gcc/gcc/objc/objc-act.c

9534 lines
266 KiB
C
Raw Normal View History

1992-01-18 00:15:38 +01:00
/* Implement classes and message passing for Objective C.
Copyright (C) 1992, 1993, 1994, 1995, 1997, 1998, 1999, 2000,
2001, 2002, 2003, 2004, 2005 Free Software Foundation, Inc.
Contributed by Steve Naroff.
1992-01-18 00:15:38 +01:00
This file is part of GCC.
1992-01-18 00:15:38 +01:00
GCC is free software; you can redistribute it and/or modify
1992-01-18 00:15:38 +01:00
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2, or (at your option)
any later version.
GCC is distributed in the hope that it will be useful,
1992-01-18 00:15:38 +01:00
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with GCC; see the file COPYING. If not, write to
2005-06-25 02:33:05 +02:00
the Free Software Foundation, 51 Franklin Street, Fifth Floor,
Boston, MA 02110-1301, USA. */
1992-01-18 00:15:38 +01:00
/* Purpose: This module implements the Objective-C 4.0 language.
compatibility issues (with the Stepstone translator):
- does not recognize the following 3.3 constructs.
@requires, @classes, @messages, = (...)
- methods with variable arguments must conform to ANSI standard.
- tagged structure definitions that appear in BOTH the interface
and implementation are not allowed.
- public/private: all instance variables are public within the
context of the implementation...I consider this to be a bug in
the translator.
- statically allocated objects are not supported. the user will
receive an error if this service is requested.
code generation `options':
*/
1992-01-18 00:15:38 +01:00
#include "config.h"
#include "system.h"
#include "coretypes.h"
#include "tm.h"
1992-01-18 00:15:38 +01:00
#include "tree.h"
splay-tree.c (splay_tree_predecessor): Fix typo in comment. * splay-tree.c (splay_tree_predecessor): Fix typo in comment. Convert the C front-end to use function-at-a-time mode. * c-common.h: Include splay-tree.h. (C_DECLARED_LABEL_FLAG): New macro. (struct language_function): Add x_scope_stmt_stack and x_function_name_declared_p. (RECHAIN_STMTS): Move definition. (lang_statment_code_p): Likewise. (lang_expand_stmt): Likewise. (lang_expand_decl_stmt): New variable. (lang_expand_function_end): Likewise. (current_scope_stmt_stack): New function. (add_decl_stmt): Likewise. (add_scope_stmt): Likewise. (mark_stmt_tree): Likewise. (struct c_lang_decl): New structure. (DECL_SAVED_TREE): Define. (c_mark_lang_decl): New function. (c_expand_start_cond): Change prototype. (c_finish_then): New function. (c_finish_else): Likewise. (current_function_name_declared): Remove. (set_current_function_name_declared): Likewise. (mark_c_language_function): Declare. (case_compare): Likewise. (c_add_case_label): Likewise. (c_expand_expr): Likewise. (c_safe_from_p): Likewise. * c-common.c (lang_expand_function_end): New variable. (struct if_elt): Add if_stmt. (c_expand_start_cond): Add the if-statement to the statement-tree, rather than generating RTL. (c_finish_then): New function. (c_expand_start_else): Don't generate RTL. (c_finish_else): New function. (c_expand_expr_stmt): Don't generate RTL. (statement_code_p): Add SCOPE_STMT. (case_compare): New function. (c_add_case_label): Likewise. (mark_stmt_tree): Likewise. (c_mark_lang_decl): Likewise. (mark_c_language_function): Likewise. (c_expand_expr): Likewise. (c_safe_from_p): Likewise. * c-decl.c (c_stmt_tree): New variable (c_scope_stmt_stack): Likewise. (c_function_name_declared_p): Likewise. (lang_expand_expr_stmt): Remove. (poplevel): Don't call output_inline_function for nested functions. (pushdecl): Don't set DECL_CONTEXT for a local declaration of an `extern' function. (redeclaration_error_message): Change means of computing whether or not a function is nested. (lookup_label): Don't call label_rtx. (init_decl_processing): Add more GC roots. (start_decl): Add DECL_STMTs to the statement-tree, rather than calling rest_of_decl_compilation. (finish_decl): Don't call expand_decl. (store_parm_decls): Begin the statement-tree, but don't generate RTL. (finish_function): Tie off the statement-tree. Call c_expand_body if appropriate. (c_expand_body): New function. (push_c_function_context): Save more information. (pop_c_function_contxt): Likewise. (copy_lang_decl): Now that we use DECL_LANG_SPECIFIC, copy it. (lang_mark_tree): Mark it. (current_stmt_tree): Adjust. (current_scope_stmt_stack): New function. (do_case): Remove. (set_current_name_declared): Likewise. (c_begin_compound_stmt): Define. (c_expand_decl_stmt): Likewise. * c-lang.c: Include rtl.h and expr.h. (lang_init): Set more language-specific hooks. * c-lex.c: Include expr.h. * c-parse.in: Changes throughout to add statements to the statement-tree, rather than generating RTL after every statement. * c-semantics.c (lang_expand_decl_stmt): Define. (add_decl_stmt): New function. (add_scope_stmt): Likewise. (finish_stmt_tree): Tweak. (genrtl_expr_stmt): Likewise. (genrtl_decl_stmt): Handle local labels, and call lang_expand_decl_stmt if required. (genrtl_for_stmt): Fix line-number handling. (genrtl_case_label): Handle cleanups. (genrtl_asm_stmt): Don't call combine_strings. (genrtl_compound_stmt): Simplify. (expand_stmt): Handle SCOPE_STMTs. * c-tree.h (struct lang_decl): New structure. (C_DECLARED_LABEL_FLAG): Remove. (c_begin_compound_stmt): Declare. (c_expand_decl_stmt): Likewise. (c_expand_start_case): Rename to c_start_case. (c_finish_case): New function. * c-typeck.c (start_init): Tweak setting of constructor_incremental. (c_expand_asm_operands): Tweak error-handling. Add to the statement-tree. (c_expand_return): Add to the statement-tree. (c_expand_start_case): Rename to ... (c_start_case): ... this. (struct c_switch): New type. (switch_stack): New variable. (do_case): Simplify. (c_finish_case): New function. * dependence.c: Include expr.h. (enum dependence_type): Change spelling of enumerals. (check_node_dependence): Adjust. * expr.h (lang_safe_from_p): Declare. (safe_from_p): Likewise. * expr.c (lang_safe_from_p): New variable. (safe_from_p): Give it external linkage. Use lang_safe_from_p. * stmt.c (expand_expr_stmt): Avoid clobberring of last_expr_type. * toplev.c (rest_of_decl_compilation): Robustify. * tree.c (contains_placeholder_p): Likewise. * Makefile.in: Update dependencies. * objc/objc-act.h: Adjust calculation of value for dummy_tree_code. * objc/objc-act.c: Include rtl.h, expr.h, and c-common.h. (objc_expand_function_end): New function. (finish_method_def): Use it. (init_objc): Initialize more language-specific hooks. * objc/Make-lang.in: Update dependencies. * cp-tree.h (struct cp_language_function): Remove x_scope_stmt_stack and name_declared. (current_scope_stmt_stack): Remove. (function_name_declared_p): New macro. (struct lang_decl_flags): Use c_lang_decl as a base class. (context): Remove. (struct lang_decl): Replace saved_tree with context. (DECL_FRIEND_CONTEXT): Adjust accordingly. (SET_DECL_FRIEND_CONTEXT): Likewise. (DECL_VIRTUAL_CONTEXT): Likewise. (DECL_SAVED_TREE): Remove. (C_DECLARED_LABEL_FLAG): Likewise. (cplus_expand_expr_stmt): Don't declare. (add_decl_stmt): Likewise. (add_scope_stmt): Likewise. * decl.c (mark_stmt_tree): Remove. (case_compare): Likewise. (finish_case_label): Use c_add_case_label. (init_decl_processing): Set more language-specific hooks. (build_enumerator): Fix typo in comment. (cplus_expand_expr_stmt): Remove. (mark_lang_function): Use mark_c_language_function. (lang_mark_tree): Use c_mark_lang_decl. * decl2.c: Change order of inclusion. * except.c: Likewise. * expr.c (cplus_expand_expr): Remove handling of STMT_EXPR. Fall back on c_expand_expr. * friend.c: Include expr.h. * init.c: Change order of inclusion. * Makefile.in: Update dependencies. * lex.h (free_lang_decl_chain): Remove. * optimize.c (maybe_clone_body): Use function_name_declared_p. * pt.c (build_template_decl): Don't copy DECL_VIRTUAL_CONTEXT if it doesn't exist. (instantiate_decl): Use function_name_declared_p. * semantics.c (lang_expand_expr_stmt): Remove. (set_current_function_name_declared): Likewise. (current_function_name_declared): Likewise. (begin_compound_stmt): Use function_name_declared_p. (add_decl_stmt): Remove. (setup_vtbl_ptr): Use function_name_declared_p. (add_scope_stmt): Remove. (current_scope_stmt_stack): New function. (cp_expand_stmt): Don't handle SCOPE_STMTs. (expand_body): Use function_name_declared_p. * tree.c (cp_statement_code_p): Don't include SCOPE_STMT. * typeck.c: Change order of includes. (convert_sequence): Remove. From-SVN: r36464
2000-09-17 09:38:23 +02:00
#include "rtl.h"
#include "tm_p.h"
splay-tree.c (splay_tree_predecessor): Fix typo in comment. * splay-tree.c (splay_tree_predecessor): Fix typo in comment. Convert the C front-end to use function-at-a-time mode. * c-common.h: Include splay-tree.h. (C_DECLARED_LABEL_FLAG): New macro. (struct language_function): Add x_scope_stmt_stack and x_function_name_declared_p. (RECHAIN_STMTS): Move definition. (lang_statment_code_p): Likewise. (lang_expand_stmt): Likewise. (lang_expand_decl_stmt): New variable. (lang_expand_function_end): Likewise. (current_scope_stmt_stack): New function. (add_decl_stmt): Likewise. (add_scope_stmt): Likewise. (mark_stmt_tree): Likewise. (struct c_lang_decl): New structure. (DECL_SAVED_TREE): Define. (c_mark_lang_decl): New function. (c_expand_start_cond): Change prototype. (c_finish_then): New function. (c_finish_else): Likewise. (current_function_name_declared): Remove. (set_current_function_name_declared): Likewise. (mark_c_language_function): Declare. (case_compare): Likewise. (c_add_case_label): Likewise. (c_expand_expr): Likewise. (c_safe_from_p): Likewise. * c-common.c (lang_expand_function_end): New variable. (struct if_elt): Add if_stmt. (c_expand_start_cond): Add the if-statement to the statement-tree, rather than generating RTL. (c_finish_then): New function. (c_expand_start_else): Don't generate RTL. (c_finish_else): New function. (c_expand_expr_stmt): Don't generate RTL. (statement_code_p): Add SCOPE_STMT. (case_compare): New function. (c_add_case_label): Likewise. (mark_stmt_tree): Likewise. (c_mark_lang_decl): Likewise. (mark_c_language_function): Likewise. (c_expand_expr): Likewise. (c_safe_from_p): Likewise. * c-decl.c (c_stmt_tree): New variable (c_scope_stmt_stack): Likewise. (c_function_name_declared_p): Likewise. (lang_expand_expr_stmt): Remove. (poplevel): Don't call output_inline_function for nested functions. (pushdecl): Don't set DECL_CONTEXT for a local declaration of an `extern' function. (redeclaration_error_message): Change means of computing whether or not a function is nested. (lookup_label): Don't call label_rtx. (init_decl_processing): Add more GC roots. (start_decl): Add DECL_STMTs to the statement-tree, rather than calling rest_of_decl_compilation. (finish_decl): Don't call expand_decl. (store_parm_decls): Begin the statement-tree, but don't generate RTL. (finish_function): Tie off the statement-tree. Call c_expand_body if appropriate. (c_expand_body): New function. (push_c_function_context): Save more information. (pop_c_function_contxt): Likewise. (copy_lang_decl): Now that we use DECL_LANG_SPECIFIC, copy it. (lang_mark_tree): Mark it. (current_stmt_tree): Adjust. (current_scope_stmt_stack): New function. (do_case): Remove. (set_current_name_declared): Likewise. (c_begin_compound_stmt): Define. (c_expand_decl_stmt): Likewise. * c-lang.c: Include rtl.h and expr.h. (lang_init): Set more language-specific hooks. * c-lex.c: Include expr.h. * c-parse.in: Changes throughout to add statements to the statement-tree, rather than generating RTL after every statement. * c-semantics.c (lang_expand_decl_stmt): Define. (add_decl_stmt): New function. (add_scope_stmt): Likewise. (finish_stmt_tree): Tweak. (genrtl_expr_stmt): Likewise. (genrtl_decl_stmt): Handle local labels, and call lang_expand_decl_stmt if required. (genrtl_for_stmt): Fix line-number handling. (genrtl_case_label): Handle cleanups. (genrtl_asm_stmt): Don't call combine_strings. (genrtl_compound_stmt): Simplify. (expand_stmt): Handle SCOPE_STMTs. * c-tree.h (struct lang_decl): New structure. (C_DECLARED_LABEL_FLAG): Remove. (c_begin_compound_stmt): Declare. (c_expand_decl_stmt): Likewise. (c_expand_start_case): Rename to c_start_case. (c_finish_case): New function. * c-typeck.c (start_init): Tweak setting of constructor_incremental. (c_expand_asm_operands): Tweak error-handling. Add to the statement-tree. (c_expand_return): Add to the statement-tree. (c_expand_start_case): Rename to ... (c_start_case): ... this. (struct c_switch): New type. (switch_stack): New variable. (do_case): Simplify. (c_finish_case): New function. * dependence.c: Include expr.h. (enum dependence_type): Change spelling of enumerals. (check_node_dependence): Adjust. * expr.h (lang_safe_from_p): Declare. (safe_from_p): Likewise. * expr.c (lang_safe_from_p): New variable. (safe_from_p): Give it external linkage. Use lang_safe_from_p. * stmt.c (expand_expr_stmt): Avoid clobberring of last_expr_type. * toplev.c (rest_of_decl_compilation): Robustify. * tree.c (contains_placeholder_p): Likewise. * Makefile.in: Update dependencies. * objc/objc-act.h: Adjust calculation of value for dummy_tree_code. * objc/objc-act.c: Include rtl.h, expr.h, and c-common.h. (objc_expand_function_end): New function. (finish_method_def): Use it. (init_objc): Initialize more language-specific hooks. * objc/Make-lang.in: Update dependencies. * cp-tree.h (struct cp_language_function): Remove x_scope_stmt_stack and name_declared. (current_scope_stmt_stack): Remove. (function_name_declared_p): New macro. (struct lang_decl_flags): Use c_lang_decl as a base class. (context): Remove. (struct lang_decl): Replace saved_tree with context. (DECL_FRIEND_CONTEXT): Adjust accordingly. (SET_DECL_FRIEND_CONTEXT): Likewise. (DECL_VIRTUAL_CONTEXT): Likewise. (DECL_SAVED_TREE): Remove. (C_DECLARED_LABEL_FLAG): Likewise. (cplus_expand_expr_stmt): Don't declare. (add_decl_stmt): Likewise. (add_scope_stmt): Likewise. * decl.c (mark_stmt_tree): Remove. (case_compare): Likewise. (finish_case_label): Use c_add_case_label. (init_decl_processing): Set more language-specific hooks. (build_enumerator): Fix typo in comment. (cplus_expand_expr_stmt): Remove. (mark_lang_function): Use mark_c_language_function. (lang_mark_tree): Use c_mark_lang_decl. * decl2.c: Change order of inclusion. * except.c: Likewise. * expr.c (cplus_expand_expr): Remove handling of STMT_EXPR. Fall back on c_expand_expr. * friend.c: Include expr.h. * init.c: Change order of inclusion. * Makefile.in: Update dependencies. * lex.h (free_lang_decl_chain): Remove. * optimize.c (maybe_clone_body): Use function_name_declared_p. * pt.c (build_template_decl): Don't copy DECL_VIRTUAL_CONTEXT if it doesn't exist. (instantiate_decl): Use function_name_declared_p. * semantics.c (lang_expand_expr_stmt): Remove. (set_current_function_name_declared): Likewise. (current_function_name_declared): Likewise. (begin_compound_stmt): Use function_name_declared_p. (add_decl_stmt): Remove. (setup_vtbl_ptr): Use function_name_declared_p. (add_scope_stmt): Remove. (current_scope_stmt_stack): New function. (cp_expand_stmt): Don't handle SCOPE_STMTs. (expand_body): Use function_name_declared_p. * tree.c (cp_statement_code_p): Don't include SCOPE_STMT. * typeck.c: Change order of includes. (convert_sequence): Remove. From-SVN: r36464
2000-09-17 09:38:23 +02:00
#include "expr.h"
Makefile.in (c-parse.o): Depend on $(C_COMMON_H). [gcc/ChangeLog] 2004-09-07 Ziemowit Laski <zlaski@apple.com> * Makefile.in (c-parse.o): Depend on $(C_COMMON_H). * c-parse.in: Include c-common.h instead of objc-act.h. (ivar_decl_list, ivar_decls, ivar_decl, ivars, ivar_declarator, myparms, myparm): Remove %type declarations. (methodtype, optparms, OBJC_TYPE_QUAL, objc_quals, objc_qual, objc_typename, objc_try_catch_stmt, optellipsis): Add %type declarations. (objc_inherit_code, objc_public_flag): Remove. (typespec_nonreserved_nonattr): Call objc_get_protocol_qualified_type() instead of get_static_reference() and get_protocol_reference(). (stmt_nocomp): Call grokparm() on @catch parameter. (objcdef): Move semantic action to objc_finish_implementation(). (classdef): Move semantic action to objc_start_class_interface(), objc_continue_interface(), objc_finish_interface(), objc_start_class_implementation(), objc_continue_implementation(), objc_start_category_interface() and objc_start_category_implementation(). (protocoldef): Move semantic actions to objc_start_protocol() and objc_finish_interface(). (ivar_decl_list): Remove nonterminal. (visibility_spec): Move semantic actions to objc_set_visibility(). (ivar_decls): Remove assignment to $$. (ivar_decl): Rephrase in terms of component_decl; call objc_add_instance_variable(). (ivars, ivar_declarator): Remove nonterminals. (opt_semi): New nonterminal. (methodtype): Remove semantic actions. (methoddef): Move semantic actions to objc_set_method_type(), objc_start_method_definition() and objc_finish_method_definition(). (methodproto): Move semantic actions to objc_set_method_type() and objc_add_method_declaration(). (methoddecl): Use objc_typename instead of typename; move semantic actions to objc_build_method_signature(). (optarglist, myxdecls, mydecl, myparms, myparm): Remove nonterminals. (optparmlist): Express in terms of optparms and optellipsis. (optparms, optellipsis, objc_qual, objc_quals, objc_typename): New nonterminals. (keyworddecl): Use objc_typename instead of typename. (rid_to_yy): Mark RID_IN, RID_OUT, RID_INOUT, RID_BYCOPY, RID_BYREF and RID_ONEWAY as returning OBJC_TYPE_QUAL to yyparse(). [gcc/objc/ChangeLog] 2004-09-07 Ziemowit Laski <zlaski@apple.com> * Make-lang.in (objc/objc-parse.o): Depend on $(C_COMMON_H) instead of objc/objc-act.h. (objc/objc-act.o): Depend on $(HASHTAB_H). * objc-act.c: Include hashtab.h; in ObjC++ mode, include cp-tree.h and objcp-decl.h instead of c-tree.h. (build_module_descriptor, get_class_ivars, synth_id_with_class_suffix, error_with_ivar, gen_method_decl, gen_declaration, setup_string_decl, build_protocol_template): Adjust prototypes. (build_module_initializer_routine, start_class, continue_class, finish_class, start_method_def, objc_start_function, start_protocol, build_method_decl, objc_add_method, add_instance_variable, build_ivar_reference, is_ivar, is_private, get_super_receiver, build_selector_table_decl, objc_push_parm, objc_get_parm_info, gen_type_name, gen_type_name_0, start_var_decl, finish_var_decl, create_field_decl): New prototypes. (objc_expand_function_end, comp_method_with_proto, objc_expr_last, gen_declaration_1, gen_declarator, is_complex_decl, adorn_decl, define_decl, create_builtin_decl, gen_declspecs): Remove prototypes. (TYPE_ID): Rename to OBJECT_TYPEDEF_NAME. (CLASS_TYPEDEF_NAME): New. (TAG_EXECCLASS): Change from a global variable to a #define. (TAG_RETURN_STRUCT): Delete. (TAG_GNUINIT): New, holds '__objc_gnu_init' name. (objc_inherit_code, objc_public_flag): New, moved from c-parse.in. (string_descriptor): New struct. (string_htab): New hash table. (string_hash, string_eq): New prototypes. (generate_struct_by_value_array): Call create_field_decl() instead of create_builtin_decl(). (objc_init): Do not initialize objc_ellipsis_node or TAG_EXECCLASS; In ObjC++ mode, call cxx_init() instead of c_objc_common_init(). (objc_finish_file): In ObjC++, call instantiate_pending_templates() and cp_finish_file(). (define_decl, get_static_reference, get_protocol_reference, create_builtin_decl): Remove functions. (objc_start_class_interface, objc_start_category_interface, objc_start_protocol, objc_continue_interface, objc_finish_interface, objc_start_class_implementation, objc_start_category_implementation, objc_continue_implementation, objc_finish_implementation, objc_set_visibility, objc_set_method_type, objc_build_method_signature, objc_add_method_declaration, objc_start_method_definition, objc_add_instance_variable, objc_get_protocol_qualified_type, create_field_decl, start_var_decl, finish_var_decl): New functions. (setup_string_decl): Simplify since it is only called once. (synth_module_prologue): Call build_class_template(); predefine 'id' and 'Class' as typedefs; rename 'temp_type' to 'type'; disable debug hooks for duration of function; fix GNU runtime messenger signatures to correspond to reality; forward-declare '__objc_exec_class' for the GNU runtime; call build_selector_table_decl(); in ObjC++ mode, generate 'extern "C" { ... }' wrappers around synthesized declarations; call build_protocol_template() and build_category_template(). (string_hash, string_eq): New functions. (objc_build_string_object): Check metaclass correctness only once; store string literals in hash table. (objc_build_constructor): Do not convert initializer elements; adjust for ObjC++ impedance mismatch. (build_objc_symtab_template): Call create_field_decl() instead of create_builtin_decl(). (init_objc_symtab): Add missing conversion to initializer element. (build_metadata_decl): Call start_var_decl() instead of define_decl(). (generate_objc_symtab_decl): Do not call build_category_template(); call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(). (build_module_descriptor): Call create_field_decl() instead of grokfield(); call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(); always mark module descriptor as used; move GNU runtime-specific functionality to build_module_initializer_routine(). (build_module_initializer_routine): New function, broken off of build_module_descriptor(). (objc_static_init_needed_p, objc_generate_static_init_call): New functions. (generate_static_references, generate_strings, build_selector_translation_table, generate_descriptor_table, generate_ivars_list, generate_dispatch_table, generate_category): Call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(); build a type directly instead of via groktypename(). (build_selector_reference_decl, build_selector_table_decl, build_class_reference_decl, build_protocol_reference, generate_objc_image_info): Call start_var_decl() instead of build_decl(). (build_selector_reference): For GNU runtime, do not call build_selector_reference_decl(). (build_selector, build_typed_selector_reference): Always convert result to the selector type. (add_objc_string): Cast return value to 'char *'. (build_method_prototype_template, build_selector_template, build_method_template): Use actual selector type for fields pointing to selectors. (finish_objc): For GNU runtime, call build_module_initializer_routine() after build_module_descriptor(). (generate_protocol_list, generate_shared_structures): Call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(); build a type directly instead of via groktypename(). (synth_id_with_class_suffix): Return a string. (get_arg_type_list): For instance methods, use the instance type for 'self'; do not call groktypename_in_parm_context(). (build_objc_string_decl): Squash redeclaration errors in ObjC++. (objc_is_class_name): Use OBJC_TYPE_NAME instead of TYPE_NAME; handle RECORD_TYPEs in ObjC as well as ObjC++. (objc_is_id): New function. (objc_is_object_ptr): Return the canonical type node. (objc_get_class_ivars): Simplify using get_class_ivars(). (get_class_ivars): Remove second parameter; create a fresh copy of the ivar list for each call; do not check for existence of super class. (objc_eh_runtime_type): Mark #ifndef OBJCPLUS. (objc_init_exceptions): When using SJLJ-style exceptions, require the use of '-fobjc-exceptions' flag; do not require it for DWARF-style exceptions. (objc_build_exc_ptr, next_sjlj_build_try_catch_finally): Use objc_object_type instead of objc_id_type. (objc_begin_catch_clause): Convert the incoming PARM_DECL into a VAR_DECL before placing it in the appropriate scope; do not call define_decl(); adjust call to c_begin_compound_stmt(); use objc_object_type instead of objc_id_type. (build_next_objc_exception_stuff): Call create_field_decl() instead of create_builtin_decl(); construct type directly instead of calling groktypename(); use OBJC_VOID_AT_END to mark end of function parameters. (build_private_template): Adjust call to get_class_ivars(); build a type directly instead of via groktypename(). (build_protocol_template, build_method_prototype_list_template, build_method_prototype_template, build_category_template, build_selector_template, build_class_template, build_super_template, build_ivar_template, build_ivar_list_template, build_method_list_template, build_method_template): Call create_field_decl() instead of grokfield(). (objc_method_parm_type): Do not call groktypename(). (generate_descriptor_table): Call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(). (generate_method_descriptors, build_protocol_initializer, generate_dispatch_tables, build_category_initializer, build_shared_structure_initializer): Do not call groktypename(). (generate_protocols): Call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(); do not call groktypename(). (error_with_ivar): Remove last parameter. (check_ivars): Do not iterate ovar CLASS_RAW_IVARS lists in addition to CLASS_IVARS lists; adjust calls to error_with_ivar(). (generate_ivar_lists): Convert one of the initializer elements; do not call groktypename(). (get_arg_type_list, start_method_def, gen_method_def): Account for new representation of variable arguments and '...' in Objective-C methods; add Objective-C++ impedance matching code. (is_objc_type_qualifier): Remove function. (adjust_type_for_id_default): Simplify; there is no longer a need to wade through declspecs. (lookup_interface, start_class, continue_class, finish_class, start_method_def, start_protocol, build_method_decl, objc_add_method, add_instance_variable, build_ivar_reference, is_ivar, is_private, get_super_receiver, objc_build_finally_epilogue): Make into static functions. (receiver_is_class_object): Use new IS_CLASS() macro. (objc_build_message_expr): Tweak ObjC++ message argument handling; call objc_finish_message_expr() instead of finish_message_expr(). (finish_message_expr): Rename to objc_finish_message_expr(); use OBJC_TYPE_NAME and OBJC_SET_TYPE_NAME macros instead of TYPE_NAME. call gen_type_name() instead of gen_declaration(); call objc_is_id() instead of using IS_ID and IS_CLASS; Use objc_class_name instead of calling get_identifier("Class"); handle CONVERT_EXPRs in receiver. (build_objc_method_call, warn_with_method): Do not call groktypename(). (build_ivar_reference): Call convert() instead of clobbering in a type. (hash_init): Initialize string_htab hash table. (add_instance_variable): Simplify parameter list; do not call grokfield(); do not populate CLASS_IVARS list. (start_class): Check for the existence of super class, if one was specified. (continue_class): Use CLASS_RAW_IVARS rather than CLASS_IVARS; do not call build_class_template(); adjust call to get_class_ivars(); call build_decl(), pushdecl() and finish_decl() instead of define_decl(). (finish_class): Call build_decl(), pushdecl() and finish_decl() instead of define_decl(). (add_protocols): Use PROTOCOL_BINFO_ELTS for the tree vector size. (start_protocol): Do not call build_protocol_template(); use PROTOCOL_BINFO_ELTS for the tree vector size. (encode_type_qualifiers): Do not handle the 'const' qualifier here. (encode_pointer): Encode 'const char *' as 'r*', for backwards compatibility. (encode_array): Use HOST_WIDE_INT_PRINT_DEC instead of "%ld". (encode_type): Handle the 'const' qualifier here. (objc_parmlist): New global variable, sued by objc_push_parm and objc_get_parm_info(). (objc_push_parm, objc_get_parm_info): New functions. (objc_expr_last): Remove function. (synth_self_and_ucmd_args): For instance methods, use the instance type for 'self'; call objc_push_parm() instead of push_parm_decl(). (start_method_def): Do not call push_scope(), declare_parm_level(), pop_scope(), push_parm_decl(), store_parm_decls() or objc_expr_last(); just use objc_push_parm() and objc_get_parm_info(). (comp_method_with_proto): Remove function. (objc_types_are_equivalent): Strip away indirections before comparing underlying types. (comp_proto_with_proto): Do not call groktypename(); types are no longer in raw declspec format. (objc_start_function): New function. (really_start_method): Call comp_proto_with_proto() instead of comp_method_with_proto(); call objc_start_function() instead of hand-crafting a function declarator. (continue_method_def, objc_expand_function_end): Remove functions. (get_super_receiver): Call objc_get_current_scope() instead of get_current_scope(); reference 'super_class' field (instead of 'class'). (finish_method_def): Rename to objc_finish_method_definition() and add a function decl parameter; move method encoding call from objc_expand_function_end(). (is_complex_decl, adorn_decl, gen_declarator, gen_declspecs, gen_declaration_1): Remove functions. (tmpbuf, RAW_DECLSPEC): Remove. (gen_declaration): Remove second parameter; simplify to deal with TYPE_P nodes instead of raw declspecs. (gen_type_name, gen_type_name_0): New functions. (gen_method_decl): Remove second parameter; call gen_type_name() instead of gen_declaration_1(). (dump_interface): Adjust calls to gen_declaration() and gen_method_decl(); do not allocate a separate string buffer. (init_objc): Allocate a larger string buffer to accommodate dump_interface(); adjust call to build_module_descriptor(); add call to build_module_initializer_routine() for the GNU runtime. (generate_classref_translation_entry): Do not call start_decl(); call finish_var_decl() instead of finish_decl(); call convert() instead of build_c_cast(). * objc-act.h (CLASS_OWN_IVARS): Remove accessor. (CLASS_BINFO_ELTS): Reduce from 6 to 5, now that CLASS_OWN_IVARS is gone. (OCTI_GNU_INIT_DECL, GNU_INIT_decl): New. (OCTI_ELLIPSIS_NODE, objc_ellipsis_node): Remove. (OCTI_ID_ID, id_type, objc_id_id): Rename to OCTI_ID_NAME, objc_object_type and objc_object_name, respectively. (OCTI_CLS_REF, OCTI_CLASS_NAME, objc_class_reference, objc_class_name): New. (IS_CLASS): New macro. (IS_ID, IS_SUPER): Robustify. (OCTI_EXECCLASS_DECL, execclass_decl): New. (finish_file, start_class, continue_class, finish_class, start_method_def, continue_method_def, finish_method_def, start_protocol, finish_protocol, objc_build_throw_stmt, objc_build_try_catch_finally_stmt, objc_build_synchronized_prologue, objc_build_synchronized_epilogue, objc_build_try_prologue, objc_build_try_epilogue, objc_build_catch_stmt, objc_build_catch_epilogue, objc_build_finally_prologue, objc_build_finally_epilogue, is_ivar, is_private, is_public, add_instance_variable, objc_add_method, get_super_receiver, objc_clear_super_receiver, get_class_ivars_from_name, get_class_reference, get_static_reference, get_object_reference, build_message_expr, finish_message_expr, build_selector_expr, build_ivar_reference, build_keyword_decl, build_method_decl, build_protocol_expr, build_objc_string_object, objc_declare_alias, objc_declare_class, objc_declare_protocols, objc_comptypes, objc_check_decl, build_encode_expr): Remove prototypes. (imp_count, cat_count): Make GGC-aware. (OBJC_SET_TYPE_NAME): New macro. From-SVN: r87168
2004-09-08 02:49:44 +02:00
#ifdef OBJCPLUS
#include "cp-tree.h"
#else
1992-01-18 00:15:38 +01:00
#include "c-tree.h"
Makefile.in (c-parse.o): Depend on $(C_COMMON_H). [gcc/ChangeLog] 2004-09-07 Ziemowit Laski <zlaski@apple.com> * Makefile.in (c-parse.o): Depend on $(C_COMMON_H). * c-parse.in: Include c-common.h instead of objc-act.h. (ivar_decl_list, ivar_decls, ivar_decl, ivars, ivar_declarator, myparms, myparm): Remove %type declarations. (methodtype, optparms, OBJC_TYPE_QUAL, objc_quals, objc_qual, objc_typename, objc_try_catch_stmt, optellipsis): Add %type declarations. (objc_inherit_code, objc_public_flag): Remove. (typespec_nonreserved_nonattr): Call objc_get_protocol_qualified_type() instead of get_static_reference() and get_protocol_reference(). (stmt_nocomp): Call grokparm() on @catch parameter. (objcdef): Move semantic action to objc_finish_implementation(). (classdef): Move semantic action to objc_start_class_interface(), objc_continue_interface(), objc_finish_interface(), objc_start_class_implementation(), objc_continue_implementation(), objc_start_category_interface() and objc_start_category_implementation(). (protocoldef): Move semantic actions to objc_start_protocol() and objc_finish_interface(). (ivar_decl_list): Remove nonterminal. (visibility_spec): Move semantic actions to objc_set_visibility(). (ivar_decls): Remove assignment to $$. (ivar_decl): Rephrase in terms of component_decl; call objc_add_instance_variable(). (ivars, ivar_declarator): Remove nonterminals. (opt_semi): New nonterminal. (methodtype): Remove semantic actions. (methoddef): Move semantic actions to objc_set_method_type(), objc_start_method_definition() and objc_finish_method_definition(). (methodproto): Move semantic actions to objc_set_method_type() and objc_add_method_declaration(). (methoddecl): Use objc_typename instead of typename; move semantic actions to objc_build_method_signature(). (optarglist, myxdecls, mydecl, myparms, myparm): Remove nonterminals. (optparmlist): Express in terms of optparms and optellipsis. (optparms, optellipsis, objc_qual, objc_quals, objc_typename): New nonterminals. (keyworddecl): Use objc_typename instead of typename. (rid_to_yy): Mark RID_IN, RID_OUT, RID_INOUT, RID_BYCOPY, RID_BYREF and RID_ONEWAY as returning OBJC_TYPE_QUAL to yyparse(). [gcc/objc/ChangeLog] 2004-09-07 Ziemowit Laski <zlaski@apple.com> * Make-lang.in (objc/objc-parse.o): Depend on $(C_COMMON_H) instead of objc/objc-act.h. (objc/objc-act.o): Depend on $(HASHTAB_H). * objc-act.c: Include hashtab.h; in ObjC++ mode, include cp-tree.h and objcp-decl.h instead of c-tree.h. (build_module_descriptor, get_class_ivars, synth_id_with_class_suffix, error_with_ivar, gen_method_decl, gen_declaration, setup_string_decl, build_protocol_template): Adjust prototypes. (build_module_initializer_routine, start_class, continue_class, finish_class, start_method_def, objc_start_function, start_protocol, build_method_decl, objc_add_method, add_instance_variable, build_ivar_reference, is_ivar, is_private, get_super_receiver, build_selector_table_decl, objc_push_parm, objc_get_parm_info, gen_type_name, gen_type_name_0, start_var_decl, finish_var_decl, create_field_decl): New prototypes. (objc_expand_function_end, comp_method_with_proto, objc_expr_last, gen_declaration_1, gen_declarator, is_complex_decl, adorn_decl, define_decl, create_builtin_decl, gen_declspecs): Remove prototypes. (TYPE_ID): Rename to OBJECT_TYPEDEF_NAME. (CLASS_TYPEDEF_NAME): New. (TAG_EXECCLASS): Change from a global variable to a #define. (TAG_RETURN_STRUCT): Delete. (TAG_GNUINIT): New, holds '__objc_gnu_init' name. (objc_inherit_code, objc_public_flag): New, moved from c-parse.in. (string_descriptor): New struct. (string_htab): New hash table. (string_hash, string_eq): New prototypes. (generate_struct_by_value_array): Call create_field_decl() instead of create_builtin_decl(). (objc_init): Do not initialize objc_ellipsis_node or TAG_EXECCLASS; In ObjC++ mode, call cxx_init() instead of c_objc_common_init(). (objc_finish_file): In ObjC++, call instantiate_pending_templates() and cp_finish_file(). (define_decl, get_static_reference, get_protocol_reference, create_builtin_decl): Remove functions. (objc_start_class_interface, objc_start_category_interface, objc_start_protocol, objc_continue_interface, objc_finish_interface, objc_start_class_implementation, objc_start_category_implementation, objc_continue_implementation, objc_finish_implementation, objc_set_visibility, objc_set_method_type, objc_build_method_signature, objc_add_method_declaration, objc_start_method_definition, objc_add_instance_variable, objc_get_protocol_qualified_type, create_field_decl, start_var_decl, finish_var_decl): New functions. (setup_string_decl): Simplify since it is only called once. (synth_module_prologue): Call build_class_template(); predefine 'id' and 'Class' as typedefs; rename 'temp_type' to 'type'; disable debug hooks for duration of function; fix GNU runtime messenger signatures to correspond to reality; forward-declare '__objc_exec_class' for the GNU runtime; call build_selector_table_decl(); in ObjC++ mode, generate 'extern "C" { ... }' wrappers around synthesized declarations; call build_protocol_template() and build_category_template(). (string_hash, string_eq): New functions. (objc_build_string_object): Check metaclass correctness only once; store string literals in hash table. (objc_build_constructor): Do not convert initializer elements; adjust for ObjC++ impedance mismatch. (build_objc_symtab_template): Call create_field_decl() instead of create_builtin_decl(). (init_objc_symtab): Add missing conversion to initializer element. (build_metadata_decl): Call start_var_decl() instead of define_decl(). (generate_objc_symtab_decl): Do not call build_category_template(); call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(). (build_module_descriptor): Call create_field_decl() instead of grokfield(); call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(); always mark module descriptor as used; move GNU runtime-specific functionality to build_module_initializer_routine(). (build_module_initializer_routine): New function, broken off of build_module_descriptor(). (objc_static_init_needed_p, objc_generate_static_init_call): New functions. (generate_static_references, generate_strings, build_selector_translation_table, generate_descriptor_table, generate_ivars_list, generate_dispatch_table, generate_category): Call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(); build a type directly instead of via groktypename(). (build_selector_reference_decl, build_selector_table_decl, build_class_reference_decl, build_protocol_reference, generate_objc_image_info): Call start_var_decl() instead of build_decl(). (build_selector_reference): For GNU runtime, do not call build_selector_reference_decl(). (build_selector, build_typed_selector_reference): Always convert result to the selector type. (add_objc_string): Cast return value to 'char *'. (build_method_prototype_template, build_selector_template, build_method_template): Use actual selector type for fields pointing to selectors. (finish_objc): For GNU runtime, call build_module_initializer_routine() after build_module_descriptor(). (generate_protocol_list, generate_shared_structures): Call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(); build a type directly instead of via groktypename(). (synth_id_with_class_suffix): Return a string. (get_arg_type_list): For instance methods, use the instance type for 'self'; do not call groktypename_in_parm_context(). (build_objc_string_decl): Squash redeclaration errors in ObjC++. (objc_is_class_name): Use OBJC_TYPE_NAME instead of TYPE_NAME; handle RECORD_TYPEs in ObjC as well as ObjC++. (objc_is_id): New function. (objc_is_object_ptr): Return the canonical type node. (objc_get_class_ivars): Simplify using get_class_ivars(). (get_class_ivars): Remove second parameter; create a fresh copy of the ivar list for each call; do not check for existence of super class. (objc_eh_runtime_type): Mark #ifndef OBJCPLUS. (objc_init_exceptions): When using SJLJ-style exceptions, require the use of '-fobjc-exceptions' flag; do not require it for DWARF-style exceptions. (objc_build_exc_ptr, next_sjlj_build_try_catch_finally): Use objc_object_type instead of objc_id_type. (objc_begin_catch_clause): Convert the incoming PARM_DECL into a VAR_DECL before placing it in the appropriate scope; do not call define_decl(); adjust call to c_begin_compound_stmt(); use objc_object_type instead of objc_id_type. (build_next_objc_exception_stuff): Call create_field_decl() instead of create_builtin_decl(); construct type directly instead of calling groktypename(); use OBJC_VOID_AT_END to mark end of function parameters. (build_private_template): Adjust call to get_class_ivars(); build a type directly instead of via groktypename(). (build_protocol_template, build_method_prototype_list_template, build_method_prototype_template, build_category_template, build_selector_template, build_class_template, build_super_template, build_ivar_template, build_ivar_list_template, build_method_list_template, build_method_template): Call create_field_decl() instead of grokfield(). (objc_method_parm_type): Do not call groktypename(). (generate_descriptor_table): Call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(). (generate_method_descriptors, build_protocol_initializer, generate_dispatch_tables, build_category_initializer, build_shared_structure_initializer): Do not call groktypename(). (generate_protocols): Call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(); do not call groktypename(). (error_with_ivar): Remove last parameter. (check_ivars): Do not iterate ovar CLASS_RAW_IVARS lists in addition to CLASS_IVARS lists; adjust calls to error_with_ivar(). (generate_ivar_lists): Convert one of the initializer elements; do not call groktypename(). (get_arg_type_list, start_method_def, gen_method_def): Account for new representation of variable arguments and '...' in Objective-C methods; add Objective-C++ impedance matching code. (is_objc_type_qualifier): Remove function. (adjust_type_for_id_default): Simplify; there is no longer a need to wade through declspecs. (lookup_interface, start_class, continue_class, finish_class, start_method_def, start_protocol, build_method_decl, objc_add_method, add_instance_variable, build_ivar_reference, is_ivar, is_private, get_super_receiver, objc_build_finally_epilogue): Make into static functions. (receiver_is_class_object): Use new IS_CLASS() macro. (objc_build_message_expr): Tweak ObjC++ message argument handling; call objc_finish_message_expr() instead of finish_message_expr(). (finish_message_expr): Rename to objc_finish_message_expr(); use OBJC_TYPE_NAME and OBJC_SET_TYPE_NAME macros instead of TYPE_NAME. call gen_type_name() instead of gen_declaration(); call objc_is_id() instead of using IS_ID and IS_CLASS; Use objc_class_name instead of calling get_identifier("Class"); handle CONVERT_EXPRs in receiver. (build_objc_method_call, warn_with_method): Do not call groktypename(). (build_ivar_reference): Call convert() instead of clobbering in a type. (hash_init): Initialize string_htab hash table. (add_instance_variable): Simplify parameter list; do not call grokfield(); do not populate CLASS_IVARS list. (start_class): Check for the existence of super class, if one was specified. (continue_class): Use CLASS_RAW_IVARS rather than CLASS_IVARS; do not call build_class_template(); adjust call to get_class_ivars(); call build_decl(), pushdecl() and finish_decl() instead of define_decl(). (finish_class): Call build_decl(), pushdecl() and finish_decl() instead of define_decl(). (add_protocols): Use PROTOCOL_BINFO_ELTS for the tree vector size. (start_protocol): Do not call build_protocol_template(); use PROTOCOL_BINFO_ELTS for the tree vector size. (encode_type_qualifiers): Do not handle the 'const' qualifier here. (encode_pointer): Encode 'const char *' as 'r*', for backwards compatibility. (encode_array): Use HOST_WIDE_INT_PRINT_DEC instead of "%ld". (encode_type): Handle the 'const' qualifier here. (objc_parmlist): New global variable, sued by objc_push_parm and objc_get_parm_info(). (objc_push_parm, objc_get_parm_info): New functions. (objc_expr_last): Remove function. (synth_self_and_ucmd_args): For instance methods, use the instance type for 'self'; call objc_push_parm() instead of push_parm_decl(). (start_method_def): Do not call push_scope(), declare_parm_level(), pop_scope(), push_parm_decl(), store_parm_decls() or objc_expr_last(); just use objc_push_parm() and objc_get_parm_info(). (comp_method_with_proto): Remove function. (objc_types_are_equivalent): Strip away indirections before comparing underlying types. (comp_proto_with_proto): Do not call groktypename(); types are no longer in raw declspec format. (objc_start_function): New function. (really_start_method): Call comp_proto_with_proto() instead of comp_method_with_proto(); call objc_start_function() instead of hand-crafting a function declarator. (continue_method_def, objc_expand_function_end): Remove functions. (get_super_receiver): Call objc_get_current_scope() instead of get_current_scope(); reference 'super_class' field (instead of 'class'). (finish_method_def): Rename to objc_finish_method_definition() and add a function decl parameter; move method encoding call from objc_expand_function_end(). (is_complex_decl, adorn_decl, gen_declarator, gen_declspecs, gen_declaration_1): Remove functions. (tmpbuf, RAW_DECLSPEC): Remove. (gen_declaration): Remove second parameter; simplify to deal with TYPE_P nodes instead of raw declspecs. (gen_type_name, gen_type_name_0): New functions. (gen_method_decl): Remove second parameter; call gen_type_name() instead of gen_declaration_1(). (dump_interface): Adjust calls to gen_declaration() and gen_method_decl(); do not allocate a separate string buffer. (init_objc): Allocate a larger string buffer to accommodate dump_interface(); adjust call to build_module_descriptor(); add call to build_module_initializer_routine() for the GNU runtime. (generate_classref_translation_entry): Do not call start_decl(); call finish_var_decl() instead of finish_decl(); call convert() instead of build_c_cast(). * objc-act.h (CLASS_OWN_IVARS): Remove accessor. (CLASS_BINFO_ELTS): Reduce from 6 to 5, now that CLASS_OWN_IVARS is gone. (OCTI_GNU_INIT_DECL, GNU_INIT_decl): New. (OCTI_ELLIPSIS_NODE, objc_ellipsis_node): Remove. (OCTI_ID_ID, id_type, objc_id_id): Rename to OCTI_ID_NAME, objc_object_type and objc_object_name, respectively. (OCTI_CLS_REF, OCTI_CLASS_NAME, objc_class_reference, objc_class_name): New. (IS_CLASS): New macro. (IS_ID, IS_SUPER): Robustify. (OCTI_EXECCLASS_DECL, execclass_decl): New. (finish_file, start_class, continue_class, finish_class, start_method_def, continue_method_def, finish_method_def, start_protocol, finish_protocol, objc_build_throw_stmt, objc_build_try_catch_finally_stmt, objc_build_synchronized_prologue, objc_build_synchronized_epilogue, objc_build_try_prologue, objc_build_try_epilogue, objc_build_catch_stmt, objc_build_catch_epilogue, objc_build_finally_prologue, objc_build_finally_epilogue, is_ivar, is_private, is_public, add_instance_variable, objc_add_method, get_super_receiver, objc_clear_super_receiver, get_class_ivars_from_name, get_class_reference, get_static_reference, get_object_reference, build_message_expr, finish_message_expr, build_selector_expr, build_ivar_reference, build_keyword_decl, build_method_decl, build_protocol_expr, build_objc_string_object, objc_declare_alias, objc_declare_class, objc_declare_protocols, objc_comptypes, objc_check_decl, build_encode_expr): Remove prototypes. (imp_count, cat_count): Make GGC-aware. (OBJC_SET_TYPE_NAME): New macro. From-SVN: r87168
2004-09-08 02:49:44 +02:00
#endif
splay-tree.c (splay_tree_predecessor): Fix typo in comment. * splay-tree.c (splay_tree_predecessor): Fix typo in comment. Convert the C front-end to use function-at-a-time mode. * c-common.h: Include splay-tree.h. (C_DECLARED_LABEL_FLAG): New macro. (struct language_function): Add x_scope_stmt_stack and x_function_name_declared_p. (RECHAIN_STMTS): Move definition. (lang_statment_code_p): Likewise. (lang_expand_stmt): Likewise. (lang_expand_decl_stmt): New variable. (lang_expand_function_end): Likewise. (current_scope_stmt_stack): New function. (add_decl_stmt): Likewise. (add_scope_stmt): Likewise. (mark_stmt_tree): Likewise. (struct c_lang_decl): New structure. (DECL_SAVED_TREE): Define. (c_mark_lang_decl): New function. (c_expand_start_cond): Change prototype. (c_finish_then): New function. (c_finish_else): Likewise. (current_function_name_declared): Remove. (set_current_function_name_declared): Likewise. (mark_c_language_function): Declare. (case_compare): Likewise. (c_add_case_label): Likewise. (c_expand_expr): Likewise. (c_safe_from_p): Likewise. * c-common.c (lang_expand_function_end): New variable. (struct if_elt): Add if_stmt. (c_expand_start_cond): Add the if-statement to the statement-tree, rather than generating RTL. (c_finish_then): New function. (c_expand_start_else): Don't generate RTL. (c_finish_else): New function. (c_expand_expr_stmt): Don't generate RTL. (statement_code_p): Add SCOPE_STMT. (case_compare): New function. (c_add_case_label): Likewise. (mark_stmt_tree): Likewise. (c_mark_lang_decl): Likewise. (mark_c_language_function): Likewise. (c_expand_expr): Likewise. (c_safe_from_p): Likewise. * c-decl.c (c_stmt_tree): New variable (c_scope_stmt_stack): Likewise. (c_function_name_declared_p): Likewise. (lang_expand_expr_stmt): Remove. (poplevel): Don't call output_inline_function for nested functions. (pushdecl): Don't set DECL_CONTEXT for a local declaration of an `extern' function. (redeclaration_error_message): Change means of computing whether or not a function is nested. (lookup_label): Don't call label_rtx. (init_decl_processing): Add more GC roots. (start_decl): Add DECL_STMTs to the statement-tree, rather than calling rest_of_decl_compilation. (finish_decl): Don't call expand_decl. (store_parm_decls): Begin the statement-tree, but don't generate RTL. (finish_function): Tie off the statement-tree. Call c_expand_body if appropriate. (c_expand_body): New function. (push_c_function_context): Save more information. (pop_c_function_contxt): Likewise. (copy_lang_decl): Now that we use DECL_LANG_SPECIFIC, copy it. (lang_mark_tree): Mark it. (current_stmt_tree): Adjust. (current_scope_stmt_stack): New function. (do_case): Remove. (set_current_name_declared): Likewise. (c_begin_compound_stmt): Define. (c_expand_decl_stmt): Likewise. * c-lang.c: Include rtl.h and expr.h. (lang_init): Set more language-specific hooks. * c-lex.c: Include expr.h. * c-parse.in: Changes throughout to add statements to the statement-tree, rather than generating RTL after every statement. * c-semantics.c (lang_expand_decl_stmt): Define. (add_decl_stmt): New function. (add_scope_stmt): Likewise. (finish_stmt_tree): Tweak. (genrtl_expr_stmt): Likewise. (genrtl_decl_stmt): Handle local labels, and call lang_expand_decl_stmt if required. (genrtl_for_stmt): Fix line-number handling. (genrtl_case_label): Handle cleanups. (genrtl_asm_stmt): Don't call combine_strings. (genrtl_compound_stmt): Simplify. (expand_stmt): Handle SCOPE_STMTs. * c-tree.h (struct lang_decl): New structure. (C_DECLARED_LABEL_FLAG): Remove. (c_begin_compound_stmt): Declare. (c_expand_decl_stmt): Likewise. (c_expand_start_case): Rename to c_start_case. (c_finish_case): New function. * c-typeck.c (start_init): Tweak setting of constructor_incremental. (c_expand_asm_operands): Tweak error-handling. Add to the statement-tree. (c_expand_return): Add to the statement-tree. (c_expand_start_case): Rename to ... (c_start_case): ... this. (struct c_switch): New type. (switch_stack): New variable. (do_case): Simplify. (c_finish_case): New function. * dependence.c: Include expr.h. (enum dependence_type): Change spelling of enumerals. (check_node_dependence): Adjust. * expr.h (lang_safe_from_p): Declare. (safe_from_p): Likewise. * expr.c (lang_safe_from_p): New variable. (safe_from_p): Give it external linkage. Use lang_safe_from_p. * stmt.c (expand_expr_stmt): Avoid clobberring of last_expr_type. * toplev.c (rest_of_decl_compilation): Robustify. * tree.c (contains_placeholder_p): Likewise. * Makefile.in: Update dependencies. * objc/objc-act.h: Adjust calculation of value for dummy_tree_code. * objc/objc-act.c: Include rtl.h, expr.h, and c-common.h. (objc_expand_function_end): New function. (finish_method_def): Use it. (init_objc): Initialize more language-specific hooks. * objc/Make-lang.in: Update dependencies. * cp-tree.h (struct cp_language_function): Remove x_scope_stmt_stack and name_declared. (current_scope_stmt_stack): Remove. (function_name_declared_p): New macro. (struct lang_decl_flags): Use c_lang_decl as a base class. (context): Remove. (struct lang_decl): Replace saved_tree with context. (DECL_FRIEND_CONTEXT): Adjust accordingly. (SET_DECL_FRIEND_CONTEXT): Likewise. (DECL_VIRTUAL_CONTEXT): Likewise. (DECL_SAVED_TREE): Remove. (C_DECLARED_LABEL_FLAG): Likewise. (cplus_expand_expr_stmt): Don't declare. (add_decl_stmt): Likewise. (add_scope_stmt): Likewise. * decl.c (mark_stmt_tree): Remove. (case_compare): Likewise. (finish_case_label): Use c_add_case_label. (init_decl_processing): Set more language-specific hooks. (build_enumerator): Fix typo in comment. (cplus_expand_expr_stmt): Remove. (mark_lang_function): Use mark_c_language_function. (lang_mark_tree): Use c_mark_lang_decl. * decl2.c: Change order of inclusion. * except.c: Likewise. * expr.c (cplus_expand_expr): Remove handling of STMT_EXPR. Fall back on c_expand_expr. * friend.c: Include expr.h. * init.c: Change order of inclusion. * Makefile.in: Update dependencies. * lex.h (free_lang_decl_chain): Remove. * optimize.c (maybe_clone_body): Use function_name_declared_p. * pt.c (build_template_decl): Don't copy DECL_VIRTUAL_CONTEXT if it doesn't exist. (instantiate_decl): Use function_name_declared_p. * semantics.c (lang_expand_expr_stmt): Remove. (set_current_function_name_declared): Likewise. (current_function_name_declared): Likewise. (begin_compound_stmt): Use function_name_declared_p. (add_decl_stmt): Remove. (setup_vtbl_ptr): Use function_name_declared_p. (add_scope_stmt): Remove. (current_scope_stmt_stack): New function. (cp_expand_stmt): Don't handle SCOPE_STMTs. (expand_body): Use function_name_declared_p. * tree.c (cp_statement_code_p): Don't include SCOPE_STMT. * typeck.c: Change order of includes. (convert_sequence): Remove. From-SVN: r36464
2000-09-17 09:38:23 +02:00
#include "c-common.h"
#include "c-pragma.h"
1992-01-18 00:15:38 +01:00
#include "flags.h"
#include "langhooks.h"
1993-01-19 04:21:31 +01:00
#include "objc-act.h"
1992-01-18 00:15:38 +01:00
#include "input.h"
1996-07-23 22:09:26 +02:00
#include "except.h"
#include "function.h"
#include "output.h"
Warning fixes: * Makefile.in (c-lang.o): Depend on c-tree.h, c-lex.h and toplev.h. (c-lex.o): Depend on output.h. (c-common.o): Likewise. (stmt.o): Likewise. (calls.o): Likewise. (integrate.o): Depend on toplev.h. (regclass.o): Depend on output.h. (final.o): Depend on reload.h. * c-common.c: Include output.h. (check_format_info): Remove unused variable `integral_format'. * c-decl.c (print_lang_decl): Mark parameters `file', `node' and `indent' with ATTRIBUTE_UNUSED. (print_lang_type): Likewise. (maybe_build_cleanup): Likewise for parameter `decl'. (copy_lang_decl): Likewise for parameter `node'. * c-lang.c: Include c-tree.h, c-lex.h and toplev.h. (lang_print_xnode): Mark parameters `file', `node' and `indent' with ATTRIBUTE_UNUSED. (lookup_interface): Likewise for parameter `arg'. (is_class_name): Likewise. (maybe_objc_check_decl): Likewise for parameter `decl'. (maybe_objc_comptypes): Likewise for parameters `lhs', `rhs' and `reflexive'. (maybe_objc_method_name): Likewise for parameter `decl'. (build_objc_string): Likewise for parameters `len' and `str'. * c-lex.c: Include output.h. * c-lex.h (position_after_white_space): Correct typo in prototype. * c-tree.h (finish_file, c_expand_start_cond, c_expand_start_else, c_expand_end_cond, init_iterators): Add prototypes. * caller-save.c (set_reg_live): Mark parameters `reg' and `setter' with ATTRIBUTE_UNUSED. * calls.c: Include output.h. * cccp.c (pipe_closed): Mark parameter `signo' with ATTRIBUTE_UNUSED. * combine.c: Move inclusion of expr.h to after insn-config.h. * iris6.h (ASM_IDENTIFY_GCC, ASM_IDENTIFY_LANGUAGE): Don't define as empty, rather define as ((void)0). * sparc.c (sparc_check_64): Add braces around ambiguous `else'. Add parentheses around assignment used as truth value. * cplus-dem.c (squangle_mop_up): Change return type to void. (internal_cplus_demangle): Remove unused parameter `options'. All callers changed. (cplus_demangle_opname): Remove function wide variable `int i' and replace with `size_t i' at each location where it is used. (cplus_demangle_opname): change type of `i' from int to size_t. * cppexp.c (right_shift): Mark parameter `pfile' with ATTRIBUTE_UNUSED. * cpphash.c (cpp_lookup): Likewise. (cpp_hash_cleanup): Likewise. * cpplib.c (parse_name): Add a prototype and make it static. (null_underflow): Mark parameter `pfile' with ATTRIBUTE_UNUSED. (null_cleanup): Likewise for parameters `pbuf' and `pfile'. (macro_cleanup): Likewise for parameter `pfile'. (file_cleanup): Likewise. * cpplib.h (cpp_reader_init, cpp_options_init, cpp_start_read, cpp_read_check_assertion, skip_rest_of_line): Add prototypes. * crtstuff.c (force_to_data, __CTOR_LIST__, force_to_data, __DTOR_END__, __FRAME_END__): Mark with ATTRIBUTE_UNUSED. * cse.c (cse_check_loop_start): Mark parameter `set' with ATTRIBUTE_UNUSED. * dbxout.c (flag_minimal_debug, have_used_extensions, source_label_number): Move inside macro wrapper check against defined (DBX_DEBUGGING_INFO) || defined (XCOFF_DEBUGGING_INFO). * dwarf2out.c (gen_entry_point_die): Hide prototype and definition. * except.h (doing_eh): Provide prototype. * expr.c: Move inclusion of expr.h to after insn-config.h. * final.c: Include reload.h. (shorten_branches): Cast the first argument of bzero to char *. * fix-header.c (cpp_print_containing_files): Mark parameter `pfile' with ATTRIBUTE_UNUSED. (cpp_fatal): Likewise. * flow.c (find_basic_blocks_1): Cast the first argument of bzero to char *. * genattrtab.c (make_length_attrs): Change the type of variable `i' from int to size_t. (zero_fn): Mark parameter `exp' with ATTRIBUTE_UNUSED. (one_fn): Likewise. * genextract.c (main): When generating insn-extract.c, mark variable `junk' with ATTRIBUTE_UNUSED. * gengenrtl.c (gencode): When generating genrtl.c, cast the first argument of bzero to char*. * integrate.c: Include toplev.h. * libgcc2.c: Wrap `struct exception_table' and `find_exception_handler' in macro DWARF2_UNWIND_INFO. * objc/Make-lang.in (objc-act.o): Depend on toplev.h. * objc/objc-act.c: Include toplev.h. (lang_print_xnode): Mark parameters `file', `node' and `indent' with ATTRIBUTE_UNUSED. (finish_protocol): Likewise for parameter `protocol'. * output.h (declare_weak): Add prototype. (decode_reg_name): Don't wrap with TREE_CODE macro. (assemble_alias): Add prototype. * regclass.c: Include output.h. * reload.h (reloads_conflict): Add prototype. * rtl.h (print_rtl_single, mark_elimiation, reg_class_subset_p, output_func_start_profiler): Add prototypes. * rtlanal.c (reg_set_p_1): Mark parameters `x' and `pat' with ATTRIBUTE_UNUSED. * scan-decls.c: Include scan.h. * scan.h (recognized_function, recognized_extern): Add prototypes. * stmt.c: Include output.h. * toplev.c (error_for_asm, warning_for_asm): Remove prototypes. (output_lang_identify): Hide prototype and definition. (float_signal): Mark parameter `signo' with ATTRIBUTE_UNUSED. (pipe_closed): Likewise. * toplev.h (count_error, strip_off_ending, error_for_asm, warning_for_asm): Add prototypes. From-SVN: r19712
1998-05-13 14:40:39 +02:00
#include "toplev.h"
#include "ggc.h"
#include "varray.h"
#include "debug.h"
#include "target.h"
toplev.h (report_error_function): Remove. * toplev.h (report_error_function): Remove. * diagnostic.h (location_t): New datatype. (text_info): Likewise. (diagnostic_info): Likewise. (output_prefix): New macro. (diagnostic_last_function_changed): Likewise. (diagnostic_set_last_function): Likewise. (diagnostic_last_module_changed): Likewise. (diagnostic_set_last_module): Likewise. (report_diagnostic): Now macro. (diagnostic_set_info): Declare. * diagnostic.c (report_problematic_module): Rename to diagnostic_repor_current_module. (set_diagnostic_context): Remove. (count_error): Rename to diagnostic_error_count. (error_function_changed): Remove. (record_last_error_function): Likewise. (error_module_changed): Likewise. (record_last_error_module): Likewise. (context_as_prefix): Rename to diagnostic_build_prefix. (flush_diagnostic_buffer): Rename to diagnostic_flush_buffer. (diagnostic_set_info): New function. * objc/objc-act.c: #include diagnostic.h (error_with_ivar): Adjust call to count_error. (warn_with_method): Likewise. * objc/Make-lang.in (objc-act.o): Depend on diagnostic.h cp/ 2002-06-04 Gabriel Dos Reis <gdr@codesourcery.com> * error.c (cp_diagnostic_starter): Adjust call. (maybe_print_instantiation_context): Change prototype to take a 'diagnostic_info *'. (print_instantiation_full_context): Likewise. (print_instantiation_partial_context): Likewise. (cp_diagnostic_starter): Likewise. (cp_diagnostic_finalizer): Likewise. (cp_print_error_function): Likewise. (cp_printer): Take a secondary parameter as a 'text_info *'. Remove output_state savings. Adjust calls. f/ 2002-06-04 Gabriel Dos Reis <gdr@codesourcery.com> * bad.c (ffebad_start_): Adjust call to count_error. * Make-lang.in (f/bad.o): Depend on diagnostic.h * bad.c: #include diagnostic.h From-SVN: r54291
2002-06-05 21:35:45 +02:00
#include "diagnostic.h"
#include "cgraph.h"
c-common.c (flag_objc_sjlj_exceptions): New. * c-common.c (flag_objc_sjlj_exceptions): New. * c-common.h (flag_objc_sjlj_exceptions): Declare. * c-opts.c (c_common_handle_option): Set it. (c_common_post_options): Handle interation of different objective-c exception and runtime switches. * c-decl.c (c_eh_initialized_p): New. (finish_decl): Use it instead of local eh_initialized_p. * c-parse.in (nested_function, notype_nested_function): Record the result of compstmt. (compstmt_or_error): Likewise. (compstmt): Don't add_stmt the result. (stmt): Don't return anything. Rewrite objc try and sync rules. (objc_try_stmt, objc_catch_list): Remove. (objc_catch_block, objc_finally_block): Remove. (objc_catch_prefix, objc_catch_clause, objc_opt_catch_list): New. (objc_try_catch_clause, objc_finally_clause): New. (objc_try_catch_stmt): Rewrite. * c-tree.h (c_eh_initialized_p): Declare. * c-opt (fobjc-sjlj-exceptions): New. * except.c (output_function_exception_table): Don't call cgraph on non-decls. * objc/objc-act.c (UTAG_EXCDATA_VAR, UTAG_CAUGHTEXC_VAR, UTAG_RETHROWEXC_VAR, UTAG_EVALONCE_VAR, struct val_stack, catch_count_stack, exc_binding_stack, if_nesting_count, blk_nesting_count, objc_enter_block, objc_exit_block, objc_declare_variable, 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): Remove. (objc_create_temporary_var, struct objc_try_context, cur_try_context, objc_eh_runtime_type, objc_init_exceptions, objc_build_exc_ptr, next_sjlj_build_try_exit, next_sjlj_build_enter_and_setjmp, next_sjlj_build_exc_extract, next_sjlj_build_catch_list, next_sjlj_build_try_catch_finally, objc_begin_try_stmt, objc_begin_catch_clause, objc_finish_catch_clause, objc_build_finally_clause, objc_finish_try_stmt, objc_build_synchronized): New. (objc_is_object_id, objc_is_class_id): New. (objc_comptypes): Use them. (build_next_objc_exception_stuff): Break NeXT sjlj out from build_objc_exception_stuff. (synth_module_prologue): Update to match. (objc_build_throw_stmt): Use cur_try_context to decide if we're in a @catch. * objc/objc-act.h: Update prototypes. (OCTI_EXCEPTION_BLK_STACK, objc_exception_block_stack): Remove. testsuite/ * objc.dg/sync-1.m: New. * objc.dg/try-catch-1.m: Don't force next runtime. * objc.dg/try-catch-3.m, objc.dg/try-catch-4.m: Likewise. * objc.dg/try-catch-2.m: Likewise. Enable everywhere. Remove shadowed catch clause. * objc.dg/try-catch-5.m: New. From-SVN: r83332
2004-06-18 03:20:53 +02:00
#include "tree-iterator.h"
#include "libfuncs.h"
Makefile.in (c-parse.o): Depend on $(C_COMMON_H). [gcc/ChangeLog] 2004-09-07 Ziemowit Laski <zlaski@apple.com> * Makefile.in (c-parse.o): Depend on $(C_COMMON_H). * c-parse.in: Include c-common.h instead of objc-act.h. (ivar_decl_list, ivar_decls, ivar_decl, ivars, ivar_declarator, myparms, myparm): Remove %type declarations. (methodtype, optparms, OBJC_TYPE_QUAL, objc_quals, objc_qual, objc_typename, objc_try_catch_stmt, optellipsis): Add %type declarations. (objc_inherit_code, objc_public_flag): Remove. (typespec_nonreserved_nonattr): Call objc_get_protocol_qualified_type() instead of get_static_reference() and get_protocol_reference(). (stmt_nocomp): Call grokparm() on @catch parameter. (objcdef): Move semantic action to objc_finish_implementation(). (classdef): Move semantic action to objc_start_class_interface(), objc_continue_interface(), objc_finish_interface(), objc_start_class_implementation(), objc_continue_implementation(), objc_start_category_interface() and objc_start_category_implementation(). (protocoldef): Move semantic actions to objc_start_protocol() and objc_finish_interface(). (ivar_decl_list): Remove nonterminal. (visibility_spec): Move semantic actions to objc_set_visibility(). (ivar_decls): Remove assignment to $$. (ivar_decl): Rephrase in terms of component_decl; call objc_add_instance_variable(). (ivars, ivar_declarator): Remove nonterminals. (opt_semi): New nonterminal. (methodtype): Remove semantic actions. (methoddef): Move semantic actions to objc_set_method_type(), objc_start_method_definition() and objc_finish_method_definition(). (methodproto): Move semantic actions to objc_set_method_type() and objc_add_method_declaration(). (methoddecl): Use objc_typename instead of typename; move semantic actions to objc_build_method_signature(). (optarglist, myxdecls, mydecl, myparms, myparm): Remove nonterminals. (optparmlist): Express in terms of optparms and optellipsis. (optparms, optellipsis, objc_qual, objc_quals, objc_typename): New nonterminals. (keyworddecl): Use objc_typename instead of typename. (rid_to_yy): Mark RID_IN, RID_OUT, RID_INOUT, RID_BYCOPY, RID_BYREF and RID_ONEWAY as returning OBJC_TYPE_QUAL to yyparse(). [gcc/objc/ChangeLog] 2004-09-07 Ziemowit Laski <zlaski@apple.com> * Make-lang.in (objc/objc-parse.o): Depend on $(C_COMMON_H) instead of objc/objc-act.h. (objc/objc-act.o): Depend on $(HASHTAB_H). * objc-act.c: Include hashtab.h; in ObjC++ mode, include cp-tree.h and objcp-decl.h instead of c-tree.h. (build_module_descriptor, get_class_ivars, synth_id_with_class_suffix, error_with_ivar, gen_method_decl, gen_declaration, setup_string_decl, build_protocol_template): Adjust prototypes. (build_module_initializer_routine, start_class, continue_class, finish_class, start_method_def, objc_start_function, start_protocol, build_method_decl, objc_add_method, add_instance_variable, build_ivar_reference, is_ivar, is_private, get_super_receiver, build_selector_table_decl, objc_push_parm, objc_get_parm_info, gen_type_name, gen_type_name_0, start_var_decl, finish_var_decl, create_field_decl): New prototypes. (objc_expand_function_end, comp_method_with_proto, objc_expr_last, gen_declaration_1, gen_declarator, is_complex_decl, adorn_decl, define_decl, create_builtin_decl, gen_declspecs): Remove prototypes. (TYPE_ID): Rename to OBJECT_TYPEDEF_NAME. (CLASS_TYPEDEF_NAME): New. (TAG_EXECCLASS): Change from a global variable to a #define. (TAG_RETURN_STRUCT): Delete. (TAG_GNUINIT): New, holds '__objc_gnu_init' name. (objc_inherit_code, objc_public_flag): New, moved from c-parse.in. (string_descriptor): New struct. (string_htab): New hash table. (string_hash, string_eq): New prototypes. (generate_struct_by_value_array): Call create_field_decl() instead of create_builtin_decl(). (objc_init): Do not initialize objc_ellipsis_node or TAG_EXECCLASS; In ObjC++ mode, call cxx_init() instead of c_objc_common_init(). (objc_finish_file): In ObjC++, call instantiate_pending_templates() and cp_finish_file(). (define_decl, get_static_reference, get_protocol_reference, create_builtin_decl): Remove functions. (objc_start_class_interface, objc_start_category_interface, objc_start_protocol, objc_continue_interface, objc_finish_interface, objc_start_class_implementation, objc_start_category_implementation, objc_continue_implementation, objc_finish_implementation, objc_set_visibility, objc_set_method_type, objc_build_method_signature, objc_add_method_declaration, objc_start_method_definition, objc_add_instance_variable, objc_get_protocol_qualified_type, create_field_decl, start_var_decl, finish_var_decl): New functions. (setup_string_decl): Simplify since it is only called once. (synth_module_prologue): Call build_class_template(); predefine 'id' and 'Class' as typedefs; rename 'temp_type' to 'type'; disable debug hooks for duration of function; fix GNU runtime messenger signatures to correspond to reality; forward-declare '__objc_exec_class' for the GNU runtime; call build_selector_table_decl(); in ObjC++ mode, generate 'extern "C" { ... }' wrappers around synthesized declarations; call build_protocol_template() and build_category_template(). (string_hash, string_eq): New functions. (objc_build_string_object): Check metaclass correctness only once; store string literals in hash table. (objc_build_constructor): Do not convert initializer elements; adjust for ObjC++ impedance mismatch. (build_objc_symtab_template): Call create_field_decl() instead of create_builtin_decl(). (init_objc_symtab): Add missing conversion to initializer element. (build_metadata_decl): Call start_var_decl() instead of define_decl(). (generate_objc_symtab_decl): Do not call build_category_template(); call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(). (build_module_descriptor): Call create_field_decl() instead of grokfield(); call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(); always mark module descriptor as used; move GNU runtime-specific functionality to build_module_initializer_routine(). (build_module_initializer_routine): New function, broken off of build_module_descriptor(). (objc_static_init_needed_p, objc_generate_static_init_call): New functions. (generate_static_references, generate_strings, build_selector_translation_table, generate_descriptor_table, generate_ivars_list, generate_dispatch_table, generate_category): Call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(); build a type directly instead of via groktypename(). (build_selector_reference_decl, build_selector_table_decl, build_class_reference_decl, build_protocol_reference, generate_objc_image_info): Call start_var_decl() instead of build_decl(). (build_selector_reference): For GNU runtime, do not call build_selector_reference_decl(). (build_selector, build_typed_selector_reference): Always convert result to the selector type. (add_objc_string): Cast return value to 'char *'. (build_method_prototype_template, build_selector_template, build_method_template): Use actual selector type for fields pointing to selectors. (finish_objc): For GNU runtime, call build_module_initializer_routine() after build_module_descriptor(). (generate_protocol_list, generate_shared_structures): Call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(); build a type directly instead of via groktypename(). (synth_id_with_class_suffix): Return a string. (get_arg_type_list): For instance methods, use the instance type for 'self'; do not call groktypename_in_parm_context(). (build_objc_string_decl): Squash redeclaration errors in ObjC++. (objc_is_class_name): Use OBJC_TYPE_NAME instead of TYPE_NAME; handle RECORD_TYPEs in ObjC as well as ObjC++. (objc_is_id): New function. (objc_is_object_ptr): Return the canonical type node. (objc_get_class_ivars): Simplify using get_class_ivars(). (get_class_ivars): Remove second parameter; create a fresh copy of the ivar list for each call; do not check for existence of super class. (objc_eh_runtime_type): Mark #ifndef OBJCPLUS. (objc_init_exceptions): When using SJLJ-style exceptions, require the use of '-fobjc-exceptions' flag; do not require it for DWARF-style exceptions. (objc_build_exc_ptr, next_sjlj_build_try_catch_finally): Use objc_object_type instead of objc_id_type. (objc_begin_catch_clause): Convert the incoming PARM_DECL into a VAR_DECL before placing it in the appropriate scope; do not call define_decl(); adjust call to c_begin_compound_stmt(); use objc_object_type instead of objc_id_type. (build_next_objc_exception_stuff): Call create_field_decl() instead of create_builtin_decl(); construct type directly instead of calling groktypename(); use OBJC_VOID_AT_END to mark end of function parameters. (build_private_template): Adjust call to get_class_ivars(); build a type directly instead of via groktypename(). (build_protocol_template, build_method_prototype_list_template, build_method_prototype_template, build_category_template, build_selector_template, build_class_template, build_super_template, build_ivar_template, build_ivar_list_template, build_method_list_template, build_method_template): Call create_field_decl() instead of grokfield(). (objc_method_parm_type): Do not call groktypename(). (generate_descriptor_table): Call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(). (generate_method_descriptors, build_protocol_initializer, generate_dispatch_tables, build_category_initializer, build_shared_structure_initializer): Do not call groktypename(). (generate_protocols): Call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(); do not call groktypename(). (error_with_ivar): Remove last parameter. (check_ivars): Do not iterate ovar CLASS_RAW_IVARS lists in addition to CLASS_IVARS lists; adjust calls to error_with_ivar(). (generate_ivar_lists): Convert one of the initializer elements; do not call groktypename(). (get_arg_type_list, start_method_def, gen_method_def): Account for new representation of variable arguments and '...' in Objective-C methods; add Objective-C++ impedance matching code. (is_objc_type_qualifier): Remove function. (adjust_type_for_id_default): Simplify; there is no longer a need to wade through declspecs. (lookup_interface, start_class, continue_class, finish_class, start_method_def, start_protocol, build_method_decl, objc_add_method, add_instance_variable, build_ivar_reference, is_ivar, is_private, get_super_receiver, objc_build_finally_epilogue): Make into static functions. (receiver_is_class_object): Use new IS_CLASS() macro. (objc_build_message_expr): Tweak ObjC++ message argument handling; call objc_finish_message_expr() instead of finish_message_expr(). (finish_message_expr): Rename to objc_finish_message_expr(); use OBJC_TYPE_NAME and OBJC_SET_TYPE_NAME macros instead of TYPE_NAME. call gen_type_name() instead of gen_declaration(); call objc_is_id() instead of using IS_ID and IS_CLASS; Use objc_class_name instead of calling get_identifier("Class"); handle CONVERT_EXPRs in receiver. (build_objc_method_call, warn_with_method): Do not call groktypename(). (build_ivar_reference): Call convert() instead of clobbering in a type. (hash_init): Initialize string_htab hash table. (add_instance_variable): Simplify parameter list; do not call grokfield(); do not populate CLASS_IVARS list. (start_class): Check for the existence of super class, if one was specified. (continue_class): Use CLASS_RAW_IVARS rather than CLASS_IVARS; do not call build_class_template(); adjust call to get_class_ivars(); call build_decl(), pushdecl() and finish_decl() instead of define_decl(). (finish_class): Call build_decl(), pushdecl() and finish_decl() instead of define_decl(). (add_protocols): Use PROTOCOL_BINFO_ELTS for the tree vector size. (start_protocol): Do not call build_protocol_template(); use PROTOCOL_BINFO_ELTS for the tree vector size. (encode_type_qualifiers): Do not handle the 'const' qualifier here. (encode_pointer): Encode 'const char *' as 'r*', for backwards compatibility. (encode_array): Use HOST_WIDE_INT_PRINT_DEC instead of "%ld". (encode_type): Handle the 'const' qualifier here. (objc_parmlist): New global variable, sued by objc_push_parm and objc_get_parm_info(). (objc_push_parm, objc_get_parm_info): New functions. (objc_expr_last): Remove function. (synth_self_and_ucmd_args): For instance methods, use the instance type for 'self'; call objc_push_parm() instead of push_parm_decl(). (start_method_def): Do not call push_scope(), declare_parm_level(), pop_scope(), push_parm_decl(), store_parm_decls() or objc_expr_last(); just use objc_push_parm() and objc_get_parm_info(). (comp_method_with_proto): Remove function. (objc_types_are_equivalent): Strip away indirections before comparing underlying types. (comp_proto_with_proto): Do not call groktypename(); types are no longer in raw declspec format. (objc_start_function): New function. (really_start_method): Call comp_proto_with_proto() instead of comp_method_with_proto(); call objc_start_function() instead of hand-crafting a function declarator. (continue_method_def, objc_expand_function_end): Remove functions. (get_super_receiver): Call objc_get_current_scope() instead of get_current_scope(); reference 'super_class' field (instead of 'class'). (finish_method_def): Rename to objc_finish_method_definition() and add a function decl parameter; move method encoding call from objc_expand_function_end(). (is_complex_decl, adorn_decl, gen_declarator, gen_declspecs, gen_declaration_1): Remove functions. (tmpbuf, RAW_DECLSPEC): Remove. (gen_declaration): Remove second parameter; simplify to deal with TYPE_P nodes instead of raw declspecs. (gen_type_name, gen_type_name_0): New functions. (gen_method_decl): Remove second parameter; call gen_type_name() instead of gen_declaration_1(). (dump_interface): Adjust calls to gen_declaration() and gen_method_decl(); do not allocate a separate string buffer. (init_objc): Allocate a larger string buffer to accommodate dump_interface(); adjust call to build_module_descriptor(); add call to build_module_initializer_routine() for the GNU runtime. (generate_classref_translation_entry): Do not call start_decl(); call finish_var_decl() instead of finish_decl(); call convert() instead of build_c_cast(). * objc-act.h (CLASS_OWN_IVARS): Remove accessor. (CLASS_BINFO_ELTS): Reduce from 6 to 5, now that CLASS_OWN_IVARS is gone. (OCTI_GNU_INIT_DECL, GNU_INIT_decl): New. (OCTI_ELLIPSIS_NODE, objc_ellipsis_node): Remove. (OCTI_ID_ID, id_type, objc_id_id): Rename to OCTI_ID_NAME, objc_object_type and objc_object_name, respectively. (OCTI_CLS_REF, OCTI_CLASS_NAME, objc_class_reference, objc_class_name): New. (IS_CLASS): New macro. (IS_ID, IS_SUPER): Robustify. (OCTI_EXECCLASS_DECL, execclass_decl): New. (finish_file, start_class, continue_class, finish_class, start_method_def, continue_method_def, finish_method_def, start_protocol, finish_protocol, objc_build_throw_stmt, objc_build_try_catch_finally_stmt, objc_build_synchronized_prologue, objc_build_synchronized_epilogue, objc_build_try_prologue, objc_build_try_epilogue, objc_build_catch_stmt, objc_build_catch_epilogue, objc_build_finally_prologue, objc_build_finally_epilogue, is_ivar, is_private, is_public, add_instance_variable, objc_add_method, get_super_receiver, objc_clear_super_receiver, get_class_ivars_from_name, get_class_reference, get_static_reference, get_object_reference, build_message_expr, finish_message_expr, build_selector_expr, build_ivar_reference, build_keyword_decl, build_method_decl, build_protocol_expr, build_objc_string_object, objc_declare_alias, objc_declare_class, objc_declare_protocols, objc_comptypes, objc_check_decl, build_encode_expr): Remove prototypes. (imp_count, cat_count): Make GGC-aware. (OBJC_SET_TYPE_NAME): New macro. From-SVN: r87168
2004-09-08 02:49:44 +02:00
#include "hashtab.h"
#include "langhooks-def.h"
Makefile.in (c-parse.o): Depend on $(C_COMMON_H). [gcc/ChangeLog] 2004-09-07 Ziemowit Laski <zlaski@apple.com> * Makefile.in (c-parse.o): Depend on $(C_COMMON_H). * c-parse.in: Include c-common.h instead of objc-act.h. (ivar_decl_list, ivar_decls, ivar_decl, ivars, ivar_declarator, myparms, myparm): Remove %type declarations. (methodtype, optparms, OBJC_TYPE_QUAL, objc_quals, objc_qual, objc_typename, objc_try_catch_stmt, optellipsis): Add %type declarations. (objc_inherit_code, objc_public_flag): Remove. (typespec_nonreserved_nonattr): Call objc_get_protocol_qualified_type() instead of get_static_reference() and get_protocol_reference(). (stmt_nocomp): Call grokparm() on @catch parameter. (objcdef): Move semantic action to objc_finish_implementation(). (classdef): Move semantic action to objc_start_class_interface(), objc_continue_interface(), objc_finish_interface(), objc_start_class_implementation(), objc_continue_implementation(), objc_start_category_interface() and objc_start_category_implementation(). (protocoldef): Move semantic actions to objc_start_protocol() and objc_finish_interface(). (ivar_decl_list): Remove nonterminal. (visibility_spec): Move semantic actions to objc_set_visibility(). (ivar_decls): Remove assignment to $$. (ivar_decl): Rephrase in terms of component_decl; call objc_add_instance_variable(). (ivars, ivar_declarator): Remove nonterminals. (opt_semi): New nonterminal. (methodtype): Remove semantic actions. (methoddef): Move semantic actions to objc_set_method_type(), objc_start_method_definition() and objc_finish_method_definition(). (methodproto): Move semantic actions to objc_set_method_type() and objc_add_method_declaration(). (methoddecl): Use objc_typename instead of typename; move semantic actions to objc_build_method_signature(). (optarglist, myxdecls, mydecl, myparms, myparm): Remove nonterminals. (optparmlist): Express in terms of optparms and optellipsis. (optparms, optellipsis, objc_qual, objc_quals, objc_typename): New nonterminals. (keyworddecl): Use objc_typename instead of typename. (rid_to_yy): Mark RID_IN, RID_OUT, RID_INOUT, RID_BYCOPY, RID_BYREF and RID_ONEWAY as returning OBJC_TYPE_QUAL to yyparse(). [gcc/objc/ChangeLog] 2004-09-07 Ziemowit Laski <zlaski@apple.com> * Make-lang.in (objc/objc-parse.o): Depend on $(C_COMMON_H) instead of objc/objc-act.h. (objc/objc-act.o): Depend on $(HASHTAB_H). * objc-act.c: Include hashtab.h; in ObjC++ mode, include cp-tree.h and objcp-decl.h instead of c-tree.h. (build_module_descriptor, get_class_ivars, synth_id_with_class_suffix, error_with_ivar, gen_method_decl, gen_declaration, setup_string_decl, build_protocol_template): Adjust prototypes. (build_module_initializer_routine, start_class, continue_class, finish_class, start_method_def, objc_start_function, start_protocol, build_method_decl, objc_add_method, add_instance_variable, build_ivar_reference, is_ivar, is_private, get_super_receiver, build_selector_table_decl, objc_push_parm, objc_get_parm_info, gen_type_name, gen_type_name_0, start_var_decl, finish_var_decl, create_field_decl): New prototypes. (objc_expand_function_end, comp_method_with_proto, objc_expr_last, gen_declaration_1, gen_declarator, is_complex_decl, adorn_decl, define_decl, create_builtin_decl, gen_declspecs): Remove prototypes. (TYPE_ID): Rename to OBJECT_TYPEDEF_NAME. (CLASS_TYPEDEF_NAME): New. (TAG_EXECCLASS): Change from a global variable to a #define. (TAG_RETURN_STRUCT): Delete. (TAG_GNUINIT): New, holds '__objc_gnu_init' name. (objc_inherit_code, objc_public_flag): New, moved from c-parse.in. (string_descriptor): New struct. (string_htab): New hash table. (string_hash, string_eq): New prototypes. (generate_struct_by_value_array): Call create_field_decl() instead of create_builtin_decl(). (objc_init): Do not initialize objc_ellipsis_node or TAG_EXECCLASS; In ObjC++ mode, call cxx_init() instead of c_objc_common_init(). (objc_finish_file): In ObjC++, call instantiate_pending_templates() and cp_finish_file(). (define_decl, get_static_reference, get_protocol_reference, create_builtin_decl): Remove functions. (objc_start_class_interface, objc_start_category_interface, objc_start_protocol, objc_continue_interface, objc_finish_interface, objc_start_class_implementation, objc_start_category_implementation, objc_continue_implementation, objc_finish_implementation, objc_set_visibility, objc_set_method_type, objc_build_method_signature, objc_add_method_declaration, objc_start_method_definition, objc_add_instance_variable, objc_get_protocol_qualified_type, create_field_decl, start_var_decl, finish_var_decl): New functions. (setup_string_decl): Simplify since it is only called once. (synth_module_prologue): Call build_class_template(); predefine 'id' and 'Class' as typedefs; rename 'temp_type' to 'type'; disable debug hooks for duration of function; fix GNU runtime messenger signatures to correspond to reality; forward-declare '__objc_exec_class' for the GNU runtime; call build_selector_table_decl(); in ObjC++ mode, generate 'extern "C" { ... }' wrappers around synthesized declarations; call build_protocol_template() and build_category_template(). (string_hash, string_eq): New functions. (objc_build_string_object): Check metaclass correctness only once; store string literals in hash table. (objc_build_constructor): Do not convert initializer elements; adjust for ObjC++ impedance mismatch. (build_objc_symtab_template): Call create_field_decl() instead of create_builtin_decl(). (init_objc_symtab): Add missing conversion to initializer element. (build_metadata_decl): Call start_var_decl() instead of define_decl(). (generate_objc_symtab_decl): Do not call build_category_template(); call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(). (build_module_descriptor): Call create_field_decl() instead of grokfield(); call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(); always mark module descriptor as used; move GNU runtime-specific functionality to build_module_initializer_routine(). (build_module_initializer_routine): New function, broken off of build_module_descriptor(). (objc_static_init_needed_p, objc_generate_static_init_call): New functions. (generate_static_references, generate_strings, build_selector_translation_table, generate_descriptor_table, generate_ivars_list, generate_dispatch_table, generate_category): Call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(); build a type directly instead of via groktypename(). (build_selector_reference_decl, build_selector_table_decl, build_class_reference_decl, build_protocol_reference, generate_objc_image_info): Call start_var_decl() instead of build_decl(). (build_selector_reference): For GNU runtime, do not call build_selector_reference_decl(). (build_selector, build_typed_selector_reference): Always convert result to the selector type. (add_objc_string): Cast return value to 'char *'. (build_method_prototype_template, build_selector_template, build_method_template): Use actual selector type for fields pointing to selectors. (finish_objc): For GNU runtime, call build_module_initializer_routine() after build_module_descriptor(). (generate_protocol_list, generate_shared_structures): Call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(); build a type directly instead of via groktypename(). (synth_id_with_class_suffix): Return a string. (get_arg_type_list): For instance methods, use the instance type for 'self'; do not call groktypename_in_parm_context(). (build_objc_string_decl): Squash redeclaration errors in ObjC++. (objc_is_class_name): Use OBJC_TYPE_NAME instead of TYPE_NAME; handle RECORD_TYPEs in ObjC as well as ObjC++. (objc_is_id): New function. (objc_is_object_ptr): Return the canonical type node. (objc_get_class_ivars): Simplify using get_class_ivars(). (get_class_ivars): Remove second parameter; create a fresh copy of the ivar list for each call; do not check for existence of super class. (objc_eh_runtime_type): Mark #ifndef OBJCPLUS. (objc_init_exceptions): When using SJLJ-style exceptions, require the use of '-fobjc-exceptions' flag; do not require it for DWARF-style exceptions. (objc_build_exc_ptr, next_sjlj_build_try_catch_finally): Use objc_object_type instead of objc_id_type. (objc_begin_catch_clause): Convert the incoming PARM_DECL into a VAR_DECL before placing it in the appropriate scope; do not call define_decl(); adjust call to c_begin_compound_stmt(); use objc_object_type instead of objc_id_type. (build_next_objc_exception_stuff): Call create_field_decl() instead of create_builtin_decl(); construct type directly instead of calling groktypename(); use OBJC_VOID_AT_END to mark end of function parameters. (build_private_template): Adjust call to get_class_ivars(); build a type directly instead of via groktypename(). (build_protocol_template, build_method_prototype_list_template, build_method_prototype_template, build_category_template, build_selector_template, build_class_template, build_super_template, build_ivar_template, build_ivar_list_template, build_method_list_template, build_method_template): Call create_field_decl() instead of grokfield(). (objc_method_parm_type): Do not call groktypename(). (generate_descriptor_table): Call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(). (generate_method_descriptors, build_protocol_initializer, generate_dispatch_tables, build_category_initializer, build_shared_structure_initializer): Do not call groktypename(). (generate_protocols): Call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(); do not call groktypename(). (error_with_ivar): Remove last parameter. (check_ivars): Do not iterate ovar CLASS_RAW_IVARS lists in addition to CLASS_IVARS lists; adjust calls to error_with_ivar(). (generate_ivar_lists): Convert one of the initializer elements; do not call groktypename(). (get_arg_type_list, start_method_def, gen_method_def): Account for new representation of variable arguments and '...' in Objective-C methods; add Objective-C++ impedance matching code. (is_objc_type_qualifier): Remove function. (adjust_type_for_id_default): Simplify; there is no longer a need to wade through declspecs. (lookup_interface, start_class, continue_class, finish_class, start_method_def, start_protocol, build_method_decl, objc_add_method, add_instance_variable, build_ivar_reference, is_ivar, is_private, get_super_receiver, objc_build_finally_epilogue): Make into static functions. (receiver_is_class_object): Use new IS_CLASS() macro. (objc_build_message_expr): Tweak ObjC++ message argument handling; call objc_finish_message_expr() instead of finish_message_expr(). (finish_message_expr): Rename to objc_finish_message_expr(); use OBJC_TYPE_NAME and OBJC_SET_TYPE_NAME macros instead of TYPE_NAME. call gen_type_name() instead of gen_declaration(); call objc_is_id() instead of using IS_ID and IS_CLASS; Use objc_class_name instead of calling get_identifier("Class"); handle CONVERT_EXPRs in receiver. (build_objc_method_call, warn_with_method): Do not call groktypename(). (build_ivar_reference): Call convert() instead of clobbering in a type. (hash_init): Initialize string_htab hash table. (add_instance_variable): Simplify parameter list; do not call grokfield(); do not populate CLASS_IVARS list. (start_class): Check for the existence of super class, if one was specified. (continue_class): Use CLASS_RAW_IVARS rather than CLASS_IVARS; do not call build_class_template(); adjust call to get_class_ivars(); call build_decl(), pushdecl() and finish_decl() instead of define_decl(). (finish_class): Call build_decl(), pushdecl() and finish_decl() instead of define_decl(). (add_protocols): Use PROTOCOL_BINFO_ELTS for the tree vector size. (start_protocol): Do not call build_protocol_template(); use PROTOCOL_BINFO_ELTS for the tree vector size. (encode_type_qualifiers): Do not handle the 'const' qualifier here. (encode_pointer): Encode 'const char *' as 'r*', for backwards compatibility. (encode_array): Use HOST_WIDE_INT_PRINT_DEC instead of "%ld". (encode_type): Handle the 'const' qualifier here. (objc_parmlist): New global variable, sued by objc_push_parm and objc_get_parm_info(). (objc_push_parm, objc_get_parm_info): New functions. (objc_expr_last): Remove function. (synth_self_and_ucmd_args): For instance methods, use the instance type for 'self'; call objc_push_parm() instead of push_parm_decl(). (start_method_def): Do not call push_scope(), declare_parm_level(), pop_scope(), push_parm_decl(), store_parm_decls() or objc_expr_last(); just use objc_push_parm() and objc_get_parm_info(). (comp_method_with_proto): Remove function. (objc_types_are_equivalent): Strip away indirections before comparing underlying types. (comp_proto_with_proto): Do not call groktypename(); types are no longer in raw declspec format. (objc_start_function): New function. (really_start_method): Call comp_proto_with_proto() instead of comp_method_with_proto(); call objc_start_function() instead of hand-crafting a function declarator. (continue_method_def, objc_expand_function_end): Remove functions. (get_super_receiver): Call objc_get_current_scope() instead of get_current_scope(); reference 'super_class' field (instead of 'class'). (finish_method_def): Rename to objc_finish_method_definition() and add a function decl parameter; move method encoding call from objc_expand_function_end(). (is_complex_decl, adorn_decl, gen_declarator, gen_declspecs, gen_declaration_1): Remove functions. (tmpbuf, RAW_DECLSPEC): Remove. (gen_declaration): Remove second parameter; simplify to deal with TYPE_P nodes instead of raw declspecs. (gen_type_name, gen_type_name_0): New functions. (gen_method_decl): Remove second parameter; call gen_type_name() instead of gen_declaration_1(). (dump_interface): Adjust calls to gen_declaration() and gen_method_decl(); do not allocate a separate string buffer. (init_objc): Allocate a larger string buffer to accommodate dump_interface(); adjust call to build_module_descriptor(); add call to build_module_initializer_routine() for the GNU runtime. (generate_classref_translation_entry): Do not call start_decl(); call finish_var_decl() instead of finish_decl(); call convert() instead of build_c_cast(). * objc-act.h (CLASS_OWN_IVARS): Remove accessor. (CLASS_BINFO_ELTS): Reduce from 6 to 5, now that CLASS_OWN_IVARS is gone. (OCTI_GNU_INIT_DECL, GNU_INIT_decl): New. (OCTI_ELLIPSIS_NODE, objc_ellipsis_node): Remove. (OCTI_ID_ID, id_type, objc_id_id): Rename to OCTI_ID_NAME, objc_object_type and objc_object_name, respectively. (OCTI_CLS_REF, OCTI_CLASS_NAME, objc_class_reference, objc_class_name): New. (IS_CLASS): New macro. (IS_ID, IS_SUPER): Robustify. (OCTI_EXECCLASS_DECL, execclass_decl): New. (finish_file, start_class, continue_class, finish_class, start_method_def, continue_method_def, finish_method_def, start_protocol, finish_protocol, objc_build_throw_stmt, objc_build_try_catch_finally_stmt, objc_build_synchronized_prologue, objc_build_synchronized_epilogue, objc_build_try_prologue, objc_build_try_epilogue, objc_build_catch_stmt, objc_build_catch_epilogue, objc_build_finally_prologue, objc_build_finally_epilogue, is_ivar, is_private, is_public, add_instance_variable, objc_add_method, get_super_receiver, objc_clear_super_receiver, get_class_ivars_from_name, get_class_reference, get_static_reference, get_object_reference, build_message_expr, finish_message_expr, build_selector_expr, build_ivar_reference, build_keyword_decl, build_method_decl, build_protocol_expr, build_objc_string_object, objc_declare_alias, objc_declare_class, objc_declare_protocols, objc_comptypes, objc_check_decl, build_encode_expr): Remove prototypes. (imp_count, cat_count): Make GGC-aware. (OBJC_SET_TYPE_NAME): New macro. From-SVN: r87168
2004-09-08 02:49:44 +02:00
#define OBJC_VOID_AT_END void_list_node
Yet more Objective-C++... * objc-act.c (objc_finish_try_stmt): Add return value. (objc_build_synchronized): Likewise. * objc-act.c (objc_is_gcable_type): Add. (objc_substitute_decl): Add. (objc_build_ivar_assignment): Add. (objc_build_global_assignment): Add. (objc_build_strong_cast_assignment): Add. (objc_is_ivar_reference_p): Add. (objc_is_global_reference_p): Add. (objc_generate_write_barrier): Add. (objc_rewrite_function_call): Add. (objc_gimplify_expr): Add Objective-C++ support. * objc-act.h (ALLOC_OBJC_TYPE_LANG_SPECIFIC): Likewise. (SIZEOF_OBJC_TYPE_LANG_SPECIFIC): Add. (INIT_TYPE_OBJC_INFO): Add Objective-C++ support. (DUP_TYPE_OBJC_INFO): Likewise. (struct imp_entry): Add field has_cxx_cdtors. (struct imp_entry *imp_list): Add OCTI_UMSG_FAST_DECL, OCTI_METH_LIST_TEMPL, OCTI_METH_PROTO_LIST_TEMPL, OCTI_IVAR_LIST_TEMPL, OCTI_ASSIGN_IVAR_DECL, OCTI_ASSIGN_IVAR_FAST_DECL, OCTI_ASSIGN_GLOBAL_DECL, OCTI_ASSIGN_STRONGCAST_DECL. (umsg_fast_decl): Add. (objc_assign_ivar_decl): Add. (objc_assign_ivar_fast_decl): Add. (objc_assign_global_decl): Add. (objc_assign_strong_cast_decl): Add. (objc_method_list_ptr): Add. (objc_method_proto_list_ptr): Add. (objc_ivar_list_ptr): Add. * objc-act.c (should_call_super_dealloc): Add. (OBJC_VERSION): Bump to 6. (objc_is_gcable_type): Add. (objc_substitute_decl): Add. (objc_build_ivar_assignment): Add. (objc_build_global_assignment): Add. (objc_build_strong_cast_assignment): Add. (objc_is_gcable_p): Add. (objc_is_ivar_reference_p): Add. (objc_is_global_reference_p): Add. (generate_shared_structures): Add flags parameter. (objc_generate_cxx_ctor_or_dtor): Add. (objc_generate_cxx_cdtors): Add. (add_class): Add name parameter. (objc_types_share_size_and_alignment): Add. (comp_proto_with_proto): Add strict parameter. (CLS_HAS_CXX_STRUCTORS): Add. (TAG_ASSIGNIVAR): Add. (TAG_ASSIGNGLOBAL): Add. (TAG_ASSIGNSTRONGCAST): Add. (TAG_MSGSEND_FAST): Add. (TAG_ASSIGNIVAR_FAST): Add. (TAG_CXX_CONSTRUCT): Add. (TAG_CXX_DESTRUCT): Add. (OBJC_LOOKUP_CLASS): Add. (OBJC_LOOKUP_NO_SUPER): Add. (objc_finish_file): Add pch support. (objc_finish_implementation): Add Objective-C++ support. (synth_module_prologue): Likewise. (synth_module_prologue): Add fast dispatching. (objc_get_class_reference): Add Objective-C++ support. (objc_generate_write_barrier): Likewise. (next_sjlj_build_enter_and_setjmp): Likewise. (objc_begin_try_stmt): Likewise. (build_next_objc_exception_stuff): Add fast ivar support. (build_private_template): Mark the record as used so debug information is generated. (build_protocol_template): Add Objective-C++ support. (objc_method_parm_type) Likewise. (objc_generate_cxx_ctor_or_dtor): Likewise. (objc_generate_cxx_cdtors): Likewise. (build_protocol_initializer): Likewise. (build_category_template): Likewise. (build_class_template): Likewise. (build_method_list_template): Likewise. (build_category_initializer): Likewise. (build_shared_structure_initializer): Likewise. (objc_finish_message_expr): Likewise. (build_objc_method_call): Add fast dispatch support. (lookup_method_static): Add support to end search at superclasses. (add_method_to_hash_list): Add strict parameter to comp_proto_with_proto. (objc_add_method): Likewise. (objc_add_method): Also set the interface_value. (add_instance_variable): Add Objective-C++ support. (objc_is_public): Likewise. (start_class): Likewise. (continue_class): Likewise. (encode_aggregate_within): Likewise. (start_method_def): Likewise. (objc_start_function): Clear current_function_returns_value and current_function_returns_null. (really_start_method): Add Objective-C++ support. (objc_finish_method_definition): Add warning for missing [super dealloc]. (finish_objc): Add Objective-C++ support. (generate_objc_image_info): Likewise. (objc_lookup_ivar): Likewise. * objc-act.h (TYPE_HAS_OBJC_INFO): Likewise. (INIT_TYPE_OBJC_INFO): Likewise. (DUP_TYPE_OBJC_INFO): Likewise. From-SVN: r99857
2005-05-17 22:07:08 +02:00
static unsigned int should_call_super_dealloc = 0;
Makefile.in (c-parse.o): Depend on $(C_COMMON_H). [gcc/ChangeLog] 2004-09-07 Ziemowit Laski <zlaski@apple.com> * Makefile.in (c-parse.o): Depend on $(C_COMMON_H). * c-parse.in: Include c-common.h instead of objc-act.h. (ivar_decl_list, ivar_decls, ivar_decl, ivars, ivar_declarator, myparms, myparm): Remove %type declarations. (methodtype, optparms, OBJC_TYPE_QUAL, objc_quals, objc_qual, objc_typename, objc_try_catch_stmt, optellipsis): Add %type declarations. (objc_inherit_code, objc_public_flag): Remove. (typespec_nonreserved_nonattr): Call objc_get_protocol_qualified_type() instead of get_static_reference() and get_protocol_reference(). (stmt_nocomp): Call grokparm() on @catch parameter. (objcdef): Move semantic action to objc_finish_implementation(). (classdef): Move semantic action to objc_start_class_interface(), objc_continue_interface(), objc_finish_interface(), objc_start_class_implementation(), objc_continue_implementation(), objc_start_category_interface() and objc_start_category_implementation(). (protocoldef): Move semantic actions to objc_start_protocol() and objc_finish_interface(). (ivar_decl_list): Remove nonterminal. (visibility_spec): Move semantic actions to objc_set_visibility(). (ivar_decls): Remove assignment to $$. (ivar_decl): Rephrase in terms of component_decl; call objc_add_instance_variable(). (ivars, ivar_declarator): Remove nonterminals. (opt_semi): New nonterminal. (methodtype): Remove semantic actions. (methoddef): Move semantic actions to objc_set_method_type(), objc_start_method_definition() and objc_finish_method_definition(). (methodproto): Move semantic actions to objc_set_method_type() and objc_add_method_declaration(). (methoddecl): Use objc_typename instead of typename; move semantic actions to objc_build_method_signature(). (optarglist, myxdecls, mydecl, myparms, myparm): Remove nonterminals. (optparmlist): Express in terms of optparms and optellipsis. (optparms, optellipsis, objc_qual, objc_quals, objc_typename): New nonterminals. (keyworddecl): Use objc_typename instead of typename. (rid_to_yy): Mark RID_IN, RID_OUT, RID_INOUT, RID_BYCOPY, RID_BYREF and RID_ONEWAY as returning OBJC_TYPE_QUAL to yyparse(). [gcc/objc/ChangeLog] 2004-09-07 Ziemowit Laski <zlaski@apple.com> * Make-lang.in (objc/objc-parse.o): Depend on $(C_COMMON_H) instead of objc/objc-act.h. (objc/objc-act.o): Depend on $(HASHTAB_H). * objc-act.c: Include hashtab.h; in ObjC++ mode, include cp-tree.h and objcp-decl.h instead of c-tree.h. (build_module_descriptor, get_class_ivars, synth_id_with_class_suffix, error_with_ivar, gen_method_decl, gen_declaration, setup_string_decl, build_protocol_template): Adjust prototypes. (build_module_initializer_routine, start_class, continue_class, finish_class, start_method_def, objc_start_function, start_protocol, build_method_decl, objc_add_method, add_instance_variable, build_ivar_reference, is_ivar, is_private, get_super_receiver, build_selector_table_decl, objc_push_parm, objc_get_parm_info, gen_type_name, gen_type_name_0, start_var_decl, finish_var_decl, create_field_decl): New prototypes. (objc_expand_function_end, comp_method_with_proto, objc_expr_last, gen_declaration_1, gen_declarator, is_complex_decl, adorn_decl, define_decl, create_builtin_decl, gen_declspecs): Remove prototypes. (TYPE_ID): Rename to OBJECT_TYPEDEF_NAME. (CLASS_TYPEDEF_NAME): New. (TAG_EXECCLASS): Change from a global variable to a #define. (TAG_RETURN_STRUCT): Delete. (TAG_GNUINIT): New, holds '__objc_gnu_init' name. (objc_inherit_code, objc_public_flag): New, moved from c-parse.in. (string_descriptor): New struct. (string_htab): New hash table. (string_hash, string_eq): New prototypes. (generate_struct_by_value_array): Call create_field_decl() instead of create_builtin_decl(). (objc_init): Do not initialize objc_ellipsis_node or TAG_EXECCLASS; In ObjC++ mode, call cxx_init() instead of c_objc_common_init(). (objc_finish_file): In ObjC++, call instantiate_pending_templates() and cp_finish_file(). (define_decl, get_static_reference, get_protocol_reference, create_builtin_decl): Remove functions. (objc_start_class_interface, objc_start_category_interface, objc_start_protocol, objc_continue_interface, objc_finish_interface, objc_start_class_implementation, objc_start_category_implementation, objc_continue_implementation, objc_finish_implementation, objc_set_visibility, objc_set_method_type, objc_build_method_signature, objc_add_method_declaration, objc_start_method_definition, objc_add_instance_variable, objc_get_protocol_qualified_type, create_field_decl, start_var_decl, finish_var_decl): New functions. (setup_string_decl): Simplify since it is only called once. (synth_module_prologue): Call build_class_template(); predefine 'id' and 'Class' as typedefs; rename 'temp_type' to 'type'; disable debug hooks for duration of function; fix GNU runtime messenger signatures to correspond to reality; forward-declare '__objc_exec_class' for the GNU runtime; call build_selector_table_decl(); in ObjC++ mode, generate 'extern "C" { ... }' wrappers around synthesized declarations; call build_protocol_template() and build_category_template(). (string_hash, string_eq): New functions. (objc_build_string_object): Check metaclass correctness only once; store string literals in hash table. (objc_build_constructor): Do not convert initializer elements; adjust for ObjC++ impedance mismatch. (build_objc_symtab_template): Call create_field_decl() instead of create_builtin_decl(). (init_objc_symtab): Add missing conversion to initializer element. (build_metadata_decl): Call start_var_decl() instead of define_decl(). (generate_objc_symtab_decl): Do not call build_category_template(); call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(). (build_module_descriptor): Call create_field_decl() instead of grokfield(); call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(); always mark module descriptor as used; move GNU runtime-specific functionality to build_module_initializer_routine(). (build_module_initializer_routine): New function, broken off of build_module_descriptor(). (objc_static_init_needed_p, objc_generate_static_init_call): New functions. (generate_static_references, generate_strings, build_selector_translation_table, generate_descriptor_table, generate_ivars_list, generate_dispatch_table, generate_category): Call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(); build a type directly instead of via groktypename(). (build_selector_reference_decl, build_selector_table_decl, build_class_reference_decl, build_protocol_reference, generate_objc_image_info): Call start_var_decl() instead of build_decl(). (build_selector_reference): For GNU runtime, do not call build_selector_reference_decl(). (build_selector, build_typed_selector_reference): Always convert result to the selector type. (add_objc_string): Cast return value to 'char *'. (build_method_prototype_template, build_selector_template, build_method_template): Use actual selector type for fields pointing to selectors. (finish_objc): For GNU runtime, call build_module_initializer_routine() after build_module_descriptor(). (generate_protocol_list, generate_shared_structures): Call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(); build a type directly instead of via groktypename(). (synth_id_with_class_suffix): Return a string. (get_arg_type_list): For instance methods, use the instance type for 'self'; do not call groktypename_in_parm_context(). (build_objc_string_decl): Squash redeclaration errors in ObjC++. (objc_is_class_name): Use OBJC_TYPE_NAME instead of TYPE_NAME; handle RECORD_TYPEs in ObjC as well as ObjC++. (objc_is_id): New function. (objc_is_object_ptr): Return the canonical type node. (objc_get_class_ivars): Simplify using get_class_ivars(). (get_class_ivars): Remove second parameter; create a fresh copy of the ivar list for each call; do not check for existence of super class. (objc_eh_runtime_type): Mark #ifndef OBJCPLUS. (objc_init_exceptions): When using SJLJ-style exceptions, require the use of '-fobjc-exceptions' flag; do not require it for DWARF-style exceptions. (objc_build_exc_ptr, next_sjlj_build_try_catch_finally): Use objc_object_type instead of objc_id_type. (objc_begin_catch_clause): Convert the incoming PARM_DECL into a VAR_DECL before placing it in the appropriate scope; do not call define_decl(); adjust call to c_begin_compound_stmt(); use objc_object_type instead of objc_id_type. (build_next_objc_exception_stuff): Call create_field_decl() instead of create_builtin_decl(); construct type directly instead of calling groktypename(); use OBJC_VOID_AT_END to mark end of function parameters. (build_private_template): Adjust call to get_class_ivars(); build a type directly instead of via groktypename(). (build_protocol_template, build_method_prototype_list_template, build_method_prototype_template, build_category_template, build_selector_template, build_class_template, build_super_template, build_ivar_template, build_ivar_list_template, build_method_list_template, build_method_template): Call create_field_decl() instead of grokfield(). (objc_method_parm_type): Do not call groktypename(). (generate_descriptor_table): Call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(). (generate_method_descriptors, build_protocol_initializer, generate_dispatch_tables, build_category_initializer, build_shared_structure_initializer): Do not call groktypename(). (generate_protocols): Call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(); do not call groktypename(). (error_with_ivar): Remove last parameter. (check_ivars): Do not iterate ovar CLASS_RAW_IVARS lists in addition to CLASS_IVARS lists; adjust calls to error_with_ivar(). (generate_ivar_lists): Convert one of the initializer elements; do not call groktypename(). (get_arg_type_list, start_method_def, gen_method_def): Account for new representation of variable arguments and '...' in Objective-C methods; add Objective-C++ impedance matching code. (is_objc_type_qualifier): Remove function. (adjust_type_for_id_default): Simplify; there is no longer a need to wade through declspecs. (lookup_interface, start_class, continue_class, finish_class, start_method_def, start_protocol, build_method_decl, objc_add_method, add_instance_variable, build_ivar_reference, is_ivar, is_private, get_super_receiver, objc_build_finally_epilogue): Make into static functions. (receiver_is_class_object): Use new IS_CLASS() macro. (objc_build_message_expr): Tweak ObjC++ message argument handling; call objc_finish_message_expr() instead of finish_message_expr(). (finish_message_expr): Rename to objc_finish_message_expr(); use OBJC_TYPE_NAME and OBJC_SET_TYPE_NAME macros instead of TYPE_NAME. call gen_type_name() instead of gen_declaration(); call objc_is_id() instead of using IS_ID and IS_CLASS; Use objc_class_name instead of calling get_identifier("Class"); handle CONVERT_EXPRs in receiver. (build_objc_method_call, warn_with_method): Do not call groktypename(). (build_ivar_reference): Call convert() instead of clobbering in a type. (hash_init): Initialize string_htab hash table. (add_instance_variable): Simplify parameter list; do not call grokfield(); do not populate CLASS_IVARS list. (start_class): Check for the existence of super class, if one was specified. (continue_class): Use CLASS_RAW_IVARS rather than CLASS_IVARS; do not call build_class_template(); adjust call to get_class_ivars(); call build_decl(), pushdecl() and finish_decl() instead of define_decl(). (finish_class): Call build_decl(), pushdecl() and finish_decl() instead of define_decl(). (add_protocols): Use PROTOCOL_BINFO_ELTS for the tree vector size. (start_protocol): Do not call build_protocol_template(); use PROTOCOL_BINFO_ELTS for the tree vector size. (encode_type_qualifiers): Do not handle the 'const' qualifier here. (encode_pointer): Encode 'const char *' as 'r*', for backwards compatibility. (encode_array): Use HOST_WIDE_INT_PRINT_DEC instead of "%ld". (encode_type): Handle the 'const' qualifier here. (objc_parmlist): New global variable, sued by objc_push_parm and objc_get_parm_info(). (objc_push_parm, objc_get_parm_info): New functions. (objc_expr_last): Remove function. (synth_self_and_ucmd_args): For instance methods, use the instance type for 'self'; call objc_push_parm() instead of push_parm_decl(). (start_method_def): Do not call push_scope(), declare_parm_level(), pop_scope(), push_parm_decl(), store_parm_decls() or objc_expr_last(); just use objc_push_parm() and objc_get_parm_info(). (comp_method_with_proto): Remove function. (objc_types_are_equivalent): Strip away indirections before comparing underlying types. (comp_proto_with_proto): Do not call groktypename(); types are no longer in raw declspec format. (objc_start_function): New function. (really_start_method): Call comp_proto_with_proto() instead of comp_method_with_proto(); call objc_start_function() instead of hand-crafting a function declarator. (continue_method_def, objc_expand_function_end): Remove functions. (get_super_receiver): Call objc_get_current_scope() instead of get_current_scope(); reference 'super_class' field (instead of 'class'). (finish_method_def): Rename to objc_finish_method_definition() and add a function decl parameter; move method encoding call from objc_expand_function_end(). (is_complex_decl, adorn_decl, gen_declarator, gen_declspecs, gen_declaration_1): Remove functions. (tmpbuf, RAW_DECLSPEC): Remove. (gen_declaration): Remove second parameter; simplify to deal with TYPE_P nodes instead of raw declspecs. (gen_type_name, gen_type_name_0): New functions. (gen_method_decl): Remove second parameter; call gen_type_name() instead of gen_declaration_1(). (dump_interface): Adjust calls to gen_declaration() and gen_method_decl(); do not allocate a separate string buffer. (init_objc): Allocate a larger string buffer to accommodate dump_interface(); adjust call to build_module_descriptor(); add call to build_module_initializer_routine() for the GNU runtime. (generate_classref_translation_entry): Do not call start_decl(); call finish_var_decl() instead of finish_decl(); call convert() instead of build_c_cast(). * objc-act.h (CLASS_OWN_IVARS): Remove accessor. (CLASS_BINFO_ELTS): Reduce from 6 to 5, now that CLASS_OWN_IVARS is gone. (OCTI_GNU_INIT_DECL, GNU_INIT_decl): New. (OCTI_ELLIPSIS_NODE, objc_ellipsis_node): Remove. (OCTI_ID_ID, id_type, objc_id_id): Rename to OCTI_ID_NAME, objc_object_type and objc_object_name, respectively. (OCTI_CLS_REF, OCTI_CLASS_NAME, objc_class_reference, objc_class_name): New. (IS_CLASS): New macro. (IS_ID, IS_SUPER): Robustify. (OCTI_EXECCLASS_DECL, execclass_decl): New. (finish_file, start_class, continue_class, finish_class, start_method_def, continue_method_def, finish_method_def, start_protocol, finish_protocol, objc_build_throw_stmt, objc_build_try_catch_finally_stmt, objc_build_synchronized_prologue, objc_build_synchronized_epilogue, objc_build_try_prologue, objc_build_try_epilogue, objc_build_catch_stmt, objc_build_catch_epilogue, objc_build_finally_prologue, objc_build_finally_epilogue, is_ivar, is_private, is_public, add_instance_variable, objc_add_method, get_super_receiver, objc_clear_super_receiver, get_class_ivars_from_name, get_class_reference, get_static_reference, get_object_reference, build_message_expr, finish_message_expr, build_selector_expr, build_ivar_reference, build_keyword_decl, build_method_decl, build_protocol_expr, build_objc_string_object, objc_declare_alias, objc_declare_class, objc_declare_protocols, objc_comptypes, objc_check_decl, build_encode_expr): Remove prototypes. (imp_count, cat_count): Make GGC-aware. (OBJC_SET_TYPE_NAME): New macro. From-SVN: r87168
2004-09-08 02:49:44 +02:00
/* When building Objective-C++, we are not linking against the C front-end
and so need to replicate the C tree-construction functions in some way. */
#ifdef OBJCPLUS
#define OBJCP_REMAP_FUNCTIONS
#include "objcp-decl.h"
#endif /* OBJCPLUS */
/* This is the default way of generating a method name. */
/* I am not sure it is really correct.
Perhaps there's a danger that it will make name conflicts
if method names contain underscores. -- rms. */
#ifndef OBJC_GEN_METHOD_LABEL
#define OBJC_GEN_METHOD_LABEL(BUF, IS_INST, CLASS_NAME, CAT_NAME, SEL_NAME, NUM) \
do { \
char *temp; \
sprintf ((BUF), "_%s_%s_%s_%s", \
((IS_INST) ? "i" : "c"), \
(CLASS_NAME), \
((CAT_NAME)? (CAT_NAME) : ""), \
(SEL_NAME)); \
for (temp = (BUF); *temp; temp++) \
if (*temp == ':') *temp = '_'; \
} while (0)
#endif
/* These need specifying. */
#ifndef OBJC_FORWARDING_STACK_OFFSET
#define OBJC_FORWARDING_STACK_OFFSET 0
#endif
#ifndef OBJC_FORWARDING_MIN_OFFSET
#define OBJC_FORWARDING_MIN_OFFSET 0
#endif
1992-01-18 00:15:38 +01:00
/* Set up for use of obstacks. */
#include "obstack.h"
/* This obstack is used to accumulate the encoding of a data type. */
static struct obstack util_obstack;
/* This points to the beginning of obstack contents, so we can free
the whole contents. */
char *util_firstobj;
1992-01-18 00:15:38 +01:00
/* The version identifies which language generation and runtime
the module (file) was compiled for, and is recorded in the
module descriptor. */
Yet more Objective-C++... * objc-act.c (objc_finish_try_stmt): Add return value. (objc_build_synchronized): Likewise. * objc-act.c (objc_is_gcable_type): Add. (objc_substitute_decl): Add. (objc_build_ivar_assignment): Add. (objc_build_global_assignment): Add. (objc_build_strong_cast_assignment): Add. (objc_is_ivar_reference_p): Add. (objc_is_global_reference_p): Add. (objc_generate_write_barrier): Add. (objc_rewrite_function_call): Add. (objc_gimplify_expr): Add Objective-C++ support. * objc-act.h (ALLOC_OBJC_TYPE_LANG_SPECIFIC): Likewise. (SIZEOF_OBJC_TYPE_LANG_SPECIFIC): Add. (INIT_TYPE_OBJC_INFO): Add Objective-C++ support. (DUP_TYPE_OBJC_INFO): Likewise. (struct imp_entry): Add field has_cxx_cdtors. (struct imp_entry *imp_list): Add OCTI_UMSG_FAST_DECL, OCTI_METH_LIST_TEMPL, OCTI_METH_PROTO_LIST_TEMPL, OCTI_IVAR_LIST_TEMPL, OCTI_ASSIGN_IVAR_DECL, OCTI_ASSIGN_IVAR_FAST_DECL, OCTI_ASSIGN_GLOBAL_DECL, OCTI_ASSIGN_STRONGCAST_DECL. (umsg_fast_decl): Add. (objc_assign_ivar_decl): Add. (objc_assign_ivar_fast_decl): Add. (objc_assign_global_decl): Add. (objc_assign_strong_cast_decl): Add. (objc_method_list_ptr): Add. (objc_method_proto_list_ptr): Add. (objc_ivar_list_ptr): Add. * objc-act.c (should_call_super_dealloc): Add. (OBJC_VERSION): Bump to 6. (objc_is_gcable_type): Add. (objc_substitute_decl): Add. (objc_build_ivar_assignment): Add. (objc_build_global_assignment): Add. (objc_build_strong_cast_assignment): Add. (objc_is_gcable_p): Add. (objc_is_ivar_reference_p): Add. (objc_is_global_reference_p): Add. (generate_shared_structures): Add flags parameter. (objc_generate_cxx_ctor_or_dtor): Add. (objc_generate_cxx_cdtors): Add. (add_class): Add name parameter. (objc_types_share_size_and_alignment): Add. (comp_proto_with_proto): Add strict parameter. (CLS_HAS_CXX_STRUCTORS): Add. (TAG_ASSIGNIVAR): Add. (TAG_ASSIGNGLOBAL): Add. (TAG_ASSIGNSTRONGCAST): Add. (TAG_MSGSEND_FAST): Add. (TAG_ASSIGNIVAR_FAST): Add. (TAG_CXX_CONSTRUCT): Add. (TAG_CXX_DESTRUCT): Add. (OBJC_LOOKUP_CLASS): Add. (OBJC_LOOKUP_NO_SUPER): Add. (objc_finish_file): Add pch support. (objc_finish_implementation): Add Objective-C++ support. (synth_module_prologue): Likewise. (synth_module_prologue): Add fast dispatching. (objc_get_class_reference): Add Objective-C++ support. (objc_generate_write_barrier): Likewise. (next_sjlj_build_enter_and_setjmp): Likewise. (objc_begin_try_stmt): Likewise. (build_next_objc_exception_stuff): Add fast ivar support. (build_private_template): Mark the record as used so debug information is generated. (build_protocol_template): Add Objective-C++ support. (objc_method_parm_type) Likewise. (objc_generate_cxx_ctor_or_dtor): Likewise. (objc_generate_cxx_cdtors): Likewise. (build_protocol_initializer): Likewise. (build_category_template): Likewise. (build_class_template): Likewise. (build_method_list_template): Likewise. (build_category_initializer): Likewise. (build_shared_structure_initializer): Likewise. (objc_finish_message_expr): Likewise. (build_objc_method_call): Add fast dispatch support. (lookup_method_static): Add support to end search at superclasses. (add_method_to_hash_list): Add strict parameter to comp_proto_with_proto. (objc_add_method): Likewise. (objc_add_method): Also set the interface_value. (add_instance_variable): Add Objective-C++ support. (objc_is_public): Likewise. (start_class): Likewise. (continue_class): Likewise. (encode_aggregate_within): Likewise. (start_method_def): Likewise. (objc_start_function): Clear current_function_returns_value and current_function_returns_null. (really_start_method): Add Objective-C++ support. (objc_finish_method_definition): Add warning for missing [super dealloc]. (finish_objc): Add Objective-C++ support. (generate_objc_image_info): Likewise. (objc_lookup_ivar): Likewise. * objc-act.h (TYPE_HAS_OBJC_INFO): Likewise. (INIT_TYPE_OBJC_INFO): Likewise. (DUP_TYPE_OBJC_INFO): Likewise. From-SVN: r99857
2005-05-17 22:07:08 +02:00
#define OBJC_VERSION (flag_next_runtime ? 6 : 8)
#define PROTOCOL_VERSION 2
1992-01-18 00:15:38 +01:00
/* (Decide if these can ever be validly changed.) */
#define OBJC_ENCODE_INLINE_DEFS 0
1992-01-18 00:15:38 +01:00
#define OBJC_ENCODE_DONT_INLINE_DEFS 1
/*** Private Interface (procedures) ***/
1996-07-04 00:07:53 +02:00
/* Used by compile_file. */
static void init_objc (void);
static void finish_objc (void);
1996-07-04 00:07:53 +02:00
/* Code generation. */
1992-01-18 00:15:38 +01:00
static tree objc_build_constructor (tree, tree);
static tree build_objc_method_call (int, tree, tree, tree, tree);
static tree get_proto_encoding (tree);
static tree lookup_interface (tree);
static tree objc_add_static_instance (tree, tree);
Makefile.in (c-parse.o): Depend on $(C_COMMON_H). [gcc/ChangeLog] 2004-09-07 Ziemowit Laski <zlaski@apple.com> * Makefile.in (c-parse.o): Depend on $(C_COMMON_H). * c-parse.in: Include c-common.h instead of objc-act.h. (ivar_decl_list, ivar_decls, ivar_decl, ivars, ivar_declarator, myparms, myparm): Remove %type declarations. (methodtype, optparms, OBJC_TYPE_QUAL, objc_quals, objc_qual, objc_typename, objc_try_catch_stmt, optellipsis): Add %type declarations. (objc_inherit_code, objc_public_flag): Remove. (typespec_nonreserved_nonattr): Call objc_get_protocol_qualified_type() instead of get_static_reference() and get_protocol_reference(). (stmt_nocomp): Call grokparm() on @catch parameter. (objcdef): Move semantic action to objc_finish_implementation(). (classdef): Move semantic action to objc_start_class_interface(), objc_continue_interface(), objc_finish_interface(), objc_start_class_implementation(), objc_continue_implementation(), objc_start_category_interface() and objc_start_category_implementation(). (protocoldef): Move semantic actions to objc_start_protocol() and objc_finish_interface(). (ivar_decl_list): Remove nonterminal. (visibility_spec): Move semantic actions to objc_set_visibility(). (ivar_decls): Remove assignment to $$. (ivar_decl): Rephrase in terms of component_decl; call objc_add_instance_variable(). (ivars, ivar_declarator): Remove nonterminals. (opt_semi): New nonterminal. (methodtype): Remove semantic actions. (methoddef): Move semantic actions to objc_set_method_type(), objc_start_method_definition() and objc_finish_method_definition(). (methodproto): Move semantic actions to objc_set_method_type() and objc_add_method_declaration(). (methoddecl): Use objc_typename instead of typename; move semantic actions to objc_build_method_signature(). (optarglist, myxdecls, mydecl, myparms, myparm): Remove nonterminals. (optparmlist): Express in terms of optparms and optellipsis. (optparms, optellipsis, objc_qual, objc_quals, objc_typename): New nonterminals. (keyworddecl): Use objc_typename instead of typename. (rid_to_yy): Mark RID_IN, RID_OUT, RID_INOUT, RID_BYCOPY, RID_BYREF and RID_ONEWAY as returning OBJC_TYPE_QUAL to yyparse(). [gcc/objc/ChangeLog] 2004-09-07 Ziemowit Laski <zlaski@apple.com> * Make-lang.in (objc/objc-parse.o): Depend on $(C_COMMON_H) instead of objc/objc-act.h. (objc/objc-act.o): Depend on $(HASHTAB_H). * objc-act.c: Include hashtab.h; in ObjC++ mode, include cp-tree.h and objcp-decl.h instead of c-tree.h. (build_module_descriptor, get_class_ivars, synth_id_with_class_suffix, error_with_ivar, gen_method_decl, gen_declaration, setup_string_decl, build_protocol_template): Adjust prototypes. (build_module_initializer_routine, start_class, continue_class, finish_class, start_method_def, objc_start_function, start_protocol, build_method_decl, objc_add_method, add_instance_variable, build_ivar_reference, is_ivar, is_private, get_super_receiver, build_selector_table_decl, objc_push_parm, objc_get_parm_info, gen_type_name, gen_type_name_0, start_var_decl, finish_var_decl, create_field_decl): New prototypes. (objc_expand_function_end, comp_method_with_proto, objc_expr_last, gen_declaration_1, gen_declarator, is_complex_decl, adorn_decl, define_decl, create_builtin_decl, gen_declspecs): Remove prototypes. (TYPE_ID): Rename to OBJECT_TYPEDEF_NAME. (CLASS_TYPEDEF_NAME): New. (TAG_EXECCLASS): Change from a global variable to a #define. (TAG_RETURN_STRUCT): Delete. (TAG_GNUINIT): New, holds '__objc_gnu_init' name. (objc_inherit_code, objc_public_flag): New, moved from c-parse.in. (string_descriptor): New struct. (string_htab): New hash table. (string_hash, string_eq): New prototypes. (generate_struct_by_value_array): Call create_field_decl() instead of create_builtin_decl(). (objc_init): Do not initialize objc_ellipsis_node or TAG_EXECCLASS; In ObjC++ mode, call cxx_init() instead of c_objc_common_init(). (objc_finish_file): In ObjC++, call instantiate_pending_templates() and cp_finish_file(). (define_decl, get_static_reference, get_protocol_reference, create_builtin_decl): Remove functions. (objc_start_class_interface, objc_start_category_interface, objc_start_protocol, objc_continue_interface, objc_finish_interface, objc_start_class_implementation, objc_start_category_implementation, objc_continue_implementation, objc_finish_implementation, objc_set_visibility, objc_set_method_type, objc_build_method_signature, objc_add_method_declaration, objc_start_method_definition, objc_add_instance_variable, objc_get_protocol_qualified_type, create_field_decl, start_var_decl, finish_var_decl): New functions. (setup_string_decl): Simplify since it is only called once. (synth_module_prologue): Call build_class_template(); predefine 'id' and 'Class' as typedefs; rename 'temp_type' to 'type'; disable debug hooks for duration of function; fix GNU runtime messenger signatures to correspond to reality; forward-declare '__objc_exec_class' for the GNU runtime; call build_selector_table_decl(); in ObjC++ mode, generate 'extern "C" { ... }' wrappers around synthesized declarations; call build_protocol_template() and build_category_template(). (string_hash, string_eq): New functions. (objc_build_string_object): Check metaclass correctness only once; store string literals in hash table. (objc_build_constructor): Do not convert initializer elements; adjust for ObjC++ impedance mismatch. (build_objc_symtab_template): Call create_field_decl() instead of create_builtin_decl(). (init_objc_symtab): Add missing conversion to initializer element. (build_metadata_decl): Call start_var_decl() instead of define_decl(). (generate_objc_symtab_decl): Do not call build_category_template(); call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(). (build_module_descriptor): Call create_field_decl() instead of grokfield(); call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(); always mark module descriptor as used; move GNU runtime-specific functionality to build_module_initializer_routine(). (build_module_initializer_routine): New function, broken off of build_module_descriptor(). (objc_static_init_needed_p, objc_generate_static_init_call): New functions. (generate_static_references, generate_strings, build_selector_translation_table, generate_descriptor_table, generate_ivars_list, generate_dispatch_table, generate_category): Call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(); build a type directly instead of via groktypename(). (build_selector_reference_decl, build_selector_table_decl, build_class_reference_decl, build_protocol_reference, generate_objc_image_info): Call start_var_decl() instead of build_decl(). (build_selector_reference): For GNU runtime, do not call build_selector_reference_decl(). (build_selector, build_typed_selector_reference): Always convert result to the selector type. (add_objc_string): Cast return value to 'char *'. (build_method_prototype_template, build_selector_template, build_method_template): Use actual selector type for fields pointing to selectors. (finish_objc): For GNU runtime, call build_module_initializer_routine() after build_module_descriptor(). (generate_protocol_list, generate_shared_structures): Call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(); build a type directly instead of via groktypename(). (synth_id_with_class_suffix): Return a string. (get_arg_type_list): For instance methods, use the instance type for 'self'; do not call groktypename_in_parm_context(). (build_objc_string_decl): Squash redeclaration errors in ObjC++. (objc_is_class_name): Use OBJC_TYPE_NAME instead of TYPE_NAME; handle RECORD_TYPEs in ObjC as well as ObjC++. (objc_is_id): New function. (objc_is_object_ptr): Return the canonical type node. (objc_get_class_ivars): Simplify using get_class_ivars(). (get_class_ivars): Remove second parameter; create a fresh copy of the ivar list for each call; do not check for existence of super class. (objc_eh_runtime_type): Mark #ifndef OBJCPLUS. (objc_init_exceptions): When using SJLJ-style exceptions, require the use of '-fobjc-exceptions' flag; do not require it for DWARF-style exceptions. (objc_build_exc_ptr, next_sjlj_build_try_catch_finally): Use objc_object_type instead of objc_id_type. (objc_begin_catch_clause): Convert the incoming PARM_DECL into a VAR_DECL before placing it in the appropriate scope; do not call define_decl(); adjust call to c_begin_compound_stmt(); use objc_object_type instead of objc_id_type. (build_next_objc_exception_stuff): Call create_field_decl() instead of create_builtin_decl(); construct type directly instead of calling groktypename(); use OBJC_VOID_AT_END to mark end of function parameters. (build_private_template): Adjust call to get_class_ivars(); build a type directly instead of via groktypename(). (build_protocol_template, build_method_prototype_list_template, build_method_prototype_template, build_category_template, build_selector_template, build_class_template, build_super_template, build_ivar_template, build_ivar_list_template, build_method_list_template, build_method_template): Call create_field_decl() instead of grokfield(). (objc_method_parm_type): Do not call groktypename(). (generate_descriptor_table): Call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(). (generate_method_descriptors, build_protocol_initializer, generate_dispatch_tables, build_category_initializer, build_shared_structure_initializer): Do not call groktypename(). (generate_protocols): Call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(); do not call groktypename(). (error_with_ivar): Remove last parameter. (check_ivars): Do not iterate ovar CLASS_RAW_IVARS lists in addition to CLASS_IVARS lists; adjust calls to error_with_ivar(). (generate_ivar_lists): Convert one of the initializer elements; do not call groktypename(). (get_arg_type_list, start_method_def, gen_method_def): Account for new representation of variable arguments and '...' in Objective-C methods; add Objective-C++ impedance matching code. (is_objc_type_qualifier): Remove function. (adjust_type_for_id_default): Simplify; there is no longer a need to wade through declspecs. (lookup_interface, start_class, continue_class, finish_class, start_method_def, start_protocol, build_method_decl, objc_add_method, add_instance_variable, build_ivar_reference, is_ivar, is_private, get_super_receiver, objc_build_finally_epilogue): Make into static functions. (receiver_is_class_object): Use new IS_CLASS() macro. (objc_build_message_expr): Tweak ObjC++ message argument handling; call objc_finish_message_expr() instead of finish_message_expr(). (finish_message_expr): Rename to objc_finish_message_expr(); use OBJC_TYPE_NAME and OBJC_SET_TYPE_NAME macros instead of TYPE_NAME. call gen_type_name() instead of gen_declaration(); call objc_is_id() instead of using IS_ID and IS_CLASS; Use objc_class_name instead of calling get_identifier("Class"); handle CONVERT_EXPRs in receiver. (build_objc_method_call, warn_with_method): Do not call groktypename(). (build_ivar_reference): Call convert() instead of clobbering in a type. (hash_init): Initialize string_htab hash table. (add_instance_variable): Simplify parameter list; do not call grokfield(); do not populate CLASS_IVARS list. (start_class): Check for the existence of super class, if one was specified. (continue_class): Use CLASS_RAW_IVARS rather than CLASS_IVARS; do not call build_class_template(); adjust call to get_class_ivars(); call build_decl(), pushdecl() and finish_decl() instead of define_decl(). (finish_class): Call build_decl(), pushdecl() and finish_decl() instead of define_decl(). (add_protocols): Use PROTOCOL_BINFO_ELTS for the tree vector size. (start_protocol): Do not call build_protocol_template(); use PROTOCOL_BINFO_ELTS for the tree vector size. (encode_type_qualifiers): Do not handle the 'const' qualifier here. (encode_pointer): Encode 'const char *' as 'r*', for backwards compatibility. (encode_array): Use HOST_WIDE_INT_PRINT_DEC instead of "%ld". (encode_type): Handle the 'const' qualifier here. (objc_parmlist): New global variable, sued by objc_push_parm and objc_get_parm_info(). (objc_push_parm, objc_get_parm_info): New functions. (objc_expr_last): Remove function. (synth_self_and_ucmd_args): For instance methods, use the instance type for 'self'; call objc_push_parm() instead of push_parm_decl(). (start_method_def): Do not call push_scope(), declare_parm_level(), pop_scope(), push_parm_decl(), store_parm_decls() or objc_expr_last(); just use objc_push_parm() and objc_get_parm_info(). (comp_method_with_proto): Remove function. (objc_types_are_equivalent): Strip away indirections before comparing underlying types. (comp_proto_with_proto): Do not call groktypename(); types are no longer in raw declspec format. (objc_start_function): New function. (really_start_method): Call comp_proto_with_proto() instead of comp_method_with_proto(); call objc_start_function() instead of hand-crafting a function declarator. (continue_method_def, objc_expand_function_end): Remove functions. (get_super_receiver): Call objc_get_current_scope() instead of get_current_scope(); reference 'super_class' field (instead of 'class'). (finish_method_def): Rename to objc_finish_method_definition() and add a function decl parameter; move method encoding call from objc_expand_function_end(). (is_complex_decl, adorn_decl, gen_declarator, gen_declspecs, gen_declaration_1): Remove functions. (tmpbuf, RAW_DECLSPEC): Remove. (gen_declaration): Remove second parameter; simplify to deal with TYPE_P nodes instead of raw declspecs. (gen_type_name, gen_type_name_0): New functions. (gen_method_decl): Remove second parameter; call gen_type_name() instead of gen_declaration_1(). (dump_interface): Adjust calls to gen_declaration() and gen_method_decl(); do not allocate a separate string buffer. (init_objc): Allocate a larger string buffer to accommodate dump_interface(); adjust call to build_module_descriptor(); add call to build_module_initializer_routine() for the GNU runtime. (generate_classref_translation_entry): Do not call start_decl(); call finish_var_decl() instead of finish_decl(); call convert() instead of build_c_cast(). * objc-act.h (CLASS_OWN_IVARS): Remove accessor. (CLASS_BINFO_ELTS): Reduce from 6 to 5, now that CLASS_OWN_IVARS is gone. (OCTI_GNU_INIT_DECL, GNU_INIT_decl): New. (OCTI_ELLIPSIS_NODE, objc_ellipsis_node): Remove. (OCTI_ID_ID, id_type, objc_id_id): Rename to OCTI_ID_NAME, objc_object_type and objc_object_name, respectively. (OCTI_CLS_REF, OCTI_CLASS_NAME, objc_class_reference, objc_class_name): New. (IS_CLASS): New macro. (IS_ID, IS_SUPER): Robustify. (OCTI_EXECCLASS_DECL, execclass_decl): New. (finish_file, start_class, continue_class, finish_class, start_method_def, continue_method_def, finish_method_def, start_protocol, finish_protocol, objc_build_throw_stmt, objc_build_try_catch_finally_stmt, objc_build_synchronized_prologue, objc_build_synchronized_epilogue, objc_build_try_prologue, objc_build_try_epilogue, objc_build_catch_stmt, objc_build_catch_epilogue, objc_build_finally_prologue, objc_build_finally_epilogue, is_ivar, is_private, is_public, add_instance_variable, objc_add_method, get_super_receiver, objc_clear_super_receiver, get_class_ivars_from_name, get_class_reference, get_static_reference, get_object_reference, build_message_expr, finish_message_expr, build_selector_expr, build_ivar_reference, build_keyword_decl, build_method_decl, build_protocol_expr, build_objc_string_object, objc_declare_alias, objc_declare_class, objc_declare_protocols, objc_comptypes, objc_check_decl, build_encode_expr): Remove prototypes. (imp_count, cat_count): Make GGC-aware. (OBJC_SET_TYPE_NAME): New macro. From-SVN: r87168
2004-09-08 02:49:44 +02:00
static tree start_class (enum tree_code, tree, tree, tree);
static tree continue_class (tree);
static void finish_class (tree);
static void start_method_def (tree);
c-tree.h (enum c_declarator_kind, [...]): New. * c-tree.h (enum c_declarator_kind, struct c_arg_info, struct c_declarator, struct c_type_name, struct c_parm): New. (build_array_declarator, set_array_declarator_inner, get_parm_info, grokfield, groktypename, grokparm, push_parm_decl, start_function, start_decl, build_c_parm, build_attrs_declarator, build_function_declarator, make_pointer_declarator, c_cast_expr, store_parm_decls_newstyle, c_expr_sizeof_type): Update prototypes. (build_id_declarator): New. * c-typeck.c (c_cast_expr, c_expr_sizeof_type): Update to new structures. * c-decl.c (ARG_INFO_PARMS, ARG_INFO_TAGS, ARG_INFO_TYPES, ARG_INFO_OTHERS): Remove. (build_id_declarator): New. (build_array_declarator, set_array_declarator_inner, groktypename, start_decl, grokparm, push_parm_decl, grokparms, get_parm_info, grokfield, start_function, store_parm_decls_newstyle, store_parm_decls_oldstyle, store_parm_decls, build_c_parm, build_attrs_declarator, build_function_declarator, make_pointer_declarator, grokdeclarator): Update to new structures. * c-parse.in (%union): Add arginfotype, dtrtype, typenametype and parmtype. (declarator, notype_declarator, after_type_declarator, parm_declarator, parm_declarator_starttypename, parm_declarator_nostarttypename, array_declarator, typename, absdcl, absdcl1, absdcl1_ea, absdcl1_noea, direct_absdcl1, absdcl_maybe_attribute, parm, firstparm, parms, parmlist, parmlist_1, parmlist_2, parmlist_or_identifiers, parmlist_or_identifiers_1): Use these types. (primary, after_type_declarator, parm_declarator_starttypename, notype_declarator, component_decl, component_declarator, component_notype_declarator, typename, absdcl, absdcl_maybe_attribute, absdcl1_ea, direct_absdcl1, parmlist_1, parmlist_2, parmlist_or_identifiers_1): Update to new structures. objc: * objc-act.c (objc_start_function, really_start_method, objc_get_parm_info, start_method_def): Update to new arg_info structures. From-SVN: r87217
2004-09-09 03:19:15 +02:00
#ifdef OBJCPLUS
Makefile.in (c-parse.o): Depend on $(C_COMMON_H). [gcc/ChangeLog] 2004-09-07 Ziemowit Laski <zlaski@apple.com> * Makefile.in (c-parse.o): Depend on $(C_COMMON_H). * c-parse.in: Include c-common.h instead of objc-act.h. (ivar_decl_list, ivar_decls, ivar_decl, ivars, ivar_declarator, myparms, myparm): Remove %type declarations. (methodtype, optparms, OBJC_TYPE_QUAL, objc_quals, objc_qual, objc_typename, objc_try_catch_stmt, optellipsis): Add %type declarations. (objc_inherit_code, objc_public_flag): Remove. (typespec_nonreserved_nonattr): Call objc_get_protocol_qualified_type() instead of get_static_reference() and get_protocol_reference(). (stmt_nocomp): Call grokparm() on @catch parameter. (objcdef): Move semantic action to objc_finish_implementation(). (classdef): Move semantic action to objc_start_class_interface(), objc_continue_interface(), objc_finish_interface(), objc_start_class_implementation(), objc_continue_implementation(), objc_start_category_interface() and objc_start_category_implementation(). (protocoldef): Move semantic actions to objc_start_protocol() and objc_finish_interface(). (ivar_decl_list): Remove nonterminal. (visibility_spec): Move semantic actions to objc_set_visibility(). (ivar_decls): Remove assignment to $$. (ivar_decl): Rephrase in terms of component_decl; call objc_add_instance_variable(). (ivars, ivar_declarator): Remove nonterminals. (opt_semi): New nonterminal. (methodtype): Remove semantic actions. (methoddef): Move semantic actions to objc_set_method_type(), objc_start_method_definition() and objc_finish_method_definition(). (methodproto): Move semantic actions to objc_set_method_type() and objc_add_method_declaration(). (methoddecl): Use objc_typename instead of typename; move semantic actions to objc_build_method_signature(). (optarglist, myxdecls, mydecl, myparms, myparm): Remove nonterminals. (optparmlist): Express in terms of optparms and optellipsis. (optparms, optellipsis, objc_qual, objc_quals, objc_typename): New nonterminals. (keyworddecl): Use objc_typename instead of typename. (rid_to_yy): Mark RID_IN, RID_OUT, RID_INOUT, RID_BYCOPY, RID_BYREF and RID_ONEWAY as returning OBJC_TYPE_QUAL to yyparse(). [gcc/objc/ChangeLog] 2004-09-07 Ziemowit Laski <zlaski@apple.com> * Make-lang.in (objc/objc-parse.o): Depend on $(C_COMMON_H) instead of objc/objc-act.h. (objc/objc-act.o): Depend on $(HASHTAB_H). * objc-act.c: Include hashtab.h; in ObjC++ mode, include cp-tree.h and objcp-decl.h instead of c-tree.h. (build_module_descriptor, get_class_ivars, synth_id_with_class_suffix, error_with_ivar, gen_method_decl, gen_declaration, setup_string_decl, build_protocol_template): Adjust prototypes. (build_module_initializer_routine, start_class, continue_class, finish_class, start_method_def, objc_start_function, start_protocol, build_method_decl, objc_add_method, add_instance_variable, build_ivar_reference, is_ivar, is_private, get_super_receiver, build_selector_table_decl, objc_push_parm, objc_get_parm_info, gen_type_name, gen_type_name_0, start_var_decl, finish_var_decl, create_field_decl): New prototypes. (objc_expand_function_end, comp_method_with_proto, objc_expr_last, gen_declaration_1, gen_declarator, is_complex_decl, adorn_decl, define_decl, create_builtin_decl, gen_declspecs): Remove prototypes. (TYPE_ID): Rename to OBJECT_TYPEDEF_NAME. (CLASS_TYPEDEF_NAME): New. (TAG_EXECCLASS): Change from a global variable to a #define. (TAG_RETURN_STRUCT): Delete. (TAG_GNUINIT): New, holds '__objc_gnu_init' name. (objc_inherit_code, objc_public_flag): New, moved from c-parse.in. (string_descriptor): New struct. (string_htab): New hash table. (string_hash, string_eq): New prototypes. (generate_struct_by_value_array): Call create_field_decl() instead of create_builtin_decl(). (objc_init): Do not initialize objc_ellipsis_node or TAG_EXECCLASS; In ObjC++ mode, call cxx_init() instead of c_objc_common_init(). (objc_finish_file): In ObjC++, call instantiate_pending_templates() and cp_finish_file(). (define_decl, get_static_reference, get_protocol_reference, create_builtin_decl): Remove functions. (objc_start_class_interface, objc_start_category_interface, objc_start_protocol, objc_continue_interface, objc_finish_interface, objc_start_class_implementation, objc_start_category_implementation, objc_continue_implementation, objc_finish_implementation, objc_set_visibility, objc_set_method_type, objc_build_method_signature, objc_add_method_declaration, objc_start_method_definition, objc_add_instance_variable, objc_get_protocol_qualified_type, create_field_decl, start_var_decl, finish_var_decl): New functions. (setup_string_decl): Simplify since it is only called once. (synth_module_prologue): Call build_class_template(); predefine 'id' and 'Class' as typedefs; rename 'temp_type' to 'type'; disable debug hooks for duration of function; fix GNU runtime messenger signatures to correspond to reality; forward-declare '__objc_exec_class' for the GNU runtime; call build_selector_table_decl(); in ObjC++ mode, generate 'extern "C" { ... }' wrappers around synthesized declarations; call build_protocol_template() and build_category_template(). (string_hash, string_eq): New functions. (objc_build_string_object): Check metaclass correctness only once; store string literals in hash table. (objc_build_constructor): Do not convert initializer elements; adjust for ObjC++ impedance mismatch. (build_objc_symtab_template): Call create_field_decl() instead of create_builtin_decl(). (init_objc_symtab): Add missing conversion to initializer element. (build_metadata_decl): Call start_var_decl() instead of define_decl(). (generate_objc_symtab_decl): Do not call build_category_template(); call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(). (build_module_descriptor): Call create_field_decl() instead of grokfield(); call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(); always mark module descriptor as used; move GNU runtime-specific functionality to build_module_initializer_routine(). (build_module_initializer_routine): New function, broken off of build_module_descriptor(). (objc_static_init_needed_p, objc_generate_static_init_call): New functions. (generate_static_references, generate_strings, build_selector_translation_table, generate_descriptor_table, generate_ivars_list, generate_dispatch_table, generate_category): Call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(); build a type directly instead of via groktypename(). (build_selector_reference_decl, build_selector_table_decl, build_class_reference_decl, build_protocol_reference, generate_objc_image_info): Call start_var_decl() instead of build_decl(). (build_selector_reference): For GNU runtime, do not call build_selector_reference_decl(). (build_selector, build_typed_selector_reference): Always convert result to the selector type. (add_objc_string): Cast return value to 'char *'. (build_method_prototype_template, build_selector_template, build_method_template): Use actual selector type for fields pointing to selectors. (finish_objc): For GNU runtime, call build_module_initializer_routine() after build_module_descriptor(). (generate_protocol_list, generate_shared_structures): Call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(); build a type directly instead of via groktypename(). (synth_id_with_class_suffix): Return a string. (get_arg_type_list): For instance methods, use the instance type for 'self'; do not call groktypename_in_parm_context(). (build_objc_string_decl): Squash redeclaration errors in ObjC++. (objc_is_class_name): Use OBJC_TYPE_NAME instead of TYPE_NAME; handle RECORD_TYPEs in ObjC as well as ObjC++. (objc_is_id): New function. (objc_is_object_ptr): Return the canonical type node. (objc_get_class_ivars): Simplify using get_class_ivars(). (get_class_ivars): Remove second parameter; create a fresh copy of the ivar list for each call; do not check for existence of super class. (objc_eh_runtime_type): Mark #ifndef OBJCPLUS. (objc_init_exceptions): When using SJLJ-style exceptions, require the use of '-fobjc-exceptions' flag; do not require it for DWARF-style exceptions. (objc_build_exc_ptr, next_sjlj_build_try_catch_finally): Use objc_object_type instead of objc_id_type. (objc_begin_catch_clause): Convert the incoming PARM_DECL into a VAR_DECL before placing it in the appropriate scope; do not call define_decl(); adjust call to c_begin_compound_stmt(); use objc_object_type instead of objc_id_type. (build_next_objc_exception_stuff): Call create_field_decl() instead of create_builtin_decl(); construct type directly instead of calling groktypename(); use OBJC_VOID_AT_END to mark end of function parameters. (build_private_template): Adjust call to get_class_ivars(); build a type directly instead of via groktypename(). (build_protocol_template, build_method_prototype_list_template, build_method_prototype_template, build_category_template, build_selector_template, build_class_template, build_super_template, build_ivar_template, build_ivar_list_template, build_method_list_template, build_method_template): Call create_field_decl() instead of grokfield(). (objc_method_parm_type): Do not call groktypename(). (generate_descriptor_table): Call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(). (generate_method_descriptors, build_protocol_initializer, generate_dispatch_tables, build_category_initializer, build_shared_structure_initializer): Do not call groktypename(). (generate_protocols): Call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(); do not call groktypename(). (error_with_ivar): Remove last parameter. (check_ivars): Do not iterate ovar CLASS_RAW_IVARS lists in addition to CLASS_IVARS lists; adjust calls to error_with_ivar(). (generate_ivar_lists): Convert one of the initializer elements; do not call groktypename(). (get_arg_type_list, start_method_def, gen_method_def): Account for new representation of variable arguments and '...' in Objective-C methods; add Objective-C++ impedance matching code. (is_objc_type_qualifier): Remove function. (adjust_type_for_id_default): Simplify; there is no longer a need to wade through declspecs. (lookup_interface, start_class, continue_class, finish_class, start_method_def, start_protocol, build_method_decl, objc_add_method, add_instance_variable, build_ivar_reference, is_ivar, is_private, get_super_receiver, objc_build_finally_epilogue): Make into static functions. (receiver_is_class_object): Use new IS_CLASS() macro. (objc_build_message_expr): Tweak ObjC++ message argument handling; call objc_finish_message_expr() instead of finish_message_expr(). (finish_message_expr): Rename to objc_finish_message_expr(); use OBJC_TYPE_NAME and OBJC_SET_TYPE_NAME macros instead of TYPE_NAME. call gen_type_name() instead of gen_declaration(); call objc_is_id() instead of using IS_ID and IS_CLASS; Use objc_class_name instead of calling get_identifier("Class"); handle CONVERT_EXPRs in receiver. (build_objc_method_call, warn_with_method): Do not call groktypename(). (build_ivar_reference): Call convert() instead of clobbering in a type. (hash_init): Initialize string_htab hash table. (add_instance_variable): Simplify parameter list; do not call grokfield(); do not populate CLASS_IVARS list. (start_class): Check for the existence of super class, if one was specified. (continue_class): Use CLASS_RAW_IVARS rather than CLASS_IVARS; do not call build_class_template(); adjust call to get_class_ivars(); call build_decl(), pushdecl() and finish_decl() instead of define_decl(). (finish_class): Call build_decl(), pushdecl() and finish_decl() instead of define_decl(). (add_protocols): Use PROTOCOL_BINFO_ELTS for the tree vector size. (start_protocol): Do not call build_protocol_template(); use PROTOCOL_BINFO_ELTS for the tree vector size. (encode_type_qualifiers): Do not handle the 'const' qualifier here. (encode_pointer): Encode 'const char *' as 'r*', for backwards compatibility. (encode_array): Use HOST_WIDE_INT_PRINT_DEC instead of "%ld". (encode_type): Handle the 'const' qualifier here. (objc_parmlist): New global variable, sued by objc_push_parm and objc_get_parm_info(). (objc_push_parm, objc_get_parm_info): New functions. (objc_expr_last): Remove function. (synth_self_and_ucmd_args): For instance methods, use the instance type for 'self'; call objc_push_parm() instead of push_parm_decl(). (start_method_def): Do not call push_scope(), declare_parm_level(), pop_scope(), push_parm_decl(), store_parm_decls() or objc_expr_last(); just use objc_push_parm() and objc_get_parm_info(). (comp_method_with_proto): Remove function. (objc_types_are_equivalent): Strip away indirections before comparing underlying types. (comp_proto_with_proto): Do not call groktypename(); types are no longer in raw declspec format. (objc_start_function): New function. (really_start_method): Call comp_proto_with_proto() instead of comp_method_with_proto(); call objc_start_function() instead of hand-crafting a function declarator. (continue_method_def, objc_expand_function_end): Remove functions. (get_super_receiver): Call objc_get_current_scope() instead of get_current_scope(); reference 'super_class' field (instead of 'class'). (finish_method_def): Rename to objc_finish_method_definition() and add a function decl parameter; move method encoding call from objc_expand_function_end(). (is_complex_decl, adorn_decl, gen_declarator, gen_declspecs, gen_declaration_1): Remove functions. (tmpbuf, RAW_DECLSPEC): Remove. (gen_declaration): Remove second parameter; simplify to deal with TYPE_P nodes instead of raw declspecs. (gen_type_name, gen_type_name_0): New functions. (gen_method_decl): Remove second parameter; call gen_type_name() instead of gen_declaration_1(). (dump_interface): Adjust calls to gen_declaration() and gen_method_decl(); do not allocate a separate string buffer. (init_objc): Allocate a larger string buffer to accommodate dump_interface(); adjust call to build_module_descriptor(); add call to build_module_initializer_routine() for the GNU runtime. (generate_classref_translation_entry): Do not call start_decl(); call finish_var_decl() instead of finish_decl(); call convert() instead of build_c_cast(). * objc-act.h (CLASS_OWN_IVARS): Remove accessor. (CLASS_BINFO_ELTS): Reduce from 6 to 5, now that CLASS_OWN_IVARS is gone. (OCTI_GNU_INIT_DECL, GNU_INIT_decl): New. (OCTI_ELLIPSIS_NODE, objc_ellipsis_node): Remove. (OCTI_ID_ID, id_type, objc_id_id): Rename to OCTI_ID_NAME, objc_object_type and objc_object_name, respectively. (OCTI_CLS_REF, OCTI_CLASS_NAME, objc_class_reference, objc_class_name): New. (IS_CLASS): New macro. (IS_ID, IS_SUPER): Robustify. (OCTI_EXECCLASS_DECL, execclass_decl): New. (finish_file, start_class, continue_class, finish_class, start_method_def, continue_method_def, finish_method_def, start_protocol, finish_protocol, objc_build_throw_stmt, objc_build_try_catch_finally_stmt, objc_build_synchronized_prologue, objc_build_synchronized_epilogue, objc_build_try_prologue, objc_build_try_epilogue, objc_build_catch_stmt, objc_build_catch_epilogue, objc_build_finally_prologue, objc_build_finally_epilogue, is_ivar, is_private, is_public, add_instance_variable, objc_add_method, get_super_receiver, objc_clear_super_receiver, get_class_ivars_from_name, get_class_reference, get_static_reference, get_object_reference, build_message_expr, finish_message_expr, build_selector_expr, build_ivar_reference, build_keyword_decl, build_method_decl, build_protocol_expr, build_objc_string_object, objc_declare_alias, objc_declare_class, objc_declare_protocols, objc_comptypes, objc_check_decl, build_encode_expr): Remove prototypes. (imp_count, cat_count): Make GGC-aware. (OBJC_SET_TYPE_NAME): New macro. From-SVN: r87168
2004-09-08 02:49:44 +02:00
static void objc_start_function (tree, tree, tree, tree);
c-tree.h (enum c_declarator_kind, [...]): New. * c-tree.h (enum c_declarator_kind, struct c_arg_info, struct c_declarator, struct c_type_name, struct c_parm): New. (build_array_declarator, set_array_declarator_inner, get_parm_info, grokfield, groktypename, grokparm, push_parm_decl, start_function, start_decl, build_c_parm, build_attrs_declarator, build_function_declarator, make_pointer_declarator, c_cast_expr, store_parm_decls_newstyle, c_expr_sizeof_type): Update prototypes. (build_id_declarator): New. * c-typeck.c (c_cast_expr, c_expr_sizeof_type): Update to new structures. * c-decl.c (ARG_INFO_PARMS, ARG_INFO_TAGS, ARG_INFO_TYPES, ARG_INFO_OTHERS): Remove. (build_id_declarator): New. (build_array_declarator, set_array_declarator_inner, groktypename, start_decl, grokparm, push_parm_decl, grokparms, get_parm_info, grokfield, start_function, store_parm_decls_newstyle, store_parm_decls_oldstyle, store_parm_decls, build_c_parm, build_attrs_declarator, build_function_declarator, make_pointer_declarator, grokdeclarator): Update to new structures. * c-parse.in (%union): Add arginfotype, dtrtype, typenametype and parmtype. (declarator, notype_declarator, after_type_declarator, parm_declarator, parm_declarator_starttypename, parm_declarator_nostarttypename, array_declarator, typename, absdcl, absdcl1, absdcl1_ea, absdcl1_noea, direct_absdcl1, absdcl_maybe_attribute, parm, firstparm, parms, parmlist, parmlist_1, parmlist_2, parmlist_or_identifiers, parmlist_or_identifiers_1): Use these types. (primary, after_type_declarator, parm_declarator_starttypename, notype_declarator, component_decl, component_declarator, component_notype_declarator, typename, absdcl, absdcl_maybe_attribute, absdcl1_ea, direct_absdcl1, parmlist_1, parmlist_2, parmlist_or_identifiers_1): Update to new structures. objc: * objc-act.c (objc_start_function, really_start_method, objc_get_parm_info, start_method_def): Update to new arg_info structures. From-SVN: r87217
2004-09-09 03:19:15 +02:00
#else
static void objc_start_function (tree, tree, tree, struct c_arg_info *);
#endif
Makefile.in (c-parse.o): Depend on $(C_COMMON_H). [gcc/ChangeLog] 2004-09-07 Ziemowit Laski <zlaski@apple.com> * Makefile.in (c-parse.o): Depend on $(C_COMMON_H). * c-parse.in: Include c-common.h instead of objc-act.h. (ivar_decl_list, ivar_decls, ivar_decl, ivars, ivar_declarator, myparms, myparm): Remove %type declarations. (methodtype, optparms, OBJC_TYPE_QUAL, objc_quals, objc_qual, objc_typename, objc_try_catch_stmt, optellipsis): Add %type declarations. (objc_inherit_code, objc_public_flag): Remove. (typespec_nonreserved_nonattr): Call objc_get_protocol_qualified_type() instead of get_static_reference() and get_protocol_reference(). (stmt_nocomp): Call grokparm() on @catch parameter. (objcdef): Move semantic action to objc_finish_implementation(). (classdef): Move semantic action to objc_start_class_interface(), objc_continue_interface(), objc_finish_interface(), objc_start_class_implementation(), objc_continue_implementation(), objc_start_category_interface() and objc_start_category_implementation(). (protocoldef): Move semantic actions to objc_start_protocol() and objc_finish_interface(). (ivar_decl_list): Remove nonterminal. (visibility_spec): Move semantic actions to objc_set_visibility(). (ivar_decls): Remove assignment to $$. (ivar_decl): Rephrase in terms of component_decl; call objc_add_instance_variable(). (ivars, ivar_declarator): Remove nonterminals. (opt_semi): New nonterminal. (methodtype): Remove semantic actions. (methoddef): Move semantic actions to objc_set_method_type(), objc_start_method_definition() and objc_finish_method_definition(). (methodproto): Move semantic actions to objc_set_method_type() and objc_add_method_declaration(). (methoddecl): Use objc_typename instead of typename; move semantic actions to objc_build_method_signature(). (optarglist, myxdecls, mydecl, myparms, myparm): Remove nonterminals. (optparmlist): Express in terms of optparms and optellipsis. (optparms, optellipsis, objc_qual, objc_quals, objc_typename): New nonterminals. (keyworddecl): Use objc_typename instead of typename. (rid_to_yy): Mark RID_IN, RID_OUT, RID_INOUT, RID_BYCOPY, RID_BYREF and RID_ONEWAY as returning OBJC_TYPE_QUAL to yyparse(). [gcc/objc/ChangeLog] 2004-09-07 Ziemowit Laski <zlaski@apple.com> * Make-lang.in (objc/objc-parse.o): Depend on $(C_COMMON_H) instead of objc/objc-act.h. (objc/objc-act.o): Depend on $(HASHTAB_H). * objc-act.c: Include hashtab.h; in ObjC++ mode, include cp-tree.h and objcp-decl.h instead of c-tree.h. (build_module_descriptor, get_class_ivars, synth_id_with_class_suffix, error_with_ivar, gen_method_decl, gen_declaration, setup_string_decl, build_protocol_template): Adjust prototypes. (build_module_initializer_routine, start_class, continue_class, finish_class, start_method_def, objc_start_function, start_protocol, build_method_decl, objc_add_method, add_instance_variable, build_ivar_reference, is_ivar, is_private, get_super_receiver, build_selector_table_decl, objc_push_parm, objc_get_parm_info, gen_type_name, gen_type_name_0, start_var_decl, finish_var_decl, create_field_decl): New prototypes. (objc_expand_function_end, comp_method_with_proto, objc_expr_last, gen_declaration_1, gen_declarator, is_complex_decl, adorn_decl, define_decl, create_builtin_decl, gen_declspecs): Remove prototypes. (TYPE_ID): Rename to OBJECT_TYPEDEF_NAME. (CLASS_TYPEDEF_NAME): New. (TAG_EXECCLASS): Change from a global variable to a #define. (TAG_RETURN_STRUCT): Delete. (TAG_GNUINIT): New, holds '__objc_gnu_init' name. (objc_inherit_code, objc_public_flag): New, moved from c-parse.in. (string_descriptor): New struct. (string_htab): New hash table. (string_hash, string_eq): New prototypes. (generate_struct_by_value_array): Call create_field_decl() instead of create_builtin_decl(). (objc_init): Do not initialize objc_ellipsis_node or TAG_EXECCLASS; In ObjC++ mode, call cxx_init() instead of c_objc_common_init(). (objc_finish_file): In ObjC++, call instantiate_pending_templates() and cp_finish_file(). (define_decl, get_static_reference, get_protocol_reference, create_builtin_decl): Remove functions. (objc_start_class_interface, objc_start_category_interface, objc_start_protocol, objc_continue_interface, objc_finish_interface, objc_start_class_implementation, objc_start_category_implementation, objc_continue_implementation, objc_finish_implementation, objc_set_visibility, objc_set_method_type, objc_build_method_signature, objc_add_method_declaration, objc_start_method_definition, objc_add_instance_variable, objc_get_protocol_qualified_type, create_field_decl, start_var_decl, finish_var_decl): New functions. (setup_string_decl): Simplify since it is only called once. (synth_module_prologue): Call build_class_template(); predefine 'id' and 'Class' as typedefs; rename 'temp_type' to 'type'; disable debug hooks for duration of function; fix GNU runtime messenger signatures to correspond to reality; forward-declare '__objc_exec_class' for the GNU runtime; call build_selector_table_decl(); in ObjC++ mode, generate 'extern "C" { ... }' wrappers around synthesized declarations; call build_protocol_template() and build_category_template(). (string_hash, string_eq): New functions. (objc_build_string_object): Check metaclass correctness only once; store string literals in hash table. (objc_build_constructor): Do not convert initializer elements; adjust for ObjC++ impedance mismatch. (build_objc_symtab_template): Call create_field_decl() instead of create_builtin_decl(). (init_objc_symtab): Add missing conversion to initializer element. (build_metadata_decl): Call start_var_decl() instead of define_decl(). (generate_objc_symtab_decl): Do not call build_category_template(); call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(). (build_module_descriptor): Call create_field_decl() instead of grokfield(); call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(); always mark module descriptor as used; move GNU runtime-specific functionality to build_module_initializer_routine(). (build_module_initializer_routine): New function, broken off of build_module_descriptor(). (objc_static_init_needed_p, objc_generate_static_init_call): New functions. (generate_static_references, generate_strings, build_selector_translation_table, generate_descriptor_table, generate_ivars_list, generate_dispatch_table, generate_category): Call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(); build a type directly instead of via groktypename(). (build_selector_reference_decl, build_selector_table_decl, build_class_reference_decl, build_protocol_reference, generate_objc_image_info): Call start_var_decl() instead of build_decl(). (build_selector_reference): For GNU runtime, do not call build_selector_reference_decl(). (build_selector, build_typed_selector_reference): Always convert result to the selector type. (add_objc_string): Cast return value to 'char *'. (build_method_prototype_template, build_selector_template, build_method_template): Use actual selector type for fields pointing to selectors. (finish_objc): For GNU runtime, call build_module_initializer_routine() after build_module_descriptor(). (generate_protocol_list, generate_shared_structures): Call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(); build a type directly instead of via groktypename(). (synth_id_with_class_suffix): Return a string. (get_arg_type_list): For instance methods, use the instance type for 'self'; do not call groktypename_in_parm_context(). (build_objc_string_decl): Squash redeclaration errors in ObjC++. (objc_is_class_name): Use OBJC_TYPE_NAME instead of TYPE_NAME; handle RECORD_TYPEs in ObjC as well as ObjC++. (objc_is_id): New function. (objc_is_object_ptr): Return the canonical type node. (objc_get_class_ivars): Simplify using get_class_ivars(). (get_class_ivars): Remove second parameter; create a fresh copy of the ivar list for each call; do not check for existence of super class. (objc_eh_runtime_type): Mark #ifndef OBJCPLUS. (objc_init_exceptions): When using SJLJ-style exceptions, require the use of '-fobjc-exceptions' flag; do not require it for DWARF-style exceptions. (objc_build_exc_ptr, next_sjlj_build_try_catch_finally): Use objc_object_type instead of objc_id_type. (objc_begin_catch_clause): Convert the incoming PARM_DECL into a VAR_DECL before placing it in the appropriate scope; do not call define_decl(); adjust call to c_begin_compound_stmt(); use objc_object_type instead of objc_id_type. (build_next_objc_exception_stuff): Call create_field_decl() instead of create_builtin_decl(); construct type directly instead of calling groktypename(); use OBJC_VOID_AT_END to mark end of function parameters. (build_private_template): Adjust call to get_class_ivars(); build a type directly instead of via groktypename(). (build_protocol_template, build_method_prototype_list_template, build_method_prototype_template, build_category_template, build_selector_template, build_class_template, build_super_template, build_ivar_template, build_ivar_list_template, build_method_list_template, build_method_template): Call create_field_decl() instead of grokfield(). (objc_method_parm_type): Do not call groktypename(). (generate_descriptor_table): Call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(). (generate_method_descriptors, build_protocol_initializer, generate_dispatch_tables, build_category_initializer, build_shared_structure_initializer): Do not call groktypename(). (generate_protocols): Call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(); do not call groktypename(). (error_with_ivar): Remove last parameter. (check_ivars): Do not iterate ovar CLASS_RAW_IVARS lists in addition to CLASS_IVARS lists; adjust calls to error_with_ivar(). (generate_ivar_lists): Convert one of the initializer elements; do not call groktypename(). (get_arg_type_list, start_method_def, gen_method_def): Account for new representation of variable arguments and '...' in Objective-C methods; add Objective-C++ impedance matching code. (is_objc_type_qualifier): Remove function. (adjust_type_for_id_default): Simplify; there is no longer a need to wade through declspecs. (lookup_interface, start_class, continue_class, finish_class, start_method_def, start_protocol, build_method_decl, objc_add_method, add_instance_variable, build_ivar_reference, is_ivar, is_private, get_super_receiver, objc_build_finally_epilogue): Make into static functions. (receiver_is_class_object): Use new IS_CLASS() macro. (objc_build_message_expr): Tweak ObjC++ message argument handling; call objc_finish_message_expr() instead of finish_message_expr(). (finish_message_expr): Rename to objc_finish_message_expr(); use OBJC_TYPE_NAME and OBJC_SET_TYPE_NAME macros instead of TYPE_NAME. call gen_type_name() instead of gen_declaration(); call objc_is_id() instead of using IS_ID and IS_CLASS; Use objc_class_name instead of calling get_identifier("Class"); handle CONVERT_EXPRs in receiver. (build_objc_method_call, warn_with_method): Do not call groktypename(). (build_ivar_reference): Call convert() instead of clobbering in a type. (hash_init): Initialize string_htab hash table. (add_instance_variable): Simplify parameter list; do not call grokfield(); do not populate CLASS_IVARS list. (start_class): Check for the existence of super class, if one was specified. (continue_class): Use CLASS_RAW_IVARS rather than CLASS_IVARS; do not call build_class_template(); adjust call to get_class_ivars(); call build_decl(), pushdecl() and finish_decl() instead of define_decl(). (finish_class): Call build_decl(), pushdecl() and finish_decl() instead of define_decl(). (add_protocols): Use PROTOCOL_BINFO_ELTS for the tree vector size. (start_protocol): Do not call build_protocol_template(); use PROTOCOL_BINFO_ELTS for the tree vector size. (encode_type_qualifiers): Do not handle the 'const' qualifier here. (encode_pointer): Encode 'const char *' as 'r*', for backwards compatibility. (encode_array): Use HOST_WIDE_INT_PRINT_DEC instead of "%ld". (encode_type): Handle the 'const' qualifier here. (objc_parmlist): New global variable, sued by objc_push_parm and objc_get_parm_info(). (objc_push_parm, objc_get_parm_info): New functions. (objc_expr_last): Remove function. (synth_self_and_ucmd_args): For instance methods, use the instance type for 'self'; call objc_push_parm() instead of push_parm_decl(). (start_method_def): Do not call push_scope(), declare_parm_level(), pop_scope(), push_parm_decl(), store_parm_decls() or objc_expr_last(); just use objc_push_parm() and objc_get_parm_info(). (comp_method_with_proto): Remove function. (objc_types_are_equivalent): Strip away indirections before comparing underlying types. (comp_proto_with_proto): Do not call groktypename(); types are no longer in raw declspec format. (objc_start_function): New function. (really_start_method): Call comp_proto_with_proto() instead of comp_method_with_proto(); call objc_start_function() instead of hand-crafting a function declarator. (continue_method_def, objc_expand_function_end): Remove functions. (get_super_receiver): Call objc_get_current_scope() instead of get_current_scope(); reference 'super_class' field (instead of 'class'). (finish_method_def): Rename to objc_finish_method_definition() and add a function decl parameter; move method encoding call from objc_expand_function_end(). (is_complex_decl, adorn_decl, gen_declarator, gen_declspecs, gen_declaration_1): Remove functions. (tmpbuf, RAW_DECLSPEC): Remove. (gen_declaration): Remove second parameter; simplify to deal with TYPE_P nodes instead of raw declspecs. (gen_type_name, gen_type_name_0): New functions. (gen_method_decl): Remove second parameter; call gen_type_name() instead of gen_declaration_1(). (dump_interface): Adjust calls to gen_declaration() and gen_method_decl(); do not allocate a separate string buffer. (init_objc): Allocate a larger string buffer to accommodate dump_interface(); adjust call to build_module_descriptor(); add call to build_module_initializer_routine() for the GNU runtime. (generate_classref_translation_entry): Do not call start_decl(); call finish_var_decl() instead of finish_decl(); call convert() instead of build_c_cast(). * objc-act.h (CLASS_OWN_IVARS): Remove accessor. (CLASS_BINFO_ELTS): Reduce from 6 to 5, now that CLASS_OWN_IVARS is gone. (OCTI_GNU_INIT_DECL, GNU_INIT_decl): New. (OCTI_ELLIPSIS_NODE, objc_ellipsis_node): Remove. (OCTI_ID_ID, id_type, objc_id_id): Rename to OCTI_ID_NAME, objc_object_type and objc_object_name, respectively. (OCTI_CLS_REF, OCTI_CLASS_NAME, objc_class_reference, objc_class_name): New. (IS_CLASS): New macro. (IS_ID, IS_SUPER): Robustify. (OCTI_EXECCLASS_DECL, execclass_decl): New. (finish_file, start_class, continue_class, finish_class, start_method_def, continue_method_def, finish_method_def, start_protocol, finish_protocol, objc_build_throw_stmt, objc_build_try_catch_finally_stmt, objc_build_synchronized_prologue, objc_build_synchronized_epilogue, objc_build_try_prologue, objc_build_try_epilogue, objc_build_catch_stmt, objc_build_catch_epilogue, objc_build_finally_prologue, objc_build_finally_epilogue, is_ivar, is_private, is_public, add_instance_variable, objc_add_method, get_super_receiver, objc_clear_super_receiver, get_class_ivars_from_name, get_class_reference, get_static_reference, get_object_reference, build_message_expr, finish_message_expr, build_selector_expr, build_ivar_reference, build_keyword_decl, build_method_decl, build_protocol_expr, build_objc_string_object, objc_declare_alias, objc_declare_class, objc_declare_protocols, objc_comptypes, objc_check_decl, build_encode_expr): Remove prototypes. (imp_count, cat_count): Make GGC-aware. (OBJC_SET_TYPE_NAME): New macro. From-SVN: r87168
2004-09-08 02:49:44 +02:00
static tree start_protocol (enum tree_code, tree, tree);
static tree build_method_decl (enum tree_code, tree, tree, tree, bool);
Makefile.in (c-parse.o): Depend on $(C_COMMON_H). [gcc/ChangeLog] 2004-09-07 Ziemowit Laski <zlaski@apple.com> * Makefile.in (c-parse.o): Depend on $(C_COMMON_H). * c-parse.in: Include c-common.h instead of objc-act.h. (ivar_decl_list, ivar_decls, ivar_decl, ivars, ivar_declarator, myparms, myparm): Remove %type declarations. (methodtype, optparms, OBJC_TYPE_QUAL, objc_quals, objc_qual, objc_typename, objc_try_catch_stmt, optellipsis): Add %type declarations. (objc_inherit_code, objc_public_flag): Remove. (typespec_nonreserved_nonattr): Call objc_get_protocol_qualified_type() instead of get_static_reference() and get_protocol_reference(). (stmt_nocomp): Call grokparm() on @catch parameter. (objcdef): Move semantic action to objc_finish_implementation(). (classdef): Move semantic action to objc_start_class_interface(), objc_continue_interface(), objc_finish_interface(), objc_start_class_implementation(), objc_continue_implementation(), objc_start_category_interface() and objc_start_category_implementation(). (protocoldef): Move semantic actions to objc_start_protocol() and objc_finish_interface(). (ivar_decl_list): Remove nonterminal. (visibility_spec): Move semantic actions to objc_set_visibility(). (ivar_decls): Remove assignment to $$. (ivar_decl): Rephrase in terms of component_decl; call objc_add_instance_variable(). (ivars, ivar_declarator): Remove nonterminals. (opt_semi): New nonterminal. (methodtype): Remove semantic actions. (methoddef): Move semantic actions to objc_set_method_type(), objc_start_method_definition() and objc_finish_method_definition(). (methodproto): Move semantic actions to objc_set_method_type() and objc_add_method_declaration(). (methoddecl): Use objc_typename instead of typename; move semantic actions to objc_build_method_signature(). (optarglist, myxdecls, mydecl, myparms, myparm): Remove nonterminals. (optparmlist): Express in terms of optparms and optellipsis. (optparms, optellipsis, objc_qual, objc_quals, objc_typename): New nonterminals. (keyworddecl): Use objc_typename instead of typename. (rid_to_yy): Mark RID_IN, RID_OUT, RID_INOUT, RID_BYCOPY, RID_BYREF and RID_ONEWAY as returning OBJC_TYPE_QUAL to yyparse(). [gcc/objc/ChangeLog] 2004-09-07 Ziemowit Laski <zlaski@apple.com> * Make-lang.in (objc/objc-parse.o): Depend on $(C_COMMON_H) instead of objc/objc-act.h. (objc/objc-act.o): Depend on $(HASHTAB_H). * objc-act.c: Include hashtab.h; in ObjC++ mode, include cp-tree.h and objcp-decl.h instead of c-tree.h. (build_module_descriptor, get_class_ivars, synth_id_with_class_suffix, error_with_ivar, gen_method_decl, gen_declaration, setup_string_decl, build_protocol_template): Adjust prototypes. (build_module_initializer_routine, start_class, continue_class, finish_class, start_method_def, objc_start_function, start_protocol, build_method_decl, objc_add_method, add_instance_variable, build_ivar_reference, is_ivar, is_private, get_super_receiver, build_selector_table_decl, objc_push_parm, objc_get_parm_info, gen_type_name, gen_type_name_0, start_var_decl, finish_var_decl, create_field_decl): New prototypes. (objc_expand_function_end, comp_method_with_proto, objc_expr_last, gen_declaration_1, gen_declarator, is_complex_decl, adorn_decl, define_decl, create_builtin_decl, gen_declspecs): Remove prototypes. (TYPE_ID): Rename to OBJECT_TYPEDEF_NAME. (CLASS_TYPEDEF_NAME): New. (TAG_EXECCLASS): Change from a global variable to a #define. (TAG_RETURN_STRUCT): Delete. (TAG_GNUINIT): New, holds '__objc_gnu_init' name. (objc_inherit_code, objc_public_flag): New, moved from c-parse.in. (string_descriptor): New struct. (string_htab): New hash table. (string_hash, string_eq): New prototypes. (generate_struct_by_value_array): Call create_field_decl() instead of create_builtin_decl(). (objc_init): Do not initialize objc_ellipsis_node or TAG_EXECCLASS; In ObjC++ mode, call cxx_init() instead of c_objc_common_init(). (objc_finish_file): In ObjC++, call instantiate_pending_templates() and cp_finish_file(). (define_decl, get_static_reference, get_protocol_reference, create_builtin_decl): Remove functions. (objc_start_class_interface, objc_start_category_interface, objc_start_protocol, objc_continue_interface, objc_finish_interface, objc_start_class_implementation, objc_start_category_implementation, objc_continue_implementation, objc_finish_implementation, objc_set_visibility, objc_set_method_type, objc_build_method_signature, objc_add_method_declaration, objc_start_method_definition, objc_add_instance_variable, objc_get_protocol_qualified_type, create_field_decl, start_var_decl, finish_var_decl): New functions. (setup_string_decl): Simplify since it is only called once. (synth_module_prologue): Call build_class_template(); predefine 'id' and 'Class' as typedefs; rename 'temp_type' to 'type'; disable debug hooks for duration of function; fix GNU runtime messenger signatures to correspond to reality; forward-declare '__objc_exec_class' for the GNU runtime; call build_selector_table_decl(); in ObjC++ mode, generate 'extern "C" { ... }' wrappers around synthesized declarations; call build_protocol_template() and build_category_template(). (string_hash, string_eq): New functions. (objc_build_string_object): Check metaclass correctness only once; store string literals in hash table. (objc_build_constructor): Do not convert initializer elements; adjust for ObjC++ impedance mismatch. (build_objc_symtab_template): Call create_field_decl() instead of create_builtin_decl(). (init_objc_symtab): Add missing conversion to initializer element. (build_metadata_decl): Call start_var_decl() instead of define_decl(). (generate_objc_symtab_decl): Do not call build_category_template(); call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(). (build_module_descriptor): Call create_field_decl() instead of grokfield(); call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(); always mark module descriptor as used; move GNU runtime-specific functionality to build_module_initializer_routine(). (build_module_initializer_routine): New function, broken off of build_module_descriptor(). (objc_static_init_needed_p, objc_generate_static_init_call): New functions. (generate_static_references, generate_strings, build_selector_translation_table, generate_descriptor_table, generate_ivars_list, generate_dispatch_table, generate_category): Call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(); build a type directly instead of via groktypename(). (build_selector_reference_decl, build_selector_table_decl, build_class_reference_decl, build_protocol_reference, generate_objc_image_info): Call start_var_decl() instead of build_decl(). (build_selector_reference): For GNU runtime, do not call build_selector_reference_decl(). (build_selector, build_typed_selector_reference): Always convert result to the selector type. (add_objc_string): Cast return value to 'char *'. (build_method_prototype_template, build_selector_template, build_method_template): Use actual selector type for fields pointing to selectors. (finish_objc): For GNU runtime, call build_module_initializer_routine() after build_module_descriptor(). (generate_protocol_list, generate_shared_structures): Call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(); build a type directly instead of via groktypename(). (synth_id_with_class_suffix): Return a string. (get_arg_type_list): For instance methods, use the instance type for 'self'; do not call groktypename_in_parm_context(). (build_objc_string_decl): Squash redeclaration errors in ObjC++. (objc_is_class_name): Use OBJC_TYPE_NAME instead of TYPE_NAME; handle RECORD_TYPEs in ObjC as well as ObjC++. (objc_is_id): New function. (objc_is_object_ptr): Return the canonical type node. (objc_get_class_ivars): Simplify using get_class_ivars(). (get_class_ivars): Remove second parameter; create a fresh copy of the ivar list for each call; do not check for existence of super class. (objc_eh_runtime_type): Mark #ifndef OBJCPLUS. (objc_init_exceptions): When using SJLJ-style exceptions, require the use of '-fobjc-exceptions' flag; do not require it for DWARF-style exceptions. (objc_build_exc_ptr, next_sjlj_build_try_catch_finally): Use objc_object_type instead of objc_id_type. (objc_begin_catch_clause): Convert the incoming PARM_DECL into a VAR_DECL before placing it in the appropriate scope; do not call define_decl(); adjust call to c_begin_compound_stmt(); use objc_object_type instead of objc_id_type. (build_next_objc_exception_stuff): Call create_field_decl() instead of create_builtin_decl(); construct type directly instead of calling groktypename(); use OBJC_VOID_AT_END to mark end of function parameters. (build_private_template): Adjust call to get_class_ivars(); build a type directly instead of via groktypename(). (build_protocol_template, build_method_prototype_list_template, build_method_prototype_template, build_category_template, build_selector_template, build_class_template, build_super_template, build_ivar_template, build_ivar_list_template, build_method_list_template, build_method_template): Call create_field_decl() instead of grokfield(). (objc_method_parm_type): Do not call groktypename(). (generate_descriptor_table): Call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(). (generate_method_descriptors, build_protocol_initializer, generate_dispatch_tables, build_category_initializer, build_shared_structure_initializer): Do not call groktypename(). (generate_protocols): Call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(); do not call groktypename(). (error_with_ivar): Remove last parameter. (check_ivars): Do not iterate ovar CLASS_RAW_IVARS lists in addition to CLASS_IVARS lists; adjust calls to error_with_ivar(). (generate_ivar_lists): Convert one of the initializer elements; do not call groktypename(). (get_arg_type_list, start_method_def, gen_method_def): Account for new representation of variable arguments and '...' in Objective-C methods; add Objective-C++ impedance matching code. (is_objc_type_qualifier): Remove function. (adjust_type_for_id_default): Simplify; there is no longer a need to wade through declspecs. (lookup_interface, start_class, continue_class, finish_class, start_method_def, start_protocol, build_method_decl, objc_add_method, add_instance_variable, build_ivar_reference, is_ivar, is_private, get_super_receiver, objc_build_finally_epilogue): Make into static functions. (receiver_is_class_object): Use new IS_CLASS() macro. (objc_build_message_expr): Tweak ObjC++ message argument handling; call objc_finish_message_expr() instead of finish_message_expr(). (finish_message_expr): Rename to objc_finish_message_expr(); use OBJC_TYPE_NAME and OBJC_SET_TYPE_NAME macros instead of TYPE_NAME. call gen_type_name() instead of gen_declaration(); call objc_is_id() instead of using IS_ID and IS_CLASS; Use objc_class_name instead of calling get_identifier("Class"); handle CONVERT_EXPRs in receiver. (build_objc_method_call, warn_with_method): Do not call groktypename(). (build_ivar_reference): Call convert() instead of clobbering in a type. (hash_init): Initialize string_htab hash table. (add_instance_variable): Simplify parameter list; do not call grokfield(); do not populate CLASS_IVARS list. (start_class): Check for the existence of super class, if one was specified. (continue_class): Use CLASS_RAW_IVARS rather than CLASS_IVARS; do not call build_class_template(); adjust call to get_class_ivars(); call build_decl(), pushdecl() and finish_decl() instead of define_decl(). (finish_class): Call build_decl(), pushdecl() and finish_decl() instead of define_decl(). (add_protocols): Use PROTOCOL_BINFO_ELTS for the tree vector size. (start_protocol): Do not call build_protocol_template(); use PROTOCOL_BINFO_ELTS for the tree vector size. (encode_type_qualifiers): Do not handle the 'const' qualifier here. (encode_pointer): Encode 'const char *' as 'r*', for backwards compatibility. (encode_array): Use HOST_WIDE_INT_PRINT_DEC instead of "%ld". (encode_type): Handle the 'const' qualifier here. (objc_parmlist): New global variable, sued by objc_push_parm and objc_get_parm_info(). (objc_push_parm, objc_get_parm_info): New functions. (objc_expr_last): Remove function. (synth_self_and_ucmd_args): For instance methods, use the instance type for 'self'; call objc_push_parm() instead of push_parm_decl(). (start_method_def): Do not call push_scope(), declare_parm_level(), pop_scope(), push_parm_decl(), store_parm_decls() or objc_expr_last(); just use objc_push_parm() and objc_get_parm_info(). (comp_method_with_proto): Remove function. (objc_types_are_equivalent): Strip away indirections before comparing underlying types. (comp_proto_with_proto): Do not call groktypename(); types are no longer in raw declspec format. (objc_start_function): New function. (really_start_method): Call comp_proto_with_proto() instead of comp_method_with_proto(); call objc_start_function() instead of hand-crafting a function declarator. (continue_method_def, objc_expand_function_end): Remove functions. (get_super_receiver): Call objc_get_current_scope() instead of get_current_scope(); reference 'super_class' field (instead of 'class'). (finish_method_def): Rename to objc_finish_method_definition() and add a function decl parameter; move method encoding call from objc_expand_function_end(). (is_complex_decl, adorn_decl, gen_declarator, gen_declspecs, gen_declaration_1): Remove functions. (tmpbuf, RAW_DECLSPEC): Remove. (gen_declaration): Remove second parameter; simplify to deal with TYPE_P nodes instead of raw declspecs. (gen_type_name, gen_type_name_0): New functions. (gen_method_decl): Remove second parameter; call gen_type_name() instead of gen_declaration_1(). (dump_interface): Adjust calls to gen_declaration() and gen_method_decl(); do not allocate a separate string buffer. (init_objc): Allocate a larger string buffer to accommodate dump_interface(); adjust call to build_module_descriptor(); add call to build_module_initializer_routine() for the GNU runtime. (generate_classref_translation_entry): Do not call start_decl(); call finish_var_decl() instead of finish_decl(); call convert() instead of build_c_cast(). * objc-act.h (CLASS_OWN_IVARS): Remove accessor. (CLASS_BINFO_ELTS): Reduce from 6 to 5, now that CLASS_OWN_IVARS is gone. (OCTI_GNU_INIT_DECL, GNU_INIT_decl): New. (OCTI_ELLIPSIS_NODE, objc_ellipsis_node): Remove. (OCTI_ID_ID, id_type, objc_id_id): Rename to OCTI_ID_NAME, objc_object_type and objc_object_name, respectively. (OCTI_CLS_REF, OCTI_CLASS_NAME, objc_class_reference, objc_class_name): New. (IS_CLASS): New macro. (IS_ID, IS_SUPER): Robustify. (OCTI_EXECCLASS_DECL, execclass_decl): New. (finish_file, start_class, continue_class, finish_class, start_method_def, continue_method_def, finish_method_def, start_protocol, finish_protocol, objc_build_throw_stmt, objc_build_try_catch_finally_stmt, objc_build_synchronized_prologue, objc_build_synchronized_epilogue, objc_build_try_prologue, objc_build_try_epilogue, objc_build_catch_stmt, objc_build_catch_epilogue, objc_build_finally_prologue, objc_build_finally_epilogue, is_ivar, is_private, is_public, add_instance_variable, objc_add_method, get_super_receiver, objc_clear_super_receiver, get_class_ivars_from_name, get_class_reference, get_static_reference, get_object_reference, build_message_expr, finish_message_expr, build_selector_expr, build_ivar_reference, build_keyword_decl, build_method_decl, build_protocol_expr, build_objc_string_object, objc_declare_alias, objc_declare_class, objc_declare_protocols, objc_comptypes, objc_check_decl, build_encode_expr): Remove prototypes. (imp_count, cat_count): Make GGC-aware. (OBJC_SET_TYPE_NAME): New macro. From-SVN: r87168
2004-09-08 02:49:44 +02:00
static tree objc_add_method (tree, tree, int);
static tree add_instance_variable (tree, int, tree);
static tree build_ivar_reference (tree);
static tree is_ivar (tree, tree);
static void build_objc_exception_stuff (void);
c-common.c (flag_objc_sjlj_exceptions): New. * c-common.c (flag_objc_sjlj_exceptions): New. * c-common.h (flag_objc_sjlj_exceptions): Declare. * c-opts.c (c_common_handle_option): Set it. (c_common_post_options): Handle interation of different objective-c exception and runtime switches. * c-decl.c (c_eh_initialized_p): New. (finish_decl): Use it instead of local eh_initialized_p. * c-parse.in (nested_function, notype_nested_function): Record the result of compstmt. (compstmt_or_error): Likewise. (compstmt): Don't add_stmt the result. (stmt): Don't return anything. Rewrite objc try and sync rules. (objc_try_stmt, objc_catch_list): Remove. (objc_catch_block, objc_finally_block): Remove. (objc_catch_prefix, objc_catch_clause, objc_opt_catch_list): New. (objc_try_catch_clause, objc_finally_clause): New. (objc_try_catch_stmt): Rewrite. * c-tree.h (c_eh_initialized_p): Declare. * c-opt (fobjc-sjlj-exceptions): New. * except.c (output_function_exception_table): Don't call cgraph on non-decls. * objc/objc-act.c (UTAG_EXCDATA_VAR, UTAG_CAUGHTEXC_VAR, UTAG_RETHROWEXC_VAR, UTAG_EVALONCE_VAR, struct val_stack, catch_count_stack, exc_binding_stack, if_nesting_count, blk_nesting_count, objc_enter_block, objc_exit_block, objc_declare_variable, 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): Remove. (objc_create_temporary_var, struct objc_try_context, cur_try_context, objc_eh_runtime_type, objc_init_exceptions, objc_build_exc_ptr, next_sjlj_build_try_exit, next_sjlj_build_enter_and_setjmp, next_sjlj_build_exc_extract, next_sjlj_build_catch_list, next_sjlj_build_try_catch_finally, objc_begin_try_stmt, objc_begin_catch_clause, objc_finish_catch_clause, objc_build_finally_clause, objc_finish_try_stmt, objc_build_synchronized): New. (objc_is_object_id, objc_is_class_id): New. (objc_comptypes): Use them. (build_next_objc_exception_stuff): Break NeXT sjlj out from build_objc_exception_stuff. (synth_module_prologue): Update to match. (objc_build_throw_stmt): Use cur_try_context to decide if we're in a @catch. * objc/objc-act.h: Update prototypes. (OCTI_EXCEPTION_BLK_STACK, objc_exception_block_stack): Remove. testsuite/ * objc.dg/sync-1.m: New. * objc.dg/try-catch-1.m: Don't force next runtime. * objc.dg/try-catch-3.m, objc.dg/try-catch-4.m: Likewise. * objc.dg/try-catch-2.m: Likewise. Enable everywhere. Remove shadowed catch clause. * objc.dg/try-catch-5.m: New. From-SVN: r83332
2004-06-18 03:20:53 +02:00
static void build_next_objc_exception_stuff (void);
objc-act.c (objc_build_struct): New function. * objc-act.c (objc_build_struct): New function. (objc_derived_from_p): Likewise. (objc_build_component_ref): Likewise. (objc_copy_binfo): Likewise. (objc_xref_basetypes): Likewise. (objc_lookup_protocol): Likewise. (objc_compare_protocols): Likewise. (objc_volatilize_decl): Likewise. (encode_aggregate_fields): Likewise. (volatilized_hash): Likewise. (volatilized_eq): Likewise. (objc_compare_types): Likewise. (objc_type_quals_match): Likewise. (DERIVED_FROM_P): New ObjC macro, corresponding to C++ macro of same name. (get_class_ivars): Add second parameter indicating if entire hierarchy is desired. (struct volatilized_type): New type. (volatilized_htab): New hash table. (objc_types_compatible_p, objc_comptypes): Remove functions. (synth_module_prologue): Do not initialize 'unused_list'. (objc_get_class_reference): Fix ObjC++ impedance mismatches. (objc_declare_alias): Implement as a typedef. (objc_substitute_decl, objc_gimplify_expr): Reformat. (objc_get_class_ivars): Adjust call to get_class_ivars(). (next_sjlj_build_enter_and_setjmp, synth_forward_declarations, build_ivar_reference, get_super_receiver): Call objc_build_component_ref() instead of build_component_ref(). (objc_begin_catch_clause): Use DERIVED_FROM_P() instead of objc_comptypes(). (build_private_template): Call objc_build_struct() instead of start_struct() and finish_struct(). (hash_init): Initialize volatilized_htab. (objc_is_public): Adjust calls to objc_get_ivars(); adjust ObjC++ impedance mismatches. (encode_aggregate_within): Streamline by calling encode_aggregate_fields(). * objc-act.h (objc_types_compatible_p): Remove prototype. (OCTI_UNUSED_LIST, unused_list): Remove slot. * objc-lang.c (LANG_HOOKS_TYPES_COMPATIBLE_P): Remove. From-SVN: r100123
2005-05-25 00:21:01 +02:00
/* We only need the following for ObjC; ObjC++ will use C++'s definition
of DERIVED_FROM_P. */
#ifndef OBJCPLUS
static bool objc_derived_from_p (tree, tree);
#define DERIVED_FROM_P(PARENT, CHILD) objc_derived_from_p (PARENT, CHILD)
#endif
static void objc_xref_basetypes (tree, tree);
static void build_class_template (void);
static void build_selector_template (void);
static void build_category_template (void);
static void build_super_template (void);
static tree build_protocol_initializer (tree, tree, tree, tree, tree);
objc-act.c (objc_build_struct): New function. * objc-act.c (objc_build_struct): New function. (objc_derived_from_p): Likewise. (objc_build_component_ref): Likewise. (objc_copy_binfo): Likewise. (objc_xref_basetypes): Likewise. (objc_lookup_protocol): Likewise. (objc_compare_protocols): Likewise. (objc_volatilize_decl): Likewise. (encode_aggregate_fields): Likewise. (volatilized_hash): Likewise. (volatilized_eq): Likewise. (objc_compare_types): Likewise. (objc_type_quals_match): Likewise. (DERIVED_FROM_P): New ObjC macro, corresponding to C++ macro of same name. (get_class_ivars): Add second parameter indicating if entire hierarchy is desired. (struct volatilized_type): New type. (volatilized_htab): New hash table. (objc_types_compatible_p, objc_comptypes): Remove functions. (synth_module_prologue): Do not initialize 'unused_list'. (objc_get_class_reference): Fix ObjC++ impedance mismatches. (objc_declare_alias): Implement as a typedef. (objc_substitute_decl, objc_gimplify_expr): Reformat. (objc_get_class_ivars): Adjust call to get_class_ivars(). (next_sjlj_build_enter_and_setjmp, synth_forward_declarations, build_ivar_reference, get_super_receiver): Call objc_build_component_ref() instead of build_component_ref(). (objc_begin_catch_clause): Use DERIVED_FROM_P() instead of objc_comptypes(). (build_private_template): Call objc_build_struct() instead of start_struct() and finish_struct(). (hash_init): Initialize volatilized_htab. (objc_is_public): Adjust calls to objc_get_ivars(); adjust ObjC++ impedance mismatches. (encode_aggregate_within): Streamline by calling encode_aggregate_fields(). * objc-act.h (objc_types_compatible_p): Remove prototype. (OCTI_UNUSED_LIST, unused_list): Remove slot. * objc-lang.c (LANG_HOOKS_TYPES_COMPATIBLE_P): Remove. From-SVN: r100123
2005-05-25 00:21:01 +02:00
static tree get_class_ivars (tree, bool);
static tree generate_protocol_list (tree);
static void build_protocol_reference (tree);
Yet more Objective-C++... * objc-act.c (objc_finish_try_stmt): Add return value. (objc_build_synchronized): Likewise. * objc-act.c (objc_is_gcable_type): Add. (objc_substitute_decl): Add. (objc_build_ivar_assignment): Add. (objc_build_global_assignment): Add. (objc_build_strong_cast_assignment): Add. (objc_is_ivar_reference_p): Add. (objc_is_global_reference_p): Add. (objc_generate_write_barrier): Add. (objc_rewrite_function_call): Add. (objc_gimplify_expr): Add Objective-C++ support. * objc-act.h (ALLOC_OBJC_TYPE_LANG_SPECIFIC): Likewise. (SIZEOF_OBJC_TYPE_LANG_SPECIFIC): Add. (INIT_TYPE_OBJC_INFO): Add Objective-C++ support. (DUP_TYPE_OBJC_INFO): Likewise. (struct imp_entry): Add field has_cxx_cdtors. (struct imp_entry *imp_list): Add OCTI_UMSG_FAST_DECL, OCTI_METH_LIST_TEMPL, OCTI_METH_PROTO_LIST_TEMPL, OCTI_IVAR_LIST_TEMPL, OCTI_ASSIGN_IVAR_DECL, OCTI_ASSIGN_IVAR_FAST_DECL, OCTI_ASSIGN_GLOBAL_DECL, OCTI_ASSIGN_STRONGCAST_DECL. (umsg_fast_decl): Add. (objc_assign_ivar_decl): Add. (objc_assign_ivar_fast_decl): Add. (objc_assign_global_decl): Add. (objc_assign_strong_cast_decl): Add. (objc_method_list_ptr): Add. (objc_method_proto_list_ptr): Add. (objc_ivar_list_ptr): Add. * objc-act.c (should_call_super_dealloc): Add. (OBJC_VERSION): Bump to 6. (objc_is_gcable_type): Add. (objc_substitute_decl): Add. (objc_build_ivar_assignment): Add. (objc_build_global_assignment): Add. (objc_build_strong_cast_assignment): Add. (objc_is_gcable_p): Add. (objc_is_ivar_reference_p): Add. (objc_is_global_reference_p): Add. (generate_shared_structures): Add flags parameter. (objc_generate_cxx_ctor_or_dtor): Add. (objc_generate_cxx_cdtors): Add. (add_class): Add name parameter. (objc_types_share_size_and_alignment): Add. (comp_proto_with_proto): Add strict parameter. (CLS_HAS_CXX_STRUCTORS): Add. (TAG_ASSIGNIVAR): Add. (TAG_ASSIGNGLOBAL): Add. (TAG_ASSIGNSTRONGCAST): Add. (TAG_MSGSEND_FAST): Add. (TAG_ASSIGNIVAR_FAST): Add. (TAG_CXX_CONSTRUCT): Add. (TAG_CXX_DESTRUCT): Add. (OBJC_LOOKUP_CLASS): Add. (OBJC_LOOKUP_NO_SUPER): Add. (objc_finish_file): Add pch support. (objc_finish_implementation): Add Objective-C++ support. (synth_module_prologue): Likewise. (synth_module_prologue): Add fast dispatching. (objc_get_class_reference): Add Objective-C++ support. (objc_generate_write_barrier): Likewise. (next_sjlj_build_enter_and_setjmp): Likewise. (objc_begin_try_stmt): Likewise. (build_next_objc_exception_stuff): Add fast ivar support. (build_private_template): Mark the record as used so debug information is generated. (build_protocol_template): Add Objective-C++ support. (objc_method_parm_type) Likewise. (objc_generate_cxx_ctor_or_dtor): Likewise. (objc_generate_cxx_cdtors): Likewise. (build_protocol_initializer): Likewise. (build_category_template): Likewise. (build_class_template): Likewise. (build_method_list_template): Likewise. (build_category_initializer): Likewise. (build_shared_structure_initializer): Likewise. (objc_finish_message_expr): Likewise. (build_objc_method_call): Add fast dispatch support. (lookup_method_static): Add support to end search at superclasses. (add_method_to_hash_list): Add strict parameter to comp_proto_with_proto. (objc_add_method): Likewise. (objc_add_method): Also set the interface_value. (add_instance_variable): Add Objective-C++ support. (objc_is_public): Likewise. (start_class): Likewise. (continue_class): Likewise. (encode_aggregate_within): Likewise. (start_method_def): Likewise. (objc_start_function): Clear current_function_returns_value and current_function_returns_null. (really_start_method): Add Objective-C++ support. (objc_finish_method_definition): Add warning for missing [super dealloc]. (finish_objc): Add Objective-C++ support. (generate_objc_image_info): Likewise. (objc_lookup_ivar): Likewise. * objc-act.h (TYPE_HAS_OBJC_INFO): Likewise. (INIT_TYPE_OBJC_INFO): Likewise. (DUP_TYPE_OBJC_INFO): Likewise. From-SVN: r99857
2005-05-17 22:07:08 +02:00
#ifdef OBJCPLUS
static void objc_generate_cxx_cdtors (void);
#endif
Yet more Objective-C++... * objc-act.c (objc_finish_try_stmt): Add return value. (objc_build_synchronized): Likewise. * objc-act.c (objc_is_gcable_type): Add. (objc_substitute_decl): Add. (objc_build_ivar_assignment): Add. (objc_build_global_assignment): Add. (objc_build_strong_cast_assignment): Add. (objc_is_ivar_reference_p): Add. (objc_is_global_reference_p): Add. (objc_generate_write_barrier): Add. (objc_rewrite_function_call): Add. (objc_gimplify_expr): Add Objective-C++ support. * objc-act.h (ALLOC_OBJC_TYPE_LANG_SPECIFIC): Likewise. (SIZEOF_OBJC_TYPE_LANG_SPECIFIC): Add. (INIT_TYPE_OBJC_INFO): Add Objective-C++ support. (DUP_TYPE_OBJC_INFO): Likewise. (struct imp_entry): Add field has_cxx_cdtors. (struct imp_entry *imp_list): Add OCTI_UMSG_FAST_DECL, OCTI_METH_LIST_TEMPL, OCTI_METH_PROTO_LIST_TEMPL, OCTI_IVAR_LIST_TEMPL, OCTI_ASSIGN_IVAR_DECL, OCTI_ASSIGN_IVAR_FAST_DECL, OCTI_ASSIGN_GLOBAL_DECL, OCTI_ASSIGN_STRONGCAST_DECL. (umsg_fast_decl): Add. (objc_assign_ivar_decl): Add. (objc_assign_ivar_fast_decl): Add. (objc_assign_global_decl): Add. (objc_assign_strong_cast_decl): Add. (objc_method_list_ptr): Add. (objc_method_proto_list_ptr): Add. (objc_ivar_list_ptr): Add. * objc-act.c (should_call_super_dealloc): Add. (OBJC_VERSION): Bump to 6. (objc_is_gcable_type): Add. (objc_substitute_decl): Add. (objc_build_ivar_assignment): Add. (objc_build_global_assignment): Add. (objc_build_strong_cast_assignment): Add. (objc_is_gcable_p): Add. (objc_is_ivar_reference_p): Add. (objc_is_global_reference_p): Add. (generate_shared_structures): Add flags parameter. (objc_generate_cxx_ctor_or_dtor): Add. (objc_generate_cxx_cdtors): Add. (add_class): Add name parameter. (objc_types_share_size_and_alignment): Add. (comp_proto_with_proto): Add strict parameter. (CLS_HAS_CXX_STRUCTORS): Add. (TAG_ASSIGNIVAR): Add. (TAG_ASSIGNGLOBAL): Add. (TAG_ASSIGNSTRONGCAST): Add. (TAG_MSGSEND_FAST): Add. (TAG_ASSIGNIVAR_FAST): Add. (TAG_CXX_CONSTRUCT): Add. (TAG_CXX_DESTRUCT): Add. (OBJC_LOOKUP_CLASS): Add. (OBJC_LOOKUP_NO_SUPER): Add. (objc_finish_file): Add pch support. (objc_finish_implementation): Add Objective-C++ support. (synth_module_prologue): Likewise. (synth_module_prologue): Add fast dispatching. (objc_get_class_reference): Add Objective-C++ support. (objc_generate_write_barrier): Likewise. (next_sjlj_build_enter_and_setjmp): Likewise. (objc_begin_try_stmt): Likewise. (build_next_objc_exception_stuff): Add fast ivar support. (build_private_template): Mark the record as used so debug information is generated. (build_protocol_template): Add Objective-C++ support. (objc_method_parm_type) Likewise. (objc_generate_cxx_ctor_or_dtor): Likewise. (objc_generate_cxx_cdtors): Likewise. (build_protocol_initializer): Likewise. (build_category_template): Likewise. (build_class_template): Likewise. (build_method_list_template): Likewise. (build_category_initializer): Likewise. (build_shared_structure_initializer): Likewise. (objc_finish_message_expr): Likewise. (build_objc_method_call): Add fast dispatch support. (lookup_method_static): Add support to end search at superclasses. (add_method_to_hash_list): Add strict parameter to comp_proto_with_proto. (objc_add_method): Likewise. (objc_add_method): Also set the interface_value. (add_instance_variable): Add Objective-C++ support. (objc_is_public): Likewise. (start_class): Likewise. (continue_class): Likewise. (encode_aggregate_within): Likewise. (start_method_def): Likewise. (objc_start_function): Clear current_function_returns_value and current_function_returns_null. (really_start_method): Add Objective-C++ support. (objc_finish_method_definition): Add warning for missing [super dealloc]. (finish_objc): Add Objective-C++ support. (generate_objc_image_info): Likewise. (objc_lookup_ivar): Likewise. * objc-act.h (TYPE_HAS_OBJC_INFO): Likewise. (INIT_TYPE_OBJC_INFO): Likewise. (DUP_TYPE_OBJC_INFO): Likewise. From-SVN: r99857
2005-05-17 22:07:08 +02:00
static const char *synth_id_with_class_suffix (const char *, tree);
c-parse.in (objc_inherit_code, [...]): Make static. 2001-10-03 Ziemowit Laski <zlaski@apple.com> * c-parse.in (objc_inherit_code, objc_pq_context, objc_public_flag): Make static. (objc_interface_context, objc_implementation_context, objc_method_context, objc_ivar_chain, objc_ivar_context): Move to global tree array in objc/objc-act.[ch]. (methoddef): Remove unnecessary code. * objc/objc-act.c: (hashed_attribute, hashed_entry, imp_entry): Hoist struct definitions to objc-act.h. (nst_method_hash_list, cls_method_hash_list, imp_list, imp_count, cat_count): Place declaration in objc-act.h. (objc_tree_index): Move enumeration to objc-act.h. (objc_global_trees): Place declaration and macro accessors in objc-act.h. (implementation_context): Remove duplicate; use objc_implementation_context instead: (method_context): Remove duplicate; use objc_method_context instead. (objc_ellipsis_node, objc_method_prototype_template, implemented_classes, function_type): Move global vars to objc_global_trees. (init_objc): Use LAST_BASE_TREE_CODE instead of LAST_CODE. (build_message_expr): Move actual construction of ObjC message send nodes to finish_message_expr. (finish_message_expr): New routine, contains code formerly in build_message_expr. * objc/objc-act.h (finish_message_expr): New prototype. (objc_ivar_chain, objc_method_context, objc_ellipsis_node): Remove declarations; these vars are now part of objc_global_trees. (objc_tree_index, objc_global_trees): Move definitions from objc-act.c. * objc/objc-tree.def: Update copyright info. From-SVN: r46000
2001-10-04 00:05:57 +02:00
/* Hash tables to manage the global pool of method prototypes. */
1992-01-18 00:15:38 +01:00
c-parse.in (objc_inherit_code, [...]): Make static. 2001-10-03 Ziemowit Laski <zlaski@apple.com> * c-parse.in (objc_inherit_code, objc_pq_context, objc_public_flag): Make static. (objc_interface_context, objc_implementation_context, objc_method_context, objc_ivar_chain, objc_ivar_context): Move to global tree array in objc/objc-act.[ch]. (methoddef): Remove unnecessary code. * objc/objc-act.c: (hashed_attribute, hashed_entry, imp_entry): Hoist struct definitions to objc-act.h. (nst_method_hash_list, cls_method_hash_list, imp_list, imp_count, cat_count): Place declaration in objc-act.h. (objc_tree_index): Move enumeration to objc-act.h. (objc_global_trees): Place declaration and macro accessors in objc-act.h. (implementation_context): Remove duplicate; use objc_implementation_context instead: (method_context): Remove duplicate; use objc_method_context instead. (objc_ellipsis_node, objc_method_prototype_template, implemented_classes, function_type): Move global vars to objc_global_trees. (init_objc): Use LAST_BASE_TREE_CODE instead of LAST_CODE. (build_message_expr): Move actual construction of ObjC message send nodes to finish_message_expr. (finish_message_expr): New routine, contains code formerly in build_message_expr. * objc/objc-act.h (finish_message_expr): New prototype. (objc_ivar_chain, objc_method_context, objc_ellipsis_node): Remove declarations; these vars are now part of objc_global_trees. (objc_tree_index, objc_global_trees): Move definitions from objc-act.c. * objc/objc-tree.def: Update copyright info. From-SVN: r46000
2001-10-04 00:05:57 +02:00
hash *nst_method_hash_list = 0;
hash *cls_method_hash_list = 0;
static hash hash_lookup (hash *, tree);
static tree lookup_method (tree, tree);
static tree lookup_method_static (tree, tree, int);
enum string_section
{
class_names, /* class, category, protocol, module names */
meth_var_names, /* method and variable names */
meth_var_types /* method and variable type descriptors */
1992-01-18 00:15:38 +01:00
};
static tree add_objc_string (tree, enum string_section);
static tree build_objc_string_decl (enum string_section);
Makefile.in (c-parse.o): Depend on $(C_COMMON_H). [gcc/ChangeLog] 2004-09-07 Ziemowit Laski <zlaski@apple.com> * Makefile.in (c-parse.o): Depend on $(C_COMMON_H). * c-parse.in: Include c-common.h instead of objc-act.h. (ivar_decl_list, ivar_decls, ivar_decl, ivars, ivar_declarator, myparms, myparm): Remove %type declarations. (methodtype, optparms, OBJC_TYPE_QUAL, objc_quals, objc_qual, objc_typename, objc_try_catch_stmt, optellipsis): Add %type declarations. (objc_inherit_code, objc_public_flag): Remove. (typespec_nonreserved_nonattr): Call objc_get_protocol_qualified_type() instead of get_static_reference() and get_protocol_reference(). (stmt_nocomp): Call grokparm() on @catch parameter. (objcdef): Move semantic action to objc_finish_implementation(). (classdef): Move semantic action to objc_start_class_interface(), objc_continue_interface(), objc_finish_interface(), objc_start_class_implementation(), objc_continue_implementation(), objc_start_category_interface() and objc_start_category_implementation(). (protocoldef): Move semantic actions to objc_start_protocol() and objc_finish_interface(). (ivar_decl_list): Remove nonterminal. (visibility_spec): Move semantic actions to objc_set_visibility(). (ivar_decls): Remove assignment to $$. (ivar_decl): Rephrase in terms of component_decl; call objc_add_instance_variable(). (ivars, ivar_declarator): Remove nonterminals. (opt_semi): New nonterminal. (methodtype): Remove semantic actions. (methoddef): Move semantic actions to objc_set_method_type(), objc_start_method_definition() and objc_finish_method_definition(). (methodproto): Move semantic actions to objc_set_method_type() and objc_add_method_declaration(). (methoddecl): Use objc_typename instead of typename; move semantic actions to objc_build_method_signature(). (optarglist, myxdecls, mydecl, myparms, myparm): Remove nonterminals. (optparmlist): Express in terms of optparms and optellipsis. (optparms, optellipsis, objc_qual, objc_quals, objc_typename): New nonterminals. (keyworddecl): Use objc_typename instead of typename. (rid_to_yy): Mark RID_IN, RID_OUT, RID_INOUT, RID_BYCOPY, RID_BYREF and RID_ONEWAY as returning OBJC_TYPE_QUAL to yyparse(). [gcc/objc/ChangeLog] 2004-09-07 Ziemowit Laski <zlaski@apple.com> * Make-lang.in (objc/objc-parse.o): Depend on $(C_COMMON_H) instead of objc/objc-act.h. (objc/objc-act.o): Depend on $(HASHTAB_H). * objc-act.c: Include hashtab.h; in ObjC++ mode, include cp-tree.h and objcp-decl.h instead of c-tree.h. (build_module_descriptor, get_class_ivars, synth_id_with_class_suffix, error_with_ivar, gen_method_decl, gen_declaration, setup_string_decl, build_protocol_template): Adjust prototypes. (build_module_initializer_routine, start_class, continue_class, finish_class, start_method_def, objc_start_function, start_protocol, build_method_decl, objc_add_method, add_instance_variable, build_ivar_reference, is_ivar, is_private, get_super_receiver, build_selector_table_decl, objc_push_parm, objc_get_parm_info, gen_type_name, gen_type_name_0, start_var_decl, finish_var_decl, create_field_decl): New prototypes. (objc_expand_function_end, comp_method_with_proto, objc_expr_last, gen_declaration_1, gen_declarator, is_complex_decl, adorn_decl, define_decl, create_builtin_decl, gen_declspecs): Remove prototypes. (TYPE_ID): Rename to OBJECT_TYPEDEF_NAME. (CLASS_TYPEDEF_NAME): New. (TAG_EXECCLASS): Change from a global variable to a #define. (TAG_RETURN_STRUCT): Delete. (TAG_GNUINIT): New, holds '__objc_gnu_init' name. (objc_inherit_code, objc_public_flag): New, moved from c-parse.in. (string_descriptor): New struct. (string_htab): New hash table. (string_hash, string_eq): New prototypes. (generate_struct_by_value_array): Call create_field_decl() instead of create_builtin_decl(). (objc_init): Do not initialize objc_ellipsis_node or TAG_EXECCLASS; In ObjC++ mode, call cxx_init() instead of c_objc_common_init(). (objc_finish_file): In ObjC++, call instantiate_pending_templates() and cp_finish_file(). (define_decl, get_static_reference, get_protocol_reference, create_builtin_decl): Remove functions. (objc_start_class_interface, objc_start_category_interface, objc_start_protocol, objc_continue_interface, objc_finish_interface, objc_start_class_implementation, objc_start_category_implementation, objc_continue_implementation, objc_finish_implementation, objc_set_visibility, objc_set_method_type, objc_build_method_signature, objc_add_method_declaration, objc_start_method_definition, objc_add_instance_variable, objc_get_protocol_qualified_type, create_field_decl, start_var_decl, finish_var_decl): New functions. (setup_string_decl): Simplify since it is only called once. (synth_module_prologue): Call build_class_template(); predefine 'id' and 'Class' as typedefs; rename 'temp_type' to 'type'; disable debug hooks for duration of function; fix GNU runtime messenger signatures to correspond to reality; forward-declare '__objc_exec_class' for the GNU runtime; call build_selector_table_decl(); in ObjC++ mode, generate 'extern "C" { ... }' wrappers around synthesized declarations; call build_protocol_template() and build_category_template(). (string_hash, string_eq): New functions. (objc_build_string_object): Check metaclass correctness only once; store string literals in hash table. (objc_build_constructor): Do not convert initializer elements; adjust for ObjC++ impedance mismatch. (build_objc_symtab_template): Call create_field_decl() instead of create_builtin_decl(). (init_objc_symtab): Add missing conversion to initializer element. (build_metadata_decl): Call start_var_decl() instead of define_decl(). (generate_objc_symtab_decl): Do not call build_category_template(); call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(). (build_module_descriptor): Call create_field_decl() instead of grokfield(); call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(); always mark module descriptor as used; move GNU runtime-specific functionality to build_module_initializer_routine(). (build_module_initializer_routine): New function, broken off of build_module_descriptor(). (objc_static_init_needed_p, objc_generate_static_init_call): New functions. (generate_static_references, generate_strings, build_selector_translation_table, generate_descriptor_table, generate_ivars_list, generate_dispatch_table, generate_category): Call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(); build a type directly instead of via groktypename(). (build_selector_reference_decl, build_selector_table_decl, build_class_reference_decl, build_protocol_reference, generate_objc_image_info): Call start_var_decl() instead of build_decl(). (build_selector_reference): For GNU runtime, do not call build_selector_reference_decl(). (build_selector, build_typed_selector_reference): Always convert result to the selector type. (add_objc_string): Cast return value to 'char *'. (build_method_prototype_template, build_selector_template, build_method_template): Use actual selector type for fields pointing to selectors. (finish_objc): For GNU runtime, call build_module_initializer_routine() after build_module_descriptor(). (generate_protocol_list, generate_shared_structures): Call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(); build a type directly instead of via groktypename(). (synth_id_with_class_suffix): Return a string. (get_arg_type_list): For instance methods, use the instance type for 'self'; do not call groktypename_in_parm_context(). (build_objc_string_decl): Squash redeclaration errors in ObjC++. (objc_is_class_name): Use OBJC_TYPE_NAME instead of TYPE_NAME; handle RECORD_TYPEs in ObjC as well as ObjC++. (objc_is_id): New function. (objc_is_object_ptr): Return the canonical type node. (objc_get_class_ivars): Simplify using get_class_ivars(). (get_class_ivars): Remove second parameter; create a fresh copy of the ivar list for each call; do not check for existence of super class. (objc_eh_runtime_type): Mark #ifndef OBJCPLUS. (objc_init_exceptions): When using SJLJ-style exceptions, require the use of '-fobjc-exceptions' flag; do not require it for DWARF-style exceptions. (objc_build_exc_ptr, next_sjlj_build_try_catch_finally): Use objc_object_type instead of objc_id_type. (objc_begin_catch_clause): Convert the incoming PARM_DECL into a VAR_DECL before placing it in the appropriate scope; do not call define_decl(); adjust call to c_begin_compound_stmt(); use objc_object_type instead of objc_id_type. (build_next_objc_exception_stuff): Call create_field_decl() instead of create_builtin_decl(); construct type directly instead of calling groktypename(); use OBJC_VOID_AT_END to mark end of function parameters. (build_private_template): Adjust call to get_class_ivars(); build a type directly instead of via groktypename(). (build_protocol_template, build_method_prototype_list_template, build_method_prototype_template, build_category_template, build_selector_template, build_class_template, build_super_template, build_ivar_template, build_ivar_list_template, build_method_list_template, build_method_template): Call create_field_decl() instead of grokfield(). (objc_method_parm_type): Do not call groktypename(). (generate_descriptor_table): Call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(). (generate_method_descriptors, build_protocol_initializer, generate_dispatch_tables, build_category_initializer, build_shared_structure_initializer): Do not call groktypename(). (generate_protocols): Call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(); do not call groktypename(). (error_with_ivar): Remove last parameter. (check_ivars): Do not iterate ovar CLASS_RAW_IVARS lists in addition to CLASS_IVARS lists; adjust calls to error_with_ivar(). (generate_ivar_lists): Convert one of the initializer elements; do not call groktypename(). (get_arg_type_list, start_method_def, gen_method_def): Account for new representation of variable arguments and '...' in Objective-C methods; add Objective-C++ impedance matching code. (is_objc_type_qualifier): Remove function. (adjust_type_for_id_default): Simplify; there is no longer a need to wade through declspecs. (lookup_interface, start_class, continue_class, finish_class, start_method_def, start_protocol, build_method_decl, objc_add_method, add_instance_variable, build_ivar_reference, is_ivar, is_private, get_super_receiver, objc_build_finally_epilogue): Make into static functions. (receiver_is_class_object): Use new IS_CLASS() macro. (objc_build_message_expr): Tweak ObjC++ message argument handling; call objc_finish_message_expr() instead of finish_message_expr(). (finish_message_expr): Rename to objc_finish_message_expr(); use OBJC_TYPE_NAME and OBJC_SET_TYPE_NAME macros instead of TYPE_NAME. call gen_type_name() instead of gen_declaration(); call objc_is_id() instead of using IS_ID and IS_CLASS; Use objc_class_name instead of calling get_identifier("Class"); handle CONVERT_EXPRs in receiver. (build_objc_method_call, warn_with_method): Do not call groktypename(). (build_ivar_reference): Call convert() instead of clobbering in a type. (hash_init): Initialize string_htab hash table. (add_instance_variable): Simplify parameter list; do not call grokfield(); do not populate CLASS_IVARS list. (start_class): Check for the existence of super class, if one was specified. (continue_class): Use CLASS_RAW_IVARS rather than CLASS_IVARS; do not call build_class_template(); adjust call to get_class_ivars(); call build_decl(), pushdecl() and finish_decl() instead of define_decl(). (finish_class): Call build_decl(), pushdecl() and finish_decl() instead of define_decl(). (add_protocols): Use PROTOCOL_BINFO_ELTS for the tree vector size. (start_protocol): Do not call build_protocol_template(); use PROTOCOL_BINFO_ELTS for the tree vector size. (encode_type_qualifiers): Do not handle the 'const' qualifier here. (encode_pointer): Encode 'const char *' as 'r*', for backwards compatibility. (encode_array): Use HOST_WIDE_INT_PRINT_DEC instead of "%ld". (encode_type): Handle the 'const' qualifier here. (objc_parmlist): New global variable, sued by objc_push_parm and objc_get_parm_info(). (objc_push_parm, objc_get_parm_info): New functions. (objc_expr_last): Remove function. (synth_self_and_ucmd_args): For instance methods, use the instance type for 'self'; call objc_push_parm() instead of push_parm_decl(). (start_method_def): Do not call push_scope(), declare_parm_level(), pop_scope(), push_parm_decl(), store_parm_decls() or objc_expr_last(); just use objc_push_parm() and objc_get_parm_info(). (comp_method_with_proto): Remove function. (objc_types_are_equivalent): Strip away indirections before comparing underlying types. (comp_proto_with_proto): Do not call groktypename(); types are no longer in raw declspec format. (objc_start_function): New function. (really_start_method): Call comp_proto_with_proto() instead of comp_method_with_proto(); call objc_start_function() instead of hand-crafting a function declarator. (continue_method_def, objc_expand_function_end): Remove functions. (get_super_receiver): Call objc_get_current_scope() instead of get_current_scope(); reference 'super_class' field (instead of 'class'). (finish_method_def): Rename to objc_finish_method_definition() and add a function decl parameter; move method encoding call from objc_expand_function_end(). (is_complex_decl, adorn_decl, gen_declarator, gen_declspecs, gen_declaration_1): Remove functions. (tmpbuf, RAW_DECLSPEC): Remove. (gen_declaration): Remove second parameter; simplify to deal with TYPE_P nodes instead of raw declspecs. (gen_type_name, gen_type_name_0): New functions. (gen_method_decl): Remove second parameter; call gen_type_name() instead of gen_declaration_1(). (dump_interface): Adjust calls to gen_declaration() and gen_method_decl(); do not allocate a separate string buffer. (init_objc): Allocate a larger string buffer to accommodate dump_interface(); adjust call to build_module_descriptor(); add call to build_module_initializer_routine() for the GNU runtime. (generate_classref_translation_entry): Do not call start_decl(); call finish_var_decl() instead of finish_decl(); call convert() instead of build_c_cast(). * objc-act.h (CLASS_OWN_IVARS): Remove accessor. (CLASS_BINFO_ELTS): Reduce from 6 to 5, now that CLASS_OWN_IVARS is gone. (OCTI_GNU_INIT_DECL, GNU_INIT_decl): New. (OCTI_ELLIPSIS_NODE, objc_ellipsis_node): Remove. (OCTI_ID_ID, id_type, objc_id_id): Rename to OCTI_ID_NAME, objc_object_type and objc_object_name, respectively. (OCTI_CLS_REF, OCTI_CLASS_NAME, objc_class_reference, objc_class_name): New. (IS_CLASS): New macro. (IS_ID, IS_SUPER): Robustify. (OCTI_EXECCLASS_DECL, execclass_decl): New. (finish_file, start_class, continue_class, finish_class, start_method_def, continue_method_def, finish_method_def, start_protocol, finish_protocol, objc_build_throw_stmt, objc_build_try_catch_finally_stmt, objc_build_synchronized_prologue, objc_build_synchronized_epilogue, objc_build_try_prologue, objc_build_try_epilogue, objc_build_catch_stmt, objc_build_catch_epilogue, objc_build_finally_prologue, objc_build_finally_epilogue, is_ivar, is_private, is_public, add_instance_variable, objc_add_method, get_super_receiver, objc_clear_super_receiver, get_class_ivars_from_name, get_class_reference, get_static_reference, get_object_reference, build_message_expr, finish_message_expr, build_selector_expr, build_ivar_reference, build_keyword_decl, build_method_decl, build_protocol_expr, build_objc_string_object, objc_declare_alias, objc_declare_class, objc_declare_protocols, objc_comptypes, objc_check_decl, build_encode_expr): Remove prototypes. (imp_count, cat_count): Make GGC-aware. (OBJC_SET_TYPE_NAME): New macro. From-SVN: r87168
2004-09-08 02:49:44 +02:00
static void build_selector_table_decl (void);
1996-07-04 00:07:53 +02:00
/* Protocol additions. */
static tree lookup_protocol (tree);
static tree lookup_and_install_protocols (tree);
1992-01-18 00:15:38 +01:00
1996-07-04 00:07:53 +02:00
/* Type encoding. */
1992-01-18 00:15:38 +01:00
static void encode_type_qualifiers (tree);
static void encode_type (tree, int, int);
static void encode_field_decl (tree, int, int);
1992-01-18 00:15:38 +01:00
c-tree.h (enum c_declarator_kind, [...]): New. * c-tree.h (enum c_declarator_kind, struct c_arg_info, struct c_declarator, struct c_type_name, struct c_parm): New. (build_array_declarator, set_array_declarator_inner, get_parm_info, grokfield, groktypename, grokparm, push_parm_decl, start_function, start_decl, build_c_parm, build_attrs_declarator, build_function_declarator, make_pointer_declarator, c_cast_expr, store_parm_decls_newstyle, c_expr_sizeof_type): Update prototypes. (build_id_declarator): New. * c-typeck.c (c_cast_expr, c_expr_sizeof_type): Update to new structures. * c-decl.c (ARG_INFO_PARMS, ARG_INFO_TAGS, ARG_INFO_TYPES, ARG_INFO_OTHERS): Remove. (build_id_declarator): New. (build_array_declarator, set_array_declarator_inner, groktypename, start_decl, grokparm, push_parm_decl, grokparms, get_parm_info, grokfield, start_function, store_parm_decls_newstyle, store_parm_decls_oldstyle, store_parm_decls, build_c_parm, build_attrs_declarator, build_function_declarator, make_pointer_declarator, grokdeclarator): Update to new structures. * c-parse.in (%union): Add arginfotype, dtrtype, typenametype and parmtype. (declarator, notype_declarator, after_type_declarator, parm_declarator, parm_declarator_starttypename, parm_declarator_nostarttypename, array_declarator, typename, absdcl, absdcl1, absdcl1_ea, absdcl1_noea, direct_absdcl1, absdcl_maybe_attribute, parm, firstparm, parms, parmlist, parmlist_1, parmlist_2, parmlist_or_identifiers, parmlist_or_identifiers_1): Use these types. (primary, after_type_declarator, parm_declarator_starttypename, notype_declarator, component_decl, component_declarator, component_notype_declarator, typename, absdcl, absdcl_maybe_attribute, absdcl1_ea, direct_absdcl1, parmlist_1, parmlist_2, parmlist_or_identifiers_1): Update to new structures. objc: * objc-act.c (objc_start_function, really_start_method, objc_get_parm_info, start_method_def): Update to new arg_info structures. From-SVN: r87217
2004-09-09 03:19:15 +02:00
#ifdef OBJCPLUS
static void really_start_method (tree, tree);
c-tree.h (enum c_declarator_kind, [...]): New. * c-tree.h (enum c_declarator_kind, struct c_arg_info, struct c_declarator, struct c_type_name, struct c_parm): New. (build_array_declarator, set_array_declarator_inner, get_parm_info, grokfield, groktypename, grokparm, push_parm_decl, start_function, start_decl, build_c_parm, build_attrs_declarator, build_function_declarator, make_pointer_declarator, c_cast_expr, store_parm_decls_newstyle, c_expr_sizeof_type): Update prototypes. (build_id_declarator): New. * c-typeck.c (c_cast_expr, c_expr_sizeof_type): Update to new structures. * c-decl.c (ARG_INFO_PARMS, ARG_INFO_TAGS, ARG_INFO_TYPES, ARG_INFO_OTHERS): Remove. (build_id_declarator): New. (build_array_declarator, set_array_declarator_inner, groktypename, start_decl, grokparm, push_parm_decl, grokparms, get_parm_info, grokfield, start_function, store_parm_decls_newstyle, store_parm_decls_oldstyle, store_parm_decls, build_c_parm, build_attrs_declarator, build_function_declarator, make_pointer_declarator, grokdeclarator): Update to new structures. * c-parse.in (%union): Add arginfotype, dtrtype, typenametype and parmtype. (declarator, notype_declarator, after_type_declarator, parm_declarator, parm_declarator_starttypename, parm_declarator_nostarttypename, array_declarator, typename, absdcl, absdcl1, absdcl1_ea, absdcl1_noea, direct_absdcl1, absdcl_maybe_attribute, parm, firstparm, parms, parmlist, parmlist_1, parmlist_2, parmlist_or_identifiers, parmlist_or_identifiers_1): Use these types. (primary, after_type_declarator, parm_declarator_starttypename, notype_declarator, component_decl, component_declarator, component_notype_declarator, typename, absdcl, absdcl_maybe_attribute, absdcl1_ea, direct_absdcl1, parmlist_1, parmlist_2, parmlist_or_identifiers_1): Update to new structures. objc: * objc-act.c (objc_start_function, really_start_method, objc_get_parm_info, start_method_def): Update to new arg_info structures. From-SVN: r87217
2004-09-09 03:19:15 +02:00
#else
static void really_start_method (tree, struct c_arg_info *);
#endif
Yet more Objective-C++... * objc-act.c (objc_finish_try_stmt): Add return value. (objc_build_synchronized): Likewise. * objc-act.c (objc_is_gcable_type): Add. (objc_substitute_decl): Add. (objc_build_ivar_assignment): Add. (objc_build_global_assignment): Add. (objc_build_strong_cast_assignment): Add. (objc_is_ivar_reference_p): Add. (objc_is_global_reference_p): Add. (objc_generate_write_barrier): Add. (objc_rewrite_function_call): Add. (objc_gimplify_expr): Add Objective-C++ support. * objc-act.h (ALLOC_OBJC_TYPE_LANG_SPECIFIC): Likewise. (SIZEOF_OBJC_TYPE_LANG_SPECIFIC): Add. (INIT_TYPE_OBJC_INFO): Add Objective-C++ support. (DUP_TYPE_OBJC_INFO): Likewise. (struct imp_entry): Add field has_cxx_cdtors. (struct imp_entry *imp_list): Add OCTI_UMSG_FAST_DECL, OCTI_METH_LIST_TEMPL, OCTI_METH_PROTO_LIST_TEMPL, OCTI_IVAR_LIST_TEMPL, OCTI_ASSIGN_IVAR_DECL, OCTI_ASSIGN_IVAR_FAST_DECL, OCTI_ASSIGN_GLOBAL_DECL, OCTI_ASSIGN_STRONGCAST_DECL. (umsg_fast_decl): Add. (objc_assign_ivar_decl): Add. (objc_assign_ivar_fast_decl): Add. (objc_assign_global_decl): Add. (objc_assign_strong_cast_decl): Add. (objc_method_list_ptr): Add. (objc_method_proto_list_ptr): Add. (objc_ivar_list_ptr): Add. * objc-act.c (should_call_super_dealloc): Add. (OBJC_VERSION): Bump to 6. (objc_is_gcable_type): Add. (objc_substitute_decl): Add. (objc_build_ivar_assignment): Add. (objc_build_global_assignment): Add. (objc_build_strong_cast_assignment): Add. (objc_is_gcable_p): Add. (objc_is_ivar_reference_p): Add. (objc_is_global_reference_p): Add. (generate_shared_structures): Add flags parameter. (objc_generate_cxx_ctor_or_dtor): Add. (objc_generate_cxx_cdtors): Add. (add_class): Add name parameter. (objc_types_share_size_and_alignment): Add. (comp_proto_with_proto): Add strict parameter. (CLS_HAS_CXX_STRUCTORS): Add. (TAG_ASSIGNIVAR): Add. (TAG_ASSIGNGLOBAL): Add. (TAG_ASSIGNSTRONGCAST): Add. (TAG_MSGSEND_FAST): Add. (TAG_ASSIGNIVAR_FAST): Add. (TAG_CXX_CONSTRUCT): Add. (TAG_CXX_DESTRUCT): Add. (OBJC_LOOKUP_CLASS): Add. (OBJC_LOOKUP_NO_SUPER): Add. (objc_finish_file): Add pch support. (objc_finish_implementation): Add Objective-C++ support. (synth_module_prologue): Likewise. (synth_module_prologue): Add fast dispatching. (objc_get_class_reference): Add Objective-C++ support. (objc_generate_write_barrier): Likewise. (next_sjlj_build_enter_and_setjmp): Likewise. (objc_begin_try_stmt): Likewise. (build_next_objc_exception_stuff): Add fast ivar support. (build_private_template): Mark the record as used so debug information is generated. (build_protocol_template): Add Objective-C++ support. (objc_method_parm_type) Likewise. (objc_generate_cxx_ctor_or_dtor): Likewise. (objc_generate_cxx_cdtors): Likewise. (build_protocol_initializer): Likewise. (build_category_template): Likewise. (build_class_template): Likewise. (build_method_list_template): Likewise. (build_category_initializer): Likewise. (build_shared_structure_initializer): Likewise. (objc_finish_message_expr): Likewise. (build_objc_method_call): Add fast dispatch support. (lookup_method_static): Add support to end search at superclasses. (add_method_to_hash_list): Add strict parameter to comp_proto_with_proto. (objc_add_method): Likewise. (objc_add_method): Also set the interface_value. (add_instance_variable): Add Objective-C++ support. (objc_is_public): Likewise. (start_class): Likewise. (continue_class): Likewise. (encode_aggregate_within): Likewise. (start_method_def): Likewise. (objc_start_function): Clear current_function_returns_value and current_function_returns_null. (really_start_method): Add Objective-C++ support. (objc_finish_method_definition): Add warning for missing [super dealloc]. (finish_objc): Add Objective-C++ support. (generate_objc_image_info): Likewise. (objc_lookup_ivar): Likewise. * objc-act.h (TYPE_HAS_OBJC_INFO): Likewise. (INIT_TYPE_OBJC_INFO): Likewise. (DUP_TYPE_OBJC_INFO): Likewise. From-SVN: r99857
2005-05-17 22:07:08 +02:00
static int comp_proto_with_proto (tree, tree, int);
Makefile.in (c-parse.o): Depend on $(C_COMMON_H). [gcc/ChangeLog] 2004-09-07 Ziemowit Laski <zlaski@apple.com> * Makefile.in (c-parse.o): Depend on $(C_COMMON_H). * c-parse.in: Include c-common.h instead of objc-act.h. (ivar_decl_list, ivar_decls, ivar_decl, ivars, ivar_declarator, myparms, myparm): Remove %type declarations. (methodtype, optparms, OBJC_TYPE_QUAL, objc_quals, objc_qual, objc_typename, objc_try_catch_stmt, optellipsis): Add %type declarations. (objc_inherit_code, objc_public_flag): Remove. (typespec_nonreserved_nonattr): Call objc_get_protocol_qualified_type() instead of get_static_reference() and get_protocol_reference(). (stmt_nocomp): Call grokparm() on @catch parameter. (objcdef): Move semantic action to objc_finish_implementation(). (classdef): Move semantic action to objc_start_class_interface(), objc_continue_interface(), objc_finish_interface(), objc_start_class_implementation(), objc_continue_implementation(), objc_start_category_interface() and objc_start_category_implementation(). (protocoldef): Move semantic actions to objc_start_protocol() and objc_finish_interface(). (ivar_decl_list): Remove nonterminal. (visibility_spec): Move semantic actions to objc_set_visibility(). (ivar_decls): Remove assignment to $$. (ivar_decl): Rephrase in terms of component_decl; call objc_add_instance_variable(). (ivars, ivar_declarator): Remove nonterminals. (opt_semi): New nonterminal. (methodtype): Remove semantic actions. (methoddef): Move semantic actions to objc_set_method_type(), objc_start_method_definition() and objc_finish_method_definition(). (methodproto): Move semantic actions to objc_set_method_type() and objc_add_method_declaration(). (methoddecl): Use objc_typename instead of typename; move semantic actions to objc_build_method_signature(). (optarglist, myxdecls, mydecl, myparms, myparm): Remove nonterminals. (optparmlist): Express in terms of optparms and optellipsis. (optparms, optellipsis, objc_qual, objc_quals, objc_typename): New nonterminals. (keyworddecl): Use objc_typename instead of typename. (rid_to_yy): Mark RID_IN, RID_OUT, RID_INOUT, RID_BYCOPY, RID_BYREF and RID_ONEWAY as returning OBJC_TYPE_QUAL to yyparse(). [gcc/objc/ChangeLog] 2004-09-07 Ziemowit Laski <zlaski@apple.com> * Make-lang.in (objc/objc-parse.o): Depend on $(C_COMMON_H) instead of objc/objc-act.h. (objc/objc-act.o): Depend on $(HASHTAB_H). * objc-act.c: Include hashtab.h; in ObjC++ mode, include cp-tree.h and objcp-decl.h instead of c-tree.h. (build_module_descriptor, get_class_ivars, synth_id_with_class_suffix, error_with_ivar, gen_method_decl, gen_declaration, setup_string_decl, build_protocol_template): Adjust prototypes. (build_module_initializer_routine, start_class, continue_class, finish_class, start_method_def, objc_start_function, start_protocol, build_method_decl, objc_add_method, add_instance_variable, build_ivar_reference, is_ivar, is_private, get_super_receiver, build_selector_table_decl, objc_push_parm, objc_get_parm_info, gen_type_name, gen_type_name_0, start_var_decl, finish_var_decl, create_field_decl): New prototypes. (objc_expand_function_end, comp_method_with_proto, objc_expr_last, gen_declaration_1, gen_declarator, is_complex_decl, adorn_decl, define_decl, create_builtin_decl, gen_declspecs): Remove prototypes. (TYPE_ID): Rename to OBJECT_TYPEDEF_NAME. (CLASS_TYPEDEF_NAME): New. (TAG_EXECCLASS): Change from a global variable to a #define. (TAG_RETURN_STRUCT): Delete. (TAG_GNUINIT): New, holds '__objc_gnu_init' name. (objc_inherit_code, objc_public_flag): New, moved from c-parse.in. (string_descriptor): New struct. (string_htab): New hash table. (string_hash, string_eq): New prototypes. (generate_struct_by_value_array): Call create_field_decl() instead of create_builtin_decl(). (objc_init): Do not initialize objc_ellipsis_node or TAG_EXECCLASS; In ObjC++ mode, call cxx_init() instead of c_objc_common_init(). (objc_finish_file): In ObjC++, call instantiate_pending_templates() and cp_finish_file(). (define_decl, get_static_reference, get_protocol_reference, create_builtin_decl): Remove functions. (objc_start_class_interface, objc_start_category_interface, objc_start_protocol, objc_continue_interface, objc_finish_interface, objc_start_class_implementation, objc_start_category_implementation, objc_continue_implementation, objc_finish_implementation, objc_set_visibility, objc_set_method_type, objc_build_method_signature, objc_add_method_declaration, objc_start_method_definition, objc_add_instance_variable, objc_get_protocol_qualified_type, create_field_decl, start_var_decl, finish_var_decl): New functions. (setup_string_decl): Simplify since it is only called once. (synth_module_prologue): Call build_class_template(); predefine 'id' and 'Class' as typedefs; rename 'temp_type' to 'type'; disable debug hooks for duration of function; fix GNU runtime messenger signatures to correspond to reality; forward-declare '__objc_exec_class' for the GNU runtime; call build_selector_table_decl(); in ObjC++ mode, generate 'extern "C" { ... }' wrappers around synthesized declarations; call build_protocol_template() and build_category_template(). (string_hash, string_eq): New functions. (objc_build_string_object): Check metaclass correctness only once; store string literals in hash table. (objc_build_constructor): Do not convert initializer elements; adjust for ObjC++ impedance mismatch. (build_objc_symtab_template): Call create_field_decl() instead of create_builtin_decl(). (init_objc_symtab): Add missing conversion to initializer element. (build_metadata_decl): Call start_var_decl() instead of define_decl(). (generate_objc_symtab_decl): Do not call build_category_template(); call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(). (build_module_descriptor): Call create_field_decl() instead of grokfield(); call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(); always mark module descriptor as used; move GNU runtime-specific functionality to build_module_initializer_routine(). (build_module_initializer_routine): New function, broken off of build_module_descriptor(). (objc_static_init_needed_p, objc_generate_static_init_call): New functions. (generate_static_references, generate_strings, build_selector_translation_table, generate_descriptor_table, generate_ivars_list, generate_dispatch_table, generate_category): Call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(); build a type directly instead of via groktypename(). (build_selector_reference_decl, build_selector_table_decl, build_class_reference_decl, build_protocol_reference, generate_objc_image_info): Call start_var_decl() instead of build_decl(). (build_selector_reference): For GNU runtime, do not call build_selector_reference_decl(). (build_selector, build_typed_selector_reference): Always convert result to the selector type. (add_objc_string): Cast return value to 'char *'. (build_method_prototype_template, build_selector_template, build_method_template): Use actual selector type for fields pointing to selectors. (finish_objc): For GNU runtime, call build_module_initializer_routine() after build_module_descriptor(). (generate_protocol_list, generate_shared_structures): Call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(); build a type directly instead of via groktypename(). (synth_id_with_class_suffix): Return a string. (get_arg_type_list): For instance methods, use the instance type for 'self'; do not call groktypename_in_parm_context(). (build_objc_string_decl): Squash redeclaration errors in ObjC++. (objc_is_class_name): Use OBJC_TYPE_NAME instead of TYPE_NAME; handle RECORD_TYPEs in ObjC as well as ObjC++. (objc_is_id): New function. (objc_is_object_ptr): Return the canonical type node. (objc_get_class_ivars): Simplify using get_class_ivars(). (get_class_ivars): Remove second parameter; create a fresh copy of the ivar list for each call; do not check for existence of super class. (objc_eh_runtime_type): Mark #ifndef OBJCPLUS. (objc_init_exceptions): When using SJLJ-style exceptions, require the use of '-fobjc-exceptions' flag; do not require it for DWARF-style exceptions. (objc_build_exc_ptr, next_sjlj_build_try_catch_finally): Use objc_object_type instead of objc_id_type. (objc_begin_catch_clause): Convert the incoming PARM_DECL into a VAR_DECL before placing it in the appropriate scope; do not call define_decl(); adjust call to c_begin_compound_stmt(); use objc_object_type instead of objc_id_type. (build_next_objc_exception_stuff): Call create_field_decl() instead of create_builtin_decl(); construct type directly instead of calling groktypename(); use OBJC_VOID_AT_END to mark end of function parameters. (build_private_template): Adjust call to get_class_ivars(); build a type directly instead of via groktypename(). (build_protocol_template, build_method_prototype_list_template, build_method_prototype_template, build_category_template, build_selector_template, build_class_template, build_super_template, build_ivar_template, build_ivar_list_template, build_method_list_template, build_method_template): Call create_field_decl() instead of grokfield(). (objc_method_parm_type): Do not call groktypename(). (generate_descriptor_table): Call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(). (generate_method_descriptors, build_protocol_initializer, generate_dispatch_tables, build_category_initializer, build_shared_structure_initializer): Do not call groktypename(). (generate_protocols): Call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(); do not call groktypename(). (error_with_ivar): Remove last parameter. (check_ivars): Do not iterate ovar CLASS_RAW_IVARS lists in addition to CLASS_IVARS lists; adjust calls to error_with_ivar(). (generate_ivar_lists): Convert one of the initializer elements; do not call groktypename(). (get_arg_type_list, start_method_def, gen_method_def): Account for new representation of variable arguments and '...' in Objective-C methods; add Objective-C++ impedance matching code. (is_objc_type_qualifier): Remove function. (adjust_type_for_id_default): Simplify; there is no longer a need to wade through declspecs. (lookup_interface, start_class, continue_class, finish_class, start_method_def, start_protocol, build_method_decl, objc_add_method, add_instance_variable, build_ivar_reference, is_ivar, is_private, get_super_receiver, objc_build_finally_epilogue): Make into static functions. (receiver_is_class_object): Use new IS_CLASS() macro. (objc_build_message_expr): Tweak ObjC++ message argument handling; call objc_finish_message_expr() instead of finish_message_expr(). (finish_message_expr): Rename to objc_finish_message_expr(); use OBJC_TYPE_NAME and OBJC_SET_TYPE_NAME macros instead of TYPE_NAME. call gen_type_name() instead of gen_declaration(); call objc_is_id() instead of using IS_ID and IS_CLASS; Use objc_class_name instead of calling get_identifier("Class"); handle CONVERT_EXPRs in receiver. (build_objc_method_call, warn_with_method): Do not call groktypename(). (build_ivar_reference): Call convert() instead of clobbering in a type. (hash_init): Initialize string_htab hash table. (add_instance_variable): Simplify parameter list; do not call grokfield(); do not populate CLASS_IVARS list. (start_class): Check for the existence of super class, if one was specified. (continue_class): Use CLASS_RAW_IVARS rather than CLASS_IVARS; do not call build_class_template(); adjust call to get_class_ivars(); call build_decl(), pushdecl() and finish_decl() instead of define_decl(). (finish_class): Call build_decl(), pushdecl() and finish_decl() instead of define_decl(). (add_protocols): Use PROTOCOL_BINFO_ELTS for the tree vector size. (start_protocol): Do not call build_protocol_template(); use PROTOCOL_BINFO_ELTS for the tree vector size. (encode_type_qualifiers): Do not handle the 'const' qualifier here. (encode_pointer): Encode 'const char *' as 'r*', for backwards compatibility. (encode_array): Use HOST_WIDE_INT_PRINT_DEC instead of "%ld". (encode_type): Handle the 'const' qualifier here. (objc_parmlist): New global variable, sued by objc_push_parm and objc_get_parm_info(). (objc_push_parm, objc_get_parm_info): New functions. (objc_expr_last): Remove function. (synth_self_and_ucmd_args): For instance methods, use the instance type for 'self'; call objc_push_parm() instead of push_parm_decl(). (start_method_def): Do not call push_scope(), declare_parm_level(), pop_scope(), push_parm_decl(), store_parm_decls() or objc_expr_last(); just use objc_push_parm() and objc_get_parm_info(). (comp_method_with_proto): Remove function. (objc_types_are_equivalent): Strip away indirections before comparing underlying types. (comp_proto_with_proto): Do not call groktypename(); types are no longer in raw declspec format. (objc_start_function): New function. (really_start_method): Call comp_proto_with_proto() instead of comp_method_with_proto(); call objc_start_function() instead of hand-crafting a function declarator. (continue_method_def, objc_expand_function_end): Remove functions. (get_super_receiver): Call objc_get_current_scope() instead of get_current_scope(); reference 'super_class' field (instead of 'class'). (finish_method_def): Rename to objc_finish_method_definition() and add a function decl parameter; move method encoding call from objc_expand_function_end(). (is_complex_decl, adorn_decl, gen_declarator, gen_declspecs, gen_declaration_1): Remove functions. (tmpbuf, RAW_DECLSPEC): Remove. (gen_declaration): Remove second parameter; simplify to deal with TYPE_P nodes instead of raw declspecs. (gen_type_name, gen_type_name_0): New functions. (gen_method_decl): Remove second parameter; call gen_type_name() instead of gen_declaration_1(). (dump_interface): Adjust calls to gen_declaration() and gen_method_decl(); do not allocate a separate string buffer. (init_objc): Allocate a larger string buffer to accommodate dump_interface(); adjust call to build_module_descriptor(); add call to build_module_initializer_routine() for the GNU runtime. (generate_classref_translation_entry): Do not call start_decl(); call finish_var_decl() instead of finish_decl(); call convert() instead of build_c_cast(). * objc-act.h (CLASS_OWN_IVARS): Remove accessor. (CLASS_BINFO_ELTS): Reduce from 6 to 5, now that CLASS_OWN_IVARS is gone. (OCTI_GNU_INIT_DECL, GNU_INIT_decl): New. (OCTI_ELLIPSIS_NODE, objc_ellipsis_node): Remove. (OCTI_ID_ID, id_type, objc_id_id): Rename to OCTI_ID_NAME, objc_object_type and objc_object_name, respectively. (OCTI_CLS_REF, OCTI_CLASS_NAME, objc_class_reference, objc_class_name): New. (IS_CLASS): New macro. (IS_ID, IS_SUPER): Robustify. (OCTI_EXECCLASS_DECL, execclass_decl): New. (finish_file, start_class, continue_class, finish_class, start_method_def, continue_method_def, finish_method_def, start_protocol, finish_protocol, objc_build_throw_stmt, objc_build_try_catch_finally_stmt, objc_build_synchronized_prologue, objc_build_synchronized_epilogue, objc_build_try_prologue, objc_build_try_epilogue, objc_build_catch_stmt, objc_build_catch_epilogue, objc_build_finally_prologue, objc_build_finally_epilogue, is_ivar, is_private, is_public, add_instance_variable, objc_add_method, get_super_receiver, objc_clear_super_receiver, get_class_ivars_from_name, get_class_reference, get_static_reference, get_object_reference, build_message_expr, finish_message_expr, build_selector_expr, build_ivar_reference, build_keyword_decl, build_method_decl, build_protocol_expr, build_objc_string_object, objc_declare_alias, objc_declare_class, objc_declare_protocols, objc_comptypes, objc_check_decl, build_encode_expr): Remove prototypes. (imp_count, cat_count): Make GGC-aware. (OBJC_SET_TYPE_NAME): New macro. From-SVN: r87168
2004-09-08 02:49:44 +02:00
static void objc_push_parm (tree);
c-tree.h (enum c_declarator_kind, [...]): New. * c-tree.h (enum c_declarator_kind, struct c_arg_info, struct c_declarator, struct c_type_name, struct c_parm): New. (build_array_declarator, set_array_declarator_inner, get_parm_info, grokfield, groktypename, grokparm, push_parm_decl, start_function, start_decl, build_c_parm, build_attrs_declarator, build_function_declarator, make_pointer_declarator, c_cast_expr, store_parm_decls_newstyle, c_expr_sizeof_type): Update prototypes. (build_id_declarator): New. * c-typeck.c (c_cast_expr, c_expr_sizeof_type): Update to new structures. * c-decl.c (ARG_INFO_PARMS, ARG_INFO_TAGS, ARG_INFO_TYPES, ARG_INFO_OTHERS): Remove. (build_id_declarator): New. (build_array_declarator, set_array_declarator_inner, groktypename, start_decl, grokparm, push_parm_decl, grokparms, get_parm_info, grokfield, start_function, store_parm_decls_newstyle, store_parm_decls_oldstyle, store_parm_decls, build_c_parm, build_attrs_declarator, build_function_declarator, make_pointer_declarator, grokdeclarator): Update to new structures. * c-parse.in (%union): Add arginfotype, dtrtype, typenametype and parmtype. (declarator, notype_declarator, after_type_declarator, parm_declarator, parm_declarator_starttypename, parm_declarator_nostarttypename, array_declarator, typename, absdcl, absdcl1, absdcl1_ea, absdcl1_noea, direct_absdcl1, absdcl_maybe_attribute, parm, firstparm, parms, parmlist, parmlist_1, parmlist_2, parmlist_or_identifiers, parmlist_or_identifiers_1): Use these types. (primary, after_type_declarator, parm_declarator_starttypename, notype_declarator, component_decl, component_declarator, component_notype_declarator, typename, absdcl, absdcl_maybe_attribute, absdcl1_ea, direct_absdcl1, parmlist_1, parmlist_2, parmlist_or_identifiers_1): Update to new structures. objc: * objc-act.c (objc_start_function, really_start_method, objc_get_parm_info, start_method_def): Update to new arg_info structures. From-SVN: r87217
2004-09-09 03:19:15 +02:00
#ifdef OBJCPLUS
Makefile.in (c-parse.o): Depend on $(C_COMMON_H). [gcc/ChangeLog] 2004-09-07 Ziemowit Laski <zlaski@apple.com> * Makefile.in (c-parse.o): Depend on $(C_COMMON_H). * c-parse.in: Include c-common.h instead of objc-act.h. (ivar_decl_list, ivar_decls, ivar_decl, ivars, ivar_declarator, myparms, myparm): Remove %type declarations. (methodtype, optparms, OBJC_TYPE_QUAL, objc_quals, objc_qual, objc_typename, objc_try_catch_stmt, optellipsis): Add %type declarations. (objc_inherit_code, objc_public_flag): Remove. (typespec_nonreserved_nonattr): Call objc_get_protocol_qualified_type() instead of get_static_reference() and get_protocol_reference(). (stmt_nocomp): Call grokparm() on @catch parameter. (objcdef): Move semantic action to objc_finish_implementation(). (classdef): Move semantic action to objc_start_class_interface(), objc_continue_interface(), objc_finish_interface(), objc_start_class_implementation(), objc_continue_implementation(), objc_start_category_interface() and objc_start_category_implementation(). (protocoldef): Move semantic actions to objc_start_protocol() and objc_finish_interface(). (ivar_decl_list): Remove nonterminal. (visibility_spec): Move semantic actions to objc_set_visibility(). (ivar_decls): Remove assignment to $$. (ivar_decl): Rephrase in terms of component_decl; call objc_add_instance_variable(). (ivars, ivar_declarator): Remove nonterminals. (opt_semi): New nonterminal. (methodtype): Remove semantic actions. (methoddef): Move semantic actions to objc_set_method_type(), objc_start_method_definition() and objc_finish_method_definition(). (methodproto): Move semantic actions to objc_set_method_type() and objc_add_method_declaration(). (methoddecl): Use objc_typename instead of typename; move semantic actions to objc_build_method_signature(). (optarglist, myxdecls, mydecl, myparms, myparm): Remove nonterminals. (optparmlist): Express in terms of optparms and optellipsis. (optparms, optellipsis, objc_qual, objc_quals, objc_typename): New nonterminals. (keyworddecl): Use objc_typename instead of typename. (rid_to_yy): Mark RID_IN, RID_OUT, RID_INOUT, RID_BYCOPY, RID_BYREF and RID_ONEWAY as returning OBJC_TYPE_QUAL to yyparse(). [gcc/objc/ChangeLog] 2004-09-07 Ziemowit Laski <zlaski@apple.com> * Make-lang.in (objc/objc-parse.o): Depend on $(C_COMMON_H) instead of objc/objc-act.h. (objc/objc-act.o): Depend on $(HASHTAB_H). * objc-act.c: Include hashtab.h; in ObjC++ mode, include cp-tree.h and objcp-decl.h instead of c-tree.h. (build_module_descriptor, get_class_ivars, synth_id_with_class_suffix, error_with_ivar, gen_method_decl, gen_declaration, setup_string_decl, build_protocol_template): Adjust prototypes. (build_module_initializer_routine, start_class, continue_class, finish_class, start_method_def, objc_start_function, start_protocol, build_method_decl, objc_add_method, add_instance_variable, build_ivar_reference, is_ivar, is_private, get_super_receiver, build_selector_table_decl, objc_push_parm, objc_get_parm_info, gen_type_name, gen_type_name_0, start_var_decl, finish_var_decl, create_field_decl): New prototypes. (objc_expand_function_end, comp_method_with_proto, objc_expr_last, gen_declaration_1, gen_declarator, is_complex_decl, adorn_decl, define_decl, create_builtin_decl, gen_declspecs): Remove prototypes. (TYPE_ID): Rename to OBJECT_TYPEDEF_NAME. (CLASS_TYPEDEF_NAME): New. (TAG_EXECCLASS): Change from a global variable to a #define. (TAG_RETURN_STRUCT): Delete. (TAG_GNUINIT): New, holds '__objc_gnu_init' name. (objc_inherit_code, objc_public_flag): New, moved from c-parse.in. (string_descriptor): New struct. (string_htab): New hash table. (string_hash, string_eq): New prototypes. (generate_struct_by_value_array): Call create_field_decl() instead of create_builtin_decl(). (objc_init): Do not initialize objc_ellipsis_node or TAG_EXECCLASS; In ObjC++ mode, call cxx_init() instead of c_objc_common_init(). (objc_finish_file): In ObjC++, call instantiate_pending_templates() and cp_finish_file(). (define_decl, get_static_reference, get_protocol_reference, create_builtin_decl): Remove functions. (objc_start_class_interface, objc_start_category_interface, objc_start_protocol, objc_continue_interface, objc_finish_interface, objc_start_class_implementation, objc_start_category_implementation, objc_continue_implementation, objc_finish_implementation, objc_set_visibility, objc_set_method_type, objc_build_method_signature, objc_add_method_declaration, objc_start_method_definition, objc_add_instance_variable, objc_get_protocol_qualified_type, create_field_decl, start_var_decl, finish_var_decl): New functions. (setup_string_decl): Simplify since it is only called once. (synth_module_prologue): Call build_class_template(); predefine 'id' and 'Class' as typedefs; rename 'temp_type' to 'type'; disable debug hooks for duration of function; fix GNU runtime messenger signatures to correspond to reality; forward-declare '__objc_exec_class' for the GNU runtime; call build_selector_table_decl(); in ObjC++ mode, generate 'extern "C" { ... }' wrappers around synthesized declarations; call build_protocol_template() and build_category_template(). (string_hash, string_eq): New functions. (objc_build_string_object): Check metaclass correctness only once; store string literals in hash table. (objc_build_constructor): Do not convert initializer elements; adjust for ObjC++ impedance mismatch. (build_objc_symtab_template): Call create_field_decl() instead of create_builtin_decl(). (init_objc_symtab): Add missing conversion to initializer element. (build_metadata_decl): Call start_var_decl() instead of define_decl(). (generate_objc_symtab_decl): Do not call build_category_template(); call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(). (build_module_descriptor): Call create_field_decl() instead of grokfield(); call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(); always mark module descriptor as used; move GNU runtime-specific functionality to build_module_initializer_routine(). (build_module_initializer_routine): New function, broken off of build_module_descriptor(). (objc_static_init_needed_p, objc_generate_static_init_call): New functions. (generate_static_references, generate_strings, build_selector_translation_table, generate_descriptor_table, generate_ivars_list, generate_dispatch_table, generate_category): Call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(); build a type directly instead of via groktypename(). (build_selector_reference_decl, build_selector_table_decl, build_class_reference_decl, build_protocol_reference, generate_objc_image_info): Call start_var_decl() instead of build_decl(). (build_selector_reference): For GNU runtime, do not call build_selector_reference_decl(). (build_selector, build_typed_selector_reference): Always convert result to the selector type. (add_objc_string): Cast return value to 'char *'. (build_method_prototype_template, build_selector_template, build_method_template): Use actual selector type for fields pointing to selectors. (finish_objc): For GNU runtime, call build_module_initializer_routine() after build_module_descriptor(). (generate_protocol_list, generate_shared_structures): Call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(); build a type directly instead of via groktypename(). (synth_id_with_class_suffix): Return a string. (get_arg_type_list): For instance methods, use the instance type for 'self'; do not call groktypename_in_parm_context(). (build_objc_string_decl): Squash redeclaration errors in ObjC++. (objc_is_class_name): Use OBJC_TYPE_NAME instead of TYPE_NAME; handle RECORD_TYPEs in ObjC as well as ObjC++. (objc_is_id): New function. (objc_is_object_ptr): Return the canonical type node. (objc_get_class_ivars): Simplify using get_class_ivars(). (get_class_ivars): Remove second parameter; create a fresh copy of the ivar list for each call; do not check for existence of super class. (objc_eh_runtime_type): Mark #ifndef OBJCPLUS. (objc_init_exceptions): When using SJLJ-style exceptions, require the use of '-fobjc-exceptions' flag; do not require it for DWARF-style exceptions. (objc_build_exc_ptr, next_sjlj_build_try_catch_finally): Use objc_object_type instead of objc_id_type. (objc_begin_catch_clause): Convert the incoming PARM_DECL into a VAR_DECL before placing it in the appropriate scope; do not call define_decl(); adjust call to c_begin_compound_stmt(); use objc_object_type instead of objc_id_type. (build_next_objc_exception_stuff): Call create_field_decl() instead of create_builtin_decl(); construct type directly instead of calling groktypename(); use OBJC_VOID_AT_END to mark end of function parameters. (build_private_template): Adjust call to get_class_ivars(); build a type directly instead of via groktypename(). (build_protocol_template, build_method_prototype_list_template, build_method_prototype_template, build_category_template, build_selector_template, build_class_template, build_super_template, build_ivar_template, build_ivar_list_template, build_method_list_template, build_method_template): Call create_field_decl() instead of grokfield(). (objc_method_parm_type): Do not call groktypename(). (generate_descriptor_table): Call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(). (generate_method_descriptors, build_protocol_initializer, generate_dispatch_tables, build_category_initializer, build_shared_structure_initializer): Do not call groktypename(). (generate_protocols): Call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(); do not call groktypename(). (error_with_ivar): Remove last parameter. (check_ivars): Do not iterate ovar CLASS_RAW_IVARS lists in addition to CLASS_IVARS lists; adjust calls to error_with_ivar(). (generate_ivar_lists): Convert one of the initializer elements; do not call groktypename(). (get_arg_type_list, start_method_def, gen_method_def): Account for new representation of variable arguments and '...' in Objective-C methods; add Objective-C++ impedance matching code. (is_objc_type_qualifier): Remove function. (adjust_type_for_id_default): Simplify; there is no longer a need to wade through declspecs. (lookup_interface, start_class, continue_class, finish_class, start_method_def, start_protocol, build_method_decl, objc_add_method, add_instance_variable, build_ivar_reference, is_ivar, is_private, get_super_receiver, objc_build_finally_epilogue): Make into static functions. (receiver_is_class_object): Use new IS_CLASS() macro. (objc_build_message_expr): Tweak ObjC++ message argument handling; call objc_finish_message_expr() instead of finish_message_expr(). (finish_message_expr): Rename to objc_finish_message_expr(); use OBJC_TYPE_NAME and OBJC_SET_TYPE_NAME macros instead of TYPE_NAME. call gen_type_name() instead of gen_declaration(); call objc_is_id() instead of using IS_ID and IS_CLASS; Use objc_class_name instead of calling get_identifier("Class"); handle CONVERT_EXPRs in receiver. (build_objc_method_call, warn_with_method): Do not call groktypename(). (build_ivar_reference): Call convert() instead of clobbering in a type. (hash_init): Initialize string_htab hash table. (add_instance_variable): Simplify parameter list; do not call grokfield(); do not populate CLASS_IVARS list. (start_class): Check for the existence of super class, if one was specified. (continue_class): Use CLASS_RAW_IVARS rather than CLASS_IVARS; do not call build_class_template(); adjust call to get_class_ivars(); call build_decl(), pushdecl() and finish_decl() instead of define_decl(). (finish_class): Call build_decl(), pushdecl() and finish_decl() instead of define_decl(). (add_protocols): Use PROTOCOL_BINFO_ELTS for the tree vector size. (start_protocol): Do not call build_protocol_template(); use PROTOCOL_BINFO_ELTS for the tree vector size. (encode_type_qualifiers): Do not handle the 'const' qualifier here. (encode_pointer): Encode 'const char *' as 'r*', for backwards compatibility. (encode_array): Use HOST_WIDE_INT_PRINT_DEC instead of "%ld". (encode_type): Handle the 'const' qualifier here. (objc_parmlist): New global variable, sued by objc_push_parm and objc_get_parm_info(). (objc_push_parm, objc_get_parm_info): New functions. (objc_expr_last): Remove function. (synth_self_and_ucmd_args): For instance methods, use the instance type for 'self'; call objc_push_parm() instead of push_parm_decl(). (start_method_def): Do not call push_scope(), declare_parm_level(), pop_scope(), push_parm_decl(), store_parm_decls() or objc_expr_last(); just use objc_push_parm() and objc_get_parm_info(). (comp_method_with_proto): Remove function. (objc_types_are_equivalent): Strip away indirections before comparing underlying types. (comp_proto_with_proto): Do not call groktypename(); types are no longer in raw declspec format. (objc_start_function): New function. (really_start_method): Call comp_proto_with_proto() instead of comp_method_with_proto(); call objc_start_function() instead of hand-crafting a function declarator. (continue_method_def, objc_expand_function_end): Remove functions. (get_super_receiver): Call objc_get_current_scope() instead of get_current_scope(); reference 'super_class' field (instead of 'class'). (finish_method_def): Rename to objc_finish_method_definition() and add a function decl parameter; move method encoding call from objc_expand_function_end(). (is_complex_decl, adorn_decl, gen_declarator, gen_declspecs, gen_declaration_1): Remove functions. (tmpbuf, RAW_DECLSPEC): Remove. (gen_declaration): Remove second parameter; simplify to deal with TYPE_P nodes instead of raw declspecs. (gen_type_name, gen_type_name_0): New functions. (gen_method_decl): Remove second parameter; call gen_type_name() instead of gen_declaration_1(). (dump_interface): Adjust calls to gen_declaration() and gen_method_decl(); do not allocate a separate string buffer. (init_objc): Allocate a larger string buffer to accommodate dump_interface(); adjust call to build_module_descriptor(); add call to build_module_initializer_routine() for the GNU runtime. (generate_classref_translation_entry): Do not call start_decl(); call finish_var_decl() instead of finish_decl(); call convert() instead of build_c_cast(). * objc-act.h (CLASS_OWN_IVARS): Remove accessor. (CLASS_BINFO_ELTS): Reduce from 6 to 5, now that CLASS_OWN_IVARS is gone. (OCTI_GNU_INIT_DECL, GNU_INIT_decl): New. (OCTI_ELLIPSIS_NODE, objc_ellipsis_node): Remove. (OCTI_ID_ID, id_type, objc_id_id): Rename to OCTI_ID_NAME, objc_object_type and objc_object_name, respectively. (OCTI_CLS_REF, OCTI_CLASS_NAME, objc_class_reference, objc_class_name): New. (IS_CLASS): New macro. (IS_ID, IS_SUPER): Robustify. (OCTI_EXECCLASS_DECL, execclass_decl): New. (finish_file, start_class, continue_class, finish_class, start_method_def, continue_method_def, finish_method_def, start_protocol, finish_protocol, objc_build_throw_stmt, objc_build_try_catch_finally_stmt, objc_build_synchronized_prologue, objc_build_synchronized_epilogue, objc_build_try_prologue, objc_build_try_epilogue, objc_build_catch_stmt, objc_build_catch_epilogue, objc_build_finally_prologue, objc_build_finally_epilogue, is_ivar, is_private, is_public, add_instance_variable, objc_add_method, get_super_receiver, objc_clear_super_receiver, get_class_ivars_from_name, get_class_reference, get_static_reference, get_object_reference, build_message_expr, finish_message_expr, build_selector_expr, build_ivar_reference, build_keyword_decl, build_method_decl, build_protocol_expr, build_objc_string_object, objc_declare_alias, objc_declare_class, objc_declare_protocols, objc_comptypes, objc_check_decl, build_encode_expr): Remove prototypes. (imp_count, cat_count): Make GGC-aware. (OBJC_SET_TYPE_NAME): New macro. From-SVN: r87168
2004-09-08 02:49:44 +02:00
static tree objc_get_parm_info (int);
c-tree.h (enum c_declarator_kind, [...]): New. * c-tree.h (enum c_declarator_kind, struct c_arg_info, struct c_declarator, struct c_type_name, struct c_parm): New. (build_array_declarator, set_array_declarator_inner, get_parm_info, grokfield, groktypename, grokparm, push_parm_decl, start_function, start_decl, build_c_parm, build_attrs_declarator, build_function_declarator, make_pointer_declarator, c_cast_expr, store_parm_decls_newstyle, c_expr_sizeof_type): Update prototypes. (build_id_declarator): New. * c-typeck.c (c_cast_expr, c_expr_sizeof_type): Update to new structures. * c-decl.c (ARG_INFO_PARMS, ARG_INFO_TAGS, ARG_INFO_TYPES, ARG_INFO_OTHERS): Remove. (build_id_declarator): New. (build_array_declarator, set_array_declarator_inner, groktypename, start_decl, grokparm, push_parm_decl, grokparms, get_parm_info, grokfield, start_function, store_parm_decls_newstyle, store_parm_decls_oldstyle, store_parm_decls, build_c_parm, build_attrs_declarator, build_function_declarator, make_pointer_declarator, grokdeclarator): Update to new structures. * c-parse.in (%union): Add arginfotype, dtrtype, typenametype and parmtype. (declarator, notype_declarator, after_type_declarator, parm_declarator, parm_declarator_starttypename, parm_declarator_nostarttypename, array_declarator, typename, absdcl, absdcl1, absdcl1_ea, absdcl1_noea, direct_absdcl1, absdcl_maybe_attribute, parm, firstparm, parms, parmlist, parmlist_1, parmlist_2, parmlist_or_identifiers, parmlist_or_identifiers_1): Use these types. (primary, after_type_declarator, parm_declarator_starttypename, notype_declarator, component_decl, component_declarator, component_notype_declarator, typename, absdcl, absdcl_maybe_attribute, absdcl1_ea, direct_absdcl1, parmlist_1, parmlist_2, parmlist_or_identifiers_1): Update to new structures. objc: * objc-act.c (objc_start_function, really_start_method, objc_get_parm_info, start_method_def): Update to new arg_info structures. From-SVN: r87217
2004-09-09 03:19:15 +02:00
#else
static struct c_arg_info *objc_get_parm_info (int);
#endif
1992-01-18 00:15:38 +01:00
1996-07-04 00:07:53 +02:00
/* Utilities for debugging and error diagnostics. */
1992-01-18 00:15:38 +01:00
static void warn_with_method (const char *, int, tree);
Makefile.in (c-parse.o): Depend on $(C_COMMON_H). [gcc/ChangeLog] 2004-09-07 Ziemowit Laski <zlaski@apple.com> * Makefile.in (c-parse.o): Depend on $(C_COMMON_H). * c-parse.in: Include c-common.h instead of objc-act.h. (ivar_decl_list, ivar_decls, ivar_decl, ivars, ivar_declarator, myparms, myparm): Remove %type declarations. (methodtype, optparms, OBJC_TYPE_QUAL, objc_quals, objc_qual, objc_typename, objc_try_catch_stmt, optellipsis): Add %type declarations. (objc_inherit_code, objc_public_flag): Remove. (typespec_nonreserved_nonattr): Call objc_get_protocol_qualified_type() instead of get_static_reference() and get_protocol_reference(). (stmt_nocomp): Call grokparm() on @catch parameter. (objcdef): Move semantic action to objc_finish_implementation(). (classdef): Move semantic action to objc_start_class_interface(), objc_continue_interface(), objc_finish_interface(), objc_start_class_implementation(), objc_continue_implementation(), objc_start_category_interface() and objc_start_category_implementation(). (protocoldef): Move semantic actions to objc_start_protocol() and objc_finish_interface(). (ivar_decl_list): Remove nonterminal. (visibility_spec): Move semantic actions to objc_set_visibility(). (ivar_decls): Remove assignment to $$. (ivar_decl): Rephrase in terms of component_decl; call objc_add_instance_variable(). (ivars, ivar_declarator): Remove nonterminals. (opt_semi): New nonterminal. (methodtype): Remove semantic actions. (methoddef): Move semantic actions to objc_set_method_type(), objc_start_method_definition() and objc_finish_method_definition(). (methodproto): Move semantic actions to objc_set_method_type() and objc_add_method_declaration(). (methoddecl): Use objc_typename instead of typename; move semantic actions to objc_build_method_signature(). (optarglist, myxdecls, mydecl, myparms, myparm): Remove nonterminals. (optparmlist): Express in terms of optparms and optellipsis. (optparms, optellipsis, objc_qual, objc_quals, objc_typename): New nonterminals. (keyworddecl): Use objc_typename instead of typename. (rid_to_yy): Mark RID_IN, RID_OUT, RID_INOUT, RID_BYCOPY, RID_BYREF and RID_ONEWAY as returning OBJC_TYPE_QUAL to yyparse(). [gcc/objc/ChangeLog] 2004-09-07 Ziemowit Laski <zlaski@apple.com> * Make-lang.in (objc/objc-parse.o): Depend on $(C_COMMON_H) instead of objc/objc-act.h. (objc/objc-act.o): Depend on $(HASHTAB_H). * objc-act.c: Include hashtab.h; in ObjC++ mode, include cp-tree.h and objcp-decl.h instead of c-tree.h. (build_module_descriptor, get_class_ivars, synth_id_with_class_suffix, error_with_ivar, gen_method_decl, gen_declaration, setup_string_decl, build_protocol_template): Adjust prototypes. (build_module_initializer_routine, start_class, continue_class, finish_class, start_method_def, objc_start_function, start_protocol, build_method_decl, objc_add_method, add_instance_variable, build_ivar_reference, is_ivar, is_private, get_super_receiver, build_selector_table_decl, objc_push_parm, objc_get_parm_info, gen_type_name, gen_type_name_0, start_var_decl, finish_var_decl, create_field_decl): New prototypes. (objc_expand_function_end, comp_method_with_proto, objc_expr_last, gen_declaration_1, gen_declarator, is_complex_decl, adorn_decl, define_decl, create_builtin_decl, gen_declspecs): Remove prototypes. (TYPE_ID): Rename to OBJECT_TYPEDEF_NAME. (CLASS_TYPEDEF_NAME): New. (TAG_EXECCLASS): Change from a global variable to a #define. (TAG_RETURN_STRUCT): Delete. (TAG_GNUINIT): New, holds '__objc_gnu_init' name. (objc_inherit_code, objc_public_flag): New, moved from c-parse.in. (string_descriptor): New struct. (string_htab): New hash table. (string_hash, string_eq): New prototypes. (generate_struct_by_value_array): Call create_field_decl() instead of create_builtin_decl(). (objc_init): Do not initialize objc_ellipsis_node or TAG_EXECCLASS; In ObjC++ mode, call cxx_init() instead of c_objc_common_init(). (objc_finish_file): In ObjC++, call instantiate_pending_templates() and cp_finish_file(). (define_decl, get_static_reference, get_protocol_reference, create_builtin_decl): Remove functions. (objc_start_class_interface, objc_start_category_interface, objc_start_protocol, objc_continue_interface, objc_finish_interface, objc_start_class_implementation, objc_start_category_implementation, objc_continue_implementation, objc_finish_implementation, objc_set_visibility, objc_set_method_type, objc_build_method_signature, objc_add_method_declaration, objc_start_method_definition, objc_add_instance_variable, objc_get_protocol_qualified_type, create_field_decl, start_var_decl, finish_var_decl): New functions. (setup_string_decl): Simplify since it is only called once. (synth_module_prologue): Call build_class_template(); predefine 'id' and 'Class' as typedefs; rename 'temp_type' to 'type'; disable debug hooks for duration of function; fix GNU runtime messenger signatures to correspond to reality; forward-declare '__objc_exec_class' for the GNU runtime; call build_selector_table_decl(); in ObjC++ mode, generate 'extern "C" { ... }' wrappers around synthesized declarations; call build_protocol_template() and build_category_template(). (string_hash, string_eq): New functions. (objc_build_string_object): Check metaclass correctness only once; store string literals in hash table. (objc_build_constructor): Do not convert initializer elements; adjust for ObjC++ impedance mismatch. (build_objc_symtab_template): Call create_field_decl() instead of create_builtin_decl(). (init_objc_symtab): Add missing conversion to initializer element. (build_metadata_decl): Call start_var_decl() instead of define_decl(). (generate_objc_symtab_decl): Do not call build_category_template(); call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(). (build_module_descriptor): Call create_field_decl() instead of grokfield(); call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(); always mark module descriptor as used; move GNU runtime-specific functionality to build_module_initializer_routine(). (build_module_initializer_routine): New function, broken off of build_module_descriptor(). (objc_static_init_needed_p, objc_generate_static_init_call): New functions. (generate_static_references, generate_strings, build_selector_translation_table, generate_descriptor_table, generate_ivars_list, generate_dispatch_table, generate_category): Call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(); build a type directly instead of via groktypename(). (build_selector_reference_decl, build_selector_table_decl, build_class_reference_decl, build_protocol_reference, generate_objc_image_info): Call start_var_decl() instead of build_decl(). (build_selector_reference): For GNU runtime, do not call build_selector_reference_decl(). (build_selector, build_typed_selector_reference): Always convert result to the selector type. (add_objc_string): Cast return value to 'char *'. (build_method_prototype_template, build_selector_template, build_method_template): Use actual selector type for fields pointing to selectors. (finish_objc): For GNU runtime, call build_module_initializer_routine() after build_module_descriptor(). (generate_protocol_list, generate_shared_structures): Call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(); build a type directly instead of via groktypename(). (synth_id_with_class_suffix): Return a string. (get_arg_type_list): For instance methods, use the instance type for 'self'; do not call groktypename_in_parm_context(). (build_objc_string_decl): Squash redeclaration errors in ObjC++. (objc_is_class_name): Use OBJC_TYPE_NAME instead of TYPE_NAME; handle RECORD_TYPEs in ObjC as well as ObjC++. (objc_is_id): New function. (objc_is_object_ptr): Return the canonical type node. (objc_get_class_ivars): Simplify using get_class_ivars(). (get_class_ivars): Remove second parameter; create a fresh copy of the ivar list for each call; do not check for existence of super class. (objc_eh_runtime_type): Mark #ifndef OBJCPLUS. (objc_init_exceptions): When using SJLJ-style exceptions, require the use of '-fobjc-exceptions' flag; do not require it for DWARF-style exceptions. (objc_build_exc_ptr, next_sjlj_build_try_catch_finally): Use objc_object_type instead of objc_id_type. (objc_begin_catch_clause): Convert the incoming PARM_DECL into a VAR_DECL before placing it in the appropriate scope; do not call define_decl(); adjust call to c_begin_compound_stmt(); use objc_object_type instead of objc_id_type. (build_next_objc_exception_stuff): Call create_field_decl() instead of create_builtin_decl(); construct type directly instead of calling groktypename(); use OBJC_VOID_AT_END to mark end of function parameters. (build_private_template): Adjust call to get_class_ivars(); build a type directly instead of via groktypename(). (build_protocol_template, build_method_prototype_list_template, build_method_prototype_template, build_category_template, build_selector_template, build_class_template, build_super_template, build_ivar_template, build_ivar_list_template, build_method_list_template, build_method_template): Call create_field_decl() instead of grokfield(). (objc_method_parm_type): Do not call groktypename(). (generate_descriptor_table): Call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(). (generate_method_descriptors, build_protocol_initializer, generate_dispatch_tables, build_category_initializer, build_shared_structure_initializer): Do not call groktypename(). (generate_protocols): Call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(); do not call groktypename(). (error_with_ivar): Remove last parameter. (check_ivars): Do not iterate ovar CLASS_RAW_IVARS lists in addition to CLASS_IVARS lists; adjust calls to error_with_ivar(). (generate_ivar_lists): Convert one of the initializer elements; do not call groktypename(). (get_arg_type_list, start_method_def, gen_method_def): Account for new representation of variable arguments and '...' in Objective-C methods; add Objective-C++ impedance matching code. (is_objc_type_qualifier): Remove function. (adjust_type_for_id_default): Simplify; there is no longer a need to wade through declspecs. (lookup_interface, start_class, continue_class, finish_class, start_method_def, start_protocol, build_method_decl, objc_add_method, add_instance_variable, build_ivar_reference, is_ivar, is_private, get_super_receiver, objc_build_finally_epilogue): Make into static functions. (receiver_is_class_object): Use new IS_CLASS() macro. (objc_build_message_expr): Tweak ObjC++ message argument handling; call objc_finish_message_expr() instead of finish_message_expr(). (finish_message_expr): Rename to objc_finish_message_expr(); use OBJC_TYPE_NAME and OBJC_SET_TYPE_NAME macros instead of TYPE_NAME. call gen_type_name() instead of gen_declaration(); call objc_is_id() instead of using IS_ID and IS_CLASS; Use objc_class_name instead of calling get_identifier("Class"); handle CONVERT_EXPRs in receiver. (build_objc_method_call, warn_with_method): Do not call groktypename(). (build_ivar_reference): Call convert() instead of clobbering in a type. (hash_init): Initialize string_htab hash table. (add_instance_variable): Simplify parameter list; do not call grokfield(); do not populate CLASS_IVARS list. (start_class): Check for the existence of super class, if one was specified. (continue_class): Use CLASS_RAW_IVARS rather than CLASS_IVARS; do not call build_class_template(); adjust call to get_class_ivars(); call build_decl(), pushdecl() and finish_decl() instead of define_decl(). (finish_class): Call build_decl(), pushdecl() and finish_decl() instead of define_decl(). (add_protocols): Use PROTOCOL_BINFO_ELTS for the tree vector size. (start_protocol): Do not call build_protocol_template(); use PROTOCOL_BINFO_ELTS for the tree vector size. (encode_type_qualifiers): Do not handle the 'const' qualifier here. (encode_pointer): Encode 'const char *' as 'r*', for backwards compatibility. (encode_array): Use HOST_WIDE_INT_PRINT_DEC instead of "%ld". (encode_type): Handle the 'const' qualifier here. (objc_parmlist): New global variable, sued by objc_push_parm and objc_get_parm_info(). (objc_push_parm, objc_get_parm_info): New functions. (objc_expr_last): Remove function. (synth_self_and_ucmd_args): For instance methods, use the instance type for 'self'; call objc_push_parm() instead of push_parm_decl(). (start_method_def): Do not call push_scope(), declare_parm_level(), pop_scope(), push_parm_decl(), store_parm_decls() or objc_expr_last(); just use objc_push_parm() and objc_get_parm_info(). (comp_method_with_proto): Remove function. (objc_types_are_equivalent): Strip away indirections before comparing underlying types. (comp_proto_with_proto): Do not call groktypename(); types are no longer in raw declspec format. (objc_start_function): New function. (really_start_method): Call comp_proto_with_proto() instead of comp_method_with_proto(); call objc_start_function() instead of hand-crafting a function declarator. (continue_method_def, objc_expand_function_end): Remove functions. (get_super_receiver): Call objc_get_current_scope() instead of get_current_scope(); reference 'super_class' field (instead of 'class'). (finish_method_def): Rename to objc_finish_method_definition() and add a function decl parameter; move method encoding call from objc_expand_function_end(). (is_complex_decl, adorn_decl, gen_declarator, gen_declspecs, gen_declaration_1): Remove functions. (tmpbuf, RAW_DECLSPEC): Remove. (gen_declaration): Remove second parameter; simplify to deal with TYPE_P nodes instead of raw declspecs. (gen_type_name, gen_type_name_0): New functions. (gen_method_decl): Remove second parameter; call gen_type_name() instead of gen_declaration_1(). (dump_interface): Adjust calls to gen_declaration() and gen_method_decl(); do not allocate a separate string buffer. (init_objc): Allocate a larger string buffer to accommodate dump_interface(); adjust call to build_module_descriptor(); add call to build_module_initializer_routine() for the GNU runtime. (generate_classref_translation_entry): Do not call start_decl(); call finish_var_decl() instead of finish_decl(); call convert() instead of build_c_cast(). * objc-act.h (CLASS_OWN_IVARS): Remove accessor. (CLASS_BINFO_ELTS): Reduce from 6 to 5, now that CLASS_OWN_IVARS is gone. (OCTI_GNU_INIT_DECL, GNU_INIT_decl): New. (OCTI_ELLIPSIS_NODE, objc_ellipsis_node): Remove. (OCTI_ID_ID, id_type, objc_id_id): Rename to OCTI_ID_NAME, objc_object_type and objc_object_name, respectively. (OCTI_CLS_REF, OCTI_CLASS_NAME, objc_class_reference, objc_class_name): New. (IS_CLASS): New macro. (IS_ID, IS_SUPER): Robustify. (OCTI_EXECCLASS_DECL, execclass_decl): New. (finish_file, start_class, continue_class, finish_class, start_method_def, continue_method_def, finish_method_def, start_protocol, finish_protocol, objc_build_throw_stmt, objc_build_try_catch_finally_stmt, objc_build_synchronized_prologue, objc_build_synchronized_epilogue, objc_build_try_prologue, objc_build_try_epilogue, objc_build_catch_stmt, objc_build_catch_epilogue, objc_build_finally_prologue, objc_build_finally_epilogue, is_ivar, is_private, is_public, add_instance_variable, objc_add_method, get_super_receiver, objc_clear_super_receiver, get_class_ivars_from_name, get_class_reference, get_static_reference, get_object_reference, build_message_expr, finish_message_expr, build_selector_expr, build_ivar_reference, build_keyword_decl, build_method_decl, build_protocol_expr, build_objc_string_object, objc_declare_alias, objc_declare_class, objc_declare_protocols, objc_comptypes, objc_check_decl, build_encode_expr): Remove prototypes. (imp_count, cat_count): Make GGC-aware. (OBJC_SET_TYPE_NAME): New macro. From-SVN: r87168
2004-09-08 02:49:44 +02:00
static char *gen_type_name (tree);
static char *gen_type_name_0 (tree);
static char *gen_method_decl (tree);
static char *gen_declaration (tree);
1996-07-04 00:07:53 +02:00
/* Everything else. */
Makefile.in (c-parse.o): Depend on $(C_COMMON_H). [gcc/ChangeLog] 2004-09-07 Ziemowit Laski <zlaski@apple.com> * Makefile.in (c-parse.o): Depend on $(C_COMMON_H). * c-parse.in: Include c-common.h instead of objc-act.h. (ivar_decl_list, ivar_decls, ivar_decl, ivars, ivar_declarator, myparms, myparm): Remove %type declarations. (methodtype, optparms, OBJC_TYPE_QUAL, objc_quals, objc_qual, objc_typename, objc_try_catch_stmt, optellipsis): Add %type declarations. (objc_inherit_code, objc_public_flag): Remove. (typespec_nonreserved_nonattr): Call objc_get_protocol_qualified_type() instead of get_static_reference() and get_protocol_reference(). (stmt_nocomp): Call grokparm() on @catch parameter. (objcdef): Move semantic action to objc_finish_implementation(). (classdef): Move semantic action to objc_start_class_interface(), objc_continue_interface(), objc_finish_interface(), objc_start_class_implementation(), objc_continue_implementation(), objc_start_category_interface() and objc_start_category_implementation(). (protocoldef): Move semantic actions to objc_start_protocol() and objc_finish_interface(). (ivar_decl_list): Remove nonterminal. (visibility_spec): Move semantic actions to objc_set_visibility(). (ivar_decls): Remove assignment to $$. (ivar_decl): Rephrase in terms of component_decl; call objc_add_instance_variable(). (ivars, ivar_declarator): Remove nonterminals. (opt_semi): New nonterminal. (methodtype): Remove semantic actions. (methoddef): Move semantic actions to objc_set_method_type(), objc_start_method_definition() and objc_finish_method_definition(). (methodproto): Move semantic actions to objc_set_method_type() and objc_add_method_declaration(). (methoddecl): Use objc_typename instead of typename; move semantic actions to objc_build_method_signature(). (optarglist, myxdecls, mydecl, myparms, myparm): Remove nonterminals. (optparmlist): Express in terms of optparms and optellipsis. (optparms, optellipsis, objc_qual, objc_quals, objc_typename): New nonterminals. (keyworddecl): Use objc_typename instead of typename. (rid_to_yy): Mark RID_IN, RID_OUT, RID_INOUT, RID_BYCOPY, RID_BYREF and RID_ONEWAY as returning OBJC_TYPE_QUAL to yyparse(). [gcc/objc/ChangeLog] 2004-09-07 Ziemowit Laski <zlaski@apple.com> * Make-lang.in (objc/objc-parse.o): Depend on $(C_COMMON_H) instead of objc/objc-act.h. (objc/objc-act.o): Depend on $(HASHTAB_H). * objc-act.c: Include hashtab.h; in ObjC++ mode, include cp-tree.h and objcp-decl.h instead of c-tree.h. (build_module_descriptor, get_class_ivars, synth_id_with_class_suffix, error_with_ivar, gen_method_decl, gen_declaration, setup_string_decl, build_protocol_template): Adjust prototypes. (build_module_initializer_routine, start_class, continue_class, finish_class, start_method_def, objc_start_function, start_protocol, build_method_decl, objc_add_method, add_instance_variable, build_ivar_reference, is_ivar, is_private, get_super_receiver, build_selector_table_decl, objc_push_parm, objc_get_parm_info, gen_type_name, gen_type_name_0, start_var_decl, finish_var_decl, create_field_decl): New prototypes. (objc_expand_function_end, comp_method_with_proto, objc_expr_last, gen_declaration_1, gen_declarator, is_complex_decl, adorn_decl, define_decl, create_builtin_decl, gen_declspecs): Remove prototypes. (TYPE_ID): Rename to OBJECT_TYPEDEF_NAME. (CLASS_TYPEDEF_NAME): New. (TAG_EXECCLASS): Change from a global variable to a #define. (TAG_RETURN_STRUCT): Delete. (TAG_GNUINIT): New, holds '__objc_gnu_init' name. (objc_inherit_code, objc_public_flag): New, moved from c-parse.in. (string_descriptor): New struct. (string_htab): New hash table. (string_hash, string_eq): New prototypes. (generate_struct_by_value_array): Call create_field_decl() instead of create_builtin_decl(). (objc_init): Do not initialize objc_ellipsis_node or TAG_EXECCLASS; In ObjC++ mode, call cxx_init() instead of c_objc_common_init(). (objc_finish_file): In ObjC++, call instantiate_pending_templates() and cp_finish_file(). (define_decl, get_static_reference, get_protocol_reference, create_builtin_decl): Remove functions. (objc_start_class_interface, objc_start_category_interface, objc_start_protocol, objc_continue_interface, objc_finish_interface, objc_start_class_implementation, objc_start_category_implementation, objc_continue_implementation, objc_finish_implementation, objc_set_visibility, objc_set_method_type, objc_build_method_signature, objc_add_method_declaration, objc_start_method_definition, objc_add_instance_variable, objc_get_protocol_qualified_type, create_field_decl, start_var_decl, finish_var_decl): New functions. (setup_string_decl): Simplify since it is only called once. (synth_module_prologue): Call build_class_template(); predefine 'id' and 'Class' as typedefs; rename 'temp_type' to 'type'; disable debug hooks for duration of function; fix GNU runtime messenger signatures to correspond to reality; forward-declare '__objc_exec_class' for the GNU runtime; call build_selector_table_decl(); in ObjC++ mode, generate 'extern "C" { ... }' wrappers around synthesized declarations; call build_protocol_template() and build_category_template(). (string_hash, string_eq): New functions. (objc_build_string_object): Check metaclass correctness only once; store string literals in hash table. (objc_build_constructor): Do not convert initializer elements; adjust for ObjC++ impedance mismatch. (build_objc_symtab_template): Call create_field_decl() instead of create_builtin_decl(). (init_objc_symtab): Add missing conversion to initializer element. (build_metadata_decl): Call start_var_decl() instead of define_decl(). (generate_objc_symtab_decl): Do not call build_category_template(); call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(). (build_module_descriptor): Call create_field_decl() instead of grokfield(); call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(); always mark module descriptor as used; move GNU runtime-specific functionality to build_module_initializer_routine(). (build_module_initializer_routine): New function, broken off of build_module_descriptor(). (objc_static_init_needed_p, objc_generate_static_init_call): New functions. (generate_static_references, generate_strings, build_selector_translation_table, generate_descriptor_table, generate_ivars_list, generate_dispatch_table, generate_category): Call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(); build a type directly instead of via groktypename(). (build_selector_reference_decl, build_selector_table_decl, build_class_reference_decl, build_protocol_reference, generate_objc_image_info): Call start_var_decl() instead of build_decl(). (build_selector_reference): For GNU runtime, do not call build_selector_reference_decl(). (build_selector, build_typed_selector_reference): Always convert result to the selector type. (add_objc_string): Cast return value to 'char *'. (build_method_prototype_template, build_selector_template, build_method_template): Use actual selector type for fields pointing to selectors. (finish_objc): For GNU runtime, call build_module_initializer_routine() after build_module_descriptor(). (generate_protocol_list, generate_shared_structures): Call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(); build a type directly instead of via groktypename(). (synth_id_with_class_suffix): Return a string. (get_arg_type_list): For instance methods, use the instance type for 'self'; do not call groktypename_in_parm_context(). (build_objc_string_decl): Squash redeclaration errors in ObjC++. (objc_is_class_name): Use OBJC_TYPE_NAME instead of TYPE_NAME; handle RECORD_TYPEs in ObjC as well as ObjC++. (objc_is_id): New function. (objc_is_object_ptr): Return the canonical type node. (objc_get_class_ivars): Simplify using get_class_ivars(). (get_class_ivars): Remove second parameter; create a fresh copy of the ivar list for each call; do not check for existence of super class. (objc_eh_runtime_type): Mark #ifndef OBJCPLUS. (objc_init_exceptions): When using SJLJ-style exceptions, require the use of '-fobjc-exceptions' flag; do not require it for DWARF-style exceptions. (objc_build_exc_ptr, next_sjlj_build_try_catch_finally): Use objc_object_type instead of objc_id_type. (objc_begin_catch_clause): Convert the incoming PARM_DECL into a VAR_DECL before placing it in the appropriate scope; do not call define_decl(); adjust call to c_begin_compound_stmt(); use objc_object_type instead of objc_id_type. (build_next_objc_exception_stuff): Call create_field_decl() instead of create_builtin_decl(); construct type directly instead of calling groktypename(); use OBJC_VOID_AT_END to mark end of function parameters. (build_private_template): Adjust call to get_class_ivars(); build a type directly instead of via groktypename(). (build_protocol_template, build_method_prototype_list_template, build_method_prototype_template, build_category_template, build_selector_template, build_class_template, build_super_template, build_ivar_template, build_ivar_list_template, build_method_list_template, build_method_template): Call create_field_decl() instead of grokfield(). (objc_method_parm_type): Do not call groktypename(). (generate_descriptor_table): Call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(). (generate_method_descriptors, build_protocol_initializer, generate_dispatch_tables, build_category_initializer, build_shared_structure_initializer): Do not call groktypename(). (generate_protocols): Call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(); do not call groktypename(). (error_with_ivar): Remove last parameter. (check_ivars): Do not iterate ovar CLASS_RAW_IVARS lists in addition to CLASS_IVARS lists; adjust calls to error_with_ivar(). (generate_ivar_lists): Convert one of the initializer elements; do not call groktypename(). (get_arg_type_list, start_method_def, gen_method_def): Account for new representation of variable arguments and '...' in Objective-C methods; add Objective-C++ impedance matching code. (is_objc_type_qualifier): Remove function. (adjust_type_for_id_default): Simplify; there is no longer a need to wade through declspecs. (lookup_interface, start_class, continue_class, finish_class, start_method_def, start_protocol, build_method_decl, objc_add_method, add_instance_variable, build_ivar_reference, is_ivar, is_private, get_super_receiver, objc_build_finally_epilogue): Make into static functions. (receiver_is_class_object): Use new IS_CLASS() macro. (objc_build_message_expr): Tweak ObjC++ message argument handling; call objc_finish_message_expr() instead of finish_message_expr(). (finish_message_expr): Rename to objc_finish_message_expr(); use OBJC_TYPE_NAME and OBJC_SET_TYPE_NAME macros instead of TYPE_NAME. call gen_type_name() instead of gen_declaration(); call objc_is_id() instead of using IS_ID and IS_CLASS; Use objc_class_name instead of calling get_identifier("Class"); handle CONVERT_EXPRs in receiver. (build_objc_method_call, warn_with_method): Do not call groktypename(). (build_ivar_reference): Call convert() instead of clobbering in a type. (hash_init): Initialize string_htab hash table. (add_instance_variable): Simplify parameter list; do not call grokfield(); do not populate CLASS_IVARS list. (start_class): Check for the existence of super class, if one was specified. (continue_class): Use CLASS_RAW_IVARS rather than CLASS_IVARS; do not call build_class_template(); adjust call to get_class_ivars(); call build_decl(), pushdecl() and finish_decl() instead of define_decl(). (finish_class): Call build_decl(), pushdecl() and finish_decl() instead of define_decl(). (add_protocols): Use PROTOCOL_BINFO_ELTS for the tree vector size. (start_protocol): Do not call build_protocol_template(); use PROTOCOL_BINFO_ELTS for the tree vector size. (encode_type_qualifiers): Do not handle the 'const' qualifier here. (encode_pointer): Encode 'const char *' as 'r*', for backwards compatibility. (encode_array): Use HOST_WIDE_INT_PRINT_DEC instead of "%ld". (encode_type): Handle the 'const' qualifier here. (objc_parmlist): New global variable, sued by objc_push_parm and objc_get_parm_info(). (objc_push_parm, objc_get_parm_info): New functions. (objc_expr_last): Remove function. (synth_self_and_ucmd_args): For instance methods, use the instance type for 'self'; call objc_push_parm() instead of push_parm_decl(). (start_method_def): Do not call push_scope(), declare_parm_level(), pop_scope(), push_parm_decl(), store_parm_decls() or objc_expr_last(); just use objc_push_parm() and objc_get_parm_info(). (comp_method_with_proto): Remove function. (objc_types_are_equivalent): Strip away indirections before comparing underlying types. (comp_proto_with_proto): Do not call groktypename(); types are no longer in raw declspec format. (objc_start_function): New function. (really_start_method): Call comp_proto_with_proto() instead of comp_method_with_proto(); call objc_start_function() instead of hand-crafting a function declarator. (continue_method_def, objc_expand_function_end): Remove functions. (get_super_receiver): Call objc_get_current_scope() instead of get_current_scope(); reference 'super_class' field (instead of 'class'). (finish_method_def): Rename to objc_finish_method_definition() and add a function decl parameter; move method encoding call from objc_expand_function_end(). (is_complex_decl, adorn_decl, gen_declarator, gen_declspecs, gen_declaration_1): Remove functions. (tmpbuf, RAW_DECLSPEC): Remove. (gen_declaration): Remove second parameter; simplify to deal with TYPE_P nodes instead of raw declspecs. (gen_type_name, gen_type_name_0): New functions. (gen_method_decl): Remove second parameter; call gen_type_name() instead of gen_declaration_1(). (dump_interface): Adjust calls to gen_declaration() and gen_method_decl(); do not allocate a separate string buffer. (init_objc): Allocate a larger string buffer to accommodate dump_interface(); adjust call to build_module_descriptor(); add call to build_module_initializer_routine() for the GNU runtime. (generate_classref_translation_entry): Do not call start_decl(); call finish_var_decl() instead of finish_decl(); call convert() instead of build_c_cast(). * objc-act.h (CLASS_OWN_IVARS): Remove accessor. (CLASS_BINFO_ELTS): Reduce from 6 to 5, now that CLASS_OWN_IVARS is gone. (OCTI_GNU_INIT_DECL, GNU_INIT_decl): New. (OCTI_ELLIPSIS_NODE, objc_ellipsis_node): Remove. (OCTI_ID_ID, id_type, objc_id_id): Rename to OCTI_ID_NAME, objc_object_type and objc_object_name, respectively. (OCTI_CLS_REF, OCTI_CLASS_NAME, objc_class_reference, objc_class_name): New. (IS_CLASS): New macro. (IS_ID, IS_SUPER): Robustify. (OCTI_EXECCLASS_DECL, execclass_decl): New. (finish_file, start_class, continue_class, finish_class, start_method_def, continue_method_def, finish_method_def, start_protocol, finish_protocol, objc_build_throw_stmt, objc_build_try_catch_finally_stmt, objc_build_synchronized_prologue, objc_build_synchronized_epilogue, objc_build_try_prologue, objc_build_try_epilogue, objc_build_catch_stmt, objc_build_catch_epilogue, objc_build_finally_prologue, objc_build_finally_epilogue, is_ivar, is_private, is_public, add_instance_variable, objc_add_method, get_super_receiver, objc_clear_super_receiver, get_class_ivars_from_name, get_class_reference, get_static_reference, get_object_reference, build_message_expr, finish_message_expr, build_selector_expr, build_ivar_reference, build_keyword_decl, build_method_decl, build_protocol_expr, build_objc_string_object, objc_declare_alias, objc_declare_class, objc_declare_protocols, objc_comptypes, objc_check_decl, build_encode_expr): Remove prototypes. (imp_count, cat_count): Make GGC-aware. (OBJC_SET_TYPE_NAME): New macro. From-SVN: r87168
2004-09-08 02:49:44 +02:00
static tree create_field_decl (tree, const char *);
static void add_class_reference (tree);
Makefile.in (c-parse.o): Depend on $(C_COMMON_H). [gcc/ChangeLog] 2004-09-07 Ziemowit Laski <zlaski@apple.com> * Makefile.in (c-parse.o): Depend on $(C_COMMON_H). * c-parse.in: Include c-common.h instead of objc-act.h. (ivar_decl_list, ivar_decls, ivar_decl, ivars, ivar_declarator, myparms, myparm): Remove %type declarations. (methodtype, optparms, OBJC_TYPE_QUAL, objc_quals, objc_qual, objc_typename, objc_try_catch_stmt, optellipsis): Add %type declarations. (objc_inherit_code, objc_public_flag): Remove. (typespec_nonreserved_nonattr): Call objc_get_protocol_qualified_type() instead of get_static_reference() and get_protocol_reference(). (stmt_nocomp): Call grokparm() on @catch parameter. (objcdef): Move semantic action to objc_finish_implementation(). (classdef): Move semantic action to objc_start_class_interface(), objc_continue_interface(), objc_finish_interface(), objc_start_class_implementation(), objc_continue_implementation(), objc_start_category_interface() and objc_start_category_implementation(). (protocoldef): Move semantic actions to objc_start_protocol() and objc_finish_interface(). (ivar_decl_list): Remove nonterminal. (visibility_spec): Move semantic actions to objc_set_visibility(). (ivar_decls): Remove assignment to $$. (ivar_decl): Rephrase in terms of component_decl; call objc_add_instance_variable(). (ivars, ivar_declarator): Remove nonterminals. (opt_semi): New nonterminal. (methodtype): Remove semantic actions. (methoddef): Move semantic actions to objc_set_method_type(), objc_start_method_definition() and objc_finish_method_definition(). (methodproto): Move semantic actions to objc_set_method_type() and objc_add_method_declaration(). (methoddecl): Use objc_typename instead of typename; move semantic actions to objc_build_method_signature(). (optarglist, myxdecls, mydecl, myparms, myparm): Remove nonterminals. (optparmlist): Express in terms of optparms and optellipsis. (optparms, optellipsis, objc_qual, objc_quals, objc_typename): New nonterminals. (keyworddecl): Use objc_typename instead of typename. (rid_to_yy): Mark RID_IN, RID_OUT, RID_INOUT, RID_BYCOPY, RID_BYREF and RID_ONEWAY as returning OBJC_TYPE_QUAL to yyparse(). [gcc/objc/ChangeLog] 2004-09-07 Ziemowit Laski <zlaski@apple.com> * Make-lang.in (objc/objc-parse.o): Depend on $(C_COMMON_H) instead of objc/objc-act.h. (objc/objc-act.o): Depend on $(HASHTAB_H). * objc-act.c: Include hashtab.h; in ObjC++ mode, include cp-tree.h and objcp-decl.h instead of c-tree.h. (build_module_descriptor, get_class_ivars, synth_id_with_class_suffix, error_with_ivar, gen_method_decl, gen_declaration, setup_string_decl, build_protocol_template): Adjust prototypes. (build_module_initializer_routine, start_class, continue_class, finish_class, start_method_def, objc_start_function, start_protocol, build_method_decl, objc_add_method, add_instance_variable, build_ivar_reference, is_ivar, is_private, get_super_receiver, build_selector_table_decl, objc_push_parm, objc_get_parm_info, gen_type_name, gen_type_name_0, start_var_decl, finish_var_decl, create_field_decl): New prototypes. (objc_expand_function_end, comp_method_with_proto, objc_expr_last, gen_declaration_1, gen_declarator, is_complex_decl, adorn_decl, define_decl, create_builtin_decl, gen_declspecs): Remove prototypes. (TYPE_ID): Rename to OBJECT_TYPEDEF_NAME. (CLASS_TYPEDEF_NAME): New. (TAG_EXECCLASS): Change from a global variable to a #define. (TAG_RETURN_STRUCT): Delete. (TAG_GNUINIT): New, holds '__objc_gnu_init' name. (objc_inherit_code, objc_public_flag): New, moved from c-parse.in. (string_descriptor): New struct. (string_htab): New hash table. (string_hash, string_eq): New prototypes. (generate_struct_by_value_array): Call create_field_decl() instead of create_builtin_decl(). (objc_init): Do not initialize objc_ellipsis_node or TAG_EXECCLASS; In ObjC++ mode, call cxx_init() instead of c_objc_common_init(). (objc_finish_file): In ObjC++, call instantiate_pending_templates() and cp_finish_file(). (define_decl, get_static_reference, get_protocol_reference, create_builtin_decl): Remove functions. (objc_start_class_interface, objc_start_category_interface, objc_start_protocol, objc_continue_interface, objc_finish_interface, objc_start_class_implementation, objc_start_category_implementation, objc_continue_implementation, objc_finish_implementation, objc_set_visibility, objc_set_method_type, objc_build_method_signature, objc_add_method_declaration, objc_start_method_definition, objc_add_instance_variable, objc_get_protocol_qualified_type, create_field_decl, start_var_decl, finish_var_decl): New functions. (setup_string_decl): Simplify since it is only called once. (synth_module_prologue): Call build_class_template(); predefine 'id' and 'Class' as typedefs; rename 'temp_type' to 'type'; disable debug hooks for duration of function; fix GNU runtime messenger signatures to correspond to reality; forward-declare '__objc_exec_class' for the GNU runtime; call build_selector_table_decl(); in ObjC++ mode, generate 'extern "C" { ... }' wrappers around synthesized declarations; call build_protocol_template() and build_category_template(). (string_hash, string_eq): New functions. (objc_build_string_object): Check metaclass correctness only once; store string literals in hash table. (objc_build_constructor): Do not convert initializer elements; adjust for ObjC++ impedance mismatch. (build_objc_symtab_template): Call create_field_decl() instead of create_builtin_decl(). (init_objc_symtab): Add missing conversion to initializer element. (build_metadata_decl): Call start_var_decl() instead of define_decl(). (generate_objc_symtab_decl): Do not call build_category_template(); call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(). (build_module_descriptor): Call create_field_decl() instead of grokfield(); call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(); always mark module descriptor as used; move GNU runtime-specific functionality to build_module_initializer_routine(). (build_module_initializer_routine): New function, broken off of build_module_descriptor(). (objc_static_init_needed_p, objc_generate_static_init_call): New functions. (generate_static_references, generate_strings, build_selector_translation_table, generate_descriptor_table, generate_ivars_list, generate_dispatch_table, generate_category): Call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(); build a type directly instead of via groktypename(). (build_selector_reference_decl, build_selector_table_decl, build_class_reference_decl, build_protocol_reference, generate_objc_image_info): Call start_var_decl() instead of build_decl(). (build_selector_reference): For GNU runtime, do not call build_selector_reference_decl(). (build_selector, build_typed_selector_reference): Always convert result to the selector type. (add_objc_string): Cast return value to 'char *'. (build_method_prototype_template, build_selector_template, build_method_template): Use actual selector type for fields pointing to selectors. (finish_objc): For GNU runtime, call build_module_initializer_routine() after build_module_descriptor(). (generate_protocol_list, generate_shared_structures): Call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(); build a type directly instead of via groktypename(). (synth_id_with_class_suffix): Return a string. (get_arg_type_list): For instance methods, use the instance type for 'self'; do not call groktypename_in_parm_context(). (build_objc_string_decl): Squash redeclaration errors in ObjC++. (objc_is_class_name): Use OBJC_TYPE_NAME instead of TYPE_NAME; handle RECORD_TYPEs in ObjC as well as ObjC++. (objc_is_id): New function. (objc_is_object_ptr): Return the canonical type node. (objc_get_class_ivars): Simplify using get_class_ivars(). (get_class_ivars): Remove second parameter; create a fresh copy of the ivar list for each call; do not check for existence of super class. (objc_eh_runtime_type): Mark #ifndef OBJCPLUS. (objc_init_exceptions): When using SJLJ-style exceptions, require the use of '-fobjc-exceptions' flag; do not require it for DWARF-style exceptions. (objc_build_exc_ptr, next_sjlj_build_try_catch_finally): Use objc_object_type instead of objc_id_type. (objc_begin_catch_clause): Convert the incoming PARM_DECL into a VAR_DECL before placing it in the appropriate scope; do not call define_decl(); adjust call to c_begin_compound_stmt(); use objc_object_type instead of objc_id_type. (build_next_objc_exception_stuff): Call create_field_decl() instead of create_builtin_decl(); construct type directly instead of calling groktypename(); use OBJC_VOID_AT_END to mark end of function parameters. (build_private_template): Adjust call to get_class_ivars(); build a type directly instead of via groktypename(). (build_protocol_template, build_method_prototype_list_template, build_method_prototype_template, build_category_template, build_selector_template, build_class_template, build_super_template, build_ivar_template, build_ivar_list_template, build_method_list_template, build_method_template): Call create_field_decl() instead of grokfield(). (objc_method_parm_type): Do not call groktypename(). (generate_descriptor_table): Call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(). (generate_method_descriptors, build_protocol_initializer, generate_dispatch_tables, build_category_initializer, build_shared_structure_initializer): Do not call groktypename(). (generate_protocols): Call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(); do not call groktypename(). (error_with_ivar): Remove last parameter. (check_ivars): Do not iterate ovar CLASS_RAW_IVARS lists in addition to CLASS_IVARS lists; adjust calls to error_with_ivar(). (generate_ivar_lists): Convert one of the initializer elements; do not call groktypename(). (get_arg_type_list, start_method_def, gen_method_def): Account for new representation of variable arguments and '...' in Objective-C methods; add Objective-C++ impedance matching code. (is_objc_type_qualifier): Remove function. (adjust_type_for_id_default): Simplify; there is no longer a need to wade through declspecs. (lookup_interface, start_class, continue_class, finish_class, start_method_def, start_protocol, build_method_decl, objc_add_method, add_instance_variable, build_ivar_reference, is_ivar, is_private, get_super_receiver, objc_build_finally_epilogue): Make into static functions. (receiver_is_class_object): Use new IS_CLASS() macro. (objc_build_message_expr): Tweak ObjC++ message argument handling; call objc_finish_message_expr() instead of finish_message_expr(). (finish_message_expr): Rename to objc_finish_message_expr(); use OBJC_TYPE_NAME and OBJC_SET_TYPE_NAME macros instead of TYPE_NAME. call gen_type_name() instead of gen_declaration(); call objc_is_id() instead of using IS_ID and IS_CLASS; Use objc_class_name instead of calling get_identifier("Class"); handle CONVERT_EXPRs in receiver. (build_objc_method_call, warn_with_method): Do not call groktypename(). (build_ivar_reference): Call convert() instead of clobbering in a type. (hash_init): Initialize string_htab hash table. (add_instance_variable): Simplify parameter list; do not call grokfield(); do not populate CLASS_IVARS list. (start_class): Check for the existence of super class, if one was specified. (continue_class): Use CLASS_RAW_IVARS rather than CLASS_IVARS; do not call build_class_template(); adjust call to get_class_ivars(); call build_decl(), pushdecl() and finish_decl() instead of define_decl(). (finish_class): Call build_decl(), pushdecl() and finish_decl() instead of define_decl(). (add_protocols): Use PROTOCOL_BINFO_ELTS for the tree vector size. (start_protocol): Do not call build_protocol_template(); use PROTOCOL_BINFO_ELTS for the tree vector size. (encode_type_qualifiers): Do not handle the 'const' qualifier here. (encode_pointer): Encode 'const char *' as 'r*', for backwards compatibility. (encode_array): Use HOST_WIDE_INT_PRINT_DEC instead of "%ld". (encode_type): Handle the 'const' qualifier here. (objc_parmlist): New global variable, sued by objc_push_parm and objc_get_parm_info(). (objc_push_parm, objc_get_parm_info): New functions. (objc_expr_last): Remove function. (synth_self_and_ucmd_args): For instance methods, use the instance type for 'self'; call objc_push_parm() instead of push_parm_decl(). (start_method_def): Do not call push_scope(), declare_parm_level(), pop_scope(), push_parm_decl(), store_parm_decls() or objc_expr_last(); just use objc_push_parm() and objc_get_parm_info(). (comp_method_with_proto): Remove function. (objc_types_are_equivalent): Strip away indirections before comparing underlying types. (comp_proto_with_proto): Do not call groktypename(); types are no longer in raw declspec format. (objc_start_function): New function. (really_start_method): Call comp_proto_with_proto() instead of comp_method_with_proto(); call objc_start_function() instead of hand-crafting a function declarator. (continue_method_def, objc_expand_function_end): Remove functions. (get_super_receiver): Call objc_get_current_scope() instead of get_current_scope(); reference 'super_class' field (instead of 'class'). (finish_method_def): Rename to objc_finish_method_definition() and add a function decl parameter; move method encoding call from objc_expand_function_end(). (is_complex_decl, adorn_decl, gen_declarator, gen_declspecs, gen_declaration_1): Remove functions. (tmpbuf, RAW_DECLSPEC): Remove. (gen_declaration): Remove second parameter; simplify to deal with TYPE_P nodes instead of raw declspecs. (gen_type_name, gen_type_name_0): New functions. (gen_method_decl): Remove second parameter; call gen_type_name() instead of gen_declaration_1(). (dump_interface): Adjust calls to gen_declaration() and gen_method_decl(); do not allocate a separate string buffer. (init_objc): Allocate a larger string buffer to accommodate dump_interface(); adjust call to build_module_descriptor(); add call to build_module_initializer_routine() for the GNU runtime. (generate_classref_translation_entry): Do not call start_decl(); call finish_var_decl() instead of finish_decl(); call convert() instead of build_c_cast(). * objc-act.h (CLASS_OWN_IVARS): Remove accessor. (CLASS_BINFO_ELTS): Reduce from 6 to 5, now that CLASS_OWN_IVARS is gone. (OCTI_GNU_INIT_DECL, GNU_INIT_decl): New. (OCTI_ELLIPSIS_NODE, objc_ellipsis_node): Remove. (OCTI_ID_ID, id_type, objc_id_id): Rename to OCTI_ID_NAME, objc_object_type and objc_object_name, respectively. (OCTI_CLS_REF, OCTI_CLASS_NAME, objc_class_reference, objc_class_name): New. (IS_CLASS): New macro. (IS_ID, IS_SUPER): Robustify. (OCTI_EXECCLASS_DECL, execclass_decl): New. (finish_file, start_class, continue_class, finish_class, start_method_def, continue_method_def, finish_method_def, start_protocol, finish_protocol, objc_build_throw_stmt, objc_build_try_catch_finally_stmt, objc_build_synchronized_prologue, objc_build_synchronized_epilogue, objc_build_try_prologue, objc_build_try_epilogue, objc_build_catch_stmt, objc_build_catch_epilogue, objc_build_finally_prologue, objc_build_finally_epilogue, is_ivar, is_private, is_public, add_instance_variable, objc_add_method, get_super_receiver, objc_clear_super_receiver, get_class_ivars_from_name, get_class_reference, get_static_reference, get_object_reference, build_message_expr, finish_message_expr, build_selector_expr, build_ivar_reference, build_keyword_decl, build_method_decl, build_protocol_expr, build_objc_string_object, objc_declare_alias, objc_declare_class, objc_declare_protocols, objc_comptypes, objc_check_decl, build_encode_expr): Remove prototypes. (imp_count, cat_count): Make GGC-aware. (OBJC_SET_TYPE_NAME): New macro. From-SVN: r87168
2004-09-08 02:49:44 +02:00
static void build_protocol_template (void);
static tree encode_method_prototype (tree);
static void generate_classref_translation_entry (tree);
static void handle_class_ref (tree);
static void generate_struct_by_value_array (void)
ATTRIBUTE_NORETURN;
static void mark_referenced_methods (void);
static void generate_objc_image_info (void);
1992-01-18 00:15:38 +01:00
/*** Private Interface (data) ***/
1996-07-04 00:07:53 +02:00
/* Reserved tag definitions. */
1992-01-18 00:15:38 +01:00
Makefile.in (c-parse.o): Depend on $(C_COMMON_H). [gcc/ChangeLog] 2004-09-07 Ziemowit Laski <zlaski@apple.com> * Makefile.in (c-parse.o): Depend on $(C_COMMON_H). * c-parse.in: Include c-common.h instead of objc-act.h. (ivar_decl_list, ivar_decls, ivar_decl, ivars, ivar_declarator, myparms, myparm): Remove %type declarations. (methodtype, optparms, OBJC_TYPE_QUAL, objc_quals, objc_qual, objc_typename, objc_try_catch_stmt, optellipsis): Add %type declarations. (objc_inherit_code, objc_public_flag): Remove. (typespec_nonreserved_nonattr): Call objc_get_protocol_qualified_type() instead of get_static_reference() and get_protocol_reference(). (stmt_nocomp): Call grokparm() on @catch parameter. (objcdef): Move semantic action to objc_finish_implementation(). (classdef): Move semantic action to objc_start_class_interface(), objc_continue_interface(), objc_finish_interface(), objc_start_class_implementation(), objc_continue_implementation(), objc_start_category_interface() and objc_start_category_implementation(). (protocoldef): Move semantic actions to objc_start_protocol() and objc_finish_interface(). (ivar_decl_list): Remove nonterminal. (visibility_spec): Move semantic actions to objc_set_visibility(). (ivar_decls): Remove assignment to $$. (ivar_decl): Rephrase in terms of component_decl; call objc_add_instance_variable(). (ivars, ivar_declarator): Remove nonterminals. (opt_semi): New nonterminal. (methodtype): Remove semantic actions. (methoddef): Move semantic actions to objc_set_method_type(), objc_start_method_definition() and objc_finish_method_definition(). (methodproto): Move semantic actions to objc_set_method_type() and objc_add_method_declaration(). (methoddecl): Use objc_typename instead of typename; move semantic actions to objc_build_method_signature(). (optarglist, myxdecls, mydecl, myparms, myparm): Remove nonterminals. (optparmlist): Express in terms of optparms and optellipsis. (optparms, optellipsis, objc_qual, objc_quals, objc_typename): New nonterminals. (keyworddecl): Use objc_typename instead of typename. (rid_to_yy): Mark RID_IN, RID_OUT, RID_INOUT, RID_BYCOPY, RID_BYREF and RID_ONEWAY as returning OBJC_TYPE_QUAL to yyparse(). [gcc/objc/ChangeLog] 2004-09-07 Ziemowit Laski <zlaski@apple.com> * Make-lang.in (objc/objc-parse.o): Depend on $(C_COMMON_H) instead of objc/objc-act.h. (objc/objc-act.o): Depend on $(HASHTAB_H). * objc-act.c: Include hashtab.h; in ObjC++ mode, include cp-tree.h and objcp-decl.h instead of c-tree.h. (build_module_descriptor, get_class_ivars, synth_id_with_class_suffix, error_with_ivar, gen_method_decl, gen_declaration, setup_string_decl, build_protocol_template): Adjust prototypes. (build_module_initializer_routine, start_class, continue_class, finish_class, start_method_def, objc_start_function, start_protocol, build_method_decl, objc_add_method, add_instance_variable, build_ivar_reference, is_ivar, is_private, get_super_receiver, build_selector_table_decl, objc_push_parm, objc_get_parm_info, gen_type_name, gen_type_name_0, start_var_decl, finish_var_decl, create_field_decl): New prototypes. (objc_expand_function_end, comp_method_with_proto, objc_expr_last, gen_declaration_1, gen_declarator, is_complex_decl, adorn_decl, define_decl, create_builtin_decl, gen_declspecs): Remove prototypes. (TYPE_ID): Rename to OBJECT_TYPEDEF_NAME. (CLASS_TYPEDEF_NAME): New. (TAG_EXECCLASS): Change from a global variable to a #define. (TAG_RETURN_STRUCT): Delete. (TAG_GNUINIT): New, holds '__objc_gnu_init' name. (objc_inherit_code, objc_public_flag): New, moved from c-parse.in. (string_descriptor): New struct. (string_htab): New hash table. (string_hash, string_eq): New prototypes. (generate_struct_by_value_array): Call create_field_decl() instead of create_builtin_decl(). (objc_init): Do not initialize objc_ellipsis_node or TAG_EXECCLASS; In ObjC++ mode, call cxx_init() instead of c_objc_common_init(). (objc_finish_file): In ObjC++, call instantiate_pending_templates() and cp_finish_file(). (define_decl, get_static_reference, get_protocol_reference, create_builtin_decl): Remove functions. (objc_start_class_interface, objc_start_category_interface, objc_start_protocol, objc_continue_interface, objc_finish_interface, objc_start_class_implementation, objc_start_category_implementation, objc_continue_implementation, objc_finish_implementation, objc_set_visibility, objc_set_method_type, objc_build_method_signature, objc_add_method_declaration, objc_start_method_definition, objc_add_instance_variable, objc_get_protocol_qualified_type, create_field_decl, start_var_decl, finish_var_decl): New functions. (setup_string_decl): Simplify since it is only called once. (synth_module_prologue): Call build_class_template(); predefine 'id' and 'Class' as typedefs; rename 'temp_type' to 'type'; disable debug hooks for duration of function; fix GNU runtime messenger signatures to correspond to reality; forward-declare '__objc_exec_class' for the GNU runtime; call build_selector_table_decl(); in ObjC++ mode, generate 'extern "C" { ... }' wrappers around synthesized declarations; call build_protocol_template() and build_category_template(). (string_hash, string_eq): New functions. (objc_build_string_object): Check metaclass correctness only once; store string literals in hash table. (objc_build_constructor): Do not convert initializer elements; adjust for ObjC++ impedance mismatch. (build_objc_symtab_template): Call create_field_decl() instead of create_builtin_decl(). (init_objc_symtab): Add missing conversion to initializer element. (build_metadata_decl): Call start_var_decl() instead of define_decl(). (generate_objc_symtab_decl): Do not call build_category_template(); call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(). (build_module_descriptor): Call create_field_decl() instead of grokfield(); call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(); always mark module descriptor as used; move GNU runtime-specific functionality to build_module_initializer_routine(). (build_module_initializer_routine): New function, broken off of build_module_descriptor(). (objc_static_init_needed_p, objc_generate_static_init_call): New functions. (generate_static_references, generate_strings, build_selector_translation_table, generate_descriptor_table, generate_ivars_list, generate_dispatch_table, generate_category): Call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(); build a type directly instead of via groktypename(). (build_selector_reference_decl, build_selector_table_decl, build_class_reference_decl, build_protocol_reference, generate_objc_image_info): Call start_var_decl() instead of build_decl(). (build_selector_reference): For GNU runtime, do not call build_selector_reference_decl(). (build_selector, build_typed_selector_reference): Always convert result to the selector type. (add_objc_string): Cast return value to 'char *'. (build_method_prototype_template, build_selector_template, build_method_template): Use actual selector type for fields pointing to selectors. (finish_objc): For GNU runtime, call build_module_initializer_routine() after build_module_descriptor(). (generate_protocol_list, generate_shared_structures): Call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(); build a type directly instead of via groktypename(). (synth_id_with_class_suffix): Return a string. (get_arg_type_list): For instance methods, use the instance type for 'self'; do not call groktypename_in_parm_context(). (build_objc_string_decl): Squash redeclaration errors in ObjC++. (objc_is_class_name): Use OBJC_TYPE_NAME instead of TYPE_NAME; handle RECORD_TYPEs in ObjC as well as ObjC++. (objc_is_id): New function. (objc_is_object_ptr): Return the canonical type node. (objc_get_class_ivars): Simplify using get_class_ivars(). (get_class_ivars): Remove second parameter; create a fresh copy of the ivar list for each call; do not check for existence of super class. (objc_eh_runtime_type): Mark #ifndef OBJCPLUS. (objc_init_exceptions): When using SJLJ-style exceptions, require the use of '-fobjc-exceptions' flag; do not require it for DWARF-style exceptions. (objc_build_exc_ptr, next_sjlj_build_try_catch_finally): Use objc_object_type instead of objc_id_type. (objc_begin_catch_clause): Convert the incoming PARM_DECL into a VAR_DECL before placing it in the appropriate scope; do not call define_decl(); adjust call to c_begin_compound_stmt(); use objc_object_type instead of objc_id_type. (build_next_objc_exception_stuff): Call create_field_decl() instead of create_builtin_decl(); construct type directly instead of calling groktypename(); use OBJC_VOID_AT_END to mark end of function parameters. (build_private_template): Adjust call to get_class_ivars(); build a type directly instead of via groktypename(). (build_protocol_template, build_method_prototype_list_template, build_method_prototype_template, build_category_template, build_selector_template, build_class_template, build_super_template, build_ivar_template, build_ivar_list_template, build_method_list_template, build_method_template): Call create_field_decl() instead of grokfield(). (objc_method_parm_type): Do not call groktypename(). (generate_descriptor_table): Call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(). (generate_method_descriptors, build_protocol_initializer, generate_dispatch_tables, build_category_initializer, build_shared_structure_initializer): Do not call groktypename(). (generate_protocols): Call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(); do not call groktypename(). (error_with_ivar): Remove last parameter. (check_ivars): Do not iterate ovar CLASS_RAW_IVARS lists in addition to CLASS_IVARS lists; adjust calls to error_with_ivar(). (generate_ivar_lists): Convert one of the initializer elements; do not call groktypename(). (get_arg_type_list, start_method_def, gen_method_def): Account for new representation of variable arguments and '...' in Objective-C methods; add Objective-C++ impedance matching code. (is_objc_type_qualifier): Remove function. (adjust_type_for_id_default): Simplify; there is no longer a need to wade through declspecs. (lookup_interface, start_class, continue_class, finish_class, start_method_def, start_protocol, build_method_decl, objc_add_method, add_instance_variable, build_ivar_reference, is_ivar, is_private, get_super_receiver, objc_build_finally_epilogue): Make into static functions. (receiver_is_class_object): Use new IS_CLASS() macro. (objc_build_message_expr): Tweak ObjC++ message argument handling; call objc_finish_message_expr() instead of finish_message_expr(). (finish_message_expr): Rename to objc_finish_message_expr(); use OBJC_TYPE_NAME and OBJC_SET_TYPE_NAME macros instead of TYPE_NAME. call gen_type_name() instead of gen_declaration(); call objc_is_id() instead of using IS_ID and IS_CLASS; Use objc_class_name instead of calling get_identifier("Class"); handle CONVERT_EXPRs in receiver. (build_objc_method_call, warn_with_method): Do not call groktypename(). (build_ivar_reference): Call convert() instead of clobbering in a type. (hash_init): Initialize string_htab hash table. (add_instance_variable): Simplify parameter list; do not call grokfield(); do not populate CLASS_IVARS list. (start_class): Check for the existence of super class, if one was specified. (continue_class): Use CLASS_RAW_IVARS rather than CLASS_IVARS; do not call build_class_template(); adjust call to get_class_ivars(); call build_decl(), pushdecl() and finish_decl() instead of define_decl(). (finish_class): Call build_decl(), pushdecl() and finish_decl() instead of define_decl(). (add_protocols): Use PROTOCOL_BINFO_ELTS for the tree vector size. (start_protocol): Do not call build_protocol_template(); use PROTOCOL_BINFO_ELTS for the tree vector size. (encode_type_qualifiers): Do not handle the 'const' qualifier here. (encode_pointer): Encode 'const char *' as 'r*', for backwards compatibility. (encode_array): Use HOST_WIDE_INT_PRINT_DEC instead of "%ld". (encode_type): Handle the 'const' qualifier here. (objc_parmlist): New global variable, sued by objc_push_parm and objc_get_parm_info(). (objc_push_parm, objc_get_parm_info): New functions. (objc_expr_last): Remove function. (synth_self_and_ucmd_args): For instance methods, use the instance type for 'self'; call objc_push_parm() instead of push_parm_decl(). (start_method_def): Do not call push_scope(), declare_parm_level(), pop_scope(), push_parm_decl(), store_parm_decls() or objc_expr_last(); just use objc_push_parm() and objc_get_parm_info(). (comp_method_with_proto): Remove function. (objc_types_are_equivalent): Strip away indirections before comparing underlying types. (comp_proto_with_proto): Do not call groktypename(); types are no longer in raw declspec format. (objc_start_function): New function. (really_start_method): Call comp_proto_with_proto() instead of comp_method_with_proto(); call objc_start_function() instead of hand-crafting a function declarator. (continue_method_def, objc_expand_function_end): Remove functions. (get_super_receiver): Call objc_get_current_scope() instead of get_current_scope(); reference 'super_class' field (instead of 'class'). (finish_method_def): Rename to objc_finish_method_definition() and add a function decl parameter; move method encoding call from objc_expand_function_end(). (is_complex_decl, adorn_decl, gen_declarator, gen_declspecs, gen_declaration_1): Remove functions. (tmpbuf, RAW_DECLSPEC): Remove. (gen_declaration): Remove second parameter; simplify to deal with TYPE_P nodes instead of raw declspecs. (gen_type_name, gen_type_name_0): New functions. (gen_method_decl): Remove second parameter; call gen_type_name() instead of gen_declaration_1(). (dump_interface): Adjust calls to gen_declaration() and gen_method_decl(); do not allocate a separate string buffer. (init_objc): Allocate a larger string buffer to accommodate dump_interface(); adjust call to build_module_descriptor(); add call to build_module_initializer_routine() for the GNU runtime. (generate_classref_translation_entry): Do not call start_decl(); call finish_var_decl() instead of finish_decl(); call convert() instead of build_c_cast(). * objc-act.h (CLASS_OWN_IVARS): Remove accessor. (CLASS_BINFO_ELTS): Reduce from 6 to 5, now that CLASS_OWN_IVARS is gone. (OCTI_GNU_INIT_DECL, GNU_INIT_decl): New. (OCTI_ELLIPSIS_NODE, objc_ellipsis_node): Remove. (OCTI_ID_ID, id_type, objc_id_id): Rename to OCTI_ID_NAME, objc_object_type and objc_object_name, respectively. (OCTI_CLS_REF, OCTI_CLASS_NAME, objc_class_reference, objc_class_name): New. (IS_CLASS): New macro. (IS_ID, IS_SUPER): Robustify. (OCTI_EXECCLASS_DECL, execclass_decl): New. (finish_file, start_class, continue_class, finish_class, start_method_def, continue_method_def, finish_method_def, start_protocol, finish_protocol, objc_build_throw_stmt, objc_build_try_catch_finally_stmt, objc_build_synchronized_prologue, objc_build_synchronized_epilogue, objc_build_try_prologue, objc_build_try_epilogue, objc_build_catch_stmt, objc_build_catch_epilogue, objc_build_finally_prologue, objc_build_finally_epilogue, is_ivar, is_private, is_public, add_instance_variable, objc_add_method, get_super_receiver, objc_clear_super_receiver, get_class_ivars_from_name, get_class_reference, get_static_reference, get_object_reference, build_message_expr, finish_message_expr, build_selector_expr, build_ivar_reference, build_keyword_decl, build_method_decl, build_protocol_expr, build_objc_string_object, objc_declare_alias, objc_declare_class, objc_declare_protocols, objc_comptypes, objc_check_decl, build_encode_expr): Remove prototypes. (imp_count, cat_count): Make GGC-aware. (OBJC_SET_TYPE_NAME): New macro. From-SVN: r87168
2004-09-08 02:49:44 +02:00
#define OBJECT_TYPEDEF_NAME "id"
#define CLASS_TYPEDEF_NAME "Class"
#define TAG_OBJECT "objc_object"
#define TAG_CLASS "objc_class"
#define TAG_SUPER "objc_super"
#define TAG_SELECTOR "objc_selector"
#define UTAG_CLASS "_objc_class"
#define UTAG_IVAR "_objc_ivar"
#define UTAG_IVAR_LIST "_objc_ivar_list"
#define UTAG_METHOD "_objc_method"
#define UTAG_METHOD_LIST "_objc_method_list"
#define UTAG_CATEGORY "_objc_category"
#define UTAG_MODULE "_objc_module"
#define UTAG_SYMTAB "_objc_symtab"
#define UTAG_SUPER "_objc_super"
#define UTAG_SELECTOR "_objc_selector"
#define UTAG_PROTOCOL "_objc_protocol"
#define UTAG_METHOD_PROTOTYPE "_objc_method_prototype"
#define UTAG_METHOD_PROTOTYPE_LIST "_objc__method_prototype_list"
/* Note that the string object global name is only needed for the
NeXT runtime. */
Makefile.in (c-parse.o): Depend on $(C_COMMON_H). [gcc/ChangeLog] 2004-09-07 Ziemowit Laski <zlaski@apple.com> * Makefile.in (c-parse.o): Depend on $(C_COMMON_H). * c-parse.in: Include c-common.h instead of objc-act.h. (ivar_decl_list, ivar_decls, ivar_decl, ivars, ivar_declarator, myparms, myparm): Remove %type declarations. (methodtype, optparms, OBJC_TYPE_QUAL, objc_quals, objc_qual, objc_typename, objc_try_catch_stmt, optellipsis): Add %type declarations. (objc_inherit_code, objc_public_flag): Remove. (typespec_nonreserved_nonattr): Call objc_get_protocol_qualified_type() instead of get_static_reference() and get_protocol_reference(). (stmt_nocomp): Call grokparm() on @catch parameter. (objcdef): Move semantic action to objc_finish_implementation(). (classdef): Move semantic action to objc_start_class_interface(), objc_continue_interface(), objc_finish_interface(), objc_start_class_implementation(), objc_continue_implementation(), objc_start_category_interface() and objc_start_category_implementation(). (protocoldef): Move semantic actions to objc_start_protocol() and objc_finish_interface(). (ivar_decl_list): Remove nonterminal. (visibility_spec): Move semantic actions to objc_set_visibility(). (ivar_decls): Remove assignment to $$. (ivar_decl): Rephrase in terms of component_decl; call objc_add_instance_variable(). (ivars, ivar_declarator): Remove nonterminals. (opt_semi): New nonterminal. (methodtype): Remove semantic actions. (methoddef): Move semantic actions to objc_set_method_type(), objc_start_method_definition() and objc_finish_method_definition(). (methodproto): Move semantic actions to objc_set_method_type() and objc_add_method_declaration(). (methoddecl): Use objc_typename instead of typename; move semantic actions to objc_build_method_signature(). (optarglist, myxdecls, mydecl, myparms, myparm): Remove nonterminals. (optparmlist): Express in terms of optparms and optellipsis. (optparms, optellipsis, objc_qual, objc_quals, objc_typename): New nonterminals. (keyworddecl): Use objc_typename instead of typename. (rid_to_yy): Mark RID_IN, RID_OUT, RID_INOUT, RID_BYCOPY, RID_BYREF and RID_ONEWAY as returning OBJC_TYPE_QUAL to yyparse(). [gcc/objc/ChangeLog] 2004-09-07 Ziemowit Laski <zlaski@apple.com> * Make-lang.in (objc/objc-parse.o): Depend on $(C_COMMON_H) instead of objc/objc-act.h. (objc/objc-act.o): Depend on $(HASHTAB_H). * objc-act.c: Include hashtab.h; in ObjC++ mode, include cp-tree.h and objcp-decl.h instead of c-tree.h. (build_module_descriptor, get_class_ivars, synth_id_with_class_suffix, error_with_ivar, gen_method_decl, gen_declaration, setup_string_decl, build_protocol_template): Adjust prototypes. (build_module_initializer_routine, start_class, continue_class, finish_class, start_method_def, objc_start_function, start_protocol, build_method_decl, objc_add_method, add_instance_variable, build_ivar_reference, is_ivar, is_private, get_super_receiver, build_selector_table_decl, objc_push_parm, objc_get_parm_info, gen_type_name, gen_type_name_0, start_var_decl, finish_var_decl, create_field_decl): New prototypes. (objc_expand_function_end, comp_method_with_proto, objc_expr_last, gen_declaration_1, gen_declarator, is_complex_decl, adorn_decl, define_decl, create_builtin_decl, gen_declspecs): Remove prototypes. (TYPE_ID): Rename to OBJECT_TYPEDEF_NAME. (CLASS_TYPEDEF_NAME): New. (TAG_EXECCLASS): Change from a global variable to a #define. (TAG_RETURN_STRUCT): Delete. (TAG_GNUINIT): New, holds '__objc_gnu_init' name. (objc_inherit_code, objc_public_flag): New, moved from c-parse.in. (string_descriptor): New struct. (string_htab): New hash table. (string_hash, string_eq): New prototypes. (generate_struct_by_value_array): Call create_field_decl() instead of create_builtin_decl(). (objc_init): Do not initialize objc_ellipsis_node or TAG_EXECCLASS; In ObjC++ mode, call cxx_init() instead of c_objc_common_init(). (objc_finish_file): In ObjC++, call instantiate_pending_templates() and cp_finish_file(). (define_decl, get_static_reference, get_protocol_reference, create_builtin_decl): Remove functions. (objc_start_class_interface, objc_start_category_interface, objc_start_protocol, objc_continue_interface, objc_finish_interface, objc_start_class_implementation, objc_start_category_implementation, objc_continue_implementation, objc_finish_implementation, objc_set_visibility, objc_set_method_type, objc_build_method_signature, objc_add_method_declaration, objc_start_method_definition, objc_add_instance_variable, objc_get_protocol_qualified_type, create_field_decl, start_var_decl, finish_var_decl): New functions. (setup_string_decl): Simplify since it is only called once. (synth_module_prologue): Call build_class_template(); predefine 'id' and 'Class' as typedefs; rename 'temp_type' to 'type'; disable debug hooks for duration of function; fix GNU runtime messenger signatures to correspond to reality; forward-declare '__objc_exec_class' for the GNU runtime; call build_selector_table_decl(); in ObjC++ mode, generate 'extern "C" { ... }' wrappers around synthesized declarations; call build_protocol_template() and build_category_template(). (string_hash, string_eq): New functions. (objc_build_string_object): Check metaclass correctness only once; store string literals in hash table. (objc_build_constructor): Do not convert initializer elements; adjust for ObjC++ impedance mismatch. (build_objc_symtab_template): Call create_field_decl() instead of create_builtin_decl(). (init_objc_symtab): Add missing conversion to initializer element. (build_metadata_decl): Call start_var_decl() instead of define_decl(). (generate_objc_symtab_decl): Do not call build_category_template(); call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(). (build_module_descriptor): Call create_field_decl() instead of grokfield(); call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(); always mark module descriptor as used; move GNU runtime-specific functionality to build_module_initializer_routine(). (build_module_initializer_routine): New function, broken off of build_module_descriptor(). (objc_static_init_needed_p, objc_generate_static_init_call): New functions. (generate_static_references, generate_strings, build_selector_translation_table, generate_descriptor_table, generate_ivars_list, generate_dispatch_table, generate_category): Call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(); build a type directly instead of via groktypename(). (build_selector_reference_decl, build_selector_table_decl, build_class_reference_decl, build_protocol_reference, generate_objc_image_info): Call start_var_decl() instead of build_decl(). (build_selector_reference): For GNU runtime, do not call build_selector_reference_decl(). (build_selector, build_typed_selector_reference): Always convert result to the selector type. (add_objc_string): Cast return value to 'char *'. (build_method_prototype_template, build_selector_template, build_method_template): Use actual selector type for fields pointing to selectors. (finish_objc): For GNU runtime, call build_module_initializer_routine() after build_module_descriptor(). (generate_protocol_list, generate_shared_structures): Call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(); build a type directly instead of via groktypename(). (synth_id_with_class_suffix): Return a string. (get_arg_type_list): For instance methods, use the instance type for 'self'; do not call groktypename_in_parm_context(). (build_objc_string_decl): Squash redeclaration errors in ObjC++. (objc_is_class_name): Use OBJC_TYPE_NAME instead of TYPE_NAME; handle RECORD_TYPEs in ObjC as well as ObjC++. (objc_is_id): New function. (objc_is_object_ptr): Return the canonical type node. (objc_get_class_ivars): Simplify using get_class_ivars(). (get_class_ivars): Remove second parameter; create a fresh copy of the ivar list for each call; do not check for existence of super class. (objc_eh_runtime_type): Mark #ifndef OBJCPLUS. (objc_init_exceptions): When using SJLJ-style exceptions, require the use of '-fobjc-exceptions' flag; do not require it for DWARF-style exceptions. (objc_build_exc_ptr, next_sjlj_build_try_catch_finally): Use objc_object_type instead of objc_id_type. (objc_begin_catch_clause): Convert the incoming PARM_DECL into a VAR_DECL before placing it in the appropriate scope; do not call define_decl(); adjust call to c_begin_compound_stmt(); use objc_object_type instead of objc_id_type. (build_next_objc_exception_stuff): Call create_field_decl() instead of create_builtin_decl(); construct type directly instead of calling groktypename(); use OBJC_VOID_AT_END to mark end of function parameters. (build_private_template): Adjust call to get_class_ivars(); build a type directly instead of via groktypename(). (build_protocol_template, build_method_prototype_list_template, build_method_prototype_template, build_category_template, build_selector_template, build_class_template, build_super_template, build_ivar_template, build_ivar_list_template, build_method_list_template, build_method_template): Call create_field_decl() instead of grokfield(). (objc_method_parm_type): Do not call groktypename(). (generate_descriptor_table): Call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(). (generate_method_descriptors, build_protocol_initializer, generate_dispatch_tables, build_category_initializer, build_shared_structure_initializer): Do not call groktypename(). (generate_protocols): Call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(); do not call groktypename(). (error_with_ivar): Remove last parameter. (check_ivars): Do not iterate ovar CLASS_RAW_IVARS lists in addition to CLASS_IVARS lists; adjust calls to error_with_ivar(). (generate_ivar_lists): Convert one of the initializer elements; do not call groktypename(). (get_arg_type_list, start_method_def, gen_method_def): Account for new representation of variable arguments and '...' in Objective-C methods; add Objective-C++ impedance matching code. (is_objc_type_qualifier): Remove function. (adjust_type_for_id_default): Simplify; there is no longer a need to wade through declspecs. (lookup_interface, start_class, continue_class, finish_class, start_method_def, start_protocol, build_method_decl, objc_add_method, add_instance_variable, build_ivar_reference, is_ivar, is_private, get_super_receiver, objc_build_finally_epilogue): Make into static functions. (receiver_is_class_object): Use new IS_CLASS() macro. (objc_build_message_expr): Tweak ObjC++ message argument handling; call objc_finish_message_expr() instead of finish_message_expr(). (finish_message_expr): Rename to objc_finish_message_expr(); use OBJC_TYPE_NAME and OBJC_SET_TYPE_NAME macros instead of TYPE_NAME. call gen_type_name() instead of gen_declaration(); call objc_is_id() instead of using IS_ID and IS_CLASS; Use objc_class_name instead of calling get_identifier("Class"); handle CONVERT_EXPRs in receiver. (build_objc_method_call, warn_with_method): Do not call groktypename(). (build_ivar_reference): Call convert() instead of clobbering in a type. (hash_init): Initialize string_htab hash table. (add_instance_variable): Simplify parameter list; do not call grokfield(); do not populate CLASS_IVARS list. (start_class): Check for the existence of super class, if one was specified. (continue_class): Use CLASS_RAW_IVARS rather than CLASS_IVARS; do not call build_class_template(); adjust call to get_class_ivars(); call build_decl(), pushdecl() and finish_decl() instead of define_decl(). (finish_class): Call build_decl(), pushdecl() and finish_decl() instead of define_decl(). (add_protocols): Use PROTOCOL_BINFO_ELTS for the tree vector size. (start_protocol): Do not call build_protocol_template(); use PROTOCOL_BINFO_ELTS for the tree vector size. (encode_type_qualifiers): Do not handle the 'const' qualifier here. (encode_pointer): Encode 'const char *' as 'r*', for backwards compatibility. (encode_array): Use HOST_WIDE_INT_PRINT_DEC instead of "%ld". (encode_type): Handle the 'const' qualifier here. (objc_parmlist): New global variable, sued by objc_push_parm and objc_get_parm_info(). (objc_push_parm, objc_get_parm_info): New functions. (objc_expr_last): Remove function. (synth_self_and_ucmd_args): For instance methods, use the instance type for 'self'; call objc_push_parm() instead of push_parm_decl(). (start_method_def): Do not call push_scope(), declare_parm_level(), pop_scope(), push_parm_decl(), store_parm_decls() or objc_expr_last(); just use objc_push_parm() and objc_get_parm_info(). (comp_method_with_proto): Remove function. (objc_types_are_equivalent): Strip away indirections before comparing underlying types. (comp_proto_with_proto): Do not call groktypename(); types are no longer in raw declspec format. (objc_start_function): New function. (really_start_method): Call comp_proto_with_proto() instead of comp_method_with_proto(); call objc_start_function() instead of hand-crafting a function declarator. (continue_method_def, objc_expand_function_end): Remove functions. (get_super_receiver): Call objc_get_current_scope() instead of get_current_scope(); reference 'super_class' field (instead of 'class'). (finish_method_def): Rename to objc_finish_method_definition() and add a function decl parameter; move method encoding call from objc_expand_function_end(). (is_complex_decl, adorn_decl, gen_declarator, gen_declspecs, gen_declaration_1): Remove functions. (tmpbuf, RAW_DECLSPEC): Remove. (gen_declaration): Remove second parameter; simplify to deal with TYPE_P nodes instead of raw declspecs. (gen_type_name, gen_type_name_0): New functions. (gen_method_decl): Remove second parameter; call gen_type_name() instead of gen_declaration_1(). (dump_interface): Adjust calls to gen_declaration() and gen_method_decl(); do not allocate a separate string buffer. (init_objc): Allocate a larger string buffer to accommodate dump_interface(); adjust call to build_module_descriptor(); add call to build_module_initializer_routine() for the GNU runtime. (generate_classref_translation_entry): Do not call start_decl(); call finish_var_decl() instead of finish_decl(); call convert() instead of build_c_cast(). * objc-act.h (CLASS_OWN_IVARS): Remove accessor. (CLASS_BINFO_ELTS): Reduce from 6 to 5, now that CLASS_OWN_IVARS is gone. (OCTI_GNU_INIT_DECL, GNU_INIT_decl): New. (OCTI_ELLIPSIS_NODE, objc_ellipsis_node): Remove. (OCTI_ID_ID, id_type, objc_id_id): Rename to OCTI_ID_NAME, objc_object_type and objc_object_name, respectively. (OCTI_CLS_REF, OCTI_CLASS_NAME, objc_class_reference, objc_class_name): New. (IS_CLASS): New macro. (IS_ID, IS_SUPER): Robustify. (OCTI_EXECCLASS_DECL, execclass_decl): New. (finish_file, start_class, continue_class, finish_class, start_method_def, continue_method_def, finish_method_def, start_protocol, finish_protocol, objc_build_throw_stmt, objc_build_try_catch_finally_stmt, objc_build_synchronized_prologue, objc_build_synchronized_epilogue, objc_build_try_prologue, objc_build_try_epilogue, objc_build_catch_stmt, objc_build_catch_epilogue, objc_build_finally_prologue, objc_build_finally_epilogue, is_ivar, is_private, is_public, add_instance_variable, objc_add_method, get_super_receiver, objc_clear_super_receiver, get_class_ivars_from_name, get_class_reference, get_static_reference, get_object_reference, build_message_expr, finish_message_expr, build_selector_expr, build_ivar_reference, build_keyword_decl, build_method_decl, build_protocol_expr, build_objc_string_object, objc_declare_alias, objc_declare_class, objc_declare_protocols, objc_comptypes, objc_check_decl, build_encode_expr): Remove prototypes. (imp_count, cat_count): Make GGC-aware. (OBJC_SET_TYPE_NAME): New macro. From-SVN: r87168
2004-09-08 02:49:44 +02:00
#define STRING_OBJECT_GLOBAL_FORMAT "_%sClassReference"
Makefile.in (c-parse.o): Depend on $(C_COMMON_H). [gcc/ChangeLog] 2004-09-07 Ziemowit Laski <zlaski@apple.com> * Makefile.in (c-parse.o): Depend on $(C_COMMON_H). * c-parse.in: Include c-common.h instead of objc-act.h. (ivar_decl_list, ivar_decls, ivar_decl, ivars, ivar_declarator, myparms, myparm): Remove %type declarations. (methodtype, optparms, OBJC_TYPE_QUAL, objc_quals, objc_qual, objc_typename, objc_try_catch_stmt, optellipsis): Add %type declarations. (objc_inherit_code, objc_public_flag): Remove. (typespec_nonreserved_nonattr): Call objc_get_protocol_qualified_type() instead of get_static_reference() and get_protocol_reference(). (stmt_nocomp): Call grokparm() on @catch parameter. (objcdef): Move semantic action to objc_finish_implementation(). (classdef): Move semantic action to objc_start_class_interface(), objc_continue_interface(), objc_finish_interface(), objc_start_class_implementation(), objc_continue_implementation(), objc_start_category_interface() and objc_start_category_implementation(). (protocoldef): Move semantic actions to objc_start_protocol() and objc_finish_interface(). (ivar_decl_list): Remove nonterminal. (visibility_spec): Move semantic actions to objc_set_visibility(). (ivar_decls): Remove assignment to $$. (ivar_decl): Rephrase in terms of component_decl; call objc_add_instance_variable(). (ivars, ivar_declarator): Remove nonterminals. (opt_semi): New nonterminal. (methodtype): Remove semantic actions. (methoddef): Move semantic actions to objc_set_method_type(), objc_start_method_definition() and objc_finish_method_definition(). (methodproto): Move semantic actions to objc_set_method_type() and objc_add_method_declaration(). (methoddecl): Use objc_typename instead of typename; move semantic actions to objc_build_method_signature(). (optarglist, myxdecls, mydecl, myparms, myparm): Remove nonterminals. (optparmlist): Express in terms of optparms and optellipsis. (optparms, optellipsis, objc_qual, objc_quals, objc_typename): New nonterminals. (keyworddecl): Use objc_typename instead of typename. (rid_to_yy): Mark RID_IN, RID_OUT, RID_INOUT, RID_BYCOPY, RID_BYREF and RID_ONEWAY as returning OBJC_TYPE_QUAL to yyparse(). [gcc/objc/ChangeLog] 2004-09-07 Ziemowit Laski <zlaski@apple.com> * Make-lang.in (objc/objc-parse.o): Depend on $(C_COMMON_H) instead of objc/objc-act.h. (objc/objc-act.o): Depend on $(HASHTAB_H). * objc-act.c: Include hashtab.h; in ObjC++ mode, include cp-tree.h and objcp-decl.h instead of c-tree.h. (build_module_descriptor, get_class_ivars, synth_id_with_class_suffix, error_with_ivar, gen_method_decl, gen_declaration, setup_string_decl, build_protocol_template): Adjust prototypes. (build_module_initializer_routine, start_class, continue_class, finish_class, start_method_def, objc_start_function, start_protocol, build_method_decl, objc_add_method, add_instance_variable, build_ivar_reference, is_ivar, is_private, get_super_receiver, build_selector_table_decl, objc_push_parm, objc_get_parm_info, gen_type_name, gen_type_name_0, start_var_decl, finish_var_decl, create_field_decl): New prototypes. (objc_expand_function_end, comp_method_with_proto, objc_expr_last, gen_declaration_1, gen_declarator, is_complex_decl, adorn_decl, define_decl, create_builtin_decl, gen_declspecs): Remove prototypes. (TYPE_ID): Rename to OBJECT_TYPEDEF_NAME. (CLASS_TYPEDEF_NAME): New. (TAG_EXECCLASS): Change from a global variable to a #define. (TAG_RETURN_STRUCT): Delete. (TAG_GNUINIT): New, holds '__objc_gnu_init' name. (objc_inherit_code, objc_public_flag): New, moved from c-parse.in. (string_descriptor): New struct. (string_htab): New hash table. (string_hash, string_eq): New prototypes. (generate_struct_by_value_array): Call create_field_decl() instead of create_builtin_decl(). (objc_init): Do not initialize objc_ellipsis_node or TAG_EXECCLASS; In ObjC++ mode, call cxx_init() instead of c_objc_common_init(). (objc_finish_file): In ObjC++, call instantiate_pending_templates() and cp_finish_file(). (define_decl, get_static_reference, get_protocol_reference, create_builtin_decl): Remove functions. (objc_start_class_interface, objc_start_category_interface, objc_start_protocol, objc_continue_interface, objc_finish_interface, objc_start_class_implementation, objc_start_category_implementation, objc_continue_implementation, objc_finish_implementation, objc_set_visibility, objc_set_method_type, objc_build_method_signature, objc_add_method_declaration, objc_start_method_definition, objc_add_instance_variable, objc_get_protocol_qualified_type, create_field_decl, start_var_decl, finish_var_decl): New functions. (setup_string_decl): Simplify since it is only called once. (synth_module_prologue): Call build_class_template(); predefine 'id' and 'Class' as typedefs; rename 'temp_type' to 'type'; disable debug hooks for duration of function; fix GNU runtime messenger signatures to correspond to reality; forward-declare '__objc_exec_class' for the GNU runtime; call build_selector_table_decl(); in ObjC++ mode, generate 'extern "C" { ... }' wrappers around synthesized declarations; call build_protocol_template() and build_category_template(). (string_hash, string_eq): New functions. (objc_build_string_object): Check metaclass correctness only once; store string literals in hash table. (objc_build_constructor): Do not convert initializer elements; adjust for ObjC++ impedance mismatch. (build_objc_symtab_template): Call create_field_decl() instead of create_builtin_decl(). (init_objc_symtab): Add missing conversion to initializer element. (build_metadata_decl): Call start_var_decl() instead of define_decl(). (generate_objc_symtab_decl): Do not call build_category_template(); call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(). (build_module_descriptor): Call create_field_decl() instead of grokfield(); call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(); always mark module descriptor as used; move GNU runtime-specific functionality to build_module_initializer_routine(). (build_module_initializer_routine): New function, broken off of build_module_descriptor(). (objc_static_init_needed_p, objc_generate_static_init_call): New functions. (generate_static_references, generate_strings, build_selector_translation_table, generate_descriptor_table, generate_ivars_list, generate_dispatch_table, generate_category): Call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(); build a type directly instead of via groktypename(). (build_selector_reference_decl, build_selector_table_decl, build_class_reference_decl, build_protocol_reference, generate_objc_image_info): Call start_var_decl() instead of build_decl(). (build_selector_reference): For GNU runtime, do not call build_selector_reference_decl(). (build_selector, build_typed_selector_reference): Always convert result to the selector type. (add_objc_string): Cast return value to 'char *'. (build_method_prototype_template, build_selector_template, build_method_template): Use actual selector type for fields pointing to selectors. (finish_objc): For GNU runtime, call build_module_initializer_routine() after build_module_descriptor(). (generate_protocol_list, generate_shared_structures): Call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(); build a type directly instead of via groktypename(). (synth_id_with_class_suffix): Return a string. (get_arg_type_list): For instance methods, use the instance type for 'self'; do not call groktypename_in_parm_context(). (build_objc_string_decl): Squash redeclaration errors in ObjC++. (objc_is_class_name): Use OBJC_TYPE_NAME instead of TYPE_NAME; handle RECORD_TYPEs in ObjC as well as ObjC++. (objc_is_id): New function. (objc_is_object_ptr): Return the canonical type node. (objc_get_class_ivars): Simplify using get_class_ivars(). (get_class_ivars): Remove second parameter; create a fresh copy of the ivar list for each call; do not check for existence of super class. (objc_eh_runtime_type): Mark #ifndef OBJCPLUS. (objc_init_exceptions): When using SJLJ-style exceptions, require the use of '-fobjc-exceptions' flag; do not require it for DWARF-style exceptions. (objc_build_exc_ptr, next_sjlj_build_try_catch_finally): Use objc_object_type instead of objc_id_type. (objc_begin_catch_clause): Convert the incoming PARM_DECL into a VAR_DECL before placing it in the appropriate scope; do not call define_decl(); adjust call to c_begin_compound_stmt(); use objc_object_type instead of objc_id_type. (build_next_objc_exception_stuff): Call create_field_decl() instead of create_builtin_decl(); construct type directly instead of calling groktypename(); use OBJC_VOID_AT_END to mark end of function parameters. (build_private_template): Adjust call to get_class_ivars(); build a type directly instead of via groktypename(). (build_protocol_template, build_method_prototype_list_template, build_method_prototype_template, build_category_template, build_selector_template, build_class_template, build_super_template, build_ivar_template, build_ivar_list_template, build_method_list_template, build_method_template): Call create_field_decl() instead of grokfield(). (objc_method_parm_type): Do not call groktypename(). (generate_descriptor_table): Call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(). (generate_method_descriptors, build_protocol_initializer, generate_dispatch_tables, build_category_initializer, build_shared_structure_initializer): Do not call groktypename(). (generate_protocols): Call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(); do not call groktypename(). (error_with_ivar): Remove last parameter. (check_ivars): Do not iterate ovar CLASS_RAW_IVARS lists in addition to CLASS_IVARS lists; adjust calls to error_with_ivar(). (generate_ivar_lists): Convert one of the initializer elements; do not call groktypename(). (get_arg_type_list, start_method_def, gen_method_def): Account for new representation of variable arguments and '...' in Objective-C methods; add Objective-C++ impedance matching code. (is_objc_type_qualifier): Remove function. (adjust_type_for_id_default): Simplify; there is no longer a need to wade through declspecs. (lookup_interface, start_class, continue_class, finish_class, start_method_def, start_protocol, build_method_decl, objc_add_method, add_instance_variable, build_ivar_reference, is_ivar, is_private, get_super_receiver, objc_build_finally_epilogue): Make into static functions. (receiver_is_class_object): Use new IS_CLASS() macro. (objc_build_message_expr): Tweak ObjC++ message argument handling; call objc_finish_message_expr() instead of finish_message_expr(). (finish_message_expr): Rename to objc_finish_message_expr(); use OBJC_TYPE_NAME and OBJC_SET_TYPE_NAME macros instead of TYPE_NAME. call gen_type_name() instead of gen_declaration(); call objc_is_id() instead of using IS_ID and IS_CLASS; Use objc_class_name instead of calling get_identifier("Class"); handle CONVERT_EXPRs in receiver. (build_objc_method_call, warn_with_method): Do not call groktypename(). (build_ivar_reference): Call convert() instead of clobbering in a type. (hash_init): Initialize string_htab hash table. (add_instance_variable): Simplify parameter list; do not call grokfield(); do not populate CLASS_IVARS list. (start_class): Check for the existence of super class, if one was specified. (continue_class): Use CLASS_RAW_IVARS rather than CLASS_IVARS; do not call build_class_template(); adjust call to get_class_ivars(); call build_decl(), pushdecl() and finish_decl() instead of define_decl(). (finish_class): Call build_decl(), pushdecl() and finish_decl() instead of define_decl(). (add_protocols): Use PROTOCOL_BINFO_ELTS for the tree vector size. (start_protocol): Do not call build_protocol_template(); use PROTOCOL_BINFO_ELTS for the tree vector size. (encode_type_qualifiers): Do not handle the 'const' qualifier here. (encode_pointer): Encode 'const char *' as 'r*', for backwards compatibility. (encode_array): Use HOST_WIDE_INT_PRINT_DEC instead of "%ld". (encode_type): Handle the 'const' qualifier here. (objc_parmlist): New global variable, sued by objc_push_parm and objc_get_parm_info(). (objc_push_parm, objc_get_parm_info): New functions. (objc_expr_last): Remove function. (synth_self_and_ucmd_args): For instance methods, use the instance type for 'self'; call objc_push_parm() instead of push_parm_decl(). (start_method_def): Do not call push_scope(), declare_parm_level(), pop_scope(), push_parm_decl(), store_parm_decls() or objc_expr_last(); just use objc_push_parm() and objc_get_parm_info(). (comp_method_with_proto): Remove function. (objc_types_are_equivalent): Strip away indirections before comparing underlying types. (comp_proto_with_proto): Do not call groktypename(); types are no longer in raw declspec format. (objc_start_function): New function. (really_start_method): Call comp_proto_with_proto() instead of comp_method_with_proto(); call objc_start_function() instead of hand-crafting a function declarator. (continue_method_def, objc_expand_function_end): Remove functions. (get_super_receiver): Call objc_get_current_scope() instead of get_current_scope(); reference 'super_class' field (instead of 'class'). (finish_method_def): Rename to objc_finish_method_definition() and add a function decl parameter; move method encoding call from objc_expand_function_end(). (is_complex_decl, adorn_decl, gen_declarator, gen_declspecs, gen_declaration_1): Remove functions. (tmpbuf, RAW_DECLSPEC): Remove. (gen_declaration): Remove second parameter; simplify to deal with TYPE_P nodes instead of raw declspecs. (gen_type_name, gen_type_name_0): New functions. (gen_method_decl): Remove second parameter; call gen_type_name() instead of gen_declaration_1(). (dump_interface): Adjust calls to gen_declaration() and gen_method_decl(); do not allocate a separate string buffer. (init_objc): Allocate a larger string buffer to accommodate dump_interface(); adjust call to build_module_descriptor(); add call to build_module_initializer_routine() for the GNU runtime. (generate_classref_translation_entry): Do not call start_decl(); call finish_var_decl() instead of finish_decl(); call convert() instead of build_c_cast(). * objc-act.h (CLASS_OWN_IVARS): Remove accessor. (CLASS_BINFO_ELTS): Reduce from 6 to 5, now that CLASS_OWN_IVARS is gone. (OCTI_GNU_INIT_DECL, GNU_INIT_decl): New. (OCTI_ELLIPSIS_NODE, objc_ellipsis_node): Remove. (OCTI_ID_ID, id_type, objc_id_id): Rename to OCTI_ID_NAME, objc_object_type and objc_object_name, respectively. (OCTI_CLS_REF, OCTI_CLASS_NAME, objc_class_reference, objc_class_name): New. (IS_CLASS): New macro. (IS_ID, IS_SUPER): Robustify. (OCTI_EXECCLASS_DECL, execclass_decl): New. (finish_file, start_class, continue_class, finish_class, start_method_def, continue_method_def, finish_method_def, start_protocol, finish_protocol, objc_build_throw_stmt, objc_build_try_catch_finally_stmt, objc_build_synchronized_prologue, objc_build_synchronized_epilogue, objc_build_try_prologue, objc_build_try_epilogue, objc_build_catch_stmt, objc_build_catch_epilogue, objc_build_finally_prologue, objc_build_finally_epilogue, is_ivar, is_private, is_public, add_instance_variable, objc_add_method, get_super_receiver, objc_clear_super_receiver, get_class_ivars_from_name, get_class_reference, get_static_reference, get_object_reference, build_message_expr, finish_message_expr, build_selector_expr, build_ivar_reference, build_keyword_decl, build_method_decl, build_protocol_expr, build_objc_string_object, objc_declare_alias, objc_declare_class, objc_declare_protocols, objc_comptypes, objc_check_decl, build_encode_expr): Remove prototypes. (imp_count, cat_count): Make GGC-aware. (OBJC_SET_TYPE_NAME): New macro. From-SVN: r87168
2004-09-08 02:49:44 +02:00
#define PROTOCOL_OBJECT_CLASS_NAME "Protocol"
static const char *TAG_GETCLASS;
static const char *TAG_GETMETACLASS;
static const char *TAG_MSGSEND;
static const char *TAG_MSGSENDSUPER;
/* The NeXT Objective-C messenger may have two extra entry points, for use
when returning a structure. */
static const char *TAG_MSGSEND_STRET;
static const char *TAG_MSGSENDSUPER_STRET;
static const char *default_constant_string_class_name;
/* Runtime metadata flags. */
#define CLS_FACTORY 0x0001L
#define CLS_META 0x0002L
Yet more Objective-C++... * objc-act.c (objc_finish_try_stmt): Add return value. (objc_build_synchronized): Likewise. * objc-act.c (objc_is_gcable_type): Add. (objc_substitute_decl): Add. (objc_build_ivar_assignment): Add. (objc_build_global_assignment): Add. (objc_build_strong_cast_assignment): Add. (objc_is_ivar_reference_p): Add. (objc_is_global_reference_p): Add. (objc_generate_write_barrier): Add. (objc_rewrite_function_call): Add. (objc_gimplify_expr): Add Objective-C++ support. * objc-act.h (ALLOC_OBJC_TYPE_LANG_SPECIFIC): Likewise. (SIZEOF_OBJC_TYPE_LANG_SPECIFIC): Add. (INIT_TYPE_OBJC_INFO): Add Objective-C++ support. (DUP_TYPE_OBJC_INFO): Likewise. (struct imp_entry): Add field has_cxx_cdtors. (struct imp_entry *imp_list): Add OCTI_UMSG_FAST_DECL, OCTI_METH_LIST_TEMPL, OCTI_METH_PROTO_LIST_TEMPL, OCTI_IVAR_LIST_TEMPL, OCTI_ASSIGN_IVAR_DECL, OCTI_ASSIGN_IVAR_FAST_DECL, OCTI_ASSIGN_GLOBAL_DECL, OCTI_ASSIGN_STRONGCAST_DECL. (umsg_fast_decl): Add. (objc_assign_ivar_decl): Add. (objc_assign_ivar_fast_decl): Add. (objc_assign_global_decl): Add. (objc_assign_strong_cast_decl): Add. (objc_method_list_ptr): Add. (objc_method_proto_list_ptr): Add. (objc_ivar_list_ptr): Add. * objc-act.c (should_call_super_dealloc): Add. (OBJC_VERSION): Bump to 6. (objc_is_gcable_type): Add. (objc_substitute_decl): Add. (objc_build_ivar_assignment): Add. (objc_build_global_assignment): Add. (objc_build_strong_cast_assignment): Add. (objc_is_gcable_p): Add. (objc_is_ivar_reference_p): Add. (objc_is_global_reference_p): Add. (generate_shared_structures): Add flags parameter. (objc_generate_cxx_ctor_or_dtor): Add. (objc_generate_cxx_cdtors): Add. (add_class): Add name parameter. (objc_types_share_size_and_alignment): Add. (comp_proto_with_proto): Add strict parameter. (CLS_HAS_CXX_STRUCTORS): Add. (TAG_ASSIGNIVAR): Add. (TAG_ASSIGNGLOBAL): Add. (TAG_ASSIGNSTRONGCAST): Add. (TAG_MSGSEND_FAST): Add. (TAG_ASSIGNIVAR_FAST): Add. (TAG_CXX_CONSTRUCT): Add. (TAG_CXX_DESTRUCT): Add. (OBJC_LOOKUP_CLASS): Add. (OBJC_LOOKUP_NO_SUPER): Add. (objc_finish_file): Add pch support. (objc_finish_implementation): Add Objective-C++ support. (synth_module_prologue): Likewise. (synth_module_prologue): Add fast dispatching. (objc_get_class_reference): Add Objective-C++ support. (objc_generate_write_barrier): Likewise. (next_sjlj_build_enter_and_setjmp): Likewise. (objc_begin_try_stmt): Likewise. (build_next_objc_exception_stuff): Add fast ivar support. (build_private_template): Mark the record as used so debug information is generated. (build_protocol_template): Add Objective-C++ support. (objc_method_parm_type) Likewise. (objc_generate_cxx_ctor_or_dtor): Likewise. (objc_generate_cxx_cdtors): Likewise. (build_protocol_initializer): Likewise. (build_category_template): Likewise. (build_class_template): Likewise. (build_method_list_template): Likewise. (build_category_initializer): Likewise. (build_shared_structure_initializer): Likewise. (objc_finish_message_expr): Likewise. (build_objc_method_call): Add fast dispatch support. (lookup_method_static): Add support to end search at superclasses. (add_method_to_hash_list): Add strict parameter to comp_proto_with_proto. (objc_add_method): Likewise. (objc_add_method): Also set the interface_value. (add_instance_variable): Add Objective-C++ support. (objc_is_public): Likewise. (start_class): Likewise. (continue_class): Likewise. (encode_aggregate_within): Likewise. (start_method_def): Likewise. (objc_start_function): Clear current_function_returns_value and current_function_returns_null. (really_start_method): Add Objective-C++ support. (objc_finish_method_definition): Add warning for missing [super dealloc]. (finish_objc): Add Objective-C++ support. (generate_objc_image_info): Likewise. (objc_lookup_ivar): Likewise. * objc-act.h (TYPE_HAS_OBJC_INFO): Likewise. (INIT_TYPE_OBJC_INFO): Likewise. (DUP_TYPE_OBJC_INFO): Likewise. From-SVN: r99857
2005-05-17 22:07:08 +02:00
#define CLS_HAS_CXX_STRUCTORS 0x2000L
#define OBJC_MODIFIER_STATIC 0x00000001
#define OBJC_MODIFIER_FINAL 0x00000002
#define OBJC_MODIFIER_PUBLIC 0x00000004
#define OBJC_MODIFIER_PRIVATE 0x00000008
#define OBJC_MODIFIER_PROTECTED 0x00000010
#define OBJC_MODIFIER_NATIVE 0x00000020
#define OBJC_MODIFIER_SYNCHRONIZED 0x00000040
#define OBJC_MODIFIER_ABSTRACT 0x00000080
#define OBJC_MODIFIER_VOLATILE 0x00000100
#define OBJC_MODIFIER_TRANSIENT 0x00000200
#define OBJC_MODIFIER_NONE_SPECIFIED 0x80000000
Makefile.in (c-parse.o): Depend on $(C_COMMON_H). [gcc/ChangeLog] 2004-09-07 Ziemowit Laski <zlaski@apple.com> * Makefile.in (c-parse.o): Depend on $(C_COMMON_H). * c-parse.in: Include c-common.h instead of objc-act.h. (ivar_decl_list, ivar_decls, ivar_decl, ivars, ivar_declarator, myparms, myparm): Remove %type declarations. (methodtype, optparms, OBJC_TYPE_QUAL, objc_quals, objc_qual, objc_typename, objc_try_catch_stmt, optellipsis): Add %type declarations. (objc_inherit_code, objc_public_flag): Remove. (typespec_nonreserved_nonattr): Call objc_get_protocol_qualified_type() instead of get_static_reference() and get_protocol_reference(). (stmt_nocomp): Call grokparm() on @catch parameter. (objcdef): Move semantic action to objc_finish_implementation(). (classdef): Move semantic action to objc_start_class_interface(), objc_continue_interface(), objc_finish_interface(), objc_start_class_implementation(), objc_continue_implementation(), objc_start_category_interface() and objc_start_category_implementation(). (protocoldef): Move semantic actions to objc_start_protocol() and objc_finish_interface(). (ivar_decl_list): Remove nonterminal. (visibility_spec): Move semantic actions to objc_set_visibility(). (ivar_decls): Remove assignment to $$. (ivar_decl): Rephrase in terms of component_decl; call objc_add_instance_variable(). (ivars, ivar_declarator): Remove nonterminals. (opt_semi): New nonterminal. (methodtype): Remove semantic actions. (methoddef): Move semantic actions to objc_set_method_type(), objc_start_method_definition() and objc_finish_method_definition(). (methodproto): Move semantic actions to objc_set_method_type() and objc_add_method_declaration(). (methoddecl): Use objc_typename instead of typename; move semantic actions to objc_build_method_signature(). (optarglist, myxdecls, mydecl, myparms, myparm): Remove nonterminals. (optparmlist): Express in terms of optparms and optellipsis. (optparms, optellipsis, objc_qual, objc_quals, objc_typename): New nonterminals. (keyworddecl): Use objc_typename instead of typename. (rid_to_yy): Mark RID_IN, RID_OUT, RID_INOUT, RID_BYCOPY, RID_BYREF and RID_ONEWAY as returning OBJC_TYPE_QUAL to yyparse(). [gcc/objc/ChangeLog] 2004-09-07 Ziemowit Laski <zlaski@apple.com> * Make-lang.in (objc/objc-parse.o): Depend on $(C_COMMON_H) instead of objc/objc-act.h. (objc/objc-act.o): Depend on $(HASHTAB_H). * objc-act.c: Include hashtab.h; in ObjC++ mode, include cp-tree.h and objcp-decl.h instead of c-tree.h. (build_module_descriptor, get_class_ivars, synth_id_with_class_suffix, error_with_ivar, gen_method_decl, gen_declaration, setup_string_decl, build_protocol_template): Adjust prototypes. (build_module_initializer_routine, start_class, continue_class, finish_class, start_method_def, objc_start_function, start_protocol, build_method_decl, objc_add_method, add_instance_variable, build_ivar_reference, is_ivar, is_private, get_super_receiver, build_selector_table_decl, objc_push_parm, objc_get_parm_info, gen_type_name, gen_type_name_0, start_var_decl, finish_var_decl, create_field_decl): New prototypes. (objc_expand_function_end, comp_method_with_proto, objc_expr_last, gen_declaration_1, gen_declarator, is_complex_decl, adorn_decl, define_decl, create_builtin_decl, gen_declspecs): Remove prototypes. (TYPE_ID): Rename to OBJECT_TYPEDEF_NAME. (CLASS_TYPEDEF_NAME): New. (TAG_EXECCLASS): Change from a global variable to a #define. (TAG_RETURN_STRUCT): Delete. (TAG_GNUINIT): New, holds '__objc_gnu_init' name. (objc_inherit_code, objc_public_flag): New, moved from c-parse.in. (string_descriptor): New struct. (string_htab): New hash table. (string_hash, string_eq): New prototypes. (generate_struct_by_value_array): Call create_field_decl() instead of create_builtin_decl(). (objc_init): Do not initialize objc_ellipsis_node or TAG_EXECCLASS; In ObjC++ mode, call cxx_init() instead of c_objc_common_init(). (objc_finish_file): In ObjC++, call instantiate_pending_templates() and cp_finish_file(). (define_decl, get_static_reference, get_protocol_reference, create_builtin_decl): Remove functions. (objc_start_class_interface, objc_start_category_interface, objc_start_protocol, objc_continue_interface, objc_finish_interface, objc_start_class_implementation, objc_start_category_implementation, objc_continue_implementation, objc_finish_implementation, objc_set_visibility, objc_set_method_type, objc_build_method_signature, objc_add_method_declaration, objc_start_method_definition, objc_add_instance_variable, objc_get_protocol_qualified_type, create_field_decl, start_var_decl, finish_var_decl): New functions. (setup_string_decl): Simplify since it is only called once. (synth_module_prologue): Call build_class_template(); predefine 'id' and 'Class' as typedefs; rename 'temp_type' to 'type'; disable debug hooks for duration of function; fix GNU runtime messenger signatures to correspond to reality; forward-declare '__objc_exec_class' for the GNU runtime; call build_selector_table_decl(); in ObjC++ mode, generate 'extern "C" { ... }' wrappers around synthesized declarations; call build_protocol_template() and build_category_template(). (string_hash, string_eq): New functions. (objc_build_string_object): Check metaclass correctness only once; store string literals in hash table. (objc_build_constructor): Do not convert initializer elements; adjust for ObjC++ impedance mismatch. (build_objc_symtab_template): Call create_field_decl() instead of create_builtin_decl(). (init_objc_symtab): Add missing conversion to initializer element. (build_metadata_decl): Call start_var_decl() instead of define_decl(). (generate_objc_symtab_decl): Do not call build_category_template(); call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(). (build_module_descriptor): Call create_field_decl() instead of grokfield(); call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(); always mark module descriptor as used; move GNU runtime-specific functionality to build_module_initializer_routine(). (build_module_initializer_routine): New function, broken off of build_module_descriptor(). (objc_static_init_needed_p, objc_generate_static_init_call): New functions. (generate_static_references, generate_strings, build_selector_translation_table, generate_descriptor_table, generate_ivars_list, generate_dispatch_table, generate_category): Call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(); build a type directly instead of via groktypename(). (build_selector_reference_decl, build_selector_table_decl, build_class_reference_decl, build_protocol_reference, generate_objc_image_info): Call start_var_decl() instead of build_decl(). (build_selector_reference): For GNU runtime, do not call build_selector_reference_decl(). (build_selector, build_typed_selector_reference): Always convert result to the selector type. (add_objc_string): Cast return value to 'char *'. (build_method_prototype_template, build_selector_template, build_method_template): Use actual selector type for fields pointing to selectors. (finish_objc): For GNU runtime, call build_module_initializer_routine() after build_module_descriptor(). (generate_protocol_list, generate_shared_structures): Call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(); build a type directly instead of via groktypename(). (synth_id_with_class_suffix): Return a string. (get_arg_type_list): For instance methods, use the instance type for 'self'; do not call groktypename_in_parm_context(). (build_objc_string_decl): Squash redeclaration errors in ObjC++. (objc_is_class_name): Use OBJC_TYPE_NAME instead of TYPE_NAME; handle RECORD_TYPEs in ObjC as well as ObjC++. (objc_is_id): New function. (objc_is_object_ptr): Return the canonical type node. (objc_get_class_ivars): Simplify using get_class_ivars(). (get_class_ivars): Remove second parameter; create a fresh copy of the ivar list for each call; do not check for existence of super class. (objc_eh_runtime_type): Mark #ifndef OBJCPLUS. (objc_init_exceptions): When using SJLJ-style exceptions, require the use of '-fobjc-exceptions' flag; do not require it for DWARF-style exceptions. (objc_build_exc_ptr, next_sjlj_build_try_catch_finally): Use objc_object_type instead of objc_id_type. (objc_begin_catch_clause): Convert the incoming PARM_DECL into a VAR_DECL before placing it in the appropriate scope; do not call define_decl(); adjust call to c_begin_compound_stmt(); use objc_object_type instead of objc_id_type. (build_next_objc_exception_stuff): Call create_field_decl() instead of create_builtin_decl(); construct type directly instead of calling groktypename(); use OBJC_VOID_AT_END to mark end of function parameters. (build_private_template): Adjust call to get_class_ivars(); build a type directly instead of via groktypename(). (build_protocol_template, build_method_prototype_list_template, build_method_prototype_template, build_category_template, build_selector_template, build_class_template, build_super_template, build_ivar_template, build_ivar_list_template, build_method_list_template, build_method_template): Call create_field_decl() instead of grokfield(). (objc_method_parm_type): Do not call groktypename(). (generate_descriptor_table): Call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(). (generate_method_descriptors, build_protocol_initializer, generate_dispatch_tables, build_category_initializer, build_shared_structure_initializer): Do not call groktypename(). (generate_protocols): Call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(); do not call groktypename(). (error_with_ivar): Remove last parameter. (check_ivars): Do not iterate ovar CLASS_RAW_IVARS lists in addition to CLASS_IVARS lists; adjust calls to error_with_ivar(). (generate_ivar_lists): Convert one of the initializer elements; do not call groktypename(). (get_arg_type_list, start_method_def, gen_method_def): Account for new representation of variable arguments and '...' in Objective-C methods; add Objective-C++ impedance matching code. (is_objc_type_qualifier): Remove function. (adjust_type_for_id_default): Simplify; there is no longer a need to wade through declspecs. (lookup_interface, start_class, continue_class, finish_class, start_method_def, start_protocol, build_method_decl, objc_add_method, add_instance_variable, build_ivar_reference, is_ivar, is_private, get_super_receiver, objc_build_finally_epilogue): Make into static functions. (receiver_is_class_object): Use new IS_CLASS() macro. (objc_build_message_expr): Tweak ObjC++ message argument handling; call objc_finish_message_expr() instead of finish_message_expr(). (finish_message_expr): Rename to objc_finish_message_expr(); use OBJC_TYPE_NAME and OBJC_SET_TYPE_NAME macros instead of TYPE_NAME. call gen_type_name() instead of gen_declaration(); call objc_is_id() instead of using IS_ID and IS_CLASS; Use objc_class_name instead of calling get_identifier("Class"); handle CONVERT_EXPRs in receiver. (build_objc_method_call, warn_with_method): Do not call groktypename(). (build_ivar_reference): Call convert() instead of clobbering in a type. (hash_init): Initialize string_htab hash table. (add_instance_variable): Simplify parameter list; do not call grokfield(); do not populate CLASS_IVARS list. (start_class): Check for the existence of super class, if one was specified. (continue_class): Use CLASS_RAW_IVARS rather than CLASS_IVARS; do not call build_class_template(); adjust call to get_class_ivars(); call build_decl(), pushdecl() and finish_decl() instead of define_decl(). (finish_class): Call build_decl(), pushdecl() and finish_decl() instead of define_decl(). (add_protocols): Use PROTOCOL_BINFO_ELTS for the tree vector size. (start_protocol): Do not call build_protocol_template(); use PROTOCOL_BINFO_ELTS for the tree vector size. (encode_type_qualifiers): Do not handle the 'const' qualifier here. (encode_pointer): Encode 'const char *' as 'r*', for backwards compatibility. (encode_array): Use HOST_WIDE_INT_PRINT_DEC instead of "%ld". (encode_type): Handle the 'const' qualifier here. (objc_parmlist): New global variable, sued by objc_push_parm and objc_get_parm_info(). (objc_push_parm, objc_get_parm_info): New functions. (objc_expr_last): Remove function. (synth_self_and_ucmd_args): For instance methods, use the instance type for 'self'; call objc_push_parm() instead of push_parm_decl(). (start_method_def): Do not call push_scope(), declare_parm_level(), pop_scope(), push_parm_decl(), store_parm_decls() or objc_expr_last(); just use objc_push_parm() and objc_get_parm_info(). (comp_method_with_proto): Remove function. (objc_types_are_equivalent): Strip away indirections before comparing underlying types. (comp_proto_with_proto): Do not call groktypename(); types are no longer in raw declspec format. (objc_start_function): New function. (really_start_method): Call comp_proto_with_proto() instead of comp_method_with_proto(); call objc_start_function() instead of hand-crafting a function declarator. (continue_method_def, objc_expand_function_end): Remove functions. (get_super_receiver): Call objc_get_current_scope() instead of get_current_scope(); reference 'super_class' field (instead of 'class'). (finish_method_def): Rename to objc_finish_method_definition() and add a function decl parameter; move method encoding call from objc_expand_function_end(). (is_complex_decl, adorn_decl, gen_declarator, gen_declspecs, gen_declaration_1): Remove functions. (tmpbuf, RAW_DECLSPEC): Remove. (gen_declaration): Remove second parameter; simplify to deal with TYPE_P nodes instead of raw declspecs. (gen_type_name, gen_type_name_0): New functions. (gen_method_decl): Remove second parameter; call gen_type_name() instead of gen_declaration_1(). (dump_interface): Adjust calls to gen_declaration() and gen_method_decl(); do not allocate a separate string buffer. (init_objc): Allocate a larger string buffer to accommodate dump_interface(); adjust call to build_module_descriptor(); add call to build_module_initializer_routine() for the GNU runtime. (generate_classref_translation_entry): Do not call start_decl(); call finish_var_decl() instead of finish_decl(); call convert() instead of build_c_cast(). * objc-act.h (CLASS_OWN_IVARS): Remove accessor. (CLASS_BINFO_ELTS): Reduce from 6 to 5, now that CLASS_OWN_IVARS is gone. (OCTI_GNU_INIT_DECL, GNU_INIT_decl): New. (OCTI_ELLIPSIS_NODE, objc_ellipsis_node): Remove. (OCTI_ID_ID, id_type, objc_id_id): Rename to OCTI_ID_NAME, objc_object_type and objc_object_name, respectively. (OCTI_CLS_REF, OCTI_CLASS_NAME, objc_class_reference, objc_class_name): New. (IS_CLASS): New macro. (IS_ID, IS_SUPER): Robustify. (OCTI_EXECCLASS_DECL, execclass_decl): New. (finish_file, start_class, continue_class, finish_class, start_method_def, continue_method_def, finish_method_def, start_protocol, finish_protocol, objc_build_throw_stmt, objc_build_try_catch_finally_stmt, objc_build_synchronized_prologue, objc_build_synchronized_epilogue, objc_build_try_prologue, objc_build_try_epilogue, objc_build_catch_stmt, objc_build_catch_epilogue, objc_build_finally_prologue, objc_build_finally_epilogue, is_ivar, is_private, is_public, add_instance_variable, objc_add_method, get_super_receiver, objc_clear_super_receiver, get_class_ivars_from_name, get_class_reference, get_static_reference, get_object_reference, build_message_expr, finish_message_expr, build_selector_expr, build_ivar_reference, build_keyword_decl, build_method_decl, build_protocol_expr, build_objc_string_object, objc_declare_alias, objc_declare_class, objc_declare_protocols, objc_comptypes, objc_check_decl, build_encode_expr): Remove prototypes. (imp_count, cat_count): Make GGC-aware. (OBJC_SET_TYPE_NAME): New macro. From-SVN: r87168
2004-09-08 02:49:44 +02:00
/* NeXT-specific tags. */
#define TAG_MSGSEND_NONNIL "objc_msgSendNonNil"
#define TAG_MSGSEND_NONNIL_STRET "objc_msgSendNonNil_stret"
#define TAG_EXCEPTIONEXTRACT "objc_exception_extract"
#define TAG_EXCEPTIONTRYENTER "objc_exception_try_enter"
#define TAG_EXCEPTIONTRYEXIT "objc_exception_try_exit"
#define TAG_EXCEPTIONMATCH "objc_exception_match"
#define TAG_EXCEPTIONTHROW "objc_exception_throw"
#define TAG_SYNCENTER "objc_sync_enter"
#define TAG_SYNCEXIT "objc_sync_exit"
#define TAG_SETJMP "_setjmp"
#define UTAG_EXCDATA "_objc_exception_data"
Yet more Objective-C++... * objc-act.c (objc_finish_try_stmt): Add return value. (objc_build_synchronized): Likewise. * objc-act.c (objc_is_gcable_type): Add. (objc_substitute_decl): Add. (objc_build_ivar_assignment): Add. (objc_build_global_assignment): Add. (objc_build_strong_cast_assignment): Add. (objc_is_ivar_reference_p): Add. (objc_is_global_reference_p): Add. (objc_generate_write_barrier): Add. (objc_rewrite_function_call): Add. (objc_gimplify_expr): Add Objective-C++ support. * objc-act.h (ALLOC_OBJC_TYPE_LANG_SPECIFIC): Likewise. (SIZEOF_OBJC_TYPE_LANG_SPECIFIC): Add. (INIT_TYPE_OBJC_INFO): Add Objective-C++ support. (DUP_TYPE_OBJC_INFO): Likewise. (struct imp_entry): Add field has_cxx_cdtors. (struct imp_entry *imp_list): Add OCTI_UMSG_FAST_DECL, OCTI_METH_LIST_TEMPL, OCTI_METH_PROTO_LIST_TEMPL, OCTI_IVAR_LIST_TEMPL, OCTI_ASSIGN_IVAR_DECL, OCTI_ASSIGN_IVAR_FAST_DECL, OCTI_ASSIGN_GLOBAL_DECL, OCTI_ASSIGN_STRONGCAST_DECL. (umsg_fast_decl): Add. (objc_assign_ivar_decl): Add. (objc_assign_ivar_fast_decl): Add. (objc_assign_global_decl): Add. (objc_assign_strong_cast_decl): Add. (objc_method_list_ptr): Add. (objc_method_proto_list_ptr): Add. (objc_ivar_list_ptr): Add. * objc-act.c (should_call_super_dealloc): Add. (OBJC_VERSION): Bump to 6. (objc_is_gcable_type): Add. (objc_substitute_decl): Add. (objc_build_ivar_assignment): Add. (objc_build_global_assignment): Add. (objc_build_strong_cast_assignment): Add. (objc_is_gcable_p): Add. (objc_is_ivar_reference_p): Add. (objc_is_global_reference_p): Add. (generate_shared_structures): Add flags parameter. (objc_generate_cxx_ctor_or_dtor): Add. (objc_generate_cxx_cdtors): Add. (add_class): Add name parameter. (objc_types_share_size_and_alignment): Add. (comp_proto_with_proto): Add strict parameter. (CLS_HAS_CXX_STRUCTORS): Add. (TAG_ASSIGNIVAR): Add. (TAG_ASSIGNGLOBAL): Add. (TAG_ASSIGNSTRONGCAST): Add. (TAG_MSGSEND_FAST): Add. (TAG_ASSIGNIVAR_FAST): Add. (TAG_CXX_CONSTRUCT): Add. (TAG_CXX_DESTRUCT): Add. (OBJC_LOOKUP_CLASS): Add. (OBJC_LOOKUP_NO_SUPER): Add. (objc_finish_file): Add pch support. (objc_finish_implementation): Add Objective-C++ support. (synth_module_prologue): Likewise. (synth_module_prologue): Add fast dispatching. (objc_get_class_reference): Add Objective-C++ support. (objc_generate_write_barrier): Likewise. (next_sjlj_build_enter_and_setjmp): Likewise. (objc_begin_try_stmt): Likewise. (build_next_objc_exception_stuff): Add fast ivar support. (build_private_template): Mark the record as used so debug information is generated. (build_protocol_template): Add Objective-C++ support. (objc_method_parm_type) Likewise. (objc_generate_cxx_ctor_or_dtor): Likewise. (objc_generate_cxx_cdtors): Likewise. (build_protocol_initializer): Likewise. (build_category_template): Likewise. (build_class_template): Likewise. (build_method_list_template): Likewise. (build_category_initializer): Likewise. (build_shared_structure_initializer): Likewise. (objc_finish_message_expr): Likewise. (build_objc_method_call): Add fast dispatch support. (lookup_method_static): Add support to end search at superclasses. (add_method_to_hash_list): Add strict parameter to comp_proto_with_proto. (objc_add_method): Likewise. (objc_add_method): Also set the interface_value. (add_instance_variable): Add Objective-C++ support. (objc_is_public): Likewise. (start_class): Likewise. (continue_class): Likewise. (encode_aggregate_within): Likewise. (start_method_def): Likewise. (objc_start_function): Clear current_function_returns_value and current_function_returns_null. (really_start_method): Add Objective-C++ support. (objc_finish_method_definition): Add warning for missing [super dealloc]. (finish_objc): Add Objective-C++ support. (generate_objc_image_info): Likewise. (objc_lookup_ivar): Likewise. * objc-act.h (TYPE_HAS_OBJC_INFO): Likewise. (INIT_TYPE_OBJC_INFO): Likewise. (DUP_TYPE_OBJC_INFO): Likewise. From-SVN: r99857
2005-05-17 22:07:08 +02:00
#define TAG_ASSIGNIVAR "objc_assign_ivar"
#define TAG_ASSIGNGLOBAL "objc_assign_global"
#define TAG_ASSIGNSTRONGCAST "objc_assign_strongCast"
/* Branch entry points. All that matters here are the addresses;
functions with these names do not really exist in libobjc. */
#define TAG_MSGSEND_FAST "objc_msgSend_Fast"
#define TAG_ASSIGNIVAR_FAST "objc_assign_ivar_Fast"
#define TAG_CXX_CONSTRUCT ".cxx_construct"
#define TAG_CXX_DESTRUCT ".cxx_destruct"
Makefile.in (c-parse.o): Depend on $(C_COMMON_H). [gcc/ChangeLog] 2004-09-07 Ziemowit Laski <zlaski@apple.com> * Makefile.in (c-parse.o): Depend on $(C_COMMON_H). * c-parse.in: Include c-common.h instead of objc-act.h. (ivar_decl_list, ivar_decls, ivar_decl, ivars, ivar_declarator, myparms, myparm): Remove %type declarations. (methodtype, optparms, OBJC_TYPE_QUAL, objc_quals, objc_qual, objc_typename, objc_try_catch_stmt, optellipsis): Add %type declarations. (objc_inherit_code, objc_public_flag): Remove. (typespec_nonreserved_nonattr): Call objc_get_protocol_qualified_type() instead of get_static_reference() and get_protocol_reference(). (stmt_nocomp): Call grokparm() on @catch parameter. (objcdef): Move semantic action to objc_finish_implementation(). (classdef): Move semantic action to objc_start_class_interface(), objc_continue_interface(), objc_finish_interface(), objc_start_class_implementation(), objc_continue_implementation(), objc_start_category_interface() and objc_start_category_implementation(). (protocoldef): Move semantic actions to objc_start_protocol() and objc_finish_interface(). (ivar_decl_list): Remove nonterminal. (visibility_spec): Move semantic actions to objc_set_visibility(). (ivar_decls): Remove assignment to $$. (ivar_decl): Rephrase in terms of component_decl; call objc_add_instance_variable(). (ivars, ivar_declarator): Remove nonterminals. (opt_semi): New nonterminal. (methodtype): Remove semantic actions. (methoddef): Move semantic actions to objc_set_method_type(), objc_start_method_definition() and objc_finish_method_definition(). (methodproto): Move semantic actions to objc_set_method_type() and objc_add_method_declaration(). (methoddecl): Use objc_typename instead of typename; move semantic actions to objc_build_method_signature(). (optarglist, myxdecls, mydecl, myparms, myparm): Remove nonterminals. (optparmlist): Express in terms of optparms and optellipsis. (optparms, optellipsis, objc_qual, objc_quals, objc_typename): New nonterminals. (keyworddecl): Use objc_typename instead of typename. (rid_to_yy): Mark RID_IN, RID_OUT, RID_INOUT, RID_BYCOPY, RID_BYREF and RID_ONEWAY as returning OBJC_TYPE_QUAL to yyparse(). [gcc/objc/ChangeLog] 2004-09-07 Ziemowit Laski <zlaski@apple.com> * Make-lang.in (objc/objc-parse.o): Depend on $(C_COMMON_H) instead of objc/objc-act.h. (objc/objc-act.o): Depend on $(HASHTAB_H). * objc-act.c: Include hashtab.h; in ObjC++ mode, include cp-tree.h and objcp-decl.h instead of c-tree.h. (build_module_descriptor, get_class_ivars, synth_id_with_class_suffix, error_with_ivar, gen_method_decl, gen_declaration, setup_string_decl, build_protocol_template): Adjust prototypes. (build_module_initializer_routine, start_class, continue_class, finish_class, start_method_def, objc_start_function, start_protocol, build_method_decl, objc_add_method, add_instance_variable, build_ivar_reference, is_ivar, is_private, get_super_receiver, build_selector_table_decl, objc_push_parm, objc_get_parm_info, gen_type_name, gen_type_name_0, start_var_decl, finish_var_decl, create_field_decl): New prototypes. (objc_expand_function_end, comp_method_with_proto, objc_expr_last, gen_declaration_1, gen_declarator, is_complex_decl, adorn_decl, define_decl, create_builtin_decl, gen_declspecs): Remove prototypes. (TYPE_ID): Rename to OBJECT_TYPEDEF_NAME. (CLASS_TYPEDEF_NAME): New. (TAG_EXECCLASS): Change from a global variable to a #define. (TAG_RETURN_STRUCT): Delete. (TAG_GNUINIT): New, holds '__objc_gnu_init' name. (objc_inherit_code, objc_public_flag): New, moved from c-parse.in. (string_descriptor): New struct. (string_htab): New hash table. (string_hash, string_eq): New prototypes. (generate_struct_by_value_array): Call create_field_decl() instead of create_builtin_decl(). (objc_init): Do not initialize objc_ellipsis_node or TAG_EXECCLASS; In ObjC++ mode, call cxx_init() instead of c_objc_common_init(). (objc_finish_file): In ObjC++, call instantiate_pending_templates() and cp_finish_file(). (define_decl, get_static_reference, get_protocol_reference, create_builtin_decl): Remove functions. (objc_start_class_interface, objc_start_category_interface, objc_start_protocol, objc_continue_interface, objc_finish_interface, objc_start_class_implementation, objc_start_category_implementation, objc_continue_implementation, objc_finish_implementation, objc_set_visibility, objc_set_method_type, objc_build_method_signature, objc_add_method_declaration, objc_start_method_definition, objc_add_instance_variable, objc_get_protocol_qualified_type, create_field_decl, start_var_decl, finish_var_decl): New functions. (setup_string_decl): Simplify since it is only called once. (synth_module_prologue): Call build_class_template(); predefine 'id' and 'Class' as typedefs; rename 'temp_type' to 'type'; disable debug hooks for duration of function; fix GNU runtime messenger signatures to correspond to reality; forward-declare '__objc_exec_class' for the GNU runtime; call build_selector_table_decl(); in ObjC++ mode, generate 'extern "C" { ... }' wrappers around synthesized declarations; call build_protocol_template() and build_category_template(). (string_hash, string_eq): New functions. (objc_build_string_object): Check metaclass correctness only once; store string literals in hash table. (objc_build_constructor): Do not convert initializer elements; adjust for ObjC++ impedance mismatch. (build_objc_symtab_template): Call create_field_decl() instead of create_builtin_decl(). (init_objc_symtab): Add missing conversion to initializer element. (build_metadata_decl): Call start_var_decl() instead of define_decl(). (generate_objc_symtab_decl): Do not call build_category_template(); call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(). (build_module_descriptor): Call create_field_decl() instead of grokfield(); call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(); always mark module descriptor as used; move GNU runtime-specific functionality to build_module_initializer_routine(). (build_module_initializer_routine): New function, broken off of build_module_descriptor(). (objc_static_init_needed_p, objc_generate_static_init_call): New functions. (generate_static_references, generate_strings, build_selector_translation_table, generate_descriptor_table, generate_ivars_list, generate_dispatch_table, generate_category): Call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(); build a type directly instead of via groktypename(). (build_selector_reference_decl, build_selector_table_decl, build_class_reference_decl, build_protocol_reference, generate_objc_image_info): Call start_var_decl() instead of build_decl(). (build_selector_reference): For GNU runtime, do not call build_selector_reference_decl(). (build_selector, build_typed_selector_reference): Always convert result to the selector type. (add_objc_string): Cast return value to 'char *'. (build_method_prototype_template, build_selector_template, build_method_template): Use actual selector type for fields pointing to selectors. (finish_objc): For GNU runtime, call build_module_initializer_routine() after build_module_descriptor(). (generate_protocol_list, generate_shared_structures): Call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(); build a type directly instead of via groktypename(). (synth_id_with_class_suffix): Return a string. (get_arg_type_list): For instance methods, use the instance type for 'self'; do not call groktypename_in_parm_context(). (build_objc_string_decl): Squash redeclaration errors in ObjC++. (objc_is_class_name): Use OBJC_TYPE_NAME instead of TYPE_NAME; handle RECORD_TYPEs in ObjC as well as ObjC++. (objc_is_id): New function. (objc_is_object_ptr): Return the canonical type node. (objc_get_class_ivars): Simplify using get_class_ivars(). (get_class_ivars): Remove second parameter; create a fresh copy of the ivar list for each call; do not check for existence of super class. (objc_eh_runtime_type): Mark #ifndef OBJCPLUS. (objc_init_exceptions): When using SJLJ-style exceptions, require the use of '-fobjc-exceptions' flag; do not require it for DWARF-style exceptions. (objc_build_exc_ptr, next_sjlj_build_try_catch_finally): Use objc_object_type instead of objc_id_type. (objc_begin_catch_clause): Convert the incoming PARM_DECL into a VAR_DECL before placing it in the appropriate scope; do not call define_decl(); adjust call to c_begin_compound_stmt(); use objc_object_type instead of objc_id_type. (build_next_objc_exception_stuff): Call create_field_decl() instead of create_builtin_decl(); construct type directly instead of calling groktypename(); use OBJC_VOID_AT_END to mark end of function parameters. (build_private_template): Adjust call to get_class_ivars(); build a type directly instead of via groktypename(). (build_protocol_template, build_method_prototype_list_template, build_method_prototype_template, build_category_template, build_selector_template, build_class_template, build_super_template, build_ivar_template, build_ivar_list_template, build_method_list_template, build_method_template): Call create_field_decl() instead of grokfield(). (objc_method_parm_type): Do not call groktypename(). (generate_descriptor_table): Call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(). (generate_method_descriptors, build_protocol_initializer, generate_dispatch_tables, build_category_initializer, build_shared_structure_initializer): Do not call groktypename(). (generate_protocols): Call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(); do not call groktypename(). (error_with_ivar): Remove last parameter. (check_ivars): Do not iterate ovar CLASS_RAW_IVARS lists in addition to CLASS_IVARS lists; adjust calls to error_with_ivar(). (generate_ivar_lists): Convert one of the initializer elements; do not call groktypename(). (get_arg_type_list, start_method_def, gen_method_def): Account for new representation of variable arguments and '...' in Objective-C methods; add Objective-C++ impedance matching code. (is_objc_type_qualifier): Remove function. (adjust_type_for_id_default): Simplify; there is no longer a need to wade through declspecs. (lookup_interface, start_class, continue_class, finish_class, start_method_def, start_protocol, build_method_decl, objc_add_method, add_instance_variable, build_ivar_reference, is_ivar, is_private, get_super_receiver, objc_build_finally_epilogue): Make into static functions. (receiver_is_class_object): Use new IS_CLASS() macro. (objc_build_message_expr): Tweak ObjC++ message argument handling; call objc_finish_message_expr() instead of finish_message_expr(). (finish_message_expr): Rename to objc_finish_message_expr(); use OBJC_TYPE_NAME and OBJC_SET_TYPE_NAME macros instead of TYPE_NAME. call gen_type_name() instead of gen_declaration(); call objc_is_id() instead of using IS_ID and IS_CLASS; Use objc_class_name instead of calling get_identifier("Class"); handle CONVERT_EXPRs in receiver. (build_objc_method_call, warn_with_method): Do not call groktypename(). (build_ivar_reference): Call convert() instead of clobbering in a type. (hash_init): Initialize string_htab hash table. (add_instance_variable): Simplify parameter list; do not call grokfield(); do not populate CLASS_IVARS list. (start_class): Check for the existence of super class, if one was specified. (continue_class): Use CLASS_RAW_IVARS rather than CLASS_IVARS; do not call build_class_template(); adjust call to get_class_ivars(); call build_decl(), pushdecl() and finish_decl() instead of define_decl(). (finish_class): Call build_decl(), pushdecl() and finish_decl() instead of define_decl(). (add_protocols): Use PROTOCOL_BINFO_ELTS for the tree vector size. (start_protocol): Do not call build_protocol_template(); use PROTOCOL_BINFO_ELTS for the tree vector size. (encode_type_qualifiers): Do not handle the 'const' qualifier here. (encode_pointer): Encode 'const char *' as 'r*', for backwards compatibility. (encode_array): Use HOST_WIDE_INT_PRINT_DEC instead of "%ld". (encode_type): Handle the 'const' qualifier here. (objc_parmlist): New global variable, sued by objc_push_parm and objc_get_parm_info(). (objc_push_parm, objc_get_parm_info): New functions. (objc_expr_last): Remove function. (synth_self_and_ucmd_args): For instance methods, use the instance type for 'self'; call objc_push_parm() instead of push_parm_decl(). (start_method_def): Do not call push_scope(), declare_parm_level(), pop_scope(), push_parm_decl(), store_parm_decls() or objc_expr_last(); just use objc_push_parm() and objc_get_parm_info(). (comp_method_with_proto): Remove function. (objc_types_are_equivalent): Strip away indirections before comparing underlying types. (comp_proto_with_proto): Do not call groktypename(); types are no longer in raw declspec format. (objc_start_function): New function. (really_start_method): Call comp_proto_with_proto() instead of comp_method_with_proto(); call objc_start_function() instead of hand-crafting a function declarator. (continue_method_def, objc_expand_function_end): Remove functions. (get_super_receiver): Call objc_get_current_scope() instead of get_current_scope(); reference 'super_class' field (instead of 'class'). (finish_method_def): Rename to objc_finish_method_definition() and add a function decl parameter; move method encoding call from objc_expand_function_end(). (is_complex_decl, adorn_decl, gen_declarator, gen_declspecs, gen_declaration_1): Remove functions. (tmpbuf, RAW_DECLSPEC): Remove. (gen_declaration): Remove second parameter; simplify to deal with TYPE_P nodes instead of raw declspecs. (gen_type_name, gen_type_name_0): New functions. (gen_method_decl): Remove second parameter; call gen_type_name() instead of gen_declaration_1(). (dump_interface): Adjust calls to gen_declaration() and gen_method_decl(); do not allocate a separate string buffer. (init_objc): Allocate a larger string buffer to accommodate dump_interface(); adjust call to build_module_descriptor(); add call to build_module_initializer_routine() for the GNU runtime. (generate_classref_translation_entry): Do not call start_decl(); call finish_var_decl() instead of finish_decl(); call convert() instead of build_c_cast(). * objc-act.h (CLASS_OWN_IVARS): Remove accessor. (CLASS_BINFO_ELTS): Reduce from 6 to 5, now that CLASS_OWN_IVARS is gone. (OCTI_GNU_INIT_DECL, GNU_INIT_decl): New. (OCTI_ELLIPSIS_NODE, objc_ellipsis_node): Remove. (OCTI_ID_ID, id_type, objc_id_id): Rename to OCTI_ID_NAME, objc_object_type and objc_object_name, respectively. (OCTI_CLS_REF, OCTI_CLASS_NAME, objc_class_reference, objc_class_name): New. (IS_CLASS): New macro. (IS_ID, IS_SUPER): Robustify. (OCTI_EXECCLASS_DECL, execclass_decl): New. (finish_file, start_class, continue_class, finish_class, start_method_def, continue_method_def, finish_method_def, start_protocol, finish_protocol, objc_build_throw_stmt, objc_build_try_catch_finally_stmt, objc_build_synchronized_prologue, objc_build_synchronized_epilogue, objc_build_try_prologue, objc_build_try_epilogue, objc_build_catch_stmt, objc_build_catch_epilogue, objc_build_finally_prologue, objc_build_finally_epilogue, is_ivar, is_private, is_public, add_instance_variable, objc_add_method, get_super_receiver, objc_clear_super_receiver, get_class_ivars_from_name, get_class_reference, get_static_reference, get_object_reference, build_message_expr, finish_message_expr, build_selector_expr, build_ivar_reference, build_keyword_decl, build_method_decl, build_protocol_expr, build_objc_string_object, objc_declare_alias, objc_declare_class, objc_declare_protocols, objc_comptypes, objc_check_decl, build_encode_expr): Remove prototypes. (imp_count, cat_count): Make GGC-aware. (OBJC_SET_TYPE_NAME): New macro. From-SVN: r87168
2004-09-08 02:49:44 +02:00
/* GNU-specific tags. */
#define TAG_EXECCLASS "__objc_exec_class"
#define TAG_GNUINIT "__objc_gnu_init"
Yet more Objective-C++... * objc-act.c (objc_finish_try_stmt): Add return value. (objc_build_synchronized): Likewise. * objc-act.c (objc_is_gcable_type): Add. (objc_substitute_decl): Add. (objc_build_ivar_assignment): Add. (objc_build_global_assignment): Add. (objc_build_strong_cast_assignment): Add. (objc_is_ivar_reference_p): Add. (objc_is_global_reference_p): Add. (objc_generate_write_barrier): Add. (objc_rewrite_function_call): Add. (objc_gimplify_expr): Add Objective-C++ support. * objc-act.h (ALLOC_OBJC_TYPE_LANG_SPECIFIC): Likewise. (SIZEOF_OBJC_TYPE_LANG_SPECIFIC): Add. (INIT_TYPE_OBJC_INFO): Add Objective-C++ support. (DUP_TYPE_OBJC_INFO): Likewise. (struct imp_entry): Add field has_cxx_cdtors. (struct imp_entry *imp_list): Add OCTI_UMSG_FAST_DECL, OCTI_METH_LIST_TEMPL, OCTI_METH_PROTO_LIST_TEMPL, OCTI_IVAR_LIST_TEMPL, OCTI_ASSIGN_IVAR_DECL, OCTI_ASSIGN_IVAR_FAST_DECL, OCTI_ASSIGN_GLOBAL_DECL, OCTI_ASSIGN_STRONGCAST_DECL. (umsg_fast_decl): Add. (objc_assign_ivar_decl): Add. (objc_assign_ivar_fast_decl): Add. (objc_assign_global_decl): Add. (objc_assign_strong_cast_decl): Add. (objc_method_list_ptr): Add. (objc_method_proto_list_ptr): Add. (objc_ivar_list_ptr): Add. * objc-act.c (should_call_super_dealloc): Add. (OBJC_VERSION): Bump to 6. (objc_is_gcable_type): Add. (objc_substitute_decl): Add. (objc_build_ivar_assignment): Add. (objc_build_global_assignment): Add. (objc_build_strong_cast_assignment): Add. (objc_is_gcable_p): Add. (objc_is_ivar_reference_p): Add. (objc_is_global_reference_p): Add. (generate_shared_structures): Add flags parameter. (objc_generate_cxx_ctor_or_dtor): Add. (objc_generate_cxx_cdtors): Add. (add_class): Add name parameter. (objc_types_share_size_and_alignment): Add. (comp_proto_with_proto): Add strict parameter. (CLS_HAS_CXX_STRUCTORS): Add. (TAG_ASSIGNIVAR): Add. (TAG_ASSIGNGLOBAL): Add. (TAG_ASSIGNSTRONGCAST): Add. (TAG_MSGSEND_FAST): Add. (TAG_ASSIGNIVAR_FAST): Add. (TAG_CXX_CONSTRUCT): Add. (TAG_CXX_DESTRUCT): Add. (OBJC_LOOKUP_CLASS): Add. (OBJC_LOOKUP_NO_SUPER): Add. (objc_finish_file): Add pch support. (objc_finish_implementation): Add Objective-C++ support. (synth_module_prologue): Likewise. (synth_module_prologue): Add fast dispatching. (objc_get_class_reference): Add Objective-C++ support. (objc_generate_write_barrier): Likewise. (next_sjlj_build_enter_and_setjmp): Likewise. (objc_begin_try_stmt): Likewise. (build_next_objc_exception_stuff): Add fast ivar support. (build_private_template): Mark the record as used so debug information is generated. (build_protocol_template): Add Objective-C++ support. (objc_method_parm_type) Likewise. (objc_generate_cxx_ctor_or_dtor): Likewise. (objc_generate_cxx_cdtors): Likewise. (build_protocol_initializer): Likewise. (build_category_template): Likewise. (build_class_template): Likewise. (build_method_list_template): Likewise. (build_category_initializer): Likewise. (build_shared_structure_initializer): Likewise. (objc_finish_message_expr): Likewise. (build_objc_method_call): Add fast dispatch support. (lookup_method_static): Add support to end search at superclasses. (add_method_to_hash_list): Add strict parameter to comp_proto_with_proto. (objc_add_method): Likewise. (objc_add_method): Also set the interface_value. (add_instance_variable): Add Objective-C++ support. (objc_is_public): Likewise. (start_class): Likewise. (continue_class): Likewise. (encode_aggregate_within): Likewise. (start_method_def): Likewise. (objc_start_function): Clear current_function_returns_value and current_function_returns_null. (really_start_method): Add Objective-C++ support. (objc_finish_method_definition): Add warning for missing [super dealloc]. (finish_objc): Add Objective-C++ support. (generate_objc_image_info): Likewise. (objc_lookup_ivar): Likewise. * objc-act.h (TYPE_HAS_OBJC_INFO): Likewise. (INIT_TYPE_OBJC_INFO): Likewise. (DUP_TYPE_OBJC_INFO): Likewise. From-SVN: r99857
2005-05-17 22:07:08 +02:00
/* Flags for lookup_method_static(). */
#define OBJC_LOOKUP_CLASS 1 /* Look for class methods. */
#define OBJC_LOOKUP_NO_SUPER 2 /* Do not examine superclasses. */
/* The OCTI_... enumeration itself is in objc/objc-act.h. */
c-parse.in (objc_inherit_code, [...]): Make static. 2001-10-03 Ziemowit Laski <zlaski@apple.com> * c-parse.in (objc_inherit_code, objc_pq_context, objc_public_flag): Make static. (objc_interface_context, objc_implementation_context, objc_method_context, objc_ivar_chain, objc_ivar_context): Move to global tree array in objc/objc-act.[ch]. (methoddef): Remove unnecessary code. * objc/objc-act.c: (hashed_attribute, hashed_entry, imp_entry): Hoist struct definitions to objc-act.h. (nst_method_hash_list, cls_method_hash_list, imp_list, imp_count, cat_count): Place declaration in objc-act.h. (objc_tree_index): Move enumeration to objc-act.h. (objc_global_trees): Place declaration and macro accessors in objc-act.h. (implementation_context): Remove duplicate; use objc_implementation_context instead: (method_context): Remove duplicate; use objc_method_context instead. (objc_ellipsis_node, objc_method_prototype_template, implemented_classes, function_type): Move global vars to objc_global_trees. (init_objc): Use LAST_BASE_TREE_CODE instead of LAST_CODE. (build_message_expr): Move actual construction of ObjC message send nodes to finish_message_expr. (finish_message_expr): New routine, contains code formerly in build_message_expr. * objc/objc-act.h (finish_message_expr): New prototype. (objc_ivar_chain, objc_method_context, objc_ellipsis_node): Remove declarations; these vars are now part of objc_global_trees. (objc_tree_index, objc_global_trees): Move definitions from objc-act.c. * objc/objc-tree.def: Update copyright info. From-SVN: r46000
2001-10-04 00:05:57 +02:00
tree objc_global_trees[OCTI_MAX];
1992-01-18 00:15:38 +01:00
static void handle_impent (struct imp_entry *);
c-parse.in (objc_inherit_code, [...]): Make static. 2001-10-03 Ziemowit Laski <zlaski@apple.com> * c-parse.in (objc_inherit_code, objc_pq_context, objc_public_flag): Make static. (objc_interface_context, objc_implementation_context, objc_method_context, objc_ivar_chain, objc_ivar_context): Move to global tree array in objc/objc-act.[ch]. (methoddef): Remove unnecessary code. * objc/objc-act.c: (hashed_attribute, hashed_entry, imp_entry): Hoist struct definitions to objc-act.h. (nst_method_hash_list, cls_method_hash_list, imp_list, imp_count, cat_count): Place declaration in objc-act.h. (objc_tree_index): Move enumeration to objc-act.h. (objc_global_trees): Place declaration and macro accessors in objc-act.h. (implementation_context): Remove duplicate; use objc_implementation_context instead: (method_context): Remove duplicate; use objc_method_context instead. (objc_ellipsis_node, objc_method_prototype_template, implemented_classes, function_type): Move global vars to objc_global_trees. (init_objc): Use LAST_BASE_TREE_CODE instead of LAST_CODE. (build_message_expr): Move actual construction of ObjC message send nodes to finish_message_expr. (finish_message_expr): New routine, contains code formerly in build_message_expr. * objc/objc-act.h (finish_message_expr): New prototype. (objc_ivar_chain, objc_method_context, objc_ellipsis_node): Remove declarations; these vars are now part of objc_global_trees. (objc_tree_index, objc_global_trees): Move definitions from objc-act.c. * objc/objc-tree.def: Update copyright info. From-SVN: r46000
2001-10-04 00:05:57 +02:00
struct imp_entry *imp_list = 0;
int imp_count = 0; /* `@implementation' */
int cat_count = 0; /* `@category' */
Makefile.in (c-parse.o): Depend on $(C_COMMON_H). [gcc/ChangeLog] 2004-09-07 Ziemowit Laski <zlaski@apple.com> * Makefile.in (c-parse.o): Depend on $(C_COMMON_H). * c-parse.in: Include c-common.h instead of objc-act.h. (ivar_decl_list, ivar_decls, ivar_decl, ivars, ivar_declarator, myparms, myparm): Remove %type declarations. (methodtype, optparms, OBJC_TYPE_QUAL, objc_quals, objc_qual, objc_typename, objc_try_catch_stmt, optellipsis): Add %type declarations. (objc_inherit_code, objc_public_flag): Remove. (typespec_nonreserved_nonattr): Call objc_get_protocol_qualified_type() instead of get_static_reference() and get_protocol_reference(). (stmt_nocomp): Call grokparm() on @catch parameter. (objcdef): Move semantic action to objc_finish_implementation(). (classdef): Move semantic action to objc_start_class_interface(), objc_continue_interface(), objc_finish_interface(), objc_start_class_implementation(), objc_continue_implementation(), objc_start_category_interface() and objc_start_category_implementation(). (protocoldef): Move semantic actions to objc_start_protocol() and objc_finish_interface(). (ivar_decl_list): Remove nonterminal. (visibility_spec): Move semantic actions to objc_set_visibility(). (ivar_decls): Remove assignment to $$. (ivar_decl): Rephrase in terms of component_decl; call objc_add_instance_variable(). (ivars, ivar_declarator): Remove nonterminals. (opt_semi): New nonterminal. (methodtype): Remove semantic actions. (methoddef): Move semantic actions to objc_set_method_type(), objc_start_method_definition() and objc_finish_method_definition(). (methodproto): Move semantic actions to objc_set_method_type() and objc_add_method_declaration(). (methoddecl): Use objc_typename instead of typename; move semantic actions to objc_build_method_signature(). (optarglist, myxdecls, mydecl, myparms, myparm): Remove nonterminals. (optparmlist): Express in terms of optparms and optellipsis. (optparms, optellipsis, objc_qual, objc_quals, objc_typename): New nonterminals. (keyworddecl): Use objc_typename instead of typename. (rid_to_yy): Mark RID_IN, RID_OUT, RID_INOUT, RID_BYCOPY, RID_BYREF and RID_ONEWAY as returning OBJC_TYPE_QUAL to yyparse(). [gcc/objc/ChangeLog] 2004-09-07 Ziemowit Laski <zlaski@apple.com> * Make-lang.in (objc/objc-parse.o): Depend on $(C_COMMON_H) instead of objc/objc-act.h. (objc/objc-act.o): Depend on $(HASHTAB_H). * objc-act.c: Include hashtab.h; in ObjC++ mode, include cp-tree.h and objcp-decl.h instead of c-tree.h. (build_module_descriptor, get_class_ivars, synth_id_with_class_suffix, error_with_ivar, gen_method_decl, gen_declaration, setup_string_decl, build_protocol_template): Adjust prototypes. (build_module_initializer_routine, start_class, continue_class, finish_class, start_method_def, objc_start_function, start_protocol, build_method_decl, objc_add_method, add_instance_variable, build_ivar_reference, is_ivar, is_private, get_super_receiver, build_selector_table_decl, objc_push_parm, objc_get_parm_info, gen_type_name, gen_type_name_0, start_var_decl, finish_var_decl, create_field_decl): New prototypes. (objc_expand_function_end, comp_method_with_proto, objc_expr_last, gen_declaration_1, gen_declarator, is_complex_decl, adorn_decl, define_decl, create_builtin_decl, gen_declspecs): Remove prototypes. (TYPE_ID): Rename to OBJECT_TYPEDEF_NAME. (CLASS_TYPEDEF_NAME): New. (TAG_EXECCLASS): Change from a global variable to a #define. (TAG_RETURN_STRUCT): Delete. (TAG_GNUINIT): New, holds '__objc_gnu_init' name. (objc_inherit_code, objc_public_flag): New, moved from c-parse.in. (string_descriptor): New struct. (string_htab): New hash table. (string_hash, string_eq): New prototypes. (generate_struct_by_value_array): Call create_field_decl() instead of create_builtin_decl(). (objc_init): Do not initialize objc_ellipsis_node or TAG_EXECCLASS; In ObjC++ mode, call cxx_init() instead of c_objc_common_init(). (objc_finish_file): In ObjC++, call instantiate_pending_templates() and cp_finish_file(). (define_decl, get_static_reference, get_protocol_reference, create_builtin_decl): Remove functions. (objc_start_class_interface, objc_start_category_interface, objc_start_protocol, objc_continue_interface, objc_finish_interface, objc_start_class_implementation, objc_start_category_implementation, objc_continue_implementation, objc_finish_implementation, objc_set_visibility, objc_set_method_type, objc_build_method_signature, objc_add_method_declaration, objc_start_method_definition, objc_add_instance_variable, objc_get_protocol_qualified_type, create_field_decl, start_var_decl, finish_var_decl): New functions. (setup_string_decl): Simplify since it is only called once. (synth_module_prologue): Call build_class_template(); predefine 'id' and 'Class' as typedefs; rename 'temp_type' to 'type'; disable debug hooks for duration of function; fix GNU runtime messenger signatures to correspond to reality; forward-declare '__objc_exec_class' for the GNU runtime; call build_selector_table_decl(); in ObjC++ mode, generate 'extern "C" { ... }' wrappers around synthesized declarations; call build_protocol_template() and build_category_template(). (string_hash, string_eq): New functions. (objc_build_string_object): Check metaclass correctness only once; store string literals in hash table. (objc_build_constructor): Do not convert initializer elements; adjust for ObjC++ impedance mismatch. (build_objc_symtab_template): Call create_field_decl() instead of create_builtin_decl(). (init_objc_symtab): Add missing conversion to initializer element. (build_metadata_decl): Call start_var_decl() instead of define_decl(). (generate_objc_symtab_decl): Do not call build_category_template(); call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(). (build_module_descriptor): Call create_field_decl() instead of grokfield(); call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(); always mark module descriptor as used; move GNU runtime-specific functionality to build_module_initializer_routine(). (build_module_initializer_routine): New function, broken off of build_module_descriptor(). (objc_static_init_needed_p, objc_generate_static_init_call): New functions. (generate_static_references, generate_strings, build_selector_translation_table, generate_descriptor_table, generate_ivars_list, generate_dispatch_table, generate_category): Call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(); build a type directly instead of via groktypename(). (build_selector_reference_decl, build_selector_table_decl, build_class_reference_decl, build_protocol_reference, generate_objc_image_info): Call start_var_decl() instead of build_decl(). (build_selector_reference): For GNU runtime, do not call build_selector_reference_decl(). (build_selector, build_typed_selector_reference): Always convert result to the selector type. (add_objc_string): Cast return value to 'char *'. (build_method_prototype_template, build_selector_template, build_method_template): Use actual selector type for fields pointing to selectors. (finish_objc): For GNU runtime, call build_module_initializer_routine() after build_module_descriptor(). (generate_protocol_list, generate_shared_structures): Call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(); build a type directly instead of via groktypename(). (synth_id_with_class_suffix): Return a string. (get_arg_type_list): For instance methods, use the instance type for 'self'; do not call groktypename_in_parm_context(). (build_objc_string_decl): Squash redeclaration errors in ObjC++. (objc_is_class_name): Use OBJC_TYPE_NAME instead of TYPE_NAME; handle RECORD_TYPEs in ObjC as well as ObjC++. (objc_is_id): New function. (objc_is_object_ptr): Return the canonical type node. (objc_get_class_ivars): Simplify using get_class_ivars(). (get_class_ivars): Remove second parameter; create a fresh copy of the ivar list for each call; do not check for existence of super class. (objc_eh_runtime_type): Mark #ifndef OBJCPLUS. (objc_init_exceptions): When using SJLJ-style exceptions, require the use of '-fobjc-exceptions' flag; do not require it for DWARF-style exceptions. (objc_build_exc_ptr, next_sjlj_build_try_catch_finally): Use objc_object_type instead of objc_id_type. (objc_begin_catch_clause): Convert the incoming PARM_DECL into a VAR_DECL before placing it in the appropriate scope; do not call define_decl(); adjust call to c_begin_compound_stmt(); use objc_object_type instead of objc_id_type. (build_next_objc_exception_stuff): Call create_field_decl() instead of create_builtin_decl(); construct type directly instead of calling groktypename(); use OBJC_VOID_AT_END to mark end of function parameters. (build_private_template): Adjust call to get_class_ivars(); build a type directly instead of via groktypename(). (build_protocol_template, build_method_prototype_list_template, build_method_prototype_template, build_category_template, build_selector_template, build_class_template, build_super_template, build_ivar_template, build_ivar_list_template, build_method_list_template, build_method_template): Call create_field_decl() instead of grokfield(). (objc_method_parm_type): Do not call groktypename(). (generate_descriptor_table): Call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(). (generate_method_descriptors, build_protocol_initializer, generate_dispatch_tables, build_category_initializer, build_shared_structure_initializer): Do not call groktypename(). (generate_protocols): Call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(); do not call groktypename(). (error_with_ivar): Remove last parameter. (check_ivars): Do not iterate ovar CLASS_RAW_IVARS lists in addition to CLASS_IVARS lists; adjust calls to error_with_ivar(). (generate_ivar_lists): Convert one of the initializer elements; do not call groktypename(). (get_arg_type_list, start_method_def, gen_method_def): Account for new representation of variable arguments and '...' in Objective-C methods; add Objective-C++ impedance matching code. (is_objc_type_qualifier): Remove function. (adjust_type_for_id_default): Simplify; there is no longer a need to wade through declspecs. (lookup_interface, start_class, continue_class, finish_class, start_method_def, start_protocol, build_method_decl, objc_add_method, add_instance_variable, build_ivar_reference, is_ivar, is_private, get_super_receiver, objc_build_finally_epilogue): Make into static functions. (receiver_is_class_object): Use new IS_CLASS() macro. (objc_build_message_expr): Tweak ObjC++ message argument handling; call objc_finish_message_expr() instead of finish_message_expr(). (finish_message_expr): Rename to objc_finish_message_expr(); use OBJC_TYPE_NAME and OBJC_SET_TYPE_NAME macros instead of TYPE_NAME. call gen_type_name() instead of gen_declaration(); call objc_is_id() instead of using IS_ID and IS_CLASS; Use objc_class_name instead of calling get_identifier("Class"); handle CONVERT_EXPRs in receiver. (build_objc_method_call, warn_with_method): Do not call groktypename(). (build_ivar_reference): Call convert() instead of clobbering in a type. (hash_init): Initialize string_htab hash table. (add_instance_variable): Simplify parameter list; do not call grokfield(); do not populate CLASS_IVARS list. (start_class): Check for the existence of super class, if one was specified. (continue_class): Use CLASS_RAW_IVARS rather than CLASS_IVARS; do not call build_class_template(); adjust call to get_class_ivars(); call build_decl(), pushdecl() and finish_decl() instead of define_decl(). (finish_class): Call build_decl(), pushdecl() and finish_decl() instead of define_decl(). (add_protocols): Use PROTOCOL_BINFO_ELTS for the tree vector size. (start_protocol): Do not call build_protocol_template(); use PROTOCOL_BINFO_ELTS for the tree vector size. (encode_type_qualifiers): Do not handle the 'const' qualifier here. (encode_pointer): Encode 'const char *' as 'r*', for backwards compatibility. (encode_array): Use HOST_WIDE_INT_PRINT_DEC instead of "%ld". (encode_type): Handle the 'const' qualifier here. (objc_parmlist): New global variable, sued by objc_push_parm and objc_get_parm_info(). (objc_push_parm, objc_get_parm_info): New functions. (objc_expr_last): Remove function. (synth_self_and_ucmd_args): For instance methods, use the instance type for 'self'; call objc_push_parm() instead of push_parm_decl(). (start_method_def): Do not call push_scope(), declare_parm_level(), pop_scope(), push_parm_decl(), store_parm_decls() or objc_expr_last(); just use objc_push_parm() and objc_get_parm_info(). (comp_method_with_proto): Remove function. (objc_types_are_equivalent): Strip away indirections before comparing underlying types. (comp_proto_with_proto): Do not call groktypename(); types are no longer in raw declspec format. (objc_start_function): New function. (really_start_method): Call comp_proto_with_proto() instead of comp_method_with_proto(); call objc_start_function() instead of hand-crafting a function declarator. (continue_method_def, objc_expand_function_end): Remove functions. (get_super_receiver): Call objc_get_current_scope() instead of get_current_scope(); reference 'super_class' field (instead of 'class'). (finish_method_def): Rename to objc_finish_method_definition() and add a function decl parameter; move method encoding call from objc_expand_function_end(). (is_complex_decl, adorn_decl, gen_declarator, gen_declspecs, gen_declaration_1): Remove functions. (tmpbuf, RAW_DECLSPEC): Remove. (gen_declaration): Remove second parameter; simplify to deal with TYPE_P nodes instead of raw declspecs. (gen_type_name, gen_type_name_0): New functions. (gen_method_decl): Remove second parameter; call gen_type_name() instead of gen_declaration_1(). (dump_interface): Adjust calls to gen_declaration() and gen_method_decl(); do not allocate a separate string buffer. (init_objc): Allocate a larger string buffer to accommodate dump_interface(); adjust call to build_module_descriptor(); add call to build_module_initializer_routine() for the GNU runtime. (generate_classref_translation_entry): Do not call start_decl(); call finish_var_decl() instead of finish_decl(); call convert() instead of build_c_cast(). * objc-act.h (CLASS_OWN_IVARS): Remove accessor. (CLASS_BINFO_ELTS): Reduce from 6 to 5, now that CLASS_OWN_IVARS is gone. (OCTI_GNU_INIT_DECL, GNU_INIT_decl): New. (OCTI_ELLIPSIS_NODE, objc_ellipsis_node): Remove. (OCTI_ID_ID, id_type, objc_id_id): Rename to OCTI_ID_NAME, objc_object_type and objc_object_name, respectively. (OCTI_CLS_REF, OCTI_CLASS_NAME, objc_class_reference, objc_class_name): New. (IS_CLASS): New macro. (IS_ID, IS_SUPER): Robustify. (OCTI_EXECCLASS_DECL, execclass_decl): New. (finish_file, start_class, continue_class, finish_class, start_method_def, continue_method_def, finish_method_def, start_protocol, finish_protocol, objc_build_throw_stmt, objc_build_try_catch_finally_stmt, objc_build_synchronized_prologue, objc_build_synchronized_epilogue, objc_build_try_prologue, objc_build_try_epilogue, objc_build_catch_stmt, objc_build_catch_epilogue, objc_build_finally_prologue, objc_build_finally_epilogue, is_ivar, is_private, is_public, add_instance_variable, objc_add_method, get_super_receiver, objc_clear_super_receiver, get_class_ivars_from_name, get_class_reference, get_static_reference, get_object_reference, build_message_expr, finish_message_expr, build_selector_expr, build_ivar_reference, build_keyword_decl, build_method_decl, build_protocol_expr, build_objc_string_object, objc_declare_alias, objc_declare_class, objc_declare_protocols, objc_comptypes, objc_check_decl, build_encode_expr): Remove prototypes. (imp_count, cat_count): Make GGC-aware. (OBJC_SET_TYPE_NAME): New macro. From-SVN: r87168
2004-09-08 02:49:44 +02:00
enum tree_code objc_inherit_code;
int objc_public_flag;
/* Use to generate method labels. */
static int method_slot = 0;
1992-01-18 00:15:38 +01:00
#define BUFSIZE 1024
1992-01-18 00:15:38 +01:00
static char *errbuf; /* Buffer for error diagnostics */
1992-01-18 00:15:38 +01:00
1996-07-04 00:07:53 +02:00
/* Data imported from tree.c. */
1992-01-18 00:15:38 +01:00
extern enum debug_info_type write_symbols;
1992-01-18 00:15:38 +01:00
/* Data imported from toplev.c. */
1992-01-18 00:15:38 +01:00
extern const char *dump_base_name;
1992-01-18 00:15:38 +01:00
static int flag_typed_selectors;
1992-01-18 00:15:38 +01:00
Makefile.in (c-parse.o): Depend on $(C_COMMON_H). [gcc/ChangeLog] 2004-09-07 Ziemowit Laski <zlaski@apple.com> * Makefile.in (c-parse.o): Depend on $(C_COMMON_H). * c-parse.in: Include c-common.h instead of objc-act.h. (ivar_decl_list, ivar_decls, ivar_decl, ivars, ivar_declarator, myparms, myparm): Remove %type declarations. (methodtype, optparms, OBJC_TYPE_QUAL, objc_quals, objc_qual, objc_typename, objc_try_catch_stmt, optellipsis): Add %type declarations. (objc_inherit_code, objc_public_flag): Remove. (typespec_nonreserved_nonattr): Call objc_get_protocol_qualified_type() instead of get_static_reference() and get_protocol_reference(). (stmt_nocomp): Call grokparm() on @catch parameter. (objcdef): Move semantic action to objc_finish_implementation(). (classdef): Move semantic action to objc_start_class_interface(), objc_continue_interface(), objc_finish_interface(), objc_start_class_implementation(), objc_continue_implementation(), objc_start_category_interface() and objc_start_category_implementation(). (protocoldef): Move semantic actions to objc_start_protocol() and objc_finish_interface(). (ivar_decl_list): Remove nonterminal. (visibility_spec): Move semantic actions to objc_set_visibility(). (ivar_decls): Remove assignment to $$. (ivar_decl): Rephrase in terms of component_decl; call objc_add_instance_variable(). (ivars, ivar_declarator): Remove nonterminals. (opt_semi): New nonterminal. (methodtype): Remove semantic actions. (methoddef): Move semantic actions to objc_set_method_type(), objc_start_method_definition() and objc_finish_method_definition(). (methodproto): Move semantic actions to objc_set_method_type() and objc_add_method_declaration(). (methoddecl): Use objc_typename instead of typename; move semantic actions to objc_build_method_signature(). (optarglist, myxdecls, mydecl, myparms, myparm): Remove nonterminals. (optparmlist): Express in terms of optparms and optellipsis. (optparms, optellipsis, objc_qual, objc_quals, objc_typename): New nonterminals. (keyworddecl): Use objc_typename instead of typename. (rid_to_yy): Mark RID_IN, RID_OUT, RID_INOUT, RID_BYCOPY, RID_BYREF and RID_ONEWAY as returning OBJC_TYPE_QUAL to yyparse(). [gcc/objc/ChangeLog] 2004-09-07 Ziemowit Laski <zlaski@apple.com> * Make-lang.in (objc/objc-parse.o): Depend on $(C_COMMON_H) instead of objc/objc-act.h. (objc/objc-act.o): Depend on $(HASHTAB_H). * objc-act.c: Include hashtab.h; in ObjC++ mode, include cp-tree.h and objcp-decl.h instead of c-tree.h. (build_module_descriptor, get_class_ivars, synth_id_with_class_suffix, error_with_ivar, gen_method_decl, gen_declaration, setup_string_decl, build_protocol_template): Adjust prototypes. (build_module_initializer_routine, start_class, continue_class, finish_class, start_method_def, objc_start_function, start_protocol, build_method_decl, objc_add_method, add_instance_variable, build_ivar_reference, is_ivar, is_private, get_super_receiver, build_selector_table_decl, objc_push_parm, objc_get_parm_info, gen_type_name, gen_type_name_0, start_var_decl, finish_var_decl, create_field_decl): New prototypes. (objc_expand_function_end, comp_method_with_proto, objc_expr_last, gen_declaration_1, gen_declarator, is_complex_decl, adorn_decl, define_decl, create_builtin_decl, gen_declspecs): Remove prototypes. (TYPE_ID): Rename to OBJECT_TYPEDEF_NAME. (CLASS_TYPEDEF_NAME): New. (TAG_EXECCLASS): Change from a global variable to a #define. (TAG_RETURN_STRUCT): Delete. (TAG_GNUINIT): New, holds '__objc_gnu_init' name. (objc_inherit_code, objc_public_flag): New, moved from c-parse.in. (string_descriptor): New struct. (string_htab): New hash table. (string_hash, string_eq): New prototypes. (generate_struct_by_value_array): Call create_field_decl() instead of create_builtin_decl(). (objc_init): Do not initialize objc_ellipsis_node or TAG_EXECCLASS; In ObjC++ mode, call cxx_init() instead of c_objc_common_init(). (objc_finish_file): In ObjC++, call instantiate_pending_templates() and cp_finish_file(). (define_decl, get_static_reference, get_protocol_reference, create_builtin_decl): Remove functions. (objc_start_class_interface, objc_start_category_interface, objc_start_protocol, objc_continue_interface, objc_finish_interface, objc_start_class_implementation, objc_start_category_implementation, objc_continue_implementation, objc_finish_implementation, objc_set_visibility, objc_set_method_type, objc_build_method_signature, objc_add_method_declaration, objc_start_method_definition, objc_add_instance_variable, objc_get_protocol_qualified_type, create_field_decl, start_var_decl, finish_var_decl): New functions. (setup_string_decl): Simplify since it is only called once. (synth_module_prologue): Call build_class_template(); predefine 'id' and 'Class' as typedefs; rename 'temp_type' to 'type'; disable debug hooks for duration of function; fix GNU runtime messenger signatures to correspond to reality; forward-declare '__objc_exec_class' for the GNU runtime; call build_selector_table_decl(); in ObjC++ mode, generate 'extern "C" { ... }' wrappers around synthesized declarations; call build_protocol_template() and build_category_template(). (string_hash, string_eq): New functions. (objc_build_string_object): Check metaclass correctness only once; store string literals in hash table. (objc_build_constructor): Do not convert initializer elements; adjust for ObjC++ impedance mismatch. (build_objc_symtab_template): Call create_field_decl() instead of create_builtin_decl(). (init_objc_symtab): Add missing conversion to initializer element. (build_metadata_decl): Call start_var_decl() instead of define_decl(). (generate_objc_symtab_decl): Do not call build_category_template(); call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(). (build_module_descriptor): Call create_field_decl() instead of grokfield(); call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(); always mark module descriptor as used; move GNU runtime-specific functionality to build_module_initializer_routine(). (build_module_initializer_routine): New function, broken off of build_module_descriptor(). (objc_static_init_needed_p, objc_generate_static_init_call): New functions. (generate_static_references, generate_strings, build_selector_translation_table, generate_descriptor_table, generate_ivars_list, generate_dispatch_table, generate_category): Call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(); build a type directly instead of via groktypename(). (build_selector_reference_decl, build_selector_table_decl, build_class_reference_decl, build_protocol_reference, generate_objc_image_info): Call start_var_decl() instead of build_decl(). (build_selector_reference): For GNU runtime, do not call build_selector_reference_decl(). (build_selector, build_typed_selector_reference): Always convert result to the selector type. (add_objc_string): Cast return value to 'char *'. (build_method_prototype_template, build_selector_template, build_method_template): Use actual selector type for fields pointing to selectors. (finish_objc): For GNU runtime, call build_module_initializer_routine() after build_module_descriptor(). (generate_protocol_list, generate_shared_structures): Call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(); build a type directly instead of via groktypename(). (synth_id_with_class_suffix): Return a string. (get_arg_type_list): For instance methods, use the instance type for 'self'; do not call groktypename_in_parm_context(). (build_objc_string_decl): Squash redeclaration errors in ObjC++. (objc_is_class_name): Use OBJC_TYPE_NAME instead of TYPE_NAME; handle RECORD_TYPEs in ObjC as well as ObjC++. (objc_is_id): New function. (objc_is_object_ptr): Return the canonical type node. (objc_get_class_ivars): Simplify using get_class_ivars(). (get_class_ivars): Remove second parameter; create a fresh copy of the ivar list for each call; do not check for existence of super class. (objc_eh_runtime_type): Mark #ifndef OBJCPLUS. (objc_init_exceptions): When using SJLJ-style exceptions, require the use of '-fobjc-exceptions' flag; do not require it for DWARF-style exceptions. (objc_build_exc_ptr, next_sjlj_build_try_catch_finally): Use objc_object_type instead of objc_id_type. (objc_begin_catch_clause): Convert the incoming PARM_DECL into a VAR_DECL before placing it in the appropriate scope; do not call define_decl(); adjust call to c_begin_compound_stmt(); use objc_object_type instead of objc_id_type. (build_next_objc_exception_stuff): Call create_field_decl() instead of create_builtin_decl(); construct type directly instead of calling groktypename(); use OBJC_VOID_AT_END to mark end of function parameters. (build_private_template): Adjust call to get_class_ivars(); build a type directly instead of via groktypename(). (build_protocol_template, build_method_prototype_list_template, build_method_prototype_template, build_category_template, build_selector_template, build_class_template, build_super_template, build_ivar_template, build_ivar_list_template, build_method_list_template, build_method_template): Call create_field_decl() instead of grokfield(). (objc_method_parm_type): Do not call groktypename(). (generate_descriptor_table): Call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(). (generate_method_descriptors, build_protocol_initializer, generate_dispatch_tables, build_category_initializer, build_shared_structure_initializer): Do not call groktypename(). (generate_protocols): Call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(); do not call groktypename(). (error_with_ivar): Remove last parameter. (check_ivars): Do not iterate ovar CLASS_RAW_IVARS lists in addition to CLASS_IVARS lists; adjust calls to error_with_ivar(). (generate_ivar_lists): Convert one of the initializer elements; do not call groktypename(). (get_arg_type_list, start_method_def, gen_method_def): Account for new representation of variable arguments and '...' in Objective-C methods; add Objective-C++ impedance matching code. (is_objc_type_qualifier): Remove function. (adjust_type_for_id_default): Simplify; there is no longer a need to wade through declspecs. (lookup_interface, start_class, continue_class, finish_class, start_method_def, start_protocol, build_method_decl, objc_add_method, add_instance_variable, build_ivar_reference, is_ivar, is_private, get_super_receiver, objc_build_finally_epilogue): Make into static functions. (receiver_is_class_object): Use new IS_CLASS() macro. (objc_build_message_expr): Tweak ObjC++ message argument handling; call objc_finish_message_expr() instead of finish_message_expr(). (finish_message_expr): Rename to objc_finish_message_expr(); use OBJC_TYPE_NAME and OBJC_SET_TYPE_NAME macros instead of TYPE_NAME. call gen_type_name() instead of gen_declaration(); call objc_is_id() instead of using IS_ID and IS_CLASS; Use objc_class_name instead of calling get_identifier("Class"); handle CONVERT_EXPRs in receiver. (build_objc_method_call, warn_with_method): Do not call groktypename(). (build_ivar_reference): Call convert() instead of clobbering in a type. (hash_init): Initialize string_htab hash table. (add_instance_variable): Simplify parameter list; do not call grokfield(); do not populate CLASS_IVARS list. (start_class): Check for the existence of super class, if one was specified. (continue_class): Use CLASS_RAW_IVARS rather than CLASS_IVARS; do not call build_class_template(); adjust call to get_class_ivars(); call build_decl(), pushdecl() and finish_decl() instead of define_decl(). (finish_class): Call build_decl(), pushdecl() and finish_decl() instead of define_decl(). (add_protocols): Use PROTOCOL_BINFO_ELTS for the tree vector size. (start_protocol): Do not call build_protocol_template(); use PROTOCOL_BINFO_ELTS for the tree vector size. (encode_type_qualifiers): Do not handle the 'const' qualifier here. (encode_pointer): Encode 'const char *' as 'r*', for backwards compatibility. (encode_array): Use HOST_WIDE_INT_PRINT_DEC instead of "%ld". (encode_type): Handle the 'const' qualifier here. (objc_parmlist): New global variable, sued by objc_push_parm and objc_get_parm_info(). (objc_push_parm, objc_get_parm_info): New functions. (objc_expr_last): Remove function. (synth_self_and_ucmd_args): For instance methods, use the instance type for 'self'; call objc_push_parm() instead of push_parm_decl(). (start_method_def): Do not call push_scope(), declare_parm_level(), pop_scope(), push_parm_decl(), store_parm_decls() or objc_expr_last(); just use objc_push_parm() and objc_get_parm_info(). (comp_method_with_proto): Remove function. (objc_types_are_equivalent): Strip away indirections before comparing underlying types. (comp_proto_with_proto): Do not call groktypename(); types are no longer in raw declspec format. (objc_start_function): New function. (really_start_method): Call comp_proto_with_proto() instead of comp_method_with_proto(); call objc_start_function() instead of hand-crafting a function declarator. (continue_method_def, objc_expand_function_end): Remove functions. (get_super_receiver): Call objc_get_current_scope() instead of get_current_scope(); reference 'super_class' field (instead of 'class'). (finish_method_def): Rename to objc_finish_method_definition() and add a function decl parameter; move method encoding call from objc_expand_function_end(). (is_complex_decl, adorn_decl, gen_declarator, gen_declspecs, gen_declaration_1): Remove functions. (tmpbuf, RAW_DECLSPEC): Remove. (gen_declaration): Remove second parameter; simplify to deal with TYPE_P nodes instead of raw declspecs. (gen_type_name, gen_type_name_0): New functions. (gen_method_decl): Remove second parameter; call gen_type_name() instead of gen_declaration_1(). (dump_interface): Adjust calls to gen_declaration() and gen_method_decl(); do not allocate a separate string buffer. (init_objc): Allocate a larger string buffer to accommodate dump_interface(); adjust call to build_module_descriptor(); add call to build_module_initializer_routine() for the GNU runtime. (generate_classref_translation_entry): Do not call start_decl(); call finish_var_decl() instead of finish_decl(); call convert() instead of build_c_cast(). * objc-act.h (CLASS_OWN_IVARS): Remove accessor. (CLASS_BINFO_ELTS): Reduce from 6 to 5, now that CLASS_OWN_IVARS is gone. (OCTI_GNU_INIT_DECL, GNU_INIT_decl): New. (OCTI_ELLIPSIS_NODE, objc_ellipsis_node): Remove. (OCTI_ID_ID, id_type, objc_id_id): Rename to OCTI_ID_NAME, objc_object_type and objc_object_name, respectively. (OCTI_CLS_REF, OCTI_CLASS_NAME, objc_class_reference, objc_class_name): New. (IS_CLASS): New macro. (IS_ID, IS_SUPER): Robustify. (OCTI_EXECCLASS_DECL, execclass_decl): New. (finish_file, start_class, continue_class, finish_class, start_method_def, continue_method_def, finish_method_def, start_protocol, finish_protocol, objc_build_throw_stmt, objc_build_try_catch_finally_stmt, objc_build_synchronized_prologue, objc_build_synchronized_epilogue, objc_build_try_prologue, objc_build_try_epilogue, objc_build_catch_stmt, objc_build_catch_epilogue, objc_build_finally_prologue, objc_build_finally_epilogue, is_ivar, is_private, is_public, add_instance_variable, objc_add_method, get_super_receiver, objc_clear_super_receiver, get_class_ivars_from_name, get_class_reference, get_static_reference, get_object_reference, build_message_expr, finish_message_expr, build_selector_expr, build_ivar_reference, build_keyword_decl, build_method_decl, build_protocol_expr, build_objc_string_object, objc_declare_alias, objc_declare_class, objc_declare_protocols, objc_comptypes, objc_check_decl, build_encode_expr): Remove prototypes. (imp_count, cat_count): Make GGC-aware. (OBJC_SET_TYPE_NAME): New macro. From-SVN: r87168
2004-09-08 02:49:44 +02:00
/* Store all constructed constant strings in a hash table so that
they get uniqued properly. */
struct string_descriptor GTY(())
{
/* The literal argument . */
tree literal;
/* The resulting constant string. */
tree constructor;
};
static GTY((param_is (struct string_descriptor))) htab_t string_htab;
objc-act.c (objc_build_struct): New function. * objc-act.c (objc_build_struct): New function. (objc_derived_from_p): Likewise. (objc_build_component_ref): Likewise. (objc_copy_binfo): Likewise. (objc_xref_basetypes): Likewise. (objc_lookup_protocol): Likewise. (objc_compare_protocols): Likewise. (objc_volatilize_decl): Likewise. (encode_aggregate_fields): Likewise. (volatilized_hash): Likewise. (volatilized_eq): Likewise. (objc_compare_types): Likewise. (objc_type_quals_match): Likewise. (DERIVED_FROM_P): New ObjC macro, corresponding to C++ macro of same name. (get_class_ivars): Add second parameter indicating if entire hierarchy is desired. (struct volatilized_type): New type. (volatilized_htab): New hash table. (objc_types_compatible_p, objc_comptypes): Remove functions. (synth_module_prologue): Do not initialize 'unused_list'. (objc_get_class_reference): Fix ObjC++ impedance mismatches. (objc_declare_alias): Implement as a typedef. (objc_substitute_decl, objc_gimplify_expr): Reformat. (objc_get_class_ivars): Adjust call to get_class_ivars(). (next_sjlj_build_enter_and_setjmp, synth_forward_declarations, build_ivar_reference, get_super_receiver): Call objc_build_component_ref() instead of build_component_ref(). (objc_begin_catch_clause): Use DERIVED_FROM_P() instead of objc_comptypes(). (build_private_template): Call objc_build_struct() instead of start_struct() and finish_struct(). (hash_init): Initialize volatilized_htab. (objc_is_public): Adjust calls to objc_get_ivars(); adjust ObjC++ impedance mismatches. (encode_aggregate_within): Streamline by calling encode_aggregate_fields(). * objc-act.h (objc_types_compatible_p): Remove prototype. (OCTI_UNUSED_LIST, unused_list): Remove slot. * objc-lang.c (LANG_HOOKS_TYPES_COMPATIBLE_P): Remove. From-SVN: r100123
2005-05-25 00:21:01 +02:00
/* Store the EH-volatilized types in a hash table, for easy retrieval. */
struct volatilized_type GTY(())
{
tree type;
};
static GTY((param_is (struct volatilized_type))) htab_t volatilized_htab;
1992-01-18 00:15:38 +01:00
FILE *gen_declaration_file;
/* Tells "encode_pointer/encode_aggregate" whether we are generating
type descriptors for instance variables (as opposed to methods).
Type descriptors for instance variables contain more information
than methods (for static typing and embedded structures). */
static int generating_instance_variables = 0;
/* Some platforms pass small structures through registers versus
through an invisible pointer. Determine at what size structure is
the transition point between the two possibilities. */
static void
generate_struct_by_value_array (void)
{
tree type;
tree field_decl, field_decl_chain;
int i, j;
int aggregate_in_mem[32];
int found = 0;
/* Presumably no platform passes 32 byte structures in a register. */
for (i = 1; i < 32; i++)
{
char buffer[5];
/* Create an unnamed struct that has `i' character components */
type = start_struct (RECORD_TYPE, NULL_TREE);
strcpy (buffer, "c1");
Makefile.in (c-parse.o): Depend on $(C_COMMON_H). [gcc/ChangeLog] 2004-09-07 Ziemowit Laski <zlaski@apple.com> * Makefile.in (c-parse.o): Depend on $(C_COMMON_H). * c-parse.in: Include c-common.h instead of objc-act.h. (ivar_decl_list, ivar_decls, ivar_decl, ivars, ivar_declarator, myparms, myparm): Remove %type declarations. (methodtype, optparms, OBJC_TYPE_QUAL, objc_quals, objc_qual, objc_typename, objc_try_catch_stmt, optellipsis): Add %type declarations. (objc_inherit_code, objc_public_flag): Remove. (typespec_nonreserved_nonattr): Call objc_get_protocol_qualified_type() instead of get_static_reference() and get_protocol_reference(). (stmt_nocomp): Call grokparm() on @catch parameter. (objcdef): Move semantic action to objc_finish_implementation(). (classdef): Move semantic action to objc_start_class_interface(), objc_continue_interface(), objc_finish_interface(), objc_start_class_implementation(), objc_continue_implementation(), objc_start_category_interface() and objc_start_category_implementation(). (protocoldef): Move semantic actions to objc_start_protocol() and objc_finish_interface(). (ivar_decl_list): Remove nonterminal. (visibility_spec): Move semantic actions to objc_set_visibility(). (ivar_decls): Remove assignment to $$. (ivar_decl): Rephrase in terms of component_decl; call objc_add_instance_variable(). (ivars, ivar_declarator): Remove nonterminals. (opt_semi): New nonterminal. (methodtype): Remove semantic actions. (methoddef): Move semantic actions to objc_set_method_type(), objc_start_method_definition() and objc_finish_method_definition(). (methodproto): Move semantic actions to objc_set_method_type() and objc_add_method_declaration(). (methoddecl): Use objc_typename instead of typename; move semantic actions to objc_build_method_signature(). (optarglist, myxdecls, mydecl, myparms, myparm): Remove nonterminals. (optparmlist): Express in terms of optparms and optellipsis. (optparms, optellipsis, objc_qual, objc_quals, objc_typename): New nonterminals. (keyworddecl): Use objc_typename instead of typename. (rid_to_yy): Mark RID_IN, RID_OUT, RID_INOUT, RID_BYCOPY, RID_BYREF and RID_ONEWAY as returning OBJC_TYPE_QUAL to yyparse(). [gcc/objc/ChangeLog] 2004-09-07 Ziemowit Laski <zlaski@apple.com> * Make-lang.in (objc/objc-parse.o): Depend on $(C_COMMON_H) instead of objc/objc-act.h. (objc/objc-act.o): Depend on $(HASHTAB_H). * objc-act.c: Include hashtab.h; in ObjC++ mode, include cp-tree.h and objcp-decl.h instead of c-tree.h. (build_module_descriptor, get_class_ivars, synth_id_with_class_suffix, error_with_ivar, gen_method_decl, gen_declaration, setup_string_decl, build_protocol_template): Adjust prototypes. (build_module_initializer_routine, start_class, continue_class, finish_class, start_method_def, objc_start_function, start_protocol, build_method_decl, objc_add_method, add_instance_variable, build_ivar_reference, is_ivar, is_private, get_super_receiver, build_selector_table_decl, objc_push_parm, objc_get_parm_info, gen_type_name, gen_type_name_0, start_var_decl, finish_var_decl, create_field_decl): New prototypes. (objc_expand_function_end, comp_method_with_proto, objc_expr_last, gen_declaration_1, gen_declarator, is_complex_decl, adorn_decl, define_decl, create_builtin_decl, gen_declspecs): Remove prototypes. (TYPE_ID): Rename to OBJECT_TYPEDEF_NAME. (CLASS_TYPEDEF_NAME): New. (TAG_EXECCLASS): Change from a global variable to a #define. (TAG_RETURN_STRUCT): Delete. (TAG_GNUINIT): New, holds '__objc_gnu_init' name. (objc_inherit_code, objc_public_flag): New, moved from c-parse.in. (string_descriptor): New struct. (string_htab): New hash table. (string_hash, string_eq): New prototypes. (generate_struct_by_value_array): Call create_field_decl() instead of create_builtin_decl(). (objc_init): Do not initialize objc_ellipsis_node or TAG_EXECCLASS; In ObjC++ mode, call cxx_init() instead of c_objc_common_init(). (objc_finish_file): In ObjC++, call instantiate_pending_templates() and cp_finish_file(). (define_decl, get_static_reference, get_protocol_reference, create_builtin_decl): Remove functions. (objc_start_class_interface, objc_start_category_interface, objc_start_protocol, objc_continue_interface, objc_finish_interface, objc_start_class_implementation, objc_start_category_implementation, objc_continue_implementation, objc_finish_implementation, objc_set_visibility, objc_set_method_type, objc_build_method_signature, objc_add_method_declaration, objc_start_method_definition, objc_add_instance_variable, objc_get_protocol_qualified_type, create_field_decl, start_var_decl, finish_var_decl): New functions. (setup_string_decl): Simplify since it is only called once. (synth_module_prologue): Call build_class_template(); predefine 'id' and 'Class' as typedefs; rename 'temp_type' to 'type'; disable debug hooks for duration of function; fix GNU runtime messenger signatures to correspond to reality; forward-declare '__objc_exec_class' for the GNU runtime; call build_selector_table_decl(); in ObjC++ mode, generate 'extern "C" { ... }' wrappers around synthesized declarations; call build_protocol_template() and build_category_template(). (string_hash, string_eq): New functions. (objc_build_string_object): Check metaclass correctness only once; store string literals in hash table. (objc_build_constructor): Do not convert initializer elements; adjust for ObjC++ impedance mismatch. (build_objc_symtab_template): Call create_field_decl() instead of create_builtin_decl(). (init_objc_symtab): Add missing conversion to initializer element. (build_metadata_decl): Call start_var_decl() instead of define_decl(). (generate_objc_symtab_decl): Do not call build_category_template(); call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(). (build_module_descriptor): Call create_field_decl() instead of grokfield(); call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(); always mark module descriptor as used; move GNU runtime-specific functionality to build_module_initializer_routine(). (build_module_initializer_routine): New function, broken off of build_module_descriptor(). (objc_static_init_needed_p, objc_generate_static_init_call): New functions. (generate_static_references, generate_strings, build_selector_translation_table, generate_descriptor_table, generate_ivars_list, generate_dispatch_table, generate_category): Call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(); build a type directly instead of via groktypename(). (build_selector_reference_decl, build_selector_table_decl, build_class_reference_decl, build_protocol_reference, generate_objc_image_info): Call start_var_decl() instead of build_decl(). (build_selector_reference): For GNU runtime, do not call build_selector_reference_decl(). (build_selector, build_typed_selector_reference): Always convert result to the selector type. (add_objc_string): Cast return value to 'char *'. (build_method_prototype_template, build_selector_template, build_method_template): Use actual selector type for fields pointing to selectors. (finish_objc): For GNU runtime, call build_module_initializer_routine() after build_module_descriptor(). (generate_protocol_list, generate_shared_structures): Call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(); build a type directly instead of via groktypename(). (synth_id_with_class_suffix): Return a string. (get_arg_type_list): For instance methods, use the instance type for 'self'; do not call groktypename_in_parm_context(). (build_objc_string_decl): Squash redeclaration errors in ObjC++. (objc_is_class_name): Use OBJC_TYPE_NAME instead of TYPE_NAME; handle RECORD_TYPEs in ObjC as well as ObjC++. (objc_is_id): New function. (objc_is_object_ptr): Return the canonical type node. (objc_get_class_ivars): Simplify using get_class_ivars(). (get_class_ivars): Remove second parameter; create a fresh copy of the ivar list for each call; do not check for existence of super class. (objc_eh_runtime_type): Mark #ifndef OBJCPLUS. (objc_init_exceptions): When using SJLJ-style exceptions, require the use of '-fobjc-exceptions' flag; do not require it for DWARF-style exceptions. (objc_build_exc_ptr, next_sjlj_build_try_catch_finally): Use objc_object_type instead of objc_id_type. (objc_begin_catch_clause): Convert the incoming PARM_DECL into a VAR_DECL before placing it in the appropriate scope; do not call define_decl(); adjust call to c_begin_compound_stmt(); use objc_object_type instead of objc_id_type. (build_next_objc_exception_stuff): Call create_field_decl() instead of create_builtin_decl(); construct type directly instead of calling groktypename(); use OBJC_VOID_AT_END to mark end of function parameters. (build_private_template): Adjust call to get_class_ivars(); build a type directly instead of via groktypename(). (build_protocol_template, build_method_prototype_list_template, build_method_prototype_template, build_category_template, build_selector_template, build_class_template, build_super_template, build_ivar_template, build_ivar_list_template, build_method_list_template, build_method_template): Call create_field_decl() instead of grokfield(). (objc_method_parm_type): Do not call groktypename(). (generate_descriptor_table): Call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(). (generate_method_descriptors, build_protocol_initializer, generate_dispatch_tables, build_category_initializer, build_shared_structure_initializer): Do not call groktypename(). (generate_protocols): Call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(); do not call groktypename(). (error_with_ivar): Remove last parameter. (check_ivars): Do not iterate ovar CLASS_RAW_IVARS lists in addition to CLASS_IVARS lists; adjust calls to error_with_ivar(). (generate_ivar_lists): Convert one of the initializer elements; do not call groktypename(). (get_arg_type_list, start_method_def, gen_method_def): Account for new representation of variable arguments and '...' in Objective-C methods; add Objective-C++ impedance matching code. (is_objc_type_qualifier): Remove function. (adjust_type_for_id_default): Simplify; there is no longer a need to wade through declspecs. (lookup_interface, start_class, continue_class, finish_class, start_method_def, start_protocol, build_method_decl, objc_add_method, add_instance_variable, build_ivar_reference, is_ivar, is_private, get_super_receiver, objc_build_finally_epilogue): Make into static functions. (receiver_is_class_object): Use new IS_CLASS() macro. (objc_build_message_expr): Tweak ObjC++ message argument handling; call objc_finish_message_expr() instead of finish_message_expr(). (finish_message_expr): Rename to objc_finish_message_expr(); use OBJC_TYPE_NAME and OBJC_SET_TYPE_NAME macros instead of TYPE_NAME. call gen_type_name() instead of gen_declaration(); call objc_is_id() instead of using IS_ID and IS_CLASS; Use objc_class_name instead of calling get_identifier("Class"); handle CONVERT_EXPRs in receiver. (build_objc_method_call, warn_with_method): Do not call groktypename(). (build_ivar_reference): Call convert() instead of clobbering in a type. (hash_init): Initialize string_htab hash table. (add_instance_variable): Simplify parameter list; do not call grokfield(); do not populate CLASS_IVARS list. (start_class): Check for the existence of super class, if one was specified. (continue_class): Use CLASS_RAW_IVARS rather than CLASS_IVARS; do not call build_class_template(); adjust call to get_class_ivars(); call build_decl(), pushdecl() and finish_decl() instead of define_decl(). (finish_class): Call build_decl(), pushdecl() and finish_decl() instead of define_decl(). (add_protocols): Use PROTOCOL_BINFO_ELTS for the tree vector size. (start_protocol): Do not call build_protocol_template(); use PROTOCOL_BINFO_ELTS for the tree vector size. (encode_type_qualifiers): Do not handle the 'const' qualifier here. (encode_pointer): Encode 'const char *' as 'r*', for backwards compatibility. (encode_array): Use HOST_WIDE_INT_PRINT_DEC instead of "%ld". (encode_type): Handle the 'const' qualifier here. (objc_parmlist): New global variable, sued by objc_push_parm and objc_get_parm_info(). (objc_push_parm, objc_get_parm_info): New functions. (objc_expr_last): Remove function. (synth_self_and_ucmd_args): For instance methods, use the instance type for 'self'; call objc_push_parm() instead of push_parm_decl(). (start_method_def): Do not call push_scope(), declare_parm_level(), pop_scope(), push_parm_decl(), store_parm_decls() or objc_expr_last(); just use objc_push_parm() and objc_get_parm_info(). (comp_method_with_proto): Remove function. (objc_types_are_equivalent): Strip away indirections before comparing underlying types. (comp_proto_with_proto): Do not call groktypename(); types are no longer in raw declspec format. (objc_start_function): New function. (really_start_method): Call comp_proto_with_proto() instead of comp_method_with_proto(); call objc_start_function() instead of hand-crafting a function declarator. (continue_method_def, objc_expand_function_end): Remove functions. (get_super_receiver): Call objc_get_current_scope() instead of get_current_scope(); reference 'super_class' field (instead of 'class'). (finish_method_def): Rename to objc_finish_method_definition() and add a function decl parameter; move method encoding call from objc_expand_function_end(). (is_complex_decl, adorn_decl, gen_declarator, gen_declspecs, gen_declaration_1): Remove functions. (tmpbuf, RAW_DECLSPEC): Remove. (gen_declaration): Remove second parameter; simplify to deal with TYPE_P nodes instead of raw declspecs. (gen_type_name, gen_type_name_0): New functions. (gen_method_decl): Remove second parameter; call gen_type_name() instead of gen_declaration_1(). (dump_interface): Adjust calls to gen_declaration() and gen_method_decl(); do not allocate a separate string buffer. (init_objc): Allocate a larger string buffer to accommodate dump_interface(); adjust call to build_module_descriptor(); add call to build_module_initializer_routine() for the GNU runtime. (generate_classref_translation_entry): Do not call start_decl(); call finish_var_decl() instead of finish_decl(); call convert() instead of build_c_cast(). * objc-act.h (CLASS_OWN_IVARS): Remove accessor. (CLASS_BINFO_ELTS): Reduce from 6 to 5, now that CLASS_OWN_IVARS is gone. (OCTI_GNU_INIT_DECL, GNU_INIT_decl): New. (OCTI_ELLIPSIS_NODE, objc_ellipsis_node): Remove. (OCTI_ID_ID, id_type, objc_id_id): Rename to OCTI_ID_NAME, objc_object_type and objc_object_name, respectively. (OCTI_CLS_REF, OCTI_CLASS_NAME, objc_class_reference, objc_class_name): New. (IS_CLASS): New macro. (IS_ID, IS_SUPER): Robustify. (OCTI_EXECCLASS_DECL, execclass_decl): New. (finish_file, start_class, continue_class, finish_class, start_method_def, continue_method_def, finish_method_def, start_protocol, finish_protocol, objc_build_throw_stmt, objc_build_try_catch_finally_stmt, objc_build_synchronized_prologue, objc_build_synchronized_epilogue, objc_build_try_prologue, objc_build_try_epilogue, objc_build_catch_stmt, objc_build_catch_epilogue, objc_build_finally_prologue, objc_build_finally_epilogue, is_ivar, is_private, is_public, add_instance_variable, objc_add_method, get_super_receiver, objc_clear_super_receiver, get_class_ivars_from_name, get_class_reference, get_static_reference, get_object_reference, build_message_expr, finish_message_expr, build_selector_expr, build_ivar_reference, build_keyword_decl, build_method_decl, build_protocol_expr, build_objc_string_object, objc_declare_alias, objc_declare_class, objc_declare_protocols, objc_comptypes, objc_check_decl, build_encode_expr): Remove prototypes. (imp_count, cat_count): Make GGC-aware. (OBJC_SET_TYPE_NAME): New macro. From-SVN: r87168
2004-09-08 02:49:44 +02:00
field_decl = create_field_decl (char_type_node,
buffer);
field_decl_chain = field_decl;
for (j = 1; j < i; j++)
{
sprintf (buffer, "c%d", j + 1);
Makefile.in (c-parse.o): Depend on $(C_COMMON_H). [gcc/ChangeLog] 2004-09-07 Ziemowit Laski <zlaski@apple.com> * Makefile.in (c-parse.o): Depend on $(C_COMMON_H). * c-parse.in: Include c-common.h instead of objc-act.h. (ivar_decl_list, ivar_decls, ivar_decl, ivars, ivar_declarator, myparms, myparm): Remove %type declarations. (methodtype, optparms, OBJC_TYPE_QUAL, objc_quals, objc_qual, objc_typename, objc_try_catch_stmt, optellipsis): Add %type declarations. (objc_inherit_code, objc_public_flag): Remove. (typespec_nonreserved_nonattr): Call objc_get_protocol_qualified_type() instead of get_static_reference() and get_protocol_reference(). (stmt_nocomp): Call grokparm() on @catch parameter. (objcdef): Move semantic action to objc_finish_implementation(). (classdef): Move semantic action to objc_start_class_interface(), objc_continue_interface(), objc_finish_interface(), objc_start_class_implementation(), objc_continue_implementation(), objc_start_category_interface() and objc_start_category_implementation(). (protocoldef): Move semantic actions to objc_start_protocol() and objc_finish_interface(). (ivar_decl_list): Remove nonterminal. (visibility_spec): Move semantic actions to objc_set_visibility(). (ivar_decls): Remove assignment to $$. (ivar_decl): Rephrase in terms of component_decl; call objc_add_instance_variable(). (ivars, ivar_declarator): Remove nonterminals. (opt_semi): New nonterminal. (methodtype): Remove semantic actions. (methoddef): Move semantic actions to objc_set_method_type(), objc_start_method_definition() and objc_finish_method_definition(). (methodproto): Move semantic actions to objc_set_method_type() and objc_add_method_declaration(). (methoddecl): Use objc_typename instead of typename; move semantic actions to objc_build_method_signature(). (optarglist, myxdecls, mydecl, myparms, myparm): Remove nonterminals. (optparmlist): Express in terms of optparms and optellipsis. (optparms, optellipsis, objc_qual, objc_quals, objc_typename): New nonterminals. (keyworddecl): Use objc_typename instead of typename. (rid_to_yy): Mark RID_IN, RID_OUT, RID_INOUT, RID_BYCOPY, RID_BYREF and RID_ONEWAY as returning OBJC_TYPE_QUAL to yyparse(). [gcc/objc/ChangeLog] 2004-09-07 Ziemowit Laski <zlaski@apple.com> * Make-lang.in (objc/objc-parse.o): Depend on $(C_COMMON_H) instead of objc/objc-act.h. (objc/objc-act.o): Depend on $(HASHTAB_H). * objc-act.c: Include hashtab.h; in ObjC++ mode, include cp-tree.h and objcp-decl.h instead of c-tree.h. (build_module_descriptor, get_class_ivars, synth_id_with_class_suffix, error_with_ivar, gen_method_decl, gen_declaration, setup_string_decl, build_protocol_template): Adjust prototypes. (build_module_initializer_routine, start_class, continue_class, finish_class, start_method_def, objc_start_function, start_protocol, build_method_decl, objc_add_method, add_instance_variable, build_ivar_reference, is_ivar, is_private, get_super_receiver, build_selector_table_decl, objc_push_parm, objc_get_parm_info, gen_type_name, gen_type_name_0, start_var_decl, finish_var_decl, create_field_decl): New prototypes. (objc_expand_function_end, comp_method_with_proto, objc_expr_last, gen_declaration_1, gen_declarator, is_complex_decl, adorn_decl, define_decl, create_builtin_decl, gen_declspecs): Remove prototypes. (TYPE_ID): Rename to OBJECT_TYPEDEF_NAME. (CLASS_TYPEDEF_NAME): New. (TAG_EXECCLASS): Change from a global variable to a #define. (TAG_RETURN_STRUCT): Delete. (TAG_GNUINIT): New, holds '__objc_gnu_init' name. (objc_inherit_code, objc_public_flag): New, moved from c-parse.in. (string_descriptor): New struct. (string_htab): New hash table. (string_hash, string_eq): New prototypes. (generate_struct_by_value_array): Call create_field_decl() instead of create_builtin_decl(). (objc_init): Do not initialize objc_ellipsis_node or TAG_EXECCLASS; In ObjC++ mode, call cxx_init() instead of c_objc_common_init(). (objc_finish_file): In ObjC++, call instantiate_pending_templates() and cp_finish_file(). (define_decl, get_static_reference, get_protocol_reference, create_builtin_decl): Remove functions. (objc_start_class_interface, objc_start_category_interface, objc_start_protocol, objc_continue_interface, objc_finish_interface, objc_start_class_implementation, objc_start_category_implementation, objc_continue_implementation, objc_finish_implementation, objc_set_visibility, objc_set_method_type, objc_build_method_signature, objc_add_method_declaration, objc_start_method_definition, objc_add_instance_variable, objc_get_protocol_qualified_type, create_field_decl, start_var_decl, finish_var_decl): New functions. (setup_string_decl): Simplify since it is only called once. (synth_module_prologue): Call build_class_template(); predefine 'id' and 'Class' as typedefs; rename 'temp_type' to 'type'; disable debug hooks for duration of function; fix GNU runtime messenger signatures to correspond to reality; forward-declare '__objc_exec_class' for the GNU runtime; call build_selector_table_decl(); in ObjC++ mode, generate 'extern "C" { ... }' wrappers around synthesized declarations; call build_protocol_template() and build_category_template(). (string_hash, string_eq): New functions. (objc_build_string_object): Check metaclass correctness only once; store string literals in hash table. (objc_build_constructor): Do not convert initializer elements; adjust for ObjC++ impedance mismatch. (build_objc_symtab_template): Call create_field_decl() instead of create_builtin_decl(). (init_objc_symtab): Add missing conversion to initializer element. (build_metadata_decl): Call start_var_decl() instead of define_decl(). (generate_objc_symtab_decl): Do not call build_category_template(); call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(). (build_module_descriptor): Call create_field_decl() instead of grokfield(); call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(); always mark module descriptor as used; move GNU runtime-specific functionality to build_module_initializer_routine(). (build_module_initializer_routine): New function, broken off of build_module_descriptor(). (objc_static_init_needed_p, objc_generate_static_init_call): New functions. (generate_static_references, generate_strings, build_selector_translation_table, generate_descriptor_table, generate_ivars_list, generate_dispatch_table, generate_category): Call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(); build a type directly instead of via groktypename(). (build_selector_reference_decl, build_selector_table_decl, build_class_reference_decl, build_protocol_reference, generate_objc_image_info): Call start_var_decl() instead of build_decl(). (build_selector_reference): For GNU runtime, do not call build_selector_reference_decl(). (build_selector, build_typed_selector_reference): Always convert result to the selector type. (add_objc_string): Cast return value to 'char *'. (build_method_prototype_template, build_selector_template, build_method_template): Use actual selector type for fields pointing to selectors. (finish_objc): For GNU runtime, call build_module_initializer_routine() after build_module_descriptor(). (generate_protocol_list, generate_shared_structures): Call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(); build a type directly instead of via groktypename(). (synth_id_with_class_suffix): Return a string. (get_arg_type_list): For instance methods, use the instance type for 'self'; do not call groktypename_in_parm_context(). (build_objc_string_decl): Squash redeclaration errors in ObjC++. (objc_is_class_name): Use OBJC_TYPE_NAME instead of TYPE_NAME; handle RECORD_TYPEs in ObjC as well as ObjC++. (objc_is_id): New function. (objc_is_object_ptr): Return the canonical type node. (objc_get_class_ivars): Simplify using get_class_ivars(). (get_class_ivars): Remove second parameter; create a fresh copy of the ivar list for each call; do not check for existence of super class. (objc_eh_runtime_type): Mark #ifndef OBJCPLUS. (objc_init_exceptions): When using SJLJ-style exceptions, require the use of '-fobjc-exceptions' flag; do not require it for DWARF-style exceptions. (objc_build_exc_ptr, next_sjlj_build_try_catch_finally): Use objc_object_type instead of objc_id_type. (objc_begin_catch_clause): Convert the incoming PARM_DECL into a VAR_DECL before placing it in the appropriate scope; do not call define_decl(); adjust call to c_begin_compound_stmt(); use objc_object_type instead of objc_id_type. (build_next_objc_exception_stuff): Call create_field_decl() instead of create_builtin_decl(); construct type directly instead of calling groktypename(); use OBJC_VOID_AT_END to mark end of function parameters. (build_private_template): Adjust call to get_class_ivars(); build a type directly instead of via groktypename(). (build_protocol_template, build_method_prototype_list_template, build_method_prototype_template, build_category_template, build_selector_template, build_class_template, build_super_template, build_ivar_template, build_ivar_list_template, build_method_list_template, build_method_template): Call create_field_decl() instead of grokfield(). (objc_method_parm_type): Do not call groktypename(). (generate_descriptor_table): Call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(). (generate_method_descriptors, build_protocol_initializer, generate_dispatch_tables, build_category_initializer, build_shared_structure_initializer): Do not call groktypename(). (generate_protocols): Call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(); do not call groktypename(). (error_with_ivar): Remove last parameter. (check_ivars): Do not iterate ovar CLASS_RAW_IVARS lists in addition to CLASS_IVARS lists; adjust calls to error_with_ivar(). (generate_ivar_lists): Convert one of the initializer elements; do not call groktypename(). (get_arg_type_list, start_method_def, gen_method_def): Account for new representation of variable arguments and '...' in Objective-C methods; add Objective-C++ impedance matching code. (is_objc_type_qualifier): Remove function. (adjust_type_for_id_default): Simplify; there is no longer a need to wade through declspecs. (lookup_interface, start_class, continue_class, finish_class, start_method_def, start_protocol, build_method_decl, objc_add_method, add_instance_variable, build_ivar_reference, is_ivar, is_private, get_super_receiver, objc_build_finally_epilogue): Make into static functions. (receiver_is_class_object): Use new IS_CLASS() macro. (objc_build_message_expr): Tweak ObjC++ message argument handling; call objc_finish_message_expr() instead of finish_message_expr(). (finish_message_expr): Rename to objc_finish_message_expr(); use OBJC_TYPE_NAME and OBJC_SET_TYPE_NAME macros instead of TYPE_NAME. call gen_type_name() instead of gen_declaration(); call objc_is_id() instead of using IS_ID and IS_CLASS; Use objc_class_name instead of calling get_identifier("Class"); handle CONVERT_EXPRs in receiver. (build_objc_method_call, warn_with_method): Do not call groktypename(). (build_ivar_reference): Call convert() instead of clobbering in a type. (hash_init): Initialize string_htab hash table. (add_instance_variable): Simplify parameter list; do not call grokfield(); do not populate CLASS_IVARS list. (start_class): Check for the existence of super class, if one was specified. (continue_class): Use CLASS_RAW_IVARS rather than CLASS_IVARS; do not call build_class_template(); adjust call to get_class_ivars(); call build_decl(), pushdecl() and finish_decl() instead of define_decl(). (finish_class): Call build_decl(), pushdecl() and finish_decl() instead of define_decl(). (add_protocols): Use PROTOCOL_BINFO_ELTS for the tree vector size. (start_protocol): Do not call build_protocol_template(); use PROTOCOL_BINFO_ELTS for the tree vector size. (encode_type_qualifiers): Do not handle the 'const' qualifier here. (encode_pointer): Encode 'const char *' as 'r*', for backwards compatibility. (encode_array): Use HOST_WIDE_INT_PRINT_DEC instead of "%ld". (encode_type): Handle the 'const' qualifier here. (objc_parmlist): New global variable, sued by objc_push_parm and objc_get_parm_info(). (objc_push_parm, objc_get_parm_info): New functions. (objc_expr_last): Remove function. (synth_self_and_ucmd_args): For instance methods, use the instance type for 'self'; call objc_push_parm() instead of push_parm_decl(). (start_method_def): Do not call push_scope(), declare_parm_level(), pop_scope(), push_parm_decl(), store_parm_decls() or objc_expr_last(); just use objc_push_parm() and objc_get_parm_info(). (comp_method_with_proto): Remove function. (objc_types_are_equivalent): Strip away indirections before comparing underlying types. (comp_proto_with_proto): Do not call groktypename(); types are no longer in raw declspec format. (objc_start_function): New function. (really_start_method): Call comp_proto_with_proto() instead of comp_method_with_proto(); call objc_start_function() instead of hand-crafting a function declarator. (continue_method_def, objc_expand_function_end): Remove functions. (get_super_receiver): Call objc_get_current_scope() instead of get_current_scope(); reference 'super_class' field (instead of 'class'). (finish_method_def): Rename to objc_finish_method_definition() and add a function decl parameter; move method encoding call from objc_expand_function_end(). (is_complex_decl, adorn_decl, gen_declarator, gen_declspecs, gen_declaration_1): Remove functions. (tmpbuf, RAW_DECLSPEC): Remove. (gen_declaration): Remove second parameter; simplify to deal with TYPE_P nodes instead of raw declspecs. (gen_type_name, gen_type_name_0): New functions. (gen_method_decl): Remove second parameter; call gen_type_name() instead of gen_declaration_1(). (dump_interface): Adjust calls to gen_declaration() and gen_method_decl(); do not allocate a separate string buffer. (init_objc): Allocate a larger string buffer to accommodate dump_interface(); adjust call to build_module_descriptor(); add call to build_module_initializer_routine() for the GNU runtime. (generate_classref_translation_entry): Do not call start_decl(); call finish_var_decl() instead of finish_decl(); call convert() instead of build_c_cast(). * objc-act.h (CLASS_OWN_IVARS): Remove accessor. (CLASS_BINFO_ELTS): Reduce from 6 to 5, now that CLASS_OWN_IVARS is gone. (OCTI_GNU_INIT_DECL, GNU_INIT_decl): New. (OCTI_ELLIPSIS_NODE, objc_ellipsis_node): Remove. (OCTI_ID_ID, id_type, objc_id_id): Rename to OCTI_ID_NAME, objc_object_type and objc_object_name, respectively. (OCTI_CLS_REF, OCTI_CLASS_NAME, objc_class_reference, objc_class_name): New. (IS_CLASS): New macro. (IS_ID, IS_SUPER): Robustify. (OCTI_EXECCLASS_DECL, execclass_decl): New. (finish_file, start_class, continue_class, finish_class, start_method_def, continue_method_def, finish_method_def, start_protocol, finish_protocol, objc_build_throw_stmt, objc_build_try_catch_finally_stmt, objc_build_synchronized_prologue, objc_build_synchronized_epilogue, objc_build_try_prologue, objc_build_try_epilogue, objc_build_catch_stmt, objc_build_catch_epilogue, objc_build_finally_prologue, objc_build_finally_epilogue, is_ivar, is_private, is_public, add_instance_variable, objc_add_method, get_super_receiver, objc_clear_super_receiver, get_class_ivars_from_name, get_class_reference, get_static_reference, get_object_reference, build_message_expr, finish_message_expr, build_selector_expr, build_ivar_reference, build_keyword_decl, build_method_decl, build_protocol_expr, build_objc_string_object, objc_declare_alias, objc_declare_class, objc_declare_protocols, objc_comptypes, objc_check_decl, build_encode_expr): Remove prototypes. (imp_count, cat_count): Make GGC-aware. (OBJC_SET_TYPE_NAME): New macro. From-SVN: r87168
2004-09-08 02:49:44 +02:00
field_decl = create_field_decl (char_type_node,
buffer);
chainon (field_decl_chain, field_decl);
}
finish_struct (type, field_decl_chain, NULL_TREE);
targhooks.c: New file. * targhooks.c: New file. * targhooks.h: New file. * Makefile.in: Add targhooks.o support. (function.o): Depend on$(TARGET_H). (stmt.o): Likewise. (combine.o): Depend on $(TREE_H) and $(TARGET_H). * builtins.c (apply_args_size, expand_builtin_apply_args_1, expand_builtin_apply): Convert to calls.struct_value_rtx hook. (expand_builtin_saveregs): Convert to calls.expand_builtin_saveregs hook. * c-decl.c (start_decl): Handle new calls.promote_prototypes hook here, instead of ... (get_parm_info) ... here. (store_parm_decls_oldstyle): Convert to calls.promote_prototypes hook. (finish_function): Handle calls.promote_prototypes hook here too. * c-typeck.c (convert_arguments): Convert to calls.promote_prototypes hook. (c_convert_parm_for_inlining): Likewise. * calls.c (initialize_argument_information): Convert to calls.promote_function_args hook. (expand_call): Convert to calls.struct_value_rtx, calls.strict_argument_naming, calls.pretend_outgoing_varargs_named, and calls.promote_function_return hooks. Pass fndecl to aggregate_value_p. Initialize CUMULATIVE_ARGS before calling hooks, so they can use that. (emit_library_call_value_1): Likewise. * combine.c (setup_incoming_promotions): Convert to calls.promote_function_args hook. * emit-rtl.c: Convert to calls.struct_value_rtx hook. * expr.c (expand_assignment): Pass call to aggregate_value_p. (expand_expr): Likewise. * expr.h: Remove support for SETUP_INCOMING_VARARGS, STRICT_ARGUMENT_NAMING, PRETEND_OUTGOING_VARARGS_NAMED, RETURN_IN_MEMORY macro defaults. * final.c (profile_function): Convert to calls.struct_value_rtx hook. * function.c (aggregate_value_p): Accept function type tree as second parameter; try to deduce fntype from it. Convert to calls.return_in_memory hook. (assign_parms): Convert to calls.setup_incoming_varargs, calls.strict_argument_naming, calls.promote_function_args, calls.pretend_outgoing_varargs_named hooks. Pass fndecl to aggregate_value_p. (expand_function_start): Likewise. Convert to calls.struct_value_rtx hook. (expand_function_end): Convert to calls.promote_function_return hook. (allocate_struct_function): Pass fndecl to aggregate_value_p. * hard-reg-set.h: Update comments to new hook names. * integrate.c (expand_inline_function): Pass fndecl to aggregate_value_p. * reg-stack.c (stack_result): Likewise. * rtl.h (struct_value_rtx, struct_value_incoming_rtx): Delete. * stmt.c (expand_value_return): Convert to calls.promote_function_return hook. * target-def.h: Add TARGET_PROMOTE_FUNCTION_ARGS, TARGET_PROMOTE_FUNCTION_RETURN, TARGET_PROMOTE_PROTOTYPES, TARGET_STRUCT_VALUE_RTX, TARGET_RETURN_IN_MEMORY, TARGET_EXPAND_BUILTIN_SAVEREGS, TARGET_SETUP_INCOMING_VARARGS, TARGET_STRICT_ARGUMENT_NAMING, TARGET_PRETEND_OUTGOING_VARARGS_NAMED, and TARGET_CALLS. * target.h: Likewise. * tree.h (aggregate_value_p): Also takes a tree to deduce function attributes from (for target hooks). * doc/tm.texi (PROMOTE_FUNCTION_ARGS, PROMOTE_FUNCTION_RETURN, PROMOTE_PROTOTYPES, RETURN_IN_MEMORY, STRUCT_VALUE_REGNUM, STRUCT_VALUE, STRUCT_VALUE_INCOMING_REGNUM, STRUCT_VALUE_INCOMING, EXPAND_BUILTIN_SAVEREGS, SETUP_INCOMING_VARARGS, STRICT_ARGUMENT_NAMING, PRETEND_OUTGOING_VARARGS_NAMED): Convert to hooks. * config/alpha/alpha.c (alpha_output_mi_thunk_osf): Pass function to aggregate_value_p. * config/arm/arm.c (arm_init_cumulative_args, arm_output_mi_thunk): Likewise. * config/i386/i386.c (ix86_return_pops_args, x86_this_parameter): Likewise. * config/mips/mips.c (mips_save_reg_p, mips_expand_prologue, mips_can_use_return_insn): Likewise. * config/rs6000/rs6000.c (rs6000_output_mi_thunk): Likewise. * config/s390/s390.c (s390_output_mi_thunk): Likewise. * config/sparc/sparc.c (sparc_output_mi_thunk): Pass function to aggregate_value_p. * config/story16/stormy16.c (xstormy16_asm_output_mi_thunk): Pass function to aggregate_value_p. * objc/objc-act.c (generate_struct_by_value_array): Pass NULL to aggregate_value_p. * config/sh/sh-protos.h (sh_builtin_saveregs): Remove. (sh_attr_renesas_p, sh_cfun_attr_renesas_p, sh_function_arg, sh_function_arg_advance, sh_pass_in_reg_p): New. * config/sh/sh.c (sh_handle_renesas_attribute, sh_promote_prototypes, sh_struct_value_rtx, sh_return_in_memory, sh_builtin_saveregs, sh_setup_incoming_varargs, sh_strict_argument_naming, sh_pretend_outgoing_varargs_named): New decls. (targetm): Add new hooks. (calc_live_regs): Save MACL and MACH if the function has the renesas attribute. (sh_expand_prologue): Support renesas attribute. (sh_builtin_saveregs): Make static. (sh_build_va_list): Support renesas attribute. (sh_va_start): Likewise. (sh_va_arg): Likewise. (sh_promote_prototypes): New. (sh_function_arg): New, moved from sh.h. Support renesas attribute. (sh_function_arg_advance): Likewise. (sh_return_in_memory): Likewise. (sh_strict_argument_naming): Likewise. (sh_pretend_outgoing_varargs_named): Likewise. (sh_struct_value_rtx): New. (sh_attribute): Add renesas attribute. (sh_handle_renesas_attribute): New. (sh_attr_renesas_p, sh_cfun_attr_renesas_p): New. (sh_ms_bitfield_layout_p): Support renesas attribute also. (sh_output_mi_thunk): Pass function to aggregate_value_p. * config/sh/sh.h (TARGET_SWITCHES): Add -mrenesas as an alias for -mhitachi. (STRUCT_VALUE_REGNUM, STRUCT_VALUE, RETURN_IN_MEMORY): Moved to target hooks. (sh_args): Add renesas_abi flag. (INIT_CUMULATIVE_ARGS): Set it. Pass fndecl to aggregate_value_p. (FUNCTION_ARG_ADVANCE, FUNCTION_ARG): Move to sh.c. (PASS_IN_REG_P): Support renesas attribute. Pass DF and TF on the stack for the renesas abi. (STRICT_ARGUMENT_NAMING, PRETEND_OUTGOING_VARARGS_NAMED, SETUP_INCOMING_VARARGS, EXPAND_BUILTIN_SAVEREGS, PROMOTE_PROTOTYPES): Moved to sh.c. * config/sh/sh.md (call): Set call cookie to indicate renesas calls. * decl.c (finish_function): Pass fndecl to aggregate_value_p. * misc.c (default_pass_by_ref): Convert to calls.return_in_memory hook. From-SVN: r71048
2003-09-04 05:18:05 +02:00
aggregate_in_mem[i] = aggregate_value_p (type, 0);
if (!aggregate_in_mem[i])
found = 1;
}
/* We found some structures that are returned in registers instead of memory
so output the necessary data. */
if (found)
{
for (i = 31; i >= 0; i--)
if (!aggregate_in_mem[i])
break;
printf ("#define OBJC_MAX_STRUCT_BY_VALUE %d\n\n", i);
/* The first member of the structure is always 0 because we don't handle
structures with 0 members */
printf ("static int struct_forward_array[] = {\n 0");
for (j = 1; j <= i; j++)
printf (", %d", aggregate_in_mem[j]);
printf ("\n};\n");
}
exit (0);
}
c-common.h (c_common_init, [...]): Update. * c-common.h (c_common_init, c_common_post_options): Update. * c-objc-common.c (c_objc_common_init): Update for new prototype. * c-opts.c (saved_lineno): New. (c_common_post_options, c_common_init): Update prototypes, move call to cpp_read_main_file from latter to former. * c-tree.h (c_ojbc_common_init): Update. * langhooks-def.h (lhd_post_options): New. (LANG_HOOKS_INIT, LANG_HOOKS_POST_OPTIONS): Update. * langhooks.c (lhd_post_options): New. * langhooks.h (struct lang_hooks): Update post_options and init hooks. * toplev.c (no_backend): New. (process_options): Call post_options hook and set main_input_filename and input_filename here. (lang_dependent_init, do_compile): post_options hook moved to process_options. * objc/objc-act.c (objc_init): Update prototype. * objc/objc-act.h (objc_init): Update prototype. ada: * misc.c (gnat_init): Update for new prototype. cp: * cp-tree.h (cxx_init): Update prototype. * lex.c (cxx_init): Similarly. f: * com.c (ffe_init): Update prototype; move code to ffe_post_options. (ffe_post_options): New. java: * lang.c (java_init): Update prototype, move code to java_post_options. (java_post_options): Similarly. treelang: * tree1.c (in_fname): Fix type. (treelang_init): Update prototype and use of in_fname. * treelang.h (in_fname): Fix type. * treetree.c (tree_code_if_start, tree_code_if_else, tree_code_if_end, tree_code_create_function_prototype, tree_code_create_function_initial, tree_code_create_funciton_wrapup, tree_code_create_variable, tree_code_output_expression_statement) : Fix prototypes and use of filenames. * treetree.h: Similarly. From-SVN: r64001
2003-03-08 22:12:26 +01:00
bool
objc_init (void)
1992-01-18 00:15:38 +01:00
{
Makefile.in (c-parse.o): Depend on $(C_COMMON_H). [gcc/ChangeLog] 2004-09-07 Ziemowit Laski <zlaski@apple.com> * Makefile.in (c-parse.o): Depend on $(C_COMMON_H). * c-parse.in: Include c-common.h instead of objc-act.h. (ivar_decl_list, ivar_decls, ivar_decl, ivars, ivar_declarator, myparms, myparm): Remove %type declarations. (methodtype, optparms, OBJC_TYPE_QUAL, objc_quals, objc_qual, objc_typename, objc_try_catch_stmt, optellipsis): Add %type declarations. (objc_inherit_code, objc_public_flag): Remove. (typespec_nonreserved_nonattr): Call objc_get_protocol_qualified_type() instead of get_static_reference() and get_protocol_reference(). (stmt_nocomp): Call grokparm() on @catch parameter. (objcdef): Move semantic action to objc_finish_implementation(). (classdef): Move semantic action to objc_start_class_interface(), objc_continue_interface(), objc_finish_interface(), objc_start_class_implementation(), objc_continue_implementation(), objc_start_category_interface() and objc_start_category_implementation(). (protocoldef): Move semantic actions to objc_start_protocol() and objc_finish_interface(). (ivar_decl_list): Remove nonterminal. (visibility_spec): Move semantic actions to objc_set_visibility(). (ivar_decls): Remove assignment to $$. (ivar_decl): Rephrase in terms of component_decl; call objc_add_instance_variable(). (ivars, ivar_declarator): Remove nonterminals. (opt_semi): New nonterminal. (methodtype): Remove semantic actions. (methoddef): Move semantic actions to objc_set_method_type(), objc_start_method_definition() and objc_finish_method_definition(). (methodproto): Move semantic actions to objc_set_method_type() and objc_add_method_declaration(). (methoddecl): Use objc_typename instead of typename; move semantic actions to objc_build_method_signature(). (optarglist, myxdecls, mydecl, myparms, myparm): Remove nonterminals. (optparmlist): Express in terms of optparms and optellipsis. (optparms, optellipsis, objc_qual, objc_quals, objc_typename): New nonterminals. (keyworddecl): Use objc_typename instead of typename. (rid_to_yy): Mark RID_IN, RID_OUT, RID_INOUT, RID_BYCOPY, RID_BYREF and RID_ONEWAY as returning OBJC_TYPE_QUAL to yyparse(). [gcc/objc/ChangeLog] 2004-09-07 Ziemowit Laski <zlaski@apple.com> * Make-lang.in (objc/objc-parse.o): Depend on $(C_COMMON_H) instead of objc/objc-act.h. (objc/objc-act.o): Depend on $(HASHTAB_H). * objc-act.c: Include hashtab.h; in ObjC++ mode, include cp-tree.h and objcp-decl.h instead of c-tree.h. (build_module_descriptor, get_class_ivars, synth_id_with_class_suffix, error_with_ivar, gen_method_decl, gen_declaration, setup_string_decl, build_protocol_template): Adjust prototypes. (build_module_initializer_routine, start_class, continue_class, finish_class, start_method_def, objc_start_function, start_protocol, build_method_decl, objc_add_method, add_instance_variable, build_ivar_reference, is_ivar, is_private, get_super_receiver, build_selector_table_decl, objc_push_parm, objc_get_parm_info, gen_type_name, gen_type_name_0, start_var_decl, finish_var_decl, create_field_decl): New prototypes. (objc_expand_function_end, comp_method_with_proto, objc_expr_last, gen_declaration_1, gen_declarator, is_complex_decl, adorn_decl, define_decl, create_builtin_decl, gen_declspecs): Remove prototypes. (TYPE_ID): Rename to OBJECT_TYPEDEF_NAME. (CLASS_TYPEDEF_NAME): New. (TAG_EXECCLASS): Change from a global variable to a #define. (TAG_RETURN_STRUCT): Delete. (TAG_GNUINIT): New, holds '__objc_gnu_init' name. (objc_inherit_code, objc_public_flag): New, moved from c-parse.in. (string_descriptor): New struct. (string_htab): New hash table. (string_hash, string_eq): New prototypes. (generate_struct_by_value_array): Call create_field_decl() instead of create_builtin_decl(). (objc_init): Do not initialize objc_ellipsis_node or TAG_EXECCLASS; In ObjC++ mode, call cxx_init() instead of c_objc_common_init(). (objc_finish_file): In ObjC++, call instantiate_pending_templates() and cp_finish_file(). (define_decl, get_static_reference, get_protocol_reference, create_builtin_decl): Remove functions. (objc_start_class_interface, objc_start_category_interface, objc_start_protocol, objc_continue_interface, objc_finish_interface, objc_start_class_implementation, objc_start_category_implementation, objc_continue_implementation, objc_finish_implementation, objc_set_visibility, objc_set_method_type, objc_build_method_signature, objc_add_method_declaration, objc_start_method_definition, objc_add_instance_variable, objc_get_protocol_qualified_type, create_field_decl, start_var_decl, finish_var_decl): New functions. (setup_string_decl): Simplify since it is only called once. (synth_module_prologue): Call build_class_template(); predefine 'id' and 'Class' as typedefs; rename 'temp_type' to 'type'; disable debug hooks for duration of function; fix GNU runtime messenger signatures to correspond to reality; forward-declare '__objc_exec_class' for the GNU runtime; call build_selector_table_decl(); in ObjC++ mode, generate 'extern "C" { ... }' wrappers around synthesized declarations; call build_protocol_template() and build_category_template(). (string_hash, string_eq): New functions. (objc_build_string_object): Check metaclass correctness only once; store string literals in hash table. (objc_build_constructor): Do not convert initializer elements; adjust for ObjC++ impedance mismatch. (build_objc_symtab_template): Call create_field_decl() instead of create_builtin_decl(). (init_objc_symtab): Add missing conversion to initializer element. (build_metadata_decl): Call start_var_decl() instead of define_decl(). (generate_objc_symtab_decl): Do not call build_category_template(); call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(). (build_module_descriptor): Call create_field_decl() instead of grokfield(); call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(); always mark module descriptor as used; move GNU runtime-specific functionality to build_module_initializer_routine(). (build_module_initializer_routine): New function, broken off of build_module_descriptor(). (objc_static_init_needed_p, objc_generate_static_init_call): New functions. (generate_static_references, generate_strings, build_selector_translation_table, generate_descriptor_table, generate_ivars_list, generate_dispatch_table, generate_category): Call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(); build a type directly instead of via groktypename(). (build_selector_reference_decl, build_selector_table_decl, build_class_reference_decl, build_protocol_reference, generate_objc_image_info): Call start_var_decl() instead of build_decl(). (build_selector_reference): For GNU runtime, do not call build_selector_reference_decl(). (build_selector, build_typed_selector_reference): Always convert result to the selector type. (add_objc_string): Cast return value to 'char *'. (build_method_prototype_template, build_selector_template, build_method_template): Use actual selector type for fields pointing to selectors. (finish_objc): For GNU runtime, call build_module_initializer_routine() after build_module_descriptor(). (generate_protocol_list, generate_shared_structures): Call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(); build a type directly instead of via groktypename(). (synth_id_with_class_suffix): Return a string. (get_arg_type_list): For instance methods, use the instance type for 'self'; do not call groktypename_in_parm_context(). (build_objc_string_decl): Squash redeclaration errors in ObjC++. (objc_is_class_name): Use OBJC_TYPE_NAME instead of TYPE_NAME; handle RECORD_TYPEs in ObjC as well as ObjC++. (objc_is_id): New function. (objc_is_object_ptr): Return the canonical type node. (objc_get_class_ivars): Simplify using get_class_ivars(). (get_class_ivars): Remove second parameter; create a fresh copy of the ivar list for each call; do not check for existence of super class. (objc_eh_runtime_type): Mark #ifndef OBJCPLUS. (objc_init_exceptions): When using SJLJ-style exceptions, require the use of '-fobjc-exceptions' flag; do not require it for DWARF-style exceptions. (objc_build_exc_ptr, next_sjlj_build_try_catch_finally): Use objc_object_type instead of objc_id_type. (objc_begin_catch_clause): Convert the incoming PARM_DECL into a VAR_DECL before placing it in the appropriate scope; do not call define_decl(); adjust call to c_begin_compound_stmt(); use objc_object_type instead of objc_id_type. (build_next_objc_exception_stuff): Call create_field_decl() instead of create_builtin_decl(); construct type directly instead of calling groktypename(); use OBJC_VOID_AT_END to mark end of function parameters. (build_private_template): Adjust call to get_class_ivars(); build a type directly instead of via groktypename(). (build_protocol_template, build_method_prototype_list_template, build_method_prototype_template, build_category_template, build_selector_template, build_class_template, build_super_template, build_ivar_template, build_ivar_list_template, build_method_list_template, build_method_template): Call create_field_decl() instead of grokfield(). (objc_method_parm_type): Do not call groktypename(). (generate_descriptor_table): Call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(). (generate_method_descriptors, build_protocol_initializer, generate_dispatch_tables, build_category_initializer, build_shared_structure_initializer): Do not call groktypename(). (generate_protocols): Call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(); do not call groktypename(). (error_with_ivar): Remove last parameter. (check_ivars): Do not iterate ovar CLASS_RAW_IVARS lists in addition to CLASS_IVARS lists; adjust calls to error_with_ivar(). (generate_ivar_lists): Convert one of the initializer elements; do not call groktypename(). (get_arg_type_list, start_method_def, gen_method_def): Account for new representation of variable arguments and '...' in Objective-C methods; add Objective-C++ impedance matching code. (is_objc_type_qualifier): Remove function. (adjust_type_for_id_default): Simplify; there is no longer a need to wade through declspecs. (lookup_interface, start_class, continue_class, finish_class, start_method_def, start_protocol, build_method_decl, objc_add_method, add_instance_variable, build_ivar_reference, is_ivar, is_private, get_super_receiver, objc_build_finally_epilogue): Make into static functions. (receiver_is_class_object): Use new IS_CLASS() macro. (objc_build_message_expr): Tweak ObjC++ message argument handling; call objc_finish_message_expr() instead of finish_message_expr(). (finish_message_expr): Rename to objc_finish_message_expr(); use OBJC_TYPE_NAME and OBJC_SET_TYPE_NAME macros instead of TYPE_NAME. call gen_type_name() instead of gen_declaration(); call objc_is_id() instead of using IS_ID and IS_CLASS; Use objc_class_name instead of calling get_identifier("Class"); handle CONVERT_EXPRs in receiver. (build_objc_method_call, warn_with_method): Do not call groktypename(). (build_ivar_reference): Call convert() instead of clobbering in a type. (hash_init): Initialize string_htab hash table. (add_instance_variable): Simplify parameter list; do not call grokfield(); do not populate CLASS_IVARS list. (start_class): Check for the existence of super class, if one was specified. (continue_class): Use CLASS_RAW_IVARS rather than CLASS_IVARS; do not call build_class_template(); adjust call to get_class_ivars(); call build_decl(), pushdecl() and finish_decl() instead of define_decl(). (finish_class): Call build_decl(), pushdecl() and finish_decl() instead of define_decl(). (add_protocols): Use PROTOCOL_BINFO_ELTS for the tree vector size. (start_protocol): Do not call build_protocol_template(); use PROTOCOL_BINFO_ELTS for the tree vector size. (encode_type_qualifiers): Do not handle the 'const' qualifier here. (encode_pointer): Encode 'const char *' as 'r*', for backwards compatibility. (encode_array): Use HOST_WIDE_INT_PRINT_DEC instead of "%ld". (encode_type): Handle the 'const' qualifier here. (objc_parmlist): New global variable, sued by objc_push_parm and objc_get_parm_info(). (objc_push_parm, objc_get_parm_info): New functions. (objc_expr_last): Remove function. (synth_self_and_ucmd_args): For instance methods, use the instance type for 'self'; call objc_push_parm() instead of push_parm_decl(). (start_method_def): Do not call push_scope(), declare_parm_level(), pop_scope(), push_parm_decl(), store_parm_decls() or objc_expr_last(); just use objc_push_parm() and objc_get_parm_info(). (comp_method_with_proto): Remove function. (objc_types_are_equivalent): Strip away indirections before comparing underlying types. (comp_proto_with_proto): Do not call groktypename(); types are no longer in raw declspec format. (objc_start_function): New function. (really_start_method): Call comp_proto_with_proto() instead of comp_method_with_proto(); call objc_start_function() instead of hand-crafting a function declarator. (continue_method_def, objc_expand_function_end): Remove functions. (get_super_receiver): Call objc_get_current_scope() instead of get_current_scope(); reference 'super_class' field (instead of 'class'). (finish_method_def): Rename to objc_finish_method_definition() and add a function decl parameter; move method encoding call from objc_expand_function_end(). (is_complex_decl, adorn_decl, gen_declarator, gen_declspecs, gen_declaration_1): Remove functions. (tmpbuf, RAW_DECLSPEC): Remove. (gen_declaration): Remove second parameter; simplify to deal with TYPE_P nodes instead of raw declspecs. (gen_type_name, gen_type_name_0): New functions. (gen_method_decl): Remove second parameter; call gen_type_name() instead of gen_declaration_1(). (dump_interface): Adjust calls to gen_declaration() and gen_method_decl(); do not allocate a separate string buffer. (init_objc): Allocate a larger string buffer to accommodate dump_interface(); adjust call to build_module_descriptor(); add call to build_module_initializer_routine() for the GNU runtime. (generate_classref_translation_entry): Do not call start_decl(); call finish_var_decl() instead of finish_decl(); call convert() instead of build_c_cast(). * objc-act.h (CLASS_OWN_IVARS): Remove accessor. (CLASS_BINFO_ELTS): Reduce from 6 to 5, now that CLASS_OWN_IVARS is gone. (OCTI_GNU_INIT_DECL, GNU_INIT_decl): New. (OCTI_ELLIPSIS_NODE, objc_ellipsis_node): Remove. (OCTI_ID_ID, id_type, objc_id_id): Rename to OCTI_ID_NAME, objc_object_type and objc_object_name, respectively. (OCTI_CLS_REF, OCTI_CLASS_NAME, objc_class_reference, objc_class_name): New. (IS_CLASS): New macro. (IS_ID, IS_SUPER): Robustify. (OCTI_EXECCLASS_DECL, execclass_decl): New. (finish_file, start_class, continue_class, finish_class, start_method_def, continue_method_def, finish_method_def, start_protocol, finish_protocol, objc_build_throw_stmt, objc_build_try_catch_finally_stmt, objc_build_synchronized_prologue, objc_build_synchronized_epilogue, objc_build_try_prologue, objc_build_try_epilogue, objc_build_catch_stmt, objc_build_catch_epilogue, objc_build_finally_prologue, objc_build_finally_epilogue, is_ivar, is_private, is_public, add_instance_variable, objc_add_method, get_super_receiver, objc_clear_super_receiver, get_class_ivars_from_name, get_class_reference, get_static_reference, get_object_reference, build_message_expr, finish_message_expr, build_selector_expr, build_ivar_reference, build_keyword_decl, build_method_decl, build_protocol_expr, build_objc_string_object, objc_declare_alias, objc_declare_class, objc_declare_protocols, objc_comptypes, objc_check_decl, build_encode_expr): Remove prototypes. (imp_count, cat_count): Make GGC-aware. (OBJC_SET_TYPE_NAME): New macro. From-SVN: r87168
2004-09-08 02:49:44 +02:00
#ifdef OBJCPLUS
if (cxx_init () == false)
#else
c-common.h (c_common_init, [...]): Update. * c-common.h (c_common_init, c_common_post_options): Update. * c-objc-common.c (c_objc_common_init): Update for new prototype. * c-opts.c (saved_lineno): New. (c_common_post_options, c_common_init): Update prototypes, move call to cpp_read_main_file from latter to former. * c-tree.h (c_ojbc_common_init): Update. * langhooks-def.h (lhd_post_options): New. (LANG_HOOKS_INIT, LANG_HOOKS_POST_OPTIONS): Update. * langhooks.c (lhd_post_options): New. * langhooks.h (struct lang_hooks): Update post_options and init hooks. * toplev.c (no_backend): New. (process_options): Call post_options hook and set main_input_filename and input_filename here. (lang_dependent_init, do_compile): post_options hook moved to process_options. * objc/objc-act.c (objc_init): Update prototype. * objc/objc-act.h (objc_init): Update prototype. ada: * misc.c (gnat_init): Update for new prototype. cp: * cp-tree.h (cxx_init): Update prototype. * lex.c (cxx_init): Similarly. f: * com.c (ffe_init): Update prototype; move code to ffe_post_options. (ffe_post_options): New. java: * lang.c (java_init): Update prototype, move code to java_post_options. (java_post_options): Similarly. treelang: * tree1.c (in_fname): Fix type. (treelang_init): Update prototype and use of in_fname. * treelang.h (in_fname): Fix type. * treetree.c (tree_code_if_start, tree_code_if_else, tree_code_if_end, tree_code_create_function_prototype, tree_code_create_function_initial, tree_code_create_funciton_wrapup, tree_code_create_variable, tree_code_output_expression_statement) : Fix prototypes and use of filenames. * treetree.h: Similarly. From-SVN: r64001
2003-03-08 22:12:26 +01:00
if (c_objc_common_init () == false)
Makefile.in (c-parse.o): Depend on $(C_COMMON_H). [gcc/ChangeLog] 2004-09-07 Ziemowit Laski <zlaski@apple.com> * Makefile.in (c-parse.o): Depend on $(C_COMMON_H). * c-parse.in: Include c-common.h instead of objc-act.h. (ivar_decl_list, ivar_decls, ivar_decl, ivars, ivar_declarator, myparms, myparm): Remove %type declarations. (methodtype, optparms, OBJC_TYPE_QUAL, objc_quals, objc_qual, objc_typename, objc_try_catch_stmt, optellipsis): Add %type declarations. (objc_inherit_code, objc_public_flag): Remove. (typespec_nonreserved_nonattr): Call objc_get_protocol_qualified_type() instead of get_static_reference() and get_protocol_reference(). (stmt_nocomp): Call grokparm() on @catch parameter. (objcdef): Move semantic action to objc_finish_implementation(). (classdef): Move semantic action to objc_start_class_interface(), objc_continue_interface(), objc_finish_interface(), objc_start_class_implementation(), objc_continue_implementation(), objc_start_category_interface() and objc_start_category_implementation(). (protocoldef): Move semantic actions to objc_start_protocol() and objc_finish_interface(). (ivar_decl_list): Remove nonterminal. (visibility_spec): Move semantic actions to objc_set_visibility(). (ivar_decls): Remove assignment to $$. (ivar_decl): Rephrase in terms of component_decl; call objc_add_instance_variable(). (ivars, ivar_declarator): Remove nonterminals. (opt_semi): New nonterminal. (methodtype): Remove semantic actions. (methoddef): Move semantic actions to objc_set_method_type(), objc_start_method_definition() and objc_finish_method_definition(). (methodproto): Move semantic actions to objc_set_method_type() and objc_add_method_declaration(). (methoddecl): Use objc_typename instead of typename; move semantic actions to objc_build_method_signature(). (optarglist, myxdecls, mydecl, myparms, myparm): Remove nonterminals. (optparmlist): Express in terms of optparms and optellipsis. (optparms, optellipsis, objc_qual, objc_quals, objc_typename): New nonterminals. (keyworddecl): Use objc_typename instead of typename. (rid_to_yy): Mark RID_IN, RID_OUT, RID_INOUT, RID_BYCOPY, RID_BYREF and RID_ONEWAY as returning OBJC_TYPE_QUAL to yyparse(). [gcc/objc/ChangeLog] 2004-09-07 Ziemowit Laski <zlaski@apple.com> * Make-lang.in (objc/objc-parse.o): Depend on $(C_COMMON_H) instead of objc/objc-act.h. (objc/objc-act.o): Depend on $(HASHTAB_H). * objc-act.c: Include hashtab.h; in ObjC++ mode, include cp-tree.h and objcp-decl.h instead of c-tree.h. (build_module_descriptor, get_class_ivars, synth_id_with_class_suffix, error_with_ivar, gen_method_decl, gen_declaration, setup_string_decl, build_protocol_template): Adjust prototypes. (build_module_initializer_routine, start_class, continue_class, finish_class, start_method_def, objc_start_function, start_protocol, build_method_decl, objc_add_method, add_instance_variable, build_ivar_reference, is_ivar, is_private, get_super_receiver, build_selector_table_decl, objc_push_parm, objc_get_parm_info, gen_type_name, gen_type_name_0, start_var_decl, finish_var_decl, create_field_decl): New prototypes. (objc_expand_function_end, comp_method_with_proto, objc_expr_last, gen_declaration_1, gen_declarator, is_complex_decl, adorn_decl, define_decl, create_builtin_decl, gen_declspecs): Remove prototypes. (TYPE_ID): Rename to OBJECT_TYPEDEF_NAME. (CLASS_TYPEDEF_NAME): New. (TAG_EXECCLASS): Change from a global variable to a #define. (TAG_RETURN_STRUCT): Delete. (TAG_GNUINIT): New, holds '__objc_gnu_init' name. (objc_inherit_code, objc_public_flag): New, moved from c-parse.in. (string_descriptor): New struct. (string_htab): New hash table. (string_hash, string_eq): New prototypes. (generate_struct_by_value_array): Call create_field_decl() instead of create_builtin_decl(). (objc_init): Do not initialize objc_ellipsis_node or TAG_EXECCLASS; In ObjC++ mode, call cxx_init() instead of c_objc_common_init(). (objc_finish_file): In ObjC++, call instantiate_pending_templates() and cp_finish_file(). (define_decl, get_static_reference, get_protocol_reference, create_builtin_decl): Remove functions. (objc_start_class_interface, objc_start_category_interface, objc_start_protocol, objc_continue_interface, objc_finish_interface, objc_start_class_implementation, objc_start_category_implementation, objc_continue_implementation, objc_finish_implementation, objc_set_visibility, objc_set_method_type, objc_build_method_signature, objc_add_method_declaration, objc_start_method_definition, objc_add_instance_variable, objc_get_protocol_qualified_type, create_field_decl, start_var_decl, finish_var_decl): New functions. (setup_string_decl): Simplify since it is only called once. (synth_module_prologue): Call build_class_template(); predefine 'id' and 'Class' as typedefs; rename 'temp_type' to 'type'; disable debug hooks for duration of function; fix GNU runtime messenger signatures to correspond to reality; forward-declare '__objc_exec_class' for the GNU runtime; call build_selector_table_decl(); in ObjC++ mode, generate 'extern "C" { ... }' wrappers around synthesized declarations; call build_protocol_template() and build_category_template(). (string_hash, string_eq): New functions. (objc_build_string_object): Check metaclass correctness only once; store string literals in hash table. (objc_build_constructor): Do not convert initializer elements; adjust for ObjC++ impedance mismatch. (build_objc_symtab_template): Call create_field_decl() instead of create_builtin_decl(). (init_objc_symtab): Add missing conversion to initializer element. (build_metadata_decl): Call start_var_decl() instead of define_decl(). (generate_objc_symtab_decl): Do not call build_category_template(); call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(). (build_module_descriptor): Call create_field_decl() instead of grokfield(); call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(); always mark module descriptor as used; move GNU runtime-specific functionality to build_module_initializer_routine(). (build_module_initializer_routine): New function, broken off of build_module_descriptor(). (objc_static_init_needed_p, objc_generate_static_init_call): New functions. (generate_static_references, generate_strings, build_selector_translation_table, generate_descriptor_table, generate_ivars_list, generate_dispatch_table, generate_category): Call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(); build a type directly instead of via groktypename(). (build_selector_reference_decl, build_selector_table_decl, build_class_reference_decl, build_protocol_reference, generate_objc_image_info): Call start_var_decl() instead of build_decl(). (build_selector_reference): For GNU runtime, do not call build_selector_reference_decl(). (build_selector, build_typed_selector_reference): Always convert result to the selector type. (add_objc_string): Cast return value to 'char *'. (build_method_prototype_template, build_selector_template, build_method_template): Use actual selector type for fields pointing to selectors. (finish_objc): For GNU runtime, call build_module_initializer_routine() after build_module_descriptor(). (generate_protocol_list, generate_shared_structures): Call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(); build a type directly instead of via groktypename(). (synth_id_with_class_suffix): Return a string. (get_arg_type_list): For instance methods, use the instance type for 'self'; do not call groktypename_in_parm_context(). (build_objc_string_decl): Squash redeclaration errors in ObjC++. (objc_is_class_name): Use OBJC_TYPE_NAME instead of TYPE_NAME; handle RECORD_TYPEs in ObjC as well as ObjC++. (objc_is_id): New function. (objc_is_object_ptr): Return the canonical type node. (objc_get_class_ivars): Simplify using get_class_ivars(). (get_class_ivars): Remove second parameter; create a fresh copy of the ivar list for each call; do not check for existence of super class. (objc_eh_runtime_type): Mark #ifndef OBJCPLUS. (objc_init_exceptions): When using SJLJ-style exceptions, require the use of '-fobjc-exceptions' flag; do not require it for DWARF-style exceptions. (objc_build_exc_ptr, next_sjlj_build_try_catch_finally): Use objc_object_type instead of objc_id_type. (objc_begin_catch_clause): Convert the incoming PARM_DECL into a VAR_DECL before placing it in the appropriate scope; do not call define_decl(); adjust call to c_begin_compound_stmt(); use objc_object_type instead of objc_id_type. (build_next_objc_exception_stuff): Call create_field_decl() instead of create_builtin_decl(); construct type directly instead of calling groktypename(); use OBJC_VOID_AT_END to mark end of function parameters. (build_private_template): Adjust call to get_class_ivars(); build a type directly instead of via groktypename(). (build_protocol_template, build_method_prototype_list_template, build_method_prototype_template, build_category_template, build_selector_template, build_class_template, build_super_template, build_ivar_template, build_ivar_list_template, build_method_list_template, build_method_template): Call create_field_decl() instead of grokfield(). (objc_method_parm_type): Do not call groktypename(). (generate_descriptor_table): Call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(). (generate_method_descriptors, build_protocol_initializer, generate_dispatch_tables, build_category_initializer, build_shared_structure_initializer): Do not call groktypename(). (generate_protocols): Call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(); do not call groktypename(). (error_with_ivar): Remove last parameter. (check_ivars): Do not iterate ovar CLASS_RAW_IVARS lists in addition to CLASS_IVARS lists; adjust calls to error_with_ivar(). (generate_ivar_lists): Convert one of the initializer elements; do not call groktypename(). (get_arg_type_list, start_method_def, gen_method_def): Account for new representation of variable arguments and '...' in Objective-C methods; add Objective-C++ impedance matching code. (is_objc_type_qualifier): Remove function. (adjust_type_for_id_default): Simplify; there is no longer a need to wade through declspecs. (lookup_interface, start_class, continue_class, finish_class, start_method_def, start_protocol, build_method_decl, objc_add_method, add_instance_variable, build_ivar_reference, is_ivar, is_private, get_super_receiver, objc_build_finally_epilogue): Make into static functions. (receiver_is_class_object): Use new IS_CLASS() macro. (objc_build_message_expr): Tweak ObjC++ message argument handling; call objc_finish_message_expr() instead of finish_message_expr(). (finish_message_expr): Rename to objc_finish_message_expr(); use OBJC_TYPE_NAME and OBJC_SET_TYPE_NAME macros instead of TYPE_NAME. call gen_type_name() instead of gen_declaration(); call objc_is_id() instead of using IS_ID and IS_CLASS; Use objc_class_name instead of calling get_identifier("Class"); handle CONVERT_EXPRs in receiver. (build_objc_method_call, warn_with_method): Do not call groktypename(). (build_ivar_reference): Call convert() instead of clobbering in a type. (hash_init): Initialize string_htab hash table. (add_instance_variable): Simplify parameter list; do not call grokfield(); do not populate CLASS_IVARS list. (start_class): Check for the existence of super class, if one was specified. (continue_class): Use CLASS_RAW_IVARS rather than CLASS_IVARS; do not call build_class_template(); adjust call to get_class_ivars(); call build_decl(), pushdecl() and finish_decl() instead of define_decl(). (finish_class): Call build_decl(), pushdecl() and finish_decl() instead of define_decl(). (add_protocols): Use PROTOCOL_BINFO_ELTS for the tree vector size. (start_protocol): Do not call build_protocol_template(); use PROTOCOL_BINFO_ELTS for the tree vector size. (encode_type_qualifiers): Do not handle the 'const' qualifier here. (encode_pointer): Encode 'const char *' as 'r*', for backwards compatibility. (encode_array): Use HOST_WIDE_INT_PRINT_DEC instead of "%ld". (encode_type): Handle the 'const' qualifier here. (objc_parmlist): New global variable, sued by objc_push_parm and objc_get_parm_info(). (objc_push_parm, objc_get_parm_info): New functions. (objc_expr_last): Remove function. (synth_self_and_ucmd_args): For instance methods, use the instance type for 'self'; call objc_push_parm() instead of push_parm_decl(). (start_method_def): Do not call push_scope(), declare_parm_level(), pop_scope(), push_parm_decl(), store_parm_decls() or objc_expr_last(); just use objc_push_parm() and objc_get_parm_info(). (comp_method_with_proto): Remove function. (objc_types_are_equivalent): Strip away indirections before comparing underlying types. (comp_proto_with_proto): Do not call groktypename(); types are no longer in raw declspec format. (objc_start_function): New function. (really_start_method): Call comp_proto_with_proto() instead of comp_method_with_proto(); call objc_start_function() instead of hand-crafting a function declarator. (continue_method_def, objc_expand_function_end): Remove functions. (get_super_receiver): Call objc_get_current_scope() instead of get_current_scope(); reference 'super_class' field (instead of 'class'). (finish_method_def): Rename to objc_finish_method_definition() and add a function decl parameter; move method encoding call from objc_expand_function_end(). (is_complex_decl, adorn_decl, gen_declarator, gen_declspecs, gen_declaration_1): Remove functions. (tmpbuf, RAW_DECLSPEC): Remove. (gen_declaration): Remove second parameter; simplify to deal with TYPE_P nodes instead of raw declspecs. (gen_type_name, gen_type_name_0): New functions. (gen_method_decl): Remove second parameter; call gen_type_name() instead of gen_declaration_1(). (dump_interface): Adjust calls to gen_declaration() and gen_method_decl(); do not allocate a separate string buffer. (init_objc): Allocate a larger string buffer to accommodate dump_interface(); adjust call to build_module_descriptor(); add call to build_module_initializer_routine() for the GNU runtime. (generate_classref_translation_entry): Do not call start_decl(); call finish_var_decl() instead of finish_decl(); call convert() instead of build_c_cast(). * objc-act.h (CLASS_OWN_IVARS): Remove accessor. (CLASS_BINFO_ELTS): Reduce from 6 to 5, now that CLASS_OWN_IVARS is gone. (OCTI_GNU_INIT_DECL, GNU_INIT_decl): New. (OCTI_ELLIPSIS_NODE, objc_ellipsis_node): Remove. (OCTI_ID_ID, id_type, objc_id_id): Rename to OCTI_ID_NAME, objc_object_type and objc_object_name, respectively. (OCTI_CLS_REF, OCTI_CLASS_NAME, objc_class_reference, objc_class_name): New. (IS_CLASS): New macro. (IS_ID, IS_SUPER): Robustify. (OCTI_EXECCLASS_DECL, execclass_decl): New. (finish_file, start_class, continue_class, finish_class, start_method_def, continue_method_def, finish_method_def, start_protocol, finish_protocol, objc_build_throw_stmt, objc_build_try_catch_finally_stmt, objc_build_synchronized_prologue, objc_build_synchronized_epilogue, objc_build_try_prologue, objc_build_try_epilogue, objc_build_catch_stmt, objc_build_catch_epilogue, objc_build_finally_prologue, objc_build_finally_epilogue, is_ivar, is_private, is_public, add_instance_variable, objc_add_method, get_super_receiver, objc_clear_super_receiver, get_class_ivars_from_name, get_class_reference, get_static_reference, get_object_reference, build_message_expr, finish_message_expr, build_selector_expr, build_ivar_reference, build_keyword_decl, build_method_decl, build_protocol_expr, build_objc_string_object, objc_declare_alias, objc_declare_class, objc_declare_protocols, objc_comptypes, objc_check_decl, build_encode_expr): Remove prototypes. (imp_count, cat_count): Make GGC-aware. (OBJC_SET_TYPE_NAME): New macro. From-SVN: r87168
2004-09-08 02:49:44 +02:00
#endif
c-common.h (c_common_init, [...]): Update. * c-common.h (c_common_init, c_common_post_options): Update. * c-objc-common.c (c_objc_common_init): Update for new prototype. * c-opts.c (saved_lineno): New. (c_common_post_options, c_common_init): Update prototypes, move call to cpp_read_main_file from latter to former. * c-tree.h (c_ojbc_common_init): Update. * langhooks-def.h (lhd_post_options): New. (LANG_HOOKS_INIT, LANG_HOOKS_POST_OPTIONS): Update. * langhooks.c (lhd_post_options): New. * langhooks.h (struct lang_hooks): Update post_options and init hooks. * toplev.c (no_backend): New. (process_options): Call post_options hook and set main_input_filename and input_filename here. (lang_dependent_init, do_compile): post_options hook moved to process_options. * objc/objc-act.c (objc_init): Update prototype. * objc/objc-act.h (objc_init): Update prototype. ada: * misc.c (gnat_init): Update for new prototype. cp: * cp-tree.h (cxx_init): Update prototype. * lex.c (cxx_init): Similarly. f: * com.c (ffe_init): Update prototype; move code to ffe_post_options. (ffe_post_options): New. java: * lang.c (java_init): Update prototype, move code to java_post_options. (java_post_options): Similarly. treelang: * tree1.c (in_fname): Fix type. (treelang_init): Update prototype and use of in_fname. * treelang.h (in_fname): Fix type. * treetree.c (tree_code_if_start, tree_code_if_else, tree_code_if_end, tree_code_create_function_prototype, tree_code_create_function_initial, tree_code_create_funciton_wrapup, tree_code_create_variable, tree_code_output_expression_statement) : Fix prototypes and use of filenames. * treetree.h: Similarly. From-SVN: r64001
2003-03-08 22:12:26 +01:00
return false;
c-common.c: Include c-lex.h. * c-common.c: Include c-lex.h. (c_common_lang_init): Change prototype. Call init_c_lex and init_pragma from here. * c-common.h (c_common_lang_init): Change prototype. * c-decl.c (init_decl_processing): Rename. Call c_parse_init. * c-lang.c (c_init): Change prototype. Update. (c_init_options): Update. * c-lex.c (cpp_filename): Remove. (init_c_lex): Update. Read the main file, and get the original file name. (yyparse): Finish the command line options. * c-parse.in (c_parse_init): Call init_reswords here. (init_parse): Remove. * c-tree.h (c_init_decl_processing): New. * cpphash.c (_cpp_init_hashtable): After initializing the hash table, populate it. * cppinit.c (read_original_filename, cpp_finish_options): New. (cpp_create_reader): New prototype. Defer hash table initialization. (cpp_start_read): Rename cpp_read_main_file. Initialize the hash table. Get the original filename. * cpplib.h (cpp_create_reader): Update. (cpp_start_read): Remove. (cpp_read_main_file, cpp_finish_options): New. * cppmain.c (main, do_preprocessing): Update. * langhooks.h (struct langhooks): Update init prototype. * toplev.c (general_init, parse_options_and_default_flags, process_options, lang_indpendent_init, lang_dependent_init, init_asm_output): New; perform the bulk of initialization. (compile_file): Move most of initialization to above functions. (debug_hooks): Initialize statically. (set_Wunused): Relocate. (toplev_main): Move most of initialization to other init functions. Have a clear logic flow. * tree.h (init_parse, init_decl_processing): Remove. ada: * misc.c (gnat_init): Change prototype. Include the functionality of the old init_parse and init_decl_processing. (gnat_init_decl_processing): New prototype. (init_parse): Remove. * utils.c (init_decl_processing): Rename gnat_init_decl_processing. cp: * cp-tree.h (init_reswords, cxx_init_decl_processing): New. (cxx_init): Update prototype. * decl.c (init_decl_processing): Rename. Move null node init to its creation time. * lex.c (cxx_init_options): Update. (cxx_init): Combine with old init_parse; also call cxx_init_decl_processing. f: * com.c (ffecom_init_decl_processing): Renamed from init_decl_processing. (init_parse): Move contents to ffe_init. (ffe_init): Update prototype. java: * decl.c (init_decl_processing): Rename java_init_decl_processing. * java-tree.h: New prototype. * lang.c (java_init): Update prototype. Combine with old init_parse. objc: * objc-act.c (objc_init): Update prototype, combine with old init_parse. (objc_init_options): Update. From-SVN: r47046
2001-11-15 11:01:10 +01:00
#ifndef USE_MAPPED_LOCATION
Integrated preprocessor. top level: * Makefile.in: Remove all references to c-parse.gperf, c-gperf.h, and c-parse.h. Remove -d from yacc command line generating c-parse.c. Update dependencies. * c-parse.gperf, c-gperf.h: Delete. * c-common.c: Don't define parse_options, cpp_token, yy_cur, yy_lim, or yy_get_token. Don't define get_directive_line if USE_CPPLIB. * c-common.h: Add multiple include guard. Define RID values for every keyword in C, C++, and Objective C. Put all the modifiers first. (struct c_fileinfo, get_fileinfo, dump_time_statistics): New. * c-decl.c (c_decode_option): Handle -lang-objc here. (print_lang_identifier): Handle C_IS_RESERVED_WORD case. (grokdeclarator): Adjust for new RID scheme. (extract_interface_info): New stub. * c-lang.c: Don't declare yy_cur or parse_options. (lang_init_options): Call cpp_init. Don't call cpp_options_init. (lang_init): Don't call check_newline if USE_CPPLIB. * c-lex.c: Don't include c-parse.h. Do include timevar.h. Elide lots of unnecessary code if USE_CPPLIB. Delete code rendered unnecessary by new architecture. Move routines not shared with C++ to c-parse.in. Maintain a local idea of the line number. Handle C++ as well as C. [USE_CPPLIB]: Declare and register callbacks for #ident and for entering/leaving files. (init_c_lex, c_lex): Are now the entry points to this file. (check_newline): Break out directive handling to process_directive. (read_ucs, is_extended_char, utf8_extend_token): Moved here from C++ front end. (readescape, parse_float): Overhaul. (lex_number, lex_string, lex_charconst): Break out of c_lex (n'ee yylex). (get_fileinfo, update_header_times, dump_one_header, dump_time_statistics): New and/or moved here from C++. Support per-file data needed by C++ and per-header timing statistics (C++ only, at the moment). * c-lex.h: Update prototypes. Add multiple include guard. * c-tree.h (struct lang_identifier): Add rid_code field. (C_IS_RESERVED_WORD, C_RID_CODE): New. * c-parse.in: Include c-pragma.h. Remove unnecesary calls to reinit_parse_for_function and/or position_after_white_space. (save_filename, save_lineno): Look ahead before saving. (label -> identifier ':'): Save file and line before shifting ':'. (reservedwords): No need to call get_identifier. (init_parse, finish_parse, yyerror, yylex, yyprint, make_pointer_declarator): Are now here for C/ObjC. (rid_to_yy): Conversion table from RID constants to Yacc codes. * c-pragma.c: Rewrite parsing logic to fit with cpplib's #pragma registry. Provide dummy implementation of that interface if !USE_CPPLIB. * c-pragma.h: Update to match. * flags.h: Add multiple include guard. (flag_detailed_statistics): Moved here from C++. * toplev.c: Define flag_detailed_statistics. * gcc.c (C specs): Use %(trad_capable_cpp) for -E|-M|-MM case #if USE_CPPLIB. * timevar.def (TV_CPP, TV_LEX): New. * timevar.h: Add multiple include guard. * objc/lang-specs.h: Use %(trad_capable_cpp) for -E|-M|-MM case #if USE_CPPLIB. * objc/objc-act.c: Don't mention yy_cur or parse_options. Initialize cpplib properly. Force lineno to 0 after first call to check_newline. Don't handle -lang-objc here. Move forget_protocol_qualifiers and remember_protocol_qualifiers here. cp: * Make-lang.in, Makefile.in: Remove all references to input.c, gxx.gperf, and hash.h. Add ../c-lex.o to C_OBJS. * gxx.gperf, hash.h, input.c: Delete. * lang-specs.h: Pass -lang-c++ to cc1plus so cpplib is initialized properly. * class.c (fixup_pending_inline): Take a tree, not a struct pending_inline *. All callers changed. (init_class_processing): Set RID_PUBLIC, RID_PRIVATE, RID_PROTECTED entries in ridpointers[] array here. * decl.c (duplicate_decls): Do not refer to struct pending_inline. (record_builtin_type, init_decl_processing): Use RID_MAX not CP_RID_MAX. (grokdeclarator): Use C_IS_RESERVED_WORD. * decl2.c (lang_decode_option): Ignore -lang-c++ for sake of cpplib. (grok_x_components): Do not inspect pending_inlines chain. * cp-tree.h (struct lang_identifier): Add rid_code entry. (C_IS_RESERVED_WORD, C_RID_CODE, C_RID_YYCODE): New. (flag_no_gnu_keywords, flag_operator_names, rid_to_yy): Declare. (DEFARG_LENGTH, struct pending_inline, TIME_IDENTIFIER_TIME, TIME_IDENTIFIER_FILEINFO): Kill. Update prototypes. * lex.h: Expunge cp_rid. Rewrite RIDBIT macros to use just a single 32-bit word. * parse.y: Call do_pending_inlines unconditionally. reinit_parse_for_method is now snarf_method. fn.defpen is no longer necessary. Remove unnecessary <itype> annotation on SCOPE. Do not refer to end_of_file or struct pending_inline. * semantics.c (begin_inline_definitions): Call do_pending_inlines unconditionally. * lex.c: Remove all code now shared with C front end. Initialize cpplib properly if USE_CPPLIB. Put reserved words into the get_identifier table. Rewrite pragma handling to work with the registry. Move code to save tokens for later processing to spew.c. * spew.c: Rewrite everything in terms of token streams instead of text. Move routines here from lex.c / input.c as appropriate. GC-mark trees hanging off the pending inlines chain. testsuite: * g++.old-deja/g++.benjamin/13478.C: Put meaningful tags on ERROR markers. * g++.old-deja/g++.brendan/crash8.C: Move ERROR marker up one line. * gcc.dg/c99-array-nonobj-1.c: Don't expect func[] cases to fail. * gcc.dg/wtr-label-1.c: Don't use unconstrained .* in error regexps. * gcc.dg/wtr-suffix-1.c: Correct error regexps. * gcc.dg/cpp/unc1.c, gcc.dg/cpp/unc2.c, gcc.dg/cpp/unc3.c: Preprocess only. * gcc.dg/cpp/unc4.c: Adjust line number in dg-error line. * gcc.dg/noncompile/const-ll-1.c: Generalize error regexp. From-SVN: r36216
2000-09-07 02:37:14 +02:00
/* Force the line number back to 0; check_newline will have
raised it to 1, which will make the builtin functions appear
not to be built in. */
input.h (lineno): Rename to ... * input.h (lineno): Rename to ... (input_line): ... here. * tree.h (lineno): Rename to ... (input_line): ... here. * scan.h (lineno): Rename to ... (input_line): ... here. * toplev.c (lineno): Rename to ... (input_line): ... here. (push_srcloc, pop_srcloc): Rename lineno to input_line. * c-common.c (c_expand_start_cond, fname_decl): Likewise. * c-decl.c (poplevel, pop_label_level, lookup_label, lookup_tag, store_parm_decls, c_expand_body_1): Likewise. * c-errors.c (pedwarn_c99): Likewise. * c-format.c (status_warning): Likewise. * c-lex.c (fe_file_change, cb_def_pragma, c_lex): Likewise. * c-opts.c (c_common_post_options, c_common_parse_file): Likewise. * c-parse.in (save_filename, maybe_type_qual, ifc): Likwise. * c-semantics.c (finish_stmt_tree, build_stmt, emit_local_var, gentrtl_goto_stmt, genrtl_expr_stmt_value, genrtl_decl_stmt, genrtl_if_stmt, genrtl_while_stmt, genrtl_do_stmt, genrtl_return_stmt, genrtl_for_stmt, build_break_stmt, build_continue_stmt, genrtl_switch_stmt, genrtl_asm_stmt, prep_stmt, find_reachable_label, expand_unreachable_stmt): Likewise. * coverage.c (create_coverage): Likewise. * diagnostic.c (pedwarn, sorry, error, fatal_error, internal_error, warning, diagnostic_report_current_module, inform): Likewise. * expr.c (expand_expr): Likewise. * integrate.c (expand_inline_function, output_inline_function): Likewise. * rtl-error.c (file_and_line_for_asm): Likewise. * tree-inline.c (find_alloca_call, find_builtin_longjmp_call, walk_tree): Likewise. * tree.c (make_node): Likewise. * ada, cp, f, java, objc, treelang: Likewise. ada * trans.c (build_unit_elab, set_lineno): Rename lineno to input_line. * utils.c (pushdecl, create_label_decl, begin_subprog_body, end_subprog_body): Likewise. * utils2.c (build_call_raise): Likewise. cp * class.c (finish_struct): Rename lineno to input_line. * decl.c (push_binding_level, pop_binding_level, suspend_binding_level, resume_binding_level, make_label_decl, use_label, start_function): Likewise. * decl2.c (warn_if_unknown_interface, start_static_initialization_or_destruction, generate_ctor_or_dtor_function, finish_file): Likewise. * error.c (cp_line_of, print_instantiation_full_context, print_instantiation_context): Likewise. * except.c (check_handlers_1, check_handlers): Likewise. * init.c (create_temporary_var): Likewise. * method.c (use_thunk, synthesize_method): Likewise. * parser.c (cp_lexer_set_source_position_from_token, cp_lexer_get_preprocessor_token): Likewise. * pt.c (push_tinst_level, pop_tinst_level, tsubst_friend_function, instantiate_class_template, tsubst_decl, tsubst, tsubst_expr, instantiate_decl): Likewise. * semantics.c (genrtl_try_block, finish_label_stmt, begin_class_definition, expand_body, genrtl_finish_function): Likewise. * tree.c (build_min_nt, build_min): Likewise. f * ansify.c (die_unless): Rename lineno to input_line. * com.c (ffecom_subscript_check_, ffecom_do_entry_, ffecom_gen_sfuncdef_, ffecom_start_progunit_, ffecom_sym_transform_, ffecom_sym_transform_assign_, bison_rule_pushlevel_, bison_rule_compstmt_, finish_function, store_parm_decls): Likewise. * intrin.c (ffeintrin_fulfill_generic): Likewise. * lex.c (ffelex_hash_, ffelex_include_, ffelex_next_line_, ffelex_file_fixed, ffelex_file_free): Likewise. * std.c (ffestd_exec_end): Likewise. * ste.c (ffeste_emit_line_note_, ffeste_start_block_, ffeste_start_stmt_): Likewise. * ste.h (ffeste_filelinenum, ffeste_set_line): Likewise. java * lex.h (lineno): Rename to ... (input_line): ... here * parse-scan.y (lineno): Rename to ... (input_line): ... here. (reset_report): Rename lineno to input_line. * check-init.c (check_init): Likewise. * class.c (push_class): Likewise. * decl.c (complete_start_java_method, end_java_method): Likewise. * expr.c (expand_byte_code): Likewise. * jcf-parse.c (give_name_to_class, parse_class_file): Likewise. * jcf-write.c (generate_bytecode_insns): Likewise. * lex.c (java_init_lex, java_allocate_new_line, do_java_lex): Likewise. * parse.h (YYNOT_TWICE): Likewise. * parse.y (empty_statement, expression_statement, java_pop_parser_context, java_parser_context_save_global, yyerror, register_fields, method_header, safe_layout_class, find_in_imports_on_demand, create_artificial_method, source_end_java_method, start_complete_expand_method, build_thisn_assign, java_complete_lhs, maybe_absorb_scoping_block): Likewise. objc * objc-act.c (objc_init): Rename lineno to input_line. (build_module_descriptor, build_selector_translation_table, build_protocol_template, build_method_prototype_list_template, build_category_template, build_selector_table, build_class_template, build_super_template, build_ivar_template, build_ivar_list_template, build_method_list_template, build_method_template, add_instance_variable): Likewise. treelang * tree1.c (treelang_init): Rename lineno to input_line. From-SVN: r66333
2003-05-01 18:13:36 +02:00
input_line = 0;
#endif
1992-01-18 00:15:38 +01:00
/* If gen_declaration desired, open the output file. */
if (flag_gen_declaration)
{
register char * const dumpname = concat (dump_base_name, ".decl", NULL);
1992-01-18 00:15:38 +01:00
gen_declaration_file = fopen (dumpname, "w");
if (gen_declaration_file == 0)
fatal_error ("can't open %s: %m", dumpname);
c-aux-info.c (concat): Don't define. * c-aux-info.c (concat): Don't define. * cccp.c (my_strerror): Likewise. All callers changed to use xstrerror instead. (do_include): Call xstrdup, not xmalloc/strcpy. (grow_outbuf): Don't check if xrealloc returns NULL, it can't. (xmalloc, xrealloc, xcalloc, xstrdup): Don't define. * collect2.c (my_strsignal): Likewise. All callers changed to use strsignal instead. (locatelib): Call xstrdup, not xmalloc/strcpy. * 1750a.h (ASM_OUTPUT_INTERNAL_LABEL): Call xmalloc, not malloc. * dsp16xx.c (override_options): Call xstrdup, not xmalloc/strcpy. * i370.h (ASM_DECLARE_FUNCTION_NAME): Call xmalloc, not malloc. * mips.c (build_mips16_call_stub): Call xstrdup, not xmalloc/strcpy. * cppinit.c (cpp_options_init): Call xcalloc, not xmalloc/bzero. * dwarfout.c (dwarfout_init): Call concat, not xmalloc/strcpy/... * except.c (new_eh_region_entry): Call xmalloc/xrealloc, not malloc/realloc. (find_all_handler_type_matches): Likewise. Don't check return value. (get_new_handler, init_insn_eh_region, process_nestinfo): Call xmalloc, not malloc. (init_eh_nesting_info): Likewise. Call xcalloc, not xmalloc/bzero. * gcc.c (xstrerror, xmalloc, xrealloc): Don't define. (init_spec): Call xcalloc, not xmalloc/bzero. (set_spec): Call xstrdup, not save_string. (record_temp_file): Call xstrdup, not xmalloc/strcpy. (find_a_file): Call xstrdup, not xmalloc/strcpy. (process_command): Call xstrdup, not save_string. (main): Call xcalloc, not xmalloc/bzero. * gcov.c (xmalloc): Don't define. (create_program_flow_graph): Call xcalloc, not xmalloc/bzero. (scan_for_source_files): Call xstrdup, not xmalloc/strcpy. (output_data): Call xcalloc, not xmalloc/bzero. * haifa-sched.c (schedule_insns): Call xcalloc, not xmalloc/bzero. * mips-tdump.c (xmalloc): Don't define. (print_symbol): Call xmalloc, not malloc. (read_tfile): Call xcalloc, not calloc. * mips-tfile.c (xfree, my_strsignal, xmalloc, xcalloc, xrealloc): Don't define. All callers of xfree/my_strsignal changed to use free/strsignal instead. (allocate_cluster): Call xcalloc, not calloc. * objc/objc-act.c (lang_init): Call concat, not xmalloc/strcpy/... Fix memory leak, free allocated memory. * prefix.c (translate_name): Call xstrdup, not save_string. (update_path): Likewise. * profile.c (branch_prob): Call xstrdup, not xmalloc/strcpy. * protoize.c (xstrerror, xmalloc, xrealloc, xfree, savestring2): Don't define. Callers of xfree/savestring2 changed to use free/concat instead. * reload1.c (reload): Call xcalloc, not xmalloc/bzero. (init_elim_table): Likewise. * resource.c (init_resource_info): Likewise. * stupid.c (stupid_life_analysis): Likewise. * toplev.c (xmalloc, xcalloc, xrealloc, xstrdup): Don't define. (open_dump_file): Call concat, not xmalloc/strcpy/... (clean_dump_file): Likewise. (compile_file): Call xstrdup, not xmalloc/strcpy. From-SVN: r29148
1999-09-07 04:36:41 +02:00
free (dumpname);
1992-01-18 00:15:38 +01:00
}
if (flag_next_runtime)
{
TAG_GETCLASS = "objc_getClass";
TAG_GETMETACLASS = "objc_getMetaClass";
TAG_MSGSEND = "objc_msgSend";
TAG_MSGSENDSUPER = "objc_msgSendSuper";
TAG_MSGSEND_STRET = "objc_msgSend_stret";
TAG_MSGSENDSUPER_STRET = "objc_msgSendSuper_stret";
default_constant_string_class_name = "NSConstantString";
}
else
{
TAG_GETCLASS = "objc_get_class";
TAG_GETMETACLASS = "objc_get_meta_class";
TAG_MSGSEND = "objc_msg_lookup";
TAG_MSGSENDSUPER = "objc_msg_lookup_super";
/* GNU runtime does not provide special functions to support
structure-returning methods. */
default_constant_string_class_name = "NXConstantString";
flag_typed_selectors = 1;
}
init_objc ();
if (print_struct_values)
generate_struct_by_value_array ();
c-common.h (c_common_init, [...]): Update. * c-common.h (c_common_init, c_common_post_options): Update. * c-objc-common.c (c_objc_common_init): Update for new prototype. * c-opts.c (saved_lineno): New. (c_common_post_options, c_common_init): Update prototypes, move call to cpp_read_main_file from latter to former. * c-tree.h (c_ojbc_common_init): Update. * langhooks-def.h (lhd_post_options): New. (LANG_HOOKS_INIT, LANG_HOOKS_POST_OPTIONS): Update. * langhooks.c (lhd_post_options): New. * langhooks.h (struct lang_hooks): Update post_options and init hooks. * toplev.c (no_backend): New. (process_options): Call post_options hook and set main_input_filename and input_filename here. (lang_dependent_init, do_compile): post_options hook moved to process_options. * objc/objc-act.c (objc_init): Update prototype. * objc/objc-act.h (objc_init): Update prototype. ada: * misc.c (gnat_init): Update for new prototype. cp: * cp-tree.h (cxx_init): Update prototype. * lex.c (cxx_init): Similarly. f: * com.c (ffe_init): Update prototype; move code to ffe_post_options. (ffe_post_options): New. java: * lang.c (java_init): Update prototype, move code to java_post_options. (java_post_options): Similarly. treelang: * tree1.c (in_fname): Fix type. (treelang_init): Update prototype and use of in_fname. * treelang.h (in_fname): Fix type. * treetree.c (tree_code_if_start, tree_code_if_else, tree_code_if_end, tree_code_create_function_prototype, tree_code_create_function_initial, tree_code_create_funciton_wrapup, tree_code_create_variable, tree_code_output_expression_statement) : Fix prototypes and use of filenames. * treetree.h: Similarly. From-SVN: r64001
2003-03-08 22:12:26 +01:00
return true;
}
1992-01-18 00:15:38 +01:00
void
Makefile.in (C_PRETTY_PRINT_H): Add c-pretty-print.h. [gcc/ChangeLog] 2004-08-15 Ziemowit Laski <zlaski@apple.com> * Makefile.in (C_PRETTY_PRINT_H): Add c-pretty-print.h. (c-lang.o): Depend on c-objc-common.h. (c-objc-common.o): Depend on $(C_PRETTY_PRINT_H) and c-objc-common.h; remove duplicate $(C_TREE_H) dependency. * c-lang.c: Include c-objc-common.h. (LANG_HOOKS_FINISH, LANG_HOOKS_INIT_OPTIONS, LANG_HOOKS_INITIALIZE_DIAGNOSTICS, LANG_HOOKS_HANDLE_OPTION, LANG_HOOKS_MISSING_ARGUMENT, LANG_HOOKS_POST_OPTIONS, LANG_HOOKS_GET_ALIAS_SET, LANG_HOOKS_SAFE_FROM_P, LANG_HOOKS_EXPAND_EXPR, LANG_HOOKS_MARK_ADDRESSABLE, LANG_HOOKS_PARSE_FILE, LANG_HOOKS_TRUTHVALUE_CONVERSION, LANG_HOOKS_FINISH_INCOMPLETE_DECL, LANG_HOOKS_UNSAFE_FOR_REEVAL, LANG_HOOKS_STATICP, LANG_HOOKS_SET_DECL_ASSEMBLER_NAME, LANG_HOOKS_NO_BODY_BLOCKS, LANG_HOOKS_WARN_UNUSED_GLOBAL_DECL, LANG_HOOKS_PRINT_IDENTIFIER, LANG_HOOKS_FUNCTION_ENTER_NESTED, LANG_HOOKS_FUNCTION_LEAVE_NESTED, LANG_HOOKS_DUP_LANG_SPECIFIC_DECL, LANG_HOOKS_DECL_UNINIT, LANG_HOOKS_RTL_EXPAND_STMT, LANG_HOOKS_COMMON_ATTRIBUTE_TABLE, LANG_HOOKS_FORMAT_ATTRIBUTE_TABLE, LANG_HOOKS_TREE_INLINING_CANNOT_INLINE_TREE_FN, LANG_HOOKS_TREE_INLINING_DISREGARD_INLINE_LIMITS, LANG_HOOKS_TREE_INLINING_ANON_AGGR_TYPE_P, LANG_HOOKS_TREE_INLINING_CONVERT_PARM_FOR_INLINING, LANG_HOOKS_TREE_INLINING_ESTIMATE_NUM_INSNS, LANG_HOOKS_TREE_DUMP_DUMP_TREE_FN, LANG_HOOKS_CALLGRAPH_EXPAND_FUNCTION, LANG_HOOKS_TYPE_FOR_MODE, LANG_HOOKS_TYPE_FOR_SIZE, LANG_HOOKS_SIGNED_TYPE, LANG_HOOKS_UNSIGNED_TYPE, LANG_HOOKS_SIGNED_OR_UNSIGNED_TYPE, LANG_HOOKS_INCOMPLETE_TYPE_ERROR, LANG_HOOKS_TYPE_PROMOTES_TO, LANG_HOOKS_REGISTER_BUILTIN_TYPE, LANG_HOOKS_WRITE_GLOBALS): Move to c-objc-common.h. * c-objc-common.c: Include c-objc-common.h. * c-objc-common.h: New file. [gcc/objc/ChangeLog] 2004-08-15 Ziemowit Laski <zlaski@apple.com> * Make-lang.in (objc/objc-lang.o): Depend on $(C_PRETTY_PRINT_H), $(DIAGNOSTIC_H), c-objc-common.h and gtype-objc.h, but not on toplev.h. (objc/objc-parse.o): Do not depend on gtype-objc.h. * objc-act.c: Do not include gtype-objc.h. (finish_file): Rename to objc_finish_file(). * objc-act.h (finish_file): Update copyright notice; remove prototype. * objc-lang.c: Update copyright notice; include diagnostic.h, c-objc-common.h, c-pretty-print.h and gtype-objc.h; do not include toplev.h. (finish_file): New hook routine. (LANG_HOOKS_FINISH, LANG_HOOKS_INIT_OPTIONS, LANG_HOOKS_INITIALIZE_DIAGNOSTICS, LANG_HOOKS_HANDLE_OPTION, LANG_HOOKS_MISSING_ARGUMENT, LANG_HOOKS_POST_OPTIONS, LANG_HOOKS_GET_ALIAS_SET, LANG_HOOKS_SAFE_FROM_P, LANG_HOOKS_EXPAND_EXPR, LANG_HOOKS_MARK_ADDRESSABLE, LANG_HOOKS_PARSE_FILE, LANG_HOOKS_TRUTHVALUE_CONVERSION, LANG_HOOKS_FINISH_INCOMPLETE_DECL, LANG_HOOKS_UNSAFE_FOR_REEVAL, LANG_HOOKS_STATICP, LANG_HOOKS_SET_DECL_ASSEMBLER_NAME, LANG_HOOKS_NO_BODY_BLOCKS, LANG_HOOKS_WARN_UNUSED_GLOBAL_DECL, LANG_HOOKS_PRINT_IDENTIFIER, LANG_HOOKS_FUNCTION_ENTER_NESTED, LANG_HOOKS_FUNCTION_LEAVE_NESTED, LANG_HOOKS_DUP_LANG_SPECIFIC_DECL, LANG_HOOKS_DECL_UNINIT, LANG_HOOKS_RTL_EXPAND_STMT, LANG_HOOKS_COMMON_ATTRIBUTE_TABLE, LANG_HOOKS_FORMAT_ATTRIBUTE_TABLE, LANG_HOOKS_TREE_INLINING_CANNOT_INLINE_TREE_FN, LANG_HOOKS_TREE_INLINING_DISREGARD_INLINE_LIMITS, LANG_HOOKS_TREE_INLINING_ANON_AGGR_TYPE_P, LANG_HOOKS_TREE_INLINING_CONVERT_PARM_FOR_INLINING, LANG_HOOKS_TREE_INLINING_ESTIMATE_NUM_INSNS, LANG_HOOKS_TREE_DUMP_DUMP_TREE_FN, LANG_HOOKS_CALLGRAPH_EXPAND_FUNCTION, LANG_HOOKS_TYPE_FOR_MODE, LANG_HOOKS_TYPE_FOR_SIZE, LANG_HOOKS_SIGNED_TYPE, LANG_HOOKS_UNSIGNED_TYPE, LANG_HOOKS_SIGNED_OR_UNSIGNED_TYPE, LANG_HOOKS_INCOMPLETE_TYPE_ERROR, LANG_HOOKS_TYPE_PROMOTES_TO, LANG_HOOKS_REGISTER_BUILTIN_TYPE, LANG_HOOKS_WRITE_GLOBALS): Move to c-objc-common.h. From-SVN: r86037
2004-08-15 23:47:32 +02:00
objc_finish_file (void)
1992-01-18 00:15:38 +01:00
{
mark_referenced_methods ();
Makefile.in (c-parse.o): Depend on $(C_COMMON_H). [gcc/ChangeLog] 2004-09-07 Ziemowit Laski <zlaski@apple.com> * Makefile.in (c-parse.o): Depend on $(C_COMMON_H). * c-parse.in: Include c-common.h instead of objc-act.h. (ivar_decl_list, ivar_decls, ivar_decl, ivars, ivar_declarator, myparms, myparm): Remove %type declarations. (methodtype, optparms, OBJC_TYPE_QUAL, objc_quals, objc_qual, objc_typename, objc_try_catch_stmt, optellipsis): Add %type declarations. (objc_inherit_code, objc_public_flag): Remove. (typespec_nonreserved_nonattr): Call objc_get_protocol_qualified_type() instead of get_static_reference() and get_protocol_reference(). (stmt_nocomp): Call grokparm() on @catch parameter. (objcdef): Move semantic action to objc_finish_implementation(). (classdef): Move semantic action to objc_start_class_interface(), objc_continue_interface(), objc_finish_interface(), objc_start_class_implementation(), objc_continue_implementation(), objc_start_category_interface() and objc_start_category_implementation(). (protocoldef): Move semantic actions to objc_start_protocol() and objc_finish_interface(). (ivar_decl_list): Remove nonterminal. (visibility_spec): Move semantic actions to objc_set_visibility(). (ivar_decls): Remove assignment to $$. (ivar_decl): Rephrase in terms of component_decl; call objc_add_instance_variable(). (ivars, ivar_declarator): Remove nonterminals. (opt_semi): New nonterminal. (methodtype): Remove semantic actions. (methoddef): Move semantic actions to objc_set_method_type(), objc_start_method_definition() and objc_finish_method_definition(). (methodproto): Move semantic actions to objc_set_method_type() and objc_add_method_declaration(). (methoddecl): Use objc_typename instead of typename; move semantic actions to objc_build_method_signature(). (optarglist, myxdecls, mydecl, myparms, myparm): Remove nonterminals. (optparmlist): Express in terms of optparms and optellipsis. (optparms, optellipsis, objc_qual, objc_quals, objc_typename): New nonterminals. (keyworddecl): Use objc_typename instead of typename. (rid_to_yy): Mark RID_IN, RID_OUT, RID_INOUT, RID_BYCOPY, RID_BYREF and RID_ONEWAY as returning OBJC_TYPE_QUAL to yyparse(). [gcc/objc/ChangeLog] 2004-09-07 Ziemowit Laski <zlaski@apple.com> * Make-lang.in (objc/objc-parse.o): Depend on $(C_COMMON_H) instead of objc/objc-act.h. (objc/objc-act.o): Depend on $(HASHTAB_H). * objc-act.c: Include hashtab.h; in ObjC++ mode, include cp-tree.h and objcp-decl.h instead of c-tree.h. (build_module_descriptor, get_class_ivars, synth_id_with_class_suffix, error_with_ivar, gen_method_decl, gen_declaration, setup_string_decl, build_protocol_template): Adjust prototypes. (build_module_initializer_routine, start_class, continue_class, finish_class, start_method_def, objc_start_function, start_protocol, build_method_decl, objc_add_method, add_instance_variable, build_ivar_reference, is_ivar, is_private, get_super_receiver, build_selector_table_decl, objc_push_parm, objc_get_parm_info, gen_type_name, gen_type_name_0, start_var_decl, finish_var_decl, create_field_decl): New prototypes. (objc_expand_function_end, comp_method_with_proto, objc_expr_last, gen_declaration_1, gen_declarator, is_complex_decl, adorn_decl, define_decl, create_builtin_decl, gen_declspecs): Remove prototypes. (TYPE_ID): Rename to OBJECT_TYPEDEF_NAME. (CLASS_TYPEDEF_NAME): New. (TAG_EXECCLASS): Change from a global variable to a #define. (TAG_RETURN_STRUCT): Delete. (TAG_GNUINIT): New, holds '__objc_gnu_init' name. (objc_inherit_code, objc_public_flag): New, moved from c-parse.in. (string_descriptor): New struct. (string_htab): New hash table. (string_hash, string_eq): New prototypes. (generate_struct_by_value_array): Call create_field_decl() instead of create_builtin_decl(). (objc_init): Do not initialize objc_ellipsis_node or TAG_EXECCLASS; In ObjC++ mode, call cxx_init() instead of c_objc_common_init(). (objc_finish_file): In ObjC++, call instantiate_pending_templates() and cp_finish_file(). (define_decl, get_static_reference, get_protocol_reference, create_builtin_decl): Remove functions. (objc_start_class_interface, objc_start_category_interface, objc_start_protocol, objc_continue_interface, objc_finish_interface, objc_start_class_implementation, objc_start_category_implementation, objc_continue_implementation, objc_finish_implementation, objc_set_visibility, objc_set_method_type, objc_build_method_signature, objc_add_method_declaration, objc_start_method_definition, objc_add_instance_variable, objc_get_protocol_qualified_type, create_field_decl, start_var_decl, finish_var_decl): New functions. (setup_string_decl): Simplify since it is only called once. (synth_module_prologue): Call build_class_template(); predefine 'id' and 'Class' as typedefs; rename 'temp_type' to 'type'; disable debug hooks for duration of function; fix GNU runtime messenger signatures to correspond to reality; forward-declare '__objc_exec_class' for the GNU runtime; call build_selector_table_decl(); in ObjC++ mode, generate 'extern "C" { ... }' wrappers around synthesized declarations; call build_protocol_template() and build_category_template(). (string_hash, string_eq): New functions. (objc_build_string_object): Check metaclass correctness only once; store string literals in hash table. (objc_build_constructor): Do not convert initializer elements; adjust for ObjC++ impedance mismatch. (build_objc_symtab_template): Call create_field_decl() instead of create_builtin_decl(). (init_objc_symtab): Add missing conversion to initializer element. (build_metadata_decl): Call start_var_decl() instead of define_decl(). (generate_objc_symtab_decl): Do not call build_category_template(); call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(). (build_module_descriptor): Call create_field_decl() instead of grokfield(); call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(); always mark module descriptor as used; move GNU runtime-specific functionality to build_module_initializer_routine(). (build_module_initializer_routine): New function, broken off of build_module_descriptor(). (objc_static_init_needed_p, objc_generate_static_init_call): New functions. (generate_static_references, generate_strings, build_selector_translation_table, generate_descriptor_table, generate_ivars_list, generate_dispatch_table, generate_category): Call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(); build a type directly instead of via groktypename(). (build_selector_reference_decl, build_selector_table_decl, build_class_reference_decl, build_protocol_reference, generate_objc_image_info): Call start_var_decl() instead of build_decl(). (build_selector_reference): For GNU runtime, do not call build_selector_reference_decl(). (build_selector, build_typed_selector_reference): Always convert result to the selector type. (add_objc_string): Cast return value to 'char *'. (build_method_prototype_template, build_selector_template, build_method_template): Use actual selector type for fields pointing to selectors. (finish_objc): For GNU runtime, call build_module_initializer_routine() after build_module_descriptor(). (generate_protocol_list, generate_shared_structures): Call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(); build a type directly instead of via groktypename(). (synth_id_with_class_suffix): Return a string. (get_arg_type_list): For instance methods, use the instance type for 'self'; do not call groktypename_in_parm_context(). (build_objc_string_decl): Squash redeclaration errors in ObjC++. (objc_is_class_name): Use OBJC_TYPE_NAME instead of TYPE_NAME; handle RECORD_TYPEs in ObjC as well as ObjC++. (objc_is_id): New function. (objc_is_object_ptr): Return the canonical type node. (objc_get_class_ivars): Simplify using get_class_ivars(). (get_class_ivars): Remove second parameter; create a fresh copy of the ivar list for each call; do not check for existence of super class. (objc_eh_runtime_type): Mark #ifndef OBJCPLUS. (objc_init_exceptions): When using SJLJ-style exceptions, require the use of '-fobjc-exceptions' flag; do not require it for DWARF-style exceptions. (objc_build_exc_ptr, next_sjlj_build_try_catch_finally): Use objc_object_type instead of objc_id_type. (objc_begin_catch_clause): Convert the incoming PARM_DECL into a VAR_DECL before placing it in the appropriate scope; do not call define_decl(); adjust call to c_begin_compound_stmt(); use objc_object_type instead of objc_id_type. (build_next_objc_exception_stuff): Call create_field_decl() instead of create_builtin_decl(); construct type directly instead of calling groktypename(); use OBJC_VOID_AT_END to mark end of function parameters. (build_private_template): Adjust call to get_class_ivars(); build a type directly instead of via groktypename(). (build_protocol_template, build_method_prototype_list_template, build_method_prototype_template, build_category_template, build_selector_template, build_class_template, build_super_template, build_ivar_template, build_ivar_list_template, build_method_list_template, build_method_template): Call create_field_decl() instead of grokfield(). (objc_method_parm_type): Do not call groktypename(). (generate_descriptor_table): Call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(). (generate_method_descriptors, build_protocol_initializer, generate_dispatch_tables, build_category_initializer, build_shared_structure_initializer): Do not call groktypename(). (generate_protocols): Call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(); do not call groktypename(). (error_with_ivar): Remove last parameter. (check_ivars): Do not iterate ovar CLASS_RAW_IVARS lists in addition to CLASS_IVARS lists; adjust calls to error_with_ivar(). (generate_ivar_lists): Convert one of the initializer elements; do not call groktypename(). (get_arg_type_list, start_method_def, gen_method_def): Account for new representation of variable arguments and '...' in Objective-C methods; add Objective-C++ impedance matching code. (is_objc_type_qualifier): Remove function. (adjust_type_for_id_default): Simplify; there is no longer a need to wade through declspecs. (lookup_interface, start_class, continue_class, finish_class, start_method_def, start_protocol, build_method_decl, objc_add_method, add_instance_variable, build_ivar_reference, is_ivar, is_private, get_super_receiver, objc_build_finally_epilogue): Make into static functions. (receiver_is_class_object): Use new IS_CLASS() macro. (objc_build_message_expr): Tweak ObjC++ message argument handling; call objc_finish_message_expr() instead of finish_message_expr(). (finish_message_expr): Rename to objc_finish_message_expr(); use OBJC_TYPE_NAME and OBJC_SET_TYPE_NAME macros instead of TYPE_NAME. call gen_type_name() instead of gen_declaration(); call objc_is_id() instead of using IS_ID and IS_CLASS; Use objc_class_name instead of calling get_identifier("Class"); handle CONVERT_EXPRs in receiver. (build_objc_method_call, warn_with_method): Do not call groktypename(). (build_ivar_reference): Call convert() instead of clobbering in a type. (hash_init): Initialize string_htab hash table. (add_instance_variable): Simplify parameter list; do not call grokfield(); do not populate CLASS_IVARS list. (start_class): Check for the existence of super class, if one was specified. (continue_class): Use CLASS_RAW_IVARS rather than CLASS_IVARS; do not call build_class_template(); adjust call to get_class_ivars(); call build_decl(), pushdecl() and finish_decl() instead of define_decl(). (finish_class): Call build_decl(), pushdecl() and finish_decl() instead of define_decl(). (add_protocols): Use PROTOCOL_BINFO_ELTS for the tree vector size. (start_protocol): Do not call build_protocol_template(); use PROTOCOL_BINFO_ELTS for the tree vector size. (encode_type_qualifiers): Do not handle the 'const' qualifier here. (encode_pointer): Encode 'const char *' as 'r*', for backwards compatibility. (encode_array): Use HOST_WIDE_INT_PRINT_DEC instead of "%ld". (encode_type): Handle the 'const' qualifier here. (objc_parmlist): New global variable, sued by objc_push_parm and objc_get_parm_info(). (objc_push_parm, objc_get_parm_info): New functions. (objc_expr_last): Remove function. (synth_self_and_ucmd_args): For instance methods, use the instance type for 'self'; call objc_push_parm() instead of push_parm_decl(). (start_method_def): Do not call push_scope(), declare_parm_level(), pop_scope(), push_parm_decl(), store_parm_decls() or objc_expr_last(); just use objc_push_parm() and objc_get_parm_info(). (comp_method_with_proto): Remove function. (objc_types_are_equivalent): Strip away indirections before comparing underlying types. (comp_proto_with_proto): Do not call groktypename(); types are no longer in raw declspec format. (objc_start_function): New function. (really_start_method): Call comp_proto_with_proto() instead of comp_method_with_proto(); call objc_start_function() instead of hand-crafting a function declarator. (continue_method_def, objc_expand_function_end): Remove functions. (get_super_receiver): Call objc_get_current_scope() instead of get_current_scope(); reference 'super_class' field (instead of 'class'). (finish_method_def): Rename to objc_finish_method_definition() and add a function decl parameter; move method encoding call from objc_expand_function_end(). (is_complex_decl, adorn_decl, gen_declarator, gen_declspecs, gen_declaration_1): Remove functions. (tmpbuf, RAW_DECLSPEC): Remove. (gen_declaration): Remove second parameter; simplify to deal with TYPE_P nodes instead of raw declspecs. (gen_type_name, gen_type_name_0): New functions. (gen_method_decl): Remove second parameter; call gen_type_name() instead of gen_declaration_1(). (dump_interface): Adjust calls to gen_declaration() and gen_method_decl(); do not allocate a separate string buffer. (init_objc): Allocate a larger string buffer to accommodate dump_interface(); adjust call to build_module_descriptor(); add call to build_module_initializer_routine() for the GNU runtime. (generate_classref_translation_entry): Do not call start_decl(); call finish_var_decl() instead of finish_decl(); call convert() instead of build_c_cast(). * objc-act.h (CLASS_OWN_IVARS): Remove accessor. (CLASS_BINFO_ELTS): Reduce from 6 to 5, now that CLASS_OWN_IVARS is gone. (OCTI_GNU_INIT_DECL, GNU_INIT_decl): New. (OCTI_ELLIPSIS_NODE, objc_ellipsis_node): Remove. (OCTI_ID_ID, id_type, objc_id_id): Rename to OCTI_ID_NAME, objc_object_type and objc_object_name, respectively. (OCTI_CLS_REF, OCTI_CLASS_NAME, objc_class_reference, objc_class_name): New. (IS_CLASS): New macro. (IS_ID, IS_SUPER): Robustify. (OCTI_EXECCLASS_DECL, execclass_decl): New. (finish_file, start_class, continue_class, finish_class, start_method_def, continue_method_def, finish_method_def, start_protocol, finish_protocol, objc_build_throw_stmt, objc_build_try_catch_finally_stmt, objc_build_synchronized_prologue, objc_build_synchronized_epilogue, objc_build_try_prologue, objc_build_try_epilogue, objc_build_catch_stmt, objc_build_catch_epilogue, objc_build_finally_prologue, objc_build_finally_epilogue, is_ivar, is_private, is_public, add_instance_variable, objc_add_method, get_super_receiver, objc_clear_super_receiver, get_class_ivars_from_name, get_class_reference, get_static_reference, get_object_reference, build_message_expr, finish_message_expr, build_selector_expr, build_ivar_reference, build_keyword_decl, build_method_decl, build_protocol_expr, build_objc_string_object, objc_declare_alias, objc_declare_class, objc_declare_protocols, objc_comptypes, objc_check_decl, build_encode_expr): Remove prototypes. (imp_count, cat_count): Make GGC-aware. (OBJC_SET_TYPE_NAME): New macro. From-SVN: r87168
2004-09-08 02:49:44 +02:00
#ifdef OBJCPLUS
/* We need to instantiate templates _before_ we emit ObjC metadata;
if we do not, some metadata (such as selectors) may go missing. */
at_eof = 1;
Makefile.in (c-parse.o): Depend on $(C_COMMON_H). [gcc/ChangeLog] 2004-09-07 Ziemowit Laski <zlaski@apple.com> * Makefile.in (c-parse.o): Depend on $(C_COMMON_H). * c-parse.in: Include c-common.h instead of objc-act.h. (ivar_decl_list, ivar_decls, ivar_decl, ivars, ivar_declarator, myparms, myparm): Remove %type declarations. (methodtype, optparms, OBJC_TYPE_QUAL, objc_quals, objc_qual, objc_typename, objc_try_catch_stmt, optellipsis): Add %type declarations. (objc_inherit_code, objc_public_flag): Remove. (typespec_nonreserved_nonattr): Call objc_get_protocol_qualified_type() instead of get_static_reference() and get_protocol_reference(). (stmt_nocomp): Call grokparm() on @catch parameter. (objcdef): Move semantic action to objc_finish_implementation(). (classdef): Move semantic action to objc_start_class_interface(), objc_continue_interface(), objc_finish_interface(), objc_start_class_implementation(), objc_continue_implementation(), objc_start_category_interface() and objc_start_category_implementation(). (protocoldef): Move semantic actions to objc_start_protocol() and objc_finish_interface(). (ivar_decl_list): Remove nonterminal. (visibility_spec): Move semantic actions to objc_set_visibility(). (ivar_decls): Remove assignment to $$. (ivar_decl): Rephrase in terms of component_decl; call objc_add_instance_variable(). (ivars, ivar_declarator): Remove nonterminals. (opt_semi): New nonterminal. (methodtype): Remove semantic actions. (methoddef): Move semantic actions to objc_set_method_type(), objc_start_method_definition() and objc_finish_method_definition(). (methodproto): Move semantic actions to objc_set_method_type() and objc_add_method_declaration(). (methoddecl): Use objc_typename instead of typename; move semantic actions to objc_build_method_signature(). (optarglist, myxdecls, mydecl, myparms, myparm): Remove nonterminals. (optparmlist): Express in terms of optparms and optellipsis. (optparms, optellipsis, objc_qual, objc_quals, objc_typename): New nonterminals. (keyworddecl): Use objc_typename instead of typename. (rid_to_yy): Mark RID_IN, RID_OUT, RID_INOUT, RID_BYCOPY, RID_BYREF and RID_ONEWAY as returning OBJC_TYPE_QUAL to yyparse(). [gcc/objc/ChangeLog] 2004-09-07 Ziemowit Laski <zlaski@apple.com> * Make-lang.in (objc/objc-parse.o): Depend on $(C_COMMON_H) instead of objc/objc-act.h. (objc/objc-act.o): Depend on $(HASHTAB_H). * objc-act.c: Include hashtab.h; in ObjC++ mode, include cp-tree.h and objcp-decl.h instead of c-tree.h. (build_module_descriptor, get_class_ivars, synth_id_with_class_suffix, error_with_ivar, gen_method_decl, gen_declaration, setup_string_decl, build_protocol_template): Adjust prototypes. (build_module_initializer_routine, start_class, continue_class, finish_class, start_method_def, objc_start_function, start_protocol, build_method_decl, objc_add_method, add_instance_variable, build_ivar_reference, is_ivar, is_private, get_super_receiver, build_selector_table_decl, objc_push_parm, objc_get_parm_info, gen_type_name, gen_type_name_0, start_var_decl, finish_var_decl, create_field_decl): New prototypes. (objc_expand_function_end, comp_method_with_proto, objc_expr_last, gen_declaration_1, gen_declarator, is_complex_decl, adorn_decl, define_decl, create_builtin_decl, gen_declspecs): Remove prototypes. (TYPE_ID): Rename to OBJECT_TYPEDEF_NAME. (CLASS_TYPEDEF_NAME): New. (TAG_EXECCLASS): Change from a global variable to a #define. (TAG_RETURN_STRUCT): Delete. (TAG_GNUINIT): New, holds '__objc_gnu_init' name. (objc_inherit_code, objc_public_flag): New, moved from c-parse.in. (string_descriptor): New struct. (string_htab): New hash table. (string_hash, string_eq): New prototypes. (generate_struct_by_value_array): Call create_field_decl() instead of create_builtin_decl(). (objc_init): Do not initialize objc_ellipsis_node or TAG_EXECCLASS; In ObjC++ mode, call cxx_init() instead of c_objc_common_init(). (objc_finish_file): In ObjC++, call instantiate_pending_templates() and cp_finish_file(). (define_decl, get_static_reference, get_protocol_reference, create_builtin_decl): Remove functions. (objc_start_class_interface, objc_start_category_interface, objc_start_protocol, objc_continue_interface, objc_finish_interface, objc_start_class_implementation, objc_start_category_implementation, objc_continue_implementation, objc_finish_implementation, objc_set_visibility, objc_set_method_type, objc_build_method_signature, objc_add_method_declaration, objc_start_method_definition, objc_add_instance_variable, objc_get_protocol_qualified_type, create_field_decl, start_var_decl, finish_var_decl): New functions. (setup_string_decl): Simplify since it is only called once. (synth_module_prologue): Call build_class_template(); predefine 'id' and 'Class' as typedefs; rename 'temp_type' to 'type'; disable debug hooks for duration of function; fix GNU runtime messenger signatures to correspond to reality; forward-declare '__objc_exec_class' for the GNU runtime; call build_selector_table_decl(); in ObjC++ mode, generate 'extern "C" { ... }' wrappers around synthesized declarations; call build_protocol_template() and build_category_template(). (string_hash, string_eq): New functions. (objc_build_string_object): Check metaclass correctness only once; store string literals in hash table. (objc_build_constructor): Do not convert initializer elements; adjust for ObjC++ impedance mismatch. (build_objc_symtab_template): Call create_field_decl() instead of create_builtin_decl(). (init_objc_symtab): Add missing conversion to initializer element. (build_metadata_decl): Call start_var_decl() instead of define_decl(). (generate_objc_symtab_decl): Do not call build_category_template(); call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(). (build_module_descriptor): Call create_field_decl() instead of grokfield(); call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(); always mark module descriptor as used; move GNU runtime-specific functionality to build_module_initializer_routine(). (build_module_initializer_routine): New function, broken off of build_module_descriptor(). (objc_static_init_needed_p, objc_generate_static_init_call): New functions. (generate_static_references, generate_strings, build_selector_translation_table, generate_descriptor_table, generate_ivars_list, generate_dispatch_table, generate_category): Call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(); build a type directly instead of via groktypename(). (build_selector_reference_decl, build_selector_table_decl, build_class_reference_decl, build_protocol_reference, generate_objc_image_info): Call start_var_decl() instead of build_decl(). (build_selector_reference): For GNU runtime, do not call build_selector_reference_decl(). (build_selector, build_typed_selector_reference): Always convert result to the selector type. (add_objc_string): Cast return value to 'char *'. (build_method_prototype_template, build_selector_template, build_method_template): Use actual selector type for fields pointing to selectors. (finish_objc): For GNU runtime, call build_module_initializer_routine() after build_module_descriptor(). (generate_protocol_list, generate_shared_structures): Call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(); build a type directly instead of via groktypename(). (synth_id_with_class_suffix): Return a string. (get_arg_type_list): For instance methods, use the instance type for 'self'; do not call groktypename_in_parm_context(). (build_objc_string_decl): Squash redeclaration errors in ObjC++. (objc_is_class_name): Use OBJC_TYPE_NAME instead of TYPE_NAME; handle RECORD_TYPEs in ObjC as well as ObjC++. (objc_is_id): New function. (objc_is_object_ptr): Return the canonical type node. (objc_get_class_ivars): Simplify using get_class_ivars(). (get_class_ivars): Remove second parameter; create a fresh copy of the ivar list for each call; do not check for existence of super class. (objc_eh_runtime_type): Mark #ifndef OBJCPLUS. (objc_init_exceptions): When using SJLJ-style exceptions, require the use of '-fobjc-exceptions' flag; do not require it for DWARF-style exceptions. (objc_build_exc_ptr, next_sjlj_build_try_catch_finally): Use objc_object_type instead of objc_id_type. (objc_begin_catch_clause): Convert the incoming PARM_DECL into a VAR_DECL before placing it in the appropriate scope; do not call define_decl(); adjust call to c_begin_compound_stmt(); use objc_object_type instead of objc_id_type. (build_next_objc_exception_stuff): Call create_field_decl() instead of create_builtin_decl(); construct type directly instead of calling groktypename(); use OBJC_VOID_AT_END to mark end of function parameters. (build_private_template): Adjust call to get_class_ivars(); build a type directly instead of via groktypename(). (build_protocol_template, build_method_prototype_list_template, build_method_prototype_template, build_category_template, build_selector_template, build_class_template, build_super_template, build_ivar_template, build_ivar_list_template, build_method_list_template, build_method_template): Call create_field_decl() instead of grokfield(). (objc_method_parm_type): Do not call groktypename(). (generate_descriptor_table): Call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(). (generate_method_descriptors, build_protocol_initializer, generate_dispatch_tables, build_category_initializer, build_shared_structure_initializer): Do not call groktypename(). (generate_protocols): Call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(); do not call groktypename(). (error_with_ivar): Remove last parameter. (check_ivars): Do not iterate ovar CLASS_RAW_IVARS lists in addition to CLASS_IVARS lists; adjust calls to error_with_ivar(). (generate_ivar_lists): Convert one of the initializer elements; do not call groktypename(). (get_arg_type_list, start_method_def, gen_method_def): Account for new representation of variable arguments and '...' in Objective-C methods; add Objective-C++ impedance matching code. (is_objc_type_qualifier): Remove function. (adjust_type_for_id_default): Simplify; there is no longer a need to wade through declspecs. (lookup_interface, start_class, continue_class, finish_class, start_method_def, start_protocol, build_method_decl, objc_add_method, add_instance_variable, build_ivar_reference, is_ivar, is_private, get_super_receiver, objc_build_finally_epilogue): Make into static functions. (receiver_is_class_object): Use new IS_CLASS() macro. (objc_build_message_expr): Tweak ObjC++ message argument handling; call objc_finish_message_expr() instead of finish_message_expr(). (finish_message_expr): Rename to objc_finish_message_expr(); use OBJC_TYPE_NAME and OBJC_SET_TYPE_NAME macros instead of TYPE_NAME. call gen_type_name() instead of gen_declaration(); call objc_is_id() instead of using IS_ID and IS_CLASS; Use objc_class_name instead of calling get_identifier("Class"); handle CONVERT_EXPRs in receiver. (build_objc_method_call, warn_with_method): Do not call groktypename(). (build_ivar_reference): Call convert() instead of clobbering in a type. (hash_init): Initialize string_htab hash table. (add_instance_variable): Simplify parameter list; do not call grokfield(); do not populate CLASS_IVARS list. (start_class): Check for the existence of super class, if one was specified. (continue_class): Use CLASS_RAW_IVARS rather than CLASS_IVARS; do not call build_class_template(); adjust call to get_class_ivars(); call build_decl(), pushdecl() and finish_decl() instead of define_decl(). (finish_class): Call build_decl(), pushdecl() and finish_decl() instead of define_decl(). (add_protocols): Use PROTOCOL_BINFO_ELTS for the tree vector size. (start_protocol): Do not call build_protocol_template(); use PROTOCOL_BINFO_ELTS for the tree vector size. (encode_type_qualifiers): Do not handle the 'const' qualifier here. (encode_pointer): Encode 'const char *' as 'r*', for backwards compatibility. (encode_array): Use HOST_WIDE_INT_PRINT_DEC instead of "%ld". (encode_type): Handle the 'const' qualifier here. (objc_parmlist): New global variable, sued by objc_push_parm and objc_get_parm_info(). (objc_push_parm, objc_get_parm_info): New functions. (objc_expr_last): Remove function. (synth_self_and_ucmd_args): For instance methods, use the instance type for 'self'; call objc_push_parm() instead of push_parm_decl(). (start_method_def): Do not call push_scope(), declare_parm_level(), pop_scope(), push_parm_decl(), store_parm_decls() or objc_expr_last(); just use objc_push_parm() and objc_get_parm_info(). (comp_method_with_proto): Remove function. (objc_types_are_equivalent): Strip away indirections before comparing underlying types. (comp_proto_with_proto): Do not call groktypename(); types are no longer in raw declspec format. (objc_start_function): New function. (really_start_method): Call comp_proto_with_proto() instead of comp_method_with_proto(); call objc_start_function() instead of hand-crafting a function declarator. (continue_method_def, objc_expand_function_end): Remove functions. (get_super_receiver): Call objc_get_current_scope() instead of get_current_scope(); reference 'super_class' field (instead of 'class'). (finish_method_def): Rename to objc_finish_method_definition() and add a function decl parameter; move method encoding call from objc_expand_function_end(). (is_complex_decl, adorn_decl, gen_declarator, gen_declspecs, gen_declaration_1): Remove functions. (tmpbuf, RAW_DECLSPEC): Remove. (gen_declaration): Remove second parameter; simplify to deal with TYPE_P nodes instead of raw declspecs. (gen_type_name, gen_type_name_0): New functions. (gen_method_decl): Remove second parameter; call gen_type_name() instead of gen_declaration_1(). (dump_interface): Adjust calls to gen_declaration() and gen_method_decl(); do not allocate a separate string buffer. (init_objc): Allocate a larger string buffer to accommodate dump_interface(); adjust call to build_module_descriptor(); add call to build_module_initializer_routine() for the GNU runtime. (generate_classref_translation_entry): Do not call start_decl(); call finish_var_decl() instead of finish_decl(); call convert() instead of build_c_cast(). * objc-act.h (CLASS_OWN_IVARS): Remove accessor. (CLASS_BINFO_ELTS): Reduce from 6 to 5, now that CLASS_OWN_IVARS is gone. (OCTI_GNU_INIT_DECL, GNU_INIT_decl): New. (OCTI_ELLIPSIS_NODE, objc_ellipsis_node): Remove. (OCTI_ID_ID, id_type, objc_id_id): Rename to OCTI_ID_NAME, objc_object_type and objc_object_name, respectively. (OCTI_CLS_REF, OCTI_CLASS_NAME, objc_class_reference, objc_class_name): New. (IS_CLASS): New macro. (IS_ID, IS_SUPER): Robustify. (OCTI_EXECCLASS_DECL, execclass_decl): New. (finish_file, start_class, continue_class, finish_class, start_method_def, continue_method_def, finish_method_def, start_protocol, finish_protocol, objc_build_throw_stmt, objc_build_try_catch_finally_stmt, objc_build_synchronized_prologue, objc_build_synchronized_epilogue, objc_build_try_prologue, objc_build_try_epilogue, objc_build_catch_stmt, objc_build_catch_epilogue, objc_build_finally_prologue, objc_build_finally_epilogue, is_ivar, is_private, is_public, add_instance_variable, objc_add_method, get_super_receiver, objc_clear_super_receiver, get_class_ivars_from_name, get_class_reference, get_static_reference, get_object_reference, build_message_expr, finish_message_expr, build_selector_expr, build_ivar_reference, build_keyword_decl, build_method_decl, build_protocol_expr, build_objc_string_object, objc_declare_alias, objc_declare_class, objc_declare_protocols, objc_comptypes, objc_check_decl, build_encode_expr): Remove prototypes. (imp_count, cat_count): Make GGC-aware. (OBJC_SET_TYPE_NAME): New macro. From-SVN: r87168
2004-09-08 02:49:44 +02:00
instantiate_pending_templates (0);
#endif
/* Finalize Objective-C runtime data. No need to generate tables
Yet more Objective-C++... * objc-act.c (objc_finish_try_stmt): Add return value. (objc_build_synchronized): Likewise. * objc-act.c (objc_is_gcable_type): Add. (objc_substitute_decl): Add. (objc_build_ivar_assignment): Add. (objc_build_global_assignment): Add. (objc_build_strong_cast_assignment): Add. (objc_is_ivar_reference_p): Add. (objc_is_global_reference_p): Add. (objc_generate_write_barrier): Add. (objc_rewrite_function_call): Add. (objc_gimplify_expr): Add Objective-C++ support. * objc-act.h (ALLOC_OBJC_TYPE_LANG_SPECIFIC): Likewise. (SIZEOF_OBJC_TYPE_LANG_SPECIFIC): Add. (INIT_TYPE_OBJC_INFO): Add Objective-C++ support. (DUP_TYPE_OBJC_INFO): Likewise. (struct imp_entry): Add field has_cxx_cdtors. (struct imp_entry *imp_list): Add OCTI_UMSG_FAST_DECL, OCTI_METH_LIST_TEMPL, OCTI_METH_PROTO_LIST_TEMPL, OCTI_IVAR_LIST_TEMPL, OCTI_ASSIGN_IVAR_DECL, OCTI_ASSIGN_IVAR_FAST_DECL, OCTI_ASSIGN_GLOBAL_DECL, OCTI_ASSIGN_STRONGCAST_DECL. (umsg_fast_decl): Add. (objc_assign_ivar_decl): Add. (objc_assign_ivar_fast_decl): Add. (objc_assign_global_decl): Add. (objc_assign_strong_cast_decl): Add. (objc_method_list_ptr): Add. (objc_method_proto_list_ptr): Add. (objc_ivar_list_ptr): Add. * objc-act.c (should_call_super_dealloc): Add. (OBJC_VERSION): Bump to 6. (objc_is_gcable_type): Add. (objc_substitute_decl): Add. (objc_build_ivar_assignment): Add. (objc_build_global_assignment): Add. (objc_build_strong_cast_assignment): Add. (objc_is_gcable_p): Add. (objc_is_ivar_reference_p): Add. (objc_is_global_reference_p): Add. (generate_shared_structures): Add flags parameter. (objc_generate_cxx_ctor_or_dtor): Add. (objc_generate_cxx_cdtors): Add. (add_class): Add name parameter. (objc_types_share_size_and_alignment): Add. (comp_proto_with_proto): Add strict parameter. (CLS_HAS_CXX_STRUCTORS): Add. (TAG_ASSIGNIVAR): Add. (TAG_ASSIGNGLOBAL): Add. (TAG_ASSIGNSTRONGCAST): Add. (TAG_MSGSEND_FAST): Add. (TAG_ASSIGNIVAR_FAST): Add. (TAG_CXX_CONSTRUCT): Add. (TAG_CXX_DESTRUCT): Add. (OBJC_LOOKUP_CLASS): Add. (OBJC_LOOKUP_NO_SUPER): Add. (objc_finish_file): Add pch support. (objc_finish_implementation): Add Objective-C++ support. (synth_module_prologue): Likewise. (synth_module_prologue): Add fast dispatching. (objc_get_class_reference): Add Objective-C++ support. (objc_generate_write_barrier): Likewise. (next_sjlj_build_enter_and_setjmp): Likewise. (objc_begin_try_stmt): Likewise. (build_next_objc_exception_stuff): Add fast ivar support. (build_private_template): Mark the record as used so debug information is generated. (build_protocol_template): Add Objective-C++ support. (objc_method_parm_type) Likewise. (objc_generate_cxx_ctor_or_dtor): Likewise. (objc_generate_cxx_cdtors): Likewise. (build_protocol_initializer): Likewise. (build_category_template): Likewise. (build_class_template): Likewise. (build_method_list_template): Likewise. (build_category_initializer): Likewise. (build_shared_structure_initializer): Likewise. (objc_finish_message_expr): Likewise. (build_objc_method_call): Add fast dispatch support. (lookup_method_static): Add support to end search at superclasses. (add_method_to_hash_list): Add strict parameter to comp_proto_with_proto. (objc_add_method): Likewise. (objc_add_method): Also set the interface_value. (add_instance_variable): Add Objective-C++ support. (objc_is_public): Likewise. (start_class): Likewise. (continue_class): Likewise. (encode_aggregate_within): Likewise. (start_method_def): Likewise. (objc_start_function): Clear current_function_returns_value and current_function_returns_null. (really_start_method): Add Objective-C++ support. (objc_finish_method_definition): Add warning for missing [super dealloc]. (finish_objc): Add Objective-C++ support. (generate_objc_image_info): Likewise. (objc_lookup_ivar): Likewise. * objc-act.h (TYPE_HAS_OBJC_INFO): Likewise. (INIT_TYPE_OBJC_INFO): Likewise. (DUP_TYPE_OBJC_INFO): Likewise. From-SVN: r99857
2005-05-17 22:07:08 +02:00
and code if only checking syntax, or if generating a PCH file. */
if (!flag_syntax_only && !pch_file)
finish_objc ();
1992-01-18 00:15:38 +01:00
if (gen_declaration_file)
fclose (gen_declaration_file);
}
objc-act.h (get_object_reference): Rename to get_protocol_reference. 2004-06-20 David Ayers <d.ayers@inode.at> * objc/objc-act.h (get_object_reference): Rename to get_protocol_reference. (super_type): Rename to objc_super_type. (selector_type): Rename to objc_selector_type. (id_type): Rename to objc_id_type. (instance_type): Rename to objc_instance_type. (protocol_type): Rename to objc_protocol_type. (IS_ID): Update reference to id_type. * objc/objc-act.c (get_object_reference): Rename to get_protocol_reference; add documentation; update references to id_type. (lookup_method_in_protocol_list): Rename class_meth to is_class; add documentation. (finish_message_expr): Rename is_class to class_tree. (synth_module_prologue, objc_is_object_ptr, objc_build_exc_ptr, next_sjlj_build_try_catch_finally, objc_begin_catch_clause, build_next_objc_exception_stuff, get_arg_type_list, build_objc_method_call): Update references to id_type. (synth_module_prologue, build_objc_symtab_template, build_selector_reference_decl, build_selector, build_selector_translation_table, build_typed_selector_reference, get_arg_type_list, synth_self_and_ucmd_args, get_arg_type_list, synth_self_and_ucmd_args): Update references to selector_type. (build_private_template, build_ivar_reference): Update references to instance_type. (synth_module_prologue, build_protocol_reference, build_protocol_expr, start_protocol): Update references to protocol_type. (synth_module_prologue, get_arg_type_list, build_objc_method_call): Update references to super_type. * c-parse.in: (typespec_nonreserved_nonattr): Update references to get_object_reference. * objc/objc-tree.def: Add C mode identifier sequence. From-SVN: r83425
2004-06-21 03:50:18 +02:00
/* Return the first occurrence of a method declaration corresponding
to sel_name in rproto_list. Search rproto_list recursively.
If is_class is 0, search for instance methods, otherwise for class
methods. */
static tree
lookup_method_in_protocol_list (tree rproto_list, tree sel_name,
objc-act.h (get_object_reference): Rename to get_protocol_reference. 2004-06-20 David Ayers <d.ayers@inode.at> * objc/objc-act.h (get_object_reference): Rename to get_protocol_reference. (super_type): Rename to objc_super_type. (selector_type): Rename to objc_selector_type. (id_type): Rename to objc_id_type. (instance_type): Rename to objc_instance_type. (protocol_type): Rename to objc_protocol_type. (IS_ID): Update reference to id_type. * objc/objc-act.c (get_object_reference): Rename to get_protocol_reference; add documentation; update references to id_type. (lookup_method_in_protocol_list): Rename class_meth to is_class; add documentation. (finish_message_expr): Rename is_class to class_tree. (synth_module_prologue, objc_is_object_ptr, objc_build_exc_ptr, next_sjlj_build_try_catch_finally, objc_begin_catch_clause, build_next_objc_exception_stuff, get_arg_type_list, build_objc_method_call): Update references to id_type. (synth_module_prologue, build_objc_symtab_template, build_selector_reference_decl, build_selector, build_selector_translation_table, build_typed_selector_reference, get_arg_type_list, synth_self_and_ucmd_args, get_arg_type_list, synth_self_and_ucmd_args): Update references to selector_type. (build_private_template, build_ivar_reference): Update references to instance_type. (synth_module_prologue, build_protocol_reference, build_protocol_expr, start_protocol): Update references to protocol_type. (synth_module_prologue, get_arg_type_list, build_objc_method_call): Update references to super_type. * c-parse.in: (typespec_nonreserved_nonattr): Update references to get_object_reference. * objc/objc-tree.def: Add C mode identifier sequence. From-SVN: r83425
2004-06-21 03:50:18 +02:00
int is_class)
{
tree rproto, p;
tree fnd = 0;
for (rproto = rproto_list; rproto; rproto = TREE_CHAIN (rproto))
{
p = TREE_VALUE (rproto);
if (TREE_CODE (p) == PROTOCOL_INTERFACE_TYPE)
{
objc-act.h (get_object_reference): Rename to get_protocol_reference. 2004-06-20 David Ayers <d.ayers@inode.at> * objc/objc-act.h (get_object_reference): Rename to get_protocol_reference. (super_type): Rename to objc_super_type. (selector_type): Rename to objc_selector_type. (id_type): Rename to objc_id_type. (instance_type): Rename to objc_instance_type. (protocol_type): Rename to objc_protocol_type. (IS_ID): Update reference to id_type. * objc/objc-act.c (get_object_reference): Rename to get_protocol_reference; add documentation; update references to id_type. (lookup_method_in_protocol_list): Rename class_meth to is_class; add documentation. (finish_message_expr): Rename is_class to class_tree. (synth_module_prologue, objc_is_object_ptr, objc_build_exc_ptr, next_sjlj_build_try_catch_finally, objc_begin_catch_clause, build_next_objc_exception_stuff, get_arg_type_list, build_objc_method_call): Update references to id_type. (synth_module_prologue, build_objc_symtab_template, build_selector_reference_decl, build_selector, build_selector_translation_table, build_typed_selector_reference, get_arg_type_list, synth_self_and_ucmd_args, get_arg_type_list, synth_self_and_ucmd_args): Update references to selector_type. (build_private_template, build_ivar_reference): Update references to instance_type. (synth_module_prologue, build_protocol_reference, build_protocol_expr, start_protocol): Update references to protocol_type. (synth_module_prologue, get_arg_type_list, build_objc_method_call): Update references to super_type. * c-parse.in: (typespec_nonreserved_nonattr): Update references to get_object_reference. * objc/objc-tree.def: Add C mode identifier sequence. From-SVN: r83425
2004-06-21 03:50:18 +02:00
if ((fnd = lookup_method (is_class
? PROTOCOL_CLS_METHODS (p)
: PROTOCOL_NST_METHODS (p), sel_name)))
;
else if (PROTOCOL_LIST (p))
fnd = lookup_method_in_protocol_list (PROTOCOL_LIST (p),
objc-act.h (get_object_reference): Rename to get_protocol_reference. 2004-06-20 David Ayers <d.ayers@inode.at> * objc/objc-act.h (get_object_reference): Rename to get_protocol_reference. (super_type): Rename to objc_super_type. (selector_type): Rename to objc_selector_type. (id_type): Rename to objc_id_type. (instance_type): Rename to objc_instance_type. (protocol_type): Rename to objc_protocol_type. (IS_ID): Update reference to id_type. * objc/objc-act.c (get_object_reference): Rename to get_protocol_reference; add documentation; update references to id_type. (lookup_method_in_protocol_list): Rename class_meth to is_class; add documentation. (finish_message_expr): Rename is_class to class_tree. (synth_module_prologue, objc_is_object_ptr, objc_build_exc_ptr, next_sjlj_build_try_catch_finally, objc_begin_catch_clause, build_next_objc_exception_stuff, get_arg_type_list, build_objc_method_call): Update references to id_type. (synth_module_prologue, build_objc_symtab_template, build_selector_reference_decl, build_selector, build_selector_translation_table, build_typed_selector_reference, get_arg_type_list, synth_self_and_ucmd_args, get_arg_type_list, synth_self_and_ucmd_args): Update references to selector_type. (build_private_template, build_ivar_reference): Update references to instance_type. (synth_module_prologue, build_protocol_reference, build_protocol_expr, start_protocol): Update references to protocol_type. (synth_module_prologue, get_arg_type_list, build_objc_method_call): Update references to super_type. * c-parse.in: (typespec_nonreserved_nonattr): Update references to get_object_reference. * objc/objc-tree.def: Add C mode identifier sequence. From-SVN: r83425
2004-06-21 03:50:18 +02:00
sel_name, is_class);
}
else
Fix warious warnings: * c-aux-info.c: Include string.h/strings.h. * pa.c: Include stdlib.h. (pa_combine_instructions): Prototype the function. (pa_can_combine_p, forward_branch_p, shadd_constant_p): Likewise. (reloc_needed): Add default case for enumeration switch. (remove_useless_addtr_insns): Remove unused variable `all'. (hppa_expand_prologue): Add explicit braces to avoid ambiguous `else'. (output_function_epilogue): Remove unused variable `i'. (output_millicode_call): Remove unused variable `link'. (shadd_constant_p, forward_branch_p): Make the function static. (following_call): Explicitly declare to return int. (pa_reorg): Declare as void. (pa_combine_instructions): Declare as static void. Add parentheses around && within ||. * pa.h: Add prototypes for pa_reorg, symbolic_operand, following_call, function_label_operand, lhs_lshift_cint_operand and zdepi_cint_p. * pa.md: Add parentheses around && within ||. * cppalloc.c: Include stdlib.h. * cpperror.c (cpp_print_containing_files): Remove unused variable `i'. Fix format specifier in fprintf. * cse.c (cse_around_loop): Add explicit braces to avoid ambiguous `else'. (delete_dead_from_cse): Wrap variable `tem' in macro HAVE_cc0. * expr.c (expand_expr): Add parentheses around && within ||. * final.c (app_enable): Replace fprintf with fputs where there are no format specifiers and no trailing argument after the string. Eg, when printing ASM_APP_ON/ASM_APP_OFF. (app_disable): Likewise. (final_end_function): Likewise. (final_scan_insn): Likewise. Remove unused variable `set'. (profile_function): Wrap empty if-statement body in {} brackets. * function.c: Include stdlib.h. (pad_below): Wrap prototype and definition in ARGS_GROW_DOWNWARD. (reposition_prologue_and_epilogue_notes): Add parentheses around assignment used as truth value. * integrate.c (expand_inline_function): Wrap variable `cc0_insn' in macro HAVE_cc0. * jump.c (jump_optimize): Wrap variable `q' in macro HAVE_cc0. Remove unused variable `prev1'. * libgcc2.c (__bb_exit_trace_func): Add parentheses around && within ||. Fix format specifier in fprintf. (__bb_init_prg): Add parentheses around assignment used as truth value. * local-alloc.c: Include stdlib.h. (requires_inout): Add parentheses around assignment used as truth value. * loop.c (analyze_loop_iterations): Wrap prototype and definition in macro HAVE_decrement_and_branch_on_count. (insert_bct, instrument_loop_bct): Likewise. (move_movables): Add parentheses around assignment used as truth value. (consec_sets_invariant_p): Likewise. (maybe_eliminate_biv_1): Wrap variable `new' in macro HAVE_cc0. * objc/objc-act.c: Include stdlib.h. (lookup_method_in_protocol_list): Wrap empty else-statement body in braces. (lookup_protocol_in_reflist): Likewise. (objc_add_static_instance): Remove unused variables `decl_expr' and `decl_spec'. (get_objc_string_decl): Remove unused variable `decl'. (generate_static_references): Remove unused variables `idecl' and `instance'. (check_protocols): Wrap empty else-statement body in braces. * protoize.c: Include stdlib.h. (substr): Add parentheses around assignment used as truth value. (abspath): Likewise. (shortpath): Likewise. * regmove.c (fixup_match_1): Add parentheses around assignment used as truth value. * reload.c (push_secondary_reload): Remove unused variable `i'. (find_reloads): Add parentheses around assignment used as truth value. * reload1.c: Include stdlib.h. * rtl.h: Correct typo in prototype of offsettable_memref_p. * stmt.c (add_case_node): Add parentheses around assignment used as truth value. (case_tree2list): Likewise. * tree.c (valid_machine_attribute): Wrap variable `decl_attr_list' in macro VALID_MACHINE_DECL_ATTRIBUTE. Wrap variable `type_attr_list' in macro VALID_MACHINE_TYPE_ATTRIBUTE. (merge_attributes): Add explicit braces to avoid ambiguous `else'. * unroll.c (copy_loop_body): Wrap variable `cc0_insn' in macro HAVE_cc0. * varasm.c: Include stdlib.h. From-SVN: r18290
1998-02-28 08:06:53 +01:00
{
; /* An identifier...if we could not find a protocol. */
}
if (fnd)
return fnd;
}
return 0;
}
static tree
lookup_protocol_in_reflist (tree rproto_list, tree lproto)
{
tree rproto, p;
/* Make sure the protocol is supported by the object on the rhs. */
if (TREE_CODE (lproto) == PROTOCOL_INTERFACE_TYPE)
{
tree fnd = 0;
for (rproto = rproto_list; rproto; rproto = TREE_CHAIN (rproto))
{
p = TREE_VALUE (rproto);
if (TREE_CODE (p) == PROTOCOL_INTERFACE_TYPE)
{
if (lproto == p)
fnd = lproto;
else if (PROTOCOL_LIST (p))
fnd = lookup_protocol_in_reflist (PROTOCOL_LIST (p), lproto);
}
if (fnd)
return fnd;
}
}
else
{
; /* An identifier...if we could not find a protocol. */
}
return 0;
1992-01-18 00:15:38 +01:00
}
Makefile.in (c-parse.o): Depend on $(C_COMMON_H). [gcc/ChangeLog] 2004-09-07 Ziemowit Laski <zlaski@apple.com> * Makefile.in (c-parse.o): Depend on $(C_COMMON_H). * c-parse.in: Include c-common.h instead of objc-act.h. (ivar_decl_list, ivar_decls, ivar_decl, ivars, ivar_declarator, myparms, myparm): Remove %type declarations. (methodtype, optparms, OBJC_TYPE_QUAL, objc_quals, objc_qual, objc_typename, objc_try_catch_stmt, optellipsis): Add %type declarations. (objc_inherit_code, objc_public_flag): Remove. (typespec_nonreserved_nonattr): Call objc_get_protocol_qualified_type() instead of get_static_reference() and get_protocol_reference(). (stmt_nocomp): Call grokparm() on @catch parameter. (objcdef): Move semantic action to objc_finish_implementation(). (classdef): Move semantic action to objc_start_class_interface(), objc_continue_interface(), objc_finish_interface(), objc_start_class_implementation(), objc_continue_implementation(), objc_start_category_interface() and objc_start_category_implementation(). (protocoldef): Move semantic actions to objc_start_protocol() and objc_finish_interface(). (ivar_decl_list): Remove nonterminal. (visibility_spec): Move semantic actions to objc_set_visibility(). (ivar_decls): Remove assignment to $$. (ivar_decl): Rephrase in terms of component_decl; call objc_add_instance_variable(). (ivars, ivar_declarator): Remove nonterminals. (opt_semi): New nonterminal. (methodtype): Remove semantic actions. (methoddef): Move semantic actions to objc_set_method_type(), objc_start_method_definition() and objc_finish_method_definition(). (methodproto): Move semantic actions to objc_set_method_type() and objc_add_method_declaration(). (methoddecl): Use objc_typename instead of typename; move semantic actions to objc_build_method_signature(). (optarglist, myxdecls, mydecl, myparms, myparm): Remove nonterminals. (optparmlist): Express in terms of optparms and optellipsis. (optparms, optellipsis, objc_qual, objc_quals, objc_typename): New nonterminals. (keyworddecl): Use objc_typename instead of typename. (rid_to_yy): Mark RID_IN, RID_OUT, RID_INOUT, RID_BYCOPY, RID_BYREF and RID_ONEWAY as returning OBJC_TYPE_QUAL to yyparse(). [gcc/objc/ChangeLog] 2004-09-07 Ziemowit Laski <zlaski@apple.com> * Make-lang.in (objc/objc-parse.o): Depend on $(C_COMMON_H) instead of objc/objc-act.h. (objc/objc-act.o): Depend on $(HASHTAB_H). * objc-act.c: Include hashtab.h; in ObjC++ mode, include cp-tree.h and objcp-decl.h instead of c-tree.h. (build_module_descriptor, get_class_ivars, synth_id_with_class_suffix, error_with_ivar, gen_method_decl, gen_declaration, setup_string_decl, build_protocol_template): Adjust prototypes. (build_module_initializer_routine, start_class, continue_class, finish_class, start_method_def, objc_start_function, start_protocol, build_method_decl, objc_add_method, add_instance_variable, build_ivar_reference, is_ivar, is_private, get_super_receiver, build_selector_table_decl, objc_push_parm, objc_get_parm_info, gen_type_name, gen_type_name_0, start_var_decl, finish_var_decl, create_field_decl): New prototypes. (objc_expand_function_end, comp_method_with_proto, objc_expr_last, gen_declaration_1, gen_declarator, is_complex_decl, adorn_decl, define_decl, create_builtin_decl, gen_declspecs): Remove prototypes. (TYPE_ID): Rename to OBJECT_TYPEDEF_NAME. (CLASS_TYPEDEF_NAME): New. (TAG_EXECCLASS): Change from a global variable to a #define. (TAG_RETURN_STRUCT): Delete. (TAG_GNUINIT): New, holds '__objc_gnu_init' name. (objc_inherit_code, objc_public_flag): New, moved from c-parse.in. (string_descriptor): New struct. (string_htab): New hash table. (string_hash, string_eq): New prototypes. (generate_struct_by_value_array): Call create_field_decl() instead of create_builtin_decl(). (objc_init): Do not initialize objc_ellipsis_node or TAG_EXECCLASS; In ObjC++ mode, call cxx_init() instead of c_objc_common_init(). (objc_finish_file): In ObjC++, call instantiate_pending_templates() and cp_finish_file(). (define_decl, get_static_reference, get_protocol_reference, create_builtin_decl): Remove functions. (objc_start_class_interface, objc_start_category_interface, objc_start_protocol, objc_continue_interface, objc_finish_interface, objc_start_class_implementation, objc_start_category_implementation, objc_continue_implementation, objc_finish_implementation, objc_set_visibility, objc_set_method_type, objc_build_method_signature, objc_add_method_declaration, objc_start_method_definition, objc_add_instance_variable, objc_get_protocol_qualified_type, create_field_decl, start_var_decl, finish_var_decl): New functions. (setup_string_decl): Simplify since it is only called once. (synth_module_prologue): Call build_class_template(); predefine 'id' and 'Class' as typedefs; rename 'temp_type' to 'type'; disable debug hooks for duration of function; fix GNU runtime messenger signatures to correspond to reality; forward-declare '__objc_exec_class' for the GNU runtime; call build_selector_table_decl(); in ObjC++ mode, generate 'extern "C" { ... }' wrappers around synthesized declarations; call build_protocol_template() and build_category_template(). (string_hash, string_eq): New functions. (objc_build_string_object): Check metaclass correctness only once; store string literals in hash table. (objc_build_constructor): Do not convert initializer elements; adjust for ObjC++ impedance mismatch. (build_objc_symtab_template): Call create_field_decl() instead of create_builtin_decl(). (init_objc_symtab): Add missing conversion to initializer element. (build_metadata_decl): Call start_var_decl() instead of define_decl(). (generate_objc_symtab_decl): Do not call build_category_template(); call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(). (build_module_descriptor): Call create_field_decl() instead of grokfield(); call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(); always mark module descriptor as used; move GNU runtime-specific functionality to build_module_initializer_routine(). (build_module_initializer_routine): New function, broken off of build_module_descriptor(). (objc_static_init_needed_p, objc_generate_static_init_call): New functions. (generate_static_references, generate_strings, build_selector_translation_table, generate_descriptor_table, generate_ivars_list, generate_dispatch_table, generate_category): Call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(); build a type directly instead of via groktypename(). (build_selector_reference_decl, build_selector_table_decl, build_class_reference_decl, build_protocol_reference, generate_objc_image_info): Call start_var_decl() instead of build_decl(). (build_selector_reference): For GNU runtime, do not call build_selector_reference_decl(). (build_selector, build_typed_selector_reference): Always convert result to the selector type. (add_objc_string): Cast return value to 'char *'. (build_method_prototype_template, build_selector_template, build_method_template): Use actual selector type for fields pointing to selectors. (finish_objc): For GNU runtime, call build_module_initializer_routine() after build_module_descriptor(). (generate_protocol_list, generate_shared_structures): Call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(); build a type directly instead of via groktypename(). (synth_id_with_class_suffix): Return a string. (get_arg_type_list): For instance methods, use the instance type for 'self'; do not call groktypename_in_parm_context(). (build_objc_string_decl): Squash redeclaration errors in ObjC++. (objc_is_class_name): Use OBJC_TYPE_NAME instead of TYPE_NAME; handle RECORD_TYPEs in ObjC as well as ObjC++. (objc_is_id): New function. (objc_is_object_ptr): Return the canonical type node. (objc_get_class_ivars): Simplify using get_class_ivars(). (get_class_ivars): Remove second parameter; create a fresh copy of the ivar list for each call; do not check for existence of super class. (objc_eh_runtime_type): Mark #ifndef OBJCPLUS. (objc_init_exceptions): When using SJLJ-style exceptions, require the use of '-fobjc-exceptions' flag; do not require it for DWARF-style exceptions. (objc_build_exc_ptr, next_sjlj_build_try_catch_finally): Use objc_object_type instead of objc_id_type. (objc_begin_catch_clause): Convert the incoming PARM_DECL into a VAR_DECL before placing it in the appropriate scope; do not call define_decl(); adjust call to c_begin_compound_stmt(); use objc_object_type instead of objc_id_type. (build_next_objc_exception_stuff): Call create_field_decl() instead of create_builtin_decl(); construct type directly instead of calling groktypename(); use OBJC_VOID_AT_END to mark end of function parameters. (build_private_template): Adjust call to get_class_ivars(); build a type directly instead of via groktypename(). (build_protocol_template, build_method_prototype_list_template, build_method_prototype_template, build_category_template, build_selector_template, build_class_template, build_super_template, build_ivar_template, build_ivar_list_template, build_method_list_template, build_method_template): Call create_field_decl() instead of grokfield(). (objc_method_parm_type): Do not call groktypename(). (generate_descriptor_table): Call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(). (generate_method_descriptors, build_protocol_initializer, generate_dispatch_tables, build_category_initializer, build_shared_structure_initializer): Do not call groktypename(). (generate_protocols): Call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(); do not call groktypename(). (error_with_ivar): Remove last parameter. (check_ivars): Do not iterate ovar CLASS_RAW_IVARS lists in addition to CLASS_IVARS lists; adjust calls to error_with_ivar(). (generate_ivar_lists): Convert one of the initializer elements; do not call groktypename(). (get_arg_type_list, start_method_def, gen_method_def): Account for new representation of variable arguments and '...' in Objective-C methods; add Objective-C++ impedance matching code. (is_objc_type_qualifier): Remove function. (adjust_type_for_id_default): Simplify; there is no longer a need to wade through declspecs. (lookup_interface, start_class, continue_class, finish_class, start_method_def, start_protocol, build_method_decl, objc_add_method, add_instance_variable, build_ivar_reference, is_ivar, is_private, get_super_receiver, objc_build_finally_epilogue): Make into static functions. (receiver_is_class_object): Use new IS_CLASS() macro. (objc_build_message_expr): Tweak ObjC++ message argument handling; call objc_finish_message_expr() instead of finish_message_expr(). (finish_message_expr): Rename to objc_finish_message_expr(); use OBJC_TYPE_NAME and OBJC_SET_TYPE_NAME macros instead of TYPE_NAME. call gen_type_name() instead of gen_declaration(); call objc_is_id() instead of using IS_ID and IS_CLASS; Use objc_class_name instead of calling get_identifier("Class"); handle CONVERT_EXPRs in receiver. (build_objc_method_call, warn_with_method): Do not call groktypename(). (build_ivar_reference): Call convert() instead of clobbering in a type. (hash_init): Initialize string_htab hash table. (add_instance_variable): Simplify parameter list; do not call grokfield(); do not populate CLASS_IVARS list. (start_class): Check for the existence of super class, if one was specified. (continue_class): Use CLASS_RAW_IVARS rather than CLASS_IVARS; do not call build_class_template(); adjust call to get_class_ivars(); call build_decl(), pushdecl() and finish_decl() instead of define_decl(). (finish_class): Call build_decl(), pushdecl() and finish_decl() instead of define_decl(). (add_protocols): Use PROTOCOL_BINFO_ELTS for the tree vector size. (start_protocol): Do not call build_protocol_template(); use PROTOCOL_BINFO_ELTS for the tree vector size. (encode_type_qualifiers): Do not handle the 'const' qualifier here. (encode_pointer): Encode 'const char *' as 'r*', for backwards compatibility. (encode_array): Use HOST_WIDE_INT_PRINT_DEC instead of "%ld". (encode_type): Handle the 'const' qualifier here. (objc_parmlist): New global variable, sued by objc_push_parm and objc_get_parm_info(). (objc_push_parm, objc_get_parm_info): New functions. (objc_expr_last): Remove function. (synth_self_and_ucmd_args): For instance methods, use the instance type for 'self'; call objc_push_parm() instead of push_parm_decl(). (start_method_def): Do not call push_scope(), declare_parm_level(), pop_scope(), push_parm_decl(), store_parm_decls() or objc_expr_last(); just use objc_push_parm() and objc_get_parm_info(). (comp_method_with_proto): Remove function. (objc_types_are_equivalent): Strip away indirections before comparing underlying types. (comp_proto_with_proto): Do not call groktypename(); types are no longer in raw declspec format. (objc_start_function): New function. (really_start_method): Call comp_proto_with_proto() instead of comp_method_with_proto(); call objc_start_function() instead of hand-crafting a function declarator. (continue_method_def, objc_expand_function_end): Remove functions. (get_super_receiver): Call objc_get_current_scope() instead of get_current_scope(); reference 'super_class' field (instead of 'class'). (finish_method_def): Rename to objc_finish_method_definition() and add a function decl parameter; move method encoding call from objc_expand_function_end(). (is_complex_decl, adorn_decl, gen_declarator, gen_declspecs, gen_declaration_1): Remove functions. (tmpbuf, RAW_DECLSPEC): Remove. (gen_declaration): Remove second parameter; simplify to deal with TYPE_P nodes instead of raw declspecs. (gen_type_name, gen_type_name_0): New functions. (gen_method_decl): Remove second parameter; call gen_type_name() instead of gen_declaration_1(). (dump_interface): Adjust calls to gen_declaration() and gen_method_decl(); do not allocate a separate string buffer. (init_objc): Allocate a larger string buffer to accommodate dump_interface(); adjust call to build_module_descriptor(); add call to build_module_initializer_routine() for the GNU runtime. (generate_classref_translation_entry): Do not call start_decl(); call finish_var_decl() instead of finish_decl(); call convert() instead of build_c_cast(). * objc-act.h (CLASS_OWN_IVARS): Remove accessor. (CLASS_BINFO_ELTS): Reduce from 6 to 5, now that CLASS_OWN_IVARS is gone. (OCTI_GNU_INIT_DECL, GNU_INIT_decl): New. (OCTI_ELLIPSIS_NODE, objc_ellipsis_node): Remove. (OCTI_ID_ID, id_type, objc_id_id): Rename to OCTI_ID_NAME, objc_object_type and objc_object_name, respectively. (OCTI_CLS_REF, OCTI_CLASS_NAME, objc_class_reference, objc_class_name): New. (IS_CLASS): New macro. (IS_ID, IS_SUPER): Robustify. (OCTI_EXECCLASS_DECL, execclass_decl): New. (finish_file, start_class, continue_class, finish_class, start_method_def, continue_method_def, finish_method_def, start_protocol, finish_protocol, objc_build_throw_stmt, objc_build_try_catch_finally_stmt, objc_build_synchronized_prologue, objc_build_synchronized_epilogue, objc_build_try_prologue, objc_build_try_epilogue, objc_build_catch_stmt, objc_build_catch_epilogue, objc_build_finally_prologue, objc_build_finally_epilogue, is_ivar, is_private, is_public, add_instance_variable, objc_add_method, get_super_receiver, objc_clear_super_receiver, get_class_ivars_from_name, get_class_reference, get_static_reference, get_object_reference, build_message_expr, finish_message_expr, build_selector_expr, build_ivar_reference, build_keyword_decl, build_method_decl, build_protocol_expr, build_objc_string_object, objc_declare_alias, objc_declare_class, objc_declare_protocols, objc_comptypes, objc_check_decl, build_encode_expr): Remove prototypes. (imp_count, cat_count): Make GGC-aware. (OBJC_SET_TYPE_NAME): New macro. From-SVN: r87168
2004-09-08 02:49:44 +02:00
void
objc_start_class_interface (tree class, tree super_class, tree protos)
{
objc_interface_context
= objc_ivar_context
= start_class (CLASS_INTERFACE_TYPE, class, super_class, protos);
objc_public_flag = 0;
}
void
objc_start_category_interface (tree class, tree categ, tree protos)
{
objc_interface_context
= start_class (CATEGORY_INTERFACE_TYPE, class, categ, protos);
objc_ivar_chain
= continue_class (objc_interface_context);
}
void
objc_start_protocol (tree name, tree protos)
{
objc_interface_context
= start_protocol (PROTOCOL_INTERFACE_TYPE, name, protos);
}
void
objc_continue_interface (void)
{
objc_ivar_chain
= continue_class (objc_interface_context);
}
void
objc_finish_interface (void)
{
finish_class (objc_interface_context);
objc_interface_context = NULL_TREE;
}
void
objc_start_class_implementation (tree class, tree super_class)
{
objc_implementation_context
= objc_ivar_context
= start_class (CLASS_IMPLEMENTATION_TYPE, class, super_class, NULL_TREE);
objc_public_flag = 0;
}
void
objc_start_category_implementation (tree class, tree categ)
{
objc_implementation_context
= start_class (CATEGORY_IMPLEMENTATION_TYPE, class, categ, NULL_TREE);
objc_ivar_chain
= continue_class (objc_implementation_context);
}
void
objc_continue_implementation (void)
{
objc_ivar_chain
= continue_class (objc_implementation_context);
}
void
objc_finish_implementation (void)
{
Yet more Objective-C++... * objc-act.c (objc_finish_try_stmt): Add return value. (objc_build_synchronized): Likewise. * objc-act.c (objc_is_gcable_type): Add. (objc_substitute_decl): Add. (objc_build_ivar_assignment): Add. (objc_build_global_assignment): Add. (objc_build_strong_cast_assignment): Add. (objc_is_ivar_reference_p): Add. (objc_is_global_reference_p): Add. (objc_generate_write_barrier): Add. (objc_rewrite_function_call): Add. (objc_gimplify_expr): Add Objective-C++ support. * objc-act.h (ALLOC_OBJC_TYPE_LANG_SPECIFIC): Likewise. (SIZEOF_OBJC_TYPE_LANG_SPECIFIC): Add. (INIT_TYPE_OBJC_INFO): Add Objective-C++ support. (DUP_TYPE_OBJC_INFO): Likewise. (struct imp_entry): Add field has_cxx_cdtors. (struct imp_entry *imp_list): Add OCTI_UMSG_FAST_DECL, OCTI_METH_LIST_TEMPL, OCTI_METH_PROTO_LIST_TEMPL, OCTI_IVAR_LIST_TEMPL, OCTI_ASSIGN_IVAR_DECL, OCTI_ASSIGN_IVAR_FAST_DECL, OCTI_ASSIGN_GLOBAL_DECL, OCTI_ASSIGN_STRONGCAST_DECL. (umsg_fast_decl): Add. (objc_assign_ivar_decl): Add. (objc_assign_ivar_fast_decl): Add. (objc_assign_global_decl): Add. (objc_assign_strong_cast_decl): Add. (objc_method_list_ptr): Add. (objc_method_proto_list_ptr): Add. (objc_ivar_list_ptr): Add. * objc-act.c (should_call_super_dealloc): Add. (OBJC_VERSION): Bump to 6. (objc_is_gcable_type): Add. (objc_substitute_decl): Add. (objc_build_ivar_assignment): Add. (objc_build_global_assignment): Add. (objc_build_strong_cast_assignment): Add. (objc_is_gcable_p): Add. (objc_is_ivar_reference_p): Add. (objc_is_global_reference_p): Add. (generate_shared_structures): Add flags parameter. (objc_generate_cxx_ctor_or_dtor): Add. (objc_generate_cxx_cdtors): Add. (add_class): Add name parameter. (objc_types_share_size_and_alignment): Add. (comp_proto_with_proto): Add strict parameter. (CLS_HAS_CXX_STRUCTORS): Add. (TAG_ASSIGNIVAR): Add. (TAG_ASSIGNGLOBAL): Add. (TAG_ASSIGNSTRONGCAST): Add. (TAG_MSGSEND_FAST): Add. (TAG_ASSIGNIVAR_FAST): Add. (TAG_CXX_CONSTRUCT): Add. (TAG_CXX_DESTRUCT): Add. (OBJC_LOOKUP_CLASS): Add. (OBJC_LOOKUP_NO_SUPER): Add. (objc_finish_file): Add pch support. (objc_finish_implementation): Add Objective-C++ support. (synth_module_prologue): Likewise. (synth_module_prologue): Add fast dispatching. (objc_get_class_reference): Add Objective-C++ support. (objc_generate_write_barrier): Likewise. (next_sjlj_build_enter_and_setjmp): Likewise. (objc_begin_try_stmt): Likewise. (build_next_objc_exception_stuff): Add fast ivar support. (build_private_template): Mark the record as used so debug information is generated. (build_protocol_template): Add Objective-C++ support. (objc_method_parm_type) Likewise. (objc_generate_cxx_ctor_or_dtor): Likewise. (objc_generate_cxx_cdtors): Likewise. (build_protocol_initializer): Likewise. (build_category_template): Likewise. (build_class_template): Likewise. (build_method_list_template): Likewise. (build_category_initializer): Likewise. (build_shared_structure_initializer): Likewise. (objc_finish_message_expr): Likewise. (build_objc_method_call): Add fast dispatch support. (lookup_method_static): Add support to end search at superclasses. (add_method_to_hash_list): Add strict parameter to comp_proto_with_proto. (objc_add_method): Likewise. (objc_add_method): Also set the interface_value. (add_instance_variable): Add Objective-C++ support. (objc_is_public): Likewise. (start_class): Likewise. (continue_class): Likewise. (encode_aggregate_within): Likewise. (start_method_def): Likewise. (objc_start_function): Clear current_function_returns_value and current_function_returns_null. (really_start_method): Add Objective-C++ support. (objc_finish_method_definition): Add warning for missing [super dealloc]. (finish_objc): Add Objective-C++ support. (generate_objc_image_info): Likewise. (objc_lookup_ivar): Likewise. * objc-act.h (TYPE_HAS_OBJC_INFO): Likewise. (INIT_TYPE_OBJC_INFO): Likewise. (DUP_TYPE_OBJC_INFO): Likewise. From-SVN: r99857
2005-05-17 22:07:08 +02:00
#ifdef OBJCPLUS
if (flag_objc_call_cxx_cdtors)
objc_generate_cxx_cdtors ();
#endif
Makefile.in (c-parse.o): Depend on $(C_COMMON_H). [gcc/ChangeLog] 2004-09-07 Ziemowit Laski <zlaski@apple.com> * Makefile.in (c-parse.o): Depend on $(C_COMMON_H). * c-parse.in: Include c-common.h instead of objc-act.h. (ivar_decl_list, ivar_decls, ivar_decl, ivars, ivar_declarator, myparms, myparm): Remove %type declarations. (methodtype, optparms, OBJC_TYPE_QUAL, objc_quals, objc_qual, objc_typename, objc_try_catch_stmt, optellipsis): Add %type declarations. (objc_inherit_code, objc_public_flag): Remove. (typespec_nonreserved_nonattr): Call objc_get_protocol_qualified_type() instead of get_static_reference() and get_protocol_reference(). (stmt_nocomp): Call grokparm() on @catch parameter. (objcdef): Move semantic action to objc_finish_implementation(). (classdef): Move semantic action to objc_start_class_interface(), objc_continue_interface(), objc_finish_interface(), objc_start_class_implementation(), objc_continue_implementation(), objc_start_category_interface() and objc_start_category_implementation(). (protocoldef): Move semantic actions to objc_start_protocol() and objc_finish_interface(). (ivar_decl_list): Remove nonterminal. (visibility_spec): Move semantic actions to objc_set_visibility(). (ivar_decls): Remove assignment to $$. (ivar_decl): Rephrase in terms of component_decl; call objc_add_instance_variable(). (ivars, ivar_declarator): Remove nonterminals. (opt_semi): New nonterminal. (methodtype): Remove semantic actions. (methoddef): Move semantic actions to objc_set_method_type(), objc_start_method_definition() and objc_finish_method_definition(). (methodproto): Move semantic actions to objc_set_method_type() and objc_add_method_declaration(). (methoddecl): Use objc_typename instead of typename; move semantic actions to objc_build_method_signature(). (optarglist, myxdecls, mydecl, myparms, myparm): Remove nonterminals. (optparmlist): Express in terms of optparms and optellipsis. (optparms, optellipsis, objc_qual, objc_quals, objc_typename): New nonterminals. (keyworddecl): Use objc_typename instead of typename. (rid_to_yy): Mark RID_IN, RID_OUT, RID_INOUT, RID_BYCOPY, RID_BYREF and RID_ONEWAY as returning OBJC_TYPE_QUAL to yyparse(). [gcc/objc/ChangeLog] 2004-09-07 Ziemowit Laski <zlaski@apple.com> * Make-lang.in (objc/objc-parse.o): Depend on $(C_COMMON_H) instead of objc/objc-act.h. (objc/objc-act.o): Depend on $(HASHTAB_H). * objc-act.c: Include hashtab.h; in ObjC++ mode, include cp-tree.h and objcp-decl.h instead of c-tree.h. (build_module_descriptor, get_class_ivars, synth_id_with_class_suffix, error_with_ivar, gen_method_decl, gen_declaration, setup_string_decl, build_protocol_template): Adjust prototypes. (build_module_initializer_routine, start_class, continue_class, finish_class, start_method_def, objc_start_function, start_protocol, build_method_decl, objc_add_method, add_instance_variable, build_ivar_reference, is_ivar, is_private, get_super_receiver, build_selector_table_decl, objc_push_parm, objc_get_parm_info, gen_type_name, gen_type_name_0, start_var_decl, finish_var_decl, create_field_decl): New prototypes. (objc_expand_function_end, comp_method_with_proto, objc_expr_last, gen_declaration_1, gen_declarator, is_complex_decl, adorn_decl, define_decl, create_builtin_decl, gen_declspecs): Remove prototypes. (TYPE_ID): Rename to OBJECT_TYPEDEF_NAME. (CLASS_TYPEDEF_NAME): New. (TAG_EXECCLASS): Change from a global variable to a #define. (TAG_RETURN_STRUCT): Delete. (TAG_GNUINIT): New, holds '__objc_gnu_init' name. (objc_inherit_code, objc_public_flag): New, moved from c-parse.in. (string_descriptor): New struct. (string_htab): New hash table. (string_hash, string_eq): New prototypes. (generate_struct_by_value_array): Call create_field_decl() instead of create_builtin_decl(). (objc_init): Do not initialize objc_ellipsis_node or TAG_EXECCLASS; In ObjC++ mode, call cxx_init() instead of c_objc_common_init(). (objc_finish_file): In ObjC++, call instantiate_pending_templates() and cp_finish_file(). (define_decl, get_static_reference, get_protocol_reference, create_builtin_decl): Remove functions. (objc_start_class_interface, objc_start_category_interface, objc_start_protocol, objc_continue_interface, objc_finish_interface, objc_start_class_implementation, objc_start_category_implementation, objc_continue_implementation, objc_finish_implementation, objc_set_visibility, objc_set_method_type, objc_build_method_signature, objc_add_method_declaration, objc_start_method_definition, objc_add_instance_variable, objc_get_protocol_qualified_type, create_field_decl, start_var_decl, finish_var_decl): New functions. (setup_string_decl): Simplify since it is only called once. (synth_module_prologue): Call build_class_template(); predefine 'id' and 'Class' as typedefs; rename 'temp_type' to 'type'; disable debug hooks for duration of function; fix GNU runtime messenger signatures to correspond to reality; forward-declare '__objc_exec_class' for the GNU runtime; call build_selector_table_decl(); in ObjC++ mode, generate 'extern "C" { ... }' wrappers around synthesized declarations; call build_protocol_template() and build_category_template(). (string_hash, string_eq): New functions. (objc_build_string_object): Check metaclass correctness only once; store string literals in hash table. (objc_build_constructor): Do not convert initializer elements; adjust for ObjC++ impedance mismatch. (build_objc_symtab_template): Call create_field_decl() instead of create_builtin_decl(). (init_objc_symtab): Add missing conversion to initializer element. (build_metadata_decl): Call start_var_decl() instead of define_decl(). (generate_objc_symtab_decl): Do not call build_category_template(); call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(). (build_module_descriptor): Call create_field_decl() instead of grokfield(); call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(); always mark module descriptor as used; move GNU runtime-specific functionality to build_module_initializer_routine(). (build_module_initializer_routine): New function, broken off of build_module_descriptor(). (objc_static_init_needed_p, objc_generate_static_init_call): New functions. (generate_static_references, generate_strings, build_selector_translation_table, generate_descriptor_table, generate_ivars_list, generate_dispatch_table, generate_category): Call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(); build a type directly instead of via groktypename(). (build_selector_reference_decl, build_selector_table_decl, build_class_reference_decl, build_protocol_reference, generate_objc_image_info): Call start_var_decl() instead of build_decl(). (build_selector_reference): For GNU runtime, do not call build_selector_reference_decl(). (build_selector, build_typed_selector_reference): Always convert result to the selector type. (add_objc_string): Cast return value to 'char *'. (build_method_prototype_template, build_selector_template, build_method_template): Use actual selector type for fields pointing to selectors. (finish_objc): For GNU runtime, call build_module_initializer_routine() after build_module_descriptor(). (generate_protocol_list, generate_shared_structures): Call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(); build a type directly instead of via groktypename(). (synth_id_with_class_suffix): Return a string. (get_arg_type_list): For instance methods, use the instance type for 'self'; do not call groktypename_in_parm_context(). (build_objc_string_decl): Squash redeclaration errors in ObjC++. (objc_is_class_name): Use OBJC_TYPE_NAME instead of TYPE_NAME; handle RECORD_TYPEs in ObjC as well as ObjC++. (objc_is_id): New function. (objc_is_object_ptr): Return the canonical type node. (objc_get_class_ivars): Simplify using get_class_ivars(). (get_class_ivars): Remove second parameter; create a fresh copy of the ivar list for each call; do not check for existence of super class. (objc_eh_runtime_type): Mark #ifndef OBJCPLUS. (objc_init_exceptions): When using SJLJ-style exceptions, require the use of '-fobjc-exceptions' flag; do not require it for DWARF-style exceptions. (objc_build_exc_ptr, next_sjlj_build_try_catch_finally): Use objc_object_type instead of objc_id_type. (objc_begin_catch_clause): Convert the incoming PARM_DECL into a VAR_DECL before placing it in the appropriate scope; do not call define_decl(); adjust call to c_begin_compound_stmt(); use objc_object_type instead of objc_id_type. (build_next_objc_exception_stuff): Call create_field_decl() instead of create_builtin_decl(); construct type directly instead of calling groktypename(); use OBJC_VOID_AT_END to mark end of function parameters. (build_private_template): Adjust call to get_class_ivars(); build a type directly instead of via groktypename(). (build_protocol_template, build_method_prototype_list_template, build_method_prototype_template, build_category_template, build_selector_template, build_class_template, build_super_template, build_ivar_template, build_ivar_list_template, build_method_list_template, build_method_template): Call create_field_decl() instead of grokfield(). (objc_method_parm_type): Do not call groktypename(). (generate_descriptor_table): Call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(). (generate_method_descriptors, build_protocol_initializer, generate_dispatch_tables, build_category_initializer, build_shared_structure_initializer): Do not call groktypename(). (generate_protocols): Call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(); do not call groktypename(). (error_with_ivar): Remove last parameter. (check_ivars): Do not iterate ovar CLASS_RAW_IVARS lists in addition to CLASS_IVARS lists; adjust calls to error_with_ivar(). (generate_ivar_lists): Convert one of the initializer elements; do not call groktypename(). (get_arg_type_list, start_method_def, gen_method_def): Account for new representation of variable arguments and '...' in Objective-C methods; add Objective-C++ impedance matching code. (is_objc_type_qualifier): Remove function. (adjust_type_for_id_default): Simplify; there is no longer a need to wade through declspecs. (lookup_interface, start_class, continue_class, finish_class, start_method_def, start_protocol, build_method_decl, objc_add_method, add_instance_variable, build_ivar_reference, is_ivar, is_private, get_super_receiver, objc_build_finally_epilogue): Make into static functions. (receiver_is_class_object): Use new IS_CLASS() macro. (objc_build_message_expr): Tweak ObjC++ message argument handling; call objc_finish_message_expr() instead of finish_message_expr(). (finish_message_expr): Rename to objc_finish_message_expr(); use OBJC_TYPE_NAME and OBJC_SET_TYPE_NAME macros instead of TYPE_NAME. call gen_type_name() instead of gen_declaration(); call objc_is_id() instead of using IS_ID and IS_CLASS; Use objc_class_name instead of calling get_identifier("Class"); handle CONVERT_EXPRs in receiver. (build_objc_method_call, warn_with_method): Do not call groktypename(). (build_ivar_reference): Call convert() instead of clobbering in a type. (hash_init): Initialize string_htab hash table. (add_instance_variable): Simplify parameter list; do not call grokfield(); do not populate CLASS_IVARS list. (start_class): Check for the existence of super class, if one was specified. (continue_class): Use CLASS_RAW_IVARS rather than CLASS_IVARS; do not call build_class_template(); adjust call to get_class_ivars(); call build_decl(), pushdecl() and finish_decl() instead of define_decl(). (finish_class): Call build_decl(), pushdecl() and finish_decl() instead of define_decl(). (add_protocols): Use PROTOCOL_BINFO_ELTS for the tree vector size. (start_protocol): Do not call build_protocol_template(); use PROTOCOL_BINFO_ELTS for the tree vector size. (encode_type_qualifiers): Do not handle the 'const' qualifier here. (encode_pointer): Encode 'const char *' as 'r*', for backwards compatibility. (encode_array): Use HOST_WIDE_INT_PRINT_DEC instead of "%ld". (encode_type): Handle the 'const' qualifier here. (objc_parmlist): New global variable, sued by objc_push_parm and objc_get_parm_info(). (objc_push_parm, objc_get_parm_info): New functions. (objc_expr_last): Remove function. (synth_self_and_ucmd_args): For instance methods, use the instance type for 'self'; call objc_push_parm() instead of push_parm_decl(). (start_method_def): Do not call push_scope(), declare_parm_level(), pop_scope(), push_parm_decl(), store_parm_decls() or objc_expr_last(); just use objc_push_parm() and objc_get_parm_info(). (comp_method_with_proto): Remove function. (objc_types_are_equivalent): Strip away indirections before comparing underlying types. (comp_proto_with_proto): Do not call groktypename(); types are no longer in raw declspec format. (objc_start_function): New function. (really_start_method): Call comp_proto_with_proto() instead of comp_method_with_proto(); call objc_start_function() instead of hand-crafting a function declarator. (continue_method_def, objc_expand_function_end): Remove functions. (get_super_receiver): Call objc_get_current_scope() instead of get_current_scope(); reference 'super_class' field (instead of 'class'). (finish_method_def): Rename to objc_finish_method_definition() and add a function decl parameter; move method encoding call from objc_expand_function_end(). (is_complex_decl, adorn_decl, gen_declarator, gen_declspecs, gen_declaration_1): Remove functions. (tmpbuf, RAW_DECLSPEC): Remove. (gen_declaration): Remove second parameter; simplify to deal with TYPE_P nodes instead of raw declspecs. (gen_type_name, gen_type_name_0): New functions. (gen_method_decl): Remove second parameter; call gen_type_name() instead of gen_declaration_1(). (dump_interface): Adjust calls to gen_declaration() and gen_method_decl(); do not allocate a separate string buffer. (init_objc): Allocate a larger string buffer to accommodate dump_interface(); adjust call to build_module_descriptor(); add call to build_module_initializer_routine() for the GNU runtime. (generate_classref_translation_entry): Do not call start_decl(); call finish_var_decl() instead of finish_decl(); call convert() instead of build_c_cast(). * objc-act.h (CLASS_OWN_IVARS): Remove accessor. (CLASS_BINFO_ELTS): Reduce from 6 to 5, now that CLASS_OWN_IVARS is gone. (OCTI_GNU_INIT_DECL, GNU_INIT_decl): New. (OCTI_ELLIPSIS_NODE, objc_ellipsis_node): Remove. (OCTI_ID_ID, id_type, objc_id_id): Rename to OCTI_ID_NAME, objc_object_type and objc_object_name, respectively. (OCTI_CLS_REF, OCTI_CLASS_NAME, objc_class_reference, objc_class_name): New. (IS_CLASS): New macro. (IS_ID, IS_SUPER): Robustify. (OCTI_EXECCLASS_DECL, execclass_decl): New. (finish_file, start_class, continue_class, finish_class, start_method_def, continue_method_def, finish_method_def, start_protocol, finish_protocol, objc_build_throw_stmt, objc_build_try_catch_finally_stmt, objc_build_synchronized_prologue, objc_build_synchronized_epilogue, objc_build_try_prologue, objc_build_try_epilogue, objc_build_catch_stmt, objc_build_catch_epilogue, objc_build_finally_prologue, objc_build_finally_epilogue, is_ivar, is_private, is_public, add_instance_variable, objc_add_method, get_super_receiver, objc_clear_super_receiver, get_class_ivars_from_name, get_class_reference, get_static_reference, get_object_reference, build_message_expr, finish_message_expr, build_selector_expr, build_ivar_reference, build_keyword_decl, build_method_decl, build_protocol_expr, build_objc_string_object, objc_declare_alias, objc_declare_class, objc_declare_protocols, objc_comptypes, objc_check_decl, build_encode_expr): Remove prototypes. (imp_count, cat_count): Make GGC-aware. (OBJC_SET_TYPE_NAME): New macro. From-SVN: r87168
2004-09-08 02:49:44 +02:00
if (objc_implementation_context)
{
finish_class (objc_implementation_context);
objc_ivar_chain = NULL_TREE;
objc_implementation_context = NULL_TREE;
}
else
diagnostic.c (warning): Accept parameter to classify warning option. * diagnostic.c (warning): Accept parameter to classify warning option. (warning0): New, for when a pointer to an error() like function is needed. * errors.c (warning): Likewise. * errors.h (warning, warning0): Adjust prototypes. * toplev.h (warning, warning0): Likewise. * attribs.c, builtins.c, c-common.c, c-decl.c, c-format.c, c-gimplify.c, c-lex.c, c-objc-common.c, c-opts.c, c-parser.c, c-pragma.c, c-typeck.c, calls.c, cgraph.c, coverage.c, emit-rtl.c, fold-const.c, fortran/trans-decl.c, function.c, gcse.c, genautomata.c, haifa-sched.c, opts.c, passes.c, regclass.c, reload1.c, stmt.c, stor-layout.c, toplev.c, tree-cfg.c, tree-dump.c, tree-inline.c, tree-mudflap.c, tree-optimize.c, tree-ssa.c, tree.c, varasm.c: Adjust warning() callers. * config/alpha/alpha.c, config/arc/arc.c, config/arm/arm.c, config/avr/avr.c, config/bfin/bfin.c, config/c4x/c4x-c.c, config/c4x/c4x.c, config/cris/cris.c, config/darwin-c.c, config/darwin.c, config/darwin.h, config/h8300/h8300.c, config/i386/cygming.h, config/i386/djgpp.h, config/i386/i386.c, config/i386/winnt.c, config/ia64/ia64-c.c, config/ia64/ia64.c, config/ip2k/ip2k.c, config/m32r/m32r.c, config/m68hc11/m68hc11.c, config/m68k/m68k.c, config/mcore/mcore.c, config/mips/mips.c, config/mmix/mmix.c, config/ns32k/ns32k.c, config/pa/pa-hpux11.h, config/pa/pa.c, config/rs6000/aix43.h, config/rs6000/aix51.h, config/rs6000/aix52.h, config/rs6000/darwin.h, config/rs6000/rs6000-c.c, config/rs6000/rs6000.c, config/s390/s390.c, config/sh/sh.c, config/sh/sh.h, config/sh/symbian.c, config/sol2-c.c, config/sol2.c, config/stormy16/stormy16.c, config/v850/v850-c.c, config/v850/v850.c, config/xtensa/xtensa.c: Adjust warning() callers. * ada/misc.c: Adjust warning() callers. * cp/call.c, cp/class.c, cp/cvt.c, cp/decl.c, cp/decl2.c, cp/except.c, cp/friend.c, cp/init.c, cp/lex.c, cp/mangle.c, cp/method.c, cp/name-lookup.c, cp/parser.c, cp/repo.c, cp/rtti.c, cp/tree.c, cp/typeck.c, cp/typeck2.c: Adjust warning() callers. * fortran/trans-decl.c: Adjust warning() callers. * java/class.c, java/decl.c, java/expr.c, java/jcf-io.c, java/jcf-parse.c, java/jv-scan.c, java/parse.y: Adjust warning() callers. * objc/objc-act.c: Adjust warning() callers. * treelang/parse.y: Adjust warning() callers. From-SVN: r98633
2005-04-23 23:29:07 +02:00
warning (0, "%<@end%> must appear in an @implementation context");
Makefile.in (c-parse.o): Depend on $(C_COMMON_H). [gcc/ChangeLog] 2004-09-07 Ziemowit Laski <zlaski@apple.com> * Makefile.in (c-parse.o): Depend on $(C_COMMON_H). * c-parse.in: Include c-common.h instead of objc-act.h. (ivar_decl_list, ivar_decls, ivar_decl, ivars, ivar_declarator, myparms, myparm): Remove %type declarations. (methodtype, optparms, OBJC_TYPE_QUAL, objc_quals, objc_qual, objc_typename, objc_try_catch_stmt, optellipsis): Add %type declarations. (objc_inherit_code, objc_public_flag): Remove. (typespec_nonreserved_nonattr): Call objc_get_protocol_qualified_type() instead of get_static_reference() and get_protocol_reference(). (stmt_nocomp): Call grokparm() on @catch parameter. (objcdef): Move semantic action to objc_finish_implementation(). (classdef): Move semantic action to objc_start_class_interface(), objc_continue_interface(), objc_finish_interface(), objc_start_class_implementation(), objc_continue_implementation(), objc_start_category_interface() and objc_start_category_implementation(). (protocoldef): Move semantic actions to objc_start_protocol() and objc_finish_interface(). (ivar_decl_list): Remove nonterminal. (visibility_spec): Move semantic actions to objc_set_visibility(). (ivar_decls): Remove assignment to $$. (ivar_decl): Rephrase in terms of component_decl; call objc_add_instance_variable(). (ivars, ivar_declarator): Remove nonterminals. (opt_semi): New nonterminal. (methodtype): Remove semantic actions. (methoddef): Move semantic actions to objc_set_method_type(), objc_start_method_definition() and objc_finish_method_definition(). (methodproto): Move semantic actions to objc_set_method_type() and objc_add_method_declaration(). (methoddecl): Use objc_typename instead of typename; move semantic actions to objc_build_method_signature(). (optarglist, myxdecls, mydecl, myparms, myparm): Remove nonterminals. (optparmlist): Express in terms of optparms and optellipsis. (optparms, optellipsis, objc_qual, objc_quals, objc_typename): New nonterminals. (keyworddecl): Use objc_typename instead of typename. (rid_to_yy): Mark RID_IN, RID_OUT, RID_INOUT, RID_BYCOPY, RID_BYREF and RID_ONEWAY as returning OBJC_TYPE_QUAL to yyparse(). [gcc/objc/ChangeLog] 2004-09-07 Ziemowit Laski <zlaski@apple.com> * Make-lang.in (objc/objc-parse.o): Depend on $(C_COMMON_H) instead of objc/objc-act.h. (objc/objc-act.o): Depend on $(HASHTAB_H). * objc-act.c: Include hashtab.h; in ObjC++ mode, include cp-tree.h and objcp-decl.h instead of c-tree.h. (build_module_descriptor, get_class_ivars, synth_id_with_class_suffix, error_with_ivar, gen_method_decl, gen_declaration, setup_string_decl, build_protocol_template): Adjust prototypes. (build_module_initializer_routine, start_class, continue_class, finish_class, start_method_def, objc_start_function, start_protocol, build_method_decl, objc_add_method, add_instance_variable, build_ivar_reference, is_ivar, is_private, get_super_receiver, build_selector_table_decl, objc_push_parm, objc_get_parm_info, gen_type_name, gen_type_name_0, start_var_decl, finish_var_decl, create_field_decl): New prototypes. (objc_expand_function_end, comp_method_with_proto, objc_expr_last, gen_declaration_1, gen_declarator, is_complex_decl, adorn_decl, define_decl, create_builtin_decl, gen_declspecs): Remove prototypes. (TYPE_ID): Rename to OBJECT_TYPEDEF_NAME. (CLASS_TYPEDEF_NAME): New. (TAG_EXECCLASS): Change from a global variable to a #define. (TAG_RETURN_STRUCT): Delete. (TAG_GNUINIT): New, holds '__objc_gnu_init' name. (objc_inherit_code, objc_public_flag): New, moved from c-parse.in. (string_descriptor): New struct. (string_htab): New hash table. (string_hash, string_eq): New prototypes. (generate_struct_by_value_array): Call create_field_decl() instead of create_builtin_decl(). (objc_init): Do not initialize objc_ellipsis_node or TAG_EXECCLASS; In ObjC++ mode, call cxx_init() instead of c_objc_common_init(). (objc_finish_file): In ObjC++, call instantiate_pending_templates() and cp_finish_file(). (define_decl, get_static_reference, get_protocol_reference, create_builtin_decl): Remove functions. (objc_start_class_interface, objc_start_category_interface, objc_start_protocol, objc_continue_interface, objc_finish_interface, objc_start_class_implementation, objc_start_category_implementation, objc_continue_implementation, objc_finish_implementation, objc_set_visibility, objc_set_method_type, objc_build_method_signature, objc_add_method_declaration, objc_start_method_definition, objc_add_instance_variable, objc_get_protocol_qualified_type, create_field_decl, start_var_decl, finish_var_decl): New functions. (setup_string_decl): Simplify since it is only called once. (synth_module_prologue): Call build_class_template(); predefine 'id' and 'Class' as typedefs; rename 'temp_type' to 'type'; disable debug hooks for duration of function; fix GNU runtime messenger signatures to correspond to reality; forward-declare '__objc_exec_class' for the GNU runtime; call build_selector_table_decl(); in ObjC++ mode, generate 'extern "C" { ... }' wrappers around synthesized declarations; call build_protocol_template() and build_category_template(). (string_hash, string_eq): New functions. (objc_build_string_object): Check metaclass correctness only once; store string literals in hash table. (objc_build_constructor): Do not convert initializer elements; adjust for ObjC++ impedance mismatch. (build_objc_symtab_template): Call create_field_decl() instead of create_builtin_decl(). (init_objc_symtab): Add missing conversion to initializer element. (build_metadata_decl): Call start_var_decl() instead of define_decl(). (generate_objc_symtab_decl): Do not call build_category_template(); call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(). (build_module_descriptor): Call create_field_decl() instead of grokfield(); call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(); always mark module descriptor as used; move GNU runtime-specific functionality to build_module_initializer_routine(). (build_module_initializer_routine): New function, broken off of build_module_descriptor(). (objc_static_init_needed_p, objc_generate_static_init_call): New functions. (generate_static_references, generate_strings, build_selector_translation_table, generate_descriptor_table, generate_ivars_list, generate_dispatch_table, generate_category): Call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(); build a type directly instead of via groktypename(). (build_selector_reference_decl, build_selector_table_decl, build_class_reference_decl, build_protocol_reference, generate_objc_image_info): Call start_var_decl() instead of build_decl(). (build_selector_reference): For GNU runtime, do not call build_selector_reference_decl(). (build_selector, build_typed_selector_reference): Always convert result to the selector type. (add_objc_string): Cast return value to 'char *'. (build_method_prototype_template, build_selector_template, build_method_template): Use actual selector type for fields pointing to selectors. (finish_objc): For GNU runtime, call build_module_initializer_routine() after build_module_descriptor(). (generate_protocol_list, generate_shared_structures): Call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(); build a type directly instead of via groktypename(). (synth_id_with_class_suffix): Return a string. (get_arg_type_list): For instance methods, use the instance type for 'self'; do not call groktypename_in_parm_context(). (build_objc_string_decl): Squash redeclaration errors in ObjC++. (objc_is_class_name): Use OBJC_TYPE_NAME instead of TYPE_NAME; handle RECORD_TYPEs in ObjC as well as ObjC++. (objc_is_id): New function. (objc_is_object_ptr): Return the canonical type node. (objc_get_class_ivars): Simplify using get_class_ivars(). (get_class_ivars): Remove second parameter; create a fresh copy of the ivar list for each call; do not check for existence of super class. (objc_eh_runtime_type): Mark #ifndef OBJCPLUS. (objc_init_exceptions): When using SJLJ-style exceptions, require the use of '-fobjc-exceptions' flag; do not require it for DWARF-style exceptions. (objc_build_exc_ptr, next_sjlj_build_try_catch_finally): Use objc_object_type instead of objc_id_type. (objc_begin_catch_clause): Convert the incoming PARM_DECL into a VAR_DECL before placing it in the appropriate scope; do not call define_decl(); adjust call to c_begin_compound_stmt(); use objc_object_type instead of objc_id_type. (build_next_objc_exception_stuff): Call create_field_decl() instead of create_builtin_decl(); construct type directly instead of calling groktypename(); use OBJC_VOID_AT_END to mark end of function parameters. (build_private_template): Adjust call to get_class_ivars(); build a type directly instead of via groktypename(). (build_protocol_template, build_method_prototype_list_template, build_method_prototype_template, build_category_template, build_selector_template, build_class_template, build_super_template, build_ivar_template, build_ivar_list_template, build_method_list_template, build_method_template): Call create_field_decl() instead of grokfield(). (objc_method_parm_type): Do not call groktypename(). (generate_descriptor_table): Call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(). (generate_method_descriptors, build_protocol_initializer, generate_dispatch_tables, build_category_initializer, build_shared_structure_initializer): Do not call groktypename(). (generate_protocols): Call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(); do not call groktypename(). (error_with_ivar): Remove last parameter. (check_ivars): Do not iterate ovar CLASS_RAW_IVARS lists in addition to CLASS_IVARS lists; adjust calls to error_with_ivar(). (generate_ivar_lists): Convert one of the initializer elements; do not call groktypename(). (get_arg_type_list, start_method_def, gen_method_def): Account for new representation of variable arguments and '...' in Objective-C methods; add Objective-C++ impedance matching code. (is_objc_type_qualifier): Remove function. (adjust_type_for_id_default): Simplify; there is no longer a need to wade through declspecs. (lookup_interface, start_class, continue_class, finish_class, start_method_def, start_protocol, build_method_decl, objc_add_method, add_instance_variable, build_ivar_reference, is_ivar, is_private, get_super_receiver, objc_build_finally_epilogue): Make into static functions. (receiver_is_class_object): Use new IS_CLASS() macro. (objc_build_message_expr): Tweak ObjC++ message argument handling; call objc_finish_message_expr() instead of finish_message_expr(). (finish_message_expr): Rename to objc_finish_message_expr(); use OBJC_TYPE_NAME and OBJC_SET_TYPE_NAME macros instead of TYPE_NAME. call gen_type_name() instead of gen_declaration(); call objc_is_id() instead of using IS_ID and IS_CLASS; Use objc_class_name instead of calling get_identifier("Class"); handle CONVERT_EXPRs in receiver. (build_objc_method_call, warn_with_method): Do not call groktypename(). (build_ivar_reference): Call convert() instead of clobbering in a type. (hash_init): Initialize string_htab hash table. (add_instance_variable): Simplify parameter list; do not call grokfield(); do not populate CLASS_IVARS list. (start_class): Check for the existence of super class, if one was specified. (continue_class): Use CLASS_RAW_IVARS rather than CLASS_IVARS; do not call build_class_template(); adjust call to get_class_ivars(); call build_decl(), pushdecl() and finish_decl() instead of define_decl(). (finish_class): Call build_decl(), pushdecl() and finish_decl() instead of define_decl(). (add_protocols): Use PROTOCOL_BINFO_ELTS for the tree vector size. (start_protocol): Do not call build_protocol_template(); use PROTOCOL_BINFO_ELTS for the tree vector size. (encode_type_qualifiers): Do not handle the 'const' qualifier here. (encode_pointer): Encode 'const char *' as 'r*', for backwards compatibility. (encode_array): Use HOST_WIDE_INT_PRINT_DEC instead of "%ld". (encode_type): Handle the 'const' qualifier here. (objc_parmlist): New global variable, sued by objc_push_parm and objc_get_parm_info(). (objc_push_parm, objc_get_parm_info): New functions. (objc_expr_last): Remove function. (synth_self_and_ucmd_args): For instance methods, use the instance type for 'self'; call objc_push_parm() instead of push_parm_decl(). (start_method_def): Do not call push_scope(), declare_parm_level(), pop_scope(), push_parm_decl(), store_parm_decls() or objc_expr_last(); just use objc_push_parm() and objc_get_parm_info(). (comp_method_with_proto): Remove function. (objc_types_are_equivalent): Strip away indirections before comparing underlying types. (comp_proto_with_proto): Do not call groktypename(); types are no longer in raw declspec format. (objc_start_function): New function. (really_start_method): Call comp_proto_with_proto() instead of comp_method_with_proto(); call objc_start_function() instead of hand-crafting a function declarator. (continue_method_def, objc_expand_function_end): Remove functions. (get_super_receiver): Call objc_get_current_scope() instead of get_current_scope(); reference 'super_class' field (instead of 'class'). (finish_method_def): Rename to objc_finish_method_definition() and add a function decl parameter; move method encoding call from objc_expand_function_end(). (is_complex_decl, adorn_decl, gen_declarator, gen_declspecs, gen_declaration_1): Remove functions. (tmpbuf, RAW_DECLSPEC): Remove. (gen_declaration): Remove second parameter; simplify to deal with TYPE_P nodes instead of raw declspecs. (gen_type_name, gen_type_name_0): New functions. (gen_method_decl): Remove second parameter; call gen_type_name() instead of gen_declaration_1(). (dump_interface): Adjust calls to gen_declaration() and gen_method_decl(); do not allocate a separate string buffer. (init_objc): Allocate a larger string buffer to accommodate dump_interface(); adjust call to build_module_descriptor(); add call to build_module_initializer_routine() for the GNU runtime. (generate_classref_translation_entry): Do not call start_decl(); call finish_var_decl() instead of finish_decl(); call convert() instead of build_c_cast(). * objc-act.h (CLASS_OWN_IVARS): Remove accessor. (CLASS_BINFO_ELTS): Reduce from 6 to 5, now that CLASS_OWN_IVARS is gone. (OCTI_GNU_INIT_DECL, GNU_INIT_decl): New. (OCTI_ELLIPSIS_NODE, objc_ellipsis_node): Remove. (OCTI_ID_ID, id_type, objc_id_id): Rename to OCTI_ID_NAME, objc_object_type and objc_object_name, respectively. (OCTI_CLS_REF, OCTI_CLASS_NAME, objc_class_reference, objc_class_name): New. (IS_CLASS): New macro. (IS_ID, IS_SUPER): Robustify. (OCTI_EXECCLASS_DECL, execclass_decl): New. (finish_file, start_class, continue_class, finish_class, start_method_def, continue_method_def, finish_method_def, start_protocol, finish_protocol, objc_build_throw_stmt, objc_build_try_catch_finally_stmt, objc_build_synchronized_prologue, objc_build_synchronized_epilogue, objc_build_try_prologue, objc_build_try_epilogue, objc_build_catch_stmt, objc_build_catch_epilogue, objc_build_finally_prologue, objc_build_finally_epilogue, is_ivar, is_private, is_public, add_instance_variable, objc_add_method, get_super_receiver, objc_clear_super_receiver, get_class_ivars_from_name, get_class_reference, get_static_reference, get_object_reference, build_message_expr, finish_message_expr, build_selector_expr, build_ivar_reference, build_keyword_decl, build_method_decl, build_protocol_expr, build_objc_string_object, objc_declare_alias, objc_declare_class, objc_declare_protocols, objc_comptypes, objc_check_decl, build_encode_expr): Remove prototypes. (imp_count, cat_count): Make GGC-aware. (OBJC_SET_TYPE_NAME): New macro. From-SVN: r87168
2004-09-08 02:49:44 +02:00
}
void
objc_set_visibility (int visibility)
{
objc_public_flag = visibility;
}
void
objc_set_method_type (enum tree_code type)
{
objc_inherit_code = (type == PLUS_EXPR
? CLASS_METHOD_DECL
: INSTANCE_METHOD_DECL);
}
tree
objc_build_method_signature (tree rettype, tree selector,
tree optparms, bool ellipsis)
Makefile.in (c-parse.o): Depend on $(C_COMMON_H). [gcc/ChangeLog] 2004-09-07 Ziemowit Laski <zlaski@apple.com> * Makefile.in (c-parse.o): Depend on $(C_COMMON_H). * c-parse.in: Include c-common.h instead of objc-act.h. (ivar_decl_list, ivar_decls, ivar_decl, ivars, ivar_declarator, myparms, myparm): Remove %type declarations. (methodtype, optparms, OBJC_TYPE_QUAL, objc_quals, objc_qual, objc_typename, objc_try_catch_stmt, optellipsis): Add %type declarations. (objc_inherit_code, objc_public_flag): Remove. (typespec_nonreserved_nonattr): Call objc_get_protocol_qualified_type() instead of get_static_reference() and get_protocol_reference(). (stmt_nocomp): Call grokparm() on @catch parameter. (objcdef): Move semantic action to objc_finish_implementation(). (classdef): Move semantic action to objc_start_class_interface(), objc_continue_interface(), objc_finish_interface(), objc_start_class_implementation(), objc_continue_implementation(), objc_start_category_interface() and objc_start_category_implementation(). (protocoldef): Move semantic actions to objc_start_protocol() and objc_finish_interface(). (ivar_decl_list): Remove nonterminal. (visibility_spec): Move semantic actions to objc_set_visibility(). (ivar_decls): Remove assignment to $$. (ivar_decl): Rephrase in terms of component_decl; call objc_add_instance_variable(). (ivars, ivar_declarator): Remove nonterminals. (opt_semi): New nonterminal. (methodtype): Remove semantic actions. (methoddef): Move semantic actions to objc_set_method_type(), objc_start_method_definition() and objc_finish_method_definition(). (methodproto): Move semantic actions to objc_set_method_type() and objc_add_method_declaration(). (methoddecl): Use objc_typename instead of typename; move semantic actions to objc_build_method_signature(). (optarglist, myxdecls, mydecl, myparms, myparm): Remove nonterminals. (optparmlist): Express in terms of optparms and optellipsis. (optparms, optellipsis, objc_qual, objc_quals, objc_typename): New nonterminals. (keyworddecl): Use objc_typename instead of typename. (rid_to_yy): Mark RID_IN, RID_OUT, RID_INOUT, RID_BYCOPY, RID_BYREF and RID_ONEWAY as returning OBJC_TYPE_QUAL to yyparse(). [gcc/objc/ChangeLog] 2004-09-07 Ziemowit Laski <zlaski@apple.com> * Make-lang.in (objc/objc-parse.o): Depend on $(C_COMMON_H) instead of objc/objc-act.h. (objc/objc-act.o): Depend on $(HASHTAB_H). * objc-act.c: Include hashtab.h; in ObjC++ mode, include cp-tree.h and objcp-decl.h instead of c-tree.h. (build_module_descriptor, get_class_ivars, synth_id_with_class_suffix, error_with_ivar, gen_method_decl, gen_declaration, setup_string_decl, build_protocol_template): Adjust prototypes. (build_module_initializer_routine, start_class, continue_class, finish_class, start_method_def, objc_start_function, start_protocol, build_method_decl, objc_add_method, add_instance_variable, build_ivar_reference, is_ivar, is_private, get_super_receiver, build_selector_table_decl, objc_push_parm, objc_get_parm_info, gen_type_name, gen_type_name_0, start_var_decl, finish_var_decl, create_field_decl): New prototypes. (objc_expand_function_end, comp_method_with_proto, objc_expr_last, gen_declaration_1, gen_declarator, is_complex_decl, adorn_decl, define_decl, create_builtin_decl, gen_declspecs): Remove prototypes. (TYPE_ID): Rename to OBJECT_TYPEDEF_NAME. (CLASS_TYPEDEF_NAME): New. (TAG_EXECCLASS): Change from a global variable to a #define. (TAG_RETURN_STRUCT): Delete. (TAG_GNUINIT): New, holds '__objc_gnu_init' name. (objc_inherit_code, objc_public_flag): New, moved from c-parse.in. (string_descriptor): New struct. (string_htab): New hash table. (string_hash, string_eq): New prototypes. (generate_struct_by_value_array): Call create_field_decl() instead of create_builtin_decl(). (objc_init): Do not initialize objc_ellipsis_node or TAG_EXECCLASS; In ObjC++ mode, call cxx_init() instead of c_objc_common_init(). (objc_finish_file): In ObjC++, call instantiate_pending_templates() and cp_finish_file(). (define_decl, get_static_reference, get_protocol_reference, create_builtin_decl): Remove functions. (objc_start_class_interface, objc_start_category_interface, objc_start_protocol, objc_continue_interface, objc_finish_interface, objc_start_class_implementation, objc_start_category_implementation, objc_continue_implementation, objc_finish_implementation, objc_set_visibility, objc_set_method_type, objc_build_method_signature, objc_add_method_declaration, objc_start_method_definition, objc_add_instance_variable, objc_get_protocol_qualified_type, create_field_decl, start_var_decl, finish_var_decl): New functions. (setup_string_decl): Simplify since it is only called once. (synth_module_prologue): Call build_class_template(); predefine 'id' and 'Class' as typedefs; rename 'temp_type' to 'type'; disable debug hooks for duration of function; fix GNU runtime messenger signatures to correspond to reality; forward-declare '__objc_exec_class' for the GNU runtime; call build_selector_table_decl(); in ObjC++ mode, generate 'extern "C" { ... }' wrappers around synthesized declarations; call build_protocol_template() and build_category_template(). (string_hash, string_eq): New functions. (objc_build_string_object): Check metaclass correctness only once; store string literals in hash table. (objc_build_constructor): Do not convert initializer elements; adjust for ObjC++ impedance mismatch. (build_objc_symtab_template): Call create_field_decl() instead of create_builtin_decl(). (init_objc_symtab): Add missing conversion to initializer element. (build_metadata_decl): Call start_var_decl() instead of define_decl(). (generate_objc_symtab_decl): Do not call build_category_template(); call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(). (build_module_descriptor): Call create_field_decl() instead of grokfield(); call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(); always mark module descriptor as used; move GNU runtime-specific functionality to build_module_initializer_routine(). (build_module_initializer_routine): New function, broken off of build_module_descriptor(). (objc_static_init_needed_p, objc_generate_static_init_call): New functions. (generate_static_references, generate_strings, build_selector_translation_table, generate_descriptor_table, generate_ivars_list, generate_dispatch_table, generate_category): Call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(); build a type directly instead of via groktypename(). (build_selector_reference_decl, build_selector_table_decl, build_class_reference_decl, build_protocol_reference, generate_objc_image_info): Call start_var_decl() instead of build_decl(). (build_selector_reference): For GNU runtime, do not call build_selector_reference_decl(). (build_selector, build_typed_selector_reference): Always convert result to the selector type. (add_objc_string): Cast return value to 'char *'. (build_method_prototype_template, build_selector_template, build_method_template): Use actual selector type for fields pointing to selectors. (finish_objc): For GNU runtime, call build_module_initializer_routine() after build_module_descriptor(). (generate_protocol_list, generate_shared_structures): Call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(); build a type directly instead of via groktypename(). (synth_id_with_class_suffix): Return a string. (get_arg_type_list): For instance methods, use the instance type for 'self'; do not call groktypename_in_parm_context(). (build_objc_string_decl): Squash redeclaration errors in ObjC++. (objc_is_class_name): Use OBJC_TYPE_NAME instead of TYPE_NAME; handle RECORD_TYPEs in ObjC as well as ObjC++. (objc_is_id): New function. (objc_is_object_ptr): Return the canonical type node. (objc_get_class_ivars): Simplify using get_class_ivars(). (get_class_ivars): Remove second parameter; create a fresh copy of the ivar list for each call; do not check for existence of super class. (objc_eh_runtime_type): Mark #ifndef OBJCPLUS. (objc_init_exceptions): When using SJLJ-style exceptions, require the use of '-fobjc-exceptions' flag; do not require it for DWARF-style exceptions. (objc_build_exc_ptr, next_sjlj_build_try_catch_finally): Use objc_object_type instead of objc_id_type. (objc_begin_catch_clause): Convert the incoming PARM_DECL into a VAR_DECL before placing it in the appropriate scope; do not call define_decl(); adjust call to c_begin_compound_stmt(); use objc_object_type instead of objc_id_type. (build_next_objc_exception_stuff): Call create_field_decl() instead of create_builtin_decl(); construct type directly instead of calling groktypename(); use OBJC_VOID_AT_END to mark end of function parameters. (build_private_template): Adjust call to get_class_ivars(); build a type directly instead of via groktypename(). (build_protocol_template, build_method_prototype_list_template, build_method_prototype_template, build_category_template, build_selector_template, build_class_template, build_super_template, build_ivar_template, build_ivar_list_template, build_method_list_template, build_method_template): Call create_field_decl() instead of grokfield(). (objc_method_parm_type): Do not call groktypename(). (generate_descriptor_table): Call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(). (generate_method_descriptors, build_protocol_initializer, generate_dispatch_tables, build_category_initializer, build_shared_structure_initializer): Do not call groktypename(). (generate_protocols): Call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(); do not call groktypename(). (error_with_ivar): Remove last parameter. (check_ivars): Do not iterate ovar CLASS_RAW_IVARS lists in addition to CLASS_IVARS lists; adjust calls to error_with_ivar(). (generate_ivar_lists): Convert one of the initializer elements; do not call groktypename(). (get_arg_type_list, start_method_def, gen_method_def): Account for new representation of variable arguments and '...' in Objective-C methods; add Objective-C++ impedance matching code. (is_objc_type_qualifier): Remove function. (adjust_type_for_id_default): Simplify; there is no longer a need to wade through declspecs. (lookup_interface, start_class, continue_class, finish_class, start_method_def, start_protocol, build_method_decl, objc_add_method, add_instance_variable, build_ivar_reference, is_ivar, is_private, get_super_receiver, objc_build_finally_epilogue): Make into static functions. (receiver_is_class_object): Use new IS_CLASS() macro. (objc_build_message_expr): Tweak ObjC++ message argument handling; call objc_finish_message_expr() instead of finish_message_expr(). (finish_message_expr): Rename to objc_finish_message_expr(); use OBJC_TYPE_NAME and OBJC_SET_TYPE_NAME macros instead of TYPE_NAME. call gen_type_name() instead of gen_declaration(); call objc_is_id() instead of using IS_ID and IS_CLASS; Use objc_class_name instead of calling get_identifier("Class"); handle CONVERT_EXPRs in receiver. (build_objc_method_call, warn_with_method): Do not call groktypename(). (build_ivar_reference): Call convert() instead of clobbering in a type. (hash_init): Initialize string_htab hash table. (add_instance_variable): Simplify parameter list; do not call grokfield(); do not populate CLASS_IVARS list. (start_class): Check for the existence of super class, if one was specified. (continue_class): Use CLASS_RAW_IVARS rather than CLASS_IVARS; do not call build_class_template(); adjust call to get_class_ivars(); call build_decl(), pushdecl() and finish_decl() instead of define_decl(). (finish_class): Call build_decl(), pushdecl() and finish_decl() instead of define_decl(). (add_protocols): Use PROTOCOL_BINFO_ELTS for the tree vector size. (start_protocol): Do not call build_protocol_template(); use PROTOCOL_BINFO_ELTS for the tree vector size. (encode_type_qualifiers): Do not handle the 'const' qualifier here. (encode_pointer): Encode 'const char *' as 'r*', for backwards compatibility. (encode_array): Use HOST_WIDE_INT_PRINT_DEC instead of "%ld". (encode_type): Handle the 'const' qualifier here. (objc_parmlist): New global variable, sued by objc_push_parm and objc_get_parm_info(). (objc_push_parm, objc_get_parm_info): New functions. (objc_expr_last): Remove function. (synth_self_and_ucmd_args): For instance methods, use the instance type for 'self'; call objc_push_parm() instead of push_parm_decl(). (start_method_def): Do not call push_scope(), declare_parm_level(), pop_scope(), push_parm_decl(), store_parm_decls() or objc_expr_last(); just use objc_push_parm() and objc_get_parm_info(). (comp_method_with_proto): Remove function. (objc_types_are_equivalent): Strip away indirections before comparing underlying types. (comp_proto_with_proto): Do not call groktypename(); types are no longer in raw declspec format. (objc_start_function): New function. (really_start_method): Call comp_proto_with_proto() instead of comp_method_with_proto(); call objc_start_function() instead of hand-crafting a function declarator. (continue_method_def, objc_expand_function_end): Remove functions. (get_super_receiver): Call objc_get_current_scope() instead of get_current_scope(); reference 'super_class' field (instead of 'class'). (finish_method_def): Rename to objc_finish_method_definition() and add a function decl parameter; move method encoding call from objc_expand_function_end(). (is_complex_decl, adorn_decl, gen_declarator, gen_declspecs, gen_declaration_1): Remove functions. (tmpbuf, RAW_DECLSPEC): Remove. (gen_declaration): Remove second parameter; simplify to deal with TYPE_P nodes instead of raw declspecs. (gen_type_name, gen_type_name_0): New functions. (gen_method_decl): Remove second parameter; call gen_type_name() instead of gen_declaration_1(). (dump_interface): Adjust calls to gen_declaration() and gen_method_decl(); do not allocate a separate string buffer. (init_objc): Allocate a larger string buffer to accommodate dump_interface(); adjust call to build_module_descriptor(); add call to build_module_initializer_routine() for the GNU runtime. (generate_classref_translation_entry): Do not call start_decl(); call finish_var_decl() instead of finish_decl(); call convert() instead of build_c_cast(). * objc-act.h (CLASS_OWN_IVARS): Remove accessor. (CLASS_BINFO_ELTS): Reduce from 6 to 5, now that CLASS_OWN_IVARS is gone. (OCTI_GNU_INIT_DECL, GNU_INIT_decl): New. (OCTI_ELLIPSIS_NODE, objc_ellipsis_node): Remove. (OCTI_ID_ID, id_type, objc_id_id): Rename to OCTI_ID_NAME, objc_object_type and objc_object_name, respectively. (OCTI_CLS_REF, OCTI_CLASS_NAME, objc_class_reference, objc_class_name): New. (IS_CLASS): New macro. (IS_ID, IS_SUPER): Robustify. (OCTI_EXECCLASS_DECL, execclass_decl): New. (finish_file, start_class, continue_class, finish_class, start_method_def, continue_method_def, finish_method_def, start_protocol, finish_protocol, objc_build_throw_stmt, objc_build_try_catch_finally_stmt, objc_build_synchronized_prologue, objc_build_synchronized_epilogue, objc_build_try_prologue, objc_build_try_epilogue, objc_build_catch_stmt, objc_build_catch_epilogue, objc_build_finally_prologue, objc_build_finally_epilogue, is_ivar, is_private, is_public, add_instance_variable, objc_add_method, get_super_receiver, objc_clear_super_receiver, get_class_ivars_from_name, get_class_reference, get_static_reference, get_object_reference, build_message_expr, finish_message_expr, build_selector_expr, build_ivar_reference, build_keyword_decl, build_method_decl, build_protocol_expr, build_objc_string_object, objc_declare_alias, objc_declare_class, objc_declare_protocols, objc_comptypes, objc_check_decl, build_encode_expr): Remove prototypes. (imp_count, cat_count): Make GGC-aware. (OBJC_SET_TYPE_NAME): New macro. From-SVN: r87168
2004-09-08 02:49:44 +02:00
{
return build_method_decl (objc_inherit_code, rettype, selector,
optparms, ellipsis);
Makefile.in (c-parse.o): Depend on $(C_COMMON_H). [gcc/ChangeLog] 2004-09-07 Ziemowit Laski <zlaski@apple.com> * Makefile.in (c-parse.o): Depend on $(C_COMMON_H). * c-parse.in: Include c-common.h instead of objc-act.h. (ivar_decl_list, ivar_decls, ivar_decl, ivars, ivar_declarator, myparms, myparm): Remove %type declarations. (methodtype, optparms, OBJC_TYPE_QUAL, objc_quals, objc_qual, objc_typename, objc_try_catch_stmt, optellipsis): Add %type declarations. (objc_inherit_code, objc_public_flag): Remove. (typespec_nonreserved_nonattr): Call objc_get_protocol_qualified_type() instead of get_static_reference() and get_protocol_reference(). (stmt_nocomp): Call grokparm() on @catch parameter. (objcdef): Move semantic action to objc_finish_implementation(). (classdef): Move semantic action to objc_start_class_interface(), objc_continue_interface(), objc_finish_interface(), objc_start_class_implementation(), objc_continue_implementation(), objc_start_category_interface() and objc_start_category_implementation(). (protocoldef): Move semantic actions to objc_start_protocol() and objc_finish_interface(). (ivar_decl_list): Remove nonterminal. (visibility_spec): Move semantic actions to objc_set_visibility(). (ivar_decls): Remove assignment to $$. (ivar_decl): Rephrase in terms of component_decl; call objc_add_instance_variable(). (ivars, ivar_declarator): Remove nonterminals. (opt_semi): New nonterminal. (methodtype): Remove semantic actions. (methoddef): Move semantic actions to objc_set_method_type(), objc_start_method_definition() and objc_finish_method_definition(). (methodproto): Move semantic actions to objc_set_method_type() and objc_add_method_declaration(). (methoddecl): Use objc_typename instead of typename; move semantic actions to objc_build_method_signature(). (optarglist, myxdecls, mydecl, myparms, myparm): Remove nonterminals. (optparmlist): Express in terms of optparms and optellipsis. (optparms, optellipsis, objc_qual, objc_quals, objc_typename): New nonterminals. (keyworddecl): Use objc_typename instead of typename. (rid_to_yy): Mark RID_IN, RID_OUT, RID_INOUT, RID_BYCOPY, RID_BYREF and RID_ONEWAY as returning OBJC_TYPE_QUAL to yyparse(). [gcc/objc/ChangeLog] 2004-09-07 Ziemowit Laski <zlaski@apple.com> * Make-lang.in (objc/objc-parse.o): Depend on $(C_COMMON_H) instead of objc/objc-act.h. (objc/objc-act.o): Depend on $(HASHTAB_H). * objc-act.c: Include hashtab.h; in ObjC++ mode, include cp-tree.h and objcp-decl.h instead of c-tree.h. (build_module_descriptor, get_class_ivars, synth_id_with_class_suffix, error_with_ivar, gen_method_decl, gen_declaration, setup_string_decl, build_protocol_template): Adjust prototypes. (build_module_initializer_routine, start_class, continue_class, finish_class, start_method_def, objc_start_function, start_protocol, build_method_decl, objc_add_method, add_instance_variable, build_ivar_reference, is_ivar, is_private, get_super_receiver, build_selector_table_decl, objc_push_parm, objc_get_parm_info, gen_type_name, gen_type_name_0, start_var_decl, finish_var_decl, create_field_decl): New prototypes. (objc_expand_function_end, comp_method_with_proto, objc_expr_last, gen_declaration_1, gen_declarator, is_complex_decl, adorn_decl, define_decl, create_builtin_decl, gen_declspecs): Remove prototypes. (TYPE_ID): Rename to OBJECT_TYPEDEF_NAME. (CLASS_TYPEDEF_NAME): New. (TAG_EXECCLASS): Change from a global variable to a #define. (TAG_RETURN_STRUCT): Delete. (TAG_GNUINIT): New, holds '__objc_gnu_init' name. (objc_inherit_code, objc_public_flag): New, moved from c-parse.in. (string_descriptor): New struct. (string_htab): New hash table. (string_hash, string_eq): New prototypes. (generate_struct_by_value_array): Call create_field_decl() instead of create_builtin_decl(). (objc_init): Do not initialize objc_ellipsis_node or TAG_EXECCLASS; In ObjC++ mode, call cxx_init() instead of c_objc_common_init(). (objc_finish_file): In ObjC++, call instantiate_pending_templates() and cp_finish_file(). (define_decl, get_static_reference, get_protocol_reference, create_builtin_decl): Remove functions. (objc_start_class_interface, objc_start_category_interface, objc_start_protocol, objc_continue_interface, objc_finish_interface, objc_start_class_implementation, objc_start_category_implementation, objc_continue_implementation, objc_finish_implementation, objc_set_visibility, objc_set_method_type, objc_build_method_signature, objc_add_method_declaration, objc_start_method_definition, objc_add_instance_variable, objc_get_protocol_qualified_type, create_field_decl, start_var_decl, finish_var_decl): New functions. (setup_string_decl): Simplify since it is only called once. (synth_module_prologue): Call build_class_template(); predefine 'id' and 'Class' as typedefs; rename 'temp_type' to 'type'; disable debug hooks for duration of function; fix GNU runtime messenger signatures to correspond to reality; forward-declare '__objc_exec_class' for the GNU runtime; call build_selector_table_decl(); in ObjC++ mode, generate 'extern "C" { ... }' wrappers around synthesized declarations; call build_protocol_template() and build_category_template(). (string_hash, string_eq): New functions. (objc_build_string_object): Check metaclass correctness only once; store string literals in hash table. (objc_build_constructor): Do not convert initializer elements; adjust for ObjC++ impedance mismatch. (build_objc_symtab_template): Call create_field_decl() instead of create_builtin_decl(). (init_objc_symtab): Add missing conversion to initializer element. (build_metadata_decl): Call start_var_decl() instead of define_decl(). (generate_objc_symtab_decl): Do not call build_category_template(); call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(). (build_module_descriptor): Call create_field_decl() instead of grokfield(); call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(); always mark module descriptor as used; move GNU runtime-specific functionality to build_module_initializer_routine(). (build_module_initializer_routine): New function, broken off of build_module_descriptor(). (objc_static_init_needed_p, objc_generate_static_init_call): New functions. (generate_static_references, generate_strings, build_selector_translation_table, generate_descriptor_table, generate_ivars_list, generate_dispatch_table, generate_category): Call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(); build a type directly instead of via groktypename(). (build_selector_reference_decl, build_selector_table_decl, build_class_reference_decl, build_protocol_reference, generate_objc_image_info): Call start_var_decl() instead of build_decl(). (build_selector_reference): For GNU runtime, do not call build_selector_reference_decl(). (build_selector, build_typed_selector_reference): Always convert result to the selector type. (add_objc_string): Cast return value to 'char *'. (build_method_prototype_template, build_selector_template, build_method_template): Use actual selector type for fields pointing to selectors. (finish_objc): For GNU runtime, call build_module_initializer_routine() after build_module_descriptor(). (generate_protocol_list, generate_shared_structures): Call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(); build a type directly instead of via groktypename(). (synth_id_with_class_suffix): Return a string. (get_arg_type_list): For instance methods, use the instance type for 'self'; do not call groktypename_in_parm_context(). (build_objc_string_decl): Squash redeclaration errors in ObjC++. (objc_is_class_name): Use OBJC_TYPE_NAME instead of TYPE_NAME; handle RECORD_TYPEs in ObjC as well as ObjC++. (objc_is_id): New function. (objc_is_object_ptr): Return the canonical type node. (objc_get_class_ivars): Simplify using get_class_ivars(). (get_class_ivars): Remove second parameter; create a fresh copy of the ivar list for each call; do not check for existence of super class. (objc_eh_runtime_type): Mark #ifndef OBJCPLUS. (objc_init_exceptions): When using SJLJ-style exceptions, require the use of '-fobjc-exceptions' flag; do not require it for DWARF-style exceptions. (objc_build_exc_ptr, next_sjlj_build_try_catch_finally): Use objc_object_type instead of objc_id_type. (objc_begin_catch_clause): Convert the incoming PARM_DECL into a VAR_DECL before placing it in the appropriate scope; do not call define_decl(); adjust call to c_begin_compound_stmt(); use objc_object_type instead of objc_id_type. (build_next_objc_exception_stuff): Call create_field_decl() instead of create_builtin_decl(); construct type directly instead of calling groktypename(); use OBJC_VOID_AT_END to mark end of function parameters. (build_private_template): Adjust call to get_class_ivars(); build a type directly instead of via groktypename(). (build_protocol_template, build_method_prototype_list_template, build_method_prototype_template, build_category_template, build_selector_template, build_class_template, build_super_template, build_ivar_template, build_ivar_list_template, build_method_list_template, build_method_template): Call create_field_decl() instead of grokfield(). (objc_method_parm_type): Do not call groktypename(). (generate_descriptor_table): Call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(). (generate_method_descriptors, build_protocol_initializer, generate_dispatch_tables, build_category_initializer, build_shared_structure_initializer): Do not call groktypename(). (generate_protocols): Call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(); do not call groktypename(). (error_with_ivar): Remove last parameter. (check_ivars): Do not iterate ovar CLASS_RAW_IVARS lists in addition to CLASS_IVARS lists; adjust calls to error_with_ivar(). (generate_ivar_lists): Convert one of the initializer elements; do not call groktypename(). (get_arg_type_list, start_method_def, gen_method_def): Account for new representation of variable arguments and '...' in Objective-C methods; add Objective-C++ impedance matching code. (is_objc_type_qualifier): Remove function. (adjust_type_for_id_default): Simplify; there is no longer a need to wade through declspecs. (lookup_interface, start_class, continue_class, finish_class, start_method_def, start_protocol, build_method_decl, objc_add_method, add_instance_variable, build_ivar_reference, is_ivar, is_private, get_super_receiver, objc_build_finally_epilogue): Make into static functions. (receiver_is_class_object): Use new IS_CLASS() macro. (objc_build_message_expr): Tweak ObjC++ message argument handling; call objc_finish_message_expr() instead of finish_message_expr(). (finish_message_expr): Rename to objc_finish_message_expr(); use OBJC_TYPE_NAME and OBJC_SET_TYPE_NAME macros instead of TYPE_NAME. call gen_type_name() instead of gen_declaration(); call objc_is_id() instead of using IS_ID and IS_CLASS; Use objc_class_name instead of calling get_identifier("Class"); handle CONVERT_EXPRs in receiver. (build_objc_method_call, warn_with_method): Do not call groktypename(). (build_ivar_reference): Call convert() instead of clobbering in a type. (hash_init): Initialize string_htab hash table. (add_instance_variable): Simplify parameter list; do not call grokfield(); do not populate CLASS_IVARS list. (start_class): Check for the existence of super class, if one was specified. (continue_class): Use CLASS_RAW_IVARS rather than CLASS_IVARS; do not call build_class_template(); adjust call to get_class_ivars(); call build_decl(), pushdecl() and finish_decl() instead of define_decl(). (finish_class): Call build_decl(), pushdecl() and finish_decl() instead of define_decl(). (add_protocols): Use PROTOCOL_BINFO_ELTS for the tree vector size. (start_protocol): Do not call build_protocol_template(); use PROTOCOL_BINFO_ELTS for the tree vector size. (encode_type_qualifiers): Do not handle the 'const' qualifier here. (encode_pointer): Encode 'const char *' as 'r*', for backwards compatibility. (encode_array): Use HOST_WIDE_INT_PRINT_DEC instead of "%ld". (encode_type): Handle the 'const' qualifier here. (objc_parmlist): New global variable, sued by objc_push_parm and objc_get_parm_info(). (objc_push_parm, objc_get_parm_info): New functions. (objc_expr_last): Remove function. (synth_self_and_ucmd_args): For instance methods, use the instance type for 'self'; call objc_push_parm() instead of push_parm_decl(). (start_method_def): Do not call push_scope(), declare_parm_level(), pop_scope(), push_parm_decl(), store_parm_decls() or objc_expr_last(); just use objc_push_parm() and objc_get_parm_info(). (comp_method_with_proto): Remove function. (objc_types_are_equivalent): Strip away indirections before comparing underlying types. (comp_proto_with_proto): Do not call groktypename(); types are no longer in raw declspec format. (objc_start_function): New function. (really_start_method): Call comp_proto_with_proto() instead of comp_method_with_proto(); call objc_start_function() instead of hand-crafting a function declarator. (continue_method_def, objc_expand_function_end): Remove functions. (get_super_receiver): Call objc_get_current_scope() instead of get_current_scope(); reference 'super_class' field (instead of 'class'). (finish_method_def): Rename to objc_finish_method_definition() and add a function decl parameter; move method encoding call from objc_expand_function_end(). (is_complex_decl, adorn_decl, gen_declarator, gen_declspecs, gen_declaration_1): Remove functions. (tmpbuf, RAW_DECLSPEC): Remove. (gen_declaration): Remove second parameter; simplify to deal with TYPE_P nodes instead of raw declspecs. (gen_type_name, gen_type_name_0): New functions. (gen_method_decl): Remove second parameter; call gen_type_name() instead of gen_declaration_1(). (dump_interface): Adjust calls to gen_declaration() and gen_method_decl(); do not allocate a separate string buffer. (init_objc): Allocate a larger string buffer to accommodate dump_interface(); adjust call to build_module_descriptor(); add call to build_module_initializer_routine() for the GNU runtime. (generate_classref_translation_entry): Do not call start_decl(); call finish_var_decl() instead of finish_decl(); call convert() instead of build_c_cast(). * objc-act.h (CLASS_OWN_IVARS): Remove accessor. (CLASS_BINFO_ELTS): Reduce from 6 to 5, now that CLASS_OWN_IVARS is gone. (OCTI_GNU_INIT_DECL, GNU_INIT_decl): New. (OCTI_ELLIPSIS_NODE, objc_ellipsis_node): Remove. (OCTI_ID_ID, id_type, objc_id_id): Rename to OCTI_ID_NAME, objc_object_type and objc_object_name, respectively. (OCTI_CLS_REF, OCTI_CLASS_NAME, objc_class_reference, objc_class_name): New. (IS_CLASS): New macro. (IS_ID, IS_SUPER): Robustify. (OCTI_EXECCLASS_DECL, execclass_decl): New. (finish_file, start_class, continue_class, finish_class, start_method_def, continue_method_def, finish_method_def, start_protocol, finish_protocol, objc_build_throw_stmt, objc_build_try_catch_finally_stmt, objc_build_synchronized_prologue, objc_build_synchronized_epilogue, objc_build_try_prologue, objc_build_try_epilogue, objc_build_catch_stmt, objc_build_catch_epilogue, objc_build_finally_prologue, objc_build_finally_epilogue, is_ivar, is_private, is_public, add_instance_variable, objc_add_method, get_super_receiver, objc_clear_super_receiver, get_class_ivars_from_name, get_class_reference, get_static_reference, get_object_reference, build_message_expr, finish_message_expr, build_selector_expr, build_ivar_reference, build_keyword_decl, build_method_decl, build_protocol_expr, build_objc_string_object, objc_declare_alias, objc_declare_class, objc_declare_protocols, objc_comptypes, objc_check_decl, build_encode_expr): Remove prototypes. (imp_count, cat_count): Make GGC-aware. (OBJC_SET_TYPE_NAME): New macro. From-SVN: r87168
2004-09-08 02:49:44 +02:00
}
void
objc_add_method_declaration (tree decl)
{
if (!objc_interface_context)
fatal_error ("method declaration not in @interface context");
objc_add_method (objc_interface_context,
decl,
objc_inherit_code == CLASS_METHOD_DECL);
}
void
objc_start_method_definition (tree decl)
{
if (!objc_implementation_context)
fatal_error ("method definition not in @implementation context");
objc_add_method (objc_implementation_context,
decl,
objc_inherit_code == CLASS_METHOD_DECL);
start_method_def (decl);
}
void
objc_add_instance_variable (tree decl)
{
(void) add_instance_variable (objc_ivar_context,
objc_public_flag,
decl);
}
/* Return 1 if IDENT is an ObjC/ObjC++ reserved keyword in the context of
an '@'. */
int
objc_is_reserved_word (tree ident)
{
unsigned char code = C_RID_CODE (ident);
return (OBJC_IS_AT_KEYWORD (code)
#ifdef OBJCPLUS
|| code == RID_CLASS || code == RID_PUBLIC
|| code == RID_PROTECTED || code == RID_PRIVATE
|| code == RID_TRY || code == RID_THROW || code == RID_CATCH
#endif
);
}
c-common.c (flag_objc_sjlj_exceptions): New. * c-common.c (flag_objc_sjlj_exceptions): New. * c-common.h (flag_objc_sjlj_exceptions): Declare. * c-opts.c (c_common_handle_option): Set it. (c_common_post_options): Handle interation of different objective-c exception and runtime switches. * c-decl.c (c_eh_initialized_p): New. (finish_decl): Use it instead of local eh_initialized_p. * c-parse.in (nested_function, notype_nested_function): Record the result of compstmt. (compstmt_or_error): Likewise. (compstmt): Don't add_stmt the result. (stmt): Don't return anything. Rewrite objc try and sync rules. (objc_try_stmt, objc_catch_list): Remove. (objc_catch_block, objc_finally_block): Remove. (objc_catch_prefix, objc_catch_clause, objc_opt_catch_list): New. (objc_try_catch_clause, objc_finally_clause): New. (objc_try_catch_stmt): Rewrite. * c-tree.h (c_eh_initialized_p): Declare. * c-opt (fobjc-sjlj-exceptions): New. * except.c (output_function_exception_table): Don't call cgraph on non-decls. * objc/objc-act.c (UTAG_EXCDATA_VAR, UTAG_CAUGHTEXC_VAR, UTAG_RETHROWEXC_VAR, UTAG_EVALONCE_VAR, struct val_stack, catch_count_stack, exc_binding_stack, if_nesting_count, blk_nesting_count, objc_enter_block, objc_exit_block, objc_declare_variable, 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): Remove. (objc_create_temporary_var, struct objc_try_context, cur_try_context, objc_eh_runtime_type, objc_init_exceptions, objc_build_exc_ptr, next_sjlj_build_try_exit, next_sjlj_build_enter_and_setjmp, next_sjlj_build_exc_extract, next_sjlj_build_catch_list, next_sjlj_build_try_catch_finally, objc_begin_try_stmt, objc_begin_catch_clause, objc_finish_catch_clause, objc_build_finally_clause, objc_finish_try_stmt, objc_build_synchronized): New. (objc_is_object_id, objc_is_class_id): New. (objc_comptypes): Use them. (build_next_objc_exception_stuff): Break NeXT sjlj out from build_objc_exception_stuff. (synth_module_prologue): Update to match. (objc_build_throw_stmt): Use cur_try_context to decide if we're in a @catch. * objc/objc-act.h: Update prototypes. (OCTI_EXCEPTION_BLK_STACK, objc_exception_block_stack): Remove. testsuite/ * objc.dg/sync-1.m: New. * objc.dg/try-catch-1.m: Don't force next runtime. * objc.dg/try-catch-3.m, objc.dg/try-catch-4.m: Likewise. * objc.dg/try-catch-2.m: Likewise. Enable everywhere. Remove shadowed catch clause. * objc.dg/try-catch-5.m: New. From-SVN: r83332
2004-06-18 03:20:53 +02:00
/* Return true if TYPE is 'id'. */
static bool
objc_is_object_id (tree type)
{
return OBJC_TYPE_NAME (type) == objc_object_id;
}
static bool
objc_is_class_id (tree type)
{
return OBJC_TYPE_NAME (type) == objc_class_id;
}
/* Construct a C struct with same name as CLASS, a base struct with tag
objc-act.c (objc_build_struct): New function. * objc-act.c (objc_build_struct): New function. (objc_derived_from_p): Likewise. (objc_build_component_ref): Likewise. (objc_copy_binfo): Likewise. (objc_xref_basetypes): Likewise. (objc_lookup_protocol): Likewise. (objc_compare_protocols): Likewise. (objc_volatilize_decl): Likewise. (encode_aggregate_fields): Likewise. (volatilized_hash): Likewise. (volatilized_eq): Likewise. (objc_compare_types): Likewise. (objc_type_quals_match): Likewise. (DERIVED_FROM_P): New ObjC macro, corresponding to C++ macro of same name. (get_class_ivars): Add second parameter indicating if entire hierarchy is desired. (struct volatilized_type): New type. (volatilized_htab): New hash table. (objc_types_compatible_p, objc_comptypes): Remove functions. (synth_module_prologue): Do not initialize 'unused_list'. (objc_get_class_reference): Fix ObjC++ impedance mismatches. (objc_declare_alias): Implement as a typedef. (objc_substitute_decl, objc_gimplify_expr): Reformat. (objc_get_class_ivars): Adjust call to get_class_ivars(). (next_sjlj_build_enter_and_setjmp, synth_forward_declarations, build_ivar_reference, get_super_receiver): Call objc_build_component_ref() instead of build_component_ref(). (objc_begin_catch_clause): Use DERIVED_FROM_P() instead of objc_comptypes(). (build_private_template): Call objc_build_struct() instead of start_struct() and finish_struct(). (hash_init): Initialize volatilized_htab. (objc_is_public): Adjust calls to objc_get_ivars(); adjust ObjC++ impedance mismatches. (encode_aggregate_within): Streamline by calling encode_aggregate_fields(). * objc-act.h (objc_types_compatible_p): Remove prototype. (OCTI_UNUSED_LIST, unused_list): Remove slot. * objc-lang.c (LANG_HOOKS_TYPES_COMPATIBLE_P): Remove. From-SVN: r100123
2005-05-25 00:21:01 +02:00
SUPER_NAME (if any), and FIELDS indicated. */
objc-act.c (objc_build_struct): New function. * objc-act.c (objc_build_struct): New function. (objc_derived_from_p): Likewise. (objc_build_component_ref): Likewise. (objc_copy_binfo): Likewise. (objc_xref_basetypes): Likewise. (objc_lookup_protocol): Likewise. (objc_compare_protocols): Likewise. (objc_volatilize_decl): Likewise. (encode_aggregate_fields): Likewise. (volatilized_hash): Likewise. (volatilized_eq): Likewise. (objc_compare_types): Likewise. (objc_type_quals_match): Likewise. (DERIVED_FROM_P): New ObjC macro, corresponding to C++ macro of same name. (get_class_ivars): Add second parameter indicating if entire hierarchy is desired. (struct volatilized_type): New type. (volatilized_htab): New hash table. (objc_types_compatible_p, objc_comptypes): Remove functions. (synth_module_prologue): Do not initialize 'unused_list'. (objc_get_class_reference): Fix ObjC++ impedance mismatches. (objc_declare_alias): Implement as a typedef. (objc_substitute_decl, objc_gimplify_expr): Reformat. (objc_get_class_ivars): Adjust call to get_class_ivars(). (next_sjlj_build_enter_and_setjmp, synth_forward_declarations, build_ivar_reference, get_super_receiver): Call objc_build_component_ref() instead of build_component_ref(). (objc_begin_catch_clause): Use DERIVED_FROM_P() instead of objc_comptypes(). (build_private_template): Call objc_build_struct() instead of start_struct() and finish_struct(). (hash_init): Initialize volatilized_htab. (objc_is_public): Adjust calls to objc_get_ivars(); adjust ObjC++ impedance mismatches. (encode_aggregate_within): Streamline by calling encode_aggregate_fields(). * objc-act.h (objc_types_compatible_p): Remove prototype. (OCTI_UNUSED_LIST, unused_list): Remove slot. * objc-lang.c (LANG_HOOKS_TYPES_COMPATIBLE_P): Remove. From-SVN: r100123
2005-05-25 00:21:01 +02:00
static tree
objc_build_struct (tree class, tree fields, tree super_name)
objc-act.c (objc_build_struct): New function. * objc-act.c (objc_build_struct): New function. (objc_derived_from_p): Likewise. (objc_build_component_ref): Likewise. (objc_copy_binfo): Likewise. (objc_xref_basetypes): Likewise. (objc_lookup_protocol): Likewise. (objc_compare_protocols): Likewise. (objc_volatilize_decl): Likewise. (encode_aggregate_fields): Likewise. (volatilized_hash): Likewise. (volatilized_eq): Likewise. (objc_compare_types): Likewise. (objc_type_quals_match): Likewise. (DERIVED_FROM_P): New ObjC macro, corresponding to C++ macro of same name. (get_class_ivars): Add second parameter indicating if entire hierarchy is desired. (struct volatilized_type): New type. (volatilized_htab): New hash table. (objc_types_compatible_p, objc_comptypes): Remove functions. (synth_module_prologue): Do not initialize 'unused_list'. (objc_get_class_reference): Fix ObjC++ impedance mismatches. (objc_declare_alias): Implement as a typedef. (objc_substitute_decl, objc_gimplify_expr): Reformat. (objc_get_class_ivars): Adjust call to get_class_ivars(). (next_sjlj_build_enter_and_setjmp, synth_forward_declarations, build_ivar_reference, get_super_receiver): Call objc_build_component_ref() instead of build_component_ref(). (objc_begin_catch_clause): Use DERIVED_FROM_P() instead of objc_comptypes(). (build_private_template): Call objc_build_struct() instead of start_struct() and finish_struct(). (hash_init): Initialize volatilized_htab. (objc_is_public): Adjust calls to objc_get_ivars(); adjust ObjC++ impedance mismatches. (encode_aggregate_within): Streamline by calling encode_aggregate_fields(). * objc-act.h (objc_types_compatible_p): Remove prototype. (OCTI_UNUSED_LIST, unused_list): Remove slot. * objc-lang.c (LANG_HOOKS_TYPES_COMPATIBLE_P): Remove. From-SVN: r100123
2005-05-25 00:21:01 +02:00
{
tree name = CLASS_NAME (class);
objc-act.c (objc_build_struct): New function. * objc-act.c (objc_build_struct): New function. (objc_derived_from_p): Likewise. (objc_build_component_ref): Likewise. (objc_copy_binfo): Likewise. (objc_xref_basetypes): Likewise. (objc_lookup_protocol): Likewise. (objc_compare_protocols): Likewise. (objc_volatilize_decl): Likewise. (encode_aggregate_fields): Likewise. (volatilized_hash): Likewise. (volatilized_eq): Likewise. (objc_compare_types): Likewise. (objc_type_quals_match): Likewise. (DERIVED_FROM_P): New ObjC macro, corresponding to C++ macro of same name. (get_class_ivars): Add second parameter indicating if entire hierarchy is desired. (struct volatilized_type): New type. (volatilized_htab): New hash table. (objc_types_compatible_p, objc_comptypes): Remove functions. (synth_module_prologue): Do not initialize 'unused_list'. (objc_get_class_reference): Fix ObjC++ impedance mismatches. (objc_declare_alias): Implement as a typedef. (objc_substitute_decl, objc_gimplify_expr): Reformat. (objc_get_class_ivars): Adjust call to get_class_ivars(). (next_sjlj_build_enter_and_setjmp, synth_forward_declarations, build_ivar_reference, get_super_receiver): Call objc_build_component_ref() instead of build_component_ref(). (objc_begin_catch_clause): Use DERIVED_FROM_P() instead of objc_comptypes(). (build_private_template): Call objc_build_struct() instead of start_struct() and finish_struct(). (hash_init): Initialize volatilized_htab. (objc_is_public): Adjust calls to objc_get_ivars(); adjust ObjC++ impedance mismatches. (encode_aggregate_within): Streamline by calling encode_aggregate_fields(). * objc-act.h (objc_types_compatible_p): Remove prototype. (OCTI_UNUSED_LIST, unused_list): Remove slot. * objc-lang.c (LANG_HOOKS_TYPES_COMPATIBLE_P): Remove. From-SVN: r100123
2005-05-25 00:21:01 +02:00
tree s = start_struct (RECORD_TYPE, name);
tree super = (super_name ? xref_tag (RECORD_TYPE, super_name) : NULL_TREE);
tree t, objc_info = NULL_TREE;
objc-act.c (objc_build_struct): New function. * objc-act.c (objc_build_struct): New function. (objc_derived_from_p): Likewise. (objc_build_component_ref): Likewise. (objc_copy_binfo): Likewise. (objc_xref_basetypes): Likewise. (objc_lookup_protocol): Likewise. (objc_compare_protocols): Likewise. (objc_volatilize_decl): Likewise. (encode_aggregate_fields): Likewise. (volatilized_hash): Likewise. (volatilized_eq): Likewise. (objc_compare_types): Likewise. (objc_type_quals_match): Likewise. (DERIVED_FROM_P): New ObjC macro, corresponding to C++ macro of same name. (get_class_ivars): Add second parameter indicating if entire hierarchy is desired. (struct volatilized_type): New type. (volatilized_htab): New hash table. (objc_types_compatible_p, objc_comptypes): Remove functions. (synth_module_prologue): Do not initialize 'unused_list'. (objc_get_class_reference): Fix ObjC++ impedance mismatches. (objc_declare_alias): Implement as a typedef. (objc_substitute_decl, objc_gimplify_expr): Reformat. (objc_get_class_ivars): Adjust call to get_class_ivars(). (next_sjlj_build_enter_and_setjmp, synth_forward_declarations, build_ivar_reference, get_super_receiver): Call objc_build_component_ref() instead of build_component_ref(). (objc_begin_catch_clause): Use DERIVED_FROM_P() instead of objc_comptypes(). (build_private_template): Call objc_build_struct() instead of start_struct() and finish_struct(). (hash_init): Initialize volatilized_htab. (objc_is_public): Adjust calls to objc_get_ivars(); adjust ObjC++ impedance mismatches. (encode_aggregate_within): Streamline by calling encode_aggregate_fields(). * objc-act.h (objc_types_compatible_p): Remove prototype. (OCTI_UNUSED_LIST, unused_list): Remove slot. * objc-lang.c (LANG_HOOKS_TYPES_COMPATIBLE_P): Remove. From-SVN: r100123
2005-05-25 00:21:01 +02:00
if (super)
{
/* Prepend a packed variant of the base class into the layout. This
is necessary to preserve ObjC ABI compatibility. */
tree base = build_decl (FIELD_DECL, NULL_TREE, super);
tree field = TYPE_FIELDS (super);
while (field && TREE_CHAIN (field)
&& TREE_CODE (TREE_CHAIN (field)) == FIELD_DECL)
field = TREE_CHAIN (field);
/* For ObjC ABI purposes, the "packed" size of a base class is the
the sum of the offset and the size (in bits) of the last field
in the class. */
objc-act.c (objc_build_struct): New function. * objc-act.c (objc_build_struct): New function. (objc_derived_from_p): Likewise. (objc_build_component_ref): Likewise. (objc_copy_binfo): Likewise. (objc_xref_basetypes): Likewise. (objc_lookup_protocol): Likewise. (objc_compare_protocols): Likewise. (objc_volatilize_decl): Likewise. (encode_aggregate_fields): Likewise. (volatilized_hash): Likewise. (volatilized_eq): Likewise. (objc_compare_types): Likewise. (objc_type_quals_match): Likewise. (DERIVED_FROM_P): New ObjC macro, corresponding to C++ macro of same name. (get_class_ivars): Add second parameter indicating if entire hierarchy is desired. (struct volatilized_type): New type. (volatilized_htab): New hash table. (objc_types_compatible_p, objc_comptypes): Remove functions. (synth_module_prologue): Do not initialize 'unused_list'. (objc_get_class_reference): Fix ObjC++ impedance mismatches. (objc_declare_alias): Implement as a typedef. (objc_substitute_decl, objc_gimplify_expr): Reformat. (objc_get_class_ivars): Adjust call to get_class_ivars(). (next_sjlj_build_enter_and_setjmp, synth_forward_declarations, build_ivar_reference, get_super_receiver): Call objc_build_component_ref() instead of build_component_ref(). (objc_begin_catch_clause): Use DERIVED_FROM_P() instead of objc_comptypes(). (build_private_template): Call objc_build_struct() instead of start_struct() and finish_struct(). (hash_init): Initialize volatilized_htab. (objc_is_public): Adjust calls to objc_get_ivars(); adjust ObjC++ impedance mismatches. (encode_aggregate_within): Streamline by calling encode_aggregate_fields(). * objc-act.h (objc_types_compatible_p): Remove prototype. (OCTI_UNUSED_LIST, unused_list): Remove slot. * objc-lang.c (LANG_HOOKS_TYPES_COMPATIBLE_P): Remove. From-SVN: r100123
2005-05-25 00:21:01 +02:00
DECL_SIZE (base)
= (field && TREE_CODE (field) == FIELD_DECL
? size_binop (PLUS_EXPR,
objc-act.c (objc_build_struct): New function. * objc-act.c (objc_build_struct): New function. (objc_derived_from_p): Likewise. (objc_build_component_ref): Likewise. (objc_copy_binfo): Likewise. (objc_xref_basetypes): Likewise. (objc_lookup_protocol): Likewise. (objc_compare_protocols): Likewise. (objc_volatilize_decl): Likewise. (encode_aggregate_fields): Likewise. (volatilized_hash): Likewise. (volatilized_eq): Likewise. (objc_compare_types): Likewise. (objc_type_quals_match): Likewise. (DERIVED_FROM_P): New ObjC macro, corresponding to C++ macro of same name. (get_class_ivars): Add second parameter indicating if entire hierarchy is desired. (struct volatilized_type): New type. (volatilized_htab): New hash table. (objc_types_compatible_p, objc_comptypes): Remove functions. (synth_module_prologue): Do not initialize 'unused_list'. (objc_get_class_reference): Fix ObjC++ impedance mismatches. (objc_declare_alias): Implement as a typedef. (objc_substitute_decl, objc_gimplify_expr): Reformat. (objc_get_class_ivars): Adjust call to get_class_ivars(). (next_sjlj_build_enter_and_setjmp, synth_forward_declarations, build_ivar_reference, get_super_receiver): Call objc_build_component_ref() instead of build_component_ref(). (objc_begin_catch_clause): Use DERIVED_FROM_P() instead of objc_comptypes(). (build_private_template): Call objc_build_struct() instead of start_struct() and finish_struct(). (hash_init): Initialize volatilized_htab. (objc_is_public): Adjust calls to objc_get_ivars(); adjust ObjC++ impedance mismatches. (encode_aggregate_within): Streamline by calling encode_aggregate_fields(). * objc-act.h (objc_types_compatible_p): Remove prototype. (OCTI_UNUSED_LIST, unused_list): Remove slot. * objc-lang.c (LANG_HOOKS_TYPES_COMPATIBLE_P): Remove. From-SVN: r100123
2005-05-25 00:21:01 +02:00
size_binop (PLUS_EXPR,
size_binop
(MULT_EXPR,
convert (bitsizetype,
DECL_FIELD_OFFSET (field)),
bitsize_int (BITS_PER_UNIT)),
DECL_FIELD_BIT_OFFSET (field)),
DECL_SIZE (field))
: bitsize_zero_node);
DECL_SIZE_UNIT (base)
= size_binop (FLOOR_DIV_EXPR, convert (sizetype, DECL_SIZE (base)),
size_int (BITS_PER_UNIT));
DECL_ARTIFICIAL (base) = 1;
DECL_ALIGN (base) = 1;
DECL_FIELD_CONTEXT (base) = s;
#ifdef OBJCPLUS
DECL_FIELD_IS_BASE (base) = 1;
if (fields)
TREE_NO_WARNING (fields) = 1; /* Suppress C++ ABI warnings -- we */
#endif /* are following the ObjC ABI here. */
TREE_CHAIN (base) = fields;
fields = base;
}
/* NB: Calling finish_struct() may cause type TYPE_LANG_SPECIFIC fields
in all variants of this RECORD_TYPE to be clobbered, but it is therein
that we store protocol conformance info (e.g., 'NSObject <MyProtocol>').
Hence, we must squirrel away the ObjC-specific information before calling
finish_struct(), and then reinstate it afterwards. */
for (t = TYPE_NEXT_VARIANT (s); t; t = TYPE_NEXT_VARIANT (t))
objc_info
= chainon (objc_info,
build_tree_list (NULL_TREE, TYPE_OBJC_INFO (t)));
/* Point the struct at its related Objective-C class. */
INIT_TYPE_OBJC_INFO (s);
TYPE_OBJC_INTERFACE (s) = class;
objc-act.c (objc_build_struct): New function. * objc-act.c (objc_build_struct): New function. (objc_derived_from_p): Likewise. (objc_build_component_ref): Likewise. (objc_copy_binfo): Likewise. (objc_xref_basetypes): Likewise. (objc_lookup_protocol): Likewise. (objc_compare_protocols): Likewise. (objc_volatilize_decl): Likewise. (encode_aggregate_fields): Likewise. (volatilized_hash): Likewise. (volatilized_eq): Likewise. (objc_compare_types): Likewise. (objc_type_quals_match): Likewise. (DERIVED_FROM_P): New ObjC macro, corresponding to C++ macro of same name. (get_class_ivars): Add second parameter indicating if entire hierarchy is desired. (struct volatilized_type): New type. (volatilized_htab): New hash table. (objc_types_compatible_p, objc_comptypes): Remove functions. (synth_module_prologue): Do not initialize 'unused_list'. (objc_get_class_reference): Fix ObjC++ impedance mismatches. (objc_declare_alias): Implement as a typedef. (objc_substitute_decl, objc_gimplify_expr): Reformat. (objc_get_class_ivars): Adjust call to get_class_ivars(). (next_sjlj_build_enter_and_setjmp, synth_forward_declarations, build_ivar_reference, get_super_receiver): Call objc_build_component_ref() instead of build_component_ref(). (objc_begin_catch_clause): Use DERIVED_FROM_P() instead of objc_comptypes(). (build_private_template): Call objc_build_struct() instead of start_struct() and finish_struct(). (hash_init): Initialize volatilized_htab. (objc_is_public): Adjust calls to objc_get_ivars(); adjust ObjC++ impedance mismatches. (encode_aggregate_within): Streamline by calling encode_aggregate_fields(). * objc-act.h (objc_types_compatible_p): Remove prototype. (OCTI_UNUSED_LIST, unused_list): Remove slot. * objc-lang.c (LANG_HOOKS_TYPES_COMPATIBLE_P): Remove. From-SVN: r100123
2005-05-25 00:21:01 +02:00
s = finish_struct (s, fields, NULL_TREE);
for (t = TYPE_NEXT_VARIANT (s); t;
t = TYPE_NEXT_VARIANT (t), objc_info = TREE_CHAIN (objc_info))
{
TYPE_OBJC_INFO (t) = TREE_VALUE (objc_info);
/* Replace the IDENTIFIER_NODE with an actual @interface. */
TYPE_OBJC_INTERFACE (t) = class;
}
objc-act.c (objc_build_struct): New function. * objc-act.c (objc_build_struct): New function. (objc_derived_from_p): Likewise. (objc_build_component_ref): Likewise. (objc_copy_binfo): Likewise. (objc_xref_basetypes): Likewise. (objc_lookup_protocol): Likewise. (objc_compare_protocols): Likewise. (objc_volatilize_decl): Likewise. (encode_aggregate_fields): Likewise. (volatilized_hash): Likewise. (volatilized_eq): Likewise. (objc_compare_types): Likewise. (objc_type_quals_match): Likewise. (DERIVED_FROM_P): New ObjC macro, corresponding to C++ macro of same name. (get_class_ivars): Add second parameter indicating if entire hierarchy is desired. (struct volatilized_type): New type. (volatilized_htab): New hash table. (objc_types_compatible_p, objc_comptypes): Remove functions. (synth_module_prologue): Do not initialize 'unused_list'. (objc_get_class_reference): Fix ObjC++ impedance mismatches. (objc_declare_alias): Implement as a typedef. (objc_substitute_decl, objc_gimplify_expr): Reformat. (objc_get_class_ivars): Adjust call to get_class_ivars(). (next_sjlj_build_enter_and_setjmp, synth_forward_declarations, build_ivar_reference, get_super_receiver): Call objc_build_component_ref() instead of build_component_ref(). (objc_begin_catch_clause): Use DERIVED_FROM_P() instead of objc_comptypes(). (build_private_template): Call objc_build_struct() instead of start_struct() and finish_struct(). (hash_init): Initialize volatilized_htab. (objc_is_public): Adjust calls to objc_get_ivars(); adjust ObjC++ impedance mismatches. (encode_aggregate_within): Streamline by calling encode_aggregate_fields(). * objc-act.h (objc_types_compatible_p): Remove prototype. (OCTI_UNUSED_LIST, unused_list): Remove slot. * objc-lang.c (LANG_HOOKS_TYPES_COMPATIBLE_P): Remove. From-SVN: r100123
2005-05-25 00:21:01 +02:00
/* Use TYPE_BINFO structures to point at the super class, if any. */
objc_xref_basetypes (s, super);
/* Mark this struct as a class template. */
CLASS_STATIC_TEMPLATE (class) = s;
objc-act.c (objc_build_struct): New function. * objc-act.c (objc_build_struct): New function. (objc_derived_from_p): Likewise. (objc_build_component_ref): Likewise. (objc_copy_binfo): Likewise. (objc_xref_basetypes): Likewise. (objc_lookup_protocol): Likewise. (objc_compare_protocols): Likewise. (objc_volatilize_decl): Likewise. (encode_aggregate_fields): Likewise. (volatilized_hash): Likewise. (volatilized_eq): Likewise. (objc_compare_types): Likewise. (objc_type_quals_match): Likewise. (DERIVED_FROM_P): New ObjC macro, corresponding to C++ macro of same name. (get_class_ivars): Add second parameter indicating if entire hierarchy is desired. (struct volatilized_type): New type. (volatilized_htab): New hash table. (objc_types_compatible_p, objc_comptypes): Remove functions. (synth_module_prologue): Do not initialize 'unused_list'. (objc_get_class_reference): Fix ObjC++ impedance mismatches. (objc_declare_alias): Implement as a typedef. (objc_substitute_decl, objc_gimplify_expr): Reformat. (objc_get_class_ivars): Adjust call to get_class_ivars(). (next_sjlj_build_enter_and_setjmp, synth_forward_declarations, build_ivar_reference, get_super_receiver): Call objc_build_component_ref() instead of build_component_ref(). (objc_begin_catch_clause): Use DERIVED_FROM_P() instead of objc_comptypes(). (build_private_template): Call objc_build_struct() instead of start_struct() and finish_struct(). (hash_init): Initialize volatilized_htab. (objc_is_public): Adjust calls to objc_get_ivars(); adjust ObjC++ impedance mismatches. (encode_aggregate_within): Streamline by calling encode_aggregate_fields(). * objc-act.h (objc_types_compatible_p): Remove prototype. (OCTI_UNUSED_LIST, unused_list): Remove slot. * objc-lang.c (LANG_HOOKS_TYPES_COMPATIBLE_P): Remove. From-SVN: r100123
2005-05-25 00:21:01 +02:00
return s;
}
/* Build a type differing from TYPE only in that TYPE_VOLATILE is set.
Unlike tree.c:build_qualified_type(), preserve TYPE_LANG_SPECIFIC in the
process. */
static tree
objc_build_volatilized_type (tree type)
{
tree t;
/* Check if we have not constructed the desired variant already. */
for (t = TYPE_MAIN_VARIANT (type); t; t = TYPE_NEXT_VARIANT (t))
{
/* The type qualifiers must (obviously) match up. */
if (!TYPE_VOLATILE (t)
|| (TYPE_READONLY (t) != TYPE_READONLY (type))
|| (TYPE_RESTRICT (t) != TYPE_RESTRICT (type)))
continue;
/* For pointer types, the pointees (and hence their TYPE_LANG_SPECIFIC
info, if any) must match up. */
if (POINTER_TYPE_P (t)
&& (TREE_TYPE (t) != TREE_TYPE (type)))
continue;
/* Everything matches up! */
return t;
}
/* Ok, we could not re-use any of the pre-existing variants. Create
a new one. */
t = build_variant_type_copy (type);
TYPE_VOLATILE (t) = 1;
c-common.c (c_common_nodes_and_builtins): Since variants of void_type_node get built before it is given a name... 2007-01-02 Douglas Gregor <doug.gregor@gmail.com> * c-common.c(c_common_nodes_and_builtins): Since variants of void_type_node get built before it is given a name, we need to give those variants the name, too. (complete_array_type): We need to work with the canonical main type of the array, from which we will build the qualified version. * params.def (PARAM_VERIFY_CANONICAL_TYPES): New. * print-tree.c (print_node): Display canonical type information for each type. * stor-layout.c (layout_type): When we don't know the alignment of a type for which we're building an array, we end up guessing wrong, so make the type require structural equality. * tree.c (make_node_stat): When we build a new type, it is its own canonical type. (build_type_attribute_qual_variant): When building an attribute variant, its canonical type is the non-attribute variant. However, if the attributes are target-dependent and they differ, we need to use structural equality checks for this type. (build_qualified_type): A qualified type is not equivalent to its unqualified variant; set the canonical type appropriately. (build_distinct_type_copy): When building a distinct type from another type, the new type is its own canonical type. (build_variant_type_copy): When building a new type variant, we assume that it is equivalent to the original type. (build_pointer_type_for_mode): When building a pointer type, also build a canonical type pointer. (build_reference_type_for_mode): When building a reference type, also build a canonical type reference. (build_index_type): When we can't hash an index type (e.g., because its maximum value is negative), the index type requires structural equality tests. (build_array_type): Build the canonical form of an array type. (build_function_type): Function types require structural equality, because they contain default arguments, attributes, etc. (build_method_type_directly): Ditto for method types. (build_offset_type): Build the canonical offset type. (build_complex_type): Build the canonical vector type. (make_vector_type): Build the canonical vector type. * tree.h (TYPE_CANONICAL): New. (TYPE_STRUCTURAL_EQUALITY_P): New. (SET_TYPE_STRUCTURAL_EQUALITY): New. (struct tree_type): Added "canonical" field. * params.h (VERIFY_CANONICAL_TYPES): New. * doc/c-tree.texi (TYPE_CANONICAL): Document. (TYPE_STRUCTURAL_EQUALITY_P): Document. (SET_TYPE_STRUCTURAL_EQUALITY): Document. * doc/invoke.texi (verify-canonical-types): Document --param parameter for verifying canonical types. 2007-01-02 Douglas Gregor <doug.gregor@gmail.com> * typeck.c (structural_comptypes): Renamed from "comptypes". (comptypes): Use canonical type information to perform fast type comparison. When VERIFY_CANONICAL_TYPES, verify that the canonical type comparison returns the same results as we would see from the current, structural check. Support COMPARE_STRUCTURAL when we need structural checks. * decl.c (typename_compare): Fix comment. (build_typename_type): TYPENAME_TYPE nodes require structural equality checks, because they resolve different based on the current class type. (make_unbound_class_template): UNBOUND_CLASS_TEMPLATE nodes require structural equality checks (for now). (build_ptrmemfunc_type): Build the canonical pointer to member function type. (compute_array_index_type): Whenever we build a new index type to represent the size of an array in a template, we need to mark this index type as requiring structural equality. This goes for arrays with value-dependent sizes with the current ABI, or all arrays with ABI-1. * tree.c (cplus_array_hash): New. (struct cplus_array_info): New. (cplus_array_compare): New. (cplus_array_htab): New. (build_cplus_array_type_1): Use a hash table to cache the array types we build. Build the canonical array type for each array type. (cp_build_qualified_type_real): When building a cv-qualified array type, use the hash table of array types and build canonical array types as necessary. (bind_template_template_parm): BOUND_TEMPLATE_TEMPLATE_PARM nodes use structural equality (for now). * cp-tree.h (COMPARE_STRUCTURAL): New. * pt.c (canonical_template_parms): New. (canonical_type_parameter): New. (process_template_parm): Find the canonical type parameter. (lookup_template_class): When we have named the primary template type, set the canonical type for our template class to the primary template type. If any of the template arguments need structural equality checks, the template class needs structural equality checks. (tsubst): When reducing the level of a template template parameter, we require structural equality tests for the resulting parameter because its template parameters have not had their types canonicalized. When reducing a template type parameter, find the canonical reduced type parameter. (any_template_arguments_need_structural_equality_p): New. 2007-01-02 Douglas Gregor <doug.gregor@gmail.com> * objc-act.c (objc_build_volatilized_type): Keep track of canonical types. (objc_get_protocol_qualified_type): Ditto. From-SVN: r120341
2007-01-02 15:23:26 +01:00
/* Set up the canonical type information. */
if (TYPE_STRUCTURAL_EQUALITY_P (type))
SET_TYPE_STRUCTURAL_EQUALITY (t);
else if (TYPE_CANONICAL (type) != type)
TYPE_CANONICAL (t) = objc_build_volatilized_type (TYPE_CANONICAL (type));
else
TYPE_CANONICAL (t) = t;
return t;
}
objc-act.c (objc_build_struct): New function. * objc-act.c (objc_build_struct): New function. (objc_derived_from_p): Likewise. (objc_build_component_ref): Likewise. (objc_copy_binfo): Likewise. (objc_xref_basetypes): Likewise. (objc_lookup_protocol): Likewise. (objc_compare_protocols): Likewise. (objc_volatilize_decl): Likewise. (encode_aggregate_fields): Likewise. (volatilized_hash): Likewise. (volatilized_eq): Likewise. (objc_compare_types): Likewise. (objc_type_quals_match): Likewise. (DERIVED_FROM_P): New ObjC macro, corresponding to C++ macro of same name. (get_class_ivars): Add second parameter indicating if entire hierarchy is desired. (struct volatilized_type): New type. (volatilized_htab): New hash table. (objc_types_compatible_p, objc_comptypes): Remove functions. (synth_module_prologue): Do not initialize 'unused_list'. (objc_get_class_reference): Fix ObjC++ impedance mismatches. (objc_declare_alias): Implement as a typedef. (objc_substitute_decl, objc_gimplify_expr): Reformat. (objc_get_class_ivars): Adjust call to get_class_ivars(). (next_sjlj_build_enter_and_setjmp, synth_forward_declarations, build_ivar_reference, get_super_receiver): Call objc_build_component_ref() instead of build_component_ref(). (objc_begin_catch_clause): Use DERIVED_FROM_P() instead of objc_comptypes(). (build_private_template): Call objc_build_struct() instead of start_struct() and finish_struct(). (hash_init): Initialize volatilized_htab. (objc_is_public): Adjust calls to objc_get_ivars(); adjust ObjC++ impedance mismatches. (encode_aggregate_within): Streamline by calling encode_aggregate_fields(). * objc-act.h (objc_types_compatible_p): Remove prototype. (OCTI_UNUSED_LIST, unused_list): Remove slot. * objc-lang.c (LANG_HOOKS_TYPES_COMPATIBLE_P): Remove. From-SVN: r100123
2005-05-25 00:21:01 +02:00
/* Mark DECL as being 'volatile' for purposes of Darwin
_setjmp()/_longjmp() exception handling. Called from
objc_mark_locals_volatile(). */
void
objc_volatilize_decl (tree decl)
{
/* Do not mess with variables that are 'static' or (already)
'volatile'. */
if (!TREE_THIS_VOLATILE (decl) && !TREE_STATIC (decl)
&& (TREE_CODE (decl) == VAR_DECL
|| TREE_CODE (decl) == PARM_DECL))
{
tree t = TREE_TYPE (decl);
struct volatilized_type key;
void **loc;
t = objc_build_volatilized_type (t);
objc-act.c (objc_build_struct): New function. * objc-act.c (objc_build_struct): New function. (objc_derived_from_p): Likewise. (objc_build_component_ref): Likewise. (objc_copy_binfo): Likewise. (objc_xref_basetypes): Likewise. (objc_lookup_protocol): Likewise. (objc_compare_protocols): Likewise. (objc_volatilize_decl): Likewise. (encode_aggregate_fields): Likewise. (volatilized_hash): Likewise. (volatilized_eq): Likewise. (objc_compare_types): Likewise. (objc_type_quals_match): Likewise. (DERIVED_FROM_P): New ObjC macro, corresponding to C++ macro of same name. (get_class_ivars): Add second parameter indicating if entire hierarchy is desired. (struct volatilized_type): New type. (volatilized_htab): New hash table. (objc_types_compatible_p, objc_comptypes): Remove functions. (synth_module_prologue): Do not initialize 'unused_list'. (objc_get_class_reference): Fix ObjC++ impedance mismatches. (objc_declare_alias): Implement as a typedef. (objc_substitute_decl, objc_gimplify_expr): Reformat. (objc_get_class_ivars): Adjust call to get_class_ivars(). (next_sjlj_build_enter_and_setjmp, synth_forward_declarations, build_ivar_reference, get_super_receiver): Call objc_build_component_ref() instead of build_component_ref(). (objc_begin_catch_clause): Use DERIVED_FROM_P() instead of objc_comptypes(). (build_private_template): Call objc_build_struct() instead of start_struct() and finish_struct(). (hash_init): Initialize volatilized_htab. (objc_is_public): Adjust calls to objc_get_ivars(); adjust ObjC++ impedance mismatches. (encode_aggregate_within): Streamline by calling encode_aggregate_fields(). * objc-act.h (objc_types_compatible_p): Remove prototype. (OCTI_UNUSED_LIST, unused_list): Remove slot. * objc-lang.c (LANG_HOOKS_TYPES_COMPATIBLE_P): Remove. From-SVN: r100123
2005-05-25 00:21:01 +02:00
key.type = t;
loc = htab_find_slot (volatilized_htab, &key, INSERT);
if (!*loc)
{
*loc = ggc_alloc (sizeof (key));
((struct volatilized_type *) *loc)->type = t;
}
TREE_TYPE (decl) = t;
TREE_THIS_VOLATILE (decl) = 1;
TREE_SIDE_EFFECTS (decl) = 1;
DECL_REGISTER (decl) = 0;
#ifndef OBJCPLUS
C_DECL_REGISTER (decl) = 0;
#endif
}
}
/* Check if protocol PROTO is adopted (directly or indirectly) by class CLS
(including its categoreis and superclasses) or by object type TYP.
Issue a warning if PROTO is not adopted anywhere and WARN is set. */
static bool
objc_lookup_protocol (tree proto, tree cls, tree typ, bool warn)
{
objc-act.c (objc_build_struct): New function. * objc-act.c (objc_build_struct): New function. (objc_derived_from_p): Likewise. (objc_build_component_ref): Likewise. (objc_copy_binfo): Likewise. (objc_xref_basetypes): Likewise. (objc_lookup_protocol): Likewise. (objc_compare_protocols): Likewise. (objc_volatilize_decl): Likewise. (encode_aggregate_fields): Likewise. (volatilized_hash): Likewise. (volatilized_eq): Likewise. (objc_compare_types): Likewise. (objc_type_quals_match): Likewise. (DERIVED_FROM_P): New ObjC macro, corresponding to C++ macro of same name. (get_class_ivars): Add second parameter indicating if entire hierarchy is desired. (struct volatilized_type): New type. (volatilized_htab): New hash table. (objc_types_compatible_p, objc_comptypes): Remove functions. (synth_module_prologue): Do not initialize 'unused_list'. (objc_get_class_reference): Fix ObjC++ impedance mismatches. (objc_declare_alias): Implement as a typedef. (objc_substitute_decl, objc_gimplify_expr): Reformat. (objc_get_class_ivars): Adjust call to get_class_ivars(). (next_sjlj_build_enter_and_setjmp, synth_forward_declarations, build_ivar_reference, get_super_receiver): Call objc_build_component_ref() instead of build_component_ref(). (objc_begin_catch_clause): Use DERIVED_FROM_P() instead of objc_comptypes(). (build_private_template): Call objc_build_struct() instead of start_struct() and finish_struct(). (hash_init): Initialize volatilized_htab. (objc_is_public): Adjust calls to objc_get_ivars(); adjust ObjC++ impedance mismatches. (encode_aggregate_within): Streamline by calling encode_aggregate_fields(). * objc-act.h (objc_types_compatible_p): Remove prototype. (OCTI_UNUSED_LIST, unused_list): Remove slot. * objc-lang.c (LANG_HOOKS_TYPES_COMPATIBLE_P): Remove. From-SVN: r100123
2005-05-25 00:21:01 +02:00
bool class_type = (cls != NULL_TREE);
objc-act.c (objc_build_struct): New function. * objc-act.c (objc_build_struct): New function. (objc_derived_from_p): Likewise. (objc_build_component_ref): Likewise. (objc_copy_binfo): Likewise. (objc_xref_basetypes): Likewise. (objc_lookup_protocol): Likewise. (objc_compare_protocols): Likewise. (objc_volatilize_decl): Likewise. (encode_aggregate_fields): Likewise. (volatilized_hash): Likewise. (volatilized_eq): Likewise. (objc_compare_types): Likewise. (objc_type_quals_match): Likewise. (DERIVED_FROM_P): New ObjC macro, corresponding to C++ macro of same name. (get_class_ivars): Add second parameter indicating if entire hierarchy is desired. (struct volatilized_type): New type. (volatilized_htab): New hash table. (objc_types_compatible_p, objc_comptypes): Remove functions. (synth_module_prologue): Do not initialize 'unused_list'. (objc_get_class_reference): Fix ObjC++ impedance mismatches. (objc_declare_alias): Implement as a typedef. (objc_substitute_decl, objc_gimplify_expr): Reformat. (objc_get_class_ivars): Adjust call to get_class_ivars(). (next_sjlj_build_enter_and_setjmp, synth_forward_declarations, build_ivar_reference, get_super_receiver): Call objc_build_component_ref() instead of build_component_ref(). (objc_begin_catch_clause): Use DERIVED_FROM_P() instead of objc_comptypes(). (build_private_template): Call objc_build_struct() instead of start_struct() and finish_struct(). (hash_init): Initialize volatilized_htab. (objc_is_public): Adjust calls to objc_get_ivars(); adjust ObjC++ impedance mismatches. (encode_aggregate_within): Streamline by calling encode_aggregate_fields(). * objc-act.h (objc_types_compatible_p): Remove prototype. (OCTI_UNUSED_LIST, unused_list): Remove slot. * objc-lang.c (LANG_HOOKS_TYPES_COMPATIBLE_P): Remove. From-SVN: r100123
2005-05-25 00:21:01 +02:00
while (cls)
{
objc-act.c (objc_build_struct): New function. * objc-act.c (objc_build_struct): New function. (objc_derived_from_p): Likewise. (objc_build_component_ref): Likewise. (objc_copy_binfo): Likewise. (objc_xref_basetypes): Likewise. (objc_lookup_protocol): Likewise. (objc_compare_protocols): Likewise. (objc_volatilize_decl): Likewise. (encode_aggregate_fields): Likewise. (volatilized_hash): Likewise. (volatilized_eq): Likewise. (objc_compare_types): Likewise. (objc_type_quals_match): Likewise. (DERIVED_FROM_P): New ObjC macro, corresponding to C++ macro of same name. (get_class_ivars): Add second parameter indicating if entire hierarchy is desired. (struct volatilized_type): New type. (volatilized_htab): New hash table. (objc_types_compatible_p, objc_comptypes): Remove functions. (synth_module_prologue): Do not initialize 'unused_list'. (objc_get_class_reference): Fix ObjC++ impedance mismatches. (objc_declare_alias): Implement as a typedef. (objc_substitute_decl, objc_gimplify_expr): Reformat. (objc_get_class_ivars): Adjust call to get_class_ivars(). (next_sjlj_build_enter_and_setjmp, synth_forward_declarations, build_ivar_reference, get_super_receiver): Call objc_build_component_ref() instead of build_component_ref(). (objc_begin_catch_clause): Use DERIVED_FROM_P() instead of objc_comptypes(). (build_private_template): Call objc_build_struct() instead of start_struct() and finish_struct(). (hash_init): Initialize volatilized_htab. (objc_is_public): Adjust calls to objc_get_ivars(); adjust ObjC++ impedance mismatches. (encode_aggregate_within): Streamline by calling encode_aggregate_fields(). * objc-act.h (objc_types_compatible_p): Remove prototype. (OCTI_UNUSED_LIST, unused_list): Remove slot. * objc-lang.c (LANG_HOOKS_TYPES_COMPATIBLE_P): Remove. From-SVN: r100123
2005-05-25 00:21:01 +02:00
tree c;
/* Check protocols adopted by the class and its categories. */
for (c = cls; c; c = CLASS_CATEGORY_LIST (c))
{
if (lookup_protocol_in_reflist (CLASS_PROTOCOL_LIST (c), proto))
return true;
}
/* Repeat for superclasses. */
cls = lookup_interface (CLASS_SUPER_NAME (cls));
}
objc-act.c (objc_build_struct): New function. * objc-act.c (objc_build_struct): New function. (objc_derived_from_p): Likewise. (objc_build_component_ref): Likewise. (objc_copy_binfo): Likewise. (objc_xref_basetypes): Likewise. (objc_lookup_protocol): Likewise. (objc_compare_protocols): Likewise. (objc_volatilize_decl): Likewise. (encode_aggregate_fields): Likewise. (volatilized_hash): Likewise. (volatilized_eq): Likewise. (objc_compare_types): Likewise. (objc_type_quals_match): Likewise. (DERIVED_FROM_P): New ObjC macro, corresponding to C++ macro of same name. (get_class_ivars): Add second parameter indicating if entire hierarchy is desired. (struct volatilized_type): New type. (volatilized_htab): New hash table. (objc_types_compatible_p, objc_comptypes): Remove functions. (synth_module_prologue): Do not initialize 'unused_list'. (objc_get_class_reference): Fix ObjC++ impedance mismatches. (objc_declare_alias): Implement as a typedef. (objc_substitute_decl, objc_gimplify_expr): Reformat. (objc_get_class_ivars): Adjust call to get_class_ivars(). (next_sjlj_build_enter_and_setjmp, synth_forward_declarations, build_ivar_reference, get_super_receiver): Call objc_build_component_ref() instead of build_component_ref(). (objc_begin_catch_clause): Use DERIVED_FROM_P() instead of objc_comptypes(). (build_private_template): Call objc_build_struct() instead of start_struct() and finish_struct(). (hash_init): Initialize volatilized_htab. (objc_is_public): Adjust calls to objc_get_ivars(); adjust ObjC++ impedance mismatches. (encode_aggregate_within): Streamline by calling encode_aggregate_fields(). * objc-act.h (objc_types_compatible_p): Remove prototype. (OCTI_UNUSED_LIST, unused_list): Remove slot. * objc-lang.c (LANG_HOOKS_TYPES_COMPATIBLE_P): Remove. From-SVN: r100123
2005-05-25 00:21:01 +02:00
/* Check for any protocols attached directly to the object type. */
if (TYPE_HAS_OBJC_INFO (typ))
{
objc-act.c (objc_build_struct): New function. * objc-act.c (objc_build_struct): New function. (objc_derived_from_p): Likewise. (objc_build_component_ref): Likewise. (objc_copy_binfo): Likewise. (objc_xref_basetypes): Likewise. (objc_lookup_protocol): Likewise. (objc_compare_protocols): Likewise. (objc_volatilize_decl): Likewise. (encode_aggregate_fields): Likewise. (volatilized_hash): Likewise. (volatilized_eq): Likewise. (objc_compare_types): Likewise. (objc_type_quals_match): Likewise. (DERIVED_FROM_P): New ObjC macro, corresponding to C++ macro of same name. (get_class_ivars): Add second parameter indicating if entire hierarchy is desired. (struct volatilized_type): New type. (volatilized_htab): New hash table. (objc_types_compatible_p, objc_comptypes): Remove functions. (synth_module_prologue): Do not initialize 'unused_list'. (objc_get_class_reference): Fix ObjC++ impedance mismatches. (objc_declare_alias): Implement as a typedef. (objc_substitute_decl, objc_gimplify_expr): Reformat. (objc_get_class_ivars): Adjust call to get_class_ivars(). (next_sjlj_build_enter_and_setjmp, synth_forward_declarations, build_ivar_reference, get_super_receiver): Call objc_build_component_ref() instead of build_component_ref(). (objc_begin_catch_clause): Use DERIVED_FROM_P() instead of objc_comptypes(). (build_private_template): Call objc_build_struct() instead of start_struct() and finish_struct(). (hash_init): Initialize volatilized_htab. (objc_is_public): Adjust calls to objc_get_ivars(); adjust ObjC++ impedance mismatches. (encode_aggregate_within): Streamline by calling encode_aggregate_fields(). * objc-act.h (objc_types_compatible_p): Remove prototype. (OCTI_UNUSED_LIST, unused_list): Remove slot. * objc-lang.c (LANG_HOOKS_TYPES_COMPATIBLE_P): Remove. From-SVN: r100123
2005-05-25 00:21:01 +02:00
if (lookup_protocol_in_reflist (TYPE_OBJC_PROTOCOL_LIST (typ), proto))
return true;
}
if (warn)
{
strcpy (errbuf, class_type ? "class \'" : "type \'");
gen_type_name_0 (class_type ? typ : TYPE_POINTER_TO (typ));
strcat (errbuf, "\' does not ");
/* NB: Types 'id' and 'Class' cannot reasonably be described as
"implementing" a given protocol, since they do not have an
implementation. */
strcat (errbuf, class_type ? "implement" : "conform to");
strcat (errbuf, " the \'");
strcat (errbuf, IDENTIFIER_POINTER (PROTOCOL_NAME (proto)));
strcat (errbuf, "\' protocol");
warning (0, errbuf);
}
objc-act.c (objc_build_struct): New function. * objc-act.c (objc_build_struct): New function. (objc_derived_from_p): Likewise. (objc_build_component_ref): Likewise. (objc_copy_binfo): Likewise. (objc_xref_basetypes): Likewise. (objc_lookup_protocol): Likewise. (objc_compare_protocols): Likewise. (objc_volatilize_decl): Likewise. (encode_aggregate_fields): Likewise. (volatilized_hash): Likewise. (volatilized_eq): Likewise. (objc_compare_types): Likewise. (objc_type_quals_match): Likewise. (DERIVED_FROM_P): New ObjC macro, corresponding to C++ macro of same name. (get_class_ivars): Add second parameter indicating if entire hierarchy is desired. (struct volatilized_type): New type. (volatilized_htab): New hash table. (objc_types_compatible_p, objc_comptypes): Remove functions. (synth_module_prologue): Do not initialize 'unused_list'. (objc_get_class_reference): Fix ObjC++ impedance mismatches. (objc_declare_alias): Implement as a typedef. (objc_substitute_decl, objc_gimplify_expr): Reformat. (objc_get_class_ivars): Adjust call to get_class_ivars(). (next_sjlj_build_enter_and_setjmp, synth_forward_declarations, build_ivar_reference, get_super_receiver): Call objc_build_component_ref() instead of build_component_ref(). (objc_begin_catch_clause): Use DERIVED_FROM_P() instead of objc_comptypes(). (build_private_template): Call objc_build_struct() instead of start_struct() and finish_struct(). (hash_init): Initialize volatilized_htab. (objc_is_public): Adjust calls to objc_get_ivars(); adjust ObjC++ impedance mismatches. (encode_aggregate_within): Streamline by calling encode_aggregate_fields(). * objc-act.h (objc_types_compatible_p): Remove prototype. (OCTI_UNUSED_LIST, unused_list): Remove slot. * objc-lang.c (LANG_HOOKS_TYPES_COMPATIBLE_P): Remove. From-SVN: r100123
2005-05-25 00:21:01 +02:00
return false;
}
objc-act.c (objc_build_struct): New function. * objc-act.c (objc_build_struct): New function. (objc_derived_from_p): Likewise. (objc_build_component_ref): Likewise. (objc_copy_binfo): Likewise. (objc_xref_basetypes): Likewise. (objc_lookup_protocol): Likewise. (objc_compare_protocols): Likewise. (objc_volatilize_decl): Likewise. (encode_aggregate_fields): Likewise. (volatilized_hash): Likewise. (volatilized_eq): Likewise. (objc_compare_types): Likewise. (objc_type_quals_match): Likewise. (DERIVED_FROM_P): New ObjC macro, corresponding to C++ macro of same name. (get_class_ivars): Add second parameter indicating if entire hierarchy is desired. (struct volatilized_type): New type. (volatilized_htab): New hash table. (objc_types_compatible_p, objc_comptypes): Remove functions. (synth_module_prologue): Do not initialize 'unused_list'. (objc_get_class_reference): Fix ObjC++ impedance mismatches. (objc_declare_alias): Implement as a typedef. (objc_substitute_decl, objc_gimplify_expr): Reformat. (objc_get_class_ivars): Adjust call to get_class_ivars(). (next_sjlj_build_enter_and_setjmp, synth_forward_declarations, build_ivar_reference, get_super_receiver): Call objc_build_component_ref() instead of build_component_ref(). (objc_begin_catch_clause): Use DERIVED_FROM_P() instead of objc_comptypes(). (build_private_template): Call objc_build_struct() instead of start_struct() and finish_struct(). (hash_init): Initialize volatilized_htab. (objc_is_public): Adjust calls to objc_get_ivars(); adjust ObjC++ impedance mismatches. (encode_aggregate_within): Streamline by calling encode_aggregate_fields(). * objc-act.h (objc_types_compatible_p): Remove prototype. (OCTI_UNUSED_LIST, unused_list): Remove slot. * objc-lang.c (LANG_HOOKS_TYPES_COMPATIBLE_P): Remove. From-SVN: r100123
2005-05-25 00:21:01 +02:00
/* Check if class RCLS and instance struct type RTYP conform to at least the
same protocols that LCLS and LTYP conform to. */
static bool
objc_compare_protocols (tree lcls, tree ltyp, tree rcls, tree rtyp, bool warn)
{
tree p;
bool have_lproto = false;
while (lcls)
{
/* NB: We do _not_ look at categories defined for LCLS; these may or
may not get loaded in, and therefore it is unreasonable to require
that RCLS/RTYP must implement any of their protocols. */
for (p = CLASS_PROTOCOL_LIST (lcls); p; p = TREE_CHAIN (p))
{
have_lproto = true;
objc-act.c (objc_build_struct): New function. * objc-act.c (objc_build_struct): New function. (objc_derived_from_p): Likewise. (objc_build_component_ref): Likewise. (objc_copy_binfo): Likewise. (objc_xref_basetypes): Likewise. (objc_lookup_protocol): Likewise. (objc_compare_protocols): Likewise. (objc_volatilize_decl): Likewise. (encode_aggregate_fields): Likewise. (volatilized_hash): Likewise. (volatilized_eq): Likewise. (objc_compare_types): Likewise. (objc_type_quals_match): Likewise. (DERIVED_FROM_P): New ObjC macro, corresponding to C++ macro of same name. (get_class_ivars): Add second parameter indicating if entire hierarchy is desired. (struct volatilized_type): New type. (volatilized_htab): New hash table. (objc_types_compatible_p, objc_comptypes): Remove functions. (synth_module_prologue): Do not initialize 'unused_list'. (objc_get_class_reference): Fix ObjC++ impedance mismatches. (objc_declare_alias): Implement as a typedef. (objc_substitute_decl, objc_gimplify_expr): Reformat. (objc_get_class_ivars): Adjust call to get_class_ivars(). (next_sjlj_build_enter_and_setjmp, synth_forward_declarations, build_ivar_reference, get_super_receiver): Call objc_build_component_ref() instead of build_component_ref(). (objc_begin_catch_clause): Use DERIVED_FROM_P() instead of objc_comptypes(). (build_private_template): Call objc_build_struct() instead of start_struct() and finish_struct(). (hash_init): Initialize volatilized_htab. (objc_is_public): Adjust calls to objc_get_ivars(); adjust ObjC++ impedance mismatches. (encode_aggregate_within): Streamline by calling encode_aggregate_fields(). * objc-act.h (objc_types_compatible_p): Remove prototype. (OCTI_UNUSED_LIST, unused_list): Remove slot. * objc-lang.c (LANG_HOOKS_TYPES_COMPATIBLE_P): Remove. From-SVN: r100123
2005-05-25 00:21:01 +02:00
if (!objc_lookup_protocol (TREE_VALUE (p), rcls, rtyp, warn))
return warn;
}
objc-act.c (objc_build_struct): New function. * objc-act.c (objc_build_struct): New function. (objc_derived_from_p): Likewise. (objc_build_component_ref): Likewise. (objc_copy_binfo): Likewise. (objc_xref_basetypes): Likewise. (objc_lookup_protocol): Likewise. (objc_compare_protocols): Likewise. (objc_volatilize_decl): Likewise. (encode_aggregate_fields): Likewise. (volatilized_hash): Likewise. (volatilized_eq): Likewise. (objc_compare_types): Likewise. (objc_type_quals_match): Likewise. (DERIVED_FROM_P): New ObjC macro, corresponding to C++ macro of same name. (get_class_ivars): Add second parameter indicating if entire hierarchy is desired. (struct volatilized_type): New type. (volatilized_htab): New hash table. (objc_types_compatible_p, objc_comptypes): Remove functions. (synth_module_prologue): Do not initialize 'unused_list'. (objc_get_class_reference): Fix ObjC++ impedance mismatches. (objc_declare_alias): Implement as a typedef. (objc_substitute_decl, objc_gimplify_expr): Reformat. (objc_get_class_ivars): Adjust call to get_class_ivars(). (next_sjlj_build_enter_and_setjmp, synth_forward_declarations, build_ivar_reference, get_super_receiver): Call objc_build_component_ref() instead of build_component_ref(). (objc_begin_catch_clause): Use DERIVED_FROM_P() instead of objc_comptypes(). (build_private_template): Call objc_build_struct() instead of start_struct() and finish_struct(). (hash_init): Initialize volatilized_htab. (objc_is_public): Adjust calls to objc_get_ivars(); adjust ObjC++ impedance mismatches. (encode_aggregate_within): Streamline by calling encode_aggregate_fields(). * objc-act.h (objc_types_compatible_p): Remove prototype. (OCTI_UNUSED_LIST, unused_list): Remove slot. * objc-lang.c (LANG_HOOKS_TYPES_COMPATIBLE_P): Remove. From-SVN: r100123
2005-05-25 00:21:01 +02:00
/* Repeat for superclasses. */
lcls = lookup_interface (CLASS_SUPER_NAME (lcls));
}
objc-act.c (objc_build_struct): New function. * objc-act.c (objc_build_struct): New function. (objc_derived_from_p): Likewise. (objc_build_component_ref): Likewise. (objc_copy_binfo): Likewise. (objc_xref_basetypes): Likewise. (objc_lookup_protocol): Likewise. (objc_compare_protocols): Likewise. (objc_volatilize_decl): Likewise. (encode_aggregate_fields): Likewise. (volatilized_hash): Likewise. (volatilized_eq): Likewise. (objc_compare_types): Likewise. (objc_type_quals_match): Likewise. (DERIVED_FROM_P): New ObjC macro, corresponding to C++ macro of same name. (get_class_ivars): Add second parameter indicating if entire hierarchy is desired. (struct volatilized_type): New type. (volatilized_htab): New hash table. (objc_types_compatible_p, objc_comptypes): Remove functions. (synth_module_prologue): Do not initialize 'unused_list'. (objc_get_class_reference): Fix ObjC++ impedance mismatches. (objc_declare_alias): Implement as a typedef. (objc_substitute_decl, objc_gimplify_expr): Reformat. (objc_get_class_ivars): Adjust call to get_class_ivars(). (next_sjlj_build_enter_and_setjmp, synth_forward_declarations, build_ivar_reference, get_super_receiver): Call objc_build_component_ref() instead of build_component_ref(). (objc_begin_catch_clause): Use DERIVED_FROM_P() instead of objc_comptypes(). (build_private_template): Call objc_build_struct() instead of start_struct() and finish_struct(). (hash_init): Initialize volatilized_htab. (objc_is_public): Adjust calls to objc_get_ivars(); adjust ObjC++ impedance mismatches. (encode_aggregate_within): Streamline by calling encode_aggregate_fields(). * objc-act.h (objc_types_compatible_p): Remove prototype. (OCTI_UNUSED_LIST, unused_list): Remove slot. * objc-lang.c (LANG_HOOKS_TYPES_COMPATIBLE_P): Remove. From-SVN: r100123
2005-05-25 00:21:01 +02:00
/* Check for any protocols attached directly to the object type. */
if (TYPE_HAS_OBJC_INFO (ltyp))
{
for (p = TYPE_OBJC_PROTOCOL_LIST (ltyp); p; p = TREE_CHAIN (p))
{
have_lproto = true;
objc-act.c (objc_build_struct): New function. * objc-act.c (objc_build_struct): New function. (objc_derived_from_p): Likewise. (objc_build_component_ref): Likewise. (objc_copy_binfo): Likewise. (objc_xref_basetypes): Likewise. (objc_lookup_protocol): Likewise. (objc_compare_protocols): Likewise. (objc_volatilize_decl): Likewise. (encode_aggregate_fields): Likewise. (volatilized_hash): Likewise. (volatilized_eq): Likewise. (objc_compare_types): Likewise. (objc_type_quals_match): Likewise. (DERIVED_FROM_P): New ObjC macro, corresponding to C++ macro of same name. (get_class_ivars): Add second parameter indicating if entire hierarchy is desired. (struct volatilized_type): New type. (volatilized_htab): New hash table. (objc_types_compatible_p, objc_comptypes): Remove functions. (synth_module_prologue): Do not initialize 'unused_list'. (objc_get_class_reference): Fix ObjC++ impedance mismatches. (objc_declare_alias): Implement as a typedef. (objc_substitute_decl, objc_gimplify_expr): Reformat. (objc_get_class_ivars): Adjust call to get_class_ivars(). (next_sjlj_build_enter_and_setjmp, synth_forward_declarations, build_ivar_reference, get_super_receiver): Call objc_build_component_ref() instead of build_component_ref(). (objc_begin_catch_clause): Use DERIVED_FROM_P() instead of objc_comptypes(). (build_private_template): Call objc_build_struct() instead of start_struct() and finish_struct(). (hash_init): Initialize volatilized_htab. (objc_is_public): Adjust calls to objc_get_ivars(); adjust ObjC++ impedance mismatches. (encode_aggregate_within): Streamline by calling encode_aggregate_fields(). * objc-act.h (objc_types_compatible_p): Remove prototype. (OCTI_UNUSED_LIST, unused_list): Remove slot. * objc-lang.c (LANG_HOOKS_TYPES_COMPATIBLE_P): Remove. From-SVN: r100123
2005-05-25 00:21:01 +02:00
if (!objc_lookup_protocol (TREE_VALUE (p), rcls, rtyp, warn))
return warn;
}
}
/* NB: If LTYP and LCLS have no protocols to search for, return 'true'
vacuously, _unless_ RTYP is a protocol-qualified 'id'. We can get
away with simply checking for 'id' or 'Class' (!RCLS), since this
routine will not get called in other cases. */
return have_lproto || (rcls != NULL_TREE);
}
/* Determine if it is permissible to assign (if ARGNO is greater than -3)
an instance of RTYP to an instance of LTYP or to compare the two
(if ARGNO is equal to -3), per ObjC type system rules. Before
returning 'true', this routine may issue warnings related to, e.g.,
protocol conformance. When returning 'false', the routine must
produce absolutely no warnings; the C or C++ front-end will do so
instead, if needed. If either LTYP or RTYP is not an Objective-C type,
the routine must return 'false'.
The ARGNO parameter is encoded as follows:
>= 1 Parameter number (CALLEE contains function being called);
0 Return value;
-1 Assignment;
-2 Initialization;
-3 Comparison (LTYP and RTYP may match in either direction). */
bool
objc_compare_types (tree ltyp, tree rtyp, int argno, tree callee)
1992-01-18 00:15:38 +01:00
{
objc-act.c (objc_build_struct): New function. * objc-act.c (objc_build_struct): New function. (objc_derived_from_p): Likewise. (objc_build_component_ref): Likewise. (objc_copy_binfo): Likewise. (objc_xref_basetypes): Likewise. (objc_lookup_protocol): Likewise. (objc_compare_protocols): Likewise. (objc_volatilize_decl): Likewise. (encode_aggregate_fields): Likewise. (volatilized_hash): Likewise. (volatilized_eq): Likewise. (objc_compare_types): Likewise. (objc_type_quals_match): Likewise. (DERIVED_FROM_P): New ObjC macro, corresponding to C++ macro of same name. (get_class_ivars): Add second parameter indicating if entire hierarchy is desired. (struct volatilized_type): New type. (volatilized_htab): New hash table. (objc_types_compatible_p, objc_comptypes): Remove functions. (synth_module_prologue): Do not initialize 'unused_list'. (objc_get_class_reference): Fix ObjC++ impedance mismatches. (objc_declare_alias): Implement as a typedef. (objc_substitute_decl, objc_gimplify_expr): Reformat. (objc_get_class_ivars): Adjust call to get_class_ivars(). (next_sjlj_build_enter_and_setjmp, synth_forward_declarations, build_ivar_reference, get_super_receiver): Call objc_build_component_ref() instead of build_component_ref(). (objc_begin_catch_clause): Use DERIVED_FROM_P() instead of objc_comptypes(). (build_private_template): Call objc_build_struct() instead of start_struct() and finish_struct(). (hash_init): Initialize volatilized_htab. (objc_is_public): Adjust calls to objc_get_ivars(); adjust ObjC++ impedance mismatches. (encode_aggregate_within): Streamline by calling encode_aggregate_fields(). * objc-act.h (objc_types_compatible_p): Remove prototype. (OCTI_UNUSED_LIST, unused_list): Remove slot. * objc-lang.c (LANG_HOOKS_TYPES_COMPATIBLE_P): Remove. From-SVN: r100123
2005-05-25 00:21:01 +02:00
tree lcls, rcls, lproto, rproto;
bool pointers_compatible;
/* We must be dealing with pointer types */
if (!POINTER_TYPE_P (ltyp) || !POINTER_TYPE_P (rtyp))
return false;
objc-act.c (objc_build_struct): New function. * objc-act.c (objc_build_struct): New function. (objc_derived_from_p): Likewise. (objc_build_component_ref): Likewise. (objc_copy_binfo): Likewise. (objc_xref_basetypes): Likewise. (objc_lookup_protocol): Likewise. (objc_compare_protocols): Likewise. (objc_volatilize_decl): Likewise. (encode_aggregate_fields): Likewise. (volatilized_hash): Likewise. (volatilized_eq): Likewise. (objc_compare_types): Likewise. (objc_type_quals_match): Likewise. (DERIVED_FROM_P): New ObjC macro, corresponding to C++ macro of same name. (get_class_ivars): Add second parameter indicating if entire hierarchy is desired. (struct volatilized_type): New type. (volatilized_htab): New hash table. (objc_types_compatible_p, objc_comptypes): Remove functions. (synth_module_prologue): Do not initialize 'unused_list'. (objc_get_class_reference): Fix ObjC++ impedance mismatches. (objc_declare_alias): Implement as a typedef. (objc_substitute_decl, objc_gimplify_expr): Reformat. (objc_get_class_ivars): Adjust call to get_class_ivars(). (next_sjlj_build_enter_and_setjmp, synth_forward_declarations, build_ivar_reference, get_super_receiver): Call objc_build_component_ref() instead of build_component_ref(). (objc_begin_catch_clause): Use DERIVED_FROM_P() instead of objc_comptypes(). (build_private_template): Call objc_build_struct() instead of start_struct() and finish_struct(). (hash_init): Initialize volatilized_htab. (objc_is_public): Adjust calls to objc_get_ivars(); adjust ObjC++ impedance mismatches. (encode_aggregate_within): Streamline by calling encode_aggregate_fields(). * objc-act.h (objc_types_compatible_p): Remove prototype. (OCTI_UNUSED_LIST, unused_list): Remove slot. * objc-lang.c (LANG_HOOKS_TYPES_COMPATIBLE_P): Remove. From-SVN: r100123
2005-05-25 00:21:01 +02:00
do
{
objc-act.c (objc_build_struct): New function. * objc-act.c (objc_build_struct): New function. (objc_derived_from_p): Likewise. (objc_build_component_ref): Likewise. (objc_copy_binfo): Likewise. (objc_xref_basetypes): Likewise. (objc_lookup_protocol): Likewise. (objc_compare_protocols): Likewise. (objc_volatilize_decl): Likewise. (encode_aggregate_fields): Likewise. (volatilized_hash): Likewise. (volatilized_eq): Likewise. (objc_compare_types): Likewise. (objc_type_quals_match): Likewise. (DERIVED_FROM_P): New ObjC macro, corresponding to C++ macro of same name. (get_class_ivars): Add second parameter indicating if entire hierarchy is desired. (struct volatilized_type): New type. (volatilized_htab): New hash table. (objc_types_compatible_p, objc_comptypes): Remove functions. (synth_module_prologue): Do not initialize 'unused_list'. (objc_get_class_reference): Fix ObjC++ impedance mismatches. (objc_declare_alias): Implement as a typedef. (objc_substitute_decl, objc_gimplify_expr): Reformat. (objc_get_class_ivars): Adjust call to get_class_ivars(). (next_sjlj_build_enter_and_setjmp, synth_forward_declarations, build_ivar_reference, get_super_receiver): Call objc_build_component_ref() instead of build_component_ref(). (objc_begin_catch_clause): Use DERIVED_FROM_P() instead of objc_comptypes(). (build_private_template): Call objc_build_struct() instead of start_struct() and finish_struct(). (hash_init): Initialize volatilized_htab. (objc_is_public): Adjust calls to objc_get_ivars(); adjust ObjC++ impedance mismatches. (encode_aggregate_within): Streamline by calling encode_aggregate_fields(). * objc-act.h (objc_types_compatible_p): Remove prototype. (OCTI_UNUSED_LIST, unused_list): Remove slot. * objc-lang.c (LANG_HOOKS_TYPES_COMPATIBLE_P): Remove. From-SVN: r100123
2005-05-25 00:21:01 +02:00
ltyp = TREE_TYPE (ltyp); /* Remove indirections. */
rtyp = TREE_TYPE (rtyp);
}
while (POINTER_TYPE_P (ltyp) && POINTER_TYPE_P (rtyp));
objc-act.c (objc_build_struct): New function. * objc-act.c (objc_build_struct): New function. (objc_derived_from_p): Likewise. (objc_build_component_ref): Likewise. (objc_copy_binfo): Likewise. (objc_xref_basetypes): Likewise. (objc_lookup_protocol): Likewise. (objc_compare_protocols): Likewise. (objc_volatilize_decl): Likewise. (encode_aggregate_fields): Likewise. (volatilized_hash): Likewise. (volatilized_eq): Likewise. (objc_compare_types): Likewise. (objc_type_quals_match): Likewise. (DERIVED_FROM_P): New ObjC macro, corresponding to C++ macro of same name. (get_class_ivars): Add second parameter indicating if entire hierarchy is desired. (struct volatilized_type): New type. (volatilized_htab): New hash table. (objc_types_compatible_p, objc_comptypes): Remove functions. (synth_module_prologue): Do not initialize 'unused_list'. (objc_get_class_reference): Fix ObjC++ impedance mismatches. (objc_declare_alias): Implement as a typedef. (objc_substitute_decl, objc_gimplify_expr): Reformat. (objc_get_class_ivars): Adjust call to get_class_ivars(). (next_sjlj_build_enter_and_setjmp, synth_forward_declarations, build_ivar_reference, get_super_receiver): Call objc_build_component_ref() instead of build_component_ref(). (objc_begin_catch_clause): Use DERIVED_FROM_P() instead of objc_comptypes(). (build_private_template): Call objc_build_struct() instead of start_struct() and finish_struct(). (hash_init): Initialize volatilized_htab. (objc_is_public): Adjust calls to objc_get_ivars(); adjust ObjC++ impedance mismatches. (encode_aggregate_within): Streamline by calling encode_aggregate_fields(). * objc-act.h (objc_types_compatible_p): Remove prototype. (OCTI_UNUSED_LIST, unused_list): Remove slot. * objc-lang.c (LANG_HOOKS_TYPES_COMPATIBLE_P): Remove. From-SVN: r100123
2005-05-25 00:21:01 +02:00
/* Past this point, we are only interested in ObjC class instances,
or 'id' or 'Class'. */
if (TREE_CODE (ltyp) != RECORD_TYPE || TREE_CODE (rtyp) != RECORD_TYPE)
return false;
objc-act.c (objc_build_struct): New function. * objc-act.c (objc_build_struct): New function. (objc_derived_from_p): Likewise. (objc_build_component_ref): Likewise. (objc_copy_binfo): Likewise. (objc_xref_basetypes): Likewise. (objc_lookup_protocol): Likewise. (objc_compare_protocols): Likewise. (objc_volatilize_decl): Likewise. (encode_aggregate_fields): Likewise. (volatilized_hash): Likewise. (volatilized_eq): Likewise. (objc_compare_types): Likewise. (objc_type_quals_match): Likewise. (DERIVED_FROM_P): New ObjC macro, corresponding to C++ macro of same name. (get_class_ivars): Add second parameter indicating if entire hierarchy is desired. (struct volatilized_type): New type. (volatilized_htab): New hash table. (objc_types_compatible_p, objc_comptypes): Remove functions. (synth_module_prologue): Do not initialize 'unused_list'. (objc_get_class_reference): Fix ObjC++ impedance mismatches. (objc_declare_alias): Implement as a typedef. (objc_substitute_decl, objc_gimplify_expr): Reformat. (objc_get_class_ivars): Adjust call to get_class_ivars(). (next_sjlj_build_enter_and_setjmp, synth_forward_declarations, build_ivar_reference, get_super_receiver): Call objc_build_component_ref() instead of build_component_ref(). (objc_begin_catch_clause): Use DERIVED_FROM_P() instead of objc_comptypes(). (build_private_template): Call objc_build_struct() instead of start_struct() and finish_struct(). (hash_init): Initialize volatilized_htab. (objc_is_public): Adjust calls to objc_get_ivars(); adjust ObjC++ impedance mismatches. (encode_aggregate_within): Streamline by calling encode_aggregate_fields(). * objc-act.h (objc_types_compatible_p): Remove prototype. (OCTI_UNUSED_LIST, unused_list): Remove slot. * objc-lang.c (LANG_HOOKS_TYPES_COMPATIBLE_P): Remove. From-SVN: r100123
2005-05-25 00:21:01 +02:00
if (!objc_is_object_id (ltyp) && !objc_is_class_id (ltyp)
&& !TYPE_HAS_OBJC_INFO (ltyp))
return false;
c-common.h: Remove RID_ID. [gcc/ChangeLog] 2004-10-25 David Ayers <d.ayers@inode.at> * c-common.h: Remove RID_ID. * c-parse.in: Remove OBJECTNAME and references to RID_ID. (typespec_reserved_attr): Add rule for TYPENAME non_empty_protocolrefs. (yylexname): Remove special handling of RID_ID. [gcc/objc/ChangeLog] 2004-10-25 Ziemowit Laski <zlaski@apple.com> David Ayers <d.ayers@inode.at> * objc-act.c (objc_comptypes): Use IS_PROTOCOL_QUALIFIED_UNTYPED instead of IS_PROTOCOL_QUALIFIED_ID; add comparisons for: 'Class <Protocol> != id <Protocol>'; 'Class <Protocol> != <class> *'; 'Class <Protocol> == id' and 'Class <Protocol> == Class'. (objc_is_id): Add test for 'super'. (objc_finish_message_expr): Allow for messaging of 'Class <Proto>' receivers; if class methods are not found in protocol lists, search for instance methods therein and warn if one is found. Look in global hash tables for suitable method as a last resort when messaging 'id <Proto>', 'Class <Proto>' and invalid receiver types. (objc_add_method): Insert instance methods listed in protocols into the global class method hash table. * objc-act.h (IS_PROTOCOL_QUALIFIED_ID): Rename to IS_PROTOCOL_QUALIFIED_UNTYPED and allow for 'Class <Proto>' in addition to 'id <Proto>'. [gcc/testsuite/ChangeLog] 2004-10-25 David Ayers <d.ayers@inode.at> Ziemowit Laski <zlaski@apple.com> * objc.dg/call-super-2.m: Add messages to 'Class <Proto>'; update diagnostics when messaging 'id <Proto>'. * objc.dg/class-protocol-1.m: New test. * objc.dg/desig-init-1.m: Add message to an invalid receiver using a non-existent method signature. * objc.dg/method-5.m, objc.dg/method-6.m, objc.dg/proto-hier-1.m: Update diagnostics when messaging with non-existent method signature. * objc.dg/proto-hier-2.m: Adjust wording of diagnostic. * objc.dg/proto-lossage-1.m, objc.dg/proto-lossage-4.m: Messages to invalid receivers are now resolved as if messaging 'id'; remove extraneous diagnostics. From-SVN: r89562
2004-10-26 00:55:25 +02:00
objc-act.c (objc_build_struct): New function. * objc-act.c (objc_build_struct): New function. (objc_derived_from_p): Likewise. (objc_build_component_ref): Likewise. (objc_copy_binfo): Likewise. (objc_xref_basetypes): Likewise. (objc_lookup_protocol): Likewise. (objc_compare_protocols): Likewise. (objc_volatilize_decl): Likewise. (encode_aggregate_fields): Likewise. (volatilized_hash): Likewise. (volatilized_eq): Likewise. (objc_compare_types): Likewise. (objc_type_quals_match): Likewise. (DERIVED_FROM_P): New ObjC macro, corresponding to C++ macro of same name. (get_class_ivars): Add second parameter indicating if entire hierarchy is desired. (struct volatilized_type): New type. (volatilized_htab): New hash table. (objc_types_compatible_p, objc_comptypes): Remove functions. (synth_module_prologue): Do not initialize 'unused_list'. (objc_get_class_reference): Fix ObjC++ impedance mismatches. (objc_declare_alias): Implement as a typedef. (objc_substitute_decl, objc_gimplify_expr): Reformat. (objc_get_class_ivars): Adjust call to get_class_ivars(). (next_sjlj_build_enter_and_setjmp, synth_forward_declarations, build_ivar_reference, get_super_receiver): Call objc_build_component_ref() instead of build_component_ref(). (objc_begin_catch_clause): Use DERIVED_FROM_P() instead of objc_comptypes(). (build_private_template): Call objc_build_struct() instead of start_struct() and finish_struct(). (hash_init): Initialize volatilized_htab. (objc_is_public): Adjust calls to objc_get_ivars(); adjust ObjC++ impedance mismatches. (encode_aggregate_within): Streamline by calling encode_aggregate_fields(). * objc-act.h (objc_types_compatible_p): Remove prototype. (OCTI_UNUSED_LIST, unused_list): Remove slot. * objc-lang.c (LANG_HOOKS_TYPES_COMPATIBLE_P): Remove. From-SVN: r100123
2005-05-25 00:21:01 +02:00
if (!objc_is_object_id (rtyp) && !objc_is_class_id (rtyp)
&& !TYPE_HAS_OBJC_INFO (rtyp))
return false;
objc-act.c (objc_build_struct): New function. * objc-act.c (objc_build_struct): New function. (objc_derived_from_p): Likewise. (objc_build_component_ref): Likewise. (objc_copy_binfo): Likewise. (objc_xref_basetypes): Likewise. (objc_lookup_protocol): Likewise. (objc_compare_protocols): Likewise. (objc_volatilize_decl): Likewise. (encode_aggregate_fields): Likewise. (volatilized_hash): Likewise. (volatilized_eq): Likewise. (objc_compare_types): Likewise. (objc_type_quals_match): Likewise. (DERIVED_FROM_P): New ObjC macro, corresponding to C++ macro of same name. (get_class_ivars): Add second parameter indicating if entire hierarchy is desired. (struct volatilized_type): New type. (volatilized_htab): New hash table. (objc_types_compatible_p, objc_comptypes): Remove functions. (synth_module_prologue): Do not initialize 'unused_list'. (objc_get_class_reference): Fix ObjC++ impedance mismatches. (objc_declare_alias): Implement as a typedef. (objc_substitute_decl, objc_gimplify_expr): Reformat. (objc_get_class_ivars): Adjust call to get_class_ivars(). (next_sjlj_build_enter_and_setjmp, synth_forward_declarations, build_ivar_reference, get_super_receiver): Call objc_build_component_ref() instead of build_component_ref(). (objc_begin_catch_clause): Use DERIVED_FROM_P() instead of objc_comptypes(). (build_private_template): Call objc_build_struct() instead of start_struct() and finish_struct(). (hash_init): Initialize volatilized_htab. (objc_is_public): Adjust calls to objc_get_ivars(); adjust ObjC++ impedance mismatches. (encode_aggregate_within): Streamline by calling encode_aggregate_fields(). * objc-act.h (objc_types_compatible_p): Remove prototype. (OCTI_UNUSED_LIST, unused_list): Remove slot. * objc-lang.c (LANG_HOOKS_TYPES_COMPATIBLE_P): Remove. From-SVN: r100123
2005-05-25 00:21:01 +02:00
/* Past this point, we are committed to returning 'true' to the caller.
However, we can still warn about type and/or protocol mismatches. */
objc-act.c (objc_build_struct): New function. * objc-act.c (objc_build_struct): New function. (objc_derived_from_p): Likewise. (objc_build_component_ref): Likewise. (objc_copy_binfo): Likewise. (objc_xref_basetypes): Likewise. (objc_lookup_protocol): Likewise. (objc_compare_protocols): Likewise. (objc_volatilize_decl): Likewise. (encode_aggregate_fields): Likewise. (volatilized_hash): Likewise. (volatilized_eq): Likewise. (objc_compare_types): Likewise. (objc_type_quals_match): Likewise. (DERIVED_FROM_P): New ObjC macro, corresponding to C++ macro of same name. (get_class_ivars): Add second parameter indicating if entire hierarchy is desired. (struct volatilized_type): New type. (volatilized_htab): New hash table. (objc_types_compatible_p, objc_comptypes): Remove functions. (synth_module_prologue): Do not initialize 'unused_list'. (objc_get_class_reference): Fix ObjC++ impedance mismatches. (objc_declare_alias): Implement as a typedef. (objc_substitute_decl, objc_gimplify_expr): Reformat. (objc_get_class_ivars): Adjust call to get_class_ivars(). (next_sjlj_build_enter_and_setjmp, synth_forward_declarations, build_ivar_reference, get_super_receiver): Call objc_build_component_ref() instead of build_component_ref(). (objc_begin_catch_clause): Use DERIVED_FROM_P() instead of objc_comptypes(). (build_private_template): Call objc_build_struct() instead of start_struct() and finish_struct(). (hash_init): Initialize volatilized_htab. (objc_is_public): Adjust calls to objc_get_ivars(); adjust ObjC++ impedance mismatches. (encode_aggregate_within): Streamline by calling encode_aggregate_fields(). * objc-act.h (objc_types_compatible_p): Remove prototype. (OCTI_UNUSED_LIST, unused_list): Remove slot. * objc-lang.c (LANG_HOOKS_TYPES_COMPATIBLE_P): Remove. From-SVN: r100123
2005-05-25 00:21:01 +02:00
if (TYPE_HAS_OBJC_INFO (ltyp))
{
lcls = TYPE_OBJC_INTERFACE (ltyp);
lproto = TYPE_OBJC_PROTOCOL_LIST (ltyp);
}
else
lcls = lproto = NULL_TREE;
objc-act.c (objc_build_struct): New function. * objc-act.c (objc_build_struct): New function. (objc_derived_from_p): Likewise. (objc_build_component_ref): Likewise. (objc_copy_binfo): Likewise. (objc_xref_basetypes): Likewise. (objc_lookup_protocol): Likewise. (objc_compare_protocols): Likewise. (objc_volatilize_decl): Likewise. (encode_aggregate_fields): Likewise. (volatilized_hash): Likewise. (volatilized_eq): Likewise. (objc_compare_types): Likewise. (objc_type_quals_match): Likewise. (DERIVED_FROM_P): New ObjC macro, corresponding to C++ macro of same name. (get_class_ivars): Add second parameter indicating if entire hierarchy is desired. (struct volatilized_type): New type. (volatilized_htab): New hash table. (objc_types_compatible_p, objc_comptypes): Remove functions. (synth_module_prologue): Do not initialize 'unused_list'. (objc_get_class_reference): Fix ObjC++ impedance mismatches. (objc_declare_alias): Implement as a typedef. (objc_substitute_decl, objc_gimplify_expr): Reformat. (objc_get_class_ivars): Adjust call to get_class_ivars(). (next_sjlj_build_enter_and_setjmp, synth_forward_declarations, build_ivar_reference, get_super_receiver): Call objc_build_component_ref() instead of build_component_ref(). (objc_begin_catch_clause): Use DERIVED_FROM_P() instead of objc_comptypes(). (build_private_template): Call objc_build_struct() instead of start_struct() and finish_struct(). (hash_init): Initialize volatilized_htab. (objc_is_public): Adjust calls to objc_get_ivars(); adjust ObjC++ impedance mismatches. (encode_aggregate_within): Streamline by calling encode_aggregate_fields(). * objc-act.h (objc_types_compatible_p): Remove prototype. (OCTI_UNUSED_LIST, unused_list): Remove slot. * objc-lang.c (LANG_HOOKS_TYPES_COMPATIBLE_P): Remove. From-SVN: r100123
2005-05-25 00:21:01 +02:00
if (TYPE_HAS_OBJC_INFO (rtyp))
{
rcls = TYPE_OBJC_INTERFACE (rtyp);
rproto = TYPE_OBJC_PROTOCOL_LIST (rtyp);
}
else
rcls = rproto = NULL_TREE;
c-common.h: Remove RID_ID. [gcc/ChangeLog] 2004-10-25 David Ayers <d.ayers@inode.at> * c-common.h: Remove RID_ID. * c-parse.in: Remove OBJECTNAME and references to RID_ID. (typespec_reserved_attr): Add rule for TYPENAME non_empty_protocolrefs. (yylexname): Remove special handling of RID_ID. [gcc/objc/ChangeLog] 2004-10-25 Ziemowit Laski <zlaski@apple.com> David Ayers <d.ayers@inode.at> * objc-act.c (objc_comptypes): Use IS_PROTOCOL_QUALIFIED_UNTYPED instead of IS_PROTOCOL_QUALIFIED_ID; add comparisons for: 'Class <Protocol> != id <Protocol>'; 'Class <Protocol> != <class> *'; 'Class <Protocol> == id' and 'Class <Protocol> == Class'. (objc_is_id): Add test for 'super'. (objc_finish_message_expr): Allow for messaging of 'Class <Proto>' receivers; if class methods are not found in protocol lists, search for instance methods therein and warn if one is found. Look in global hash tables for suitable method as a last resort when messaging 'id <Proto>', 'Class <Proto>' and invalid receiver types. (objc_add_method): Insert instance methods listed in protocols into the global class method hash table. * objc-act.h (IS_PROTOCOL_QUALIFIED_ID): Rename to IS_PROTOCOL_QUALIFIED_UNTYPED and allow for 'Class <Proto>' in addition to 'id <Proto>'. [gcc/testsuite/ChangeLog] 2004-10-25 David Ayers <d.ayers@inode.at> Ziemowit Laski <zlaski@apple.com> * objc.dg/call-super-2.m: Add messages to 'Class <Proto>'; update diagnostics when messaging 'id <Proto>'. * objc.dg/class-protocol-1.m: New test. * objc.dg/desig-init-1.m: Add message to an invalid receiver using a non-existent method signature. * objc.dg/method-5.m, objc.dg/method-6.m, objc.dg/proto-hier-1.m: Update diagnostics when messaging with non-existent method signature. * objc.dg/proto-hier-2.m: Adjust wording of diagnostic. * objc.dg/proto-lossage-1.m, objc.dg/proto-lossage-4.m: Messages to invalid receivers are now resolved as if messaging 'id'; remove extraneous diagnostics. From-SVN: r89562
2004-10-26 00:55:25 +02:00
/* If we could not find an @interface declaration, we must have
only seen a @class declaration; for purposes of type comparison,
treat it as a stand-alone (root) class. */
if (lcls && TREE_CODE (lcls) == IDENTIFIER_NODE)
lcls = NULL_TREE;
if (rcls && TREE_CODE (rcls) == IDENTIFIER_NODE)
rcls = NULL_TREE;
objc-act.c (objc_build_struct): New function. * objc-act.c (objc_build_struct): New function. (objc_derived_from_p): Likewise. (objc_build_component_ref): Likewise. (objc_copy_binfo): Likewise. (objc_xref_basetypes): Likewise. (objc_lookup_protocol): Likewise. (objc_compare_protocols): Likewise. (objc_volatilize_decl): Likewise. (encode_aggregate_fields): Likewise. (volatilized_hash): Likewise. (volatilized_eq): Likewise. (objc_compare_types): Likewise. (objc_type_quals_match): Likewise. (DERIVED_FROM_P): New ObjC macro, corresponding to C++ macro of same name. (get_class_ivars): Add second parameter indicating if entire hierarchy is desired. (struct volatilized_type): New type. (volatilized_htab): New hash table. (objc_types_compatible_p, objc_comptypes): Remove functions. (synth_module_prologue): Do not initialize 'unused_list'. (objc_get_class_reference): Fix ObjC++ impedance mismatches. (objc_declare_alias): Implement as a typedef. (objc_substitute_decl, objc_gimplify_expr): Reformat. (objc_get_class_ivars): Adjust call to get_class_ivars(). (next_sjlj_build_enter_and_setjmp, synth_forward_declarations, build_ivar_reference, get_super_receiver): Call objc_build_component_ref() instead of build_component_ref(). (objc_begin_catch_clause): Use DERIVED_FROM_P() instead of objc_comptypes(). (build_private_template): Call objc_build_struct() instead of start_struct() and finish_struct(). (hash_init): Initialize volatilized_htab. (objc_is_public): Adjust calls to objc_get_ivars(); adjust ObjC++ impedance mismatches. (encode_aggregate_within): Streamline by calling encode_aggregate_fields(). * objc-act.h (objc_types_compatible_p): Remove prototype. (OCTI_UNUSED_LIST, unused_list): Remove slot. * objc-lang.c (LANG_HOOKS_TYPES_COMPATIBLE_P): Remove. From-SVN: r100123
2005-05-25 00:21:01 +02:00
/* If either type is an unqualified 'id', we're done. */
if ((!lproto && objc_is_object_id (ltyp))
|| (!rproto && objc_is_object_id (rtyp)))
return true;
objc-act.c (objc_build_struct): New function. * objc-act.c (objc_build_struct): New function. (objc_derived_from_p): Likewise. (objc_build_component_ref): Likewise. (objc_copy_binfo): Likewise. (objc_xref_basetypes): Likewise. (objc_lookup_protocol): Likewise. (objc_compare_protocols): Likewise. (objc_volatilize_decl): Likewise. (encode_aggregate_fields): Likewise. (volatilized_hash): Likewise. (volatilized_eq): Likewise. (objc_compare_types): Likewise. (objc_type_quals_match): Likewise. (DERIVED_FROM_P): New ObjC macro, corresponding to C++ macro of same name. (get_class_ivars): Add second parameter indicating if entire hierarchy is desired. (struct volatilized_type): New type. (volatilized_htab): New hash table. (objc_types_compatible_p, objc_comptypes): Remove functions. (synth_module_prologue): Do not initialize 'unused_list'. (objc_get_class_reference): Fix ObjC++ impedance mismatches. (objc_declare_alias): Implement as a typedef. (objc_substitute_decl, objc_gimplify_expr): Reformat. (objc_get_class_ivars): Adjust call to get_class_ivars(). (next_sjlj_build_enter_and_setjmp, synth_forward_declarations, build_ivar_reference, get_super_receiver): Call objc_build_component_ref() instead of build_component_ref(). (objc_begin_catch_clause): Use DERIVED_FROM_P() instead of objc_comptypes(). (build_private_template): Call objc_build_struct() instead of start_struct() and finish_struct(). (hash_init): Initialize volatilized_htab. (objc_is_public): Adjust calls to objc_get_ivars(); adjust ObjC++ impedance mismatches. (encode_aggregate_within): Streamline by calling encode_aggregate_fields(). * objc-act.h (objc_types_compatible_p): Remove prototype. (OCTI_UNUSED_LIST, unused_list): Remove slot. * objc-lang.c (LANG_HOOKS_TYPES_COMPATIBLE_P): Remove. From-SVN: r100123
2005-05-25 00:21:01 +02:00
pointers_compatible = (TYPE_MAIN_VARIANT (ltyp) == TYPE_MAIN_VARIANT (rtyp));
objc-act.c (objc_build_struct): New function. * objc-act.c (objc_build_struct): New function. (objc_derived_from_p): Likewise. (objc_build_component_ref): Likewise. (objc_copy_binfo): Likewise. (objc_xref_basetypes): Likewise. (objc_lookup_protocol): Likewise. (objc_compare_protocols): Likewise. (objc_volatilize_decl): Likewise. (encode_aggregate_fields): Likewise. (volatilized_hash): Likewise. (volatilized_eq): Likewise. (objc_compare_types): Likewise. (objc_type_quals_match): Likewise. (DERIVED_FROM_P): New ObjC macro, corresponding to C++ macro of same name. (get_class_ivars): Add second parameter indicating if entire hierarchy is desired. (struct volatilized_type): New type. (volatilized_htab): New hash table. (objc_types_compatible_p, objc_comptypes): Remove functions. (synth_module_prologue): Do not initialize 'unused_list'. (objc_get_class_reference): Fix ObjC++ impedance mismatches. (objc_declare_alias): Implement as a typedef. (objc_substitute_decl, objc_gimplify_expr): Reformat. (objc_get_class_ivars): Adjust call to get_class_ivars(). (next_sjlj_build_enter_and_setjmp, synth_forward_declarations, build_ivar_reference, get_super_receiver): Call objc_build_component_ref() instead of build_component_ref(). (objc_begin_catch_clause): Use DERIVED_FROM_P() instead of objc_comptypes(). (build_private_template): Call objc_build_struct() instead of start_struct() and finish_struct(). (hash_init): Initialize volatilized_htab. (objc_is_public): Adjust calls to objc_get_ivars(); adjust ObjC++ impedance mismatches. (encode_aggregate_within): Streamline by calling encode_aggregate_fields(). * objc-act.h (objc_types_compatible_p): Remove prototype. (OCTI_UNUSED_LIST, unused_list): Remove slot. * objc-lang.c (LANG_HOOKS_TYPES_COMPATIBLE_P): Remove. From-SVN: r100123
2005-05-25 00:21:01 +02:00
/* If the underlying types are the same, and at most one of them has
a protocol list, we do not need to issue any diagnostics. */
if (pointers_compatible && (!lproto || !rproto))
return true;
c-common.h: Remove RID_ID. [gcc/ChangeLog] 2004-10-25 David Ayers <d.ayers@inode.at> * c-common.h: Remove RID_ID. * c-parse.in: Remove OBJECTNAME and references to RID_ID. (typespec_reserved_attr): Add rule for TYPENAME non_empty_protocolrefs. (yylexname): Remove special handling of RID_ID. [gcc/objc/ChangeLog] 2004-10-25 Ziemowit Laski <zlaski@apple.com> David Ayers <d.ayers@inode.at> * objc-act.c (objc_comptypes): Use IS_PROTOCOL_QUALIFIED_UNTYPED instead of IS_PROTOCOL_QUALIFIED_ID; add comparisons for: 'Class <Protocol> != id <Protocol>'; 'Class <Protocol> != <class> *'; 'Class <Protocol> == id' and 'Class <Protocol> == Class'. (objc_is_id): Add test for 'super'. (objc_finish_message_expr): Allow for messaging of 'Class <Proto>' receivers; if class methods are not found in protocol lists, search for instance methods therein and warn if one is found. Look in global hash tables for suitable method as a last resort when messaging 'id <Proto>', 'Class <Proto>' and invalid receiver types. (objc_add_method): Insert instance methods listed in protocols into the global class method hash table. * objc-act.h (IS_PROTOCOL_QUALIFIED_ID): Rename to IS_PROTOCOL_QUALIFIED_UNTYPED and allow for 'Class <Proto>' in addition to 'id <Proto>'. [gcc/testsuite/ChangeLog] 2004-10-25 David Ayers <d.ayers@inode.at> Ziemowit Laski <zlaski@apple.com> * objc.dg/call-super-2.m: Add messages to 'Class <Proto>'; update diagnostics when messaging 'id <Proto>'. * objc.dg/class-protocol-1.m: New test. * objc.dg/desig-init-1.m: Add message to an invalid receiver using a non-existent method signature. * objc.dg/method-5.m, objc.dg/method-6.m, objc.dg/proto-hier-1.m: Update diagnostics when messaging with non-existent method signature. * objc.dg/proto-hier-2.m: Adjust wording of diagnostic. * objc.dg/proto-lossage-1.m, objc.dg/proto-lossage-4.m: Messages to invalid receivers are now resolved as if messaging 'id'; remove extraneous diagnostics. From-SVN: r89562
2004-10-26 00:55:25 +02:00
objc-act.c (objc_build_struct): New function. * objc-act.c (objc_build_struct): New function. (objc_derived_from_p): Likewise. (objc_build_component_ref): Likewise. (objc_copy_binfo): Likewise. (objc_xref_basetypes): Likewise. (objc_lookup_protocol): Likewise. (objc_compare_protocols): Likewise. (objc_volatilize_decl): Likewise. (encode_aggregate_fields): Likewise. (volatilized_hash): Likewise. (volatilized_eq): Likewise. (objc_compare_types): Likewise. (objc_type_quals_match): Likewise. (DERIVED_FROM_P): New ObjC macro, corresponding to C++ macro of same name. (get_class_ivars): Add second parameter indicating if entire hierarchy is desired. (struct volatilized_type): New type. (volatilized_htab): New hash table. (objc_types_compatible_p, objc_comptypes): Remove functions. (synth_module_prologue): Do not initialize 'unused_list'. (objc_get_class_reference): Fix ObjC++ impedance mismatches. (objc_declare_alias): Implement as a typedef. (objc_substitute_decl, objc_gimplify_expr): Reformat. (objc_get_class_ivars): Adjust call to get_class_ivars(). (next_sjlj_build_enter_and_setjmp, synth_forward_declarations, build_ivar_reference, get_super_receiver): Call objc_build_component_ref() instead of build_component_ref(). (objc_begin_catch_clause): Use DERIVED_FROM_P() instead of objc_comptypes(). (build_private_template): Call objc_build_struct() instead of start_struct() and finish_struct(). (hash_init): Initialize volatilized_htab. (objc_is_public): Adjust calls to objc_get_ivars(); adjust ObjC++ impedance mismatches. (encode_aggregate_within): Streamline by calling encode_aggregate_fields(). * objc-act.h (objc_types_compatible_p): Remove prototype. (OCTI_UNUSED_LIST, unused_list): Remove slot. * objc-lang.c (LANG_HOOKS_TYPES_COMPATIBLE_P): Remove. From-SVN: r100123
2005-05-25 00:21:01 +02:00
/* If exactly one of the types is 'Class', issue a diagnostic; any
exceptions of this rule have already been handled. */
if (objc_is_class_id (ltyp) ^ objc_is_class_id (rtyp))
pointers_compatible = false;
/* Otherwise, check for inheritance relations. */
else
{
if (!pointers_compatible)
pointers_compatible
= (objc_is_object_id (ltyp) || objc_is_object_id (rtyp));
if (!pointers_compatible)
pointers_compatible = DERIVED_FROM_P (ltyp, rtyp);
if (!pointers_compatible && argno == -3)
pointers_compatible = DERIVED_FROM_P (rtyp, ltyp);
}
/* If the pointers match modulo protocols, check for protocol conformance
mismatches. */
if (pointers_compatible)
{
pointers_compatible = objc_compare_protocols (lcls, ltyp, rcls, rtyp,
argno != -3);
if (!pointers_compatible && argno == -3)
pointers_compatible = objc_compare_protocols (rcls, rtyp, lcls, ltyp,
argno != -3);
}
if (!pointers_compatible)
{
/* NB: For the time being, we shall make our warnings look like their
C counterparts. In the future, we may wish to make them more
ObjC-specific. */
switch (argno)
{
objc-act.c (objc_build_struct): New function. * objc-act.c (objc_build_struct): New function. (objc_derived_from_p): Likewise. (objc_build_component_ref): Likewise. (objc_copy_binfo): Likewise. (objc_xref_basetypes): Likewise. (objc_lookup_protocol): Likewise. (objc_compare_protocols): Likewise. (objc_volatilize_decl): Likewise. (encode_aggregate_fields): Likewise. (volatilized_hash): Likewise. (volatilized_eq): Likewise. (objc_compare_types): Likewise. (objc_type_quals_match): Likewise. (DERIVED_FROM_P): New ObjC macro, corresponding to C++ macro of same name. (get_class_ivars): Add second parameter indicating if entire hierarchy is desired. (struct volatilized_type): New type. (volatilized_htab): New hash table. (objc_types_compatible_p, objc_comptypes): Remove functions. (synth_module_prologue): Do not initialize 'unused_list'. (objc_get_class_reference): Fix ObjC++ impedance mismatches. (objc_declare_alias): Implement as a typedef. (objc_substitute_decl, objc_gimplify_expr): Reformat. (objc_get_class_ivars): Adjust call to get_class_ivars(). (next_sjlj_build_enter_and_setjmp, synth_forward_declarations, build_ivar_reference, get_super_receiver): Call objc_build_component_ref() instead of build_component_ref(). (objc_begin_catch_clause): Use DERIVED_FROM_P() instead of objc_comptypes(). (build_private_template): Call objc_build_struct() instead of start_struct() and finish_struct(). (hash_init): Initialize volatilized_htab. (objc_is_public): Adjust calls to objc_get_ivars(); adjust ObjC++ impedance mismatches. (encode_aggregate_within): Streamline by calling encode_aggregate_fields(). * objc-act.h (objc_types_compatible_p): Remove prototype. (OCTI_UNUSED_LIST, unused_list): Remove slot. * objc-lang.c (LANG_HOOKS_TYPES_COMPATIBLE_P): Remove. From-SVN: r100123
2005-05-25 00:21:01 +02:00
case -3:
warning (0, "comparison of distinct Objective-C types lacks a cast");
break;
case -2:
warning (0, "initialization from distinct Objective-C type");
break;
case -1:
warning (0, "assignment from distinct Objective-C type");
break;
case 0:
warning (0, "distinct Objective-C type in return");
break;
default:
warning (0, "passing argument %d of %qE from distinct "
"Objective-C type", argno, callee);
break;
}
}
objc-act.c (objc_build_struct): New function. * objc-act.c (objc_build_struct): New function. (objc_derived_from_p): Likewise. (objc_build_component_ref): Likewise. (objc_copy_binfo): Likewise. (objc_xref_basetypes): Likewise. (objc_lookup_protocol): Likewise. (objc_compare_protocols): Likewise. (objc_volatilize_decl): Likewise. (encode_aggregate_fields): Likewise. (volatilized_hash): Likewise. (volatilized_eq): Likewise. (objc_compare_types): Likewise. (objc_type_quals_match): Likewise. (DERIVED_FROM_P): New ObjC macro, corresponding to C++ macro of same name. (get_class_ivars): Add second parameter indicating if entire hierarchy is desired. (struct volatilized_type): New type. (volatilized_htab): New hash table. (objc_types_compatible_p, objc_comptypes): Remove functions. (synth_module_prologue): Do not initialize 'unused_list'. (objc_get_class_reference): Fix ObjC++ impedance mismatches. (objc_declare_alias): Implement as a typedef. (objc_substitute_decl, objc_gimplify_expr): Reformat. (objc_get_class_ivars): Adjust call to get_class_ivars(). (next_sjlj_build_enter_and_setjmp, synth_forward_declarations, build_ivar_reference, get_super_receiver): Call objc_build_component_ref() instead of build_component_ref(). (objc_begin_catch_clause): Use DERIVED_FROM_P() instead of objc_comptypes(). (build_private_template): Call objc_build_struct() instead of start_struct() and finish_struct(). (hash_init): Initialize volatilized_htab. (objc_is_public): Adjust calls to objc_get_ivars(); adjust ObjC++ impedance mismatches. (encode_aggregate_within): Streamline by calling encode_aggregate_fields(). * objc-act.h (objc_types_compatible_p): Remove prototype. (OCTI_UNUSED_LIST, unused_list): Remove slot. * objc-lang.c (LANG_HOOKS_TYPES_COMPATIBLE_P): Remove. From-SVN: r100123
2005-05-25 00:21:01 +02:00
return true;
}
/* Check if LTYP and RTYP have the same type qualifiers. If either type
lives in the volatilized hash table, ignore the 'volatile' bit when
making the comparison. */
bool
objc_type_quals_match (tree ltyp, tree rtyp)
{
int lquals = TYPE_QUALS (ltyp), rquals = TYPE_QUALS (rtyp);
struct volatilized_type key;
key.type = ltyp;
if (htab_find_slot (volatilized_htab, &key, NO_INSERT))
lquals &= ~TYPE_QUAL_VOLATILE;
key.type = rtyp;
if (htab_find_slot (volatilized_htab, &key, NO_INSERT))
rquals &= ~TYPE_QUAL_VOLATILE;
return (lquals == rquals);
}
#ifndef OBJCPLUS
/* Determine if CHILD is derived from PARENT. The routine assumes that
both parameters are RECORD_TYPEs, and is non-reflexive. */
static bool
objc_derived_from_p (tree parent, tree child)
{
parent = TYPE_MAIN_VARIANT (parent);
for (child = TYPE_MAIN_VARIANT (child);
TYPE_BINFO (child) && BINFO_N_BASE_BINFOS (TYPE_BINFO (child));)
{
objc-act.c (objc_build_struct): New function. * objc-act.c (objc_build_struct): New function. (objc_derived_from_p): Likewise. (objc_build_component_ref): Likewise. (objc_copy_binfo): Likewise. (objc_xref_basetypes): Likewise. (objc_lookup_protocol): Likewise. (objc_compare_protocols): Likewise. (objc_volatilize_decl): Likewise. (encode_aggregate_fields): Likewise. (volatilized_hash): Likewise. (volatilized_eq): Likewise. (objc_compare_types): Likewise. (objc_type_quals_match): Likewise. (DERIVED_FROM_P): New ObjC macro, corresponding to C++ macro of same name. (get_class_ivars): Add second parameter indicating if entire hierarchy is desired. (struct volatilized_type): New type. (volatilized_htab): New hash table. (objc_types_compatible_p, objc_comptypes): Remove functions. (synth_module_prologue): Do not initialize 'unused_list'. (objc_get_class_reference): Fix ObjC++ impedance mismatches. (objc_declare_alias): Implement as a typedef. (objc_substitute_decl, objc_gimplify_expr): Reformat. (objc_get_class_ivars): Adjust call to get_class_ivars(). (next_sjlj_build_enter_and_setjmp, synth_forward_declarations, build_ivar_reference, get_super_receiver): Call objc_build_component_ref() instead of build_component_ref(). (objc_begin_catch_clause): Use DERIVED_FROM_P() instead of objc_comptypes(). (build_private_template): Call objc_build_struct() instead of start_struct() and finish_struct(). (hash_init): Initialize volatilized_htab. (objc_is_public): Adjust calls to objc_get_ivars(); adjust ObjC++ impedance mismatches. (encode_aggregate_within): Streamline by calling encode_aggregate_fields(). * objc-act.h (objc_types_compatible_p): Remove prototype. (OCTI_UNUSED_LIST, unused_list): Remove slot. * objc-lang.c (LANG_HOOKS_TYPES_COMPATIBLE_P): Remove. From-SVN: r100123
2005-05-25 00:21:01 +02:00
child = TYPE_MAIN_VARIANT (BINFO_TYPE (BINFO_BASE_BINFO
(TYPE_BINFO (child),
0)));
if (child == parent)
return true;
}
1992-01-18 00:15:38 +01:00
objc-act.c (objc_build_struct): New function. * objc-act.c (objc_build_struct): New function. (objc_derived_from_p): Likewise. (objc_build_component_ref): Likewise. (objc_copy_binfo): Likewise. (objc_xref_basetypes): Likewise. (objc_lookup_protocol): Likewise. (objc_compare_protocols): Likewise. (objc_volatilize_decl): Likewise. (encode_aggregate_fields): Likewise. (volatilized_hash): Likewise. (volatilized_eq): Likewise. (objc_compare_types): Likewise. (objc_type_quals_match): Likewise. (DERIVED_FROM_P): New ObjC macro, corresponding to C++ macro of same name. (get_class_ivars): Add second parameter indicating if entire hierarchy is desired. (struct volatilized_type): New type. (volatilized_htab): New hash table. (objc_types_compatible_p, objc_comptypes): Remove functions. (synth_module_prologue): Do not initialize 'unused_list'. (objc_get_class_reference): Fix ObjC++ impedance mismatches. (objc_declare_alias): Implement as a typedef. (objc_substitute_decl, objc_gimplify_expr): Reformat. (objc_get_class_ivars): Adjust call to get_class_ivars(). (next_sjlj_build_enter_and_setjmp, synth_forward_declarations, build_ivar_reference, get_super_receiver): Call objc_build_component_ref() instead of build_component_ref(). (objc_begin_catch_clause): Use DERIVED_FROM_P() instead of objc_comptypes(). (build_private_template): Call objc_build_struct() instead of start_struct() and finish_struct(). (hash_init): Initialize volatilized_htab. (objc_is_public): Adjust calls to objc_get_ivars(); adjust ObjC++ impedance mismatches. (encode_aggregate_within): Streamline by calling encode_aggregate_fields(). * objc-act.h (objc_types_compatible_p): Remove prototype. (OCTI_UNUSED_LIST, unused_list): Remove slot. * objc-lang.c (LANG_HOOKS_TYPES_COMPATIBLE_P): Remove. From-SVN: r100123
2005-05-25 00:21:01 +02:00
return false;
}
#endif
static tree
objc_build_component_ref (tree datum, tree component)
{
/* If COMPONENT is NULL, the caller is referring to the anonymous
base class field. */
if (!component)
{
tree base = TYPE_FIELDS (TREE_TYPE (datum));
1992-01-18 00:15:38 +01:00
objc-act.c (objc_build_struct): New function. * objc-act.c (objc_build_struct): New function. (objc_derived_from_p): Likewise. (objc_build_component_ref): Likewise. (objc_copy_binfo): Likewise. (objc_xref_basetypes): Likewise. (objc_lookup_protocol): Likewise. (objc_compare_protocols): Likewise. (objc_volatilize_decl): Likewise. (encode_aggregate_fields): Likewise. (volatilized_hash): Likewise. (volatilized_eq): Likewise. (objc_compare_types): Likewise. (objc_type_quals_match): Likewise. (DERIVED_FROM_P): New ObjC macro, corresponding to C++ macro of same name. (get_class_ivars): Add second parameter indicating if entire hierarchy is desired. (struct volatilized_type): New type. (volatilized_htab): New hash table. (objc_types_compatible_p, objc_comptypes): Remove functions. (synth_module_prologue): Do not initialize 'unused_list'. (objc_get_class_reference): Fix ObjC++ impedance mismatches. (objc_declare_alias): Implement as a typedef. (objc_substitute_decl, objc_gimplify_expr): Reformat. (objc_get_class_ivars): Adjust call to get_class_ivars(). (next_sjlj_build_enter_and_setjmp, synth_forward_declarations, build_ivar_reference, get_super_receiver): Call objc_build_component_ref() instead of build_component_ref(). (objc_begin_catch_clause): Use DERIVED_FROM_P() instead of objc_comptypes(). (build_private_template): Call objc_build_struct() instead of start_struct() and finish_struct(). (hash_init): Initialize volatilized_htab. (objc_is_public): Adjust calls to objc_get_ivars(); adjust ObjC++ impedance mismatches. (encode_aggregate_within): Streamline by calling encode_aggregate_fields(). * objc-act.h (objc_types_compatible_p): Remove prototype. (OCTI_UNUSED_LIST, unused_list): Remove slot. * objc-lang.c (LANG_HOOKS_TYPES_COMPATIBLE_P): Remove. From-SVN: r100123
2005-05-25 00:21:01 +02:00
return build3 (COMPONENT_REF, TREE_TYPE (base), datum, base, NULL_TREE);
}
1992-01-18 00:15:38 +01:00
objc-act.c (objc_build_struct): New function. * objc-act.c (objc_build_struct): New function. (objc_derived_from_p): Likewise. (objc_build_component_ref): Likewise. (objc_copy_binfo): Likewise. (objc_xref_basetypes): Likewise. (objc_lookup_protocol): Likewise. (objc_compare_protocols): Likewise. (objc_volatilize_decl): Likewise. (encode_aggregate_fields): Likewise. (volatilized_hash): Likewise. (volatilized_eq): Likewise. (objc_compare_types): Likewise. (objc_type_quals_match): Likewise. (DERIVED_FROM_P): New ObjC macro, corresponding to C++ macro of same name. (get_class_ivars): Add second parameter indicating if entire hierarchy is desired. (struct volatilized_type): New type. (volatilized_htab): New hash table. (objc_types_compatible_p, objc_comptypes): Remove functions. (synth_module_prologue): Do not initialize 'unused_list'. (objc_get_class_reference): Fix ObjC++ impedance mismatches. (objc_declare_alias): Implement as a typedef. (objc_substitute_decl, objc_gimplify_expr): Reformat. (objc_get_class_ivars): Adjust call to get_class_ivars(). (next_sjlj_build_enter_and_setjmp, synth_forward_declarations, build_ivar_reference, get_super_receiver): Call objc_build_component_ref() instead of build_component_ref(). (objc_begin_catch_clause): Use DERIVED_FROM_P() instead of objc_comptypes(). (build_private_template): Call objc_build_struct() instead of start_struct() and finish_struct(). (hash_init): Initialize volatilized_htab. (objc_is_public): Adjust calls to objc_get_ivars(); adjust ObjC++ impedance mismatches. (encode_aggregate_within): Streamline by calling encode_aggregate_fields(). * objc-act.h (objc_types_compatible_p): Remove prototype. (OCTI_UNUSED_LIST, unused_list): Remove slot. * objc-lang.c (LANG_HOOKS_TYPES_COMPATIBLE_P): Remove. From-SVN: r100123
2005-05-25 00:21:01 +02:00
/* The 'build_component_ref' routine has been removed from the C++
front-end, but 'finish_class_member_access_expr' seems to be
a worthy substitute. */
#ifdef OBJCPLUS
return finish_class_member_access_expr (datum, component, false);
objc-act.c (objc_build_struct): New function. * objc-act.c (objc_build_struct): New function. (objc_derived_from_p): Likewise. (objc_build_component_ref): Likewise. (objc_copy_binfo): Likewise. (objc_xref_basetypes): Likewise. (objc_lookup_protocol): Likewise. (objc_compare_protocols): Likewise. (objc_volatilize_decl): Likewise. (encode_aggregate_fields): Likewise. (volatilized_hash): Likewise. (volatilized_eq): Likewise. (objc_compare_types): Likewise. (objc_type_quals_match): Likewise. (DERIVED_FROM_P): New ObjC macro, corresponding to C++ macro of same name. (get_class_ivars): Add second parameter indicating if entire hierarchy is desired. (struct volatilized_type): New type. (volatilized_htab): New hash table. (objc_types_compatible_p, objc_comptypes): Remove functions. (synth_module_prologue): Do not initialize 'unused_list'. (objc_get_class_reference): Fix ObjC++ impedance mismatches. (objc_declare_alias): Implement as a typedef. (objc_substitute_decl, objc_gimplify_expr): Reformat. (objc_get_class_ivars): Adjust call to get_class_ivars(). (next_sjlj_build_enter_and_setjmp, synth_forward_declarations, build_ivar_reference, get_super_receiver): Call objc_build_component_ref() instead of build_component_ref(). (objc_begin_catch_clause): Use DERIVED_FROM_P() instead of objc_comptypes(). (build_private_template): Call objc_build_struct() instead of start_struct() and finish_struct(). (hash_init): Initialize volatilized_htab. (objc_is_public): Adjust calls to objc_get_ivars(); adjust ObjC++ impedance mismatches. (encode_aggregate_within): Streamline by calling encode_aggregate_fields(). * objc-act.h (objc_types_compatible_p): Remove prototype. (OCTI_UNUSED_LIST, unused_list): Remove slot. * objc-lang.c (LANG_HOOKS_TYPES_COMPATIBLE_P): Remove. From-SVN: r100123
2005-05-25 00:21:01 +02:00
#else
return build_component_ref (datum, component);
#endif
}
1992-01-18 00:15:38 +01:00
objc-act.c (objc_build_struct): New function. * objc-act.c (objc_build_struct): New function. (objc_derived_from_p): Likewise. (objc_build_component_ref): Likewise. (objc_copy_binfo): Likewise. (objc_xref_basetypes): Likewise. (objc_lookup_protocol): Likewise. (objc_compare_protocols): Likewise. (objc_volatilize_decl): Likewise. (encode_aggregate_fields): Likewise. (volatilized_hash): Likewise. (volatilized_eq): Likewise. (objc_compare_types): Likewise. (objc_type_quals_match): Likewise. (DERIVED_FROM_P): New ObjC macro, corresponding to C++ macro of same name. (get_class_ivars): Add second parameter indicating if entire hierarchy is desired. (struct volatilized_type): New type. (volatilized_htab): New hash table. (objc_types_compatible_p, objc_comptypes): Remove functions. (synth_module_prologue): Do not initialize 'unused_list'. (objc_get_class_reference): Fix ObjC++ impedance mismatches. (objc_declare_alias): Implement as a typedef. (objc_substitute_decl, objc_gimplify_expr): Reformat. (objc_get_class_ivars): Adjust call to get_class_ivars(). (next_sjlj_build_enter_and_setjmp, synth_forward_declarations, build_ivar_reference, get_super_receiver): Call objc_build_component_ref() instead of build_component_ref(). (objc_begin_catch_clause): Use DERIVED_FROM_P() instead of objc_comptypes(). (build_private_template): Call objc_build_struct() instead of start_struct() and finish_struct(). (hash_init): Initialize volatilized_htab. (objc_is_public): Adjust calls to objc_get_ivars(); adjust ObjC++ impedance mismatches. (encode_aggregate_within): Streamline by calling encode_aggregate_fields(). * objc-act.h (objc_types_compatible_p): Remove prototype. (OCTI_UNUSED_LIST, unused_list): Remove slot. * objc-lang.c (LANG_HOOKS_TYPES_COMPATIBLE_P): Remove. From-SVN: r100123
2005-05-25 00:21:01 +02:00
/* Recursively copy inheritance information rooted at BINFO. To do this,
we emulate the song and dance performed by cp/tree.c:copy_binfo(). */
objc-act.c (objc_build_struct): New function. * objc-act.c (objc_build_struct): New function. (objc_derived_from_p): Likewise. (objc_build_component_ref): Likewise. (objc_copy_binfo): Likewise. (objc_xref_basetypes): Likewise. (objc_lookup_protocol): Likewise. (objc_compare_protocols): Likewise. (objc_volatilize_decl): Likewise. (encode_aggregate_fields): Likewise. (volatilized_hash): Likewise. (volatilized_eq): Likewise. (objc_compare_types): Likewise. (objc_type_quals_match): Likewise. (DERIVED_FROM_P): New ObjC macro, corresponding to C++ macro of same name. (get_class_ivars): Add second parameter indicating if entire hierarchy is desired. (struct volatilized_type): New type. (volatilized_htab): New hash table. (objc_types_compatible_p, objc_comptypes): Remove functions. (synth_module_prologue): Do not initialize 'unused_list'. (objc_get_class_reference): Fix ObjC++ impedance mismatches. (objc_declare_alias): Implement as a typedef. (objc_substitute_decl, objc_gimplify_expr): Reformat. (objc_get_class_ivars): Adjust call to get_class_ivars(). (next_sjlj_build_enter_and_setjmp, synth_forward_declarations, build_ivar_reference, get_super_receiver): Call objc_build_component_ref() instead of build_component_ref(). (objc_begin_catch_clause): Use DERIVED_FROM_P() instead of objc_comptypes(). (build_private_template): Call objc_build_struct() instead of start_struct() and finish_struct(). (hash_init): Initialize volatilized_htab. (objc_is_public): Adjust calls to objc_get_ivars(); adjust ObjC++ impedance mismatches. (encode_aggregate_within): Streamline by calling encode_aggregate_fields(). * objc-act.h (objc_types_compatible_p): Remove prototype. (OCTI_UNUSED_LIST, unused_list): Remove slot. * objc-lang.c (LANG_HOOKS_TYPES_COMPATIBLE_P): Remove. From-SVN: r100123
2005-05-25 00:21:01 +02:00
static tree
objc_copy_binfo (tree binfo)
{
tree btype = BINFO_TYPE (binfo);
tree binfo2 = make_tree_binfo (BINFO_N_BASE_BINFOS (binfo));
tree base_binfo;
int ix;
1992-01-18 00:15:38 +01:00
objc-act.c (objc_build_struct): New function. * objc-act.c (objc_build_struct): New function. (objc_derived_from_p): Likewise. (objc_build_component_ref): Likewise. (objc_copy_binfo): Likewise. (objc_xref_basetypes): Likewise. (objc_lookup_protocol): Likewise. (objc_compare_protocols): Likewise. (objc_volatilize_decl): Likewise. (encode_aggregate_fields): Likewise. (volatilized_hash): Likewise. (volatilized_eq): Likewise. (objc_compare_types): Likewise. (objc_type_quals_match): Likewise. (DERIVED_FROM_P): New ObjC macro, corresponding to C++ macro of same name. (get_class_ivars): Add second parameter indicating if entire hierarchy is desired. (struct volatilized_type): New type. (volatilized_htab): New hash table. (objc_types_compatible_p, objc_comptypes): Remove functions. (synth_module_prologue): Do not initialize 'unused_list'. (objc_get_class_reference): Fix ObjC++ impedance mismatches. (objc_declare_alias): Implement as a typedef. (objc_substitute_decl, objc_gimplify_expr): Reformat. (objc_get_class_ivars): Adjust call to get_class_ivars(). (next_sjlj_build_enter_and_setjmp, synth_forward_declarations, build_ivar_reference, get_super_receiver): Call objc_build_component_ref() instead of build_component_ref(). (objc_begin_catch_clause): Use DERIVED_FROM_P() instead of objc_comptypes(). (build_private_template): Call objc_build_struct() instead of start_struct() and finish_struct(). (hash_init): Initialize volatilized_htab. (objc_is_public): Adjust calls to objc_get_ivars(); adjust ObjC++ impedance mismatches. (encode_aggregate_within): Streamline by calling encode_aggregate_fields(). * objc-act.h (objc_types_compatible_p): Remove prototype. (OCTI_UNUSED_LIST, unused_list): Remove slot. * objc-lang.c (LANG_HOOKS_TYPES_COMPATIBLE_P): Remove. From-SVN: r100123
2005-05-25 00:21:01 +02:00
BINFO_TYPE (binfo2) = btype;
BINFO_OFFSET (binfo2) = BINFO_OFFSET (binfo);
BINFO_BASE_ACCESSES (binfo2) = BINFO_BASE_ACCESSES (binfo);
/* Recursively copy base binfos of BINFO. */
for (ix = 0; BINFO_BASE_ITERATE (binfo, ix, base_binfo); ix++)
1992-01-18 00:15:38 +01:00
{
objc-act.c (objc_build_struct): New function. * objc-act.c (objc_build_struct): New function. (objc_derived_from_p): Likewise. (objc_build_component_ref): Likewise. (objc_copy_binfo): Likewise. (objc_xref_basetypes): Likewise. (objc_lookup_protocol): Likewise. (objc_compare_protocols): Likewise. (objc_volatilize_decl): Likewise. (encode_aggregate_fields): Likewise. (volatilized_hash): Likewise. (volatilized_eq): Likewise. (objc_compare_types): Likewise. (objc_type_quals_match): Likewise. (DERIVED_FROM_P): New ObjC macro, corresponding to C++ macro of same name. (get_class_ivars): Add second parameter indicating if entire hierarchy is desired. (struct volatilized_type): New type. (volatilized_htab): New hash table. (objc_types_compatible_p, objc_comptypes): Remove functions. (synth_module_prologue): Do not initialize 'unused_list'. (objc_get_class_reference): Fix ObjC++ impedance mismatches. (objc_declare_alias): Implement as a typedef. (objc_substitute_decl, objc_gimplify_expr): Reformat. (objc_get_class_ivars): Adjust call to get_class_ivars(). (next_sjlj_build_enter_and_setjmp, synth_forward_declarations, build_ivar_reference, get_super_receiver): Call objc_build_component_ref() instead of build_component_ref(). (objc_begin_catch_clause): Use DERIVED_FROM_P() instead of objc_comptypes(). (build_private_template): Call objc_build_struct() instead of start_struct() and finish_struct(). (hash_init): Initialize volatilized_htab. (objc_is_public): Adjust calls to objc_get_ivars(); adjust ObjC++ impedance mismatches. (encode_aggregate_within): Streamline by calling encode_aggregate_fields(). * objc-act.h (objc_types_compatible_p): Remove prototype. (OCTI_UNUSED_LIST, unused_list): Remove slot. * objc-lang.c (LANG_HOOKS_TYPES_COMPATIBLE_P): Remove. From-SVN: r100123
2005-05-25 00:21:01 +02:00
tree base_binfo2 = objc_copy_binfo (base_binfo);
BINFO_INHERITANCE_CHAIN (base_binfo2) = binfo2;
BINFO_BASE_APPEND (binfo2, base_binfo2);
}
return binfo2;
}
/* Record superclass information provided in BASETYPE for ObjC class REF.
This is loosely based on cp/decl.c:xref_basetypes(). */
1992-01-18 00:15:38 +01:00
objc-act.c (objc_build_struct): New function. * objc-act.c (objc_build_struct): New function. (objc_derived_from_p): Likewise. (objc_build_component_ref): Likewise. (objc_copy_binfo): Likewise. (objc_xref_basetypes): Likewise. (objc_lookup_protocol): Likewise. (objc_compare_protocols): Likewise. (objc_volatilize_decl): Likewise. (encode_aggregate_fields): Likewise. (volatilized_hash): Likewise. (volatilized_eq): Likewise. (objc_compare_types): Likewise. (objc_type_quals_match): Likewise. (DERIVED_FROM_P): New ObjC macro, corresponding to C++ macro of same name. (get_class_ivars): Add second parameter indicating if entire hierarchy is desired. (struct volatilized_type): New type. (volatilized_htab): New hash table. (objc_types_compatible_p, objc_comptypes): Remove functions. (synth_module_prologue): Do not initialize 'unused_list'. (objc_get_class_reference): Fix ObjC++ impedance mismatches. (objc_declare_alias): Implement as a typedef. (objc_substitute_decl, objc_gimplify_expr): Reformat. (objc_get_class_ivars): Adjust call to get_class_ivars(). (next_sjlj_build_enter_and_setjmp, synth_forward_declarations, build_ivar_reference, get_super_receiver): Call objc_build_component_ref() instead of build_component_ref(). (objc_begin_catch_clause): Use DERIVED_FROM_P() instead of objc_comptypes(). (build_private_template): Call objc_build_struct() instead of start_struct() and finish_struct(). (hash_init): Initialize volatilized_htab. (objc_is_public): Adjust calls to objc_get_ivars(); adjust ObjC++ impedance mismatches. (encode_aggregate_within): Streamline by calling encode_aggregate_fields(). * objc-act.h (objc_types_compatible_p): Remove prototype. (OCTI_UNUSED_LIST, unused_list): Remove slot. * objc-lang.c (LANG_HOOKS_TYPES_COMPATIBLE_P): Remove. From-SVN: r100123
2005-05-25 00:21:01 +02:00
static void
objc_xref_basetypes (tree ref, tree basetype)
{
tree binfo = make_tree_binfo (basetype ? 1 : 0);
1992-01-18 00:15:38 +01:00
objc-act.c (objc_build_struct): New function. * objc-act.c (objc_build_struct): New function. (objc_derived_from_p): Likewise. (objc_build_component_ref): Likewise. (objc_copy_binfo): Likewise. (objc_xref_basetypes): Likewise. (objc_lookup_protocol): Likewise. (objc_compare_protocols): Likewise. (objc_volatilize_decl): Likewise. (encode_aggregate_fields): Likewise. (volatilized_hash): Likewise. (volatilized_eq): Likewise. (objc_compare_types): Likewise. (objc_type_quals_match): Likewise. (DERIVED_FROM_P): New ObjC macro, corresponding to C++ macro of same name. (get_class_ivars): Add second parameter indicating if entire hierarchy is desired. (struct volatilized_type): New type. (volatilized_htab): New hash table. (objc_types_compatible_p, objc_comptypes): Remove functions. (synth_module_prologue): Do not initialize 'unused_list'. (objc_get_class_reference): Fix ObjC++ impedance mismatches. (objc_declare_alias): Implement as a typedef. (objc_substitute_decl, objc_gimplify_expr): Reformat. (objc_get_class_ivars): Adjust call to get_class_ivars(). (next_sjlj_build_enter_and_setjmp, synth_forward_declarations, build_ivar_reference, get_super_receiver): Call objc_build_component_ref() instead of build_component_ref(). (objc_begin_catch_clause): Use DERIVED_FROM_P() instead of objc_comptypes(). (build_private_template): Call objc_build_struct() instead of start_struct() and finish_struct(). (hash_init): Initialize volatilized_htab. (objc_is_public): Adjust calls to objc_get_ivars(); adjust ObjC++ impedance mismatches. (encode_aggregate_within): Streamline by calling encode_aggregate_fields(). * objc-act.h (objc_types_compatible_p): Remove prototype. (OCTI_UNUSED_LIST, unused_list): Remove slot. * objc-lang.c (LANG_HOOKS_TYPES_COMPATIBLE_P): Remove. From-SVN: r100123
2005-05-25 00:21:01 +02:00
TYPE_BINFO (ref) = binfo;
BINFO_OFFSET (binfo) = size_zero_node;
BINFO_TYPE (binfo) = ref;
objc-act.c (objc_build_struct): New function. * objc-act.c (objc_build_struct): New function. (objc_derived_from_p): Likewise. (objc_build_component_ref): Likewise. (objc_copy_binfo): Likewise. (objc_xref_basetypes): Likewise. (objc_lookup_protocol): Likewise. (objc_compare_protocols): Likewise. (objc_volatilize_decl): Likewise. (encode_aggregate_fields): Likewise. (volatilized_hash): Likewise. (volatilized_eq): Likewise. (objc_compare_types): Likewise. (objc_type_quals_match): Likewise. (DERIVED_FROM_P): New ObjC macro, corresponding to C++ macro of same name. (get_class_ivars): Add second parameter indicating if entire hierarchy is desired. (struct volatilized_type): New type. (volatilized_htab): New hash table. (objc_types_compatible_p, objc_comptypes): Remove functions. (synth_module_prologue): Do not initialize 'unused_list'. (objc_get_class_reference): Fix ObjC++ impedance mismatches. (objc_declare_alias): Implement as a typedef. (objc_substitute_decl, objc_gimplify_expr): Reformat. (objc_get_class_ivars): Adjust call to get_class_ivars(). (next_sjlj_build_enter_and_setjmp, synth_forward_declarations, build_ivar_reference, get_super_receiver): Call objc_build_component_ref() instead of build_component_ref(). (objc_begin_catch_clause): Use DERIVED_FROM_P() instead of objc_comptypes(). (build_private_template): Call objc_build_struct() instead of start_struct() and finish_struct(). (hash_init): Initialize volatilized_htab. (objc_is_public): Adjust calls to objc_get_ivars(); adjust ObjC++ impedance mismatches. (encode_aggregate_within): Streamline by calling encode_aggregate_fields(). * objc-act.h (objc_types_compatible_p): Remove prototype. (OCTI_UNUSED_LIST, unused_list): Remove slot. * objc-lang.c (LANG_HOOKS_TYPES_COMPATIBLE_P): Remove. From-SVN: r100123
2005-05-25 00:21:01 +02:00
if (basetype)
{
tree base_binfo = objc_copy_binfo (TYPE_BINFO (basetype));
objc-act.c (objc_build_struct): New function. * objc-act.c (objc_build_struct): New function. (objc_derived_from_p): Likewise. (objc_build_component_ref): Likewise. (objc_copy_binfo): Likewise. (objc_xref_basetypes): Likewise. (objc_lookup_protocol): Likewise. (objc_compare_protocols): Likewise. (objc_volatilize_decl): Likewise. (encode_aggregate_fields): Likewise. (volatilized_hash): Likewise. (volatilized_eq): Likewise. (objc_compare_types): Likewise. (objc_type_quals_match): Likewise. (DERIVED_FROM_P): New ObjC macro, corresponding to C++ macro of same name. (get_class_ivars): Add second parameter indicating if entire hierarchy is desired. (struct volatilized_type): New type. (volatilized_htab): New hash table. (objc_types_compatible_p, objc_comptypes): Remove functions. (synth_module_prologue): Do not initialize 'unused_list'. (objc_get_class_reference): Fix ObjC++ impedance mismatches. (objc_declare_alias): Implement as a typedef. (objc_substitute_decl, objc_gimplify_expr): Reformat. (objc_get_class_ivars): Adjust call to get_class_ivars(). (next_sjlj_build_enter_and_setjmp, synth_forward_declarations, build_ivar_reference, get_super_receiver): Call objc_build_component_ref() instead of build_component_ref(). (objc_begin_catch_clause): Use DERIVED_FROM_P() instead of objc_comptypes(). (build_private_template): Call objc_build_struct() instead of start_struct() and finish_struct(). (hash_init): Initialize volatilized_htab. (objc_is_public): Adjust calls to objc_get_ivars(); adjust ObjC++ impedance mismatches. (encode_aggregate_within): Streamline by calling encode_aggregate_fields(). * objc-act.h (objc_types_compatible_p): Remove prototype. (OCTI_UNUSED_LIST, unused_list): Remove slot. * objc-lang.c (LANG_HOOKS_TYPES_COMPATIBLE_P): Remove. From-SVN: r100123
2005-05-25 00:21:01 +02:00
BINFO_INHERITANCE_CHAIN (base_binfo) = binfo;
BINFO_BASE_ACCESSES (binfo) = VEC_alloc (tree, gc, 1);
BINFO_BASE_APPEND (binfo, base_binfo);
BINFO_BASE_ACCESS_APPEND (binfo, access_public_node);
1992-01-18 00:15:38 +01:00
}
objc-act.c (objc_build_struct): New function. * objc-act.c (objc_build_struct): New function. (objc_derived_from_p): Likewise. (objc_build_component_ref): Likewise. (objc_copy_binfo): Likewise. (objc_xref_basetypes): Likewise. (objc_lookup_protocol): Likewise. (objc_compare_protocols): Likewise. (objc_volatilize_decl): Likewise. (encode_aggregate_fields): Likewise. (volatilized_hash): Likewise. (volatilized_eq): Likewise. (objc_compare_types): Likewise. (objc_type_quals_match): Likewise. (DERIVED_FROM_P): New ObjC macro, corresponding to C++ macro of same name. (get_class_ivars): Add second parameter indicating if entire hierarchy is desired. (struct volatilized_type): New type. (volatilized_htab): New hash table. (objc_types_compatible_p, objc_comptypes): Remove functions. (synth_module_prologue): Do not initialize 'unused_list'. (objc_get_class_reference): Fix ObjC++ impedance mismatches. (objc_declare_alias): Implement as a typedef. (objc_substitute_decl, objc_gimplify_expr): Reformat. (objc_get_class_ivars): Adjust call to get_class_ivars(). (next_sjlj_build_enter_and_setjmp, synth_forward_declarations, build_ivar_reference, get_super_receiver): Call objc_build_component_ref() instead of build_component_ref(). (objc_begin_catch_clause): Use DERIVED_FROM_P() instead of objc_comptypes(). (build_private_template): Call objc_build_struct() instead of start_struct() and finish_struct(). (hash_init): Initialize volatilized_htab. (objc_is_public): Adjust calls to objc_get_ivars(); adjust ObjC++ impedance mismatches. (encode_aggregate_within): Streamline by calling encode_aggregate_fields(). * objc-act.h (objc_types_compatible_p): Remove prototype. (OCTI_UNUSED_LIST, unused_list): Remove slot. * objc-lang.c (LANG_HOOKS_TYPES_COMPATIBLE_P): Remove. From-SVN: r100123
2005-05-25 00:21:01 +02:00
}
static hashval_t
volatilized_hash (const void *ptr)
{
tree typ = ((struct volatilized_type *)ptr)->type;
return htab_hash_pointer(typ);
objc-act.c (objc_build_struct): New function. * objc-act.c (objc_build_struct): New function. (objc_derived_from_p): Likewise. (objc_build_component_ref): Likewise. (objc_copy_binfo): Likewise. (objc_xref_basetypes): Likewise. (objc_lookup_protocol): Likewise. (objc_compare_protocols): Likewise. (objc_volatilize_decl): Likewise. (encode_aggregate_fields): Likewise. (volatilized_hash): Likewise. (volatilized_eq): Likewise. (objc_compare_types): Likewise. (objc_type_quals_match): Likewise. (DERIVED_FROM_P): New ObjC macro, corresponding to C++ macro of same name. (get_class_ivars): Add second parameter indicating if entire hierarchy is desired. (struct volatilized_type): New type. (volatilized_htab): New hash table. (objc_types_compatible_p, objc_comptypes): Remove functions. (synth_module_prologue): Do not initialize 'unused_list'. (objc_get_class_reference): Fix ObjC++ impedance mismatches. (objc_declare_alias): Implement as a typedef. (objc_substitute_decl, objc_gimplify_expr): Reformat. (objc_get_class_ivars): Adjust call to get_class_ivars(). (next_sjlj_build_enter_and_setjmp, synth_forward_declarations, build_ivar_reference, get_super_receiver): Call objc_build_component_ref() instead of build_component_ref(). (objc_begin_catch_clause): Use DERIVED_FROM_P() instead of objc_comptypes(). (build_private_template): Call objc_build_struct() instead of start_struct() and finish_struct(). (hash_init): Initialize volatilized_htab. (objc_is_public): Adjust calls to objc_get_ivars(); adjust ObjC++ impedance mismatches. (encode_aggregate_within): Streamline by calling encode_aggregate_fields(). * objc-act.h (objc_types_compatible_p): Remove prototype. (OCTI_UNUSED_LIST, unused_list): Remove slot. * objc-lang.c (LANG_HOOKS_TYPES_COMPATIBLE_P): Remove. From-SVN: r100123
2005-05-25 00:21:01 +02:00
}
static int
volatilized_eq (const void *ptr1, const void *ptr2)
{
tree typ1 = ((struct volatilized_type *)ptr1)->type;
tree typ2 = ((struct volatilized_type *)ptr2)->type;
return typ1 == typ2;
1992-01-18 00:15:38 +01:00
}
/* Called from finish_decl. */
1992-01-18 00:15:38 +01:00
void
objc_check_decl (tree decl)
{
tree type = TREE_TYPE (decl);
if (TREE_CODE (type) != RECORD_TYPE)
return;
c-parse.in (primary): Call objc_build_message_expr()... [gcc/ChangeLog] 2004-09-01 Ziemowit Laski <zlaski@apple.com> * c-parse.in (primary): Call objc_build_message_expr(), objc_build_selector_expr(), objc_build_protocol_expr(), objc_build_encode_expr() and objc_build_string_object() instead of build_message_expr(), build_selector_expr(), build_protocol_expr(), build_encode_expr() and build_objc_string_object(), respectively. (component_decl_list2): Call objc_get_class_ivars() instead of get_class_ivars_from_name(). (keyworddecl): Call objc_build_keyword_decl() instead of build_keyword_decl(). (receiver): Call objc_get_class_reference() instead of get_class_reference(). (reswords): Add blank line before @@ifobjc section, for clarity. [gcc/objc/ChangeLog] 2004-09-01 Ziemowit Laski <zlaski@apple.com> * objc-act.c (objc_check_decl): Use OBJC_TYPE_NAME macro instead of TYPE_NAME. (build_objc_string_object): Rename to objc_build_string_object(). (get_class_reference): Rename to objc_get_class_reference(). (get_class_ivars_from_name): Rename to objc_get_class_ivars(). (next_sjlj_build_catch_list, get_super_receiver): Call objc_get_class_reference() instead of get_class_reference(). (build_keyword_decl): Rename to objc_build_keyword_decl(). (build_message_expr): Rename to objc_build_message_expr(). (build_protocol_expr): Rename to objc_build_protocol_expr(). (build_selector_expr): Rename to objc_build_selector_expr(). (build_encode_expr): Rename to objc_build_encode_expr(). * objc-act.h (get_class_ivars_from_name): Rename prototype to objc_get_class_ivars(). (get_class_reference): Rename prototype to objc_get_class_reference(). (build_message_expr): Rename prototype to objc_build_message_expr(). (build_selector_expr): Rename prototype to objc_build_selector_expr(). (build_keyword_decl): Rename prototype to objc_build_keyword_decl(). (build_protocol_expr): Rename prototype to objc_build_prototype_expr(). (build_objc_string_object): Rename prototype to objc_build_string_object(). From-SVN: r86950
2004-09-02 02:36:18 +02:00
if (OBJC_TYPE_NAME (type) && (type = objc_is_class_name (OBJC_TYPE_NAME (type))))
builtins.c, [...]: Avoid "`" as left quote, using "'" or %q, %< and %> as appropriate. * builtins.c, c-common.c, c-decl.c, c-format.c, c-format.h, c-parse.in, c-pch.c, c-pragma.c, collect2.c, final.c, gcc.c, gcov.c, opts.c, pretty-print.h, protoize.c, reg-stack.c, rtl.c, tlink.c, config/alpha/alpha.c, config/arc/arc.c, config/arm/arm.c, config/avr/avr.c, config/c4x/c4x.c, config/darwin.c, config/frv/frv.c, config/h8300/h8300.c, config/i386/i386.c, config/i386/winnt.c, config/ia64/ia64.c, config/ip2k/ip2k.c, config/iq2000/iq2000.c, config/m32r/m32r.c, config/m68hc11/m68hc11.c, config/m68k/m68k.c, config/m68k/m68k.h, config/mcore/mcore.c, config/mips/mips.c, config/mmix/mmix.c, config/ns32k/ns32k.c, config/rs6000/host-darwin.c, config/rs6000/rs6000.c, config/s390/s390.c, config/sh/sh.c, config/sh/symbian.c, config/stormy16/stormy16.c, config/v850/v850.c: Avoid "`" as left quote, using "'" or %q, %< and %> as appropriate. Use %' as apostrophe in diagnostics where applicable. Use %< and %> in place of '' quotes where applicable. Use %qs in place of %<%s%>. Consistently quote __builtin function names. ada: * misc.c (gnat_handle_option): Use %< and %> for quoting in warning message. cp: * call.c, class.c, decl.c, decl2.c, error.c, mangle.c, parser.c, pt.c, search.c, semantics.c, typeck.c: Use %q, %< and %> for quoting in diagnostics. * parser.c (cp_parser_sizeof_operand): Use '' instead of `' for quoting in printf format. * decl.c (duplicate_decls, start_decl): Use %qD instead of unquoted %D. objc: * objc-act.c: Use %q, %< and %> for quoting in diagnostics. testsuite: * gcc.dg/builtin-prefetch-1.c: Adjust expected messages. From-SVN: r90337
2004-11-09 11:13:30 +01:00
error ("statically allocated instance of Objective-C class %qs",
IDENTIFIER_POINTER (type));
}
Makefile.in (c-parse.o): Depend on $(C_COMMON_H). [gcc/ChangeLog] 2004-09-07 Ziemowit Laski <zlaski@apple.com> * Makefile.in (c-parse.o): Depend on $(C_COMMON_H). * c-parse.in: Include c-common.h instead of objc-act.h. (ivar_decl_list, ivar_decls, ivar_decl, ivars, ivar_declarator, myparms, myparm): Remove %type declarations. (methodtype, optparms, OBJC_TYPE_QUAL, objc_quals, objc_qual, objc_typename, objc_try_catch_stmt, optellipsis): Add %type declarations. (objc_inherit_code, objc_public_flag): Remove. (typespec_nonreserved_nonattr): Call objc_get_protocol_qualified_type() instead of get_static_reference() and get_protocol_reference(). (stmt_nocomp): Call grokparm() on @catch parameter. (objcdef): Move semantic action to objc_finish_implementation(). (classdef): Move semantic action to objc_start_class_interface(), objc_continue_interface(), objc_finish_interface(), objc_start_class_implementation(), objc_continue_implementation(), objc_start_category_interface() and objc_start_category_implementation(). (protocoldef): Move semantic actions to objc_start_protocol() and objc_finish_interface(). (ivar_decl_list): Remove nonterminal. (visibility_spec): Move semantic actions to objc_set_visibility(). (ivar_decls): Remove assignment to $$. (ivar_decl): Rephrase in terms of component_decl; call objc_add_instance_variable(). (ivars, ivar_declarator): Remove nonterminals. (opt_semi): New nonterminal. (methodtype): Remove semantic actions. (methoddef): Move semantic actions to objc_set_method_type(), objc_start_method_definition() and objc_finish_method_definition(). (methodproto): Move semantic actions to objc_set_method_type() and objc_add_method_declaration(). (methoddecl): Use objc_typename instead of typename; move semantic actions to objc_build_method_signature(). (optarglist, myxdecls, mydecl, myparms, myparm): Remove nonterminals. (optparmlist): Express in terms of optparms and optellipsis. (optparms, optellipsis, objc_qual, objc_quals, objc_typename): New nonterminals. (keyworddecl): Use objc_typename instead of typename. (rid_to_yy): Mark RID_IN, RID_OUT, RID_INOUT, RID_BYCOPY, RID_BYREF and RID_ONEWAY as returning OBJC_TYPE_QUAL to yyparse(). [gcc/objc/ChangeLog] 2004-09-07 Ziemowit Laski <zlaski@apple.com> * Make-lang.in (objc/objc-parse.o): Depend on $(C_COMMON_H) instead of objc/objc-act.h. (objc/objc-act.o): Depend on $(HASHTAB_H). * objc-act.c: Include hashtab.h; in ObjC++ mode, include cp-tree.h and objcp-decl.h instead of c-tree.h. (build_module_descriptor, get_class_ivars, synth_id_with_class_suffix, error_with_ivar, gen_method_decl, gen_declaration, setup_string_decl, build_protocol_template): Adjust prototypes. (build_module_initializer_routine, start_class, continue_class, finish_class, start_method_def, objc_start_function, start_protocol, build_method_decl, objc_add_method, add_instance_variable, build_ivar_reference, is_ivar, is_private, get_super_receiver, build_selector_table_decl, objc_push_parm, objc_get_parm_info, gen_type_name, gen_type_name_0, start_var_decl, finish_var_decl, create_field_decl): New prototypes. (objc_expand_function_end, comp_method_with_proto, objc_expr_last, gen_declaration_1, gen_declarator, is_complex_decl, adorn_decl, define_decl, create_builtin_decl, gen_declspecs): Remove prototypes. (TYPE_ID): Rename to OBJECT_TYPEDEF_NAME. (CLASS_TYPEDEF_NAME): New. (TAG_EXECCLASS): Change from a global variable to a #define. (TAG_RETURN_STRUCT): Delete. (TAG_GNUINIT): New, holds '__objc_gnu_init' name. (objc_inherit_code, objc_public_flag): New, moved from c-parse.in. (string_descriptor): New struct. (string_htab): New hash table. (string_hash, string_eq): New prototypes. (generate_struct_by_value_array): Call create_field_decl() instead of create_builtin_decl(). (objc_init): Do not initialize objc_ellipsis_node or TAG_EXECCLASS; In ObjC++ mode, call cxx_init() instead of c_objc_common_init(). (objc_finish_file): In ObjC++, call instantiate_pending_templates() and cp_finish_file(). (define_decl, get_static_reference, get_protocol_reference, create_builtin_decl): Remove functions. (objc_start_class_interface, objc_start_category_interface, objc_start_protocol, objc_continue_interface, objc_finish_interface, objc_start_class_implementation, objc_start_category_implementation, objc_continue_implementation, objc_finish_implementation, objc_set_visibility, objc_set_method_type, objc_build_method_signature, objc_add_method_declaration, objc_start_method_definition, objc_add_instance_variable, objc_get_protocol_qualified_type, create_field_decl, start_var_decl, finish_var_decl): New functions. (setup_string_decl): Simplify since it is only called once. (synth_module_prologue): Call build_class_template(); predefine 'id' and 'Class' as typedefs; rename 'temp_type' to 'type'; disable debug hooks for duration of function; fix GNU runtime messenger signatures to correspond to reality; forward-declare '__objc_exec_class' for the GNU runtime; call build_selector_table_decl(); in ObjC++ mode, generate 'extern "C" { ... }' wrappers around synthesized declarations; call build_protocol_template() and build_category_template(). (string_hash, string_eq): New functions. (objc_build_string_object): Check metaclass correctness only once; store string literals in hash table. (objc_build_constructor): Do not convert initializer elements; adjust for ObjC++ impedance mismatch. (build_objc_symtab_template): Call create_field_decl() instead of create_builtin_decl(). (init_objc_symtab): Add missing conversion to initializer element. (build_metadata_decl): Call start_var_decl() instead of define_decl(). (generate_objc_symtab_decl): Do not call build_category_template(); call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(). (build_module_descriptor): Call create_field_decl() instead of grokfield(); call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(); always mark module descriptor as used; move GNU runtime-specific functionality to build_module_initializer_routine(). (build_module_initializer_routine): New function, broken off of build_module_descriptor(). (objc_static_init_needed_p, objc_generate_static_init_call): New functions. (generate_static_references, generate_strings, build_selector_translation_table, generate_descriptor_table, generate_ivars_list, generate_dispatch_table, generate_category): Call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(); build a type directly instead of via groktypename(). (build_selector_reference_decl, build_selector_table_decl, build_class_reference_decl, build_protocol_reference, generate_objc_image_info): Call start_var_decl() instead of build_decl(). (build_selector_reference): For GNU runtime, do not call build_selector_reference_decl(). (build_selector, build_typed_selector_reference): Always convert result to the selector type. (add_objc_string): Cast return value to 'char *'. (build_method_prototype_template, build_selector_template, build_method_template): Use actual selector type for fields pointing to selectors. (finish_objc): For GNU runtime, call build_module_initializer_routine() after build_module_descriptor(). (generate_protocol_list, generate_shared_structures): Call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(); build a type directly instead of via groktypename(). (synth_id_with_class_suffix): Return a string. (get_arg_type_list): For instance methods, use the instance type for 'self'; do not call groktypename_in_parm_context(). (build_objc_string_decl): Squash redeclaration errors in ObjC++. (objc_is_class_name): Use OBJC_TYPE_NAME instead of TYPE_NAME; handle RECORD_TYPEs in ObjC as well as ObjC++. (objc_is_id): New function. (objc_is_object_ptr): Return the canonical type node. (objc_get_class_ivars): Simplify using get_class_ivars(). (get_class_ivars): Remove second parameter; create a fresh copy of the ivar list for each call; do not check for existence of super class. (objc_eh_runtime_type): Mark #ifndef OBJCPLUS. (objc_init_exceptions): When using SJLJ-style exceptions, require the use of '-fobjc-exceptions' flag; do not require it for DWARF-style exceptions. (objc_build_exc_ptr, next_sjlj_build_try_catch_finally): Use objc_object_type instead of objc_id_type. (objc_begin_catch_clause): Convert the incoming PARM_DECL into a VAR_DECL before placing it in the appropriate scope; do not call define_decl(); adjust call to c_begin_compound_stmt(); use objc_object_type instead of objc_id_type. (build_next_objc_exception_stuff): Call create_field_decl() instead of create_builtin_decl(); construct type directly instead of calling groktypename(); use OBJC_VOID_AT_END to mark end of function parameters. (build_private_template): Adjust call to get_class_ivars(); build a type directly instead of via groktypename(). (build_protocol_template, build_method_prototype_list_template, build_method_prototype_template, build_category_template, build_selector_template, build_class_template, build_super_template, build_ivar_template, build_ivar_list_template, build_method_list_template, build_method_template): Call create_field_decl() instead of grokfield(). (objc_method_parm_type): Do not call groktypename(). (generate_descriptor_table): Call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(). (generate_method_descriptors, build_protocol_initializer, generate_dispatch_tables, build_category_initializer, build_shared_structure_initializer): Do not call groktypename(). (generate_protocols): Call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(); do not call groktypename(). (error_with_ivar): Remove last parameter. (check_ivars): Do not iterate ovar CLASS_RAW_IVARS lists in addition to CLASS_IVARS lists; adjust calls to error_with_ivar(). (generate_ivar_lists): Convert one of the initializer elements; do not call groktypename(). (get_arg_type_list, start_method_def, gen_method_def): Account for new representation of variable arguments and '...' in Objective-C methods; add Objective-C++ impedance matching code. (is_objc_type_qualifier): Remove function. (adjust_type_for_id_default): Simplify; there is no longer a need to wade through declspecs. (lookup_interface, start_class, continue_class, finish_class, start_method_def, start_protocol, build_method_decl, objc_add_method, add_instance_variable, build_ivar_reference, is_ivar, is_private, get_super_receiver, objc_build_finally_epilogue): Make into static functions. (receiver_is_class_object): Use new IS_CLASS() macro. (objc_build_message_expr): Tweak ObjC++ message argument handling; call objc_finish_message_expr() instead of finish_message_expr(). (finish_message_expr): Rename to objc_finish_message_expr(); use OBJC_TYPE_NAME and OBJC_SET_TYPE_NAME macros instead of TYPE_NAME. call gen_type_name() instead of gen_declaration(); call objc_is_id() instead of using IS_ID and IS_CLASS; Use objc_class_name instead of calling get_identifier("Class"); handle CONVERT_EXPRs in receiver. (build_objc_method_call, warn_with_method): Do not call groktypename(). (build_ivar_reference): Call convert() instead of clobbering in a type. (hash_init): Initialize string_htab hash table. (add_instance_variable): Simplify parameter list; do not call grokfield(); do not populate CLASS_IVARS list. (start_class): Check for the existence of super class, if one was specified. (continue_class): Use CLASS_RAW_IVARS rather than CLASS_IVARS; do not call build_class_template(); adjust call to get_class_ivars(); call build_decl(), pushdecl() and finish_decl() instead of define_decl(). (finish_class): Call build_decl(), pushdecl() and finish_decl() instead of define_decl(). (add_protocols): Use PROTOCOL_BINFO_ELTS for the tree vector size. (start_protocol): Do not call build_protocol_template(); use PROTOCOL_BINFO_ELTS for the tree vector size. (encode_type_qualifiers): Do not handle the 'const' qualifier here. (encode_pointer): Encode 'const char *' as 'r*', for backwards compatibility. (encode_array): Use HOST_WIDE_INT_PRINT_DEC instead of "%ld". (encode_type): Handle the 'const' qualifier here. (objc_parmlist): New global variable, sued by objc_push_parm and objc_get_parm_info(). (objc_push_parm, objc_get_parm_info): New functions. (objc_expr_last): Remove function. (synth_self_and_ucmd_args): For instance methods, use the instance type for 'self'; call objc_push_parm() instead of push_parm_decl(). (start_method_def): Do not call push_scope(), declare_parm_level(), pop_scope(), push_parm_decl(), store_parm_decls() or objc_expr_last(); just use objc_push_parm() and objc_get_parm_info(). (comp_method_with_proto): Remove function. (objc_types_are_equivalent): Strip away indirections before comparing underlying types. (comp_proto_with_proto): Do not call groktypename(); types are no longer in raw declspec format. (objc_start_function): New function. (really_start_method): Call comp_proto_with_proto() instead of comp_method_with_proto(); call objc_start_function() instead of hand-crafting a function declarator. (continue_method_def, objc_expand_function_end): Remove functions. (get_super_receiver): Call objc_get_current_scope() instead of get_current_scope(); reference 'super_class' field (instead of 'class'). (finish_method_def): Rename to objc_finish_method_definition() and add a function decl parameter; move method encoding call from objc_expand_function_end(). (is_complex_decl, adorn_decl, gen_declarator, gen_declspecs, gen_declaration_1): Remove functions. (tmpbuf, RAW_DECLSPEC): Remove. (gen_declaration): Remove second parameter; simplify to deal with TYPE_P nodes instead of raw declspecs. (gen_type_name, gen_type_name_0): New functions. (gen_method_decl): Remove second parameter; call gen_type_name() instead of gen_declaration_1(). (dump_interface): Adjust calls to gen_declaration() and gen_method_decl(); do not allocate a separate string buffer. (init_objc): Allocate a larger string buffer to accommodate dump_interface(); adjust call to build_module_descriptor(); add call to build_module_initializer_routine() for the GNU runtime. (generate_classref_translation_entry): Do not call start_decl(); call finish_var_decl() instead of finish_decl(); call convert() instead of build_c_cast(). * objc-act.h (CLASS_OWN_IVARS): Remove accessor. (CLASS_BINFO_ELTS): Reduce from 6 to 5, now that CLASS_OWN_IVARS is gone. (OCTI_GNU_INIT_DECL, GNU_INIT_decl): New. (OCTI_ELLIPSIS_NODE, objc_ellipsis_node): Remove. (OCTI_ID_ID, id_type, objc_id_id): Rename to OCTI_ID_NAME, objc_object_type and objc_object_name, respectively. (OCTI_CLS_REF, OCTI_CLASS_NAME, objc_class_reference, objc_class_name): New. (IS_CLASS): New macro. (IS_ID, IS_SUPER): Robustify. (OCTI_EXECCLASS_DECL, execclass_decl): New. (finish_file, start_class, continue_class, finish_class, start_method_def, continue_method_def, finish_method_def, start_protocol, finish_protocol, objc_build_throw_stmt, objc_build_try_catch_finally_stmt, objc_build_synchronized_prologue, objc_build_synchronized_epilogue, objc_build_try_prologue, objc_build_try_epilogue, objc_build_catch_stmt, objc_build_catch_epilogue, objc_build_finally_prologue, objc_build_finally_epilogue, is_ivar, is_private, is_public, add_instance_variable, objc_add_method, get_super_receiver, objc_clear_super_receiver, get_class_ivars_from_name, get_class_reference, get_static_reference, get_object_reference, build_message_expr, finish_message_expr, build_selector_expr, build_ivar_reference, build_keyword_decl, build_method_decl, build_protocol_expr, build_objc_string_object, objc_declare_alias, objc_declare_class, objc_declare_protocols, objc_comptypes, objc_check_decl, build_encode_expr): Remove prototypes. (imp_count, cat_count): Make GGC-aware. (OBJC_SET_TYPE_NAME): New macro. From-SVN: r87168
2004-09-08 02:49:44 +02:00
/* Construct a PROTOCOLS-qualified variant of INTERFACE, where INTERFACE may
either name an Objective-C class, or refer to the special 'id' or 'Class'
types. If INTERFACE is not a valid ObjC type, just return it unchanged. */
1992-01-18 00:15:38 +01:00
tree
Makefile.in (c-parse.o): Depend on $(C_COMMON_H). [gcc/ChangeLog] 2004-09-07 Ziemowit Laski <zlaski@apple.com> * Makefile.in (c-parse.o): Depend on $(C_COMMON_H). * c-parse.in: Include c-common.h instead of objc-act.h. (ivar_decl_list, ivar_decls, ivar_decl, ivars, ivar_declarator, myparms, myparm): Remove %type declarations. (methodtype, optparms, OBJC_TYPE_QUAL, objc_quals, objc_qual, objc_typename, objc_try_catch_stmt, optellipsis): Add %type declarations. (objc_inherit_code, objc_public_flag): Remove. (typespec_nonreserved_nonattr): Call objc_get_protocol_qualified_type() instead of get_static_reference() and get_protocol_reference(). (stmt_nocomp): Call grokparm() on @catch parameter. (objcdef): Move semantic action to objc_finish_implementation(). (classdef): Move semantic action to objc_start_class_interface(), objc_continue_interface(), objc_finish_interface(), objc_start_class_implementation(), objc_continue_implementation(), objc_start_category_interface() and objc_start_category_implementation(). (protocoldef): Move semantic actions to objc_start_protocol() and objc_finish_interface(). (ivar_decl_list): Remove nonterminal. (visibility_spec): Move semantic actions to objc_set_visibility(). (ivar_decls): Remove assignment to $$. (ivar_decl): Rephrase in terms of component_decl; call objc_add_instance_variable(). (ivars, ivar_declarator): Remove nonterminals. (opt_semi): New nonterminal. (methodtype): Remove semantic actions. (methoddef): Move semantic actions to objc_set_method_type(), objc_start_method_definition() and objc_finish_method_definition(). (methodproto): Move semantic actions to objc_set_method_type() and objc_add_method_declaration(). (methoddecl): Use objc_typename instead of typename; move semantic actions to objc_build_method_signature(). (optarglist, myxdecls, mydecl, myparms, myparm): Remove nonterminals. (optparmlist): Express in terms of optparms and optellipsis. (optparms, optellipsis, objc_qual, objc_quals, objc_typename): New nonterminals. (keyworddecl): Use objc_typename instead of typename. (rid_to_yy): Mark RID_IN, RID_OUT, RID_INOUT, RID_BYCOPY, RID_BYREF and RID_ONEWAY as returning OBJC_TYPE_QUAL to yyparse(). [gcc/objc/ChangeLog] 2004-09-07 Ziemowit Laski <zlaski@apple.com> * Make-lang.in (objc/objc-parse.o): Depend on $(C_COMMON_H) instead of objc/objc-act.h. (objc/objc-act.o): Depend on $(HASHTAB_H). * objc-act.c: Include hashtab.h; in ObjC++ mode, include cp-tree.h and objcp-decl.h instead of c-tree.h. (build_module_descriptor, get_class_ivars, synth_id_with_class_suffix, error_with_ivar, gen_method_decl, gen_declaration, setup_string_decl, build_protocol_template): Adjust prototypes. (build_module_initializer_routine, start_class, continue_class, finish_class, start_method_def, objc_start_function, start_protocol, build_method_decl, objc_add_method, add_instance_variable, build_ivar_reference, is_ivar, is_private, get_super_receiver, build_selector_table_decl, objc_push_parm, objc_get_parm_info, gen_type_name, gen_type_name_0, start_var_decl, finish_var_decl, create_field_decl): New prototypes. (objc_expand_function_end, comp_method_with_proto, objc_expr_last, gen_declaration_1, gen_declarator, is_complex_decl, adorn_decl, define_decl, create_builtin_decl, gen_declspecs): Remove prototypes. (TYPE_ID): Rename to OBJECT_TYPEDEF_NAME. (CLASS_TYPEDEF_NAME): New. (TAG_EXECCLASS): Change from a global variable to a #define. (TAG_RETURN_STRUCT): Delete. (TAG_GNUINIT): New, holds '__objc_gnu_init' name. (objc_inherit_code, objc_public_flag): New, moved from c-parse.in. (string_descriptor): New struct. (string_htab): New hash table. (string_hash, string_eq): New prototypes. (generate_struct_by_value_array): Call create_field_decl() instead of create_builtin_decl(). (objc_init): Do not initialize objc_ellipsis_node or TAG_EXECCLASS; In ObjC++ mode, call cxx_init() instead of c_objc_common_init(). (objc_finish_file): In ObjC++, call instantiate_pending_templates() and cp_finish_file(). (define_decl, get_static_reference, get_protocol_reference, create_builtin_decl): Remove functions. (objc_start_class_interface, objc_start_category_interface, objc_start_protocol, objc_continue_interface, objc_finish_interface, objc_start_class_implementation, objc_start_category_implementation, objc_continue_implementation, objc_finish_implementation, objc_set_visibility, objc_set_method_type, objc_build_method_signature, objc_add_method_declaration, objc_start_method_definition, objc_add_instance_variable, objc_get_protocol_qualified_type, create_field_decl, start_var_decl, finish_var_decl): New functions. (setup_string_decl): Simplify since it is only called once. (synth_module_prologue): Call build_class_template(); predefine 'id' and 'Class' as typedefs; rename 'temp_type' to 'type'; disable debug hooks for duration of function; fix GNU runtime messenger signatures to correspond to reality; forward-declare '__objc_exec_class' for the GNU runtime; call build_selector_table_decl(); in ObjC++ mode, generate 'extern "C" { ... }' wrappers around synthesized declarations; call build_protocol_template() and build_category_template(). (string_hash, string_eq): New functions. (objc_build_string_object): Check metaclass correctness only once; store string literals in hash table. (objc_build_constructor): Do not convert initializer elements; adjust for ObjC++ impedance mismatch. (build_objc_symtab_template): Call create_field_decl() instead of create_builtin_decl(). (init_objc_symtab): Add missing conversion to initializer element. (build_metadata_decl): Call start_var_decl() instead of define_decl(). (generate_objc_symtab_decl): Do not call build_category_template(); call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(). (build_module_descriptor): Call create_field_decl() instead of grokfield(); call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(); always mark module descriptor as used; move GNU runtime-specific functionality to build_module_initializer_routine(). (build_module_initializer_routine): New function, broken off of build_module_descriptor(). (objc_static_init_needed_p, objc_generate_static_init_call): New functions. (generate_static_references, generate_strings, build_selector_translation_table, generate_descriptor_table, generate_ivars_list, generate_dispatch_table, generate_category): Call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(); build a type directly instead of via groktypename(). (build_selector_reference_decl, build_selector_table_decl, build_class_reference_decl, build_protocol_reference, generate_objc_image_info): Call start_var_decl() instead of build_decl(). (build_selector_reference): For GNU runtime, do not call build_selector_reference_decl(). (build_selector, build_typed_selector_reference): Always convert result to the selector type. (add_objc_string): Cast return value to 'char *'. (build_method_prototype_template, build_selector_template, build_method_template): Use actual selector type for fields pointing to selectors. (finish_objc): For GNU runtime, call build_module_initializer_routine() after build_module_descriptor(). (generate_protocol_list, generate_shared_structures): Call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(); build a type directly instead of via groktypename(). (synth_id_with_class_suffix): Return a string. (get_arg_type_list): For instance methods, use the instance type for 'self'; do not call groktypename_in_parm_context(). (build_objc_string_decl): Squash redeclaration errors in ObjC++. (objc_is_class_name): Use OBJC_TYPE_NAME instead of TYPE_NAME; handle RECORD_TYPEs in ObjC as well as ObjC++. (objc_is_id): New function. (objc_is_object_ptr): Return the canonical type node. (objc_get_class_ivars): Simplify using get_class_ivars(). (get_class_ivars): Remove second parameter; create a fresh copy of the ivar list for each call; do not check for existence of super class. (objc_eh_runtime_type): Mark #ifndef OBJCPLUS. (objc_init_exceptions): When using SJLJ-style exceptions, require the use of '-fobjc-exceptions' flag; do not require it for DWARF-style exceptions. (objc_build_exc_ptr, next_sjlj_build_try_catch_finally): Use objc_object_type instead of objc_id_type. (objc_begin_catch_clause): Convert the incoming PARM_DECL into a VAR_DECL before placing it in the appropriate scope; do not call define_decl(); adjust call to c_begin_compound_stmt(); use objc_object_type instead of objc_id_type. (build_next_objc_exception_stuff): Call create_field_decl() instead of create_builtin_decl(); construct type directly instead of calling groktypename(); use OBJC_VOID_AT_END to mark end of function parameters. (build_private_template): Adjust call to get_class_ivars(); build a type directly instead of via groktypename(). (build_protocol_template, build_method_prototype_list_template, build_method_prototype_template, build_category_template, build_selector_template, build_class_template, build_super_template, build_ivar_template, build_ivar_list_template, build_method_list_template, build_method_template): Call create_field_decl() instead of grokfield(). (objc_method_parm_type): Do not call groktypename(). (generate_descriptor_table): Call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(). (generate_method_descriptors, build_protocol_initializer, generate_dispatch_tables, build_category_initializer, build_shared_structure_initializer): Do not call groktypename(). (generate_protocols): Call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(); do not call groktypename(). (error_with_ivar): Remove last parameter. (check_ivars): Do not iterate ovar CLASS_RAW_IVARS lists in addition to CLASS_IVARS lists; adjust calls to error_with_ivar(). (generate_ivar_lists): Convert one of the initializer elements; do not call groktypename(). (get_arg_type_list, start_method_def, gen_method_def): Account for new representation of variable arguments and '...' in Objective-C methods; add Objective-C++ impedance matching code. (is_objc_type_qualifier): Remove function. (adjust_type_for_id_default): Simplify; there is no longer a need to wade through declspecs. (lookup_interface, start_class, continue_class, finish_class, start_method_def, start_protocol, build_method_decl, objc_add_method, add_instance_variable, build_ivar_reference, is_ivar, is_private, get_super_receiver, objc_build_finally_epilogue): Make into static functions. (receiver_is_class_object): Use new IS_CLASS() macro. (objc_build_message_expr): Tweak ObjC++ message argument handling; call objc_finish_message_expr() instead of finish_message_expr(). (finish_message_expr): Rename to objc_finish_message_expr(); use OBJC_TYPE_NAME and OBJC_SET_TYPE_NAME macros instead of TYPE_NAME. call gen_type_name() instead of gen_declaration(); call objc_is_id() instead of using IS_ID and IS_CLASS; Use objc_class_name instead of calling get_identifier("Class"); handle CONVERT_EXPRs in receiver. (build_objc_method_call, warn_with_method): Do not call groktypename(). (build_ivar_reference): Call convert() instead of clobbering in a type. (hash_init): Initialize string_htab hash table. (add_instance_variable): Simplify parameter list; do not call grokfield(); do not populate CLASS_IVARS list. (start_class): Check for the existence of super class, if one was specified. (continue_class): Use CLASS_RAW_IVARS rather than CLASS_IVARS; do not call build_class_template(); adjust call to get_class_ivars(); call build_decl(), pushdecl() and finish_decl() instead of define_decl(). (finish_class): Call build_decl(), pushdecl() and finish_decl() instead of define_decl(). (add_protocols): Use PROTOCOL_BINFO_ELTS for the tree vector size. (start_protocol): Do not call build_protocol_template(); use PROTOCOL_BINFO_ELTS for the tree vector size. (encode_type_qualifiers): Do not handle the 'const' qualifier here. (encode_pointer): Encode 'const char *' as 'r*', for backwards compatibility. (encode_array): Use HOST_WIDE_INT_PRINT_DEC instead of "%ld". (encode_type): Handle the 'const' qualifier here. (objc_parmlist): New global variable, sued by objc_push_parm and objc_get_parm_info(). (objc_push_parm, objc_get_parm_info): New functions. (objc_expr_last): Remove function. (synth_self_and_ucmd_args): For instance methods, use the instance type for 'self'; call objc_push_parm() instead of push_parm_decl(). (start_method_def): Do not call push_scope(), declare_parm_level(), pop_scope(), push_parm_decl(), store_parm_decls() or objc_expr_last(); just use objc_push_parm() and objc_get_parm_info(). (comp_method_with_proto): Remove function. (objc_types_are_equivalent): Strip away indirections before comparing underlying types. (comp_proto_with_proto): Do not call groktypename(); types are no longer in raw declspec format. (objc_start_function): New function. (really_start_method): Call comp_proto_with_proto() instead of comp_method_with_proto(); call objc_start_function() instead of hand-crafting a function declarator. (continue_method_def, objc_expand_function_end): Remove functions. (get_super_receiver): Call objc_get_current_scope() instead of get_current_scope(); reference 'super_class' field (instead of 'class'). (finish_method_def): Rename to objc_finish_method_definition() and add a function decl parameter; move method encoding call from objc_expand_function_end(). (is_complex_decl, adorn_decl, gen_declarator, gen_declspecs, gen_declaration_1): Remove functions. (tmpbuf, RAW_DECLSPEC): Remove. (gen_declaration): Remove second parameter; simplify to deal with TYPE_P nodes instead of raw declspecs. (gen_type_name, gen_type_name_0): New functions. (gen_method_decl): Remove second parameter; call gen_type_name() instead of gen_declaration_1(). (dump_interface): Adjust calls to gen_declaration() and gen_method_decl(); do not allocate a separate string buffer. (init_objc): Allocate a larger string buffer to accommodate dump_interface(); adjust call to build_module_descriptor(); add call to build_module_initializer_routine() for the GNU runtime. (generate_classref_translation_entry): Do not call start_decl(); call finish_var_decl() instead of finish_decl(); call convert() instead of build_c_cast(). * objc-act.h (CLASS_OWN_IVARS): Remove accessor. (CLASS_BINFO_ELTS): Reduce from 6 to 5, now that CLASS_OWN_IVARS is gone. (OCTI_GNU_INIT_DECL, GNU_INIT_decl): New. (OCTI_ELLIPSIS_NODE, objc_ellipsis_node): Remove. (OCTI_ID_ID, id_type, objc_id_id): Rename to OCTI_ID_NAME, objc_object_type and objc_object_name, respectively. (OCTI_CLS_REF, OCTI_CLASS_NAME, objc_class_reference, objc_class_name): New. (IS_CLASS): New macro. (IS_ID, IS_SUPER): Robustify. (OCTI_EXECCLASS_DECL, execclass_decl): New. (finish_file, start_class, continue_class, finish_class, start_method_def, continue_method_def, finish_method_def, start_protocol, finish_protocol, objc_build_throw_stmt, objc_build_try_catch_finally_stmt, objc_build_synchronized_prologue, objc_build_synchronized_epilogue, objc_build_try_prologue, objc_build_try_epilogue, objc_build_catch_stmt, objc_build_catch_epilogue, objc_build_finally_prologue, objc_build_finally_epilogue, is_ivar, is_private, is_public, add_instance_variable, objc_add_method, get_super_receiver, objc_clear_super_receiver, get_class_ivars_from_name, get_class_reference, get_static_reference, get_object_reference, build_message_expr, finish_message_expr, build_selector_expr, build_ivar_reference, build_keyword_decl, build_method_decl, build_protocol_expr, build_objc_string_object, objc_declare_alias, objc_declare_class, objc_declare_protocols, objc_comptypes, objc_check_decl, build_encode_expr): Remove prototypes. (imp_count, cat_count): Make GGC-aware. (OBJC_SET_TYPE_NAME): New macro. From-SVN: r87168
2004-09-08 02:49:44 +02:00
objc_get_protocol_qualified_type (tree interface, tree protocols)
{
objc-act.c (build_private_template): Change to return 'void'... [gcc/objc/ChangeLog] 2004-12-15 Ziemowit Laski <zlaski@apple.com> * objc-act.c (build_private_template): Change to return 'void'; do not set ivar_context, uprivate_record or objc_instance_type. (objc_comptypes, gen_type_name_0): For types 'id' and 'Class', retrieve protocol list from the pointee rather than the pointer itself; check TYPE_HAS_OBJC_INFO(...) precondition before accessing TYPE_OBJC_PROTOCOL_LIST. (objc_get_protocol_qualified_type): For types 'id' and 'Class', construct a variant of the pointee as well as the pointer, and store protocol information in the former. When creating variants of RECORD_TYPEs, clone their TYPE_LANG_SPECIFIC fields and propagate TYPE_OBJC_INTERFACE information. (objc_declare_class): If a TYPE_DECL is looked up, retrieve the underlying RECORD_TYPE to check for presence of TYPE_OBJC_INTERFACE; for newly-created RECORD_TYPEs, create a tentative TYPE_OBJC_INTERFACE holding an IDENTIFIER_NODE. (objc_finish_message_expr): Check TYPE_HAS_OBJC_INFO(...) before accessing TYPE_OBJC_PROTOCOL_LIST; Use TYPE_OBJC_INTERFACE instead of calling lookup_interface(); allow for TYPE_OBJC_INTERFACE holding an IDENTIFIER_NODE (meaning a @class forward-declaration only). (objc_is_public): Check TYPE_OBJC_INTERFACE instead of calling lookup_interface(). (continue_class): For @implementations, set ivar_context, uprivate_record and objc_instance_type, for @interfaces, call build_private_template(). (encode_pointer): Check TYPE_HAS_OBJC_INFO(...) before accessing TYPE_OBJC_INTERFACE. (objc_types_are_equivalent): Check TYPE_HAS_OBJC_INFO(...) before accessing TYPE_OBJC_PROTOCOL_LIST. * objc-act.h (OBJC_INFO_SLOT_ELTS, TYPE_OBJC_INFO, INIT_TYPE_OBJC_INFO, DUP_TYPE_OBJC_INFO, ALLOC_OBJC_TYPE_LANG_SPECIFIC, SIZEOF_OBJC_TYPE_LANG_SPECIFIC): New macros. (TYPE_OBJC_INTERFACE): Replaces TREE_STATIC_INSTANCE and now points to an actual @interface; stored in TYPE_LANG_SPECIFIC(...). (TYPE_OBJC_PROTOCOL_LIST): Replaces TYPE_PROTOCOL_LIST; stored in TYPE_LANG_SPECIFIC(...). (TREE_STATIC_INSTANCE, TYPE_PROTOCOL_LIST): Delete. (IS_ID, IS_CLASS, IS_PROTOCOL_QUALIFIED_UNTYPED, IS_SUPER, TYPED_OBJECT): Check for POINTER_TYPE rather than POINTER_TYPE_P; adjust for use of TYPE_OBJC_INTERFACE and TYPE_OBJC_PROTOCOL_LIST instead of TREE_STATIC_INSTANCE and TYPE_PROTOCOL_LIST. From-SVN: r92239
2004-12-16 02:10:38 +01:00
/* If INTERFACE is not provided, default to 'id'. */
tree type = (interface ? objc_is_id (interface) : objc_object_type);
bool is_ptr = (type != NULL_TREE);
objc-act.c (build_private_template): Change to return 'void'... [gcc/objc/ChangeLog] 2004-12-15 Ziemowit Laski <zlaski@apple.com> * objc-act.c (build_private_template): Change to return 'void'; do not set ivar_context, uprivate_record or objc_instance_type. (objc_comptypes, gen_type_name_0): For types 'id' and 'Class', retrieve protocol list from the pointee rather than the pointer itself; check TYPE_HAS_OBJC_INFO(...) precondition before accessing TYPE_OBJC_PROTOCOL_LIST. (objc_get_protocol_qualified_type): For types 'id' and 'Class', construct a variant of the pointee as well as the pointer, and store protocol information in the former. When creating variants of RECORD_TYPEs, clone their TYPE_LANG_SPECIFIC fields and propagate TYPE_OBJC_INTERFACE information. (objc_declare_class): If a TYPE_DECL is looked up, retrieve the underlying RECORD_TYPE to check for presence of TYPE_OBJC_INTERFACE; for newly-created RECORD_TYPEs, create a tentative TYPE_OBJC_INTERFACE holding an IDENTIFIER_NODE. (objc_finish_message_expr): Check TYPE_HAS_OBJC_INFO(...) before accessing TYPE_OBJC_PROTOCOL_LIST; Use TYPE_OBJC_INTERFACE instead of calling lookup_interface(); allow for TYPE_OBJC_INTERFACE holding an IDENTIFIER_NODE (meaning a @class forward-declaration only). (objc_is_public): Check TYPE_OBJC_INTERFACE instead of calling lookup_interface(). (continue_class): For @implementations, set ivar_context, uprivate_record and objc_instance_type, for @interfaces, call build_private_template(). (encode_pointer): Check TYPE_HAS_OBJC_INFO(...) before accessing TYPE_OBJC_INTERFACE. (objc_types_are_equivalent): Check TYPE_HAS_OBJC_INFO(...) before accessing TYPE_OBJC_PROTOCOL_LIST. * objc-act.h (OBJC_INFO_SLOT_ELTS, TYPE_OBJC_INFO, INIT_TYPE_OBJC_INFO, DUP_TYPE_OBJC_INFO, ALLOC_OBJC_TYPE_LANG_SPECIFIC, SIZEOF_OBJC_TYPE_LANG_SPECIFIC): New macros. (TYPE_OBJC_INTERFACE): Replaces TREE_STATIC_INSTANCE and now points to an actual @interface; stored in TYPE_LANG_SPECIFIC(...). (TYPE_OBJC_PROTOCOL_LIST): Replaces TYPE_PROTOCOL_LIST; stored in TYPE_LANG_SPECIFIC(...). (TREE_STATIC_INSTANCE, TYPE_PROTOCOL_LIST): Delete. (IS_ID, IS_CLASS, IS_PROTOCOL_QUALIFIED_UNTYPED, IS_SUPER, TYPED_OBJECT): Check for POINTER_TYPE rather than POINTER_TYPE_P; adjust for use of TYPE_OBJC_INTERFACE and TYPE_OBJC_PROTOCOL_LIST instead of TREE_STATIC_INSTANCE and TYPE_PROTOCOL_LIST. From-SVN: r92239
2004-12-16 02:10:38 +01:00
if (!is_ptr)
{
Makefile.in (c-parse.o): Depend on $(C_COMMON_H). [gcc/ChangeLog] 2004-09-07 Ziemowit Laski <zlaski@apple.com> * Makefile.in (c-parse.o): Depend on $(C_COMMON_H). * c-parse.in: Include c-common.h instead of objc-act.h. (ivar_decl_list, ivar_decls, ivar_decl, ivars, ivar_declarator, myparms, myparm): Remove %type declarations. (methodtype, optparms, OBJC_TYPE_QUAL, objc_quals, objc_qual, objc_typename, objc_try_catch_stmt, optellipsis): Add %type declarations. (objc_inherit_code, objc_public_flag): Remove. (typespec_nonreserved_nonattr): Call objc_get_protocol_qualified_type() instead of get_static_reference() and get_protocol_reference(). (stmt_nocomp): Call grokparm() on @catch parameter. (objcdef): Move semantic action to objc_finish_implementation(). (classdef): Move semantic action to objc_start_class_interface(), objc_continue_interface(), objc_finish_interface(), objc_start_class_implementation(), objc_continue_implementation(), objc_start_category_interface() and objc_start_category_implementation(). (protocoldef): Move semantic actions to objc_start_protocol() and objc_finish_interface(). (ivar_decl_list): Remove nonterminal. (visibility_spec): Move semantic actions to objc_set_visibility(). (ivar_decls): Remove assignment to $$. (ivar_decl): Rephrase in terms of component_decl; call objc_add_instance_variable(). (ivars, ivar_declarator): Remove nonterminals. (opt_semi): New nonterminal. (methodtype): Remove semantic actions. (methoddef): Move semantic actions to objc_set_method_type(), objc_start_method_definition() and objc_finish_method_definition(). (methodproto): Move semantic actions to objc_set_method_type() and objc_add_method_declaration(). (methoddecl): Use objc_typename instead of typename; move semantic actions to objc_build_method_signature(). (optarglist, myxdecls, mydecl, myparms, myparm): Remove nonterminals. (optparmlist): Express in terms of optparms and optellipsis. (optparms, optellipsis, objc_qual, objc_quals, objc_typename): New nonterminals. (keyworddecl): Use objc_typename instead of typename. (rid_to_yy): Mark RID_IN, RID_OUT, RID_INOUT, RID_BYCOPY, RID_BYREF and RID_ONEWAY as returning OBJC_TYPE_QUAL to yyparse(). [gcc/objc/ChangeLog] 2004-09-07 Ziemowit Laski <zlaski@apple.com> * Make-lang.in (objc/objc-parse.o): Depend on $(C_COMMON_H) instead of objc/objc-act.h. (objc/objc-act.o): Depend on $(HASHTAB_H). * objc-act.c: Include hashtab.h; in ObjC++ mode, include cp-tree.h and objcp-decl.h instead of c-tree.h. (build_module_descriptor, get_class_ivars, synth_id_with_class_suffix, error_with_ivar, gen_method_decl, gen_declaration, setup_string_decl, build_protocol_template): Adjust prototypes. (build_module_initializer_routine, start_class, continue_class, finish_class, start_method_def, objc_start_function, start_protocol, build_method_decl, objc_add_method, add_instance_variable, build_ivar_reference, is_ivar, is_private, get_super_receiver, build_selector_table_decl, objc_push_parm, objc_get_parm_info, gen_type_name, gen_type_name_0, start_var_decl, finish_var_decl, create_field_decl): New prototypes. (objc_expand_function_end, comp_method_with_proto, objc_expr_last, gen_declaration_1, gen_declarator, is_complex_decl, adorn_decl, define_decl, create_builtin_decl, gen_declspecs): Remove prototypes. (TYPE_ID): Rename to OBJECT_TYPEDEF_NAME. (CLASS_TYPEDEF_NAME): New. (TAG_EXECCLASS): Change from a global variable to a #define. (TAG_RETURN_STRUCT): Delete. (TAG_GNUINIT): New, holds '__objc_gnu_init' name. (objc_inherit_code, objc_public_flag): New, moved from c-parse.in. (string_descriptor): New struct. (string_htab): New hash table. (string_hash, string_eq): New prototypes. (generate_struct_by_value_array): Call create_field_decl() instead of create_builtin_decl(). (objc_init): Do not initialize objc_ellipsis_node or TAG_EXECCLASS; In ObjC++ mode, call cxx_init() instead of c_objc_common_init(). (objc_finish_file): In ObjC++, call instantiate_pending_templates() and cp_finish_file(). (define_decl, get_static_reference, get_protocol_reference, create_builtin_decl): Remove functions. (objc_start_class_interface, objc_start_category_interface, objc_start_protocol, objc_continue_interface, objc_finish_interface, objc_start_class_implementation, objc_start_category_implementation, objc_continue_implementation, objc_finish_implementation, objc_set_visibility, objc_set_method_type, objc_build_method_signature, objc_add_method_declaration, objc_start_method_definition, objc_add_instance_variable, objc_get_protocol_qualified_type, create_field_decl, start_var_decl, finish_var_decl): New functions. (setup_string_decl): Simplify since it is only called once. (synth_module_prologue): Call build_class_template(); predefine 'id' and 'Class' as typedefs; rename 'temp_type' to 'type'; disable debug hooks for duration of function; fix GNU runtime messenger signatures to correspond to reality; forward-declare '__objc_exec_class' for the GNU runtime; call build_selector_table_decl(); in ObjC++ mode, generate 'extern "C" { ... }' wrappers around synthesized declarations; call build_protocol_template() and build_category_template(). (string_hash, string_eq): New functions. (objc_build_string_object): Check metaclass correctness only once; store string literals in hash table. (objc_build_constructor): Do not convert initializer elements; adjust for ObjC++ impedance mismatch. (build_objc_symtab_template): Call create_field_decl() instead of create_builtin_decl(). (init_objc_symtab): Add missing conversion to initializer element. (build_metadata_decl): Call start_var_decl() instead of define_decl(). (generate_objc_symtab_decl): Do not call build_category_template(); call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(). (build_module_descriptor): Call create_field_decl() instead of grokfield(); call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(); always mark module descriptor as used; move GNU runtime-specific functionality to build_module_initializer_routine(). (build_module_initializer_routine): New function, broken off of build_module_descriptor(). (objc_static_init_needed_p, objc_generate_static_init_call): New functions. (generate_static_references, generate_strings, build_selector_translation_table, generate_descriptor_table, generate_ivars_list, generate_dispatch_table, generate_category): Call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(); build a type directly instead of via groktypename(). (build_selector_reference_decl, build_selector_table_decl, build_class_reference_decl, build_protocol_reference, generate_objc_image_info): Call start_var_decl() instead of build_decl(). (build_selector_reference): For GNU runtime, do not call build_selector_reference_decl(). (build_selector, build_typed_selector_reference): Always convert result to the selector type. (add_objc_string): Cast return value to 'char *'. (build_method_prototype_template, build_selector_template, build_method_template): Use actual selector type for fields pointing to selectors. (finish_objc): For GNU runtime, call build_module_initializer_routine() after build_module_descriptor(). (generate_protocol_list, generate_shared_structures): Call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(); build a type directly instead of via groktypename(). (synth_id_with_class_suffix): Return a string. (get_arg_type_list): For instance methods, use the instance type for 'self'; do not call groktypename_in_parm_context(). (build_objc_string_decl): Squash redeclaration errors in ObjC++. (objc_is_class_name): Use OBJC_TYPE_NAME instead of TYPE_NAME; handle RECORD_TYPEs in ObjC as well as ObjC++. (objc_is_id): New function. (objc_is_object_ptr): Return the canonical type node. (objc_get_class_ivars): Simplify using get_class_ivars(). (get_class_ivars): Remove second parameter; create a fresh copy of the ivar list for each call; do not check for existence of super class. (objc_eh_runtime_type): Mark #ifndef OBJCPLUS. (objc_init_exceptions): When using SJLJ-style exceptions, require the use of '-fobjc-exceptions' flag; do not require it for DWARF-style exceptions. (objc_build_exc_ptr, next_sjlj_build_try_catch_finally): Use objc_object_type instead of objc_id_type. (objc_begin_catch_clause): Convert the incoming PARM_DECL into a VAR_DECL before placing it in the appropriate scope; do not call define_decl(); adjust call to c_begin_compound_stmt(); use objc_object_type instead of objc_id_type. (build_next_objc_exception_stuff): Call create_field_decl() instead of create_builtin_decl(); construct type directly instead of calling groktypename(); use OBJC_VOID_AT_END to mark end of function parameters. (build_private_template): Adjust call to get_class_ivars(); build a type directly instead of via groktypename(). (build_protocol_template, build_method_prototype_list_template, build_method_prototype_template, build_category_template, build_selector_template, build_class_template, build_super_template, build_ivar_template, build_ivar_list_template, build_method_list_template, build_method_template): Call create_field_decl() instead of grokfield(). (objc_method_parm_type): Do not call groktypename(). (generate_descriptor_table): Call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(). (generate_method_descriptors, build_protocol_initializer, generate_dispatch_tables, build_category_initializer, build_shared_structure_initializer): Do not call groktypename(). (generate_protocols): Call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(); do not call groktypename(). (error_with_ivar): Remove last parameter. (check_ivars): Do not iterate ovar CLASS_RAW_IVARS lists in addition to CLASS_IVARS lists; adjust calls to error_with_ivar(). (generate_ivar_lists): Convert one of the initializer elements; do not call groktypename(). (get_arg_type_list, start_method_def, gen_method_def): Account for new representation of variable arguments and '...' in Objective-C methods; add Objective-C++ impedance matching code. (is_objc_type_qualifier): Remove function. (adjust_type_for_id_default): Simplify; there is no longer a need to wade through declspecs. (lookup_interface, start_class, continue_class, finish_class, start_method_def, start_protocol, build_method_decl, objc_add_method, add_instance_variable, build_ivar_reference, is_ivar, is_private, get_super_receiver, objc_build_finally_epilogue): Make into static functions. (receiver_is_class_object): Use new IS_CLASS() macro. (objc_build_message_expr): Tweak ObjC++ message argument handling; call objc_finish_message_expr() instead of finish_message_expr(). (finish_message_expr): Rename to objc_finish_message_expr(); use OBJC_TYPE_NAME and OBJC_SET_TYPE_NAME macros instead of TYPE_NAME. call gen_type_name() instead of gen_declaration(); call objc_is_id() instead of using IS_ID and IS_CLASS; Use objc_class_name instead of calling get_identifier("Class"); handle CONVERT_EXPRs in receiver. (build_objc_method_call, warn_with_method): Do not call groktypename(). (build_ivar_reference): Call convert() instead of clobbering in a type. (hash_init): Initialize string_htab hash table. (add_instance_variable): Simplify parameter list; do not call grokfield(); do not populate CLASS_IVARS list. (start_class): Check for the existence of super class, if one was specified. (continue_class): Use CLASS_RAW_IVARS rather than CLASS_IVARS; do not call build_class_template(); adjust call to get_class_ivars(); call build_decl(), pushdecl() and finish_decl() instead of define_decl(). (finish_class): Call build_decl(), pushdecl() and finish_decl() instead of define_decl(). (add_protocols): Use PROTOCOL_BINFO_ELTS for the tree vector size. (start_protocol): Do not call build_protocol_template(); use PROTOCOL_BINFO_ELTS for the tree vector size. (encode_type_qualifiers): Do not handle the 'const' qualifier here. (encode_pointer): Encode 'const char *' as 'r*', for backwards compatibility. (encode_array): Use HOST_WIDE_INT_PRINT_DEC instead of "%ld". (encode_type): Handle the 'const' qualifier here. (objc_parmlist): New global variable, sued by objc_push_parm and objc_get_parm_info(). (objc_push_parm, objc_get_parm_info): New functions. (objc_expr_last): Remove function. (synth_self_and_ucmd_args): For instance methods, use the instance type for 'self'; call objc_push_parm() instead of push_parm_decl(). (start_method_def): Do not call push_scope(), declare_parm_level(), pop_scope(), push_parm_decl(), store_parm_decls() or objc_expr_last(); just use objc_push_parm() and objc_get_parm_info(). (comp_method_with_proto): Remove function. (objc_types_are_equivalent): Strip away indirections before comparing underlying types. (comp_proto_with_proto): Do not call groktypename(); types are no longer in raw declspec format. (objc_start_function): New function. (really_start_method): Call comp_proto_with_proto() instead of comp_method_with_proto(); call objc_start_function() instead of hand-crafting a function declarator. (continue_method_def, objc_expand_function_end): Remove functions. (get_super_receiver): Call objc_get_current_scope() instead of get_current_scope(); reference 'super_class' field (instead of 'class'). (finish_method_def): Rename to objc_finish_method_definition() and add a function decl parameter; move method encoding call from objc_expand_function_end(). (is_complex_decl, adorn_decl, gen_declarator, gen_declspecs, gen_declaration_1): Remove functions. (tmpbuf, RAW_DECLSPEC): Remove. (gen_declaration): Remove second parameter; simplify to deal with TYPE_P nodes instead of raw declspecs. (gen_type_name, gen_type_name_0): New functions. (gen_method_decl): Remove second parameter; call gen_type_name() instead of gen_declaration_1(). (dump_interface): Adjust calls to gen_declaration() and gen_method_decl(); do not allocate a separate string buffer. (init_objc): Allocate a larger string buffer to accommodate dump_interface(); adjust call to build_module_descriptor(); add call to build_module_initializer_routine() for the GNU runtime. (generate_classref_translation_entry): Do not call start_decl(); call finish_var_decl() instead of finish_decl(); call convert() instead of build_c_cast(). * objc-act.h (CLASS_OWN_IVARS): Remove accessor. (CLASS_BINFO_ELTS): Reduce from 6 to 5, now that CLASS_OWN_IVARS is gone. (OCTI_GNU_INIT_DECL, GNU_INIT_decl): New. (OCTI_ELLIPSIS_NODE, objc_ellipsis_node): Remove. (OCTI_ID_ID, id_type, objc_id_id): Rename to OCTI_ID_NAME, objc_object_type and objc_object_name, respectively. (OCTI_CLS_REF, OCTI_CLASS_NAME, objc_class_reference, objc_class_name): New. (IS_CLASS): New macro. (IS_ID, IS_SUPER): Robustify. (OCTI_EXECCLASS_DECL, execclass_decl): New. (finish_file, start_class, continue_class, finish_class, start_method_def, continue_method_def, finish_method_def, start_protocol, finish_protocol, objc_build_throw_stmt, objc_build_try_catch_finally_stmt, objc_build_synchronized_prologue, objc_build_synchronized_epilogue, objc_build_try_prologue, objc_build_try_epilogue, objc_build_catch_stmt, objc_build_catch_epilogue, objc_build_finally_prologue, objc_build_finally_epilogue, is_ivar, is_private, is_public, add_instance_variable, objc_add_method, get_super_receiver, objc_clear_super_receiver, get_class_ivars_from_name, get_class_reference, get_static_reference, get_object_reference, build_message_expr, finish_message_expr, build_selector_expr, build_ivar_reference, build_keyword_decl, build_method_decl, build_protocol_expr, build_objc_string_object, objc_declare_alias, objc_declare_class, objc_declare_protocols, objc_comptypes, objc_check_decl, build_encode_expr): Remove prototypes. (imp_count, cat_count): Make GGC-aware. (OBJC_SET_TYPE_NAME): New macro. From-SVN: r87168
2004-09-08 02:49:44 +02:00
type = objc_is_class_name (interface);
Makefile.in (c-parse.o): Depend on $(C_COMMON_H). [gcc/ChangeLog] 2004-09-07 Ziemowit Laski <zlaski@apple.com> * Makefile.in (c-parse.o): Depend on $(C_COMMON_H). * c-parse.in: Include c-common.h instead of objc-act.h. (ivar_decl_list, ivar_decls, ivar_decl, ivars, ivar_declarator, myparms, myparm): Remove %type declarations. (methodtype, optparms, OBJC_TYPE_QUAL, objc_quals, objc_qual, objc_typename, objc_try_catch_stmt, optellipsis): Add %type declarations. (objc_inherit_code, objc_public_flag): Remove. (typespec_nonreserved_nonattr): Call objc_get_protocol_qualified_type() instead of get_static_reference() and get_protocol_reference(). (stmt_nocomp): Call grokparm() on @catch parameter. (objcdef): Move semantic action to objc_finish_implementation(). (classdef): Move semantic action to objc_start_class_interface(), objc_continue_interface(), objc_finish_interface(), objc_start_class_implementation(), objc_continue_implementation(), objc_start_category_interface() and objc_start_category_implementation(). (protocoldef): Move semantic actions to objc_start_protocol() and objc_finish_interface(). (ivar_decl_list): Remove nonterminal. (visibility_spec): Move semantic actions to objc_set_visibility(). (ivar_decls): Remove assignment to $$. (ivar_decl): Rephrase in terms of component_decl; call objc_add_instance_variable(). (ivars, ivar_declarator): Remove nonterminals. (opt_semi): New nonterminal. (methodtype): Remove semantic actions. (methoddef): Move semantic actions to objc_set_method_type(), objc_start_method_definition() and objc_finish_method_definition(). (methodproto): Move semantic actions to objc_set_method_type() and objc_add_method_declaration(). (methoddecl): Use objc_typename instead of typename; move semantic actions to objc_build_method_signature(). (optarglist, myxdecls, mydecl, myparms, myparm): Remove nonterminals. (optparmlist): Express in terms of optparms and optellipsis. (optparms, optellipsis, objc_qual, objc_quals, objc_typename): New nonterminals. (keyworddecl): Use objc_typename instead of typename. (rid_to_yy): Mark RID_IN, RID_OUT, RID_INOUT, RID_BYCOPY, RID_BYREF and RID_ONEWAY as returning OBJC_TYPE_QUAL to yyparse(). [gcc/objc/ChangeLog] 2004-09-07 Ziemowit Laski <zlaski@apple.com> * Make-lang.in (objc/objc-parse.o): Depend on $(C_COMMON_H) instead of objc/objc-act.h. (objc/objc-act.o): Depend on $(HASHTAB_H). * objc-act.c: Include hashtab.h; in ObjC++ mode, include cp-tree.h and objcp-decl.h instead of c-tree.h. (build_module_descriptor, get_class_ivars, synth_id_with_class_suffix, error_with_ivar, gen_method_decl, gen_declaration, setup_string_decl, build_protocol_template): Adjust prototypes. (build_module_initializer_routine, start_class, continue_class, finish_class, start_method_def, objc_start_function, start_protocol, build_method_decl, objc_add_method, add_instance_variable, build_ivar_reference, is_ivar, is_private, get_super_receiver, build_selector_table_decl, objc_push_parm, objc_get_parm_info, gen_type_name, gen_type_name_0, start_var_decl, finish_var_decl, create_field_decl): New prototypes. (objc_expand_function_end, comp_method_with_proto, objc_expr_last, gen_declaration_1, gen_declarator, is_complex_decl, adorn_decl, define_decl, create_builtin_decl, gen_declspecs): Remove prototypes. (TYPE_ID): Rename to OBJECT_TYPEDEF_NAME. (CLASS_TYPEDEF_NAME): New. (TAG_EXECCLASS): Change from a global variable to a #define. (TAG_RETURN_STRUCT): Delete. (TAG_GNUINIT): New, holds '__objc_gnu_init' name. (objc_inherit_code, objc_public_flag): New, moved from c-parse.in. (string_descriptor): New struct. (string_htab): New hash table. (string_hash, string_eq): New prototypes. (generate_struct_by_value_array): Call create_field_decl() instead of create_builtin_decl(). (objc_init): Do not initialize objc_ellipsis_node or TAG_EXECCLASS; In ObjC++ mode, call cxx_init() instead of c_objc_common_init(). (objc_finish_file): In ObjC++, call instantiate_pending_templates() and cp_finish_file(). (define_decl, get_static_reference, get_protocol_reference, create_builtin_decl): Remove functions. (objc_start_class_interface, objc_start_category_interface, objc_start_protocol, objc_continue_interface, objc_finish_interface, objc_start_class_implementation, objc_start_category_implementation, objc_continue_implementation, objc_finish_implementation, objc_set_visibility, objc_set_method_type, objc_build_method_signature, objc_add_method_declaration, objc_start_method_definition, objc_add_instance_variable, objc_get_protocol_qualified_type, create_field_decl, start_var_decl, finish_var_decl): New functions. (setup_string_decl): Simplify since it is only called once. (synth_module_prologue): Call build_class_template(); predefine 'id' and 'Class' as typedefs; rename 'temp_type' to 'type'; disable debug hooks for duration of function; fix GNU runtime messenger signatures to correspond to reality; forward-declare '__objc_exec_class' for the GNU runtime; call build_selector_table_decl(); in ObjC++ mode, generate 'extern "C" { ... }' wrappers around synthesized declarations; call build_protocol_template() and build_category_template(). (string_hash, string_eq): New functions. (objc_build_string_object): Check metaclass correctness only once; store string literals in hash table. (objc_build_constructor): Do not convert initializer elements; adjust for ObjC++ impedance mismatch. (build_objc_symtab_template): Call create_field_decl() instead of create_builtin_decl(). (init_objc_symtab): Add missing conversion to initializer element. (build_metadata_decl): Call start_var_decl() instead of define_decl(). (generate_objc_symtab_decl): Do not call build_category_template(); call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(). (build_module_descriptor): Call create_field_decl() instead of grokfield(); call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(); always mark module descriptor as used; move GNU runtime-specific functionality to build_module_initializer_routine(). (build_module_initializer_routine): New function, broken off of build_module_descriptor(). (objc_static_init_needed_p, objc_generate_static_init_call): New functions. (generate_static_references, generate_strings, build_selector_translation_table, generate_descriptor_table, generate_ivars_list, generate_dispatch_table, generate_category): Call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(); build a type directly instead of via groktypename(). (build_selector_reference_decl, build_selector_table_decl, build_class_reference_decl, build_protocol_reference, generate_objc_image_info): Call start_var_decl() instead of build_decl(). (build_selector_reference): For GNU runtime, do not call build_selector_reference_decl(). (build_selector, build_typed_selector_reference): Always convert result to the selector type. (add_objc_string): Cast return value to 'char *'. (build_method_prototype_template, build_selector_template, build_method_template): Use actual selector type for fields pointing to selectors. (finish_objc): For GNU runtime, call build_module_initializer_routine() after build_module_descriptor(). (generate_protocol_list, generate_shared_structures): Call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(); build a type directly instead of via groktypename(). (synth_id_with_class_suffix): Return a string. (get_arg_type_list): For instance methods, use the instance type for 'self'; do not call groktypename_in_parm_context(). (build_objc_string_decl): Squash redeclaration errors in ObjC++. (objc_is_class_name): Use OBJC_TYPE_NAME instead of TYPE_NAME; handle RECORD_TYPEs in ObjC as well as ObjC++. (objc_is_id): New function. (objc_is_object_ptr): Return the canonical type node. (objc_get_class_ivars): Simplify using get_class_ivars(). (get_class_ivars): Remove second parameter; create a fresh copy of the ivar list for each call; do not check for existence of super class. (objc_eh_runtime_type): Mark #ifndef OBJCPLUS. (objc_init_exceptions): When using SJLJ-style exceptions, require the use of '-fobjc-exceptions' flag; do not require it for DWARF-style exceptions. (objc_build_exc_ptr, next_sjlj_build_try_catch_finally): Use objc_object_type instead of objc_id_type. (objc_begin_catch_clause): Convert the incoming PARM_DECL into a VAR_DECL before placing it in the appropriate scope; do not call define_decl(); adjust call to c_begin_compound_stmt(); use objc_object_type instead of objc_id_type. (build_next_objc_exception_stuff): Call create_field_decl() instead of create_builtin_decl(); construct type directly instead of calling groktypename(); use OBJC_VOID_AT_END to mark end of function parameters. (build_private_template): Adjust call to get_class_ivars(); build a type directly instead of via groktypename(). (build_protocol_template, build_method_prototype_list_template, build_method_prototype_template, build_category_template, build_selector_template, build_class_template, build_super_template, build_ivar_template, build_ivar_list_template, build_method_list_template, build_method_template): Call create_field_decl() instead of grokfield(). (objc_method_parm_type): Do not call groktypename(). (generate_descriptor_table): Call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(). (generate_method_descriptors, build_protocol_initializer, generate_dispatch_tables, build_category_initializer, build_shared_structure_initializer): Do not call groktypename(). (generate_protocols): Call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(); do not call groktypename(). (error_with_ivar): Remove last parameter. (check_ivars): Do not iterate ovar CLASS_RAW_IVARS lists in addition to CLASS_IVARS lists; adjust calls to error_with_ivar(). (generate_ivar_lists): Convert one of the initializer elements; do not call groktypename(). (get_arg_type_list, start_method_def, gen_method_def): Account for new representation of variable arguments and '...' in Objective-C methods; add Objective-C++ impedance matching code. (is_objc_type_qualifier): Remove function. (adjust_type_for_id_default): Simplify; there is no longer a need to wade through declspecs. (lookup_interface, start_class, continue_class, finish_class, start_method_def, start_protocol, build_method_decl, objc_add_method, add_instance_variable, build_ivar_reference, is_ivar, is_private, get_super_receiver, objc_build_finally_epilogue): Make into static functions. (receiver_is_class_object): Use new IS_CLASS() macro. (objc_build_message_expr): Tweak ObjC++ message argument handling; call objc_finish_message_expr() instead of finish_message_expr(). (finish_message_expr): Rename to objc_finish_message_expr(); use OBJC_TYPE_NAME and OBJC_SET_TYPE_NAME macros instead of TYPE_NAME. call gen_type_name() instead of gen_declaration(); call objc_is_id() instead of using IS_ID and IS_CLASS; Use objc_class_name instead of calling get_identifier("Class"); handle CONVERT_EXPRs in receiver. (build_objc_method_call, warn_with_method): Do not call groktypename(). (build_ivar_reference): Call convert() instead of clobbering in a type. (hash_init): Initialize string_htab hash table. (add_instance_variable): Simplify parameter list; do not call grokfield(); do not populate CLASS_IVARS list. (start_class): Check for the existence of super class, if one was specified. (continue_class): Use CLASS_RAW_IVARS rather than CLASS_IVARS; do not call build_class_template(); adjust call to get_class_ivars(); call build_decl(), pushdecl() and finish_decl() instead of define_decl(). (finish_class): Call build_decl(), pushdecl() and finish_decl() instead of define_decl(). (add_protocols): Use PROTOCOL_BINFO_ELTS for the tree vector size. (start_protocol): Do not call build_protocol_template(); use PROTOCOL_BINFO_ELTS for the tree vector size. (encode_type_qualifiers): Do not handle the 'const' qualifier here. (encode_pointer): Encode 'const char *' as 'r*', for backwards compatibility. (encode_array): Use HOST_WIDE_INT_PRINT_DEC instead of "%ld". (encode_type): Handle the 'const' qualifier here. (objc_parmlist): New global variable, sued by objc_push_parm and objc_get_parm_info(). (objc_push_parm, objc_get_parm_info): New functions. (objc_expr_last): Remove function. (synth_self_and_ucmd_args): For instance methods, use the instance type for 'self'; call objc_push_parm() instead of push_parm_decl(). (start_method_def): Do not call push_scope(), declare_parm_level(), pop_scope(), push_parm_decl(), store_parm_decls() or objc_expr_last(); just use objc_push_parm() and objc_get_parm_info(). (comp_method_with_proto): Remove function. (objc_types_are_equivalent): Strip away indirections before comparing underlying types. (comp_proto_with_proto): Do not call groktypename(); types are no longer in raw declspec format. (objc_start_function): New function. (really_start_method): Call comp_proto_with_proto() instead of comp_method_with_proto(); call objc_start_function() instead of hand-crafting a function declarator. (continue_method_def, objc_expand_function_end): Remove functions. (get_super_receiver): Call objc_get_current_scope() instead of get_current_scope(); reference 'super_class' field (instead of 'class'). (finish_method_def): Rename to objc_finish_method_definition() and add a function decl parameter; move method encoding call from objc_expand_function_end(). (is_complex_decl, adorn_decl, gen_declarator, gen_declspecs, gen_declaration_1): Remove functions. (tmpbuf, RAW_DECLSPEC): Remove. (gen_declaration): Remove second parameter; simplify to deal with TYPE_P nodes instead of raw declspecs. (gen_type_name, gen_type_name_0): New functions. (gen_method_decl): Remove second parameter; call gen_type_name() instead of gen_declaration_1(). (dump_interface): Adjust calls to gen_declaration() and gen_method_decl(); do not allocate a separate string buffer. (init_objc): Allocate a larger string buffer to accommodate dump_interface(); adjust call to build_module_descriptor(); add call to build_module_initializer_routine() for the GNU runtime. (generate_classref_translation_entry): Do not call start_decl(); call finish_var_decl() instead of finish_decl(); call convert() instead of build_c_cast(). * objc-act.h (CLASS_OWN_IVARS): Remove accessor. (CLASS_BINFO_ELTS): Reduce from 6 to 5, now that CLASS_OWN_IVARS is gone. (OCTI_GNU_INIT_DECL, GNU_INIT_decl): New. (OCTI_ELLIPSIS_NODE, objc_ellipsis_node): Remove. (OCTI_ID_ID, id_type, objc_id_id): Rename to OCTI_ID_NAME, objc_object_type and objc_object_name, respectively. (OCTI_CLS_REF, OCTI_CLASS_NAME, objc_class_reference, objc_class_name): New. (IS_CLASS): New macro. (IS_ID, IS_SUPER): Robustify. (OCTI_EXECCLASS_DECL, execclass_decl): New. (finish_file, start_class, continue_class, finish_class, start_method_def, continue_method_def, finish_method_def, start_protocol, finish_protocol, objc_build_throw_stmt, objc_build_try_catch_finally_stmt, objc_build_synchronized_prologue, objc_build_synchronized_epilogue, objc_build_try_prologue, objc_build_try_epilogue, objc_build_catch_stmt, objc_build_catch_epilogue, objc_build_finally_prologue, objc_build_finally_epilogue, is_ivar, is_private, is_public, add_instance_variable, objc_add_method, get_super_receiver, objc_clear_super_receiver, get_class_ivars_from_name, get_class_reference, get_static_reference, get_object_reference, build_message_expr, finish_message_expr, build_selector_expr, build_ivar_reference, build_keyword_decl, build_method_decl, build_protocol_expr, build_objc_string_object, objc_declare_alias, objc_declare_class, objc_declare_protocols, objc_comptypes, objc_check_decl, build_encode_expr): Remove prototypes. (imp_count, cat_count): Make GGC-aware. (OBJC_SET_TYPE_NAME): New macro. From-SVN: r87168
2004-09-08 02:49:44 +02:00
if (type)
type = xref_tag (RECORD_TYPE, type);
else
return interface;
}
if (protocols)
{
type = build_variant_type_copy (type);
Makefile.in (c-parse.o): Depend on $(C_COMMON_H). [gcc/ChangeLog] 2004-09-07 Ziemowit Laski <zlaski@apple.com> * Makefile.in (c-parse.o): Depend on $(C_COMMON_H). * c-parse.in: Include c-common.h instead of objc-act.h. (ivar_decl_list, ivar_decls, ivar_decl, ivars, ivar_declarator, myparms, myparm): Remove %type declarations. (methodtype, optparms, OBJC_TYPE_QUAL, objc_quals, objc_qual, objc_typename, objc_try_catch_stmt, optellipsis): Add %type declarations. (objc_inherit_code, objc_public_flag): Remove. (typespec_nonreserved_nonattr): Call objc_get_protocol_qualified_type() instead of get_static_reference() and get_protocol_reference(). (stmt_nocomp): Call grokparm() on @catch parameter. (objcdef): Move semantic action to objc_finish_implementation(). (classdef): Move semantic action to objc_start_class_interface(), objc_continue_interface(), objc_finish_interface(), objc_start_class_implementation(), objc_continue_implementation(), objc_start_category_interface() and objc_start_category_implementation(). (protocoldef): Move semantic actions to objc_start_protocol() and objc_finish_interface(). (ivar_decl_list): Remove nonterminal. (visibility_spec): Move semantic actions to objc_set_visibility(). (ivar_decls): Remove assignment to $$. (ivar_decl): Rephrase in terms of component_decl; call objc_add_instance_variable(). (ivars, ivar_declarator): Remove nonterminals. (opt_semi): New nonterminal. (methodtype): Remove semantic actions. (methoddef): Move semantic actions to objc_set_method_type(), objc_start_method_definition() and objc_finish_method_definition(). (methodproto): Move semantic actions to objc_set_method_type() and objc_add_method_declaration(). (methoddecl): Use objc_typename instead of typename; move semantic actions to objc_build_method_signature(). (optarglist, myxdecls, mydecl, myparms, myparm): Remove nonterminals. (optparmlist): Express in terms of optparms and optellipsis. (optparms, optellipsis, objc_qual, objc_quals, objc_typename): New nonterminals. (keyworddecl): Use objc_typename instead of typename. (rid_to_yy): Mark RID_IN, RID_OUT, RID_INOUT, RID_BYCOPY, RID_BYREF and RID_ONEWAY as returning OBJC_TYPE_QUAL to yyparse(). [gcc/objc/ChangeLog] 2004-09-07 Ziemowit Laski <zlaski@apple.com> * Make-lang.in (objc/objc-parse.o): Depend on $(C_COMMON_H) instead of objc/objc-act.h. (objc/objc-act.o): Depend on $(HASHTAB_H). * objc-act.c: Include hashtab.h; in ObjC++ mode, include cp-tree.h and objcp-decl.h instead of c-tree.h. (build_module_descriptor, get_class_ivars, synth_id_with_class_suffix, error_with_ivar, gen_method_decl, gen_declaration, setup_string_decl, build_protocol_template): Adjust prototypes. (build_module_initializer_routine, start_class, continue_class, finish_class, start_method_def, objc_start_function, start_protocol, build_method_decl, objc_add_method, add_instance_variable, build_ivar_reference, is_ivar, is_private, get_super_receiver, build_selector_table_decl, objc_push_parm, objc_get_parm_info, gen_type_name, gen_type_name_0, start_var_decl, finish_var_decl, create_field_decl): New prototypes. (objc_expand_function_end, comp_method_with_proto, objc_expr_last, gen_declaration_1, gen_declarator, is_complex_decl, adorn_decl, define_decl, create_builtin_decl, gen_declspecs): Remove prototypes. (TYPE_ID): Rename to OBJECT_TYPEDEF_NAME. (CLASS_TYPEDEF_NAME): New. (TAG_EXECCLASS): Change from a global variable to a #define. (TAG_RETURN_STRUCT): Delete. (TAG_GNUINIT): New, holds '__objc_gnu_init' name. (objc_inherit_code, objc_public_flag): New, moved from c-parse.in. (string_descriptor): New struct. (string_htab): New hash table. (string_hash, string_eq): New prototypes. (generate_struct_by_value_array): Call create_field_decl() instead of create_builtin_decl(). (objc_init): Do not initialize objc_ellipsis_node or TAG_EXECCLASS; In ObjC++ mode, call cxx_init() instead of c_objc_common_init(). (objc_finish_file): In ObjC++, call instantiate_pending_templates() and cp_finish_file(). (define_decl, get_static_reference, get_protocol_reference, create_builtin_decl): Remove functions. (objc_start_class_interface, objc_start_category_interface, objc_start_protocol, objc_continue_interface, objc_finish_interface, objc_start_class_implementation, objc_start_category_implementation, objc_continue_implementation, objc_finish_implementation, objc_set_visibility, objc_set_method_type, objc_build_method_signature, objc_add_method_declaration, objc_start_method_definition, objc_add_instance_variable, objc_get_protocol_qualified_type, create_field_decl, start_var_decl, finish_var_decl): New functions. (setup_string_decl): Simplify since it is only called once. (synth_module_prologue): Call build_class_template(); predefine 'id' and 'Class' as typedefs; rename 'temp_type' to 'type'; disable debug hooks for duration of function; fix GNU runtime messenger signatures to correspond to reality; forward-declare '__objc_exec_class' for the GNU runtime; call build_selector_table_decl(); in ObjC++ mode, generate 'extern "C" { ... }' wrappers around synthesized declarations; call build_protocol_template() and build_category_template(). (string_hash, string_eq): New functions. (objc_build_string_object): Check metaclass correctness only once; store string literals in hash table. (objc_build_constructor): Do not convert initializer elements; adjust for ObjC++ impedance mismatch. (build_objc_symtab_template): Call create_field_decl() instead of create_builtin_decl(). (init_objc_symtab): Add missing conversion to initializer element. (build_metadata_decl): Call start_var_decl() instead of define_decl(). (generate_objc_symtab_decl): Do not call build_category_template(); call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(). (build_module_descriptor): Call create_field_decl() instead of grokfield(); call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(); always mark module descriptor as used; move GNU runtime-specific functionality to build_module_initializer_routine(). (build_module_initializer_routine): New function, broken off of build_module_descriptor(). (objc_static_init_needed_p, objc_generate_static_init_call): New functions. (generate_static_references, generate_strings, build_selector_translation_table, generate_descriptor_table, generate_ivars_list, generate_dispatch_table, generate_category): Call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(); build a type directly instead of via groktypename(). (build_selector_reference_decl, build_selector_table_decl, build_class_reference_decl, build_protocol_reference, generate_objc_image_info): Call start_var_decl() instead of build_decl(). (build_selector_reference): For GNU runtime, do not call build_selector_reference_decl(). (build_selector, build_typed_selector_reference): Always convert result to the selector type. (add_objc_string): Cast return value to 'char *'. (build_method_prototype_template, build_selector_template, build_method_template): Use actual selector type for fields pointing to selectors. (finish_objc): For GNU runtime, call build_module_initializer_routine() after build_module_descriptor(). (generate_protocol_list, generate_shared_structures): Call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(); build a type directly instead of via groktypename(). (synth_id_with_class_suffix): Return a string. (get_arg_type_list): For instance methods, use the instance type for 'self'; do not call groktypename_in_parm_context(). (build_objc_string_decl): Squash redeclaration errors in ObjC++. (objc_is_class_name): Use OBJC_TYPE_NAME instead of TYPE_NAME; handle RECORD_TYPEs in ObjC as well as ObjC++. (objc_is_id): New function. (objc_is_object_ptr): Return the canonical type node. (objc_get_class_ivars): Simplify using get_class_ivars(). (get_class_ivars): Remove second parameter; create a fresh copy of the ivar list for each call; do not check for existence of super class. (objc_eh_runtime_type): Mark #ifndef OBJCPLUS. (objc_init_exceptions): When using SJLJ-style exceptions, require the use of '-fobjc-exceptions' flag; do not require it for DWARF-style exceptions. (objc_build_exc_ptr, next_sjlj_build_try_catch_finally): Use objc_object_type instead of objc_id_type. (objc_begin_catch_clause): Convert the incoming PARM_DECL into a VAR_DECL before placing it in the appropriate scope; do not call define_decl(); adjust call to c_begin_compound_stmt(); use objc_object_type instead of objc_id_type. (build_next_objc_exception_stuff): Call create_field_decl() instead of create_builtin_decl(); construct type directly instead of calling groktypename(); use OBJC_VOID_AT_END to mark end of function parameters. (build_private_template): Adjust call to get_class_ivars(); build a type directly instead of via groktypename(). (build_protocol_template, build_method_prototype_list_template, build_method_prototype_template, build_category_template, build_selector_template, build_class_template, build_super_template, build_ivar_template, build_ivar_list_template, build_method_list_template, build_method_template): Call create_field_decl() instead of grokfield(). (objc_method_parm_type): Do not call groktypename(). (generate_descriptor_table): Call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(). (generate_method_descriptors, build_protocol_initializer, generate_dispatch_tables, build_category_initializer, build_shared_structure_initializer): Do not call groktypename(). (generate_protocols): Call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(); do not call groktypename(). (error_with_ivar): Remove last parameter. (check_ivars): Do not iterate ovar CLASS_RAW_IVARS lists in addition to CLASS_IVARS lists; adjust calls to error_with_ivar(). (generate_ivar_lists): Convert one of the initializer elements; do not call groktypename(). (get_arg_type_list, start_method_def, gen_method_def): Account for new representation of variable arguments and '...' in Objective-C methods; add Objective-C++ impedance matching code. (is_objc_type_qualifier): Remove function. (adjust_type_for_id_default): Simplify; there is no longer a need to wade through declspecs. (lookup_interface, start_class, continue_class, finish_class, start_method_def, start_protocol, build_method_decl, objc_add_method, add_instance_variable, build_ivar_reference, is_ivar, is_private, get_super_receiver, objc_build_finally_epilogue): Make into static functions. (receiver_is_class_object): Use new IS_CLASS() macro. (objc_build_message_expr): Tweak ObjC++ message argument handling; call objc_finish_message_expr() instead of finish_message_expr(). (finish_message_expr): Rename to objc_finish_message_expr(); use OBJC_TYPE_NAME and OBJC_SET_TYPE_NAME macros instead of TYPE_NAME. call gen_type_name() instead of gen_declaration(); call objc_is_id() instead of using IS_ID and IS_CLASS; Use objc_class_name instead of calling get_identifier("Class"); handle CONVERT_EXPRs in receiver. (build_objc_method_call, warn_with_method): Do not call groktypename(). (build_ivar_reference): Call convert() instead of clobbering in a type. (hash_init): Initialize string_htab hash table. (add_instance_variable): Simplify parameter list; do not call grokfield(); do not populate CLASS_IVARS list. (start_class): Check for the existence of super class, if one was specified. (continue_class): Use CLASS_RAW_IVARS rather than CLASS_IVARS; do not call build_class_template(); adjust call to get_class_ivars(); call build_decl(), pushdecl() and finish_decl() instead of define_decl(). (finish_class): Call build_decl(), pushdecl() and finish_decl() instead of define_decl(). (add_protocols): Use PROTOCOL_BINFO_ELTS for the tree vector size. (start_protocol): Do not call build_protocol_template(); use PROTOCOL_BINFO_ELTS for the tree vector size. (encode_type_qualifiers): Do not handle the 'const' qualifier here. (encode_pointer): Encode 'const char *' as 'r*', for backwards compatibility. (encode_array): Use HOST_WIDE_INT_PRINT_DEC instead of "%ld". (encode_type): Handle the 'const' qualifier here. (objc_parmlist): New global variable, sued by objc_push_parm and objc_get_parm_info(). (objc_push_parm, objc_get_parm_info): New functions. (objc_expr_last): Remove function. (synth_self_and_ucmd_args): For instance methods, use the instance type for 'self'; call objc_push_parm() instead of push_parm_decl(). (start_method_def): Do not call push_scope(), declare_parm_level(), pop_scope(), push_parm_decl(), store_parm_decls() or objc_expr_last(); just use objc_push_parm() and objc_get_parm_info(). (comp_method_with_proto): Remove function. (objc_types_are_equivalent): Strip away indirections before comparing underlying types. (comp_proto_with_proto): Do not call groktypename(); types are no longer in raw declspec format. (objc_start_function): New function. (really_start_method): Call comp_proto_with_proto() instead of comp_method_with_proto(); call objc_start_function() instead of hand-crafting a function declarator. (continue_method_def, objc_expand_function_end): Remove functions. (get_super_receiver): Call objc_get_current_scope() instead of get_current_scope(); reference 'super_class' field (instead of 'class'). (finish_method_def): Rename to objc_finish_method_definition() and add a function decl parameter; move method encoding call from objc_expand_function_end(). (is_complex_decl, adorn_decl, gen_declarator, gen_declspecs, gen_declaration_1): Remove functions. (tmpbuf, RAW_DECLSPEC): Remove. (gen_declaration): Remove second parameter; simplify to deal with TYPE_P nodes instead of raw declspecs. (gen_type_name, gen_type_name_0): New functions. (gen_method_decl): Remove second parameter; call gen_type_name() instead of gen_declaration_1(). (dump_interface): Adjust calls to gen_declaration() and gen_method_decl(); do not allocate a separate string buffer. (init_objc): Allocate a larger string buffer to accommodate dump_interface(); adjust call to build_module_descriptor(); add call to build_module_initializer_routine() for the GNU runtime. (generate_classref_translation_entry): Do not call start_decl(); call finish_var_decl() instead of finish_decl(); call convert() instead of build_c_cast(). * objc-act.h (CLASS_OWN_IVARS): Remove accessor. (CLASS_BINFO_ELTS): Reduce from 6 to 5, now that CLASS_OWN_IVARS is gone. (OCTI_GNU_INIT_DECL, GNU_INIT_decl): New. (OCTI_ELLIPSIS_NODE, objc_ellipsis_node): Remove. (OCTI_ID_ID, id_type, objc_id_id): Rename to OCTI_ID_NAME, objc_object_type and objc_object_name, respectively. (OCTI_CLS_REF, OCTI_CLASS_NAME, objc_class_reference, objc_class_name): New. (IS_CLASS): New macro. (IS_ID, IS_SUPER): Robustify. (OCTI_EXECCLASS_DECL, execclass_decl): New. (finish_file, start_class, continue_class, finish_class, start_method_def, continue_method_def, finish_method_def, start_protocol, finish_protocol, objc_build_throw_stmt, objc_build_try_catch_finally_stmt, objc_build_synchronized_prologue, objc_build_synchronized_epilogue, objc_build_try_prologue, objc_build_try_epilogue, objc_build_catch_stmt, objc_build_catch_epilogue, objc_build_finally_prologue, objc_build_finally_epilogue, is_ivar, is_private, is_public, add_instance_variable, objc_add_method, get_super_receiver, objc_clear_super_receiver, get_class_ivars_from_name, get_class_reference, get_static_reference, get_object_reference, build_message_expr, finish_message_expr, build_selector_expr, build_ivar_reference, build_keyword_decl, build_method_decl, build_protocol_expr, build_objc_string_object, objc_declare_alias, objc_declare_class, objc_declare_protocols, objc_comptypes, objc_check_decl, build_encode_expr): Remove prototypes. (imp_count, cat_count): Make GGC-aware. (OBJC_SET_TYPE_NAME): New macro. From-SVN: r87168
2004-09-08 02:49:44 +02:00
objc-act.c (build_private_template): Change to return 'void'... [gcc/objc/ChangeLog] 2004-12-15 Ziemowit Laski <zlaski@apple.com> * objc-act.c (build_private_template): Change to return 'void'; do not set ivar_context, uprivate_record or objc_instance_type. (objc_comptypes, gen_type_name_0): For types 'id' and 'Class', retrieve protocol list from the pointee rather than the pointer itself; check TYPE_HAS_OBJC_INFO(...) precondition before accessing TYPE_OBJC_PROTOCOL_LIST. (objc_get_protocol_qualified_type): For types 'id' and 'Class', construct a variant of the pointee as well as the pointer, and store protocol information in the former. When creating variants of RECORD_TYPEs, clone their TYPE_LANG_SPECIFIC fields and propagate TYPE_OBJC_INTERFACE information. (objc_declare_class): If a TYPE_DECL is looked up, retrieve the underlying RECORD_TYPE to check for presence of TYPE_OBJC_INTERFACE; for newly-created RECORD_TYPEs, create a tentative TYPE_OBJC_INTERFACE holding an IDENTIFIER_NODE. (objc_finish_message_expr): Check TYPE_HAS_OBJC_INFO(...) before accessing TYPE_OBJC_PROTOCOL_LIST; Use TYPE_OBJC_INTERFACE instead of calling lookup_interface(); allow for TYPE_OBJC_INTERFACE holding an IDENTIFIER_NODE (meaning a @class forward-declaration only). (objc_is_public): Check TYPE_OBJC_INTERFACE instead of calling lookup_interface(). (continue_class): For @implementations, set ivar_context, uprivate_record and objc_instance_type, for @interfaces, call build_private_template(). (encode_pointer): Check TYPE_HAS_OBJC_INFO(...) before accessing TYPE_OBJC_INTERFACE. (objc_types_are_equivalent): Check TYPE_HAS_OBJC_INFO(...) before accessing TYPE_OBJC_PROTOCOL_LIST. * objc-act.h (OBJC_INFO_SLOT_ELTS, TYPE_OBJC_INFO, INIT_TYPE_OBJC_INFO, DUP_TYPE_OBJC_INFO, ALLOC_OBJC_TYPE_LANG_SPECIFIC, SIZEOF_OBJC_TYPE_LANG_SPECIFIC): New macros. (TYPE_OBJC_INTERFACE): Replaces TREE_STATIC_INSTANCE and now points to an actual @interface; stored in TYPE_LANG_SPECIFIC(...). (TYPE_OBJC_PROTOCOL_LIST): Replaces TYPE_PROTOCOL_LIST; stored in TYPE_LANG_SPECIFIC(...). (TREE_STATIC_INSTANCE, TYPE_PROTOCOL_LIST): Delete. (IS_ID, IS_CLASS, IS_PROTOCOL_QUALIFIED_UNTYPED, IS_SUPER, TYPED_OBJECT): Check for POINTER_TYPE rather than POINTER_TYPE_P; adjust for use of TYPE_OBJC_INTERFACE and TYPE_OBJC_PROTOCOL_LIST instead of TREE_STATIC_INSTANCE and TYPE_PROTOCOL_LIST. From-SVN: r92239
2004-12-16 02:10:38 +01:00
/* For pointers (i.e., 'id' or 'Class'), attach the protocol(s)
to the pointee. */
if (is_ptr)
{
c-common.c (c_common_nodes_and_builtins): Since variants of void_type_node get built before it is given a name... 2007-01-02 Douglas Gregor <doug.gregor@gmail.com> * c-common.c(c_common_nodes_and_builtins): Since variants of void_type_node get built before it is given a name, we need to give those variants the name, too. (complete_array_type): We need to work with the canonical main type of the array, from which we will build the qualified version. * params.def (PARAM_VERIFY_CANONICAL_TYPES): New. * print-tree.c (print_node): Display canonical type information for each type. * stor-layout.c (layout_type): When we don't know the alignment of a type for which we're building an array, we end up guessing wrong, so make the type require structural equality. * tree.c (make_node_stat): When we build a new type, it is its own canonical type. (build_type_attribute_qual_variant): When building an attribute variant, its canonical type is the non-attribute variant. However, if the attributes are target-dependent and they differ, we need to use structural equality checks for this type. (build_qualified_type): A qualified type is not equivalent to its unqualified variant; set the canonical type appropriately. (build_distinct_type_copy): When building a distinct type from another type, the new type is its own canonical type. (build_variant_type_copy): When building a new type variant, we assume that it is equivalent to the original type. (build_pointer_type_for_mode): When building a pointer type, also build a canonical type pointer. (build_reference_type_for_mode): When building a reference type, also build a canonical type reference. (build_index_type): When we can't hash an index type (e.g., because its maximum value is negative), the index type requires structural equality tests. (build_array_type): Build the canonical form of an array type. (build_function_type): Function types require structural equality, because they contain default arguments, attributes, etc. (build_method_type_directly): Ditto for method types. (build_offset_type): Build the canonical offset type. (build_complex_type): Build the canonical vector type. (make_vector_type): Build the canonical vector type. * tree.h (TYPE_CANONICAL): New. (TYPE_STRUCTURAL_EQUALITY_P): New. (SET_TYPE_STRUCTURAL_EQUALITY): New. (struct tree_type): Added "canonical" field. * params.h (VERIFY_CANONICAL_TYPES): New. * doc/c-tree.texi (TYPE_CANONICAL): Document. (TYPE_STRUCTURAL_EQUALITY_P): Document. (SET_TYPE_STRUCTURAL_EQUALITY): Document. * doc/invoke.texi (verify-canonical-types): Document --param parameter for verifying canonical types. 2007-01-02 Douglas Gregor <doug.gregor@gmail.com> * typeck.c (structural_comptypes): Renamed from "comptypes". (comptypes): Use canonical type information to perform fast type comparison. When VERIFY_CANONICAL_TYPES, verify that the canonical type comparison returns the same results as we would see from the current, structural check. Support COMPARE_STRUCTURAL when we need structural checks. * decl.c (typename_compare): Fix comment. (build_typename_type): TYPENAME_TYPE nodes require structural equality checks, because they resolve different based on the current class type. (make_unbound_class_template): UNBOUND_CLASS_TEMPLATE nodes require structural equality checks (for now). (build_ptrmemfunc_type): Build the canonical pointer to member function type. (compute_array_index_type): Whenever we build a new index type to represent the size of an array in a template, we need to mark this index type as requiring structural equality. This goes for arrays with value-dependent sizes with the current ABI, or all arrays with ABI-1. * tree.c (cplus_array_hash): New. (struct cplus_array_info): New. (cplus_array_compare): New. (cplus_array_htab): New. (build_cplus_array_type_1): Use a hash table to cache the array types we build. Build the canonical array type for each array type. (cp_build_qualified_type_real): When building a cv-qualified array type, use the hash table of array types and build canonical array types as necessary. (bind_template_template_parm): BOUND_TEMPLATE_TEMPLATE_PARM nodes use structural equality (for now). * cp-tree.h (COMPARE_STRUCTURAL): New. * pt.c (canonical_template_parms): New. (canonical_type_parameter): New. (process_template_parm): Find the canonical type parameter. (lookup_template_class): When we have named the primary template type, set the canonical type for our template class to the primary template type. If any of the template arguments need structural equality checks, the template class needs structural equality checks. (tsubst): When reducing the level of a template template parameter, we require structural equality tests for the resulting parameter because its template parameters have not had their types canonicalized. When reducing a template type parameter, find the canonical reduced type parameter. (any_template_arguments_need_structural_equality_p): New. 2007-01-02 Douglas Gregor <doug.gregor@gmail.com> * objc-act.c (objc_build_volatilized_type): Keep track of canonical types. (objc_get_protocol_qualified_type): Ditto. From-SVN: r120341
2007-01-02 15:23:26 +01:00
tree orig_pointee_type = TREE_TYPE (type);
TREE_TYPE (type) = build_variant_type_copy (orig_pointee_type);
/* Set up the canonical type information. */
TYPE_CANONICAL (type)
= TYPE_CANONICAL (TYPE_POINTER_TO (orig_pointee_type));
objc-act.c (build_private_template): Change to return 'void'... [gcc/objc/ChangeLog] 2004-12-15 Ziemowit Laski <zlaski@apple.com> * objc-act.c (build_private_template): Change to return 'void'; do not set ivar_context, uprivate_record or objc_instance_type. (objc_comptypes, gen_type_name_0): For types 'id' and 'Class', retrieve protocol list from the pointee rather than the pointer itself; check TYPE_HAS_OBJC_INFO(...) precondition before accessing TYPE_OBJC_PROTOCOL_LIST. (objc_get_protocol_qualified_type): For types 'id' and 'Class', construct a variant of the pointee as well as the pointer, and store protocol information in the former. When creating variants of RECORD_TYPEs, clone their TYPE_LANG_SPECIFIC fields and propagate TYPE_OBJC_INTERFACE information. (objc_declare_class): If a TYPE_DECL is looked up, retrieve the underlying RECORD_TYPE to check for presence of TYPE_OBJC_INTERFACE; for newly-created RECORD_TYPEs, create a tentative TYPE_OBJC_INTERFACE holding an IDENTIFIER_NODE. (objc_finish_message_expr): Check TYPE_HAS_OBJC_INFO(...) before accessing TYPE_OBJC_PROTOCOL_LIST; Use TYPE_OBJC_INTERFACE instead of calling lookup_interface(); allow for TYPE_OBJC_INTERFACE holding an IDENTIFIER_NODE (meaning a @class forward-declaration only). (objc_is_public): Check TYPE_OBJC_INTERFACE instead of calling lookup_interface(). (continue_class): For @implementations, set ivar_context, uprivate_record and objc_instance_type, for @interfaces, call build_private_template(). (encode_pointer): Check TYPE_HAS_OBJC_INFO(...) before accessing TYPE_OBJC_INTERFACE. (objc_types_are_equivalent): Check TYPE_HAS_OBJC_INFO(...) before accessing TYPE_OBJC_PROTOCOL_LIST. * objc-act.h (OBJC_INFO_SLOT_ELTS, TYPE_OBJC_INFO, INIT_TYPE_OBJC_INFO, DUP_TYPE_OBJC_INFO, ALLOC_OBJC_TYPE_LANG_SPECIFIC, SIZEOF_OBJC_TYPE_LANG_SPECIFIC): New macros. (TYPE_OBJC_INTERFACE): Replaces TREE_STATIC_INSTANCE and now points to an actual @interface; stored in TYPE_LANG_SPECIFIC(...). (TYPE_OBJC_PROTOCOL_LIST): Replaces TYPE_PROTOCOL_LIST; stored in TYPE_LANG_SPECIFIC(...). (TREE_STATIC_INSTANCE, TYPE_PROTOCOL_LIST): Delete. (IS_ID, IS_CLASS, IS_PROTOCOL_QUALIFIED_UNTYPED, IS_SUPER, TYPED_OBJECT): Check for POINTER_TYPE rather than POINTER_TYPE_P; adjust for use of TYPE_OBJC_INTERFACE and TYPE_OBJC_PROTOCOL_LIST instead of TREE_STATIC_INSTANCE and TYPE_PROTOCOL_LIST. From-SVN: r92239
2004-12-16 02:10:38 +01:00
TYPE_POINTER_TO (TREE_TYPE (type)) = type;
type = TREE_TYPE (type);
}
/* Look up protocols and install in lang specific list. */
DUP_TYPE_OBJC_INFO (type, TYPE_MAIN_VARIANT (type));
TYPE_OBJC_PROTOCOL_LIST (type) = lookup_and_install_protocols (protocols);
/* For RECORD_TYPEs, point to the @interface; for 'id' and 'Class',
return the pointer to the new pointee variant. */
if (is_ptr)
type = TYPE_POINTER_TO (type);
else
TYPE_OBJC_INTERFACE (type)
= TYPE_OBJC_INTERFACE (TYPE_MAIN_VARIANT (type));
}
Makefile.in (c-parse.o): Depend on $(C_COMMON_H). [gcc/ChangeLog] 2004-09-07 Ziemowit Laski <zlaski@apple.com> * Makefile.in (c-parse.o): Depend on $(C_COMMON_H). * c-parse.in: Include c-common.h instead of objc-act.h. (ivar_decl_list, ivar_decls, ivar_decl, ivars, ivar_declarator, myparms, myparm): Remove %type declarations. (methodtype, optparms, OBJC_TYPE_QUAL, objc_quals, objc_qual, objc_typename, objc_try_catch_stmt, optellipsis): Add %type declarations. (objc_inherit_code, objc_public_flag): Remove. (typespec_nonreserved_nonattr): Call objc_get_protocol_qualified_type() instead of get_static_reference() and get_protocol_reference(). (stmt_nocomp): Call grokparm() on @catch parameter. (objcdef): Move semantic action to objc_finish_implementation(). (classdef): Move semantic action to objc_start_class_interface(), objc_continue_interface(), objc_finish_interface(), objc_start_class_implementation(), objc_continue_implementation(), objc_start_category_interface() and objc_start_category_implementation(). (protocoldef): Move semantic actions to objc_start_protocol() and objc_finish_interface(). (ivar_decl_list): Remove nonterminal. (visibility_spec): Move semantic actions to objc_set_visibility(). (ivar_decls): Remove assignment to $$. (ivar_decl): Rephrase in terms of component_decl; call objc_add_instance_variable(). (ivars, ivar_declarator): Remove nonterminals. (opt_semi): New nonterminal. (methodtype): Remove semantic actions. (methoddef): Move semantic actions to objc_set_method_type(), objc_start_method_definition() and objc_finish_method_definition(). (methodproto): Move semantic actions to objc_set_method_type() and objc_add_method_declaration(). (methoddecl): Use objc_typename instead of typename; move semantic actions to objc_build_method_signature(). (optarglist, myxdecls, mydecl, myparms, myparm): Remove nonterminals. (optparmlist): Express in terms of optparms and optellipsis. (optparms, optellipsis, objc_qual, objc_quals, objc_typename): New nonterminals. (keyworddecl): Use objc_typename instead of typename. (rid_to_yy): Mark RID_IN, RID_OUT, RID_INOUT, RID_BYCOPY, RID_BYREF and RID_ONEWAY as returning OBJC_TYPE_QUAL to yyparse(). [gcc/objc/ChangeLog] 2004-09-07 Ziemowit Laski <zlaski@apple.com> * Make-lang.in (objc/objc-parse.o): Depend on $(C_COMMON_H) instead of objc/objc-act.h. (objc/objc-act.o): Depend on $(HASHTAB_H). * objc-act.c: Include hashtab.h; in ObjC++ mode, include cp-tree.h and objcp-decl.h instead of c-tree.h. (build_module_descriptor, get_class_ivars, synth_id_with_class_suffix, error_with_ivar, gen_method_decl, gen_declaration, setup_string_decl, build_protocol_template): Adjust prototypes. (build_module_initializer_routine, start_class, continue_class, finish_class, start_method_def, objc_start_function, start_protocol, build_method_decl, objc_add_method, add_instance_variable, build_ivar_reference, is_ivar, is_private, get_super_receiver, build_selector_table_decl, objc_push_parm, objc_get_parm_info, gen_type_name, gen_type_name_0, start_var_decl, finish_var_decl, create_field_decl): New prototypes. (objc_expand_function_end, comp_method_with_proto, objc_expr_last, gen_declaration_1, gen_declarator, is_complex_decl, adorn_decl, define_decl, create_builtin_decl, gen_declspecs): Remove prototypes. (TYPE_ID): Rename to OBJECT_TYPEDEF_NAME. (CLASS_TYPEDEF_NAME): New. (TAG_EXECCLASS): Change from a global variable to a #define. (TAG_RETURN_STRUCT): Delete. (TAG_GNUINIT): New, holds '__objc_gnu_init' name. (objc_inherit_code, objc_public_flag): New, moved from c-parse.in. (string_descriptor): New struct. (string_htab): New hash table. (string_hash, string_eq): New prototypes. (generate_struct_by_value_array): Call create_field_decl() instead of create_builtin_decl(). (objc_init): Do not initialize objc_ellipsis_node or TAG_EXECCLASS; In ObjC++ mode, call cxx_init() instead of c_objc_common_init(). (objc_finish_file): In ObjC++, call instantiate_pending_templates() and cp_finish_file(). (define_decl, get_static_reference, get_protocol_reference, create_builtin_decl): Remove functions. (objc_start_class_interface, objc_start_category_interface, objc_start_protocol, objc_continue_interface, objc_finish_interface, objc_start_class_implementation, objc_start_category_implementation, objc_continue_implementation, objc_finish_implementation, objc_set_visibility, objc_set_method_type, objc_build_method_signature, objc_add_method_declaration, objc_start_method_definition, objc_add_instance_variable, objc_get_protocol_qualified_type, create_field_decl, start_var_decl, finish_var_decl): New functions. (setup_string_decl): Simplify since it is only called once. (synth_module_prologue): Call build_class_template(); predefine 'id' and 'Class' as typedefs; rename 'temp_type' to 'type'; disable debug hooks for duration of function; fix GNU runtime messenger signatures to correspond to reality; forward-declare '__objc_exec_class' for the GNU runtime; call build_selector_table_decl(); in ObjC++ mode, generate 'extern "C" { ... }' wrappers around synthesized declarations; call build_protocol_template() and build_category_template(). (string_hash, string_eq): New functions. (objc_build_string_object): Check metaclass correctness only once; store string literals in hash table. (objc_build_constructor): Do not convert initializer elements; adjust for ObjC++ impedance mismatch. (build_objc_symtab_template): Call create_field_decl() instead of create_builtin_decl(). (init_objc_symtab): Add missing conversion to initializer element. (build_metadata_decl): Call start_var_decl() instead of define_decl(). (generate_objc_symtab_decl): Do not call build_category_template(); call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(). (build_module_descriptor): Call create_field_decl() instead of grokfield(); call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(); always mark module descriptor as used; move GNU runtime-specific functionality to build_module_initializer_routine(). (build_module_initializer_routine): New function, broken off of build_module_descriptor(). (objc_static_init_needed_p, objc_generate_static_init_call): New functions. (generate_static_references, generate_strings, build_selector_translation_table, generate_descriptor_table, generate_ivars_list, generate_dispatch_table, generate_category): Call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(); build a type directly instead of via groktypename(). (build_selector_reference_decl, build_selector_table_decl, build_class_reference_decl, build_protocol_reference, generate_objc_image_info): Call start_var_decl() instead of build_decl(). (build_selector_reference): For GNU runtime, do not call build_selector_reference_decl(). (build_selector, build_typed_selector_reference): Always convert result to the selector type. (add_objc_string): Cast return value to 'char *'. (build_method_prototype_template, build_selector_template, build_method_template): Use actual selector type for fields pointing to selectors. (finish_objc): For GNU runtime, call build_module_initializer_routine() after build_module_descriptor(). (generate_protocol_list, generate_shared_structures): Call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(); build a type directly instead of via groktypename(). (synth_id_with_class_suffix): Return a string. (get_arg_type_list): For instance methods, use the instance type for 'self'; do not call groktypename_in_parm_context(). (build_objc_string_decl): Squash redeclaration errors in ObjC++. (objc_is_class_name): Use OBJC_TYPE_NAME instead of TYPE_NAME; handle RECORD_TYPEs in ObjC as well as ObjC++. (objc_is_id): New function. (objc_is_object_ptr): Return the canonical type node. (objc_get_class_ivars): Simplify using get_class_ivars(). (get_class_ivars): Remove second parameter; create a fresh copy of the ivar list for each call; do not check for existence of super class. (objc_eh_runtime_type): Mark #ifndef OBJCPLUS. (objc_init_exceptions): When using SJLJ-style exceptions, require the use of '-fobjc-exceptions' flag; do not require it for DWARF-style exceptions. (objc_build_exc_ptr, next_sjlj_build_try_catch_finally): Use objc_object_type instead of objc_id_type. (objc_begin_catch_clause): Convert the incoming PARM_DECL into a VAR_DECL before placing it in the appropriate scope; do not call define_decl(); adjust call to c_begin_compound_stmt(); use objc_object_type instead of objc_id_type. (build_next_objc_exception_stuff): Call create_field_decl() instead of create_builtin_decl(); construct type directly instead of calling groktypename(); use OBJC_VOID_AT_END to mark end of function parameters. (build_private_template): Adjust call to get_class_ivars(); build a type directly instead of via groktypename(). (build_protocol_template, build_method_prototype_list_template, build_method_prototype_template, build_category_template, build_selector_template, build_class_template, build_super_template, build_ivar_template, build_ivar_list_template, build_method_list_template, build_method_template): Call create_field_decl() instead of grokfield(). (objc_method_parm_type): Do not call groktypename(). (generate_descriptor_table): Call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(). (generate_method_descriptors, build_protocol_initializer, generate_dispatch_tables, build_category_initializer, build_shared_structure_initializer): Do not call groktypename(). (generate_protocols): Call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(); do not call groktypename(). (error_with_ivar): Remove last parameter. (check_ivars): Do not iterate ovar CLASS_RAW_IVARS lists in addition to CLASS_IVARS lists; adjust calls to error_with_ivar(). (generate_ivar_lists): Convert one of the initializer elements; do not call groktypename(). (get_arg_type_list, start_method_def, gen_method_def): Account for new representation of variable arguments and '...' in Objective-C methods; add Objective-C++ impedance matching code. (is_objc_type_qualifier): Remove function. (adjust_type_for_id_default): Simplify; there is no longer a need to wade through declspecs. (lookup_interface, start_class, continue_class, finish_class, start_method_def, start_protocol, build_method_decl, objc_add_method, add_instance_variable, build_ivar_reference, is_ivar, is_private, get_super_receiver, objc_build_finally_epilogue): Make into static functions. (receiver_is_class_object): Use new IS_CLASS() macro. (objc_build_message_expr): Tweak ObjC++ message argument handling; call objc_finish_message_expr() instead of finish_message_expr(). (finish_message_expr): Rename to objc_finish_message_expr(); use OBJC_TYPE_NAME and OBJC_SET_TYPE_NAME macros instead of TYPE_NAME. call gen_type_name() instead of gen_declaration(); call objc_is_id() instead of using IS_ID and IS_CLASS; Use objc_class_name instead of calling get_identifier("Class"); handle CONVERT_EXPRs in receiver. (build_objc_method_call, warn_with_method): Do not call groktypename(). (build_ivar_reference): Call convert() instead of clobbering in a type. (hash_init): Initialize string_htab hash table. (add_instance_variable): Simplify parameter list; do not call grokfield(); do not populate CLASS_IVARS list. (start_class): Check for the existence of super class, if one was specified. (continue_class): Use CLASS_RAW_IVARS rather than CLASS_IVARS; do not call build_class_template(); adjust call to get_class_ivars(); call build_decl(), pushdecl() and finish_decl() instead of define_decl(). (finish_class): Call build_decl(), pushdecl() and finish_decl() instead of define_decl(). (add_protocols): Use PROTOCOL_BINFO_ELTS for the tree vector size. (start_protocol): Do not call build_protocol_template(); use PROTOCOL_BINFO_ELTS for the tree vector size. (encode_type_qualifiers): Do not handle the 'const' qualifier here. (encode_pointer): Encode 'const char *' as 'r*', for backwards compatibility. (encode_array): Use HOST_WIDE_INT_PRINT_DEC instead of "%ld". (encode_type): Handle the 'const' qualifier here. (objc_parmlist): New global variable, sued by objc_push_parm and objc_get_parm_info(). (objc_push_parm, objc_get_parm_info): New functions. (objc_expr_last): Remove function. (synth_self_and_ucmd_args): For instance methods, use the instance type for 'self'; call objc_push_parm() instead of push_parm_decl(). (start_method_def): Do not call push_scope(), declare_parm_level(), pop_scope(), push_parm_decl(), store_parm_decls() or objc_expr_last(); just use objc_push_parm() and objc_get_parm_info(). (comp_method_with_proto): Remove function. (objc_types_are_equivalent): Strip away indirections before comparing underlying types. (comp_proto_with_proto): Do not call groktypename(); types are no longer in raw declspec format. (objc_start_function): New function. (really_start_method): Call comp_proto_with_proto() instead of comp_method_with_proto(); call objc_start_function() instead of hand-crafting a function declarator. (continue_method_def, objc_expand_function_end): Remove functions. (get_super_receiver): Call objc_get_current_scope() instead of get_current_scope(); reference 'super_class' field (instead of 'class'). (finish_method_def): Rename to objc_finish_method_definition() and add a function decl parameter; move method encoding call from objc_expand_function_end(). (is_complex_decl, adorn_decl, gen_declarator, gen_declspecs, gen_declaration_1): Remove functions. (tmpbuf, RAW_DECLSPEC): Remove. (gen_declaration): Remove second parameter; simplify to deal with TYPE_P nodes instead of raw declspecs. (gen_type_name, gen_type_name_0): New functions. (gen_method_decl): Remove second parameter; call gen_type_name() instead of gen_declaration_1(). (dump_interface): Adjust calls to gen_declaration() and gen_method_decl(); do not allocate a separate string buffer. (init_objc): Allocate a larger string buffer to accommodate dump_interface(); adjust call to build_module_descriptor(); add call to build_module_initializer_routine() for the GNU runtime. (generate_classref_translation_entry): Do not call start_decl(); call finish_var_decl() instead of finish_decl(); call convert() instead of build_c_cast(). * objc-act.h (CLASS_OWN_IVARS): Remove accessor. (CLASS_BINFO_ELTS): Reduce from 6 to 5, now that CLASS_OWN_IVARS is gone. (OCTI_GNU_INIT_DECL, GNU_INIT_decl): New. (OCTI_ELLIPSIS_NODE, objc_ellipsis_node): Remove. (OCTI_ID_ID, id_type, objc_id_id): Rename to OCTI_ID_NAME, objc_object_type and objc_object_name, respectively. (OCTI_CLS_REF, OCTI_CLASS_NAME, objc_class_reference, objc_class_name): New. (IS_CLASS): New macro. (IS_ID, IS_SUPER): Robustify. (OCTI_EXECCLASS_DECL, execclass_decl): New. (finish_file, start_class, continue_class, finish_class, start_method_def, continue_method_def, finish_method_def, start_protocol, finish_protocol, objc_build_throw_stmt, objc_build_try_catch_finally_stmt, objc_build_synchronized_prologue, objc_build_synchronized_epilogue, objc_build_try_prologue, objc_build_try_epilogue, objc_build_catch_stmt, objc_build_catch_epilogue, objc_build_finally_prologue, objc_build_finally_epilogue, is_ivar, is_private, is_public, add_instance_variable, objc_add_method, get_super_receiver, objc_clear_super_receiver, get_class_ivars_from_name, get_class_reference, get_static_reference, get_object_reference, build_message_expr, finish_message_expr, build_selector_expr, build_ivar_reference, build_keyword_decl, build_method_decl, build_protocol_expr, build_objc_string_object, objc_declare_alias, objc_declare_class, objc_declare_protocols, objc_comptypes, objc_check_decl, build_encode_expr): Remove prototypes. (imp_count, cat_count): Make GGC-aware. (OBJC_SET_TYPE_NAME): New macro. From-SVN: r87168
2004-09-08 02:49:44 +02:00
return type;
}
/* Check for circular dependencies in protocols. The arguments are
PROTO, the protocol to check, and LIST, a list of protocol it
conforms to. */
static void
check_protocol_recursively (tree proto, tree list)
{
tree p;
for (p = list; p; p = TREE_CHAIN (p))
{
tree pp = TREE_VALUE (p);
if (TREE_CODE (pp) == IDENTIFIER_NODE)
pp = lookup_protocol (pp);
if (pp == proto)
builtins.c, [...]: Avoid "`" as left quote, using "'" or %q, %< and %> as appropriate. * builtins.c, c-common.c, c-decl.c, c-format.c, c-format.h, c-parse.in, c-pch.c, c-pragma.c, collect2.c, final.c, gcc.c, gcov.c, opts.c, pretty-print.h, protoize.c, reg-stack.c, rtl.c, tlink.c, config/alpha/alpha.c, config/arc/arc.c, config/arm/arm.c, config/avr/avr.c, config/c4x/c4x.c, config/darwin.c, config/frv/frv.c, config/h8300/h8300.c, config/i386/i386.c, config/i386/winnt.c, config/ia64/ia64.c, config/ip2k/ip2k.c, config/iq2000/iq2000.c, config/m32r/m32r.c, config/m68hc11/m68hc11.c, config/m68k/m68k.c, config/m68k/m68k.h, config/mcore/mcore.c, config/mips/mips.c, config/mmix/mmix.c, config/ns32k/ns32k.c, config/rs6000/host-darwin.c, config/rs6000/rs6000.c, config/s390/s390.c, config/sh/sh.c, config/sh/symbian.c, config/stormy16/stormy16.c, config/v850/v850.c: Avoid "`" as left quote, using "'" or %q, %< and %> as appropriate. Use %' as apostrophe in diagnostics where applicable. Use %< and %> in place of '' quotes where applicable. Use %qs in place of %<%s%>. Consistently quote __builtin function names. ada: * misc.c (gnat_handle_option): Use %< and %> for quoting in warning message. cp: * call.c, class.c, decl.c, decl2.c, error.c, mangle.c, parser.c, pt.c, search.c, semantics.c, typeck.c: Use %q, %< and %> for quoting in diagnostics. * parser.c (cp_parser_sizeof_operand): Use '' instead of `' for quoting in printf format. * decl.c (duplicate_decls, start_decl): Use %qD instead of unquoted %D. objc: * objc-act.c: Use %q, %< and %> for quoting in diagnostics. testsuite: * gcc.dg/builtin-prefetch-1.c: Adjust expected messages. From-SVN: r90337
2004-11-09 11:13:30 +01:00
fatal_error ("protocol %qs has circular dependency",
IDENTIFIER_POINTER (PROTOCOL_NAME (pp)));
if (pp)
check_protocol_recursively (proto, PROTOCOL_LIST (pp));
}
}
/* Look up PROTOCOLS, and return a list of those that are found.
If none are found, return NULL. */
static tree
lookup_and_install_protocols (tree protocols)
1992-01-18 00:15:38 +01:00
{
tree proto;
tree return_value = NULL_TREE;
for (proto = protocols; proto; proto = TREE_CHAIN (proto))
{
tree ident = TREE_VALUE (proto);
tree p = lookup_protocol (ident);
if (p)
return_value = chainon (return_value,
build_tree_list (NULL_TREE, p));
else if (ident != error_mark_node)
error ("cannot find protocol declaration for %qs",
IDENTIFIER_POINTER (ident));
}
return return_value;
1992-01-18 00:15:38 +01:00
}
Makefile.in (c-parse.o): Depend on $(C_COMMON_H). [gcc/ChangeLog] 2004-09-07 Ziemowit Laski <zlaski@apple.com> * Makefile.in (c-parse.o): Depend on $(C_COMMON_H). * c-parse.in: Include c-common.h instead of objc-act.h. (ivar_decl_list, ivar_decls, ivar_decl, ivars, ivar_declarator, myparms, myparm): Remove %type declarations. (methodtype, optparms, OBJC_TYPE_QUAL, objc_quals, objc_qual, objc_typename, objc_try_catch_stmt, optellipsis): Add %type declarations. (objc_inherit_code, objc_public_flag): Remove. (typespec_nonreserved_nonattr): Call objc_get_protocol_qualified_type() instead of get_static_reference() and get_protocol_reference(). (stmt_nocomp): Call grokparm() on @catch parameter. (objcdef): Move semantic action to objc_finish_implementation(). (classdef): Move semantic action to objc_start_class_interface(), objc_continue_interface(), objc_finish_interface(), objc_start_class_implementation(), objc_continue_implementation(), objc_start_category_interface() and objc_start_category_implementation(). (protocoldef): Move semantic actions to objc_start_protocol() and objc_finish_interface(). (ivar_decl_list): Remove nonterminal. (visibility_spec): Move semantic actions to objc_set_visibility(). (ivar_decls): Remove assignment to $$. (ivar_decl): Rephrase in terms of component_decl; call objc_add_instance_variable(). (ivars, ivar_declarator): Remove nonterminals. (opt_semi): New nonterminal. (methodtype): Remove semantic actions. (methoddef): Move semantic actions to objc_set_method_type(), objc_start_method_definition() and objc_finish_method_definition(). (methodproto): Move semantic actions to objc_set_method_type() and objc_add_method_declaration(). (methoddecl): Use objc_typename instead of typename; move semantic actions to objc_build_method_signature(). (optarglist, myxdecls, mydecl, myparms, myparm): Remove nonterminals. (optparmlist): Express in terms of optparms and optellipsis. (optparms, optellipsis, objc_qual, objc_quals, objc_typename): New nonterminals. (keyworddecl): Use objc_typename instead of typename. (rid_to_yy): Mark RID_IN, RID_OUT, RID_INOUT, RID_BYCOPY, RID_BYREF and RID_ONEWAY as returning OBJC_TYPE_QUAL to yyparse(). [gcc/objc/ChangeLog] 2004-09-07 Ziemowit Laski <zlaski@apple.com> * Make-lang.in (objc/objc-parse.o): Depend on $(C_COMMON_H) instead of objc/objc-act.h. (objc/objc-act.o): Depend on $(HASHTAB_H). * objc-act.c: Include hashtab.h; in ObjC++ mode, include cp-tree.h and objcp-decl.h instead of c-tree.h. (build_module_descriptor, get_class_ivars, synth_id_with_class_suffix, error_with_ivar, gen_method_decl, gen_declaration, setup_string_decl, build_protocol_template): Adjust prototypes. (build_module_initializer_routine, start_class, continue_class, finish_class, start_method_def, objc_start_function, start_protocol, build_method_decl, objc_add_method, add_instance_variable, build_ivar_reference, is_ivar, is_private, get_super_receiver, build_selector_table_decl, objc_push_parm, objc_get_parm_info, gen_type_name, gen_type_name_0, start_var_decl, finish_var_decl, create_field_decl): New prototypes. (objc_expand_function_end, comp_method_with_proto, objc_expr_last, gen_declaration_1, gen_declarator, is_complex_decl, adorn_decl, define_decl, create_builtin_decl, gen_declspecs): Remove prototypes. (TYPE_ID): Rename to OBJECT_TYPEDEF_NAME. (CLASS_TYPEDEF_NAME): New. (TAG_EXECCLASS): Change from a global variable to a #define. (TAG_RETURN_STRUCT): Delete. (TAG_GNUINIT): New, holds '__objc_gnu_init' name. (objc_inherit_code, objc_public_flag): New, moved from c-parse.in. (string_descriptor): New struct. (string_htab): New hash table. (string_hash, string_eq): New prototypes. (generate_struct_by_value_array): Call create_field_decl() instead of create_builtin_decl(). (objc_init): Do not initialize objc_ellipsis_node or TAG_EXECCLASS; In ObjC++ mode, call cxx_init() instead of c_objc_common_init(). (objc_finish_file): In ObjC++, call instantiate_pending_templates() and cp_finish_file(). (define_decl, get_static_reference, get_protocol_reference, create_builtin_decl): Remove functions. (objc_start_class_interface, objc_start_category_interface, objc_start_protocol, objc_continue_interface, objc_finish_interface, objc_start_class_implementation, objc_start_category_implementation, objc_continue_implementation, objc_finish_implementation, objc_set_visibility, objc_set_method_type, objc_build_method_signature, objc_add_method_declaration, objc_start_method_definition, objc_add_instance_variable, objc_get_protocol_qualified_type, create_field_decl, start_var_decl, finish_var_decl): New functions. (setup_string_decl): Simplify since it is only called once. (synth_module_prologue): Call build_class_template(); predefine 'id' and 'Class' as typedefs; rename 'temp_type' to 'type'; disable debug hooks for duration of function; fix GNU runtime messenger signatures to correspond to reality; forward-declare '__objc_exec_class' for the GNU runtime; call build_selector_table_decl(); in ObjC++ mode, generate 'extern "C" { ... }' wrappers around synthesized declarations; call build_protocol_template() and build_category_template(). (string_hash, string_eq): New functions. (objc_build_string_object): Check metaclass correctness only once; store string literals in hash table. (objc_build_constructor): Do not convert initializer elements; adjust for ObjC++ impedance mismatch. (build_objc_symtab_template): Call create_field_decl() instead of create_builtin_decl(). (init_objc_symtab): Add missing conversion to initializer element. (build_metadata_decl): Call start_var_decl() instead of define_decl(). (generate_objc_symtab_decl): Do not call build_category_template(); call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(). (build_module_descriptor): Call create_field_decl() instead of grokfield(); call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(); always mark module descriptor as used; move GNU runtime-specific functionality to build_module_initializer_routine(). (build_module_initializer_routine): New function, broken off of build_module_descriptor(). (objc_static_init_needed_p, objc_generate_static_init_call): New functions. (generate_static_references, generate_strings, build_selector_translation_table, generate_descriptor_table, generate_ivars_list, generate_dispatch_table, generate_category): Call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(); build a type directly instead of via groktypename(). (build_selector_reference_decl, build_selector_table_decl, build_class_reference_decl, build_protocol_reference, generate_objc_image_info): Call start_var_decl() instead of build_decl(). (build_selector_reference): For GNU runtime, do not call build_selector_reference_decl(). (build_selector, build_typed_selector_reference): Always convert result to the selector type. (add_objc_string): Cast return value to 'char *'. (build_method_prototype_template, build_selector_template, build_method_template): Use actual selector type for fields pointing to selectors. (finish_objc): For GNU runtime, call build_module_initializer_routine() after build_module_descriptor(). (generate_protocol_list, generate_shared_structures): Call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(); build a type directly instead of via groktypename(). (synth_id_with_class_suffix): Return a string. (get_arg_type_list): For instance methods, use the instance type for 'self'; do not call groktypename_in_parm_context(). (build_objc_string_decl): Squash redeclaration errors in ObjC++. (objc_is_class_name): Use OBJC_TYPE_NAME instead of TYPE_NAME; handle RECORD_TYPEs in ObjC as well as ObjC++. (objc_is_id): New function. (objc_is_object_ptr): Return the canonical type node. (objc_get_class_ivars): Simplify using get_class_ivars(). (get_class_ivars): Remove second parameter; create a fresh copy of the ivar list for each call; do not check for existence of super class. (objc_eh_runtime_type): Mark #ifndef OBJCPLUS. (objc_init_exceptions): When using SJLJ-style exceptions, require the use of '-fobjc-exceptions' flag; do not require it for DWARF-style exceptions. (objc_build_exc_ptr, next_sjlj_build_try_catch_finally): Use objc_object_type instead of objc_id_type. (objc_begin_catch_clause): Convert the incoming PARM_DECL into a VAR_DECL before placing it in the appropriate scope; do not call define_decl(); adjust call to c_begin_compound_stmt(); use objc_object_type instead of objc_id_type. (build_next_objc_exception_stuff): Call create_field_decl() instead of create_builtin_decl(); construct type directly instead of calling groktypename(); use OBJC_VOID_AT_END to mark end of function parameters. (build_private_template): Adjust call to get_class_ivars(); build a type directly instead of via groktypename(). (build_protocol_template, build_method_prototype_list_template, build_method_prototype_template, build_category_template, build_selector_template, build_class_template, build_super_template, build_ivar_template, build_ivar_list_template, build_method_list_template, build_method_template): Call create_field_decl() instead of grokfield(). (objc_method_parm_type): Do not call groktypename(). (generate_descriptor_table): Call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(). (generate_method_descriptors, build_protocol_initializer, generate_dispatch_tables, build_category_initializer, build_shared_structure_initializer): Do not call groktypename(). (generate_protocols): Call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(); do not call groktypename(). (error_with_ivar): Remove last parameter. (check_ivars): Do not iterate ovar CLASS_RAW_IVARS lists in addition to CLASS_IVARS lists; adjust calls to error_with_ivar(). (generate_ivar_lists): Convert one of the initializer elements; do not call groktypename(). (get_arg_type_list, start_method_def, gen_method_def): Account for new representation of variable arguments and '...' in Objective-C methods; add Objective-C++ impedance matching code. (is_objc_type_qualifier): Remove function. (adjust_type_for_id_default): Simplify; there is no longer a need to wade through declspecs. (lookup_interface, start_class, continue_class, finish_class, start_method_def, start_protocol, build_method_decl, objc_add_method, add_instance_variable, build_ivar_reference, is_ivar, is_private, get_super_receiver, objc_build_finally_epilogue): Make into static functions. (receiver_is_class_object): Use new IS_CLASS() macro. (objc_build_message_expr): Tweak ObjC++ message argument handling; call objc_finish_message_expr() instead of finish_message_expr(). (finish_message_expr): Rename to objc_finish_message_expr(); use OBJC_TYPE_NAME and OBJC_SET_TYPE_NAME macros instead of TYPE_NAME. call gen_type_name() instead of gen_declaration(); call objc_is_id() instead of using IS_ID and IS_CLASS; Use objc_class_name instead of calling get_identifier("Class"); handle CONVERT_EXPRs in receiver. (build_objc_method_call, warn_with_method): Do not call groktypename(). (build_ivar_reference): Call convert() instead of clobbering in a type. (hash_init): Initialize string_htab hash table. (add_instance_variable): Simplify parameter list; do not call grokfield(); do not populate CLASS_IVARS list. (start_class): Check for the existence of super class, if one was specified. (continue_class): Use CLASS_RAW_IVARS rather than CLASS_IVARS; do not call build_class_template(); adjust call to get_class_ivars(); call build_decl(), pushdecl() and finish_decl() instead of define_decl(). (finish_class): Call build_decl(), pushdecl() and finish_decl() instead of define_decl(). (add_protocols): Use PROTOCOL_BINFO_ELTS for the tree vector size. (start_protocol): Do not call build_protocol_template(); use PROTOCOL_BINFO_ELTS for the tree vector size. (encode_type_qualifiers): Do not handle the 'const' qualifier here. (encode_pointer): Encode 'const char *' as 'r*', for backwards compatibility. (encode_array): Use HOST_WIDE_INT_PRINT_DEC instead of "%ld". (encode_type): Handle the 'const' qualifier here. (objc_parmlist): New global variable, sued by objc_push_parm and objc_get_parm_info(). (objc_push_parm, objc_get_parm_info): New functions. (objc_expr_last): Remove function. (synth_self_and_ucmd_args): For instance methods, use the instance type for 'self'; call objc_push_parm() instead of push_parm_decl(). (start_method_def): Do not call push_scope(), declare_parm_level(), pop_scope(), push_parm_decl(), store_parm_decls() or objc_expr_last(); just use objc_push_parm() and objc_get_parm_info(). (comp_method_with_proto): Remove function. (objc_types_are_equivalent): Strip away indirections before comparing underlying types. (comp_proto_with_proto): Do not call groktypename(); types are no longer in raw declspec format. (objc_start_function): New function. (really_start_method): Call comp_proto_with_proto() instead of comp_method_with_proto(); call objc_start_function() instead of hand-crafting a function declarator. (continue_method_def, objc_expand_function_end): Remove functions. (get_super_receiver): Call objc_get_current_scope() instead of get_current_scope(); reference 'super_class' field (instead of 'class'). (finish_method_def): Rename to objc_finish_method_definition() and add a function decl parameter; move method encoding call from objc_expand_function_end(). (is_complex_decl, adorn_decl, gen_declarator, gen_declspecs, gen_declaration_1): Remove functions. (tmpbuf, RAW_DECLSPEC): Remove. (gen_declaration): Remove second parameter; simplify to deal with TYPE_P nodes instead of raw declspecs. (gen_type_name, gen_type_name_0): New functions. (gen_method_decl): Remove second parameter; call gen_type_name() instead of gen_declaration_1(). (dump_interface): Adjust calls to gen_declaration() and gen_method_decl(); do not allocate a separate string buffer. (init_objc): Allocate a larger string buffer to accommodate dump_interface(); adjust call to build_module_descriptor(); add call to build_module_initializer_routine() for the GNU runtime. (generate_classref_translation_entry): Do not call start_decl(); call finish_var_decl() instead of finish_decl(); call convert() instead of build_c_cast(). * objc-act.h (CLASS_OWN_IVARS): Remove accessor. (CLASS_BINFO_ELTS): Reduce from 6 to 5, now that CLASS_OWN_IVARS is gone. (OCTI_GNU_INIT_DECL, GNU_INIT_decl): New. (OCTI_ELLIPSIS_NODE, objc_ellipsis_node): Remove. (OCTI_ID_ID, id_type, objc_id_id): Rename to OCTI_ID_NAME, objc_object_type and objc_object_name, respectively. (OCTI_CLS_REF, OCTI_CLASS_NAME, objc_class_reference, objc_class_name): New. (IS_CLASS): New macro. (IS_ID, IS_SUPER): Robustify. (OCTI_EXECCLASS_DECL, execclass_decl): New. (finish_file, start_class, continue_class, finish_class, start_method_def, continue_method_def, finish_method_def, start_protocol, finish_protocol, objc_build_throw_stmt, objc_build_try_catch_finally_stmt, objc_build_synchronized_prologue, objc_build_synchronized_epilogue, objc_build_try_prologue, objc_build_try_epilogue, objc_build_catch_stmt, objc_build_catch_epilogue, objc_build_finally_prologue, objc_build_finally_epilogue, is_ivar, is_private, is_public, add_instance_variable, objc_add_method, get_super_receiver, objc_clear_super_receiver, get_class_ivars_from_name, get_class_reference, get_static_reference, get_object_reference, build_message_expr, finish_message_expr, build_selector_expr, build_ivar_reference, build_keyword_decl, build_method_decl, build_protocol_expr, build_objc_string_object, objc_declare_alias, objc_declare_class, objc_declare_protocols, objc_comptypes, objc_check_decl, build_encode_expr): Remove prototypes. (imp_count, cat_count): Make GGC-aware. (OBJC_SET_TYPE_NAME): New macro. From-SVN: r87168
2004-09-08 02:49:44 +02:00
/* Create a declaration for field NAME of a given TYPE. */
static tree
Makefile.in (c-parse.o): Depend on $(C_COMMON_H). [gcc/ChangeLog] 2004-09-07 Ziemowit Laski <zlaski@apple.com> * Makefile.in (c-parse.o): Depend on $(C_COMMON_H). * c-parse.in: Include c-common.h instead of objc-act.h. (ivar_decl_list, ivar_decls, ivar_decl, ivars, ivar_declarator, myparms, myparm): Remove %type declarations. (methodtype, optparms, OBJC_TYPE_QUAL, objc_quals, objc_qual, objc_typename, objc_try_catch_stmt, optellipsis): Add %type declarations. (objc_inherit_code, objc_public_flag): Remove. (typespec_nonreserved_nonattr): Call objc_get_protocol_qualified_type() instead of get_static_reference() and get_protocol_reference(). (stmt_nocomp): Call grokparm() on @catch parameter. (objcdef): Move semantic action to objc_finish_implementation(). (classdef): Move semantic action to objc_start_class_interface(), objc_continue_interface(), objc_finish_interface(), objc_start_class_implementation(), objc_continue_implementation(), objc_start_category_interface() and objc_start_category_implementation(). (protocoldef): Move semantic actions to objc_start_protocol() and objc_finish_interface(). (ivar_decl_list): Remove nonterminal. (visibility_spec): Move semantic actions to objc_set_visibility(). (ivar_decls): Remove assignment to $$. (ivar_decl): Rephrase in terms of component_decl; call objc_add_instance_variable(). (ivars, ivar_declarator): Remove nonterminals. (opt_semi): New nonterminal. (methodtype): Remove semantic actions. (methoddef): Move semantic actions to objc_set_method_type(), objc_start_method_definition() and objc_finish_method_definition(). (methodproto): Move semantic actions to objc_set_method_type() and objc_add_method_declaration(). (methoddecl): Use objc_typename instead of typename; move semantic actions to objc_build_method_signature(). (optarglist, myxdecls, mydecl, myparms, myparm): Remove nonterminals. (optparmlist): Express in terms of optparms and optellipsis. (optparms, optellipsis, objc_qual, objc_quals, objc_typename): New nonterminals. (keyworddecl): Use objc_typename instead of typename. (rid_to_yy): Mark RID_IN, RID_OUT, RID_INOUT, RID_BYCOPY, RID_BYREF and RID_ONEWAY as returning OBJC_TYPE_QUAL to yyparse(). [gcc/objc/ChangeLog] 2004-09-07 Ziemowit Laski <zlaski@apple.com> * Make-lang.in (objc/objc-parse.o): Depend on $(C_COMMON_H) instead of objc/objc-act.h. (objc/objc-act.o): Depend on $(HASHTAB_H). * objc-act.c: Include hashtab.h; in ObjC++ mode, include cp-tree.h and objcp-decl.h instead of c-tree.h. (build_module_descriptor, get_class_ivars, synth_id_with_class_suffix, error_with_ivar, gen_method_decl, gen_declaration, setup_string_decl, build_protocol_template): Adjust prototypes. (build_module_initializer_routine, start_class, continue_class, finish_class, start_method_def, objc_start_function, start_protocol, build_method_decl, objc_add_method, add_instance_variable, build_ivar_reference, is_ivar, is_private, get_super_receiver, build_selector_table_decl, objc_push_parm, objc_get_parm_info, gen_type_name, gen_type_name_0, start_var_decl, finish_var_decl, create_field_decl): New prototypes. (objc_expand_function_end, comp_method_with_proto, objc_expr_last, gen_declaration_1, gen_declarator, is_complex_decl, adorn_decl, define_decl, create_builtin_decl, gen_declspecs): Remove prototypes. (TYPE_ID): Rename to OBJECT_TYPEDEF_NAME. (CLASS_TYPEDEF_NAME): New. (TAG_EXECCLASS): Change from a global variable to a #define. (TAG_RETURN_STRUCT): Delete. (TAG_GNUINIT): New, holds '__objc_gnu_init' name. (objc_inherit_code, objc_public_flag): New, moved from c-parse.in. (string_descriptor): New struct. (string_htab): New hash table. (string_hash, string_eq): New prototypes. (generate_struct_by_value_array): Call create_field_decl() instead of create_builtin_decl(). (objc_init): Do not initialize objc_ellipsis_node or TAG_EXECCLASS; In ObjC++ mode, call cxx_init() instead of c_objc_common_init(). (objc_finish_file): In ObjC++, call instantiate_pending_templates() and cp_finish_file(). (define_decl, get_static_reference, get_protocol_reference, create_builtin_decl): Remove functions. (objc_start_class_interface, objc_start_category_interface, objc_start_protocol, objc_continue_interface, objc_finish_interface, objc_start_class_implementation, objc_start_category_implementation, objc_continue_implementation, objc_finish_implementation, objc_set_visibility, objc_set_method_type, objc_build_method_signature, objc_add_method_declaration, objc_start_method_definition, objc_add_instance_variable, objc_get_protocol_qualified_type, create_field_decl, start_var_decl, finish_var_decl): New functions. (setup_string_decl): Simplify since it is only called once. (synth_module_prologue): Call build_class_template(); predefine 'id' and 'Class' as typedefs; rename 'temp_type' to 'type'; disable debug hooks for duration of function; fix GNU runtime messenger signatures to correspond to reality; forward-declare '__objc_exec_class' for the GNU runtime; call build_selector_table_decl(); in ObjC++ mode, generate 'extern "C" { ... }' wrappers around synthesized declarations; call build_protocol_template() and build_category_template(). (string_hash, string_eq): New functions. (objc_build_string_object): Check metaclass correctness only once; store string literals in hash table. (objc_build_constructor): Do not convert initializer elements; adjust for ObjC++ impedance mismatch. (build_objc_symtab_template): Call create_field_decl() instead of create_builtin_decl(). (init_objc_symtab): Add missing conversion to initializer element. (build_metadata_decl): Call start_var_decl() instead of define_decl(). (generate_objc_symtab_decl): Do not call build_category_template(); call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(). (build_module_descriptor): Call create_field_decl() instead of grokfield(); call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(); always mark module descriptor as used; move GNU runtime-specific functionality to build_module_initializer_routine(). (build_module_initializer_routine): New function, broken off of build_module_descriptor(). (objc_static_init_needed_p, objc_generate_static_init_call): New functions. (generate_static_references, generate_strings, build_selector_translation_table, generate_descriptor_table, generate_ivars_list, generate_dispatch_table, generate_category): Call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(); build a type directly instead of via groktypename(). (build_selector_reference_decl, build_selector_table_decl, build_class_reference_decl, build_protocol_reference, generate_objc_image_info): Call start_var_decl() instead of build_decl(). (build_selector_reference): For GNU runtime, do not call build_selector_reference_decl(). (build_selector, build_typed_selector_reference): Always convert result to the selector type. (add_objc_string): Cast return value to 'char *'. (build_method_prototype_template, build_selector_template, build_method_template): Use actual selector type for fields pointing to selectors. (finish_objc): For GNU runtime, call build_module_initializer_routine() after build_module_descriptor(). (generate_protocol_list, generate_shared_structures): Call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(); build a type directly instead of via groktypename(). (synth_id_with_class_suffix): Return a string. (get_arg_type_list): For instance methods, use the instance type for 'self'; do not call groktypename_in_parm_context(). (build_objc_string_decl): Squash redeclaration errors in ObjC++. (objc_is_class_name): Use OBJC_TYPE_NAME instead of TYPE_NAME; handle RECORD_TYPEs in ObjC as well as ObjC++. (objc_is_id): New function. (objc_is_object_ptr): Return the canonical type node. (objc_get_class_ivars): Simplify using get_class_ivars(). (get_class_ivars): Remove second parameter; create a fresh copy of the ivar list for each call; do not check for existence of super class. (objc_eh_runtime_type): Mark #ifndef OBJCPLUS. (objc_init_exceptions): When using SJLJ-style exceptions, require the use of '-fobjc-exceptions' flag; do not require it for DWARF-style exceptions. (objc_build_exc_ptr, next_sjlj_build_try_catch_finally): Use objc_object_type instead of objc_id_type. (objc_begin_catch_clause): Convert the incoming PARM_DECL into a VAR_DECL before placing it in the appropriate scope; do not call define_decl(); adjust call to c_begin_compound_stmt(); use objc_object_type instead of objc_id_type. (build_next_objc_exception_stuff): Call create_field_decl() instead of create_builtin_decl(); construct type directly instead of calling groktypename(); use OBJC_VOID_AT_END to mark end of function parameters. (build_private_template): Adjust call to get_class_ivars(); build a type directly instead of via groktypename(). (build_protocol_template, build_method_prototype_list_template, build_method_prototype_template, build_category_template, build_selector_template, build_class_template, build_super_template, build_ivar_template, build_ivar_list_template, build_method_list_template, build_method_template): Call create_field_decl() instead of grokfield(). (objc_method_parm_type): Do not call groktypename(). (generate_descriptor_table): Call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(). (generate_method_descriptors, build_protocol_initializer, generate_dispatch_tables, build_category_initializer, build_shared_structure_initializer): Do not call groktypename(). (generate_protocols): Call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(); do not call groktypename(). (error_with_ivar): Remove last parameter. (check_ivars): Do not iterate ovar CLASS_RAW_IVARS lists in addition to CLASS_IVARS lists; adjust calls to error_with_ivar(). (generate_ivar_lists): Convert one of the initializer elements; do not call groktypename(). (get_arg_type_list, start_method_def, gen_method_def): Account for new representation of variable arguments and '...' in Objective-C methods; add Objective-C++ impedance matching code. (is_objc_type_qualifier): Remove function. (adjust_type_for_id_default): Simplify; there is no longer a need to wade through declspecs. (lookup_interface, start_class, continue_class, finish_class, start_method_def, start_protocol, build_method_decl, objc_add_method, add_instance_variable, build_ivar_reference, is_ivar, is_private, get_super_receiver, objc_build_finally_epilogue): Make into static functions. (receiver_is_class_object): Use new IS_CLASS() macro. (objc_build_message_expr): Tweak ObjC++ message argument handling; call objc_finish_message_expr() instead of finish_message_expr(). (finish_message_expr): Rename to objc_finish_message_expr(); use OBJC_TYPE_NAME and OBJC_SET_TYPE_NAME macros instead of TYPE_NAME. call gen_type_name() instead of gen_declaration(); call objc_is_id() instead of using IS_ID and IS_CLASS; Use objc_class_name instead of calling get_identifier("Class"); handle CONVERT_EXPRs in receiver. (build_objc_method_call, warn_with_method): Do not call groktypename(). (build_ivar_reference): Call convert() instead of clobbering in a type. (hash_init): Initialize string_htab hash table. (add_instance_variable): Simplify parameter list; do not call grokfield(); do not populate CLASS_IVARS list. (start_class): Check for the existence of super class, if one was specified. (continue_class): Use CLASS_RAW_IVARS rather than CLASS_IVARS; do not call build_class_template(); adjust call to get_class_ivars(); call build_decl(), pushdecl() and finish_decl() instead of define_decl(). (finish_class): Call build_decl(), pushdecl() and finish_decl() instead of define_decl(). (add_protocols): Use PROTOCOL_BINFO_ELTS for the tree vector size. (start_protocol): Do not call build_protocol_template(); use PROTOCOL_BINFO_ELTS for the tree vector size. (encode_type_qualifiers): Do not handle the 'const' qualifier here. (encode_pointer): Encode 'const char *' as 'r*', for backwards compatibility. (encode_array): Use HOST_WIDE_INT_PRINT_DEC instead of "%ld". (encode_type): Handle the 'const' qualifier here. (objc_parmlist): New global variable, sued by objc_push_parm and objc_get_parm_info(). (objc_push_parm, objc_get_parm_info): New functions. (objc_expr_last): Remove function. (synth_self_and_ucmd_args): For instance methods, use the instance type for 'self'; call objc_push_parm() instead of push_parm_decl(). (start_method_def): Do not call push_scope(), declare_parm_level(), pop_scope(), push_parm_decl(), store_parm_decls() or objc_expr_last(); just use objc_push_parm() and objc_get_parm_info(). (comp_method_with_proto): Remove function. (objc_types_are_equivalent): Strip away indirections before comparing underlying types. (comp_proto_with_proto): Do not call groktypename(); types are no longer in raw declspec format. (objc_start_function): New function. (really_start_method): Call comp_proto_with_proto() instead of comp_method_with_proto(); call objc_start_function() instead of hand-crafting a function declarator. (continue_method_def, objc_expand_function_end): Remove functions. (get_super_receiver): Call objc_get_current_scope() instead of get_current_scope(); reference 'super_class' field (instead of 'class'). (finish_method_def): Rename to objc_finish_method_definition() and add a function decl parameter; move method encoding call from objc_expand_function_end(). (is_complex_decl, adorn_decl, gen_declarator, gen_declspecs, gen_declaration_1): Remove functions. (tmpbuf, RAW_DECLSPEC): Remove. (gen_declaration): Remove second parameter; simplify to deal with TYPE_P nodes instead of raw declspecs. (gen_type_name, gen_type_name_0): New functions. (gen_method_decl): Remove second parameter; call gen_type_name() instead of gen_declaration_1(). (dump_interface): Adjust calls to gen_declaration() and gen_method_decl(); do not allocate a separate string buffer. (init_objc): Allocate a larger string buffer to accommodate dump_interface(); adjust call to build_module_descriptor(); add call to build_module_initializer_routine() for the GNU runtime. (generate_classref_translation_entry): Do not call start_decl(); call finish_var_decl() instead of finish_decl(); call convert() instead of build_c_cast(). * objc-act.h (CLASS_OWN_IVARS): Remove accessor. (CLASS_BINFO_ELTS): Reduce from 6 to 5, now that CLASS_OWN_IVARS is gone. (OCTI_GNU_INIT_DECL, GNU_INIT_decl): New. (OCTI_ELLIPSIS_NODE, objc_ellipsis_node): Remove. (OCTI_ID_ID, id_type, objc_id_id): Rename to OCTI_ID_NAME, objc_object_type and objc_object_name, respectively. (OCTI_CLS_REF, OCTI_CLASS_NAME, objc_class_reference, objc_class_name): New. (IS_CLASS): New macro. (IS_ID, IS_SUPER): Robustify. (OCTI_EXECCLASS_DECL, execclass_decl): New. (finish_file, start_class, continue_class, finish_class, start_method_def, continue_method_def, finish_method_def, start_protocol, finish_protocol, objc_build_throw_stmt, objc_build_try_catch_finally_stmt, objc_build_synchronized_prologue, objc_build_synchronized_epilogue, objc_build_try_prologue, objc_build_try_epilogue, objc_build_catch_stmt, objc_build_catch_epilogue, objc_build_finally_prologue, objc_build_finally_epilogue, is_ivar, is_private, is_public, add_instance_variable, objc_add_method, get_super_receiver, objc_clear_super_receiver, get_class_ivars_from_name, get_class_reference, get_static_reference, get_object_reference, build_message_expr, finish_message_expr, build_selector_expr, build_ivar_reference, build_keyword_decl, build_method_decl, build_protocol_expr, build_objc_string_object, objc_declare_alias, objc_declare_class, objc_declare_protocols, objc_comptypes, objc_check_decl, build_encode_expr): Remove prototypes. (imp_count, cat_count): Make GGC-aware. (OBJC_SET_TYPE_NAME): New macro. From-SVN: r87168
2004-09-08 02:49:44 +02:00
create_field_decl (tree type, const char *name)
{
Makefile.in (c-parse.o): Depend on $(C_COMMON_H). [gcc/ChangeLog] 2004-09-07 Ziemowit Laski <zlaski@apple.com> * Makefile.in (c-parse.o): Depend on $(C_COMMON_H). * c-parse.in: Include c-common.h instead of objc-act.h. (ivar_decl_list, ivar_decls, ivar_decl, ivars, ivar_declarator, myparms, myparm): Remove %type declarations. (methodtype, optparms, OBJC_TYPE_QUAL, objc_quals, objc_qual, objc_typename, objc_try_catch_stmt, optellipsis): Add %type declarations. (objc_inherit_code, objc_public_flag): Remove. (typespec_nonreserved_nonattr): Call objc_get_protocol_qualified_type() instead of get_static_reference() and get_protocol_reference(). (stmt_nocomp): Call grokparm() on @catch parameter. (objcdef): Move semantic action to objc_finish_implementation(). (classdef): Move semantic action to objc_start_class_interface(), objc_continue_interface(), objc_finish_interface(), objc_start_class_implementation(), objc_continue_implementation(), objc_start_category_interface() and objc_start_category_implementation(). (protocoldef): Move semantic actions to objc_start_protocol() and objc_finish_interface(). (ivar_decl_list): Remove nonterminal. (visibility_spec): Move semantic actions to objc_set_visibility(). (ivar_decls): Remove assignment to $$. (ivar_decl): Rephrase in terms of component_decl; call objc_add_instance_variable(). (ivars, ivar_declarator): Remove nonterminals. (opt_semi): New nonterminal. (methodtype): Remove semantic actions. (methoddef): Move semantic actions to objc_set_method_type(), objc_start_method_definition() and objc_finish_method_definition(). (methodproto): Move semantic actions to objc_set_method_type() and objc_add_method_declaration(). (methoddecl): Use objc_typename instead of typename; move semantic actions to objc_build_method_signature(). (optarglist, myxdecls, mydecl, myparms, myparm): Remove nonterminals. (optparmlist): Express in terms of optparms and optellipsis. (optparms, optellipsis, objc_qual, objc_quals, objc_typename): New nonterminals. (keyworddecl): Use objc_typename instead of typename. (rid_to_yy): Mark RID_IN, RID_OUT, RID_INOUT, RID_BYCOPY, RID_BYREF and RID_ONEWAY as returning OBJC_TYPE_QUAL to yyparse(). [gcc/objc/ChangeLog] 2004-09-07 Ziemowit Laski <zlaski@apple.com> * Make-lang.in (objc/objc-parse.o): Depend on $(C_COMMON_H) instead of objc/objc-act.h. (objc/objc-act.o): Depend on $(HASHTAB_H). * objc-act.c: Include hashtab.h; in ObjC++ mode, include cp-tree.h and objcp-decl.h instead of c-tree.h. (build_module_descriptor, get_class_ivars, synth_id_with_class_suffix, error_with_ivar, gen_method_decl, gen_declaration, setup_string_decl, build_protocol_template): Adjust prototypes. (build_module_initializer_routine, start_class, continue_class, finish_class, start_method_def, objc_start_function, start_protocol, build_method_decl, objc_add_method, add_instance_variable, build_ivar_reference, is_ivar, is_private, get_super_receiver, build_selector_table_decl, objc_push_parm, objc_get_parm_info, gen_type_name, gen_type_name_0, start_var_decl, finish_var_decl, create_field_decl): New prototypes. (objc_expand_function_end, comp_method_with_proto, objc_expr_last, gen_declaration_1, gen_declarator, is_complex_decl, adorn_decl, define_decl, create_builtin_decl, gen_declspecs): Remove prototypes. (TYPE_ID): Rename to OBJECT_TYPEDEF_NAME. (CLASS_TYPEDEF_NAME): New. (TAG_EXECCLASS): Change from a global variable to a #define. (TAG_RETURN_STRUCT): Delete. (TAG_GNUINIT): New, holds '__objc_gnu_init' name. (objc_inherit_code, objc_public_flag): New, moved from c-parse.in. (string_descriptor): New struct. (string_htab): New hash table. (string_hash, string_eq): New prototypes. (generate_struct_by_value_array): Call create_field_decl() instead of create_builtin_decl(). (objc_init): Do not initialize objc_ellipsis_node or TAG_EXECCLASS; In ObjC++ mode, call cxx_init() instead of c_objc_common_init(). (objc_finish_file): In ObjC++, call instantiate_pending_templates() and cp_finish_file(). (define_decl, get_static_reference, get_protocol_reference, create_builtin_decl): Remove functions. (objc_start_class_interface, objc_start_category_interface, objc_start_protocol, objc_continue_interface, objc_finish_interface, objc_start_class_implementation, objc_start_category_implementation, objc_continue_implementation, objc_finish_implementation, objc_set_visibility, objc_set_method_type, objc_build_method_signature, objc_add_method_declaration, objc_start_method_definition, objc_add_instance_variable, objc_get_protocol_qualified_type, create_field_decl, start_var_decl, finish_var_decl): New functions. (setup_string_decl): Simplify since it is only called once. (synth_module_prologue): Call build_class_template(); predefine 'id' and 'Class' as typedefs; rename 'temp_type' to 'type'; disable debug hooks for duration of function; fix GNU runtime messenger signatures to correspond to reality; forward-declare '__objc_exec_class' for the GNU runtime; call build_selector_table_decl(); in ObjC++ mode, generate 'extern "C" { ... }' wrappers around synthesized declarations; call build_protocol_template() and build_category_template(). (string_hash, string_eq): New functions. (objc_build_string_object): Check metaclass correctness only once; store string literals in hash table. (objc_build_constructor): Do not convert initializer elements; adjust for ObjC++ impedance mismatch. (build_objc_symtab_template): Call create_field_decl() instead of create_builtin_decl(). (init_objc_symtab): Add missing conversion to initializer element. (build_metadata_decl): Call start_var_decl() instead of define_decl(). (generate_objc_symtab_decl): Do not call build_category_template(); call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(). (build_module_descriptor): Call create_field_decl() instead of grokfield(); call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(); always mark module descriptor as used; move GNU runtime-specific functionality to build_module_initializer_routine(). (build_module_initializer_routine): New function, broken off of build_module_descriptor(). (objc_static_init_needed_p, objc_generate_static_init_call): New functions. (generate_static_references, generate_strings, build_selector_translation_table, generate_descriptor_table, generate_ivars_list, generate_dispatch_table, generate_category): Call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(); build a type directly instead of via groktypename(). (build_selector_reference_decl, build_selector_table_decl, build_class_reference_decl, build_protocol_reference, generate_objc_image_info): Call start_var_decl() instead of build_decl(). (build_selector_reference): For GNU runtime, do not call build_selector_reference_decl(). (build_selector, build_typed_selector_reference): Always convert result to the selector type. (add_objc_string): Cast return value to 'char *'. (build_method_prototype_template, build_selector_template, build_method_template): Use actual selector type for fields pointing to selectors. (finish_objc): For GNU runtime, call build_module_initializer_routine() after build_module_descriptor(). (generate_protocol_list, generate_shared_structures): Call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(); build a type directly instead of via groktypename(). (synth_id_with_class_suffix): Return a string. (get_arg_type_list): For instance methods, use the instance type for 'self'; do not call groktypename_in_parm_context(). (build_objc_string_decl): Squash redeclaration errors in ObjC++. (objc_is_class_name): Use OBJC_TYPE_NAME instead of TYPE_NAME; handle RECORD_TYPEs in ObjC as well as ObjC++. (objc_is_id): New function. (objc_is_object_ptr): Return the canonical type node. (objc_get_class_ivars): Simplify using get_class_ivars(). (get_class_ivars): Remove second parameter; create a fresh copy of the ivar list for each call; do not check for existence of super class. (objc_eh_runtime_type): Mark #ifndef OBJCPLUS. (objc_init_exceptions): When using SJLJ-style exceptions, require the use of '-fobjc-exceptions' flag; do not require it for DWARF-style exceptions. (objc_build_exc_ptr, next_sjlj_build_try_catch_finally): Use objc_object_type instead of objc_id_type. (objc_begin_catch_clause): Convert the incoming PARM_DECL into a VAR_DECL before placing it in the appropriate scope; do not call define_decl(); adjust call to c_begin_compound_stmt(); use objc_object_type instead of objc_id_type. (build_next_objc_exception_stuff): Call create_field_decl() instead of create_builtin_decl(); construct type directly instead of calling groktypename(); use OBJC_VOID_AT_END to mark end of function parameters. (build_private_template): Adjust call to get_class_ivars(); build a type directly instead of via groktypename(). (build_protocol_template, build_method_prototype_list_template, build_method_prototype_template, build_category_template, build_selector_template, build_class_template, build_super_template, build_ivar_template, build_ivar_list_template, build_method_list_template, build_method_template): Call create_field_decl() instead of grokfield(). (objc_method_parm_type): Do not call groktypename(). (generate_descriptor_table): Call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(). (generate_method_descriptors, build_protocol_initializer, generate_dispatch_tables, build_category_initializer, build_shared_structure_initializer): Do not call groktypename(). (generate_protocols): Call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(); do not call groktypename(). (error_with_ivar): Remove last parameter. (check_ivars): Do not iterate ovar CLASS_RAW_IVARS lists in addition to CLASS_IVARS lists; adjust calls to error_with_ivar(). (generate_ivar_lists): Convert one of the initializer elements; do not call groktypename(). (get_arg_type_list, start_method_def, gen_method_def): Account for new representation of variable arguments and '...' in Objective-C methods; add Objective-C++ impedance matching code. (is_objc_type_qualifier): Remove function. (adjust_type_for_id_default): Simplify; there is no longer a need to wade through declspecs. (lookup_interface, start_class, continue_class, finish_class, start_method_def, start_protocol, build_method_decl, objc_add_method, add_instance_variable, build_ivar_reference, is_ivar, is_private, get_super_receiver, objc_build_finally_epilogue): Make into static functions. (receiver_is_class_object): Use new IS_CLASS() macro. (objc_build_message_expr): Tweak ObjC++ message argument handling; call objc_finish_message_expr() instead of finish_message_expr(). (finish_message_expr): Rename to objc_finish_message_expr(); use OBJC_TYPE_NAME and OBJC_SET_TYPE_NAME macros instead of TYPE_NAME. call gen_type_name() instead of gen_declaration(); call objc_is_id() instead of using IS_ID and IS_CLASS; Use objc_class_name instead of calling get_identifier("Class"); handle CONVERT_EXPRs in receiver. (build_objc_method_call, warn_with_method): Do not call groktypename(). (build_ivar_reference): Call convert() instead of clobbering in a type. (hash_init): Initialize string_htab hash table. (add_instance_variable): Simplify parameter list; do not call grokfield(); do not populate CLASS_IVARS list. (start_class): Check for the existence of super class, if one was specified. (continue_class): Use CLASS_RAW_IVARS rather than CLASS_IVARS; do not call build_class_template(); adjust call to get_class_ivars(); call build_decl(), pushdecl() and finish_decl() instead of define_decl(). (finish_class): Call build_decl(), pushdecl() and finish_decl() instead of define_decl(). (add_protocols): Use PROTOCOL_BINFO_ELTS for the tree vector size. (start_protocol): Do not call build_protocol_template(); use PROTOCOL_BINFO_ELTS for the tree vector size. (encode_type_qualifiers): Do not handle the 'const' qualifier here. (encode_pointer): Encode 'const char *' as 'r*', for backwards compatibility. (encode_array): Use HOST_WIDE_INT_PRINT_DEC instead of "%ld". (encode_type): Handle the 'const' qualifier here. (objc_parmlist): New global variable, sued by objc_push_parm and objc_get_parm_info(). (objc_push_parm, objc_get_parm_info): New functions. (objc_expr_last): Remove function. (synth_self_and_ucmd_args): For instance methods, use the instance type for 'self'; call objc_push_parm() instead of push_parm_decl(). (start_method_def): Do not call push_scope(), declare_parm_level(), pop_scope(), push_parm_decl(), store_parm_decls() or objc_expr_last(); just use objc_push_parm() and objc_get_parm_info(). (comp_method_with_proto): Remove function. (objc_types_are_equivalent): Strip away indirections before comparing underlying types. (comp_proto_with_proto): Do not call groktypename(); types are no longer in raw declspec format. (objc_start_function): New function. (really_start_method): Call comp_proto_with_proto() instead of comp_method_with_proto(); call objc_start_function() instead of hand-crafting a function declarator. (continue_method_def, objc_expand_function_end): Remove functions. (get_super_receiver): Call objc_get_current_scope() instead of get_current_scope(); reference 'super_class' field (instead of 'class'). (finish_method_def): Rename to objc_finish_method_definition() and add a function decl parameter; move method encoding call from objc_expand_function_end(). (is_complex_decl, adorn_decl, gen_declarator, gen_declspecs, gen_declaration_1): Remove functions. (tmpbuf, RAW_DECLSPEC): Remove. (gen_declaration): Remove second parameter; simplify to deal with TYPE_P nodes instead of raw declspecs. (gen_type_name, gen_type_name_0): New functions. (gen_method_decl): Remove second parameter; call gen_type_name() instead of gen_declaration_1(). (dump_interface): Adjust calls to gen_declaration() and gen_method_decl(); do not allocate a separate string buffer. (init_objc): Allocate a larger string buffer to accommodate dump_interface(); adjust call to build_module_descriptor(); add call to build_module_initializer_routine() for the GNU runtime. (generate_classref_translation_entry): Do not call start_decl(); call finish_var_decl() instead of finish_decl(); call convert() instead of build_c_cast(). * objc-act.h (CLASS_OWN_IVARS): Remove accessor. (CLASS_BINFO_ELTS): Reduce from 6 to 5, now that CLASS_OWN_IVARS is gone. (OCTI_GNU_INIT_DECL, GNU_INIT_decl): New. (OCTI_ELLIPSIS_NODE, objc_ellipsis_node): Remove. (OCTI_ID_ID, id_type, objc_id_id): Rename to OCTI_ID_NAME, objc_object_type and objc_object_name, respectively. (OCTI_CLS_REF, OCTI_CLASS_NAME, objc_class_reference, objc_class_name): New. (IS_CLASS): New macro. (IS_ID, IS_SUPER): Robustify. (OCTI_EXECCLASS_DECL, execclass_decl): New. (finish_file, start_class, continue_class, finish_class, start_method_def, continue_method_def, finish_method_def, start_protocol, finish_protocol, objc_build_throw_stmt, objc_build_try_catch_finally_stmt, objc_build_synchronized_prologue, objc_build_synchronized_epilogue, objc_build_try_prologue, objc_build_try_epilogue, objc_build_catch_stmt, objc_build_catch_epilogue, objc_build_finally_prologue, objc_build_finally_epilogue, is_ivar, is_private, is_public, add_instance_variable, objc_add_method, get_super_receiver, objc_clear_super_receiver, get_class_ivars_from_name, get_class_reference, get_static_reference, get_object_reference, build_message_expr, finish_message_expr, build_selector_expr, build_ivar_reference, build_keyword_decl, build_method_decl, build_protocol_expr, build_objc_string_object, objc_declare_alias, objc_declare_class, objc_declare_protocols, objc_comptypes, objc_check_decl, build_encode_expr): Remove prototypes. (imp_count, cat_count): Make GGC-aware. (OBJC_SET_TYPE_NAME): New macro. From-SVN: r87168
2004-09-08 02:49:44 +02:00
return build_decl (FIELD_DECL, get_identifier (name), type);
}
Makefile.in (c-parse.o): Depend on $(C_COMMON_H). [gcc/ChangeLog] 2004-09-07 Ziemowit Laski <zlaski@apple.com> * Makefile.in (c-parse.o): Depend on $(C_COMMON_H). * c-parse.in: Include c-common.h instead of objc-act.h. (ivar_decl_list, ivar_decls, ivar_decl, ivars, ivar_declarator, myparms, myparm): Remove %type declarations. (methodtype, optparms, OBJC_TYPE_QUAL, objc_quals, objc_qual, objc_typename, objc_try_catch_stmt, optellipsis): Add %type declarations. (objc_inherit_code, objc_public_flag): Remove. (typespec_nonreserved_nonattr): Call objc_get_protocol_qualified_type() instead of get_static_reference() and get_protocol_reference(). (stmt_nocomp): Call grokparm() on @catch parameter. (objcdef): Move semantic action to objc_finish_implementation(). (classdef): Move semantic action to objc_start_class_interface(), objc_continue_interface(), objc_finish_interface(), objc_start_class_implementation(), objc_continue_implementation(), objc_start_category_interface() and objc_start_category_implementation(). (protocoldef): Move semantic actions to objc_start_protocol() and objc_finish_interface(). (ivar_decl_list): Remove nonterminal. (visibility_spec): Move semantic actions to objc_set_visibility(). (ivar_decls): Remove assignment to $$. (ivar_decl): Rephrase in terms of component_decl; call objc_add_instance_variable(). (ivars, ivar_declarator): Remove nonterminals. (opt_semi): New nonterminal. (methodtype): Remove semantic actions. (methoddef): Move semantic actions to objc_set_method_type(), objc_start_method_definition() and objc_finish_method_definition(). (methodproto): Move semantic actions to objc_set_method_type() and objc_add_method_declaration(). (methoddecl): Use objc_typename instead of typename; move semantic actions to objc_build_method_signature(). (optarglist, myxdecls, mydecl, myparms, myparm): Remove nonterminals. (optparmlist): Express in terms of optparms and optellipsis. (optparms, optellipsis, objc_qual, objc_quals, objc_typename): New nonterminals. (keyworddecl): Use objc_typename instead of typename. (rid_to_yy): Mark RID_IN, RID_OUT, RID_INOUT, RID_BYCOPY, RID_BYREF and RID_ONEWAY as returning OBJC_TYPE_QUAL to yyparse(). [gcc/objc/ChangeLog] 2004-09-07 Ziemowit Laski <zlaski@apple.com> * Make-lang.in (objc/objc-parse.o): Depend on $(C_COMMON_H) instead of objc/objc-act.h. (objc/objc-act.o): Depend on $(HASHTAB_H). * objc-act.c: Include hashtab.h; in ObjC++ mode, include cp-tree.h and objcp-decl.h instead of c-tree.h. (build_module_descriptor, get_class_ivars, synth_id_with_class_suffix, error_with_ivar, gen_method_decl, gen_declaration, setup_string_decl, build_protocol_template): Adjust prototypes. (build_module_initializer_routine, start_class, continue_class, finish_class, start_method_def, objc_start_function, start_protocol, build_method_decl, objc_add_method, add_instance_variable, build_ivar_reference, is_ivar, is_private, get_super_receiver, build_selector_table_decl, objc_push_parm, objc_get_parm_info, gen_type_name, gen_type_name_0, start_var_decl, finish_var_decl, create_field_decl): New prototypes. (objc_expand_function_end, comp_method_with_proto, objc_expr_last, gen_declaration_1, gen_declarator, is_complex_decl, adorn_decl, define_decl, create_builtin_decl, gen_declspecs): Remove prototypes. (TYPE_ID): Rename to OBJECT_TYPEDEF_NAME. (CLASS_TYPEDEF_NAME): New. (TAG_EXECCLASS): Change from a global variable to a #define. (TAG_RETURN_STRUCT): Delete. (TAG_GNUINIT): New, holds '__objc_gnu_init' name. (objc_inherit_code, objc_public_flag): New, moved from c-parse.in. (string_descriptor): New struct. (string_htab): New hash table. (string_hash, string_eq): New prototypes. (generate_struct_by_value_array): Call create_field_decl() instead of create_builtin_decl(). (objc_init): Do not initialize objc_ellipsis_node or TAG_EXECCLASS; In ObjC++ mode, call cxx_init() instead of c_objc_common_init(). (objc_finish_file): In ObjC++, call instantiate_pending_templates() and cp_finish_file(). (define_decl, get_static_reference, get_protocol_reference, create_builtin_decl): Remove functions. (objc_start_class_interface, objc_start_category_interface, objc_start_protocol, objc_continue_interface, objc_finish_interface, objc_start_class_implementation, objc_start_category_implementation, objc_continue_implementation, objc_finish_implementation, objc_set_visibility, objc_set_method_type, objc_build_method_signature, objc_add_method_declaration, objc_start_method_definition, objc_add_instance_variable, objc_get_protocol_qualified_type, create_field_decl, start_var_decl, finish_var_decl): New functions. (setup_string_decl): Simplify since it is only called once. (synth_module_prologue): Call build_class_template(); predefine 'id' and 'Class' as typedefs; rename 'temp_type' to 'type'; disable debug hooks for duration of function; fix GNU runtime messenger signatures to correspond to reality; forward-declare '__objc_exec_class' for the GNU runtime; call build_selector_table_decl(); in ObjC++ mode, generate 'extern "C" { ... }' wrappers around synthesized declarations; call build_protocol_template() and build_category_template(). (string_hash, string_eq): New functions. (objc_build_string_object): Check metaclass correctness only once; store string literals in hash table. (objc_build_constructor): Do not convert initializer elements; adjust for ObjC++ impedance mismatch. (build_objc_symtab_template): Call create_field_decl() instead of create_builtin_decl(). (init_objc_symtab): Add missing conversion to initializer element. (build_metadata_decl): Call start_var_decl() instead of define_decl(). (generate_objc_symtab_decl): Do not call build_category_template(); call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(). (build_module_descriptor): Call create_field_decl() instead of grokfield(); call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(); always mark module descriptor as used; move GNU runtime-specific functionality to build_module_initializer_routine(). (build_module_initializer_routine): New function, broken off of build_module_descriptor(). (objc_static_init_needed_p, objc_generate_static_init_call): New functions. (generate_static_references, generate_strings, build_selector_translation_table, generate_descriptor_table, generate_ivars_list, generate_dispatch_table, generate_category): Call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(); build a type directly instead of via groktypename(). (build_selector_reference_decl, build_selector_table_decl, build_class_reference_decl, build_protocol_reference, generate_objc_image_info): Call start_var_decl() instead of build_decl(). (build_selector_reference): For GNU runtime, do not call build_selector_reference_decl(). (build_selector, build_typed_selector_reference): Always convert result to the selector type. (add_objc_string): Cast return value to 'char *'. (build_method_prototype_template, build_selector_template, build_method_template): Use actual selector type for fields pointing to selectors. (finish_objc): For GNU runtime, call build_module_initializer_routine() after build_module_descriptor(). (generate_protocol_list, generate_shared_structures): Call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(); build a type directly instead of via groktypename(). (synth_id_with_class_suffix): Return a string. (get_arg_type_list): For instance methods, use the instance type for 'self'; do not call groktypename_in_parm_context(). (build_objc_string_decl): Squash redeclaration errors in ObjC++. (objc_is_class_name): Use OBJC_TYPE_NAME instead of TYPE_NAME; handle RECORD_TYPEs in ObjC as well as ObjC++. (objc_is_id): New function. (objc_is_object_ptr): Return the canonical type node. (objc_get_class_ivars): Simplify using get_class_ivars(). (get_class_ivars): Remove second parameter; create a fresh copy of the ivar list for each call; do not check for existence of super class. (objc_eh_runtime_type): Mark #ifndef OBJCPLUS. (objc_init_exceptions): When using SJLJ-style exceptions, require the use of '-fobjc-exceptions' flag; do not require it for DWARF-style exceptions. (objc_build_exc_ptr, next_sjlj_build_try_catch_finally): Use objc_object_type instead of objc_id_type. (objc_begin_catch_clause): Convert the incoming PARM_DECL into a VAR_DECL before placing it in the appropriate scope; do not call define_decl(); adjust call to c_begin_compound_stmt(); use objc_object_type instead of objc_id_type. (build_next_objc_exception_stuff): Call create_field_decl() instead of create_builtin_decl(); construct type directly instead of calling groktypename(); use OBJC_VOID_AT_END to mark end of function parameters. (build_private_template): Adjust call to get_class_ivars(); build a type directly instead of via groktypename(). (build_protocol_template, build_method_prototype_list_template, build_method_prototype_template, build_category_template, build_selector_template, build_class_template, build_super_template, build_ivar_template, build_ivar_list_template, build_method_list_template, build_method_template): Call create_field_decl() instead of grokfield(). (objc_method_parm_type): Do not call groktypename(). (generate_descriptor_table): Call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(). (generate_method_descriptors, build_protocol_initializer, generate_dispatch_tables, build_category_initializer, build_shared_structure_initializer): Do not call groktypename(). (generate_protocols): Call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(); do not call groktypename(). (error_with_ivar): Remove last parameter. (check_ivars): Do not iterate ovar CLASS_RAW_IVARS lists in addition to CLASS_IVARS lists; adjust calls to error_with_ivar(). (generate_ivar_lists): Convert one of the initializer elements; do not call groktypename(). (get_arg_type_list, start_method_def, gen_method_def): Account for new representation of variable arguments and '...' in Objective-C methods; add Objective-C++ impedance matching code. (is_objc_type_qualifier): Remove function. (adjust_type_for_id_default): Simplify; there is no longer a need to wade through declspecs. (lookup_interface, start_class, continue_class, finish_class, start_method_def, start_protocol, build_method_decl, objc_add_method, add_instance_variable, build_ivar_reference, is_ivar, is_private, get_super_receiver, objc_build_finally_epilogue): Make into static functions. (receiver_is_class_object): Use new IS_CLASS() macro. (objc_build_message_expr): Tweak ObjC++ message argument handling; call objc_finish_message_expr() instead of finish_message_expr(). (finish_message_expr): Rename to objc_finish_message_expr(); use OBJC_TYPE_NAME and OBJC_SET_TYPE_NAME macros instead of TYPE_NAME. call gen_type_name() instead of gen_declaration(); call objc_is_id() instead of using IS_ID and IS_CLASS; Use objc_class_name instead of calling get_identifier("Class"); handle CONVERT_EXPRs in receiver. (build_objc_method_call, warn_with_method): Do not call groktypename(). (build_ivar_reference): Call convert() instead of clobbering in a type. (hash_init): Initialize string_htab hash table. (add_instance_variable): Simplify parameter list; do not call grokfield(); do not populate CLASS_IVARS list. (start_class): Check for the existence of super class, if one was specified. (continue_class): Use CLASS_RAW_IVARS rather than CLASS_IVARS; do not call build_class_template(); adjust call to get_class_ivars(); call build_decl(), pushdecl() and finish_decl() instead of define_decl(). (finish_class): Call build_decl(), pushdecl() and finish_decl() instead of define_decl(). (add_protocols): Use PROTOCOL_BINFO_ELTS for the tree vector size. (start_protocol): Do not call build_protocol_template(); use PROTOCOL_BINFO_ELTS for the tree vector size. (encode_type_qualifiers): Do not handle the 'const' qualifier here. (encode_pointer): Encode 'const char *' as 'r*', for backwards compatibility. (encode_array): Use HOST_WIDE_INT_PRINT_DEC instead of "%ld". (encode_type): Handle the 'const' qualifier here. (objc_parmlist): New global variable, sued by objc_push_parm and objc_get_parm_info(). (objc_push_parm, objc_get_parm_info): New functions. (objc_expr_last): Remove function. (synth_self_and_ucmd_args): For instance methods, use the instance type for 'self'; call objc_push_parm() instead of push_parm_decl(). (start_method_def): Do not call push_scope(), declare_parm_level(), pop_scope(), push_parm_decl(), store_parm_decls() or objc_expr_last(); just use objc_push_parm() and objc_get_parm_info(). (comp_method_with_proto): Remove function. (objc_types_are_equivalent): Strip away indirections before comparing underlying types. (comp_proto_with_proto): Do not call groktypename(); types are no longer in raw declspec format. (objc_start_function): New function. (really_start_method): Call comp_proto_with_proto() instead of comp_method_with_proto(); call objc_start_function() instead of hand-crafting a function declarator. (continue_method_def, objc_expand_function_end): Remove functions. (get_super_receiver): Call objc_get_current_scope() instead of get_current_scope(); reference 'super_class' field (instead of 'class'). (finish_method_def): Rename to objc_finish_method_definition() and add a function decl parameter; move method encoding call from objc_expand_function_end(). (is_complex_decl, adorn_decl, gen_declarator, gen_declspecs, gen_declaration_1): Remove functions. (tmpbuf, RAW_DECLSPEC): Remove. (gen_declaration): Remove second parameter; simplify to deal with TYPE_P nodes instead of raw declspecs. (gen_type_name, gen_type_name_0): New functions. (gen_method_decl): Remove second parameter; call gen_type_name() instead of gen_declaration_1(). (dump_interface): Adjust calls to gen_declaration() and gen_method_decl(); do not allocate a separate string buffer. (init_objc): Allocate a larger string buffer to accommodate dump_interface(); adjust call to build_module_descriptor(); add call to build_module_initializer_routine() for the GNU runtime. (generate_classref_translation_entry): Do not call start_decl(); call finish_var_decl() instead of finish_decl(); call convert() instead of build_c_cast(). * objc-act.h (CLASS_OWN_IVARS): Remove accessor. (CLASS_BINFO_ELTS): Reduce from 6 to 5, now that CLASS_OWN_IVARS is gone. (OCTI_GNU_INIT_DECL, GNU_INIT_decl): New. (OCTI_ELLIPSIS_NODE, objc_ellipsis_node): Remove. (OCTI_ID_ID, id_type, objc_id_id): Rename to OCTI_ID_NAME, objc_object_type and objc_object_name, respectively. (OCTI_CLS_REF, OCTI_CLASS_NAME, objc_class_reference, objc_class_name): New. (IS_CLASS): New macro. (IS_ID, IS_SUPER): Robustify. (OCTI_EXECCLASS_DECL, execclass_decl): New. (finish_file, start_class, continue_class, finish_class, start_method_def, continue_method_def, finish_method_def, start_protocol, finish_protocol, objc_build_throw_stmt, objc_build_try_catch_finally_stmt, objc_build_synchronized_prologue, objc_build_synchronized_epilogue, objc_build_try_prologue, objc_build_try_epilogue, objc_build_catch_stmt, objc_build_catch_epilogue, objc_build_finally_prologue, objc_build_finally_epilogue, is_ivar, is_private, is_public, add_instance_variable, objc_add_method, get_super_receiver, objc_clear_super_receiver, get_class_ivars_from_name, get_class_reference, get_static_reference, get_object_reference, build_message_expr, finish_message_expr, build_selector_expr, build_ivar_reference, build_keyword_decl, build_method_decl, build_protocol_expr, build_objc_string_object, objc_declare_alias, objc_declare_class, objc_declare_protocols, objc_comptypes, objc_check_decl, build_encode_expr): Remove prototypes. (imp_count, cat_count): Make GGC-aware. (OBJC_SET_TYPE_NAME): New macro. From-SVN: r87168
2004-09-08 02:49:44 +02:00
/* Create a global, static declaration for variable NAME of a given TYPE. The
finish_var_decl() routine will need to be called on it afterwards. */
Makefile.in (c-parse.o): Depend on $(C_COMMON_H). [gcc/ChangeLog] 2004-09-07 Ziemowit Laski <zlaski@apple.com> * Makefile.in (c-parse.o): Depend on $(C_COMMON_H). * c-parse.in: Include c-common.h instead of objc-act.h. (ivar_decl_list, ivar_decls, ivar_decl, ivars, ivar_declarator, myparms, myparm): Remove %type declarations. (methodtype, optparms, OBJC_TYPE_QUAL, objc_quals, objc_qual, objc_typename, objc_try_catch_stmt, optellipsis): Add %type declarations. (objc_inherit_code, objc_public_flag): Remove. (typespec_nonreserved_nonattr): Call objc_get_protocol_qualified_type() instead of get_static_reference() and get_protocol_reference(). (stmt_nocomp): Call grokparm() on @catch parameter. (objcdef): Move semantic action to objc_finish_implementation(). (classdef): Move semantic action to objc_start_class_interface(), objc_continue_interface(), objc_finish_interface(), objc_start_class_implementation(), objc_continue_implementation(), objc_start_category_interface() and objc_start_category_implementation(). (protocoldef): Move semantic actions to objc_start_protocol() and objc_finish_interface(). (ivar_decl_list): Remove nonterminal. (visibility_spec): Move semantic actions to objc_set_visibility(). (ivar_decls): Remove assignment to $$. (ivar_decl): Rephrase in terms of component_decl; call objc_add_instance_variable(). (ivars, ivar_declarator): Remove nonterminals. (opt_semi): New nonterminal. (methodtype): Remove semantic actions. (methoddef): Move semantic actions to objc_set_method_type(), objc_start_method_definition() and objc_finish_method_definition(). (methodproto): Move semantic actions to objc_set_method_type() and objc_add_method_declaration(). (methoddecl): Use objc_typename instead of typename; move semantic actions to objc_build_method_signature(). (optarglist, myxdecls, mydecl, myparms, myparm): Remove nonterminals. (optparmlist): Express in terms of optparms and optellipsis. (optparms, optellipsis, objc_qual, objc_quals, objc_typename): New nonterminals. (keyworddecl): Use objc_typename instead of typename. (rid_to_yy): Mark RID_IN, RID_OUT, RID_INOUT, RID_BYCOPY, RID_BYREF and RID_ONEWAY as returning OBJC_TYPE_QUAL to yyparse(). [gcc/objc/ChangeLog] 2004-09-07 Ziemowit Laski <zlaski@apple.com> * Make-lang.in (objc/objc-parse.o): Depend on $(C_COMMON_H) instead of objc/objc-act.h. (objc/objc-act.o): Depend on $(HASHTAB_H). * objc-act.c: Include hashtab.h; in ObjC++ mode, include cp-tree.h and objcp-decl.h instead of c-tree.h. (build_module_descriptor, get_class_ivars, synth_id_with_class_suffix, error_with_ivar, gen_method_decl, gen_declaration, setup_string_decl, build_protocol_template): Adjust prototypes. (build_module_initializer_routine, start_class, continue_class, finish_class, start_method_def, objc_start_function, start_protocol, build_method_decl, objc_add_method, add_instance_variable, build_ivar_reference, is_ivar, is_private, get_super_receiver, build_selector_table_decl, objc_push_parm, objc_get_parm_info, gen_type_name, gen_type_name_0, start_var_decl, finish_var_decl, create_field_decl): New prototypes. (objc_expand_function_end, comp_method_with_proto, objc_expr_last, gen_declaration_1, gen_declarator, is_complex_decl, adorn_decl, define_decl, create_builtin_decl, gen_declspecs): Remove prototypes. (TYPE_ID): Rename to OBJECT_TYPEDEF_NAME. (CLASS_TYPEDEF_NAME): New. (TAG_EXECCLASS): Change from a global variable to a #define. (TAG_RETURN_STRUCT): Delete. (TAG_GNUINIT): New, holds '__objc_gnu_init' name. (objc_inherit_code, objc_public_flag): New, moved from c-parse.in. (string_descriptor): New struct. (string_htab): New hash table. (string_hash, string_eq): New prototypes. (generate_struct_by_value_array): Call create_field_decl() instead of create_builtin_decl(). (objc_init): Do not initialize objc_ellipsis_node or TAG_EXECCLASS; In ObjC++ mode, call cxx_init() instead of c_objc_common_init(). (objc_finish_file): In ObjC++, call instantiate_pending_templates() and cp_finish_file(). (define_decl, get_static_reference, get_protocol_reference, create_builtin_decl): Remove functions. (objc_start_class_interface, objc_start_category_interface, objc_start_protocol, objc_continue_interface, objc_finish_interface, objc_start_class_implementation, objc_start_category_implementation, objc_continue_implementation, objc_finish_implementation, objc_set_visibility, objc_set_method_type, objc_build_method_signature, objc_add_method_declaration, objc_start_method_definition, objc_add_instance_variable, objc_get_protocol_qualified_type, create_field_decl, start_var_decl, finish_var_decl): New functions. (setup_string_decl): Simplify since it is only called once. (synth_module_prologue): Call build_class_template(); predefine 'id' and 'Class' as typedefs; rename 'temp_type' to 'type'; disable debug hooks for duration of function; fix GNU runtime messenger signatures to correspond to reality; forward-declare '__objc_exec_class' for the GNU runtime; call build_selector_table_decl(); in ObjC++ mode, generate 'extern "C" { ... }' wrappers around synthesized declarations; call build_protocol_template() and build_category_template(). (string_hash, string_eq): New functions. (objc_build_string_object): Check metaclass correctness only once; store string literals in hash table. (objc_build_constructor): Do not convert initializer elements; adjust for ObjC++ impedance mismatch. (build_objc_symtab_template): Call create_field_decl() instead of create_builtin_decl(). (init_objc_symtab): Add missing conversion to initializer element. (build_metadata_decl): Call start_var_decl() instead of define_decl(). (generate_objc_symtab_decl): Do not call build_category_template(); call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(). (build_module_descriptor): Call create_field_decl() instead of grokfield(); call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(); always mark module descriptor as used; move GNU runtime-specific functionality to build_module_initializer_routine(). (build_module_initializer_routine): New function, broken off of build_module_descriptor(). (objc_static_init_needed_p, objc_generate_static_init_call): New functions. (generate_static_references, generate_strings, build_selector_translation_table, generate_descriptor_table, generate_ivars_list, generate_dispatch_table, generate_category): Call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(); build a type directly instead of via groktypename(). (build_selector_reference_decl, build_selector_table_decl, build_class_reference_decl, build_protocol_reference, generate_objc_image_info): Call start_var_decl() instead of build_decl(). (build_selector_reference): For GNU runtime, do not call build_selector_reference_decl(). (build_selector, build_typed_selector_reference): Always convert result to the selector type. (add_objc_string): Cast return value to 'char *'. (build_method_prototype_template, build_selector_template, build_method_template): Use actual selector type for fields pointing to selectors. (finish_objc): For GNU runtime, call build_module_initializer_routine() after build_module_descriptor(). (generate_protocol_list, generate_shared_structures): Call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(); build a type directly instead of via groktypename(). (synth_id_with_class_suffix): Return a string. (get_arg_type_list): For instance methods, use the instance type for 'self'; do not call groktypename_in_parm_context(). (build_objc_string_decl): Squash redeclaration errors in ObjC++. (objc_is_class_name): Use OBJC_TYPE_NAME instead of TYPE_NAME; handle RECORD_TYPEs in ObjC as well as ObjC++. (objc_is_id): New function. (objc_is_object_ptr): Return the canonical type node. (objc_get_class_ivars): Simplify using get_class_ivars(). (get_class_ivars): Remove second parameter; create a fresh copy of the ivar list for each call; do not check for existence of super class. (objc_eh_runtime_type): Mark #ifndef OBJCPLUS. (objc_init_exceptions): When using SJLJ-style exceptions, require the use of '-fobjc-exceptions' flag; do not require it for DWARF-style exceptions. (objc_build_exc_ptr, next_sjlj_build_try_catch_finally): Use objc_object_type instead of objc_id_type. (objc_begin_catch_clause): Convert the incoming PARM_DECL into a VAR_DECL before placing it in the appropriate scope; do not call define_decl(); adjust call to c_begin_compound_stmt(); use objc_object_type instead of objc_id_type. (build_next_objc_exception_stuff): Call create_field_decl() instead of create_builtin_decl(); construct type directly instead of calling groktypename(); use OBJC_VOID_AT_END to mark end of function parameters. (build_private_template): Adjust call to get_class_ivars(); build a type directly instead of via groktypename(). (build_protocol_template, build_method_prototype_list_template, build_method_prototype_template, build_category_template, build_selector_template, build_class_template, build_super_template, build_ivar_template, build_ivar_list_template, build_method_list_template, build_method_template): Call create_field_decl() instead of grokfield(). (objc_method_parm_type): Do not call groktypename(). (generate_descriptor_table): Call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(). (generate_method_descriptors, build_protocol_initializer, generate_dispatch_tables, build_category_initializer, build_shared_structure_initializer): Do not call groktypename(). (generate_protocols): Call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(); do not call groktypename(). (error_with_ivar): Remove last parameter. (check_ivars): Do not iterate ovar CLASS_RAW_IVARS lists in addition to CLASS_IVARS lists; adjust calls to error_with_ivar(). (generate_ivar_lists): Convert one of the initializer elements; do not call groktypename(). (get_arg_type_list, start_method_def, gen_method_def): Account for new representation of variable arguments and '...' in Objective-C methods; add Objective-C++ impedance matching code. (is_objc_type_qualifier): Remove function. (adjust_type_for_id_default): Simplify; there is no longer a need to wade through declspecs. (lookup_interface, start_class, continue_class, finish_class, start_method_def, start_protocol, build_method_decl, objc_add_method, add_instance_variable, build_ivar_reference, is_ivar, is_private, get_super_receiver, objc_build_finally_epilogue): Make into static functions. (receiver_is_class_object): Use new IS_CLASS() macro. (objc_build_message_expr): Tweak ObjC++ message argument handling; call objc_finish_message_expr() instead of finish_message_expr(). (finish_message_expr): Rename to objc_finish_message_expr(); use OBJC_TYPE_NAME and OBJC_SET_TYPE_NAME macros instead of TYPE_NAME. call gen_type_name() instead of gen_declaration(); call objc_is_id() instead of using IS_ID and IS_CLASS; Use objc_class_name instead of calling get_identifier("Class"); handle CONVERT_EXPRs in receiver. (build_objc_method_call, warn_with_method): Do not call groktypename(). (build_ivar_reference): Call convert() instead of clobbering in a type. (hash_init): Initialize string_htab hash table. (add_instance_variable): Simplify parameter list; do not call grokfield(); do not populate CLASS_IVARS list. (start_class): Check for the existence of super class, if one was specified. (continue_class): Use CLASS_RAW_IVARS rather than CLASS_IVARS; do not call build_class_template(); adjust call to get_class_ivars(); call build_decl(), pushdecl() and finish_decl() instead of define_decl(). (finish_class): Call build_decl(), pushdecl() and finish_decl() instead of define_decl(). (add_protocols): Use PROTOCOL_BINFO_ELTS for the tree vector size. (start_protocol): Do not call build_protocol_template(); use PROTOCOL_BINFO_ELTS for the tree vector size. (encode_type_qualifiers): Do not handle the 'const' qualifier here. (encode_pointer): Encode 'const char *' as 'r*', for backwards compatibility. (encode_array): Use HOST_WIDE_INT_PRINT_DEC instead of "%ld". (encode_type): Handle the 'const' qualifier here. (objc_parmlist): New global variable, sued by objc_push_parm and objc_get_parm_info(). (objc_push_parm, objc_get_parm_info): New functions. (objc_expr_last): Remove function. (synth_self_and_ucmd_args): For instance methods, use the instance type for 'self'; call objc_push_parm() instead of push_parm_decl(). (start_method_def): Do not call push_scope(), declare_parm_level(), pop_scope(), push_parm_decl(), store_parm_decls() or objc_expr_last(); just use objc_push_parm() and objc_get_parm_info(). (comp_method_with_proto): Remove function. (objc_types_are_equivalent): Strip away indirections before comparing underlying types. (comp_proto_with_proto): Do not call groktypename(); types are no longer in raw declspec format. (objc_start_function): New function. (really_start_method): Call comp_proto_with_proto() instead of comp_method_with_proto(); call objc_start_function() instead of hand-crafting a function declarator. (continue_method_def, objc_expand_function_end): Remove functions. (get_super_receiver): Call objc_get_current_scope() instead of get_current_scope(); reference 'super_class' field (instead of 'class'). (finish_method_def): Rename to objc_finish_method_definition() and add a function decl parameter; move method encoding call from objc_expand_function_end(). (is_complex_decl, adorn_decl, gen_declarator, gen_declspecs, gen_declaration_1): Remove functions. (tmpbuf, RAW_DECLSPEC): Remove. (gen_declaration): Remove second parameter; simplify to deal with TYPE_P nodes instead of raw declspecs. (gen_type_name, gen_type_name_0): New functions. (gen_method_decl): Remove second parameter; call gen_type_name() instead of gen_declaration_1(). (dump_interface): Adjust calls to gen_declaration() and gen_method_decl(); do not allocate a separate string buffer. (init_objc): Allocate a larger string buffer to accommodate dump_interface(); adjust call to build_module_descriptor(); add call to build_module_initializer_routine() for the GNU runtime. (generate_classref_translation_entry): Do not call start_decl(); call finish_var_decl() instead of finish_decl(); call convert() instead of build_c_cast(). * objc-act.h (CLASS_OWN_IVARS): Remove accessor. (CLASS_BINFO_ELTS): Reduce from 6 to 5, now that CLASS_OWN_IVARS is gone. (OCTI_GNU_INIT_DECL, GNU_INIT_decl): New. (OCTI_ELLIPSIS_NODE, objc_ellipsis_node): Remove. (OCTI_ID_ID, id_type, objc_id_id): Rename to OCTI_ID_NAME, objc_object_type and objc_object_name, respectively. (OCTI_CLS_REF, OCTI_CLASS_NAME, objc_class_reference, objc_class_name): New. (IS_CLASS): New macro. (IS_ID, IS_SUPER): Robustify. (OCTI_EXECCLASS_DECL, execclass_decl): New. (finish_file, start_class, continue_class, finish_class, start_method_def, continue_method_def, finish_method_def, start_protocol, finish_protocol, objc_build_throw_stmt, objc_build_try_catch_finally_stmt, objc_build_synchronized_prologue, objc_build_synchronized_epilogue, objc_build_try_prologue, objc_build_try_epilogue, objc_build_catch_stmt, objc_build_catch_epilogue, objc_build_finally_prologue, objc_build_finally_epilogue, is_ivar, is_private, is_public, add_instance_variable, objc_add_method, get_super_receiver, objc_clear_super_receiver, get_class_ivars_from_name, get_class_reference, get_static_reference, get_object_reference, build_message_expr, finish_message_expr, build_selector_expr, build_ivar_reference, build_keyword_decl, build_method_decl, build_protocol_expr, build_objc_string_object, objc_declare_alias, objc_declare_class, objc_declare_protocols, objc_comptypes, objc_check_decl, build_encode_expr): Remove prototypes. (imp_count, cat_count): Make GGC-aware. (OBJC_SET_TYPE_NAME): New macro. From-SVN: r87168
2004-09-08 02:49:44 +02:00
static tree
start_var_decl (tree type, const char *name)
{
tree var = build_decl (VAR_DECL, get_identifier (name), type);
TREE_STATIC (var) = 1;
DECL_INITIAL (var) = error_mark_node; /* A real initializer is coming... */
DECL_IGNORED_P (var) = 1;
DECL_ARTIFICIAL (var) = 1;
DECL_CONTEXT (var) = NULL_TREE;
#ifdef OBJCPLUS
DECL_THIS_STATIC (var) = 1; /* squash redeclaration errors */
#endif
return var;
}
Makefile.in (c-parse.o): Depend on $(C_COMMON_H). [gcc/ChangeLog] 2004-09-07 Ziemowit Laski <zlaski@apple.com> * Makefile.in (c-parse.o): Depend on $(C_COMMON_H). * c-parse.in: Include c-common.h instead of objc-act.h. (ivar_decl_list, ivar_decls, ivar_decl, ivars, ivar_declarator, myparms, myparm): Remove %type declarations. (methodtype, optparms, OBJC_TYPE_QUAL, objc_quals, objc_qual, objc_typename, objc_try_catch_stmt, optellipsis): Add %type declarations. (objc_inherit_code, objc_public_flag): Remove. (typespec_nonreserved_nonattr): Call objc_get_protocol_qualified_type() instead of get_static_reference() and get_protocol_reference(). (stmt_nocomp): Call grokparm() on @catch parameter. (objcdef): Move semantic action to objc_finish_implementation(). (classdef): Move semantic action to objc_start_class_interface(), objc_continue_interface(), objc_finish_interface(), objc_start_class_implementation(), objc_continue_implementation(), objc_start_category_interface() and objc_start_category_implementation(). (protocoldef): Move semantic actions to objc_start_protocol() and objc_finish_interface(). (ivar_decl_list): Remove nonterminal. (visibility_spec): Move semantic actions to objc_set_visibility(). (ivar_decls): Remove assignment to $$. (ivar_decl): Rephrase in terms of component_decl; call objc_add_instance_variable(). (ivars, ivar_declarator): Remove nonterminals. (opt_semi): New nonterminal. (methodtype): Remove semantic actions. (methoddef): Move semantic actions to objc_set_method_type(), objc_start_method_definition() and objc_finish_method_definition(). (methodproto): Move semantic actions to objc_set_method_type() and objc_add_method_declaration(). (methoddecl): Use objc_typename instead of typename; move semantic actions to objc_build_method_signature(). (optarglist, myxdecls, mydecl, myparms, myparm): Remove nonterminals. (optparmlist): Express in terms of optparms and optellipsis. (optparms, optellipsis, objc_qual, objc_quals, objc_typename): New nonterminals. (keyworddecl): Use objc_typename instead of typename. (rid_to_yy): Mark RID_IN, RID_OUT, RID_INOUT, RID_BYCOPY, RID_BYREF and RID_ONEWAY as returning OBJC_TYPE_QUAL to yyparse(). [gcc/objc/ChangeLog] 2004-09-07 Ziemowit Laski <zlaski@apple.com> * Make-lang.in (objc/objc-parse.o): Depend on $(C_COMMON_H) instead of objc/objc-act.h. (objc/objc-act.o): Depend on $(HASHTAB_H). * objc-act.c: Include hashtab.h; in ObjC++ mode, include cp-tree.h and objcp-decl.h instead of c-tree.h. (build_module_descriptor, get_class_ivars, synth_id_with_class_suffix, error_with_ivar, gen_method_decl, gen_declaration, setup_string_decl, build_protocol_template): Adjust prototypes. (build_module_initializer_routine, start_class, continue_class, finish_class, start_method_def, objc_start_function, start_protocol, build_method_decl, objc_add_method, add_instance_variable, build_ivar_reference, is_ivar, is_private, get_super_receiver, build_selector_table_decl, objc_push_parm, objc_get_parm_info, gen_type_name, gen_type_name_0, start_var_decl, finish_var_decl, create_field_decl): New prototypes. (objc_expand_function_end, comp_method_with_proto, objc_expr_last, gen_declaration_1, gen_declarator, is_complex_decl, adorn_decl, define_decl, create_builtin_decl, gen_declspecs): Remove prototypes. (TYPE_ID): Rename to OBJECT_TYPEDEF_NAME. (CLASS_TYPEDEF_NAME): New. (TAG_EXECCLASS): Change from a global variable to a #define. (TAG_RETURN_STRUCT): Delete. (TAG_GNUINIT): New, holds '__objc_gnu_init' name. (objc_inherit_code, objc_public_flag): New, moved from c-parse.in. (string_descriptor): New struct. (string_htab): New hash table. (string_hash, string_eq): New prototypes. (generate_struct_by_value_array): Call create_field_decl() instead of create_builtin_decl(). (objc_init): Do not initialize objc_ellipsis_node or TAG_EXECCLASS; In ObjC++ mode, call cxx_init() instead of c_objc_common_init(). (objc_finish_file): In ObjC++, call instantiate_pending_templates() and cp_finish_file(). (define_decl, get_static_reference, get_protocol_reference, create_builtin_decl): Remove functions. (objc_start_class_interface, objc_start_category_interface, objc_start_protocol, objc_continue_interface, objc_finish_interface, objc_start_class_implementation, objc_start_category_implementation, objc_continue_implementation, objc_finish_implementation, objc_set_visibility, objc_set_method_type, objc_build_method_signature, objc_add_method_declaration, objc_start_method_definition, objc_add_instance_variable, objc_get_protocol_qualified_type, create_field_decl, start_var_decl, finish_var_decl): New functions. (setup_string_decl): Simplify since it is only called once. (synth_module_prologue): Call build_class_template(); predefine 'id' and 'Class' as typedefs; rename 'temp_type' to 'type'; disable debug hooks for duration of function; fix GNU runtime messenger signatures to correspond to reality; forward-declare '__objc_exec_class' for the GNU runtime; call build_selector_table_decl(); in ObjC++ mode, generate 'extern "C" { ... }' wrappers around synthesized declarations; call build_protocol_template() and build_category_template(). (string_hash, string_eq): New functions. (objc_build_string_object): Check metaclass correctness only once; store string literals in hash table. (objc_build_constructor): Do not convert initializer elements; adjust for ObjC++ impedance mismatch. (build_objc_symtab_template): Call create_field_decl() instead of create_builtin_decl(). (init_objc_symtab): Add missing conversion to initializer element. (build_metadata_decl): Call start_var_decl() instead of define_decl(). (generate_objc_symtab_decl): Do not call build_category_template(); call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(). (build_module_descriptor): Call create_field_decl() instead of grokfield(); call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(); always mark module descriptor as used; move GNU runtime-specific functionality to build_module_initializer_routine(). (build_module_initializer_routine): New function, broken off of build_module_descriptor(). (objc_static_init_needed_p, objc_generate_static_init_call): New functions. (generate_static_references, generate_strings, build_selector_translation_table, generate_descriptor_table, generate_ivars_list, generate_dispatch_table, generate_category): Call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(); build a type directly instead of via groktypename(). (build_selector_reference_decl, build_selector_table_decl, build_class_reference_decl, build_protocol_reference, generate_objc_image_info): Call start_var_decl() instead of build_decl(). (build_selector_reference): For GNU runtime, do not call build_selector_reference_decl(). (build_selector, build_typed_selector_reference): Always convert result to the selector type. (add_objc_string): Cast return value to 'char *'. (build_method_prototype_template, build_selector_template, build_method_template): Use actual selector type for fields pointing to selectors. (finish_objc): For GNU runtime, call build_module_initializer_routine() after build_module_descriptor(). (generate_protocol_list, generate_shared_structures): Call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(); build a type directly instead of via groktypename(). (synth_id_with_class_suffix): Return a string. (get_arg_type_list): For instance methods, use the instance type for 'self'; do not call groktypename_in_parm_context(). (build_objc_string_decl): Squash redeclaration errors in ObjC++. (objc_is_class_name): Use OBJC_TYPE_NAME instead of TYPE_NAME; handle RECORD_TYPEs in ObjC as well as ObjC++. (objc_is_id): New function. (objc_is_object_ptr): Return the canonical type node. (objc_get_class_ivars): Simplify using get_class_ivars(). (get_class_ivars): Remove second parameter; create a fresh copy of the ivar list for each call; do not check for existence of super class. (objc_eh_runtime_type): Mark #ifndef OBJCPLUS. (objc_init_exceptions): When using SJLJ-style exceptions, require the use of '-fobjc-exceptions' flag; do not require it for DWARF-style exceptions. (objc_build_exc_ptr, next_sjlj_build_try_catch_finally): Use objc_object_type instead of objc_id_type. (objc_begin_catch_clause): Convert the incoming PARM_DECL into a VAR_DECL before placing it in the appropriate scope; do not call define_decl(); adjust call to c_begin_compound_stmt(); use objc_object_type instead of objc_id_type. (build_next_objc_exception_stuff): Call create_field_decl() instead of create_builtin_decl(); construct type directly instead of calling groktypename(); use OBJC_VOID_AT_END to mark end of function parameters. (build_private_template): Adjust call to get_class_ivars(); build a type directly instead of via groktypename(). (build_protocol_template, build_method_prototype_list_template, build_method_prototype_template, build_category_template, build_selector_template, build_class_template, build_super_template, build_ivar_template, build_ivar_list_template, build_method_list_template, build_method_template): Call create_field_decl() instead of grokfield(). (objc_method_parm_type): Do not call groktypename(). (generate_descriptor_table): Call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(). (generate_method_descriptors, build_protocol_initializer, generate_dispatch_tables, build_category_initializer, build_shared_structure_initializer): Do not call groktypename(). (generate_protocols): Call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(); do not call groktypename(). (error_with_ivar): Remove last parameter. (check_ivars): Do not iterate ovar CLASS_RAW_IVARS lists in addition to CLASS_IVARS lists; adjust calls to error_with_ivar(). (generate_ivar_lists): Convert one of the initializer elements; do not call groktypename(). (get_arg_type_list, start_method_def, gen_method_def): Account for new representation of variable arguments and '...' in Objective-C methods; add Objective-C++ impedance matching code. (is_objc_type_qualifier): Remove function. (adjust_type_for_id_default): Simplify; there is no longer a need to wade through declspecs. (lookup_interface, start_class, continue_class, finish_class, start_method_def, start_protocol, build_method_decl, objc_add_method, add_instance_variable, build_ivar_reference, is_ivar, is_private, get_super_receiver, objc_build_finally_epilogue): Make into static functions. (receiver_is_class_object): Use new IS_CLASS() macro. (objc_build_message_expr): Tweak ObjC++ message argument handling; call objc_finish_message_expr() instead of finish_message_expr(). (finish_message_expr): Rename to objc_finish_message_expr(); use OBJC_TYPE_NAME and OBJC_SET_TYPE_NAME macros instead of TYPE_NAME. call gen_type_name() instead of gen_declaration(); call objc_is_id() instead of using IS_ID and IS_CLASS; Use objc_class_name instead of calling get_identifier("Class"); handle CONVERT_EXPRs in receiver. (build_objc_method_call, warn_with_method): Do not call groktypename(). (build_ivar_reference): Call convert() instead of clobbering in a type. (hash_init): Initialize string_htab hash table. (add_instance_variable): Simplify parameter list; do not call grokfield(); do not populate CLASS_IVARS list. (start_class): Check for the existence of super class, if one was specified. (continue_class): Use CLASS_RAW_IVARS rather than CLASS_IVARS; do not call build_class_template(); adjust call to get_class_ivars(); call build_decl(), pushdecl() and finish_decl() instead of define_decl(). (finish_class): Call build_decl(), pushdecl() and finish_decl() instead of define_decl(). (add_protocols): Use PROTOCOL_BINFO_ELTS for the tree vector size. (start_protocol): Do not call build_protocol_template(); use PROTOCOL_BINFO_ELTS for the tree vector size. (encode_type_qualifiers): Do not handle the 'const' qualifier here. (encode_pointer): Encode 'const char *' as 'r*', for backwards compatibility. (encode_array): Use HOST_WIDE_INT_PRINT_DEC instead of "%ld". (encode_type): Handle the 'const' qualifier here. (objc_parmlist): New global variable, sued by objc_push_parm and objc_get_parm_info(). (objc_push_parm, objc_get_parm_info): New functions. (objc_expr_last): Remove function. (synth_self_and_ucmd_args): For instance methods, use the instance type for 'self'; call objc_push_parm() instead of push_parm_decl(). (start_method_def): Do not call push_scope(), declare_parm_level(), pop_scope(), push_parm_decl(), store_parm_decls() or objc_expr_last(); just use objc_push_parm() and objc_get_parm_info(). (comp_method_with_proto): Remove function. (objc_types_are_equivalent): Strip away indirections before comparing underlying types. (comp_proto_with_proto): Do not call groktypename(); types are no longer in raw declspec format. (objc_start_function): New function. (really_start_method): Call comp_proto_with_proto() instead of comp_method_with_proto(); call objc_start_function() instead of hand-crafting a function declarator. (continue_method_def, objc_expand_function_end): Remove functions. (get_super_receiver): Call objc_get_current_scope() instead of get_current_scope(); reference 'super_class' field (instead of 'class'). (finish_method_def): Rename to objc_finish_method_definition() and add a function decl parameter; move method encoding call from objc_expand_function_end(). (is_complex_decl, adorn_decl, gen_declarator, gen_declspecs, gen_declaration_1): Remove functions. (tmpbuf, RAW_DECLSPEC): Remove. (gen_declaration): Remove second parameter; simplify to deal with TYPE_P nodes instead of raw declspecs. (gen_type_name, gen_type_name_0): New functions. (gen_method_decl): Remove second parameter; call gen_type_name() instead of gen_declaration_1(). (dump_interface): Adjust calls to gen_declaration() and gen_method_decl(); do not allocate a separate string buffer. (init_objc): Allocate a larger string buffer to accommodate dump_interface(); adjust call to build_module_descriptor(); add call to build_module_initializer_routine() for the GNU runtime. (generate_classref_translation_entry): Do not call start_decl(); call finish_var_decl() instead of finish_decl(); call convert() instead of build_c_cast(). * objc-act.h (CLASS_OWN_IVARS): Remove accessor. (CLASS_BINFO_ELTS): Reduce from 6 to 5, now that CLASS_OWN_IVARS is gone. (OCTI_GNU_INIT_DECL, GNU_INIT_decl): New. (OCTI_ELLIPSIS_NODE, objc_ellipsis_node): Remove. (OCTI_ID_ID, id_type, objc_id_id): Rename to OCTI_ID_NAME, objc_object_type and objc_object_name, respectively. (OCTI_CLS_REF, OCTI_CLASS_NAME, objc_class_reference, objc_class_name): New. (IS_CLASS): New macro. (IS_ID, IS_SUPER): Robustify. (OCTI_EXECCLASS_DECL, execclass_decl): New. (finish_file, start_class, continue_class, finish_class, start_method_def, continue_method_def, finish_method_def, start_protocol, finish_protocol, objc_build_throw_stmt, objc_build_try_catch_finally_stmt, objc_build_synchronized_prologue, objc_build_synchronized_epilogue, objc_build_try_prologue, objc_build_try_epilogue, objc_build_catch_stmt, objc_build_catch_epilogue, objc_build_finally_prologue, objc_build_finally_epilogue, is_ivar, is_private, is_public, add_instance_variable, objc_add_method, get_super_receiver, objc_clear_super_receiver, get_class_ivars_from_name, get_class_reference, get_static_reference, get_object_reference, build_message_expr, finish_message_expr, build_selector_expr, build_ivar_reference, build_keyword_decl, build_method_decl, build_protocol_expr, build_objc_string_object, objc_declare_alias, objc_declare_class, objc_declare_protocols, objc_comptypes, objc_check_decl, build_encode_expr): Remove prototypes. (imp_count, cat_count): Make GGC-aware. (OBJC_SET_TYPE_NAME): New macro. From-SVN: r87168
2004-09-08 02:49:44 +02:00
/* Finish off the variable declaration created by start_var_decl(). */
static void
Makefile.in (c-parse.o): Depend on $(C_COMMON_H). [gcc/ChangeLog] 2004-09-07 Ziemowit Laski <zlaski@apple.com> * Makefile.in (c-parse.o): Depend on $(C_COMMON_H). * c-parse.in: Include c-common.h instead of objc-act.h. (ivar_decl_list, ivar_decls, ivar_decl, ivars, ivar_declarator, myparms, myparm): Remove %type declarations. (methodtype, optparms, OBJC_TYPE_QUAL, objc_quals, objc_qual, objc_typename, objc_try_catch_stmt, optellipsis): Add %type declarations. (objc_inherit_code, objc_public_flag): Remove. (typespec_nonreserved_nonattr): Call objc_get_protocol_qualified_type() instead of get_static_reference() and get_protocol_reference(). (stmt_nocomp): Call grokparm() on @catch parameter. (objcdef): Move semantic action to objc_finish_implementation(). (classdef): Move semantic action to objc_start_class_interface(), objc_continue_interface(), objc_finish_interface(), objc_start_class_implementation(), objc_continue_implementation(), objc_start_category_interface() and objc_start_category_implementation(). (protocoldef): Move semantic actions to objc_start_protocol() and objc_finish_interface(). (ivar_decl_list): Remove nonterminal. (visibility_spec): Move semantic actions to objc_set_visibility(). (ivar_decls): Remove assignment to $$. (ivar_decl): Rephrase in terms of component_decl; call objc_add_instance_variable(). (ivars, ivar_declarator): Remove nonterminals. (opt_semi): New nonterminal. (methodtype): Remove semantic actions. (methoddef): Move semantic actions to objc_set_method_type(), objc_start_method_definition() and objc_finish_method_definition(). (methodproto): Move semantic actions to objc_set_method_type() and objc_add_method_declaration(). (methoddecl): Use objc_typename instead of typename; move semantic actions to objc_build_method_signature(). (optarglist, myxdecls, mydecl, myparms, myparm): Remove nonterminals. (optparmlist): Express in terms of optparms and optellipsis. (optparms, optellipsis, objc_qual, objc_quals, objc_typename): New nonterminals. (keyworddecl): Use objc_typename instead of typename. (rid_to_yy): Mark RID_IN, RID_OUT, RID_INOUT, RID_BYCOPY, RID_BYREF and RID_ONEWAY as returning OBJC_TYPE_QUAL to yyparse(). [gcc/objc/ChangeLog] 2004-09-07 Ziemowit Laski <zlaski@apple.com> * Make-lang.in (objc/objc-parse.o): Depend on $(C_COMMON_H) instead of objc/objc-act.h. (objc/objc-act.o): Depend on $(HASHTAB_H). * objc-act.c: Include hashtab.h; in ObjC++ mode, include cp-tree.h and objcp-decl.h instead of c-tree.h. (build_module_descriptor, get_class_ivars, synth_id_with_class_suffix, error_with_ivar, gen_method_decl, gen_declaration, setup_string_decl, build_protocol_template): Adjust prototypes. (build_module_initializer_routine, start_class, continue_class, finish_class, start_method_def, objc_start_function, start_protocol, build_method_decl, objc_add_method, add_instance_variable, build_ivar_reference, is_ivar, is_private, get_super_receiver, build_selector_table_decl, objc_push_parm, objc_get_parm_info, gen_type_name, gen_type_name_0, start_var_decl, finish_var_decl, create_field_decl): New prototypes. (objc_expand_function_end, comp_method_with_proto, objc_expr_last, gen_declaration_1, gen_declarator, is_complex_decl, adorn_decl, define_decl, create_builtin_decl, gen_declspecs): Remove prototypes. (TYPE_ID): Rename to OBJECT_TYPEDEF_NAME. (CLASS_TYPEDEF_NAME): New. (TAG_EXECCLASS): Change from a global variable to a #define. (TAG_RETURN_STRUCT): Delete. (TAG_GNUINIT): New, holds '__objc_gnu_init' name. (objc_inherit_code, objc_public_flag): New, moved from c-parse.in. (string_descriptor): New struct. (string_htab): New hash table. (string_hash, string_eq): New prototypes. (generate_struct_by_value_array): Call create_field_decl() instead of create_builtin_decl(). (objc_init): Do not initialize objc_ellipsis_node or TAG_EXECCLASS; In ObjC++ mode, call cxx_init() instead of c_objc_common_init(). (objc_finish_file): In ObjC++, call instantiate_pending_templates() and cp_finish_file(). (define_decl, get_static_reference, get_protocol_reference, create_builtin_decl): Remove functions. (objc_start_class_interface, objc_start_category_interface, objc_start_protocol, objc_continue_interface, objc_finish_interface, objc_start_class_implementation, objc_start_category_implementation, objc_continue_implementation, objc_finish_implementation, objc_set_visibility, objc_set_method_type, objc_build_method_signature, objc_add_method_declaration, objc_start_method_definition, objc_add_instance_variable, objc_get_protocol_qualified_type, create_field_decl, start_var_decl, finish_var_decl): New functions. (setup_string_decl): Simplify since it is only called once. (synth_module_prologue): Call build_class_template(); predefine 'id' and 'Class' as typedefs; rename 'temp_type' to 'type'; disable debug hooks for duration of function; fix GNU runtime messenger signatures to correspond to reality; forward-declare '__objc_exec_class' for the GNU runtime; call build_selector_table_decl(); in ObjC++ mode, generate 'extern "C" { ... }' wrappers around synthesized declarations; call build_protocol_template() and build_category_template(). (string_hash, string_eq): New functions. (objc_build_string_object): Check metaclass correctness only once; store string literals in hash table. (objc_build_constructor): Do not convert initializer elements; adjust for ObjC++ impedance mismatch. (build_objc_symtab_template): Call create_field_decl() instead of create_builtin_decl(). (init_objc_symtab): Add missing conversion to initializer element. (build_metadata_decl): Call start_var_decl() instead of define_decl(). (generate_objc_symtab_decl): Do not call build_category_template(); call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(). (build_module_descriptor): Call create_field_decl() instead of grokfield(); call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(); always mark module descriptor as used; move GNU runtime-specific functionality to build_module_initializer_routine(). (build_module_initializer_routine): New function, broken off of build_module_descriptor(). (objc_static_init_needed_p, objc_generate_static_init_call): New functions. (generate_static_references, generate_strings, build_selector_translation_table, generate_descriptor_table, generate_ivars_list, generate_dispatch_table, generate_category): Call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(); build a type directly instead of via groktypename(). (build_selector_reference_decl, build_selector_table_decl, build_class_reference_decl, build_protocol_reference, generate_objc_image_info): Call start_var_decl() instead of build_decl(). (build_selector_reference): For GNU runtime, do not call build_selector_reference_decl(). (build_selector, build_typed_selector_reference): Always convert result to the selector type. (add_objc_string): Cast return value to 'char *'. (build_method_prototype_template, build_selector_template, build_method_template): Use actual selector type for fields pointing to selectors. (finish_objc): For GNU runtime, call build_module_initializer_routine() after build_module_descriptor(). (generate_protocol_list, generate_shared_structures): Call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(); build a type directly instead of via groktypename(). (synth_id_with_class_suffix): Return a string. (get_arg_type_list): For instance methods, use the instance type for 'self'; do not call groktypename_in_parm_context(). (build_objc_string_decl): Squash redeclaration errors in ObjC++. (objc_is_class_name): Use OBJC_TYPE_NAME instead of TYPE_NAME; handle RECORD_TYPEs in ObjC as well as ObjC++. (objc_is_id): New function. (objc_is_object_ptr): Return the canonical type node. (objc_get_class_ivars): Simplify using get_class_ivars(). (get_class_ivars): Remove second parameter; create a fresh copy of the ivar list for each call; do not check for existence of super class. (objc_eh_runtime_type): Mark #ifndef OBJCPLUS. (objc_init_exceptions): When using SJLJ-style exceptions, require the use of '-fobjc-exceptions' flag; do not require it for DWARF-style exceptions. (objc_build_exc_ptr, next_sjlj_build_try_catch_finally): Use objc_object_type instead of objc_id_type. (objc_begin_catch_clause): Convert the incoming PARM_DECL into a VAR_DECL before placing it in the appropriate scope; do not call define_decl(); adjust call to c_begin_compound_stmt(); use objc_object_type instead of objc_id_type. (build_next_objc_exception_stuff): Call create_field_decl() instead of create_builtin_decl(); construct type directly instead of calling groktypename(); use OBJC_VOID_AT_END to mark end of function parameters. (build_private_template): Adjust call to get_class_ivars(); build a type directly instead of via groktypename(). (build_protocol_template, build_method_prototype_list_template, build_method_prototype_template, build_category_template, build_selector_template, build_class_template, build_super_template, build_ivar_template, build_ivar_list_template, build_method_list_template, build_method_template): Call create_field_decl() instead of grokfield(). (objc_method_parm_type): Do not call groktypename(). (generate_descriptor_table): Call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(). (generate_method_descriptors, build_protocol_initializer, generate_dispatch_tables, build_category_initializer, build_shared_structure_initializer): Do not call groktypename(). (generate_protocols): Call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(); do not call groktypename(). (error_with_ivar): Remove last parameter. (check_ivars): Do not iterate ovar CLASS_RAW_IVARS lists in addition to CLASS_IVARS lists; adjust calls to error_with_ivar(). (generate_ivar_lists): Convert one of the initializer elements; do not call groktypename(). (get_arg_type_list, start_method_def, gen_method_def): Account for new representation of variable arguments and '...' in Objective-C methods; add Objective-C++ impedance matching code. (is_objc_type_qualifier): Remove function. (adjust_type_for_id_default): Simplify; there is no longer a need to wade through declspecs. (lookup_interface, start_class, continue_class, finish_class, start_method_def, start_protocol, build_method_decl, objc_add_method, add_instance_variable, build_ivar_reference, is_ivar, is_private, get_super_receiver, objc_build_finally_epilogue): Make into static functions. (receiver_is_class_object): Use new IS_CLASS() macro. (objc_build_message_expr): Tweak ObjC++ message argument handling; call objc_finish_message_expr() instead of finish_message_expr(). (finish_message_expr): Rename to objc_finish_message_expr(); use OBJC_TYPE_NAME and OBJC_SET_TYPE_NAME macros instead of TYPE_NAME. call gen_type_name() instead of gen_declaration(); call objc_is_id() instead of using IS_ID and IS_CLASS; Use objc_class_name instead of calling get_identifier("Class"); handle CONVERT_EXPRs in receiver. (build_objc_method_call, warn_with_method): Do not call groktypename(). (build_ivar_reference): Call convert() instead of clobbering in a type. (hash_init): Initialize string_htab hash table. (add_instance_variable): Simplify parameter list; do not call grokfield(); do not populate CLASS_IVARS list. (start_class): Check for the existence of super class, if one was specified. (continue_class): Use CLASS_RAW_IVARS rather than CLASS_IVARS; do not call build_class_template(); adjust call to get_class_ivars(); call build_decl(), pushdecl() and finish_decl() instead of define_decl(). (finish_class): Call build_decl(), pushdecl() and finish_decl() instead of define_decl(). (add_protocols): Use PROTOCOL_BINFO_ELTS for the tree vector size. (start_protocol): Do not call build_protocol_template(); use PROTOCOL_BINFO_ELTS for the tree vector size. (encode_type_qualifiers): Do not handle the 'const' qualifier here. (encode_pointer): Encode 'const char *' as 'r*', for backwards compatibility. (encode_array): Use HOST_WIDE_INT_PRINT_DEC instead of "%ld". (encode_type): Handle the 'const' qualifier here. (objc_parmlist): New global variable, sued by objc_push_parm and objc_get_parm_info(). (objc_push_parm, objc_get_parm_info): New functions. (objc_expr_last): Remove function. (synth_self_and_ucmd_args): For instance methods, use the instance type for 'self'; call objc_push_parm() instead of push_parm_decl(). (start_method_def): Do not call push_scope(), declare_parm_level(), pop_scope(), push_parm_decl(), store_parm_decls() or objc_expr_last(); just use objc_push_parm() and objc_get_parm_info(). (comp_method_with_proto): Remove function. (objc_types_are_equivalent): Strip away indirections before comparing underlying types. (comp_proto_with_proto): Do not call groktypename(); types are no longer in raw declspec format. (objc_start_function): New function. (really_start_method): Call comp_proto_with_proto() instead of comp_method_with_proto(); call objc_start_function() instead of hand-crafting a function declarator. (continue_method_def, objc_expand_function_end): Remove functions. (get_super_receiver): Call objc_get_current_scope() instead of get_current_scope(); reference 'super_class' field (instead of 'class'). (finish_method_def): Rename to objc_finish_method_definition() and add a function decl parameter; move method encoding call from objc_expand_function_end(). (is_complex_decl, adorn_decl, gen_declarator, gen_declspecs, gen_declaration_1): Remove functions. (tmpbuf, RAW_DECLSPEC): Remove. (gen_declaration): Remove second parameter; simplify to deal with TYPE_P nodes instead of raw declspecs. (gen_type_name, gen_type_name_0): New functions. (gen_method_decl): Remove second parameter; call gen_type_name() instead of gen_declaration_1(). (dump_interface): Adjust calls to gen_declaration() and gen_method_decl(); do not allocate a separate string buffer. (init_objc): Allocate a larger string buffer to accommodate dump_interface(); adjust call to build_module_descriptor(); add call to build_module_initializer_routine() for the GNU runtime. (generate_classref_translation_entry): Do not call start_decl(); call finish_var_decl() instead of finish_decl(); call convert() instead of build_c_cast(). * objc-act.h (CLASS_OWN_IVARS): Remove accessor. (CLASS_BINFO_ELTS): Reduce from 6 to 5, now that CLASS_OWN_IVARS is gone. (OCTI_GNU_INIT_DECL, GNU_INIT_decl): New. (OCTI_ELLIPSIS_NODE, objc_ellipsis_node): Remove. (OCTI_ID_ID, id_type, objc_id_id): Rename to OCTI_ID_NAME, objc_object_type and objc_object_name, respectively. (OCTI_CLS_REF, OCTI_CLASS_NAME, objc_class_reference, objc_class_name): New. (IS_CLASS): New macro. (IS_ID, IS_SUPER): Robustify. (OCTI_EXECCLASS_DECL, execclass_decl): New. (finish_file, start_class, continue_class, finish_class, start_method_def, continue_method_def, finish_method_def, start_protocol, finish_protocol, objc_build_throw_stmt, objc_build_try_catch_finally_stmt, objc_build_synchronized_prologue, objc_build_synchronized_epilogue, objc_build_try_prologue, objc_build_try_epilogue, objc_build_catch_stmt, objc_build_catch_epilogue, objc_build_finally_prologue, objc_build_finally_epilogue, is_ivar, is_private, is_public, add_instance_variable, objc_add_method, get_super_receiver, objc_clear_super_receiver, get_class_ivars_from_name, get_class_reference, get_static_reference, get_object_reference, build_message_expr, finish_message_expr, build_selector_expr, build_ivar_reference, build_keyword_decl, build_method_decl, build_protocol_expr, build_objc_string_object, objc_declare_alias, objc_declare_class, objc_declare_protocols, objc_comptypes, objc_check_decl, build_encode_expr): Remove prototypes. (imp_count, cat_count): Make GGC-aware. (OBJC_SET_TYPE_NAME): New macro. From-SVN: r87168
2004-09-08 02:49:44 +02:00
finish_var_decl (tree var, tree initializer)
{
finish_decl (var, initializer, NULL_TREE);
/* Ensure that the variable actually gets output. */
mark_decl_referenced (var);
/* Mark the decl to avoid "defined but not used" warning. */
TREE_USED (var) = 1;
}
/* Find the decl for the constant string class reference. This is only
Makefile.in (c-parse.o): Depend on $(C_COMMON_H). [gcc/ChangeLog] 2004-09-07 Ziemowit Laski <zlaski@apple.com> * Makefile.in (c-parse.o): Depend on $(C_COMMON_H). * c-parse.in: Include c-common.h instead of objc-act.h. (ivar_decl_list, ivar_decls, ivar_decl, ivars, ivar_declarator, myparms, myparm): Remove %type declarations. (methodtype, optparms, OBJC_TYPE_QUAL, objc_quals, objc_qual, objc_typename, objc_try_catch_stmt, optellipsis): Add %type declarations. (objc_inherit_code, objc_public_flag): Remove. (typespec_nonreserved_nonattr): Call objc_get_protocol_qualified_type() instead of get_static_reference() and get_protocol_reference(). (stmt_nocomp): Call grokparm() on @catch parameter. (objcdef): Move semantic action to objc_finish_implementation(). (classdef): Move semantic action to objc_start_class_interface(), objc_continue_interface(), objc_finish_interface(), objc_start_class_implementation(), objc_continue_implementation(), objc_start_category_interface() and objc_start_category_implementation(). (protocoldef): Move semantic actions to objc_start_protocol() and objc_finish_interface(). (ivar_decl_list): Remove nonterminal. (visibility_spec): Move semantic actions to objc_set_visibility(). (ivar_decls): Remove assignment to $$. (ivar_decl): Rephrase in terms of component_decl; call objc_add_instance_variable(). (ivars, ivar_declarator): Remove nonterminals. (opt_semi): New nonterminal. (methodtype): Remove semantic actions. (methoddef): Move semantic actions to objc_set_method_type(), objc_start_method_definition() and objc_finish_method_definition(). (methodproto): Move semantic actions to objc_set_method_type() and objc_add_method_declaration(). (methoddecl): Use objc_typename instead of typename; move semantic actions to objc_build_method_signature(). (optarglist, myxdecls, mydecl, myparms, myparm): Remove nonterminals. (optparmlist): Express in terms of optparms and optellipsis. (optparms, optellipsis, objc_qual, objc_quals, objc_typename): New nonterminals. (keyworddecl): Use objc_typename instead of typename. (rid_to_yy): Mark RID_IN, RID_OUT, RID_INOUT, RID_BYCOPY, RID_BYREF and RID_ONEWAY as returning OBJC_TYPE_QUAL to yyparse(). [gcc/objc/ChangeLog] 2004-09-07 Ziemowit Laski <zlaski@apple.com> * Make-lang.in (objc/objc-parse.o): Depend on $(C_COMMON_H) instead of objc/objc-act.h. (objc/objc-act.o): Depend on $(HASHTAB_H). * objc-act.c: Include hashtab.h; in ObjC++ mode, include cp-tree.h and objcp-decl.h instead of c-tree.h. (build_module_descriptor, get_class_ivars, synth_id_with_class_suffix, error_with_ivar, gen_method_decl, gen_declaration, setup_string_decl, build_protocol_template): Adjust prototypes. (build_module_initializer_routine, start_class, continue_class, finish_class, start_method_def, objc_start_function, start_protocol, build_method_decl, objc_add_method, add_instance_variable, build_ivar_reference, is_ivar, is_private, get_super_receiver, build_selector_table_decl, objc_push_parm, objc_get_parm_info, gen_type_name, gen_type_name_0, start_var_decl, finish_var_decl, create_field_decl): New prototypes. (objc_expand_function_end, comp_method_with_proto, objc_expr_last, gen_declaration_1, gen_declarator, is_complex_decl, adorn_decl, define_decl, create_builtin_decl, gen_declspecs): Remove prototypes. (TYPE_ID): Rename to OBJECT_TYPEDEF_NAME. (CLASS_TYPEDEF_NAME): New. (TAG_EXECCLASS): Change from a global variable to a #define. (TAG_RETURN_STRUCT): Delete. (TAG_GNUINIT): New, holds '__objc_gnu_init' name. (objc_inherit_code, objc_public_flag): New, moved from c-parse.in. (string_descriptor): New struct. (string_htab): New hash table. (string_hash, string_eq): New prototypes. (generate_struct_by_value_array): Call create_field_decl() instead of create_builtin_decl(). (objc_init): Do not initialize objc_ellipsis_node or TAG_EXECCLASS; In ObjC++ mode, call cxx_init() instead of c_objc_common_init(). (objc_finish_file): In ObjC++, call instantiate_pending_templates() and cp_finish_file(). (define_decl, get_static_reference, get_protocol_reference, create_builtin_decl): Remove functions. (objc_start_class_interface, objc_start_category_interface, objc_start_protocol, objc_continue_interface, objc_finish_interface, objc_start_class_implementation, objc_start_category_implementation, objc_continue_implementation, objc_finish_implementation, objc_set_visibility, objc_set_method_type, objc_build_method_signature, objc_add_method_declaration, objc_start_method_definition, objc_add_instance_variable, objc_get_protocol_qualified_type, create_field_decl, start_var_decl, finish_var_decl): New functions. (setup_string_decl): Simplify since it is only called once. (synth_module_prologue): Call build_class_template(); predefine 'id' and 'Class' as typedefs; rename 'temp_type' to 'type'; disable debug hooks for duration of function; fix GNU runtime messenger signatures to correspond to reality; forward-declare '__objc_exec_class' for the GNU runtime; call build_selector_table_decl(); in ObjC++ mode, generate 'extern "C" { ... }' wrappers around synthesized declarations; call build_protocol_template() and build_category_template(). (string_hash, string_eq): New functions. (objc_build_string_object): Check metaclass correctness only once; store string literals in hash table. (objc_build_constructor): Do not convert initializer elements; adjust for ObjC++ impedance mismatch. (build_objc_symtab_template): Call create_field_decl() instead of create_builtin_decl(). (init_objc_symtab): Add missing conversion to initializer element. (build_metadata_decl): Call start_var_decl() instead of define_decl(). (generate_objc_symtab_decl): Do not call build_category_template(); call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(). (build_module_descriptor): Call create_field_decl() instead of grokfield(); call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(); always mark module descriptor as used; move GNU runtime-specific functionality to build_module_initializer_routine(). (build_module_initializer_routine): New function, broken off of build_module_descriptor(). (objc_static_init_needed_p, objc_generate_static_init_call): New functions. (generate_static_references, generate_strings, build_selector_translation_table, generate_descriptor_table, generate_ivars_list, generate_dispatch_table, generate_category): Call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(); build a type directly instead of via groktypename(). (build_selector_reference_decl, build_selector_table_decl, build_class_reference_decl, build_protocol_reference, generate_objc_image_info): Call start_var_decl() instead of build_decl(). (build_selector_reference): For GNU runtime, do not call build_selector_reference_decl(). (build_selector, build_typed_selector_reference): Always convert result to the selector type. (add_objc_string): Cast return value to 'char *'. (build_method_prototype_template, build_selector_template, build_method_template): Use actual selector type for fields pointing to selectors. (finish_objc): For GNU runtime, call build_module_initializer_routine() after build_module_descriptor(). (generate_protocol_list, generate_shared_structures): Call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(); build a type directly instead of via groktypename(). (synth_id_with_class_suffix): Return a string. (get_arg_type_list): For instance methods, use the instance type for 'self'; do not call groktypename_in_parm_context(). (build_objc_string_decl): Squash redeclaration errors in ObjC++. (objc_is_class_name): Use OBJC_TYPE_NAME instead of TYPE_NAME; handle RECORD_TYPEs in ObjC as well as ObjC++. (objc_is_id): New function. (objc_is_object_ptr): Return the canonical type node. (objc_get_class_ivars): Simplify using get_class_ivars(). (get_class_ivars): Remove second parameter; create a fresh copy of the ivar list for each call; do not check for existence of super class. (objc_eh_runtime_type): Mark #ifndef OBJCPLUS. (objc_init_exceptions): When using SJLJ-style exceptions, require the use of '-fobjc-exceptions' flag; do not require it for DWARF-style exceptions. (objc_build_exc_ptr, next_sjlj_build_try_catch_finally): Use objc_object_type instead of objc_id_type. (objc_begin_catch_clause): Convert the incoming PARM_DECL into a VAR_DECL before placing it in the appropriate scope; do not call define_decl(); adjust call to c_begin_compound_stmt(); use objc_object_type instead of objc_id_type. (build_next_objc_exception_stuff): Call create_field_decl() instead of create_builtin_decl(); construct type directly instead of calling groktypename(); use OBJC_VOID_AT_END to mark end of function parameters. (build_private_template): Adjust call to get_class_ivars(); build a type directly instead of via groktypename(). (build_protocol_template, build_method_prototype_list_template, build_method_prototype_template, build_category_template, build_selector_template, build_class_template, build_super_template, build_ivar_template, build_ivar_list_template, build_method_list_template, build_method_template): Call create_field_decl() instead of grokfield(). (objc_method_parm_type): Do not call groktypename(). (generate_descriptor_table): Call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(). (generate_method_descriptors, build_protocol_initializer, generate_dispatch_tables, build_category_initializer, build_shared_structure_initializer): Do not call groktypename(). (generate_protocols): Call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(); do not call groktypename(). (error_with_ivar): Remove last parameter. (check_ivars): Do not iterate ovar CLASS_RAW_IVARS lists in addition to CLASS_IVARS lists; adjust calls to error_with_ivar(). (generate_ivar_lists): Convert one of the initializer elements; do not call groktypename(). (get_arg_type_list, start_method_def, gen_method_def): Account for new representation of variable arguments and '...' in Objective-C methods; add Objective-C++ impedance matching code. (is_objc_type_qualifier): Remove function. (adjust_type_for_id_default): Simplify; there is no longer a need to wade through declspecs. (lookup_interface, start_class, continue_class, finish_class, start_method_def, start_protocol, build_method_decl, objc_add_method, add_instance_variable, build_ivar_reference, is_ivar, is_private, get_super_receiver, objc_build_finally_epilogue): Make into static functions. (receiver_is_class_object): Use new IS_CLASS() macro. (objc_build_message_expr): Tweak ObjC++ message argument handling; call objc_finish_message_expr() instead of finish_message_expr(). (finish_message_expr): Rename to objc_finish_message_expr(); use OBJC_TYPE_NAME and OBJC_SET_TYPE_NAME macros instead of TYPE_NAME. call gen_type_name() instead of gen_declaration(); call objc_is_id() instead of using IS_ID and IS_CLASS; Use objc_class_name instead of calling get_identifier("Class"); handle CONVERT_EXPRs in receiver. (build_objc_method_call, warn_with_method): Do not call groktypename(). (build_ivar_reference): Call convert() instead of clobbering in a type. (hash_init): Initialize string_htab hash table. (add_instance_variable): Simplify parameter list; do not call grokfield(); do not populate CLASS_IVARS list. (start_class): Check for the existence of super class, if one was specified. (continue_class): Use CLASS_RAW_IVARS rather than CLASS_IVARS; do not call build_class_template(); adjust call to get_class_ivars(); call build_decl(), pushdecl() and finish_decl() instead of define_decl(). (finish_class): Call build_decl(), pushdecl() and finish_decl() instead of define_decl(). (add_protocols): Use PROTOCOL_BINFO_ELTS for the tree vector size. (start_protocol): Do not call build_protocol_template(); use PROTOCOL_BINFO_ELTS for the tree vector size. (encode_type_qualifiers): Do not handle the 'const' qualifier here. (encode_pointer): Encode 'const char *' as 'r*', for backwards compatibility. (encode_array): Use HOST_WIDE_INT_PRINT_DEC instead of "%ld". (encode_type): Handle the 'const' qualifier here. (objc_parmlist): New global variable, sued by objc_push_parm and objc_get_parm_info(). (objc_push_parm, objc_get_parm_info): New functions. (objc_expr_last): Remove function. (synth_self_and_ucmd_args): For instance methods, use the instance type for 'self'; call objc_push_parm() instead of push_parm_decl(). (start_method_def): Do not call push_scope(), declare_parm_level(), pop_scope(), push_parm_decl(), store_parm_decls() or objc_expr_last(); just use objc_push_parm() and objc_get_parm_info(). (comp_method_with_proto): Remove function. (objc_types_are_equivalent): Strip away indirections before comparing underlying types. (comp_proto_with_proto): Do not call groktypename(); types are no longer in raw declspec format. (objc_start_function): New function. (really_start_method): Call comp_proto_with_proto() instead of comp_method_with_proto(); call objc_start_function() instead of hand-crafting a function declarator. (continue_method_def, objc_expand_function_end): Remove functions. (get_super_receiver): Call objc_get_current_scope() instead of get_current_scope(); reference 'super_class' field (instead of 'class'). (finish_method_def): Rename to objc_finish_method_definition() and add a function decl parameter; move method encoding call from objc_expand_function_end(). (is_complex_decl, adorn_decl, gen_declarator, gen_declspecs, gen_declaration_1): Remove functions. (tmpbuf, RAW_DECLSPEC): Remove. (gen_declaration): Remove second parameter; simplify to deal with TYPE_P nodes instead of raw declspecs. (gen_type_name, gen_type_name_0): New functions. (gen_method_decl): Remove second parameter; call gen_type_name() instead of gen_declaration_1(). (dump_interface): Adjust calls to gen_declaration() and gen_method_decl(); do not allocate a separate string buffer. (init_objc): Allocate a larger string buffer to accommodate dump_interface(); adjust call to build_module_descriptor(); add call to build_module_initializer_routine() for the GNU runtime. (generate_classref_translation_entry): Do not call start_decl(); call finish_var_decl() instead of finish_decl(); call convert() instead of build_c_cast(). * objc-act.h (CLASS_OWN_IVARS): Remove accessor. (CLASS_BINFO_ELTS): Reduce from 6 to 5, now that CLASS_OWN_IVARS is gone. (OCTI_GNU_INIT_DECL, GNU_INIT_decl): New. (OCTI_ELLIPSIS_NODE, objc_ellipsis_node): Remove. (OCTI_ID_ID, id_type, objc_id_id): Rename to OCTI_ID_NAME, objc_object_type and objc_object_name, respectively. (OCTI_CLS_REF, OCTI_CLASS_NAME, objc_class_reference, objc_class_name): New. (IS_CLASS): New macro. (IS_ID, IS_SUPER): Robustify. (OCTI_EXECCLASS_DECL, execclass_decl): New. (finish_file, start_class, continue_class, finish_class, start_method_def, continue_method_def, finish_method_def, start_protocol, finish_protocol, objc_build_throw_stmt, objc_build_try_catch_finally_stmt, objc_build_synchronized_prologue, objc_build_synchronized_epilogue, objc_build_try_prologue, objc_build_try_epilogue, objc_build_catch_stmt, objc_build_catch_epilogue, objc_build_finally_prologue, objc_build_finally_epilogue, is_ivar, is_private, is_public, add_instance_variable, objc_add_method, get_super_receiver, objc_clear_super_receiver, get_class_ivars_from_name, get_class_reference, get_static_reference, get_object_reference, build_message_expr, finish_message_expr, build_selector_expr, build_ivar_reference, build_keyword_decl, build_method_decl, build_protocol_expr, build_objc_string_object, objc_declare_alias, objc_declare_class, objc_declare_protocols, objc_comptypes, objc_check_decl, build_encode_expr): Remove prototypes. (imp_count, cat_count): Make GGC-aware. (OBJC_SET_TYPE_NAME): New macro. From-SVN: r87168
2004-09-08 02:49:44 +02:00
used for the NeXT runtime. */
static tree
setup_string_decl (void)
{
Makefile.in (c-parse.o): Depend on $(C_COMMON_H). [gcc/ChangeLog] 2004-09-07 Ziemowit Laski <zlaski@apple.com> * Makefile.in (c-parse.o): Depend on $(C_COMMON_H). * c-parse.in: Include c-common.h instead of objc-act.h. (ivar_decl_list, ivar_decls, ivar_decl, ivars, ivar_declarator, myparms, myparm): Remove %type declarations. (methodtype, optparms, OBJC_TYPE_QUAL, objc_quals, objc_qual, objc_typename, objc_try_catch_stmt, optellipsis): Add %type declarations. (objc_inherit_code, objc_public_flag): Remove. (typespec_nonreserved_nonattr): Call objc_get_protocol_qualified_type() instead of get_static_reference() and get_protocol_reference(). (stmt_nocomp): Call grokparm() on @catch parameter. (objcdef): Move semantic action to objc_finish_implementation(). (classdef): Move semantic action to objc_start_class_interface(), objc_continue_interface(), objc_finish_interface(), objc_start_class_implementation(), objc_continue_implementation(), objc_start_category_interface() and objc_start_category_implementation(). (protocoldef): Move semantic actions to objc_start_protocol() and objc_finish_interface(). (ivar_decl_list): Remove nonterminal. (visibility_spec): Move semantic actions to objc_set_visibility(). (ivar_decls): Remove assignment to $$. (ivar_decl): Rephrase in terms of component_decl; call objc_add_instance_variable(). (ivars, ivar_declarator): Remove nonterminals. (opt_semi): New nonterminal. (methodtype): Remove semantic actions. (methoddef): Move semantic actions to objc_set_method_type(), objc_start_method_definition() and objc_finish_method_definition(). (methodproto): Move semantic actions to objc_set_method_type() and objc_add_method_declaration(). (methoddecl): Use objc_typename instead of typename; move semantic actions to objc_build_method_signature(). (optarglist, myxdecls, mydecl, myparms, myparm): Remove nonterminals. (optparmlist): Express in terms of optparms and optellipsis. (optparms, optellipsis, objc_qual, objc_quals, objc_typename): New nonterminals. (keyworddecl): Use objc_typename instead of typename. (rid_to_yy): Mark RID_IN, RID_OUT, RID_INOUT, RID_BYCOPY, RID_BYREF and RID_ONEWAY as returning OBJC_TYPE_QUAL to yyparse(). [gcc/objc/ChangeLog] 2004-09-07 Ziemowit Laski <zlaski@apple.com> * Make-lang.in (objc/objc-parse.o): Depend on $(C_COMMON_H) instead of objc/objc-act.h. (objc/objc-act.o): Depend on $(HASHTAB_H). * objc-act.c: Include hashtab.h; in ObjC++ mode, include cp-tree.h and objcp-decl.h instead of c-tree.h. (build_module_descriptor, get_class_ivars, synth_id_with_class_suffix, error_with_ivar, gen_method_decl, gen_declaration, setup_string_decl, build_protocol_template): Adjust prototypes. (build_module_initializer_routine, start_class, continue_class, finish_class, start_method_def, objc_start_function, start_protocol, build_method_decl, objc_add_method, add_instance_variable, build_ivar_reference, is_ivar, is_private, get_super_receiver, build_selector_table_decl, objc_push_parm, objc_get_parm_info, gen_type_name, gen_type_name_0, start_var_decl, finish_var_decl, create_field_decl): New prototypes. (objc_expand_function_end, comp_method_with_proto, objc_expr_last, gen_declaration_1, gen_declarator, is_complex_decl, adorn_decl, define_decl, create_builtin_decl, gen_declspecs): Remove prototypes. (TYPE_ID): Rename to OBJECT_TYPEDEF_NAME. (CLASS_TYPEDEF_NAME): New. (TAG_EXECCLASS): Change from a global variable to a #define. (TAG_RETURN_STRUCT): Delete. (TAG_GNUINIT): New, holds '__objc_gnu_init' name. (objc_inherit_code, objc_public_flag): New, moved from c-parse.in. (string_descriptor): New struct. (string_htab): New hash table. (string_hash, string_eq): New prototypes. (generate_struct_by_value_array): Call create_field_decl() instead of create_builtin_decl(). (objc_init): Do not initialize objc_ellipsis_node or TAG_EXECCLASS; In ObjC++ mode, call cxx_init() instead of c_objc_common_init(). (objc_finish_file): In ObjC++, call instantiate_pending_templates() and cp_finish_file(). (define_decl, get_static_reference, get_protocol_reference, create_builtin_decl): Remove functions. (objc_start_class_interface, objc_start_category_interface, objc_start_protocol, objc_continue_interface, objc_finish_interface, objc_start_class_implementation, objc_start_category_implementation, objc_continue_implementation, objc_finish_implementation, objc_set_visibility, objc_set_method_type, objc_build_method_signature, objc_add_method_declaration, objc_start_method_definition, objc_add_instance_variable, objc_get_protocol_qualified_type, create_field_decl, start_var_decl, finish_var_decl): New functions. (setup_string_decl): Simplify since it is only called once. (synth_module_prologue): Call build_class_template(); predefine 'id' and 'Class' as typedefs; rename 'temp_type' to 'type'; disable debug hooks for duration of function; fix GNU runtime messenger signatures to correspond to reality; forward-declare '__objc_exec_class' for the GNU runtime; call build_selector_table_decl(); in ObjC++ mode, generate 'extern "C" { ... }' wrappers around synthesized declarations; call build_protocol_template() and build_category_template(). (string_hash, string_eq): New functions. (objc_build_string_object): Check metaclass correctness only once; store string literals in hash table. (objc_build_constructor): Do not convert initializer elements; adjust for ObjC++ impedance mismatch. (build_objc_symtab_template): Call create_field_decl() instead of create_builtin_decl(). (init_objc_symtab): Add missing conversion to initializer element. (build_metadata_decl): Call start_var_decl() instead of define_decl(). (generate_objc_symtab_decl): Do not call build_category_template(); call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(). (build_module_descriptor): Call create_field_decl() instead of grokfield(); call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(); always mark module descriptor as used; move GNU runtime-specific functionality to build_module_initializer_routine(). (build_module_initializer_routine): New function, broken off of build_module_descriptor(). (objc_static_init_needed_p, objc_generate_static_init_call): New functions. (generate_static_references, generate_strings, build_selector_translation_table, generate_descriptor_table, generate_ivars_list, generate_dispatch_table, generate_category): Call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(); build a type directly instead of via groktypename(). (build_selector_reference_decl, build_selector_table_decl, build_class_reference_decl, build_protocol_reference, generate_objc_image_info): Call start_var_decl() instead of build_decl(). (build_selector_reference): For GNU runtime, do not call build_selector_reference_decl(). (build_selector, build_typed_selector_reference): Always convert result to the selector type. (add_objc_string): Cast return value to 'char *'. (build_method_prototype_template, build_selector_template, build_method_template): Use actual selector type for fields pointing to selectors. (finish_objc): For GNU runtime, call build_module_initializer_routine() after build_module_descriptor(). (generate_protocol_list, generate_shared_structures): Call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(); build a type directly instead of via groktypename(). (synth_id_with_class_suffix): Return a string. (get_arg_type_list): For instance methods, use the instance type for 'self'; do not call groktypename_in_parm_context(). (build_objc_string_decl): Squash redeclaration errors in ObjC++. (objc_is_class_name): Use OBJC_TYPE_NAME instead of TYPE_NAME; handle RECORD_TYPEs in ObjC as well as ObjC++. (objc_is_id): New function. (objc_is_object_ptr): Return the canonical type node. (objc_get_class_ivars): Simplify using get_class_ivars(). (get_class_ivars): Remove second parameter; create a fresh copy of the ivar list for each call; do not check for existence of super class. (objc_eh_runtime_type): Mark #ifndef OBJCPLUS. (objc_init_exceptions): When using SJLJ-style exceptions, require the use of '-fobjc-exceptions' flag; do not require it for DWARF-style exceptions. (objc_build_exc_ptr, next_sjlj_build_try_catch_finally): Use objc_object_type instead of objc_id_type. (objc_begin_catch_clause): Convert the incoming PARM_DECL into a VAR_DECL before placing it in the appropriate scope; do not call define_decl(); adjust call to c_begin_compound_stmt(); use objc_object_type instead of objc_id_type. (build_next_objc_exception_stuff): Call create_field_decl() instead of create_builtin_decl(); construct type directly instead of calling groktypename(); use OBJC_VOID_AT_END to mark end of function parameters. (build_private_template): Adjust call to get_class_ivars(); build a type directly instead of via groktypename(). (build_protocol_template, build_method_prototype_list_template, build_method_prototype_template, build_category_template, build_selector_template, build_class_template, build_super_template, build_ivar_template, build_ivar_list_template, build_method_list_template, build_method_template): Call create_field_decl() instead of grokfield(). (objc_method_parm_type): Do not call groktypename(). (generate_descriptor_table): Call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(). (generate_method_descriptors, build_protocol_initializer, generate_dispatch_tables, build_category_initializer, build_shared_structure_initializer): Do not call groktypename(). (generate_protocols): Call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(); do not call groktypename(). (error_with_ivar): Remove last parameter. (check_ivars): Do not iterate ovar CLASS_RAW_IVARS lists in addition to CLASS_IVARS lists; adjust calls to error_with_ivar(). (generate_ivar_lists): Convert one of the initializer elements; do not call groktypename(). (get_arg_type_list, start_method_def, gen_method_def): Account for new representation of variable arguments and '...' in Objective-C methods; add Objective-C++ impedance matching code. (is_objc_type_qualifier): Remove function. (adjust_type_for_id_default): Simplify; there is no longer a need to wade through declspecs. (lookup_interface, start_class, continue_class, finish_class, start_method_def, start_protocol, build_method_decl, objc_add_method, add_instance_variable, build_ivar_reference, is_ivar, is_private, get_super_receiver, objc_build_finally_epilogue): Make into static functions. (receiver_is_class_object): Use new IS_CLASS() macro. (objc_build_message_expr): Tweak ObjC++ message argument handling; call objc_finish_message_expr() instead of finish_message_expr(). (finish_message_expr): Rename to objc_finish_message_expr(); use OBJC_TYPE_NAME and OBJC_SET_TYPE_NAME macros instead of TYPE_NAME. call gen_type_name() instead of gen_declaration(); call objc_is_id() instead of using IS_ID and IS_CLASS; Use objc_class_name instead of calling get_identifier("Class"); handle CONVERT_EXPRs in receiver. (build_objc_method_call, warn_with_method): Do not call groktypename(). (build_ivar_reference): Call convert() instead of clobbering in a type. (hash_init): Initialize string_htab hash table. (add_instance_variable): Simplify parameter list; do not call grokfield(); do not populate CLASS_IVARS list. (start_class): Check for the existence of super class, if one was specified. (continue_class): Use CLASS_RAW_IVARS rather than CLASS_IVARS; do not call build_class_template(); adjust call to get_class_ivars(); call build_decl(), pushdecl() and finish_decl() instead of define_decl(). (finish_class): Call build_decl(), pushdecl() and finish_decl() instead of define_decl(). (add_protocols): Use PROTOCOL_BINFO_ELTS for the tree vector size. (start_protocol): Do not call build_protocol_template(); use PROTOCOL_BINFO_ELTS for the tree vector size. (encode_type_qualifiers): Do not handle the 'const' qualifier here. (encode_pointer): Encode 'const char *' as 'r*', for backwards compatibility. (encode_array): Use HOST_WIDE_INT_PRINT_DEC instead of "%ld". (encode_type): Handle the 'const' qualifier here. (objc_parmlist): New global variable, sued by objc_push_parm and objc_get_parm_info(). (objc_push_parm, objc_get_parm_info): New functions. (objc_expr_last): Remove function. (synth_self_and_ucmd_args): For instance methods, use the instance type for 'self'; call objc_push_parm() instead of push_parm_decl(). (start_method_def): Do not call push_scope(), declare_parm_level(), pop_scope(), push_parm_decl(), store_parm_decls() or objc_expr_last(); just use objc_push_parm() and objc_get_parm_info(). (comp_method_with_proto): Remove function. (objc_types_are_equivalent): Strip away indirections before comparing underlying types. (comp_proto_with_proto): Do not call groktypename(); types are no longer in raw declspec format. (objc_start_function): New function. (really_start_method): Call comp_proto_with_proto() instead of comp_method_with_proto(); call objc_start_function() instead of hand-crafting a function declarator. (continue_method_def, objc_expand_function_end): Remove functions. (get_super_receiver): Call objc_get_current_scope() instead of get_current_scope(); reference 'super_class' field (instead of 'class'). (finish_method_def): Rename to objc_finish_method_definition() and add a function decl parameter; move method encoding call from objc_expand_function_end(). (is_complex_decl, adorn_decl, gen_declarator, gen_declspecs, gen_declaration_1): Remove functions. (tmpbuf, RAW_DECLSPEC): Remove. (gen_declaration): Remove second parameter; simplify to deal with TYPE_P nodes instead of raw declspecs. (gen_type_name, gen_type_name_0): New functions. (gen_method_decl): Remove second parameter; call gen_type_name() instead of gen_declaration_1(). (dump_interface): Adjust calls to gen_declaration() and gen_method_decl(); do not allocate a separate string buffer. (init_objc): Allocate a larger string buffer to accommodate dump_interface(); adjust call to build_module_descriptor(); add call to build_module_initializer_routine() for the GNU runtime. (generate_classref_translation_entry): Do not call start_decl(); call finish_var_decl() instead of finish_decl(); call convert() instead of build_c_cast(). * objc-act.h (CLASS_OWN_IVARS): Remove accessor. (CLASS_BINFO_ELTS): Reduce from 6 to 5, now that CLASS_OWN_IVARS is gone. (OCTI_GNU_INIT_DECL, GNU_INIT_decl): New. (OCTI_ELLIPSIS_NODE, objc_ellipsis_node): Remove. (OCTI_ID_ID, id_type, objc_id_id): Rename to OCTI_ID_NAME, objc_object_type and objc_object_name, respectively. (OCTI_CLS_REF, OCTI_CLASS_NAME, objc_class_reference, objc_class_name): New. (IS_CLASS): New macro. (IS_ID, IS_SUPER): Robustify. (OCTI_EXECCLASS_DECL, execclass_decl): New. (finish_file, start_class, continue_class, finish_class, start_method_def, continue_method_def, finish_method_def, start_protocol, finish_protocol, objc_build_throw_stmt, objc_build_try_catch_finally_stmt, objc_build_synchronized_prologue, objc_build_synchronized_epilogue, objc_build_try_prologue, objc_build_try_epilogue, objc_build_catch_stmt, objc_build_catch_epilogue, objc_build_finally_prologue, objc_build_finally_epilogue, is_ivar, is_private, is_public, add_instance_variable, objc_add_method, get_super_receiver, objc_clear_super_receiver, get_class_ivars_from_name, get_class_reference, get_static_reference, get_object_reference, build_message_expr, finish_message_expr, build_selector_expr, build_ivar_reference, build_keyword_decl, build_method_decl, build_protocol_expr, build_objc_string_object, objc_declare_alias, objc_declare_class, objc_declare_protocols, objc_comptypes, objc_check_decl, build_encode_expr): Remove prototypes. (imp_count, cat_count): Make GGC-aware. (OBJC_SET_TYPE_NAME): New macro. From-SVN: r87168
2004-09-08 02:49:44 +02:00
char *name;
size_t length;
/* %s in format will provide room for terminating null */
length = strlen (STRING_OBJECT_GLOBAL_FORMAT)
+ strlen (constant_string_class_name);
name = xmalloc (length);
sprintf (name, STRING_OBJECT_GLOBAL_FORMAT,
constant_string_class_name);
constant_string_global_id = get_identifier (name);
string_class_decl = lookup_name (constant_string_global_id);
return string_class_decl;
}
/* Purpose: "play" parser, creating/installing representations
of the declarations that are required by Objective-C.
Model:
type_spec--------->sc_spec
(tree_list) (tree_list)
| |
| |
identifier_node identifier_node */
1992-01-18 00:15:38 +01:00
static void
synth_module_prologue (void)
1992-01-18 00:15:38 +01:00
{
Makefile.in (c-parse.o): Depend on $(C_COMMON_H). [gcc/ChangeLog] 2004-09-07 Ziemowit Laski <zlaski@apple.com> * Makefile.in (c-parse.o): Depend on $(C_COMMON_H). * c-parse.in: Include c-common.h instead of objc-act.h. (ivar_decl_list, ivar_decls, ivar_decl, ivars, ivar_declarator, myparms, myparm): Remove %type declarations. (methodtype, optparms, OBJC_TYPE_QUAL, objc_quals, objc_qual, objc_typename, objc_try_catch_stmt, optellipsis): Add %type declarations. (objc_inherit_code, objc_public_flag): Remove. (typespec_nonreserved_nonattr): Call objc_get_protocol_qualified_type() instead of get_static_reference() and get_protocol_reference(). (stmt_nocomp): Call grokparm() on @catch parameter. (objcdef): Move semantic action to objc_finish_implementation(). (classdef): Move semantic action to objc_start_class_interface(), objc_continue_interface(), objc_finish_interface(), objc_start_class_implementation(), objc_continue_implementation(), objc_start_category_interface() and objc_start_category_implementation(). (protocoldef): Move semantic actions to objc_start_protocol() and objc_finish_interface(). (ivar_decl_list): Remove nonterminal. (visibility_spec): Move semantic actions to objc_set_visibility(). (ivar_decls): Remove assignment to $$. (ivar_decl): Rephrase in terms of component_decl; call objc_add_instance_variable(). (ivars, ivar_declarator): Remove nonterminals. (opt_semi): New nonterminal. (methodtype): Remove semantic actions. (methoddef): Move semantic actions to objc_set_method_type(), objc_start_method_definition() and objc_finish_method_definition(). (methodproto): Move semantic actions to objc_set_method_type() and objc_add_method_declaration(). (methoddecl): Use objc_typename instead of typename; move semantic actions to objc_build_method_signature(). (optarglist, myxdecls, mydecl, myparms, myparm): Remove nonterminals. (optparmlist): Express in terms of optparms and optellipsis. (optparms, optellipsis, objc_qual, objc_quals, objc_typename): New nonterminals. (keyworddecl): Use objc_typename instead of typename. (rid_to_yy): Mark RID_IN, RID_OUT, RID_INOUT, RID_BYCOPY, RID_BYREF and RID_ONEWAY as returning OBJC_TYPE_QUAL to yyparse(). [gcc/objc/ChangeLog] 2004-09-07 Ziemowit Laski <zlaski@apple.com> * Make-lang.in (objc/objc-parse.o): Depend on $(C_COMMON_H) instead of objc/objc-act.h. (objc/objc-act.o): Depend on $(HASHTAB_H). * objc-act.c: Include hashtab.h; in ObjC++ mode, include cp-tree.h and objcp-decl.h instead of c-tree.h. (build_module_descriptor, get_class_ivars, synth_id_with_class_suffix, error_with_ivar, gen_method_decl, gen_declaration, setup_string_decl, build_protocol_template): Adjust prototypes. (build_module_initializer_routine, start_class, continue_class, finish_class, start_method_def, objc_start_function, start_protocol, build_method_decl, objc_add_method, add_instance_variable, build_ivar_reference, is_ivar, is_private, get_super_receiver, build_selector_table_decl, objc_push_parm, objc_get_parm_info, gen_type_name, gen_type_name_0, start_var_decl, finish_var_decl, create_field_decl): New prototypes. (objc_expand_function_end, comp_method_with_proto, objc_expr_last, gen_declaration_1, gen_declarator, is_complex_decl, adorn_decl, define_decl, create_builtin_decl, gen_declspecs): Remove prototypes. (TYPE_ID): Rename to OBJECT_TYPEDEF_NAME. (CLASS_TYPEDEF_NAME): New. (TAG_EXECCLASS): Change from a global variable to a #define. (TAG_RETURN_STRUCT): Delete. (TAG_GNUINIT): New, holds '__objc_gnu_init' name. (objc_inherit_code, objc_public_flag): New, moved from c-parse.in. (string_descriptor): New struct. (string_htab): New hash table. (string_hash, string_eq): New prototypes. (generate_struct_by_value_array): Call create_field_decl() instead of create_builtin_decl(). (objc_init): Do not initialize objc_ellipsis_node or TAG_EXECCLASS; In ObjC++ mode, call cxx_init() instead of c_objc_common_init(). (objc_finish_file): In ObjC++, call instantiate_pending_templates() and cp_finish_file(). (define_decl, get_static_reference, get_protocol_reference, create_builtin_decl): Remove functions. (objc_start_class_interface, objc_start_category_interface, objc_start_protocol, objc_continue_interface, objc_finish_interface, objc_start_class_implementation, objc_start_category_implementation, objc_continue_implementation, objc_finish_implementation, objc_set_visibility, objc_set_method_type, objc_build_method_signature, objc_add_method_declaration, objc_start_method_definition, objc_add_instance_variable, objc_get_protocol_qualified_type, create_field_decl, start_var_decl, finish_var_decl): New functions. (setup_string_decl): Simplify since it is only called once. (synth_module_prologue): Call build_class_template(); predefine 'id' and 'Class' as typedefs; rename 'temp_type' to 'type'; disable debug hooks for duration of function; fix GNU runtime messenger signatures to correspond to reality; forward-declare '__objc_exec_class' for the GNU runtime; call build_selector_table_decl(); in ObjC++ mode, generate 'extern "C" { ... }' wrappers around synthesized declarations; call build_protocol_template() and build_category_template(). (string_hash, string_eq): New functions. (objc_build_string_object): Check metaclass correctness only once; store string literals in hash table. (objc_build_constructor): Do not convert initializer elements; adjust for ObjC++ impedance mismatch. (build_objc_symtab_template): Call create_field_decl() instead of create_builtin_decl(). (init_objc_symtab): Add missing conversion to initializer element. (build_metadata_decl): Call start_var_decl() instead of define_decl(). (generate_objc_symtab_decl): Do not call build_category_template(); call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(). (build_module_descriptor): Call create_field_decl() instead of grokfield(); call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(); always mark module descriptor as used; move GNU runtime-specific functionality to build_module_initializer_routine(). (build_module_initializer_routine): New function, broken off of build_module_descriptor(). (objc_static_init_needed_p, objc_generate_static_init_call): New functions. (generate_static_references, generate_strings, build_selector_translation_table, generate_descriptor_table, generate_ivars_list, generate_dispatch_table, generate_category): Call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(); build a type directly instead of via groktypename(). (build_selector_reference_decl, build_selector_table_decl, build_class_reference_decl, build_protocol_reference, generate_objc_image_info): Call start_var_decl() instead of build_decl(). (build_selector_reference): For GNU runtime, do not call build_selector_reference_decl(). (build_selector, build_typed_selector_reference): Always convert result to the selector type. (add_objc_string): Cast return value to 'char *'. (build_method_prototype_template, build_selector_template, build_method_template): Use actual selector type for fields pointing to selectors. (finish_objc): For GNU runtime, call build_module_initializer_routine() after build_module_descriptor(). (generate_protocol_list, generate_shared_structures): Call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(); build a type directly instead of via groktypename(). (synth_id_with_class_suffix): Return a string. (get_arg_type_list): For instance methods, use the instance type for 'self'; do not call groktypename_in_parm_context(). (build_objc_string_decl): Squash redeclaration errors in ObjC++. (objc_is_class_name): Use OBJC_TYPE_NAME instead of TYPE_NAME; handle RECORD_TYPEs in ObjC as well as ObjC++. (objc_is_id): New function. (objc_is_object_ptr): Return the canonical type node. (objc_get_class_ivars): Simplify using get_class_ivars(). (get_class_ivars): Remove second parameter; create a fresh copy of the ivar list for each call; do not check for existence of super class. (objc_eh_runtime_type): Mark #ifndef OBJCPLUS. (objc_init_exceptions): When using SJLJ-style exceptions, require the use of '-fobjc-exceptions' flag; do not require it for DWARF-style exceptions. (objc_build_exc_ptr, next_sjlj_build_try_catch_finally): Use objc_object_type instead of objc_id_type. (objc_begin_catch_clause): Convert the incoming PARM_DECL into a VAR_DECL before placing it in the appropriate scope; do not call define_decl(); adjust call to c_begin_compound_stmt(); use objc_object_type instead of objc_id_type. (build_next_objc_exception_stuff): Call create_field_decl() instead of create_builtin_decl(); construct type directly instead of calling groktypename(); use OBJC_VOID_AT_END to mark end of function parameters. (build_private_template): Adjust call to get_class_ivars(); build a type directly instead of via groktypename(). (build_protocol_template, build_method_prototype_list_template, build_method_prototype_template, build_category_template, build_selector_template, build_class_template, build_super_template, build_ivar_template, build_ivar_list_template, build_method_list_template, build_method_template): Call create_field_decl() instead of grokfield(). (objc_method_parm_type): Do not call groktypename(). (generate_descriptor_table): Call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(). (generate_method_descriptors, build_protocol_initializer, generate_dispatch_tables, build_category_initializer, build_shared_structure_initializer): Do not call groktypename(). (generate_protocols): Call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(); do not call groktypename(). (error_with_ivar): Remove last parameter. (check_ivars): Do not iterate ovar CLASS_RAW_IVARS lists in addition to CLASS_IVARS lists; adjust calls to error_with_ivar(). (generate_ivar_lists): Convert one of the initializer elements; do not call groktypename(). (get_arg_type_list, start_method_def, gen_method_def): Account for new representation of variable arguments and '...' in Objective-C methods; add Objective-C++ impedance matching code. (is_objc_type_qualifier): Remove function. (adjust_type_for_id_default): Simplify; there is no longer a need to wade through declspecs. (lookup_interface, start_class, continue_class, finish_class, start_method_def, start_protocol, build_method_decl, objc_add_method, add_instance_variable, build_ivar_reference, is_ivar, is_private, get_super_receiver, objc_build_finally_epilogue): Make into static functions. (receiver_is_class_object): Use new IS_CLASS() macro. (objc_build_message_expr): Tweak ObjC++ message argument handling; call objc_finish_message_expr() instead of finish_message_expr(). (finish_message_expr): Rename to objc_finish_message_expr(); use OBJC_TYPE_NAME and OBJC_SET_TYPE_NAME macros instead of TYPE_NAME. call gen_type_name() instead of gen_declaration(); call objc_is_id() instead of using IS_ID and IS_CLASS; Use objc_class_name instead of calling get_identifier("Class"); handle CONVERT_EXPRs in receiver. (build_objc_method_call, warn_with_method): Do not call groktypename(). (build_ivar_reference): Call convert() instead of clobbering in a type. (hash_init): Initialize string_htab hash table. (add_instance_variable): Simplify parameter list; do not call grokfield(); do not populate CLASS_IVARS list. (start_class): Check for the existence of super class, if one was specified. (continue_class): Use CLASS_RAW_IVARS rather than CLASS_IVARS; do not call build_class_template(); adjust call to get_class_ivars(); call build_decl(), pushdecl() and finish_decl() instead of define_decl(). (finish_class): Call build_decl(), pushdecl() and finish_decl() instead of define_decl(). (add_protocols): Use PROTOCOL_BINFO_ELTS for the tree vector size. (start_protocol): Do not call build_protocol_template(); use PROTOCOL_BINFO_ELTS for the tree vector size. (encode_type_qualifiers): Do not handle the 'const' qualifier here. (encode_pointer): Encode 'const char *' as 'r*', for backwards compatibility. (encode_array): Use HOST_WIDE_INT_PRINT_DEC instead of "%ld". (encode_type): Handle the 'const' qualifier here. (objc_parmlist): New global variable, sued by objc_push_parm and objc_get_parm_info(). (objc_push_parm, objc_get_parm_info): New functions. (objc_expr_last): Remove function. (synth_self_and_ucmd_args): For instance methods, use the instance type for 'self'; call objc_push_parm() instead of push_parm_decl(). (start_method_def): Do not call push_scope(), declare_parm_level(), pop_scope(), push_parm_decl(), store_parm_decls() or objc_expr_last(); just use objc_push_parm() and objc_get_parm_info(). (comp_method_with_proto): Remove function. (objc_types_are_equivalent): Strip away indirections before comparing underlying types. (comp_proto_with_proto): Do not call groktypename(); types are no longer in raw declspec format. (objc_start_function): New function. (really_start_method): Call comp_proto_with_proto() instead of comp_method_with_proto(); call objc_start_function() instead of hand-crafting a function declarator. (continue_method_def, objc_expand_function_end): Remove functions. (get_super_receiver): Call objc_get_current_scope() instead of get_current_scope(); reference 'super_class' field (instead of 'class'). (finish_method_def): Rename to objc_finish_method_definition() and add a function decl parameter; move method encoding call from objc_expand_function_end(). (is_complex_decl, adorn_decl, gen_declarator, gen_declspecs, gen_declaration_1): Remove functions. (tmpbuf, RAW_DECLSPEC): Remove. (gen_declaration): Remove second parameter; simplify to deal with TYPE_P nodes instead of raw declspecs. (gen_type_name, gen_type_name_0): New functions. (gen_method_decl): Remove second parameter; call gen_type_name() instead of gen_declaration_1(). (dump_interface): Adjust calls to gen_declaration() and gen_method_decl(); do not allocate a separate string buffer. (init_objc): Allocate a larger string buffer to accommodate dump_interface(); adjust call to build_module_descriptor(); add call to build_module_initializer_routine() for the GNU runtime. (generate_classref_translation_entry): Do not call start_decl(); call finish_var_decl() instead of finish_decl(); call convert() instead of build_c_cast(). * objc-act.h (CLASS_OWN_IVARS): Remove accessor. (CLASS_BINFO_ELTS): Reduce from 6 to 5, now that CLASS_OWN_IVARS is gone. (OCTI_GNU_INIT_DECL, GNU_INIT_decl): New. (OCTI_ELLIPSIS_NODE, objc_ellipsis_node): Remove. (OCTI_ID_ID, id_type, objc_id_id): Rename to OCTI_ID_NAME, objc_object_type and objc_object_name, respectively. (OCTI_CLS_REF, OCTI_CLASS_NAME, objc_class_reference, objc_class_name): New. (IS_CLASS): New macro. (IS_ID, IS_SUPER): Robustify. (OCTI_EXECCLASS_DECL, execclass_decl): New. (finish_file, start_class, continue_class, finish_class, start_method_def, continue_method_def, finish_method_def, start_protocol, finish_protocol, objc_build_throw_stmt, objc_build_try_catch_finally_stmt, objc_build_synchronized_prologue, objc_build_synchronized_epilogue, objc_build_try_prologue, objc_build_try_epilogue, objc_build_catch_stmt, objc_build_catch_epilogue, objc_build_finally_prologue, objc_build_finally_epilogue, is_ivar, is_private, is_public, add_instance_variable, objc_add_method, get_super_receiver, objc_clear_super_receiver, get_class_ivars_from_name, get_class_reference, get_static_reference, get_object_reference, build_message_expr, finish_message_expr, build_selector_expr, build_ivar_reference, build_keyword_decl, build_method_decl, build_protocol_expr, build_objc_string_object, objc_declare_alias, objc_declare_class, objc_declare_protocols, objc_comptypes, objc_check_decl, build_encode_expr): Remove prototypes. (imp_count, cat_count): Make GGC-aware. (OBJC_SET_TYPE_NAME): New macro. From-SVN: r87168
2004-09-08 02:49:44 +02:00
tree type;
enum debug_info_type save_write_symbols = write_symbols;
const struct gcc_debug_hooks *const save_hooks = debug_hooks;
/* Suppress outputting debug symbols, because
dbxout_init hasn'r been called yet. */
write_symbols = NO_DEBUG;
debug_hooks = &do_nothing_debug_hooks;
#ifdef OBJCPLUS
push_lang_context (lang_name_c); /* extern "C" */
#endif
/* The following are also defined in <objc/objc.h> and friends. */
1992-01-18 00:15:38 +01:00
objc_object_id = get_identifier (TAG_OBJECT);
Makefile.in (c-parse.o): Depend on $(C_COMMON_H). [gcc/ChangeLog] 2004-09-07 Ziemowit Laski <zlaski@apple.com> * Makefile.in (c-parse.o): Depend on $(C_COMMON_H). * c-parse.in: Include c-common.h instead of objc-act.h. (ivar_decl_list, ivar_decls, ivar_decl, ivars, ivar_declarator, myparms, myparm): Remove %type declarations. (methodtype, optparms, OBJC_TYPE_QUAL, objc_quals, objc_qual, objc_typename, objc_try_catch_stmt, optellipsis): Add %type declarations. (objc_inherit_code, objc_public_flag): Remove. (typespec_nonreserved_nonattr): Call objc_get_protocol_qualified_type() instead of get_static_reference() and get_protocol_reference(). (stmt_nocomp): Call grokparm() on @catch parameter. (objcdef): Move semantic action to objc_finish_implementation(). (classdef): Move semantic action to objc_start_class_interface(), objc_continue_interface(), objc_finish_interface(), objc_start_class_implementation(), objc_continue_implementation(), objc_start_category_interface() and objc_start_category_implementation(). (protocoldef): Move semantic actions to objc_start_protocol() and objc_finish_interface(). (ivar_decl_list): Remove nonterminal. (visibility_spec): Move semantic actions to objc_set_visibility(). (ivar_decls): Remove assignment to $$. (ivar_decl): Rephrase in terms of component_decl; call objc_add_instance_variable(). (ivars, ivar_declarator): Remove nonterminals. (opt_semi): New nonterminal. (methodtype): Remove semantic actions. (methoddef): Move semantic actions to objc_set_method_type(), objc_start_method_definition() and objc_finish_method_definition(). (methodproto): Move semantic actions to objc_set_method_type() and objc_add_method_declaration(). (methoddecl): Use objc_typename instead of typename; move semantic actions to objc_build_method_signature(). (optarglist, myxdecls, mydecl, myparms, myparm): Remove nonterminals. (optparmlist): Express in terms of optparms and optellipsis. (optparms, optellipsis, objc_qual, objc_quals, objc_typename): New nonterminals. (keyworddecl): Use objc_typename instead of typename. (rid_to_yy): Mark RID_IN, RID_OUT, RID_INOUT, RID_BYCOPY, RID_BYREF and RID_ONEWAY as returning OBJC_TYPE_QUAL to yyparse(). [gcc/objc/ChangeLog] 2004-09-07 Ziemowit Laski <zlaski@apple.com> * Make-lang.in (objc/objc-parse.o): Depend on $(C_COMMON_H) instead of objc/objc-act.h. (objc/objc-act.o): Depend on $(HASHTAB_H). * objc-act.c: Include hashtab.h; in ObjC++ mode, include cp-tree.h and objcp-decl.h instead of c-tree.h. (build_module_descriptor, get_class_ivars, synth_id_with_class_suffix, error_with_ivar, gen_method_decl, gen_declaration, setup_string_decl, build_protocol_template): Adjust prototypes. (build_module_initializer_routine, start_class, continue_class, finish_class, start_method_def, objc_start_function, start_protocol, build_method_decl, objc_add_method, add_instance_variable, build_ivar_reference, is_ivar, is_private, get_super_receiver, build_selector_table_decl, objc_push_parm, objc_get_parm_info, gen_type_name, gen_type_name_0, start_var_decl, finish_var_decl, create_field_decl): New prototypes. (objc_expand_function_end, comp_method_with_proto, objc_expr_last, gen_declaration_1, gen_declarator, is_complex_decl, adorn_decl, define_decl, create_builtin_decl, gen_declspecs): Remove prototypes. (TYPE_ID): Rename to OBJECT_TYPEDEF_NAME. (CLASS_TYPEDEF_NAME): New. (TAG_EXECCLASS): Change from a global variable to a #define. (TAG_RETURN_STRUCT): Delete. (TAG_GNUINIT): New, holds '__objc_gnu_init' name. (objc_inherit_code, objc_public_flag): New, moved from c-parse.in. (string_descriptor): New struct. (string_htab): New hash table. (string_hash, string_eq): New prototypes. (generate_struct_by_value_array): Call create_field_decl() instead of create_builtin_decl(). (objc_init): Do not initialize objc_ellipsis_node or TAG_EXECCLASS; In ObjC++ mode, call cxx_init() instead of c_objc_common_init(). (objc_finish_file): In ObjC++, call instantiate_pending_templates() and cp_finish_file(). (define_decl, get_static_reference, get_protocol_reference, create_builtin_decl): Remove functions. (objc_start_class_interface, objc_start_category_interface, objc_start_protocol, objc_continue_interface, objc_finish_interface, objc_start_class_implementation, objc_start_category_implementation, objc_continue_implementation, objc_finish_implementation, objc_set_visibility, objc_set_method_type, objc_build_method_signature, objc_add_method_declaration, objc_start_method_definition, objc_add_instance_variable, objc_get_protocol_qualified_type, create_field_decl, start_var_decl, finish_var_decl): New functions. (setup_string_decl): Simplify since it is only called once. (synth_module_prologue): Call build_class_template(); predefine 'id' and 'Class' as typedefs; rename 'temp_type' to 'type'; disable debug hooks for duration of function; fix GNU runtime messenger signatures to correspond to reality; forward-declare '__objc_exec_class' for the GNU runtime; call build_selector_table_decl(); in ObjC++ mode, generate 'extern "C" { ... }' wrappers around synthesized declarations; call build_protocol_template() and build_category_template(). (string_hash, string_eq): New functions. (objc_build_string_object): Check metaclass correctness only once; store string literals in hash table. (objc_build_constructor): Do not convert initializer elements; adjust for ObjC++ impedance mismatch. (build_objc_symtab_template): Call create_field_decl() instead of create_builtin_decl(). (init_objc_symtab): Add missing conversion to initializer element. (build_metadata_decl): Call start_var_decl() instead of define_decl(). (generate_objc_symtab_decl): Do not call build_category_template(); call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(). (build_module_descriptor): Call create_field_decl() instead of grokfield(); call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(); always mark module descriptor as used; move GNU runtime-specific functionality to build_module_initializer_routine(). (build_module_initializer_routine): New function, broken off of build_module_descriptor(). (objc_static_init_needed_p, objc_generate_static_init_call): New functions. (generate_static_references, generate_strings, build_selector_translation_table, generate_descriptor_table, generate_ivars_list, generate_dispatch_table, generate_category): Call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(); build a type directly instead of via groktypename(). (build_selector_reference_decl, build_selector_table_decl, build_class_reference_decl, build_protocol_reference, generate_objc_image_info): Call start_var_decl() instead of build_decl(). (build_selector_reference): For GNU runtime, do not call build_selector_reference_decl(). (build_selector, build_typed_selector_reference): Always convert result to the selector type. (add_objc_string): Cast return value to 'char *'. (build_method_prototype_template, build_selector_template, build_method_template): Use actual selector type for fields pointing to selectors. (finish_objc): For GNU runtime, call build_module_initializer_routine() after build_module_descriptor(). (generate_protocol_list, generate_shared_structures): Call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(); build a type directly instead of via groktypename(). (synth_id_with_class_suffix): Return a string. (get_arg_type_list): For instance methods, use the instance type for 'self'; do not call groktypename_in_parm_context(). (build_objc_string_decl): Squash redeclaration errors in ObjC++. (objc_is_class_name): Use OBJC_TYPE_NAME instead of TYPE_NAME; handle RECORD_TYPEs in ObjC as well as ObjC++. (objc_is_id): New function. (objc_is_object_ptr): Return the canonical type node. (objc_get_class_ivars): Simplify using get_class_ivars(). (get_class_ivars): Remove second parameter; create a fresh copy of the ivar list for each call; do not check for existence of super class. (objc_eh_runtime_type): Mark #ifndef OBJCPLUS. (objc_init_exceptions): When using SJLJ-style exceptions, require the use of '-fobjc-exceptions' flag; do not require it for DWARF-style exceptions. (objc_build_exc_ptr, next_sjlj_build_try_catch_finally): Use objc_object_type instead of objc_id_type. (objc_begin_catch_clause): Convert the incoming PARM_DECL into a VAR_DECL before placing it in the appropriate scope; do not call define_decl(); adjust call to c_begin_compound_stmt(); use objc_object_type instead of objc_id_type. (build_next_objc_exception_stuff): Call create_field_decl() instead of create_builtin_decl(); construct type directly instead of calling groktypename(); use OBJC_VOID_AT_END to mark end of function parameters. (build_private_template): Adjust call to get_class_ivars(); build a type directly instead of via groktypename(). (build_protocol_template, build_method_prototype_list_template, build_method_prototype_template, build_category_template, build_selector_template, build_class_template, build_super_template, build_ivar_template, build_ivar_list_template, build_method_list_template, build_method_template): Call create_field_decl() instead of grokfield(). (objc_method_parm_type): Do not call groktypename(). (generate_descriptor_table): Call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(). (generate_method_descriptors, build_protocol_initializer, generate_dispatch_tables, build_category_initializer, build_shared_structure_initializer): Do not call groktypename(). (generate_protocols): Call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(); do not call groktypename(). (error_with_ivar): Remove last parameter. (check_ivars): Do not iterate ovar CLASS_RAW_IVARS lists in addition to CLASS_IVARS lists; adjust calls to error_with_ivar(). (generate_ivar_lists): Convert one of the initializer elements; do not call groktypename(). (get_arg_type_list, start_method_def, gen_method_def): Account for new representation of variable arguments and '...' in Objective-C methods; add Objective-C++ impedance matching code. (is_objc_type_qualifier): Remove function. (adjust_type_for_id_default): Simplify; there is no longer a need to wade through declspecs. (lookup_interface, start_class, continue_class, finish_class, start_method_def, start_protocol, build_method_decl, objc_add_method, add_instance_variable, build_ivar_reference, is_ivar, is_private, get_super_receiver, objc_build_finally_epilogue): Make into static functions. (receiver_is_class_object): Use new IS_CLASS() macro. (objc_build_message_expr): Tweak ObjC++ message argument handling; call objc_finish_message_expr() instead of finish_message_expr(). (finish_message_expr): Rename to objc_finish_message_expr(); use OBJC_TYPE_NAME and OBJC_SET_TYPE_NAME macros instead of TYPE_NAME. call gen_type_name() instead of gen_declaration(); call objc_is_id() instead of using IS_ID and IS_CLASS; Use objc_class_name instead of calling get_identifier("Class"); handle CONVERT_EXPRs in receiver. (build_objc_method_call, warn_with_method): Do not call groktypename(). (build_ivar_reference): Call convert() instead of clobbering in a type. (hash_init): Initialize string_htab hash table. (add_instance_variable): Simplify parameter list; do not call grokfield(); do not populate CLASS_IVARS list. (start_class): Check for the existence of super class, if one was specified. (continue_class): Use CLASS_RAW_IVARS rather than CLASS_IVARS; do not call build_class_template(); adjust call to get_class_ivars(); call build_decl(), pushdecl() and finish_decl() instead of define_decl(). (finish_class): Call build_decl(), pushdecl() and finish_decl() instead of define_decl(). (add_protocols): Use PROTOCOL_BINFO_ELTS for the tree vector size. (start_protocol): Do not call build_protocol_template(); use PROTOCOL_BINFO_ELTS for the tree vector size. (encode_type_qualifiers): Do not handle the 'const' qualifier here. (encode_pointer): Encode 'const char *' as 'r*', for backwards compatibility. (encode_array): Use HOST_WIDE_INT_PRINT_DEC instead of "%ld". (encode_type): Handle the 'const' qualifier here. (objc_parmlist): New global variable, sued by objc_push_parm and objc_get_parm_info(). (objc_push_parm, objc_get_parm_info): New functions. (objc_expr_last): Remove function. (synth_self_and_ucmd_args): For instance methods, use the instance type for 'self'; call objc_push_parm() instead of push_parm_decl(). (start_method_def): Do not call push_scope(), declare_parm_level(), pop_scope(), push_parm_decl(), store_parm_decls() or objc_expr_last(); just use objc_push_parm() and objc_get_parm_info(). (comp_method_with_proto): Remove function. (objc_types_are_equivalent): Strip away indirections before comparing underlying types. (comp_proto_with_proto): Do not call groktypename(); types are no longer in raw declspec format. (objc_start_function): New function. (really_start_method): Call comp_proto_with_proto() instead of comp_method_with_proto(); call objc_start_function() instead of hand-crafting a function declarator. (continue_method_def, objc_expand_function_end): Remove functions. (get_super_receiver): Call objc_get_current_scope() instead of get_current_scope(); reference 'super_class' field (instead of 'class'). (finish_method_def): Rename to objc_finish_method_definition() and add a function decl parameter; move method encoding call from objc_expand_function_end(). (is_complex_decl, adorn_decl, gen_declarator, gen_declspecs, gen_declaration_1): Remove functions. (tmpbuf, RAW_DECLSPEC): Remove. (gen_declaration): Remove second parameter; simplify to deal with TYPE_P nodes instead of raw declspecs. (gen_type_name, gen_type_name_0): New functions. (gen_method_decl): Remove second parameter; call gen_type_name() instead of gen_declaration_1(). (dump_interface): Adjust calls to gen_declaration() and gen_method_decl(); do not allocate a separate string buffer. (init_objc): Allocate a larger string buffer to accommodate dump_interface(); adjust call to build_module_descriptor(); add call to build_module_initializer_routine() for the GNU runtime. (generate_classref_translation_entry): Do not call start_decl(); call finish_var_decl() instead of finish_decl(); call convert() instead of build_c_cast(). * objc-act.h (CLASS_OWN_IVARS): Remove accessor. (CLASS_BINFO_ELTS): Reduce from 6 to 5, now that CLASS_OWN_IVARS is gone. (OCTI_GNU_INIT_DECL, GNU_INIT_decl): New. (OCTI_ELLIPSIS_NODE, objc_ellipsis_node): Remove. (OCTI_ID_ID, id_type, objc_id_id): Rename to OCTI_ID_NAME, objc_object_type and objc_object_name, respectively. (OCTI_CLS_REF, OCTI_CLASS_NAME, objc_class_reference, objc_class_name): New. (IS_CLASS): New macro. (IS_ID, IS_SUPER): Robustify. (OCTI_EXECCLASS_DECL, execclass_decl): New. (finish_file, start_class, continue_class, finish_class, start_method_def, continue_method_def, finish_method_def, start_protocol, finish_protocol, objc_build_throw_stmt, objc_build_try_catch_finally_stmt, objc_build_synchronized_prologue, objc_build_synchronized_epilogue, objc_build_try_prologue, objc_build_try_epilogue, objc_build_catch_stmt, objc_build_catch_epilogue, objc_build_finally_prologue, objc_build_finally_epilogue, is_ivar, is_private, is_public, add_instance_variable, objc_add_method, get_super_receiver, objc_clear_super_receiver, get_class_ivars_from_name, get_class_reference, get_static_reference, get_object_reference, build_message_expr, finish_message_expr, build_selector_expr, build_ivar_reference, build_keyword_decl, build_method_decl, build_protocol_expr, build_objc_string_object, objc_declare_alias, objc_declare_class, objc_declare_protocols, objc_comptypes, objc_check_decl, build_encode_expr): Remove prototypes. (imp_count, cat_count): Make GGC-aware. (OBJC_SET_TYPE_NAME): New macro. From-SVN: r87168
2004-09-08 02:49:44 +02:00
objc_class_id = get_identifier (TAG_CLASS);
1992-01-18 00:15:38 +01:00
objc_object_reference = xref_tag (RECORD_TYPE, objc_object_id);
Makefile.in (c-parse.o): Depend on $(C_COMMON_H). [gcc/ChangeLog] 2004-09-07 Ziemowit Laski <zlaski@apple.com> * Makefile.in (c-parse.o): Depend on $(C_COMMON_H). * c-parse.in: Include c-common.h instead of objc-act.h. (ivar_decl_list, ivar_decls, ivar_decl, ivars, ivar_declarator, myparms, myparm): Remove %type declarations. (methodtype, optparms, OBJC_TYPE_QUAL, objc_quals, objc_qual, objc_typename, objc_try_catch_stmt, optellipsis): Add %type declarations. (objc_inherit_code, objc_public_flag): Remove. (typespec_nonreserved_nonattr): Call objc_get_protocol_qualified_type() instead of get_static_reference() and get_protocol_reference(). (stmt_nocomp): Call grokparm() on @catch parameter. (objcdef): Move semantic action to objc_finish_implementation(). (classdef): Move semantic action to objc_start_class_interface(), objc_continue_interface(), objc_finish_interface(), objc_start_class_implementation(), objc_continue_implementation(), objc_start_category_interface() and objc_start_category_implementation(). (protocoldef): Move semantic actions to objc_start_protocol() and objc_finish_interface(). (ivar_decl_list): Remove nonterminal. (visibility_spec): Move semantic actions to objc_set_visibility(). (ivar_decls): Remove assignment to $$. (ivar_decl): Rephrase in terms of component_decl; call objc_add_instance_variable(). (ivars, ivar_declarator): Remove nonterminals. (opt_semi): New nonterminal. (methodtype): Remove semantic actions. (methoddef): Move semantic actions to objc_set_method_type(), objc_start_method_definition() and objc_finish_method_definition(). (methodproto): Move semantic actions to objc_set_method_type() and objc_add_method_declaration(). (methoddecl): Use objc_typename instead of typename; move semantic actions to objc_build_method_signature(). (optarglist, myxdecls, mydecl, myparms, myparm): Remove nonterminals. (optparmlist): Express in terms of optparms and optellipsis. (optparms, optellipsis, objc_qual, objc_quals, objc_typename): New nonterminals. (keyworddecl): Use objc_typename instead of typename. (rid_to_yy): Mark RID_IN, RID_OUT, RID_INOUT, RID_BYCOPY, RID_BYREF and RID_ONEWAY as returning OBJC_TYPE_QUAL to yyparse(). [gcc/objc/ChangeLog] 2004-09-07 Ziemowit Laski <zlaski@apple.com> * Make-lang.in (objc/objc-parse.o): Depend on $(C_COMMON_H) instead of objc/objc-act.h. (objc/objc-act.o): Depend on $(HASHTAB_H). * objc-act.c: Include hashtab.h; in ObjC++ mode, include cp-tree.h and objcp-decl.h instead of c-tree.h. (build_module_descriptor, get_class_ivars, synth_id_with_class_suffix, error_with_ivar, gen_method_decl, gen_declaration, setup_string_decl, build_protocol_template): Adjust prototypes. (build_module_initializer_routine, start_class, continue_class, finish_class, start_method_def, objc_start_function, start_protocol, build_method_decl, objc_add_method, add_instance_variable, build_ivar_reference, is_ivar, is_private, get_super_receiver, build_selector_table_decl, objc_push_parm, objc_get_parm_info, gen_type_name, gen_type_name_0, start_var_decl, finish_var_decl, create_field_decl): New prototypes. (objc_expand_function_end, comp_method_with_proto, objc_expr_last, gen_declaration_1, gen_declarator, is_complex_decl, adorn_decl, define_decl, create_builtin_decl, gen_declspecs): Remove prototypes. (TYPE_ID): Rename to OBJECT_TYPEDEF_NAME. (CLASS_TYPEDEF_NAME): New. (TAG_EXECCLASS): Change from a global variable to a #define. (TAG_RETURN_STRUCT): Delete. (TAG_GNUINIT): New, holds '__objc_gnu_init' name. (objc_inherit_code, objc_public_flag): New, moved from c-parse.in. (string_descriptor): New struct. (string_htab): New hash table. (string_hash, string_eq): New prototypes. (generate_struct_by_value_array): Call create_field_decl() instead of create_builtin_decl(). (objc_init): Do not initialize objc_ellipsis_node or TAG_EXECCLASS; In ObjC++ mode, call cxx_init() instead of c_objc_common_init(). (objc_finish_file): In ObjC++, call instantiate_pending_templates() and cp_finish_file(). (define_decl, get_static_reference, get_protocol_reference, create_builtin_decl): Remove functions. (objc_start_class_interface, objc_start_category_interface, objc_start_protocol, objc_continue_interface, objc_finish_interface, objc_start_class_implementation, objc_start_category_implementation, objc_continue_implementation, objc_finish_implementation, objc_set_visibility, objc_set_method_type, objc_build_method_signature, objc_add_method_declaration, objc_start_method_definition, objc_add_instance_variable, objc_get_protocol_qualified_type, create_field_decl, start_var_decl, finish_var_decl): New functions. (setup_string_decl): Simplify since it is only called once. (synth_module_prologue): Call build_class_template(); predefine 'id' and 'Class' as typedefs; rename 'temp_type' to 'type'; disable debug hooks for duration of function; fix GNU runtime messenger signatures to correspond to reality; forward-declare '__objc_exec_class' for the GNU runtime; call build_selector_table_decl(); in ObjC++ mode, generate 'extern "C" { ... }' wrappers around synthesized declarations; call build_protocol_template() and build_category_template(). (string_hash, string_eq): New functions. (objc_build_string_object): Check metaclass correctness only once; store string literals in hash table. (objc_build_constructor): Do not convert initializer elements; adjust for ObjC++ impedance mismatch. (build_objc_symtab_template): Call create_field_decl() instead of create_builtin_decl(). (init_objc_symtab): Add missing conversion to initializer element. (build_metadata_decl): Call start_var_decl() instead of define_decl(). (generate_objc_symtab_decl): Do not call build_category_template(); call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(). (build_module_descriptor): Call create_field_decl() instead of grokfield(); call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(); always mark module descriptor as used; move GNU runtime-specific functionality to build_module_initializer_routine(). (build_module_initializer_routine): New function, broken off of build_module_descriptor(). (objc_static_init_needed_p, objc_generate_static_init_call): New functions. (generate_static_references, generate_strings, build_selector_translation_table, generate_descriptor_table, generate_ivars_list, generate_dispatch_table, generate_category): Call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(); build a type directly instead of via groktypename(). (build_selector_reference_decl, build_selector_table_decl, build_class_reference_decl, build_protocol_reference, generate_objc_image_info): Call start_var_decl() instead of build_decl(). (build_selector_reference): For GNU runtime, do not call build_selector_reference_decl(). (build_selector, build_typed_selector_reference): Always convert result to the selector type. (add_objc_string): Cast return value to 'char *'. (build_method_prototype_template, build_selector_template, build_method_template): Use actual selector type for fields pointing to selectors. (finish_objc): For GNU runtime, call build_module_initializer_routine() after build_module_descriptor(). (generate_protocol_list, generate_shared_structures): Call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(); build a type directly instead of via groktypename(). (synth_id_with_class_suffix): Return a string. (get_arg_type_list): For instance methods, use the instance type for 'self'; do not call groktypename_in_parm_context(). (build_objc_string_decl): Squash redeclaration errors in ObjC++. (objc_is_class_name): Use OBJC_TYPE_NAME instead of TYPE_NAME; handle RECORD_TYPEs in ObjC as well as ObjC++. (objc_is_id): New function. (objc_is_object_ptr): Return the canonical type node. (objc_get_class_ivars): Simplify using get_class_ivars(). (get_class_ivars): Remove second parameter; create a fresh copy of the ivar list for each call; do not check for existence of super class. (objc_eh_runtime_type): Mark #ifndef OBJCPLUS. (objc_init_exceptions): When using SJLJ-style exceptions, require the use of '-fobjc-exceptions' flag; do not require it for DWARF-style exceptions. (objc_build_exc_ptr, next_sjlj_build_try_catch_finally): Use objc_object_type instead of objc_id_type. (objc_begin_catch_clause): Convert the incoming PARM_DECL into a VAR_DECL before placing it in the appropriate scope; do not call define_decl(); adjust call to c_begin_compound_stmt(); use objc_object_type instead of objc_id_type. (build_next_objc_exception_stuff): Call create_field_decl() instead of create_builtin_decl(); construct type directly instead of calling groktypename(); use OBJC_VOID_AT_END to mark end of function parameters. (build_private_template): Adjust call to get_class_ivars(); build a type directly instead of via groktypename(). (build_protocol_template, build_method_prototype_list_template, build_method_prototype_template, build_category_template, build_selector_template, build_class_template, build_super_template, build_ivar_template, build_ivar_list_template, build_method_list_template, build_method_template): Call create_field_decl() instead of grokfield(). (objc_method_parm_type): Do not call groktypename(). (generate_descriptor_table): Call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(). (generate_method_descriptors, build_protocol_initializer, generate_dispatch_tables, build_category_initializer, build_shared_structure_initializer): Do not call groktypename(). (generate_protocols): Call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(); do not call groktypename(). (error_with_ivar): Remove last parameter. (check_ivars): Do not iterate ovar CLASS_RAW_IVARS lists in addition to CLASS_IVARS lists; adjust calls to error_with_ivar(). (generate_ivar_lists): Convert one of the initializer elements; do not call groktypename(). (get_arg_type_list, start_method_def, gen_method_def): Account for new representation of variable arguments and '...' in Objective-C methods; add Objective-C++ impedance matching code. (is_objc_type_qualifier): Remove function. (adjust_type_for_id_default): Simplify; there is no longer a need to wade through declspecs. (lookup_interface, start_class, continue_class, finish_class, start_method_def, start_protocol, build_method_decl, objc_add_method, add_instance_variable, build_ivar_reference, is_ivar, is_private, get_super_receiver, objc_build_finally_epilogue): Make into static functions. (receiver_is_class_object): Use new IS_CLASS() macro. (objc_build_message_expr): Tweak ObjC++ message argument handling; call objc_finish_message_expr() instead of finish_message_expr(). (finish_message_expr): Rename to objc_finish_message_expr(); use OBJC_TYPE_NAME and OBJC_SET_TYPE_NAME macros instead of TYPE_NAME. call gen_type_name() instead of gen_declaration(); call objc_is_id() instead of using IS_ID and IS_CLASS; Use objc_class_name instead of calling get_identifier("Class"); handle CONVERT_EXPRs in receiver. (build_objc_method_call, warn_with_method): Do not call groktypename(). (build_ivar_reference): Call convert() instead of clobbering in a type. (hash_init): Initialize string_htab hash table. (add_instance_variable): Simplify parameter list; do not call grokfield(); do not populate CLASS_IVARS list. (start_class): Check for the existence of super class, if one was specified. (continue_class): Use CLASS_RAW_IVARS rather than CLASS_IVARS; do not call build_class_template(); adjust call to get_class_ivars(); call build_decl(), pushdecl() and finish_decl() instead of define_decl(). (finish_class): Call build_decl(), pushdecl() and finish_decl() instead of define_decl(). (add_protocols): Use PROTOCOL_BINFO_ELTS for the tree vector size. (start_protocol): Do not call build_protocol_template(); use PROTOCOL_BINFO_ELTS for the tree vector size. (encode_type_qualifiers): Do not handle the 'const' qualifier here. (encode_pointer): Encode 'const char *' as 'r*', for backwards compatibility. (encode_array): Use HOST_WIDE_INT_PRINT_DEC instead of "%ld". (encode_type): Handle the 'const' qualifier here. (objc_parmlist): New global variable, sued by objc_push_parm and objc_get_parm_info(). (objc_push_parm, objc_get_parm_info): New functions. (objc_expr_last): Remove function. (synth_self_and_ucmd_args): For instance methods, use the instance type for 'self'; call objc_push_parm() instead of push_parm_decl(). (start_method_def): Do not call push_scope(), declare_parm_level(), pop_scope(), push_parm_decl(), store_parm_decls() or objc_expr_last(); just use objc_push_parm() and objc_get_parm_info(). (comp_method_with_proto): Remove function. (objc_types_are_equivalent): Strip away indirections before comparing underlying types. (comp_proto_with_proto): Do not call groktypename(); types are no longer in raw declspec format. (objc_start_function): New function. (really_start_method): Call comp_proto_with_proto() instead of comp_method_with_proto(); call objc_start_function() instead of hand-crafting a function declarator. (continue_method_def, objc_expand_function_end): Remove functions. (get_super_receiver): Call objc_get_current_scope() instead of get_current_scope(); reference 'super_class' field (instead of 'class'). (finish_method_def): Rename to objc_finish_method_definition() and add a function decl parameter; move method encoding call from objc_expand_function_end(). (is_complex_decl, adorn_decl, gen_declarator, gen_declspecs, gen_declaration_1): Remove functions. (tmpbuf, RAW_DECLSPEC): Remove. (gen_declaration): Remove second parameter; simplify to deal with TYPE_P nodes instead of raw declspecs. (gen_type_name, gen_type_name_0): New functions. (gen_method_decl): Remove second parameter; call gen_type_name() instead of gen_declaration_1(). (dump_interface): Adjust calls to gen_declaration() and gen_method_decl(); do not allocate a separate string buffer. (init_objc): Allocate a larger string buffer to accommodate dump_interface(); adjust call to build_module_descriptor(); add call to build_module_initializer_routine() for the GNU runtime. (generate_classref_translation_entry): Do not call start_decl(); call finish_var_decl() instead of finish_decl(); call convert() instead of build_c_cast(). * objc-act.h (CLASS_OWN_IVARS): Remove accessor. (CLASS_BINFO_ELTS): Reduce from 6 to 5, now that CLASS_OWN_IVARS is gone. (OCTI_GNU_INIT_DECL, GNU_INIT_decl): New. (OCTI_ELLIPSIS_NODE, objc_ellipsis_node): Remove. (OCTI_ID_ID, id_type, objc_id_id): Rename to OCTI_ID_NAME, objc_object_type and objc_object_name, respectively. (OCTI_CLS_REF, OCTI_CLASS_NAME, objc_class_reference, objc_class_name): New. (IS_CLASS): New macro. (IS_ID, IS_SUPER): Robustify. (OCTI_EXECCLASS_DECL, execclass_decl): New. (finish_file, start_class, continue_class, finish_class, start_method_def, continue_method_def, finish_method_def, start_protocol, finish_protocol, objc_build_throw_stmt, objc_build_try_catch_finally_stmt, objc_build_synchronized_prologue, objc_build_synchronized_epilogue, objc_build_try_prologue, objc_build_try_epilogue, objc_build_catch_stmt, objc_build_catch_epilogue, objc_build_finally_prologue, objc_build_finally_epilogue, is_ivar, is_private, is_public, add_instance_variable, objc_add_method, get_super_receiver, objc_clear_super_receiver, get_class_ivars_from_name, get_class_reference, get_static_reference, get_object_reference, build_message_expr, finish_message_expr, build_selector_expr, build_ivar_reference, build_keyword_decl, build_method_decl, build_protocol_expr, build_objc_string_object, objc_declare_alias, objc_declare_class, objc_declare_protocols, objc_comptypes, objc_check_decl, build_encode_expr): Remove prototypes. (imp_count, cat_count): Make GGC-aware. (OBJC_SET_TYPE_NAME): New macro. From-SVN: r87168
2004-09-08 02:49:44 +02:00
objc_class_reference = xref_tag (RECORD_TYPE, objc_class_id);
Makefile.in (c-parse.o): Depend on $(C_COMMON_H). [gcc/ChangeLog] 2004-09-07 Ziemowit Laski <zlaski@apple.com> * Makefile.in (c-parse.o): Depend on $(C_COMMON_H). * c-parse.in: Include c-common.h instead of objc-act.h. (ivar_decl_list, ivar_decls, ivar_decl, ivars, ivar_declarator, myparms, myparm): Remove %type declarations. (methodtype, optparms, OBJC_TYPE_QUAL, objc_quals, objc_qual, objc_typename, objc_try_catch_stmt, optellipsis): Add %type declarations. (objc_inherit_code, objc_public_flag): Remove. (typespec_nonreserved_nonattr): Call objc_get_protocol_qualified_type() instead of get_static_reference() and get_protocol_reference(). (stmt_nocomp): Call grokparm() on @catch parameter. (objcdef): Move semantic action to objc_finish_implementation(). (classdef): Move semantic action to objc_start_class_interface(), objc_continue_interface(), objc_finish_interface(), objc_start_class_implementation(), objc_continue_implementation(), objc_start_category_interface() and objc_start_category_implementation(). (protocoldef): Move semantic actions to objc_start_protocol() and objc_finish_interface(). (ivar_decl_list): Remove nonterminal. (visibility_spec): Move semantic actions to objc_set_visibility(). (ivar_decls): Remove assignment to $$. (ivar_decl): Rephrase in terms of component_decl; call objc_add_instance_variable(). (ivars, ivar_declarator): Remove nonterminals. (opt_semi): New nonterminal. (methodtype): Remove semantic actions. (methoddef): Move semantic actions to objc_set_method_type(), objc_start_method_definition() and objc_finish_method_definition(). (methodproto): Move semantic actions to objc_set_method_type() and objc_add_method_declaration(). (methoddecl): Use objc_typename instead of typename; move semantic actions to objc_build_method_signature(). (optarglist, myxdecls, mydecl, myparms, myparm): Remove nonterminals. (optparmlist): Express in terms of optparms and optellipsis. (optparms, optellipsis, objc_qual, objc_quals, objc_typename): New nonterminals. (keyworddecl): Use objc_typename instead of typename. (rid_to_yy): Mark RID_IN, RID_OUT, RID_INOUT, RID_BYCOPY, RID_BYREF and RID_ONEWAY as returning OBJC_TYPE_QUAL to yyparse(). [gcc/objc/ChangeLog] 2004-09-07 Ziemowit Laski <zlaski@apple.com> * Make-lang.in (objc/objc-parse.o): Depend on $(C_COMMON_H) instead of objc/objc-act.h. (objc/objc-act.o): Depend on $(HASHTAB_H). * objc-act.c: Include hashtab.h; in ObjC++ mode, include cp-tree.h and objcp-decl.h instead of c-tree.h. (build_module_descriptor, get_class_ivars, synth_id_with_class_suffix, error_with_ivar, gen_method_decl, gen_declaration, setup_string_decl, build_protocol_template): Adjust prototypes. (build_module_initializer_routine, start_class, continue_class, finish_class, start_method_def, objc_start_function, start_protocol, build_method_decl, objc_add_method, add_instance_variable, build_ivar_reference, is_ivar, is_private, get_super_receiver, build_selector_table_decl, objc_push_parm, objc_get_parm_info, gen_type_name, gen_type_name_0, start_var_decl, finish_var_decl, create_field_decl): New prototypes. (objc_expand_function_end, comp_method_with_proto, objc_expr_last, gen_declaration_1, gen_declarator, is_complex_decl, adorn_decl, define_decl, create_builtin_decl, gen_declspecs): Remove prototypes. (TYPE_ID): Rename to OBJECT_TYPEDEF_NAME. (CLASS_TYPEDEF_NAME): New. (TAG_EXECCLASS): Change from a global variable to a #define. (TAG_RETURN_STRUCT): Delete. (TAG_GNUINIT): New, holds '__objc_gnu_init' name. (objc_inherit_code, objc_public_flag): New, moved from c-parse.in. (string_descriptor): New struct. (string_htab): New hash table. (string_hash, string_eq): New prototypes. (generate_struct_by_value_array): Call create_field_decl() instead of create_builtin_decl(). (objc_init): Do not initialize objc_ellipsis_node or TAG_EXECCLASS; In ObjC++ mode, call cxx_init() instead of c_objc_common_init(). (objc_finish_file): In ObjC++, call instantiate_pending_templates() and cp_finish_file(). (define_decl, get_static_reference, get_protocol_reference, create_builtin_decl): Remove functions. (objc_start_class_interface, objc_start_category_interface, objc_start_protocol, objc_continue_interface, objc_finish_interface, objc_start_class_implementation, objc_start_category_implementation, objc_continue_implementation, objc_finish_implementation, objc_set_visibility, objc_set_method_type, objc_build_method_signature, objc_add_method_declaration, objc_start_method_definition, objc_add_instance_variable, objc_get_protocol_qualified_type, create_field_decl, start_var_decl, finish_var_decl): New functions. (setup_string_decl): Simplify since it is only called once. (synth_module_prologue): Call build_class_template(); predefine 'id' and 'Class' as typedefs; rename 'temp_type' to 'type'; disable debug hooks for duration of function; fix GNU runtime messenger signatures to correspond to reality; forward-declare '__objc_exec_class' for the GNU runtime; call build_selector_table_decl(); in ObjC++ mode, generate 'extern "C" { ... }' wrappers around synthesized declarations; call build_protocol_template() and build_category_template(). (string_hash, string_eq): New functions. (objc_build_string_object): Check metaclass correctness only once; store string literals in hash table. (objc_build_constructor): Do not convert initializer elements; adjust for ObjC++ impedance mismatch. (build_objc_symtab_template): Call create_field_decl() instead of create_builtin_decl(). (init_objc_symtab): Add missing conversion to initializer element. (build_metadata_decl): Call start_var_decl() instead of define_decl(). (generate_objc_symtab_decl): Do not call build_category_template(); call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(). (build_module_descriptor): Call create_field_decl() instead of grokfield(); call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(); always mark module descriptor as used; move GNU runtime-specific functionality to build_module_initializer_routine(). (build_module_initializer_routine): New function, broken off of build_module_descriptor(). (objc_static_init_needed_p, objc_generate_static_init_call): New functions. (generate_static_references, generate_strings, build_selector_translation_table, generate_descriptor_table, generate_ivars_list, generate_dispatch_table, generate_category): Call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(); build a type directly instead of via groktypename(). (build_selector_reference_decl, build_selector_table_decl, build_class_reference_decl, build_protocol_reference, generate_objc_image_info): Call start_var_decl() instead of build_decl(). (build_selector_reference): For GNU runtime, do not call build_selector_reference_decl(). (build_selector, build_typed_selector_reference): Always convert result to the selector type. (add_objc_string): Cast return value to 'char *'. (build_method_prototype_template, build_selector_template, build_method_template): Use actual selector type for fields pointing to selectors. (finish_objc): For GNU runtime, call build_module_initializer_routine() after build_module_descriptor(). (generate_protocol_list, generate_shared_structures): Call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(); build a type directly instead of via groktypename(). (synth_id_with_class_suffix): Return a string. (get_arg_type_list): For instance methods, use the instance type for 'self'; do not call groktypename_in_parm_context(). (build_objc_string_decl): Squash redeclaration errors in ObjC++. (objc_is_class_name): Use OBJC_TYPE_NAME instead of TYPE_NAME; handle RECORD_TYPEs in ObjC as well as ObjC++. (objc_is_id): New function. (objc_is_object_ptr): Return the canonical type node. (objc_get_class_ivars): Simplify using get_class_ivars(). (get_class_ivars): Remove second parameter; create a fresh copy of the ivar list for each call; do not check for existence of super class. (objc_eh_runtime_type): Mark #ifndef OBJCPLUS. (objc_init_exceptions): When using SJLJ-style exceptions, require the use of '-fobjc-exceptions' flag; do not require it for DWARF-style exceptions. (objc_build_exc_ptr, next_sjlj_build_try_catch_finally): Use objc_object_type instead of objc_id_type. (objc_begin_catch_clause): Convert the incoming PARM_DECL into a VAR_DECL before placing it in the appropriate scope; do not call define_decl(); adjust call to c_begin_compound_stmt(); use objc_object_type instead of objc_id_type. (build_next_objc_exception_stuff): Call create_field_decl() instead of create_builtin_decl(); construct type directly instead of calling groktypename(); use OBJC_VOID_AT_END to mark end of function parameters. (build_private_template): Adjust call to get_class_ivars(); build a type directly instead of via groktypename(). (build_protocol_template, build_method_prototype_list_template, build_method_prototype_template, build_category_template, build_selector_template, build_class_template, build_super_template, build_ivar_template, build_ivar_list_template, build_method_list_template, build_method_template): Call create_field_decl() instead of grokfield(). (objc_method_parm_type): Do not call groktypename(). (generate_descriptor_table): Call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(). (generate_method_descriptors, build_protocol_initializer, generate_dispatch_tables, build_category_initializer, build_shared_structure_initializer): Do not call groktypename(). (generate_protocols): Call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(); do not call groktypename(). (error_with_ivar): Remove last parameter. (check_ivars): Do not iterate ovar CLASS_RAW_IVARS lists in addition to CLASS_IVARS lists; adjust calls to error_with_ivar(). (generate_ivar_lists): Convert one of the initializer elements; do not call groktypename(). (get_arg_type_list, start_method_def, gen_method_def): Account for new representation of variable arguments and '...' in Objective-C methods; add Objective-C++ impedance matching code. (is_objc_type_qualifier): Remove function. (adjust_type_for_id_default): Simplify; there is no longer a need to wade through declspecs. (lookup_interface, start_class, continue_class, finish_class, start_method_def, start_protocol, build_method_decl, objc_add_method, add_instance_variable, build_ivar_reference, is_ivar, is_private, get_super_receiver, objc_build_finally_epilogue): Make into static functions. (receiver_is_class_object): Use new IS_CLASS() macro. (objc_build_message_expr): Tweak ObjC++ message argument handling; call objc_finish_message_expr() instead of finish_message_expr(). (finish_message_expr): Rename to objc_finish_message_expr(); use OBJC_TYPE_NAME and OBJC_SET_TYPE_NAME macros instead of TYPE_NAME. call gen_type_name() instead of gen_declaration(); call objc_is_id() instead of using IS_ID and IS_CLASS; Use objc_class_name instead of calling get_identifier("Class"); handle CONVERT_EXPRs in receiver. (build_objc_method_call, warn_with_method): Do not call groktypename(). (build_ivar_reference): Call convert() instead of clobbering in a type. (hash_init): Initialize string_htab hash table. (add_instance_variable): Simplify parameter list; do not call grokfield(); do not populate CLASS_IVARS list. (start_class): Check for the existence of super class, if one was specified. (continue_class): Use CLASS_RAW_IVARS rather than CLASS_IVARS; do not call build_class_template(); adjust call to get_class_ivars(); call build_decl(), pushdecl() and finish_decl() instead of define_decl(). (finish_class): Call build_decl(), pushdecl() and finish_decl() instead of define_decl(). (add_protocols): Use PROTOCOL_BINFO_ELTS for the tree vector size. (start_protocol): Do not call build_protocol_template(); use PROTOCOL_BINFO_ELTS for the tree vector size. (encode_type_qualifiers): Do not handle the 'const' qualifier here. (encode_pointer): Encode 'const char *' as 'r*', for backwards compatibility. (encode_array): Use HOST_WIDE_INT_PRINT_DEC instead of "%ld". (encode_type): Handle the 'const' qualifier here. (objc_parmlist): New global variable, sued by objc_push_parm and objc_get_parm_info(). (objc_push_parm, objc_get_parm_info): New functions. (objc_expr_last): Remove function. (synth_self_and_ucmd_args): For instance methods, use the instance type for 'self'; call objc_push_parm() instead of push_parm_decl(). (start_method_def): Do not call push_scope(), declare_parm_level(), pop_scope(), push_parm_decl(), store_parm_decls() or objc_expr_last(); just use objc_push_parm() and objc_get_parm_info(). (comp_method_with_proto): Remove function. (objc_types_are_equivalent): Strip away indirections before comparing underlying types. (comp_proto_with_proto): Do not call groktypename(); types are no longer in raw declspec format. (objc_start_function): New function. (really_start_method): Call comp_proto_with_proto() instead of comp_method_with_proto(); call objc_start_function() instead of hand-crafting a function declarator. (continue_method_def, objc_expand_function_end): Remove functions. (get_super_receiver): Call objc_get_current_scope() instead of get_current_scope(); reference 'super_class' field (instead of 'class'). (finish_method_def): Rename to objc_finish_method_definition() and add a function decl parameter; move method encoding call from objc_expand_function_end(). (is_complex_decl, adorn_decl, gen_declarator, gen_declspecs, gen_declaration_1): Remove functions. (tmpbuf, RAW_DECLSPEC): Remove. (gen_declaration): Remove second parameter; simplify to deal with TYPE_P nodes instead of raw declspecs. (gen_type_name, gen_type_name_0): New functions. (gen_method_decl): Remove second parameter; call gen_type_name() instead of gen_declaration_1(). (dump_interface): Adjust calls to gen_declaration() and gen_method_decl(); do not allocate a separate string buffer. (init_objc): Allocate a larger string buffer to accommodate dump_interface(); adjust call to build_module_descriptor(); add call to build_module_initializer_routine() for the GNU runtime. (generate_classref_translation_entry): Do not call start_decl(); call finish_var_decl() instead of finish_decl(); call convert() instead of build_c_cast(). * objc-act.h (CLASS_OWN_IVARS): Remove accessor. (CLASS_BINFO_ELTS): Reduce from 6 to 5, now that CLASS_OWN_IVARS is gone. (OCTI_GNU_INIT_DECL, GNU_INIT_decl): New. (OCTI_ELLIPSIS_NODE, objc_ellipsis_node): Remove. (OCTI_ID_ID, id_type, objc_id_id): Rename to OCTI_ID_NAME, objc_object_type and objc_object_name, respectively. (OCTI_CLS_REF, OCTI_CLASS_NAME, objc_class_reference, objc_class_name): New. (IS_CLASS): New macro. (IS_ID, IS_SUPER): Robustify. (OCTI_EXECCLASS_DECL, execclass_decl): New. (finish_file, start_class, continue_class, finish_class, start_method_def, continue_method_def, finish_method_def, start_protocol, finish_protocol, objc_build_throw_stmt, objc_build_try_catch_finally_stmt, objc_build_synchronized_prologue, objc_build_synchronized_epilogue, objc_build_try_prologue, objc_build_try_epilogue, objc_build_catch_stmt, objc_build_catch_epilogue, objc_build_finally_prologue, objc_build_finally_epilogue, is_ivar, is_private, is_public, add_instance_variable, objc_add_method, get_super_receiver, objc_clear_super_receiver, get_class_ivars_from_name, get_class_reference, get_static_reference, get_object_reference, build_message_expr, finish_message_expr, build_selector_expr, build_ivar_reference, build_keyword_decl, build_method_decl, build_protocol_expr, build_objc_string_object, objc_declare_alias, objc_declare_class, objc_declare_protocols, objc_comptypes, objc_check_decl, build_encode_expr): Remove prototypes. (imp_count, cat_count): Make GGC-aware. (OBJC_SET_TYPE_NAME): New macro. From-SVN: r87168
2004-09-08 02:49:44 +02:00
objc_object_type = build_pointer_type (objc_object_reference);
objc_class_type = build_pointer_type (objc_class_reference);
1992-01-18 00:15:38 +01:00
Makefile.in (c-parse.o): Depend on $(C_COMMON_H). [gcc/ChangeLog] 2004-09-07 Ziemowit Laski <zlaski@apple.com> * Makefile.in (c-parse.o): Depend on $(C_COMMON_H). * c-parse.in: Include c-common.h instead of objc-act.h. (ivar_decl_list, ivar_decls, ivar_decl, ivars, ivar_declarator, myparms, myparm): Remove %type declarations. (methodtype, optparms, OBJC_TYPE_QUAL, objc_quals, objc_qual, objc_typename, objc_try_catch_stmt, optellipsis): Add %type declarations. (objc_inherit_code, objc_public_flag): Remove. (typespec_nonreserved_nonattr): Call objc_get_protocol_qualified_type() instead of get_static_reference() and get_protocol_reference(). (stmt_nocomp): Call grokparm() on @catch parameter. (objcdef): Move semantic action to objc_finish_implementation(). (classdef): Move semantic action to objc_start_class_interface(), objc_continue_interface(), objc_finish_interface(), objc_start_class_implementation(), objc_continue_implementation(), objc_start_category_interface() and objc_start_category_implementation(). (protocoldef): Move semantic actions to objc_start_protocol() and objc_finish_interface(). (ivar_decl_list): Remove nonterminal. (visibility_spec): Move semantic actions to objc_set_visibility(). (ivar_decls): Remove assignment to $$. (ivar_decl): Rephrase in terms of component_decl; call objc_add_instance_variable(). (ivars, ivar_declarator): Remove nonterminals. (opt_semi): New nonterminal. (methodtype): Remove semantic actions. (methoddef): Move semantic actions to objc_set_method_type(), objc_start_method_definition() and objc_finish_method_definition(). (methodproto): Move semantic actions to objc_set_method_type() and objc_add_method_declaration(). (methoddecl): Use objc_typename instead of typename; move semantic actions to objc_build_method_signature(). (optarglist, myxdecls, mydecl, myparms, myparm): Remove nonterminals. (optparmlist): Express in terms of optparms and optellipsis. (optparms, optellipsis, objc_qual, objc_quals, objc_typename): New nonterminals. (keyworddecl): Use objc_typename instead of typename. (rid_to_yy): Mark RID_IN, RID_OUT, RID_INOUT, RID_BYCOPY, RID_BYREF and RID_ONEWAY as returning OBJC_TYPE_QUAL to yyparse(). [gcc/objc/ChangeLog] 2004-09-07 Ziemowit Laski <zlaski@apple.com> * Make-lang.in (objc/objc-parse.o): Depend on $(C_COMMON_H) instead of objc/objc-act.h. (objc/objc-act.o): Depend on $(HASHTAB_H). * objc-act.c: Include hashtab.h; in ObjC++ mode, include cp-tree.h and objcp-decl.h instead of c-tree.h. (build_module_descriptor, get_class_ivars, synth_id_with_class_suffix, error_with_ivar, gen_method_decl, gen_declaration, setup_string_decl, build_protocol_template): Adjust prototypes. (build_module_initializer_routine, start_class, continue_class, finish_class, start_method_def, objc_start_function, start_protocol, build_method_decl, objc_add_method, add_instance_variable, build_ivar_reference, is_ivar, is_private, get_super_receiver, build_selector_table_decl, objc_push_parm, objc_get_parm_info, gen_type_name, gen_type_name_0, start_var_decl, finish_var_decl, create_field_decl): New prototypes. (objc_expand_function_end, comp_method_with_proto, objc_expr_last, gen_declaration_1, gen_declarator, is_complex_decl, adorn_decl, define_decl, create_builtin_decl, gen_declspecs): Remove prototypes. (TYPE_ID): Rename to OBJECT_TYPEDEF_NAME. (CLASS_TYPEDEF_NAME): New. (TAG_EXECCLASS): Change from a global variable to a #define. (TAG_RETURN_STRUCT): Delete. (TAG_GNUINIT): New, holds '__objc_gnu_init' name. (objc_inherit_code, objc_public_flag): New, moved from c-parse.in. (string_descriptor): New struct. (string_htab): New hash table. (string_hash, string_eq): New prototypes. (generate_struct_by_value_array): Call create_field_decl() instead of create_builtin_decl(). (objc_init): Do not initialize objc_ellipsis_node or TAG_EXECCLASS; In ObjC++ mode, call cxx_init() instead of c_objc_common_init(). (objc_finish_file): In ObjC++, call instantiate_pending_templates() and cp_finish_file(). (define_decl, get_static_reference, get_protocol_reference, create_builtin_decl): Remove functions. (objc_start_class_interface, objc_start_category_interface, objc_start_protocol, objc_continue_interface, objc_finish_interface, objc_start_class_implementation, objc_start_category_implementation, objc_continue_implementation, objc_finish_implementation, objc_set_visibility, objc_set_method_type, objc_build_method_signature, objc_add_method_declaration, objc_start_method_definition, objc_add_instance_variable, objc_get_protocol_qualified_type, create_field_decl, start_var_decl, finish_var_decl): New functions. (setup_string_decl): Simplify since it is only called once. (synth_module_prologue): Call build_class_template(); predefine 'id' and 'Class' as typedefs; rename 'temp_type' to 'type'; disable debug hooks for duration of function; fix GNU runtime messenger signatures to correspond to reality; forward-declare '__objc_exec_class' for the GNU runtime; call build_selector_table_decl(); in ObjC++ mode, generate 'extern "C" { ... }' wrappers around synthesized declarations; call build_protocol_template() and build_category_template(). (string_hash, string_eq): New functions. (objc_build_string_object): Check metaclass correctness only once; store string literals in hash table. (objc_build_constructor): Do not convert initializer elements; adjust for ObjC++ impedance mismatch. (build_objc_symtab_template): Call create_field_decl() instead of create_builtin_decl(). (init_objc_symtab): Add missing conversion to initializer element. (build_metadata_decl): Call start_var_decl() instead of define_decl(). (generate_objc_symtab_decl): Do not call build_category_template(); call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(). (build_module_descriptor): Call create_field_decl() instead of grokfield(); call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(); always mark module descriptor as used; move GNU runtime-specific functionality to build_module_initializer_routine(). (build_module_initializer_routine): New function, broken off of build_module_descriptor(). (objc_static_init_needed_p, objc_generate_static_init_call): New functions. (generate_static_references, generate_strings, build_selector_translation_table, generate_descriptor_table, generate_ivars_list, generate_dispatch_table, generate_category): Call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(); build a type directly instead of via groktypename(). (build_selector_reference_decl, build_selector_table_decl, build_class_reference_decl, build_protocol_reference, generate_objc_image_info): Call start_var_decl() instead of build_decl(). (build_selector_reference): For GNU runtime, do not call build_selector_reference_decl(). (build_selector, build_typed_selector_reference): Always convert result to the selector type. (add_objc_string): Cast return value to 'char *'. (build_method_prototype_template, build_selector_template, build_method_template): Use actual selector type for fields pointing to selectors. (finish_objc): For GNU runtime, call build_module_initializer_routine() after build_module_descriptor(). (generate_protocol_list, generate_shared_structures): Call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(); build a type directly instead of via groktypename(). (synth_id_with_class_suffix): Return a string. (get_arg_type_list): For instance methods, use the instance type for 'self'; do not call groktypename_in_parm_context(). (build_objc_string_decl): Squash redeclaration errors in ObjC++. (objc_is_class_name): Use OBJC_TYPE_NAME instead of TYPE_NAME; handle RECORD_TYPEs in ObjC as well as ObjC++. (objc_is_id): New function. (objc_is_object_ptr): Return the canonical type node. (objc_get_class_ivars): Simplify using get_class_ivars(). (get_class_ivars): Remove second parameter; create a fresh copy of the ivar list for each call; do not check for existence of super class. (objc_eh_runtime_type): Mark #ifndef OBJCPLUS. (objc_init_exceptions): When using SJLJ-style exceptions, require the use of '-fobjc-exceptions' flag; do not require it for DWARF-style exceptions. (objc_build_exc_ptr, next_sjlj_build_try_catch_finally): Use objc_object_type instead of objc_id_type. (objc_begin_catch_clause): Convert the incoming PARM_DECL into a VAR_DECL before placing it in the appropriate scope; do not call define_decl(); adjust call to c_begin_compound_stmt(); use objc_object_type instead of objc_id_type. (build_next_objc_exception_stuff): Call create_field_decl() instead of create_builtin_decl(); construct type directly instead of calling groktypename(); use OBJC_VOID_AT_END to mark end of function parameters. (build_private_template): Adjust call to get_class_ivars(); build a type directly instead of via groktypename(). (build_protocol_template, build_method_prototype_list_template, build_method_prototype_template, build_category_template, build_selector_template, build_class_template, build_super_template, build_ivar_template, build_ivar_list_template, build_method_list_template, build_method_template): Call create_field_decl() instead of grokfield(). (objc_method_parm_type): Do not call groktypename(). (generate_descriptor_table): Call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(). (generate_method_descriptors, build_protocol_initializer, generate_dispatch_tables, build_category_initializer, build_shared_structure_initializer): Do not call groktypename(). (generate_protocols): Call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(); do not call groktypename(). (error_with_ivar): Remove last parameter. (check_ivars): Do not iterate ovar CLASS_RAW_IVARS lists in addition to CLASS_IVARS lists; adjust calls to error_with_ivar(). (generate_ivar_lists): Convert one of the initializer elements; do not call groktypename(). (get_arg_type_list, start_method_def, gen_method_def): Account for new representation of variable arguments and '...' in Objective-C methods; add Objective-C++ impedance matching code. (is_objc_type_qualifier): Remove function. (adjust_type_for_id_default): Simplify; there is no longer a need to wade through declspecs. (lookup_interface, start_class, continue_class, finish_class, start_method_def, start_protocol, build_method_decl, objc_add_method, add_instance_variable, build_ivar_reference, is_ivar, is_private, get_super_receiver, objc_build_finally_epilogue): Make into static functions. (receiver_is_class_object): Use new IS_CLASS() macro. (objc_build_message_expr): Tweak ObjC++ message argument handling; call objc_finish_message_expr() instead of finish_message_expr(). (finish_message_expr): Rename to objc_finish_message_expr(); use OBJC_TYPE_NAME and OBJC_SET_TYPE_NAME macros instead of TYPE_NAME. call gen_type_name() instead of gen_declaration(); call objc_is_id() instead of using IS_ID and IS_CLASS; Use objc_class_name instead of calling get_identifier("Class"); handle CONVERT_EXPRs in receiver. (build_objc_method_call, warn_with_method): Do not call groktypename(). (build_ivar_reference): Call convert() instead of clobbering in a type. (hash_init): Initialize string_htab hash table. (add_instance_variable): Simplify parameter list; do not call grokfield(); do not populate CLASS_IVARS list. (start_class): Check for the existence of super class, if one was specified. (continue_class): Use CLASS_RAW_IVARS rather than CLASS_IVARS; do not call build_class_template(); adjust call to get_class_ivars(); call build_decl(), pushdecl() and finish_decl() instead of define_decl(). (finish_class): Call build_decl(), pushdecl() and finish_decl() instead of define_decl(). (add_protocols): Use PROTOCOL_BINFO_ELTS for the tree vector size. (start_protocol): Do not call build_protocol_template(); use PROTOCOL_BINFO_ELTS for the tree vector size. (encode_type_qualifiers): Do not handle the 'const' qualifier here. (encode_pointer): Encode 'const char *' as 'r*', for backwards compatibility. (encode_array): Use HOST_WIDE_INT_PRINT_DEC instead of "%ld". (encode_type): Handle the 'const' qualifier here. (objc_parmlist): New global variable, sued by objc_push_parm and objc_get_parm_info(). (objc_push_parm, objc_get_parm_info): New functions. (objc_expr_last): Remove function. (synth_self_and_ucmd_args): For instance methods, use the instance type for 'self'; call objc_push_parm() instead of push_parm_decl(). (start_method_def): Do not call push_scope(), declare_parm_level(), pop_scope(), push_parm_decl(), store_parm_decls() or objc_expr_last(); just use objc_push_parm() and objc_get_parm_info(). (comp_method_with_proto): Remove function. (objc_types_are_equivalent): Strip away indirections before comparing underlying types. (comp_proto_with_proto): Do not call groktypename(); types are no longer in raw declspec format. (objc_start_function): New function. (really_start_method): Call comp_proto_with_proto() instead of comp_method_with_proto(); call objc_start_function() instead of hand-crafting a function declarator. (continue_method_def, objc_expand_function_end): Remove functions. (get_super_receiver): Call objc_get_current_scope() instead of get_current_scope(); reference 'super_class' field (instead of 'class'). (finish_method_def): Rename to objc_finish_method_definition() and add a function decl parameter; move method encoding call from objc_expand_function_end(). (is_complex_decl, adorn_decl, gen_declarator, gen_declspecs, gen_declaration_1): Remove functions. (tmpbuf, RAW_DECLSPEC): Remove. (gen_declaration): Remove second parameter; simplify to deal with TYPE_P nodes instead of raw declspecs. (gen_type_name, gen_type_name_0): New functions. (gen_method_decl): Remove second parameter; call gen_type_name() instead of gen_declaration_1(). (dump_interface): Adjust calls to gen_declaration() and gen_method_decl(); do not allocate a separate string buffer. (init_objc): Allocate a larger string buffer to accommodate dump_interface(); adjust call to build_module_descriptor(); add call to build_module_initializer_routine() for the GNU runtime. (generate_classref_translation_entry): Do not call start_decl(); call finish_var_decl() instead of finish_decl(); call convert() instead of build_c_cast(). * objc-act.h (CLASS_OWN_IVARS): Remove accessor. (CLASS_BINFO_ELTS): Reduce from 6 to 5, now that CLASS_OWN_IVARS is gone. (OCTI_GNU_INIT_DECL, GNU_INIT_decl): New. (OCTI_ELLIPSIS_NODE, objc_ellipsis_node): Remove. (OCTI_ID_ID, id_type, objc_id_id): Rename to OCTI_ID_NAME, objc_object_type and objc_object_name, respectively. (OCTI_CLS_REF, OCTI_CLASS_NAME, objc_class_reference, objc_class_name): New. (IS_CLASS): New macro. (IS_ID, IS_SUPER): Robustify. (OCTI_EXECCLASS_DECL, execclass_decl): New. (finish_file, start_class, continue_class, finish_class, start_method_def, continue_method_def, finish_method_def, start_protocol, finish_protocol, objc_build_throw_stmt, objc_build_try_catch_finally_stmt, objc_build_synchronized_prologue, objc_build_synchronized_epilogue, objc_build_try_prologue, objc_build_try_epilogue, objc_build_catch_stmt, objc_build_catch_epilogue, objc_build_finally_prologue, objc_build_finally_epilogue, is_ivar, is_private, is_public, add_instance_variable, objc_add_method, get_super_receiver, objc_clear_super_receiver, get_class_ivars_from_name, get_class_reference, get_static_reference, get_object_reference, build_message_expr, finish_message_expr, build_selector_expr, build_ivar_reference, build_keyword_decl, build_method_decl, build_protocol_expr, build_objc_string_object, objc_declare_alias, objc_declare_class, objc_declare_protocols, objc_comptypes, objc_check_decl, build_encode_expr): Remove prototypes. (imp_count, cat_count): Make GGC-aware. (OBJC_SET_TYPE_NAME): New macro. From-SVN: r87168
2004-09-08 02:49:44 +02:00
objc_object_name = get_identifier (OBJECT_TYPEDEF_NAME);
objc_class_name = get_identifier (CLASS_TYPEDEF_NAME);
1992-01-18 00:15:38 +01:00
Makefile.in (c-parse.o): Depend on $(C_COMMON_H). [gcc/ChangeLog] 2004-09-07 Ziemowit Laski <zlaski@apple.com> * Makefile.in (c-parse.o): Depend on $(C_COMMON_H). * c-parse.in: Include c-common.h instead of objc-act.h. (ivar_decl_list, ivar_decls, ivar_decl, ivars, ivar_declarator, myparms, myparm): Remove %type declarations. (methodtype, optparms, OBJC_TYPE_QUAL, objc_quals, objc_qual, objc_typename, objc_try_catch_stmt, optellipsis): Add %type declarations. (objc_inherit_code, objc_public_flag): Remove. (typespec_nonreserved_nonattr): Call objc_get_protocol_qualified_type() instead of get_static_reference() and get_protocol_reference(). (stmt_nocomp): Call grokparm() on @catch parameter. (objcdef): Move semantic action to objc_finish_implementation(). (classdef): Move semantic action to objc_start_class_interface(), objc_continue_interface(), objc_finish_interface(), objc_start_class_implementation(), objc_continue_implementation(), objc_start_category_interface() and objc_start_category_implementation(). (protocoldef): Move semantic actions to objc_start_protocol() and objc_finish_interface(). (ivar_decl_list): Remove nonterminal. (visibility_spec): Move semantic actions to objc_set_visibility(). (ivar_decls): Remove assignment to $$. (ivar_decl): Rephrase in terms of component_decl; call objc_add_instance_variable(). (ivars, ivar_declarator): Remove nonterminals. (opt_semi): New nonterminal. (methodtype): Remove semantic actions. (methoddef): Move semantic actions to objc_set_method_type(), objc_start_method_definition() and objc_finish_method_definition(). (methodproto): Move semantic actions to objc_set_method_type() and objc_add_method_declaration(). (methoddecl): Use objc_typename instead of typename; move semantic actions to objc_build_method_signature(). (optarglist, myxdecls, mydecl, myparms, myparm): Remove nonterminals. (optparmlist): Express in terms of optparms and optellipsis. (optparms, optellipsis, objc_qual, objc_quals, objc_typename): New nonterminals. (keyworddecl): Use objc_typename instead of typename. (rid_to_yy): Mark RID_IN, RID_OUT, RID_INOUT, RID_BYCOPY, RID_BYREF and RID_ONEWAY as returning OBJC_TYPE_QUAL to yyparse(). [gcc/objc/ChangeLog] 2004-09-07 Ziemowit Laski <zlaski@apple.com> * Make-lang.in (objc/objc-parse.o): Depend on $(C_COMMON_H) instead of objc/objc-act.h. (objc/objc-act.o): Depend on $(HASHTAB_H). * objc-act.c: Include hashtab.h; in ObjC++ mode, include cp-tree.h and objcp-decl.h instead of c-tree.h. (build_module_descriptor, get_class_ivars, synth_id_with_class_suffix, error_with_ivar, gen_method_decl, gen_declaration, setup_string_decl, build_protocol_template): Adjust prototypes. (build_module_initializer_routine, start_class, continue_class, finish_class, start_method_def, objc_start_function, start_protocol, build_method_decl, objc_add_method, add_instance_variable, build_ivar_reference, is_ivar, is_private, get_super_receiver, build_selector_table_decl, objc_push_parm, objc_get_parm_info, gen_type_name, gen_type_name_0, start_var_decl, finish_var_decl, create_field_decl): New prototypes. (objc_expand_function_end, comp_method_with_proto, objc_expr_last, gen_declaration_1, gen_declarator, is_complex_decl, adorn_decl, define_decl, create_builtin_decl, gen_declspecs): Remove prototypes. (TYPE_ID): Rename to OBJECT_TYPEDEF_NAME. (CLASS_TYPEDEF_NAME): New. (TAG_EXECCLASS): Change from a global variable to a #define. (TAG_RETURN_STRUCT): Delete. (TAG_GNUINIT): New, holds '__objc_gnu_init' name. (objc_inherit_code, objc_public_flag): New, moved from c-parse.in. (string_descriptor): New struct. (string_htab): New hash table. (string_hash, string_eq): New prototypes. (generate_struct_by_value_array): Call create_field_decl() instead of create_builtin_decl(). (objc_init): Do not initialize objc_ellipsis_node or TAG_EXECCLASS; In ObjC++ mode, call cxx_init() instead of c_objc_common_init(). (objc_finish_file): In ObjC++, call instantiate_pending_templates() and cp_finish_file(). (define_decl, get_static_reference, get_protocol_reference, create_builtin_decl): Remove functions. (objc_start_class_interface, objc_start_category_interface, objc_start_protocol, objc_continue_interface, objc_finish_interface, objc_start_class_implementation, objc_start_category_implementation, objc_continue_implementation, objc_finish_implementation, objc_set_visibility, objc_set_method_type, objc_build_method_signature, objc_add_method_declaration, objc_start_method_definition, objc_add_instance_variable, objc_get_protocol_qualified_type, create_field_decl, start_var_decl, finish_var_decl): New functions. (setup_string_decl): Simplify since it is only called once. (synth_module_prologue): Call build_class_template(); predefine 'id' and 'Class' as typedefs; rename 'temp_type' to 'type'; disable debug hooks for duration of function; fix GNU runtime messenger signatures to correspond to reality; forward-declare '__objc_exec_class' for the GNU runtime; call build_selector_table_decl(); in ObjC++ mode, generate 'extern "C" { ... }' wrappers around synthesized declarations; call build_protocol_template() and build_category_template(). (string_hash, string_eq): New functions. (objc_build_string_object): Check metaclass correctness only once; store string literals in hash table. (objc_build_constructor): Do not convert initializer elements; adjust for ObjC++ impedance mismatch. (build_objc_symtab_template): Call create_field_decl() instead of create_builtin_decl(). (init_objc_symtab): Add missing conversion to initializer element. (build_metadata_decl): Call start_var_decl() instead of define_decl(). (generate_objc_symtab_decl): Do not call build_category_template(); call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(). (build_module_descriptor): Call create_field_decl() instead of grokfield(); call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(); always mark module descriptor as used; move GNU runtime-specific functionality to build_module_initializer_routine(). (build_module_initializer_routine): New function, broken off of build_module_descriptor(). (objc_static_init_needed_p, objc_generate_static_init_call): New functions. (generate_static_references, generate_strings, build_selector_translation_table, generate_descriptor_table, generate_ivars_list, generate_dispatch_table, generate_category): Call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(); build a type directly instead of via groktypename(). (build_selector_reference_decl, build_selector_table_decl, build_class_reference_decl, build_protocol_reference, generate_objc_image_info): Call start_var_decl() instead of build_decl(). (build_selector_reference): For GNU runtime, do not call build_selector_reference_decl(). (build_selector, build_typed_selector_reference): Always convert result to the selector type. (add_objc_string): Cast return value to 'char *'. (build_method_prototype_template, build_selector_template, build_method_template): Use actual selector type for fields pointing to selectors. (finish_objc): For GNU runtime, call build_module_initializer_routine() after build_module_descriptor(). (generate_protocol_list, generate_shared_structures): Call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(); build a type directly instead of via groktypename(). (synth_id_with_class_suffix): Return a string. (get_arg_type_list): For instance methods, use the instance type for 'self'; do not call groktypename_in_parm_context(). (build_objc_string_decl): Squash redeclaration errors in ObjC++. (objc_is_class_name): Use OBJC_TYPE_NAME instead of TYPE_NAME; handle RECORD_TYPEs in ObjC as well as ObjC++. (objc_is_id): New function. (objc_is_object_ptr): Return the canonical type node. (objc_get_class_ivars): Simplify using get_class_ivars(). (get_class_ivars): Remove second parameter; create a fresh copy of the ivar list for each call; do not check for existence of super class. (objc_eh_runtime_type): Mark #ifndef OBJCPLUS. (objc_init_exceptions): When using SJLJ-style exceptions, require the use of '-fobjc-exceptions' flag; do not require it for DWARF-style exceptions. (objc_build_exc_ptr, next_sjlj_build_try_catch_finally): Use objc_object_type instead of objc_id_type. (objc_begin_catch_clause): Convert the incoming PARM_DECL into a VAR_DECL before placing it in the appropriate scope; do not call define_decl(); adjust call to c_begin_compound_stmt(); use objc_object_type instead of objc_id_type. (build_next_objc_exception_stuff): Call create_field_decl() instead of create_builtin_decl(); construct type directly instead of calling groktypename(); use OBJC_VOID_AT_END to mark end of function parameters. (build_private_template): Adjust call to get_class_ivars(); build a type directly instead of via groktypename(). (build_protocol_template, build_method_prototype_list_template, build_method_prototype_template, build_category_template, build_selector_template, build_class_template, build_super_template, build_ivar_template, build_ivar_list_template, build_method_list_template, build_method_template): Call create_field_decl() instead of grokfield(). (objc_method_parm_type): Do not call groktypename(). (generate_descriptor_table): Call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(). (generate_method_descriptors, build_protocol_initializer, generate_dispatch_tables, build_category_initializer, build_shared_structure_initializer): Do not call groktypename(). (generate_protocols): Call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(); do not call groktypename(). (error_with_ivar): Remove last parameter. (check_ivars): Do not iterate ovar CLASS_RAW_IVARS lists in addition to CLASS_IVARS lists; adjust calls to error_with_ivar(). (generate_ivar_lists): Convert one of the initializer elements; do not call groktypename(). (get_arg_type_list, start_method_def, gen_method_def): Account for new representation of variable arguments and '...' in Objective-C methods; add Objective-C++ impedance matching code. (is_objc_type_qualifier): Remove function. (adjust_type_for_id_default): Simplify; there is no longer a need to wade through declspecs. (lookup_interface, start_class, continue_class, finish_class, start_method_def, start_protocol, build_method_decl, objc_add_method, add_instance_variable, build_ivar_reference, is_ivar, is_private, get_super_receiver, objc_build_finally_epilogue): Make into static functions. (receiver_is_class_object): Use new IS_CLASS() macro. (objc_build_message_expr): Tweak ObjC++ message argument handling; call objc_finish_message_expr() instead of finish_message_expr(). (finish_message_expr): Rename to objc_finish_message_expr(); use OBJC_TYPE_NAME and OBJC_SET_TYPE_NAME macros instead of TYPE_NAME. call gen_type_name() instead of gen_declaration(); call objc_is_id() instead of using IS_ID and IS_CLASS; Use objc_class_name instead of calling get_identifier("Class"); handle CONVERT_EXPRs in receiver. (build_objc_method_call, warn_with_method): Do not call groktypename(). (build_ivar_reference): Call convert() instead of clobbering in a type. (hash_init): Initialize string_htab hash table. (add_instance_variable): Simplify parameter list; do not call grokfield(); do not populate CLASS_IVARS list. (start_class): Check for the existence of super class, if one was specified. (continue_class): Use CLASS_RAW_IVARS rather than CLASS_IVARS; do not call build_class_template(); adjust call to get_class_ivars(); call build_decl(), pushdecl() and finish_decl() instead of define_decl(). (finish_class): Call build_decl(), pushdecl() and finish_decl() instead of define_decl(). (add_protocols): Use PROTOCOL_BINFO_ELTS for the tree vector size. (start_protocol): Do not call build_protocol_template(); use PROTOCOL_BINFO_ELTS for the tree vector size. (encode_type_qualifiers): Do not handle the 'const' qualifier here. (encode_pointer): Encode 'const char *' as 'r*', for backwards compatibility. (encode_array): Use HOST_WIDE_INT_PRINT_DEC instead of "%ld". (encode_type): Handle the 'const' qualifier here. (objc_parmlist): New global variable, sued by objc_push_parm and objc_get_parm_info(). (objc_push_parm, objc_get_parm_info): New functions. (objc_expr_last): Remove function. (synth_self_and_ucmd_args): For instance methods, use the instance type for 'self'; call objc_push_parm() instead of push_parm_decl(). (start_method_def): Do not call push_scope(), declare_parm_level(), pop_scope(), push_parm_decl(), store_parm_decls() or objc_expr_last(); just use objc_push_parm() and objc_get_parm_info(). (comp_method_with_proto): Remove function. (objc_types_are_equivalent): Strip away indirections before comparing underlying types. (comp_proto_with_proto): Do not call groktypename(); types are no longer in raw declspec format. (objc_start_function): New function. (really_start_method): Call comp_proto_with_proto() instead of comp_method_with_proto(); call objc_start_function() instead of hand-crafting a function declarator. (continue_method_def, objc_expand_function_end): Remove functions. (get_super_receiver): Call objc_get_current_scope() instead of get_current_scope(); reference 'super_class' field (instead of 'class'). (finish_method_def): Rename to objc_finish_method_definition() and add a function decl parameter; move method encoding call from objc_expand_function_end(). (is_complex_decl, adorn_decl, gen_declarator, gen_declspecs, gen_declaration_1): Remove functions. (tmpbuf, RAW_DECLSPEC): Remove. (gen_declaration): Remove second parameter; simplify to deal with TYPE_P nodes instead of raw declspecs. (gen_type_name, gen_type_name_0): New functions. (gen_method_decl): Remove second parameter; call gen_type_name() instead of gen_declaration_1(). (dump_interface): Adjust calls to gen_declaration() and gen_method_decl(); do not allocate a separate string buffer. (init_objc): Allocate a larger string buffer to accommodate dump_interface(); adjust call to build_module_descriptor(); add call to build_module_initializer_routine() for the GNU runtime. (generate_classref_translation_entry): Do not call start_decl(); call finish_var_decl() instead of finish_decl(); call convert() instead of build_c_cast(). * objc-act.h (CLASS_OWN_IVARS): Remove accessor. (CLASS_BINFO_ELTS): Reduce from 6 to 5, now that CLASS_OWN_IVARS is gone. (OCTI_GNU_INIT_DECL, GNU_INIT_decl): New. (OCTI_ELLIPSIS_NODE, objc_ellipsis_node): Remove. (OCTI_ID_ID, id_type, objc_id_id): Rename to OCTI_ID_NAME, objc_object_type and objc_object_name, respectively. (OCTI_CLS_REF, OCTI_CLASS_NAME, objc_class_reference, objc_class_name): New. (IS_CLASS): New macro. (IS_ID, IS_SUPER): Robustify. (OCTI_EXECCLASS_DECL, execclass_decl): New. (finish_file, start_class, continue_class, finish_class, start_method_def, continue_method_def, finish_method_def, start_protocol, finish_protocol, objc_build_throw_stmt, objc_build_try_catch_finally_stmt, objc_build_synchronized_prologue, objc_build_synchronized_epilogue, objc_build_try_prologue, objc_build_try_epilogue, objc_build_catch_stmt, objc_build_catch_epilogue, objc_build_finally_prologue, objc_build_finally_epilogue, is_ivar, is_private, is_public, add_instance_variable, objc_add_method, get_super_receiver, objc_clear_super_receiver, get_class_ivars_from_name, get_class_reference, get_static_reference, get_object_reference, build_message_expr, finish_message_expr, build_selector_expr, build_ivar_reference, build_keyword_decl, build_method_decl, build_protocol_expr, build_objc_string_object, objc_declare_alias, objc_declare_class, objc_declare_protocols, objc_comptypes, objc_check_decl, build_encode_expr): Remove prototypes. (imp_count, cat_count): Make GGC-aware. (OBJC_SET_TYPE_NAME): New macro. From-SVN: r87168
2004-09-08 02:49:44 +02:00
/* Declare the 'id' and 'Class' typedefs. */
Makefile.in (c-parse.o): Depend on $(C_COMMON_H). [gcc/ChangeLog] 2004-09-07 Ziemowit Laski <zlaski@apple.com> * Makefile.in (c-parse.o): Depend on $(C_COMMON_H). * c-parse.in: Include c-common.h instead of objc-act.h. (ivar_decl_list, ivar_decls, ivar_decl, ivars, ivar_declarator, myparms, myparm): Remove %type declarations. (methodtype, optparms, OBJC_TYPE_QUAL, objc_quals, objc_qual, objc_typename, objc_try_catch_stmt, optellipsis): Add %type declarations. (objc_inherit_code, objc_public_flag): Remove. (typespec_nonreserved_nonattr): Call objc_get_protocol_qualified_type() instead of get_static_reference() and get_protocol_reference(). (stmt_nocomp): Call grokparm() on @catch parameter. (objcdef): Move semantic action to objc_finish_implementation(). (classdef): Move semantic action to objc_start_class_interface(), objc_continue_interface(), objc_finish_interface(), objc_start_class_implementation(), objc_continue_implementation(), objc_start_category_interface() and objc_start_category_implementation(). (protocoldef): Move semantic actions to objc_start_protocol() and objc_finish_interface(). (ivar_decl_list): Remove nonterminal. (visibility_spec): Move semantic actions to objc_set_visibility(). (ivar_decls): Remove assignment to $$. (ivar_decl): Rephrase in terms of component_decl; call objc_add_instance_variable(). (ivars, ivar_declarator): Remove nonterminals. (opt_semi): New nonterminal. (methodtype): Remove semantic actions. (methoddef): Move semantic actions to objc_set_method_type(), objc_start_method_definition() and objc_finish_method_definition(). (methodproto): Move semantic actions to objc_set_method_type() and objc_add_method_declaration(). (methoddecl): Use objc_typename instead of typename; move semantic actions to objc_build_method_signature(). (optarglist, myxdecls, mydecl, myparms, myparm): Remove nonterminals. (optparmlist): Express in terms of optparms and optellipsis. (optparms, optellipsis, objc_qual, objc_quals, objc_typename): New nonterminals. (keyworddecl): Use objc_typename instead of typename. (rid_to_yy): Mark RID_IN, RID_OUT, RID_INOUT, RID_BYCOPY, RID_BYREF and RID_ONEWAY as returning OBJC_TYPE_QUAL to yyparse(). [gcc/objc/ChangeLog] 2004-09-07 Ziemowit Laski <zlaski@apple.com> * Make-lang.in (objc/objc-parse.o): Depend on $(C_COMMON_H) instead of objc/objc-act.h. (objc/objc-act.o): Depend on $(HASHTAB_H). * objc-act.c: Include hashtab.h; in ObjC++ mode, include cp-tree.h and objcp-decl.h instead of c-tree.h. (build_module_descriptor, get_class_ivars, synth_id_with_class_suffix, error_with_ivar, gen_method_decl, gen_declaration, setup_string_decl, build_protocol_template): Adjust prototypes. (build_module_initializer_routine, start_class, continue_class, finish_class, start_method_def, objc_start_function, start_protocol, build_method_decl, objc_add_method, add_instance_variable, build_ivar_reference, is_ivar, is_private, get_super_receiver, build_selector_table_decl, objc_push_parm, objc_get_parm_info, gen_type_name, gen_type_name_0, start_var_decl, finish_var_decl, create_field_decl): New prototypes. (objc_expand_function_end, comp_method_with_proto, objc_expr_last, gen_declaration_1, gen_declarator, is_complex_decl, adorn_decl, define_decl, create_builtin_decl, gen_declspecs): Remove prototypes. (TYPE_ID): Rename to OBJECT_TYPEDEF_NAME. (CLASS_TYPEDEF_NAME): New. (TAG_EXECCLASS): Change from a global variable to a #define. (TAG_RETURN_STRUCT): Delete. (TAG_GNUINIT): New, holds '__objc_gnu_init' name. (objc_inherit_code, objc_public_flag): New, moved from c-parse.in. (string_descriptor): New struct. (string_htab): New hash table. (string_hash, string_eq): New prototypes. (generate_struct_by_value_array): Call create_field_decl() instead of create_builtin_decl(). (objc_init): Do not initialize objc_ellipsis_node or TAG_EXECCLASS; In ObjC++ mode, call cxx_init() instead of c_objc_common_init(). (objc_finish_file): In ObjC++, call instantiate_pending_templates() and cp_finish_file(). (define_decl, get_static_reference, get_protocol_reference, create_builtin_decl): Remove functions. (objc_start_class_interface, objc_start_category_interface, objc_start_protocol, objc_continue_interface, objc_finish_interface, objc_start_class_implementation, objc_start_category_implementation, objc_continue_implementation, objc_finish_implementation, objc_set_visibility, objc_set_method_type, objc_build_method_signature, objc_add_method_declaration, objc_start_method_definition, objc_add_instance_variable, objc_get_protocol_qualified_type, create_field_decl, start_var_decl, finish_var_decl): New functions. (setup_string_decl): Simplify since it is only called once. (synth_module_prologue): Call build_class_template(); predefine 'id' and 'Class' as typedefs; rename 'temp_type' to 'type'; disable debug hooks for duration of function; fix GNU runtime messenger signatures to correspond to reality; forward-declare '__objc_exec_class' for the GNU runtime; call build_selector_table_decl(); in ObjC++ mode, generate 'extern "C" { ... }' wrappers around synthesized declarations; call build_protocol_template() and build_category_template(). (string_hash, string_eq): New functions. (objc_build_string_object): Check metaclass correctness only once; store string literals in hash table. (objc_build_constructor): Do not convert initializer elements; adjust for ObjC++ impedance mismatch. (build_objc_symtab_template): Call create_field_decl() instead of create_builtin_decl(). (init_objc_symtab): Add missing conversion to initializer element. (build_metadata_decl): Call start_var_decl() instead of define_decl(). (generate_objc_symtab_decl): Do not call build_category_template(); call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(). (build_module_descriptor): Call create_field_decl() instead of grokfield(); call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(); always mark module descriptor as used; move GNU runtime-specific functionality to build_module_initializer_routine(). (build_module_initializer_routine): New function, broken off of build_module_descriptor(). (objc_static_init_needed_p, objc_generate_static_init_call): New functions. (generate_static_references, generate_strings, build_selector_translation_table, generate_descriptor_table, generate_ivars_list, generate_dispatch_table, generate_category): Call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(); build a type directly instead of via groktypename(). (build_selector_reference_decl, build_selector_table_decl, build_class_reference_decl, build_protocol_reference, generate_objc_image_info): Call start_var_decl() instead of build_decl(). (build_selector_reference): For GNU runtime, do not call build_selector_reference_decl(). (build_selector, build_typed_selector_reference): Always convert result to the selector type. (add_objc_string): Cast return value to 'char *'. (build_method_prototype_template, build_selector_template, build_method_template): Use actual selector type for fields pointing to selectors. (finish_objc): For GNU runtime, call build_module_initializer_routine() after build_module_descriptor(). (generate_protocol_list, generate_shared_structures): Call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(); build a type directly instead of via groktypename(). (synth_id_with_class_suffix): Return a string. (get_arg_type_list): For instance methods, use the instance type for 'self'; do not call groktypename_in_parm_context(). (build_objc_string_decl): Squash redeclaration errors in ObjC++. (objc_is_class_name): Use OBJC_TYPE_NAME instead of TYPE_NAME; handle RECORD_TYPEs in ObjC as well as ObjC++. (objc_is_id): New function. (objc_is_object_ptr): Return the canonical type node. (objc_get_class_ivars): Simplify using get_class_ivars(). (get_class_ivars): Remove second parameter; create a fresh copy of the ivar list for each call; do not check for existence of super class. (objc_eh_runtime_type): Mark #ifndef OBJCPLUS. (objc_init_exceptions): When using SJLJ-style exceptions, require the use of '-fobjc-exceptions' flag; do not require it for DWARF-style exceptions. (objc_build_exc_ptr, next_sjlj_build_try_catch_finally): Use objc_object_type instead of objc_id_type. (objc_begin_catch_clause): Convert the incoming PARM_DECL into a VAR_DECL before placing it in the appropriate scope; do not call define_decl(); adjust call to c_begin_compound_stmt(); use objc_object_type instead of objc_id_type. (build_next_objc_exception_stuff): Call create_field_decl() instead of create_builtin_decl(); construct type directly instead of calling groktypename(); use OBJC_VOID_AT_END to mark end of function parameters. (build_private_template): Adjust call to get_class_ivars(); build a type directly instead of via groktypename(). (build_protocol_template, build_method_prototype_list_template, build_method_prototype_template, build_category_template, build_selector_template, build_class_template, build_super_template, build_ivar_template, build_ivar_list_template, build_method_list_template, build_method_template): Call create_field_decl() instead of grokfield(). (objc_method_parm_type): Do not call groktypename(). (generate_descriptor_table): Call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(). (generate_method_descriptors, build_protocol_initializer, generate_dispatch_tables, build_category_initializer, build_shared_structure_initializer): Do not call groktypename(). (generate_protocols): Call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(); do not call groktypename(). (error_with_ivar): Remove last parameter. (check_ivars): Do not iterate ovar CLASS_RAW_IVARS lists in addition to CLASS_IVARS lists; adjust calls to error_with_ivar(). (generate_ivar_lists): Convert one of the initializer elements; do not call groktypename(). (get_arg_type_list, start_method_def, gen_method_def): Account for new representation of variable arguments and '...' in Objective-C methods; add Objective-C++ impedance matching code. (is_objc_type_qualifier): Remove function. (adjust_type_for_id_default): Simplify; there is no longer a need to wade through declspecs. (lookup_interface, start_class, continue_class, finish_class, start_method_def, start_protocol, build_method_decl, objc_add_method, add_instance_variable, build_ivar_reference, is_ivar, is_private, get_super_receiver, objc_build_finally_epilogue): Make into static functions. (receiver_is_class_object): Use new IS_CLASS() macro. (objc_build_message_expr): Tweak ObjC++ message argument handling; call objc_finish_message_expr() instead of finish_message_expr(). (finish_message_expr): Rename to objc_finish_message_expr(); use OBJC_TYPE_NAME and OBJC_SET_TYPE_NAME macros instead of TYPE_NAME. call gen_type_name() instead of gen_declaration(); call objc_is_id() instead of using IS_ID and IS_CLASS; Use objc_class_name instead of calling get_identifier("Class"); handle CONVERT_EXPRs in receiver. (build_objc_method_call, warn_with_method): Do not call groktypename(). (build_ivar_reference): Call convert() instead of clobbering in a type. (hash_init): Initialize string_htab hash table. (add_instance_variable): Simplify parameter list; do not call grokfield(); do not populate CLASS_IVARS list. (start_class): Check for the existence of super class, if one was specified. (continue_class): Use CLASS_RAW_IVARS rather than CLASS_IVARS; do not call build_class_template(); adjust call to get_class_ivars(); call build_decl(), pushdecl() and finish_decl() instead of define_decl(). (finish_class): Call build_decl(), pushdecl() and finish_decl() instead of define_decl(). (add_protocols): Use PROTOCOL_BINFO_ELTS for the tree vector size. (start_protocol): Do not call build_protocol_template(); use PROTOCOL_BINFO_ELTS for the tree vector size. (encode_type_qualifiers): Do not handle the 'const' qualifier here. (encode_pointer): Encode 'const char *' as 'r*', for backwards compatibility. (encode_array): Use HOST_WIDE_INT_PRINT_DEC instead of "%ld". (encode_type): Handle the 'const' qualifier here. (objc_parmlist): New global variable, sued by objc_push_parm and objc_get_parm_info(). (objc_push_parm, objc_get_parm_info): New functions. (objc_expr_last): Remove function. (synth_self_and_ucmd_args): For instance methods, use the instance type for 'self'; call objc_push_parm() instead of push_parm_decl(). (start_method_def): Do not call push_scope(), declare_parm_level(), pop_scope(), push_parm_decl(), store_parm_decls() or objc_expr_last(); just use objc_push_parm() and objc_get_parm_info(). (comp_method_with_proto): Remove function. (objc_types_are_equivalent): Strip away indirections before comparing underlying types. (comp_proto_with_proto): Do not call groktypename(); types are no longer in raw declspec format. (objc_start_function): New function. (really_start_method): Call comp_proto_with_proto() instead of comp_method_with_proto(); call objc_start_function() instead of hand-crafting a function declarator. (continue_method_def, objc_expand_function_end): Remove functions. (get_super_receiver): Call objc_get_current_scope() instead of get_current_scope(); reference 'super_class' field (instead of 'class'). (finish_method_def): Rename to objc_finish_method_definition() and add a function decl parameter; move method encoding call from objc_expand_function_end(). (is_complex_decl, adorn_decl, gen_declarator, gen_declspecs, gen_declaration_1): Remove functions. (tmpbuf, RAW_DECLSPEC): Remove. (gen_declaration): Remove second parameter; simplify to deal with TYPE_P nodes instead of raw declspecs. (gen_type_name, gen_type_name_0): New functions. (gen_method_decl): Remove second parameter; call gen_type_name() instead of gen_declaration_1(). (dump_interface): Adjust calls to gen_declaration() and gen_method_decl(); do not allocate a separate string buffer. (init_objc): Allocate a larger string buffer to accommodate dump_interface(); adjust call to build_module_descriptor(); add call to build_module_initializer_routine() for the GNU runtime. (generate_classref_translation_entry): Do not call start_decl(); call finish_var_decl() instead of finish_decl(); call convert() instead of build_c_cast(). * objc-act.h (CLASS_OWN_IVARS): Remove accessor. (CLASS_BINFO_ELTS): Reduce from 6 to 5, now that CLASS_OWN_IVARS is gone. (OCTI_GNU_INIT_DECL, GNU_INIT_decl): New. (OCTI_ELLIPSIS_NODE, objc_ellipsis_node): Remove. (OCTI_ID_ID, id_type, objc_id_id): Rename to OCTI_ID_NAME, objc_object_type and objc_object_name, respectively. (OCTI_CLS_REF, OCTI_CLASS_NAME, objc_class_reference, objc_class_name): New. (IS_CLASS): New macro. (IS_ID, IS_SUPER): Robustify. (OCTI_EXECCLASS_DECL, execclass_decl): New. (finish_file, start_class, continue_class, finish_class, start_method_def, continue_method_def, finish_method_def, start_protocol, finish_protocol, objc_build_throw_stmt, objc_build_try_catch_finally_stmt, objc_build_synchronized_prologue, objc_build_synchronized_epilogue, objc_build_try_prologue, objc_build_try_epilogue, objc_build_catch_stmt, objc_build_catch_epilogue, objc_build_finally_prologue, objc_build_finally_epilogue, is_ivar, is_private, is_public, add_instance_variable, objc_add_method, get_super_receiver, objc_clear_super_receiver, get_class_ivars_from_name, get_class_reference, get_static_reference, get_object_reference, build_message_expr, finish_message_expr, build_selector_expr, build_ivar_reference, build_keyword_decl, build_method_decl, build_protocol_expr, build_objc_string_object, objc_declare_alias, objc_declare_class, objc_declare_protocols, objc_comptypes, objc_check_decl, build_encode_expr): Remove prototypes. (imp_count, cat_count): Make GGC-aware. (OBJC_SET_TYPE_NAME): New macro. From-SVN: r87168
2004-09-08 02:49:44 +02:00
type = lang_hooks.decls.pushdecl (build_decl (TYPE_DECL,
objc_object_name,
objc_object_type));
DECL_IN_SYSTEM_HEADER (type) = 1;
type = lang_hooks.decls.pushdecl (build_decl (TYPE_DECL,
objc_class_name,
objc_class_type));
DECL_IN_SYSTEM_HEADER (type) = 1;
/* Forward-declare '@interface Protocol'. */
type = get_identifier (PROTOCOL_OBJECT_CLASS_NAME);
objc_declare_class (tree_cons (NULL_TREE, type, NULL_TREE));
objc_protocol_type = build_pointer_type (xref_tag (RECORD_TYPE,
type));
1992-01-18 00:15:38 +01:00
/* Declare type of selector-objects that represent an operation name. */
1992-01-18 00:15:38 +01:00
if (flag_next_runtime)
/* `struct objc_selector *' */
objc-act.h (get_object_reference): Rename to get_protocol_reference. 2004-06-20 David Ayers <d.ayers@inode.at> * objc/objc-act.h (get_object_reference): Rename to get_protocol_reference. (super_type): Rename to objc_super_type. (selector_type): Rename to objc_selector_type. (id_type): Rename to objc_id_type. (instance_type): Rename to objc_instance_type. (protocol_type): Rename to objc_protocol_type. (IS_ID): Update reference to id_type. * objc/objc-act.c (get_object_reference): Rename to get_protocol_reference; add documentation; update references to id_type. (lookup_method_in_protocol_list): Rename class_meth to is_class; add documentation. (finish_message_expr): Rename is_class to class_tree. (synth_module_prologue, objc_is_object_ptr, objc_build_exc_ptr, next_sjlj_build_try_catch_finally, objc_begin_catch_clause, build_next_objc_exception_stuff, get_arg_type_list, build_objc_method_call): Update references to id_type. (synth_module_prologue, build_objc_symtab_template, build_selector_reference_decl, build_selector, build_selector_translation_table, build_typed_selector_reference, get_arg_type_list, synth_self_and_ucmd_args, get_arg_type_list, synth_self_and_ucmd_args): Update references to selector_type. (build_private_template, build_ivar_reference): Update references to instance_type. (synth_module_prologue, build_protocol_reference, build_protocol_expr, start_protocol): Update references to protocol_type. (synth_module_prologue, get_arg_type_list, build_objc_method_call): Update references to super_type. * c-parse.in: (typespec_nonreserved_nonattr): Update references to get_object_reference. * objc/objc-tree.def: Add C mode identifier sequence. From-SVN: r83425
2004-06-21 03:50:18 +02:00
objc_selector_type
= build_pointer_type (xref_tag (RECORD_TYPE,
get_identifier (TAG_SELECTOR)));
else
/* `const struct objc_selector *' */
objc-act.h (get_object_reference): Rename to get_protocol_reference. 2004-06-20 David Ayers <d.ayers@inode.at> * objc/objc-act.h (get_object_reference): Rename to get_protocol_reference. (super_type): Rename to objc_super_type. (selector_type): Rename to objc_selector_type. (id_type): Rename to objc_id_type. (instance_type): Rename to objc_instance_type. (protocol_type): Rename to objc_protocol_type. (IS_ID): Update reference to id_type. * objc/objc-act.c (get_object_reference): Rename to get_protocol_reference; add documentation; update references to id_type. (lookup_method_in_protocol_list): Rename class_meth to is_class; add documentation. (finish_message_expr): Rename is_class to class_tree. (synth_module_prologue, objc_is_object_ptr, objc_build_exc_ptr, next_sjlj_build_try_catch_finally, objc_begin_catch_clause, build_next_objc_exception_stuff, get_arg_type_list, build_objc_method_call): Update references to id_type. (synth_module_prologue, build_objc_symtab_template, build_selector_reference_decl, build_selector, build_selector_translation_table, build_typed_selector_reference, get_arg_type_list, synth_self_and_ucmd_args, get_arg_type_list, synth_self_and_ucmd_args): Update references to selector_type. (build_private_template, build_ivar_reference): Update references to instance_type. (synth_module_prologue, build_protocol_reference, build_protocol_expr, start_protocol): Update references to protocol_type. (synth_module_prologue, get_arg_type_list, build_objc_method_call): Update references to super_type. * c-parse.in: (typespec_nonreserved_nonattr): Update references to get_object_reference. * objc/objc-tree.def: Add C mode identifier sequence. From-SVN: r83425
2004-06-21 03:50:18 +02:00
objc_selector_type
= build_pointer_type
(build_qualified_type (xref_tag (RECORD_TYPE,
get_identifier (TAG_SELECTOR)),
TYPE_QUAL_CONST));
1992-01-18 00:15:38 +01:00
/* Declare receiver type used for dispatching messages to 'super'. */
/* `struct objc_super *' */
objc-act.h (get_object_reference): Rename to get_protocol_reference. 2004-06-20 David Ayers <d.ayers@inode.at> * objc/objc-act.h (get_object_reference): Rename to get_protocol_reference. (super_type): Rename to objc_super_type. (selector_type): Rename to objc_selector_type. (id_type): Rename to objc_id_type. (instance_type): Rename to objc_instance_type. (protocol_type): Rename to objc_protocol_type. (IS_ID): Update reference to id_type. * objc/objc-act.c (get_object_reference): Rename to get_protocol_reference; add documentation; update references to id_type. (lookup_method_in_protocol_list): Rename class_meth to is_class; add documentation. (finish_message_expr): Rename is_class to class_tree. (synth_module_prologue, objc_is_object_ptr, objc_build_exc_ptr, next_sjlj_build_try_catch_finally, objc_begin_catch_clause, build_next_objc_exception_stuff, get_arg_type_list, build_objc_method_call): Update references to id_type. (synth_module_prologue, build_objc_symtab_template, build_selector_reference_decl, build_selector, build_selector_translation_table, build_typed_selector_reference, get_arg_type_list, synth_self_and_ucmd_args, get_arg_type_list, synth_self_and_ucmd_args): Update references to selector_type. (build_private_template, build_ivar_reference): Update references to instance_type. (synth_module_prologue, build_protocol_reference, build_protocol_expr, start_protocol): Update references to protocol_type. (synth_module_prologue, get_arg_type_list, build_objc_method_call): Update references to super_type. * c-parse.in: (typespec_nonreserved_nonattr): Update references to get_object_reference. * objc/objc-tree.def: Add C mode identifier sequence. From-SVN: r83425
2004-06-21 03:50:18 +02:00
objc_super_type = build_pointer_type (xref_tag (RECORD_TYPE,
get_identifier (TAG_SUPER)));
Yet more Objective-C++... * objc-act.c (objc_finish_try_stmt): Add return value. (objc_build_synchronized): Likewise. * objc-act.c (objc_is_gcable_type): Add. (objc_substitute_decl): Add. (objc_build_ivar_assignment): Add. (objc_build_global_assignment): Add. (objc_build_strong_cast_assignment): Add. (objc_is_ivar_reference_p): Add. (objc_is_global_reference_p): Add. (objc_generate_write_barrier): Add. (objc_rewrite_function_call): Add. (objc_gimplify_expr): Add Objective-C++ support. * objc-act.h (ALLOC_OBJC_TYPE_LANG_SPECIFIC): Likewise. (SIZEOF_OBJC_TYPE_LANG_SPECIFIC): Add. (INIT_TYPE_OBJC_INFO): Add Objective-C++ support. (DUP_TYPE_OBJC_INFO): Likewise. (struct imp_entry): Add field has_cxx_cdtors. (struct imp_entry *imp_list): Add OCTI_UMSG_FAST_DECL, OCTI_METH_LIST_TEMPL, OCTI_METH_PROTO_LIST_TEMPL, OCTI_IVAR_LIST_TEMPL, OCTI_ASSIGN_IVAR_DECL, OCTI_ASSIGN_IVAR_FAST_DECL, OCTI_ASSIGN_GLOBAL_DECL, OCTI_ASSIGN_STRONGCAST_DECL. (umsg_fast_decl): Add. (objc_assign_ivar_decl): Add. (objc_assign_ivar_fast_decl): Add. (objc_assign_global_decl): Add. (objc_assign_strong_cast_decl): Add. (objc_method_list_ptr): Add. (objc_method_proto_list_ptr): Add. (objc_ivar_list_ptr): Add. * objc-act.c (should_call_super_dealloc): Add. (OBJC_VERSION): Bump to 6. (objc_is_gcable_type): Add. (objc_substitute_decl): Add. (objc_build_ivar_assignment): Add. (objc_build_global_assignment): Add. (objc_build_strong_cast_assignment): Add. (objc_is_gcable_p): Add. (objc_is_ivar_reference_p): Add. (objc_is_global_reference_p): Add. (generate_shared_structures): Add flags parameter. (objc_generate_cxx_ctor_or_dtor): Add. (objc_generate_cxx_cdtors): Add. (add_class): Add name parameter. (objc_types_share_size_and_alignment): Add. (comp_proto_with_proto): Add strict parameter. (CLS_HAS_CXX_STRUCTORS): Add. (TAG_ASSIGNIVAR): Add. (TAG_ASSIGNGLOBAL): Add. (TAG_ASSIGNSTRONGCAST): Add. (TAG_MSGSEND_FAST): Add. (TAG_ASSIGNIVAR_FAST): Add. (TAG_CXX_CONSTRUCT): Add. (TAG_CXX_DESTRUCT): Add. (OBJC_LOOKUP_CLASS): Add. (OBJC_LOOKUP_NO_SUPER): Add. (objc_finish_file): Add pch support. (objc_finish_implementation): Add Objective-C++ support. (synth_module_prologue): Likewise. (synth_module_prologue): Add fast dispatching. (objc_get_class_reference): Add Objective-C++ support. (objc_generate_write_barrier): Likewise. (next_sjlj_build_enter_and_setjmp): Likewise. (objc_begin_try_stmt): Likewise. (build_next_objc_exception_stuff): Add fast ivar support. (build_private_template): Mark the record as used so debug information is generated. (build_protocol_template): Add Objective-C++ support. (objc_method_parm_type) Likewise. (objc_generate_cxx_ctor_or_dtor): Likewise. (objc_generate_cxx_cdtors): Likewise. (build_protocol_initializer): Likewise. (build_category_template): Likewise. (build_class_template): Likewise. (build_method_list_template): Likewise. (build_category_initializer): Likewise. (build_shared_structure_initializer): Likewise. (objc_finish_message_expr): Likewise. (build_objc_method_call): Add fast dispatch support. (lookup_method_static): Add support to end search at superclasses. (add_method_to_hash_list): Add strict parameter to comp_proto_with_proto. (objc_add_method): Likewise. (objc_add_method): Also set the interface_value. (add_instance_variable): Add Objective-C++ support. (objc_is_public): Likewise. (start_class): Likewise. (continue_class): Likewise. (encode_aggregate_within): Likewise. (start_method_def): Likewise. (objc_start_function): Clear current_function_returns_value and current_function_returns_null. (really_start_method): Add Objective-C++ support. (objc_finish_method_definition): Add warning for missing [super dealloc]. (finish_objc): Add Objective-C++ support. (generate_objc_image_info): Likewise. (objc_lookup_ivar): Likewise. * objc-act.h (TYPE_HAS_OBJC_INFO): Likewise. (INIT_TYPE_OBJC_INFO): Likewise. (DUP_TYPE_OBJC_INFO): Likewise. From-SVN: r99857
2005-05-17 22:07:08 +02:00
/* Declare pointers to method and ivar lists. */
objc_method_list_ptr = build_pointer_type
(xref_tag (RECORD_TYPE,
get_identifier (UTAG_METHOD_LIST)));
objc_method_proto_list_ptr
= build_pointer_type (xref_tag (RECORD_TYPE,
get_identifier (UTAG_METHOD_PROTOTYPE_LIST)));
objc_ivar_list_ptr = build_pointer_type
(xref_tag (RECORD_TYPE,
get_identifier (UTAG_IVAR_LIST)));
/* TREE_NOTHROW is cleared for the message-sending functions,
because the function that gets called can throw in Obj-C++, or
could itself call something that can throw even in Obj-C. */
if (flag_next_runtime)
{
/* NB: In order to call one of the ..._stret (struct-returning)
functions, the function *MUST* first be cast to a signature that
corresponds to the actual ObjC method being invoked. This is
what is done by the build_objc_method_call() routine below. */
/* id objc_msgSend (id, SEL, ...); */
/* id objc_msgSendNonNil (id, SEL, ...); */
/* id objc_msgSend_stret (id, SEL, ...); */
/* id objc_msgSendNonNil_stret (id, SEL, ...); */
Makefile.in (c-parse.o): Depend on $(C_COMMON_H). [gcc/ChangeLog] 2004-09-07 Ziemowit Laski <zlaski@apple.com> * Makefile.in (c-parse.o): Depend on $(C_COMMON_H). * c-parse.in: Include c-common.h instead of objc-act.h. (ivar_decl_list, ivar_decls, ivar_decl, ivars, ivar_declarator, myparms, myparm): Remove %type declarations. (methodtype, optparms, OBJC_TYPE_QUAL, objc_quals, objc_qual, objc_typename, objc_try_catch_stmt, optellipsis): Add %type declarations. (objc_inherit_code, objc_public_flag): Remove. (typespec_nonreserved_nonattr): Call objc_get_protocol_qualified_type() instead of get_static_reference() and get_protocol_reference(). (stmt_nocomp): Call grokparm() on @catch parameter. (objcdef): Move semantic action to objc_finish_implementation(). (classdef): Move semantic action to objc_start_class_interface(), objc_continue_interface(), objc_finish_interface(), objc_start_class_implementation(), objc_continue_implementation(), objc_start_category_interface() and objc_start_category_implementation(). (protocoldef): Move semantic actions to objc_start_protocol() and objc_finish_interface(). (ivar_decl_list): Remove nonterminal. (visibility_spec): Move semantic actions to objc_set_visibility(). (ivar_decls): Remove assignment to $$. (ivar_decl): Rephrase in terms of component_decl; call objc_add_instance_variable(). (ivars, ivar_declarator): Remove nonterminals. (opt_semi): New nonterminal. (methodtype): Remove semantic actions. (methoddef): Move semantic actions to objc_set_method_type(), objc_start_method_definition() and objc_finish_method_definition(). (methodproto): Move semantic actions to objc_set_method_type() and objc_add_method_declaration(). (methoddecl): Use objc_typename instead of typename; move semantic actions to objc_build_method_signature(). (optarglist, myxdecls, mydecl, myparms, myparm): Remove nonterminals. (optparmlist): Express in terms of optparms and optellipsis. (optparms, optellipsis, objc_qual, objc_quals, objc_typename): New nonterminals. (keyworddecl): Use objc_typename instead of typename. (rid_to_yy): Mark RID_IN, RID_OUT, RID_INOUT, RID_BYCOPY, RID_BYREF and RID_ONEWAY as returning OBJC_TYPE_QUAL to yyparse(). [gcc/objc/ChangeLog] 2004-09-07 Ziemowit Laski <zlaski@apple.com> * Make-lang.in (objc/objc-parse.o): Depend on $(C_COMMON_H) instead of objc/objc-act.h. (objc/objc-act.o): Depend on $(HASHTAB_H). * objc-act.c: Include hashtab.h; in ObjC++ mode, include cp-tree.h and objcp-decl.h instead of c-tree.h. (build_module_descriptor, get_class_ivars, synth_id_with_class_suffix, error_with_ivar, gen_method_decl, gen_declaration, setup_string_decl, build_protocol_template): Adjust prototypes. (build_module_initializer_routine, start_class, continue_class, finish_class, start_method_def, objc_start_function, start_protocol, build_method_decl, objc_add_method, add_instance_variable, build_ivar_reference, is_ivar, is_private, get_super_receiver, build_selector_table_decl, objc_push_parm, objc_get_parm_info, gen_type_name, gen_type_name_0, start_var_decl, finish_var_decl, create_field_decl): New prototypes. (objc_expand_function_end, comp_method_with_proto, objc_expr_last, gen_declaration_1, gen_declarator, is_complex_decl, adorn_decl, define_decl, create_builtin_decl, gen_declspecs): Remove prototypes. (TYPE_ID): Rename to OBJECT_TYPEDEF_NAME. (CLASS_TYPEDEF_NAME): New. (TAG_EXECCLASS): Change from a global variable to a #define. (TAG_RETURN_STRUCT): Delete. (TAG_GNUINIT): New, holds '__objc_gnu_init' name. (objc_inherit_code, objc_public_flag): New, moved from c-parse.in. (string_descriptor): New struct. (string_htab): New hash table. (string_hash, string_eq): New prototypes. (generate_struct_by_value_array): Call create_field_decl() instead of create_builtin_decl(). (objc_init): Do not initialize objc_ellipsis_node or TAG_EXECCLASS; In ObjC++ mode, call cxx_init() instead of c_objc_common_init(). (objc_finish_file): In ObjC++, call instantiate_pending_templates() and cp_finish_file(). (define_decl, get_static_reference, get_protocol_reference, create_builtin_decl): Remove functions. (objc_start_class_interface, objc_start_category_interface, objc_start_protocol, objc_continue_interface, objc_finish_interface, objc_start_class_implementation, objc_start_category_implementation, objc_continue_implementation, objc_finish_implementation, objc_set_visibility, objc_set_method_type, objc_build_method_signature, objc_add_method_declaration, objc_start_method_definition, objc_add_instance_variable, objc_get_protocol_qualified_type, create_field_decl, start_var_decl, finish_var_decl): New functions. (setup_string_decl): Simplify since it is only called once. (synth_module_prologue): Call build_class_template(); predefine 'id' and 'Class' as typedefs; rename 'temp_type' to 'type'; disable debug hooks for duration of function; fix GNU runtime messenger signatures to correspond to reality; forward-declare '__objc_exec_class' for the GNU runtime; call build_selector_table_decl(); in ObjC++ mode, generate 'extern "C" { ... }' wrappers around synthesized declarations; call build_protocol_template() and build_category_template(). (string_hash, string_eq): New functions. (objc_build_string_object): Check metaclass correctness only once; store string literals in hash table. (objc_build_constructor): Do not convert initializer elements; adjust for ObjC++ impedance mismatch. (build_objc_symtab_template): Call create_field_decl() instead of create_builtin_decl(). (init_objc_symtab): Add missing conversion to initializer element. (build_metadata_decl): Call start_var_decl() instead of define_decl(). (generate_objc_symtab_decl): Do not call build_category_template(); call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(). (build_module_descriptor): Call create_field_decl() instead of grokfield(); call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(); always mark module descriptor as used; move GNU runtime-specific functionality to build_module_initializer_routine(). (build_module_initializer_routine): New function, broken off of build_module_descriptor(). (objc_static_init_needed_p, objc_generate_static_init_call): New functions. (generate_static_references, generate_strings, build_selector_translation_table, generate_descriptor_table, generate_ivars_list, generate_dispatch_table, generate_category): Call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(); build a type directly instead of via groktypename(). (build_selector_reference_decl, build_selector_table_decl, build_class_reference_decl, build_protocol_reference, generate_objc_image_info): Call start_var_decl() instead of build_decl(). (build_selector_reference): For GNU runtime, do not call build_selector_reference_decl(). (build_selector, build_typed_selector_reference): Always convert result to the selector type. (add_objc_string): Cast return value to 'char *'. (build_method_prototype_template, build_selector_template, build_method_template): Use actual selector type for fields pointing to selectors. (finish_objc): For GNU runtime, call build_module_initializer_routine() after build_module_descriptor(). (generate_protocol_list, generate_shared_structures): Call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(); build a type directly instead of via groktypename(). (synth_id_with_class_suffix): Return a string. (get_arg_type_list): For instance methods, use the instance type for 'self'; do not call groktypename_in_parm_context(). (build_objc_string_decl): Squash redeclaration errors in ObjC++. (objc_is_class_name): Use OBJC_TYPE_NAME instead of TYPE_NAME; handle RECORD_TYPEs in ObjC as well as ObjC++. (objc_is_id): New function. (objc_is_object_ptr): Return the canonical type node. (objc_get_class_ivars): Simplify using get_class_ivars(). (get_class_ivars): Remove second parameter; create a fresh copy of the ivar list for each call; do not check for existence of super class. (objc_eh_runtime_type): Mark #ifndef OBJCPLUS. (objc_init_exceptions): When using SJLJ-style exceptions, require the use of '-fobjc-exceptions' flag; do not require it for DWARF-style exceptions. (objc_build_exc_ptr, next_sjlj_build_try_catch_finally): Use objc_object_type instead of objc_id_type. (objc_begin_catch_clause): Convert the incoming PARM_DECL into a VAR_DECL before placing it in the appropriate scope; do not call define_decl(); adjust call to c_begin_compound_stmt(); use objc_object_type instead of objc_id_type. (build_next_objc_exception_stuff): Call create_field_decl() instead of create_builtin_decl(); construct type directly instead of calling groktypename(); use OBJC_VOID_AT_END to mark end of function parameters. (build_private_template): Adjust call to get_class_ivars(); build a type directly instead of via groktypename(). (build_protocol_template, build_method_prototype_list_template, build_method_prototype_template, build_category_template, build_selector_template, build_class_template, build_super_template, build_ivar_template, build_ivar_list_template, build_method_list_template, build_method_template): Call create_field_decl() instead of grokfield(). (objc_method_parm_type): Do not call groktypename(). (generate_descriptor_table): Call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(). (generate_method_descriptors, build_protocol_initializer, generate_dispatch_tables, build_category_initializer, build_shared_structure_initializer): Do not call groktypename(). (generate_protocols): Call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(); do not call groktypename(). (error_with_ivar): Remove last parameter. (check_ivars): Do not iterate ovar CLASS_RAW_IVARS lists in addition to CLASS_IVARS lists; adjust calls to error_with_ivar(). (generate_ivar_lists): Convert one of the initializer elements; do not call groktypename(). (get_arg_type_list, start_method_def, gen_method_def): Account for new representation of variable arguments and '...' in Objective-C methods; add Objective-C++ impedance matching code. (is_objc_type_qualifier): Remove function. (adjust_type_for_id_default): Simplify; there is no longer a need to wade through declspecs. (lookup_interface, start_class, continue_class, finish_class, start_method_def, start_protocol, build_method_decl, objc_add_method, add_instance_variable, build_ivar_reference, is_ivar, is_private, get_super_receiver, objc_build_finally_epilogue): Make into static functions. (receiver_is_class_object): Use new IS_CLASS() macro. (objc_build_message_expr): Tweak ObjC++ message argument handling; call objc_finish_message_expr() instead of finish_message_expr(). (finish_message_expr): Rename to objc_finish_message_expr(); use OBJC_TYPE_NAME and OBJC_SET_TYPE_NAME macros instead of TYPE_NAME. call gen_type_name() instead of gen_declaration(); call objc_is_id() instead of using IS_ID and IS_CLASS; Use objc_class_name instead of calling get_identifier("Class"); handle CONVERT_EXPRs in receiver. (build_objc_method_call, warn_with_method): Do not call groktypename(). (build_ivar_reference): Call convert() instead of clobbering in a type. (hash_init): Initialize string_htab hash table. (add_instance_variable): Simplify parameter list; do not call grokfield(); do not populate CLASS_IVARS list. (start_class): Check for the existence of super class, if one was specified. (continue_class): Use CLASS_RAW_IVARS rather than CLASS_IVARS; do not call build_class_template(); adjust call to get_class_ivars(); call build_decl(), pushdecl() and finish_decl() instead of define_decl(). (finish_class): Call build_decl(), pushdecl() and finish_decl() instead of define_decl(). (add_protocols): Use PROTOCOL_BINFO_ELTS for the tree vector size. (start_protocol): Do not call build_protocol_template(); use PROTOCOL_BINFO_ELTS for the tree vector size. (encode_type_qualifiers): Do not handle the 'const' qualifier here. (encode_pointer): Encode 'const char *' as 'r*', for backwards compatibility. (encode_array): Use HOST_WIDE_INT_PRINT_DEC instead of "%ld". (encode_type): Handle the 'const' qualifier here. (objc_parmlist): New global variable, sued by objc_push_parm and objc_get_parm_info(). (objc_push_parm, objc_get_parm_info): New functions. (objc_expr_last): Remove function. (synth_self_and_ucmd_args): For instance methods, use the instance type for 'self'; call objc_push_parm() instead of push_parm_decl(). (start_method_def): Do not call push_scope(), declare_parm_level(), pop_scope(), push_parm_decl(), store_parm_decls() or objc_expr_last(); just use objc_push_parm() and objc_get_parm_info(). (comp_method_with_proto): Remove function. (objc_types_are_equivalent): Strip away indirections before comparing underlying types. (comp_proto_with_proto): Do not call groktypename(); types are no longer in raw declspec format. (objc_start_function): New function. (really_start_method): Call comp_proto_with_proto() instead of comp_method_with_proto(); call objc_start_function() instead of hand-crafting a function declarator. (continue_method_def, objc_expand_function_end): Remove functions. (get_super_receiver): Call objc_get_current_scope() instead of get_current_scope(); reference 'super_class' field (instead of 'class'). (finish_method_def): Rename to objc_finish_method_definition() and add a function decl parameter; move method encoding call from objc_expand_function_end(). (is_complex_decl, adorn_decl, gen_declarator, gen_declspecs, gen_declaration_1): Remove functions. (tmpbuf, RAW_DECLSPEC): Remove. (gen_declaration): Remove second parameter; simplify to deal with TYPE_P nodes instead of raw declspecs. (gen_type_name, gen_type_name_0): New functions. (gen_method_decl): Remove second parameter; call gen_type_name() instead of gen_declaration_1(). (dump_interface): Adjust calls to gen_declaration() and gen_method_decl(); do not allocate a separate string buffer. (init_objc): Allocate a larger string buffer to accommodate dump_interface(); adjust call to build_module_descriptor(); add call to build_module_initializer_routine() for the GNU runtime. (generate_classref_translation_entry): Do not call start_decl(); call finish_var_decl() instead of finish_decl(); call convert() instead of build_c_cast(). * objc-act.h (CLASS_OWN_IVARS): Remove accessor. (CLASS_BINFO_ELTS): Reduce from 6 to 5, now that CLASS_OWN_IVARS is gone. (OCTI_GNU_INIT_DECL, GNU_INIT_decl): New. (OCTI_ELLIPSIS_NODE, objc_ellipsis_node): Remove. (OCTI_ID_ID, id_type, objc_id_id): Rename to OCTI_ID_NAME, objc_object_type and objc_object_name, respectively. (OCTI_CLS_REF, OCTI_CLASS_NAME, objc_class_reference, objc_class_name): New. (IS_CLASS): New macro. (IS_ID, IS_SUPER): Robustify. (OCTI_EXECCLASS_DECL, execclass_decl): New. (finish_file, start_class, continue_class, finish_class, start_method_def, continue_method_def, finish_method_def, start_protocol, finish_protocol, objc_build_throw_stmt, objc_build_try_catch_finally_stmt, objc_build_synchronized_prologue, objc_build_synchronized_epilogue, objc_build_try_prologue, objc_build_try_epilogue, objc_build_catch_stmt, objc_build_catch_epilogue, objc_build_finally_prologue, objc_build_finally_epilogue, is_ivar, is_private, is_public, add_instance_variable, objc_add_method, get_super_receiver, objc_clear_super_receiver, get_class_ivars_from_name, get_class_reference, get_static_reference, get_object_reference, build_message_expr, finish_message_expr, build_selector_expr, build_ivar_reference, build_keyword_decl, build_method_decl, build_protocol_expr, build_objc_string_object, objc_declare_alias, objc_declare_class, objc_declare_protocols, objc_comptypes, objc_check_decl, build_encode_expr): Remove prototypes. (imp_count, cat_count): Make GGC-aware. (OBJC_SET_TYPE_NAME): New macro. From-SVN: r87168
2004-09-08 02:49:44 +02:00
type
= build_function_type (objc_object_type,
tree_cons (NULL_TREE, objc_object_type,
tree_cons (NULL_TREE, objc_selector_type,
NULL_TREE)));
decl.c: Include langhooks.h. * gcc/java/decl.c: Include langhooks.h. (builtin_function): Remove. (java_init_decl_processing): Replace calls to builtin_function with add_builtin_function. * gcc/java/Make-lang.in (jc1$(exeext)): Depend on and link with attribs.o. (java/decl.o): Depend on langhooks.h. * gcc/java/java-tree.h (builtin_function): Remove. * gcc/tree.c (local_define_builtin): Replace calls to lang_hooks.builtin_function with add_builtin_function. * gcc/objc/objc-act.c (synth_module_prologue): Replace calls to builtin_function with add_builtin_function. (build_next_objc_exception_stuff): Replace calls to builtin_function with add_builtin_function. (build_objc_exception_stuff): Replace calls to builtin_function with add_builtin_function. * gcc/objcp/objcp-decl.h (objcp_builtin_function): Remove. * gcc/cp/decl.c (builtin_function_1): Move common code to add_builtin_function. (builtin_function): Rename to cxx_builtin_function. Change the signature. * gcc/cp/call.c: Include langhooks.h. (build_java_interface_fn_ref): Replace calls to builtin_function with add_builtin_function. * gcc/cp/Make-lang.in (cp/call.o): Depend on langhooks.h. * gcc/cp/cp-objcp-common.h (LANG_HOOKS_BUILTIN_FUNCTION): Define as cxx_builtin_function. * gcc/cp/cp-tree.h (builtin_function): Rename to cxx_builtin_function. Change the signature. * gcc/c-objc-common.h (LANG_HOOKS_BUILTIN_FUNCTION): Define as c_builtin_function. * gcc/c-tree.h (builtin_function): Rename to c_builtin_function. Change the signature. * gcc/ada/utils.c (builtin_function): Rename to gnat_builtin_function. Move common code to add_builtin_function. * gcc/ada/misc.c (LANG_HOOKS_BUILTIN_FUNCTION): Define as gnat_builtin_function. * gcc/ada/gigi.h (builtin_function): Rename to gnat_builtin_function. Change the signature. * gcc/c-decl.c (builtin_function): Rename to c_builtin_function. Move common code to add_builtin_function. * gcc/fortran/Make-lang.in (f951$(exeext)): Depend on and link with attribs.o. * gcc/fortran/trans.h (builtin_function): Rename to gfc_builtin_function. Change the signature. * gcc/fortran/f95-lang.c (LANG_HOOKS_BUILTIN_FUNCTION): Define as gfc_builtin_function. (builtin_function): Rename to gfc_builtin_function. Move common code to builtin_function. (gfc_define_builtin): Replace calls to builtin_function with gfc_define_builtin. * gcc/langhooks.c (add_builtin_function): New function. (lhd_builtin_function): New function. * gcc/langhooks.h (struct lang_hooks): Change the signature of builtin_function. (add_builtin_function): New function. * gcc/treelang/treetree.c (builtin_function): Remove. * gcc/tree-ssa-loop-prefetch.c (tree_ssa_prefetch_arrays): Replace calls to lang_hooks.builtin_function with add_builtin_function. * gcc/c-common.c (decl_builtin_1): Replace calls to lang_hooks.builtin_function with add_builtin_function. * gcc/config/alpha/alpha.c (alpha_init_builtins): Replace calls to lang_hooks.builtin_function with add_builtin_function. * gcc/config/frv/frv.c (def_builtin): Replace calls to lang_hooks.builtin_function with add_builtin_function. * gcc/config/s390/s390.c (s390_init_builtins): Replace calls to lang_hooks.builtin_function with add_builtin_function. * gcc/config/sparc/sparc.c (def_builtin): Replace calls to lang_hooks.builtin_function with add_builtin_function. * gcc/config/i386/i386.c (def_builtin): Replace calls to lang_hooks.builtin_function with add_builtin_function. (def_builtin): Replace calls to lang_hooks.builtin_function with add_builtin_function. * gcc/config/sh/sh.c (sh_media_init_builtins): Replace calls to lang_hooks.builtin_function with add_builtin_function. * gcc/config/c4x/c4x.c (c4x_init_builtins): Replace calls to lang_hooks.builtin_function with add_builtin_function. * gcc/config/stormy16/stormy16.c (xstormy16_init_builtins): Replace calls to lang_hooks.builtin_function with add_builtin_function. * gcc/config/iq2000/iq2000.c (def_builtin): Replace calls to lang_hooks.builtin_function with add_builtin_function. * gcc/config/ia64/ia64.c (def_builtin): Replace calls to lang_hooks.builtin_function with add_builtin_function. * gcc/config/rs6000/rs6000.c (def_builtin): Replace calls to lang_hooks.builtin_function with add_builtin_function. (altivec_init_builtins): Replace calls to lang_hooks.builtin_function with add_builtin_function. * gcc/config/arm/arm.c (def_mbuiltin): Replace calls to lang_hooks.builtin_function with add_builtin_function. (arm_init_tls_builtins): Replace calls to lang_hooks.builtin_function with add_builtin_function. * gcc/config/mips/mips.c (mips_init_builtins): Replace calls to lang_hooks.builtin_function with add_builtin_function. * gcc/config/bfin/bfin.c (def_builtin): Replace calls to lang_hooks.builtin_function with add_builtin_function. * gcc/langhooks-def.h (lhd_builtin_function): New function. (LANG_HOOKS_BUILTIN_FUNCTION): Define as lhd_builtin_function. From-SVN: r117981
2006-10-23 21:47:58 +02:00
umsg_decl = add_builtin_function (TAG_MSGSEND,
type, 0, NOT_BUILT_IN,
NULL, NULL_TREE);
umsg_nonnil_decl = add_builtin_function (TAG_MSGSEND_NONNIL,
type, 0, NOT_BUILT_IN,
NULL, NULL_TREE);
umsg_stret_decl = add_builtin_function (TAG_MSGSEND_STRET,
type, 0, NOT_BUILT_IN,
NULL, NULL_TREE);
umsg_nonnil_stret_decl = add_builtin_function (TAG_MSGSEND_NONNIL_STRET,
type, 0, NOT_BUILT_IN,
NULL, NULL_TREE);
/* These can throw, because the function that gets called can throw
in Obj-C++, or could itself call something that can throw even
in Obj-C. */
TREE_NOTHROW (umsg_decl) = 0;
TREE_NOTHROW (umsg_nonnil_decl) = 0;
TREE_NOTHROW (umsg_stret_decl) = 0;
TREE_NOTHROW (umsg_nonnil_stret_decl) = 0;
Yet more Objective-C++... * objc-act.c (objc_finish_try_stmt): Add return value. (objc_build_synchronized): Likewise. * objc-act.c (objc_is_gcable_type): Add. (objc_substitute_decl): Add. (objc_build_ivar_assignment): Add. (objc_build_global_assignment): Add. (objc_build_strong_cast_assignment): Add. (objc_is_ivar_reference_p): Add. (objc_is_global_reference_p): Add. (objc_generate_write_barrier): Add. (objc_rewrite_function_call): Add. (objc_gimplify_expr): Add Objective-C++ support. * objc-act.h (ALLOC_OBJC_TYPE_LANG_SPECIFIC): Likewise. (SIZEOF_OBJC_TYPE_LANG_SPECIFIC): Add. (INIT_TYPE_OBJC_INFO): Add Objective-C++ support. (DUP_TYPE_OBJC_INFO): Likewise. (struct imp_entry): Add field has_cxx_cdtors. (struct imp_entry *imp_list): Add OCTI_UMSG_FAST_DECL, OCTI_METH_LIST_TEMPL, OCTI_METH_PROTO_LIST_TEMPL, OCTI_IVAR_LIST_TEMPL, OCTI_ASSIGN_IVAR_DECL, OCTI_ASSIGN_IVAR_FAST_DECL, OCTI_ASSIGN_GLOBAL_DECL, OCTI_ASSIGN_STRONGCAST_DECL. (umsg_fast_decl): Add. (objc_assign_ivar_decl): Add. (objc_assign_ivar_fast_decl): Add. (objc_assign_global_decl): Add. (objc_assign_strong_cast_decl): Add. (objc_method_list_ptr): Add. (objc_method_proto_list_ptr): Add. (objc_ivar_list_ptr): Add. * objc-act.c (should_call_super_dealloc): Add. (OBJC_VERSION): Bump to 6. (objc_is_gcable_type): Add. (objc_substitute_decl): Add. (objc_build_ivar_assignment): Add. (objc_build_global_assignment): Add. (objc_build_strong_cast_assignment): Add. (objc_is_gcable_p): Add. (objc_is_ivar_reference_p): Add. (objc_is_global_reference_p): Add. (generate_shared_structures): Add flags parameter. (objc_generate_cxx_ctor_or_dtor): Add. (objc_generate_cxx_cdtors): Add. (add_class): Add name parameter. (objc_types_share_size_and_alignment): Add. (comp_proto_with_proto): Add strict parameter. (CLS_HAS_CXX_STRUCTORS): Add. (TAG_ASSIGNIVAR): Add. (TAG_ASSIGNGLOBAL): Add. (TAG_ASSIGNSTRONGCAST): Add. (TAG_MSGSEND_FAST): Add. (TAG_ASSIGNIVAR_FAST): Add. (TAG_CXX_CONSTRUCT): Add. (TAG_CXX_DESTRUCT): Add. (OBJC_LOOKUP_CLASS): Add. (OBJC_LOOKUP_NO_SUPER): Add. (objc_finish_file): Add pch support. (objc_finish_implementation): Add Objective-C++ support. (synth_module_prologue): Likewise. (synth_module_prologue): Add fast dispatching. (objc_get_class_reference): Add Objective-C++ support. (objc_generate_write_barrier): Likewise. (next_sjlj_build_enter_and_setjmp): Likewise. (objc_begin_try_stmt): Likewise. (build_next_objc_exception_stuff): Add fast ivar support. (build_private_template): Mark the record as used so debug information is generated. (build_protocol_template): Add Objective-C++ support. (objc_method_parm_type) Likewise. (objc_generate_cxx_ctor_or_dtor): Likewise. (objc_generate_cxx_cdtors): Likewise. (build_protocol_initializer): Likewise. (build_category_template): Likewise. (build_class_template): Likewise. (build_method_list_template): Likewise. (build_category_initializer): Likewise. (build_shared_structure_initializer): Likewise. (objc_finish_message_expr): Likewise. (build_objc_method_call): Add fast dispatch support. (lookup_method_static): Add support to end search at superclasses. (add_method_to_hash_list): Add strict parameter to comp_proto_with_proto. (objc_add_method): Likewise. (objc_add_method): Also set the interface_value. (add_instance_variable): Add Objective-C++ support. (objc_is_public): Likewise. (start_class): Likewise. (continue_class): Likewise. (encode_aggregate_within): Likewise. (start_method_def): Likewise. (objc_start_function): Clear current_function_returns_value and current_function_returns_null. (really_start_method): Add Objective-C++ support. (objc_finish_method_definition): Add warning for missing [super dealloc]. (finish_objc): Add Objective-C++ support. (generate_objc_image_info): Likewise. (objc_lookup_ivar): Likewise. * objc-act.h (TYPE_HAS_OBJC_INFO): Likewise. (INIT_TYPE_OBJC_INFO): Likewise. (DUP_TYPE_OBJC_INFO): Likewise. From-SVN: r99857
2005-05-17 22:07:08 +02:00
/* id objc_msgSend_Fast (id, SEL, ...)
__attribute__ ((hard_coded_address (OFFS_MSGSEND_FAST))); */
#ifdef OFFS_MSGSEND_FAST
decl.c: Include langhooks.h. * gcc/java/decl.c: Include langhooks.h. (builtin_function): Remove. (java_init_decl_processing): Replace calls to builtin_function with add_builtin_function. * gcc/java/Make-lang.in (jc1$(exeext)): Depend on and link with attribs.o. (java/decl.o): Depend on langhooks.h. * gcc/java/java-tree.h (builtin_function): Remove. * gcc/tree.c (local_define_builtin): Replace calls to lang_hooks.builtin_function with add_builtin_function. * gcc/objc/objc-act.c (synth_module_prologue): Replace calls to builtin_function with add_builtin_function. (build_next_objc_exception_stuff): Replace calls to builtin_function with add_builtin_function. (build_objc_exception_stuff): Replace calls to builtin_function with add_builtin_function. * gcc/objcp/objcp-decl.h (objcp_builtin_function): Remove. * gcc/cp/decl.c (builtin_function_1): Move common code to add_builtin_function. (builtin_function): Rename to cxx_builtin_function. Change the signature. * gcc/cp/call.c: Include langhooks.h. (build_java_interface_fn_ref): Replace calls to builtin_function with add_builtin_function. * gcc/cp/Make-lang.in (cp/call.o): Depend on langhooks.h. * gcc/cp/cp-objcp-common.h (LANG_HOOKS_BUILTIN_FUNCTION): Define as cxx_builtin_function. * gcc/cp/cp-tree.h (builtin_function): Rename to cxx_builtin_function. Change the signature. * gcc/c-objc-common.h (LANG_HOOKS_BUILTIN_FUNCTION): Define as c_builtin_function. * gcc/c-tree.h (builtin_function): Rename to c_builtin_function. Change the signature. * gcc/ada/utils.c (builtin_function): Rename to gnat_builtin_function. Move common code to add_builtin_function. * gcc/ada/misc.c (LANG_HOOKS_BUILTIN_FUNCTION): Define as gnat_builtin_function. * gcc/ada/gigi.h (builtin_function): Rename to gnat_builtin_function. Change the signature. * gcc/c-decl.c (builtin_function): Rename to c_builtin_function. Move common code to add_builtin_function. * gcc/fortran/Make-lang.in (f951$(exeext)): Depend on and link with attribs.o. * gcc/fortran/trans.h (builtin_function): Rename to gfc_builtin_function. Change the signature. * gcc/fortran/f95-lang.c (LANG_HOOKS_BUILTIN_FUNCTION): Define as gfc_builtin_function. (builtin_function): Rename to gfc_builtin_function. Move common code to builtin_function. (gfc_define_builtin): Replace calls to builtin_function with gfc_define_builtin. * gcc/langhooks.c (add_builtin_function): New function. (lhd_builtin_function): New function. * gcc/langhooks.h (struct lang_hooks): Change the signature of builtin_function. (add_builtin_function): New function. * gcc/treelang/treetree.c (builtin_function): Remove. * gcc/tree-ssa-loop-prefetch.c (tree_ssa_prefetch_arrays): Replace calls to lang_hooks.builtin_function with add_builtin_function. * gcc/c-common.c (decl_builtin_1): Replace calls to lang_hooks.builtin_function with add_builtin_function. * gcc/config/alpha/alpha.c (alpha_init_builtins): Replace calls to lang_hooks.builtin_function with add_builtin_function. * gcc/config/frv/frv.c (def_builtin): Replace calls to lang_hooks.builtin_function with add_builtin_function. * gcc/config/s390/s390.c (s390_init_builtins): Replace calls to lang_hooks.builtin_function with add_builtin_function. * gcc/config/sparc/sparc.c (def_builtin): Replace calls to lang_hooks.builtin_function with add_builtin_function. * gcc/config/i386/i386.c (def_builtin): Replace calls to lang_hooks.builtin_function with add_builtin_function. (def_builtin): Replace calls to lang_hooks.builtin_function with add_builtin_function. * gcc/config/sh/sh.c (sh_media_init_builtins): Replace calls to lang_hooks.builtin_function with add_builtin_function. * gcc/config/c4x/c4x.c (c4x_init_builtins): Replace calls to lang_hooks.builtin_function with add_builtin_function. * gcc/config/stormy16/stormy16.c (xstormy16_init_builtins): Replace calls to lang_hooks.builtin_function with add_builtin_function. * gcc/config/iq2000/iq2000.c (def_builtin): Replace calls to lang_hooks.builtin_function with add_builtin_function. * gcc/config/ia64/ia64.c (def_builtin): Replace calls to lang_hooks.builtin_function with add_builtin_function. * gcc/config/rs6000/rs6000.c (def_builtin): Replace calls to lang_hooks.builtin_function with add_builtin_function. (altivec_init_builtins): Replace calls to lang_hooks.builtin_function with add_builtin_function. * gcc/config/arm/arm.c (def_mbuiltin): Replace calls to lang_hooks.builtin_function with add_builtin_function. (arm_init_tls_builtins): Replace calls to lang_hooks.builtin_function with add_builtin_function. * gcc/config/mips/mips.c (mips_init_builtins): Replace calls to lang_hooks.builtin_function with add_builtin_function. * gcc/config/bfin/bfin.c (def_builtin): Replace calls to lang_hooks.builtin_function with add_builtin_function. * gcc/langhooks-def.h (lhd_builtin_function): New function. (LANG_HOOKS_BUILTIN_FUNCTION): Define as lhd_builtin_function. From-SVN: r117981
2006-10-23 21:47:58 +02:00
umsg_fast_decl = add_builtin_function (TAG_MSGSEND_FAST,
type, 0, NOT_BUILT_IN,
NULL, NULL_TREE);
TREE_NOTHROW (umsg_fast_decl) = 0;
DECL_ATTRIBUTES (umsg_fast_decl)
= tree_cons (get_identifier ("hard_coded_address"),
Yet more Objective-C++... * objc-act.c (objc_finish_try_stmt): Add return value. (objc_build_synchronized): Likewise. * objc-act.c (objc_is_gcable_type): Add. (objc_substitute_decl): Add. (objc_build_ivar_assignment): Add. (objc_build_global_assignment): Add. (objc_build_strong_cast_assignment): Add. (objc_is_ivar_reference_p): Add. (objc_is_global_reference_p): Add. (objc_generate_write_barrier): Add. (objc_rewrite_function_call): Add. (objc_gimplify_expr): Add Objective-C++ support. * objc-act.h (ALLOC_OBJC_TYPE_LANG_SPECIFIC): Likewise. (SIZEOF_OBJC_TYPE_LANG_SPECIFIC): Add. (INIT_TYPE_OBJC_INFO): Add Objective-C++ support. (DUP_TYPE_OBJC_INFO): Likewise. (struct imp_entry): Add field has_cxx_cdtors. (struct imp_entry *imp_list): Add OCTI_UMSG_FAST_DECL, OCTI_METH_LIST_TEMPL, OCTI_METH_PROTO_LIST_TEMPL, OCTI_IVAR_LIST_TEMPL, OCTI_ASSIGN_IVAR_DECL, OCTI_ASSIGN_IVAR_FAST_DECL, OCTI_ASSIGN_GLOBAL_DECL, OCTI_ASSIGN_STRONGCAST_DECL. (umsg_fast_decl): Add. (objc_assign_ivar_decl): Add. (objc_assign_ivar_fast_decl): Add. (objc_assign_global_decl): Add. (objc_assign_strong_cast_decl): Add. (objc_method_list_ptr): Add. (objc_method_proto_list_ptr): Add. (objc_ivar_list_ptr): Add. * objc-act.c (should_call_super_dealloc): Add. (OBJC_VERSION): Bump to 6. (objc_is_gcable_type): Add. (objc_substitute_decl): Add. (objc_build_ivar_assignment): Add. (objc_build_global_assignment): Add. (objc_build_strong_cast_assignment): Add. (objc_is_gcable_p): Add. (objc_is_ivar_reference_p): Add. (objc_is_global_reference_p): Add. (generate_shared_structures): Add flags parameter. (objc_generate_cxx_ctor_or_dtor): Add. (objc_generate_cxx_cdtors): Add. (add_class): Add name parameter. (objc_types_share_size_and_alignment): Add. (comp_proto_with_proto): Add strict parameter. (CLS_HAS_CXX_STRUCTORS): Add. (TAG_ASSIGNIVAR): Add. (TAG_ASSIGNGLOBAL): Add. (TAG_ASSIGNSTRONGCAST): Add. (TAG_MSGSEND_FAST): Add. (TAG_ASSIGNIVAR_FAST): Add. (TAG_CXX_CONSTRUCT): Add. (TAG_CXX_DESTRUCT): Add. (OBJC_LOOKUP_CLASS): Add. (OBJC_LOOKUP_NO_SUPER): Add. (objc_finish_file): Add pch support. (objc_finish_implementation): Add Objective-C++ support. (synth_module_prologue): Likewise. (synth_module_prologue): Add fast dispatching. (objc_get_class_reference): Add Objective-C++ support. (objc_generate_write_barrier): Likewise. (next_sjlj_build_enter_and_setjmp): Likewise. (objc_begin_try_stmt): Likewise. (build_next_objc_exception_stuff): Add fast ivar support. (build_private_template): Mark the record as used so debug information is generated. (build_protocol_template): Add Objective-C++ support. (objc_method_parm_type) Likewise. (objc_generate_cxx_ctor_or_dtor): Likewise. (objc_generate_cxx_cdtors): Likewise. (build_protocol_initializer): Likewise. (build_category_template): Likewise. (build_class_template): Likewise. (build_method_list_template): Likewise. (build_category_initializer): Likewise. (build_shared_structure_initializer): Likewise. (objc_finish_message_expr): Likewise. (build_objc_method_call): Add fast dispatch support. (lookup_method_static): Add support to end search at superclasses. (add_method_to_hash_list): Add strict parameter to comp_proto_with_proto. (objc_add_method): Likewise. (objc_add_method): Also set the interface_value. (add_instance_variable): Add Objective-C++ support. (objc_is_public): Likewise. (start_class): Likewise. (continue_class): Likewise. (encode_aggregate_within): Likewise. (start_method_def): Likewise. (objc_start_function): Clear current_function_returns_value and current_function_returns_null. (really_start_method): Add Objective-C++ support. (objc_finish_method_definition): Add warning for missing [super dealloc]. (finish_objc): Add Objective-C++ support. (generate_objc_image_info): Likewise. (objc_lookup_ivar): Likewise. * objc-act.h (TYPE_HAS_OBJC_INFO): Likewise. (INIT_TYPE_OBJC_INFO): Likewise. (DUP_TYPE_OBJC_INFO): Likewise. From-SVN: r99857
2005-05-17 22:07:08 +02:00
build_int_cst (NULL_TREE, OFFS_MSGSEND_FAST),
NULL_TREE);
#else
/* No direct dispatch availible. */
umsg_fast_decl = umsg_decl;
#endif
/* id objc_msgSendSuper (struct objc_super *, SEL, ...); */
/* id objc_msgSendSuper_stret (struct objc_super *, SEL, ...); */
Makefile.in (c-parse.o): Depend on $(C_COMMON_H). [gcc/ChangeLog] 2004-09-07 Ziemowit Laski <zlaski@apple.com> * Makefile.in (c-parse.o): Depend on $(C_COMMON_H). * c-parse.in: Include c-common.h instead of objc-act.h. (ivar_decl_list, ivar_decls, ivar_decl, ivars, ivar_declarator, myparms, myparm): Remove %type declarations. (methodtype, optparms, OBJC_TYPE_QUAL, objc_quals, objc_qual, objc_typename, objc_try_catch_stmt, optellipsis): Add %type declarations. (objc_inherit_code, objc_public_flag): Remove. (typespec_nonreserved_nonattr): Call objc_get_protocol_qualified_type() instead of get_static_reference() and get_protocol_reference(). (stmt_nocomp): Call grokparm() on @catch parameter. (objcdef): Move semantic action to objc_finish_implementation(). (classdef): Move semantic action to objc_start_class_interface(), objc_continue_interface(), objc_finish_interface(), objc_start_class_implementation(), objc_continue_implementation(), objc_start_category_interface() and objc_start_category_implementation(). (protocoldef): Move semantic actions to objc_start_protocol() and objc_finish_interface(). (ivar_decl_list): Remove nonterminal. (visibility_spec): Move semantic actions to objc_set_visibility(). (ivar_decls): Remove assignment to $$. (ivar_decl): Rephrase in terms of component_decl; call objc_add_instance_variable(). (ivars, ivar_declarator): Remove nonterminals. (opt_semi): New nonterminal. (methodtype): Remove semantic actions. (methoddef): Move semantic actions to objc_set_method_type(), objc_start_method_definition() and objc_finish_method_definition(). (methodproto): Move semantic actions to objc_set_method_type() and objc_add_method_declaration(). (methoddecl): Use objc_typename instead of typename; move semantic actions to objc_build_method_signature(). (optarglist, myxdecls, mydecl, myparms, myparm): Remove nonterminals. (optparmlist): Express in terms of optparms and optellipsis. (optparms, optellipsis, objc_qual, objc_quals, objc_typename): New nonterminals. (keyworddecl): Use objc_typename instead of typename. (rid_to_yy): Mark RID_IN, RID_OUT, RID_INOUT, RID_BYCOPY, RID_BYREF and RID_ONEWAY as returning OBJC_TYPE_QUAL to yyparse(). [gcc/objc/ChangeLog] 2004-09-07 Ziemowit Laski <zlaski@apple.com> * Make-lang.in (objc/objc-parse.o): Depend on $(C_COMMON_H) instead of objc/objc-act.h. (objc/objc-act.o): Depend on $(HASHTAB_H). * objc-act.c: Include hashtab.h; in ObjC++ mode, include cp-tree.h and objcp-decl.h instead of c-tree.h. (build_module_descriptor, get_class_ivars, synth_id_with_class_suffix, error_with_ivar, gen_method_decl, gen_declaration, setup_string_decl, build_protocol_template): Adjust prototypes. (build_module_initializer_routine, start_class, continue_class, finish_class, start_method_def, objc_start_function, start_protocol, build_method_decl, objc_add_method, add_instance_variable, build_ivar_reference, is_ivar, is_private, get_super_receiver, build_selector_table_decl, objc_push_parm, objc_get_parm_info, gen_type_name, gen_type_name_0, start_var_decl, finish_var_decl, create_field_decl): New prototypes. (objc_expand_function_end, comp_method_with_proto, objc_expr_last, gen_declaration_1, gen_declarator, is_complex_decl, adorn_decl, define_decl, create_builtin_decl, gen_declspecs): Remove prototypes. (TYPE_ID): Rename to OBJECT_TYPEDEF_NAME. (CLASS_TYPEDEF_NAME): New. (TAG_EXECCLASS): Change from a global variable to a #define. (TAG_RETURN_STRUCT): Delete. (TAG_GNUINIT): New, holds '__objc_gnu_init' name. (objc_inherit_code, objc_public_flag): New, moved from c-parse.in. (string_descriptor): New struct. (string_htab): New hash table. (string_hash, string_eq): New prototypes. (generate_struct_by_value_array): Call create_field_decl() instead of create_builtin_decl(). (objc_init): Do not initialize objc_ellipsis_node or TAG_EXECCLASS; In ObjC++ mode, call cxx_init() instead of c_objc_common_init(). (objc_finish_file): In ObjC++, call instantiate_pending_templates() and cp_finish_file(). (define_decl, get_static_reference, get_protocol_reference, create_builtin_decl): Remove functions. (objc_start_class_interface, objc_start_category_interface, objc_start_protocol, objc_continue_interface, objc_finish_interface, objc_start_class_implementation, objc_start_category_implementation, objc_continue_implementation, objc_finish_implementation, objc_set_visibility, objc_set_method_type, objc_build_method_signature, objc_add_method_declaration, objc_start_method_definition, objc_add_instance_variable, objc_get_protocol_qualified_type, create_field_decl, start_var_decl, finish_var_decl): New functions. (setup_string_decl): Simplify since it is only called once. (synth_module_prologue): Call build_class_template(); predefine 'id' and 'Class' as typedefs; rename 'temp_type' to 'type'; disable debug hooks for duration of function; fix GNU runtime messenger signatures to correspond to reality; forward-declare '__objc_exec_class' for the GNU runtime; call build_selector_table_decl(); in ObjC++ mode, generate 'extern "C" { ... }' wrappers around synthesized declarations; call build_protocol_template() and build_category_template(). (string_hash, string_eq): New functions. (objc_build_string_object): Check metaclass correctness only once; store string literals in hash table. (objc_build_constructor): Do not convert initializer elements; adjust for ObjC++ impedance mismatch. (build_objc_symtab_template): Call create_field_decl() instead of create_builtin_decl(). (init_objc_symtab): Add missing conversion to initializer element. (build_metadata_decl): Call start_var_decl() instead of define_decl(). (generate_objc_symtab_decl): Do not call build_category_template(); call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(). (build_module_descriptor): Call create_field_decl() instead of grokfield(); call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(); always mark module descriptor as used; move GNU runtime-specific functionality to build_module_initializer_routine(). (build_module_initializer_routine): New function, broken off of build_module_descriptor(). (objc_static_init_needed_p, objc_generate_static_init_call): New functions. (generate_static_references, generate_strings, build_selector_translation_table, generate_descriptor_table, generate_ivars_list, generate_dispatch_table, generate_category): Call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(); build a type directly instead of via groktypename(). (build_selector_reference_decl, build_selector_table_decl, build_class_reference_decl, build_protocol_reference, generate_objc_image_info): Call start_var_decl() instead of build_decl(). (build_selector_reference): For GNU runtime, do not call build_selector_reference_decl(). (build_selector, build_typed_selector_reference): Always convert result to the selector type. (add_objc_string): Cast return value to 'char *'. (build_method_prototype_template, build_selector_template, build_method_template): Use actual selector type for fields pointing to selectors. (finish_objc): For GNU runtime, call build_module_initializer_routine() after build_module_descriptor(). (generate_protocol_list, generate_shared_structures): Call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(); build a type directly instead of via groktypename(). (synth_id_with_class_suffix): Return a string. (get_arg_type_list): For instance methods, use the instance type for 'self'; do not call groktypename_in_parm_context(). (build_objc_string_decl): Squash redeclaration errors in ObjC++. (objc_is_class_name): Use OBJC_TYPE_NAME instead of TYPE_NAME; handle RECORD_TYPEs in ObjC as well as ObjC++. (objc_is_id): New function. (objc_is_object_ptr): Return the canonical type node. (objc_get_class_ivars): Simplify using get_class_ivars(). (get_class_ivars): Remove second parameter; create a fresh copy of the ivar list for each call; do not check for existence of super class. (objc_eh_runtime_type): Mark #ifndef OBJCPLUS. (objc_init_exceptions): When using SJLJ-style exceptions, require the use of '-fobjc-exceptions' flag; do not require it for DWARF-style exceptions. (objc_build_exc_ptr, next_sjlj_build_try_catch_finally): Use objc_object_type instead of objc_id_type. (objc_begin_catch_clause): Convert the incoming PARM_DECL into a VAR_DECL before placing it in the appropriate scope; do not call define_decl(); adjust call to c_begin_compound_stmt(); use objc_object_type instead of objc_id_type. (build_next_objc_exception_stuff): Call create_field_decl() instead of create_builtin_decl(); construct type directly instead of calling groktypename(); use OBJC_VOID_AT_END to mark end of function parameters. (build_private_template): Adjust call to get_class_ivars(); build a type directly instead of via groktypename(). (build_protocol_template, build_method_prototype_list_template, build_method_prototype_template, build_category_template, build_selector_template, build_class_template, build_super_template, build_ivar_template, build_ivar_list_template, build_method_list_template, build_method_template): Call create_field_decl() instead of grokfield(). (objc_method_parm_type): Do not call groktypename(). (generate_descriptor_table): Call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(). (generate_method_descriptors, build_protocol_initializer, generate_dispatch_tables, build_category_initializer, build_shared_structure_initializer): Do not call groktypename(). (generate_protocols): Call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(); do not call groktypename(). (error_with_ivar): Remove last parameter. (check_ivars): Do not iterate ovar CLASS_RAW_IVARS lists in addition to CLASS_IVARS lists; adjust calls to error_with_ivar(). (generate_ivar_lists): Convert one of the initializer elements; do not call groktypename(). (get_arg_type_list, start_method_def, gen_method_def): Account for new representation of variable arguments and '...' in Objective-C methods; add Objective-C++ impedance matching code. (is_objc_type_qualifier): Remove function. (adjust_type_for_id_default): Simplify; there is no longer a need to wade through declspecs. (lookup_interface, start_class, continue_class, finish_class, start_method_def, start_protocol, build_method_decl, objc_add_method, add_instance_variable, build_ivar_reference, is_ivar, is_private, get_super_receiver, objc_build_finally_epilogue): Make into static functions. (receiver_is_class_object): Use new IS_CLASS() macro. (objc_build_message_expr): Tweak ObjC++ message argument handling; call objc_finish_message_expr() instead of finish_message_expr(). (finish_message_expr): Rename to objc_finish_message_expr(); use OBJC_TYPE_NAME and OBJC_SET_TYPE_NAME macros instead of TYPE_NAME. call gen_type_name() instead of gen_declaration(); call objc_is_id() instead of using IS_ID and IS_CLASS; Use objc_class_name instead of calling get_identifier("Class"); handle CONVERT_EXPRs in receiver. (build_objc_method_call, warn_with_method): Do not call groktypename(). (build_ivar_reference): Call convert() instead of clobbering in a type. (hash_init): Initialize string_htab hash table. (add_instance_variable): Simplify parameter list; do not call grokfield(); do not populate CLASS_IVARS list. (start_class): Check for the existence of super class, if one was specified. (continue_class): Use CLASS_RAW_IVARS rather than CLASS_IVARS; do not call build_class_template(); adjust call to get_class_ivars(); call build_decl(), pushdecl() and finish_decl() instead of define_decl(). (finish_class): Call build_decl(), pushdecl() and finish_decl() instead of define_decl(). (add_protocols): Use PROTOCOL_BINFO_ELTS for the tree vector size. (start_protocol): Do not call build_protocol_template(); use PROTOCOL_BINFO_ELTS for the tree vector size. (encode_type_qualifiers): Do not handle the 'const' qualifier here. (encode_pointer): Encode 'const char *' as 'r*', for backwards compatibility. (encode_array): Use HOST_WIDE_INT_PRINT_DEC instead of "%ld". (encode_type): Handle the 'const' qualifier here. (objc_parmlist): New global variable, sued by objc_push_parm and objc_get_parm_info(). (objc_push_parm, objc_get_parm_info): New functions. (objc_expr_last): Remove function. (synth_self_and_ucmd_args): For instance methods, use the instance type for 'self'; call objc_push_parm() instead of push_parm_decl(). (start_method_def): Do not call push_scope(), declare_parm_level(), pop_scope(), push_parm_decl(), store_parm_decls() or objc_expr_last(); just use objc_push_parm() and objc_get_parm_info(). (comp_method_with_proto): Remove function. (objc_types_are_equivalent): Strip away indirections before comparing underlying types. (comp_proto_with_proto): Do not call groktypename(); types are no longer in raw declspec format. (objc_start_function): New function. (really_start_method): Call comp_proto_with_proto() instead of comp_method_with_proto(); call objc_start_function() instead of hand-crafting a function declarator. (continue_method_def, objc_expand_function_end): Remove functions. (get_super_receiver): Call objc_get_current_scope() instead of get_current_scope(); reference 'super_class' field (instead of 'class'). (finish_method_def): Rename to objc_finish_method_definition() and add a function decl parameter; move method encoding call from objc_expand_function_end(). (is_complex_decl, adorn_decl, gen_declarator, gen_declspecs, gen_declaration_1): Remove functions. (tmpbuf, RAW_DECLSPEC): Remove. (gen_declaration): Remove second parameter; simplify to deal with TYPE_P nodes instead of raw declspecs. (gen_type_name, gen_type_name_0): New functions. (gen_method_decl): Remove second parameter; call gen_type_name() instead of gen_declaration_1(). (dump_interface): Adjust calls to gen_declaration() and gen_method_decl(); do not allocate a separate string buffer. (init_objc): Allocate a larger string buffer to accommodate dump_interface(); adjust call to build_module_descriptor(); add call to build_module_initializer_routine() for the GNU runtime. (generate_classref_translation_entry): Do not call start_decl(); call finish_var_decl() instead of finish_decl(); call convert() instead of build_c_cast(). * objc-act.h (CLASS_OWN_IVARS): Remove accessor. (CLASS_BINFO_ELTS): Reduce from 6 to 5, now that CLASS_OWN_IVARS is gone. (OCTI_GNU_INIT_DECL, GNU_INIT_decl): New. (OCTI_ELLIPSIS_NODE, objc_ellipsis_node): Remove. (OCTI_ID_ID, id_type, objc_id_id): Rename to OCTI_ID_NAME, objc_object_type and objc_object_name, respectively. (OCTI_CLS_REF, OCTI_CLASS_NAME, objc_class_reference, objc_class_name): New. (IS_CLASS): New macro. (IS_ID, IS_SUPER): Robustify. (OCTI_EXECCLASS_DECL, execclass_decl): New. (finish_file, start_class, continue_class, finish_class, start_method_def, continue_method_def, finish_method_def, start_protocol, finish_protocol, objc_build_throw_stmt, objc_build_try_catch_finally_stmt, objc_build_synchronized_prologue, objc_build_synchronized_epilogue, objc_build_try_prologue, objc_build_try_epilogue, objc_build_catch_stmt, objc_build_catch_epilogue, objc_build_finally_prologue, objc_build_finally_epilogue, is_ivar, is_private, is_public, add_instance_variable, objc_add_method, get_super_receiver, objc_clear_super_receiver, get_class_ivars_from_name, get_class_reference, get_static_reference, get_object_reference, build_message_expr, finish_message_expr, build_selector_expr, build_ivar_reference, build_keyword_decl, build_method_decl, build_protocol_expr, build_objc_string_object, objc_declare_alias, objc_declare_class, objc_declare_protocols, objc_comptypes, objc_check_decl, build_encode_expr): Remove prototypes. (imp_count, cat_count): Make GGC-aware. (OBJC_SET_TYPE_NAME): New macro. From-SVN: r87168
2004-09-08 02:49:44 +02:00
type
= build_function_type (objc_object_type,
objc-act.h (get_object_reference): Rename to get_protocol_reference. 2004-06-20 David Ayers <d.ayers@inode.at> * objc/objc-act.h (get_object_reference): Rename to get_protocol_reference. (super_type): Rename to objc_super_type. (selector_type): Rename to objc_selector_type. (id_type): Rename to objc_id_type. (instance_type): Rename to objc_instance_type. (protocol_type): Rename to objc_protocol_type. (IS_ID): Update reference to id_type. * objc/objc-act.c (get_object_reference): Rename to get_protocol_reference; add documentation; update references to id_type. (lookup_method_in_protocol_list): Rename class_meth to is_class; add documentation. (finish_message_expr): Rename is_class to class_tree. (synth_module_prologue, objc_is_object_ptr, objc_build_exc_ptr, next_sjlj_build_try_catch_finally, objc_begin_catch_clause, build_next_objc_exception_stuff, get_arg_type_list, build_objc_method_call): Update references to id_type. (synth_module_prologue, build_objc_symtab_template, build_selector_reference_decl, build_selector, build_selector_translation_table, build_typed_selector_reference, get_arg_type_list, synth_self_and_ucmd_args, get_arg_type_list, synth_self_and_ucmd_args): Update references to selector_type. (build_private_template, build_ivar_reference): Update references to instance_type. (synth_module_prologue, build_protocol_reference, build_protocol_expr, start_protocol): Update references to protocol_type. (synth_module_prologue, get_arg_type_list, build_objc_method_call): Update references to super_type. * c-parse.in: (typespec_nonreserved_nonattr): Update references to get_object_reference. * objc/objc-tree.def: Add C mode identifier sequence. From-SVN: r83425
2004-06-21 03:50:18 +02:00
tree_cons (NULL_TREE, objc_super_type,
Makefile.in (c-parse.o): Depend on $(C_COMMON_H). [gcc/ChangeLog] 2004-09-07 Ziemowit Laski <zlaski@apple.com> * Makefile.in (c-parse.o): Depend on $(C_COMMON_H). * c-parse.in: Include c-common.h instead of objc-act.h. (ivar_decl_list, ivar_decls, ivar_decl, ivars, ivar_declarator, myparms, myparm): Remove %type declarations. (methodtype, optparms, OBJC_TYPE_QUAL, objc_quals, objc_qual, objc_typename, objc_try_catch_stmt, optellipsis): Add %type declarations. (objc_inherit_code, objc_public_flag): Remove. (typespec_nonreserved_nonattr): Call objc_get_protocol_qualified_type() instead of get_static_reference() and get_protocol_reference(). (stmt_nocomp): Call grokparm() on @catch parameter. (objcdef): Move semantic action to objc_finish_implementation(). (classdef): Move semantic action to objc_start_class_interface(), objc_continue_interface(), objc_finish_interface(), objc_start_class_implementation(), objc_continue_implementation(), objc_start_category_interface() and objc_start_category_implementation(). (protocoldef): Move semantic actions to objc_start_protocol() and objc_finish_interface(). (ivar_decl_list): Remove nonterminal. (visibility_spec): Move semantic actions to objc_set_visibility(). (ivar_decls): Remove assignment to $$. (ivar_decl): Rephrase in terms of component_decl; call objc_add_instance_variable(). (ivars, ivar_declarator): Remove nonterminals. (opt_semi): New nonterminal. (methodtype): Remove semantic actions. (methoddef): Move semantic actions to objc_set_method_type(), objc_start_method_definition() and objc_finish_method_definition(). (methodproto): Move semantic actions to objc_set_method_type() and objc_add_method_declaration(). (methoddecl): Use objc_typename instead of typename; move semantic actions to objc_build_method_signature(). (optarglist, myxdecls, mydecl, myparms, myparm): Remove nonterminals. (optparmlist): Express in terms of optparms and optellipsis. (optparms, optellipsis, objc_qual, objc_quals, objc_typename): New nonterminals. (keyworddecl): Use objc_typename instead of typename. (rid_to_yy): Mark RID_IN, RID_OUT, RID_INOUT, RID_BYCOPY, RID_BYREF and RID_ONEWAY as returning OBJC_TYPE_QUAL to yyparse(). [gcc/objc/ChangeLog] 2004-09-07 Ziemowit Laski <zlaski@apple.com> * Make-lang.in (objc/objc-parse.o): Depend on $(C_COMMON_H) instead of objc/objc-act.h. (objc/objc-act.o): Depend on $(HASHTAB_H). * objc-act.c: Include hashtab.h; in ObjC++ mode, include cp-tree.h and objcp-decl.h instead of c-tree.h. (build_module_descriptor, get_class_ivars, synth_id_with_class_suffix, error_with_ivar, gen_method_decl, gen_declaration, setup_string_decl, build_protocol_template): Adjust prototypes. (build_module_initializer_routine, start_class, continue_class, finish_class, start_method_def, objc_start_function, start_protocol, build_method_decl, objc_add_method, add_instance_variable, build_ivar_reference, is_ivar, is_private, get_super_receiver, build_selector_table_decl, objc_push_parm, objc_get_parm_info, gen_type_name, gen_type_name_0, start_var_decl, finish_var_decl, create_field_decl): New prototypes. (objc_expand_function_end, comp_method_with_proto, objc_expr_last, gen_declaration_1, gen_declarator, is_complex_decl, adorn_decl, define_decl, create_builtin_decl, gen_declspecs): Remove prototypes. (TYPE_ID): Rename to OBJECT_TYPEDEF_NAME. (CLASS_TYPEDEF_NAME): New. (TAG_EXECCLASS): Change from a global variable to a #define. (TAG_RETURN_STRUCT): Delete. (TAG_GNUINIT): New, holds '__objc_gnu_init' name. (objc_inherit_code, objc_public_flag): New, moved from c-parse.in. (string_descriptor): New struct. (string_htab): New hash table. (string_hash, string_eq): New prototypes. (generate_struct_by_value_array): Call create_field_decl() instead of create_builtin_decl(). (objc_init): Do not initialize objc_ellipsis_node or TAG_EXECCLASS; In ObjC++ mode, call cxx_init() instead of c_objc_common_init(). (objc_finish_file): In ObjC++, call instantiate_pending_templates() and cp_finish_file(). (define_decl, get_static_reference, get_protocol_reference, create_builtin_decl): Remove functions. (objc_start_class_interface, objc_start_category_interface, objc_start_protocol, objc_continue_interface, objc_finish_interface, objc_start_class_implementation, objc_start_category_implementation, objc_continue_implementation, objc_finish_implementation, objc_set_visibility, objc_set_method_type, objc_build_method_signature, objc_add_method_declaration, objc_start_method_definition, objc_add_instance_variable, objc_get_protocol_qualified_type, create_field_decl, start_var_decl, finish_var_decl): New functions. (setup_string_decl): Simplify since it is only called once. (synth_module_prologue): Call build_class_template(); predefine 'id' and 'Class' as typedefs; rename 'temp_type' to 'type'; disable debug hooks for duration of function; fix GNU runtime messenger signatures to correspond to reality; forward-declare '__objc_exec_class' for the GNU runtime; call build_selector_table_decl(); in ObjC++ mode, generate 'extern "C" { ... }' wrappers around synthesized declarations; call build_protocol_template() and build_category_template(). (string_hash, string_eq): New functions. (objc_build_string_object): Check metaclass correctness only once; store string literals in hash table. (objc_build_constructor): Do not convert initializer elements; adjust for ObjC++ impedance mismatch. (build_objc_symtab_template): Call create_field_decl() instead of create_builtin_decl(). (init_objc_symtab): Add missing conversion to initializer element. (build_metadata_decl): Call start_var_decl() instead of define_decl(). (generate_objc_symtab_decl): Do not call build_category_template(); call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(). (build_module_descriptor): Call create_field_decl() instead of grokfield(); call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(); always mark module descriptor as used; move GNU runtime-specific functionality to build_module_initializer_routine(). (build_module_initializer_routine): New function, broken off of build_module_descriptor(). (objc_static_init_needed_p, objc_generate_static_init_call): New functions. (generate_static_references, generate_strings, build_selector_translation_table, generate_descriptor_table, generate_ivars_list, generate_dispatch_table, generate_category): Call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(); build a type directly instead of via groktypename(). (build_selector_reference_decl, build_selector_table_decl, build_class_reference_decl, build_protocol_reference, generate_objc_image_info): Call start_var_decl() instead of build_decl(). (build_selector_reference): For GNU runtime, do not call build_selector_reference_decl(). (build_selector, build_typed_selector_reference): Always convert result to the selector type. (add_objc_string): Cast return value to 'char *'. (build_method_prototype_template, build_selector_template, build_method_template): Use actual selector type for fields pointing to selectors. (finish_objc): For GNU runtime, call build_module_initializer_routine() after build_module_descriptor(). (generate_protocol_list, generate_shared_structures): Call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(); build a type directly instead of via groktypename(). (synth_id_with_class_suffix): Return a string. (get_arg_type_list): For instance methods, use the instance type for 'self'; do not call groktypename_in_parm_context(). (build_objc_string_decl): Squash redeclaration errors in ObjC++. (objc_is_class_name): Use OBJC_TYPE_NAME instead of TYPE_NAME; handle RECORD_TYPEs in ObjC as well as ObjC++. (objc_is_id): New function. (objc_is_object_ptr): Return the canonical type node. (objc_get_class_ivars): Simplify using get_class_ivars(). (get_class_ivars): Remove second parameter; create a fresh copy of the ivar list for each call; do not check for existence of super class. (objc_eh_runtime_type): Mark #ifndef OBJCPLUS. (objc_init_exceptions): When using SJLJ-style exceptions, require the use of '-fobjc-exceptions' flag; do not require it for DWARF-style exceptions. (objc_build_exc_ptr, next_sjlj_build_try_catch_finally): Use objc_object_type instead of objc_id_type. (objc_begin_catch_clause): Convert the incoming PARM_DECL into a VAR_DECL before placing it in the appropriate scope; do not call define_decl(); adjust call to c_begin_compound_stmt(); use objc_object_type instead of objc_id_type. (build_next_objc_exception_stuff): Call create_field_decl() instead of create_builtin_decl(); construct type directly instead of calling groktypename(); use OBJC_VOID_AT_END to mark end of function parameters. (build_private_template): Adjust call to get_class_ivars(); build a type directly instead of via groktypename(). (build_protocol_template, build_method_prototype_list_template, build_method_prototype_template, build_category_template, build_selector_template, build_class_template, build_super_template, build_ivar_template, build_ivar_list_template, build_method_list_template, build_method_template): Call create_field_decl() instead of grokfield(). (objc_method_parm_type): Do not call groktypename(). (generate_descriptor_table): Call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(). (generate_method_descriptors, build_protocol_initializer, generate_dispatch_tables, build_category_initializer, build_shared_structure_initializer): Do not call groktypename(). (generate_protocols): Call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(); do not call groktypename(). (error_with_ivar): Remove last parameter. (check_ivars): Do not iterate ovar CLASS_RAW_IVARS lists in addition to CLASS_IVARS lists; adjust calls to error_with_ivar(). (generate_ivar_lists): Convert one of the initializer elements; do not call groktypename(). (get_arg_type_list, start_method_def, gen_method_def): Account for new representation of variable arguments and '...' in Objective-C methods; add Objective-C++ impedance matching code. (is_objc_type_qualifier): Remove function. (adjust_type_for_id_default): Simplify; there is no longer a need to wade through declspecs. (lookup_interface, start_class, continue_class, finish_class, start_method_def, start_protocol, build_method_decl, objc_add_method, add_instance_variable, build_ivar_reference, is_ivar, is_private, get_super_receiver, objc_build_finally_epilogue): Make into static functions. (receiver_is_class_object): Use new IS_CLASS() macro. (objc_build_message_expr): Tweak ObjC++ message argument handling; call objc_finish_message_expr() instead of finish_message_expr(). (finish_message_expr): Rename to objc_finish_message_expr(); use OBJC_TYPE_NAME and OBJC_SET_TYPE_NAME macros instead of TYPE_NAME. call gen_type_name() instead of gen_declaration(); call objc_is_id() instead of using IS_ID and IS_CLASS; Use objc_class_name instead of calling get_identifier("Class"); handle CONVERT_EXPRs in receiver. (build_objc_method_call, warn_with_method): Do not call groktypename(). (build_ivar_reference): Call convert() instead of clobbering in a type. (hash_init): Initialize string_htab hash table. (add_instance_variable): Simplify parameter list; do not call grokfield(); do not populate CLASS_IVARS list. (start_class): Check for the existence of super class, if one was specified. (continue_class): Use CLASS_RAW_IVARS rather than CLASS_IVARS; do not call build_class_template(); adjust call to get_class_ivars(); call build_decl(), pushdecl() and finish_decl() instead of define_decl(). (finish_class): Call build_decl(), pushdecl() and finish_decl() instead of define_decl(). (add_protocols): Use PROTOCOL_BINFO_ELTS for the tree vector size. (start_protocol): Do not call build_protocol_template(); use PROTOCOL_BINFO_ELTS for the tree vector size. (encode_type_qualifiers): Do not handle the 'const' qualifier here. (encode_pointer): Encode 'const char *' as 'r*', for backwards compatibility. (encode_array): Use HOST_WIDE_INT_PRINT_DEC instead of "%ld". (encode_type): Handle the 'const' qualifier here. (objc_parmlist): New global variable, sued by objc_push_parm and objc_get_parm_info(). (objc_push_parm, objc_get_parm_info): New functions. (objc_expr_last): Remove function. (synth_self_and_ucmd_args): For instance methods, use the instance type for 'self'; call objc_push_parm() instead of push_parm_decl(). (start_method_def): Do not call push_scope(), declare_parm_level(), pop_scope(), push_parm_decl(), store_parm_decls() or objc_expr_last(); just use objc_push_parm() and objc_get_parm_info(). (comp_method_with_proto): Remove function. (objc_types_are_equivalent): Strip away indirections before comparing underlying types. (comp_proto_with_proto): Do not call groktypename(); types are no longer in raw declspec format. (objc_start_function): New function. (really_start_method): Call comp_proto_with_proto() instead of comp_method_with_proto(); call objc_start_function() instead of hand-crafting a function declarator. (continue_method_def, objc_expand_function_end): Remove functions. (get_super_receiver): Call objc_get_current_scope() instead of get_current_scope(); reference 'super_class' field (instead of 'class'). (finish_method_def): Rename to objc_finish_method_definition() and add a function decl parameter; move method encoding call from objc_expand_function_end(). (is_complex_decl, adorn_decl, gen_declarator, gen_declspecs, gen_declaration_1): Remove functions. (tmpbuf, RAW_DECLSPEC): Remove. (gen_declaration): Remove second parameter; simplify to deal with TYPE_P nodes instead of raw declspecs. (gen_type_name, gen_type_name_0): New functions. (gen_method_decl): Remove second parameter; call gen_type_name() instead of gen_declaration_1(). (dump_interface): Adjust calls to gen_declaration() and gen_method_decl(); do not allocate a separate string buffer. (init_objc): Allocate a larger string buffer to accommodate dump_interface(); adjust call to build_module_descriptor(); add call to build_module_initializer_routine() for the GNU runtime. (generate_classref_translation_entry): Do not call start_decl(); call finish_var_decl() instead of finish_decl(); call convert() instead of build_c_cast(). * objc-act.h (CLASS_OWN_IVARS): Remove accessor. (CLASS_BINFO_ELTS): Reduce from 6 to 5, now that CLASS_OWN_IVARS is gone. (OCTI_GNU_INIT_DECL, GNU_INIT_decl): New. (OCTI_ELLIPSIS_NODE, objc_ellipsis_node): Remove. (OCTI_ID_ID, id_type, objc_id_id): Rename to OCTI_ID_NAME, objc_object_type and objc_object_name, respectively. (OCTI_CLS_REF, OCTI_CLASS_NAME, objc_class_reference, objc_class_name): New. (IS_CLASS): New macro. (IS_ID, IS_SUPER): Robustify. (OCTI_EXECCLASS_DECL, execclass_decl): New. (finish_file, start_class, continue_class, finish_class, start_method_def, continue_method_def, finish_method_def, start_protocol, finish_protocol, objc_build_throw_stmt, objc_build_try_catch_finally_stmt, objc_build_synchronized_prologue, objc_build_synchronized_epilogue, objc_build_try_prologue, objc_build_try_epilogue, objc_build_catch_stmt, objc_build_catch_epilogue, objc_build_finally_prologue, objc_build_finally_epilogue, is_ivar, is_private, is_public, add_instance_variable, objc_add_method, get_super_receiver, objc_clear_super_receiver, get_class_ivars_from_name, get_class_reference, get_static_reference, get_object_reference, build_message_expr, finish_message_expr, build_selector_expr, build_ivar_reference, build_keyword_decl, build_method_decl, build_protocol_expr, build_objc_string_object, objc_declare_alias, objc_declare_class, objc_declare_protocols, objc_comptypes, objc_check_decl, build_encode_expr): Remove prototypes. (imp_count, cat_count): Make GGC-aware. (OBJC_SET_TYPE_NAME): New macro. From-SVN: r87168
2004-09-08 02:49:44 +02:00
tree_cons (NULL_TREE, objc_selector_type,
NULL_TREE)));
decl.c: Include langhooks.h. * gcc/java/decl.c: Include langhooks.h. (builtin_function): Remove. (java_init_decl_processing): Replace calls to builtin_function with add_builtin_function. * gcc/java/Make-lang.in (jc1$(exeext)): Depend on and link with attribs.o. (java/decl.o): Depend on langhooks.h. * gcc/java/java-tree.h (builtin_function): Remove. * gcc/tree.c (local_define_builtin): Replace calls to lang_hooks.builtin_function with add_builtin_function. * gcc/objc/objc-act.c (synth_module_prologue): Replace calls to builtin_function with add_builtin_function. (build_next_objc_exception_stuff): Replace calls to builtin_function with add_builtin_function. (build_objc_exception_stuff): Replace calls to builtin_function with add_builtin_function. * gcc/objcp/objcp-decl.h (objcp_builtin_function): Remove. * gcc/cp/decl.c (builtin_function_1): Move common code to add_builtin_function. (builtin_function): Rename to cxx_builtin_function. Change the signature. * gcc/cp/call.c: Include langhooks.h. (build_java_interface_fn_ref): Replace calls to builtin_function with add_builtin_function. * gcc/cp/Make-lang.in (cp/call.o): Depend on langhooks.h. * gcc/cp/cp-objcp-common.h (LANG_HOOKS_BUILTIN_FUNCTION): Define as cxx_builtin_function. * gcc/cp/cp-tree.h (builtin_function): Rename to cxx_builtin_function. Change the signature. * gcc/c-objc-common.h (LANG_HOOKS_BUILTIN_FUNCTION): Define as c_builtin_function. * gcc/c-tree.h (builtin_function): Rename to c_builtin_function. Change the signature. * gcc/ada/utils.c (builtin_function): Rename to gnat_builtin_function. Move common code to add_builtin_function. * gcc/ada/misc.c (LANG_HOOKS_BUILTIN_FUNCTION): Define as gnat_builtin_function. * gcc/ada/gigi.h (builtin_function): Rename to gnat_builtin_function. Change the signature. * gcc/c-decl.c (builtin_function): Rename to c_builtin_function. Move common code to add_builtin_function. * gcc/fortran/Make-lang.in (f951$(exeext)): Depend on and link with attribs.o. * gcc/fortran/trans.h (builtin_function): Rename to gfc_builtin_function. Change the signature. * gcc/fortran/f95-lang.c (LANG_HOOKS_BUILTIN_FUNCTION): Define as gfc_builtin_function. (builtin_function): Rename to gfc_builtin_function. Move common code to builtin_function. (gfc_define_builtin): Replace calls to builtin_function with gfc_define_builtin. * gcc/langhooks.c (add_builtin_function): New function. (lhd_builtin_function): New function. * gcc/langhooks.h (struct lang_hooks): Change the signature of builtin_function. (add_builtin_function): New function. * gcc/treelang/treetree.c (builtin_function): Remove. * gcc/tree-ssa-loop-prefetch.c (tree_ssa_prefetch_arrays): Replace calls to lang_hooks.builtin_function with add_builtin_function. * gcc/c-common.c (decl_builtin_1): Replace calls to lang_hooks.builtin_function with add_builtin_function. * gcc/config/alpha/alpha.c (alpha_init_builtins): Replace calls to lang_hooks.builtin_function with add_builtin_function. * gcc/config/frv/frv.c (def_builtin): Replace calls to lang_hooks.builtin_function with add_builtin_function. * gcc/config/s390/s390.c (s390_init_builtins): Replace calls to lang_hooks.builtin_function with add_builtin_function. * gcc/config/sparc/sparc.c (def_builtin): Replace calls to lang_hooks.builtin_function with add_builtin_function. * gcc/config/i386/i386.c (def_builtin): Replace calls to lang_hooks.builtin_function with add_builtin_function. (def_builtin): Replace calls to lang_hooks.builtin_function with add_builtin_function. * gcc/config/sh/sh.c (sh_media_init_builtins): Replace calls to lang_hooks.builtin_function with add_builtin_function. * gcc/config/c4x/c4x.c (c4x_init_builtins): Replace calls to lang_hooks.builtin_function with add_builtin_function. * gcc/config/stormy16/stormy16.c (xstormy16_init_builtins): Replace calls to lang_hooks.builtin_function with add_builtin_function. * gcc/config/iq2000/iq2000.c (def_builtin): Replace calls to lang_hooks.builtin_function with add_builtin_function. * gcc/config/ia64/ia64.c (def_builtin): Replace calls to lang_hooks.builtin_function with add_builtin_function. * gcc/config/rs6000/rs6000.c (def_builtin): Replace calls to lang_hooks.builtin_function with add_builtin_function. (altivec_init_builtins): Replace calls to lang_hooks.builtin_function with add_builtin_function. * gcc/config/arm/arm.c (def_mbuiltin): Replace calls to lang_hooks.builtin_function with add_builtin_function. (arm_init_tls_builtins): Replace calls to lang_hooks.builtin_function with add_builtin_function. * gcc/config/mips/mips.c (mips_init_builtins): Replace calls to lang_hooks.builtin_function with add_builtin_function. * gcc/config/bfin/bfin.c (def_builtin): Replace calls to lang_hooks.builtin_function with add_builtin_function. * gcc/langhooks-def.h (lhd_builtin_function): New function. (LANG_HOOKS_BUILTIN_FUNCTION): Define as lhd_builtin_function. From-SVN: r117981
2006-10-23 21:47:58 +02:00
umsg_super_decl = add_builtin_function (TAG_MSGSENDSUPER,
type, 0, NOT_BUILT_IN,
NULL, NULL_TREE);
umsg_super_stret_decl = add_builtin_function (TAG_MSGSENDSUPER_STRET,
type, 0, NOT_BUILT_IN, 0,
NULL_TREE);
TREE_NOTHROW (umsg_super_decl) = 0;
TREE_NOTHROW (umsg_super_stret_decl) = 0;
}
else
{
/* GNU runtime messenger entry points. */
/* typedef id (*IMP)(id, SEL, ...); */
tree IMP_type
= build_pointer_type
(build_function_type (objc_object_type,
tree_cons (NULL_TREE, objc_object_type,
tree_cons (NULL_TREE, objc_selector_type,
NULL_TREE))));
/* IMP objc_msg_lookup (id, SEL); */
Makefile.in (c-parse.o): Depend on $(C_COMMON_H). [gcc/ChangeLog] 2004-09-07 Ziemowit Laski <zlaski@apple.com> * Makefile.in (c-parse.o): Depend on $(C_COMMON_H). * c-parse.in: Include c-common.h instead of objc-act.h. (ivar_decl_list, ivar_decls, ivar_decl, ivars, ivar_declarator, myparms, myparm): Remove %type declarations. (methodtype, optparms, OBJC_TYPE_QUAL, objc_quals, objc_qual, objc_typename, objc_try_catch_stmt, optellipsis): Add %type declarations. (objc_inherit_code, objc_public_flag): Remove. (typespec_nonreserved_nonattr): Call objc_get_protocol_qualified_type() instead of get_static_reference() and get_protocol_reference(). (stmt_nocomp): Call grokparm() on @catch parameter. (objcdef): Move semantic action to objc_finish_implementation(). (classdef): Move semantic action to objc_start_class_interface(), objc_continue_interface(), objc_finish_interface(), objc_start_class_implementation(), objc_continue_implementation(), objc_start_category_interface() and objc_start_category_implementation(). (protocoldef): Move semantic actions to objc_start_protocol() and objc_finish_interface(). (ivar_decl_list): Remove nonterminal. (visibility_spec): Move semantic actions to objc_set_visibility(). (ivar_decls): Remove assignment to $$. (ivar_decl): Rephrase in terms of component_decl; call objc_add_instance_variable(). (ivars, ivar_declarator): Remove nonterminals. (opt_semi): New nonterminal. (methodtype): Remove semantic actions. (methoddef): Move semantic actions to objc_set_method_type(), objc_start_method_definition() and objc_finish_method_definition(). (methodproto): Move semantic actions to objc_set_method_type() and objc_add_method_declaration(). (methoddecl): Use objc_typename instead of typename; move semantic actions to objc_build_method_signature(). (optarglist, myxdecls, mydecl, myparms, myparm): Remove nonterminals. (optparmlist): Express in terms of optparms and optellipsis. (optparms, optellipsis, objc_qual, objc_quals, objc_typename): New nonterminals. (keyworddecl): Use objc_typename instead of typename. (rid_to_yy): Mark RID_IN, RID_OUT, RID_INOUT, RID_BYCOPY, RID_BYREF and RID_ONEWAY as returning OBJC_TYPE_QUAL to yyparse(). [gcc/objc/ChangeLog] 2004-09-07 Ziemowit Laski <zlaski@apple.com> * Make-lang.in (objc/objc-parse.o): Depend on $(C_COMMON_H) instead of objc/objc-act.h. (objc/objc-act.o): Depend on $(HASHTAB_H). * objc-act.c: Include hashtab.h; in ObjC++ mode, include cp-tree.h and objcp-decl.h instead of c-tree.h. (build_module_descriptor, get_class_ivars, synth_id_with_class_suffix, error_with_ivar, gen_method_decl, gen_declaration, setup_string_decl, build_protocol_template): Adjust prototypes. (build_module_initializer_routine, start_class, continue_class, finish_class, start_method_def, objc_start_function, start_protocol, build_method_decl, objc_add_method, add_instance_variable, build_ivar_reference, is_ivar, is_private, get_super_receiver, build_selector_table_decl, objc_push_parm, objc_get_parm_info, gen_type_name, gen_type_name_0, start_var_decl, finish_var_decl, create_field_decl): New prototypes. (objc_expand_function_end, comp_method_with_proto, objc_expr_last, gen_declaration_1, gen_declarator, is_complex_decl, adorn_decl, define_decl, create_builtin_decl, gen_declspecs): Remove prototypes. (TYPE_ID): Rename to OBJECT_TYPEDEF_NAME. (CLASS_TYPEDEF_NAME): New. (TAG_EXECCLASS): Change from a global variable to a #define. (TAG_RETURN_STRUCT): Delete. (TAG_GNUINIT): New, holds '__objc_gnu_init' name. (objc_inherit_code, objc_public_flag): New, moved from c-parse.in. (string_descriptor): New struct. (string_htab): New hash table. (string_hash, string_eq): New prototypes. (generate_struct_by_value_array): Call create_field_decl() instead of create_builtin_decl(). (objc_init): Do not initialize objc_ellipsis_node or TAG_EXECCLASS; In ObjC++ mode, call cxx_init() instead of c_objc_common_init(). (objc_finish_file): In ObjC++, call instantiate_pending_templates() and cp_finish_file(). (define_decl, get_static_reference, get_protocol_reference, create_builtin_decl): Remove functions. (objc_start_class_interface, objc_start_category_interface, objc_start_protocol, objc_continue_interface, objc_finish_interface, objc_start_class_implementation, objc_start_category_implementation, objc_continue_implementation, objc_finish_implementation, objc_set_visibility, objc_set_method_type, objc_build_method_signature, objc_add_method_declaration, objc_start_method_definition, objc_add_instance_variable, objc_get_protocol_qualified_type, create_field_decl, start_var_decl, finish_var_decl): New functions. (setup_string_decl): Simplify since it is only called once. (synth_module_prologue): Call build_class_template(); predefine 'id' and 'Class' as typedefs; rename 'temp_type' to 'type'; disable debug hooks for duration of function; fix GNU runtime messenger signatures to correspond to reality; forward-declare '__objc_exec_class' for the GNU runtime; call build_selector_table_decl(); in ObjC++ mode, generate 'extern "C" { ... }' wrappers around synthesized declarations; call build_protocol_template() and build_category_template(). (string_hash, string_eq): New functions. (objc_build_string_object): Check metaclass correctness only once; store string literals in hash table. (objc_build_constructor): Do not convert initializer elements; adjust for ObjC++ impedance mismatch. (build_objc_symtab_template): Call create_field_decl() instead of create_builtin_decl(). (init_objc_symtab): Add missing conversion to initializer element. (build_metadata_decl): Call start_var_decl() instead of define_decl(). (generate_objc_symtab_decl): Do not call build_category_template(); call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(). (build_module_descriptor): Call create_field_decl() instead of grokfield(); call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(); always mark module descriptor as used; move GNU runtime-specific functionality to build_module_initializer_routine(). (build_module_initializer_routine): New function, broken off of build_module_descriptor(). (objc_static_init_needed_p, objc_generate_static_init_call): New functions. (generate_static_references, generate_strings, build_selector_translation_table, generate_descriptor_table, generate_ivars_list, generate_dispatch_table, generate_category): Call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(); build a type directly instead of via groktypename(). (build_selector_reference_decl, build_selector_table_decl, build_class_reference_decl, build_protocol_reference, generate_objc_image_info): Call start_var_decl() instead of build_decl(). (build_selector_reference): For GNU runtime, do not call build_selector_reference_decl(). (build_selector, build_typed_selector_reference): Always convert result to the selector type. (add_objc_string): Cast return value to 'char *'. (build_method_prototype_template, build_selector_template, build_method_template): Use actual selector type for fields pointing to selectors. (finish_objc): For GNU runtime, call build_module_initializer_routine() after build_module_descriptor(). (generate_protocol_list, generate_shared_structures): Call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(); build a type directly instead of via groktypename(). (synth_id_with_class_suffix): Return a string. (get_arg_type_list): For instance methods, use the instance type for 'self'; do not call groktypename_in_parm_context(). (build_objc_string_decl): Squash redeclaration errors in ObjC++. (objc_is_class_name): Use OBJC_TYPE_NAME instead of TYPE_NAME; handle RECORD_TYPEs in ObjC as well as ObjC++. (objc_is_id): New function. (objc_is_object_ptr): Return the canonical type node. (objc_get_class_ivars): Simplify using get_class_ivars(). (get_class_ivars): Remove second parameter; create a fresh copy of the ivar list for each call; do not check for existence of super class. (objc_eh_runtime_type): Mark #ifndef OBJCPLUS. (objc_init_exceptions): When using SJLJ-style exceptions, require the use of '-fobjc-exceptions' flag; do not require it for DWARF-style exceptions. (objc_build_exc_ptr, next_sjlj_build_try_catch_finally): Use objc_object_type instead of objc_id_type. (objc_begin_catch_clause): Convert the incoming PARM_DECL into a VAR_DECL before placing it in the appropriate scope; do not call define_decl(); adjust call to c_begin_compound_stmt(); use objc_object_type instead of objc_id_type. (build_next_objc_exception_stuff): Call create_field_decl() instead of create_builtin_decl(); construct type directly instead of calling groktypename(); use OBJC_VOID_AT_END to mark end of function parameters. (build_private_template): Adjust call to get_class_ivars(); build a type directly instead of via groktypename(). (build_protocol_template, build_method_prototype_list_template, build_method_prototype_template, build_category_template, build_selector_template, build_class_template, build_super_template, build_ivar_template, build_ivar_list_template, build_method_list_template, build_method_template): Call create_field_decl() instead of grokfield(). (objc_method_parm_type): Do not call groktypename(). (generate_descriptor_table): Call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(). (generate_method_descriptors, build_protocol_initializer, generate_dispatch_tables, build_category_initializer, build_shared_structure_initializer): Do not call groktypename(). (generate_protocols): Call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(); do not call groktypename(). (error_with_ivar): Remove last parameter. (check_ivars): Do not iterate ovar CLASS_RAW_IVARS lists in addition to CLASS_IVARS lists; adjust calls to error_with_ivar(). (generate_ivar_lists): Convert one of the initializer elements; do not call groktypename(). (get_arg_type_list, start_method_def, gen_method_def): Account for new representation of variable arguments and '...' in Objective-C methods; add Objective-C++ impedance matching code. (is_objc_type_qualifier): Remove function. (adjust_type_for_id_default): Simplify; there is no longer a need to wade through declspecs. (lookup_interface, start_class, continue_class, finish_class, start_method_def, start_protocol, build_method_decl, objc_add_method, add_instance_variable, build_ivar_reference, is_ivar, is_private, get_super_receiver, objc_build_finally_epilogue): Make into static functions. (receiver_is_class_object): Use new IS_CLASS() macro. (objc_build_message_expr): Tweak ObjC++ message argument handling; call objc_finish_message_expr() instead of finish_message_expr(). (finish_message_expr): Rename to objc_finish_message_expr(); use OBJC_TYPE_NAME and OBJC_SET_TYPE_NAME macros instead of TYPE_NAME. call gen_type_name() instead of gen_declaration(); call objc_is_id() instead of using IS_ID and IS_CLASS; Use objc_class_name instead of calling get_identifier("Class"); handle CONVERT_EXPRs in receiver. (build_objc_method_call, warn_with_method): Do not call groktypename(). (build_ivar_reference): Call convert() instead of clobbering in a type. (hash_init): Initialize string_htab hash table. (add_instance_variable): Simplify parameter list; do not call grokfield(); do not populate CLASS_IVARS list. (start_class): Check for the existence of super class, if one was specified. (continue_class): Use CLASS_RAW_IVARS rather than CLASS_IVARS; do not call build_class_template(); adjust call to get_class_ivars(); call build_decl(), pushdecl() and finish_decl() instead of define_decl(). (finish_class): Call build_decl(), pushdecl() and finish_decl() instead of define_decl(). (add_protocols): Use PROTOCOL_BINFO_ELTS for the tree vector size. (start_protocol): Do not call build_protocol_template(); use PROTOCOL_BINFO_ELTS for the tree vector size. (encode_type_qualifiers): Do not handle the 'const' qualifier here. (encode_pointer): Encode 'const char *' as 'r*', for backwards compatibility. (encode_array): Use HOST_WIDE_INT_PRINT_DEC instead of "%ld". (encode_type): Handle the 'const' qualifier here. (objc_parmlist): New global variable, sued by objc_push_parm and objc_get_parm_info(). (objc_push_parm, objc_get_parm_info): New functions. (objc_expr_last): Remove function. (synth_self_and_ucmd_args): For instance methods, use the instance type for 'self'; call objc_push_parm() instead of push_parm_decl(). (start_method_def): Do not call push_scope(), declare_parm_level(), pop_scope(), push_parm_decl(), store_parm_decls() or objc_expr_last(); just use objc_push_parm() and objc_get_parm_info(). (comp_method_with_proto): Remove function. (objc_types_are_equivalent): Strip away indirections before comparing underlying types. (comp_proto_with_proto): Do not call groktypename(); types are no longer in raw declspec format. (objc_start_function): New function. (really_start_method): Call comp_proto_with_proto() instead of comp_method_with_proto(); call objc_start_function() instead of hand-crafting a function declarator. (continue_method_def, objc_expand_function_end): Remove functions. (get_super_receiver): Call objc_get_current_scope() instead of get_current_scope(); reference 'super_class' field (instead of 'class'). (finish_method_def): Rename to objc_finish_method_definition() and add a function decl parameter; move method encoding call from objc_expand_function_end(). (is_complex_decl, adorn_decl, gen_declarator, gen_declspecs, gen_declaration_1): Remove functions. (tmpbuf, RAW_DECLSPEC): Remove. (gen_declaration): Remove second parameter; simplify to deal with TYPE_P nodes instead of raw declspecs. (gen_type_name, gen_type_name_0): New functions. (gen_method_decl): Remove second parameter; call gen_type_name() instead of gen_declaration_1(). (dump_interface): Adjust calls to gen_declaration() and gen_method_decl(); do not allocate a separate string buffer. (init_objc): Allocate a larger string buffer to accommodate dump_interface(); adjust call to build_module_descriptor(); add call to build_module_initializer_routine() for the GNU runtime. (generate_classref_translation_entry): Do not call start_decl(); call finish_var_decl() instead of finish_decl(); call convert() instead of build_c_cast(). * objc-act.h (CLASS_OWN_IVARS): Remove accessor. (CLASS_BINFO_ELTS): Reduce from 6 to 5, now that CLASS_OWN_IVARS is gone. (OCTI_GNU_INIT_DECL, GNU_INIT_decl): New. (OCTI_ELLIPSIS_NODE, objc_ellipsis_node): Remove. (OCTI_ID_ID, id_type, objc_id_id): Rename to OCTI_ID_NAME, objc_object_type and objc_object_name, respectively. (OCTI_CLS_REF, OCTI_CLASS_NAME, objc_class_reference, objc_class_name): New. (IS_CLASS): New macro. (IS_ID, IS_SUPER): Robustify. (OCTI_EXECCLASS_DECL, execclass_decl): New. (finish_file, start_class, continue_class, finish_class, start_method_def, continue_method_def, finish_method_def, start_protocol, finish_protocol, objc_build_throw_stmt, objc_build_try_catch_finally_stmt, objc_build_synchronized_prologue, objc_build_synchronized_epilogue, objc_build_try_prologue, objc_build_try_epilogue, objc_build_catch_stmt, objc_build_catch_epilogue, objc_build_finally_prologue, objc_build_finally_epilogue, is_ivar, is_private, is_public, add_instance_variable, objc_add_method, get_super_receiver, objc_clear_super_receiver, get_class_ivars_from_name, get_class_reference, get_static_reference, get_object_reference, build_message_expr, finish_message_expr, build_selector_expr, build_ivar_reference, build_keyword_decl, build_method_decl, build_protocol_expr, build_objc_string_object, objc_declare_alias, objc_declare_class, objc_declare_protocols, objc_comptypes, objc_check_decl, build_encode_expr): Remove prototypes. (imp_count, cat_count): Make GGC-aware. (OBJC_SET_TYPE_NAME): New macro. From-SVN: r87168
2004-09-08 02:49:44 +02:00
type
= build_function_type (IMP_type,
Makefile.in (c-parse.o): Depend on $(C_COMMON_H). [gcc/ChangeLog] 2004-09-07 Ziemowit Laski <zlaski@apple.com> * Makefile.in (c-parse.o): Depend on $(C_COMMON_H). * c-parse.in: Include c-common.h instead of objc-act.h. (ivar_decl_list, ivar_decls, ivar_decl, ivars, ivar_declarator, myparms, myparm): Remove %type declarations. (methodtype, optparms, OBJC_TYPE_QUAL, objc_quals, objc_qual, objc_typename, objc_try_catch_stmt, optellipsis): Add %type declarations. (objc_inherit_code, objc_public_flag): Remove. (typespec_nonreserved_nonattr): Call objc_get_protocol_qualified_type() instead of get_static_reference() and get_protocol_reference(). (stmt_nocomp): Call grokparm() on @catch parameter. (objcdef): Move semantic action to objc_finish_implementation(). (classdef): Move semantic action to objc_start_class_interface(), objc_continue_interface(), objc_finish_interface(), objc_start_class_implementation(), objc_continue_implementation(), objc_start_category_interface() and objc_start_category_implementation(). (protocoldef): Move semantic actions to objc_start_protocol() and objc_finish_interface(). (ivar_decl_list): Remove nonterminal. (visibility_spec): Move semantic actions to objc_set_visibility(). (ivar_decls): Remove assignment to $$. (ivar_decl): Rephrase in terms of component_decl; call objc_add_instance_variable(). (ivars, ivar_declarator): Remove nonterminals. (opt_semi): New nonterminal. (methodtype): Remove semantic actions. (methoddef): Move semantic actions to objc_set_method_type(), objc_start_method_definition() and objc_finish_method_definition(). (methodproto): Move semantic actions to objc_set_method_type() and objc_add_method_declaration(). (methoddecl): Use objc_typename instead of typename; move semantic actions to objc_build_method_signature(). (optarglist, myxdecls, mydecl, myparms, myparm): Remove nonterminals. (optparmlist): Express in terms of optparms and optellipsis. (optparms, optellipsis, objc_qual, objc_quals, objc_typename): New nonterminals. (keyworddecl): Use objc_typename instead of typename. (rid_to_yy): Mark RID_IN, RID_OUT, RID_INOUT, RID_BYCOPY, RID_BYREF and RID_ONEWAY as returning OBJC_TYPE_QUAL to yyparse(). [gcc/objc/ChangeLog] 2004-09-07 Ziemowit Laski <zlaski@apple.com> * Make-lang.in (objc/objc-parse.o): Depend on $(C_COMMON_H) instead of objc/objc-act.h. (objc/objc-act.o): Depend on $(HASHTAB_H). * objc-act.c: Include hashtab.h; in ObjC++ mode, include cp-tree.h and objcp-decl.h instead of c-tree.h. (build_module_descriptor, get_class_ivars, synth_id_with_class_suffix, error_with_ivar, gen_method_decl, gen_declaration, setup_string_decl, build_protocol_template): Adjust prototypes. (build_module_initializer_routine, start_class, continue_class, finish_class, start_method_def, objc_start_function, start_protocol, build_method_decl, objc_add_method, add_instance_variable, build_ivar_reference, is_ivar, is_private, get_super_receiver, build_selector_table_decl, objc_push_parm, objc_get_parm_info, gen_type_name, gen_type_name_0, start_var_decl, finish_var_decl, create_field_decl): New prototypes. (objc_expand_function_end, comp_method_with_proto, objc_expr_last, gen_declaration_1, gen_declarator, is_complex_decl, adorn_decl, define_decl, create_builtin_decl, gen_declspecs): Remove prototypes. (TYPE_ID): Rename to OBJECT_TYPEDEF_NAME. (CLASS_TYPEDEF_NAME): New. (TAG_EXECCLASS): Change from a global variable to a #define. (TAG_RETURN_STRUCT): Delete. (TAG_GNUINIT): New, holds '__objc_gnu_init' name. (objc_inherit_code, objc_public_flag): New, moved from c-parse.in. (string_descriptor): New struct. (string_htab): New hash table. (string_hash, string_eq): New prototypes. (generate_struct_by_value_array): Call create_field_decl() instead of create_builtin_decl(). (objc_init): Do not initialize objc_ellipsis_node or TAG_EXECCLASS; In ObjC++ mode, call cxx_init() instead of c_objc_common_init(). (objc_finish_file): In ObjC++, call instantiate_pending_templates() and cp_finish_file(). (define_decl, get_static_reference, get_protocol_reference, create_builtin_decl): Remove functions. (objc_start_class_interface, objc_start_category_interface, objc_start_protocol, objc_continue_interface, objc_finish_interface, objc_start_class_implementation, objc_start_category_implementation, objc_continue_implementation, objc_finish_implementation, objc_set_visibility, objc_set_method_type, objc_build_method_signature, objc_add_method_declaration, objc_start_method_definition, objc_add_instance_variable, objc_get_protocol_qualified_type, create_field_decl, start_var_decl, finish_var_decl): New functions. (setup_string_decl): Simplify since it is only called once. (synth_module_prologue): Call build_class_template(); predefine 'id' and 'Class' as typedefs; rename 'temp_type' to 'type'; disable debug hooks for duration of function; fix GNU runtime messenger signatures to correspond to reality; forward-declare '__objc_exec_class' for the GNU runtime; call build_selector_table_decl(); in ObjC++ mode, generate 'extern "C" { ... }' wrappers around synthesized declarations; call build_protocol_template() and build_category_template(). (string_hash, string_eq): New functions. (objc_build_string_object): Check metaclass correctness only once; store string literals in hash table. (objc_build_constructor): Do not convert initializer elements; adjust for ObjC++ impedance mismatch. (build_objc_symtab_template): Call create_field_decl() instead of create_builtin_decl(). (init_objc_symtab): Add missing conversion to initializer element. (build_metadata_decl): Call start_var_decl() instead of define_decl(). (generate_objc_symtab_decl): Do not call build_category_template(); call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(). (build_module_descriptor): Call create_field_decl() instead of grokfield(); call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(); always mark module descriptor as used; move GNU runtime-specific functionality to build_module_initializer_routine(). (build_module_initializer_routine): New function, broken off of build_module_descriptor(). (objc_static_init_needed_p, objc_generate_static_init_call): New functions. (generate_static_references, generate_strings, build_selector_translation_table, generate_descriptor_table, generate_ivars_list, generate_dispatch_table, generate_category): Call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(); build a type directly instead of via groktypename(). (build_selector_reference_decl, build_selector_table_decl, build_class_reference_decl, build_protocol_reference, generate_objc_image_info): Call start_var_decl() instead of build_decl(). (build_selector_reference): For GNU runtime, do not call build_selector_reference_decl(). (build_selector, build_typed_selector_reference): Always convert result to the selector type. (add_objc_string): Cast return value to 'char *'. (build_method_prototype_template, build_selector_template, build_method_template): Use actual selector type for fields pointing to selectors. (finish_objc): For GNU runtime, call build_module_initializer_routine() after build_module_descriptor(). (generate_protocol_list, generate_shared_structures): Call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(); build a type directly instead of via groktypename(). (synth_id_with_class_suffix): Return a string. (get_arg_type_list): For instance methods, use the instance type for 'self'; do not call groktypename_in_parm_context(). (build_objc_string_decl): Squash redeclaration errors in ObjC++. (objc_is_class_name): Use OBJC_TYPE_NAME instead of TYPE_NAME; handle RECORD_TYPEs in ObjC as well as ObjC++. (objc_is_id): New function. (objc_is_object_ptr): Return the canonical type node. (objc_get_class_ivars): Simplify using get_class_ivars(). (get_class_ivars): Remove second parameter; create a fresh copy of the ivar list for each call; do not check for existence of super class. (objc_eh_runtime_type): Mark #ifndef OBJCPLUS. (objc_init_exceptions): When using SJLJ-style exceptions, require the use of '-fobjc-exceptions' flag; do not require it for DWARF-style exceptions. (objc_build_exc_ptr, next_sjlj_build_try_catch_finally): Use objc_object_type instead of objc_id_type. (objc_begin_catch_clause): Convert the incoming PARM_DECL into a VAR_DECL before placing it in the appropriate scope; do not call define_decl(); adjust call to c_begin_compound_stmt(); use objc_object_type instead of objc_id_type. (build_next_objc_exception_stuff): Call create_field_decl() instead of create_builtin_decl(); construct type directly instead of calling groktypename(); use OBJC_VOID_AT_END to mark end of function parameters. (build_private_template): Adjust call to get_class_ivars(); build a type directly instead of via groktypename(). (build_protocol_template, build_method_prototype_list_template, build_method_prototype_template, build_category_template, build_selector_template, build_class_template, build_super_template, build_ivar_template, build_ivar_list_template, build_method_list_template, build_method_template): Call create_field_decl() instead of grokfield(). (objc_method_parm_type): Do not call groktypename(). (generate_descriptor_table): Call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(). (generate_method_descriptors, build_protocol_initializer, generate_dispatch_tables, build_category_initializer, build_shared_structure_initializer): Do not call groktypename(). (generate_protocols): Call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(); do not call groktypename(). (error_with_ivar): Remove last parameter. (check_ivars): Do not iterate ovar CLASS_RAW_IVARS lists in addition to CLASS_IVARS lists; adjust calls to error_with_ivar(). (generate_ivar_lists): Convert one of the initializer elements; do not call groktypename(). (get_arg_type_list, start_method_def, gen_method_def): Account for new representation of variable arguments and '...' in Objective-C methods; add Objective-C++ impedance matching code. (is_objc_type_qualifier): Remove function. (adjust_type_for_id_default): Simplify; there is no longer a need to wade through declspecs. (lookup_interface, start_class, continue_class, finish_class, start_method_def, start_protocol, build_method_decl, objc_add_method, add_instance_variable, build_ivar_reference, is_ivar, is_private, get_super_receiver, objc_build_finally_epilogue): Make into static functions. (receiver_is_class_object): Use new IS_CLASS() macro. (objc_build_message_expr): Tweak ObjC++ message argument handling; call objc_finish_message_expr() instead of finish_message_expr(). (finish_message_expr): Rename to objc_finish_message_expr(); use OBJC_TYPE_NAME and OBJC_SET_TYPE_NAME macros instead of TYPE_NAME. call gen_type_name() instead of gen_declaration(); call objc_is_id() instead of using IS_ID and IS_CLASS; Use objc_class_name instead of calling get_identifier("Class"); handle CONVERT_EXPRs in receiver. (build_objc_method_call, warn_with_method): Do not call groktypename(). (build_ivar_reference): Call convert() instead of clobbering in a type. (hash_init): Initialize string_htab hash table. (add_instance_variable): Simplify parameter list; do not call grokfield(); do not populate CLASS_IVARS list. (start_class): Check for the existence of super class, if one was specified. (continue_class): Use CLASS_RAW_IVARS rather than CLASS_IVARS; do not call build_class_template(); adjust call to get_class_ivars(); call build_decl(), pushdecl() and finish_decl() instead of define_decl(). (finish_class): Call build_decl(), pushdecl() and finish_decl() instead of define_decl(). (add_protocols): Use PROTOCOL_BINFO_ELTS for the tree vector size. (start_protocol): Do not call build_protocol_template(); use PROTOCOL_BINFO_ELTS for the tree vector size. (encode_type_qualifiers): Do not handle the 'const' qualifier here. (encode_pointer): Encode 'const char *' as 'r*', for backwards compatibility. (encode_array): Use HOST_WIDE_INT_PRINT_DEC instead of "%ld". (encode_type): Handle the 'const' qualifier here. (objc_parmlist): New global variable, sued by objc_push_parm and objc_get_parm_info(). (objc_push_parm, objc_get_parm_info): New functions. (objc_expr_last): Remove function. (synth_self_and_ucmd_args): For instance methods, use the instance type for 'self'; call objc_push_parm() instead of push_parm_decl(). (start_method_def): Do not call push_scope(), declare_parm_level(), pop_scope(), push_parm_decl(), store_parm_decls() or objc_expr_last(); just use objc_push_parm() and objc_get_parm_info(). (comp_method_with_proto): Remove function. (objc_types_are_equivalent): Strip away indirections before comparing underlying types. (comp_proto_with_proto): Do not call groktypename(); types are no longer in raw declspec format. (objc_start_function): New function. (really_start_method): Call comp_proto_with_proto() instead of comp_method_with_proto(); call objc_start_function() instead of hand-crafting a function declarator. (continue_method_def, objc_expand_function_end): Remove functions. (get_super_receiver): Call objc_get_current_scope() instead of get_current_scope(); reference 'super_class' field (instead of 'class'). (finish_method_def): Rename to objc_finish_method_definition() and add a function decl parameter; move method encoding call from objc_expand_function_end(). (is_complex_decl, adorn_decl, gen_declarator, gen_declspecs, gen_declaration_1): Remove functions. (tmpbuf, RAW_DECLSPEC): Remove. (gen_declaration): Remove second parameter; simplify to deal with TYPE_P nodes instead of raw declspecs. (gen_type_name, gen_type_name_0): New functions. (gen_method_decl): Remove second parameter; call gen_type_name() instead of gen_declaration_1(). (dump_interface): Adjust calls to gen_declaration() and gen_method_decl(); do not allocate a separate string buffer. (init_objc): Allocate a larger string buffer to accommodate dump_interface(); adjust call to build_module_descriptor(); add call to build_module_initializer_routine() for the GNU runtime. (generate_classref_translation_entry): Do not call start_decl(); call finish_var_decl() instead of finish_decl(); call convert() instead of build_c_cast(). * objc-act.h (CLASS_OWN_IVARS): Remove accessor. (CLASS_BINFO_ELTS): Reduce from 6 to 5, now that CLASS_OWN_IVARS is gone. (OCTI_GNU_INIT_DECL, GNU_INIT_decl): New. (OCTI_ELLIPSIS_NODE, objc_ellipsis_node): Remove. (OCTI_ID_ID, id_type, objc_id_id): Rename to OCTI_ID_NAME, objc_object_type and objc_object_name, respectively. (OCTI_CLS_REF, OCTI_CLASS_NAME, objc_class_reference, objc_class_name): New. (IS_CLASS): New macro. (IS_ID, IS_SUPER): Robustify. (OCTI_EXECCLASS_DECL, execclass_decl): New. (finish_file, start_class, continue_class, finish_class, start_method_def, continue_method_def, finish_method_def, start_protocol, finish_protocol, objc_build_throw_stmt, objc_build_try_catch_finally_stmt, objc_build_synchronized_prologue, objc_build_synchronized_epilogue, objc_build_try_prologue, objc_build_try_epilogue, objc_build_catch_stmt, objc_build_catch_epilogue, objc_build_finally_prologue, objc_build_finally_epilogue, is_ivar, is_private, is_public, add_instance_variable, objc_add_method, get_super_receiver, objc_clear_super_receiver, get_class_ivars_from_name, get_class_reference, get_static_reference, get_object_reference, build_message_expr, finish_message_expr, build_selector_expr, build_ivar_reference, build_keyword_decl, build_method_decl, build_protocol_expr, build_objc_string_object, objc_declare_alias, objc_declare_class, objc_declare_protocols, objc_comptypes, objc_check_decl, build_encode_expr): Remove prototypes. (imp_count, cat_count): Make GGC-aware. (OBJC_SET_TYPE_NAME): New macro. From-SVN: r87168
2004-09-08 02:49:44 +02:00
tree_cons (NULL_TREE, objc_object_type,
tree_cons (NULL_TREE, objc_selector_type,
OBJC_VOID_AT_END)));
decl.c: Include langhooks.h. * gcc/java/decl.c: Include langhooks.h. (builtin_function): Remove. (java_init_decl_processing): Replace calls to builtin_function with add_builtin_function. * gcc/java/Make-lang.in (jc1$(exeext)): Depend on and link with attribs.o. (java/decl.o): Depend on langhooks.h. * gcc/java/java-tree.h (builtin_function): Remove. * gcc/tree.c (local_define_builtin): Replace calls to lang_hooks.builtin_function with add_builtin_function. * gcc/objc/objc-act.c (synth_module_prologue): Replace calls to builtin_function with add_builtin_function. (build_next_objc_exception_stuff): Replace calls to builtin_function with add_builtin_function. (build_objc_exception_stuff): Replace calls to builtin_function with add_builtin_function. * gcc/objcp/objcp-decl.h (objcp_builtin_function): Remove. * gcc/cp/decl.c (builtin_function_1): Move common code to add_builtin_function. (builtin_function): Rename to cxx_builtin_function. Change the signature. * gcc/cp/call.c: Include langhooks.h. (build_java_interface_fn_ref): Replace calls to builtin_function with add_builtin_function. * gcc/cp/Make-lang.in (cp/call.o): Depend on langhooks.h. * gcc/cp/cp-objcp-common.h (LANG_HOOKS_BUILTIN_FUNCTION): Define as cxx_builtin_function. * gcc/cp/cp-tree.h (builtin_function): Rename to cxx_builtin_function. Change the signature. * gcc/c-objc-common.h (LANG_HOOKS_BUILTIN_FUNCTION): Define as c_builtin_function. * gcc/c-tree.h (builtin_function): Rename to c_builtin_function. Change the signature. * gcc/ada/utils.c (builtin_function): Rename to gnat_builtin_function. Move common code to add_builtin_function. * gcc/ada/misc.c (LANG_HOOKS_BUILTIN_FUNCTION): Define as gnat_builtin_function. * gcc/ada/gigi.h (builtin_function): Rename to gnat_builtin_function. Change the signature. * gcc/c-decl.c (builtin_function): Rename to c_builtin_function. Move common code to add_builtin_function. * gcc/fortran/Make-lang.in (f951$(exeext)): Depend on and link with attribs.o. * gcc/fortran/trans.h (builtin_function): Rename to gfc_builtin_function. Change the signature. * gcc/fortran/f95-lang.c (LANG_HOOKS_BUILTIN_FUNCTION): Define as gfc_builtin_function. (builtin_function): Rename to gfc_builtin_function. Move common code to builtin_function. (gfc_define_builtin): Replace calls to builtin_function with gfc_define_builtin. * gcc/langhooks.c (add_builtin_function): New function. (lhd_builtin_function): New function. * gcc/langhooks.h (struct lang_hooks): Change the signature of builtin_function. (add_builtin_function): New function. * gcc/treelang/treetree.c (builtin_function): Remove. * gcc/tree-ssa-loop-prefetch.c (tree_ssa_prefetch_arrays): Replace calls to lang_hooks.builtin_function with add_builtin_function. * gcc/c-common.c (decl_builtin_1): Replace calls to lang_hooks.builtin_function with add_builtin_function. * gcc/config/alpha/alpha.c (alpha_init_builtins): Replace calls to lang_hooks.builtin_function with add_builtin_function. * gcc/config/frv/frv.c (def_builtin): Replace calls to lang_hooks.builtin_function with add_builtin_function. * gcc/config/s390/s390.c (s390_init_builtins): Replace calls to lang_hooks.builtin_function with add_builtin_function. * gcc/config/sparc/sparc.c (def_builtin): Replace calls to lang_hooks.builtin_function with add_builtin_function. * gcc/config/i386/i386.c (def_builtin): Replace calls to lang_hooks.builtin_function with add_builtin_function. (def_builtin): Replace calls to lang_hooks.builtin_function with add_builtin_function. * gcc/config/sh/sh.c (sh_media_init_builtins): Replace calls to lang_hooks.builtin_function with add_builtin_function. * gcc/config/c4x/c4x.c (c4x_init_builtins): Replace calls to lang_hooks.builtin_function with add_builtin_function. * gcc/config/stormy16/stormy16.c (xstormy16_init_builtins): Replace calls to lang_hooks.builtin_function with add_builtin_function. * gcc/config/iq2000/iq2000.c (def_builtin): Replace calls to lang_hooks.builtin_function with add_builtin_function. * gcc/config/ia64/ia64.c (def_builtin): Replace calls to lang_hooks.builtin_function with add_builtin_function. * gcc/config/rs6000/rs6000.c (def_builtin): Replace calls to lang_hooks.builtin_function with add_builtin_function. (altivec_init_builtins): Replace calls to lang_hooks.builtin_function with add_builtin_function. * gcc/config/arm/arm.c (def_mbuiltin): Replace calls to lang_hooks.builtin_function with add_builtin_function. (arm_init_tls_builtins): Replace calls to lang_hooks.builtin_function with add_builtin_function. * gcc/config/mips/mips.c (mips_init_builtins): Replace calls to lang_hooks.builtin_function with add_builtin_function. * gcc/config/bfin/bfin.c (def_builtin): Replace calls to lang_hooks.builtin_function with add_builtin_function. * gcc/langhooks-def.h (lhd_builtin_function): New function. (LANG_HOOKS_BUILTIN_FUNCTION): Define as lhd_builtin_function. From-SVN: r117981
2006-10-23 21:47:58 +02:00
umsg_decl = add_builtin_function (TAG_MSGSEND,
type, 0, NOT_BUILT_IN,
NULL, NULL_TREE);
TREE_NOTHROW (umsg_decl) = 0;
/* IMP objc_msg_lookup_super (struct objc_super *, SEL); */
Makefile.in (c-parse.o): Depend on $(C_COMMON_H). [gcc/ChangeLog] 2004-09-07 Ziemowit Laski <zlaski@apple.com> * Makefile.in (c-parse.o): Depend on $(C_COMMON_H). * c-parse.in: Include c-common.h instead of objc-act.h. (ivar_decl_list, ivar_decls, ivar_decl, ivars, ivar_declarator, myparms, myparm): Remove %type declarations. (methodtype, optparms, OBJC_TYPE_QUAL, objc_quals, objc_qual, objc_typename, objc_try_catch_stmt, optellipsis): Add %type declarations. (objc_inherit_code, objc_public_flag): Remove. (typespec_nonreserved_nonattr): Call objc_get_protocol_qualified_type() instead of get_static_reference() and get_protocol_reference(). (stmt_nocomp): Call grokparm() on @catch parameter. (objcdef): Move semantic action to objc_finish_implementation(). (classdef): Move semantic action to objc_start_class_interface(), objc_continue_interface(), objc_finish_interface(), objc_start_class_implementation(), objc_continue_implementation(), objc_start_category_interface() and objc_start_category_implementation(). (protocoldef): Move semantic actions to objc_start_protocol() and objc_finish_interface(). (ivar_decl_list): Remove nonterminal. (visibility_spec): Move semantic actions to objc_set_visibility(). (ivar_decls): Remove assignment to $$. (ivar_decl): Rephrase in terms of component_decl; call objc_add_instance_variable(). (ivars, ivar_declarator): Remove nonterminals. (opt_semi): New nonterminal. (methodtype): Remove semantic actions. (methoddef): Move semantic actions to objc_set_method_type(), objc_start_method_definition() and objc_finish_method_definition(). (methodproto): Move semantic actions to objc_set_method_type() and objc_add_method_declaration(). (methoddecl): Use objc_typename instead of typename; move semantic actions to objc_build_method_signature(). (optarglist, myxdecls, mydecl, myparms, myparm): Remove nonterminals. (optparmlist): Express in terms of optparms and optellipsis. (optparms, optellipsis, objc_qual, objc_quals, objc_typename): New nonterminals. (keyworddecl): Use objc_typename instead of typename. (rid_to_yy): Mark RID_IN, RID_OUT, RID_INOUT, RID_BYCOPY, RID_BYREF and RID_ONEWAY as returning OBJC_TYPE_QUAL to yyparse(). [gcc/objc/ChangeLog] 2004-09-07 Ziemowit Laski <zlaski@apple.com> * Make-lang.in (objc/objc-parse.o): Depend on $(C_COMMON_H) instead of objc/objc-act.h. (objc/objc-act.o): Depend on $(HASHTAB_H). * objc-act.c: Include hashtab.h; in ObjC++ mode, include cp-tree.h and objcp-decl.h instead of c-tree.h. (build_module_descriptor, get_class_ivars, synth_id_with_class_suffix, error_with_ivar, gen_method_decl, gen_declaration, setup_string_decl, build_protocol_template): Adjust prototypes. (build_module_initializer_routine, start_class, continue_class, finish_class, start_method_def, objc_start_function, start_protocol, build_method_decl, objc_add_method, add_instance_variable, build_ivar_reference, is_ivar, is_private, get_super_receiver, build_selector_table_decl, objc_push_parm, objc_get_parm_info, gen_type_name, gen_type_name_0, start_var_decl, finish_var_decl, create_field_decl): New prototypes. (objc_expand_function_end, comp_method_with_proto, objc_expr_last, gen_declaration_1, gen_declarator, is_complex_decl, adorn_decl, define_decl, create_builtin_decl, gen_declspecs): Remove prototypes. (TYPE_ID): Rename to OBJECT_TYPEDEF_NAME. (CLASS_TYPEDEF_NAME): New. (TAG_EXECCLASS): Change from a global variable to a #define. (TAG_RETURN_STRUCT): Delete. (TAG_GNUINIT): New, holds '__objc_gnu_init' name. (objc_inherit_code, objc_public_flag): New, moved from c-parse.in. (string_descriptor): New struct. (string_htab): New hash table. (string_hash, string_eq): New prototypes. (generate_struct_by_value_array): Call create_field_decl() instead of create_builtin_decl(). (objc_init): Do not initialize objc_ellipsis_node or TAG_EXECCLASS; In ObjC++ mode, call cxx_init() instead of c_objc_common_init(). (objc_finish_file): In ObjC++, call instantiate_pending_templates() and cp_finish_file(). (define_decl, get_static_reference, get_protocol_reference, create_builtin_decl): Remove functions. (objc_start_class_interface, objc_start_category_interface, objc_start_protocol, objc_continue_interface, objc_finish_interface, objc_start_class_implementation, objc_start_category_implementation, objc_continue_implementation, objc_finish_implementation, objc_set_visibility, objc_set_method_type, objc_build_method_signature, objc_add_method_declaration, objc_start_method_definition, objc_add_instance_variable, objc_get_protocol_qualified_type, create_field_decl, start_var_decl, finish_var_decl): New functions. (setup_string_decl): Simplify since it is only called once. (synth_module_prologue): Call build_class_template(); predefine 'id' and 'Class' as typedefs; rename 'temp_type' to 'type'; disable debug hooks for duration of function; fix GNU runtime messenger signatures to correspond to reality; forward-declare '__objc_exec_class' for the GNU runtime; call build_selector_table_decl(); in ObjC++ mode, generate 'extern "C" { ... }' wrappers around synthesized declarations; call build_protocol_template() and build_category_template(). (string_hash, string_eq): New functions. (objc_build_string_object): Check metaclass correctness only once; store string literals in hash table. (objc_build_constructor): Do not convert initializer elements; adjust for ObjC++ impedance mismatch. (build_objc_symtab_template): Call create_field_decl() instead of create_builtin_decl(). (init_objc_symtab): Add missing conversion to initializer element. (build_metadata_decl): Call start_var_decl() instead of define_decl(). (generate_objc_symtab_decl): Do not call build_category_template(); call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(). (build_module_descriptor): Call create_field_decl() instead of grokfield(); call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(); always mark module descriptor as used; move GNU runtime-specific functionality to build_module_initializer_routine(). (build_module_initializer_routine): New function, broken off of build_module_descriptor(). (objc_static_init_needed_p, objc_generate_static_init_call): New functions. (generate_static_references, generate_strings, build_selector_translation_table, generate_descriptor_table, generate_ivars_list, generate_dispatch_table, generate_category): Call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(); build a type directly instead of via groktypename(). (build_selector_reference_decl, build_selector_table_decl, build_class_reference_decl, build_protocol_reference, generate_objc_image_info): Call start_var_decl() instead of build_decl(). (build_selector_reference): For GNU runtime, do not call build_selector_reference_decl(). (build_selector, build_typed_selector_reference): Always convert result to the selector type. (add_objc_string): Cast return value to 'char *'. (build_method_prototype_template, build_selector_template, build_method_template): Use actual selector type for fields pointing to selectors. (finish_objc): For GNU runtime, call build_module_initializer_routine() after build_module_descriptor(). (generate_protocol_list, generate_shared_structures): Call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(); build a type directly instead of via groktypename(). (synth_id_with_class_suffix): Return a string. (get_arg_type_list): For instance methods, use the instance type for 'self'; do not call groktypename_in_parm_context(). (build_objc_string_decl): Squash redeclaration errors in ObjC++. (objc_is_class_name): Use OBJC_TYPE_NAME instead of TYPE_NAME; handle RECORD_TYPEs in ObjC as well as ObjC++. (objc_is_id): New function. (objc_is_object_ptr): Return the canonical type node. (objc_get_class_ivars): Simplify using get_class_ivars(). (get_class_ivars): Remove second parameter; create a fresh copy of the ivar list for each call; do not check for existence of super class. (objc_eh_runtime_type): Mark #ifndef OBJCPLUS. (objc_init_exceptions): When using SJLJ-style exceptions, require the use of '-fobjc-exceptions' flag; do not require it for DWARF-style exceptions. (objc_build_exc_ptr, next_sjlj_build_try_catch_finally): Use objc_object_type instead of objc_id_type. (objc_begin_catch_clause): Convert the incoming PARM_DECL into a VAR_DECL before placing it in the appropriate scope; do not call define_decl(); adjust call to c_begin_compound_stmt(); use objc_object_type instead of objc_id_type. (build_next_objc_exception_stuff): Call create_field_decl() instead of create_builtin_decl(); construct type directly instead of calling groktypename(); use OBJC_VOID_AT_END to mark end of function parameters. (build_private_template): Adjust call to get_class_ivars(); build a type directly instead of via groktypename(). (build_protocol_template, build_method_prototype_list_template, build_method_prototype_template, build_category_template, build_selector_template, build_class_template, build_super_template, build_ivar_template, build_ivar_list_template, build_method_list_template, build_method_template): Call create_field_decl() instead of grokfield(). (objc_method_parm_type): Do not call groktypename(). (generate_descriptor_table): Call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(). (generate_method_descriptors, build_protocol_initializer, generate_dispatch_tables, build_category_initializer, build_shared_structure_initializer): Do not call groktypename(). (generate_protocols): Call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(); do not call groktypename(). (error_with_ivar): Remove last parameter. (check_ivars): Do not iterate ovar CLASS_RAW_IVARS lists in addition to CLASS_IVARS lists; adjust calls to error_with_ivar(). (generate_ivar_lists): Convert one of the initializer elements; do not call groktypename(). (get_arg_type_list, start_method_def, gen_method_def): Account for new representation of variable arguments and '...' in Objective-C methods; add Objective-C++ impedance matching code. (is_objc_type_qualifier): Remove function. (adjust_type_for_id_default): Simplify; there is no longer a need to wade through declspecs. (lookup_interface, start_class, continue_class, finish_class, start_method_def, start_protocol, build_method_decl, objc_add_method, add_instance_variable, build_ivar_reference, is_ivar, is_private, get_super_receiver, objc_build_finally_epilogue): Make into static functions. (receiver_is_class_object): Use new IS_CLASS() macro. (objc_build_message_expr): Tweak ObjC++ message argument handling; call objc_finish_message_expr() instead of finish_message_expr(). (finish_message_expr): Rename to objc_finish_message_expr(); use OBJC_TYPE_NAME and OBJC_SET_TYPE_NAME macros instead of TYPE_NAME. call gen_type_name() instead of gen_declaration(); call objc_is_id() instead of using IS_ID and IS_CLASS; Use objc_class_name instead of calling get_identifier("Class"); handle CONVERT_EXPRs in receiver. (build_objc_method_call, warn_with_method): Do not call groktypename(). (build_ivar_reference): Call convert() instead of clobbering in a type. (hash_init): Initialize string_htab hash table. (add_instance_variable): Simplify parameter list; do not call grokfield(); do not populate CLASS_IVARS list. (start_class): Check for the existence of super class, if one was specified. (continue_class): Use CLASS_RAW_IVARS rather than CLASS_IVARS; do not call build_class_template(); adjust call to get_class_ivars(); call build_decl(), pushdecl() and finish_decl() instead of define_decl(). (finish_class): Call build_decl(), pushdecl() and finish_decl() instead of define_decl(). (add_protocols): Use PROTOCOL_BINFO_ELTS for the tree vector size. (start_protocol): Do not call build_protocol_template(); use PROTOCOL_BINFO_ELTS for the tree vector size. (encode_type_qualifiers): Do not handle the 'const' qualifier here. (encode_pointer): Encode 'const char *' as 'r*', for backwards compatibility. (encode_array): Use HOST_WIDE_INT_PRINT_DEC instead of "%ld". (encode_type): Handle the 'const' qualifier here. (objc_parmlist): New global variable, sued by objc_push_parm and objc_get_parm_info(). (objc_push_parm, objc_get_parm_info): New functions. (objc_expr_last): Remove function. (synth_self_and_ucmd_args): For instance methods, use the instance type for 'self'; call objc_push_parm() instead of push_parm_decl(). (start_method_def): Do not call push_scope(), declare_parm_level(), pop_scope(), push_parm_decl(), store_parm_decls() or objc_expr_last(); just use objc_push_parm() and objc_get_parm_info(). (comp_method_with_proto): Remove function. (objc_types_are_equivalent): Strip away indirections before comparing underlying types. (comp_proto_with_proto): Do not call groktypename(); types are no longer in raw declspec format. (objc_start_function): New function. (really_start_method): Call comp_proto_with_proto() instead of comp_method_with_proto(); call objc_start_function() instead of hand-crafting a function declarator. (continue_method_def, objc_expand_function_end): Remove functions. (get_super_receiver): Call objc_get_current_scope() instead of get_current_scope(); reference 'super_class' field (instead of 'class'). (finish_method_def): Rename to objc_finish_method_definition() and add a function decl parameter; move method encoding call from objc_expand_function_end(). (is_complex_decl, adorn_decl, gen_declarator, gen_declspecs, gen_declaration_1): Remove functions. (tmpbuf, RAW_DECLSPEC): Remove. (gen_declaration): Remove second parameter; simplify to deal with TYPE_P nodes instead of raw declspecs. (gen_type_name, gen_type_name_0): New functions. (gen_method_decl): Remove second parameter; call gen_type_name() instead of gen_declaration_1(). (dump_interface): Adjust calls to gen_declaration() and gen_method_decl(); do not allocate a separate string buffer. (init_objc): Allocate a larger string buffer to accommodate dump_interface(); adjust call to build_module_descriptor(); add call to build_module_initializer_routine() for the GNU runtime. (generate_classref_translation_entry): Do not call start_decl(); call finish_var_decl() instead of finish_decl(); call convert() instead of build_c_cast(). * objc-act.h (CLASS_OWN_IVARS): Remove accessor. (CLASS_BINFO_ELTS): Reduce from 6 to 5, now that CLASS_OWN_IVARS is gone. (OCTI_GNU_INIT_DECL, GNU_INIT_decl): New. (OCTI_ELLIPSIS_NODE, objc_ellipsis_node): Remove. (OCTI_ID_ID, id_type, objc_id_id): Rename to OCTI_ID_NAME, objc_object_type and objc_object_name, respectively. (OCTI_CLS_REF, OCTI_CLASS_NAME, objc_class_reference, objc_class_name): New. (IS_CLASS): New macro. (IS_ID, IS_SUPER): Robustify. (OCTI_EXECCLASS_DECL, execclass_decl): New. (finish_file, start_class, continue_class, finish_class, start_method_def, continue_method_def, finish_method_def, start_protocol, finish_protocol, objc_build_throw_stmt, objc_build_try_catch_finally_stmt, objc_build_synchronized_prologue, objc_build_synchronized_epilogue, objc_build_try_prologue, objc_build_try_epilogue, objc_build_catch_stmt, objc_build_catch_epilogue, objc_build_finally_prologue, objc_build_finally_epilogue, is_ivar, is_private, is_public, add_instance_variable, objc_add_method, get_super_receiver, objc_clear_super_receiver, get_class_ivars_from_name, get_class_reference, get_static_reference, get_object_reference, build_message_expr, finish_message_expr, build_selector_expr, build_ivar_reference, build_keyword_decl, build_method_decl, build_protocol_expr, build_objc_string_object, objc_declare_alias, objc_declare_class, objc_declare_protocols, objc_comptypes, objc_check_decl, build_encode_expr): Remove prototypes. (imp_count, cat_count): Make GGC-aware. (OBJC_SET_TYPE_NAME): New macro. From-SVN: r87168
2004-09-08 02:49:44 +02:00
type
= build_function_type (IMP_type,
Makefile.in (c-parse.o): Depend on $(C_COMMON_H). [gcc/ChangeLog] 2004-09-07 Ziemowit Laski <zlaski@apple.com> * Makefile.in (c-parse.o): Depend on $(C_COMMON_H). * c-parse.in: Include c-common.h instead of objc-act.h. (ivar_decl_list, ivar_decls, ivar_decl, ivars, ivar_declarator, myparms, myparm): Remove %type declarations. (methodtype, optparms, OBJC_TYPE_QUAL, objc_quals, objc_qual, objc_typename, objc_try_catch_stmt, optellipsis): Add %type declarations. (objc_inherit_code, objc_public_flag): Remove. (typespec_nonreserved_nonattr): Call objc_get_protocol_qualified_type() instead of get_static_reference() and get_protocol_reference(). (stmt_nocomp): Call grokparm() on @catch parameter. (objcdef): Move semantic action to objc_finish_implementation(). (classdef): Move semantic action to objc_start_class_interface(), objc_continue_interface(), objc_finish_interface(), objc_start_class_implementation(), objc_continue_implementation(), objc_start_category_interface() and objc_start_category_implementation(). (protocoldef): Move semantic actions to objc_start_protocol() and objc_finish_interface(). (ivar_decl_list): Remove nonterminal. (visibility_spec): Move semantic actions to objc_set_visibility(). (ivar_decls): Remove assignment to $$. (ivar_decl): Rephrase in terms of component_decl; call objc_add_instance_variable(). (ivars, ivar_declarator): Remove nonterminals. (opt_semi): New nonterminal. (methodtype): Remove semantic actions. (methoddef): Move semantic actions to objc_set_method_type(), objc_start_method_definition() and objc_finish_method_definition(). (methodproto): Move semantic actions to objc_set_method_type() and objc_add_method_declaration(). (methoddecl): Use objc_typename instead of typename; move semantic actions to objc_build_method_signature(). (optarglist, myxdecls, mydecl, myparms, myparm): Remove nonterminals. (optparmlist): Express in terms of optparms and optellipsis. (optparms, optellipsis, objc_qual, objc_quals, objc_typename): New nonterminals. (keyworddecl): Use objc_typename instead of typename. (rid_to_yy): Mark RID_IN, RID_OUT, RID_INOUT, RID_BYCOPY, RID_BYREF and RID_ONEWAY as returning OBJC_TYPE_QUAL to yyparse(). [gcc/objc/ChangeLog] 2004-09-07 Ziemowit Laski <zlaski@apple.com> * Make-lang.in (objc/objc-parse.o): Depend on $(C_COMMON_H) instead of objc/objc-act.h. (objc/objc-act.o): Depend on $(HASHTAB_H). * objc-act.c: Include hashtab.h; in ObjC++ mode, include cp-tree.h and objcp-decl.h instead of c-tree.h. (build_module_descriptor, get_class_ivars, synth_id_with_class_suffix, error_with_ivar, gen_method_decl, gen_declaration, setup_string_decl, build_protocol_template): Adjust prototypes. (build_module_initializer_routine, start_class, continue_class, finish_class, start_method_def, objc_start_function, start_protocol, build_method_decl, objc_add_method, add_instance_variable, build_ivar_reference, is_ivar, is_private, get_super_receiver, build_selector_table_decl, objc_push_parm, objc_get_parm_info, gen_type_name, gen_type_name_0, start_var_decl, finish_var_decl, create_field_decl): New prototypes. (objc_expand_function_end, comp_method_with_proto, objc_expr_last, gen_declaration_1, gen_declarator, is_complex_decl, adorn_decl, define_decl, create_builtin_decl, gen_declspecs): Remove prototypes. (TYPE_ID): Rename to OBJECT_TYPEDEF_NAME. (CLASS_TYPEDEF_NAME): New. (TAG_EXECCLASS): Change from a global variable to a #define. (TAG_RETURN_STRUCT): Delete. (TAG_GNUINIT): New, holds '__objc_gnu_init' name. (objc_inherit_code, objc_public_flag): New, moved from c-parse.in. (string_descriptor): New struct. (string_htab): New hash table. (string_hash, string_eq): New prototypes. (generate_struct_by_value_array): Call create_field_decl() instead of create_builtin_decl(). (objc_init): Do not initialize objc_ellipsis_node or TAG_EXECCLASS; In ObjC++ mode, call cxx_init() instead of c_objc_common_init(). (objc_finish_file): In ObjC++, call instantiate_pending_templates() and cp_finish_file(). (define_decl, get_static_reference, get_protocol_reference, create_builtin_decl): Remove functions. (objc_start_class_interface, objc_start_category_interface, objc_start_protocol, objc_continue_interface, objc_finish_interface, objc_start_class_implementation, objc_start_category_implementation, objc_continue_implementation, objc_finish_implementation, objc_set_visibility, objc_set_method_type, objc_build_method_signature, objc_add_method_declaration, objc_start_method_definition, objc_add_instance_variable, objc_get_protocol_qualified_type, create_field_decl, start_var_decl, finish_var_decl): New functions. (setup_string_decl): Simplify since it is only called once. (synth_module_prologue): Call build_class_template(); predefine 'id' and 'Class' as typedefs; rename 'temp_type' to 'type'; disable debug hooks for duration of function; fix GNU runtime messenger signatures to correspond to reality; forward-declare '__objc_exec_class' for the GNU runtime; call build_selector_table_decl(); in ObjC++ mode, generate 'extern "C" { ... }' wrappers around synthesized declarations; call build_protocol_template() and build_category_template(). (string_hash, string_eq): New functions. (objc_build_string_object): Check metaclass correctness only once; store string literals in hash table. (objc_build_constructor): Do not convert initializer elements; adjust for ObjC++ impedance mismatch. (build_objc_symtab_template): Call create_field_decl() instead of create_builtin_decl(). (init_objc_symtab): Add missing conversion to initializer element. (build_metadata_decl): Call start_var_decl() instead of define_decl(). (generate_objc_symtab_decl): Do not call build_category_template(); call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(). (build_module_descriptor): Call create_field_decl() instead of grokfield(); call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(); always mark module descriptor as used; move GNU runtime-specific functionality to build_module_initializer_routine(). (build_module_initializer_routine): New function, broken off of build_module_descriptor(). (objc_static_init_needed_p, objc_generate_static_init_call): New functions. (generate_static_references, generate_strings, build_selector_translation_table, generate_descriptor_table, generate_ivars_list, generate_dispatch_table, generate_category): Call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(); build a type directly instead of via groktypename(). (build_selector_reference_decl, build_selector_table_decl, build_class_reference_decl, build_protocol_reference, generate_objc_image_info): Call start_var_decl() instead of build_decl(). (build_selector_reference): For GNU runtime, do not call build_selector_reference_decl(). (build_selector, build_typed_selector_reference): Always convert result to the selector type. (add_objc_string): Cast return value to 'char *'. (build_method_prototype_template, build_selector_template, build_method_template): Use actual selector type for fields pointing to selectors. (finish_objc): For GNU runtime, call build_module_initializer_routine() after build_module_descriptor(). (generate_protocol_list, generate_shared_structures): Call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(); build a type directly instead of via groktypename(). (synth_id_with_class_suffix): Return a string. (get_arg_type_list): For instance methods, use the instance type for 'self'; do not call groktypename_in_parm_context(). (build_objc_string_decl): Squash redeclaration errors in ObjC++. (objc_is_class_name): Use OBJC_TYPE_NAME instead of TYPE_NAME; handle RECORD_TYPEs in ObjC as well as ObjC++. (objc_is_id): New function. (objc_is_object_ptr): Return the canonical type node. (objc_get_class_ivars): Simplify using get_class_ivars(). (get_class_ivars): Remove second parameter; create a fresh copy of the ivar list for each call; do not check for existence of super class. (objc_eh_runtime_type): Mark #ifndef OBJCPLUS. (objc_init_exceptions): When using SJLJ-style exceptions, require the use of '-fobjc-exceptions' flag; do not require it for DWARF-style exceptions. (objc_build_exc_ptr, next_sjlj_build_try_catch_finally): Use objc_object_type instead of objc_id_type. (objc_begin_catch_clause): Convert the incoming PARM_DECL into a VAR_DECL before placing it in the appropriate scope; do not call define_decl(); adjust call to c_begin_compound_stmt(); use objc_object_type instead of objc_id_type. (build_next_objc_exception_stuff): Call create_field_decl() instead of create_builtin_decl(); construct type directly instead of calling groktypename(); use OBJC_VOID_AT_END to mark end of function parameters. (build_private_template): Adjust call to get_class_ivars(); build a type directly instead of via groktypename(). (build_protocol_template, build_method_prototype_list_template, build_method_prototype_template, build_category_template, build_selector_template, build_class_template, build_super_template, build_ivar_template, build_ivar_list_template, build_method_list_template, build_method_template): Call create_field_decl() instead of grokfield(). (objc_method_parm_type): Do not call groktypename(). (generate_descriptor_table): Call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(). (generate_method_descriptors, build_protocol_initializer, generate_dispatch_tables, build_category_initializer, build_shared_structure_initializer): Do not call groktypename(). (generate_protocols): Call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(); do not call groktypename(). (error_with_ivar): Remove last parameter. (check_ivars): Do not iterate ovar CLASS_RAW_IVARS lists in addition to CLASS_IVARS lists; adjust calls to error_with_ivar(). (generate_ivar_lists): Convert one of the initializer elements; do not call groktypename(). (get_arg_type_list, start_method_def, gen_method_def): Account for new representation of variable arguments and '...' in Objective-C methods; add Objective-C++ impedance matching code. (is_objc_type_qualifier): Remove function. (adjust_type_for_id_default): Simplify; there is no longer a need to wade through declspecs. (lookup_interface, start_class, continue_class, finish_class, start_method_def, start_protocol, build_method_decl, objc_add_method, add_instance_variable, build_ivar_reference, is_ivar, is_private, get_super_receiver, objc_build_finally_epilogue): Make into static functions. (receiver_is_class_object): Use new IS_CLASS() macro. (objc_build_message_expr): Tweak ObjC++ message argument handling; call objc_finish_message_expr() instead of finish_message_expr(). (finish_message_expr): Rename to objc_finish_message_expr(); use OBJC_TYPE_NAME and OBJC_SET_TYPE_NAME macros instead of TYPE_NAME. call gen_type_name() instead of gen_declaration(); call objc_is_id() instead of using IS_ID and IS_CLASS; Use objc_class_name instead of calling get_identifier("Class"); handle CONVERT_EXPRs in receiver. (build_objc_method_call, warn_with_method): Do not call groktypename(). (build_ivar_reference): Call convert() instead of clobbering in a type. (hash_init): Initialize string_htab hash table. (add_instance_variable): Simplify parameter list; do not call grokfield(); do not populate CLASS_IVARS list. (start_class): Check for the existence of super class, if one was specified. (continue_class): Use CLASS_RAW_IVARS rather than CLASS_IVARS; do not call build_class_template(); adjust call to get_class_ivars(); call build_decl(), pushdecl() and finish_decl() instead of define_decl(). (finish_class): Call build_decl(), pushdecl() and finish_decl() instead of define_decl(). (add_protocols): Use PROTOCOL_BINFO_ELTS for the tree vector size. (start_protocol): Do not call build_protocol_template(); use PROTOCOL_BINFO_ELTS for the tree vector size. (encode_type_qualifiers): Do not handle the 'const' qualifier here. (encode_pointer): Encode 'const char *' as 'r*', for backwards compatibility. (encode_array): Use HOST_WIDE_INT_PRINT_DEC instead of "%ld". (encode_type): Handle the 'const' qualifier here. (objc_parmlist): New global variable, sued by objc_push_parm and objc_get_parm_info(). (objc_push_parm, objc_get_parm_info): New functions. (objc_expr_last): Remove function. (synth_self_and_ucmd_args): For instance methods, use the instance type for 'self'; call objc_push_parm() instead of push_parm_decl(). (start_method_def): Do not call push_scope(), declare_parm_level(), pop_scope(), push_parm_decl(), store_parm_decls() or objc_expr_last(); just use objc_push_parm() and objc_get_parm_info(). (comp_method_with_proto): Remove function. (objc_types_are_equivalent): Strip away indirections before comparing underlying types. (comp_proto_with_proto): Do not call groktypename(); types are no longer in raw declspec format. (objc_start_function): New function. (really_start_method): Call comp_proto_with_proto() instead of comp_method_with_proto(); call objc_start_function() instead of hand-crafting a function declarator. (continue_method_def, objc_expand_function_end): Remove functions. (get_super_receiver): Call objc_get_current_scope() instead of get_current_scope(); reference 'super_class' field (instead of 'class'). (finish_method_def): Rename to objc_finish_method_definition() and add a function decl parameter; move method encoding call from objc_expand_function_end(). (is_complex_decl, adorn_decl, gen_declarator, gen_declspecs, gen_declaration_1): Remove functions. (tmpbuf, RAW_DECLSPEC): Remove. (gen_declaration): Remove second parameter; simplify to deal with TYPE_P nodes instead of raw declspecs. (gen_type_name, gen_type_name_0): New functions. (gen_method_decl): Remove second parameter; call gen_type_name() instead of gen_declaration_1(). (dump_interface): Adjust calls to gen_declaration() and gen_method_decl(); do not allocate a separate string buffer. (init_objc): Allocate a larger string buffer to accommodate dump_interface(); adjust call to build_module_descriptor(); add call to build_module_initializer_routine() for the GNU runtime. (generate_classref_translation_entry): Do not call start_decl(); call finish_var_decl() instead of finish_decl(); call convert() instead of build_c_cast(). * objc-act.h (CLASS_OWN_IVARS): Remove accessor. (CLASS_BINFO_ELTS): Reduce from 6 to 5, now that CLASS_OWN_IVARS is gone. (OCTI_GNU_INIT_DECL, GNU_INIT_decl): New. (OCTI_ELLIPSIS_NODE, objc_ellipsis_node): Remove. (OCTI_ID_ID, id_type, objc_id_id): Rename to OCTI_ID_NAME, objc_object_type and objc_object_name, respectively. (OCTI_CLS_REF, OCTI_CLASS_NAME, objc_class_reference, objc_class_name): New. (IS_CLASS): New macro. (IS_ID, IS_SUPER): Robustify. (OCTI_EXECCLASS_DECL, execclass_decl): New. (finish_file, start_class, continue_class, finish_class, start_method_def, continue_method_def, finish_method_def, start_protocol, finish_protocol, objc_build_throw_stmt, objc_build_try_catch_finally_stmt, objc_build_synchronized_prologue, objc_build_synchronized_epilogue, objc_build_try_prologue, objc_build_try_epilogue, objc_build_catch_stmt, objc_build_catch_epilogue, objc_build_finally_prologue, objc_build_finally_epilogue, is_ivar, is_private, is_public, add_instance_variable, objc_add_method, get_super_receiver, objc_clear_super_receiver, get_class_ivars_from_name, get_class_reference, get_static_reference, get_object_reference, build_message_expr, finish_message_expr, build_selector_expr, build_ivar_reference, build_keyword_decl, build_method_decl, build_protocol_expr, build_objc_string_object, objc_declare_alias, objc_declare_class, objc_declare_protocols, objc_comptypes, objc_check_decl, build_encode_expr): Remove prototypes. (imp_count, cat_count): Make GGC-aware. (OBJC_SET_TYPE_NAME): New macro. From-SVN: r87168
2004-09-08 02:49:44 +02:00
tree_cons (NULL_TREE, objc_super_type,
tree_cons (NULL_TREE, objc_selector_type,
OBJC_VOID_AT_END)));
decl.c: Include langhooks.h. * gcc/java/decl.c: Include langhooks.h. (builtin_function): Remove. (java_init_decl_processing): Replace calls to builtin_function with add_builtin_function. * gcc/java/Make-lang.in (jc1$(exeext)): Depend on and link with attribs.o. (java/decl.o): Depend on langhooks.h. * gcc/java/java-tree.h (builtin_function): Remove. * gcc/tree.c (local_define_builtin): Replace calls to lang_hooks.builtin_function with add_builtin_function. * gcc/objc/objc-act.c (synth_module_prologue): Replace calls to builtin_function with add_builtin_function. (build_next_objc_exception_stuff): Replace calls to builtin_function with add_builtin_function. (build_objc_exception_stuff): Replace calls to builtin_function with add_builtin_function. * gcc/objcp/objcp-decl.h (objcp_builtin_function): Remove. * gcc/cp/decl.c (builtin_function_1): Move common code to add_builtin_function. (builtin_function): Rename to cxx_builtin_function. Change the signature. * gcc/cp/call.c: Include langhooks.h. (build_java_interface_fn_ref): Replace calls to builtin_function with add_builtin_function. * gcc/cp/Make-lang.in (cp/call.o): Depend on langhooks.h. * gcc/cp/cp-objcp-common.h (LANG_HOOKS_BUILTIN_FUNCTION): Define as cxx_builtin_function. * gcc/cp/cp-tree.h (builtin_function): Rename to cxx_builtin_function. Change the signature. * gcc/c-objc-common.h (LANG_HOOKS_BUILTIN_FUNCTION): Define as c_builtin_function. * gcc/c-tree.h (builtin_function): Rename to c_builtin_function. Change the signature. * gcc/ada/utils.c (builtin_function): Rename to gnat_builtin_function. Move common code to add_builtin_function. * gcc/ada/misc.c (LANG_HOOKS_BUILTIN_FUNCTION): Define as gnat_builtin_function. * gcc/ada/gigi.h (builtin_function): Rename to gnat_builtin_function. Change the signature. * gcc/c-decl.c (builtin_function): Rename to c_builtin_function. Move common code to add_builtin_function. * gcc/fortran/Make-lang.in (f951$(exeext)): Depend on and link with attribs.o. * gcc/fortran/trans.h (builtin_function): Rename to gfc_builtin_function. Change the signature. * gcc/fortran/f95-lang.c (LANG_HOOKS_BUILTIN_FUNCTION): Define as gfc_builtin_function. (builtin_function): Rename to gfc_builtin_function. Move common code to builtin_function. (gfc_define_builtin): Replace calls to builtin_function with gfc_define_builtin. * gcc/langhooks.c (add_builtin_function): New function. (lhd_builtin_function): New function. * gcc/langhooks.h (struct lang_hooks): Change the signature of builtin_function. (add_builtin_function): New function. * gcc/treelang/treetree.c (builtin_function): Remove. * gcc/tree-ssa-loop-prefetch.c (tree_ssa_prefetch_arrays): Replace calls to lang_hooks.builtin_function with add_builtin_function. * gcc/c-common.c (decl_builtin_1): Replace calls to lang_hooks.builtin_function with add_builtin_function. * gcc/config/alpha/alpha.c (alpha_init_builtins): Replace calls to lang_hooks.builtin_function with add_builtin_function. * gcc/config/frv/frv.c (def_builtin): Replace calls to lang_hooks.builtin_function with add_builtin_function. * gcc/config/s390/s390.c (s390_init_builtins): Replace calls to lang_hooks.builtin_function with add_builtin_function. * gcc/config/sparc/sparc.c (def_builtin): Replace calls to lang_hooks.builtin_function with add_builtin_function. * gcc/config/i386/i386.c (def_builtin): Replace calls to lang_hooks.builtin_function with add_builtin_function. (def_builtin): Replace calls to lang_hooks.builtin_function with add_builtin_function. * gcc/config/sh/sh.c (sh_media_init_builtins): Replace calls to lang_hooks.builtin_function with add_builtin_function. * gcc/config/c4x/c4x.c (c4x_init_builtins): Replace calls to lang_hooks.builtin_function with add_builtin_function. * gcc/config/stormy16/stormy16.c (xstormy16_init_builtins): Replace calls to lang_hooks.builtin_function with add_builtin_function. * gcc/config/iq2000/iq2000.c (def_builtin): Replace calls to lang_hooks.builtin_function with add_builtin_function. * gcc/config/ia64/ia64.c (def_builtin): Replace calls to lang_hooks.builtin_function with add_builtin_function. * gcc/config/rs6000/rs6000.c (def_builtin): Replace calls to lang_hooks.builtin_function with add_builtin_function. (altivec_init_builtins): Replace calls to lang_hooks.builtin_function with add_builtin_function. * gcc/config/arm/arm.c (def_mbuiltin): Replace calls to lang_hooks.builtin_function with add_builtin_function. (arm_init_tls_builtins): Replace calls to lang_hooks.builtin_function with add_builtin_function. * gcc/config/mips/mips.c (mips_init_builtins): Replace calls to lang_hooks.builtin_function with add_builtin_function. * gcc/config/bfin/bfin.c (def_builtin): Replace calls to lang_hooks.builtin_function with add_builtin_function. * gcc/langhooks-def.h (lhd_builtin_function): New function. (LANG_HOOKS_BUILTIN_FUNCTION): Define as lhd_builtin_function. From-SVN: r117981
2006-10-23 21:47:58 +02:00
umsg_super_decl = add_builtin_function (TAG_MSGSENDSUPER,
type, 0, NOT_BUILT_IN,
NULL, NULL_TREE);
TREE_NOTHROW (umsg_super_decl) = 0;
Makefile.in (c-parse.o): Depend on $(C_COMMON_H). [gcc/ChangeLog] 2004-09-07 Ziemowit Laski <zlaski@apple.com> * Makefile.in (c-parse.o): Depend on $(C_COMMON_H). * c-parse.in: Include c-common.h instead of objc-act.h. (ivar_decl_list, ivar_decls, ivar_decl, ivars, ivar_declarator, myparms, myparm): Remove %type declarations. (methodtype, optparms, OBJC_TYPE_QUAL, objc_quals, objc_qual, objc_typename, objc_try_catch_stmt, optellipsis): Add %type declarations. (objc_inherit_code, objc_public_flag): Remove. (typespec_nonreserved_nonattr): Call objc_get_protocol_qualified_type() instead of get_static_reference() and get_protocol_reference(). (stmt_nocomp): Call grokparm() on @catch parameter. (objcdef): Move semantic action to objc_finish_implementation(). (classdef): Move semantic action to objc_start_class_interface(), objc_continue_interface(), objc_finish_interface(), objc_start_class_implementation(), objc_continue_implementation(), objc_start_category_interface() and objc_start_category_implementation(). (protocoldef): Move semantic actions to objc_start_protocol() and objc_finish_interface(). (ivar_decl_list): Remove nonterminal. (visibility_spec): Move semantic actions to objc_set_visibility(). (ivar_decls): Remove assignment to $$. (ivar_decl): Rephrase in terms of component_decl; call objc_add_instance_variable(). (ivars, ivar_declarator): Remove nonterminals. (opt_semi): New nonterminal. (methodtype): Remove semantic actions. (methoddef): Move semantic actions to objc_set_method_type(), objc_start_method_definition() and objc_finish_method_definition(). (methodproto): Move semantic actions to objc_set_method_type() and objc_add_method_declaration(). (methoddecl): Use objc_typename instead of typename; move semantic actions to objc_build_method_signature(). (optarglist, myxdecls, mydecl, myparms, myparm): Remove nonterminals. (optparmlist): Express in terms of optparms and optellipsis. (optparms, optellipsis, objc_qual, objc_quals, objc_typename): New nonterminals. (keyworddecl): Use objc_typename instead of typename. (rid_to_yy): Mark RID_IN, RID_OUT, RID_INOUT, RID_BYCOPY, RID_BYREF and RID_ONEWAY as returning OBJC_TYPE_QUAL to yyparse(). [gcc/objc/ChangeLog] 2004-09-07 Ziemowit Laski <zlaski@apple.com> * Make-lang.in (objc/objc-parse.o): Depend on $(C_COMMON_H) instead of objc/objc-act.h. (objc/objc-act.o): Depend on $(HASHTAB_H). * objc-act.c: Include hashtab.h; in ObjC++ mode, include cp-tree.h and objcp-decl.h instead of c-tree.h. (build_module_descriptor, get_class_ivars, synth_id_with_class_suffix, error_with_ivar, gen_method_decl, gen_declaration, setup_string_decl, build_protocol_template): Adjust prototypes. (build_module_initializer_routine, start_class, continue_class, finish_class, start_method_def, objc_start_function, start_protocol, build_method_decl, objc_add_method, add_instance_variable, build_ivar_reference, is_ivar, is_private, get_super_receiver, build_selector_table_decl, objc_push_parm, objc_get_parm_info, gen_type_name, gen_type_name_0, start_var_decl, finish_var_decl, create_field_decl): New prototypes. (objc_expand_function_end, comp_method_with_proto, objc_expr_last, gen_declaration_1, gen_declarator, is_complex_decl, adorn_decl, define_decl, create_builtin_decl, gen_declspecs): Remove prototypes. (TYPE_ID): Rename to OBJECT_TYPEDEF_NAME. (CLASS_TYPEDEF_NAME): New. (TAG_EXECCLASS): Change from a global variable to a #define. (TAG_RETURN_STRUCT): Delete. (TAG_GNUINIT): New, holds '__objc_gnu_init' name. (objc_inherit_code, objc_public_flag): New, moved from c-parse.in. (string_descriptor): New struct. (string_htab): New hash table. (string_hash, string_eq): New prototypes. (generate_struct_by_value_array): Call create_field_decl() instead of create_builtin_decl(). (objc_init): Do not initialize objc_ellipsis_node or TAG_EXECCLASS; In ObjC++ mode, call cxx_init() instead of c_objc_common_init(). (objc_finish_file): In ObjC++, call instantiate_pending_templates() and cp_finish_file(). (define_decl, get_static_reference, get_protocol_reference, create_builtin_decl): Remove functions. (objc_start_class_interface, objc_start_category_interface, objc_start_protocol, objc_continue_interface, objc_finish_interface, objc_start_class_implementation, objc_start_category_implementation, objc_continue_implementation, objc_finish_implementation, objc_set_visibility, objc_set_method_type, objc_build_method_signature, objc_add_method_declaration, objc_start_method_definition, objc_add_instance_variable, objc_get_protocol_qualified_type, create_field_decl, start_var_decl, finish_var_decl): New functions. (setup_string_decl): Simplify since it is only called once. (synth_module_prologue): Call build_class_template(); predefine 'id' and 'Class' as typedefs; rename 'temp_type' to 'type'; disable debug hooks for duration of function; fix GNU runtime messenger signatures to correspond to reality; forward-declare '__objc_exec_class' for the GNU runtime; call build_selector_table_decl(); in ObjC++ mode, generate 'extern "C" { ... }' wrappers around synthesized declarations; call build_protocol_template() and build_category_template(). (string_hash, string_eq): New functions. (objc_build_string_object): Check metaclass correctness only once; store string literals in hash table. (objc_build_constructor): Do not convert initializer elements; adjust for ObjC++ impedance mismatch. (build_objc_symtab_template): Call create_field_decl() instead of create_builtin_decl(). (init_objc_symtab): Add missing conversion to initializer element. (build_metadata_decl): Call start_var_decl() instead of define_decl(). (generate_objc_symtab_decl): Do not call build_category_template(); call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(). (build_module_descriptor): Call create_field_decl() instead of grokfield(); call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(); always mark module descriptor as used; move GNU runtime-specific functionality to build_module_initializer_routine(). (build_module_initializer_routine): New function, broken off of build_module_descriptor(). (objc_static_init_needed_p, objc_generate_static_init_call): New functions. (generate_static_references, generate_strings, build_selector_translation_table, generate_descriptor_table, generate_ivars_list, generate_dispatch_table, generate_category): Call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(); build a type directly instead of via groktypename(). (build_selector_reference_decl, build_selector_table_decl, build_class_reference_decl, build_protocol_reference, generate_objc_image_info): Call start_var_decl() instead of build_decl(). (build_selector_reference): For GNU runtime, do not call build_selector_reference_decl(). (build_selector, build_typed_selector_reference): Always convert result to the selector type. (add_objc_string): Cast return value to 'char *'. (build_method_prototype_template, build_selector_template, build_method_template): Use actual selector type for fields pointing to selectors. (finish_objc): For GNU runtime, call build_module_initializer_routine() after build_module_descriptor(). (generate_protocol_list, generate_shared_structures): Call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(); build a type directly instead of via groktypename(). (synth_id_with_class_suffix): Return a string. (get_arg_type_list): For instance methods, use the instance type for 'self'; do not call groktypename_in_parm_context(). (build_objc_string_decl): Squash redeclaration errors in ObjC++. (objc_is_class_name): Use OBJC_TYPE_NAME instead of TYPE_NAME; handle RECORD_TYPEs in ObjC as well as ObjC++. (objc_is_id): New function. (objc_is_object_ptr): Return the canonical type node. (objc_get_class_ivars): Simplify using get_class_ivars(). (get_class_ivars): Remove second parameter; create a fresh copy of the ivar list for each call; do not check for existence of super class. (objc_eh_runtime_type): Mark #ifndef OBJCPLUS. (objc_init_exceptions): When using SJLJ-style exceptions, require the use of '-fobjc-exceptions' flag; do not require it for DWARF-style exceptions. (objc_build_exc_ptr, next_sjlj_build_try_catch_finally): Use objc_object_type instead of objc_id_type. (objc_begin_catch_clause): Convert the incoming PARM_DECL into a VAR_DECL before placing it in the appropriate scope; do not call define_decl(); adjust call to c_begin_compound_stmt(); use objc_object_type instead of objc_id_type. (build_next_objc_exception_stuff): Call create_field_decl() instead of create_builtin_decl(); construct type directly instead of calling groktypename(); use OBJC_VOID_AT_END to mark end of function parameters. (build_private_template): Adjust call to get_class_ivars(); build a type directly instead of via groktypename(). (build_protocol_template, build_method_prototype_list_template, build_method_prototype_template, build_category_template, build_selector_template, build_class_template, build_super_template, build_ivar_template, build_ivar_list_template, build_method_list_template, build_method_template): Call create_field_decl() instead of grokfield(). (objc_method_parm_type): Do not call groktypename(). (generate_descriptor_table): Call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(). (generate_method_descriptors, build_protocol_initializer, generate_dispatch_tables, build_category_initializer, build_shared_structure_initializer): Do not call groktypename(). (generate_protocols): Call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(); do not call groktypename(). (error_with_ivar): Remove last parameter. (check_ivars): Do not iterate ovar CLASS_RAW_IVARS lists in addition to CLASS_IVARS lists; adjust calls to error_with_ivar(). (generate_ivar_lists): Convert one of the initializer elements; do not call groktypename(). (get_arg_type_list, start_method_def, gen_method_def): Account for new representation of variable arguments and '...' in Objective-C methods; add Objective-C++ impedance matching code. (is_objc_type_qualifier): Remove function. (adjust_type_for_id_default): Simplify; there is no longer a need to wade through declspecs. (lookup_interface, start_class, continue_class, finish_class, start_method_def, start_protocol, build_method_decl, objc_add_method, add_instance_variable, build_ivar_reference, is_ivar, is_private, get_super_receiver, objc_build_finally_epilogue): Make into static functions. (receiver_is_class_object): Use new IS_CLASS() macro. (objc_build_message_expr): Tweak ObjC++ message argument handling; call objc_finish_message_expr() instead of finish_message_expr(). (finish_message_expr): Rename to objc_finish_message_expr(); use OBJC_TYPE_NAME and OBJC_SET_TYPE_NAME macros instead of TYPE_NAME. call gen_type_name() instead of gen_declaration(); call objc_is_id() instead of using IS_ID and IS_CLASS; Use objc_class_name instead of calling get_identifier("Class"); handle CONVERT_EXPRs in receiver. (build_objc_method_call, warn_with_method): Do not call groktypename(). (build_ivar_reference): Call convert() instead of clobbering in a type. (hash_init): Initialize string_htab hash table. (add_instance_variable): Simplify parameter list; do not call grokfield(); do not populate CLASS_IVARS list. (start_class): Check for the existence of super class, if one was specified. (continue_class): Use CLASS_RAW_IVARS rather than CLASS_IVARS; do not call build_class_template(); adjust call to get_class_ivars(); call build_decl(), pushdecl() and finish_decl() instead of define_decl(). (finish_class): Call build_decl(), pushdecl() and finish_decl() instead of define_decl(). (add_protocols): Use PROTOCOL_BINFO_ELTS for the tree vector size. (start_protocol): Do not call build_protocol_template(); use PROTOCOL_BINFO_ELTS for the tree vector size. (encode_type_qualifiers): Do not handle the 'const' qualifier here. (encode_pointer): Encode 'const char *' as 'r*', for backwards compatibility. (encode_array): Use HOST_WIDE_INT_PRINT_DEC instead of "%ld". (encode_type): Handle the 'const' qualifier here. (objc_parmlist): New global variable, sued by objc_push_parm and objc_get_parm_info(). (objc_push_parm, objc_get_parm_info): New functions. (objc_expr_last): Remove function. (synth_self_and_ucmd_args): For instance methods, use the instance type for 'self'; call objc_push_parm() instead of push_parm_decl(). (start_method_def): Do not call push_scope(), declare_parm_level(), pop_scope(), push_parm_decl(), store_parm_decls() or objc_expr_last(); just use objc_push_parm() and objc_get_parm_info(). (comp_method_with_proto): Remove function. (objc_types_are_equivalent): Strip away indirections before comparing underlying types. (comp_proto_with_proto): Do not call groktypename(); types are no longer in raw declspec format. (objc_start_function): New function. (really_start_method): Call comp_proto_with_proto() instead of comp_method_with_proto(); call objc_start_function() instead of hand-crafting a function declarator. (continue_method_def, objc_expand_function_end): Remove functions. (get_super_receiver): Call objc_get_current_scope() instead of get_current_scope(); reference 'super_class' field (instead of 'class'). (finish_method_def): Rename to objc_finish_method_definition() and add a function decl parameter; move method encoding call from objc_expand_function_end(). (is_complex_decl, adorn_decl, gen_declarator, gen_declspecs, gen_declaration_1): Remove functions. (tmpbuf, RAW_DECLSPEC): Remove. (gen_declaration): Remove second parameter; simplify to deal with TYPE_P nodes instead of raw declspecs. (gen_type_name, gen_type_name_0): New functions. (gen_method_decl): Remove second parameter; call gen_type_name() instead of gen_declaration_1(). (dump_interface): Adjust calls to gen_declaration() and gen_method_decl(); do not allocate a separate string buffer. (init_objc): Allocate a larger string buffer to accommodate dump_interface(); adjust call to build_module_descriptor(); add call to build_module_initializer_routine() for the GNU runtime. (generate_classref_translation_entry): Do not call start_decl(); call finish_var_decl() instead of finish_decl(); call convert() instead of build_c_cast(). * objc-act.h (CLASS_OWN_IVARS): Remove accessor. (CLASS_BINFO_ELTS): Reduce from 6 to 5, now that CLASS_OWN_IVARS is gone. (OCTI_GNU_INIT_DECL, GNU_INIT_decl): New. (OCTI_ELLIPSIS_NODE, objc_ellipsis_node): Remove. (OCTI_ID_ID, id_type, objc_id_id): Rename to OCTI_ID_NAME, objc_object_type and objc_object_name, respectively. (OCTI_CLS_REF, OCTI_CLASS_NAME, objc_class_reference, objc_class_name): New. (IS_CLASS): New macro. (IS_ID, IS_SUPER): Robustify. (OCTI_EXECCLASS_DECL, execclass_decl): New. (finish_file, start_class, continue_class, finish_class, start_method_def, continue_method_def, finish_method_def, start_protocol, finish_protocol, objc_build_throw_stmt, objc_build_try_catch_finally_stmt, objc_build_synchronized_prologue, objc_build_synchronized_epilogue, objc_build_try_prologue, objc_build_try_epilogue, objc_build_catch_stmt, objc_build_catch_epilogue, objc_build_finally_prologue, objc_build_finally_epilogue, is_ivar, is_private, is_public, add_instance_variable, objc_add_method, get_super_receiver, objc_clear_super_receiver, get_class_ivars_from_name, get_class_reference, get_static_reference, get_object_reference, build_message_expr, finish_message_expr, build_selector_expr, build_ivar_reference, build_keyword_decl, build_method_decl, build_protocol_expr, build_objc_string_object, objc_declare_alias, objc_declare_class, objc_declare_protocols, objc_comptypes, objc_check_decl, build_encode_expr): Remove prototypes. (imp_count, cat_count): Make GGC-aware. (OBJC_SET_TYPE_NAME): New macro. From-SVN: r87168
2004-09-08 02:49:44 +02:00
/* The following GNU runtime entry point is called to initialize
each module:
__objc_exec_class (void *); */
type
= build_function_type (void_type_node,
tree_cons (NULL_TREE, ptr_type_node,
OBJC_VOID_AT_END));
decl.c: Include langhooks.h. * gcc/java/decl.c: Include langhooks.h. (builtin_function): Remove. (java_init_decl_processing): Replace calls to builtin_function with add_builtin_function. * gcc/java/Make-lang.in (jc1$(exeext)): Depend on and link with attribs.o. (java/decl.o): Depend on langhooks.h. * gcc/java/java-tree.h (builtin_function): Remove. * gcc/tree.c (local_define_builtin): Replace calls to lang_hooks.builtin_function with add_builtin_function. * gcc/objc/objc-act.c (synth_module_prologue): Replace calls to builtin_function with add_builtin_function. (build_next_objc_exception_stuff): Replace calls to builtin_function with add_builtin_function. (build_objc_exception_stuff): Replace calls to builtin_function with add_builtin_function. * gcc/objcp/objcp-decl.h (objcp_builtin_function): Remove. * gcc/cp/decl.c (builtin_function_1): Move common code to add_builtin_function. (builtin_function): Rename to cxx_builtin_function. Change the signature. * gcc/cp/call.c: Include langhooks.h. (build_java_interface_fn_ref): Replace calls to builtin_function with add_builtin_function. * gcc/cp/Make-lang.in (cp/call.o): Depend on langhooks.h. * gcc/cp/cp-objcp-common.h (LANG_HOOKS_BUILTIN_FUNCTION): Define as cxx_builtin_function. * gcc/cp/cp-tree.h (builtin_function): Rename to cxx_builtin_function. Change the signature. * gcc/c-objc-common.h (LANG_HOOKS_BUILTIN_FUNCTION): Define as c_builtin_function. * gcc/c-tree.h (builtin_function): Rename to c_builtin_function. Change the signature. * gcc/ada/utils.c (builtin_function): Rename to gnat_builtin_function. Move common code to add_builtin_function. * gcc/ada/misc.c (LANG_HOOKS_BUILTIN_FUNCTION): Define as gnat_builtin_function. * gcc/ada/gigi.h (builtin_function): Rename to gnat_builtin_function. Change the signature. * gcc/c-decl.c (builtin_function): Rename to c_builtin_function. Move common code to add_builtin_function. * gcc/fortran/Make-lang.in (f951$(exeext)): Depend on and link with attribs.o. * gcc/fortran/trans.h (builtin_function): Rename to gfc_builtin_function. Change the signature. * gcc/fortran/f95-lang.c (LANG_HOOKS_BUILTIN_FUNCTION): Define as gfc_builtin_function. (builtin_function): Rename to gfc_builtin_function. Move common code to builtin_function. (gfc_define_builtin): Replace calls to builtin_function with gfc_define_builtin. * gcc/langhooks.c (add_builtin_function): New function. (lhd_builtin_function): New function. * gcc/langhooks.h (struct lang_hooks): Change the signature of builtin_function. (add_builtin_function): New function. * gcc/treelang/treetree.c (builtin_function): Remove. * gcc/tree-ssa-loop-prefetch.c (tree_ssa_prefetch_arrays): Replace calls to lang_hooks.builtin_function with add_builtin_function. * gcc/c-common.c (decl_builtin_1): Replace calls to lang_hooks.builtin_function with add_builtin_function. * gcc/config/alpha/alpha.c (alpha_init_builtins): Replace calls to lang_hooks.builtin_function with add_builtin_function. * gcc/config/frv/frv.c (def_builtin): Replace calls to lang_hooks.builtin_function with add_builtin_function. * gcc/config/s390/s390.c (s390_init_builtins): Replace calls to lang_hooks.builtin_function with add_builtin_function. * gcc/config/sparc/sparc.c (def_builtin): Replace calls to lang_hooks.builtin_function with add_builtin_function. * gcc/config/i386/i386.c (def_builtin): Replace calls to lang_hooks.builtin_function with add_builtin_function. (def_builtin): Replace calls to lang_hooks.builtin_function with add_builtin_function. * gcc/config/sh/sh.c (sh_media_init_builtins): Replace calls to lang_hooks.builtin_function with add_builtin_function. * gcc/config/c4x/c4x.c (c4x_init_builtins): Replace calls to lang_hooks.builtin_function with add_builtin_function. * gcc/config/stormy16/stormy16.c (xstormy16_init_builtins): Replace calls to lang_hooks.builtin_function with add_builtin_function. * gcc/config/iq2000/iq2000.c (def_builtin): Replace calls to lang_hooks.builtin_function with add_builtin_function. * gcc/config/ia64/ia64.c (def_builtin): Replace calls to lang_hooks.builtin_function with add_builtin_function. * gcc/config/rs6000/rs6000.c (def_builtin): Replace calls to lang_hooks.builtin_function with add_builtin_function. (altivec_init_builtins): Replace calls to lang_hooks.builtin_function with add_builtin_function. * gcc/config/arm/arm.c (def_mbuiltin): Replace calls to lang_hooks.builtin_function with add_builtin_function. (arm_init_tls_builtins): Replace calls to lang_hooks.builtin_function with add_builtin_function. * gcc/config/mips/mips.c (mips_init_builtins): Replace calls to lang_hooks.builtin_function with add_builtin_function. * gcc/config/bfin/bfin.c (def_builtin): Replace calls to lang_hooks.builtin_function with add_builtin_function. * gcc/langhooks-def.h (lhd_builtin_function): New function. (LANG_HOOKS_BUILTIN_FUNCTION): Define as lhd_builtin_function. From-SVN: r117981
2006-10-23 21:47:58 +02:00
execclass_decl = add_builtin_function (TAG_EXECCLASS,
type, 0, NOT_BUILT_IN,
NULL, NULL_TREE);
}
/* id objc_getClass (const char *); */
1992-01-18 00:15:38 +01:00
Makefile.in (c-parse.o): Depend on $(C_COMMON_H). [gcc/ChangeLog] 2004-09-07 Ziemowit Laski <zlaski@apple.com> * Makefile.in (c-parse.o): Depend on $(C_COMMON_H). * c-parse.in: Include c-common.h instead of objc-act.h. (ivar_decl_list, ivar_decls, ivar_decl, ivars, ivar_declarator, myparms, myparm): Remove %type declarations. (methodtype, optparms, OBJC_TYPE_QUAL, objc_quals, objc_qual, objc_typename, objc_try_catch_stmt, optellipsis): Add %type declarations. (objc_inherit_code, objc_public_flag): Remove. (typespec_nonreserved_nonattr): Call objc_get_protocol_qualified_type() instead of get_static_reference() and get_protocol_reference(). (stmt_nocomp): Call grokparm() on @catch parameter. (objcdef): Move semantic action to objc_finish_implementation(). (classdef): Move semantic action to objc_start_class_interface(), objc_continue_interface(), objc_finish_interface(), objc_start_class_implementation(), objc_continue_implementation(), objc_start_category_interface() and objc_start_category_implementation(). (protocoldef): Move semantic actions to objc_start_protocol() and objc_finish_interface(). (ivar_decl_list): Remove nonterminal. (visibility_spec): Move semantic actions to objc_set_visibility(). (ivar_decls): Remove assignment to $$. (ivar_decl): Rephrase in terms of component_decl; call objc_add_instance_variable(). (ivars, ivar_declarator): Remove nonterminals. (opt_semi): New nonterminal. (methodtype): Remove semantic actions. (methoddef): Move semantic actions to objc_set_method_type(), objc_start_method_definition() and objc_finish_method_definition(). (methodproto): Move semantic actions to objc_set_method_type() and objc_add_method_declaration(). (methoddecl): Use objc_typename instead of typename; move semantic actions to objc_build_method_signature(). (optarglist, myxdecls, mydecl, myparms, myparm): Remove nonterminals. (optparmlist): Express in terms of optparms and optellipsis. (optparms, optellipsis, objc_qual, objc_quals, objc_typename): New nonterminals. (keyworddecl): Use objc_typename instead of typename. (rid_to_yy): Mark RID_IN, RID_OUT, RID_INOUT, RID_BYCOPY, RID_BYREF and RID_ONEWAY as returning OBJC_TYPE_QUAL to yyparse(). [gcc/objc/ChangeLog] 2004-09-07 Ziemowit Laski <zlaski@apple.com> * Make-lang.in (objc/objc-parse.o): Depend on $(C_COMMON_H) instead of objc/objc-act.h. (objc/objc-act.o): Depend on $(HASHTAB_H). * objc-act.c: Include hashtab.h; in ObjC++ mode, include cp-tree.h and objcp-decl.h instead of c-tree.h. (build_module_descriptor, get_class_ivars, synth_id_with_class_suffix, error_with_ivar, gen_method_decl, gen_declaration, setup_string_decl, build_protocol_template): Adjust prototypes. (build_module_initializer_routine, start_class, continue_class, finish_class, start_method_def, objc_start_function, start_protocol, build_method_decl, objc_add_method, add_instance_variable, build_ivar_reference, is_ivar, is_private, get_super_receiver, build_selector_table_decl, objc_push_parm, objc_get_parm_info, gen_type_name, gen_type_name_0, start_var_decl, finish_var_decl, create_field_decl): New prototypes. (objc_expand_function_end, comp_method_with_proto, objc_expr_last, gen_declaration_1, gen_declarator, is_complex_decl, adorn_decl, define_decl, create_builtin_decl, gen_declspecs): Remove prototypes. (TYPE_ID): Rename to OBJECT_TYPEDEF_NAME. (CLASS_TYPEDEF_NAME): New. (TAG_EXECCLASS): Change from a global variable to a #define. (TAG_RETURN_STRUCT): Delete. (TAG_GNUINIT): New, holds '__objc_gnu_init' name. (objc_inherit_code, objc_public_flag): New, moved from c-parse.in. (string_descriptor): New struct. (string_htab): New hash table. (string_hash, string_eq): New prototypes. (generate_struct_by_value_array): Call create_field_decl() instead of create_builtin_decl(). (objc_init): Do not initialize objc_ellipsis_node or TAG_EXECCLASS; In ObjC++ mode, call cxx_init() instead of c_objc_common_init(). (objc_finish_file): In ObjC++, call instantiate_pending_templates() and cp_finish_file(). (define_decl, get_static_reference, get_protocol_reference, create_builtin_decl): Remove functions. (objc_start_class_interface, objc_start_category_interface, objc_start_protocol, objc_continue_interface, objc_finish_interface, objc_start_class_implementation, objc_start_category_implementation, objc_continue_implementation, objc_finish_implementation, objc_set_visibility, objc_set_method_type, objc_build_method_signature, objc_add_method_declaration, objc_start_method_definition, objc_add_instance_variable, objc_get_protocol_qualified_type, create_field_decl, start_var_decl, finish_var_decl): New functions. (setup_string_decl): Simplify since it is only called once. (synth_module_prologue): Call build_class_template(); predefine 'id' and 'Class' as typedefs; rename 'temp_type' to 'type'; disable debug hooks for duration of function; fix GNU runtime messenger signatures to correspond to reality; forward-declare '__objc_exec_class' for the GNU runtime; call build_selector_table_decl(); in ObjC++ mode, generate 'extern "C" { ... }' wrappers around synthesized declarations; call build_protocol_template() and build_category_template(). (string_hash, string_eq): New functions. (objc_build_string_object): Check metaclass correctness only once; store string literals in hash table. (objc_build_constructor): Do not convert initializer elements; adjust for ObjC++ impedance mismatch. (build_objc_symtab_template): Call create_field_decl() instead of create_builtin_decl(). (init_objc_symtab): Add missing conversion to initializer element. (build_metadata_decl): Call start_var_decl() instead of define_decl(). (generate_objc_symtab_decl): Do not call build_category_template(); call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(). (build_module_descriptor): Call create_field_decl() instead of grokfield(); call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(); always mark module descriptor as used; move GNU runtime-specific functionality to build_module_initializer_routine(). (build_module_initializer_routine): New function, broken off of build_module_descriptor(). (objc_static_init_needed_p, objc_generate_static_init_call): New functions. (generate_static_references, generate_strings, build_selector_translation_table, generate_descriptor_table, generate_ivars_list, generate_dispatch_table, generate_category): Call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(); build a type directly instead of via groktypename(). (build_selector_reference_decl, build_selector_table_decl, build_class_reference_decl, build_protocol_reference, generate_objc_image_info): Call start_var_decl() instead of build_decl(). (build_selector_reference): For GNU runtime, do not call build_selector_reference_decl(). (build_selector, build_typed_selector_reference): Always convert result to the selector type. (add_objc_string): Cast return value to 'char *'. (build_method_prototype_template, build_selector_template, build_method_template): Use actual selector type for fields pointing to selectors. (finish_objc): For GNU runtime, call build_module_initializer_routine() after build_module_descriptor(). (generate_protocol_list, generate_shared_structures): Call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(); build a type directly instead of via groktypename(). (synth_id_with_class_suffix): Return a string. (get_arg_type_list): For instance methods, use the instance type for 'self'; do not call groktypename_in_parm_context(). (build_objc_string_decl): Squash redeclaration errors in ObjC++. (objc_is_class_name): Use OBJC_TYPE_NAME instead of TYPE_NAME; handle RECORD_TYPEs in ObjC as well as ObjC++. (objc_is_id): New function. (objc_is_object_ptr): Return the canonical type node. (objc_get_class_ivars): Simplify using get_class_ivars(). (get_class_ivars): Remove second parameter; create a fresh copy of the ivar list for each call; do not check for existence of super class. (objc_eh_runtime_type): Mark #ifndef OBJCPLUS. (objc_init_exceptions): When using SJLJ-style exceptions, require the use of '-fobjc-exceptions' flag; do not require it for DWARF-style exceptions. (objc_build_exc_ptr, next_sjlj_build_try_catch_finally): Use objc_object_type instead of objc_id_type. (objc_begin_catch_clause): Convert the incoming PARM_DECL into a VAR_DECL before placing it in the appropriate scope; do not call define_decl(); adjust call to c_begin_compound_stmt(); use objc_object_type instead of objc_id_type. (build_next_objc_exception_stuff): Call create_field_decl() instead of create_builtin_decl(); construct type directly instead of calling groktypename(); use OBJC_VOID_AT_END to mark end of function parameters. (build_private_template): Adjust call to get_class_ivars(); build a type directly instead of via groktypename(). (build_protocol_template, build_method_prototype_list_template, build_method_prototype_template, build_category_template, build_selector_template, build_class_template, build_super_template, build_ivar_template, build_ivar_list_template, build_method_list_template, build_method_template): Call create_field_decl() instead of grokfield(). (objc_method_parm_type): Do not call groktypename(). (generate_descriptor_table): Call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(). (generate_method_descriptors, build_protocol_initializer, generate_dispatch_tables, build_category_initializer, build_shared_structure_initializer): Do not call groktypename(). (generate_protocols): Call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(); do not call groktypename(). (error_with_ivar): Remove last parameter. (check_ivars): Do not iterate ovar CLASS_RAW_IVARS lists in addition to CLASS_IVARS lists; adjust calls to error_with_ivar(). (generate_ivar_lists): Convert one of the initializer elements; do not call groktypename(). (get_arg_type_list, start_method_def, gen_method_def): Account for new representation of variable arguments and '...' in Objective-C methods; add Objective-C++ impedance matching code. (is_objc_type_qualifier): Remove function. (adjust_type_for_id_default): Simplify; there is no longer a need to wade through declspecs. (lookup_interface, start_class, continue_class, finish_class, start_method_def, start_protocol, build_method_decl, objc_add_method, add_instance_variable, build_ivar_reference, is_ivar, is_private, get_super_receiver, objc_build_finally_epilogue): Make into static functions. (receiver_is_class_object): Use new IS_CLASS() macro. (objc_build_message_expr): Tweak ObjC++ message argument handling; call objc_finish_message_expr() instead of finish_message_expr(). (finish_message_expr): Rename to objc_finish_message_expr(); use OBJC_TYPE_NAME and OBJC_SET_TYPE_NAME macros instead of TYPE_NAME. call gen_type_name() instead of gen_declaration(); call objc_is_id() instead of using IS_ID and IS_CLASS; Use objc_class_name instead of calling get_identifier("Class"); handle CONVERT_EXPRs in receiver. (build_objc_method_call, warn_with_method): Do not call groktypename(). (build_ivar_reference): Call convert() instead of clobbering in a type. (hash_init): Initialize string_htab hash table. (add_instance_variable): Simplify parameter list; do not call grokfield(); do not populate CLASS_IVARS list. (start_class): Check for the existence of super class, if one was specified. (continue_class): Use CLASS_RAW_IVARS rather than CLASS_IVARS; do not call build_class_template(); adjust call to get_class_ivars(); call build_decl(), pushdecl() and finish_decl() instead of define_decl(). (finish_class): Call build_decl(), pushdecl() and finish_decl() instead of define_decl(). (add_protocols): Use PROTOCOL_BINFO_ELTS for the tree vector size. (start_protocol): Do not call build_protocol_template(); use PROTOCOL_BINFO_ELTS for the tree vector size. (encode_type_qualifiers): Do not handle the 'const' qualifier here. (encode_pointer): Encode 'const char *' as 'r*', for backwards compatibility. (encode_array): Use HOST_WIDE_INT_PRINT_DEC instead of "%ld". (encode_type): Handle the 'const' qualifier here. (objc_parmlist): New global variable, sued by objc_push_parm and objc_get_parm_info(). (objc_push_parm, objc_get_parm_info): New functions. (objc_expr_last): Remove function. (synth_self_and_ucmd_args): For instance methods, use the instance type for 'self'; call objc_push_parm() instead of push_parm_decl(). (start_method_def): Do not call push_scope(), declare_parm_level(), pop_scope(), push_parm_decl(), store_parm_decls() or objc_expr_last(); just use objc_push_parm() and objc_get_parm_info(). (comp_method_with_proto): Remove function. (objc_types_are_equivalent): Strip away indirections before comparing underlying types. (comp_proto_with_proto): Do not call groktypename(); types are no longer in raw declspec format. (objc_start_function): New function. (really_start_method): Call comp_proto_with_proto() instead of comp_method_with_proto(); call objc_start_function() instead of hand-crafting a function declarator. (continue_method_def, objc_expand_function_end): Remove functions. (get_super_receiver): Call objc_get_current_scope() instead of get_current_scope(); reference 'super_class' field (instead of 'class'). (finish_method_def): Rename to objc_finish_method_definition() and add a function decl parameter; move method encoding call from objc_expand_function_end(). (is_complex_decl, adorn_decl, gen_declarator, gen_declspecs, gen_declaration_1): Remove functions. (tmpbuf, RAW_DECLSPEC): Remove. (gen_declaration): Remove second parameter; simplify to deal with TYPE_P nodes instead of raw declspecs. (gen_type_name, gen_type_name_0): New functions. (gen_method_decl): Remove second parameter; call gen_type_name() instead of gen_declaration_1(). (dump_interface): Adjust calls to gen_declaration() and gen_method_decl(); do not allocate a separate string buffer. (init_objc): Allocate a larger string buffer to accommodate dump_interface(); adjust call to build_module_descriptor(); add call to build_module_initializer_routine() for the GNU runtime. (generate_classref_translation_entry): Do not call start_decl(); call finish_var_decl() instead of finish_decl(); call convert() instead of build_c_cast(). * objc-act.h (CLASS_OWN_IVARS): Remove accessor. (CLASS_BINFO_ELTS): Reduce from 6 to 5, now that CLASS_OWN_IVARS is gone. (OCTI_GNU_INIT_DECL, GNU_INIT_decl): New. (OCTI_ELLIPSIS_NODE, objc_ellipsis_node): Remove. (OCTI_ID_ID, id_type, objc_id_id): Rename to OCTI_ID_NAME, objc_object_type and objc_object_name, respectively. (OCTI_CLS_REF, OCTI_CLASS_NAME, objc_class_reference, objc_class_name): New. (IS_CLASS): New macro. (IS_ID, IS_SUPER): Robustify. (OCTI_EXECCLASS_DECL, execclass_decl): New. (finish_file, start_class, continue_class, finish_class, start_method_def, continue_method_def, finish_method_def, start_protocol, finish_protocol, objc_build_throw_stmt, objc_build_try_catch_finally_stmt, objc_build_synchronized_prologue, objc_build_synchronized_epilogue, objc_build_try_prologue, objc_build_try_epilogue, objc_build_catch_stmt, objc_build_catch_epilogue, objc_build_finally_prologue, objc_build_finally_epilogue, is_ivar, is_private, is_public, add_instance_variable, objc_add_method, get_super_receiver, objc_clear_super_receiver, get_class_ivars_from_name, get_class_reference, get_static_reference, get_object_reference, build_message_expr, finish_message_expr, build_selector_expr, build_ivar_reference, build_keyword_decl, build_method_decl, build_protocol_expr, build_objc_string_object, objc_declare_alias, objc_declare_class, objc_declare_protocols, objc_comptypes, objc_check_decl, build_encode_expr): Remove prototypes. (imp_count, cat_count): Make GGC-aware. (OBJC_SET_TYPE_NAME): New macro. From-SVN: r87168
2004-09-08 02:49:44 +02:00
type = build_function_type (objc_object_type,
tree_cons (NULL_TREE,
const_string_type_node,
Makefile.in (c-parse.o): Depend on $(C_COMMON_H). [gcc/ChangeLog] 2004-09-07 Ziemowit Laski <zlaski@apple.com> * Makefile.in (c-parse.o): Depend on $(C_COMMON_H). * c-parse.in: Include c-common.h instead of objc-act.h. (ivar_decl_list, ivar_decls, ivar_decl, ivars, ivar_declarator, myparms, myparm): Remove %type declarations. (methodtype, optparms, OBJC_TYPE_QUAL, objc_quals, objc_qual, objc_typename, objc_try_catch_stmt, optellipsis): Add %type declarations. (objc_inherit_code, objc_public_flag): Remove. (typespec_nonreserved_nonattr): Call objc_get_protocol_qualified_type() instead of get_static_reference() and get_protocol_reference(). (stmt_nocomp): Call grokparm() on @catch parameter. (objcdef): Move semantic action to objc_finish_implementation(). (classdef): Move semantic action to objc_start_class_interface(), objc_continue_interface(), objc_finish_interface(), objc_start_class_implementation(), objc_continue_implementation(), objc_start_category_interface() and objc_start_category_implementation(). (protocoldef): Move semantic actions to objc_start_protocol() and objc_finish_interface(). (ivar_decl_list): Remove nonterminal. (visibility_spec): Move semantic actions to objc_set_visibility(). (ivar_decls): Remove assignment to $$. (ivar_decl): Rephrase in terms of component_decl; call objc_add_instance_variable(). (ivars, ivar_declarator): Remove nonterminals. (opt_semi): New nonterminal. (methodtype): Remove semantic actions. (methoddef): Move semantic actions to objc_set_method_type(), objc_start_method_definition() and objc_finish_method_definition(). (methodproto): Move semantic actions to objc_set_method_type() and objc_add_method_declaration(). (methoddecl): Use objc_typename instead of typename; move semantic actions to objc_build_method_signature(). (optarglist, myxdecls, mydecl, myparms, myparm): Remove nonterminals. (optparmlist): Express in terms of optparms and optellipsis. (optparms, optellipsis, objc_qual, objc_quals, objc_typename): New nonterminals. (keyworddecl): Use objc_typename instead of typename. (rid_to_yy): Mark RID_IN, RID_OUT, RID_INOUT, RID_BYCOPY, RID_BYREF and RID_ONEWAY as returning OBJC_TYPE_QUAL to yyparse(). [gcc/objc/ChangeLog] 2004-09-07 Ziemowit Laski <zlaski@apple.com> * Make-lang.in (objc/objc-parse.o): Depend on $(C_COMMON_H) instead of objc/objc-act.h. (objc/objc-act.o): Depend on $(HASHTAB_H). * objc-act.c: Include hashtab.h; in ObjC++ mode, include cp-tree.h and objcp-decl.h instead of c-tree.h. (build_module_descriptor, get_class_ivars, synth_id_with_class_suffix, error_with_ivar, gen_method_decl, gen_declaration, setup_string_decl, build_protocol_template): Adjust prototypes. (build_module_initializer_routine, start_class, continue_class, finish_class, start_method_def, objc_start_function, start_protocol, build_method_decl, objc_add_method, add_instance_variable, build_ivar_reference, is_ivar, is_private, get_super_receiver, build_selector_table_decl, objc_push_parm, objc_get_parm_info, gen_type_name, gen_type_name_0, start_var_decl, finish_var_decl, create_field_decl): New prototypes. (objc_expand_function_end, comp_method_with_proto, objc_expr_last, gen_declaration_1, gen_declarator, is_complex_decl, adorn_decl, define_decl, create_builtin_decl, gen_declspecs): Remove prototypes. (TYPE_ID): Rename to OBJECT_TYPEDEF_NAME. (CLASS_TYPEDEF_NAME): New. (TAG_EXECCLASS): Change from a global variable to a #define. (TAG_RETURN_STRUCT): Delete. (TAG_GNUINIT): New, holds '__objc_gnu_init' name. (objc_inherit_code, objc_public_flag): New, moved from c-parse.in. (string_descriptor): New struct. (string_htab): New hash table. (string_hash, string_eq): New prototypes. (generate_struct_by_value_array): Call create_field_decl() instead of create_builtin_decl(). (objc_init): Do not initialize objc_ellipsis_node or TAG_EXECCLASS; In ObjC++ mode, call cxx_init() instead of c_objc_common_init(). (objc_finish_file): In ObjC++, call instantiate_pending_templates() and cp_finish_file(). (define_decl, get_static_reference, get_protocol_reference, create_builtin_decl): Remove functions. (objc_start_class_interface, objc_start_category_interface, objc_start_protocol, objc_continue_interface, objc_finish_interface, objc_start_class_implementation, objc_start_category_implementation, objc_continue_implementation, objc_finish_implementation, objc_set_visibility, objc_set_method_type, objc_build_method_signature, objc_add_method_declaration, objc_start_method_definition, objc_add_instance_variable, objc_get_protocol_qualified_type, create_field_decl, start_var_decl, finish_var_decl): New functions. (setup_string_decl): Simplify since it is only called once. (synth_module_prologue): Call build_class_template(); predefine 'id' and 'Class' as typedefs; rename 'temp_type' to 'type'; disable debug hooks for duration of function; fix GNU runtime messenger signatures to correspond to reality; forward-declare '__objc_exec_class' for the GNU runtime; call build_selector_table_decl(); in ObjC++ mode, generate 'extern "C" { ... }' wrappers around synthesized declarations; call build_protocol_template() and build_category_template(). (string_hash, string_eq): New functions. (objc_build_string_object): Check metaclass correctness only once; store string literals in hash table. (objc_build_constructor): Do not convert initializer elements; adjust for ObjC++ impedance mismatch. (build_objc_symtab_template): Call create_field_decl() instead of create_builtin_decl(). (init_objc_symtab): Add missing conversion to initializer element. (build_metadata_decl): Call start_var_decl() instead of define_decl(). (generate_objc_symtab_decl): Do not call build_category_template(); call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(). (build_module_descriptor): Call create_field_decl() instead of grokfield(); call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(); always mark module descriptor as used; move GNU runtime-specific functionality to build_module_initializer_routine(). (build_module_initializer_routine): New function, broken off of build_module_descriptor(). (objc_static_init_needed_p, objc_generate_static_init_call): New functions. (generate_static_references, generate_strings, build_selector_translation_table, generate_descriptor_table, generate_ivars_list, generate_dispatch_table, generate_category): Call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(); build a type directly instead of via groktypename(). (build_selector_reference_decl, build_selector_table_decl, build_class_reference_decl, build_protocol_reference, generate_objc_image_info): Call start_var_decl() instead of build_decl(). (build_selector_reference): For GNU runtime, do not call build_selector_reference_decl(). (build_selector, build_typed_selector_reference): Always convert result to the selector type. (add_objc_string): Cast return value to 'char *'. (build_method_prototype_template, build_selector_template, build_method_template): Use actual selector type for fields pointing to selectors. (finish_objc): For GNU runtime, call build_module_initializer_routine() after build_module_descriptor(). (generate_protocol_list, generate_shared_structures): Call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(); build a type directly instead of via groktypename(). (synth_id_with_class_suffix): Return a string. (get_arg_type_list): For instance methods, use the instance type for 'self'; do not call groktypename_in_parm_context(). (build_objc_string_decl): Squash redeclaration errors in ObjC++. (objc_is_class_name): Use OBJC_TYPE_NAME instead of TYPE_NAME; handle RECORD_TYPEs in ObjC as well as ObjC++. (objc_is_id): New function. (objc_is_object_ptr): Return the canonical type node. (objc_get_class_ivars): Simplify using get_class_ivars(). (get_class_ivars): Remove second parameter; create a fresh copy of the ivar list for each call; do not check for existence of super class. (objc_eh_runtime_type): Mark #ifndef OBJCPLUS. (objc_init_exceptions): When using SJLJ-style exceptions, require the use of '-fobjc-exceptions' flag; do not require it for DWARF-style exceptions. (objc_build_exc_ptr, next_sjlj_build_try_catch_finally): Use objc_object_type instead of objc_id_type. (objc_begin_catch_clause): Convert the incoming PARM_DECL into a VAR_DECL before placing it in the appropriate scope; do not call define_decl(); adjust call to c_begin_compound_stmt(); use objc_object_type instead of objc_id_type. (build_next_objc_exception_stuff): Call create_field_decl() instead of create_builtin_decl(); construct type directly instead of calling groktypename(); use OBJC_VOID_AT_END to mark end of function parameters. (build_private_template): Adjust call to get_class_ivars(); build a type directly instead of via groktypename(). (build_protocol_template, build_method_prototype_list_template, build_method_prototype_template, build_category_template, build_selector_template, build_class_template, build_super_template, build_ivar_template, build_ivar_list_template, build_method_list_template, build_method_template): Call create_field_decl() instead of grokfield(). (objc_method_parm_type): Do not call groktypename(). (generate_descriptor_table): Call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(). (generate_method_descriptors, build_protocol_initializer, generate_dispatch_tables, build_category_initializer, build_shared_structure_initializer): Do not call groktypename(). (generate_protocols): Call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(); do not call groktypename(). (error_with_ivar): Remove last parameter. (check_ivars): Do not iterate ovar CLASS_RAW_IVARS lists in addition to CLASS_IVARS lists; adjust calls to error_with_ivar(). (generate_ivar_lists): Convert one of the initializer elements; do not call groktypename(). (get_arg_type_list, start_method_def, gen_method_def): Account for new representation of variable arguments and '...' in Objective-C methods; add Objective-C++ impedance matching code. (is_objc_type_qualifier): Remove function. (adjust_type_for_id_default): Simplify; there is no longer a need to wade through declspecs. (lookup_interface, start_class, continue_class, finish_class, start_method_def, start_protocol, build_method_decl, objc_add_method, add_instance_variable, build_ivar_reference, is_ivar, is_private, get_super_receiver, objc_build_finally_epilogue): Make into static functions. (receiver_is_class_object): Use new IS_CLASS() macro. (objc_build_message_expr): Tweak ObjC++ message argument handling; call objc_finish_message_expr() instead of finish_message_expr(). (finish_message_expr): Rename to objc_finish_message_expr(); use OBJC_TYPE_NAME and OBJC_SET_TYPE_NAME macros instead of TYPE_NAME. call gen_type_name() instead of gen_declaration(); call objc_is_id() instead of using IS_ID and IS_CLASS; Use objc_class_name instead of calling get_identifier("Class"); handle CONVERT_EXPRs in receiver. (build_objc_method_call, warn_with_method): Do not call groktypename(). (build_ivar_reference): Call convert() instead of clobbering in a type. (hash_init): Initialize string_htab hash table. (add_instance_variable): Simplify parameter list; do not call grokfield(); do not populate CLASS_IVARS list. (start_class): Check for the existence of super class, if one was specified. (continue_class): Use CLASS_RAW_IVARS rather than CLASS_IVARS; do not call build_class_template(); adjust call to get_class_ivars(); call build_decl(), pushdecl() and finish_decl() instead of define_decl(). (finish_class): Call build_decl(), pushdecl() and finish_decl() instead of define_decl(). (add_protocols): Use PROTOCOL_BINFO_ELTS for the tree vector size. (start_protocol): Do not call build_protocol_template(); use PROTOCOL_BINFO_ELTS for the tree vector size. (encode_type_qualifiers): Do not handle the 'const' qualifier here. (encode_pointer): Encode 'const char *' as 'r*', for backwards compatibility. (encode_array): Use HOST_WIDE_INT_PRINT_DEC instead of "%ld". (encode_type): Handle the 'const' qualifier here. (objc_parmlist): New global variable, sued by objc_push_parm and objc_get_parm_info(). (objc_push_parm, objc_get_parm_info): New functions. (objc_expr_last): Remove function. (synth_self_and_ucmd_args): For instance methods, use the instance type for 'self'; call objc_push_parm() instead of push_parm_decl(). (start_method_def): Do not call push_scope(), declare_parm_level(), pop_scope(), push_parm_decl(), store_parm_decls() or objc_expr_last(); just use objc_push_parm() and objc_get_parm_info(). (comp_method_with_proto): Remove function. (objc_types_are_equivalent): Strip away indirections before comparing underlying types. (comp_proto_with_proto): Do not call groktypename(); types are no longer in raw declspec format. (objc_start_function): New function. (really_start_method): Call comp_proto_with_proto() instead of comp_method_with_proto(); call objc_start_function() instead of hand-crafting a function declarator. (continue_method_def, objc_expand_function_end): Remove functions. (get_super_receiver): Call objc_get_current_scope() instead of get_current_scope(); reference 'super_class' field (instead of 'class'). (finish_method_def): Rename to objc_finish_method_definition() and add a function decl parameter; move method encoding call from objc_expand_function_end(). (is_complex_decl, adorn_decl, gen_declarator, gen_declspecs, gen_declaration_1): Remove functions. (tmpbuf, RAW_DECLSPEC): Remove. (gen_declaration): Remove second parameter; simplify to deal with TYPE_P nodes instead of raw declspecs. (gen_type_name, gen_type_name_0): New functions. (gen_method_decl): Remove second parameter; call gen_type_name() instead of gen_declaration_1(). (dump_interface): Adjust calls to gen_declaration() and gen_method_decl(); do not allocate a separate string buffer. (init_objc): Allocate a larger string buffer to accommodate dump_interface(); adjust call to build_module_descriptor(); add call to build_module_initializer_routine() for the GNU runtime. (generate_classref_translation_entry): Do not call start_decl(); call finish_var_decl() instead of finish_decl(); call convert() instead of build_c_cast(). * objc-act.h (CLASS_OWN_IVARS): Remove accessor. (CLASS_BINFO_ELTS): Reduce from 6 to 5, now that CLASS_OWN_IVARS is gone. (OCTI_GNU_INIT_DECL, GNU_INIT_decl): New. (OCTI_ELLIPSIS_NODE, objc_ellipsis_node): Remove. (OCTI_ID_ID, id_type, objc_id_id): Rename to OCTI_ID_NAME, objc_object_type and objc_object_name, respectively. (OCTI_CLS_REF, OCTI_CLASS_NAME, objc_class_reference, objc_class_name): New. (IS_CLASS): New macro. (IS_ID, IS_SUPER): Robustify. (OCTI_EXECCLASS_DECL, execclass_decl): New. (finish_file, start_class, continue_class, finish_class, start_method_def, continue_method_def, finish_method_def, start_protocol, finish_protocol, objc_build_throw_stmt, objc_build_try_catch_finally_stmt, objc_build_synchronized_prologue, objc_build_synchronized_epilogue, objc_build_try_prologue, objc_build_try_epilogue, objc_build_catch_stmt, objc_build_catch_epilogue, objc_build_finally_prologue, objc_build_finally_epilogue, is_ivar, is_private, is_public, add_instance_variable, objc_add_method, get_super_receiver, objc_clear_super_receiver, get_class_ivars_from_name, get_class_reference, get_static_reference, get_object_reference, build_message_expr, finish_message_expr, build_selector_expr, build_ivar_reference, build_keyword_decl, build_method_decl, build_protocol_expr, build_objc_string_object, objc_declare_alias, objc_declare_class, objc_declare_protocols, objc_comptypes, objc_check_decl, build_encode_expr): Remove prototypes. (imp_count, cat_count): Make GGC-aware. (OBJC_SET_TYPE_NAME): New macro. From-SVN: r87168
2004-09-08 02:49:44 +02:00
OBJC_VOID_AT_END));
1992-01-18 00:15:38 +01:00
objc_get_class_decl
decl.c: Include langhooks.h. * gcc/java/decl.c: Include langhooks.h. (builtin_function): Remove. (java_init_decl_processing): Replace calls to builtin_function with add_builtin_function. * gcc/java/Make-lang.in (jc1$(exeext)): Depend on and link with attribs.o. (java/decl.o): Depend on langhooks.h. * gcc/java/java-tree.h (builtin_function): Remove. * gcc/tree.c (local_define_builtin): Replace calls to lang_hooks.builtin_function with add_builtin_function. * gcc/objc/objc-act.c (synth_module_prologue): Replace calls to builtin_function with add_builtin_function. (build_next_objc_exception_stuff): Replace calls to builtin_function with add_builtin_function. (build_objc_exception_stuff): Replace calls to builtin_function with add_builtin_function. * gcc/objcp/objcp-decl.h (objcp_builtin_function): Remove. * gcc/cp/decl.c (builtin_function_1): Move common code to add_builtin_function. (builtin_function): Rename to cxx_builtin_function. Change the signature. * gcc/cp/call.c: Include langhooks.h. (build_java_interface_fn_ref): Replace calls to builtin_function with add_builtin_function. * gcc/cp/Make-lang.in (cp/call.o): Depend on langhooks.h. * gcc/cp/cp-objcp-common.h (LANG_HOOKS_BUILTIN_FUNCTION): Define as cxx_builtin_function. * gcc/cp/cp-tree.h (builtin_function): Rename to cxx_builtin_function. Change the signature. * gcc/c-objc-common.h (LANG_HOOKS_BUILTIN_FUNCTION): Define as c_builtin_function. * gcc/c-tree.h (builtin_function): Rename to c_builtin_function. Change the signature. * gcc/ada/utils.c (builtin_function): Rename to gnat_builtin_function. Move common code to add_builtin_function. * gcc/ada/misc.c (LANG_HOOKS_BUILTIN_FUNCTION): Define as gnat_builtin_function. * gcc/ada/gigi.h (builtin_function): Rename to gnat_builtin_function. Change the signature. * gcc/c-decl.c (builtin_function): Rename to c_builtin_function. Move common code to add_builtin_function. * gcc/fortran/Make-lang.in (f951$(exeext)): Depend on and link with attribs.o. * gcc/fortran/trans.h (builtin_function): Rename to gfc_builtin_function. Change the signature. * gcc/fortran/f95-lang.c (LANG_HOOKS_BUILTIN_FUNCTION): Define as gfc_builtin_function. (builtin_function): Rename to gfc_builtin_function. Move common code to builtin_function. (gfc_define_builtin): Replace calls to builtin_function with gfc_define_builtin. * gcc/langhooks.c (add_builtin_function): New function. (lhd_builtin_function): New function. * gcc/langhooks.h (struct lang_hooks): Change the signature of builtin_function. (add_builtin_function): New function. * gcc/treelang/treetree.c (builtin_function): Remove. * gcc/tree-ssa-loop-prefetch.c (tree_ssa_prefetch_arrays): Replace calls to lang_hooks.builtin_function with add_builtin_function. * gcc/c-common.c (decl_builtin_1): Replace calls to lang_hooks.builtin_function with add_builtin_function. * gcc/config/alpha/alpha.c (alpha_init_builtins): Replace calls to lang_hooks.builtin_function with add_builtin_function. * gcc/config/frv/frv.c (def_builtin): Replace calls to lang_hooks.builtin_function with add_builtin_function. * gcc/config/s390/s390.c (s390_init_builtins): Replace calls to lang_hooks.builtin_function with add_builtin_function. * gcc/config/sparc/sparc.c (def_builtin): Replace calls to lang_hooks.builtin_function with add_builtin_function. * gcc/config/i386/i386.c (def_builtin): Replace calls to lang_hooks.builtin_function with add_builtin_function. (def_builtin): Replace calls to lang_hooks.builtin_function with add_builtin_function. * gcc/config/sh/sh.c (sh_media_init_builtins): Replace calls to lang_hooks.builtin_function with add_builtin_function. * gcc/config/c4x/c4x.c (c4x_init_builtins): Replace calls to lang_hooks.builtin_function with add_builtin_function. * gcc/config/stormy16/stormy16.c (xstormy16_init_builtins): Replace calls to lang_hooks.builtin_function with add_builtin_function. * gcc/config/iq2000/iq2000.c (def_builtin): Replace calls to lang_hooks.builtin_function with add_builtin_function. * gcc/config/ia64/ia64.c (def_builtin): Replace calls to lang_hooks.builtin_function with add_builtin_function. * gcc/config/rs6000/rs6000.c (def_builtin): Replace calls to lang_hooks.builtin_function with add_builtin_function. (altivec_init_builtins): Replace calls to lang_hooks.builtin_function with add_builtin_function. * gcc/config/arm/arm.c (def_mbuiltin): Replace calls to lang_hooks.builtin_function with add_builtin_function. (arm_init_tls_builtins): Replace calls to lang_hooks.builtin_function with add_builtin_function. * gcc/config/mips/mips.c (mips_init_builtins): Replace calls to lang_hooks.builtin_function with add_builtin_function. * gcc/config/bfin/bfin.c (def_builtin): Replace calls to lang_hooks.builtin_function with add_builtin_function. * gcc/langhooks-def.h (lhd_builtin_function): New function. (LANG_HOOKS_BUILTIN_FUNCTION): Define as lhd_builtin_function. From-SVN: r117981
2006-10-23 21:47:58 +02:00
= add_builtin_function (TAG_GETCLASS, type, 0, NOT_BUILT_IN,
NULL, NULL_TREE);
1992-01-18 00:15:38 +01:00
/* id objc_getMetaClass (const char *); */
1992-01-18 00:15:38 +01:00
objc_get_meta_class_decl
decl.c: Include langhooks.h. * gcc/java/decl.c: Include langhooks.h. (builtin_function): Remove. (java_init_decl_processing): Replace calls to builtin_function with add_builtin_function. * gcc/java/Make-lang.in (jc1$(exeext)): Depend on and link with attribs.o. (java/decl.o): Depend on langhooks.h. * gcc/java/java-tree.h (builtin_function): Remove. * gcc/tree.c (local_define_builtin): Replace calls to lang_hooks.builtin_function with add_builtin_function. * gcc/objc/objc-act.c (synth_module_prologue): Replace calls to builtin_function with add_builtin_function. (build_next_objc_exception_stuff): Replace calls to builtin_function with add_builtin_function. (build_objc_exception_stuff): Replace calls to builtin_function with add_builtin_function. * gcc/objcp/objcp-decl.h (objcp_builtin_function): Remove. * gcc/cp/decl.c (builtin_function_1): Move common code to add_builtin_function. (builtin_function): Rename to cxx_builtin_function. Change the signature. * gcc/cp/call.c: Include langhooks.h. (build_java_interface_fn_ref): Replace calls to builtin_function with add_builtin_function. * gcc/cp/Make-lang.in (cp/call.o): Depend on langhooks.h. * gcc/cp/cp-objcp-common.h (LANG_HOOKS_BUILTIN_FUNCTION): Define as cxx_builtin_function. * gcc/cp/cp-tree.h (builtin_function): Rename to cxx_builtin_function. Change the signature. * gcc/c-objc-common.h (LANG_HOOKS_BUILTIN_FUNCTION): Define as c_builtin_function. * gcc/c-tree.h (builtin_function): Rename to c_builtin_function. Change the signature. * gcc/ada/utils.c (builtin_function): Rename to gnat_builtin_function. Move common code to add_builtin_function. * gcc/ada/misc.c (LANG_HOOKS_BUILTIN_FUNCTION): Define as gnat_builtin_function. * gcc/ada/gigi.h (builtin_function): Rename to gnat_builtin_function. Change the signature. * gcc/c-decl.c (builtin_function): Rename to c_builtin_function. Move common code to add_builtin_function. * gcc/fortran/Make-lang.in (f951$(exeext)): Depend on and link with attribs.o. * gcc/fortran/trans.h (builtin_function): Rename to gfc_builtin_function. Change the signature. * gcc/fortran/f95-lang.c (LANG_HOOKS_BUILTIN_FUNCTION): Define as gfc_builtin_function. (builtin_function): Rename to gfc_builtin_function. Move common code to builtin_function. (gfc_define_builtin): Replace calls to builtin_function with gfc_define_builtin. * gcc/langhooks.c (add_builtin_function): New function. (lhd_builtin_function): New function. * gcc/langhooks.h (struct lang_hooks): Change the signature of builtin_function. (add_builtin_function): New function. * gcc/treelang/treetree.c (builtin_function): Remove. * gcc/tree-ssa-loop-prefetch.c (tree_ssa_prefetch_arrays): Replace calls to lang_hooks.builtin_function with add_builtin_function. * gcc/c-common.c (decl_builtin_1): Replace calls to lang_hooks.builtin_function with add_builtin_function. * gcc/config/alpha/alpha.c (alpha_init_builtins): Replace calls to lang_hooks.builtin_function with add_builtin_function. * gcc/config/frv/frv.c (def_builtin): Replace calls to lang_hooks.builtin_function with add_builtin_function. * gcc/config/s390/s390.c (s390_init_builtins): Replace calls to lang_hooks.builtin_function with add_builtin_function. * gcc/config/sparc/sparc.c (def_builtin): Replace calls to lang_hooks.builtin_function with add_builtin_function. * gcc/config/i386/i386.c (def_builtin): Replace calls to lang_hooks.builtin_function with add_builtin_function. (def_builtin): Replace calls to lang_hooks.builtin_function with add_builtin_function. * gcc/config/sh/sh.c (sh_media_init_builtins): Replace calls to lang_hooks.builtin_function with add_builtin_function. * gcc/config/c4x/c4x.c (c4x_init_builtins): Replace calls to lang_hooks.builtin_function with add_builtin_function. * gcc/config/stormy16/stormy16.c (xstormy16_init_builtins): Replace calls to lang_hooks.builtin_function with add_builtin_function. * gcc/config/iq2000/iq2000.c (def_builtin): Replace calls to lang_hooks.builtin_function with add_builtin_function. * gcc/config/ia64/ia64.c (def_builtin): Replace calls to lang_hooks.builtin_function with add_builtin_function. * gcc/config/rs6000/rs6000.c (def_builtin): Replace calls to lang_hooks.builtin_function with add_builtin_function. (altivec_init_builtins): Replace calls to lang_hooks.builtin_function with add_builtin_function. * gcc/config/arm/arm.c (def_mbuiltin): Replace calls to lang_hooks.builtin_function with add_builtin_function. (arm_init_tls_builtins): Replace calls to lang_hooks.builtin_function with add_builtin_function. * gcc/config/mips/mips.c (mips_init_builtins): Replace calls to lang_hooks.builtin_function with add_builtin_function. * gcc/config/bfin/bfin.c (def_builtin): Replace calls to lang_hooks.builtin_function with add_builtin_function. * gcc/langhooks-def.h (lhd_builtin_function): New function. (LANG_HOOKS_BUILTIN_FUNCTION): Define as lhd_builtin_function. From-SVN: r117981
2006-10-23 21:47:58 +02:00
= add_builtin_function (TAG_GETMETACLASS, type, 0, NOT_BUILT_IN, NULL, NULL_TREE);
Makefile.in (c-parse.o): Depend on $(C_COMMON_H). [gcc/ChangeLog] 2004-09-07 Ziemowit Laski <zlaski@apple.com> * Makefile.in (c-parse.o): Depend on $(C_COMMON_H). * c-parse.in: Include c-common.h instead of objc-act.h. (ivar_decl_list, ivar_decls, ivar_decl, ivars, ivar_declarator, myparms, myparm): Remove %type declarations. (methodtype, optparms, OBJC_TYPE_QUAL, objc_quals, objc_qual, objc_typename, objc_try_catch_stmt, optellipsis): Add %type declarations. (objc_inherit_code, objc_public_flag): Remove. (typespec_nonreserved_nonattr): Call objc_get_protocol_qualified_type() instead of get_static_reference() and get_protocol_reference(). (stmt_nocomp): Call grokparm() on @catch parameter. (objcdef): Move semantic action to objc_finish_implementation(). (classdef): Move semantic action to objc_start_class_interface(), objc_continue_interface(), objc_finish_interface(), objc_start_class_implementation(), objc_continue_implementation(), objc_start_category_interface() and objc_start_category_implementation(). (protocoldef): Move semantic actions to objc_start_protocol() and objc_finish_interface(). (ivar_decl_list): Remove nonterminal. (visibility_spec): Move semantic actions to objc_set_visibility(). (ivar_decls): Remove assignment to $$. (ivar_decl): Rephrase in terms of component_decl; call objc_add_instance_variable(). (ivars, ivar_declarator): Remove nonterminals. (opt_semi): New nonterminal. (methodtype): Remove semantic actions. (methoddef): Move semantic actions to objc_set_method_type(), objc_start_method_definition() and objc_finish_method_definition(). (methodproto): Move semantic actions to objc_set_method_type() and objc_add_method_declaration(). (methoddecl): Use objc_typename instead of typename; move semantic actions to objc_build_method_signature(). (optarglist, myxdecls, mydecl, myparms, myparm): Remove nonterminals. (optparmlist): Express in terms of optparms and optellipsis. (optparms, optellipsis, objc_qual, objc_quals, objc_typename): New nonterminals. (keyworddecl): Use objc_typename instead of typename. (rid_to_yy): Mark RID_IN, RID_OUT, RID_INOUT, RID_BYCOPY, RID_BYREF and RID_ONEWAY as returning OBJC_TYPE_QUAL to yyparse(). [gcc/objc/ChangeLog] 2004-09-07 Ziemowit Laski <zlaski@apple.com> * Make-lang.in (objc/objc-parse.o): Depend on $(C_COMMON_H) instead of objc/objc-act.h. (objc/objc-act.o): Depend on $(HASHTAB_H). * objc-act.c: Include hashtab.h; in ObjC++ mode, include cp-tree.h and objcp-decl.h instead of c-tree.h. (build_module_descriptor, get_class_ivars, synth_id_with_class_suffix, error_with_ivar, gen_method_decl, gen_declaration, setup_string_decl, build_protocol_template): Adjust prototypes. (build_module_initializer_routine, start_class, continue_class, finish_class, start_method_def, objc_start_function, start_protocol, build_method_decl, objc_add_method, add_instance_variable, build_ivar_reference, is_ivar, is_private, get_super_receiver, build_selector_table_decl, objc_push_parm, objc_get_parm_info, gen_type_name, gen_type_name_0, start_var_decl, finish_var_decl, create_field_decl): New prototypes. (objc_expand_function_end, comp_method_with_proto, objc_expr_last, gen_declaration_1, gen_declarator, is_complex_decl, adorn_decl, define_decl, create_builtin_decl, gen_declspecs): Remove prototypes. (TYPE_ID): Rename to OBJECT_TYPEDEF_NAME. (CLASS_TYPEDEF_NAME): New. (TAG_EXECCLASS): Change from a global variable to a #define. (TAG_RETURN_STRUCT): Delete. (TAG_GNUINIT): New, holds '__objc_gnu_init' name. (objc_inherit_code, objc_public_flag): New, moved from c-parse.in. (string_descriptor): New struct. (string_htab): New hash table. (string_hash, string_eq): New prototypes. (generate_struct_by_value_array): Call create_field_decl() instead of create_builtin_decl(). (objc_init): Do not initialize objc_ellipsis_node or TAG_EXECCLASS; In ObjC++ mode, call cxx_init() instead of c_objc_common_init(). (objc_finish_file): In ObjC++, call instantiate_pending_templates() and cp_finish_file(). (define_decl, get_static_reference, get_protocol_reference, create_builtin_decl): Remove functions. (objc_start_class_interface, objc_start_category_interface, objc_start_protocol, objc_continue_interface, objc_finish_interface, objc_start_class_implementation, objc_start_category_implementation, objc_continue_implementation, objc_finish_implementation, objc_set_visibility, objc_set_method_type, objc_build_method_signature, objc_add_method_declaration, objc_start_method_definition, objc_add_instance_variable, objc_get_protocol_qualified_type, create_field_decl, start_var_decl, finish_var_decl): New functions. (setup_string_decl): Simplify since it is only called once. (synth_module_prologue): Call build_class_template(); predefine 'id' and 'Class' as typedefs; rename 'temp_type' to 'type'; disable debug hooks for duration of function; fix GNU runtime messenger signatures to correspond to reality; forward-declare '__objc_exec_class' for the GNU runtime; call build_selector_table_decl(); in ObjC++ mode, generate 'extern "C" { ... }' wrappers around synthesized declarations; call build_protocol_template() and build_category_template(). (string_hash, string_eq): New functions. (objc_build_string_object): Check metaclass correctness only once; store string literals in hash table. (objc_build_constructor): Do not convert initializer elements; adjust for ObjC++ impedance mismatch. (build_objc_symtab_template): Call create_field_decl() instead of create_builtin_decl(). (init_objc_symtab): Add missing conversion to initializer element. (build_metadata_decl): Call start_var_decl() instead of define_decl(). (generate_objc_symtab_decl): Do not call build_category_template(); call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(). (build_module_descriptor): Call create_field_decl() instead of grokfield(); call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(); always mark module descriptor as used; move GNU runtime-specific functionality to build_module_initializer_routine(). (build_module_initializer_routine): New function, broken off of build_module_descriptor(). (objc_static_init_needed_p, objc_generate_static_init_call): New functions. (generate_static_references, generate_strings, build_selector_translation_table, generate_descriptor_table, generate_ivars_list, generate_dispatch_table, generate_category): Call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(); build a type directly instead of via groktypename(). (build_selector_reference_decl, build_selector_table_decl, build_class_reference_decl, build_protocol_reference, generate_objc_image_info): Call start_var_decl() instead of build_decl(). (build_selector_reference): For GNU runtime, do not call build_selector_reference_decl(). (build_selector, build_typed_selector_reference): Always convert result to the selector type. (add_objc_string): Cast return value to 'char *'. (build_method_prototype_template, build_selector_template, build_method_template): Use actual selector type for fields pointing to selectors. (finish_objc): For GNU runtime, call build_module_initializer_routine() after build_module_descriptor(). (generate_protocol_list, generate_shared_structures): Call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(); build a type directly instead of via groktypename(). (synth_id_with_class_suffix): Return a string. (get_arg_type_list): For instance methods, use the instance type for 'self'; do not call groktypename_in_parm_context(). (build_objc_string_decl): Squash redeclaration errors in ObjC++. (objc_is_class_name): Use OBJC_TYPE_NAME instead of TYPE_NAME; handle RECORD_TYPEs in ObjC as well as ObjC++. (objc_is_id): New function. (objc_is_object_ptr): Return the canonical type node. (objc_get_class_ivars): Simplify using get_class_ivars(). (get_class_ivars): Remove second parameter; create a fresh copy of the ivar list for each call; do not check for existence of super class. (objc_eh_runtime_type): Mark #ifndef OBJCPLUS. (objc_init_exceptions): When using SJLJ-style exceptions, require the use of '-fobjc-exceptions' flag; do not require it for DWARF-style exceptions. (objc_build_exc_ptr, next_sjlj_build_try_catch_finally): Use objc_object_type instead of objc_id_type. (objc_begin_catch_clause): Convert the incoming PARM_DECL into a VAR_DECL before placing it in the appropriate scope; do not call define_decl(); adjust call to c_begin_compound_stmt(); use objc_object_type instead of objc_id_type. (build_next_objc_exception_stuff): Call create_field_decl() instead of create_builtin_decl(); construct type directly instead of calling groktypename(); use OBJC_VOID_AT_END to mark end of function parameters. (build_private_template): Adjust call to get_class_ivars(); build a type directly instead of via groktypename(). (build_protocol_template, build_method_prototype_list_template, build_method_prototype_template, build_category_template, build_selector_template, build_class_template, build_super_template, build_ivar_template, build_ivar_list_template, build_method_list_template, build_method_template): Call create_field_decl() instead of grokfield(). (objc_method_parm_type): Do not call groktypename(). (generate_descriptor_table): Call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(). (generate_method_descriptors, build_protocol_initializer, generate_dispatch_tables, build_category_initializer, build_shared_structure_initializer): Do not call groktypename(). (generate_protocols): Call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(); do not call groktypename(). (error_with_ivar): Remove last parameter. (check_ivars): Do not iterate ovar CLASS_RAW_IVARS lists in addition to CLASS_IVARS lists; adjust calls to error_with_ivar(). (generate_ivar_lists): Convert one of the initializer elements; do not call groktypename(). (get_arg_type_list, start_method_def, gen_method_def): Account for new representation of variable arguments and '...' in Objective-C methods; add Objective-C++ impedance matching code. (is_objc_type_qualifier): Remove function. (adjust_type_for_id_default): Simplify; there is no longer a need to wade through declspecs. (lookup_interface, start_class, continue_class, finish_class, start_method_def, start_protocol, build_method_decl, objc_add_method, add_instance_variable, build_ivar_reference, is_ivar, is_private, get_super_receiver, objc_build_finally_epilogue): Make into static functions. (receiver_is_class_object): Use new IS_CLASS() macro. (objc_build_message_expr): Tweak ObjC++ message argument handling; call objc_finish_message_expr() instead of finish_message_expr(). (finish_message_expr): Rename to objc_finish_message_expr(); use OBJC_TYPE_NAME and OBJC_SET_TYPE_NAME macros instead of TYPE_NAME. call gen_type_name() instead of gen_declaration(); call objc_is_id() instead of using IS_ID and IS_CLASS; Use objc_class_name instead of calling get_identifier("Class"); handle CONVERT_EXPRs in receiver. (build_objc_method_call, warn_with_method): Do not call groktypename(). (build_ivar_reference): Call convert() instead of clobbering in a type. (hash_init): Initialize string_htab hash table. (add_instance_variable): Simplify parameter list; do not call grokfield(); do not populate CLASS_IVARS list. (start_class): Check for the existence of super class, if one was specified. (continue_class): Use CLASS_RAW_IVARS rather than CLASS_IVARS; do not call build_class_template(); adjust call to get_class_ivars(); call build_decl(), pushdecl() and finish_decl() instead of define_decl(). (finish_class): Call build_decl(), pushdecl() and finish_decl() instead of define_decl(). (add_protocols): Use PROTOCOL_BINFO_ELTS for the tree vector size. (start_protocol): Do not call build_protocol_template(); use PROTOCOL_BINFO_ELTS for the tree vector size. (encode_type_qualifiers): Do not handle the 'const' qualifier here. (encode_pointer): Encode 'const char *' as 'r*', for backwards compatibility. (encode_array): Use HOST_WIDE_INT_PRINT_DEC instead of "%ld". (encode_type): Handle the 'const' qualifier here. (objc_parmlist): New global variable, sued by objc_push_parm and objc_get_parm_info(). (objc_push_parm, objc_get_parm_info): New functions. (objc_expr_last): Remove function. (synth_self_and_ucmd_args): For instance methods, use the instance type for 'self'; call objc_push_parm() instead of push_parm_decl(). (start_method_def): Do not call push_scope(), declare_parm_level(), pop_scope(), push_parm_decl(), store_parm_decls() or objc_expr_last(); just use objc_push_parm() and objc_get_parm_info(). (comp_method_with_proto): Remove function. (objc_types_are_equivalent): Strip away indirections before comparing underlying types. (comp_proto_with_proto): Do not call groktypename(); types are no longer in raw declspec format. (objc_start_function): New function. (really_start_method): Call comp_proto_with_proto() instead of comp_method_with_proto(); call objc_start_function() instead of hand-crafting a function declarator. (continue_method_def, objc_expand_function_end): Remove functions. (get_super_receiver): Call objc_get_current_scope() instead of get_current_scope(); reference 'super_class' field (instead of 'class'). (finish_method_def): Rename to objc_finish_method_definition() and add a function decl parameter; move method encoding call from objc_expand_function_end(). (is_complex_decl, adorn_decl, gen_declarator, gen_declspecs, gen_declaration_1): Remove functions. (tmpbuf, RAW_DECLSPEC): Remove. (gen_declaration): Remove second parameter; simplify to deal with TYPE_P nodes instead of raw declspecs. (gen_type_name, gen_type_name_0): New functions. (gen_method_decl): Remove second parameter; call gen_type_name() instead of gen_declaration_1(). (dump_interface): Adjust calls to gen_declaration() and gen_method_decl(); do not allocate a separate string buffer. (init_objc): Allocate a larger string buffer to accommodate dump_interface(); adjust call to build_module_descriptor(); add call to build_module_initializer_routine() for the GNU runtime. (generate_classref_translation_entry): Do not call start_decl(); call finish_var_decl() instead of finish_decl(); call convert() instead of build_c_cast(). * objc-act.h (CLASS_OWN_IVARS): Remove accessor. (CLASS_BINFO_ELTS): Reduce from 6 to 5, now that CLASS_OWN_IVARS is gone. (OCTI_GNU_INIT_DECL, GNU_INIT_decl): New. (OCTI_ELLIPSIS_NODE, objc_ellipsis_node): Remove. (OCTI_ID_ID, id_type, objc_id_id): Rename to OCTI_ID_NAME, objc_object_type and objc_object_name, respectively. (OCTI_CLS_REF, OCTI_CLASS_NAME, objc_class_reference, objc_class_name): New. (IS_CLASS): New macro. (IS_ID, IS_SUPER): Robustify. (OCTI_EXECCLASS_DECL, execclass_decl): New. (finish_file, start_class, continue_class, finish_class, start_method_def, continue_method_def, finish_method_def, start_protocol, finish_protocol, objc_build_throw_stmt, objc_build_try_catch_finally_stmt, objc_build_synchronized_prologue, objc_build_synchronized_epilogue, objc_build_try_prologue, objc_build_try_epilogue, objc_build_catch_stmt, objc_build_catch_epilogue, objc_build_finally_prologue, objc_build_finally_epilogue, is_ivar, is_private, is_public, add_instance_variable, objc_add_method, get_super_receiver, objc_clear_super_receiver, get_class_ivars_from_name, get_class_reference, get_static_reference, get_object_reference, build_message_expr, finish_message_expr, build_selector_expr, build_ivar_reference, build_keyword_decl, build_method_decl, build_protocol_expr, build_objc_string_object, objc_declare_alias, objc_declare_class, objc_declare_protocols, objc_comptypes, objc_check_decl, build_encode_expr): Remove prototypes. (imp_count, cat_count): Make GGC-aware. (OBJC_SET_TYPE_NAME): New macro. From-SVN: r87168
2004-09-08 02:49:44 +02:00
build_class_template ();
build_super_template ();
Makefile.in (c-parse.o): Depend on $(C_COMMON_H). [gcc/ChangeLog] 2004-09-07 Ziemowit Laski <zlaski@apple.com> * Makefile.in (c-parse.o): Depend on $(C_COMMON_H). * c-parse.in: Include c-common.h instead of objc-act.h. (ivar_decl_list, ivar_decls, ivar_decl, ivars, ivar_declarator, myparms, myparm): Remove %type declarations. (methodtype, optparms, OBJC_TYPE_QUAL, objc_quals, objc_qual, objc_typename, objc_try_catch_stmt, optellipsis): Add %type declarations. (objc_inherit_code, objc_public_flag): Remove. (typespec_nonreserved_nonattr): Call objc_get_protocol_qualified_type() instead of get_static_reference() and get_protocol_reference(). (stmt_nocomp): Call grokparm() on @catch parameter. (objcdef): Move semantic action to objc_finish_implementation(). (classdef): Move semantic action to objc_start_class_interface(), objc_continue_interface(), objc_finish_interface(), objc_start_class_implementation(), objc_continue_implementation(), objc_start_category_interface() and objc_start_category_implementation(). (protocoldef): Move semantic actions to objc_start_protocol() and objc_finish_interface(). (ivar_decl_list): Remove nonterminal. (visibility_spec): Move semantic actions to objc_set_visibility(). (ivar_decls): Remove assignment to $$. (ivar_decl): Rephrase in terms of component_decl; call objc_add_instance_variable(). (ivars, ivar_declarator): Remove nonterminals. (opt_semi): New nonterminal. (methodtype): Remove semantic actions. (methoddef): Move semantic actions to objc_set_method_type(), objc_start_method_definition() and objc_finish_method_definition(). (methodproto): Move semantic actions to objc_set_method_type() and objc_add_method_declaration(). (methoddecl): Use objc_typename instead of typename; move semantic actions to objc_build_method_signature(). (optarglist, myxdecls, mydecl, myparms, myparm): Remove nonterminals. (optparmlist): Express in terms of optparms and optellipsis. (optparms, optellipsis, objc_qual, objc_quals, objc_typename): New nonterminals. (keyworddecl): Use objc_typename instead of typename. (rid_to_yy): Mark RID_IN, RID_OUT, RID_INOUT, RID_BYCOPY, RID_BYREF and RID_ONEWAY as returning OBJC_TYPE_QUAL to yyparse(). [gcc/objc/ChangeLog] 2004-09-07 Ziemowit Laski <zlaski@apple.com> * Make-lang.in (objc/objc-parse.o): Depend on $(C_COMMON_H) instead of objc/objc-act.h. (objc/objc-act.o): Depend on $(HASHTAB_H). * objc-act.c: Include hashtab.h; in ObjC++ mode, include cp-tree.h and objcp-decl.h instead of c-tree.h. (build_module_descriptor, get_class_ivars, synth_id_with_class_suffix, error_with_ivar, gen_method_decl, gen_declaration, setup_string_decl, build_protocol_template): Adjust prototypes. (build_module_initializer_routine, start_class, continue_class, finish_class, start_method_def, objc_start_function, start_protocol, build_method_decl, objc_add_method, add_instance_variable, build_ivar_reference, is_ivar, is_private, get_super_receiver, build_selector_table_decl, objc_push_parm, objc_get_parm_info, gen_type_name, gen_type_name_0, start_var_decl, finish_var_decl, create_field_decl): New prototypes. (objc_expand_function_end, comp_method_with_proto, objc_expr_last, gen_declaration_1, gen_declarator, is_complex_decl, adorn_decl, define_decl, create_builtin_decl, gen_declspecs): Remove prototypes. (TYPE_ID): Rename to OBJECT_TYPEDEF_NAME. (CLASS_TYPEDEF_NAME): New. (TAG_EXECCLASS): Change from a global variable to a #define. (TAG_RETURN_STRUCT): Delete. (TAG_GNUINIT): New, holds '__objc_gnu_init' name. (objc_inherit_code, objc_public_flag): New, moved from c-parse.in. (string_descriptor): New struct. (string_htab): New hash table. (string_hash, string_eq): New prototypes. (generate_struct_by_value_array): Call create_field_decl() instead of create_builtin_decl(). (objc_init): Do not initialize objc_ellipsis_node or TAG_EXECCLASS; In ObjC++ mode, call cxx_init() instead of c_objc_common_init(). (objc_finish_file): In ObjC++, call instantiate_pending_templates() and cp_finish_file(). (define_decl, get_static_reference, get_protocol_reference, create_builtin_decl): Remove functions. (objc_start_class_interface, objc_start_category_interface, objc_start_protocol, objc_continue_interface, objc_finish_interface, objc_start_class_implementation, objc_start_category_implementation, objc_continue_implementation, objc_finish_implementation, objc_set_visibility, objc_set_method_type, objc_build_method_signature, objc_add_method_declaration, objc_start_method_definition, objc_add_instance_variable, objc_get_protocol_qualified_type, create_field_decl, start_var_decl, finish_var_decl): New functions. (setup_string_decl): Simplify since it is only called once. (synth_module_prologue): Call build_class_template(); predefine 'id' and 'Class' as typedefs; rename 'temp_type' to 'type'; disable debug hooks for duration of function; fix GNU runtime messenger signatures to correspond to reality; forward-declare '__objc_exec_class' for the GNU runtime; call build_selector_table_decl(); in ObjC++ mode, generate 'extern "C" { ... }' wrappers around synthesized declarations; call build_protocol_template() and build_category_template(). (string_hash, string_eq): New functions. (objc_build_string_object): Check metaclass correctness only once; store string literals in hash table. (objc_build_constructor): Do not convert initializer elements; adjust for ObjC++ impedance mismatch. (build_objc_symtab_template): Call create_field_decl() instead of create_builtin_decl(). (init_objc_symtab): Add missing conversion to initializer element. (build_metadata_decl): Call start_var_decl() instead of define_decl(). (generate_objc_symtab_decl): Do not call build_category_template(); call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(). (build_module_descriptor): Call create_field_decl() instead of grokfield(); call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(); always mark module descriptor as used; move GNU runtime-specific functionality to build_module_initializer_routine(). (build_module_initializer_routine): New function, broken off of build_module_descriptor(). (objc_static_init_needed_p, objc_generate_static_init_call): New functions. (generate_static_references, generate_strings, build_selector_translation_table, generate_descriptor_table, generate_ivars_list, generate_dispatch_table, generate_category): Call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(); build a type directly instead of via groktypename(). (build_selector_reference_decl, build_selector_table_decl, build_class_reference_decl, build_protocol_reference, generate_objc_image_info): Call start_var_decl() instead of build_decl(). (build_selector_reference): For GNU runtime, do not call build_selector_reference_decl(). (build_selector, build_typed_selector_reference): Always convert result to the selector type. (add_objc_string): Cast return value to 'char *'. (build_method_prototype_template, build_selector_template, build_method_template): Use actual selector type for fields pointing to selectors. (finish_objc): For GNU runtime, call build_module_initializer_routine() after build_module_descriptor(). (generate_protocol_list, generate_shared_structures): Call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(); build a type directly instead of via groktypename(). (synth_id_with_class_suffix): Return a string. (get_arg_type_list): For instance methods, use the instance type for 'self'; do not call groktypename_in_parm_context(). (build_objc_string_decl): Squash redeclaration errors in ObjC++. (objc_is_class_name): Use OBJC_TYPE_NAME instead of TYPE_NAME; handle RECORD_TYPEs in ObjC as well as ObjC++. (objc_is_id): New function. (objc_is_object_ptr): Return the canonical type node. (objc_get_class_ivars): Simplify using get_class_ivars(). (get_class_ivars): Remove second parameter; create a fresh copy of the ivar list for each call; do not check for existence of super class. (objc_eh_runtime_type): Mark #ifndef OBJCPLUS. (objc_init_exceptions): When using SJLJ-style exceptions, require the use of '-fobjc-exceptions' flag; do not require it for DWARF-style exceptions. (objc_build_exc_ptr, next_sjlj_build_try_catch_finally): Use objc_object_type instead of objc_id_type. (objc_begin_catch_clause): Convert the incoming PARM_DECL into a VAR_DECL before placing it in the appropriate scope; do not call define_decl(); adjust call to c_begin_compound_stmt(); use objc_object_type instead of objc_id_type. (build_next_objc_exception_stuff): Call create_field_decl() instead of create_builtin_decl(); construct type directly instead of calling groktypename(); use OBJC_VOID_AT_END to mark end of function parameters. (build_private_template): Adjust call to get_class_ivars(); build a type directly instead of via groktypename(). (build_protocol_template, build_method_prototype_list_template, build_method_prototype_template, build_category_template, build_selector_template, build_class_template, build_super_template, build_ivar_template, build_ivar_list_template, build_method_list_template, build_method_template): Call create_field_decl() instead of grokfield(). (objc_method_parm_type): Do not call groktypename(). (generate_descriptor_table): Call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(). (generate_method_descriptors, build_protocol_initializer, generate_dispatch_tables, build_category_initializer, build_shared_structure_initializer): Do not call groktypename(). (generate_protocols): Call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(); do not call groktypename(). (error_with_ivar): Remove last parameter. (check_ivars): Do not iterate ovar CLASS_RAW_IVARS lists in addition to CLASS_IVARS lists; adjust calls to error_with_ivar(). (generate_ivar_lists): Convert one of the initializer elements; do not call groktypename(). (get_arg_type_list, start_method_def, gen_method_def): Account for new representation of variable arguments and '...' in Objective-C methods; add Objective-C++ impedance matching code. (is_objc_type_qualifier): Remove function. (adjust_type_for_id_default): Simplify; there is no longer a need to wade through declspecs. (lookup_interface, start_class, continue_class, finish_class, start_method_def, start_protocol, build_method_decl, objc_add_method, add_instance_variable, build_ivar_reference, is_ivar, is_private, get_super_receiver, objc_build_finally_epilogue): Make into static functions. (receiver_is_class_object): Use new IS_CLASS() macro. (objc_build_message_expr): Tweak ObjC++ message argument handling; call objc_finish_message_expr() instead of finish_message_expr(). (finish_message_expr): Rename to objc_finish_message_expr(); use OBJC_TYPE_NAME and OBJC_SET_TYPE_NAME macros instead of TYPE_NAME. call gen_type_name() instead of gen_declaration(); call objc_is_id() instead of using IS_ID and IS_CLASS; Use objc_class_name instead of calling get_identifier("Class"); handle CONVERT_EXPRs in receiver. (build_objc_method_call, warn_with_method): Do not call groktypename(). (build_ivar_reference): Call convert() instead of clobbering in a type. (hash_init): Initialize string_htab hash table. (add_instance_variable): Simplify parameter list; do not call grokfield(); do not populate CLASS_IVARS list. (start_class): Check for the existence of super class, if one was specified. (continue_class): Use CLASS_RAW_IVARS rather than CLASS_IVARS; do not call build_class_template(); adjust call to get_class_ivars(); call build_decl(), pushdecl() and finish_decl() instead of define_decl(). (finish_class): Call build_decl(), pushdecl() and finish_decl() instead of define_decl(). (add_protocols): Use PROTOCOL_BINFO_ELTS for the tree vector size. (start_protocol): Do not call build_protocol_template(); use PROTOCOL_BINFO_ELTS for the tree vector size. (encode_type_qualifiers): Do not handle the 'const' qualifier here. (encode_pointer): Encode 'const char *' as 'r*', for backwards compatibility. (encode_array): Use HOST_WIDE_INT_PRINT_DEC instead of "%ld". (encode_type): Handle the 'const' qualifier here. (objc_parmlist): New global variable, sued by objc_push_parm and objc_get_parm_info(). (objc_push_parm, objc_get_parm_info): New functions. (objc_expr_last): Remove function. (synth_self_and_ucmd_args): For instance methods, use the instance type for 'self'; call objc_push_parm() instead of push_parm_decl(). (start_method_def): Do not call push_scope(), declare_parm_level(), pop_scope(), push_parm_decl(), store_parm_decls() or objc_expr_last(); just use objc_push_parm() and objc_get_parm_info(). (comp_method_with_proto): Remove function. (objc_types_are_equivalent): Strip away indirections before comparing underlying types. (comp_proto_with_proto): Do not call groktypename(); types are no longer in raw declspec format. (objc_start_function): New function. (really_start_method): Call comp_proto_with_proto() instead of comp_method_with_proto(); call objc_start_function() instead of hand-crafting a function declarator. (continue_method_def, objc_expand_function_end): Remove functions. (get_super_receiver): Call objc_get_current_scope() instead of get_current_scope(); reference 'super_class' field (instead of 'class'). (finish_method_def): Rename to objc_finish_method_definition() and add a function decl parameter; move method encoding call from objc_expand_function_end(). (is_complex_decl, adorn_decl, gen_declarator, gen_declspecs, gen_declaration_1): Remove functions. (tmpbuf, RAW_DECLSPEC): Remove. (gen_declaration): Remove second parameter; simplify to deal with TYPE_P nodes instead of raw declspecs. (gen_type_name, gen_type_name_0): New functions. (gen_method_decl): Remove second parameter; call gen_type_name() instead of gen_declaration_1(). (dump_interface): Adjust calls to gen_declaration() and gen_method_decl(); do not allocate a separate string buffer. (init_objc): Allocate a larger string buffer to accommodate dump_interface(); adjust call to build_module_descriptor(); add call to build_module_initializer_routine() for the GNU runtime. (generate_classref_translation_entry): Do not call start_decl(); call finish_var_decl() instead of finish_decl(); call convert() instead of build_c_cast(). * objc-act.h (CLASS_OWN_IVARS): Remove accessor. (CLASS_BINFO_ELTS): Reduce from 6 to 5, now that CLASS_OWN_IVARS is gone. (OCTI_GNU_INIT_DECL, GNU_INIT_decl): New. (OCTI_ELLIPSIS_NODE, objc_ellipsis_node): Remove. (OCTI_ID_ID, id_type, objc_id_id): Rename to OCTI_ID_NAME, objc_object_type and objc_object_name, respectively. (OCTI_CLS_REF, OCTI_CLASS_NAME, objc_class_reference, objc_class_name): New. (IS_CLASS): New macro. (IS_ID, IS_SUPER): Robustify. (OCTI_EXECCLASS_DECL, execclass_decl): New. (finish_file, start_class, continue_class, finish_class, start_method_def, continue_method_def, finish_method_def, start_protocol, finish_protocol, objc_build_throw_stmt, objc_build_try_catch_finally_stmt, objc_build_synchronized_prologue, objc_build_synchronized_epilogue, objc_build_try_prologue, objc_build_try_epilogue, objc_build_catch_stmt, objc_build_catch_epilogue, objc_build_finally_prologue, objc_build_finally_epilogue, is_ivar, is_private, is_public, add_instance_variable, objc_add_method, get_super_receiver, objc_clear_super_receiver, get_class_ivars_from_name, get_class_reference, get_static_reference, get_object_reference, build_message_expr, finish_message_expr, build_selector_expr, build_ivar_reference, build_keyword_decl, build_method_decl, build_protocol_expr, build_objc_string_object, objc_declare_alias, objc_declare_class, objc_declare_protocols, objc_comptypes, objc_check_decl, build_encode_expr): Remove prototypes. (imp_count, cat_count): Make GGC-aware. (OBJC_SET_TYPE_NAME): New macro. From-SVN: r87168
2004-09-08 02:49:44 +02:00
build_protocol_template ();
build_category_template ();
c-common.c (flag_objc_sjlj_exceptions): New. * c-common.c (flag_objc_sjlj_exceptions): New. * c-common.h (flag_objc_sjlj_exceptions): Declare. * c-opts.c (c_common_handle_option): Set it. (c_common_post_options): Handle interation of different objective-c exception and runtime switches. * c-decl.c (c_eh_initialized_p): New. (finish_decl): Use it instead of local eh_initialized_p. * c-parse.in (nested_function, notype_nested_function): Record the result of compstmt. (compstmt_or_error): Likewise. (compstmt): Don't add_stmt the result. (stmt): Don't return anything. Rewrite objc try and sync rules. (objc_try_stmt, objc_catch_list): Remove. (objc_catch_block, objc_finally_block): Remove. (objc_catch_prefix, objc_catch_clause, objc_opt_catch_list): New. (objc_try_catch_clause, objc_finally_clause): New. (objc_try_catch_stmt): Rewrite. * c-tree.h (c_eh_initialized_p): Declare. * c-opt (fobjc-sjlj-exceptions): New. * except.c (output_function_exception_table): Don't call cgraph on non-decls. * objc/objc-act.c (UTAG_EXCDATA_VAR, UTAG_CAUGHTEXC_VAR, UTAG_RETHROWEXC_VAR, UTAG_EVALONCE_VAR, struct val_stack, catch_count_stack, exc_binding_stack, if_nesting_count, blk_nesting_count, objc_enter_block, objc_exit_block, objc_declare_variable, 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): Remove. (objc_create_temporary_var, struct objc_try_context, cur_try_context, objc_eh_runtime_type, objc_init_exceptions, objc_build_exc_ptr, next_sjlj_build_try_exit, next_sjlj_build_enter_and_setjmp, next_sjlj_build_exc_extract, next_sjlj_build_catch_list, next_sjlj_build_try_catch_finally, objc_begin_try_stmt, objc_begin_catch_clause, objc_finish_catch_clause, objc_build_finally_clause, objc_finish_try_stmt, objc_build_synchronized): New. (objc_is_object_id, objc_is_class_id): New. (objc_comptypes): Use them. (build_next_objc_exception_stuff): Break NeXT sjlj out from build_objc_exception_stuff. (synth_module_prologue): Update to match. (objc_build_throw_stmt): Use cur_try_context to decide if we're in a @catch. * objc/objc-act.h: Update prototypes. (OCTI_EXCEPTION_BLK_STACK, objc_exception_block_stack): Remove. testsuite/ * objc.dg/sync-1.m: New. * objc.dg/try-catch-1.m: Don't force next runtime. * objc.dg/try-catch-3.m, objc.dg/try-catch-4.m: Likewise. * objc.dg/try-catch-2.m: Likewise. Enable everywhere. Remove shadowed catch clause. * objc.dg/try-catch-5.m: New. From-SVN: r83332
2004-06-18 03:20:53 +02:00
build_objc_exception_stuff ();
Makefile.in (c-parse.o): Depend on $(C_COMMON_H). [gcc/ChangeLog] 2004-09-07 Ziemowit Laski <zlaski@apple.com> * Makefile.in (c-parse.o): Depend on $(C_COMMON_H). * c-parse.in: Include c-common.h instead of objc-act.h. (ivar_decl_list, ivar_decls, ivar_decl, ivars, ivar_declarator, myparms, myparm): Remove %type declarations. (methodtype, optparms, OBJC_TYPE_QUAL, objc_quals, objc_qual, objc_typename, objc_try_catch_stmt, optellipsis): Add %type declarations. (objc_inherit_code, objc_public_flag): Remove. (typespec_nonreserved_nonattr): Call objc_get_protocol_qualified_type() instead of get_static_reference() and get_protocol_reference(). (stmt_nocomp): Call grokparm() on @catch parameter. (objcdef): Move semantic action to objc_finish_implementation(). (classdef): Move semantic action to objc_start_class_interface(), objc_continue_interface(), objc_finish_interface(), objc_start_class_implementation(), objc_continue_implementation(), objc_start_category_interface() and objc_start_category_implementation(). (protocoldef): Move semantic actions to objc_start_protocol() and objc_finish_interface(). (ivar_decl_list): Remove nonterminal. (visibility_spec): Move semantic actions to objc_set_visibility(). (ivar_decls): Remove assignment to $$. (ivar_decl): Rephrase in terms of component_decl; call objc_add_instance_variable(). (ivars, ivar_declarator): Remove nonterminals. (opt_semi): New nonterminal. (methodtype): Remove semantic actions. (methoddef): Move semantic actions to objc_set_method_type(), objc_start_method_definition() and objc_finish_method_definition(). (methodproto): Move semantic actions to objc_set_method_type() and objc_add_method_declaration(). (methoddecl): Use objc_typename instead of typename; move semantic actions to objc_build_method_signature(). (optarglist, myxdecls, mydecl, myparms, myparm): Remove nonterminals. (optparmlist): Express in terms of optparms and optellipsis. (optparms, optellipsis, objc_qual, objc_quals, objc_typename): New nonterminals. (keyworddecl): Use objc_typename instead of typename. (rid_to_yy): Mark RID_IN, RID_OUT, RID_INOUT, RID_BYCOPY, RID_BYREF and RID_ONEWAY as returning OBJC_TYPE_QUAL to yyparse(). [gcc/objc/ChangeLog] 2004-09-07 Ziemowit Laski <zlaski@apple.com> * Make-lang.in (objc/objc-parse.o): Depend on $(C_COMMON_H) instead of objc/objc-act.h. (objc/objc-act.o): Depend on $(HASHTAB_H). * objc-act.c: Include hashtab.h; in ObjC++ mode, include cp-tree.h and objcp-decl.h instead of c-tree.h. (build_module_descriptor, get_class_ivars, synth_id_with_class_suffix, error_with_ivar, gen_method_decl, gen_declaration, setup_string_decl, build_protocol_template): Adjust prototypes. (build_module_initializer_routine, start_class, continue_class, finish_class, start_method_def, objc_start_function, start_protocol, build_method_decl, objc_add_method, add_instance_variable, build_ivar_reference, is_ivar, is_private, get_super_receiver, build_selector_table_decl, objc_push_parm, objc_get_parm_info, gen_type_name, gen_type_name_0, start_var_decl, finish_var_decl, create_field_decl): New prototypes. (objc_expand_function_end, comp_method_with_proto, objc_expr_last, gen_declaration_1, gen_declarator, is_complex_decl, adorn_decl, define_decl, create_builtin_decl, gen_declspecs): Remove prototypes. (TYPE_ID): Rename to OBJECT_TYPEDEF_NAME. (CLASS_TYPEDEF_NAME): New. (TAG_EXECCLASS): Change from a global variable to a #define. (TAG_RETURN_STRUCT): Delete. (TAG_GNUINIT): New, holds '__objc_gnu_init' name. (objc_inherit_code, objc_public_flag): New, moved from c-parse.in. (string_descriptor): New struct. (string_htab): New hash table. (string_hash, string_eq): New prototypes. (generate_struct_by_value_array): Call create_field_decl() instead of create_builtin_decl(). (objc_init): Do not initialize objc_ellipsis_node or TAG_EXECCLASS; In ObjC++ mode, call cxx_init() instead of c_objc_common_init(). (objc_finish_file): In ObjC++, call instantiate_pending_templates() and cp_finish_file(). (define_decl, get_static_reference, get_protocol_reference, create_builtin_decl): Remove functions. (objc_start_class_interface, objc_start_category_interface, objc_start_protocol, objc_continue_interface, objc_finish_interface, objc_start_class_implementation, objc_start_category_implementation, objc_continue_implementation, objc_finish_implementation, objc_set_visibility, objc_set_method_type, objc_build_method_signature, objc_add_method_declaration, objc_start_method_definition, objc_add_instance_variable, objc_get_protocol_qualified_type, create_field_decl, start_var_decl, finish_var_decl): New functions. (setup_string_decl): Simplify since it is only called once. (synth_module_prologue): Call build_class_template(); predefine 'id' and 'Class' as typedefs; rename 'temp_type' to 'type'; disable debug hooks for duration of function; fix GNU runtime messenger signatures to correspond to reality; forward-declare '__objc_exec_class' for the GNU runtime; call build_selector_table_decl(); in ObjC++ mode, generate 'extern "C" { ... }' wrappers around synthesized declarations; call build_protocol_template() and build_category_template(). (string_hash, string_eq): New functions. (objc_build_string_object): Check metaclass correctness only once; store string literals in hash table. (objc_build_constructor): Do not convert initializer elements; adjust for ObjC++ impedance mismatch. (build_objc_symtab_template): Call create_field_decl() instead of create_builtin_decl(). (init_objc_symtab): Add missing conversion to initializer element. (build_metadata_decl): Call start_var_decl() instead of define_decl(). (generate_objc_symtab_decl): Do not call build_category_template(); call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(). (build_module_descriptor): Call create_field_decl() instead of grokfield(); call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(); always mark module descriptor as used; move GNU runtime-specific functionality to build_module_initializer_routine(). (build_module_initializer_routine): New function, broken off of build_module_descriptor(). (objc_static_init_needed_p, objc_generate_static_init_call): New functions. (generate_static_references, generate_strings, build_selector_translation_table, generate_descriptor_table, generate_ivars_list, generate_dispatch_table, generate_category): Call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(); build a type directly instead of via groktypename(). (build_selector_reference_decl, build_selector_table_decl, build_class_reference_decl, build_protocol_reference, generate_objc_image_info): Call start_var_decl() instead of build_decl(). (build_selector_reference): For GNU runtime, do not call build_selector_reference_decl(). (build_selector, build_typed_selector_reference): Always convert result to the selector type. (add_objc_string): Cast return value to 'char *'. (build_method_prototype_template, build_selector_template, build_method_template): Use actual selector type for fields pointing to selectors. (finish_objc): For GNU runtime, call build_module_initializer_routine() after build_module_descriptor(). (generate_protocol_list, generate_shared_structures): Call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(); build a type directly instead of via groktypename(). (synth_id_with_class_suffix): Return a string. (get_arg_type_list): For instance methods, use the instance type for 'self'; do not call groktypename_in_parm_context(). (build_objc_string_decl): Squash redeclaration errors in ObjC++. (objc_is_class_name): Use OBJC_TYPE_NAME instead of TYPE_NAME; handle RECORD_TYPEs in ObjC as well as ObjC++. (objc_is_id): New function. (objc_is_object_ptr): Return the canonical type node. (objc_get_class_ivars): Simplify using get_class_ivars(). (get_class_ivars): Remove second parameter; create a fresh copy of the ivar list for each call; do not check for existence of super class. (objc_eh_runtime_type): Mark #ifndef OBJCPLUS. (objc_init_exceptions): When using SJLJ-style exceptions, require the use of '-fobjc-exceptions' flag; do not require it for DWARF-style exceptions. (objc_build_exc_ptr, next_sjlj_build_try_catch_finally): Use objc_object_type instead of objc_id_type. (objc_begin_catch_clause): Convert the incoming PARM_DECL into a VAR_DECL before placing it in the appropriate scope; do not call define_decl(); adjust call to c_begin_compound_stmt(); use objc_object_type instead of objc_id_type. (build_next_objc_exception_stuff): Call create_field_decl() instead of create_builtin_decl(); construct type directly instead of calling groktypename(); use OBJC_VOID_AT_END to mark end of function parameters. (build_private_template): Adjust call to get_class_ivars(); build a type directly instead of via groktypename(). (build_protocol_template, build_method_prototype_list_template, build_method_prototype_template, build_category_template, build_selector_template, build_class_template, build_super_template, build_ivar_template, build_ivar_list_template, build_method_list_template, build_method_template): Call create_field_decl() instead of grokfield(). (objc_method_parm_type): Do not call groktypename(). (generate_descriptor_table): Call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(). (generate_method_descriptors, build_protocol_initializer, generate_dispatch_tables, build_category_initializer, build_shared_structure_initializer): Do not call groktypename(). (generate_protocols): Call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(); do not call groktypename(). (error_with_ivar): Remove last parameter. (check_ivars): Do not iterate ovar CLASS_RAW_IVARS lists in addition to CLASS_IVARS lists; adjust calls to error_with_ivar(). (generate_ivar_lists): Convert one of the initializer elements; do not call groktypename(). (get_arg_type_list, start_method_def, gen_method_def): Account for new representation of variable arguments and '...' in Objective-C methods; add Objective-C++ impedance matching code. (is_objc_type_qualifier): Remove function. (adjust_type_for_id_default): Simplify; there is no longer a need to wade through declspecs. (lookup_interface, start_class, continue_class, finish_class, start_method_def, start_protocol, build_method_decl, objc_add_method, add_instance_variable, build_ivar_reference, is_ivar, is_private, get_super_receiver, objc_build_finally_epilogue): Make into static functions. (receiver_is_class_object): Use new IS_CLASS() macro. (objc_build_message_expr): Tweak ObjC++ message argument handling; call objc_finish_message_expr() instead of finish_message_expr(). (finish_message_expr): Rename to objc_finish_message_expr(); use OBJC_TYPE_NAME and OBJC_SET_TYPE_NAME macros instead of TYPE_NAME. call gen_type_name() instead of gen_declaration(); call objc_is_id() instead of using IS_ID and IS_CLASS; Use objc_class_name instead of calling get_identifier("Class"); handle CONVERT_EXPRs in receiver. (build_objc_method_call, warn_with_method): Do not call groktypename(). (build_ivar_reference): Call convert() instead of clobbering in a type. (hash_init): Initialize string_htab hash table. (add_instance_variable): Simplify parameter list; do not call grokfield(); do not populate CLASS_IVARS list. (start_class): Check for the existence of super class, if one was specified. (continue_class): Use CLASS_RAW_IVARS rather than CLASS_IVARS; do not call build_class_template(); adjust call to get_class_ivars(); call build_decl(), pushdecl() and finish_decl() instead of define_decl(). (finish_class): Call build_decl(), pushdecl() and finish_decl() instead of define_decl(). (add_protocols): Use PROTOCOL_BINFO_ELTS for the tree vector size. (start_protocol): Do not call build_protocol_template(); use PROTOCOL_BINFO_ELTS for the tree vector size. (encode_type_qualifiers): Do not handle the 'const' qualifier here. (encode_pointer): Encode 'const char *' as 'r*', for backwards compatibility. (encode_array): Use HOST_WIDE_INT_PRINT_DEC instead of "%ld". (encode_type): Handle the 'const' qualifier here. (objc_parmlist): New global variable, sued by objc_push_parm and objc_get_parm_info(). (objc_push_parm, objc_get_parm_info): New functions. (objc_expr_last): Remove function. (synth_self_and_ucmd_args): For instance methods, use the instance type for 'self'; call objc_push_parm() instead of push_parm_decl(). (start_method_def): Do not call push_scope(), declare_parm_level(), pop_scope(), push_parm_decl(), store_parm_decls() or objc_expr_last(); just use objc_push_parm() and objc_get_parm_info(). (comp_method_with_proto): Remove function. (objc_types_are_equivalent): Strip away indirections before comparing underlying types. (comp_proto_with_proto): Do not call groktypename(); types are no longer in raw declspec format. (objc_start_function): New function. (really_start_method): Call comp_proto_with_proto() instead of comp_method_with_proto(); call objc_start_function() instead of hand-crafting a function declarator. (continue_method_def, objc_expand_function_end): Remove functions. (get_super_receiver): Call objc_get_current_scope() instead of get_current_scope(); reference 'super_class' field (instead of 'class'). (finish_method_def): Rename to objc_finish_method_definition() and add a function decl parameter; move method encoding call from objc_expand_function_end(). (is_complex_decl, adorn_decl, gen_declarator, gen_declspecs, gen_declaration_1): Remove functions. (tmpbuf, RAW_DECLSPEC): Remove. (gen_declaration): Remove second parameter; simplify to deal with TYPE_P nodes instead of raw declspecs. (gen_type_name, gen_type_name_0): New functions. (gen_method_decl): Remove second parameter; call gen_type_name() instead of gen_declaration_1(). (dump_interface): Adjust calls to gen_declaration() and gen_method_decl(); do not allocate a separate string buffer. (init_objc): Allocate a larger string buffer to accommodate dump_interface(); adjust call to build_module_descriptor(); add call to build_module_initializer_routine() for the GNU runtime. (generate_classref_translation_entry): Do not call start_decl(); call finish_var_decl() instead of finish_decl(); call convert() instead of build_c_cast(). * objc-act.h (CLASS_OWN_IVARS): Remove accessor. (CLASS_BINFO_ELTS): Reduce from 6 to 5, now that CLASS_OWN_IVARS is gone. (OCTI_GNU_INIT_DECL, GNU_INIT_decl): New. (OCTI_ELLIPSIS_NODE, objc_ellipsis_node): Remove. (OCTI_ID_ID, id_type, objc_id_id): Rename to OCTI_ID_NAME, objc_object_type and objc_object_name, respectively. (OCTI_CLS_REF, OCTI_CLASS_NAME, objc_class_reference, objc_class_name): New. (IS_CLASS): New macro. (IS_ID, IS_SUPER): Robustify. (OCTI_EXECCLASS_DECL, execclass_decl): New. (finish_file, start_class, continue_class, finish_class, start_method_def, continue_method_def, finish_method_def, start_protocol, finish_protocol, objc_build_throw_stmt, objc_build_try_catch_finally_stmt, objc_build_synchronized_prologue, objc_build_synchronized_epilogue, objc_build_try_prologue, objc_build_try_epilogue, objc_build_catch_stmt, objc_build_catch_epilogue, objc_build_finally_prologue, objc_build_finally_epilogue, is_ivar, is_private, is_public, add_instance_variable, objc_add_method, get_super_receiver, objc_clear_super_receiver, get_class_ivars_from_name, get_class_reference, get_static_reference, get_object_reference, build_message_expr, finish_message_expr, build_selector_expr, build_ivar_reference, build_keyword_decl, build_method_decl, build_protocol_expr, build_objc_string_object, objc_declare_alias, objc_declare_class, objc_declare_protocols, objc_comptypes, objc_check_decl, build_encode_expr): Remove prototypes. (imp_count, cat_count): Make GGC-aware. (OBJC_SET_TYPE_NAME): New macro. From-SVN: r87168
2004-09-08 02:49:44 +02:00
if (flag_next_runtime)
c-common.c (flag_objc_sjlj_exceptions): New. * c-common.c (flag_objc_sjlj_exceptions): New. * c-common.h (flag_objc_sjlj_exceptions): Declare. * c-opts.c (c_common_handle_option): Set it. (c_common_post_options): Handle interation of different objective-c exception and runtime switches. * c-decl.c (c_eh_initialized_p): New. (finish_decl): Use it instead of local eh_initialized_p. * c-parse.in (nested_function, notype_nested_function): Record the result of compstmt. (compstmt_or_error): Likewise. (compstmt): Don't add_stmt the result. (stmt): Don't return anything. Rewrite objc try and sync rules. (objc_try_stmt, objc_catch_list): Remove. (objc_catch_block, objc_finally_block): Remove. (objc_catch_prefix, objc_catch_clause, objc_opt_catch_list): New. (objc_try_catch_clause, objc_finally_clause): New. (objc_try_catch_stmt): Rewrite. * c-tree.h (c_eh_initialized_p): Declare. * c-opt (fobjc-sjlj-exceptions): New. * except.c (output_function_exception_table): Don't call cgraph on non-decls. * objc/objc-act.c (UTAG_EXCDATA_VAR, UTAG_CAUGHTEXC_VAR, UTAG_RETHROWEXC_VAR, UTAG_EVALONCE_VAR, struct val_stack, catch_count_stack, exc_binding_stack, if_nesting_count, blk_nesting_count, objc_enter_block, objc_exit_block, objc_declare_variable, 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): Remove. (objc_create_temporary_var, struct objc_try_context, cur_try_context, objc_eh_runtime_type, objc_init_exceptions, objc_build_exc_ptr, next_sjlj_build_try_exit, next_sjlj_build_enter_and_setjmp, next_sjlj_build_exc_extract, next_sjlj_build_catch_list, next_sjlj_build_try_catch_finally, objc_begin_try_stmt, objc_begin_catch_clause, objc_finish_catch_clause, objc_build_finally_clause, objc_finish_try_stmt, objc_build_synchronized): New. (objc_is_object_id, objc_is_class_id): New. (objc_comptypes): Use them. (build_next_objc_exception_stuff): Break NeXT sjlj out from build_objc_exception_stuff. (synth_module_prologue): Update to match. (objc_build_throw_stmt): Use cur_try_context to decide if we're in a @catch. * objc/objc-act.h: Update prototypes. (OCTI_EXCEPTION_BLK_STACK, objc_exception_block_stack): Remove. testsuite/ * objc.dg/sync-1.m: New. * objc.dg/try-catch-1.m: Don't force next runtime. * objc.dg/try-catch-3.m, objc.dg/try-catch-4.m: Likewise. * objc.dg/try-catch-2.m: Likewise. Enable everywhere. Remove shadowed catch clause. * objc.dg/try-catch-5.m: New. From-SVN: r83332
2004-06-18 03:20:53 +02:00
build_next_objc_exception_stuff ();
1992-01-18 00:15:38 +01:00
/* static SEL _OBJC_SELECTOR_TABLE[]; */
if (! flag_next_runtime)
Makefile.in (c-parse.o): Depend on $(C_COMMON_H). [gcc/ChangeLog] 2004-09-07 Ziemowit Laski <zlaski@apple.com> * Makefile.in (c-parse.o): Depend on $(C_COMMON_H). * c-parse.in: Include c-common.h instead of objc-act.h. (ivar_decl_list, ivar_decls, ivar_decl, ivars, ivar_declarator, myparms, myparm): Remove %type declarations. (methodtype, optparms, OBJC_TYPE_QUAL, objc_quals, objc_qual, objc_typename, objc_try_catch_stmt, optellipsis): Add %type declarations. (objc_inherit_code, objc_public_flag): Remove. (typespec_nonreserved_nonattr): Call objc_get_protocol_qualified_type() instead of get_static_reference() and get_protocol_reference(). (stmt_nocomp): Call grokparm() on @catch parameter. (objcdef): Move semantic action to objc_finish_implementation(). (classdef): Move semantic action to objc_start_class_interface(), objc_continue_interface(), objc_finish_interface(), objc_start_class_implementation(), objc_continue_implementation(), objc_start_category_interface() and objc_start_category_implementation(). (protocoldef): Move semantic actions to objc_start_protocol() and objc_finish_interface(). (ivar_decl_list): Remove nonterminal. (visibility_spec): Move semantic actions to objc_set_visibility(). (ivar_decls): Remove assignment to $$. (ivar_decl): Rephrase in terms of component_decl; call objc_add_instance_variable(). (ivars, ivar_declarator): Remove nonterminals. (opt_semi): New nonterminal. (methodtype): Remove semantic actions. (methoddef): Move semantic actions to objc_set_method_type(), objc_start_method_definition() and objc_finish_method_definition(). (methodproto): Move semantic actions to objc_set_method_type() and objc_add_method_declaration(). (methoddecl): Use objc_typename instead of typename; move semantic actions to objc_build_method_signature(). (optarglist, myxdecls, mydecl, myparms, myparm): Remove nonterminals. (optparmlist): Express in terms of optparms and optellipsis. (optparms, optellipsis, objc_qual, objc_quals, objc_typename): New nonterminals. (keyworddecl): Use objc_typename instead of typename. (rid_to_yy): Mark RID_IN, RID_OUT, RID_INOUT, RID_BYCOPY, RID_BYREF and RID_ONEWAY as returning OBJC_TYPE_QUAL to yyparse(). [gcc/objc/ChangeLog] 2004-09-07 Ziemowit Laski <zlaski@apple.com> * Make-lang.in (objc/objc-parse.o): Depend on $(C_COMMON_H) instead of objc/objc-act.h. (objc/objc-act.o): Depend on $(HASHTAB_H). * objc-act.c: Include hashtab.h; in ObjC++ mode, include cp-tree.h and objcp-decl.h instead of c-tree.h. (build_module_descriptor, get_class_ivars, synth_id_with_class_suffix, error_with_ivar, gen_method_decl, gen_declaration, setup_string_decl, build_protocol_template): Adjust prototypes. (build_module_initializer_routine, start_class, continue_class, finish_class, start_method_def, objc_start_function, start_protocol, build_method_decl, objc_add_method, add_instance_variable, build_ivar_reference, is_ivar, is_private, get_super_receiver, build_selector_table_decl, objc_push_parm, objc_get_parm_info, gen_type_name, gen_type_name_0, start_var_decl, finish_var_decl, create_field_decl): New prototypes. (objc_expand_function_end, comp_method_with_proto, objc_expr_last, gen_declaration_1, gen_declarator, is_complex_decl, adorn_decl, define_decl, create_builtin_decl, gen_declspecs): Remove prototypes. (TYPE_ID): Rename to OBJECT_TYPEDEF_NAME. (CLASS_TYPEDEF_NAME): New. (TAG_EXECCLASS): Change from a global variable to a #define. (TAG_RETURN_STRUCT): Delete. (TAG_GNUINIT): New, holds '__objc_gnu_init' name. (objc_inherit_code, objc_public_flag): New, moved from c-parse.in. (string_descriptor): New struct. (string_htab): New hash table. (string_hash, string_eq): New prototypes. (generate_struct_by_value_array): Call create_field_decl() instead of create_builtin_decl(). (objc_init): Do not initialize objc_ellipsis_node or TAG_EXECCLASS; In ObjC++ mode, call cxx_init() instead of c_objc_common_init(). (objc_finish_file): In ObjC++, call instantiate_pending_templates() and cp_finish_file(). (define_decl, get_static_reference, get_protocol_reference, create_builtin_decl): Remove functions. (objc_start_class_interface, objc_start_category_interface, objc_start_protocol, objc_continue_interface, objc_finish_interface, objc_start_class_implementation, objc_start_category_implementation, objc_continue_implementation, objc_finish_implementation, objc_set_visibility, objc_set_method_type, objc_build_method_signature, objc_add_method_declaration, objc_start_method_definition, objc_add_instance_variable, objc_get_protocol_qualified_type, create_field_decl, start_var_decl, finish_var_decl): New functions. (setup_string_decl): Simplify since it is only called once. (synth_module_prologue): Call build_class_template(); predefine 'id' and 'Class' as typedefs; rename 'temp_type' to 'type'; disable debug hooks for duration of function; fix GNU runtime messenger signatures to correspond to reality; forward-declare '__objc_exec_class' for the GNU runtime; call build_selector_table_decl(); in ObjC++ mode, generate 'extern "C" { ... }' wrappers around synthesized declarations; call build_protocol_template() and build_category_template(). (string_hash, string_eq): New functions. (objc_build_string_object): Check metaclass correctness only once; store string literals in hash table. (objc_build_constructor): Do not convert initializer elements; adjust for ObjC++ impedance mismatch. (build_objc_symtab_template): Call create_field_decl() instead of create_builtin_decl(). (init_objc_symtab): Add missing conversion to initializer element. (build_metadata_decl): Call start_var_decl() instead of define_decl(). (generate_objc_symtab_decl): Do not call build_category_template(); call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(). (build_module_descriptor): Call create_field_decl() instead of grokfield(); call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(); always mark module descriptor as used; move GNU runtime-specific functionality to build_module_initializer_routine(). (build_module_initializer_routine): New function, broken off of build_module_descriptor(). (objc_static_init_needed_p, objc_generate_static_init_call): New functions. (generate_static_references, generate_strings, build_selector_translation_table, generate_descriptor_table, generate_ivars_list, generate_dispatch_table, generate_category): Call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(); build a type directly instead of via groktypename(). (build_selector_reference_decl, build_selector_table_decl, build_class_reference_decl, build_protocol_reference, generate_objc_image_info): Call start_var_decl() instead of build_decl(). (build_selector_reference): For GNU runtime, do not call build_selector_reference_decl(). (build_selector, build_typed_selector_reference): Always convert result to the selector type. (add_objc_string): Cast return value to 'char *'. (build_method_prototype_template, build_selector_template, build_method_template): Use actual selector type for fields pointing to selectors. (finish_objc): For GNU runtime, call build_module_initializer_routine() after build_module_descriptor(). (generate_protocol_list, generate_shared_structures): Call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(); build a type directly instead of via groktypename(). (synth_id_with_class_suffix): Return a string. (get_arg_type_list): For instance methods, use the instance type for 'self'; do not call groktypename_in_parm_context(). (build_objc_string_decl): Squash redeclaration errors in ObjC++. (objc_is_class_name): Use OBJC_TYPE_NAME instead of TYPE_NAME; handle RECORD_TYPEs in ObjC as well as ObjC++. (objc_is_id): New function. (objc_is_object_ptr): Return the canonical type node. (objc_get_class_ivars): Simplify using get_class_ivars(). (get_class_ivars): Remove second parameter; create a fresh copy of the ivar list for each call; do not check for existence of super class. (objc_eh_runtime_type): Mark #ifndef OBJCPLUS. (objc_init_exceptions): When using SJLJ-style exceptions, require the use of '-fobjc-exceptions' flag; do not require it for DWARF-style exceptions. (objc_build_exc_ptr, next_sjlj_build_try_catch_finally): Use objc_object_type instead of objc_id_type. (objc_begin_catch_clause): Convert the incoming PARM_DECL into a VAR_DECL before placing it in the appropriate scope; do not call define_decl(); adjust call to c_begin_compound_stmt(); use objc_object_type instead of objc_id_type. (build_next_objc_exception_stuff): Call create_field_decl() instead of create_builtin_decl(); construct type directly instead of calling groktypename(); use OBJC_VOID_AT_END to mark end of function parameters. (build_private_template): Adjust call to get_class_ivars(); build a type directly instead of via groktypename(). (build_protocol_template, build_method_prototype_list_template, build_method_prototype_template, build_category_template, build_selector_template, build_class_template, build_super_template, build_ivar_template, build_ivar_list_template, build_method_list_template, build_method_template): Call create_field_decl() instead of grokfield(). (objc_method_parm_type): Do not call groktypename(). (generate_descriptor_table): Call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(). (generate_method_descriptors, build_protocol_initializer, generate_dispatch_tables, build_category_initializer, build_shared_structure_initializer): Do not call groktypename(). (generate_protocols): Call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(); do not call groktypename(). (error_with_ivar): Remove last parameter. (check_ivars): Do not iterate ovar CLASS_RAW_IVARS lists in addition to CLASS_IVARS lists; adjust calls to error_with_ivar(). (generate_ivar_lists): Convert one of the initializer elements; do not call groktypename(). (get_arg_type_list, start_method_def, gen_method_def): Account for new representation of variable arguments and '...' in Objective-C methods; add Objective-C++ impedance matching code. (is_objc_type_qualifier): Remove function. (adjust_type_for_id_default): Simplify; there is no longer a need to wade through declspecs. (lookup_interface, start_class, continue_class, finish_class, start_method_def, start_protocol, build_method_decl, objc_add_method, add_instance_variable, build_ivar_reference, is_ivar, is_private, get_super_receiver, objc_build_finally_epilogue): Make into static functions. (receiver_is_class_object): Use new IS_CLASS() macro. (objc_build_message_expr): Tweak ObjC++ message argument handling; call objc_finish_message_expr() instead of finish_message_expr(). (finish_message_expr): Rename to objc_finish_message_expr(); use OBJC_TYPE_NAME and OBJC_SET_TYPE_NAME macros instead of TYPE_NAME. call gen_type_name() instead of gen_declaration(); call objc_is_id() instead of using IS_ID and IS_CLASS; Use objc_class_name instead of calling get_identifier("Class"); handle CONVERT_EXPRs in receiver. (build_objc_method_call, warn_with_method): Do not call groktypename(). (build_ivar_reference): Call convert() instead of clobbering in a type. (hash_init): Initialize string_htab hash table. (add_instance_variable): Simplify parameter list; do not call grokfield(); do not populate CLASS_IVARS list. (start_class): Check for the existence of super class, if one was specified. (continue_class): Use CLASS_RAW_IVARS rather than CLASS_IVARS; do not call build_class_template(); adjust call to get_class_ivars(); call build_decl(), pushdecl() and finish_decl() instead of define_decl(). (finish_class): Call build_decl(), pushdecl() and finish_decl() instead of define_decl(). (add_protocols): Use PROTOCOL_BINFO_ELTS for the tree vector size. (start_protocol): Do not call build_protocol_template(); use PROTOCOL_BINFO_ELTS for the tree vector size. (encode_type_qualifiers): Do not handle the 'const' qualifier here. (encode_pointer): Encode 'const char *' as 'r*', for backwards compatibility. (encode_array): Use HOST_WIDE_INT_PRINT_DEC instead of "%ld". (encode_type): Handle the 'const' qualifier here. (objc_parmlist): New global variable, sued by objc_push_parm and objc_get_parm_info(). (objc_push_parm, objc_get_parm_info): New functions. (objc_expr_last): Remove function. (synth_self_and_ucmd_args): For instance methods, use the instance type for 'self'; call objc_push_parm() instead of push_parm_decl(). (start_method_def): Do not call push_scope(), declare_parm_level(), pop_scope(), push_parm_decl(), store_parm_decls() or objc_expr_last(); just use objc_push_parm() and objc_get_parm_info(). (comp_method_with_proto): Remove function. (objc_types_are_equivalent): Strip away indirections before comparing underlying types. (comp_proto_with_proto): Do not call groktypename(); types are no longer in raw declspec format. (objc_start_function): New function. (really_start_method): Call comp_proto_with_proto() instead of comp_method_with_proto(); call objc_start_function() instead of hand-crafting a function declarator. (continue_method_def, objc_expand_function_end): Remove functions. (get_super_receiver): Call objc_get_current_scope() instead of get_current_scope(); reference 'super_class' field (instead of 'class'). (finish_method_def): Rename to objc_finish_method_definition() and add a function decl parameter; move method encoding call from objc_expand_function_end(). (is_complex_decl, adorn_decl, gen_declarator, gen_declspecs, gen_declaration_1): Remove functions. (tmpbuf, RAW_DECLSPEC): Remove. (gen_declaration): Remove second parameter; simplify to deal with TYPE_P nodes instead of raw declspecs. (gen_type_name, gen_type_name_0): New functions. (gen_method_decl): Remove second parameter; call gen_type_name() instead of gen_declaration_1(). (dump_interface): Adjust calls to gen_declaration() and gen_method_decl(); do not allocate a separate string buffer. (init_objc): Allocate a larger string buffer to accommodate dump_interface(); adjust call to build_module_descriptor(); add call to build_module_initializer_routine() for the GNU runtime. (generate_classref_translation_entry): Do not call start_decl(); call finish_var_decl() instead of finish_decl(); call convert() instead of build_c_cast(). * objc-act.h (CLASS_OWN_IVARS): Remove accessor. (CLASS_BINFO_ELTS): Reduce from 6 to 5, now that CLASS_OWN_IVARS is gone. (OCTI_GNU_INIT_DECL, GNU_INIT_decl): New. (OCTI_ELLIPSIS_NODE, objc_ellipsis_node): Remove. (OCTI_ID_ID, id_type, objc_id_id): Rename to OCTI_ID_NAME, objc_object_type and objc_object_name, respectively. (OCTI_CLS_REF, OCTI_CLASS_NAME, objc_class_reference, objc_class_name): New. (IS_CLASS): New macro. (IS_ID, IS_SUPER): Robustify. (OCTI_EXECCLASS_DECL, execclass_decl): New. (finish_file, start_class, continue_class, finish_class, start_method_def, continue_method_def, finish_method_def, start_protocol, finish_protocol, objc_build_throw_stmt, objc_build_try_catch_finally_stmt, objc_build_synchronized_prologue, objc_build_synchronized_epilogue, objc_build_try_prologue, objc_build_try_epilogue, objc_build_catch_stmt, objc_build_catch_epilogue, objc_build_finally_prologue, objc_build_finally_epilogue, is_ivar, is_private, is_public, add_instance_variable, objc_add_method, get_super_receiver, objc_clear_super_receiver, get_class_ivars_from_name, get_class_reference, get_static_reference, get_object_reference, build_message_expr, finish_message_expr, build_selector_expr, build_ivar_reference, build_keyword_decl, build_method_decl, build_protocol_expr, build_objc_string_object, objc_declare_alias, objc_declare_class, objc_declare_protocols, objc_comptypes, objc_check_decl, build_encode_expr): Remove prototypes. (imp_count, cat_count): Make GGC-aware. (OBJC_SET_TYPE_NAME): New macro. From-SVN: r87168
2004-09-08 02:49:44 +02:00
build_selector_table_decl ();
/* Forward declare constant_string_id and constant_string_type. */
if (!constant_string_class_name)
constant_string_class_name = default_constant_string_class_name;
constant_string_id = get_identifier (constant_string_class_name);
objc_declare_class (tree_cons (NULL_TREE, constant_string_id, NULL_TREE));
/* Pre-build the following entities - for speed/convenience. */
self_id = get_identifier ("self");
ucmd_id = get_identifier ("_cmd");
Makefile.in (c-parse.o): Depend on $(C_COMMON_H). [gcc/ChangeLog] 2004-09-07 Ziemowit Laski <zlaski@apple.com> * Makefile.in (c-parse.o): Depend on $(C_COMMON_H). * c-parse.in: Include c-common.h instead of objc-act.h. (ivar_decl_list, ivar_decls, ivar_decl, ivars, ivar_declarator, myparms, myparm): Remove %type declarations. (methodtype, optparms, OBJC_TYPE_QUAL, objc_quals, objc_qual, objc_typename, objc_try_catch_stmt, optellipsis): Add %type declarations. (objc_inherit_code, objc_public_flag): Remove. (typespec_nonreserved_nonattr): Call objc_get_protocol_qualified_type() instead of get_static_reference() and get_protocol_reference(). (stmt_nocomp): Call grokparm() on @catch parameter. (objcdef): Move semantic action to objc_finish_implementation(). (classdef): Move semantic action to objc_start_class_interface(), objc_continue_interface(), objc_finish_interface(), objc_start_class_implementation(), objc_continue_implementation(), objc_start_category_interface() and objc_start_category_implementation(). (protocoldef): Move semantic actions to objc_start_protocol() and objc_finish_interface(). (ivar_decl_list): Remove nonterminal. (visibility_spec): Move semantic actions to objc_set_visibility(). (ivar_decls): Remove assignment to $$. (ivar_decl): Rephrase in terms of component_decl; call objc_add_instance_variable(). (ivars, ivar_declarator): Remove nonterminals. (opt_semi): New nonterminal. (methodtype): Remove semantic actions. (methoddef): Move semantic actions to objc_set_method_type(), objc_start_method_definition() and objc_finish_method_definition(). (methodproto): Move semantic actions to objc_set_method_type() and objc_add_method_declaration(). (methoddecl): Use objc_typename instead of typename; move semantic actions to objc_build_method_signature(). (optarglist, myxdecls, mydecl, myparms, myparm): Remove nonterminals. (optparmlist): Express in terms of optparms and optellipsis. (optparms, optellipsis, objc_qual, objc_quals, objc_typename): New nonterminals. (keyworddecl): Use objc_typename instead of typename. (rid_to_yy): Mark RID_IN, RID_OUT, RID_INOUT, RID_BYCOPY, RID_BYREF and RID_ONEWAY as returning OBJC_TYPE_QUAL to yyparse(). [gcc/objc/ChangeLog] 2004-09-07 Ziemowit Laski <zlaski@apple.com> * Make-lang.in (objc/objc-parse.o): Depend on $(C_COMMON_H) instead of objc/objc-act.h. (objc/objc-act.o): Depend on $(HASHTAB_H). * objc-act.c: Include hashtab.h; in ObjC++ mode, include cp-tree.h and objcp-decl.h instead of c-tree.h. (build_module_descriptor, get_class_ivars, synth_id_with_class_suffix, error_with_ivar, gen_method_decl, gen_declaration, setup_string_decl, build_protocol_template): Adjust prototypes. (build_module_initializer_routine, start_class, continue_class, finish_class, start_method_def, objc_start_function, start_protocol, build_method_decl, objc_add_method, add_instance_variable, build_ivar_reference, is_ivar, is_private, get_super_receiver, build_selector_table_decl, objc_push_parm, objc_get_parm_info, gen_type_name, gen_type_name_0, start_var_decl, finish_var_decl, create_field_decl): New prototypes. (objc_expand_function_end, comp_method_with_proto, objc_expr_last, gen_declaration_1, gen_declarator, is_complex_decl, adorn_decl, define_decl, create_builtin_decl, gen_declspecs): Remove prototypes. (TYPE_ID): Rename to OBJECT_TYPEDEF_NAME. (CLASS_TYPEDEF_NAME): New. (TAG_EXECCLASS): Change from a global variable to a #define. (TAG_RETURN_STRUCT): Delete. (TAG_GNUINIT): New, holds '__objc_gnu_init' name. (objc_inherit_code, objc_public_flag): New, moved from c-parse.in. (string_descriptor): New struct. (string_htab): New hash table. (string_hash, string_eq): New prototypes. (generate_struct_by_value_array): Call create_field_decl() instead of create_builtin_decl(). (objc_init): Do not initialize objc_ellipsis_node or TAG_EXECCLASS; In ObjC++ mode, call cxx_init() instead of c_objc_common_init(). (objc_finish_file): In ObjC++, call instantiate_pending_templates() and cp_finish_file(). (define_decl, get_static_reference, get_protocol_reference, create_builtin_decl): Remove functions. (objc_start_class_interface, objc_start_category_interface, objc_start_protocol, objc_continue_interface, objc_finish_interface, objc_start_class_implementation, objc_start_category_implementation, objc_continue_implementation, objc_finish_implementation, objc_set_visibility, objc_set_method_type, objc_build_method_signature, objc_add_method_declaration, objc_start_method_definition, objc_add_instance_variable, objc_get_protocol_qualified_type, create_field_decl, start_var_decl, finish_var_decl): New functions. (setup_string_decl): Simplify since it is only called once. (synth_module_prologue): Call build_class_template(); predefine 'id' and 'Class' as typedefs; rename 'temp_type' to 'type'; disable debug hooks for duration of function; fix GNU runtime messenger signatures to correspond to reality; forward-declare '__objc_exec_class' for the GNU runtime; call build_selector_table_decl(); in ObjC++ mode, generate 'extern "C" { ... }' wrappers around synthesized declarations; call build_protocol_template() and build_category_template(). (string_hash, string_eq): New functions. (objc_build_string_object): Check metaclass correctness only once; store string literals in hash table. (objc_build_constructor): Do not convert initializer elements; adjust for ObjC++ impedance mismatch. (build_objc_symtab_template): Call create_field_decl() instead of create_builtin_decl(). (init_objc_symtab): Add missing conversion to initializer element. (build_metadata_decl): Call start_var_decl() instead of define_decl(). (generate_objc_symtab_decl): Do not call build_category_template(); call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(). (build_module_descriptor): Call create_field_decl() instead of grokfield(); call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(); always mark module descriptor as used; move GNU runtime-specific functionality to build_module_initializer_routine(). (build_module_initializer_routine): New function, broken off of build_module_descriptor(). (objc_static_init_needed_p, objc_generate_static_init_call): New functions. (generate_static_references, generate_strings, build_selector_translation_table, generate_descriptor_table, generate_ivars_list, generate_dispatch_table, generate_category): Call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(); build a type directly instead of via groktypename(). (build_selector_reference_decl, build_selector_table_decl, build_class_reference_decl, build_protocol_reference, generate_objc_image_info): Call start_var_decl() instead of build_decl(). (build_selector_reference): For GNU runtime, do not call build_selector_reference_decl(). (build_selector, build_typed_selector_reference): Always convert result to the selector type. (add_objc_string): Cast return value to 'char *'. (build_method_prototype_template, build_selector_template, build_method_template): Use actual selector type for fields pointing to selectors. (finish_objc): For GNU runtime, call build_module_initializer_routine() after build_module_descriptor(). (generate_protocol_list, generate_shared_structures): Call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(); build a type directly instead of via groktypename(). (synth_id_with_class_suffix): Return a string. (get_arg_type_list): For instance methods, use the instance type for 'self'; do not call groktypename_in_parm_context(). (build_objc_string_decl): Squash redeclaration errors in ObjC++. (objc_is_class_name): Use OBJC_TYPE_NAME instead of TYPE_NAME; handle RECORD_TYPEs in ObjC as well as ObjC++. (objc_is_id): New function. (objc_is_object_ptr): Return the canonical type node. (objc_get_class_ivars): Simplify using get_class_ivars(). (get_class_ivars): Remove second parameter; create a fresh copy of the ivar list for each call; do not check for existence of super class. (objc_eh_runtime_type): Mark #ifndef OBJCPLUS. (objc_init_exceptions): When using SJLJ-style exceptions, require the use of '-fobjc-exceptions' flag; do not require it for DWARF-style exceptions. (objc_build_exc_ptr, next_sjlj_build_try_catch_finally): Use objc_object_type instead of objc_id_type. (objc_begin_catch_clause): Convert the incoming PARM_DECL into a VAR_DECL before placing it in the appropriate scope; do not call define_decl(); adjust call to c_begin_compound_stmt(); use objc_object_type instead of objc_id_type. (build_next_objc_exception_stuff): Call create_field_decl() instead of create_builtin_decl(); construct type directly instead of calling groktypename(); use OBJC_VOID_AT_END to mark end of function parameters. (build_private_template): Adjust call to get_class_ivars(); build a type directly instead of via groktypename(). (build_protocol_template, build_method_prototype_list_template, build_method_prototype_template, build_category_template, build_selector_template, build_class_template, build_super_template, build_ivar_template, build_ivar_list_template, build_method_list_template, build_method_template): Call create_field_decl() instead of grokfield(). (objc_method_parm_type): Do not call groktypename(). (generate_descriptor_table): Call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(). (generate_method_descriptors, build_protocol_initializer, generate_dispatch_tables, build_category_initializer, build_shared_structure_initializer): Do not call groktypename(). (generate_protocols): Call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(); do not call groktypename(). (error_with_ivar): Remove last parameter. (check_ivars): Do not iterate ovar CLASS_RAW_IVARS lists in addition to CLASS_IVARS lists; adjust calls to error_with_ivar(). (generate_ivar_lists): Convert one of the initializer elements; do not call groktypename(). (get_arg_type_list, start_method_def, gen_method_def): Account for new representation of variable arguments and '...' in Objective-C methods; add Objective-C++ impedance matching code. (is_objc_type_qualifier): Remove function. (adjust_type_for_id_default): Simplify; there is no longer a need to wade through declspecs. (lookup_interface, start_class, continue_class, finish_class, start_method_def, start_protocol, build_method_decl, objc_add_method, add_instance_variable, build_ivar_reference, is_ivar, is_private, get_super_receiver, objc_build_finally_epilogue): Make into static functions. (receiver_is_class_object): Use new IS_CLASS() macro. (objc_build_message_expr): Tweak ObjC++ message argument handling; call objc_finish_message_expr() instead of finish_message_expr(). (finish_message_expr): Rename to objc_finish_message_expr(); use OBJC_TYPE_NAME and OBJC_SET_TYPE_NAME macros instead of TYPE_NAME. call gen_type_name() instead of gen_declaration(); call objc_is_id() instead of using IS_ID and IS_CLASS; Use objc_class_name instead of calling get_identifier("Class"); handle CONVERT_EXPRs in receiver. (build_objc_method_call, warn_with_method): Do not call groktypename(). (build_ivar_reference): Call convert() instead of clobbering in a type. (hash_init): Initialize string_htab hash table. (add_instance_variable): Simplify parameter list; do not call grokfield(); do not populate CLASS_IVARS list. (start_class): Check for the existence of super class, if one was specified. (continue_class): Use CLASS_RAW_IVARS rather than CLASS_IVARS; do not call build_class_template(); adjust call to get_class_ivars(); call build_decl(), pushdecl() and finish_decl() instead of define_decl(). (finish_class): Call build_decl(), pushdecl() and finish_decl() instead of define_decl(). (add_protocols): Use PROTOCOL_BINFO_ELTS for the tree vector size. (start_protocol): Do not call build_protocol_template(); use PROTOCOL_BINFO_ELTS for the tree vector size. (encode_type_qualifiers): Do not handle the 'const' qualifier here. (encode_pointer): Encode 'const char *' as 'r*', for backwards compatibility. (encode_array): Use HOST_WIDE_INT_PRINT_DEC instead of "%ld". (encode_type): Handle the 'const' qualifier here. (objc_parmlist): New global variable, sued by objc_push_parm and objc_get_parm_info(). (objc_push_parm, objc_get_parm_info): New functions. (objc_expr_last): Remove function. (synth_self_and_ucmd_args): For instance methods, use the instance type for 'self'; call objc_push_parm() instead of push_parm_decl(). (start_method_def): Do not call push_scope(), declare_parm_level(), pop_scope(), push_parm_decl(), store_parm_decls() or objc_expr_last(); just use objc_push_parm() and objc_get_parm_info(). (comp_method_with_proto): Remove function. (objc_types_are_equivalent): Strip away indirections before comparing underlying types. (comp_proto_with_proto): Do not call groktypename(); types are no longer in raw declspec format. (objc_start_function): New function. (really_start_method): Call comp_proto_with_proto() instead of comp_method_with_proto(); call objc_start_function() instead of hand-crafting a function declarator. (continue_method_def, objc_expand_function_end): Remove functions. (get_super_receiver): Call objc_get_current_scope() instead of get_current_scope(); reference 'super_class' field (instead of 'class'). (finish_method_def): Rename to objc_finish_method_definition() and add a function decl parameter; move method encoding call from objc_expand_function_end(). (is_complex_decl, adorn_decl, gen_declarator, gen_declspecs, gen_declaration_1): Remove functions. (tmpbuf, RAW_DECLSPEC): Remove. (gen_declaration): Remove second parameter; simplify to deal with TYPE_P nodes instead of raw declspecs. (gen_type_name, gen_type_name_0): New functions. (gen_method_decl): Remove second parameter; call gen_type_name() instead of gen_declaration_1(). (dump_interface): Adjust calls to gen_declaration() and gen_method_decl(); do not allocate a separate string buffer. (init_objc): Allocate a larger string buffer to accommodate dump_interface(); adjust call to build_module_descriptor(); add call to build_module_initializer_routine() for the GNU runtime. (generate_classref_translation_entry): Do not call start_decl(); call finish_var_decl() instead of finish_decl(); call convert() instead of build_c_cast(). * objc-act.h (CLASS_OWN_IVARS): Remove accessor. (CLASS_BINFO_ELTS): Reduce from 6 to 5, now that CLASS_OWN_IVARS is gone. (OCTI_GNU_INIT_DECL, GNU_INIT_decl): New. (OCTI_ELLIPSIS_NODE, objc_ellipsis_node): Remove. (OCTI_ID_ID, id_type, objc_id_id): Rename to OCTI_ID_NAME, objc_object_type and objc_object_name, respectively. (OCTI_CLS_REF, OCTI_CLASS_NAME, objc_class_reference, objc_class_name): New. (IS_CLASS): New macro. (IS_ID, IS_SUPER): Robustify. (OCTI_EXECCLASS_DECL, execclass_decl): New. (finish_file, start_class, continue_class, finish_class, start_method_def, continue_method_def, finish_method_def, start_protocol, finish_protocol, objc_build_throw_stmt, objc_build_try_catch_finally_stmt, objc_build_synchronized_prologue, objc_build_synchronized_epilogue, objc_build_try_prologue, objc_build_try_epilogue, objc_build_catch_stmt, objc_build_catch_epilogue, objc_build_finally_prologue, objc_build_finally_epilogue, is_ivar, is_private, is_public, add_instance_variable, objc_add_method, get_super_receiver, objc_clear_super_receiver, get_class_ivars_from_name, get_class_reference, get_static_reference, get_object_reference, build_message_expr, finish_message_expr, build_selector_expr, build_ivar_reference, build_keyword_decl, build_method_decl, build_protocol_expr, build_objc_string_object, objc_declare_alias, objc_declare_class, objc_declare_protocols, objc_comptypes, objc_check_decl, build_encode_expr): Remove prototypes. (imp_count, cat_count): Make GGC-aware. (OBJC_SET_TYPE_NAME): New macro. From-SVN: r87168
2004-09-08 02:49:44 +02:00
#ifdef OBJCPLUS
pop_lang_context ();
#endif
write_symbols = save_write_symbols;
debug_hooks = save_hooks;
1992-01-18 00:15:38 +01:00
}
/* Ensure that the ivar list for NSConstantString/NXConstantString
(or whatever was specified via `-fconstant-string-class')
contains fields at least as large as the following three, so that
the runtime can stomp on them with confidence:
struct STRING_OBJECT_CLASS_NAME
{
Object isa;
char *cString;
unsigned int length;
}; */
static int
check_string_class_template (void)
{
tree field_decl = objc_get_class_ivars (constant_string_id);
#define AT_LEAST_AS_LARGE_AS(F, T) \
(F && TREE_CODE (F) == FIELD_DECL \
&& (TREE_INT_CST_LOW (TYPE_SIZE (TREE_TYPE (F))) \
>= TREE_INT_CST_LOW (TYPE_SIZE (T))))
if (!AT_LEAST_AS_LARGE_AS (field_decl, ptr_type_node))
return 0;
field_decl = TREE_CHAIN (field_decl);
if (!AT_LEAST_AS_LARGE_AS (field_decl, ptr_type_node))
return 0;
field_decl = TREE_CHAIN (field_decl);
return AT_LEAST_AS_LARGE_AS (field_decl, unsigned_type_node);
#undef AT_LEAST_AS_LARGE_AS
}
/* Avoid calling `check_string_class_template ()' more than once. */
static GTY(()) int string_layout_checked;
/* Construct an internal string layout to be used as a template for
creating NSConstantString/NXConstantString instances. */
static tree
objc_build_internal_const_str_type (void)
{
tree type = (*lang_hooks.types.make_type) (RECORD_TYPE);
tree fields = build_decl (FIELD_DECL, NULL_TREE, ptr_type_node);
tree field = build_decl (FIELD_DECL, NULL_TREE, ptr_type_node);
TREE_CHAIN (field) = fields; fields = field;
field = build_decl (FIELD_DECL, NULL_TREE, unsigned_type_node);
TREE_CHAIN (field) = fields; fields = field;
/* NB: The finish_builtin_struct() routine expects FIELD_DECLs in
reverse order! */
finish_builtin_struct (type, "__builtin_ObjCString",
fields, NULL_TREE);
return type;
}
/* Custom build_string which sets TREE_TYPE! */
1992-01-18 00:15:38 +01:00
static tree
my_build_string (int len, const char *str)
1992-01-18 00:15:38 +01:00
{
return fix_string_type (build_string (len, str));
}
c-tree.h (default_function_array_conversion): Declare. * c-tree.h (default_function_array_conversion): Declare. * c-typeck.c (default_function_array_conversion): Export. Correct comment. (default_conversion): Do not call default_function_array_conversion. Do not allow FUNCTION_TYPE. (build_function_call): Call default_function_array_conversion on the function. (convert_arguments): Do not call it on the function arguments. (build_unary_op): Do not allow ARRAY_TYPE or FUNCTION_TYPE for TRUTH_NOT_EXPR. Call default_function_array_conversion for taking address of ARRAY_REF. (build_compound_expr): Do not call default_function_array_conversion. (build_c_cast): Do not call default_function_array_conversion. (convert_for_assignment): Do not call default_conversion. (digest_init): Call default_function_array_conversion to convert string constants and compound literals to pointers, but not otherwise. (output_init_element): Likewise. (build_asm_expr): Do not call default_function_array_conversion. (c_process_expr_stmt): Likewise. (c_objc_common_truthvalue_conversion): Likewise. Do not allow FUNCTION_TYPE. * c-parser.c (c_parser_expression_conv): New. (c_parser_asm_operands, c_parser_expr_list): Add convert_p argument. All callers changed. Call default_function_array_conversion if convert_p. (c_parser_initializer, c_parser_initval): Call default_function_array_conversion except for string constants and compound literals. (c_parser_initelt): Call default_function_array_conversion for ObjC expression received. (c_parser_statement_after_labels): Call c_parser_expression_conv for return and expression statements. (c_parser_paren_condition, c_parser_for_statement, c_parser_conditional_expression): Call c_parser_expression_conv. (c_parser_expr_no_commas, c_parser_conditional_expression, c_parser_binary_expression, c_parser_cast_expression, c_parser_unary_expression): Call default_function_array_conversion. objc: * objc-act.c (my_build_string_pointer): New. (objc_get_class_reference, get_super_receiver): Call my_build_string_pointer instead of my_build_string when building function arguments. testsuite: * gcc.dg/noncompile/20040203-3.c: Update expected message. From-SVN: r100984
2005-06-15 17:55:47 +02:00
/* Build a string with contents STR and length LEN and convert it to a
pointer. */
static tree
my_build_string_pointer (int len, const char *str)
{
tree string = my_build_string (len, str);
tree ptrtype = build_pointer_type (TREE_TYPE (TREE_TYPE (string)));
return build1 (ADDR_EXPR, ptrtype, string);
}
Makefile.in (c-parse.o): Depend on $(C_COMMON_H). [gcc/ChangeLog] 2004-09-07 Ziemowit Laski <zlaski@apple.com> * Makefile.in (c-parse.o): Depend on $(C_COMMON_H). * c-parse.in: Include c-common.h instead of objc-act.h. (ivar_decl_list, ivar_decls, ivar_decl, ivars, ivar_declarator, myparms, myparm): Remove %type declarations. (methodtype, optparms, OBJC_TYPE_QUAL, objc_quals, objc_qual, objc_typename, objc_try_catch_stmt, optellipsis): Add %type declarations. (objc_inherit_code, objc_public_flag): Remove. (typespec_nonreserved_nonattr): Call objc_get_protocol_qualified_type() instead of get_static_reference() and get_protocol_reference(). (stmt_nocomp): Call grokparm() on @catch parameter. (objcdef): Move semantic action to objc_finish_implementation(). (classdef): Move semantic action to objc_start_class_interface(), objc_continue_interface(), objc_finish_interface(), objc_start_class_implementation(), objc_continue_implementation(), objc_start_category_interface() and objc_start_category_implementation(). (protocoldef): Move semantic actions to objc_start_protocol() and objc_finish_interface(). (ivar_decl_list): Remove nonterminal. (visibility_spec): Move semantic actions to objc_set_visibility(). (ivar_decls): Remove assignment to $$. (ivar_decl): Rephrase in terms of component_decl; call objc_add_instance_variable(). (ivars, ivar_declarator): Remove nonterminals. (opt_semi): New nonterminal. (methodtype): Remove semantic actions. (methoddef): Move semantic actions to objc_set_method_type(), objc_start_method_definition() and objc_finish_method_definition(). (methodproto): Move semantic actions to objc_set_method_type() and objc_add_method_declaration(). (methoddecl): Use objc_typename instead of typename; move semantic actions to objc_build_method_signature(). (optarglist, myxdecls, mydecl, myparms, myparm): Remove nonterminals. (optparmlist): Express in terms of optparms and optellipsis. (optparms, optellipsis, objc_qual, objc_quals, objc_typename): New nonterminals. (keyworddecl): Use objc_typename instead of typename. (rid_to_yy): Mark RID_IN, RID_OUT, RID_INOUT, RID_BYCOPY, RID_BYREF and RID_ONEWAY as returning OBJC_TYPE_QUAL to yyparse(). [gcc/objc/ChangeLog] 2004-09-07 Ziemowit Laski <zlaski@apple.com> * Make-lang.in (objc/objc-parse.o): Depend on $(C_COMMON_H) instead of objc/objc-act.h. (objc/objc-act.o): Depend on $(HASHTAB_H). * objc-act.c: Include hashtab.h; in ObjC++ mode, include cp-tree.h and objcp-decl.h instead of c-tree.h. (build_module_descriptor, get_class_ivars, synth_id_with_class_suffix, error_with_ivar, gen_method_decl, gen_declaration, setup_string_decl, build_protocol_template): Adjust prototypes. (build_module_initializer_routine, start_class, continue_class, finish_class, start_method_def, objc_start_function, start_protocol, build_method_decl, objc_add_method, add_instance_variable, build_ivar_reference, is_ivar, is_private, get_super_receiver, build_selector_table_decl, objc_push_parm, objc_get_parm_info, gen_type_name, gen_type_name_0, start_var_decl, finish_var_decl, create_field_decl): New prototypes. (objc_expand_function_end, comp_method_with_proto, objc_expr_last, gen_declaration_1, gen_declarator, is_complex_decl, adorn_decl, define_decl, create_builtin_decl, gen_declspecs): Remove prototypes. (TYPE_ID): Rename to OBJECT_TYPEDEF_NAME. (CLASS_TYPEDEF_NAME): New. (TAG_EXECCLASS): Change from a global variable to a #define. (TAG_RETURN_STRUCT): Delete. (TAG_GNUINIT): New, holds '__objc_gnu_init' name. (objc_inherit_code, objc_public_flag): New, moved from c-parse.in. (string_descriptor): New struct. (string_htab): New hash table. (string_hash, string_eq): New prototypes. (generate_struct_by_value_array): Call create_field_decl() instead of create_builtin_decl(). (objc_init): Do not initialize objc_ellipsis_node or TAG_EXECCLASS; In ObjC++ mode, call cxx_init() instead of c_objc_common_init(). (objc_finish_file): In ObjC++, call instantiate_pending_templates() and cp_finish_file(). (define_decl, get_static_reference, get_protocol_reference, create_builtin_decl): Remove functions. (objc_start_class_interface, objc_start_category_interface, objc_start_protocol, objc_continue_interface, objc_finish_interface, objc_start_class_implementation, objc_start_category_implementation, objc_continue_implementation, objc_finish_implementation, objc_set_visibility, objc_set_method_type, objc_build_method_signature, objc_add_method_declaration, objc_start_method_definition, objc_add_instance_variable, objc_get_protocol_qualified_type, create_field_decl, start_var_decl, finish_var_decl): New functions. (setup_string_decl): Simplify since it is only called once. (synth_module_prologue): Call build_class_template(); predefine 'id' and 'Class' as typedefs; rename 'temp_type' to 'type'; disable debug hooks for duration of function; fix GNU runtime messenger signatures to correspond to reality; forward-declare '__objc_exec_class' for the GNU runtime; call build_selector_table_decl(); in ObjC++ mode, generate 'extern "C" { ... }' wrappers around synthesized declarations; call build_protocol_template() and build_category_template(). (string_hash, string_eq): New functions. (objc_build_string_object): Check metaclass correctness only once; store string literals in hash table. (objc_build_constructor): Do not convert initializer elements; adjust for ObjC++ impedance mismatch. (build_objc_symtab_template): Call create_field_decl() instead of create_builtin_decl(). (init_objc_symtab): Add missing conversion to initializer element. (build_metadata_decl): Call start_var_decl() instead of define_decl(). (generate_objc_symtab_decl): Do not call build_category_template(); call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(). (build_module_descriptor): Call create_field_decl() instead of grokfield(); call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(); always mark module descriptor as used; move GNU runtime-specific functionality to build_module_initializer_routine(). (build_module_initializer_routine): New function, broken off of build_module_descriptor(). (objc_static_init_needed_p, objc_generate_static_init_call): New functions. (generate_static_references, generate_strings, build_selector_translation_table, generate_descriptor_table, generate_ivars_list, generate_dispatch_table, generate_category): Call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(); build a type directly instead of via groktypename(). (build_selector_reference_decl, build_selector_table_decl, build_class_reference_decl, build_protocol_reference, generate_objc_image_info): Call start_var_decl() instead of build_decl(). (build_selector_reference): For GNU runtime, do not call build_selector_reference_decl(). (build_selector, build_typed_selector_reference): Always convert result to the selector type. (add_objc_string): Cast return value to 'char *'. (build_method_prototype_template, build_selector_template, build_method_template): Use actual selector type for fields pointing to selectors. (finish_objc): For GNU runtime, call build_module_initializer_routine() after build_module_descriptor(). (generate_protocol_list, generate_shared_structures): Call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(); build a type directly instead of via groktypename(). (synth_id_with_class_suffix): Return a string. (get_arg_type_list): For instance methods, use the instance type for 'self'; do not call groktypename_in_parm_context(). (build_objc_string_decl): Squash redeclaration errors in ObjC++. (objc_is_class_name): Use OBJC_TYPE_NAME instead of TYPE_NAME; handle RECORD_TYPEs in ObjC as well as ObjC++. (objc_is_id): New function. (objc_is_object_ptr): Return the canonical type node. (objc_get_class_ivars): Simplify using get_class_ivars(). (get_class_ivars): Remove second parameter; create a fresh copy of the ivar list for each call; do not check for existence of super class. (objc_eh_runtime_type): Mark #ifndef OBJCPLUS. (objc_init_exceptions): When using SJLJ-style exceptions, require the use of '-fobjc-exceptions' flag; do not require it for DWARF-style exceptions. (objc_build_exc_ptr, next_sjlj_build_try_catch_finally): Use objc_object_type instead of objc_id_type. (objc_begin_catch_clause): Convert the incoming PARM_DECL into a VAR_DECL before placing it in the appropriate scope; do not call define_decl(); adjust call to c_begin_compound_stmt(); use objc_object_type instead of objc_id_type. (build_next_objc_exception_stuff): Call create_field_decl() instead of create_builtin_decl(); construct type directly instead of calling groktypename(); use OBJC_VOID_AT_END to mark end of function parameters. (build_private_template): Adjust call to get_class_ivars(); build a type directly instead of via groktypename(). (build_protocol_template, build_method_prototype_list_template, build_method_prototype_template, build_category_template, build_selector_template, build_class_template, build_super_template, build_ivar_template, build_ivar_list_template, build_method_list_template, build_method_template): Call create_field_decl() instead of grokfield(). (objc_method_parm_type): Do not call groktypename(). (generate_descriptor_table): Call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(). (generate_method_descriptors, build_protocol_initializer, generate_dispatch_tables, build_category_initializer, build_shared_structure_initializer): Do not call groktypename(). (generate_protocols): Call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(); do not call groktypename(). (error_with_ivar): Remove last parameter. (check_ivars): Do not iterate ovar CLASS_RAW_IVARS lists in addition to CLASS_IVARS lists; adjust calls to error_with_ivar(). (generate_ivar_lists): Convert one of the initializer elements; do not call groktypename(). (get_arg_type_list, start_method_def, gen_method_def): Account for new representation of variable arguments and '...' in Objective-C methods; add Objective-C++ impedance matching code. (is_objc_type_qualifier): Remove function. (adjust_type_for_id_default): Simplify; there is no longer a need to wade through declspecs. (lookup_interface, start_class, continue_class, finish_class, start_method_def, start_protocol, build_method_decl, objc_add_method, add_instance_variable, build_ivar_reference, is_ivar, is_private, get_super_receiver, objc_build_finally_epilogue): Make into static functions. (receiver_is_class_object): Use new IS_CLASS() macro. (objc_build_message_expr): Tweak ObjC++ message argument handling; call objc_finish_message_expr() instead of finish_message_expr(). (finish_message_expr): Rename to objc_finish_message_expr(); use OBJC_TYPE_NAME and OBJC_SET_TYPE_NAME macros instead of TYPE_NAME. call gen_type_name() instead of gen_declaration(); call objc_is_id() instead of using IS_ID and IS_CLASS; Use objc_class_name instead of calling get_identifier("Class"); handle CONVERT_EXPRs in receiver. (build_objc_method_call, warn_with_method): Do not call groktypename(). (build_ivar_reference): Call convert() instead of clobbering in a type. (hash_init): Initialize string_htab hash table. (add_instance_variable): Simplify parameter list; do not call grokfield(); do not populate CLASS_IVARS list. (start_class): Check for the existence of super class, if one was specified. (continue_class): Use CLASS_RAW_IVARS rather than CLASS_IVARS; do not call build_class_template(); adjust call to get_class_ivars(); call build_decl(), pushdecl() and finish_decl() instead of define_decl(). (finish_class): Call build_decl(), pushdecl() and finish_decl() instead of define_decl(). (add_protocols): Use PROTOCOL_BINFO_ELTS for the tree vector size. (start_protocol): Do not call build_protocol_template(); use PROTOCOL_BINFO_ELTS for the tree vector size. (encode_type_qualifiers): Do not handle the 'const' qualifier here. (encode_pointer): Encode 'const char *' as 'r*', for backwards compatibility. (encode_array): Use HOST_WIDE_INT_PRINT_DEC instead of "%ld". (encode_type): Handle the 'const' qualifier here. (objc_parmlist): New global variable, sued by objc_push_parm and objc_get_parm_info(). (objc_push_parm, objc_get_parm_info): New functions. (objc_expr_last): Remove function. (synth_self_and_ucmd_args): For instance methods, use the instance type for 'self'; call objc_push_parm() instead of push_parm_decl(). (start_method_def): Do not call push_scope(), declare_parm_level(), pop_scope(), push_parm_decl(), store_parm_decls() or objc_expr_last(); just use objc_push_parm() and objc_get_parm_info(). (comp_method_with_proto): Remove function. (objc_types_are_equivalent): Strip away indirections before comparing underlying types. (comp_proto_with_proto): Do not call groktypename(); types are no longer in raw declspec format. (objc_start_function): New function. (really_start_method): Call comp_proto_with_proto() instead of comp_method_with_proto(); call objc_start_function() instead of hand-crafting a function declarator. (continue_method_def, objc_expand_function_end): Remove functions. (get_super_receiver): Call objc_get_current_scope() instead of get_current_scope(); reference 'super_class' field (instead of 'class'). (finish_method_def): Rename to objc_finish_method_definition() and add a function decl parameter; move method encoding call from objc_expand_function_end(). (is_complex_decl, adorn_decl, gen_declarator, gen_declspecs, gen_declaration_1): Remove functions. (tmpbuf, RAW_DECLSPEC): Remove. (gen_declaration): Remove second parameter; simplify to deal with TYPE_P nodes instead of raw declspecs. (gen_type_name, gen_type_name_0): New functions. (gen_method_decl): Remove second parameter; call gen_type_name() instead of gen_declaration_1(). (dump_interface): Adjust calls to gen_declaration() and gen_method_decl(); do not allocate a separate string buffer. (init_objc): Allocate a larger string buffer to accommodate dump_interface(); adjust call to build_module_descriptor(); add call to build_module_initializer_routine() for the GNU runtime. (generate_classref_translation_entry): Do not call start_decl(); call finish_var_decl() instead of finish_decl(); call convert() instead of build_c_cast(). * objc-act.h (CLASS_OWN_IVARS): Remove accessor. (CLASS_BINFO_ELTS): Reduce from 6 to 5, now that CLASS_OWN_IVARS is gone. (OCTI_GNU_INIT_DECL, GNU_INIT_decl): New. (OCTI_ELLIPSIS_NODE, objc_ellipsis_node): Remove. (OCTI_ID_ID, id_type, objc_id_id): Rename to OCTI_ID_NAME, objc_object_type and objc_object_name, respectively. (OCTI_CLS_REF, OCTI_CLASS_NAME, objc_class_reference, objc_class_name): New. (IS_CLASS): New macro. (IS_ID, IS_SUPER): Robustify. (OCTI_EXECCLASS_DECL, execclass_decl): New. (finish_file, start_class, continue_class, finish_class, start_method_def, continue_method_def, finish_method_def, start_protocol, finish_protocol, objc_build_throw_stmt, objc_build_try_catch_finally_stmt, objc_build_synchronized_prologue, objc_build_synchronized_epilogue, objc_build_try_prologue, objc_build_try_epilogue, objc_build_catch_stmt, objc_build_catch_epilogue, objc_build_finally_prologue, objc_build_finally_epilogue, is_ivar, is_private, is_public, add_instance_variable, objc_add_method, get_super_receiver, objc_clear_super_receiver, get_class_ivars_from_name, get_class_reference, get_static_reference, get_object_reference, build_message_expr, finish_message_expr, build_selector_expr, build_ivar_reference, build_keyword_decl, build_method_decl, build_protocol_expr, build_objc_string_object, objc_declare_alias, objc_declare_class, objc_declare_protocols, objc_comptypes, objc_check_decl, build_encode_expr): Remove prototypes. (imp_count, cat_count): Make GGC-aware. (OBJC_SET_TYPE_NAME): New macro. From-SVN: r87168
2004-09-08 02:49:44 +02:00
static hashval_t
string_hash (const void *ptr)
{
tree str = ((struct string_descriptor *)ptr)->literal;
const unsigned char *p = (const unsigned char *) TREE_STRING_POINTER (str);
int i, len = TREE_STRING_LENGTH (str);
hashval_t h = len;
for (i = 0; i < len; i++)
h = ((h * 613) + p[i]);
return h;
}
static int
string_eq (const void *ptr1, const void *ptr2)
{
tree str1 = ((struct string_descriptor *)ptr1)->literal;
tree str2 = ((struct string_descriptor *)ptr2)->literal;
int len1 = TREE_STRING_LENGTH (str1);
return (len1 == TREE_STRING_LENGTH (str2)
&& !memcmp (TREE_STRING_POINTER (str1), TREE_STRING_POINTER (str2),
len1));
}
/* Given a chain of STRING_CST's, build a static instance of
NXConstantString which points at the concatenation of those
strings. We place the string object in the __string_objects
section of the __OBJC segment. The Objective-C runtime will
initialize the isa pointers of the string objects to point at the
NXConstantString class object. */
tree
c-parse.in (primary): Call objc_build_message_expr()... [gcc/ChangeLog] 2004-09-01 Ziemowit Laski <zlaski@apple.com> * c-parse.in (primary): Call objc_build_message_expr(), objc_build_selector_expr(), objc_build_protocol_expr(), objc_build_encode_expr() and objc_build_string_object() instead of build_message_expr(), build_selector_expr(), build_protocol_expr(), build_encode_expr() and build_objc_string_object(), respectively. (component_decl_list2): Call objc_get_class_ivars() instead of get_class_ivars_from_name(). (keyworddecl): Call objc_build_keyword_decl() instead of build_keyword_decl(). (receiver): Call objc_get_class_reference() instead of get_class_reference(). (reswords): Add blank line before @@ifobjc section, for clarity. [gcc/objc/ChangeLog] 2004-09-01 Ziemowit Laski <zlaski@apple.com> * objc-act.c (objc_check_decl): Use OBJC_TYPE_NAME macro instead of TYPE_NAME. (build_objc_string_object): Rename to objc_build_string_object(). (get_class_reference): Rename to objc_get_class_reference(). (get_class_ivars_from_name): Rename to objc_get_class_ivars(). (next_sjlj_build_catch_list, get_super_receiver): Call objc_get_class_reference() instead of get_class_reference(). (build_keyword_decl): Rename to objc_build_keyword_decl(). (build_message_expr): Rename to objc_build_message_expr(). (build_protocol_expr): Rename to objc_build_protocol_expr(). (build_selector_expr): Rename to objc_build_selector_expr(). (build_encode_expr): Rename to objc_build_encode_expr(). * objc-act.h (get_class_ivars_from_name): Rename prototype to objc_get_class_ivars(). (get_class_reference): Rename prototype to objc_get_class_reference(). (build_message_expr): Rename prototype to objc_build_message_expr(). (build_selector_expr): Rename prototype to objc_build_selector_expr(). (build_keyword_decl): Rename prototype to objc_build_keyword_decl(). (build_protocol_expr): Rename prototype to objc_build_prototype_expr(). (build_objc_string_object): Rename prototype to objc_build_string_object(). From-SVN: r86950
2004-09-02 02:36:18 +02:00
objc_build_string_object (tree string)
{
tree initlist, constructor, constant_string_class;
int length;
Makefile.in (c-parse.o): Depend on $(C_COMMON_H). [gcc/ChangeLog] 2004-09-07 Ziemowit Laski <zlaski@apple.com> * Makefile.in (c-parse.o): Depend on $(C_COMMON_H). * c-parse.in: Include c-common.h instead of objc-act.h. (ivar_decl_list, ivar_decls, ivar_decl, ivars, ivar_declarator, myparms, myparm): Remove %type declarations. (methodtype, optparms, OBJC_TYPE_QUAL, objc_quals, objc_qual, objc_typename, objc_try_catch_stmt, optellipsis): Add %type declarations. (objc_inherit_code, objc_public_flag): Remove. (typespec_nonreserved_nonattr): Call objc_get_protocol_qualified_type() instead of get_static_reference() and get_protocol_reference(). (stmt_nocomp): Call grokparm() on @catch parameter. (objcdef): Move semantic action to objc_finish_implementation(). (classdef): Move semantic action to objc_start_class_interface(), objc_continue_interface(), objc_finish_interface(), objc_start_class_implementation(), objc_continue_implementation(), objc_start_category_interface() and objc_start_category_implementation(). (protocoldef): Move semantic actions to objc_start_protocol() and objc_finish_interface(). (ivar_decl_list): Remove nonterminal. (visibility_spec): Move semantic actions to objc_set_visibility(). (ivar_decls): Remove assignment to $$. (ivar_decl): Rephrase in terms of component_decl; call objc_add_instance_variable(). (ivars, ivar_declarator): Remove nonterminals. (opt_semi): New nonterminal. (methodtype): Remove semantic actions. (methoddef): Move semantic actions to objc_set_method_type(), objc_start_method_definition() and objc_finish_method_definition(). (methodproto): Move semantic actions to objc_set_method_type() and objc_add_method_declaration(). (methoddecl): Use objc_typename instead of typename; move semantic actions to objc_build_method_signature(). (optarglist, myxdecls, mydecl, myparms, myparm): Remove nonterminals. (optparmlist): Express in terms of optparms and optellipsis. (optparms, optellipsis, objc_qual, objc_quals, objc_typename): New nonterminals. (keyworddecl): Use objc_typename instead of typename. (rid_to_yy): Mark RID_IN, RID_OUT, RID_INOUT, RID_BYCOPY, RID_BYREF and RID_ONEWAY as returning OBJC_TYPE_QUAL to yyparse(). [gcc/objc/ChangeLog] 2004-09-07 Ziemowit Laski <zlaski@apple.com> * Make-lang.in (objc/objc-parse.o): Depend on $(C_COMMON_H) instead of objc/objc-act.h. (objc/objc-act.o): Depend on $(HASHTAB_H). * objc-act.c: Include hashtab.h; in ObjC++ mode, include cp-tree.h and objcp-decl.h instead of c-tree.h. (build_module_descriptor, get_class_ivars, synth_id_with_class_suffix, error_with_ivar, gen_method_decl, gen_declaration, setup_string_decl, build_protocol_template): Adjust prototypes. (build_module_initializer_routine, start_class, continue_class, finish_class, start_method_def, objc_start_function, start_protocol, build_method_decl, objc_add_method, add_instance_variable, build_ivar_reference, is_ivar, is_private, get_super_receiver, build_selector_table_decl, objc_push_parm, objc_get_parm_info, gen_type_name, gen_type_name_0, start_var_decl, finish_var_decl, create_field_decl): New prototypes. (objc_expand_function_end, comp_method_with_proto, objc_expr_last, gen_declaration_1, gen_declarator, is_complex_decl, adorn_decl, define_decl, create_builtin_decl, gen_declspecs): Remove prototypes. (TYPE_ID): Rename to OBJECT_TYPEDEF_NAME. (CLASS_TYPEDEF_NAME): New. (TAG_EXECCLASS): Change from a global variable to a #define. (TAG_RETURN_STRUCT): Delete. (TAG_GNUINIT): New, holds '__objc_gnu_init' name. (objc_inherit_code, objc_public_flag): New, moved from c-parse.in. (string_descriptor): New struct. (string_htab): New hash table. (string_hash, string_eq): New prototypes. (generate_struct_by_value_array): Call create_field_decl() instead of create_builtin_decl(). (objc_init): Do not initialize objc_ellipsis_node or TAG_EXECCLASS; In ObjC++ mode, call cxx_init() instead of c_objc_common_init(). (objc_finish_file): In ObjC++, call instantiate_pending_templates() and cp_finish_file(). (define_decl, get_static_reference, get_protocol_reference, create_builtin_decl): Remove functions. (objc_start_class_interface, objc_start_category_interface, objc_start_protocol, objc_continue_interface, objc_finish_interface, objc_start_class_implementation, objc_start_category_implementation, objc_continue_implementation, objc_finish_implementation, objc_set_visibility, objc_set_method_type, objc_build_method_signature, objc_add_method_declaration, objc_start_method_definition, objc_add_instance_variable, objc_get_protocol_qualified_type, create_field_decl, start_var_decl, finish_var_decl): New functions. (setup_string_decl): Simplify since it is only called once. (synth_module_prologue): Call build_class_template(); predefine 'id' and 'Class' as typedefs; rename 'temp_type' to 'type'; disable debug hooks for duration of function; fix GNU runtime messenger signatures to correspond to reality; forward-declare '__objc_exec_class' for the GNU runtime; call build_selector_table_decl(); in ObjC++ mode, generate 'extern "C" { ... }' wrappers around synthesized declarations; call build_protocol_template() and build_category_template(). (string_hash, string_eq): New functions. (objc_build_string_object): Check metaclass correctness only once; store string literals in hash table. (objc_build_constructor): Do not convert initializer elements; adjust for ObjC++ impedance mismatch. (build_objc_symtab_template): Call create_field_decl() instead of create_builtin_decl(). (init_objc_symtab): Add missing conversion to initializer element. (build_metadata_decl): Call start_var_decl() instead of define_decl(). (generate_objc_symtab_decl): Do not call build_category_template(); call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(). (build_module_descriptor): Call create_field_decl() instead of grokfield(); call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(); always mark module descriptor as used; move GNU runtime-specific functionality to build_module_initializer_routine(). (build_module_initializer_routine): New function, broken off of build_module_descriptor(). (objc_static_init_needed_p, objc_generate_static_init_call): New functions. (generate_static_references, generate_strings, build_selector_translation_table, generate_descriptor_table, generate_ivars_list, generate_dispatch_table, generate_category): Call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(); build a type directly instead of via groktypename(). (build_selector_reference_decl, build_selector_table_decl, build_class_reference_decl, build_protocol_reference, generate_objc_image_info): Call start_var_decl() instead of build_decl(). (build_selector_reference): For GNU runtime, do not call build_selector_reference_decl(). (build_selector, build_typed_selector_reference): Always convert result to the selector type. (add_objc_string): Cast return value to 'char *'. (build_method_prototype_template, build_selector_template, build_method_template): Use actual selector type for fields pointing to selectors. (finish_objc): For GNU runtime, call build_module_initializer_routine() after build_module_descriptor(). (generate_protocol_list, generate_shared_structures): Call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(); build a type directly instead of via groktypename(). (synth_id_with_class_suffix): Return a string. (get_arg_type_list): For instance methods, use the instance type for 'self'; do not call groktypename_in_parm_context(). (build_objc_string_decl): Squash redeclaration errors in ObjC++. (objc_is_class_name): Use OBJC_TYPE_NAME instead of TYPE_NAME; handle RECORD_TYPEs in ObjC as well as ObjC++. (objc_is_id): New function. (objc_is_object_ptr): Return the canonical type node. (objc_get_class_ivars): Simplify using get_class_ivars(). (get_class_ivars): Remove second parameter; create a fresh copy of the ivar list for each call; do not check for existence of super class. (objc_eh_runtime_type): Mark #ifndef OBJCPLUS. (objc_init_exceptions): When using SJLJ-style exceptions, require the use of '-fobjc-exceptions' flag; do not require it for DWARF-style exceptions. (objc_build_exc_ptr, next_sjlj_build_try_catch_finally): Use objc_object_type instead of objc_id_type. (objc_begin_catch_clause): Convert the incoming PARM_DECL into a VAR_DECL before placing it in the appropriate scope; do not call define_decl(); adjust call to c_begin_compound_stmt(); use objc_object_type instead of objc_id_type. (build_next_objc_exception_stuff): Call create_field_decl() instead of create_builtin_decl(); construct type directly instead of calling groktypename(); use OBJC_VOID_AT_END to mark end of function parameters. (build_private_template): Adjust call to get_class_ivars(); build a type directly instead of via groktypename(). (build_protocol_template, build_method_prototype_list_template, build_method_prototype_template, build_category_template, build_selector_template, build_class_template, build_super_template, build_ivar_template, build_ivar_list_template, build_method_list_template, build_method_template): Call create_field_decl() instead of grokfield(). (objc_method_parm_type): Do not call groktypename(). (generate_descriptor_table): Call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(). (generate_method_descriptors, build_protocol_initializer, generate_dispatch_tables, build_category_initializer, build_shared_structure_initializer): Do not call groktypename(). (generate_protocols): Call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(); do not call groktypename(). (error_with_ivar): Remove last parameter. (check_ivars): Do not iterate ovar CLASS_RAW_IVARS lists in addition to CLASS_IVARS lists; adjust calls to error_with_ivar(). (generate_ivar_lists): Convert one of the initializer elements; do not call groktypename(). (get_arg_type_list, start_method_def, gen_method_def): Account for new representation of variable arguments and '...' in Objective-C methods; add Objective-C++ impedance matching code. (is_objc_type_qualifier): Remove function. (adjust_type_for_id_default): Simplify; there is no longer a need to wade through declspecs. (lookup_interface, start_class, continue_class, finish_class, start_method_def, start_protocol, build_method_decl, objc_add_method, add_instance_variable, build_ivar_reference, is_ivar, is_private, get_super_receiver, objc_build_finally_epilogue): Make into static functions. (receiver_is_class_object): Use new IS_CLASS() macro. (objc_build_message_expr): Tweak ObjC++ message argument handling; call objc_finish_message_expr() instead of finish_message_expr(). (finish_message_expr): Rename to objc_finish_message_expr(); use OBJC_TYPE_NAME and OBJC_SET_TYPE_NAME macros instead of TYPE_NAME. call gen_type_name() instead of gen_declaration(); call objc_is_id() instead of using IS_ID and IS_CLASS; Use objc_class_name instead of calling get_identifier("Class"); handle CONVERT_EXPRs in receiver. (build_objc_method_call, warn_with_method): Do not call groktypename(). (build_ivar_reference): Call convert() instead of clobbering in a type. (hash_init): Initialize string_htab hash table. (add_instance_variable): Simplify parameter list; do not call grokfield(); do not populate CLASS_IVARS list. (start_class): Check for the existence of super class, if one was specified. (continue_class): Use CLASS_RAW_IVARS rather than CLASS_IVARS; do not call build_class_template(); adjust call to get_class_ivars(); call build_decl(), pushdecl() and finish_decl() instead of define_decl(). (finish_class): Call build_decl(), pushdecl() and finish_decl() instead of define_decl(). (add_protocols): Use PROTOCOL_BINFO_ELTS for the tree vector size. (start_protocol): Do not call build_protocol_template(); use PROTOCOL_BINFO_ELTS for the tree vector size. (encode_type_qualifiers): Do not handle the 'const' qualifier here. (encode_pointer): Encode 'const char *' as 'r*', for backwards compatibility. (encode_array): Use HOST_WIDE_INT_PRINT_DEC instead of "%ld". (encode_type): Handle the 'const' qualifier here. (objc_parmlist): New global variable, sued by objc_push_parm and objc_get_parm_info(). (objc_push_parm, objc_get_parm_info): New functions. (objc_expr_last): Remove function. (synth_self_and_ucmd_args): For instance methods, use the instance type for 'self'; call objc_push_parm() instead of push_parm_decl(). (start_method_def): Do not call push_scope(), declare_parm_level(), pop_scope(), push_parm_decl(), store_parm_decls() or objc_expr_last(); just use objc_push_parm() and objc_get_parm_info(). (comp_method_with_proto): Remove function. (objc_types_are_equivalent): Strip away indirections before comparing underlying types. (comp_proto_with_proto): Do not call groktypename(); types are no longer in raw declspec format. (objc_start_function): New function. (really_start_method): Call comp_proto_with_proto() instead of comp_method_with_proto(); call objc_start_function() instead of hand-crafting a function declarator. (continue_method_def, objc_expand_function_end): Remove functions. (get_super_receiver): Call objc_get_current_scope() instead of get_current_scope(); reference 'super_class' field (instead of 'class'). (finish_method_def): Rename to objc_finish_method_definition() and add a function decl parameter; move method encoding call from objc_expand_function_end(). (is_complex_decl, adorn_decl, gen_declarator, gen_declspecs, gen_declaration_1): Remove functions. (tmpbuf, RAW_DECLSPEC): Remove. (gen_declaration): Remove second parameter; simplify to deal with TYPE_P nodes instead of raw declspecs. (gen_type_name, gen_type_name_0): New functions. (gen_method_decl): Remove second parameter; call gen_type_name() instead of gen_declaration_1(). (dump_interface): Adjust calls to gen_declaration() and gen_method_decl(); do not allocate a separate string buffer. (init_objc): Allocate a larger string buffer to accommodate dump_interface(); adjust call to build_module_descriptor(); add call to build_module_initializer_routine() for the GNU runtime. (generate_classref_translation_entry): Do not call start_decl(); call finish_var_decl() instead of finish_decl(); call convert() instead of build_c_cast(). * objc-act.h (CLASS_OWN_IVARS): Remove accessor. (CLASS_BINFO_ELTS): Reduce from 6 to 5, now that CLASS_OWN_IVARS is gone. (OCTI_GNU_INIT_DECL, GNU_INIT_decl): New. (OCTI_ELLIPSIS_NODE, objc_ellipsis_node): Remove. (OCTI_ID_ID, id_type, objc_id_id): Rename to OCTI_ID_NAME, objc_object_type and objc_object_name, respectively. (OCTI_CLS_REF, OCTI_CLASS_NAME, objc_class_reference, objc_class_name): New. (IS_CLASS): New macro. (IS_ID, IS_SUPER): Robustify. (OCTI_EXECCLASS_DECL, execclass_decl): New. (finish_file, start_class, continue_class, finish_class, start_method_def, continue_method_def, finish_method_def, start_protocol, finish_protocol, objc_build_throw_stmt, objc_build_try_catch_finally_stmt, objc_build_synchronized_prologue, objc_build_synchronized_epilogue, objc_build_try_prologue, objc_build_try_epilogue, objc_build_catch_stmt, objc_build_catch_epilogue, objc_build_finally_prologue, objc_build_finally_epilogue, is_ivar, is_private, is_public, add_instance_variable, objc_add_method, get_super_receiver, objc_clear_super_receiver, get_class_ivars_from_name, get_class_reference, get_static_reference, get_object_reference, build_message_expr, finish_message_expr, build_selector_expr, build_ivar_reference, build_keyword_decl, build_method_decl, build_protocol_expr, build_objc_string_object, objc_declare_alias, objc_declare_class, objc_declare_protocols, objc_comptypes, objc_check_decl, build_encode_expr): Remove prototypes. (imp_count, cat_count): Make GGC-aware. (OBJC_SET_TYPE_NAME): New macro. From-SVN: r87168
2004-09-08 02:49:44 +02:00
tree fields, addr;
struct string_descriptor *desc, key;
void **loc;
Makefile.in (c-parse.o): Depend on $(C_COMMON_H). [gcc/ChangeLog] 2004-09-07 Ziemowit Laski <zlaski@apple.com> * Makefile.in (c-parse.o): Depend on $(C_COMMON_H). * c-parse.in: Include c-common.h instead of objc-act.h. (ivar_decl_list, ivar_decls, ivar_decl, ivars, ivar_declarator, myparms, myparm): Remove %type declarations. (methodtype, optparms, OBJC_TYPE_QUAL, objc_quals, objc_qual, objc_typename, objc_try_catch_stmt, optellipsis): Add %type declarations. (objc_inherit_code, objc_public_flag): Remove. (typespec_nonreserved_nonattr): Call objc_get_protocol_qualified_type() instead of get_static_reference() and get_protocol_reference(). (stmt_nocomp): Call grokparm() on @catch parameter. (objcdef): Move semantic action to objc_finish_implementation(). (classdef): Move semantic action to objc_start_class_interface(), objc_continue_interface(), objc_finish_interface(), objc_start_class_implementation(), objc_continue_implementation(), objc_start_category_interface() and objc_start_category_implementation(). (protocoldef): Move semantic actions to objc_start_protocol() and objc_finish_interface(). (ivar_decl_list): Remove nonterminal. (visibility_spec): Move semantic actions to objc_set_visibility(). (ivar_decls): Remove assignment to $$. (ivar_decl): Rephrase in terms of component_decl; call objc_add_instance_variable(). (ivars, ivar_declarator): Remove nonterminals. (opt_semi): New nonterminal. (methodtype): Remove semantic actions. (methoddef): Move semantic actions to objc_set_method_type(), objc_start_method_definition() and objc_finish_method_definition(). (methodproto): Move semantic actions to objc_set_method_type() and objc_add_method_declaration(). (methoddecl): Use objc_typename instead of typename; move semantic actions to objc_build_method_signature(). (optarglist, myxdecls, mydecl, myparms, myparm): Remove nonterminals. (optparmlist): Express in terms of optparms and optellipsis. (optparms, optellipsis, objc_qual, objc_quals, objc_typename): New nonterminals. (keyworddecl): Use objc_typename instead of typename. (rid_to_yy): Mark RID_IN, RID_OUT, RID_INOUT, RID_BYCOPY, RID_BYREF and RID_ONEWAY as returning OBJC_TYPE_QUAL to yyparse(). [gcc/objc/ChangeLog] 2004-09-07 Ziemowit Laski <zlaski@apple.com> * Make-lang.in (objc/objc-parse.o): Depend on $(C_COMMON_H) instead of objc/objc-act.h. (objc/objc-act.o): Depend on $(HASHTAB_H). * objc-act.c: Include hashtab.h; in ObjC++ mode, include cp-tree.h and objcp-decl.h instead of c-tree.h. (build_module_descriptor, get_class_ivars, synth_id_with_class_suffix, error_with_ivar, gen_method_decl, gen_declaration, setup_string_decl, build_protocol_template): Adjust prototypes. (build_module_initializer_routine, start_class, continue_class, finish_class, start_method_def, objc_start_function, start_protocol, build_method_decl, objc_add_method, add_instance_variable, build_ivar_reference, is_ivar, is_private, get_super_receiver, build_selector_table_decl, objc_push_parm, objc_get_parm_info, gen_type_name, gen_type_name_0, start_var_decl, finish_var_decl, create_field_decl): New prototypes. (objc_expand_function_end, comp_method_with_proto, objc_expr_last, gen_declaration_1, gen_declarator, is_complex_decl, adorn_decl, define_decl, create_builtin_decl, gen_declspecs): Remove prototypes. (TYPE_ID): Rename to OBJECT_TYPEDEF_NAME. (CLASS_TYPEDEF_NAME): New. (TAG_EXECCLASS): Change from a global variable to a #define. (TAG_RETURN_STRUCT): Delete. (TAG_GNUINIT): New, holds '__objc_gnu_init' name. (objc_inherit_code, objc_public_flag): New, moved from c-parse.in. (string_descriptor): New struct. (string_htab): New hash table. (string_hash, string_eq): New prototypes. (generate_struct_by_value_array): Call create_field_decl() instead of create_builtin_decl(). (objc_init): Do not initialize objc_ellipsis_node or TAG_EXECCLASS; In ObjC++ mode, call cxx_init() instead of c_objc_common_init(). (objc_finish_file): In ObjC++, call instantiate_pending_templates() and cp_finish_file(). (define_decl, get_static_reference, get_protocol_reference, create_builtin_decl): Remove functions. (objc_start_class_interface, objc_start_category_interface, objc_start_protocol, objc_continue_interface, objc_finish_interface, objc_start_class_implementation, objc_start_category_implementation, objc_continue_implementation, objc_finish_implementation, objc_set_visibility, objc_set_method_type, objc_build_method_signature, objc_add_method_declaration, objc_start_method_definition, objc_add_instance_variable, objc_get_protocol_qualified_type, create_field_decl, start_var_decl, finish_var_decl): New functions. (setup_string_decl): Simplify since it is only called once. (synth_module_prologue): Call build_class_template(); predefine 'id' and 'Class' as typedefs; rename 'temp_type' to 'type'; disable debug hooks for duration of function; fix GNU runtime messenger signatures to correspond to reality; forward-declare '__objc_exec_class' for the GNU runtime; call build_selector_table_decl(); in ObjC++ mode, generate 'extern "C" { ... }' wrappers around synthesized declarations; call build_protocol_template() and build_category_template(). (string_hash, string_eq): New functions. (objc_build_string_object): Check metaclass correctness only once; store string literals in hash table. (objc_build_constructor): Do not convert initializer elements; adjust for ObjC++ impedance mismatch. (build_objc_symtab_template): Call create_field_decl() instead of create_builtin_decl(). (init_objc_symtab): Add missing conversion to initializer element. (build_metadata_decl): Call start_var_decl() instead of define_decl(). (generate_objc_symtab_decl): Do not call build_category_template(); call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(). (build_module_descriptor): Call create_field_decl() instead of grokfield(); call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(); always mark module descriptor as used; move GNU runtime-specific functionality to build_module_initializer_routine(). (build_module_initializer_routine): New function, broken off of build_module_descriptor(). (objc_static_init_needed_p, objc_generate_static_init_call): New functions. (generate_static_references, generate_strings, build_selector_translation_table, generate_descriptor_table, generate_ivars_list, generate_dispatch_table, generate_category): Call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(); build a type directly instead of via groktypename(). (build_selector_reference_decl, build_selector_table_decl, build_class_reference_decl, build_protocol_reference, generate_objc_image_info): Call start_var_decl() instead of build_decl(). (build_selector_reference): For GNU runtime, do not call build_selector_reference_decl(). (build_selector, build_typed_selector_reference): Always convert result to the selector type. (add_objc_string): Cast return value to 'char *'. (build_method_prototype_template, build_selector_template, build_method_template): Use actual selector type for fields pointing to selectors. (finish_objc): For GNU runtime, call build_module_initializer_routine() after build_module_descriptor(). (generate_protocol_list, generate_shared_structures): Call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(); build a type directly instead of via groktypename(). (synth_id_with_class_suffix): Return a string. (get_arg_type_list): For instance methods, use the instance type for 'self'; do not call groktypename_in_parm_context(). (build_objc_string_decl): Squash redeclaration errors in ObjC++. (objc_is_class_name): Use OBJC_TYPE_NAME instead of TYPE_NAME; handle RECORD_TYPEs in ObjC as well as ObjC++. (objc_is_id): New function. (objc_is_object_ptr): Return the canonical type node. (objc_get_class_ivars): Simplify using get_class_ivars(). (get_class_ivars): Remove second parameter; create a fresh copy of the ivar list for each call; do not check for existence of super class. (objc_eh_runtime_type): Mark #ifndef OBJCPLUS. (objc_init_exceptions): When using SJLJ-style exceptions, require the use of '-fobjc-exceptions' flag; do not require it for DWARF-style exceptions. (objc_build_exc_ptr, next_sjlj_build_try_catch_finally): Use objc_object_type instead of objc_id_type. (objc_begin_catch_clause): Convert the incoming PARM_DECL into a VAR_DECL before placing it in the appropriate scope; do not call define_decl(); adjust call to c_begin_compound_stmt(); use objc_object_type instead of objc_id_type. (build_next_objc_exception_stuff): Call create_field_decl() instead of create_builtin_decl(); construct type directly instead of calling groktypename(); use OBJC_VOID_AT_END to mark end of function parameters. (build_private_template): Adjust call to get_class_ivars(); build a type directly instead of via groktypename(). (build_protocol_template, build_method_prototype_list_template, build_method_prototype_template, build_category_template, build_selector_template, build_class_template, build_super_template, build_ivar_template, build_ivar_list_template, build_method_list_template, build_method_template): Call create_field_decl() instead of grokfield(). (objc_method_parm_type): Do not call groktypename(). (generate_descriptor_table): Call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(). (generate_method_descriptors, build_protocol_initializer, generate_dispatch_tables, build_category_initializer, build_shared_structure_initializer): Do not call groktypename(). (generate_protocols): Call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(); do not call groktypename(). (error_with_ivar): Remove last parameter. (check_ivars): Do not iterate ovar CLASS_RAW_IVARS lists in addition to CLASS_IVARS lists; adjust calls to error_with_ivar(). (generate_ivar_lists): Convert one of the initializer elements; do not call groktypename(). (get_arg_type_list, start_method_def, gen_method_def): Account for new representation of variable arguments and '...' in Objective-C methods; add Objective-C++ impedance matching code. (is_objc_type_qualifier): Remove function. (adjust_type_for_id_default): Simplify; there is no longer a need to wade through declspecs. (lookup_interface, start_class, continue_class, finish_class, start_method_def, start_protocol, build_method_decl, objc_add_method, add_instance_variable, build_ivar_reference, is_ivar, is_private, get_super_receiver, objc_build_finally_epilogue): Make into static functions. (receiver_is_class_object): Use new IS_CLASS() macro. (objc_build_message_expr): Tweak ObjC++ message argument handling; call objc_finish_message_expr() instead of finish_message_expr(). (finish_message_expr): Rename to objc_finish_message_expr(); use OBJC_TYPE_NAME and OBJC_SET_TYPE_NAME macros instead of TYPE_NAME. call gen_type_name() instead of gen_declaration(); call objc_is_id() instead of using IS_ID and IS_CLASS; Use objc_class_name instead of calling get_identifier("Class"); handle CONVERT_EXPRs in receiver. (build_objc_method_call, warn_with_method): Do not call groktypename(). (build_ivar_reference): Call convert() instead of clobbering in a type. (hash_init): Initialize string_htab hash table. (add_instance_variable): Simplify parameter list; do not call grokfield(); do not populate CLASS_IVARS list. (start_class): Check for the existence of super class, if one was specified. (continue_class): Use CLASS_RAW_IVARS rather than CLASS_IVARS; do not call build_class_template(); adjust call to get_class_ivars(); call build_decl(), pushdecl() and finish_decl() instead of define_decl(). (finish_class): Call build_decl(), pushdecl() and finish_decl() instead of define_decl(). (add_protocols): Use PROTOCOL_BINFO_ELTS for the tree vector size. (start_protocol): Do not call build_protocol_template(); use PROTOCOL_BINFO_ELTS for the tree vector size. (encode_type_qualifiers): Do not handle the 'const' qualifier here. (encode_pointer): Encode 'const char *' as 'r*', for backwards compatibility. (encode_array): Use HOST_WIDE_INT_PRINT_DEC instead of "%ld". (encode_type): Handle the 'const' qualifier here. (objc_parmlist): New global variable, sued by objc_push_parm and objc_get_parm_info(). (objc_push_parm, objc_get_parm_info): New functions. (objc_expr_last): Remove function. (synth_self_and_ucmd_args): For instance methods, use the instance type for 'self'; call objc_push_parm() instead of push_parm_decl(). (start_method_def): Do not call push_scope(), declare_parm_level(), pop_scope(), push_parm_decl(), store_parm_decls() or objc_expr_last(); just use objc_push_parm() and objc_get_parm_info(). (comp_method_with_proto): Remove function. (objc_types_are_equivalent): Strip away indirections before comparing underlying types. (comp_proto_with_proto): Do not call groktypename(); types are no longer in raw declspec format. (objc_start_function): New function. (really_start_method): Call comp_proto_with_proto() instead of comp_method_with_proto(); call objc_start_function() instead of hand-crafting a function declarator. (continue_method_def, objc_expand_function_end): Remove functions. (get_super_receiver): Call objc_get_current_scope() instead of get_current_scope(); reference 'super_class' field (instead of 'class'). (finish_method_def): Rename to objc_finish_method_definition() and add a function decl parameter; move method encoding call from objc_expand_function_end(). (is_complex_decl, adorn_decl, gen_declarator, gen_declspecs, gen_declaration_1): Remove functions. (tmpbuf, RAW_DECLSPEC): Remove. (gen_declaration): Remove second parameter; simplify to deal with TYPE_P nodes instead of raw declspecs. (gen_type_name, gen_type_name_0): New functions. (gen_method_decl): Remove second parameter; call gen_type_name() instead of gen_declaration_1(). (dump_interface): Adjust calls to gen_declaration() and gen_method_decl(); do not allocate a separate string buffer. (init_objc): Allocate a larger string buffer to accommodate dump_interface(); adjust call to build_module_descriptor(); add call to build_module_initializer_routine() for the GNU runtime. (generate_classref_translation_entry): Do not call start_decl(); call finish_var_decl() instead of finish_decl(); call convert() instead of build_c_cast(). * objc-act.h (CLASS_OWN_IVARS): Remove accessor. (CLASS_BINFO_ELTS): Reduce from 6 to 5, now that CLASS_OWN_IVARS is gone. (OCTI_GNU_INIT_DECL, GNU_INIT_decl): New. (OCTI_ELLIPSIS_NODE, objc_ellipsis_node): Remove. (OCTI_ID_ID, id_type, objc_id_id): Rename to OCTI_ID_NAME, objc_object_type and objc_object_name, respectively. (OCTI_CLS_REF, OCTI_CLASS_NAME, objc_class_reference, objc_class_name): New. (IS_CLASS): New macro. (IS_ID, IS_SUPER): Robustify. (OCTI_EXECCLASS_DECL, execclass_decl): New. (finish_file, start_class, continue_class, finish_class, start_method_def, continue_method_def, finish_method_def, start_protocol, finish_protocol, objc_build_throw_stmt, objc_build_try_catch_finally_stmt, objc_build_synchronized_prologue, objc_build_synchronized_epilogue, objc_build_try_prologue, objc_build_try_epilogue, objc_build_catch_stmt, objc_build_catch_epilogue, objc_build_finally_prologue, objc_build_finally_epilogue, is_ivar, is_private, is_public, add_instance_variable, objc_add_method, get_super_receiver, objc_clear_super_receiver, get_class_ivars_from_name, get_class_reference, get_static_reference, get_object_reference, build_message_expr, finish_message_expr, build_selector_expr, build_ivar_reference, build_keyword_decl, build_method_decl, build_protocol_expr, build_objc_string_object, objc_declare_alias, objc_declare_class, objc_declare_protocols, objc_comptypes, objc_check_decl, build_encode_expr): Remove prototypes. (imp_count, cat_count): Make GGC-aware. (OBJC_SET_TYPE_NAME): New macro. From-SVN: r87168
2004-09-08 02:49:44 +02:00
/* Prep the string argument. */
string = fix_string_type (string);
TREE_SET_CODE (string, STRING_CST);
length = TREE_STRING_LENGTH (string) - 1;
Makefile.in (c-parse.o): Depend on $(C_COMMON_H). [gcc/ChangeLog] 2004-09-07 Ziemowit Laski <zlaski@apple.com> * Makefile.in (c-parse.o): Depend on $(C_COMMON_H). * c-parse.in: Include c-common.h instead of objc-act.h. (ivar_decl_list, ivar_decls, ivar_decl, ivars, ivar_declarator, myparms, myparm): Remove %type declarations. (methodtype, optparms, OBJC_TYPE_QUAL, objc_quals, objc_qual, objc_typename, objc_try_catch_stmt, optellipsis): Add %type declarations. (objc_inherit_code, objc_public_flag): Remove. (typespec_nonreserved_nonattr): Call objc_get_protocol_qualified_type() instead of get_static_reference() and get_protocol_reference(). (stmt_nocomp): Call grokparm() on @catch parameter. (objcdef): Move semantic action to objc_finish_implementation(). (classdef): Move semantic action to objc_start_class_interface(), objc_continue_interface(), objc_finish_interface(), objc_start_class_implementation(), objc_continue_implementation(), objc_start_category_interface() and objc_start_category_implementation(). (protocoldef): Move semantic actions to objc_start_protocol() and objc_finish_interface(). (ivar_decl_list): Remove nonterminal. (visibility_spec): Move semantic actions to objc_set_visibility(). (ivar_decls): Remove assignment to $$. (ivar_decl): Rephrase in terms of component_decl; call objc_add_instance_variable(). (ivars, ivar_declarator): Remove nonterminals. (opt_semi): New nonterminal. (methodtype): Remove semantic actions. (methoddef): Move semantic actions to objc_set_method_type(), objc_start_method_definition() and objc_finish_method_definition(). (methodproto): Move semantic actions to objc_set_method_type() and objc_add_method_declaration(). (methoddecl): Use objc_typename instead of typename; move semantic actions to objc_build_method_signature(). (optarglist, myxdecls, mydecl, myparms, myparm): Remove nonterminals. (optparmlist): Express in terms of optparms and optellipsis. (optparms, optellipsis, objc_qual, objc_quals, objc_typename): New nonterminals. (keyworddecl): Use objc_typename instead of typename. (rid_to_yy): Mark RID_IN, RID_OUT, RID_INOUT, RID_BYCOPY, RID_BYREF and RID_ONEWAY as returning OBJC_TYPE_QUAL to yyparse(). [gcc/objc/ChangeLog] 2004-09-07 Ziemowit Laski <zlaski@apple.com> * Make-lang.in (objc/objc-parse.o): Depend on $(C_COMMON_H) instead of objc/objc-act.h. (objc/objc-act.o): Depend on $(HASHTAB_H). * objc-act.c: Include hashtab.h; in ObjC++ mode, include cp-tree.h and objcp-decl.h instead of c-tree.h. (build_module_descriptor, get_class_ivars, synth_id_with_class_suffix, error_with_ivar, gen_method_decl, gen_declaration, setup_string_decl, build_protocol_template): Adjust prototypes. (build_module_initializer_routine, start_class, continue_class, finish_class, start_method_def, objc_start_function, start_protocol, build_method_decl, objc_add_method, add_instance_variable, build_ivar_reference, is_ivar, is_private, get_super_receiver, build_selector_table_decl, objc_push_parm, objc_get_parm_info, gen_type_name, gen_type_name_0, start_var_decl, finish_var_decl, create_field_decl): New prototypes. (objc_expand_function_end, comp_method_with_proto, objc_expr_last, gen_declaration_1, gen_declarator, is_complex_decl, adorn_decl, define_decl, create_builtin_decl, gen_declspecs): Remove prototypes. (TYPE_ID): Rename to OBJECT_TYPEDEF_NAME. (CLASS_TYPEDEF_NAME): New. (TAG_EXECCLASS): Change from a global variable to a #define. (TAG_RETURN_STRUCT): Delete. (TAG_GNUINIT): New, holds '__objc_gnu_init' name. (objc_inherit_code, objc_public_flag): New, moved from c-parse.in. (string_descriptor): New struct. (string_htab): New hash table. (string_hash, string_eq): New prototypes. (generate_struct_by_value_array): Call create_field_decl() instead of create_builtin_decl(). (objc_init): Do not initialize objc_ellipsis_node or TAG_EXECCLASS; In ObjC++ mode, call cxx_init() instead of c_objc_common_init(). (objc_finish_file): In ObjC++, call instantiate_pending_templates() and cp_finish_file(). (define_decl, get_static_reference, get_protocol_reference, create_builtin_decl): Remove functions. (objc_start_class_interface, objc_start_category_interface, objc_start_protocol, objc_continue_interface, objc_finish_interface, objc_start_class_implementation, objc_start_category_implementation, objc_continue_implementation, objc_finish_implementation, objc_set_visibility, objc_set_method_type, objc_build_method_signature, objc_add_method_declaration, objc_start_method_definition, objc_add_instance_variable, objc_get_protocol_qualified_type, create_field_decl, start_var_decl, finish_var_decl): New functions. (setup_string_decl): Simplify since it is only called once. (synth_module_prologue): Call build_class_template(); predefine 'id' and 'Class' as typedefs; rename 'temp_type' to 'type'; disable debug hooks for duration of function; fix GNU runtime messenger signatures to correspond to reality; forward-declare '__objc_exec_class' for the GNU runtime; call build_selector_table_decl(); in ObjC++ mode, generate 'extern "C" { ... }' wrappers around synthesized declarations; call build_protocol_template() and build_category_template(). (string_hash, string_eq): New functions. (objc_build_string_object): Check metaclass correctness only once; store string literals in hash table. (objc_build_constructor): Do not convert initializer elements; adjust for ObjC++ impedance mismatch. (build_objc_symtab_template): Call create_field_decl() instead of create_builtin_decl(). (init_objc_symtab): Add missing conversion to initializer element. (build_metadata_decl): Call start_var_decl() instead of define_decl(). (generate_objc_symtab_decl): Do not call build_category_template(); call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(). (build_module_descriptor): Call create_field_decl() instead of grokfield(); call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(); always mark module descriptor as used; move GNU runtime-specific functionality to build_module_initializer_routine(). (build_module_initializer_routine): New function, broken off of build_module_descriptor(). (objc_static_init_needed_p, objc_generate_static_init_call): New functions. (generate_static_references, generate_strings, build_selector_translation_table, generate_descriptor_table, generate_ivars_list, generate_dispatch_table, generate_category): Call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(); build a type directly instead of via groktypename(). (build_selector_reference_decl, build_selector_table_decl, build_class_reference_decl, build_protocol_reference, generate_objc_image_info): Call start_var_decl() instead of build_decl(). (build_selector_reference): For GNU runtime, do not call build_selector_reference_decl(). (build_selector, build_typed_selector_reference): Always convert result to the selector type. (add_objc_string): Cast return value to 'char *'. (build_method_prototype_template, build_selector_template, build_method_template): Use actual selector type for fields pointing to selectors. (finish_objc): For GNU runtime, call build_module_initializer_routine() after build_module_descriptor(). (generate_protocol_list, generate_shared_structures): Call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(); build a type directly instead of via groktypename(). (synth_id_with_class_suffix): Return a string. (get_arg_type_list): For instance methods, use the instance type for 'self'; do not call groktypename_in_parm_context(). (build_objc_string_decl): Squash redeclaration errors in ObjC++. (objc_is_class_name): Use OBJC_TYPE_NAME instead of TYPE_NAME; handle RECORD_TYPEs in ObjC as well as ObjC++. (objc_is_id): New function. (objc_is_object_ptr): Return the canonical type node. (objc_get_class_ivars): Simplify using get_class_ivars(). (get_class_ivars): Remove second parameter; create a fresh copy of the ivar list for each call; do not check for existence of super class. (objc_eh_runtime_type): Mark #ifndef OBJCPLUS. (objc_init_exceptions): When using SJLJ-style exceptions, require the use of '-fobjc-exceptions' flag; do not require it for DWARF-style exceptions. (objc_build_exc_ptr, next_sjlj_build_try_catch_finally): Use objc_object_type instead of objc_id_type. (objc_begin_catch_clause): Convert the incoming PARM_DECL into a VAR_DECL before placing it in the appropriate scope; do not call define_decl(); adjust call to c_begin_compound_stmt(); use objc_object_type instead of objc_id_type. (build_next_objc_exception_stuff): Call create_field_decl() instead of create_builtin_decl(); construct type directly instead of calling groktypename(); use OBJC_VOID_AT_END to mark end of function parameters. (build_private_template): Adjust call to get_class_ivars(); build a type directly instead of via groktypename(). (build_protocol_template, build_method_prototype_list_template, build_method_prototype_template, build_category_template, build_selector_template, build_class_template, build_super_template, build_ivar_template, build_ivar_list_template, build_method_list_template, build_method_template): Call create_field_decl() instead of grokfield(). (objc_method_parm_type): Do not call groktypename(). (generate_descriptor_table): Call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(). (generate_method_descriptors, build_protocol_initializer, generate_dispatch_tables, build_category_initializer, build_shared_structure_initializer): Do not call groktypename(). (generate_protocols): Call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(); do not call groktypename(). (error_with_ivar): Remove last parameter. (check_ivars): Do not iterate ovar CLASS_RAW_IVARS lists in addition to CLASS_IVARS lists; adjust calls to error_with_ivar(). (generate_ivar_lists): Convert one of the initializer elements; do not call groktypename(). (get_arg_type_list, start_method_def, gen_method_def): Account for new representation of variable arguments and '...' in Objective-C methods; add Objective-C++ impedance matching code. (is_objc_type_qualifier): Remove function. (adjust_type_for_id_default): Simplify; there is no longer a need to wade through declspecs. (lookup_interface, start_class, continue_class, finish_class, start_method_def, start_protocol, build_method_decl, objc_add_method, add_instance_variable, build_ivar_reference, is_ivar, is_private, get_super_receiver, objc_build_finally_epilogue): Make into static functions. (receiver_is_class_object): Use new IS_CLASS() macro. (objc_build_message_expr): Tweak ObjC++ message argument handling; call objc_finish_message_expr() instead of finish_message_expr(). (finish_message_expr): Rename to objc_finish_message_expr(); use OBJC_TYPE_NAME and OBJC_SET_TYPE_NAME macros instead of TYPE_NAME. call gen_type_name() instead of gen_declaration(); call objc_is_id() instead of using IS_ID and IS_CLASS; Use objc_class_name instead of calling get_identifier("Class"); handle CONVERT_EXPRs in receiver. (build_objc_method_call, warn_with_method): Do not call groktypename(). (build_ivar_reference): Call convert() instead of clobbering in a type. (hash_init): Initialize string_htab hash table. (add_instance_variable): Simplify parameter list; do not call grokfield(); do not populate CLASS_IVARS list. (start_class): Check for the existence of super class, if one was specified. (continue_class): Use CLASS_RAW_IVARS rather than CLASS_IVARS; do not call build_class_template(); adjust call to get_class_ivars(); call build_decl(), pushdecl() and finish_decl() instead of define_decl(). (finish_class): Call build_decl(), pushdecl() and finish_decl() instead of define_decl(). (add_protocols): Use PROTOCOL_BINFO_ELTS for the tree vector size. (start_protocol): Do not call build_protocol_template(); use PROTOCOL_BINFO_ELTS for the tree vector size. (encode_type_qualifiers): Do not handle the 'const' qualifier here. (encode_pointer): Encode 'const char *' as 'r*', for backwards compatibility. (encode_array): Use HOST_WIDE_INT_PRINT_DEC instead of "%ld". (encode_type): Handle the 'const' qualifier here. (objc_parmlist): New global variable, sued by objc_push_parm and objc_get_parm_info(). (objc_push_parm, objc_get_parm_info): New functions. (objc_expr_last): Remove function. (synth_self_and_ucmd_args): For instance methods, use the instance type for 'self'; call objc_push_parm() instead of push_parm_decl(). (start_method_def): Do not call push_scope(), declare_parm_level(), pop_scope(), push_parm_decl(), store_parm_decls() or objc_expr_last(); just use objc_push_parm() and objc_get_parm_info(). (comp_method_with_proto): Remove function. (objc_types_are_equivalent): Strip away indirections before comparing underlying types. (comp_proto_with_proto): Do not call groktypename(); types are no longer in raw declspec format. (objc_start_function): New function. (really_start_method): Call comp_proto_with_proto() instead of comp_method_with_proto(); call objc_start_function() instead of hand-crafting a function declarator. (continue_method_def, objc_expand_function_end): Remove functions. (get_super_receiver): Call objc_get_current_scope() instead of get_current_scope(); reference 'super_class' field (instead of 'class'). (finish_method_def): Rename to objc_finish_method_definition() and add a function decl parameter; move method encoding call from objc_expand_function_end(). (is_complex_decl, adorn_decl, gen_declarator, gen_declspecs, gen_declaration_1): Remove functions. (tmpbuf, RAW_DECLSPEC): Remove. (gen_declaration): Remove second parameter; simplify to deal with TYPE_P nodes instead of raw declspecs. (gen_type_name, gen_type_name_0): New functions. (gen_method_decl): Remove second parameter; call gen_type_name() instead of gen_declaration_1(). (dump_interface): Adjust calls to gen_declaration() and gen_method_decl(); do not allocate a separate string buffer. (init_objc): Allocate a larger string buffer to accommodate dump_interface(); adjust call to build_module_descriptor(); add call to build_module_initializer_routine() for the GNU runtime. (generate_classref_translation_entry): Do not call start_decl(); call finish_var_decl() instead of finish_decl(); call convert() instead of build_c_cast(). * objc-act.h (CLASS_OWN_IVARS): Remove accessor. (CLASS_BINFO_ELTS): Reduce from 6 to 5, now that CLASS_OWN_IVARS is gone. (OCTI_GNU_INIT_DECL, GNU_INIT_decl): New. (OCTI_ELLIPSIS_NODE, objc_ellipsis_node): Remove. (OCTI_ID_ID, id_type, objc_id_id): Rename to OCTI_ID_NAME, objc_object_type and objc_object_name, respectively. (OCTI_CLS_REF, OCTI_CLASS_NAME, objc_class_reference, objc_class_name): New. (IS_CLASS): New macro. (IS_ID, IS_SUPER): Robustify. (OCTI_EXECCLASS_DECL, execclass_decl): New. (finish_file, start_class, continue_class, finish_class, start_method_def, continue_method_def, finish_method_def, start_protocol, finish_protocol, objc_build_throw_stmt, objc_build_try_catch_finally_stmt, objc_build_synchronized_prologue, objc_build_synchronized_epilogue, objc_build_try_prologue, objc_build_try_epilogue, objc_build_catch_stmt, objc_build_catch_epilogue, objc_build_finally_prologue, objc_build_finally_epilogue, is_ivar, is_private, is_public, add_instance_variable, objc_add_method, get_super_receiver, objc_clear_super_receiver, get_class_ivars_from_name, get_class_reference, get_static_reference, get_object_reference, build_message_expr, finish_message_expr, build_selector_expr, build_ivar_reference, build_keyword_decl, build_method_decl, build_protocol_expr, build_objc_string_object, objc_declare_alias, objc_declare_class, objc_declare_protocols, objc_comptypes, objc_check_decl, build_encode_expr): Remove prototypes. (imp_count, cat_count): Make GGC-aware. (OBJC_SET_TYPE_NAME): New macro. From-SVN: r87168
2004-09-08 02:49:44 +02:00
/* Check whether the string class being used actually exists and has the
correct ivar layout. */
if (!string_layout_checked)
{
Makefile.in (c-parse.o): Depend on $(C_COMMON_H). [gcc/ChangeLog] 2004-09-07 Ziemowit Laski <zlaski@apple.com> * Makefile.in (c-parse.o): Depend on $(C_COMMON_H). * c-parse.in: Include c-common.h instead of objc-act.h. (ivar_decl_list, ivar_decls, ivar_decl, ivars, ivar_declarator, myparms, myparm): Remove %type declarations. (methodtype, optparms, OBJC_TYPE_QUAL, objc_quals, objc_qual, objc_typename, objc_try_catch_stmt, optellipsis): Add %type declarations. (objc_inherit_code, objc_public_flag): Remove. (typespec_nonreserved_nonattr): Call objc_get_protocol_qualified_type() instead of get_static_reference() and get_protocol_reference(). (stmt_nocomp): Call grokparm() on @catch parameter. (objcdef): Move semantic action to objc_finish_implementation(). (classdef): Move semantic action to objc_start_class_interface(), objc_continue_interface(), objc_finish_interface(), objc_start_class_implementation(), objc_continue_implementation(), objc_start_category_interface() and objc_start_category_implementation(). (protocoldef): Move semantic actions to objc_start_protocol() and objc_finish_interface(). (ivar_decl_list): Remove nonterminal. (visibility_spec): Move semantic actions to objc_set_visibility(). (ivar_decls): Remove assignment to $$. (ivar_decl): Rephrase in terms of component_decl; call objc_add_instance_variable(). (ivars, ivar_declarator): Remove nonterminals. (opt_semi): New nonterminal. (methodtype): Remove semantic actions. (methoddef): Move semantic actions to objc_set_method_type(), objc_start_method_definition() and objc_finish_method_definition(). (methodproto): Move semantic actions to objc_set_method_type() and objc_add_method_declaration(). (methoddecl): Use objc_typename instead of typename; move semantic actions to objc_build_method_signature(). (optarglist, myxdecls, mydecl, myparms, myparm): Remove nonterminals. (optparmlist): Express in terms of optparms and optellipsis. (optparms, optellipsis, objc_qual, objc_quals, objc_typename): New nonterminals. (keyworddecl): Use objc_typename instead of typename. (rid_to_yy): Mark RID_IN, RID_OUT, RID_INOUT, RID_BYCOPY, RID_BYREF and RID_ONEWAY as returning OBJC_TYPE_QUAL to yyparse(). [gcc/objc/ChangeLog] 2004-09-07 Ziemowit Laski <zlaski@apple.com> * Make-lang.in (objc/objc-parse.o): Depend on $(C_COMMON_H) instead of objc/objc-act.h. (objc/objc-act.o): Depend on $(HASHTAB_H). * objc-act.c: Include hashtab.h; in ObjC++ mode, include cp-tree.h and objcp-decl.h instead of c-tree.h. (build_module_descriptor, get_class_ivars, synth_id_with_class_suffix, error_with_ivar, gen_method_decl, gen_declaration, setup_string_decl, build_protocol_template): Adjust prototypes. (build_module_initializer_routine, start_class, continue_class, finish_class, start_method_def, objc_start_function, start_protocol, build_method_decl, objc_add_method, add_instance_variable, build_ivar_reference, is_ivar, is_private, get_super_receiver, build_selector_table_decl, objc_push_parm, objc_get_parm_info, gen_type_name, gen_type_name_0, start_var_decl, finish_var_decl, create_field_decl): New prototypes. (objc_expand_function_end, comp_method_with_proto, objc_expr_last, gen_declaration_1, gen_declarator, is_complex_decl, adorn_decl, define_decl, create_builtin_decl, gen_declspecs): Remove prototypes. (TYPE_ID): Rename to OBJECT_TYPEDEF_NAME. (CLASS_TYPEDEF_NAME): New. (TAG_EXECCLASS): Change from a global variable to a #define. (TAG_RETURN_STRUCT): Delete. (TAG_GNUINIT): New, holds '__objc_gnu_init' name. (objc_inherit_code, objc_public_flag): New, moved from c-parse.in. (string_descriptor): New struct. (string_htab): New hash table. (string_hash, string_eq): New prototypes. (generate_struct_by_value_array): Call create_field_decl() instead of create_builtin_decl(). (objc_init): Do not initialize objc_ellipsis_node or TAG_EXECCLASS; In ObjC++ mode, call cxx_init() instead of c_objc_common_init(). (objc_finish_file): In ObjC++, call instantiate_pending_templates() and cp_finish_file(). (define_decl, get_static_reference, get_protocol_reference, create_builtin_decl): Remove functions. (objc_start_class_interface, objc_start_category_interface, objc_start_protocol, objc_continue_interface, objc_finish_interface, objc_start_class_implementation, objc_start_category_implementation, objc_continue_implementation, objc_finish_implementation, objc_set_visibility, objc_set_method_type, objc_build_method_signature, objc_add_method_declaration, objc_start_method_definition, objc_add_instance_variable, objc_get_protocol_qualified_type, create_field_decl, start_var_decl, finish_var_decl): New functions. (setup_string_decl): Simplify since it is only called once. (synth_module_prologue): Call build_class_template(); predefine 'id' and 'Class' as typedefs; rename 'temp_type' to 'type'; disable debug hooks for duration of function; fix GNU runtime messenger signatures to correspond to reality; forward-declare '__objc_exec_class' for the GNU runtime; call build_selector_table_decl(); in ObjC++ mode, generate 'extern "C" { ... }' wrappers around synthesized declarations; call build_protocol_template() and build_category_template(). (string_hash, string_eq): New functions. (objc_build_string_object): Check metaclass correctness only once; store string literals in hash table. (objc_build_constructor): Do not convert initializer elements; adjust for ObjC++ impedance mismatch. (build_objc_symtab_template): Call create_field_decl() instead of create_builtin_decl(). (init_objc_symtab): Add missing conversion to initializer element. (build_metadata_decl): Call start_var_decl() instead of define_decl(). (generate_objc_symtab_decl): Do not call build_category_template(); call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(). (build_module_descriptor): Call create_field_decl() instead of grokfield(); call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(); always mark module descriptor as used; move GNU runtime-specific functionality to build_module_initializer_routine(). (build_module_initializer_routine): New function, broken off of build_module_descriptor(). (objc_static_init_needed_p, objc_generate_static_init_call): New functions. (generate_static_references, generate_strings, build_selector_translation_table, generate_descriptor_table, generate_ivars_list, generate_dispatch_table, generate_category): Call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(); build a type directly instead of via groktypename(). (build_selector_reference_decl, build_selector_table_decl, build_class_reference_decl, build_protocol_reference, generate_objc_image_info): Call start_var_decl() instead of build_decl(). (build_selector_reference): For GNU runtime, do not call build_selector_reference_decl(). (build_selector, build_typed_selector_reference): Always convert result to the selector type. (add_objc_string): Cast return value to 'char *'. (build_method_prototype_template, build_selector_template, build_method_template): Use actual selector type for fields pointing to selectors. (finish_objc): For GNU runtime, call build_module_initializer_routine() after build_module_descriptor(). (generate_protocol_list, generate_shared_structures): Call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(); build a type directly instead of via groktypename(). (synth_id_with_class_suffix): Return a string. (get_arg_type_list): For instance methods, use the instance type for 'self'; do not call groktypename_in_parm_context(). (build_objc_string_decl): Squash redeclaration errors in ObjC++. (objc_is_class_name): Use OBJC_TYPE_NAME instead of TYPE_NAME; handle RECORD_TYPEs in ObjC as well as ObjC++. (objc_is_id): New function. (objc_is_object_ptr): Return the canonical type node. (objc_get_class_ivars): Simplify using get_class_ivars(). (get_class_ivars): Remove second parameter; create a fresh copy of the ivar list for each call; do not check for existence of super class. (objc_eh_runtime_type): Mark #ifndef OBJCPLUS. (objc_init_exceptions): When using SJLJ-style exceptions, require the use of '-fobjc-exceptions' flag; do not require it for DWARF-style exceptions. (objc_build_exc_ptr, next_sjlj_build_try_catch_finally): Use objc_object_type instead of objc_id_type. (objc_begin_catch_clause): Convert the incoming PARM_DECL into a VAR_DECL before placing it in the appropriate scope; do not call define_decl(); adjust call to c_begin_compound_stmt(); use objc_object_type instead of objc_id_type. (build_next_objc_exception_stuff): Call create_field_decl() instead of create_builtin_decl(); construct type directly instead of calling groktypename(); use OBJC_VOID_AT_END to mark end of function parameters. (build_private_template): Adjust call to get_class_ivars(); build a type directly instead of via groktypename(). (build_protocol_template, build_method_prototype_list_template, build_method_prototype_template, build_category_template, build_selector_template, build_class_template, build_super_template, build_ivar_template, build_ivar_list_template, build_method_list_template, build_method_template): Call create_field_decl() instead of grokfield(). (objc_method_parm_type): Do not call groktypename(). (generate_descriptor_table): Call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(). (generate_method_descriptors, build_protocol_initializer, generate_dispatch_tables, build_category_initializer, build_shared_structure_initializer): Do not call groktypename(). (generate_protocols): Call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(); do not call groktypename(). (error_with_ivar): Remove last parameter. (check_ivars): Do not iterate ovar CLASS_RAW_IVARS lists in addition to CLASS_IVARS lists; adjust calls to error_with_ivar(). (generate_ivar_lists): Convert one of the initializer elements; do not call groktypename(). (get_arg_type_list, start_method_def, gen_method_def): Account for new representation of variable arguments and '...' in Objective-C methods; add Objective-C++ impedance matching code. (is_objc_type_qualifier): Remove function. (adjust_type_for_id_default): Simplify; there is no longer a need to wade through declspecs. (lookup_interface, start_class, continue_class, finish_class, start_method_def, start_protocol, build_method_decl, objc_add_method, add_instance_variable, build_ivar_reference, is_ivar, is_private, get_super_receiver, objc_build_finally_epilogue): Make into static functions. (receiver_is_class_object): Use new IS_CLASS() macro. (objc_build_message_expr): Tweak ObjC++ message argument handling; call objc_finish_message_expr() instead of finish_message_expr(). (finish_message_expr): Rename to objc_finish_message_expr(); use OBJC_TYPE_NAME and OBJC_SET_TYPE_NAME macros instead of TYPE_NAME. call gen_type_name() instead of gen_declaration(); call objc_is_id() instead of using IS_ID and IS_CLASS; Use objc_class_name instead of calling get_identifier("Class"); handle CONVERT_EXPRs in receiver. (build_objc_method_call, warn_with_method): Do not call groktypename(). (build_ivar_reference): Call convert() instead of clobbering in a type. (hash_init): Initialize string_htab hash table. (add_instance_variable): Simplify parameter list; do not call grokfield(); do not populate CLASS_IVARS list. (start_class): Check for the existence of super class, if one was specified. (continue_class): Use CLASS_RAW_IVARS rather than CLASS_IVARS; do not call build_class_template(); adjust call to get_class_ivars(); call build_decl(), pushdecl() and finish_decl() instead of define_decl(). (finish_class): Call build_decl(), pushdecl() and finish_decl() instead of define_decl(). (add_protocols): Use PROTOCOL_BINFO_ELTS for the tree vector size. (start_protocol): Do not call build_protocol_template(); use PROTOCOL_BINFO_ELTS for the tree vector size. (encode_type_qualifiers): Do not handle the 'const' qualifier here. (encode_pointer): Encode 'const char *' as 'r*', for backwards compatibility. (encode_array): Use HOST_WIDE_INT_PRINT_DEC instead of "%ld". (encode_type): Handle the 'const' qualifier here. (objc_parmlist): New global variable, sued by objc_push_parm and objc_get_parm_info(). (objc_push_parm, objc_get_parm_info): New functions. (objc_expr_last): Remove function. (synth_self_and_ucmd_args): For instance methods, use the instance type for 'self'; call objc_push_parm() instead of push_parm_decl(). (start_method_def): Do not call push_scope(), declare_parm_level(), pop_scope(), push_parm_decl(), store_parm_decls() or objc_expr_last(); just use objc_push_parm() and objc_get_parm_info(). (comp_method_with_proto): Remove function. (objc_types_are_equivalent): Strip away indirections before comparing underlying types. (comp_proto_with_proto): Do not call groktypename(); types are no longer in raw declspec format. (objc_start_function): New function. (really_start_method): Call comp_proto_with_proto() instead of comp_method_with_proto(); call objc_start_function() instead of hand-crafting a function declarator. (continue_method_def, objc_expand_function_end): Remove functions. (get_super_receiver): Call objc_get_current_scope() instead of get_current_scope(); reference 'super_class' field (instead of 'class'). (finish_method_def): Rename to objc_finish_method_definition() and add a function decl parameter; move method encoding call from objc_expand_function_end(). (is_complex_decl, adorn_decl, gen_declarator, gen_declspecs, gen_declaration_1): Remove functions. (tmpbuf, RAW_DECLSPEC): Remove. (gen_declaration): Remove second parameter; simplify to deal with TYPE_P nodes instead of raw declspecs. (gen_type_name, gen_type_name_0): New functions. (gen_method_decl): Remove second parameter; call gen_type_name() instead of gen_declaration_1(). (dump_interface): Adjust calls to gen_declaration() and gen_method_decl(); do not allocate a separate string buffer. (init_objc): Allocate a larger string buffer to accommodate dump_interface(); adjust call to build_module_descriptor(); add call to build_module_initializer_routine() for the GNU runtime. (generate_classref_translation_entry): Do not call start_decl(); call finish_var_decl() instead of finish_decl(); call convert() instead of build_c_cast(). * objc-act.h (CLASS_OWN_IVARS): Remove accessor. (CLASS_BINFO_ELTS): Reduce from 6 to 5, now that CLASS_OWN_IVARS is gone. (OCTI_GNU_INIT_DECL, GNU_INIT_decl): New. (OCTI_ELLIPSIS_NODE, objc_ellipsis_node): Remove. (OCTI_ID_ID, id_type, objc_id_id): Rename to OCTI_ID_NAME, objc_object_type and objc_object_name, respectively. (OCTI_CLS_REF, OCTI_CLASS_NAME, objc_class_reference, objc_class_name): New. (IS_CLASS): New macro. (IS_ID, IS_SUPER): Robustify. (OCTI_EXECCLASS_DECL, execclass_decl): New. (finish_file, start_class, continue_class, finish_class, start_method_def, continue_method_def, finish_method_def, start_protocol, finish_protocol, objc_build_throw_stmt, objc_build_try_catch_finally_stmt, objc_build_synchronized_prologue, objc_build_synchronized_epilogue, objc_build_try_prologue, objc_build_try_epilogue, objc_build_catch_stmt, objc_build_catch_epilogue, objc_build_finally_prologue, objc_build_finally_epilogue, is_ivar, is_private, is_public, add_instance_variable, objc_add_method, get_super_receiver, objc_clear_super_receiver, get_class_ivars_from_name, get_class_reference, get_static_reference, get_object_reference, build_message_expr, finish_message_expr, build_selector_expr, build_ivar_reference, build_keyword_decl, build_method_decl, build_protocol_expr, build_objc_string_object, objc_declare_alias, objc_declare_class, objc_declare_protocols, objc_comptypes, objc_check_decl, build_encode_expr): Remove prototypes. (imp_count, cat_count): Make GGC-aware. (OBJC_SET_TYPE_NAME): New macro. From-SVN: r87168
2004-09-08 02:49:44 +02:00
string_layout_checked = -1;
constant_string_class = lookup_interface (constant_string_id);
internal_const_str_type = objc_build_internal_const_str_type ();
Makefile.in (c-parse.o): Depend on $(C_COMMON_H). [gcc/ChangeLog] 2004-09-07 Ziemowit Laski <zlaski@apple.com> * Makefile.in (c-parse.o): Depend on $(C_COMMON_H). * c-parse.in: Include c-common.h instead of objc-act.h. (ivar_decl_list, ivar_decls, ivar_decl, ivars, ivar_declarator, myparms, myparm): Remove %type declarations. (methodtype, optparms, OBJC_TYPE_QUAL, objc_quals, objc_qual, objc_typename, objc_try_catch_stmt, optellipsis): Add %type declarations. (objc_inherit_code, objc_public_flag): Remove. (typespec_nonreserved_nonattr): Call objc_get_protocol_qualified_type() instead of get_static_reference() and get_protocol_reference(). (stmt_nocomp): Call grokparm() on @catch parameter. (objcdef): Move semantic action to objc_finish_implementation(). (classdef): Move semantic action to objc_start_class_interface(), objc_continue_interface(), objc_finish_interface(), objc_start_class_implementation(), objc_continue_implementation(), objc_start_category_interface() and objc_start_category_implementation(). (protocoldef): Move semantic actions to objc_start_protocol() and objc_finish_interface(). (ivar_decl_list): Remove nonterminal. (visibility_spec): Move semantic actions to objc_set_visibility(). (ivar_decls): Remove assignment to $$. (ivar_decl): Rephrase in terms of component_decl; call objc_add_instance_variable(). (ivars, ivar_declarator): Remove nonterminals. (opt_semi): New nonterminal. (methodtype): Remove semantic actions. (methoddef): Move semantic actions to objc_set_method_type(), objc_start_method_definition() and objc_finish_method_definition(). (methodproto): Move semantic actions to objc_set_method_type() and objc_add_method_declaration(). (methoddecl): Use objc_typename instead of typename; move semantic actions to objc_build_method_signature(). (optarglist, myxdecls, mydecl, myparms, myparm): Remove nonterminals. (optparmlist): Express in terms of optparms and optellipsis. (optparms, optellipsis, objc_qual, objc_quals, objc_typename): New nonterminals. (keyworddecl): Use objc_typename instead of typename. (rid_to_yy): Mark RID_IN, RID_OUT, RID_INOUT, RID_BYCOPY, RID_BYREF and RID_ONEWAY as returning OBJC_TYPE_QUAL to yyparse(). [gcc/objc/ChangeLog] 2004-09-07 Ziemowit Laski <zlaski@apple.com> * Make-lang.in (objc/objc-parse.o): Depend on $(C_COMMON_H) instead of objc/objc-act.h. (objc/objc-act.o): Depend on $(HASHTAB_H). * objc-act.c: Include hashtab.h; in ObjC++ mode, include cp-tree.h and objcp-decl.h instead of c-tree.h. (build_module_descriptor, get_class_ivars, synth_id_with_class_suffix, error_with_ivar, gen_method_decl, gen_declaration, setup_string_decl, build_protocol_template): Adjust prototypes. (build_module_initializer_routine, start_class, continue_class, finish_class, start_method_def, objc_start_function, start_protocol, build_method_decl, objc_add_method, add_instance_variable, build_ivar_reference, is_ivar, is_private, get_super_receiver, build_selector_table_decl, objc_push_parm, objc_get_parm_info, gen_type_name, gen_type_name_0, start_var_decl, finish_var_decl, create_field_decl): New prototypes. (objc_expand_function_end, comp_method_with_proto, objc_expr_last, gen_declaration_1, gen_declarator, is_complex_decl, adorn_decl, define_decl, create_builtin_decl, gen_declspecs): Remove prototypes. (TYPE_ID): Rename to OBJECT_TYPEDEF_NAME. (CLASS_TYPEDEF_NAME): New. (TAG_EXECCLASS): Change from a global variable to a #define. (TAG_RETURN_STRUCT): Delete. (TAG_GNUINIT): New, holds '__objc_gnu_init' name. (objc_inherit_code, objc_public_flag): New, moved from c-parse.in. (string_descriptor): New struct. (string_htab): New hash table. (string_hash, string_eq): New prototypes. (generate_struct_by_value_array): Call create_field_decl() instead of create_builtin_decl(). (objc_init): Do not initialize objc_ellipsis_node or TAG_EXECCLASS; In ObjC++ mode, call cxx_init() instead of c_objc_common_init(). (objc_finish_file): In ObjC++, call instantiate_pending_templates() and cp_finish_file(). (define_decl, get_static_reference, get_protocol_reference, create_builtin_decl): Remove functions. (objc_start_class_interface, objc_start_category_interface, objc_start_protocol, objc_continue_interface, objc_finish_interface, objc_start_class_implementation, objc_start_category_implementation, objc_continue_implementation, objc_finish_implementation, objc_set_visibility, objc_set_method_type, objc_build_method_signature, objc_add_method_declaration, objc_start_method_definition, objc_add_instance_variable, objc_get_protocol_qualified_type, create_field_decl, start_var_decl, finish_var_decl): New functions. (setup_string_decl): Simplify since it is only called once. (synth_module_prologue): Call build_class_template(); predefine 'id' and 'Class' as typedefs; rename 'temp_type' to 'type'; disable debug hooks for duration of function; fix GNU runtime messenger signatures to correspond to reality; forward-declare '__objc_exec_class' for the GNU runtime; call build_selector_table_decl(); in ObjC++ mode, generate 'extern "C" { ... }' wrappers around synthesized declarations; call build_protocol_template() and build_category_template(). (string_hash, string_eq): New functions. (objc_build_string_object): Check metaclass correctness only once; store string literals in hash table. (objc_build_constructor): Do not convert initializer elements; adjust for ObjC++ impedance mismatch. (build_objc_symtab_template): Call create_field_decl() instead of create_builtin_decl(). (init_objc_symtab): Add missing conversion to initializer element. (build_metadata_decl): Call start_var_decl() instead of define_decl(). (generate_objc_symtab_decl): Do not call build_category_template(); call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(). (build_module_descriptor): Call create_field_decl() instead of grokfield(); call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(); always mark module descriptor as used; move GNU runtime-specific functionality to build_module_initializer_routine(). (build_module_initializer_routine): New function, broken off of build_module_descriptor(). (objc_static_init_needed_p, objc_generate_static_init_call): New functions. (generate_static_references, generate_strings, build_selector_translation_table, generate_descriptor_table, generate_ivars_list, generate_dispatch_table, generate_category): Call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(); build a type directly instead of via groktypename(). (build_selector_reference_decl, build_selector_table_decl, build_class_reference_decl, build_protocol_reference, generate_objc_image_info): Call start_var_decl() instead of build_decl(). (build_selector_reference): For GNU runtime, do not call build_selector_reference_decl(). (build_selector, build_typed_selector_reference): Always convert result to the selector type. (add_objc_string): Cast return value to 'char *'. (build_method_prototype_template, build_selector_template, build_method_template): Use actual selector type for fields pointing to selectors. (finish_objc): For GNU runtime, call build_module_initializer_routine() after build_module_descriptor(). (generate_protocol_list, generate_shared_structures): Call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(); build a type directly instead of via groktypename(). (synth_id_with_class_suffix): Return a string. (get_arg_type_list): For instance methods, use the instance type for 'self'; do not call groktypename_in_parm_context(). (build_objc_string_decl): Squash redeclaration errors in ObjC++. (objc_is_class_name): Use OBJC_TYPE_NAME instead of TYPE_NAME; handle RECORD_TYPEs in ObjC as well as ObjC++. (objc_is_id): New function. (objc_is_object_ptr): Return the canonical type node. (objc_get_class_ivars): Simplify using get_class_ivars(). (get_class_ivars): Remove second parameter; create a fresh copy of the ivar list for each call; do not check for existence of super class. (objc_eh_runtime_type): Mark #ifndef OBJCPLUS. (objc_init_exceptions): When using SJLJ-style exceptions, require the use of '-fobjc-exceptions' flag; do not require it for DWARF-style exceptions. (objc_build_exc_ptr, next_sjlj_build_try_catch_finally): Use objc_object_type instead of objc_id_type. (objc_begin_catch_clause): Convert the incoming PARM_DECL into a VAR_DECL before placing it in the appropriate scope; do not call define_decl(); adjust call to c_begin_compound_stmt(); use objc_object_type instead of objc_id_type. (build_next_objc_exception_stuff): Call create_field_decl() instead of create_builtin_decl(); construct type directly instead of calling groktypename(); use OBJC_VOID_AT_END to mark end of function parameters. (build_private_template): Adjust call to get_class_ivars(); build a type directly instead of via groktypename(). (build_protocol_template, build_method_prototype_list_template, build_method_prototype_template, build_category_template, build_selector_template, build_class_template, build_super_template, build_ivar_template, build_ivar_list_template, build_method_list_template, build_method_template): Call create_field_decl() instead of grokfield(). (objc_method_parm_type): Do not call groktypename(). (generate_descriptor_table): Call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(). (generate_method_descriptors, build_protocol_initializer, generate_dispatch_tables, build_category_initializer, build_shared_structure_initializer): Do not call groktypename(). (generate_protocols): Call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(); do not call groktypename(). (error_with_ivar): Remove last parameter. (check_ivars): Do not iterate ovar CLASS_RAW_IVARS lists in addition to CLASS_IVARS lists; adjust calls to error_with_ivar(). (generate_ivar_lists): Convert one of the initializer elements; do not call groktypename(). (get_arg_type_list, start_method_def, gen_method_def): Account for new representation of variable arguments and '...' in Objective-C methods; add Objective-C++ impedance matching code. (is_objc_type_qualifier): Remove function. (adjust_type_for_id_default): Simplify; there is no longer a need to wade through declspecs. (lookup_interface, start_class, continue_class, finish_class, start_method_def, start_protocol, build_method_decl, objc_add_method, add_instance_variable, build_ivar_reference, is_ivar, is_private, get_super_receiver, objc_build_finally_epilogue): Make into static functions. (receiver_is_class_object): Use new IS_CLASS() macro. (objc_build_message_expr): Tweak ObjC++ message argument handling; call objc_finish_message_expr() instead of finish_message_expr(). (finish_message_expr): Rename to objc_finish_message_expr(); use OBJC_TYPE_NAME and OBJC_SET_TYPE_NAME macros instead of TYPE_NAME. call gen_type_name() instead of gen_declaration(); call objc_is_id() instead of using IS_ID and IS_CLASS; Use objc_class_name instead of calling get_identifier("Class"); handle CONVERT_EXPRs in receiver. (build_objc_method_call, warn_with_method): Do not call groktypename(). (build_ivar_reference): Call convert() instead of clobbering in a type. (hash_init): Initialize string_htab hash table. (add_instance_variable): Simplify parameter list; do not call grokfield(); do not populate CLASS_IVARS list. (start_class): Check for the existence of super class, if one was specified. (continue_class): Use CLASS_RAW_IVARS rather than CLASS_IVARS; do not call build_class_template(); adjust call to get_class_ivars(); call build_decl(), pushdecl() and finish_decl() instead of define_decl(). (finish_class): Call build_decl(), pushdecl() and finish_decl() instead of define_decl(). (add_protocols): Use PROTOCOL_BINFO_ELTS for the tree vector size. (start_protocol): Do not call build_protocol_template(); use PROTOCOL_BINFO_ELTS for the tree vector size. (encode_type_qualifiers): Do not handle the 'const' qualifier here. (encode_pointer): Encode 'const char *' as 'r*', for backwards compatibility. (encode_array): Use HOST_WIDE_INT_PRINT_DEC instead of "%ld". (encode_type): Handle the 'const' qualifier here. (objc_parmlist): New global variable, sued by objc_push_parm and objc_get_parm_info(). (objc_push_parm, objc_get_parm_info): New functions. (objc_expr_last): Remove function. (synth_self_and_ucmd_args): For instance methods, use the instance type for 'self'; call objc_push_parm() instead of push_parm_decl(). (start_method_def): Do not call push_scope(), declare_parm_level(), pop_scope(), push_parm_decl(), store_parm_decls() or objc_expr_last(); just use objc_push_parm() and objc_get_parm_info(). (comp_method_with_proto): Remove function. (objc_types_are_equivalent): Strip away indirections before comparing underlying types. (comp_proto_with_proto): Do not call groktypename(); types are no longer in raw declspec format. (objc_start_function): New function. (really_start_method): Call comp_proto_with_proto() instead of comp_method_with_proto(); call objc_start_function() instead of hand-crafting a function declarator. (continue_method_def, objc_expand_function_end): Remove functions. (get_super_receiver): Call objc_get_current_scope() instead of get_current_scope(); reference 'super_class' field (instead of 'class'). (finish_method_def): Rename to objc_finish_method_definition() and add a function decl parameter; move method encoding call from objc_expand_function_end(). (is_complex_decl, adorn_decl, gen_declarator, gen_declspecs, gen_declaration_1): Remove functions. (tmpbuf, RAW_DECLSPEC): Remove. (gen_declaration): Remove second parameter; simplify to deal with TYPE_P nodes instead of raw declspecs. (gen_type_name, gen_type_name_0): New functions. (gen_method_decl): Remove second parameter; call gen_type_name() instead of gen_declaration_1(). (dump_interface): Adjust calls to gen_declaration() and gen_method_decl(); do not allocate a separate string buffer. (init_objc): Allocate a larger string buffer to accommodate dump_interface(); adjust call to build_module_descriptor(); add call to build_module_initializer_routine() for the GNU runtime. (generate_classref_translation_entry): Do not call start_decl(); call finish_var_decl() instead of finish_decl(); call convert() instead of build_c_cast(). * objc-act.h (CLASS_OWN_IVARS): Remove accessor. (CLASS_BINFO_ELTS): Reduce from 6 to 5, now that CLASS_OWN_IVARS is gone. (OCTI_GNU_INIT_DECL, GNU_INIT_decl): New. (OCTI_ELLIPSIS_NODE, objc_ellipsis_node): Remove. (OCTI_ID_ID, id_type, objc_id_id): Rename to OCTI_ID_NAME, objc_object_type and objc_object_name, respectively. (OCTI_CLS_REF, OCTI_CLASS_NAME, objc_class_reference, objc_class_name): New. (IS_CLASS): New macro. (IS_ID, IS_SUPER): Robustify. (OCTI_EXECCLASS_DECL, execclass_decl): New. (finish_file, start_class, continue_class, finish_class, start_method_def, continue_method_def, finish_method_def, start_protocol, finish_protocol, objc_build_throw_stmt, objc_build_try_catch_finally_stmt, objc_build_synchronized_prologue, objc_build_synchronized_epilogue, objc_build_try_prologue, objc_build_try_epilogue, objc_build_catch_stmt, objc_build_catch_epilogue, objc_build_finally_prologue, objc_build_finally_epilogue, is_ivar, is_private, is_public, add_instance_variable, objc_add_method, get_super_receiver, objc_clear_super_receiver, get_class_ivars_from_name, get_class_reference, get_static_reference, get_object_reference, build_message_expr, finish_message_expr, build_selector_expr, build_ivar_reference, build_keyword_decl, build_method_decl, build_protocol_expr, build_objc_string_object, objc_declare_alias, objc_declare_class, objc_declare_protocols, objc_comptypes, objc_check_decl, build_encode_expr): Remove prototypes. (imp_count, cat_count): Make GGC-aware. (OBJC_SET_TYPE_NAME): New macro. From-SVN: r87168
2004-09-08 02:49:44 +02:00
if (!constant_string_class
|| !(constant_string_type
= CLASS_STATIC_TEMPLATE (constant_string_class)))
builtins.c, [...]: Avoid "`" as left quote, using "'" or %q, %< and %> as appropriate. * builtins.c, c-common.c, c-decl.c, c-format.c, c-format.h, c-parse.in, c-pch.c, c-pragma.c, collect2.c, final.c, gcc.c, gcov.c, opts.c, pretty-print.h, protoize.c, reg-stack.c, rtl.c, tlink.c, config/alpha/alpha.c, config/arc/arc.c, config/arm/arm.c, config/avr/avr.c, config/c4x/c4x.c, config/darwin.c, config/frv/frv.c, config/h8300/h8300.c, config/i386/i386.c, config/i386/winnt.c, config/ia64/ia64.c, config/ip2k/ip2k.c, config/iq2000/iq2000.c, config/m32r/m32r.c, config/m68hc11/m68hc11.c, config/m68k/m68k.c, config/m68k/m68k.h, config/mcore/mcore.c, config/mips/mips.c, config/mmix/mmix.c, config/ns32k/ns32k.c, config/rs6000/host-darwin.c, config/rs6000/rs6000.c, config/s390/s390.c, config/sh/sh.c, config/sh/symbian.c, config/stormy16/stormy16.c, config/v850/v850.c: Avoid "`" as left quote, using "'" or %q, %< and %> as appropriate. Use %' as apostrophe in diagnostics where applicable. Use %< and %> in place of '' quotes where applicable. Use %qs in place of %<%s%>. Consistently quote __builtin function names. ada: * misc.c (gnat_handle_option): Use %< and %> for quoting in warning message. cp: * call.c, class.c, decl.c, decl2.c, error.c, mangle.c, parser.c, pt.c, search.c, semantics.c, typeck.c: Use %q, %< and %> for quoting in diagnostics. * parser.c (cp_parser_sizeof_operand): Use '' instead of `' for quoting in printf format. * decl.c (duplicate_decls, start_decl): Use %qD instead of unquoted %D. objc: * objc-act.c: Use %q, %< and %> for quoting in diagnostics. testsuite: * gcc.dg/builtin-prefetch-1.c: Adjust expected messages. From-SVN: r90337
2004-11-09 11:13:30 +01:00
error ("cannot find interface declaration for %qs",
Makefile.in (c-parse.o): Depend on $(C_COMMON_H). [gcc/ChangeLog] 2004-09-07 Ziemowit Laski <zlaski@apple.com> * Makefile.in (c-parse.o): Depend on $(C_COMMON_H). * c-parse.in: Include c-common.h instead of objc-act.h. (ivar_decl_list, ivar_decls, ivar_decl, ivars, ivar_declarator, myparms, myparm): Remove %type declarations. (methodtype, optparms, OBJC_TYPE_QUAL, objc_quals, objc_qual, objc_typename, objc_try_catch_stmt, optellipsis): Add %type declarations. (objc_inherit_code, objc_public_flag): Remove. (typespec_nonreserved_nonattr): Call objc_get_protocol_qualified_type() instead of get_static_reference() and get_protocol_reference(). (stmt_nocomp): Call grokparm() on @catch parameter. (objcdef): Move semantic action to objc_finish_implementation(). (classdef): Move semantic action to objc_start_class_interface(), objc_continue_interface(), objc_finish_interface(), objc_start_class_implementation(), objc_continue_implementation(), objc_start_category_interface() and objc_start_category_implementation(). (protocoldef): Move semantic actions to objc_start_protocol() and objc_finish_interface(). (ivar_decl_list): Remove nonterminal. (visibility_spec): Move semantic actions to objc_set_visibility(). (ivar_decls): Remove assignment to $$. (ivar_decl): Rephrase in terms of component_decl; call objc_add_instance_variable(). (ivars, ivar_declarator): Remove nonterminals. (opt_semi): New nonterminal. (methodtype): Remove semantic actions. (methoddef): Move semantic actions to objc_set_method_type(), objc_start_method_definition() and objc_finish_method_definition(). (methodproto): Move semantic actions to objc_set_method_type() and objc_add_method_declaration(). (methoddecl): Use objc_typename instead of typename; move semantic actions to objc_build_method_signature(). (optarglist, myxdecls, mydecl, myparms, myparm): Remove nonterminals. (optparmlist): Express in terms of optparms and optellipsis. (optparms, optellipsis, objc_qual, objc_quals, objc_typename): New nonterminals. (keyworddecl): Use objc_typename instead of typename. (rid_to_yy): Mark RID_IN, RID_OUT, RID_INOUT, RID_BYCOPY, RID_BYREF and RID_ONEWAY as returning OBJC_TYPE_QUAL to yyparse(). [gcc/objc/ChangeLog] 2004-09-07 Ziemowit Laski <zlaski@apple.com> * Make-lang.in (objc/objc-parse.o): Depend on $(C_COMMON_H) instead of objc/objc-act.h. (objc/objc-act.o): Depend on $(HASHTAB_H). * objc-act.c: Include hashtab.h; in ObjC++ mode, include cp-tree.h and objcp-decl.h instead of c-tree.h. (build_module_descriptor, get_class_ivars, synth_id_with_class_suffix, error_with_ivar, gen_method_decl, gen_declaration, setup_string_decl, build_protocol_template): Adjust prototypes. (build_module_initializer_routine, start_class, continue_class, finish_class, start_method_def, objc_start_function, start_protocol, build_method_decl, objc_add_method, add_instance_variable, build_ivar_reference, is_ivar, is_private, get_super_receiver, build_selector_table_decl, objc_push_parm, objc_get_parm_info, gen_type_name, gen_type_name_0, start_var_decl, finish_var_decl, create_field_decl): New prototypes. (objc_expand_function_end, comp_method_with_proto, objc_expr_last, gen_declaration_1, gen_declarator, is_complex_decl, adorn_decl, define_decl, create_builtin_decl, gen_declspecs): Remove prototypes. (TYPE_ID): Rename to OBJECT_TYPEDEF_NAME. (CLASS_TYPEDEF_NAME): New. (TAG_EXECCLASS): Change from a global variable to a #define. (TAG_RETURN_STRUCT): Delete. (TAG_GNUINIT): New, holds '__objc_gnu_init' name. (objc_inherit_code, objc_public_flag): New, moved from c-parse.in. (string_descriptor): New struct. (string_htab): New hash table. (string_hash, string_eq): New prototypes. (generate_struct_by_value_array): Call create_field_decl() instead of create_builtin_decl(). (objc_init): Do not initialize objc_ellipsis_node or TAG_EXECCLASS; In ObjC++ mode, call cxx_init() instead of c_objc_common_init(). (objc_finish_file): In ObjC++, call instantiate_pending_templates() and cp_finish_file(). (define_decl, get_static_reference, get_protocol_reference, create_builtin_decl): Remove functions. (objc_start_class_interface, objc_start_category_interface, objc_start_protocol, objc_continue_interface, objc_finish_interface, objc_start_class_implementation, objc_start_category_implementation, objc_continue_implementation, objc_finish_implementation, objc_set_visibility, objc_set_method_type, objc_build_method_signature, objc_add_method_declaration, objc_start_method_definition, objc_add_instance_variable, objc_get_protocol_qualified_type, create_field_decl, start_var_decl, finish_var_decl): New functions. (setup_string_decl): Simplify since it is only called once. (synth_module_prologue): Call build_class_template(); predefine 'id' and 'Class' as typedefs; rename 'temp_type' to 'type'; disable debug hooks for duration of function; fix GNU runtime messenger signatures to correspond to reality; forward-declare '__objc_exec_class' for the GNU runtime; call build_selector_table_decl(); in ObjC++ mode, generate 'extern "C" { ... }' wrappers around synthesized declarations; call build_protocol_template() and build_category_template(). (string_hash, string_eq): New functions. (objc_build_string_object): Check metaclass correctness only once; store string literals in hash table. (objc_build_constructor): Do not convert initializer elements; adjust for ObjC++ impedance mismatch. (build_objc_symtab_template): Call create_field_decl() instead of create_builtin_decl(). (init_objc_symtab): Add missing conversion to initializer element. (build_metadata_decl): Call start_var_decl() instead of define_decl(). (generate_objc_symtab_decl): Do not call build_category_template(); call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(). (build_module_descriptor): Call create_field_decl() instead of grokfield(); call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(); always mark module descriptor as used; move GNU runtime-specific functionality to build_module_initializer_routine(). (build_module_initializer_routine): New function, broken off of build_module_descriptor(). (objc_static_init_needed_p, objc_generate_static_init_call): New functions. (generate_static_references, generate_strings, build_selector_translation_table, generate_descriptor_table, generate_ivars_list, generate_dispatch_table, generate_category): Call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(); build a type directly instead of via groktypename(). (build_selector_reference_decl, build_selector_table_decl, build_class_reference_decl, build_protocol_reference, generate_objc_image_info): Call start_var_decl() instead of build_decl(). (build_selector_reference): For GNU runtime, do not call build_selector_reference_decl(). (build_selector, build_typed_selector_reference): Always convert result to the selector type. (add_objc_string): Cast return value to 'char *'. (build_method_prototype_template, build_selector_template, build_method_template): Use actual selector type for fields pointing to selectors. (finish_objc): For GNU runtime, call build_module_initializer_routine() after build_module_descriptor(). (generate_protocol_list, generate_shared_structures): Call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(); build a type directly instead of via groktypename(). (synth_id_with_class_suffix): Return a string. (get_arg_type_list): For instance methods, use the instance type for 'self'; do not call groktypename_in_parm_context(). (build_objc_string_decl): Squash redeclaration errors in ObjC++. (objc_is_class_name): Use OBJC_TYPE_NAME instead of TYPE_NAME; handle RECORD_TYPEs in ObjC as well as ObjC++. (objc_is_id): New function. (objc_is_object_ptr): Return the canonical type node. (objc_get_class_ivars): Simplify using get_class_ivars(). (get_class_ivars): Remove second parameter; create a fresh copy of the ivar list for each call; do not check for existence of super class. (objc_eh_runtime_type): Mark #ifndef OBJCPLUS. (objc_init_exceptions): When using SJLJ-style exceptions, require the use of '-fobjc-exceptions' flag; do not require it for DWARF-style exceptions. (objc_build_exc_ptr, next_sjlj_build_try_catch_finally): Use objc_object_type instead of objc_id_type. (objc_begin_catch_clause): Convert the incoming PARM_DECL into a VAR_DECL before placing it in the appropriate scope; do not call define_decl(); adjust call to c_begin_compound_stmt(); use objc_object_type instead of objc_id_type. (build_next_objc_exception_stuff): Call create_field_decl() instead of create_builtin_decl(); construct type directly instead of calling groktypename(); use OBJC_VOID_AT_END to mark end of function parameters. (build_private_template): Adjust call to get_class_ivars(); build a type directly instead of via groktypename(). (build_protocol_template, build_method_prototype_list_template, build_method_prototype_template, build_category_template, build_selector_template, build_class_template, build_super_template, build_ivar_template, build_ivar_list_template, build_method_list_template, build_method_template): Call create_field_decl() instead of grokfield(). (objc_method_parm_type): Do not call groktypename(). (generate_descriptor_table): Call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(). (generate_method_descriptors, build_protocol_initializer, generate_dispatch_tables, build_category_initializer, build_shared_structure_initializer): Do not call groktypename(). (generate_protocols): Call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(); do not call groktypename(). (error_with_ivar): Remove last parameter. (check_ivars): Do not iterate ovar CLASS_RAW_IVARS lists in addition to CLASS_IVARS lists; adjust calls to error_with_ivar(). (generate_ivar_lists): Convert one of the initializer elements; do not call groktypename(). (get_arg_type_list, start_method_def, gen_method_def): Account for new representation of variable arguments and '...' in Objective-C methods; add Objective-C++ impedance matching code. (is_objc_type_qualifier): Remove function. (adjust_type_for_id_default): Simplify; there is no longer a need to wade through declspecs. (lookup_interface, start_class, continue_class, finish_class, start_method_def, start_protocol, build_method_decl, objc_add_method, add_instance_variable, build_ivar_reference, is_ivar, is_private, get_super_receiver, objc_build_finally_epilogue): Make into static functions. (receiver_is_class_object): Use new IS_CLASS() macro. (objc_build_message_expr): Tweak ObjC++ message argument handling; call objc_finish_message_expr() instead of finish_message_expr(). (finish_message_expr): Rename to objc_finish_message_expr(); use OBJC_TYPE_NAME and OBJC_SET_TYPE_NAME macros instead of TYPE_NAME. call gen_type_name() instead of gen_declaration(); call objc_is_id() instead of using IS_ID and IS_CLASS; Use objc_class_name instead of calling get_identifier("Class"); handle CONVERT_EXPRs in receiver. (build_objc_method_call, warn_with_method): Do not call groktypename(). (build_ivar_reference): Call convert() instead of clobbering in a type. (hash_init): Initialize string_htab hash table. (add_instance_variable): Simplify parameter list; do not call grokfield(); do not populate CLASS_IVARS list. (start_class): Check for the existence of super class, if one was specified. (continue_class): Use CLASS_RAW_IVARS rather than CLASS_IVARS; do not call build_class_template(); adjust call to get_class_ivars(); call build_decl(), pushdecl() and finish_decl() instead of define_decl(). (finish_class): Call build_decl(), pushdecl() and finish_decl() instead of define_decl(). (add_protocols): Use PROTOCOL_BINFO_ELTS for the tree vector size. (start_protocol): Do not call build_protocol_template(); use PROTOCOL_BINFO_ELTS for the tree vector size. (encode_type_qualifiers): Do not handle the 'const' qualifier here. (encode_pointer): Encode 'const char *' as 'r*', for backwards compatibility. (encode_array): Use HOST_WIDE_INT_PRINT_DEC instead of "%ld". (encode_type): Handle the 'const' qualifier here. (objc_parmlist): New global variable, sued by objc_push_parm and objc_get_parm_info(). (objc_push_parm, objc_get_parm_info): New functions. (objc_expr_last): Remove function. (synth_self_and_ucmd_args): For instance methods, use the instance type for 'self'; call objc_push_parm() instead of push_parm_decl(). (start_method_def): Do not call push_scope(), declare_parm_level(), pop_scope(), push_parm_decl(), store_parm_decls() or objc_expr_last(); just use objc_push_parm() and objc_get_parm_info(). (comp_method_with_proto): Remove function. (objc_types_are_equivalent): Strip away indirections before comparing underlying types. (comp_proto_with_proto): Do not call groktypename(); types are no longer in raw declspec format. (objc_start_function): New function. (really_start_method): Call comp_proto_with_proto() instead of comp_method_with_proto(); call objc_start_function() instead of hand-crafting a function declarator. (continue_method_def, objc_expand_function_end): Remove functions. (get_super_receiver): Call objc_get_current_scope() instead of get_current_scope(); reference 'super_class' field (instead of 'class'). (finish_method_def): Rename to objc_finish_method_definition() and add a function decl parameter; move method encoding call from objc_expand_function_end(). (is_complex_decl, adorn_decl, gen_declarator, gen_declspecs, gen_declaration_1): Remove functions. (tmpbuf, RAW_DECLSPEC): Remove. (gen_declaration): Remove second parameter; simplify to deal with TYPE_P nodes instead of raw declspecs. (gen_type_name, gen_type_name_0): New functions. (gen_method_decl): Remove second parameter; call gen_type_name() instead of gen_declaration_1(). (dump_interface): Adjust calls to gen_declaration() and gen_method_decl(); do not allocate a separate string buffer. (init_objc): Allocate a larger string buffer to accommodate dump_interface(); adjust call to build_module_descriptor(); add call to build_module_initializer_routine() for the GNU runtime. (generate_classref_translation_entry): Do not call start_decl(); call finish_var_decl() instead of finish_decl(); call convert() instead of build_c_cast(). * objc-act.h (CLASS_OWN_IVARS): Remove accessor. (CLASS_BINFO_ELTS): Reduce from 6 to 5, now that CLASS_OWN_IVARS is gone. (OCTI_GNU_INIT_DECL, GNU_INIT_decl): New. (OCTI_ELLIPSIS_NODE, objc_ellipsis_node): Remove. (OCTI_ID_ID, id_type, objc_id_id): Rename to OCTI_ID_NAME, objc_object_type and objc_object_name, respectively. (OCTI_CLS_REF, OCTI_CLASS_NAME, objc_class_reference, objc_class_name): New. (IS_CLASS): New macro. (IS_ID, IS_SUPER): Robustify. (OCTI_EXECCLASS_DECL, execclass_decl): New. (finish_file, start_class, continue_class, finish_class, start_method_def, continue_method_def, finish_method_def, start_protocol, finish_protocol, objc_build_throw_stmt, objc_build_try_catch_finally_stmt, objc_build_synchronized_prologue, objc_build_synchronized_epilogue, objc_build_try_prologue, objc_build_try_epilogue, objc_build_catch_stmt, objc_build_catch_epilogue, objc_build_finally_prologue, objc_build_finally_epilogue, is_ivar, is_private, is_public, add_instance_variable, objc_add_method, get_super_receiver, objc_clear_super_receiver, get_class_ivars_from_name, get_class_reference, get_static_reference, get_object_reference, build_message_expr, finish_message_expr, build_selector_expr, build_ivar_reference, build_keyword_decl, build_method_decl, build_protocol_expr, build_objc_string_object, objc_declare_alias, objc_declare_class, objc_declare_protocols, objc_comptypes, objc_check_decl, build_encode_expr): Remove prototypes. (imp_count, cat_count): Make GGC-aware. (OBJC_SET_TYPE_NAME): New macro. From-SVN: r87168
2004-09-08 02:49:44 +02:00
IDENTIFIER_POINTER (constant_string_id));
/* The NSConstantString/NXConstantString ivar layout is now known. */
else if (!check_string_class_template ())
builtins.c, [...]: Avoid "`" as left quote, using "'" or %q, %< and %> as appropriate. * builtins.c, c-common.c, c-decl.c, c-format.c, c-format.h, c-parse.in, c-pch.c, c-pragma.c, collect2.c, final.c, gcc.c, gcov.c, opts.c, pretty-print.h, protoize.c, reg-stack.c, rtl.c, tlink.c, config/alpha/alpha.c, config/arc/arc.c, config/arm/arm.c, config/avr/avr.c, config/c4x/c4x.c, config/darwin.c, config/frv/frv.c, config/h8300/h8300.c, config/i386/i386.c, config/i386/winnt.c, config/ia64/ia64.c, config/ip2k/ip2k.c, config/iq2000/iq2000.c, config/m32r/m32r.c, config/m68hc11/m68hc11.c, config/m68k/m68k.c, config/m68k/m68k.h, config/mcore/mcore.c, config/mips/mips.c, config/mmix/mmix.c, config/ns32k/ns32k.c, config/rs6000/host-darwin.c, config/rs6000/rs6000.c, config/s390/s390.c, config/sh/sh.c, config/sh/symbian.c, config/stormy16/stormy16.c, config/v850/v850.c: Avoid "`" as left quote, using "'" or %q, %< and %> as appropriate. Use %' as apostrophe in diagnostics where applicable. Use %< and %> in place of '' quotes where applicable. Use %qs in place of %<%s%>. Consistently quote __builtin function names. ada: * misc.c (gnat_handle_option): Use %< and %> for quoting in warning message. cp: * call.c, class.c, decl.c, decl2.c, error.c, mangle.c, parser.c, pt.c, search.c, semantics.c, typeck.c: Use %q, %< and %> for quoting in diagnostics. * parser.c (cp_parser_sizeof_operand): Use '' instead of `' for quoting in printf format. * decl.c (duplicate_decls, start_decl): Use %qD instead of unquoted %D. objc: * objc-act.c: Use %q, %< and %> for quoting in diagnostics. testsuite: * gcc.dg/builtin-prefetch-1.c: Adjust expected messages. From-SVN: r90337
2004-11-09 11:13:30 +01:00
error ("interface %qs does not have valid constant string layout",
Makefile.in (c-parse.o): Depend on $(C_COMMON_H). [gcc/ChangeLog] 2004-09-07 Ziemowit Laski <zlaski@apple.com> * Makefile.in (c-parse.o): Depend on $(C_COMMON_H). * c-parse.in: Include c-common.h instead of objc-act.h. (ivar_decl_list, ivar_decls, ivar_decl, ivars, ivar_declarator, myparms, myparm): Remove %type declarations. (methodtype, optparms, OBJC_TYPE_QUAL, objc_quals, objc_qual, objc_typename, objc_try_catch_stmt, optellipsis): Add %type declarations. (objc_inherit_code, objc_public_flag): Remove. (typespec_nonreserved_nonattr): Call objc_get_protocol_qualified_type() instead of get_static_reference() and get_protocol_reference(). (stmt_nocomp): Call grokparm() on @catch parameter. (objcdef): Move semantic action to objc_finish_implementation(). (classdef): Move semantic action to objc_start_class_interface(), objc_continue_interface(), objc_finish_interface(), objc_start_class_implementation(), objc_continue_implementation(), objc_start_category_interface() and objc_start_category_implementation(). (protocoldef): Move semantic actions to objc_start_protocol() and objc_finish_interface(). (ivar_decl_list): Remove nonterminal. (visibility_spec): Move semantic actions to objc_set_visibility(). (ivar_decls): Remove assignment to $$. (ivar_decl): Rephrase in terms of component_decl; call objc_add_instance_variable(). (ivars, ivar_declarator): Remove nonterminals. (opt_semi): New nonterminal. (methodtype): Remove semantic actions. (methoddef): Move semantic actions to objc_set_method_type(), objc_start_method_definition() and objc_finish_method_definition(). (methodproto): Move semantic actions to objc_set_method_type() and objc_add_method_declaration(). (methoddecl): Use objc_typename instead of typename; move semantic actions to objc_build_method_signature(). (optarglist, myxdecls, mydecl, myparms, myparm): Remove nonterminals. (optparmlist): Express in terms of optparms and optellipsis. (optparms, optellipsis, objc_qual, objc_quals, objc_typename): New nonterminals. (keyworddecl): Use objc_typename instead of typename. (rid_to_yy): Mark RID_IN, RID_OUT, RID_INOUT, RID_BYCOPY, RID_BYREF and RID_ONEWAY as returning OBJC_TYPE_QUAL to yyparse(). [gcc/objc/ChangeLog] 2004-09-07 Ziemowit Laski <zlaski@apple.com> * Make-lang.in (objc/objc-parse.o): Depend on $(C_COMMON_H) instead of objc/objc-act.h. (objc/objc-act.o): Depend on $(HASHTAB_H). * objc-act.c: Include hashtab.h; in ObjC++ mode, include cp-tree.h and objcp-decl.h instead of c-tree.h. (build_module_descriptor, get_class_ivars, synth_id_with_class_suffix, error_with_ivar, gen_method_decl, gen_declaration, setup_string_decl, build_protocol_template): Adjust prototypes. (build_module_initializer_routine, start_class, continue_class, finish_class, start_method_def, objc_start_function, start_protocol, build_method_decl, objc_add_method, add_instance_variable, build_ivar_reference, is_ivar, is_private, get_super_receiver, build_selector_table_decl, objc_push_parm, objc_get_parm_info, gen_type_name, gen_type_name_0, start_var_decl, finish_var_decl, create_field_decl): New prototypes. (objc_expand_function_end, comp_method_with_proto, objc_expr_last, gen_declaration_1, gen_declarator, is_complex_decl, adorn_decl, define_decl, create_builtin_decl, gen_declspecs): Remove prototypes. (TYPE_ID): Rename to OBJECT_TYPEDEF_NAME. (CLASS_TYPEDEF_NAME): New. (TAG_EXECCLASS): Change from a global variable to a #define. (TAG_RETURN_STRUCT): Delete. (TAG_GNUINIT): New, holds '__objc_gnu_init' name. (objc_inherit_code, objc_public_flag): New, moved from c-parse.in. (string_descriptor): New struct. (string_htab): New hash table. (string_hash, string_eq): New prototypes. (generate_struct_by_value_array): Call create_field_decl() instead of create_builtin_decl(). (objc_init): Do not initialize objc_ellipsis_node or TAG_EXECCLASS; In ObjC++ mode, call cxx_init() instead of c_objc_common_init(). (objc_finish_file): In ObjC++, call instantiate_pending_templates() and cp_finish_file(). (define_decl, get_static_reference, get_protocol_reference, create_builtin_decl): Remove functions. (objc_start_class_interface, objc_start_category_interface, objc_start_protocol, objc_continue_interface, objc_finish_interface, objc_start_class_implementation, objc_start_category_implementation, objc_continue_implementation, objc_finish_implementation, objc_set_visibility, objc_set_method_type, objc_build_method_signature, objc_add_method_declaration, objc_start_method_definition, objc_add_instance_variable, objc_get_protocol_qualified_type, create_field_decl, start_var_decl, finish_var_decl): New functions. (setup_string_decl): Simplify since it is only called once. (synth_module_prologue): Call build_class_template(); predefine 'id' and 'Class' as typedefs; rename 'temp_type' to 'type'; disable debug hooks for duration of function; fix GNU runtime messenger signatures to correspond to reality; forward-declare '__objc_exec_class' for the GNU runtime; call build_selector_table_decl(); in ObjC++ mode, generate 'extern "C" { ... }' wrappers around synthesized declarations; call build_protocol_template() and build_category_template(). (string_hash, string_eq): New functions. (objc_build_string_object): Check metaclass correctness only once; store string literals in hash table. (objc_build_constructor): Do not convert initializer elements; adjust for ObjC++ impedance mismatch. (build_objc_symtab_template): Call create_field_decl() instead of create_builtin_decl(). (init_objc_symtab): Add missing conversion to initializer element. (build_metadata_decl): Call start_var_decl() instead of define_decl(). (generate_objc_symtab_decl): Do not call build_category_template(); call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(). (build_module_descriptor): Call create_field_decl() instead of grokfield(); call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(); always mark module descriptor as used; move GNU runtime-specific functionality to build_module_initializer_routine(). (build_module_initializer_routine): New function, broken off of build_module_descriptor(). (objc_static_init_needed_p, objc_generate_static_init_call): New functions. (generate_static_references, generate_strings, build_selector_translation_table, generate_descriptor_table, generate_ivars_list, generate_dispatch_table, generate_category): Call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(); build a type directly instead of via groktypename(). (build_selector_reference_decl, build_selector_table_decl, build_class_reference_decl, build_protocol_reference, generate_objc_image_info): Call start_var_decl() instead of build_decl(). (build_selector_reference): For GNU runtime, do not call build_selector_reference_decl(). (build_selector, build_typed_selector_reference): Always convert result to the selector type. (add_objc_string): Cast return value to 'char *'. (build_method_prototype_template, build_selector_template, build_method_template): Use actual selector type for fields pointing to selectors. (finish_objc): For GNU runtime, call build_module_initializer_routine() after build_module_descriptor(). (generate_protocol_list, generate_shared_structures): Call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(); build a type directly instead of via groktypename(). (synth_id_with_class_suffix): Return a string. (get_arg_type_list): For instance methods, use the instance type for 'self'; do not call groktypename_in_parm_context(). (build_objc_string_decl): Squash redeclaration errors in ObjC++. (objc_is_class_name): Use OBJC_TYPE_NAME instead of TYPE_NAME; handle RECORD_TYPEs in ObjC as well as ObjC++. (objc_is_id): New function. (objc_is_object_ptr): Return the canonical type node. (objc_get_class_ivars): Simplify using get_class_ivars(). (get_class_ivars): Remove second parameter; create a fresh copy of the ivar list for each call; do not check for existence of super class. (objc_eh_runtime_type): Mark #ifndef OBJCPLUS. (objc_init_exceptions): When using SJLJ-style exceptions, require the use of '-fobjc-exceptions' flag; do not require it for DWARF-style exceptions. (objc_build_exc_ptr, next_sjlj_build_try_catch_finally): Use objc_object_type instead of objc_id_type. (objc_begin_catch_clause): Convert the incoming PARM_DECL into a VAR_DECL before placing it in the appropriate scope; do not call define_decl(); adjust call to c_begin_compound_stmt(); use objc_object_type instead of objc_id_type. (build_next_objc_exception_stuff): Call create_field_decl() instead of create_builtin_decl(); construct type directly instead of calling groktypename(); use OBJC_VOID_AT_END to mark end of function parameters. (build_private_template): Adjust call to get_class_ivars(); build a type directly instead of via groktypename(). (build_protocol_template, build_method_prototype_list_template, build_method_prototype_template, build_category_template, build_selector_template, build_class_template, build_super_template, build_ivar_template, build_ivar_list_template, build_method_list_template, build_method_template): Call create_field_decl() instead of grokfield(). (objc_method_parm_type): Do not call groktypename(). (generate_descriptor_table): Call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(). (generate_method_descriptors, build_protocol_initializer, generate_dispatch_tables, build_category_initializer, build_shared_structure_initializer): Do not call groktypename(). (generate_protocols): Call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(); do not call groktypename(). (error_with_ivar): Remove last parameter. (check_ivars): Do not iterate ovar CLASS_RAW_IVARS lists in addition to CLASS_IVARS lists; adjust calls to error_with_ivar(). (generate_ivar_lists): Convert one of the initializer elements; do not call groktypename(). (get_arg_type_list, start_method_def, gen_method_def): Account for new representation of variable arguments and '...' in Objective-C methods; add Objective-C++ impedance matching code. (is_objc_type_qualifier): Remove function. (adjust_type_for_id_default): Simplify; there is no longer a need to wade through declspecs. (lookup_interface, start_class, continue_class, finish_class, start_method_def, start_protocol, build_method_decl, objc_add_method, add_instance_variable, build_ivar_reference, is_ivar, is_private, get_super_receiver, objc_build_finally_epilogue): Make into static functions. (receiver_is_class_object): Use new IS_CLASS() macro. (objc_build_message_expr): Tweak ObjC++ message argument handling; call objc_finish_message_expr() instead of finish_message_expr(). (finish_message_expr): Rename to objc_finish_message_expr(); use OBJC_TYPE_NAME and OBJC_SET_TYPE_NAME macros instead of TYPE_NAME. call gen_type_name() instead of gen_declaration(); call objc_is_id() instead of using IS_ID and IS_CLASS; Use objc_class_name instead of calling get_identifier("Class"); handle CONVERT_EXPRs in receiver. (build_objc_method_call, warn_with_method): Do not call groktypename(). (build_ivar_reference): Call convert() instead of clobbering in a type. (hash_init): Initialize string_htab hash table. (add_instance_variable): Simplify parameter list; do not call grokfield(); do not populate CLASS_IVARS list. (start_class): Check for the existence of super class, if one was specified. (continue_class): Use CLASS_RAW_IVARS rather than CLASS_IVARS; do not call build_class_template(); adjust call to get_class_ivars(); call build_decl(), pushdecl() and finish_decl() instead of define_decl(). (finish_class): Call build_decl(), pushdecl() and finish_decl() instead of define_decl(). (add_protocols): Use PROTOCOL_BINFO_ELTS for the tree vector size. (start_protocol): Do not call build_protocol_template(); use PROTOCOL_BINFO_ELTS for the tree vector size. (encode_type_qualifiers): Do not handle the 'const' qualifier here. (encode_pointer): Encode 'const char *' as 'r*', for backwards compatibility. (encode_array): Use HOST_WIDE_INT_PRINT_DEC instead of "%ld". (encode_type): Handle the 'const' qualifier here. (objc_parmlist): New global variable, sued by objc_push_parm and objc_get_parm_info(). (objc_push_parm, objc_get_parm_info): New functions. (objc_expr_last): Remove function. (synth_self_and_ucmd_args): For instance methods, use the instance type for 'self'; call objc_push_parm() instead of push_parm_decl(). (start_method_def): Do not call push_scope(), declare_parm_level(), pop_scope(), push_parm_decl(), store_parm_decls() or objc_expr_last(); just use objc_push_parm() and objc_get_parm_info(). (comp_method_with_proto): Remove function. (objc_types_are_equivalent): Strip away indirections before comparing underlying types. (comp_proto_with_proto): Do not call groktypename(); types are no longer in raw declspec format. (objc_start_function): New function. (really_start_method): Call comp_proto_with_proto() instead of comp_method_with_proto(); call objc_start_function() instead of hand-crafting a function declarator. (continue_method_def, objc_expand_function_end): Remove functions. (get_super_receiver): Call objc_get_current_scope() instead of get_current_scope(); reference 'super_class' field (instead of 'class'). (finish_method_def): Rename to objc_finish_method_definition() and add a function decl parameter; move method encoding call from objc_expand_function_end(). (is_complex_decl, adorn_decl, gen_declarator, gen_declspecs, gen_declaration_1): Remove functions. (tmpbuf, RAW_DECLSPEC): Remove. (gen_declaration): Remove second parameter; simplify to deal with TYPE_P nodes instead of raw declspecs. (gen_type_name, gen_type_name_0): New functions. (gen_method_decl): Remove second parameter; call gen_type_name() instead of gen_declaration_1(). (dump_interface): Adjust calls to gen_declaration() and gen_method_decl(); do not allocate a separate string buffer. (init_objc): Allocate a larger string buffer to accommodate dump_interface(); adjust call to build_module_descriptor(); add call to build_module_initializer_routine() for the GNU runtime. (generate_classref_translation_entry): Do not call start_decl(); call finish_var_decl() instead of finish_decl(); call convert() instead of build_c_cast(). * objc-act.h (CLASS_OWN_IVARS): Remove accessor. (CLASS_BINFO_ELTS): Reduce from 6 to 5, now that CLASS_OWN_IVARS is gone. (OCTI_GNU_INIT_DECL, GNU_INIT_decl): New. (OCTI_ELLIPSIS_NODE, objc_ellipsis_node): Remove. (OCTI_ID_ID, id_type, objc_id_id): Rename to OCTI_ID_NAME, objc_object_type and objc_object_name, respectively. (OCTI_CLS_REF, OCTI_CLASS_NAME, objc_class_reference, objc_class_name): New. (IS_CLASS): New macro. (IS_ID, IS_SUPER): Robustify. (OCTI_EXECCLASS_DECL, execclass_decl): New. (finish_file, start_class, continue_class, finish_class, start_method_def, continue_method_def, finish_method_def, start_protocol, finish_protocol, objc_build_throw_stmt, objc_build_try_catch_finally_stmt, objc_build_synchronized_prologue, objc_build_synchronized_epilogue, objc_build_try_prologue, objc_build_try_epilogue, objc_build_catch_stmt, objc_build_catch_epilogue, objc_build_finally_prologue, objc_build_finally_epilogue, is_ivar, is_private, is_public, add_instance_variable, objc_add_method, get_super_receiver, objc_clear_super_receiver, get_class_ivars_from_name, get_class_reference, get_static_reference, get_object_reference, build_message_expr, finish_message_expr, build_selector_expr, build_ivar_reference, build_keyword_decl, build_method_decl, build_protocol_expr, build_objc_string_object, objc_declare_alias, objc_declare_class, objc_declare_protocols, objc_comptypes, objc_check_decl, build_encode_expr): Remove prototypes. (imp_count, cat_count): Make GGC-aware. (OBJC_SET_TYPE_NAME): New macro. From-SVN: r87168
2004-09-08 02:49:44 +02:00
IDENTIFIER_POINTER (constant_string_id));
/* For the NeXT runtime, we can generate a literal reference
to the string class, don't need to run a constructor. */
Makefile.in (c-parse.o): Depend on $(C_COMMON_H). [gcc/ChangeLog] 2004-09-07 Ziemowit Laski <zlaski@apple.com> * Makefile.in (c-parse.o): Depend on $(C_COMMON_H). * c-parse.in: Include c-common.h instead of objc-act.h. (ivar_decl_list, ivar_decls, ivar_decl, ivars, ivar_declarator, myparms, myparm): Remove %type declarations. (methodtype, optparms, OBJC_TYPE_QUAL, objc_quals, objc_qual, objc_typename, objc_try_catch_stmt, optellipsis): Add %type declarations. (objc_inherit_code, objc_public_flag): Remove. (typespec_nonreserved_nonattr): Call objc_get_protocol_qualified_type() instead of get_static_reference() and get_protocol_reference(). (stmt_nocomp): Call grokparm() on @catch parameter. (objcdef): Move semantic action to objc_finish_implementation(). (classdef): Move semantic action to objc_start_class_interface(), objc_continue_interface(), objc_finish_interface(), objc_start_class_implementation(), objc_continue_implementation(), objc_start_category_interface() and objc_start_category_implementation(). (protocoldef): Move semantic actions to objc_start_protocol() and objc_finish_interface(). (ivar_decl_list): Remove nonterminal. (visibility_spec): Move semantic actions to objc_set_visibility(). (ivar_decls): Remove assignment to $$. (ivar_decl): Rephrase in terms of component_decl; call objc_add_instance_variable(). (ivars, ivar_declarator): Remove nonterminals. (opt_semi): New nonterminal. (methodtype): Remove semantic actions. (methoddef): Move semantic actions to objc_set_method_type(), objc_start_method_definition() and objc_finish_method_definition(). (methodproto): Move semantic actions to objc_set_method_type() and objc_add_method_declaration(). (methoddecl): Use objc_typename instead of typename; move semantic actions to objc_build_method_signature(). (optarglist, myxdecls, mydecl, myparms, myparm): Remove nonterminals. (optparmlist): Express in terms of optparms and optellipsis. (optparms, optellipsis, objc_qual, objc_quals, objc_typename): New nonterminals. (keyworddecl): Use objc_typename instead of typename. (rid_to_yy): Mark RID_IN, RID_OUT, RID_INOUT, RID_BYCOPY, RID_BYREF and RID_ONEWAY as returning OBJC_TYPE_QUAL to yyparse(). [gcc/objc/ChangeLog] 2004-09-07 Ziemowit Laski <zlaski@apple.com> * Make-lang.in (objc/objc-parse.o): Depend on $(C_COMMON_H) instead of objc/objc-act.h. (objc/objc-act.o): Depend on $(HASHTAB_H). * objc-act.c: Include hashtab.h; in ObjC++ mode, include cp-tree.h and objcp-decl.h instead of c-tree.h. (build_module_descriptor, get_class_ivars, synth_id_with_class_suffix, error_with_ivar, gen_method_decl, gen_declaration, setup_string_decl, build_protocol_template): Adjust prototypes. (build_module_initializer_routine, start_class, continue_class, finish_class, start_method_def, objc_start_function, start_protocol, build_method_decl, objc_add_method, add_instance_variable, build_ivar_reference, is_ivar, is_private, get_super_receiver, build_selector_table_decl, objc_push_parm, objc_get_parm_info, gen_type_name, gen_type_name_0, start_var_decl, finish_var_decl, create_field_decl): New prototypes. (objc_expand_function_end, comp_method_with_proto, objc_expr_last, gen_declaration_1, gen_declarator, is_complex_decl, adorn_decl, define_decl, create_builtin_decl, gen_declspecs): Remove prototypes. (TYPE_ID): Rename to OBJECT_TYPEDEF_NAME. (CLASS_TYPEDEF_NAME): New. (TAG_EXECCLASS): Change from a global variable to a #define. (TAG_RETURN_STRUCT): Delete. (TAG_GNUINIT): New, holds '__objc_gnu_init' name. (objc_inherit_code, objc_public_flag): New, moved from c-parse.in. (string_descriptor): New struct. (string_htab): New hash table. (string_hash, string_eq): New prototypes. (generate_struct_by_value_array): Call create_field_decl() instead of create_builtin_decl(). (objc_init): Do not initialize objc_ellipsis_node or TAG_EXECCLASS; In ObjC++ mode, call cxx_init() instead of c_objc_common_init(). (objc_finish_file): In ObjC++, call instantiate_pending_templates() and cp_finish_file(). (define_decl, get_static_reference, get_protocol_reference, create_builtin_decl): Remove functions. (objc_start_class_interface, objc_start_category_interface, objc_start_protocol, objc_continue_interface, objc_finish_interface, objc_start_class_implementation, objc_start_category_implementation, objc_continue_implementation, objc_finish_implementation, objc_set_visibility, objc_set_method_type, objc_build_method_signature, objc_add_method_declaration, objc_start_method_definition, objc_add_instance_variable, objc_get_protocol_qualified_type, create_field_decl, start_var_decl, finish_var_decl): New functions. (setup_string_decl): Simplify since it is only called once. (synth_module_prologue): Call build_class_template(); predefine 'id' and 'Class' as typedefs; rename 'temp_type' to 'type'; disable debug hooks for duration of function; fix GNU runtime messenger signatures to correspond to reality; forward-declare '__objc_exec_class' for the GNU runtime; call build_selector_table_decl(); in ObjC++ mode, generate 'extern "C" { ... }' wrappers around synthesized declarations; call build_protocol_template() and build_category_template(). (string_hash, string_eq): New functions. (objc_build_string_object): Check metaclass correctness only once; store string literals in hash table. (objc_build_constructor): Do not convert initializer elements; adjust for ObjC++ impedance mismatch. (build_objc_symtab_template): Call create_field_decl() instead of create_builtin_decl(). (init_objc_symtab): Add missing conversion to initializer element. (build_metadata_decl): Call start_var_decl() instead of define_decl(). (generate_objc_symtab_decl): Do not call build_category_template(); call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(). (build_module_descriptor): Call create_field_decl() instead of grokfield(); call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(); always mark module descriptor as used; move GNU runtime-specific functionality to build_module_initializer_routine(). (build_module_initializer_routine): New function, broken off of build_module_descriptor(). (objc_static_init_needed_p, objc_generate_static_init_call): New functions. (generate_static_references, generate_strings, build_selector_translation_table, generate_descriptor_table, generate_ivars_list, generate_dispatch_table, generate_category): Call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(); build a type directly instead of via groktypename(). (build_selector_reference_decl, build_selector_table_decl, build_class_reference_decl, build_protocol_reference, generate_objc_image_info): Call start_var_decl() instead of build_decl(). (build_selector_reference): For GNU runtime, do not call build_selector_reference_decl(). (build_selector, build_typed_selector_reference): Always convert result to the selector type. (add_objc_string): Cast return value to 'char *'. (build_method_prototype_template, build_selector_template, build_method_template): Use actual selector type for fields pointing to selectors. (finish_objc): For GNU runtime, call build_module_initializer_routine() after build_module_descriptor(). (generate_protocol_list, generate_shared_structures): Call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(); build a type directly instead of via groktypename(). (synth_id_with_class_suffix): Return a string. (get_arg_type_list): For instance methods, use the instance type for 'self'; do not call groktypename_in_parm_context(). (build_objc_string_decl): Squash redeclaration errors in ObjC++. (objc_is_class_name): Use OBJC_TYPE_NAME instead of TYPE_NAME; handle RECORD_TYPEs in ObjC as well as ObjC++. (objc_is_id): New function. (objc_is_object_ptr): Return the canonical type node. (objc_get_class_ivars): Simplify using get_class_ivars(). (get_class_ivars): Remove second parameter; create a fresh copy of the ivar list for each call; do not check for existence of super class. (objc_eh_runtime_type): Mark #ifndef OBJCPLUS. (objc_init_exceptions): When using SJLJ-style exceptions, require the use of '-fobjc-exceptions' flag; do not require it for DWARF-style exceptions. (objc_build_exc_ptr, next_sjlj_build_try_catch_finally): Use objc_object_type instead of objc_id_type. (objc_begin_catch_clause): Convert the incoming PARM_DECL into a VAR_DECL before placing it in the appropriate scope; do not call define_decl(); adjust call to c_begin_compound_stmt(); use objc_object_type instead of objc_id_type. (build_next_objc_exception_stuff): Call create_field_decl() instead of create_builtin_decl(); construct type directly instead of calling groktypename(); use OBJC_VOID_AT_END to mark end of function parameters. (build_private_template): Adjust call to get_class_ivars(); build a type directly instead of via groktypename(). (build_protocol_template, build_method_prototype_list_template, build_method_prototype_template, build_category_template, build_selector_template, build_class_template, build_super_template, build_ivar_template, build_ivar_list_template, build_method_list_template, build_method_template): Call create_field_decl() instead of grokfield(). (objc_method_parm_type): Do not call groktypename(). (generate_descriptor_table): Call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(). (generate_method_descriptors, build_protocol_initializer, generate_dispatch_tables, build_category_initializer, build_shared_structure_initializer): Do not call groktypename(). (generate_protocols): Call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(); do not call groktypename(). (error_with_ivar): Remove last parameter. (check_ivars): Do not iterate ovar CLASS_RAW_IVARS lists in addition to CLASS_IVARS lists; adjust calls to error_with_ivar(). (generate_ivar_lists): Convert one of the initializer elements; do not call groktypename(). (get_arg_type_list, start_method_def, gen_method_def): Account for new representation of variable arguments and '...' in Objective-C methods; add Objective-C++ impedance matching code. (is_objc_type_qualifier): Remove function. (adjust_type_for_id_default): Simplify; there is no longer a need to wade through declspecs. (lookup_interface, start_class, continue_class, finish_class, start_method_def, start_protocol, build_method_decl, objc_add_method, add_instance_variable, build_ivar_reference, is_ivar, is_private, get_super_receiver, objc_build_finally_epilogue): Make into static functions. (receiver_is_class_object): Use new IS_CLASS() macro. (objc_build_message_expr): Tweak ObjC++ message argument handling; call objc_finish_message_expr() instead of finish_message_expr(). (finish_message_expr): Rename to objc_finish_message_expr(); use OBJC_TYPE_NAME and OBJC_SET_TYPE_NAME macros instead of TYPE_NAME. call gen_type_name() instead of gen_declaration(); call objc_is_id() instead of using IS_ID and IS_CLASS; Use objc_class_name instead of calling get_identifier("Class"); handle CONVERT_EXPRs in receiver. (build_objc_method_call, warn_with_method): Do not call groktypename(). (build_ivar_reference): Call convert() instead of clobbering in a type. (hash_init): Initialize string_htab hash table. (add_instance_variable): Simplify parameter list; do not call grokfield(); do not populate CLASS_IVARS list. (start_class): Check for the existence of super class, if one was specified. (continue_class): Use CLASS_RAW_IVARS rather than CLASS_IVARS; do not call build_class_template(); adjust call to get_class_ivars(); call build_decl(), pushdecl() and finish_decl() instead of define_decl(). (finish_class): Call build_decl(), pushdecl() and finish_decl() instead of define_decl(). (add_protocols): Use PROTOCOL_BINFO_ELTS for the tree vector size. (start_protocol): Do not call build_protocol_template(); use PROTOCOL_BINFO_ELTS for the tree vector size. (encode_type_qualifiers): Do not handle the 'const' qualifier here. (encode_pointer): Encode 'const char *' as 'r*', for backwards compatibility. (encode_array): Use HOST_WIDE_INT_PRINT_DEC instead of "%ld". (encode_type): Handle the 'const' qualifier here. (objc_parmlist): New global variable, sued by objc_push_parm and objc_get_parm_info(). (objc_push_parm, objc_get_parm_info): New functions. (objc_expr_last): Remove function. (synth_self_and_ucmd_args): For instance methods, use the instance type for 'self'; call objc_push_parm() instead of push_parm_decl(). (start_method_def): Do not call push_scope(), declare_parm_level(), pop_scope(), push_parm_decl(), store_parm_decls() or objc_expr_last(); just use objc_push_parm() and objc_get_parm_info(). (comp_method_with_proto): Remove function. (objc_types_are_equivalent): Strip away indirections before comparing underlying types. (comp_proto_with_proto): Do not call groktypename(); types are no longer in raw declspec format. (objc_start_function): New function. (really_start_method): Call comp_proto_with_proto() instead of comp_method_with_proto(); call objc_start_function() instead of hand-crafting a function declarator. (continue_method_def, objc_expand_function_end): Remove functions. (get_super_receiver): Call objc_get_current_scope() instead of get_current_scope(); reference 'super_class' field (instead of 'class'). (finish_method_def): Rename to objc_finish_method_definition() and add a function decl parameter; move method encoding call from objc_expand_function_end(). (is_complex_decl, adorn_decl, gen_declarator, gen_declspecs, gen_declaration_1): Remove functions. (tmpbuf, RAW_DECLSPEC): Remove. (gen_declaration): Remove second parameter; simplify to deal with TYPE_P nodes instead of raw declspecs. (gen_type_name, gen_type_name_0): New functions. (gen_method_decl): Remove second parameter; call gen_type_name() instead of gen_declaration_1(). (dump_interface): Adjust calls to gen_declaration() and gen_method_decl(); do not allocate a separate string buffer. (init_objc): Allocate a larger string buffer to accommodate dump_interface(); adjust call to build_module_descriptor(); add call to build_module_initializer_routine() for the GNU runtime. (generate_classref_translation_entry): Do not call start_decl(); call finish_var_decl() instead of finish_decl(); call convert() instead of build_c_cast(). * objc-act.h (CLASS_OWN_IVARS): Remove accessor. (CLASS_BINFO_ELTS): Reduce from 6 to 5, now that CLASS_OWN_IVARS is gone. (OCTI_GNU_INIT_DECL, GNU_INIT_decl): New. (OCTI_ELLIPSIS_NODE, objc_ellipsis_node): Remove. (OCTI_ID_ID, id_type, objc_id_id): Rename to OCTI_ID_NAME, objc_object_type and objc_object_name, respectively. (OCTI_CLS_REF, OCTI_CLASS_NAME, objc_class_reference, objc_class_name): New. (IS_CLASS): New macro. (IS_ID, IS_SUPER): Robustify. (OCTI_EXECCLASS_DECL, execclass_decl): New. (finish_file, start_class, continue_class, finish_class, start_method_def, continue_method_def, finish_method_def, start_protocol, finish_protocol, objc_build_throw_stmt, objc_build_try_catch_finally_stmt, objc_build_synchronized_prologue, objc_build_synchronized_epilogue, objc_build_try_prologue, objc_build_try_epilogue, objc_build_catch_stmt, objc_build_catch_epilogue, objc_build_finally_prologue, objc_build_finally_epilogue, is_ivar, is_private, is_public, add_instance_variable, objc_add_method, get_super_receiver, objc_clear_super_receiver, get_class_ivars_from_name, get_class_reference, get_static_reference, get_object_reference, build_message_expr, finish_message_expr, build_selector_expr, build_ivar_reference, build_keyword_decl, build_method_decl, build_protocol_expr, build_objc_string_object, objc_declare_alias, objc_declare_class, objc_declare_protocols, objc_comptypes, objc_check_decl, build_encode_expr): Remove prototypes. (imp_count, cat_count): Make GGC-aware. (OBJC_SET_TYPE_NAME): New macro. From-SVN: r87168
2004-09-08 02:49:44 +02:00
else if (flag_next_runtime && !setup_string_decl ())
builtins.c, [...]: Avoid "`" as left quote, using "'" or %q, %< and %> as appropriate. * builtins.c, c-common.c, c-decl.c, c-format.c, c-format.h, c-parse.in, c-pch.c, c-pragma.c, collect2.c, final.c, gcc.c, gcov.c, opts.c, pretty-print.h, protoize.c, reg-stack.c, rtl.c, tlink.c, config/alpha/alpha.c, config/arc/arc.c, config/arm/arm.c, config/avr/avr.c, config/c4x/c4x.c, config/darwin.c, config/frv/frv.c, config/h8300/h8300.c, config/i386/i386.c, config/i386/winnt.c, config/ia64/ia64.c, config/ip2k/ip2k.c, config/iq2000/iq2000.c, config/m32r/m32r.c, config/m68hc11/m68hc11.c, config/m68k/m68k.c, config/m68k/m68k.h, config/mcore/mcore.c, config/mips/mips.c, config/mmix/mmix.c, config/ns32k/ns32k.c, config/rs6000/host-darwin.c, config/rs6000/rs6000.c, config/s390/s390.c, config/sh/sh.c, config/sh/symbian.c, config/stormy16/stormy16.c, config/v850/v850.c: Avoid "`" as left quote, using "'" or %q, %< and %> as appropriate. Use %' as apostrophe in diagnostics where applicable. Use %< and %> in place of '' quotes where applicable. Use %qs in place of %<%s%>. Consistently quote __builtin function names. ada: * misc.c (gnat_handle_option): Use %< and %> for quoting in warning message. cp: * call.c, class.c, decl.c, decl2.c, error.c, mangle.c, parser.c, pt.c, search.c, semantics.c, typeck.c: Use %q, %< and %> for quoting in diagnostics. * parser.c (cp_parser_sizeof_operand): Use '' instead of `' for quoting in printf format. * decl.c (duplicate_decls, start_decl): Use %qD instead of unquoted %D. objc: * objc-act.c: Use %q, %< and %> for quoting in diagnostics. testsuite: * gcc.dg/builtin-prefetch-1.c: Adjust expected messages. From-SVN: r90337
2004-11-09 11:13:30 +01:00
error ("cannot find reference tag for class %qs",
Makefile.in (c-parse.o): Depend on $(C_COMMON_H). [gcc/ChangeLog] 2004-09-07 Ziemowit Laski <zlaski@apple.com> * Makefile.in (c-parse.o): Depend on $(C_COMMON_H). * c-parse.in: Include c-common.h instead of objc-act.h. (ivar_decl_list, ivar_decls, ivar_decl, ivars, ivar_declarator, myparms, myparm): Remove %type declarations. (methodtype, optparms, OBJC_TYPE_QUAL, objc_quals, objc_qual, objc_typename, objc_try_catch_stmt, optellipsis): Add %type declarations. (objc_inherit_code, objc_public_flag): Remove. (typespec_nonreserved_nonattr): Call objc_get_protocol_qualified_type() instead of get_static_reference() and get_protocol_reference(). (stmt_nocomp): Call grokparm() on @catch parameter. (objcdef): Move semantic action to objc_finish_implementation(). (classdef): Move semantic action to objc_start_class_interface(), objc_continue_interface(), objc_finish_interface(), objc_start_class_implementation(), objc_continue_implementation(), objc_start_category_interface() and objc_start_category_implementation(). (protocoldef): Move semantic actions to objc_start_protocol() and objc_finish_interface(). (ivar_decl_list): Remove nonterminal. (visibility_spec): Move semantic actions to objc_set_visibility(). (ivar_decls): Remove assignment to $$. (ivar_decl): Rephrase in terms of component_decl; call objc_add_instance_variable(). (ivars, ivar_declarator): Remove nonterminals. (opt_semi): New nonterminal. (methodtype): Remove semantic actions. (methoddef): Move semantic actions to objc_set_method_type(), objc_start_method_definition() and objc_finish_method_definition(). (methodproto): Move semantic actions to objc_set_method_type() and objc_add_method_declaration(). (methoddecl): Use objc_typename instead of typename; move semantic actions to objc_build_method_signature(). (optarglist, myxdecls, mydecl, myparms, myparm): Remove nonterminals. (optparmlist): Express in terms of optparms and optellipsis. (optparms, optellipsis, objc_qual, objc_quals, objc_typename): New nonterminals. (keyworddecl): Use objc_typename instead of typename. (rid_to_yy): Mark RID_IN, RID_OUT, RID_INOUT, RID_BYCOPY, RID_BYREF and RID_ONEWAY as returning OBJC_TYPE_QUAL to yyparse(). [gcc/objc/ChangeLog] 2004-09-07 Ziemowit Laski <zlaski@apple.com> * Make-lang.in (objc/objc-parse.o): Depend on $(C_COMMON_H) instead of objc/objc-act.h. (objc/objc-act.o): Depend on $(HASHTAB_H). * objc-act.c: Include hashtab.h; in ObjC++ mode, include cp-tree.h and objcp-decl.h instead of c-tree.h. (build_module_descriptor, get_class_ivars, synth_id_with_class_suffix, error_with_ivar, gen_method_decl, gen_declaration, setup_string_decl, build_protocol_template): Adjust prototypes. (build_module_initializer_routine, start_class, continue_class, finish_class, start_method_def, objc_start_function, start_protocol, build_method_decl, objc_add_method, add_instance_variable, build_ivar_reference, is_ivar, is_private, get_super_receiver, build_selector_table_decl, objc_push_parm, objc_get_parm_info, gen_type_name, gen_type_name_0, start_var_decl, finish_var_decl, create_field_decl): New prototypes. (objc_expand_function_end, comp_method_with_proto, objc_expr_last, gen_declaration_1, gen_declarator, is_complex_decl, adorn_decl, define_decl, create_builtin_decl, gen_declspecs): Remove prototypes. (TYPE_ID): Rename to OBJECT_TYPEDEF_NAME. (CLASS_TYPEDEF_NAME): New. (TAG_EXECCLASS): Change from a global variable to a #define. (TAG_RETURN_STRUCT): Delete. (TAG_GNUINIT): New, holds '__objc_gnu_init' name. (objc_inherit_code, objc_public_flag): New, moved from c-parse.in. (string_descriptor): New struct. (string_htab): New hash table. (string_hash, string_eq): New prototypes. (generate_struct_by_value_array): Call create_field_decl() instead of create_builtin_decl(). (objc_init): Do not initialize objc_ellipsis_node or TAG_EXECCLASS; In ObjC++ mode, call cxx_init() instead of c_objc_common_init(). (objc_finish_file): In ObjC++, call instantiate_pending_templates() and cp_finish_file(). (define_decl, get_static_reference, get_protocol_reference, create_builtin_decl): Remove functions. (objc_start_class_interface, objc_start_category_interface, objc_start_protocol, objc_continue_interface, objc_finish_interface, objc_start_class_implementation, objc_start_category_implementation, objc_continue_implementation, objc_finish_implementation, objc_set_visibility, objc_set_method_type, objc_build_method_signature, objc_add_method_declaration, objc_start_method_definition, objc_add_instance_variable, objc_get_protocol_qualified_type, create_field_decl, start_var_decl, finish_var_decl): New functions. (setup_string_decl): Simplify since it is only called once. (synth_module_prologue): Call build_class_template(); predefine 'id' and 'Class' as typedefs; rename 'temp_type' to 'type'; disable debug hooks for duration of function; fix GNU runtime messenger signatures to correspond to reality; forward-declare '__objc_exec_class' for the GNU runtime; call build_selector_table_decl(); in ObjC++ mode, generate 'extern "C" { ... }' wrappers around synthesized declarations; call build_protocol_template() and build_category_template(). (string_hash, string_eq): New functions. (objc_build_string_object): Check metaclass correctness only once; store string literals in hash table. (objc_build_constructor): Do not convert initializer elements; adjust for ObjC++ impedance mismatch. (build_objc_symtab_template): Call create_field_decl() instead of create_builtin_decl(). (init_objc_symtab): Add missing conversion to initializer element. (build_metadata_decl): Call start_var_decl() instead of define_decl(). (generate_objc_symtab_decl): Do not call build_category_template(); call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(). (build_module_descriptor): Call create_field_decl() instead of grokfield(); call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(); always mark module descriptor as used; move GNU runtime-specific functionality to build_module_initializer_routine(). (build_module_initializer_routine): New function, broken off of build_module_descriptor(). (objc_static_init_needed_p, objc_generate_static_init_call): New functions. (generate_static_references, generate_strings, build_selector_translation_table, generate_descriptor_table, generate_ivars_list, generate_dispatch_table, generate_category): Call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(); build a type directly instead of via groktypename(). (build_selector_reference_decl, build_selector_table_decl, build_class_reference_decl, build_protocol_reference, generate_objc_image_info): Call start_var_decl() instead of build_decl(). (build_selector_reference): For GNU runtime, do not call build_selector_reference_decl(). (build_selector, build_typed_selector_reference): Always convert result to the selector type. (add_objc_string): Cast return value to 'char *'. (build_method_prototype_template, build_selector_template, build_method_template): Use actual selector type for fields pointing to selectors. (finish_objc): For GNU runtime, call build_module_initializer_routine() after build_module_descriptor(). (generate_protocol_list, generate_shared_structures): Call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(); build a type directly instead of via groktypename(). (synth_id_with_class_suffix): Return a string. (get_arg_type_list): For instance methods, use the instance type for 'self'; do not call groktypename_in_parm_context(). (build_objc_string_decl): Squash redeclaration errors in ObjC++. (objc_is_class_name): Use OBJC_TYPE_NAME instead of TYPE_NAME; handle RECORD_TYPEs in ObjC as well as ObjC++. (objc_is_id): New function. (objc_is_object_ptr): Return the canonical type node. (objc_get_class_ivars): Simplify using get_class_ivars(). (get_class_ivars): Remove second parameter; create a fresh copy of the ivar list for each call; do not check for existence of super class. (objc_eh_runtime_type): Mark #ifndef OBJCPLUS. (objc_init_exceptions): When using SJLJ-style exceptions, require the use of '-fobjc-exceptions' flag; do not require it for DWARF-style exceptions. (objc_build_exc_ptr, next_sjlj_build_try_catch_finally): Use objc_object_type instead of objc_id_type. (objc_begin_catch_clause): Convert the incoming PARM_DECL into a VAR_DECL before placing it in the appropriate scope; do not call define_decl(); adjust call to c_begin_compound_stmt(); use objc_object_type instead of objc_id_type. (build_next_objc_exception_stuff): Call create_field_decl() instead of create_builtin_decl(); construct type directly instead of calling groktypename(); use OBJC_VOID_AT_END to mark end of function parameters. (build_private_template): Adjust call to get_class_ivars(); build a type directly instead of via groktypename(). (build_protocol_template, build_method_prototype_list_template, build_method_prototype_template, build_category_template, build_selector_template, build_class_template, build_super_template, build_ivar_template, build_ivar_list_template, build_method_list_template, build_method_template): Call create_field_decl() instead of grokfield(). (objc_method_parm_type): Do not call groktypename(). (generate_descriptor_table): Call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(). (generate_method_descriptors, build_protocol_initializer, generate_dispatch_tables, build_category_initializer, build_shared_structure_initializer): Do not call groktypename(). (generate_protocols): Call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(); do not call groktypename(). (error_with_ivar): Remove last parameter. (check_ivars): Do not iterate ovar CLASS_RAW_IVARS lists in addition to CLASS_IVARS lists; adjust calls to error_with_ivar(). (generate_ivar_lists): Convert one of the initializer elements; do not call groktypename(). (get_arg_type_list, start_method_def, gen_method_def): Account for new representation of variable arguments and '...' in Objective-C methods; add Objective-C++ impedance matching code. (is_objc_type_qualifier): Remove function. (adjust_type_for_id_default): Simplify; there is no longer a need to wade through declspecs. (lookup_interface, start_class, continue_class, finish_class, start_method_def, start_protocol, build_method_decl, objc_add_method, add_instance_variable, build_ivar_reference, is_ivar, is_private, get_super_receiver, objc_build_finally_epilogue): Make into static functions. (receiver_is_class_object): Use new IS_CLASS() macro. (objc_build_message_expr): Tweak ObjC++ message argument handling; call objc_finish_message_expr() instead of finish_message_expr(). (finish_message_expr): Rename to objc_finish_message_expr(); use OBJC_TYPE_NAME and OBJC_SET_TYPE_NAME macros instead of TYPE_NAME. call gen_type_name() instead of gen_declaration(); call objc_is_id() instead of using IS_ID and IS_CLASS; Use objc_class_name instead of calling get_identifier("Class"); handle CONVERT_EXPRs in receiver. (build_objc_method_call, warn_with_method): Do not call groktypename(). (build_ivar_reference): Call convert() instead of clobbering in a type. (hash_init): Initialize string_htab hash table. (add_instance_variable): Simplify parameter list; do not call grokfield(); do not populate CLASS_IVARS list. (start_class): Check for the existence of super class, if one was specified. (continue_class): Use CLASS_RAW_IVARS rather than CLASS_IVARS; do not call build_class_template(); adjust call to get_class_ivars(); call build_decl(), pushdecl() and finish_decl() instead of define_decl(). (finish_class): Call build_decl(), pushdecl() and finish_decl() instead of define_decl(). (add_protocols): Use PROTOCOL_BINFO_ELTS for the tree vector size. (start_protocol): Do not call build_protocol_template(); use PROTOCOL_BINFO_ELTS for the tree vector size. (encode_type_qualifiers): Do not handle the 'const' qualifier here. (encode_pointer): Encode 'const char *' as 'r*', for backwards compatibility. (encode_array): Use HOST_WIDE_INT_PRINT_DEC instead of "%ld". (encode_type): Handle the 'const' qualifier here. (objc_parmlist): New global variable, sued by objc_push_parm and objc_get_parm_info(). (objc_push_parm, objc_get_parm_info): New functions. (objc_expr_last): Remove function. (synth_self_and_ucmd_args): For instance methods, use the instance type for 'self'; call objc_push_parm() instead of push_parm_decl(). (start_method_def): Do not call push_scope(), declare_parm_level(), pop_scope(), push_parm_decl(), store_parm_decls() or objc_expr_last(); just use objc_push_parm() and objc_get_parm_info(). (comp_method_with_proto): Remove function. (objc_types_are_equivalent): Strip away indirections before comparing underlying types. (comp_proto_with_proto): Do not call groktypename(); types are no longer in raw declspec format. (objc_start_function): New function. (really_start_method): Call comp_proto_with_proto() instead of comp_method_with_proto(); call objc_start_function() instead of hand-crafting a function declarator. (continue_method_def, objc_expand_function_end): Remove functions. (get_super_receiver): Call objc_get_current_scope() instead of get_current_scope(); reference 'super_class' field (instead of 'class'). (finish_method_def): Rename to objc_finish_method_definition() and add a function decl parameter; move method encoding call from objc_expand_function_end(). (is_complex_decl, adorn_decl, gen_declarator, gen_declspecs, gen_declaration_1): Remove functions. (tmpbuf, RAW_DECLSPEC): Remove. (gen_declaration): Remove second parameter; simplify to deal with TYPE_P nodes instead of raw declspecs. (gen_type_name, gen_type_name_0): New functions. (gen_method_decl): Remove second parameter; call gen_type_name() instead of gen_declaration_1(). (dump_interface): Adjust calls to gen_declaration() and gen_method_decl(); do not allocate a separate string buffer. (init_objc): Allocate a larger string buffer to accommodate dump_interface(); adjust call to build_module_descriptor(); add call to build_module_initializer_routine() for the GNU runtime. (generate_classref_translation_entry): Do not call start_decl(); call finish_var_decl() instead of finish_decl(); call convert() instead of build_c_cast(). * objc-act.h (CLASS_OWN_IVARS): Remove accessor. (CLASS_BINFO_ELTS): Reduce from 6 to 5, now that CLASS_OWN_IVARS is gone. (OCTI_GNU_INIT_DECL, GNU_INIT_decl): New. (OCTI_ELLIPSIS_NODE, objc_ellipsis_node): Remove. (OCTI_ID_ID, id_type, objc_id_id): Rename to OCTI_ID_NAME, objc_object_type and objc_object_name, respectively. (OCTI_CLS_REF, OCTI_CLASS_NAME, objc_class_reference, objc_class_name): New. (IS_CLASS): New macro. (IS_ID, IS_SUPER): Robustify. (OCTI_EXECCLASS_DECL, execclass_decl): New. (finish_file, start_class, continue_class, finish_class, start_method_def, continue_method_def, finish_method_def, start_protocol, finish_protocol, objc_build_throw_stmt, objc_build_try_catch_finally_stmt, objc_build_synchronized_prologue, objc_build_synchronized_epilogue, objc_build_try_prologue, objc_build_try_epilogue, objc_build_catch_stmt, objc_build_catch_epilogue, objc_build_finally_prologue, objc_build_finally_epilogue, is_ivar, is_private, is_public, add_instance_variable, objc_add_method, get_super_receiver, objc_clear_super_receiver, get_class_ivars_from_name, get_class_reference, get_static_reference, get_object_reference, build_message_expr, finish_message_expr, build_selector_expr, build_ivar_reference, build_keyword_decl, build_method_decl, build_protocol_expr, build_objc_string_object, objc_declare_alias, objc_declare_class, objc_declare_protocols, objc_comptypes, objc_check_decl, build_encode_expr): Remove prototypes. (imp_count, cat_count): Make GGC-aware. (OBJC_SET_TYPE_NAME): New macro. From-SVN: r87168
2004-09-08 02:49:44 +02:00
IDENTIFIER_POINTER (constant_string_id));
else
{
Makefile.in (c-parse.o): Depend on $(C_COMMON_H). [gcc/ChangeLog] 2004-09-07 Ziemowit Laski <zlaski@apple.com> * Makefile.in (c-parse.o): Depend on $(C_COMMON_H). * c-parse.in: Include c-common.h instead of objc-act.h. (ivar_decl_list, ivar_decls, ivar_decl, ivars, ivar_declarator, myparms, myparm): Remove %type declarations. (methodtype, optparms, OBJC_TYPE_QUAL, objc_quals, objc_qual, objc_typename, objc_try_catch_stmt, optellipsis): Add %type declarations. (objc_inherit_code, objc_public_flag): Remove. (typespec_nonreserved_nonattr): Call objc_get_protocol_qualified_type() instead of get_static_reference() and get_protocol_reference(). (stmt_nocomp): Call grokparm() on @catch parameter. (objcdef): Move semantic action to objc_finish_implementation(). (classdef): Move semantic action to objc_start_class_interface(), objc_continue_interface(), objc_finish_interface(), objc_start_class_implementation(), objc_continue_implementation(), objc_start_category_interface() and objc_start_category_implementation(). (protocoldef): Move semantic actions to objc_start_protocol() and objc_finish_interface(). (ivar_decl_list): Remove nonterminal. (visibility_spec): Move semantic actions to objc_set_visibility(). (ivar_decls): Remove assignment to $$. (ivar_decl): Rephrase in terms of component_decl; call objc_add_instance_variable(). (ivars, ivar_declarator): Remove nonterminals. (opt_semi): New nonterminal. (methodtype): Remove semantic actions. (methoddef): Move semantic actions to objc_set_method_type(), objc_start_method_definition() and objc_finish_method_definition(). (methodproto): Move semantic actions to objc_set_method_type() and objc_add_method_declaration(). (methoddecl): Use objc_typename instead of typename; move semantic actions to objc_build_method_signature(). (optarglist, myxdecls, mydecl, myparms, myparm): Remove nonterminals. (optparmlist): Express in terms of optparms and optellipsis. (optparms, optellipsis, objc_qual, objc_quals, objc_typename): New nonterminals. (keyworddecl): Use objc_typename instead of typename. (rid_to_yy): Mark RID_IN, RID_OUT, RID_INOUT, RID_BYCOPY, RID_BYREF and RID_ONEWAY as returning OBJC_TYPE_QUAL to yyparse(). [gcc/objc/ChangeLog] 2004-09-07 Ziemowit Laski <zlaski@apple.com> * Make-lang.in (objc/objc-parse.o): Depend on $(C_COMMON_H) instead of objc/objc-act.h. (objc/objc-act.o): Depend on $(HASHTAB_H). * objc-act.c: Include hashtab.h; in ObjC++ mode, include cp-tree.h and objcp-decl.h instead of c-tree.h. (build_module_descriptor, get_class_ivars, synth_id_with_class_suffix, error_with_ivar, gen_method_decl, gen_declaration, setup_string_decl, build_protocol_template): Adjust prototypes. (build_module_initializer_routine, start_class, continue_class, finish_class, start_method_def, objc_start_function, start_protocol, build_method_decl, objc_add_method, add_instance_variable, build_ivar_reference, is_ivar, is_private, get_super_receiver, build_selector_table_decl, objc_push_parm, objc_get_parm_info, gen_type_name, gen_type_name_0, start_var_decl, finish_var_decl, create_field_decl): New prototypes. (objc_expand_function_end, comp_method_with_proto, objc_expr_last, gen_declaration_1, gen_declarator, is_complex_decl, adorn_decl, define_decl, create_builtin_decl, gen_declspecs): Remove prototypes. (TYPE_ID): Rename to OBJECT_TYPEDEF_NAME. (CLASS_TYPEDEF_NAME): New. (TAG_EXECCLASS): Change from a global variable to a #define. (TAG_RETURN_STRUCT): Delete. (TAG_GNUINIT): New, holds '__objc_gnu_init' name. (objc_inherit_code, objc_public_flag): New, moved from c-parse.in. (string_descriptor): New struct. (string_htab): New hash table. (string_hash, string_eq): New prototypes. (generate_struct_by_value_array): Call create_field_decl() instead of create_builtin_decl(). (objc_init): Do not initialize objc_ellipsis_node or TAG_EXECCLASS; In ObjC++ mode, call cxx_init() instead of c_objc_common_init(). (objc_finish_file): In ObjC++, call instantiate_pending_templates() and cp_finish_file(). (define_decl, get_static_reference, get_protocol_reference, create_builtin_decl): Remove functions. (objc_start_class_interface, objc_start_category_interface, objc_start_protocol, objc_continue_interface, objc_finish_interface, objc_start_class_implementation, objc_start_category_implementation, objc_continue_implementation, objc_finish_implementation, objc_set_visibility, objc_set_method_type, objc_build_method_signature, objc_add_method_declaration, objc_start_method_definition, objc_add_instance_variable, objc_get_protocol_qualified_type, create_field_decl, start_var_decl, finish_var_decl): New functions. (setup_string_decl): Simplify since it is only called once. (synth_module_prologue): Call build_class_template(); predefine 'id' and 'Class' as typedefs; rename 'temp_type' to 'type'; disable debug hooks for duration of function; fix GNU runtime messenger signatures to correspond to reality; forward-declare '__objc_exec_class' for the GNU runtime; call build_selector_table_decl(); in ObjC++ mode, generate 'extern "C" { ... }' wrappers around synthesized declarations; call build_protocol_template() and build_category_template(). (string_hash, string_eq): New functions. (objc_build_string_object): Check metaclass correctness only once; store string literals in hash table. (objc_build_constructor): Do not convert initializer elements; adjust for ObjC++ impedance mismatch. (build_objc_symtab_template): Call create_field_decl() instead of create_builtin_decl(). (init_objc_symtab): Add missing conversion to initializer element. (build_metadata_decl): Call start_var_decl() instead of define_decl(). (generate_objc_symtab_decl): Do not call build_category_template(); call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(). (build_module_descriptor): Call create_field_decl() instead of grokfield(); call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(); always mark module descriptor as used; move GNU runtime-specific functionality to build_module_initializer_routine(). (build_module_initializer_routine): New function, broken off of build_module_descriptor(). (objc_static_init_needed_p, objc_generate_static_init_call): New functions. (generate_static_references, generate_strings, build_selector_translation_table, generate_descriptor_table, generate_ivars_list, generate_dispatch_table, generate_category): Call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(); build a type directly instead of via groktypename(). (build_selector_reference_decl, build_selector_table_decl, build_class_reference_decl, build_protocol_reference, generate_objc_image_info): Call start_var_decl() instead of build_decl(). (build_selector_reference): For GNU runtime, do not call build_selector_reference_decl(). (build_selector, build_typed_selector_reference): Always convert result to the selector type. (add_objc_string): Cast return value to 'char *'. (build_method_prototype_template, build_selector_template, build_method_template): Use actual selector type for fields pointing to selectors. (finish_objc): For GNU runtime, call build_module_initializer_routine() after build_module_descriptor(). (generate_protocol_list, generate_shared_structures): Call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(); build a type directly instead of via groktypename(). (synth_id_with_class_suffix): Return a string. (get_arg_type_list): For instance methods, use the instance type for 'self'; do not call groktypename_in_parm_context(). (build_objc_string_decl): Squash redeclaration errors in ObjC++. (objc_is_class_name): Use OBJC_TYPE_NAME instead of TYPE_NAME; handle RECORD_TYPEs in ObjC as well as ObjC++. (objc_is_id): New function. (objc_is_object_ptr): Return the canonical type node. (objc_get_class_ivars): Simplify using get_class_ivars(). (get_class_ivars): Remove second parameter; create a fresh copy of the ivar list for each call; do not check for existence of super class. (objc_eh_runtime_type): Mark #ifndef OBJCPLUS. (objc_init_exceptions): When using SJLJ-style exceptions, require the use of '-fobjc-exceptions' flag; do not require it for DWARF-style exceptions. (objc_build_exc_ptr, next_sjlj_build_try_catch_finally): Use objc_object_type instead of objc_id_type. (objc_begin_catch_clause): Convert the incoming PARM_DECL into a VAR_DECL before placing it in the appropriate scope; do not call define_decl(); adjust call to c_begin_compound_stmt(); use objc_object_type instead of objc_id_type. (build_next_objc_exception_stuff): Call create_field_decl() instead of create_builtin_decl(); construct type directly instead of calling groktypename(); use OBJC_VOID_AT_END to mark end of function parameters. (build_private_template): Adjust call to get_class_ivars(); build a type directly instead of via groktypename(). (build_protocol_template, build_method_prototype_list_template, build_method_prototype_template, build_category_template, build_selector_template, build_class_template, build_super_template, build_ivar_template, build_ivar_list_template, build_method_list_template, build_method_template): Call create_field_decl() instead of grokfield(). (objc_method_parm_type): Do not call groktypename(). (generate_descriptor_table): Call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(). (generate_method_descriptors, build_protocol_initializer, generate_dispatch_tables, build_category_initializer, build_shared_structure_initializer): Do not call groktypename(). (generate_protocols): Call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(); do not call groktypename(). (error_with_ivar): Remove last parameter. (check_ivars): Do not iterate ovar CLASS_RAW_IVARS lists in addition to CLASS_IVARS lists; adjust calls to error_with_ivar(). (generate_ivar_lists): Convert one of the initializer elements; do not call groktypename(). (get_arg_type_list, start_method_def, gen_method_def): Account for new representation of variable arguments and '...' in Objective-C methods; add Objective-C++ impedance matching code. (is_objc_type_qualifier): Remove function. (adjust_type_for_id_default): Simplify; there is no longer a need to wade through declspecs. (lookup_interface, start_class, continue_class, finish_class, start_method_def, start_protocol, build_method_decl, objc_add_method, add_instance_variable, build_ivar_reference, is_ivar, is_private, get_super_receiver, objc_build_finally_epilogue): Make into static functions. (receiver_is_class_object): Use new IS_CLASS() macro. (objc_build_message_expr): Tweak ObjC++ message argument handling; call objc_finish_message_expr() instead of finish_message_expr(). (finish_message_expr): Rename to objc_finish_message_expr(); use OBJC_TYPE_NAME and OBJC_SET_TYPE_NAME macros instead of TYPE_NAME. call gen_type_name() instead of gen_declaration(); call objc_is_id() instead of using IS_ID and IS_CLASS; Use objc_class_name instead of calling get_identifier("Class"); handle CONVERT_EXPRs in receiver. (build_objc_method_call, warn_with_method): Do not call groktypename(). (build_ivar_reference): Call convert() instead of clobbering in a type. (hash_init): Initialize string_htab hash table. (add_instance_variable): Simplify parameter list; do not call grokfield(); do not populate CLASS_IVARS list. (start_class): Check for the existence of super class, if one was specified. (continue_class): Use CLASS_RAW_IVARS rather than CLASS_IVARS; do not call build_class_template(); adjust call to get_class_ivars(); call build_decl(), pushdecl() and finish_decl() instead of define_decl(). (finish_class): Call build_decl(), pushdecl() and finish_decl() instead of define_decl(). (add_protocols): Use PROTOCOL_BINFO_ELTS for the tree vector size. (start_protocol): Do not call build_protocol_template(); use PROTOCOL_BINFO_ELTS for the tree vector size. (encode_type_qualifiers): Do not handle the 'const' qualifier here. (encode_pointer): Encode 'const char *' as 'r*', for backwards compatibility. (encode_array): Use HOST_WIDE_INT_PRINT_DEC instead of "%ld". (encode_type): Handle the 'const' qualifier here. (objc_parmlist): New global variable, sued by objc_push_parm and objc_get_parm_info(). (objc_push_parm, objc_get_parm_info): New functions. (objc_expr_last): Remove function. (synth_self_and_ucmd_args): For instance methods, use the instance type for 'self'; call objc_push_parm() instead of push_parm_decl(). (start_method_def): Do not call push_scope(), declare_parm_level(), pop_scope(), push_parm_decl(), store_parm_decls() or objc_expr_last(); just use objc_push_parm() and objc_get_parm_info(). (comp_method_with_proto): Remove function. (objc_types_are_equivalent): Strip away indirections before comparing underlying types. (comp_proto_with_proto): Do not call groktypename(); types are no longer in raw declspec format. (objc_start_function): New function. (really_start_method): Call comp_proto_with_proto() instead of comp_method_with_proto(); call objc_start_function() instead of hand-crafting a function declarator. (continue_method_def, objc_expand_function_end): Remove functions. (get_super_receiver): Call objc_get_current_scope() instead of get_current_scope(); reference 'super_class' field (instead of 'class'). (finish_method_def): Rename to objc_finish_method_definition() and add a function decl parameter; move method encoding call from objc_expand_function_end(). (is_complex_decl, adorn_decl, gen_declarator, gen_declspecs, gen_declaration_1): Remove functions. (tmpbuf, RAW_DECLSPEC): Remove. (gen_declaration): Remove second parameter; simplify to deal with TYPE_P nodes instead of raw declspecs. (gen_type_name, gen_type_name_0): New functions. (gen_method_decl): Remove second parameter; call gen_type_name() instead of gen_declaration_1(). (dump_interface): Adjust calls to gen_declaration() and gen_method_decl(); do not allocate a separate string buffer. (init_objc): Allocate a larger string buffer to accommodate dump_interface(); adjust call to build_module_descriptor(); add call to build_module_initializer_routine() for the GNU runtime. (generate_classref_translation_entry): Do not call start_decl(); call finish_var_decl() instead of finish_decl(); call convert() instead of build_c_cast(). * objc-act.h (CLASS_OWN_IVARS): Remove accessor. (CLASS_BINFO_ELTS): Reduce from 6 to 5, now that CLASS_OWN_IVARS is gone. (OCTI_GNU_INIT_DECL, GNU_INIT_decl): New. (OCTI_ELLIPSIS_NODE, objc_ellipsis_node): Remove. (OCTI_ID_ID, id_type, objc_id_id): Rename to OCTI_ID_NAME, objc_object_type and objc_object_name, respectively. (OCTI_CLS_REF, OCTI_CLASS_NAME, objc_class_reference, objc_class_name): New. (IS_CLASS): New macro. (IS_ID, IS_SUPER): Robustify. (OCTI_EXECCLASS_DECL, execclass_decl): New. (finish_file, start_class, continue_class, finish_class, start_method_def, continue_method_def, finish_method_def, start_protocol, finish_protocol, objc_build_throw_stmt, objc_build_try_catch_finally_stmt, objc_build_synchronized_prologue, objc_build_synchronized_epilogue, objc_build_try_prologue, objc_build_try_epilogue, objc_build_catch_stmt, objc_build_catch_epilogue, objc_build_finally_prologue, objc_build_finally_epilogue, is_ivar, is_private, is_public, add_instance_variable, objc_add_method, get_super_receiver, objc_clear_super_receiver, get_class_ivars_from_name, get_class_reference, get_static_reference, get_object_reference, build_message_expr, finish_message_expr, build_selector_expr, build_ivar_reference, build_keyword_decl, build_method_decl, build_protocol_expr, build_objc_string_object, objc_declare_alias, objc_declare_class, objc_declare_protocols, objc_comptypes, objc_check_decl, build_encode_expr): Remove prototypes. (imp_count, cat_count): Make GGC-aware. (OBJC_SET_TYPE_NAME): New macro. From-SVN: r87168
2004-09-08 02:49:44 +02:00
string_layout_checked = 1; /* Success! */
add_class_reference (constant_string_id);
}
}
Makefile.in (c-parse.o): Depend on $(C_COMMON_H). [gcc/ChangeLog] 2004-09-07 Ziemowit Laski <zlaski@apple.com> * Makefile.in (c-parse.o): Depend on $(C_COMMON_H). * c-parse.in: Include c-common.h instead of objc-act.h. (ivar_decl_list, ivar_decls, ivar_decl, ivars, ivar_declarator, myparms, myparm): Remove %type declarations. (methodtype, optparms, OBJC_TYPE_QUAL, objc_quals, objc_qual, objc_typename, objc_try_catch_stmt, optellipsis): Add %type declarations. (objc_inherit_code, objc_public_flag): Remove. (typespec_nonreserved_nonattr): Call objc_get_protocol_qualified_type() instead of get_static_reference() and get_protocol_reference(). (stmt_nocomp): Call grokparm() on @catch parameter. (objcdef): Move semantic action to objc_finish_implementation(). (classdef): Move semantic action to objc_start_class_interface(), objc_continue_interface(), objc_finish_interface(), objc_start_class_implementation(), objc_continue_implementation(), objc_start_category_interface() and objc_start_category_implementation(). (protocoldef): Move semantic actions to objc_start_protocol() and objc_finish_interface(). (ivar_decl_list): Remove nonterminal. (visibility_spec): Move semantic actions to objc_set_visibility(). (ivar_decls): Remove assignment to $$. (ivar_decl): Rephrase in terms of component_decl; call objc_add_instance_variable(). (ivars, ivar_declarator): Remove nonterminals. (opt_semi): New nonterminal. (methodtype): Remove semantic actions. (methoddef): Move semantic actions to objc_set_method_type(), objc_start_method_definition() and objc_finish_method_definition(). (methodproto): Move semantic actions to objc_set_method_type() and objc_add_method_declaration(). (methoddecl): Use objc_typename instead of typename; move semantic actions to objc_build_method_signature(). (optarglist, myxdecls, mydecl, myparms, myparm): Remove nonterminals. (optparmlist): Express in terms of optparms and optellipsis. (optparms, optellipsis, objc_qual, objc_quals, objc_typename): New nonterminals. (keyworddecl): Use objc_typename instead of typename. (rid_to_yy): Mark RID_IN, RID_OUT, RID_INOUT, RID_BYCOPY, RID_BYREF and RID_ONEWAY as returning OBJC_TYPE_QUAL to yyparse(). [gcc/objc/ChangeLog] 2004-09-07 Ziemowit Laski <zlaski@apple.com> * Make-lang.in (objc/objc-parse.o): Depend on $(C_COMMON_H) instead of objc/objc-act.h. (objc/objc-act.o): Depend on $(HASHTAB_H). * objc-act.c: Include hashtab.h; in ObjC++ mode, include cp-tree.h and objcp-decl.h instead of c-tree.h. (build_module_descriptor, get_class_ivars, synth_id_with_class_suffix, error_with_ivar, gen_method_decl, gen_declaration, setup_string_decl, build_protocol_template): Adjust prototypes. (build_module_initializer_routine, start_class, continue_class, finish_class, start_method_def, objc_start_function, start_protocol, build_method_decl, objc_add_method, add_instance_variable, build_ivar_reference, is_ivar, is_private, get_super_receiver, build_selector_table_decl, objc_push_parm, objc_get_parm_info, gen_type_name, gen_type_name_0, start_var_decl, finish_var_decl, create_field_decl): New prototypes. (objc_expand_function_end, comp_method_with_proto, objc_expr_last, gen_declaration_1, gen_declarator, is_complex_decl, adorn_decl, define_decl, create_builtin_decl, gen_declspecs): Remove prototypes. (TYPE_ID): Rename to OBJECT_TYPEDEF_NAME. (CLASS_TYPEDEF_NAME): New. (TAG_EXECCLASS): Change from a global variable to a #define. (TAG_RETURN_STRUCT): Delete. (TAG_GNUINIT): New, holds '__objc_gnu_init' name. (objc_inherit_code, objc_public_flag): New, moved from c-parse.in. (string_descriptor): New struct. (string_htab): New hash table. (string_hash, string_eq): New prototypes. (generate_struct_by_value_array): Call create_field_decl() instead of create_builtin_decl(). (objc_init): Do not initialize objc_ellipsis_node or TAG_EXECCLASS; In ObjC++ mode, call cxx_init() instead of c_objc_common_init(). (objc_finish_file): In ObjC++, call instantiate_pending_templates() and cp_finish_file(). (define_decl, get_static_reference, get_protocol_reference, create_builtin_decl): Remove functions. (objc_start_class_interface, objc_start_category_interface, objc_start_protocol, objc_continue_interface, objc_finish_interface, objc_start_class_implementation, objc_start_category_implementation, objc_continue_implementation, objc_finish_implementation, objc_set_visibility, objc_set_method_type, objc_build_method_signature, objc_add_method_declaration, objc_start_method_definition, objc_add_instance_variable, objc_get_protocol_qualified_type, create_field_decl, start_var_decl, finish_var_decl): New functions. (setup_string_decl): Simplify since it is only called once. (synth_module_prologue): Call build_class_template(); predefine 'id' and 'Class' as typedefs; rename 'temp_type' to 'type'; disable debug hooks for duration of function; fix GNU runtime messenger signatures to correspond to reality; forward-declare '__objc_exec_class' for the GNU runtime; call build_selector_table_decl(); in ObjC++ mode, generate 'extern "C" { ... }' wrappers around synthesized declarations; call build_protocol_template() and build_category_template(). (string_hash, string_eq): New functions. (objc_build_string_object): Check metaclass correctness only once; store string literals in hash table. (objc_build_constructor): Do not convert initializer elements; adjust for ObjC++ impedance mismatch. (build_objc_symtab_template): Call create_field_decl() instead of create_builtin_decl(). (init_objc_symtab): Add missing conversion to initializer element. (build_metadata_decl): Call start_var_decl() instead of define_decl(). (generate_objc_symtab_decl): Do not call build_category_template(); call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(). (build_module_descriptor): Call create_field_decl() instead of grokfield(); call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(); always mark module descriptor as used; move GNU runtime-specific functionality to build_module_initializer_routine(). (build_module_initializer_routine): New function, broken off of build_module_descriptor(). (objc_static_init_needed_p, objc_generate_static_init_call): New functions. (generate_static_references, generate_strings, build_selector_translation_table, generate_descriptor_table, generate_ivars_list, generate_dispatch_table, generate_category): Call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(); build a type directly instead of via groktypename(). (build_selector_reference_decl, build_selector_table_decl, build_class_reference_decl, build_protocol_reference, generate_objc_image_info): Call start_var_decl() instead of build_decl(). (build_selector_reference): For GNU runtime, do not call build_selector_reference_decl(). (build_selector, build_typed_selector_reference): Always convert result to the selector type. (add_objc_string): Cast return value to 'char *'. (build_method_prototype_template, build_selector_template, build_method_template): Use actual selector type for fields pointing to selectors. (finish_objc): For GNU runtime, call build_module_initializer_routine() after build_module_descriptor(). (generate_protocol_list, generate_shared_structures): Call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(); build a type directly instead of via groktypename(). (synth_id_with_class_suffix): Return a string. (get_arg_type_list): For instance methods, use the instance type for 'self'; do not call groktypename_in_parm_context(). (build_objc_string_decl): Squash redeclaration errors in ObjC++. (objc_is_class_name): Use OBJC_TYPE_NAME instead of TYPE_NAME; handle RECORD_TYPEs in ObjC as well as ObjC++. (objc_is_id): New function. (objc_is_object_ptr): Return the canonical type node. (objc_get_class_ivars): Simplify using get_class_ivars(). (get_class_ivars): Remove second parameter; create a fresh copy of the ivar list for each call; do not check for existence of super class. (objc_eh_runtime_type): Mark #ifndef OBJCPLUS. (objc_init_exceptions): When using SJLJ-style exceptions, require the use of '-fobjc-exceptions' flag; do not require it for DWARF-style exceptions. (objc_build_exc_ptr, next_sjlj_build_try_catch_finally): Use objc_object_type instead of objc_id_type. (objc_begin_catch_clause): Convert the incoming PARM_DECL into a VAR_DECL before placing it in the appropriate scope; do not call define_decl(); adjust call to c_begin_compound_stmt(); use objc_object_type instead of objc_id_type. (build_next_objc_exception_stuff): Call create_field_decl() instead of create_builtin_decl(); construct type directly instead of calling groktypename(); use OBJC_VOID_AT_END to mark end of function parameters. (build_private_template): Adjust call to get_class_ivars(); build a type directly instead of via groktypename(). (build_protocol_template, build_method_prototype_list_template, build_method_prototype_template, build_category_template, build_selector_template, build_class_template, build_super_template, build_ivar_template, build_ivar_list_template, build_method_list_template, build_method_template): Call create_field_decl() instead of grokfield(). (objc_method_parm_type): Do not call groktypename(). (generate_descriptor_table): Call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(). (generate_method_descriptors, build_protocol_initializer, generate_dispatch_tables, build_category_initializer, build_shared_structure_initializer): Do not call groktypename(). (generate_protocols): Call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(); do not call groktypename(). (error_with_ivar): Remove last parameter. (check_ivars): Do not iterate ovar CLASS_RAW_IVARS lists in addition to CLASS_IVARS lists; adjust calls to error_with_ivar(). (generate_ivar_lists): Convert one of the initializer elements; do not call groktypename(). (get_arg_type_list, start_method_def, gen_method_def): Account for new representation of variable arguments and '...' in Objective-C methods; add Objective-C++ impedance matching code. (is_objc_type_qualifier): Remove function. (adjust_type_for_id_default): Simplify; there is no longer a need to wade through declspecs. (lookup_interface, start_class, continue_class, finish_class, start_method_def, start_protocol, build_method_decl, objc_add_method, add_instance_variable, build_ivar_reference, is_ivar, is_private, get_super_receiver, objc_build_finally_epilogue): Make into static functions. (receiver_is_class_object): Use new IS_CLASS() macro. (objc_build_message_expr): Tweak ObjC++ message argument handling; call objc_finish_message_expr() instead of finish_message_expr(). (finish_message_expr): Rename to objc_finish_message_expr(); use OBJC_TYPE_NAME and OBJC_SET_TYPE_NAME macros instead of TYPE_NAME. call gen_type_name() instead of gen_declaration(); call objc_is_id() instead of using IS_ID and IS_CLASS; Use objc_class_name instead of calling get_identifier("Class"); handle CONVERT_EXPRs in receiver. (build_objc_method_call, warn_with_method): Do not call groktypename(). (build_ivar_reference): Call convert() instead of clobbering in a type. (hash_init): Initialize string_htab hash table. (add_instance_variable): Simplify parameter list; do not call grokfield(); do not populate CLASS_IVARS list. (start_class): Check for the existence of super class, if one was specified. (continue_class): Use CLASS_RAW_IVARS rather than CLASS_IVARS; do not call build_class_template(); adjust call to get_class_ivars(); call build_decl(), pushdecl() and finish_decl() instead of define_decl(). (finish_class): Call build_decl(), pushdecl() and finish_decl() instead of define_decl(). (add_protocols): Use PROTOCOL_BINFO_ELTS for the tree vector size. (start_protocol): Do not call build_protocol_template(); use PROTOCOL_BINFO_ELTS for the tree vector size. (encode_type_qualifiers): Do not handle the 'const' qualifier here. (encode_pointer): Encode 'const char *' as 'r*', for backwards compatibility. (encode_array): Use HOST_WIDE_INT_PRINT_DEC instead of "%ld". (encode_type): Handle the 'const' qualifier here. (objc_parmlist): New global variable, sued by objc_push_parm and objc_get_parm_info(). (objc_push_parm, objc_get_parm_info): New functions. (objc_expr_last): Remove function. (synth_self_and_ucmd_args): For instance methods, use the instance type for 'self'; call objc_push_parm() instead of push_parm_decl(). (start_method_def): Do not call push_scope(), declare_parm_level(), pop_scope(), push_parm_decl(), store_parm_decls() or objc_expr_last(); just use objc_push_parm() and objc_get_parm_info(). (comp_method_with_proto): Remove function. (objc_types_are_equivalent): Strip away indirections before comparing underlying types. (comp_proto_with_proto): Do not call groktypename(); types are no longer in raw declspec format. (objc_start_function): New function. (really_start_method): Call comp_proto_with_proto() instead of comp_method_with_proto(); call objc_start_function() instead of hand-crafting a function declarator. (continue_method_def, objc_expand_function_end): Remove functions. (get_super_receiver): Call objc_get_current_scope() instead of get_current_scope(); reference 'super_class' field (instead of 'class'). (finish_method_def): Rename to objc_finish_method_definition() and add a function decl parameter; move method encoding call from objc_expand_function_end(). (is_complex_decl, adorn_decl, gen_declarator, gen_declspecs, gen_declaration_1): Remove functions. (tmpbuf, RAW_DECLSPEC): Remove. (gen_declaration): Remove second parameter; simplify to deal with TYPE_P nodes instead of raw declspecs. (gen_type_name, gen_type_name_0): New functions. (gen_method_decl): Remove second parameter; call gen_type_name() instead of gen_declaration_1(). (dump_interface): Adjust calls to gen_declaration() and gen_method_decl(); do not allocate a separate string buffer. (init_objc): Allocate a larger string buffer to accommodate dump_interface(); adjust call to build_module_descriptor(); add call to build_module_initializer_routine() for the GNU runtime. (generate_classref_translation_entry): Do not call start_decl(); call finish_var_decl() instead of finish_decl(); call convert() instead of build_c_cast(). * objc-act.h (CLASS_OWN_IVARS): Remove accessor. (CLASS_BINFO_ELTS): Reduce from 6 to 5, now that CLASS_OWN_IVARS is gone. (OCTI_GNU_INIT_DECL, GNU_INIT_decl): New. (OCTI_ELLIPSIS_NODE, objc_ellipsis_node): Remove. (OCTI_ID_ID, id_type, objc_id_id): Rename to OCTI_ID_NAME, objc_object_type and objc_object_name, respectively. (OCTI_CLS_REF, OCTI_CLASS_NAME, objc_class_reference, objc_class_name): New. (IS_CLASS): New macro. (IS_ID, IS_SUPER): Robustify. (OCTI_EXECCLASS_DECL, execclass_decl): New. (finish_file, start_class, continue_class, finish_class, start_method_def, continue_method_def, finish_method_def, start_protocol, finish_protocol, objc_build_throw_stmt, objc_build_try_catch_finally_stmt, objc_build_synchronized_prologue, objc_build_synchronized_epilogue, objc_build_try_prologue, objc_build_try_epilogue, objc_build_catch_stmt, objc_build_catch_epilogue, objc_build_finally_prologue, objc_build_finally_epilogue, is_ivar, is_private, is_public, add_instance_variable, objc_add_method, get_super_receiver, objc_clear_super_receiver, get_class_ivars_from_name, get_class_reference, get_static_reference, get_object_reference, build_message_expr, finish_message_expr, build_selector_expr, build_ivar_reference, build_keyword_decl, build_method_decl, build_protocol_expr, build_objc_string_object, objc_declare_alias, objc_declare_class, objc_declare_protocols, objc_comptypes, objc_check_decl, build_encode_expr): Remove prototypes. (imp_count, cat_count): Make GGC-aware. (OBJC_SET_TYPE_NAME): New macro. From-SVN: r87168
2004-09-08 02:49:44 +02:00
if (string_layout_checked == -1)
return error_mark_node;
Makefile.in (c-parse.o): Depend on $(C_COMMON_H). [gcc/ChangeLog] 2004-09-07 Ziemowit Laski <zlaski@apple.com> * Makefile.in (c-parse.o): Depend on $(C_COMMON_H). * c-parse.in: Include c-common.h instead of objc-act.h. (ivar_decl_list, ivar_decls, ivar_decl, ivars, ivar_declarator, myparms, myparm): Remove %type declarations. (methodtype, optparms, OBJC_TYPE_QUAL, objc_quals, objc_qual, objc_typename, objc_try_catch_stmt, optellipsis): Add %type declarations. (objc_inherit_code, objc_public_flag): Remove. (typespec_nonreserved_nonattr): Call objc_get_protocol_qualified_type() instead of get_static_reference() and get_protocol_reference(). (stmt_nocomp): Call grokparm() on @catch parameter. (objcdef): Move semantic action to objc_finish_implementation(). (classdef): Move semantic action to objc_start_class_interface(), objc_continue_interface(), objc_finish_interface(), objc_start_class_implementation(), objc_continue_implementation(), objc_start_category_interface() and objc_start_category_implementation(). (protocoldef): Move semantic actions to objc_start_protocol() and objc_finish_interface(). (ivar_decl_list): Remove nonterminal. (visibility_spec): Move semantic actions to objc_set_visibility(). (ivar_decls): Remove assignment to $$. (ivar_decl): Rephrase in terms of component_decl; call objc_add_instance_variable(). (ivars, ivar_declarator): Remove nonterminals. (opt_semi): New nonterminal. (methodtype): Remove semantic actions. (methoddef): Move semantic actions to objc_set_method_type(), objc_start_method_definition() and objc_finish_method_definition(). (methodproto): Move semantic actions to objc_set_method_type() and objc_add_method_declaration(). (methoddecl): Use objc_typename instead of typename; move semantic actions to objc_build_method_signature(). (optarglist, myxdecls, mydecl, myparms, myparm): Remove nonterminals. (optparmlist): Express in terms of optparms and optellipsis. (optparms, optellipsis, objc_qual, objc_quals, objc_typename): New nonterminals. (keyworddecl): Use objc_typename instead of typename. (rid_to_yy): Mark RID_IN, RID_OUT, RID_INOUT, RID_BYCOPY, RID_BYREF and RID_ONEWAY as returning OBJC_TYPE_QUAL to yyparse(). [gcc/objc/ChangeLog] 2004-09-07 Ziemowit Laski <zlaski@apple.com> * Make-lang.in (objc/objc-parse.o): Depend on $(C_COMMON_H) instead of objc/objc-act.h. (objc/objc-act.o): Depend on $(HASHTAB_H). * objc-act.c: Include hashtab.h; in ObjC++ mode, include cp-tree.h and objcp-decl.h instead of c-tree.h. (build_module_descriptor, get_class_ivars, synth_id_with_class_suffix, error_with_ivar, gen_method_decl, gen_declaration, setup_string_decl, build_protocol_template): Adjust prototypes. (build_module_initializer_routine, start_class, continue_class, finish_class, start_method_def, objc_start_function, start_protocol, build_method_decl, objc_add_method, add_instance_variable, build_ivar_reference, is_ivar, is_private, get_super_receiver, build_selector_table_decl, objc_push_parm, objc_get_parm_info, gen_type_name, gen_type_name_0, start_var_decl, finish_var_decl, create_field_decl): New prototypes. (objc_expand_function_end, comp_method_with_proto, objc_expr_last, gen_declaration_1, gen_declarator, is_complex_decl, adorn_decl, define_decl, create_builtin_decl, gen_declspecs): Remove prototypes. (TYPE_ID): Rename to OBJECT_TYPEDEF_NAME. (CLASS_TYPEDEF_NAME): New. (TAG_EXECCLASS): Change from a global variable to a #define. (TAG_RETURN_STRUCT): Delete. (TAG_GNUINIT): New, holds '__objc_gnu_init' name. (objc_inherit_code, objc_public_flag): New, moved from c-parse.in. (string_descriptor): New struct. (string_htab): New hash table. (string_hash, string_eq): New prototypes. (generate_struct_by_value_array): Call create_field_decl() instead of create_builtin_decl(). (objc_init): Do not initialize objc_ellipsis_node or TAG_EXECCLASS; In ObjC++ mode, call cxx_init() instead of c_objc_common_init(). (objc_finish_file): In ObjC++, call instantiate_pending_templates() and cp_finish_file(). (define_decl, get_static_reference, get_protocol_reference, create_builtin_decl): Remove functions. (objc_start_class_interface, objc_start_category_interface, objc_start_protocol, objc_continue_interface, objc_finish_interface, objc_start_class_implementation, objc_start_category_implementation, objc_continue_implementation, objc_finish_implementation, objc_set_visibility, objc_set_method_type, objc_build_method_signature, objc_add_method_declaration, objc_start_method_definition, objc_add_instance_variable, objc_get_protocol_qualified_type, create_field_decl, start_var_decl, finish_var_decl): New functions. (setup_string_decl): Simplify since it is only called once. (synth_module_prologue): Call build_class_template(); predefine 'id' and 'Class' as typedefs; rename 'temp_type' to 'type'; disable debug hooks for duration of function; fix GNU runtime messenger signatures to correspond to reality; forward-declare '__objc_exec_class' for the GNU runtime; call build_selector_table_decl(); in ObjC++ mode, generate 'extern "C" { ... }' wrappers around synthesized declarations; call build_protocol_template() and build_category_template(). (string_hash, string_eq): New functions. (objc_build_string_object): Check metaclass correctness only once; store string literals in hash table. (objc_build_constructor): Do not convert initializer elements; adjust for ObjC++ impedance mismatch. (build_objc_symtab_template): Call create_field_decl() instead of create_builtin_decl(). (init_objc_symtab): Add missing conversion to initializer element. (build_metadata_decl): Call start_var_decl() instead of define_decl(). (generate_objc_symtab_decl): Do not call build_category_template(); call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(). (build_module_descriptor): Call create_field_decl() instead of grokfield(); call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(); always mark module descriptor as used; move GNU runtime-specific functionality to build_module_initializer_routine(). (build_module_initializer_routine): New function, broken off of build_module_descriptor(). (objc_static_init_needed_p, objc_generate_static_init_call): New functions. (generate_static_references, generate_strings, build_selector_translation_table, generate_descriptor_table, generate_ivars_list, generate_dispatch_table, generate_category): Call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(); build a type directly instead of via groktypename(). (build_selector_reference_decl, build_selector_table_decl, build_class_reference_decl, build_protocol_reference, generate_objc_image_info): Call start_var_decl() instead of build_decl(). (build_selector_reference): For GNU runtime, do not call build_selector_reference_decl(). (build_selector, build_typed_selector_reference): Always convert result to the selector type. (add_objc_string): Cast return value to 'char *'. (build_method_prototype_template, build_selector_template, build_method_template): Use actual selector type for fields pointing to selectors. (finish_objc): For GNU runtime, call build_module_initializer_routine() after build_module_descriptor(). (generate_protocol_list, generate_shared_structures): Call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(); build a type directly instead of via groktypename(). (synth_id_with_class_suffix): Return a string. (get_arg_type_list): For instance methods, use the instance type for 'self'; do not call groktypename_in_parm_context(). (build_objc_string_decl): Squash redeclaration errors in ObjC++. (objc_is_class_name): Use OBJC_TYPE_NAME instead of TYPE_NAME; handle RECORD_TYPEs in ObjC as well as ObjC++. (objc_is_id): New function. (objc_is_object_ptr): Return the canonical type node. (objc_get_class_ivars): Simplify using get_class_ivars(). (get_class_ivars): Remove second parameter; create a fresh copy of the ivar list for each call; do not check for existence of super class. (objc_eh_runtime_type): Mark #ifndef OBJCPLUS. (objc_init_exceptions): When using SJLJ-style exceptions, require the use of '-fobjc-exceptions' flag; do not require it for DWARF-style exceptions. (objc_build_exc_ptr, next_sjlj_build_try_catch_finally): Use objc_object_type instead of objc_id_type. (objc_begin_catch_clause): Convert the incoming PARM_DECL into a VAR_DECL before placing it in the appropriate scope; do not call define_decl(); adjust call to c_begin_compound_stmt(); use objc_object_type instead of objc_id_type. (build_next_objc_exception_stuff): Call create_field_decl() instead of create_builtin_decl(); construct type directly instead of calling groktypename(); use OBJC_VOID_AT_END to mark end of function parameters. (build_private_template): Adjust call to get_class_ivars(); build a type directly instead of via groktypename(). (build_protocol_template, build_method_prototype_list_template, build_method_prototype_template, build_category_template, build_selector_template, build_class_template, build_super_template, build_ivar_template, build_ivar_list_template, build_method_list_template, build_method_template): Call create_field_decl() instead of grokfield(). (objc_method_parm_type): Do not call groktypename(). (generate_descriptor_table): Call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(). (generate_method_descriptors, build_protocol_initializer, generate_dispatch_tables, build_category_initializer, build_shared_structure_initializer): Do not call groktypename(). (generate_protocols): Call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(); do not call groktypename(). (error_with_ivar): Remove last parameter. (check_ivars): Do not iterate ovar CLASS_RAW_IVARS lists in addition to CLASS_IVARS lists; adjust calls to error_with_ivar(). (generate_ivar_lists): Convert one of the initializer elements; do not call groktypename(). (get_arg_type_list, start_method_def, gen_method_def): Account for new representation of variable arguments and '...' in Objective-C methods; add Objective-C++ impedance matching code. (is_objc_type_qualifier): Remove function. (adjust_type_for_id_default): Simplify; there is no longer a need to wade through declspecs. (lookup_interface, start_class, continue_class, finish_class, start_method_def, start_protocol, build_method_decl, objc_add_method, add_instance_variable, build_ivar_reference, is_ivar, is_private, get_super_receiver, objc_build_finally_epilogue): Make into static functions. (receiver_is_class_object): Use new IS_CLASS() macro. (objc_build_message_expr): Tweak ObjC++ message argument handling; call objc_finish_message_expr() instead of finish_message_expr(). (finish_message_expr): Rename to objc_finish_message_expr(); use OBJC_TYPE_NAME and OBJC_SET_TYPE_NAME macros instead of TYPE_NAME. call gen_type_name() instead of gen_declaration(); call objc_is_id() instead of using IS_ID and IS_CLASS; Use objc_class_name instead of calling get_identifier("Class"); handle CONVERT_EXPRs in receiver. (build_objc_method_call, warn_with_method): Do not call groktypename(). (build_ivar_reference): Call convert() instead of clobbering in a type. (hash_init): Initialize string_htab hash table. (add_instance_variable): Simplify parameter list; do not call grokfield(); do not populate CLASS_IVARS list. (start_class): Check for the existence of super class, if one was specified. (continue_class): Use CLASS_RAW_IVARS rather than CLASS_IVARS; do not call build_class_template(); adjust call to get_class_ivars(); call build_decl(), pushdecl() and finish_decl() instead of define_decl(). (finish_class): Call build_decl(), pushdecl() and finish_decl() instead of define_decl(). (add_protocols): Use PROTOCOL_BINFO_ELTS for the tree vector size. (start_protocol): Do not call build_protocol_template(); use PROTOCOL_BINFO_ELTS for the tree vector size. (encode_type_qualifiers): Do not handle the 'const' qualifier here. (encode_pointer): Encode 'const char *' as 'r*', for backwards compatibility. (encode_array): Use HOST_WIDE_INT_PRINT_DEC instead of "%ld". (encode_type): Handle the 'const' qualifier here. (objc_parmlist): New global variable, sued by objc_push_parm and objc_get_parm_info(). (objc_push_parm, objc_get_parm_info): New functions. (objc_expr_last): Remove function. (synth_self_and_ucmd_args): For instance methods, use the instance type for 'self'; call objc_push_parm() instead of push_parm_decl(). (start_method_def): Do not call push_scope(), declare_parm_level(), pop_scope(), push_parm_decl(), store_parm_decls() or objc_expr_last(); just use objc_push_parm() and objc_get_parm_info(). (comp_method_with_proto): Remove function. (objc_types_are_equivalent): Strip away indirections before comparing underlying types. (comp_proto_with_proto): Do not call groktypename(); types are no longer in raw declspec format. (objc_start_function): New function. (really_start_method): Call comp_proto_with_proto() instead of comp_method_with_proto(); call objc_start_function() instead of hand-crafting a function declarator. (continue_method_def, objc_expand_function_end): Remove functions. (get_super_receiver): Call objc_get_current_scope() instead of get_current_scope(); reference 'super_class' field (instead of 'class'). (finish_method_def): Rename to objc_finish_method_definition() and add a function decl parameter; move method encoding call from objc_expand_function_end(). (is_complex_decl, adorn_decl, gen_declarator, gen_declspecs, gen_declaration_1): Remove functions. (tmpbuf, RAW_DECLSPEC): Remove. (gen_declaration): Remove second parameter; simplify to deal with TYPE_P nodes instead of raw declspecs. (gen_type_name, gen_type_name_0): New functions. (gen_method_decl): Remove second parameter; call gen_type_name() instead of gen_declaration_1(). (dump_interface): Adjust calls to gen_declaration() and gen_method_decl(); do not allocate a separate string buffer. (init_objc): Allocate a larger string buffer to accommodate dump_interface(); adjust call to build_module_descriptor(); add call to build_module_initializer_routine() for the GNU runtime. (generate_classref_translation_entry): Do not call start_decl(); call finish_var_decl() instead of finish_decl(); call convert() instead of build_c_cast(). * objc-act.h (CLASS_OWN_IVARS): Remove accessor. (CLASS_BINFO_ELTS): Reduce from 6 to 5, now that CLASS_OWN_IVARS is gone. (OCTI_GNU_INIT_DECL, GNU_INIT_decl): New. (OCTI_ELLIPSIS_NODE, objc_ellipsis_node): Remove. (OCTI_ID_ID, id_type, objc_id_id): Rename to OCTI_ID_NAME, objc_object_type and objc_object_name, respectively. (OCTI_CLS_REF, OCTI_CLASS_NAME, objc_class_reference, objc_class_name): New. (IS_CLASS): New macro. (IS_ID, IS_SUPER): Robustify. (OCTI_EXECCLASS_DECL, execclass_decl): New. (finish_file, start_class, continue_class, finish_class, start_method_def, continue_method_def, finish_method_def, start_protocol, finish_protocol, objc_build_throw_stmt, objc_build_try_catch_finally_stmt, objc_build_synchronized_prologue, objc_build_synchronized_epilogue, objc_build_try_prologue, objc_build_try_epilogue, objc_build_catch_stmt, objc_build_catch_epilogue, objc_build_finally_prologue, objc_build_finally_epilogue, is_ivar, is_private, is_public, add_instance_variable, objc_add_method, get_super_receiver, objc_clear_super_receiver, get_class_ivars_from_name, get_class_reference, get_static_reference, get_object_reference, build_message_expr, finish_message_expr, build_selector_expr, build_ivar_reference, build_keyword_decl, build_method_decl, build_protocol_expr, build_objc_string_object, objc_declare_alias, objc_declare_class, objc_declare_protocols, objc_comptypes, objc_check_decl, build_encode_expr): Remove prototypes. (imp_count, cat_count): Make GGC-aware. (OBJC_SET_TYPE_NAME): New macro. From-SVN: r87168
2004-09-08 02:49:44 +02:00
/* Perhaps we already constructed a constant string just like this one? */
key.literal = string;
loc = htab_find_slot (string_htab, &key, INSERT);
desc = *loc;
if (!desc)
{
tree var;
Makefile.in (c-parse.o): Depend on $(C_COMMON_H). [gcc/ChangeLog] 2004-09-07 Ziemowit Laski <zlaski@apple.com> * Makefile.in (c-parse.o): Depend on $(C_COMMON_H). * c-parse.in: Include c-common.h instead of objc-act.h. (ivar_decl_list, ivar_decls, ivar_decl, ivars, ivar_declarator, myparms, myparm): Remove %type declarations. (methodtype, optparms, OBJC_TYPE_QUAL, objc_quals, objc_qual, objc_typename, objc_try_catch_stmt, optellipsis): Add %type declarations. (objc_inherit_code, objc_public_flag): Remove. (typespec_nonreserved_nonattr): Call objc_get_protocol_qualified_type() instead of get_static_reference() and get_protocol_reference(). (stmt_nocomp): Call grokparm() on @catch parameter. (objcdef): Move semantic action to objc_finish_implementation(). (classdef): Move semantic action to objc_start_class_interface(), objc_continue_interface(), objc_finish_interface(), objc_start_class_implementation(), objc_continue_implementation(), objc_start_category_interface() and objc_start_category_implementation(). (protocoldef): Move semantic actions to objc_start_protocol() and objc_finish_interface(). (ivar_decl_list): Remove nonterminal. (visibility_spec): Move semantic actions to objc_set_visibility(). (ivar_decls): Remove assignment to $$. (ivar_decl): Rephrase in terms of component_decl; call objc_add_instance_variable(). (ivars, ivar_declarator): Remove nonterminals. (opt_semi): New nonterminal. (methodtype): Remove semantic actions. (methoddef): Move semantic actions to objc_set_method_type(), objc_start_method_definition() and objc_finish_method_definition(). (methodproto): Move semantic actions to objc_set_method_type() and objc_add_method_declaration(). (methoddecl): Use objc_typename instead of typename; move semantic actions to objc_build_method_signature(). (optarglist, myxdecls, mydecl, myparms, myparm): Remove nonterminals. (optparmlist): Express in terms of optparms and optellipsis. (optparms, optellipsis, objc_qual, objc_quals, objc_typename): New nonterminals. (keyworddecl): Use objc_typename instead of typename. (rid_to_yy): Mark RID_IN, RID_OUT, RID_INOUT, RID_BYCOPY, RID_BYREF and RID_ONEWAY as returning OBJC_TYPE_QUAL to yyparse(). [gcc/objc/ChangeLog] 2004-09-07 Ziemowit Laski <zlaski@apple.com> * Make-lang.in (objc/objc-parse.o): Depend on $(C_COMMON_H) instead of objc/objc-act.h. (objc/objc-act.o): Depend on $(HASHTAB_H). * objc-act.c: Include hashtab.h; in ObjC++ mode, include cp-tree.h and objcp-decl.h instead of c-tree.h. (build_module_descriptor, get_class_ivars, synth_id_with_class_suffix, error_with_ivar, gen_method_decl, gen_declaration, setup_string_decl, build_protocol_template): Adjust prototypes. (build_module_initializer_routine, start_class, continue_class, finish_class, start_method_def, objc_start_function, start_protocol, build_method_decl, objc_add_method, add_instance_variable, build_ivar_reference, is_ivar, is_private, get_super_receiver, build_selector_table_decl, objc_push_parm, objc_get_parm_info, gen_type_name, gen_type_name_0, start_var_decl, finish_var_decl, create_field_decl): New prototypes. (objc_expand_function_end, comp_method_with_proto, objc_expr_last, gen_declaration_1, gen_declarator, is_complex_decl, adorn_decl, define_decl, create_builtin_decl, gen_declspecs): Remove prototypes. (TYPE_ID): Rename to OBJECT_TYPEDEF_NAME. (CLASS_TYPEDEF_NAME): New. (TAG_EXECCLASS): Change from a global variable to a #define. (TAG_RETURN_STRUCT): Delete. (TAG_GNUINIT): New, holds '__objc_gnu_init' name. (objc_inherit_code, objc_public_flag): New, moved from c-parse.in. (string_descriptor): New struct. (string_htab): New hash table. (string_hash, string_eq): New prototypes. (generate_struct_by_value_array): Call create_field_decl() instead of create_builtin_decl(). (objc_init): Do not initialize objc_ellipsis_node or TAG_EXECCLASS; In ObjC++ mode, call cxx_init() instead of c_objc_common_init(). (objc_finish_file): In ObjC++, call instantiate_pending_templates() and cp_finish_file(). (define_decl, get_static_reference, get_protocol_reference, create_builtin_decl): Remove functions. (objc_start_class_interface, objc_start_category_interface, objc_start_protocol, objc_continue_interface, objc_finish_interface, objc_start_class_implementation, objc_start_category_implementation, objc_continue_implementation, objc_finish_implementation, objc_set_visibility, objc_set_method_type, objc_build_method_signature, objc_add_method_declaration, objc_start_method_definition, objc_add_instance_variable, objc_get_protocol_qualified_type, create_field_decl, start_var_decl, finish_var_decl): New functions. (setup_string_decl): Simplify since it is only called once. (synth_module_prologue): Call build_class_template(); predefine 'id' and 'Class' as typedefs; rename 'temp_type' to 'type'; disable debug hooks for duration of function; fix GNU runtime messenger signatures to correspond to reality; forward-declare '__objc_exec_class' for the GNU runtime; call build_selector_table_decl(); in ObjC++ mode, generate 'extern "C" { ... }' wrappers around synthesized declarations; call build_protocol_template() and build_category_template(). (string_hash, string_eq): New functions. (objc_build_string_object): Check metaclass correctness only once; store string literals in hash table. (objc_build_constructor): Do not convert initializer elements; adjust for ObjC++ impedance mismatch. (build_objc_symtab_template): Call create_field_decl() instead of create_builtin_decl(). (init_objc_symtab): Add missing conversion to initializer element. (build_metadata_decl): Call start_var_decl() instead of define_decl(). (generate_objc_symtab_decl): Do not call build_category_template(); call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(). (build_module_descriptor): Call create_field_decl() instead of grokfield(); call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(); always mark module descriptor as used; move GNU runtime-specific functionality to build_module_initializer_routine(). (build_module_initializer_routine): New function, broken off of build_module_descriptor(). (objc_static_init_needed_p, objc_generate_static_init_call): New functions. (generate_static_references, generate_strings, build_selector_translation_table, generate_descriptor_table, generate_ivars_list, generate_dispatch_table, generate_category): Call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(); build a type directly instead of via groktypename(). (build_selector_reference_decl, build_selector_table_decl, build_class_reference_decl, build_protocol_reference, generate_objc_image_info): Call start_var_decl() instead of build_decl(). (build_selector_reference): For GNU runtime, do not call build_selector_reference_decl(). (build_selector, build_typed_selector_reference): Always convert result to the selector type. (add_objc_string): Cast return value to 'char *'. (build_method_prototype_template, build_selector_template, build_method_template): Use actual selector type for fields pointing to selectors. (finish_objc): For GNU runtime, call build_module_initializer_routine() after build_module_descriptor(). (generate_protocol_list, generate_shared_structures): Call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(); build a type directly instead of via groktypename(). (synth_id_with_class_suffix): Return a string. (get_arg_type_list): For instance methods, use the instance type for 'self'; do not call groktypename_in_parm_context(). (build_objc_string_decl): Squash redeclaration errors in ObjC++. (objc_is_class_name): Use OBJC_TYPE_NAME instead of TYPE_NAME; handle RECORD_TYPEs in ObjC as well as ObjC++. (objc_is_id): New function. (objc_is_object_ptr): Return the canonical type node. (objc_get_class_ivars): Simplify using get_class_ivars(). (get_class_ivars): Remove second parameter; create a fresh copy of the ivar list for each call; do not check for existence of super class. (objc_eh_runtime_type): Mark #ifndef OBJCPLUS. (objc_init_exceptions): When using SJLJ-style exceptions, require the use of '-fobjc-exceptions' flag; do not require it for DWARF-style exceptions. (objc_build_exc_ptr, next_sjlj_build_try_catch_finally): Use objc_object_type instead of objc_id_type. (objc_begin_catch_clause): Convert the incoming PARM_DECL into a VAR_DECL before placing it in the appropriate scope; do not call define_decl(); adjust call to c_begin_compound_stmt(); use objc_object_type instead of objc_id_type. (build_next_objc_exception_stuff): Call create_field_decl() instead of create_builtin_decl(); construct type directly instead of calling groktypename(); use OBJC_VOID_AT_END to mark end of function parameters. (build_private_template): Adjust call to get_class_ivars(); build a type directly instead of via groktypename(). (build_protocol_template, build_method_prototype_list_template, build_method_prototype_template, build_category_template, build_selector_template, build_class_template, build_super_template, build_ivar_template, build_ivar_list_template, build_method_list_template, build_method_template): Call create_field_decl() instead of grokfield(). (objc_method_parm_type): Do not call groktypename(). (generate_descriptor_table): Call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(). (generate_method_descriptors, build_protocol_initializer, generate_dispatch_tables, build_category_initializer, build_shared_structure_initializer): Do not call groktypename(). (generate_protocols): Call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(); do not call groktypename(). (error_with_ivar): Remove last parameter. (check_ivars): Do not iterate ovar CLASS_RAW_IVARS lists in addition to CLASS_IVARS lists; adjust calls to error_with_ivar(). (generate_ivar_lists): Convert one of the initializer elements; do not call groktypename(). (get_arg_type_list, start_method_def, gen_method_def): Account for new representation of variable arguments and '...' in Objective-C methods; add Objective-C++ impedance matching code. (is_objc_type_qualifier): Remove function. (adjust_type_for_id_default): Simplify; there is no longer a need to wade through declspecs. (lookup_interface, start_class, continue_class, finish_class, start_method_def, start_protocol, build_method_decl, objc_add_method, add_instance_variable, build_ivar_reference, is_ivar, is_private, get_super_receiver, objc_build_finally_epilogue): Make into static functions. (receiver_is_class_object): Use new IS_CLASS() macro. (objc_build_message_expr): Tweak ObjC++ message argument handling; call objc_finish_message_expr() instead of finish_message_expr(). (finish_message_expr): Rename to objc_finish_message_expr(); use OBJC_TYPE_NAME and OBJC_SET_TYPE_NAME macros instead of TYPE_NAME. call gen_type_name() instead of gen_declaration(); call objc_is_id() instead of using IS_ID and IS_CLASS; Use objc_class_name instead of calling get_identifier("Class"); handle CONVERT_EXPRs in receiver. (build_objc_method_call, warn_with_method): Do not call groktypename(). (build_ivar_reference): Call convert() instead of clobbering in a type. (hash_init): Initialize string_htab hash table. (add_instance_variable): Simplify parameter list; do not call grokfield(); do not populate CLASS_IVARS list. (start_class): Check for the existence of super class, if one was specified. (continue_class): Use CLASS_RAW_IVARS rather than CLASS_IVARS; do not call build_class_template(); adjust call to get_class_ivars(); call build_decl(), pushdecl() and finish_decl() instead of define_decl(). (finish_class): Call build_decl(), pushdecl() and finish_decl() instead of define_decl(). (add_protocols): Use PROTOCOL_BINFO_ELTS for the tree vector size. (start_protocol): Do not call build_protocol_template(); use PROTOCOL_BINFO_ELTS for the tree vector size. (encode_type_qualifiers): Do not handle the 'const' qualifier here. (encode_pointer): Encode 'const char *' as 'r*', for backwards compatibility. (encode_array): Use HOST_WIDE_INT_PRINT_DEC instead of "%ld". (encode_type): Handle the 'const' qualifier here. (objc_parmlist): New global variable, sued by objc_push_parm and objc_get_parm_info(). (objc_push_parm, objc_get_parm_info): New functions. (objc_expr_last): Remove function. (synth_self_and_ucmd_args): For instance methods, use the instance type for 'self'; call objc_push_parm() instead of push_parm_decl(). (start_method_def): Do not call push_scope(), declare_parm_level(), pop_scope(), push_parm_decl(), store_parm_decls() or objc_expr_last(); just use objc_push_parm() and objc_get_parm_info(). (comp_method_with_proto): Remove function. (objc_types_are_equivalent): Strip away indirections before comparing underlying types. (comp_proto_with_proto): Do not call groktypename(); types are no longer in raw declspec format. (objc_start_function): New function. (really_start_method): Call comp_proto_with_proto() instead of comp_method_with_proto(); call objc_start_function() instead of hand-crafting a function declarator. (continue_method_def, objc_expand_function_end): Remove functions. (get_super_receiver): Call objc_get_current_scope() instead of get_current_scope(); reference 'super_class' field (instead of 'class'). (finish_method_def): Rename to objc_finish_method_definition() and add a function decl parameter; move method encoding call from objc_expand_function_end(). (is_complex_decl, adorn_decl, gen_declarator, gen_declspecs, gen_declaration_1): Remove functions. (tmpbuf, RAW_DECLSPEC): Remove. (gen_declaration): Remove second parameter; simplify to deal with TYPE_P nodes instead of raw declspecs. (gen_type_name, gen_type_name_0): New functions. (gen_method_decl): Remove second parameter; call gen_type_name() instead of gen_declaration_1(). (dump_interface): Adjust calls to gen_declaration() and gen_method_decl(); do not allocate a separate string buffer. (init_objc): Allocate a larger string buffer to accommodate dump_interface(); adjust call to build_module_descriptor(); add call to build_module_initializer_routine() for the GNU runtime. (generate_classref_translation_entry): Do not call start_decl(); call finish_var_decl() instead of finish_decl(); call convert() instead of build_c_cast(). * objc-act.h (CLASS_OWN_IVARS): Remove accessor. (CLASS_BINFO_ELTS): Reduce from 6 to 5, now that CLASS_OWN_IVARS is gone. (OCTI_GNU_INIT_DECL, GNU_INIT_decl): New. (OCTI_ELLIPSIS_NODE, objc_ellipsis_node): Remove. (OCTI_ID_ID, id_type, objc_id_id): Rename to OCTI_ID_NAME, objc_object_type and objc_object_name, respectively. (OCTI_CLS_REF, OCTI_CLASS_NAME, objc_class_reference, objc_class_name): New. (IS_CLASS): New macro. (IS_ID, IS_SUPER): Robustify. (OCTI_EXECCLASS_DECL, execclass_decl): New. (finish_file, start_class, continue_class, finish_class, start_method_def, continue_method_def, finish_method_def, start_protocol, finish_protocol, objc_build_throw_stmt, objc_build_try_catch_finally_stmt, objc_build_synchronized_prologue, objc_build_synchronized_epilogue, objc_build_try_prologue, objc_build_try_epilogue, objc_build_catch_stmt, objc_build_catch_epilogue, objc_build_finally_prologue, objc_build_finally_epilogue, is_ivar, is_private, is_public, add_instance_variable, objc_add_method, get_super_receiver, objc_clear_super_receiver, get_class_ivars_from_name, get_class_reference, get_static_reference, get_object_reference, build_message_expr, finish_message_expr, build_selector_expr, build_ivar_reference, build_keyword_decl, build_method_decl, build_protocol_expr, build_objc_string_object, objc_declare_alias, objc_declare_class, objc_declare_protocols, objc_comptypes, objc_check_decl, build_encode_expr): Remove prototypes. (imp_count, cat_count): Make GGC-aware. (OBJC_SET_TYPE_NAME): New macro. From-SVN: r87168
2004-09-08 02:49:44 +02:00
*loc = desc = ggc_alloc (sizeof (*desc));
desc->literal = string;
/* GNU: (NXConstantString *) & ((__builtin_ObjCString) { NULL, string, length }) */
/* NeXT: (NSConstantString *) & ((__builtin_ObjCString) { isa, string, length }) */
fields = TYPE_FIELDS (internal_const_str_type);
Makefile.in (c-parse.o): Depend on $(C_COMMON_H). [gcc/ChangeLog] 2004-09-07 Ziemowit Laski <zlaski@apple.com> * Makefile.in (c-parse.o): Depend on $(C_COMMON_H). * c-parse.in: Include c-common.h instead of objc-act.h. (ivar_decl_list, ivar_decls, ivar_decl, ivars, ivar_declarator, myparms, myparm): Remove %type declarations. (methodtype, optparms, OBJC_TYPE_QUAL, objc_quals, objc_qual, objc_typename, objc_try_catch_stmt, optellipsis): Add %type declarations. (objc_inherit_code, objc_public_flag): Remove. (typespec_nonreserved_nonattr): Call objc_get_protocol_qualified_type() instead of get_static_reference() and get_protocol_reference(). (stmt_nocomp): Call grokparm() on @catch parameter. (objcdef): Move semantic action to objc_finish_implementation(). (classdef): Move semantic action to objc_start_class_interface(), objc_continue_interface(), objc_finish_interface(), objc_start_class_implementation(), objc_continue_implementation(), objc_start_category_interface() and objc_start_category_implementation(). (protocoldef): Move semantic actions to objc_start_protocol() and objc_finish_interface(). (ivar_decl_list): Remove nonterminal. (visibility_spec): Move semantic actions to objc_set_visibility(). (ivar_decls): Remove assignment to $$. (ivar_decl): Rephrase in terms of component_decl; call objc_add_instance_variable(). (ivars, ivar_declarator): Remove nonterminals. (opt_semi): New nonterminal. (methodtype): Remove semantic actions. (methoddef): Move semantic actions to objc_set_method_type(), objc_start_method_definition() and objc_finish_method_definition(). (methodproto): Move semantic actions to objc_set_method_type() and objc_add_method_declaration(). (methoddecl): Use objc_typename instead of typename; move semantic actions to objc_build_method_signature(). (optarglist, myxdecls, mydecl, myparms, myparm): Remove nonterminals. (optparmlist): Express in terms of optparms and optellipsis. (optparms, optellipsis, objc_qual, objc_quals, objc_typename): New nonterminals. (keyworddecl): Use objc_typename instead of typename. (rid_to_yy): Mark RID_IN, RID_OUT, RID_INOUT, RID_BYCOPY, RID_BYREF and RID_ONEWAY as returning OBJC_TYPE_QUAL to yyparse(). [gcc/objc/ChangeLog] 2004-09-07 Ziemowit Laski <zlaski@apple.com> * Make-lang.in (objc/objc-parse.o): Depend on $(C_COMMON_H) instead of objc/objc-act.h. (objc/objc-act.o): Depend on $(HASHTAB_H). * objc-act.c: Include hashtab.h; in ObjC++ mode, include cp-tree.h and objcp-decl.h instead of c-tree.h. (build_module_descriptor, get_class_ivars, synth_id_with_class_suffix, error_with_ivar, gen_method_decl, gen_declaration, setup_string_decl, build_protocol_template): Adjust prototypes. (build_module_initializer_routine, start_class, continue_class, finish_class, start_method_def, objc_start_function, start_protocol, build_method_decl, objc_add_method, add_instance_variable, build_ivar_reference, is_ivar, is_private, get_super_receiver, build_selector_table_decl, objc_push_parm, objc_get_parm_info, gen_type_name, gen_type_name_0, start_var_decl, finish_var_decl, create_field_decl): New prototypes. (objc_expand_function_end, comp_method_with_proto, objc_expr_last, gen_declaration_1, gen_declarator, is_complex_decl, adorn_decl, define_decl, create_builtin_decl, gen_declspecs): Remove prototypes. (TYPE_ID): Rename to OBJECT_TYPEDEF_NAME. (CLASS_TYPEDEF_NAME): New. (TAG_EXECCLASS): Change from a global variable to a #define. (TAG_RETURN_STRUCT): Delete. (TAG_GNUINIT): New, holds '__objc_gnu_init' name. (objc_inherit_code, objc_public_flag): New, moved from c-parse.in. (string_descriptor): New struct. (string_htab): New hash table. (string_hash, string_eq): New prototypes. (generate_struct_by_value_array): Call create_field_decl() instead of create_builtin_decl(). (objc_init): Do not initialize objc_ellipsis_node or TAG_EXECCLASS; In ObjC++ mode, call cxx_init() instead of c_objc_common_init(). (objc_finish_file): In ObjC++, call instantiate_pending_templates() and cp_finish_file(). (define_decl, get_static_reference, get_protocol_reference, create_builtin_decl): Remove functions. (objc_start_class_interface, objc_start_category_interface, objc_start_protocol, objc_continue_interface, objc_finish_interface, objc_start_class_implementation, objc_start_category_implementation, objc_continue_implementation, objc_finish_implementation, objc_set_visibility, objc_set_method_type, objc_build_method_signature, objc_add_method_declaration, objc_start_method_definition, objc_add_instance_variable, objc_get_protocol_qualified_type, create_field_decl, start_var_decl, finish_var_decl): New functions. (setup_string_decl): Simplify since it is only called once. (synth_module_prologue): Call build_class_template(); predefine 'id' and 'Class' as typedefs; rename 'temp_type' to 'type'; disable debug hooks for duration of function; fix GNU runtime messenger signatures to correspond to reality; forward-declare '__objc_exec_class' for the GNU runtime; call build_selector_table_decl(); in ObjC++ mode, generate 'extern "C" { ... }' wrappers around synthesized declarations; call build_protocol_template() and build_category_template(). (string_hash, string_eq): New functions. (objc_build_string_object): Check metaclass correctness only once; store string literals in hash table. (objc_build_constructor): Do not convert initializer elements; adjust for ObjC++ impedance mismatch. (build_objc_symtab_template): Call create_field_decl() instead of create_builtin_decl(). (init_objc_symtab): Add missing conversion to initializer element. (build_metadata_decl): Call start_var_decl() instead of define_decl(). (generate_objc_symtab_decl): Do not call build_category_template(); call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(). (build_module_descriptor): Call create_field_decl() instead of grokfield(); call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(); always mark module descriptor as used; move GNU runtime-specific functionality to build_module_initializer_routine(). (build_module_initializer_routine): New function, broken off of build_module_descriptor(). (objc_static_init_needed_p, objc_generate_static_init_call): New functions. (generate_static_references, generate_strings, build_selector_translation_table, generate_descriptor_table, generate_ivars_list, generate_dispatch_table, generate_category): Call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(); build a type directly instead of via groktypename(). (build_selector_reference_decl, build_selector_table_decl, build_class_reference_decl, build_protocol_reference, generate_objc_image_info): Call start_var_decl() instead of build_decl(). (build_selector_reference): For GNU runtime, do not call build_selector_reference_decl(). (build_selector, build_typed_selector_reference): Always convert result to the selector type. (add_objc_string): Cast return value to 'char *'. (build_method_prototype_template, build_selector_template, build_method_template): Use actual selector type for fields pointing to selectors. (finish_objc): For GNU runtime, call build_module_initializer_routine() after build_module_descriptor(). (generate_protocol_list, generate_shared_structures): Call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(); build a type directly instead of via groktypename(). (synth_id_with_class_suffix): Return a string. (get_arg_type_list): For instance methods, use the instance type for 'self'; do not call groktypename_in_parm_context(). (build_objc_string_decl): Squash redeclaration errors in ObjC++. (objc_is_class_name): Use OBJC_TYPE_NAME instead of TYPE_NAME; handle RECORD_TYPEs in ObjC as well as ObjC++. (objc_is_id): New function. (objc_is_object_ptr): Return the canonical type node. (objc_get_class_ivars): Simplify using get_class_ivars(). (get_class_ivars): Remove second parameter; create a fresh copy of the ivar list for each call; do not check for existence of super class. (objc_eh_runtime_type): Mark #ifndef OBJCPLUS. (objc_init_exceptions): When using SJLJ-style exceptions, require the use of '-fobjc-exceptions' flag; do not require it for DWARF-style exceptions. (objc_build_exc_ptr, next_sjlj_build_try_catch_finally): Use objc_object_type instead of objc_id_type. (objc_begin_catch_clause): Convert the incoming PARM_DECL into a VAR_DECL before placing it in the appropriate scope; do not call define_decl(); adjust call to c_begin_compound_stmt(); use objc_object_type instead of objc_id_type. (build_next_objc_exception_stuff): Call create_field_decl() instead of create_builtin_decl(); construct type directly instead of calling groktypename(); use OBJC_VOID_AT_END to mark end of function parameters. (build_private_template): Adjust call to get_class_ivars(); build a type directly instead of via groktypename(). (build_protocol_template, build_method_prototype_list_template, build_method_prototype_template, build_category_template, build_selector_template, build_class_template, build_super_template, build_ivar_template, build_ivar_list_template, build_method_list_template, build_method_template): Call create_field_decl() instead of grokfield(). (objc_method_parm_type): Do not call groktypename(). (generate_descriptor_table): Call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(). (generate_method_descriptors, build_protocol_initializer, generate_dispatch_tables, build_category_initializer, build_shared_structure_initializer): Do not call groktypename(). (generate_protocols): Call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(); do not call groktypename(). (error_with_ivar): Remove last parameter. (check_ivars): Do not iterate ovar CLASS_RAW_IVARS lists in addition to CLASS_IVARS lists; adjust calls to error_with_ivar(). (generate_ivar_lists): Convert one of the initializer elements; do not call groktypename(). (get_arg_type_list, start_method_def, gen_method_def): Account for new representation of variable arguments and '...' in Objective-C methods; add Objective-C++ impedance matching code. (is_objc_type_qualifier): Remove function. (adjust_type_for_id_default): Simplify; there is no longer a need to wade through declspecs. (lookup_interface, start_class, continue_class, finish_class, start_method_def, start_protocol, build_method_decl, objc_add_method, add_instance_variable, build_ivar_reference, is_ivar, is_private, get_super_receiver, objc_build_finally_epilogue): Make into static functions. (receiver_is_class_object): Use new IS_CLASS() macro. (objc_build_message_expr): Tweak ObjC++ message argument handling; call objc_finish_message_expr() instead of finish_message_expr(). (finish_message_expr): Rename to objc_finish_message_expr(); use OBJC_TYPE_NAME and OBJC_SET_TYPE_NAME macros instead of TYPE_NAME. call gen_type_name() instead of gen_declaration(); call objc_is_id() instead of using IS_ID and IS_CLASS; Use objc_class_name instead of calling get_identifier("Class"); handle CONVERT_EXPRs in receiver. (build_objc_method_call, warn_with_method): Do not call groktypename(). (build_ivar_reference): Call convert() instead of clobbering in a type. (hash_init): Initialize string_htab hash table. (add_instance_variable): Simplify parameter list; do not call grokfield(); do not populate CLASS_IVARS list. (start_class): Check for the existence of super class, if one was specified. (continue_class): Use CLASS_RAW_IVARS rather than CLASS_IVARS; do not call build_class_template(); adjust call to get_class_ivars(); call build_decl(), pushdecl() and finish_decl() instead of define_decl(). (finish_class): Call build_decl(), pushdecl() and finish_decl() instead of define_decl(). (add_protocols): Use PROTOCOL_BINFO_ELTS for the tree vector size. (start_protocol): Do not call build_protocol_template(); use PROTOCOL_BINFO_ELTS for the tree vector size. (encode_type_qualifiers): Do not handle the 'const' qualifier here. (encode_pointer): Encode 'const char *' as 'r*', for backwards compatibility. (encode_array): Use HOST_WIDE_INT_PRINT_DEC instead of "%ld". (encode_type): Handle the 'const' qualifier here. (objc_parmlist): New global variable, sued by objc_push_parm and objc_get_parm_info(). (objc_push_parm, objc_get_parm_info): New functions. (objc_expr_last): Remove function. (synth_self_and_ucmd_args): For instance methods, use the instance type for 'self'; call objc_push_parm() instead of push_parm_decl(). (start_method_def): Do not call push_scope(), declare_parm_level(), pop_scope(), push_parm_decl(), store_parm_decls() or objc_expr_last(); just use objc_push_parm() and objc_get_parm_info(). (comp_method_with_proto): Remove function. (objc_types_are_equivalent): Strip away indirections before comparing underlying types. (comp_proto_with_proto): Do not call groktypename(); types are no longer in raw declspec format. (objc_start_function): New function. (really_start_method): Call comp_proto_with_proto() instead of comp_method_with_proto(); call objc_start_function() instead of hand-crafting a function declarator. (continue_method_def, objc_expand_function_end): Remove functions. (get_super_receiver): Call objc_get_current_scope() instead of get_current_scope(); reference 'super_class' field (instead of 'class'). (finish_method_def): Rename to objc_finish_method_definition() and add a function decl parameter; move method encoding call from objc_expand_function_end(). (is_complex_decl, adorn_decl, gen_declarator, gen_declspecs, gen_declaration_1): Remove functions. (tmpbuf, RAW_DECLSPEC): Remove. (gen_declaration): Remove second parameter; simplify to deal with TYPE_P nodes instead of raw declspecs. (gen_type_name, gen_type_name_0): New functions. (gen_method_decl): Remove second parameter; call gen_type_name() instead of gen_declaration_1(). (dump_interface): Adjust calls to gen_declaration() and gen_method_decl(); do not allocate a separate string buffer. (init_objc): Allocate a larger string buffer to accommodate dump_interface(); adjust call to build_module_descriptor(); add call to build_module_initializer_routine() for the GNU runtime. (generate_classref_translation_entry): Do not call start_decl(); call finish_var_decl() instead of finish_decl(); call convert() instead of build_c_cast(). * objc-act.h (CLASS_OWN_IVARS): Remove accessor. (CLASS_BINFO_ELTS): Reduce from 6 to 5, now that CLASS_OWN_IVARS is gone. (OCTI_GNU_INIT_DECL, GNU_INIT_decl): New. (OCTI_ELLIPSIS_NODE, objc_ellipsis_node): Remove. (OCTI_ID_ID, id_type, objc_id_id): Rename to OCTI_ID_NAME, objc_object_type and objc_object_name, respectively. (OCTI_CLS_REF, OCTI_CLASS_NAME, objc_class_reference, objc_class_name): New. (IS_CLASS): New macro. (IS_ID, IS_SUPER): Robustify. (OCTI_EXECCLASS_DECL, execclass_decl): New. (finish_file, start_class, continue_class, finish_class, start_method_def, continue_method_def, finish_method_def, start_protocol, finish_protocol, objc_build_throw_stmt, objc_build_try_catch_finally_stmt, objc_build_synchronized_prologue, objc_build_synchronized_epilogue, objc_build_try_prologue, objc_build_try_epilogue, objc_build_catch_stmt, objc_build_catch_epilogue, objc_build_finally_prologue, objc_build_finally_epilogue, is_ivar, is_private, is_public, add_instance_variable, objc_add_method, get_super_receiver, objc_clear_super_receiver, get_class_ivars_from_name, get_class_reference, get_static_reference, get_object_reference, build_message_expr, finish_message_expr, build_selector_expr, build_ivar_reference, build_keyword_decl, build_method_decl, build_protocol_expr, build_objc_string_object, objc_declare_alias, objc_declare_class, objc_declare_protocols, objc_comptypes, objc_check_decl, build_encode_expr): Remove prototypes. (imp_count, cat_count): Make GGC-aware. (OBJC_SET_TYPE_NAME): New macro. From-SVN: r87168
2004-09-08 02:49:44 +02:00
initlist
= build_tree_list (fields,
flag_next_runtime
? build_unary_op (ADDR_EXPR, string_class_decl, 0)
: build_int_cst (NULL_TREE, 0));
fields = TREE_CHAIN (fields);
initlist = tree_cons (fields, build_unary_op (ADDR_EXPR, string, 1),
initlist);
fields = TREE_CHAIN (fields);
initlist = tree_cons (fields, build_int_cst (NULL_TREE, length),
initlist);
constructor = objc_build_constructor (internal_const_str_type,
Makefile.in (c-parse.o): Depend on $(C_COMMON_H). [gcc/ChangeLog] 2004-09-07 Ziemowit Laski <zlaski@apple.com> * Makefile.in (c-parse.o): Depend on $(C_COMMON_H). * c-parse.in: Include c-common.h instead of objc-act.h. (ivar_decl_list, ivar_decls, ivar_decl, ivars, ivar_declarator, myparms, myparm): Remove %type declarations. (methodtype, optparms, OBJC_TYPE_QUAL, objc_quals, objc_qual, objc_typename, objc_try_catch_stmt, optellipsis): Add %type declarations. (objc_inherit_code, objc_public_flag): Remove. (typespec_nonreserved_nonattr): Call objc_get_protocol_qualified_type() instead of get_static_reference() and get_protocol_reference(). (stmt_nocomp): Call grokparm() on @catch parameter. (objcdef): Move semantic action to objc_finish_implementation(). (classdef): Move semantic action to objc_start_class_interface(), objc_continue_interface(), objc_finish_interface(), objc_start_class_implementation(), objc_continue_implementation(), objc_start_category_interface() and objc_start_category_implementation(). (protocoldef): Move semantic actions to objc_start_protocol() and objc_finish_interface(). (ivar_decl_list): Remove nonterminal. (visibility_spec): Move semantic actions to objc_set_visibility(). (ivar_decls): Remove assignment to $$. (ivar_decl): Rephrase in terms of component_decl; call objc_add_instance_variable(). (ivars, ivar_declarator): Remove nonterminals. (opt_semi): New nonterminal. (methodtype): Remove semantic actions. (methoddef): Move semantic actions to objc_set_method_type(), objc_start_method_definition() and objc_finish_method_definition(). (methodproto): Move semantic actions to objc_set_method_type() and objc_add_method_declaration(). (methoddecl): Use objc_typename instead of typename; move semantic actions to objc_build_method_signature(). (optarglist, myxdecls, mydecl, myparms, myparm): Remove nonterminals. (optparmlist): Express in terms of optparms and optellipsis. (optparms, optellipsis, objc_qual, objc_quals, objc_typename): New nonterminals. (keyworddecl): Use objc_typename instead of typename. (rid_to_yy): Mark RID_IN, RID_OUT, RID_INOUT, RID_BYCOPY, RID_BYREF and RID_ONEWAY as returning OBJC_TYPE_QUAL to yyparse(). [gcc/objc/ChangeLog] 2004-09-07 Ziemowit Laski <zlaski@apple.com> * Make-lang.in (objc/objc-parse.o): Depend on $(C_COMMON_H) instead of objc/objc-act.h. (objc/objc-act.o): Depend on $(HASHTAB_H). * objc-act.c: Include hashtab.h; in ObjC++ mode, include cp-tree.h and objcp-decl.h instead of c-tree.h. (build_module_descriptor, get_class_ivars, synth_id_with_class_suffix, error_with_ivar, gen_method_decl, gen_declaration, setup_string_decl, build_protocol_template): Adjust prototypes. (build_module_initializer_routine, start_class, continue_class, finish_class, start_method_def, objc_start_function, start_protocol, build_method_decl, objc_add_method, add_instance_variable, build_ivar_reference, is_ivar, is_private, get_super_receiver, build_selector_table_decl, objc_push_parm, objc_get_parm_info, gen_type_name, gen_type_name_0, start_var_decl, finish_var_decl, create_field_decl): New prototypes. (objc_expand_function_end, comp_method_with_proto, objc_expr_last, gen_declaration_1, gen_declarator, is_complex_decl, adorn_decl, define_decl, create_builtin_decl, gen_declspecs): Remove prototypes. (TYPE_ID): Rename to OBJECT_TYPEDEF_NAME. (CLASS_TYPEDEF_NAME): New. (TAG_EXECCLASS): Change from a global variable to a #define. (TAG_RETURN_STRUCT): Delete. (TAG_GNUINIT): New, holds '__objc_gnu_init' name. (objc_inherit_code, objc_public_flag): New, moved from c-parse.in. (string_descriptor): New struct. (string_htab): New hash table. (string_hash, string_eq): New prototypes. (generate_struct_by_value_array): Call create_field_decl() instead of create_builtin_decl(). (objc_init): Do not initialize objc_ellipsis_node or TAG_EXECCLASS; In ObjC++ mode, call cxx_init() instead of c_objc_common_init(). (objc_finish_file): In ObjC++, call instantiate_pending_templates() and cp_finish_file(). (define_decl, get_static_reference, get_protocol_reference, create_builtin_decl): Remove functions. (objc_start_class_interface, objc_start_category_interface, objc_start_protocol, objc_continue_interface, objc_finish_interface, objc_start_class_implementation, objc_start_category_implementation, objc_continue_implementation, objc_finish_implementation, objc_set_visibility, objc_set_method_type, objc_build_method_signature, objc_add_method_declaration, objc_start_method_definition, objc_add_instance_variable, objc_get_protocol_qualified_type, create_field_decl, start_var_decl, finish_var_decl): New functions. (setup_string_decl): Simplify since it is only called once. (synth_module_prologue): Call build_class_template(); predefine 'id' and 'Class' as typedefs; rename 'temp_type' to 'type'; disable debug hooks for duration of function; fix GNU runtime messenger signatures to correspond to reality; forward-declare '__objc_exec_class' for the GNU runtime; call build_selector_table_decl(); in ObjC++ mode, generate 'extern "C" { ... }' wrappers around synthesized declarations; call build_protocol_template() and build_category_template(). (string_hash, string_eq): New functions. (objc_build_string_object): Check metaclass correctness only once; store string literals in hash table. (objc_build_constructor): Do not convert initializer elements; adjust for ObjC++ impedance mismatch. (build_objc_symtab_template): Call create_field_decl() instead of create_builtin_decl(). (init_objc_symtab): Add missing conversion to initializer element. (build_metadata_decl): Call start_var_decl() instead of define_decl(). (generate_objc_symtab_decl): Do not call build_category_template(); call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(). (build_module_descriptor): Call create_field_decl() instead of grokfield(); call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(); always mark module descriptor as used; move GNU runtime-specific functionality to build_module_initializer_routine(). (build_module_initializer_routine): New function, broken off of build_module_descriptor(). (objc_static_init_needed_p, objc_generate_static_init_call): New functions. (generate_static_references, generate_strings, build_selector_translation_table, generate_descriptor_table, generate_ivars_list, generate_dispatch_table, generate_category): Call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(); build a type directly instead of via groktypename(). (build_selector_reference_decl, build_selector_table_decl, build_class_reference_decl, build_protocol_reference, generate_objc_image_info): Call start_var_decl() instead of build_decl(). (build_selector_reference): For GNU runtime, do not call build_selector_reference_decl(). (build_selector, build_typed_selector_reference): Always convert result to the selector type. (add_objc_string): Cast return value to 'char *'. (build_method_prototype_template, build_selector_template, build_method_template): Use actual selector type for fields pointing to selectors. (finish_objc): For GNU runtime, call build_module_initializer_routine() after build_module_descriptor(). (generate_protocol_list, generate_shared_structures): Call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(); build a type directly instead of via groktypename(). (synth_id_with_class_suffix): Return a string. (get_arg_type_list): For instance methods, use the instance type for 'self'; do not call groktypename_in_parm_context(). (build_objc_string_decl): Squash redeclaration errors in ObjC++. (objc_is_class_name): Use OBJC_TYPE_NAME instead of TYPE_NAME; handle RECORD_TYPEs in ObjC as well as ObjC++. (objc_is_id): New function. (objc_is_object_ptr): Return the canonical type node. (objc_get_class_ivars): Simplify using get_class_ivars(). (get_class_ivars): Remove second parameter; create a fresh copy of the ivar list for each call; do not check for existence of super class. (objc_eh_runtime_type): Mark #ifndef OBJCPLUS. (objc_init_exceptions): When using SJLJ-style exceptions, require the use of '-fobjc-exceptions' flag; do not require it for DWARF-style exceptions. (objc_build_exc_ptr, next_sjlj_build_try_catch_finally): Use objc_object_type instead of objc_id_type. (objc_begin_catch_clause): Convert the incoming PARM_DECL into a VAR_DECL before placing it in the appropriate scope; do not call define_decl(); adjust call to c_begin_compound_stmt(); use objc_object_type instead of objc_id_type. (build_next_objc_exception_stuff): Call create_field_decl() instead of create_builtin_decl(); construct type directly instead of calling groktypename(); use OBJC_VOID_AT_END to mark end of function parameters. (build_private_template): Adjust call to get_class_ivars(); build a type directly instead of via groktypename(). (build_protocol_template, build_method_prototype_list_template, build_method_prototype_template, build_category_template, build_selector_template, build_class_template, build_super_template, build_ivar_template, build_ivar_list_template, build_method_list_template, build_method_template): Call create_field_decl() instead of grokfield(). (objc_method_parm_type): Do not call groktypename(). (generate_descriptor_table): Call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(). (generate_method_descriptors, build_protocol_initializer, generate_dispatch_tables, build_category_initializer, build_shared_structure_initializer): Do not call groktypename(). (generate_protocols): Call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(); do not call groktypename(). (error_with_ivar): Remove last parameter. (check_ivars): Do not iterate ovar CLASS_RAW_IVARS lists in addition to CLASS_IVARS lists; adjust calls to error_with_ivar(). (generate_ivar_lists): Convert one of the initializer elements; do not call groktypename(). (get_arg_type_list, start_method_def, gen_method_def): Account for new representation of variable arguments and '...' in Objective-C methods; add Objective-C++ impedance matching code. (is_objc_type_qualifier): Remove function. (adjust_type_for_id_default): Simplify; there is no longer a need to wade through declspecs. (lookup_interface, start_class, continue_class, finish_class, start_method_def, start_protocol, build_method_decl, objc_add_method, add_instance_variable, build_ivar_reference, is_ivar, is_private, get_super_receiver, objc_build_finally_epilogue): Make into static functions. (receiver_is_class_object): Use new IS_CLASS() macro. (objc_build_message_expr): Tweak ObjC++ message argument handling; call objc_finish_message_expr() instead of finish_message_expr(). (finish_message_expr): Rename to objc_finish_message_expr(); use OBJC_TYPE_NAME and OBJC_SET_TYPE_NAME macros instead of TYPE_NAME. call gen_type_name() instead of gen_declaration(); call objc_is_id() instead of using IS_ID and IS_CLASS; Use objc_class_name instead of calling get_identifier("Class"); handle CONVERT_EXPRs in receiver. (build_objc_method_call, warn_with_method): Do not call groktypename(). (build_ivar_reference): Call convert() instead of clobbering in a type. (hash_init): Initialize string_htab hash table. (add_instance_variable): Simplify parameter list; do not call grokfield(); do not populate CLASS_IVARS list. (start_class): Check for the existence of super class, if one was specified. (continue_class): Use CLASS_RAW_IVARS rather than CLASS_IVARS; do not call build_class_template(); adjust call to get_class_ivars(); call build_decl(), pushdecl() and finish_decl() instead of define_decl(). (finish_class): Call build_decl(), pushdecl() and finish_decl() instead of define_decl(). (add_protocols): Use PROTOCOL_BINFO_ELTS for the tree vector size. (start_protocol): Do not call build_protocol_template(); use PROTOCOL_BINFO_ELTS for the tree vector size. (encode_type_qualifiers): Do not handle the 'const' qualifier here. (encode_pointer): Encode 'const char *' as 'r*', for backwards compatibility. (encode_array): Use HOST_WIDE_INT_PRINT_DEC instead of "%ld". (encode_type): Handle the 'const' qualifier here. (objc_parmlist): New global variable, sued by objc_push_parm and objc_get_parm_info(). (objc_push_parm, objc_get_parm_info): New functions. (objc_expr_last): Remove function. (synth_self_and_ucmd_args): For instance methods, use the instance type for 'self'; call objc_push_parm() instead of push_parm_decl(). (start_method_def): Do not call push_scope(), declare_parm_level(), pop_scope(), push_parm_decl(), store_parm_decls() or objc_expr_last(); just use objc_push_parm() and objc_get_parm_info(). (comp_method_with_proto): Remove function. (objc_types_are_equivalent): Strip away indirections before comparing underlying types. (comp_proto_with_proto): Do not call groktypename(); types are no longer in raw declspec format. (objc_start_function): New function. (really_start_method): Call comp_proto_with_proto() instead of comp_method_with_proto(); call objc_start_function() instead of hand-crafting a function declarator. (continue_method_def, objc_expand_function_end): Remove functions. (get_super_receiver): Call objc_get_current_scope() instead of get_current_scope(); reference 'super_class' field (instead of 'class'). (finish_method_def): Rename to objc_finish_method_definition() and add a function decl parameter; move method encoding call from objc_expand_function_end(). (is_complex_decl, adorn_decl, gen_declarator, gen_declspecs, gen_declaration_1): Remove functions. (tmpbuf, RAW_DECLSPEC): Remove. (gen_declaration): Remove second parameter; simplify to deal with TYPE_P nodes instead of raw declspecs. (gen_type_name, gen_type_name_0): New functions. (gen_method_decl): Remove second parameter; call gen_type_name() instead of gen_declaration_1(). (dump_interface): Adjust calls to gen_declaration() and gen_method_decl(); do not allocate a separate string buffer. (init_objc): Allocate a larger string buffer to accommodate dump_interface(); adjust call to build_module_descriptor(); add call to build_module_initializer_routine() for the GNU runtime. (generate_classref_translation_entry): Do not call start_decl(); call finish_var_decl() instead of finish_decl(); call convert() instead of build_c_cast(). * objc-act.h (CLASS_OWN_IVARS): Remove accessor. (CLASS_BINFO_ELTS): Reduce from 6 to 5, now that CLASS_OWN_IVARS is gone. (OCTI_GNU_INIT_DECL, GNU_INIT_decl): New. (OCTI_ELLIPSIS_NODE, objc_ellipsis_node): Remove. (OCTI_ID_ID, id_type, objc_id_id): Rename to OCTI_ID_NAME, objc_object_type and objc_object_name, respectively. (OCTI_CLS_REF, OCTI_CLASS_NAME, objc_class_reference, objc_class_name): New. (IS_CLASS): New macro. (IS_ID, IS_SUPER): Robustify. (OCTI_EXECCLASS_DECL, execclass_decl): New. (finish_file, start_class, continue_class, finish_class, start_method_def, continue_method_def, finish_method_def, start_protocol, finish_protocol, objc_build_throw_stmt, objc_build_try_catch_finally_stmt, objc_build_synchronized_prologue, objc_build_synchronized_epilogue, objc_build_try_prologue, objc_build_try_epilogue, objc_build_catch_stmt, objc_build_catch_epilogue, objc_build_finally_prologue, objc_build_finally_epilogue, is_ivar, is_private, is_public, add_instance_variable, objc_add_method, get_super_receiver, objc_clear_super_receiver, get_class_ivars_from_name, get_class_reference, get_static_reference, get_object_reference, build_message_expr, finish_message_expr, build_selector_expr, build_ivar_reference, build_keyword_decl, build_method_decl, build_protocol_expr, build_objc_string_object, objc_declare_alias, objc_declare_class, objc_declare_protocols, objc_comptypes, objc_check_decl, build_encode_expr): Remove prototypes. (imp_count, cat_count): Make GGC-aware. (OBJC_SET_TYPE_NAME): New macro. From-SVN: r87168
2004-09-08 02:49:44 +02:00
nreverse (initlist));
TREE_INVARIANT (constructor) = true;
if (!flag_next_runtime)
constructor
= objc_add_static_instance (constructor, constant_string_type);
else
{
var = build_decl (CONST_DECL, NULL, TREE_TYPE (constructor));
DECL_INITIAL (var) = constructor;
TREE_STATIC (var) = 1;
pushdecl_top_level (var);
constructor = var;
}
Makefile.in (c-parse.o): Depend on $(C_COMMON_H). [gcc/ChangeLog] 2004-09-07 Ziemowit Laski <zlaski@apple.com> * Makefile.in (c-parse.o): Depend on $(C_COMMON_H). * c-parse.in: Include c-common.h instead of objc-act.h. (ivar_decl_list, ivar_decls, ivar_decl, ivars, ivar_declarator, myparms, myparm): Remove %type declarations. (methodtype, optparms, OBJC_TYPE_QUAL, objc_quals, objc_qual, objc_typename, objc_try_catch_stmt, optellipsis): Add %type declarations. (objc_inherit_code, objc_public_flag): Remove. (typespec_nonreserved_nonattr): Call objc_get_protocol_qualified_type() instead of get_static_reference() and get_protocol_reference(). (stmt_nocomp): Call grokparm() on @catch parameter. (objcdef): Move semantic action to objc_finish_implementation(). (classdef): Move semantic action to objc_start_class_interface(), objc_continue_interface(), objc_finish_interface(), objc_start_class_implementation(), objc_continue_implementation(), objc_start_category_interface() and objc_start_category_implementation(). (protocoldef): Move semantic actions to objc_start_protocol() and objc_finish_interface(). (ivar_decl_list): Remove nonterminal. (visibility_spec): Move semantic actions to objc_set_visibility(). (ivar_decls): Remove assignment to $$. (ivar_decl): Rephrase in terms of component_decl; call objc_add_instance_variable(). (ivars, ivar_declarator): Remove nonterminals. (opt_semi): New nonterminal. (methodtype): Remove semantic actions. (methoddef): Move semantic actions to objc_set_method_type(), objc_start_method_definition() and objc_finish_method_definition(). (methodproto): Move semantic actions to objc_set_method_type() and objc_add_method_declaration(). (methoddecl): Use objc_typename instead of typename; move semantic actions to objc_build_method_signature(). (optarglist, myxdecls, mydecl, myparms, myparm): Remove nonterminals. (optparmlist): Express in terms of optparms and optellipsis. (optparms, optellipsis, objc_qual, objc_quals, objc_typename): New nonterminals. (keyworddecl): Use objc_typename instead of typename. (rid_to_yy): Mark RID_IN, RID_OUT, RID_INOUT, RID_BYCOPY, RID_BYREF and RID_ONEWAY as returning OBJC_TYPE_QUAL to yyparse(). [gcc/objc/ChangeLog] 2004-09-07 Ziemowit Laski <zlaski@apple.com> * Make-lang.in (objc/objc-parse.o): Depend on $(C_COMMON_H) instead of objc/objc-act.h. (objc/objc-act.o): Depend on $(HASHTAB_H). * objc-act.c: Include hashtab.h; in ObjC++ mode, include cp-tree.h and objcp-decl.h instead of c-tree.h. (build_module_descriptor, get_class_ivars, synth_id_with_class_suffix, error_with_ivar, gen_method_decl, gen_declaration, setup_string_decl, build_protocol_template): Adjust prototypes. (build_module_initializer_routine, start_class, continue_class, finish_class, start_method_def, objc_start_function, start_protocol, build_method_decl, objc_add_method, add_instance_variable, build_ivar_reference, is_ivar, is_private, get_super_receiver, build_selector_table_decl, objc_push_parm, objc_get_parm_info, gen_type_name, gen_type_name_0, start_var_decl, finish_var_decl, create_field_decl): New prototypes. (objc_expand_function_end, comp_method_with_proto, objc_expr_last, gen_declaration_1, gen_declarator, is_complex_decl, adorn_decl, define_decl, create_builtin_decl, gen_declspecs): Remove prototypes. (TYPE_ID): Rename to OBJECT_TYPEDEF_NAME. (CLASS_TYPEDEF_NAME): New. (TAG_EXECCLASS): Change from a global variable to a #define. (TAG_RETURN_STRUCT): Delete. (TAG_GNUINIT): New, holds '__objc_gnu_init' name. (objc_inherit_code, objc_public_flag): New, moved from c-parse.in. (string_descriptor): New struct. (string_htab): New hash table. (string_hash, string_eq): New prototypes. (generate_struct_by_value_array): Call create_field_decl() instead of create_builtin_decl(). (objc_init): Do not initialize objc_ellipsis_node or TAG_EXECCLASS; In ObjC++ mode, call cxx_init() instead of c_objc_common_init(). (objc_finish_file): In ObjC++, call instantiate_pending_templates() and cp_finish_file(). (define_decl, get_static_reference, get_protocol_reference, create_builtin_decl): Remove functions. (objc_start_class_interface, objc_start_category_interface, objc_start_protocol, objc_continue_interface, objc_finish_interface, objc_start_class_implementation, objc_start_category_implementation, objc_continue_implementation, objc_finish_implementation, objc_set_visibility, objc_set_method_type, objc_build_method_signature, objc_add_method_declaration, objc_start_method_definition, objc_add_instance_variable, objc_get_protocol_qualified_type, create_field_decl, start_var_decl, finish_var_decl): New functions. (setup_string_decl): Simplify since it is only called once. (synth_module_prologue): Call build_class_template(); predefine 'id' and 'Class' as typedefs; rename 'temp_type' to 'type'; disable debug hooks for duration of function; fix GNU runtime messenger signatures to correspond to reality; forward-declare '__objc_exec_class' for the GNU runtime; call build_selector_table_decl(); in ObjC++ mode, generate 'extern "C" { ... }' wrappers around synthesized declarations; call build_protocol_template() and build_category_template(). (string_hash, string_eq): New functions. (objc_build_string_object): Check metaclass correctness only once; store string literals in hash table. (objc_build_constructor): Do not convert initializer elements; adjust for ObjC++ impedance mismatch. (build_objc_symtab_template): Call create_field_decl() instead of create_builtin_decl(). (init_objc_symtab): Add missing conversion to initializer element. (build_metadata_decl): Call start_var_decl() instead of define_decl(). (generate_objc_symtab_decl): Do not call build_category_template(); call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(). (build_module_descriptor): Call create_field_decl() instead of grokfield(); call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(); always mark module descriptor as used; move GNU runtime-specific functionality to build_module_initializer_routine(). (build_module_initializer_routine): New function, broken off of build_module_descriptor(). (objc_static_init_needed_p, objc_generate_static_init_call): New functions. (generate_static_references, generate_strings, build_selector_translation_table, generate_descriptor_table, generate_ivars_list, generate_dispatch_table, generate_category): Call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(); build a type directly instead of via groktypename(). (build_selector_reference_decl, build_selector_table_decl, build_class_reference_decl, build_protocol_reference, generate_objc_image_info): Call start_var_decl() instead of build_decl(). (build_selector_reference): For GNU runtime, do not call build_selector_reference_decl(). (build_selector, build_typed_selector_reference): Always convert result to the selector type. (add_objc_string): Cast return value to 'char *'. (build_method_prototype_template, build_selector_template, build_method_template): Use actual selector type for fields pointing to selectors. (finish_objc): For GNU runtime, call build_module_initializer_routine() after build_module_descriptor(). (generate_protocol_list, generate_shared_structures): Call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(); build a type directly instead of via groktypename(). (synth_id_with_class_suffix): Return a string. (get_arg_type_list): For instance methods, use the instance type for 'self'; do not call groktypename_in_parm_context(). (build_objc_string_decl): Squash redeclaration errors in ObjC++. (objc_is_class_name): Use OBJC_TYPE_NAME instead of TYPE_NAME; handle RECORD_TYPEs in ObjC as well as ObjC++. (objc_is_id): New function. (objc_is_object_ptr): Return the canonical type node. (objc_get_class_ivars): Simplify using get_class_ivars(). (get_class_ivars): Remove second parameter; create a fresh copy of the ivar list for each call; do not check for existence of super class. (objc_eh_runtime_type): Mark #ifndef OBJCPLUS. (objc_init_exceptions): When using SJLJ-style exceptions, require the use of '-fobjc-exceptions' flag; do not require it for DWARF-style exceptions. (objc_build_exc_ptr, next_sjlj_build_try_catch_finally): Use objc_object_type instead of objc_id_type. (objc_begin_catch_clause): Convert the incoming PARM_DECL into a VAR_DECL before placing it in the appropriate scope; do not call define_decl(); adjust call to c_begin_compound_stmt(); use objc_object_type instead of objc_id_type. (build_next_objc_exception_stuff): Call create_field_decl() instead of create_builtin_decl(); construct type directly instead of calling groktypename(); use OBJC_VOID_AT_END to mark end of function parameters. (build_private_template): Adjust call to get_class_ivars(); build a type directly instead of via groktypename(). (build_protocol_template, build_method_prototype_list_template, build_method_prototype_template, build_category_template, build_selector_template, build_class_template, build_super_template, build_ivar_template, build_ivar_list_template, build_method_list_template, build_method_template): Call create_field_decl() instead of grokfield(). (objc_method_parm_type): Do not call groktypename(). (generate_descriptor_table): Call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(). (generate_method_descriptors, build_protocol_initializer, generate_dispatch_tables, build_category_initializer, build_shared_structure_initializer): Do not call groktypename(). (generate_protocols): Call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(); do not call groktypename(). (error_with_ivar): Remove last parameter. (check_ivars): Do not iterate ovar CLASS_RAW_IVARS lists in addition to CLASS_IVARS lists; adjust calls to error_with_ivar(). (generate_ivar_lists): Convert one of the initializer elements; do not call groktypename(). (get_arg_type_list, start_method_def, gen_method_def): Account for new representation of variable arguments and '...' in Objective-C methods; add Objective-C++ impedance matching code. (is_objc_type_qualifier): Remove function. (adjust_type_for_id_default): Simplify; there is no longer a need to wade through declspecs. (lookup_interface, start_class, continue_class, finish_class, start_method_def, start_protocol, build_method_decl, objc_add_method, add_instance_variable, build_ivar_reference, is_ivar, is_private, get_super_receiver, objc_build_finally_epilogue): Make into static functions. (receiver_is_class_object): Use new IS_CLASS() macro. (objc_build_message_expr): Tweak ObjC++ message argument handling; call objc_finish_message_expr() instead of finish_message_expr(). (finish_message_expr): Rename to objc_finish_message_expr(); use OBJC_TYPE_NAME and OBJC_SET_TYPE_NAME macros instead of TYPE_NAME. call gen_type_name() instead of gen_declaration(); call objc_is_id() instead of using IS_ID and IS_CLASS; Use objc_class_name instead of calling get_identifier("Class"); handle CONVERT_EXPRs in receiver. (build_objc_method_call, warn_with_method): Do not call groktypename(). (build_ivar_reference): Call convert() instead of clobbering in a type. (hash_init): Initialize string_htab hash table. (add_instance_variable): Simplify parameter list; do not call grokfield(); do not populate CLASS_IVARS list. (start_class): Check for the existence of super class, if one was specified. (continue_class): Use CLASS_RAW_IVARS rather than CLASS_IVARS; do not call build_class_template(); adjust call to get_class_ivars(); call build_decl(), pushdecl() and finish_decl() instead of define_decl(). (finish_class): Call build_decl(), pushdecl() and finish_decl() instead of define_decl(). (add_protocols): Use PROTOCOL_BINFO_ELTS for the tree vector size. (start_protocol): Do not call build_protocol_template(); use PROTOCOL_BINFO_ELTS for the tree vector size. (encode_type_qualifiers): Do not handle the 'const' qualifier here. (encode_pointer): Encode 'const char *' as 'r*', for backwards compatibility. (encode_array): Use HOST_WIDE_INT_PRINT_DEC instead of "%ld". (encode_type): Handle the 'const' qualifier here. (objc_parmlist): New global variable, sued by objc_push_parm and objc_get_parm_info(). (objc_push_parm, objc_get_parm_info): New functions. (objc_expr_last): Remove function. (synth_self_and_ucmd_args): For instance methods, use the instance type for 'self'; call objc_push_parm() instead of push_parm_decl(). (start_method_def): Do not call push_scope(), declare_parm_level(), pop_scope(), push_parm_decl(), store_parm_decls() or objc_expr_last(); just use objc_push_parm() and objc_get_parm_info(). (comp_method_with_proto): Remove function. (objc_types_are_equivalent): Strip away indirections before comparing underlying types. (comp_proto_with_proto): Do not call groktypename(); types are no longer in raw declspec format. (objc_start_function): New function. (really_start_method): Call comp_proto_with_proto() instead of comp_method_with_proto(); call objc_start_function() instead of hand-crafting a function declarator. (continue_method_def, objc_expand_function_end): Remove functions. (get_super_receiver): Call objc_get_current_scope() instead of get_current_scope(); reference 'super_class' field (instead of 'class'). (finish_method_def): Rename to objc_finish_method_definition() and add a function decl parameter; move method encoding call from objc_expand_function_end(). (is_complex_decl, adorn_decl, gen_declarator, gen_declspecs, gen_declaration_1): Remove functions. (tmpbuf, RAW_DECLSPEC): Remove. (gen_declaration): Remove second parameter; simplify to deal with TYPE_P nodes instead of raw declspecs. (gen_type_name, gen_type_name_0): New functions. (gen_method_decl): Remove second parameter; call gen_type_name() instead of gen_declaration_1(). (dump_interface): Adjust calls to gen_declaration() and gen_method_decl(); do not allocate a separate string buffer. (init_objc): Allocate a larger string buffer to accommodate dump_interface(); adjust call to build_module_descriptor(); add call to build_module_initializer_routine() for the GNU runtime. (generate_classref_translation_entry): Do not call start_decl(); call finish_var_decl() instead of finish_decl(); call convert() instead of build_c_cast(). * objc-act.h (CLASS_OWN_IVARS): Remove accessor. (CLASS_BINFO_ELTS): Reduce from 6 to 5, now that CLASS_OWN_IVARS is gone. (OCTI_GNU_INIT_DECL, GNU_INIT_decl): New. (OCTI_ELLIPSIS_NODE, objc_ellipsis_node): Remove. (OCTI_ID_ID, id_type, objc_id_id): Rename to OCTI_ID_NAME, objc_object_type and objc_object_name, respectively. (OCTI_CLS_REF, OCTI_CLASS_NAME, objc_class_reference, objc_class_name): New. (IS_CLASS): New macro. (IS_ID, IS_SUPER): Robustify. (OCTI_EXECCLASS_DECL, execclass_decl): New. (finish_file, start_class, continue_class, finish_class, start_method_def, continue_method_def, finish_method_def, start_protocol, finish_protocol, objc_build_throw_stmt, objc_build_try_catch_finally_stmt, objc_build_synchronized_prologue, objc_build_synchronized_epilogue, objc_build_try_prologue, objc_build_try_epilogue, objc_build_catch_stmt, objc_build_catch_epilogue, objc_build_finally_prologue, objc_build_finally_epilogue, is_ivar, is_private, is_public, add_instance_variable, objc_add_method, get_super_receiver, objc_clear_super_receiver, get_class_ivars_from_name, get_class_reference, get_static_reference, get_object_reference, build_message_expr, finish_message_expr, build_selector_expr, build_ivar_reference, build_keyword_decl, build_method_decl, build_protocol_expr, build_objc_string_object, objc_declare_alias, objc_declare_class, objc_declare_protocols, objc_comptypes, objc_check_decl, build_encode_expr): Remove prototypes. (imp_count, cat_count): Make GGC-aware. (OBJC_SET_TYPE_NAME): New macro. From-SVN: r87168
2004-09-08 02:49:44 +02:00
desc->constructor = constructor;
}
addr = convert (build_pointer_type (constant_string_type),
build_unary_op (ADDR_EXPR, desc->constructor, 1));
Makefile.in (c-parse.o): Depend on $(C_COMMON_H). [gcc/ChangeLog] 2004-09-07 Ziemowit Laski <zlaski@apple.com> * Makefile.in (c-parse.o): Depend on $(C_COMMON_H). * c-parse.in: Include c-common.h instead of objc-act.h. (ivar_decl_list, ivar_decls, ivar_decl, ivars, ivar_declarator, myparms, myparm): Remove %type declarations. (methodtype, optparms, OBJC_TYPE_QUAL, objc_quals, objc_qual, objc_typename, objc_try_catch_stmt, optellipsis): Add %type declarations. (objc_inherit_code, objc_public_flag): Remove. (typespec_nonreserved_nonattr): Call objc_get_protocol_qualified_type() instead of get_static_reference() and get_protocol_reference(). (stmt_nocomp): Call grokparm() on @catch parameter. (objcdef): Move semantic action to objc_finish_implementation(). (classdef): Move semantic action to objc_start_class_interface(), objc_continue_interface(), objc_finish_interface(), objc_start_class_implementation(), objc_continue_implementation(), objc_start_category_interface() and objc_start_category_implementation(). (protocoldef): Move semantic actions to objc_start_protocol() and objc_finish_interface(). (ivar_decl_list): Remove nonterminal. (visibility_spec): Move semantic actions to objc_set_visibility(). (ivar_decls): Remove assignment to $$. (ivar_decl): Rephrase in terms of component_decl; call objc_add_instance_variable(). (ivars, ivar_declarator): Remove nonterminals. (opt_semi): New nonterminal. (methodtype): Remove semantic actions. (methoddef): Move semantic actions to objc_set_method_type(), objc_start_method_definition() and objc_finish_method_definition(). (methodproto): Move semantic actions to objc_set_method_type() and objc_add_method_declaration(). (methoddecl): Use objc_typename instead of typename; move semantic actions to objc_build_method_signature(). (optarglist, myxdecls, mydecl, myparms, myparm): Remove nonterminals. (optparmlist): Express in terms of optparms and optellipsis. (optparms, optellipsis, objc_qual, objc_quals, objc_typename): New nonterminals. (keyworddecl): Use objc_typename instead of typename. (rid_to_yy): Mark RID_IN, RID_OUT, RID_INOUT, RID_BYCOPY, RID_BYREF and RID_ONEWAY as returning OBJC_TYPE_QUAL to yyparse(). [gcc/objc/ChangeLog] 2004-09-07 Ziemowit Laski <zlaski@apple.com> * Make-lang.in (objc/objc-parse.o): Depend on $(C_COMMON_H) instead of objc/objc-act.h. (objc/objc-act.o): Depend on $(HASHTAB_H). * objc-act.c: Include hashtab.h; in ObjC++ mode, include cp-tree.h and objcp-decl.h instead of c-tree.h. (build_module_descriptor, get_class_ivars, synth_id_with_class_suffix, error_with_ivar, gen_method_decl, gen_declaration, setup_string_decl, build_protocol_template): Adjust prototypes. (build_module_initializer_routine, start_class, continue_class, finish_class, start_method_def, objc_start_function, start_protocol, build_method_decl, objc_add_method, add_instance_variable, build_ivar_reference, is_ivar, is_private, get_super_receiver, build_selector_table_decl, objc_push_parm, objc_get_parm_info, gen_type_name, gen_type_name_0, start_var_decl, finish_var_decl, create_field_decl): New prototypes. (objc_expand_function_end, comp_method_with_proto, objc_expr_last, gen_declaration_1, gen_declarator, is_complex_decl, adorn_decl, define_decl, create_builtin_decl, gen_declspecs): Remove prototypes. (TYPE_ID): Rename to OBJECT_TYPEDEF_NAME. (CLASS_TYPEDEF_NAME): New. (TAG_EXECCLASS): Change from a global variable to a #define. (TAG_RETURN_STRUCT): Delete. (TAG_GNUINIT): New, holds '__objc_gnu_init' name. (objc_inherit_code, objc_public_flag): New, moved from c-parse.in. (string_descriptor): New struct. (string_htab): New hash table. (string_hash, string_eq): New prototypes. (generate_struct_by_value_array): Call create_field_decl() instead of create_builtin_decl(). (objc_init): Do not initialize objc_ellipsis_node or TAG_EXECCLASS; In ObjC++ mode, call cxx_init() instead of c_objc_common_init(). (objc_finish_file): In ObjC++, call instantiate_pending_templates() and cp_finish_file(). (define_decl, get_static_reference, get_protocol_reference, create_builtin_decl): Remove functions. (objc_start_class_interface, objc_start_category_interface, objc_start_protocol, objc_continue_interface, objc_finish_interface, objc_start_class_implementation, objc_start_category_implementation, objc_continue_implementation, objc_finish_implementation, objc_set_visibility, objc_set_method_type, objc_build_method_signature, objc_add_method_declaration, objc_start_method_definition, objc_add_instance_variable, objc_get_protocol_qualified_type, create_field_decl, start_var_decl, finish_var_decl): New functions. (setup_string_decl): Simplify since it is only called once. (synth_module_prologue): Call build_class_template(); predefine 'id' and 'Class' as typedefs; rename 'temp_type' to 'type'; disable debug hooks for duration of function; fix GNU runtime messenger signatures to correspond to reality; forward-declare '__objc_exec_class' for the GNU runtime; call build_selector_table_decl(); in ObjC++ mode, generate 'extern "C" { ... }' wrappers around synthesized declarations; call build_protocol_template() and build_category_template(). (string_hash, string_eq): New functions. (objc_build_string_object): Check metaclass correctness only once; store string literals in hash table. (objc_build_constructor): Do not convert initializer elements; adjust for ObjC++ impedance mismatch. (build_objc_symtab_template): Call create_field_decl() instead of create_builtin_decl(). (init_objc_symtab): Add missing conversion to initializer element. (build_metadata_decl): Call start_var_decl() instead of define_decl(). (generate_objc_symtab_decl): Do not call build_category_template(); call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(). (build_module_descriptor): Call create_field_decl() instead of grokfield(); call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(); always mark module descriptor as used; move GNU runtime-specific functionality to build_module_initializer_routine(). (build_module_initializer_routine): New function, broken off of build_module_descriptor(). (objc_static_init_needed_p, objc_generate_static_init_call): New functions. (generate_static_references, generate_strings, build_selector_translation_table, generate_descriptor_table, generate_ivars_list, generate_dispatch_table, generate_category): Call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(); build a type directly instead of via groktypename(). (build_selector_reference_decl, build_selector_table_decl, build_class_reference_decl, build_protocol_reference, generate_objc_image_info): Call start_var_decl() instead of build_decl(). (build_selector_reference): For GNU runtime, do not call build_selector_reference_decl(). (build_selector, build_typed_selector_reference): Always convert result to the selector type. (add_objc_string): Cast return value to 'char *'. (build_method_prototype_template, build_selector_template, build_method_template): Use actual selector type for fields pointing to selectors. (finish_objc): For GNU runtime, call build_module_initializer_routine() after build_module_descriptor(). (generate_protocol_list, generate_shared_structures): Call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(); build a type directly instead of via groktypename(). (synth_id_with_class_suffix): Return a string. (get_arg_type_list): For instance methods, use the instance type for 'self'; do not call groktypename_in_parm_context(). (build_objc_string_decl): Squash redeclaration errors in ObjC++. (objc_is_class_name): Use OBJC_TYPE_NAME instead of TYPE_NAME; handle RECORD_TYPEs in ObjC as well as ObjC++. (objc_is_id): New function. (objc_is_object_ptr): Return the canonical type node. (objc_get_class_ivars): Simplify using get_class_ivars(). (get_class_ivars): Remove second parameter; create a fresh copy of the ivar list for each call; do not check for existence of super class. (objc_eh_runtime_type): Mark #ifndef OBJCPLUS. (objc_init_exceptions): When using SJLJ-style exceptions, require the use of '-fobjc-exceptions' flag; do not require it for DWARF-style exceptions. (objc_build_exc_ptr, next_sjlj_build_try_catch_finally): Use objc_object_type instead of objc_id_type. (objc_begin_catch_clause): Convert the incoming PARM_DECL into a VAR_DECL before placing it in the appropriate scope; do not call define_decl(); adjust call to c_begin_compound_stmt(); use objc_object_type instead of objc_id_type. (build_next_objc_exception_stuff): Call create_field_decl() instead of create_builtin_decl(); construct type directly instead of calling groktypename(); use OBJC_VOID_AT_END to mark end of function parameters. (build_private_template): Adjust call to get_class_ivars(); build a type directly instead of via groktypename(). (build_protocol_template, build_method_prototype_list_template, build_method_prototype_template, build_category_template, build_selector_template, build_class_template, build_super_template, build_ivar_template, build_ivar_list_template, build_method_list_template, build_method_template): Call create_field_decl() instead of grokfield(). (objc_method_parm_type): Do not call groktypename(). (generate_descriptor_table): Call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(). (generate_method_descriptors, build_protocol_initializer, generate_dispatch_tables, build_category_initializer, build_shared_structure_initializer): Do not call groktypename(). (generate_protocols): Call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(); do not call groktypename(). (error_with_ivar): Remove last parameter. (check_ivars): Do not iterate ovar CLASS_RAW_IVARS lists in addition to CLASS_IVARS lists; adjust calls to error_with_ivar(). (generate_ivar_lists): Convert one of the initializer elements; do not call groktypename(). (get_arg_type_list, start_method_def, gen_method_def): Account for new representation of variable arguments and '...' in Objective-C methods; add Objective-C++ impedance matching code. (is_objc_type_qualifier): Remove function. (adjust_type_for_id_default): Simplify; there is no longer a need to wade through declspecs. (lookup_interface, start_class, continue_class, finish_class, start_method_def, start_protocol, build_method_decl, objc_add_method, add_instance_variable, build_ivar_reference, is_ivar, is_private, get_super_receiver, objc_build_finally_epilogue): Make into static functions. (receiver_is_class_object): Use new IS_CLASS() macro. (objc_build_message_expr): Tweak ObjC++ message argument handling; call objc_finish_message_expr() instead of finish_message_expr(). (finish_message_expr): Rename to objc_finish_message_expr(); use OBJC_TYPE_NAME and OBJC_SET_TYPE_NAME macros instead of TYPE_NAME. call gen_type_name() instead of gen_declaration(); call objc_is_id() instead of using IS_ID and IS_CLASS; Use objc_class_name instead of calling get_identifier("Class"); handle CONVERT_EXPRs in receiver. (build_objc_method_call, warn_with_method): Do not call groktypename(). (build_ivar_reference): Call convert() instead of clobbering in a type. (hash_init): Initialize string_htab hash table. (add_instance_variable): Simplify parameter list; do not call grokfield(); do not populate CLASS_IVARS list. (start_class): Check for the existence of super class, if one was specified. (continue_class): Use CLASS_RAW_IVARS rather than CLASS_IVARS; do not call build_class_template(); adjust call to get_class_ivars(); call build_decl(), pushdecl() and finish_decl() instead of define_decl(). (finish_class): Call build_decl(), pushdecl() and finish_decl() instead of define_decl(). (add_protocols): Use PROTOCOL_BINFO_ELTS for the tree vector size. (start_protocol): Do not call build_protocol_template(); use PROTOCOL_BINFO_ELTS for the tree vector size. (encode_type_qualifiers): Do not handle the 'const' qualifier here. (encode_pointer): Encode 'const char *' as 'r*', for backwards compatibility. (encode_array): Use HOST_WIDE_INT_PRINT_DEC instead of "%ld". (encode_type): Handle the 'const' qualifier here. (objc_parmlist): New global variable, sued by objc_push_parm and objc_get_parm_info(). (objc_push_parm, objc_get_parm_info): New functions. (objc_expr_last): Remove function. (synth_self_and_ucmd_args): For instance methods, use the instance type for 'self'; call objc_push_parm() instead of push_parm_decl(). (start_method_def): Do not call push_scope(), declare_parm_level(), pop_scope(), push_parm_decl(), store_parm_decls() or objc_expr_last(); just use objc_push_parm() and objc_get_parm_info(). (comp_method_with_proto): Remove function. (objc_types_are_equivalent): Strip away indirections before comparing underlying types. (comp_proto_with_proto): Do not call groktypename(); types are no longer in raw declspec format. (objc_start_function): New function. (really_start_method): Call comp_proto_with_proto() instead of comp_method_with_proto(); call objc_start_function() instead of hand-crafting a function declarator. (continue_method_def, objc_expand_function_end): Remove functions. (get_super_receiver): Call objc_get_current_scope() instead of get_current_scope(); reference 'super_class' field (instead of 'class'). (finish_method_def): Rename to objc_finish_method_definition() and add a function decl parameter; move method encoding call from objc_expand_function_end(). (is_complex_decl, adorn_decl, gen_declarator, gen_declspecs, gen_declaration_1): Remove functions. (tmpbuf, RAW_DECLSPEC): Remove. (gen_declaration): Remove second parameter; simplify to deal with TYPE_P nodes instead of raw declspecs. (gen_type_name, gen_type_name_0): New functions. (gen_method_decl): Remove second parameter; call gen_type_name() instead of gen_declaration_1(). (dump_interface): Adjust calls to gen_declaration() and gen_method_decl(); do not allocate a separate string buffer. (init_objc): Allocate a larger string buffer to accommodate dump_interface(); adjust call to build_module_descriptor(); add call to build_module_initializer_routine() for the GNU runtime. (generate_classref_translation_entry): Do not call start_decl(); call finish_var_decl() instead of finish_decl(); call convert() instead of build_c_cast(). * objc-act.h (CLASS_OWN_IVARS): Remove accessor. (CLASS_BINFO_ELTS): Reduce from 6 to 5, now that CLASS_OWN_IVARS is gone. (OCTI_GNU_INIT_DECL, GNU_INIT_decl): New. (OCTI_ELLIPSIS_NODE, objc_ellipsis_node): Remove. (OCTI_ID_ID, id_type, objc_id_id): Rename to OCTI_ID_NAME, objc_object_type and objc_object_name, respectively. (OCTI_CLS_REF, OCTI_CLASS_NAME, objc_class_reference, objc_class_name): New. (IS_CLASS): New macro. (IS_ID, IS_SUPER): Robustify. (OCTI_EXECCLASS_DECL, execclass_decl): New. (finish_file, start_class, continue_class, finish_class, start_method_def, continue_method_def, finish_method_def, start_protocol, finish_protocol, objc_build_throw_stmt, objc_build_try_catch_finally_stmt, objc_build_synchronized_prologue, objc_build_synchronized_epilogue, objc_build_try_prologue, objc_build_try_epilogue, objc_build_catch_stmt, objc_build_catch_epilogue, objc_build_finally_prologue, objc_build_finally_epilogue, is_ivar, is_private, is_public, add_instance_variable, objc_add_method, get_super_receiver, objc_clear_super_receiver, get_class_ivars_from_name, get_class_reference, get_static_reference, get_object_reference, build_message_expr, finish_message_expr, build_selector_expr, build_ivar_reference, build_keyword_decl, build_method_decl, build_protocol_expr, build_objc_string_object, objc_declare_alias, objc_declare_class, objc_declare_protocols, objc_comptypes, objc_check_decl, build_encode_expr): Remove prototypes. (imp_count, cat_count): Make GGC-aware. (OBJC_SET_TYPE_NAME): New macro. From-SVN: r87168
2004-09-08 02:49:44 +02:00
return addr;
}
/* Declare a static instance of CLASS_DECL initialized by CONSTRUCTOR. */
static GTY(()) int num_static_inst;
static tree
objc_add_static_instance (tree constructor, tree class_decl)
{
Fix warious warnings: * c-aux-info.c: Include string.h/strings.h. * pa.c: Include stdlib.h. (pa_combine_instructions): Prototype the function. (pa_can_combine_p, forward_branch_p, shadd_constant_p): Likewise. (reloc_needed): Add default case for enumeration switch. (remove_useless_addtr_insns): Remove unused variable `all'. (hppa_expand_prologue): Add explicit braces to avoid ambiguous `else'. (output_function_epilogue): Remove unused variable `i'. (output_millicode_call): Remove unused variable `link'. (shadd_constant_p, forward_branch_p): Make the function static. (following_call): Explicitly declare to return int. (pa_reorg): Declare as void. (pa_combine_instructions): Declare as static void. Add parentheses around && within ||. * pa.h: Add prototypes for pa_reorg, symbolic_operand, following_call, function_label_operand, lhs_lshift_cint_operand and zdepi_cint_p. * pa.md: Add parentheses around && within ||. * cppalloc.c: Include stdlib.h. * cpperror.c (cpp_print_containing_files): Remove unused variable `i'. Fix format specifier in fprintf. * cse.c (cse_around_loop): Add explicit braces to avoid ambiguous `else'. (delete_dead_from_cse): Wrap variable `tem' in macro HAVE_cc0. * expr.c (expand_expr): Add parentheses around && within ||. * final.c (app_enable): Replace fprintf with fputs where there are no format specifiers and no trailing argument after the string. Eg, when printing ASM_APP_ON/ASM_APP_OFF. (app_disable): Likewise. (final_end_function): Likewise. (final_scan_insn): Likewise. Remove unused variable `set'. (profile_function): Wrap empty if-statement body in {} brackets. * function.c: Include stdlib.h. (pad_below): Wrap prototype and definition in ARGS_GROW_DOWNWARD. (reposition_prologue_and_epilogue_notes): Add parentheses around assignment used as truth value. * integrate.c (expand_inline_function): Wrap variable `cc0_insn' in macro HAVE_cc0. * jump.c (jump_optimize): Wrap variable `q' in macro HAVE_cc0. Remove unused variable `prev1'. * libgcc2.c (__bb_exit_trace_func): Add parentheses around && within ||. Fix format specifier in fprintf. (__bb_init_prg): Add parentheses around assignment used as truth value. * local-alloc.c: Include stdlib.h. (requires_inout): Add parentheses around assignment used as truth value. * loop.c (analyze_loop_iterations): Wrap prototype and definition in macro HAVE_decrement_and_branch_on_count. (insert_bct, instrument_loop_bct): Likewise. (move_movables): Add parentheses around assignment used as truth value. (consec_sets_invariant_p): Likewise. (maybe_eliminate_biv_1): Wrap variable `new' in macro HAVE_cc0. * objc/objc-act.c: Include stdlib.h. (lookup_method_in_protocol_list): Wrap empty else-statement body in braces. (lookup_protocol_in_reflist): Likewise. (objc_add_static_instance): Remove unused variables `decl_expr' and `decl_spec'. (get_objc_string_decl): Remove unused variable `decl'. (generate_static_references): Remove unused variables `idecl' and `instance'. (check_protocols): Wrap empty else-statement body in braces. * protoize.c: Include stdlib.h. (substr): Add parentheses around assignment used as truth value. (abspath): Likewise. (shortpath): Likewise. * regmove.c (fixup_match_1): Add parentheses around assignment used as truth value. * reload.c (push_secondary_reload): Remove unused variable `i'. (find_reloads): Add parentheses around assignment used as truth value. * reload1.c: Include stdlib.h. * rtl.h: Correct typo in prototype of offsettable_memref_p. * stmt.c (add_case_node): Add parentheses around assignment used as truth value. (case_tree2list): Likewise. * tree.c (valid_machine_attribute): Wrap variable `decl_attr_list' in macro VALID_MACHINE_DECL_ATTRIBUTE. Wrap variable `type_attr_list' in macro VALID_MACHINE_TYPE_ATTRIBUTE. (merge_attributes): Add explicit braces to avoid ambiguous `else'. * unroll.c (copy_loop_body): Wrap variable `cc0_insn' in macro HAVE_cc0. * varasm.c: Include stdlib.h. From-SVN: r18290
1998-02-28 08:06:53 +01:00
tree *chain, decl;
char buf[256];
/* Find the list of static instances for the CLASS_DECL. Create one if
not found. */
for (chain = &objc_static_instances;
*chain && TREE_VALUE (*chain) != class_decl;
chain = &TREE_CHAIN (*chain));
if (!*chain)
{
*chain = tree_cons (NULL_TREE, class_decl, NULL_TREE);
add_objc_string (OBJC_TYPE_NAME (class_decl), class_names);
}
sprintf (buf, "_OBJC_INSTANCE_%d", num_static_inst++);
decl = build_decl (VAR_DECL, get_identifier (buf), class_decl);
DECL_COMMON (decl) = 1;
TREE_STATIC (decl) = 1;
DECL_ARTIFICIAL (decl) = 1;
TREE_USED (decl) = 1;
DECL_INITIAL (decl) = constructor;
/* We may be writing something else just now.
Postpone till end of input. */
DECL_DEFER_OUTPUT (decl) = 1;
pushdecl_top_level (decl);
rest_of_decl_compilation (decl, 1, 0);
/* Add the DECL to the head of this CLASS' list. */
TREE_PURPOSE (*chain) = tree_cons (NULL_TREE, decl, TREE_PURPOSE (*chain));
return decl;
}
/* Build a static constant CONSTRUCTOR
with type TYPE and elements ELTS. */
static tree
objc_build_constructor (tree type, tree elts)
{
Make CONSTRUCTOR use VEC to store initializers. * c-common.c (complete_array_type): Update to cope with VEC in CONSTRUCTOR_ELTS. * c-pretty-print.c (pp_c_initializer_list): Use pp_c_constructor_elts. (pp_c_constructor_elts): New function. * c-pretty-print.h (pp_c_constructor_elts): Declare. * c-typeck.c (build_function_call, build_c_cast, digest_init, struct constructor_stack, struct initializer_stack, constructor_elements, push_init_level, pop_init_level, add_pending_init, find_init_member, output_init_element): Update to cope with VEC in CONSTRUCTOR_ELTS. * coverage.c (build_fn_info_value, build_ctr_info_value, build_gcov_info): Likewise. * expr.c (categorize_ctor_elements_1, store_constructor, expand_expr_real_1): Likewise. * fold-const.c (fold_ternary): Likewise. * gimplify.c (gimplify_init_ctor_preeval, zero_sized_field_decl, gimplify_init_constructor, gimplify_expr): Likewise. * tree-dump.c (dequeue_and_dump): Likewise. * tree-inline.c (copy_tree_r): Add code to duplicate a CONSTRUCTOR node. * tree-pretty-print.c (dump_generic_node): Update to cope with VEC in CONSTRUCTOR_ELTS. * tree-sra.c (generate_element_init_1): Likewise. * tree-ssa-ccp.c (fold_const_aggregate_ref): Likewise. * tree-ssa-operands.c (get_expr_operands): Likewise. * tree-vect-generic.c (expand_vector_piecewise): Likewise. * tree-vect-transform.c (vect_get_vec_def_for_operand): (get_initial_def_for_reduction): Likewise. * tree-vn.c (set_value_handle, get_value_handle): CONSTURCTOR uses value handle in annotations. * tree.c (tree_node_kind, tree_code_size, make_node_stat, tree_node_structure): Add support for constr_kind. (build_vector_from_ctor, build_constructor_single, build_constructor_from_list): New functions. (build_constructor): Update to take a VEC instead of a TREE_LIST. (simple_cst_equal, iterative_hash_expr, initializer_zerop, walk_tree): Update to cope with VEC in CONSTRUCTOR_ELTS. * tree.def (CONSTRUCTOR): Make it a tcc_exceptional node. * tree.h (FOR_EACH_CONSTRUCTOR_VALUE, FOR_EACH_CONSTRUCTOR_ELT, CONSTRUCTOR_APPEND_ELT): New macros. (struct constructor_elt, struct tree_constructor): New data types. (union tree_node): Add tree_constructor field. * treestruct.def: Define TS_CONSTRUCTOR. * varasm.c (const_hash_1, compare_constant, copy_constant, compute_reloc_for_constant, output_addressed_constants, initializer_constant_valid_p, output_constant, array_size_for_constructor, output_constructor): Update to cope with VEC in CONSTRUCTOR_ELTS. * vec.h (VEC_empty, VEC_copy): New macros. ada/ Make CONSTRUCTOR use VEC to store initializers. * decl.c (gnat_to_gnu_entity): Update to cope with VEC in CONSTRUCTOR_ELTS. * trans.c (extract_values): Likewise. * utils.c (convert, remove_conversions): Likewise. * utils2.c (contains_save_expr_p, build_binary_op, build_unary_op, gnat_build_constructor): Likewise. cp/ Make CONSTRUCTOR use VEC to store initializers. * call.c (convert_default_arg): Update call to digest_init. * class.c (dump_class_hierarchy, dump_array): Update to cope with VEC in CONSTRUCTOR_ELTS. * cp-tree.h (EMPTY_CONSTRUCTOR_P): Likewise. (finish_compound_literal, digest_init): Update declaration. * decl.c (struct reshape_iter): New data type. (reshape_init_array): Rename to... (reshape_init_array_1): Update to cope with VEC in CONSTRUCTOR_ELTS. (reshape_init): Rewrite from scratch. Split parts into... (reshape_init_array, reshape_init_vector, reshape_init_class, reshape_init_r): New functions. (check_initializer): Update call to reshape_init. Remove obsolete code. (initialize_artificial_var, cp_complete_array_type): Update to cope with VEC in CONSTRUCTOR_ELTS. * decl2.c (grokfield): Update calls to digest_init. (mark_vtable_entries): Update to cope with VEC in CONSTRUCTOR_ELTS. * error.c (dump_expr_init_vec): New function. (dump_expr): Use dump_expr_init_vec. * init.c (build_zero_init, build_vec_init): Update to cope with VEC in CONSTRUCTOR_ELTS. (expand_default_init): Update call to digest_init. * parser.c (cp_parser_postfix_expression): Use a VEC for the initializers. (cp_parser_initializer_list): Build a VEC of initializers. * pt.c (tsubst_copy, tsubst_copy_and_build): Update to cope with VEC in CONSTRUCTOR_ELTS. * rtti.c (tinfo_base_init, generic_initializer, ptr_initializer, ptm_initializer, class_initializer, get_pseudo_ti_init): Use build_constructor_from_list instead of build_constructor. * semantics.c (finish_compound_literal): Update call to digest_init. * tree.c (stabilize_init): Update to cope with VEC in CONSTRUCTOR_ELTS. * typeck.c (build_ptrmemfunc1): Likewise. * typeck2.c: (cxx_incomplete_type_error, split_nonconstant_init_1): Likewise. (store_init_value): Use build_constructor_from_list and update call to digest_init. (digest_init): Rewrite. (process_init_constructor): Rewrite from scratch. Split into... (process_init_constructor_array, picflag_from_initializer, process_init_constructor_record, process_init_constructor_union): New functions. (PICFLAG_ERRONEOUS, PICFLAG_NOT_ALL_CONSTANT, PICFLAG_NOT_ALL_SIMPLE): New macros. (build_functional_cast): Use build_constructor_from_list instead of build_constructor. fortran/ Make CONSTRUCTOR use VEC to store initializers. * trans-array.c (gfc_build_null_descriptor, gfc_trans_array_constructor_value, gfc_conv_array_initializer): Update to cope with VEC in CONSTRUCTOR_ELTS. * trans-common.c (create_common): Likewise. * trans-expr.c (gfc_conv_structure): Likewise. * trans-stmt.c (gfc_trans_character_select): Use build_constructor_from_list instead of build_constructor. java/ Make CONSTRUCTOR use VEC to store initializers. * check-init.c (check_init): Update to cope with VEC in CONSTRUCTOR_ELTS. * class.c (make_field_value, make_method_value, get_dispatch_table, make_class_data, emit_symbol_table, emit_catch_table, emit_assertion_table): Use build_constructor_from_list instead of build_constructor. * constants.c (build_constants_constructor): Likewise. * java-gimplify.c (java_gimplify_new_array_init): Update to cope with VEC in CONSTRUCTOR_ELTS. * java-tree.h (START_RECORD_CONSTRUCTOR, PUSH_SUPER_VALUE, PUSH_FIELD_VALUE, FINISH_RECORD_CONSTRUCTOR): Create a VEC instead of a TREE_LIST. * jcf-write.c (generate_bytecode_insns): Update to cope with VEC in CONSTRUCTOR_ELTS. * parse.y (build_new_array_init): Use build_constructor_from_list instead of build_constructor. (patch_new_array_init): Update to cope with VEC in CONSTRUCTOR_ELTS. (array_constructor_check_entry): Likewise. objc/ Make CONSTRUCTOR use VEC to store initializers. * objc-act.c (objc_build_constructor): Use build_constructor_from_list instead of build_constructor. testsuite/ Make CONSTRUCTOR use VEC to store initializers. * g++.dg/ext/complit3.C: Check for specific error messages. * g++.dg/init/brace2.C: Update error message. * g++.dg/warn/Wbraces2.C: Likewise. From-SVN: r102182
2005-07-20 03:19:59 +02:00
tree constructor = build_constructor_from_list (type, elts);
TREE_CONSTANT (constructor) = 1;
TREE_STATIC (constructor) = 1;
TREE_READONLY (constructor) = 1;
#ifdef OBJCPLUS
Makefile.in (c-parse.o): Depend on $(C_COMMON_H). [gcc/ChangeLog] 2004-09-07 Ziemowit Laski <zlaski@apple.com> * Makefile.in (c-parse.o): Depend on $(C_COMMON_H). * c-parse.in: Include c-common.h instead of objc-act.h. (ivar_decl_list, ivar_decls, ivar_decl, ivars, ivar_declarator, myparms, myparm): Remove %type declarations. (methodtype, optparms, OBJC_TYPE_QUAL, objc_quals, objc_qual, objc_typename, objc_try_catch_stmt, optellipsis): Add %type declarations. (objc_inherit_code, objc_public_flag): Remove. (typespec_nonreserved_nonattr): Call objc_get_protocol_qualified_type() instead of get_static_reference() and get_protocol_reference(). (stmt_nocomp): Call grokparm() on @catch parameter. (objcdef): Move semantic action to objc_finish_implementation(). (classdef): Move semantic action to objc_start_class_interface(), objc_continue_interface(), objc_finish_interface(), objc_start_class_implementation(), objc_continue_implementation(), objc_start_category_interface() and objc_start_category_implementation(). (protocoldef): Move semantic actions to objc_start_protocol() and objc_finish_interface(). (ivar_decl_list): Remove nonterminal. (visibility_spec): Move semantic actions to objc_set_visibility(). (ivar_decls): Remove assignment to $$. (ivar_decl): Rephrase in terms of component_decl; call objc_add_instance_variable(). (ivars, ivar_declarator): Remove nonterminals. (opt_semi): New nonterminal. (methodtype): Remove semantic actions. (methoddef): Move semantic actions to objc_set_method_type(), objc_start_method_definition() and objc_finish_method_definition(). (methodproto): Move semantic actions to objc_set_method_type() and objc_add_method_declaration(). (methoddecl): Use objc_typename instead of typename; move semantic actions to objc_build_method_signature(). (optarglist, myxdecls, mydecl, myparms, myparm): Remove nonterminals. (optparmlist): Express in terms of optparms and optellipsis. (optparms, optellipsis, objc_qual, objc_quals, objc_typename): New nonterminals. (keyworddecl): Use objc_typename instead of typename. (rid_to_yy): Mark RID_IN, RID_OUT, RID_INOUT, RID_BYCOPY, RID_BYREF and RID_ONEWAY as returning OBJC_TYPE_QUAL to yyparse(). [gcc/objc/ChangeLog] 2004-09-07 Ziemowit Laski <zlaski@apple.com> * Make-lang.in (objc/objc-parse.o): Depend on $(C_COMMON_H) instead of objc/objc-act.h. (objc/objc-act.o): Depend on $(HASHTAB_H). * objc-act.c: Include hashtab.h; in ObjC++ mode, include cp-tree.h and objcp-decl.h instead of c-tree.h. (build_module_descriptor, get_class_ivars, synth_id_with_class_suffix, error_with_ivar, gen_method_decl, gen_declaration, setup_string_decl, build_protocol_template): Adjust prototypes. (build_module_initializer_routine, start_class, continue_class, finish_class, start_method_def, objc_start_function, start_protocol, build_method_decl, objc_add_method, add_instance_variable, build_ivar_reference, is_ivar, is_private, get_super_receiver, build_selector_table_decl, objc_push_parm, objc_get_parm_info, gen_type_name, gen_type_name_0, start_var_decl, finish_var_decl, create_field_decl): New prototypes. (objc_expand_function_end, comp_method_with_proto, objc_expr_last, gen_declaration_1, gen_declarator, is_complex_decl, adorn_decl, define_decl, create_builtin_decl, gen_declspecs): Remove prototypes. (TYPE_ID): Rename to OBJECT_TYPEDEF_NAME. (CLASS_TYPEDEF_NAME): New. (TAG_EXECCLASS): Change from a global variable to a #define. (TAG_RETURN_STRUCT): Delete. (TAG_GNUINIT): New, holds '__objc_gnu_init' name. (objc_inherit_code, objc_public_flag): New, moved from c-parse.in. (string_descriptor): New struct. (string_htab): New hash table. (string_hash, string_eq): New prototypes. (generate_struct_by_value_array): Call create_field_decl() instead of create_builtin_decl(). (objc_init): Do not initialize objc_ellipsis_node or TAG_EXECCLASS; In ObjC++ mode, call cxx_init() instead of c_objc_common_init(). (objc_finish_file): In ObjC++, call instantiate_pending_templates() and cp_finish_file(). (define_decl, get_static_reference, get_protocol_reference, create_builtin_decl): Remove functions. (objc_start_class_interface, objc_start_category_interface, objc_start_protocol, objc_continue_interface, objc_finish_interface, objc_start_class_implementation, objc_start_category_implementation, objc_continue_implementation, objc_finish_implementation, objc_set_visibility, objc_set_method_type, objc_build_method_signature, objc_add_method_declaration, objc_start_method_definition, objc_add_instance_variable, objc_get_protocol_qualified_type, create_field_decl, start_var_decl, finish_var_decl): New functions. (setup_string_decl): Simplify since it is only called once. (synth_module_prologue): Call build_class_template(); predefine 'id' and 'Class' as typedefs; rename 'temp_type' to 'type'; disable debug hooks for duration of function; fix GNU runtime messenger signatures to correspond to reality; forward-declare '__objc_exec_class' for the GNU runtime; call build_selector_table_decl(); in ObjC++ mode, generate 'extern "C" { ... }' wrappers around synthesized declarations; call build_protocol_template() and build_category_template(). (string_hash, string_eq): New functions. (objc_build_string_object): Check metaclass correctness only once; store string literals in hash table. (objc_build_constructor): Do not convert initializer elements; adjust for ObjC++ impedance mismatch. (build_objc_symtab_template): Call create_field_decl() instead of create_builtin_decl(). (init_objc_symtab): Add missing conversion to initializer element. (build_metadata_decl): Call start_var_decl() instead of define_decl(). (generate_objc_symtab_decl): Do not call build_category_template(); call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(). (build_module_descriptor): Call create_field_decl() instead of grokfield(); call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(); always mark module descriptor as used; move GNU runtime-specific functionality to build_module_initializer_routine(). (build_module_initializer_routine): New function, broken off of build_module_descriptor(). (objc_static_init_needed_p, objc_generate_static_init_call): New functions. (generate_static_references, generate_strings, build_selector_translation_table, generate_descriptor_table, generate_ivars_list, generate_dispatch_table, generate_category): Call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(); build a type directly instead of via groktypename(). (build_selector_reference_decl, build_selector_table_decl, build_class_reference_decl, build_protocol_reference, generate_objc_image_info): Call start_var_decl() instead of build_decl(). (build_selector_reference): For GNU runtime, do not call build_selector_reference_decl(). (build_selector, build_typed_selector_reference): Always convert result to the selector type. (add_objc_string): Cast return value to 'char *'. (build_method_prototype_template, build_selector_template, build_method_template): Use actual selector type for fields pointing to selectors. (finish_objc): For GNU runtime, call build_module_initializer_routine() after build_module_descriptor(). (generate_protocol_list, generate_shared_structures): Call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(); build a type directly instead of via groktypename(). (synth_id_with_class_suffix): Return a string. (get_arg_type_list): For instance methods, use the instance type for 'self'; do not call groktypename_in_parm_context(). (build_objc_string_decl): Squash redeclaration errors in ObjC++. (objc_is_class_name): Use OBJC_TYPE_NAME instead of TYPE_NAME; handle RECORD_TYPEs in ObjC as well as ObjC++. (objc_is_id): New function. (objc_is_object_ptr): Return the canonical type node. (objc_get_class_ivars): Simplify using get_class_ivars(). (get_class_ivars): Remove second parameter; create a fresh copy of the ivar list for each call; do not check for existence of super class. (objc_eh_runtime_type): Mark #ifndef OBJCPLUS. (objc_init_exceptions): When using SJLJ-style exceptions, require the use of '-fobjc-exceptions' flag; do not require it for DWARF-style exceptions. (objc_build_exc_ptr, next_sjlj_build_try_catch_finally): Use objc_object_type instead of objc_id_type. (objc_begin_catch_clause): Convert the incoming PARM_DECL into a VAR_DECL before placing it in the appropriate scope; do not call define_decl(); adjust call to c_begin_compound_stmt(); use objc_object_type instead of objc_id_type. (build_next_objc_exception_stuff): Call create_field_decl() instead of create_builtin_decl(); construct type directly instead of calling groktypename(); use OBJC_VOID_AT_END to mark end of function parameters. (build_private_template): Adjust call to get_class_ivars(); build a type directly instead of via groktypename(). (build_protocol_template, build_method_prototype_list_template, build_method_prototype_template, build_category_template, build_selector_template, build_class_template, build_super_template, build_ivar_template, build_ivar_list_template, build_method_list_template, build_method_template): Call create_field_decl() instead of grokfield(). (objc_method_parm_type): Do not call groktypename(). (generate_descriptor_table): Call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(). (generate_method_descriptors, build_protocol_initializer, generate_dispatch_tables, build_category_initializer, build_shared_structure_initializer): Do not call groktypename(). (generate_protocols): Call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(); do not call groktypename(). (error_with_ivar): Remove last parameter. (check_ivars): Do not iterate ovar CLASS_RAW_IVARS lists in addition to CLASS_IVARS lists; adjust calls to error_with_ivar(). (generate_ivar_lists): Convert one of the initializer elements; do not call groktypename(). (get_arg_type_list, start_method_def, gen_method_def): Account for new representation of variable arguments and '...' in Objective-C methods; add Objective-C++ impedance matching code. (is_objc_type_qualifier): Remove function. (adjust_type_for_id_default): Simplify; there is no longer a need to wade through declspecs. (lookup_interface, start_class, continue_class, finish_class, start_method_def, start_protocol, build_method_decl, objc_add_method, add_instance_variable, build_ivar_reference, is_ivar, is_private, get_super_receiver, objc_build_finally_epilogue): Make into static functions. (receiver_is_class_object): Use new IS_CLASS() macro. (objc_build_message_expr): Tweak ObjC++ message argument handling; call objc_finish_message_expr() instead of finish_message_expr(). (finish_message_expr): Rename to objc_finish_message_expr(); use OBJC_TYPE_NAME and OBJC_SET_TYPE_NAME macros instead of TYPE_NAME. call gen_type_name() instead of gen_declaration(); call objc_is_id() instead of using IS_ID and IS_CLASS; Use objc_class_name instead of calling get_identifier("Class"); handle CONVERT_EXPRs in receiver. (build_objc_method_call, warn_with_method): Do not call groktypename(). (build_ivar_reference): Call convert() instead of clobbering in a type. (hash_init): Initialize string_htab hash table. (add_instance_variable): Simplify parameter list; do not call grokfield(); do not populate CLASS_IVARS list. (start_class): Check for the existence of super class, if one was specified. (continue_class): Use CLASS_RAW_IVARS rather than CLASS_IVARS; do not call build_class_template(); adjust call to get_class_ivars(); call build_decl(), pushdecl() and finish_decl() instead of define_decl(). (finish_class): Call build_decl(), pushdecl() and finish_decl() instead of define_decl(). (add_protocols): Use PROTOCOL_BINFO_ELTS for the tree vector size. (start_protocol): Do not call build_protocol_template(); use PROTOCOL_BINFO_ELTS for the tree vector size. (encode_type_qualifiers): Do not handle the 'const' qualifier here. (encode_pointer): Encode 'const char *' as 'r*', for backwards compatibility. (encode_array): Use HOST_WIDE_INT_PRINT_DEC instead of "%ld". (encode_type): Handle the 'const' qualifier here. (objc_parmlist): New global variable, sued by objc_push_parm and objc_get_parm_info(). (objc_push_parm, objc_get_parm_info): New functions. (objc_expr_last): Remove function. (synth_self_and_ucmd_args): For instance methods, use the instance type for 'self'; call objc_push_parm() instead of push_parm_decl(). (start_method_def): Do not call push_scope(), declare_parm_level(), pop_scope(), push_parm_decl(), store_parm_decls() or objc_expr_last(); just use objc_push_parm() and objc_get_parm_info(). (comp_method_with_proto): Remove function. (objc_types_are_equivalent): Strip away indirections before comparing underlying types. (comp_proto_with_proto): Do not call groktypename(); types are no longer in raw declspec format. (objc_start_function): New function. (really_start_method): Call comp_proto_with_proto() instead of comp_method_with_proto(); call objc_start_function() instead of hand-crafting a function declarator. (continue_method_def, objc_expand_function_end): Remove functions. (get_super_receiver): Call objc_get_current_scope() instead of get_current_scope(); reference 'super_class' field (instead of 'class'). (finish_method_def): Rename to objc_finish_method_definition() and add a function decl parameter; move method encoding call from objc_expand_function_end(). (is_complex_decl, adorn_decl, gen_declarator, gen_declspecs, gen_declaration_1): Remove functions. (tmpbuf, RAW_DECLSPEC): Remove. (gen_declaration): Remove second parameter; simplify to deal with TYPE_P nodes instead of raw declspecs. (gen_type_name, gen_type_name_0): New functions. (gen_method_decl): Remove second parameter; call gen_type_name() instead of gen_declaration_1(). (dump_interface): Adjust calls to gen_declaration() and gen_method_decl(); do not allocate a separate string buffer. (init_objc): Allocate a larger string buffer to accommodate dump_interface(); adjust call to build_module_descriptor(); add call to build_module_initializer_routine() for the GNU runtime. (generate_classref_translation_entry): Do not call start_decl(); call finish_var_decl() instead of finish_decl(); call convert() instead of build_c_cast(). * objc-act.h (CLASS_OWN_IVARS): Remove accessor. (CLASS_BINFO_ELTS): Reduce from 6 to 5, now that CLASS_OWN_IVARS is gone. (OCTI_GNU_INIT_DECL, GNU_INIT_decl): New. (OCTI_ELLIPSIS_NODE, objc_ellipsis_node): Remove. (OCTI_ID_ID, id_type, objc_id_id): Rename to OCTI_ID_NAME, objc_object_type and objc_object_name, respectively. (OCTI_CLS_REF, OCTI_CLASS_NAME, objc_class_reference, objc_class_name): New. (IS_CLASS): New macro. (IS_ID, IS_SUPER): Robustify. (OCTI_EXECCLASS_DECL, execclass_decl): New. (finish_file, start_class, continue_class, finish_class, start_method_def, continue_method_def, finish_method_def, start_protocol, finish_protocol, objc_build_throw_stmt, objc_build_try_catch_finally_stmt, objc_build_synchronized_prologue, objc_build_synchronized_epilogue, objc_build_try_prologue, objc_build_try_epilogue, objc_build_catch_stmt, objc_build_catch_epilogue, objc_build_finally_prologue, objc_build_finally_epilogue, is_ivar, is_private, is_public, add_instance_variable, objc_add_method, get_super_receiver, objc_clear_super_receiver, get_class_ivars_from_name, get_class_reference, get_static_reference, get_object_reference, build_message_expr, finish_message_expr, build_selector_expr, build_ivar_reference, build_keyword_decl, build_method_decl, build_protocol_expr, build_objc_string_object, objc_declare_alias, objc_declare_class, objc_declare_protocols, objc_comptypes, objc_check_decl, build_encode_expr): Remove prototypes. (imp_count, cat_count): Make GGC-aware. (OBJC_SET_TYPE_NAME): New macro. From-SVN: r87168
2004-09-08 02:49:44 +02:00
/* Adjust for impedance mismatch. We should figure out how to build
CONSTRUCTORs that consistently please both the C and C++ gods. */
if (!TREE_PURPOSE (elts))
TREE_TYPE (constructor) = NULL_TREE;
TREE_HAS_CONSTRUCTOR (constructor) = 1;
#endif
Makefile.in (c-parse.o): Depend on $(C_COMMON_H). [gcc/ChangeLog] 2004-09-07 Ziemowit Laski <zlaski@apple.com> * Makefile.in (c-parse.o): Depend on $(C_COMMON_H). * c-parse.in: Include c-common.h instead of objc-act.h. (ivar_decl_list, ivar_decls, ivar_decl, ivars, ivar_declarator, myparms, myparm): Remove %type declarations. (methodtype, optparms, OBJC_TYPE_QUAL, objc_quals, objc_qual, objc_typename, objc_try_catch_stmt, optellipsis): Add %type declarations. (objc_inherit_code, objc_public_flag): Remove. (typespec_nonreserved_nonattr): Call objc_get_protocol_qualified_type() instead of get_static_reference() and get_protocol_reference(). (stmt_nocomp): Call grokparm() on @catch parameter. (objcdef): Move semantic action to objc_finish_implementation(). (classdef): Move semantic action to objc_start_class_interface(), objc_continue_interface(), objc_finish_interface(), objc_start_class_implementation(), objc_continue_implementation(), objc_start_category_interface() and objc_start_category_implementation(). (protocoldef): Move semantic actions to objc_start_protocol() and objc_finish_interface(). (ivar_decl_list): Remove nonterminal. (visibility_spec): Move semantic actions to objc_set_visibility(). (ivar_decls): Remove assignment to $$. (ivar_decl): Rephrase in terms of component_decl; call objc_add_instance_variable(). (ivars, ivar_declarator): Remove nonterminals. (opt_semi): New nonterminal. (methodtype): Remove semantic actions. (methoddef): Move semantic actions to objc_set_method_type(), objc_start_method_definition() and objc_finish_method_definition(). (methodproto): Move semantic actions to objc_set_method_type() and objc_add_method_declaration(). (methoddecl): Use objc_typename instead of typename; move semantic actions to objc_build_method_signature(). (optarglist, myxdecls, mydecl, myparms, myparm): Remove nonterminals. (optparmlist): Express in terms of optparms and optellipsis. (optparms, optellipsis, objc_qual, objc_quals, objc_typename): New nonterminals. (keyworddecl): Use objc_typename instead of typename. (rid_to_yy): Mark RID_IN, RID_OUT, RID_INOUT, RID_BYCOPY, RID_BYREF and RID_ONEWAY as returning OBJC_TYPE_QUAL to yyparse(). [gcc/objc/ChangeLog] 2004-09-07 Ziemowit Laski <zlaski@apple.com> * Make-lang.in (objc/objc-parse.o): Depend on $(C_COMMON_H) instead of objc/objc-act.h. (objc/objc-act.o): Depend on $(HASHTAB_H). * objc-act.c: Include hashtab.h; in ObjC++ mode, include cp-tree.h and objcp-decl.h instead of c-tree.h. (build_module_descriptor, get_class_ivars, synth_id_with_class_suffix, error_with_ivar, gen_method_decl, gen_declaration, setup_string_decl, build_protocol_template): Adjust prototypes. (build_module_initializer_routine, start_class, continue_class, finish_class, start_method_def, objc_start_function, start_protocol, build_method_decl, objc_add_method, add_instance_variable, build_ivar_reference, is_ivar, is_private, get_super_receiver, build_selector_table_decl, objc_push_parm, objc_get_parm_info, gen_type_name, gen_type_name_0, start_var_decl, finish_var_decl, create_field_decl): New prototypes. (objc_expand_function_end, comp_method_with_proto, objc_expr_last, gen_declaration_1, gen_declarator, is_complex_decl, adorn_decl, define_decl, create_builtin_decl, gen_declspecs): Remove prototypes. (TYPE_ID): Rename to OBJECT_TYPEDEF_NAME. (CLASS_TYPEDEF_NAME): New. (TAG_EXECCLASS): Change from a global variable to a #define. (TAG_RETURN_STRUCT): Delete. (TAG_GNUINIT): New, holds '__objc_gnu_init' name. (objc_inherit_code, objc_public_flag): New, moved from c-parse.in. (string_descriptor): New struct. (string_htab): New hash table. (string_hash, string_eq): New prototypes. (generate_struct_by_value_array): Call create_field_decl() instead of create_builtin_decl(). (objc_init): Do not initialize objc_ellipsis_node or TAG_EXECCLASS; In ObjC++ mode, call cxx_init() instead of c_objc_common_init(). (objc_finish_file): In ObjC++, call instantiate_pending_templates() and cp_finish_file(). (define_decl, get_static_reference, get_protocol_reference, create_builtin_decl): Remove functions. (objc_start_class_interface, objc_start_category_interface, objc_start_protocol, objc_continue_interface, objc_finish_interface, objc_start_class_implementation, objc_start_category_implementation, objc_continue_implementation, objc_finish_implementation, objc_set_visibility, objc_set_method_type, objc_build_method_signature, objc_add_method_declaration, objc_start_method_definition, objc_add_instance_variable, objc_get_protocol_qualified_type, create_field_decl, start_var_decl, finish_var_decl): New functions. (setup_string_decl): Simplify since it is only called once. (synth_module_prologue): Call build_class_template(); predefine 'id' and 'Class' as typedefs; rename 'temp_type' to 'type'; disable debug hooks for duration of function; fix GNU runtime messenger signatures to correspond to reality; forward-declare '__objc_exec_class' for the GNU runtime; call build_selector_table_decl(); in ObjC++ mode, generate 'extern "C" { ... }' wrappers around synthesized declarations; call build_protocol_template() and build_category_template(). (string_hash, string_eq): New functions. (objc_build_string_object): Check metaclass correctness only once; store string literals in hash table. (objc_build_constructor): Do not convert initializer elements; adjust for ObjC++ impedance mismatch. (build_objc_symtab_template): Call create_field_decl() instead of create_builtin_decl(). (init_objc_symtab): Add missing conversion to initializer element. (build_metadata_decl): Call start_var_decl() instead of define_decl(). (generate_objc_symtab_decl): Do not call build_category_template(); call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(). (build_module_descriptor): Call create_field_decl() instead of grokfield(); call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(); always mark module descriptor as used; move GNU runtime-specific functionality to build_module_initializer_routine(). (build_module_initializer_routine): New function, broken off of build_module_descriptor(). (objc_static_init_needed_p, objc_generate_static_init_call): New functions. (generate_static_references, generate_strings, build_selector_translation_table, generate_descriptor_table, generate_ivars_list, generate_dispatch_table, generate_category): Call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(); build a type directly instead of via groktypename(). (build_selector_reference_decl, build_selector_table_decl, build_class_reference_decl, build_protocol_reference, generate_objc_image_info): Call start_var_decl() instead of build_decl(). (build_selector_reference): For GNU runtime, do not call build_selector_reference_decl(). (build_selector, build_typed_selector_reference): Always convert result to the selector type. (add_objc_string): Cast return value to 'char *'. (build_method_prototype_template, build_selector_template, build_method_template): Use actual selector type for fields pointing to selectors. (finish_objc): For GNU runtime, call build_module_initializer_routine() after build_module_descriptor(). (generate_protocol_list, generate_shared_structures): Call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(); build a type directly instead of via groktypename(). (synth_id_with_class_suffix): Return a string. (get_arg_type_list): For instance methods, use the instance type for 'self'; do not call groktypename_in_parm_context(). (build_objc_string_decl): Squash redeclaration errors in ObjC++. (objc_is_class_name): Use OBJC_TYPE_NAME instead of TYPE_NAME; handle RECORD_TYPEs in ObjC as well as ObjC++. (objc_is_id): New function. (objc_is_object_ptr): Return the canonical type node. (objc_get_class_ivars): Simplify using get_class_ivars(). (get_class_ivars): Remove second parameter; create a fresh copy of the ivar list for each call; do not check for existence of super class. (objc_eh_runtime_type): Mark #ifndef OBJCPLUS. (objc_init_exceptions): When using SJLJ-style exceptions, require the use of '-fobjc-exceptions' flag; do not require it for DWARF-style exceptions. (objc_build_exc_ptr, next_sjlj_build_try_catch_finally): Use objc_object_type instead of objc_id_type. (objc_begin_catch_clause): Convert the incoming PARM_DECL into a VAR_DECL before placing it in the appropriate scope; do not call define_decl(); adjust call to c_begin_compound_stmt(); use objc_object_type instead of objc_id_type. (build_next_objc_exception_stuff): Call create_field_decl() instead of create_builtin_decl(); construct type directly instead of calling groktypename(); use OBJC_VOID_AT_END to mark end of function parameters. (build_private_template): Adjust call to get_class_ivars(); build a type directly instead of via groktypename(). (build_protocol_template, build_method_prototype_list_template, build_method_prototype_template, build_category_template, build_selector_template, build_class_template, build_super_template, build_ivar_template, build_ivar_list_template, build_method_list_template, build_method_template): Call create_field_decl() instead of grokfield(). (objc_method_parm_type): Do not call groktypename(). (generate_descriptor_table): Call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(). (generate_method_descriptors, build_protocol_initializer, generate_dispatch_tables, build_category_initializer, build_shared_structure_initializer): Do not call groktypename(). (generate_protocols): Call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(); do not call groktypename(). (error_with_ivar): Remove last parameter. (check_ivars): Do not iterate ovar CLASS_RAW_IVARS lists in addition to CLASS_IVARS lists; adjust calls to error_with_ivar(). (generate_ivar_lists): Convert one of the initializer elements; do not call groktypename(). (get_arg_type_list, start_method_def, gen_method_def): Account for new representation of variable arguments and '...' in Objective-C methods; add Objective-C++ impedance matching code. (is_objc_type_qualifier): Remove function. (adjust_type_for_id_default): Simplify; there is no longer a need to wade through declspecs. (lookup_interface, start_class, continue_class, finish_class, start_method_def, start_protocol, build_method_decl, objc_add_method, add_instance_variable, build_ivar_reference, is_ivar, is_private, get_super_receiver, objc_build_finally_epilogue): Make into static functions. (receiver_is_class_object): Use new IS_CLASS() macro. (objc_build_message_expr): Tweak ObjC++ message argument handling; call objc_finish_message_expr() instead of finish_message_expr(). (finish_message_expr): Rename to objc_finish_message_expr(); use OBJC_TYPE_NAME and OBJC_SET_TYPE_NAME macros instead of TYPE_NAME. call gen_type_name() instead of gen_declaration(); call objc_is_id() instead of using IS_ID and IS_CLASS; Use objc_class_name instead of calling get_identifier("Class"); handle CONVERT_EXPRs in receiver. (build_objc_method_call, warn_with_method): Do not call groktypename(). (build_ivar_reference): Call convert() instead of clobbering in a type. (hash_init): Initialize string_htab hash table. (add_instance_variable): Simplify parameter list; do not call grokfield(); do not populate CLASS_IVARS list. (start_class): Check for the existence of super class, if one was specified. (continue_class): Use CLASS_RAW_IVARS rather than CLASS_IVARS; do not call build_class_template(); adjust call to get_class_ivars(); call build_decl(), pushdecl() and finish_decl() instead of define_decl(). (finish_class): Call build_decl(), pushdecl() and finish_decl() instead of define_decl(). (add_protocols): Use PROTOCOL_BINFO_ELTS for the tree vector size. (start_protocol): Do not call build_protocol_template(); use PROTOCOL_BINFO_ELTS for the tree vector size. (encode_type_qualifiers): Do not handle the 'const' qualifier here. (encode_pointer): Encode 'const char *' as 'r*', for backwards compatibility. (encode_array): Use HOST_WIDE_INT_PRINT_DEC instead of "%ld". (encode_type): Handle the 'const' qualifier here. (objc_parmlist): New global variable, sued by objc_push_parm and objc_get_parm_info(). (objc_push_parm, objc_get_parm_info): New functions. (objc_expr_last): Remove function. (synth_self_and_ucmd_args): For instance methods, use the instance type for 'self'; call objc_push_parm() instead of push_parm_decl(). (start_method_def): Do not call push_scope(), declare_parm_level(), pop_scope(), push_parm_decl(), store_parm_decls() or objc_expr_last(); just use objc_push_parm() and objc_get_parm_info(). (comp_method_with_proto): Remove function. (objc_types_are_equivalent): Strip away indirections before comparing underlying types. (comp_proto_with_proto): Do not call groktypename(); types are no longer in raw declspec format. (objc_start_function): New function. (really_start_method): Call comp_proto_with_proto() instead of comp_method_with_proto(); call objc_start_function() instead of hand-crafting a function declarator. (continue_method_def, objc_expand_function_end): Remove functions. (get_super_receiver): Call objc_get_current_scope() instead of get_current_scope(); reference 'super_class' field (instead of 'class'). (finish_method_def): Rename to objc_finish_method_definition() and add a function decl parameter; move method encoding call from objc_expand_function_end(). (is_complex_decl, adorn_decl, gen_declarator, gen_declspecs, gen_declaration_1): Remove functions. (tmpbuf, RAW_DECLSPEC): Remove. (gen_declaration): Remove second parameter; simplify to deal with TYPE_P nodes instead of raw declspecs. (gen_type_name, gen_type_name_0): New functions. (gen_method_decl): Remove second parameter; call gen_type_name() instead of gen_declaration_1(). (dump_interface): Adjust calls to gen_declaration() and gen_method_decl(); do not allocate a separate string buffer. (init_objc): Allocate a larger string buffer to accommodate dump_interface(); adjust call to build_module_descriptor(); add call to build_module_initializer_routine() for the GNU runtime. (generate_classref_translation_entry): Do not call start_decl(); call finish_var_decl() instead of finish_decl(); call convert() instead of build_c_cast(). * objc-act.h (CLASS_OWN_IVARS): Remove accessor. (CLASS_BINFO_ELTS): Reduce from 6 to 5, now that CLASS_OWN_IVARS is gone. (OCTI_GNU_INIT_DECL, GNU_INIT_decl): New. (OCTI_ELLIPSIS_NODE, objc_ellipsis_node): Remove. (OCTI_ID_ID, id_type, objc_id_id): Rename to OCTI_ID_NAME, objc_object_type and objc_object_name, respectively. (OCTI_CLS_REF, OCTI_CLASS_NAME, objc_class_reference, objc_class_name): New. (IS_CLASS): New macro. (IS_ID, IS_SUPER): Robustify. (OCTI_EXECCLASS_DECL, execclass_decl): New. (finish_file, start_class, continue_class, finish_class, start_method_def, continue_method_def, finish_method_def, start_protocol, finish_protocol, objc_build_throw_stmt, objc_build_try_catch_finally_stmt, objc_build_synchronized_prologue, objc_build_synchronized_epilogue, objc_build_try_prologue, objc_build_try_epilogue, objc_build_catch_stmt, objc_build_catch_epilogue, objc_build_finally_prologue, objc_build_finally_epilogue, is_ivar, is_private, is_public, add_instance_variable, objc_add_method, get_super_receiver, objc_clear_super_receiver, get_class_ivars_from_name, get_class_reference, get_static_reference, get_object_reference, build_message_expr, finish_message_expr, build_selector_expr, build_ivar_reference, build_keyword_decl, build_method_decl, build_protocol_expr, build_objc_string_object, objc_declare_alias, objc_declare_class, objc_declare_protocols, objc_comptypes, objc_check_decl, build_encode_expr): Remove prototypes. (imp_count, cat_count): Make GGC-aware. (OBJC_SET_TYPE_NAME): New macro. From-SVN: r87168
2004-09-08 02:49:44 +02:00
return constructor;
1992-01-18 00:15:38 +01:00
}
/* Take care of defining and initializing _OBJC_SYMBOLS. */
/* Predefine the following data type:
struct _objc_symtab
{
long sel_ref_cnt;
SEL *refs;
short cls_def_cnt;
short cat_def_cnt;
void *defs[cls_def_cnt + cat_def_cnt];
}; */
1992-01-18 00:15:38 +01:00
static void
build_objc_symtab_template (void)
1992-01-18 00:15:38 +01:00
{
tree field_decl, field_decl_chain;
1992-01-18 00:15:38 +01:00
objc_symtab_template
= start_struct (RECORD_TYPE, get_identifier (UTAG_SYMTAB));
1992-01-18 00:15:38 +01:00
/* long sel_ref_cnt; */
Makefile.in (c-parse.o): Depend on $(C_COMMON_H). [gcc/ChangeLog] 2004-09-07 Ziemowit Laski <zlaski@apple.com> * Makefile.in (c-parse.o): Depend on $(C_COMMON_H). * c-parse.in: Include c-common.h instead of objc-act.h. (ivar_decl_list, ivar_decls, ivar_decl, ivars, ivar_declarator, myparms, myparm): Remove %type declarations. (methodtype, optparms, OBJC_TYPE_QUAL, objc_quals, objc_qual, objc_typename, objc_try_catch_stmt, optellipsis): Add %type declarations. (objc_inherit_code, objc_public_flag): Remove. (typespec_nonreserved_nonattr): Call objc_get_protocol_qualified_type() instead of get_static_reference() and get_protocol_reference(). (stmt_nocomp): Call grokparm() on @catch parameter. (objcdef): Move semantic action to objc_finish_implementation(). (classdef): Move semantic action to objc_start_class_interface(), objc_continue_interface(), objc_finish_interface(), objc_start_class_implementation(), objc_continue_implementation(), objc_start_category_interface() and objc_start_category_implementation(). (protocoldef): Move semantic actions to objc_start_protocol() and objc_finish_interface(). (ivar_decl_list): Remove nonterminal. (visibility_spec): Move semantic actions to objc_set_visibility(). (ivar_decls): Remove assignment to $$. (ivar_decl): Rephrase in terms of component_decl; call objc_add_instance_variable(). (ivars, ivar_declarator): Remove nonterminals. (opt_semi): New nonterminal. (methodtype): Remove semantic actions. (methoddef): Move semantic actions to objc_set_method_type(), objc_start_method_definition() and objc_finish_method_definition(). (methodproto): Move semantic actions to objc_set_method_type() and objc_add_method_declaration(). (methoddecl): Use objc_typename instead of typename; move semantic actions to objc_build_method_signature(). (optarglist, myxdecls, mydecl, myparms, myparm): Remove nonterminals. (optparmlist): Express in terms of optparms and optellipsis. (optparms, optellipsis, objc_qual, objc_quals, objc_typename): New nonterminals. (keyworddecl): Use objc_typename instead of typename. (rid_to_yy): Mark RID_IN, RID_OUT, RID_INOUT, RID_BYCOPY, RID_BYREF and RID_ONEWAY as returning OBJC_TYPE_QUAL to yyparse(). [gcc/objc/ChangeLog] 2004-09-07 Ziemowit Laski <zlaski@apple.com> * Make-lang.in (objc/objc-parse.o): Depend on $(C_COMMON_H) instead of objc/objc-act.h. (objc/objc-act.o): Depend on $(HASHTAB_H). * objc-act.c: Include hashtab.h; in ObjC++ mode, include cp-tree.h and objcp-decl.h instead of c-tree.h. (build_module_descriptor, get_class_ivars, synth_id_with_class_suffix, error_with_ivar, gen_method_decl, gen_declaration, setup_string_decl, build_protocol_template): Adjust prototypes. (build_module_initializer_routine, start_class, continue_class, finish_class, start_method_def, objc_start_function, start_protocol, build_method_decl, objc_add_method, add_instance_variable, build_ivar_reference, is_ivar, is_private, get_super_receiver, build_selector_table_decl, objc_push_parm, objc_get_parm_info, gen_type_name, gen_type_name_0, start_var_decl, finish_var_decl, create_field_decl): New prototypes. (objc_expand_function_end, comp_method_with_proto, objc_expr_last, gen_declaration_1, gen_declarator, is_complex_decl, adorn_decl, define_decl, create_builtin_decl, gen_declspecs): Remove prototypes. (TYPE_ID): Rename to OBJECT_TYPEDEF_NAME. (CLASS_TYPEDEF_NAME): New. (TAG_EXECCLASS): Change from a global variable to a #define. (TAG_RETURN_STRUCT): Delete. (TAG_GNUINIT): New, holds '__objc_gnu_init' name. (objc_inherit_code, objc_public_flag): New, moved from c-parse.in. (string_descriptor): New struct. (string_htab): New hash table. (string_hash, string_eq): New prototypes. (generate_struct_by_value_array): Call create_field_decl() instead of create_builtin_decl(). (objc_init): Do not initialize objc_ellipsis_node or TAG_EXECCLASS; In ObjC++ mode, call cxx_init() instead of c_objc_common_init(). (objc_finish_file): In ObjC++, call instantiate_pending_templates() and cp_finish_file(). (define_decl, get_static_reference, get_protocol_reference, create_builtin_decl): Remove functions. (objc_start_class_interface, objc_start_category_interface, objc_start_protocol, objc_continue_interface, objc_finish_interface, objc_start_class_implementation, objc_start_category_implementation, objc_continue_implementation, objc_finish_implementation, objc_set_visibility, objc_set_method_type, objc_build_method_signature, objc_add_method_declaration, objc_start_method_definition, objc_add_instance_variable, objc_get_protocol_qualified_type, create_field_decl, start_var_decl, finish_var_decl): New functions. (setup_string_decl): Simplify since it is only called once. (synth_module_prologue): Call build_class_template(); predefine 'id' and 'Class' as typedefs; rename 'temp_type' to 'type'; disable debug hooks for duration of function; fix GNU runtime messenger signatures to correspond to reality; forward-declare '__objc_exec_class' for the GNU runtime; call build_selector_table_decl(); in ObjC++ mode, generate 'extern "C" { ... }' wrappers around synthesized declarations; call build_protocol_template() and build_category_template(). (string_hash, string_eq): New functions. (objc_build_string_object): Check metaclass correctness only once; store string literals in hash table. (objc_build_constructor): Do not convert initializer elements; adjust for ObjC++ impedance mismatch. (build_objc_symtab_template): Call create_field_decl() instead of create_builtin_decl(). (init_objc_symtab): Add missing conversion to initializer element. (build_metadata_decl): Call start_var_decl() instead of define_decl(). (generate_objc_symtab_decl): Do not call build_category_template(); call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(). (build_module_descriptor): Call create_field_decl() instead of grokfield(); call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(); always mark module descriptor as used; move GNU runtime-specific functionality to build_module_initializer_routine(). (build_module_initializer_routine): New function, broken off of build_module_descriptor(). (objc_static_init_needed_p, objc_generate_static_init_call): New functions. (generate_static_references, generate_strings, build_selector_translation_table, generate_descriptor_table, generate_ivars_list, generate_dispatch_table, generate_category): Call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(); build a type directly instead of via groktypename(). (build_selector_reference_decl, build_selector_table_decl, build_class_reference_decl, build_protocol_reference, generate_objc_image_info): Call start_var_decl() instead of build_decl(). (build_selector_reference): For GNU runtime, do not call build_selector_reference_decl(). (build_selector, build_typed_selector_reference): Always convert result to the selector type. (add_objc_string): Cast return value to 'char *'. (build_method_prototype_template, build_selector_template, build_method_template): Use actual selector type for fields pointing to selectors. (finish_objc): For GNU runtime, call build_module_initializer_routine() after build_module_descriptor(). (generate_protocol_list, generate_shared_structures): Call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(); build a type directly instead of via groktypename(). (synth_id_with_class_suffix): Return a string. (get_arg_type_list): For instance methods, use the instance type for 'self'; do not call groktypename_in_parm_context(). (build_objc_string_decl): Squash redeclaration errors in ObjC++. (objc_is_class_name): Use OBJC_TYPE_NAME instead of TYPE_NAME; handle RECORD_TYPEs in ObjC as well as ObjC++. (objc_is_id): New function. (objc_is_object_ptr): Return the canonical type node. (objc_get_class_ivars): Simplify using get_class_ivars(). (get_class_ivars): Remove second parameter; create a fresh copy of the ivar list for each call; do not check for existence of super class. (objc_eh_runtime_type): Mark #ifndef OBJCPLUS. (objc_init_exceptions): When using SJLJ-style exceptions, require the use of '-fobjc-exceptions' flag; do not require it for DWARF-style exceptions. (objc_build_exc_ptr, next_sjlj_build_try_catch_finally): Use objc_object_type instead of objc_id_type. (objc_begin_catch_clause): Convert the incoming PARM_DECL into a VAR_DECL before placing it in the appropriate scope; do not call define_decl(); adjust call to c_begin_compound_stmt(); use objc_object_type instead of objc_id_type. (build_next_objc_exception_stuff): Call create_field_decl() instead of create_builtin_decl(); construct type directly instead of calling groktypename(); use OBJC_VOID_AT_END to mark end of function parameters. (build_private_template): Adjust call to get_class_ivars(); build a type directly instead of via groktypename(). (build_protocol_template, build_method_prototype_list_template, build_method_prototype_template, build_category_template, build_selector_template, build_class_template, build_super_template, build_ivar_template, build_ivar_list_template, build_method_list_template, build_method_template): Call create_field_decl() instead of grokfield(). (objc_method_parm_type): Do not call groktypename(). (generate_descriptor_table): Call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(). (generate_method_descriptors, build_protocol_initializer, generate_dispatch_tables, build_category_initializer, build_shared_structure_initializer): Do not call groktypename(). (generate_protocols): Call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(); do not call groktypename(). (error_with_ivar): Remove last parameter. (check_ivars): Do not iterate ovar CLASS_RAW_IVARS lists in addition to CLASS_IVARS lists; adjust calls to error_with_ivar(). (generate_ivar_lists): Convert one of the initializer elements; do not call groktypename(). (get_arg_type_list, start_method_def, gen_method_def): Account for new representation of variable arguments and '...' in Objective-C methods; add Objective-C++ impedance matching code. (is_objc_type_qualifier): Remove function. (adjust_type_for_id_default): Simplify; there is no longer a need to wade through declspecs. (lookup_interface, start_class, continue_class, finish_class, start_method_def, start_protocol, build_method_decl, objc_add_method, add_instance_variable, build_ivar_reference, is_ivar, is_private, get_super_receiver, objc_build_finally_epilogue): Make into static functions. (receiver_is_class_object): Use new IS_CLASS() macro. (objc_build_message_expr): Tweak ObjC++ message argument handling; call objc_finish_message_expr() instead of finish_message_expr(). (finish_message_expr): Rename to objc_finish_message_expr(); use OBJC_TYPE_NAME and OBJC_SET_TYPE_NAME macros instead of TYPE_NAME. call gen_type_name() instead of gen_declaration(); call objc_is_id() instead of using IS_ID and IS_CLASS; Use objc_class_name instead of calling get_identifier("Class"); handle CONVERT_EXPRs in receiver. (build_objc_method_call, warn_with_method): Do not call groktypename(). (build_ivar_reference): Call convert() instead of clobbering in a type. (hash_init): Initialize string_htab hash table. (add_instance_variable): Simplify parameter list; do not call grokfield(); do not populate CLASS_IVARS list. (start_class): Check for the existence of super class, if one was specified. (continue_class): Use CLASS_RAW_IVARS rather than CLASS_IVARS; do not call build_class_template(); adjust call to get_class_ivars(); call build_decl(), pushdecl() and finish_decl() instead of define_decl(). (finish_class): Call build_decl(), pushdecl() and finish_decl() instead of define_decl(). (add_protocols): Use PROTOCOL_BINFO_ELTS for the tree vector size. (start_protocol): Do not call build_protocol_template(); use PROTOCOL_BINFO_ELTS for the tree vector size. (encode_type_qualifiers): Do not handle the 'const' qualifier here. (encode_pointer): Encode 'const char *' as 'r*', for backwards compatibility. (encode_array): Use HOST_WIDE_INT_PRINT_DEC instead of "%ld". (encode_type): Handle the 'const' qualifier here. (objc_parmlist): New global variable, sued by objc_push_parm and objc_get_parm_info(). (objc_push_parm, objc_get_parm_info): New functions. (objc_expr_last): Remove function. (synth_self_and_ucmd_args): For instance methods, use the instance type for 'self'; call objc_push_parm() instead of push_parm_decl(). (start_method_def): Do not call push_scope(), declare_parm_level(), pop_scope(), push_parm_decl(), store_parm_decls() or objc_expr_last(); just use objc_push_parm() and objc_get_parm_info(). (comp_method_with_proto): Remove function. (objc_types_are_equivalent): Strip away indirections before comparing underlying types. (comp_proto_with_proto): Do not call groktypename(); types are no longer in raw declspec format. (objc_start_function): New function. (really_start_method): Call comp_proto_with_proto() instead of comp_method_with_proto(); call objc_start_function() instead of hand-crafting a function declarator. (continue_method_def, objc_expand_function_end): Remove functions. (get_super_receiver): Call objc_get_current_scope() instead of get_current_scope(); reference 'super_class' field (instead of 'class'). (finish_method_def): Rename to objc_finish_method_definition() and add a function decl parameter; move method encoding call from objc_expand_function_end(). (is_complex_decl, adorn_decl, gen_declarator, gen_declspecs, gen_declaration_1): Remove functions. (tmpbuf, RAW_DECLSPEC): Remove. (gen_declaration): Remove second parameter; simplify to deal with TYPE_P nodes instead of raw declspecs. (gen_type_name, gen_type_name_0): New functions. (gen_method_decl): Remove second parameter; call gen_type_name() instead of gen_declaration_1(). (dump_interface): Adjust calls to gen_declaration() and gen_method_decl(); do not allocate a separate string buffer. (init_objc): Allocate a larger string buffer to accommodate dump_interface(); adjust call to build_module_descriptor(); add call to build_module_initializer_routine() for the GNU runtime. (generate_classref_translation_entry): Do not call start_decl(); call finish_var_decl() instead of finish_decl(); call convert() instead of build_c_cast(). * objc-act.h (CLASS_OWN_IVARS): Remove accessor. (CLASS_BINFO_ELTS): Reduce from 6 to 5, now that CLASS_OWN_IVARS is gone. (OCTI_GNU_INIT_DECL, GNU_INIT_decl): New. (OCTI_ELLIPSIS_NODE, objc_ellipsis_node): Remove. (OCTI_ID_ID, id_type, objc_id_id): Rename to OCTI_ID_NAME, objc_object_type and objc_object_name, respectively. (OCTI_CLS_REF, OCTI_CLASS_NAME, objc_class_reference, objc_class_name): New. (IS_CLASS): New macro. (IS_ID, IS_SUPER): Robustify. (OCTI_EXECCLASS_DECL, execclass_decl): New. (finish_file, start_class, continue_class, finish_class, start_method_def, continue_method_def, finish_method_def, start_protocol, finish_protocol, objc_build_throw_stmt, objc_build_try_catch_finally_stmt, objc_build_synchronized_prologue, objc_build_synchronized_epilogue, objc_build_try_prologue, objc_build_try_epilogue, objc_build_catch_stmt, objc_build_catch_epilogue, objc_build_finally_prologue, objc_build_finally_epilogue, is_ivar, is_private, is_public, add_instance_variable, objc_add_method, get_super_receiver, objc_clear_super_receiver, get_class_ivars_from_name, get_class_reference, get_static_reference, get_object_reference, build_message_expr, finish_message_expr, build_selector_expr, build_ivar_reference, build_keyword_decl, build_method_decl, build_protocol_expr, build_objc_string_object, objc_declare_alias, objc_declare_class, objc_declare_protocols, objc_comptypes, objc_check_decl, build_encode_expr): Remove prototypes. (imp_count, cat_count): Make GGC-aware. (OBJC_SET_TYPE_NAME): New macro. From-SVN: r87168
2004-09-08 02:49:44 +02:00
field_decl = create_field_decl (long_integer_type_node, "sel_ref_cnt");
1992-01-18 00:15:38 +01:00
field_decl_chain = field_decl;
/* SEL *refs; */
Makefile.in (c-parse.o): Depend on $(C_COMMON_H). [gcc/ChangeLog] 2004-09-07 Ziemowit Laski <zlaski@apple.com> * Makefile.in (c-parse.o): Depend on $(C_COMMON_H). * c-parse.in: Include c-common.h instead of objc-act.h. (ivar_decl_list, ivar_decls, ivar_decl, ivars, ivar_declarator, myparms, myparm): Remove %type declarations. (methodtype, optparms, OBJC_TYPE_QUAL, objc_quals, objc_qual, objc_typename, objc_try_catch_stmt, optellipsis): Add %type declarations. (objc_inherit_code, objc_public_flag): Remove. (typespec_nonreserved_nonattr): Call objc_get_protocol_qualified_type() instead of get_static_reference() and get_protocol_reference(). (stmt_nocomp): Call grokparm() on @catch parameter. (objcdef): Move semantic action to objc_finish_implementation(). (classdef): Move semantic action to objc_start_class_interface(), objc_continue_interface(), objc_finish_interface(), objc_start_class_implementation(), objc_continue_implementation(), objc_start_category_interface() and objc_start_category_implementation(). (protocoldef): Move semantic actions to objc_start_protocol() and objc_finish_interface(). (ivar_decl_list): Remove nonterminal. (visibility_spec): Move semantic actions to objc_set_visibility(). (ivar_decls): Remove assignment to $$. (ivar_decl): Rephrase in terms of component_decl; call objc_add_instance_variable(). (ivars, ivar_declarator): Remove nonterminals. (opt_semi): New nonterminal. (methodtype): Remove semantic actions. (methoddef): Move semantic actions to objc_set_method_type(), objc_start_method_definition() and objc_finish_method_definition(). (methodproto): Move semantic actions to objc_set_method_type() and objc_add_method_declaration(). (methoddecl): Use objc_typename instead of typename; move semantic actions to objc_build_method_signature(). (optarglist, myxdecls, mydecl, myparms, myparm): Remove nonterminals. (optparmlist): Express in terms of optparms and optellipsis. (optparms, optellipsis, objc_qual, objc_quals, objc_typename): New nonterminals. (keyworddecl): Use objc_typename instead of typename. (rid_to_yy): Mark RID_IN, RID_OUT, RID_INOUT, RID_BYCOPY, RID_BYREF and RID_ONEWAY as returning OBJC_TYPE_QUAL to yyparse(). [gcc/objc/ChangeLog] 2004-09-07 Ziemowit Laski <zlaski@apple.com> * Make-lang.in (objc/objc-parse.o): Depend on $(C_COMMON_H) instead of objc/objc-act.h. (objc/objc-act.o): Depend on $(HASHTAB_H). * objc-act.c: Include hashtab.h; in ObjC++ mode, include cp-tree.h and objcp-decl.h instead of c-tree.h. (build_module_descriptor, get_class_ivars, synth_id_with_class_suffix, error_with_ivar, gen_method_decl, gen_declaration, setup_string_decl, build_protocol_template): Adjust prototypes. (build_module_initializer_routine, start_class, continue_class, finish_class, start_method_def, objc_start_function, start_protocol, build_method_decl, objc_add_method, add_instance_variable, build_ivar_reference, is_ivar, is_private, get_super_receiver, build_selector_table_decl, objc_push_parm, objc_get_parm_info, gen_type_name, gen_type_name_0, start_var_decl, finish_var_decl, create_field_decl): New prototypes. (objc_expand_function_end, comp_method_with_proto, objc_expr_last, gen_declaration_1, gen_declarator, is_complex_decl, adorn_decl, define_decl, create_builtin_decl, gen_declspecs): Remove prototypes. (TYPE_ID): Rename to OBJECT_TYPEDEF_NAME. (CLASS_TYPEDEF_NAME): New. (TAG_EXECCLASS): Change from a global variable to a #define. (TAG_RETURN_STRUCT): Delete. (TAG_GNUINIT): New, holds '__objc_gnu_init' name. (objc_inherit_code, objc_public_flag): New, moved from c-parse.in. (string_descriptor): New struct. (string_htab): New hash table. (string_hash, string_eq): New prototypes. (generate_struct_by_value_array): Call create_field_decl() instead of create_builtin_decl(). (objc_init): Do not initialize objc_ellipsis_node or TAG_EXECCLASS; In ObjC++ mode, call cxx_init() instead of c_objc_common_init(). (objc_finish_file): In ObjC++, call instantiate_pending_templates() and cp_finish_file(). (define_decl, get_static_reference, get_protocol_reference, create_builtin_decl): Remove functions. (objc_start_class_interface, objc_start_category_interface, objc_start_protocol, objc_continue_interface, objc_finish_interface, objc_start_class_implementation, objc_start_category_implementation, objc_continue_implementation, objc_finish_implementation, objc_set_visibility, objc_set_method_type, objc_build_method_signature, objc_add_method_declaration, objc_start_method_definition, objc_add_instance_variable, objc_get_protocol_qualified_type, create_field_decl, start_var_decl, finish_var_decl): New functions. (setup_string_decl): Simplify since it is only called once. (synth_module_prologue): Call build_class_template(); predefine 'id' and 'Class' as typedefs; rename 'temp_type' to 'type'; disable debug hooks for duration of function; fix GNU runtime messenger signatures to correspond to reality; forward-declare '__objc_exec_class' for the GNU runtime; call build_selector_table_decl(); in ObjC++ mode, generate 'extern "C" { ... }' wrappers around synthesized declarations; call build_protocol_template() and build_category_template(). (string_hash, string_eq): New functions. (objc_build_string_object): Check metaclass correctness only once; store string literals in hash table. (objc_build_constructor): Do not convert initializer elements; adjust for ObjC++ impedance mismatch. (build_objc_symtab_template): Call create_field_decl() instead of create_builtin_decl(). (init_objc_symtab): Add missing conversion to initializer element. (build_metadata_decl): Call start_var_decl() instead of define_decl(). (generate_objc_symtab_decl): Do not call build_category_template(); call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(). (build_module_descriptor): Call create_field_decl() instead of grokfield(); call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(); always mark module descriptor as used; move GNU runtime-specific functionality to build_module_initializer_routine(). (build_module_initializer_routine): New function, broken off of build_module_descriptor(). (objc_static_init_needed_p, objc_generate_static_init_call): New functions. (generate_static_references, generate_strings, build_selector_translation_table, generate_descriptor_table, generate_ivars_list, generate_dispatch_table, generate_category): Call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(); build a type directly instead of via groktypename(). (build_selector_reference_decl, build_selector_table_decl, build_class_reference_decl, build_protocol_reference, generate_objc_image_info): Call start_var_decl() instead of build_decl(). (build_selector_reference): For GNU runtime, do not call build_selector_reference_decl(). (build_selector, build_typed_selector_reference): Always convert result to the selector type. (add_objc_string): Cast return value to 'char *'. (build_method_prototype_template, build_selector_template, build_method_template): Use actual selector type for fields pointing to selectors. (finish_objc): For GNU runtime, call build_module_initializer_routine() after build_module_descriptor(). (generate_protocol_list, generate_shared_structures): Call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(); build a type directly instead of via groktypename(). (synth_id_with_class_suffix): Return a string. (get_arg_type_list): For instance methods, use the instance type for 'self'; do not call groktypename_in_parm_context(). (build_objc_string_decl): Squash redeclaration errors in ObjC++. (objc_is_class_name): Use OBJC_TYPE_NAME instead of TYPE_NAME; handle RECORD_TYPEs in ObjC as well as ObjC++. (objc_is_id): New function. (objc_is_object_ptr): Return the canonical type node. (objc_get_class_ivars): Simplify using get_class_ivars(). (get_class_ivars): Remove second parameter; create a fresh copy of the ivar list for each call; do not check for existence of super class. (objc_eh_runtime_type): Mark #ifndef OBJCPLUS. (objc_init_exceptions): When using SJLJ-style exceptions, require the use of '-fobjc-exceptions' flag; do not require it for DWARF-style exceptions. (objc_build_exc_ptr, next_sjlj_build_try_catch_finally): Use objc_object_type instead of objc_id_type. (objc_begin_catch_clause): Convert the incoming PARM_DECL into a VAR_DECL before placing it in the appropriate scope; do not call define_decl(); adjust call to c_begin_compound_stmt(); use objc_object_type instead of objc_id_type. (build_next_objc_exception_stuff): Call create_field_decl() instead of create_builtin_decl(); construct type directly instead of calling groktypename(); use OBJC_VOID_AT_END to mark end of function parameters. (build_private_template): Adjust call to get_class_ivars(); build a type directly instead of via groktypename(). (build_protocol_template, build_method_prototype_list_template, build_method_prototype_template, build_category_template, build_selector_template, build_class_template, build_super_template, build_ivar_template, build_ivar_list_template, build_method_list_template, build_method_template): Call create_field_decl() instead of grokfield(). (objc_method_parm_type): Do not call groktypename(). (generate_descriptor_table): Call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(). (generate_method_descriptors, build_protocol_initializer, generate_dispatch_tables, build_category_initializer, build_shared_structure_initializer): Do not call groktypename(). (generate_protocols): Call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(); do not call groktypename(). (error_with_ivar): Remove last parameter. (check_ivars): Do not iterate ovar CLASS_RAW_IVARS lists in addition to CLASS_IVARS lists; adjust calls to error_with_ivar(). (generate_ivar_lists): Convert one of the initializer elements; do not call groktypename(). (get_arg_type_list, start_method_def, gen_method_def): Account for new representation of variable arguments and '...' in Objective-C methods; add Objective-C++ impedance matching code. (is_objc_type_qualifier): Remove function. (adjust_type_for_id_default): Simplify; there is no longer a need to wade through declspecs. (lookup_interface, start_class, continue_class, finish_class, start_method_def, start_protocol, build_method_decl, objc_add_method, add_instance_variable, build_ivar_reference, is_ivar, is_private, get_super_receiver, objc_build_finally_epilogue): Make into static functions. (receiver_is_class_object): Use new IS_CLASS() macro. (objc_build_message_expr): Tweak ObjC++ message argument handling; call objc_finish_message_expr() instead of finish_message_expr(). (finish_message_expr): Rename to objc_finish_message_expr(); use OBJC_TYPE_NAME and OBJC_SET_TYPE_NAME macros instead of TYPE_NAME. call gen_type_name() instead of gen_declaration(); call objc_is_id() instead of using IS_ID and IS_CLASS; Use objc_class_name instead of calling get_identifier("Class"); handle CONVERT_EXPRs in receiver. (build_objc_method_call, warn_with_method): Do not call groktypename(). (build_ivar_reference): Call convert() instead of clobbering in a type. (hash_init): Initialize string_htab hash table. (add_instance_variable): Simplify parameter list; do not call grokfield(); do not populate CLASS_IVARS list. (start_class): Check for the existence of super class, if one was specified. (continue_class): Use CLASS_RAW_IVARS rather than CLASS_IVARS; do not call build_class_template(); adjust call to get_class_ivars(); call build_decl(), pushdecl() and finish_decl() instead of define_decl(). (finish_class): Call build_decl(), pushdecl() and finish_decl() instead of define_decl(). (add_protocols): Use PROTOCOL_BINFO_ELTS for the tree vector size. (start_protocol): Do not call build_protocol_template(); use PROTOCOL_BINFO_ELTS for the tree vector size. (encode_type_qualifiers): Do not handle the 'const' qualifier here. (encode_pointer): Encode 'const char *' as 'r*', for backwards compatibility. (encode_array): Use HOST_WIDE_INT_PRINT_DEC instead of "%ld". (encode_type): Handle the 'const' qualifier here. (objc_parmlist): New global variable, sued by objc_push_parm and objc_get_parm_info(). (objc_push_parm, objc_get_parm_info): New functions. (objc_expr_last): Remove function. (synth_self_and_ucmd_args): For instance methods, use the instance type for 'self'; call objc_push_parm() instead of push_parm_decl(). (start_method_def): Do not call push_scope(), declare_parm_level(), pop_scope(), push_parm_decl(), store_parm_decls() or objc_expr_last(); just use objc_push_parm() and objc_get_parm_info(). (comp_method_with_proto): Remove function. (objc_types_are_equivalent): Strip away indirections before comparing underlying types. (comp_proto_with_proto): Do not call groktypename(); types are no longer in raw declspec format. (objc_start_function): New function. (really_start_method): Call comp_proto_with_proto() instead of comp_method_with_proto(); call objc_start_function() instead of hand-crafting a function declarator. (continue_method_def, objc_expand_function_end): Remove functions. (get_super_receiver): Call objc_get_current_scope() instead of get_current_scope(); reference 'super_class' field (instead of 'class'). (finish_method_def): Rename to objc_finish_method_definition() and add a function decl parameter; move method encoding call from objc_expand_function_end(). (is_complex_decl, adorn_decl, gen_declarator, gen_declspecs, gen_declaration_1): Remove functions. (tmpbuf, RAW_DECLSPEC): Remove. (gen_declaration): Remove second parameter; simplify to deal with TYPE_P nodes instead of raw declspecs. (gen_type_name, gen_type_name_0): New functions. (gen_method_decl): Remove second parameter; call gen_type_name() instead of gen_declaration_1(). (dump_interface): Adjust calls to gen_declaration() and gen_method_decl(); do not allocate a separate string buffer. (init_objc): Allocate a larger string buffer to accommodate dump_interface(); adjust call to build_module_descriptor(); add call to build_module_initializer_routine() for the GNU runtime. (generate_classref_translation_entry): Do not call start_decl(); call finish_var_decl() instead of finish_decl(); call convert() instead of build_c_cast(). * objc-act.h (CLASS_OWN_IVARS): Remove accessor. (CLASS_BINFO_ELTS): Reduce from 6 to 5, now that CLASS_OWN_IVARS is gone. (OCTI_GNU_INIT_DECL, GNU_INIT_decl): New. (OCTI_ELLIPSIS_NODE, objc_ellipsis_node): Remove. (OCTI_ID_ID, id_type, objc_id_id): Rename to OCTI_ID_NAME, objc_object_type and objc_object_name, respectively. (OCTI_CLS_REF, OCTI_CLASS_NAME, objc_class_reference, objc_class_name): New. (IS_CLASS): New macro. (IS_ID, IS_SUPER): Robustify. (OCTI_EXECCLASS_DECL, execclass_decl): New. (finish_file, start_class, continue_class, finish_class, start_method_def, continue_method_def, finish_method_def, start_protocol, finish_protocol, objc_build_throw_stmt, objc_build_try_catch_finally_stmt, objc_build_synchronized_prologue, objc_build_synchronized_epilogue, objc_build_try_prologue, objc_build_try_epilogue, objc_build_catch_stmt, objc_build_catch_epilogue, objc_build_finally_prologue, objc_build_finally_epilogue, is_ivar, is_private, is_public, add_instance_variable, objc_add_method, get_super_receiver, objc_clear_super_receiver, get_class_ivars_from_name, get_class_reference, get_static_reference, get_object_reference, build_message_expr, finish_message_expr, build_selector_expr, build_ivar_reference, build_keyword_decl, build_method_decl, build_protocol_expr, build_objc_string_object, objc_declare_alias, objc_declare_class, objc_declare_protocols, objc_comptypes, objc_check_decl, build_encode_expr): Remove prototypes. (imp_count, cat_count): Make GGC-aware. (OBJC_SET_TYPE_NAME): New macro. From-SVN: r87168
2004-09-08 02:49:44 +02:00
field_decl = create_field_decl (build_pointer_type (objc_selector_type),
"refs");
1992-01-18 00:15:38 +01:00
chainon (field_decl_chain, field_decl);
/* short cls_def_cnt; */
Makefile.in (c-parse.o): Depend on $(C_COMMON_H). [gcc/ChangeLog] 2004-09-07 Ziemowit Laski <zlaski@apple.com> * Makefile.in (c-parse.o): Depend on $(C_COMMON_H). * c-parse.in: Include c-common.h instead of objc-act.h. (ivar_decl_list, ivar_decls, ivar_decl, ivars, ivar_declarator, myparms, myparm): Remove %type declarations. (methodtype, optparms, OBJC_TYPE_QUAL, objc_quals, objc_qual, objc_typename, objc_try_catch_stmt, optellipsis): Add %type declarations. (objc_inherit_code, objc_public_flag): Remove. (typespec_nonreserved_nonattr): Call objc_get_protocol_qualified_type() instead of get_static_reference() and get_protocol_reference(). (stmt_nocomp): Call grokparm() on @catch parameter. (objcdef): Move semantic action to objc_finish_implementation(). (classdef): Move semantic action to objc_start_class_interface(), objc_continue_interface(), objc_finish_interface(), objc_start_class_implementation(), objc_continue_implementation(), objc_start_category_interface() and objc_start_category_implementation(). (protocoldef): Move semantic actions to objc_start_protocol() and objc_finish_interface(). (ivar_decl_list): Remove nonterminal. (visibility_spec): Move semantic actions to objc_set_visibility(). (ivar_decls): Remove assignment to $$. (ivar_decl): Rephrase in terms of component_decl; call objc_add_instance_variable(). (ivars, ivar_declarator): Remove nonterminals. (opt_semi): New nonterminal. (methodtype): Remove semantic actions. (methoddef): Move semantic actions to objc_set_method_type(), objc_start_method_definition() and objc_finish_method_definition(). (methodproto): Move semantic actions to objc_set_method_type() and objc_add_method_declaration(). (methoddecl): Use objc_typename instead of typename; move semantic actions to objc_build_method_signature(). (optarglist, myxdecls, mydecl, myparms, myparm): Remove nonterminals. (optparmlist): Express in terms of optparms and optellipsis. (optparms, optellipsis, objc_qual, objc_quals, objc_typename): New nonterminals. (keyworddecl): Use objc_typename instead of typename. (rid_to_yy): Mark RID_IN, RID_OUT, RID_INOUT, RID_BYCOPY, RID_BYREF and RID_ONEWAY as returning OBJC_TYPE_QUAL to yyparse(). [gcc/objc/ChangeLog] 2004-09-07 Ziemowit Laski <zlaski@apple.com> * Make-lang.in (objc/objc-parse.o): Depend on $(C_COMMON_H) instead of objc/objc-act.h. (objc/objc-act.o): Depend on $(HASHTAB_H). * objc-act.c: Include hashtab.h; in ObjC++ mode, include cp-tree.h and objcp-decl.h instead of c-tree.h. (build_module_descriptor, get_class_ivars, synth_id_with_class_suffix, error_with_ivar, gen_method_decl, gen_declaration, setup_string_decl, build_protocol_template): Adjust prototypes. (build_module_initializer_routine, start_class, continue_class, finish_class, start_method_def, objc_start_function, start_protocol, build_method_decl, objc_add_method, add_instance_variable, build_ivar_reference, is_ivar, is_private, get_super_receiver, build_selector_table_decl, objc_push_parm, objc_get_parm_info, gen_type_name, gen_type_name_0, start_var_decl, finish_var_decl, create_field_decl): New prototypes. (objc_expand_function_end, comp_method_with_proto, objc_expr_last, gen_declaration_1, gen_declarator, is_complex_decl, adorn_decl, define_decl, create_builtin_decl, gen_declspecs): Remove prototypes. (TYPE_ID): Rename to OBJECT_TYPEDEF_NAME. (CLASS_TYPEDEF_NAME): New. (TAG_EXECCLASS): Change from a global variable to a #define. (TAG_RETURN_STRUCT): Delete. (TAG_GNUINIT): New, holds '__objc_gnu_init' name. (objc_inherit_code, objc_public_flag): New, moved from c-parse.in. (string_descriptor): New struct. (string_htab): New hash table. (string_hash, string_eq): New prototypes. (generate_struct_by_value_array): Call create_field_decl() instead of create_builtin_decl(). (objc_init): Do not initialize objc_ellipsis_node or TAG_EXECCLASS; In ObjC++ mode, call cxx_init() instead of c_objc_common_init(). (objc_finish_file): In ObjC++, call instantiate_pending_templates() and cp_finish_file(). (define_decl, get_static_reference, get_protocol_reference, create_builtin_decl): Remove functions. (objc_start_class_interface, objc_start_category_interface, objc_start_protocol, objc_continue_interface, objc_finish_interface, objc_start_class_implementation, objc_start_category_implementation, objc_continue_implementation, objc_finish_implementation, objc_set_visibility, objc_set_method_type, objc_build_method_signature, objc_add_method_declaration, objc_start_method_definition, objc_add_instance_variable, objc_get_protocol_qualified_type, create_field_decl, start_var_decl, finish_var_decl): New functions. (setup_string_decl): Simplify since it is only called once. (synth_module_prologue): Call build_class_template(); predefine 'id' and 'Class' as typedefs; rename 'temp_type' to 'type'; disable debug hooks for duration of function; fix GNU runtime messenger signatures to correspond to reality; forward-declare '__objc_exec_class' for the GNU runtime; call build_selector_table_decl(); in ObjC++ mode, generate 'extern "C" { ... }' wrappers around synthesized declarations; call build_protocol_template() and build_category_template(). (string_hash, string_eq): New functions. (objc_build_string_object): Check metaclass correctness only once; store string literals in hash table. (objc_build_constructor): Do not convert initializer elements; adjust for ObjC++ impedance mismatch. (build_objc_symtab_template): Call create_field_decl() instead of create_builtin_decl(). (init_objc_symtab): Add missing conversion to initializer element. (build_metadata_decl): Call start_var_decl() instead of define_decl(). (generate_objc_symtab_decl): Do not call build_category_template(); call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(). (build_module_descriptor): Call create_field_decl() instead of grokfield(); call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(); always mark module descriptor as used; move GNU runtime-specific functionality to build_module_initializer_routine(). (build_module_initializer_routine): New function, broken off of build_module_descriptor(). (objc_static_init_needed_p, objc_generate_static_init_call): New functions. (generate_static_references, generate_strings, build_selector_translation_table, generate_descriptor_table, generate_ivars_list, generate_dispatch_table, generate_category): Call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(); build a type directly instead of via groktypename(). (build_selector_reference_decl, build_selector_table_decl, build_class_reference_decl, build_protocol_reference, generate_objc_image_info): Call start_var_decl() instead of build_decl(). (build_selector_reference): For GNU runtime, do not call build_selector_reference_decl(). (build_selector, build_typed_selector_reference): Always convert result to the selector type. (add_objc_string): Cast return value to 'char *'. (build_method_prototype_template, build_selector_template, build_method_template): Use actual selector type for fields pointing to selectors. (finish_objc): For GNU runtime, call build_module_initializer_routine() after build_module_descriptor(). (generate_protocol_list, generate_shared_structures): Call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(); build a type directly instead of via groktypename(). (synth_id_with_class_suffix): Return a string. (get_arg_type_list): For instance methods, use the instance type for 'self'; do not call groktypename_in_parm_context(). (build_objc_string_decl): Squash redeclaration errors in ObjC++. (objc_is_class_name): Use OBJC_TYPE_NAME instead of TYPE_NAME; handle RECORD_TYPEs in ObjC as well as ObjC++. (objc_is_id): New function. (objc_is_object_ptr): Return the canonical type node. (objc_get_class_ivars): Simplify using get_class_ivars(). (get_class_ivars): Remove second parameter; create a fresh copy of the ivar list for each call; do not check for existence of super class. (objc_eh_runtime_type): Mark #ifndef OBJCPLUS. (objc_init_exceptions): When using SJLJ-style exceptions, require the use of '-fobjc-exceptions' flag; do not require it for DWARF-style exceptions. (objc_build_exc_ptr, next_sjlj_build_try_catch_finally): Use objc_object_type instead of objc_id_type. (objc_begin_catch_clause): Convert the incoming PARM_DECL into a VAR_DECL before placing it in the appropriate scope; do not call define_decl(); adjust call to c_begin_compound_stmt(); use objc_object_type instead of objc_id_type. (build_next_objc_exception_stuff): Call create_field_decl() instead of create_builtin_decl(); construct type directly instead of calling groktypename(); use OBJC_VOID_AT_END to mark end of function parameters. (build_private_template): Adjust call to get_class_ivars(); build a type directly instead of via groktypename(). (build_protocol_template, build_method_prototype_list_template, build_method_prototype_template, build_category_template, build_selector_template, build_class_template, build_super_template, build_ivar_template, build_ivar_list_template, build_method_list_template, build_method_template): Call create_field_decl() instead of grokfield(). (objc_method_parm_type): Do not call groktypename(). (generate_descriptor_table): Call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(). (generate_method_descriptors, build_protocol_initializer, generate_dispatch_tables, build_category_initializer, build_shared_structure_initializer): Do not call groktypename(). (generate_protocols): Call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(); do not call groktypename(). (error_with_ivar): Remove last parameter. (check_ivars): Do not iterate ovar CLASS_RAW_IVARS lists in addition to CLASS_IVARS lists; adjust calls to error_with_ivar(). (generate_ivar_lists): Convert one of the initializer elements; do not call groktypename(). (get_arg_type_list, start_method_def, gen_method_def): Account for new representation of variable arguments and '...' in Objective-C methods; add Objective-C++ impedance matching code. (is_objc_type_qualifier): Remove function. (adjust_type_for_id_default): Simplify; there is no longer a need to wade through declspecs. (lookup_interface, start_class, continue_class, finish_class, start_method_def, start_protocol, build_method_decl, objc_add_method, add_instance_variable, build_ivar_reference, is_ivar, is_private, get_super_receiver, objc_build_finally_epilogue): Make into static functions. (receiver_is_class_object): Use new IS_CLASS() macro. (objc_build_message_expr): Tweak ObjC++ message argument handling; call objc_finish_message_expr() instead of finish_message_expr(). (finish_message_expr): Rename to objc_finish_message_expr(); use OBJC_TYPE_NAME and OBJC_SET_TYPE_NAME macros instead of TYPE_NAME. call gen_type_name() instead of gen_declaration(); call objc_is_id() instead of using IS_ID and IS_CLASS; Use objc_class_name instead of calling get_identifier("Class"); handle CONVERT_EXPRs in receiver. (build_objc_method_call, warn_with_method): Do not call groktypename(). (build_ivar_reference): Call convert() instead of clobbering in a type. (hash_init): Initialize string_htab hash table. (add_instance_variable): Simplify parameter list; do not call grokfield(); do not populate CLASS_IVARS list. (start_class): Check for the existence of super class, if one was specified. (continue_class): Use CLASS_RAW_IVARS rather than CLASS_IVARS; do not call build_class_template(); adjust call to get_class_ivars(); call build_decl(), pushdecl() and finish_decl() instead of define_decl(). (finish_class): Call build_decl(), pushdecl() and finish_decl() instead of define_decl(). (add_protocols): Use PROTOCOL_BINFO_ELTS for the tree vector size. (start_protocol): Do not call build_protocol_template(); use PROTOCOL_BINFO_ELTS for the tree vector size. (encode_type_qualifiers): Do not handle the 'const' qualifier here. (encode_pointer): Encode 'const char *' as 'r*', for backwards compatibility. (encode_array): Use HOST_WIDE_INT_PRINT_DEC instead of "%ld". (encode_type): Handle the 'const' qualifier here. (objc_parmlist): New global variable, sued by objc_push_parm and objc_get_parm_info(). (objc_push_parm, objc_get_parm_info): New functions. (objc_expr_last): Remove function. (synth_self_and_ucmd_args): For instance methods, use the instance type for 'self'; call objc_push_parm() instead of push_parm_decl(). (start_method_def): Do not call push_scope(), declare_parm_level(), pop_scope(), push_parm_decl(), store_parm_decls() or objc_expr_last(); just use objc_push_parm() and objc_get_parm_info(). (comp_method_with_proto): Remove function. (objc_types_are_equivalent): Strip away indirections before comparing underlying types. (comp_proto_with_proto): Do not call groktypename(); types are no longer in raw declspec format. (objc_start_function): New function. (really_start_method): Call comp_proto_with_proto() instead of comp_method_with_proto(); call objc_start_function() instead of hand-crafting a function declarator. (continue_method_def, objc_expand_function_end): Remove functions. (get_super_receiver): Call objc_get_current_scope() instead of get_current_scope(); reference 'super_class' field (instead of 'class'). (finish_method_def): Rename to objc_finish_method_definition() and add a function decl parameter; move method encoding call from objc_expand_function_end(). (is_complex_decl, adorn_decl, gen_declarator, gen_declspecs, gen_declaration_1): Remove functions. (tmpbuf, RAW_DECLSPEC): Remove. (gen_declaration): Remove second parameter; simplify to deal with TYPE_P nodes instead of raw declspecs. (gen_type_name, gen_type_name_0): New functions. (gen_method_decl): Remove second parameter; call gen_type_name() instead of gen_declaration_1(). (dump_interface): Adjust calls to gen_declaration() and gen_method_decl(); do not allocate a separate string buffer. (init_objc): Allocate a larger string buffer to accommodate dump_interface(); adjust call to build_module_descriptor(); add call to build_module_initializer_routine() for the GNU runtime. (generate_classref_translation_entry): Do not call start_decl(); call finish_var_decl() instead of finish_decl(); call convert() instead of build_c_cast(). * objc-act.h (CLASS_OWN_IVARS): Remove accessor. (CLASS_BINFO_ELTS): Reduce from 6 to 5, now that CLASS_OWN_IVARS is gone. (OCTI_GNU_INIT_DECL, GNU_INIT_decl): New. (OCTI_ELLIPSIS_NODE, objc_ellipsis_node): Remove. (OCTI_ID_ID, id_type, objc_id_id): Rename to OCTI_ID_NAME, objc_object_type and objc_object_name, respectively. (OCTI_CLS_REF, OCTI_CLASS_NAME, objc_class_reference, objc_class_name): New. (IS_CLASS): New macro. (IS_ID, IS_SUPER): Robustify. (OCTI_EXECCLASS_DECL, execclass_decl): New. (finish_file, start_class, continue_class, finish_class, start_method_def, continue_method_def, finish_method_def, start_protocol, finish_protocol, objc_build_throw_stmt, objc_build_try_catch_finally_stmt, objc_build_synchronized_prologue, objc_build_synchronized_epilogue, objc_build_try_prologue, objc_build_try_epilogue, objc_build_catch_stmt, objc_build_catch_epilogue, objc_build_finally_prologue, objc_build_finally_epilogue, is_ivar, is_private, is_public, add_instance_variable, objc_add_method, get_super_receiver, objc_clear_super_receiver, get_class_ivars_from_name, get_class_reference, get_static_reference, get_object_reference, build_message_expr, finish_message_expr, build_selector_expr, build_ivar_reference, build_keyword_decl, build_method_decl, build_protocol_expr, build_objc_string_object, objc_declare_alias, objc_declare_class, objc_declare_protocols, objc_comptypes, objc_check_decl, build_encode_expr): Remove prototypes. (imp_count, cat_count): Make GGC-aware. (OBJC_SET_TYPE_NAME): New macro. From-SVN: r87168
2004-09-08 02:49:44 +02:00
field_decl = create_field_decl (short_integer_type_node, "cls_def_cnt");
1992-01-18 00:15:38 +01:00
chainon (field_decl_chain, field_decl);
/* short cat_def_cnt; */
Makefile.in (c-parse.o): Depend on $(C_COMMON_H). [gcc/ChangeLog] 2004-09-07 Ziemowit Laski <zlaski@apple.com> * Makefile.in (c-parse.o): Depend on $(C_COMMON_H). * c-parse.in: Include c-common.h instead of objc-act.h. (ivar_decl_list, ivar_decls, ivar_decl, ivars, ivar_declarator, myparms, myparm): Remove %type declarations. (methodtype, optparms, OBJC_TYPE_QUAL, objc_quals, objc_qual, objc_typename, objc_try_catch_stmt, optellipsis): Add %type declarations. (objc_inherit_code, objc_public_flag): Remove. (typespec_nonreserved_nonattr): Call objc_get_protocol_qualified_type() instead of get_static_reference() and get_protocol_reference(). (stmt_nocomp): Call grokparm() on @catch parameter. (objcdef): Move semantic action to objc_finish_implementation(). (classdef): Move semantic action to objc_start_class_interface(), objc_continue_interface(), objc_finish_interface(), objc_start_class_implementation(), objc_continue_implementation(), objc_start_category_interface() and objc_start_category_implementation(). (protocoldef): Move semantic actions to objc_start_protocol() and objc_finish_interface(). (ivar_decl_list): Remove nonterminal. (visibility_spec): Move semantic actions to objc_set_visibility(). (ivar_decls): Remove assignment to $$. (ivar_decl): Rephrase in terms of component_decl; call objc_add_instance_variable(). (ivars, ivar_declarator): Remove nonterminals. (opt_semi): New nonterminal. (methodtype): Remove semantic actions. (methoddef): Move semantic actions to objc_set_method_type(), objc_start_method_definition() and objc_finish_method_definition(). (methodproto): Move semantic actions to objc_set_method_type() and objc_add_method_declaration(). (methoddecl): Use objc_typename instead of typename; move semantic actions to objc_build_method_signature(). (optarglist, myxdecls, mydecl, myparms, myparm): Remove nonterminals. (optparmlist): Express in terms of optparms and optellipsis. (optparms, optellipsis, objc_qual, objc_quals, objc_typename): New nonterminals. (keyworddecl): Use objc_typename instead of typename. (rid_to_yy): Mark RID_IN, RID_OUT, RID_INOUT, RID_BYCOPY, RID_BYREF and RID_ONEWAY as returning OBJC_TYPE_QUAL to yyparse(). [gcc/objc/ChangeLog] 2004-09-07 Ziemowit Laski <zlaski@apple.com> * Make-lang.in (objc/objc-parse.o): Depend on $(C_COMMON_H) instead of objc/objc-act.h. (objc/objc-act.o): Depend on $(HASHTAB_H). * objc-act.c: Include hashtab.h; in ObjC++ mode, include cp-tree.h and objcp-decl.h instead of c-tree.h. (build_module_descriptor, get_class_ivars, synth_id_with_class_suffix, error_with_ivar, gen_method_decl, gen_declaration, setup_string_decl, build_protocol_template): Adjust prototypes. (build_module_initializer_routine, start_class, continue_class, finish_class, start_method_def, objc_start_function, start_protocol, build_method_decl, objc_add_method, add_instance_variable, build_ivar_reference, is_ivar, is_private, get_super_receiver, build_selector_table_decl, objc_push_parm, objc_get_parm_info, gen_type_name, gen_type_name_0, start_var_decl, finish_var_decl, create_field_decl): New prototypes. (objc_expand_function_end, comp_method_with_proto, objc_expr_last, gen_declaration_1, gen_declarator, is_complex_decl, adorn_decl, define_decl, create_builtin_decl, gen_declspecs): Remove prototypes. (TYPE_ID): Rename to OBJECT_TYPEDEF_NAME. (CLASS_TYPEDEF_NAME): New. (TAG_EXECCLASS): Change from a global variable to a #define. (TAG_RETURN_STRUCT): Delete. (TAG_GNUINIT): New, holds '__objc_gnu_init' name. (objc_inherit_code, objc_public_flag): New, moved from c-parse.in. (string_descriptor): New struct. (string_htab): New hash table. (string_hash, string_eq): New prototypes. (generate_struct_by_value_array): Call create_field_decl() instead of create_builtin_decl(). (objc_init): Do not initialize objc_ellipsis_node or TAG_EXECCLASS; In ObjC++ mode, call cxx_init() instead of c_objc_common_init(). (objc_finish_file): In ObjC++, call instantiate_pending_templates() and cp_finish_file(). (define_decl, get_static_reference, get_protocol_reference, create_builtin_decl): Remove functions. (objc_start_class_interface, objc_start_category_interface, objc_start_protocol, objc_continue_interface, objc_finish_interface, objc_start_class_implementation, objc_start_category_implementation, objc_continue_implementation, objc_finish_implementation, objc_set_visibility, objc_set_method_type, objc_build_method_signature, objc_add_method_declaration, objc_start_method_definition, objc_add_instance_variable, objc_get_protocol_qualified_type, create_field_decl, start_var_decl, finish_var_decl): New functions. (setup_string_decl): Simplify since it is only called once. (synth_module_prologue): Call build_class_template(); predefine 'id' and 'Class' as typedefs; rename 'temp_type' to 'type'; disable debug hooks for duration of function; fix GNU runtime messenger signatures to correspond to reality; forward-declare '__objc_exec_class' for the GNU runtime; call build_selector_table_decl(); in ObjC++ mode, generate 'extern "C" { ... }' wrappers around synthesized declarations; call build_protocol_template() and build_category_template(). (string_hash, string_eq): New functions. (objc_build_string_object): Check metaclass correctness only once; store string literals in hash table. (objc_build_constructor): Do not convert initializer elements; adjust for ObjC++ impedance mismatch. (build_objc_symtab_template): Call create_field_decl() instead of create_builtin_decl(). (init_objc_symtab): Add missing conversion to initializer element. (build_metadata_decl): Call start_var_decl() instead of define_decl(). (generate_objc_symtab_decl): Do not call build_category_template(); call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(). (build_module_descriptor): Call create_field_decl() instead of grokfield(); call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(); always mark module descriptor as used; move GNU runtime-specific functionality to build_module_initializer_routine(). (build_module_initializer_routine): New function, broken off of build_module_descriptor(). (objc_static_init_needed_p, objc_generate_static_init_call): New functions. (generate_static_references, generate_strings, build_selector_translation_table, generate_descriptor_table, generate_ivars_list, generate_dispatch_table, generate_category): Call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(); build a type directly instead of via groktypename(). (build_selector_reference_decl, build_selector_table_decl, build_class_reference_decl, build_protocol_reference, generate_objc_image_info): Call start_var_decl() instead of build_decl(). (build_selector_reference): For GNU runtime, do not call build_selector_reference_decl(). (build_selector, build_typed_selector_reference): Always convert result to the selector type. (add_objc_string): Cast return value to 'char *'. (build_method_prototype_template, build_selector_template, build_method_template): Use actual selector type for fields pointing to selectors. (finish_objc): For GNU runtime, call build_module_initializer_routine() after build_module_descriptor(). (generate_protocol_list, generate_shared_structures): Call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(); build a type directly instead of via groktypename(). (synth_id_with_class_suffix): Return a string. (get_arg_type_list): For instance methods, use the instance type for 'self'; do not call groktypename_in_parm_context(). (build_objc_string_decl): Squash redeclaration errors in ObjC++. (objc_is_class_name): Use OBJC_TYPE_NAME instead of TYPE_NAME; handle RECORD_TYPEs in ObjC as well as ObjC++. (objc_is_id): New function. (objc_is_object_ptr): Return the canonical type node. (objc_get_class_ivars): Simplify using get_class_ivars(). (get_class_ivars): Remove second parameter; create a fresh copy of the ivar list for each call; do not check for existence of super class. (objc_eh_runtime_type): Mark #ifndef OBJCPLUS. (objc_init_exceptions): When using SJLJ-style exceptions, require the use of '-fobjc-exceptions' flag; do not require it for DWARF-style exceptions. (objc_build_exc_ptr, next_sjlj_build_try_catch_finally): Use objc_object_type instead of objc_id_type. (objc_begin_catch_clause): Convert the incoming PARM_DECL into a VAR_DECL before placing it in the appropriate scope; do not call define_decl(); adjust call to c_begin_compound_stmt(); use objc_object_type instead of objc_id_type. (build_next_objc_exception_stuff): Call create_field_decl() instead of create_builtin_decl(); construct type directly instead of calling groktypename(); use OBJC_VOID_AT_END to mark end of function parameters. (build_private_template): Adjust call to get_class_ivars(); build a type directly instead of via groktypename(). (build_protocol_template, build_method_prototype_list_template, build_method_prototype_template, build_category_template, build_selector_template, build_class_template, build_super_template, build_ivar_template, build_ivar_list_template, build_method_list_template, build_method_template): Call create_field_decl() instead of grokfield(). (objc_method_parm_type): Do not call groktypename(). (generate_descriptor_table): Call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(). (generate_method_descriptors, build_protocol_initializer, generate_dispatch_tables, build_category_initializer, build_shared_structure_initializer): Do not call groktypename(). (generate_protocols): Call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(); do not call groktypename(). (error_with_ivar): Remove last parameter. (check_ivars): Do not iterate ovar CLASS_RAW_IVARS lists in addition to CLASS_IVARS lists; adjust calls to error_with_ivar(). (generate_ivar_lists): Convert one of the initializer elements; do not call groktypename(). (get_arg_type_list, start_method_def, gen_method_def): Account for new representation of variable arguments and '...' in Objective-C methods; add Objective-C++ impedance matching code. (is_objc_type_qualifier): Remove function. (adjust_type_for_id_default): Simplify; there is no longer a need to wade through declspecs. (lookup_interface, start_class, continue_class, finish_class, start_method_def, start_protocol, build_method_decl, objc_add_method, add_instance_variable, build_ivar_reference, is_ivar, is_private, get_super_receiver, objc_build_finally_epilogue): Make into static functions. (receiver_is_class_object): Use new IS_CLASS() macro. (objc_build_message_expr): Tweak ObjC++ message argument handling; call objc_finish_message_expr() instead of finish_message_expr(). (finish_message_expr): Rename to objc_finish_message_expr(); use OBJC_TYPE_NAME and OBJC_SET_TYPE_NAME macros instead of TYPE_NAME. call gen_type_name() instead of gen_declaration(); call objc_is_id() instead of using IS_ID and IS_CLASS; Use objc_class_name instead of calling get_identifier("Class"); handle CONVERT_EXPRs in receiver. (build_objc_method_call, warn_with_method): Do not call groktypename(). (build_ivar_reference): Call convert() instead of clobbering in a type. (hash_init): Initialize string_htab hash table. (add_instance_variable): Simplify parameter list; do not call grokfield(); do not populate CLASS_IVARS list. (start_class): Check for the existence of super class, if one was specified. (continue_class): Use CLASS_RAW_IVARS rather than CLASS_IVARS; do not call build_class_template(); adjust call to get_class_ivars(); call build_decl(), pushdecl() and finish_decl() instead of define_decl(). (finish_class): Call build_decl(), pushdecl() and finish_decl() instead of define_decl(). (add_protocols): Use PROTOCOL_BINFO_ELTS for the tree vector size. (start_protocol): Do not call build_protocol_template(); use PROTOCOL_BINFO_ELTS for the tree vector size. (encode_type_qualifiers): Do not handle the 'const' qualifier here. (encode_pointer): Encode 'const char *' as 'r*', for backwards compatibility. (encode_array): Use HOST_WIDE_INT_PRINT_DEC instead of "%ld". (encode_type): Handle the 'const' qualifier here. (objc_parmlist): New global variable, sued by objc_push_parm and objc_get_parm_info(). (objc_push_parm, objc_get_parm_info): New functions. (objc_expr_last): Remove function. (synth_self_and_ucmd_args): For instance methods, use the instance type for 'self'; call objc_push_parm() instead of push_parm_decl(). (start_method_def): Do not call push_scope(), declare_parm_level(), pop_scope(), push_parm_decl(), store_parm_decls() or objc_expr_last(); just use objc_push_parm() and objc_get_parm_info(). (comp_method_with_proto): Remove function. (objc_types_are_equivalent): Strip away indirections before comparing underlying types. (comp_proto_with_proto): Do not call groktypename(); types are no longer in raw declspec format. (objc_start_function): New function. (really_start_method): Call comp_proto_with_proto() instead of comp_method_with_proto(); call objc_start_function() instead of hand-crafting a function declarator. (continue_method_def, objc_expand_function_end): Remove functions. (get_super_receiver): Call objc_get_current_scope() instead of get_current_scope(); reference 'super_class' field (instead of 'class'). (finish_method_def): Rename to objc_finish_method_definition() and add a function decl parameter; move method encoding call from objc_expand_function_end(). (is_complex_decl, adorn_decl, gen_declarator, gen_declspecs, gen_declaration_1): Remove functions. (tmpbuf, RAW_DECLSPEC): Remove. (gen_declaration): Remove second parameter; simplify to deal with TYPE_P nodes instead of raw declspecs. (gen_type_name, gen_type_name_0): New functions. (gen_method_decl): Remove second parameter; call gen_type_name() instead of gen_declaration_1(). (dump_interface): Adjust calls to gen_declaration() and gen_method_decl(); do not allocate a separate string buffer. (init_objc): Allocate a larger string buffer to accommodate dump_interface(); adjust call to build_module_descriptor(); add call to build_module_initializer_routine() for the GNU runtime. (generate_classref_translation_entry): Do not call start_decl(); call finish_var_decl() instead of finish_decl(); call convert() instead of build_c_cast(). * objc-act.h (CLASS_OWN_IVARS): Remove accessor. (CLASS_BINFO_ELTS): Reduce from 6 to 5, now that CLASS_OWN_IVARS is gone. (OCTI_GNU_INIT_DECL, GNU_INIT_decl): New. (OCTI_ELLIPSIS_NODE, objc_ellipsis_node): Remove. (OCTI_ID_ID, id_type, objc_id_id): Rename to OCTI_ID_NAME, objc_object_type and objc_object_name, respectively. (OCTI_CLS_REF, OCTI_CLASS_NAME, objc_class_reference, objc_class_name): New. (IS_CLASS): New macro. (IS_ID, IS_SUPER): Robustify. (OCTI_EXECCLASS_DECL, execclass_decl): New. (finish_file, start_class, continue_class, finish_class, start_method_def, continue_method_def, finish_method_def, start_protocol, finish_protocol, objc_build_throw_stmt, objc_build_try_catch_finally_stmt, objc_build_synchronized_prologue, objc_build_synchronized_epilogue, objc_build_try_prologue, objc_build_try_epilogue, objc_build_catch_stmt, objc_build_catch_epilogue, objc_build_finally_prologue, objc_build_finally_epilogue, is_ivar, is_private, is_public, add_instance_variable, objc_add_method, get_super_receiver, objc_clear_super_receiver, get_class_ivars_from_name, get_class_reference, get_static_reference, get_object_reference, build_message_expr, finish_message_expr, build_selector_expr, build_ivar_reference, build_keyword_decl, build_method_decl, build_protocol_expr, build_objc_string_object, objc_declare_alias, objc_declare_class, objc_declare_protocols, objc_comptypes, objc_check_decl, build_encode_expr): Remove prototypes. (imp_count, cat_count): Make GGC-aware. (OBJC_SET_TYPE_NAME): New macro. From-SVN: r87168
2004-09-08 02:49:44 +02:00
field_decl = create_field_decl (short_integer_type_node,
"cat_def_cnt");
1992-01-18 00:15:38 +01:00
chainon (field_decl_chain, field_decl);
if (imp_count || cat_count || !flag_next_runtime)
{
/* void *defs[imp_count + cat_count (+ 1)]; */
/* NB: The index is one less than the size of the array. */
int index = imp_count + cat_count
+ (flag_next_runtime? -1: 0);
Makefile.in (c-parse.o): Depend on $(C_COMMON_H). [gcc/ChangeLog] 2004-09-07 Ziemowit Laski <zlaski@apple.com> * Makefile.in (c-parse.o): Depend on $(C_COMMON_H). * c-parse.in: Include c-common.h instead of objc-act.h. (ivar_decl_list, ivar_decls, ivar_decl, ivars, ivar_declarator, myparms, myparm): Remove %type declarations. (methodtype, optparms, OBJC_TYPE_QUAL, objc_quals, objc_qual, objc_typename, objc_try_catch_stmt, optellipsis): Add %type declarations. (objc_inherit_code, objc_public_flag): Remove. (typespec_nonreserved_nonattr): Call objc_get_protocol_qualified_type() instead of get_static_reference() and get_protocol_reference(). (stmt_nocomp): Call grokparm() on @catch parameter. (objcdef): Move semantic action to objc_finish_implementation(). (classdef): Move semantic action to objc_start_class_interface(), objc_continue_interface(), objc_finish_interface(), objc_start_class_implementation(), objc_continue_implementation(), objc_start_category_interface() and objc_start_category_implementation(). (protocoldef): Move semantic actions to objc_start_protocol() and objc_finish_interface(). (ivar_decl_list): Remove nonterminal. (visibility_spec): Move semantic actions to objc_set_visibility(). (ivar_decls): Remove assignment to $$. (ivar_decl): Rephrase in terms of component_decl; call objc_add_instance_variable(). (ivars, ivar_declarator): Remove nonterminals. (opt_semi): New nonterminal. (methodtype): Remove semantic actions. (methoddef): Move semantic actions to objc_set_method_type(), objc_start_method_definition() and objc_finish_method_definition(). (methodproto): Move semantic actions to objc_set_method_type() and objc_add_method_declaration(). (methoddecl): Use objc_typename instead of typename; move semantic actions to objc_build_method_signature(). (optarglist, myxdecls, mydecl, myparms, myparm): Remove nonterminals. (optparmlist): Express in terms of optparms and optellipsis. (optparms, optellipsis, objc_qual, objc_quals, objc_typename): New nonterminals. (keyworddecl): Use objc_typename instead of typename. (rid_to_yy): Mark RID_IN, RID_OUT, RID_INOUT, RID_BYCOPY, RID_BYREF and RID_ONEWAY as returning OBJC_TYPE_QUAL to yyparse(). [gcc/objc/ChangeLog] 2004-09-07 Ziemowit Laski <zlaski@apple.com> * Make-lang.in (objc/objc-parse.o): Depend on $(C_COMMON_H) instead of objc/objc-act.h. (objc/objc-act.o): Depend on $(HASHTAB_H). * objc-act.c: Include hashtab.h; in ObjC++ mode, include cp-tree.h and objcp-decl.h instead of c-tree.h. (build_module_descriptor, get_class_ivars, synth_id_with_class_suffix, error_with_ivar, gen_method_decl, gen_declaration, setup_string_decl, build_protocol_template): Adjust prototypes. (build_module_initializer_routine, start_class, continue_class, finish_class, start_method_def, objc_start_function, start_protocol, build_method_decl, objc_add_method, add_instance_variable, build_ivar_reference, is_ivar, is_private, get_super_receiver, build_selector_table_decl, objc_push_parm, objc_get_parm_info, gen_type_name, gen_type_name_0, start_var_decl, finish_var_decl, create_field_decl): New prototypes. (objc_expand_function_end, comp_method_with_proto, objc_expr_last, gen_declaration_1, gen_declarator, is_complex_decl, adorn_decl, define_decl, create_builtin_decl, gen_declspecs): Remove prototypes. (TYPE_ID): Rename to OBJECT_TYPEDEF_NAME. (CLASS_TYPEDEF_NAME): New. (TAG_EXECCLASS): Change from a global variable to a #define. (TAG_RETURN_STRUCT): Delete. (TAG_GNUINIT): New, holds '__objc_gnu_init' name. (objc_inherit_code, objc_public_flag): New, moved from c-parse.in. (string_descriptor): New struct. (string_htab): New hash table. (string_hash, string_eq): New prototypes. (generate_struct_by_value_array): Call create_field_decl() instead of create_builtin_decl(). (objc_init): Do not initialize objc_ellipsis_node or TAG_EXECCLASS; In ObjC++ mode, call cxx_init() instead of c_objc_common_init(). (objc_finish_file): In ObjC++, call instantiate_pending_templates() and cp_finish_file(). (define_decl, get_static_reference, get_protocol_reference, create_builtin_decl): Remove functions. (objc_start_class_interface, objc_start_category_interface, objc_start_protocol, objc_continue_interface, objc_finish_interface, objc_start_class_implementation, objc_start_category_implementation, objc_continue_implementation, objc_finish_implementation, objc_set_visibility, objc_set_method_type, objc_build_method_signature, objc_add_method_declaration, objc_start_method_definition, objc_add_instance_variable, objc_get_protocol_qualified_type, create_field_decl, start_var_decl, finish_var_decl): New functions. (setup_string_decl): Simplify since it is only called once. (synth_module_prologue): Call build_class_template(); predefine 'id' and 'Class' as typedefs; rename 'temp_type' to 'type'; disable debug hooks for duration of function; fix GNU runtime messenger signatures to correspond to reality; forward-declare '__objc_exec_class' for the GNU runtime; call build_selector_table_decl(); in ObjC++ mode, generate 'extern "C" { ... }' wrappers around synthesized declarations; call build_protocol_template() and build_category_template(). (string_hash, string_eq): New functions. (objc_build_string_object): Check metaclass correctness only once; store string literals in hash table. (objc_build_constructor): Do not convert initializer elements; adjust for ObjC++ impedance mismatch. (build_objc_symtab_template): Call create_field_decl() instead of create_builtin_decl(). (init_objc_symtab): Add missing conversion to initializer element. (build_metadata_decl): Call start_var_decl() instead of define_decl(). (generate_objc_symtab_decl): Do not call build_category_template(); call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(). (build_module_descriptor): Call create_field_decl() instead of grokfield(); call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(); always mark module descriptor as used; move GNU runtime-specific functionality to build_module_initializer_routine(). (build_module_initializer_routine): New function, broken off of build_module_descriptor(). (objc_static_init_needed_p, objc_generate_static_init_call): New functions. (generate_static_references, generate_strings, build_selector_translation_table, generate_descriptor_table, generate_ivars_list, generate_dispatch_table, generate_category): Call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(); build a type directly instead of via groktypename(). (build_selector_reference_decl, build_selector_table_decl, build_class_reference_decl, build_protocol_reference, generate_objc_image_info): Call start_var_decl() instead of build_decl(). (build_selector_reference): For GNU runtime, do not call build_selector_reference_decl(). (build_selector, build_typed_selector_reference): Always convert result to the selector type. (add_objc_string): Cast return value to 'char *'. (build_method_prototype_template, build_selector_template, build_method_template): Use actual selector type for fields pointing to selectors. (finish_objc): For GNU runtime, call build_module_initializer_routine() after build_module_descriptor(). (generate_protocol_list, generate_shared_structures): Call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(); build a type directly instead of via groktypename(). (synth_id_with_class_suffix): Return a string. (get_arg_type_list): For instance methods, use the instance type for 'self'; do not call groktypename_in_parm_context(). (build_objc_string_decl): Squash redeclaration errors in ObjC++. (objc_is_class_name): Use OBJC_TYPE_NAME instead of TYPE_NAME; handle RECORD_TYPEs in ObjC as well as ObjC++. (objc_is_id): New function. (objc_is_object_ptr): Return the canonical type node. (objc_get_class_ivars): Simplify using get_class_ivars(). (get_class_ivars): Remove second parameter; create a fresh copy of the ivar list for each call; do not check for existence of super class. (objc_eh_runtime_type): Mark #ifndef OBJCPLUS. (objc_init_exceptions): When using SJLJ-style exceptions, require the use of '-fobjc-exceptions' flag; do not require it for DWARF-style exceptions. (objc_build_exc_ptr, next_sjlj_build_try_catch_finally): Use objc_object_type instead of objc_id_type. (objc_begin_catch_clause): Convert the incoming PARM_DECL into a VAR_DECL before placing it in the appropriate scope; do not call define_decl(); adjust call to c_begin_compound_stmt(); use objc_object_type instead of objc_id_type. (build_next_objc_exception_stuff): Call create_field_decl() instead of create_builtin_decl(); construct type directly instead of calling groktypename(); use OBJC_VOID_AT_END to mark end of function parameters. (build_private_template): Adjust call to get_class_ivars(); build a type directly instead of via groktypename(). (build_protocol_template, build_method_prototype_list_template, build_method_prototype_template, build_category_template, build_selector_template, build_class_template, build_super_template, build_ivar_template, build_ivar_list_template, build_method_list_template, build_method_template): Call create_field_decl() instead of grokfield(). (objc_method_parm_type): Do not call groktypename(). (generate_descriptor_table): Call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(). (generate_method_descriptors, build_protocol_initializer, generate_dispatch_tables, build_category_initializer, build_shared_structure_initializer): Do not call groktypename(). (generate_protocols): Call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(); do not call groktypename(). (error_with_ivar): Remove last parameter. (check_ivars): Do not iterate ovar CLASS_RAW_IVARS lists in addition to CLASS_IVARS lists; adjust calls to error_with_ivar(). (generate_ivar_lists): Convert one of the initializer elements; do not call groktypename(). (get_arg_type_list, start_method_def, gen_method_def): Account for new representation of variable arguments and '...' in Objective-C methods; add Objective-C++ impedance matching code. (is_objc_type_qualifier): Remove function. (adjust_type_for_id_default): Simplify; there is no longer a need to wade through declspecs. (lookup_interface, start_class, continue_class, finish_class, start_method_def, start_protocol, build_method_decl, objc_add_method, add_instance_variable, build_ivar_reference, is_ivar, is_private, get_super_receiver, objc_build_finally_epilogue): Make into static functions. (receiver_is_class_object): Use new IS_CLASS() macro. (objc_build_message_expr): Tweak ObjC++ message argument handling; call objc_finish_message_expr() instead of finish_message_expr(). (finish_message_expr): Rename to objc_finish_message_expr(); use OBJC_TYPE_NAME and OBJC_SET_TYPE_NAME macros instead of TYPE_NAME. call gen_type_name() instead of gen_declaration(); call objc_is_id() instead of using IS_ID and IS_CLASS; Use objc_class_name instead of calling get_identifier("Class"); handle CONVERT_EXPRs in receiver. (build_objc_method_call, warn_with_method): Do not call groktypename(). (build_ivar_reference): Call convert() instead of clobbering in a type. (hash_init): Initialize string_htab hash table. (add_instance_variable): Simplify parameter list; do not call grokfield(); do not populate CLASS_IVARS list. (start_class): Check for the existence of super class, if one was specified. (continue_class): Use CLASS_RAW_IVARS rather than CLASS_IVARS; do not call build_class_template(); adjust call to get_class_ivars(); call build_decl(), pushdecl() and finish_decl() instead of define_decl(). (finish_class): Call build_decl(), pushdecl() and finish_decl() instead of define_decl(). (add_protocols): Use PROTOCOL_BINFO_ELTS for the tree vector size. (start_protocol): Do not call build_protocol_template(); use PROTOCOL_BINFO_ELTS for the tree vector size. (encode_type_qualifiers): Do not handle the 'const' qualifier here. (encode_pointer): Encode 'const char *' as 'r*', for backwards compatibility. (encode_array): Use HOST_WIDE_INT_PRINT_DEC instead of "%ld". (encode_type): Handle the 'const' qualifier here. (objc_parmlist): New global variable, sued by objc_push_parm and objc_get_parm_info(). (objc_push_parm, objc_get_parm_info): New functions. (objc_expr_last): Remove function. (synth_self_and_ucmd_args): For instance methods, use the instance type for 'self'; call objc_push_parm() instead of push_parm_decl(). (start_method_def): Do not call push_scope(), declare_parm_level(), pop_scope(), push_parm_decl(), store_parm_decls() or objc_expr_last(); just use objc_push_parm() and objc_get_parm_info(). (comp_method_with_proto): Remove function. (objc_types_are_equivalent): Strip away indirections before comparing underlying types. (comp_proto_with_proto): Do not call groktypename(); types are no longer in raw declspec format. (objc_start_function): New function. (really_start_method): Call comp_proto_with_proto() instead of comp_method_with_proto(); call objc_start_function() instead of hand-crafting a function declarator. (continue_method_def, objc_expand_function_end): Remove functions. (get_super_receiver): Call objc_get_current_scope() instead of get_current_scope(); reference 'super_class' field (instead of 'class'). (finish_method_def): Rename to objc_finish_method_definition() and add a function decl parameter; move method encoding call from objc_expand_function_end(). (is_complex_decl, adorn_decl, gen_declarator, gen_declspecs, gen_declaration_1): Remove functions. (tmpbuf, RAW_DECLSPEC): Remove. (gen_declaration): Remove second parameter; simplify to deal with TYPE_P nodes instead of raw declspecs. (gen_type_name, gen_type_name_0): New functions. (gen_method_decl): Remove second parameter; call gen_type_name() instead of gen_declaration_1(). (dump_interface): Adjust calls to gen_declaration() and gen_method_decl(); do not allocate a separate string buffer. (init_objc): Allocate a larger string buffer to accommodate dump_interface(); adjust call to build_module_descriptor(); add call to build_module_initializer_routine() for the GNU runtime. (generate_classref_translation_entry): Do not call start_decl(); call finish_var_decl() instead of finish_decl(); call convert() instead of build_c_cast(). * objc-act.h (CLASS_OWN_IVARS): Remove accessor. (CLASS_BINFO_ELTS): Reduce from 6 to 5, now that CLASS_OWN_IVARS is gone. (OCTI_GNU_INIT_DECL, GNU_INIT_decl): New. (OCTI_ELLIPSIS_NODE, objc_ellipsis_node): Remove. (OCTI_ID_ID, id_type, objc_id_id): Rename to OCTI_ID_NAME, objc_object_type and objc_object_name, respectively. (OCTI_CLS_REF, OCTI_CLASS_NAME, objc_class_reference, objc_class_name): New. (IS_CLASS): New macro. (IS_ID, IS_SUPER): Robustify. (OCTI_EXECCLASS_DECL, execclass_decl): New. (finish_file, start_class, continue_class, finish_class, start_method_def, continue_method_def, finish_method_def, start_protocol, finish_protocol, objc_build_throw_stmt, objc_build_try_catch_finally_stmt, objc_build_synchronized_prologue, objc_build_synchronized_epilogue, objc_build_try_prologue, objc_build_try_epilogue, objc_build_catch_stmt, objc_build_catch_epilogue, objc_build_finally_prologue, objc_build_finally_epilogue, is_ivar, is_private, is_public, add_instance_variable, objc_add_method, get_super_receiver, objc_clear_super_receiver, get_class_ivars_from_name, get_class_reference, get_static_reference, get_object_reference, build_message_expr, finish_message_expr, build_selector_expr, build_ivar_reference, build_keyword_decl, build_method_decl, build_protocol_expr, build_objc_string_object, objc_declare_alias, objc_declare_class, objc_declare_protocols, objc_comptypes, objc_check_decl, build_encode_expr): Remove prototypes. (imp_count, cat_count): Make GGC-aware. (OBJC_SET_TYPE_NAME): New macro. From-SVN: r87168
2004-09-08 02:49:44 +02:00
field_decl = create_field_decl
(build_array_type
(ptr_type_node,
tree.h (build_int_cst): New, sign extended constant. * tree.h (build_int_cst): New, sign extended constant. (build_int_cstu): New, zero extended constant. (build_int_cst_wide): Renamed from build_int_cst. * tree.c (build_int_cst, build_int_cstu): New. (build_int_cst_wide): Renamed from build_int_cst. (make_vector_type, build_common_tree_nodes, build_common_tree_nodes_2): Adjust build_int_cst calls. * builtins.c (expand_builtin_prefetch, expand_builtin_strstr, expand_builtin_strpbrk, expand_builtin_fputs, build_string_literal, expand_builtin_printf, expand_builtin_sprintf, fold_builtin_classify_type, fold_builtin_lround, fold_builtin_bitop, fold_builtin_isascii, fold_builtin_toascii, fold_builtin_isdigit, simplify_builtin_strstr, simplify_builtin_strpbrk, fold_builtin_fputs, simplify_builtin_sprintf): Likewise. * c-common.c (start_fname_decls, fix_string_type, shorten_compare, DEF_ATTR_INT): Likewise. * c-decl.c (complete_array_type, check_bitfield_type_and_width): Likewise. * c-lex.c (interpret_integer, lex_charconst): Likewise. * c-parse.in (primary) <TYPES_COMPATIBLE_P> Likewise. * c-pretty-print.c (pp_c_integer_constant): Likewise. * c-typeck.c (really_start_incremental_init, push_init_level, set_nonincremental_init_from_string): Likewise. * calls.c (load_register_parameters): Likewise. convert.c (convert_to_pointer): Likewise. coverage.c (coverage_counter_alloc, tree_coverage_counter_ref, build_fn_info_type, build_fn_info_value, build_ctr_info_value, build_gcov_info): Likewise. * except.c (init_eh, assign_filter_values): Likewise. * expmed.c (store_fixed_bit_field, extract_bit_field, extract_fixed_bit_field, extract_split_bit_field, expand_shift, expand_mult_const, expand_mult_highpart_adjust, extract_high_half, expand_sdiv_pow2, expand_divmod, make_tree): Likewise. * expr.c (convert_move, emit_group_load, emit_group_store, expand_assignment, store_constructor, store_field, expand_expr_real_1, reduce_to_bit_field_precision): Likewise. fold-const.c (force_fit_type, int_const_binop, fold_convert_const, invert_truthvalue, optimize_bit_field_compare, decode_field_reference, all_ones_mask_p, constant_boolean_node, fold_div_compare, fold, fold_read_from_constant_string, fold_negate_const, fold_abs_const, fold_not_const, round_up, round_down): Likewise. * function.c (assign_parm_setup_block): Likewise. * stmt.c (shift_return_value, expand_case, estimate_case_costs): Likewise. * stor-layout.c (layout_type, initialize_sizetypes, set_min_and_max_values_for_integral_type): Likewise. * tree-chrec.c (chrec_fold_multiply_poly_poly, reset_evolution_in_loop): Likewise. * tree-chrec.h (build_polynomial_chrec): Likewise. * tree-complex.c (build_replicated_const): Likewise. * tree-eh.c (honor_protect_cleanup_actions, lower_try_finally_onedest, lower_try_finally_copy, lower_try_finally_switch): Likewise. * tree-mudflap.c (mf_build_string, mx_register_decls, mudflap_register_call, mudflap_enqueue_constant): Likewise. * tree-nested.c (get_trampoline_type, get_nl_goto_field): Likewise. * tree-pretty-print.c (dump_generic_node): Likewise. * tree-ssa-ccp.c (widen_bitfield, maybe_fold_offset_to_array_ref): Likewise. * tree-ssa-dom.c (simplify_rhs_and_lookup_avail_expr): Likewise. * tree-ssa-loop-niter.c (number_of_iterations_cond, loop_niter_by_eval, upper_bound_in_type, lower_bound_in_type): Likewise. * tree-ssa-loop-ivcanon.c (create_canonical_iv, canonicalize_loop_induction_variables): Likewise. * tree-vectorizer.c (vect_create_index_for_array_ref, vect_transform_loop_bound, vect_compute_data_ref_alignment): Likewise. * config/alpha/alpha.c (alpha_initialize_trampoline, alpha_va_start, alpha_gimplify_va_arg_1): Likewise. * config/arm/arm.c (arm_get_cookie_size): Likewise. * config/c4x/c4x.c (c4x_gimplify_va_arg_expr): Likewise. * config/i386/i386.c (ix86_va_start, ix86_gimplify_va_arg): Likewise. * config/ia64/ia64.c (ia64_gimplify_va_arg): Likewise. * config/mips/mips.c (mips_build_builtin_va_list, mips_va_start, mips_gimplify_va_arg_expr): Likewise. * config/pa/pa.c (hppa_gimplify_va_arg_expr): Likewise. * config/rs6000/rs6000.c (rs6000_va_start, rs6000_gimplify_va_arg, add_compiler_branch_island): Likewise. * config/s390/s390.c (s390_va_start): Likewise. * config/sh/sh.c (sh_va_start): Likewise. * config/stormy16/stormy16.c (xstormy16_expand_builtin_va_start): Likewise. * config/xtensa/xtensa.c (xtensa_va_start, xtensa_gimplify_va_arg_expr): Likewise. * objc/objc-act.c (build_objc_string_object, build_objc_symtab_template, init_def_list, init_objc_symtab, init_module_descriptor, generate_static_references, build_selector_translation_table, get_proto_encoding, build_typed_selector_reference, build_selector_reference, build_next_objc_exception_stuff, build_method_prototype_list_template, generate_descriptor_table, generate_protocols, build_protocol_initializer, build_ivar_list_template, build_method_list_template, build_ivar_list_initializer, generate_ivars_list, generate_dispatch_table, generate_protocol_list, build_category_initializer, build_shared_structure_initializer, generate_shared_structures, handle_impent, generate_objc_image_info): Likewise. 2004-04-25 Paolo Bonzini <bonzini@gnu.org> * cfglayout.c (duplicate_insn_chain): Remove references to NOTE_INSN_LOOP_VTOP and NOTE_INSN_LOOP_CONT. * cfgloop.h (struct loop): Remove fields vtop, cont and cont_dominator. * cfgrtl.c (rtl_delete_block): Remove handling of NOTE_INSN_LOOP_CONT. * final.c (final_scan_insn): Remove references to NOTE_INSN_LOOP_VTOP and NOTE_INSN_LOOP_CONT. * insn-notes.def (NOTE_INSN_LOOP_VTOP, NOTE_INSN_LOOP_CONT): Remove. * jump.c (squeeze_notes): Remove references to NOTE_INSN_LOOP_VTOP and NOTE_INSN_LOOP_CONT. * loop.c (scan_loops, find_and_verify_loops, for_each_insn_in_loop, check_dbra_loop, loop_dump_aux): Remove references to removed notes and fields. * reorg.c (mostly_true_jump): Do not rely on NOTE_INSN_LOOP_VTOPs. * unroll.c (unroll_loop, copy_loop_body, loop_iterations): Remove references to removed notes and fields. (subtract_reg_term, ujump_to_loop_cont): Remove. From-SVN: r86544
2004-08-25 11:52:54 +02:00
build_index_type (build_int_cst (NULL_TREE, index))),
"defs");
chainon (field_decl_chain, field_decl);
}
1992-01-18 00:15:38 +01:00
finish_struct (objc_symtab_template, field_decl_chain, NULL_TREE);
1992-01-18 00:15:38 +01:00
}
/* Create the initial value for the `defs' field of _objc_symtab.
This is a CONSTRUCTOR. */
1992-01-18 00:15:38 +01:00
static tree
init_def_list (tree type)
1992-01-18 00:15:38 +01:00
{
tree expr, initlist = NULL_TREE;
1992-01-18 00:15:38 +01:00
struct imp_entry *impent;
if (imp_count)
for (impent = imp_list; impent; impent = impent->next)
{
if (TREE_CODE (impent->imp_context) == CLASS_IMPLEMENTATION_TYPE)
1992-01-18 00:15:38 +01:00
{
expr = build_unary_op (ADDR_EXPR, impent->class_decl, 0);
initlist = tree_cons (NULL_TREE, expr, initlist);
1992-01-18 00:15:38 +01:00
}
}
if (cat_count)
for (impent = imp_list; impent; impent = impent->next)
{
if (TREE_CODE (impent->imp_context) == CATEGORY_IMPLEMENTATION_TYPE)
1992-01-18 00:15:38 +01:00
{
expr = build_unary_op (ADDR_EXPR, impent->class_decl, 0);
initlist = tree_cons (NULL_TREE, expr, initlist);
1992-01-18 00:15:38 +01:00
}
}
if (!flag_next_runtime)
{
/* statics = { ..., _OBJC_STATIC_INSTANCES, ... } */
tree expr;
if (static_instances_decl)
expr = build_unary_op (ADDR_EXPR, static_instances_decl, 0);
else
tree.h (build_int_cst): New, sign extended constant. * tree.h (build_int_cst): New, sign extended constant. (build_int_cstu): New, zero extended constant. (build_int_cst_wide): Renamed from build_int_cst. * tree.c (build_int_cst, build_int_cstu): New. (build_int_cst_wide): Renamed from build_int_cst. (make_vector_type, build_common_tree_nodes, build_common_tree_nodes_2): Adjust build_int_cst calls. * builtins.c (expand_builtin_prefetch, expand_builtin_strstr, expand_builtin_strpbrk, expand_builtin_fputs, build_string_literal, expand_builtin_printf, expand_builtin_sprintf, fold_builtin_classify_type, fold_builtin_lround, fold_builtin_bitop, fold_builtin_isascii, fold_builtin_toascii, fold_builtin_isdigit, simplify_builtin_strstr, simplify_builtin_strpbrk, fold_builtin_fputs, simplify_builtin_sprintf): Likewise. * c-common.c (start_fname_decls, fix_string_type, shorten_compare, DEF_ATTR_INT): Likewise. * c-decl.c (complete_array_type, check_bitfield_type_and_width): Likewise. * c-lex.c (interpret_integer, lex_charconst): Likewise. * c-parse.in (primary) <TYPES_COMPATIBLE_P> Likewise. * c-pretty-print.c (pp_c_integer_constant): Likewise. * c-typeck.c (really_start_incremental_init, push_init_level, set_nonincremental_init_from_string): Likewise. * calls.c (load_register_parameters): Likewise. convert.c (convert_to_pointer): Likewise. coverage.c (coverage_counter_alloc, tree_coverage_counter_ref, build_fn_info_type, build_fn_info_value, build_ctr_info_value, build_gcov_info): Likewise. * except.c (init_eh, assign_filter_values): Likewise. * expmed.c (store_fixed_bit_field, extract_bit_field, extract_fixed_bit_field, extract_split_bit_field, expand_shift, expand_mult_const, expand_mult_highpart_adjust, extract_high_half, expand_sdiv_pow2, expand_divmod, make_tree): Likewise. * expr.c (convert_move, emit_group_load, emit_group_store, expand_assignment, store_constructor, store_field, expand_expr_real_1, reduce_to_bit_field_precision): Likewise. fold-const.c (force_fit_type, int_const_binop, fold_convert_const, invert_truthvalue, optimize_bit_field_compare, decode_field_reference, all_ones_mask_p, constant_boolean_node, fold_div_compare, fold, fold_read_from_constant_string, fold_negate_const, fold_abs_const, fold_not_const, round_up, round_down): Likewise. * function.c (assign_parm_setup_block): Likewise. * stmt.c (shift_return_value, expand_case, estimate_case_costs): Likewise. * stor-layout.c (layout_type, initialize_sizetypes, set_min_and_max_values_for_integral_type): Likewise. * tree-chrec.c (chrec_fold_multiply_poly_poly, reset_evolution_in_loop): Likewise. * tree-chrec.h (build_polynomial_chrec): Likewise. * tree-complex.c (build_replicated_const): Likewise. * tree-eh.c (honor_protect_cleanup_actions, lower_try_finally_onedest, lower_try_finally_copy, lower_try_finally_switch): Likewise. * tree-mudflap.c (mf_build_string, mx_register_decls, mudflap_register_call, mudflap_enqueue_constant): Likewise. * tree-nested.c (get_trampoline_type, get_nl_goto_field): Likewise. * tree-pretty-print.c (dump_generic_node): Likewise. * tree-ssa-ccp.c (widen_bitfield, maybe_fold_offset_to_array_ref): Likewise. * tree-ssa-dom.c (simplify_rhs_and_lookup_avail_expr): Likewise. * tree-ssa-loop-niter.c (number_of_iterations_cond, loop_niter_by_eval, upper_bound_in_type, lower_bound_in_type): Likewise. * tree-ssa-loop-ivcanon.c (create_canonical_iv, canonicalize_loop_induction_variables): Likewise. * tree-vectorizer.c (vect_create_index_for_array_ref, vect_transform_loop_bound, vect_compute_data_ref_alignment): Likewise. * config/alpha/alpha.c (alpha_initialize_trampoline, alpha_va_start, alpha_gimplify_va_arg_1): Likewise. * config/arm/arm.c (arm_get_cookie_size): Likewise. * config/c4x/c4x.c (c4x_gimplify_va_arg_expr): Likewise. * config/i386/i386.c (ix86_va_start, ix86_gimplify_va_arg): Likewise. * config/ia64/ia64.c (ia64_gimplify_va_arg): Likewise. * config/mips/mips.c (mips_build_builtin_va_list, mips_va_start, mips_gimplify_va_arg_expr): Likewise. * config/pa/pa.c (hppa_gimplify_va_arg_expr): Likewise. * config/rs6000/rs6000.c (rs6000_va_start, rs6000_gimplify_va_arg, add_compiler_branch_island): Likewise. * config/s390/s390.c (s390_va_start): Likewise. * config/sh/sh.c (sh_va_start): Likewise. * config/stormy16/stormy16.c (xstormy16_expand_builtin_va_start): Likewise. * config/xtensa/xtensa.c (xtensa_va_start, xtensa_gimplify_va_arg_expr): Likewise. * objc/objc-act.c (build_objc_string_object, build_objc_symtab_template, init_def_list, init_objc_symtab, init_module_descriptor, generate_static_references, build_selector_translation_table, get_proto_encoding, build_typed_selector_reference, build_selector_reference, build_next_objc_exception_stuff, build_method_prototype_list_template, generate_descriptor_table, generate_protocols, build_protocol_initializer, build_ivar_list_template, build_method_list_template, build_ivar_list_initializer, generate_ivars_list, generate_dispatch_table, generate_protocol_list, build_category_initializer, build_shared_structure_initializer, generate_shared_structures, handle_impent, generate_objc_image_info): Likewise. 2004-04-25 Paolo Bonzini <bonzini@gnu.org> * cfglayout.c (duplicate_insn_chain): Remove references to NOTE_INSN_LOOP_VTOP and NOTE_INSN_LOOP_CONT. * cfgloop.h (struct loop): Remove fields vtop, cont and cont_dominator. * cfgrtl.c (rtl_delete_block): Remove handling of NOTE_INSN_LOOP_CONT. * final.c (final_scan_insn): Remove references to NOTE_INSN_LOOP_VTOP and NOTE_INSN_LOOP_CONT. * insn-notes.def (NOTE_INSN_LOOP_VTOP, NOTE_INSN_LOOP_CONT): Remove. * jump.c (squeeze_notes): Remove references to NOTE_INSN_LOOP_VTOP and NOTE_INSN_LOOP_CONT. * loop.c (scan_loops, find_and_verify_loops, for_each_insn_in_loop, check_dbra_loop, loop_dump_aux): Remove references to removed notes and fields. * reorg.c (mostly_true_jump): Do not rely on NOTE_INSN_LOOP_VTOPs. * unroll.c (unroll_loop, copy_loop_body, loop_iterations): Remove references to removed notes and fields. (subtract_reg_term, ujump_to_loop_cont): Remove. From-SVN: r86544
2004-08-25 11:52:54 +02:00
expr = build_int_cst (NULL_TREE, 0);
initlist = tree_cons (NULL_TREE, expr, initlist);
}
tree.c (build_constructor): New function. * tree.c (build_constructor): New function. * tree.h: Prototype it. * c-typeck.c (build_c_cast, pop_init_level) * profile.c (build_function_info_value, build_gcov_info_value) (create_profiler): Use build_constructor. * builtins.c (expand_builtin_args_info): Remove #if 0 blocks. * objc/objc-act.c (build_constructor): Rename objc_build_constructor. Use build_constructor. (build_objc_string_object, objc_add_static_instance) (init_def_list, init_objc_symtab, init_module_descriptor) (generate_static_references, build_selector_translation_table) (build_descriptor_table_initializer, generate_descriptor_table) (build_protocol_initializer, build_ivar_list_initializer) (generate_ivars_list, build_dispatch_table_initializer) (generate_dispatch_table, generate_protocol_list) (build_category_initializer, build_shared_structure_initializer): Update to match. ada: * gigi.h, utils2.c (build_constructor): Rename gnat_build_constructor. Use build_constructor. * decl.c (gnat_to_gnu_entity) * trans.c (tree_transform, pos_to_constructor, extract_values) * ada/utils.c (build_template, convert_to_fat_pointer, convert) (unchecked_convert) * ada/utils2.c (build_binary_op, build_call_raise, build_allocator) (fill_vms_descriptor): Update to match. cp: * class.c (initialize_array) * decl.c (reshape_init) * decl2.c (build_expr_from_tree) * init.c (build_zero_init) * pt.c (tsubst_copy, tsubst_copy_and_build) * rtti.c (tinfo_base_init, generic_initializer, ptr_initializer) (ptm_initializer, class_initializer, get_pseudo_ti_init) * semantics.c (finish_compound_literal) * typeck.c (build_ptrmemfunc1) * typeck2.c (store_init_value, process_init_constructor) (build_functional_cast): Use build_constructor. f: * com.c (ffecom_build_complex_constant_, ffecom_expr_) (ffecom_init_zero_, ffecom_transform_namelist_, ffecom_vardesc_) (ffecom_vardesc_array_, ffecom_vardesc_dims_, ffecom_2) * ste.c (ffeste_io_ialist_, ffeste_io_cilist_, ffeste_io_cllist_) (ffeste_io_icilist_, ffeste_io_inlist_, ffeste_io_olist_): Use build_constructor. java: * class.c (make_field_value, make_method_value, get_dispatch_table) (make_class_data, emit_offset_symbol_table) * constants.c (build_constants_constructor) * java-tree.h (START_RECORD_CONSTRUCTOR) * parse.y (maybe_build_array_element_wfl): Use build_constructor. From-SVN: r65539
2003-04-13 03:45:35 +02:00
return objc_build_constructor (type, nreverse (initlist));
1992-01-18 00:15:38 +01:00
}
/* Construct the initial value for all of _objc_symtab. */
1992-01-18 00:15:38 +01:00
static tree
init_objc_symtab (tree type)
1992-01-18 00:15:38 +01:00
{
tree initlist;
/* sel_ref_cnt = { ..., 5, ... } */
initlist = build_tree_list (NULL_TREE,
build_int_cst (long_integer_type_node, 0));
1992-01-18 00:15:38 +01:00
/* refs = { ..., _OBJC_SELECTOR_TABLE, ... } */
1992-01-18 00:15:38 +01:00
if (flag_next_runtime || ! sel_ref_chain)
tree.h (build_int_cst): New, sign extended constant. * tree.h (build_int_cst): New, sign extended constant. (build_int_cstu): New, zero extended constant. (build_int_cst_wide): Renamed from build_int_cst. * tree.c (build_int_cst, build_int_cstu): New. (build_int_cst_wide): Renamed from build_int_cst. (make_vector_type, build_common_tree_nodes, build_common_tree_nodes_2): Adjust build_int_cst calls. * builtins.c (expand_builtin_prefetch, expand_builtin_strstr, expand_builtin_strpbrk, expand_builtin_fputs, build_string_literal, expand_builtin_printf, expand_builtin_sprintf, fold_builtin_classify_type, fold_builtin_lround, fold_builtin_bitop, fold_builtin_isascii, fold_builtin_toascii, fold_builtin_isdigit, simplify_builtin_strstr, simplify_builtin_strpbrk, fold_builtin_fputs, simplify_builtin_sprintf): Likewise. * c-common.c (start_fname_decls, fix_string_type, shorten_compare, DEF_ATTR_INT): Likewise. * c-decl.c (complete_array_type, check_bitfield_type_and_width): Likewise. * c-lex.c (interpret_integer, lex_charconst): Likewise. * c-parse.in (primary) <TYPES_COMPATIBLE_P> Likewise. * c-pretty-print.c (pp_c_integer_constant): Likewise. * c-typeck.c (really_start_incremental_init, push_init_level, set_nonincremental_init_from_string): Likewise. * calls.c (load_register_parameters): Likewise. convert.c (convert_to_pointer): Likewise. coverage.c (coverage_counter_alloc, tree_coverage_counter_ref, build_fn_info_type, build_fn_info_value, build_ctr_info_value, build_gcov_info): Likewise. * except.c (init_eh, assign_filter_values): Likewise. * expmed.c (store_fixed_bit_field, extract_bit_field, extract_fixed_bit_field, extract_split_bit_field, expand_shift, expand_mult_const, expand_mult_highpart_adjust, extract_high_half, expand_sdiv_pow2, expand_divmod, make_tree): Likewise. * expr.c (convert_move, emit_group_load, emit_group_store, expand_assignment, store_constructor, store_field, expand_expr_real_1, reduce_to_bit_field_precision): Likewise. fold-const.c (force_fit_type, int_const_binop, fold_convert_const, invert_truthvalue, optimize_bit_field_compare, decode_field_reference, all_ones_mask_p, constant_boolean_node, fold_div_compare, fold, fold_read_from_constant_string, fold_negate_const, fold_abs_const, fold_not_const, round_up, round_down): Likewise. * function.c (assign_parm_setup_block): Likewise. * stmt.c (shift_return_value, expand_case, estimate_case_costs): Likewise. * stor-layout.c (layout_type, initialize_sizetypes, set_min_and_max_values_for_integral_type): Likewise. * tree-chrec.c (chrec_fold_multiply_poly_poly, reset_evolution_in_loop): Likewise. * tree-chrec.h (build_polynomial_chrec): Likewise. * tree-complex.c (build_replicated_const): Likewise. * tree-eh.c (honor_protect_cleanup_actions, lower_try_finally_onedest, lower_try_finally_copy, lower_try_finally_switch): Likewise. * tree-mudflap.c (mf_build_string, mx_register_decls, mudflap_register_call, mudflap_enqueue_constant): Likewise. * tree-nested.c (get_trampoline_type, get_nl_goto_field): Likewise. * tree-pretty-print.c (dump_generic_node): Likewise. * tree-ssa-ccp.c (widen_bitfield, maybe_fold_offset_to_array_ref): Likewise. * tree-ssa-dom.c (simplify_rhs_and_lookup_avail_expr): Likewise. * tree-ssa-loop-niter.c (number_of_iterations_cond, loop_niter_by_eval, upper_bound_in_type, lower_bound_in_type): Likewise. * tree-ssa-loop-ivcanon.c (create_canonical_iv, canonicalize_loop_induction_variables): Likewise. * tree-vectorizer.c (vect_create_index_for_array_ref, vect_transform_loop_bound, vect_compute_data_ref_alignment): Likewise. * config/alpha/alpha.c (alpha_initialize_trampoline, alpha_va_start, alpha_gimplify_va_arg_1): Likewise. * config/arm/arm.c (arm_get_cookie_size): Likewise. * config/c4x/c4x.c (c4x_gimplify_va_arg_expr): Likewise. * config/i386/i386.c (ix86_va_start, ix86_gimplify_va_arg): Likewise. * config/ia64/ia64.c (ia64_gimplify_va_arg): Likewise. * config/mips/mips.c (mips_build_builtin_va_list, mips_va_start, mips_gimplify_va_arg_expr): Likewise. * config/pa/pa.c (hppa_gimplify_va_arg_expr): Likewise. * config/rs6000/rs6000.c (rs6000_va_start, rs6000_gimplify_va_arg, add_compiler_branch_island): Likewise. * config/s390/s390.c (s390_va_start): Likewise. * config/sh/sh.c (sh_va_start): Likewise. * config/stormy16/stormy16.c (xstormy16_expand_builtin_va_start): Likewise. * config/xtensa/xtensa.c (xtensa_va_start, xtensa_gimplify_va_arg_expr): Likewise. * objc/objc-act.c (build_objc_string_object, build_objc_symtab_template, init_def_list, init_objc_symtab, init_module_descriptor, generate_static_references, build_selector_translation_table, get_proto_encoding, build_typed_selector_reference, build_selector_reference, build_next_objc_exception_stuff, build_method_prototype_list_template, generate_descriptor_table, generate_protocols, build_protocol_initializer, build_ivar_list_template, build_method_list_template, build_ivar_list_initializer, generate_ivars_list, generate_dispatch_table, generate_protocol_list, build_category_initializer, build_shared_structure_initializer, generate_shared_structures, handle_impent, generate_objc_image_info): Likewise. 2004-04-25 Paolo Bonzini <bonzini@gnu.org> * cfglayout.c (duplicate_insn_chain): Remove references to NOTE_INSN_LOOP_VTOP and NOTE_INSN_LOOP_CONT. * cfgloop.h (struct loop): Remove fields vtop, cont and cont_dominator. * cfgrtl.c (rtl_delete_block): Remove handling of NOTE_INSN_LOOP_CONT. * final.c (final_scan_insn): Remove references to NOTE_INSN_LOOP_VTOP and NOTE_INSN_LOOP_CONT. * insn-notes.def (NOTE_INSN_LOOP_VTOP, NOTE_INSN_LOOP_CONT): Remove. * jump.c (squeeze_notes): Remove references to NOTE_INSN_LOOP_VTOP and NOTE_INSN_LOOP_CONT. * loop.c (scan_loops, find_and_verify_loops, for_each_insn_in_loop, check_dbra_loop, loop_dump_aux): Remove references to removed notes and fields. * reorg.c (mostly_true_jump): Do not rely on NOTE_INSN_LOOP_VTOPs. * unroll.c (unroll_loop, copy_loop_body, loop_iterations): Remove references to removed notes and fields. (subtract_reg_term, ujump_to_loop_cont): Remove. From-SVN: r86544
2004-08-25 11:52:54 +02:00
initlist = tree_cons (NULL_TREE, build_int_cst (NULL_TREE, 0), initlist);
else
Makefile.in (c-parse.o): Depend on $(C_COMMON_H). [gcc/ChangeLog] 2004-09-07 Ziemowit Laski <zlaski@apple.com> * Makefile.in (c-parse.o): Depend on $(C_COMMON_H). * c-parse.in: Include c-common.h instead of objc-act.h. (ivar_decl_list, ivar_decls, ivar_decl, ivars, ivar_declarator, myparms, myparm): Remove %type declarations. (methodtype, optparms, OBJC_TYPE_QUAL, objc_quals, objc_qual, objc_typename, objc_try_catch_stmt, optellipsis): Add %type declarations. (objc_inherit_code, objc_public_flag): Remove. (typespec_nonreserved_nonattr): Call objc_get_protocol_qualified_type() instead of get_static_reference() and get_protocol_reference(). (stmt_nocomp): Call grokparm() on @catch parameter. (objcdef): Move semantic action to objc_finish_implementation(). (classdef): Move semantic action to objc_start_class_interface(), objc_continue_interface(), objc_finish_interface(), objc_start_class_implementation(), objc_continue_implementation(), objc_start_category_interface() and objc_start_category_implementation(). (protocoldef): Move semantic actions to objc_start_protocol() and objc_finish_interface(). (ivar_decl_list): Remove nonterminal. (visibility_spec): Move semantic actions to objc_set_visibility(). (ivar_decls): Remove assignment to $$. (ivar_decl): Rephrase in terms of component_decl; call objc_add_instance_variable(). (ivars, ivar_declarator): Remove nonterminals. (opt_semi): New nonterminal. (methodtype): Remove semantic actions. (methoddef): Move semantic actions to objc_set_method_type(), objc_start_method_definition() and objc_finish_method_definition(). (methodproto): Move semantic actions to objc_set_method_type() and objc_add_method_declaration(). (methoddecl): Use objc_typename instead of typename; move semantic actions to objc_build_method_signature(). (optarglist, myxdecls, mydecl, myparms, myparm): Remove nonterminals. (optparmlist): Express in terms of optparms and optellipsis. (optparms, optellipsis, objc_qual, objc_quals, objc_typename): New nonterminals. (keyworddecl): Use objc_typename instead of typename. (rid_to_yy): Mark RID_IN, RID_OUT, RID_INOUT, RID_BYCOPY, RID_BYREF and RID_ONEWAY as returning OBJC_TYPE_QUAL to yyparse(). [gcc/objc/ChangeLog] 2004-09-07 Ziemowit Laski <zlaski@apple.com> * Make-lang.in (objc/objc-parse.o): Depend on $(C_COMMON_H) instead of objc/objc-act.h. (objc/objc-act.o): Depend on $(HASHTAB_H). * objc-act.c: Include hashtab.h; in ObjC++ mode, include cp-tree.h and objcp-decl.h instead of c-tree.h. (build_module_descriptor, get_class_ivars, synth_id_with_class_suffix, error_with_ivar, gen_method_decl, gen_declaration, setup_string_decl, build_protocol_template): Adjust prototypes. (build_module_initializer_routine, start_class, continue_class, finish_class, start_method_def, objc_start_function, start_protocol, build_method_decl, objc_add_method, add_instance_variable, build_ivar_reference, is_ivar, is_private, get_super_receiver, build_selector_table_decl, objc_push_parm, objc_get_parm_info, gen_type_name, gen_type_name_0, start_var_decl, finish_var_decl, create_field_decl): New prototypes. (objc_expand_function_end, comp_method_with_proto, objc_expr_last, gen_declaration_1, gen_declarator, is_complex_decl, adorn_decl, define_decl, create_builtin_decl, gen_declspecs): Remove prototypes. (TYPE_ID): Rename to OBJECT_TYPEDEF_NAME. (CLASS_TYPEDEF_NAME): New. (TAG_EXECCLASS): Change from a global variable to a #define. (TAG_RETURN_STRUCT): Delete. (TAG_GNUINIT): New, holds '__objc_gnu_init' name. (objc_inherit_code, objc_public_flag): New, moved from c-parse.in. (string_descriptor): New struct. (string_htab): New hash table. (string_hash, string_eq): New prototypes. (generate_struct_by_value_array): Call create_field_decl() instead of create_builtin_decl(). (objc_init): Do not initialize objc_ellipsis_node or TAG_EXECCLASS; In ObjC++ mode, call cxx_init() instead of c_objc_common_init(). (objc_finish_file): In ObjC++, call instantiate_pending_templates() and cp_finish_file(). (define_decl, get_static_reference, get_protocol_reference, create_builtin_decl): Remove functions. (objc_start_class_interface, objc_start_category_interface, objc_start_protocol, objc_continue_interface, objc_finish_interface, objc_start_class_implementation, objc_start_category_implementation, objc_continue_implementation, objc_finish_implementation, objc_set_visibility, objc_set_method_type, objc_build_method_signature, objc_add_method_declaration, objc_start_method_definition, objc_add_instance_variable, objc_get_protocol_qualified_type, create_field_decl, start_var_decl, finish_var_decl): New functions. (setup_string_decl): Simplify since it is only called once. (synth_module_prologue): Call build_class_template(); predefine 'id' and 'Class' as typedefs; rename 'temp_type' to 'type'; disable debug hooks for duration of function; fix GNU runtime messenger signatures to correspond to reality; forward-declare '__objc_exec_class' for the GNU runtime; call build_selector_table_decl(); in ObjC++ mode, generate 'extern "C" { ... }' wrappers around synthesized declarations; call build_protocol_template() and build_category_template(). (string_hash, string_eq): New functions. (objc_build_string_object): Check metaclass correctness only once; store string literals in hash table. (objc_build_constructor): Do not convert initializer elements; adjust for ObjC++ impedance mismatch. (build_objc_symtab_template): Call create_field_decl() instead of create_builtin_decl(). (init_objc_symtab): Add missing conversion to initializer element. (build_metadata_decl): Call start_var_decl() instead of define_decl(). (generate_objc_symtab_decl): Do not call build_category_template(); call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(). (build_module_descriptor): Call create_field_decl() instead of grokfield(); call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(); always mark module descriptor as used; move GNU runtime-specific functionality to build_module_initializer_routine(). (build_module_initializer_routine): New function, broken off of build_module_descriptor(). (objc_static_init_needed_p, objc_generate_static_init_call): New functions. (generate_static_references, generate_strings, build_selector_translation_table, generate_descriptor_table, generate_ivars_list, generate_dispatch_table, generate_category): Call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(); build a type directly instead of via groktypename(). (build_selector_reference_decl, build_selector_table_decl, build_class_reference_decl, build_protocol_reference, generate_objc_image_info): Call start_var_decl() instead of build_decl(). (build_selector_reference): For GNU runtime, do not call build_selector_reference_decl(). (build_selector, build_typed_selector_reference): Always convert result to the selector type. (add_objc_string): Cast return value to 'char *'. (build_method_prototype_template, build_selector_template, build_method_template): Use actual selector type for fields pointing to selectors. (finish_objc): For GNU runtime, call build_module_initializer_routine() after build_module_descriptor(). (generate_protocol_list, generate_shared_structures): Call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(); build a type directly instead of via groktypename(). (synth_id_with_class_suffix): Return a string. (get_arg_type_list): For instance methods, use the instance type for 'self'; do not call groktypename_in_parm_context(). (build_objc_string_decl): Squash redeclaration errors in ObjC++. (objc_is_class_name): Use OBJC_TYPE_NAME instead of TYPE_NAME; handle RECORD_TYPEs in ObjC as well as ObjC++. (objc_is_id): New function. (objc_is_object_ptr): Return the canonical type node. (objc_get_class_ivars): Simplify using get_class_ivars(). (get_class_ivars): Remove second parameter; create a fresh copy of the ivar list for each call; do not check for existence of super class. (objc_eh_runtime_type): Mark #ifndef OBJCPLUS. (objc_init_exceptions): When using SJLJ-style exceptions, require the use of '-fobjc-exceptions' flag; do not require it for DWARF-style exceptions. (objc_build_exc_ptr, next_sjlj_build_try_catch_finally): Use objc_object_type instead of objc_id_type. (objc_begin_catch_clause): Convert the incoming PARM_DECL into a VAR_DECL before placing it in the appropriate scope; do not call define_decl(); adjust call to c_begin_compound_stmt(); use objc_object_type instead of objc_id_type. (build_next_objc_exception_stuff): Call create_field_decl() instead of create_builtin_decl(); construct type directly instead of calling groktypename(); use OBJC_VOID_AT_END to mark end of function parameters. (build_private_template): Adjust call to get_class_ivars(); build a type directly instead of via groktypename(). (build_protocol_template, build_method_prototype_list_template, build_method_prototype_template, build_category_template, build_selector_template, build_class_template, build_super_template, build_ivar_template, build_ivar_list_template, build_method_list_template, build_method_template): Call create_field_decl() instead of grokfield(). (objc_method_parm_type): Do not call groktypename(). (generate_descriptor_table): Call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(). (generate_method_descriptors, build_protocol_initializer, generate_dispatch_tables, build_category_initializer, build_shared_structure_initializer): Do not call groktypename(). (generate_protocols): Call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(); do not call groktypename(). (error_with_ivar): Remove last parameter. (check_ivars): Do not iterate ovar CLASS_RAW_IVARS lists in addition to CLASS_IVARS lists; adjust calls to error_with_ivar(). (generate_ivar_lists): Convert one of the initializer elements; do not call groktypename(). (get_arg_type_list, start_method_def, gen_method_def): Account for new representation of variable arguments and '...' in Objective-C methods; add Objective-C++ impedance matching code. (is_objc_type_qualifier): Remove function. (adjust_type_for_id_default): Simplify; there is no longer a need to wade through declspecs. (lookup_interface, start_class, continue_class, finish_class, start_method_def, start_protocol, build_method_decl, objc_add_method, add_instance_variable, build_ivar_reference, is_ivar, is_private, get_super_receiver, objc_build_finally_epilogue): Make into static functions. (receiver_is_class_object): Use new IS_CLASS() macro. (objc_build_message_expr): Tweak ObjC++ message argument handling; call objc_finish_message_expr() instead of finish_message_expr(). (finish_message_expr): Rename to objc_finish_message_expr(); use OBJC_TYPE_NAME and OBJC_SET_TYPE_NAME macros instead of TYPE_NAME. call gen_type_name() instead of gen_declaration(); call objc_is_id() instead of using IS_ID and IS_CLASS; Use objc_class_name instead of calling get_identifier("Class"); handle CONVERT_EXPRs in receiver. (build_objc_method_call, warn_with_method): Do not call groktypename(). (build_ivar_reference): Call convert() instead of clobbering in a type. (hash_init): Initialize string_htab hash table. (add_instance_variable): Simplify parameter list; do not call grokfield(); do not populate CLASS_IVARS list. (start_class): Check for the existence of super class, if one was specified. (continue_class): Use CLASS_RAW_IVARS rather than CLASS_IVARS; do not call build_class_template(); adjust call to get_class_ivars(); call build_decl(), pushdecl() and finish_decl() instead of define_decl(). (finish_class): Call build_decl(), pushdecl() and finish_decl() instead of define_decl(). (add_protocols): Use PROTOCOL_BINFO_ELTS for the tree vector size. (start_protocol): Do not call build_protocol_template(); use PROTOCOL_BINFO_ELTS for the tree vector size. (encode_type_qualifiers): Do not handle the 'const' qualifier here. (encode_pointer): Encode 'const char *' as 'r*', for backwards compatibility. (encode_array): Use HOST_WIDE_INT_PRINT_DEC instead of "%ld". (encode_type): Handle the 'const' qualifier here. (objc_parmlist): New global variable, sued by objc_push_parm and objc_get_parm_info(). (objc_push_parm, objc_get_parm_info): New functions. (objc_expr_last): Remove function. (synth_self_and_ucmd_args): For instance methods, use the instance type for 'self'; call objc_push_parm() instead of push_parm_decl(). (start_method_def): Do not call push_scope(), declare_parm_level(), pop_scope(), push_parm_decl(), store_parm_decls() or objc_expr_last(); just use objc_push_parm() and objc_get_parm_info(). (comp_method_with_proto): Remove function. (objc_types_are_equivalent): Strip away indirections before comparing underlying types. (comp_proto_with_proto): Do not call groktypename(); types are no longer in raw declspec format. (objc_start_function): New function. (really_start_method): Call comp_proto_with_proto() instead of comp_method_with_proto(); call objc_start_function() instead of hand-crafting a function declarator. (continue_method_def, objc_expand_function_end): Remove functions. (get_super_receiver): Call objc_get_current_scope() instead of get_current_scope(); reference 'super_class' field (instead of 'class'). (finish_method_def): Rename to objc_finish_method_definition() and add a function decl parameter; move method encoding call from objc_expand_function_end(). (is_complex_decl, adorn_decl, gen_declarator, gen_declspecs, gen_declaration_1): Remove functions. (tmpbuf, RAW_DECLSPEC): Remove. (gen_declaration): Remove second parameter; simplify to deal with TYPE_P nodes instead of raw declspecs. (gen_type_name, gen_type_name_0): New functions. (gen_method_decl): Remove second parameter; call gen_type_name() instead of gen_declaration_1(). (dump_interface): Adjust calls to gen_declaration() and gen_method_decl(); do not allocate a separate string buffer. (init_objc): Allocate a larger string buffer to accommodate dump_interface(); adjust call to build_module_descriptor(); add call to build_module_initializer_routine() for the GNU runtime. (generate_classref_translation_entry): Do not call start_decl(); call finish_var_decl() instead of finish_decl(); call convert() instead of build_c_cast(). * objc-act.h (CLASS_OWN_IVARS): Remove accessor. (CLASS_BINFO_ELTS): Reduce from 6 to 5, now that CLASS_OWN_IVARS is gone. (OCTI_GNU_INIT_DECL, GNU_INIT_decl): New. (OCTI_ELLIPSIS_NODE, objc_ellipsis_node): Remove. (OCTI_ID_ID, id_type, objc_id_id): Rename to OCTI_ID_NAME, objc_object_type and objc_object_name, respectively. (OCTI_CLS_REF, OCTI_CLASS_NAME, objc_class_reference, objc_class_name): New. (IS_CLASS): New macro. (IS_ID, IS_SUPER): Robustify. (OCTI_EXECCLASS_DECL, execclass_decl): New. (finish_file, start_class, continue_class, finish_class, start_method_def, continue_method_def, finish_method_def, start_protocol, finish_protocol, objc_build_throw_stmt, objc_build_try_catch_finally_stmt, objc_build_synchronized_prologue, objc_build_synchronized_epilogue, objc_build_try_prologue, objc_build_try_epilogue, objc_build_catch_stmt, objc_build_catch_epilogue, objc_build_finally_prologue, objc_build_finally_epilogue, is_ivar, is_private, is_public, add_instance_variable, objc_add_method, get_super_receiver, objc_clear_super_receiver, get_class_ivars_from_name, get_class_reference, get_static_reference, get_object_reference, build_message_expr, finish_message_expr, build_selector_expr, build_ivar_reference, build_keyword_decl, build_method_decl, build_protocol_expr, build_objc_string_object, objc_declare_alias, objc_declare_class, objc_declare_protocols, objc_comptypes, objc_check_decl, build_encode_expr): Remove prototypes. (imp_count, cat_count): Make GGC-aware. (OBJC_SET_TYPE_NAME): New macro. From-SVN: r87168
2004-09-08 02:49:44 +02:00
initlist
= tree_cons (NULL_TREE,
convert (build_pointer_type (objc_selector_type),
build_unary_op (ADDR_EXPR,
UOBJC_SELECTOR_TABLE_decl, 1)),
initlist);
1992-01-18 00:15:38 +01:00
/* cls_def_cnt = { ..., 5, ... } */
tree.h (build_int_cst): New, sign extended constant. * tree.h (build_int_cst): New, sign extended constant. (build_int_cstu): New, zero extended constant. (build_int_cst_wide): Renamed from build_int_cst. * tree.c (build_int_cst, build_int_cstu): New. (build_int_cst_wide): Renamed from build_int_cst. (make_vector_type, build_common_tree_nodes, build_common_tree_nodes_2): Adjust build_int_cst calls. * builtins.c (expand_builtin_prefetch, expand_builtin_strstr, expand_builtin_strpbrk, expand_builtin_fputs, build_string_literal, expand_builtin_printf, expand_builtin_sprintf, fold_builtin_classify_type, fold_builtin_lround, fold_builtin_bitop, fold_builtin_isascii, fold_builtin_toascii, fold_builtin_isdigit, simplify_builtin_strstr, simplify_builtin_strpbrk, fold_builtin_fputs, simplify_builtin_sprintf): Likewise. * c-common.c (start_fname_decls, fix_string_type, shorten_compare, DEF_ATTR_INT): Likewise. * c-decl.c (complete_array_type, check_bitfield_type_and_width): Likewise. * c-lex.c (interpret_integer, lex_charconst): Likewise. * c-parse.in (primary) <TYPES_COMPATIBLE_P> Likewise. * c-pretty-print.c (pp_c_integer_constant): Likewise. * c-typeck.c (really_start_incremental_init, push_init_level, set_nonincremental_init_from_string): Likewise. * calls.c (load_register_parameters): Likewise. convert.c (convert_to_pointer): Likewise. coverage.c (coverage_counter_alloc, tree_coverage_counter_ref, build_fn_info_type, build_fn_info_value, build_ctr_info_value, build_gcov_info): Likewise. * except.c (init_eh, assign_filter_values): Likewise. * expmed.c (store_fixed_bit_field, extract_bit_field, extract_fixed_bit_field, extract_split_bit_field, expand_shift, expand_mult_const, expand_mult_highpart_adjust, extract_high_half, expand_sdiv_pow2, expand_divmod, make_tree): Likewise. * expr.c (convert_move, emit_group_load, emit_group_store, expand_assignment, store_constructor, store_field, expand_expr_real_1, reduce_to_bit_field_precision): Likewise. fold-const.c (force_fit_type, int_const_binop, fold_convert_const, invert_truthvalue, optimize_bit_field_compare, decode_field_reference, all_ones_mask_p, constant_boolean_node, fold_div_compare, fold, fold_read_from_constant_string, fold_negate_const, fold_abs_const, fold_not_const, round_up, round_down): Likewise. * function.c (assign_parm_setup_block): Likewise. * stmt.c (shift_return_value, expand_case, estimate_case_costs): Likewise. * stor-layout.c (layout_type, initialize_sizetypes, set_min_and_max_values_for_integral_type): Likewise. * tree-chrec.c (chrec_fold_multiply_poly_poly, reset_evolution_in_loop): Likewise. * tree-chrec.h (build_polynomial_chrec): Likewise. * tree-complex.c (build_replicated_const): Likewise. * tree-eh.c (honor_protect_cleanup_actions, lower_try_finally_onedest, lower_try_finally_copy, lower_try_finally_switch): Likewise. * tree-mudflap.c (mf_build_string, mx_register_decls, mudflap_register_call, mudflap_enqueue_constant): Likewise. * tree-nested.c (get_trampoline_type, get_nl_goto_field): Likewise. * tree-pretty-print.c (dump_generic_node): Likewise. * tree-ssa-ccp.c (widen_bitfield, maybe_fold_offset_to_array_ref): Likewise. * tree-ssa-dom.c (simplify_rhs_and_lookup_avail_expr): Likewise. * tree-ssa-loop-niter.c (number_of_iterations_cond, loop_niter_by_eval, upper_bound_in_type, lower_bound_in_type): Likewise. * tree-ssa-loop-ivcanon.c (create_canonical_iv, canonicalize_loop_induction_variables): Likewise. * tree-vectorizer.c (vect_create_index_for_array_ref, vect_transform_loop_bound, vect_compute_data_ref_alignment): Likewise. * config/alpha/alpha.c (alpha_initialize_trampoline, alpha_va_start, alpha_gimplify_va_arg_1): Likewise. * config/arm/arm.c (arm_get_cookie_size): Likewise. * config/c4x/c4x.c (c4x_gimplify_va_arg_expr): Likewise. * config/i386/i386.c (ix86_va_start, ix86_gimplify_va_arg): Likewise. * config/ia64/ia64.c (ia64_gimplify_va_arg): Likewise. * config/mips/mips.c (mips_build_builtin_va_list, mips_va_start, mips_gimplify_va_arg_expr): Likewise. * config/pa/pa.c (hppa_gimplify_va_arg_expr): Likewise. * config/rs6000/rs6000.c (rs6000_va_start, rs6000_gimplify_va_arg, add_compiler_branch_island): Likewise. * config/s390/s390.c (s390_va_start): Likewise. * config/sh/sh.c (sh_va_start): Likewise. * config/stormy16/stormy16.c (xstormy16_expand_builtin_va_start): Likewise. * config/xtensa/xtensa.c (xtensa_va_start, xtensa_gimplify_va_arg_expr): Likewise. * objc/objc-act.c (build_objc_string_object, build_objc_symtab_template, init_def_list, init_objc_symtab, init_module_descriptor, generate_static_references, build_selector_translation_table, get_proto_encoding, build_typed_selector_reference, build_selector_reference, build_next_objc_exception_stuff, build_method_prototype_list_template, generate_descriptor_table, generate_protocols, build_protocol_initializer, build_ivar_list_template, build_method_list_template, build_ivar_list_initializer, generate_ivars_list, generate_dispatch_table, generate_protocol_list, build_category_initializer, build_shared_structure_initializer, generate_shared_structures, handle_impent, generate_objc_image_info): Likewise. 2004-04-25 Paolo Bonzini <bonzini@gnu.org> * cfglayout.c (duplicate_insn_chain): Remove references to NOTE_INSN_LOOP_VTOP and NOTE_INSN_LOOP_CONT. * cfgloop.h (struct loop): Remove fields vtop, cont and cont_dominator. * cfgrtl.c (rtl_delete_block): Remove handling of NOTE_INSN_LOOP_CONT. * final.c (final_scan_insn): Remove references to NOTE_INSN_LOOP_VTOP and NOTE_INSN_LOOP_CONT. * insn-notes.def (NOTE_INSN_LOOP_VTOP, NOTE_INSN_LOOP_CONT): Remove. * jump.c (squeeze_notes): Remove references to NOTE_INSN_LOOP_VTOP and NOTE_INSN_LOOP_CONT. * loop.c (scan_loops, find_and_verify_loops, for_each_insn_in_loop, check_dbra_loop, loop_dump_aux): Remove references to removed notes and fields. * reorg.c (mostly_true_jump): Do not rely on NOTE_INSN_LOOP_VTOPs. * unroll.c (unroll_loop, copy_loop_body, loop_iterations): Remove references to removed notes and fields. (subtract_reg_term, ujump_to_loop_cont): Remove. From-SVN: r86544
2004-08-25 11:52:54 +02:00
initlist = tree_cons (NULL_TREE, build_int_cst (NULL_TREE, imp_count), initlist);
1992-01-18 00:15:38 +01:00
/* cat_def_cnt = { ..., 5, ... } */
tree.h (build_int_cst): New, sign extended constant. * tree.h (build_int_cst): New, sign extended constant. (build_int_cstu): New, zero extended constant. (build_int_cst_wide): Renamed from build_int_cst. * tree.c (build_int_cst, build_int_cstu): New. (build_int_cst_wide): Renamed from build_int_cst. (make_vector_type, build_common_tree_nodes, build_common_tree_nodes_2): Adjust build_int_cst calls. * builtins.c (expand_builtin_prefetch, expand_builtin_strstr, expand_builtin_strpbrk, expand_builtin_fputs, build_string_literal, expand_builtin_printf, expand_builtin_sprintf, fold_builtin_classify_type, fold_builtin_lround, fold_builtin_bitop, fold_builtin_isascii, fold_builtin_toascii, fold_builtin_isdigit, simplify_builtin_strstr, simplify_builtin_strpbrk, fold_builtin_fputs, simplify_builtin_sprintf): Likewise. * c-common.c (start_fname_decls, fix_string_type, shorten_compare, DEF_ATTR_INT): Likewise. * c-decl.c (complete_array_type, check_bitfield_type_and_width): Likewise. * c-lex.c (interpret_integer, lex_charconst): Likewise. * c-parse.in (primary) <TYPES_COMPATIBLE_P> Likewise. * c-pretty-print.c (pp_c_integer_constant): Likewise. * c-typeck.c (really_start_incremental_init, push_init_level, set_nonincremental_init_from_string): Likewise. * calls.c (load_register_parameters): Likewise. convert.c (convert_to_pointer): Likewise. coverage.c (coverage_counter_alloc, tree_coverage_counter_ref, build_fn_info_type, build_fn_info_value, build_ctr_info_value, build_gcov_info): Likewise. * except.c (init_eh, assign_filter_values): Likewise. * expmed.c (store_fixed_bit_field, extract_bit_field, extract_fixed_bit_field, extract_split_bit_field, expand_shift, expand_mult_const, expand_mult_highpart_adjust, extract_high_half, expand_sdiv_pow2, expand_divmod, make_tree): Likewise. * expr.c (convert_move, emit_group_load, emit_group_store, expand_assignment, store_constructor, store_field, expand_expr_real_1, reduce_to_bit_field_precision): Likewise. fold-const.c (force_fit_type, int_const_binop, fold_convert_const, invert_truthvalue, optimize_bit_field_compare, decode_field_reference, all_ones_mask_p, constant_boolean_node, fold_div_compare, fold, fold_read_from_constant_string, fold_negate_const, fold_abs_const, fold_not_const, round_up, round_down): Likewise. * function.c (assign_parm_setup_block): Likewise. * stmt.c (shift_return_value, expand_case, estimate_case_costs): Likewise. * stor-layout.c (layout_type, initialize_sizetypes, set_min_and_max_values_for_integral_type): Likewise. * tree-chrec.c (chrec_fold_multiply_poly_poly, reset_evolution_in_loop): Likewise. * tree-chrec.h (build_polynomial_chrec): Likewise. * tree-complex.c (build_replicated_const): Likewise. * tree-eh.c (honor_protect_cleanup_actions, lower_try_finally_onedest, lower_try_finally_copy, lower_try_finally_switch): Likewise. * tree-mudflap.c (mf_build_string, mx_register_decls, mudflap_register_call, mudflap_enqueue_constant): Likewise. * tree-nested.c (get_trampoline_type, get_nl_goto_field): Likewise. * tree-pretty-print.c (dump_generic_node): Likewise. * tree-ssa-ccp.c (widen_bitfield, maybe_fold_offset_to_array_ref): Likewise. * tree-ssa-dom.c (simplify_rhs_and_lookup_avail_expr): Likewise. * tree-ssa-loop-niter.c (number_of_iterations_cond, loop_niter_by_eval, upper_bound_in_type, lower_bound_in_type): Likewise. * tree-ssa-loop-ivcanon.c (create_canonical_iv, canonicalize_loop_induction_variables): Likewise. * tree-vectorizer.c (vect_create_index_for_array_ref, vect_transform_loop_bound, vect_compute_data_ref_alignment): Likewise. * config/alpha/alpha.c (alpha_initialize_trampoline, alpha_va_start, alpha_gimplify_va_arg_1): Likewise. * config/arm/arm.c (arm_get_cookie_size): Likewise. * config/c4x/c4x.c (c4x_gimplify_va_arg_expr): Likewise. * config/i386/i386.c (ix86_va_start, ix86_gimplify_va_arg): Likewise. * config/ia64/ia64.c (ia64_gimplify_va_arg): Likewise. * config/mips/mips.c (mips_build_builtin_va_list, mips_va_start, mips_gimplify_va_arg_expr): Likewise. * config/pa/pa.c (hppa_gimplify_va_arg_expr): Likewise. * config/rs6000/rs6000.c (rs6000_va_start, rs6000_gimplify_va_arg, add_compiler_branch_island): Likewise. * config/s390/s390.c (s390_va_start): Likewise. * config/sh/sh.c (sh_va_start): Likewise. * config/stormy16/stormy16.c (xstormy16_expand_builtin_va_start): Likewise. * config/xtensa/xtensa.c (xtensa_va_start, xtensa_gimplify_va_arg_expr): Likewise. * objc/objc-act.c (build_objc_string_object, build_objc_symtab_template, init_def_list, init_objc_symtab, init_module_descriptor, generate_static_references, build_selector_translation_table, get_proto_encoding, build_typed_selector_reference, build_selector_reference, build_next_objc_exception_stuff, build_method_prototype_list_template, generate_descriptor_table, generate_protocols, build_protocol_initializer, build_ivar_list_template, build_method_list_template, build_ivar_list_initializer, generate_ivars_list, generate_dispatch_table, generate_protocol_list, build_category_initializer, build_shared_structure_initializer, generate_shared_structures, handle_impent, generate_objc_image_info): Likewise. 2004-04-25 Paolo Bonzini <bonzini@gnu.org> * cfglayout.c (duplicate_insn_chain): Remove references to NOTE_INSN_LOOP_VTOP and NOTE_INSN_LOOP_CONT. * cfgloop.h (struct loop): Remove fields vtop, cont and cont_dominator. * cfgrtl.c (rtl_delete_block): Remove handling of NOTE_INSN_LOOP_CONT. * final.c (final_scan_insn): Remove references to NOTE_INSN_LOOP_VTOP and NOTE_INSN_LOOP_CONT. * insn-notes.def (NOTE_INSN_LOOP_VTOP, NOTE_INSN_LOOP_CONT): Remove. * jump.c (squeeze_notes): Remove references to NOTE_INSN_LOOP_VTOP and NOTE_INSN_LOOP_CONT. * loop.c (scan_loops, find_and_verify_loops, for_each_insn_in_loop, check_dbra_loop, loop_dump_aux): Remove references to removed notes and fields. * reorg.c (mostly_true_jump): Do not rely on NOTE_INSN_LOOP_VTOPs. * unroll.c (unroll_loop, copy_loop_body, loop_iterations): Remove references to removed notes and fields. (subtract_reg_term, ujump_to_loop_cont): Remove. From-SVN: r86544
2004-08-25 11:52:54 +02:00
initlist = tree_cons (NULL_TREE, build_int_cst (NULL_TREE, cat_count), initlist);
1992-01-18 00:15:38 +01:00
/* cls_def = { ..., { &Foo, &Bar, ...}, ... } */
if (imp_count || cat_count || !flag_next_runtime)
{
tree field = TYPE_FIELDS (type);
field = TREE_CHAIN (TREE_CHAIN (TREE_CHAIN (TREE_CHAIN (field))));
initlist = tree_cons (NULL_TREE, init_def_list (TREE_TYPE (field)),
initlist);
}
1992-01-18 00:15:38 +01:00
tree.c (build_constructor): New function. * tree.c (build_constructor): New function. * tree.h: Prototype it. * c-typeck.c (build_c_cast, pop_init_level) * profile.c (build_function_info_value, build_gcov_info_value) (create_profiler): Use build_constructor. * builtins.c (expand_builtin_args_info): Remove #if 0 blocks. * objc/objc-act.c (build_constructor): Rename objc_build_constructor. Use build_constructor. (build_objc_string_object, objc_add_static_instance) (init_def_list, init_objc_symtab, init_module_descriptor) (generate_static_references, build_selector_translation_table) (build_descriptor_table_initializer, generate_descriptor_table) (build_protocol_initializer, build_ivar_list_initializer) (generate_ivars_list, build_dispatch_table_initializer) (generate_dispatch_table, generate_protocol_list) (build_category_initializer, build_shared_structure_initializer): Update to match. ada: * gigi.h, utils2.c (build_constructor): Rename gnat_build_constructor. Use build_constructor. * decl.c (gnat_to_gnu_entity) * trans.c (tree_transform, pos_to_constructor, extract_values) * ada/utils.c (build_template, convert_to_fat_pointer, convert) (unchecked_convert) * ada/utils2.c (build_binary_op, build_call_raise, build_allocator) (fill_vms_descriptor): Update to match. cp: * class.c (initialize_array) * decl.c (reshape_init) * decl2.c (build_expr_from_tree) * init.c (build_zero_init) * pt.c (tsubst_copy, tsubst_copy_and_build) * rtti.c (tinfo_base_init, generic_initializer, ptr_initializer) (ptm_initializer, class_initializer, get_pseudo_ti_init) * semantics.c (finish_compound_literal) * typeck.c (build_ptrmemfunc1) * typeck2.c (store_init_value, process_init_constructor) (build_functional_cast): Use build_constructor. f: * com.c (ffecom_build_complex_constant_, ffecom_expr_) (ffecom_init_zero_, ffecom_transform_namelist_, ffecom_vardesc_) (ffecom_vardesc_array_, ffecom_vardesc_dims_, ffecom_2) * ste.c (ffeste_io_ialist_, ffeste_io_cilist_, ffeste_io_cllist_) (ffeste_io_icilist_, ffeste_io_inlist_, ffeste_io_olist_): Use build_constructor. java: * class.c (make_field_value, make_method_value, get_dispatch_table) (make_class_data, emit_offset_symbol_table) * constants.c (build_constants_constructor) * java-tree.h (START_RECORD_CONSTRUCTOR) * parse.y (maybe_build_array_element_wfl): Use build_constructor. From-SVN: r65539
2003-04-13 03:45:35 +02:00
return objc_build_constructor (type, nreverse (initlist));
1992-01-18 00:15:38 +01:00
}
/* Generate forward declarations for metadata such as
'OBJC_CLASS_...'. */
static tree
build_metadata_decl (const char *name, tree type)
{
Makefile.in (c-parse.o): Depend on $(C_COMMON_H). [gcc/ChangeLog] 2004-09-07 Ziemowit Laski <zlaski@apple.com> * Makefile.in (c-parse.o): Depend on $(C_COMMON_H). * c-parse.in: Include c-common.h instead of objc-act.h. (ivar_decl_list, ivar_decls, ivar_decl, ivars, ivar_declarator, myparms, myparm): Remove %type declarations. (methodtype, optparms, OBJC_TYPE_QUAL, objc_quals, objc_qual, objc_typename, objc_try_catch_stmt, optellipsis): Add %type declarations. (objc_inherit_code, objc_public_flag): Remove. (typespec_nonreserved_nonattr): Call objc_get_protocol_qualified_type() instead of get_static_reference() and get_protocol_reference(). (stmt_nocomp): Call grokparm() on @catch parameter. (objcdef): Move semantic action to objc_finish_implementation(). (classdef): Move semantic action to objc_start_class_interface(), objc_continue_interface(), objc_finish_interface(), objc_start_class_implementation(), objc_continue_implementation(), objc_start_category_interface() and objc_start_category_implementation(). (protocoldef): Move semantic actions to objc_start_protocol() and objc_finish_interface(). (ivar_decl_list): Remove nonterminal. (visibility_spec): Move semantic actions to objc_set_visibility(). (ivar_decls): Remove assignment to $$. (ivar_decl): Rephrase in terms of component_decl; call objc_add_instance_variable(). (ivars, ivar_declarator): Remove nonterminals. (opt_semi): New nonterminal. (methodtype): Remove semantic actions. (methoddef): Move semantic actions to objc_set_method_type(), objc_start_method_definition() and objc_finish_method_definition(). (methodproto): Move semantic actions to objc_set_method_type() and objc_add_method_declaration(). (methoddecl): Use objc_typename instead of typename; move semantic actions to objc_build_method_signature(). (optarglist, myxdecls, mydecl, myparms, myparm): Remove nonterminals. (optparmlist): Express in terms of optparms and optellipsis. (optparms, optellipsis, objc_qual, objc_quals, objc_typename): New nonterminals. (keyworddecl): Use objc_typename instead of typename. (rid_to_yy): Mark RID_IN, RID_OUT, RID_INOUT, RID_BYCOPY, RID_BYREF and RID_ONEWAY as returning OBJC_TYPE_QUAL to yyparse(). [gcc/objc/ChangeLog] 2004-09-07 Ziemowit Laski <zlaski@apple.com> * Make-lang.in (objc/objc-parse.o): Depend on $(C_COMMON_H) instead of objc/objc-act.h. (objc/objc-act.o): Depend on $(HASHTAB_H). * objc-act.c: Include hashtab.h; in ObjC++ mode, include cp-tree.h and objcp-decl.h instead of c-tree.h. (build_module_descriptor, get_class_ivars, synth_id_with_class_suffix, error_with_ivar, gen_method_decl, gen_declaration, setup_string_decl, build_protocol_template): Adjust prototypes. (build_module_initializer_routine, start_class, continue_class, finish_class, start_method_def, objc_start_function, start_protocol, build_method_decl, objc_add_method, add_instance_variable, build_ivar_reference, is_ivar, is_private, get_super_receiver, build_selector_table_decl, objc_push_parm, objc_get_parm_info, gen_type_name, gen_type_name_0, start_var_decl, finish_var_decl, create_field_decl): New prototypes. (objc_expand_function_end, comp_method_with_proto, objc_expr_last, gen_declaration_1, gen_declarator, is_complex_decl, adorn_decl, define_decl, create_builtin_decl, gen_declspecs): Remove prototypes. (TYPE_ID): Rename to OBJECT_TYPEDEF_NAME. (CLASS_TYPEDEF_NAME): New. (TAG_EXECCLASS): Change from a global variable to a #define. (TAG_RETURN_STRUCT): Delete. (TAG_GNUINIT): New, holds '__objc_gnu_init' name. (objc_inherit_code, objc_public_flag): New, moved from c-parse.in. (string_descriptor): New struct. (string_htab): New hash table. (string_hash, string_eq): New prototypes. (generate_struct_by_value_array): Call create_field_decl() instead of create_builtin_decl(). (objc_init): Do not initialize objc_ellipsis_node or TAG_EXECCLASS; In ObjC++ mode, call cxx_init() instead of c_objc_common_init(). (objc_finish_file): In ObjC++, call instantiate_pending_templates() and cp_finish_file(). (define_decl, get_static_reference, get_protocol_reference, create_builtin_decl): Remove functions. (objc_start_class_interface, objc_start_category_interface, objc_start_protocol, objc_continue_interface, objc_finish_interface, objc_start_class_implementation, objc_start_category_implementation, objc_continue_implementation, objc_finish_implementation, objc_set_visibility, objc_set_method_type, objc_build_method_signature, objc_add_method_declaration, objc_start_method_definition, objc_add_instance_variable, objc_get_protocol_qualified_type, create_field_decl, start_var_decl, finish_var_decl): New functions. (setup_string_decl): Simplify since it is only called once. (synth_module_prologue): Call build_class_template(); predefine 'id' and 'Class' as typedefs; rename 'temp_type' to 'type'; disable debug hooks for duration of function; fix GNU runtime messenger signatures to correspond to reality; forward-declare '__objc_exec_class' for the GNU runtime; call build_selector_table_decl(); in ObjC++ mode, generate 'extern "C" { ... }' wrappers around synthesized declarations; call build_protocol_template() and build_category_template(). (string_hash, string_eq): New functions. (objc_build_string_object): Check metaclass correctness only once; store string literals in hash table. (objc_build_constructor): Do not convert initializer elements; adjust for ObjC++ impedance mismatch. (build_objc_symtab_template): Call create_field_decl() instead of create_builtin_decl(). (init_objc_symtab): Add missing conversion to initializer element. (build_metadata_decl): Call start_var_decl() instead of define_decl(). (generate_objc_symtab_decl): Do not call build_category_template(); call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(). (build_module_descriptor): Call create_field_decl() instead of grokfield(); call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(); always mark module descriptor as used; move GNU runtime-specific functionality to build_module_initializer_routine(). (build_module_initializer_routine): New function, broken off of build_module_descriptor(). (objc_static_init_needed_p, objc_generate_static_init_call): New functions. (generate_static_references, generate_strings, build_selector_translation_table, generate_descriptor_table, generate_ivars_list, generate_dispatch_table, generate_category): Call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(); build a type directly instead of via groktypename(). (build_selector_reference_decl, build_selector_table_decl, build_class_reference_decl, build_protocol_reference, generate_objc_image_info): Call start_var_decl() instead of build_decl(). (build_selector_reference): For GNU runtime, do not call build_selector_reference_decl(). (build_selector, build_typed_selector_reference): Always convert result to the selector type. (add_objc_string): Cast return value to 'char *'. (build_method_prototype_template, build_selector_template, build_method_template): Use actual selector type for fields pointing to selectors. (finish_objc): For GNU runtime, call build_module_initializer_routine() after build_module_descriptor(). (generate_protocol_list, generate_shared_structures): Call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(); build a type directly instead of via groktypename(). (synth_id_with_class_suffix): Return a string. (get_arg_type_list): For instance methods, use the instance type for 'self'; do not call groktypename_in_parm_context(). (build_objc_string_decl): Squash redeclaration errors in ObjC++. (objc_is_class_name): Use OBJC_TYPE_NAME instead of TYPE_NAME; handle RECORD_TYPEs in ObjC as well as ObjC++. (objc_is_id): New function. (objc_is_object_ptr): Return the canonical type node. (objc_get_class_ivars): Simplify using get_class_ivars(). (get_class_ivars): Remove second parameter; create a fresh copy of the ivar list for each call; do not check for existence of super class. (objc_eh_runtime_type): Mark #ifndef OBJCPLUS. (objc_init_exceptions): When using SJLJ-style exceptions, require the use of '-fobjc-exceptions' flag; do not require it for DWARF-style exceptions. (objc_build_exc_ptr, next_sjlj_build_try_catch_finally): Use objc_object_type instead of objc_id_type. (objc_begin_catch_clause): Convert the incoming PARM_DECL into a VAR_DECL before placing it in the appropriate scope; do not call define_decl(); adjust call to c_begin_compound_stmt(); use objc_object_type instead of objc_id_type. (build_next_objc_exception_stuff): Call create_field_decl() instead of create_builtin_decl(); construct type directly instead of calling groktypename(); use OBJC_VOID_AT_END to mark end of function parameters. (build_private_template): Adjust call to get_class_ivars(); build a type directly instead of via groktypename(). (build_protocol_template, build_method_prototype_list_template, build_method_prototype_template, build_category_template, build_selector_template, build_class_template, build_super_template, build_ivar_template, build_ivar_list_template, build_method_list_template, build_method_template): Call create_field_decl() instead of grokfield(). (objc_method_parm_type): Do not call groktypename(). (generate_descriptor_table): Call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(). (generate_method_descriptors, build_protocol_initializer, generate_dispatch_tables, build_category_initializer, build_shared_structure_initializer): Do not call groktypename(). (generate_protocols): Call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(); do not call groktypename(). (error_with_ivar): Remove last parameter. (check_ivars): Do not iterate ovar CLASS_RAW_IVARS lists in addition to CLASS_IVARS lists; adjust calls to error_with_ivar(). (generate_ivar_lists): Convert one of the initializer elements; do not call groktypename(). (get_arg_type_list, start_method_def, gen_method_def): Account for new representation of variable arguments and '...' in Objective-C methods; add Objective-C++ impedance matching code. (is_objc_type_qualifier): Remove function. (adjust_type_for_id_default): Simplify; there is no longer a need to wade through declspecs. (lookup_interface, start_class, continue_class, finish_class, start_method_def, start_protocol, build_method_decl, objc_add_method, add_instance_variable, build_ivar_reference, is_ivar, is_private, get_super_receiver, objc_build_finally_epilogue): Make into static functions. (receiver_is_class_object): Use new IS_CLASS() macro. (objc_build_message_expr): Tweak ObjC++ message argument handling; call objc_finish_message_expr() instead of finish_message_expr(). (finish_message_expr): Rename to objc_finish_message_expr(); use OBJC_TYPE_NAME and OBJC_SET_TYPE_NAME macros instead of TYPE_NAME. call gen_type_name() instead of gen_declaration(); call objc_is_id() instead of using IS_ID and IS_CLASS; Use objc_class_name instead of calling get_identifier("Class"); handle CONVERT_EXPRs in receiver. (build_objc_method_call, warn_with_method): Do not call groktypename(). (build_ivar_reference): Call convert() instead of clobbering in a type. (hash_init): Initialize string_htab hash table. (add_instance_variable): Simplify parameter list; do not call grokfield(); do not populate CLASS_IVARS list. (start_class): Check for the existence of super class, if one was specified. (continue_class): Use CLASS_RAW_IVARS rather than CLASS_IVARS; do not call build_class_template(); adjust call to get_class_ivars(); call build_decl(), pushdecl() and finish_decl() instead of define_decl(). (finish_class): Call build_decl(), pushdecl() and finish_decl() instead of define_decl(). (add_protocols): Use PROTOCOL_BINFO_ELTS for the tree vector size. (start_protocol): Do not call build_protocol_template(); use PROTOCOL_BINFO_ELTS for the tree vector size. (encode_type_qualifiers): Do not handle the 'const' qualifier here. (encode_pointer): Encode 'const char *' as 'r*', for backwards compatibility. (encode_array): Use HOST_WIDE_INT_PRINT_DEC instead of "%ld". (encode_type): Handle the 'const' qualifier here. (objc_parmlist): New global variable, sued by objc_push_parm and objc_get_parm_info(). (objc_push_parm, objc_get_parm_info): New functions. (objc_expr_last): Remove function. (synth_self_and_ucmd_args): For instance methods, use the instance type for 'self'; call objc_push_parm() instead of push_parm_decl(). (start_method_def): Do not call push_scope(), declare_parm_level(), pop_scope(), push_parm_decl(), store_parm_decls() or objc_expr_last(); just use objc_push_parm() and objc_get_parm_info(). (comp_method_with_proto): Remove function. (objc_types_are_equivalent): Strip away indirections before comparing underlying types. (comp_proto_with_proto): Do not call groktypename(); types are no longer in raw declspec format. (objc_start_function): New function. (really_start_method): Call comp_proto_with_proto() instead of comp_method_with_proto(); call objc_start_function() instead of hand-crafting a function declarator. (continue_method_def, objc_expand_function_end): Remove functions. (get_super_receiver): Call objc_get_current_scope() instead of get_current_scope(); reference 'super_class' field (instead of 'class'). (finish_method_def): Rename to objc_finish_method_definition() and add a function decl parameter; move method encoding call from objc_expand_function_end(). (is_complex_decl, adorn_decl, gen_declarator, gen_declspecs, gen_declaration_1): Remove functions. (tmpbuf, RAW_DECLSPEC): Remove. (gen_declaration): Remove second parameter; simplify to deal with TYPE_P nodes instead of raw declspecs. (gen_type_name, gen_type_name_0): New functions. (gen_method_decl): Remove second parameter; call gen_type_name() instead of gen_declaration_1(). (dump_interface): Adjust calls to gen_declaration() and gen_method_decl(); do not allocate a separate string buffer. (init_objc): Allocate a larger string buffer to accommodate dump_interface(); adjust call to build_module_descriptor(); add call to build_module_initializer_routine() for the GNU runtime. (generate_classref_translation_entry): Do not call start_decl(); call finish_var_decl() instead of finish_decl(); call convert() instead of build_c_cast(). * objc-act.h (CLASS_OWN_IVARS): Remove accessor. (CLASS_BINFO_ELTS): Reduce from 6 to 5, now that CLASS_OWN_IVARS is gone. (OCTI_GNU_INIT_DECL, GNU_INIT_decl): New. (OCTI_ELLIPSIS_NODE, objc_ellipsis_node): Remove. (OCTI_ID_ID, id_type, objc_id_id): Rename to OCTI_ID_NAME, objc_object_type and objc_object_name, respectively. (OCTI_CLS_REF, OCTI_CLASS_NAME, objc_class_reference, objc_class_name): New. (IS_CLASS): New macro. (IS_ID, IS_SUPER): Robustify. (OCTI_EXECCLASS_DECL, execclass_decl): New. (finish_file, start_class, continue_class, finish_class, start_method_def, continue_method_def, finish_method_def, start_protocol, finish_protocol, objc_build_throw_stmt, objc_build_try_catch_finally_stmt, objc_build_synchronized_prologue, objc_build_synchronized_epilogue, objc_build_try_prologue, objc_build_try_epilogue, objc_build_catch_stmt, objc_build_catch_epilogue, objc_build_finally_prologue, objc_build_finally_epilogue, is_ivar, is_private, is_public, add_instance_variable, objc_add_method, get_super_receiver, objc_clear_super_receiver, get_class_ivars_from_name, get_class_reference, get_static_reference, get_object_reference, build_message_expr, finish_message_expr, build_selector_expr, build_ivar_reference, build_keyword_decl, build_method_decl, build_protocol_expr, build_objc_string_object, objc_declare_alias, objc_declare_class, objc_declare_protocols, objc_comptypes, objc_check_decl, build_encode_expr): Remove prototypes. (imp_count, cat_count): Make GGC-aware. (OBJC_SET_TYPE_NAME): New macro. From-SVN: r87168
2004-09-08 02:49:44 +02:00
tree decl;
/* struct TYPE NAME_<name>; */
decl = start_var_decl (type, synth_id_with_class_suffix
(name,
objc_implementation_context));
return decl;
}
/* Push forward-declarations of all the categories so that
init_def_list can use them in a CONSTRUCTOR. */
1992-01-18 00:15:38 +01:00
static void
forward_declare_categories (void)
1992-01-18 00:15:38 +01:00
{
struct imp_entry *impent;
c-parse.in (objc_inherit_code, [...]): Make static. 2001-10-03 Ziemowit Laski <zlaski@apple.com> * c-parse.in (objc_inherit_code, objc_pq_context, objc_public_flag): Make static. (objc_interface_context, objc_implementation_context, objc_method_context, objc_ivar_chain, objc_ivar_context): Move to global tree array in objc/objc-act.[ch]. (methoddef): Remove unnecessary code. * objc/objc-act.c: (hashed_attribute, hashed_entry, imp_entry): Hoist struct definitions to objc-act.h. (nst_method_hash_list, cls_method_hash_list, imp_list, imp_count, cat_count): Place declaration in objc-act.h. (objc_tree_index): Move enumeration to objc-act.h. (objc_global_trees): Place declaration and macro accessors in objc-act.h. (implementation_context): Remove duplicate; use objc_implementation_context instead: (method_context): Remove duplicate; use objc_method_context instead. (objc_ellipsis_node, objc_method_prototype_template, implemented_classes, function_type): Move global vars to objc_global_trees. (init_objc): Use LAST_BASE_TREE_CODE instead of LAST_CODE. (build_message_expr): Move actual construction of ObjC message send nodes to finish_message_expr. (finish_message_expr): New routine, contains code formerly in build_message_expr. * objc/objc-act.h (finish_message_expr): New prototype. (objc_ivar_chain, objc_method_context, objc_ellipsis_node): Remove declarations; these vars are now part of objc_global_trees. (objc_tree_index, objc_global_trees): Move definitions from objc-act.c. * objc/objc-tree.def: Update copyright info. From-SVN: r46000
2001-10-04 00:05:57 +02:00
tree sav = objc_implementation_context;
1992-01-18 00:15:38 +01:00
for (impent = imp_list; impent; impent = impent->next)
{
if (TREE_CODE (impent->imp_context) == CATEGORY_IMPLEMENTATION_TYPE)
1992-01-18 00:15:38 +01:00
{
/* Set an invisible arg to synth_id_with_class_suffix. */
c-parse.in (objc_inherit_code, [...]): Make static. 2001-10-03 Ziemowit Laski <zlaski@apple.com> * c-parse.in (objc_inherit_code, objc_pq_context, objc_public_flag): Make static. (objc_interface_context, objc_implementation_context, objc_method_context, objc_ivar_chain, objc_ivar_context): Move to global tree array in objc/objc-act.[ch]. (methoddef): Remove unnecessary code. * objc/objc-act.c: (hashed_attribute, hashed_entry, imp_entry): Hoist struct definitions to objc-act.h. (nst_method_hash_list, cls_method_hash_list, imp_list, imp_count, cat_count): Place declaration in objc-act.h. (objc_tree_index): Move enumeration to objc-act.h. (objc_global_trees): Place declaration and macro accessors in objc-act.h. (implementation_context): Remove duplicate; use objc_implementation_context instead: (method_context): Remove duplicate; use objc_method_context instead. (objc_ellipsis_node, objc_method_prototype_template, implemented_classes, function_type): Move global vars to objc_global_trees. (init_objc): Use LAST_BASE_TREE_CODE instead of LAST_CODE. (build_message_expr): Move actual construction of ObjC message send nodes to finish_message_expr. (finish_message_expr): New routine, contains code formerly in build_message_expr. * objc/objc-act.h (finish_message_expr): New prototype. (objc_ivar_chain, objc_method_context, objc_ellipsis_node): Remove declarations; these vars are now part of objc_global_trees. (objc_tree_index, objc_global_trees): Move definitions from objc-act.c. * objc/objc-tree.def: Update copyright info. From-SVN: r46000
2001-10-04 00:05:57 +02:00
objc_implementation_context = impent->imp_context;
/* extern struct objc_category _OBJC_CATEGORY_<name>; */
impent->class_decl = build_metadata_decl ("_OBJC_CATEGORY",
Makefile.in (c-parse.o): Depend on $(C_COMMON_H). [gcc/ChangeLog] 2004-09-07 Ziemowit Laski <zlaski@apple.com> * Makefile.in (c-parse.o): Depend on $(C_COMMON_H). * c-parse.in: Include c-common.h instead of objc-act.h. (ivar_decl_list, ivar_decls, ivar_decl, ivars, ivar_declarator, myparms, myparm): Remove %type declarations. (methodtype, optparms, OBJC_TYPE_QUAL, objc_quals, objc_qual, objc_typename, objc_try_catch_stmt, optellipsis): Add %type declarations. (objc_inherit_code, objc_public_flag): Remove. (typespec_nonreserved_nonattr): Call objc_get_protocol_qualified_type() instead of get_static_reference() and get_protocol_reference(). (stmt_nocomp): Call grokparm() on @catch parameter. (objcdef): Move semantic action to objc_finish_implementation(). (classdef): Move semantic action to objc_start_class_interface(), objc_continue_interface(), objc_finish_interface(), objc_start_class_implementation(), objc_continue_implementation(), objc_start_category_interface() and objc_start_category_implementation(). (protocoldef): Move semantic actions to objc_start_protocol() and objc_finish_interface(). (ivar_decl_list): Remove nonterminal. (visibility_spec): Move semantic actions to objc_set_visibility(). (ivar_decls): Remove assignment to $$. (ivar_decl): Rephrase in terms of component_decl; call objc_add_instance_variable(). (ivars, ivar_declarator): Remove nonterminals. (opt_semi): New nonterminal. (methodtype): Remove semantic actions. (methoddef): Move semantic actions to objc_set_method_type(), objc_start_method_definition() and objc_finish_method_definition(). (methodproto): Move semantic actions to objc_set_method_type() and objc_add_method_declaration(). (methoddecl): Use objc_typename instead of typename; move semantic actions to objc_build_method_signature(). (optarglist, myxdecls, mydecl, myparms, myparm): Remove nonterminals. (optparmlist): Express in terms of optparms and optellipsis. (optparms, optellipsis, objc_qual, objc_quals, objc_typename): New nonterminals. (keyworddecl): Use objc_typename instead of typename. (rid_to_yy): Mark RID_IN, RID_OUT, RID_INOUT, RID_BYCOPY, RID_BYREF and RID_ONEWAY as returning OBJC_TYPE_QUAL to yyparse(). [gcc/objc/ChangeLog] 2004-09-07 Ziemowit Laski <zlaski@apple.com> * Make-lang.in (objc/objc-parse.o): Depend on $(C_COMMON_H) instead of objc/objc-act.h. (objc/objc-act.o): Depend on $(HASHTAB_H). * objc-act.c: Include hashtab.h; in ObjC++ mode, include cp-tree.h and objcp-decl.h instead of c-tree.h. (build_module_descriptor, get_class_ivars, synth_id_with_class_suffix, error_with_ivar, gen_method_decl, gen_declaration, setup_string_decl, build_protocol_template): Adjust prototypes. (build_module_initializer_routine, start_class, continue_class, finish_class, start_method_def, objc_start_function, start_protocol, build_method_decl, objc_add_method, add_instance_variable, build_ivar_reference, is_ivar, is_private, get_super_receiver, build_selector_table_decl, objc_push_parm, objc_get_parm_info, gen_type_name, gen_type_name_0, start_var_decl, finish_var_decl, create_field_decl): New prototypes. (objc_expand_function_end, comp_method_with_proto, objc_expr_last, gen_declaration_1, gen_declarator, is_complex_decl, adorn_decl, define_decl, create_builtin_decl, gen_declspecs): Remove prototypes. (TYPE_ID): Rename to OBJECT_TYPEDEF_NAME. (CLASS_TYPEDEF_NAME): New. (TAG_EXECCLASS): Change from a global variable to a #define. (TAG_RETURN_STRUCT): Delete. (TAG_GNUINIT): New, holds '__objc_gnu_init' name. (objc_inherit_code, objc_public_flag): New, moved from c-parse.in. (string_descriptor): New struct. (string_htab): New hash table. (string_hash, string_eq): New prototypes. (generate_struct_by_value_array): Call create_field_decl() instead of create_builtin_decl(). (objc_init): Do not initialize objc_ellipsis_node or TAG_EXECCLASS; In ObjC++ mode, call cxx_init() instead of c_objc_common_init(). (objc_finish_file): In ObjC++, call instantiate_pending_templates() and cp_finish_file(). (define_decl, get_static_reference, get_protocol_reference, create_builtin_decl): Remove functions. (objc_start_class_interface, objc_start_category_interface, objc_start_protocol, objc_continue_interface, objc_finish_interface, objc_start_class_implementation, objc_start_category_implementation, objc_continue_implementation, objc_finish_implementation, objc_set_visibility, objc_set_method_type, objc_build_method_signature, objc_add_method_declaration, objc_start_method_definition, objc_add_instance_variable, objc_get_protocol_qualified_type, create_field_decl, start_var_decl, finish_var_decl): New functions. (setup_string_decl): Simplify since it is only called once. (synth_module_prologue): Call build_class_template(); predefine 'id' and 'Class' as typedefs; rename 'temp_type' to 'type'; disable debug hooks for duration of function; fix GNU runtime messenger signatures to correspond to reality; forward-declare '__objc_exec_class' for the GNU runtime; call build_selector_table_decl(); in ObjC++ mode, generate 'extern "C" { ... }' wrappers around synthesized declarations; call build_protocol_template() and build_category_template(). (string_hash, string_eq): New functions. (objc_build_string_object): Check metaclass correctness only once; store string literals in hash table. (objc_build_constructor): Do not convert initializer elements; adjust for ObjC++ impedance mismatch. (build_objc_symtab_template): Call create_field_decl() instead of create_builtin_decl(). (init_objc_symtab): Add missing conversion to initializer element. (build_metadata_decl): Call start_var_decl() instead of define_decl(). (generate_objc_symtab_decl): Do not call build_category_template(); call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(). (build_module_descriptor): Call create_field_decl() instead of grokfield(); call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(); always mark module descriptor as used; move GNU runtime-specific functionality to build_module_initializer_routine(). (build_module_initializer_routine): New function, broken off of build_module_descriptor(). (objc_static_init_needed_p, objc_generate_static_init_call): New functions. (generate_static_references, generate_strings, build_selector_translation_table, generate_descriptor_table, generate_ivars_list, generate_dispatch_table, generate_category): Call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(); build a type directly instead of via groktypename(). (build_selector_reference_decl, build_selector_table_decl, build_class_reference_decl, build_protocol_reference, generate_objc_image_info): Call start_var_decl() instead of build_decl(). (build_selector_reference): For GNU runtime, do not call build_selector_reference_decl(). (build_selector, build_typed_selector_reference): Always convert result to the selector type. (add_objc_string): Cast return value to 'char *'. (build_method_prototype_template, build_selector_template, build_method_template): Use actual selector type for fields pointing to selectors. (finish_objc): For GNU runtime, call build_module_initializer_routine() after build_module_descriptor(). (generate_protocol_list, generate_shared_structures): Call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(); build a type directly instead of via groktypename(). (synth_id_with_class_suffix): Return a string. (get_arg_type_list): For instance methods, use the instance type for 'self'; do not call groktypename_in_parm_context(). (build_objc_string_decl): Squash redeclaration errors in ObjC++. (objc_is_class_name): Use OBJC_TYPE_NAME instead of TYPE_NAME; handle RECORD_TYPEs in ObjC as well as ObjC++. (objc_is_id): New function. (objc_is_object_ptr): Return the canonical type node. (objc_get_class_ivars): Simplify using get_class_ivars(). (get_class_ivars): Remove second parameter; create a fresh copy of the ivar list for each call; do not check for existence of super class. (objc_eh_runtime_type): Mark #ifndef OBJCPLUS. (objc_init_exceptions): When using SJLJ-style exceptions, require the use of '-fobjc-exceptions' flag; do not require it for DWARF-style exceptions. (objc_build_exc_ptr, next_sjlj_build_try_catch_finally): Use objc_object_type instead of objc_id_type. (objc_begin_catch_clause): Convert the incoming PARM_DECL into a VAR_DECL before placing it in the appropriate scope; do not call define_decl(); adjust call to c_begin_compound_stmt(); use objc_object_type instead of objc_id_type. (build_next_objc_exception_stuff): Call create_field_decl() instead of create_builtin_decl(); construct type directly instead of calling groktypename(); use OBJC_VOID_AT_END to mark end of function parameters. (build_private_template): Adjust call to get_class_ivars(); build a type directly instead of via groktypename(). (build_protocol_template, build_method_prototype_list_template, build_method_prototype_template, build_category_template, build_selector_template, build_class_template, build_super_template, build_ivar_template, build_ivar_list_template, build_method_list_template, build_method_template): Call create_field_decl() instead of grokfield(). (objc_method_parm_type): Do not call groktypename(). (generate_descriptor_table): Call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(). (generate_method_descriptors, build_protocol_initializer, generate_dispatch_tables, build_category_initializer, build_shared_structure_initializer): Do not call groktypename(). (generate_protocols): Call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(); do not call groktypename(). (error_with_ivar): Remove last parameter. (check_ivars): Do not iterate ovar CLASS_RAW_IVARS lists in addition to CLASS_IVARS lists; adjust calls to error_with_ivar(). (generate_ivar_lists): Convert one of the initializer elements; do not call groktypename(). (get_arg_type_list, start_method_def, gen_method_def): Account for new representation of variable arguments and '...' in Objective-C methods; add Objective-C++ impedance matching code. (is_objc_type_qualifier): Remove function. (adjust_type_for_id_default): Simplify; there is no longer a need to wade through declspecs. (lookup_interface, start_class, continue_class, finish_class, start_method_def, start_protocol, build_method_decl, objc_add_method, add_instance_variable, build_ivar_reference, is_ivar, is_private, get_super_receiver, objc_build_finally_epilogue): Make into static functions. (receiver_is_class_object): Use new IS_CLASS() macro. (objc_build_message_expr): Tweak ObjC++ message argument handling; call objc_finish_message_expr() instead of finish_message_expr(). (finish_message_expr): Rename to objc_finish_message_expr(); use OBJC_TYPE_NAME and OBJC_SET_TYPE_NAME macros instead of TYPE_NAME. call gen_type_name() instead of gen_declaration(); call objc_is_id() instead of using IS_ID and IS_CLASS; Use objc_class_name instead of calling get_identifier("Class"); handle CONVERT_EXPRs in receiver. (build_objc_method_call, warn_with_method): Do not call groktypename(). (build_ivar_reference): Call convert() instead of clobbering in a type. (hash_init): Initialize string_htab hash table. (add_instance_variable): Simplify parameter list; do not call grokfield(); do not populate CLASS_IVARS list. (start_class): Check for the existence of super class, if one was specified. (continue_class): Use CLASS_RAW_IVARS rather than CLASS_IVARS; do not call build_class_template(); adjust call to get_class_ivars(); call build_decl(), pushdecl() and finish_decl() instead of define_decl(). (finish_class): Call build_decl(), pushdecl() and finish_decl() instead of define_decl(). (add_protocols): Use PROTOCOL_BINFO_ELTS for the tree vector size. (start_protocol): Do not call build_protocol_template(); use PROTOCOL_BINFO_ELTS for the tree vector size. (encode_type_qualifiers): Do not handle the 'const' qualifier here. (encode_pointer): Encode 'const char *' as 'r*', for backwards compatibility. (encode_array): Use HOST_WIDE_INT_PRINT_DEC instead of "%ld". (encode_type): Handle the 'const' qualifier here. (objc_parmlist): New global variable, sued by objc_push_parm and objc_get_parm_info(). (objc_push_parm, objc_get_parm_info): New functions. (objc_expr_last): Remove function. (synth_self_and_ucmd_args): For instance methods, use the instance type for 'self'; call objc_push_parm() instead of push_parm_decl(). (start_method_def): Do not call push_scope(), declare_parm_level(), pop_scope(), push_parm_decl(), store_parm_decls() or objc_expr_last(); just use objc_push_parm() and objc_get_parm_info(). (comp_method_with_proto): Remove function. (objc_types_are_equivalent): Strip away indirections before comparing underlying types. (comp_proto_with_proto): Do not call groktypename(); types are no longer in raw declspec format. (objc_start_function): New function. (really_start_method): Call comp_proto_with_proto() instead of comp_method_with_proto(); call objc_start_function() instead of hand-crafting a function declarator. (continue_method_def, objc_expand_function_end): Remove functions. (get_super_receiver): Call objc_get_current_scope() instead of get_current_scope(); reference 'super_class' field (instead of 'class'). (finish_method_def): Rename to objc_finish_method_definition() and add a function decl parameter; move method encoding call from objc_expand_function_end(). (is_complex_decl, adorn_decl, gen_declarator, gen_declspecs, gen_declaration_1): Remove functions. (tmpbuf, RAW_DECLSPEC): Remove. (gen_declaration): Remove second parameter; simplify to deal with TYPE_P nodes instead of raw declspecs. (gen_type_name, gen_type_name_0): New functions. (gen_method_decl): Remove second parameter; call gen_type_name() instead of gen_declaration_1(). (dump_interface): Adjust calls to gen_declaration() and gen_method_decl(); do not allocate a separate string buffer. (init_objc): Allocate a larger string buffer to accommodate dump_interface(); adjust call to build_module_descriptor(); add call to build_module_initializer_routine() for the GNU runtime. (generate_classref_translation_entry): Do not call start_decl(); call finish_var_decl() instead of finish_decl(); call convert() instead of build_c_cast(). * objc-act.h (CLASS_OWN_IVARS): Remove accessor. (CLASS_BINFO_ELTS): Reduce from 6 to 5, now that CLASS_OWN_IVARS is gone. (OCTI_GNU_INIT_DECL, GNU_INIT_decl): New. (OCTI_ELLIPSIS_NODE, objc_ellipsis_node): Remove. (OCTI_ID_ID, id_type, objc_id_id): Rename to OCTI_ID_NAME, objc_object_type and objc_object_name, respectively. (OCTI_CLS_REF, OCTI_CLASS_NAME, objc_class_reference, objc_class_name): New. (IS_CLASS): New macro. (IS_ID, IS_SUPER): Robustify. (OCTI_EXECCLASS_DECL, execclass_decl): New. (finish_file, start_class, continue_class, finish_class, start_method_def, continue_method_def, finish_method_def, start_protocol, finish_protocol, objc_build_throw_stmt, objc_build_try_catch_finally_stmt, objc_build_synchronized_prologue, objc_build_synchronized_epilogue, objc_build_try_prologue, objc_build_try_epilogue, objc_build_catch_stmt, objc_build_catch_epilogue, objc_build_finally_prologue, objc_build_finally_epilogue, is_ivar, is_private, is_public, add_instance_variable, objc_add_method, get_super_receiver, objc_clear_super_receiver, get_class_ivars_from_name, get_class_reference, get_static_reference, get_object_reference, build_message_expr, finish_message_expr, build_selector_expr, build_ivar_reference, build_keyword_decl, build_method_decl, build_protocol_expr, build_objc_string_object, objc_declare_alias, objc_declare_class, objc_declare_protocols, objc_comptypes, objc_check_decl, build_encode_expr): Remove prototypes. (imp_count, cat_count): Make GGC-aware. (OBJC_SET_TYPE_NAME): New macro. From-SVN: r87168
2004-09-08 02:49:44 +02:00
objc_category_template);
1992-01-18 00:15:38 +01:00
}
}
c-parse.in (objc_inherit_code, [...]): Make static. 2001-10-03 Ziemowit Laski <zlaski@apple.com> * c-parse.in (objc_inherit_code, objc_pq_context, objc_public_flag): Make static. (objc_interface_context, objc_implementation_context, objc_method_context, objc_ivar_chain, objc_ivar_context): Move to global tree array in objc/objc-act.[ch]. (methoddef): Remove unnecessary code. * objc/objc-act.c: (hashed_attribute, hashed_entry, imp_entry): Hoist struct definitions to objc-act.h. (nst_method_hash_list, cls_method_hash_list, imp_list, imp_count, cat_count): Place declaration in objc-act.h. (objc_tree_index): Move enumeration to objc-act.h. (objc_global_trees): Place declaration and macro accessors in objc-act.h. (implementation_context): Remove duplicate; use objc_implementation_context instead: (method_context): Remove duplicate; use objc_method_context instead. (objc_ellipsis_node, objc_method_prototype_template, implemented_classes, function_type): Move global vars to objc_global_trees. (init_objc): Use LAST_BASE_TREE_CODE instead of LAST_CODE. (build_message_expr): Move actual construction of ObjC message send nodes to finish_message_expr. (finish_message_expr): New routine, contains code formerly in build_message_expr. * objc/objc-act.h (finish_message_expr): New prototype. (objc_ivar_chain, objc_method_context, objc_ellipsis_node): Remove declarations; these vars are now part of objc_global_trees. (objc_tree_index, objc_global_trees): Move definitions from objc-act.c. * objc/objc-tree.def: Update copyright info. From-SVN: r46000
2001-10-04 00:05:57 +02:00
objc_implementation_context = sav;
1992-01-18 00:15:38 +01:00
}
/* Create the declaration of _OBJC_SYMBOLS, with type `struct _objc_symtab'
and initialized appropriately. */
1992-01-18 00:15:38 +01:00
static void
generate_objc_symtab_decl (void)
1992-01-18 00:15:38 +01:00
{
/* forward declare categories */
if (cat_count)
forward_declare_categories ();
Makefile.in (c-parse.o): Depend on $(C_COMMON_H). [gcc/ChangeLog] 2004-09-07 Ziemowit Laski <zlaski@apple.com> * Makefile.in (c-parse.o): Depend on $(C_COMMON_H). * c-parse.in: Include c-common.h instead of objc-act.h. (ivar_decl_list, ivar_decls, ivar_decl, ivars, ivar_declarator, myparms, myparm): Remove %type declarations. (methodtype, optparms, OBJC_TYPE_QUAL, objc_quals, objc_qual, objc_typename, objc_try_catch_stmt, optellipsis): Add %type declarations. (objc_inherit_code, objc_public_flag): Remove. (typespec_nonreserved_nonattr): Call objc_get_protocol_qualified_type() instead of get_static_reference() and get_protocol_reference(). (stmt_nocomp): Call grokparm() on @catch parameter. (objcdef): Move semantic action to objc_finish_implementation(). (classdef): Move semantic action to objc_start_class_interface(), objc_continue_interface(), objc_finish_interface(), objc_start_class_implementation(), objc_continue_implementation(), objc_start_category_interface() and objc_start_category_implementation(). (protocoldef): Move semantic actions to objc_start_protocol() and objc_finish_interface(). (ivar_decl_list): Remove nonterminal. (visibility_spec): Move semantic actions to objc_set_visibility(). (ivar_decls): Remove assignment to $$. (ivar_decl): Rephrase in terms of component_decl; call objc_add_instance_variable(). (ivars, ivar_declarator): Remove nonterminals. (opt_semi): New nonterminal. (methodtype): Remove semantic actions. (methoddef): Move semantic actions to objc_set_method_type(), objc_start_method_definition() and objc_finish_method_definition(). (methodproto): Move semantic actions to objc_set_method_type() and objc_add_method_declaration(). (methoddecl): Use objc_typename instead of typename; move semantic actions to objc_build_method_signature(). (optarglist, myxdecls, mydecl, myparms, myparm): Remove nonterminals. (optparmlist): Express in terms of optparms and optellipsis. (optparms, optellipsis, objc_qual, objc_quals, objc_typename): New nonterminals. (keyworddecl): Use objc_typename instead of typename. (rid_to_yy): Mark RID_IN, RID_OUT, RID_INOUT, RID_BYCOPY, RID_BYREF and RID_ONEWAY as returning OBJC_TYPE_QUAL to yyparse(). [gcc/objc/ChangeLog] 2004-09-07 Ziemowit Laski <zlaski@apple.com> * Make-lang.in (objc/objc-parse.o): Depend on $(C_COMMON_H) instead of objc/objc-act.h. (objc/objc-act.o): Depend on $(HASHTAB_H). * objc-act.c: Include hashtab.h; in ObjC++ mode, include cp-tree.h and objcp-decl.h instead of c-tree.h. (build_module_descriptor, get_class_ivars, synth_id_with_class_suffix, error_with_ivar, gen_method_decl, gen_declaration, setup_string_decl, build_protocol_template): Adjust prototypes. (build_module_initializer_routine, start_class, continue_class, finish_class, start_method_def, objc_start_function, start_protocol, build_method_decl, objc_add_method, add_instance_variable, build_ivar_reference, is_ivar, is_private, get_super_receiver, build_selector_table_decl, objc_push_parm, objc_get_parm_info, gen_type_name, gen_type_name_0, start_var_decl, finish_var_decl, create_field_decl): New prototypes. (objc_expand_function_end, comp_method_with_proto, objc_expr_last, gen_declaration_1, gen_declarator, is_complex_decl, adorn_decl, define_decl, create_builtin_decl, gen_declspecs): Remove prototypes. (TYPE_ID): Rename to OBJECT_TYPEDEF_NAME. (CLASS_TYPEDEF_NAME): New. (TAG_EXECCLASS): Change from a global variable to a #define. (TAG_RETURN_STRUCT): Delete. (TAG_GNUINIT): New, holds '__objc_gnu_init' name. (objc_inherit_code, objc_public_flag): New, moved from c-parse.in. (string_descriptor): New struct. (string_htab): New hash table. (string_hash, string_eq): New prototypes. (generate_struct_by_value_array): Call create_field_decl() instead of create_builtin_decl(). (objc_init): Do not initialize objc_ellipsis_node or TAG_EXECCLASS; In ObjC++ mode, call cxx_init() instead of c_objc_common_init(). (objc_finish_file): In ObjC++, call instantiate_pending_templates() and cp_finish_file(). (define_decl, get_static_reference, get_protocol_reference, create_builtin_decl): Remove functions. (objc_start_class_interface, objc_start_category_interface, objc_start_protocol, objc_continue_interface, objc_finish_interface, objc_start_class_implementation, objc_start_category_implementation, objc_continue_implementation, objc_finish_implementation, objc_set_visibility, objc_set_method_type, objc_build_method_signature, objc_add_method_declaration, objc_start_method_definition, objc_add_instance_variable, objc_get_protocol_qualified_type, create_field_decl, start_var_decl, finish_var_decl): New functions. (setup_string_decl): Simplify since it is only called once. (synth_module_prologue): Call build_class_template(); predefine 'id' and 'Class' as typedefs; rename 'temp_type' to 'type'; disable debug hooks for duration of function; fix GNU runtime messenger signatures to correspond to reality; forward-declare '__objc_exec_class' for the GNU runtime; call build_selector_table_decl(); in ObjC++ mode, generate 'extern "C" { ... }' wrappers around synthesized declarations; call build_protocol_template() and build_category_template(). (string_hash, string_eq): New functions. (objc_build_string_object): Check metaclass correctness only once; store string literals in hash table. (objc_build_constructor): Do not convert initializer elements; adjust for ObjC++ impedance mismatch. (build_objc_symtab_template): Call create_field_decl() instead of create_builtin_decl(). (init_objc_symtab): Add missing conversion to initializer element. (build_metadata_decl): Call start_var_decl() instead of define_decl(). (generate_objc_symtab_decl): Do not call build_category_template(); call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(). (build_module_descriptor): Call create_field_decl() instead of grokfield(); call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(); always mark module descriptor as used; move GNU runtime-specific functionality to build_module_initializer_routine(). (build_module_initializer_routine): New function, broken off of build_module_descriptor(). (objc_static_init_needed_p, objc_generate_static_init_call): New functions. (generate_static_references, generate_strings, build_selector_translation_table, generate_descriptor_table, generate_ivars_list, generate_dispatch_table, generate_category): Call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(); build a type directly instead of via groktypename(). (build_selector_reference_decl, build_selector_table_decl, build_class_reference_decl, build_protocol_reference, generate_objc_image_info): Call start_var_decl() instead of build_decl(). (build_selector_reference): For GNU runtime, do not call build_selector_reference_decl(). (build_selector, build_typed_selector_reference): Always convert result to the selector type. (add_objc_string): Cast return value to 'char *'. (build_method_prototype_template, build_selector_template, build_method_template): Use actual selector type for fields pointing to selectors. (finish_objc): For GNU runtime, call build_module_initializer_routine() after build_module_descriptor(). (generate_protocol_list, generate_shared_structures): Call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(); build a type directly instead of via groktypename(). (synth_id_with_class_suffix): Return a string. (get_arg_type_list): For instance methods, use the instance type for 'self'; do not call groktypename_in_parm_context(). (build_objc_string_decl): Squash redeclaration errors in ObjC++. (objc_is_class_name): Use OBJC_TYPE_NAME instead of TYPE_NAME; handle RECORD_TYPEs in ObjC as well as ObjC++. (objc_is_id): New function. (objc_is_object_ptr): Return the canonical type node. (objc_get_class_ivars): Simplify using get_class_ivars(). (get_class_ivars): Remove second parameter; create a fresh copy of the ivar list for each call; do not check for existence of super class. (objc_eh_runtime_type): Mark #ifndef OBJCPLUS. (objc_init_exceptions): When using SJLJ-style exceptions, require the use of '-fobjc-exceptions' flag; do not require it for DWARF-style exceptions. (objc_build_exc_ptr, next_sjlj_build_try_catch_finally): Use objc_object_type instead of objc_id_type. (objc_begin_catch_clause): Convert the incoming PARM_DECL into a VAR_DECL before placing it in the appropriate scope; do not call define_decl(); adjust call to c_begin_compound_stmt(); use objc_object_type instead of objc_id_type. (build_next_objc_exception_stuff): Call create_field_decl() instead of create_builtin_decl(); construct type directly instead of calling groktypename(); use OBJC_VOID_AT_END to mark end of function parameters. (build_private_template): Adjust call to get_class_ivars(); build a type directly instead of via groktypename(). (build_protocol_template, build_method_prototype_list_template, build_method_prototype_template, build_category_template, build_selector_template, build_class_template, build_super_template, build_ivar_template, build_ivar_list_template, build_method_list_template, build_method_template): Call create_field_decl() instead of grokfield(). (objc_method_parm_type): Do not call groktypename(). (generate_descriptor_table): Call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(). (generate_method_descriptors, build_protocol_initializer, generate_dispatch_tables, build_category_initializer, build_shared_structure_initializer): Do not call groktypename(). (generate_protocols): Call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(); do not call groktypename(). (error_with_ivar): Remove last parameter. (check_ivars): Do not iterate ovar CLASS_RAW_IVARS lists in addition to CLASS_IVARS lists; adjust calls to error_with_ivar(). (generate_ivar_lists): Convert one of the initializer elements; do not call groktypename(). (get_arg_type_list, start_method_def, gen_method_def): Account for new representation of variable arguments and '...' in Objective-C methods; add Objective-C++ impedance matching code. (is_objc_type_qualifier): Remove function. (adjust_type_for_id_default): Simplify; there is no longer a need to wade through declspecs. (lookup_interface, start_class, continue_class, finish_class, start_method_def, start_protocol, build_method_decl, objc_add_method, add_instance_variable, build_ivar_reference, is_ivar, is_private, get_super_receiver, objc_build_finally_epilogue): Make into static functions. (receiver_is_class_object): Use new IS_CLASS() macro. (objc_build_message_expr): Tweak ObjC++ message argument handling; call objc_finish_message_expr() instead of finish_message_expr(). (finish_message_expr): Rename to objc_finish_message_expr(); use OBJC_TYPE_NAME and OBJC_SET_TYPE_NAME macros instead of TYPE_NAME. call gen_type_name() instead of gen_declaration(); call objc_is_id() instead of using IS_ID and IS_CLASS; Use objc_class_name instead of calling get_identifier("Class"); handle CONVERT_EXPRs in receiver. (build_objc_method_call, warn_with_method): Do not call groktypename(). (build_ivar_reference): Call convert() instead of clobbering in a type. (hash_init): Initialize string_htab hash table. (add_instance_variable): Simplify parameter list; do not call grokfield(); do not populate CLASS_IVARS list. (start_class): Check for the existence of super class, if one was specified. (continue_class): Use CLASS_RAW_IVARS rather than CLASS_IVARS; do not call build_class_template(); adjust call to get_class_ivars(); call build_decl(), pushdecl() and finish_decl() instead of define_decl(). (finish_class): Call build_decl(), pushdecl() and finish_decl() instead of define_decl(). (add_protocols): Use PROTOCOL_BINFO_ELTS for the tree vector size. (start_protocol): Do not call build_protocol_template(); use PROTOCOL_BINFO_ELTS for the tree vector size. (encode_type_qualifiers): Do not handle the 'const' qualifier here. (encode_pointer): Encode 'const char *' as 'r*', for backwards compatibility. (encode_array): Use HOST_WIDE_INT_PRINT_DEC instead of "%ld". (encode_type): Handle the 'const' qualifier here. (objc_parmlist): New global variable, sued by objc_push_parm and objc_get_parm_info(). (objc_push_parm, objc_get_parm_info): New functions. (objc_expr_last): Remove function. (synth_self_and_ucmd_args): For instance methods, use the instance type for 'self'; call objc_push_parm() instead of push_parm_decl(). (start_method_def): Do not call push_scope(), declare_parm_level(), pop_scope(), push_parm_decl(), store_parm_decls() or objc_expr_last(); just use objc_push_parm() and objc_get_parm_info(). (comp_method_with_proto): Remove function. (objc_types_are_equivalent): Strip away indirections before comparing underlying types. (comp_proto_with_proto): Do not call groktypename(); types are no longer in raw declspec format. (objc_start_function): New function. (really_start_method): Call comp_proto_with_proto() instead of comp_method_with_proto(); call objc_start_function() instead of hand-crafting a function declarator. (continue_method_def, objc_expand_function_end): Remove functions. (get_super_receiver): Call objc_get_current_scope() instead of get_current_scope(); reference 'super_class' field (instead of 'class'). (finish_method_def): Rename to objc_finish_method_definition() and add a function decl parameter; move method encoding call from objc_expand_function_end(). (is_complex_decl, adorn_decl, gen_declarator, gen_declspecs, gen_declaration_1): Remove functions. (tmpbuf, RAW_DECLSPEC): Remove. (gen_declaration): Remove second parameter; simplify to deal with TYPE_P nodes instead of raw declspecs. (gen_type_name, gen_type_name_0): New functions. (gen_method_decl): Remove second parameter; call gen_type_name() instead of gen_declaration_1(). (dump_interface): Adjust calls to gen_declaration() and gen_method_decl(); do not allocate a separate string buffer. (init_objc): Allocate a larger string buffer to accommodate dump_interface(); adjust call to build_module_descriptor(); add call to build_module_initializer_routine() for the GNU runtime. (generate_classref_translation_entry): Do not call start_decl(); call finish_var_decl() instead of finish_decl(); call convert() instead of build_c_cast(). * objc-act.h (CLASS_OWN_IVARS): Remove accessor. (CLASS_BINFO_ELTS): Reduce from 6 to 5, now that CLASS_OWN_IVARS is gone. (OCTI_GNU_INIT_DECL, GNU_INIT_decl): New. (OCTI_ELLIPSIS_NODE, objc_ellipsis_node): Remove. (OCTI_ID_ID, id_type, objc_id_id): Rename to OCTI_ID_NAME, objc_object_type and objc_object_name, respectively. (OCTI_CLS_REF, OCTI_CLASS_NAME, objc_class_reference, objc_class_name): New. (IS_CLASS): New macro. (IS_ID, IS_SUPER): Robustify. (OCTI_EXECCLASS_DECL, execclass_decl): New. (finish_file, start_class, continue_class, finish_class, start_method_def, continue_method_def, finish_method_def, start_protocol, finish_protocol, objc_build_throw_stmt, objc_build_try_catch_finally_stmt, objc_build_synchronized_prologue, objc_build_synchronized_epilogue, objc_build_try_prologue, objc_build_try_epilogue, objc_build_catch_stmt, objc_build_catch_epilogue, objc_build_finally_prologue, objc_build_finally_epilogue, is_ivar, is_private, is_public, add_instance_variable, objc_add_method, get_super_receiver, objc_clear_super_receiver, get_class_ivars_from_name, get_class_reference, get_static_reference, get_object_reference, build_message_expr, finish_message_expr, build_selector_expr, build_ivar_reference, build_keyword_decl, build_method_decl, build_protocol_expr, build_objc_string_object, objc_declare_alias, objc_declare_class, objc_declare_protocols, objc_comptypes, objc_check_decl, build_encode_expr): Remove prototypes. (imp_count, cat_count): Make GGC-aware. (OBJC_SET_TYPE_NAME): New macro. From-SVN: r87168
2004-09-08 02:49:44 +02:00
build_objc_symtab_template ();
UOBJC_SYMBOLS_decl = start_var_decl (objc_symtab_template, "_OBJC_SYMBOLS");
finish_var_decl (UOBJC_SYMBOLS_decl,
init_objc_symtab (TREE_TYPE (UOBJC_SYMBOLS_decl)));
1992-01-18 00:15:38 +01:00
}
1992-01-18 00:15:38 +01:00
static tree
init_module_descriptor (tree type)
1992-01-18 00:15:38 +01:00
{
tree initlist, expr;
/* version = { 1, ... } */
expr = build_int_cst (long_integer_type_node, OBJC_VERSION);
initlist = build_tree_list (NULL_TREE, expr);
1992-01-18 00:15:38 +01:00
Makefile.in (c-parse.o): Depend on $(C_COMMON_H). [gcc/ChangeLog] 2004-09-07 Ziemowit Laski <zlaski@apple.com> * Makefile.in (c-parse.o): Depend on $(C_COMMON_H). * c-parse.in: Include c-common.h instead of objc-act.h. (ivar_decl_list, ivar_decls, ivar_decl, ivars, ivar_declarator, myparms, myparm): Remove %type declarations. (methodtype, optparms, OBJC_TYPE_QUAL, objc_quals, objc_qual, objc_typename, objc_try_catch_stmt, optellipsis): Add %type declarations. (objc_inherit_code, objc_public_flag): Remove. (typespec_nonreserved_nonattr): Call objc_get_protocol_qualified_type() instead of get_static_reference() and get_protocol_reference(). (stmt_nocomp): Call grokparm() on @catch parameter. (objcdef): Move semantic action to objc_finish_implementation(). (classdef): Move semantic action to objc_start_class_interface(), objc_continue_interface(), objc_finish_interface(), objc_start_class_implementation(), objc_continue_implementation(), objc_start_category_interface() and objc_start_category_implementation(). (protocoldef): Move semantic actions to objc_start_protocol() and objc_finish_interface(). (ivar_decl_list): Remove nonterminal. (visibility_spec): Move semantic actions to objc_set_visibility(). (ivar_decls): Remove assignment to $$. (ivar_decl): Rephrase in terms of component_decl; call objc_add_instance_variable(). (ivars, ivar_declarator): Remove nonterminals. (opt_semi): New nonterminal. (methodtype): Remove semantic actions. (methoddef): Move semantic actions to objc_set_method_type(), objc_start_method_definition() and objc_finish_method_definition(). (methodproto): Move semantic actions to objc_set_method_type() and objc_add_method_declaration(). (methoddecl): Use objc_typename instead of typename; move semantic actions to objc_build_method_signature(). (optarglist, myxdecls, mydecl, myparms, myparm): Remove nonterminals. (optparmlist): Express in terms of optparms and optellipsis. (optparms, optellipsis, objc_qual, objc_quals, objc_typename): New nonterminals. (keyworddecl): Use objc_typename instead of typename. (rid_to_yy): Mark RID_IN, RID_OUT, RID_INOUT, RID_BYCOPY, RID_BYREF and RID_ONEWAY as returning OBJC_TYPE_QUAL to yyparse(). [gcc/objc/ChangeLog] 2004-09-07 Ziemowit Laski <zlaski@apple.com> * Make-lang.in (objc/objc-parse.o): Depend on $(C_COMMON_H) instead of objc/objc-act.h. (objc/objc-act.o): Depend on $(HASHTAB_H). * objc-act.c: Include hashtab.h; in ObjC++ mode, include cp-tree.h and objcp-decl.h instead of c-tree.h. (build_module_descriptor, get_class_ivars, synth_id_with_class_suffix, error_with_ivar, gen_method_decl, gen_declaration, setup_string_decl, build_protocol_template): Adjust prototypes. (build_module_initializer_routine, start_class, continue_class, finish_class, start_method_def, objc_start_function, start_protocol, build_method_decl, objc_add_method, add_instance_variable, build_ivar_reference, is_ivar, is_private, get_super_receiver, build_selector_table_decl, objc_push_parm, objc_get_parm_info, gen_type_name, gen_type_name_0, start_var_decl, finish_var_decl, create_field_decl): New prototypes. (objc_expand_function_end, comp_method_with_proto, objc_expr_last, gen_declaration_1, gen_declarator, is_complex_decl, adorn_decl, define_decl, create_builtin_decl, gen_declspecs): Remove prototypes. (TYPE_ID): Rename to OBJECT_TYPEDEF_NAME. (CLASS_TYPEDEF_NAME): New. (TAG_EXECCLASS): Change from a global variable to a #define. (TAG_RETURN_STRUCT): Delete. (TAG_GNUINIT): New, holds '__objc_gnu_init' name. (objc_inherit_code, objc_public_flag): New, moved from c-parse.in. (string_descriptor): New struct. (string_htab): New hash table. (string_hash, string_eq): New prototypes. (generate_struct_by_value_array): Call create_field_decl() instead of create_builtin_decl(). (objc_init): Do not initialize objc_ellipsis_node or TAG_EXECCLASS; In ObjC++ mode, call cxx_init() instead of c_objc_common_init(). (objc_finish_file): In ObjC++, call instantiate_pending_templates() and cp_finish_file(). (define_decl, get_static_reference, get_protocol_reference, create_builtin_decl): Remove functions. (objc_start_class_interface, objc_start_category_interface, objc_start_protocol, objc_continue_interface, objc_finish_interface, objc_start_class_implementation, objc_start_category_implementation, objc_continue_implementation, objc_finish_implementation, objc_set_visibility, objc_set_method_type, objc_build_method_signature, objc_add_method_declaration, objc_start_method_definition, objc_add_instance_variable, objc_get_protocol_qualified_type, create_field_decl, start_var_decl, finish_var_decl): New functions. (setup_string_decl): Simplify since it is only called once. (synth_module_prologue): Call build_class_template(); predefine 'id' and 'Class' as typedefs; rename 'temp_type' to 'type'; disable debug hooks for duration of function; fix GNU runtime messenger signatures to correspond to reality; forward-declare '__objc_exec_class' for the GNU runtime; call build_selector_table_decl(); in ObjC++ mode, generate 'extern "C" { ... }' wrappers around synthesized declarations; call build_protocol_template() and build_category_template(). (string_hash, string_eq): New functions. (objc_build_string_object): Check metaclass correctness only once; store string literals in hash table. (objc_build_constructor): Do not convert initializer elements; adjust for ObjC++ impedance mismatch. (build_objc_symtab_template): Call create_field_decl() instead of create_builtin_decl(). (init_objc_symtab): Add missing conversion to initializer element. (build_metadata_decl): Call start_var_decl() instead of define_decl(). (generate_objc_symtab_decl): Do not call build_category_template(); call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(). (build_module_descriptor): Call create_field_decl() instead of grokfield(); call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(); always mark module descriptor as used; move GNU runtime-specific functionality to build_module_initializer_routine(). (build_module_initializer_routine): New function, broken off of build_module_descriptor(). (objc_static_init_needed_p, objc_generate_static_init_call): New functions. (generate_static_references, generate_strings, build_selector_translation_table, generate_descriptor_table, generate_ivars_list, generate_dispatch_table, generate_category): Call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(); build a type directly instead of via groktypename(). (build_selector_reference_decl, build_selector_table_decl, build_class_reference_decl, build_protocol_reference, generate_objc_image_info): Call start_var_decl() instead of build_decl(). (build_selector_reference): For GNU runtime, do not call build_selector_reference_decl(). (build_selector, build_typed_selector_reference): Always convert result to the selector type. (add_objc_string): Cast return value to 'char *'. (build_method_prototype_template, build_selector_template, build_method_template): Use actual selector type for fields pointing to selectors. (finish_objc): For GNU runtime, call build_module_initializer_routine() after build_module_descriptor(). (generate_protocol_list, generate_shared_structures): Call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(); build a type directly instead of via groktypename(). (synth_id_with_class_suffix): Return a string. (get_arg_type_list): For instance methods, use the instance type for 'self'; do not call groktypename_in_parm_context(). (build_objc_string_decl): Squash redeclaration errors in ObjC++. (objc_is_class_name): Use OBJC_TYPE_NAME instead of TYPE_NAME; handle RECORD_TYPEs in ObjC as well as ObjC++. (objc_is_id): New function. (objc_is_object_ptr): Return the canonical type node. (objc_get_class_ivars): Simplify using get_class_ivars(). (get_class_ivars): Remove second parameter; create a fresh copy of the ivar list for each call; do not check for existence of super class. (objc_eh_runtime_type): Mark #ifndef OBJCPLUS. (objc_init_exceptions): When using SJLJ-style exceptions, require the use of '-fobjc-exceptions' flag; do not require it for DWARF-style exceptions. (objc_build_exc_ptr, next_sjlj_build_try_catch_finally): Use objc_object_type instead of objc_id_type. (objc_begin_catch_clause): Convert the incoming PARM_DECL into a VAR_DECL before placing it in the appropriate scope; do not call define_decl(); adjust call to c_begin_compound_stmt(); use objc_object_type instead of objc_id_type. (build_next_objc_exception_stuff): Call create_field_decl() instead of create_builtin_decl(); construct type directly instead of calling groktypename(); use OBJC_VOID_AT_END to mark end of function parameters. (build_private_template): Adjust call to get_class_ivars(); build a type directly instead of via groktypename(). (build_protocol_template, build_method_prototype_list_template, build_method_prototype_template, build_category_template, build_selector_template, build_class_template, build_super_template, build_ivar_template, build_ivar_list_template, build_method_list_template, build_method_template): Call create_field_decl() instead of grokfield(). (objc_method_parm_type): Do not call groktypename(). (generate_descriptor_table): Call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(). (generate_method_descriptors, build_protocol_initializer, generate_dispatch_tables, build_category_initializer, build_shared_structure_initializer): Do not call groktypename(). (generate_protocols): Call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(); do not call groktypename(). (error_with_ivar): Remove last parameter. (check_ivars): Do not iterate ovar CLASS_RAW_IVARS lists in addition to CLASS_IVARS lists; adjust calls to error_with_ivar(). (generate_ivar_lists): Convert one of the initializer elements; do not call groktypename(). (get_arg_type_list, start_method_def, gen_method_def): Account for new representation of variable arguments and '...' in Objective-C methods; add Objective-C++ impedance matching code. (is_objc_type_qualifier): Remove function. (adjust_type_for_id_default): Simplify; there is no longer a need to wade through declspecs. (lookup_interface, start_class, continue_class, finish_class, start_method_def, start_protocol, build_method_decl, objc_add_method, add_instance_variable, build_ivar_reference, is_ivar, is_private, get_super_receiver, objc_build_finally_epilogue): Make into static functions. (receiver_is_class_object): Use new IS_CLASS() macro. (objc_build_message_expr): Tweak ObjC++ message argument handling; call objc_finish_message_expr() instead of finish_message_expr(). (finish_message_expr): Rename to objc_finish_message_expr(); use OBJC_TYPE_NAME and OBJC_SET_TYPE_NAME macros instead of TYPE_NAME. call gen_type_name() instead of gen_declaration(); call objc_is_id() instead of using IS_ID and IS_CLASS; Use objc_class_name instead of calling get_identifier("Class"); handle CONVERT_EXPRs in receiver. (build_objc_method_call, warn_with_method): Do not call groktypename(). (build_ivar_reference): Call convert() instead of clobbering in a type. (hash_init): Initialize string_htab hash table. (add_instance_variable): Simplify parameter list; do not call grokfield(); do not populate CLASS_IVARS list. (start_class): Check for the existence of super class, if one was specified. (continue_class): Use CLASS_RAW_IVARS rather than CLASS_IVARS; do not call build_class_template(); adjust call to get_class_ivars(); call build_decl(), pushdecl() and finish_decl() instead of define_decl(). (finish_class): Call build_decl(), pushdecl() and finish_decl() instead of define_decl(). (add_protocols): Use PROTOCOL_BINFO_ELTS for the tree vector size. (start_protocol): Do not call build_protocol_template(); use PROTOCOL_BINFO_ELTS for the tree vector size. (encode_type_qualifiers): Do not handle the 'const' qualifier here. (encode_pointer): Encode 'const char *' as 'r*', for backwards compatibility. (encode_array): Use HOST_WIDE_INT_PRINT_DEC instead of "%ld". (encode_type): Handle the 'const' qualifier here. (objc_parmlist): New global variable, sued by objc_push_parm and objc_get_parm_info(). (objc_push_parm, objc_get_parm_info): New functions. (objc_expr_last): Remove function. (synth_self_and_ucmd_args): For instance methods, use the instance type for 'self'; call objc_push_parm() instead of push_parm_decl(). (start_method_def): Do not call push_scope(), declare_parm_level(), pop_scope(), push_parm_decl(), store_parm_decls() or objc_expr_last(); just use objc_push_parm() and objc_get_parm_info(). (comp_method_with_proto): Remove function. (objc_types_are_equivalent): Strip away indirections before comparing underlying types. (comp_proto_with_proto): Do not call groktypename(); types are no longer in raw declspec format. (objc_start_function): New function. (really_start_method): Call comp_proto_with_proto() instead of comp_method_with_proto(); call objc_start_function() instead of hand-crafting a function declarator. (continue_method_def, objc_expand_function_end): Remove functions. (get_super_receiver): Call objc_get_current_scope() instead of get_current_scope(); reference 'super_class' field (instead of 'class'). (finish_method_def): Rename to objc_finish_method_definition() and add a function decl parameter; move method encoding call from objc_expand_function_end(). (is_complex_decl, adorn_decl, gen_declarator, gen_declspecs, gen_declaration_1): Remove functions. (tmpbuf, RAW_DECLSPEC): Remove. (gen_declaration): Remove second parameter; simplify to deal with TYPE_P nodes instead of raw declspecs. (gen_type_name, gen_type_name_0): New functions. (gen_method_decl): Remove second parameter; call gen_type_name() instead of gen_declaration_1(). (dump_interface): Adjust calls to gen_declaration() and gen_method_decl(); do not allocate a separate string buffer. (init_objc): Allocate a larger string buffer to accommodate dump_interface(); adjust call to build_module_descriptor(); add call to build_module_initializer_routine() for the GNU runtime. (generate_classref_translation_entry): Do not call start_decl(); call finish_var_decl() instead of finish_decl(); call convert() instead of build_c_cast(). * objc-act.h (CLASS_OWN_IVARS): Remove accessor. (CLASS_BINFO_ELTS): Reduce from 6 to 5, now that CLASS_OWN_IVARS is gone. (OCTI_GNU_INIT_DECL, GNU_INIT_decl): New. (OCTI_ELLIPSIS_NODE, objc_ellipsis_node): Remove. (OCTI_ID_ID, id_type, objc_id_id): Rename to OCTI_ID_NAME, objc_object_type and objc_object_name, respectively. (OCTI_CLS_REF, OCTI_CLASS_NAME, objc_class_reference, objc_class_name): New. (IS_CLASS): New macro. (IS_ID, IS_SUPER): Robustify. (OCTI_EXECCLASS_DECL, execclass_decl): New. (finish_file, start_class, continue_class, finish_class, start_method_def, continue_method_def, finish_method_def, start_protocol, finish_protocol, objc_build_throw_stmt, objc_build_try_catch_finally_stmt, objc_build_synchronized_prologue, objc_build_synchronized_epilogue, objc_build_try_prologue, objc_build_try_epilogue, objc_build_catch_stmt, objc_build_catch_epilogue, objc_build_finally_prologue, objc_build_finally_epilogue, is_ivar, is_private, is_public, add_instance_variable, objc_add_method, get_super_receiver, objc_clear_super_receiver, get_class_ivars_from_name, get_class_reference, get_static_reference, get_object_reference, build_message_expr, finish_message_expr, build_selector_expr, build_ivar_reference, build_keyword_decl, build_method_decl, build_protocol_expr, build_objc_string_object, objc_declare_alias, objc_declare_class, objc_declare_protocols, objc_comptypes, objc_check_decl, build_encode_expr): Remove prototypes. (imp_count, cat_count): Make GGC-aware. (OBJC_SET_TYPE_NAME): New macro. From-SVN: r87168
2004-09-08 02:49:44 +02:00
/* size = { ..., sizeof (struct _objc_module), ... } */
1992-01-18 00:15:38 +01:00
expr = convert (long_integer_type_node,
size_in_bytes (objc_module_template));
initlist = tree_cons (NULL_TREE, expr, initlist);
1992-01-18 00:15:38 +01:00
/* Don't provide any file name for security reasons. */
/* name = { ..., "", ... } */
1992-01-18 00:15:38 +01:00
expr = add_objc_string (get_identifier (""), class_names);
initlist = tree_cons (NULL_TREE, expr, initlist);
1992-01-18 00:15:38 +01:00
/* symtab = { ..., _OBJC_SYMBOLS, ... } */
if (UOBJC_SYMBOLS_decl)
expr = build_unary_op (ADDR_EXPR, UOBJC_SYMBOLS_decl, 0);
1992-01-18 00:15:38 +01:00
else
tree.h (build_int_cst): New, sign extended constant. * tree.h (build_int_cst): New, sign extended constant. (build_int_cstu): New, zero extended constant. (build_int_cst_wide): Renamed from build_int_cst. * tree.c (build_int_cst, build_int_cstu): New. (build_int_cst_wide): Renamed from build_int_cst. (make_vector_type, build_common_tree_nodes, build_common_tree_nodes_2): Adjust build_int_cst calls. * builtins.c (expand_builtin_prefetch, expand_builtin_strstr, expand_builtin_strpbrk, expand_builtin_fputs, build_string_literal, expand_builtin_printf, expand_builtin_sprintf, fold_builtin_classify_type, fold_builtin_lround, fold_builtin_bitop, fold_builtin_isascii, fold_builtin_toascii, fold_builtin_isdigit, simplify_builtin_strstr, simplify_builtin_strpbrk, fold_builtin_fputs, simplify_builtin_sprintf): Likewise. * c-common.c (start_fname_decls, fix_string_type, shorten_compare, DEF_ATTR_INT): Likewise. * c-decl.c (complete_array_type, check_bitfield_type_and_width): Likewise. * c-lex.c (interpret_integer, lex_charconst): Likewise. * c-parse.in (primary) <TYPES_COMPATIBLE_P> Likewise. * c-pretty-print.c (pp_c_integer_constant): Likewise. * c-typeck.c (really_start_incremental_init, push_init_level, set_nonincremental_init_from_string): Likewise. * calls.c (load_register_parameters): Likewise. convert.c (convert_to_pointer): Likewise. coverage.c (coverage_counter_alloc, tree_coverage_counter_ref, build_fn_info_type, build_fn_info_value, build_ctr_info_value, build_gcov_info): Likewise. * except.c (init_eh, assign_filter_values): Likewise. * expmed.c (store_fixed_bit_field, extract_bit_field, extract_fixed_bit_field, extract_split_bit_field, expand_shift, expand_mult_const, expand_mult_highpart_adjust, extract_high_half, expand_sdiv_pow2, expand_divmod, make_tree): Likewise. * expr.c (convert_move, emit_group_load, emit_group_store, expand_assignment, store_constructor, store_field, expand_expr_real_1, reduce_to_bit_field_precision): Likewise. fold-const.c (force_fit_type, int_const_binop, fold_convert_const, invert_truthvalue, optimize_bit_field_compare, decode_field_reference, all_ones_mask_p, constant_boolean_node, fold_div_compare, fold, fold_read_from_constant_string, fold_negate_const, fold_abs_const, fold_not_const, round_up, round_down): Likewise. * function.c (assign_parm_setup_block): Likewise. * stmt.c (shift_return_value, expand_case, estimate_case_costs): Likewise. * stor-layout.c (layout_type, initialize_sizetypes, set_min_and_max_values_for_integral_type): Likewise. * tree-chrec.c (chrec_fold_multiply_poly_poly, reset_evolution_in_loop): Likewise. * tree-chrec.h (build_polynomial_chrec): Likewise. * tree-complex.c (build_replicated_const): Likewise. * tree-eh.c (honor_protect_cleanup_actions, lower_try_finally_onedest, lower_try_finally_copy, lower_try_finally_switch): Likewise. * tree-mudflap.c (mf_build_string, mx_register_decls, mudflap_register_call, mudflap_enqueue_constant): Likewise. * tree-nested.c (get_trampoline_type, get_nl_goto_field): Likewise. * tree-pretty-print.c (dump_generic_node): Likewise. * tree-ssa-ccp.c (widen_bitfield, maybe_fold_offset_to_array_ref): Likewise. * tree-ssa-dom.c (simplify_rhs_and_lookup_avail_expr): Likewise. * tree-ssa-loop-niter.c (number_of_iterations_cond, loop_niter_by_eval, upper_bound_in_type, lower_bound_in_type): Likewise. * tree-ssa-loop-ivcanon.c (create_canonical_iv, canonicalize_loop_induction_variables): Likewise. * tree-vectorizer.c (vect_create_index_for_array_ref, vect_transform_loop_bound, vect_compute_data_ref_alignment): Likewise. * config/alpha/alpha.c (alpha_initialize_trampoline, alpha_va_start, alpha_gimplify_va_arg_1): Likewise. * config/arm/arm.c (arm_get_cookie_size): Likewise. * config/c4x/c4x.c (c4x_gimplify_va_arg_expr): Likewise. * config/i386/i386.c (ix86_va_start, ix86_gimplify_va_arg): Likewise. * config/ia64/ia64.c (ia64_gimplify_va_arg): Likewise. * config/mips/mips.c (mips_build_builtin_va_list, mips_va_start, mips_gimplify_va_arg_expr): Likewise. * config/pa/pa.c (hppa_gimplify_va_arg_expr): Likewise. * config/rs6000/rs6000.c (rs6000_va_start, rs6000_gimplify_va_arg, add_compiler_branch_island): Likewise. * config/s390/s390.c (s390_va_start): Likewise. * config/sh/sh.c (sh_va_start): Likewise. * config/stormy16/stormy16.c (xstormy16_expand_builtin_va_start): Likewise. * config/xtensa/xtensa.c (xtensa_va_start, xtensa_gimplify_va_arg_expr): Likewise. * objc/objc-act.c (build_objc_string_object, build_objc_symtab_template, init_def_list, init_objc_symtab, init_module_descriptor, generate_static_references, build_selector_translation_table, get_proto_encoding, build_typed_selector_reference, build_selector_reference, build_next_objc_exception_stuff, build_method_prototype_list_template, generate_descriptor_table, generate_protocols, build_protocol_initializer, build_ivar_list_template, build_method_list_template, build_ivar_list_initializer, generate_ivars_list, generate_dispatch_table, generate_protocol_list, build_category_initializer, build_shared_structure_initializer, generate_shared_structures, handle_impent, generate_objc_image_info): Likewise. 2004-04-25 Paolo Bonzini <bonzini@gnu.org> * cfglayout.c (duplicate_insn_chain): Remove references to NOTE_INSN_LOOP_VTOP and NOTE_INSN_LOOP_CONT. * cfgloop.h (struct loop): Remove fields vtop, cont and cont_dominator. * cfgrtl.c (rtl_delete_block): Remove handling of NOTE_INSN_LOOP_CONT. * final.c (final_scan_insn): Remove references to NOTE_INSN_LOOP_VTOP and NOTE_INSN_LOOP_CONT. * insn-notes.def (NOTE_INSN_LOOP_VTOP, NOTE_INSN_LOOP_CONT): Remove. * jump.c (squeeze_notes): Remove references to NOTE_INSN_LOOP_VTOP and NOTE_INSN_LOOP_CONT. * loop.c (scan_loops, find_and_verify_loops, for_each_insn_in_loop, check_dbra_loop, loop_dump_aux): Remove references to removed notes and fields. * reorg.c (mostly_true_jump): Do not rely on NOTE_INSN_LOOP_VTOPs. * unroll.c (unroll_loop, copy_loop_body, loop_iterations): Remove references to removed notes and fields. (subtract_reg_term, ujump_to_loop_cont): Remove. From-SVN: r86544
2004-08-25 11:52:54 +02:00
expr = build_int_cst (NULL_TREE, 0);
initlist = tree_cons (NULL_TREE, expr, initlist);
1992-01-18 00:15:38 +01:00
tree.c (build_constructor): New function. * tree.c (build_constructor): New function. * tree.h: Prototype it. * c-typeck.c (build_c_cast, pop_init_level) * profile.c (build_function_info_value, build_gcov_info_value) (create_profiler): Use build_constructor. * builtins.c (expand_builtin_args_info): Remove #if 0 blocks. * objc/objc-act.c (build_constructor): Rename objc_build_constructor. Use build_constructor. (build_objc_string_object, objc_add_static_instance) (init_def_list, init_objc_symtab, init_module_descriptor) (generate_static_references, build_selector_translation_table) (build_descriptor_table_initializer, generate_descriptor_table) (build_protocol_initializer, build_ivar_list_initializer) (generate_ivars_list, build_dispatch_table_initializer) (generate_dispatch_table, generate_protocol_list) (build_category_initializer, build_shared_structure_initializer): Update to match. ada: * gigi.h, utils2.c (build_constructor): Rename gnat_build_constructor. Use build_constructor. * decl.c (gnat_to_gnu_entity) * trans.c (tree_transform, pos_to_constructor, extract_values) * ada/utils.c (build_template, convert_to_fat_pointer, convert) (unchecked_convert) * ada/utils2.c (build_binary_op, build_call_raise, build_allocator) (fill_vms_descriptor): Update to match. cp: * class.c (initialize_array) * decl.c (reshape_init) * decl2.c (build_expr_from_tree) * init.c (build_zero_init) * pt.c (tsubst_copy, tsubst_copy_and_build) * rtti.c (tinfo_base_init, generic_initializer, ptr_initializer) (ptm_initializer, class_initializer, get_pseudo_ti_init) * semantics.c (finish_compound_literal) * typeck.c (build_ptrmemfunc1) * typeck2.c (store_init_value, process_init_constructor) (build_functional_cast): Use build_constructor. f: * com.c (ffecom_build_complex_constant_, ffecom_expr_) (ffecom_init_zero_, ffecom_transform_namelist_, ffecom_vardesc_) (ffecom_vardesc_array_, ffecom_vardesc_dims_, ffecom_2) * ste.c (ffeste_io_ialist_, ffeste_io_cilist_, ffeste_io_cllist_) (ffeste_io_icilist_, ffeste_io_inlist_, ffeste_io_olist_): Use build_constructor. java: * class.c (make_field_value, make_method_value, get_dispatch_table) (make_class_data, emit_offset_symbol_table) * constants.c (build_constants_constructor) * java-tree.h (START_RECORD_CONSTRUCTOR) * parse.y (maybe_build_array_element_wfl): Use build_constructor. From-SVN: r65539
2003-04-13 03:45:35 +02:00
return objc_build_constructor (type, nreverse (initlist));
1992-01-18 00:15:38 +01:00
}
/* Write out the data structures to describe Objective C classes defined.
Makefile.in (c-parse.o): Depend on $(C_COMMON_H). [gcc/ChangeLog] 2004-09-07 Ziemowit Laski <zlaski@apple.com> * Makefile.in (c-parse.o): Depend on $(C_COMMON_H). * c-parse.in: Include c-common.h instead of objc-act.h. (ivar_decl_list, ivar_decls, ivar_decl, ivars, ivar_declarator, myparms, myparm): Remove %type declarations. (methodtype, optparms, OBJC_TYPE_QUAL, objc_quals, objc_qual, objc_typename, objc_try_catch_stmt, optellipsis): Add %type declarations. (objc_inherit_code, objc_public_flag): Remove. (typespec_nonreserved_nonattr): Call objc_get_protocol_qualified_type() instead of get_static_reference() and get_protocol_reference(). (stmt_nocomp): Call grokparm() on @catch parameter. (objcdef): Move semantic action to objc_finish_implementation(). (classdef): Move semantic action to objc_start_class_interface(), objc_continue_interface(), objc_finish_interface(), objc_start_class_implementation(), objc_continue_implementation(), objc_start_category_interface() and objc_start_category_implementation(). (protocoldef): Move semantic actions to objc_start_protocol() and objc_finish_interface(). (ivar_decl_list): Remove nonterminal. (visibility_spec): Move semantic actions to objc_set_visibility(). (ivar_decls): Remove assignment to $$. (ivar_decl): Rephrase in terms of component_decl; call objc_add_instance_variable(). (ivars, ivar_declarator): Remove nonterminals. (opt_semi): New nonterminal. (methodtype): Remove semantic actions. (methoddef): Move semantic actions to objc_set_method_type(), objc_start_method_definition() and objc_finish_method_definition(). (methodproto): Move semantic actions to objc_set_method_type() and objc_add_method_declaration(). (methoddecl): Use objc_typename instead of typename; move semantic actions to objc_build_method_signature(). (optarglist, myxdecls, mydecl, myparms, myparm): Remove nonterminals. (optparmlist): Express in terms of optparms and optellipsis. (optparms, optellipsis, objc_qual, objc_quals, objc_typename): New nonterminals. (keyworddecl): Use objc_typename instead of typename. (rid_to_yy): Mark RID_IN, RID_OUT, RID_INOUT, RID_BYCOPY, RID_BYREF and RID_ONEWAY as returning OBJC_TYPE_QUAL to yyparse(). [gcc/objc/ChangeLog] 2004-09-07 Ziemowit Laski <zlaski@apple.com> * Make-lang.in (objc/objc-parse.o): Depend on $(C_COMMON_H) instead of objc/objc-act.h. (objc/objc-act.o): Depend on $(HASHTAB_H). * objc-act.c: Include hashtab.h; in ObjC++ mode, include cp-tree.h and objcp-decl.h instead of c-tree.h. (build_module_descriptor, get_class_ivars, synth_id_with_class_suffix, error_with_ivar, gen_method_decl, gen_declaration, setup_string_decl, build_protocol_template): Adjust prototypes. (build_module_initializer_routine, start_class, continue_class, finish_class, start_method_def, objc_start_function, start_protocol, build_method_decl, objc_add_method, add_instance_variable, build_ivar_reference, is_ivar, is_private, get_super_receiver, build_selector_table_decl, objc_push_parm, objc_get_parm_info, gen_type_name, gen_type_name_0, start_var_decl, finish_var_decl, create_field_decl): New prototypes. (objc_expand_function_end, comp_method_with_proto, objc_expr_last, gen_declaration_1, gen_declarator, is_complex_decl, adorn_decl, define_decl, create_builtin_decl, gen_declspecs): Remove prototypes. (TYPE_ID): Rename to OBJECT_TYPEDEF_NAME. (CLASS_TYPEDEF_NAME): New. (TAG_EXECCLASS): Change from a global variable to a #define. (TAG_RETURN_STRUCT): Delete. (TAG_GNUINIT): New, holds '__objc_gnu_init' name. (objc_inherit_code, objc_public_flag): New, moved from c-parse.in. (string_descriptor): New struct. (string_htab): New hash table. (string_hash, string_eq): New prototypes. (generate_struct_by_value_array): Call create_field_decl() instead of create_builtin_decl(). (objc_init): Do not initialize objc_ellipsis_node or TAG_EXECCLASS; In ObjC++ mode, call cxx_init() instead of c_objc_common_init(). (objc_finish_file): In ObjC++, call instantiate_pending_templates() and cp_finish_file(). (define_decl, get_static_reference, get_protocol_reference, create_builtin_decl): Remove functions. (objc_start_class_interface, objc_start_category_interface, objc_start_protocol, objc_continue_interface, objc_finish_interface, objc_start_class_implementation, objc_start_category_implementation, objc_continue_implementation, objc_finish_implementation, objc_set_visibility, objc_set_method_type, objc_build_method_signature, objc_add_method_declaration, objc_start_method_definition, objc_add_instance_variable, objc_get_protocol_qualified_type, create_field_decl, start_var_decl, finish_var_decl): New functions. (setup_string_decl): Simplify since it is only called once. (synth_module_prologue): Call build_class_template(); predefine 'id' and 'Class' as typedefs; rename 'temp_type' to 'type'; disable debug hooks for duration of function; fix GNU runtime messenger signatures to correspond to reality; forward-declare '__objc_exec_class' for the GNU runtime; call build_selector_table_decl(); in ObjC++ mode, generate 'extern "C" { ... }' wrappers around synthesized declarations; call build_protocol_template() and build_category_template(). (string_hash, string_eq): New functions. (objc_build_string_object): Check metaclass correctness only once; store string literals in hash table. (objc_build_constructor): Do not convert initializer elements; adjust for ObjC++ impedance mismatch. (build_objc_symtab_template): Call create_field_decl() instead of create_builtin_decl(). (init_objc_symtab): Add missing conversion to initializer element. (build_metadata_decl): Call start_var_decl() instead of define_decl(). (generate_objc_symtab_decl): Do not call build_category_template(); call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(). (build_module_descriptor): Call create_field_decl() instead of grokfield(); call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(); always mark module descriptor as used; move GNU runtime-specific functionality to build_module_initializer_routine(). (build_module_initializer_routine): New function, broken off of build_module_descriptor(). (objc_static_init_needed_p, objc_generate_static_init_call): New functions. (generate_static_references, generate_strings, build_selector_translation_table, generate_descriptor_table, generate_ivars_list, generate_dispatch_table, generate_category): Call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(); build a type directly instead of via groktypename(). (build_selector_reference_decl, build_selector_table_decl, build_class_reference_decl, build_protocol_reference, generate_objc_image_info): Call start_var_decl() instead of build_decl(). (build_selector_reference): For GNU runtime, do not call build_selector_reference_decl(). (build_selector, build_typed_selector_reference): Always convert result to the selector type. (add_objc_string): Cast return value to 'char *'. (build_method_prototype_template, build_selector_template, build_method_template): Use actual selector type for fields pointing to selectors. (finish_objc): For GNU runtime, call build_module_initializer_routine() after build_module_descriptor(). (generate_protocol_list, generate_shared_structures): Call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(); build a type directly instead of via groktypename(). (synth_id_with_class_suffix): Return a string. (get_arg_type_list): For instance methods, use the instance type for 'self'; do not call groktypename_in_parm_context(). (build_objc_string_decl): Squash redeclaration errors in ObjC++. (objc_is_class_name): Use OBJC_TYPE_NAME instead of TYPE_NAME; handle RECORD_TYPEs in ObjC as well as ObjC++. (objc_is_id): New function. (objc_is_object_ptr): Return the canonical type node. (objc_get_class_ivars): Simplify using get_class_ivars(). (get_class_ivars): Remove second parameter; create a fresh copy of the ivar list for each call; do not check for existence of super class. (objc_eh_runtime_type): Mark #ifndef OBJCPLUS. (objc_init_exceptions): When using SJLJ-style exceptions, require the use of '-fobjc-exceptions' flag; do not require it for DWARF-style exceptions. (objc_build_exc_ptr, next_sjlj_build_try_catch_finally): Use objc_object_type instead of objc_id_type. (objc_begin_catch_clause): Convert the incoming PARM_DECL into a VAR_DECL before placing it in the appropriate scope; do not call define_decl(); adjust call to c_begin_compound_stmt(); use objc_object_type instead of objc_id_type. (build_next_objc_exception_stuff): Call create_field_decl() instead of create_builtin_decl(); construct type directly instead of calling groktypename(); use OBJC_VOID_AT_END to mark end of function parameters. (build_private_template): Adjust call to get_class_ivars(); build a type directly instead of via groktypename(). (build_protocol_template, build_method_prototype_list_template, build_method_prototype_template, build_category_template, build_selector_template, build_class_template, build_super_template, build_ivar_template, build_ivar_list_template, build_method_list_template, build_method_template): Call create_field_decl() instead of grokfield(). (objc_method_parm_type): Do not call groktypename(). (generate_descriptor_table): Call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(). (generate_method_descriptors, build_protocol_initializer, generate_dispatch_tables, build_category_initializer, build_shared_structure_initializer): Do not call groktypename(). (generate_protocols): Call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(); do not call groktypename(). (error_with_ivar): Remove last parameter. (check_ivars): Do not iterate ovar CLASS_RAW_IVARS lists in addition to CLASS_IVARS lists; adjust calls to error_with_ivar(). (generate_ivar_lists): Convert one of the initializer elements; do not call groktypename(). (get_arg_type_list, start_method_def, gen_method_def): Account for new representation of variable arguments and '...' in Objective-C methods; add Objective-C++ impedance matching code. (is_objc_type_qualifier): Remove function. (adjust_type_for_id_default): Simplify; there is no longer a need to wade through declspecs. (lookup_interface, start_class, continue_class, finish_class, start_method_def, start_protocol, build_method_decl, objc_add_method, add_instance_variable, build_ivar_reference, is_ivar, is_private, get_super_receiver, objc_build_finally_epilogue): Make into static functions. (receiver_is_class_object): Use new IS_CLASS() macro. (objc_build_message_expr): Tweak ObjC++ message argument handling; call objc_finish_message_expr() instead of finish_message_expr(). (finish_message_expr): Rename to objc_finish_message_expr(); use OBJC_TYPE_NAME and OBJC_SET_TYPE_NAME macros instead of TYPE_NAME. call gen_type_name() instead of gen_declaration(); call objc_is_id() instead of using IS_ID and IS_CLASS; Use objc_class_name instead of calling get_identifier("Class"); handle CONVERT_EXPRs in receiver. (build_objc_method_call, warn_with_method): Do not call groktypename(). (build_ivar_reference): Call convert() instead of clobbering in a type. (hash_init): Initialize string_htab hash table. (add_instance_variable): Simplify parameter list; do not call grokfield(); do not populate CLASS_IVARS list. (start_class): Check for the existence of super class, if one was specified. (continue_class): Use CLASS_RAW_IVARS rather than CLASS_IVARS; do not call build_class_template(); adjust call to get_class_ivars(); call build_decl(), pushdecl() and finish_decl() instead of define_decl(). (finish_class): Call build_decl(), pushdecl() and finish_decl() instead of define_decl(). (add_protocols): Use PROTOCOL_BINFO_ELTS for the tree vector size. (start_protocol): Do not call build_protocol_template(); use PROTOCOL_BINFO_ELTS for the tree vector size. (encode_type_qualifiers): Do not handle the 'const' qualifier here. (encode_pointer): Encode 'const char *' as 'r*', for backwards compatibility. (encode_array): Use HOST_WIDE_INT_PRINT_DEC instead of "%ld". (encode_type): Handle the 'const' qualifier here. (objc_parmlist): New global variable, sued by objc_push_parm and objc_get_parm_info(). (objc_push_parm, objc_get_parm_info): New functions. (objc_expr_last): Remove function. (synth_self_and_ucmd_args): For instance methods, use the instance type for 'self'; call objc_push_parm() instead of push_parm_decl(). (start_method_def): Do not call push_scope(), declare_parm_level(), pop_scope(), push_parm_decl(), store_parm_decls() or objc_expr_last(); just use objc_push_parm() and objc_get_parm_info(). (comp_method_with_proto): Remove function. (objc_types_are_equivalent): Strip away indirections before comparing underlying types. (comp_proto_with_proto): Do not call groktypename(); types are no longer in raw declspec format. (objc_start_function): New function. (really_start_method): Call comp_proto_with_proto() instead of comp_method_with_proto(); call objc_start_function() instead of hand-crafting a function declarator. (continue_method_def, objc_expand_function_end): Remove functions. (get_super_receiver): Call objc_get_current_scope() instead of get_current_scope(); reference 'super_class' field (instead of 'class'). (finish_method_def): Rename to objc_finish_method_definition() and add a function decl parameter; move method encoding call from objc_expand_function_end(). (is_complex_decl, adorn_decl, gen_declarator, gen_declspecs, gen_declaration_1): Remove functions. (tmpbuf, RAW_DECLSPEC): Remove. (gen_declaration): Remove second parameter; simplify to deal with TYPE_P nodes instead of raw declspecs. (gen_type_name, gen_type_name_0): New functions. (gen_method_decl): Remove second parameter; call gen_type_name() instead of gen_declaration_1(). (dump_interface): Adjust calls to gen_declaration() and gen_method_decl(); do not allocate a separate string buffer. (init_objc): Allocate a larger string buffer to accommodate dump_interface(); adjust call to build_module_descriptor(); add call to build_module_initializer_routine() for the GNU runtime. (generate_classref_translation_entry): Do not call start_decl(); call finish_var_decl() instead of finish_decl(); call convert() instead of build_c_cast(). * objc-act.h (CLASS_OWN_IVARS): Remove accessor. (CLASS_BINFO_ELTS): Reduce from 6 to 5, now that CLASS_OWN_IVARS is gone. (OCTI_GNU_INIT_DECL, GNU_INIT_decl): New. (OCTI_ELLIPSIS_NODE, objc_ellipsis_node): Remove. (OCTI_ID_ID, id_type, objc_id_id): Rename to OCTI_ID_NAME, objc_object_type and objc_object_name, respectively. (OCTI_CLS_REF, OCTI_CLASS_NAME, objc_class_reference, objc_class_name): New. (IS_CLASS): New macro. (IS_ID, IS_SUPER): Robustify. (OCTI_EXECCLASS_DECL, execclass_decl): New. (finish_file, start_class, continue_class, finish_class, start_method_def, continue_method_def, finish_method_def, start_protocol, finish_protocol, objc_build_throw_stmt, objc_build_try_catch_finally_stmt, objc_build_synchronized_prologue, objc_build_synchronized_epilogue, objc_build_try_prologue, objc_build_try_epilogue, objc_build_catch_stmt, objc_build_catch_epilogue, objc_build_finally_prologue, objc_build_finally_epilogue, is_ivar, is_private, is_public, add_instance_variable, objc_add_method, get_super_receiver, objc_clear_super_receiver, get_class_ivars_from_name, get_class_reference, get_static_reference, get_object_reference, build_message_expr, finish_message_expr, build_selector_expr, build_ivar_reference, build_keyword_decl, build_method_decl, build_protocol_expr, build_objc_string_object, objc_declare_alias, objc_declare_class, objc_declare_protocols, objc_comptypes, objc_check_decl, build_encode_expr): Remove prototypes. (imp_count, cat_count): Make GGC-aware. (OBJC_SET_TYPE_NAME): New macro. From-SVN: r87168
2004-09-08 02:49:44 +02:00
struct _objc_module { ... } _OBJC_MODULE = { ... }; */
1992-01-18 00:15:38 +01:00
Makefile.in (c-parse.o): Depend on $(C_COMMON_H). [gcc/ChangeLog] 2004-09-07 Ziemowit Laski <zlaski@apple.com> * Makefile.in (c-parse.o): Depend on $(C_COMMON_H). * c-parse.in: Include c-common.h instead of objc-act.h. (ivar_decl_list, ivar_decls, ivar_decl, ivars, ivar_declarator, myparms, myparm): Remove %type declarations. (methodtype, optparms, OBJC_TYPE_QUAL, objc_quals, objc_qual, objc_typename, objc_try_catch_stmt, optellipsis): Add %type declarations. (objc_inherit_code, objc_public_flag): Remove. (typespec_nonreserved_nonattr): Call objc_get_protocol_qualified_type() instead of get_static_reference() and get_protocol_reference(). (stmt_nocomp): Call grokparm() on @catch parameter. (objcdef): Move semantic action to objc_finish_implementation(). (classdef): Move semantic action to objc_start_class_interface(), objc_continue_interface(), objc_finish_interface(), objc_start_class_implementation(), objc_continue_implementation(), objc_start_category_interface() and objc_start_category_implementation(). (protocoldef): Move semantic actions to objc_start_protocol() and objc_finish_interface(). (ivar_decl_list): Remove nonterminal. (visibility_spec): Move semantic actions to objc_set_visibility(). (ivar_decls): Remove assignment to $$. (ivar_decl): Rephrase in terms of component_decl; call objc_add_instance_variable(). (ivars, ivar_declarator): Remove nonterminals. (opt_semi): New nonterminal. (methodtype): Remove semantic actions. (methoddef): Move semantic actions to objc_set_method_type(), objc_start_method_definition() and objc_finish_method_definition(). (methodproto): Move semantic actions to objc_set_method_type() and objc_add_method_declaration(). (methoddecl): Use objc_typename instead of typename; move semantic actions to objc_build_method_signature(). (optarglist, myxdecls, mydecl, myparms, myparm): Remove nonterminals. (optparmlist): Express in terms of optparms and optellipsis. (optparms, optellipsis, objc_qual, objc_quals, objc_typename): New nonterminals. (keyworddecl): Use objc_typename instead of typename. (rid_to_yy): Mark RID_IN, RID_OUT, RID_INOUT, RID_BYCOPY, RID_BYREF and RID_ONEWAY as returning OBJC_TYPE_QUAL to yyparse(). [gcc/objc/ChangeLog] 2004-09-07 Ziemowit Laski <zlaski@apple.com> * Make-lang.in (objc/objc-parse.o): Depend on $(C_COMMON_H) instead of objc/objc-act.h. (objc/objc-act.o): Depend on $(HASHTAB_H). * objc-act.c: Include hashtab.h; in ObjC++ mode, include cp-tree.h and objcp-decl.h instead of c-tree.h. (build_module_descriptor, get_class_ivars, synth_id_with_class_suffix, error_with_ivar, gen_method_decl, gen_declaration, setup_string_decl, build_protocol_template): Adjust prototypes. (build_module_initializer_routine, start_class, continue_class, finish_class, start_method_def, objc_start_function, start_protocol, build_method_decl, objc_add_method, add_instance_variable, build_ivar_reference, is_ivar, is_private, get_super_receiver, build_selector_table_decl, objc_push_parm, objc_get_parm_info, gen_type_name, gen_type_name_0, start_var_decl, finish_var_decl, create_field_decl): New prototypes. (objc_expand_function_end, comp_method_with_proto, objc_expr_last, gen_declaration_1, gen_declarator, is_complex_decl, adorn_decl, define_decl, create_builtin_decl, gen_declspecs): Remove prototypes. (TYPE_ID): Rename to OBJECT_TYPEDEF_NAME. (CLASS_TYPEDEF_NAME): New. (TAG_EXECCLASS): Change from a global variable to a #define. (TAG_RETURN_STRUCT): Delete. (TAG_GNUINIT): New, holds '__objc_gnu_init' name. (objc_inherit_code, objc_public_flag): New, moved from c-parse.in. (string_descriptor): New struct. (string_htab): New hash table. (string_hash, string_eq): New prototypes. (generate_struct_by_value_array): Call create_field_decl() instead of create_builtin_decl(). (objc_init): Do not initialize objc_ellipsis_node or TAG_EXECCLASS; In ObjC++ mode, call cxx_init() instead of c_objc_common_init(). (objc_finish_file): In ObjC++, call instantiate_pending_templates() and cp_finish_file(). (define_decl, get_static_reference, get_protocol_reference, create_builtin_decl): Remove functions. (objc_start_class_interface, objc_start_category_interface, objc_start_protocol, objc_continue_interface, objc_finish_interface, objc_start_class_implementation, objc_start_category_implementation, objc_continue_implementation, objc_finish_implementation, objc_set_visibility, objc_set_method_type, objc_build_method_signature, objc_add_method_declaration, objc_start_method_definition, objc_add_instance_variable, objc_get_protocol_qualified_type, create_field_decl, start_var_decl, finish_var_decl): New functions. (setup_string_decl): Simplify since it is only called once. (synth_module_prologue): Call build_class_template(); predefine 'id' and 'Class' as typedefs; rename 'temp_type' to 'type'; disable debug hooks for duration of function; fix GNU runtime messenger signatures to correspond to reality; forward-declare '__objc_exec_class' for the GNU runtime; call build_selector_table_decl(); in ObjC++ mode, generate 'extern "C" { ... }' wrappers around synthesized declarations; call build_protocol_template() and build_category_template(). (string_hash, string_eq): New functions. (objc_build_string_object): Check metaclass correctness only once; store string literals in hash table. (objc_build_constructor): Do not convert initializer elements; adjust for ObjC++ impedance mismatch. (build_objc_symtab_template): Call create_field_decl() instead of create_builtin_decl(). (init_objc_symtab): Add missing conversion to initializer element. (build_metadata_decl): Call start_var_decl() instead of define_decl(). (generate_objc_symtab_decl): Do not call build_category_template(); call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(). (build_module_descriptor): Call create_field_decl() instead of grokfield(); call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(); always mark module descriptor as used; move GNU runtime-specific functionality to build_module_initializer_routine(). (build_module_initializer_routine): New function, broken off of build_module_descriptor(). (objc_static_init_needed_p, objc_generate_static_init_call): New functions. (generate_static_references, generate_strings, build_selector_translation_table, generate_descriptor_table, generate_ivars_list, generate_dispatch_table, generate_category): Call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(); build a type directly instead of via groktypename(). (build_selector_reference_decl, build_selector_table_decl, build_class_reference_decl, build_protocol_reference, generate_objc_image_info): Call start_var_decl() instead of build_decl(). (build_selector_reference): For GNU runtime, do not call build_selector_reference_decl(). (build_selector, build_typed_selector_reference): Always convert result to the selector type. (add_objc_string): Cast return value to 'char *'. (build_method_prototype_template, build_selector_template, build_method_template): Use actual selector type for fields pointing to selectors. (finish_objc): For GNU runtime, call build_module_initializer_routine() after build_module_descriptor(). (generate_protocol_list, generate_shared_structures): Call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(); build a type directly instead of via groktypename(). (synth_id_with_class_suffix): Return a string. (get_arg_type_list): For instance methods, use the instance type for 'self'; do not call groktypename_in_parm_context(). (build_objc_string_decl): Squash redeclaration errors in ObjC++. (objc_is_class_name): Use OBJC_TYPE_NAME instead of TYPE_NAME; handle RECORD_TYPEs in ObjC as well as ObjC++. (objc_is_id): New function. (objc_is_object_ptr): Return the canonical type node. (objc_get_class_ivars): Simplify using get_class_ivars(). (get_class_ivars): Remove second parameter; create a fresh copy of the ivar list for each call; do not check for existence of super class. (objc_eh_runtime_type): Mark #ifndef OBJCPLUS. (objc_init_exceptions): When using SJLJ-style exceptions, require the use of '-fobjc-exceptions' flag; do not require it for DWARF-style exceptions. (objc_build_exc_ptr, next_sjlj_build_try_catch_finally): Use objc_object_type instead of objc_id_type. (objc_begin_catch_clause): Convert the incoming PARM_DECL into a VAR_DECL before placing it in the appropriate scope; do not call define_decl(); adjust call to c_begin_compound_stmt(); use objc_object_type instead of objc_id_type. (build_next_objc_exception_stuff): Call create_field_decl() instead of create_builtin_decl(); construct type directly instead of calling groktypename(); use OBJC_VOID_AT_END to mark end of function parameters. (build_private_template): Adjust call to get_class_ivars(); build a type directly instead of via groktypename(). (build_protocol_template, build_method_prototype_list_template, build_method_prototype_template, build_category_template, build_selector_template, build_class_template, build_super_template, build_ivar_template, build_ivar_list_template, build_method_list_template, build_method_template): Call create_field_decl() instead of grokfield(). (objc_method_parm_type): Do not call groktypename(). (generate_descriptor_table): Call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(). (generate_method_descriptors, build_protocol_initializer, generate_dispatch_tables, build_category_initializer, build_shared_structure_initializer): Do not call groktypename(). (generate_protocols): Call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(); do not call groktypename(). (error_with_ivar): Remove last parameter. (check_ivars): Do not iterate ovar CLASS_RAW_IVARS lists in addition to CLASS_IVARS lists; adjust calls to error_with_ivar(). (generate_ivar_lists): Convert one of the initializer elements; do not call groktypename(). (get_arg_type_list, start_method_def, gen_method_def): Account for new representation of variable arguments and '...' in Objective-C methods; add Objective-C++ impedance matching code. (is_objc_type_qualifier): Remove function. (adjust_type_for_id_default): Simplify; there is no longer a need to wade through declspecs. (lookup_interface, start_class, continue_class, finish_class, start_method_def, start_protocol, build_method_decl, objc_add_method, add_instance_variable, build_ivar_reference, is_ivar, is_private, get_super_receiver, objc_build_finally_epilogue): Make into static functions. (receiver_is_class_object): Use new IS_CLASS() macro. (objc_build_message_expr): Tweak ObjC++ message argument handling; call objc_finish_message_expr() instead of finish_message_expr(). (finish_message_expr): Rename to objc_finish_message_expr(); use OBJC_TYPE_NAME and OBJC_SET_TYPE_NAME macros instead of TYPE_NAME. call gen_type_name() instead of gen_declaration(); call objc_is_id() instead of using IS_ID and IS_CLASS; Use objc_class_name instead of calling get_identifier("Class"); handle CONVERT_EXPRs in receiver. (build_objc_method_call, warn_with_method): Do not call groktypename(). (build_ivar_reference): Call convert() instead of clobbering in a type. (hash_init): Initialize string_htab hash table. (add_instance_variable): Simplify parameter list; do not call grokfield(); do not populate CLASS_IVARS list. (start_class): Check for the existence of super class, if one was specified. (continue_class): Use CLASS_RAW_IVARS rather than CLASS_IVARS; do not call build_class_template(); adjust call to get_class_ivars(); call build_decl(), pushdecl() and finish_decl() instead of define_decl(). (finish_class): Call build_decl(), pushdecl() and finish_decl() instead of define_decl(). (add_protocols): Use PROTOCOL_BINFO_ELTS for the tree vector size. (start_protocol): Do not call build_protocol_template(); use PROTOCOL_BINFO_ELTS for the tree vector size. (encode_type_qualifiers): Do not handle the 'const' qualifier here. (encode_pointer): Encode 'const char *' as 'r*', for backwards compatibility. (encode_array): Use HOST_WIDE_INT_PRINT_DEC instead of "%ld". (encode_type): Handle the 'const' qualifier here. (objc_parmlist): New global variable, sued by objc_push_parm and objc_get_parm_info(). (objc_push_parm, objc_get_parm_info): New functions. (objc_expr_last): Remove function. (synth_self_and_ucmd_args): For instance methods, use the instance type for 'self'; call objc_push_parm() instead of push_parm_decl(). (start_method_def): Do not call push_scope(), declare_parm_level(), pop_scope(), push_parm_decl(), store_parm_decls() or objc_expr_last(); just use objc_push_parm() and objc_get_parm_info(). (comp_method_with_proto): Remove function. (objc_types_are_equivalent): Strip away indirections before comparing underlying types. (comp_proto_with_proto): Do not call groktypename(); types are no longer in raw declspec format. (objc_start_function): New function. (really_start_method): Call comp_proto_with_proto() instead of comp_method_with_proto(); call objc_start_function() instead of hand-crafting a function declarator. (continue_method_def, objc_expand_function_end): Remove functions. (get_super_receiver): Call objc_get_current_scope() instead of get_current_scope(); reference 'super_class' field (instead of 'class'). (finish_method_def): Rename to objc_finish_method_definition() and add a function decl parameter; move method encoding call from objc_expand_function_end(). (is_complex_decl, adorn_decl, gen_declarator, gen_declspecs, gen_declaration_1): Remove functions. (tmpbuf, RAW_DECLSPEC): Remove. (gen_declaration): Remove second parameter; simplify to deal with TYPE_P nodes instead of raw declspecs. (gen_type_name, gen_type_name_0): New functions. (gen_method_decl): Remove second parameter; call gen_type_name() instead of gen_declaration_1(). (dump_interface): Adjust calls to gen_declaration() and gen_method_decl(); do not allocate a separate string buffer. (init_objc): Allocate a larger string buffer to accommodate dump_interface(); adjust call to build_module_descriptor(); add call to build_module_initializer_routine() for the GNU runtime. (generate_classref_translation_entry): Do not call start_decl(); call finish_var_decl() instead of finish_decl(); call convert() instead of build_c_cast(). * objc-act.h (CLASS_OWN_IVARS): Remove accessor. (CLASS_BINFO_ELTS): Reduce from 6 to 5, now that CLASS_OWN_IVARS is gone. (OCTI_GNU_INIT_DECL, GNU_INIT_decl): New. (OCTI_ELLIPSIS_NODE, objc_ellipsis_node): Remove. (OCTI_ID_ID, id_type, objc_id_id): Rename to OCTI_ID_NAME, objc_object_type and objc_object_name, respectively. (OCTI_CLS_REF, OCTI_CLASS_NAME, objc_class_reference, objc_class_name): New. (IS_CLASS): New macro. (IS_ID, IS_SUPER): Robustify. (OCTI_EXECCLASS_DECL, execclass_decl): New. (finish_file, start_class, continue_class, finish_class, start_method_def, continue_method_def, finish_method_def, start_protocol, finish_protocol, objc_build_throw_stmt, objc_build_try_catch_finally_stmt, objc_build_synchronized_prologue, objc_build_synchronized_epilogue, objc_build_try_prologue, objc_build_try_epilogue, objc_build_catch_stmt, objc_build_catch_epilogue, objc_build_finally_prologue, objc_build_finally_epilogue, is_ivar, is_private, is_public, add_instance_variable, objc_add_method, get_super_receiver, objc_clear_super_receiver, get_class_ivars_from_name, get_class_reference, get_static_reference, get_object_reference, build_message_expr, finish_message_expr, build_selector_expr, build_ivar_reference, build_keyword_decl, build_method_decl, build_protocol_expr, build_objc_string_object, objc_declare_alias, objc_declare_class, objc_declare_protocols, objc_comptypes, objc_check_decl, build_encode_expr): Remove prototypes. (imp_count, cat_count): Make GGC-aware. (OBJC_SET_TYPE_NAME): New macro. From-SVN: r87168
2004-09-08 02:49:44 +02:00
static void
build_module_descriptor (void)
1992-01-18 00:15:38 +01:00
{
Makefile.in (c-parse.o): Depend on $(C_COMMON_H). [gcc/ChangeLog] 2004-09-07 Ziemowit Laski <zlaski@apple.com> * Makefile.in (c-parse.o): Depend on $(C_COMMON_H). * c-parse.in: Include c-common.h instead of objc-act.h. (ivar_decl_list, ivar_decls, ivar_decl, ivars, ivar_declarator, myparms, myparm): Remove %type declarations. (methodtype, optparms, OBJC_TYPE_QUAL, objc_quals, objc_qual, objc_typename, objc_try_catch_stmt, optellipsis): Add %type declarations. (objc_inherit_code, objc_public_flag): Remove. (typespec_nonreserved_nonattr): Call objc_get_protocol_qualified_type() instead of get_static_reference() and get_protocol_reference(). (stmt_nocomp): Call grokparm() on @catch parameter. (objcdef): Move semantic action to objc_finish_implementation(). (classdef): Move semantic action to objc_start_class_interface(), objc_continue_interface(), objc_finish_interface(), objc_start_class_implementation(), objc_continue_implementation(), objc_start_category_interface() and objc_start_category_implementation(). (protocoldef): Move semantic actions to objc_start_protocol() and objc_finish_interface(). (ivar_decl_list): Remove nonterminal. (visibility_spec): Move semantic actions to objc_set_visibility(). (ivar_decls): Remove assignment to $$. (ivar_decl): Rephrase in terms of component_decl; call objc_add_instance_variable(). (ivars, ivar_declarator): Remove nonterminals. (opt_semi): New nonterminal. (methodtype): Remove semantic actions. (methoddef): Move semantic actions to objc_set_method_type(), objc_start_method_definition() and objc_finish_method_definition(). (methodproto): Move semantic actions to objc_set_method_type() and objc_add_method_declaration(). (methoddecl): Use objc_typename instead of typename; move semantic actions to objc_build_method_signature(). (optarglist, myxdecls, mydecl, myparms, myparm): Remove nonterminals. (optparmlist): Express in terms of optparms and optellipsis. (optparms, optellipsis, objc_qual, objc_quals, objc_typename): New nonterminals. (keyworddecl): Use objc_typename instead of typename. (rid_to_yy): Mark RID_IN, RID_OUT, RID_INOUT, RID_BYCOPY, RID_BYREF and RID_ONEWAY as returning OBJC_TYPE_QUAL to yyparse(). [gcc/objc/ChangeLog] 2004-09-07 Ziemowit Laski <zlaski@apple.com> * Make-lang.in (objc/objc-parse.o): Depend on $(C_COMMON_H) instead of objc/objc-act.h. (objc/objc-act.o): Depend on $(HASHTAB_H). * objc-act.c: Include hashtab.h; in ObjC++ mode, include cp-tree.h and objcp-decl.h instead of c-tree.h. (build_module_descriptor, get_class_ivars, synth_id_with_class_suffix, error_with_ivar, gen_method_decl, gen_declaration, setup_string_decl, build_protocol_template): Adjust prototypes. (build_module_initializer_routine, start_class, continue_class, finish_class, start_method_def, objc_start_function, start_protocol, build_method_decl, objc_add_method, add_instance_variable, build_ivar_reference, is_ivar, is_private, get_super_receiver, build_selector_table_decl, objc_push_parm, objc_get_parm_info, gen_type_name, gen_type_name_0, start_var_decl, finish_var_decl, create_field_decl): New prototypes. (objc_expand_function_end, comp_method_with_proto, objc_expr_last, gen_declaration_1, gen_declarator, is_complex_decl, adorn_decl, define_decl, create_builtin_decl, gen_declspecs): Remove prototypes. (TYPE_ID): Rename to OBJECT_TYPEDEF_NAME. (CLASS_TYPEDEF_NAME): New. (TAG_EXECCLASS): Change from a global variable to a #define. (TAG_RETURN_STRUCT): Delete. (TAG_GNUINIT): New, holds '__objc_gnu_init' name. (objc_inherit_code, objc_public_flag): New, moved from c-parse.in. (string_descriptor): New struct. (string_htab): New hash table. (string_hash, string_eq): New prototypes. (generate_struct_by_value_array): Call create_field_decl() instead of create_builtin_decl(). (objc_init): Do not initialize objc_ellipsis_node or TAG_EXECCLASS; In ObjC++ mode, call cxx_init() instead of c_objc_common_init(). (objc_finish_file): In ObjC++, call instantiate_pending_templates() and cp_finish_file(). (define_decl, get_static_reference, get_protocol_reference, create_builtin_decl): Remove functions. (objc_start_class_interface, objc_start_category_interface, objc_start_protocol, objc_continue_interface, objc_finish_interface, objc_start_class_implementation, objc_start_category_implementation, objc_continue_implementation, objc_finish_implementation, objc_set_visibility, objc_set_method_type, objc_build_method_signature, objc_add_method_declaration, objc_start_method_definition, objc_add_instance_variable, objc_get_protocol_qualified_type, create_field_decl, start_var_decl, finish_var_decl): New functions. (setup_string_decl): Simplify since it is only called once. (synth_module_prologue): Call build_class_template(); predefine 'id' and 'Class' as typedefs; rename 'temp_type' to 'type'; disable debug hooks for duration of function; fix GNU runtime messenger signatures to correspond to reality; forward-declare '__objc_exec_class' for the GNU runtime; call build_selector_table_decl(); in ObjC++ mode, generate 'extern "C" { ... }' wrappers around synthesized declarations; call build_protocol_template() and build_category_template(). (string_hash, string_eq): New functions. (objc_build_string_object): Check metaclass correctness only once; store string literals in hash table. (objc_build_constructor): Do not convert initializer elements; adjust for ObjC++ impedance mismatch. (build_objc_symtab_template): Call create_field_decl() instead of create_builtin_decl(). (init_objc_symtab): Add missing conversion to initializer element. (build_metadata_decl): Call start_var_decl() instead of define_decl(). (generate_objc_symtab_decl): Do not call build_category_template(); call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(). (build_module_descriptor): Call create_field_decl() instead of grokfield(); call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(); always mark module descriptor as used; move GNU runtime-specific functionality to build_module_initializer_routine(). (build_module_initializer_routine): New function, broken off of build_module_descriptor(). (objc_static_init_needed_p, objc_generate_static_init_call): New functions. (generate_static_references, generate_strings, build_selector_translation_table, generate_descriptor_table, generate_ivars_list, generate_dispatch_table, generate_category): Call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(); build a type directly instead of via groktypename(). (build_selector_reference_decl, build_selector_table_decl, build_class_reference_decl, build_protocol_reference, generate_objc_image_info): Call start_var_decl() instead of build_decl(). (build_selector_reference): For GNU runtime, do not call build_selector_reference_decl(). (build_selector, build_typed_selector_reference): Always convert result to the selector type. (add_objc_string): Cast return value to 'char *'. (build_method_prototype_template, build_selector_template, build_method_template): Use actual selector type for fields pointing to selectors. (finish_objc): For GNU runtime, call build_module_initializer_routine() after build_module_descriptor(). (generate_protocol_list, generate_shared_structures): Call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(); build a type directly instead of via groktypename(). (synth_id_with_class_suffix): Return a string. (get_arg_type_list): For instance methods, use the instance type for 'self'; do not call groktypename_in_parm_context(). (build_objc_string_decl): Squash redeclaration errors in ObjC++. (objc_is_class_name): Use OBJC_TYPE_NAME instead of TYPE_NAME; handle RECORD_TYPEs in ObjC as well as ObjC++. (objc_is_id): New function. (objc_is_object_ptr): Return the canonical type node. (objc_get_class_ivars): Simplify using get_class_ivars(). (get_class_ivars): Remove second parameter; create a fresh copy of the ivar list for each call; do not check for existence of super class. (objc_eh_runtime_type): Mark #ifndef OBJCPLUS. (objc_init_exceptions): When using SJLJ-style exceptions, require the use of '-fobjc-exceptions' flag; do not require it for DWARF-style exceptions. (objc_build_exc_ptr, next_sjlj_build_try_catch_finally): Use objc_object_type instead of objc_id_type. (objc_begin_catch_clause): Convert the incoming PARM_DECL into a VAR_DECL before placing it in the appropriate scope; do not call define_decl(); adjust call to c_begin_compound_stmt(); use objc_object_type instead of objc_id_type. (build_next_objc_exception_stuff): Call create_field_decl() instead of create_builtin_decl(); construct type directly instead of calling groktypename(); use OBJC_VOID_AT_END to mark end of function parameters. (build_private_template): Adjust call to get_class_ivars(); build a type directly instead of via groktypename(). (build_protocol_template, build_method_prototype_list_template, build_method_prototype_template, build_category_template, build_selector_template, build_class_template, build_super_template, build_ivar_template, build_ivar_list_template, build_method_list_template, build_method_template): Call create_field_decl() instead of grokfield(). (objc_method_parm_type): Do not call groktypename(). (generate_descriptor_table): Call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(). (generate_method_descriptors, build_protocol_initializer, generate_dispatch_tables, build_category_initializer, build_shared_structure_initializer): Do not call groktypename(). (generate_protocols): Call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(); do not call groktypename(). (error_with_ivar): Remove last parameter. (check_ivars): Do not iterate ovar CLASS_RAW_IVARS lists in addition to CLASS_IVARS lists; adjust calls to error_with_ivar(). (generate_ivar_lists): Convert one of the initializer elements; do not call groktypename(). (get_arg_type_list, start_method_def, gen_method_def): Account for new representation of variable arguments and '...' in Objective-C methods; add Objective-C++ impedance matching code. (is_objc_type_qualifier): Remove function. (adjust_type_for_id_default): Simplify; there is no longer a need to wade through declspecs. (lookup_interface, start_class, continue_class, finish_class, start_method_def, start_protocol, build_method_decl, objc_add_method, add_instance_variable, build_ivar_reference, is_ivar, is_private, get_super_receiver, objc_build_finally_epilogue): Make into static functions. (receiver_is_class_object): Use new IS_CLASS() macro. (objc_build_message_expr): Tweak ObjC++ message argument handling; call objc_finish_message_expr() instead of finish_message_expr(). (finish_message_expr): Rename to objc_finish_message_expr(); use OBJC_TYPE_NAME and OBJC_SET_TYPE_NAME macros instead of TYPE_NAME. call gen_type_name() instead of gen_declaration(); call objc_is_id() instead of using IS_ID and IS_CLASS; Use objc_class_name instead of calling get_identifier("Class"); handle CONVERT_EXPRs in receiver. (build_objc_method_call, warn_with_method): Do not call groktypename(). (build_ivar_reference): Call convert() instead of clobbering in a type. (hash_init): Initialize string_htab hash table. (add_instance_variable): Simplify parameter list; do not call grokfield(); do not populate CLASS_IVARS list. (start_class): Check for the existence of super class, if one was specified. (continue_class): Use CLASS_RAW_IVARS rather than CLASS_IVARS; do not call build_class_template(); adjust call to get_class_ivars(); call build_decl(), pushdecl() and finish_decl() instead of define_decl(). (finish_class): Call build_decl(), pushdecl() and finish_decl() instead of define_decl(). (add_protocols): Use PROTOCOL_BINFO_ELTS for the tree vector size. (start_protocol): Do not call build_protocol_template(); use PROTOCOL_BINFO_ELTS for the tree vector size. (encode_type_qualifiers): Do not handle the 'const' qualifier here. (encode_pointer): Encode 'const char *' as 'r*', for backwards compatibility. (encode_array): Use HOST_WIDE_INT_PRINT_DEC instead of "%ld". (encode_type): Handle the 'const' qualifier here. (objc_parmlist): New global variable, sued by objc_push_parm and objc_get_parm_info(). (objc_push_parm, objc_get_parm_info): New functions. (objc_expr_last): Remove function. (synth_self_and_ucmd_args): For instance methods, use the instance type for 'self'; call objc_push_parm() instead of push_parm_decl(). (start_method_def): Do not call push_scope(), declare_parm_level(), pop_scope(), push_parm_decl(), store_parm_decls() or objc_expr_last(); just use objc_push_parm() and objc_get_parm_info(). (comp_method_with_proto): Remove function. (objc_types_are_equivalent): Strip away indirections before comparing underlying types. (comp_proto_with_proto): Do not call groktypename(); types are no longer in raw declspec format. (objc_start_function): New function. (really_start_method): Call comp_proto_with_proto() instead of comp_method_with_proto(); call objc_start_function() instead of hand-crafting a function declarator. (continue_method_def, objc_expand_function_end): Remove functions. (get_super_receiver): Call objc_get_current_scope() instead of get_current_scope(); reference 'super_class' field (instead of 'class'). (finish_method_def): Rename to objc_finish_method_definition() and add a function decl parameter; move method encoding call from objc_expand_function_end(). (is_complex_decl, adorn_decl, gen_declarator, gen_declspecs, gen_declaration_1): Remove functions. (tmpbuf, RAW_DECLSPEC): Remove. (gen_declaration): Remove second parameter; simplify to deal with TYPE_P nodes instead of raw declspecs. (gen_type_name, gen_type_name_0): New functions. (gen_method_decl): Remove second parameter; call gen_type_name() instead of gen_declaration_1(). (dump_interface): Adjust calls to gen_declaration() and gen_method_decl(); do not allocate a separate string buffer. (init_objc): Allocate a larger string buffer to accommodate dump_interface(); adjust call to build_module_descriptor(); add call to build_module_initializer_routine() for the GNU runtime. (generate_classref_translation_entry): Do not call start_decl(); call finish_var_decl() instead of finish_decl(); call convert() instead of build_c_cast(). * objc-act.h (CLASS_OWN_IVARS): Remove accessor. (CLASS_BINFO_ELTS): Reduce from 6 to 5, now that CLASS_OWN_IVARS is gone. (OCTI_GNU_INIT_DECL, GNU_INIT_decl): New. (OCTI_ELLIPSIS_NODE, objc_ellipsis_node): Remove. (OCTI_ID_ID, id_type, objc_id_id): Rename to OCTI_ID_NAME, objc_object_type and objc_object_name, respectively. (OCTI_CLS_REF, OCTI_CLASS_NAME, objc_class_reference, objc_class_name): New. (IS_CLASS): New macro. (IS_ID, IS_SUPER): Robustify. (OCTI_EXECCLASS_DECL, execclass_decl): New. (finish_file, start_class, continue_class, finish_class, start_method_def, continue_method_def, finish_method_def, start_protocol, finish_protocol, objc_build_throw_stmt, objc_build_try_catch_finally_stmt, objc_build_synchronized_prologue, objc_build_synchronized_epilogue, objc_build_try_prologue, objc_build_try_epilogue, objc_build_catch_stmt, objc_build_catch_epilogue, objc_build_finally_prologue, objc_build_finally_epilogue, is_ivar, is_private, is_public, add_instance_variable, objc_add_method, get_super_receiver, objc_clear_super_receiver, get_class_ivars_from_name, get_class_reference, get_static_reference, get_object_reference, build_message_expr, finish_message_expr, build_selector_expr, build_ivar_reference, build_keyword_decl, build_method_decl, build_protocol_expr, build_objc_string_object, objc_declare_alias, objc_declare_class, objc_declare_protocols, objc_comptypes, objc_check_decl, build_encode_expr): Remove prototypes. (imp_count, cat_count): Make GGC-aware. (OBJC_SET_TYPE_NAME): New macro. From-SVN: r87168
2004-09-08 02:49:44 +02:00
tree field_decl, field_decl_chain;
#ifdef OBJCPLUS
push_lang_context (lang_name_c); /* extern "C" */
#endif
1992-01-18 00:15:38 +01:00
objc_module_template
= start_struct (RECORD_TYPE, get_identifier (UTAG_MODULE));
1992-01-18 00:15:38 +01:00
Makefile.in (c-parse.o): Depend on $(C_COMMON_H). [gcc/ChangeLog] 2004-09-07 Ziemowit Laski <zlaski@apple.com> * Makefile.in (c-parse.o): Depend on $(C_COMMON_H). * c-parse.in: Include c-common.h instead of objc-act.h. (ivar_decl_list, ivar_decls, ivar_decl, ivars, ivar_declarator, myparms, myparm): Remove %type declarations. (methodtype, optparms, OBJC_TYPE_QUAL, objc_quals, objc_qual, objc_typename, objc_try_catch_stmt, optellipsis): Add %type declarations. (objc_inherit_code, objc_public_flag): Remove. (typespec_nonreserved_nonattr): Call objc_get_protocol_qualified_type() instead of get_static_reference() and get_protocol_reference(). (stmt_nocomp): Call grokparm() on @catch parameter. (objcdef): Move semantic action to objc_finish_implementation(). (classdef): Move semantic action to objc_start_class_interface(), objc_continue_interface(), objc_finish_interface(), objc_start_class_implementation(), objc_continue_implementation(), objc_start_category_interface() and objc_start_category_implementation(). (protocoldef): Move semantic actions to objc_start_protocol() and objc_finish_interface(). (ivar_decl_list): Remove nonterminal. (visibility_spec): Move semantic actions to objc_set_visibility(). (ivar_decls): Remove assignment to $$. (ivar_decl): Rephrase in terms of component_decl; call objc_add_instance_variable(). (ivars, ivar_declarator): Remove nonterminals. (opt_semi): New nonterminal. (methodtype): Remove semantic actions. (methoddef): Move semantic actions to objc_set_method_type(), objc_start_method_definition() and objc_finish_method_definition(). (methodproto): Move semantic actions to objc_set_method_type() and objc_add_method_declaration(). (methoddecl): Use objc_typename instead of typename; move semantic actions to objc_build_method_signature(). (optarglist, myxdecls, mydecl, myparms, myparm): Remove nonterminals. (optparmlist): Express in terms of optparms and optellipsis. (optparms, optellipsis, objc_qual, objc_quals, objc_typename): New nonterminals. (keyworddecl): Use objc_typename instead of typename. (rid_to_yy): Mark RID_IN, RID_OUT, RID_INOUT, RID_BYCOPY, RID_BYREF and RID_ONEWAY as returning OBJC_TYPE_QUAL to yyparse(). [gcc/objc/ChangeLog] 2004-09-07 Ziemowit Laski <zlaski@apple.com> * Make-lang.in (objc/objc-parse.o): Depend on $(C_COMMON_H) instead of objc/objc-act.h. (objc/objc-act.o): Depend on $(HASHTAB_H). * objc-act.c: Include hashtab.h; in ObjC++ mode, include cp-tree.h and objcp-decl.h instead of c-tree.h. (build_module_descriptor, get_class_ivars, synth_id_with_class_suffix, error_with_ivar, gen_method_decl, gen_declaration, setup_string_decl, build_protocol_template): Adjust prototypes. (build_module_initializer_routine, start_class, continue_class, finish_class, start_method_def, objc_start_function, start_protocol, build_method_decl, objc_add_method, add_instance_variable, build_ivar_reference, is_ivar, is_private, get_super_receiver, build_selector_table_decl, objc_push_parm, objc_get_parm_info, gen_type_name, gen_type_name_0, start_var_decl, finish_var_decl, create_field_decl): New prototypes. (objc_expand_function_end, comp_method_with_proto, objc_expr_last, gen_declaration_1, gen_declarator, is_complex_decl, adorn_decl, define_decl, create_builtin_decl, gen_declspecs): Remove prototypes. (TYPE_ID): Rename to OBJECT_TYPEDEF_NAME. (CLASS_TYPEDEF_NAME): New. (TAG_EXECCLASS): Change from a global variable to a #define. (TAG_RETURN_STRUCT): Delete. (TAG_GNUINIT): New, holds '__objc_gnu_init' name. (objc_inherit_code, objc_public_flag): New, moved from c-parse.in. (string_descriptor): New struct. (string_htab): New hash table. (string_hash, string_eq): New prototypes. (generate_struct_by_value_array): Call create_field_decl() instead of create_builtin_decl(). (objc_init): Do not initialize objc_ellipsis_node or TAG_EXECCLASS; In ObjC++ mode, call cxx_init() instead of c_objc_common_init(). (objc_finish_file): In ObjC++, call instantiate_pending_templates() and cp_finish_file(). (define_decl, get_static_reference, get_protocol_reference, create_builtin_decl): Remove functions. (objc_start_class_interface, objc_start_category_interface, objc_start_protocol, objc_continue_interface, objc_finish_interface, objc_start_class_implementation, objc_start_category_implementation, objc_continue_implementation, objc_finish_implementation, objc_set_visibility, objc_set_method_type, objc_build_method_signature, objc_add_method_declaration, objc_start_method_definition, objc_add_instance_variable, objc_get_protocol_qualified_type, create_field_decl, start_var_decl, finish_var_decl): New functions. (setup_string_decl): Simplify since it is only called once. (synth_module_prologue): Call build_class_template(); predefine 'id' and 'Class' as typedefs; rename 'temp_type' to 'type'; disable debug hooks for duration of function; fix GNU runtime messenger signatures to correspond to reality; forward-declare '__objc_exec_class' for the GNU runtime; call build_selector_table_decl(); in ObjC++ mode, generate 'extern "C" { ... }' wrappers around synthesized declarations; call build_protocol_template() and build_category_template(). (string_hash, string_eq): New functions. (objc_build_string_object): Check metaclass correctness only once; store string literals in hash table. (objc_build_constructor): Do not convert initializer elements; adjust for ObjC++ impedance mismatch. (build_objc_symtab_template): Call create_field_decl() instead of create_builtin_decl(). (init_objc_symtab): Add missing conversion to initializer element. (build_metadata_decl): Call start_var_decl() instead of define_decl(). (generate_objc_symtab_decl): Do not call build_category_template(); call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(). (build_module_descriptor): Call create_field_decl() instead of grokfield(); call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(); always mark module descriptor as used; move GNU runtime-specific functionality to build_module_initializer_routine(). (build_module_initializer_routine): New function, broken off of build_module_descriptor(). (objc_static_init_needed_p, objc_generate_static_init_call): New functions. (generate_static_references, generate_strings, build_selector_translation_table, generate_descriptor_table, generate_ivars_list, generate_dispatch_table, generate_category): Call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(); build a type directly instead of via groktypename(). (build_selector_reference_decl, build_selector_table_decl, build_class_reference_decl, build_protocol_reference, generate_objc_image_info): Call start_var_decl() instead of build_decl(). (build_selector_reference): For GNU runtime, do not call build_selector_reference_decl(). (build_selector, build_typed_selector_reference): Always convert result to the selector type. (add_objc_string): Cast return value to 'char *'. (build_method_prototype_template, build_selector_template, build_method_template): Use actual selector type for fields pointing to selectors. (finish_objc): For GNU runtime, call build_module_initializer_routine() after build_module_descriptor(). (generate_protocol_list, generate_shared_structures): Call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(); build a type directly instead of via groktypename(). (synth_id_with_class_suffix): Return a string. (get_arg_type_list): For instance methods, use the instance type for 'self'; do not call groktypename_in_parm_context(). (build_objc_string_decl): Squash redeclaration errors in ObjC++. (objc_is_class_name): Use OBJC_TYPE_NAME instead of TYPE_NAME; handle RECORD_TYPEs in ObjC as well as ObjC++. (objc_is_id): New function. (objc_is_object_ptr): Return the canonical type node. (objc_get_class_ivars): Simplify using get_class_ivars(). (get_class_ivars): Remove second parameter; create a fresh copy of the ivar list for each call; do not check for existence of super class. (objc_eh_runtime_type): Mark #ifndef OBJCPLUS. (objc_init_exceptions): When using SJLJ-style exceptions, require the use of '-fobjc-exceptions' flag; do not require it for DWARF-style exceptions. (objc_build_exc_ptr, next_sjlj_build_try_catch_finally): Use objc_object_type instead of objc_id_type. (objc_begin_catch_clause): Convert the incoming PARM_DECL into a VAR_DECL before placing it in the appropriate scope; do not call define_decl(); adjust call to c_begin_compound_stmt(); use objc_object_type instead of objc_id_type. (build_next_objc_exception_stuff): Call create_field_decl() instead of create_builtin_decl(); construct type directly instead of calling groktypename(); use OBJC_VOID_AT_END to mark end of function parameters. (build_private_template): Adjust call to get_class_ivars(); build a type directly instead of via groktypename(). (build_protocol_template, build_method_prototype_list_template, build_method_prototype_template, build_category_template, build_selector_template, build_class_template, build_super_template, build_ivar_template, build_ivar_list_template, build_method_list_template, build_method_template): Call create_field_decl() instead of grokfield(). (objc_method_parm_type): Do not call groktypename(). (generate_descriptor_table): Call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(). (generate_method_descriptors, build_protocol_initializer, generate_dispatch_tables, build_category_initializer, build_shared_structure_initializer): Do not call groktypename(). (generate_protocols): Call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(); do not call groktypename(). (error_with_ivar): Remove last parameter. (check_ivars): Do not iterate ovar CLASS_RAW_IVARS lists in addition to CLASS_IVARS lists; adjust calls to error_with_ivar(). (generate_ivar_lists): Convert one of the initializer elements; do not call groktypename(). (get_arg_type_list, start_method_def, gen_method_def): Account for new representation of variable arguments and '...' in Objective-C methods; add Objective-C++ impedance matching code. (is_objc_type_qualifier): Remove function. (adjust_type_for_id_default): Simplify; there is no longer a need to wade through declspecs. (lookup_interface, start_class, continue_class, finish_class, start_method_def, start_protocol, build_method_decl, objc_add_method, add_instance_variable, build_ivar_reference, is_ivar, is_private, get_super_receiver, objc_build_finally_epilogue): Make into static functions. (receiver_is_class_object): Use new IS_CLASS() macro. (objc_build_message_expr): Tweak ObjC++ message argument handling; call objc_finish_message_expr() instead of finish_message_expr(). (finish_message_expr): Rename to objc_finish_message_expr(); use OBJC_TYPE_NAME and OBJC_SET_TYPE_NAME macros instead of TYPE_NAME. call gen_type_name() instead of gen_declaration(); call objc_is_id() instead of using IS_ID and IS_CLASS; Use objc_class_name instead of calling get_identifier("Class"); handle CONVERT_EXPRs in receiver. (build_objc_method_call, warn_with_method): Do not call groktypename(). (build_ivar_reference): Call convert() instead of clobbering in a type. (hash_init): Initialize string_htab hash table. (add_instance_variable): Simplify parameter list; do not call grokfield(); do not populate CLASS_IVARS list. (start_class): Check for the existence of super class, if one was specified. (continue_class): Use CLASS_RAW_IVARS rather than CLASS_IVARS; do not call build_class_template(); adjust call to get_class_ivars(); call build_decl(), pushdecl() and finish_decl() instead of define_decl(). (finish_class): Call build_decl(), pushdecl() and finish_decl() instead of define_decl(). (add_protocols): Use PROTOCOL_BINFO_ELTS for the tree vector size. (start_protocol): Do not call build_protocol_template(); use PROTOCOL_BINFO_ELTS for the tree vector size. (encode_type_qualifiers): Do not handle the 'const' qualifier here. (encode_pointer): Encode 'const char *' as 'r*', for backwards compatibility. (encode_array): Use HOST_WIDE_INT_PRINT_DEC instead of "%ld". (encode_type): Handle the 'const' qualifier here. (objc_parmlist): New global variable, sued by objc_push_parm and objc_get_parm_info(). (objc_push_parm, objc_get_parm_info): New functions. (objc_expr_last): Remove function. (synth_self_and_ucmd_args): For instance methods, use the instance type for 'self'; call objc_push_parm() instead of push_parm_decl(). (start_method_def): Do not call push_scope(), declare_parm_level(), pop_scope(), push_parm_decl(), store_parm_decls() or objc_expr_last(); just use objc_push_parm() and objc_get_parm_info(). (comp_method_with_proto): Remove function. (objc_types_are_equivalent): Strip away indirections before comparing underlying types. (comp_proto_with_proto): Do not call groktypename(); types are no longer in raw declspec format. (objc_start_function): New function. (really_start_method): Call comp_proto_with_proto() instead of comp_method_with_proto(); call objc_start_function() instead of hand-crafting a function declarator. (continue_method_def, objc_expand_function_end): Remove functions. (get_super_receiver): Call objc_get_current_scope() instead of get_current_scope(); reference 'super_class' field (instead of 'class'). (finish_method_def): Rename to objc_finish_method_definition() and add a function decl parameter; move method encoding call from objc_expand_function_end(). (is_complex_decl, adorn_decl, gen_declarator, gen_declspecs, gen_declaration_1): Remove functions. (tmpbuf, RAW_DECLSPEC): Remove. (gen_declaration): Remove second parameter; simplify to deal with TYPE_P nodes instead of raw declspecs. (gen_type_name, gen_type_name_0): New functions. (gen_method_decl): Remove second parameter; call gen_type_name() instead of gen_declaration_1(). (dump_interface): Adjust calls to gen_declaration() and gen_method_decl(); do not allocate a separate string buffer. (init_objc): Allocate a larger string buffer to accommodate dump_interface(); adjust call to build_module_descriptor(); add call to build_module_initializer_routine() for the GNU runtime. (generate_classref_translation_entry): Do not call start_decl(); call finish_var_decl() instead of finish_decl(); call convert() instead of build_c_cast(). * objc-act.h (CLASS_OWN_IVARS): Remove accessor. (CLASS_BINFO_ELTS): Reduce from 6 to 5, now that CLASS_OWN_IVARS is gone. (OCTI_GNU_INIT_DECL, GNU_INIT_decl): New. (OCTI_ELLIPSIS_NODE, objc_ellipsis_node): Remove. (OCTI_ID_ID, id_type, objc_id_id): Rename to OCTI_ID_NAME, objc_object_type and objc_object_name, respectively. (OCTI_CLS_REF, OCTI_CLASS_NAME, objc_class_reference, objc_class_name): New. (IS_CLASS): New macro. (IS_ID, IS_SUPER): Robustify. (OCTI_EXECCLASS_DECL, execclass_decl): New. (finish_file, start_class, continue_class, finish_class, start_method_def, continue_method_def, finish_method_def, start_protocol, finish_protocol, objc_build_throw_stmt, objc_build_try_catch_finally_stmt, objc_build_synchronized_prologue, objc_build_synchronized_epilogue, objc_build_try_prologue, objc_build_try_epilogue, objc_build_catch_stmt, objc_build_catch_epilogue, objc_build_finally_prologue, objc_build_finally_epilogue, is_ivar, is_private, is_public, add_instance_variable, objc_add_method, get_super_receiver, objc_clear_super_receiver, get_class_ivars_from_name, get_class_reference, get_static_reference, get_object_reference, build_message_expr, finish_message_expr, build_selector_expr, build_ivar_reference, build_keyword_decl, build_method_decl, build_protocol_expr, build_objc_string_object, objc_declare_alias, objc_declare_class, objc_declare_protocols, objc_comptypes, objc_check_decl, build_encode_expr): Remove prototypes. (imp_count, cat_count): Make GGC-aware. (OBJC_SET_TYPE_NAME): New macro. From-SVN: r87168
2004-09-08 02:49:44 +02:00
/* long version; */
field_decl = create_field_decl (long_integer_type_node, "version");
1992-01-18 00:15:38 +01:00
field_decl_chain = field_decl;
Makefile.in (c-parse.o): Depend on $(C_COMMON_H). [gcc/ChangeLog] 2004-09-07 Ziemowit Laski <zlaski@apple.com> * Makefile.in (c-parse.o): Depend on $(C_COMMON_H). * c-parse.in: Include c-common.h instead of objc-act.h. (ivar_decl_list, ivar_decls, ivar_decl, ivars, ivar_declarator, myparms, myparm): Remove %type declarations. (methodtype, optparms, OBJC_TYPE_QUAL, objc_quals, objc_qual, objc_typename, objc_try_catch_stmt, optellipsis): Add %type declarations. (objc_inherit_code, objc_public_flag): Remove. (typespec_nonreserved_nonattr): Call objc_get_protocol_qualified_type() instead of get_static_reference() and get_protocol_reference(). (stmt_nocomp): Call grokparm() on @catch parameter. (objcdef): Move semantic action to objc_finish_implementation(). (classdef): Move semantic action to objc_start_class_interface(), objc_continue_interface(), objc_finish_interface(), objc_start_class_implementation(), objc_continue_implementation(), objc_start_category_interface() and objc_start_category_implementation(). (protocoldef): Move semantic actions to objc_start_protocol() and objc_finish_interface(). (ivar_decl_list): Remove nonterminal. (visibility_spec): Move semantic actions to objc_set_visibility(). (ivar_decls): Remove assignment to $$. (ivar_decl): Rephrase in terms of component_decl; call objc_add_instance_variable(). (ivars, ivar_declarator): Remove nonterminals. (opt_semi): New nonterminal. (methodtype): Remove semantic actions. (methoddef): Move semantic actions to objc_set_method_type(), objc_start_method_definition() and objc_finish_method_definition(). (methodproto): Move semantic actions to objc_set_method_type() and objc_add_method_declaration(). (methoddecl): Use objc_typename instead of typename; move semantic actions to objc_build_method_signature(). (optarglist, myxdecls, mydecl, myparms, myparm): Remove nonterminals. (optparmlist): Express in terms of optparms and optellipsis. (optparms, optellipsis, objc_qual, objc_quals, objc_typename): New nonterminals. (keyworddecl): Use objc_typename instead of typename. (rid_to_yy): Mark RID_IN, RID_OUT, RID_INOUT, RID_BYCOPY, RID_BYREF and RID_ONEWAY as returning OBJC_TYPE_QUAL to yyparse(). [gcc/objc/ChangeLog] 2004-09-07 Ziemowit Laski <zlaski@apple.com> * Make-lang.in (objc/objc-parse.o): Depend on $(C_COMMON_H) instead of objc/objc-act.h. (objc/objc-act.o): Depend on $(HASHTAB_H). * objc-act.c: Include hashtab.h; in ObjC++ mode, include cp-tree.h and objcp-decl.h instead of c-tree.h. (build_module_descriptor, get_class_ivars, synth_id_with_class_suffix, error_with_ivar, gen_method_decl, gen_declaration, setup_string_decl, build_protocol_template): Adjust prototypes. (build_module_initializer_routine, start_class, continue_class, finish_class, start_method_def, objc_start_function, start_protocol, build_method_decl, objc_add_method, add_instance_variable, build_ivar_reference, is_ivar, is_private, get_super_receiver, build_selector_table_decl, objc_push_parm, objc_get_parm_info, gen_type_name, gen_type_name_0, start_var_decl, finish_var_decl, create_field_decl): New prototypes. (objc_expand_function_end, comp_method_with_proto, objc_expr_last, gen_declaration_1, gen_declarator, is_complex_decl, adorn_decl, define_decl, create_builtin_decl, gen_declspecs): Remove prototypes. (TYPE_ID): Rename to OBJECT_TYPEDEF_NAME. (CLASS_TYPEDEF_NAME): New. (TAG_EXECCLASS): Change from a global variable to a #define. (TAG_RETURN_STRUCT): Delete. (TAG_GNUINIT): New, holds '__objc_gnu_init' name. (objc_inherit_code, objc_public_flag): New, moved from c-parse.in. (string_descriptor): New struct. (string_htab): New hash table. (string_hash, string_eq): New prototypes. (generate_struct_by_value_array): Call create_field_decl() instead of create_builtin_decl(). (objc_init): Do not initialize objc_ellipsis_node or TAG_EXECCLASS; In ObjC++ mode, call cxx_init() instead of c_objc_common_init(). (objc_finish_file): In ObjC++, call instantiate_pending_templates() and cp_finish_file(). (define_decl, get_static_reference, get_protocol_reference, create_builtin_decl): Remove functions. (objc_start_class_interface, objc_start_category_interface, objc_start_protocol, objc_continue_interface, objc_finish_interface, objc_start_class_implementation, objc_start_category_implementation, objc_continue_implementation, objc_finish_implementation, objc_set_visibility, objc_set_method_type, objc_build_method_signature, objc_add_method_declaration, objc_start_method_definition, objc_add_instance_variable, objc_get_protocol_qualified_type, create_field_decl, start_var_decl, finish_var_decl): New functions. (setup_string_decl): Simplify since it is only called once. (synth_module_prologue): Call build_class_template(); predefine 'id' and 'Class' as typedefs; rename 'temp_type' to 'type'; disable debug hooks for duration of function; fix GNU runtime messenger signatures to correspond to reality; forward-declare '__objc_exec_class' for the GNU runtime; call build_selector_table_decl(); in ObjC++ mode, generate 'extern "C" { ... }' wrappers around synthesized declarations; call build_protocol_template() and build_category_template(). (string_hash, string_eq): New functions. (objc_build_string_object): Check metaclass correctness only once; store string literals in hash table. (objc_build_constructor): Do not convert initializer elements; adjust for ObjC++ impedance mismatch. (build_objc_symtab_template): Call create_field_decl() instead of create_builtin_decl(). (init_objc_symtab): Add missing conversion to initializer element. (build_metadata_decl): Call start_var_decl() instead of define_decl(). (generate_objc_symtab_decl): Do not call build_category_template(); call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(). (build_module_descriptor): Call create_field_decl() instead of grokfield(); call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(); always mark module descriptor as used; move GNU runtime-specific functionality to build_module_initializer_routine(). (build_module_initializer_routine): New function, broken off of build_module_descriptor(). (objc_static_init_needed_p, objc_generate_static_init_call): New functions. (generate_static_references, generate_strings, build_selector_translation_table, generate_descriptor_table, generate_ivars_list, generate_dispatch_table, generate_category): Call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(); build a type directly instead of via groktypename(). (build_selector_reference_decl, build_selector_table_decl, build_class_reference_decl, build_protocol_reference, generate_objc_image_info): Call start_var_decl() instead of build_decl(). (build_selector_reference): For GNU runtime, do not call build_selector_reference_decl(). (build_selector, build_typed_selector_reference): Always convert result to the selector type. (add_objc_string): Cast return value to 'char *'. (build_method_prototype_template, build_selector_template, build_method_template): Use actual selector type for fields pointing to selectors. (finish_objc): For GNU runtime, call build_module_initializer_routine() after build_module_descriptor(). (generate_protocol_list, generate_shared_structures): Call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(); build a type directly instead of via groktypename(). (synth_id_with_class_suffix): Return a string. (get_arg_type_list): For instance methods, use the instance type for 'self'; do not call groktypename_in_parm_context(). (build_objc_string_decl): Squash redeclaration errors in ObjC++. (objc_is_class_name): Use OBJC_TYPE_NAME instead of TYPE_NAME; handle RECORD_TYPEs in ObjC as well as ObjC++. (objc_is_id): New function. (objc_is_object_ptr): Return the canonical type node. (objc_get_class_ivars): Simplify using get_class_ivars(). (get_class_ivars): Remove second parameter; create a fresh copy of the ivar list for each call; do not check for existence of super class. (objc_eh_runtime_type): Mark #ifndef OBJCPLUS. (objc_init_exceptions): When using SJLJ-style exceptions, require the use of '-fobjc-exceptions' flag; do not require it for DWARF-style exceptions. (objc_build_exc_ptr, next_sjlj_build_try_catch_finally): Use objc_object_type instead of objc_id_type. (objc_begin_catch_clause): Convert the incoming PARM_DECL into a VAR_DECL before placing it in the appropriate scope; do not call define_decl(); adjust call to c_begin_compound_stmt(); use objc_object_type instead of objc_id_type. (build_next_objc_exception_stuff): Call create_field_decl() instead of create_builtin_decl(); construct type directly instead of calling groktypename(); use OBJC_VOID_AT_END to mark end of function parameters. (build_private_template): Adjust call to get_class_ivars(); build a type directly instead of via groktypename(). (build_protocol_template, build_method_prototype_list_template, build_method_prototype_template, build_category_template, build_selector_template, build_class_template, build_super_template, build_ivar_template, build_ivar_list_template, build_method_list_template, build_method_template): Call create_field_decl() instead of grokfield(). (objc_method_parm_type): Do not call groktypename(). (generate_descriptor_table): Call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(). (generate_method_descriptors, build_protocol_initializer, generate_dispatch_tables, build_category_initializer, build_shared_structure_initializer): Do not call groktypename(). (generate_protocols): Call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(); do not call groktypename(). (error_with_ivar): Remove last parameter. (check_ivars): Do not iterate ovar CLASS_RAW_IVARS lists in addition to CLASS_IVARS lists; adjust calls to error_with_ivar(). (generate_ivar_lists): Convert one of the initializer elements; do not call groktypename(). (get_arg_type_list, start_method_def, gen_method_def): Account for new representation of variable arguments and '...' in Objective-C methods; add Objective-C++ impedance matching code. (is_objc_type_qualifier): Remove function. (adjust_type_for_id_default): Simplify; there is no longer a need to wade through declspecs. (lookup_interface, start_class, continue_class, finish_class, start_method_def, start_protocol, build_method_decl, objc_add_method, add_instance_variable, build_ivar_reference, is_ivar, is_private, get_super_receiver, objc_build_finally_epilogue): Make into static functions. (receiver_is_class_object): Use new IS_CLASS() macro. (objc_build_message_expr): Tweak ObjC++ message argument handling; call objc_finish_message_expr() instead of finish_message_expr(). (finish_message_expr): Rename to objc_finish_message_expr(); use OBJC_TYPE_NAME and OBJC_SET_TYPE_NAME macros instead of TYPE_NAME. call gen_type_name() instead of gen_declaration(); call objc_is_id() instead of using IS_ID and IS_CLASS; Use objc_class_name instead of calling get_identifier("Class"); handle CONVERT_EXPRs in receiver. (build_objc_method_call, warn_with_method): Do not call groktypename(). (build_ivar_reference): Call convert() instead of clobbering in a type. (hash_init): Initialize string_htab hash table. (add_instance_variable): Simplify parameter list; do not call grokfield(); do not populate CLASS_IVARS list. (start_class): Check for the existence of super class, if one was specified. (continue_class): Use CLASS_RAW_IVARS rather than CLASS_IVARS; do not call build_class_template(); adjust call to get_class_ivars(); call build_decl(), pushdecl() and finish_decl() instead of define_decl(). (finish_class): Call build_decl(), pushdecl() and finish_decl() instead of define_decl(). (add_protocols): Use PROTOCOL_BINFO_ELTS for the tree vector size. (start_protocol): Do not call build_protocol_template(); use PROTOCOL_BINFO_ELTS for the tree vector size. (encode_type_qualifiers): Do not handle the 'const' qualifier here. (encode_pointer): Encode 'const char *' as 'r*', for backwards compatibility. (encode_array): Use HOST_WIDE_INT_PRINT_DEC instead of "%ld". (encode_type): Handle the 'const' qualifier here. (objc_parmlist): New global variable, sued by objc_push_parm and objc_get_parm_info(). (objc_push_parm, objc_get_parm_info): New functions. (objc_expr_last): Remove function. (synth_self_and_ucmd_args): For instance methods, use the instance type for 'self'; call objc_push_parm() instead of push_parm_decl(). (start_method_def): Do not call push_scope(), declare_parm_level(), pop_scope(), push_parm_decl(), store_parm_decls() or objc_expr_last(); just use objc_push_parm() and objc_get_parm_info(). (comp_method_with_proto): Remove function. (objc_types_are_equivalent): Strip away indirections before comparing underlying types. (comp_proto_with_proto): Do not call groktypename(); types are no longer in raw declspec format. (objc_start_function): New function. (really_start_method): Call comp_proto_with_proto() instead of comp_method_with_proto(); call objc_start_function() instead of hand-crafting a function declarator. (continue_method_def, objc_expand_function_end): Remove functions. (get_super_receiver): Call objc_get_current_scope() instead of get_current_scope(); reference 'super_class' field (instead of 'class'). (finish_method_def): Rename to objc_finish_method_definition() and add a function decl parameter; move method encoding call from objc_expand_function_end(). (is_complex_decl, adorn_decl, gen_declarator, gen_declspecs, gen_declaration_1): Remove functions. (tmpbuf, RAW_DECLSPEC): Remove. (gen_declaration): Remove second parameter; simplify to deal with TYPE_P nodes instead of raw declspecs. (gen_type_name, gen_type_name_0): New functions. (gen_method_decl): Remove second parameter; call gen_type_name() instead of gen_declaration_1(). (dump_interface): Adjust calls to gen_declaration() and gen_method_decl(); do not allocate a separate string buffer. (init_objc): Allocate a larger string buffer to accommodate dump_interface(); adjust call to build_module_descriptor(); add call to build_module_initializer_routine() for the GNU runtime. (generate_classref_translation_entry): Do not call start_decl(); call finish_var_decl() instead of finish_decl(); call convert() instead of build_c_cast(). * objc-act.h (CLASS_OWN_IVARS): Remove accessor. (CLASS_BINFO_ELTS): Reduce from 6 to 5, now that CLASS_OWN_IVARS is gone. (OCTI_GNU_INIT_DECL, GNU_INIT_decl): New. (OCTI_ELLIPSIS_NODE, objc_ellipsis_node): Remove. (OCTI_ID_ID, id_type, objc_id_id): Rename to OCTI_ID_NAME, objc_object_type and objc_object_name, respectively. (OCTI_CLS_REF, OCTI_CLASS_NAME, objc_class_reference, objc_class_name): New. (IS_CLASS): New macro. (IS_ID, IS_SUPER): Robustify. (OCTI_EXECCLASS_DECL, execclass_decl): New. (finish_file, start_class, continue_class, finish_class, start_method_def, continue_method_def, finish_method_def, start_protocol, finish_protocol, objc_build_throw_stmt, objc_build_try_catch_finally_stmt, objc_build_synchronized_prologue, objc_build_synchronized_epilogue, objc_build_try_prologue, objc_build_try_epilogue, objc_build_catch_stmt, objc_build_catch_epilogue, objc_build_finally_prologue, objc_build_finally_epilogue, is_ivar, is_private, is_public, add_instance_variable, objc_add_method, get_super_receiver, objc_clear_super_receiver, get_class_ivars_from_name, get_class_reference, get_static_reference, get_object_reference, build_message_expr, finish_message_expr, build_selector_expr, build_ivar_reference, build_keyword_decl, build_method_decl, build_protocol_expr, build_objc_string_object, objc_declare_alias, objc_declare_class, objc_declare_protocols, objc_comptypes, objc_check_decl, build_encode_expr): Remove prototypes. (imp_count, cat_count): Make GGC-aware. (OBJC_SET_TYPE_NAME): New macro. From-SVN: r87168
2004-09-08 02:49:44 +02:00
/* long size; */
field_decl = create_field_decl (long_integer_type_node, "size");
1992-01-18 00:15:38 +01:00
chainon (field_decl_chain, field_decl);
Makefile.in (c-parse.o): Depend on $(C_COMMON_H). [gcc/ChangeLog] 2004-09-07 Ziemowit Laski <zlaski@apple.com> * Makefile.in (c-parse.o): Depend on $(C_COMMON_H). * c-parse.in: Include c-common.h instead of objc-act.h. (ivar_decl_list, ivar_decls, ivar_decl, ivars, ivar_declarator, myparms, myparm): Remove %type declarations. (methodtype, optparms, OBJC_TYPE_QUAL, objc_quals, objc_qual, objc_typename, objc_try_catch_stmt, optellipsis): Add %type declarations. (objc_inherit_code, objc_public_flag): Remove. (typespec_nonreserved_nonattr): Call objc_get_protocol_qualified_type() instead of get_static_reference() and get_protocol_reference(). (stmt_nocomp): Call grokparm() on @catch parameter. (objcdef): Move semantic action to objc_finish_implementation(). (classdef): Move semantic action to objc_start_class_interface(), objc_continue_interface(), objc_finish_interface(), objc_start_class_implementation(), objc_continue_implementation(), objc_start_category_interface() and objc_start_category_implementation(). (protocoldef): Move semantic actions to objc_start_protocol() and objc_finish_interface(). (ivar_decl_list): Remove nonterminal. (visibility_spec): Move semantic actions to objc_set_visibility(). (ivar_decls): Remove assignment to $$. (ivar_decl): Rephrase in terms of component_decl; call objc_add_instance_variable(). (ivars, ivar_declarator): Remove nonterminals. (opt_semi): New nonterminal. (methodtype): Remove semantic actions. (methoddef): Move semantic actions to objc_set_method_type(), objc_start_method_definition() and objc_finish_method_definition(). (methodproto): Move semantic actions to objc_set_method_type() and objc_add_method_declaration(). (methoddecl): Use objc_typename instead of typename; move semantic actions to objc_build_method_signature(). (optarglist, myxdecls, mydecl, myparms, myparm): Remove nonterminals. (optparmlist): Express in terms of optparms and optellipsis. (optparms, optellipsis, objc_qual, objc_quals, objc_typename): New nonterminals. (keyworddecl): Use objc_typename instead of typename. (rid_to_yy): Mark RID_IN, RID_OUT, RID_INOUT, RID_BYCOPY, RID_BYREF and RID_ONEWAY as returning OBJC_TYPE_QUAL to yyparse(). [gcc/objc/ChangeLog] 2004-09-07 Ziemowit Laski <zlaski@apple.com> * Make-lang.in (objc/objc-parse.o): Depend on $(C_COMMON_H) instead of objc/objc-act.h. (objc/objc-act.o): Depend on $(HASHTAB_H). * objc-act.c: Include hashtab.h; in ObjC++ mode, include cp-tree.h and objcp-decl.h instead of c-tree.h. (build_module_descriptor, get_class_ivars, synth_id_with_class_suffix, error_with_ivar, gen_method_decl, gen_declaration, setup_string_decl, build_protocol_template): Adjust prototypes. (build_module_initializer_routine, start_class, continue_class, finish_class, start_method_def, objc_start_function, start_protocol, build_method_decl, objc_add_method, add_instance_variable, build_ivar_reference, is_ivar, is_private, get_super_receiver, build_selector_table_decl, objc_push_parm, objc_get_parm_info, gen_type_name, gen_type_name_0, start_var_decl, finish_var_decl, create_field_decl): New prototypes. (objc_expand_function_end, comp_method_with_proto, objc_expr_last, gen_declaration_1, gen_declarator, is_complex_decl, adorn_decl, define_decl, create_builtin_decl, gen_declspecs): Remove prototypes. (TYPE_ID): Rename to OBJECT_TYPEDEF_NAME. (CLASS_TYPEDEF_NAME): New. (TAG_EXECCLASS): Change from a global variable to a #define. (TAG_RETURN_STRUCT): Delete. (TAG_GNUINIT): New, holds '__objc_gnu_init' name. (objc_inherit_code, objc_public_flag): New, moved from c-parse.in. (string_descriptor): New struct. (string_htab): New hash table. (string_hash, string_eq): New prototypes. (generate_struct_by_value_array): Call create_field_decl() instead of create_builtin_decl(). (objc_init): Do not initialize objc_ellipsis_node or TAG_EXECCLASS; In ObjC++ mode, call cxx_init() instead of c_objc_common_init(). (objc_finish_file): In ObjC++, call instantiate_pending_templates() and cp_finish_file(). (define_decl, get_static_reference, get_protocol_reference, create_builtin_decl): Remove functions. (objc_start_class_interface, objc_start_category_interface, objc_start_protocol, objc_continue_interface, objc_finish_interface, objc_start_class_implementation, objc_start_category_implementation, objc_continue_implementation, objc_finish_implementation, objc_set_visibility, objc_set_method_type, objc_build_method_signature, objc_add_method_declaration, objc_start_method_definition, objc_add_instance_variable, objc_get_protocol_qualified_type, create_field_decl, start_var_decl, finish_var_decl): New functions. (setup_string_decl): Simplify since it is only called once. (synth_module_prologue): Call build_class_template(); predefine 'id' and 'Class' as typedefs; rename 'temp_type' to 'type'; disable debug hooks for duration of function; fix GNU runtime messenger signatures to correspond to reality; forward-declare '__objc_exec_class' for the GNU runtime; call build_selector_table_decl(); in ObjC++ mode, generate 'extern "C" { ... }' wrappers around synthesized declarations; call build_protocol_template() and build_category_template(). (string_hash, string_eq): New functions. (objc_build_string_object): Check metaclass correctness only once; store string literals in hash table. (objc_build_constructor): Do not convert initializer elements; adjust for ObjC++ impedance mismatch. (build_objc_symtab_template): Call create_field_decl() instead of create_builtin_decl(). (init_objc_symtab): Add missing conversion to initializer element. (build_metadata_decl): Call start_var_decl() instead of define_decl(). (generate_objc_symtab_decl): Do not call build_category_template(); call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(). (build_module_descriptor): Call create_field_decl() instead of grokfield(); call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(); always mark module descriptor as used; move GNU runtime-specific functionality to build_module_initializer_routine(). (build_module_initializer_routine): New function, broken off of build_module_descriptor(). (objc_static_init_needed_p, objc_generate_static_init_call): New functions. (generate_static_references, generate_strings, build_selector_translation_table, generate_descriptor_table, generate_ivars_list, generate_dispatch_table, generate_category): Call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(); build a type directly instead of via groktypename(). (build_selector_reference_decl, build_selector_table_decl, build_class_reference_decl, build_protocol_reference, generate_objc_image_info): Call start_var_decl() instead of build_decl(). (build_selector_reference): For GNU runtime, do not call build_selector_reference_decl(). (build_selector, build_typed_selector_reference): Always convert result to the selector type. (add_objc_string): Cast return value to 'char *'. (build_method_prototype_template, build_selector_template, build_method_template): Use actual selector type for fields pointing to selectors. (finish_objc): For GNU runtime, call build_module_initializer_routine() after build_module_descriptor(). (generate_protocol_list, generate_shared_structures): Call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(); build a type directly instead of via groktypename(). (synth_id_with_class_suffix): Return a string. (get_arg_type_list): For instance methods, use the instance type for 'self'; do not call groktypename_in_parm_context(). (build_objc_string_decl): Squash redeclaration errors in ObjC++. (objc_is_class_name): Use OBJC_TYPE_NAME instead of TYPE_NAME; handle RECORD_TYPEs in ObjC as well as ObjC++. (objc_is_id): New function. (objc_is_object_ptr): Return the canonical type node. (objc_get_class_ivars): Simplify using get_class_ivars(). (get_class_ivars): Remove second parameter; create a fresh copy of the ivar list for each call; do not check for existence of super class. (objc_eh_runtime_type): Mark #ifndef OBJCPLUS. (objc_init_exceptions): When using SJLJ-style exceptions, require the use of '-fobjc-exceptions' flag; do not require it for DWARF-style exceptions. (objc_build_exc_ptr, next_sjlj_build_try_catch_finally): Use objc_object_type instead of objc_id_type. (objc_begin_catch_clause): Convert the incoming PARM_DECL into a VAR_DECL before placing it in the appropriate scope; do not call define_decl(); adjust call to c_begin_compound_stmt(); use objc_object_type instead of objc_id_type. (build_next_objc_exception_stuff): Call create_field_decl() instead of create_builtin_decl(); construct type directly instead of calling groktypename(); use OBJC_VOID_AT_END to mark end of function parameters. (build_private_template): Adjust call to get_class_ivars(); build a type directly instead of via groktypename(). (build_protocol_template, build_method_prototype_list_template, build_method_prototype_template, build_category_template, build_selector_template, build_class_template, build_super_template, build_ivar_template, build_ivar_list_template, build_method_list_template, build_method_template): Call create_field_decl() instead of grokfield(). (objc_method_parm_type): Do not call groktypename(). (generate_descriptor_table): Call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(). (generate_method_descriptors, build_protocol_initializer, generate_dispatch_tables, build_category_initializer, build_shared_structure_initializer): Do not call groktypename(). (generate_protocols): Call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(); do not call groktypename(). (error_with_ivar): Remove last parameter. (check_ivars): Do not iterate ovar CLASS_RAW_IVARS lists in addition to CLASS_IVARS lists; adjust calls to error_with_ivar(). (generate_ivar_lists): Convert one of the initializer elements; do not call groktypename(). (get_arg_type_list, start_method_def, gen_method_def): Account for new representation of variable arguments and '...' in Objective-C methods; add Objective-C++ impedance matching code. (is_objc_type_qualifier): Remove function. (adjust_type_for_id_default): Simplify; there is no longer a need to wade through declspecs. (lookup_interface, start_class, continue_class, finish_class, start_method_def, start_protocol, build_method_decl, objc_add_method, add_instance_variable, build_ivar_reference, is_ivar, is_private, get_super_receiver, objc_build_finally_epilogue): Make into static functions. (receiver_is_class_object): Use new IS_CLASS() macro. (objc_build_message_expr): Tweak ObjC++ message argument handling; call objc_finish_message_expr() instead of finish_message_expr(). (finish_message_expr): Rename to objc_finish_message_expr(); use OBJC_TYPE_NAME and OBJC_SET_TYPE_NAME macros instead of TYPE_NAME. call gen_type_name() instead of gen_declaration(); call objc_is_id() instead of using IS_ID and IS_CLASS; Use objc_class_name instead of calling get_identifier("Class"); handle CONVERT_EXPRs in receiver. (build_objc_method_call, warn_with_method): Do not call groktypename(). (build_ivar_reference): Call convert() instead of clobbering in a type. (hash_init): Initialize string_htab hash table. (add_instance_variable): Simplify parameter list; do not call grokfield(); do not populate CLASS_IVARS list. (start_class): Check for the existence of super class, if one was specified. (continue_class): Use CLASS_RAW_IVARS rather than CLASS_IVARS; do not call build_class_template(); adjust call to get_class_ivars(); call build_decl(), pushdecl() and finish_decl() instead of define_decl(). (finish_class): Call build_decl(), pushdecl() and finish_decl() instead of define_decl(). (add_protocols): Use PROTOCOL_BINFO_ELTS for the tree vector size. (start_protocol): Do not call build_protocol_template(); use PROTOCOL_BINFO_ELTS for the tree vector size. (encode_type_qualifiers): Do not handle the 'const' qualifier here. (encode_pointer): Encode 'const char *' as 'r*', for backwards compatibility. (encode_array): Use HOST_WIDE_INT_PRINT_DEC instead of "%ld". (encode_type): Handle the 'const' qualifier here. (objc_parmlist): New global variable, sued by objc_push_parm and objc_get_parm_info(). (objc_push_parm, objc_get_parm_info): New functions. (objc_expr_last): Remove function. (synth_self_and_ucmd_args): For instance methods, use the instance type for 'self'; call objc_push_parm() instead of push_parm_decl(). (start_method_def): Do not call push_scope(), declare_parm_level(), pop_scope(), push_parm_decl(), store_parm_decls() or objc_expr_last(); just use objc_push_parm() and objc_get_parm_info(). (comp_method_with_proto): Remove function. (objc_types_are_equivalent): Strip away indirections before comparing underlying types. (comp_proto_with_proto): Do not call groktypename(); types are no longer in raw declspec format. (objc_start_function): New function. (really_start_method): Call comp_proto_with_proto() instead of comp_method_with_proto(); call objc_start_function() instead of hand-crafting a function declarator. (continue_method_def, objc_expand_function_end): Remove functions. (get_super_receiver): Call objc_get_current_scope() instead of get_current_scope(); reference 'super_class' field (instead of 'class'). (finish_method_def): Rename to objc_finish_method_definition() and add a function decl parameter; move method encoding call from objc_expand_function_end(). (is_complex_decl, adorn_decl, gen_declarator, gen_declspecs, gen_declaration_1): Remove functions. (tmpbuf, RAW_DECLSPEC): Remove. (gen_declaration): Remove second parameter; simplify to deal with TYPE_P nodes instead of raw declspecs. (gen_type_name, gen_type_name_0): New functions. (gen_method_decl): Remove second parameter; call gen_type_name() instead of gen_declaration_1(). (dump_interface): Adjust calls to gen_declaration() and gen_method_decl(); do not allocate a separate string buffer. (init_objc): Allocate a larger string buffer to accommodate dump_interface(); adjust call to build_module_descriptor(); add call to build_module_initializer_routine() for the GNU runtime. (generate_classref_translation_entry): Do not call start_decl(); call finish_var_decl() instead of finish_decl(); call convert() instead of build_c_cast(). * objc-act.h (CLASS_OWN_IVARS): Remove accessor. (CLASS_BINFO_ELTS): Reduce from 6 to 5, now that CLASS_OWN_IVARS is gone. (OCTI_GNU_INIT_DECL, GNU_INIT_decl): New. (OCTI_ELLIPSIS_NODE, objc_ellipsis_node): Remove. (OCTI_ID_ID, id_type, objc_id_id): Rename to OCTI_ID_NAME, objc_object_type and objc_object_name, respectively. (OCTI_CLS_REF, OCTI_CLASS_NAME, objc_class_reference, objc_class_name): New. (IS_CLASS): New macro. (IS_ID, IS_SUPER): Robustify. (OCTI_EXECCLASS_DECL, execclass_decl): New. (finish_file, start_class, continue_class, finish_class, start_method_def, continue_method_def, finish_method_def, start_protocol, finish_protocol, objc_build_throw_stmt, objc_build_try_catch_finally_stmt, objc_build_synchronized_prologue, objc_build_synchronized_epilogue, objc_build_try_prologue, objc_build_try_epilogue, objc_build_catch_stmt, objc_build_catch_epilogue, objc_build_finally_prologue, objc_build_finally_epilogue, is_ivar, is_private, is_public, add_instance_variable, objc_add_method, get_super_receiver, objc_clear_super_receiver, get_class_ivars_from_name, get_class_reference, get_static_reference, get_object_reference, build_message_expr, finish_message_expr, build_selector_expr, build_ivar_reference, build_keyword_decl, build_method_decl, build_protocol_expr, build_objc_string_object, objc_declare_alias, objc_declare_class, objc_declare_protocols, objc_comptypes, objc_check_decl, build_encode_expr): Remove prototypes. (imp_count, cat_count): Make GGC-aware. (OBJC_SET_TYPE_NAME): New macro. From-SVN: r87168
2004-09-08 02:49:44 +02:00
/* char *name; */
field_decl = create_field_decl (string_type_node, "name");
1992-01-18 00:15:38 +01:00
chainon (field_decl_chain, field_decl);
Makefile.in (c-parse.o): Depend on $(C_COMMON_H). [gcc/ChangeLog] 2004-09-07 Ziemowit Laski <zlaski@apple.com> * Makefile.in (c-parse.o): Depend on $(C_COMMON_H). * c-parse.in: Include c-common.h instead of objc-act.h. (ivar_decl_list, ivar_decls, ivar_decl, ivars, ivar_declarator, myparms, myparm): Remove %type declarations. (methodtype, optparms, OBJC_TYPE_QUAL, objc_quals, objc_qual, objc_typename, objc_try_catch_stmt, optellipsis): Add %type declarations. (objc_inherit_code, objc_public_flag): Remove. (typespec_nonreserved_nonattr): Call objc_get_protocol_qualified_type() instead of get_static_reference() and get_protocol_reference(). (stmt_nocomp): Call grokparm() on @catch parameter. (objcdef): Move semantic action to objc_finish_implementation(). (classdef): Move semantic action to objc_start_class_interface(), objc_continue_interface(), objc_finish_interface(), objc_start_class_implementation(), objc_continue_implementation(), objc_start_category_interface() and objc_start_category_implementation(). (protocoldef): Move semantic actions to objc_start_protocol() and objc_finish_interface(). (ivar_decl_list): Remove nonterminal. (visibility_spec): Move semantic actions to objc_set_visibility(). (ivar_decls): Remove assignment to $$. (ivar_decl): Rephrase in terms of component_decl; call objc_add_instance_variable(). (ivars, ivar_declarator): Remove nonterminals. (opt_semi): New nonterminal. (methodtype): Remove semantic actions. (methoddef): Move semantic actions to objc_set_method_type(), objc_start_method_definition() and objc_finish_method_definition(). (methodproto): Move semantic actions to objc_set_method_type() and objc_add_method_declaration(). (methoddecl): Use objc_typename instead of typename; move semantic actions to objc_build_method_signature(). (optarglist, myxdecls, mydecl, myparms, myparm): Remove nonterminals. (optparmlist): Express in terms of optparms and optellipsis. (optparms, optellipsis, objc_qual, objc_quals, objc_typename): New nonterminals. (keyworddecl): Use objc_typename instead of typename. (rid_to_yy): Mark RID_IN, RID_OUT, RID_INOUT, RID_BYCOPY, RID_BYREF and RID_ONEWAY as returning OBJC_TYPE_QUAL to yyparse(). [gcc/objc/ChangeLog] 2004-09-07 Ziemowit Laski <zlaski@apple.com> * Make-lang.in (objc/objc-parse.o): Depend on $(C_COMMON_H) instead of objc/objc-act.h. (objc/objc-act.o): Depend on $(HASHTAB_H). * objc-act.c: Include hashtab.h; in ObjC++ mode, include cp-tree.h and objcp-decl.h instead of c-tree.h. (build_module_descriptor, get_class_ivars, synth_id_with_class_suffix, error_with_ivar, gen_method_decl, gen_declaration, setup_string_decl, build_protocol_template): Adjust prototypes. (build_module_initializer_routine, start_class, continue_class, finish_class, start_method_def, objc_start_function, start_protocol, build_method_decl, objc_add_method, add_instance_variable, build_ivar_reference, is_ivar, is_private, get_super_receiver, build_selector_table_decl, objc_push_parm, objc_get_parm_info, gen_type_name, gen_type_name_0, start_var_decl, finish_var_decl, create_field_decl): New prototypes. (objc_expand_function_end, comp_method_with_proto, objc_expr_last, gen_declaration_1, gen_declarator, is_complex_decl, adorn_decl, define_decl, create_builtin_decl, gen_declspecs): Remove prototypes. (TYPE_ID): Rename to OBJECT_TYPEDEF_NAME. (CLASS_TYPEDEF_NAME): New. (TAG_EXECCLASS): Change from a global variable to a #define. (TAG_RETURN_STRUCT): Delete. (TAG_GNUINIT): New, holds '__objc_gnu_init' name. (objc_inherit_code, objc_public_flag): New, moved from c-parse.in. (string_descriptor): New struct. (string_htab): New hash table. (string_hash, string_eq): New prototypes. (generate_struct_by_value_array): Call create_field_decl() instead of create_builtin_decl(). (objc_init): Do not initialize objc_ellipsis_node or TAG_EXECCLASS; In ObjC++ mode, call cxx_init() instead of c_objc_common_init(). (objc_finish_file): In ObjC++, call instantiate_pending_templates() and cp_finish_file(). (define_decl, get_static_reference, get_protocol_reference, create_builtin_decl): Remove functions. (objc_start_class_interface, objc_start_category_interface, objc_start_protocol, objc_continue_interface, objc_finish_interface, objc_start_class_implementation, objc_start_category_implementation, objc_continue_implementation, objc_finish_implementation, objc_set_visibility, objc_set_method_type, objc_build_method_signature, objc_add_method_declaration, objc_start_method_definition, objc_add_instance_variable, objc_get_protocol_qualified_type, create_field_decl, start_var_decl, finish_var_decl): New functions. (setup_string_decl): Simplify since it is only called once. (synth_module_prologue): Call build_class_template(); predefine 'id' and 'Class' as typedefs; rename 'temp_type' to 'type'; disable debug hooks for duration of function; fix GNU runtime messenger signatures to correspond to reality; forward-declare '__objc_exec_class' for the GNU runtime; call build_selector_table_decl(); in ObjC++ mode, generate 'extern "C" { ... }' wrappers around synthesized declarations; call build_protocol_template() and build_category_template(). (string_hash, string_eq): New functions. (objc_build_string_object): Check metaclass correctness only once; store string literals in hash table. (objc_build_constructor): Do not convert initializer elements; adjust for ObjC++ impedance mismatch. (build_objc_symtab_template): Call create_field_decl() instead of create_builtin_decl(). (init_objc_symtab): Add missing conversion to initializer element. (build_metadata_decl): Call start_var_decl() instead of define_decl(). (generate_objc_symtab_decl): Do not call build_category_template(); call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(). (build_module_descriptor): Call create_field_decl() instead of grokfield(); call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(); always mark module descriptor as used; move GNU runtime-specific functionality to build_module_initializer_routine(). (build_module_initializer_routine): New function, broken off of build_module_descriptor(). (objc_static_init_needed_p, objc_generate_static_init_call): New functions. (generate_static_references, generate_strings, build_selector_translation_table, generate_descriptor_table, generate_ivars_list, generate_dispatch_table, generate_category): Call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(); build a type directly instead of via groktypename(). (build_selector_reference_decl, build_selector_table_decl, build_class_reference_decl, build_protocol_reference, generate_objc_image_info): Call start_var_decl() instead of build_decl(). (build_selector_reference): For GNU runtime, do not call build_selector_reference_decl(). (build_selector, build_typed_selector_reference): Always convert result to the selector type. (add_objc_string): Cast return value to 'char *'. (build_method_prototype_template, build_selector_template, build_method_template): Use actual selector type for fields pointing to selectors. (finish_objc): For GNU runtime, call build_module_initializer_routine() after build_module_descriptor(). (generate_protocol_list, generate_shared_structures): Call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(); build a type directly instead of via groktypename(). (synth_id_with_class_suffix): Return a string. (get_arg_type_list): For instance methods, use the instance type for 'self'; do not call groktypename_in_parm_context(). (build_objc_string_decl): Squash redeclaration errors in ObjC++. (objc_is_class_name): Use OBJC_TYPE_NAME instead of TYPE_NAME; handle RECORD_TYPEs in ObjC as well as ObjC++. (objc_is_id): New function. (objc_is_object_ptr): Return the canonical type node. (objc_get_class_ivars): Simplify using get_class_ivars(). (get_class_ivars): Remove second parameter; create a fresh copy of the ivar list for each call; do not check for existence of super class. (objc_eh_runtime_type): Mark #ifndef OBJCPLUS. (objc_init_exceptions): When using SJLJ-style exceptions, require the use of '-fobjc-exceptions' flag; do not require it for DWARF-style exceptions. (objc_build_exc_ptr, next_sjlj_build_try_catch_finally): Use objc_object_type instead of objc_id_type. (objc_begin_catch_clause): Convert the incoming PARM_DECL into a VAR_DECL before placing it in the appropriate scope; do not call define_decl(); adjust call to c_begin_compound_stmt(); use objc_object_type instead of objc_id_type. (build_next_objc_exception_stuff): Call create_field_decl() instead of create_builtin_decl(); construct type directly instead of calling groktypename(); use OBJC_VOID_AT_END to mark end of function parameters. (build_private_template): Adjust call to get_class_ivars(); build a type directly instead of via groktypename(). (build_protocol_template, build_method_prototype_list_template, build_method_prototype_template, build_category_template, build_selector_template, build_class_template, build_super_template, build_ivar_template, build_ivar_list_template, build_method_list_template, build_method_template): Call create_field_decl() instead of grokfield(). (objc_method_parm_type): Do not call groktypename(). (generate_descriptor_table): Call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(). (generate_method_descriptors, build_protocol_initializer, generate_dispatch_tables, build_category_initializer, build_shared_structure_initializer): Do not call groktypename(). (generate_protocols): Call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(); do not call groktypename(). (error_with_ivar): Remove last parameter. (check_ivars): Do not iterate ovar CLASS_RAW_IVARS lists in addition to CLASS_IVARS lists; adjust calls to error_with_ivar(). (generate_ivar_lists): Convert one of the initializer elements; do not call groktypename(). (get_arg_type_list, start_method_def, gen_method_def): Account for new representation of variable arguments and '...' in Objective-C methods; add Objective-C++ impedance matching code. (is_objc_type_qualifier): Remove function. (adjust_type_for_id_default): Simplify; there is no longer a need to wade through declspecs. (lookup_interface, start_class, continue_class, finish_class, start_method_def, start_protocol, build_method_decl, objc_add_method, add_instance_variable, build_ivar_reference, is_ivar, is_private, get_super_receiver, objc_build_finally_epilogue): Make into static functions. (receiver_is_class_object): Use new IS_CLASS() macro. (objc_build_message_expr): Tweak ObjC++ message argument handling; call objc_finish_message_expr() instead of finish_message_expr(). (finish_message_expr): Rename to objc_finish_message_expr(); use OBJC_TYPE_NAME and OBJC_SET_TYPE_NAME macros instead of TYPE_NAME. call gen_type_name() instead of gen_declaration(); call objc_is_id() instead of using IS_ID and IS_CLASS; Use objc_class_name instead of calling get_identifier("Class"); handle CONVERT_EXPRs in receiver. (build_objc_method_call, warn_with_method): Do not call groktypename(). (build_ivar_reference): Call convert() instead of clobbering in a type. (hash_init): Initialize string_htab hash table. (add_instance_variable): Simplify parameter list; do not call grokfield(); do not populate CLASS_IVARS list. (start_class): Check for the existence of super class, if one was specified. (continue_class): Use CLASS_RAW_IVARS rather than CLASS_IVARS; do not call build_class_template(); adjust call to get_class_ivars(); call build_decl(), pushdecl() and finish_decl() instead of define_decl(). (finish_class): Call build_decl(), pushdecl() and finish_decl() instead of define_decl(). (add_protocols): Use PROTOCOL_BINFO_ELTS for the tree vector size. (start_protocol): Do not call build_protocol_template(); use PROTOCOL_BINFO_ELTS for the tree vector size. (encode_type_qualifiers): Do not handle the 'const' qualifier here. (encode_pointer): Encode 'const char *' as 'r*', for backwards compatibility. (encode_array): Use HOST_WIDE_INT_PRINT_DEC instead of "%ld". (encode_type): Handle the 'const' qualifier here. (objc_parmlist): New global variable, sued by objc_push_parm and objc_get_parm_info(). (objc_push_parm, objc_get_parm_info): New functions. (objc_expr_last): Remove function. (synth_self_and_ucmd_args): For instance methods, use the instance type for 'self'; call objc_push_parm() instead of push_parm_decl(). (start_method_def): Do not call push_scope(), declare_parm_level(), pop_scope(), push_parm_decl(), store_parm_decls() or objc_expr_last(); just use objc_push_parm() and objc_get_parm_info(). (comp_method_with_proto): Remove function. (objc_types_are_equivalent): Strip away indirections before comparing underlying types. (comp_proto_with_proto): Do not call groktypename(); types are no longer in raw declspec format. (objc_start_function): New function. (really_start_method): Call comp_proto_with_proto() instead of comp_method_with_proto(); call objc_start_function() instead of hand-crafting a function declarator. (continue_method_def, objc_expand_function_end): Remove functions. (get_super_receiver): Call objc_get_current_scope() instead of get_current_scope(); reference 'super_class' field (instead of 'class'). (finish_method_def): Rename to objc_finish_method_definition() and add a function decl parameter; move method encoding call from objc_expand_function_end(). (is_complex_decl, adorn_decl, gen_declarator, gen_declspecs, gen_declaration_1): Remove functions. (tmpbuf, RAW_DECLSPEC): Remove. (gen_declaration): Remove second parameter; simplify to deal with TYPE_P nodes instead of raw declspecs. (gen_type_name, gen_type_name_0): New functions. (gen_method_decl): Remove second parameter; call gen_type_name() instead of gen_declaration_1(). (dump_interface): Adjust calls to gen_declaration() and gen_method_decl(); do not allocate a separate string buffer. (init_objc): Allocate a larger string buffer to accommodate dump_interface(); adjust call to build_module_descriptor(); add call to build_module_initializer_routine() for the GNU runtime. (generate_classref_translation_entry): Do not call start_decl(); call finish_var_decl() instead of finish_decl(); call convert() instead of build_c_cast(). * objc-act.h (CLASS_OWN_IVARS): Remove accessor. (CLASS_BINFO_ELTS): Reduce from 6 to 5, now that CLASS_OWN_IVARS is gone. (OCTI_GNU_INIT_DECL, GNU_INIT_decl): New. (OCTI_ELLIPSIS_NODE, objc_ellipsis_node): Remove. (OCTI_ID_ID, id_type, objc_id_id): Rename to OCTI_ID_NAME, objc_object_type and objc_object_name, respectively. (OCTI_CLS_REF, OCTI_CLASS_NAME, objc_class_reference, objc_class_name): New. (IS_CLASS): New macro. (IS_ID, IS_SUPER): Robustify. (OCTI_EXECCLASS_DECL, execclass_decl): New. (finish_file, start_class, continue_class, finish_class, start_method_def, continue_method_def, finish_method_def, start_protocol, finish_protocol, objc_build_throw_stmt, objc_build_try_catch_finally_stmt, objc_build_synchronized_prologue, objc_build_synchronized_epilogue, objc_build_try_prologue, objc_build_try_epilogue, objc_build_catch_stmt, objc_build_catch_epilogue, objc_build_finally_prologue, objc_build_finally_epilogue, is_ivar, is_private, is_public, add_instance_variable, objc_add_method, get_super_receiver, objc_clear_super_receiver, get_class_ivars_from_name, get_class_reference, get_static_reference, get_object_reference, build_message_expr, finish_message_expr, build_selector_expr, build_ivar_reference, build_keyword_decl, build_method_decl, build_protocol_expr, build_objc_string_object, objc_declare_alias, objc_declare_class, objc_declare_protocols, objc_comptypes, objc_check_decl, build_encode_expr): Remove prototypes. (imp_count, cat_count): Make GGC-aware. (OBJC_SET_TYPE_NAME): New macro. From-SVN: r87168
2004-09-08 02:49:44 +02:00
/* struct _objc_symtab *symtab; */
field_decl
= create_field_decl (build_pointer_type
(xref_tag (RECORD_TYPE,
get_identifier (UTAG_SYMTAB))),
"symtab");
1992-01-18 00:15:38 +01:00
chainon (field_decl_chain, field_decl);
finish_struct (objc_module_template, field_decl_chain, NULL_TREE);
1992-01-18 00:15:38 +01:00
Makefile.in (c-parse.o): Depend on $(C_COMMON_H). [gcc/ChangeLog] 2004-09-07 Ziemowit Laski <zlaski@apple.com> * Makefile.in (c-parse.o): Depend on $(C_COMMON_H). * c-parse.in: Include c-common.h instead of objc-act.h. (ivar_decl_list, ivar_decls, ivar_decl, ivars, ivar_declarator, myparms, myparm): Remove %type declarations. (methodtype, optparms, OBJC_TYPE_QUAL, objc_quals, objc_qual, objc_typename, objc_try_catch_stmt, optellipsis): Add %type declarations. (objc_inherit_code, objc_public_flag): Remove. (typespec_nonreserved_nonattr): Call objc_get_protocol_qualified_type() instead of get_static_reference() and get_protocol_reference(). (stmt_nocomp): Call grokparm() on @catch parameter. (objcdef): Move semantic action to objc_finish_implementation(). (classdef): Move semantic action to objc_start_class_interface(), objc_continue_interface(), objc_finish_interface(), objc_start_class_implementation(), objc_continue_implementation(), objc_start_category_interface() and objc_start_category_implementation(). (protocoldef): Move semantic actions to objc_start_protocol() and objc_finish_interface(). (ivar_decl_list): Remove nonterminal. (visibility_spec): Move semantic actions to objc_set_visibility(). (ivar_decls): Remove assignment to $$. (ivar_decl): Rephrase in terms of component_decl; call objc_add_instance_variable(). (ivars, ivar_declarator): Remove nonterminals. (opt_semi): New nonterminal. (methodtype): Remove semantic actions. (methoddef): Move semantic actions to objc_set_method_type(), objc_start_method_definition() and objc_finish_method_definition(). (methodproto): Move semantic actions to objc_set_method_type() and objc_add_method_declaration(). (methoddecl): Use objc_typename instead of typename; move semantic actions to objc_build_method_signature(). (optarglist, myxdecls, mydecl, myparms, myparm): Remove nonterminals. (optparmlist): Express in terms of optparms and optellipsis. (optparms, optellipsis, objc_qual, objc_quals, objc_typename): New nonterminals. (keyworddecl): Use objc_typename instead of typename. (rid_to_yy): Mark RID_IN, RID_OUT, RID_INOUT, RID_BYCOPY, RID_BYREF and RID_ONEWAY as returning OBJC_TYPE_QUAL to yyparse(). [gcc/objc/ChangeLog] 2004-09-07 Ziemowit Laski <zlaski@apple.com> * Make-lang.in (objc/objc-parse.o): Depend on $(C_COMMON_H) instead of objc/objc-act.h. (objc/objc-act.o): Depend on $(HASHTAB_H). * objc-act.c: Include hashtab.h; in ObjC++ mode, include cp-tree.h and objcp-decl.h instead of c-tree.h. (build_module_descriptor, get_class_ivars, synth_id_with_class_suffix, error_with_ivar, gen_method_decl, gen_declaration, setup_string_decl, build_protocol_template): Adjust prototypes. (build_module_initializer_routine, start_class, continue_class, finish_class, start_method_def, objc_start_function, start_protocol, build_method_decl, objc_add_method, add_instance_variable, build_ivar_reference, is_ivar, is_private, get_super_receiver, build_selector_table_decl, objc_push_parm, objc_get_parm_info, gen_type_name, gen_type_name_0, start_var_decl, finish_var_decl, create_field_decl): New prototypes. (objc_expand_function_end, comp_method_with_proto, objc_expr_last, gen_declaration_1, gen_declarator, is_complex_decl, adorn_decl, define_decl, create_builtin_decl, gen_declspecs): Remove prototypes. (TYPE_ID): Rename to OBJECT_TYPEDEF_NAME. (CLASS_TYPEDEF_NAME): New. (TAG_EXECCLASS): Change from a global variable to a #define. (TAG_RETURN_STRUCT): Delete. (TAG_GNUINIT): New, holds '__objc_gnu_init' name. (objc_inherit_code, objc_public_flag): New, moved from c-parse.in. (string_descriptor): New struct. (string_htab): New hash table. (string_hash, string_eq): New prototypes. (generate_struct_by_value_array): Call create_field_decl() instead of create_builtin_decl(). (objc_init): Do not initialize objc_ellipsis_node or TAG_EXECCLASS; In ObjC++ mode, call cxx_init() instead of c_objc_common_init(). (objc_finish_file): In ObjC++, call instantiate_pending_templates() and cp_finish_file(). (define_decl, get_static_reference, get_protocol_reference, create_builtin_decl): Remove functions. (objc_start_class_interface, objc_start_category_interface, objc_start_protocol, objc_continue_interface, objc_finish_interface, objc_start_class_implementation, objc_start_category_implementation, objc_continue_implementation, objc_finish_implementation, objc_set_visibility, objc_set_method_type, objc_build_method_signature, objc_add_method_declaration, objc_start_method_definition, objc_add_instance_variable, objc_get_protocol_qualified_type, create_field_decl, start_var_decl, finish_var_decl): New functions. (setup_string_decl): Simplify since it is only called once. (synth_module_prologue): Call build_class_template(); predefine 'id' and 'Class' as typedefs; rename 'temp_type' to 'type'; disable debug hooks for duration of function; fix GNU runtime messenger signatures to correspond to reality; forward-declare '__objc_exec_class' for the GNU runtime; call build_selector_table_decl(); in ObjC++ mode, generate 'extern "C" { ... }' wrappers around synthesized declarations; call build_protocol_template() and build_category_template(). (string_hash, string_eq): New functions. (objc_build_string_object): Check metaclass correctness only once; store string literals in hash table. (objc_build_constructor): Do not convert initializer elements; adjust for ObjC++ impedance mismatch. (build_objc_symtab_template): Call create_field_decl() instead of create_builtin_decl(). (init_objc_symtab): Add missing conversion to initializer element. (build_metadata_decl): Call start_var_decl() instead of define_decl(). (generate_objc_symtab_decl): Do not call build_category_template(); call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(). (build_module_descriptor): Call create_field_decl() instead of grokfield(); call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(); always mark module descriptor as used; move GNU runtime-specific functionality to build_module_initializer_routine(). (build_module_initializer_routine): New function, broken off of build_module_descriptor(). (objc_static_init_needed_p, objc_generate_static_init_call): New functions. (generate_static_references, generate_strings, build_selector_translation_table, generate_descriptor_table, generate_ivars_list, generate_dispatch_table, generate_category): Call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(); build a type directly instead of via groktypename(). (build_selector_reference_decl, build_selector_table_decl, build_class_reference_decl, build_protocol_reference, generate_objc_image_info): Call start_var_decl() instead of build_decl(). (build_selector_reference): For GNU runtime, do not call build_selector_reference_decl(). (build_selector, build_typed_selector_reference): Always convert result to the selector type. (add_objc_string): Cast return value to 'char *'. (build_method_prototype_template, build_selector_template, build_method_template): Use actual selector type for fields pointing to selectors. (finish_objc): For GNU runtime, call build_module_initializer_routine() after build_module_descriptor(). (generate_protocol_list, generate_shared_structures): Call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(); build a type directly instead of via groktypename(). (synth_id_with_class_suffix): Return a string. (get_arg_type_list): For instance methods, use the instance type for 'self'; do not call groktypename_in_parm_context(). (build_objc_string_decl): Squash redeclaration errors in ObjC++. (objc_is_class_name): Use OBJC_TYPE_NAME instead of TYPE_NAME; handle RECORD_TYPEs in ObjC as well as ObjC++. (objc_is_id): New function. (objc_is_object_ptr): Return the canonical type node. (objc_get_class_ivars): Simplify using get_class_ivars(). (get_class_ivars): Remove second parameter; create a fresh copy of the ivar list for each call; do not check for existence of super class. (objc_eh_runtime_type): Mark #ifndef OBJCPLUS. (objc_init_exceptions): When using SJLJ-style exceptions, require the use of '-fobjc-exceptions' flag; do not require it for DWARF-style exceptions. (objc_build_exc_ptr, next_sjlj_build_try_catch_finally): Use objc_object_type instead of objc_id_type. (objc_begin_catch_clause): Convert the incoming PARM_DECL into a VAR_DECL before placing it in the appropriate scope; do not call define_decl(); adjust call to c_begin_compound_stmt(); use objc_object_type instead of objc_id_type. (build_next_objc_exception_stuff): Call create_field_decl() instead of create_builtin_decl(); construct type directly instead of calling groktypename(); use OBJC_VOID_AT_END to mark end of function parameters. (build_private_template): Adjust call to get_class_ivars(); build a type directly instead of via groktypename(). (build_protocol_template, build_method_prototype_list_template, build_method_prototype_template, build_category_template, build_selector_template, build_class_template, build_super_template, build_ivar_template, build_ivar_list_template, build_method_list_template, build_method_template): Call create_field_decl() instead of grokfield(). (objc_method_parm_type): Do not call groktypename(). (generate_descriptor_table): Call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(). (generate_method_descriptors, build_protocol_initializer, generate_dispatch_tables, build_category_initializer, build_shared_structure_initializer): Do not call groktypename(). (generate_protocols): Call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(); do not call groktypename(). (error_with_ivar): Remove last parameter. (check_ivars): Do not iterate ovar CLASS_RAW_IVARS lists in addition to CLASS_IVARS lists; adjust calls to error_with_ivar(). (generate_ivar_lists): Convert one of the initializer elements; do not call groktypename(). (get_arg_type_list, start_method_def, gen_method_def): Account for new representation of variable arguments and '...' in Objective-C methods; add Objective-C++ impedance matching code. (is_objc_type_qualifier): Remove function. (adjust_type_for_id_default): Simplify; there is no longer a need to wade through declspecs. (lookup_interface, start_class, continue_class, finish_class, start_method_def, start_protocol, build_method_decl, objc_add_method, add_instance_variable, build_ivar_reference, is_ivar, is_private, get_super_receiver, objc_build_finally_epilogue): Make into static functions. (receiver_is_class_object): Use new IS_CLASS() macro. (objc_build_message_expr): Tweak ObjC++ message argument handling; call objc_finish_message_expr() instead of finish_message_expr(). (finish_message_expr): Rename to objc_finish_message_expr(); use OBJC_TYPE_NAME and OBJC_SET_TYPE_NAME macros instead of TYPE_NAME. call gen_type_name() instead of gen_declaration(); call objc_is_id() instead of using IS_ID and IS_CLASS; Use objc_class_name instead of calling get_identifier("Class"); handle CONVERT_EXPRs in receiver. (build_objc_method_call, warn_with_method): Do not call groktypename(). (build_ivar_reference): Call convert() instead of clobbering in a type. (hash_init): Initialize string_htab hash table. (add_instance_variable): Simplify parameter list; do not call grokfield(); do not populate CLASS_IVARS list. (start_class): Check for the existence of super class, if one was specified. (continue_class): Use CLASS_RAW_IVARS rather than CLASS_IVARS; do not call build_class_template(); adjust call to get_class_ivars(); call build_decl(), pushdecl() and finish_decl() instead of define_decl(). (finish_class): Call build_decl(), pushdecl() and finish_decl() instead of define_decl(). (add_protocols): Use PROTOCOL_BINFO_ELTS for the tree vector size. (start_protocol): Do not call build_protocol_template(); use PROTOCOL_BINFO_ELTS for the tree vector size. (encode_type_qualifiers): Do not handle the 'const' qualifier here. (encode_pointer): Encode 'const char *' as 'r*', for backwards compatibility. (encode_array): Use HOST_WIDE_INT_PRINT_DEC instead of "%ld". (encode_type): Handle the 'const' qualifier here. (objc_parmlist): New global variable, sued by objc_push_parm and objc_get_parm_info(). (objc_push_parm, objc_get_parm_info): New functions. (objc_expr_last): Remove function. (synth_self_and_ucmd_args): For instance methods, use the instance type for 'self'; call objc_push_parm() instead of push_parm_decl(). (start_method_def): Do not call push_scope(), declare_parm_level(), pop_scope(), push_parm_decl(), store_parm_decls() or objc_expr_last(); just use objc_push_parm() and objc_get_parm_info(). (comp_method_with_proto): Remove function. (objc_types_are_equivalent): Strip away indirections before comparing underlying types. (comp_proto_with_proto): Do not call groktypename(); types are no longer in raw declspec format. (objc_start_function): New function. (really_start_method): Call comp_proto_with_proto() instead of comp_method_with_proto(); call objc_start_function() instead of hand-crafting a function declarator. (continue_method_def, objc_expand_function_end): Remove functions. (get_super_receiver): Call objc_get_current_scope() instead of get_current_scope(); reference 'super_class' field (instead of 'class'). (finish_method_def): Rename to objc_finish_method_definition() and add a function decl parameter; move method encoding call from objc_expand_function_end(). (is_complex_decl, adorn_decl, gen_declarator, gen_declspecs, gen_declaration_1): Remove functions. (tmpbuf, RAW_DECLSPEC): Remove. (gen_declaration): Remove second parameter; simplify to deal with TYPE_P nodes instead of raw declspecs. (gen_type_name, gen_type_name_0): New functions. (gen_method_decl): Remove second parameter; call gen_type_name() instead of gen_declaration_1(). (dump_interface): Adjust calls to gen_declaration() and gen_method_decl(); do not allocate a separate string buffer. (init_objc): Allocate a larger string buffer to accommodate dump_interface(); adjust call to build_module_descriptor(); add call to build_module_initializer_routine() for the GNU runtime. (generate_classref_translation_entry): Do not call start_decl(); call finish_var_decl() instead of finish_decl(); call convert() instead of build_c_cast(). * objc-act.h (CLASS_OWN_IVARS): Remove accessor. (CLASS_BINFO_ELTS): Reduce from 6 to 5, now that CLASS_OWN_IVARS is gone. (OCTI_GNU_INIT_DECL, GNU_INIT_decl): New. (OCTI_ELLIPSIS_NODE, objc_ellipsis_node): Remove. (OCTI_ID_ID, id_type, objc_id_id): Rename to OCTI_ID_NAME, objc_object_type and objc_object_name, respectively. (OCTI_CLS_REF, OCTI_CLASS_NAME, objc_class_reference, objc_class_name): New. (IS_CLASS): New macro. (IS_ID, IS_SUPER): Robustify. (OCTI_EXECCLASS_DECL, execclass_decl): New. (finish_file, start_class, continue_class, finish_class, start_method_def, continue_method_def, finish_method_def, start_protocol, finish_protocol, objc_build_throw_stmt, objc_build_try_catch_finally_stmt, objc_build_synchronized_prologue, objc_build_synchronized_epilogue, objc_build_try_prologue, objc_build_try_epilogue, objc_build_catch_stmt, objc_build_catch_epilogue, objc_build_finally_prologue, objc_build_finally_epilogue, is_ivar, is_private, is_public, add_instance_variable, objc_add_method, get_super_receiver, objc_clear_super_receiver, get_class_ivars_from_name, get_class_reference, get_static_reference, get_object_reference, build_message_expr, finish_message_expr, build_selector_expr, build_ivar_reference, build_keyword_decl, build_method_decl, build_protocol_expr, build_objc_string_object, objc_declare_alias, objc_declare_class, objc_declare_protocols, objc_comptypes, objc_check_decl, build_encode_expr): Remove prototypes. (imp_count, cat_count): Make GGC-aware. (OBJC_SET_TYPE_NAME): New macro. From-SVN: r87168
2004-09-08 02:49:44 +02:00
/* Create an instance of "_objc_module". */
UOBJC_MODULES_decl = start_var_decl (objc_module_template, "_OBJC_MODULES");
finish_var_decl (UOBJC_MODULES_decl,
init_module_descriptor (TREE_TYPE (UOBJC_MODULES_decl)));
#ifdef OBJCPLUS
pop_lang_context ();
#endif
}
/* The GNU runtime requires us to provide a static initializer function
for each module:
1992-01-18 00:15:38 +01:00
Makefile.in (c-parse.o): Depend on $(C_COMMON_H). [gcc/ChangeLog] 2004-09-07 Ziemowit Laski <zlaski@apple.com> * Makefile.in (c-parse.o): Depend on $(C_COMMON_H). * c-parse.in: Include c-common.h instead of objc-act.h. (ivar_decl_list, ivar_decls, ivar_decl, ivars, ivar_declarator, myparms, myparm): Remove %type declarations. (methodtype, optparms, OBJC_TYPE_QUAL, objc_quals, objc_qual, objc_typename, objc_try_catch_stmt, optellipsis): Add %type declarations. (objc_inherit_code, objc_public_flag): Remove. (typespec_nonreserved_nonattr): Call objc_get_protocol_qualified_type() instead of get_static_reference() and get_protocol_reference(). (stmt_nocomp): Call grokparm() on @catch parameter. (objcdef): Move semantic action to objc_finish_implementation(). (classdef): Move semantic action to objc_start_class_interface(), objc_continue_interface(), objc_finish_interface(), objc_start_class_implementation(), objc_continue_implementation(), objc_start_category_interface() and objc_start_category_implementation(). (protocoldef): Move semantic actions to objc_start_protocol() and objc_finish_interface(). (ivar_decl_list): Remove nonterminal. (visibility_spec): Move semantic actions to objc_set_visibility(). (ivar_decls): Remove assignment to $$. (ivar_decl): Rephrase in terms of component_decl; call objc_add_instance_variable(). (ivars, ivar_declarator): Remove nonterminals. (opt_semi): New nonterminal. (methodtype): Remove semantic actions. (methoddef): Move semantic actions to objc_set_method_type(), objc_start_method_definition() and objc_finish_method_definition(). (methodproto): Move semantic actions to objc_set_method_type() and objc_add_method_declaration(). (methoddecl): Use objc_typename instead of typename; move semantic actions to objc_build_method_signature(). (optarglist, myxdecls, mydecl, myparms, myparm): Remove nonterminals. (optparmlist): Express in terms of optparms and optellipsis. (optparms, optellipsis, objc_qual, objc_quals, objc_typename): New nonterminals. (keyworddecl): Use objc_typename instead of typename. (rid_to_yy): Mark RID_IN, RID_OUT, RID_INOUT, RID_BYCOPY, RID_BYREF and RID_ONEWAY as returning OBJC_TYPE_QUAL to yyparse(). [gcc/objc/ChangeLog] 2004-09-07 Ziemowit Laski <zlaski@apple.com> * Make-lang.in (objc/objc-parse.o): Depend on $(C_COMMON_H) instead of objc/objc-act.h. (objc/objc-act.o): Depend on $(HASHTAB_H). * objc-act.c: Include hashtab.h; in ObjC++ mode, include cp-tree.h and objcp-decl.h instead of c-tree.h. (build_module_descriptor, get_class_ivars, synth_id_with_class_suffix, error_with_ivar, gen_method_decl, gen_declaration, setup_string_decl, build_protocol_template): Adjust prototypes. (build_module_initializer_routine, start_class, continue_class, finish_class, start_method_def, objc_start_function, start_protocol, build_method_decl, objc_add_method, add_instance_variable, build_ivar_reference, is_ivar, is_private, get_super_receiver, build_selector_table_decl, objc_push_parm, objc_get_parm_info, gen_type_name, gen_type_name_0, start_var_decl, finish_var_decl, create_field_decl): New prototypes. (objc_expand_function_end, comp_method_with_proto, objc_expr_last, gen_declaration_1, gen_declarator, is_complex_decl, adorn_decl, define_decl, create_builtin_decl, gen_declspecs): Remove prototypes. (TYPE_ID): Rename to OBJECT_TYPEDEF_NAME. (CLASS_TYPEDEF_NAME): New. (TAG_EXECCLASS): Change from a global variable to a #define. (TAG_RETURN_STRUCT): Delete. (TAG_GNUINIT): New, holds '__objc_gnu_init' name. (objc_inherit_code, objc_public_flag): New, moved from c-parse.in. (string_descriptor): New struct. (string_htab): New hash table. (string_hash, string_eq): New prototypes. (generate_struct_by_value_array): Call create_field_decl() instead of create_builtin_decl(). (objc_init): Do not initialize objc_ellipsis_node or TAG_EXECCLASS; In ObjC++ mode, call cxx_init() instead of c_objc_common_init(). (objc_finish_file): In ObjC++, call instantiate_pending_templates() and cp_finish_file(). (define_decl, get_static_reference, get_protocol_reference, create_builtin_decl): Remove functions. (objc_start_class_interface, objc_start_category_interface, objc_start_protocol, objc_continue_interface, objc_finish_interface, objc_start_class_implementation, objc_start_category_implementation, objc_continue_implementation, objc_finish_implementation, objc_set_visibility, objc_set_method_type, objc_build_method_signature, objc_add_method_declaration, objc_start_method_definition, objc_add_instance_variable, objc_get_protocol_qualified_type, create_field_decl, start_var_decl, finish_var_decl): New functions. (setup_string_decl): Simplify since it is only called once. (synth_module_prologue): Call build_class_template(); predefine 'id' and 'Class' as typedefs; rename 'temp_type' to 'type'; disable debug hooks for duration of function; fix GNU runtime messenger signatures to correspond to reality; forward-declare '__objc_exec_class' for the GNU runtime; call build_selector_table_decl(); in ObjC++ mode, generate 'extern "C" { ... }' wrappers around synthesized declarations; call build_protocol_template() and build_category_template(). (string_hash, string_eq): New functions. (objc_build_string_object): Check metaclass correctness only once; store string literals in hash table. (objc_build_constructor): Do not convert initializer elements; adjust for ObjC++ impedance mismatch. (build_objc_symtab_template): Call create_field_decl() instead of create_builtin_decl(). (init_objc_symtab): Add missing conversion to initializer element. (build_metadata_decl): Call start_var_decl() instead of define_decl(). (generate_objc_symtab_decl): Do not call build_category_template(); call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(). (build_module_descriptor): Call create_field_decl() instead of grokfield(); call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(); always mark module descriptor as used; move GNU runtime-specific functionality to build_module_initializer_routine(). (build_module_initializer_routine): New function, broken off of build_module_descriptor(). (objc_static_init_needed_p, objc_generate_static_init_call): New functions. (generate_static_references, generate_strings, build_selector_translation_table, generate_descriptor_table, generate_ivars_list, generate_dispatch_table, generate_category): Call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(); build a type directly instead of via groktypename(). (build_selector_reference_decl, build_selector_table_decl, build_class_reference_decl, build_protocol_reference, generate_objc_image_info): Call start_var_decl() instead of build_decl(). (build_selector_reference): For GNU runtime, do not call build_selector_reference_decl(). (build_selector, build_typed_selector_reference): Always convert result to the selector type. (add_objc_string): Cast return value to 'char *'. (build_method_prototype_template, build_selector_template, build_method_template): Use actual selector type for fields pointing to selectors. (finish_objc): For GNU runtime, call build_module_initializer_routine() after build_module_descriptor(). (generate_protocol_list, generate_shared_structures): Call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(); build a type directly instead of via groktypename(). (synth_id_with_class_suffix): Return a string. (get_arg_type_list): For instance methods, use the instance type for 'self'; do not call groktypename_in_parm_context(). (build_objc_string_decl): Squash redeclaration errors in ObjC++. (objc_is_class_name): Use OBJC_TYPE_NAME instead of TYPE_NAME; handle RECORD_TYPEs in ObjC as well as ObjC++. (objc_is_id): New function. (objc_is_object_ptr): Return the canonical type node. (objc_get_class_ivars): Simplify using get_class_ivars(). (get_class_ivars): Remove second parameter; create a fresh copy of the ivar list for each call; do not check for existence of super class. (objc_eh_runtime_type): Mark #ifndef OBJCPLUS. (objc_init_exceptions): When using SJLJ-style exceptions, require the use of '-fobjc-exceptions' flag; do not require it for DWARF-style exceptions. (objc_build_exc_ptr, next_sjlj_build_try_catch_finally): Use objc_object_type instead of objc_id_type. (objc_begin_catch_clause): Convert the incoming PARM_DECL into a VAR_DECL before placing it in the appropriate scope; do not call define_decl(); adjust call to c_begin_compound_stmt(); use objc_object_type instead of objc_id_type. (build_next_objc_exception_stuff): Call create_field_decl() instead of create_builtin_decl(); construct type directly instead of calling groktypename(); use OBJC_VOID_AT_END to mark end of function parameters. (build_private_template): Adjust call to get_class_ivars(); build a type directly instead of via groktypename(). (build_protocol_template, build_method_prototype_list_template, build_method_prototype_template, build_category_template, build_selector_template, build_class_template, build_super_template, build_ivar_template, build_ivar_list_template, build_method_list_template, build_method_template): Call create_field_decl() instead of grokfield(). (objc_method_parm_type): Do not call groktypename(). (generate_descriptor_table): Call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(). (generate_method_descriptors, build_protocol_initializer, generate_dispatch_tables, build_category_initializer, build_shared_structure_initializer): Do not call groktypename(). (generate_protocols): Call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(); do not call groktypename(). (error_with_ivar): Remove last parameter. (check_ivars): Do not iterate ovar CLASS_RAW_IVARS lists in addition to CLASS_IVARS lists; adjust calls to error_with_ivar(). (generate_ivar_lists): Convert one of the initializer elements; do not call groktypename(). (get_arg_type_list, start_method_def, gen_method_def): Account for new representation of variable arguments and '...' in Objective-C methods; add Objective-C++ impedance matching code. (is_objc_type_qualifier): Remove function. (adjust_type_for_id_default): Simplify; there is no longer a need to wade through declspecs. (lookup_interface, start_class, continue_class, finish_class, start_method_def, start_protocol, build_method_decl, objc_add_method, add_instance_variable, build_ivar_reference, is_ivar, is_private, get_super_receiver, objc_build_finally_epilogue): Make into static functions. (receiver_is_class_object): Use new IS_CLASS() macro. (objc_build_message_expr): Tweak ObjC++ message argument handling; call objc_finish_message_expr() instead of finish_message_expr(). (finish_message_expr): Rename to objc_finish_message_expr(); use OBJC_TYPE_NAME and OBJC_SET_TYPE_NAME macros instead of TYPE_NAME. call gen_type_name() instead of gen_declaration(); call objc_is_id() instead of using IS_ID and IS_CLASS; Use objc_class_name instead of calling get_identifier("Class"); handle CONVERT_EXPRs in receiver. (build_objc_method_call, warn_with_method): Do not call groktypename(). (build_ivar_reference): Call convert() instead of clobbering in a type. (hash_init): Initialize string_htab hash table. (add_instance_variable): Simplify parameter list; do not call grokfield(); do not populate CLASS_IVARS list. (start_class): Check for the existence of super class, if one was specified. (continue_class): Use CLASS_RAW_IVARS rather than CLASS_IVARS; do not call build_class_template(); adjust call to get_class_ivars(); call build_decl(), pushdecl() and finish_decl() instead of define_decl(). (finish_class): Call build_decl(), pushdecl() and finish_decl() instead of define_decl(). (add_protocols): Use PROTOCOL_BINFO_ELTS for the tree vector size. (start_protocol): Do not call build_protocol_template(); use PROTOCOL_BINFO_ELTS for the tree vector size. (encode_type_qualifiers): Do not handle the 'const' qualifier here. (encode_pointer): Encode 'const char *' as 'r*', for backwards compatibility. (encode_array): Use HOST_WIDE_INT_PRINT_DEC instead of "%ld". (encode_type): Handle the 'const' qualifier here. (objc_parmlist): New global variable, sued by objc_push_parm and objc_get_parm_info(). (objc_push_parm, objc_get_parm_info): New functions. (objc_expr_last): Remove function. (synth_self_and_ucmd_args): For instance methods, use the instance type for 'self'; call objc_push_parm() instead of push_parm_decl(). (start_method_def): Do not call push_scope(), declare_parm_level(), pop_scope(), push_parm_decl(), store_parm_decls() or objc_expr_last(); just use objc_push_parm() and objc_get_parm_info(). (comp_method_with_proto): Remove function. (objc_types_are_equivalent): Strip away indirections before comparing underlying types. (comp_proto_with_proto): Do not call groktypename(); types are no longer in raw declspec format. (objc_start_function): New function. (really_start_method): Call comp_proto_with_proto() instead of comp_method_with_proto(); call objc_start_function() instead of hand-crafting a function declarator. (continue_method_def, objc_expand_function_end): Remove functions. (get_super_receiver): Call objc_get_current_scope() instead of get_current_scope(); reference 'super_class' field (instead of 'class'). (finish_method_def): Rename to objc_finish_method_definition() and add a function decl parameter; move method encoding call from objc_expand_function_end(). (is_complex_decl, adorn_decl, gen_declarator, gen_declspecs, gen_declaration_1): Remove functions. (tmpbuf, RAW_DECLSPEC): Remove. (gen_declaration): Remove second parameter; simplify to deal with TYPE_P nodes instead of raw declspecs. (gen_type_name, gen_type_name_0): New functions. (gen_method_decl): Remove second parameter; call gen_type_name() instead of gen_declaration_1(). (dump_interface): Adjust calls to gen_declaration() and gen_method_decl(); do not allocate a separate string buffer. (init_objc): Allocate a larger string buffer to accommodate dump_interface(); adjust call to build_module_descriptor(); add call to build_module_initializer_routine() for the GNU runtime. (generate_classref_translation_entry): Do not call start_decl(); call finish_var_decl() instead of finish_decl(); call convert() instead of build_c_cast(). * objc-act.h (CLASS_OWN_IVARS): Remove accessor. (CLASS_BINFO_ELTS): Reduce from 6 to 5, now that CLASS_OWN_IVARS is gone. (OCTI_GNU_INIT_DECL, GNU_INIT_decl): New. (OCTI_ELLIPSIS_NODE, objc_ellipsis_node): Remove. (OCTI_ID_ID, id_type, objc_id_id): Rename to OCTI_ID_NAME, objc_object_type and objc_object_name, respectively. (OCTI_CLS_REF, OCTI_CLASS_NAME, objc_class_reference, objc_class_name): New. (IS_CLASS): New macro. (IS_ID, IS_SUPER): Robustify. (OCTI_EXECCLASS_DECL, execclass_decl): New. (finish_file, start_class, continue_class, finish_class, start_method_def, continue_method_def, finish_method_def, start_protocol, finish_protocol, objc_build_throw_stmt, objc_build_try_catch_finally_stmt, objc_build_synchronized_prologue, objc_build_synchronized_epilogue, objc_build_try_prologue, objc_build_try_epilogue, objc_build_catch_stmt, objc_build_catch_epilogue, objc_build_finally_prologue, objc_build_finally_epilogue, is_ivar, is_private, is_public, add_instance_variable, objc_add_method, get_super_receiver, objc_clear_super_receiver, get_class_ivars_from_name, get_class_reference, get_static_reference, get_object_reference, build_message_expr, finish_message_expr, build_selector_expr, build_ivar_reference, build_keyword_decl, build_method_decl, build_protocol_expr, build_objc_string_object, objc_declare_alias, objc_declare_class, objc_declare_protocols, objc_comptypes, objc_check_decl, build_encode_expr): Remove prototypes. (imp_count, cat_count): Make GGC-aware. (OBJC_SET_TYPE_NAME): New macro. From-SVN: r87168
2004-09-08 02:49:44 +02:00
static void __objc_gnu_init (void) {
__objc_exec_class (&L_OBJC_MODULES);
} */
1992-01-18 00:15:38 +01:00
Makefile.in (c-parse.o): Depend on $(C_COMMON_H). [gcc/ChangeLog] 2004-09-07 Ziemowit Laski <zlaski@apple.com> * Makefile.in (c-parse.o): Depend on $(C_COMMON_H). * c-parse.in: Include c-common.h instead of objc-act.h. (ivar_decl_list, ivar_decls, ivar_decl, ivars, ivar_declarator, myparms, myparm): Remove %type declarations. (methodtype, optparms, OBJC_TYPE_QUAL, objc_quals, objc_qual, objc_typename, objc_try_catch_stmt, optellipsis): Add %type declarations. (objc_inherit_code, objc_public_flag): Remove. (typespec_nonreserved_nonattr): Call objc_get_protocol_qualified_type() instead of get_static_reference() and get_protocol_reference(). (stmt_nocomp): Call grokparm() on @catch parameter. (objcdef): Move semantic action to objc_finish_implementation(). (classdef): Move semantic action to objc_start_class_interface(), objc_continue_interface(), objc_finish_interface(), objc_start_class_implementation(), objc_continue_implementation(), objc_start_category_interface() and objc_start_category_implementation(). (protocoldef): Move semantic actions to objc_start_protocol() and objc_finish_interface(). (ivar_decl_list): Remove nonterminal. (visibility_spec): Move semantic actions to objc_set_visibility(). (ivar_decls): Remove assignment to $$. (ivar_decl): Rephrase in terms of component_decl; call objc_add_instance_variable(). (ivars, ivar_declarator): Remove nonterminals. (opt_semi): New nonterminal. (methodtype): Remove semantic actions. (methoddef): Move semantic actions to objc_set_method_type(), objc_start_method_definition() and objc_finish_method_definition(). (methodproto): Move semantic actions to objc_set_method_type() and objc_add_method_declaration(). (methoddecl): Use objc_typename instead of typename; move semantic actions to objc_build_method_signature(). (optarglist, myxdecls, mydecl, myparms, myparm): Remove nonterminals. (optparmlist): Express in terms of optparms and optellipsis. (optparms, optellipsis, objc_qual, objc_quals, objc_typename): New nonterminals. (keyworddecl): Use objc_typename instead of typename. (rid_to_yy): Mark RID_IN, RID_OUT, RID_INOUT, RID_BYCOPY, RID_BYREF and RID_ONEWAY as returning OBJC_TYPE_QUAL to yyparse(). [gcc/objc/ChangeLog] 2004-09-07 Ziemowit Laski <zlaski@apple.com> * Make-lang.in (objc/objc-parse.o): Depend on $(C_COMMON_H) instead of objc/objc-act.h. (objc/objc-act.o): Depend on $(HASHTAB_H). * objc-act.c: Include hashtab.h; in ObjC++ mode, include cp-tree.h and objcp-decl.h instead of c-tree.h. (build_module_descriptor, get_class_ivars, synth_id_with_class_suffix, error_with_ivar, gen_method_decl, gen_declaration, setup_string_decl, build_protocol_template): Adjust prototypes. (build_module_initializer_routine, start_class, continue_class, finish_class, start_method_def, objc_start_function, start_protocol, build_method_decl, objc_add_method, add_instance_variable, build_ivar_reference, is_ivar, is_private, get_super_receiver, build_selector_table_decl, objc_push_parm, objc_get_parm_info, gen_type_name, gen_type_name_0, start_var_decl, finish_var_decl, create_field_decl): New prototypes. (objc_expand_function_end, comp_method_with_proto, objc_expr_last, gen_declaration_1, gen_declarator, is_complex_decl, adorn_decl, define_decl, create_builtin_decl, gen_declspecs): Remove prototypes. (TYPE_ID): Rename to OBJECT_TYPEDEF_NAME. (CLASS_TYPEDEF_NAME): New. (TAG_EXECCLASS): Change from a global variable to a #define. (TAG_RETURN_STRUCT): Delete. (TAG_GNUINIT): New, holds '__objc_gnu_init' name. (objc_inherit_code, objc_public_flag): New, moved from c-parse.in. (string_descriptor): New struct. (string_htab): New hash table. (string_hash, string_eq): New prototypes. (generate_struct_by_value_array): Call create_field_decl() instead of create_builtin_decl(). (objc_init): Do not initialize objc_ellipsis_node or TAG_EXECCLASS; In ObjC++ mode, call cxx_init() instead of c_objc_common_init(). (objc_finish_file): In ObjC++, call instantiate_pending_templates() and cp_finish_file(). (define_decl, get_static_reference, get_protocol_reference, create_builtin_decl): Remove functions. (objc_start_class_interface, objc_start_category_interface, objc_start_protocol, objc_continue_interface, objc_finish_interface, objc_start_class_implementation, objc_start_category_implementation, objc_continue_implementation, objc_finish_implementation, objc_set_visibility, objc_set_method_type, objc_build_method_signature, objc_add_method_declaration, objc_start_method_definition, objc_add_instance_variable, objc_get_protocol_qualified_type, create_field_decl, start_var_decl, finish_var_decl): New functions. (setup_string_decl): Simplify since it is only called once. (synth_module_prologue): Call build_class_template(); predefine 'id' and 'Class' as typedefs; rename 'temp_type' to 'type'; disable debug hooks for duration of function; fix GNU runtime messenger signatures to correspond to reality; forward-declare '__objc_exec_class' for the GNU runtime; call build_selector_table_decl(); in ObjC++ mode, generate 'extern "C" { ... }' wrappers around synthesized declarations; call build_protocol_template() and build_category_template(). (string_hash, string_eq): New functions. (objc_build_string_object): Check metaclass correctness only once; store string literals in hash table. (objc_build_constructor): Do not convert initializer elements; adjust for ObjC++ impedance mismatch. (build_objc_symtab_template): Call create_field_decl() instead of create_builtin_decl(). (init_objc_symtab): Add missing conversion to initializer element. (build_metadata_decl): Call start_var_decl() instead of define_decl(). (generate_objc_symtab_decl): Do not call build_category_template(); call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(). (build_module_descriptor): Call create_field_decl() instead of grokfield(); call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(); always mark module descriptor as used; move GNU runtime-specific functionality to build_module_initializer_routine(). (build_module_initializer_routine): New function, broken off of build_module_descriptor(). (objc_static_init_needed_p, objc_generate_static_init_call): New functions. (generate_static_references, generate_strings, build_selector_translation_table, generate_descriptor_table, generate_ivars_list, generate_dispatch_table, generate_category): Call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(); build a type directly instead of via groktypename(). (build_selector_reference_decl, build_selector_table_decl, build_class_reference_decl, build_protocol_reference, generate_objc_image_info): Call start_var_decl() instead of build_decl(). (build_selector_reference): For GNU runtime, do not call build_selector_reference_decl(). (build_selector, build_typed_selector_reference): Always convert result to the selector type. (add_objc_string): Cast return value to 'char *'. (build_method_prototype_template, build_selector_template, build_method_template): Use actual selector type for fields pointing to selectors. (finish_objc): For GNU runtime, call build_module_initializer_routine() after build_module_descriptor(). (generate_protocol_list, generate_shared_structures): Call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(); build a type directly instead of via groktypename(). (synth_id_with_class_suffix): Return a string. (get_arg_type_list): For instance methods, use the instance type for 'self'; do not call groktypename_in_parm_context(). (build_objc_string_decl): Squash redeclaration errors in ObjC++. (objc_is_class_name): Use OBJC_TYPE_NAME instead of TYPE_NAME; handle RECORD_TYPEs in ObjC as well as ObjC++. (objc_is_id): New function. (objc_is_object_ptr): Return the canonical type node. (objc_get_class_ivars): Simplify using get_class_ivars(). (get_class_ivars): Remove second parameter; create a fresh copy of the ivar list for each call; do not check for existence of super class. (objc_eh_runtime_type): Mark #ifndef OBJCPLUS. (objc_init_exceptions): When using SJLJ-style exceptions, require the use of '-fobjc-exceptions' flag; do not require it for DWARF-style exceptions. (objc_build_exc_ptr, next_sjlj_build_try_catch_finally): Use objc_object_type instead of objc_id_type. (objc_begin_catch_clause): Convert the incoming PARM_DECL into a VAR_DECL before placing it in the appropriate scope; do not call define_decl(); adjust call to c_begin_compound_stmt(); use objc_object_type instead of objc_id_type. (build_next_objc_exception_stuff): Call create_field_decl() instead of create_builtin_decl(); construct type directly instead of calling groktypename(); use OBJC_VOID_AT_END to mark end of function parameters. (build_private_template): Adjust call to get_class_ivars(); build a type directly instead of via groktypename(). (build_protocol_template, build_method_prototype_list_template, build_method_prototype_template, build_category_template, build_selector_template, build_class_template, build_super_template, build_ivar_template, build_ivar_list_template, build_method_list_template, build_method_template): Call create_field_decl() instead of grokfield(). (objc_method_parm_type): Do not call groktypename(). (generate_descriptor_table): Call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(). (generate_method_descriptors, build_protocol_initializer, generate_dispatch_tables, build_category_initializer, build_shared_structure_initializer): Do not call groktypename(). (generate_protocols): Call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(); do not call groktypename(). (error_with_ivar): Remove last parameter. (check_ivars): Do not iterate ovar CLASS_RAW_IVARS lists in addition to CLASS_IVARS lists; adjust calls to error_with_ivar(). (generate_ivar_lists): Convert one of the initializer elements; do not call groktypename(). (get_arg_type_list, start_method_def, gen_method_def): Account for new representation of variable arguments and '...' in Objective-C methods; add Objective-C++ impedance matching code. (is_objc_type_qualifier): Remove function. (adjust_type_for_id_default): Simplify; there is no longer a need to wade through declspecs. (lookup_interface, start_class, continue_class, finish_class, start_method_def, start_protocol, build_method_decl, objc_add_method, add_instance_variable, build_ivar_reference, is_ivar, is_private, get_super_receiver, objc_build_finally_epilogue): Make into static functions. (receiver_is_class_object): Use new IS_CLASS() macro. (objc_build_message_expr): Tweak ObjC++ message argument handling; call objc_finish_message_expr() instead of finish_message_expr(). (finish_message_expr): Rename to objc_finish_message_expr(); use OBJC_TYPE_NAME and OBJC_SET_TYPE_NAME macros instead of TYPE_NAME. call gen_type_name() instead of gen_declaration(); call objc_is_id() instead of using IS_ID and IS_CLASS; Use objc_class_name instead of calling get_identifier("Class"); handle CONVERT_EXPRs in receiver. (build_objc_method_call, warn_with_method): Do not call groktypename(). (build_ivar_reference): Call convert() instead of clobbering in a type. (hash_init): Initialize string_htab hash table. (add_instance_variable): Simplify parameter list; do not call grokfield(); do not populate CLASS_IVARS list. (start_class): Check for the existence of super class, if one was specified. (continue_class): Use CLASS_RAW_IVARS rather than CLASS_IVARS; do not call build_class_template(); adjust call to get_class_ivars(); call build_decl(), pushdecl() and finish_decl() instead of define_decl(). (finish_class): Call build_decl(), pushdecl() and finish_decl() instead of define_decl(). (add_protocols): Use PROTOCOL_BINFO_ELTS for the tree vector size. (start_protocol): Do not call build_protocol_template(); use PROTOCOL_BINFO_ELTS for the tree vector size. (encode_type_qualifiers): Do not handle the 'const' qualifier here. (encode_pointer): Encode 'const char *' as 'r*', for backwards compatibility. (encode_array): Use HOST_WIDE_INT_PRINT_DEC instead of "%ld". (encode_type): Handle the 'const' qualifier here. (objc_parmlist): New global variable, sued by objc_push_parm and objc_get_parm_info(). (objc_push_parm, objc_get_parm_info): New functions. (objc_expr_last): Remove function. (synth_self_and_ucmd_args): For instance methods, use the instance type for 'self'; call objc_push_parm() instead of push_parm_decl(). (start_method_def): Do not call push_scope(), declare_parm_level(), pop_scope(), push_parm_decl(), store_parm_decls() or objc_expr_last(); just use objc_push_parm() and objc_get_parm_info(). (comp_method_with_proto): Remove function. (objc_types_are_equivalent): Strip away indirections before comparing underlying types. (comp_proto_with_proto): Do not call groktypename(); types are no longer in raw declspec format. (objc_start_function): New function. (really_start_method): Call comp_proto_with_proto() instead of comp_method_with_proto(); call objc_start_function() instead of hand-crafting a function declarator. (continue_method_def, objc_expand_function_end): Remove functions. (get_super_receiver): Call objc_get_current_scope() instead of get_current_scope(); reference 'super_class' field (instead of 'class'). (finish_method_def): Rename to objc_finish_method_definition() and add a function decl parameter; move method encoding call from objc_expand_function_end(). (is_complex_decl, adorn_decl, gen_declarator, gen_declspecs, gen_declaration_1): Remove functions. (tmpbuf, RAW_DECLSPEC): Remove. (gen_declaration): Remove second parameter; simplify to deal with TYPE_P nodes instead of raw declspecs. (gen_type_name, gen_type_name_0): New functions. (gen_method_decl): Remove second parameter; call gen_type_name() instead of gen_declaration_1(). (dump_interface): Adjust calls to gen_declaration() and gen_method_decl(); do not allocate a separate string buffer. (init_objc): Allocate a larger string buffer to accommodate dump_interface(); adjust call to build_module_descriptor(); add call to build_module_initializer_routine() for the GNU runtime. (generate_classref_translation_entry): Do not call start_decl(); call finish_var_decl() instead of finish_decl(); call convert() instead of build_c_cast(). * objc-act.h (CLASS_OWN_IVARS): Remove accessor. (CLASS_BINFO_ELTS): Reduce from 6 to 5, now that CLASS_OWN_IVARS is gone. (OCTI_GNU_INIT_DECL, GNU_INIT_decl): New. (OCTI_ELLIPSIS_NODE, objc_ellipsis_node): Remove. (OCTI_ID_ID, id_type, objc_id_id): Rename to OCTI_ID_NAME, objc_object_type and objc_object_name, respectively. (OCTI_CLS_REF, OCTI_CLASS_NAME, objc_class_reference, objc_class_name): New. (IS_CLASS): New macro. (IS_ID, IS_SUPER): Robustify. (OCTI_EXECCLASS_DECL, execclass_decl): New. (finish_file, start_class, continue_class, finish_class, start_method_def, continue_method_def, finish_method_def, start_protocol, finish_protocol, objc_build_throw_stmt, objc_build_try_catch_finally_stmt, objc_build_synchronized_prologue, objc_build_synchronized_epilogue, objc_build_try_prologue, objc_build_try_epilogue, objc_build_catch_stmt, objc_build_catch_epilogue, objc_build_finally_prologue, objc_build_finally_epilogue, is_ivar, is_private, is_public, add_instance_variable, objc_add_method, get_super_receiver, objc_clear_super_receiver, get_class_ivars_from_name, get_class_reference, get_static_reference, get_object_reference, build_message_expr, finish_message_expr, build_selector_expr, build_ivar_reference, build_keyword_decl, build_method_decl, build_protocol_expr, build_objc_string_object, objc_declare_alias, objc_declare_class, objc_declare_protocols, objc_comptypes, objc_check_decl, build_encode_expr): Remove prototypes. (imp_count, cat_count): Make GGC-aware. (OBJC_SET_TYPE_NAME): New macro. From-SVN: r87168
2004-09-08 02:49:44 +02:00
static void
build_module_initializer_routine (void)
{
tree body;
1992-01-18 00:15:38 +01:00
Makefile.in (c-parse.o): Depend on $(C_COMMON_H). [gcc/ChangeLog] 2004-09-07 Ziemowit Laski <zlaski@apple.com> * Makefile.in (c-parse.o): Depend on $(C_COMMON_H). * c-parse.in: Include c-common.h instead of objc-act.h. (ivar_decl_list, ivar_decls, ivar_decl, ivars, ivar_declarator, myparms, myparm): Remove %type declarations. (methodtype, optparms, OBJC_TYPE_QUAL, objc_quals, objc_qual, objc_typename, objc_try_catch_stmt, optellipsis): Add %type declarations. (objc_inherit_code, objc_public_flag): Remove. (typespec_nonreserved_nonattr): Call objc_get_protocol_qualified_type() instead of get_static_reference() and get_protocol_reference(). (stmt_nocomp): Call grokparm() on @catch parameter. (objcdef): Move semantic action to objc_finish_implementation(). (classdef): Move semantic action to objc_start_class_interface(), objc_continue_interface(), objc_finish_interface(), objc_start_class_implementation(), objc_continue_implementation(), objc_start_category_interface() and objc_start_category_implementation(). (protocoldef): Move semantic actions to objc_start_protocol() and objc_finish_interface(). (ivar_decl_list): Remove nonterminal. (visibility_spec): Move semantic actions to objc_set_visibility(). (ivar_decls): Remove assignment to $$. (ivar_decl): Rephrase in terms of component_decl; call objc_add_instance_variable(). (ivars, ivar_declarator): Remove nonterminals. (opt_semi): New nonterminal. (methodtype): Remove semantic actions. (methoddef): Move semantic actions to objc_set_method_type(), objc_start_method_definition() and objc_finish_method_definition(). (methodproto): Move semantic actions to objc_set_method_type() and objc_add_method_declaration(). (methoddecl): Use objc_typename instead of typename; move semantic actions to objc_build_method_signature(). (optarglist, myxdecls, mydecl, myparms, myparm): Remove nonterminals. (optparmlist): Express in terms of optparms and optellipsis. (optparms, optellipsis, objc_qual, objc_quals, objc_typename): New nonterminals. (keyworddecl): Use objc_typename instead of typename. (rid_to_yy): Mark RID_IN, RID_OUT, RID_INOUT, RID_BYCOPY, RID_BYREF and RID_ONEWAY as returning OBJC_TYPE_QUAL to yyparse(). [gcc/objc/ChangeLog] 2004-09-07 Ziemowit Laski <zlaski@apple.com> * Make-lang.in (objc/objc-parse.o): Depend on $(C_COMMON_H) instead of objc/objc-act.h. (objc/objc-act.o): Depend on $(HASHTAB_H). * objc-act.c: Include hashtab.h; in ObjC++ mode, include cp-tree.h and objcp-decl.h instead of c-tree.h. (build_module_descriptor, get_class_ivars, synth_id_with_class_suffix, error_with_ivar, gen_method_decl, gen_declaration, setup_string_decl, build_protocol_template): Adjust prototypes. (build_module_initializer_routine, start_class, continue_class, finish_class, start_method_def, objc_start_function, start_protocol, build_method_decl, objc_add_method, add_instance_variable, build_ivar_reference, is_ivar, is_private, get_super_receiver, build_selector_table_decl, objc_push_parm, objc_get_parm_info, gen_type_name, gen_type_name_0, start_var_decl, finish_var_decl, create_field_decl): New prototypes. (objc_expand_function_end, comp_method_with_proto, objc_expr_last, gen_declaration_1, gen_declarator, is_complex_decl, adorn_decl, define_decl, create_builtin_decl, gen_declspecs): Remove prototypes. (TYPE_ID): Rename to OBJECT_TYPEDEF_NAME. (CLASS_TYPEDEF_NAME): New. (TAG_EXECCLASS): Change from a global variable to a #define. (TAG_RETURN_STRUCT): Delete. (TAG_GNUINIT): New, holds '__objc_gnu_init' name. (objc_inherit_code, objc_public_flag): New, moved from c-parse.in. (string_descriptor): New struct. (string_htab): New hash table. (string_hash, string_eq): New prototypes. (generate_struct_by_value_array): Call create_field_decl() instead of create_builtin_decl(). (objc_init): Do not initialize objc_ellipsis_node or TAG_EXECCLASS; In ObjC++ mode, call cxx_init() instead of c_objc_common_init(). (objc_finish_file): In ObjC++, call instantiate_pending_templates() and cp_finish_file(). (define_decl, get_static_reference, get_protocol_reference, create_builtin_decl): Remove functions. (objc_start_class_interface, objc_start_category_interface, objc_start_protocol, objc_continue_interface, objc_finish_interface, objc_start_class_implementation, objc_start_category_implementation, objc_continue_implementation, objc_finish_implementation, objc_set_visibility, objc_set_method_type, objc_build_method_signature, objc_add_method_declaration, objc_start_method_definition, objc_add_instance_variable, objc_get_protocol_qualified_type, create_field_decl, start_var_decl, finish_var_decl): New functions. (setup_string_decl): Simplify since it is only called once. (synth_module_prologue): Call build_class_template(); predefine 'id' and 'Class' as typedefs; rename 'temp_type' to 'type'; disable debug hooks for duration of function; fix GNU runtime messenger signatures to correspond to reality; forward-declare '__objc_exec_class' for the GNU runtime; call build_selector_table_decl(); in ObjC++ mode, generate 'extern "C" { ... }' wrappers around synthesized declarations; call build_protocol_template() and build_category_template(). (string_hash, string_eq): New functions. (objc_build_string_object): Check metaclass correctness only once; store string literals in hash table. (objc_build_constructor): Do not convert initializer elements; adjust for ObjC++ impedance mismatch. (build_objc_symtab_template): Call create_field_decl() instead of create_builtin_decl(). (init_objc_symtab): Add missing conversion to initializer element. (build_metadata_decl): Call start_var_decl() instead of define_decl(). (generate_objc_symtab_decl): Do not call build_category_template(); call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(). (build_module_descriptor): Call create_field_decl() instead of grokfield(); call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(); always mark module descriptor as used; move GNU runtime-specific functionality to build_module_initializer_routine(). (build_module_initializer_routine): New function, broken off of build_module_descriptor(). (objc_static_init_needed_p, objc_generate_static_init_call): New functions. (generate_static_references, generate_strings, build_selector_translation_table, generate_descriptor_table, generate_ivars_list, generate_dispatch_table, generate_category): Call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(); build a type directly instead of via groktypename(). (build_selector_reference_decl, build_selector_table_decl, build_class_reference_decl, build_protocol_reference, generate_objc_image_info): Call start_var_decl() instead of build_decl(). (build_selector_reference): For GNU runtime, do not call build_selector_reference_decl(). (build_selector, build_typed_selector_reference): Always convert result to the selector type. (add_objc_string): Cast return value to 'char *'. (build_method_prototype_template, build_selector_template, build_method_template): Use actual selector type for fields pointing to selectors. (finish_objc): For GNU runtime, call build_module_initializer_routine() after build_module_descriptor(). (generate_protocol_list, generate_shared_structures): Call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(); build a type directly instead of via groktypename(). (synth_id_with_class_suffix): Return a string. (get_arg_type_list): For instance methods, use the instance type for 'self'; do not call groktypename_in_parm_context(). (build_objc_string_decl): Squash redeclaration errors in ObjC++. (objc_is_class_name): Use OBJC_TYPE_NAME instead of TYPE_NAME; handle RECORD_TYPEs in ObjC as well as ObjC++. (objc_is_id): New function. (objc_is_object_ptr): Return the canonical type node. (objc_get_class_ivars): Simplify using get_class_ivars(). (get_class_ivars): Remove second parameter; create a fresh copy of the ivar list for each call; do not check for existence of super class. (objc_eh_runtime_type): Mark #ifndef OBJCPLUS. (objc_init_exceptions): When using SJLJ-style exceptions, require the use of '-fobjc-exceptions' flag; do not require it for DWARF-style exceptions. (objc_build_exc_ptr, next_sjlj_build_try_catch_finally): Use objc_object_type instead of objc_id_type. (objc_begin_catch_clause): Convert the incoming PARM_DECL into a VAR_DECL before placing it in the appropriate scope; do not call define_decl(); adjust call to c_begin_compound_stmt(); use objc_object_type instead of objc_id_type. (build_next_objc_exception_stuff): Call create_field_decl() instead of create_builtin_decl(); construct type directly instead of calling groktypename(); use OBJC_VOID_AT_END to mark end of function parameters. (build_private_template): Adjust call to get_class_ivars(); build a type directly instead of via groktypename(). (build_protocol_template, build_method_prototype_list_template, build_method_prototype_template, build_category_template, build_selector_template, build_class_template, build_super_template, build_ivar_template, build_ivar_list_template, build_method_list_template, build_method_template): Call create_field_decl() instead of grokfield(). (objc_method_parm_type): Do not call groktypename(). (generate_descriptor_table): Call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(). (generate_method_descriptors, build_protocol_initializer, generate_dispatch_tables, build_category_initializer, build_shared_structure_initializer): Do not call groktypename(). (generate_protocols): Call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(); do not call groktypename(). (error_with_ivar): Remove last parameter. (check_ivars): Do not iterate ovar CLASS_RAW_IVARS lists in addition to CLASS_IVARS lists; adjust calls to error_with_ivar(). (generate_ivar_lists): Convert one of the initializer elements; do not call groktypename(). (get_arg_type_list, start_method_def, gen_method_def): Account for new representation of variable arguments and '...' in Objective-C methods; add Objective-C++ impedance matching code. (is_objc_type_qualifier): Remove function. (adjust_type_for_id_default): Simplify; there is no longer a need to wade through declspecs. (lookup_interface, start_class, continue_class, finish_class, start_method_def, start_protocol, build_method_decl, objc_add_method, add_instance_variable, build_ivar_reference, is_ivar, is_private, get_super_receiver, objc_build_finally_epilogue): Make into static functions. (receiver_is_class_object): Use new IS_CLASS() macro. (objc_build_message_expr): Tweak ObjC++ message argument handling; call objc_finish_message_expr() instead of finish_message_expr(). (finish_message_expr): Rename to objc_finish_message_expr(); use OBJC_TYPE_NAME and OBJC_SET_TYPE_NAME macros instead of TYPE_NAME. call gen_type_name() instead of gen_declaration(); call objc_is_id() instead of using IS_ID and IS_CLASS; Use objc_class_name instead of calling get_identifier("Class"); handle CONVERT_EXPRs in receiver. (build_objc_method_call, warn_with_method): Do not call groktypename(). (build_ivar_reference): Call convert() instead of clobbering in a type. (hash_init): Initialize string_htab hash table. (add_instance_variable): Simplify parameter list; do not call grokfield(); do not populate CLASS_IVARS list. (start_class): Check for the existence of super class, if one was specified. (continue_class): Use CLASS_RAW_IVARS rather than CLASS_IVARS; do not call build_class_template(); adjust call to get_class_ivars(); call build_decl(), pushdecl() and finish_decl() instead of define_decl(). (finish_class): Call build_decl(), pushdecl() and finish_decl() instead of define_decl(). (add_protocols): Use PROTOCOL_BINFO_ELTS for the tree vector size. (start_protocol): Do not call build_protocol_template(); use PROTOCOL_BINFO_ELTS for the tree vector size. (encode_type_qualifiers): Do not handle the 'const' qualifier here. (encode_pointer): Encode 'const char *' as 'r*', for backwards compatibility. (encode_array): Use HOST_WIDE_INT_PRINT_DEC instead of "%ld". (encode_type): Handle the 'const' qualifier here. (objc_parmlist): New global variable, sued by objc_push_parm and objc_get_parm_info(). (objc_push_parm, objc_get_parm_info): New functions. (objc_expr_last): Remove function. (synth_self_and_ucmd_args): For instance methods, use the instance type for 'self'; call objc_push_parm() instead of push_parm_decl(). (start_method_def): Do not call push_scope(), declare_parm_level(), pop_scope(), push_parm_decl(), store_parm_decls() or objc_expr_last(); just use objc_push_parm() and objc_get_parm_info(). (comp_method_with_proto): Remove function. (objc_types_are_equivalent): Strip away indirections before comparing underlying types. (comp_proto_with_proto): Do not call groktypename(); types are no longer in raw declspec format. (objc_start_function): New function. (really_start_method): Call comp_proto_with_proto() instead of comp_method_with_proto(); call objc_start_function() instead of hand-crafting a function declarator. (continue_method_def, objc_expand_function_end): Remove functions. (get_super_receiver): Call objc_get_current_scope() instead of get_current_scope(); reference 'super_class' field (instead of 'class'). (finish_method_def): Rename to objc_finish_method_definition() and add a function decl parameter; move method encoding call from objc_expand_function_end(). (is_complex_decl, adorn_decl, gen_declarator, gen_declspecs, gen_declaration_1): Remove functions. (tmpbuf, RAW_DECLSPEC): Remove. (gen_declaration): Remove second parameter; simplify to deal with TYPE_P nodes instead of raw declspecs. (gen_type_name, gen_type_name_0): New functions. (gen_method_decl): Remove second parameter; call gen_type_name() instead of gen_declaration_1(). (dump_interface): Adjust calls to gen_declaration() and gen_method_decl(); do not allocate a separate string buffer. (init_objc): Allocate a larger string buffer to accommodate dump_interface(); adjust call to build_module_descriptor(); add call to build_module_initializer_routine() for the GNU runtime. (generate_classref_translation_entry): Do not call start_decl(); call finish_var_decl() instead of finish_decl(); call convert() instead of build_c_cast(). * objc-act.h (CLASS_OWN_IVARS): Remove accessor. (CLASS_BINFO_ELTS): Reduce from 6 to 5, now that CLASS_OWN_IVARS is gone. (OCTI_GNU_INIT_DECL, GNU_INIT_decl): New. (OCTI_ELLIPSIS_NODE, objc_ellipsis_node): Remove. (OCTI_ID_ID, id_type, objc_id_id): Rename to OCTI_ID_NAME, objc_object_type and objc_object_name, respectively. (OCTI_CLS_REF, OCTI_CLASS_NAME, objc_class_reference, objc_class_name): New. (IS_CLASS): New macro. (IS_ID, IS_SUPER): Robustify. (OCTI_EXECCLASS_DECL, execclass_decl): New. (finish_file, start_class, continue_class, finish_class, start_method_def, continue_method_def, finish_method_def, start_protocol, finish_protocol, objc_build_throw_stmt, objc_build_try_catch_finally_stmt, objc_build_synchronized_prologue, objc_build_synchronized_epilogue, objc_build_try_prologue, objc_build_try_epilogue, objc_build_catch_stmt, objc_build_catch_epilogue, objc_build_finally_prologue, objc_build_finally_epilogue, is_ivar, is_private, is_public, add_instance_variable, objc_add_method, get_super_receiver, objc_clear_super_receiver, get_class_ivars_from_name, get_class_reference, get_static_reference, get_object_reference, build_message_expr, finish_message_expr, build_selector_expr, build_ivar_reference, build_keyword_decl, build_method_decl, build_protocol_expr, build_objc_string_object, objc_declare_alias, objc_declare_class, objc_declare_protocols, objc_comptypes, objc_check_decl, build_encode_expr): Remove prototypes. (imp_count, cat_count): Make GGC-aware. (OBJC_SET_TYPE_NAME): New macro. From-SVN: r87168
2004-09-08 02:49:44 +02:00
#ifdef OBJCPLUS
push_lang_context (lang_name_c); /* extern "C" */
#endif
Makefile.in (c-parse.o): Depend on $(C_COMMON_H). [gcc/ChangeLog] 2004-09-07 Ziemowit Laski <zlaski@apple.com> * Makefile.in (c-parse.o): Depend on $(C_COMMON_H). * c-parse.in: Include c-common.h instead of objc-act.h. (ivar_decl_list, ivar_decls, ivar_decl, ivars, ivar_declarator, myparms, myparm): Remove %type declarations. (methodtype, optparms, OBJC_TYPE_QUAL, objc_quals, objc_qual, objc_typename, objc_try_catch_stmt, optellipsis): Add %type declarations. (objc_inherit_code, objc_public_flag): Remove. (typespec_nonreserved_nonattr): Call objc_get_protocol_qualified_type() instead of get_static_reference() and get_protocol_reference(). (stmt_nocomp): Call grokparm() on @catch parameter. (objcdef): Move semantic action to objc_finish_implementation(). (classdef): Move semantic action to objc_start_class_interface(), objc_continue_interface(), objc_finish_interface(), objc_start_class_implementation(), objc_continue_implementation(), objc_start_category_interface() and objc_start_category_implementation(). (protocoldef): Move semantic actions to objc_start_protocol() and objc_finish_interface(). (ivar_decl_list): Remove nonterminal. (visibility_spec): Move semantic actions to objc_set_visibility(). (ivar_decls): Remove assignment to $$. (ivar_decl): Rephrase in terms of component_decl; call objc_add_instance_variable(). (ivars, ivar_declarator): Remove nonterminals. (opt_semi): New nonterminal. (methodtype): Remove semantic actions. (methoddef): Move semantic actions to objc_set_method_type(), objc_start_method_definition() and objc_finish_method_definition(). (methodproto): Move semantic actions to objc_set_method_type() and objc_add_method_declaration(). (methoddecl): Use objc_typename instead of typename; move semantic actions to objc_build_method_signature(). (optarglist, myxdecls, mydecl, myparms, myparm): Remove nonterminals. (optparmlist): Express in terms of optparms and optellipsis. (optparms, optellipsis, objc_qual, objc_quals, objc_typename): New nonterminals. (keyworddecl): Use objc_typename instead of typename. (rid_to_yy): Mark RID_IN, RID_OUT, RID_INOUT, RID_BYCOPY, RID_BYREF and RID_ONEWAY as returning OBJC_TYPE_QUAL to yyparse(). [gcc/objc/ChangeLog] 2004-09-07 Ziemowit Laski <zlaski@apple.com> * Make-lang.in (objc/objc-parse.o): Depend on $(C_COMMON_H) instead of objc/objc-act.h. (objc/objc-act.o): Depend on $(HASHTAB_H). * objc-act.c: Include hashtab.h; in ObjC++ mode, include cp-tree.h and objcp-decl.h instead of c-tree.h. (build_module_descriptor, get_class_ivars, synth_id_with_class_suffix, error_with_ivar, gen_method_decl, gen_declaration, setup_string_decl, build_protocol_template): Adjust prototypes. (build_module_initializer_routine, start_class, continue_class, finish_class, start_method_def, objc_start_function, start_protocol, build_method_decl, objc_add_method, add_instance_variable, build_ivar_reference, is_ivar, is_private, get_super_receiver, build_selector_table_decl, objc_push_parm, objc_get_parm_info, gen_type_name, gen_type_name_0, start_var_decl, finish_var_decl, create_field_decl): New prototypes. (objc_expand_function_end, comp_method_with_proto, objc_expr_last, gen_declaration_1, gen_declarator, is_complex_decl, adorn_decl, define_decl, create_builtin_decl, gen_declspecs): Remove prototypes. (TYPE_ID): Rename to OBJECT_TYPEDEF_NAME. (CLASS_TYPEDEF_NAME): New. (TAG_EXECCLASS): Change from a global variable to a #define. (TAG_RETURN_STRUCT): Delete. (TAG_GNUINIT): New, holds '__objc_gnu_init' name. (objc_inherit_code, objc_public_flag): New, moved from c-parse.in. (string_descriptor): New struct. (string_htab): New hash table. (string_hash, string_eq): New prototypes. (generate_struct_by_value_array): Call create_field_decl() instead of create_builtin_decl(). (objc_init): Do not initialize objc_ellipsis_node or TAG_EXECCLASS; In ObjC++ mode, call cxx_init() instead of c_objc_common_init(). (objc_finish_file): In ObjC++, call instantiate_pending_templates() and cp_finish_file(). (define_decl, get_static_reference, get_protocol_reference, create_builtin_decl): Remove functions. (objc_start_class_interface, objc_start_category_interface, objc_start_protocol, objc_continue_interface, objc_finish_interface, objc_start_class_implementation, objc_start_category_implementation, objc_continue_implementation, objc_finish_implementation, objc_set_visibility, objc_set_method_type, objc_build_method_signature, objc_add_method_declaration, objc_start_method_definition, objc_add_instance_variable, objc_get_protocol_qualified_type, create_field_decl, start_var_decl, finish_var_decl): New functions. (setup_string_decl): Simplify since it is only called once. (synth_module_prologue): Call build_class_template(); predefine 'id' and 'Class' as typedefs; rename 'temp_type' to 'type'; disable debug hooks for duration of function; fix GNU runtime messenger signatures to correspond to reality; forward-declare '__objc_exec_class' for the GNU runtime; call build_selector_table_decl(); in ObjC++ mode, generate 'extern "C" { ... }' wrappers around synthesized declarations; call build_protocol_template() and build_category_template(). (string_hash, string_eq): New functions. (objc_build_string_object): Check metaclass correctness only once; store string literals in hash table. (objc_build_constructor): Do not convert initializer elements; adjust for ObjC++ impedance mismatch. (build_objc_symtab_template): Call create_field_decl() instead of create_builtin_decl(). (init_objc_symtab): Add missing conversion to initializer element. (build_metadata_decl): Call start_var_decl() instead of define_decl(). (generate_objc_symtab_decl): Do not call build_category_template(); call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(). (build_module_descriptor): Call create_field_decl() instead of grokfield(); call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(); always mark module descriptor as used; move GNU runtime-specific functionality to build_module_initializer_routine(). (build_module_initializer_routine): New function, broken off of build_module_descriptor(). (objc_static_init_needed_p, objc_generate_static_init_call): New functions. (generate_static_references, generate_strings, build_selector_translation_table, generate_descriptor_table, generate_ivars_list, generate_dispatch_table, generate_category): Call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(); build a type directly instead of via groktypename(). (build_selector_reference_decl, build_selector_table_decl, build_class_reference_decl, build_protocol_reference, generate_objc_image_info): Call start_var_decl() instead of build_decl(). (build_selector_reference): For GNU runtime, do not call build_selector_reference_decl(). (build_selector, build_typed_selector_reference): Always convert result to the selector type. (add_objc_string): Cast return value to 'char *'. (build_method_prototype_template, build_selector_template, build_method_template): Use actual selector type for fields pointing to selectors. (finish_objc): For GNU runtime, call build_module_initializer_routine() after build_module_descriptor(). (generate_protocol_list, generate_shared_structures): Call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(); build a type directly instead of via groktypename(). (synth_id_with_class_suffix): Return a string. (get_arg_type_list): For instance methods, use the instance type for 'self'; do not call groktypename_in_parm_context(). (build_objc_string_decl): Squash redeclaration errors in ObjC++. (objc_is_class_name): Use OBJC_TYPE_NAME instead of TYPE_NAME; handle RECORD_TYPEs in ObjC as well as ObjC++. (objc_is_id): New function. (objc_is_object_ptr): Return the canonical type node. (objc_get_class_ivars): Simplify using get_class_ivars(). (get_class_ivars): Remove second parameter; create a fresh copy of the ivar list for each call; do not check for existence of super class. (objc_eh_runtime_type): Mark #ifndef OBJCPLUS. (objc_init_exceptions): When using SJLJ-style exceptions, require the use of '-fobjc-exceptions' flag; do not require it for DWARF-style exceptions. (objc_build_exc_ptr, next_sjlj_build_try_catch_finally): Use objc_object_type instead of objc_id_type. (objc_begin_catch_clause): Convert the incoming PARM_DECL into a VAR_DECL before placing it in the appropriate scope; do not call define_decl(); adjust call to c_begin_compound_stmt(); use objc_object_type instead of objc_id_type. (build_next_objc_exception_stuff): Call create_field_decl() instead of create_builtin_decl(); construct type directly instead of calling groktypename(); use OBJC_VOID_AT_END to mark end of function parameters. (build_private_template): Adjust call to get_class_ivars(); build a type directly instead of via groktypename(). (build_protocol_template, build_method_prototype_list_template, build_method_prototype_template, build_category_template, build_selector_template, build_class_template, build_super_template, build_ivar_template, build_ivar_list_template, build_method_list_template, build_method_template): Call create_field_decl() instead of grokfield(). (objc_method_parm_type): Do not call groktypename(). (generate_descriptor_table): Call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(). (generate_method_descriptors, build_protocol_initializer, generate_dispatch_tables, build_category_initializer, build_shared_structure_initializer): Do not call groktypename(). (generate_protocols): Call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(); do not call groktypename(). (error_with_ivar): Remove last parameter. (check_ivars): Do not iterate ovar CLASS_RAW_IVARS lists in addition to CLASS_IVARS lists; adjust calls to error_with_ivar(). (generate_ivar_lists): Convert one of the initializer elements; do not call groktypename(). (get_arg_type_list, start_method_def, gen_method_def): Account for new representation of variable arguments and '...' in Objective-C methods; add Objective-C++ impedance matching code. (is_objc_type_qualifier): Remove function. (adjust_type_for_id_default): Simplify; there is no longer a need to wade through declspecs. (lookup_interface, start_class, continue_class, finish_class, start_method_def, start_protocol, build_method_decl, objc_add_method, add_instance_variable, build_ivar_reference, is_ivar, is_private, get_super_receiver, objc_build_finally_epilogue): Make into static functions. (receiver_is_class_object): Use new IS_CLASS() macro. (objc_build_message_expr): Tweak ObjC++ message argument handling; call objc_finish_message_expr() instead of finish_message_expr(). (finish_message_expr): Rename to objc_finish_message_expr(); use OBJC_TYPE_NAME and OBJC_SET_TYPE_NAME macros instead of TYPE_NAME. call gen_type_name() instead of gen_declaration(); call objc_is_id() instead of using IS_ID and IS_CLASS; Use objc_class_name instead of calling get_identifier("Class"); handle CONVERT_EXPRs in receiver. (build_objc_method_call, warn_with_method): Do not call groktypename(). (build_ivar_reference): Call convert() instead of clobbering in a type. (hash_init): Initialize string_htab hash table. (add_instance_variable): Simplify parameter list; do not call grokfield(); do not populate CLASS_IVARS list. (start_class): Check for the existence of super class, if one was specified. (continue_class): Use CLASS_RAW_IVARS rather than CLASS_IVARS; do not call build_class_template(); adjust call to get_class_ivars(); call build_decl(), pushdecl() and finish_decl() instead of define_decl(). (finish_class): Call build_decl(), pushdecl() and finish_decl() instead of define_decl(). (add_protocols): Use PROTOCOL_BINFO_ELTS for the tree vector size. (start_protocol): Do not call build_protocol_template(); use PROTOCOL_BINFO_ELTS for the tree vector size. (encode_type_qualifiers): Do not handle the 'const' qualifier here. (encode_pointer): Encode 'const char *' as 'r*', for backwards compatibility. (encode_array): Use HOST_WIDE_INT_PRINT_DEC instead of "%ld". (encode_type): Handle the 'const' qualifier here. (objc_parmlist): New global variable, sued by objc_push_parm and objc_get_parm_info(). (objc_push_parm, objc_get_parm_info): New functions. (objc_expr_last): Remove function. (synth_self_and_ucmd_args): For instance methods, use the instance type for 'self'; call objc_push_parm() instead of push_parm_decl(). (start_method_def): Do not call push_scope(), declare_parm_level(), pop_scope(), push_parm_decl(), store_parm_decls() or objc_expr_last(); just use objc_push_parm() and objc_get_parm_info(). (comp_method_with_proto): Remove function. (objc_types_are_equivalent): Strip away indirections before comparing underlying types. (comp_proto_with_proto): Do not call groktypename(); types are no longer in raw declspec format. (objc_start_function): New function. (really_start_method): Call comp_proto_with_proto() instead of comp_method_with_proto(); call objc_start_function() instead of hand-crafting a function declarator. (continue_method_def, objc_expand_function_end): Remove functions. (get_super_receiver): Call objc_get_current_scope() instead of get_current_scope(); reference 'super_class' field (instead of 'class'). (finish_method_def): Rename to objc_finish_method_definition() and add a function decl parameter; move method encoding call from objc_expand_function_end(). (is_complex_decl, adorn_decl, gen_declarator, gen_declspecs, gen_declaration_1): Remove functions. (tmpbuf, RAW_DECLSPEC): Remove. (gen_declaration): Remove second parameter; simplify to deal with TYPE_P nodes instead of raw declspecs. (gen_type_name, gen_type_name_0): New functions. (gen_method_decl): Remove second parameter; call gen_type_name() instead of gen_declaration_1(). (dump_interface): Adjust calls to gen_declaration() and gen_method_decl(); do not allocate a separate string buffer. (init_objc): Allocate a larger string buffer to accommodate dump_interface(); adjust call to build_module_descriptor(); add call to build_module_initializer_routine() for the GNU runtime. (generate_classref_translation_entry): Do not call start_decl(); call finish_var_decl() instead of finish_decl(); call convert() instead of build_c_cast(). * objc-act.h (CLASS_OWN_IVARS): Remove accessor. (CLASS_BINFO_ELTS): Reduce from 6 to 5, now that CLASS_OWN_IVARS is gone. (OCTI_GNU_INIT_DECL, GNU_INIT_decl): New. (OCTI_ELLIPSIS_NODE, objc_ellipsis_node): Remove. (OCTI_ID_ID, id_type, objc_id_id): Rename to OCTI_ID_NAME, objc_object_type and objc_object_name, respectively. (OCTI_CLS_REF, OCTI_CLASS_NAME, objc_class_reference, objc_class_name): New. (IS_CLASS): New macro. (IS_ID, IS_SUPER): Robustify. (OCTI_EXECCLASS_DECL, execclass_decl): New. (finish_file, start_class, continue_class, finish_class, start_method_def, continue_method_def, finish_method_def, start_protocol, finish_protocol, objc_build_throw_stmt, objc_build_try_catch_finally_stmt, objc_build_synchronized_prologue, objc_build_synchronized_epilogue, objc_build_try_prologue, objc_build_try_epilogue, objc_build_catch_stmt, objc_build_catch_epilogue, objc_build_finally_prologue, objc_build_finally_epilogue, is_ivar, is_private, is_public, add_instance_variable, objc_add_method, get_super_receiver, objc_clear_super_receiver, get_class_ivars_from_name, get_class_reference, get_static_reference, get_object_reference, build_message_expr, finish_message_expr, build_selector_expr, build_ivar_reference, build_keyword_decl, build_method_decl, build_protocol_expr, build_objc_string_object, objc_declare_alias, objc_declare_class, objc_declare_protocols, objc_comptypes, objc_check_decl, build_encode_expr): Remove prototypes. (imp_count, cat_count): Make GGC-aware. (OBJC_SET_TYPE_NAME): New macro. From-SVN: r87168
2004-09-08 02:49:44 +02:00
objc_push_parm (build_decl (PARM_DECL, NULL_TREE, void_type_node));
objc_start_function (get_identifier (TAG_GNUINIT),
build_function_type (void_type_node,
OBJC_VOID_AT_END),
NULL_TREE, objc_get_parm_info (0));
body = c_begin_compound_stmt (true);
add_stmt (build_function_call
(execclass_decl,
build_tree_list
(NULL_TREE,
build_unary_op (ADDR_EXPR,
UOBJC_MODULES_decl, 0))));
add_stmt (c_end_compound_stmt (body, true));
TREE_PUBLIC (current_function_decl) = 0;
Makefile.in (c-parse.o): Depend on $(C_COMMON_H). [gcc/ChangeLog] 2004-09-07 Ziemowit Laski <zlaski@apple.com> * Makefile.in (c-parse.o): Depend on $(C_COMMON_H). * c-parse.in: Include c-common.h instead of objc-act.h. (ivar_decl_list, ivar_decls, ivar_decl, ivars, ivar_declarator, myparms, myparm): Remove %type declarations. (methodtype, optparms, OBJC_TYPE_QUAL, objc_quals, objc_qual, objc_typename, objc_try_catch_stmt, optellipsis): Add %type declarations. (objc_inherit_code, objc_public_flag): Remove. (typespec_nonreserved_nonattr): Call objc_get_protocol_qualified_type() instead of get_static_reference() and get_protocol_reference(). (stmt_nocomp): Call grokparm() on @catch parameter. (objcdef): Move semantic action to objc_finish_implementation(). (classdef): Move semantic action to objc_start_class_interface(), objc_continue_interface(), objc_finish_interface(), objc_start_class_implementation(), objc_continue_implementation(), objc_start_category_interface() and objc_start_category_implementation(). (protocoldef): Move semantic actions to objc_start_protocol() and objc_finish_interface(). (ivar_decl_list): Remove nonterminal. (visibility_spec): Move semantic actions to objc_set_visibility(). (ivar_decls): Remove assignment to $$. (ivar_decl): Rephrase in terms of component_decl; call objc_add_instance_variable(). (ivars, ivar_declarator): Remove nonterminals. (opt_semi): New nonterminal. (methodtype): Remove semantic actions. (methoddef): Move semantic actions to objc_set_method_type(), objc_start_method_definition() and objc_finish_method_definition(). (methodproto): Move semantic actions to objc_set_method_type() and objc_add_method_declaration(). (methoddecl): Use objc_typename instead of typename; move semantic actions to objc_build_method_signature(). (optarglist, myxdecls, mydecl, myparms, myparm): Remove nonterminals. (optparmlist): Express in terms of optparms and optellipsis. (optparms, optellipsis, objc_qual, objc_quals, objc_typename): New nonterminals. (keyworddecl): Use objc_typename instead of typename. (rid_to_yy): Mark RID_IN, RID_OUT, RID_INOUT, RID_BYCOPY, RID_BYREF and RID_ONEWAY as returning OBJC_TYPE_QUAL to yyparse(). [gcc/objc/ChangeLog] 2004-09-07 Ziemowit Laski <zlaski@apple.com> * Make-lang.in (objc/objc-parse.o): Depend on $(C_COMMON_H) instead of objc/objc-act.h. (objc/objc-act.o): Depend on $(HASHTAB_H). * objc-act.c: Include hashtab.h; in ObjC++ mode, include cp-tree.h and objcp-decl.h instead of c-tree.h. (build_module_descriptor, get_class_ivars, synth_id_with_class_suffix, error_with_ivar, gen_method_decl, gen_declaration, setup_string_decl, build_protocol_template): Adjust prototypes. (build_module_initializer_routine, start_class, continue_class, finish_class, start_method_def, objc_start_function, start_protocol, build_method_decl, objc_add_method, add_instance_variable, build_ivar_reference, is_ivar, is_private, get_super_receiver, build_selector_table_decl, objc_push_parm, objc_get_parm_info, gen_type_name, gen_type_name_0, start_var_decl, finish_var_decl, create_field_decl): New prototypes. (objc_expand_function_end, comp_method_with_proto, objc_expr_last, gen_declaration_1, gen_declarator, is_complex_decl, adorn_decl, define_decl, create_builtin_decl, gen_declspecs): Remove prototypes. (TYPE_ID): Rename to OBJECT_TYPEDEF_NAME. (CLASS_TYPEDEF_NAME): New. (TAG_EXECCLASS): Change from a global variable to a #define. (TAG_RETURN_STRUCT): Delete. (TAG_GNUINIT): New, holds '__objc_gnu_init' name. (objc_inherit_code, objc_public_flag): New, moved from c-parse.in. (string_descriptor): New struct. (string_htab): New hash table. (string_hash, string_eq): New prototypes. (generate_struct_by_value_array): Call create_field_decl() instead of create_builtin_decl(). (objc_init): Do not initialize objc_ellipsis_node or TAG_EXECCLASS; In ObjC++ mode, call cxx_init() instead of c_objc_common_init(). (objc_finish_file): In ObjC++, call instantiate_pending_templates() and cp_finish_file(). (define_decl, get_static_reference, get_protocol_reference, create_builtin_decl): Remove functions. (objc_start_class_interface, objc_start_category_interface, objc_start_protocol, objc_continue_interface, objc_finish_interface, objc_start_class_implementation, objc_start_category_implementation, objc_continue_implementation, objc_finish_implementation, objc_set_visibility, objc_set_method_type, objc_build_method_signature, objc_add_method_declaration, objc_start_method_definition, objc_add_instance_variable, objc_get_protocol_qualified_type, create_field_decl, start_var_decl, finish_var_decl): New functions. (setup_string_decl): Simplify since it is only called once. (synth_module_prologue): Call build_class_template(); predefine 'id' and 'Class' as typedefs; rename 'temp_type' to 'type'; disable debug hooks for duration of function; fix GNU runtime messenger signatures to correspond to reality; forward-declare '__objc_exec_class' for the GNU runtime; call build_selector_table_decl(); in ObjC++ mode, generate 'extern "C" { ... }' wrappers around synthesized declarations; call build_protocol_template() and build_category_template(). (string_hash, string_eq): New functions. (objc_build_string_object): Check metaclass correctness only once; store string literals in hash table. (objc_build_constructor): Do not convert initializer elements; adjust for ObjC++ impedance mismatch. (build_objc_symtab_template): Call create_field_decl() instead of create_builtin_decl(). (init_objc_symtab): Add missing conversion to initializer element. (build_metadata_decl): Call start_var_decl() instead of define_decl(). (generate_objc_symtab_decl): Do not call build_category_template(); call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(). (build_module_descriptor): Call create_field_decl() instead of grokfield(); call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(); always mark module descriptor as used; move GNU runtime-specific functionality to build_module_initializer_routine(). (build_module_initializer_routine): New function, broken off of build_module_descriptor(). (objc_static_init_needed_p, objc_generate_static_init_call): New functions. (generate_static_references, generate_strings, build_selector_translation_table, generate_descriptor_table, generate_ivars_list, generate_dispatch_table, generate_category): Call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(); build a type directly instead of via groktypename(). (build_selector_reference_decl, build_selector_table_decl, build_class_reference_decl, build_protocol_reference, generate_objc_image_info): Call start_var_decl() instead of build_decl(). (build_selector_reference): For GNU runtime, do not call build_selector_reference_decl(). (build_selector, build_typed_selector_reference): Always convert result to the selector type. (add_objc_string): Cast return value to 'char *'. (build_method_prototype_template, build_selector_template, build_method_template): Use actual selector type for fields pointing to selectors. (finish_objc): For GNU runtime, call build_module_initializer_routine() after build_module_descriptor(). (generate_protocol_list, generate_shared_structures): Call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(); build a type directly instead of via groktypename(). (synth_id_with_class_suffix): Return a string. (get_arg_type_list): For instance methods, use the instance type for 'self'; do not call groktypename_in_parm_context(). (build_objc_string_decl): Squash redeclaration errors in ObjC++. (objc_is_class_name): Use OBJC_TYPE_NAME instead of TYPE_NAME; handle RECORD_TYPEs in ObjC as well as ObjC++. (objc_is_id): New function. (objc_is_object_ptr): Return the canonical type node. (objc_get_class_ivars): Simplify using get_class_ivars(). (get_class_ivars): Remove second parameter; create a fresh copy of the ivar list for each call; do not check for existence of super class. (objc_eh_runtime_type): Mark #ifndef OBJCPLUS. (objc_init_exceptions): When using SJLJ-style exceptions, require the use of '-fobjc-exceptions' flag; do not require it for DWARF-style exceptions. (objc_build_exc_ptr, next_sjlj_build_try_catch_finally): Use objc_object_type instead of objc_id_type. (objc_begin_catch_clause): Convert the incoming PARM_DECL into a VAR_DECL before placing it in the appropriate scope; do not call define_decl(); adjust call to c_begin_compound_stmt(); use objc_object_type instead of objc_id_type. (build_next_objc_exception_stuff): Call create_field_decl() instead of create_builtin_decl(); construct type directly instead of calling groktypename(); use OBJC_VOID_AT_END to mark end of function parameters. (build_private_template): Adjust call to get_class_ivars(); build a type directly instead of via groktypename(). (build_protocol_template, build_method_prototype_list_template, build_method_prototype_template, build_category_template, build_selector_template, build_class_template, build_super_template, build_ivar_template, build_ivar_list_template, build_method_list_template, build_method_template): Call create_field_decl() instead of grokfield(). (objc_method_parm_type): Do not call groktypename(). (generate_descriptor_table): Call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(). (generate_method_descriptors, build_protocol_initializer, generate_dispatch_tables, build_category_initializer, build_shared_structure_initializer): Do not call groktypename(). (generate_protocols): Call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(); do not call groktypename(). (error_with_ivar): Remove last parameter. (check_ivars): Do not iterate ovar CLASS_RAW_IVARS lists in addition to CLASS_IVARS lists; adjust calls to error_with_ivar(). (generate_ivar_lists): Convert one of the initializer elements; do not call groktypename(). (get_arg_type_list, start_method_def, gen_method_def): Account for new representation of variable arguments and '...' in Objective-C methods; add Objective-C++ impedance matching code. (is_objc_type_qualifier): Remove function. (adjust_type_for_id_default): Simplify; there is no longer a need to wade through declspecs. (lookup_interface, start_class, continue_class, finish_class, start_method_def, start_protocol, build_method_decl, objc_add_method, add_instance_variable, build_ivar_reference, is_ivar, is_private, get_super_receiver, objc_build_finally_epilogue): Make into static functions. (receiver_is_class_object): Use new IS_CLASS() macro. (objc_build_message_expr): Tweak ObjC++ message argument handling; call objc_finish_message_expr() instead of finish_message_expr(). (finish_message_expr): Rename to objc_finish_message_expr(); use OBJC_TYPE_NAME and OBJC_SET_TYPE_NAME macros instead of TYPE_NAME. call gen_type_name() instead of gen_declaration(); call objc_is_id() instead of using IS_ID and IS_CLASS; Use objc_class_name instead of calling get_identifier("Class"); handle CONVERT_EXPRs in receiver. (build_objc_method_call, warn_with_method): Do not call groktypename(). (build_ivar_reference): Call convert() instead of clobbering in a type. (hash_init): Initialize string_htab hash table. (add_instance_variable): Simplify parameter list; do not call grokfield(); do not populate CLASS_IVARS list. (start_class): Check for the existence of super class, if one was specified. (continue_class): Use CLASS_RAW_IVARS rather than CLASS_IVARS; do not call build_class_template(); adjust call to get_class_ivars(); call build_decl(), pushdecl() and finish_decl() instead of define_decl(). (finish_class): Call build_decl(), pushdecl() and finish_decl() instead of define_decl(). (add_protocols): Use PROTOCOL_BINFO_ELTS for the tree vector size. (start_protocol): Do not call build_protocol_template(); use PROTOCOL_BINFO_ELTS for the tree vector size. (encode_type_qualifiers): Do not handle the 'const' qualifier here. (encode_pointer): Encode 'const char *' as 'r*', for backwards compatibility. (encode_array): Use HOST_WIDE_INT_PRINT_DEC instead of "%ld". (encode_type): Handle the 'const' qualifier here. (objc_parmlist): New global variable, sued by objc_push_parm and objc_get_parm_info(). (objc_push_parm, objc_get_parm_info): New functions. (objc_expr_last): Remove function. (synth_self_and_ucmd_args): For instance methods, use the instance type for 'self'; call objc_push_parm() instead of push_parm_decl(). (start_method_def): Do not call push_scope(), declare_parm_level(), pop_scope(), push_parm_decl(), store_parm_decls() or objc_expr_last(); just use objc_push_parm() and objc_get_parm_info(). (comp_method_with_proto): Remove function. (objc_types_are_equivalent): Strip away indirections before comparing underlying types. (comp_proto_with_proto): Do not call groktypename(); types are no longer in raw declspec format. (objc_start_function): New function. (really_start_method): Call comp_proto_with_proto() instead of comp_method_with_proto(); call objc_start_function() instead of hand-crafting a function declarator. (continue_method_def, objc_expand_function_end): Remove functions. (get_super_receiver): Call objc_get_current_scope() instead of get_current_scope(); reference 'super_class' field (instead of 'class'). (finish_method_def): Rename to objc_finish_method_definition() and add a function decl parameter; move method encoding call from objc_expand_function_end(). (is_complex_decl, adorn_decl, gen_declarator, gen_declspecs, gen_declaration_1): Remove functions. (tmpbuf, RAW_DECLSPEC): Remove. (gen_declaration): Remove second parameter; simplify to deal with TYPE_P nodes instead of raw declspecs. (gen_type_name, gen_type_name_0): New functions. (gen_method_decl): Remove second parameter; call gen_type_name() instead of gen_declaration_1(). (dump_interface): Adjust calls to gen_declaration() and gen_method_decl(); do not allocate a separate string buffer. (init_objc): Allocate a larger string buffer to accommodate dump_interface(); adjust call to build_module_descriptor(); add call to build_module_initializer_routine() for the GNU runtime. (generate_classref_translation_entry): Do not call start_decl(); call finish_var_decl() instead of finish_decl(); call convert() instead of build_c_cast(). * objc-act.h (CLASS_OWN_IVARS): Remove accessor. (CLASS_BINFO_ELTS): Reduce from 6 to 5, now that CLASS_OWN_IVARS is gone. (OCTI_GNU_INIT_DECL, GNU_INIT_decl): New. (OCTI_ELLIPSIS_NODE, objc_ellipsis_node): Remove. (OCTI_ID_ID, id_type, objc_id_id): Rename to OCTI_ID_NAME, objc_object_type and objc_object_name, respectively. (OCTI_CLS_REF, OCTI_CLASS_NAME, objc_class_reference, objc_class_name): New. (IS_CLASS): New macro. (IS_ID, IS_SUPER): Robustify. (OCTI_EXECCLASS_DECL, execclass_decl): New. (finish_file, start_class, continue_class, finish_class, start_method_def, continue_method_def, finish_method_def, start_protocol, finish_protocol, objc_build_throw_stmt, objc_build_try_catch_finally_stmt, objc_build_synchronized_prologue, objc_build_synchronized_epilogue, objc_build_try_prologue, objc_build_try_epilogue, objc_build_catch_stmt, objc_build_catch_epilogue, objc_build_finally_prologue, objc_build_finally_epilogue, is_ivar, is_private, is_public, add_instance_variable, objc_add_method, get_super_receiver, objc_clear_super_receiver, get_class_ivars_from_name, get_class_reference, get_static_reference, get_object_reference, build_message_expr, finish_message_expr, build_selector_expr, build_ivar_reference, build_keyword_decl, build_method_decl, build_protocol_expr, build_objc_string_object, objc_declare_alias, objc_declare_class, objc_declare_protocols, objc_comptypes, objc_check_decl, build_encode_expr): Remove prototypes. (imp_count, cat_count): Make GGC-aware. (OBJC_SET_TYPE_NAME): New macro. From-SVN: r87168
2004-09-08 02:49:44 +02:00
#ifndef OBJCPLUS
/* For Objective-C++, we will need to call __objc_gnu_init
from objc_generate_static_init_call() below. */
DECL_STATIC_CONSTRUCTOR (current_function_decl) = 1;
#endif
1992-01-18 00:15:38 +01:00
Makefile.in (c-parse.o): Depend on $(C_COMMON_H). [gcc/ChangeLog] 2004-09-07 Ziemowit Laski <zlaski@apple.com> * Makefile.in (c-parse.o): Depend on $(C_COMMON_H). * c-parse.in: Include c-common.h instead of objc-act.h. (ivar_decl_list, ivar_decls, ivar_decl, ivars, ivar_declarator, myparms, myparm): Remove %type declarations. (methodtype, optparms, OBJC_TYPE_QUAL, objc_quals, objc_qual, objc_typename, objc_try_catch_stmt, optellipsis): Add %type declarations. (objc_inherit_code, objc_public_flag): Remove. (typespec_nonreserved_nonattr): Call objc_get_protocol_qualified_type() instead of get_static_reference() and get_protocol_reference(). (stmt_nocomp): Call grokparm() on @catch parameter. (objcdef): Move semantic action to objc_finish_implementation(). (classdef): Move semantic action to objc_start_class_interface(), objc_continue_interface(), objc_finish_interface(), objc_start_class_implementation(), objc_continue_implementation(), objc_start_category_interface() and objc_start_category_implementation(). (protocoldef): Move semantic actions to objc_start_protocol() and objc_finish_interface(). (ivar_decl_list): Remove nonterminal. (visibility_spec): Move semantic actions to objc_set_visibility(). (ivar_decls): Remove assignment to $$. (ivar_decl): Rephrase in terms of component_decl; call objc_add_instance_variable(). (ivars, ivar_declarator): Remove nonterminals. (opt_semi): New nonterminal. (methodtype): Remove semantic actions. (methoddef): Move semantic actions to objc_set_method_type(), objc_start_method_definition() and objc_finish_method_definition(). (methodproto): Move semantic actions to objc_set_method_type() and objc_add_method_declaration(). (methoddecl): Use objc_typename instead of typename; move semantic actions to objc_build_method_signature(). (optarglist, myxdecls, mydecl, myparms, myparm): Remove nonterminals. (optparmlist): Express in terms of optparms and optellipsis. (optparms, optellipsis, objc_qual, objc_quals, objc_typename): New nonterminals. (keyworddecl): Use objc_typename instead of typename. (rid_to_yy): Mark RID_IN, RID_OUT, RID_INOUT, RID_BYCOPY, RID_BYREF and RID_ONEWAY as returning OBJC_TYPE_QUAL to yyparse(). [gcc/objc/ChangeLog] 2004-09-07 Ziemowit Laski <zlaski@apple.com> * Make-lang.in (objc/objc-parse.o): Depend on $(C_COMMON_H) instead of objc/objc-act.h. (objc/objc-act.o): Depend on $(HASHTAB_H). * objc-act.c: Include hashtab.h; in ObjC++ mode, include cp-tree.h and objcp-decl.h instead of c-tree.h. (build_module_descriptor, get_class_ivars, synth_id_with_class_suffix, error_with_ivar, gen_method_decl, gen_declaration, setup_string_decl, build_protocol_template): Adjust prototypes. (build_module_initializer_routine, start_class, continue_class, finish_class, start_method_def, objc_start_function, start_protocol, build_method_decl, objc_add_method, add_instance_variable, build_ivar_reference, is_ivar, is_private, get_super_receiver, build_selector_table_decl, objc_push_parm, objc_get_parm_info, gen_type_name, gen_type_name_0, start_var_decl, finish_var_decl, create_field_decl): New prototypes. (objc_expand_function_end, comp_method_with_proto, objc_expr_last, gen_declaration_1, gen_declarator, is_complex_decl, adorn_decl, define_decl, create_builtin_decl, gen_declspecs): Remove prototypes. (TYPE_ID): Rename to OBJECT_TYPEDEF_NAME. (CLASS_TYPEDEF_NAME): New. (TAG_EXECCLASS): Change from a global variable to a #define. (TAG_RETURN_STRUCT): Delete. (TAG_GNUINIT): New, holds '__objc_gnu_init' name. (objc_inherit_code, objc_public_flag): New, moved from c-parse.in. (string_descriptor): New struct. (string_htab): New hash table. (string_hash, string_eq): New prototypes. (generate_struct_by_value_array): Call create_field_decl() instead of create_builtin_decl(). (objc_init): Do not initialize objc_ellipsis_node or TAG_EXECCLASS; In ObjC++ mode, call cxx_init() instead of c_objc_common_init(). (objc_finish_file): In ObjC++, call instantiate_pending_templates() and cp_finish_file(). (define_decl, get_static_reference, get_protocol_reference, create_builtin_decl): Remove functions. (objc_start_class_interface, objc_start_category_interface, objc_start_protocol, objc_continue_interface, objc_finish_interface, objc_start_class_implementation, objc_start_category_implementation, objc_continue_implementation, objc_finish_implementation, objc_set_visibility, objc_set_method_type, objc_build_method_signature, objc_add_method_declaration, objc_start_method_definition, objc_add_instance_variable, objc_get_protocol_qualified_type, create_field_decl, start_var_decl, finish_var_decl): New functions. (setup_string_decl): Simplify since it is only called once. (synth_module_prologue): Call build_class_template(); predefine 'id' and 'Class' as typedefs; rename 'temp_type' to 'type'; disable debug hooks for duration of function; fix GNU runtime messenger signatures to correspond to reality; forward-declare '__objc_exec_class' for the GNU runtime; call build_selector_table_decl(); in ObjC++ mode, generate 'extern "C" { ... }' wrappers around synthesized declarations; call build_protocol_template() and build_category_template(). (string_hash, string_eq): New functions. (objc_build_string_object): Check metaclass correctness only once; store string literals in hash table. (objc_build_constructor): Do not convert initializer elements; adjust for ObjC++ impedance mismatch. (build_objc_symtab_template): Call create_field_decl() instead of create_builtin_decl(). (init_objc_symtab): Add missing conversion to initializer element. (build_metadata_decl): Call start_var_decl() instead of define_decl(). (generate_objc_symtab_decl): Do not call build_category_template(); call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(). (build_module_descriptor): Call create_field_decl() instead of grokfield(); call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(); always mark module descriptor as used; move GNU runtime-specific functionality to build_module_initializer_routine(). (build_module_initializer_routine): New function, broken off of build_module_descriptor(). (objc_static_init_needed_p, objc_generate_static_init_call): New functions. (generate_static_references, generate_strings, build_selector_translation_table, generate_descriptor_table, generate_ivars_list, generate_dispatch_table, generate_category): Call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(); build a type directly instead of via groktypename(). (build_selector_reference_decl, build_selector_table_decl, build_class_reference_decl, build_protocol_reference, generate_objc_image_info): Call start_var_decl() instead of build_decl(). (build_selector_reference): For GNU runtime, do not call build_selector_reference_decl(). (build_selector, build_typed_selector_reference): Always convert result to the selector type. (add_objc_string): Cast return value to 'char *'. (build_method_prototype_template, build_selector_template, build_method_template): Use actual selector type for fields pointing to selectors. (finish_objc): For GNU runtime, call build_module_initializer_routine() after build_module_descriptor(). (generate_protocol_list, generate_shared_structures): Call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(); build a type directly instead of via groktypename(). (synth_id_with_class_suffix): Return a string. (get_arg_type_list): For instance methods, use the instance type for 'self'; do not call groktypename_in_parm_context(). (build_objc_string_decl): Squash redeclaration errors in ObjC++. (objc_is_class_name): Use OBJC_TYPE_NAME instead of TYPE_NAME; handle RECORD_TYPEs in ObjC as well as ObjC++. (objc_is_id): New function. (objc_is_object_ptr): Return the canonical type node. (objc_get_class_ivars): Simplify using get_class_ivars(). (get_class_ivars): Remove second parameter; create a fresh copy of the ivar list for each call; do not check for existence of super class. (objc_eh_runtime_type): Mark #ifndef OBJCPLUS. (objc_init_exceptions): When using SJLJ-style exceptions, require the use of '-fobjc-exceptions' flag; do not require it for DWARF-style exceptions. (objc_build_exc_ptr, next_sjlj_build_try_catch_finally): Use objc_object_type instead of objc_id_type. (objc_begin_catch_clause): Convert the incoming PARM_DECL into a VAR_DECL before placing it in the appropriate scope; do not call define_decl(); adjust call to c_begin_compound_stmt(); use objc_object_type instead of objc_id_type. (build_next_objc_exception_stuff): Call create_field_decl() instead of create_builtin_decl(); construct type directly instead of calling groktypename(); use OBJC_VOID_AT_END to mark end of function parameters. (build_private_template): Adjust call to get_class_ivars(); build a type directly instead of via groktypename(). (build_protocol_template, build_method_prototype_list_template, build_method_prototype_template, build_category_template, build_selector_template, build_class_template, build_super_template, build_ivar_template, build_ivar_list_template, build_method_list_template, build_method_template): Call create_field_decl() instead of grokfield(). (objc_method_parm_type): Do not call groktypename(). (generate_descriptor_table): Call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(). (generate_method_descriptors, build_protocol_initializer, generate_dispatch_tables, build_category_initializer, build_shared_structure_initializer): Do not call groktypename(). (generate_protocols): Call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(); do not call groktypename(). (error_with_ivar): Remove last parameter. (check_ivars): Do not iterate ovar CLASS_RAW_IVARS lists in addition to CLASS_IVARS lists; adjust calls to error_with_ivar(). (generate_ivar_lists): Convert one of the initializer elements; do not call groktypename(). (get_arg_type_list, start_method_def, gen_method_def): Account for new representation of variable arguments and '...' in Objective-C methods; add Objective-C++ impedance matching code. (is_objc_type_qualifier): Remove function. (adjust_type_for_id_default): Simplify; there is no longer a need to wade through declspecs. (lookup_interface, start_class, continue_class, finish_class, start_method_def, start_protocol, build_method_decl, objc_add_method, add_instance_variable, build_ivar_reference, is_ivar, is_private, get_super_receiver, objc_build_finally_epilogue): Make into static functions. (receiver_is_class_object): Use new IS_CLASS() macro. (objc_build_message_expr): Tweak ObjC++ message argument handling; call objc_finish_message_expr() instead of finish_message_expr(). (finish_message_expr): Rename to objc_finish_message_expr(); use OBJC_TYPE_NAME and OBJC_SET_TYPE_NAME macros instead of TYPE_NAME. call gen_type_name() instead of gen_declaration(); call objc_is_id() instead of using IS_ID and IS_CLASS; Use objc_class_name instead of calling get_identifier("Class"); handle CONVERT_EXPRs in receiver. (build_objc_method_call, warn_with_method): Do not call groktypename(). (build_ivar_reference): Call convert() instead of clobbering in a type. (hash_init): Initialize string_htab hash table. (add_instance_variable): Simplify parameter list; do not call grokfield(); do not populate CLASS_IVARS list. (start_class): Check for the existence of super class, if one was specified. (continue_class): Use CLASS_RAW_IVARS rather than CLASS_IVARS; do not call build_class_template(); adjust call to get_class_ivars(); call build_decl(), pushdecl() and finish_decl() instead of define_decl(). (finish_class): Call build_decl(), pushdecl() and finish_decl() instead of define_decl(). (add_protocols): Use PROTOCOL_BINFO_ELTS for the tree vector size. (start_protocol): Do not call build_protocol_template(); use PROTOCOL_BINFO_ELTS for the tree vector size. (encode_type_qualifiers): Do not handle the 'const' qualifier here. (encode_pointer): Encode 'const char *' as 'r*', for backwards compatibility. (encode_array): Use HOST_WIDE_INT_PRINT_DEC instead of "%ld". (encode_type): Handle the 'const' qualifier here. (objc_parmlist): New global variable, sued by objc_push_parm and objc_get_parm_info(). (objc_push_parm, objc_get_parm_info): New functions. (objc_expr_last): Remove function. (synth_self_and_ucmd_args): For instance methods, use the instance type for 'self'; call objc_push_parm() instead of push_parm_decl(). (start_method_def): Do not call push_scope(), declare_parm_level(), pop_scope(), push_parm_decl(), store_parm_decls() or objc_expr_last(); just use objc_push_parm() and objc_get_parm_info(). (comp_method_with_proto): Remove function. (objc_types_are_equivalent): Strip away indirections before comparing underlying types. (comp_proto_with_proto): Do not call groktypename(); types are no longer in raw declspec format. (objc_start_function): New function. (really_start_method): Call comp_proto_with_proto() instead of comp_method_with_proto(); call objc_start_function() instead of hand-crafting a function declarator. (continue_method_def, objc_expand_function_end): Remove functions. (get_super_receiver): Call objc_get_current_scope() instead of get_current_scope(); reference 'super_class' field (instead of 'class'). (finish_method_def): Rename to objc_finish_method_definition() and add a function decl parameter; move method encoding call from objc_expand_function_end(). (is_complex_decl, adorn_decl, gen_declarator, gen_declspecs, gen_declaration_1): Remove functions. (tmpbuf, RAW_DECLSPEC): Remove. (gen_declaration): Remove second parameter; simplify to deal with TYPE_P nodes instead of raw declspecs. (gen_type_name, gen_type_name_0): New functions. (gen_method_decl): Remove second parameter; call gen_type_name() instead of gen_declaration_1(). (dump_interface): Adjust calls to gen_declaration() and gen_method_decl(); do not allocate a separate string buffer. (init_objc): Allocate a larger string buffer to accommodate dump_interface(); adjust call to build_module_descriptor(); add call to build_module_initializer_routine() for the GNU runtime. (generate_classref_translation_entry): Do not call start_decl(); call finish_var_decl() instead of finish_decl(); call convert() instead of build_c_cast(). * objc-act.h (CLASS_OWN_IVARS): Remove accessor. (CLASS_BINFO_ELTS): Reduce from 6 to 5, now that CLASS_OWN_IVARS is gone. (OCTI_GNU_INIT_DECL, GNU_INIT_decl): New. (OCTI_ELLIPSIS_NODE, objc_ellipsis_node): Remove. (OCTI_ID_ID, id_type, objc_id_id): Rename to OCTI_ID_NAME, objc_object_type and objc_object_name, respectively. (OCTI_CLS_REF, OCTI_CLASS_NAME, objc_class_reference, objc_class_name): New. (IS_CLASS): New macro. (IS_ID, IS_SUPER): Robustify. (OCTI_EXECCLASS_DECL, execclass_decl): New. (finish_file, start_class, continue_class, finish_class, start_method_def, continue_method_def, finish_method_def, start_protocol, finish_protocol, objc_build_throw_stmt, objc_build_try_catch_finally_stmt, objc_build_synchronized_prologue, objc_build_synchronized_epilogue, objc_build_try_prologue, objc_build_try_epilogue, objc_build_catch_stmt, objc_build_catch_epilogue, objc_build_finally_prologue, objc_build_finally_epilogue, is_ivar, is_private, is_public, add_instance_variable, objc_add_method, get_super_receiver, objc_clear_super_receiver, get_class_ivars_from_name, get_class_reference, get_static_reference, get_object_reference, build_message_expr, finish_message_expr, build_selector_expr, build_ivar_reference, build_keyword_decl, build_method_decl, build_protocol_expr, build_objc_string_object, objc_declare_alias, objc_declare_class, objc_declare_protocols, objc_comptypes, objc_check_decl, build_encode_expr): Remove prototypes. (imp_count, cat_count): Make GGC-aware. (OBJC_SET_TYPE_NAME): New macro. From-SVN: r87168
2004-09-08 02:49:44 +02:00
GNU_INIT_decl = current_function_decl;
finish_function ();
1992-01-18 00:15:38 +01:00
Makefile.in (c-parse.o): Depend on $(C_COMMON_H). [gcc/ChangeLog] 2004-09-07 Ziemowit Laski <zlaski@apple.com> * Makefile.in (c-parse.o): Depend on $(C_COMMON_H). * c-parse.in: Include c-common.h instead of objc-act.h. (ivar_decl_list, ivar_decls, ivar_decl, ivars, ivar_declarator, myparms, myparm): Remove %type declarations. (methodtype, optparms, OBJC_TYPE_QUAL, objc_quals, objc_qual, objc_typename, objc_try_catch_stmt, optellipsis): Add %type declarations. (objc_inherit_code, objc_public_flag): Remove. (typespec_nonreserved_nonattr): Call objc_get_protocol_qualified_type() instead of get_static_reference() and get_protocol_reference(). (stmt_nocomp): Call grokparm() on @catch parameter. (objcdef): Move semantic action to objc_finish_implementation(). (classdef): Move semantic action to objc_start_class_interface(), objc_continue_interface(), objc_finish_interface(), objc_start_class_implementation(), objc_continue_implementation(), objc_start_category_interface() and objc_start_category_implementation(). (protocoldef): Move semantic actions to objc_start_protocol() and objc_finish_interface(). (ivar_decl_list): Remove nonterminal. (visibility_spec): Move semantic actions to objc_set_visibility(). (ivar_decls): Remove assignment to $$. (ivar_decl): Rephrase in terms of component_decl; call objc_add_instance_variable(). (ivars, ivar_declarator): Remove nonterminals. (opt_semi): New nonterminal. (methodtype): Remove semantic actions. (methoddef): Move semantic actions to objc_set_method_type(), objc_start_method_definition() and objc_finish_method_definition(). (methodproto): Move semantic actions to objc_set_method_type() and objc_add_method_declaration(). (methoddecl): Use objc_typename instead of typename; move semantic actions to objc_build_method_signature(). (optarglist, myxdecls, mydecl, myparms, myparm): Remove nonterminals. (optparmlist): Express in terms of optparms and optellipsis. (optparms, optellipsis, objc_qual, objc_quals, objc_typename): New nonterminals. (keyworddecl): Use objc_typename instead of typename. (rid_to_yy): Mark RID_IN, RID_OUT, RID_INOUT, RID_BYCOPY, RID_BYREF and RID_ONEWAY as returning OBJC_TYPE_QUAL to yyparse(). [gcc/objc/ChangeLog] 2004-09-07 Ziemowit Laski <zlaski@apple.com> * Make-lang.in (objc/objc-parse.o): Depend on $(C_COMMON_H) instead of objc/objc-act.h. (objc/objc-act.o): Depend on $(HASHTAB_H). * objc-act.c: Include hashtab.h; in ObjC++ mode, include cp-tree.h and objcp-decl.h instead of c-tree.h. (build_module_descriptor, get_class_ivars, synth_id_with_class_suffix, error_with_ivar, gen_method_decl, gen_declaration, setup_string_decl, build_protocol_template): Adjust prototypes. (build_module_initializer_routine, start_class, continue_class, finish_class, start_method_def, objc_start_function, start_protocol, build_method_decl, objc_add_method, add_instance_variable, build_ivar_reference, is_ivar, is_private, get_super_receiver, build_selector_table_decl, objc_push_parm, objc_get_parm_info, gen_type_name, gen_type_name_0, start_var_decl, finish_var_decl, create_field_decl): New prototypes. (objc_expand_function_end, comp_method_with_proto, objc_expr_last, gen_declaration_1, gen_declarator, is_complex_decl, adorn_decl, define_decl, create_builtin_decl, gen_declspecs): Remove prototypes. (TYPE_ID): Rename to OBJECT_TYPEDEF_NAME. (CLASS_TYPEDEF_NAME): New. (TAG_EXECCLASS): Change from a global variable to a #define. (TAG_RETURN_STRUCT): Delete. (TAG_GNUINIT): New, holds '__objc_gnu_init' name. (objc_inherit_code, objc_public_flag): New, moved from c-parse.in. (string_descriptor): New struct. (string_htab): New hash table. (string_hash, string_eq): New prototypes. (generate_struct_by_value_array): Call create_field_decl() instead of create_builtin_decl(). (objc_init): Do not initialize objc_ellipsis_node or TAG_EXECCLASS; In ObjC++ mode, call cxx_init() instead of c_objc_common_init(). (objc_finish_file): In ObjC++, call instantiate_pending_templates() and cp_finish_file(). (define_decl, get_static_reference, get_protocol_reference, create_builtin_decl): Remove functions. (objc_start_class_interface, objc_start_category_interface, objc_start_protocol, objc_continue_interface, objc_finish_interface, objc_start_class_implementation, objc_start_category_implementation, objc_continue_implementation, objc_finish_implementation, objc_set_visibility, objc_set_method_type, objc_build_method_signature, objc_add_method_declaration, objc_start_method_definition, objc_add_instance_variable, objc_get_protocol_qualified_type, create_field_decl, start_var_decl, finish_var_decl): New functions. (setup_string_decl): Simplify since it is only called once. (synth_module_prologue): Call build_class_template(); predefine 'id' and 'Class' as typedefs; rename 'temp_type' to 'type'; disable debug hooks for duration of function; fix GNU runtime messenger signatures to correspond to reality; forward-declare '__objc_exec_class' for the GNU runtime; call build_selector_table_decl(); in ObjC++ mode, generate 'extern "C" { ... }' wrappers around synthesized declarations; call build_protocol_template() and build_category_template(). (string_hash, string_eq): New functions. (objc_build_string_object): Check metaclass correctness only once; store string literals in hash table. (objc_build_constructor): Do not convert initializer elements; adjust for ObjC++ impedance mismatch. (build_objc_symtab_template): Call create_field_decl() instead of create_builtin_decl(). (init_objc_symtab): Add missing conversion to initializer element. (build_metadata_decl): Call start_var_decl() instead of define_decl(). (generate_objc_symtab_decl): Do not call build_category_template(); call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(). (build_module_descriptor): Call create_field_decl() instead of grokfield(); call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(); always mark module descriptor as used; move GNU runtime-specific functionality to build_module_initializer_routine(). (build_module_initializer_routine): New function, broken off of build_module_descriptor(). (objc_static_init_needed_p, objc_generate_static_init_call): New functions. (generate_static_references, generate_strings, build_selector_translation_table, generate_descriptor_table, generate_ivars_list, generate_dispatch_table, generate_category): Call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(); build a type directly instead of via groktypename(). (build_selector_reference_decl, build_selector_table_decl, build_class_reference_decl, build_protocol_reference, generate_objc_image_info): Call start_var_decl() instead of build_decl(). (build_selector_reference): For GNU runtime, do not call build_selector_reference_decl(). (build_selector, build_typed_selector_reference): Always convert result to the selector type. (add_objc_string): Cast return value to 'char *'. (build_method_prototype_template, build_selector_template, build_method_template): Use actual selector type for fields pointing to selectors. (finish_objc): For GNU runtime, call build_module_initializer_routine() after build_module_descriptor(). (generate_protocol_list, generate_shared_structures): Call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(); build a type directly instead of via groktypename(). (synth_id_with_class_suffix): Return a string. (get_arg_type_list): For instance methods, use the instance type for 'self'; do not call groktypename_in_parm_context(). (build_objc_string_decl): Squash redeclaration errors in ObjC++. (objc_is_class_name): Use OBJC_TYPE_NAME instead of TYPE_NAME; handle RECORD_TYPEs in ObjC as well as ObjC++. (objc_is_id): New function. (objc_is_object_ptr): Return the canonical type node. (objc_get_class_ivars): Simplify using get_class_ivars(). (get_class_ivars): Remove second parameter; create a fresh copy of the ivar list for each call; do not check for existence of super class. (objc_eh_runtime_type): Mark #ifndef OBJCPLUS. (objc_init_exceptions): When using SJLJ-style exceptions, require the use of '-fobjc-exceptions' flag; do not require it for DWARF-style exceptions. (objc_build_exc_ptr, next_sjlj_build_try_catch_finally): Use objc_object_type instead of objc_id_type. (objc_begin_catch_clause): Convert the incoming PARM_DECL into a VAR_DECL before placing it in the appropriate scope; do not call define_decl(); adjust call to c_begin_compound_stmt(); use objc_object_type instead of objc_id_type. (build_next_objc_exception_stuff): Call create_field_decl() instead of create_builtin_decl(); construct type directly instead of calling groktypename(); use OBJC_VOID_AT_END to mark end of function parameters. (build_private_template): Adjust call to get_class_ivars(); build a type directly instead of via groktypename(). (build_protocol_template, build_method_prototype_list_template, build_method_prototype_template, build_category_template, build_selector_template, build_class_template, build_super_template, build_ivar_template, build_ivar_list_template, build_method_list_template, build_method_template): Call create_field_decl() instead of grokfield(). (objc_method_parm_type): Do not call groktypename(). (generate_descriptor_table): Call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(). (generate_method_descriptors, build_protocol_initializer, generate_dispatch_tables, build_category_initializer, build_shared_structure_initializer): Do not call groktypename(). (generate_protocols): Call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(); do not call groktypename(). (error_with_ivar): Remove last parameter. (check_ivars): Do not iterate ovar CLASS_RAW_IVARS lists in addition to CLASS_IVARS lists; adjust calls to error_with_ivar(). (generate_ivar_lists): Convert one of the initializer elements; do not call groktypename(). (get_arg_type_list, start_method_def, gen_method_def): Account for new representation of variable arguments and '...' in Objective-C methods; add Objective-C++ impedance matching code. (is_objc_type_qualifier): Remove function. (adjust_type_for_id_default): Simplify; there is no longer a need to wade through declspecs. (lookup_interface, start_class, continue_class, finish_class, start_method_def, start_protocol, build_method_decl, objc_add_method, add_instance_variable, build_ivar_reference, is_ivar, is_private, get_super_receiver, objc_build_finally_epilogue): Make into static functions. (receiver_is_class_object): Use new IS_CLASS() macro. (objc_build_message_expr): Tweak ObjC++ message argument handling; call objc_finish_message_expr() instead of finish_message_expr(). (finish_message_expr): Rename to objc_finish_message_expr(); use OBJC_TYPE_NAME and OBJC_SET_TYPE_NAME macros instead of TYPE_NAME. call gen_type_name() instead of gen_declaration(); call objc_is_id() instead of using IS_ID and IS_CLASS; Use objc_class_name instead of calling get_identifier("Class"); handle CONVERT_EXPRs in receiver. (build_objc_method_call, warn_with_method): Do not call groktypename(). (build_ivar_reference): Call convert() instead of clobbering in a type. (hash_init): Initialize string_htab hash table. (add_instance_variable): Simplify parameter list; do not call grokfield(); do not populate CLASS_IVARS list. (start_class): Check for the existence of super class, if one was specified. (continue_class): Use CLASS_RAW_IVARS rather than CLASS_IVARS; do not call build_class_template(); adjust call to get_class_ivars(); call build_decl(), pushdecl() and finish_decl() instead of define_decl(). (finish_class): Call build_decl(), pushdecl() and finish_decl() instead of define_decl(). (add_protocols): Use PROTOCOL_BINFO_ELTS for the tree vector size. (start_protocol): Do not call build_protocol_template(); use PROTOCOL_BINFO_ELTS for the tree vector size. (encode_type_qualifiers): Do not handle the 'const' qualifier here. (encode_pointer): Encode 'const char *' as 'r*', for backwards compatibility. (encode_array): Use HOST_WIDE_INT_PRINT_DEC instead of "%ld". (encode_type): Handle the 'const' qualifier here. (objc_parmlist): New global variable, sued by objc_push_parm and objc_get_parm_info(). (objc_push_parm, objc_get_parm_info): New functions. (objc_expr_last): Remove function. (synth_self_and_ucmd_args): For instance methods, use the instance type for 'self'; call objc_push_parm() instead of push_parm_decl(). (start_method_def): Do not call push_scope(), declare_parm_level(), pop_scope(), push_parm_decl(), store_parm_decls() or objc_expr_last(); just use objc_push_parm() and objc_get_parm_info(). (comp_method_with_proto): Remove function. (objc_types_are_equivalent): Strip away indirections before comparing underlying types. (comp_proto_with_proto): Do not call groktypename(); types are no longer in raw declspec format. (objc_start_function): New function. (really_start_method): Call comp_proto_with_proto() instead of comp_method_with_proto(); call objc_start_function() instead of hand-crafting a function declarator. (continue_method_def, objc_expand_function_end): Remove functions. (get_super_receiver): Call objc_get_current_scope() instead of get_current_scope(); reference 'super_class' field (instead of 'class'). (finish_method_def): Rename to objc_finish_method_definition() and add a function decl parameter; move method encoding call from objc_expand_function_end(). (is_complex_decl, adorn_decl, gen_declarator, gen_declspecs, gen_declaration_1): Remove functions. (tmpbuf, RAW_DECLSPEC): Remove. (gen_declaration): Remove second parameter; simplify to deal with TYPE_P nodes instead of raw declspecs. (gen_type_name, gen_type_name_0): New functions. (gen_method_decl): Remove second parameter; call gen_type_name() instead of gen_declaration_1(). (dump_interface): Adjust calls to gen_declaration() and gen_method_decl(); do not allocate a separate string buffer. (init_objc): Allocate a larger string buffer to accommodate dump_interface(); adjust call to build_module_descriptor(); add call to build_module_initializer_routine() for the GNU runtime. (generate_classref_translation_entry): Do not call start_decl(); call finish_var_decl() instead of finish_decl(); call convert() instead of build_c_cast(). * objc-act.h (CLASS_OWN_IVARS): Remove accessor. (CLASS_BINFO_ELTS): Reduce from 6 to 5, now that CLASS_OWN_IVARS is gone. (OCTI_GNU_INIT_DECL, GNU_INIT_decl): New. (OCTI_ELLIPSIS_NODE, objc_ellipsis_node): Remove. (OCTI_ID_ID, id_type, objc_id_id): Rename to OCTI_ID_NAME, objc_object_type and objc_object_name, respectively. (OCTI_CLS_REF, OCTI_CLASS_NAME, objc_class_reference, objc_class_name): New. (IS_CLASS): New macro. (IS_ID, IS_SUPER): Robustify. (OCTI_EXECCLASS_DECL, execclass_decl): New. (finish_file, start_class, continue_class, finish_class, start_method_def, continue_method_def, finish_method_def, start_protocol, finish_protocol, objc_build_throw_stmt, objc_build_try_catch_finally_stmt, objc_build_synchronized_prologue, objc_build_synchronized_epilogue, objc_build_try_prologue, objc_build_try_epilogue, objc_build_catch_stmt, objc_build_catch_epilogue, objc_build_finally_prologue, objc_build_finally_epilogue, is_ivar, is_private, is_public, add_instance_variable, objc_add_method, get_super_receiver, objc_clear_super_receiver, get_class_ivars_from_name, get_class_reference, get_static_reference, get_object_reference, build_message_expr, finish_message_expr, build_selector_expr, build_ivar_reference, build_keyword_decl, build_method_decl, build_protocol_expr, build_objc_string_object, objc_declare_alias, objc_declare_class, objc_declare_protocols, objc_comptypes, objc_check_decl, build_encode_expr): Remove prototypes. (imp_count, cat_count): Make GGC-aware. (OBJC_SET_TYPE_NAME): New macro. From-SVN: r87168
2004-09-08 02:49:44 +02:00
#ifdef OBJCPLUS
pop_lang_context ();
#endif
}
Makefile.in (c-parse.o): Depend on $(C_COMMON_H). [gcc/ChangeLog] 2004-09-07 Ziemowit Laski <zlaski@apple.com> * Makefile.in (c-parse.o): Depend on $(C_COMMON_H). * c-parse.in: Include c-common.h instead of objc-act.h. (ivar_decl_list, ivar_decls, ivar_decl, ivars, ivar_declarator, myparms, myparm): Remove %type declarations. (methodtype, optparms, OBJC_TYPE_QUAL, objc_quals, objc_qual, objc_typename, objc_try_catch_stmt, optellipsis): Add %type declarations. (objc_inherit_code, objc_public_flag): Remove. (typespec_nonreserved_nonattr): Call objc_get_protocol_qualified_type() instead of get_static_reference() and get_protocol_reference(). (stmt_nocomp): Call grokparm() on @catch parameter. (objcdef): Move semantic action to objc_finish_implementation(). (classdef): Move semantic action to objc_start_class_interface(), objc_continue_interface(), objc_finish_interface(), objc_start_class_implementation(), objc_continue_implementation(), objc_start_category_interface() and objc_start_category_implementation(). (protocoldef): Move semantic actions to objc_start_protocol() and objc_finish_interface(). (ivar_decl_list): Remove nonterminal. (visibility_spec): Move semantic actions to objc_set_visibility(). (ivar_decls): Remove assignment to $$. (ivar_decl): Rephrase in terms of component_decl; call objc_add_instance_variable(). (ivars, ivar_declarator): Remove nonterminals. (opt_semi): New nonterminal. (methodtype): Remove semantic actions. (methoddef): Move semantic actions to objc_set_method_type(), objc_start_method_definition() and objc_finish_method_definition(). (methodproto): Move semantic actions to objc_set_method_type() and objc_add_method_declaration(). (methoddecl): Use objc_typename instead of typename; move semantic actions to objc_build_method_signature(). (optarglist, myxdecls, mydecl, myparms, myparm): Remove nonterminals. (optparmlist): Express in terms of optparms and optellipsis. (optparms, optellipsis, objc_qual, objc_quals, objc_typename): New nonterminals. (keyworddecl): Use objc_typename instead of typename. (rid_to_yy): Mark RID_IN, RID_OUT, RID_INOUT, RID_BYCOPY, RID_BYREF and RID_ONEWAY as returning OBJC_TYPE_QUAL to yyparse(). [gcc/objc/ChangeLog] 2004-09-07 Ziemowit Laski <zlaski@apple.com> * Make-lang.in (objc/objc-parse.o): Depend on $(C_COMMON_H) instead of objc/objc-act.h. (objc/objc-act.o): Depend on $(HASHTAB_H). * objc-act.c: Include hashtab.h; in ObjC++ mode, include cp-tree.h and objcp-decl.h instead of c-tree.h. (build_module_descriptor, get_class_ivars, synth_id_with_class_suffix, error_with_ivar, gen_method_decl, gen_declaration, setup_string_decl, build_protocol_template): Adjust prototypes. (build_module_initializer_routine, start_class, continue_class, finish_class, start_method_def, objc_start_function, start_protocol, build_method_decl, objc_add_method, add_instance_variable, build_ivar_reference, is_ivar, is_private, get_super_receiver, build_selector_table_decl, objc_push_parm, objc_get_parm_info, gen_type_name, gen_type_name_0, start_var_decl, finish_var_decl, create_field_decl): New prototypes. (objc_expand_function_end, comp_method_with_proto, objc_expr_last, gen_declaration_1, gen_declarator, is_complex_decl, adorn_decl, define_decl, create_builtin_decl, gen_declspecs): Remove prototypes. (TYPE_ID): Rename to OBJECT_TYPEDEF_NAME. (CLASS_TYPEDEF_NAME): New. (TAG_EXECCLASS): Change from a global variable to a #define. (TAG_RETURN_STRUCT): Delete. (TAG_GNUINIT): New, holds '__objc_gnu_init' name. (objc_inherit_code, objc_public_flag): New, moved from c-parse.in. (string_descriptor): New struct. (string_htab): New hash table. (string_hash, string_eq): New prototypes. (generate_struct_by_value_array): Call create_field_decl() instead of create_builtin_decl(). (objc_init): Do not initialize objc_ellipsis_node or TAG_EXECCLASS; In ObjC++ mode, call cxx_init() instead of c_objc_common_init(). (objc_finish_file): In ObjC++, call instantiate_pending_templates() and cp_finish_file(). (define_decl, get_static_reference, get_protocol_reference, create_builtin_decl): Remove functions. (objc_start_class_interface, objc_start_category_interface, objc_start_protocol, objc_continue_interface, objc_finish_interface, objc_start_class_implementation, objc_start_category_implementation, objc_continue_implementation, objc_finish_implementation, objc_set_visibility, objc_set_method_type, objc_build_method_signature, objc_add_method_declaration, objc_start_method_definition, objc_add_instance_variable, objc_get_protocol_qualified_type, create_field_decl, start_var_decl, finish_var_decl): New functions. (setup_string_decl): Simplify since it is only called once. (synth_module_prologue): Call build_class_template(); predefine 'id' and 'Class' as typedefs; rename 'temp_type' to 'type'; disable debug hooks for duration of function; fix GNU runtime messenger signatures to correspond to reality; forward-declare '__objc_exec_class' for the GNU runtime; call build_selector_table_decl(); in ObjC++ mode, generate 'extern "C" { ... }' wrappers around synthesized declarations; call build_protocol_template() and build_category_template(). (string_hash, string_eq): New functions. (objc_build_string_object): Check metaclass correctness only once; store string literals in hash table. (objc_build_constructor): Do not convert initializer elements; adjust for ObjC++ impedance mismatch. (build_objc_symtab_template): Call create_field_decl() instead of create_builtin_decl(). (init_objc_symtab): Add missing conversion to initializer element. (build_metadata_decl): Call start_var_decl() instead of define_decl(). (generate_objc_symtab_decl): Do not call build_category_template(); call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(). (build_module_descriptor): Call create_field_decl() instead of grokfield(); call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(); always mark module descriptor as used; move GNU runtime-specific functionality to build_module_initializer_routine(). (build_module_initializer_routine): New function, broken off of build_module_descriptor(). (objc_static_init_needed_p, objc_generate_static_init_call): New functions. (generate_static_references, generate_strings, build_selector_translation_table, generate_descriptor_table, generate_ivars_list, generate_dispatch_table, generate_category): Call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(); build a type directly instead of via groktypename(). (build_selector_reference_decl, build_selector_table_decl, build_class_reference_decl, build_protocol_reference, generate_objc_image_info): Call start_var_decl() instead of build_decl(). (build_selector_reference): For GNU runtime, do not call build_selector_reference_decl(). (build_selector, build_typed_selector_reference): Always convert result to the selector type. (add_objc_string): Cast return value to 'char *'. (build_method_prototype_template, build_selector_template, build_method_template): Use actual selector type for fields pointing to selectors. (finish_objc): For GNU runtime, call build_module_initializer_routine() after build_module_descriptor(). (generate_protocol_list, generate_shared_structures): Call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(); build a type directly instead of via groktypename(). (synth_id_with_class_suffix): Return a string. (get_arg_type_list): For instance methods, use the instance type for 'self'; do not call groktypename_in_parm_context(). (build_objc_string_decl): Squash redeclaration errors in ObjC++. (objc_is_class_name): Use OBJC_TYPE_NAME instead of TYPE_NAME; handle RECORD_TYPEs in ObjC as well as ObjC++. (objc_is_id): New function. (objc_is_object_ptr): Return the canonical type node. (objc_get_class_ivars): Simplify using get_class_ivars(). (get_class_ivars): Remove second parameter; create a fresh copy of the ivar list for each call; do not check for existence of super class. (objc_eh_runtime_type): Mark #ifndef OBJCPLUS. (objc_init_exceptions): When using SJLJ-style exceptions, require the use of '-fobjc-exceptions' flag; do not require it for DWARF-style exceptions. (objc_build_exc_ptr, next_sjlj_build_try_catch_finally): Use objc_object_type instead of objc_id_type. (objc_begin_catch_clause): Convert the incoming PARM_DECL into a VAR_DECL before placing it in the appropriate scope; do not call define_decl(); adjust call to c_begin_compound_stmt(); use objc_object_type instead of objc_id_type. (build_next_objc_exception_stuff): Call create_field_decl() instead of create_builtin_decl(); construct type directly instead of calling groktypename(); use OBJC_VOID_AT_END to mark end of function parameters. (build_private_template): Adjust call to get_class_ivars(); build a type directly instead of via groktypename(). (build_protocol_template, build_method_prototype_list_template, build_method_prototype_template, build_category_template, build_selector_template, build_class_template, build_super_template, build_ivar_template, build_ivar_list_template, build_method_list_template, build_method_template): Call create_field_decl() instead of grokfield(). (objc_method_parm_type): Do not call groktypename(). (generate_descriptor_table): Call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(). (generate_method_descriptors, build_protocol_initializer, generate_dispatch_tables, build_category_initializer, build_shared_structure_initializer): Do not call groktypename(). (generate_protocols): Call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(); do not call groktypename(). (error_with_ivar): Remove last parameter. (check_ivars): Do not iterate ovar CLASS_RAW_IVARS lists in addition to CLASS_IVARS lists; adjust calls to error_with_ivar(). (generate_ivar_lists): Convert one of the initializer elements; do not call groktypename(). (get_arg_type_list, start_method_def, gen_method_def): Account for new representation of variable arguments and '...' in Objective-C methods; add Objective-C++ impedance matching code. (is_objc_type_qualifier): Remove function. (adjust_type_for_id_default): Simplify; there is no longer a need to wade through declspecs. (lookup_interface, start_class, continue_class, finish_class, start_method_def, start_protocol, build_method_decl, objc_add_method, add_instance_variable, build_ivar_reference, is_ivar, is_private, get_super_receiver, objc_build_finally_epilogue): Make into static functions. (receiver_is_class_object): Use new IS_CLASS() macro. (objc_build_message_expr): Tweak ObjC++ message argument handling; call objc_finish_message_expr() instead of finish_message_expr(). (finish_message_expr): Rename to objc_finish_message_expr(); use OBJC_TYPE_NAME and OBJC_SET_TYPE_NAME macros instead of TYPE_NAME. call gen_type_name() instead of gen_declaration(); call objc_is_id() instead of using IS_ID and IS_CLASS; Use objc_class_name instead of calling get_identifier("Class"); handle CONVERT_EXPRs in receiver. (build_objc_method_call, warn_with_method): Do not call groktypename(). (build_ivar_reference): Call convert() instead of clobbering in a type. (hash_init): Initialize string_htab hash table. (add_instance_variable): Simplify parameter list; do not call grokfield(); do not populate CLASS_IVARS list. (start_class): Check for the existence of super class, if one was specified. (continue_class): Use CLASS_RAW_IVARS rather than CLASS_IVARS; do not call build_class_template(); adjust call to get_class_ivars(); call build_decl(), pushdecl() and finish_decl() instead of define_decl(). (finish_class): Call build_decl(), pushdecl() and finish_decl() instead of define_decl(). (add_protocols): Use PROTOCOL_BINFO_ELTS for the tree vector size. (start_protocol): Do not call build_protocol_template(); use PROTOCOL_BINFO_ELTS for the tree vector size. (encode_type_qualifiers): Do not handle the 'const' qualifier here. (encode_pointer): Encode 'const char *' as 'r*', for backwards compatibility. (encode_array): Use HOST_WIDE_INT_PRINT_DEC instead of "%ld". (encode_type): Handle the 'const' qualifier here. (objc_parmlist): New global variable, sued by objc_push_parm and objc_get_parm_info(). (objc_push_parm, objc_get_parm_info): New functions. (objc_expr_last): Remove function. (synth_self_and_ucmd_args): For instance methods, use the instance type for 'self'; call objc_push_parm() instead of push_parm_decl(). (start_method_def): Do not call push_scope(), declare_parm_level(), pop_scope(), push_parm_decl(), store_parm_decls() or objc_expr_last(); just use objc_push_parm() and objc_get_parm_info(). (comp_method_with_proto): Remove function. (objc_types_are_equivalent): Strip away indirections before comparing underlying types. (comp_proto_with_proto): Do not call groktypename(); types are no longer in raw declspec format. (objc_start_function): New function. (really_start_method): Call comp_proto_with_proto() instead of comp_method_with_proto(); call objc_start_function() instead of hand-crafting a function declarator. (continue_method_def, objc_expand_function_end): Remove functions. (get_super_receiver): Call objc_get_current_scope() instead of get_current_scope(); reference 'super_class' field (instead of 'class'). (finish_method_def): Rename to objc_finish_method_definition() and add a function decl parameter; move method encoding call from objc_expand_function_end(). (is_complex_decl, adorn_decl, gen_declarator, gen_declspecs, gen_declaration_1): Remove functions. (tmpbuf, RAW_DECLSPEC): Remove. (gen_declaration): Remove second parameter; simplify to deal with TYPE_P nodes instead of raw declspecs. (gen_type_name, gen_type_name_0): New functions. (gen_method_decl): Remove second parameter; call gen_type_name() instead of gen_declaration_1(). (dump_interface): Adjust calls to gen_declaration() and gen_method_decl(); do not allocate a separate string buffer. (init_objc): Allocate a larger string buffer to accommodate dump_interface(); adjust call to build_module_descriptor(); add call to build_module_initializer_routine() for the GNU runtime. (generate_classref_translation_entry): Do not call start_decl(); call finish_var_decl() instead of finish_decl(); call convert() instead of build_c_cast(). * objc-act.h (CLASS_OWN_IVARS): Remove accessor. (CLASS_BINFO_ELTS): Reduce from 6 to 5, now that CLASS_OWN_IVARS is gone. (OCTI_GNU_INIT_DECL, GNU_INIT_decl): New. (OCTI_ELLIPSIS_NODE, objc_ellipsis_node): Remove. (OCTI_ID_ID, id_type, objc_id_id): Rename to OCTI_ID_NAME, objc_object_type and objc_object_name, respectively. (OCTI_CLS_REF, OCTI_CLASS_NAME, objc_class_reference, objc_class_name): New. (IS_CLASS): New macro. (IS_ID, IS_SUPER): Robustify. (OCTI_EXECCLASS_DECL, execclass_decl): New. (finish_file, start_class, continue_class, finish_class, start_method_def, continue_method_def, finish_method_def, start_protocol, finish_protocol, objc_build_throw_stmt, objc_build_try_catch_finally_stmt, objc_build_synchronized_prologue, objc_build_synchronized_epilogue, objc_build_try_prologue, objc_build_try_epilogue, objc_build_catch_stmt, objc_build_catch_epilogue, objc_build_finally_prologue, objc_build_finally_epilogue, is_ivar, is_private, is_public, add_instance_variable, objc_add_method, get_super_receiver, objc_clear_super_receiver, get_class_ivars_from_name, get_class_reference, get_static_reference, get_object_reference, build_message_expr, finish_message_expr, build_selector_expr, build_ivar_reference, build_keyword_decl, build_method_decl, build_protocol_expr, build_objc_string_object, objc_declare_alias, objc_declare_class, objc_declare_protocols, objc_comptypes, objc_check_decl, build_encode_expr): Remove prototypes. (imp_count, cat_count): Make GGC-aware. (OBJC_SET_TYPE_NAME): New macro. From-SVN: r87168
2004-09-08 02:49:44 +02:00
#ifdef OBJCPLUS
/* Return 1 if the __objc_gnu_init function has been synthesized and needs
to be called by the module initializer routine. */
int
objc_static_init_needed_p (void)
{
return (GNU_INIT_decl != NULL_TREE);
}
/* Generate a call to the __objc_gnu_init initializer function. */
tree
objc_generate_static_init_call (tree ctors ATTRIBUTE_UNUSED)
{
add_stmt (build_stmt (EXPR_STMT,
build_function_call (GNU_INIT_decl, NULL_TREE)));
return ctors;
1992-01-18 00:15:38 +01:00
}
Makefile.in (c-parse.o): Depend on $(C_COMMON_H). [gcc/ChangeLog] 2004-09-07 Ziemowit Laski <zlaski@apple.com> * Makefile.in (c-parse.o): Depend on $(C_COMMON_H). * c-parse.in: Include c-common.h instead of objc-act.h. (ivar_decl_list, ivar_decls, ivar_decl, ivars, ivar_declarator, myparms, myparm): Remove %type declarations. (methodtype, optparms, OBJC_TYPE_QUAL, objc_quals, objc_qual, objc_typename, objc_try_catch_stmt, optellipsis): Add %type declarations. (objc_inherit_code, objc_public_flag): Remove. (typespec_nonreserved_nonattr): Call objc_get_protocol_qualified_type() instead of get_static_reference() and get_protocol_reference(). (stmt_nocomp): Call grokparm() on @catch parameter. (objcdef): Move semantic action to objc_finish_implementation(). (classdef): Move semantic action to objc_start_class_interface(), objc_continue_interface(), objc_finish_interface(), objc_start_class_implementation(), objc_continue_implementation(), objc_start_category_interface() and objc_start_category_implementation(). (protocoldef): Move semantic actions to objc_start_protocol() and objc_finish_interface(). (ivar_decl_list): Remove nonterminal. (visibility_spec): Move semantic actions to objc_set_visibility(). (ivar_decls): Remove assignment to $$. (ivar_decl): Rephrase in terms of component_decl; call objc_add_instance_variable(). (ivars, ivar_declarator): Remove nonterminals. (opt_semi): New nonterminal. (methodtype): Remove semantic actions. (methoddef): Move semantic actions to objc_set_method_type(), objc_start_method_definition() and objc_finish_method_definition(). (methodproto): Move semantic actions to objc_set_method_type() and objc_add_method_declaration(). (methoddecl): Use objc_typename instead of typename; move semantic actions to objc_build_method_signature(). (optarglist, myxdecls, mydecl, myparms, myparm): Remove nonterminals. (optparmlist): Express in terms of optparms and optellipsis. (optparms, optellipsis, objc_qual, objc_quals, objc_typename): New nonterminals. (keyworddecl): Use objc_typename instead of typename. (rid_to_yy): Mark RID_IN, RID_OUT, RID_INOUT, RID_BYCOPY, RID_BYREF and RID_ONEWAY as returning OBJC_TYPE_QUAL to yyparse(). [gcc/objc/ChangeLog] 2004-09-07 Ziemowit Laski <zlaski@apple.com> * Make-lang.in (objc/objc-parse.o): Depend on $(C_COMMON_H) instead of objc/objc-act.h. (objc/objc-act.o): Depend on $(HASHTAB_H). * objc-act.c: Include hashtab.h; in ObjC++ mode, include cp-tree.h and objcp-decl.h instead of c-tree.h. (build_module_descriptor, get_class_ivars, synth_id_with_class_suffix, error_with_ivar, gen_method_decl, gen_declaration, setup_string_decl, build_protocol_template): Adjust prototypes. (build_module_initializer_routine, start_class, continue_class, finish_class, start_method_def, objc_start_function, start_protocol, build_method_decl, objc_add_method, add_instance_variable, build_ivar_reference, is_ivar, is_private, get_super_receiver, build_selector_table_decl, objc_push_parm, objc_get_parm_info, gen_type_name, gen_type_name_0, start_var_decl, finish_var_decl, create_field_decl): New prototypes. (objc_expand_function_end, comp_method_with_proto, objc_expr_last, gen_declaration_1, gen_declarator, is_complex_decl, adorn_decl, define_decl, create_builtin_decl, gen_declspecs): Remove prototypes. (TYPE_ID): Rename to OBJECT_TYPEDEF_NAME. (CLASS_TYPEDEF_NAME): New. (TAG_EXECCLASS): Change from a global variable to a #define. (TAG_RETURN_STRUCT): Delete. (TAG_GNUINIT): New, holds '__objc_gnu_init' name. (objc_inherit_code, objc_public_flag): New, moved from c-parse.in. (string_descriptor): New struct. (string_htab): New hash table. (string_hash, string_eq): New prototypes. (generate_struct_by_value_array): Call create_field_decl() instead of create_builtin_decl(). (objc_init): Do not initialize objc_ellipsis_node or TAG_EXECCLASS; In ObjC++ mode, call cxx_init() instead of c_objc_common_init(). (objc_finish_file): In ObjC++, call instantiate_pending_templates() and cp_finish_file(). (define_decl, get_static_reference, get_protocol_reference, create_builtin_decl): Remove functions. (objc_start_class_interface, objc_start_category_interface, objc_start_protocol, objc_continue_interface, objc_finish_interface, objc_start_class_implementation, objc_start_category_implementation, objc_continue_implementation, objc_finish_implementation, objc_set_visibility, objc_set_method_type, objc_build_method_signature, objc_add_method_declaration, objc_start_method_definition, objc_add_instance_variable, objc_get_protocol_qualified_type, create_field_decl, start_var_decl, finish_var_decl): New functions. (setup_string_decl): Simplify since it is only called once. (synth_module_prologue): Call build_class_template(); predefine 'id' and 'Class' as typedefs; rename 'temp_type' to 'type'; disable debug hooks for duration of function; fix GNU runtime messenger signatures to correspond to reality; forward-declare '__objc_exec_class' for the GNU runtime; call build_selector_table_decl(); in ObjC++ mode, generate 'extern "C" { ... }' wrappers around synthesized declarations; call build_protocol_template() and build_category_template(). (string_hash, string_eq): New functions. (objc_build_string_object): Check metaclass correctness only once; store string literals in hash table. (objc_build_constructor): Do not convert initializer elements; adjust for ObjC++ impedance mismatch. (build_objc_symtab_template): Call create_field_decl() instead of create_builtin_decl(). (init_objc_symtab): Add missing conversion to initializer element. (build_metadata_decl): Call start_var_decl() instead of define_decl(). (generate_objc_symtab_decl): Do not call build_category_template(); call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(). (build_module_descriptor): Call create_field_decl() instead of grokfield(); call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(); always mark module descriptor as used; move GNU runtime-specific functionality to build_module_initializer_routine(). (build_module_initializer_routine): New function, broken off of build_module_descriptor(). (objc_static_init_needed_p, objc_generate_static_init_call): New functions. (generate_static_references, generate_strings, build_selector_translation_table, generate_descriptor_table, generate_ivars_list, generate_dispatch_table, generate_category): Call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(); build a type directly instead of via groktypename(). (build_selector_reference_decl, build_selector_table_decl, build_class_reference_decl, build_protocol_reference, generate_objc_image_info): Call start_var_decl() instead of build_decl(). (build_selector_reference): For GNU runtime, do not call build_selector_reference_decl(). (build_selector, build_typed_selector_reference): Always convert result to the selector type. (add_objc_string): Cast return value to 'char *'. (build_method_prototype_template, build_selector_template, build_method_template): Use actual selector type for fields pointing to selectors. (finish_objc): For GNU runtime, call build_module_initializer_routine() after build_module_descriptor(). (generate_protocol_list, generate_shared_structures): Call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(); build a type directly instead of via groktypename(). (synth_id_with_class_suffix): Return a string. (get_arg_type_list): For instance methods, use the instance type for 'self'; do not call groktypename_in_parm_context(). (build_objc_string_decl): Squash redeclaration errors in ObjC++. (objc_is_class_name): Use OBJC_TYPE_NAME instead of TYPE_NAME; handle RECORD_TYPEs in ObjC as well as ObjC++. (objc_is_id): New function. (objc_is_object_ptr): Return the canonical type node. (objc_get_class_ivars): Simplify using get_class_ivars(). (get_class_ivars): Remove second parameter; create a fresh copy of the ivar list for each call; do not check for existence of super class. (objc_eh_runtime_type): Mark #ifndef OBJCPLUS. (objc_init_exceptions): When using SJLJ-style exceptions, require the use of '-fobjc-exceptions' flag; do not require it for DWARF-style exceptions. (objc_build_exc_ptr, next_sjlj_build_try_catch_finally): Use objc_object_type instead of objc_id_type. (objc_begin_catch_clause): Convert the incoming PARM_DECL into a VAR_DECL before placing it in the appropriate scope; do not call define_decl(); adjust call to c_begin_compound_stmt(); use objc_object_type instead of objc_id_type. (build_next_objc_exception_stuff): Call create_field_decl() instead of create_builtin_decl(); construct type directly instead of calling groktypename(); use OBJC_VOID_AT_END to mark end of function parameters. (build_private_template): Adjust call to get_class_ivars(); build a type directly instead of via groktypename(). (build_protocol_template, build_method_prototype_list_template, build_method_prototype_template, build_category_template, build_selector_template, build_class_template, build_super_template, build_ivar_template, build_ivar_list_template, build_method_list_template, build_method_template): Call create_field_decl() instead of grokfield(). (objc_method_parm_type): Do not call groktypename(). (generate_descriptor_table): Call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(). (generate_method_descriptors, build_protocol_initializer, generate_dispatch_tables, build_category_initializer, build_shared_structure_initializer): Do not call groktypename(). (generate_protocols): Call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(); do not call groktypename(). (error_with_ivar): Remove last parameter. (check_ivars): Do not iterate ovar CLASS_RAW_IVARS lists in addition to CLASS_IVARS lists; adjust calls to error_with_ivar(). (generate_ivar_lists): Convert one of the initializer elements; do not call groktypename(). (get_arg_type_list, start_method_def, gen_method_def): Account for new representation of variable arguments and '...' in Objective-C methods; add Objective-C++ impedance matching code. (is_objc_type_qualifier): Remove function. (adjust_type_for_id_default): Simplify; there is no longer a need to wade through declspecs. (lookup_interface, start_class, continue_class, finish_class, start_method_def, start_protocol, build_method_decl, objc_add_method, add_instance_variable, build_ivar_reference, is_ivar, is_private, get_super_receiver, objc_build_finally_epilogue): Make into static functions. (receiver_is_class_object): Use new IS_CLASS() macro. (objc_build_message_expr): Tweak ObjC++ message argument handling; call objc_finish_message_expr() instead of finish_message_expr(). (finish_message_expr): Rename to objc_finish_message_expr(); use OBJC_TYPE_NAME and OBJC_SET_TYPE_NAME macros instead of TYPE_NAME. call gen_type_name() instead of gen_declaration(); call objc_is_id() instead of using IS_ID and IS_CLASS; Use objc_class_name instead of calling get_identifier("Class"); handle CONVERT_EXPRs in receiver. (build_objc_method_call, warn_with_method): Do not call groktypename(). (build_ivar_reference): Call convert() instead of clobbering in a type. (hash_init): Initialize string_htab hash table. (add_instance_variable): Simplify parameter list; do not call grokfield(); do not populate CLASS_IVARS list. (start_class): Check for the existence of super class, if one was specified. (continue_class): Use CLASS_RAW_IVARS rather than CLASS_IVARS; do not call build_class_template(); adjust call to get_class_ivars(); call build_decl(), pushdecl() and finish_decl() instead of define_decl(). (finish_class): Call build_decl(), pushdecl() and finish_decl() instead of define_decl(). (add_protocols): Use PROTOCOL_BINFO_ELTS for the tree vector size. (start_protocol): Do not call build_protocol_template(); use PROTOCOL_BINFO_ELTS for the tree vector size. (encode_type_qualifiers): Do not handle the 'const' qualifier here. (encode_pointer): Encode 'const char *' as 'r*', for backwards compatibility. (encode_array): Use HOST_WIDE_INT_PRINT_DEC instead of "%ld". (encode_type): Handle the 'const' qualifier here. (objc_parmlist): New global variable, sued by objc_push_parm and objc_get_parm_info(). (objc_push_parm, objc_get_parm_info): New functions. (objc_expr_last): Remove function. (synth_self_and_ucmd_args): For instance methods, use the instance type for 'self'; call objc_push_parm() instead of push_parm_decl(). (start_method_def): Do not call push_scope(), declare_parm_level(), pop_scope(), push_parm_decl(), store_parm_decls() or objc_expr_last(); just use objc_push_parm() and objc_get_parm_info(). (comp_method_with_proto): Remove function. (objc_types_are_equivalent): Strip away indirections before comparing underlying types. (comp_proto_with_proto): Do not call groktypename(); types are no longer in raw declspec format. (objc_start_function): New function. (really_start_method): Call comp_proto_with_proto() instead of comp_method_with_proto(); call objc_start_function() instead of hand-crafting a function declarator. (continue_method_def, objc_expand_function_end): Remove functions. (get_super_receiver): Call objc_get_current_scope() instead of get_current_scope(); reference 'super_class' field (instead of 'class'). (finish_method_def): Rename to objc_finish_method_definition() and add a function decl parameter; move method encoding call from objc_expand_function_end(). (is_complex_decl, adorn_decl, gen_declarator, gen_declspecs, gen_declaration_1): Remove functions. (tmpbuf, RAW_DECLSPEC): Remove. (gen_declaration): Remove second parameter; simplify to deal with TYPE_P nodes instead of raw declspecs. (gen_type_name, gen_type_name_0): New functions. (gen_method_decl): Remove second parameter; call gen_type_name() instead of gen_declaration_1(). (dump_interface): Adjust calls to gen_declaration() and gen_method_decl(); do not allocate a separate string buffer. (init_objc): Allocate a larger string buffer to accommodate dump_interface(); adjust call to build_module_descriptor(); add call to build_module_initializer_routine() for the GNU runtime. (generate_classref_translation_entry): Do not call start_decl(); call finish_var_decl() instead of finish_decl(); call convert() instead of build_c_cast(). * objc-act.h (CLASS_OWN_IVARS): Remove accessor. (CLASS_BINFO_ELTS): Reduce from 6 to 5, now that CLASS_OWN_IVARS is gone. (OCTI_GNU_INIT_DECL, GNU_INIT_decl): New. (OCTI_ELLIPSIS_NODE, objc_ellipsis_node): Remove. (OCTI_ID_ID, id_type, objc_id_id): Rename to OCTI_ID_NAME, objc_object_type and objc_object_name, respectively. (OCTI_CLS_REF, OCTI_CLASS_NAME, objc_class_reference, objc_class_name): New. (IS_CLASS): New macro. (IS_ID, IS_SUPER): Robustify. (OCTI_EXECCLASS_DECL, execclass_decl): New. (finish_file, start_class, continue_class, finish_class, start_method_def, continue_method_def, finish_method_def, start_protocol, finish_protocol, objc_build_throw_stmt, objc_build_try_catch_finally_stmt, objc_build_synchronized_prologue, objc_build_synchronized_epilogue, objc_build_try_prologue, objc_build_try_epilogue, objc_build_catch_stmt, objc_build_catch_epilogue, objc_build_finally_prologue, objc_build_finally_epilogue, is_ivar, is_private, is_public, add_instance_variable, objc_add_method, get_super_receiver, objc_clear_super_receiver, get_class_ivars_from_name, get_class_reference, get_static_reference, get_object_reference, build_message_expr, finish_message_expr, build_selector_expr, build_ivar_reference, build_keyword_decl, build_method_decl, build_protocol_expr, build_objc_string_object, objc_declare_alias, objc_declare_class, objc_declare_protocols, objc_comptypes, objc_check_decl, build_encode_expr): Remove prototypes. (imp_count, cat_count): Make GGC-aware. (OBJC_SET_TYPE_NAME): New macro. From-SVN: r87168
2004-09-08 02:49:44 +02:00
#endif /* OBJCPLUS */
1992-01-18 00:15:38 +01:00
/* Return the DECL of the string IDENT in the SECTION. */
static tree
get_objc_string_decl (tree ident, enum string_section section)
{
Fix warious warnings: * c-aux-info.c: Include string.h/strings.h. * pa.c: Include stdlib.h. (pa_combine_instructions): Prototype the function. (pa_can_combine_p, forward_branch_p, shadd_constant_p): Likewise. (reloc_needed): Add default case for enumeration switch. (remove_useless_addtr_insns): Remove unused variable `all'. (hppa_expand_prologue): Add explicit braces to avoid ambiguous `else'. (output_function_epilogue): Remove unused variable `i'. (output_millicode_call): Remove unused variable `link'. (shadd_constant_p, forward_branch_p): Make the function static. (following_call): Explicitly declare to return int. (pa_reorg): Declare as void. (pa_combine_instructions): Declare as static void. Add parentheses around && within ||. * pa.h: Add prototypes for pa_reorg, symbolic_operand, following_call, function_label_operand, lhs_lshift_cint_operand and zdepi_cint_p. * pa.md: Add parentheses around && within ||. * cppalloc.c: Include stdlib.h. * cpperror.c (cpp_print_containing_files): Remove unused variable `i'. Fix format specifier in fprintf. * cse.c (cse_around_loop): Add explicit braces to avoid ambiguous `else'. (delete_dead_from_cse): Wrap variable `tem' in macro HAVE_cc0. * expr.c (expand_expr): Add parentheses around && within ||. * final.c (app_enable): Replace fprintf with fputs where there are no format specifiers and no trailing argument after the string. Eg, when printing ASM_APP_ON/ASM_APP_OFF. (app_disable): Likewise. (final_end_function): Likewise. (final_scan_insn): Likewise. Remove unused variable `set'. (profile_function): Wrap empty if-statement body in {} brackets. * function.c: Include stdlib.h. (pad_below): Wrap prototype and definition in ARGS_GROW_DOWNWARD. (reposition_prologue_and_epilogue_notes): Add parentheses around assignment used as truth value. * integrate.c (expand_inline_function): Wrap variable `cc0_insn' in macro HAVE_cc0. * jump.c (jump_optimize): Wrap variable `q' in macro HAVE_cc0. Remove unused variable `prev1'. * libgcc2.c (__bb_exit_trace_func): Add parentheses around && within ||. Fix format specifier in fprintf. (__bb_init_prg): Add parentheses around assignment used as truth value. * local-alloc.c: Include stdlib.h. (requires_inout): Add parentheses around assignment used as truth value. * loop.c (analyze_loop_iterations): Wrap prototype and definition in macro HAVE_decrement_and_branch_on_count. (insert_bct, instrument_loop_bct): Likewise. (move_movables): Add parentheses around assignment used as truth value. (consec_sets_invariant_p): Likewise. (maybe_eliminate_biv_1): Wrap variable `new' in macro HAVE_cc0. * objc/objc-act.c: Include stdlib.h. (lookup_method_in_protocol_list): Wrap empty else-statement body in braces. (lookup_protocol_in_reflist): Likewise. (objc_add_static_instance): Remove unused variables `decl_expr' and `decl_spec'. (get_objc_string_decl): Remove unused variable `decl'. (generate_static_references): Remove unused variables `idecl' and `instance'. (check_protocols): Wrap empty else-statement body in braces. * protoize.c: Include stdlib.h. (substr): Add parentheses around assignment used as truth value. (abspath): Likewise. (shortpath): Likewise. * regmove.c (fixup_match_1): Add parentheses around assignment used as truth value. * reload.c (push_secondary_reload): Remove unused variable `i'. (find_reloads): Add parentheses around assignment used as truth value. * reload1.c: Include stdlib.h. * rtl.h: Correct typo in prototype of offsettable_memref_p. * stmt.c (add_case_node): Add parentheses around assignment used as truth value. (case_tree2list): Likewise. * tree.c (valid_machine_attribute): Wrap variable `decl_attr_list' in macro VALID_MACHINE_DECL_ATTRIBUTE. Wrap variable `type_attr_list' in macro VALID_MACHINE_TYPE_ATTRIBUTE. (merge_attributes): Add explicit braces to avoid ambiguous `else'. * unroll.c (copy_loop_body): Wrap variable `cc0_insn' in macro HAVE_cc0. * varasm.c: Include stdlib.h. From-SVN: r18290
1998-02-28 08:06:53 +01:00
tree chain;
if (section == class_names)
chain = class_names_chain;
else if (section == meth_var_names)
chain = meth_var_names_chain;
else if (section == meth_var_types)
chain = meth_var_types_chain;
else
abort ();
for (; chain != 0; chain = TREE_CHAIN (chain))
if (TREE_VALUE (chain) == ident)
return (TREE_PURPOSE (chain));
abort ();
return NULL_TREE;
}
/* Output references to all statically allocated objects. Return the DECL
for the array built. */
static void
generate_static_references (void)
{
Makefile.in (c-parse.o): Depend on $(C_COMMON_H). [gcc/ChangeLog] 2004-09-07 Ziemowit Laski <zlaski@apple.com> * Makefile.in (c-parse.o): Depend on $(C_COMMON_H). * c-parse.in: Include c-common.h instead of objc-act.h. (ivar_decl_list, ivar_decls, ivar_decl, ivars, ivar_declarator, myparms, myparm): Remove %type declarations. (methodtype, optparms, OBJC_TYPE_QUAL, objc_quals, objc_qual, objc_typename, objc_try_catch_stmt, optellipsis): Add %type declarations. (objc_inherit_code, objc_public_flag): Remove. (typespec_nonreserved_nonattr): Call objc_get_protocol_qualified_type() instead of get_static_reference() and get_protocol_reference(). (stmt_nocomp): Call grokparm() on @catch parameter. (objcdef): Move semantic action to objc_finish_implementation(). (classdef): Move semantic action to objc_start_class_interface(), objc_continue_interface(), objc_finish_interface(), objc_start_class_implementation(), objc_continue_implementation(), objc_start_category_interface() and objc_start_category_implementation(). (protocoldef): Move semantic actions to objc_start_protocol() and objc_finish_interface(). (ivar_decl_list): Remove nonterminal. (visibility_spec): Move semantic actions to objc_set_visibility(). (ivar_decls): Remove assignment to $$. (ivar_decl): Rephrase in terms of component_decl; call objc_add_instance_variable(). (ivars, ivar_declarator): Remove nonterminals. (opt_semi): New nonterminal. (methodtype): Remove semantic actions. (methoddef): Move semantic actions to objc_set_method_type(), objc_start_method_definition() and objc_finish_method_definition(). (methodproto): Move semantic actions to objc_set_method_type() and objc_add_method_declaration(). (methoddecl): Use objc_typename instead of typename; move semantic actions to objc_build_method_signature(). (optarglist, myxdecls, mydecl, myparms, myparm): Remove nonterminals. (optparmlist): Express in terms of optparms and optellipsis. (optparms, optellipsis, objc_qual, objc_quals, objc_typename): New nonterminals. (keyworddecl): Use objc_typename instead of typename. (rid_to_yy): Mark RID_IN, RID_OUT, RID_INOUT, RID_BYCOPY, RID_BYREF and RID_ONEWAY as returning OBJC_TYPE_QUAL to yyparse(). [gcc/objc/ChangeLog] 2004-09-07 Ziemowit Laski <zlaski@apple.com> * Make-lang.in (objc/objc-parse.o): Depend on $(C_COMMON_H) instead of objc/objc-act.h. (objc/objc-act.o): Depend on $(HASHTAB_H). * objc-act.c: Include hashtab.h; in ObjC++ mode, include cp-tree.h and objcp-decl.h instead of c-tree.h. (build_module_descriptor, get_class_ivars, synth_id_with_class_suffix, error_with_ivar, gen_method_decl, gen_declaration, setup_string_decl, build_protocol_template): Adjust prototypes. (build_module_initializer_routine, start_class, continue_class, finish_class, start_method_def, objc_start_function, start_protocol, build_method_decl, objc_add_method, add_instance_variable, build_ivar_reference, is_ivar, is_private, get_super_receiver, build_selector_table_decl, objc_push_parm, objc_get_parm_info, gen_type_name, gen_type_name_0, start_var_decl, finish_var_decl, create_field_decl): New prototypes. (objc_expand_function_end, comp_method_with_proto, objc_expr_last, gen_declaration_1, gen_declarator, is_complex_decl, adorn_decl, define_decl, create_builtin_decl, gen_declspecs): Remove prototypes. (TYPE_ID): Rename to OBJECT_TYPEDEF_NAME. (CLASS_TYPEDEF_NAME): New. (TAG_EXECCLASS): Change from a global variable to a #define. (TAG_RETURN_STRUCT): Delete. (TAG_GNUINIT): New, holds '__objc_gnu_init' name. (objc_inherit_code, objc_public_flag): New, moved from c-parse.in. (string_descriptor): New struct. (string_htab): New hash table. (string_hash, string_eq): New prototypes. (generate_struct_by_value_array): Call create_field_decl() instead of create_builtin_decl(). (objc_init): Do not initialize objc_ellipsis_node or TAG_EXECCLASS; In ObjC++ mode, call cxx_init() instead of c_objc_common_init(). (objc_finish_file): In ObjC++, call instantiate_pending_templates() and cp_finish_file(). (define_decl, get_static_reference, get_protocol_reference, create_builtin_decl): Remove functions. (objc_start_class_interface, objc_start_category_interface, objc_start_protocol, objc_continue_interface, objc_finish_interface, objc_start_class_implementation, objc_start_category_implementation, objc_continue_implementation, objc_finish_implementation, objc_set_visibility, objc_set_method_type, objc_build_method_signature, objc_add_method_declaration, objc_start_method_definition, objc_add_instance_variable, objc_get_protocol_qualified_type, create_field_decl, start_var_decl, finish_var_decl): New functions. (setup_string_decl): Simplify since it is only called once. (synth_module_prologue): Call build_class_template(); predefine 'id' and 'Class' as typedefs; rename 'temp_type' to 'type'; disable debug hooks for duration of function; fix GNU runtime messenger signatures to correspond to reality; forward-declare '__objc_exec_class' for the GNU runtime; call build_selector_table_decl(); in ObjC++ mode, generate 'extern "C" { ... }' wrappers around synthesized declarations; call build_protocol_template() and build_category_template(). (string_hash, string_eq): New functions. (objc_build_string_object): Check metaclass correctness only once; store string literals in hash table. (objc_build_constructor): Do not convert initializer elements; adjust for ObjC++ impedance mismatch. (build_objc_symtab_template): Call create_field_decl() instead of create_builtin_decl(). (init_objc_symtab): Add missing conversion to initializer element. (build_metadata_decl): Call start_var_decl() instead of define_decl(). (generate_objc_symtab_decl): Do not call build_category_template(); call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(). (build_module_descriptor): Call create_field_decl() instead of grokfield(); call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(); always mark module descriptor as used; move GNU runtime-specific functionality to build_module_initializer_routine(). (build_module_initializer_routine): New function, broken off of build_module_descriptor(). (objc_static_init_needed_p, objc_generate_static_init_call): New functions. (generate_static_references, generate_strings, build_selector_translation_table, generate_descriptor_table, generate_ivars_list, generate_dispatch_table, generate_category): Call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(); build a type directly instead of via groktypename(). (build_selector_reference_decl, build_selector_table_decl, build_class_reference_decl, build_protocol_reference, generate_objc_image_info): Call start_var_decl() instead of build_decl(). (build_selector_reference): For GNU runtime, do not call build_selector_reference_decl(). (build_selector, build_typed_selector_reference): Always convert result to the selector type. (add_objc_string): Cast return value to 'char *'. (build_method_prototype_template, build_selector_template, build_method_template): Use actual selector type for fields pointing to selectors. (finish_objc): For GNU runtime, call build_module_initializer_routine() after build_module_descriptor(). (generate_protocol_list, generate_shared_structures): Call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(); build a type directly instead of via groktypename(). (synth_id_with_class_suffix): Return a string. (get_arg_type_list): For instance methods, use the instance type for 'self'; do not call groktypename_in_parm_context(). (build_objc_string_decl): Squash redeclaration errors in ObjC++. (objc_is_class_name): Use OBJC_TYPE_NAME instead of TYPE_NAME; handle RECORD_TYPEs in ObjC as well as ObjC++. (objc_is_id): New function. (objc_is_object_ptr): Return the canonical type node. (objc_get_class_ivars): Simplify using get_class_ivars(). (get_class_ivars): Remove second parameter; create a fresh copy of the ivar list for each call; do not check for existence of super class. (objc_eh_runtime_type): Mark #ifndef OBJCPLUS. (objc_init_exceptions): When using SJLJ-style exceptions, require the use of '-fobjc-exceptions' flag; do not require it for DWARF-style exceptions. (objc_build_exc_ptr, next_sjlj_build_try_catch_finally): Use objc_object_type instead of objc_id_type. (objc_begin_catch_clause): Convert the incoming PARM_DECL into a VAR_DECL before placing it in the appropriate scope; do not call define_decl(); adjust call to c_begin_compound_stmt(); use objc_object_type instead of objc_id_type. (build_next_objc_exception_stuff): Call create_field_decl() instead of create_builtin_decl(); construct type directly instead of calling groktypename(); use OBJC_VOID_AT_END to mark end of function parameters. (build_private_template): Adjust call to get_class_ivars(); build a type directly instead of via groktypename(). (build_protocol_template, build_method_prototype_list_template, build_method_prototype_template, build_category_template, build_selector_template, build_class_template, build_super_template, build_ivar_template, build_ivar_list_template, build_method_list_template, build_method_template): Call create_field_decl() instead of grokfield(). (objc_method_parm_type): Do not call groktypename(). (generate_descriptor_table): Call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(). (generate_method_descriptors, build_protocol_initializer, generate_dispatch_tables, build_category_initializer, build_shared_structure_initializer): Do not call groktypename(). (generate_protocols): Call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(); do not call groktypename(). (error_with_ivar): Remove last parameter. (check_ivars): Do not iterate ovar CLASS_RAW_IVARS lists in addition to CLASS_IVARS lists; adjust calls to error_with_ivar(). (generate_ivar_lists): Convert one of the initializer elements; do not call groktypename(). (get_arg_type_list, start_method_def, gen_method_def): Account for new representation of variable arguments and '...' in Objective-C methods; add Objective-C++ impedance matching code. (is_objc_type_qualifier): Remove function. (adjust_type_for_id_default): Simplify; there is no longer a need to wade through declspecs. (lookup_interface, start_class, continue_class, finish_class, start_method_def, start_protocol, build_method_decl, objc_add_method, add_instance_variable, build_ivar_reference, is_ivar, is_private, get_super_receiver, objc_build_finally_epilogue): Make into static functions. (receiver_is_class_object): Use new IS_CLASS() macro. (objc_build_message_expr): Tweak ObjC++ message argument handling; call objc_finish_message_expr() instead of finish_message_expr(). (finish_message_expr): Rename to objc_finish_message_expr(); use OBJC_TYPE_NAME and OBJC_SET_TYPE_NAME macros instead of TYPE_NAME. call gen_type_name() instead of gen_declaration(); call objc_is_id() instead of using IS_ID and IS_CLASS; Use objc_class_name instead of calling get_identifier("Class"); handle CONVERT_EXPRs in receiver. (build_objc_method_call, warn_with_method): Do not call groktypename(). (build_ivar_reference): Call convert() instead of clobbering in a type. (hash_init): Initialize string_htab hash table. (add_instance_variable): Simplify parameter list; do not call grokfield(); do not populate CLASS_IVARS list. (start_class): Check for the existence of super class, if one was specified. (continue_class): Use CLASS_RAW_IVARS rather than CLASS_IVARS; do not call build_class_template(); adjust call to get_class_ivars(); call build_decl(), pushdecl() and finish_decl() instead of define_decl(). (finish_class): Call build_decl(), pushdecl() and finish_decl() instead of define_decl(). (add_protocols): Use PROTOCOL_BINFO_ELTS for the tree vector size. (start_protocol): Do not call build_protocol_template(); use PROTOCOL_BINFO_ELTS for the tree vector size. (encode_type_qualifiers): Do not handle the 'const' qualifier here. (encode_pointer): Encode 'const char *' as 'r*', for backwards compatibility. (encode_array): Use HOST_WIDE_INT_PRINT_DEC instead of "%ld". (encode_type): Handle the 'const' qualifier here. (objc_parmlist): New global variable, sued by objc_push_parm and objc_get_parm_info(). (objc_push_parm, objc_get_parm_info): New functions. (objc_expr_last): Remove function. (synth_self_and_ucmd_args): For instance methods, use the instance type for 'self'; call objc_push_parm() instead of push_parm_decl(). (start_method_def): Do not call push_scope(), declare_parm_level(), pop_scope(), push_parm_decl(), store_parm_decls() or objc_expr_last(); just use objc_push_parm() and objc_get_parm_info(). (comp_method_with_proto): Remove function. (objc_types_are_equivalent): Strip away indirections before comparing underlying types. (comp_proto_with_proto): Do not call groktypename(); types are no longer in raw declspec format. (objc_start_function): New function. (really_start_method): Call comp_proto_with_proto() instead of comp_method_with_proto(); call objc_start_function() instead of hand-crafting a function declarator. (continue_method_def, objc_expand_function_end): Remove functions. (get_super_receiver): Call objc_get_current_scope() instead of get_current_scope(); reference 'super_class' field (instead of 'class'). (finish_method_def): Rename to objc_finish_method_definition() and add a function decl parameter; move method encoding call from objc_expand_function_end(). (is_complex_decl, adorn_decl, gen_declarator, gen_declspecs, gen_declaration_1): Remove functions. (tmpbuf, RAW_DECLSPEC): Remove. (gen_declaration): Remove second parameter; simplify to deal with TYPE_P nodes instead of raw declspecs. (gen_type_name, gen_type_name_0): New functions. (gen_method_decl): Remove second parameter; call gen_type_name() instead of gen_declaration_1(). (dump_interface): Adjust calls to gen_declaration() and gen_method_decl(); do not allocate a separate string buffer. (init_objc): Allocate a larger string buffer to accommodate dump_interface(); adjust call to build_module_descriptor(); add call to build_module_initializer_routine() for the GNU runtime. (generate_classref_translation_entry): Do not call start_decl(); call finish_var_decl() instead of finish_decl(); call convert() instead of build_c_cast(). * objc-act.h (CLASS_OWN_IVARS): Remove accessor. (CLASS_BINFO_ELTS): Reduce from 6 to 5, now that CLASS_OWN_IVARS is gone. (OCTI_GNU_INIT_DECL, GNU_INIT_decl): New. (OCTI_ELLIPSIS_NODE, objc_ellipsis_node): Remove. (OCTI_ID_ID, id_type, objc_id_id): Rename to OCTI_ID_NAME, objc_object_type and objc_object_name, respectively. (OCTI_CLS_REF, OCTI_CLASS_NAME, objc_class_reference, objc_class_name): New. (IS_CLASS): New macro. (IS_ID, IS_SUPER): Robustify. (OCTI_EXECCLASS_DECL, execclass_decl): New. (finish_file, start_class, continue_class, finish_class, start_method_def, continue_method_def, finish_method_def, start_protocol, finish_protocol, objc_build_throw_stmt, objc_build_try_catch_finally_stmt, objc_build_synchronized_prologue, objc_build_synchronized_epilogue, objc_build_try_prologue, objc_build_try_epilogue, objc_build_catch_stmt, objc_build_catch_epilogue, objc_build_finally_prologue, objc_build_finally_epilogue, is_ivar, is_private, is_public, add_instance_variable, objc_add_method, get_super_receiver, objc_clear_super_receiver, get_class_ivars_from_name, get_class_reference, get_static_reference, get_object_reference, build_message_expr, finish_message_expr, build_selector_expr, build_ivar_reference, build_keyword_decl, build_method_decl, build_protocol_expr, build_objc_string_object, objc_declare_alias, objc_declare_class, objc_declare_protocols, objc_comptypes, objc_check_decl, build_encode_expr): Remove prototypes. (imp_count, cat_count): Make GGC-aware. (OBJC_SET_TYPE_NAME): New macro. From-SVN: r87168
2004-09-08 02:49:44 +02:00
tree decls = NULL_TREE, expr = NULL_TREE;
Fix warious warnings: * c-aux-info.c: Include string.h/strings.h. * pa.c: Include stdlib.h. (pa_combine_instructions): Prototype the function. (pa_can_combine_p, forward_branch_p, shadd_constant_p): Likewise. (reloc_needed): Add default case for enumeration switch. (remove_useless_addtr_insns): Remove unused variable `all'. (hppa_expand_prologue): Add explicit braces to avoid ambiguous `else'. (output_function_epilogue): Remove unused variable `i'. (output_millicode_call): Remove unused variable `link'. (shadd_constant_p, forward_branch_p): Make the function static. (following_call): Explicitly declare to return int. (pa_reorg): Declare as void. (pa_combine_instructions): Declare as static void. Add parentheses around && within ||. * pa.h: Add prototypes for pa_reorg, symbolic_operand, following_call, function_label_operand, lhs_lshift_cint_operand and zdepi_cint_p. * pa.md: Add parentheses around && within ||. * cppalloc.c: Include stdlib.h. * cpperror.c (cpp_print_containing_files): Remove unused variable `i'. Fix format specifier in fprintf. * cse.c (cse_around_loop): Add explicit braces to avoid ambiguous `else'. (delete_dead_from_cse): Wrap variable `tem' in macro HAVE_cc0. * expr.c (expand_expr): Add parentheses around && within ||. * final.c (app_enable): Replace fprintf with fputs where there are no format specifiers and no trailing argument after the string. Eg, when printing ASM_APP_ON/ASM_APP_OFF. (app_disable): Likewise. (final_end_function): Likewise. (final_scan_insn): Likewise. Remove unused variable `set'. (profile_function): Wrap empty if-statement body in {} brackets. * function.c: Include stdlib.h. (pad_below): Wrap prototype and definition in ARGS_GROW_DOWNWARD. (reposition_prologue_and_epilogue_notes): Add parentheses around assignment used as truth value. * integrate.c (expand_inline_function): Wrap variable `cc0_insn' in macro HAVE_cc0. * jump.c (jump_optimize): Wrap variable `q' in macro HAVE_cc0. Remove unused variable `prev1'. * libgcc2.c (__bb_exit_trace_func): Add parentheses around && within ||. Fix format specifier in fprintf. (__bb_init_prg): Add parentheses around assignment used as truth value. * local-alloc.c: Include stdlib.h. (requires_inout): Add parentheses around assignment used as truth value. * loop.c (analyze_loop_iterations): Wrap prototype and definition in macro HAVE_decrement_and_branch_on_count. (insert_bct, instrument_loop_bct): Likewise. (move_movables): Add parentheses around assignment used as truth value. (consec_sets_invariant_p): Likewise. (maybe_eliminate_biv_1): Wrap variable `new' in macro HAVE_cc0. * objc/objc-act.c: Include stdlib.h. (lookup_method_in_protocol_list): Wrap empty else-statement body in braces. (lookup_protocol_in_reflist): Likewise. (objc_add_static_instance): Remove unused variables `decl_expr' and `decl_spec'. (get_objc_string_decl): Remove unused variable `decl'. (generate_static_references): Remove unused variables `idecl' and `instance'. (check_protocols): Wrap empty else-statement body in braces. * protoize.c: Include stdlib.h. (substr): Add parentheses around assignment used as truth value. (abspath): Likewise. (shortpath): Likewise. * regmove.c (fixup_match_1): Add parentheses around assignment used as truth value. * reload.c (push_secondary_reload): Remove unused variable `i'. (find_reloads): Add parentheses around assignment used as truth value. * reload1.c: Include stdlib.h. * rtl.h: Correct typo in prototype of offsettable_memref_p. * stmt.c (add_case_node): Add parentheses around assignment used as truth value. (case_tree2list): Likewise. * tree.c (valid_machine_attribute): Wrap variable `decl_attr_list' in macro VALID_MACHINE_DECL_ATTRIBUTE. Wrap variable `type_attr_list' in macro VALID_MACHINE_TYPE_ATTRIBUTE. (merge_attributes): Add explicit braces to avoid ambiguous `else'. * unroll.c (copy_loop_body): Wrap variable `cc0_insn' in macro HAVE_cc0. * varasm.c: Include stdlib.h. From-SVN: r18290
1998-02-28 08:06:53 +01:00
tree class_name, class, decl, initlist;
Makefile.in (c-parse.o): Depend on $(C_COMMON_H). [gcc/ChangeLog] 2004-09-07 Ziemowit Laski <zlaski@apple.com> * Makefile.in (c-parse.o): Depend on $(C_COMMON_H). * c-parse.in: Include c-common.h instead of objc-act.h. (ivar_decl_list, ivar_decls, ivar_decl, ivars, ivar_declarator, myparms, myparm): Remove %type declarations. (methodtype, optparms, OBJC_TYPE_QUAL, objc_quals, objc_qual, objc_typename, objc_try_catch_stmt, optellipsis): Add %type declarations. (objc_inherit_code, objc_public_flag): Remove. (typespec_nonreserved_nonattr): Call objc_get_protocol_qualified_type() instead of get_static_reference() and get_protocol_reference(). (stmt_nocomp): Call grokparm() on @catch parameter. (objcdef): Move semantic action to objc_finish_implementation(). (classdef): Move semantic action to objc_start_class_interface(), objc_continue_interface(), objc_finish_interface(), objc_start_class_implementation(), objc_continue_implementation(), objc_start_category_interface() and objc_start_category_implementation(). (protocoldef): Move semantic actions to objc_start_protocol() and objc_finish_interface(). (ivar_decl_list): Remove nonterminal. (visibility_spec): Move semantic actions to objc_set_visibility(). (ivar_decls): Remove assignment to $$. (ivar_decl): Rephrase in terms of component_decl; call objc_add_instance_variable(). (ivars, ivar_declarator): Remove nonterminals. (opt_semi): New nonterminal. (methodtype): Remove semantic actions. (methoddef): Move semantic actions to objc_set_method_type(), objc_start_method_definition() and objc_finish_method_definition(). (methodproto): Move semantic actions to objc_set_method_type() and objc_add_method_declaration(). (methoddecl): Use objc_typename instead of typename; move semantic actions to objc_build_method_signature(). (optarglist, myxdecls, mydecl, myparms, myparm): Remove nonterminals. (optparmlist): Express in terms of optparms and optellipsis. (optparms, optellipsis, objc_qual, objc_quals, objc_typename): New nonterminals. (keyworddecl): Use objc_typename instead of typename. (rid_to_yy): Mark RID_IN, RID_OUT, RID_INOUT, RID_BYCOPY, RID_BYREF and RID_ONEWAY as returning OBJC_TYPE_QUAL to yyparse(). [gcc/objc/ChangeLog] 2004-09-07 Ziemowit Laski <zlaski@apple.com> * Make-lang.in (objc/objc-parse.o): Depend on $(C_COMMON_H) instead of objc/objc-act.h. (objc/objc-act.o): Depend on $(HASHTAB_H). * objc-act.c: Include hashtab.h; in ObjC++ mode, include cp-tree.h and objcp-decl.h instead of c-tree.h. (build_module_descriptor, get_class_ivars, synth_id_with_class_suffix, error_with_ivar, gen_method_decl, gen_declaration, setup_string_decl, build_protocol_template): Adjust prototypes. (build_module_initializer_routine, start_class, continue_class, finish_class, start_method_def, objc_start_function, start_protocol, build_method_decl, objc_add_method, add_instance_variable, build_ivar_reference, is_ivar, is_private, get_super_receiver, build_selector_table_decl, objc_push_parm, objc_get_parm_info, gen_type_name, gen_type_name_0, start_var_decl, finish_var_decl, create_field_decl): New prototypes. (objc_expand_function_end, comp_method_with_proto, objc_expr_last, gen_declaration_1, gen_declarator, is_complex_decl, adorn_decl, define_decl, create_builtin_decl, gen_declspecs): Remove prototypes. (TYPE_ID): Rename to OBJECT_TYPEDEF_NAME. (CLASS_TYPEDEF_NAME): New. (TAG_EXECCLASS): Change from a global variable to a #define. (TAG_RETURN_STRUCT): Delete. (TAG_GNUINIT): New, holds '__objc_gnu_init' name. (objc_inherit_code, objc_public_flag): New, moved from c-parse.in. (string_descriptor): New struct. (string_htab): New hash table. (string_hash, string_eq): New prototypes. (generate_struct_by_value_array): Call create_field_decl() instead of create_builtin_decl(). (objc_init): Do not initialize objc_ellipsis_node or TAG_EXECCLASS; In ObjC++ mode, call cxx_init() instead of c_objc_common_init(). (objc_finish_file): In ObjC++, call instantiate_pending_templates() and cp_finish_file(). (define_decl, get_static_reference, get_protocol_reference, create_builtin_decl): Remove functions. (objc_start_class_interface, objc_start_category_interface, objc_start_protocol, objc_continue_interface, objc_finish_interface, objc_start_class_implementation, objc_start_category_implementation, objc_continue_implementation, objc_finish_implementation, objc_set_visibility, objc_set_method_type, objc_build_method_signature, objc_add_method_declaration, objc_start_method_definition, objc_add_instance_variable, objc_get_protocol_qualified_type, create_field_decl, start_var_decl, finish_var_decl): New functions. (setup_string_decl): Simplify since it is only called once. (synth_module_prologue): Call build_class_template(); predefine 'id' and 'Class' as typedefs; rename 'temp_type' to 'type'; disable debug hooks for duration of function; fix GNU runtime messenger signatures to correspond to reality; forward-declare '__objc_exec_class' for the GNU runtime; call build_selector_table_decl(); in ObjC++ mode, generate 'extern "C" { ... }' wrappers around synthesized declarations; call build_protocol_template() and build_category_template(). (string_hash, string_eq): New functions. (objc_build_string_object): Check metaclass correctness only once; store string literals in hash table. (objc_build_constructor): Do not convert initializer elements; adjust for ObjC++ impedance mismatch. (build_objc_symtab_template): Call create_field_decl() instead of create_builtin_decl(). (init_objc_symtab): Add missing conversion to initializer element. (build_metadata_decl): Call start_var_decl() instead of define_decl(). (generate_objc_symtab_decl): Do not call build_category_template(); call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(). (build_module_descriptor): Call create_field_decl() instead of grokfield(); call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(); always mark module descriptor as used; move GNU runtime-specific functionality to build_module_initializer_routine(). (build_module_initializer_routine): New function, broken off of build_module_descriptor(). (objc_static_init_needed_p, objc_generate_static_init_call): New functions. (generate_static_references, generate_strings, build_selector_translation_table, generate_descriptor_table, generate_ivars_list, generate_dispatch_table, generate_category): Call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(); build a type directly instead of via groktypename(). (build_selector_reference_decl, build_selector_table_decl, build_class_reference_decl, build_protocol_reference, generate_objc_image_info): Call start_var_decl() instead of build_decl(). (build_selector_reference): For GNU runtime, do not call build_selector_reference_decl(). (build_selector, build_typed_selector_reference): Always convert result to the selector type. (add_objc_string): Cast return value to 'char *'. (build_method_prototype_template, build_selector_template, build_method_template): Use actual selector type for fields pointing to selectors. (finish_objc): For GNU runtime, call build_module_initializer_routine() after build_module_descriptor(). (generate_protocol_list, generate_shared_structures): Call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(); build a type directly instead of via groktypename(). (synth_id_with_class_suffix): Return a string. (get_arg_type_list): For instance methods, use the instance type for 'self'; do not call groktypename_in_parm_context(). (build_objc_string_decl): Squash redeclaration errors in ObjC++. (objc_is_class_name): Use OBJC_TYPE_NAME instead of TYPE_NAME; handle RECORD_TYPEs in ObjC as well as ObjC++. (objc_is_id): New function. (objc_is_object_ptr): Return the canonical type node. (objc_get_class_ivars): Simplify using get_class_ivars(). (get_class_ivars): Remove second parameter; create a fresh copy of the ivar list for each call; do not check for existence of super class. (objc_eh_runtime_type): Mark #ifndef OBJCPLUS. (objc_init_exceptions): When using SJLJ-style exceptions, require the use of '-fobjc-exceptions' flag; do not require it for DWARF-style exceptions. (objc_build_exc_ptr, next_sjlj_build_try_catch_finally): Use objc_object_type instead of objc_id_type. (objc_begin_catch_clause): Convert the incoming PARM_DECL into a VAR_DECL before placing it in the appropriate scope; do not call define_decl(); adjust call to c_begin_compound_stmt(); use objc_object_type instead of objc_id_type. (build_next_objc_exception_stuff): Call create_field_decl() instead of create_builtin_decl(); construct type directly instead of calling groktypename(); use OBJC_VOID_AT_END to mark end of function parameters. (build_private_template): Adjust call to get_class_ivars(); build a type directly instead of via groktypename(). (build_protocol_template, build_method_prototype_list_template, build_method_prototype_template, build_category_template, build_selector_template, build_class_template, build_super_template, build_ivar_template, build_ivar_list_template, build_method_list_template, build_method_template): Call create_field_decl() instead of grokfield(). (objc_method_parm_type): Do not call groktypename(). (generate_descriptor_table): Call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(). (generate_method_descriptors, build_protocol_initializer, generate_dispatch_tables, build_category_initializer, build_shared_structure_initializer): Do not call groktypename(). (generate_protocols): Call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(); do not call groktypename(). (error_with_ivar): Remove last parameter. (check_ivars): Do not iterate ovar CLASS_RAW_IVARS lists in addition to CLASS_IVARS lists; adjust calls to error_with_ivar(). (generate_ivar_lists): Convert one of the initializer elements; do not call groktypename(). (get_arg_type_list, start_method_def, gen_method_def): Account for new representation of variable arguments and '...' in Objective-C methods; add Objective-C++ impedance matching code. (is_objc_type_qualifier): Remove function. (adjust_type_for_id_default): Simplify; there is no longer a need to wade through declspecs. (lookup_interface, start_class, continue_class, finish_class, start_method_def, start_protocol, build_method_decl, objc_add_method, add_instance_variable, build_ivar_reference, is_ivar, is_private, get_super_receiver, objc_build_finally_epilogue): Make into static functions. (receiver_is_class_object): Use new IS_CLASS() macro. (objc_build_message_expr): Tweak ObjC++ message argument handling; call objc_finish_message_expr() instead of finish_message_expr(). (finish_message_expr): Rename to objc_finish_message_expr(); use OBJC_TYPE_NAME and OBJC_SET_TYPE_NAME macros instead of TYPE_NAME. call gen_type_name() instead of gen_declaration(); call objc_is_id() instead of using IS_ID and IS_CLASS; Use objc_class_name instead of calling get_identifier("Class"); handle CONVERT_EXPRs in receiver. (build_objc_method_call, warn_with_method): Do not call groktypename(). (build_ivar_reference): Call convert() instead of clobbering in a type. (hash_init): Initialize string_htab hash table. (add_instance_variable): Simplify parameter list; do not call grokfield(); do not populate CLASS_IVARS list. (start_class): Check for the existence of super class, if one was specified. (continue_class): Use CLASS_RAW_IVARS rather than CLASS_IVARS; do not call build_class_template(); adjust call to get_class_ivars(); call build_decl(), pushdecl() and finish_decl() instead of define_decl(). (finish_class): Call build_decl(), pushdecl() and finish_decl() instead of define_decl(). (add_protocols): Use PROTOCOL_BINFO_ELTS for the tree vector size. (start_protocol): Do not call build_protocol_template(); use PROTOCOL_BINFO_ELTS for the tree vector size. (encode_type_qualifiers): Do not handle the 'const' qualifier here. (encode_pointer): Encode 'const char *' as 'r*', for backwards compatibility. (encode_array): Use HOST_WIDE_INT_PRINT_DEC instead of "%ld". (encode_type): Handle the 'const' qualifier here. (objc_parmlist): New global variable, sued by objc_push_parm and objc_get_parm_info(). (objc_push_parm, objc_get_parm_info): New functions. (objc_expr_last): Remove function. (synth_self_and_ucmd_args): For instance methods, use the instance type for 'self'; call objc_push_parm() instead of push_parm_decl(). (start_method_def): Do not call push_scope(), declare_parm_level(), pop_scope(), push_parm_decl(), store_parm_decls() or objc_expr_last(); just use objc_push_parm() and objc_get_parm_info(). (comp_method_with_proto): Remove function. (objc_types_are_equivalent): Strip away indirections before comparing underlying types. (comp_proto_with_proto): Do not call groktypename(); types are no longer in raw declspec format. (objc_start_function): New function. (really_start_method): Call comp_proto_with_proto() instead of comp_method_with_proto(); call objc_start_function() instead of hand-crafting a function declarator. (continue_method_def, objc_expand_function_end): Remove functions. (get_super_receiver): Call objc_get_current_scope() instead of get_current_scope(); reference 'super_class' field (instead of 'class'). (finish_method_def): Rename to objc_finish_method_definition() and add a function decl parameter; move method encoding call from objc_expand_function_end(). (is_complex_decl, adorn_decl, gen_declarator, gen_declspecs, gen_declaration_1): Remove functions. (tmpbuf, RAW_DECLSPEC): Remove. (gen_declaration): Remove second parameter; simplify to deal with TYPE_P nodes instead of raw declspecs. (gen_type_name, gen_type_name_0): New functions. (gen_method_decl): Remove second parameter; call gen_type_name() instead of gen_declaration_1(). (dump_interface): Adjust calls to gen_declaration() and gen_method_decl(); do not allocate a separate string buffer. (init_objc): Allocate a larger string buffer to accommodate dump_interface(); adjust call to build_module_descriptor(); add call to build_module_initializer_routine() for the GNU runtime. (generate_classref_translation_entry): Do not call start_decl(); call finish_var_decl() instead of finish_decl(); call convert() instead of build_c_cast(). * objc-act.h (CLASS_OWN_IVARS): Remove accessor. (CLASS_BINFO_ELTS): Reduce from 6 to 5, now that CLASS_OWN_IVARS is gone. (OCTI_GNU_INIT_DECL, GNU_INIT_decl): New. (OCTI_ELLIPSIS_NODE, objc_ellipsis_node): Remove. (OCTI_ID_ID, id_type, objc_id_id): Rename to OCTI_ID_NAME, objc_object_type and objc_object_name, respectively. (OCTI_CLS_REF, OCTI_CLASS_NAME, objc_class_reference, objc_class_name): New. (IS_CLASS): New macro. (IS_ID, IS_SUPER): Robustify. (OCTI_EXECCLASS_DECL, execclass_decl): New. (finish_file, start_class, continue_class, finish_class, start_method_def, continue_method_def, finish_method_def, start_protocol, finish_protocol, objc_build_throw_stmt, objc_build_try_catch_finally_stmt, objc_build_synchronized_prologue, objc_build_synchronized_epilogue, objc_build_try_prologue, objc_build_try_epilogue, objc_build_catch_stmt, objc_build_catch_epilogue, objc_build_finally_prologue, objc_build_finally_epilogue, is_ivar, is_private, is_public, add_instance_variable, objc_add_method, get_super_receiver, objc_clear_super_receiver, get_class_ivars_from_name, get_class_reference, get_static_reference, get_object_reference, build_message_expr, finish_message_expr, build_selector_expr, build_ivar_reference, build_keyword_decl, build_method_decl, build_protocol_expr, build_objc_string_object, objc_declare_alias, objc_declare_class, objc_declare_protocols, objc_comptypes, objc_check_decl, build_encode_expr): Remove prototypes. (imp_count, cat_count): Make GGC-aware. (OBJC_SET_TYPE_NAME): New macro. From-SVN: r87168
2004-09-08 02:49:44 +02:00
tree cl_chain, in_chain, type
= build_array_type (build_pointer_type (void_type_node), NULL_TREE);
int num_inst, num_class;
char buf[256];
if (flag_next_runtime)
abort ();
for (cl_chain = objc_static_instances, num_class = 0;
cl_chain; cl_chain = TREE_CHAIN (cl_chain), num_class++)
{
for (num_inst = 0, in_chain = TREE_PURPOSE (cl_chain);
in_chain; num_inst++, in_chain = TREE_CHAIN (in_chain));
sprintf (buf, "_OBJC_STATIC_INSTANCES_%d", num_class);
Makefile.in (c-parse.o): Depend on $(C_COMMON_H). [gcc/ChangeLog] 2004-09-07 Ziemowit Laski <zlaski@apple.com> * Makefile.in (c-parse.o): Depend on $(C_COMMON_H). * c-parse.in: Include c-common.h instead of objc-act.h. (ivar_decl_list, ivar_decls, ivar_decl, ivars, ivar_declarator, myparms, myparm): Remove %type declarations. (methodtype, optparms, OBJC_TYPE_QUAL, objc_quals, objc_qual, objc_typename, objc_try_catch_stmt, optellipsis): Add %type declarations. (objc_inherit_code, objc_public_flag): Remove. (typespec_nonreserved_nonattr): Call objc_get_protocol_qualified_type() instead of get_static_reference() and get_protocol_reference(). (stmt_nocomp): Call grokparm() on @catch parameter. (objcdef): Move semantic action to objc_finish_implementation(). (classdef): Move semantic action to objc_start_class_interface(), objc_continue_interface(), objc_finish_interface(), objc_start_class_implementation(), objc_continue_implementation(), objc_start_category_interface() and objc_start_category_implementation(). (protocoldef): Move semantic actions to objc_start_protocol() and objc_finish_interface(). (ivar_decl_list): Remove nonterminal. (visibility_spec): Move semantic actions to objc_set_visibility(). (ivar_decls): Remove assignment to $$. (ivar_decl): Rephrase in terms of component_decl; call objc_add_instance_variable(). (ivars, ivar_declarator): Remove nonterminals. (opt_semi): New nonterminal. (methodtype): Remove semantic actions. (methoddef): Move semantic actions to objc_set_method_type(), objc_start_method_definition() and objc_finish_method_definition(). (methodproto): Move semantic actions to objc_set_method_type() and objc_add_method_declaration(). (methoddecl): Use objc_typename instead of typename; move semantic actions to objc_build_method_signature(). (optarglist, myxdecls, mydecl, myparms, myparm): Remove nonterminals. (optparmlist): Express in terms of optparms and optellipsis. (optparms, optellipsis, objc_qual, objc_quals, objc_typename): New nonterminals. (keyworddecl): Use objc_typename instead of typename. (rid_to_yy): Mark RID_IN, RID_OUT, RID_INOUT, RID_BYCOPY, RID_BYREF and RID_ONEWAY as returning OBJC_TYPE_QUAL to yyparse(). [gcc/objc/ChangeLog] 2004-09-07 Ziemowit Laski <zlaski@apple.com> * Make-lang.in (objc/objc-parse.o): Depend on $(C_COMMON_H) instead of objc/objc-act.h. (objc/objc-act.o): Depend on $(HASHTAB_H). * objc-act.c: Include hashtab.h; in ObjC++ mode, include cp-tree.h and objcp-decl.h instead of c-tree.h. (build_module_descriptor, get_class_ivars, synth_id_with_class_suffix, error_with_ivar, gen_method_decl, gen_declaration, setup_string_decl, build_protocol_template): Adjust prototypes. (build_module_initializer_routine, start_class, continue_class, finish_class, start_method_def, objc_start_function, start_protocol, build_method_decl, objc_add_method, add_instance_variable, build_ivar_reference, is_ivar, is_private, get_super_receiver, build_selector_table_decl, objc_push_parm, objc_get_parm_info, gen_type_name, gen_type_name_0, start_var_decl, finish_var_decl, create_field_decl): New prototypes. (objc_expand_function_end, comp_method_with_proto, objc_expr_last, gen_declaration_1, gen_declarator, is_complex_decl, adorn_decl, define_decl, create_builtin_decl, gen_declspecs): Remove prototypes. (TYPE_ID): Rename to OBJECT_TYPEDEF_NAME. (CLASS_TYPEDEF_NAME): New. (TAG_EXECCLASS): Change from a global variable to a #define. (TAG_RETURN_STRUCT): Delete. (TAG_GNUINIT): New, holds '__objc_gnu_init' name. (objc_inherit_code, objc_public_flag): New, moved from c-parse.in. (string_descriptor): New struct. (string_htab): New hash table. (string_hash, string_eq): New prototypes. (generate_struct_by_value_array): Call create_field_decl() instead of create_builtin_decl(). (objc_init): Do not initialize objc_ellipsis_node or TAG_EXECCLASS; In ObjC++ mode, call cxx_init() instead of c_objc_common_init(). (objc_finish_file): In ObjC++, call instantiate_pending_templates() and cp_finish_file(). (define_decl, get_static_reference, get_protocol_reference, create_builtin_decl): Remove functions. (objc_start_class_interface, objc_start_category_interface, objc_start_protocol, objc_continue_interface, objc_finish_interface, objc_start_class_implementation, objc_start_category_implementation, objc_continue_implementation, objc_finish_implementation, objc_set_visibility, objc_set_method_type, objc_build_method_signature, objc_add_method_declaration, objc_start_method_definition, objc_add_instance_variable, objc_get_protocol_qualified_type, create_field_decl, start_var_decl, finish_var_decl): New functions. (setup_string_decl): Simplify since it is only called once. (synth_module_prologue): Call build_class_template(); predefine 'id' and 'Class' as typedefs; rename 'temp_type' to 'type'; disable debug hooks for duration of function; fix GNU runtime messenger signatures to correspond to reality; forward-declare '__objc_exec_class' for the GNU runtime; call build_selector_table_decl(); in ObjC++ mode, generate 'extern "C" { ... }' wrappers around synthesized declarations; call build_protocol_template() and build_category_template(). (string_hash, string_eq): New functions. (objc_build_string_object): Check metaclass correctness only once; store string literals in hash table. (objc_build_constructor): Do not convert initializer elements; adjust for ObjC++ impedance mismatch. (build_objc_symtab_template): Call create_field_decl() instead of create_builtin_decl(). (init_objc_symtab): Add missing conversion to initializer element. (build_metadata_decl): Call start_var_decl() instead of define_decl(). (generate_objc_symtab_decl): Do not call build_category_template(); call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(). (build_module_descriptor): Call create_field_decl() instead of grokfield(); call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(); always mark module descriptor as used; move GNU runtime-specific functionality to build_module_initializer_routine(). (build_module_initializer_routine): New function, broken off of build_module_descriptor(). (objc_static_init_needed_p, objc_generate_static_init_call): New functions. (generate_static_references, generate_strings, build_selector_translation_table, generate_descriptor_table, generate_ivars_list, generate_dispatch_table, generate_category): Call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(); build a type directly instead of via groktypename(). (build_selector_reference_decl, build_selector_table_decl, build_class_reference_decl, build_protocol_reference, generate_objc_image_info): Call start_var_decl() instead of build_decl(). (build_selector_reference): For GNU runtime, do not call build_selector_reference_decl(). (build_selector, build_typed_selector_reference): Always convert result to the selector type. (add_objc_string): Cast return value to 'char *'. (build_method_prototype_template, build_selector_template, build_method_template): Use actual selector type for fields pointing to selectors. (finish_objc): For GNU runtime, call build_module_initializer_routine() after build_module_descriptor(). (generate_protocol_list, generate_shared_structures): Call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(); build a type directly instead of via groktypename(). (synth_id_with_class_suffix): Return a string. (get_arg_type_list): For instance methods, use the instance type for 'self'; do not call groktypename_in_parm_context(). (build_objc_string_decl): Squash redeclaration errors in ObjC++. (objc_is_class_name): Use OBJC_TYPE_NAME instead of TYPE_NAME; handle RECORD_TYPEs in ObjC as well as ObjC++. (objc_is_id): New function. (objc_is_object_ptr): Return the canonical type node. (objc_get_class_ivars): Simplify using get_class_ivars(). (get_class_ivars): Remove second parameter; create a fresh copy of the ivar list for each call; do not check for existence of super class. (objc_eh_runtime_type): Mark #ifndef OBJCPLUS. (objc_init_exceptions): When using SJLJ-style exceptions, require the use of '-fobjc-exceptions' flag; do not require it for DWARF-style exceptions. (objc_build_exc_ptr, next_sjlj_build_try_catch_finally): Use objc_object_type instead of objc_id_type. (objc_begin_catch_clause): Convert the incoming PARM_DECL into a VAR_DECL before placing it in the appropriate scope; do not call define_decl(); adjust call to c_begin_compound_stmt(); use objc_object_type instead of objc_id_type. (build_next_objc_exception_stuff): Call create_field_decl() instead of create_builtin_decl(); construct type directly instead of calling groktypename(); use OBJC_VOID_AT_END to mark end of function parameters. (build_private_template): Adjust call to get_class_ivars(); build a type directly instead of via groktypename(). (build_protocol_template, build_method_prototype_list_template, build_method_prototype_template, build_category_template, build_selector_template, build_class_template, build_super_template, build_ivar_template, build_ivar_list_template, build_method_list_template, build_method_template): Call create_field_decl() instead of grokfield(). (objc_method_parm_type): Do not call groktypename(). (generate_descriptor_table): Call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(). (generate_method_descriptors, build_protocol_initializer, generate_dispatch_tables, build_category_initializer, build_shared_structure_initializer): Do not call groktypename(). (generate_protocols): Call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(); do not call groktypename(). (error_with_ivar): Remove last parameter. (check_ivars): Do not iterate ovar CLASS_RAW_IVARS lists in addition to CLASS_IVARS lists; adjust calls to error_with_ivar(). (generate_ivar_lists): Convert one of the initializer elements; do not call groktypename(). (get_arg_type_list, start_method_def, gen_method_def): Account for new representation of variable arguments and '...' in Objective-C methods; add Objective-C++ impedance matching code. (is_objc_type_qualifier): Remove function. (adjust_type_for_id_default): Simplify; there is no longer a need to wade through declspecs. (lookup_interface, start_class, continue_class, finish_class, start_method_def, start_protocol, build_method_decl, objc_add_method, add_instance_variable, build_ivar_reference, is_ivar, is_private, get_super_receiver, objc_build_finally_epilogue): Make into static functions. (receiver_is_class_object): Use new IS_CLASS() macro. (objc_build_message_expr): Tweak ObjC++ message argument handling; call objc_finish_message_expr() instead of finish_message_expr(). (finish_message_expr): Rename to objc_finish_message_expr(); use OBJC_TYPE_NAME and OBJC_SET_TYPE_NAME macros instead of TYPE_NAME. call gen_type_name() instead of gen_declaration(); call objc_is_id() instead of using IS_ID and IS_CLASS; Use objc_class_name instead of calling get_identifier("Class"); handle CONVERT_EXPRs in receiver. (build_objc_method_call, warn_with_method): Do not call groktypename(). (build_ivar_reference): Call convert() instead of clobbering in a type. (hash_init): Initialize string_htab hash table. (add_instance_variable): Simplify parameter list; do not call grokfield(); do not populate CLASS_IVARS list. (start_class): Check for the existence of super class, if one was specified. (continue_class): Use CLASS_RAW_IVARS rather than CLASS_IVARS; do not call build_class_template(); adjust call to get_class_ivars(); call build_decl(), pushdecl() and finish_decl() instead of define_decl(). (finish_class): Call build_decl(), pushdecl() and finish_decl() instead of define_decl(). (add_protocols): Use PROTOCOL_BINFO_ELTS for the tree vector size. (start_protocol): Do not call build_protocol_template(); use PROTOCOL_BINFO_ELTS for the tree vector size. (encode_type_qualifiers): Do not handle the 'const' qualifier here. (encode_pointer): Encode 'const char *' as 'r*', for backwards compatibility. (encode_array): Use HOST_WIDE_INT_PRINT_DEC instead of "%ld". (encode_type): Handle the 'const' qualifier here. (objc_parmlist): New global variable, sued by objc_push_parm and objc_get_parm_info(). (objc_push_parm, objc_get_parm_info): New functions. (objc_expr_last): Remove function. (synth_self_and_ucmd_args): For instance methods, use the instance type for 'self'; call objc_push_parm() instead of push_parm_decl(). (start_method_def): Do not call push_scope(), declare_parm_level(), pop_scope(), push_parm_decl(), store_parm_decls() or objc_expr_last(); just use objc_push_parm() and objc_get_parm_info(). (comp_method_with_proto): Remove function. (objc_types_are_equivalent): Strip away indirections before comparing underlying types. (comp_proto_with_proto): Do not call groktypename(); types are no longer in raw declspec format. (objc_start_function): New function. (really_start_method): Call comp_proto_with_proto() instead of comp_method_with_proto(); call objc_start_function() instead of hand-crafting a function declarator. (continue_method_def, objc_expand_function_end): Remove functions. (get_super_receiver): Call objc_get_current_scope() instead of get_current_scope(); reference 'super_class' field (instead of 'class'). (finish_method_def): Rename to objc_finish_method_definition() and add a function decl parameter; move method encoding call from objc_expand_function_end(). (is_complex_decl, adorn_decl, gen_declarator, gen_declspecs, gen_declaration_1): Remove functions. (tmpbuf, RAW_DECLSPEC): Remove. (gen_declaration): Remove second parameter; simplify to deal with TYPE_P nodes instead of raw declspecs. (gen_type_name, gen_type_name_0): New functions. (gen_method_decl): Remove second parameter; call gen_type_name() instead of gen_declaration_1(). (dump_interface): Adjust calls to gen_declaration() and gen_method_decl(); do not allocate a separate string buffer. (init_objc): Allocate a larger string buffer to accommodate dump_interface(); adjust call to build_module_descriptor(); add call to build_module_initializer_routine() for the GNU runtime. (generate_classref_translation_entry): Do not call start_decl(); call finish_var_decl() instead of finish_decl(); call convert() instead of build_c_cast(). * objc-act.h (CLASS_OWN_IVARS): Remove accessor. (CLASS_BINFO_ELTS): Reduce from 6 to 5, now that CLASS_OWN_IVARS is gone. (OCTI_GNU_INIT_DECL, GNU_INIT_decl): New. (OCTI_ELLIPSIS_NODE, objc_ellipsis_node): Remove. (OCTI_ID_ID, id_type, objc_id_id): Rename to OCTI_ID_NAME, objc_object_type and objc_object_name, respectively. (OCTI_CLS_REF, OCTI_CLASS_NAME, objc_class_reference, objc_class_name): New. (IS_CLASS): New macro. (IS_ID, IS_SUPER): Robustify. (OCTI_EXECCLASS_DECL, execclass_decl): New. (finish_file, start_class, continue_class, finish_class, start_method_def, continue_method_def, finish_method_def, start_protocol, finish_protocol, objc_build_throw_stmt, objc_build_try_catch_finally_stmt, objc_build_synchronized_prologue, objc_build_synchronized_epilogue, objc_build_try_prologue, objc_build_try_epilogue, objc_build_catch_stmt, objc_build_catch_epilogue, objc_build_finally_prologue, objc_build_finally_epilogue, is_ivar, is_private, is_public, add_instance_variable, objc_add_method, get_super_receiver, objc_clear_super_receiver, get_class_ivars_from_name, get_class_reference, get_static_reference, get_object_reference, build_message_expr, finish_message_expr, build_selector_expr, build_ivar_reference, build_keyword_decl, build_method_decl, build_protocol_expr, build_objc_string_object, objc_declare_alias, objc_declare_class, objc_declare_protocols, objc_comptypes, objc_check_decl, build_encode_expr): Remove prototypes. (imp_count, cat_count): Make GGC-aware. (OBJC_SET_TYPE_NAME): New macro. From-SVN: r87168
2004-09-08 02:49:44 +02:00
decl = start_var_decl (type, buf);
/* Output {class_name, ...}. */
class = TREE_VALUE (cl_chain);
class_name = get_objc_string_decl (OBJC_TYPE_NAME (class), class_names);
initlist = build_tree_list (NULL_TREE,
build_unary_op (ADDR_EXPR, class_name, 1));
/* Output {..., instance, ...}. */
for (in_chain = TREE_PURPOSE (cl_chain);
in_chain; in_chain = TREE_CHAIN (in_chain))
{
expr = build_unary_op (ADDR_EXPR, TREE_VALUE (in_chain), 1);
initlist = tree_cons (NULL_TREE, expr, initlist);
}
/* Output {..., NULL}. */
tree.h (build_int_cst): New, sign extended constant. * tree.h (build_int_cst): New, sign extended constant. (build_int_cstu): New, zero extended constant. (build_int_cst_wide): Renamed from build_int_cst. * tree.c (build_int_cst, build_int_cstu): New. (build_int_cst_wide): Renamed from build_int_cst. (make_vector_type, build_common_tree_nodes, build_common_tree_nodes_2): Adjust build_int_cst calls. * builtins.c (expand_builtin_prefetch, expand_builtin_strstr, expand_builtin_strpbrk, expand_builtin_fputs, build_string_literal, expand_builtin_printf, expand_builtin_sprintf, fold_builtin_classify_type, fold_builtin_lround, fold_builtin_bitop, fold_builtin_isascii, fold_builtin_toascii, fold_builtin_isdigit, simplify_builtin_strstr, simplify_builtin_strpbrk, fold_builtin_fputs, simplify_builtin_sprintf): Likewise. * c-common.c (start_fname_decls, fix_string_type, shorten_compare, DEF_ATTR_INT): Likewise. * c-decl.c (complete_array_type, check_bitfield_type_and_width): Likewise. * c-lex.c (interpret_integer, lex_charconst): Likewise. * c-parse.in (primary) <TYPES_COMPATIBLE_P> Likewise. * c-pretty-print.c (pp_c_integer_constant): Likewise. * c-typeck.c (really_start_incremental_init, push_init_level, set_nonincremental_init_from_string): Likewise. * calls.c (load_register_parameters): Likewise. convert.c (convert_to_pointer): Likewise. coverage.c (coverage_counter_alloc, tree_coverage_counter_ref, build_fn_info_type, build_fn_info_value, build_ctr_info_value, build_gcov_info): Likewise. * except.c (init_eh, assign_filter_values): Likewise. * expmed.c (store_fixed_bit_field, extract_bit_field, extract_fixed_bit_field, extract_split_bit_field, expand_shift, expand_mult_const, expand_mult_highpart_adjust, extract_high_half, expand_sdiv_pow2, expand_divmod, make_tree): Likewise. * expr.c (convert_move, emit_group_load, emit_group_store, expand_assignment, store_constructor, store_field, expand_expr_real_1, reduce_to_bit_field_precision): Likewise. fold-const.c (force_fit_type, int_const_binop, fold_convert_const, invert_truthvalue, optimize_bit_field_compare, decode_field_reference, all_ones_mask_p, constant_boolean_node, fold_div_compare, fold, fold_read_from_constant_string, fold_negate_const, fold_abs_const, fold_not_const, round_up, round_down): Likewise. * function.c (assign_parm_setup_block): Likewise. * stmt.c (shift_return_value, expand_case, estimate_case_costs): Likewise. * stor-layout.c (layout_type, initialize_sizetypes, set_min_and_max_values_for_integral_type): Likewise. * tree-chrec.c (chrec_fold_multiply_poly_poly, reset_evolution_in_loop): Likewise. * tree-chrec.h (build_polynomial_chrec): Likewise. * tree-complex.c (build_replicated_const): Likewise. * tree-eh.c (honor_protect_cleanup_actions, lower_try_finally_onedest, lower_try_finally_copy, lower_try_finally_switch): Likewise. * tree-mudflap.c (mf_build_string, mx_register_decls, mudflap_register_call, mudflap_enqueue_constant): Likewise. * tree-nested.c (get_trampoline_type, get_nl_goto_field): Likewise. * tree-pretty-print.c (dump_generic_node): Likewise. * tree-ssa-ccp.c (widen_bitfield, maybe_fold_offset_to_array_ref): Likewise. * tree-ssa-dom.c (simplify_rhs_and_lookup_avail_expr): Likewise. * tree-ssa-loop-niter.c (number_of_iterations_cond, loop_niter_by_eval, upper_bound_in_type, lower_bound_in_type): Likewise. * tree-ssa-loop-ivcanon.c (create_canonical_iv, canonicalize_loop_induction_variables): Likewise. * tree-vectorizer.c (vect_create_index_for_array_ref, vect_transform_loop_bound, vect_compute_data_ref_alignment): Likewise. * config/alpha/alpha.c (alpha_initialize_trampoline, alpha_va_start, alpha_gimplify_va_arg_1): Likewise. * config/arm/arm.c (arm_get_cookie_size): Likewise. * config/c4x/c4x.c (c4x_gimplify_va_arg_expr): Likewise. * config/i386/i386.c (ix86_va_start, ix86_gimplify_va_arg): Likewise. * config/ia64/ia64.c (ia64_gimplify_va_arg): Likewise. * config/mips/mips.c (mips_build_builtin_va_list, mips_va_start, mips_gimplify_va_arg_expr): Likewise. * config/pa/pa.c (hppa_gimplify_va_arg_expr): Likewise. * config/rs6000/rs6000.c (rs6000_va_start, rs6000_gimplify_va_arg, add_compiler_branch_island): Likewise. * config/s390/s390.c (s390_va_start): Likewise. * config/sh/sh.c (sh_va_start): Likewise. * config/stormy16/stormy16.c (xstormy16_expand_builtin_va_start): Likewise. * config/xtensa/xtensa.c (xtensa_va_start, xtensa_gimplify_va_arg_expr): Likewise. * objc/objc-act.c (build_objc_string_object, build_objc_symtab_template, init_def_list, init_objc_symtab, init_module_descriptor, generate_static_references, build_selector_translation_table, get_proto_encoding, build_typed_selector_reference, build_selector_reference, build_next_objc_exception_stuff, build_method_prototype_list_template, generate_descriptor_table, generate_protocols, build_protocol_initializer, build_ivar_list_template, build_method_list_template, build_ivar_list_initializer, generate_ivars_list, generate_dispatch_table, generate_protocol_list, build_category_initializer, build_shared_structure_initializer, generate_shared_structures, handle_impent, generate_objc_image_info): Likewise. 2004-04-25 Paolo Bonzini <bonzini@gnu.org> * cfglayout.c (duplicate_insn_chain): Remove references to NOTE_INSN_LOOP_VTOP and NOTE_INSN_LOOP_CONT. * cfgloop.h (struct loop): Remove fields vtop, cont and cont_dominator. * cfgrtl.c (rtl_delete_block): Remove handling of NOTE_INSN_LOOP_CONT. * final.c (final_scan_insn): Remove references to NOTE_INSN_LOOP_VTOP and NOTE_INSN_LOOP_CONT. * insn-notes.def (NOTE_INSN_LOOP_VTOP, NOTE_INSN_LOOP_CONT): Remove. * jump.c (squeeze_notes): Remove references to NOTE_INSN_LOOP_VTOP and NOTE_INSN_LOOP_CONT. * loop.c (scan_loops, find_and_verify_loops, for_each_insn_in_loop, check_dbra_loop, loop_dump_aux): Remove references to removed notes and fields. * reorg.c (mostly_true_jump): Do not rely on NOTE_INSN_LOOP_VTOPs. * unroll.c (unroll_loop, copy_loop_body, loop_iterations): Remove references to removed notes and fields. (subtract_reg_term, ujump_to_loop_cont): Remove. From-SVN: r86544
2004-08-25 11:52:54 +02:00
initlist = tree_cons (NULL_TREE, build_int_cst (NULL_TREE, 0), initlist);
tree.c (build_constructor): New function. * tree.c (build_constructor): New function. * tree.h: Prototype it. * c-typeck.c (build_c_cast, pop_init_level) * profile.c (build_function_info_value, build_gcov_info_value) (create_profiler): Use build_constructor. * builtins.c (expand_builtin_args_info): Remove #if 0 blocks. * objc/objc-act.c (build_constructor): Rename objc_build_constructor. Use build_constructor. (build_objc_string_object, objc_add_static_instance) (init_def_list, init_objc_symtab, init_module_descriptor) (generate_static_references, build_selector_translation_table) (build_descriptor_table_initializer, generate_descriptor_table) (build_protocol_initializer, build_ivar_list_initializer) (generate_ivars_list, build_dispatch_table_initializer) (generate_dispatch_table, generate_protocol_list) (build_category_initializer, build_shared_structure_initializer): Update to match. ada: * gigi.h, utils2.c (build_constructor): Rename gnat_build_constructor. Use build_constructor. * decl.c (gnat_to_gnu_entity) * trans.c (tree_transform, pos_to_constructor, extract_values) * ada/utils.c (build_template, convert_to_fat_pointer, convert) (unchecked_convert) * ada/utils2.c (build_binary_op, build_call_raise, build_allocator) (fill_vms_descriptor): Update to match. cp: * class.c (initialize_array) * decl.c (reshape_init) * decl2.c (build_expr_from_tree) * init.c (build_zero_init) * pt.c (tsubst_copy, tsubst_copy_and_build) * rtti.c (tinfo_base_init, generic_initializer, ptr_initializer) (ptm_initializer, class_initializer, get_pseudo_ti_init) * semantics.c (finish_compound_literal) * typeck.c (build_ptrmemfunc1) * typeck2.c (store_init_value, process_init_constructor) (build_functional_cast): Use build_constructor. f: * com.c (ffecom_build_complex_constant_, ffecom_expr_) (ffecom_init_zero_, ffecom_transform_namelist_, ffecom_vardesc_) (ffecom_vardesc_array_, ffecom_vardesc_dims_, ffecom_2) * ste.c (ffeste_io_ialist_, ffeste_io_cilist_, ffeste_io_cllist_) (ffeste_io_icilist_, ffeste_io_inlist_, ffeste_io_olist_): Use build_constructor. java: * class.c (make_field_value, make_method_value, get_dispatch_table) (make_class_data, emit_offset_symbol_table) * constants.c (build_constants_constructor) * java-tree.h (START_RECORD_CONSTRUCTOR) * parse.y (maybe_build_array_element_wfl): Use build_constructor. From-SVN: r65539
2003-04-13 03:45:35 +02:00
expr = objc_build_constructor (TREE_TYPE (decl), nreverse (initlist));
Makefile.in (c-parse.o): Depend on $(C_COMMON_H). [gcc/ChangeLog] 2004-09-07 Ziemowit Laski <zlaski@apple.com> * Makefile.in (c-parse.o): Depend on $(C_COMMON_H). * c-parse.in: Include c-common.h instead of objc-act.h. (ivar_decl_list, ivar_decls, ivar_decl, ivars, ivar_declarator, myparms, myparm): Remove %type declarations. (methodtype, optparms, OBJC_TYPE_QUAL, objc_quals, objc_qual, objc_typename, objc_try_catch_stmt, optellipsis): Add %type declarations. (objc_inherit_code, objc_public_flag): Remove. (typespec_nonreserved_nonattr): Call objc_get_protocol_qualified_type() instead of get_static_reference() and get_protocol_reference(). (stmt_nocomp): Call grokparm() on @catch parameter. (objcdef): Move semantic action to objc_finish_implementation(). (classdef): Move semantic action to objc_start_class_interface(), objc_continue_interface(), objc_finish_interface(), objc_start_class_implementation(), objc_continue_implementation(), objc_start_category_interface() and objc_start_category_implementation(). (protocoldef): Move semantic actions to objc_start_protocol() and objc_finish_interface(). (ivar_decl_list): Remove nonterminal. (visibility_spec): Move semantic actions to objc_set_visibility(). (ivar_decls): Remove assignment to $$. (ivar_decl): Rephrase in terms of component_decl; call objc_add_instance_variable(). (ivars, ivar_declarator): Remove nonterminals. (opt_semi): New nonterminal. (methodtype): Remove semantic actions. (methoddef): Move semantic actions to objc_set_method_type(), objc_start_method_definition() and objc_finish_method_definition(). (methodproto): Move semantic actions to objc_set_method_type() and objc_add_method_declaration(). (methoddecl): Use objc_typename instead of typename; move semantic actions to objc_build_method_signature(). (optarglist, myxdecls, mydecl, myparms, myparm): Remove nonterminals. (optparmlist): Express in terms of optparms and optellipsis. (optparms, optellipsis, objc_qual, objc_quals, objc_typename): New nonterminals. (keyworddecl): Use objc_typename instead of typename. (rid_to_yy): Mark RID_IN, RID_OUT, RID_INOUT, RID_BYCOPY, RID_BYREF and RID_ONEWAY as returning OBJC_TYPE_QUAL to yyparse(). [gcc/objc/ChangeLog] 2004-09-07 Ziemowit Laski <zlaski@apple.com> * Make-lang.in (objc/objc-parse.o): Depend on $(C_COMMON_H) instead of objc/objc-act.h. (objc/objc-act.o): Depend on $(HASHTAB_H). * objc-act.c: Include hashtab.h; in ObjC++ mode, include cp-tree.h and objcp-decl.h instead of c-tree.h. (build_module_descriptor, get_class_ivars, synth_id_with_class_suffix, error_with_ivar, gen_method_decl, gen_declaration, setup_string_decl, build_protocol_template): Adjust prototypes. (build_module_initializer_routine, start_class, continue_class, finish_class, start_method_def, objc_start_function, start_protocol, build_method_decl, objc_add_method, add_instance_variable, build_ivar_reference, is_ivar, is_private, get_super_receiver, build_selector_table_decl, objc_push_parm, objc_get_parm_info, gen_type_name, gen_type_name_0, start_var_decl, finish_var_decl, create_field_decl): New prototypes. (objc_expand_function_end, comp_method_with_proto, objc_expr_last, gen_declaration_1, gen_declarator, is_complex_decl, adorn_decl, define_decl, create_builtin_decl, gen_declspecs): Remove prototypes. (TYPE_ID): Rename to OBJECT_TYPEDEF_NAME. (CLASS_TYPEDEF_NAME): New. (TAG_EXECCLASS): Change from a global variable to a #define. (TAG_RETURN_STRUCT): Delete. (TAG_GNUINIT): New, holds '__objc_gnu_init' name. (objc_inherit_code, objc_public_flag): New, moved from c-parse.in. (string_descriptor): New struct. (string_htab): New hash table. (string_hash, string_eq): New prototypes. (generate_struct_by_value_array): Call create_field_decl() instead of create_builtin_decl(). (objc_init): Do not initialize objc_ellipsis_node or TAG_EXECCLASS; In ObjC++ mode, call cxx_init() instead of c_objc_common_init(). (objc_finish_file): In ObjC++, call instantiate_pending_templates() and cp_finish_file(). (define_decl, get_static_reference, get_protocol_reference, create_builtin_decl): Remove functions. (objc_start_class_interface, objc_start_category_interface, objc_start_protocol, objc_continue_interface, objc_finish_interface, objc_start_class_implementation, objc_start_category_implementation, objc_continue_implementation, objc_finish_implementation, objc_set_visibility, objc_set_method_type, objc_build_method_signature, objc_add_method_declaration, objc_start_method_definition, objc_add_instance_variable, objc_get_protocol_qualified_type, create_field_decl, start_var_decl, finish_var_decl): New functions. (setup_string_decl): Simplify since it is only called once. (synth_module_prologue): Call build_class_template(); predefine 'id' and 'Class' as typedefs; rename 'temp_type' to 'type'; disable debug hooks for duration of function; fix GNU runtime messenger signatures to correspond to reality; forward-declare '__objc_exec_class' for the GNU runtime; call build_selector_table_decl(); in ObjC++ mode, generate 'extern "C" { ... }' wrappers around synthesized declarations; call build_protocol_template() and build_category_template(). (string_hash, string_eq): New functions. (objc_build_string_object): Check metaclass correctness only once; store string literals in hash table. (objc_build_constructor): Do not convert initializer elements; adjust for ObjC++ impedance mismatch. (build_objc_symtab_template): Call create_field_decl() instead of create_builtin_decl(). (init_objc_symtab): Add missing conversion to initializer element. (build_metadata_decl): Call start_var_decl() instead of define_decl(). (generate_objc_symtab_decl): Do not call build_category_template(); call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(). (build_module_descriptor): Call create_field_decl() instead of grokfield(); call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(); always mark module descriptor as used; move GNU runtime-specific functionality to build_module_initializer_routine(). (build_module_initializer_routine): New function, broken off of build_module_descriptor(). (objc_static_init_needed_p, objc_generate_static_init_call): New functions. (generate_static_references, generate_strings, build_selector_translation_table, generate_descriptor_table, generate_ivars_list, generate_dispatch_table, generate_category): Call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(); build a type directly instead of via groktypename(). (build_selector_reference_decl, build_selector_table_decl, build_class_reference_decl, build_protocol_reference, generate_objc_image_info): Call start_var_decl() instead of build_decl(). (build_selector_reference): For GNU runtime, do not call build_selector_reference_decl(). (build_selector, build_typed_selector_reference): Always convert result to the selector type. (add_objc_string): Cast return value to 'char *'. (build_method_prototype_template, build_selector_template, build_method_template): Use actual selector type for fields pointing to selectors. (finish_objc): For GNU runtime, call build_module_initializer_routine() after build_module_descriptor(). (generate_protocol_list, generate_shared_structures): Call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(); build a type directly instead of via groktypename(). (synth_id_with_class_suffix): Return a string. (get_arg_type_list): For instance methods, use the instance type for 'self'; do not call groktypename_in_parm_context(). (build_objc_string_decl): Squash redeclaration errors in ObjC++. (objc_is_class_name): Use OBJC_TYPE_NAME instead of TYPE_NAME; handle RECORD_TYPEs in ObjC as well as ObjC++. (objc_is_id): New function. (objc_is_object_ptr): Return the canonical type node. (objc_get_class_ivars): Simplify using get_class_ivars(). (get_class_ivars): Remove second parameter; create a fresh copy of the ivar list for each call; do not check for existence of super class. (objc_eh_runtime_type): Mark #ifndef OBJCPLUS. (objc_init_exceptions): When using SJLJ-style exceptions, require the use of '-fobjc-exceptions' flag; do not require it for DWARF-style exceptions. (objc_build_exc_ptr, next_sjlj_build_try_catch_finally): Use objc_object_type instead of objc_id_type. (objc_begin_catch_clause): Convert the incoming PARM_DECL into a VAR_DECL before placing it in the appropriate scope; do not call define_decl(); adjust call to c_begin_compound_stmt(); use objc_object_type instead of objc_id_type. (build_next_objc_exception_stuff): Call create_field_decl() instead of create_builtin_decl(); construct type directly instead of calling groktypename(); use OBJC_VOID_AT_END to mark end of function parameters. (build_private_template): Adjust call to get_class_ivars(); build a type directly instead of via groktypename(). (build_protocol_template, build_method_prototype_list_template, build_method_prototype_template, build_category_template, build_selector_template, build_class_template, build_super_template, build_ivar_template, build_ivar_list_template, build_method_list_template, build_method_template): Call create_field_decl() instead of grokfield(). (objc_method_parm_type): Do not call groktypename(). (generate_descriptor_table): Call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(). (generate_method_descriptors, build_protocol_initializer, generate_dispatch_tables, build_category_initializer, build_shared_structure_initializer): Do not call groktypename(). (generate_protocols): Call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(); do not call groktypename(). (error_with_ivar): Remove last parameter. (check_ivars): Do not iterate ovar CLASS_RAW_IVARS lists in addition to CLASS_IVARS lists; adjust calls to error_with_ivar(). (generate_ivar_lists): Convert one of the initializer elements; do not call groktypename(). (get_arg_type_list, start_method_def, gen_method_def): Account for new representation of variable arguments and '...' in Objective-C methods; add Objective-C++ impedance matching code. (is_objc_type_qualifier): Remove function. (adjust_type_for_id_default): Simplify; there is no longer a need to wade through declspecs. (lookup_interface, start_class, continue_class, finish_class, start_method_def, start_protocol, build_method_decl, objc_add_method, add_instance_variable, build_ivar_reference, is_ivar, is_private, get_super_receiver, objc_build_finally_epilogue): Make into static functions. (receiver_is_class_object): Use new IS_CLASS() macro. (objc_build_message_expr): Tweak ObjC++ message argument handling; call objc_finish_message_expr() instead of finish_message_expr(). (finish_message_expr): Rename to objc_finish_message_expr(); use OBJC_TYPE_NAME and OBJC_SET_TYPE_NAME macros instead of TYPE_NAME. call gen_type_name() instead of gen_declaration(); call objc_is_id() instead of using IS_ID and IS_CLASS; Use objc_class_name instead of calling get_identifier("Class"); handle CONVERT_EXPRs in receiver. (build_objc_method_call, warn_with_method): Do not call groktypename(). (build_ivar_reference): Call convert() instead of clobbering in a type. (hash_init): Initialize string_htab hash table. (add_instance_variable): Simplify parameter list; do not call grokfield(); do not populate CLASS_IVARS list. (start_class): Check for the existence of super class, if one was specified. (continue_class): Use CLASS_RAW_IVARS rather than CLASS_IVARS; do not call build_class_template(); adjust call to get_class_ivars(); call build_decl(), pushdecl() and finish_decl() instead of define_decl(). (finish_class): Call build_decl(), pushdecl() and finish_decl() instead of define_decl(). (add_protocols): Use PROTOCOL_BINFO_ELTS for the tree vector size. (start_protocol): Do not call build_protocol_template(); use PROTOCOL_BINFO_ELTS for the tree vector size. (encode_type_qualifiers): Do not handle the 'const' qualifier here. (encode_pointer): Encode 'const char *' as 'r*', for backwards compatibility. (encode_array): Use HOST_WIDE_INT_PRINT_DEC instead of "%ld". (encode_type): Handle the 'const' qualifier here. (objc_parmlist): New global variable, sued by objc_push_parm and objc_get_parm_info(). (objc_push_parm, objc_get_parm_info): New functions. (objc_expr_last): Remove function. (synth_self_and_ucmd_args): For instance methods, use the instance type for 'self'; call objc_push_parm() instead of push_parm_decl(). (start_method_def): Do not call push_scope(), declare_parm_level(), pop_scope(), push_parm_decl(), store_parm_decls() or objc_expr_last(); just use objc_push_parm() and objc_get_parm_info(). (comp_method_with_proto): Remove function. (objc_types_are_equivalent): Strip away indirections before comparing underlying types. (comp_proto_with_proto): Do not call groktypename(); types are no longer in raw declspec format. (objc_start_function): New function. (really_start_method): Call comp_proto_with_proto() instead of comp_method_with_proto(); call objc_start_function() instead of hand-crafting a function declarator. (continue_method_def, objc_expand_function_end): Remove functions. (get_super_receiver): Call objc_get_current_scope() instead of get_current_scope(); reference 'super_class' field (instead of 'class'). (finish_method_def): Rename to objc_finish_method_definition() and add a function decl parameter; move method encoding call from objc_expand_function_end(). (is_complex_decl, adorn_decl, gen_declarator, gen_declspecs, gen_declaration_1): Remove functions. (tmpbuf, RAW_DECLSPEC): Remove. (gen_declaration): Remove second parameter; simplify to deal with TYPE_P nodes instead of raw declspecs. (gen_type_name, gen_type_name_0): New functions. (gen_method_decl): Remove second parameter; call gen_type_name() instead of gen_declaration_1(). (dump_interface): Adjust calls to gen_declaration() and gen_method_decl(); do not allocate a separate string buffer. (init_objc): Allocate a larger string buffer to accommodate dump_interface(); adjust call to build_module_descriptor(); add call to build_module_initializer_routine() for the GNU runtime. (generate_classref_translation_entry): Do not call start_decl(); call finish_var_decl() instead of finish_decl(); call convert() instead of build_c_cast(). * objc-act.h (CLASS_OWN_IVARS): Remove accessor. (CLASS_BINFO_ELTS): Reduce from 6 to 5, now that CLASS_OWN_IVARS is gone. (OCTI_GNU_INIT_DECL, GNU_INIT_decl): New. (OCTI_ELLIPSIS_NODE, objc_ellipsis_node): Remove. (OCTI_ID_ID, id_type, objc_id_id): Rename to OCTI_ID_NAME, objc_object_type and objc_object_name, respectively. (OCTI_CLS_REF, OCTI_CLASS_NAME, objc_class_reference, objc_class_name): New. (IS_CLASS): New macro. (IS_ID, IS_SUPER): Robustify. (OCTI_EXECCLASS_DECL, execclass_decl): New. (finish_file, start_class, continue_class, finish_class, start_method_def, continue_method_def, finish_method_def, start_protocol, finish_protocol, objc_build_throw_stmt, objc_build_try_catch_finally_stmt, objc_build_synchronized_prologue, objc_build_synchronized_epilogue, objc_build_try_prologue, objc_build_try_epilogue, objc_build_catch_stmt, objc_build_catch_epilogue, objc_build_finally_prologue, objc_build_finally_epilogue, is_ivar, is_private, is_public, add_instance_variable, objc_add_method, get_super_receiver, objc_clear_super_receiver, get_class_ivars_from_name, get_class_reference, get_static_reference, get_object_reference, build_message_expr, finish_message_expr, build_selector_expr, build_ivar_reference, build_keyword_decl, build_method_decl, build_protocol_expr, build_objc_string_object, objc_declare_alias, objc_declare_class, objc_declare_protocols, objc_comptypes, objc_check_decl, build_encode_expr): Remove prototypes. (imp_count, cat_count): Make GGC-aware. (OBJC_SET_TYPE_NAME): New macro. From-SVN: r87168
2004-09-08 02:49:44 +02:00
finish_var_decl (decl, expr);
decls
= tree_cons (NULL_TREE, build_unary_op (ADDR_EXPR, decl, 1), decls);
}
tree.h (build_int_cst): New, sign extended constant. * tree.h (build_int_cst): New, sign extended constant. (build_int_cstu): New, zero extended constant. (build_int_cst_wide): Renamed from build_int_cst. * tree.c (build_int_cst, build_int_cstu): New. (build_int_cst_wide): Renamed from build_int_cst. (make_vector_type, build_common_tree_nodes, build_common_tree_nodes_2): Adjust build_int_cst calls. * builtins.c (expand_builtin_prefetch, expand_builtin_strstr, expand_builtin_strpbrk, expand_builtin_fputs, build_string_literal, expand_builtin_printf, expand_builtin_sprintf, fold_builtin_classify_type, fold_builtin_lround, fold_builtin_bitop, fold_builtin_isascii, fold_builtin_toascii, fold_builtin_isdigit, simplify_builtin_strstr, simplify_builtin_strpbrk, fold_builtin_fputs, simplify_builtin_sprintf): Likewise. * c-common.c (start_fname_decls, fix_string_type, shorten_compare, DEF_ATTR_INT): Likewise. * c-decl.c (complete_array_type, check_bitfield_type_and_width): Likewise. * c-lex.c (interpret_integer, lex_charconst): Likewise. * c-parse.in (primary) <TYPES_COMPATIBLE_P> Likewise. * c-pretty-print.c (pp_c_integer_constant): Likewise. * c-typeck.c (really_start_incremental_init, push_init_level, set_nonincremental_init_from_string): Likewise. * calls.c (load_register_parameters): Likewise. convert.c (convert_to_pointer): Likewise. coverage.c (coverage_counter_alloc, tree_coverage_counter_ref, build_fn_info_type, build_fn_info_value, build_ctr_info_value, build_gcov_info): Likewise. * except.c (init_eh, assign_filter_values): Likewise. * expmed.c (store_fixed_bit_field, extract_bit_field, extract_fixed_bit_field, extract_split_bit_field, expand_shift, expand_mult_const, expand_mult_highpart_adjust, extract_high_half, expand_sdiv_pow2, expand_divmod, make_tree): Likewise. * expr.c (convert_move, emit_group_load, emit_group_store, expand_assignment, store_constructor, store_field, expand_expr_real_1, reduce_to_bit_field_precision): Likewise. fold-const.c (force_fit_type, int_const_binop, fold_convert_const, invert_truthvalue, optimize_bit_field_compare, decode_field_reference, all_ones_mask_p, constant_boolean_node, fold_div_compare, fold, fold_read_from_constant_string, fold_negate_const, fold_abs_const, fold_not_const, round_up, round_down): Likewise. * function.c (assign_parm_setup_block): Likewise. * stmt.c (shift_return_value, expand_case, estimate_case_costs): Likewise. * stor-layout.c (layout_type, initialize_sizetypes, set_min_and_max_values_for_integral_type): Likewise. * tree-chrec.c (chrec_fold_multiply_poly_poly, reset_evolution_in_loop): Likewise. * tree-chrec.h (build_polynomial_chrec): Likewise. * tree-complex.c (build_replicated_const): Likewise. * tree-eh.c (honor_protect_cleanup_actions, lower_try_finally_onedest, lower_try_finally_copy, lower_try_finally_switch): Likewise. * tree-mudflap.c (mf_build_string, mx_register_decls, mudflap_register_call, mudflap_enqueue_constant): Likewise. * tree-nested.c (get_trampoline_type, get_nl_goto_field): Likewise. * tree-pretty-print.c (dump_generic_node): Likewise. * tree-ssa-ccp.c (widen_bitfield, maybe_fold_offset_to_array_ref): Likewise. * tree-ssa-dom.c (simplify_rhs_and_lookup_avail_expr): Likewise. * tree-ssa-loop-niter.c (number_of_iterations_cond, loop_niter_by_eval, upper_bound_in_type, lower_bound_in_type): Likewise. * tree-ssa-loop-ivcanon.c (create_canonical_iv, canonicalize_loop_induction_variables): Likewise. * tree-vectorizer.c (vect_create_index_for_array_ref, vect_transform_loop_bound, vect_compute_data_ref_alignment): Likewise. * config/alpha/alpha.c (alpha_initialize_trampoline, alpha_va_start, alpha_gimplify_va_arg_1): Likewise. * config/arm/arm.c (arm_get_cookie_size): Likewise. * config/c4x/c4x.c (c4x_gimplify_va_arg_expr): Likewise. * config/i386/i386.c (ix86_va_start, ix86_gimplify_va_arg): Likewise. * config/ia64/ia64.c (ia64_gimplify_va_arg): Likewise. * config/mips/mips.c (mips_build_builtin_va_list, mips_va_start, mips_gimplify_va_arg_expr): Likewise. * config/pa/pa.c (hppa_gimplify_va_arg_expr): Likewise. * config/rs6000/rs6000.c (rs6000_va_start, rs6000_gimplify_va_arg, add_compiler_branch_island): Likewise. * config/s390/s390.c (s390_va_start): Likewise. * config/sh/sh.c (sh_va_start): Likewise. * config/stormy16/stormy16.c (xstormy16_expand_builtin_va_start): Likewise. * config/xtensa/xtensa.c (xtensa_va_start, xtensa_gimplify_va_arg_expr): Likewise. * objc/objc-act.c (build_objc_string_object, build_objc_symtab_template, init_def_list, init_objc_symtab, init_module_descriptor, generate_static_references, build_selector_translation_table, get_proto_encoding, build_typed_selector_reference, build_selector_reference, build_next_objc_exception_stuff, build_method_prototype_list_template, generate_descriptor_table, generate_protocols, build_protocol_initializer, build_ivar_list_template, build_method_list_template, build_ivar_list_initializer, generate_ivars_list, generate_dispatch_table, generate_protocol_list, build_category_initializer, build_shared_structure_initializer, generate_shared_structures, handle_impent, generate_objc_image_info): Likewise. 2004-04-25 Paolo Bonzini <bonzini@gnu.org> * cfglayout.c (duplicate_insn_chain): Remove references to NOTE_INSN_LOOP_VTOP and NOTE_INSN_LOOP_CONT. * cfgloop.h (struct loop): Remove fields vtop, cont and cont_dominator. * cfgrtl.c (rtl_delete_block): Remove handling of NOTE_INSN_LOOP_CONT. * final.c (final_scan_insn): Remove references to NOTE_INSN_LOOP_VTOP and NOTE_INSN_LOOP_CONT. * insn-notes.def (NOTE_INSN_LOOP_VTOP, NOTE_INSN_LOOP_CONT): Remove. * jump.c (squeeze_notes): Remove references to NOTE_INSN_LOOP_VTOP and NOTE_INSN_LOOP_CONT. * loop.c (scan_loops, find_and_verify_loops, for_each_insn_in_loop, check_dbra_loop, loop_dump_aux): Remove references to removed notes and fields. * reorg.c (mostly_true_jump): Do not rely on NOTE_INSN_LOOP_VTOPs. * unroll.c (unroll_loop, copy_loop_body, loop_iterations): Remove references to removed notes and fields. (subtract_reg_term, ujump_to_loop_cont): Remove. From-SVN: r86544
2004-08-25 11:52:54 +02:00
decls = tree_cons (NULL_TREE, build_int_cst (NULL_TREE, 0), decls);
Makefile.in (c-parse.o): Depend on $(C_COMMON_H). [gcc/ChangeLog] 2004-09-07 Ziemowit Laski <zlaski@apple.com> * Makefile.in (c-parse.o): Depend on $(C_COMMON_H). * c-parse.in: Include c-common.h instead of objc-act.h. (ivar_decl_list, ivar_decls, ivar_decl, ivars, ivar_declarator, myparms, myparm): Remove %type declarations. (methodtype, optparms, OBJC_TYPE_QUAL, objc_quals, objc_qual, objc_typename, objc_try_catch_stmt, optellipsis): Add %type declarations. (objc_inherit_code, objc_public_flag): Remove. (typespec_nonreserved_nonattr): Call objc_get_protocol_qualified_type() instead of get_static_reference() and get_protocol_reference(). (stmt_nocomp): Call grokparm() on @catch parameter. (objcdef): Move semantic action to objc_finish_implementation(). (classdef): Move semantic action to objc_start_class_interface(), objc_continue_interface(), objc_finish_interface(), objc_start_class_implementation(), objc_continue_implementation(), objc_start_category_interface() and objc_start_category_implementation(). (protocoldef): Move semantic actions to objc_start_protocol() and objc_finish_interface(). (ivar_decl_list): Remove nonterminal. (visibility_spec): Move semantic actions to objc_set_visibility(). (ivar_decls): Remove assignment to $$. (ivar_decl): Rephrase in terms of component_decl; call objc_add_instance_variable(). (ivars, ivar_declarator): Remove nonterminals. (opt_semi): New nonterminal. (methodtype): Remove semantic actions. (methoddef): Move semantic actions to objc_set_method_type(), objc_start_method_definition() and objc_finish_method_definition(). (methodproto): Move semantic actions to objc_set_method_type() and objc_add_method_declaration(). (methoddecl): Use objc_typename instead of typename; move semantic actions to objc_build_method_signature(). (optarglist, myxdecls, mydecl, myparms, myparm): Remove nonterminals. (optparmlist): Express in terms of optparms and optellipsis. (optparms, optellipsis, objc_qual, objc_quals, objc_typename): New nonterminals. (keyworddecl): Use objc_typename instead of typename. (rid_to_yy): Mark RID_IN, RID_OUT, RID_INOUT, RID_BYCOPY, RID_BYREF and RID_ONEWAY as returning OBJC_TYPE_QUAL to yyparse(). [gcc/objc/ChangeLog] 2004-09-07 Ziemowit Laski <zlaski@apple.com> * Make-lang.in (objc/objc-parse.o): Depend on $(C_COMMON_H) instead of objc/objc-act.h. (objc/objc-act.o): Depend on $(HASHTAB_H). * objc-act.c: Include hashtab.h; in ObjC++ mode, include cp-tree.h and objcp-decl.h instead of c-tree.h. (build_module_descriptor, get_class_ivars, synth_id_with_class_suffix, error_with_ivar, gen_method_decl, gen_declaration, setup_string_decl, build_protocol_template): Adjust prototypes. (build_module_initializer_routine, start_class, continue_class, finish_class, start_method_def, objc_start_function, start_protocol, build_method_decl, objc_add_method, add_instance_variable, build_ivar_reference, is_ivar, is_private, get_super_receiver, build_selector_table_decl, objc_push_parm, objc_get_parm_info, gen_type_name, gen_type_name_0, start_var_decl, finish_var_decl, create_field_decl): New prototypes. (objc_expand_function_end, comp_method_with_proto, objc_expr_last, gen_declaration_1, gen_declarator, is_complex_decl, adorn_decl, define_decl, create_builtin_decl, gen_declspecs): Remove prototypes. (TYPE_ID): Rename to OBJECT_TYPEDEF_NAME. (CLASS_TYPEDEF_NAME): New. (TAG_EXECCLASS): Change from a global variable to a #define. (TAG_RETURN_STRUCT): Delete. (TAG_GNUINIT): New, holds '__objc_gnu_init' name. (objc_inherit_code, objc_public_flag): New, moved from c-parse.in. (string_descriptor): New struct. (string_htab): New hash table. (string_hash, string_eq): New prototypes. (generate_struct_by_value_array): Call create_field_decl() instead of create_builtin_decl(). (objc_init): Do not initialize objc_ellipsis_node or TAG_EXECCLASS; In ObjC++ mode, call cxx_init() instead of c_objc_common_init(). (objc_finish_file): In ObjC++, call instantiate_pending_templates() and cp_finish_file(). (define_decl, get_static_reference, get_protocol_reference, create_builtin_decl): Remove functions. (objc_start_class_interface, objc_start_category_interface, objc_start_protocol, objc_continue_interface, objc_finish_interface, objc_start_class_implementation, objc_start_category_implementation, objc_continue_implementation, objc_finish_implementation, objc_set_visibility, objc_set_method_type, objc_build_method_signature, objc_add_method_declaration, objc_start_method_definition, objc_add_instance_variable, objc_get_protocol_qualified_type, create_field_decl, start_var_decl, finish_var_decl): New functions. (setup_string_decl): Simplify since it is only called once. (synth_module_prologue): Call build_class_template(); predefine 'id' and 'Class' as typedefs; rename 'temp_type' to 'type'; disable debug hooks for duration of function; fix GNU runtime messenger signatures to correspond to reality; forward-declare '__objc_exec_class' for the GNU runtime; call build_selector_table_decl(); in ObjC++ mode, generate 'extern "C" { ... }' wrappers around synthesized declarations; call build_protocol_template() and build_category_template(). (string_hash, string_eq): New functions. (objc_build_string_object): Check metaclass correctness only once; store string literals in hash table. (objc_build_constructor): Do not convert initializer elements; adjust for ObjC++ impedance mismatch. (build_objc_symtab_template): Call create_field_decl() instead of create_builtin_decl(). (init_objc_symtab): Add missing conversion to initializer element. (build_metadata_decl): Call start_var_decl() instead of define_decl(). (generate_objc_symtab_decl): Do not call build_category_template(); call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(). (build_module_descriptor): Call create_field_decl() instead of grokfield(); call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(); always mark module descriptor as used; move GNU runtime-specific functionality to build_module_initializer_routine(). (build_module_initializer_routine): New function, broken off of build_module_descriptor(). (objc_static_init_needed_p, objc_generate_static_init_call): New functions. (generate_static_references, generate_strings, build_selector_translation_table, generate_descriptor_table, generate_ivars_list, generate_dispatch_table, generate_category): Call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(); build a type directly instead of via groktypename(). (build_selector_reference_decl, build_selector_table_decl, build_class_reference_decl, build_protocol_reference, generate_objc_image_info): Call start_var_decl() instead of build_decl(). (build_selector_reference): For GNU runtime, do not call build_selector_reference_decl(). (build_selector, build_typed_selector_reference): Always convert result to the selector type. (add_objc_string): Cast return value to 'char *'. (build_method_prototype_template, build_selector_template, build_method_template): Use actual selector type for fields pointing to selectors. (finish_objc): For GNU runtime, call build_module_initializer_routine() after build_module_descriptor(). (generate_protocol_list, generate_shared_structures): Call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(); build a type directly instead of via groktypename(). (synth_id_with_class_suffix): Return a string. (get_arg_type_list): For instance methods, use the instance type for 'self'; do not call groktypename_in_parm_context(). (build_objc_string_decl): Squash redeclaration errors in ObjC++. (objc_is_class_name): Use OBJC_TYPE_NAME instead of TYPE_NAME; handle RECORD_TYPEs in ObjC as well as ObjC++. (objc_is_id): New function. (objc_is_object_ptr): Return the canonical type node. (objc_get_class_ivars): Simplify using get_class_ivars(). (get_class_ivars): Remove second parameter; create a fresh copy of the ivar list for each call; do not check for existence of super class. (objc_eh_runtime_type): Mark #ifndef OBJCPLUS. (objc_init_exceptions): When using SJLJ-style exceptions, require the use of '-fobjc-exceptions' flag; do not require it for DWARF-style exceptions. (objc_build_exc_ptr, next_sjlj_build_try_catch_finally): Use objc_object_type instead of objc_id_type. (objc_begin_catch_clause): Convert the incoming PARM_DECL into a VAR_DECL before placing it in the appropriate scope; do not call define_decl(); adjust call to c_begin_compound_stmt(); use objc_object_type instead of objc_id_type. (build_next_objc_exception_stuff): Call create_field_decl() instead of create_builtin_decl(); construct type directly instead of calling groktypename(); use OBJC_VOID_AT_END to mark end of function parameters. (build_private_template): Adjust call to get_class_ivars(); build a type directly instead of via groktypename(). (build_protocol_template, build_method_prototype_list_template, build_method_prototype_template, build_category_template, build_selector_template, build_class_template, build_super_template, build_ivar_template, build_ivar_list_template, build_method_list_template, build_method_template): Call create_field_decl() instead of grokfield(). (objc_method_parm_type): Do not call groktypename(). (generate_descriptor_table): Call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(). (generate_method_descriptors, build_protocol_initializer, generate_dispatch_tables, build_category_initializer, build_shared_structure_initializer): Do not call groktypename(). (generate_protocols): Call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(); do not call groktypename(). (error_with_ivar): Remove last parameter. (check_ivars): Do not iterate ovar CLASS_RAW_IVARS lists in addition to CLASS_IVARS lists; adjust calls to error_with_ivar(). (generate_ivar_lists): Convert one of the initializer elements; do not call groktypename(). (get_arg_type_list, start_method_def, gen_method_def): Account for new representation of variable arguments and '...' in Objective-C methods; add Objective-C++ impedance matching code. (is_objc_type_qualifier): Remove function. (adjust_type_for_id_default): Simplify; there is no longer a need to wade through declspecs. (lookup_interface, start_class, continue_class, finish_class, start_method_def, start_protocol, build_method_decl, objc_add_method, add_instance_variable, build_ivar_reference, is_ivar, is_private, get_super_receiver, objc_build_finally_epilogue): Make into static functions. (receiver_is_class_object): Use new IS_CLASS() macro. (objc_build_message_expr): Tweak ObjC++ message argument handling; call objc_finish_message_expr() instead of finish_message_expr(). (finish_message_expr): Rename to objc_finish_message_expr(); use OBJC_TYPE_NAME and OBJC_SET_TYPE_NAME macros instead of TYPE_NAME. call gen_type_name() instead of gen_declaration(); call objc_is_id() instead of using IS_ID and IS_CLASS; Use objc_class_name instead of calling get_identifier("Class"); handle CONVERT_EXPRs in receiver. (build_objc_method_call, warn_with_method): Do not call groktypename(). (build_ivar_reference): Call convert() instead of clobbering in a type. (hash_init): Initialize string_htab hash table. (add_instance_variable): Simplify parameter list; do not call grokfield(); do not populate CLASS_IVARS list. (start_class): Check for the existence of super class, if one was specified. (continue_class): Use CLASS_RAW_IVARS rather than CLASS_IVARS; do not call build_class_template(); adjust call to get_class_ivars(); call build_decl(), pushdecl() and finish_decl() instead of define_decl(). (finish_class): Call build_decl(), pushdecl() and finish_decl() instead of define_decl(). (add_protocols): Use PROTOCOL_BINFO_ELTS for the tree vector size. (start_protocol): Do not call build_protocol_template(); use PROTOCOL_BINFO_ELTS for the tree vector size. (encode_type_qualifiers): Do not handle the 'const' qualifier here. (encode_pointer): Encode 'const char *' as 'r*', for backwards compatibility. (encode_array): Use HOST_WIDE_INT_PRINT_DEC instead of "%ld". (encode_type): Handle the 'const' qualifier here. (objc_parmlist): New global variable, sued by objc_push_parm and objc_get_parm_info(). (objc_push_parm, objc_get_parm_info): New functions. (objc_expr_last): Remove function. (synth_self_and_ucmd_args): For instance methods, use the instance type for 'self'; call objc_push_parm() instead of push_parm_decl(). (start_method_def): Do not call push_scope(), declare_parm_level(), pop_scope(), push_parm_decl(), store_parm_decls() or objc_expr_last(); just use objc_push_parm() and objc_get_parm_info(). (comp_method_with_proto): Remove function. (objc_types_are_equivalent): Strip away indirections before comparing underlying types. (comp_proto_with_proto): Do not call groktypename(); types are no longer in raw declspec format. (objc_start_function): New function. (really_start_method): Call comp_proto_with_proto() instead of comp_method_with_proto(); call objc_start_function() instead of hand-crafting a function declarator. (continue_method_def, objc_expand_function_end): Remove functions. (get_super_receiver): Call objc_get_current_scope() instead of get_current_scope(); reference 'super_class' field (instead of 'class'). (finish_method_def): Rename to objc_finish_method_definition() and add a function decl parameter; move method encoding call from objc_expand_function_end(). (is_complex_decl, adorn_decl, gen_declarator, gen_declspecs, gen_declaration_1): Remove functions. (tmpbuf, RAW_DECLSPEC): Remove. (gen_declaration): Remove second parameter; simplify to deal with TYPE_P nodes instead of raw declspecs. (gen_type_name, gen_type_name_0): New functions. (gen_method_decl): Remove second parameter; call gen_type_name() instead of gen_declaration_1(). (dump_interface): Adjust calls to gen_declaration() and gen_method_decl(); do not allocate a separate string buffer. (init_objc): Allocate a larger string buffer to accommodate dump_interface(); adjust call to build_module_descriptor(); add call to build_module_initializer_routine() for the GNU runtime. (generate_classref_translation_entry): Do not call start_decl(); call finish_var_decl() instead of finish_decl(); call convert() instead of build_c_cast(). * objc-act.h (CLASS_OWN_IVARS): Remove accessor. (CLASS_BINFO_ELTS): Reduce from 6 to 5, now that CLASS_OWN_IVARS is gone. (OCTI_GNU_INIT_DECL, GNU_INIT_decl): New. (OCTI_ELLIPSIS_NODE, objc_ellipsis_node): Remove. (OCTI_ID_ID, id_type, objc_id_id): Rename to OCTI_ID_NAME, objc_object_type and objc_object_name, respectively. (OCTI_CLS_REF, OCTI_CLASS_NAME, objc_class_reference, objc_class_name): New. (IS_CLASS): New macro. (IS_ID, IS_SUPER): Robustify. (OCTI_EXECCLASS_DECL, execclass_decl): New. (finish_file, start_class, continue_class, finish_class, start_method_def, continue_method_def, finish_method_def, start_protocol, finish_protocol, objc_build_throw_stmt, objc_build_try_catch_finally_stmt, objc_build_synchronized_prologue, objc_build_synchronized_epilogue, objc_build_try_prologue, objc_build_try_epilogue, objc_build_catch_stmt, objc_build_catch_epilogue, objc_build_finally_prologue, objc_build_finally_epilogue, is_ivar, is_private, is_public, add_instance_variable, objc_add_method, get_super_receiver, objc_clear_super_receiver, get_class_ivars_from_name, get_class_reference, get_static_reference, get_object_reference, build_message_expr, finish_message_expr, build_selector_expr, build_ivar_reference, build_keyword_decl, build_method_decl, build_protocol_expr, build_objc_string_object, objc_declare_alias, objc_declare_class, objc_declare_protocols, objc_comptypes, objc_check_decl, build_encode_expr): Remove prototypes. (imp_count, cat_count): Make GGC-aware. (OBJC_SET_TYPE_NAME): New macro. From-SVN: r87168
2004-09-08 02:49:44 +02:00
expr = objc_build_constructor (type, nreverse (decls));
static_instances_decl = start_var_decl (type, "_OBJC_STATIC_INSTANCES");
finish_var_decl (static_instances_decl, expr);
}
static GTY(()) int selector_reference_idx;
1992-01-18 00:15:38 +01:00
static tree
build_selector_reference_decl (void)
1992-01-18 00:15:38 +01:00
{
Makefile.in (c-parse.o): Depend on $(C_COMMON_H). [gcc/ChangeLog] 2004-09-07 Ziemowit Laski <zlaski@apple.com> * Makefile.in (c-parse.o): Depend on $(C_COMMON_H). * c-parse.in: Include c-common.h instead of objc-act.h. (ivar_decl_list, ivar_decls, ivar_decl, ivars, ivar_declarator, myparms, myparm): Remove %type declarations. (methodtype, optparms, OBJC_TYPE_QUAL, objc_quals, objc_qual, objc_typename, objc_try_catch_stmt, optellipsis): Add %type declarations. (objc_inherit_code, objc_public_flag): Remove. (typespec_nonreserved_nonattr): Call objc_get_protocol_qualified_type() instead of get_static_reference() and get_protocol_reference(). (stmt_nocomp): Call grokparm() on @catch parameter. (objcdef): Move semantic action to objc_finish_implementation(). (classdef): Move semantic action to objc_start_class_interface(), objc_continue_interface(), objc_finish_interface(), objc_start_class_implementation(), objc_continue_implementation(), objc_start_category_interface() and objc_start_category_implementation(). (protocoldef): Move semantic actions to objc_start_protocol() and objc_finish_interface(). (ivar_decl_list): Remove nonterminal. (visibility_spec): Move semantic actions to objc_set_visibility(). (ivar_decls): Remove assignment to $$. (ivar_decl): Rephrase in terms of component_decl; call objc_add_instance_variable(). (ivars, ivar_declarator): Remove nonterminals. (opt_semi): New nonterminal. (methodtype): Remove semantic actions. (methoddef): Move semantic actions to objc_set_method_type(), objc_start_method_definition() and objc_finish_method_definition(). (methodproto): Move semantic actions to objc_set_method_type() and objc_add_method_declaration(). (methoddecl): Use objc_typename instead of typename; move semantic actions to objc_build_method_signature(). (optarglist, myxdecls, mydecl, myparms, myparm): Remove nonterminals. (optparmlist): Express in terms of optparms and optellipsis. (optparms, optellipsis, objc_qual, objc_quals, objc_typename): New nonterminals. (keyworddecl): Use objc_typename instead of typename. (rid_to_yy): Mark RID_IN, RID_OUT, RID_INOUT, RID_BYCOPY, RID_BYREF and RID_ONEWAY as returning OBJC_TYPE_QUAL to yyparse(). [gcc/objc/ChangeLog] 2004-09-07 Ziemowit Laski <zlaski@apple.com> * Make-lang.in (objc/objc-parse.o): Depend on $(C_COMMON_H) instead of objc/objc-act.h. (objc/objc-act.o): Depend on $(HASHTAB_H). * objc-act.c: Include hashtab.h; in ObjC++ mode, include cp-tree.h and objcp-decl.h instead of c-tree.h. (build_module_descriptor, get_class_ivars, synth_id_with_class_suffix, error_with_ivar, gen_method_decl, gen_declaration, setup_string_decl, build_protocol_template): Adjust prototypes. (build_module_initializer_routine, start_class, continue_class, finish_class, start_method_def, objc_start_function, start_protocol, build_method_decl, objc_add_method, add_instance_variable, build_ivar_reference, is_ivar, is_private, get_super_receiver, build_selector_table_decl, objc_push_parm, objc_get_parm_info, gen_type_name, gen_type_name_0, start_var_decl, finish_var_decl, create_field_decl): New prototypes. (objc_expand_function_end, comp_method_with_proto, objc_expr_last, gen_declaration_1, gen_declarator, is_complex_decl, adorn_decl, define_decl, create_builtin_decl, gen_declspecs): Remove prototypes. (TYPE_ID): Rename to OBJECT_TYPEDEF_NAME. (CLASS_TYPEDEF_NAME): New. (TAG_EXECCLASS): Change from a global variable to a #define. (TAG_RETURN_STRUCT): Delete. (TAG_GNUINIT): New, holds '__objc_gnu_init' name. (objc_inherit_code, objc_public_flag): New, moved from c-parse.in. (string_descriptor): New struct. (string_htab): New hash table. (string_hash, string_eq): New prototypes. (generate_struct_by_value_array): Call create_field_decl() instead of create_builtin_decl(). (objc_init): Do not initialize objc_ellipsis_node or TAG_EXECCLASS; In ObjC++ mode, call cxx_init() instead of c_objc_common_init(). (objc_finish_file): In ObjC++, call instantiate_pending_templates() and cp_finish_file(). (define_decl, get_static_reference, get_protocol_reference, create_builtin_decl): Remove functions. (objc_start_class_interface, objc_start_category_interface, objc_start_protocol, objc_continue_interface, objc_finish_interface, objc_start_class_implementation, objc_start_category_implementation, objc_continue_implementation, objc_finish_implementation, objc_set_visibility, objc_set_method_type, objc_build_method_signature, objc_add_method_declaration, objc_start_method_definition, objc_add_instance_variable, objc_get_protocol_qualified_type, create_field_decl, start_var_decl, finish_var_decl): New functions. (setup_string_decl): Simplify since it is only called once. (synth_module_prologue): Call build_class_template(); predefine 'id' and 'Class' as typedefs; rename 'temp_type' to 'type'; disable debug hooks for duration of function; fix GNU runtime messenger signatures to correspond to reality; forward-declare '__objc_exec_class' for the GNU runtime; call build_selector_table_decl(); in ObjC++ mode, generate 'extern "C" { ... }' wrappers around synthesized declarations; call build_protocol_template() and build_category_template(). (string_hash, string_eq): New functions. (objc_build_string_object): Check metaclass correctness only once; store string literals in hash table. (objc_build_constructor): Do not convert initializer elements; adjust for ObjC++ impedance mismatch. (build_objc_symtab_template): Call create_field_decl() instead of create_builtin_decl(). (init_objc_symtab): Add missing conversion to initializer element. (build_metadata_decl): Call start_var_decl() instead of define_decl(). (generate_objc_symtab_decl): Do not call build_category_template(); call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(). (build_module_descriptor): Call create_field_decl() instead of grokfield(); call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(); always mark module descriptor as used; move GNU runtime-specific functionality to build_module_initializer_routine(). (build_module_initializer_routine): New function, broken off of build_module_descriptor(). (objc_static_init_needed_p, objc_generate_static_init_call): New functions. (generate_static_references, generate_strings, build_selector_translation_table, generate_descriptor_table, generate_ivars_list, generate_dispatch_table, generate_category): Call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(); build a type directly instead of via groktypename(). (build_selector_reference_decl, build_selector_table_decl, build_class_reference_decl, build_protocol_reference, generate_objc_image_info): Call start_var_decl() instead of build_decl(). (build_selector_reference): For GNU runtime, do not call build_selector_reference_decl(). (build_selector, build_typed_selector_reference): Always convert result to the selector type. (add_objc_string): Cast return value to 'char *'. (build_method_prototype_template, build_selector_template, build_method_template): Use actual selector type for fields pointing to selectors. (finish_objc): For GNU runtime, call build_module_initializer_routine() after build_module_descriptor(). (generate_protocol_list, generate_shared_structures): Call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(); build a type directly instead of via groktypename(). (synth_id_with_class_suffix): Return a string. (get_arg_type_list): For instance methods, use the instance type for 'self'; do not call groktypename_in_parm_context(). (build_objc_string_decl): Squash redeclaration errors in ObjC++. (objc_is_class_name): Use OBJC_TYPE_NAME instead of TYPE_NAME; handle RECORD_TYPEs in ObjC as well as ObjC++. (objc_is_id): New function. (objc_is_object_ptr): Return the canonical type node. (objc_get_class_ivars): Simplify using get_class_ivars(). (get_class_ivars): Remove second parameter; create a fresh copy of the ivar list for each call; do not check for existence of super class. (objc_eh_runtime_type): Mark #ifndef OBJCPLUS. (objc_init_exceptions): When using SJLJ-style exceptions, require the use of '-fobjc-exceptions' flag; do not require it for DWARF-style exceptions. (objc_build_exc_ptr, next_sjlj_build_try_catch_finally): Use objc_object_type instead of objc_id_type. (objc_begin_catch_clause): Convert the incoming PARM_DECL into a VAR_DECL before placing it in the appropriate scope; do not call define_decl(); adjust call to c_begin_compound_stmt(); use objc_object_type instead of objc_id_type. (build_next_objc_exception_stuff): Call create_field_decl() instead of create_builtin_decl(); construct type directly instead of calling groktypename(); use OBJC_VOID_AT_END to mark end of function parameters. (build_private_template): Adjust call to get_class_ivars(); build a type directly instead of via groktypename(). (build_protocol_template, build_method_prototype_list_template, build_method_prototype_template, build_category_template, build_selector_template, build_class_template, build_super_template, build_ivar_template, build_ivar_list_template, build_method_list_template, build_method_template): Call create_field_decl() instead of grokfield(). (objc_method_parm_type): Do not call groktypename(). (generate_descriptor_table): Call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(). (generate_method_descriptors, build_protocol_initializer, generate_dispatch_tables, build_category_initializer, build_shared_structure_initializer): Do not call groktypename(). (generate_protocols): Call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(); do not call groktypename(). (error_with_ivar): Remove last parameter. (check_ivars): Do not iterate ovar CLASS_RAW_IVARS lists in addition to CLASS_IVARS lists; adjust calls to error_with_ivar(). (generate_ivar_lists): Convert one of the initializer elements; do not call groktypename(). (get_arg_type_list, start_method_def, gen_method_def): Account for new representation of variable arguments and '...' in Objective-C methods; add Objective-C++ impedance matching code. (is_objc_type_qualifier): Remove function. (adjust_type_for_id_default): Simplify; there is no longer a need to wade through declspecs. (lookup_interface, start_class, continue_class, finish_class, start_method_def, start_protocol, build_method_decl, objc_add_method, add_instance_variable, build_ivar_reference, is_ivar, is_private, get_super_receiver, objc_build_finally_epilogue): Make into static functions. (receiver_is_class_object): Use new IS_CLASS() macro. (objc_build_message_expr): Tweak ObjC++ message argument handling; call objc_finish_message_expr() instead of finish_message_expr(). (finish_message_expr): Rename to objc_finish_message_expr(); use OBJC_TYPE_NAME and OBJC_SET_TYPE_NAME macros instead of TYPE_NAME. call gen_type_name() instead of gen_declaration(); call objc_is_id() instead of using IS_ID and IS_CLASS; Use objc_class_name instead of calling get_identifier("Class"); handle CONVERT_EXPRs in receiver. (build_objc_method_call, warn_with_method): Do not call groktypename(). (build_ivar_reference): Call convert() instead of clobbering in a type. (hash_init): Initialize string_htab hash table. (add_instance_variable): Simplify parameter list; do not call grokfield(); do not populate CLASS_IVARS list. (start_class): Check for the existence of super class, if one was specified. (continue_class): Use CLASS_RAW_IVARS rather than CLASS_IVARS; do not call build_class_template(); adjust call to get_class_ivars(); call build_decl(), pushdecl() and finish_decl() instead of define_decl(). (finish_class): Call build_decl(), pushdecl() and finish_decl() instead of define_decl(). (add_protocols): Use PROTOCOL_BINFO_ELTS for the tree vector size. (start_protocol): Do not call build_protocol_template(); use PROTOCOL_BINFO_ELTS for the tree vector size. (encode_type_qualifiers): Do not handle the 'const' qualifier here. (encode_pointer): Encode 'const char *' as 'r*', for backwards compatibility. (encode_array): Use HOST_WIDE_INT_PRINT_DEC instead of "%ld". (encode_type): Handle the 'const' qualifier here. (objc_parmlist): New global variable, sued by objc_push_parm and objc_get_parm_info(). (objc_push_parm, objc_get_parm_info): New functions. (objc_expr_last): Remove function. (synth_self_and_ucmd_args): For instance methods, use the instance type for 'self'; call objc_push_parm() instead of push_parm_decl(). (start_method_def): Do not call push_scope(), declare_parm_level(), pop_scope(), push_parm_decl(), store_parm_decls() or objc_expr_last(); just use objc_push_parm() and objc_get_parm_info(). (comp_method_with_proto): Remove function. (objc_types_are_equivalent): Strip away indirections before comparing underlying types. (comp_proto_with_proto): Do not call groktypename(); types are no longer in raw declspec format. (objc_start_function): New function. (really_start_method): Call comp_proto_with_proto() instead of comp_method_with_proto(); call objc_start_function() instead of hand-crafting a function declarator. (continue_method_def, objc_expand_function_end): Remove functions. (get_super_receiver): Call objc_get_current_scope() instead of get_current_scope(); reference 'super_class' field (instead of 'class'). (finish_method_def): Rename to objc_finish_method_definition() and add a function decl parameter; move method encoding call from objc_expand_function_end(). (is_complex_decl, adorn_decl, gen_declarator, gen_declspecs, gen_declaration_1): Remove functions. (tmpbuf, RAW_DECLSPEC): Remove. (gen_declaration): Remove second parameter; simplify to deal with TYPE_P nodes instead of raw declspecs. (gen_type_name, gen_type_name_0): New functions. (gen_method_decl): Remove second parameter; call gen_type_name() instead of gen_declaration_1(). (dump_interface): Adjust calls to gen_declaration() and gen_method_decl(); do not allocate a separate string buffer. (init_objc): Allocate a larger string buffer to accommodate dump_interface(); adjust call to build_module_descriptor(); add call to build_module_initializer_routine() for the GNU runtime. (generate_classref_translation_entry): Do not call start_decl(); call finish_var_decl() instead of finish_decl(); call convert() instead of build_c_cast(). * objc-act.h (CLASS_OWN_IVARS): Remove accessor. (CLASS_BINFO_ELTS): Reduce from 6 to 5, now that CLASS_OWN_IVARS is gone. (OCTI_GNU_INIT_DECL, GNU_INIT_decl): New. (OCTI_ELLIPSIS_NODE, objc_ellipsis_node): Remove. (OCTI_ID_ID, id_type, objc_id_id): Rename to OCTI_ID_NAME, objc_object_type and objc_object_name, respectively. (OCTI_CLS_REF, OCTI_CLASS_NAME, objc_class_reference, objc_class_name): New. (IS_CLASS): New macro. (IS_ID, IS_SUPER): Robustify. (OCTI_EXECCLASS_DECL, execclass_decl): New. (finish_file, start_class, continue_class, finish_class, start_method_def, continue_method_def, finish_method_def, start_protocol, finish_protocol, objc_build_throw_stmt, objc_build_try_catch_finally_stmt, objc_build_synchronized_prologue, objc_build_synchronized_epilogue, objc_build_try_prologue, objc_build_try_epilogue, objc_build_catch_stmt, objc_build_catch_epilogue, objc_build_finally_prologue, objc_build_finally_epilogue, is_ivar, is_private, is_public, add_instance_variable, objc_add_method, get_super_receiver, objc_clear_super_receiver, get_class_ivars_from_name, get_class_reference, get_static_reference, get_object_reference, build_message_expr, finish_message_expr, build_selector_expr, build_ivar_reference, build_keyword_decl, build_method_decl, build_protocol_expr, build_objc_string_object, objc_declare_alias, objc_declare_class, objc_declare_protocols, objc_comptypes, objc_check_decl, build_encode_expr): Remove prototypes. (imp_count, cat_count): Make GGC-aware. (OBJC_SET_TYPE_NAME): New macro. From-SVN: r87168
2004-09-08 02:49:44 +02:00
tree decl;
char buf[256];
1992-01-18 00:15:38 +01:00
sprintf (buf, "_OBJC_SELECTOR_REFERENCES_%d", selector_reference_idx++);
Makefile.in (c-parse.o): Depend on $(C_COMMON_H). [gcc/ChangeLog] 2004-09-07 Ziemowit Laski <zlaski@apple.com> * Makefile.in (c-parse.o): Depend on $(C_COMMON_H). * c-parse.in: Include c-common.h instead of objc-act.h. (ivar_decl_list, ivar_decls, ivar_decl, ivars, ivar_declarator, myparms, myparm): Remove %type declarations. (methodtype, optparms, OBJC_TYPE_QUAL, objc_quals, objc_qual, objc_typename, objc_try_catch_stmt, optellipsis): Add %type declarations. (objc_inherit_code, objc_public_flag): Remove. (typespec_nonreserved_nonattr): Call objc_get_protocol_qualified_type() instead of get_static_reference() and get_protocol_reference(). (stmt_nocomp): Call grokparm() on @catch parameter. (objcdef): Move semantic action to objc_finish_implementation(). (classdef): Move semantic action to objc_start_class_interface(), objc_continue_interface(), objc_finish_interface(), objc_start_class_implementation(), objc_continue_implementation(), objc_start_category_interface() and objc_start_category_implementation(). (protocoldef): Move semantic actions to objc_start_protocol() and objc_finish_interface(). (ivar_decl_list): Remove nonterminal. (visibility_spec): Move semantic actions to objc_set_visibility(). (ivar_decls): Remove assignment to $$. (ivar_decl): Rephrase in terms of component_decl; call objc_add_instance_variable(). (ivars, ivar_declarator): Remove nonterminals. (opt_semi): New nonterminal. (methodtype): Remove semantic actions. (methoddef): Move semantic actions to objc_set_method_type(), objc_start_method_definition() and objc_finish_method_definition(). (methodproto): Move semantic actions to objc_set_method_type() and objc_add_method_declaration(). (methoddecl): Use objc_typename instead of typename; move semantic actions to objc_build_method_signature(). (optarglist, myxdecls, mydecl, myparms, myparm): Remove nonterminals. (optparmlist): Express in terms of optparms and optellipsis. (optparms, optellipsis, objc_qual, objc_quals, objc_typename): New nonterminals. (keyworddecl): Use objc_typename instead of typename. (rid_to_yy): Mark RID_IN, RID_OUT, RID_INOUT, RID_BYCOPY, RID_BYREF and RID_ONEWAY as returning OBJC_TYPE_QUAL to yyparse(). [gcc/objc/ChangeLog] 2004-09-07 Ziemowit Laski <zlaski@apple.com> * Make-lang.in (objc/objc-parse.o): Depend on $(C_COMMON_H) instead of objc/objc-act.h. (objc/objc-act.o): Depend on $(HASHTAB_H). * objc-act.c: Include hashtab.h; in ObjC++ mode, include cp-tree.h and objcp-decl.h instead of c-tree.h. (build_module_descriptor, get_class_ivars, synth_id_with_class_suffix, error_with_ivar, gen_method_decl, gen_declaration, setup_string_decl, build_protocol_template): Adjust prototypes. (build_module_initializer_routine, start_class, continue_class, finish_class, start_method_def, objc_start_function, start_protocol, build_method_decl, objc_add_method, add_instance_variable, build_ivar_reference, is_ivar, is_private, get_super_receiver, build_selector_table_decl, objc_push_parm, objc_get_parm_info, gen_type_name, gen_type_name_0, start_var_decl, finish_var_decl, create_field_decl): New prototypes. (objc_expand_function_end, comp_method_with_proto, objc_expr_last, gen_declaration_1, gen_declarator, is_complex_decl, adorn_decl, define_decl, create_builtin_decl, gen_declspecs): Remove prototypes. (TYPE_ID): Rename to OBJECT_TYPEDEF_NAME. (CLASS_TYPEDEF_NAME): New. (TAG_EXECCLASS): Change from a global variable to a #define. (TAG_RETURN_STRUCT): Delete. (TAG_GNUINIT): New, holds '__objc_gnu_init' name. (objc_inherit_code, objc_public_flag): New, moved from c-parse.in. (string_descriptor): New struct. (string_htab): New hash table. (string_hash, string_eq): New prototypes. (generate_struct_by_value_array): Call create_field_decl() instead of create_builtin_decl(). (objc_init): Do not initialize objc_ellipsis_node or TAG_EXECCLASS; In ObjC++ mode, call cxx_init() instead of c_objc_common_init(). (objc_finish_file): In ObjC++, call instantiate_pending_templates() and cp_finish_file(). (define_decl, get_static_reference, get_protocol_reference, create_builtin_decl): Remove functions. (objc_start_class_interface, objc_start_category_interface, objc_start_protocol, objc_continue_interface, objc_finish_interface, objc_start_class_implementation, objc_start_category_implementation, objc_continue_implementation, objc_finish_implementation, objc_set_visibility, objc_set_method_type, objc_build_method_signature, objc_add_method_declaration, objc_start_method_definition, objc_add_instance_variable, objc_get_protocol_qualified_type, create_field_decl, start_var_decl, finish_var_decl): New functions. (setup_string_decl): Simplify since it is only called once. (synth_module_prologue): Call build_class_template(); predefine 'id' and 'Class' as typedefs; rename 'temp_type' to 'type'; disable debug hooks for duration of function; fix GNU runtime messenger signatures to correspond to reality; forward-declare '__objc_exec_class' for the GNU runtime; call build_selector_table_decl(); in ObjC++ mode, generate 'extern "C" { ... }' wrappers around synthesized declarations; call build_protocol_template() and build_category_template(). (string_hash, string_eq): New functions. (objc_build_string_object): Check metaclass correctness only once; store string literals in hash table. (objc_build_constructor): Do not convert initializer elements; adjust for ObjC++ impedance mismatch. (build_objc_symtab_template): Call create_field_decl() instead of create_builtin_decl(). (init_objc_symtab): Add missing conversion to initializer element. (build_metadata_decl): Call start_var_decl() instead of define_decl(). (generate_objc_symtab_decl): Do not call build_category_template(); call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(). (build_module_descriptor): Call create_field_decl() instead of grokfield(); call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(); always mark module descriptor as used; move GNU runtime-specific functionality to build_module_initializer_routine(). (build_module_initializer_routine): New function, broken off of build_module_descriptor(). (objc_static_init_needed_p, objc_generate_static_init_call): New functions. (generate_static_references, generate_strings, build_selector_translation_table, generate_descriptor_table, generate_ivars_list, generate_dispatch_table, generate_category): Call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(); build a type directly instead of via groktypename(). (build_selector_reference_decl, build_selector_table_decl, build_class_reference_decl, build_protocol_reference, generate_objc_image_info): Call start_var_decl() instead of build_decl(). (build_selector_reference): For GNU runtime, do not call build_selector_reference_decl(). (build_selector, build_typed_selector_reference): Always convert result to the selector type. (add_objc_string): Cast return value to 'char *'. (build_method_prototype_template, build_selector_template, build_method_template): Use actual selector type for fields pointing to selectors. (finish_objc): For GNU runtime, call build_module_initializer_routine() after build_module_descriptor(). (generate_protocol_list, generate_shared_structures): Call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(); build a type directly instead of via groktypename(). (synth_id_with_class_suffix): Return a string. (get_arg_type_list): For instance methods, use the instance type for 'self'; do not call groktypename_in_parm_context(). (build_objc_string_decl): Squash redeclaration errors in ObjC++. (objc_is_class_name): Use OBJC_TYPE_NAME instead of TYPE_NAME; handle RECORD_TYPEs in ObjC as well as ObjC++. (objc_is_id): New function. (objc_is_object_ptr): Return the canonical type node. (objc_get_class_ivars): Simplify using get_class_ivars(). (get_class_ivars): Remove second parameter; create a fresh copy of the ivar list for each call; do not check for existence of super class. (objc_eh_runtime_type): Mark #ifndef OBJCPLUS. (objc_init_exceptions): When using SJLJ-style exceptions, require the use of '-fobjc-exceptions' flag; do not require it for DWARF-style exceptions. (objc_build_exc_ptr, next_sjlj_build_try_catch_finally): Use objc_object_type instead of objc_id_type. (objc_begin_catch_clause): Convert the incoming PARM_DECL into a VAR_DECL before placing it in the appropriate scope; do not call define_decl(); adjust call to c_begin_compound_stmt(); use objc_object_type instead of objc_id_type. (build_next_objc_exception_stuff): Call create_field_decl() instead of create_builtin_decl(); construct type directly instead of calling groktypename(); use OBJC_VOID_AT_END to mark end of function parameters. (build_private_template): Adjust call to get_class_ivars(); build a type directly instead of via groktypename(). (build_protocol_template, build_method_prototype_list_template, build_method_prototype_template, build_category_template, build_selector_template, build_class_template, build_super_template, build_ivar_template, build_ivar_list_template, build_method_list_template, build_method_template): Call create_field_decl() instead of grokfield(). (objc_method_parm_type): Do not call groktypename(). (generate_descriptor_table): Call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(). (generate_method_descriptors, build_protocol_initializer, generate_dispatch_tables, build_category_initializer, build_shared_structure_initializer): Do not call groktypename(). (generate_protocols): Call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(); do not call groktypename(). (error_with_ivar): Remove last parameter. (check_ivars): Do not iterate ovar CLASS_RAW_IVARS lists in addition to CLASS_IVARS lists; adjust calls to error_with_ivar(). (generate_ivar_lists): Convert one of the initializer elements; do not call groktypename(). (get_arg_type_list, start_method_def, gen_method_def): Account for new representation of variable arguments and '...' in Objective-C methods; add Objective-C++ impedance matching code. (is_objc_type_qualifier): Remove function. (adjust_type_for_id_default): Simplify; there is no longer a need to wade through declspecs. (lookup_interface, start_class, continue_class, finish_class, start_method_def, start_protocol, build_method_decl, objc_add_method, add_instance_variable, build_ivar_reference, is_ivar, is_private, get_super_receiver, objc_build_finally_epilogue): Make into static functions. (receiver_is_class_object): Use new IS_CLASS() macro. (objc_build_message_expr): Tweak ObjC++ message argument handling; call objc_finish_message_expr() instead of finish_message_expr(). (finish_message_expr): Rename to objc_finish_message_expr(); use OBJC_TYPE_NAME and OBJC_SET_TYPE_NAME macros instead of TYPE_NAME. call gen_type_name() instead of gen_declaration(); call objc_is_id() instead of using IS_ID and IS_CLASS; Use objc_class_name instead of calling get_identifier("Class"); handle CONVERT_EXPRs in receiver. (build_objc_method_call, warn_with_method): Do not call groktypename(). (build_ivar_reference): Call convert() instead of clobbering in a type. (hash_init): Initialize string_htab hash table. (add_instance_variable): Simplify parameter list; do not call grokfield(); do not populate CLASS_IVARS list. (start_class): Check for the existence of super class, if one was specified. (continue_class): Use CLASS_RAW_IVARS rather than CLASS_IVARS; do not call build_class_template(); adjust call to get_class_ivars(); call build_decl(), pushdecl() and finish_decl() instead of define_decl(). (finish_class): Call build_decl(), pushdecl() and finish_decl() instead of define_decl(). (add_protocols): Use PROTOCOL_BINFO_ELTS for the tree vector size. (start_protocol): Do not call build_protocol_template(); use PROTOCOL_BINFO_ELTS for the tree vector size. (encode_type_qualifiers): Do not handle the 'const' qualifier here. (encode_pointer): Encode 'const char *' as 'r*', for backwards compatibility. (encode_array): Use HOST_WIDE_INT_PRINT_DEC instead of "%ld". (encode_type): Handle the 'const' qualifier here. (objc_parmlist): New global variable, sued by objc_push_parm and objc_get_parm_info(). (objc_push_parm, objc_get_parm_info): New functions. (objc_expr_last): Remove function. (synth_self_and_ucmd_args): For instance methods, use the instance type for 'self'; call objc_push_parm() instead of push_parm_decl(). (start_method_def): Do not call push_scope(), declare_parm_level(), pop_scope(), push_parm_decl(), store_parm_decls() or objc_expr_last(); just use objc_push_parm() and objc_get_parm_info(). (comp_method_with_proto): Remove function. (objc_types_are_equivalent): Strip away indirections before comparing underlying types. (comp_proto_with_proto): Do not call groktypename(); types are no longer in raw declspec format. (objc_start_function): New function. (really_start_method): Call comp_proto_with_proto() instead of comp_method_with_proto(); call objc_start_function() instead of hand-crafting a function declarator. (continue_method_def, objc_expand_function_end): Remove functions. (get_super_receiver): Call objc_get_current_scope() instead of get_current_scope(); reference 'super_class' field (instead of 'class'). (finish_method_def): Rename to objc_finish_method_definition() and add a function decl parameter; move method encoding call from objc_expand_function_end(). (is_complex_decl, adorn_decl, gen_declarator, gen_declspecs, gen_declaration_1): Remove functions. (tmpbuf, RAW_DECLSPEC): Remove. (gen_declaration): Remove second parameter; simplify to deal with TYPE_P nodes instead of raw declspecs. (gen_type_name, gen_type_name_0): New functions. (gen_method_decl): Remove second parameter; call gen_type_name() instead of gen_declaration_1(). (dump_interface): Adjust calls to gen_declaration() and gen_method_decl(); do not allocate a separate string buffer. (init_objc): Allocate a larger string buffer to accommodate dump_interface(); adjust call to build_module_descriptor(); add call to build_module_initializer_routine() for the GNU runtime. (generate_classref_translation_entry): Do not call start_decl(); call finish_var_decl() instead of finish_decl(); call convert() instead of build_c_cast(). * objc-act.h (CLASS_OWN_IVARS): Remove accessor. (CLASS_BINFO_ELTS): Reduce from 6 to 5, now that CLASS_OWN_IVARS is gone. (OCTI_GNU_INIT_DECL, GNU_INIT_decl): New. (OCTI_ELLIPSIS_NODE, objc_ellipsis_node): Remove. (OCTI_ID_ID, id_type, objc_id_id): Rename to OCTI_ID_NAME, objc_object_type and objc_object_name, respectively. (OCTI_CLS_REF, OCTI_CLASS_NAME, objc_class_reference, objc_class_name): New. (IS_CLASS): New macro. (IS_ID, IS_SUPER): Robustify. (OCTI_EXECCLASS_DECL, execclass_decl): New. (finish_file, start_class, continue_class, finish_class, start_method_def, continue_method_def, finish_method_def, start_protocol, finish_protocol, objc_build_throw_stmt, objc_build_try_catch_finally_stmt, objc_build_synchronized_prologue, objc_build_synchronized_epilogue, objc_build_try_prologue, objc_build_try_epilogue, objc_build_catch_stmt, objc_build_catch_epilogue, objc_build_finally_prologue, objc_build_finally_epilogue, is_ivar, is_private, is_public, add_instance_variable, objc_add_method, get_super_receiver, objc_clear_super_receiver, get_class_ivars_from_name, get_class_reference, get_static_reference, get_object_reference, build_message_expr, finish_message_expr, build_selector_expr, build_ivar_reference, build_keyword_decl, build_method_decl, build_protocol_expr, build_objc_string_object, objc_declare_alias, objc_declare_class, objc_declare_protocols, objc_comptypes, objc_check_decl, build_encode_expr): Remove prototypes. (imp_count, cat_count): Make GGC-aware. (OBJC_SET_TYPE_NAME): New macro. From-SVN: r87168
2004-09-08 02:49:44 +02:00
decl = start_var_decl (objc_selector_type, buf);
1992-01-18 00:15:38 +01:00
Makefile.in (c-parse.o): Depend on $(C_COMMON_H). [gcc/ChangeLog] 2004-09-07 Ziemowit Laski <zlaski@apple.com> * Makefile.in (c-parse.o): Depend on $(C_COMMON_H). * c-parse.in: Include c-common.h instead of objc-act.h. (ivar_decl_list, ivar_decls, ivar_decl, ivars, ivar_declarator, myparms, myparm): Remove %type declarations. (methodtype, optparms, OBJC_TYPE_QUAL, objc_quals, objc_qual, objc_typename, objc_try_catch_stmt, optellipsis): Add %type declarations. (objc_inherit_code, objc_public_flag): Remove. (typespec_nonreserved_nonattr): Call objc_get_protocol_qualified_type() instead of get_static_reference() and get_protocol_reference(). (stmt_nocomp): Call grokparm() on @catch parameter. (objcdef): Move semantic action to objc_finish_implementation(). (classdef): Move semantic action to objc_start_class_interface(), objc_continue_interface(), objc_finish_interface(), objc_start_class_implementation(), objc_continue_implementation(), objc_start_category_interface() and objc_start_category_implementation(). (protocoldef): Move semantic actions to objc_start_protocol() and objc_finish_interface(). (ivar_decl_list): Remove nonterminal. (visibility_spec): Move semantic actions to objc_set_visibility(). (ivar_decls): Remove assignment to $$. (ivar_decl): Rephrase in terms of component_decl; call objc_add_instance_variable(). (ivars, ivar_declarator): Remove nonterminals. (opt_semi): New nonterminal. (methodtype): Remove semantic actions. (methoddef): Move semantic actions to objc_set_method_type(), objc_start_method_definition() and objc_finish_method_definition(). (methodproto): Move semantic actions to objc_set_method_type() and objc_add_method_declaration(). (methoddecl): Use objc_typename instead of typename; move semantic actions to objc_build_method_signature(). (optarglist, myxdecls, mydecl, myparms, myparm): Remove nonterminals. (optparmlist): Express in terms of optparms and optellipsis. (optparms, optellipsis, objc_qual, objc_quals, objc_typename): New nonterminals. (keyworddecl): Use objc_typename instead of typename. (rid_to_yy): Mark RID_IN, RID_OUT, RID_INOUT, RID_BYCOPY, RID_BYREF and RID_ONEWAY as returning OBJC_TYPE_QUAL to yyparse(). [gcc/objc/ChangeLog] 2004-09-07 Ziemowit Laski <zlaski@apple.com> * Make-lang.in (objc/objc-parse.o): Depend on $(C_COMMON_H) instead of objc/objc-act.h. (objc/objc-act.o): Depend on $(HASHTAB_H). * objc-act.c: Include hashtab.h; in ObjC++ mode, include cp-tree.h and objcp-decl.h instead of c-tree.h. (build_module_descriptor, get_class_ivars, synth_id_with_class_suffix, error_with_ivar, gen_method_decl, gen_declaration, setup_string_decl, build_protocol_template): Adjust prototypes. (build_module_initializer_routine, start_class, continue_class, finish_class, start_method_def, objc_start_function, start_protocol, build_method_decl, objc_add_method, add_instance_variable, build_ivar_reference, is_ivar, is_private, get_super_receiver, build_selector_table_decl, objc_push_parm, objc_get_parm_info, gen_type_name, gen_type_name_0, start_var_decl, finish_var_decl, create_field_decl): New prototypes. (objc_expand_function_end, comp_method_with_proto, objc_expr_last, gen_declaration_1, gen_declarator, is_complex_decl, adorn_decl, define_decl, create_builtin_decl, gen_declspecs): Remove prototypes. (TYPE_ID): Rename to OBJECT_TYPEDEF_NAME. (CLASS_TYPEDEF_NAME): New. (TAG_EXECCLASS): Change from a global variable to a #define. (TAG_RETURN_STRUCT): Delete. (TAG_GNUINIT): New, holds '__objc_gnu_init' name. (objc_inherit_code, objc_public_flag): New, moved from c-parse.in. (string_descriptor): New struct. (string_htab): New hash table. (string_hash, string_eq): New prototypes. (generate_struct_by_value_array): Call create_field_decl() instead of create_builtin_decl(). (objc_init): Do not initialize objc_ellipsis_node or TAG_EXECCLASS; In ObjC++ mode, call cxx_init() instead of c_objc_common_init(). (objc_finish_file): In ObjC++, call instantiate_pending_templates() and cp_finish_file(). (define_decl, get_static_reference, get_protocol_reference, create_builtin_decl): Remove functions. (objc_start_class_interface, objc_start_category_interface, objc_start_protocol, objc_continue_interface, objc_finish_interface, objc_start_class_implementation, objc_start_category_implementation, objc_continue_implementation, objc_finish_implementation, objc_set_visibility, objc_set_method_type, objc_build_method_signature, objc_add_method_declaration, objc_start_method_definition, objc_add_instance_variable, objc_get_protocol_qualified_type, create_field_decl, start_var_decl, finish_var_decl): New functions. (setup_string_decl): Simplify since it is only called once. (synth_module_prologue): Call build_class_template(); predefine 'id' and 'Class' as typedefs; rename 'temp_type' to 'type'; disable debug hooks for duration of function; fix GNU runtime messenger signatures to correspond to reality; forward-declare '__objc_exec_class' for the GNU runtime; call build_selector_table_decl(); in ObjC++ mode, generate 'extern "C" { ... }' wrappers around synthesized declarations; call build_protocol_template() and build_category_template(). (string_hash, string_eq): New functions. (objc_build_string_object): Check metaclass correctness only once; store string literals in hash table. (objc_build_constructor): Do not convert initializer elements; adjust for ObjC++ impedance mismatch. (build_objc_symtab_template): Call create_field_decl() instead of create_builtin_decl(). (init_objc_symtab): Add missing conversion to initializer element. (build_metadata_decl): Call start_var_decl() instead of define_decl(). (generate_objc_symtab_decl): Do not call build_category_template(); call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(). (build_module_descriptor): Call create_field_decl() instead of grokfield(); call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(); always mark module descriptor as used; move GNU runtime-specific functionality to build_module_initializer_routine(). (build_module_initializer_routine): New function, broken off of build_module_descriptor(). (objc_static_init_needed_p, objc_generate_static_init_call): New functions. (generate_static_references, generate_strings, build_selector_translation_table, generate_descriptor_table, generate_ivars_list, generate_dispatch_table, generate_category): Call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(); build a type directly instead of via groktypename(). (build_selector_reference_decl, build_selector_table_decl, build_class_reference_decl, build_protocol_reference, generate_objc_image_info): Call start_var_decl() instead of build_decl(). (build_selector_reference): For GNU runtime, do not call build_selector_reference_decl(). (build_selector, build_typed_selector_reference): Always convert result to the selector type. (add_objc_string): Cast return value to 'char *'. (build_method_prototype_template, build_selector_template, build_method_template): Use actual selector type for fields pointing to selectors. (finish_objc): For GNU runtime, call build_module_initializer_routine() after build_module_descriptor(). (generate_protocol_list, generate_shared_structures): Call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(); build a type directly instead of via groktypename(). (synth_id_with_class_suffix): Return a string. (get_arg_type_list): For instance methods, use the instance type for 'self'; do not call groktypename_in_parm_context(). (build_objc_string_decl): Squash redeclaration errors in ObjC++. (objc_is_class_name): Use OBJC_TYPE_NAME instead of TYPE_NAME; handle RECORD_TYPEs in ObjC as well as ObjC++. (objc_is_id): New function. (objc_is_object_ptr): Return the canonical type node. (objc_get_class_ivars): Simplify using get_class_ivars(). (get_class_ivars): Remove second parameter; create a fresh copy of the ivar list for each call; do not check for existence of super class. (objc_eh_runtime_type): Mark #ifndef OBJCPLUS. (objc_init_exceptions): When using SJLJ-style exceptions, require the use of '-fobjc-exceptions' flag; do not require it for DWARF-style exceptions. (objc_build_exc_ptr, next_sjlj_build_try_catch_finally): Use objc_object_type instead of objc_id_type. (objc_begin_catch_clause): Convert the incoming PARM_DECL into a VAR_DECL before placing it in the appropriate scope; do not call define_decl(); adjust call to c_begin_compound_stmt(); use objc_object_type instead of objc_id_type. (build_next_objc_exception_stuff): Call create_field_decl() instead of create_builtin_decl(); construct type directly instead of calling groktypename(); use OBJC_VOID_AT_END to mark end of function parameters. (build_private_template): Adjust call to get_class_ivars(); build a type directly instead of via groktypename(). (build_protocol_template, build_method_prototype_list_template, build_method_prototype_template, build_category_template, build_selector_template, build_class_template, build_super_template, build_ivar_template, build_ivar_list_template, build_method_list_template, build_method_template): Call create_field_decl() instead of grokfield(). (objc_method_parm_type): Do not call groktypename(). (generate_descriptor_table): Call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(). (generate_method_descriptors, build_protocol_initializer, generate_dispatch_tables, build_category_initializer, build_shared_structure_initializer): Do not call groktypename(). (generate_protocols): Call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(); do not call groktypename(). (error_with_ivar): Remove last parameter. (check_ivars): Do not iterate ovar CLASS_RAW_IVARS lists in addition to CLASS_IVARS lists; adjust calls to error_with_ivar(). (generate_ivar_lists): Convert one of the initializer elements; do not call groktypename(). (get_arg_type_list, start_method_def, gen_method_def): Account for new representation of variable arguments and '...' in Objective-C methods; add Objective-C++ impedance matching code. (is_objc_type_qualifier): Remove function. (adjust_type_for_id_default): Simplify; there is no longer a need to wade through declspecs. (lookup_interface, start_class, continue_class, finish_class, start_method_def, start_protocol, build_method_decl, objc_add_method, add_instance_variable, build_ivar_reference, is_ivar, is_private, get_super_receiver, objc_build_finally_epilogue): Make into static functions. (receiver_is_class_object): Use new IS_CLASS() macro. (objc_build_message_expr): Tweak ObjC++ message argument handling; call objc_finish_message_expr() instead of finish_message_expr(). (finish_message_expr): Rename to objc_finish_message_expr(); use OBJC_TYPE_NAME and OBJC_SET_TYPE_NAME macros instead of TYPE_NAME. call gen_type_name() instead of gen_declaration(); call objc_is_id() instead of using IS_ID and IS_CLASS; Use objc_class_name instead of calling get_identifier("Class"); handle CONVERT_EXPRs in receiver. (build_objc_method_call, warn_with_method): Do not call groktypename(). (build_ivar_reference): Call convert() instead of clobbering in a type. (hash_init): Initialize string_htab hash table. (add_instance_variable): Simplify parameter list; do not call grokfield(); do not populate CLASS_IVARS list. (start_class): Check for the existence of super class, if one was specified. (continue_class): Use CLASS_RAW_IVARS rather than CLASS_IVARS; do not call build_class_template(); adjust call to get_class_ivars(); call build_decl(), pushdecl() and finish_decl() instead of define_decl(). (finish_class): Call build_decl(), pushdecl() and finish_decl() instead of define_decl(). (add_protocols): Use PROTOCOL_BINFO_ELTS for the tree vector size. (start_protocol): Do not call build_protocol_template(); use PROTOCOL_BINFO_ELTS for the tree vector size. (encode_type_qualifiers): Do not handle the 'const' qualifier here. (encode_pointer): Encode 'const char *' as 'r*', for backwards compatibility. (encode_array): Use HOST_WIDE_INT_PRINT_DEC instead of "%ld". (encode_type): Handle the 'const' qualifier here. (objc_parmlist): New global variable, sued by objc_push_parm and objc_get_parm_info(). (objc_push_parm, objc_get_parm_info): New functions. (objc_expr_last): Remove function. (synth_self_and_ucmd_args): For instance methods, use the instance type for 'self'; call objc_push_parm() instead of push_parm_decl(). (start_method_def): Do not call push_scope(), declare_parm_level(), pop_scope(), push_parm_decl(), store_parm_decls() or objc_expr_last(); just use objc_push_parm() and objc_get_parm_info(). (comp_method_with_proto): Remove function. (objc_types_are_equivalent): Strip away indirections before comparing underlying types. (comp_proto_with_proto): Do not call groktypename(); types are no longer in raw declspec format. (objc_start_function): New function. (really_start_method): Call comp_proto_with_proto() instead of comp_method_with_proto(); call objc_start_function() instead of hand-crafting a function declarator. (continue_method_def, objc_expand_function_end): Remove functions. (get_super_receiver): Call objc_get_current_scope() instead of get_current_scope(); reference 'super_class' field (instead of 'class'). (finish_method_def): Rename to objc_finish_method_definition() and add a function decl parameter; move method encoding call from objc_expand_function_end(). (is_complex_decl, adorn_decl, gen_declarator, gen_declspecs, gen_declaration_1): Remove functions. (tmpbuf, RAW_DECLSPEC): Remove. (gen_declaration): Remove second parameter; simplify to deal with TYPE_P nodes instead of raw declspecs. (gen_type_name, gen_type_name_0): New functions. (gen_method_decl): Remove second parameter; call gen_type_name() instead of gen_declaration_1(). (dump_interface): Adjust calls to gen_declaration() and gen_method_decl(); do not allocate a separate string buffer. (init_objc): Allocate a larger string buffer to accommodate dump_interface(); adjust call to build_module_descriptor(); add call to build_module_initializer_routine() for the GNU runtime. (generate_classref_translation_entry): Do not call start_decl(); call finish_var_decl() instead of finish_decl(); call convert() instead of build_c_cast(). * objc-act.h (CLASS_OWN_IVARS): Remove accessor. (CLASS_BINFO_ELTS): Reduce from 6 to 5, now that CLASS_OWN_IVARS is gone. (OCTI_GNU_INIT_DECL, GNU_INIT_decl): New. (OCTI_ELLIPSIS_NODE, objc_ellipsis_node): Remove. (OCTI_ID_ID, id_type, objc_id_id): Rename to OCTI_ID_NAME, objc_object_type and objc_object_name, respectively. (OCTI_CLS_REF, OCTI_CLASS_NAME, objc_class_reference, objc_class_name): New. (IS_CLASS): New macro. (IS_ID, IS_SUPER): Robustify. (OCTI_EXECCLASS_DECL, execclass_decl): New. (finish_file, start_class, continue_class, finish_class, start_method_def, continue_method_def, finish_method_def, start_protocol, finish_protocol, objc_build_throw_stmt, objc_build_try_catch_finally_stmt, objc_build_synchronized_prologue, objc_build_synchronized_epilogue, objc_build_try_prologue, objc_build_try_epilogue, objc_build_catch_stmt, objc_build_catch_epilogue, objc_build_finally_prologue, objc_build_finally_epilogue, is_ivar, is_private, is_public, add_instance_variable, objc_add_method, get_super_receiver, objc_clear_super_receiver, get_class_ivars_from_name, get_class_reference, get_static_reference, get_object_reference, build_message_expr, finish_message_expr, build_selector_expr, build_ivar_reference, build_keyword_decl, build_method_decl, build_protocol_expr, build_objc_string_object, objc_declare_alias, objc_declare_class, objc_declare_protocols, objc_comptypes, objc_check_decl, build_encode_expr): Remove prototypes. (imp_count, cat_count): Make GGC-aware. (OBJC_SET_TYPE_NAME): New macro. From-SVN: r87168
2004-09-08 02:49:44 +02:00
return decl;
}
1992-01-18 00:15:38 +01:00
Makefile.in (c-parse.o): Depend on $(C_COMMON_H). [gcc/ChangeLog] 2004-09-07 Ziemowit Laski <zlaski@apple.com> * Makefile.in (c-parse.o): Depend on $(C_COMMON_H). * c-parse.in: Include c-common.h instead of objc-act.h. (ivar_decl_list, ivar_decls, ivar_decl, ivars, ivar_declarator, myparms, myparm): Remove %type declarations. (methodtype, optparms, OBJC_TYPE_QUAL, objc_quals, objc_qual, objc_typename, objc_try_catch_stmt, optellipsis): Add %type declarations. (objc_inherit_code, objc_public_flag): Remove. (typespec_nonreserved_nonattr): Call objc_get_protocol_qualified_type() instead of get_static_reference() and get_protocol_reference(). (stmt_nocomp): Call grokparm() on @catch parameter. (objcdef): Move semantic action to objc_finish_implementation(). (classdef): Move semantic action to objc_start_class_interface(), objc_continue_interface(), objc_finish_interface(), objc_start_class_implementation(), objc_continue_implementation(), objc_start_category_interface() and objc_start_category_implementation(). (protocoldef): Move semantic actions to objc_start_protocol() and objc_finish_interface(). (ivar_decl_list): Remove nonterminal. (visibility_spec): Move semantic actions to objc_set_visibility(). (ivar_decls): Remove assignment to $$. (ivar_decl): Rephrase in terms of component_decl; call objc_add_instance_variable(). (ivars, ivar_declarator): Remove nonterminals. (opt_semi): New nonterminal. (methodtype): Remove semantic actions. (methoddef): Move semantic actions to objc_set_method_type(), objc_start_method_definition() and objc_finish_method_definition(). (methodproto): Move semantic actions to objc_set_method_type() and objc_add_method_declaration(). (methoddecl): Use objc_typename instead of typename; move semantic actions to objc_build_method_signature(). (optarglist, myxdecls, mydecl, myparms, myparm): Remove nonterminals. (optparmlist): Express in terms of optparms and optellipsis. (optparms, optellipsis, objc_qual, objc_quals, objc_typename): New nonterminals. (keyworddecl): Use objc_typename instead of typename. (rid_to_yy): Mark RID_IN, RID_OUT, RID_INOUT, RID_BYCOPY, RID_BYREF and RID_ONEWAY as returning OBJC_TYPE_QUAL to yyparse(). [gcc/objc/ChangeLog] 2004-09-07 Ziemowit Laski <zlaski@apple.com> * Make-lang.in (objc/objc-parse.o): Depend on $(C_COMMON_H) instead of objc/objc-act.h. (objc/objc-act.o): Depend on $(HASHTAB_H). * objc-act.c: Include hashtab.h; in ObjC++ mode, include cp-tree.h and objcp-decl.h instead of c-tree.h. (build_module_descriptor, get_class_ivars, synth_id_with_class_suffix, error_with_ivar, gen_method_decl, gen_declaration, setup_string_decl, build_protocol_template): Adjust prototypes. (build_module_initializer_routine, start_class, continue_class, finish_class, start_method_def, objc_start_function, start_protocol, build_method_decl, objc_add_method, add_instance_variable, build_ivar_reference, is_ivar, is_private, get_super_receiver, build_selector_table_decl, objc_push_parm, objc_get_parm_info, gen_type_name, gen_type_name_0, start_var_decl, finish_var_decl, create_field_decl): New prototypes. (objc_expand_function_end, comp_method_with_proto, objc_expr_last, gen_declaration_1, gen_declarator, is_complex_decl, adorn_decl, define_decl, create_builtin_decl, gen_declspecs): Remove prototypes. (TYPE_ID): Rename to OBJECT_TYPEDEF_NAME. (CLASS_TYPEDEF_NAME): New. (TAG_EXECCLASS): Change from a global variable to a #define. (TAG_RETURN_STRUCT): Delete. (TAG_GNUINIT): New, holds '__objc_gnu_init' name. (objc_inherit_code, objc_public_flag): New, moved from c-parse.in. (string_descriptor): New struct. (string_htab): New hash table. (string_hash, string_eq): New prototypes. (generate_struct_by_value_array): Call create_field_decl() instead of create_builtin_decl(). (objc_init): Do not initialize objc_ellipsis_node or TAG_EXECCLASS; In ObjC++ mode, call cxx_init() instead of c_objc_common_init(). (objc_finish_file): In ObjC++, call instantiate_pending_templates() and cp_finish_file(). (define_decl, get_static_reference, get_protocol_reference, create_builtin_decl): Remove functions. (objc_start_class_interface, objc_start_category_interface, objc_start_protocol, objc_continue_interface, objc_finish_interface, objc_start_class_implementation, objc_start_category_implementation, objc_continue_implementation, objc_finish_implementation, objc_set_visibility, objc_set_method_type, objc_build_method_signature, objc_add_method_declaration, objc_start_method_definition, objc_add_instance_variable, objc_get_protocol_qualified_type, create_field_decl, start_var_decl, finish_var_decl): New functions. (setup_string_decl): Simplify since it is only called once. (synth_module_prologue): Call build_class_template(); predefine 'id' and 'Class' as typedefs; rename 'temp_type' to 'type'; disable debug hooks for duration of function; fix GNU runtime messenger signatures to correspond to reality; forward-declare '__objc_exec_class' for the GNU runtime; call build_selector_table_decl(); in ObjC++ mode, generate 'extern "C" { ... }' wrappers around synthesized declarations; call build_protocol_template() and build_category_template(). (string_hash, string_eq): New functions. (objc_build_string_object): Check metaclass correctness only once; store string literals in hash table. (objc_build_constructor): Do not convert initializer elements; adjust for ObjC++ impedance mismatch. (build_objc_symtab_template): Call create_field_decl() instead of create_builtin_decl(). (init_objc_symtab): Add missing conversion to initializer element. (build_metadata_decl): Call start_var_decl() instead of define_decl(). (generate_objc_symtab_decl): Do not call build_category_template(); call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(). (build_module_descriptor): Call create_field_decl() instead of grokfield(); call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(); always mark module descriptor as used; move GNU runtime-specific functionality to build_module_initializer_routine(). (build_module_initializer_routine): New function, broken off of build_module_descriptor(). (objc_static_init_needed_p, objc_generate_static_init_call): New functions. (generate_static_references, generate_strings, build_selector_translation_table, generate_descriptor_table, generate_ivars_list, generate_dispatch_table, generate_category): Call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(); build a type directly instead of via groktypename(). (build_selector_reference_decl, build_selector_table_decl, build_class_reference_decl, build_protocol_reference, generate_objc_image_info): Call start_var_decl() instead of build_decl(). (build_selector_reference): For GNU runtime, do not call build_selector_reference_decl(). (build_selector, build_typed_selector_reference): Always convert result to the selector type. (add_objc_string): Cast return value to 'char *'. (build_method_prototype_template, build_selector_template, build_method_template): Use actual selector type for fields pointing to selectors. (finish_objc): For GNU runtime, call build_module_initializer_routine() after build_module_descriptor(). (generate_protocol_list, generate_shared_structures): Call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(); build a type directly instead of via groktypename(). (synth_id_with_class_suffix): Return a string. (get_arg_type_list): For instance methods, use the instance type for 'self'; do not call groktypename_in_parm_context(). (build_objc_string_decl): Squash redeclaration errors in ObjC++. (objc_is_class_name): Use OBJC_TYPE_NAME instead of TYPE_NAME; handle RECORD_TYPEs in ObjC as well as ObjC++. (objc_is_id): New function. (objc_is_object_ptr): Return the canonical type node. (objc_get_class_ivars): Simplify using get_class_ivars(). (get_class_ivars): Remove second parameter; create a fresh copy of the ivar list for each call; do not check for existence of super class. (objc_eh_runtime_type): Mark #ifndef OBJCPLUS. (objc_init_exceptions): When using SJLJ-style exceptions, require the use of '-fobjc-exceptions' flag; do not require it for DWARF-style exceptions. (objc_build_exc_ptr, next_sjlj_build_try_catch_finally): Use objc_object_type instead of objc_id_type. (objc_begin_catch_clause): Convert the incoming PARM_DECL into a VAR_DECL before placing it in the appropriate scope; do not call define_decl(); adjust call to c_begin_compound_stmt(); use objc_object_type instead of objc_id_type. (build_next_objc_exception_stuff): Call create_field_decl() instead of create_builtin_decl(); construct type directly instead of calling groktypename(); use OBJC_VOID_AT_END to mark end of function parameters. (build_private_template): Adjust call to get_class_ivars(); build a type directly instead of via groktypename(). (build_protocol_template, build_method_prototype_list_template, build_method_prototype_template, build_category_template, build_selector_template, build_class_template, build_super_template, build_ivar_template, build_ivar_list_template, build_method_list_template, build_method_template): Call create_field_decl() instead of grokfield(). (objc_method_parm_type): Do not call groktypename(). (generate_descriptor_table): Call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(). (generate_method_descriptors, build_protocol_initializer, generate_dispatch_tables, build_category_initializer, build_shared_structure_initializer): Do not call groktypename(). (generate_protocols): Call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(); do not call groktypename(). (error_with_ivar): Remove last parameter. (check_ivars): Do not iterate ovar CLASS_RAW_IVARS lists in addition to CLASS_IVARS lists; adjust calls to error_with_ivar(). (generate_ivar_lists): Convert one of the initializer elements; do not call groktypename(). (get_arg_type_list, start_method_def, gen_method_def): Account for new representation of variable arguments and '...' in Objective-C methods; add Objective-C++ impedance matching code. (is_objc_type_qualifier): Remove function. (adjust_type_for_id_default): Simplify; there is no longer a need to wade through declspecs. (lookup_interface, start_class, continue_class, finish_class, start_method_def, start_protocol, build_method_decl, objc_add_method, add_instance_variable, build_ivar_reference, is_ivar, is_private, get_super_receiver, objc_build_finally_epilogue): Make into static functions. (receiver_is_class_object): Use new IS_CLASS() macro. (objc_build_message_expr): Tweak ObjC++ message argument handling; call objc_finish_message_expr() instead of finish_message_expr(). (finish_message_expr): Rename to objc_finish_message_expr(); use OBJC_TYPE_NAME and OBJC_SET_TYPE_NAME macros instead of TYPE_NAME. call gen_type_name() instead of gen_declaration(); call objc_is_id() instead of using IS_ID and IS_CLASS; Use objc_class_name instead of calling get_identifier("Class"); handle CONVERT_EXPRs in receiver. (build_objc_method_call, warn_with_method): Do not call groktypename(). (build_ivar_reference): Call convert() instead of clobbering in a type. (hash_init): Initialize string_htab hash table. (add_instance_variable): Simplify parameter list; do not call grokfield(); do not populate CLASS_IVARS list. (start_class): Check for the existence of super class, if one was specified. (continue_class): Use CLASS_RAW_IVARS rather than CLASS_IVARS; do not call build_class_template(); adjust call to get_class_ivars(); call build_decl(), pushdecl() and finish_decl() instead of define_decl(). (finish_class): Call build_decl(), pushdecl() and finish_decl() instead of define_decl(). (add_protocols): Use PROTOCOL_BINFO_ELTS for the tree vector size. (start_protocol): Do not call build_protocol_template(); use PROTOCOL_BINFO_ELTS for the tree vector size. (encode_type_qualifiers): Do not handle the 'const' qualifier here. (encode_pointer): Encode 'const char *' as 'r*', for backwards compatibility. (encode_array): Use HOST_WIDE_INT_PRINT_DEC instead of "%ld". (encode_type): Handle the 'const' qualifier here. (objc_parmlist): New global variable, sued by objc_push_parm and objc_get_parm_info(). (objc_push_parm, objc_get_parm_info): New functions. (objc_expr_last): Remove function. (synth_self_and_ucmd_args): For instance methods, use the instance type for 'self'; call objc_push_parm() instead of push_parm_decl(). (start_method_def): Do not call push_scope(), declare_parm_level(), pop_scope(), push_parm_decl(), store_parm_decls() or objc_expr_last(); just use objc_push_parm() and objc_get_parm_info(). (comp_method_with_proto): Remove function. (objc_types_are_equivalent): Strip away indirections before comparing underlying types. (comp_proto_with_proto): Do not call groktypename(); types are no longer in raw declspec format. (objc_start_function): New function. (really_start_method): Call comp_proto_with_proto() instead of comp_method_with_proto(); call objc_start_function() instead of hand-crafting a function declarator. (continue_method_def, objc_expand_function_end): Remove functions. (get_super_receiver): Call objc_get_current_scope() instead of get_current_scope(); reference 'super_class' field (instead of 'class'). (finish_method_def): Rename to objc_finish_method_definition() and add a function decl parameter; move method encoding call from objc_expand_function_end(). (is_complex_decl, adorn_decl, gen_declarator, gen_declspecs, gen_declaration_1): Remove functions. (tmpbuf, RAW_DECLSPEC): Remove. (gen_declaration): Remove second parameter; simplify to deal with TYPE_P nodes instead of raw declspecs. (gen_type_name, gen_type_name_0): New functions. (gen_method_decl): Remove second parameter; call gen_type_name() instead of gen_declaration_1(). (dump_interface): Adjust calls to gen_declaration() and gen_method_decl(); do not allocate a separate string buffer. (init_objc): Allocate a larger string buffer to accommodate dump_interface(); adjust call to build_module_descriptor(); add call to build_module_initializer_routine() for the GNU runtime. (generate_classref_translation_entry): Do not call start_decl(); call finish_var_decl() instead of finish_decl(); call convert() instead of build_c_cast(). * objc-act.h (CLASS_OWN_IVARS): Remove accessor. (CLASS_BINFO_ELTS): Reduce from 6 to 5, now that CLASS_OWN_IVARS is gone. (OCTI_GNU_INIT_DECL, GNU_INIT_decl): New. (OCTI_ELLIPSIS_NODE, objc_ellipsis_node): Remove. (OCTI_ID_ID, id_type, objc_id_id): Rename to OCTI_ID_NAME, objc_object_type and objc_object_name, respectively. (OCTI_CLS_REF, OCTI_CLASS_NAME, objc_class_reference, objc_class_name): New. (IS_CLASS): New macro. (IS_ID, IS_SUPER): Robustify. (OCTI_EXECCLASS_DECL, execclass_decl): New. (finish_file, start_class, continue_class, finish_class, start_method_def, continue_method_def, finish_method_def, start_protocol, finish_protocol, objc_build_throw_stmt, objc_build_try_catch_finally_stmt, objc_build_synchronized_prologue, objc_build_synchronized_epilogue, objc_build_try_prologue, objc_build_try_epilogue, objc_build_catch_stmt, objc_build_catch_epilogue, objc_build_finally_prologue, objc_build_finally_epilogue, is_ivar, is_private, is_public, add_instance_variable, objc_add_method, get_super_receiver, objc_clear_super_receiver, get_class_ivars_from_name, get_class_reference, get_static_reference, get_object_reference, build_message_expr, finish_message_expr, build_selector_expr, build_ivar_reference, build_keyword_decl, build_method_decl, build_protocol_expr, build_objc_string_object, objc_declare_alias, objc_declare_class, objc_declare_protocols, objc_comptypes, objc_check_decl, build_encode_expr): Remove prototypes. (imp_count, cat_count): Make GGC-aware. (OBJC_SET_TYPE_NAME): New macro. From-SVN: r87168
2004-09-08 02:49:44 +02:00
static void
build_selector_table_decl (void)
{
tree temp;
Makefile.in (c-parse.o): Depend on $(C_COMMON_H). [gcc/ChangeLog] 2004-09-07 Ziemowit Laski <zlaski@apple.com> * Makefile.in (c-parse.o): Depend on $(C_COMMON_H). * c-parse.in: Include c-common.h instead of objc-act.h. (ivar_decl_list, ivar_decls, ivar_decl, ivars, ivar_declarator, myparms, myparm): Remove %type declarations. (methodtype, optparms, OBJC_TYPE_QUAL, objc_quals, objc_qual, objc_typename, objc_try_catch_stmt, optellipsis): Add %type declarations. (objc_inherit_code, objc_public_flag): Remove. (typespec_nonreserved_nonattr): Call objc_get_protocol_qualified_type() instead of get_static_reference() and get_protocol_reference(). (stmt_nocomp): Call grokparm() on @catch parameter. (objcdef): Move semantic action to objc_finish_implementation(). (classdef): Move semantic action to objc_start_class_interface(), objc_continue_interface(), objc_finish_interface(), objc_start_class_implementation(), objc_continue_implementation(), objc_start_category_interface() and objc_start_category_implementation(). (protocoldef): Move semantic actions to objc_start_protocol() and objc_finish_interface(). (ivar_decl_list): Remove nonterminal. (visibility_spec): Move semantic actions to objc_set_visibility(). (ivar_decls): Remove assignment to $$. (ivar_decl): Rephrase in terms of component_decl; call objc_add_instance_variable(). (ivars, ivar_declarator): Remove nonterminals. (opt_semi): New nonterminal. (methodtype): Remove semantic actions. (methoddef): Move semantic actions to objc_set_method_type(), objc_start_method_definition() and objc_finish_method_definition(). (methodproto): Move semantic actions to objc_set_method_type() and objc_add_method_declaration(). (methoddecl): Use objc_typename instead of typename; move semantic actions to objc_build_method_signature(). (optarglist, myxdecls, mydecl, myparms, myparm): Remove nonterminals. (optparmlist): Express in terms of optparms and optellipsis. (optparms, optellipsis, objc_qual, objc_quals, objc_typename): New nonterminals. (keyworddecl): Use objc_typename instead of typename. (rid_to_yy): Mark RID_IN, RID_OUT, RID_INOUT, RID_BYCOPY, RID_BYREF and RID_ONEWAY as returning OBJC_TYPE_QUAL to yyparse(). [gcc/objc/ChangeLog] 2004-09-07 Ziemowit Laski <zlaski@apple.com> * Make-lang.in (objc/objc-parse.o): Depend on $(C_COMMON_H) instead of objc/objc-act.h. (objc/objc-act.o): Depend on $(HASHTAB_H). * objc-act.c: Include hashtab.h; in ObjC++ mode, include cp-tree.h and objcp-decl.h instead of c-tree.h. (build_module_descriptor, get_class_ivars, synth_id_with_class_suffix, error_with_ivar, gen_method_decl, gen_declaration, setup_string_decl, build_protocol_template): Adjust prototypes. (build_module_initializer_routine, start_class, continue_class, finish_class, start_method_def, objc_start_function, start_protocol, build_method_decl, objc_add_method, add_instance_variable, build_ivar_reference, is_ivar, is_private, get_super_receiver, build_selector_table_decl, objc_push_parm, objc_get_parm_info, gen_type_name, gen_type_name_0, start_var_decl, finish_var_decl, create_field_decl): New prototypes. (objc_expand_function_end, comp_method_with_proto, objc_expr_last, gen_declaration_1, gen_declarator, is_complex_decl, adorn_decl, define_decl, create_builtin_decl, gen_declspecs): Remove prototypes. (TYPE_ID): Rename to OBJECT_TYPEDEF_NAME. (CLASS_TYPEDEF_NAME): New. (TAG_EXECCLASS): Change from a global variable to a #define. (TAG_RETURN_STRUCT): Delete. (TAG_GNUINIT): New, holds '__objc_gnu_init' name. (objc_inherit_code, objc_public_flag): New, moved from c-parse.in. (string_descriptor): New struct. (string_htab): New hash table. (string_hash, string_eq): New prototypes. (generate_struct_by_value_array): Call create_field_decl() instead of create_builtin_decl(). (objc_init): Do not initialize objc_ellipsis_node or TAG_EXECCLASS; In ObjC++ mode, call cxx_init() instead of c_objc_common_init(). (objc_finish_file): In ObjC++, call instantiate_pending_templates() and cp_finish_file(). (define_decl, get_static_reference, get_protocol_reference, create_builtin_decl): Remove functions. (objc_start_class_interface, objc_start_category_interface, objc_start_protocol, objc_continue_interface, objc_finish_interface, objc_start_class_implementation, objc_start_category_implementation, objc_continue_implementation, objc_finish_implementation, objc_set_visibility, objc_set_method_type, objc_build_method_signature, objc_add_method_declaration, objc_start_method_definition, objc_add_instance_variable, objc_get_protocol_qualified_type, create_field_decl, start_var_decl, finish_var_decl): New functions. (setup_string_decl): Simplify since it is only called once. (synth_module_prologue): Call build_class_template(); predefine 'id' and 'Class' as typedefs; rename 'temp_type' to 'type'; disable debug hooks for duration of function; fix GNU runtime messenger signatures to correspond to reality; forward-declare '__objc_exec_class' for the GNU runtime; call build_selector_table_decl(); in ObjC++ mode, generate 'extern "C" { ... }' wrappers around synthesized declarations; call build_protocol_template() and build_category_template(). (string_hash, string_eq): New functions. (objc_build_string_object): Check metaclass correctness only once; store string literals in hash table. (objc_build_constructor): Do not convert initializer elements; adjust for ObjC++ impedance mismatch. (build_objc_symtab_template): Call create_field_decl() instead of create_builtin_decl(). (init_objc_symtab): Add missing conversion to initializer element. (build_metadata_decl): Call start_var_decl() instead of define_decl(). (generate_objc_symtab_decl): Do not call build_category_template(); call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(). (build_module_descriptor): Call create_field_decl() instead of grokfield(); call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(); always mark module descriptor as used; move GNU runtime-specific functionality to build_module_initializer_routine(). (build_module_initializer_routine): New function, broken off of build_module_descriptor(). (objc_static_init_needed_p, objc_generate_static_init_call): New functions. (generate_static_references, generate_strings, build_selector_translation_table, generate_descriptor_table, generate_ivars_list, generate_dispatch_table, generate_category): Call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(); build a type directly instead of via groktypename(). (build_selector_reference_decl, build_selector_table_decl, build_class_reference_decl, build_protocol_reference, generate_objc_image_info): Call start_var_decl() instead of build_decl(). (build_selector_reference): For GNU runtime, do not call build_selector_reference_decl(). (build_selector, build_typed_selector_reference): Always convert result to the selector type. (add_objc_string): Cast return value to 'char *'. (build_method_prototype_template, build_selector_template, build_method_template): Use actual selector type for fields pointing to selectors. (finish_objc): For GNU runtime, call build_module_initializer_routine() after build_module_descriptor(). (generate_protocol_list, generate_shared_structures): Call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(); build a type directly instead of via groktypename(). (synth_id_with_class_suffix): Return a string. (get_arg_type_list): For instance methods, use the instance type for 'self'; do not call groktypename_in_parm_context(). (build_objc_string_decl): Squash redeclaration errors in ObjC++. (objc_is_class_name): Use OBJC_TYPE_NAME instead of TYPE_NAME; handle RECORD_TYPEs in ObjC as well as ObjC++. (objc_is_id): New function. (objc_is_object_ptr): Return the canonical type node. (objc_get_class_ivars): Simplify using get_class_ivars(). (get_class_ivars): Remove second parameter; create a fresh copy of the ivar list for each call; do not check for existence of super class. (objc_eh_runtime_type): Mark #ifndef OBJCPLUS. (objc_init_exceptions): When using SJLJ-style exceptions, require the use of '-fobjc-exceptions' flag; do not require it for DWARF-style exceptions. (objc_build_exc_ptr, next_sjlj_build_try_catch_finally): Use objc_object_type instead of objc_id_type. (objc_begin_catch_clause): Convert the incoming PARM_DECL into a VAR_DECL before placing it in the appropriate scope; do not call define_decl(); adjust call to c_begin_compound_stmt(); use objc_object_type instead of objc_id_type. (build_next_objc_exception_stuff): Call create_field_decl() instead of create_builtin_decl(); construct type directly instead of calling groktypename(); use OBJC_VOID_AT_END to mark end of function parameters. (build_private_template): Adjust call to get_class_ivars(); build a type directly instead of via groktypename(). (build_protocol_template, build_method_prototype_list_template, build_method_prototype_template, build_category_template, build_selector_template, build_class_template, build_super_template, build_ivar_template, build_ivar_list_template, build_method_list_template, build_method_template): Call create_field_decl() instead of grokfield(). (objc_method_parm_type): Do not call groktypename(). (generate_descriptor_table): Call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(). (generate_method_descriptors, build_protocol_initializer, generate_dispatch_tables, build_category_initializer, build_shared_structure_initializer): Do not call groktypename(). (generate_protocols): Call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(); do not call groktypename(). (error_with_ivar): Remove last parameter. (check_ivars): Do not iterate ovar CLASS_RAW_IVARS lists in addition to CLASS_IVARS lists; adjust calls to error_with_ivar(). (generate_ivar_lists): Convert one of the initializer elements; do not call groktypename(). (get_arg_type_list, start_method_def, gen_method_def): Account for new representation of variable arguments and '...' in Objective-C methods; add Objective-C++ impedance matching code. (is_objc_type_qualifier): Remove function. (adjust_type_for_id_default): Simplify; there is no longer a need to wade through declspecs. (lookup_interface, start_class, continue_class, finish_class, start_method_def, start_protocol, build_method_decl, objc_add_method, add_instance_variable, build_ivar_reference, is_ivar, is_private, get_super_receiver, objc_build_finally_epilogue): Make into static functions. (receiver_is_class_object): Use new IS_CLASS() macro. (objc_build_message_expr): Tweak ObjC++ message argument handling; call objc_finish_message_expr() instead of finish_message_expr(). (finish_message_expr): Rename to objc_finish_message_expr(); use OBJC_TYPE_NAME and OBJC_SET_TYPE_NAME macros instead of TYPE_NAME. call gen_type_name() instead of gen_declaration(); call objc_is_id() instead of using IS_ID and IS_CLASS; Use objc_class_name instead of calling get_identifier("Class"); handle CONVERT_EXPRs in receiver. (build_objc_method_call, warn_with_method): Do not call groktypename(). (build_ivar_reference): Call convert() instead of clobbering in a type. (hash_init): Initialize string_htab hash table. (add_instance_variable): Simplify parameter list; do not call grokfield(); do not populate CLASS_IVARS list. (start_class): Check for the existence of super class, if one was specified. (continue_class): Use CLASS_RAW_IVARS rather than CLASS_IVARS; do not call build_class_template(); adjust call to get_class_ivars(); call build_decl(), pushdecl() and finish_decl() instead of define_decl(). (finish_class): Call build_decl(), pushdecl() and finish_decl() instead of define_decl(). (add_protocols): Use PROTOCOL_BINFO_ELTS for the tree vector size. (start_protocol): Do not call build_protocol_template(); use PROTOCOL_BINFO_ELTS for the tree vector size. (encode_type_qualifiers): Do not handle the 'const' qualifier here. (encode_pointer): Encode 'const char *' as 'r*', for backwards compatibility. (encode_array): Use HOST_WIDE_INT_PRINT_DEC instead of "%ld". (encode_type): Handle the 'const' qualifier here. (objc_parmlist): New global variable, sued by objc_push_parm and objc_get_parm_info(). (objc_push_parm, objc_get_parm_info): New functions. (objc_expr_last): Remove function. (synth_self_and_ucmd_args): For instance methods, use the instance type for 'self'; call objc_push_parm() instead of push_parm_decl(). (start_method_def): Do not call push_scope(), declare_parm_level(), pop_scope(), push_parm_decl(), store_parm_decls() or objc_expr_last(); just use objc_push_parm() and objc_get_parm_info(). (comp_method_with_proto): Remove function. (objc_types_are_equivalent): Strip away indirections before comparing underlying types. (comp_proto_with_proto): Do not call groktypename(); types are no longer in raw declspec format. (objc_start_function): New function. (really_start_method): Call comp_proto_with_proto() instead of comp_method_with_proto(); call objc_start_function() instead of hand-crafting a function declarator. (continue_method_def, objc_expand_function_end): Remove functions. (get_super_receiver): Call objc_get_current_scope() instead of get_current_scope(); reference 'super_class' field (instead of 'class'). (finish_method_def): Rename to objc_finish_method_definition() and add a function decl parameter; move method encoding call from objc_expand_function_end(). (is_complex_decl, adorn_decl, gen_declarator, gen_declspecs, gen_declaration_1): Remove functions. (tmpbuf, RAW_DECLSPEC): Remove. (gen_declaration): Remove second parameter; simplify to deal with TYPE_P nodes instead of raw declspecs. (gen_type_name, gen_type_name_0): New functions. (gen_method_decl): Remove second parameter; call gen_type_name() instead of gen_declaration_1(). (dump_interface): Adjust calls to gen_declaration() and gen_method_decl(); do not allocate a separate string buffer. (init_objc): Allocate a larger string buffer to accommodate dump_interface(); adjust call to build_module_descriptor(); add call to build_module_initializer_routine() for the GNU runtime. (generate_classref_translation_entry): Do not call start_decl(); call finish_var_decl() instead of finish_decl(); call convert() instead of build_c_cast(). * objc-act.h (CLASS_OWN_IVARS): Remove accessor. (CLASS_BINFO_ELTS): Reduce from 6 to 5, now that CLASS_OWN_IVARS is gone. (OCTI_GNU_INIT_DECL, GNU_INIT_decl): New. (OCTI_ELLIPSIS_NODE, objc_ellipsis_node): Remove. (OCTI_ID_ID, id_type, objc_id_id): Rename to OCTI_ID_NAME, objc_object_type and objc_object_name, respectively. (OCTI_CLS_REF, OCTI_CLASS_NAME, objc_class_reference, objc_class_name): New. (IS_CLASS): New macro. (IS_ID, IS_SUPER): Robustify. (OCTI_EXECCLASS_DECL, execclass_decl): New. (finish_file, start_class, continue_class, finish_class, start_method_def, continue_method_def, finish_method_def, start_protocol, finish_protocol, objc_build_throw_stmt, objc_build_try_catch_finally_stmt, objc_build_synchronized_prologue, objc_build_synchronized_epilogue, objc_build_try_prologue, objc_build_try_epilogue, objc_build_catch_stmt, objc_build_catch_epilogue, objc_build_finally_prologue, objc_build_finally_epilogue, is_ivar, is_private, is_public, add_instance_variable, objc_add_method, get_super_receiver, objc_clear_super_receiver, get_class_ivars_from_name, get_class_reference, get_static_reference, get_object_reference, build_message_expr, finish_message_expr, build_selector_expr, build_ivar_reference, build_keyword_decl, build_method_decl, build_protocol_expr, build_objc_string_object, objc_declare_alias, objc_declare_class, objc_declare_protocols, objc_comptypes, objc_check_decl, build_encode_expr): Remove prototypes. (imp_count, cat_count): Make GGC-aware. (OBJC_SET_TYPE_NAME): New macro. From-SVN: r87168
2004-09-08 02:49:44 +02:00
if (flag_typed_selectors)
{
build_selector_template ();
temp = build_array_type (objc_selector_template, NULL_TREE);
}
else
temp = build_array_type (objc_selector_type, NULL_TREE);
Makefile.in (c-parse.o): Depend on $(C_COMMON_H). [gcc/ChangeLog] 2004-09-07 Ziemowit Laski <zlaski@apple.com> * Makefile.in (c-parse.o): Depend on $(C_COMMON_H). * c-parse.in: Include c-common.h instead of objc-act.h. (ivar_decl_list, ivar_decls, ivar_decl, ivars, ivar_declarator, myparms, myparm): Remove %type declarations. (methodtype, optparms, OBJC_TYPE_QUAL, objc_quals, objc_qual, objc_typename, objc_try_catch_stmt, optellipsis): Add %type declarations. (objc_inherit_code, objc_public_flag): Remove. (typespec_nonreserved_nonattr): Call objc_get_protocol_qualified_type() instead of get_static_reference() and get_protocol_reference(). (stmt_nocomp): Call grokparm() on @catch parameter. (objcdef): Move semantic action to objc_finish_implementation(). (classdef): Move semantic action to objc_start_class_interface(), objc_continue_interface(), objc_finish_interface(), objc_start_class_implementation(), objc_continue_implementation(), objc_start_category_interface() and objc_start_category_implementation(). (protocoldef): Move semantic actions to objc_start_protocol() and objc_finish_interface(). (ivar_decl_list): Remove nonterminal. (visibility_spec): Move semantic actions to objc_set_visibility(). (ivar_decls): Remove assignment to $$. (ivar_decl): Rephrase in terms of component_decl; call objc_add_instance_variable(). (ivars, ivar_declarator): Remove nonterminals. (opt_semi): New nonterminal. (methodtype): Remove semantic actions. (methoddef): Move semantic actions to objc_set_method_type(), objc_start_method_definition() and objc_finish_method_definition(). (methodproto): Move semantic actions to objc_set_method_type() and objc_add_method_declaration(). (methoddecl): Use objc_typename instead of typename; move semantic actions to objc_build_method_signature(). (optarglist, myxdecls, mydecl, myparms, myparm): Remove nonterminals. (optparmlist): Express in terms of optparms and optellipsis. (optparms, optellipsis, objc_qual, objc_quals, objc_typename): New nonterminals. (keyworddecl): Use objc_typename instead of typename. (rid_to_yy): Mark RID_IN, RID_OUT, RID_INOUT, RID_BYCOPY, RID_BYREF and RID_ONEWAY as returning OBJC_TYPE_QUAL to yyparse(). [gcc/objc/ChangeLog] 2004-09-07 Ziemowit Laski <zlaski@apple.com> * Make-lang.in (objc/objc-parse.o): Depend on $(C_COMMON_H) instead of objc/objc-act.h. (objc/objc-act.o): Depend on $(HASHTAB_H). * objc-act.c: Include hashtab.h; in ObjC++ mode, include cp-tree.h and objcp-decl.h instead of c-tree.h. (build_module_descriptor, get_class_ivars, synth_id_with_class_suffix, error_with_ivar, gen_method_decl, gen_declaration, setup_string_decl, build_protocol_template): Adjust prototypes. (build_module_initializer_routine, start_class, continue_class, finish_class, start_method_def, objc_start_function, start_protocol, build_method_decl, objc_add_method, add_instance_variable, build_ivar_reference, is_ivar, is_private, get_super_receiver, build_selector_table_decl, objc_push_parm, objc_get_parm_info, gen_type_name, gen_type_name_0, start_var_decl, finish_var_decl, create_field_decl): New prototypes. (objc_expand_function_end, comp_method_with_proto, objc_expr_last, gen_declaration_1, gen_declarator, is_complex_decl, adorn_decl, define_decl, create_builtin_decl, gen_declspecs): Remove prototypes. (TYPE_ID): Rename to OBJECT_TYPEDEF_NAME. (CLASS_TYPEDEF_NAME): New. (TAG_EXECCLASS): Change from a global variable to a #define. (TAG_RETURN_STRUCT): Delete. (TAG_GNUINIT): New, holds '__objc_gnu_init' name. (objc_inherit_code, objc_public_flag): New, moved from c-parse.in. (string_descriptor): New struct. (string_htab): New hash table. (string_hash, string_eq): New prototypes. (generate_struct_by_value_array): Call create_field_decl() instead of create_builtin_decl(). (objc_init): Do not initialize objc_ellipsis_node or TAG_EXECCLASS; In ObjC++ mode, call cxx_init() instead of c_objc_common_init(). (objc_finish_file): In ObjC++, call instantiate_pending_templates() and cp_finish_file(). (define_decl, get_static_reference, get_protocol_reference, create_builtin_decl): Remove functions. (objc_start_class_interface, objc_start_category_interface, objc_start_protocol, objc_continue_interface, objc_finish_interface, objc_start_class_implementation, objc_start_category_implementation, objc_continue_implementation, objc_finish_implementation, objc_set_visibility, objc_set_method_type, objc_build_method_signature, objc_add_method_declaration, objc_start_method_definition, objc_add_instance_variable, objc_get_protocol_qualified_type, create_field_decl, start_var_decl, finish_var_decl): New functions. (setup_string_decl): Simplify since it is only called once. (synth_module_prologue): Call build_class_template(); predefine 'id' and 'Class' as typedefs; rename 'temp_type' to 'type'; disable debug hooks for duration of function; fix GNU runtime messenger signatures to correspond to reality; forward-declare '__objc_exec_class' for the GNU runtime; call build_selector_table_decl(); in ObjC++ mode, generate 'extern "C" { ... }' wrappers around synthesized declarations; call build_protocol_template() and build_category_template(). (string_hash, string_eq): New functions. (objc_build_string_object): Check metaclass correctness only once; store string literals in hash table. (objc_build_constructor): Do not convert initializer elements; adjust for ObjC++ impedance mismatch. (build_objc_symtab_template): Call create_field_decl() instead of create_builtin_decl(). (init_objc_symtab): Add missing conversion to initializer element. (build_metadata_decl): Call start_var_decl() instead of define_decl(). (generate_objc_symtab_decl): Do not call build_category_template(); call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(). (build_module_descriptor): Call create_field_decl() instead of grokfield(); call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(); always mark module descriptor as used; move GNU runtime-specific functionality to build_module_initializer_routine(). (build_module_initializer_routine): New function, broken off of build_module_descriptor(). (objc_static_init_needed_p, objc_generate_static_init_call): New functions. (generate_static_references, generate_strings, build_selector_translation_table, generate_descriptor_table, generate_ivars_list, generate_dispatch_table, generate_category): Call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(); build a type directly instead of via groktypename(). (build_selector_reference_decl, build_selector_table_decl, build_class_reference_decl, build_protocol_reference, generate_objc_image_info): Call start_var_decl() instead of build_decl(). (build_selector_reference): For GNU runtime, do not call build_selector_reference_decl(). (build_selector, build_typed_selector_reference): Always convert result to the selector type. (add_objc_string): Cast return value to 'char *'. (build_method_prototype_template, build_selector_template, build_method_template): Use actual selector type for fields pointing to selectors. (finish_objc): For GNU runtime, call build_module_initializer_routine() after build_module_descriptor(). (generate_protocol_list, generate_shared_structures): Call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(); build a type directly instead of via groktypename(). (synth_id_with_class_suffix): Return a string. (get_arg_type_list): For instance methods, use the instance type for 'self'; do not call groktypename_in_parm_context(). (build_objc_string_decl): Squash redeclaration errors in ObjC++. (objc_is_class_name): Use OBJC_TYPE_NAME instead of TYPE_NAME; handle RECORD_TYPEs in ObjC as well as ObjC++. (objc_is_id): New function. (objc_is_object_ptr): Return the canonical type node. (objc_get_class_ivars): Simplify using get_class_ivars(). (get_class_ivars): Remove second parameter; create a fresh copy of the ivar list for each call; do not check for existence of super class. (objc_eh_runtime_type): Mark #ifndef OBJCPLUS. (objc_init_exceptions): When using SJLJ-style exceptions, require the use of '-fobjc-exceptions' flag; do not require it for DWARF-style exceptions. (objc_build_exc_ptr, next_sjlj_build_try_catch_finally): Use objc_object_type instead of objc_id_type. (objc_begin_catch_clause): Convert the incoming PARM_DECL into a VAR_DECL before placing it in the appropriate scope; do not call define_decl(); adjust call to c_begin_compound_stmt(); use objc_object_type instead of objc_id_type. (build_next_objc_exception_stuff): Call create_field_decl() instead of create_builtin_decl(); construct type directly instead of calling groktypename(); use OBJC_VOID_AT_END to mark end of function parameters. (build_private_template): Adjust call to get_class_ivars(); build a type directly instead of via groktypename(). (build_protocol_template, build_method_prototype_list_template, build_method_prototype_template, build_category_template, build_selector_template, build_class_template, build_super_template, build_ivar_template, build_ivar_list_template, build_method_list_template, build_method_template): Call create_field_decl() instead of grokfield(). (objc_method_parm_type): Do not call groktypename(). (generate_descriptor_table): Call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(). (generate_method_descriptors, build_protocol_initializer, generate_dispatch_tables, build_category_initializer, build_shared_structure_initializer): Do not call groktypename(). (generate_protocols): Call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(); do not call groktypename(). (error_with_ivar): Remove last parameter. (check_ivars): Do not iterate ovar CLASS_RAW_IVARS lists in addition to CLASS_IVARS lists; adjust calls to error_with_ivar(). (generate_ivar_lists): Convert one of the initializer elements; do not call groktypename(). (get_arg_type_list, start_method_def, gen_method_def): Account for new representation of variable arguments and '...' in Objective-C methods; add Objective-C++ impedance matching code. (is_objc_type_qualifier): Remove function. (adjust_type_for_id_default): Simplify; there is no longer a need to wade through declspecs. (lookup_interface, start_class, continue_class, finish_class, start_method_def, start_protocol, build_method_decl, objc_add_method, add_instance_variable, build_ivar_reference, is_ivar, is_private, get_super_receiver, objc_build_finally_epilogue): Make into static functions. (receiver_is_class_object): Use new IS_CLASS() macro. (objc_build_message_expr): Tweak ObjC++ message argument handling; call objc_finish_message_expr() instead of finish_message_expr(). (finish_message_expr): Rename to objc_finish_message_expr(); use OBJC_TYPE_NAME and OBJC_SET_TYPE_NAME macros instead of TYPE_NAME. call gen_type_name() instead of gen_declaration(); call objc_is_id() instead of using IS_ID and IS_CLASS; Use objc_class_name instead of calling get_identifier("Class"); handle CONVERT_EXPRs in receiver. (build_objc_method_call, warn_with_method): Do not call groktypename(). (build_ivar_reference): Call convert() instead of clobbering in a type. (hash_init): Initialize string_htab hash table. (add_instance_variable): Simplify parameter list; do not call grokfield(); do not populate CLASS_IVARS list. (start_class): Check for the existence of super class, if one was specified. (continue_class): Use CLASS_RAW_IVARS rather than CLASS_IVARS; do not call build_class_template(); adjust call to get_class_ivars(); call build_decl(), pushdecl() and finish_decl() instead of define_decl(). (finish_class): Call build_decl(), pushdecl() and finish_decl() instead of define_decl(). (add_protocols): Use PROTOCOL_BINFO_ELTS for the tree vector size. (start_protocol): Do not call build_protocol_template(); use PROTOCOL_BINFO_ELTS for the tree vector size. (encode_type_qualifiers): Do not handle the 'const' qualifier here. (encode_pointer): Encode 'const char *' as 'r*', for backwards compatibility. (encode_array): Use HOST_WIDE_INT_PRINT_DEC instead of "%ld". (encode_type): Handle the 'const' qualifier here. (objc_parmlist): New global variable, sued by objc_push_parm and objc_get_parm_info(). (objc_push_parm, objc_get_parm_info): New functions. (objc_expr_last): Remove function. (synth_self_and_ucmd_args): For instance methods, use the instance type for 'self'; call objc_push_parm() instead of push_parm_decl(). (start_method_def): Do not call push_scope(), declare_parm_level(), pop_scope(), push_parm_decl(), store_parm_decls() or objc_expr_last(); just use objc_push_parm() and objc_get_parm_info(). (comp_method_with_proto): Remove function. (objc_types_are_equivalent): Strip away indirections before comparing underlying types. (comp_proto_with_proto): Do not call groktypename(); types are no longer in raw declspec format. (objc_start_function): New function. (really_start_method): Call comp_proto_with_proto() instead of comp_method_with_proto(); call objc_start_function() instead of hand-crafting a function declarator. (continue_method_def, objc_expand_function_end): Remove functions. (get_super_receiver): Call objc_get_current_scope() instead of get_current_scope(); reference 'super_class' field (instead of 'class'). (finish_method_def): Rename to objc_finish_method_definition() and add a function decl parameter; move method encoding call from objc_expand_function_end(). (is_complex_decl, adorn_decl, gen_declarator, gen_declspecs, gen_declaration_1): Remove functions. (tmpbuf, RAW_DECLSPEC): Remove. (gen_declaration): Remove second parameter; simplify to deal with TYPE_P nodes instead of raw declspecs. (gen_type_name, gen_type_name_0): New functions. (gen_method_decl): Remove second parameter; call gen_type_name() instead of gen_declaration_1(). (dump_interface): Adjust calls to gen_declaration() and gen_method_decl(); do not allocate a separate string buffer. (init_objc): Allocate a larger string buffer to accommodate dump_interface(); adjust call to build_module_descriptor(); add call to build_module_initializer_routine() for the GNU runtime. (generate_classref_translation_entry): Do not call start_decl(); call finish_var_decl() instead of finish_decl(); call convert() instead of build_c_cast(). * objc-act.h (CLASS_OWN_IVARS): Remove accessor. (CLASS_BINFO_ELTS): Reduce from 6 to 5, now that CLASS_OWN_IVARS is gone. (OCTI_GNU_INIT_DECL, GNU_INIT_decl): New. (OCTI_ELLIPSIS_NODE, objc_ellipsis_node): Remove. (OCTI_ID_ID, id_type, objc_id_id): Rename to OCTI_ID_NAME, objc_object_type and objc_object_name, respectively. (OCTI_CLS_REF, OCTI_CLASS_NAME, objc_class_reference, objc_class_name): New. (IS_CLASS): New macro. (IS_ID, IS_SUPER): Robustify. (OCTI_EXECCLASS_DECL, execclass_decl): New. (finish_file, start_class, continue_class, finish_class, start_method_def, continue_method_def, finish_method_def, start_protocol, finish_protocol, objc_build_throw_stmt, objc_build_try_catch_finally_stmt, objc_build_synchronized_prologue, objc_build_synchronized_epilogue, objc_build_try_prologue, objc_build_try_epilogue, objc_build_catch_stmt, objc_build_catch_epilogue, objc_build_finally_prologue, objc_build_finally_epilogue, is_ivar, is_private, is_public, add_instance_variable, objc_add_method, get_super_receiver, objc_clear_super_receiver, get_class_ivars_from_name, get_class_reference, get_static_reference, get_object_reference, build_message_expr, finish_message_expr, build_selector_expr, build_ivar_reference, build_keyword_decl, build_method_decl, build_protocol_expr, build_objc_string_object, objc_declare_alias, objc_declare_class, objc_declare_protocols, objc_comptypes, objc_check_decl, build_encode_expr): Remove prototypes. (imp_count, cat_count): Make GGC-aware. (OBJC_SET_TYPE_NAME): New macro. From-SVN: r87168
2004-09-08 02:49:44 +02:00
UOBJC_SELECTOR_TABLE_decl = start_var_decl (temp, "_OBJC_SELECTOR_TABLE");
1992-01-18 00:15:38 +01:00
}
/* Just a handy wrapper for add_objc_string. */
static tree
build_selector (tree ident)
{
Makefile.in (c-parse.o): Depend on $(C_COMMON_H). [gcc/ChangeLog] 2004-09-07 Ziemowit Laski <zlaski@apple.com> * Makefile.in (c-parse.o): Depend on $(C_COMMON_H). * c-parse.in: Include c-common.h instead of objc-act.h. (ivar_decl_list, ivar_decls, ivar_decl, ivars, ivar_declarator, myparms, myparm): Remove %type declarations. (methodtype, optparms, OBJC_TYPE_QUAL, objc_quals, objc_qual, objc_typename, objc_try_catch_stmt, optellipsis): Add %type declarations. (objc_inherit_code, objc_public_flag): Remove. (typespec_nonreserved_nonattr): Call objc_get_protocol_qualified_type() instead of get_static_reference() and get_protocol_reference(). (stmt_nocomp): Call grokparm() on @catch parameter. (objcdef): Move semantic action to objc_finish_implementation(). (classdef): Move semantic action to objc_start_class_interface(), objc_continue_interface(), objc_finish_interface(), objc_start_class_implementation(), objc_continue_implementation(), objc_start_category_interface() and objc_start_category_implementation(). (protocoldef): Move semantic actions to objc_start_protocol() and objc_finish_interface(). (ivar_decl_list): Remove nonterminal. (visibility_spec): Move semantic actions to objc_set_visibility(). (ivar_decls): Remove assignment to $$. (ivar_decl): Rephrase in terms of component_decl; call objc_add_instance_variable(). (ivars, ivar_declarator): Remove nonterminals. (opt_semi): New nonterminal. (methodtype): Remove semantic actions. (methoddef): Move semantic actions to objc_set_method_type(), objc_start_method_definition() and objc_finish_method_definition(). (methodproto): Move semantic actions to objc_set_method_type() and objc_add_method_declaration(). (methoddecl): Use objc_typename instead of typename; move semantic actions to objc_build_method_signature(). (optarglist, myxdecls, mydecl, myparms, myparm): Remove nonterminals. (optparmlist): Express in terms of optparms and optellipsis. (optparms, optellipsis, objc_qual, objc_quals, objc_typename): New nonterminals. (keyworddecl): Use objc_typename instead of typename. (rid_to_yy): Mark RID_IN, RID_OUT, RID_INOUT, RID_BYCOPY, RID_BYREF and RID_ONEWAY as returning OBJC_TYPE_QUAL to yyparse(). [gcc/objc/ChangeLog] 2004-09-07 Ziemowit Laski <zlaski@apple.com> * Make-lang.in (objc/objc-parse.o): Depend on $(C_COMMON_H) instead of objc/objc-act.h. (objc/objc-act.o): Depend on $(HASHTAB_H). * objc-act.c: Include hashtab.h; in ObjC++ mode, include cp-tree.h and objcp-decl.h instead of c-tree.h. (build_module_descriptor, get_class_ivars, synth_id_with_class_suffix, error_with_ivar, gen_method_decl, gen_declaration, setup_string_decl, build_protocol_template): Adjust prototypes. (build_module_initializer_routine, start_class, continue_class, finish_class, start_method_def, objc_start_function, start_protocol, build_method_decl, objc_add_method, add_instance_variable, build_ivar_reference, is_ivar, is_private, get_super_receiver, build_selector_table_decl, objc_push_parm, objc_get_parm_info, gen_type_name, gen_type_name_0, start_var_decl, finish_var_decl, create_field_decl): New prototypes. (objc_expand_function_end, comp_method_with_proto, objc_expr_last, gen_declaration_1, gen_declarator, is_complex_decl, adorn_decl, define_decl, create_builtin_decl, gen_declspecs): Remove prototypes. (TYPE_ID): Rename to OBJECT_TYPEDEF_NAME. (CLASS_TYPEDEF_NAME): New. (TAG_EXECCLASS): Change from a global variable to a #define. (TAG_RETURN_STRUCT): Delete. (TAG_GNUINIT): New, holds '__objc_gnu_init' name. (objc_inherit_code, objc_public_flag): New, moved from c-parse.in. (string_descriptor): New struct. (string_htab): New hash table. (string_hash, string_eq): New prototypes. (generate_struct_by_value_array): Call create_field_decl() instead of create_builtin_decl(). (objc_init): Do not initialize objc_ellipsis_node or TAG_EXECCLASS; In ObjC++ mode, call cxx_init() instead of c_objc_common_init(). (objc_finish_file): In ObjC++, call instantiate_pending_templates() and cp_finish_file(). (define_decl, get_static_reference, get_protocol_reference, create_builtin_decl): Remove functions. (objc_start_class_interface, objc_start_category_interface, objc_start_protocol, objc_continue_interface, objc_finish_interface, objc_start_class_implementation, objc_start_category_implementation, objc_continue_implementation, objc_finish_implementation, objc_set_visibility, objc_set_method_type, objc_build_method_signature, objc_add_method_declaration, objc_start_method_definition, objc_add_instance_variable, objc_get_protocol_qualified_type, create_field_decl, start_var_decl, finish_var_decl): New functions. (setup_string_decl): Simplify since it is only called once. (synth_module_prologue): Call build_class_template(); predefine 'id' and 'Class' as typedefs; rename 'temp_type' to 'type'; disable debug hooks for duration of function; fix GNU runtime messenger signatures to correspond to reality; forward-declare '__objc_exec_class' for the GNU runtime; call build_selector_table_decl(); in ObjC++ mode, generate 'extern "C" { ... }' wrappers around synthesized declarations; call build_protocol_template() and build_category_template(). (string_hash, string_eq): New functions. (objc_build_string_object): Check metaclass correctness only once; store string literals in hash table. (objc_build_constructor): Do not convert initializer elements; adjust for ObjC++ impedance mismatch. (build_objc_symtab_template): Call create_field_decl() instead of create_builtin_decl(). (init_objc_symtab): Add missing conversion to initializer element. (build_metadata_decl): Call start_var_decl() instead of define_decl(). (generate_objc_symtab_decl): Do not call build_category_template(); call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(). (build_module_descriptor): Call create_field_decl() instead of grokfield(); call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(); always mark module descriptor as used; move GNU runtime-specific functionality to build_module_initializer_routine(). (build_module_initializer_routine): New function, broken off of build_module_descriptor(). (objc_static_init_needed_p, objc_generate_static_init_call): New functions. (generate_static_references, generate_strings, build_selector_translation_table, generate_descriptor_table, generate_ivars_list, generate_dispatch_table, generate_category): Call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(); build a type directly instead of via groktypename(). (build_selector_reference_decl, build_selector_table_decl, build_class_reference_decl, build_protocol_reference, generate_objc_image_info): Call start_var_decl() instead of build_decl(). (build_selector_reference): For GNU runtime, do not call build_selector_reference_decl(). (build_selector, build_typed_selector_reference): Always convert result to the selector type. (add_objc_string): Cast return value to 'char *'. (build_method_prototype_template, build_selector_template, build_method_template): Use actual selector type for fields pointing to selectors. (finish_objc): For GNU runtime, call build_module_initializer_routine() after build_module_descriptor(). (generate_protocol_list, generate_shared_structures): Call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(); build a type directly instead of via groktypename(). (synth_id_with_class_suffix): Return a string. (get_arg_type_list): For instance methods, use the instance type for 'self'; do not call groktypename_in_parm_context(). (build_objc_string_decl): Squash redeclaration errors in ObjC++. (objc_is_class_name): Use OBJC_TYPE_NAME instead of TYPE_NAME; handle RECORD_TYPEs in ObjC as well as ObjC++. (objc_is_id): New function. (objc_is_object_ptr): Return the canonical type node. (objc_get_class_ivars): Simplify using get_class_ivars(). (get_class_ivars): Remove second parameter; create a fresh copy of the ivar list for each call; do not check for existence of super class. (objc_eh_runtime_type): Mark #ifndef OBJCPLUS. (objc_init_exceptions): When using SJLJ-style exceptions, require the use of '-fobjc-exceptions' flag; do not require it for DWARF-style exceptions. (objc_build_exc_ptr, next_sjlj_build_try_catch_finally): Use objc_object_type instead of objc_id_type. (objc_begin_catch_clause): Convert the incoming PARM_DECL into a VAR_DECL before placing it in the appropriate scope; do not call define_decl(); adjust call to c_begin_compound_stmt(); use objc_object_type instead of objc_id_type. (build_next_objc_exception_stuff): Call create_field_decl() instead of create_builtin_decl(); construct type directly instead of calling groktypename(); use OBJC_VOID_AT_END to mark end of function parameters. (build_private_template): Adjust call to get_class_ivars(); build a type directly instead of via groktypename(). (build_protocol_template, build_method_prototype_list_template, build_method_prototype_template, build_category_template, build_selector_template, build_class_template, build_super_template, build_ivar_template, build_ivar_list_template, build_method_list_template, build_method_template): Call create_field_decl() instead of grokfield(). (objc_method_parm_type): Do not call groktypename(). (generate_descriptor_table): Call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(). (generate_method_descriptors, build_protocol_initializer, generate_dispatch_tables, build_category_initializer, build_shared_structure_initializer): Do not call groktypename(). (generate_protocols): Call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(); do not call groktypename(). (error_with_ivar): Remove last parameter. (check_ivars): Do not iterate ovar CLASS_RAW_IVARS lists in addition to CLASS_IVARS lists; adjust calls to error_with_ivar(). (generate_ivar_lists): Convert one of the initializer elements; do not call groktypename(). (get_arg_type_list, start_method_def, gen_method_def): Account for new representation of variable arguments and '...' in Objective-C methods; add Objective-C++ impedance matching code. (is_objc_type_qualifier): Remove function. (adjust_type_for_id_default): Simplify; there is no longer a need to wade through declspecs. (lookup_interface, start_class, continue_class, finish_class, start_method_def, start_protocol, build_method_decl, objc_add_method, add_instance_variable, build_ivar_reference, is_ivar, is_private, get_super_receiver, objc_build_finally_epilogue): Make into static functions. (receiver_is_class_object): Use new IS_CLASS() macro. (objc_build_message_expr): Tweak ObjC++ message argument handling; call objc_finish_message_expr() instead of finish_message_expr(). (finish_message_expr): Rename to objc_finish_message_expr(); use OBJC_TYPE_NAME and OBJC_SET_TYPE_NAME macros instead of TYPE_NAME. call gen_type_name() instead of gen_declaration(); call objc_is_id() instead of using IS_ID and IS_CLASS; Use objc_class_name instead of calling get_identifier("Class"); handle CONVERT_EXPRs in receiver. (build_objc_method_call, warn_with_method): Do not call groktypename(). (build_ivar_reference): Call convert() instead of clobbering in a type. (hash_init): Initialize string_htab hash table. (add_instance_variable): Simplify parameter list; do not call grokfield(); do not populate CLASS_IVARS list. (start_class): Check for the existence of super class, if one was specified. (continue_class): Use CLASS_RAW_IVARS rather than CLASS_IVARS; do not call build_class_template(); adjust call to get_class_ivars(); call build_decl(), pushdecl() and finish_decl() instead of define_decl(). (finish_class): Call build_decl(), pushdecl() and finish_decl() instead of define_decl(). (add_protocols): Use PROTOCOL_BINFO_ELTS for the tree vector size. (start_protocol): Do not call build_protocol_template(); use PROTOCOL_BINFO_ELTS for the tree vector size. (encode_type_qualifiers): Do not handle the 'const' qualifier here. (encode_pointer): Encode 'const char *' as 'r*', for backwards compatibility. (encode_array): Use HOST_WIDE_INT_PRINT_DEC instead of "%ld". (encode_type): Handle the 'const' qualifier here. (objc_parmlist): New global variable, sued by objc_push_parm and objc_get_parm_info(). (objc_push_parm, objc_get_parm_info): New functions. (objc_expr_last): Remove function. (synth_self_and_ucmd_args): For instance methods, use the instance type for 'self'; call objc_push_parm() instead of push_parm_decl(). (start_method_def): Do not call push_scope(), declare_parm_level(), pop_scope(), push_parm_decl(), store_parm_decls() or objc_expr_last(); just use objc_push_parm() and objc_get_parm_info(). (comp_method_with_proto): Remove function. (objc_types_are_equivalent): Strip away indirections before comparing underlying types. (comp_proto_with_proto): Do not call groktypename(); types are no longer in raw declspec format. (objc_start_function): New function. (really_start_method): Call comp_proto_with_proto() instead of comp_method_with_proto(); call objc_start_function() instead of hand-crafting a function declarator. (continue_method_def, objc_expand_function_end): Remove functions. (get_super_receiver): Call objc_get_current_scope() instead of get_current_scope(); reference 'super_class' field (instead of 'class'). (finish_method_def): Rename to objc_finish_method_definition() and add a function decl parameter; move method encoding call from objc_expand_function_end(). (is_complex_decl, adorn_decl, gen_declarator, gen_declspecs, gen_declaration_1): Remove functions. (tmpbuf, RAW_DECLSPEC): Remove. (gen_declaration): Remove second parameter; simplify to deal with TYPE_P nodes instead of raw declspecs. (gen_type_name, gen_type_name_0): New functions. (gen_method_decl): Remove second parameter; call gen_type_name() instead of gen_declaration_1(). (dump_interface): Adjust calls to gen_declaration() and gen_method_decl(); do not allocate a separate string buffer. (init_objc): Allocate a larger string buffer to accommodate dump_interface(); adjust call to build_module_descriptor(); add call to build_module_initializer_routine() for the GNU runtime. (generate_classref_translation_entry): Do not call start_decl(); call finish_var_decl() instead of finish_decl(); call convert() instead of build_c_cast(). * objc-act.h (CLASS_OWN_IVARS): Remove accessor. (CLASS_BINFO_ELTS): Reduce from 6 to 5, now that CLASS_OWN_IVARS is gone. (OCTI_GNU_INIT_DECL, GNU_INIT_decl): New. (OCTI_ELLIPSIS_NODE, objc_ellipsis_node): Remove. (OCTI_ID_ID, id_type, objc_id_id): Rename to OCTI_ID_NAME, objc_object_type and objc_object_name, respectively. (OCTI_CLS_REF, OCTI_CLASS_NAME, objc_class_reference, objc_class_name): New. (IS_CLASS): New macro. (IS_ID, IS_SUPER): Robustify. (OCTI_EXECCLASS_DECL, execclass_decl): New. (finish_file, start_class, continue_class, finish_class, start_method_def, continue_method_def, finish_method_def, start_protocol, finish_protocol, objc_build_throw_stmt, objc_build_try_catch_finally_stmt, objc_build_synchronized_prologue, objc_build_synchronized_epilogue, objc_build_try_prologue, objc_build_try_epilogue, objc_build_catch_stmt, objc_build_catch_epilogue, objc_build_finally_prologue, objc_build_finally_epilogue, is_ivar, is_private, is_public, add_instance_variable, objc_add_method, get_super_receiver, objc_clear_super_receiver, get_class_ivars_from_name, get_class_reference, get_static_reference, get_object_reference, build_message_expr, finish_message_expr, build_selector_expr, build_ivar_reference, build_keyword_decl, build_method_decl, build_protocol_expr, build_objc_string_object, objc_declare_alias, objc_declare_class, objc_declare_protocols, objc_comptypes, objc_check_decl, build_encode_expr): Remove prototypes. (imp_count, cat_count): Make GGC-aware. (OBJC_SET_TYPE_NAME): New macro. From-SVN: r87168
2004-09-08 02:49:44 +02:00
return convert (objc_selector_type,
add_objc_string (ident, meth_var_names));
}
1992-01-18 00:15:38 +01:00
static void
build_selector_translation_table (void)
1992-01-18 00:15:38 +01:00
{
tree chain, initlist = NULL_TREE;
1992-01-18 00:15:38 +01:00
int offset = 0;
Makefile.in (c-parse.o): Depend on $(C_COMMON_H). [gcc/ChangeLog] 2004-09-07 Ziemowit Laski <zlaski@apple.com> * Makefile.in (c-parse.o): Depend on $(C_COMMON_H). * c-parse.in: Include c-common.h instead of objc-act.h. (ivar_decl_list, ivar_decls, ivar_decl, ivars, ivar_declarator, myparms, myparm): Remove %type declarations. (methodtype, optparms, OBJC_TYPE_QUAL, objc_quals, objc_qual, objc_typename, objc_try_catch_stmt, optellipsis): Add %type declarations. (objc_inherit_code, objc_public_flag): Remove. (typespec_nonreserved_nonattr): Call objc_get_protocol_qualified_type() instead of get_static_reference() and get_protocol_reference(). (stmt_nocomp): Call grokparm() on @catch parameter. (objcdef): Move semantic action to objc_finish_implementation(). (classdef): Move semantic action to objc_start_class_interface(), objc_continue_interface(), objc_finish_interface(), objc_start_class_implementation(), objc_continue_implementation(), objc_start_category_interface() and objc_start_category_implementation(). (protocoldef): Move semantic actions to objc_start_protocol() and objc_finish_interface(). (ivar_decl_list): Remove nonterminal. (visibility_spec): Move semantic actions to objc_set_visibility(). (ivar_decls): Remove assignment to $$. (ivar_decl): Rephrase in terms of component_decl; call objc_add_instance_variable(). (ivars, ivar_declarator): Remove nonterminals. (opt_semi): New nonterminal. (methodtype): Remove semantic actions. (methoddef): Move semantic actions to objc_set_method_type(), objc_start_method_definition() and objc_finish_method_definition(). (methodproto): Move semantic actions to objc_set_method_type() and objc_add_method_declaration(). (methoddecl): Use objc_typename instead of typename; move semantic actions to objc_build_method_signature(). (optarglist, myxdecls, mydecl, myparms, myparm): Remove nonterminals. (optparmlist): Express in terms of optparms and optellipsis. (optparms, optellipsis, objc_qual, objc_quals, objc_typename): New nonterminals. (keyworddecl): Use objc_typename instead of typename. (rid_to_yy): Mark RID_IN, RID_OUT, RID_INOUT, RID_BYCOPY, RID_BYREF and RID_ONEWAY as returning OBJC_TYPE_QUAL to yyparse(). [gcc/objc/ChangeLog] 2004-09-07 Ziemowit Laski <zlaski@apple.com> * Make-lang.in (objc/objc-parse.o): Depend on $(C_COMMON_H) instead of objc/objc-act.h. (objc/objc-act.o): Depend on $(HASHTAB_H). * objc-act.c: Include hashtab.h; in ObjC++ mode, include cp-tree.h and objcp-decl.h instead of c-tree.h. (build_module_descriptor, get_class_ivars, synth_id_with_class_suffix, error_with_ivar, gen_method_decl, gen_declaration, setup_string_decl, build_protocol_template): Adjust prototypes. (build_module_initializer_routine, start_class, continue_class, finish_class, start_method_def, objc_start_function, start_protocol, build_method_decl, objc_add_method, add_instance_variable, build_ivar_reference, is_ivar, is_private, get_super_receiver, build_selector_table_decl, objc_push_parm, objc_get_parm_info, gen_type_name, gen_type_name_0, start_var_decl, finish_var_decl, create_field_decl): New prototypes. (objc_expand_function_end, comp_method_with_proto, objc_expr_last, gen_declaration_1, gen_declarator, is_complex_decl, adorn_decl, define_decl, create_builtin_decl, gen_declspecs): Remove prototypes. (TYPE_ID): Rename to OBJECT_TYPEDEF_NAME. (CLASS_TYPEDEF_NAME): New. (TAG_EXECCLASS): Change from a global variable to a #define. (TAG_RETURN_STRUCT): Delete. (TAG_GNUINIT): New, holds '__objc_gnu_init' name. (objc_inherit_code, objc_public_flag): New, moved from c-parse.in. (string_descriptor): New struct. (string_htab): New hash table. (string_hash, string_eq): New prototypes. (generate_struct_by_value_array): Call create_field_decl() instead of create_builtin_decl(). (objc_init): Do not initialize objc_ellipsis_node or TAG_EXECCLASS; In ObjC++ mode, call cxx_init() instead of c_objc_common_init(). (objc_finish_file): In ObjC++, call instantiate_pending_templates() and cp_finish_file(). (define_decl, get_static_reference, get_protocol_reference, create_builtin_decl): Remove functions. (objc_start_class_interface, objc_start_category_interface, objc_start_protocol, objc_continue_interface, objc_finish_interface, objc_start_class_implementation, objc_start_category_implementation, objc_continue_implementation, objc_finish_implementation, objc_set_visibility, objc_set_method_type, objc_build_method_signature, objc_add_method_declaration, objc_start_method_definition, objc_add_instance_variable, objc_get_protocol_qualified_type, create_field_decl, start_var_decl, finish_var_decl): New functions. (setup_string_decl): Simplify since it is only called once. (synth_module_prologue): Call build_class_template(); predefine 'id' and 'Class' as typedefs; rename 'temp_type' to 'type'; disable debug hooks for duration of function; fix GNU runtime messenger signatures to correspond to reality; forward-declare '__objc_exec_class' for the GNU runtime; call build_selector_table_decl(); in ObjC++ mode, generate 'extern "C" { ... }' wrappers around synthesized declarations; call build_protocol_template() and build_category_template(). (string_hash, string_eq): New functions. (objc_build_string_object): Check metaclass correctness only once; store string literals in hash table. (objc_build_constructor): Do not convert initializer elements; adjust for ObjC++ impedance mismatch. (build_objc_symtab_template): Call create_field_decl() instead of create_builtin_decl(). (init_objc_symtab): Add missing conversion to initializer element. (build_metadata_decl): Call start_var_decl() instead of define_decl(). (generate_objc_symtab_decl): Do not call build_category_template(); call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(). (build_module_descriptor): Call create_field_decl() instead of grokfield(); call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(); always mark module descriptor as used; move GNU runtime-specific functionality to build_module_initializer_routine(). (build_module_initializer_routine): New function, broken off of build_module_descriptor(). (objc_static_init_needed_p, objc_generate_static_init_call): New functions. (generate_static_references, generate_strings, build_selector_translation_table, generate_descriptor_table, generate_ivars_list, generate_dispatch_table, generate_category): Call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(); build a type directly instead of via groktypename(). (build_selector_reference_decl, build_selector_table_decl, build_class_reference_decl, build_protocol_reference, generate_objc_image_info): Call start_var_decl() instead of build_decl(). (build_selector_reference): For GNU runtime, do not call build_selector_reference_decl(). (build_selector, build_typed_selector_reference): Always convert result to the selector type. (add_objc_string): Cast return value to 'char *'. (build_method_prototype_template, build_selector_template, build_method_template): Use actual selector type for fields pointing to selectors. (finish_objc): For GNU runtime, call build_module_initializer_routine() after build_module_descriptor(). (generate_protocol_list, generate_shared_structures): Call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(); build a type directly instead of via groktypename(). (synth_id_with_class_suffix): Return a string. (get_arg_type_list): For instance methods, use the instance type for 'self'; do not call groktypename_in_parm_context(). (build_objc_string_decl): Squash redeclaration errors in ObjC++. (objc_is_class_name): Use OBJC_TYPE_NAME instead of TYPE_NAME; handle RECORD_TYPEs in ObjC as well as ObjC++. (objc_is_id): New function. (objc_is_object_ptr): Return the canonical type node. (objc_get_class_ivars): Simplify using get_class_ivars(). (get_class_ivars): Remove second parameter; create a fresh copy of the ivar list for each call; do not check for existence of super class. (objc_eh_runtime_type): Mark #ifndef OBJCPLUS. (objc_init_exceptions): When using SJLJ-style exceptions, require the use of '-fobjc-exceptions' flag; do not require it for DWARF-style exceptions. (objc_build_exc_ptr, next_sjlj_build_try_catch_finally): Use objc_object_type instead of objc_id_type. (objc_begin_catch_clause): Convert the incoming PARM_DECL into a VAR_DECL before placing it in the appropriate scope; do not call define_decl(); adjust call to c_begin_compound_stmt(); use objc_object_type instead of objc_id_type. (build_next_objc_exception_stuff): Call create_field_decl() instead of create_builtin_decl(); construct type directly instead of calling groktypename(); use OBJC_VOID_AT_END to mark end of function parameters. (build_private_template): Adjust call to get_class_ivars(); build a type directly instead of via groktypename(). (build_protocol_template, build_method_prototype_list_template, build_method_prototype_template, build_category_template, build_selector_template, build_class_template, build_super_template, build_ivar_template, build_ivar_list_template, build_method_list_template, build_method_template): Call create_field_decl() instead of grokfield(). (objc_method_parm_type): Do not call groktypename(). (generate_descriptor_table): Call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(). (generate_method_descriptors, build_protocol_initializer, generate_dispatch_tables, build_category_initializer, build_shared_structure_initializer): Do not call groktypename(). (generate_protocols): Call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(); do not call groktypename(). (error_with_ivar): Remove last parameter. (check_ivars): Do not iterate ovar CLASS_RAW_IVARS lists in addition to CLASS_IVARS lists; adjust calls to error_with_ivar(). (generate_ivar_lists): Convert one of the initializer elements; do not call groktypename(). (get_arg_type_list, start_method_def, gen_method_def): Account for new representation of variable arguments and '...' in Objective-C methods; add Objective-C++ impedance matching code. (is_objc_type_qualifier): Remove function. (adjust_type_for_id_default): Simplify; there is no longer a need to wade through declspecs. (lookup_interface, start_class, continue_class, finish_class, start_method_def, start_protocol, build_method_decl, objc_add_method, add_instance_variable, build_ivar_reference, is_ivar, is_private, get_super_receiver, objc_build_finally_epilogue): Make into static functions. (receiver_is_class_object): Use new IS_CLASS() macro. (objc_build_message_expr): Tweak ObjC++ message argument handling; call objc_finish_message_expr() instead of finish_message_expr(). (finish_message_expr): Rename to objc_finish_message_expr(); use OBJC_TYPE_NAME and OBJC_SET_TYPE_NAME macros instead of TYPE_NAME. call gen_type_name() instead of gen_declaration(); call objc_is_id() instead of using IS_ID and IS_CLASS; Use objc_class_name instead of calling get_identifier("Class"); handle CONVERT_EXPRs in receiver. (build_objc_method_call, warn_with_method): Do not call groktypename(). (build_ivar_reference): Call convert() instead of clobbering in a type. (hash_init): Initialize string_htab hash table. (add_instance_variable): Simplify parameter list; do not call grokfield(); do not populate CLASS_IVARS list. (start_class): Check for the existence of super class, if one was specified. (continue_class): Use CLASS_RAW_IVARS rather than CLASS_IVARS; do not call build_class_template(); adjust call to get_class_ivars(); call build_decl(), pushdecl() and finish_decl() instead of define_decl(). (finish_class): Call build_decl(), pushdecl() and finish_decl() instead of define_decl(). (add_protocols): Use PROTOCOL_BINFO_ELTS for the tree vector size. (start_protocol): Do not call build_protocol_template(); use PROTOCOL_BINFO_ELTS for the tree vector size. (encode_type_qualifiers): Do not handle the 'const' qualifier here. (encode_pointer): Encode 'const char *' as 'r*', for backwards compatibility. (encode_array): Use HOST_WIDE_INT_PRINT_DEC instead of "%ld". (encode_type): Handle the 'const' qualifier here. (objc_parmlist): New global variable, sued by objc_push_parm and objc_get_parm_info(). (objc_push_parm, objc_get_parm_info): New functions. (objc_expr_last): Remove function. (synth_self_and_ucmd_args): For instance methods, use the instance type for 'self'; call objc_push_parm() instead of push_parm_decl(). (start_method_def): Do not call push_scope(), declare_parm_level(), pop_scope(), push_parm_decl(), store_parm_decls() or objc_expr_last(); just use objc_push_parm() and objc_get_parm_info(). (comp_method_with_proto): Remove function. (objc_types_are_equivalent): Strip away indirections before comparing underlying types. (comp_proto_with_proto): Do not call groktypename(); types are no longer in raw declspec format. (objc_start_function): New function. (really_start_method): Call comp_proto_with_proto() instead of comp_method_with_proto(); call objc_start_function() instead of hand-crafting a function declarator. (continue_method_def, objc_expand_function_end): Remove functions. (get_super_receiver): Call objc_get_current_scope() instead of get_current_scope(); reference 'super_class' field (instead of 'class'). (finish_method_def): Rename to objc_finish_method_definition() and add a function decl parameter; move method encoding call from objc_expand_function_end(). (is_complex_decl, adorn_decl, gen_declarator, gen_declspecs, gen_declaration_1): Remove functions. (tmpbuf, RAW_DECLSPEC): Remove. (gen_declaration): Remove second parameter; simplify to deal with TYPE_P nodes instead of raw declspecs. (gen_type_name, gen_type_name_0): New functions. (gen_method_decl): Remove second parameter; call gen_type_name() instead of gen_declaration_1(). (dump_interface): Adjust calls to gen_declaration() and gen_method_decl(); do not allocate a separate string buffer. (init_objc): Allocate a larger string buffer to accommodate dump_interface(); adjust call to build_module_descriptor(); add call to build_module_initializer_routine() for the GNU runtime. (generate_classref_translation_entry): Do not call start_decl(); call finish_var_decl() instead of finish_decl(); call convert() instead of build_c_cast(). * objc-act.h (CLASS_OWN_IVARS): Remove accessor. (CLASS_BINFO_ELTS): Reduce from 6 to 5, now that CLASS_OWN_IVARS is gone. (OCTI_GNU_INIT_DECL, GNU_INIT_decl): New. (OCTI_ELLIPSIS_NODE, objc_ellipsis_node): Remove. (OCTI_ID_ID, id_type, objc_id_id): Rename to OCTI_ID_NAME, objc_object_type and objc_object_name, respectively. (OCTI_CLS_REF, OCTI_CLASS_NAME, objc_class_reference, objc_class_name): New. (IS_CLASS): New macro. (IS_ID, IS_SUPER): Robustify. (OCTI_EXECCLASS_DECL, execclass_decl): New. (finish_file, start_class, continue_class, finish_class, start_method_def, continue_method_def, finish_method_def, start_protocol, finish_protocol, objc_build_throw_stmt, objc_build_try_catch_finally_stmt, objc_build_synchronized_prologue, objc_build_synchronized_epilogue, objc_build_try_prologue, objc_build_try_epilogue, objc_build_catch_stmt, objc_build_catch_epilogue, objc_build_finally_prologue, objc_build_finally_epilogue, is_ivar, is_private, is_public, add_instance_variable, objc_add_method, get_super_receiver, objc_clear_super_receiver, get_class_ivars_from_name, get_class_reference, get_static_reference, get_object_reference, build_message_expr, finish_message_expr, build_selector_expr, build_ivar_reference, build_keyword_decl, build_method_decl, build_protocol_expr, build_objc_string_object, objc_declare_alias, objc_declare_class, objc_declare_protocols, objc_comptypes, objc_check_decl, build_encode_expr): Remove prototypes. (imp_count, cat_count): Make GGC-aware. (OBJC_SET_TYPE_NAME): New macro. From-SVN: r87168
2004-09-08 02:49:44 +02:00
tree decl = NULL_TREE;
1992-01-18 00:15:38 +01:00
for (chain = sel_ref_chain; chain; chain = TREE_CHAIN (chain))
{
tree expr;
if (warn_selector && objc_implementation_context)
{
tree method_chain;
bool found = false;
for (method_chain = meth_var_names_chain;
method_chain;
method_chain = TREE_CHAIN (method_chain))
{
if (TREE_VALUE (method_chain) == TREE_VALUE (chain))
{
found = true;
break;
}
}
if (!found)
{
location_t *loc;
if (flag_next_runtime && TREE_PURPOSE (chain))
loc = &DECL_SOURCE_LOCATION (TREE_PURPOSE (chain));
else
loc = &input_location;
diagnostic.c (warning): Accept parameter to classify warning option. * diagnostic.c (warning): Accept parameter to classify warning option. (warning0): New, for when a pointer to an error() like function is needed. * errors.c (warning): Likewise. * errors.h (warning, warning0): Adjust prototypes. * toplev.h (warning, warning0): Likewise. * attribs.c, builtins.c, c-common.c, c-decl.c, c-format.c, c-gimplify.c, c-lex.c, c-objc-common.c, c-opts.c, c-parser.c, c-pragma.c, c-typeck.c, calls.c, cgraph.c, coverage.c, emit-rtl.c, fold-const.c, fortran/trans-decl.c, function.c, gcse.c, genautomata.c, haifa-sched.c, opts.c, passes.c, regclass.c, reload1.c, stmt.c, stor-layout.c, toplev.c, tree-cfg.c, tree-dump.c, tree-inline.c, tree-mudflap.c, tree-optimize.c, tree-ssa.c, tree.c, varasm.c: Adjust warning() callers. * config/alpha/alpha.c, config/arc/arc.c, config/arm/arm.c, config/avr/avr.c, config/bfin/bfin.c, config/c4x/c4x-c.c, config/c4x/c4x.c, config/cris/cris.c, config/darwin-c.c, config/darwin.c, config/darwin.h, config/h8300/h8300.c, config/i386/cygming.h, config/i386/djgpp.h, config/i386/i386.c, config/i386/winnt.c, config/ia64/ia64-c.c, config/ia64/ia64.c, config/ip2k/ip2k.c, config/m32r/m32r.c, config/m68hc11/m68hc11.c, config/m68k/m68k.c, config/mcore/mcore.c, config/mips/mips.c, config/mmix/mmix.c, config/ns32k/ns32k.c, config/pa/pa-hpux11.h, config/pa/pa.c, config/rs6000/aix43.h, config/rs6000/aix51.h, config/rs6000/aix52.h, config/rs6000/darwin.h, config/rs6000/rs6000-c.c, config/rs6000/rs6000.c, config/s390/s390.c, config/sh/sh.c, config/sh/sh.h, config/sh/symbian.c, config/sol2-c.c, config/sol2.c, config/stormy16/stormy16.c, config/v850/v850-c.c, config/v850/v850.c, config/xtensa/xtensa.c: Adjust warning() callers. * ada/misc.c: Adjust warning() callers. * cp/call.c, cp/class.c, cp/cvt.c, cp/decl.c, cp/decl2.c, cp/except.c, cp/friend.c, cp/init.c, cp/lex.c, cp/mangle.c, cp/method.c, cp/name-lookup.c, cp/parser.c, cp/repo.c, cp/rtti.c, cp/tree.c, cp/typeck.c, cp/typeck2.c: Adjust warning() callers. * fortran/trans-decl.c: Adjust warning() callers. * java/class.c, java/decl.c, java/expr.c, java/jcf-io.c, java/jcf-parse.c, java/jv-scan.c, java/parse.y: Adjust warning() callers. * objc/objc-act.c: Adjust warning() callers. * treelang/parse.y: Adjust warning() callers. From-SVN: r98633
2005-04-23 23:29:07 +02:00
warning (0, "%Hcreating selector for nonexistent method %qE",
loc, TREE_VALUE (chain));
}
}
expr = build_selector (TREE_VALUE (chain));
1992-01-18 00:15:38 +01:00
/* add one for the '\0' character */
offset += IDENTIFIER_LENGTH (TREE_VALUE (chain)) + 1;
if (flag_next_runtime)
Makefile.in (c-parse.o): Depend on $(C_COMMON_H). [gcc/ChangeLog] 2004-09-07 Ziemowit Laski <zlaski@apple.com> * Makefile.in (c-parse.o): Depend on $(C_COMMON_H). * c-parse.in: Include c-common.h instead of objc-act.h. (ivar_decl_list, ivar_decls, ivar_decl, ivars, ivar_declarator, myparms, myparm): Remove %type declarations. (methodtype, optparms, OBJC_TYPE_QUAL, objc_quals, objc_qual, objc_typename, objc_try_catch_stmt, optellipsis): Add %type declarations. (objc_inherit_code, objc_public_flag): Remove. (typespec_nonreserved_nonattr): Call objc_get_protocol_qualified_type() instead of get_static_reference() and get_protocol_reference(). (stmt_nocomp): Call grokparm() on @catch parameter. (objcdef): Move semantic action to objc_finish_implementation(). (classdef): Move semantic action to objc_start_class_interface(), objc_continue_interface(), objc_finish_interface(), objc_start_class_implementation(), objc_continue_implementation(), objc_start_category_interface() and objc_start_category_implementation(). (protocoldef): Move semantic actions to objc_start_protocol() and objc_finish_interface(). (ivar_decl_list): Remove nonterminal. (visibility_spec): Move semantic actions to objc_set_visibility(). (ivar_decls): Remove assignment to $$. (ivar_decl): Rephrase in terms of component_decl; call objc_add_instance_variable(). (ivars, ivar_declarator): Remove nonterminals. (opt_semi): New nonterminal. (methodtype): Remove semantic actions. (methoddef): Move semantic actions to objc_set_method_type(), objc_start_method_definition() and objc_finish_method_definition(). (methodproto): Move semantic actions to objc_set_method_type() and objc_add_method_declaration(). (methoddecl): Use objc_typename instead of typename; move semantic actions to objc_build_method_signature(). (optarglist, myxdecls, mydecl, myparms, myparm): Remove nonterminals. (optparmlist): Express in terms of optparms and optellipsis. (optparms, optellipsis, objc_qual, objc_quals, objc_typename): New nonterminals. (keyworddecl): Use objc_typename instead of typename. (rid_to_yy): Mark RID_IN, RID_OUT, RID_INOUT, RID_BYCOPY, RID_BYREF and RID_ONEWAY as returning OBJC_TYPE_QUAL to yyparse(). [gcc/objc/ChangeLog] 2004-09-07 Ziemowit Laski <zlaski@apple.com> * Make-lang.in (objc/objc-parse.o): Depend on $(C_COMMON_H) instead of objc/objc-act.h. (objc/objc-act.o): Depend on $(HASHTAB_H). * objc-act.c: Include hashtab.h; in ObjC++ mode, include cp-tree.h and objcp-decl.h instead of c-tree.h. (build_module_descriptor, get_class_ivars, synth_id_with_class_suffix, error_with_ivar, gen_method_decl, gen_declaration, setup_string_decl, build_protocol_template): Adjust prototypes. (build_module_initializer_routine, start_class, continue_class, finish_class, start_method_def, objc_start_function, start_protocol, build_method_decl, objc_add_method, add_instance_variable, build_ivar_reference, is_ivar, is_private, get_super_receiver, build_selector_table_decl, objc_push_parm, objc_get_parm_info, gen_type_name, gen_type_name_0, start_var_decl, finish_var_decl, create_field_decl): New prototypes. (objc_expand_function_end, comp_method_with_proto, objc_expr_last, gen_declaration_1, gen_declarator, is_complex_decl, adorn_decl, define_decl, create_builtin_decl, gen_declspecs): Remove prototypes. (TYPE_ID): Rename to OBJECT_TYPEDEF_NAME. (CLASS_TYPEDEF_NAME): New. (TAG_EXECCLASS): Change from a global variable to a #define. (TAG_RETURN_STRUCT): Delete. (TAG_GNUINIT): New, holds '__objc_gnu_init' name. (objc_inherit_code, objc_public_flag): New, moved from c-parse.in. (string_descriptor): New struct. (string_htab): New hash table. (string_hash, string_eq): New prototypes. (generate_struct_by_value_array): Call create_field_decl() instead of create_builtin_decl(). (objc_init): Do not initialize objc_ellipsis_node or TAG_EXECCLASS; In ObjC++ mode, call cxx_init() instead of c_objc_common_init(). (objc_finish_file): In ObjC++, call instantiate_pending_templates() and cp_finish_file(). (define_decl, get_static_reference, get_protocol_reference, create_builtin_decl): Remove functions. (objc_start_class_interface, objc_start_category_interface, objc_start_protocol, objc_continue_interface, objc_finish_interface, objc_start_class_implementation, objc_start_category_implementation, objc_continue_implementation, objc_finish_implementation, objc_set_visibility, objc_set_method_type, objc_build_method_signature, objc_add_method_declaration, objc_start_method_definition, objc_add_instance_variable, objc_get_protocol_qualified_type, create_field_decl, start_var_decl, finish_var_decl): New functions. (setup_string_decl): Simplify since it is only called once. (synth_module_prologue): Call build_class_template(); predefine 'id' and 'Class' as typedefs; rename 'temp_type' to 'type'; disable debug hooks for duration of function; fix GNU runtime messenger signatures to correspond to reality; forward-declare '__objc_exec_class' for the GNU runtime; call build_selector_table_decl(); in ObjC++ mode, generate 'extern "C" { ... }' wrappers around synthesized declarations; call build_protocol_template() and build_category_template(). (string_hash, string_eq): New functions. (objc_build_string_object): Check metaclass correctness only once; store string literals in hash table. (objc_build_constructor): Do not convert initializer elements; adjust for ObjC++ impedance mismatch. (build_objc_symtab_template): Call create_field_decl() instead of create_builtin_decl(). (init_objc_symtab): Add missing conversion to initializer element. (build_metadata_decl): Call start_var_decl() instead of define_decl(). (generate_objc_symtab_decl): Do not call build_category_template(); call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(). (build_module_descriptor): Call create_field_decl() instead of grokfield(); call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(); always mark module descriptor as used; move GNU runtime-specific functionality to build_module_initializer_routine(). (build_module_initializer_routine): New function, broken off of build_module_descriptor(). (objc_static_init_needed_p, objc_generate_static_init_call): New functions. (generate_static_references, generate_strings, build_selector_translation_table, generate_descriptor_table, generate_ivars_list, generate_dispatch_table, generate_category): Call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(); build a type directly instead of via groktypename(). (build_selector_reference_decl, build_selector_table_decl, build_class_reference_decl, build_protocol_reference, generate_objc_image_info): Call start_var_decl() instead of build_decl(). (build_selector_reference): For GNU runtime, do not call build_selector_reference_decl(). (build_selector, build_typed_selector_reference): Always convert result to the selector type. (add_objc_string): Cast return value to 'char *'. (build_method_prototype_template, build_selector_template, build_method_template): Use actual selector type for fields pointing to selectors. (finish_objc): For GNU runtime, call build_module_initializer_routine() after build_module_descriptor(). (generate_protocol_list, generate_shared_structures): Call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(); build a type directly instead of via groktypename(). (synth_id_with_class_suffix): Return a string. (get_arg_type_list): For instance methods, use the instance type for 'self'; do not call groktypename_in_parm_context(). (build_objc_string_decl): Squash redeclaration errors in ObjC++. (objc_is_class_name): Use OBJC_TYPE_NAME instead of TYPE_NAME; handle RECORD_TYPEs in ObjC as well as ObjC++. (objc_is_id): New function. (objc_is_object_ptr): Return the canonical type node. (objc_get_class_ivars): Simplify using get_class_ivars(). (get_class_ivars): Remove second parameter; create a fresh copy of the ivar list for each call; do not check for existence of super class. (objc_eh_runtime_type): Mark #ifndef OBJCPLUS. (objc_init_exceptions): When using SJLJ-style exceptions, require the use of '-fobjc-exceptions' flag; do not require it for DWARF-style exceptions. (objc_build_exc_ptr, next_sjlj_build_try_catch_finally): Use objc_object_type instead of objc_id_type. (objc_begin_catch_clause): Convert the incoming PARM_DECL into a VAR_DECL before placing it in the appropriate scope; do not call define_decl(); adjust call to c_begin_compound_stmt(); use objc_object_type instead of objc_id_type. (build_next_objc_exception_stuff): Call create_field_decl() instead of create_builtin_decl(); construct type directly instead of calling groktypename(); use OBJC_VOID_AT_END to mark end of function parameters. (build_private_template): Adjust call to get_class_ivars(); build a type directly instead of via groktypename(). (build_protocol_template, build_method_prototype_list_template, build_method_prototype_template, build_category_template, build_selector_template, build_class_template, build_super_template, build_ivar_template, build_ivar_list_template, build_method_list_template, build_method_template): Call create_field_decl() instead of grokfield(). (objc_method_parm_type): Do not call groktypename(). (generate_descriptor_table): Call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(). (generate_method_descriptors, build_protocol_initializer, generate_dispatch_tables, build_category_initializer, build_shared_structure_initializer): Do not call groktypename(). (generate_protocols): Call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(); do not call groktypename(). (error_with_ivar): Remove last parameter. (check_ivars): Do not iterate ovar CLASS_RAW_IVARS lists in addition to CLASS_IVARS lists; adjust calls to error_with_ivar(). (generate_ivar_lists): Convert one of the initializer elements; do not call groktypename(). (get_arg_type_list, start_method_def, gen_method_def): Account for new representation of variable arguments and '...' in Objective-C methods; add Objective-C++ impedance matching code. (is_objc_type_qualifier): Remove function. (adjust_type_for_id_default): Simplify; there is no longer a need to wade through declspecs. (lookup_interface, start_class, continue_class, finish_class, start_method_def, start_protocol, build_method_decl, objc_add_method, add_instance_variable, build_ivar_reference, is_ivar, is_private, get_super_receiver, objc_build_finally_epilogue): Make into static functions. (receiver_is_class_object): Use new IS_CLASS() macro. (objc_build_message_expr): Tweak ObjC++ message argument handling; call objc_finish_message_expr() instead of finish_message_expr(). (finish_message_expr): Rename to objc_finish_message_expr(); use OBJC_TYPE_NAME and OBJC_SET_TYPE_NAME macros instead of TYPE_NAME. call gen_type_name() instead of gen_declaration(); call objc_is_id() instead of using IS_ID and IS_CLASS; Use objc_class_name instead of calling get_identifier("Class"); handle CONVERT_EXPRs in receiver. (build_objc_method_call, warn_with_method): Do not call groktypename(). (build_ivar_reference): Call convert() instead of clobbering in a type. (hash_init): Initialize string_htab hash table. (add_instance_variable): Simplify parameter list; do not call grokfield(); do not populate CLASS_IVARS list. (start_class): Check for the existence of super class, if one was specified. (continue_class): Use CLASS_RAW_IVARS rather than CLASS_IVARS; do not call build_class_template(); adjust call to get_class_ivars(); call build_decl(), pushdecl() and finish_decl() instead of define_decl(). (finish_class): Call build_decl(), pushdecl() and finish_decl() instead of define_decl(). (add_protocols): Use PROTOCOL_BINFO_ELTS for the tree vector size. (start_protocol): Do not call build_protocol_template(); use PROTOCOL_BINFO_ELTS for the tree vector size. (encode_type_qualifiers): Do not handle the 'const' qualifier here. (encode_pointer): Encode 'const char *' as 'r*', for backwards compatibility. (encode_array): Use HOST_WIDE_INT_PRINT_DEC instead of "%ld". (encode_type): Handle the 'const' qualifier here. (objc_parmlist): New global variable, sued by objc_push_parm and objc_get_parm_info(). (objc_push_parm, objc_get_parm_info): New functions. (objc_expr_last): Remove function. (synth_self_and_ucmd_args): For instance methods, use the instance type for 'self'; call objc_push_parm() instead of push_parm_decl(). (start_method_def): Do not call push_scope(), declare_parm_level(), pop_scope(), push_parm_decl(), store_parm_decls() or objc_expr_last(); just use objc_push_parm() and objc_get_parm_info(). (comp_method_with_proto): Remove function. (objc_types_are_equivalent): Strip away indirections before comparing underlying types. (comp_proto_with_proto): Do not call groktypename(); types are no longer in raw declspec format. (objc_start_function): New function. (really_start_method): Call comp_proto_with_proto() instead of comp_method_with_proto(); call objc_start_function() instead of hand-crafting a function declarator. (continue_method_def, objc_expand_function_end): Remove functions. (get_super_receiver): Call objc_get_current_scope() instead of get_current_scope(); reference 'super_class' field (instead of 'class'). (finish_method_def): Rename to objc_finish_method_definition() and add a function decl parameter; move method encoding call from objc_expand_function_end(). (is_complex_decl, adorn_decl, gen_declarator, gen_declspecs, gen_declaration_1): Remove functions. (tmpbuf, RAW_DECLSPEC): Remove. (gen_declaration): Remove second parameter; simplify to deal with TYPE_P nodes instead of raw declspecs. (gen_type_name, gen_type_name_0): New functions. (gen_method_decl): Remove second parameter; call gen_type_name() instead of gen_declaration_1(). (dump_interface): Adjust calls to gen_declaration() and gen_method_decl(); do not allocate a separate string buffer. (init_objc): Allocate a larger string buffer to accommodate dump_interface(); adjust call to build_module_descriptor(); add call to build_module_initializer_routine() for the GNU runtime. (generate_classref_translation_entry): Do not call start_decl(); call finish_var_decl() instead of finish_decl(); call convert() instead of build_c_cast(). * objc-act.h (CLASS_OWN_IVARS): Remove accessor. (CLASS_BINFO_ELTS): Reduce from 6 to 5, now that CLASS_OWN_IVARS is gone. (OCTI_GNU_INIT_DECL, GNU_INIT_decl): New. (OCTI_ELLIPSIS_NODE, objc_ellipsis_node): Remove. (OCTI_ID_ID, id_type, objc_id_id): Rename to OCTI_ID_NAME, objc_object_type and objc_object_name, respectively. (OCTI_CLS_REF, OCTI_CLASS_NAME, objc_class_reference, objc_class_name): New. (IS_CLASS): New macro. (IS_ID, IS_SUPER): Robustify. (OCTI_EXECCLASS_DECL, execclass_decl): New. (finish_file, start_class, continue_class, finish_class, start_method_def, continue_method_def, finish_method_def, start_protocol, finish_protocol, objc_build_throw_stmt, objc_build_try_catch_finally_stmt, objc_build_synchronized_prologue, objc_build_synchronized_epilogue, objc_build_try_prologue, objc_build_try_epilogue, objc_build_catch_stmt, objc_build_catch_epilogue, objc_build_finally_prologue, objc_build_finally_epilogue, is_ivar, is_private, is_public, add_instance_variable, objc_add_method, get_super_receiver, objc_clear_super_receiver, get_class_ivars_from_name, get_class_reference, get_static_reference, get_object_reference, build_message_expr, finish_message_expr, build_selector_expr, build_ivar_reference, build_keyword_decl, build_method_decl, build_protocol_expr, build_objc_string_object, objc_declare_alias, objc_declare_class, objc_declare_protocols, objc_comptypes, objc_check_decl, build_encode_expr): Remove prototypes. (imp_count, cat_count): Make GGC-aware. (OBJC_SET_TYPE_NAME): New macro. From-SVN: r87168
2004-09-08 02:49:44 +02:00
{
decl = TREE_PURPOSE (chain);
finish_var_decl (decl, expr);
}
else
{
if (flag_typed_selectors)
{
tree eltlist = NULL_TREE;
tree encoding = get_proto_encoding (TREE_PURPOSE (chain));
eltlist = tree_cons (NULL_TREE, expr, NULL_TREE);
eltlist = tree_cons (NULL_TREE, encoding, eltlist);
tree.c (build_constructor): New function. * tree.c (build_constructor): New function. * tree.h: Prototype it. * c-typeck.c (build_c_cast, pop_init_level) * profile.c (build_function_info_value, build_gcov_info_value) (create_profiler): Use build_constructor. * builtins.c (expand_builtin_args_info): Remove #if 0 blocks. * objc/objc-act.c (build_constructor): Rename objc_build_constructor. Use build_constructor. (build_objc_string_object, objc_add_static_instance) (init_def_list, init_objc_symtab, init_module_descriptor) (generate_static_references, build_selector_translation_table) (build_descriptor_table_initializer, generate_descriptor_table) (build_protocol_initializer, build_ivar_list_initializer) (generate_ivars_list, build_dispatch_table_initializer) (generate_dispatch_table, generate_protocol_list) (build_category_initializer, build_shared_structure_initializer): Update to match. ada: * gigi.h, utils2.c (build_constructor): Rename gnat_build_constructor. Use build_constructor. * decl.c (gnat_to_gnu_entity) * trans.c (tree_transform, pos_to_constructor, extract_values) * ada/utils.c (build_template, convert_to_fat_pointer, convert) (unchecked_convert) * ada/utils2.c (build_binary_op, build_call_raise, build_allocator) (fill_vms_descriptor): Update to match. cp: * class.c (initialize_array) * decl.c (reshape_init) * decl2.c (build_expr_from_tree) * init.c (build_zero_init) * pt.c (tsubst_copy, tsubst_copy_and_build) * rtti.c (tinfo_base_init, generic_initializer, ptr_initializer) (ptm_initializer, class_initializer, get_pseudo_ti_init) * semantics.c (finish_compound_literal) * typeck.c (build_ptrmemfunc1) * typeck2.c (store_init_value, process_init_constructor) (build_functional_cast): Use build_constructor. f: * com.c (ffecom_build_complex_constant_, ffecom_expr_) (ffecom_init_zero_, ffecom_transform_namelist_, ffecom_vardesc_) (ffecom_vardesc_array_, ffecom_vardesc_dims_, ffecom_2) * ste.c (ffeste_io_ialist_, ffeste_io_cilist_, ffeste_io_cllist_) (ffeste_io_icilist_, ffeste_io_inlist_, ffeste_io_olist_): Use build_constructor. java: * class.c (make_field_value, make_method_value, get_dispatch_table) (make_class_data, emit_offset_symbol_table) * constants.c (build_constants_constructor) * java-tree.h (START_RECORD_CONSTRUCTOR) * parse.y (maybe_build_array_element_wfl): Use build_constructor. From-SVN: r65539
2003-04-13 03:45:35 +02:00
expr = objc_build_constructor (objc_selector_template,
nreverse (eltlist));
}
Makefile.in (c-parse.o): Depend on $(C_COMMON_H). [gcc/ChangeLog] 2004-09-07 Ziemowit Laski <zlaski@apple.com> * Makefile.in (c-parse.o): Depend on $(C_COMMON_H). * c-parse.in: Include c-common.h instead of objc-act.h. (ivar_decl_list, ivar_decls, ivar_decl, ivars, ivar_declarator, myparms, myparm): Remove %type declarations. (methodtype, optparms, OBJC_TYPE_QUAL, objc_quals, objc_qual, objc_typename, objc_try_catch_stmt, optellipsis): Add %type declarations. (objc_inherit_code, objc_public_flag): Remove. (typespec_nonreserved_nonattr): Call objc_get_protocol_qualified_type() instead of get_static_reference() and get_protocol_reference(). (stmt_nocomp): Call grokparm() on @catch parameter. (objcdef): Move semantic action to objc_finish_implementation(). (classdef): Move semantic action to objc_start_class_interface(), objc_continue_interface(), objc_finish_interface(), objc_start_class_implementation(), objc_continue_implementation(), objc_start_category_interface() and objc_start_category_implementation(). (protocoldef): Move semantic actions to objc_start_protocol() and objc_finish_interface(). (ivar_decl_list): Remove nonterminal. (visibility_spec): Move semantic actions to objc_set_visibility(). (ivar_decls): Remove assignment to $$. (ivar_decl): Rephrase in terms of component_decl; call objc_add_instance_variable(). (ivars, ivar_declarator): Remove nonterminals. (opt_semi): New nonterminal. (methodtype): Remove semantic actions. (methoddef): Move semantic actions to objc_set_method_type(), objc_start_method_definition() and objc_finish_method_definition(). (methodproto): Move semantic actions to objc_set_method_type() and objc_add_method_declaration(). (methoddecl): Use objc_typename instead of typename; move semantic actions to objc_build_method_signature(). (optarglist, myxdecls, mydecl, myparms, myparm): Remove nonterminals. (optparmlist): Express in terms of optparms and optellipsis. (optparms, optellipsis, objc_qual, objc_quals, objc_typename): New nonterminals. (keyworddecl): Use objc_typename instead of typename. (rid_to_yy): Mark RID_IN, RID_OUT, RID_INOUT, RID_BYCOPY, RID_BYREF and RID_ONEWAY as returning OBJC_TYPE_QUAL to yyparse(). [gcc/objc/ChangeLog] 2004-09-07 Ziemowit Laski <zlaski@apple.com> * Make-lang.in (objc/objc-parse.o): Depend on $(C_COMMON_H) instead of objc/objc-act.h. (objc/objc-act.o): Depend on $(HASHTAB_H). * objc-act.c: Include hashtab.h; in ObjC++ mode, include cp-tree.h and objcp-decl.h instead of c-tree.h. (build_module_descriptor, get_class_ivars, synth_id_with_class_suffix, error_with_ivar, gen_method_decl, gen_declaration, setup_string_decl, build_protocol_template): Adjust prototypes. (build_module_initializer_routine, start_class, continue_class, finish_class, start_method_def, objc_start_function, start_protocol, build_method_decl, objc_add_method, add_instance_variable, build_ivar_reference, is_ivar, is_private, get_super_receiver, build_selector_table_decl, objc_push_parm, objc_get_parm_info, gen_type_name, gen_type_name_0, start_var_decl, finish_var_decl, create_field_decl): New prototypes. (objc_expand_function_end, comp_method_with_proto, objc_expr_last, gen_declaration_1, gen_declarator, is_complex_decl, adorn_decl, define_decl, create_builtin_decl, gen_declspecs): Remove prototypes. (TYPE_ID): Rename to OBJECT_TYPEDEF_NAME. (CLASS_TYPEDEF_NAME): New. (TAG_EXECCLASS): Change from a global variable to a #define. (TAG_RETURN_STRUCT): Delete. (TAG_GNUINIT): New, holds '__objc_gnu_init' name. (objc_inherit_code, objc_public_flag): New, moved from c-parse.in. (string_descriptor): New struct. (string_htab): New hash table. (string_hash, string_eq): New prototypes. (generate_struct_by_value_array): Call create_field_decl() instead of create_builtin_decl(). (objc_init): Do not initialize objc_ellipsis_node or TAG_EXECCLASS; In ObjC++ mode, call cxx_init() instead of c_objc_common_init(). (objc_finish_file): In ObjC++, call instantiate_pending_templates() and cp_finish_file(). (define_decl, get_static_reference, get_protocol_reference, create_builtin_decl): Remove functions. (objc_start_class_interface, objc_start_category_interface, objc_start_protocol, objc_continue_interface, objc_finish_interface, objc_start_class_implementation, objc_start_category_implementation, objc_continue_implementation, objc_finish_implementation, objc_set_visibility, objc_set_method_type, objc_build_method_signature, objc_add_method_declaration, objc_start_method_definition, objc_add_instance_variable, objc_get_protocol_qualified_type, create_field_decl, start_var_decl, finish_var_decl): New functions. (setup_string_decl): Simplify since it is only called once. (synth_module_prologue): Call build_class_template(); predefine 'id' and 'Class' as typedefs; rename 'temp_type' to 'type'; disable debug hooks for duration of function; fix GNU runtime messenger signatures to correspond to reality; forward-declare '__objc_exec_class' for the GNU runtime; call build_selector_table_decl(); in ObjC++ mode, generate 'extern "C" { ... }' wrappers around synthesized declarations; call build_protocol_template() and build_category_template(). (string_hash, string_eq): New functions. (objc_build_string_object): Check metaclass correctness only once; store string literals in hash table. (objc_build_constructor): Do not convert initializer elements; adjust for ObjC++ impedance mismatch. (build_objc_symtab_template): Call create_field_decl() instead of create_builtin_decl(). (init_objc_symtab): Add missing conversion to initializer element. (build_metadata_decl): Call start_var_decl() instead of define_decl(). (generate_objc_symtab_decl): Do not call build_category_template(); call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(). (build_module_descriptor): Call create_field_decl() instead of grokfield(); call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(); always mark module descriptor as used; move GNU runtime-specific functionality to build_module_initializer_routine(). (build_module_initializer_routine): New function, broken off of build_module_descriptor(). (objc_static_init_needed_p, objc_generate_static_init_call): New functions. (generate_static_references, generate_strings, build_selector_translation_table, generate_descriptor_table, generate_ivars_list, generate_dispatch_table, generate_category): Call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(); build a type directly instead of via groktypename(). (build_selector_reference_decl, build_selector_table_decl, build_class_reference_decl, build_protocol_reference, generate_objc_image_info): Call start_var_decl() instead of build_decl(). (build_selector_reference): For GNU runtime, do not call build_selector_reference_decl(). (build_selector, build_typed_selector_reference): Always convert result to the selector type. (add_objc_string): Cast return value to 'char *'. (build_method_prototype_template, build_selector_template, build_method_template): Use actual selector type for fields pointing to selectors. (finish_objc): For GNU runtime, call build_module_initializer_routine() after build_module_descriptor(). (generate_protocol_list, generate_shared_structures): Call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(); build a type directly instead of via groktypename(). (synth_id_with_class_suffix): Return a string. (get_arg_type_list): For instance methods, use the instance type for 'self'; do not call groktypename_in_parm_context(). (build_objc_string_decl): Squash redeclaration errors in ObjC++. (objc_is_class_name): Use OBJC_TYPE_NAME instead of TYPE_NAME; handle RECORD_TYPEs in ObjC as well as ObjC++. (objc_is_id): New function. (objc_is_object_ptr): Return the canonical type node. (objc_get_class_ivars): Simplify using get_class_ivars(). (get_class_ivars): Remove second parameter; create a fresh copy of the ivar list for each call; do not check for existence of super class. (objc_eh_runtime_type): Mark #ifndef OBJCPLUS. (objc_init_exceptions): When using SJLJ-style exceptions, require the use of '-fobjc-exceptions' flag; do not require it for DWARF-style exceptions. (objc_build_exc_ptr, next_sjlj_build_try_catch_finally): Use objc_object_type instead of objc_id_type. (objc_begin_catch_clause): Convert the incoming PARM_DECL into a VAR_DECL before placing it in the appropriate scope; do not call define_decl(); adjust call to c_begin_compound_stmt(); use objc_object_type instead of objc_id_type. (build_next_objc_exception_stuff): Call create_field_decl() instead of create_builtin_decl(); construct type directly instead of calling groktypename(); use OBJC_VOID_AT_END to mark end of function parameters. (build_private_template): Adjust call to get_class_ivars(); build a type directly instead of via groktypename(). (build_protocol_template, build_method_prototype_list_template, build_method_prototype_template, build_category_template, build_selector_template, build_class_template, build_super_template, build_ivar_template, build_ivar_list_template, build_method_list_template, build_method_template): Call create_field_decl() instead of grokfield(). (objc_method_parm_type): Do not call groktypename(). (generate_descriptor_table): Call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(). (generate_method_descriptors, build_protocol_initializer, generate_dispatch_tables, build_category_initializer, build_shared_structure_initializer): Do not call groktypename(). (generate_protocols): Call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(); do not call groktypename(). (error_with_ivar): Remove last parameter. (check_ivars): Do not iterate ovar CLASS_RAW_IVARS lists in addition to CLASS_IVARS lists; adjust calls to error_with_ivar(). (generate_ivar_lists): Convert one of the initializer elements; do not call groktypename(). (get_arg_type_list, start_method_def, gen_method_def): Account for new representation of variable arguments and '...' in Objective-C methods; add Objective-C++ impedance matching code. (is_objc_type_qualifier): Remove function. (adjust_type_for_id_default): Simplify; there is no longer a need to wade through declspecs. (lookup_interface, start_class, continue_class, finish_class, start_method_def, start_protocol, build_method_decl, objc_add_method, add_instance_variable, build_ivar_reference, is_ivar, is_private, get_super_receiver, objc_build_finally_epilogue): Make into static functions. (receiver_is_class_object): Use new IS_CLASS() macro. (objc_build_message_expr): Tweak ObjC++ message argument handling; call objc_finish_message_expr() instead of finish_message_expr(). (finish_message_expr): Rename to objc_finish_message_expr(); use OBJC_TYPE_NAME and OBJC_SET_TYPE_NAME macros instead of TYPE_NAME. call gen_type_name() instead of gen_declaration(); call objc_is_id() instead of using IS_ID and IS_CLASS; Use objc_class_name instead of calling get_identifier("Class"); handle CONVERT_EXPRs in receiver. (build_objc_method_call, warn_with_method): Do not call groktypename(). (build_ivar_reference): Call convert() instead of clobbering in a type. (hash_init): Initialize string_htab hash table. (add_instance_variable): Simplify parameter list; do not call grokfield(); do not populate CLASS_IVARS list. (start_class): Check for the existence of super class, if one was specified. (continue_class): Use CLASS_RAW_IVARS rather than CLASS_IVARS; do not call build_class_template(); adjust call to get_class_ivars(); call build_decl(), pushdecl() and finish_decl() instead of define_decl(). (finish_class): Call build_decl(), pushdecl() and finish_decl() instead of define_decl(). (add_protocols): Use PROTOCOL_BINFO_ELTS for the tree vector size. (start_protocol): Do not call build_protocol_template(); use PROTOCOL_BINFO_ELTS for the tree vector size. (encode_type_qualifiers): Do not handle the 'const' qualifier here. (encode_pointer): Encode 'const char *' as 'r*', for backwards compatibility. (encode_array): Use HOST_WIDE_INT_PRINT_DEC instead of "%ld". (encode_type): Handle the 'const' qualifier here. (objc_parmlist): New global variable, sued by objc_push_parm and objc_get_parm_info(). (objc_push_parm, objc_get_parm_info): New functions. (objc_expr_last): Remove function. (synth_self_and_ucmd_args): For instance methods, use the instance type for 'self'; call objc_push_parm() instead of push_parm_decl(). (start_method_def): Do not call push_scope(), declare_parm_level(), pop_scope(), push_parm_decl(), store_parm_decls() or objc_expr_last(); just use objc_push_parm() and objc_get_parm_info(). (comp_method_with_proto): Remove function. (objc_types_are_equivalent): Strip away indirections before comparing underlying types. (comp_proto_with_proto): Do not call groktypename(); types are no longer in raw declspec format. (objc_start_function): New function. (really_start_method): Call comp_proto_with_proto() instead of comp_method_with_proto(); call objc_start_function() instead of hand-crafting a function declarator. (continue_method_def, objc_expand_function_end): Remove functions. (get_super_receiver): Call objc_get_current_scope() instead of get_current_scope(); reference 'super_class' field (instead of 'class'). (finish_method_def): Rename to objc_finish_method_definition() and add a function decl parameter; move method encoding call from objc_expand_function_end(). (is_complex_decl, adorn_decl, gen_declarator, gen_declspecs, gen_declaration_1): Remove functions. (tmpbuf, RAW_DECLSPEC): Remove. (gen_declaration): Remove second parameter; simplify to deal with TYPE_P nodes instead of raw declspecs. (gen_type_name, gen_type_name_0): New functions. (gen_method_decl): Remove second parameter; call gen_type_name() instead of gen_declaration_1(). (dump_interface): Adjust calls to gen_declaration() and gen_method_decl(); do not allocate a separate string buffer. (init_objc): Allocate a larger string buffer to accommodate dump_interface(); adjust call to build_module_descriptor(); add call to build_module_initializer_routine() for the GNU runtime. (generate_classref_translation_entry): Do not call start_decl(); call finish_var_decl() instead of finish_decl(); call convert() instead of build_c_cast(). * objc-act.h (CLASS_OWN_IVARS): Remove accessor. (CLASS_BINFO_ELTS): Reduce from 6 to 5, now that CLASS_OWN_IVARS is gone. (OCTI_GNU_INIT_DECL, GNU_INIT_decl): New. (OCTI_ELLIPSIS_NODE, objc_ellipsis_node): Remove. (OCTI_ID_ID, id_type, objc_id_id): Rename to OCTI_ID_NAME, objc_object_type and objc_object_name, respectively. (OCTI_CLS_REF, OCTI_CLASS_NAME, objc_class_reference, objc_class_name): New. (IS_CLASS): New macro. (IS_ID, IS_SUPER): Robustify. (OCTI_EXECCLASS_DECL, execclass_decl): New. (finish_file, start_class, continue_class, finish_class, start_method_def, continue_method_def, finish_method_def, start_protocol, finish_protocol, objc_build_throw_stmt, objc_build_try_catch_finally_stmt, objc_build_synchronized_prologue, objc_build_synchronized_epilogue, objc_build_try_prologue, objc_build_try_epilogue, objc_build_catch_stmt, objc_build_catch_epilogue, objc_build_finally_prologue, objc_build_finally_epilogue, is_ivar, is_private, is_public, add_instance_variable, objc_add_method, get_super_receiver, objc_clear_super_receiver, get_class_ivars_from_name, get_class_reference, get_static_reference, get_object_reference, build_message_expr, finish_message_expr, build_selector_expr, build_ivar_reference, build_keyword_decl, build_method_decl, build_protocol_expr, build_objc_string_object, objc_declare_alias, objc_declare_class, objc_declare_protocols, objc_comptypes, objc_check_decl, build_encode_expr): Remove prototypes. (imp_count, cat_count): Make GGC-aware. (OBJC_SET_TYPE_NAME): New macro. From-SVN: r87168
2004-09-08 02:49:44 +02:00
initlist = tree_cons (NULL_TREE, expr, initlist);
}
1992-01-18 00:15:38 +01:00
}
if (! flag_next_runtime)
{
Makefile.in (c-parse.o): Depend on $(C_COMMON_H). [gcc/ChangeLog] 2004-09-07 Ziemowit Laski <zlaski@apple.com> * Makefile.in (c-parse.o): Depend on $(C_COMMON_H). * c-parse.in: Include c-common.h instead of objc-act.h. (ivar_decl_list, ivar_decls, ivar_decl, ivars, ivar_declarator, myparms, myparm): Remove %type declarations. (methodtype, optparms, OBJC_TYPE_QUAL, objc_quals, objc_qual, objc_typename, objc_try_catch_stmt, optellipsis): Add %type declarations. (objc_inherit_code, objc_public_flag): Remove. (typespec_nonreserved_nonattr): Call objc_get_protocol_qualified_type() instead of get_static_reference() and get_protocol_reference(). (stmt_nocomp): Call grokparm() on @catch parameter. (objcdef): Move semantic action to objc_finish_implementation(). (classdef): Move semantic action to objc_start_class_interface(), objc_continue_interface(), objc_finish_interface(), objc_start_class_implementation(), objc_continue_implementation(), objc_start_category_interface() and objc_start_category_implementation(). (protocoldef): Move semantic actions to objc_start_protocol() and objc_finish_interface(). (ivar_decl_list): Remove nonterminal. (visibility_spec): Move semantic actions to objc_set_visibility(). (ivar_decls): Remove assignment to $$. (ivar_decl): Rephrase in terms of component_decl; call objc_add_instance_variable(). (ivars, ivar_declarator): Remove nonterminals. (opt_semi): New nonterminal. (methodtype): Remove semantic actions. (methoddef): Move semantic actions to objc_set_method_type(), objc_start_method_definition() and objc_finish_method_definition(). (methodproto): Move semantic actions to objc_set_method_type() and objc_add_method_declaration(). (methoddecl): Use objc_typename instead of typename; move semantic actions to objc_build_method_signature(). (optarglist, myxdecls, mydecl, myparms, myparm): Remove nonterminals. (optparmlist): Express in terms of optparms and optellipsis. (optparms, optellipsis, objc_qual, objc_quals, objc_typename): New nonterminals. (keyworddecl): Use objc_typename instead of typename. (rid_to_yy): Mark RID_IN, RID_OUT, RID_INOUT, RID_BYCOPY, RID_BYREF and RID_ONEWAY as returning OBJC_TYPE_QUAL to yyparse(). [gcc/objc/ChangeLog] 2004-09-07 Ziemowit Laski <zlaski@apple.com> * Make-lang.in (objc/objc-parse.o): Depend on $(C_COMMON_H) instead of objc/objc-act.h. (objc/objc-act.o): Depend on $(HASHTAB_H). * objc-act.c: Include hashtab.h; in ObjC++ mode, include cp-tree.h and objcp-decl.h instead of c-tree.h. (build_module_descriptor, get_class_ivars, synth_id_with_class_suffix, error_with_ivar, gen_method_decl, gen_declaration, setup_string_decl, build_protocol_template): Adjust prototypes. (build_module_initializer_routine, start_class, continue_class, finish_class, start_method_def, objc_start_function, start_protocol, build_method_decl, objc_add_method, add_instance_variable, build_ivar_reference, is_ivar, is_private, get_super_receiver, build_selector_table_decl, objc_push_parm, objc_get_parm_info, gen_type_name, gen_type_name_0, start_var_decl, finish_var_decl, create_field_decl): New prototypes. (objc_expand_function_end, comp_method_with_proto, objc_expr_last, gen_declaration_1, gen_declarator, is_complex_decl, adorn_decl, define_decl, create_builtin_decl, gen_declspecs): Remove prototypes. (TYPE_ID): Rename to OBJECT_TYPEDEF_NAME. (CLASS_TYPEDEF_NAME): New. (TAG_EXECCLASS): Change from a global variable to a #define. (TAG_RETURN_STRUCT): Delete. (TAG_GNUINIT): New, holds '__objc_gnu_init' name. (objc_inherit_code, objc_public_flag): New, moved from c-parse.in. (string_descriptor): New struct. (string_htab): New hash table. (string_hash, string_eq): New prototypes. (generate_struct_by_value_array): Call create_field_decl() instead of create_builtin_decl(). (objc_init): Do not initialize objc_ellipsis_node or TAG_EXECCLASS; In ObjC++ mode, call cxx_init() instead of c_objc_common_init(). (objc_finish_file): In ObjC++, call instantiate_pending_templates() and cp_finish_file(). (define_decl, get_static_reference, get_protocol_reference, create_builtin_decl): Remove functions. (objc_start_class_interface, objc_start_category_interface, objc_start_protocol, objc_continue_interface, objc_finish_interface, objc_start_class_implementation, objc_start_category_implementation, objc_continue_implementation, objc_finish_implementation, objc_set_visibility, objc_set_method_type, objc_build_method_signature, objc_add_method_declaration, objc_start_method_definition, objc_add_instance_variable, objc_get_protocol_qualified_type, create_field_decl, start_var_decl, finish_var_decl): New functions. (setup_string_decl): Simplify since it is only called once. (synth_module_prologue): Call build_class_template(); predefine 'id' and 'Class' as typedefs; rename 'temp_type' to 'type'; disable debug hooks for duration of function; fix GNU runtime messenger signatures to correspond to reality; forward-declare '__objc_exec_class' for the GNU runtime; call build_selector_table_decl(); in ObjC++ mode, generate 'extern "C" { ... }' wrappers around synthesized declarations; call build_protocol_template() and build_category_template(). (string_hash, string_eq): New functions. (objc_build_string_object): Check metaclass correctness only once; store string literals in hash table. (objc_build_constructor): Do not convert initializer elements; adjust for ObjC++ impedance mismatch. (build_objc_symtab_template): Call create_field_decl() instead of create_builtin_decl(). (init_objc_symtab): Add missing conversion to initializer element. (build_metadata_decl): Call start_var_decl() instead of define_decl(). (generate_objc_symtab_decl): Do not call build_category_template(); call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(). (build_module_descriptor): Call create_field_decl() instead of grokfield(); call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(); always mark module descriptor as used; move GNU runtime-specific functionality to build_module_initializer_routine(). (build_module_initializer_routine): New function, broken off of build_module_descriptor(). (objc_static_init_needed_p, objc_generate_static_init_call): New functions. (generate_static_references, generate_strings, build_selector_translation_table, generate_descriptor_table, generate_ivars_list, generate_dispatch_table, generate_category): Call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(); build a type directly instead of via groktypename(). (build_selector_reference_decl, build_selector_table_decl, build_class_reference_decl, build_protocol_reference, generate_objc_image_info): Call start_var_decl() instead of build_decl(). (build_selector_reference): For GNU runtime, do not call build_selector_reference_decl(). (build_selector, build_typed_selector_reference): Always convert result to the selector type. (add_objc_string): Cast return value to 'char *'. (build_method_prototype_template, build_selector_template, build_method_template): Use actual selector type for fields pointing to selectors. (finish_objc): For GNU runtime, call build_module_initializer_routine() after build_module_descriptor(). (generate_protocol_list, generate_shared_structures): Call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(); build a type directly instead of via groktypename(). (synth_id_with_class_suffix): Return a string. (get_arg_type_list): For instance methods, use the instance type for 'self'; do not call groktypename_in_parm_context(). (build_objc_string_decl): Squash redeclaration errors in ObjC++. (objc_is_class_name): Use OBJC_TYPE_NAME instead of TYPE_NAME; handle RECORD_TYPEs in ObjC as well as ObjC++. (objc_is_id): New function. (objc_is_object_ptr): Return the canonical type node. (objc_get_class_ivars): Simplify using get_class_ivars(). (get_class_ivars): Remove second parameter; create a fresh copy of the ivar list for each call; do not check for existence of super class. (objc_eh_runtime_type): Mark #ifndef OBJCPLUS. (objc_init_exceptions): When using SJLJ-style exceptions, require the use of '-fobjc-exceptions' flag; do not require it for DWARF-style exceptions. (objc_build_exc_ptr, next_sjlj_build_try_catch_finally): Use objc_object_type instead of objc_id_type. (objc_begin_catch_clause): Convert the incoming PARM_DECL into a VAR_DECL before placing it in the appropriate scope; do not call define_decl(); adjust call to c_begin_compound_stmt(); use objc_object_type instead of objc_id_type. (build_next_objc_exception_stuff): Call create_field_decl() instead of create_builtin_decl(); construct type directly instead of calling groktypename(); use OBJC_VOID_AT_END to mark end of function parameters. (build_private_template): Adjust call to get_class_ivars(); build a type directly instead of via groktypename(). (build_protocol_template, build_method_prototype_list_template, build_method_prototype_template, build_category_template, build_selector_template, build_class_template, build_super_template, build_ivar_template, build_ivar_list_template, build_method_list_template, build_method_template): Call create_field_decl() instead of grokfield(). (objc_method_parm_type): Do not call groktypename(). (generate_descriptor_table): Call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(). (generate_method_descriptors, build_protocol_initializer, generate_dispatch_tables, build_category_initializer, build_shared_structure_initializer): Do not call groktypename(). (generate_protocols): Call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(); do not call groktypename(). (error_with_ivar): Remove last parameter. (check_ivars): Do not iterate ovar CLASS_RAW_IVARS lists in addition to CLASS_IVARS lists; adjust calls to error_with_ivar(). (generate_ivar_lists): Convert one of the initializer elements; do not call groktypename(). (get_arg_type_list, start_method_def, gen_method_def): Account for new representation of variable arguments and '...' in Objective-C methods; add Objective-C++ impedance matching code. (is_objc_type_qualifier): Remove function. (adjust_type_for_id_default): Simplify; there is no longer a need to wade through declspecs. (lookup_interface, start_class, continue_class, finish_class, start_method_def, start_protocol, build_method_decl, objc_add_method, add_instance_variable, build_ivar_reference, is_ivar, is_private, get_super_receiver, objc_build_finally_epilogue): Make into static functions. (receiver_is_class_object): Use new IS_CLASS() macro. (objc_build_message_expr): Tweak ObjC++ message argument handling; call objc_finish_message_expr() instead of finish_message_expr(). (finish_message_expr): Rename to objc_finish_message_expr(); use OBJC_TYPE_NAME and OBJC_SET_TYPE_NAME macros instead of TYPE_NAME. call gen_type_name() instead of gen_declaration(); call objc_is_id() instead of using IS_ID and IS_CLASS; Use objc_class_name instead of calling get_identifier("Class"); handle CONVERT_EXPRs in receiver. (build_objc_method_call, warn_with_method): Do not call groktypename(). (build_ivar_reference): Call convert() instead of clobbering in a type. (hash_init): Initialize string_htab hash table. (add_instance_variable): Simplify parameter list; do not call grokfield(); do not populate CLASS_IVARS list. (start_class): Check for the existence of super class, if one was specified. (continue_class): Use CLASS_RAW_IVARS rather than CLASS_IVARS; do not call build_class_template(); adjust call to get_class_ivars(); call build_decl(), pushdecl() and finish_decl() instead of define_decl(). (finish_class): Call build_decl(), pushdecl() and finish_decl() instead of define_decl(). (add_protocols): Use PROTOCOL_BINFO_ELTS for the tree vector size. (start_protocol): Do not call build_protocol_template(); use PROTOCOL_BINFO_ELTS for the tree vector size. (encode_type_qualifiers): Do not handle the 'const' qualifier here. (encode_pointer): Encode 'const char *' as 'r*', for backwards compatibility. (encode_array): Use HOST_WIDE_INT_PRINT_DEC instead of "%ld". (encode_type): Handle the 'const' qualifier here. (objc_parmlist): New global variable, sued by objc_push_parm and objc_get_parm_info(). (objc_push_parm, objc_get_parm_info): New functions. (objc_expr_last): Remove function. (synth_self_and_ucmd_args): For instance methods, use the instance type for 'self'; call objc_push_parm() instead of push_parm_decl(). (start_method_def): Do not call push_scope(), declare_parm_level(), pop_scope(), push_parm_decl(), store_parm_decls() or objc_expr_last(); just use objc_push_parm() and objc_get_parm_info(). (comp_method_with_proto): Remove function. (objc_types_are_equivalent): Strip away indirections before comparing underlying types. (comp_proto_with_proto): Do not call groktypename(); types are no longer in raw declspec format. (objc_start_function): New function. (really_start_method): Call comp_proto_with_proto() instead of comp_method_with_proto(); call objc_start_function() instead of hand-crafting a function declarator. (continue_method_def, objc_expand_function_end): Remove functions. (get_super_receiver): Call objc_get_current_scope() instead of get_current_scope(); reference 'super_class' field (instead of 'class'). (finish_method_def): Rename to objc_finish_method_definition() and add a function decl parameter; move method encoding call from objc_expand_function_end(). (is_complex_decl, adorn_decl, gen_declarator, gen_declspecs, gen_declaration_1): Remove functions. (tmpbuf, RAW_DECLSPEC): Remove. (gen_declaration): Remove second parameter; simplify to deal with TYPE_P nodes instead of raw declspecs. (gen_type_name, gen_type_name_0): New functions. (gen_method_decl): Remove second parameter; call gen_type_name() instead of gen_declaration_1(). (dump_interface): Adjust calls to gen_declaration() and gen_method_decl(); do not allocate a separate string buffer. (init_objc): Allocate a larger string buffer to accommodate dump_interface(); adjust call to build_module_descriptor(); add call to build_module_initializer_routine() for the GNU runtime. (generate_classref_translation_entry): Do not call start_decl(); call finish_var_decl() instead of finish_decl(); call convert() instead of build_c_cast(). * objc-act.h (CLASS_OWN_IVARS): Remove accessor. (CLASS_BINFO_ELTS): Reduce from 6 to 5, now that CLASS_OWN_IVARS is gone. (OCTI_GNU_INIT_DECL, GNU_INIT_decl): New. (OCTI_ELLIPSIS_NODE, objc_ellipsis_node): Remove. (OCTI_ID_ID, id_type, objc_id_id): Rename to OCTI_ID_NAME, objc_object_type and objc_object_name, respectively. (OCTI_CLS_REF, OCTI_CLASS_NAME, objc_class_reference, objc_class_name): New. (IS_CLASS): New macro. (IS_ID, IS_SUPER): Robustify. (OCTI_EXECCLASS_DECL, execclass_decl): New. (finish_file, start_class, continue_class, finish_class, start_method_def, continue_method_def, finish_method_def, start_protocol, finish_protocol, objc_build_throw_stmt, objc_build_try_catch_finally_stmt, objc_build_synchronized_prologue, objc_build_synchronized_epilogue, objc_build_try_prologue, objc_build_try_epilogue, objc_build_catch_stmt, objc_build_catch_epilogue, objc_build_finally_prologue, objc_build_finally_epilogue, is_ivar, is_private, is_public, add_instance_variable, objc_add_method, get_super_receiver, objc_clear_super_receiver, get_class_ivars_from_name, get_class_reference, get_static_reference, get_object_reference, build_message_expr, finish_message_expr, build_selector_expr, build_ivar_reference, build_keyword_decl, build_method_decl, build_protocol_expr, build_objc_string_object, objc_declare_alias, objc_declare_class, objc_declare_protocols, objc_comptypes, objc_check_decl, build_encode_expr): Remove prototypes. (imp_count, cat_count): Make GGC-aware. (OBJC_SET_TYPE_NAME): New macro. From-SVN: r87168
2004-09-08 02:49:44 +02:00
/* Cause the selector table (previously forward-declared)
to be actually output. */
initlist = tree_cons (NULL_TREE,
flag_typed_selectors
? objc_build_constructor
(objc_selector_template,
tree_cons (NULL_TREE,
build_int_cst (NULL_TREE, 0),
tree_cons (NULL_TREE,
build_int_cst (NULL_TREE, 0),
Makefile.in (c-parse.o): Depend on $(C_COMMON_H). [gcc/ChangeLog] 2004-09-07 Ziemowit Laski <zlaski@apple.com> * Makefile.in (c-parse.o): Depend on $(C_COMMON_H). * c-parse.in: Include c-common.h instead of objc-act.h. (ivar_decl_list, ivar_decls, ivar_decl, ivars, ivar_declarator, myparms, myparm): Remove %type declarations. (methodtype, optparms, OBJC_TYPE_QUAL, objc_quals, objc_qual, objc_typename, objc_try_catch_stmt, optellipsis): Add %type declarations. (objc_inherit_code, objc_public_flag): Remove. (typespec_nonreserved_nonattr): Call objc_get_protocol_qualified_type() instead of get_static_reference() and get_protocol_reference(). (stmt_nocomp): Call grokparm() on @catch parameter. (objcdef): Move semantic action to objc_finish_implementation(). (classdef): Move semantic action to objc_start_class_interface(), objc_continue_interface(), objc_finish_interface(), objc_start_class_implementation(), objc_continue_implementation(), objc_start_category_interface() and objc_start_category_implementation(). (protocoldef): Move semantic actions to objc_start_protocol() and objc_finish_interface(). (ivar_decl_list): Remove nonterminal. (visibility_spec): Move semantic actions to objc_set_visibility(). (ivar_decls): Remove assignment to $$. (ivar_decl): Rephrase in terms of component_decl; call objc_add_instance_variable(). (ivars, ivar_declarator): Remove nonterminals. (opt_semi): New nonterminal. (methodtype): Remove semantic actions. (methoddef): Move semantic actions to objc_set_method_type(), objc_start_method_definition() and objc_finish_method_definition(). (methodproto): Move semantic actions to objc_set_method_type() and objc_add_method_declaration(). (methoddecl): Use objc_typename instead of typename; move semantic actions to objc_build_method_signature(). (optarglist, myxdecls, mydecl, myparms, myparm): Remove nonterminals. (optparmlist): Express in terms of optparms and optellipsis. (optparms, optellipsis, objc_qual, objc_quals, objc_typename): New nonterminals. (keyworddecl): Use objc_typename instead of typename. (rid_to_yy): Mark RID_IN, RID_OUT, RID_INOUT, RID_BYCOPY, RID_BYREF and RID_ONEWAY as returning OBJC_TYPE_QUAL to yyparse(). [gcc/objc/ChangeLog] 2004-09-07 Ziemowit Laski <zlaski@apple.com> * Make-lang.in (objc/objc-parse.o): Depend on $(C_COMMON_H) instead of objc/objc-act.h. (objc/objc-act.o): Depend on $(HASHTAB_H). * objc-act.c: Include hashtab.h; in ObjC++ mode, include cp-tree.h and objcp-decl.h instead of c-tree.h. (build_module_descriptor, get_class_ivars, synth_id_with_class_suffix, error_with_ivar, gen_method_decl, gen_declaration, setup_string_decl, build_protocol_template): Adjust prototypes. (build_module_initializer_routine, start_class, continue_class, finish_class, start_method_def, objc_start_function, start_protocol, build_method_decl, objc_add_method, add_instance_variable, build_ivar_reference, is_ivar, is_private, get_super_receiver, build_selector_table_decl, objc_push_parm, objc_get_parm_info, gen_type_name, gen_type_name_0, start_var_decl, finish_var_decl, create_field_decl): New prototypes. (objc_expand_function_end, comp_method_with_proto, objc_expr_last, gen_declaration_1, gen_declarator, is_complex_decl, adorn_decl, define_decl, create_builtin_decl, gen_declspecs): Remove prototypes. (TYPE_ID): Rename to OBJECT_TYPEDEF_NAME. (CLASS_TYPEDEF_NAME): New. (TAG_EXECCLASS): Change from a global variable to a #define. (TAG_RETURN_STRUCT): Delete. (TAG_GNUINIT): New, holds '__objc_gnu_init' name. (objc_inherit_code, objc_public_flag): New, moved from c-parse.in. (string_descriptor): New struct. (string_htab): New hash table. (string_hash, string_eq): New prototypes. (generate_struct_by_value_array): Call create_field_decl() instead of create_builtin_decl(). (objc_init): Do not initialize objc_ellipsis_node or TAG_EXECCLASS; In ObjC++ mode, call cxx_init() instead of c_objc_common_init(). (objc_finish_file): In ObjC++, call instantiate_pending_templates() and cp_finish_file(). (define_decl, get_static_reference, get_protocol_reference, create_builtin_decl): Remove functions. (objc_start_class_interface, objc_start_category_interface, objc_start_protocol, objc_continue_interface, objc_finish_interface, objc_start_class_implementation, objc_start_category_implementation, objc_continue_implementation, objc_finish_implementation, objc_set_visibility, objc_set_method_type, objc_build_method_signature, objc_add_method_declaration, objc_start_method_definition, objc_add_instance_variable, objc_get_protocol_qualified_type, create_field_decl, start_var_decl, finish_var_decl): New functions. (setup_string_decl): Simplify since it is only called once. (synth_module_prologue): Call build_class_template(); predefine 'id' and 'Class' as typedefs; rename 'temp_type' to 'type'; disable debug hooks for duration of function; fix GNU runtime messenger signatures to correspond to reality; forward-declare '__objc_exec_class' for the GNU runtime; call build_selector_table_decl(); in ObjC++ mode, generate 'extern "C" { ... }' wrappers around synthesized declarations; call build_protocol_template() and build_category_template(). (string_hash, string_eq): New functions. (objc_build_string_object): Check metaclass correctness only once; store string literals in hash table. (objc_build_constructor): Do not convert initializer elements; adjust for ObjC++ impedance mismatch. (build_objc_symtab_template): Call create_field_decl() instead of create_builtin_decl(). (init_objc_symtab): Add missing conversion to initializer element. (build_metadata_decl): Call start_var_decl() instead of define_decl(). (generate_objc_symtab_decl): Do not call build_category_template(); call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(). (build_module_descriptor): Call create_field_decl() instead of grokfield(); call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(); always mark module descriptor as used; move GNU runtime-specific functionality to build_module_initializer_routine(). (build_module_initializer_routine): New function, broken off of build_module_descriptor(). (objc_static_init_needed_p, objc_generate_static_init_call): New functions. (generate_static_references, generate_strings, build_selector_translation_table, generate_descriptor_table, generate_ivars_list, generate_dispatch_table, generate_category): Call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(); build a type directly instead of via groktypename(). (build_selector_reference_decl, build_selector_table_decl, build_class_reference_decl, build_protocol_reference, generate_objc_image_info): Call start_var_decl() instead of build_decl(). (build_selector_reference): For GNU runtime, do not call build_selector_reference_decl(). (build_selector, build_typed_selector_reference): Always convert result to the selector type. (add_objc_string): Cast return value to 'char *'. (build_method_prototype_template, build_selector_template, build_method_template): Use actual selector type for fields pointing to selectors. (finish_objc): For GNU runtime, call build_module_initializer_routine() after build_module_descriptor(). (generate_protocol_list, generate_shared_structures): Call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(); build a type directly instead of via groktypename(). (synth_id_with_class_suffix): Return a string. (get_arg_type_list): For instance methods, use the instance type for 'self'; do not call groktypename_in_parm_context(). (build_objc_string_decl): Squash redeclaration errors in ObjC++. (objc_is_class_name): Use OBJC_TYPE_NAME instead of TYPE_NAME; handle RECORD_TYPEs in ObjC as well as ObjC++. (objc_is_id): New function. (objc_is_object_ptr): Return the canonical type node. (objc_get_class_ivars): Simplify using get_class_ivars(). (get_class_ivars): Remove second parameter; create a fresh copy of the ivar list for each call; do not check for existence of super class. (objc_eh_runtime_type): Mark #ifndef OBJCPLUS. (objc_init_exceptions): When using SJLJ-style exceptions, require the use of '-fobjc-exceptions' flag; do not require it for DWARF-style exceptions. (objc_build_exc_ptr, next_sjlj_build_try_catch_finally): Use objc_object_type instead of objc_id_type. (objc_begin_catch_clause): Convert the incoming PARM_DECL into a VAR_DECL before placing it in the appropriate scope; do not call define_decl(); adjust call to c_begin_compound_stmt(); use objc_object_type instead of objc_id_type. (build_next_objc_exception_stuff): Call create_field_decl() instead of create_builtin_decl(); construct type directly instead of calling groktypename(); use OBJC_VOID_AT_END to mark end of function parameters. (build_private_template): Adjust call to get_class_ivars(); build a type directly instead of via groktypename(). (build_protocol_template, build_method_prototype_list_template, build_method_prototype_template, build_category_template, build_selector_template, build_class_template, build_super_template, build_ivar_template, build_ivar_list_template, build_method_list_template, build_method_template): Call create_field_decl() instead of grokfield(). (objc_method_parm_type): Do not call groktypename(). (generate_descriptor_table): Call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(). (generate_method_descriptors, build_protocol_initializer, generate_dispatch_tables, build_category_initializer, build_shared_structure_initializer): Do not call groktypename(). (generate_protocols): Call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(); do not call groktypename(). (error_with_ivar): Remove last parameter. (check_ivars): Do not iterate ovar CLASS_RAW_IVARS lists in addition to CLASS_IVARS lists; adjust calls to error_with_ivar(). (generate_ivar_lists): Convert one of the initializer elements; do not call groktypename(). (get_arg_type_list, start_method_def, gen_method_def): Account for new representation of variable arguments and '...' in Objective-C methods; add Objective-C++ impedance matching code. (is_objc_type_qualifier): Remove function. (adjust_type_for_id_default): Simplify; there is no longer a need to wade through declspecs. (lookup_interface, start_class, continue_class, finish_class, start_method_def, start_protocol, build_method_decl, objc_add_method, add_instance_variable, build_ivar_reference, is_ivar, is_private, get_super_receiver, objc_build_finally_epilogue): Make into static functions. (receiver_is_class_object): Use new IS_CLASS() macro. (objc_build_message_expr): Tweak ObjC++ message argument handling; call objc_finish_message_expr() instead of finish_message_expr(). (finish_message_expr): Rename to objc_finish_message_expr(); use OBJC_TYPE_NAME and OBJC_SET_TYPE_NAME macros instead of TYPE_NAME. call gen_type_name() instead of gen_declaration(); call objc_is_id() instead of using IS_ID and IS_CLASS; Use objc_class_name instead of calling get_identifier("Class"); handle CONVERT_EXPRs in receiver. (build_objc_method_call, warn_with_method): Do not call groktypename(). (build_ivar_reference): Call convert() instead of clobbering in a type. (hash_init): Initialize string_htab hash table. (add_instance_variable): Simplify parameter list; do not call grokfield(); do not populate CLASS_IVARS list. (start_class): Check for the existence of super class, if one was specified. (continue_class): Use CLASS_RAW_IVARS rather than CLASS_IVARS; do not call build_class_template(); adjust call to get_class_ivars(); call build_decl(), pushdecl() and finish_decl() instead of define_decl(). (finish_class): Call build_decl(), pushdecl() and finish_decl() instead of define_decl(). (add_protocols): Use PROTOCOL_BINFO_ELTS for the tree vector size. (start_protocol): Do not call build_protocol_template(); use PROTOCOL_BINFO_ELTS for the tree vector size. (encode_type_qualifiers): Do not handle the 'const' qualifier here. (encode_pointer): Encode 'const char *' as 'r*', for backwards compatibility. (encode_array): Use HOST_WIDE_INT_PRINT_DEC instead of "%ld". (encode_type): Handle the 'const' qualifier here. (objc_parmlist): New global variable, sued by objc_push_parm and objc_get_parm_info(). (objc_push_parm, objc_get_parm_info): New functions. (objc_expr_last): Remove function. (synth_self_and_ucmd_args): For instance methods, use the instance type for 'self'; call objc_push_parm() instead of push_parm_decl(). (start_method_def): Do not call push_scope(), declare_parm_level(), pop_scope(), push_parm_decl(), store_parm_decls() or objc_expr_last(); just use objc_push_parm() and objc_get_parm_info(). (comp_method_with_proto): Remove function. (objc_types_are_equivalent): Strip away indirections before comparing underlying types. (comp_proto_with_proto): Do not call groktypename(); types are no longer in raw declspec format. (objc_start_function): New function. (really_start_method): Call comp_proto_with_proto() instead of comp_method_with_proto(); call objc_start_function() instead of hand-crafting a function declarator. (continue_method_def, objc_expand_function_end): Remove functions. (get_super_receiver): Call objc_get_current_scope() instead of get_current_scope(); reference 'super_class' field (instead of 'class'). (finish_method_def): Rename to objc_finish_method_definition() and add a function decl parameter; move method encoding call from objc_expand_function_end(). (is_complex_decl, adorn_decl, gen_declarator, gen_declspecs, gen_declaration_1): Remove functions. (tmpbuf, RAW_DECLSPEC): Remove. (gen_declaration): Remove second parameter; simplify to deal with TYPE_P nodes instead of raw declspecs. (gen_type_name, gen_type_name_0): New functions. (gen_method_decl): Remove second parameter; call gen_type_name() instead of gen_declaration_1(). (dump_interface): Adjust calls to gen_declaration() and gen_method_decl(); do not allocate a separate string buffer. (init_objc): Allocate a larger string buffer to accommodate dump_interface(); adjust call to build_module_descriptor(); add call to build_module_initializer_routine() for the GNU runtime. (generate_classref_translation_entry): Do not call start_decl(); call finish_var_decl() instead of finish_decl(); call convert() instead of build_c_cast(). * objc-act.h (CLASS_OWN_IVARS): Remove accessor. (CLASS_BINFO_ELTS): Reduce from 6 to 5, now that CLASS_OWN_IVARS is gone. (OCTI_GNU_INIT_DECL, GNU_INIT_decl): New. (OCTI_ELLIPSIS_NODE, objc_ellipsis_node): Remove. (OCTI_ID_ID, id_type, objc_id_id): Rename to OCTI_ID_NAME, objc_object_type and objc_object_name, respectively. (OCTI_CLS_REF, OCTI_CLASS_NAME, objc_class_reference, objc_class_name): New. (IS_CLASS): New macro. (IS_ID, IS_SUPER): Robustify. (OCTI_EXECCLASS_DECL, execclass_decl): New. (finish_file, start_class, continue_class, finish_class, start_method_def, continue_method_def, finish_method_def, start_protocol, finish_protocol, objc_build_throw_stmt, objc_build_try_catch_finally_stmt, objc_build_synchronized_prologue, objc_build_synchronized_epilogue, objc_build_try_prologue, objc_build_try_epilogue, objc_build_catch_stmt, objc_build_catch_epilogue, objc_build_finally_prologue, objc_build_finally_epilogue, is_ivar, is_private, is_public, add_instance_variable, objc_add_method, get_super_receiver, objc_clear_super_receiver, get_class_ivars_from_name, get_class_reference, get_static_reference, get_object_reference, build_message_expr, finish_message_expr, build_selector_expr, build_ivar_reference, build_keyword_decl, build_method_decl, build_protocol_expr, build_objc_string_object, objc_declare_alias, objc_declare_class, objc_declare_protocols, objc_comptypes, objc_check_decl, build_encode_expr): Remove prototypes. (imp_count, cat_count): Make GGC-aware. (OBJC_SET_TYPE_NAME): New macro. From-SVN: r87168
2004-09-08 02:49:44 +02:00
NULL_TREE)))
: build_int_cst (NULL_TREE, 0), initlist);
tree.c (build_constructor): New function. * tree.c (build_constructor): New function. * tree.h: Prototype it. * c-typeck.c (build_c_cast, pop_init_level) * profile.c (build_function_info_value, build_gcov_info_value) (create_profiler): Use build_constructor. * builtins.c (expand_builtin_args_info): Remove #if 0 blocks. * objc/objc-act.c (build_constructor): Rename objc_build_constructor. Use build_constructor. (build_objc_string_object, objc_add_static_instance) (init_def_list, init_objc_symtab, init_module_descriptor) (generate_static_references, build_selector_translation_table) (build_descriptor_table_initializer, generate_descriptor_table) (build_protocol_initializer, build_ivar_list_initializer) (generate_ivars_list, build_dispatch_table_initializer) (generate_dispatch_table, generate_protocol_list) (build_category_initializer, build_shared_structure_initializer): Update to match. ada: * gigi.h, utils2.c (build_constructor): Rename gnat_build_constructor. Use build_constructor. * decl.c (gnat_to_gnu_entity) * trans.c (tree_transform, pos_to_constructor, extract_values) * ada/utils.c (build_template, convert_to_fat_pointer, convert) (unchecked_convert) * ada/utils2.c (build_binary_op, build_call_raise, build_allocator) (fill_vms_descriptor): Update to match. cp: * class.c (initialize_array) * decl.c (reshape_init) * decl2.c (build_expr_from_tree) * init.c (build_zero_init) * pt.c (tsubst_copy, tsubst_copy_and_build) * rtti.c (tinfo_base_init, generic_initializer, ptr_initializer) (ptm_initializer, class_initializer, get_pseudo_ti_init) * semantics.c (finish_compound_literal) * typeck.c (build_ptrmemfunc1) * typeck2.c (store_init_value, process_init_constructor) (build_functional_cast): Use build_constructor. f: * com.c (ffecom_build_complex_constant_, ffecom_expr_) (ffecom_init_zero_, ffecom_transform_namelist_, ffecom_vardesc_) (ffecom_vardesc_array_, ffecom_vardesc_dims_, ffecom_2) * ste.c (ffeste_io_ialist_, ffeste_io_cilist_, ffeste_io_cllist_) (ffeste_io_icilist_, ffeste_io_inlist_, ffeste_io_olist_): Use build_constructor. java: * class.c (make_field_value, make_method_value, get_dispatch_table) (make_class_data, emit_offset_symbol_table) * constants.c (build_constants_constructor) * java-tree.h (START_RECORD_CONSTRUCTOR) * parse.y (maybe_build_array_element_wfl): Use build_constructor. From-SVN: r65539
2003-04-13 03:45:35 +02:00
initlist = objc_build_constructor (TREE_TYPE (UOBJC_SELECTOR_TABLE_decl),
nreverse (initlist));
Makefile.in (c-parse.o): Depend on $(C_COMMON_H). [gcc/ChangeLog] 2004-09-07 Ziemowit Laski <zlaski@apple.com> * Makefile.in (c-parse.o): Depend on $(C_COMMON_H). * c-parse.in: Include c-common.h instead of objc-act.h. (ivar_decl_list, ivar_decls, ivar_decl, ivars, ivar_declarator, myparms, myparm): Remove %type declarations. (methodtype, optparms, OBJC_TYPE_QUAL, objc_quals, objc_qual, objc_typename, objc_try_catch_stmt, optellipsis): Add %type declarations. (objc_inherit_code, objc_public_flag): Remove. (typespec_nonreserved_nonattr): Call objc_get_protocol_qualified_type() instead of get_static_reference() and get_protocol_reference(). (stmt_nocomp): Call grokparm() on @catch parameter. (objcdef): Move semantic action to objc_finish_implementation(). (classdef): Move semantic action to objc_start_class_interface(), objc_continue_interface(), objc_finish_interface(), objc_start_class_implementation(), objc_continue_implementation(), objc_start_category_interface() and objc_start_category_implementation(). (protocoldef): Move semantic actions to objc_start_protocol() and objc_finish_interface(). (ivar_decl_list): Remove nonterminal. (visibility_spec): Move semantic actions to objc_set_visibility(). (ivar_decls): Remove assignment to $$. (ivar_decl): Rephrase in terms of component_decl; call objc_add_instance_variable(). (ivars, ivar_declarator): Remove nonterminals. (opt_semi): New nonterminal. (methodtype): Remove semantic actions. (methoddef): Move semantic actions to objc_set_method_type(), objc_start_method_definition() and objc_finish_method_definition(). (methodproto): Move semantic actions to objc_set_method_type() and objc_add_method_declaration(). (methoddecl): Use objc_typename instead of typename; move semantic actions to objc_build_method_signature(). (optarglist, myxdecls, mydecl, myparms, myparm): Remove nonterminals. (optparmlist): Express in terms of optparms and optellipsis. (optparms, optellipsis, objc_qual, objc_quals, objc_typename): New nonterminals. (keyworddecl): Use objc_typename instead of typename. (rid_to_yy): Mark RID_IN, RID_OUT, RID_INOUT, RID_BYCOPY, RID_BYREF and RID_ONEWAY as returning OBJC_TYPE_QUAL to yyparse(). [gcc/objc/ChangeLog] 2004-09-07 Ziemowit Laski <zlaski@apple.com> * Make-lang.in (objc/objc-parse.o): Depend on $(C_COMMON_H) instead of objc/objc-act.h. (objc/objc-act.o): Depend on $(HASHTAB_H). * objc-act.c: Include hashtab.h; in ObjC++ mode, include cp-tree.h and objcp-decl.h instead of c-tree.h. (build_module_descriptor, get_class_ivars, synth_id_with_class_suffix, error_with_ivar, gen_method_decl, gen_declaration, setup_string_decl, build_protocol_template): Adjust prototypes. (build_module_initializer_routine, start_class, continue_class, finish_class, start_method_def, objc_start_function, start_protocol, build_method_decl, objc_add_method, add_instance_variable, build_ivar_reference, is_ivar, is_private, get_super_receiver, build_selector_table_decl, objc_push_parm, objc_get_parm_info, gen_type_name, gen_type_name_0, start_var_decl, finish_var_decl, create_field_decl): New prototypes. (objc_expand_function_end, comp_method_with_proto, objc_expr_last, gen_declaration_1, gen_declarator, is_complex_decl, adorn_decl, define_decl, create_builtin_decl, gen_declspecs): Remove prototypes. (TYPE_ID): Rename to OBJECT_TYPEDEF_NAME. (CLASS_TYPEDEF_NAME): New. (TAG_EXECCLASS): Change from a global variable to a #define. (TAG_RETURN_STRUCT): Delete. (TAG_GNUINIT): New, holds '__objc_gnu_init' name. (objc_inherit_code, objc_public_flag): New, moved from c-parse.in. (string_descriptor): New struct. (string_htab): New hash table. (string_hash, string_eq): New prototypes. (generate_struct_by_value_array): Call create_field_decl() instead of create_builtin_decl(). (objc_init): Do not initialize objc_ellipsis_node or TAG_EXECCLASS; In ObjC++ mode, call cxx_init() instead of c_objc_common_init(). (objc_finish_file): In ObjC++, call instantiate_pending_templates() and cp_finish_file(). (define_decl, get_static_reference, get_protocol_reference, create_builtin_decl): Remove functions. (objc_start_class_interface, objc_start_category_interface, objc_start_protocol, objc_continue_interface, objc_finish_interface, objc_start_class_implementation, objc_start_category_implementation, objc_continue_implementation, objc_finish_implementation, objc_set_visibility, objc_set_method_type, objc_build_method_signature, objc_add_method_declaration, objc_start_method_definition, objc_add_instance_variable, objc_get_protocol_qualified_type, create_field_decl, start_var_decl, finish_var_decl): New functions. (setup_string_decl): Simplify since it is only called once. (synth_module_prologue): Call build_class_template(); predefine 'id' and 'Class' as typedefs; rename 'temp_type' to 'type'; disable debug hooks for duration of function; fix GNU runtime messenger signatures to correspond to reality; forward-declare '__objc_exec_class' for the GNU runtime; call build_selector_table_decl(); in ObjC++ mode, generate 'extern "C" { ... }' wrappers around synthesized declarations; call build_protocol_template() and build_category_template(). (string_hash, string_eq): New functions. (objc_build_string_object): Check metaclass correctness only once; store string literals in hash table. (objc_build_constructor): Do not convert initializer elements; adjust for ObjC++ impedance mismatch. (build_objc_symtab_template): Call create_field_decl() instead of create_builtin_decl(). (init_objc_symtab): Add missing conversion to initializer element. (build_metadata_decl): Call start_var_decl() instead of define_decl(). (generate_objc_symtab_decl): Do not call build_category_template(); call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(). (build_module_descriptor): Call create_field_decl() instead of grokfield(); call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(); always mark module descriptor as used; move GNU runtime-specific functionality to build_module_initializer_routine(). (build_module_initializer_routine): New function, broken off of build_module_descriptor(). (objc_static_init_needed_p, objc_generate_static_init_call): New functions. (generate_static_references, generate_strings, build_selector_translation_table, generate_descriptor_table, generate_ivars_list, generate_dispatch_table, generate_category): Call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(); build a type directly instead of via groktypename(). (build_selector_reference_decl, build_selector_table_decl, build_class_reference_decl, build_protocol_reference, generate_objc_image_info): Call start_var_decl() instead of build_decl(). (build_selector_reference): For GNU runtime, do not call build_selector_reference_decl(). (build_selector, build_typed_selector_reference): Always convert result to the selector type. (add_objc_string): Cast return value to 'char *'. (build_method_prototype_template, build_selector_template, build_method_template): Use actual selector type for fields pointing to selectors. (finish_objc): For GNU runtime, call build_module_initializer_routine() after build_module_descriptor(). (generate_protocol_list, generate_shared_structures): Call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(); build a type directly instead of via groktypename(). (synth_id_with_class_suffix): Return a string. (get_arg_type_list): For instance methods, use the instance type for 'self'; do not call groktypename_in_parm_context(). (build_objc_string_decl): Squash redeclaration errors in ObjC++. (objc_is_class_name): Use OBJC_TYPE_NAME instead of TYPE_NAME; handle RECORD_TYPEs in ObjC as well as ObjC++. (objc_is_id): New function. (objc_is_object_ptr): Return the canonical type node. (objc_get_class_ivars): Simplify using get_class_ivars(). (get_class_ivars): Remove second parameter; create a fresh copy of the ivar list for each call; do not check for existence of super class. (objc_eh_runtime_type): Mark #ifndef OBJCPLUS. (objc_init_exceptions): When using SJLJ-style exceptions, require the use of '-fobjc-exceptions' flag; do not require it for DWARF-style exceptions. (objc_build_exc_ptr, next_sjlj_build_try_catch_finally): Use objc_object_type instead of objc_id_type. (objc_begin_catch_clause): Convert the incoming PARM_DECL into a VAR_DECL before placing it in the appropriate scope; do not call define_decl(); adjust call to c_begin_compound_stmt(); use objc_object_type instead of objc_id_type. (build_next_objc_exception_stuff): Call create_field_decl() instead of create_builtin_decl(); construct type directly instead of calling groktypename(); use OBJC_VOID_AT_END to mark end of function parameters. (build_private_template): Adjust call to get_class_ivars(); build a type directly instead of via groktypename(). (build_protocol_template, build_method_prototype_list_template, build_method_prototype_template, build_category_template, build_selector_template, build_class_template, build_super_template, build_ivar_template, build_ivar_list_template, build_method_list_template, build_method_template): Call create_field_decl() instead of grokfield(). (objc_method_parm_type): Do not call groktypename(). (generate_descriptor_table): Call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(). (generate_method_descriptors, build_protocol_initializer, generate_dispatch_tables, build_category_initializer, build_shared_structure_initializer): Do not call groktypename(). (generate_protocols): Call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(); do not call groktypename(). (error_with_ivar): Remove last parameter. (check_ivars): Do not iterate ovar CLASS_RAW_IVARS lists in addition to CLASS_IVARS lists; adjust calls to error_with_ivar(). (generate_ivar_lists): Convert one of the initializer elements; do not call groktypename(). (get_arg_type_list, start_method_def, gen_method_def): Account for new representation of variable arguments and '...' in Objective-C methods; add Objective-C++ impedance matching code. (is_objc_type_qualifier): Remove function. (adjust_type_for_id_default): Simplify; there is no longer a need to wade through declspecs. (lookup_interface, start_class, continue_class, finish_class, start_method_def, start_protocol, build_method_decl, objc_add_method, add_instance_variable, build_ivar_reference, is_ivar, is_private, get_super_receiver, objc_build_finally_epilogue): Make into static functions. (receiver_is_class_object): Use new IS_CLASS() macro. (objc_build_message_expr): Tweak ObjC++ message argument handling; call objc_finish_message_expr() instead of finish_message_expr(). (finish_message_expr): Rename to objc_finish_message_expr(); use OBJC_TYPE_NAME and OBJC_SET_TYPE_NAME macros instead of TYPE_NAME. call gen_type_name() instead of gen_declaration(); call objc_is_id() instead of using IS_ID and IS_CLASS; Use objc_class_name instead of calling get_identifier("Class"); handle CONVERT_EXPRs in receiver. (build_objc_method_call, warn_with_method): Do not call groktypename(). (build_ivar_reference): Call convert() instead of clobbering in a type. (hash_init): Initialize string_htab hash table. (add_instance_variable): Simplify parameter list; do not call grokfield(); do not populate CLASS_IVARS list. (start_class): Check for the existence of super class, if one was specified. (continue_class): Use CLASS_RAW_IVARS rather than CLASS_IVARS; do not call build_class_template(); adjust call to get_class_ivars(); call build_decl(), pushdecl() and finish_decl() instead of define_decl(). (finish_class): Call build_decl(), pushdecl() and finish_decl() instead of define_decl(). (add_protocols): Use PROTOCOL_BINFO_ELTS for the tree vector size. (start_protocol): Do not call build_protocol_template(); use PROTOCOL_BINFO_ELTS for the tree vector size. (encode_type_qualifiers): Do not handle the 'const' qualifier here. (encode_pointer): Encode 'const char *' as 'r*', for backwards compatibility. (encode_array): Use HOST_WIDE_INT_PRINT_DEC instead of "%ld". (encode_type): Handle the 'const' qualifier here. (objc_parmlist): New global variable, sued by objc_push_parm and objc_get_parm_info(). (objc_push_parm, objc_get_parm_info): New functions. (objc_expr_last): Remove function. (synth_self_and_ucmd_args): For instance methods, use the instance type for 'self'; call objc_push_parm() instead of push_parm_decl(). (start_method_def): Do not call push_scope(), declare_parm_level(), pop_scope(), push_parm_decl(), store_parm_decls() or objc_expr_last(); just use objc_push_parm() and objc_get_parm_info(). (comp_method_with_proto): Remove function. (objc_types_are_equivalent): Strip away indirections before comparing underlying types. (comp_proto_with_proto): Do not call groktypename(); types are no longer in raw declspec format. (objc_start_function): New function. (really_start_method): Call comp_proto_with_proto() instead of comp_method_with_proto(); call objc_start_function() instead of hand-crafting a function declarator. (continue_method_def, objc_expand_function_end): Remove functions. (get_super_receiver): Call objc_get_current_scope() instead of get_current_scope(); reference 'super_class' field (instead of 'class'). (finish_method_def): Rename to objc_finish_method_definition() and add a function decl parameter; move method encoding call from objc_expand_function_end(). (is_complex_decl, adorn_decl, gen_declarator, gen_declspecs, gen_declaration_1): Remove functions. (tmpbuf, RAW_DECLSPEC): Remove. (gen_declaration): Remove second parameter; simplify to deal with TYPE_P nodes instead of raw declspecs. (gen_type_name, gen_type_name_0): New functions. (gen_method_decl): Remove second parameter; call gen_type_name() instead of gen_declaration_1(). (dump_interface): Adjust calls to gen_declaration() and gen_method_decl(); do not allocate a separate string buffer. (init_objc): Allocate a larger string buffer to accommodate dump_interface(); adjust call to build_module_descriptor(); add call to build_module_initializer_routine() for the GNU runtime. (generate_classref_translation_entry): Do not call start_decl(); call finish_var_decl() instead of finish_decl(); call convert() instead of build_c_cast(). * objc-act.h (CLASS_OWN_IVARS): Remove accessor. (CLASS_BINFO_ELTS): Reduce from 6 to 5, now that CLASS_OWN_IVARS is gone. (OCTI_GNU_INIT_DECL, GNU_INIT_decl): New. (OCTI_ELLIPSIS_NODE, objc_ellipsis_node): Remove. (OCTI_ID_ID, id_type, objc_id_id): Rename to OCTI_ID_NAME, objc_object_type and objc_object_name, respectively. (OCTI_CLS_REF, OCTI_CLASS_NAME, objc_class_reference, objc_class_name): New. (IS_CLASS): New macro. (IS_ID, IS_SUPER): Robustify. (OCTI_EXECCLASS_DECL, execclass_decl): New. (finish_file, start_class, continue_class, finish_class, start_method_def, continue_method_def, finish_method_def, start_protocol, finish_protocol, objc_build_throw_stmt, objc_build_try_catch_finally_stmt, objc_build_synchronized_prologue, objc_build_synchronized_epilogue, objc_build_try_prologue, objc_build_try_epilogue, objc_build_catch_stmt, objc_build_catch_epilogue, objc_build_finally_prologue, objc_build_finally_epilogue, is_ivar, is_private, is_public, add_instance_variable, objc_add_method, get_super_receiver, objc_clear_super_receiver, get_class_ivars_from_name, get_class_reference, get_static_reference, get_object_reference, build_message_expr, finish_message_expr, build_selector_expr, build_ivar_reference, build_keyword_decl, build_method_decl, build_protocol_expr, build_objc_string_object, objc_declare_alias, objc_declare_class, objc_declare_protocols, objc_comptypes, objc_check_decl, build_encode_expr): Remove prototypes. (imp_count, cat_count): Make GGC-aware. (OBJC_SET_TYPE_NAME): New macro. From-SVN: r87168
2004-09-08 02:49:44 +02:00
finish_var_decl (UOBJC_SELECTOR_TABLE_decl, initlist);
}
}
static tree
get_proto_encoding (tree proto)
{
tree encoding;
if (proto)
{
if (! METHOD_ENCODING (proto))
{
encoding = encode_method_prototype (proto);
METHOD_ENCODING (proto) = encoding;
}
else
encoding = METHOD_ENCODING (proto);
return add_objc_string (encoding, meth_var_types);
}
else
tree.h (build_int_cst): New, sign extended constant. * tree.h (build_int_cst): New, sign extended constant. (build_int_cstu): New, zero extended constant. (build_int_cst_wide): Renamed from build_int_cst. * tree.c (build_int_cst, build_int_cstu): New. (build_int_cst_wide): Renamed from build_int_cst. (make_vector_type, build_common_tree_nodes, build_common_tree_nodes_2): Adjust build_int_cst calls. * builtins.c (expand_builtin_prefetch, expand_builtin_strstr, expand_builtin_strpbrk, expand_builtin_fputs, build_string_literal, expand_builtin_printf, expand_builtin_sprintf, fold_builtin_classify_type, fold_builtin_lround, fold_builtin_bitop, fold_builtin_isascii, fold_builtin_toascii, fold_builtin_isdigit, simplify_builtin_strstr, simplify_builtin_strpbrk, fold_builtin_fputs, simplify_builtin_sprintf): Likewise. * c-common.c (start_fname_decls, fix_string_type, shorten_compare, DEF_ATTR_INT): Likewise. * c-decl.c (complete_array_type, check_bitfield_type_and_width): Likewise. * c-lex.c (interpret_integer, lex_charconst): Likewise. * c-parse.in (primary) <TYPES_COMPATIBLE_P> Likewise. * c-pretty-print.c (pp_c_integer_constant): Likewise. * c-typeck.c (really_start_incremental_init, push_init_level, set_nonincremental_init_from_string): Likewise. * calls.c (load_register_parameters): Likewise. convert.c (convert_to_pointer): Likewise. coverage.c (coverage_counter_alloc, tree_coverage_counter_ref, build_fn_info_type, build_fn_info_value, build_ctr_info_value, build_gcov_info): Likewise. * except.c (init_eh, assign_filter_values): Likewise. * expmed.c (store_fixed_bit_field, extract_bit_field, extract_fixed_bit_field, extract_split_bit_field, expand_shift, expand_mult_const, expand_mult_highpart_adjust, extract_high_half, expand_sdiv_pow2, expand_divmod, make_tree): Likewise. * expr.c (convert_move, emit_group_load, emit_group_store, expand_assignment, store_constructor, store_field, expand_expr_real_1, reduce_to_bit_field_precision): Likewise. fold-const.c (force_fit_type, int_const_binop, fold_convert_const, invert_truthvalue, optimize_bit_field_compare, decode_field_reference, all_ones_mask_p, constant_boolean_node, fold_div_compare, fold, fold_read_from_constant_string, fold_negate_const, fold_abs_const, fold_not_const, round_up, round_down): Likewise. * function.c (assign_parm_setup_block): Likewise. * stmt.c (shift_return_value, expand_case, estimate_case_costs): Likewise. * stor-layout.c (layout_type, initialize_sizetypes, set_min_and_max_values_for_integral_type): Likewise. * tree-chrec.c (chrec_fold_multiply_poly_poly, reset_evolution_in_loop): Likewise. * tree-chrec.h (build_polynomial_chrec): Likewise. * tree-complex.c (build_replicated_const): Likewise. * tree-eh.c (honor_protect_cleanup_actions, lower_try_finally_onedest, lower_try_finally_copy, lower_try_finally_switch): Likewise. * tree-mudflap.c (mf_build_string, mx_register_decls, mudflap_register_call, mudflap_enqueue_constant): Likewise. * tree-nested.c (get_trampoline_type, get_nl_goto_field): Likewise. * tree-pretty-print.c (dump_generic_node): Likewise. * tree-ssa-ccp.c (widen_bitfield, maybe_fold_offset_to_array_ref): Likewise. * tree-ssa-dom.c (simplify_rhs_and_lookup_avail_expr): Likewise. * tree-ssa-loop-niter.c (number_of_iterations_cond, loop_niter_by_eval, upper_bound_in_type, lower_bound_in_type): Likewise. * tree-ssa-loop-ivcanon.c (create_canonical_iv, canonicalize_loop_induction_variables): Likewise. * tree-vectorizer.c (vect_create_index_for_array_ref, vect_transform_loop_bound, vect_compute_data_ref_alignment): Likewise. * config/alpha/alpha.c (alpha_initialize_trampoline, alpha_va_start, alpha_gimplify_va_arg_1): Likewise. * config/arm/arm.c (arm_get_cookie_size): Likewise. * config/c4x/c4x.c (c4x_gimplify_va_arg_expr): Likewise. * config/i386/i386.c (ix86_va_start, ix86_gimplify_va_arg): Likewise. * config/ia64/ia64.c (ia64_gimplify_va_arg): Likewise. * config/mips/mips.c (mips_build_builtin_va_list, mips_va_start, mips_gimplify_va_arg_expr): Likewise. * config/pa/pa.c (hppa_gimplify_va_arg_expr): Likewise. * config/rs6000/rs6000.c (rs6000_va_start, rs6000_gimplify_va_arg, add_compiler_branch_island): Likewise. * config/s390/s390.c (s390_va_start): Likewise. * config/sh/sh.c (sh_va_start): Likewise. * config/stormy16/stormy16.c (xstormy16_expand_builtin_va_start): Likewise. * config/xtensa/xtensa.c (xtensa_va_start, xtensa_gimplify_va_arg_expr): Likewise. * objc/objc-act.c (build_objc_string_object, build_objc_symtab_template, init_def_list, init_objc_symtab, init_module_descriptor, generate_static_references, build_selector_translation_table, get_proto_encoding, build_typed_selector_reference, build_selector_reference, build_next_objc_exception_stuff, build_method_prototype_list_template, generate_descriptor_table, generate_protocols, build_protocol_initializer, build_ivar_list_template, build_method_list_template, build_ivar_list_initializer, generate_ivars_list, generate_dispatch_table, generate_protocol_list, build_category_initializer, build_shared_structure_initializer, generate_shared_structures, handle_impent, generate_objc_image_info): Likewise. 2004-04-25 Paolo Bonzini <bonzini@gnu.org> * cfglayout.c (duplicate_insn_chain): Remove references to NOTE_INSN_LOOP_VTOP and NOTE_INSN_LOOP_CONT. * cfgloop.h (struct loop): Remove fields vtop, cont and cont_dominator. * cfgrtl.c (rtl_delete_block): Remove handling of NOTE_INSN_LOOP_CONT. * final.c (final_scan_insn): Remove references to NOTE_INSN_LOOP_VTOP and NOTE_INSN_LOOP_CONT. * insn-notes.def (NOTE_INSN_LOOP_VTOP, NOTE_INSN_LOOP_CONT): Remove. * jump.c (squeeze_notes): Remove references to NOTE_INSN_LOOP_VTOP and NOTE_INSN_LOOP_CONT. * loop.c (scan_loops, find_and_verify_loops, for_each_insn_in_loop, check_dbra_loop, loop_dump_aux): Remove references to removed notes and fields. * reorg.c (mostly_true_jump): Do not rely on NOTE_INSN_LOOP_VTOPs. * unroll.c (unroll_loop, copy_loop_body, loop_iterations): Remove references to removed notes and fields. (subtract_reg_term, ujump_to_loop_cont): Remove. From-SVN: r86544
2004-08-25 11:52:54 +02:00
return build_int_cst (NULL_TREE, 0);
}
/* sel_ref_chain is a list whose "value" fields will be instances of
identifier_node that represent the selector. */
static tree
build_typed_selector_reference (tree ident, tree prototype)
{
tree *chain = &sel_ref_chain;
tree expr;
int index = 0;
while (*chain)
{
if (TREE_PURPOSE (*chain) == prototype && TREE_VALUE (*chain) == ident)
goto return_at_index;
index++;
chain = &TREE_CHAIN (*chain);
}
*chain = tree_cons (prototype, ident, NULL_TREE);
return_at_index:
expr = build_unary_op (ADDR_EXPR,
build_array_ref (UOBJC_SELECTOR_TABLE_decl,
tree.h (build_int_cst): New, sign extended constant. * tree.h (build_int_cst): New, sign extended constant. (build_int_cstu): New, zero extended constant. (build_int_cst_wide): Renamed from build_int_cst. * tree.c (build_int_cst, build_int_cstu): New. (build_int_cst_wide): Renamed from build_int_cst. (make_vector_type, build_common_tree_nodes, build_common_tree_nodes_2): Adjust build_int_cst calls. * builtins.c (expand_builtin_prefetch, expand_builtin_strstr, expand_builtin_strpbrk, expand_builtin_fputs, build_string_literal, expand_builtin_printf, expand_builtin_sprintf, fold_builtin_classify_type, fold_builtin_lround, fold_builtin_bitop, fold_builtin_isascii, fold_builtin_toascii, fold_builtin_isdigit, simplify_builtin_strstr, simplify_builtin_strpbrk, fold_builtin_fputs, simplify_builtin_sprintf): Likewise. * c-common.c (start_fname_decls, fix_string_type, shorten_compare, DEF_ATTR_INT): Likewise. * c-decl.c (complete_array_type, check_bitfield_type_and_width): Likewise. * c-lex.c (interpret_integer, lex_charconst): Likewise. * c-parse.in (primary) <TYPES_COMPATIBLE_P> Likewise. * c-pretty-print.c (pp_c_integer_constant): Likewise. * c-typeck.c (really_start_incremental_init, push_init_level, set_nonincremental_init_from_string): Likewise. * calls.c (load_register_parameters): Likewise. convert.c (convert_to_pointer): Likewise. coverage.c (coverage_counter_alloc, tree_coverage_counter_ref, build_fn_info_type, build_fn_info_value, build_ctr_info_value, build_gcov_info): Likewise. * except.c (init_eh, assign_filter_values): Likewise. * expmed.c (store_fixed_bit_field, extract_bit_field, extract_fixed_bit_field, extract_split_bit_field, expand_shift, expand_mult_const, expand_mult_highpart_adjust, extract_high_half, expand_sdiv_pow2, expand_divmod, make_tree): Likewise. * expr.c (convert_move, emit_group_load, emit_group_store, expand_assignment, store_constructor, store_field, expand_expr_real_1, reduce_to_bit_field_precision): Likewise. fold-const.c (force_fit_type, int_const_binop, fold_convert_const, invert_truthvalue, optimize_bit_field_compare, decode_field_reference, all_ones_mask_p, constant_boolean_node, fold_div_compare, fold, fold_read_from_constant_string, fold_negate_const, fold_abs_const, fold_not_const, round_up, round_down): Likewise. * function.c (assign_parm_setup_block): Likewise. * stmt.c (shift_return_value, expand_case, estimate_case_costs): Likewise. * stor-layout.c (layout_type, initialize_sizetypes, set_min_and_max_values_for_integral_type): Likewise. * tree-chrec.c (chrec_fold_multiply_poly_poly, reset_evolution_in_loop): Likewise. * tree-chrec.h (build_polynomial_chrec): Likewise. * tree-complex.c (build_replicated_const): Likewise. * tree-eh.c (honor_protect_cleanup_actions, lower_try_finally_onedest, lower_try_finally_copy, lower_try_finally_switch): Likewise. * tree-mudflap.c (mf_build_string, mx_register_decls, mudflap_register_call, mudflap_enqueue_constant): Likewise. * tree-nested.c (get_trampoline_type, get_nl_goto_field): Likewise. * tree-pretty-print.c (dump_generic_node): Likewise. * tree-ssa-ccp.c (widen_bitfield, maybe_fold_offset_to_array_ref): Likewise. * tree-ssa-dom.c (simplify_rhs_and_lookup_avail_expr): Likewise. * tree-ssa-loop-niter.c (number_of_iterations_cond, loop_niter_by_eval, upper_bound_in_type, lower_bound_in_type): Likewise. * tree-ssa-loop-ivcanon.c (create_canonical_iv, canonicalize_loop_induction_variables): Likewise. * tree-vectorizer.c (vect_create_index_for_array_ref, vect_transform_loop_bound, vect_compute_data_ref_alignment): Likewise. * config/alpha/alpha.c (alpha_initialize_trampoline, alpha_va_start, alpha_gimplify_va_arg_1): Likewise. * config/arm/arm.c (arm_get_cookie_size): Likewise. * config/c4x/c4x.c (c4x_gimplify_va_arg_expr): Likewise. * config/i386/i386.c (ix86_va_start, ix86_gimplify_va_arg): Likewise. * config/ia64/ia64.c (ia64_gimplify_va_arg): Likewise. * config/mips/mips.c (mips_build_builtin_va_list, mips_va_start, mips_gimplify_va_arg_expr): Likewise. * config/pa/pa.c (hppa_gimplify_va_arg_expr): Likewise. * config/rs6000/rs6000.c (rs6000_va_start, rs6000_gimplify_va_arg, add_compiler_branch_island): Likewise. * config/s390/s390.c (s390_va_start): Likewise. * config/sh/sh.c (sh_va_start): Likewise. * config/stormy16/stormy16.c (xstormy16_expand_builtin_va_start): Likewise. * config/xtensa/xtensa.c (xtensa_va_start, xtensa_gimplify_va_arg_expr): Likewise. * objc/objc-act.c (build_objc_string_object, build_objc_symtab_template, init_def_list, init_objc_symtab, init_module_descriptor, generate_static_references, build_selector_translation_table, get_proto_encoding, build_typed_selector_reference, build_selector_reference, build_next_objc_exception_stuff, build_method_prototype_list_template, generate_descriptor_table, generate_protocols, build_protocol_initializer, build_ivar_list_template, build_method_list_template, build_ivar_list_initializer, generate_ivars_list, generate_dispatch_table, generate_protocol_list, build_category_initializer, build_shared_structure_initializer, generate_shared_structures, handle_impent, generate_objc_image_info): Likewise. 2004-04-25 Paolo Bonzini <bonzini@gnu.org> * cfglayout.c (duplicate_insn_chain): Remove references to NOTE_INSN_LOOP_VTOP and NOTE_INSN_LOOP_CONT. * cfgloop.h (struct loop): Remove fields vtop, cont and cont_dominator. * cfgrtl.c (rtl_delete_block): Remove handling of NOTE_INSN_LOOP_CONT. * final.c (final_scan_insn): Remove references to NOTE_INSN_LOOP_VTOP and NOTE_INSN_LOOP_CONT. * insn-notes.def (NOTE_INSN_LOOP_VTOP, NOTE_INSN_LOOP_CONT): Remove. * jump.c (squeeze_notes): Remove references to NOTE_INSN_LOOP_VTOP and NOTE_INSN_LOOP_CONT. * loop.c (scan_loops, find_and_verify_loops, for_each_insn_in_loop, check_dbra_loop, loop_dump_aux): Remove references to removed notes and fields. * reorg.c (mostly_true_jump): Do not rely on NOTE_INSN_LOOP_VTOPs. * unroll.c (unroll_loop, copy_loop_body, loop_iterations): Remove references to removed notes and fields. (subtract_reg_term, ujump_to_loop_cont): Remove. From-SVN: r86544
2004-08-25 11:52:54 +02:00
build_int_cst (NULL_TREE, index)),
1);
Makefile.in (c-parse.o): Depend on $(C_COMMON_H). [gcc/ChangeLog] 2004-09-07 Ziemowit Laski <zlaski@apple.com> * Makefile.in (c-parse.o): Depend on $(C_COMMON_H). * c-parse.in: Include c-common.h instead of objc-act.h. (ivar_decl_list, ivar_decls, ivar_decl, ivars, ivar_declarator, myparms, myparm): Remove %type declarations. (methodtype, optparms, OBJC_TYPE_QUAL, objc_quals, objc_qual, objc_typename, objc_try_catch_stmt, optellipsis): Add %type declarations. (objc_inherit_code, objc_public_flag): Remove. (typespec_nonreserved_nonattr): Call objc_get_protocol_qualified_type() instead of get_static_reference() and get_protocol_reference(). (stmt_nocomp): Call grokparm() on @catch parameter. (objcdef): Move semantic action to objc_finish_implementation(). (classdef): Move semantic action to objc_start_class_interface(), objc_continue_interface(), objc_finish_interface(), objc_start_class_implementation(), objc_continue_implementation(), objc_start_category_interface() and objc_start_category_implementation(). (protocoldef): Move semantic actions to objc_start_protocol() and objc_finish_interface(). (ivar_decl_list): Remove nonterminal. (visibility_spec): Move semantic actions to objc_set_visibility(). (ivar_decls): Remove assignment to $$. (ivar_decl): Rephrase in terms of component_decl; call objc_add_instance_variable(). (ivars, ivar_declarator): Remove nonterminals. (opt_semi): New nonterminal. (methodtype): Remove semantic actions. (methoddef): Move semantic actions to objc_set_method_type(), objc_start_method_definition() and objc_finish_method_definition(). (methodproto): Move semantic actions to objc_set_method_type() and objc_add_method_declaration(). (methoddecl): Use objc_typename instead of typename; move semantic actions to objc_build_method_signature(). (optarglist, myxdecls, mydecl, myparms, myparm): Remove nonterminals. (optparmlist): Express in terms of optparms and optellipsis. (optparms, optellipsis, objc_qual, objc_quals, objc_typename): New nonterminals. (keyworddecl): Use objc_typename instead of typename. (rid_to_yy): Mark RID_IN, RID_OUT, RID_INOUT, RID_BYCOPY, RID_BYREF and RID_ONEWAY as returning OBJC_TYPE_QUAL to yyparse(). [gcc/objc/ChangeLog] 2004-09-07 Ziemowit Laski <zlaski@apple.com> * Make-lang.in (objc/objc-parse.o): Depend on $(C_COMMON_H) instead of objc/objc-act.h. (objc/objc-act.o): Depend on $(HASHTAB_H). * objc-act.c: Include hashtab.h; in ObjC++ mode, include cp-tree.h and objcp-decl.h instead of c-tree.h. (build_module_descriptor, get_class_ivars, synth_id_with_class_suffix, error_with_ivar, gen_method_decl, gen_declaration, setup_string_decl, build_protocol_template): Adjust prototypes. (build_module_initializer_routine, start_class, continue_class, finish_class, start_method_def, objc_start_function, start_protocol, build_method_decl, objc_add_method, add_instance_variable, build_ivar_reference, is_ivar, is_private, get_super_receiver, build_selector_table_decl, objc_push_parm, objc_get_parm_info, gen_type_name, gen_type_name_0, start_var_decl, finish_var_decl, create_field_decl): New prototypes. (objc_expand_function_end, comp_method_with_proto, objc_expr_last, gen_declaration_1, gen_declarator, is_complex_decl, adorn_decl, define_decl, create_builtin_decl, gen_declspecs): Remove prototypes. (TYPE_ID): Rename to OBJECT_TYPEDEF_NAME. (CLASS_TYPEDEF_NAME): New. (TAG_EXECCLASS): Change from a global variable to a #define. (TAG_RETURN_STRUCT): Delete. (TAG_GNUINIT): New, holds '__objc_gnu_init' name. (objc_inherit_code, objc_public_flag): New, moved from c-parse.in. (string_descriptor): New struct. (string_htab): New hash table. (string_hash, string_eq): New prototypes. (generate_struct_by_value_array): Call create_field_decl() instead of create_builtin_decl(). (objc_init): Do not initialize objc_ellipsis_node or TAG_EXECCLASS; In ObjC++ mode, call cxx_init() instead of c_objc_common_init(). (objc_finish_file): In ObjC++, call instantiate_pending_templates() and cp_finish_file(). (define_decl, get_static_reference, get_protocol_reference, create_builtin_decl): Remove functions. (objc_start_class_interface, objc_start_category_interface, objc_start_protocol, objc_continue_interface, objc_finish_interface, objc_start_class_implementation, objc_start_category_implementation, objc_continue_implementation, objc_finish_implementation, objc_set_visibility, objc_set_method_type, objc_build_method_signature, objc_add_method_declaration, objc_start_method_definition, objc_add_instance_variable, objc_get_protocol_qualified_type, create_field_decl, start_var_decl, finish_var_decl): New functions. (setup_string_decl): Simplify since it is only called once. (synth_module_prologue): Call build_class_template(); predefine 'id' and 'Class' as typedefs; rename 'temp_type' to 'type'; disable debug hooks for duration of function; fix GNU runtime messenger signatures to correspond to reality; forward-declare '__objc_exec_class' for the GNU runtime; call build_selector_table_decl(); in ObjC++ mode, generate 'extern "C" { ... }' wrappers around synthesized declarations; call build_protocol_template() and build_category_template(). (string_hash, string_eq): New functions. (objc_build_string_object): Check metaclass correctness only once; store string literals in hash table. (objc_build_constructor): Do not convert initializer elements; adjust for ObjC++ impedance mismatch. (build_objc_symtab_template): Call create_field_decl() instead of create_builtin_decl(). (init_objc_symtab): Add missing conversion to initializer element. (build_metadata_decl): Call start_var_decl() instead of define_decl(). (generate_objc_symtab_decl): Do not call build_category_template(); call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(). (build_module_descriptor): Call create_field_decl() instead of grokfield(); call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(); always mark module descriptor as used; move GNU runtime-specific functionality to build_module_initializer_routine(). (build_module_initializer_routine): New function, broken off of build_module_descriptor(). (objc_static_init_needed_p, objc_generate_static_init_call): New functions. (generate_static_references, generate_strings, build_selector_translation_table, generate_descriptor_table, generate_ivars_list, generate_dispatch_table, generate_category): Call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(); build a type directly instead of via groktypename(). (build_selector_reference_decl, build_selector_table_decl, build_class_reference_decl, build_protocol_reference, generate_objc_image_info): Call start_var_decl() instead of build_decl(). (build_selector_reference): For GNU runtime, do not call build_selector_reference_decl(). (build_selector, build_typed_selector_reference): Always convert result to the selector type. (add_objc_string): Cast return value to 'char *'. (build_method_prototype_template, build_selector_template, build_method_template): Use actual selector type for fields pointing to selectors. (finish_objc): For GNU runtime, call build_module_initializer_routine() after build_module_descriptor(). (generate_protocol_list, generate_shared_structures): Call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(); build a type directly instead of via groktypename(). (synth_id_with_class_suffix): Return a string. (get_arg_type_list): For instance methods, use the instance type for 'self'; do not call groktypename_in_parm_context(). (build_objc_string_decl): Squash redeclaration errors in ObjC++. (objc_is_class_name): Use OBJC_TYPE_NAME instead of TYPE_NAME; handle RECORD_TYPEs in ObjC as well as ObjC++. (objc_is_id): New function. (objc_is_object_ptr): Return the canonical type node. (objc_get_class_ivars): Simplify using get_class_ivars(). (get_class_ivars): Remove second parameter; create a fresh copy of the ivar list for each call; do not check for existence of super class. (objc_eh_runtime_type): Mark #ifndef OBJCPLUS. (objc_init_exceptions): When using SJLJ-style exceptions, require the use of '-fobjc-exceptions' flag; do not require it for DWARF-style exceptions. (objc_build_exc_ptr, next_sjlj_build_try_catch_finally): Use objc_object_type instead of objc_id_type. (objc_begin_catch_clause): Convert the incoming PARM_DECL into a VAR_DECL before placing it in the appropriate scope; do not call define_decl(); adjust call to c_begin_compound_stmt(); use objc_object_type instead of objc_id_type. (build_next_objc_exception_stuff): Call create_field_decl() instead of create_builtin_decl(); construct type directly instead of calling groktypename(); use OBJC_VOID_AT_END to mark end of function parameters. (build_private_template): Adjust call to get_class_ivars(); build a type directly instead of via groktypename(). (build_protocol_template, build_method_prototype_list_template, build_method_prototype_template, build_category_template, build_selector_template, build_class_template, build_super_template, build_ivar_template, build_ivar_list_template, build_method_list_template, build_method_template): Call create_field_decl() instead of grokfield(). (objc_method_parm_type): Do not call groktypename(). (generate_descriptor_table): Call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(). (generate_method_descriptors, build_protocol_initializer, generate_dispatch_tables, build_category_initializer, build_shared_structure_initializer): Do not call groktypename(). (generate_protocols): Call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(); do not call groktypename(). (error_with_ivar): Remove last parameter. (check_ivars): Do not iterate ovar CLASS_RAW_IVARS lists in addition to CLASS_IVARS lists; adjust calls to error_with_ivar(). (generate_ivar_lists): Convert one of the initializer elements; do not call groktypename(). (get_arg_type_list, start_method_def, gen_method_def): Account for new representation of variable arguments and '...' in Objective-C methods; add Objective-C++ impedance matching code. (is_objc_type_qualifier): Remove function. (adjust_type_for_id_default): Simplify; there is no longer a need to wade through declspecs. (lookup_interface, start_class, continue_class, finish_class, start_method_def, start_protocol, build_method_decl, objc_add_method, add_instance_variable, build_ivar_reference, is_ivar, is_private, get_super_receiver, objc_build_finally_epilogue): Make into static functions. (receiver_is_class_object): Use new IS_CLASS() macro. (objc_build_message_expr): Tweak ObjC++ message argument handling; call objc_finish_message_expr() instead of finish_message_expr(). (finish_message_expr): Rename to objc_finish_message_expr(); use OBJC_TYPE_NAME and OBJC_SET_TYPE_NAME macros instead of TYPE_NAME. call gen_type_name() instead of gen_declaration(); call objc_is_id() instead of using IS_ID and IS_CLASS; Use objc_class_name instead of calling get_identifier("Class"); handle CONVERT_EXPRs in receiver. (build_objc_method_call, warn_with_method): Do not call groktypename(). (build_ivar_reference): Call convert() instead of clobbering in a type. (hash_init): Initialize string_htab hash table. (add_instance_variable): Simplify parameter list; do not call grokfield(); do not populate CLASS_IVARS list. (start_class): Check for the existence of super class, if one was specified. (continue_class): Use CLASS_RAW_IVARS rather than CLASS_IVARS; do not call build_class_template(); adjust call to get_class_ivars(); call build_decl(), pushdecl() and finish_decl() instead of define_decl(). (finish_class): Call build_decl(), pushdecl() and finish_decl() instead of define_decl(). (add_protocols): Use PROTOCOL_BINFO_ELTS for the tree vector size. (start_protocol): Do not call build_protocol_template(); use PROTOCOL_BINFO_ELTS for the tree vector size. (encode_type_qualifiers): Do not handle the 'const' qualifier here. (encode_pointer): Encode 'const char *' as 'r*', for backwards compatibility. (encode_array): Use HOST_WIDE_INT_PRINT_DEC instead of "%ld". (encode_type): Handle the 'const' qualifier here. (objc_parmlist): New global variable, sued by objc_push_parm and objc_get_parm_info(). (objc_push_parm, objc_get_parm_info): New functions. (objc_expr_last): Remove function. (synth_self_and_ucmd_args): For instance methods, use the instance type for 'self'; call objc_push_parm() instead of push_parm_decl(). (start_method_def): Do not call push_scope(), declare_parm_level(), pop_scope(), push_parm_decl(), store_parm_decls() or objc_expr_last(); just use objc_push_parm() and objc_get_parm_info(). (comp_method_with_proto): Remove function. (objc_types_are_equivalent): Strip away indirections before comparing underlying types. (comp_proto_with_proto): Do not call groktypename(); types are no longer in raw declspec format. (objc_start_function): New function. (really_start_method): Call comp_proto_with_proto() instead of comp_method_with_proto(); call objc_start_function() instead of hand-crafting a function declarator. (continue_method_def, objc_expand_function_end): Remove functions. (get_super_receiver): Call objc_get_current_scope() instead of get_current_scope(); reference 'super_class' field (instead of 'class'). (finish_method_def): Rename to objc_finish_method_definition() and add a function decl parameter; move method encoding call from objc_expand_function_end(). (is_complex_decl, adorn_decl, gen_declarator, gen_declspecs, gen_declaration_1): Remove functions. (tmpbuf, RAW_DECLSPEC): Remove. (gen_declaration): Remove second parameter; simplify to deal with TYPE_P nodes instead of raw declspecs. (gen_type_name, gen_type_name_0): New functions. (gen_method_decl): Remove second parameter; call gen_type_name() instead of gen_declaration_1(). (dump_interface): Adjust calls to gen_declaration() and gen_method_decl(); do not allocate a separate string buffer. (init_objc): Allocate a larger string buffer to accommodate dump_interface(); adjust call to build_module_descriptor(); add call to build_module_initializer_routine() for the GNU runtime. (generate_classref_translation_entry): Do not call start_decl(); call finish_var_decl() instead of finish_decl(); call convert() instead of build_c_cast(). * objc-act.h (CLASS_OWN_IVARS): Remove accessor. (CLASS_BINFO_ELTS): Reduce from 6 to 5, now that CLASS_OWN_IVARS is gone. (OCTI_GNU_INIT_DECL, GNU_INIT_decl): New. (OCTI_ELLIPSIS_NODE, objc_ellipsis_node): Remove. (OCTI_ID_ID, id_type, objc_id_id): Rename to OCTI_ID_NAME, objc_object_type and objc_object_name, respectively. (OCTI_CLS_REF, OCTI_CLASS_NAME, objc_class_reference, objc_class_name): New. (IS_CLASS): New macro. (IS_ID, IS_SUPER): Robustify. (OCTI_EXECCLASS_DECL, execclass_decl): New. (finish_file, start_class, continue_class, finish_class, start_method_def, continue_method_def, finish_method_def, start_protocol, finish_protocol, objc_build_throw_stmt, objc_build_try_catch_finally_stmt, objc_build_synchronized_prologue, objc_build_synchronized_epilogue, objc_build_try_prologue, objc_build_try_epilogue, objc_build_catch_stmt, objc_build_catch_epilogue, objc_build_finally_prologue, objc_build_finally_epilogue, is_ivar, is_private, is_public, add_instance_variable, objc_add_method, get_super_receiver, objc_clear_super_receiver, get_class_ivars_from_name, get_class_reference, get_static_reference, get_object_reference, build_message_expr, finish_message_expr, build_selector_expr, build_ivar_reference, build_keyword_decl, build_method_decl, build_protocol_expr, build_objc_string_object, objc_declare_alias, objc_declare_class, objc_declare_protocols, objc_comptypes, objc_check_decl, build_encode_expr): Remove prototypes. (imp_count, cat_count): Make GGC-aware. (OBJC_SET_TYPE_NAME): New macro. From-SVN: r87168
2004-09-08 02:49:44 +02:00
return convert (objc_selector_type, expr);
}
static tree
build_selector_reference (tree ident)
{
tree *chain = &sel_ref_chain;
tree expr;
int index = 0;
while (*chain)
{
if (TREE_VALUE (*chain) == ident)
return (flag_next_runtime
? TREE_PURPOSE (*chain)
: build_array_ref (UOBJC_SELECTOR_TABLE_decl,
tree.h (build_int_cst): New, sign extended constant. * tree.h (build_int_cst): New, sign extended constant. (build_int_cstu): New, zero extended constant. (build_int_cst_wide): Renamed from build_int_cst. * tree.c (build_int_cst, build_int_cstu): New. (build_int_cst_wide): Renamed from build_int_cst. (make_vector_type, build_common_tree_nodes, build_common_tree_nodes_2): Adjust build_int_cst calls. * builtins.c (expand_builtin_prefetch, expand_builtin_strstr, expand_builtin_strpbrk, expand_builtin_fputs, build_string_literal, expand_builtin_printf, expand_builtin_sprintf, fold_builtin_classify_type, fold_builtin_lround, fold_builtin_bitop, fold_builtin_isascii, fold_builtin_toascii, fold_builtin_isdigit, simplify_builtin_strstr, simplify_builtin_strpbrk, fold_builtin_fputs, simplify_builtin_sprintf): Likewise. * c-common.c (start_fname_decls, fix_string_type, shorten_compare, DEF_ATTR_INT): Likewise. * c-decl.c (complete_array_type, check_bitfield_type_and_width): Likewise. * c-lex.c (interpret_integer, lex_charconst): Likewise. * c-parse.in (primary) <TYPES_COMPATIBLE_P> Likewise. * c-pretty-print.c (pp_c_integer_constant): Likewise. * c-typeck.c (really_start_incremental_init, push_init_level, set_nonincremental_init_from_string): Likewise. * calls.c (load_register_parameters): Likewise. convert.c (convert_to_pointer): Likewise. coverage.c (coverage_counter_alloc, tree_coverage_counter_ref, build_fn_info_type, build_fn_info_value, build_ctr_info_value, build_gcov_info): Likewise. * except.c (init_eh, assign_filter_values): Likewise. * expmed.c (store_fixed_bit_field, extract_bit_field, extract_fixed_bit_field, extract_split_bit_field, expand_shift, expand_mult_const, expand_mult_highpart_adjust, extract_high_half, expand_sdiv_pow2, expand_divmod, make_tree): Likewise. * expr.c (convert_move, emit_group_load, emit_group_store, expand_assignment, store_constructor, store_field, expand_expr_real_1, reduce_to_bit_field_precision): Likewise. fold-const.c (force_fit_type, int_const_binop, fold_convert_const, invert_truthvalue, optimize_bit_field_compare, decode_field_reference, all_ones_mask_p, constant_boolean_node, fold_div_compare, fold, fold_read_from_constant_string, fold_negate_const, fold_abs_const, fold_not_const, round_up, round_down): Likewise. * function.c (assign_parm_setup_block): Likewise. * stmt.c (shift_return_value, expand_case, estimate_case_costs): Likewise. * stor-layout.c (layout_type, initialize_sizetypes, set_min_and_max_values_for_integral_type): Likewise. * tree-chrec.c (chrec_fold_multiply_poly_poly, reset_evolution_in_loop): Likewise. * tree-chrec.h (build_polynomial_chrec): Likewise. * tree-complex.c (build_replicated_const): Likewise. * tree-eh.c (honor_protect_cleanup_actions, lower_try_finally_onedest, lower_try_finally_copy, lower_try_finally_switch): Likewise. * tree-mudflap.c (mf_build_string, mx_register_decls, mudflap_register_call, mudflap_enqueue_constant): Likewise. * tree-nested.c (get_trampoline_type, get_nl_goto_field): Likewise. * tree-pretty-print.c (dump_generic_node): Likewise. * tree-ssa-ccp.c (widen_bitfield, maybe_fold_offset_to_array_ref): Likewise. * tree-ssa-dom.c (simplify_rhs_and_lookup_avail_expr): Likewise. * tree-ssa-loop-niter.c (number_of_iterations_cond, loop_niter_by_eval, upper_bound_in_type, lower_bound_in_type): Likewise. * tree-ssa-loop-ivcanon.c (create_canonical_iv, canonicalize_loop_induction_variables): Likewise. * tree-vectorizer.c (vect_create_index_for_array_ref, vect_transform_loop_bound, vect_compute_data_ref_alignment): Likewise. * config/alpha/alpha.c (alpha_initialize_trampoline, alpha_va_start, alpha_gimplify_va_arg_1): Likewise. * config/arm/arm.c (arm_get_cookie_size): Likewise. * config/c4x/c4x.c (c4x_gimplify_va_arg_expr): Likewise. * config/i386/i386.c (ix86_va_start, ix86_gimplify_va_arg): Likewise. * config/ia64/ia64.c (ia64_gimplify_va_arg): Likewise. * config/mips/mips.c (mips_build_builtin_va_list, mips_va_start, mips_gimplify_va_arg_expr): Likewise. * config/pa/pa.c (hppa_gimplify_va_arg_expr): Likewise. * config/rs6000/rs6000.c (rs6000_va_start, rs6000_gimplify_va_arg, add_compiler_branch_island): Likewise. * config/s390/s390.c (s390_va_start): Likewise. * config/sh/sh.c (sh_va_start): Likewise. * config/stormy16/stormy16.c (xstormy16_expand_builtin_va_start): Likewise. * config/xtensa/xtensa.c (xtensa_va_start, xtensa_gimplify_va_arg_expr): Likewise. * objc/objc-act.c (build_objc_string_object, build_objc_symtab_template, init_def_list, init_objc_symtab, init_module_descriptor, generate_static_references, build_selector_translation_table, get_proto_encoding, build_typed_selector_reference, build_selector_reference, build_next_objc_exception_stuff, build_method_prototype_list_template, generate_descriptor_table, generate_protocols, build_protocol_initializer, build_ivar_list_template, build_method_list_template, build_ivar_list_initializer, generate_ivars_list, generate_dispatch_table, generate_protocol_list, build_category_initializer, build_shared_structure_initializer, generate_shared_structures, handle_impent, generate_objc_image_info): Likewise. 2004-04-25 Paolo Bonzini <bonzini@gnu.org> * cfglayout.c (duplicate_insn_chain): Remove references to NOTE_INSN_LOOP_VTOP and NOTE_INSN_LOOP_CONT. * cfgloop.h (struct loop): Remove fields vtop, cont and cont_dominator. * cfgrtl.c (rtl_delete_block): Remove handling of NOTE_INSN_LOOP_CONT. * final.c (final_scan_insn): Remove references to NOTE_INSN_LOOP_VTOP and NOTE_INSN_LOOP_CONT. * insn-notes.def (NOTE_INSN_LOOP_VTOP, NOTE_INSN_LOOP_CONT): Remove. * jump.c (squeeze_notes): Remove references to NOTE_INSN_LOOP_VTOP and NOTE_INSN_LOOP_CONT. * loop.c (scan_loops, find_and_verify_loops, for_each_insn_in_loop, check_dbra_loop, loop_dump_aux): Remove references to removed notes and fields. * reorg.c (mostly_true_jump): Do not rely on NOTE_INSN_LOOP_VTOPs. * unroll.c (unroll_loop, copy_loop_body, loop_iterations): Remove references to removed notes and fields. (subtract_reg_term, ujump_to_loop_cont): Remove. From-SVN: r86544
2004-08-25 11:52:54 +02:00
build_int_cst (NULL_TREE, index)));
index++;
chain = &TREE_CHAIN (*chain);
}
Makefile.in (c-parse.o): Depend on $(C_COMMON_H). [gcc/ChangeLog] 2004-09-07 Ziemowit Laski <zlaski@apple.com> * Makefile.in (c-parse.o): Depend on $(C_COMMON_H). * c-parse.in: Include c-common.h instead of objc-act.h. (ivar_decl_list, ivar_decls, ivar_decl, ivars, ivar_declarator, myparms, myparm): Remove %type declarations. (methodtype, optparms, OBJC_TYPE_QUAL, objc_quals, objc_qual, objc_typename, objc_try_catch_stmt, optellipsis): Add %type declarations. (objc_inherit_code, objc_public_flag): Remove. (typespec_nonreserved_nonattr): Call objc_get_protocol_qualified_type() instead of get_static_reference() and get_protocol_reference(). (stmt_nocomp): Call grokparm() on @catch parameter. (objcdef): Move semantic action to objc_finish_implementation(). (classdef): Move semantic action to objc_start_class_interface(), objc_continue_interface(), objc_finish_interface(), objc_start_class_implementation(), objc_continue_implementation(), objc_start_category_interface() and objc_start_category_implementation(). (protocoldef): Move semantic actions to objc_start_protocol() and objc_finish_interface(). (ivar_decl_list): Remove nonterminal. (visibility_spec): Move semantic actions to objc_set_visibility(). (ivar_decls): Remove assignment to $$. (ivar_decl): Rephrase in terms of component_decl; call objc_add_instance_variable(). (ivars, ivar_declarator): Remove nonterminals. (opt_semi): New nonterminal. (methodtype): Remove semantic actions. (methoddef): Move semantic actions to objc_set_method_type(), objc_start_method_definition() and objc_finish_method_definition(). (methodproto): Move semantic actions to objc_set_method_type() and objc_add_method_declaration(). (methoddecl): Use objc_typename instead of typename; move semantic actions to objc_build_method_signature(). (optarglist, myxdecls, mydecl, myparms, myparm): Remove nonterminals. (optparmlist): Express in terms of optparms and optellipsis. (optparms, optellipsis, objc_qual, objc_quals, objc_typename): New nonterminals. (keyworddecl): Use objc_typename instead of typename. (rid_to_yy): Mark RID_IN, RID_OUT, RID_INOUT, RID_BYCOPY, RID_BYREF and RID_ONEWAY as returning OBJC_TYPE_QUAL to yyparse(). [gcc/objc/ChangeLog] 2004-09-07 Ziemowit Laski <zlaski@apple.com> * Make-lang.in (objc/objc-parse.o): Depend on $(C_COMMON_H) instead of objc/objc-act.h. (objc/objc-act.o): Depend on $(HASHTAB_H). * objc-act.c: Include hashtab.h; in ObjC++ mode, include cp-tree.h and objcp-decl.h instead of c-tree.h. (build_module_descriptor, get_class_ivars, synth_id_with_class_suffix, error_with_ivar, gen_method_decl, gen_declaration, setup_string_decl, build_protocol_template): Adjust prototypes. (build_module_initializer_routine, start_class, continue_class, finish_class, start_method_def, objc_start_function, start_protocol, build_method_decl, objc_add_method, add_instance_variable, build_ivar_reference, is_ivar, is_private, get_super_receiver, build_selector_table_decl, objc_push_parm, objc_get_parm_info, gen_type_name, gen_type_name_0, start_var_decl, finish_var_decl, create_field_decl): New prototypes. (objc_expand_function_end, comp_method_with_proto, objc_expr_last, gen_declaration_1, gen_declarator, is_complex_decl, adorn_decl, define_decl, create_builtin_decl, gen_declspecs): Remove prototypes. (TYPE_ID): Rename to OBJECT_TYPEDEF_NAME. (CLASS_TYPEDEF_NAME): New. (TAG_EXECCLASS): Change from a global variable to a #define. (TAG_RETURN_STRUCT): Delete. (TAG_GNUINIT): New, holds '__objc_gnu_init' name. (objc_inherit_code, objc_public_flag): New, moved from c-parse.in. (string_descriptor): New struct. (string_htab): New hash table. (string_hash, string_eq): New prototypes. (generate_struct_by_value_array): Call create_field_decl() instead of create_builtin_decl(). (objc_init): Do not initialize objc_ellipsis_node or TAG_EXECCLASS; In ObjC++ mode, call cxx_init() instead of c_objc_common_init(). (objc_finish_file): In ObjC++, call instantiate_pending_templates() and cp_finish_file(). (define_decl, get_static_reference, get_protocol_reference, create_builtin_decl): Remove functions. (objc_start_class_interface, objc_start_category_interface, objc_start_protocol, objc_continue_interface, objc_finish_interface, objc_start_class_implementation, objc_start_category_implementation, objc_continue_implementation, objc_finish_implementation, objc_set_visibility, objc_set_method_type, objc_build_method_signature, objc_add_method_declaration, objc_start_method_definition, objc_add_instance_variable, objc_get_protocol_qualified_type, create_field_decl, start_var_decl, finish_var_decl): New functions. (setup_string_decl): Simplify since it is only called once. (synth_module_prologue): Call build_class_template(); predefine 'id' and 'Class' as typedefs; rename 'temp_type' to 'type'; disable debug hooks for duration of function; fix GNU runtime messenger signatures to correspond to reality; forward-declare '__objc_exec_class' for the GNU runtime; call build_selector_table_decl(); in ObjC++ mode, generate 'extern "C" { ... }' wrappers around synthesized declarations; call build_protocol_template() and build_category_template(). (string_hash, string_eq): New functions. (objc_build_string_object): Check metaclass correctness only once; store string literals in hash table. (objc_build_constructor): Do not convert initializer elements; adjust for ObjC++ impedance mismatch. (build_objc_symtab_template): Call create_field_decl() instead of create_builtin_decl(). (init_objc_symtab): Add missing conversion to initializer element. (build_metadata_decl): Call start_var_decl() instead of define_decl(). (generate_objc_symtab_decl): Do not call build_category_template(); call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(). (build_module_descriptor): Call create_field_decl() instead of grokfield(); call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(); always mark module descriptor as used; move GNU runtime-specific functionality to build_module_initializer_routine(). (build_module_initializer_routine): New function, broken off of build_module_descriptor(). (objc_static_init_needed_p, objc_generate_static_init_call): New functions. (generate_static_references, generate_strings, build_selector_translation_table, generate_descriptor_table, generate_ivars_list, generate_dispatch_table, generate_category): Call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(); build a type directly instead of via groktypename(). (build_selector_reference_decl, build_selector_table_decl, build_class_reference_decl, build_protocol_reference, generate_objc_image_info): Call start_var_decl() instead of build_decl(). (build_selector_reference): For GNU runtime, do not call build_selector_reference_decl(). (build_selector, build_typed_selector_reference): Always convert result to the selector type. (add_objc_string): Cast return value to 'char *'. (build_method_prototype_template, build_selector_template, build_method_template): Use actual selector type for fields pointing to selectors. (finish_objc): For GNU runtime, call build_module_initializer_routine() after build_module_descriptor(). (generate_protocol_list, generate_shared_structures): Call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(); build a type directly instead of via groktypename(). (synth_id_with_class_suffix): Return a string. (get_arg_type_list): For instance methods, use the instance type for 'self'; do not call groktypename_in_parm_context(). (build_objc_string_decl): Squash redeclaration errors in ObjC++. (objc_is_class_name): Use OBJC_TYPE_NAME instead of TYPE_NAME; handle RECORD_TYPEs in ObjC as well as ObjC++. (objc_is_id): New function. (objc_is_object_ptr): Return the canonical type node. (objc_get_class_ivars): Simplify using get_class_ivars(). (get_class_ivars): Remove second parameter; create a fresh copy of the ivar list for each call; do not check for existence of super class. (objc_eh_runtime_type): Mark #ifndef OBJCPLUS. (objc_init_exceptions): When using SJLJ-style exceptions, require the use of '-fobjc-exceptions' flag; do not require it for DWARF-style exceptions. (objc_build_exc_ptr, next_sjlj_build_try_catch_finally): Use objc_object_type instead of objc_id_type. (objc_begin_catch_clause): Convert the incoming PARM_DECL into a VAR_DECL before placing it in the appropriate scope; do not call define_decl(); adjust call to c_begin_compound_stmt(); use objc_object_type instead of objc_id_type. (build_next_objc_exception_stuff): Call create_field_decl() instead of create_builtin_decl(); construct type directly instead of calling groktypename(); use OBJC_VOID_AT_END to mark end of function parameters. (build_private_template): Adjust call to get_class_ivars(); build a type directly instead of via groktypename(). (build_protocol_template, build_method_prototype_list_template, build_method_prototype_template, build_category_template, build_selector_template, build_class_template, build_super_template, build_ivar_template, build_ivar_list_template, build_method_list_template, build_method_template): Call create_field_decl() instead of grokfield(). (objc_method_parm_type): Do not call groktypename(). (generate_descriptor_table): Call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(). (generate_method_descriptors, build_protocol_initializer, generate_dispatch_tables, build_category_initializer, build_shared_structure_initializer): Do not call groktypename(). (generate_protocols): Call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(); do not call groktypename(). (error_with_ivar): Remove last parameter. (check_ivars): Do not iterate ovar CLASS_RAW_IVARS lists in addition to CLASS_IVARS lists; adjust calls to error_with_ivar(). (generate_ivar_lists): Convert one of the initializer elements; do not call groktypename(). (get_arg_type_list, start_method_def, gen_method_def): Account for new representation of variable arguments and '...' in Objective-C methods; add Objective-C++ impedance matching code. (is_objc_type_qualifier): Remove function. (adjust_type_for_id_default): Simplify; there is no longer a need to wade through declspecs. (lookup_interface, start_class, continue_class, finish_class, start_method_def, start_protocol, build_method_decl, objc_add_method, add_instance_variable, build_ivar_reference, is_ivar, is_private, get_super_receiver, objc_build_finally_epilogue): Make into static functions. (receiver_is_class_object): Use new IS_CLASS() macro. (objc_build_message_expr): Tweak ObjC++ message argument handling; call objc_finish_message_expr() instead of finish_message_expr(). (finish_message_expr): Rename to objc_finish_message_expr(); use OBJC_TYPE_NAME and OBJC_SET_TYPE_NAME macros instead of TYPE_NAME. call gen_type_name() instead of gen_declaration(); call objc_is_id() instead of using IS_ID and IS_CLASS; Use objc_class_name instead of calling get_identifier("Class"); handle CONVERT_EXPRs in receiver. (build_objc_method_call, warn_with_method): Do not call groktypename(). (build_ivar_reference): Call convert() instead of clobbering in a type. (hash_init): Initialize string_htab hash table. (add_instance_variable): Simplify parameter list; do not call grokfield(); do not populate CLASS_IVARS list. (start_class): Check for the existence of super class, if one was specified. (continue_class): Use CLASS_RAW_IVARS rather than CLASS_IVARS; do not call build_class_template(); adjust call to get_class_ivars(); call build_decl(), pushdecl() and finish_decl() instead of define_decl(). (finish_class): Call build_decl(), pushdecl() and finish_decl() instead of define_decl(). (add_protocols): Use PROTOCOL_BINFO_ELTS for the tree vector size. (start_protocol): Do not call build_protocol_template(); use PROTOCOL_BINFO_ELTS for the tree vector size. (encode_type_qualifiers): Do not handle the 'const' qualifier here. (encode_pointer): Encode 'const char *' as 'r*', for backwards compatibility. (encode_array): Use HOST_WIDE_INT_PRINT_DEC instead of "%ld". (encode_type): Handle the 'const' qualifier here. (objc_parmlist): New global variable, sued by objc_push_parm and objc_get_parm_info(). (objc_push_parm, objc_get_parm_info): New functions. (objc_expr_last): Remove function. (synth_self_and_ucmd_args): For instance methods, use the instance type for 'self'; call objc_push_parm() instead of push_parm_decl(). (start_method_def): Do not call push_scope(), declare_parm_level(), pop_scope(), push_parm_decl(), store_parm_decls() or objc_expr_last(); just use objc_push_parm() and objc_get_parm_info(). (comp_method_with_proto): Remove function. (objc_types_are_equivalent): Strip away indirections before comparing underlying types. (comp_proto_with_proto): Do not call groktypename(); types are no longer in raw declspec format. (objc_start_function): New function. (really_start_method): Call comp_proto_with_proto() instead of comp_method_with_proto(); call objc_start_function() instead of hand-crafting a function declarator. (continue_method_def, objc_expand_function_end): Remove functions. (get_super_receiver): Call objc_get_current_scope() instead of get_current_scope(); reference 'super_class' field (instead of 'class'). (finish_method_def): Rename to objc_finish_method_definition() and add a function decl parameter; move method encoding call from objc_expand_function_end(). (is_complex_decl, adorn_decl, gen_declarator, gen_declspecs, gen_declaration_1): Remove functions. (tmpbuf, RAW_DECLSPEC): Remove. (gen_declaration): Remove second parameter; simplify to deal with TYPE_P nodes instead of raw declspecs. (gen_type_name, gen_type_name_0): New functions. (gen_method_decl): Remove second parameter; call gen_type_name() instead of gen_declaration_1(). (dump_interface): Adjust calls to gen_declaration() and gen_method_decl(); do not allocate a separate string buffer. (init_objc): Allocate a larger string buffer to accommodate dump_interface(); adjust call to build_module_descriptor(); add call to build_module_initializer_routine() for the GNU runtime. (generate_classref_translation_entry): Do not call start_decl(); call finish_var_decl() instead of finish_decl(); call convert() instead of build_c_cast(). * objc-act.h (CLASS_OWN_IVARS): Remove accessor. (CLASS_BINFO_ELTS): Reduce from 6 to 5, now that CLASS_OWN_IVARS is gone. (OCTI_GNU_INIT_DECL, GNU_INIT_decl): New. (OCTI_ELLIPSIS_NODE, objc_ellipsis_node): Remove. (OCTI_ID_ID, id_type, objc_id_id): Rename to OCTI_ID_NAME, objc_object_type and objc_object_name, respectively. (OCTI_CLS_REF, OCTI_CLASS_NAME, objc_class_reference, objc_class_name): New. (IS_CLASS): New macro. (IS_ID, IS_SUPER): Robustify. (OCTI_EXECCLASS_DECL, execclass_decl): New. (finish_file, start_class, continue_class, finish_class, start_method_def, continue_method_def, finish_method_def, start_protocol, finish_protocol, objc_build_throw_stmt, objc_build_try_catch_finally_stmt, objc_build_synchronized_prologue, objc_build_synchronized_epilogue, objc_build_try_prologue, objc_build_try_epilogue, objc_build_catch_stmt, objc_build_catch_epilogue, objc_build_finally_prologue, objc_build_finally_epilogue, is_ivar, is_private, is_public, add_instance_variable, objc_add_method, get_super_receiver, objc_clear_super_receiver, get_class_ivars_from_name, get_class_reference, get_static_reference, get_object_reference, build_message_expr, finish_message_expr, build_selector_expr, build_ivar_reference, build_keyword_decl, build_method_decl, build_protocol_expr, build_objc_string_object, objc_declare_alias, objc_declare_class, objc_declare_protocols, objc_comptypes, objc_check_decl, build_encode_expr): Remove prototypes. (imp_count, cat_count): Make GGC-aware. (OBJC_SET_TYPE_NAME): New macro. From-SVN: r87168
2004-09-08 02:49:44 +02:00
expr = (flag_next_runtime ? build_selector_reference_decl (): NULL_TREE);
*chain = tree_cons (expr, ident, NULL_TREE);
return (flag_next_runtime
? expr
: build_array_ref (UOBJC_SELECTOR_TABLE_decl,
tree.h (build_int_cst): New, sign extended constant. * tree.h (build_int_cst): New, sign extended constant. (build_int_cstu): New, zero extended constant. (build_int_cst_wide): Renamed from build_int_cst. * tree.c (build_int_cst, build_int_cstu): New. (build_int_cst_wide): Renamed from build_int_cst. (make_vector_type, build_common_tree_nodes, build_common_tree_nodes_2): Adjust build_int_cst calls. * builtins.c (expand_builtin_prefetch, expand_builtin_strstr, expand_builtin_strpbrk, expand_builtin_fputs, build_string_literal, expand_builtin_printf, expand_builtin_sprintf, fold_builtin_classify_type, fold_builtin_lround, fold_builtin_bitop, fold_builtin_isascii, fold_builtin_toascii, fold_builtin_isdigit, simplify_builtin_strstr, simplify_builtin_strpbrk, fold_builtin_fputs, simplify_builtin_sprintf): Likewise. * c-common.c (start_fname_decls, fix_string_type, shorten_compare, DEF_ATTR_INT): Likewise. * c-decl.c (complete_array_type, check_bitfield_type_and_width): Likewise. * c-lex.c (interpret_integer, lex_charconst): Likewise. * c-parse.in (primary) <TYPES_COMPATIBLE_P> Likewise. * c-pretty-print.c (pp_c_integer_constant): Likewise. * c-typeck.c (really_start_incremental_init, push_init_level, set_nonincremental_init_from_string): Likewise. * calls.c (load_register_parameters): Likewise. convert.c (convert_to_pointer): Likewise. coverage.c (coverage_counter_alloc, tree_coverage_counter_ref, build_fn_info_type, build_fn_info_value, build_ctr_info_value, build_gcov_info): Likewise. * except.c (init_eh, assign_filter_values): Likewise. * expmed.c (store_fixed_bit_field, extract_bit_field, extract_fixed_bit_field, extract_split_bit_field, expand_shift, expand_mult_const, expand_mult_highpart_adjust, extract_high_half, expand_sdiv_pow2, expand_divmod, make_tree): Likewise. * expr.c (convert_move, emit_group_load, emit_group_store, expand_assignment, store_constructor, store_field, expand_expr_real_1, reduce_to_bit_field_precision): Likewise. fold-const.c (force_fit_type, int_const_binop, fold_convert_const, invert_truthvalue, optimize_bit_field_compare, decode_field_reference, all_ones_mask_p, constant_boolean_node, fold_div_compare, fold, fold_read_from_constant_string, fold_negate_const, fold_abs_const, fold_not_const, round_up, round_down): Likewise. * function.c (assign_parm_setup_block): Likewise. * stmt.c (shift_return_value, expand_case, estimate_case_costs): Likewise. * stor-layout.c (layout_type, initialize_sizetypes, set_min_and_max_values_for_integral_type): Likewise. * tree-chrec.c (chrec_fold_multiply_poly_poly, reset_evolution_in_loop): Likewise. * tree-chrec.h (build_polynomial_chrec): Likewise. * tree-complex.c (build_replicated_const): Likewise. * tree-eh.c (honor_protect_cleanup_actions, lower_try_finally_onedest, lower_try_finally_copy, lower_try_finally_switch): Likewise. * tree-mudflap.c (mf_build_string, mx_register_decls, mudflap_register_call, mudflap_enqueue_constant): Likewise. * tree-nested.c (get_trampoline_type, get_nl_goto_field): Likewise. * tree-pretty-print.c (dump_generic_node): Likewise. * tree-ssa-ccp.c (widen_bitfield, maybe_fold_offset_to_array_ref): Likewise. * tree-ssa-dom.c (simplify_rhs_and_lookup_avail_expr): Likewise. * tree-ssa-loop-niter.c (number_of_iterations_cond, loop_niter_by_eval, upper_bound_in_type, lower_bound_in_type): Likewise. * tree-ssa-loop-ivcanon.c (create_canonical_iv, canonicalize_loop_induction_variables): Likewise. * tree-vectorizer.c (vect_create_index_for_array_ref, vect_transform_loop_bound, vect_compute_data_ref_alignment): Likewise. * config/alpha/alpha.c (alpha_initialize_trampoline, alpha_va_start, alpha_gimplify_va_arg_1): Likewise. * config/arm/arm.c (arm_get_cookie_size): Likewise. * config/c4x/c4x.c (c4x_gimplify_va_arg_expr): Likewise. * config/i386/i386.c (ix86_va_start, ix86_gimplify_va_arg): Likewise. * config/ia64/ia64.c (ia64_gimplify_va_arg): Likewise. * config/mips/mips.c (mips_build_builtin_va_list, mips_va_start, mips_gimplify_va_arg_expr): Likewise. * config/pa/pa.c (hppa_gimplify_va_arg_expr): Likewise. * config/rs6000/rs6000.c (rs6000_va_start, rs6000_gimplify_va_arg, add_compiler_branch_island): Likewise. * config/s390/s390.c (s390_va_start): Likewise. * config/sh/sh.c (sh_va_start): Likewise. * config/stormy16/stormy16.c (xstormy16_expand_builtin_va_start): Likewise. * config/xtensa/xtensa.c (xtensa_va_start, xtensa_gimplify_va_arg_expr): Likewise. * objc/objc-act.c (build_objc_string_object, build_objc_symtab_template, init_def_list, init_objc_symtab, init_module_descriptor, generate_static_references, build_selector_translation_table, get_proto_encoding, build_typed_selector_reference, build_selector_reference, build_next_objc_exception_stuff, build_method_prototype_list_template, generate_descriptor_table, generate_protocols, build_protocol_initializer, build_ivar_list_template, build_method_list_template, build_ivar_list_initializer, generate_ivars_list, generate_dispatch_table, generate_protocol_list, build_category_initializer, build_shared_structure_initializer, generate_shared_structures, handle_impent, generate_objc_image_info): Likewise. 2004-04-25 Paolo Bonzini <bonzini@gnu.org> * cfglayout.c (duplicate_insn_chain): Remove references to NOTE_INSN_LOOP_VTOP and NOTE_INSN_LOOP_CONT. * cfgloop.h (struct loop): Remove fields vtop, cont and cont_dominator. * cfgrtl.c (rtl_delete_block): Remove handling of NOTE_INSN_LOOP_CONT. * final.c (final_scan_insn): Remove references to NOTE_INSN_LOOP_VTOP and NOTE_INSN_LOOP_CONT. * insn-notes.def (NOTE_INSN_LOOP_VTOP, NOTE_INSN_LOOP_CONT): Remove. * jump.c (squeeze_notes): Remove references to NOTE_INSN_LOOP_VTOP and NOTE_INSN_LOOP_CONT. * loop.c (scan_loops, find_and_verify_loops, for_each_insn_in_loop, check_dbra_loop, loop_dump_aux): Remove references to removed notes and fields. * reorg.c (mostly_true_jump): Do not rely on NOTE_INSN_LOOP_VTOPs. * unroll.c (unroll_loop, copy_loop_body, loop_iterations): Remove references to removed notes and fields. (subtract_reg_term, ujump_to_loop_cont): Remove. From-SVN: r86544
2004-08-25 11:52:54 +02:00
build_int_cst (NULL_TREE, index)));
}
static GTY(()) int class_reference_idx;
static tree
build_class_reference_decl (void)
{
Makefile.in (c-parse.o): Depend on $(C_COMMON_H). [gcc/ChangeLog] 2004-09-07 Ziemowit Laski <zlaski@apple.com> * Makefile.in (c-parse.o): Depend on $(C_COMMON_H). * c-parse.in: Include c-common.h instead of objc-act.h. (ivar_decl_list, ivar_decls, ivar_decl, ivars, ivar_declarator, myparms, myparm): Remove %type declarations. (methodtype, optparms, OBJC_TYPE_QUAL, objc_quals, objc_qual, objc_typename, objc_try_catch_stmt, optellipsis): Add %type declarations. (objc_inherit_code, objc_public_flag): Remove. (typespec_nonreserved_nonattr): Call objc_get_protocol_qualified_type() instead of get_static_reference() and get_protocol_reference(). (stmt_nocomp): Call grokparm() on @catch parameter. (objcdef): Move semantic action to objc_finish_implementation(). (classdef): Move semantic action to objc_start_class_interface(), objc_continue_interface(), objc_finish_interface(), objc_start_class_implementation(), objc_continue_implementation(), objc_start_category_interface() and objc_start_category_implementation(). (protocoldef): Move semantic actions to objc_start_protocol() and objc_finish_interface(). (ivar_decl_list): Remove nonterminal. (visibility_spec): Move semantic actions to objc_set_visibility(). (ivar_decls): Remove assignment to $$. (ivar_decl): Rephrase in terms of component_decl; call objc_add_instance_variable(). (ivars, ivar_declarator): Remove nonterminals. (opt_semi): New nonterminal. (methodtype): Remove semantic actions. (methoddef): Move semantic actions to objc_set_method_type(), objc_start_method_definition() and objc_finish_method_definition(). (methodproto): Move semantic actions to objc_set_method_type() and objc_add_method_declaration(). (methoddecl): Use objc_typename instead of typename; move semantic actions to objc_build_method_signature(). (optarglist, myxdecls, mydecl, myparms, myparm): Remove nonterminals. (optparmlist): Express in terms of optparms and optellipsis. (optparms, optellipsis, objc_qual, objc_quals, objc_typename): New nonterminals. (keyworddecl): Use objc_typename instead of typename. (rid_to_yy): Mark RID_IN, RID_OUT, RID_INOUT, RID_BYCOPY, RID_BYREF and RID_ONEWAY as returning OBJC_TYPE_QUAL to yyparse(). [gcc/objc/ChangeLog] 2004-09-07 Ziemowit Laski <zlaski@apple.com> * Make-lang.in (objc/objc-parse.o): Depend on $(C_COMMON_H) instead of objc/objc-act.h. (objc/objc-act.o): Depend on $(HASHTAB_H). * objc-act.c: Include hashtab.h; in ObjC++ mode, include cp-tree.h and objcp-decl.h instead of c-tree.h. (build_module_descriptor, get_class_ivars, synth_id_with_class_suffix, error_with_ivar, gen_method_decl, gen_declaration, setup_string_decl, build_protocol_template): Adjust prototypes. (build_module_initializer_routine, start_class, continue_class, finish_class, start_method_def, objc_start_function, start_protocol, build_method_decl, objc_add_method, add_instance_variable, build_ivar_reference, is_ivar, is_private, get_super_receiver, build_selector_table_decl, objc_push_parm, objc_get_parm_info, gen_type_name, gen_type_name_0, start_var_decl, finish_var_decl, create_field_decl): New prototypes. (objc_expand_function_end, comp_method_with_proto, objc_expr_last, gen_declaration_1, gen_declarator, is_complex_decl, adorn_decl, define_decl, create_builtin_decl, gen_declspecs): Remove prototypes. (TYPE_ID): Rename to OBJECT_TYPEDEF_NAME. (CLASS_TYPEDEF_NAME): New. (TAG_EXECCLASS): Change from a global variable to a #define. (TAG_RETURN_STRUCT): Delete. (TAG_GNUINIT): New, holds '__objc_gnu_init' name. (objc_inherit_code, objc_public_flag): New, moved from c-parse.in. (string_descriptor): New struct. (string_htab): New hash table. (string_hash, string_eq): New prototypes. (generate_struct_by_value_array): Call create_field_decl() instead of create_builtin_decl(). (objc_init): Do not initialize objc_ellipsis_node or TAG_EXECCLASS; In ObjC++ mode, call cxx_init() instead of c_objc_common_init(). (objc_finish_file): In ObjC++, call instantiate_pending_templates() and cp_finish_file(). (define_decl, get_static_reference, get_protocol_reference, create_builtin_decl): Remove functions. (objc_start_class_interface, objc_start_category_interface, objc_start_protocol, objc_continue_interface, objc_finish_interface, objc_start_class_implementation, objc_start_category_implementation, objc_continue_implementation, objc_finish_implementation, objc_set_visibility, objc_set_method_type, objc_build_method_signature, objc_add_method_declaration, objc_start_method_definition, objc_add_instance_variable, objc_get_protocol_qualified_type, create_field_decl, start_var_decl, finish_var_decl): New functions. (setup_string_decl): Simplify since it is only called once. (synth_module_prologue): Call build_class_template(); predefine 'id' and 'Class' as typedefs; rename 'temp_type' to 'type'; disable debug hooks for duration of function; fix GNU runtime messenger signatures to correspond to reality; forward-declare '__objc_exec_class' for the GNU runtime; call build_selector_table_decl(); in ObjC++ mode, generate 'extern "C" { ... }' wrappers around synthesized declarations; call build_protocol_template() and build_category_template(). (string_hash, string_eq): New functions. (objc_build_string_object): Check metaclass correctness only once; store string literals in hash table. (objc_build_constructor): Do not convert initializer elements; adjust for ObjC++ impedance mismatch. (build_objc_symtab_template): Call create_field_decl() instead of create_builtin_decl(). (init_objc_symtab): Add missing conversion to initializer element. (build_metadata_decl): Call start_var_decl() instead of define_decl(). (generate_objc_symtab_decl): Do not call build_category_template(); call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(). (build_module_descriptor): Call create_field_decl() instead of grokfield(); call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(); always mark module descriptor as used; move GNU runtime-specific functionality to build_module_initializer_routine(). (build_module_initializer_routine): New function, broken off of build_module_descriptor(). (objc_static_init_needed_p, objc_generate_static_init_call): New functions. (generate_static_references, generate_strings, build_selector_translation_table, generate_descriptor_table, generate_ivars_list, generate_dispatch_table, generate_category): Call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(); build a type directly instead of via groktypename(). (build_selector_reference_decl, build_selector_table_decl, build_class_reference_decl, build_protocol_reference, generate_objc_image_info): Call start_var_decl() instead of build_decl(). (build_selector_reference): For GNU runtime, do not call build_selector_reference_decl(). (build_selector, build_typed_selector_reference): Always convert result to the selector type. (add_objc_string): Cast return value to 'char *'. (build_method_prototype_template, build_selector_template, build_method_template): Use actual selector type for fields pointing to selectors. (finish_objc): For GNU runtime, call build_module_initializer_routine() after build_module_descriptor(). (generate_protocol_list, generate_shared_structures): Call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(); build a type directly instead of via groktypename(). (synth_id_with_class_suffix): Return a string. (get_arg_type_list): For instance methods, use the instance type for 'self'; do not call groktypename_in_parm_context(). (build_objc_string_decl): Squash redeclaration errors in ObjC++. (objc_is_class_name): Use OBJC_TYPE_NAME instead of TYPE_NAME; handle RECORD_TYPEs in ObjC as well as ObjC++. (objc_is_id): New function. (objc_is_object_ptr): Return the canonical type node. (objc_get_class_ivars): Simplify using get_class_ivars(). (get_class_ivars): Remove second parameter; create a fresh copy of the ivar list for each call; do not check for existence of super class. (objc_eh_runtime_type): Mark #ifndef OBJCPLUS. (objc_init_exceptions): When using SJLJ-style exceptions, require the use of '-fobjc-exceptions' flag; do not require it for DWARF-style exceptions. (objc_build_exc_ptr, next_sjlj_build_try_catch_finally): Use objc_object_type instead of objc_id_type. (objc_begin_catch_clause): Convert the incoming PARM_DECL into a VAR_DECL before placing it in the appropriate scope; do not call define_decl(); adjust call to c_begin_compound_stmt(); use objc_object_type instead of objc_id_type. (build_next_objc_exception_stuff): Call create_field_decl() instead of create_builtin_decl(); construct type directly instead of calling groktypename(); use OBJC_VOID_AT_END to mark end of function parameters. (build_private_template): Adjust call to get_class_ivars(); build a type directly instead of via groktypename(). (build_protocol_template, build_method_prototype_list_template, build_method_prototype_template, build_category_template, build_selector_template, build_class_template, build_super_template, build_ivar_template, build_ivar_list_template, build_method_list_template, build_method_template): Call create_field_decl() instead of grokfield(). (objc_method_parm_type): Do not call groktypename(). (generate_descriptor_table): Call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(). (generate_method_descriptors, build_protocol_initializer, generate_dispatch_tables, build_category_initializer, build_shared_structure_initializer): Do not call groktypename(). (generate_protocols): Call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(); do not call groktypename(). (error_with_ivar): Remove last parameter. (check_ivars): Do not iterate ovar CLASS_RAW_IVARS lists in addition to CLASS_IVARS lists; adjust calls to error_with_ivar(). (generate_ivar_lists): Convert one of the initializer elements; do not call groktypename(). (get_arg_type_list, start_method_def, gen_method_def): Account for new representation of variable arguments and '...' in Objective-C methods; add Objective-C++ impedance matching code. (is_objc_type_qualifier): Remove function. (adjust_type_for_id_default): Simplify; there is no longer a need to wade through declspecs. (lookup_interface, start_class, continue_class, finish_class, start_method_def, start_protocol, build_method_decl, objc_add_method, add_instance_variable, build_ivar_reference, is_ivar, is_private, get_super_receiver, objc_build_finally_epilogue): Make into static functions. (receiver_is_class_object): Use new IS_CLASS() macro. (objc_build_message_expr): Tweak ObjC++ message argument handling; call objc_finish_message_expr() instead of finish_message_expr(). (finish_message_expr): Rename to objc_finish_message_expr(); use OBJC_TYPE_NAME and OBJC_SET_TYPE_NAME macros instead of TYPE_NAME. call gen_type_name() instead of gen_declaration(); call objc_is_id() instead of using IS_ID and IS_CLASS; Use objc_class_name instead of calling get_identifier("Class"); handle CONVERT_EXPRs in receiver. (build_objc_method_call, warn_with_method): Do not call groktypename(). (build_ivar_reference): Call convert() instead of clobbering in a type. (hash_init): Initialize string_htab hash table. (add_instance_variable): Simplify parameter list; do not call grokfield(); do not populate CLASS_IVARS list. (start_class): Check for the existence of super class, if one was specified. (continue_class): Use CLASS_RAW_IVARS rather than CLASS_IVARS; do not call build_class_template(); adjust call to get_class_ivars(); call build_decl(), pushdecl() and finish_decl() instead of define_decl(). (finish_class): Call build_decl(), pushdecl() and finish_decl() instead of define_decl(). (add_protocols): Use PROTOCOL_BINFO_ELTS for the tree vector size. (start_protocol): Do not call build_protocol_template(); use PROTOCOL_BINFO_ELTS for the tree vector size. (encode_type_qualifiers): Do not handle the 'const' qualifier here. (encode_pointer): Encode 'const char *' as 'r*', for backwards compatibility. (encode_array): Use HOST_WIDE_INT_PRINT_DEC instead of "%ld". (encode_type): Handle the 'const' qualifier here. (objc_parmlist): New global variable, sued by objc_push_parm and objc_get_parm_info(). (objc_push_parm, objc_get_parm_info): New functions. (objc_expr_last): Remove function. (synth_self_and_ucmd_args): For instance methods, use the instance type for 'self'; call objc_push_parm() instead of push_parm_decl(). (start_method_def): Do not call push_scope(), declare_parm_level(), pop_scope(), push_parm_decl(), store_parm_decls() or objc_expr_last(); just use objc_push_parm() and objc_get_parm_info(). (comp_method_with_proto): Remove function. (objc_types_are_equivalent): Strip away indirections before comparing underlying types. (comp_proto_with_proto): Do not call groktypename(); types are no longer in raw declspec format. (objc_start_function): New function. (really_start_method): Call comp_proto_with_proto() instead of comp_method_with_proto(); call objc_start_function() instead of hand-crafting a function declarator. (continue_method_def, objc_expand_function_end): Remove functions. (get_super_receiver): Call objc_get_current_scope() instead of get_current_scope(); reference 'super_class' field (instead of 'class'). (finish_method_def): Rename to objc_finish_method_definition() and add a function decl parameter; move method encoding call from objc_expand_function_end(). (is_complex_decl, adorn_decl, gen_declarator, gen_declspecs, gen_declaration_1): Remove functions. (tmpbuf, RAW_DECLSPEC): Remove. (gen_declaration): Remove second parameter; simplify to deal with TYPE_P nodes instead of raw declspecs. (gen_type_name, gen_type_name_0): New functions. (gen_method_decl): Remove second parameter; call gen_type_name() instead of gen_declaration_1(). (dump_interface): Adjust calls to gen_declaration() and gen_method_decl(); do not allocate a separate string buffer. (init_objc): Allocate a larger string buffer to accommodate dump_interface(); adjust call to build_module_descriptor(); add call to build_module_initializer_routine() for the GNU runtime. (generate_classref_translation_entry): Do not call start_decl(); call finish_var_decl() instead of finish_decl(); call convert() instead of build_c_cast(). * objc-act.h (CLASS_OWN_IVARS): Remove accessor. (CLASS_BINFO_ELTS): Reduce from 6 to 5, now that CLASS_OWN_IVARS is gone. (OCTI_GNU_INIT_DECL, GNU_INIT_decl): New. (OCTI_ELLIPSIS_NODE, objc_ellipsis_node): Remove. (OCTI_ID_ID, id_type, objc_id_id): Rename to OCTI_ID_NAME, objc_object_type and objc_object_name, respectively. (OCTI_CLS_REF, OCTI_CLASS_NAME, objc_class_reference, objc_class_name): New. (IS_CLASS): New macro. (IS_ID, IS_SUPER): Robustify. (OCTI_EXECCLASS_DECL, execclass_decl): New. (finish_file, start_class, continue_class, finish_class, start_method_def, continue_method_def, finish_method_def, start_protocol, finish_protocol, objc_build_throw_stmt, objc_build_try_catch_finally_stmt, objc_build_synchronized_prologue, objc_build_synchronized_epilogue, objc_build_try_prologue, objc_build_try_epilogue, objc_build_catch_stmt, objc_build_catch_epilogue, objc_build_finally_prologue, objc_build_finally_epilogue, is_ivar, is_private, is_public, add_instance_variable, objc_add_method, get_super_receiver, objc_clear_super_receiver, get_class_ivars_from_name, get_class_reference, get_static_reference, get_object_reference, build_message_expr, finish_message_expr, build_selector_expr, build_ivar_reference, build_keyword_decl, build_method_decl, build_protocol_expr, build_objc_string_object, objc_declare_alias, objc_declare_class, objc_declare_protocols, objc_comptypes, objc_check_decl, build_encode_expr): Remove prototypes. (imp_count, cat_count): Make GGC-aware. (OBJC_SET_TYPE_NAME): New macro. From-SVN: r87168
2004-09-08 02:49:44 +02:00
tree decl;
char buf[256];
sprintf (buf, "_OBJC_CLASS_REFERENCES_%d", class_reference_idx++);
Makefile.in (c-parse.o): Depend on $(C_COMMON_H). [gcc/ChangeLog] 2004-09-07 Ziemowit Laski <zlaski@apple.com> * Makefile.in (c-parse.o): Depend on $(C_COMMON_H). * c-parse.in: Include c-common.h instead of objc-act.h. (ivar_decl_list, ivar_decls, ivar_decl, ivars, ivar_declarator, myparms, myparm): Remove %type declarations. (methodtype, optparms, OBJC_TYPE_QUAL, objc_quals, objc_qual, objc_typename, objc_try_catch_stmt, optellipsis): Add %type declarations. (objc_inherit_code, objc_public_flag): Remove. (typespec_nonreserved_nonattr): Call objc_get_protocol_qualified_type() instead of get_static_reference() and get_protocol_reference(). (stmt_nocomp): Call grokparm() on @catch parameter. (objcdef): Move semantic action to objc_finish_implementation(). (classdef): Move semantic action to objc_start_class_interface(), objc_continue_interface(), objc_finish_interface(), objc_start_class_implementation(), objc_continue_implementation(), objc_start_category_interface() and objc_start_category_implementation(). (protocoldef): Move semantic actions to objc_start_protocol() and objc_finish_interface(). (ivar_decl_list): Remove nonterminal. (visibility_spec): Move semantic actions to objc_set_visibility(). (ivar_decls): Remove assignment to $$. (ivar_decl): Rephrase in terms of component_decl; call objc_add_instance_variable(). (ivars, ivar_declarator): Remove nonterminals. (opt_semi): New nonterminal. (methodtype): Remove semantic actions. (methoddef): Move semantic actions to objc_set_method_type(), objc_start_method_definition() and objc_finish_method_definition(). (methodproto): Move semantic actions to objc_set_method_type() and objc_add_method_declaration(). (methoddecl): Use objc_typename instead of typename; move semantic actions to objc_build_method_signature(). (optarglist, myxdecls, mydecl, myparms, myparm): Remove nonterminals. (optparmlist): Express in terms of optparms and optellipsis. (optparms, optellipsis, objc_qual, objc_quals, objc_typename): New nonterminals. (keyworddecl): Use objc_typename instead of typename. (rid_to_yy): Mark RID_IN, RID_OUT, RID_INOUT, RID_BYCOPY, RID_BYREF and RID_ONEWAY as returning OBJC_TYPE_QUAL to yyparse(). [gcc/objc/ChangeLog] 2004-09-07 Ziemowit Laski <zlaski@apple.com> * Make-lang.in (objc/objc-parse.o): Depend on $(C_COMMON_H) instead of objc/objc-act.h. (objc/objc-act.o): Depend on $(HASHTAB_H). * objc-act.c: Include hashtab.h; in ObjC++ mode, include cp-tree.h and objcp-decl.h instead of c-tree.h. (build_module_descriptor, get_class_ivars, synth_id_with_class_suffix, error_with_ivar, gen_method_decl, gen_declaration, setup_string_decl, build_protocol_template): Adjust prototypes. (build_module_initializer_routine, start_class, continue_class, finish_class, start_method_def, objc_start_function, start_protocol, build_method_decl, objc_add_method, add_instance_variable, build_ivar_reference, is_ivar, is_private, get_super_receiver, build_selector_table_decl, objc_push_parm, objc_get_parm_info, gen_type_name, gen_type_name_0, start_var_decl, finish_var_decl, create_field_decl): New prototypes. (objc_expand_function_end, comp_method_with_proto, objc_expr_last, gen_declaration_1, gen_declarator, is_complex_decl, adorn_decl, define_decl, create_builtin_decl, gen_declspecs): Remove prototypes. (TYPE_ID): Rename to OBJECT_TYPEDEF_NAME. (CLASS_TYPEDEF_NAME): New. (TAG_EXECCLASS): Change from a global variable to a #define. (TAG_RETURN_STRUCT): Delete. (TAG_GNUINIT): New, holds '__objc_gnu_init' name. (objc_inherit_code, objc_public_flag): New, moved from c-parse.in. (string_descriptor): New struct. (string_htab): New hash table. (string_hash, string_eq): New prototypes. (generate_struct_by_value_array): Call create_field_decl() instead of create_builtin_decl(). (objc_init): Do not initialize objc_ellipsis_node or TAG_EXECCLASS; In ObjC++ mode, call cxx_init() instead of c_objc_common_init(). (objc_finish_file): In ObjC++, call instantiate_pending_templates() and cp_finish_file(). (define_decl, get_static_reference, get_protocol_reference, create_builtin_decl): Remove functions. (objc_start_class_interface, objc_start_category_interface, objc_start_protocol, objc_continue_interface, objc_finish_interface, objc_start_class_implementation, objc_start_category_implementation, objc_continue_implementation, objc_finish_implementation, objc_set_visibility, objc_set_method_type, objc_build_method_signature, objc_add_method_declaration, objc_start_method_definition, objc_add_instance_variable, objc_get_protocol_qualified_type, create_field_decl, start_var_decl, finish_var_decl): New functions. (setup_string_decl): Simplify since it is only called once. (synth_module_prologue): Call build_class_template(); predefine 'id' and 'Class' as typedefs; rename 'temp_type' to 'type'; disable debug hooks for duration of function; fix GNU runtime messenger signatures to correspond to reality; forward-declare '__objc_exec_class' for the GNU runtime; call build_selector_table_decl(); in ObjC++ mode, generate 'extern "C" { ... }' wrappers around synthesized declarations; call build_protocol_template() and build_category_template(). (string_hash, string_eq): New functions. (objc_build_string_object): Check metaclass correctness only once; store string literals in hash table. (objc_build_constructor): Do not convert initializer elements; adjust for ObjC++ impedance mismatch. (build_objc_symtab_template): Call create_field_decl() instead of create_builtin_decl(). (init_objc_symtab): Add missing conversion to initializer element. (build_metadata_decl): Call start_var_decl() instead of define_decl(). (generate_objc_symtab_decl): Do not call build_category_template(); call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(). (build_module_descriptor): Call create_field_decl() instead of grokfield(); call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(); always mark module descriptor as used; move GNU runtime-specific functionality to build_module_initializer_routine(). (build_module_initializer_routine): New function, broken off of build_module_descriptor(). (objc_static_init_needed_p, objc_generate_static_init_call): New functions. (generate_static_references, generate_strings, build_selector_translation_table, generate_descriptor_table, generate_ivars_list, generate_dispatch_table, generate_category): Call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(); build a type directly instead of via groktypename(). (build_selector_reference_decl, build_selector_table_decl, build_class_reference_decl, build_protocol_reference, generate_objc_image_info): Call start_var_decl() instead of build_decl(). (build_selector_reference): For GNU runtime, do not call build_selector_reference_decl(). (build_selector, build_typed_selector_reference): Always convert result to the selector type. (add_objc_string): Cast return value to 'char *'. (build_method_prototype_template, build_selector_template, build_method_template): Use actual selector type for fields pointing to selectors. (finish_objc): For GNU runtime, call build_module_initializer_routine() after build_module_descriptor(). (generate_protocol_list, generate_shared_structures): Call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(); build a type directly instead of via groktypename(). (synth_id_with_class_suffix): Return a string. (get_arg_type_list): For instance methods, use the instance type for 'self'; do not call groktypename_in_parm_context(). (build_objc_string_decl): Squash redeclaration errors in ObjC++. (objc_is_class_name): Use OBJC_TYPE_NAME instead of TYPE_NAME; handle RECORD_TYPEs in ObjC as well as ObjC++. (objc_is_id): New function. (objc_is_object_ptr): Return the canonical type node. (objc_get_class_ivars): Simplify using get_class_ivars(). (get_class_ivars): Remove second parameter; create a fresh copy of the ivar list for each call; do not check for existence of super class. (objc_eh_runtime_type): Mark #ifndef OBJCPLUS. (objc_init_exceptions): When using SJLJ-style exceptions, require the use of '-fobjc-exceptions' flag; do not require it for DWARF-style exceptions. (objc_build_exc_ptr, next_sjlj_build_try_catch_finally): Use objc_object_type instead of objc_id_type. (objc_begin_catch_clause): Convert the incoming PARM_DECL into a VAR_DECL before placing it in the appropriate scope; do not call define_decl(); adjust call to c_begin_compound_stmt(); use objc_object_type instead of objc_id_type. (build_next_objc_exception_stuff): Call create_field_decl() instead of create_builtin_decl(); construct type directly instead of calling groktypename(); use OBJC_VOID_AT_END to mark end of function parameters. (build_private_template): Adjust call to get_class_ivars(); build a type directly instead of via groktypename(). (build_protocol_template, build_method_prototype_list_template, build_method_prototype_template, build_category_template, build_selector_template, build_class_template, build_super_template, build_ivar_template, build_ivar_list_template, build_method_list_template, build_method_template): Call create_field_decl() instead of grokfield(). (objc_method_parm_type): Do not call groktypename(). (generate_descriptor_table): Call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(). (generate_method_descriptors, build_protocol_initializer, generate_dispatch_tables, build_category_initializer, build_shared_structure_initializer): Do not call groktypename(). (generate_protocols): Call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(); do not call groktypename(). (error_with_ivar): Remove last parameter. (check_ivars): Do not iterate ovar CLASS_RAW_IVARS lists in addition to CLASS_IVARS lists; adjust calls to error_with_ivar(). (generate_ivar_lists): Convert one of the initializer elements; do not call groktypename(). (get_arg_type_list, start_method_def, gen_method_def): Account for new representation of variable arguments and '...' in Objective-C methods; add Objective-C++ impedance matching code. (is_objc_type_qualifier): Remove function. (adjust_type_for_id_default): Simplify; there is no longer a need to wade through declspecs. (lookup_interface, start_class, continue_class, finish_class, start_method_def, start_protocol, build_method_decl, objc_add_method, add_instance_variable, build_ivar_reference, is_ivar, is_private, get_super_receiver, objc_build_finally_epilogue): Make into static functions. (receiver_is_class_object): Use new IS_CLASS() macro. (objc_build_message_expr): Tweak ObjC++ message argument handling; call objc_finish_message_expr() instead of finish_message_expr(). (finish_message_expr): Rename to objc_finish_message_expr(); use OBJC_TYPE_NAME and OBJC_SET_TYPE_NAME macros instead of TYPE_NAME. call gen_type_name() instead of gen_declaration(); call objc_is_id() instead of using IS_ID and IS_CLASS; Use objc_class_name instead of calling get_identifier("Class"); handle CONVERT_EXPRs in receiver. (build_objc_method_call, warn_with_method): Do not call groktypename(). (build_ivar_reference): Call convert() instead of clobbering in a type. (hash_init): Initialize string_htab hash table. (add_instance_variable): Simplify parameter list; do not call grokfield(); do not populate CLASS_IVARS list. (start_class): Check for the existence of super class, if one was specified. (continue_class): Use CLASS_RAW_IVARS rather than CLASS_IVARS; do not call build_class_template(); adjust call to get_class_ivars(); call build_decl(), pushdecl() and finish_decl() instead of define_decl(). (finish_class): Call build_decl(), pushdecl() and finish_decl() instead of define_decl(). (add_protocols): Use PROTOCOL_BINFO_ELTS for the tree vector size. (start_protocol): Do not call build_protocol_template(); use PROTOCOL_BINFO_ELTS for the tree vector size. (encode_type_qualifiers): Do not handle the 'const' qualifier here. (encode_pointer): Encode 'const char *' as 'r*', for backwards compatibility. (encode_array): Use HOST_WIDE_INT_PRINT_DEC instead of "%ld". (encode_type): Handle the 'const' qualifier here. (objc_parmlist): New global variable, sued by objc_push_parm and objc_get_parm_info(). (objc_push_parm, objc_get_parm_info): New functions. (objc_expr_last): Remove function. (synth_self_and_ucmd_args): For instance methods, use the instance type for 'self'; call objc_push_parm() instead of push_parm_decl(). (start_method_def): Do not call push_scope(), declare_parm_level(), pop_scope(), push_parm_decl(), store_parm_decls() or objc_expr_last(); just use objc_push_parm() and objc_get_parm_info(). (comp_method_with_proto): Remove function. (objc_types_are_equivalent): Strip away indirections before comparing underlying types. (comp_proto_with_proto): Do not call groktypename(); types are no longer in raw declspec format. (objc_start_function): New function. (really_start_method): Call comp_proto_with_proto() instead of comp_method_with_proto(); call objc_start_function() instead of hand-crafting a function declarator. (continue_method_def, objc_expand_function_end): Remove functions. (get_super_receiver): Call objc_get_current_scope() instead of get_current_scope(); reference 'super_class' field (instead of 'class'). (finish_method_def): Rename to objc_finish_method_definition() and add a function decl parameter; move method encoding call from objc_expand_function_end(). (is_complex_decl, adorn_decl, gen_declarator, gen_declspecs, gen_declaration_1): Remove functions. (tmpbuf, RAW_DECLSPEC): Remove. (gen_declaration): Remove second parameter; simplify to deal with TYPE_P nodes instead of raw declspecs. (gen_type_name, gen_type_name_0): New functions. (gen_method_decl): Remove second parameter; call gen_type_name() instead of gen_declaration_1(). (dump_interface): Adjust calls to gen_declaration() and gen_method_decl(); do not allocate a separate string buffer. (init_objc): Allocate a larger string buffer to accommodate dump_interface(); adjust call to build_module_descriptor(); add call to build_module_initializer_routine() for the GNU runtime. (generate_classref_translation_entry): Do not call start_decl(); call finish_var_decl() instead of finish_decl(); call convert() instead of build_c_cast(). * objc-act.h (CLASS_OWN_IVARS): Remove accessor. (CLASS_BINFO_ELTS): Reduce from 6 to 5, now that CLASS_OWN_IVARS is gone. (OCTI_GNU_INIT_DECL, GNU_INIT_decl): New. (OCTI_ELLIPSIS_NODE, objc_ellipsis_node): Remove. (OCTI_ID_ID, id_type, objc_id_id): Rename to OCTI_ID_NAME, objc_object_type and objc_object_name, respectively. (OCTI_CLS_REF, OCTI_CLASS_NAME, objc_class_reference, objc_class_name): New. (IS_CLASS): New macro. (IS_ID, IS_SUPER): Robustify. (OCTI_EXECCLASS_DECL, execclass_decl): New. (finish_file, start_class, continue_class, finish_class, start_method_def, continue_method_def, finish_method_def, start_protocol, finish_protocol, objc_build_throw_stmt, objc_build_try_catch_finally_stmt, objc_build_synchronized_prologue, objc_build_synchronized_epilogue, objc_build_try_prologue, objc_build_try_epilogue, objc_build_catch_stmt, objc_build_catch_epilogue, objc_build_finally_prologue, objc_build_finally_epilogue, is_ivar, is_private, is_public, add_instance_variable, objc_add_method, get_super_receiver, objc_clear_super_receiver, get_class_ivars_from_name, get_class_reference, get_static_reference, get_object_reference, build_message_expr, finish_message_expr, build_selector_expr, build_ivar_reference, build_keyword_decl, build_method_decl, build_protocol_expr, build_objc_string_object, objc_declare_alias, objc_declare_class, objc_declare_protocols, objc_comptypes, objc_check_decl, build_encode_expr): Remove prototypes. (imp_count, cat_count): Make GGC-aware. (OBJC_SET_TYPE_NAME): New macro. From-SVN: r87168
2004-09-08 02:49:44 +02:00
decl = start_var_decl (objc_class_type, buf);
return decl;
1992-01-18 00:15:38 +01:00
}
/* Create a class reference, but don't create a variable to reference
it. */
1992-01-18 00:15:38 +01:00
static void
add_class_reference (tree ident)
1992-01-18 00:15:38 +01:00
{
tree chain;
if ((chain = cls_ref_chain))
1992-01-18 00:15:38 +01:00
{
tree tail;
do
{
if (ident == TREE_VALUE (chain))
return;
tail = chain;
chain = TREE_CHAIN (chain);
}
while (chain);
/* Append to the end of the list */
TREE_CHAIN (tail) = tree_cons (NULL_TREE, ident, NULL_TREE);
1992-01-18 00:15:38 +01:00
}
else
cls_ref_chain = tree_cons (NULL_TREE, ident, NULL_TREE);
1992-01-18 00:15:38 +01:00
}
/* Get a class reference, creating it if necessary. Also create the
reference variable. */
tree
c-parse.in (primary): Call objc_build_message_expr()... [gcc/ChangeLog] 2004-09-01 Ziemowit Laski <zlaski@apple.com> * c-parse.in (primary): Call objc_build_message_expr(), objc_build_selector_expr(), objc_build_protocol_expr(), objc_build_encode_expr() and objc_build_string_object() instead of build_message_expr(), build_selector_expr(), build_protocol_expr(), build_encode_expr() and build_objc_string_object(), respectively. (component_decl_list2): Call objc_get_class_ivars() instead of get_class_ivars_from_name(). (keyworddecl): Call objc_build_keyword_decl() instead of build_keyword_decl(). (receiver): Call objc_get_class_reference() instead of get_class_reference(). (reswords): Add blank line before @@ifobjc section, for clarity. [gcc/objc/ChangeLog] 2004-09-01 Ziemowit Laski <zlaski@apple.com> * objc-act.c (objc_check_decl): Use OBJC_TYPE_NAME macro instead of TYPE_NAME. (build_objc_string_object): Rename to objc_build_string_object(). (get_class_reference): Rename to objc_get_class_reference(). (get_class_ivars_from_name): Rename to objc_get_class_ivars(). (next_sjlj_build_catch_list, get_super_receiver): Call objc_get_class_reference() instead of get_class_reference(). (build_keyword_decl): Rename to objc_build_keyword_decl(). (build_message_expr): Rename to objc_build_message_expr(). (build_protocol_expr): Rename to objc_build_protocol_expr(). (build_selector_expr): Rename to objc_build_selector_expr(). (build_encode_expr): Rename to objc_build_encode_expr(). * objc-act.h (get_class_ivars_from_name): Rename prototype to objc_get_class_ivars(). (get_class_reference): Rename prototype to objc_get_class_reference(). (build_message_expr): Rename prototype to objc_build_message_expr(). (build_selector_expr): Rename prototype to objc_build_selector_expr(). (build_keyword_decl): Rename prototype to objc_build_keyword_decl(). (build_protocol_expr): Rename prototype to objc_build_prototype_expr(). (build_objc_string_object): Rename prototype to objc_build_string_object(). From-SVN: r86950
2004-09-02 02:36:18 +02:00
objc_get_class_reference (tree ident)
1992-01-18 00:15:38 +01:00
{
objc-act.c (objc_build_struct): New function. * objc-act.c (objc_build_struct): New function. (objc_derived_from_p): Likewise. (objc_build_component_ref): Likewise. (objc_copy_binfo): Likewise. (objc_xref_basetypes): Likewise. (objc_lookup_protocol): Likewise. (objc_compare_protocols): Likewise. (objc_volatilize_decl): Likewise. (encode_aggregate_fields): Likewise. (volatilized_hash): Likewise. (volatilized_eq): Likewise. (objc_compare_types): Likewise. (objc_type_quals_match): Likewise. (DERIVED_FROM_P): New ObjC macro, corresponding to C++ macro of same name. (get_class_ivars): Add second parameter indicating if entire hierarchy is desired. (struct volatilized_type): New type. (volatilized_htab): New hash table. (objc_types_compatible_p, objc_comptypes): Remove functions. (synth_module_prologue): Do not initialize 'unused_list'. (objc_get_class_reference): Fix ObjC++ impedance mismatches. (objc_declare_alias): Implement as a typedef. (objc_substitute_decl, objc_gimplify_expr): Reformat. (objc_get_class_ivars): Adjust call to get_class_ivars(). (next_sjlj_build_enter_and_setjmp, synth_forward_declarations, build_ivar_reference, get_super_receiver): Call objc_build_component_ref() instead of build_component_ref(). (objc_begin_catch_clause): Use DERIVED_FROM_P() instead of objc_comptypes(). (build_private_template): Call objc_build_struct() instead of start_struct() and finish_struct(). (hash_init): Initialize volatilized_htab. (objc_is_public): Adjust calls to objc_get_ivars(); adjust ObjC++ impedance mismatches. (encode_aggregate_within): Streamline by calling encode_aggregate_fields(). * objc-act.h (objc_types_compatible_p): Remove prototype. (OCTI_UNUSED_LIST, unused_list): Remove slot. * objc-lang.c (LANG_HOOKS_TYPES_COMPATIBLE_P): Remove. From-SVN: r100123
2005-05-25 00:21:01 +02:00
tree orig_ident = (DECL_P (ident)
? DECL_NAME (ident)
: TYPE_P (ident)
? OBJC_TYPE_NAME (ident)
: ident);
Yet more Objective-C++... * objc-act.c (objc_finish_try_stmt): Add return value. (objc_build_synchronized): Likewise. * objc-act.c (objc_is_gcable_type): Add. (objc_substitute_decl): Add. (objc_build_ivar_assignment): Add. (objc_build_global_assignment): Add. (objc_build_strong_cast_assignment): Add. (objc_is_ivar_reference_p): Add. (objc_is_global_reference_p): Add. (objc_generate_write_barrier): Add. (objc_rewrite_function_call): Add. (objc_gimplify_expr): Add Objective-C++ support. * objc-act.h (ALLOC_OBJC_TYPE_LANG_SPECIFIC): Likewise. (SIZEOF_OBJC_TYPE_LANG_SPECIFIC): Add. (INIT_TYPE_OBJC_INFO): Add Objective-C++ support. (DUP_TYPE_OBJC_INFO): Likewise. (struct imp_entry): Add field has_cxx_cdtors. (struct imp_entry *imp_list): Add OCTI_UMSG_FAST_DECL, OCTI_METH_LIST_TEMPL, OCTI_METH_PROTO_LIST_TEMPL, OCTI_IVAR_LIST_TEMPL, OCTI_ASSIGN_IVAR_DECL, OCTI_ASSIGN_IVAR_FAST_DECL, OCTI_ASSIGN_GLOBAL_DECL, OCTI_ASSIGN_STRONGCAST_DECL. (umsg_fast_decl): Add. (objc_assign_ivar_decl): Add. (objc_assign_ivar_fast_decl): Add. (objc_assign_global_decl): Add. (objc_assign_strong_cast_decl): Add. (objc_method_list_ptr): Add. (objc_method_proto_list_ptr): Add. (objc_ivar_list_ptr): Add. * objc-act.c (should_call_super_dealloc): Add. (OBJC_VERSION): Bump to 6. (objc_is_gcable_type): Add. (objc_substitute_decl): Add. (objc_build_ivar_assignment): Add. (objc_build_global_assignment): Add. (objc_build_strong_cast_assignment): Add. (objc_is_gcable_p): Add. (objc_is_ivar_reference_p): Add. (objc_is_global_reference_p): Add. (generate_shared_structures): Add flags parameter. (objc_generate_cxx_ctor_or_dtor): Add. (objc_generate_cxx_cdtors): Add. (add_class): Add name parameter. (objc_types_share_size_and_alignment): Add. (comp_proto_with_proto): Add strict parameter. (CLS_HAS_CXX_STRUCTORS): Add. (TAG_ASSIGNIVAR): Add. (TAG_ASSIGNGLOBAL): Add. (TAG_ASSIGNSTRONGCAST): Add. (TAG_MSGSEND_FAST): Add. (TAG_ASSIGNIVAR_FAST): Add. (TAG_CXX_CONSTRUCT): Add. (TAG_CXX_DESTRUCT): Add. (OBJC_LOOKUP_CLASS): Add. (OBJC_LOOKUP_NO_SUPER): Add. (objc_finish_file): Add pch support. (objc_finish_implementation): Add Objective-C++ support. (synth_module_prologue): Likewise. (synth_module_prologue): Add fast dispatching. (objc_get_class_reference): Add Objective-C++ support. (objc_generate_write_barrier): Likewise. (next_sjlj_build_enter_and_setjmp): Likewise. (objc_begin_try_stmt): Likewise. (build_next_objc_exception_stuff): Add fast ivar support. (build_private_template): Mark the record as used so debug information is generated. (build_protocol_template): Add Objective-C++ support. (objc_method_parm_type) Likewise. (objc_generate_cxx_ctor_or_dtor): Likewise. (objc_generate_cxx_cdtors): Likewise. (build_protocol_initializer): Likewise. (build_category_template): Likewise. (build_class_template): Likewise. (build_method_list_template): Likewise. (build_category_initializer): Likewise. (build_shared_structure_initializer): Likewise. (objc_finish_message_expr): Likewise. (build_objc_method_call): Add fast dispatch support. (lookup_method_static): Add support to end search at superclasses. (add_method_to_hash_list): Add strict parameter to comp_proto_with_proto. (objc_add_method): Likewise. (objc_add_method): Also set the interface_value. (add_instance_variable): Add Objective-C++ support. (objc_is_public): Likewise. (start_class): Likewise. (continue_class): Likewise. (encode_aggregate_within): Likewise. (start_method_def): Likewise. (objc_start_function): Clear current_function_returns_value and current_function_returns_null. (really_start_method): Add Objective-C++ support. (objc_finish_method_definition): Add warning for missing [super dealloc]. (finish_objc): Add Objective-C++ support. (generate_objc_image_info): Likewise. (objc_lookup_ivar): Likewise. * objc-act.h (TYPE_HAS_OBJC_INFO): Likewise. (INIT_TYPE_OBJC_INFO): Likewise. (DUP_TYPE_OBJC_INFO): Likewise. From-SVN: r99857
2005-05-17 22:07:08 +02:00
bool local_scope = false;
#ifdef OBJCPLUS
if (processing_template_decl)
/* Must wait until template instantiation time. */
return build_min_nt (CLASS_REFERENCE_EXPR, ident);
objc-act.c (objc_build_struct): New function. * objc-act.c (objc_build_struct): New function. (objc_derived_from_p): Likewise. (objc_build_component_ref): Likewise. (objc_copy_binfo): Likewise. (objc_xref_basetypes): Likewise. (objc_lookup_protocol): Likewise. (objc_compare_protocols): Likewise. (objc_volatilize_decl): Likewise. (encode_aggregate_fields): Likewise. (volatilized_hash): Likewise. (volatilized_eq): Likewise. (objc_compare_types): Likewise. (objc_type_quals_match): Likewise. (DERIVED_FROM_P): New ObjC macro, corresponding to C++ macro of same name. (get_class_ivars): Add second parameter indicating if entire hierarchy is desired. (struct volatilized_type): New type. (volatilized_htab): New hash table. (objc_types_compatible_p, objc_comptypes): Remove functions. (synth_module_prologue): Do not initialize 'unused_list'. (objc_get_class_reference): Fix ObjC++ impedance mismatches. (objc_declare_alias): Implement as a typedef. (objc_substitute_decl, objc_gimplify_expr): Reformat. (objc_get_class_ivars): Adjust call to get_class_ivars(). (next_sjlj_build_enter_and_setjmp, synth_forward_declarations, build_ivar_reference, get_super_receiver): Call objc_build_component_ref() instead of build_component_ref(). (objc_begin_catch_clause): Use DERIVED_FROM_P() instead of objc_comptypes(). (build_private_template): Call objc_build_struct() instead of start_struct() and finish_struct(). (hash_init): Initialize volatilized_htab. (objc_is_public): Adjust calls to objc_get_ivars(); adjust ObjC++ impedance mismatches. (encode_aggregate_within): Streamline by calling encode_aggregate_fields(). * objc-act.h (objc_types_compatible_p): Remove prototype. (OCTI_UNUSED_LIST, unused_list): Remove slot. * objc-lang.c (LANG_HOOKS_TYPES_COMPATIBLE_P): Remove. From-SVN: r100123
2005-05-25 00:21:01 +02:00
#endif
if (TREE_CODE (ident) == TYPE_DECL)
objc-act.c (objc_build_struct): New function. * objc-act.c (objc_build_struct): New function. (objc_derived_from_p): Likewise. (objc_build_component_ref): Likewise. (objc_copy_binfo): Likewise. (objc_xref_basetypes): Likewise. (objc_lookup_protocol): Likewise. (objc_compare_protocols): Likewise. (objc_volatilize_decl): Likewise. (encode_aggregate_fields): Likewise. (volatilized_hash): Likewise. (volatilized_eq): Likewise. (objc_compare_types): Likewise. (objc_type_quals_match): Likewise. (DERIVED_FROM_P): New ObjC macro, corresponding to C++ macro of same name. (get_class_ivars): Add second parameter indicating if entire hierarchy is desired. (struct volatilized_type): New type. (volatilized_htab): New hash table. (objc_types_compatible_p, objc_comptypes): Remove functions. (synth_module_prologue): Do not initialize 'unused_list'. (objc_get_class_reference): Fix ObjC++ impedance mismatches. (objc_declare_alias): Implement as a typedef. (objc_substitute_decl, objc_gimplify_expr): Reformat. (objc_get_class_ivars): Adjust call to get_class_ivars(). (next_sjlj_build_enter_and_setjmp, synth_forward_declarations, build_ivar_reference, get_super_receiver): Call objc_build_component_ref() instead of build_component_ref(). (objc_begin_catch_clause): Use DERIVED_FROM_P() instead of objc_comptypes(). (build_private_template): Call objc_build_struct() instead of start_struct() and finish_struct(). (hash_init): Initialize volatilized_htab. (objc_is_public): Adjust calls to objc_get_ivars(); adjust ObjC++ impedance mismatches. (encode_aggregate_within): Streamline by calling encode_aggregate_fields(). * objc-act.h (objc_types_compatible_p): Remove prototype. (OCTI_UNUSED_LIST, unused_list): Remove slot. * objc-lang.c (LANG_HOOKS_TYPES_COMPATIBLE_P): Remove. From-SVN: r100123
2005-05-25 00:21:01 +02:00
ident = (DECL_ORIGINAL_TYPE (ident)
? DECL_ORIGINAL_TYPE (ident)
: TREE_TYPE (ident));
Yet more Objective-C++... * objc-act.c (objc_finish_try_stmt): Add return value. (objc_build_synchronized): Likewise. * objc-act.c (objc_is_gcable_type): Add. (objc_substitute_decl): Add. (objc_build_ivar_assignment): Add. (objc_build_global_assignment): Add. (objc_build_strong_cast_assignment): Add. (objc_is_ivar_reference_p): Add. (objc_is_global_reference_p): Add. (objc_generate_write_barrier): Add. (objc_rewrite_function_call): Add. (objc_gimplify_expr): Add Objective-C++ support. * objc-act.h (ALLOC_OBJC_TYPE_LANG_SPECIFIC): Likewise. (SIZEOF_OBJC_TYPE_LANG_SPECIFIC): Add. (INIT_TYPE_OBJC_INFO): Add Objective-C++ support. (DUP_TYPE_OBJC_INFO): Likewise. (struct imp_entry): Add field has_cxx_cdtors. (struct imp_entry *imp_list): Add OCTI_UMSG_FAST_DECL, OCTI_METH_LIST_TEMPL, OCTI_METH_PROTO_LIST_TEMPL, OCTI_IVAR_LIST_TEMPL, OCTI_ASSIGN_IVAR_DECL, OCTI_ASSIGN_IVAR_FAST_DECL, OCTI_ASSIGN_GLOBAL_DECL, OCTI_ASSIGN_STRONGCAST_DECL. (umsg_fast_decl): Add. (objc_assign_ivar_decl): Add. (objc_assign_ivar_fast_decl): Add. (objc_assign_global_decl): Add. (objc_assign_strong_cast_decl): Add. (objc_method_list_ptr): Add. (objc_method_proto_list_ptr): Add. (objc_ivar_list_ptr): Add. * objc-act.c (should_call_super_dealloc): Add. (OBJC_VERSION): Bump to 6. (objc_is_gcable_type): Add. (objc_substitute_decl): Add. (objc_build_ivar_assignment): Add. (objc_build_global_assignment): Add. (objc_build_strong_cast_assignment): Add. (objc_is_gcable_p): Add. (objc_is_ivar_reference_p): Add. (objc_is_global_reference_p): Add. (generate_shared_structures): Add flags parameter. (objc_generate_cxx_ctor_or_dtor): Add. (objc_generate_cxx_cdtors): Add. (add_class): Add name parameter. (objc_types_share_size_and_alignment): Add. (comp_proto_with_proto): Add strict parameter. (CLS_HAS_CXX_STRUCTORS): Add. (TAG_ASSIGNIVAR): Add. (TAG_ASSIGNGLOBAL): Add. (TAG_ASSIGNSTRONGCAST): Add. (TAG_MSGSEND_FAST): Add. (TAG_ASSIGNIVAR_FAST): Add. (TAG_CXX_CONSTRUCT): Add. (TAG_CXX_DESTRUCT): Add. (OBJC_LOOKUP_CLASS): Add. (OBJC_LOOKUP_NO_SUPER): Add. (objc_finish_file): Add pch support. (objc_finish_implementation): Add Objective-C++ support. (synth_module_prologue): Likewise. (synth_module_prologue): Add fast dispatching. (objc_get_class_reference): Add Objective-C++ support. (objc_generate_write_barrier): Likewise. (next_sjlj_build_enter_and_setjmp): Likewise. (objc_begin_try_stmt): Likewise. (build_next_objc_exception_stuff): Add fast ivar support. (build_private_template): Mark the record as used so debug information is generated. (build_protocol_template): Add Objective-C++ support. (objc_method_parm_type) Likewise. (objc_generate_cxx_ctor_or_dtor): Likewise. (objc_generate_cxx_cdtors): Likewise. (build_protocol_initializer): Likewise. (build_category_template): Likewise. (build_class_template): Likewise. (build_method_list_template): Likewise. (build_category_initializer): Likewise. (build_shared_structure_initializer): Likewise. (objc_finish_message_expr): Likewise. (build_objc_method_call): Add fast dispatch support. (lookup_method_static): Add support to end search at superclasses. (add_method_to_hash_list): Add strict parameter to comp_proto_with_proto. (objc_add_method): Likewise. (objc_add_method): Also set the interface_value. (add_instance_variable): Add Objective-C++ support. (objc_is_public): Likewise. (start_class): Likewise. (continue_class): Likewise. (encode_aggregate_within): Likewise. (start_method_def): Likewise. (objc_start_function): Clear current_function_returns_value and current_function_returns_null. (really_start_method): Add Objective-C++ support. (objc_finish_method_definition): Add warning for missing [super dealloc]. (finish_objc): Add Objective-C++ support. (generate_objc_image_info): Likewise. (objc_lookup_ivar): Likewise. * objc-act.h (TYPE_HAS_OBJC_INFO): Likewise. (INIT_TYPE_OBJC_INFO): Likewise. (DUP_TYPE_OBJC_INFO): Likewise. From-SVN: r99857
2005-05-17 22:07:08 +02:00
objc-act.c (objc_build_struct): New function. * objc-act.c (objc_build_struct): New function. (objc_derived_from_p): Likewise. (objc_build_component_ref): Likewise. (objc_copy_binfo): Likewise. (objc_xref_basetypes): Likewise. (objc_lookup_protocol): Likewise. (objc_compare_protocols): Likewise. (objc_volatilize_decl): Likewise. (encode_aggregate_fields): Likewise. (volatilized_hash): Likewise. (volatilized_eq): Likewise. (objc_compare_types): Likewise. (objc_type_quals_match): Likewise. (DERIVED_FROM_P): New ObjC macro, corresponding to C++ macro of same name. (get_class_ivars): Add second parameter indicating if entire hierarchy is desired. (struct volatilized_type): New type. (volatilized_htab): New hash table. (objc_types_compatible_p, objc_comptypes): Remove functions. (synth_module_prologue): Do not initialize 'unused_list'. (objc_get_class_reference): Fix ObjC++ impedance mismatches. (objc_declare_alias): Implement as a typedef. (objc_substitute_decl, objc_gimplify_expr): Reformat. (objc_get_class_ivars): Adjust call to get_class_ivars(). (next_sjlj_build_enter_and_setjmp, synth_forward_declarations, build_ivar_reference, get_super_receiver): Call objc_build_component_ref() instead of build_component_ref(). (objc_begin_catch_clause): Use DERIVED_FROM_P() instead of objc_comptypes(). (build_private_template): Call objc_build_struct() instead of start_struct() and finish_struct(). (hash_init): Initialize volatilized_htab. (objc_is_public): Adjust calls to objc_get_ivars(); adjust ObjC++ impedance mismatches. (encode_aggregate_within): Streamline by calling encode_aggregate_fields(). * objc-act.h (objc_types_compatible_p): Remove prototype. (OCTI_UNUSED_LIST, unused_list): Remove slot. * objc-lang.c (LANG_HOOKS_TYPES_COMPATIBLE_P): Remove. From-SVN: r100123
2005-05-25 00:21:01 +02:00
#ifdef OBJCPLUS
if (TYPE_P (ident) && TYPE_CONTEXT (ident)
&& TYPE_CONTEXT (ident) != global_namespace)
local_scope = true;
#endif
Yet more Objective-C++... * objc-act.c (objc_finish_try_stmt): Add return value. (objc_build_synchronized): Likewise. * objc-act.c (objc_is_gcable_type): Add. (objc_substitute_decl): Add. (objc_build_ivar_assignment): Add. (objc_build_global_assignment): Add. (objc_build_strong_cast_assignment): Add. (objc_is_ivar_reference_p): Add. (objc_is_global_reference_p): Add. (objc_generate_write_barrier): Add. (objc_rewrite_function_call): Add. (objc_gimplify_expr): Add Objective-C++ support. * objc-act.h (ALLOC_OBJC_TYPE_LANG_SPECIFIC): Likewise. (SIZEOF_OBJC_TYPE_LANG_SPECIFIC): Add. (INIT_TYPE_OBJC_INFO): Add Objective-C++ support. (DUP_TYPE_OBJC_INFO): Likewise. (struct imp_entry): Add field has_cxx_cdtors. (struct imp_entry *imp_list): Add OCTI_UMSG_FAST_DECL, OCTI_METH_LIST_TEMPL, OCTI_METH_PROTO_LIST_TEMPL, OCTI_IVAR_LIST_TEMPL, OCTI_ASSIGN_IVAR_DECL, OCTI_ASSIGN_IVAR_FAST_DECL, OCTI_ASSIGN_GLOBAL_DECL, OCTI_ASSIGN_STRONGCAST_DECL. (umsg_fast_decl): Add. (objc_assign_ivar_decl): Add. (objc_assign_ivar_fast_decl): Add. (objc_assign_global_decl): Add. (objc_assign_strong_cast_decl): Add. (objc_method_list_ptr): Add. (objc_method_proto_list_ptr): Add. (objc_ivar_list_ptr): Add. * objc-act.c (should_call_super_dealloc): Add. (OBJC_VERSION): Bump to 6. (objc_is_gcable_type): Add. (objc_substitute_decl): Add. (objc_build_ivar_assignment): Add. (objc_build_global_assignment): Add. (objc_build_strong_cast_assignment): Add. (objc_is_gcable_p): Add. (objc_is_ivar_reference_p): Add. (objc_is_global_reference_p): Add. (generate_shared_structures): Add flags parameter. (objc_generate_cxx_ctor_or_dtor): Add. (objc_generate_cxx_cdtors): Add. (add_class): Add name parameter. (objc_types_share_size_and_alignment): Add. (comp_proto_with_proto): Add strict parameter. (CLS_HAS_CXX_STRUCTORS): Add. (TAG_ASSIGNIVAR): Add. (TAG_ASSIGNGLOBAL): Add. (TAG_ASSIGNSTRONGCAST): Add. (TAG_MSGSEND_FAST): Add. (TAG_ASSIGNIVAR_FAST): Add. (TAG_CXX_CONSTRUCT): Add. (TAG_CXX_DESTRUCT): Add. (OBJC_LOOKUP_CLASS): Add. (OBJC_LOOKUP_NO_SUPER): Add. (objc_finish_file): Add pch support. (objc_finish_implementation): Add Objective-C++ support. (synth_module_prologue): Likewise. (synth_module_prologue): Add fast dispatching. (objc_get_class_reference): Add Objective-C++ support. (objc_generate_write_barrier): Likewise. (next_sjlj_build_enter_and_setjmp): Likewise. (objc_begin_try_stmt): Likewise. (build_next_objc_exception_stuff): Add fast ivar support. (build_private_template): Mark the record as used so debug information is generated. (build_protocol_template): Add Objective-C++ support. (objc_method_parm_type) Likewise. (objc_generate_cxx_ctor_or_dtor): Likewise. (objc_generate_cxx_cdtors): Likewise. (build_protocol_initializer): Likewise. (build_category_template): Likewise. (build_class_template): Likewise. (build_method_list_template): Likewise. (build_category_initializer): Likewise. (build_shared_structure_initializer): Likewise. (objc_finish_message_expr): Likewise. (build_objc_method_call): Add fast dispatch support. (lookup_method_static): Add support to end search at superclasses. (add_method_to_hash_list): Add strict parameter to comp_proto_with_proto. (objc_add_method): Likewise. (objc_add_method): Also set the interface_value. (add_instance_variable): Add Objective-C++ support. (objc_is_public): Likewise. (start_class): Likewise. (continue_class): Likewise. (encode_aggregate_within): Likewise. (start_method_def): Likewise. (objc_start_function): Clear current_function_returns_value and current_function_returns_null. (really_start_method): Add Objective-C++ support. (objc_finish_method_definition): Add warning for missing [super dealloc]. (finish_objc): Add Objective-C++ support. (generate_objc_image_info): Likewise. (objc_lookup_ivar): Likewise. * objc-act.h (TYPE_HAS_OBJC_INFO): Likewise. (INIT_TYPE_OBJC_INFO): Likewise. (DUP_TYPE_OBJC_INFO): Likewise. From-SVN: r99857
2005-05-17 22:07:08 +02:00
if (local_scope || !(ident = objc_is_class_name (ident)))
{
builtins.c, [...]: Avoid "`" as left quote, using "'" or %q, %< and %> as appropriate. * builtins.c, c-common.c, c-decl.c, c-format.c, c-format.h, c-parse.in, c-pch.c, c-pragma.c, collect2.c, final.c, gcc.c, gcov.c, opts.c, pretty-print.h, protoize.c, reg-stack.c, rtl.c, tlink.c, config/alpha/alpha.c, config/arc/arc.c, config/arm/arm.c, config/avr/avr.c, config/c4x/c4x.c, config/darwin.c, config/frv/frv.c, config/h8300/h8300.c, config/i386/i386.c, config/i386/winnt.c, config/ia64/ia64.c, config/ip2k/ip2k.c, config/iq2000/iq2000.c, config/m32r/m32r.c, config/m68hc11/m68hc11.c, config/m68k/m68k.c, config/m68k/m68k.h, config/mcore/mcore.c, config/mips/mips.c, config/mmix/mmix.c, config/ns32k/ns32k.c, config/rs6000/host-darwin.c, config/rs6000/rs6000.c, config/s390/s390.c, config/sh/sh.c, config/sh/symbian.c, config/stormy16/stormy16.c, config/v850/v850.c: Avoid "`" as left quote, using "'" or %q, %< and %> as appropriate. Use %' as apostrophe in diagnostics where applicable. Use %< and %> in place of '' quotes where applicable. Use %qs in place of %<%s%>. Consistently quote __builtin function names. ada: * misc.c (gnat_handle_option): Use %< and %> for quoting in warning message. cp: * call.c, class.c, decl.c, decl2.c, error.c, mangle.c, parser.c, pt.c, search.c, semantics.c, typeck.c: Use %q, %< and %> for quoting in diagnostics. * parser.c (cp_parser_sizeof_operand): Use '' instead of `' for quoting in printf format. * decl.c (duplicate_decls, start_decl): Use %qD instead of unquoted %D. objc: * objc-act.c: Use %q, %< and %> for quoting in diagnostics. testsuite: * gcc.dg/builtin-prefetch-1.c: Adjust expected messages. From-SVN: r90337
2004-11-09 11:13:30 +01:00
error ("%qs is not an Objective-C class name or alias",
IDENTIFIER_POINTER (orig_ident));
return error_mark_node;
}
if (flag_next_runtime && !flag_zero_link)
{
tree *chain;
tree decl;
1992-01-18 00:15:38 +01:00
for (chain = &cls_ref_chain; *chain; chain = &TREE_CHAIN (*chain))
if (TREE_VALUE (*chain) == ident)
{
if (! TREE_PURPOSE (*chain))
TREE_PURPOSE (*chain) = build_class_reference_decl ();
return TREE_PURPOSE (*chain);
}
1992-01-18 00:15:38 +01:00
decl = build_class_reference_decl ();
*chain = tree_cons (decl, ident, NULL_TREE);
return decl;
}
else
1992-01-18 00:15:38 +01:00
{
tree params;
1992-01-18 00:15:38 +01:00
add_class_reference (ident);
params = build_tree_list (NULL_TREE,
c-tree.h (default_function_array_conversion): Declare. * c-tree.h (default_function_array_conversion): Declare. * c-typeck.c (default_function_array_conversion): Export. Correct comment. (default_conversion): Do not call default_function_array_conversion. Do not allow FUNCTION_TYPE. (build_function_call): Call default_function_array_conversion on the function. (convert_arguments): Do not call it on the function arguments. (build_unary_op): Do not allow ARRAY_TYPE or FUNCTION_TYPE for TRUTH_NOT_EXPR. Call default_function_array_conversion for taking address of ARRAY_REF. (build_compound_expr): Do not call default_function_array_conversion. (build_c_cast): Do not call default_function_array_conversion. (convert_for_assignment): Do not call default_conversion. (digest_init): Call default_function_array_conversion to convert string constants and compound literals to pointers, but not otherwise. (output_init_element): Likewise. (build_asm_expr): Do not call default_function_array_conversion. (c_process_expr_stmt): Likewise. (c_objc_common_truthvalue_conversion): Likewise. Do not allow FUNCTION_TYPE. * c-parser.c (c_parser_expression_conv): New. (c_parser_asm_operands, c_parser_expr_list): Add convert_p argument. All callers changed. Call default_function_array_conversion if convert_p. (c_parser_initializer, c_parser_initval): Call default_function_array_conversion except for string constants and compound literals. (c_parser_initelt): Call default_function_array_conversion for ObjC expression received. (c_parser_statement_after_labels): Call c_parser_expression_conv for return and expression statements. (c_parser_paren_condition, c_parser_for_statement, c_parser_conditional_expression): Call c_parser_expression_conv. (c_parser_expr_no_commas, c_parser_conditional_expression, c_parser_binary_expression, c_parser_cast_expression, c_parser_unary_expression): Call default_function_array_conversion. objc: * objc-act.c (my_build_string_pointer): New. (objc_get_class_reference, get_super_receiver): Call my_build_string_pointer instead of my_build_string when building function arguments. testsuite: * gcc.dg/noncompile/20040203-3.c: Update expected message. From-SVN: r100984
2005-06-15 17:55:47 +02:00
my_build_string_pointer
(IDENTIFIER_LENGTH (ident) + 1,
IDENTIFIER_POINTER (ident)));
1992-01-18 00:15:38 +01:00
assemble_external (objc_get_class_decl);
return build_function_call (objc_get_class_decl, params);
}
}
/* For each string section we have a chain which maps identifier nodes
1996-07-04 00:07:53 +02:00
to decls for the strings. */
static tree
add_objc_string (tree ident, enum string_section section)
{
tree *chain, decl, type, string_expr;
if (section == class_names)
chain = &class_names_chain;
else if (section == meth_var_names)
chain = &meth_var_names_chain;
else if (section == meth_var_types)
chain = &meth_var_types_chain;
else
abort ();
while (*chain)
{
if (TREE_VALUE (*chain) == ident)
Makefile.in (c-parse.o): Depend on $(C_COMMON_H). [gcc/ChangeLog] 2004-09-07 Ziemowit Laski <zlaski@apple.com> * Makefile.in (c-parse.o): Depend on $(C_COMMON_H). * c-parse.in: Include c-common.h instead of objc-act.h. (ivar_decl_list, ivar_decls, ivar_decl, ivars, ivar_declarator, myparms, myparm): Remove %type declarations. (methodtype, optparms, OBJC_TYPE_QUAL, objc_quals, objc_qual, objc_typename, objc_try_catch_stmt, optellipsis): Add %type declarations. (objc_inherit_code, objc_public_flag): Remove. (typespec_nonreserved_nonattr): Call objc_get_protocol_qualified_type() instead of get_static_reference() and get_protocol_reference(). (stmt_nocomp): Call grokparm() on @catch parameter. (objcdef): Move semantic action to objc_finish_implementation(). (classdef): Move semantic action to objc_start_class_interface(), objc_continue_interface(), objc_finish_interface(), objc_start_class_implementation(), objc_continue_implementation(), objc_start_category_interface() and objc_start_category_implementation(). (protocoldef): Move semantic actions to objc_start_protocol() and objc_finish_interface(). (ivar_decl_list): Remove nonterminal. (visibility_spec): Move semantic actions to objc_set_visibility(). (ivar_decls): Remove assignment to $$. (ivar_decl): Rephrase in terms of component_decl; call objc_add_instance_variable(). (ivars, ivar_declarator): Remove nonterminals. (opt_semi): New nonterminal. (methodtype): Remove semantic actions. (methoddef): Move semantic actions to objc_set_method_type(), objc_start_method_definition() and objc_finish_method_definition(). (methodproto): Move semantic actions to objc_set_method_type() and objc_add_method_declaration(). (methoddecl): Use objc_typename instead of typename; move semantic actions to objc_build_method_signature(). (optarglist, myxdecls, mydecl, myparms, myparm): Remove nonterminals. (optparmlist): Express in terms of optparms and optellipsis. (optparms, optellipsis, objc_qual, objc_quals, objc_typename): New nonterminals. (keyworddecl): Use objc_typename instead of typename. (rid_to_yy): Mark RID_IN, RID_OUT, RID_INOUT, RID_BYCOPY, RID_BYREF and RID_ONEWAY as returning OBJC_TYPE_QUAL to yyparse(). [gcc/objc/ChangeLog] 2004-09-07 Ziemowit Laski <zlaski@apple.com> * Make-lang.in (objc/objc-parse.o): Depend on $(C_COMMON_H) instead of objc/objc-act.h. (objc/objc-act.o): Depend on $(HASHTAB_H). * objc-act.c: Include hashtab.h; in ObjC++ mode, include cp-tree.h and objcp-decl.h instead of c-tree.h. (build_module_descriptor, get_class_ivars, synth_id_with_class_suffix, error_with_ivar, gen_method_decl, gen_declaration, setup_string_decl, build_protocol_template): Adjust prototypes. (build_module_initializer_routine, start_class, continue_class, finish_class, start_method_def, objc_start_function, start_protocol, build_method_decl, objc_add_method, add_instance_variable, build_ivar_reference, is_ivar, is_private, get_super_receiver, build_selector_table_decl, objc_push_parm, objc_get_parm_info, gen_type_name, gen_type_name_0, start_var_decl, finish_var_decl, create_field_decl): New prototypes. (objc_expand_function_end, comp_method_with_proto, objc_expr_last, gen_declaration_1, gen_declarator, is_complex_decl, adorn_decl, define_decl, create_builtin_decl, gen_declspecs): Remove prototypes. (TYPE_ID): Rename to OBJECT_TYPEDEF_NAME. (CLASS_TYPEDEF_NAME): New. (TAG_EXECCLASS): Change from a global variable to a #define. (TAG_RETURN_STRUCT): Delete. (TAG_GNUINIT): New, holds '__objc_gnu_init' name. (objc_inherit_code, objc_public_flag): New, moved from c-parse.in. (string_descriptor): New struct. (string_htab): New hash table. (string_hash, string_eq): New prototypes. (generate_struct_by_value_array): Call create_field_decl() instead of create_builtin_decl(). (objc_init): Do not initialize objc_ellipsis_node or TAG_EXECCLASS; In ObjC++ mode, call cxx_init() instead of c_objc_common_init(). (objc_finish_file): In ObjC++, call instantiate_pending_templates() and cp_finish_file(). (define_decl, get_static_reference, get_protocol_reference, create_builtin_decl): Remove functions. (objc_start_class_interface, objc_start_category_interface, objc_start_protocol, objc_continue_interface, objc_finish_interface, objc_start_class_implementation, objc_start_category_implementation, objc_continue_implementation, objc_finish_implementation, objc_set_visibility, objc_set_method_type, objc_build_method_signature, objc_add_method_declaration, objc_start_method_definition, objc_add_instance_variable, objc_get_protocol_qualified_type, create_field_decl, start_var_decl, finish_var_decl): New functions. (setup_string_decl): Simplify since it is only called once. (synth_module_prologue): Call build_class_template(); predefine 'id' and 'Class' as typedefs; rename 'temp_type' to 'type'; disable debug hooks for duration of function; fix GNU runtime messenger signatures to correspond to reality; forward-declare '__objc_exec_class' for the GNU runtime; call build_selector_table_decl(); in ObjC++ mode, generate 'extern "C" { ... }' wrappers around synthesized declarations; call build_protocol_template() and build_category_template(). (string_hash, string_eq): New functions. (objc_build_string_object): Check metaclass correctness only once; store string literals in hash table. (objc_build_constructor): Do not convert initializer elements; adjust for ObjC++ impedance mismatch. (build_objc_symtab_template): Call create_field_decl() instead of create_builtin_decl(). (init_objc_symtab): Add missing conversion to initializer element. (build_metadata_decl): Call start_var_decl() instead of define_decl(). (generate_objc_symtab_decl): Do not call build_category_template(); call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(). (build_module_descriptor): Call create_field_decl() instead of grokfield(); call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(); always mark module descriptor as used; move GNU runtime-specific functionality to build_module_initializer_routine(). (build_module_initializer_routine): New function, broken off of build_module_descriptor(). (objc_static_init_needed_p, objc_generate_static_init_call): New functions. (generate_static_references, generate_strings, build_selector_translation_table, generate_descriptor_table, generate_ivars_list, generate_dispatch_table, generate_category): Call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(); build a type directly instead of via groktypename(). (build_selector_reference_decl, build_selector_table_decl, build_class_reference_decl, build_protocol_reference, generate_objc_image_info): Call start_var_decl() instead of build_decl(). (build_selector_reference): For GNU runtime, do not call build_selector_reference_decl(). (build_selector, build_typed_selector_reference): Always convert result to the selector type. (add_objc_string): Cast return value to 'char *'. (build_method_prototype_template, build_selector_template, build_method_template): Use actual selector type for fields pointing to selectors. (finish_objc): For GNU runtime, call build_module_initializer_routine() after build_module_descriptor(). (generate_protocol_list, generate_shared_structures): Call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(); build a type directly instead of via groktypename(). (synth_id_with_class_suffix): Return a string. (get_arg_type_list): For instance methods, use the instance type for 'self'; do not call groktypename_in_parm_context(). (build_objc_string_decl): Squash redeclaration errors in ObjC++. (objc_is_class_name): Use OBJC_TYPE_NAME instead of TYPE_NAME; handle RECORD_TYPEs in ObjC as well as ObjC++. (objc_is_id): New function. (objc_is_object_ptr): Return the canonical type node. (objc_get_class_ivars): Simplify using get_class_ivars(). (get_class_ivars): Remove second parameter; create a fresh copy of the ivar list for each call; do not check for existence of super class. (objc_eh_runtime_type): Mark #ifndef OBJCPLUS. (objc_init_exceptions): When using SJLJ-style exceptions, require the use of '-fobjc-exceptions' flag; do not require it for DWARF-style exceptions. (objc_build_exc_ptr, next_sjlj_build_try_catch_finally): Use objc_object_type instead of objc_id_type. (objc_begin_catch_clause): Convert the incoming PARM_DECL into a VAR_DECL before placing it in the appropriate scope; do not call define_decl(); adjust call to c_begin_compound_stmt(); use objc_object_type instead of objc_id_type. (build_next_objc_exception_stuff): Call create_field_decl() instead of create_builtin_decl(); construct type directly instead of calling groktypename(); use OBJC_VOID_AT_END to mark end of function parameters. (build_private_template): Adjust call to get_class_ivars(); build a type directly instead of via groktypename(). (build_protocol_template, build_method_prototype_list_template, build_method_prototype_template, build_category_template, build_selector_template, build_class_template, build_super_template, build_ivar_template, build_ivar_list_template, build_method_list_template, build_method_template): Call create_field_decl() instead of grokfield(). (objc_method_parm_type): Do not call groktypename(). (generate_descriptor_table): Call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(). (generate_method_descriptors, build_protocol_initializer, generate_dispatch_tables, build_category_initializer, build_shared_structure_initializer): Do not call groktypename(). (generate_protocols): Call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(); do not call groktypename(). (error_with_ivar): Remove last parameter. (check_ivars): Do not iterate ovar CLASS_RAW_IVARS lists in addition to CLASS_IVARS lists; adjust calls to error_with_ivar(). (generate_ivar_lists): Convert one of the initializer elements; do not call groktypename(). (get_arg_type_list, start_method_def, gen_method_def): Account for new representation of variable arguments and '...' in Objective-C methods; add Objective-C++ impedance matching code. (is_objc_type_qualifier): Remove function. (adjust_type_for_id_default): Simplify; there is no longer a need to wade through declspecs. (lookup_interface, start_class, continue_class, finish_class, start_method_def, start_protocol, build_method_decl, objc_add_method, add_instance_variable, build_ivar_reference, is_ivar, is_private, get_super_receiver, objc_build_finally_epilogue): Make into static functions. (receiver_is_class_object): Use new IS_CLASS() macro. (objc_build_message_expr): Tweak ObjC++ message argument handling; call objc_finish_message_expr() instead of finish_message_expr(). (finish_message_expr): Rename to objc_finish_message_expr(); use OBJC_TYPE_NAME and OBJC_SET_TYPE_NAME macros instead of TYPE_NAME. call gen_type_name() instead of gen_declaration(); call objc_is_id() instead of using IS_ID and IS_CLASS; Use objc_class_name instead of calling get_identifier("Class"); handle CONVERT_EXPRs in receiver. (build_objc_method_call, warn_with_method): Do not call groktypename(). (build_ivar_reference): Call convert() instead of clobbering in a type. (hash_init): Initialize string_htab hash table. (add_instance_variable): Simplify parameter list; do not call grokfield(); do not populate CLASS_IVARS list. (start_class): Check for the existence of super class, if one was specified. (continue_class): Use CLASS_RAW_IVARS rather than CLASS_IVARS; do not call build_class_template(); adjust call to get_class_ivars(); call build_decl(), pushdecl() and finish_decl() instead of define_decl(). (finish_class): Call build_decl(), pushdecl() and finish_decl() instead of define_decl(). (add_protocols): Use PROTOCOL_BINFO_ELTS for the tree vector size. (start_protocol): Do not call build_protocol_template(); use PROTOCOL_BINFO_ELTS for the tree vector size. (encode_type_qualifiers): Do not handle the 'const' qualifier here. (encode_pointer): Encode 'const char *' as 'r*', for backwards compatibility. (encode_array): Use HOST_WIDE_INT_PRINT_DEC instead of "%ld". (encode_type): Handle the 'const' qualifier here. (objc_parmlist): New global variable, sued by objc_push_parm and objc_get_parm_info(). (objc_push_parm, objc_get_parm_info): New functions. (objc_expr_last): Remove function. (synth_self_and_ucmd_args): For instance methods, use the instance type for 'self'; call objc_push_parm() instead of push_parm_decl(). (start_method_def): Do not call push_scope(), declare_parm_level(), pop_scope(), push_parm_decl(), store_parm_decls() or objc_expr_last(); just use objc_push_parm() and objc_get_parm_info(). (comp_method_with_proto): Remove function. (objc_types_are_equivalent): Strip away indirections before comparing underlying types. (comp_proto_with_proto): Do not call groktypename(); types are no longer in raw declspec format. (objc_start_function): New function. (really_start_method): Call comp_proto_with_proto() instead of comp_method_with_proto(); call objc_start_function() instead of hand-crafting a function declarator. (continue_method_def, objc_expand_function_end): Remove functions. (get_super_receiver): Call objc_get_current_scope() instead of get_current_scope(); reference 'super_class' field (instead of 'class'). (finish_method_def): Rename to objc_finish_method_definition() and add a function decl parameter; move method encoding call from objc_expand_function_end(). (is_complex_decl, adorn_decl, gen_declarator, gen_declspecs, gen_declaration_1): Remove functions. (tmpbuf, RAW_DECLSPEC): Remove. (gen_declaration): Remove second parameter; simplify to deal with TYPE_P nodes instead of raw declspecs. (gen_type_name, gen_type_name_0): New functions. (gen_method_decl): Remove second parameter; call gen_type_name() instead of gen_declaration_1(). (dump_interface): Adjust calls to gen_declaration() and gen_method_decl(); do not allocate a separate string buffer. (init_objc): Allocate a larger string buffer to accommodate dump_interface(); adjust call to build_module_descriptor(); add call to build_module_initializer_routine() for the GNU runtime. (generate_classref_translation_entry): Do not call start_decl(); call finish_var_decl() instead of finish_decl(); call convert() instead of build_c_cast(). * objc-act.h (CLASS_OWN_IVARS): Remove accessor. (CLASS_BINFO_ELTS): Reduce from 6 to 5, now that CLASS_OWN_IVARS is gone. (OCTI_GNU_INIT_DECL, GNU_INIT_decl): New. (OCTI_ELLIPSIS_NODE, objc_ellipsis_node): Remove. (OCTI_ID_ID, id_type, objc_id_id): Rename to OCTI_ID_NAME, objc_object_type and objc_object_name, respectively. (OCTI_CLS_REF, OCTI_CLASS_NAME, objc_class_reference, objc_class_name): New. (IS_CLASS): New macro. (IS_ID, IS_SUPER): Robustify. (OCTI_EXECCLASS_DECL, execclass_decl): New. (finish_file, start_class, continue_class, finish_class, start_method_def, continue_method_def, finish_method_def, start_protocol, finish_protocol, objc_build_throw_stmt, objc_build_try_catch_finally_stmt, objc_build_synchronized_prologue, objc_build_synchronized_epilogue, objc_build_try_prologue, objc_build_try_epilogue, objc_build_catch_stmt, objc_build_catch_epilogue, objc_build_finally_prologue, objc_build_finally_epilogue, is_ivar, is_private, is_public, add_instance_variable, objc_add_method, get_super_receiver, objc_clear_super_receiver, get_class_ivars_from_name, get_class_reference, get_static_reference, get_object_reference, build_message_expr, finish_message_expr, build_selector_expr, build_ivar_reference, build_keyword_decl, build_method_decl, build_protocol_expr, build_objc_string_object, objc_declare_alias, objc_declare_class, objc_declare_protocols, objc_comptypes, objc_check_decl, build_encode_expr): Remove prototypes. (imp_count, cat_count): Make GGC-aware. (OBJC_SET_TYPE_NAME): New macro. From-SVN: r87168
2004-09-08 02:49:44 +02:00
return convert (string_type_node,
build_unary_op (ADDR_EXPR, TREE_PURPOSE (*chain), 1));
chain = &TREE_CHAIN (*chain);
1992-01-18 00:15:38 +01:00
}
decl = build_objc_string_decl (section);
type = build_array_type
(char_type_node,
build_index_type
(build_int_cst (NULL_TREE,
IDENTIFIER_LENGTH (ident))));
decl = start_var_decl (type, IDENTIFIER_POINTER (DECL_NAME (decl)));
string_expr = my_build_string (IDENTIFIER_LENGTH (ident) + 1,
IDENTIFIER_POINTER (ident));
finish_var_decl (decl, string_expr);
*chain = tree_cons (decl, ident, NULL_TREE);
Makefile.in (c-parse.o): Depend on $(C_COMMON_H). [gcc/ChangeLog] 2004-09-07 Ziemowit Laski <zlaski@apple.com> * Makefile.in (c-parse.o): Depend on $(C_COMMON_H). * c-parse.in: Include c-common.h instead of objc-act.h. (ivar_decl_list, ivar_decls, ivar_decl, ivars, ivar_declarator, myparms, myparm): Remove %type declarations. (methodtype, optparms, OBJC_TYPE_QUAL, objc_quals, objc_qual, objc_typename, objc_try_catch_stmt, optellipsis): Add %type declarations. (objc_inherit_code, objc_public_flag): Remove. (typespec_nonreserved_nonattr): Call objc_get_protocol_qualified_type() instead of get_static_reference() and get_protocol_reference(). (stmt_nocomp): Call grokparm() on @catch parameter. (objcdef): Move semantic action to objc_finish_implementation(). (classdef): Move semantic action to objc_start_class_interface(), objc_continue_interface(), objc_finish_interface(), objc_start_class_implementation(), objc_continue_implementation(), objc_start_category_interface() and objc_start_category_implementation(). (protocoldef): Move semantic actions to objc_start_protocol() and objc_finish_interface(). (ivar_decl_list): Remove nonterminal. (visibility_spec): Move semantic actions to objc_set_visibility(). (ivar_decls): Remove assignment to $$. (ivar_decl): Rephrase in terms of component_decl; call objc_add_instance_variable(). (ivars, ivar_declarator): Remove nonterminals. (opt_semi): New nonterminal. (methodtype): Remove semantic actions. (methoddef): Move semantic actions to objc_set_method_type(), objc_start_method_definition() and objc_finish_method_definition(). (methodproto): Move semantic actions to objc_set_method_type() and objc_add_method_declaration(). (methoddecl): Use objc_typename instead of typename; move semantic actions to objc_build_method_signature(). (optarglist, myxdecls, mydecl, myparms, myparm): Remove nonterminals. (optparmlist): Express in terms of optparms and optellipsis. (optparms, optellipsis, objc_qual, objc_quals, objc_typename): New nonterminals. (keyworddecl): Use objc_typename instead of typename. (rid_to_yy): Mark RID_IN, RID_OUT, RID_INOUT, RID_BYCOPY, RID_BYREF and RID_ONEWAY as returning OBJC_TYPE_QUAL to yyparse(). [gcc/objc/ChangeLog] 2004-09-07 Ziemowit Laski <zlaski@apple.com> * Make-lang.in (objc/objc-parse.o): Depend on $(C_COMMON_H) instead of objc/objc-act.h. (objc/objc-act.o): Depend on $(HASHTAB_H). * objc-act.c: Include hashtab.h; in ObjC++ mode, include cp-tree.h and objcp-decl.h instead of c-tree.h. (build_module_descriptor, get_class_ivars, synth_id_with_class_suffix, error_with_ivar, gen_method_decl, gen_declaration, setup_string_decl, build_protocol_template): Adjust prototypes. (build_module_initializer_routine, start_class, continue_class, finish_class, start_method_def, objc_start_function, start_protocol, build_method_decl, objc_add_method, add_instance_variable, build_ivar_reference, is_ivar, is_private, get_super_receiver, build_selector_table_decl, objc_push_parm, objc_get_parm_info, gen_type_name, gen_type_name_0, start_var_decl, finish_var_decl, create_field_decl): New prototypes. (objc_expand_function_end, comp_method_with_proto, objc_expr_last, gen_declaration_1, gen_declarator, is_complex_decl, adorn_decl, define_decl, create_builtin_decl, gen_declspecs): Remove prototypes. (TYPE_ID): Rename to OBJECT_TYPEDEF_NAME. (CLASS_TYPEDEF_NAME): New. (TAG_EXECCLASS): Change from a global variable to a #define. (TAG_RETURN_STRUCT): Delete. (TAG_GNUINIT): New, holds '__objc_gnu_init' name. (objc_inherit_code, objc_public_flag): New, moved from c-parse.in. (string_descriptor): New struct. (string_htab): New hash table. (string_hash, string_eq): New prototypes. (generate_struct_by_value_array): Call create_field_decl() instead of create_builtin_decl(). (objc_init): Do not initialize objc_ellipsis_node or TAG_EXECCLASS; In ObjC++ mode, call cxx_init() instead of c_objc_common_init(). (objc_finish_file): In ObjC++, call instantiate_pending_templates() and cp_finish_file(). (define_decl, get_static_reference, get_protocol_reference, create_builtin_decl): Remove functions. (objc_start_class_interface, objc_start_category_interface, objc_start_protocol, objc_continue_interface, objc_finish_interface, objc_start_class_implementation, objc_start_category_implementation, objc_continue_implementation, objc_finish_implementation, objc_set_visibility, objc_set_method_type, objc_build_method_signature, objc_add_method_declaration, objc_start_method_definition, objc_add_instance_variable, objc_get_protocol_qualified_type, create_field_decl, start_var_decl, finish_var_decl): New functions. (setup_string_decl): Simplify since it is only called once. (synth_module_prologue): Call build_class_template(); predefine 'id' and 'Class' as typedefs; rename 'temp_type' to 'type'; disable debug hooks for duration of function; fix GNU runtime messenger signatures to correspond to reality; forward-declare '__objc_exec_class' for the GNU runtime; call build_selector_table_decl(); in ObjC++ mode, generate 'extern "C" { ... }' wrappers around synthesized declarations; call build_protocol_template() and build_category_template(). (string_hash, string_eq): New functions. (objc_build_string_object): Check metaclass correctness only once; store string literals in hash table. (objc_build_constructor): Do not convert initializer elements; adjust for ObjC++ impedance mismatch. (build_objc_symtab_template): Call create_field_decl() instead of create_builtin_decl(). (init_objc_symtab): Add missing conversion to initializer element. (build_metadata_decl): Call start_var_decl() instead of define_decl(). (generate_objc_symtab_decl): Do not call build_category_template(); call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(). (build_module_descriptor): Call create_field_decl() instead of grokfield(); call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(); always mark module descriptor as used; move GNU runtime-specific functionality to build_module_initializer_routine(). (build_module_initializer_routine): New function, broken off of build_module_descriptor(). (objc_static_init_needed_p, objc_generate_static_init_call): New functions. (generate_static_references, generate_strings, build_selector_translation_table, generate_descriptor_table, generate_ivars_list, generate_dispatch_table, generate_category): Call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(); build a type directly instead of via groktypename(). (build_selector_reference_decl, build_selector_table_decl, build_class_reference_decl, build_protocol_reference, generate_objc_image_info): Call start_var_decl() instead of build_decl(). (build_selector_reference): For GNU runtime, do not call build_selector_reference_decl(). (build_selector, build_typed_selector_reference): Always convert result to the selector type. (add_objc_string): Cast return value to 'char *'. (build_method_prototype_template, build_selector_template, build_method_template): Use actual selector type for fields pointing to selectors. (finish_objc): For GNU runtime, call build_module_initializer_routine() after build_module_descriptor(). (generate_protocol_list, generate_shared_structures): Call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(); build a type directly instead of via groktypename(). (synth_id_with_class_suffix): Return a string. (get_arg_type_list): For instance methods, use the instance type for 'self'; do not call groktypename_in_parm_context(). (build_objc_string_decl): Squash redeclaration errors in ObjC++. (objc_is_class_name): Use OBJC_TYPE_NAME instead of TYPE_NAME; handle RECORD_TYPEs in ObjC as well as ObjC++. (objc_is_id): New function. (objc_is_object_ptr): Return the canonical type node. (objc_get_class_ivars): Simplify using get_class_ivars(). (get_class_ivars): Remove second parameter; create a fresh copy of the ivar list for each call; do not check for existence of super class. (objc_eh_runtime_type): Mark #ifndef OBJCPLUS. (objc_init_exceptions): When using SJLJ-style exceptions, require the use of '-fobjc-exceptions' flag; do not require it for DWARF-style exceptions. (objc_build_exc_ptr, next_sjlj_build_try_catch_finally): Use objc_object_type instead of objc_id_type. (objc_begin_catch_clause): Convert the incoming PARM_DECL into a VAR_DECL before placing it in the appropriate scope; do not call define_decl(); adjust call to c_begin_compound_stmt(); use objc_object_type instead of objc_id_type. (build_next_objc_exception_stuff): Call create_field_decl() instead of create_builtin_decl(); construct type directly instead of calling groktypename(); use OBJC_VOID_AT_END to mark end of function parameters. (build_private_template): Adjust call to get_class_ivars(); build a type directly instead of via groktypename(). (build_protocol_template, build_method_prototype_list_template, build_method_prototype_template, build_category_template, build_selector_template, build_class_template, build_super_template, build_ivar_template, build_ivar_list_template, build_method_list_template, build_method_template): Call create_field_decl() instead of grokfield(). (objc_method_parm_type): Do not call groktypename(). (generate_descriptor_table): Call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(). (generate_method_descriptors, build_protocol_initializer, generate_dispatch_tables, build_category_initializer, build_shared_structure_initializer): Do not call groktypename(). (generate_protocols): Call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(); do not call groktypename(). (error_with_ivar): Remove last parameter. (check_ivars): Do not iterate ovar CLASS_RAW_IVARS lists in addition to CLASS_IVARS lists; adjust calls to error_with_ivar(). (generate_ivar_lists): Convert one of the initializer elements; do not call groktypename(). (get_arg_type_list, start_method_def, gen_method_def): Account for new representation of variable arguments and '...' in Objective-C methods; add Objective-C++ impedance matching code. (is_objc_type_qualifier): Remove function. (adjust_type_for_id_default): Simplify; there is no longer a need to wade through declspecs. (lookup_interface, start_class, continue_class, finish_class, start_method_def, start_protocol, build_method_decl, objc_add_method, add_instance_variable, build_ivar_reference, is_ivar, is_private, get_super_receiver, objc_build_finally_epilogue): Make into static functions. (receiver_is_class_object): Use new IS_CLASS() macro. (objc_build_message_expr): Tweak ObjC++ message argument handling; call objc_finish_message_expr() instead of finish_message_expr(). (finish_message_expr): Rename to objc_finish_message_expr(); use OBJC_TYPE_NAME and OBJC_SET_TYPE_NAME macros instead of TYPE_NAME. call gen_type_name() instead of gen_declaration(); call objc_is_id() instead of using IS_ID and IS_CLASS; Use objc_class_name instead of calling get_identifier("Class"); handle CONVERT_EXPRs in receiver. (build_objc_method_call, warn_with_method): Do not call groktypename(). (build_ivar_reference): Call convert() instead of clobbering in a type. (hash_init): Initialize string_htab hash table. (add_instance_variable): Simplify parameter list; do not call grokfield(); do not populate CLASS_IVARS list. (start_class): Check for the existence of super class, if one was specified. (continue_class): Use CLASS_RAW_IVARS rather than CLASS_IVARS; do not call build_class_template(); adjust call to get_class_ivars(); call build_decl(), pushdecl() and finish_decl() instead of define_decl(). (finish_class): Call build_decl(), pushdecl() and finish_decl() instead of define_decl(). (add_protocols): Use PROTOCOL_BINFO_ELTS for the tree vector size. (start_protocol): Do not call build_protocol_template(); use PROTOCOL_BINFO_ELTS for the tree vector size. (encode_type_qualifiers): Do not handle the 'const' qualifier here. (encode_pointer): Encode 'const char *' as 'r*', for backwards compatibility. (encode_array): Use HOST_WIDE_INT_PRINT_DEC instead of "%ld". (encode_type): Handle the 'const' qualifier here. (objc_parmlist): New global variable, sued by objc_push_parm and objc_get_parm_info(). (objc_push_parm, objc_get_parm_info): New functions. (objc_expr_last): Remove function. (synth_self_and_ucmd_args): For instance methods, use the instance type for 'self'; call objc_push_parm() instead of push_parm_decl(). (start_method_def): Do not call push_scope(), declare_parm_level(), pop_scope(), push_parm_decl(), store_parm_decls() or objc_expr_last(); just use objc_push_parm() and objc_get_parm_info(). (comp_method_with_proto): Remove function. (objc_types_are_equivalent): Strip away indirections before comparing underlying types. (comp_proto_with_proto): Do not call groktypename(); types are no longer in raw declspec format. (objc_start_function): New function. (really_start_method): Call comp_proto_with_proto() instead of comp_method_with_proto(); call objc_start_function() instead of hand-crafting a function declarator. (continue_method_def, objc_expand_function_end): Remove functions. (get_super_receiver): Call objc_get_current_scope() instead of get_current_scope(); reference 'super_class' field (instead of 'class'). (finish_method_def): Rename to objc_finish_method_definition() and add a function decl parameter; move method encoding call from objc_expand_function_end(). (is_complex_decl, adorn_decl, gen_declarator, gen_declspecs, gen_declaration_1): Remove functions. (tmpbuf, RAW_DECLSPEC): Remove. (gen_declaration): Remove second parameter; simplify to deal with TYPE_P nodes instead of raw declspecs. (gen_type_name, gen_type_name_0): New functions. (gen_method_decl): Remove second parameter; call gen_type_name() instead of gen_declaration_1(). (dump_interface): Adjust calls to gen_declaration() and gen_method_decl(); do not allocate a separate string buffer. (init_objc): Allocate a larger string buffer to accommodate dump_interface(); adjust call to build_module_descriptor(); add call to build_module_initializer_routine() for the GNU runtime. (generate_classref_translation_entry): Do not call start_decl(); call finish_var_decl() instead of finish_decl(); call convert() instead of build_c_cast(). * objc-act.h (CLASS_OWN_IVARS): Remove accessor. (CLASS_BINFO_ELTS): Reduce from 6 to 5, now that CLASS_OWN_IVARS is gone. (OCTI_GNU_INIT_DECL, GNU_INIT_decl): New. (OCTI_ELLIPSIS_NODE, objc_ellipsis_node): Remove. (OCTI_ID_ID, id_type, objc_id_id): Rename to OCTI_ID_NAME, objc_object_type and objc_object_name, respectively. (OCTI_CLS_REF, OCTI_CLASS_NAME, objc_class_reference, objc_class_name): New. (IS_CLASS): New macro. (IS_ID, IS_SUPER): Robustify. (OCTI_EXECCLASS_DECL, execclass_decl): New. (finish_file, start_class, continue_class, finish_class, start_method_def, continue_method_def, finish_method_def, start_protocol, finish_protocol, objc_build_throw_stmt, objc_build_try_catch_finally_stmt, objc_build_synchronized_prologue, objc_build_synchronized_epilogue, objc_build_try_prologue, objc_build_try_epilogue, objc_build_catch_stmt, objc_build_catch_epilogue, objc_build_finally_prologue, objc_build_finally_epilogue, is_ivar, is_private, is_public, add_instance_variable, objc_add_method, get_super_receiver, objc_clear_super_receiver, get_class_ivars_from_name, get_class_reference, get_static_reference, get_object_reference, build_message_expr, finish_message_expr, build_selector_expr, build_ivar_reference, build_keyword_decl, build_method_decl, build_protocol_expr, build_objc_string_object, objc_declare_alias, objc_declare_class, objc_declare_protocols, objc_comptypes, objc_check_decl, build_encode_expr): Remove prototypes. (imp_count, cat_count): Make GGC-aware. (OBJC_SET_TYPE_NAME): New macro. From-SVN: r87168
2004-09-08 02:49:44 +02:00
return convert (string_type_node, build_unary_op (ADDR_EXPR, decl, 1));
}
static GTY(()) int class_names_idx;
static GTY(()) int meth_var_names_idx;
static GTY(()) int meth_var_types_idx;
static tree
build_objc_string_decl (enum string_section section)
{
tree decl, ident;
char buf[256];
if (section == class_names)
sprintf (buf, "_OBJC_CLASS_NAME_%d", class_names_idx++);
else if (section == meth_var_names)
sprintf (buf, "_OBJC_METH_VAR_NAME_%d", meth_var_names_idx++);
else if (section == meth_var_types)
sprintf (buf, "_OBJC_METH_VAR_TYPE_%d", meth_var_types_idx++);
ident = get_identifier (buf);
decl = build_decl (VAR_DECL, ident, build_array_type (char_type_node, 0));
DECL_EXTERNAL (decl) = 1;
TREE_PUBLIC (decl) = 0;
TREE_USED (decl) = 1;
TREE_CONSTANT (decl) = 1;
DECL_CONTEXT (decl) = 0;
DECL_ARTIFICIAL (decl) = 1;
Makefile.in (c-parse.o): Depend on $(C_COMMON_H). [gcc/ChangeLog] 2004-09-07 Ziemowit Laski <zlaski@apple.com> * Makefile.in (c-parse.o): Depend on $(C_COMMON_H). * c-parse.in: Include c-common.h instead of objc-act.h. (ivar_decl_list, ivar_decls, ivar_decl, ivars, ivar_declarator, myparms, myparm): Remove %type declarations. (methodtype, optparms, OBJC_TYPE_QUAL, objc_quals, objc_qual, objc_typename, objc_try_catch_stmt, optellipsis): Add %type declarations. (objc_inherit_code, objc_public_flag): Remove. (typespec_nonreserved_nonattr): Call objc_get_protocol_qualified_type() instead of get_static_reference() and get_protocol_reference(). (stmt_nocomp): Call grokparm() on @catch parameter. (objcdef): Move semantic action to objc_finish_implementation(). (classdef): Move semantic action to objc_start_class_interface(), objc_continue_interface(), objc_finish_interface(), objc_start_class_implementation(), objc_continue_implementation(), objc_start_category_interface() and objc_start_category_implementation(). (protocoldef): Move semantic actions to objc_start_protocol() and objc_finish_interface(). (ivar_decl_list): Remove nonterminal. (visibility_spec): Move semantic actions to objc_set_visibility(). (ivar_decls): Remove assignment to $$. (ivar_decl): Rephrase in terms of component_decl; call objc_add_instance_variable(). (ivars, ivar_declarator): Remove nonterminals. (opt_semi): New nonterminal. (methodtype): Remove semantic actions. (methoddef): Move semantic actions to objc_set_method_type(), objc_start_method_definition() and objc_finish_method_definition(). (methodproto): Move semantic actions to objc_set_method_type() and objc_add_method_declaration(). (methoddecl): Use objc_typename instead of typename; move semantic actions to objc_build_method_signature(). (optarglist, myxdecls, mydecl, myparms, myparm): Remove nonterminals. (optparmlist): Express in terms of optparms and optellipsis. (optparms, optellipsis, objc_qual, objc_quals, objc_typename): New nonterminals. (keyworddecl): Use objc_typename instead of typename. (rid_to_yy): Mark RID_IN, RID_OUT, RID_INOUT, RID_BYCOPY, RID_BYREF and RID_ONEWAY as returning OBJC_TYPE_QUAL to yyparse(). [gcc/objc/ChangeLog] 2004-09-07 Ziemowit Laski <zlaski@apple.com> * Make-lang.in (objc/objc-parse.o): Depend on $(C_COMMON_H) instead of objc/objc-act.h. (objc/objc-act.o): Depend on $(HASHTAB_H). * objc-act.c: Include hashtab.h; in ObjC++ mode, include cp-tree.h and objcp-decl.h instead of c-tree.h. (build_module_descriptor, get_class_ivars, synth_id_with_class_suffix, error_with_ivar, gen_method_decl, gen_declaration, setup_string_decl, build_protocol_template): Adjust prototypes. (build_module_initializer_routine, start_class, continue_class, finish_class, start_method_def, objc_start_function, start_protocol, build_method_decl, objc_add_method, add_instance_variable, build_ivar_reference, is_ivar, is_private, get_super_receiver, build_selector_table_decl, objc_push_parm, objc_get_parm_info, gen_type_name, gen_type_name_0, start_var_decl, finish_var_decl, create_field_decl): New prototypes. (objc_expand_function_end, comp_method_with_proto, objc_expr_last, gen_declaration_1, gen_declarator, is_complex_decl, adorn_decl, define_decl, create_builtin_decl, gen_declspecs): Remove prototypes. (TYPE_ID): Rename to OBJECT_TYPEDEF_NAME. (CLASS_TYPEDEF_NAME): New. (TAG_EXECCLASS): Change from a global variable to a #define. (TAG_RETURN_STRUCT): Delete. (TAG_GNUINIT): New, holds '__objc_gnu_init' name. (objc_inherit_code, objc_public_flag): New, moved from c-parse.in. (string_descriptor): New struct. (string_htab): New hash table. (string_hash, string_eq): New prototypes. (generate_struct_by_value_array): Call create_field_decl() instead of create_builtin_decl(). (objc_init): Do not initialize objc_ellipsis_node or TAG_EXECCLASS; In ObjC++ mode, call cxx_init() instead of c_objc_common_init(). (objc_finish_file): In ObjC++, call instantiate_pending_templates() and cp_finish_file(). (define_decl, get_static_reference, get_protocol_reference, create_builtin_decl): Remove functions. (objc_start_class_interface, objc_start_category_interface, objc_start_protocol, objc_continue_interface, objc_finish_interface, objc_start_class_implementation, objc_start_category_implementation, objc_continue_implementation, objc_finish_implementation, objc_set_visibility, objc_set_method_type, objc_build_method_signature, objc_add_method_declaration, objc_start_method_definition, objc_add_instance_variable, objc_get_protocol_qualified_type, create_field_decl, start_var_decl, finish_var_decl): New functions. (setup_string_decl): Simplify since it is only called once. (synth_module_prologue): Call build_class_template(); predefine 'id' and 'Class' as typedefs; rename 'temp_type' to 'type'; disable debug hooks for duration of function; fix GNU runtime messenger signatures to correspond to reality; forward-declare '__objc_exec_class' for the GNU runtime; call build_selector_table_decl(); in ObjC++ mode, generate 'extern "C" { ... }' wrappers around synthesized declarations; call build_protocol_template() and build_category_template(). (string_hash, string_eq): New functions. (objc_build_string_object): Check metaclass correctness only once; store string literals in hash table. (objc_build_constructor): Do not convert initializer elements; adjust for ObjC++ impedance mismatch. (build_objc_symtab_template): Call create_field_decl() instead of create_builtin_decl(). (init_objc_symtab): Add missing conversion to initializer element. (build_metadata_decl): Call start_var_decl() instead of define_decl(). (generate_objc_symtab_decl): Do not call build_category_template(); call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(). (build_module_descriptor): Call create_field_decl() instead of grokfield(); call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(); always mark module descriptor as used; move GNU runtime-specific functionality to build_module_initializer_routine(). (build_module_initializer_routine): New function, broken off of build_module_descriptor(). (objc_static_init_needed_p, objc_generate_static_init_call): New functions. (generate_static_references, generate_strings, build_selector_translation_table, generate_descriptor_table, generate_ivars_list, generate_dispatch_table, generate_category): Call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(); build a type directly instead of via groktypename(). (build_selector_reference_decl, build_selector_table_decl, build_class_reference_decl, build_protocol_reference, generate_objc_image_info): Call start_var_decl() instead of build_decl(). (build_selector_reference): For GNU runtime, do not call build_selector_reference_decl(). (build_selector, build_typed_selector_reference): Always convert result to the selector type. (add_objc_string): Cast return value to 'char *'. (build_method_prototype_template, build_selector_template, build_method_template): Use actual selector type for fields pointing to selectors. (finish_objc): For GNU runtime, call build_module_initializer_routine() after build_module_descriptor(). (generate_protocol_list, generate_shared_structures): Call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(); build a type directly instead of via groktypename(). (synth_id_with_class_suffix): Return a string. (get_arg_type_list): For instance methods, use the instance type for 'self'; do not call groktypename_in_parm_context(). (build_objc_string_decl): Squash redeclaration errors in ObjC++. (objc_is_class_name): Use OBJC_TYPE_NAME instead of TYPE_NAME; handle RECORD_TYPEs in ObjC as well as ObjC++. (objc_is_id): New function. (objc_is_object_ptr): Return the canonical type node. (objc_get_class_ivars): Simplify using get_class_ivars(). (get_class_ivars): Remove second parameter; create a fresh copy of the ivar list for each call; do not check for existence of super class. (objc_eh_runtime_type): Mark #ifndef OBJCPLUS. (objc_init_exceptions): When using SJLJ-style exceptions, require the use of '-fobjc-exceptions' flag; do not require it for DWARF-style exceptions. (objc_build_exc_ptr, next_sjlj_build_try_catch_finally): Use objc_object_type instead of objc_id_type. (objc_begin_catch_clause): Convert the incoming PARM_DECL into a VAR_DECL before placing it in the appropriate scope; do not call define_decl(); adjust call to c_begin_compound_stmt(); use objc_object_type instead of objc_id_type. (build_next_objc_exception_stuff): Call create_field_decl() instead of create_builtin_decl(); construct type directly instead of calling groktypename(); use OBJC_VOID_AT_END to mark end of function parameters. (build_private_template): Adjust call to get_class_ivars(); build a type directly instead of via groktypename(). (build_protocol_template, build_method_prototype_list_template, build_method_prototype_template, build_category_template, build_selector_template, build_class_template, build_super_template, build_ivar_template, build_ivar_list_template, build_method_list_template, build_method_template): Call create_field_decl() instead of grokfield(). (objc_method_parm_type): Do not call groktypename(). (generate_descriptor_table): Call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(). (generate_method_descriptors, build_protocol_initializer, generate_dispatch_tables, build_category_initializer, build_shared_structure_initializer): Do not call groktypename(). (generate_protocols): Call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(); do not call groktypename(). (error_with_ivar): Remove last parameter. (check_ivars): Do not iterate ovar CLASS_RAW_IVARS lists in addition to CLASS_IVARS lists; adjust calls to error_with_ivar(). (generate_ivar_lists): Convert one of the initializer elements; do not call groktypename(). (get_arg_type_list, start_method_def, gen_method_def): Account for new representation of variable arguments and '...' in Objective-C methods; add Objective-C++ impedance matching code. (is_objc_type_qualifier): Remove function. (adjust_type_for_id_default): Simplify; there is no longer a need to wade through declspecs. (lookup_interface, start_class, continue_class, finish_class, start_method_def, start_protocol, build_method_decl, objc_add_method, add_instance_variable, build_ivar_reference, is_ivar, is_private, get_super_receiver, objc_build_finally_epilogue): Make into static functions. (receiver_is_class_object): Use new IS_CLASS() macro. (objc_build_message_expr): Tweak ObjC++ message argument handling; call objc_finish_message_expr() instead of finish_message_expr(). (finish_message_expr): Rename to objc_finish_message_expr(); use OBJC_TYPE_NAME and OBJC_SET_TYPE_NAME macros instead of TYPE_NAME. call gen_type_name() instead of gen_declaration(); call objc_is_id() instead of using IS_ID and IS_CLASS; Use objc_class_name instead of calling get_identifier("Class"); handle CONVERT_EXPRs in receiver. (build_objc_method_call, warn_with_method): Do not call groktypename(). (build_ivar_reference): Call convert() instead of clobbering in a type. (hash_init): Initialize string_htab hash table. (add_instance_variable): Simplify parameter list; do not call grokfield(); do not populate CLASS_IVARS list. (start_class): Check for the existence of super class, if one was specified. (continue_class): Use CLASS_RAW_IVARS rather than CLASS_IVARS; do not call build_class_template(); adjust call to get_class_ivars(); call build_decl(), pushdecl() and finish_decl() instead of define_decl(). (finish_class): Call build_decl(), pushdecl() and finish_decl() instead of define_decl(). (add_protocols): Use PROTOCOL_BINFO_ELTS for the tree vector size. (start_protocol): Do not call build_protocol_template(); use PROTOCOL_BINFO_ELTS for the tree vector size. (encode_type_qualifiers): Do not handle the 'const' qualifier here. (encode_pointer): Encode 'const char *' as 'r*', for backwards compatibility. (encode_array): Use HOST_WIDE_INT_PRINT_DEC instead of "%ld". (encode_type): Handle the 'const' qualifier here. (objc_parmlist): New global variable, sued by objc_push_parm and objc_get_parm_info(). (objc_push_parm, objc_get_parm_info): New functions. (objc_expr_last): Remove function. (synth_self_and_ucmd_args): For instance methods, use the instance type for 'self'; call objc_push_parm() instead of push_parm_decl(). (start_method_def): Do not call push_scope(), declare_parm_level(), pop_scope(), push_parm_decl(), store_parm_decls() or objc_expr_last(); just use objc_push_parm() and objc_get_parm_info(). (comp_method_with_proto): Remove function. (objc_types_are_equivalent): Strip away indirections before comparing underlying types. (comp_proto_with_proto): Do not call groktypename(); types are no longer in raw declspec format. (objc_start_function): New function. (really_start_method): Call comp_proto_with_proto() instead of comp_method_with_proto(); call objc_start_function() instead of hand-crafting a function declarator. (continue_method_def, objc_expand_function_end): Remove functions. (get_super_receiver): Call objc_get_current_scope() instead of get_current_scope(); reference 'super_class' field (instead of 'class'). (finish_method_def): Rename to objc_finish_method_definition() and add a function decl parameter; move method encoding call from objc_expand_function_end(). (is_complex_decl, adorn_decl, gen_declarator, gen_declspecs, gen_declaration_1): Remove functions. (tmpbuf, RAW_DECLSPEC): Remove. (gen_declaration): Remove second parameter; simplify to deal with TYPE_P nodes instead of raw declspecs. (gen_type_name, gen_type_name_0): New functions. (gen_method_decl): Remove second parameter; call gen_type_name() instead of gen_declaration_1(). (dump_interface): Adjust calls to gen_declaration() and gen_method_decl(); do not allocate a separate string buffer. (init_objc): Allocate a larger string buffer to accommodate dump_interface(); adjust call to build_module_descriptor(); add call to build_module_initializer_routine() for the GNU runtime. (generate_classref_translation_entry): Do not call start_decl(); call finish_var_decl() instead of finish_decl(); call convert() instead of build_c_cast(). * objc-act.h (CLASS_OWN_IVARS): Remove accessor. (CLASS_BINFO_ELTS): Reduce from 6 to 5, now that CLASS_OWN_IVARS is gone. (OCTI_GNU_INIT_DECL, GNU_INIT_decl): New. (OCTI_ELLIPSIS_NODE, objc_ellipsis_node): Remove. (OCTI_ID_ID, id_type, objc_id_id): Rename to OCTI_ID_NAME, objc_object_type and objc_object_name, respectively. (OCTI_CLS_REF, OCTI_CLASS_NAME, objc_class_reference, objc_class_name): New. (IS_CLASS): New macro. (IS_ID, IS_SUPER): Robustify. (OCTI_EXECCLASS_DECL, execclass_decl): New. (finish_file, start_class, continue_class, finish_class, start_method_def, continue_method_def, finish_method_def, start_protocol, finish_protocol, objc_build_throw_stmt, objc_build_try_catch_finally_stmt, objc_build_synchronized_prologue, objc_build_synchronized_epilogue, objc_build_try_prologue, objc_build_try_epilogue, objc_build_catch_stmt, objc_build_catch_epilogue, objc_build_finally_prologue, objc_build_finally_epilogue, is_ivar, is_private, is_public, add_instance_variable, objc_add_method, get_super_receiver, objc_clear_super_receiver, get_class_ivars_from_name, get_class_reference, get_static_reference, get_object_reference, build_message_expr, finish_message_expr, build_selector_expr, build_ivar_reference, build_keyword_decl, build_method_decl, build_protocol_expr, build_objc_string_object, objc_declare_alias, objc_declare_class, objc_declare_protocols, objc_comptypes, objc_check_decl, build_encode_expr): Remove prototypes. (imp_count, cat_count): Make GGC-aware. (OBJC_SET_TYPE_NAME): New macro. From-SVN: r87168
2004-09-08 02:49:44 +02:00
#ifdef OBJCPLUS
DECL_THIS_STATIC (decl) = 1; /* squash redeclaration errors */
#endif
make_decl_rtl (decl);
pushdecl_top_level (decl);
return decl;
}
void
objc_declare_alias (tree alias_ident, tree class_ident)
{
tree underlying_class;
#ifdef OBJCPLUS
if (current_namespace != global_namespace) {
error ("Objective-C declarations may only appear in global scope");
}
#endif /* OBJCPLUS */
if (!(underlying_class = objc_is_class_name (class_ident)))
diagnostic.c (warning): Accept parameter to classify warning option. * diagnostic.c (warning): Accept parameter to classify warning option. (warning0): New, for when a pointer to an error() like function is needed. * errors.c (warning): Likewise. * errors.h (warning, warning0): Adjust prototypes. * toplev.h (warning, warning0): Likewise. * attribs.c, builtins.c, c-common.c, c-decl.c, c-format.c, c-gimplify.c, c-lex.c, c-objc-common.c, c-opts.c, c-parser.c, c-pragma.c, c-typeck.c, calls.c, cgraph.c, coverage.c, emit-rtl.c, fold-const.c, fortran/trans-decl.c, function.c, gcse.c, genautomata.c, haifa-sched.c, opts.c, passes.c, regclass.c, reload1.c, stmt.c, stor-layout.c, toplev.c, tree-cfg.c, tree-dump.c, tree-inline.c, tree-mudflap.c, tree-optimize.c, tree-ssa.c, tree.c, varasm.c: Adjust warning() callers. * config/alpha/alpha.c, config/arc/arc.c, config/arm/arm.c, config/avr/avr.c, config/bfin/bfin.c, config/c4x/c4x-c.c, config/c4x/c4x.c, config/cris/cris.c, config/darwin-c.c, config/darwin.c, config/darwin.h, config/h8300/h8300.c, config/i386/cygming.h, config/i386/djgpp.h, config/i386/i386.c, config/i386/winnt.c, config/ia64/ia64-c.c, config/ia64/ia64.c, config/ip2k/ip2k.c, config/m32r/m32r.c, config/m68hc11/m68hc11.c, config/m68k/m68k.c, config/mcore/mcore.c, config/mips/mips.c, config/mmix/mmix.c, config/ns32k/ns32k.c, config/pa/pa-hpux11.h, config/pa/pa.c, config/rs6000/aix43.h, config/rs6000/aix51.h, config/rs6000/aix52.h, config/rs6000/darwin.h, config/rs6000/rs6000-c.c, config/rs6000/rs6000.c, config/s390/s390.c, config/sh/sh.c, config/sh/sh.h, config/sh/symbian.c, config/sol2-c.c, config/sol2.c, config/stormy16/stormy16.c, config/v850/v850-c.c, config/v850/v850.c, config/xtensa/xtensa.c: Adjust warning() callers. * ada/misc.c: Adjust warning() callers. * cp/call.c, cp/class.c, cp/cvt.c, cp/decl.c, cp/decl2.c, cp/except.c, cp/friend.c, cp/init.c, cp/lex.c, cp/mangle.c, cp/method.c, cp/name-lookup.c, cp/parser.c, cp/repo.c, cp/rtti.c, cp/tree.c, cp/typeck.c, cp/typeck2.c: Adjust warning() callers. * fortran/trans-decl.c: Adjust warning() callers. * java/class.c, java/decl.c, java/expr.c, java/jcf-io.c, java/jcf-parse.c, java/jv-scan.c, java/parse.y: Adjust warning() callers. * objc/objc-act.c: Adjust warning() callers. * treelang/parse.y: Adjust warning() callers. From-SVN: r98633
2005-04-23 23:29:07 +02:00
warning (0, "cannot find class %qs", IDENTIFIER_POINTER (class_ident));
else if (objc_is_class_name (alias_ident))
diagnostic.c (warning): Accept parameter to classify warning option. * diagnostic.c (warning): Accept parameter to classify warning option. (warning0): New, for when a pointer to an error() like function is needed. * errors.c (warning): Likewise. * errors.h (warning, warning0): Adjust prototypes. * toplev.h (warning, warning0): Likewise. * attribs.c, builtins.c, c-common.c, c-decl.c, c-format.c, c-gimplify.c, c-lex.c, c-objc-common.c, c-opts.c, c-parser.c, c-pragma.c, c-typeck.c, calls.c, cgraph.c, coverage.c, emit-rtl.c, fold-const.c, fortran/trans-decl.c, function.c, gcse.c, genautomata.c, haifa-sched.c, opts.c, passes.c, regclass.c, reload1.c, stmt.c, stor-layout.c, toplev.c, tree-cfg.c, tree-dump.c, tree-inline.c, tree-mudflap.c, tree-optimize.c, tree-ssa.c, tree.c, varasm.c: Adjust warning() callers. * config/alpha/alpha.c, config/arc/arc.c, config/arm/arm.c, config/avr/avr.c, config/bfin/bfin.c, config/c4x/c4x-c.c, config/c4x/c4x.c, config/cris/cris.c, config/darwin-c.c, config/darwin.c, config/darwin.h, config/h8300/h8300.c, config/i386/cygming.h, config/i386/djgpp.h, config/i386/i386.c, config/i386/winnt.c, config/ia64/ia64-c.c, config/ia64/ia64.c, config/ip2k/ip2k.c, config/m32r/m32r.c, config/m68hc11/m68hc11.c, config/m68k/m68k.c, config/mcore/mcore.c, config/mips/mips.c, config/mmix/mmix.c, config/ns32k/ns32k.c, config/pa/pa-hpux11.h, config/pa/pa.c, config/rs6000/aix43.h, config/rs6000/aix51.h, config/rs6000/aix52.h, config/rs6000/darwin.h, config/rs6000/rs6000-c.c, config/rs6000/rs6000.c, config/s390/s390.c, config/sh/sh.c, config/sh/sh.h, config/sh/symbian.c, config/sol2-c.c, config/sol2.c, config/stormy16/stormy16.c, config/v850/v850-c.c, config/v850/v850.c, config/xtensa/xtensa.c: Adjust warning() callers. * ada/misc.c: Adjust warning() callers. * cp/call.c, cp/class.c, cp/cvt.c, cp/decl.c, cp/decl2.c, cp/except.c, cp/friend.c, cp/init.c, cp/lex.c, cp/mangle.c, cp/method.c, cp/name-lookup.c, cp/parser.c, cp/repo.c, cp/rtti.c, cp/tree.c, cp/typeck.c, cp/typeck2.c: Adjust warning() callers. * fortran/trans-decl.c: Adjust warning() callers. * java/class.c, java/decl.c, java/expr.c, java/jcf-io.c, java/jcf-parse.c, java/jv-scan.c, java/parse.y: Adjust warning() callers. * objc/objc-act.c: Adjust warning() callers. * treelang/parse.y: Adjust warning() callers. From-SVN: r98633
2005-04-23 23:29:07 +02:00
warning (0, "class %qs already exists", IDENTIFIER_POINTER (alias_ident));
1992-01-18 00:15:38 +01:00
else
objc-act.c (objc_build_struct): New function. * objc-act.c (objc_build_struct): New function. (objc_derived_from_p): Likewise. (objc_build_component_ref): Likewise. (objc_copy_binfo): Likewise. (objc_xref_basetypes): Likewise. (objc_lookup_protocol): Likewise. (objc_compare_protocols): Likewise. (objc_volatilize_decl): Likewise. (encode_aggregate_fields): Likewise. (volatilized_hash): Likewise. (volatilized_eq): Likewise. (objc_compare_types): Likewise. (objc_type_quals_match): Likewise. (DERIVED_FROM_P): New ObjC macro, corresponding to C++ macro of same name. (get_class_ivars): Add second parameter indicating if entire hierarchy is desired. (struct volatilized_type): New type. (volatilized_htab): New hash table. (objc_types_compatible_p, objc_comptypes): Remove functions. (synth_module_prologue): Do not initialize 'unused_list'. (objc_get_class_reference): Fix ObjC++ impedance mismatches. (objc_declare_alias): Implement as a typedef. (objc_substitute_decl, objc_gimplify_expr): Reformat. (objc_get_class_ivars): Adjust call to get_class_ivars(). (next_sjlj_build_enter_and_setjmp, synth_forward_declarations, build_ivar_reference, get_super_receiver): Call objc_build_component_ref() instead of build_component_ref(). (objc_begin_catch_clause): Use DERIVED_FROM_P() instead of objc_comptypes(). (build_private_template): Call objc_build_struct() instead of start_struct() and finish_struct(). (hash_init): Initialize volatilized_htab. (objc_is_public): Adjust calls to objc_get_ivars(); adjust ObjC++ impedance mismatches. (encode_aggregate_within): Streamline by calling encode_aggregate_fields(). * objc-act.h (objc_types_compatible_p): Remove prototype. (OCTI_UNUSED_LIST, unused_list): Remove slot. * objc-lang.c (LANG_HOOKS_TYPES_COMPATIBLE_P): Remove. From-SVN: r100123
2005-05-25 00:21:01 +02:00
{
/* Implement @compatibility_alias as a typedef. */
#ifdef OBJCPLUS
push_lang_context (lang_name_c); /* extern "C" */
#endif
lang_hooks.decls.pushdecl (build_decl
(TYPE_DECL,
alias_ident,
xref_tag (RECORD_TYPE, underlying_class)));
#ifdef OBJCPLUS
pop_lang_context ();
#endif
alias_chain = tree_cons (underlying_class, alias_ident, alias_chain);
}
}
void
objc_declare_class (tree ident_list)
{
tree list;
#ifdef OBJCPLUS
if (current_namespace != global_namespace) {
error ("Objective-C declarations may only appear in global scope");
}
#endif /* OBJCPLUS */
for (list = ident_list; list; list = TREE_CHAIN (list))
{
tree ident = TREE_VALUE (list);
if (! objc_is_class_name (ident))
{
objc-act.c (build_private_template): Change to return 'void'... [gcc/objc/ChangeLog] 2004-12-15 Ziemowit Laski <zlaski@apple.com> * objc-act.c (build_private_template): Change to return 'void'; do not set ivar_context, uprivate_record or objc_instance_type. (objc_comptypes, gen_type_name_0): For types 'id' and 'Class', retrieve protocol list from the pointee rather than the pointer itself; check TYPE_HAS_OBJC_INFO(...) precondition before accessing TYPE_OBJC_PROTOCOL_LIST. (objc_get_protocol_qualified_type): For types 'id' and 'Class', construct a variant of the pointee as well as the pointer, and store protocol information in the former. When creating variants of RECORD_TYPEs, clone their TYPE_LANG_SPECIFIC fields and propagate TYPE_OBJC_INTERFACE information. (objc_declare_class): If a TYPE_DECL is looked up, retrieve the underlying RECORD_TYPE to check for presence of TYPE_OBJC_INTERFACE; for newly-created RECORD_TYPEs, create a tentative TYPE_OBJC_INTERFACE holding an IDENTIFIER_NODE. (objc_finish_message_expr): Check TYPE_HAS_OBJC_INFO(...) before accessing TYPE_OBJC_PROTOCOL_LIST; Use TYPE_OBJC_INTERFACE instead of calling lookup_interface(); allow for TYPE_OBJC_INTERFACE holding an IDENTIFIER_NODE (meaning a @class forward-declaration only). (objc_is_public): Check TYPE_OBJC_INTERFACE instead of calling lookup_interface(). (continue_class): For @implementations, set ivar_context, uprivate_record and objc_instance_type, for @interfaces, call build_private_template(). (encode_pointer): Check TYPE_HAS_OBJC_INFO(...) before accessing TYPE_OBJC_INTERFACE. (objc_types_are_equivalent): Check TYPE_HAS_OBJC_INFO(...) before accessing TYPE_OBJC_PROTOCOL_LIST. * objc-act.h (OBJC_INFO_SLOT_ELTS, TYPE_OBJC_INFO, INIT_TYPE_OBJC_INFO, DUP_TYPE_OBJC_INFO, ALLOC_OBJC_TYPE_LANG_SPECIFIC, SIZEOF_OBJC_TYPE_LANG_SPECIFIC): New macros. (TYPE_OBJC_INTERFACE): Replaces TREE_STATIC_INSTANCE and now points to an actual @interface; stored in TYPE_LANG_SPECIFIC(...). (TYPE_OBJC_PROTOCOL_LIST): Replaces TYPE_PROTOCOL_LIST; stored in TYPE_LANG_SPECIFIC(...). (TREE_STATIC_INSTANCE, TYPE_PROTOCOL_LIST): Delete. (IS_ID, IS_CLASS, IS_PROTOCOL_QUALIFIED_UNTYPED, IS_SUPER, TYPED_OBJECT): Check for POINTER_TYPE rather than POINTER_TYPE_P; adjust for use of TYPE_OBJC_INTERFACE and TYPE_OBJC_PROTOCOL_LIST instead of TREE_STATIC_INSTANCE and TYPE_PROTOCOL_LIST. From-SVN: r92239
2004-12-16 02:10:38 +01:00
tree record = lookup_name (ident), type = record;
if (record)
{
objc-act.c (build_private_template): Change to return 'void'... [gcc/objc/ChangeLog] 2004-12-15 Ziemowit Laski <zlaski@apple.com> * objc-act.c (build_private_template): Change to return 'void'; do not set ivar_context, uprivate_record or objc_instance_type. (objc_comptypes, gen_type_name_0): For types 'id' and 'Class', retrieve protocol list from the pointee rather than the pointer itself; check TYPE_HAS_OBJC_INFO(...) precondition before accessing TYPE_OBJC_PROTOCOL_LIST. (objc_get_protocol_qualified_type): For types 'id' and 'Class', construct a variant of the pointee as well as the pointer, and store protocol information in the former. When creating variants of RECORD_TYPEs, clone their TYPE_LANG_SPECIFIC fields and propagate TYPE_OBJC_INTERFACE information. (objc_declare_class): If a TYPE_DECL is looked up, retrieve the underlying RECORD_TYPE to check for presence of TYPE_OBJC_INTERFACE; for newly-created RECORD_TYPEs, create a tentative TYPE_OBJC_INTERFACE holding an IDENTIFIER_NODE. (objc_finish_message_expr): Check TYPE_HAS_OBJC_INFO(...) before accessing TYPE_OBJC_PROTOCOL_LIST; Use TYPE_OBJC_INTERFACE instead of calling lookup_interface(); allow for TYPE_OBJC_INTERFACE holding an IDENTIFIER_NODE (meaning a @class forward-declaration only). (objc_is_public): Check TYPE_OBJC_INTERFACE instead of calling lookup_interface(). (continue_class): For @implementations, set ivar_context, uprivate_record and objc_instance_type, for @interfaces, call build_private_template(). (encode_pointer): Check TYPE_HAS_OBJC_INFO(...) before accessing TYPE_OBJC_INTERFACE. (objc_types_are_equivalent): Check TYPE_HAS_OBJC_INFO(...) before accessing TYPE_OBJC_PROTOCOL_LIST. * objc-act.h (OBJC_INFO_SLOT_ELTS, TYPE_OBJC_INFO, INIT_TYPE_OBJC_INFO, DUP_TYPE_OBJC_INFO, ALLOC_OBJC_TYPE_LANG_SPECIFIC, SIZEOF_OBJC_TYPE_LANG_SPECIFIC): New macros. (TYPE_OBJC_INTERFACE): Replaces TREE_STATIC_INSTANCE and now points to an actual @interface; stored in TYPE_LANG_SPECIFIC(...). (TYPE_OBJC_PROTOCOL_LIST): Replaces TYPE_PROTOCOL_LIST; stored in TYPE_LANG_SPECIFIC(...). (TREE_STATIC_INSTANCE, TYPE_PROTOCOL_LIST): Delete. (IS_ID, IS_CLASS, IS_PROTOCOL_QUALIFIED_UNTYPED, IS_SUPER, TYPED_OBJECT): Check for POINTER_TYPE rather than POINTER_TYPE_P; adjust for use of TYPE_OBJC_INTERFACE and TYPE_OBJC_PROTOCOL_LIST instead of TREE_STATIC_INSTANCE and TYPE_PROTOCOL_LIST. From-SVN: r92239
2004-12-16 02:10:38 +01:00
if (TREE_CODE (record) == TYPE_DECL)
type = DECL_ORIGINAL_TYPE (record);
if (!TYPE_HAS_OBJC_INFO (type)
|| !TYPE_OBJC_INTERFACE (type))
{
error ("%qs redeclared as different kind of symbol",
IDENTIFIER_POINTER (ident));
toplev.c (default_tree_printer): Handle setting location with '+' flag. 2005-07-02 Zack Weinberg <zack@codesourcery.com> Joseph S. Myers <joseph@codesourcery.com> * toplev.c (default_tree_printer): Handle setting location with '+' flag. * c-objc.common.c (c_tree_printer): Likewise. * c-format.c (gcc_diag_flag_specs): Add '+'. (gcc_cdiag_char_table): Allow '+' flag for tree formats. (format_types_orig): Allow '+' flag for gcc_diag and gcc_cdiag formats. * c-common.c, c-decl.c, c-objc-common.c, c-pragma.c, config/arm/pe.c, config/i386/winnt.c, config/ia64/ia64.c, config/mcore/mcore.c, config/sh/symbian.c, config/sol2.c, config/v850/v850.c, function.c, stor-layout.c, toplev.c, tree-inline.c, tree-optimize.c, tree.c, varasm.c: Use '+' flag instead of %J or %H. Use 'q' flag for quoting. Avoid '.' at end of diagnostics. Use %q+D not %s for a decl. Do not pass excess format arguments where %J is used without %D. cp: * error.c (location_of): Add comment. (locate_error, cp_error_at, cp_warning_at, cp_pedwarn_at): Remove. * cp-tree.h (cp_error_at, cp_warning_at, cp_pedwarn_at): Remove. * call.c, class.c, decl.c, decl2.c, friend.c, init.c, name-lookup.c, parser.c, pt.c, search.c, semantics.c, typeck.c, typeck2.c: Use '+' flag instead of %J, cp_error_at, cp_warning_at or cp_pedwarn_at. Mark up some diagnostic strings with N_. java: * class.c, decl.c, expr.c: Use '+' flag instead of %J. Use 'q' flag for quoting. objc: * objc-act.c: Use '+' flag instead of %J. Use 'q' flag for quoting. testsuite: * gcc.dg/format/gcc_diag-1.c: Update. From-SVN: r101532
2005-07-02 12:55:32 +02:00
error ("previous declaration of %q+D",
record);
objc-act.c (build_private_template): Change to return 'void'... [gcc/objc/ChangeLog] 2004-12-15 Ziemowit Laski <zlaski@apple.com> * objc-act.c (build_private_template): Change to return 'void'; do not set ivar_context, uprivate_record or objc_instance_type. (objc_comptypes, gen_type_name_0): For types 'id' and 'Class', retrieve protocol list from the pointee rather than the pointer itself; check TYPE_HAS_OBJC_INFO(...) precondition before accessing TYPE_OBJC_PROTOCOL_LIST. (objc_get_protocol_qualified_type): For types 'id' and 'Class', construct a variant of the pointee as well as the pointer, and store protocol information in the former. When creating variants of RECORD_TYPEs, clone their TYPE_LANG_SPECIFIC fields and propagate TYPE_OBJC_INTERFACE information. (objc_declare_class): If a TYPE_DECL is looked up, retrieve the underlying RECORD_TYPE to check for presence of TYPE_OBJC_INTERFACE; for newly-created RECORD_TYPEs, create a tentative TYPE_OBJC_INTERFACE holding an IDENTIFIER_NODE. (objc_finish_message_expr): Check TYPE_HAS_OBJC_INFO(...) before accessing TYPE_OBJC_PROTOCOL_LIST; Use TYPE_OBJC_INTERFACE instead of calling lookup_interface(); allow for TYPE_OBJC_INTERFACE holding an IDENTIFIER_NODE (meaning a @class forward-declaration only). (objc_is_public): Check TYPE_OBJC_INTERFACE instead of calling lookup_interface(). (continue_class): For @implementations, set ivar_context, uprivate_record and objc_instance_type, for @interfaces, call build_private_template(). (encode_pointer): Check TYPE_HAS_OBJC_INFO(...) before accessing TYPE_OBJC_INTERFACE. (objc_types_are_equivalent): Check TYPE_HAS_OBJC_INFO(...) before accessing TYPE_OBJC_PROTOCOL_LIST. * objc-act.h (OBJC_INFO_SLOT_ELTS, TYPE_OBJC_INFO, INIT_TYPE_OBJC_INFO, DUP_TYPE_OBJC_INFO, ALLOC_OBJC_TYPE_LANG_SPECIFIC, SIZEOF_OBJC_TYPE_LANG_SPECIFIC): New macros. (TYPE_OBJC_INTERFACE): Replaces TREE_STATIC_INSTANCE and now points to an actual @interface; stored in TYPE_LANG_SPECIFIC(...). (TYPE_OBJC_PROTOCOL_LIST): Replaces TYPE_PROTOCOL_LIST; stored in TYPE_LANG_SPECIFIC(...). (TREE_STATIC_INSTANCE, TYPE_PROTOCOL_LIST): Delete. (IS_ID, IS_CLASS, IS_PROTOCOL_QUALIFIED_UNTYPED, IS_SUPER, TYPED_OBJECT): Check for POINTER_TYPE rather than POINTER_TYPE_P; adjust for use of TYPE_OBJC_INTERFACE and TYPE_OBJC_PROTOCOL_LIST instead of TREE_STATIC_INSTANCE and TYPE_PROTOCOL_LIST. From-SVN: r92239
2004-12-16 02:10:38 +01:00
}
}
record = xref_tag (RECORD_TYPE, ident);
objc-act.c (build_private_template): Change to return 'void'... [gcc/objc/ChangeLog] 2004-12-15 Ziemowit Laski <zlaski@apple.com> * objc-act.c (build_private_template): Change to return 'void'; do not set ivar_context, uprivate_record or objc_instance_type. (objc_comptypes, gen_type_name_0): For types 'id' and 'Class', retrieve protocol list from the pointee rather than the pointer itself; check TYPE_HAS_OBJC_INFO(...) precondition before accessing TYPE_OBJC_PROTOCOL_LIST. (objc_get_protocol_qualified_type): For types 'id' and 'Class', construct a variant of the pointee as well as the pointer, and store protocol information in the former. When creating variants of RECORD_TYPEs, clone their TYPE_LANG_SPECIFIC fields and propagate TYPE_OBJC_INTERFACE information. (objc_declare_class): If a TYPE_DECL is looked up, retrieve the underlying RECORD_TYPE to check for presence of TYPE_OBJC_INTERFACE; for newly-created RECORD_TYPEs, create a tentative TYPE_OBJC_INTERFACE holding an IDENTIFIER_NODE. (objc_finish_message_expr): Check TYPE_HAS_OBJC_INFO(...) before accessing TYPE_OBJC_PROTOCOL_LIST; Use TYPE_OBJC_INTERFACE instead of calling lookup_interface(); allow for TYPE_OBJC_INTERFACE holding an IDENTIFIER_NODE (meaning a @class forward-declaration only). (objc_is_public): Check TYPE_OBJC_INTERFACE instead of calling lookup_interface(). (continue_class): For @implementations, set ivar_context, uprivate_record and objc_instance_type, for @interfaces, call build_private_template(). (encode_pointer): Check TYPE_HAS_OBJC_INFO(...) before accessing TYPE_OBJC_INTERFACE. (objc_types_are_equivalent): Check TYPE_HAS_OBJC_INFO(...) before accessing TYPE_OBJC_PROTOCOL_LIST. * objc-act.h (OBJC_INFO_SLOT_ELTS, TYPE_OBJC_INFO, INIT_TYPE_OBJC_INFO, DUP_TYPE_OBJC_INFO, ALLOC_OBJC_TYPE_LANG_SPECIFIC, SIZEOF_OBJC_TYPE_LANG_SPECIFIC): New macros. (TYPE_OBJC_INTERFACE): Replaces TREE_STATIC_INSTANCE and now points to an actual @interface; stored in TYPE_LANG_SPECIFIC(...). (TYPE_OBJC_PROTOCOL_LIST): Replaces TYPE_PROTOCOL_LIST; stored in TYPE_LANG_SPECIFIC(...). (TREE_STATIC_INSTANCE, TYPE_PROTOCOL_LIST): Delete. (IS_ID, IS_CLASS, IS_PROTOCOL_QUALIFIED_UNTYPED, IS_SUPER, TYPED_OBJECT): Check for POINTER_TYPE rather than POINTER_TYPE_P; adjust for use of TYPE_OBJC_INTERFACE and TYPE_OBJC_PROTOCOL_LIST instead of TREE_STATIC_INSTANCE and TYPE_PROTOCOL_LIST. From-SVN: r92239
2004-12-16 02:10:38 +01:00
INIT_TYPE_OBJC_INFO (record);
TYPE_OBJC_INTERFACE (record) = ident;
class_chain = tree_cons (NULL_TREE, ident, class_chain);
}
}
1992-01-18 00:15:38 +01:00
}
tree
objc_is_class_name (tree ident)
1992-01-18 00:15:38 +01:00
{
tree chain;
if (ident && TREE_CODE (ident) == IDENTIFIER_NODE
&& identifier_global_value (ident))
ident = identifier_global_value (ident);
while (ident && TREE_CODE (ident) == TYPE_DECL && DECL_ORIGINAL_TYPE (ident))
Makefile.in (c-parse.o): Depend on $(C_COMMON_H). [gcc/ChangeLog] 2004-09-07 Ziemowit Laski <zlaski@apple.com> * Makefile.in (c-parse.o): Depend on $(C_COMMON_H). * c-parse.in: Include c-common.h instead of objc-act.h. (ivar_decl_list, ivar_decls, ivar_decl, ivars, ivar_declarator, myparms, myparm): Remove %type declarations. (methodtype, optparms, OBJC_TYPE_QUAL, objc_quals, objc_qual, objc_typename, objc_try_catch_stmt, optellipsis): Add %type declarations. (objc_inherit_code, objc_public_flag): Remove. (typespec_nonreserved_nonattr): Call objc_get_protocol_qualified_type() instead of get_static_reference() and get_protocol_reference(). (stmt_nocomp): Call grokparm() on @catch parameter. (objcdef): Move semantic action to objc_finish_implementation(). (classdef): Move semantic action to objc_start_class_interface(), objc_continue_interface(), objc_finish_interface(), objc_start_class_implementation(), objc_continue_implementation(), objc_start_category_interface() and objc_start_category_implementation(). (protocoldef): Move semantic actions to objc_start_protocol() and objc_finish_interface(). (ivar_decl_list): Remove nonterminal. (visibility_spec): Move semantic actions to objc_set_visibility(). (ivar_decls): Remove assignment to $$. (ivar_decl): Rephrase in terms of component_decl; call objc_add_instance_variable(). (ivars, ivar_declarator): Remove nonterminals. (opt_semi): New nonterminal. (methodtype): Remove semantic actions. (methoddef): Move semantic actions to objc_set_method_type(), objc_start_method_definition() and objc_finish_method_definition(). (methodproto): Move semantic actions to objc_set_method_type() and objc_add_method_declaration(). (methoddecl): Use objc_typename instead of typename; move semantic actions to objc_build_method_signature(). (optarglist, myxdecls, mydecl, myparms, myparm): Remove nonterminals. (optparmlist): Express in terms of optparms and optellipsis. (optparms, optellipsis, objc_qual, objc_quals, objc_typename): New nonterminals. (keyworddecl): Use objc_typename instead of typename. (rid_to_yy): Mark RID_IN, RID_OUT, RID_INOUT, RID_BYCOPY, RID_BYREF and RID_ONEWAY as returning OBJC_TYPE_QUAL to yyparse(). [gcc/objc/ChangeLog] 2004-09-07 Ziemowit Laski <zlaski@apple.com> * Make-lang.in (objc/objc-parse.o): Depend on $(C_COMMON_H) instead of objc/objc-act.h. (objc/objc-act.o): Depend on $(HASHTAB_H). * objc-act.c: Include hashtab.h; in ObjC++ mode, include cp-tree.h and objcp-decl.h instead of c-tree.h. (build_module_descriptor, get_class_ivars, synth_id_with_class_suffix, error_with_ivar, gen_method_decl, gen_declaration, setup_string_decl, build_protocol_template): Adjust prototypes. (build_module_initializer_routine, start_class, continue_class, finish_class, start_method_def, objc_start_function, start_protocol, build_method_decl, objc_add_method, add_instance_variable, build_ivar_reference, is_ivar, is_private, get_super_receiver, build_selector_table_decl, objc_push_parm, objc_get_parm_info, gen_type_name, gen_type_name_0, start_var_decl, finish_var_decl, create_field_decl): New prototypes. (objc_expand_function_end, comp_method_with_proto, objc_expr_last, gen_declaration_1, gen_declarator, is_complex_decl, adorn_decl, define_decl, create_builtin_decl, gen_declspecs): Remove prototypes. (TYPE_ID): Rename to OBJECT_TYPEDEF_NAME. (CLASS_TYPEDEF_NAME): New. (TAG_EXECCLASS): Change from a global variable to a #define. (TAG_RETURN_STRUCT): Delete. (TAG_GNUINIT): New, holds '__objc_gnu_init' name. (objc_inherit_code, objc_public_flag): New, moved from c-parse.in. (string_descriptor): New struct. (string_htab): New hash table. (string_hash, string_eq): New prototypes. (generate_struct_by_value_array): Call create_field_decl() instead of create_builtin_decl(). (objc_init): Do not initialize objc_ellipsis_node or TAG_EXECCLASS; In ObjC++ mode, call cxx_init() instead of c_objc_common_init(). (objc_finish_file): In ObjC++, call instantiate_pending_templates() and cp_finish_file(). (define_decl, get_static_reference, get_protocol_reference, create_builtin_decl): Remove functions. (objc_start_class_interface, objc_start_category_interface, objc_start_protocol, objc_continue_interface, objc_finish_interface, objc_start_class_implementation, objc_start_category_implementation, objc_continue_implementation, objc_finish_implementation, objc_set_visibility, objc_set_method_type, objc_build_method_signature, objc_add_method_declaration, objc_start_method_definition, objc_add_instance_variable, objc_get_protocol_qualified_type, create_field_decl, start_var_decl, finish_var_decl): New functions. (setup_string_decl): Simplify since it is only called once. (synth_module_prologue): Call build_class_template(); predefine 'id' and 'Class' as typedefs; rename 'temp_type' to 'type'; disable debug hooks for duration of function; fix GNU runtime messenger signatures to correspond to reality; forward-declare '__objc_exec_class' for the GNU runtime; call build_selector_table_decl(); in ObjC++ mode, generate 'extern "C" { ... }' wrappers around synthesized declarations; call build_protocol_template() and build_category_template(). (string_hash, string_eq): New functions. (objc_build_string_object): Check metaclass correctness only once; store string literals in hash table. (objc_build_constructor): Do not convert initializer elements; adjust for ObjC++ impedance mismatch. (build_objc_symtab_template): Call create_field_decl() instead of create_builtin_decl(). (init_objc_symtab): Add missing conversion to initializer element. (build_metadata_decl): Call start_var_decl() instead of define_decl(). (generate_objc_symtab_decl): Do not call build_category_template(); call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(). (build_module_descriptor): Call create_field_decl() instead of grokfield(); call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(); always mark module descriptor as used; move GNU runtime-specific functionality to build_module_initializer_routine(). (build_module_initializer_routine): New function, broken off of build_module_descriptor(). (objc_static_init_needed_p, objc_generate_static_init_call): New functions. (generate_static_references, generate_strings, build_selector_translation_table, generate_descriptor_table, generate_ivars_list, generate_dispatch_table, generate_category): Call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(); build a type directly instead of via groktypename(). (build_selector_reference_decl, build_selector_table_decl, build_class_reference_decl, build_protocol_reference, generate_objc_image_info): Call start_var_decl() instead of build_decl(). (build_selector_reference): For GNU runtime, do not call build_selector_reference_decl(). (build_selector, build_typed_selector_reference): Always convert result to the selector type. (add_objc_string): Cast return value to 'char *'. (build_method_prototype_template, build_selector_template, build_method_template): Use actual selector type for fields pointing to selectors. (finish_objc): For GNU runtime, call build_module_initializer_routine() after build_module_descriptor(). (generate_protocol_list, generate_shared_structures): Call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(); build a type directly instead of via groktypename(). (synth_id_with_class_suffix): Return a string. (get_arg_type_list): For instance methods, use the instance type for 'self'; do not call groktypename_in_parm_context(). (build_objc_string_decl): Squash redeclaration errors in ObjC++. (objc_is_class_name): Use OBJC_TYPE_NAME instead of TYPE_NAME; handle RECORD_TYPEs in ObjC as well as ObjC++. (objc_is_id): New function. (objc_is_object_ptr): Return the canonical type node. (objc_get_class_ivars): Simplify using get_class_ivars(). (get_class_ivars): Remove second parameter; create a fresh copy of the ivar list for each call; do not check for existence of super class. (objc_eh_runtime_type): Mark #ifndef OBJCPLUS. (objc_init_exceptions): When using SJLJ-style exceptions, require the use of '-fobjc-exceptions' flag; do not require it for DWARF-style exceptions. (objc_build_exc_ptr, next_sjlj_build_try_catch_finally): Use objc_object_type instead of objc_id_type. (objc_begin_catch_clause): Convert the incoming PARM_DECL into a VAR_DECL before placing it in the appropriate scope; do not call define_decl(); adjust call to c_begin_compound_stmt(); use objc_object_type instead of objc_id_type. (build_next_objc_exception_stuff): Call create_field_decl() instead of create_builtin_decl(); construct type directly instead of calling groktypename(); use OBJC_VOID_AT_END to mark end of function parameters. (build_private_template): Adjust call to get_class_ivars(); build a type directly instead of via groktypename(). (build_protocol_template, build_method_prototype_list_template, build_method_prototype_template, build_category_template, build_selector_template, build_class_template, build_super_template, build_ivar_template, build_ivar_list_template, build_method_list_template, build_method_template): Call create_field_decl() instead of grokfield(). (objc_method_parm_type): Do not call groktypename(). (generate_descriptor_table): Call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(). (generate_method_descriptors, build_protocol_initializer, generate_dispatch_tables, build_category_initializer, build_shared_structure_initializer): Do not call groktypename(). (generate_protocols): Call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(); do not call groktypename(). (error_with_ivar): Remove last parameter. (check_ivars): Do not iterate ovar CLASS_RAW_IVARS lists in addition to CLASS_IVARS lists; adjust calls to error_with_ivar(). (generate_ivar_lists): Convert one of the initializer elements; do not call groktypename(). (get_arg_type_list, start_method_def, gen_method_def): Account for new representation of variable arguments and '...' in Objective-C methods; add Objective-C++ impedance matching code. (is_objc_type_qualifier): Remove function. (adjust_type_for_id_default): Simplify; there is no longer a need to wade through declspecs. (lookup_interface, start_class, continue_class, finish_class, start_method_def, start_protocol, build_method_decl, objc_add_method, add_instance_variable, build_ivar_reference, is_ivar, is_private, get_super_receiver, objc_build_finally_epilogue): Make into static functions. (receiver_is_class_object): Use new IS_CLASS() macro. (objc_build_message_expr): Tweak ObjC++ message argument handling; call objc_finish_message_expr() instead of finish_message_expr(). (finish_message_expr): Rename to objc_finish_message_expr(); use OBJC_TYPE_NAME and OBJC_SET_TYPE_NAME macros instead of TYPE_NAME. call gen_type_name() instead of gen_declaration(); call objc_is_id() instead of using IS_ID and IS_CLASS; Use objc_class_name instead of calling get_identifier("Class"); handle CONVERT_EXPRs in receiver. (build_objc_method_call, warn_with_method): Do not call groktypename(). (build_ivar_reference): Call convert() instead of clobbering in a type. (hash_init): Initialize string_htab hash table. (add_instance_variable): Simplify parameter list; do not call grokfield(); do not populate CLASS_IVARS list. (start_class): Check for the existence of super class, if one was specified. (continue_class): Use CLASS_RAW_IVARS rather than CLASS_IVARS; do not call build_class_template(); adjust call to get_class_ivars(); call build_decl(), pushdecl() and finish_decl() instead of define_decl(). (finish_class): Call build_decl(), pushdecl() and finish_decl() instead of define_decl(). (add_protocols): Use PROTOCOL_BINFO_ELTS for the tree vector size. (start_protocol): Do not call build_protocol_template(); use PROTOCOL_BINFO_ELTS for the tree vector size. (encode_type_qualifiers): Do not handle the 'const' qualifier here. (encode_pointer): Encode 'const char *' as 'r*', for backwards compatibility. (encode_array): Use HOST_WIDE_INT_PRINT_DEC instead of "%ld". (encode_type): Handle the 'const' qualifier here. (objc_parmlist): New global variable, sued by objc_push_parm and objc_get_parm_info(). (objc_push_parm, objc_get_parm_info): New functions. (objc_expr_last): Remove function. (synth_self_and_ucmd_args): For instance methods, use the instance type for 'self'; call objc_push_parm() instead of push_parm_decl(). (start_method_def): Do not call push_scope(), declare_parm_level(), pop_scope(), push_parm_decl(), store_parm_decls() or objc_expr_last(); just use objc_push_parm() and objc_get_parm_info(). (comp_method_with_proto): Remove function. (objc_types_are_equivalent): Strip away indirections before comparing underlying types. (comp_proto_with_proto): Do not call groktypename(); types are no longer in raw declspec format. (objc_start_function): New function. (really_start_method): Call comp_proto_with_proto() instead of comp_method_with_proto(); call objc_start_function() instead of hand-crafting a function declarator. (continue_method_def, objc_expand_function_end): Remove functions. (get_super_receiver): Call objc_get_current_scope() instead of get_current_scope(); reference 'super_class' field (instead of 'class'). (finish_method_def): Rename to objc_finish_method_definition() and add a function decl parameter; move method encoding call from objc_expand_function_end(). (is_complex_decl, adorn_decl, gen_declarator, gen_declspecs, gen_declaration_1): Remove functions. (tmpbuf, RAW_DECLSPEC): Remove. (gen_declaration): Remove second parameter; simplify to deal with TYPE_P nodes instead of raw declspecs. (gen_type_name, gen_type_name_0): New functions. (gen_method_decl): Remove second parameter; call gen_type_name() instead of gen_declaration_1(). (dump_interface): Adjust calls to gen_declaration() and gen_method_decl(); do not allocate a separate string buffer. (init_objc): Allocate a larger string buffer to accommodate dump_interface(); adjust call to build_module_descriptor(); add call to build_module_initializer_routine() for the GNU runtime. (generate_classref_translation_entry): Do not call start_decl(); call finish_var_decl() instead of finish_decl(); call convert() instead of build_c_cast(). * objc-act.h (CLASS_OWN_IVARS): Remove accessor. (CLASS_BINFO_ELTS): Reduce from 6 to 5, now that CLASS_OWN_IVARS is gone. (OCTI_GNU_INIT_DECL, GNU_INIT_decl): New. (OCTI_ELLIPSIS_NODE, objc_ellipsis_node): Remove. (OCTI_ID_ID, id_type, objc_id_id): Rename to OCTI_ID_NAME, objc_object_type and objc_object_name, respectively. (OCTI_CLS_REF, OCTI_CLASS_NAME, objc_class_reference, objc_class_name): New. (IS_CLASS): New macro. (IS_ID, IS_SUPER): Robustify. (OCTI_EXECCLASS_DECL, execclass_decl): New. (finish_file, start_class, continue_class, finish_class, start_method_def, continue_method_def, finish_method_def, start_protocol, finish_protocol, objc_build_throw_stmt, objc_build_try_catch_finally_stmt, objc_build_synchronized_prologue, objc_build_synchronized_epilogue, objc_build_try_prologue, objc_build_try_epilogue, objc_build_catch_stmt, objc_build_catch_epilogue, objc_build_finally_prologue, objc_build_finally_epilogue, is_ivar, is_private, is_public, add_instance_variable, objc_add_method, get_super_receiver, objc_clear_super_receiver, get_class_ivars_from_name, get_class_reference, get_static_reference, get_object_reference, build_message_expr, finish_message_expr, build_selector_expr, build_ivar_reference, build_keyword_decl, build_method_decl, build_protocol_expr, build_objc_string_object, objc_declare_alias, objc_declare_class, objc_declare_protocols, objc_comptypes, objc_check_decl, build_encode_expr): Remove prototypes. (imp_count, cat_count): Make GGC-aware. (OBJC_SET_TYPE_NAME): New macro. From-SVN: r87168
2004-09-08 02:49:44 +02:00
ident = OBJC_TYPE_NAME (DECL_ORIGINAL_TYPE (ident));
if (ident && TREE_CODE (ident) == RECORD_TYPE)
Makefile.in (c-parse.o): Depend on $(C_COMMON_H). [gcc/ChangeLog] 2004-09-07 Ziemowit Laski <zlaski@apple.com> * Makefile.in (c-parse.o): Depend on $(C_COMMON_H). * c-parse.in: Include c-common.h instead of objc-act.h. (ivar_decl_list, ivar_decls, ivar_decl, ivars, ivar_declarator, myparms, myparm): Remove %type declarations. (methodtype, optparms, OBJC_TYPE_QUAL, objc_quals, objc_qual, objc_typename, objc_try_catch_stmt, optellipsis): Add %type declarations. (objc_inherit_code, objc_public_flag): Remove. (typespec_nonreserved_nonattr): Call objc_get_protocol_qualified_type() instead of get_static_reference() and get_protocol_reference(). (stmt_nocomp): Call grokparm() on @catch parameter. (objcdef): Move semantic action to objc_finish_implementation(). (classdef): Move semantic action to objc_start_class_interface(), objc_continue_interface(), objc_finish_interface(), objc_start_class_implementation(), objc_continue_implementation(), objc_start_category_interface() and objc_start_category_implementation(). (protocoldef): Move semantic actions to objc_start_protocol() and objc_finish_interface(). (ivar_decl_list): Remove nonterminal. (visibility_spec): Move semantic actions to objc_set_visibility(). (ivar_decls): Remove assignment to $$. (ivar_decl): Rephrase in terms of component_decl; call objc_add_instance_variable(). (ivars, ivar_declarator): Remove nonterminals. (opt_semi): New nonterminal. (methodtype): Remove semantic actions. (methoddef): Move semantic actions to objc_set_method_type(), objc_start_method_definition() and objc_finish_method_definition(). (methodproto): Move semantic actions to objc_set_method_type() and objc_add_method_declaration(). (methoddecl): Use objc_typename instead of typename; move semantic actions to objc_build_method_signature(). (optarglist, myxdecls, mydecl, myparms, myparm): Remove nonterminals. (optparmlist): Express in terms of optparms and optellipsis. (optparms, optellipsis, objc_qual, objc_quals, objc_typename): New nonterminals. (keyworddecl): Use objc_typename instead of typename. (rid_to_yy): Mark RID_IN, RID_OUT, RID_INOUT, RID_BYCOPY, RID_BYREF and RID_ONEWAY as returning OBJC_TYPE_QUAL to yyparse(). [gcc/objc/ChangeLog] 2004-09-07 Ziemowit Laski <zlaski@apple.com> * Make-lang.in (objc/objc-parse.o): Depend on $(C_COMMON_H) instead of objc/objc-act.h. (objc/objc-act.o): Depend on $(HASHTAB_H). * objc-act.c: Include hashtab.h; in ObjC++ mode, include cp-tree.h and objcp-decl.h instead of c-tree.h. (build_module_descriptor, get_class_ivars, synth_id_with_class_suffix, error_with_ivar, gen_method_decl, gen_declaration, setup_string_decl, build_protocol_template): Adjust prototypes. (build_module_initializer_routine, start_class, continue_class, finish_class, start_method_def, objc_start_function, start_protocol, build_method_decl, objc_add_method, add_instance_variable, build_ivar_reference, is_ivar, is_private, get_super_receiver, build_selector_table_decl, objc_push_parm, objc_get_parm_info, gen_type_name, gen_type_name_0, start_var_decl, finish_var_decl, create_field_decl): New prototypes. (objc_expand_function_end, comp_method_with_proto, objc_expr_last, gen_declaration_1, gen_declarator, is_complex_decl, adorn_decl, define_decl, create_builtin_decl, gen_declspecs): Remove prototypes. (TYPE_ID): Rename to OBJECT_TYPEDEF_NAME. (CLASS_TYPEDEF_NAME): New. (TAG_EXECCLASS): Change from a global variable to a #define. (TAG_RETURN_STRUCT): Delete. (TAG_GNUINIT): New, holds '__objc_gnu_init' name. (objc_inherit_code, objc_public_flag): New, moved from c-parse.in. (string_descriptor): New struct. (string_htab): New hash table. (string_hash, string_eq): New prototypes. (generate_struct_by_value_array): Call create_field_decl() instead of create_builtin_decl(). (objc_init): Do not initialize objc_ellipsis_node or TAG_EXECCLASS; In ObjC++ mode, call cxx_init() instead of c_objc_common_init(). (objc_finish_file): In ObjC++, call instantiate_pending_templates() and cp_finish_file(). (define_decl, get_static_reference, get_protocol_reference, create_builtin_decl): Remove functions. (objc_start_class_interface, objc_start_category_interface, objc_start_protocol, objc_continue_interface, objc_finish_interface, objc_start_class_implementation, objc_start_category_implementation, objc_continue_implementation, objc_finish_implementation, objc_set_visibility, objc_set_method_type, objc_build_method_signature, objc_add_method_declaration, objc_start_method_definition, objc_add_instance_variable, objc_get_protocol_qualified_type, create_field_decl, start_var_decl, finish_var_decl): New functions. (setup_string_decl): Simplify since it is only called once. (synth_module_prologue): Call build_class_template(); predefine 'id' and 'Class' as typedefs; rename 'temp_type' to 'type'; disable debug hooks for duration of function; fix GNU runtime messenger signatures to correspond to reality; forward-declare '__objc_exec_class' for the GNU runtime; call build_selector_table_decl(); in ObjC++ mode, generate 'extern "C" { ... }' wrappers around synthesized declarations; call build_protocol_template() and build_category_template(). (string_hash, string_eq): New functions. (objc_build_string_object): Check metaclass correctness only once; store string literals in hash table. (objc_build_constructor): Do not convert initializer elements; adjust for ObjC++ impedance mismatch. (build_objc_symtab_template): Call create_field_decl() instead of create_builtin_decl(). (init_objc_symtab): Add missing conversion to initializer element. (build_metadata_decl): Call start_var_decl() instead of define_decl(). (generate_objc_symtab_decl): Do not call build_category_template(); call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(). (build_module_descriptor): Call create_field_decl() instead of grokfield(); call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(); always mark module descriptor as used; move GNU runtime-specific functionality to build_module_initializer_routine(). (build_module_initializer_routine): New function, broken off of build_module_descriptor(). (objc_static_init_needed_p, objc_generate_static_init_call): New functions. (generate_static_references, generate_strings, build_selector_translation_table, generate_descriptor_table, generate_ivars_list, generate_dispatch_table, generate_category): Call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(); build a type directly instead of via groktypename(). (build_selector_reference_decl, build_selector_table_decl, build_class_reference_decl, build_protocol_reference, generate_objc_image_info): Call start_var_decl() instead of build_decl(). (build_selector_reference): For GNU runtime, do not call build_selector_reference_decl(). (build_selector, build_typed_selector_reference): Always convert result to the selector type. (add_objc_string): Cast return value to 'char *'. (build_method_prototype_template, build_selector_template, build_method_template): Use actual selector type for fields pointing to selectors. (finish_objc): For GNU runtime, call build_module_initializer_routine() after build_module_descriptor(). (generate_protocol_list, generate_shared_structures): Call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(); build a type directly instead of via groktypename(). (synth_id_with_class_suffix): Return a string. (get_arg_type_list): For instance methods, use the instance type for 'self'; do not call groktypename_in_parm_context(). (build_objc_string_decl): Squash redeclaration errors in ObjC++. (objc_is_class_name): Use OBJC_TYPE_NAME instead of TYPE_NAME; handle RECORD_TYPEs in ObjC as well as ObjC++. (objc_is_id): New function. (objc_is_object_ptr): Return the canonical type node. (objc_get_class_ivars): Simplify using get_class_ivars(). (get_class_ivars): Remove second parameter; create a fresh copy of the ivar list for each call; do not check for existence of super class. (objc_eh_runtime_type): Mark #ifndef OBJCPLUS. (objc_init_exceptions): When using SJLJ-style exceptions, require the use of '-fobjc-exceptions' flag; do not require it for DWARF-style exceptions. (objc_build_exc_ptr, next_sjlj_build_try_catch_finally): Use objc_object_type instead of objc_id_type. (objc_begin_catch_clause): Convert the incoming PARM_DECL into a VAR_DECL before placing it in the appropriate scope; do not call define_decl(); adjust call to c_begin_compound_stmt(); use objc_object_type instead of objc_id_type. (build_next_objc_exception_stuff): Call create_field_decl() instead of create_builtin_decl(); construct type directly instead of calling groktypename(); use OBJC_VOID_AT_END to mark end of function parameters. (build_private_template): Adjust call to get_class_ivars(); build a type directly instead of via groktypename(). (build_protocol_template, build_method_prototype_list_template, build_method_prototype_template, build_category_template, build_selector_template, build_class_template, build_super_template, build_ivar_template, build_ivar_list_template, build_method_list_template, build_method_template): Call create_field_decl() instead of grokfield(). (objc_method_parm_type): Do not call groktypename(). (generate_descriptor_table): Call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(). (generate_method_descriptors, build_protocol_initializer, generate_dispatch_tables, build_category_initializer, build_shared_structure_initializer): Do not call groktypename(). (generate_protocols): Call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(); do not call groktypename(). (error_with_ivar): Remove last parameter. (check_ivars): Do not iterate ovar CLASS_RAW_IVARS lists in addition to CLASS_IVARS lists; adjust calls to error_with_ivar(). (generate_ivar_lists): Convert one of the initializer elements; do not call groktypename(). (get_arg_type_list, start_method_def, gen_method_def): Account for new representation of variable arguments and '...' in Objective-C methods; add Objective-C++ impedance matching code. (is_objc_type_qualifier): Remove function. (adjust_type_for_id_default): Simplify; there is no longer a need to wade through declspecs. (lookup_interface, start_class, continue_class, finish_class, start_method_def, start_protocol, build_method_decl, objc_add_method, add_instance_variable, build_ivar_reference, is_ivar, is_private, get_super_receiver, objc_build_finally_epilogue): Make into static functions. (receiver_is_class_object): Use new IS_CLASS() macro. (objc_build_message_expr): Tweak ObjC++ message argument handling; call objc_finish_message_expr() instead of finish_message_expr(). (finish_message_expr): Rename to objc_finish_message_expr(); use OBJC_TYPE_NAME and OBJC_SET_TYPE_NAME macros instead of TYPE_NAME. call gen_type_name() instead of gen_declaration(); call objc_is_id() instead of using IS_ID and IS_CLASS; Use objc_class_name instead of calling get_identifier("Class"); handle CONVERT_EXPRs in receiver. (build_objc_method_call, warn_with_method): Do not call groktypename(). (build_ivar_reference): Call convert() instead of clobbering in a type. (hash_init): Initialize string_htab hash table. (add_instance_variable): Simplify parameter list; do not call grokfield(); do not populate CLASS_IVARS list. (start_class): Check for the existence of super class, if one was specified. (continue_class): Use CLASS_RAW_IVARS rather than CLASS_IVARS; do not call build_class_template(); adjust call to get_class_ivars(); call build_decl(), pushdecl() and finish_decl() instead of define_decl(). (finish_class): Call build_decl(), pushdecl() and finish_decl() instead of define_decl(). (add_protocols): Use PROTOCOL_BINFO_ELTS for the tree vector size. (start_protocol): Do not call build_protocol_template(); use PROTOCOL_BINFO_ELTS for the tree vector size. (encode_type_qualifiers): Do not handle the 'const' qualifier here. (encode_pointer): Encode 'const char *' as 'r*', for backwards compatibility. (encode_array): Use HOST_WIDE_INT_PRINT_DEC instead of "%ld". (encode_type): Handle the 'const' qualifier here. (objc_parmlist): New global variable, sued by objc_push_parm and objc_get_parm_info(). (objc_push_parm, objc_get_parm_info): New functions. (objc_expr_last): Remove function. (synth_self_and_ucmd_args): For instance methods, use the instance type for 'self'; call objc_push_parm() instead of push_parm_decl(). (start_method_def): Do not call push_scope(), declare_parm_level(), pop_scope(), push_parm_decl(), store_parm_decls() or objc_expr_last(); just use objc_push_parm() and objc_get_parm_info(). (comp_method_with_proto): Remove function. (objc_types_are_equivalent): Strip away indirections before comparing underlying types. (comp_proto_with_proto): Do not call groktypename(); types are no longer in raw declspec format. (objc_start_function): New function. (really_start_method): Call comp_proto_with_proto() instead of comp_method_with_proto(); call objc_start_function() instead of hand-crafting a function declarator. (continue_method_def, objc_expand_function_end): Remove functions. (get_super_receiver): Call objc_get_current_scope() instead of get_current_scope(); reference 'super_class' field (instead of 'class'). (finish_method_def): Rename to objc_finish_method_definition() and add a function decl parameter; move method encoding call from objc_expand_function_end(). (is_complex_decl, adorn_decl, gen_declarator, gen_declspecs, gen_declaration_1): Remove functions. (tmpbuf, RAW_DECLSPEC): Remove. (gen_declaration): Remove second parameter; simplify to deal with TYPE_P nodes instead of raw declspecs. (gen_type_name, gen_type_name_0): New functions. (gen_method_decl): Remove second parameter; call gen_type_name() instead of gen_declaration_1(). (dump_interface): Adjust calls to gen_declaration() and gen_method_decl(); do not allocate a separate string buffer. (init_objc): Allocate a larger string buffer to accommodate dump_interface(); adjust call to build_module_descriptor(); add call to build_module_initializer_routine() for the GNU runtime. (generate_classref_translation_entry): Do not call start_decl(); call finish_var_decl() instead of finish_decl(); call convert() instead of build_c_cast(). * objc-act.h (CLASS_OWN_IVARS): Remove accessor. (CLASS_BINFO_ELTS): Reduce from 6 to 5, now that CLASS_OWN_IVARS is gone. (OCTI_GNU_INIT_DECL, GNU_INIT_decl): New. (OCTI_ELLIPSIS_NODE, objc_ellipsis_node): Remove. (OCTI_ID_ID, id_type, objc_id_id): Rename to OCTI_ID_NAME, objc_object_type and objc_object_name, respectively. (OCTI_CLS_REF, OCTI_CLASS_NAME, objc_class_reference, objc_class_name): New. (IS_CLASS): New macro. (IS_ID, IS_SUPER): Robustify. (OCTI_EXECCLASS_DECL, execclass_decl): New. (finish_file, start_class, continue_class, finish_class, start_method_def, continue_method_def, finish_method_def, start_protocol, finish_protocol, objc_build_throw_stmt, objc_build_try_catch_finally_stmt, objc_build_synchronized_prologue, objc_build_synchronized_epilogue, objc_build_try_prologue, objc_build_try_epilogue, objc_build_catch_stmt, objc_build_catch_epilogue, objc_build_finally_prologue, objc_build_finally_epilogue, is_ivar, is_private, is_public, add_instance_variable, objc_add_method, get_super_receiver, objc_clear_super_receiver, get_class_ivars_from_name, get_class_reference, get_static_reference, get_object_reference, build_message_expr, finish_message_expr, build_selector_expr, build_ivar_reference, build_keyword_decl, build_method_decl, build_protocol_expr, build_objc_string_object, objc_declare_alias, objc_declare_class, objc_declare_protocols, objc_comptypes, objc_check_decl, build_encode_expr): Remove prototypes. (imp_count, cat_count): Make GGC-aware. (OBJC_SET_TYPE_NAME): New macro. From-SVN: r87168
2004-09-08 02:49:44 +02:00
ident = OBJC_TYPE_NAME (ident);
#ifdef OBJCPLUS
if (ident && TREE_CODE (ident) == TYPE_DECL)
ident = DECL_NAME (ident);
#endif
if (!ident || TREE_CODE (ident) != IDENTIFIER_NODE)
return NULL_TREE;
if (lookup_interface (ident))
return ident;
1992-01-18 00:15:38 +01:00
for (chain = class_chain; chain; chain = TREE_CHAIN (chain))
{
if (ident == TREE_VALUE (chain))
return ident;
}
1992-01-18 00:15:38 +01:00
for (chain = alias_chain; chain; chain = TREE_CHAIN (chain))
{
if (ident == TREE_VALUE (chain))
return TREE_PURPOSE (chain);
1992-01-18 00:15:38 +01:00
}
return 0;
}
Makefile.in (c-parse.o): Depend on $(C_COMMON_H). [gcc/ChangeLog] 2004-09-07 Ziemowit Laski <zlaski@apple.com> * Makefile.in (c-parse.o): Depend on $(C_COMMON_H). * c-parse.in: Include c-common.h instead of objc-act.h. (ivar_decl_list, ivar_decls, ivar_decl, ivars, ivar_declarator, myparms, myparm): Remove %type declarations. (methodtype, optparms, OBJC_TYPE_QUAL, objc_quals, objc_qual, objc_typename, objc_try_catch_stmt, optellipsis): Add %type declarations. (objc_inherit_code, objc_public_flag): Remove. (typespec_nonreserved_nonattr): Call objc_get_protocol_qualified_type() instead of get_static_reference() and get_protocol_reference(). (stmt_nocomp): Call grokparm() on @catch parameter. (objcdef): Move semantic action to objc_finish_implementation(). (classdef): Move semantic action to objc_start_class_interface(), objc_continue_interface(), objc_finish_interface(), objc_start_class_implementation(), objc_continue_implementation(), objc_start_category_interface() and objc_start_category_implementation(). (protocoldef): Move semantic actions to objc_start_protocol() and objc_finish_interface(). (ivar_decl_list): Remove nonterminal. (visibility_spec): Move semantic actions to objc_set_visibility(). (ivar_decls): Remove assignment to $$. (ivar_decl): Rephrase in terms of component_decl; call objc_add_instance_variable(). (ivars, ivar_declarator): Remove nonterminals. (opt_semi): New nonterminal. (methodtype): Remove semantic actions. (methoddef): Move semantic actions to objc_set_method_type(), objc_start_method_definition() and objc_finish_method_definition(). (methodproto): Move semantic actions to objc_set_method_type() and objc_add_method_declaration(). (methoddecl): Use objc_typename instead of typename; move semantic actions to objc_build_method_signature(). (optarglist, myxdecls, mydecl, myparms, myparm): Remove nonterminals. (optparmlist): Express in terms of optparms and optellipsis. (optparms, optellipsis, objc_qual, objc_quals, objc_typename): New nonterminals. (keyworddecl): Use objc_typename instead of typename. (rid_to_yy): Mark RID_IN, RID_OUT, RID_INOUT, RID_BYCOPY, RID_BYREF and RID_ONEWAY as returning OBJC_TYPE_QUAL to yyparse(). [gcc/objc/ChangeLog] 2004-09-07 Ziemowit Laski <zlaski@apple.com> * Make-lang.in (objc/objc-parse.o): Depend on $(C_COMMON_H) instead of objc/objc-act.h. (objc/objc-act.o): Depend on $(HASHTAB_H). * objc-act.c: Include hashtab.h; in ObjC++ mode, include cp-tree.h and objcp-decl.h instead of c-tree.h. (build_module_descriptor, get_class_ivars, synth_id_with_class_suffix, error_with_ivar, gen_method_decl, gen_declaration, setup_string_decl, build_protocol_template): Adjust prototypes. (build_module_initializer_routine, start_class, continue_class, finish_class, start_method_def, objc_start_function, start_protocol, build_method_decl, objc_add_method, add_instance_variable, build_ivar_reference, is_ivar, is_private, get_super_receiver, build_selector_table_decl, objc_push_parm, objc_get_parm_info, gen_type_name, gen_type_name_0, start_var_decl, finish_var_decl, create_field_decl): New prototypes. (objc_expand_function_end, comp_method_with_proto, objc_expr_last, gen_declaration_1, gen_declarator, is_complex_decl, adorn_decl, define_decl, create_builtin_decl, gen_declspecs): Remove prototypes. (TYPE_ID): Rename to OBJECT_TYPEDEF_NAME. (CLASS_TYPEDEF_NAME): New. (TAG_EXECCLASS): Change from a global variable to a #define. (TAG_RETURN_STRUCT): Delete. (TAG_GNUINIT): New, holds '__objc_gnu_init' name. (objc_inherit_code, objc_public_flag): New, moved from c-parse.in. (string_descriptor): New struct. (string_htab): New hash table. (string_hash, string_eq): New prototypes. (generate_struct_by_value_array): Call create_field_decl() instead of create_builtin_decl(). (objc_init): Do not initialize objc_ellipsis_node or TAG_EXECCLASS; In ObjC++ mode, call cxx_init() instead of c_objc_common_init(). (objc_finish_file): In ObjC++, call instantiate_pending_templates() and cp_finish_file(). (define_decl, get_static_reference, get_protocol_reference, create_builtin_decl): Remove functions. (objc_start_class_interface, objc_start_category_interface, objc_start_protocol, objc_continue_interface, objc_finish_interface, objc_start_class_implementation, objc_start_category_implementation, objc_continue_implementation, objc_finish_implementation, objc_set_visibility, objc_set_method_type, objc_build_method_signature, objc_add_method_declaration, objc_start_method_definition, objc_add_instance_variable, objc_get_protocol_qualified_type, create_field_decl, start_var_decl, finish_var_decl): New functions. (setup_string_decl): Simplify since it is only called once. (synth_module_prologue): Call build_class_template(); predefine 'id' and 'Class' as typedefs; rename 'temp_type' to 'type'; disable debug hooks for duration of function; fix GNU runtime messenger signatures to correspond to reality; forward-declare '__objc_exec_class' for the GNU runtime; call build_selector_table_decl(); in ObjC++ mode, generate 'extern "C" { ... }' wrappers around synthesized declarations; call build_protocol_template() and build_category_template(). (string_hash, string_eq): New functions. (objc_build_string_object): Check metaclass correctness only once; store string literals in hash table. (objc_build_constructor): Do not convert initializer elements; adjust for ObjC++ impedance mismatch. (build_objc_symtab_template): Call create_field_decl() instead of create_builtin_decl(). (init_objc_symtab): Add missing conversion to initializer element. (build_metadata_decl): Call start_var_decl() instead of define_decl(). (generate_objc_symtab_decl): Do not call build_category_template(); call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(). (build_module_descriptor): Call create_field_decl() instead of grokfield(); call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(); always mark module descriptor as used; move GNU runtime-specific functionality to build_module_initializer_routine(). (build_module_initializer_routine): New function, broken off of build_module_descriptor(). (objc_static_init_needed_p, objc_generate_static_init_call): New functions. (generate_static_references, generate_strings, build_selector_translation_table, generate_descriptor_table, generate_ivars_list, generate_dispatch_table, generate_category): Call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(); build a type directly instead of via groktypename(). (build_selector_reference_decl, build_selector_table_decl, build_class_reference_decl, build_protocol_reference, generate_objc_image_info): Call start_var_decl() instead of build_decl(). (build_selector_reference): For GNU runtime, do not call build_selector_reference_decl(). (build_selector, build_typed_selector_reference): Always convert result to the selector type. (add_objc_string): Cast return value to 'char *'. (build_method_prototype_template, build_selector_template, build_method_template): Use actual selector type for fields pointing to selectors. (finish_objc): For GNU runtime, call build_module_initializer_routine() after build_module_descriptor(). (generate_protocol_list, generate_shared_structures): Call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(); build a type directly instead of via groktypename(). (synth_id_with_class_suffix): Return a string. (get_arg_type_list): For instance methods, use the instance type for 'self'; do not call groktypename_in_parm_context(). (build_objc_string_decl): Squash redeclaration errors in ObjC++. (objc_is_class_name): Use OBJC_TYPE_NAME instead of TYPE_NAME; handle RECORD_TYPEs in ObjC as well as ObjC++. (objc_is_id): New function. (objc_is_object_ptr): Return the canonical type node. (objc_get_class_ivars): Simplify using get_class_ivars(). (get_class_ivars): Remove second parameter; create a fresh copy of the ivar list for each call; do not check for existence of super class. (objc_eh_runtime_type): Mark #ifndef OBJCPLUS. (objc_init_exceptions): When using SJLJ-style exceptions, require the use of '-fobjc-exceptions' flag; do not require it for DWARF-style exceptions. (objc_build_exc_ptr, next_sjlj_build_try_catch_finally): Use objc_object_type instead of objc_id_type. (objc_begin_catch_clause): Convert the incoming PARM_DECL into a VAR_DECL before placing it in the appropriate scope; do not call define_decl(); adjust call to c_begin_compound_stmt(); use objc_object_type instead of objc_id_type. (build_next_objc_exception_stuff): Call create_field_decl() instead of create_builtin_decl(); construct type directly instead of calling groktypename(); use OBJC_VOID_AT_END to mark end of function parameters. (build_private_template): Adjust call to get_class_ivars(); build a type directly instead of via groktypename(). (build_protocol_template, build_method_prototype_list_template, build_method_prototype_template, build_category_template, build_selector_template, build_class_template, build_super_template, build_ivar_template, build_ivar_list_template, build_method_list_template, build_method_template): Call create_field_decl() instead of grokfield(). (objc_method_parm_type): Do not call groktypename(). (generate_descriptor_table): Call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(). (generate_method_descriptors, build_protocol_initializer, generate_dispatch_tables, build_category_initializer, build_shared_structure_initializer): Do not call groktypename(). (generate_protocols): Call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(); do not call groktypename(). (error_with_ivar): Remove last parameter. (check_ivars): Do not iterate ovar CLASS_RAW_IVARS lists in addition to CLASS_IVARS lists; adjust calls to error_with_ivar(). (generate_ivar_lists): Convert one of the initializer elements; do not call groktypename(). (get_arg_type_list, start_method_def, gen_method_def): Account for new representation of variable arguments and '...' in Objective-C methods; add Objective-C++ impedance matching code. (is_objc_type_qualifier): Remove function. (adjust_type_for_id_default): Simplify; there is no longer a need to wade through declspecs. (lookup_interface, start_class, continue_class, finish_class, start_method_def, start_protocol, build_method_decl, objc_add_method, add_instance_variable, build_ivar_reference, is_ivar, is_private, get_super_receiver, objc_build_finally_epilogue): Make into static functions. (receiver_is_class_object): Use new IS_CLASS() macro. (objc_build_message_expr): Tweak ObjC++ message argument handling; call objc_finish_message_expr() instead of finish_message_expr(). (finish_message_expr): Rename to objc_finish_message_expr(); use OBJC_TYPE_NAME and OBJC_SET_TYPE_NAME macros instead of TYPE_NAME. call gen_type_name() instead of gen_declaration(); call objc_is_id() instead of using IS_ID and IS_CLASS; Use objc_class_name instead of calling get_identifier("Class"); handle CONVERT_EXPRs in receiver. (build_objc_method_call, warn_with_method): Do not call groktypename(). (build_ivar_reference): Call convert() instead of clobbering in a type. (hash_init): Initialize string_htab hash table. (add_instance_variable): Simplify parameter list; do not call grokfield(); do not populate CLASS_IVARS list. (start_class): Check for the existence of super class, if one was specified. (continue_class): Use CLASS_RAW_IVARS rather than CLASS_IVARS; do not call build_class_template(); adjust call to get_class_ivars(); call build_decl(), pushdecl() and finish_decl() instead of define_decl(). (finish_class): Call build_decl(), pushdecl() and finish_decl() instead of define_decl(). (add_protocols): Use PROTOCOL_BINFO_ELTS for the tree vector size. (start_protocol): Do not call build_protocol_template(); use PROTOCOL_BINFO_ELTS for the tree vector size. (encode_type_qualifiers): Do not handle the 'const' qualifier here. (encode_pointer): Encode 'const char *' as 'r*', for backwards compatibility. (encode_array): Use HOST_WIDE_INT_PRINT_DEC instead of "%ld". (encode_type): Handle the 'const' qualifier here. (objc_parmlist): New global variable, sued by objc_push_parm and objc_get_parm_info(). (objc_push_parm, objc_get_parm_info): New functions. (objc_expr_last): Remove function. (synth_self_and_ucmd_args): For instance methods, use the instance type for 'self'; call objc_push_parm() instead of push_parm_decl(). (start_method_def): Do not call push_scope(), declare_parm_level(), pop_scope(), push_parm_decl(), store_parm_decls() or objc_expr_last(); just use objc_push_parm() and objc_get_parm_info(). (comp_method_with_proto): Remove function. (objc_types_are_equivalent): Strip away indirections before comparing underlying types. (comp_proto_with_proto): Do not call groktypename(); types are no longer in raw declspec format. (objc_start_function): New function. (really_start_method): Call comp_proto_with_proto() instead of comp_method_with_proto(); call objc_start_function() instead of hand-crafting a function declarator. (continue_method_def, objc_expand_function_end): Remove functions. (get_super_receiver): Call objc_get_current_scope() instead of get_current_scope(); reference 'super_class' field (instead of 'class'). (finish_method_def): Rename to objc_finish_method_definition() and add a function decl parameter; move method encoding call from objc_expand_function_end(). (is_complex_decl, adorn_decl, gen_declarator, gen_declspecs, gen_declaration_1): Remove functions. (tmpbuf, RAW_DECLSPEC): Remove. (gen_declaration): Remove second parameter; simplify to deal with TYPE_P nodes instead of raw declspecs. (gen_type_name, gen_type_name_0): New functions. (gen_method_decl): Remove second parameter; call gen_type_name() instead of gen_declaration_1(). (dump_interface): Adjust calls to gen_declaration() and gen_method_decl(); do not allocate a separate string buffer. (init_objc): Allocate a larger string buffer to accommodate dump_interface(); adjust call to build_module_descriptor(); add call to build_module_initializer_routine() for the GNU runtime. (generate_classref_translation_entry): Do not call start_decl(); call finish_var_decl() instead of finish_decl(); call convert() instead of build_c_cast(). * objc-act.h (CLASS_OWN_IVARS): Remove accessor. (CLASS_BINFO_ELTS): Reduce from 6 to 5, now that CLASS_OWN_IVARS is gone. (OCTI_GNU_INIT_DECL, GNU_INIT_decl): New. (OCTI_ELLIPSIS_NODE, objc_ellipsis_node): Remove. (OCTI_ID_ID, id_type, objc_id_id): Rename to OCTI_ID_NAME, objc_object_type and objc_object_name, respectively. (OCTI_CLS_REF, OCTI_CLASS_NAME, objc_class_reference, objc_class_name): New. (IS_CLASS): New macro. (IS_ID, IS_SUPER): Robustify. (OCTI_EXECCLASS_DECL, execclass_decl): New. (finish_file, start_class, continue_class, finish_class, start_method_def, continue_method_def, finish_method_def, start_protocol, finish_protocol, objc_build_throw_stmt, objc_build_try_catch_finally_stmt, objc_build_synchronized_prologue, objc_build_synchronized_epilogue, objc_build_try_prologue, objc_build_try_epilogue, objc_build_catch_stmt, objc_build_catch_epilogue, objc_build_finally_prologue, objc_build_finally_epilogue, is_ivar, is_private, is_public, add_instance_variable, objc_add_method, get_super_receiver, objc_clear_super_receiver, get_class_ivars_from_name, get_class_reference, get_static_reference, get_object_reference, build_message_expr, finish_message_expr, build_selector_expr, build_ivar_reference, build_keyword_decl, build_method_decl, build_protocol_expr, build_objc_string_object, objc_declare_alias, objc_declare_class, objc_declare_protocols, objc_comptypes, objc_check_decl, build_encode_expr): Remove prototypes. (imp_count, cat_count): Make GGC-aware. (OBJC_SET_TYPE_NAME): New macro. From-SVN: r87168
2004-09-08 02:49:44 +02:00
/* Check whether TYPE is either 'id' or 'Class'. */
tree
objc_is_id (tree type)
{
if (type && TREE_CODE (type) == IDENTIFIER_NODE
&& identifier_global_value (type))
type = identifier_global_value (type);
if (type && TREE_CODE (type) == TYPE_DECL)
type = TREE_TYPE (type);
/* NB: This function may be called before the ObjC front-end has
been initialized, in which case OBJC_OBJECT_TYPE will (still) be NULL. */
c-common.h: Remove RID_ID. [gcc/ChangeLog] 2004-10-25 David Ayers <d.ayers@inode.at> * c-common.h: Remove RID_ID. * c-parse.in: Remove OBJECTNAME and references to RID_ID. (typespec_reserved_attr): Add rule for TYPENAME non_empty_protocolrefs. (yylexname): Remove special handling of RID_ID. [gcc/objc/ChangeLog] 2004-10-25 Ziemowit Laski <zlaski@apple.com> David Ayers <d.ayers@inode.at> * objc-act.c (objc_comptypes): Use IS_PROTOCOL_QUALIFIED_UNTYPED instead of IS_PROTOCOL_QUALIFIED_ID; add comparisons for: 'Class <Protocol> != id <Protocol>'; 'Class <Protocol> != <class> *'; 'Class <Protocol> == id' and 'Class <Protocol> == Class'. (objc_is_id): Add test for 'super'. (objc_finish_message_expr): Allow for messaging of 'Class <Proto>' receivers; if class methods are not found in protocol lists, search for instance methods therein and warn if one is found. Look in global hash tables for suitable method as a last resort when messaging 'id <Proto>', 'Class <Proto>' and invalid receiver types. (objc_add_method): Insert instance methods listed in protocols into the global class method hash table. * objc-act.h (IS_PROTOCOL_QUALIFIED_ID): Rename to IS_PROTOCOL_QUALIFIED_UNTYPED and allow for 'Class <Proto>' in addition to 'id <Proto>'. [gcc/testsuite/ChangeLog] 2004-10-25 David Ayers <d.ayers@inode.at> Ziemowit Laski <zlaski@apple.com> * objc.dg/call-super-2.m: Add messages to 'Class <Proto>'; update diagnostics when messaging 'id <Proto>'. * objc.dg/class-protocol-1.m: New test. * objc.dg/desig-init-1.m: Add message to an invalid receiver using a non-existent method signature. * objc.dg/method-5.m, objc.dg/method-6.m, objc.dg/proto-hier-1.m: Update diagnostics when messaging with non-existent method signature. * objc.dg/proto-hier-2.m: Adjust wording of diagnostic. * objc.dg/proto-lossage-1.m, objc.dg/proto-lossage-4.m: Messages to invalid receivers are now resolved as if messaging 'id'; remove extraneous diagnostics. From-SVN: r89562
2004-10-26 00:55:25 +02:00
return (objc_object_type && type
&& (IS_ID (type) || IS_CLASS (type) || IS_SUPER (type))
Makefile.in (c-parse.o): Depend on $(C_COMMON_H). [gcc/ChangeLog] 2004-09-07 Ziemowit Laski <zlaski@apple.com> * Makefile.in (c-parse.o): Depend on $(C_COMMON_H). * c-parse.in: Include c-common.h instead of objc-act.h. (ivar_decl_list, ivar_decls, ivar_decl, ivars, ivar_declarator, myparms, myparm): Remove %type declarations. (methodtype, optparms, OBJC_TYPE_QUAL, objc_quals, objc_qual, objc_typename, objc_try_catch_stmt, optellipsis): Add %type declarations. (objc_inherit_code, objc_public_flag): Remove. (typespec_nonreserved_nonattr): Call objc_get_protocol_qualified_type() instead of get_static_reference() and get_protocol_reference(). (stmt_nocomp): Call grokparm() on @catch parameter. (objcdef): Move semantic action to objc_finish_implementation(). (classdef): Move semantic action to objc_start_class_interface(), objc_continue_interface(), objc_finish_interface(), objc_start_class_implementation(), objc_continue_implementation(), objc_start_category_interface() and objc_start_category_implementation(). (protocoldef): Move semantic actions to objc_start_protocol() and objc_finish_interface(). (ivar_decl_list): Remove nonterminal. (visibility_spec): Move semantic actions to objc_set_visibility(). (ivar_decls): Remove assignment to $$. (ivar_decl): Rephrase in terms of component_decl; call objc_add_instance_variable(). (ivars, ivar_declarator): Remove nonterminals. (opt_semi): New nonterminal. (methodtype): Remove semantic actions. (methoddef): Move semantic actions to objc_set_method_type(), objc_start_method_definition() and objc_finish_method_definition(). (methodproto): Move semantic actions to objc_set_method_type() and objc_add_method_declaration(). (methoddecl): Use objc_typename instead of typename; move semantic actions to objc_build_method_signature(). (optarglist, myxdecls, mydecl, myparms, myparm): Remove nonterminals. (optparmlist): Express in terms of optparms and optellipsis. (optparms, optellipsis, objc_qual, objc_quals, objc_typename): New nonterminals. (keyworddecl): Use objc_typename instead of typename. (rid_to_yy): Mark RID_IN, RID_OUT, RID_INOUT, RID_BYCOPY, RID_BYREF and RID_ONEWAY as returning OBJC_TYPE_QUAL to yyparse(). [gcc/objc/ChangeLog] 2004-09-07 Ziemowit Laski <zlaski@apple.com> * Make-lang.in (objc/objc-parse.o): Depend on $(C_COMMON_H) instead of objc/objc-act.h. (objc/objc-act.o): Depend on $(HASHTAB_H). * objc-act.c: Include hashtab.h; in ObjC++ mode, include cp-tree.h and objcp-decl.h instead of c-tree.h. (build_module_descriptor, get_class_ivars, synth_id_with_class_suffix, error_with_ivar, gen_method_decl, gen_declaration, setup_string_decl, build_protocol_template): Adjust prototypes. (build_module_initializer_routine, start_class, continue_class, finish_class, start_method_def, objc_start_function, start_protocol, build_method_decl, objc_add_method, add_instance_variable, build_ivar_reference, is_ivar, is_private, get_super_receiver, build_selector_table_decl, objc_push_parm, objc_get_parm_info, gen_type_name, gen_type_name_0, start_var_decl, finish_var_decl, create_field_decl): New prototypes. (objc_expand_function_end, comp_method_with_proto, objc_expr_last, gen_declaration_1, gen_declarator, is_complex_decl, adorn_decl, define_decl, create_builtin_decl, gen_declspecs): Remove prototypes. (TYPE_ID): Rename to OBJECT_TYPEDEF_NAME. (CLASS_TYPEDEF_NAME): New. (TAG_EXECCLASS): Change from a global variable to a #define. (TAG_RETURN_STRUCT): Delete. (TAG_GNUINIT): New, holds '__objc_gnu_init' name. (objc_inherit_code, objc_public_flag): New, moved from c-parse.in. (string_descriptor): New struct. (string_htab): New hash table. (string_hash, string_eq): New prototypes. (generate_struct_by_value_array): Call create_field_decl() instead of create_builtin_decl(). (objc_init): Do not initialize objc_ellipsis_node or TAG_EXECCLASS; In ObjC++ mode, call cxx_init() instead of c_objc_common_init(). (objc_finish_file): In ObjC++, call instantiate_pending_templates() and cp_finish_file(). (define_decl, get_static_reference, get_protocol_reference, create_builtin_decl): Remove functions. (objc_start_class_interface, objc_start_category_interface, objc_start_protocol, objc_continue_interface, objc_finish_interface, objc_start_class_implementation, objc_start_category_implementation, objc_continue_implementation, objc_finish_implementation, objc_set_visibility, objc_set_method_type, objc_build_method_signature, objc_add_method_declaration, objc_start_method_definition, objc_add_instance_variable, objc_get_protocol_qualified_type, create_field_decl, start_var_decl, finish_var_decl): New functions. (setup_string_decl): Simplify since it is only called once. (synth_module_prologue): Call build_class_template(); predefine 'id' and 'Class' as typedefs; rename 'temp_type' to 'type'; disable debug hooks for duration of function; fix GNU runtime messenger signatures to correspond to reality; forward-declare '__objc_exec_class' for the GNU runtime; call build_selector_table_decl(); in ObjC++ mode, generate 'extern "C" { ... }' wrappers around synthesized declarations; call build_protocol_template() and build_category_template(). (string_hash, string_eq): New functions. (objc_build_string_object): Check metaclass correctness only once; store string literals in hash table. (objc_build_constructor): Do not convert initializer elements; adjust for ObjC++ impedance mismatch. (build_objc_symtab_template): Call create_field_decl() instead of create_builtin_decl(). (init_objc_symtab): Add missing conversion to initializer element. (build_metadata_decl): Call start_var_decl() instead of define_decl(). (generate_objc_symtab_decl): Do not call build_category_template(); call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(). (build_module_descriptor): Call create_field_decl() instead of grokfield(); call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(); always mark module descriptor as used; move GNU runtime-specific functionality to build_module_initializer_routine(). (build_module_initializer_routine): New function, broken off of build_module_descriptor(). (objc_static_init_needed_p, objc_generate_static_init_call): New functions. (generate_static_references, generate_strings, build_selector_translation_table, generate_descriptor_table, generate_ivars_list, generate_dispatch_table, generate_category): Call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(); build a type directly instead of via groktypename(). (build_selector_reference_decl, build_selector_table_decl, build_class_reference_decl, build_protocol_reference, generate_objc_image_info): Call start_var_decl() instead of build_decl(). (build_selector_reference): For GNU runtime, do not call build_selector_reference_decl(). (build_selector, build_typed_selector_reference): Always convert result to the selector type. (add_objc_string): Cast return value to 'char *'. (build_method_prototype_template, build_selector_template, build_method_template): Use actual selector type for fields pointing to selectors. (finish_objc): For GNU runtime, call build_module_initializer_routine() after build_module_descriptor(). (generate_protocol_list, generate_shared_structures): Call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(); build a type directly instead of via groktypename(). (synth_id_with_class_suffix): Return a string. (get_arg_type_list): For instance methods, use the instance type for 'self'; do not call groktypename_in_parm_context(). (build_objc_string_decl): Squash redeclaration errors in ObjC++. (objc_is_class_name): Use OBJC_TYPE_NAME instead of TYPE_NAME; handle RECORD_TYPEs in ObjC as well as ObjC++. (objc_is_id): New function. (objc_is_object_ptr): Return the canonical type node. (objc_get_class_ivars): Simplify using get_class_ivars(). (get_class_ivars): Remove second parameter; create a fresh copy of the ivar list for each call; do not check for existence of super class. (objc_eh_runtime_type): Mark #ifndef OBJCPLUS. (objc_init_exceptions): When using SJLJ-style exceptions, require the use of '-fobjc-exceptions' flag; do not require it for DWARF-style exceptions. (objc_build_exc_ptr, next_sjlj_build_try_catch_finally): Use objc_object_type instead of objc_id_type. (objc_begin_catch_clause): Convert the incoming PARM_DECL into a VAR_DECL before placing it in the appropriate scope; do not call define_decl(); adjust call to c_begin_compound_stmt(); use objc_object_type instead of objc_id_type. (build_next_objc_exception_stuff): Call create_field_decl() instead of create_builtin_decl(); construct type directly instead of calling groktypename(); use OBJC_VOID_AT_END to mark end of function parameters. (build_private_template): Adjust call to get_class_ivars(); build a type directly instead of via groktypename(). (build_protocol_template, build_method_prototype_list_template, build_method_prototype_template, build_category_template, build_selector_template, build_class_template, build_super_template, build_ivar_template, build_ivar_list_template, build_method_list_template, build_method_template): Call create_field_decl() instead of grokfield(). (objc_method_parm_type): Do not call groktypename(). (generate_descriptor_table): Call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(). (generate_method_descriptors, build_protocol_initializer, generate_dispatch_tables, build_category_initializer, build_shared_structure_initializer): Do not call groktypename(). (generate_protocols): Call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(); do not call groktypename(). (error_with_ivar): Remove last parameter. (check_ivars): Do not iterate ovar CLASS_RAW_IVARS lists in addition to CLASS_IVARS lists; adjust calls to error_with_ivar(). (generate_ivar_lists): Convert one of the initializer elements; do not call groktypename(). (get_arg_type_list, start_method_def, gen_method_def): Account for new representation of variable arguments and '...' in Objective-C methods; add Objective-C++ impedance matching code. (is_objc_type_qualifier): Remove function. (adjust_type_for_id_default): Simplify; there is no longer a need to wade through declspecs. (lookup_interface, start_class, continue_class, finish_class, start_method_def, start_protocol, build_method_decl, objc_add_method, add_instance_variable, build_ivar_reference, is_ivar, is_private, get_super_receiver, objc_build_finally_epilogue): Make into static functions. (receiver_is_class_object): Use new IS_CLASS() macro. (objc_build_message_expr): Tweak ObjC++ message argument handling; call objc_finish_message_expr() instead of finish_message_expr(). (finish_message_expr): Rename to objc_finish_message_expr(); use OBJC_TYPE_NAME and OBJC_SET_TYPE_NAME macros instead of TYPE_NAME. call gen_type_name() instead of gen_declaration(); call objc_is_id() instead of using IS_ID and IS_CLASS; Use objc_class_name instead of calling get_identifier("Class"); handle CONVERT_EXPRs in receiver. (build_objc_method_call, warn_with_method): Do not call groktypename(). (build_ivar_reference): Call convert() instead of clobbering in a type. (hash_init): Initialize string_htab hash table. (add_instance_variable): Simplify parameter list; do not call grokfield(); do not populate CLASS_IVARS list. (start_class): Check for the existence of super class, if one was specified. (continue_class): Use CLASS_RAW_IVARS rather than CLASS_IVARS; do not call build_class_template(); adjust call to get_class_ivars(); call build_decl(), pushdecl() and finish_decl() instead of define_decl(). (finish_class): Call build_decl(), pushdecl() and finish_decl() instead of define_decl(). (add_protocols): Use PROTOCOL_BINFO_ELTS for the tree vector size. (start_protocol): Do not call build_protocol_template(); use PROTOCOL_BINFO_ELTS for the tree vector size. (encode_type_qualifiers): Do not handle the 'const' qualifier here. (encode_pointer): Encode 'const char *' as 'r*', for backwards compatibility. (encode_array): Use HOST_WIDE_INT_PRINT_DEC instead of "%ld". (encode_type): Handle the 'const' qualifier here. (objc_parmlist): New global variable, sued by objc_push_parm and objc_get_parm_info(). (objc_push_parm, objc_get_parm_info): New functions. (objc_expr_last): Remove function. (synth_self_and_ucmd_args): For instance methods, use the instance type for 'self'; call objc_push_parm() instead of push_parm_decl(). (start_method_def): Do not call push_scope(), declare_parm_level(), pop_scope(), push_parm_decl(), store_parm_decls() or objc_expr_last(); just use objc_push_parm() and objc_get_parm_info(). (comp_method_with_proto): Remove function. (objc_types_are_equivalent): Strip away indirections before comparing underlying types. (comp_proto_with_proto): Do not call groktypename(); types are no longer in raw declspec format. (objc_start_function): New function. (really_start_method): Call comp_proto_with_proto() instead of comp_method_with_proto(); call objc_start_function() instead of hand-crafting a function declarator. (continue_method_def, objc_expand_function_end): Remove functions. (get_super_receiver): Call objc_get_current_scope() instead of get_current_scope(); reference 'super_class' field (instead of 'class'). (finish_method_def): Rename to objc_finish_method_definition() and add a function decl parameter; move method encoding call from objc_expand_function_end(). (is_complex_decl, adorn_decl, gen_declarator, gen_declspecs, gen_declaration_1): Remove functions. (tmpbuf, RAW_DECLSPEC): Remove. (gen_declaration): Remove second parameter; simplify to deal with TYPE_P nodes instead of raw declspecs. (gen_type_name, gen_type_name_0): New functions. (gen_method_decl): Remove second parameter; call gen_type_name() instead of gen_declaration_1(). (dump_interface): Adjust calls to gen_declaration() and gen_method_decl(); do not allocate a separate string buffer. (init_objc): Allocate a larger string buffer to accommodate dump_interface(); adjust call to build_module_descriptor(); add call to build_module_initializer_routine() for the GNU runtime. (generate_classref_translation_entry): Do not call start_decl(); call finish_var_decl() instead of finish_decl(); call convert() instead of build_c_cast(). * objc-act.h (CLASS_OWN_IVARS): Remove accessor. (CLASS_BINFO_ELTS): Reduce from 6 to 5, now that CLASS_OWN_IVARS is gone. (OCTI_GNU_INIT_DECL, GNU_INIT_decl): New. (OCTI_ELLIPSIS_NODE, objc_ellipsis_node): Remove. (OCTI_ID_ID, id_type, objc_id_id): Rename to OCTI_ID_NAME, objc_object_type and objc_object_name, respectively. (OCTI_CLS_REF, OCTI_CLASS_NAME, objc_class_reference, objc_class_name): New. (IS_CLASS): New macro. (IS_ID, IS_SUPER): Robustify. (OCTI_EXECCLASS_DECL, execclass_decl): New. (finish_file, start_class, continue_class, finish_class, start_method_def, continue_method_def, finish_method_def, start_protocol, finish_protocol, objc_build_throw_stmt, objc_build_try_catch_finally_stmt, objc_build_synchronized_prologue, objc_build_synchronized_epilogue, objc_build_try_prologue, objc_build_try_epilogue, objc_build_catch_stmt, objc_build_catch_epilogue, objc_build_finally_prologue, objc_build_finally_epilogue, is_ivar, is_private, is_public, add_instance_variable, objc_add_method, get_super_receiver, objc_clear_super_receiver, get_class_ivars_from_name, get_class_reference, get_static_reference, get_object_reference, build_message_expr, finish_message_expr, build_selector_expr, build_ivar_reference, build_keyword_decl, build_method_decl, build_protocol_expr, build_objc_string_object, objc_declare_alias, objc_declare_class, objc_declare_protocols, objc_comptypes, objc_check_decl, build_encode_expr): Remove prototypes. (imp_count, cat_count): Make GGC-aware. (OBJC_SET_TYPE_NAME): New macro. From-SVN: r87168
2004-09-08 02:49:44 +02:00
? type
: NULL_TREE);
Makefile.in (c-parse.o): Depend on $(C_COMMON_H). [gcc/ChangeLog] 2004-09-07 Ziemowit Laski <zlaski@apple.com> * Makefile.in (c-parse.o): Depend on $(C_COMMON_H). * c-parse.in: Include c-common.h instead of objc-act.h. (ivar_decl_list, ivar_decls, ivar_decl, ivars, ivar_declarator, myparms, myparm): Remove %type declarations. (methodtype, optparms, OBJC_TYPE_QUAL, objc_quals, objc_qual, objc_typename, objc_try_catch_stmt, optellipsis): Add %type declarations. (objc_inherit_code, objc_public_flag): Remove. (typespec_nonreserved_nonattr): Call objc_get_protocol_qualified_type() instead of get_static_reference() and get_protocol_reference(). (stmt_nocomp): Call grokparm() on @catch parameter. (objcdef): Move semantic action to objc_finish_implementation(). (classdef): Move semantic action to objc_start_class_interface(), objc_continue_interface(), objc_finish_interface(), objc_start_class_implementation(), objc_continue_implementation(), objc_start_category_interface() and objc_start_category_implementation(). (protocoldef): Move semantic actions to objc_start_protocol() and objc_finish_interface(). (ivar_decl_list): Remove nonterminal. (visibility_spec): Move semantic actions to objc_set_visibility(). (ivar_decls): Remove assignment to $$. (ivar_decl): Rephrase in terms of component_decl; call objc_add_instance_variable(). (ivars, ivar_declarator): Remove nonterminals. (opt_semi): New nonterminal. (methodtype): Remove semantic actions. (methoddef): Move semantic actions to objc_set_method_type(), objc_start_method_definition() and objc_finish_method_definition(). (methodproto): Move semantic actions to objc_set_method_type() and objc_add_method_declaration(). (methoddecl): Use objc_typename instead of typename; move semantic actions to objc_build_method_signature(). (optarglist, myxdecls, mydecl, myparms, myparm): Remove nonterminals. (optparmlist): Express in terms of optparms and optellipsis. (optparms, optellipsis, objc_qual, objc_quals, objc_typename): New nonterminals. (keyworddecl): Use objc_typename instead of typename. (rid_to_yy): Mark RID_IN, RID_OUT, RID_INOUT, RID_BYCOPY, RID_BYREF and RID_ONEWAY as returning OBJC_TYPE_QUAL to yyparse(). [gcc/objc/ChangeLog] 2004-09-07 Ziemowit Laski <zlaski@apple.com> * Make-lang.in (objc/objc-parse.o): Depend on $(C_COMMON_H) instead of objc/objc-act.h. (objc/objc-act.o): Depend on $(HASHTAB_H). * objc-act.c: Include hashtab.h; in ObjC++ mode, include cp-tree.h and objcp-decl.h instead of c-tree.h. (build_module_descriptor, get_class_ivars, synth_id_with_class_suffix, error_with_ivar, gen_method_decl, gen_declaration, setup_string_decl, build_protocol_template): Adjust prototypes. (build_module_initializer_routine, start_class, continue_class, finish_class, start_method_def, objc_start_function, start_protocol, build_method_decl, objc_add_method, add_instance_variable, build_ivar_reference, is_ivar, is_private, get_super_receiver, build_selector_table_decl, objc_push_parm, objc_get_parm_info, gen_type_name, gen_type_name_0, start_var_decl, finish_var_decl, create_field_decl): New prototypes. (objc_expand_function_end, comp_method_with_proto, objc_expr_last, gen_declaration_1, gen_declarator, is_complex_decl, adorn_decl, define_decl, create_builtin_decl, gen_declspecs): Remove prototypes. (TYPE_ID): Rename to OBJECT_TYPEDEF_NAME. (CLASS_TYPEDEF_NAME): New. (TAG_EXECCLASS): Change from a global variable to a #define. (TAG_RETURN_STRUCT): Delete. (TAG_GNUINIT): New, holds '__objc_gnu_init' name. (objc_inherit_code, objc_public_flag): New, moved from c-parse.in. (string_descriptor): New struct. (string_htab): New hash table. (string_hash, string_eq): New prototypes. (generate_struct_by_value_array): Call create_field_decl() instead of create_builtin_decl(). (objc_init): Do not initialize objc_ellipsis_node or TAG_EXECCLASS; In ObjC++ mode, call cxx_init() instead of c_objc_common_init(). (objc_finish_file): In ObjC++, call instantiate_pending_templates() and cp_finish_file(). (define_decl, get_static_reference, get_protocol_reference, create_builtin_decl): Remove functions. (objc_start_class_interface, objc_start_category_interface, objc_start_protocol, objc_continue_interface, objc_finish_interface, objc_start_class_implementation, objc_start_category_implementation, objc_continue_implementation, objc_finish_implementation, objc_set_visibility, objc_set_method_type, objc_build_method_signature, objc_add_method_declaration, objc_start_method_definition, objc_add_instance_variable, objc_get_protocol_qualified_type, create_field_decl, start_var_decl, finish_var_decl): New functions. (setup_string_decl): Simplify since it is only called once. (synth_module_prologue): Call build_class_template(); predefine 'id' and 'Class' as typedefs; rename 'temp_type' to 'type'; disable debug hooks for duration of function; fix GNU runtime messenger signatures to correspond to reality; forward-declare '__objc_exec_class' for the GNU runtime; call build_selector_table_decl(); in ObjC++ mode, generate 'extern "C" { ... }' wrappers around synthesized declarations; call build_protocol_template() and build_category_template(). (string_hash, string_eq): New functions. (objc_build_string_object): Check metaclass correctness only once; store string literals in hash table. (objc_build_constructor): Do not convert initializer elements; adjust for ObjC++ impedance mismatch. (build_objc_symtab_template): Call create_field_decl() instead of create_builtin_decl(). (init_objc_symtab): Add missing conversion to initializer element. (build_metadata_decl): Call start_var_decl() instead of define_decl(). (generate_objc_symtab_decl): Do not call build_category_template(); call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(). (build_module_descriptor): Call create_field_decl() instead of grokfield(); call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(); always mark module descriptor as used; move GNU runtime-specific functionality to build_module_initializer_routine(). (build_module_initializer_routine): New function, broken off of build_module_descriptor(). (objc_static_init_needed_p, objc_generate_static_init_call): New functions. (generate_static_references, generate_strings, build_selector_translation_table, generate_descriptor_table, generate_ivars_list, generate_dispatch_table, generate_category): Call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(); build a type directly instead of via groktypename(). (build_selector_reference_decl, build_selector_table_decl, build_class_reference_decl, build_protocol_reference, generate_objc_image_info): Call start_var_decl() instead of build_decl(). (build_selector_reference): For GNU runtime, do not call build_selector_reference_decl(). (build_selector, build_typed_selector_reference): Always convert result to the selector type. (add_objc_string): Cast return value to 'char *'. (build_method_prototype_template, build_selector_template, build_method_template): Use actual selector type for fields pointing to selectors. (finish_objc): For GNU runtime, call build_module_initializer_routine() after build_module_descriptor(). (generate_protocol_list, generate_shared_structures): Call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(); build a type directly instead of via groktypename(). (synth_id_with_class_suffix): Return a string. (get_arg_type_list): For instance methods, use the instance type for 'self'; do not call groktypename_in_parm_context(). (build_objc_string_decl): Squash redeclaration errors in ObjC++. (objc_is_class_name): Use OBJC_TYPE_NAME instead of TYPE_NAME; handle RECORD_TYPEs in ObjC as well as ObjC++. (objc_is_id): New function. (objc_is_object_ptr): Return the canonical type node. (objc_get_class_ivars): Simplify using get_class_ivars(). (get_class_ivars): Remove second parameter; create a fresh copy of the ivar list for each call; do not check for existence of super class. (objc_eh_runtime_type): Mark #ifndef OBJCPLUS. (objc_init_exceptions): When using SJLJ-style exceptions, require the use of '-fobjc-exceptions' flag; do not require it for DWARF-style exceptions. (objc_build_exc_ptr, next_sjlj_build_try_catch_finally): Use objc_object_type instead of objc_id_type. (objc_begin_catch_clause): Convert the incoming PARM_DECL into a VAR_DECL before placing it in the appropriate scope; do not call define_decl(); adjust call to c_begin_compound_stmt(); use objc_object_type instead of objc_id_type. (build_next_objc_exception_stuff): Call create_field_decl() instead of create_builtin_decl(); construct type directly instead of calling groktypename(); use OBJC_VOID_AT_END to mark end of function parameters. (build_private_template): Adjust call to get_class_ivars(); build a type directly instead of via groktypename(). (build_protocol_template, build_method_prototype_list_template, build_method_prototype_template, build_category_template, build_selector_template, build_class_template, build_super_template, build_ivar_template, build_ivar_list_template, build_method_list_template, build_method_template): Call create_field_decl() instead of grokfield(). (objc_method_parm_type): Do not call groktypename(). (generate_descriptor_table): Call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(). (generate_method_descriptors, build_protocol_initializer, generate_dispatch_tables, build_category_initializer, build_shared_structure_initializer): Do not call groktypename(). (generate_protocols): Call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(); do not call groktypename(). (error_with_ivar): Remove last parameter. (check_ivars): Do not iterate ovar CLASS_RAW_IVARS lists in addition to CLASS_IVARS lists; adjust calls to error_with_ivar(). (generate_ivar_lists): Convert one of the initializer elements; do not call groktypename(). (get_arg_type_list, start_method_def, gen_method_def): Account for new representation of variable arguments and '...' in Objective-C methods; add Objective-C++ impedance matching code. (is_objc_type_qualifier): Remove function. (adjust_type_for_id_default): Simplify; there is no longer a need to wade through declspecs. (lookup_interface, start_class, continue_class, finish_class, start_method_def, start_protocol, build_method_decl, objc_add_method, add_instance_variable, build_ivar_reference, is_ivar, is_private, get_super_receiver, objc_build_finally_epilogue): Make into static functions. (receiver_is_class_object): Use new IS_CLASS() macro. (objc_build_message_expr): Tweak ObjC++ message argument handling; call objc_finish_message_expr() instead of finish_message_expr(). (finish_message_expr): Rename to objc_finish_message_expr(); use OBJC_TYPE_NAME and OBJC_SET_TYPE_NAME macros instead of TYPE_NAME. call gen_type_name() instead of gen_declaration(); call objc_is_id() instead of using IS_ID and IS_CLASS; Use objc_class_name instead of calling get_identifier("Class"); handle CONVERT_EXPRs in receiver. (build_objc_method_call, warn_with_method): Do not call groktypename(). (build_ivar_reference): Call convert() instead of clobbering in a type. (hash_init): Initialize string_htab hash table. (add_instance_variable): Simplify parameter list; do not call grokfield(); do not populate CLASS_IVARS list. (start_class): Check for the existence of super class, if one was specified. (continue_class): Use CLASS_RAW_IVARS rather than CLASS_IVARS; do not call build_class_template(); adjust call to get_class_ivars(); call build_decl(), pushdecl() and finish_decl() instead of define_decl(). (finish_class): Call build_decl(), pushdecl() and finish_decl() instead of define_decl(). (add_protocols): Use PROTOCOL_BINFO_ELTS for the tree vector size. (start_protocol): Do not call build_protocol_template(); use PROTOCOL_BINFO_ELTS for the tree vector size. (encode_type_qualifiers): Do not handle the 'const' qualifier here. (encode_pointer): Encode 'const char *' as 'r*', for backwards compatibility. (encode_array): Use HOST_WIDE_INT_PRINT_DEC instead of "%ld". (encode_type): Handle the 'const' qualifier here. (objc_parmlist): New global variable, sued by objc_push_parm and objc_get_parm_info(). (objc_push_parm, objc_get_parm_info): New functions. (objc_expr_last): Remove function. (synth_self_and_ucmd_args): For instance methods, use the instance type for 'self'; call objc_push_parm() instead of push_parm_decl(). (start_method_def): Do not call push_scope(), declare_parm_level(), pop_scope(), push_parm_decl(), store_parm_decls() or objc_expr_last(); just use objc_push_parm() and objc_get_parm_info(). (comp_method_with_proto): Remove function. (objc_types_are_equivalent): Strip away indirections before comparing underlying types. (comp_proto_with_proto): Do not call groktypename(); types are no longer in raw declspec format. (objc_start_function): New function. (really_start_method): Call comp_proto_with_proto() instead of comp_method_with_proto(); call objc_start_function() instead of hand-crafting a function declarator. (continue_method_def, objc_expand_function_end): Remove functions. (get_super_receiver): Call objc_get_current_scope() instead of get_current_scope(); reference 'super_class' field (instead of 'class'). (finish_method_def): Rename to objc_finish_method_definition() and add a function decl parameter; move method encoding call from objc_expand_function_end(). (is_complex_decl, adorn_decl, gen_declarator, gen_declspecs, gen_declaration_1): Remove functions. (tmpbuf, RAW_DECLSPEC): Remove. (gen_declaration): Remove second parameter; simplify to deal with TYPE_P nodes instead of raw declspecs. (gen_type_name, gen_type_name_0): New functions. (gen_method_decl): Remove second parameter; call gen_type_name() instead of gen_declaration_1(). (dump_interface): Adjust calls to gen_declaration() and gen_method_decl(); do not allocate a separate string buffer. (init_objc): Allocate a larger string buffer to accommodate dump_interface(); adjust call to build_module_descriptor(); add call to build_module_initializer_routine() for the GNU runtime. (generate_classref_translation_entry): Do not call start_decl(); call finish_var_decl() instead of finish_decl(); call convert() instead of build_c_cast(). * objc-act.h (CLASS_OWN_IVARS): Remove accessor. (CLASS_BINFO_ELTS): Reduce from 6 to 5, now that CLASS_OWN_IVARS is gone. (OCTI_GNU_INIT_DECL, GNU_INIT_decl): New. (OCTI_ELLIPSIS_NODE, objc_ellipsis_node): Remove. (OCTI_ID_ID, id_type, objc_id_id): Rename to OCTI_ID_NAME, objc_object_type and objc_object_name, respectively. (OCTI_CLS_REF, OCTI_CLASS_NAME, objc_class_reference, objc_class_name): New. (IS_CLASS): New macro. (IS_ID, IS_SUPER): Robustify. (OCTI_EXECCLASS_DECL, execclass_decl): New. (finish_file, start_class, continue_class, finish_class, start_method_def, continue_method_def, finish_method_def, start_protocol, finish_protocol, objc_build_throw_stmt, objc_build_try_catch_finally_stmt, objc_build_synchronized_prologue, objc_build_synchronized_epilogue, objc_build_try_prologue, objc_build_try_epilogue, objc_build_catch_stmt, objc_build_catch_epilogue, objc_build_finally_prologue, objc_build_finally_epilogue, is_ivar, is_private, is_public, add_instance_variable, objc_add_method, get_super_receiver, objc_clear_super_receiver, get_class_ivars_from_name, get_class_reference, get_static_reference, get_object_reference, build_message_expr, finish_message_expr, build_selector_expr, build_ivar_reference, build_keyword_decl, build_method_decl, build_protocol_expr, build_objc_string_object, objc_declare_alias, objc_declare_class, objc_declare_protocols, objc_comptypes, objc_check_decl, build_encode_expr): Remove prototypes. (imp_count, cat_count): Make GGC-aware. (OBJC_SET_TYPE_NAME): New macro. From-SVN: r87168
2004-09-08 02:49:44 +02:00
}
/* Check whether TYPE is either 'id', 'Class', or a pointer to an ObjC
class instance. This is needed by other parts of the compiler to
handle ObjC types gracefully. */
tree
objc_is_object_ptr (tree type)
{
Makefile.in (c-parse.o): Depend on $(C_COMMON_H). [gcc/ChangeLog] 2004-09-07 Ziemowit Laski <zlaski@apple.com> * Makefile.in (c-parse.o): Depend on $(C_COMMON_H). * c-parse.in: Include c-common.h instead of objc-act.h. (ivar_decl_list, ivar_decls, ivar_decl, ivars, ivar_declarator, myparms, myparm): Remove %type declarations. (methodtype, optparms, OBJC_TYPE_QUAL, objc_quals, objc_qual, objc_typename, objc_try_catch_stmt, optellipsis): Add %type declarations. (objc_inherit_code, objc_public_flag): Remove. (typespec_nonreserved_nonattr): Call objc_get_protocol_qualified_type() instead of get_static_reference() and get_protocol_reference(). (stmt_nocomp): Call grokparm() on @catch parameter. (objcdef): Move semantic action to objc_finish_implementation(). (classdef): Move semantic action to objc_start_class_interface(), objc_continue_interface(), objc_finish_interface(), objc_start_class_implementation(), objc_continue_implementation(), objc_start_category_interface() and objc_start_category_implementation(). (protocoldef): Move semantic actions to objc_start_protocol() and objc_finish_interface(). (ivar_decl_list): Remove nonterminal. (visibility_spec): Move semantic actions to objc_set_visibility(). (ivar_decls): Remove assignment to $$. (ivar_decl): Rephrase in terms of component_decl; call objc_add_instance_variable(). (ivars, ivar_declarator): Remove nonterminals. (opt_semi): New nonterminal. (methodtype): Remove semantic actions. (methoddef): Move semantic actions to objc_set_method_type(), objc_start_method_definition() and objc_finish_method_definition(). (methodproto): Move semantic actions to objc_set_method_type() and objc_add_method_declaration(). (methoddecl): Use objc_typename instead of typename; move semantic actions to objc_build_method_signature(). (optarglist, myxdecls, mydecl, myparms, myparm): Remove nonterminals. (optparmlist): Express in terms of optparms and optellipsis. (optparms, optellipsis, objc_qual, objc_quals, objc_typename): New nonterminals. (keyworddecl): Use objc_typename instead of typename. (rid_to_yy): Mark RID_IN, RID_OUT, RID_INOUT, RID_BYCOPY, RID_BYREF and RID_ONEWAY as returning OBJC_TYPE_QUAL to yyparse(). [gcc/objc/ChangeLog] 2004-09-07 Ziemowit Laski <zlaski@apple.com> * Make-lang.in (objc/objc-parse.o): Depend on $(C_COMMON_H) instead of objc/objc-act.h. (objc/objc-act.o): Depend on $(HASHTAB_H). * objc-act.c: Include hashtab.h; in ObjC++ mode, include cp-tree.h and objcp-decl.h instead of c-tree.h. (build_module_descriptor, get_class_ivars, synth_id_with_class_suffix, error_with_ivar, gen_method_decl, gen_declaration, setup_string_decl, build_protocol_template): Adjust prototypes. (build_module_initializer_routine, start_class, continue_class, finish_class, start_method_def, objc_start_function, start_protocol, build_method_decl, objc_add_method, add_instance_variable, build_ivar_reference, is_ivar, is_private, get_super_receiver, build_selector_table_decl, objc_push_parm, objc_get_parm_info, gen_type_name, gen_type_name_0, start_var_decl, finish_var_decl, create_field_decl): New prototypes. (objc_expand_function_end, comp_method_with_proto, objc_expr_last, gen_declaration_1, gen_declarator, is_complex_decl, adorn_decl, define_decl, create_builtin_decl, gen_declspecs): Remove prototypes. (TYPE_ID): Rename to OBJECT_TYPEDEF_NAME. (CLASS_TYPEDEF_NAME): New. (TAG_EXECCLASS): Change from a global variable to a #define. (TAG_RETURN_STRUCT): Delete. (TAG_GNUINIT): New, holds '__objc_gnu_init' name. (objc_inherit_code, objc_public_flag): New, moved from c-parse.in. (string_descriptor): New struct. (string_htab): New hash table. (string_hash, string_eq): New prototypes. (generate_struct_by_value_array): Call create_field_decl() instead of create_builtin_decl(). (objc_init): Do not initialize objc_ellipsis_node or TAG_EXECCLASS; In ObjC++ mode, call cxx_init() instead of c_objc_common_init(). (objc_finish_file): In ObjC++, call instantiate_pending_templates() and cp_finish_file(). (define_decl, get_static_reference, get_protocol_reference, create_builtin_decl): Remove functions. (objc_start_class_interface, objc_start_category_interface, objc_start_protocol, objc_continue_interface, objc_finish_interface, objc_start_class_implementation, objc_start_category_implementation, objc_continue_implementation, objc_finish_implementation, objc_set_visibility, objc_set_method_type, objc_build_method_signature, objc_add_method_declaration, objc_start_method_definition, objc_add_instance_variable, objc_get_protocol_qualified_type, create_field_decl, start_var_decl, finish_var_decl): New functions. (setup_string_decl): Simplify since it is only called once. (synth_module_prologue): Call build_class_template(); predefine 'id' and 'Class' as typedefs; rename 'temp_type' to 'type'; disable debug hooks for duration of function; fix GNU runtime messenger signatures to correspond to reality; forward-declare '__objc_exec_class' for the GNU runtime; call build_selector_table_decl(); in ObjC++ mode, generate 'extern "C" { ... }' wrappers around synthesized declarations; call build_protocol_template() and build_category_template(). (string_hash, string_eq): New functions. (objc_build_string_object): Check metaclass correctness only once; store string literals in hash table. (objc_build_constructor): Do not convert initializer elements; adjust for ObjC++ impedance mismatch. (build_objc_symtab_template): Call create_field_decl() instead of create_builtin_decl(). (init_objc_symtab): Add missing conversion to initializer element. (build_metadata_decl): Call start_var_decl() instead of define_decl(). (generate_objc_symtab_decl): Do not call build_category_template(); call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(). (build_module_descriptor): Call create_field_decl() instead of grokfield(); call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(); always mark module descriptor as used; move GNU runtime-specific functionality to build_module_initializer_routine(). (build_module_initializer_routine): New function, broken off of build_module_descriptor(). (objc_static_init_needed_p, objc_generate_static_init_call): New functions. (generate_static_references, generate_strings, build_selector_translation_table, generate_descriptor_table, generate_ivars_list, generate_dispatch_table, generate_category): Call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(); build a type directly instead of via groktypename(). (build_selector_reference_decl, build_selector_table_decl, build_class_reference_decl, build_protocol_reference, generate_objc_image_info): Call start_var_decl() instead of build_decl(). (build_selector_reference): For GNU runtime, do not call build_selector_reference_decl(). (build_selector, build_typed_selector_reference): Always convert result to the selector type. (add_objc_string): Cast return value to 'char *'. (build_method_prototype_template, build_selector_template, build_method_template): Use actual selector type for fields pointing to selectors. (finish_objc): For GNU runtime, call build_module_initializer_routine() after build_module_descriptor(). (generate_protocol_list, generate_shared_structures): Call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(); build a type directly instead of via groktypename(). (synth_id_with_class_suffix): Return a string. (get_arg_type_list): For instance methods, use the instance type for 'self'; do not call groktypename_in_parm_context(). (build_objc_string_decl): Squash redeclaration errors in ObjC++. (objc_is_class_name): Use OBJC_TYPE_NAME instead of TYPE_NAME; handle RECORD_TYPEs in ObjC as well as ObjC++. (objc_is_id): New function. (objc_is_object_ptr): Return the canonical type node. (objc_get_class_ivars): Simplify using get_class_ivars(). (get_class_ivars): Remove second parameter; create a fresh copy of the ivar list for each call; do not check for existence of super class. (objc_eh_runtime_type): Mark #ifndef OBJCPLUS. (objc_init_exceptions): When using SJLJ-style exceptions, require the use of '-fobjc-exceptions' flag; do not require it for DWARF-style exceptions. (objc_build_exc_ptr, next_sjlj_build_try_catch_finally): Use objc_object_type instead of objc_id_type. (objc_begin_catch_clause): Convert the incoming PARM_DECL into a VAR_DECL before placing it in the appropriate scope; do not call define_decl(); adjust call to c_begin_compound_stmt(); use objc_object_type instead of objc_id_type. (build_next_objc_exception_stuff): Call create_field_decl() instead of create_builtin_decl(); construct type directly instead of calling groktypename(); use OBJC_VOID_AT_END to mark end of function parameters. (build_private_template): Adjust call to get_class_ivars(); build a type directly instead of via groktypename(). (build_protocol_template, build_method_prototype_list_template, build_method_prototype_template, build_category_template, build_selector_template, build_class_template, build_super_template, build_ivar_template, build_ivar_list_template, build_method_list_template, build_method_template): Call create_field_decl() instead of grokfield(). (objc_method_parm_type): Do not call groktypename(). (generate_descriptor_table): Call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(). (generate_method_descriptors, build_protocol_initializer, generate_dispatch_tables, build_category_initializer, build_shared_structure_initializer): Do not call groktypename(). (generate_protocols): Call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(); do not call groktypename(). (error_with_ivar): Remove last parameter. (check_ivars): Do not iterate ovar CLASS_RAW_IVARS lists in addition to CLASS_IVARS lists; adjust calls to error_with_ivar(). (generate_ivar_lists): Convert one of the initializer elements; do not call groktypename(). (get_arg_type_list, start_method_def, gen_method_def): Account for new representation of variable arguments and '...' in Objective-C methods; add Objective-C++ impedance matching code. (is_objc_type_qualifier): Remove function. (adjust_type_for_id_default): Simplify; there is no longer a need to wade through declspecs. (lookup_interface, start_class, continue_class, finish_class, start_method_def, start_protocol, build_method_decl, objc_add_method, add_instance_variable, build_ivar_reference, is_ivar, is_private, get_super_receiver, objc_build_finally_epilogue): Make into static functions. (receiver_is_class_object): Use new IS_CLASS() macro. (objc_build_message_expr): Tweak ObjC++ message argument handling; call objc_finish_message_expr() instead of finish_message_expr(). (finish_message_expr): Rename to objc_finish_message_expr(); use OBJC_TYPE_NAME and OBJC_SET_TYPE_NAME macros instead of TYPE_NAME. call gen_type_name() instead of gen_declaration(); call objc_is_id() instead of using IS_ID and IS_CLASS; Use objc_class_name instead of calling get_identifier("Class"); handle CONVERT_EXPRs in receiver. (build_objc_method_call, warn_with_method): Do not call groktypename(). (build_ivar_reference): Call convert() instead of clobbering in a type. (hash_init): Initialize string_htab hash table. (add_instance_variable): Simplify parameter list; do not call grokfield(); do not populate CLASS_IVARS list. (start_class): Check for the existence of super class, if one was specified. (continue_class): Use CLASS_RAW_IVARS rather than CLASS_IVARS; do not call build_class_template(); adjust call to get_class_ivars(); call build_decl(), pushdecl() and finish_decl() instead of define_decl(). (finish_class): Call build_decl(), pushdecl() and finish_decl() instead of define_decl(). (add_protocols): Use PROTOCOL_BINFO_ELTS for the tree vector size. (start_protocol): Do not call build_protocol_template(); use PROTOCOL_BINFO_ELTS for the tree vector size. (encode_type_qualifiers): Do not handle the 'const' qualifier here. (encode_pointer): Encode 'const char *' as 'r*', for backwards compatibility. (encode_array): Use HOST_WIDE_INT_PRINT_DEC instead of "%ld". (encode_type): Handle the 'const' qualifier here. (objc_parmlist): New global variable, sued by objc_push_parm and objc_get_parm_info(). (objc_push_parm, objc_get_parm_info): New functions. (objc_expr_last): Remove function. (synth_self_and_ucmd_args): For instance methods, use the instance type for 'self'; call objc_push_parm() instead of push_parm_decl(). (start_method_def): Do not call push_scope(), declare_parm_level(), pop_scope(), push_parm_decl(), store_parm_decls() or objc_expr_last(); just use objc_push_parm() and objc_get_parm_info(). (comp_method_with_proto): Remove function. (objc_types_are_equivalent): Strip away indirections before comparing underlying types. (comp_proto_with_proto): Do not call groktypename(); types are no longer in raw declspec format. (objc_start_function): New function. (really_start_method): Call comp_proto_with_proto() instead of comp_method_with_proto(); call objc_start_function() instead of hand-crafting a function declarator. (continue_method_def, objc_expand_function_end): Remove functions. (get_super_receiver): Call objc_get_current_scope() instead of get_current_scope(); reference 'super_class' field (instead of 'class'). (finish_method_def): Rename to objc_finish_method_definition() and add a function decl parameter; move method encoding call from objc_expand_function_end(). (is_complex_decl, adorn_decl, gen_declarator, gen_declspecs, gen_declaration_1): Remove functions. (tmpbuf, RAW_DECLSPEC): Remove. (gen_declaration): Remove second parameter; simplify to deal with TYPE_P nodes instead of raw declspecs. (gen_type_name, gen_type_name_0): New functions. (gen_method_decl): Remove second parameter; call gen_type_name() instead of gen_declaration_1(). (dump_interface): Adjust calls to gen_declaration() and gen_method_decl(); do not allocate a separate string buffer. (init_objc): Allocate a larger string buffer to accommodate dump_interface(); adjust call to build_module_descriptor(); add call to build_module_initializer_routine() for the GNU runtime. (generate_classref_translation_entry): Do not call start_decl(); call finish_var_decl() instead of finish_decl(); call convert() instead of build_c_cast(). * objc-act.h (CLASS_OWN_IVARS): Remove accessor. (CLASS_BINFO_ELTS): Reduce from 6 to 5, now that CLASS_OWN_IVARS is gone. (OCTI_GNU_INIT_DECL, GNU_INIT_decl): New. (OCTI_ELLIPSIS_NODE, objc_ellipsis_node): Remove. (OCTI_ID_ID, id_type, objc_id_id): Rename to OCTI_ID_NAME, objc_object_type and objc_object_name, respectively. (OCTI_CLS_REF, OCTI_CLASS_NAME, objc_class_reference, objc_class_name): New. (IS_CLASS): New macro. (IS_ID, IS_SUPER): Robustify. (OCTI_EXECCLASS_DECL, execclass_decl): New. (finish_file, start_class, continue_class, finish_class, start_method_def, continue_method_def, finish_method_def, start_protocol, finish_protocol, objc_build_throw_stmt, objc_build_try_catch_finally_stmt, objc_build_synchronized_prologue, objc_build_synchronized_epilogue, objc_build_try_prologue, objc_build_try_epilogue, objc_build_catch_stmt, objc_build_catch_epilogue, objc_build_finally_prologue, objc_build_finally_epilogue, is_ivar, is_private, is_public, add_instance_variable, objc_add_method, get_super_receiver, objc_clear_super_receiver, get_class_ivars_from_name, get_class_reference, get_static_reference, get_object_reference, build_message_expr, finish_message_expr, build_selector_expr, build_ivar_reference, build_keyword_decl, build_method_decl, build_protocol_expr, build_objc_string_object, objc_declare_alias, objc_declare_class, objc_declare_protocols, objc_comptypes, objc_check_decl, build_encode_expr): Remove prototypes. (imp_count, cat_count): Make GGC-aware. (OBJC_SET_TYPE_NAME): New macro. From-SVN: r87168
2004-09-08 02:49:44 +02:00
tree ret;
type = TYPE_MAIN_VARIANT (type);
Makefile.in (c-parse.o): Depend on $(C_COMMON_H). [gcc/ChangeLog] 2004-09-07 Ziemowit Laski <zlaski@apple.com> * Makefile.in (c-parse.o): Depend on $(C_COMMON_H). * c-parse.in: Include c-common.h instead of objc-act.h. (ivar_decl_list, ivar_decls, ivar_decl, ivars, ivar_declarator, myparms, myparm): Remove %type declarations. (methodtype, optparms, OBJC_TYPE_QUAL, objc_quals, objc_qual, objc_typename, objc_try_catch_stmt, optellipsis): Add %type declarations. (objc_inherit_code, objc_public_flag): Remove. (typespec_nonreserved_nonattr): Call objc_get_protocol_qualified_type() instead of get_static_reference() and get_protocol_reference(). (stmt_nocomp): Call grokparm() on @catch parameter. (objcdef): Move semantic action to objc_finish_implementation(). (classdef): Move semantic action to objc_start_class_interface(), objc_continue_interface(), objc_finish_interface(), objc_start_class_implementation(), objc_continue_implementation(), objc_start_category_interface() and objc_start_category_implementation(). (protocoldef): Move semantic actions to objc_start_protocol() and objc_finish_interface(). (ivar_decl_list): Remove nonterminal. (visibility_spec): Move semantic actions to objc_set_visibility(). (ivar_decls): Remove assignment to $$. (ivar_decl): Rephrase in terms of component_decl; call objc_add_instance_variable(). (ivars, ivar_declarator): Remove nonterminals. (opt_semi): New nonterminal. (methodtype): Remove semantic actions. (methoddef): Move semantic actions to objc_set_method_type(), objc_start_method_definition() and objc_finish_method_definition(). (methodproto): Move semantic actions to objc_set_method_type() and objc_add_method_declaration(). (methoddecl): Use objc_typename instead of typename; move semantic actions to objc_build_method_signature(). (optarglist, myxdecls, mydecl, myparms, myparm): Remove nonterminals. (optparmlist): Express in terms of optparms and optellipsis. (optparms, optellipsis, objc_qual, objc_quals, objc_typename): New nonterminals. (keyworddecl): Use objc_typename instead of typename. (rid_to_yy): Mark RID_IN, RID_OUT, RID_INOUT, RID_BYCOPY, RID_BYREF and RID_ONEWAY as returning OBJC_TYPE_QUAL to yyparse(). [gcc/objc/ChangeLog] 2004-09-07 Ziemowit Laski <zlaski@apple.com> * Make-lang.in (objc/objc-parse.o): Depend on $(C_COMMON_H) instead of objc/objc-act.h. (objc/objc-act.o): Depend on $(HASHTAB_H). * objc-act.c: Include hashtab.h; in ObjC++ mode, include cp-tree.h and objcp-decl.h instead of c-tree.h. (build_module_descriptor, get_class_ivars, synth_id_with_class_suffix, error_with_ivar, gen_method_decl, gen_declaration, setup_string_decl, build_protocol_template): Adjust prototypes. (build_module_initializer_routine, start_class, continue_class, finish_class, start_method_def, objc_start_function, start_protocol, build_method_decl, objc_add_method, add_instance_variable, build_ivar_reference, is_ivar, is_private, get_super_receiver, build_selector_table_decl, objc_push_parm, objc_get_parm_info, gen_type_name, gen_type_name_0, start_var_decl, finish_var_decl, create_field_decl): New prototypes. (objc_expand_function_end, comp_method_with_proto, objc_expr_last, gen_declaration_1, gen_declarator, is_complex_decl, adorn_decl, define_decl, create_builtin_decl, gen_declspecs): Remove prototypes. (TYPE_ID): Rename to OBJECT_TYPEDEF_NAME. (CLASS_TYPEDEF_NAME): New. (TAG_EXECCLASS): Change from a global variable to a #define. (TAG_RETURN_STRUCT): Delete. (TAG_GNUINIT): New, holds '__objc_gnu_init' name. (objc_inherit_code, objc_public_flag): New, moved from c-parse.in. (string_descriptor): New struct. (string_htab): New hash table. (string_hash, string_eq): New prototypes. (generate_struct_by_value_array): Call create_field_decl() instead of create_builtin_decl(). (objc_init): Do not initialize objc_ellipsis_node or TAG_EXECCLASS; In ObjC++ mode, call cxx_init() instead of c_objc_common_init(). (objc_finish_file): In ObjC++, call instantiate_pending_templates() and cp_finish_file(). (define_decl, get_static_reference, get_protocol_reference, create_builtin_decl): Remove functions. (objc_start_class_interface, objc_start_category_interface, objc_start_protocol, objc_continue_interface, objc_finish_interface, objc_start_class_implementation, objc_start_category_implementation, objc_continue_implementation, objc_finish_implementation, objc_set_visibility, objc_set_method_type, objc_build_method_signature, objc_add_method_declaration, objc_start_method_definition, objc_add_instance_variable, objc_get_protocol_qualified_type, create_field_decl, start_var_decl, finish_var_decl): New functions. (setup_string_decl): Simplify since it is only called once. (synth_module_prologue): Call build_class_template(); predefine 'id' and 'Class' as typedefs; rename 'temp_type' to 'type'; disable debug hooks for duration of function; fix GNU runtime messenger signatures to correspond to reality; forward-declare '__objc_exec_class' for the GNU runtime; call build_selector_table_decl(); in ObjC++ mode, generate 'extern "C" { ... }' wrappers around synthesized declarations; call build_protocol_template() and build_category_template(). (string_hash, string_eq): New functions. (objc_build_string_object): Check metaclass correctness only once; store string literals in hash table. (objc_build_constructor): Do not convert initializer elements; adjust for ObjC++ impedance mismatch. (build_objc_symtab_template): Call create_field_decl() instead of create_builtin_decl(). (init_objc_symtab): Add missing conversion to initializer element. (build_metadata_decl): Call start_var_decl() instead of define_decl(). (generate_objc_symtab_decl): Do not call build_category_template(); call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(). (build_module_descriptor): Call create_field_decl() instead of grokfield(); call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(); always mark module descriptor as used; move GNU runtime-specific functionality to build_module_initializer_routine(). (build_module_initializer_routine): New function, broken off of build_module_descriptor(). (objc_static_init_needed_p, objc_generate_static_init_call): New functions. (generate_static_references, generate_strings, build_selector_translation_table, generate_descriptor_table, generate_ivars_list, generate_dispatch_table, generate_category): Call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(); build a type directly instead of via groktypename(). (build_selector_reference_decl, build_selector_table_decl, build_class_reference_decl, build_protocol_reference, generate_objc_image_info): Call start_var_decl() instead of build_decl(). (build_selector_reference): For GNU runtime, do not call build_selector_reference_decl(). (build_selector, build_typed_selector_reference): Always convert result to the selector type. (add_objc_string): Cast return value to 'char *'. (build_method_prototype_template, build_selector_template, build_method_template): Use actual selector type for fields pointing to selectors. (finish_objc): For GNU runtime, call build_module_initializer_routine() after build_module_descriptor(). (generate_protocol_list, generate_shared_structures): Call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(); build a type directly instead of via groktypename(). (synth_id_with_class_suffix): Return a string. (get_arg_type_list): For instance methods, use the instance type for 'self'; do not call groktypename_in_parm_context(). (build_objc_string_decl): Squash redeclaration errors in ObjC++. (objc_is_class_name): Use OBJC_TYPE_NAME instead of TYPE_NAME; handle RECORD_TYPEs in ObjC as well as ObjC++. (objc_is_id): New function. (objc_is_object_ptr): Return the canonical type node. (objc_get_class_ivars): Simplify using get_class_ivars(). (get_class_ivars): Remove second parameter; create a fresh copy of the ivar list for each call; do not check for existence of super class. (objc_eh_runtime_type): Mark #ifndef OBJCPLUS. (objc_init_exceptions): When using SJLJ-style exceptions, require the use of '-fobjc-exceptions' flag; do not require it for DWARF-style exceptions. (objc_build_exc_ptr, next_sjlj_build_try_catch_finally): Use objc_object_type instead of objc_id_type. (objc_begin_catch_clause): Convert the incoming PARM_DECL into a VAR_DECL before placing it in the appropriate scope; do not call define_decl(); adjust call to c_begin_compound_stmt(); use objc_object_type instead of objc_id_type. (build_next_objc_exception_stuff): Call create_field_decl() instead of create_builtin_decl(); construct type directly instead of calling groktypename(); use OBJC_VOID_AT_END to mark end of function parameters. (build_private_template): Adjust call to get_class_ivars(); build a type directly instead of via groktypename(). (build_protocol_template, build_method_prototype_list_template, build_method_prototype_template, build_category_template, build_selector_template, build_class_template, build_super_template, build_ivar_template, build_ivar_list_template, build_method_list_template, build_method_template): Call create_field_decl() instead of grokfield(). (objc_method_parm_type): Do not call groktypename(). (generate_descriptor_table): Call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(). (generate_method_descriptors, build_protocol_initializer, generate_dispatch_tables, build_category_initializer, build_shared_structure_initializer): Do not call groktypename(). (generate_protocols): Call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(); do not call groktypename(). (error_with_ivar): Remove last parameter. (check_ivars): Do not iterate ovar CLASS_RAW_IVARS lists in addition to CLASS_IVARS lists; adjust calls to error_with_ivar(). (generate_ivar_lists): Convert one of the initializer elements; do not call groktypename(). (get_arg_type_list, start_method_def, gen_method_def): Account for new representation of variable arguments and '...' in Objective-C methods; add Objective-C++ impedance matching code. (is_objc_type_qualifier): Remove function. (adjust_type_for_id_default): Simplify; there is no longer a need to wade through declspecs. (lookup_interface, start_class, continue_class, finish_class, start_method_def, start_protocol, build_method_decl, objc_add_method, add_instance_variable, build_ivar_reference, is_ivar, is_private, get_super_receiver, objc_build_finally_epilogue): Make into static functions. (receiver_is_class_object): Use new IS_CLASS() macro. (objc_build_message_expr): Tweak ObjC++ message argument handling; call objc_finish_message_expr() instead of finish_message_expr(). (finish_message_expr): Rename to objc_finish_message_expr(); use OBJC_TYPE_NAME and OBJC_SET_TYPE_NAME macros instead of TYPE_NAME. call gen_type_name() instead of gen_declaration(); call objc_is_id() instead of using IS_ID and IS_CLASS; Use objc_class_name instead of calling get_identifier("Class"); handle CONVERT_EXPRs in receiver. (build_objc_method_call, warn_with_method): Do not call groktypename(). (build_ivar_reference): Call convert() instead of clobbering in a type. (hash_init): Initialize string_htab hash table. (add_instance_variable): Simplify parameter list; do not call grokfield(); do not populate CLASS_IVARS list. (start_class): Check for the existence of super class, if one was specified. (continue_class): Use CLASS_RAW_IVARS rather than CLASS_IVARS; do not call build_class_template(); adjust call to get_class_ivars(); call build_decl(), pushdecl() and finish_decl() instead of define_decl(). (finish_class): Call build_decl(), pushdecl() and finish_decl() instead of define_decl(). (add_protocols): Use PROTOCOL_BINFO_ELTS for the tree vector size. (start_protocol): Do not call build_protocol_template(); use PROTOCOL_BINFO_ELTS for the tree vector size. (encode_type_qualifiers): Do not handle the 'const' qualifier here. (encode_pointer): Encode 'const char *' as 'r*', for backwards compatibility. (encode_array): Use HOST_WIDE_INT_PRINT_DEC instead of "%ld". (encode_type): Handle the 'const' qualifier here. (objc_parmlist): New global variable, sued by objc_push_parm and objc_get_parm_info(). (objc_push_parm, objc_get_parm_info): New functions. (objc_expr_last): Remove function. (synth_self_and_ucmd_args): For instance methods, use the instance type for 'self'; call objc_push_parm() instead of push_parm_decl(). (start_method_def): Do not call push_scope(), declare_parm_level(), pop_scope(), push_parm_decl(), store_parm_decls() or objc_expr_last(); just use objc_push_parm() and objc_get_parm_info(). (comp_method_with_proto): Remove function. (objc_types_are_equivalent): Strip away indirections before comparing underlying types. (comp_proto_with_proto): Do not call groktypename(); types are no longer in raw declspec format. (objc_start_function): New function. (really_start_method): Call comp_proto_with_proto() instead of comp_method_with_proto(); call objc_start_function() instead of hand-crafting a function declarator. (continue_method_def, objc_expand_function_end): Remove functions. (get_super_receiver): Call objc_get_current_scope() instead of get_current_scope(); reference 'super_class' field (instead of 'class'). (finish_method_def): Rename to objc_finish_method_definition() and add a function decl parameter; move method encoding call from objc_expand_function_end(). (is_complex_decl, adorn_decl, gen_declarator, gen_declspecs, gen_declaration_1): Remove functions. (tmpbuf, RAW_DECLSPEC): Remove. (gen_declaration): Remove second parameter; simplify to deal with TYPE_P nodes instead of raw declspecs. (gen_type_name, gen_type_name_0): New functions. (gen_method_decl): Remove second parameter; call gen_type_name() instead of gen_declaration_1(). (dump_interface): Adjust calls to gen_declaration() and gen_method_decl(); do not allocate a separate string buffer. (init_objc): Allocate a larger string buffer to accommodate dump_interface(); adjust call to build_module_descriptor(); add call to build_module_initializer_routine() for the GNU runtime. (generate_classref_translation_entry): Do not call start_decl(); call finish_var_decl() instead of finish_decl(); call convert() instead of build_c_cast(). * objc-act.h (CLASS_OWN_IVARS): Remove accessor. (CLASS_BINFO_ELTS): Reduce from 6 to 5, now that CLASS_OWN_IVARS is gone. (OCTI_GNU_INIT_DECL, GNU_INIT_decl): New. (OCTI_ELLIPSIS_NODE, objc_ellipsis_node): Remove. (OCTI_ID_ID, id_type, objc_id_id): Rename to OCTI_ID_NAME, objc_object_type and objc_object_name, respectively. (OCTI_CLS_REF, OCTI_CLASS_NAME, objc_class_reference, objc_class_name): New. (IS_CLASS): New macro. (IS_ID, IS_SUPER): Robustify. (OCTI_EXECCLASS_DECL, execclass_decl): New. (finish_file, start_class, continue_class, finish_class, start_method_def, continue_method_def, finish_method_def, start_protocol, finish_protocol, objc_build_throw_stmt, objc_build_try_catch_finally_stmt, objc_build_synchronized_prologue, objc_build_synchronized_epilogue, objc_build_try_prologue, objc_build_try_epilogue, objc_build_catch_stmt, objc_build_catch_epilogue, objc_build_finally_prologue, objc_build_finally_epilogue, is_ivar, is_private, is_public, add_instance_variable, objc_add_method, get_super_receiver, objc_clear_super_receiver, get_class_ivars_from_name, get_class_reference, get_static_reference, get_object_reference, build_message_expr, finish_message_expr, build_selector_expr, build_ivar_reference, build_keyword_decl, build_method_decl, build_protocol_expr, build_objc_string_object, objc_declare_alias, objc_declare_class, objc_declare_protocols, objc_comptypes, objc_check_decl, build_encode_expr): Remove prototypes. (imp_count, cat_count): Make GGC-aware. (OBJC_SET_TYPE_NAME): New macro. From-SVN: r87168
2004-09-08 02:49:44 +02:00
if (!POINTER_TYPE_P (type))
return 0;
Makefile.in (c-parse.o): Depend on $(C_COMMON_H). [gcc/ChangeLog] 2004-09-07 Ziemowit Laski <zlaski@apple.com> * Makefile.in (c-parse.o): Depend on $(C_COMMON_H). * c-parse.in: Include c-common.h instead of objc-act.h. (ivar_decl_list, ivar_decls, ivar_decl, ivars, ivar_declarator, myparms, myparm): Remove %type declarations. (methodtype, optparms, OBJC_TYPE_QUAL, objc_quals, objc_qual, objc_typename, objc_try_catch_stmt, optellipsis): Add %type declarations. (objc_inherit_code, objc_public_flag): Remove. (typespec_nonreserved_nonattr): Call objc_get_protocol_qualified_type() instead of get_static_reference() and get_protocol_reference(). (stmt_nocomp): Call grokparm() on @catch parameter. (objcdef): Move semantic action to objc_finish_implementation(). (classdef): Move semantic action to objc_start_class_interface(), objc_continue_interface(), objc_finish_interface(), objc_start_class_implementation(), objc_continue_implementation(), objc_start_category_interface() and objc_start_category_implementation(). (protocoldef): Move semantic actions to objc_start_protocol() and objc_finish_interface(). (ivar_decl_list): Remove nonterminal. (visibility_spec): Move semantic actions to objc_set_visibility(). (ivar_decls): Remove assignment to $$. (ivar_decl): Rephrase in terms of component_decl; call objc_add_instance_variable(). (ivars, ivar_declarator): Remove nonterminals. (opt_semi): New nonterminal. (methodtype): Remove semantic actions. (methoddef): Move semantic actions to objc_set_method_type(), objc_start_method_definition() and objc_finish_method_definition(). (methodproto): Move semantic actions to objc_set_method_type() and objc_add_method_declaration(). (methoddecl): Use objc_typename instead of typename; move semantic actions to objc_build_method_signature(). (optarglist, myxdecls, mydecl, myparms, myparm): Remove nonterminals. (optparmlist): Express in terms of optparms and optellipsis. (optparms, optellipsis, objc_qual, objc_quals, objc_typename): New nonterminals. (keyworddecl): Use objc_typename instead of typename. (rid_to_yy): Mark RID_IN, RID_OUT, RID_INOUT, RID_BYCOPY, RID_BYREF and RID_ONEWAY as returning OBJC_TYPE_QUAL to yyparse(). [gcc/objc/ChangeLog] 2004-09-07 Ziemowit Laski <zlaski@apple.com> * Make-lang.in (objc/objc-parse.o): Depend on $(C_COMMON_H) instead of objc/objc-act.h. (objc/objc-act.o): Depend on $(HASHTAB_H). * objc-act.c: Include hashtab.h; in ObjC++ mode, include cp-tree.h and objcp-decl.h instead of c-tree.h. (build_module_descriptor, get_class_ivars, synth_id_with_class_suffix, error_with_ivar, gen_method_decl, gen_declaration, setup_string_decl, build_protocol_template): Adjust prototypes. (build_module_initializer_routine, start_class, continue_class, finish_class, start_method_def, objc_start_function, start_protocol, build_method_decl, objc_add_method, add_instance_variable, build_ivar_reference, is_ivar, is_private, get_super_receiver, build_selector_table_decl, objc_push_parm, objc_get_parm_info, gen_type_name, gen_type_name_0, start_var_decl, finish_var_decl, create_field_decl): New prototypes. (objc_expand_function_end, comp_method_with_proto, objc_expr_last, gen_declaration_1, gen_declarator, is_complex_decl, adorn_decl, define_decl, create_builtin_decl, gen_declspecs): Remove prototypes. (TYPE_ID): Rename to OBJECT_TYPEDEF_NAME. (CLASS_TYPEDEF_NAME): New. (TAG_EXECCLASS): Change from a global variable to a #define. (TAG_RETURN_STRUCT): Delete. (TAG_GNUINIT): New, holds '__objc_gnu_init' name. (objc_inherit_code, objc_public_flag): New, moved from c-parse.in. (string_descriptor): New struct. (string_htab): New hash table. (string_hash, string_eq): New prototypes. (generate_struct_by_value_array): Call create_field_decl() instead of create_builtin_decl(). (objc_init): Do not initialize objc_ellipsis_node or TAG_EXECCLASS; In ObjC++ mode, call cxx_init() instead of c_objc_common_init(). (objc_finish_file): In ObjC++, call instantiate_pending_templates() and cp_finish_file(). (define_decl, get_static_reference, get_protocol_reference, create_builtin_decl): Remove functions. (objc_start_class_interface, objc_start_category_interface, objc_start_protocol, objc_continue_interface, objc_finish_interface, objc_start_class_implementation, objc_start_category_implementation, objc_continue_implementation, objc_finish_implementation, objc_set_visibility, objc_set_method_type, objc_build_method_signature, objc_add_method_declaration, objc_start_method_definition, objc_add_instance_variable, objc_get_protocol_qualified_type, create_field_decl, start_var_decl, finish_var_decl): New functions. (setup_string_decl): Simplify since it is only called once. (synth_module_prologue): Call build_class_template(); predefine 'id' and 'Class' as typedefs; rename 'temp_type' to 'type'; disable debug hooks for duration of function; fix GNU runtime messenger signatures to correspond to reality; forward-declare '__objc_exec_class' for the GNU runtime; call build_selector_table_decl(); in ObjC++ mode, generate 'extern "C" { ... }' wrappers around synthesized declarations; call build_protocol_template() and build_category_template(). (string_hash, string_eq): New functions. (objc_build_string_object): Check metaclass correctness only once; store string literals in hash table. (objc_build_constructor): Do not convert initializer elements; adjust for ObjC++ impedance mismatch. (build_objc_symtab_template): Call create_field_decl() instead of create_builtin_decl(). (init_objc_symtab): Add missing conversion to initializer element. (build_metadata_decl): Call start_var_decl() instead of define_decl(). (generate_objc_symtab_decl): Do not call build_category_template(); call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(). (build_module_descriptor): Call create_field_decl() instead of grokfield(); call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(); always mark module descriptor as used; move GNU runtime-specific functionality to build_module_initializer_routine(). (build_module_initializer_routine): New function, broken off of build_module_descriptor(). (objc_static_init_needed_p, objc_generate_static_init_call): New functions. (generate_static_references, generate_strings, build_selector_translation_table, generate_descriptor_table, generate_ivars_list, generate_dispatch_table, generate_category): Call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(); build a type directly instead of via groktypename(). (build_selector_reference_decl, build_selector_table_decl, build_class_reference_decl, build_protocol_reference, generate_objc_image_info): Call start_var_decl() instead of build_decl(). (build_selector_reference): For GNU runtime, do not call build_selector_reference_decl(). (build_selector, build_typed_selector_reference): Always convert result to the selector type. (add_objc_string): Cast return value to 'char *'. (build_method_prototype_template, build_selector_template, build_method_template): Use actual selector type for fields pointing to selectors. (finish_objc): For GNU runtime, call build_module_initializer_routine() after build_module_descriptor(). (generate_protocol_list, generate_shared_structures): Call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(); build a type directly instead of via groktypename(). (synth_id_with_class_suffix): Return a string. (get_arg_type_list): For instance methods, use the instance type for 'self'; do not call groktypename_in_parm_context(). (build_objc_string_decl): Squash redeclaration errors in ObjC++. (objc_is_class_name): Use OBJC_TYPE_NAME instead of TYPE_NAME; handle RECORD_TYPEs in ObjC as well as ObjC++. (objc_is_id): New function. (objc_is_object_ptr): Return the canonical type node. (objc_get_class_ivars): Simplify using get_class_ivars(). (get_class_ivars): Remove second parameter; create a fresh copy of the ivar list for each call; do not check for existence of super class. (objc_eh_runtime_type): Mark #ifndef OBJCPLUS. (objc_init_exceptions): When using SJLJ-style exceptions, require the use of '-fobjc-exceptions' flag; do not require it for DWARF-style exceptions. (objc_build_exc_ptr, next_sjlj_build_try_catch_finally): Use objc_object_type instead of objc_id_type. (objc_begin_catch_clause): Convert the incoming PARM_DECL into a VAR_DECL before placing it in the appropriate scope; do not call define_decl(); adjust call to c_begin_compound_stmt(); use objc_object_type instead of objc_id_type. (build_next_objc_exception_stuff): Call create_field_decl() instead of create_builtin_decl(); construct type directly instead of calling groktypename(); use OBJC_VOID_AT_END to mark end of function parameters. (build_private_template): Adjust call to get_class_ivars(); build a type directly instead of via groktypename(). (build_protocol_template, build_method_prototype_list_template, build_method_prototype_template, build_category_template, build_selector_template, build_class_template, build_super_template, build_ivar_template, build_ivar_list_template, build_method_list_template, build_method_template): Call create_field_decl() instead of grokfield(). (objc_method_parm_type): Do not call groktypename(). (generate_descriptor_table): Call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(). (generate_method_descriptors, build_protocol_initializer, generate_dispatch_tables, build_category_initializer, build_shared_structure_initializer): Do not call groktypename(). (generate_protocols): Call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(); do not call groktypename(). (error_with_ivar): Remove last parameter. (check_ivars): Do not iterate ovar CLASS_RAW_IVARS lists in addition to CLASS_IVARS lists; adjust calls to error_with_ivar(). (generate_ivar_lists): Convert one of the initializer elements; do not call groktypename(). (get_arg_type_list, start_method_def, gen_method_def): Account for new representation of variable arguments and '...' in Objective-C methods; add Objective-C++ impedance matching code. (is_objc_type_qualifier): Remove function. (adjust_type_for_id_default): Simplify; there is no longer a need to wade through declspecs. (lookup_interface, start_class, continue_class, finish_class, start_method_def, start_protocol, build_method_decl, objc_add_method, add_instance_variable, build_ivar_reference, is_ivar, is_private, get_super_receiver, objc_build_finally_epilogue): Make into static functions. (receiver_is_class_object): Use new IS_CLASS() macro. (objc_build_message_expr): Tweak ObjC++ message argument handling; call objc_finish_message_expr() instead of finish_message_expr(). (finish_message_expr): Rename to objc_finish_message_expr(); use OBJC_TYPE_NAME and OBJC_SET_TYPE_NAME macros instead of TYPE_NAME. call gen_type_name() instead of gen_declaration(); call objc_is_id() instead of using IS_ID and IS_CLASS; Use objc_class_name instead of calling get_identifier("Class"); handle CONVERT_EXPRs in receiver. (build_objc_method_call, warn_with_method): Do not call groktypename(). (build_ivar_reference): Call convert() instead of clobbering in a type. (hash_init): Initialize string_htab hash table. (add_instance_variable): Simplify parameter list; do not call grokfield(); do not populate CLASS_IVARS list. (start_class): Check for the existence of super class, if one was specified. (continue_class): Use CLASS_RAW_IVARS rather than CLASS_IVARS; do not call build_class_template(); adjust call to get_class_ivars(); call build_decl(), pushdecl() and finish_decl() instead of define_decl(). (finish_class): Call build_decl(), pushdecl() and finish_decl() instead of define_decl(). (add_protocols): Use PROTOCOL_BINFO_ELTS for the tree vector size. (start_protocol): Do not call build_protocol_template(); use PROTOCOL_BINFO_ELTS for the tree vector size. (encode_type_qualifiers): Do not handle the 'const' qualifier here. (encode_pointer): Encode 'const char *' as 'r*', for backwards compatibility. (encode_array): Use HOST_WIDE_INT_PRINT_DEC instead of "%ld". (encode_type): Handle the 'const' qualifier here. (objc_parmlist): New global variable, sued by objc_push_parm and objc_get_parm_info(). (objc_push_parm, objc_get_parm_info): New functions. (objc_expr_last): Remove function. (synth_self_and_ucmd_args): For instance methods, use the instance type for 'self'; call objc_push_parm() instead of push_parm_decl(). (start_method_def): Do not call push_scope(), declare_parm_level(), pop_scope(), push_parm_decl(), store_parm_decls() or objc_expr_last(); just use objc_push_parm() and objc_get_parm_info(). (comp_method_with_proto): Remove function. (objc_types_are_equivalent): Strip away indirections before comparing underlying types. (comp_proto_with_proto): Do not call groktypename(); types are no longer in raw declspec format. (objc_start_function): New function. (really_start_method): Call comp_proto_with_proto() instead of comp_method_with_proto(); call objc_start_function() instead of hand-crafting a function declarator. (continue_method_def, objc_expand_function_end): Remove functions. (get_super_receiver): Call objc_get_current_scope() instead of get_current_scope(); reference 'super_class' field (instead of 'class'). (finish_method_def): Rename to objc_finish_method_definition() and add a function decl parameter; move method encoding call from objc_expand_function_end(). (is_complex_decl, adorn_decl, gen_declarator, gen_declspecs, gen_declaration_1): Remove functions. (tmpbuf, RAW_DECLSPEC): Remove. (gen_declaration): Remove second parameter; simplify to deal with TYPE_P nodes instead of raw declspecs. (gen_type_name, gen_type_name_0): New functions. (gen_method_decl): Remove second parameter; call gen_type_name() instead of gen_declaration_1(). (dump_interface): Adjust calls to gen_declaration() and gen_method_decl(); do not allocate a separate string buffer. (init_objc): Allocate a larger string buffer to accommodate dump_interface(); adjust call to build_module_descriptor(); add call to build_module_initializer_routine() for the GNU runtime. (generate_classref_translation_entry): Do not call start_decl(); call finish_var_decl() instead of finish_decl(); call convert() instead of build_c_cast(). * objc-act.h (CLASS_OWN_IVARS): Remove accessor. (CLASS_BINFO_ELTS): Reduce from 6 to 5, now that CLASS_OWN_IVARS is gone. (OCTI_GNU_INIT_DECL, GNU_INIT_decl): New. (OCTI_ELLIPSIS_NODE, objc_ellipsis_node): Remove. (OCTI_ID_ID, id_type, objc_id_id): Rename to OCTI_ID_NAME, objc_object_type and objc_object_name, respectively. (OCTI_CLS_REF, OCTI_CLASS_NAME, objc_class_reference, objc_class_name): New. (IS_CLASS): New macro. (IS_ID, IS_SUPER): Robustify. (OCTI_EXECCLASS_DECL, execclass_decl): New. (finish_file, start_class, continue_class, finish_class, start_method_def, continue_method_def, finish_method_def, start_protocol, finish_protocol, objc_build_throw_stmt, objc_build_try_catch_finally_stmt, objc_build_synchronized_prologue, objc_build_synchronized_epilogue, objc_build_try_prologue, objc_build_try_epilogue, objc_build_catch_stmt, objc_build_catch_epilogue, objc_build_finally_prologue, objc_build_finally_epilogue, is_ivar, is_private, is_public, add_instance_variable, objc_add_method, get_super_receiver, objc_clear_super_receiver, get_class_ivars_from_name, get_class_reference, get_static_reference, get_object_reference, build_message_expr, finish_message_expr, build_selector_expr, build_ivar_reference, build_keyword_decl, build_method_decl, build_protocol_expr, build_objc_string_object, objc_declare_alias, objc_declare_class, objc_declare_protocols, objc_comptypes, objc_check_decl, build_encode_expr): Remove prototypes. (imp_count, cat_count): Make GGC-aware. (OBJC_SET_TYPE_NAME): New macro. From-SVN: r87168
2004-09-08 02:49:44 +02:00
ret = objc_is_id (type);
if (!ret)
ret = objc_is_class_name (TREE_TYPE (type));
return ret;
1992-01-18 00:15:38 +01:00
}
Yet more Objective-C++... * objc-act.c (objc_finish_try_stmt): Add return value. (objc_build_synchronized): Likewise. * objc-act.c (objc_is_gcable_type): Add. (objc_substitute_decl): Add. (objc_build_ivar_assignment): Add. (objc_build_global_assignment): Add. (objc_build_strong_cast_assignment): Add. (objc_is_ivar_reference_p): Add. (objc_is_global_reference_p): Add. (objc_generate_write_barrier): Add. (objc_rewrite_function_call): Add. (objc_gimplify_expr): Add Objective-C++ support. * objc-act.h (ALLOC_OBJC_TYPE_LANG_SPECIFIC): Likewise. (SIZEOF_OBJC_TYPE_LANG_SPECIFIC): Add. (INIT_TYPE_OBJC_INFO): Add Objective-C++ support. (DUP_TYPE_OBJC_INFO): Likewise. (struct imp_entry): Add field has_cxx_cdtors. (struct imp_entry *imp_list): Add OCTI_UMSG_FAST_DECL, OCTI_METH_LIST_TEMPL, OCTI_METH_PROTO_LIST_TEMPL, OCTI_IVAR_LIST_TEMPL, OCTI_ASSIGN_IVAR_DECL, OCTI_ASSIGN_IVAR_FAST_DECL, OCTI_ASSIGN_GLOBAL_DECL, OCTI_ASSIGN_STRONGCAST_DECL. (umsg_fast_decl): Add. (objc_assign_ivar_decl): Add. (objc_assign_ivar_fast_decl): Add. (objc_assign_global_decl): Add. (objc_assign_strong_cast_decl): Add. (objc_method_list_ptr): Add. (objc_method_proto_list_ptr): Add. (objc_ivar_list_ptr): Add. * objc-act.c (should_call_super_dealloc): Add. (OBJC_VERSION): Bump to 6. (objc_is_gcable_type): Add. (objc_substitute_decl): Add. (objc_build_ivar_assignment): Add. (objc_build_global_assignment): Add. (objc_build_strong_cast_assignment): Add. (objc_is_gcable_p): Add. (objc_is_ivar_reference_p): Add. (objc_is_global_reference_p): Add. (generate_shared_structures): Add flags parameter. (objc_generate_cxx_ctor_or_dtor): Add. (objc_generate_cxx_cdtors): Add. (add_class): Add name parameter. (objc_types_share_size_and_alignment): Add. (comp_proto_with_proto): Add strict parameter. (CLS_HAS_CXX_STRUCTORS): Add. (TAG_ASSIGNIVAR): Add. (TAG_ASSIGNGLOBAL): Add. (TAG_ASSIGNSTRONGCAST): Add. (TAG_MSGSEND_FAST): Add. (TAG_ASSIGNIVAR_FAST): Add. (TAG_CXX_CONSTRUCT): Add. (TAG_CXX_DESTRUCT): Add. (OBJC_LOOKUP_CLASS): Add. (OBJC_LOOKUP_NO_SUPER): Add. (objc_finish_file): Add pch support. (objc_finish_implementation): Add Objective-C++ support. (synth_module_prologue): Likewise. (synth_module_prologue): Add fast dispatching. (objc_get_class_reference): Add Objective-C++ support. (objc_generate_write_barrier): Likewise. (next_sjlj_build_enter_and_setjmp): Likewise. (objc_begin_try_stmt): Likewise. (build_next_objc_exception_stuff): Add fast ivar support. (build_private_template): Mark the record as used so debug information is generated. (build_protocol_template): Add Objective-C++ support. (objc_method_parm_type) Likewise. (objc_generate_cxx_ctor_or_dtor): Likewise. (objc_generate_cxx_cdtors): Likewise. (build_protocol_initializer): Likewise. (build_category_template): Likewise. (build_class_template): Likewise. (build_method_list_template): Likewise. (build_category_initializer): Likewise. (build_shared_structure_initializer): Likewise. (objc_finish_message_expr): Likewise. (build_objc_method_call): Add fast dispatch support. (lookup_method_static): Add support to end search at superclasses. (add_method_to_hash_list): Add strict parameter to comp_proto_with_proto. (objc_add_method): Likewise. (objc_add_method): Also set the interface_value. (add_instance_variable): Add Objective-C++ support. (objc_is_public): Likewise. (start_class): Likewise. (continue_class): Likewise. (encode_aggregate_within): Likewise. (start_method_def): Likewise. (objc_start_function): Clear current_function_returns_value and current_function_returns_null. (really_start_method): Add Objective-C++ support. (objc_finish_method_definition): Add warning for missing [super dealloc]. (finish_objc): Add Objective-C++ support. (generate_objc_image_info): Likewise. (objc_lookup_ivar): Likewise. * objc-act.h (TYPE_HAS_OBJC_INFO): Likewise. (INIT_TYPE_OBJC_INFO): Likewise. (DUP_TYPE_OBJC_INFO): Likewise. From-SVN: r99857
2005-05-17 22:07:08 +02:00
static int
objc_is_gcable_type (tree type, int or_strong_p)
{
tree name;
Yet more Objective-C++... * objc-act.c (objc_finish_try_stmt): Add return value. (objc_build_synchronized): Likewise. * objc-act.c (objc_is_gcable_type): Add. (objc_substitute_decl): Add. (objc_build_ivar_assignment): Add. (objc_build_global_assignment): Add. (objc_build_strong_cast_assignment): Add. (objc_is_ivar_reference_p): Add. (objc_is_global_reference_p): Add. (objc_generate_write_barrier): Add. (objc_rewrite_function_call): Add. (objc_gimplify_expr): Add Objective-C++ support. * objc-act.h (ALLOC_OBJC_TYPE_LANG_SPECIFIC): Likewise. (SIZEOF_OBJC_TYPE_LANG_SPECIFIC): Add. (INIT_TYPE_OBJC_INFO): Add Objective-C++ support. (DUP_TYPE_OBJC_INFO): Likewise. (struct imp_entry): Add field has_cxx_cdtors. (struct imp_entry *imp_list): Add OCTI_UMSG_FAST_DECL, OCTI_METH_LIST_TEMPL, OCTI_METH_PROTO_LIST_TEMPL, OCTI_IVAR_LIST_TEMPL, OCTI_ASSIGN_IVAR_DECL, OCTI_ASSIGN_IVAR_FAST_DECL, OCTI_ASSIGN_GLOBAL_DECL, OCTI_ASSIGN_STRONGCAST_DECL. (umsg_fast_decl): Add. (objc_assign_ivar_decl): Add. (objc_assign_ivar_fast_decl): Add. (objc_assign_global_decl): Add. (objc_assign_strong_cast_decl): Add. (objc_method_list_ptr): Add. (objc_method_proto_list_ptr): Add. (objc_ivar_list_ptr): Add. * objc-act.c (should_call_super_dealloc): Add. (OBJC_VERSION): Bump to 6. (objc_is_gcable_type): Add. (objc_substitute_decl): Add. (objc_build_ivar_assignment): Add. (objc_build_global_assignment): Add. (objc_build_strong_cast_assignment): Add. (objc_is_gcable_p): Add. (objc_is_ivar_reference_p): Add. (objc_is_global_reference_p): Add. (generate_shared_structures): Add flags parameter. (objc_generate_cxx_ctor_or_dtor): Add. (objc_generate_cxx_cdtors): Add. (add_class): Add name parameter. (objc_types_share_size_and_alignment): Add. (comp_proto_with_proto): Add strict parameter. (CLS_HAS_CXX_STRUCTORS): Add. (TAG_ASSIGNIVAR): Add. (TAG_ASSIGNGLOBAL): Add. (TAG_ASSIGNSTRONGCAST): Add. (TAG_MSGSEND_FAST): Add. (TAG_ASSIGNIVAR_FAST): Add. (TAG_CXX_CONSTRUCT): Add. (TAG_CXX_DESTRUCT): Add. (OBJC_LOOKUP_CLASS): Add. (OBJC_LOOKUP_NO_SUPER): Add. (objc_finish_file): Add pch support. (objc_finish_implementation): Add Objective-C++ support. (synth_module_prologue): Likewise. (synth_module_prologue): Add fast dispatching. (objc_get_class_reference): Add Objective-C++ support. (objc_generate_write_barrier): Likewise. (next_sjlj_build_enter_and_setjmp): Likewise. (objc_begin_try_stmt): Likewise. (build_next_objc_exception_stuff): Add fast ivar support. (build_private_template): Mark the record as used so debug information is generated. (build_protocol_template): Add Objective-C++ support. (objc_method_parm_type) Likewise. (objc_generate_cxx_ctor_or_dtor): Likewise. (objc_generate_cxx_cdtors): Likewise. (build_protocol_initializer): Likewise. (build_category_template): Likewise. (build_class_template): Likewise. (build_method_list_template): Likewise. (build_category_initializer): Likewise. (build_shared_structure_initializer): Likewise. (objc_finish_message_expr): Likewise. (build_objc_method_call): Add fast dispatch support. (lookup_method_static): Add support to end search at superclasses. (add_method_to_hash_list): Add strict parameter to comp_proto_with_proto. (objc_add_method): Likewise. (objc_add_method): Also set the interface_value. (add_instance_variable): Add Objective-C++ support. (objc_is_public): Likewise. (start_class): Likewise. (continue_class): Likewise. (encode_aggregate_within): Likewise. (start_method_def): Likewise. (objc_start_function): Clear current_function_returns_value and current_function_returns_null. (really_start_method): Add Objective-C++ support. (objc_finish_method_definition): Add warning for missing [super dealloc]. (finish_objc): Add Objective-C++ support. (generate_objc_image_info): Likewise. (objc_lookup_ivar): Likewise. * objc-act.h (TYPE_HAS_OBJC_INFO): Likewise. (INIT_TYPE_OBJC_INFO): Likewise. (DUP_TYPE_OBJC_INFO): Likewise. From-SVN: r99857
2005-05-17 22:07:08 +02:00
if (!TYPE_P (type))
return 0;
if (objc_is_id (TYPE_MAIN_VARIANT (type)))
return 1;
if (or_strong_p && lookup_attribute ("objc_gc", TYPE_ATTRIBUTES (type)))
return 1;
if (TREE_CODE (type) != POINTER_TYPE && TREE_CODE (type) != INDIRECT_REF)
return 0;
type = TREE_TYPE (type);
if (TREE_CODE (type) != RECORD_TYPE)
return 0;
name = TYPE_NAME (type);
return (objc_is_class_name (name) != NULL_TREE);
}
static tree
Yet more Objective-C++... * objc-act.c (objc_finish_try_stmt): Add return value. (objc_build_synchronized): Likewise. * objc-act.c (objc_is_gcable_type): Add. (objc_substitute_decl): Add. (objc_build_ivar_assignment): Add. (objc_build_global_assignment): Add. (objc_build_strong_cast_assignment): Add. (objc_is_ivar_reference_p): Add. (objc_is_global_reference_p): Add. (objc_generate_write_barrier): Add. (objc_rewrite_function_call): Add. (objc_gimplify_expr): Add Objective-C++ support. * objc-act.h (ALLOC_OBJC_TYPE_LANG_SPECIFIC): Likewise. (SIZEOF_OBJC_TYPE_LANG_SPECIFIC): Add. (INIT_TYPE_OBJC_INFO): Add Objective-C++ support. (DUP_TYPE_OBJC_INFO): Likewise. (struct imp_entry): Add field has_cxx_cdtors. (struct imp_entry *imp_list): Add OCTI_UMSG_FAST_DECL, OCTI_METH_LIST_TEMPL, OCTI_METH_PROTO_LIST_TEMPL, OCTI_IVAR_LIST_TEMPL, OCTI_ASSIGN_IVAR_DECL, OCTI_ASSIGN_IVAR_FAST_DECL, OCTI_ASSIGN_GLOBAL_DECL, OCTI_ASSIGN_STRONGCAST_DECL. (umsg_fast_decl): Add. (objc_assign_ivar_decl): Add. (objc_assign_ivar_fast_decl): Add. (objc_assign_global_decl): Add. (objc_assign_strong_cast_decl): Add. (objc_method_list_ptr): Add. (objc_method_proto_list_ptr): Add. (objc_ivar_list_ptr): Add. * objc-act.c (should_call_super_dealloc): Add. (OBJC_VERSION): Bump to 6. (objc_is_gcable_type): Add. (objc_substitute_decl): Add. (objc_build_ivar_assignment): Add. (objc_build_global_assignment): Add. (objc_build_strong_cast_assignment): Add. (objc_is_gcable_p): Add. (objc_is_ivar_reference_p): Add. (objc_is_global_reference_p): Add. (generate_shared_structures): Add flags parameter. (objc_generate_cxx_ctor_or_dtor): Add. (objc_generate_cxx_cdtors): Add. (add_class): Add name parameter. (objc_types_share_size_and_alignment): Add. (comp_proto_with_proto): Add strict parameter. (CLS_HAS_CXX_STRUCTORS): Add. (TAG_ASSIGNIVAR): Add. (TAG_ASSIGNGLOBAL): Add. (TAG_ASSIGNSTRONGCAST): Add. (TAG_MSGSEND_FAST): Add. (TAG_ASSIGNIVAR_FAST): Add. (TAG_CXX_CONSTRUCT): Add. (TAG_CXX_DESTRUCT): Add. (OBJC_LOOKUP_CLASS): Add. (OBJC_LOOKUP_NO_SUPER): Add. (objc_finish_file): Add pch support. (objc_finish_implementation): Add Objective-C++ support. (synth_module_prologue): Likewise. (synth_module_prologue): Add fast dispatching. (objc_get_class_reference): Add Objective-C++ support. (objc_generate_write_barrier): Likewise. (next_sjlj_build_enter_and_setjmp): Likewise. (objc_begin_try_stmt): Likewise. (build_next_objc_exception_stuff): Add fast ivar support. (build_private_template): Mark the record as used so debug information is generated. (build_protocol_template): Add Objective-C++ support. (objc_method_parm_type) Likewise. (objc_generate_cxx_ctor_or_dtor): Likewise. (objc_generate_cxx_cdtors): Likewise. (build_protocol_initializer): Likewise. (build_category_template): Likewise. (build_class_template): Likewise. (build_method_list_template): Likewise. (build_category_initializer): Likewise. (build_shared_structure_initializer): Likewise. (objc_finish_message_expr): Likewise. (build_objc_method_call): Add fast dispatch support. (lookup_method_static): Add support to end search at superclasses. (add_method_to_hash_list): Add strict parameter to comp_proto_with_proto. (objc_add_method): Likewise. (objc_add_method): Also set the interface_value. (add_instance_variable): Add Objective-C++ support. (objc_is_public): Likewise. (start_class): Likewise. (continue_class): Likewise. (encode_aggregate_within): Likewise. (start_method_def): Likewise. (objc_start_function): Clear current_function_returns_value and current_function_returns_null. (really_start_method): Add Objective-C++ support. (objc_finish_method_definition): Add warning for missing [super dealloc]. (finish_objc): Add Objective-C++ support. (generate_objc_image_info): Likewise. (objc_lookup_ivar): Likewise. * objc-act.h (TYPE_HAS_OBJC_INFO): Likewise. (INIT_TYPE_OBJC_INFO): Likewise. (DUP_TYPE_OBJC_INFO): Likewise. From-SVN: r99857
2005-05-17 22:07:08 +02:00
objc_substitute_decl (tree expr, tree oldexpr, tree newexpr)
{
if (expr == oldexpr)
return newexpr;
switch (TREE_CODE (expr))
{
case COMPONENT_REF:
objc-act.c (objc_build_struct): New function. * objc-act.c (objc_build_struct): New function. (objc_derived_from_p): Likewise. (objc_build_component_ref): Likewise. (objc_copy_binfo): Likewise. (objc_xref_basetypes): Likewise. (objc_lookup_protocol): Likewise. (objc_compare_protocols): Likewise. (objc_volatilize_decl): Likewise. (encode_aggregate_fields): Likewise. (volatilized_hash): Likewise. (volatilized_eq): Likewise. (objc_compare_types): Likewise. (objc_type_quals_match): Likewise. (DERIVED_FROM_P): New ObjC macro, corresponding to C++ macro of same name. (get_class_ivars): Add second parameter indicating if entire hierarchy is desired. (struct volatilized_type): New type. (volatilized_htab): New hash table. (objc_types_compatible_p, objc_comptypes): Remove functions. (synth_module_prologue): Do not initialize 'unused_list'. (objc_get_class_reference): Fix ObjC++ impedance mismatches. (objc_declare_alias): Implement as a typedef. (objc_substitute_decl, objc_gimplify_expr): Reformat. (objc_get_class_ivars): Adjust call to get_class_ivars(). (next_sjlj_build_enter_and_setjmp, synth_forward_declarations, build_ivar_reference, get_super_receiver): Call objc_build_component_ref() instead of build_component_ref(). (objc_begin_catch_clause): Use DERIVED_FROM_P() instead of objc_comptypes(). (build_private_template): Call objc_build_struct() instead of start_struct() and finish_struct(). (hash_init): Initialize volatilized_htab. (objc_is_public): Adjust calls to objc_get_ivars(); adjust ObjC++ impedance mismatches. (encode_aggregate_within): Streamline by calling encode_aggregate_fields(). * objc-act.h (objc_types_compatible_p): Remove prototype. (OCTI_UNUSED_LIST, unused_list): Remove slot. * objc-lang.c (LANG_HOOKS_TYPES_COMPATIBLE_P): Remove. From-SVN: r100123
2005-05-25 00:21:01 +02:00
return objc_build_component_ref
(objc_substitute_decl (TREE_OPERAND (expr, 0),
oldexpr,
newexpr),
DECL_NAME (TREE_OPERAND (expr, 1)));
Yet more Objective-C++... * objc-act.c (objc_finish_try_stmt): Add return value. (objc_build_synchronized): Likewise. * objc-act.c (objc_is_gcable_type): Add. (objc_substitute_decl): Add. (objc_build_ivar_assignment): Add. (objc_build_global_assignment): Add. (objc_build_strong_cast_assignment): Add. (objc_is_ivar_reference_p): Add. (objc_is_global_reference_p): Add. (objc_generate_write_barrier): Add. (objc_rewrite_function_call): Add. (objc_gimplify_expr): Add Objective-C++ support. * objc-act.h (ALLOC_OBJC_TYPE_LANG_SPECIFIC): Likewise. (SIZEOF_OBJC_TYPE_LANG_SPECIFIC): Add. (INIT_TYPE_OBJC_INFO): Add Objective-C++ support. (DUP_TYPE_OBJC_INFO): Likewise. (struct imp_entry): Add field has_cxx_cdtors. (struct imp_entry *imp_list): Add OCTI_UMSG_FAST_DECL, OCTI_METH_LIST_TEMPL, OCTI_METH_PROTO_LIST_TEMPL, OCTI_IVAR_LIST_TEMPL, OCTI_ASSIGN_IVAR_DECL, OCTI_ASSIGN_IVAR_FAST_DECL, OCTI_ASSIGN_GLOBAL_DECL, OCTI_ASSIGN_STRONGCAST_DECL. (umsg_fast_decl): Add. (objc_assign_ivar_decl): Add. (objc_assign_ivar_fast_decl): Add. (objc_assign_global_decl): Add. (objc_assign_strong_cast_decl): Add. (objc_method_list_ptr): Add. (objc_method_proto_list_ptr): Add. (objc_ivar_list_ptr): Add. * objc-act.c (should_call_super_dealloc): Add. (OBJC_VERSION): Bump to 6. (objc_is_gcable_type): Add. (objc_substitute_decl): Add. (objc_build_ivar_assignment): Add. (objc_build_global_assignment): Add. (objc_build_strong_cast_assignment): Add. (objc_is_gcable_p): Add. (objc_is_ivar_reference_p): Add. (objc_is_global_reference_p): Add. (generate_shared_structures): Add flags parameter. (objc_generate_cxx_ctor_or_dtor): Add. (objc_generate_cxx_cdtors): Add. (add_class): Add name parameter. (objc_types_share_size_and_alignment): Add. (comp_proto_with_proto): Add strict parameter. (CLS_HAS_CXX_STRUCTORS): Add. (TAG_ASSIGNIVAR): Add. (TAG_ASSIGNGLOBAL): Add. (TAG_ASSIGNSTRONGCAST): Add. (TAG_MSGSEND_FAST): Add. (TAG_ASSIGNIVAR_FAST): Add. (TAG_CXX_CONSTRUCT): Add. (TAG_CXX_DESTRUCT): Add. (OBJC_LOOKUP_CLASS): Add. (OBJC_LOOKUP_NO_SUPER): Add. (objc_finish_file): Add pch support. (objc_finish_implementation): Add Objective-C++ support. (synth_module_prologue): Likewise. (synth_module_prologue): Add fast dispatching. (objc_get_class_reference): Add Objective-C++ support. (objc_generate_write_barrier): Likewise. (next_sjlj_build_enter_and_setjmp): Likewise. (objc_begin_try_stmt): Likewise. (build_next_objc_exception_stuff): Add fast ivar support. (build_private_template): Mark the record as used so debug information is generated. (build_protocol_template): Add Objective-C++ support. (objc_method_parm_type) Likewise. (objc_generate_cxx_ctor_or_dtor): Likewise. (objc_generate_cxx_cdtors): Likewise. (build_protocol_initializer): Likewise. (build_category_template): Likewise. (build_class_template): Likewise. (build_method_list_template): Likewise. (build_category_initializer): Likewise. (build_shared_structure_initializer): Likewise. (objc_finish_message_expr): Likewise. (build_objc_method_call): Add fast dispatch support. (lookup_method_static): Add support to end search at superclasses. (add_method_to_hash_list): Add strict parameter to comp_proto_with_proto. (objc_add_method): Likewise. (objc_add_method): Also set the interface_value. (add_instance_variable): Add Objective-C++ support. (objc_is_public): Likewise. (start_class): Likewise. (continue_class): Likewise. (encode_aggregate_within): Likewise. (start_method_def): Likewise. (objc_start_function): Clear current_function_returns_value and current_function_returns_null. (really_start_method): Add Objective-C++ support. (objc_finish_method_definition): Add warning for missing [super dealloc]. (finish_objc): Add Objective-C++ support. (generate_objc_image_info): Likewise. (objc_lookup_ivar): Likewise. * objc-act.h (TYPE_HAS_OBJC_INFO): Likewise. (INIT_TYPE_OBJC_INFO): Likewise. (DUP_TYPE_OBJC_INFO): Likewise. From-SVN: r99857
2005-05-17 22:07:08 +02:00
case ARRAY_REF:
return build_array_ref (objc_substitute_decl (TREE_OPERAND (expr, 0),
oldexpr,
newexpr),
TREE_OPERAND (expr, 1));
case INDIRECT_REF:
return build_indirect_ref (objc_substitute_decl (TREE_OPERAND (expr, 0),
oldexpr,
newexpr), "->");
default:
return expr;
}
}
static tree
objc_build_ivar_assignment (tree outervar, tree lhs, tree rhs)
1992-01-18 00:15:38 +01:00
{
Yet more Objective-C++... * objc-act.c (objc_finish_try_stmt): Add return value. (objc_build_synchronized): Likewise. * objc-act.c (objc_is_gcable_type): Add. (objc_substitute_decl): Add. (objc_build_ivar_assignment): Add. (objc_build_global_assignment): Add. (objc_build_strong_cast_assignment): Add. (objc_is_ivar_reference_p): Add. (objc_is_global_reference_p): Add. (objc_generate_write_barrier): Add. (objc_rewrite_function_call): Add. (objc_gimplify_expr): Add Objective-C++ support. * objc-act.h (ALLOC_OBJC_TYPE_LANG_SPECIFIC): Likewise. (SIZEOF_OBJC_TYPE_LANG_SPECIFIC): Add. (INIT_TYPE_OBJC_INFO): Add Objective-C++ support. (DUP_TYPE_OBJC_INFO): Likewise. (struct imp_entry): Add field has_cxx_cdtors. (struct imp_entry *imp_list): Add OCTI_UMSG_FAST_DECL, OCTI_METH_LIST_TEMPL, OCTI_METH_PROTO_LIST_TEMPL, OCTI_IVAR_LIST_TEMPL, OCTI_ASSIGN_IVAR_DECL, OCTI_ASSIGN_IVAR_FAST_DECL, OCTI_ASSIGN_GLOBAL_DECL, OCTI_ASSIGN_STRONGCAST_DECL. (umsg_fast_decl): Add. (objc_assign_ivar_decl): Add. (objc_assign_ivar_fast_decl): Add. (objc_assign_global_decl): Add. (objc_assign_strong_cast_decl): Add. (objc_method_list_ptr): Add. (objc_method_proto_list_ptr): Add. (objc_ivar_list_ptr): Add. * objc-act.c (should_call_super_dealloc): Add. (OBJC_VERSION): Bump to 6. (objc_is_gcable_type): Add. (objc_substitute_decl): Add. (objc_build_ivar_assignment): Add. (objc_build_global_assignment): Add. (objc_build_strong_cast_assignment): Add. (objc_is_gcable_p): Add. (objc_is_ivar_reference_p): Add. (objc_is_global_reference_p): Add. (generate_shared_structures): Add flags parameter. (objc_generate_cxx_ctor_or_dtor): Add. (objc_generate_cxx_cdtors): Add. (add_class): Add name parameter. (objc_types_share_size_and_alignment): Add. (comp_proto_with_proto): Add strict parameter. (CLS_HAS_CXX_STRUCTORS): Add. (TAG_ASSIGNIVAR): Add. (TAG_ASSIGNGLOBAL): Add. (TAG_ASSIGNSTRONGCAST): Add. (TAG_MSGSEND_FAST): Add. (TAG_ASSIGNIVAR_FAST): Add. (TAG_CXX_CONSTRUCT): Add. (TAG_CXX_DESTRUCT): Add. (OBJC_LOOKUP_CLASS): Add. (OBJC_LOOKUP_NO_SUPER): Add. (objc_finish_file): Add pch support. (objc_finish_implementation): Add Objective-C++ support. (synth_module_prologue): Likewise. (synth_module_prologue): Add fast dispatching. (objc_get_class_reference): Add Objective-C++ support. (objc_generate_write_barrier): Likewise. (next_sjlj_build_enter_and_setjmp): Likewise. (objc_begin_try_stmt): Likewise. (build_next_objc_exception_stuff): Add fast ivar support. (build_private_template): Mark the record as used so debug information is generated. (build_protocol_template): Add Objective-C++ support. (objc_method_parm_type) Likewise. (objc_generate_cxx_ctor_or_dtor): Likewise. (objc_generate_cxx_cdtors): Likewise. (build_protocol_initializer): Likewise. (build_category_template): Likewise. (build_class_template): Likewise. (build_method_list_template): Likewise. (build_category_initializer): Likewise. (build_shared_structure_initializer): Likewise. (objc_finish_message_expr): Likewise. (build_objc_method_call): Add fast dispatch support. (lookup_method_static): Add support to end search at superclasses. (add_method_to_hash_list): Add strict parameter to comp_proto_with_proto. (objc_add_method): Likewise. (objc_add_method): Also set the interface_value. (add_instance_variable): Add Objective-C++ support. (objc_is_public): Likewise. (start_class): Likewise. (continue_class): Likewise. (encode_aggregate_within): Likewise. (start_method_def): Likewise. (objc_start_function): Clear current_function_returns_value and current_function_returns_null. (really_start_method): Add Objective-C++ support. (objc_finish_method_definition): Add warning for missing [super dealloc]. (finish_objc): Add Objective-C++ support. (generate_objc_image_info): Likewise. (objc_lookup_ivar): Likewise. * objc-act.h (TYPE_HAS_OBJC_INFO): Likewise. (INIT_TYPE_OBJC_INFO): Likewise. (DUP_TYPE_OBJC_INFO): Likewise. From-SVN: r99857
2005-05-17 22:07:08 +02:00
tree func_params;
/* The LHS parameter contains the expression 'outervar->memberspec';
we need to transform it into '&((typeof(outervar) *) 0)->memberspec',
where memberspec may be arbitrarily complex (e.g., 'g->f.d[2].g[3]').
*/
tree offs
= objc_substitute_decl
(lhs, outervar, convert (TREE_TYPE (outervar), integer_zero_node));
tree func
= (flag_objc_direct_dispatch
? objc_assign_ivar_fast_decl
: objc_assign_ivar_decl);
offs = convert (integer_type_node, build_unary_op (ADDR_EXPR, offs, 0));
offs = fold (offs);
func_params = tree_cons (NULL_TREE,
Yet more Objective-C++... * objc-act.c (objc_finish_try_stmt): Add return value. (objc_build_synchronized): Likewise. * objc-act.c (objc_is_gcable_type): Add. (objc_substitute_decl): Add. (objc_build_ivar_assignment): Add. (objc_build_global_assignment): Add. (objc_build_strong_cast_assignment): Add. (objc_is_ivar_reference_p): Add. (objc_is_global_reference_p): Add. (objc_generate_write_barrier): Add. (objc_rewrite_function_call): Add. (objc_gimplify_expr): Add Objective-C++ support. * objc-act.h (ALLOC_OBJC_TYPE_LANG_SPECIFIC): Likewise. (SIZEOF_OBJC_TYPE_LANG_SPECIFIC): Add. (INIT_TYPE_OBJC_INFO): Add Objective-C++ support. (DUP_TYPE_OBJC_INFO): Likewise. (struct imp_entry): Add field has_cxx_cdtors. (struct imp_entry *imp_list): Add OCTI_UMSG_FAST_DECL, OCTI_METH_LIST_TEMPL, OCTI_METH_PROTO_LIST_TEMPL, OCTI_IVAR_LIST_TEMPL, OCTI_ASSIGN_IVAR_DECL, OCTI_ASSIGN_IVAR_FAST_DECL, OCTI_ASSIGN_GLOBAL_DECL, OCTI_ASSIGN_STRONGCAST_DECL. (umsg_fast_decl): Add. (objc_assign_ivar_decl): Add. (objc_assign_ivar_fast_decl): Add. (objc_assign_global_decl): Add. (objc_assign_strong_cast_decl): Add. (objc_method_list_ptr): Add. (objc_method_proto_list_ptr): Add. (objc_ivar_list_ptr): Add. * objc-act.c (should_call_super_dealloc): Add. (OBJC_VERSION): Bump to 6. (objc_is_gcable_type): Add. (objc_substitute_decl): Add. (objc_build_ivar_assignment): Add. (objc_build_global_assignment): Add. (objc_build_strong_cast_assignment): Add. (objc_is_gcable_p): Add. (objc_is_ivar_reference_p): Add. (objc_is_global_reference_p): Add. (generate_shared_structures): Add flags parameter. (objc_generate_cxx_ctor_or_dtor): Add. (objc_generate_cxx_cdtors): Add. (add_class): Add name parameter. (objc_types_share_size_and_alignment): Add. (comp_proto_with_proto): Add strict parameter. (CLS_HAS_CXX_STRUCTORS): Add. (TAG_ASSIGNIVAR): Add. (TAG_ASSIGNGLOBAL): Add. (TAG_ASSIGNSTRONGCAST): Add. (TAG_MSGSEND_FAST): Add. (TAG_ASSIGNIVAR_FAST): Add. (TAG_CXX_CONSTRUCT): Add. (TAG_CXX_DESTRUCT): Add. (OBJC_LOOKUP_CLASS): Add. (OBJC_LOOKUP_NO_SUPER): Add. (objc_finish_file): Add pch support. (objc_finish_implementation): Add Objective-C++ support. (synth_module_prologue): Likewise. (synth_module_prologue): Add fast dispatching. (objc_get_class_reference): Add Objective-C++ support. (objc_generate_write_barrier): Likewise. (next_sjlj_build_enter_and_setjmp): Likewise. (objc_begin_try_stmt): Likewise. (build_next_objc_exception_stuff): Add fast ivar support. (build_private_template): Mark the record as used so debug information is generated. (build_protocol_template): Add Objective-C++ support. (objc_method_parm_type) Likewise. (objc_generate_cxx_ctor_or_dtor): Likewise. (objc_generate_cxx_cdtors): Likewise. (build_protocol_initializer): Likewise. (build_category_template): Likewise. (build_class_template): Likewise. (build_method_list_template): Likewise. (build_category_initializer): Likewise. (build_shared_structure_initializer): Likewise. (objc_finish_message_expr): Likewise. (build_objc_method_call): Add fast dispatch support. (lookup_method_static): Add support to end search at superclasses. (add_method_to_hash_list): Add strict parameter to comp_proto_with_proto. (objc_add_method): Likewise. (objc_add_method): Also set the interface_value. (add_instance_variable): Add Objective-C++ support. (objc_is_public): Likewise. (start_class): Likewise. (continue_class): Likewise. (encode_aggregate_within): Likewise. (start_method_def): Likewise. (objc_start_function): Clear current_function_returns_value and current_function_returns_null. (really_start_method): Add Objective-C++ support. (objc_finish_method_definition): Add warning for missing [super dealloc]. (finish_objc): Add Objective-C++ support. (generate_objc_image_info): Likewise. (objc_lookup_ivar): Likewise. * objc-act.h (TYPE_HAS_OBJC_INFO): Likewise. (INIT_TYPE_OBJC_INFO): Likewise. (DUP_TYPE_OBJC_INFO): Likewise. From-SVN: r99857
2005-05-17 22:07:08 +02:00
convert (objc_object_type, rhs),
tree_cons (NULL_TREE, convert (objc_object_type, outervar),
tree_cons (NULL_TREE, offs,
NULL_TREE)));
assemble_external (func);
return build_function_call (func, func_params);
}
static tree
objc_build_global_assignment (tree lhs, tree rhs)
{
tree func_params = tree_cons (NULL_TREE,
convert (objc_object_type, rhs),
tree_cons (NULL_TREE, convert (build_pointer_type (objc_object_type),
build_unary_op (ADDR_EXPR, lhs, 0)),
NULL_TREE));
assemble_external (objc_assign_global_decl);
return build_function_call (objc_assign_global_decl, func_params);
}
static tree
objc_build_strong_cast_assignment (tree lhs, tree rhs)
{
tree func_params = tree_cons (NULL_TREE,
convert (objc_object_type, rhs),
tree_cons (NULL_TREE, convert (build_pointer_type (objc_object_type),
build_unary_op (ADDR_EXPR, lhs, 0)),
Yet more Objective-C++... * objc-act.c (objc_finish_try_stmt): Add return value. (objc_build_synchronized): Likewise. * objc-act.c (objc_is_gcable_type): Add. (objc_substitute_decl): Add. (objc_build_ivar_assignment): Add. (objc_build_global_assignment): Add. (objc_build_strong_cast_assignment): Add. (objc_is_ivar_reference_p): Add. (objc_is_global_reference_p): Add. (objc_generate_write_barrier): Add. (objc_rewrite_function_call): Add. (objc_gimplify_expr): Add Objective-C++ support. * objc-act.h (ALLOC_OBJC_TYPE_LANG_SPECIFIC): Likewise. (SIZEOF_OBJC_TYPE_LANG_SPECIFIC): Add. (INIT_TYPE_OBJC_INFO): Add Objective-C++ support. (DUP_TYPE_OBJC_INFO): Likewise. (struct imp_entry): Add field has_cxx_cdtors. (struct imp_entry *imp_list): Add OCTI_UMSG_FAST_DECL, OCTI_METH_LIST_TEMPL, OCTI_METH_PROTO_LIST_TEMPL, OCTI_IVAR_LIST_TEMPL, OCTI_ASSIGN_IVAR_DECL, OCTI_ASSIGN_IVAR_FAST_DECL, OCTI_ASSIGN_GLOBAL_DECL, OCTI_ASSIGN_STRONGCAST_DECL. (umsg_fast_decl): Add. (objc_assign_ivar_decl): Add. (objc_assign_ivar_fast_decl): Add. (objc_assign_global_decl): Add. (objc_assign_strong_cast_decl): Add. (objc_method_list_ptr): Add. (objc_method_proto_list_ptr): Add. (objc_ivar_list_ptr): Add. * objc-act.c (should_call_super_dealloc): Add. (OBJC_VERSION): Bump to 6. (objc_is_gcable_type): Add. (objc_substitute_decl): Add. (objc_build_ivar_assignment): Add. (objc_build_global_assignment): Add. (objc_build_strong_cast_assignment): Add. (objc_is_gcable_p): Add. (objc_is_ivar_reference_p): Add. (objc_is_global_reference_p): Add. (generate_shared_structures): Add flags parameter. (objc_generate_cxx_ctor_or_dtor): Add. (objc_generate_cxx_cdtors): Add. (add_class): Add name parameter. (objc_types_share_size_and_alignment): Add. (comp_proto_with_proto): Add strict parameter. (CLS_HAS_CXX_STRUCTORS): Add. (TAG_ASSIGNIVAR): Add. (TAG_ASSIGNGLOBAL): Add. (TAG_ASSIGNSTRONGCAST): Add. (TAG_MSGSEND_FAST): Add. (TAG_ASSIGNIVAR_FAST): Add. (TAG_CXX_CONSTRUCT): Add. (TAG_CXX_DESTRUCT): Add. (OBJC_LOOKUP_CLASS): Add. (OBJC_LOOKUP_NO_SUPER): Add. (objc_finish_file): Add pch support. (objc_finish_implementation): Add Objective-C++ support. (synth_module_prologue): Likewise. (synth_module_prologue): Add fast dispatching. (objc_get_class_reference): Add Objective-C++ support. (objc_generate_write_barrier): Likewise. (next_sjlj_build_enter_and_setjmp): Likewise. (objc_begin_try_stmt): Likewise. (build_next_objc_exception_stuff): Add fast ivar support. (build_private_template): Mark the record as used so debug information is generated. (build_protocol_template): Add Objective-C++ support. (objc_method_parm_type) Likewise. (objc_generate_cxx_ctor_or_dtor): Likewise. (objc_generate_cxx_cdtors): Likewise. (build_protocol_initializer): Likewise. (build_category_template): Likewise. (build_class_template): Likewise. (build_method_list_template): Likewise. (build_category_initializer): Likewise. (build_shared_structure_initializer): Likewise. (objc_finish_message_expr): Likewise. (build_objc_method_call): Add fast dispatch support. (lookup_method_static): Add support to end search at superclasses. (add_method_to_hash_list): Add strict parameter to comp_proto_with_proto. (objc_add_method): Likewise. (objc_add_method): Also set the interface_value. (add_instance_variable): Add Objective-C++ support. (objc_is_public): Likewise. (start_class): Likewise. (continue_class): Likewise. (encode_aggregate_within): Likewise. (start_method_def): Likewise. (objc_start_function): Clear current_function_returns_value and current_function_returns_null. (really_start_method): Add Objective-C++ support. (objc_finish_method_definition): Add warning for missing [super dealloc]. (finish_objc): Add Objective-C++ support. (generate_objc_image_info): Likewise. (objc_lookup_ivar): Likewise. * objc-act.h (TYPE_HAS_OBJC_INFO): Likewise. (INIT_TYPE_OBJC_INFO): Likewise. (DUP_TYPE_OBJC_INFO): Likewise. From-SVN: r99857
2005-05-17 22:07:08 +02:00
NULL_TREE));
assemble_external (objc_assign_strong_cast_decl);
return build_function_call (objc_assign_strong_cast_decl, func_params);
}
static int
objc_is_gcable_p (tree expr)
{
return (TREE_CODE (expr) == COMPONENT_REF
? objc_is_gcable_p (TREE_OPERAND (expr, 1))
: TREE_CODE (expr) == ARRAY_REF
? (objc_is_gcable_p (TREE_TYPE (expr))
|| objc_is_gcable_p (TREE_OPERAND (expr, 0)))
: TREE_CODE (expr) == ARRAY_TYPE
? objc_is_gcable_p (TREE_TYPE (expr))
: TYPE_P (expr)
? objc_is_gcable_type (expr, 1)
: (objc_is_gcable_p (TREE_TYPE (expr))
|| (DECL_P (expr)
&& lookup_attribute ("objc_gc", DECL_ATTRIBUTES (expr)))));
}
static int
objc_is_ivar_reference_p (tree expr)
{
return (TREE_CODE (expr) == ARRAY_REF
? objc_is_ivar_reference_p (TREE_OPERAND (expr, 0))
: TREE_CODE (expr) == COMPONENT_REF
? TREE_CODE (TREE_OPERAND (expr, 1)) == FIELD_DECL
: 0);
}
static int
objc_is_global_reference_p (tree expr)
{
return (TREE_CODE (expr) == INDIRECT_REF || TREE_CODE (expr) == PLUS_EXPR
? objc_is_global_reference_p (TREE_OPERAND (expr, 0))
: DECL_P (expr)
? (!DECL_CONTEXT (expr) || TREE_STATIC (expr))
: 0);
}
1992-01-18 00:15:38 +01:00
Yet more Objective-C++... * objc-act.c (objc_finish_try_stmt): Add return value. (objc_build_synchronized): Likewise. * objc-act.c (objc_is_gcable_type): Add. (objc_substitute_decl): Add. (objc_build_ivar_assignment): Add. (objc_build_global_assignment): Add. (objc_build_strong_cast_assignment): Add. (objc_is_ivar_reference_p): Add. (objc_is_global_reference_p): Add. (objc_generate_write_barrier): Add. (objc_rewrite_function_call): Add. (objc_gimplify_expr): Add Objective-C++ support. * objc-act.h (ALLOC_OBJC_TYPE_LANG_SPECIFIC): Likewise. (SIZEOF_OBJC_TYPE_LANG_SPECIFIC): Add. (INIT_TYPE_OBJC_INFO): Add Objective-C++ support. (DUP_TYPE_OBJC_INFO): Likewise. (struct imp_entry): Add field has_cxx_cdtors. (struct imp_entry *imp_list): Add OCTI_UMSG_FAST_DECL, OCTI_METH_LIST_TEMPL, OCTI_METH_PROTO_LIST_TEMPL, OCTI_IVAR_LIST_TEMPL, OCTI_ASSIGN_IVAR_DECL, OCTI_ASSIGN_IVAR_FAST_DECL, OCTI_ASSIGN_GLOBAL_DECL, OCTI_ASSIGN_STRONGCAST_DECL. (umsg_fast_decl): Add. (objc_assign_ivar_decl): Add. (objc_assign_ivar_fast_decl): Add. (objc_assign_global_decl): Add. (objc_assign_strong_cast_decl): Add. (objc_method_list_ptr): Add. (objc_method_proto_list_ptr): Add. (objc_ivar_list_ptr): Add. * objc-act.c (should_call_super_dealloc): Add. (OBJC_VERSION): Bump to 6. (objc_is_gcable_type): Add. (objc_substitute_decl): Add. (objc_build_ivar_assignment): Add. (objc_build_global_assignment): Add. (objc_build_strong_cast_assignment): Add. (objc_is_gcable_p): Add. (objc_is_ivar_reference_p): Add. (objc_is_global_reference_p): Add. (generate_shared_structures): Add flags parameter. (objc_generate_cxx_ctor_or_dtor): Add. (objc_generate_cxx_cdtors): Add. (add_class): Add name parameter. (objc_types_share_size_and_alignment): Add. (comp_proto_with_proto): Add strict parameter. (CLS_HAS_CXX_STRUCTORS): Add. (TAG_ASSIGNIVAR): Add. (TAG_ASSIGNGLOBAL): Add. (TAG_ASSIGNSTRONGCAST): Add. (TAG_MSGSEND_FAST): Add. (TAG_ASSIGNIVAR_FAST): Add. (TAG_CXX_CONSTRUCT): Add. (TAG_CXX_DESTRUCT): Add. (OBJC_LOOKUP_CLASS): Add. (OBJC_LOOKUP_NO_SUPER): Add. (objc_finish_file): Add pch support. (objc_finish_implementation): Add Objective-C++ support. (synth_module_prologue): Likewise. (synth_module_prologue): Add fast dispatching. (objc_get_class_reference): Add Objective-C++ support. (objc_generate_write_barrier): Likewise. (next_sjlj_build_enter_and_setjmp): Likewise. (objc_begin_try_stmt): Likewise. (build_next_objc_exception_stuff): Add fast ivar support. (build_private_template): Mark the record as used so debug information is generated. (build_protocol_template): Add Objective-C++ support. (objc_method_parm_type) Likewise. (objc_generate_cxx_ctor_or_dtor): Likewise. (objc_generate_cxx_cdtors): Likewise. (build_protocol_initializer): Likewise. (build_category_template): Likewise. (build_class_template): Likewise. (build_method_list_template): Likewise. (build_category_initializer): Likewise. (build_shared_structure_initializer): Likewise. (objc_finish_message_expr): Likewise. (build_objc_method_call): Add fast dispatch support. (lookup_method_static): Add support to end search at superclasses. (add_method_to_hash_list): Add strict parameter to comp_proto_with_proto. (objc_add_method): Likewise. (objc_add_method): Also set the interface_value. (add_instance_variable): Add Objective-C++ support. (objc_is_public): Likewise. (start_class): Likewise. (continue_class): Likewise. (encode_aggregate_within): Likewise. (start_method_def): Likewise. (objc_start_function): Clear current_function_returns_value and current_function_returns_null. (really_start_method): Add Objective-C++ support. (objc_finish_method_definition): Add warning for missing [super dealloc]. (finish_objc): Add Objective-C++ support. (generate_objc_image_info): Likewise. (objc_lookup_ivar): Likewise. * objc-act.h (TYPE_HAS_OBJC_INFO): Likewise. (INIT_TYPE_OBJC_INFO): Likewise. (DUP_TYPE_OBJC_INFO): Likewise. From-SVN: r99857
2005-05-17 22:07:08 +02:00
tree
objc_generate_write_barrier (tree lhs, enum tree_code modifycode, tree rhs)
{
tree result = NULL_TREE, outer;
int strong_cast_p = 0, outer_gc_p = 0, indirect_p = 0;
/* See if we have any lhs casts, and strip them out. NB: The lvalue casts
will have been transformed to the form '*(type *)&expr'. */
if (TREE_CODE (lhs) == INDIRECT_REF)
{
outer = TREE_OPERAND (lhs, 0);
while (!strong_cast_p
&& (TREE_CODE (outer) == CONVERT_EXPR
|| TREE_CODE (outer) == NOP_EXPR
|| TREE_CODE (outer) == NON_LVALUE_EXPR))
{
tree lhstype = TREE_TYPE (outer);
/* Descend down the cast chain, and record the first objc_gc
attribute found. */
if (POINTER_TYPE_P (lhstype))
{
tree attr
= lookup_attribute ("objc_gc",
TYPE_ATTRIBUTES (TREE_TYPE (lhstype)));
if (attr)
strong_cast_p = 1;
}
outer = TREE_OPERAND (outer, 0);
}
}
/* If we have a __strong cast, it trumps all else. */
if (strong_cast_p)
{
if (modifycode != NOP_EXPR)
goto invalid_pointer_arithmetic;
if (warn_assign_intercept)
warning (0, "strong-cast assignment has been intercepted");
result = objc_build_strong_cast_assignment (lhs, rhs);
goto exit_point;
}
/* the lhs must be of a suitable type, regardless of its underlying
structure. */
if (!objc_is_gcable_p (lhs))
goto exit_point;
outer = lhs;
while (outer
&& (TREE_CODE (outer) == COMPONENT_REF
|| TREE_CODE (outer) == ARRAY_REF))
outer = TREE_OPERAND (outer, 0);
if (TREE_CODE (outer) == INDIRECT_REF)
{
outer = TREE_OPERAND (outer, 0);
indirect_p = 1;
}
outer_gc_p = objc_is_gcable_p (outer);
Yet more Objective-C++... * objc-act.c (objc_finish_try_stmt): Add return value. (objc_build_synchronized): Likewise. * objc-act.c (objc_is_gcable_type): Add. (objc_substitute_decl): Add. (objc_build_ivar_assignment): Add. (objc_build_global_assignment): Add. (objc_build_strong_cast_assignment): Add. (objc_is_ivar_reference_p): Add. (objc_is_global_reference_p): Add. (objc_generate_write_barrier): Add. (objc_rewrite_function_call): Add. (objc_gimplify_expr): Add Objective-C++ support. * objc-act.h (ALLOC_OBJC_TYPE_LANG_SPECIFIC): Likewise. (SIZEOF_OBJC_TYPE_LANG_SPECIFIC): Add. (INIT_TYPE_OBJC_INFO): Add Objective-C++ support. (DUP_TYPE_OBJC_INFO): Likewise. (struct imp_entry): Add field has_cxx_cdtors. (struct imp_entry *imp_list): Add OCTI_UMSG_FAST_DECL, OCTI_METH_LIST_TEMPL, OCTI_METH_PROTO_LIST_TEMPL, OCTI_IVAR_LIST_TEMPL, OCTI_ASSIGN_IVAR_DECL, OCTI_ASSIGN_IVAR_FAST_DECL, OCTI_ASSIGN_GLOBAL_DECL, OCTI_ASSIGN_STRONGCAST_DECL. (umsg_fast_decl): Add. (objc_assign_ivar_decl): Add. (objc_assign_ivar_fast_decl): Add. (objc_assign_global_decl): Add. (objc_assign_strong_cast_decl): Add. (objc_method_list_ptr): Add. (objc_method_proto_list_ptr): Add. (objc_ivar_list_ptr): Add. * objc-act.c (should_call_super_dealloc): Add. (OBJC_VERSION): Bump to 6. (objc_is_gcable_type): Add. (objc_substitute_decl): Add. (objc_build_ivar_assignment): Add. (objc_build_global_assignment): Add. (objc_build_strong_cast_assignment): Add. (objc_is_gcable_p): Add. (objc_is_ivar_reference_p): Add. (objc_is_global_reference_p): Add. (generate_shared_structures): Add flags parameter. (objc_generate_cxx_ctor_or_dtor): Add. (objc_generate_cxx_cdtors): Add. (add_class): Add name parameter. (objc_types_share_size_and_alignment): Add. (comp_proto_with_proto): Add strict parameter. (CLS_HAS_CXX_STRUCTORS): Add. (TAG_ASSIGNIVAR): Add. (TAG_ASSIGNGLOBAL): Add. (TAG_ASSIGNSTRONGCAST): Add. (TAG_MSGSEND_FAST): Add. (TAG_ASSIGNIVAR_FAST): Add. (TAG_CXX_CONSTRUCT): Add. (TAG_CXX_DESTRUCT): Add. (OBJC_LOOKUP_CLASS): Add. (OBJC_LOOKUP_NO_SUPER): Add. (objc_finish_file): Add pch support. (objc_finish_implementation): Add Objective-C++ support. (synth_module_prologue): Likewise. (synth_module_prologue): Add fast dispatching. (objc_get_class_reference): Add Objective-C++ support. (objc_generate_write_barrier): Likewise. (next_sjlj_build_enter_and_setjmp): Likewise. (objc_begin_try_stmt): Likewise. (build_next_objc_exception_stuff): Add fast ivar support. (build_private_template): Mark the record as used so debug information is generated. (build_protocol_template): Add Objective-C++ support. (objc_method_parm_type) Likewise. (objc_generate_cxx_ctor_or_dtor): Likewise. (objc_generate_cxx_cdtors): Likewise. (build_protocol_initializer): Likewise. (build_category_template): Likewise. (build_class_template): Likewise. (build_method_list_template): Likewise. (build_category_initializer): Likewise. (build_shared_structure_initializer): Likewise. (objc_finish_message_expr): Likewise. (build_objc_method_call): Add fast dispatch support. (lookup_method_static): Add support to end search at superclasses. (add_method_to_hash_list): Add strict parameter to comp_proto_with_proto. (objc_add_method): Likewise. (objc_add_method): Also set the interface_value. (add_instance_variable): Add Objective-C++ support. (objc_is_public): Likewise. (start_class): Likewise. (continue_class): Likewise. (encode_aggregate_within): Likewise. (start_method_def): Likewise. (objc_start_function): Clear current_function_returns_value and current_function_returns_null. (really_start_method): Add Objective-C++ support. (objc_finish_method_definition): Add warning for missing [super dealloc]. (finish_objc): Add Objective-C++ support. (generate_objc_image_info): Likewise. (objc_lookup_ivar): Likewise. * objc-act.h (TYPE_HAS_OBJC_INFO): Likewise. (INIT_TYPE_OBJC_INFO): Likewise. (DUP_TYPE_OBJC_INFO): Likewise. From-SVN: r99857
2005-05-17 22:07:08 +02:00
/* Handle ivar assignments. */
if (objc_is_ivar_reference_p (lhs))
{
/* if the struct to the left of the ivar is not an Objective-C object (__strong
doesn't cut it here), the best we can do here is suggest a cast. */
if (!objc_is_gcable_type (TREE_TYPE (outer), 0))
{
/* We may still be able to use the global write barrier... */
if (!indirect_p && objc_is_global_reference_p (outer))
goto global_reference;
suggest_cast:
if (modifycode == NOP_EXPR)
{
if (warn_assign_intercept)
warning (0, "strong-cast may possibly be needed");
}
goto exit_point;
}
if (modifycode != NOP_EXPR)
goto invalid_pointer_arithmetic;
if (warn_assign_intercept)
warning (0, "instance variable assignment has been intercepted");
result = objc_build_ivar_assignment (outer, lhs, rhs);
goto exit_point;
}
/* Likewise, intercept assignment to global/static variables if their type is
GC-marked. */
Yet more Objective-C++... * objc-act.c (objc_finish_try_stmt): Add return value. (objc_build_synchronized): Likewise. * objc-act.c (objc_is_gcable_type): Add. (objc_substitute_decl): Add. (objc_build_ivar_assignment): Add. (objc_build_global_assignment): Add. (objc_build_strong_cast_assignment): Add. (objc_is_ivar_reference_p): Add. (objc_is_global_reference_p): Add. (objc_generate_write_barrier): Add. (objc_rewrite_function_call): Add. (objc_gimplify_expr): Add Objective-C++ support. * objc-act.h (ALLOC_OBJC_TYPE_LANG_SPECIFIC): Likewise. (SIZEOF_OBJC_TYPE_LANG_SPECIFIC): Add. (INIT_TYPE_OBJC_INFO): Add Objective-C++ support. (DUP_TYPE_OBJC_INFO): Likewise. (struct imp_entry): Add field has_cxx_cdtors. (struct imp_entry *imp_list): Add OCTI_UMSG_FAST_DECL, OCTI_METH_LIST_TEMPL, OCTI_METH_PROTO_LIST_TEMPL, OCTI_IVAR_LIST_TEMPL, OCTI_ASSIGN_IVAR_DECL, OCTI_ASSIGN_IVAR_FAST_DECL, OCTI_ASSIGN_GLOBAL_DECL, OCTI_ASSIGN_STRONGCAST_DECL. (umsg_fast_decl): Add. (objc_assign_ivar_decl): Add. (objc_assign_ivar_fast_decl): Add. (objc_assign_global_decl): Add. (objc_assign_strong_cast_decl): Add. (objc_method_list_ptr): Add. (objc_method_proto_list_ptr): Add. (objc_ivar_list_ptr): Add. * objc-act.c (should_call_super_dealloc): Add. (OBJC_VERSION): Bump to 6. (objc_is_gcable_type): Add. (objc_substitute_decl): Add. (objc_build_ivar_assignment): Add. (objc_build_global_assignment): Add. (objc_build_strong_cast_assignment): Add. (objc_is_gcable_p): Add. (objc_is_ivar_reference_p): Add. (objc_is_global_reference_p): Add. (generate_shared_structures): Add flags parameter. (objc_generate_cxx_ctor_or_dtor): Add. (objc_generate_cxx_cdtors): Add. (add_class): Add name parameter. (objc_types_share_size_and_alignment): Add. (comp_proto_with_proto): Add strict parameter. (CLS_HAS_CXX_STRUCTORS): Add. (TAG_ASSIGNIVAR): Add. (TAG_ASSIGNGLOBAL): Add. (TAG_ASSIGNSTRONGCAST): Add. (TAG_MSGSEND_FAST): Add. (TAG_ASSIGNIVAR_FAST): Add. (TAG_CXX_CONSTRUCT): Add. (TAG_CXX_DESTRUCT): Add. (OBJC_LOOKUP_CLASS): Add. (OBJC_LOOKUP_NO_SUPER): Add. (objc_finish_file): Add pch support. (objc_finish_implementation): Add Objective-C++ support. (synth_module_prologue): Likewise. (synth_module_prologue): Add fast dispatching. (objc_get_class_reference): Add Objective-C++ support. (objc_generate_write_barrier): Likewise. (next_sjlj_build_enter_and_setjmp): Likewise. (objc_begin_try_stmt): Likewise. (build_next_objc_exception_stuff): Add fast ivar support. (build_private_template): Mark the record as used so debug information is generated. (build_protocol_template): Add Objective-C++ support. (objc_method_parm_type) Likewise. (objc_generate_cxx_ctor_or_dtor): Likewise. (objc_generate_cxx_cdtors): Likewise. (build_protocol_initializer): Likewise. (build_category_template): Likewise. (build_class_template): Likewise. (build_method_list_template): Likewise. (build_category_initializer): Likewise. (build_shared_structure_initializer): Likewise. (objc_finish_message_expr): Likewise. (build_objc_method_call): Add fast dispatch support. (lookup_method_static): Add support to end search at superclasses. (add_method_to_hash_list): Add strict parameter to comp_proto_with_proto. (objc_add_method): Likewise. (objc_add_method): Also set the interface_value. (add_instance_variable): Add Objective-C++ support. (objc_is_public): Likewise. (start_class): Likewise. (continue_class): Likewise. (encode_aggregate_within): Likewise. (start_method_def): Likewise. (objc_start_function): Clear current_function_returns_value and current_function_returns_null. (really_start_method): Add Objective-C++ support. (objc_finish_method_definition): Add warning for missing [super dealloc]. (finish_objc): Add Objective-C++ support. (generate_objc_image_info): Likewise. (objc_lookup_ivar): Likewise. * objc-act.h (TYPE_HAS_OBJC_INFO): Likewise. (INIT_TYPE_OBJC_INFO): Likewise. (DUP_TYPE_OBJC_INFO): Likewise. From-SVN: r99857
2005-05-17 22:07:08 +02:00
if (objc_is_global_reference_p (outer))
{
if (indirect_p)
goto suggest_cast;
global_reference:
if (modifycode != NOP_EXPR)
{
invalid_pointer_arithmetic:
if (outer_gc_p)
warning (0, "pointer arithmetic for garbage-collected objects not allowed");
goto exit_point;
}
if (warn_assign_intercept)
warning (0, "global/static variable assignment has been intercepted");
result = objc_build_global_assignment (lhs, rhs);
}
/* In all other cases, fall back to the normal mechanism. */
exit_point:
return result;
}
struct interface_tuple GTY(())
{
Yet more Objective-C++... * objc-act.c (objc_finish_try_stmt): Add return value. (objc_build_synchronized): Likewise. * objc-act.c (objc_is_gcable_type): Add. (objc_substitute_decl): Add. (objc_build_ivar_assignment): Add. (objc_build_global_assignment): Add. (objc_build_strong_cast_assignment): Add. (objc_is_ivar_reference_p): Add. (objc_is_global_reference_p): Add. (objc_generate_write_barrier): Add. (objc_rewrite_function_call): Add. (objc_gimplify_expr): Add Objective-C++ support. * objc-act.h (ALLOC_OBJC_TYPE_LANG_SPECIFIC): Likewise. (SIZEOF_OBJC_TYPE_LANG_SPECIFIC): Add. (INIT_TYPE_OBJC_INFO): Add Objective-C++ support. (DUP_TYPE_OBJC_INFO): Likewise. (struct imp_entry): Add field has_cxx_cdtors. (struct imp_entry *imp_list): Add OCTI_UMSG_FAST_DECL, OCTI_METH_LIST_TEMPL, OCTI_METH_PROTO_LIST_TEMPL, OCTI_IVAR_LIST_TEMPL, OCTI_ASSIGN_IVAR_DECL, OCTI_ASSIGN_IVAR_FAST_DECL, OCTI_ASSIGN_GLOBAL_DECL, OCTI_ASSIGN_STRONGCAST_DECL. (umsg_fast_decl): Add. (objc_assign_ivar_decl): Add. (objc_assign_ivar_fast_decl): Add. (objc_assign_global_decl): Add. (objc_assign_strong_cast_decl): Add. (objc_method_list_ptr): Add. (objc_method_proto_list_ptr): Add. (objc_ivar_list_ptr): Add. * objc-act.c (should_call_super_dealloc): Add. (OBJC_VERSION): Bump to 6. (objc_is_gcable_type): Add. (objc_substitute_decl): Add. (objc_build_ivar_assignment): Add. (objc_build_global_assignment): Add. (objc_build_strong_cast_assignment): Add. (objc_is_gcable_p): Add. (objc_is_ivar_reference_p): Add. (objc_is_global_reference_p): Add. (generate_shared_structures): Add flags parameter. (objc_generate_cxx_ctor_or_dtor): Add. (objc_generate_cxx_cdtors): Add. (add_class): Add name parameter. (objc_types_share_size_and_alignment): Add. (comp_proto_with_proto): Add strict parameter. (CLS_HAS_CXX_STRUCTORS): Add. (TAG_ASSIGNIVAR): Add. (TAG_ASSIGNGLOBAL): Add. (TAG_ASSIGNSTRONGCAST): Add. (TAG_MSGSEND_FAST): Add. (TAG_ASSIGNIVAR_FAST): Add. (TAG_CXX_CONSTRUCT): Add. (TAG_CXX_DESTRUCT): Add. (OBJC_LOOKUP_CLASS): Add. (OBJC_LOOKUP_NO_SUPER): Add. (objc_finish_file): Add pch support. (objc_finish_implementation): Add Objective-C++ support. (synth_module_prologue): Likewise. (synth_module_prologue): Add fast dispatching. (objc_get_class_reference): Add Objective-C++ support. (objc_generate_write_barrier): Likewise. (next_sjlj_build_enter_and_setjmp): Likewise. (objc_begin_try_stmt): Likewise. (build_next_objc_exception_stuff): Add fast ivar support. (build_private_template): Mark the record as used so debug information is generated. (build_protocol_template): Add Objective-C++ support. (objc_method_parm_type) Likewise. (objc_generate_cxx_ctor_or_dtor): Likewise. (objc_generate_cxx_cdtors): Likewise. (build_protocol_initializer): Likewise. (build_category_template): Likewise. (build_class_template): Likewise. (build_method_list_template): Likewise. (build_category_initializer): Likewise. (build_shared_structure_initializer): Likewise. (objc_finish_message_expr): Likewise. (build_objc_method_call): Add fast dispatch support. (lookup_method_static): Add support to end search at superclasses. (add_method_to_hash_list): Add strict parameter to comp_proto_with_proto. (objc_add_method): Likewise. (objc_add_method): Also set the interface_value. (add_instance_variable): Add Objective-C++ support. (objc_is_public): Likewise. (start_class): Likewise. (continue_class): Likewise. (encode_aggregate_within): Likewise. (start_method_def): Likewise. (objc_start_function): Clear current_function_returns_value and current_function_returns_null. (really_start_method): Add Objective-C++ support. (objc_finish_method_definition): Add warning for missing [super dealloc]. (finish_objc): Add Objective-C++ support. (generate_objc_image_info): Likewise. (objc_lookup_ivar): Likewise. * objc-act.h (TYPE_HAS_OBJC_INFO): Likewise. (INIT_TYPE_OBJC_INFO): Likewise. (DUP_TYPE_OBJC_INFO): Likewise. From-SVN: r99857
2005-05-17 22:07:08 +02:00
tree id;
tree class_name;
};
static GTY ((param_is (struct interface_tuple))) htab_t interface_htab;
Yet more Objective-C++... * objc-act.c (objc_finish_try_stmt): Add return value. (objc_build_synchronized): Likewise. * objc-act.c (objc_is_gcable_type): Add. (objc_substitute_decl): Add. (objc_build_ivar_assignment): Add. (objc_build_global_assignment): Add. (objc_build_strong_cast_assignment): Add. (objc_is_ivar_reference_p): Add. (objc_is_global_reference_p): Add. (objc_generate_write_barrier): Add. (objc_rewrite_function_call): Add. (objc_gimplify_expr): Add Objective-C++ support. * objc-act.h (ALLOC_OBJC_TYPE_LANG_SPECIFIC): Likewise. (SIZEOF_OBJC_TYPE_LANG_SPECIFIC): Add. (INIT_TYPE_OBJC_INFO): Add Objective-C++ support. (DUP_TYPE_OBJC_INFO): Likewise. (struct imp_entry): Add field has_cxx_cdtors. (struct imp_entry *imp_list): Add OCTI_UMSG_FAST_DECL, OCTI_METH_LIST_TEMPL, OCTI_METH_PROTO_LIST_TEMPL, OCTI_IVAR_LIST_TEMPL, OCTI_ASSIGN_IVAR_DECL, OCTI_ASSIGN_IVAR_FAST_DECL, OCTI_ASSIGN_GLOBAL_DECL, OCTI_ASSIGN_STRONGCAST_DECL. (umsg_fast_decl): Add. (objc_assign_ivar_decl): Add. (objc_assign_ivar_fast_decl): Add. (objc_assign_global_decl): Add. (objc_assign_strong_cast_decl): Add. (objc_method_list_ptr): Add. (objc_method_proto_list_ptr): Add. (objc_ivar_list_ptr): Add. * objc-act.c (should_call_super_dealloc): Add. (OBJC_VERSION): Bump to 6. (objc_is_gcable_type): Add. (objc_substitute_decl): Add. (objc_build_ivar_assignment): Add. (objc_build_global_assignment): Add. (objc_build_strong_cast_assignment): Add. (objc_is_gcable_p): Add. (objc_is_ivar_reference_p): Add. (objc_is_global_reference_p): Add. (generate_shared_structures): Add flags parameter. (objc_generate_cxx_ctor_or_dtor): Add. (objc_generate_cxx_cdtors): Add. (add_class): Add name parameter. (objc_types_share_size_and_alignment): Add. (comp_proto_with_proto): Add strict parameter. (CLS_HAS_CXX_STRUCTORS): Add. (TAG_ASSIGNIVAR): Add. (TAG_ASSIGNGLOBAL): Add. (TAG_ASSIGNSTRONGCAST): Add. (TAG_MSGSEND_FAST): Add. (TAG_ASSIGNIVAR_FAST): Add. (TAG_CXX_CONSTRUCT): Add. (TAG_CXX_DESTRUCT): Add. (OBJC_LOOKUP_CLASS): Add. (OBJC_LOOKUP_NO_SUPER): Add. (objc_finish_file): Add pch support. (objc_finish_implementation): Add Objective-C++ support. (synth_module_prologue): Likewise. (synth_module_prologue): Add fast dispatching. (objc_get_class_reference): Add Objective-C++ support. (objc_generate_write_barrier): Likewise. (next_sjlj_build_enter_and_setjmp): Likewise. (objc_begin_try_stmt): Likewise. (build_next_objc_exception_stuff): Add fast ivar support. (build_private_template): Mark the record as used so debug information is generated. (build_protocol_template): Add Objective-C++ support. (objc_method_parm_type) Likewise. (objc_generate_cxx_ctor_or_dtor): Likewise. (objc_generate_cxx_cdtors): Likewise. (build_protocol_initializer): Likewise. (build_category_template): Likewise. (build_class_template): Likewise. (build_method_list_template): Likewise. (build_category_initializer): Likewise. (build_shared_structure_initializer): Likewise. (objc_finish_message_expr): Likewise. (build_objc_method_call): Add fast dispatch support. (lookup_method_static): Add support to end search at superclasses. (add_method_to_hash_list): Add strict parameter to comp_proto_with_proto. (objc_add_method): Likewise. (objc_add_method): Also set the interface_value. (add_instance_variable): Add Objective-C++ support. (objc_is_public): Likewise. (start_class): Likewise. (continue_class): Likewise. (encode_aggregate_within): Likewise. (start_method_def): Likewise. (objc_start_function): Clear current_function_returns_value and current_function_returns_null. (really_start_method): Add Objective-C++ support. (objc_finish_method_definition): Add warning for missing [super dealloc]. (finish_objc): Add Objective-C++ support. (generate_objc_image_info): Likewise. (objc_lookup_ivar): Likewise. * objc-act.h (TYPE_HAS_OBJC_INFO): Likewise. (INIT_TYPE_OBJC_INFO): Likewise. (DUP_TYPE_OBJC_INFO): Likewise. From-SVN: r99857
2005-05-17 22:07:08 +02:00
static hashval_t
hash_interface (const void *p)
{
const struct interface_tuple *d = p;
return IDENTIFIER_HASH_VALUE (d->id);
Yet more Objective-C++... * objc-act.c (objc_finish_try_stmt): Add return value. (objc_build_synchronized): Likewise. * objc-act.c (objc_is_gcable_type): Add. (objc_substitute_decl): Add. (objc_build_ivar_assignment): Add. (objc_build_global_assignment): Add. (objc_build_strong_cast_assignment): Add. (objc_is_ivar_reference_p): Add. (objc_is_global_reference_p): Add. (objc_generate_write_barrier): Add. (objc_rewrite_function_call): Add. (objc_gimplify_expr): Add Objective-C++ support. * objc-act.h (ALLOC_OBJC_TYPE_LANG_SPECIFIC): Likewise. (SIZEOF_OBJC_TYPE_LANG_SPECIFIC): Add. (INIT_TYPE_OBJC_INFO): Add Objective-C++ support. (DUP_TYPE_OBJC_INFO): Likewise. (struct imp_entry): Add field has_cxx_cdtors. (struct imp_entry *imp_list): Add OCTI_UMSG_FAST_DECL, OCTI_METH_LIST_TEMPL, OCTI_METH_PROTO_LIST_TEMPL, OCTI_IVAR_LIST_TEMPL, OCTI_ASSIGN_IVAR_DECL, OCTI_ASSIGN_IVAR_FAST_DECL, OCTI_ASSIGN_GLOBAL_DECL, OCTI_ASSIGN_STRONGCAST_DECL. (umsg_fast_decl): Add. (objc_assign_ivar_decl): Add. (objc_assign_ivar_fast_decl): Add. (objc_assign_global_decl): Add. (objc_assign_strong_cast_decl): Add. (objc_method_list_ptr): Add. (objc_method_proto_list_ptr): Add. (objc_ivar_list_ptr): Add. * objc-act.c (should_call_super_dealloc): Add. (OBJC_VERSION): Bump to 6. (objc_is_gcable_type): Add. (objc_substitute_decl): Add. (objc_build_ivar_assignment): Add. (objc_build_global_assignment): Add. (objc_build_strong_cast_assignment): Add. (objc_is_gcable_p): Add. (objc_is_ivar_reference_p): Add. (objc_is_global_reference_p): Add. (generate_shared_structures): Add flags parameter. (objc_generate_cxx_ctor_or_dtor): Add. (objc_generate_cxx_cdtors): Add. (add_class): Add name parameter. (objc_types_share_size_and_alignment): Add. (comp_proto_with_proto): Add strict parameter. (CLS_HAS_CXX_STRUCTORS): Add. (TAG_ASSIGNIVAR): Add. (TAG_ASSIGNGLOBAL): Add. (TAG_ASSIGNSTRONGCAST): Add. (TAG_MSGSEND_FAST): Add. (TAG_ASSIGNIVAR_FAST): Add. (TAG_CXX_CONSTRUCT): Add. (TAG_CXX_DESTRUCT): Add. (OBJC_LOOKUP_CLASS): Add. (OBJC_LOOKUP_NO_SUPER): Add. (objc_finish_file): Add pch support. (objc_finish_implementation): Add Objective-C++ support. (synth_module_prologue): Likewise. (synth_module_prologue): Add fast dispatching. (objc_get_class_reference): Add Objective-C++ support. (objc_generate_write_barrier): Likewise. (next_sjlj_build_enter_and_setjmp): Likewise. (objc_begin_try_stmt): Likewise. (build_next_objc_exception_stuff): Add fast ivar support. (build_private_template): Mark the record as used so debug information is generated. (build_protocol_template): Add Objective-C++ support. (objc_method_parm_type) Likewise. (objc_generate_cxx_ctor_or_dtor): Likewise. (objc_generate_cxx_cdtors): Likewise. (build_protocol_initializer): Likewise. (build_category_template): Likewise. (build_class_template): Likewise. (build_method_list_template): Likewise. (build_category_initializer): Likewise. (build_shared_structure_initializer): Likewise. (objc_finish_message_expr): Likewise. (build_objc_method_call): Add fast dispatch support. (lookup_method_static): Add support to end search at superclasses. (add_method_to_hash_list): Add strict parameter to comp_proto_with_proto. (objc_add_method): Likewise. (objc_add_method): Also set the interface_value. (add_instance_variable): Add Objective-C++ support. (objc_is_public): Likewise. (start_class): Likewise. (continue_class): Likewise. (encode_aggregate_within): Likewise. (start_method_def): Likewise. (objc_start_function): Clear current_function_returns_value and current_function_returns_null. (really_start_method): Add Objective-C++ support. (objc_finish_method_definition): Add warning for missing [super dealloc]. (finish_objc): Add Objective-C++ support. (generate_objc_image_info): Likewise. (objc_lookup_ivar): Likewise. * objc-act.h (TYPE_HAS_OBJC_INFO): Likewise. (INIT_TYPE_OBJC_INFO): Likewise. (DUP_TYPE_OBJC_INFO): Likewise. From-SVN: r99857
2005-05-17 22:07:08 +02:00
}
static int
eq_interface (const void *p1, const void *p2)
{
const struct interface_tuple *d = p1;
return d->id == p2;
}
static tree
lookup_interface (tree ident)
{
#ifdef OBJCPLUS
if (ident && TREE_CODE (ident) == TYPE_DECL)
ident = DECL_NAME (ident);
#endif
Yet more Objective-C++... * objc-act.c (objc_finish_try_stmt): Add return value. (objc_build_synchronized): Likewise. * objc-act.c (objc_is_gcable_type): Add. (objc_substitute_decl): Add. (objc_build_ivar_assignment): Add. (objc_build_global_assignment): Add. (objc_build_strong_cast_assignment): Add. (objc_is_ivar_reference_p): Add. (objc_is_global_reference_p): Add. (objc_generate_write_barrier): Add. (objc_rewrite_function_call): Add. (objc_gimplify_expr): Add Objective-C++ support. * objc-act.h (ALLOC_OBJC_TYPE_LANG_SPECIFIC): Likewise. (SIZEOF_OBJC_TYPE_LANG_SPECIFIC): Add. (INIT_TYPE_OBJC_INFO): Add Objective-C++ support. (DUP_TYPE_OBJC_INFO): Likewise. (struct imp_entry): Add field has_cxx_cdtors. (struct imp_entry *imp_list): Add OCTI_UMSG_FAST_DECL, OCTI_METH_LIST_TEMPL, OCTI_METH_PROTO_LIST_TEMPL, OCTI_IVAR_LIST_TEMPL, OCTI_ASSIGN_IVAR_DECL, OCTI_ASSIGN_IVAR_FAST_DECL, OCTI_ASSIGN_GLOBAL_DECL, OCTI_ASSIGN_STRONGCAST_DECL. (umsg_fast_decl): Add. (objc_assign_ivar_decl): Add. (objc_assign_ivar_fast_decl): Add. (objc_assign_global_decl): Add. (objc_assign_strong_cast_decl): Add. (objc_method_list_ptr): Add. (objc_method_proto_list_ptr): Add. (objc_ivar_list_ptr): Add. * objc-act.c (should_call_super_dealloc): Add. (OBJC_VERSION): Bump to 6. (objc_is_gcable_type): Add. (objc_substitute_decl): Add. (objc_build_ivar_assignment): Add. (objc_build_global_assignment): Add. (objc_build_strong_cast_assignment): Add. (objc_is_gcable_p): Add. (objc_is_ivar_reference_p): Add. (objc_is_global_reference_p): Add. (generate_shared_structures): Add flags parameter. (objc_generate_cxx_ctor_or_dtor): Add. (objc_generate_cxx_cdtors): Add. (add_class): Add name parameter. (objc_types_share_size_and_alignment): Add. (comp_proto_with_proto): Add strict parameter. (CLS_HAS_CXX_STRUCTORS): Add. (TAG_ASSIGNIVAR): Add. (TAG_ASSIGNGLOBAL): Add. (TAG_ASSIGNSTRONGCAST): Add. (TAG_MSGSEND_FAST): Add. (TAG_ASSIGNIVAR_FAST): Add. (TAG_CXX_CONSTRUCT): Add. (TAG_CXX_DESTRUCT): Add. (OBJC_LOOKUP_CLASS): Add. (OBJC_LOOKUP_NO_SUPER): Add. (objc_finish_file): Add pch support. (objc_finish_implementation): Add Objective-C++ support. (synth_module_prologue): Likewise. (synth_module_prologue): Add fast dispatching. (objc_get_class_reference): Add Objective-C++ support. (objc_generate_write_barrier): Likewise. (next_sjlj_build_enter_and_setjmp): Likewise. (objc_begin_try_stmt): Likewise. (build_next_objc_exception_stuff): Add fast ivar support. (build_private_template): Mark the record as used so debug information is generated. (build_protocol_template): Add Objective-C++ support. (objc_method_parm_type) Likewise. (objc_generate_cxx_ctor_or_dtor): Likewise. (objc_generate_cxx_cdtors): Likewise. (build_protocol_initializer): Likewise. (build_category_template): Likewise. (build_class_template): Likewise. (build_method_list_template): Likewise. (build_category_initializer): Likewise. (build_shared_structure_initializer): Likewise. (objc_finish_message_expr): Likewise. (build_objc_method_call): Add fast dispatch support. (lookup_method_static): Add support to end search at superclasses. (add_method_to_hash_list): Add strict parameter to comp_proto_with_proto. (objc_add_method): Likewise. (objc_add_method): Also set the interface_value. (add_instance_variable): Add Objective-C++ support. (objc_is_public): Likewise. (start_class): Likewise. (continue_class): Likewise. (encode_aggregate_within): Likewise. (start_method_def): Likewise. (objc_start_function): Clear current_function_returns_value and current_function_returns_null. (really_start_method): Add Objective-C++ support. (objc_finish_method_definition): Add warning for missing [super dealloc]. (finish_objc): Add Objective-C++ support. (generate_objc_image_info): Likewise. (objc_lookup_ivar): Likewise. * objc-act.h (TYPE_HAS_OBJC_INFO): Likewise. (INIT_TYPE_OBJC_INFO): Likewise. (DUP_TYPE_OBJC_INFO): Likewise. From-SVN: r99857
2005-05-17 22:07:08 +02:00
if (ident == NULL_TREE || TREE_CODE (ident) != IDENTIFIER_NODE)
return NULL_TREE;
{
struct interface_tuple **slot;
tree i = NULL_TREE;
if (interface_htab)
{
slot = (struct interface_tuple **)
htab_find_slot_with_hash (interface_htab, ident,
IDENTIFIER_HASH_VALUE (ident),
Yet more Objective-C++... * objc-act.c (objc_finish_try_stmt): Add return value. (objc_build_synchronized): Likewise. * objc-act.c (objc_is_gcable_type): Add. (objc_substitute_decl): Add. (objc_build_ivar_assignment): Add. (objc_build_global_assignment): Add. (objc_build_strong_cast_assignment): Add. (objc_is_ivar_reference_p): Add. (objc_is_global_reference_p): Add. (objc_generate_write_barrier): Add. (objc_rewrite_function_call): Add. (objc_gimplify_expr): Add Objective-C++ support. * objc-act.h (ALLOC_OBJC_TYPE_LANG_SPECIFIC): Likewise. (SIZEOF_OBJC_TYPE_LANG_SPECIFIC): Add. (INIT_TYPE_OBJC_INFO): Add Objective-C++ support. (DUP_TYPE_OBJC_INFO): Likewise. (struct imp_entry): Add field has_cxx_cdtors. (struct imp_entry *imp_list): Add OCTI_UMSG_FAST_DECL, OCTI_METH_LIST_TEMPL, OCTI_METH_PROTO_LIST_TEMPL, OCTI_IVAR_LIST_TEMPL, OCTI_ASSIGN_IVAR_DECL, OCTI_ASSIGN_IVAR_FAST_DECL, OCTI_ASSIGN_GLOBAL_DECL, OCTI_ASSIGN_STRONGCAST_DECL. (umsg_fast_decl): Add. (objc_assign_ivar_decl): Add. (objc_assign_ivar_fast_decl): Add. (objc_assign_global_decl): Add. (objc_assign_strong_cast_decl): Add. (objc_method_list_ptr): Add. (objc_method_proto_list_ptr): Add. (objc_ivar_list_ptr): Add. * objc-act.c (should_call_super_dealloc): Add. (OBJC_VERSION): Bump to 6. (objc_is_gcable_type): Add. (objc_substitute_decl): Add. (objc_build_ivar_assignment): Add. (objc_build_global_assignment): Add. (objc_build_strong_cast_assignment): Add. (objc_is_gcable_p): Add. (objc_is_ivar_reference_p): Add. (objc_is_global_reference_p): Add. (generate_shared_structures): Add flags parameter. (objc_generate_cxx_ctor_or_dtor): Add. (objc_generate_cxx_cdtors): Add. (add_class): Add name parameter. (objc_types_share_size_and_alignment): Add. (comp_proto_with_proto): Add strict parameter. (CLS_HAS_CXX_STRUCTORS): Add. (TAG_ASSIGNIVAR): Add. (TAG_ASSIGNGLOBAL): Add. (TAG_ASSIGNSTRONGCAST): Add. (TAG_MSGSEND_FAST): Add. (TAG_ASSIGNIVAR_FAST): Add. (TAG_CXX_CONSTRUCT): Add. (TAG_CXX_DESTRUCT): Add. (OBJC_LOOKUP_CLASS): Add. (OBJC_LOOKUP_NO_SUPER): Add. (objc_finish_file): Add pch support. (objc_finish_implementation): Add Objective-C++ support. (synth_module_prologue): Likewise. (synth_module_prologue): Add fast dispatching. (objc_get_class_reference): Add Objective-C++ support. (objc_generate_write_barrier): Likewise. (next_sjlj_build_enter_and_setjmp): Likewise. (objc_begin_try_stmt): Likewise. (build_next_objc_exception_stuff): Add fast ivar support. (build_private_template): Mark the record as used so debug information is generated. (build_protocol_template): Add Objective-C++ support. (objc_method_parm_type) Likewise. (objc_generate_cxx_ctor_or_dtor): Likewise. (objc_generate_cxx_cdtors): Likewise. (build_protocol_initializer): Likewise. (build_category_template): Likewise. (build_class_template): Likewise. (build_method_list_template): Likewise. (build_category_initializer): Likewise. (build_shared_structure_initializer): Likewise. (objc_finish_message_expr): Likewise. (build_objc_method_call): Add fast dispatch support. (lookup_method_static): Add support to end search at superclasses. (add_method_to_hash_list): Add strict parameter to comp_proto_with_proto. (objc_add_method): Likewise. (objc_add_method): Also set the interface_value. (add_instance_variable): Add Objective-C++ support. (objc_is_public): Likewise. (start_class): Likewise. (continue_class): Likewise. (encode_aggregate_within): Likewise. (start_method_def): Likewise. (objc_start_function): Clear current_function_returns_value and current_function_returns_null. (really_start_method): Add Objective-C++ support. (objc_finish_method_definition): Add warning for missing [super dealloc]. (finish_objc): Add Objective-C++ support. (generate_objc_image_info): Likewise. (objc_lookup_ivar): Likewise. * objc-act.h (TYPE_HAS_OBJC_INFO): Likewise. (INIT_TYPE_OBJC_INFO): Likewise. (DUP_TYPE_OBJC_INFO): Likewise. From-SVN: r99857
2005-05-17 22:07:08 +02:00
NO_INSERT);
if (slot && *slot)
i = (*slot)->class_name;
}
return i;
}
1992-01-18 00:15:38 +01:00
}
/* Implement @defs (<classname>) within struct bodies. */
tree
c-parse.in (primary): Call objc_build_message_expr()... [gcc/ChangeLog] 2004-09-01 Ziemowit Laski <zlaski@apple.com> * c-parse.in (primary): Call objc_build_message_expr(), objc_build_selector_expr(), objc_build_protocol_expr(), objc_build_encode_expr() and objc_build_string_object() instead of build_message_expr(), build_selector_expr(), build_protocol_expr(), build_encode_expr() and build_objc_string_object(), respectively. (component_decl_list2): Call objc_get_class_ivars() instead of get_class_ivars_from_name(). (keyworddecl): Call objc_build_keyword_decl() instead of build_keyword_decl(). (receiver): Call objc_get_class_reference() instead of get_class_reference(). (reswords): Add blank line before @@ifobjc section, for clarity. [gcc/objc/ChangeLog] 2004-09-01 Ziemowit Laski <zlaski@apple.com> * objc-act.c (objc_check_decl): Use OBJC_TYPE_NAME macro instead of TYPE_NAME. (build_objc_string_object): Rename to objc_build_string_object(). (get_class_reference): Rename to objc_get_class_reference(). (get_class_ivars_from_name): Rename to objc_get_class_ivars(). (next_sjlj_build_catch_list, get_super_receiver): Call objc_get_class_reference() instead of get_class_reference(). (build_keyword_decl): Rename to objc_build_keyword_decl(). (build_message_expr): Rename to objc_build_message_expr(). (build_protocol_expr): Rename to objc_build_protocol_expr(). (build_selector_expr): Rename to objc_build_selector_expr(). (build_encode_expr): Rename to objc_build_encode_expr(). * objc-act.h (get_class_ivars_from_name): Rename prototype to objc_get_class_ivars(). (get_class_reference): Rename prototype to objc_get_class_reference(). (build_message_expr): Rename prototype to objc_build_message_expr(). (build_selector_expr): Rename prototype to objc_build_selector_expr(). (build_keyword_decl): Rename prototype to objc_build_keyword_decl(). (build_protocol_expr): Rename prototype to objc_build_prototype_expr(). (build_objc_string_object): Rename prototype to objc_build_string_object(). From-SVN: r86950
2004-09-02 02:36:18 +02:00
objc_get_class_ivars (tree class_name)
{
tree interface = lookup_interface (class_name);
if (interface)
objc-act.c (objc_build_struct): New function. * objc-act.c (objc_build_struct): New function. (objc_derived_from_p): Likewise. (objc_build_component_ref): Likewise. (objc_copy_binfo): Likewise. (objc_xref_basetypes): Likewise. (objc_lookup_protocol): Likewise. (objc_compare_protocols): Likewise. (objc_volatilize_decl): Likewise. (encode_aggregate_fields): Likewise. (volatilized_hash): Likewise. (volatilized_eq): Likewise. (objc_compare_types): Likewise. (objc_type_quals_match): Likewise. (DERIVED_FROM_P): New ObjC macro, corresponding to C++ macro of same name. (get_class_ivars): Add second parameter indicating if entire hierarchy is desired. (struct volatilized_type): New type. (volatilized_htab): New hash table. (objc_types_compatible_p, objc_comptypes): Remove functions. (synth_module_prologue): Do not initialize 'unused_list'. (objc_get_class_reference): Fix ObjC++ impedance mismatches. (objc_declare_alias): Implement as a typedef. (objc_substitute_decl, objc_gimplify_expr): Reformat. (objc_get_class_ivars): Adjust call to get_class_ivars(). (next_sjlj_build_enter_and_setjmp, synth_forward_declarations, build_ivar_reference, get_super_receiver): Call objc_build_component_ref() instead of build_component_ref(). (objc_begin_catch_clause): Use DERIVED_FROM_P() instead of objc_comptypes(). (build_private_template): Call objc_build_struct() instead of start_struct() and finish_struct(). (hash_init): Initialize volatilized_htab. (objc_is_public): Adjust calls to objc_get_ivars(); adjust ObjC++ impedance mismatches. (encode_aggregate_within): Streamline by calling encode_aggregate_fields(). * objc-act.h (objc_types_compatible_p): Remove prototype. (OCTI_UNUSED_LIST, unused_list): Remove slot. * objc-lang.c (LANG_HOOKS_TYPES_COMPATIBLE_P): Remove. From-SVN: r100123
2005-05-25 00:21:01 +02:00
return get_class_ivars (interface, true);
builtins.c, [...]: Avoid "`" as left quote, using "'" or %q, %< and %> as appropriate. * builtins.c, c-common.c, c-decl.c, c-format.c, c-format.h, c-parse.in, c-pch.c, c-pragma.c, collect2.c, final.c, gcc.c, gcov.c, opts.c, pretty-print.h, protoize.c, reg-stack.c, rtl.c, tlink.c, config/alpha/alpha.c, config/arc/arc.c, config/arm/arm.c, config/avr/avr.c, config/c4x/c4x.c, config/darwin.c, config/frv/frv.c, config/h8300/h8300.c, config/i386/i386.c, config/i386/winnt.c, config/ia64/ia64.c, config/ip2k/ip2k.c, config/iq2000/iq2000.c, config/m32r/m32r.c, config/m68hc11/m68hc11.c, config/m68k/m68k.c, config/m68k/m68k.h, config/mcore/mcore.c, config/mips/mips.c, config/mmix/mmix.c, config/ns32k/ns32k.c, config/rs6000/host-darwin.c, config/rs6000/rs6000.c, config/s390/s390.c, config/sh/sh.c, config/sh/symbian.c, config/stormy16/stormy16.c, config/v850/v850.c: Avoid "`" as left quote, using "'" or %q, %< and %> as appropriate. Use %' as apostrophe in diagnostics where applicable. Use %< and %> in place of '' quotes where applicable. Use %qs in place of %<%s%>. Consistently quote __builtin function names. ada: * misc.c (gnat_handle_option): Use %< and %> for quoting in warning message. cp: * call.c, class.c, decl.c, decl2.c, error.c, mangle.c, parser.c, pt.c, search.c, semantics.c, typeck.c: Use %q, %< and %> for quoting in diagnostics. * parser.c (cp_parser_sizeof_operand): Use '' instead of `' for quoting in printf format. * decl.c (duplicate_decls, start_decl): Use %qD instead of unquoted %D. objc: * objc-act.c: Use %q, %< and %> for quoting in diagnostics. testsuite: * gcc.dg/builtin-prefetch-1.c: Adjust expected messages. From-SVN: r90337
2004-11-09 11:13:30 +01:00
error ("cannot find interface declaration for %qs",
Makefile.in (c-parse.o): Depend on $(C_COMMON_H). [gcc/ChangeLog] 2004-09-07 Ziemowit Laski <zlaski@apple.com> * Makefile.in (c-parse.o): Depend on $(C_COMMON_H). * c-parse.in: Include c-common.h instead of objc-act.h. (ivar_decl_list, ivar_decls, ivar_decl, ivars, ivar_declarator, myparms, myparm): Remove %type declarations. (methodtype, optparms, OBJC_TYPE_QUAL, objc_quals, objc_qual, objc_typename, objc_try_catch_stmt, optellipsis): Add %type declarations. (objc_inherit_code, objc_public_flag): Remove. (typespec_nonreserved_nonattr): Call objc_get_protocol_qualified_type() instead of get_static_reference() and get_protocol_reference(). (stmt_nocomp): Call grokparm() on @catch parameter. (objcdef): Move semantic action to objc_finish_implementation(). (classdef): Move semantic action to objc_start_class_interface(), objc_continue_interface(), objc_finish_interface(), objc_start_class_implementation(), objc_continue_implementation(), objc_start_category_interface() and objc_start_category_implementation(). (protocoldef): Move semantic actions to objc_start_protocol() and objc_finish_interface(). (ivar_decl_list): Remove nonterminal. (visibility_spec): Move semantic actions to objc_set_visibility(). (ivar_decls): Remove assignment to $$. (ivar_decl): Rephrase in terms of component_decl; call objc_add_instance_variable(). (ivars, ivar_declarator): Remove nonterminals. (opt_semi): New nonterminal. (methodtype): Remove semantic actions. (methoddef): Move semantic actions to objc_set_method_type(), objc_start_method_definition() and objc_finish_method_definition(). (methodproto): Move semantic actions to objc_set_method_type() and objc_add_method_declaration(). (methoddecl): Use objc_typename instead of typename; move semantic actions to objc_build_method_signature(). (optarglist, myxdecls, mydecl, myparms, myparm): Remove nonterminals. (optparmlist): Express in terms of optparms and optellipsis. (optparms, optellipsis, objc_qual, objc_quals, objc_typename): New nonterminals. (keyworddecl): Use objc_typename instead of typename. (rid_to_yy): Mark RID_IN, RID_OUT, RID_INOUT, RID_BYCOPY, RID_BYREF and RID_ONEWAY as returning OBJC_TYPE_QUAL to yyparse(). [gcc/objc/ChangeLog] 2004-09-07 Ziemowit Laski <zlaski@apple.com> * Make-lang.in (objc/objc-parse.o): Depend on $(C_COMMON_H) instead of objc/objc-act.h. (objc/objc-act.o): Depend on $(HASHTAB_H). * objc-act.c: Include hashtab.h; in ObjC++ mode, include cp-tree.h and objcp-decl.h instead of c-tree.h. (build_module_descriptor, get_class_ivars, synth_id_with_class_suffix, error_with_ivar, gen_method_decl, gen_declaration, setup_string_decl, build_protocol_template): Adjust prototypes. (build_module_initializer_routine, start_class, continue_class, finish_class, start_method_def, objc_start_function, start_protocol, build_method_decl, objc_add_method, add_instance_variable, build_ivar_reference, is_ivar, is_private, get_super_receiver, build_selector_table_decl, objc_push_parm, objc_get_parm_info, gen_type_name, gen_type_name_0, start_var_decl, finish_var_decl, create_field_decl): New prototypes. (objc_expand_function_end, comp_method_with_proto, objc_expr_last, gen_declaration_1, gen_declarator, is_complex_decl, adorn_decl, define_decl, create_builtin_decl, gen_declspecs): Remove prototypes. (TYPE_ID): Rename to OBJECT_TYPEDEF_NAME. (CLASS_TYPEDEF_NAME): New. (TAG_EXECCLASS): Change from a global variable to a #define. (TAG_RETURN_STRUCT): Delete. (TAG_GNUINIT): New, holds '__objc_gnu_init' name. (objc_inherit_code, objc_public_flag): New, moved from c-parse.in. (string_descriptor): New struct. (string_htab): New hash table. (string_hash, string_eq): New prototypes. (generate_struct_by_value_array): Call create_field_decl() instead of create_builtin_decl(). (objc_init): Do not initialize objc_ellipsis_node or TAG_EXECCLASS; In ObjC++ mode, call cxx_init() instead of c_objc_common_init(). (objc_finish_file): In ObjC++, call instantiate_pending_templates() and cp_finish_file(). (define_decl, get_static_reference, get_protocol_reference, create_builtin_decl): Remove functions. (objc_start_class_interface, objc_start_category_interface, objc_start_protocol, objc_continue_interface, objc_finish_interface, objc_start_class_implementation, objc_start_category_implementation, objc_continue_implementation, objc_finish_implementation, objc_set_visibility, objc_set_method_type, objc_build_method_signature, objc_add_method_declaration, objc_start_method_definition, objc_add_instance_variable, objc_get_protocol_qualified_type, create_field_decl, start_var_decl, finish_var_decl): New functions. (setup_string_decl): Simplify since it is only called once. (synth_module_prologue): Call build_class_template(); predefine 'id' and 'Class' as typedefs; rename 'temp_type' to 'type'; disable debug hooks for duration of function; fix GNU runtime messenger signatures to correspond to reality; forward-declare '__objc_exec_class' for the GNU runtime; call build_selector_table_decl(); in ObjC++ mode, generate 'extern "C" { ... }' wrappers around synthesized declarations; call build_protocol_template() and build_category_template(). (string_hash, string_eq): New functions. (objc_build_string_object): Check metaclass correctness only once; store string literals in hash table. (objc_build_constructor): Do not convert initializer elements; adjust for ObjC++ impedance mismatch. (build_objc_symtab_template): Call create_field_decl() instead of create_builtin_decl(). (init_objc_symtab): Add missing conversion to initializer element. (build_metadata_decl): Call start_var_decl() instead of define_decl(). (generate_objc_symtab_decl): Do not call build_category_template(); call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(). (build_module_descriptor): Call create_field_decl() instead of grokfield(); call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(); always mark module descriptor as used; move GNU runtime-specific functionality to build_module_initializer_routine(). (build_module_initializer_routine): New function, broken off of build_module_descriptor(). (objc_static_init_needed_p, objc_generate_static_init_call): New functions. (generate_static_references, generate_strings, build_selector_translation_table, generate_descriptor_table, generate_ivars_list, generate_dispatch_table, generate_category): Call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(); build a type directly instead of via groktypename(). (build_selector_reference_decl, build_selector_table_decl, build_class_reference_decl, build_protocol_reference, generate_objc_image_info): Call start_var_decl() instead of build_decl(). (build_selector_reference): For GNU runtime, do not call build_selector_reference_decl(). (build_selector, build_typed_selector_reference): Always convert result to the selector type. (add_objc_string): Cast return value to 'char *'. (build_method_prototype_template, build_selector_template, build_method_template): Use actual selector type for fields pointing to selectors. (finish_objc): For GNU runtime, call build_module_initializer_routine() after build_module_descriptor(). (generate_protocol_list, generate_shared_structures): Call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(); build a type directly instead of via groktypename(). (synth_id_with_class_suffix): Return a string. (get_arg_type_list): For instance methods, use the instance type for 'self'; do not call groktypename_in_parm_context(). (build_objc_string_decl): Squash redeclaration errors in ObjC++. (objc_is_class_name): Use OBJC_TYPE_NAME instead of TYPE_NAME; handle RECORD_TYPEs in ObjC as well as ObjC++. (objc_is_id): New function. (objc_is_object_ptr): Return the canonical type node. (objc_get_class_ivars): Simplify using get_class_ivars(). (get_class_ivars): Remove second parameter; create a fresh copy of the ivar list for each call; do not check for existence of super class. (objc_eh_runtime_type): Mark #ifndef OBJCPLUS. (objc_init_exceptions): When using SJLJ-style exceptions, require the use of '-fobjc-exceptions' flag; do not require it for DWARF-style exceptions. (objc_build_exc_ptr, next_sjlj_build_try_catch_finally): Use objc_object_type instead of objc_id_type. (objc_begin_catch_clause): Convert the incoming PARM_DECL into a VAR_DECL before placing it in the appropriate scope; do not call define_decl(); adjust call to c_begin_compound_stmt(); use objc_object_type instead of objc_id_type. (build_next_objc_exception_stuff): Call create_field_decl() instead of create_builtin_decl(); construct type directly instead of calling groktypename(); use OBJC_VOID_AT_END to mark end of function parameters. (build_private_template): Adjust call to get_class_ivars(); build a type directly instead of via groktypename(). (build_protocol_template, build_method_prototype_list_template, build_method_prototype_template, build_category_template, build_selector_template, build_class_template, build_super_template, build_ivar_template, build_ivar_list_template, build_method_list_template, build_method_template): Call create_field_decl() instead of grokfield(). (objc_method_parm_type): Do not call groktypename(). (generate_descriptor_table): Call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(). (generate_method_descriptors, build_protocol_initializer, generate_dispatch_tables, build_category_initializer, build_shared_structure_initializer): Do not call groktypename(). (generate_protocols): Call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(); do not call groktypename(). (error_with_ivar): Remove last parameter. (check_ivars): Do not iterate ovar CLASS_RAW_IVARS lists in addition to CLASS_IVARS lists; adjust calls to error_with_ivar(). (generate_ivar_lists): Convert one of the initializer elements; do not call groktypename(). (get_arg_type_list, start_method_def, gen_method_def): Account for new representation of variable arguments and '...' in Objective-C methods; add Objective-C++ impedance matching code. (is_objc_type_qualifier): Remove function. (adjust_type_for_id_default): Simplify; there is no longer a need to wade through declspecs. (lookup_interface, start_class, continue_class, finish_class, start_method_def, start_protocol, build_method_decl, objc_add_method, add_instance_variable, build_ivar_reference, is_ivar, is_private, get_super_receiver, objc_build_finally_epilogue): Make into static functions. (receiver_is_class_object): Use new IS_CLASS() macro. (objc_build_message_expr): Tweak ObjC++ message argument handling; call objc_finish_message_expr() instead of finish_message_expr(). (finish_message_expr): Rename to objc_finish_message_expr(); use OBJC_TYPE_NAME and OBJC_SET_TYPE_NAME macros instead of TYPE_NAME. call gen_type_name() instead of gen_declaration(); call objc_is_id() instead of using IS_ID and IS_CLASS; Use objc_class_name instead of calling get_identifier("Class"); handle CONVERT_EXPRs in receiver. (build_objc_method_call, warn_with_method): Do not call groktypename(). (build_ivar_reference): Call convert() instead of clobbering in a type. (hash_init): Initialize string_htab hash table. (add_instance_variable): Simplify parameter list; do not call grokfield(); do not populate CLASS_IVARS list. (start_class): Check for the existence of super class, if one was specified. (continue_class): Use CLASS_RAW_IVARS rather than CLASS_IVARS; do not call build_class_template(); adjust call to get_class_ivars(); call build_decl(), pushdecl() and finish_decl() instead of define_decl(). (finish_class): Call build_decl(), pushdecl() and finish_decl() instead of define_decl(). (add_protocols): Use PROTOCOL_BINFO_ELTS for the tree vector size. (start_protocol): Do not call build_protocol_template(); use PROTOCOL_BINFO_ELTS for the tree vector size. (encode_type_qualifiers): Do not handle the 'const' qualifier here. (encode_pointer): Encode 'const char *' as 'r*', for backwards compatibility. (encode_array): Use HOST_WIDE_INT_PRINT_DEC instead of "%ld". (encode_type): Handle the 'const' qualifier here. (objc_parmlist): New global variable, sued by objc_push_parm and objc_get_parm_info(). (objc_push_parm, objc_get_parm_info): New functions. (objc_expr_last): Remove function. (synth_self_and_ucmd_args): For instance methods, use the instance type for 'self'; call objc_push_parm() instead of push_parm_decl(). (start_method_def): Do not call push_scope(), declare_parm_level(), pop_scope(), push_parm_decl(), store_parm_decls() or objc_expr_last(); just use objc_push_parm() and objc_get_parm_info(). (comp_method_with_proto): Remove function. (objc_types_are_equivalent): Strip away indirections before comparing underlying types. (comp_proto_with_proto): Do not call groktypename(); types are no longer in raw declspec format. (objc_start_function): New function. (really_start_method): Call comp_proto_with_proto() instead of comp_method_with_proto(); call objc_start_function() instead of hand-crafting a function declarator. (continue_method_def, objc_expand_function_end): Remove functions. (get_super_receiver): Call objc_get_current_scope() instead of get_current_scope(); reference 'super_class' field (instead of 'class'). (finish_method_def): Rename to objc_finish_method_definition() and add a function decl parameter; move method encoding call from objc_expand_function_end(). (is_complex_decl, adorn_decl, gen_declarator, gen_declspecs, gen_declaration_1): Remove functions. (tmpbuf, RAW_DECLSPEC): Remove. (gen_declaration): Remove second parameter; simplify to deal with TYPE_P nodes instead of raw declspecs. (gen_type_name, gen_type_name_0): New functions. (gen_method_decl): Remove second parameter; call gen_type_name() instead of gen_declaration_1(). (dump_interface): Adjust calls to gen_declaration() and gen_method_decl(); do not allocate a separate string buffer. (init_objc): Allocate a larger string buffer to accommodate dump_interface(); adjust call to build_module_descriptor(); add call to build_module_initializer_routine() for the GNU runtime. (generate_classref_translation_entry): Do not call start_decl(); call finish_var_decl() instead of finish_decl(); call convert() instead of build_c_cast(). * objc-act.h (CLASS_OWN_IVARS): Remove accessor. (CLASS_BINFO_ELTS): Reduce from 6 to 5, now that CLASS_OWN_IVARS is gone. (OCTI_GNU_INIT_DECL, GNU_INIT_decl): New. (OCTI_ELLIPSIS_NODE, objc_ellipsis_node): Remove. (OCTI_ID_ID, id_type, objc_id_id): Rename to OCTI_ID_NAME, objc_object_type and objc_object_name, respectively. (OCTI_CLS_REF, OCTI_CLASS_NAME, objc_class_reference, objc_class_name): New. (IS_CLASS): New macro. (IS_ID, IS_SUPER): Robustify. (OCTI_EXECCLASS_DECL, execclass_decl): New. (finish_file, start_class, continue_class, finish_class, start_method_def, continue_method_def, finish_method_def, start_protocol, finish_protocol, objc_build_throw_stmt, objc_build_try_catch_finally_stmt, objc_build_synchronized_prologue, objc_build_synchronized_epilogue, objc_build_try_prologue, objc_build_try_epilogue, objc_build_catch_stmt, objc_build_catch_epilogue, objc_build_finally_prologue, objc_build_finally_epilogue, is_ivar, is_private, is_public, add_instance_variable, objc_add_method, get_super_receiver, objc_clear_super_receiver, get_class_ivars_from_name, get_class_reference, get_static_reference, get_object_reference, build_message_expr, finish_message_expr, build_selector_expr, build_ivar_reference, build_keyword_decl, build_method_decl, build_protocol_expr, build_objc_string_object, objc_declare_alias, objc_declare_class, objc_declare_protocols, objc_comptypes, objc_check_decl, build_encode_expr): Remove prototypes. (imp_count, cat_count): Make GGC-aware. (OBJC_SET_TYPE_NAME): New macro. From-SVN: r87168
2004-09-08 02:49:44 +02:00
IDENTIFIER_POINTER (class_name));
Makefile.in (c-parse.o): Depend on $(C_COMMON_H). [gcc/ChangeLog] 2004-09-07 Ziemowit Laski <zlaski@apple.com> * Makefile.in (c-parse.o): Depend on $(C_COMMON_H). * c-parse.in: Include c-common.h instead of objc-act.h. (ivar_decl_list, ivar_decls, ivar_decl, ivars, ivar_declarator, myparms, myparm): Remove %type declarations. (methodtype, optparms, OBJC_TYPE_QUAL, objc_quals, objc_qual, objc_typename, objc_try_catch_stmt, optellipsis): Add %type declarations. (objc_inherit_code, objc_public_flag): Remove. (typespec_nonreserved_nonattr): Call objc_get_protocol_qualified_type() instead of get_static_reference() and get_protocol_reference(). (stmt_nocomp): Call grokparm() on @catch parameter. (objcdef): Move semantic action to objc_finish_implementation(). (classdef): Move semantic action to objc_start_class_interface(), objc_continue_interface(), objc_finish_interface(), objc_start_class_implementation(), objc_continue_implementation(), objc_start_category_interface() and objc_start_category_implementation(). (protocoldef): Move semantic actions to objc_start_protocol() and objc_finish_interface(). (ivar_decl_list): Remove nonterminal. (visibility_spec): Move semantic actions to objc_set_visibility(). (ivar_decls): Remove assignment to $$. (ivar_decl): Rephrase in terms of component_decl; call objc_add_instance_variable(). (ivars, ivar_declarator): Remove nonterminals. (opt_semi): New nonterminal. (methodtype): Remove semantic actions. (methoddef): Move semantic actions to objc_set_method_type(), objc_start_method_definition() and objc_finish_method_definition(). (methodproto): Move semantic actions to objc_set_method_type() and objc_add_method_declaration(). (methoddecl): Use objc_typename instead of typename; move semantic actions to objc_build_method_signature(). (optarglist, myxdecls, mydecl, myparms, myparm): Remove nonterminals. (optparmlist): Express in terms of optparms and optellipsis. (optparms, optellipsis, objc_qual, objc_quals, objc_typename): New nonterminals. (keyworddecl): Use objc_typename instead of typename. (rid_to_yy): Mark RID_IN, RID_OUT, RID_INOUT, RID_BYCOPY, RID_BYREF and RID_ONEWAY as returning OBJC_TYPE_QUAL to yyparse(). [gcc/objc/ChangeLog] 2004-09-07 Ziemowit Laski <zlaski@apple.com> * Make-lang.in (objc/objc-parse.o): Depend on $(C_COMMON_H) instead of objc/objc-act.h. (objc/objc-act.o): Depend on $(HASHTAB_H). * objc-act.c: Include hashtab.h; in ObjC++ mode, include cp-tree.h and objcp-decl.h instead of c-tree.h. (build_module_descriptor, get_class_ivars, synth_id_with_class_suffix, error_with_ivar, gen_method_decl, gen_declaration, setup_string_decl, build_protocol_template): Adjust prototypes. (build_module_initializer_routine, start_class, continue_class, finish_class, start_method_def, objc_start_function, start_protocol, build_method_decl, objc_add_method, add_instance_variable, build_ivar_reference, is_ivar, is_private, get_super_receiver, build_selector_table_decl, objc_push_parm, objc_get_parm_info, gen_type_name, gen_type_name_0, start_var_decl, finish_var_decl, create_field_decl): New prototypes. (objc_expand_function_end, comp_method_with_proto, objc_expr_last, gen_declaration_1, gen_declarator, is_complex_decl, adorn_decl, define_decl, create_builtin_decl, gen_declspecs): Remove prototypes. (TYPE_ID): Rename to OBJECT_TYPEDEF_NAME. (CLASS_TYPEDEF_NAME): New. (TAG_EXECCLASS): Change from a global variable to a #define. (TAG_RETURN_STRUCT): Delete. (TAG_GNUINIT): New, holds '__objc_gnu_init' name. (objc_inherit_code, objc_public_flag): New, moved from c-parse.in. (string_descriptor): New struct. (string_htab): New hash table. (string_hash, string_eq): New prototypes. (generate_struct_by_value_array): Call create_field_decl() instead of create_builtin_decl(). (objc_init): Do not initialize objc_ellipsis_node or TAG_EXECCLASS; In ObjC++ mode, call cxx_init() instead of c_objc_common_init(). (objc_finish_file): In ObjC++, call instantiate_pending_templates() and cp_finish_file(). (define_decl, get_static_reference, get_protocol_reference, create_builtin_decl): Remove functions. (objc_start_class_interface, objc_start_category_interface, objc_start_protocol, objc_continue_interface, objc_finish_interface, objc_start_class_implementation, objc_start_category_implementation, objc_continue_implementation, objc_finish_implementation, objc_set_visibility, objc_set_method_type, objc_build_method_signature, objc_add_method_declaration, objc_start_method_definition, objc_add_instance_variable, objc_get_protocol_qualified_type, create_field_decl, start_var_decl, finish_var_decl): New functions. (setup_string_decl): Simplify since it is only called once. (synth_module_prologue): Call build_class_template(); predefine 'id' and 'Class' as typedefs; rename 'temp_type' to 'type'; disable debug hooks for duration of function; fix GNU runtime messenger signatures to correspond to reality; forward-declare '__objc_exec_class' for the GNU runtime; call build_selector_table_decl(); in ObjC++ mode, generate 'extern "C" { ... }' wrappers around synthesized declarations; call build_protocol_template() and build_category_template(). (string_hash, string_eq): New functions. (objc_build_string_object): Check metaclass correctness only once; store string literals in hash table. (objc_build_constructor): Do not convert initializer elements; adjust for ObjC++ impedance mismatch. (build_objc_symtab_template): Call create_field_decl() instead of create_builtin_decl(). (init_objc_symtab): Add missing conversion to initializer element. (build_metadata_decl): Call start_var_decl() instead of define_decl(). (generate_objc_symtab_decl): Do not call build_category_template(); call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(). (build_module_descriptor): Call create_field_decl() instead of grokfield(); call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(); always mark module descriptor as used; move GNU runtime-specific functionality to build_module_initializer_routine(). (build_module_initializer_routine): New function, broken off of build_module_descriptor(). (objc_static_init_needed_p, objc_generate_static_init_call): New functions. (generate_static_references, generate_strings, build_selector_translation_table, generate_descriptor_table, generate_ivars_list, generate_dispatch_table, generate_category): Call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(); build a type directly instead of via groktypename(). (build_selector_reference_decl, build_selector_table_decl, build_class_reference_decl, build_protocol_reference, generate_objc_image_info): Call start_var_decl() instead of build_decl(). (build_selector_reference): For GNU runtime, do not call build_selector_reference_decl(). (build_selector, build_typed_selector_reference): Always convert result to the selector type. (add_objc_string): Cast return value to 'char *'. (build_method_prototype_template, build_selector_template, build_method_template): Use actual selector type for fields pointing to selectors. (finish_objc): For GNU runtime, call build_module_initializer_routine() after build_module_descriptor(). (generate_protocol_list, generate_shared_structures): Call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(); build a type directly instead of via groktypename(). (synth_id_with_class_suffix): Return a string. (get_arg_type_list): For instance methods, use the instance type for 'self'; do not call groktypename_in_parm_context(). (build_objc_string_decl): Squash redeclaration errors in ObjC++. (objc_is_class_name): Use OBJC_TYPE_NAME instead of TYPE_NAME; handle RECORD_TYPEs in ObjC as well as ObjC++. (objc_is_id): New function. (objc_is_object_ptr): Return the canonical type node. (objc_get_class_ivars): Simplify using get_class_ivars(). (get_class_ivars): Remove second parameter; create a fresh copy of the ivar list for each call; do not check for existence of super class. (objc_eh_runtime_type): Mark #ifndef OBJCPLUS. (objc_init_exceptions): When using SJLJ-style exceptions, require the use of '-fobjc-exceptions' flag; do not require it for DWARF-style exceptions. (objc_build_exc_ptr, next_sjlj_build_try_catch_finally): Use objc_object_type instead of objc_id_type. (objc_begin_catch_clause): Convert the incoming PARM_DECL into a VAR_DECL before placing it in the appropriate scope; do not call define_decl(); adjust call to c_begin_compound_stmt(); use objc_object_type instead of objc_id_type. (build_next_objc_exception_stuff): Call create_field_decl() instead of create_builtin_decl(); construct type directly instead of calling groktypename(); use OBJC_VOID_AT_END to mark end of function parameters. (build_private_template): Adjust call to get_class_ivars(); build a type directly instead of via groktypename(). (build_protocol_template, build_method_prototype_list_template, build_method_prototype_template, build_category_template, build_selector_template, build_class_template, build_super_template, build_ivar_template, build_ivar_list_template, build_method_list_template, build_method_template): Call create_field_decl() instead of grokfield(). (objc_method_parm_type): Do not call groktypename(). (generate_descriptor_table): Call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(). (generate_method_descriptors, build_protocol_initializer, generate_dispatch_tables, build_category_initializer, build_shared_structure_initializer): Do not call groktypename(). (generate_protocols): Call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(); do not call groktypename(). (error_with_ivar): Remove last parameter. (check_ivars): Do not iterate ovar CLASS_RAW_IVARS lists in addition to CLASS_IVARS lists; adjust calls to error_with_ivar(). (generate_ivar_lists): Convert one of the initializer elements; do not call groktypename(). (get_arg_type_list, start_method_def, gen_method_def): Account for new representation of variable arguments and '...' in Objective-C methods; add Objective-C++ impedance matching code. (is_objc_type_qualifier): Remove function. (adjust_type_for_id_default): Simplify; there is no longer a need to wade through declspecs. (lookup_interface, start_class, continue_class, finish_class, start_method_def, start_protocol, build_method_decl, objc_add_method, add_instance_variable, build_ivar_reference, is_ivar, is_private, get_super_receiver, objc_build_finally_epilogue): Make into static functions. (receiver_is_class_object): Use new IS_CLASS() macro. (objc_build_message_expr): Tweak ObjC++ message argument handling; call objc_finish_message_expr() instead of finish_message_expr(). (finish_message_expr): Rename to objc_finish_message_expr(); use OBJC_TYPE_NAME and OBJC_SET_TYPE_NAME macros instead of TYPE_NAME. call gen_type_name() instead of gen_declaration(); call objc_is_id() instead of using IS_ID and IS_CLASS; Use objc_class_name instead of calling get_identifier("Class"); handle CONVERT_EXPRs in receiver. (build_objc_method_call, warn_with_method): Do not call groktypename(). (build_ivar_reference): Call convert() instead of clobbering in a type. (hash_init): Initialize string_htab hash table. (add_instance_variable): Simplify parameter list; do not call grokfield(); do not populate CLASS_IVARS list. (start_class): Check for the existence of super class, if one was specified. (continue_class): Use CLASS_RAW_IVARS rather than CLASS_IVARS; do not call build_class_template(); adjust call to get_class_ivars(); call build_decl(), pushdecl() and finish_decl() instead of define_decl(). (finish_class): Call build_decl(), pushdecl() and finish_decl() instead of define_decl(). (add_protocols): Use PROTOCOL_BINFO_ELTS for the tree vector size. (start_protocol): Do not call build_protocol_template(); use PROTOCOL_BINFO_ELTS for the tree vector size. (encode_type_qualifiers): Do not handle the 'const' qualifier here. (encode_pointer): Encode 'const char *' as 'r*', for backwards compatibility. (encode_array): Use HOST_WIDE_INT_PRINT_DEC instead of "%ld". (encode_type): Handle the 'const' qualifier here. (objc_parmlist): New global variable, sued by objc_push_parm and objc_get_parm_info(). (objc_push_parm, objc_get_parm_info): New functions. (objc_expr_last): Remove function. (synth_self_and_ucmd_args): For instance methods, use the instance type for 'self'; call objc_push_parm() instead of push_parm_decl(). (start_method_def): Do not call push_scope(), declare_parm_level(), pop_scope(), push_parm_decl(), store_parm_decls() or objc_expr_last(); just use objc_push_parm() and objc_get_parm_info(). (comp_method_with_proto): Remove function. (objc_types_are_equivalent): Strip away indirections before comparing underlying types. (comp_proto_with_proto): Do not call groktypename(); types are no longer in raw declspec format. (objc_start_function): New function. (really_start_method): Call comp_proto_with_proto() instead of comp_method_with_proto(); call objc_start_function() instead of hand-crafting a function declarator. (continue_method_def, objc_expand_function_end): Remove functions. (get_super_receiver): Call objc_get_current_scope() instead of get_current_scope(); reference 'super_class' field (instead of 'class'). (finish_method_def): Rename to objc_finish_method_definition() and add a function decl parameter; move method encoding call from objc_expand_function_end(). (is_complex_decl, adorn_decl, gen_declarator, gen_declspecs, gen_declaration_1): Remove functions. (tmpbuf, RAW_DECLSPEC): Remove. (gen_declaration): Remove second parameter; simplify to deal with TYPE_P nodes instead of raw declspecs. (gen_type_name, gen_type_name_0): New functions. (gen_method_decl): Remove second parameter; call gen_type_name() instead of gen_declaration_1(). (dump_interface): Adjust calls to gen_declaration() and gen_method_decl(); do not allocate a separate string buffer. (init_objc): Allocate a larger string buffer to accommodate dump_interface(); adjust call to build_module_descriptor(); add call to build_module_initializer_routine() for the GNU runtime. (generate_classref_translation_entry): Do not call start_decl(); call finish_var_decl() instead of finish_decl(); call convert() instead of build_c_cast(). * objc-act.h (CLASS_OWN_IVARS): Remove accessor. (CLASS_BINFO_ELTS): Reduce from 6 to 5, now that CLASS_OWN_IVARS is gone. (OCTI_GNU_INIT_DECL, GNU_INIT_decl): New. (OCTI_ELLIPSIS_NODE, objc_ellipsis_node): Remove. (OCTI_ID_ID, id_type, objc_id_id): Rename to OCTI_ID_NAME, objc_object_type and objc_object_name, respectively. (OCTI_CLS_REF, OCTI_CLASS_NAME, objc_class_reference, objc_class_name): New. (IS_CLASS): New macro. (IS_ID, IS_SUPER): Robustify. (OCTI_EXECCLASS_DECL, execclass_decl): New. (finish_file, start_class, continue_class, finish_class, start_method_def, continue_method_def, finish_method_def, start_protocol, finish_protocol, objc_build_throw_stmt, objc_build_try_catch_finally_stmt, objc_build_synchronized_prologue, objc_build_synchronized_epilogue, objc_build_try_prologue, objc_build_try_epilogue, objc_build_catch_stmt, objc_build_catch_epilogue, objc_build_finally_prologue, objc_build_finally_epilogue, is_ivar, is_private, is_public, add_instance_variable, objc_add_method, get_super_receiver, objc_clear_super_receiver, get_class_ivars_from_name, get_class_reference, get_static_reference, get_object_reference, build_message_expr, finish_message_expr, build_selector_expr, build_ivar_reference, build_keyword_decl, build_method_decl, build_protocol_expr, build_objc_string_object, objc_declare_alias, objc_declare_class, objc_declare_protocols, objc_comptypes, objc_check_decl, build_encode_expr): Remove prototypes. (imp_count, cat_count): Make GGC-aware. (OBJC_SET_TYPE_NAME): New macro. From-SVN: r87168
2004-09-08 02:49:44 +02:00
return error_mark_node;
}
/* Used by: build_private_template, continue_class,
and for @defs constructs. */
static tree
objc-act.c (objc_build_struct): New function. * objc-act.c (objc_build_struct): New function. (objc_derived_from_p): Likewise. (objc_build_component_ref): Likewise. (objc_copy_binfo): Likewise. (objc_xref_basetypes): Likewise. (objc_lookup_protocol): Likewise. (objc_compare_protocols): Likewise. (objc_volatilize_decl): Likewise. (encode_aggregate_fields): Likewise. (volatilized_hash): Likewise. (volatilized_eq): Likewise. (objc_compare_types): Likewise. (objc_type_quals_match): Likewise. (DERIVED_FROM_P): New ObjC macro, corresponding to C++ macro of same name. (get_class_ivars): Add second parameter indicating if entire hierarchy is desired. (struct volatilized_type): New type. (volatilized_htab): New hash table. (objc_types_compatible_p, objc_comptypes): Remove functions. (synth_module_prologue): Do not initialize 'unused_list'. (objc_get_class_reference): Fix ObjC++ impedance mismatches. (objc_declare_alias): Implement as a typedef. (objc_substitute_decl, objc_gimplify_expr): Reformat. (objc_get_class_ivars): Adjust call to get_class_ivars(). (next_sjlj_build_enter_and_setjmp, synth_forward_declarations, build_ivar_reference, get_super_receiver): Call objc_build_component_ref() instead of build_component_ref(). (objc_begin_catch_clause): Use DERIVED_FROM_P() instead of objc_comptypes(). (build_private_template): Call objc_build_struct() instead of start_struct() and finish_struct(). (hash_init): Initialize volatilized_htab. (objc_is_public): Adjust calls to objc_get_ivars(); adjust ObjC++ impedance mismatches. (encode_aggregate_within): Streamline by calling encode_aggregate_fields(). * objc-act.h (objc_types_compatible_p): Remove prototype. (OCTI_UNUSED_LIST, unused_list): Remove slot. * objc-lang.c (LANG_HOOKS_TYPES_COMPATIBLE_P): Remove. From-SVN: r100123
2005-05-25 00:21:01 +02:00
get_class_ivars (tree interface, bool inherited)
{
Makefile.in (c-parse.o): Depend on $(C_COMMON_H). [gcc/ChangeLog] 2004-09-07 Ziemowit Laski <zlaski@apple.com> * Makefile.in (c-parse.o): Depend on $(C_COMMON_H). * c-parse.in: Include c-common.h instead of objc-act.h. (ivar_decl_list, ivar_decls, ivar_decl, ivars, ivar_declarator, myparms, myparm): Remove %type declarations. (methodtype, optparms, OBJC_TYPE_QUAL, objc_quals, objc_qual, objc_typename, objc_try_catch_stmt, optellipsis): Add %type declarations. (objc_inherit_code, objc_public_flag): Remove. (typespec_nonreserved_nonattr): Call objc_get_protocol_qualified_type() instead of get_static_reference() and get_protocol_reference(). (stmt_nocomp): Call grokparm() on @catch parameter. (objcdef): Move semantic action to objc_finish_implementation(). (classdef): Move semantic action to objc_start_class_interface(), objc_continue_interface(), objc_finish_interface(), objc_start_class_implementation(), objc_continue_implementation(), objc_start_category_interface() and objc_start_category_implementation(). (protocoldef): Move semantic actions to objc_start_protocol() and objc_finish_interface(). (ivar_decl_list): Remove nonterminal. (visibility_spec): Move semantic actions to objc_set_visibility(). (ivar_decls): Remove assignment to $$. (ivar_decl): Rephrase in terms of component_decl; call objc_add_instance_variable(). (ivars, ivar_declarator): Remove nonterminals. (opt_semi): New nonterminal. (methodtype): Remove semantic actions. (methoddef): Move semantic actions to objc_set_method_type(), objc_start_method_definition() and objc_finish_method_definition(). (methodproto): Move semantic actions to objc_set_method_type() and objc_add_method_declaration(). (methoddecl): Use objc_typename instead of typename; move semantic actions to objc_build_method_signature(). (optarglist, myxdecls, mydecl, myparms, myparm): Remove nonterminals. (optparmlist): Express in terms of optparms and optellipsis. (optparms, optellipsis, objc_qual, objc_quals, objc_typename): New nonterminals. (keyworddecl): Use objc_typename instead of typename. (rid_to_yy): Mark RID_IN, RID_OUT, RID_INOUT, RID_BYCOPY, RID_BYREF and RID_ONEWAY as returning OBJC_TYPE_QUAL to yyparse(). [gcc/objc/ChangeLog] 2004-09-07 Ziemowit Laski <zlaski@apple.com> * Make-lang.in (objc/objc-parse.o): Depend on $(C_COMMON_H) instead of objc/objc-act.h. (objc/objc-act.o): Depend on $(HASHTAB_H). * objc-act.c: Include hashtab.h; in ObjC++ mode, include cp-tree.h and objcp-decl.h instead of c-tree.h. (build_module_descriptor, get_class_ivars, synth_id_with_class_suffix, error_with_ivar, gen_method_decl, gen_declaration, setup_string_decl, build_protocol_template): Adjust prototypes. (build_module_initializer_routine, start_class, continue_class, finish_class, start_method_def, objc_start_function, start_protocol, build_method_decl, objc_add_method, add_instance_variable, build_ivar_reference, is_ivar, is_private, get_super_receiver, build_selector_table_decl, objc_push_parm, objc_get_parm_info, gen_type_name, gen_type_name_0, start_var_decl, finish_var_decl, create_field_decl): New prototypes. (objc_expand_function_end, comp_method_with_proto, objc_expr_last, gen_declaration_1, gen_declarator, is_complex_decl, adorn_decl, define_decl, create_builtin_decl, gen_declspecs): Remove prototypes. (TYPE_ID): Rename to OBJECT_TYPEDEF_NAME. (CLASS_TYPEDEF_NAME): New. (TAG_EXECCLASS): Change from a global variable to a #define. (TAG_RETURN_STRUCT): Delete. (TAG_GNUINIT): New, holds '__objc_gnu_init' name. (objc_inherit_code, objc_public_flag): New, moved from c-parse.in. (string_descriptor): New struct. (string_htab): New hash table. (string_hash, string_eq): New prototypes. (generate_struct_by_value_array): Call create_field_decl() instead of create_builtin_decl(). (objc_init): Do not initialize objc_ellipsis_node or TAG_EXECCLASS; In ObjC++ mode, call cxx_init() instead of c_objc_common_init(). (objc_finish_file): In ObjC++, call instantiate_pending_templates() and cp_finish_file(). (define_decl, get_static_reference, get_protocol_reference, create_builtin_decl): Remove functions. (objc_start_class_interface, objc_start_category_interface, objc_start_protocol, objc_continue_interface, objc_finish_interface, objc_start_class_implementation, objc_start_category_implementation, objc_continue_implementation, objc_finish_implementation, objc_set_visibility, objc_set_method_type, objc_build_method_signature, objc_add_method_declaration, objc_start_method_definition, objc_add_instance_variable, objc_get_protocol_qualified_type, create_field_decl, start_var_decl, finish_var_decl): New functions. (setup_string_decl): Simplify since it is only called once. (synth_module_prologue): Call build_class_template(); predefine 'id' and 'Class' as typedefs; rename 'temp_type' to 'type'; disable debug hooks for duration of function; fix GNU runtime messenger signatures to correspond to reality; forward-declare '__objc_exec_class' for the GNU runtime; call build_selector_table_decl(); in ObjC++ mode, generate 'extern "C" { ... }' wrappers around synthesized declarations; call build_protocol_template() and build_category_template(). (string_hash, string_eq): New functions. (objc_build_string_object): Check metaclass correctness only once; store string literals in hash table. (objc_build_constructor): Do not convert initializer elements; adjust for ObjC++ impedance mismatch. (build_objc_symtab_template): Call create_field_decl() instead of create_builtin_decl(). (init_objc_symtab): Add missing conversion to initializer element. (build_metadata_decl): Call start_var_decl() instead of define_decl(). (generate_objc_symtab_decl): Do not call build_category_template(); call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(). (build_module_descriptor): Call create_field_decl() instead of grokfield(); call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(); always mark module descriptor as used; move GNU runtime-specific functionality to build_module_initializer_routine(). (build_module_initializer_routine): New function, broken off of build_module_descriptor(). (objc_static_init_needed_p, objc_generate_static_init_call): New functions. (generate_static_references, generate_strings, build_selector_translation_table, generate_descriptor_table, generate_ivars_list, generate_dispatch_table, generate_category): Call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(); build a type directly instead of via groktypename(). (build_selector_reference_decl, build_selector_table_decl, build_class_reference_decl, build_protocol_reference, generate_objc_image_info): Call start_var_decl() instead of build_decl(). (build_selector_reference): For GNU runtime, do not call build_selector_reference_decl(). (build_selector, build_typed_selector_reference): Always convert result to the selector type. (add_objc_string): Cast return value to 'char *'. (build_method_prototype_template, build_selector_template, build_method_template): Use actual selector type for fields pointing to selectors. (finish_objc): For GNU runtime, call build_module_initializer_routine() after build_module_descriptor(). (generate_protocol_list, generate_shared_structures): Call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(); build a type directly instead of via groktypename(). (synth_id_with_class_suffix): Return a string. (get_arg_type_list): For instance methods, use the instance type for 'self'; do not call groktypename_in_parm_context(). (build_objc_string_decl): Squash redeclaration errors in ObjC++. (objc_is_class_name): Use OBJC_TYPE_NAME instead of TYPE_NAME; handle RECORD_TYPEs in ObjC as well as ObjC++. (objc_is_id): New function. (objc_is_object_ptr): Return the canonical type node. (objc_get_class_ivars): Simplify using get_class_ivars(). (get_class_ivars): Remove second parameter; create a fresh copy of the ivar list for each call; do not check for existence of super class. (objc_eh_runtime_type): Mark #ifndef OBJCPLUS. (objc_init_exceptions): When using SJLJ-style exceptions, require the use of '-fobjc-exceptions' flag; do not require it for DWARF-style exceptions. (objc_build_exc_ptr, next_sjlj_build_try_catch_finally): Use objc_object_type instead of objc_id_type. (objc_begin_catch_clause): Convert the incoming PARM_DECL into a VAR_DECL before placing it in the appropriate scope; do not call define_decl(); adjust call to c_begin_compound_stmt(); use objc_object_type instead of objc_id_type. (build_next_objc_exception_stuff): Call create_field_decl() instead of create_builtin_decl(); construct type directly instead of calling groktypename(); use OBJC_VOID_AT_END to mark end of function parameters. (build_private_template): Adjust call to get_class_ivars(); build a type directly instead of via groktypename(). (build_protocol_template, build_method_prototype_list_template, build_method_prototype_template, build_category_template, build_selector_template, build_class_template, build_super_template, build_ivar_template, build_ivar_list_template, build_method_list_template, build_method_template): Call create_field_decl() instead of grokfield(). (objc_method_parm_type): Do not call groktypename(). (generate_descriptor_table): Call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(). (generate_method_descriptors, build_protocol_initializer, generate_dispatch_tables, build_category_initializer, build_shared_structure_initializer): Do not call groktypename(). (generate_protocols): Call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(); do not call groktypename(). (error_with_ivar): Remove last parameter. (check_ivars): Do not iterate ovar CLASS_RAW_IVARS lists in addition to CLASS_IVARS lists; adjust calls to error_with_ivar(). (generate_ivar_lists): Convert one of the initializer elements; do not call groktypename(). (get_arg_type_list, start_method_def, gen_method_def): Account for new representation of variable arguments and '...' in Objective-C methods; add Objective-C++ impedance matching code. (is_objc_type_qualifier): Remove function. (adjust_type_for_id_default): Simplify; there is no longer a need to wade through declspecs. (lookup_interface, start_class, continue_class, finish_class, start_method_def, start_protocol, build_method_decl, objc_add_method, add_instance_variable, build_ivar_reference, is_ivar, is_private, get_super_receiver, objc_build_finally_epilogue): Make into static functions. (receiver_is_class_object): Use new IS_CLASS() macro. (objc_build_message_expr): Tweak ObjC++ message argument handling; call objc_finish_message_expr() instead of finish_message_expr(). (finish_message_expr): Rename to objc_finish_message_expr(); use OBJC_TYPE_NAME and OBJC_SET_TYPE_NAME macros instead of TYPE_NAME. call gen_type_name() instead of gen_declaration(); call objc_is_id() instead of using IS_ID and IS_CLASS; Use objc_class_name instead of calling get_identifier("Class"); handle CONVERT_EXPRs in receiver. (build_objc_method_call, warn_with_method): Do not call groktypename(). (build_ivar_reference): Call convert() instead of clobbering in a type. (hash_init): Initialize string_htab hash table. (add_instance_variable): Simplify parameter list; do not call grokfield(); do not populate CLASS_IVARS list. (start_class): Check for the existence of super class, if one was specified. (continue_class): Use CLASS_RAW_IVARS rather than CLASS_IVARS; do not call build_class_template(); adjust call to get_class_ivars(); call build_decl(), pushdecl() and finish_decl() instead of define_decl(). (finish_class): Call build_decl(), pushdecl() and finish_decl() instead of define_decl(). (add_protocols): Use PROTOCOL_BINFO_ELTS for the tree vector size. (start_protocol): Do not call build_protocol_template(); use PROTOCOL_BINFO_ELTS for the tree vector size. (encode_type_qualifiers): Do not handle the 'const' qualifier here. (encode_pointer): Encode 'const char *' as 'r*', for backwards compatibility. (encode_array): Use HOST_WIDE_INT_PRINT_DEC instead of "%ld". (encode_type): Handle the 'const' qualifier here. (objc_parmlist): New global variable, sued by objc_push_parm and objc_get_parm_info(). (objc_push_parm, objc_get_parm_info): New functions. (objc_expr_last): Remove function. (synth_self_and_ucmd_args): For instance methods, use the instance type for 'self'; call objc_push_parm() instead of push_parm_decl(). (start_method_def): Do not call push_scope(), declare_parm_level(), pop_scope(), push_parm_decl(), store_parm_decls() or objc_expr_last(); just use objc_push_parm() and objc_get_parm_info(). (comp_method_with_proto): Remove function. (objc_types_are_equivalent): Strip away indirections before comparing underlying types. (comp_proto_with_proto): Do not call groktypename(); types are no longer in raw declspec format. (objc_start_function): New function. (really_start_method): Call comp_proto_with_proto() instead of comp_method_with_proto(); call objc_start_function() instead of hand-crafting a function declarator. (continue_method_def, objc_expand_function_end): Remove functions. (get_super_receiver): Call objc_get_current_scope() instead of get_current_scope(); reference 'super_class' field (instead of 'class'). (finish_method_def): Rename to objc_finish_method_definition() and add a function decl parameter; move method encoding call from objc_expand_function_end(). (is_complex_decl, adorn_decl, gen_declarator, gen_declspecs, gen_declaration_1): Remove functions. (tmpbuf, RAW_DECLSPEC): Remove. (gen_declaration): Remove second parameter; simplify to deal with TYPE_P nodes instead of raw declspecs. (gen_type_name, gen_type_name_0): New functions. (gen_method_decl): Remove second parameter; call gen_type_name() instead of gen_declaration_1(). (dump_interface): Adjust calls to gen_declaration() and gen_method_decl(); do not allocate a separate string buffer. (init_objc): Allocate a larger string buffer to accommodate dump_interface(); adjust call to build_module_descriptor(); add call to build_module_initializer_routine() for the GNU runtime. (generate_classref_translation_entry): Do not call start_decl(); call finish_var_decl() instead of finish_decl(); call convert() instead of build_c_cast(). * objc-act.h (CLASS_OWN_IVARS): Remove accessor. (CLASS_BINFO_ELTS): Reduce from 6 to 5, now that CLASS_OWN_IVARS is gone. (OCTI_GNU_INIT_DECL, GNU_INIT_decl): New. (OCTI_ELLIPSIS_NODE, objc_ellipsis_node): Remove. (OCTI_ID_ID, id_type, objc_id_id): Rename to OCTI_ID_NAME, objc_object_type and objc_object_name, respectively. (OCTI_CLS_REF, OCTI_CLASS_NAME, objc_class_reference, objc_class_name): New. (IS_CLASS): New macro. (IS_ID, IS_SUPER): Robustify. (OCTI_EXECCLASS_DECL, execclass_decl): New. (finish_file, start_class, continue_class, finish_class, start_method_def, continue_method_def, finish_method_def, start_protocol, finish_protocol, objc_build_throw_stmt, objc_build_try_catch_finally_stmt, objc_build_synchronized_prologue, objc_build_synchronized_epilogue, objc_build_try_prologue, objc_build_try_epilogue, objc_build_catch_stmt, objc_build_catch_epilogue, objc_build_finally_prologue, objc_build_finally_epilogue, is_ivar, is_private, is_public, add_instance_variable, objc_add_method, get_super_receiver, objc_clear_super_receiver, get_class_ivars_from_name, get_class_reference, get_static_reference, get_object_reference, build_message_expr, finish_message_expr, build_selector_expr, build_ivar_reference, build_keyword_decl, build_method_decl, build_protocol_expr, build_objc_string_object, objc_declare_alias, objc_declare_class, objc_declare_protocols, objc_comptypes, objc_check_decl, build_encode_expr): Remove prototypes. (imp_count, cat_count): Make GGC-aware. (OBJC_SET_TYPE_NAME): New macro. From-SVN: r87168
2004-09-08 02:49:44 +02:00
tree ivar_chain = copy_list (CLASS_RAW_IVARS (interface));
Makefile.in (c-parse.o): Depend on $(C_COMMON_H). [gcc/ChangeLog] 2004-09-07 Ziemowit Laski <zlaski@apple.com> * Makefile.in (c-parse.o): Depend on $(C_COMMON_H). * c-parse.in: Include c-common.h instead of objc-act.h. (ivar_decl_list, ivar_decls, ivar_decl, ivars, ivar_declarator, myparms, myparm): Remove %type declarations. (methodtype, optparms, OBJC_TYPE_QUAL, objc_quals, objc_qual, objc_typename, objc_try_catch_stmt, optellipsis): Add %type declarations. (objc_inherit_code, objc_public_flag): Remove. (typespec_nonreserved_nonattr): Call objc_get_protocol_qualified_type() instead of get_static_reference() and get_protocol_reference(). (stmt_nocomp): Call grokparm() on @catch parameter. (objcdef): Move semantic action to objc_finish_implementation(). (classdef): Move semantic action to objc_start_class_interface(), objc_continue_interface(), objc_finish_interface(), objc_start_class_implementation(), objc_continue_implementation(), objc_start_category_interface() and objc_start_category_implementation(). (protocoldef): Move semantic actions to objc_start_protocol() and objc_finish_interface(). (ivar_decl_list): Remove nonterminal. (visibility_spec): Move semantic actions to objc_set_visibility(). (ivar_decls): Remove assignment to $$. (ivar_decl): Rephrase in terms of component_decl; call objc_add_instance_variable(). (ivars, ivar_declarator): Remove nonterminals. (opt_semi): New nonterminal. (methodtype): Remove semantic actions. (methoddef): Move semantic actions to objc_set_method_type(), objc_start_method_definition() and objc_finish_method_definition(). (methodproto): Move semantic actions to objc_set_method_type() and objc_add_method_declaration(). (methoddecl): Use objc_typename instead of typename; move semantic actions to objc_build_method_signature(). (optarglist, myxdecls, mydecl, myparms, myparm): Remove nonterminals. (optparmlist): Express in terms of optparms and optellipsis. (optparms, optellipsis, objc_qual, objc_quals, objc_typename): New nonterminals. (keyworddecl): Use objc_typename instead of typename. (rid_to_yy): Mark RID_IN, RID_OUT, RID_INOUT, RID_BYCOPY, RID_BYREF and RID_ONEWAY as returning OBJC_TYPE_QUAL to yyparse(). [gcc/objc/ChangeLog] 2004-09-07 Ziemowit Laski <zlaski@apple.com> * Make-lang.in (objc/objc-parse.o): Depend on $(C_COMMON_H) instead of objc/objc-act.h. (objc/objc-act.o): Depend on $(HASHTAB_H). * objc-act.c: Include hashtab.h; in ObjC++ mode, include cp-tree.h and objcp-decl.h instead of c-tree.h. (build_module_descriptor, get_class_ivars, synth_id_with_class_suffix, error_with_ivar, gen_method_decl, gen_declaration, setup_string_decl, build_protocol_template): Adjust prototypes. (build_module_initializer_routine, start_class, continue_class, finish_class, start_method_def, objc_start_function, start_protocol, build_method_decl, objc_add_method, add_instance_variable, build_ivar_reference, is_ivar, is_private, get_super_receiver, build_selector_table_decl, objc_push_parm, objc_get_parm_info, gen_type_name, gen_type_name_0, start_var_decl, finish_var_decl, create_field_decl): New prototypes. (objc_expand_function_end, comp_method_with_proto, objc_expr_last, gen_declaration_1, gen_declarator, is_complex_decl, adorn_decl, define_decl, create_builtin_decl, gen_declspecs): Remove prototypes. (TYPE_ID): Rename to OBJECT_TYPEDEF_NAME. (CLASS_TYPEDEF_NAME): New. (TAG_EXECCLASS): Change from a global variable to a #define. (TAG_RETURN_STRUCT): Delete. (TAG_GNUINIT): New, holds '__objc_gnu_init' name. (objc_inherit_code, objc_public_flag): New, moved from c-parse.in. (string_descriptor): New struct. (string_htab): New hash table. (string_hash, string_eq): New prototypes. (generate_struct_by_value_array): Call create_field_decl() instead of create_builtin_decl(). (objc_init): Do not initialize objc_ellipsis_node or TAG_EXECCLASS; In ObjC++ mode, call cxx_init() instead of c_objc_common_init(). (objc_finish_file): In ObjC++, call instantiate_pending_templates() and cp_finish_file(). (define_decl, get_static_reference, get_protocol_reference, create_builtin_decl): Remove functions. (objc_start_class_interface, objc_start_category_interface, objc_start_protocol, objc_continue_interface, objc_finish_interface, objc_start_class_implementation, objc_start_category_implementation, objc_continue_implementation, objc_finish_implementation, objc_set_visibility, objc_set_method_type, objc_build_method_signature, objc_add_method_declaration, objc_start_method_definition, objc_add_instance_variable, objc_get_protocol_qualified_type, create_field_decl, start_var_decl, finish_var_decl): New functions. (setup_string_decl): Simplify since it is only called once. (synth_module_prologue): Call build_class_template(); predefine 'id' and 'Class' as typedefs; rename 'temp_type' to 'type'; disable debug hooks for duration of function; fix GNU runtime messenger signatures to correspond to reality; forward-declare '__objc_exec_class' for the GNU runtime; call build_selector_table_decl(); in ObjC++ mode, generate 'extern "C" { ... }' wrappers around synthesized declarations; call build_protocol_template() and build_category_template(). (string_hash, string_eq): New functions. (objc_build_string_object): Check metaclass correctness only once; store string literals in hash table. (objc_build_constructor): Do not convert initializer elements; adjust for ObjC++ impedance mismatch. (build_objc_symtab_template): Call create_field_decl() instead of create_builtin_decl(). (init_objc_symtab): Add missing conversion to initializer element. (build_metadata_decl): Call start_var_decl() instead of define_decl(). (generate_objc_symtab_decl): Do not call build_category_template(); call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(). (build_module_descriptor): Call create_field_decl() instead of grokfield(); call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(); always mark module descriptor as used; move GNU runtime-specific functionality to build_module_initializer_routine(). (build_module_initializer_routine): New function, broken off of build_module_descriptor(). (objc_static_init_needed_p, objc_generate_static_init_call): New functions. (generate_static_references, generate_strings, build_selector_translation_table, generate_descriptor_table, generate_ivars_list, generate_dispatch_table, generate_category): Call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(); build a type directly instead of via groktypename(). (build_selector_reference_decl, build_selector_table_decl, build_class_reference_decl, build_protocol_reference, generate_objc_image_info): Call start_var_decl() instead of build_decl(). (build_selector_reference): For GNU runtime, do not call build_selector_reference_decl(). (build_selector, build_typed_selector_reference): Always convert result to the selector type. (add_objc_string): Cast return value to 'char *'. (build_method_prototype_template, build_selector_template, build_method_template): Use actual selector type for fields pointing to selectors. (finish_objc): For GNU runtime, call build_module_initializer_routine() after build_module_descriptor(). (generate_protocol_list, generate_shared_structures): Call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(); build a type directly instead of via groktypename(). (synth_id_with_class_suffix): Return a string. (get_arg_type_list): For instance methods, use the instance type for 'self'; do not call groktypename_in_parm_context(). (build_objc_string_decl): Squash redeclaration errors in ObjC++. (objc_is_class_name): Use OBJC_TYPE_NAME instead of TYPE_NAME; handle RECORD_TYPEs in ObjC as well as ObjC++. (objc_is_id): New function. (objc_is_object_ptr): Return the canonical type node. (objc_get_class_ivars): Simplify using get_class_ivars(). (get_class_ivars): Remove second parameter; create a fresh copy of the ivar list for each call; do not check for existence of super class. (objc_eh_runtime_type): Mark #ifndef OBJCPLUS. (objc_init_exceptions): When using SJLJ-style exceptions, require the use of '-fobjc-exceptions' flag; do not require it for DWARF-style exceptions. (objc_build_exc_ptr, next_sjlj_build_try_catch_finally): Use objc_object_type instead of objc_id_type. (objc_begin_catch_clause): Convert the incoming PARM_DECL into a VAR_DECL before placing it in the appropriate scope; do not call define_decl(); adjust call to c_begin_compound_stmt(); use objc_object_type instead of objc_id_type. (build_next_objc_exception_stuff): Call create_field_decl() instead of create_builtin_decl(); construct type directly instead of calling groktypename(); use OBJC_VOID_AT_END to mark end of function parameters. (build_private_template): Adjust call to get_class_ivars(); build a type directly instead of via groktypename(). (build_protocol_template, build_method_prototype_list_template, build_method_prototype_template, build_category_template, build_selector_template, build_class_template, build_super_template, build_ivar_template, build_ivar_list_template, build_method_list_template, build_method_template): Call create_field_decl() instead of grokfield(). (objc_method_parm_type): Do not call groktypename(). (generate_descriptor_table): Call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(). (generate_method_descriptors, build_protocol_initializer, generate_dispatch_tables, build_category_initializer, build_shared_structure_initializer): Do not call groktypename(). (generate_protocols): Call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(); do not call groktypename(). (error_with_ivar): Remove last parameter. (check_ivars): Do not iterate ovar CLASS_RAW_IVARS lists in addition to CLASS_IVARS lists; adjust calls to error_with_ivar(). (generate_ivar_lists): Convert one of the initializer elements; do not call groktypename(). (get_arg_type_list, start_method_def, gen_method_def): Account for new representation of variable arguments and '...' in Objective-C methods; add Objective-C++ impedance matching code. (is_objc_type_qualifier): Remove function. (adjust_type_for_id_default): Simplify; there is no longer a need to wade through declspecs. (lookup_interface, start_class, continue_class, finish_class, start_method_def, start_protocol, build_method_decl, objc_add_method, add_instance_variable, build_ivar_reference, is_ivar, is_private, get_super_receiver, objc_build_finally_epilogue): Make into static functions. (receiver_is_class_object): Use new IS_CLASS() macro. (objc_build_message_expr): Tweak ObjC++ message argument handling; call objc_finish_message_expr() instead of finish_message_expr(). (finish_message_expr): Rename to objc_finish_message_expr(); use OBJC_TYPE_NAME and OBJC_SET_TYPE_NAME macros instead of TYPE_NAME. call gen_type_name() instead of gen_declaration(); call objc_is_id() instead of using IS_ID and IS_CLASS; Use objc_class_name instead of calling get_identifier("Class"); handle CONVERT_EXPRs in receiver. (build_objc_method_call, warn_with_method): Do not call groktypename(). (build_ivar_reference): Call convert() instead of clobbering in a type. (hash_init): Initialize string_htab hash table. (add_instance_variable): Simplify parameter list; do not call grokfield(); do not populate CLASS_IVARS list. (start_class): Check for the existence of super class, if one was specified. (continue_class): Use CLASS_RAW_IVARS rather than CLASS_IVARS; do not call build_class_template(); adjust call to get_class_ivars(); call build_decl(), pushdecl() and finish_decl() instead of define_decl(). (finish_class): Call build_decl(), pushdecl() and finish_decl() instead of define_decl(). (add_protocols): Use PROTOCOL_BINFO_ELTS for the tree vector size. (start_protocol): Do not call build_protocol_template(); use PROTOCOL_BINFO_ELTS for the tree vector size. (encode_type_qualifiers): Do not handle the 'const' qualifier here. (encode_pointer): Encode 'const char *' as 'r*', for backwards compatibility. (encode_array): Use HOST_WIDE_INT_PRINT_DEC instead of "%ld". (encode_type): Handle the 'const' qualifier here. (objc_parmlist): New global variable, sued by objc_push_parm and objc_get_parm_info(). (objc_push_parm, objc_get_parm_info): New functions. (objc_expr_last): Remove function. (synth_self_and_ucmd_args): For instance methods, use the instance type for 'self'; call objc_push_parm() instead of push_parm_decl(). (start_method_def): Do not call push_scope(), declare_parm_level(), pop_scope(), push_parm_decl(), store_parm_decls() or objc_expr_last(); just use objc_push_parm() and objc_get_parm_info(). (comp_method_with_proto): Remove function. (objc_types_are_equivalent): Strip away indirections before comparing underlying types. (comp_proto_with_proto): Do not call groktypename(); types are no longer in raw declspec format. (objc_start_function): New function. (really_start_method): Call comp_proto_with_proto() instead of comp_method_with_proto(); call objc_start_function() instead of hand-crafting a function declarator. (continue_method_def, objc_expand_function_end): Remove functions. (get_super_receiver): Call objc_get_current_scope() instead of get_current_scope(); reference 'super_class' field (instead of 'class'). (finish_method_def): Rename to objc_finish_method_definition() and add a function decl parameter; move method encoding call from objc_expand_function_end(). (is_complex_decl, adorn_decl, gen_declarator, gen_declspecs, gen_declaration_1): Remove functions. (tmpbuf, RAW_DECLSPEC): Remove. (gen_declaration): Remove second parameter; simplify to deal with TYPE_P nodes instead of raw declspecs. (gen_type_name, gen_type_name_0): New functions. (gen_method_decl): Remove second parameter; call gen_type_name() instead of gen_declaration_1(). (dump_interface): Adjust calls to gen_declaration() and gen_method_decl(); do not allocate a separate string buffer. (init_objc): Allocate a larger string buffer to accommodate dump_interface(); adjust call to build_module_descriptor(); add call to build_module_initializer_routine() for the GNU runtime. (generate_classref_translation_entry): Do not call start_decl(); call finish_var_decl() instead of finish_decl(); call convert() instead of build_c_cast(). * objc-act.h (CLASS_OWN_IVARS): Remove accessor. (CLASS_BINFO_ELTS): Reduce from 6 to 5, now that CLASS_OWN_IVARS is gone. (OCTI_GNU_INIT_DECL, GNU_INIT_decl): New. (OCTI_ELLIPSIS_NODE, objc_ellipsis_node): Remove. (OCTI_ID_ID, id_type, objc_id_id): Rename to OCTI_ID_NAME, objc_object_type and objc_object_name, respectively. (OCTI_CLS_REF, OCTI_CLASS_NAME, objc_class_reference, objc_class_name): New. (IS_CLASS): New macro. (IS_ID, IS_SUPER): Robustify. (OCTI_EXECCLASS_DECL, execclass_decl): New. (finish_file, start_class, continue_class, finish_class, start_method_def, continue_method_def, finish_method_def, start_protocol, finish_protocol, objc_build_throw_stmt, objc_build_try_catch_finally_stmt, objc_build_synchronized_prologue, objc_build_synchronized_epilogue, objc_build_try_prologue, objc_build_try_epilogue, objc_build_catch_stmt, objc_build_catch_epilogue, objc_build_finally_prologue, objc_build_finally_epilogue, is_ivar, is_private, is_public, add_instance_variable, objc_add_method, get_super_receiver, objc_clear_super_receiver, get_class_ivars_from_name, get_class_reference, get_static_reference, get_object_reference, build_message_expr, finish_message_expr, build_selector_expr, build_ivar_reference, build_keyword_decl, build_method_decl, build_protocol_expr, build_objc_string_object, objc_declare_alias, objc_declare_class, objc_declare_protocols, objc_comptypes, objc_check_decl, build_encode_expr): Remove prototypes. (imp_count, cat_count): Make GGC-aware. (OBJC_SET_TYPE_NAME): New macro. From-SVN: r87168
2004-09-08 02:49:44 +02:00
/* Both CLASS_RAW_IVARS and CLASS_IVARS contain a list of ivars declared
by the current class (i.e., they do not include super-class ivars).
However, the CLASS_IVARS list will be side-effected by a call to
finish_struct(), which will fill in field offsets. */
if (!CLASS_IVARS (interface))
CLASS_IVARS (interface) = ivar_chain;
objc-act.c (objc_build_struct): New function. * objc-act.c (objc_build_struct): New function. (objc_derived_from_p): Likewise. (objc_build_component_ref): Likewise. (objc_copy_binfo): Likewise. (objc_xref_basetypes): Likewise. (objc_lookup_protocol): Likewise. (objc_compare_protocols): Likewise. (objc_volatilize_decl): Likewise. (encode_aggregate_fields): Likewise. (volatilized_hash): Likewise. (volatilized_eq): Likewise. (objc_compare_types): Likewise. (objc_type_quals_match): Likewise. (DERIVED_FROM_P): New ObjC macro, corresponding to C++ macro of same name. (get_class_ivars): Add second parameter indicating if entire hierarchy is desired. (struct volatilized_type): New type. (volatilized_htab): New hash table. (objc_types_compatible_p, objc_comptypes): Remove functions. (synth_module_prologue): Do not initialize 'unused_list'. (objc_get_class_reference): Fix ObjC++ impedance mismatches. (objc_declare_alias): Implement as a typedef. (objc_substitute_decl, objc_gimplify_expr): Reformat. (objc_get_class_ivars): Adjust call to get_class_ivars(). (next_sjlj_build_enter_and_setjmp, synth_forward_declarations, build_ivar_reference, get_super_receiver): Call objc_build_component_ref() instead of build_component_ref(). (objc_begin_catch_clause): Use DERIVED_FROM_P() instead of objc_comptypes(). (build_private_template): Call objc_build_struct() instead of start_struct() and finish_struct(). (hash_init): Initialize volatilized_htab. (objc_is_public): Adjust calls to objc_get_ivars(); adjust ObjC++ impedance mismatches. (encode_aggregate_within): Streamline by calling encode_aggregate_fields(). * objc-act.h (objc_types_compatible_p): Remove prototype. (OCTI_UNUSED_LIST, unused_list): Remove slot. * objc-lang.c (LANG_HOOKS_TYPES_COMPATIBLE_P): Remove. From-SVN: r100123
2005-05-25 00:21:01 +02:00
if (!inherited)
return ivar_chain;
Makefile.in (c-parse.o): Depend on $(C_COMMON_H). [gcc/ChangeLog] 2004-09-07 Ziemowit Laski <zlaski@apple.com> * Makefile.in (c-parse.o): Depend on $(C_COMMON_H). * c-parse.in: Include c-common.h instead of objc-act.h. (ivar_decl_list, ivar_decls, ivar_decl, ivars, ivar_declarator, myparms, myparm): Remove %type declarations. (methodtype, optparms, OBJC_TYPE_QUAL, objc_quals, objc_qual, objc_typename, objc_try_catch_stmt, optellipsis): Add %type declarations. (objc_inherit_code, objc_public_flag): Remove. (typespec_nonreserved_nonattr): Call objc_get_protocol_qualified_type() instead of get_static_reference() and get_protocol_reference(). (stmt_nocomp): Call grokparm() on @catch parameter. (objcdef): Move semantic action to objc_finish_implementation(). (classdef): Move semantic action to objc_start_class_interface(), objc_continue_interface(), objc_finish_interface(), objc_start_class_implementation(), objc_continue_implementation(), objc_start_category_interface() and objc_start_category_implementation(). (protocoldef): Move semantic actions to objc_start_protocol() and objc_finish_interface(). (ivar_decl_list): Remove nonterminal. (visibility_spec): Move semantic actions to objc_set_visibility(). (ivar_decls): Remove assignment to $$. (ivar_decl): Rephrase in terms of component_decl; call objc_add_instance_variable(). (ivars, ivar_declarator): Remove nonterminals. (opt_semi): New nonterminal. (methodtype): Remove semantic actions. (methoddef): Move semantic actions to objc_set_method_type(), objc_start_method_definition() and objc_finish_method_definition(). (methodproto): Move semantic actions to objc_set_method_type() and objc_add_method_declaration(). (methoddecl): Use objc_typename instead of typename; move semantic actions to objc_build_method_signature(). (optarglist, myxdecls, mydecl, myparms, myparm): Remove nonterminals. (optparmlist): Express in terms of optparms and optellipsis. (optparms, optellipsis, objc_qual, objc_quals, objc_typename): New nonterminals. (keyworddecl): Use objc_typename instead of typename. (rid_to_yy): Mark RID_IN, RID_OUT, RID_INOUT, RID_BYCOPY, RID_BYREF and RID_ONEWAY as returning OBJC_TYPE_QUAL to yyparse(). [gcc/objc/ChangeLog] 2004-09-07 Ziemowit Laski <zlaski@apple.com> * Make-lang.in (objc/objc-parse.o): Depend on $(C_COMMON_H) instead of objc/objc-act.h. (objc/objc-act.o): Depend on $(HASHTAB_H). * objc-act.c: Include hashtab.h; in ObjC++ mode, include cp-tree.h and objcp-decl.h instead of c-tree.h. (build_module_descriptor, get_class_ivars, synth_id_with_class_suffix, error_with_ivar, gen_method_decl, gen_declaration, setup_string_decl, build_protocol_template): Adjust prototypes. (build_module_initializer_routine, start_class, continue_class, finish_class, start_method_def, objc_start_function, start_protocol, build_method_decl, objc_add_method, add_instance_variable, build_ivar_reference, is_ivar, is_private, get_super_receiver, build_selector_table_decl, objc_push_parm, objc_get_parm_info, gen_type_name, gen_type_name_0, start_var_decl, finish_var_decl, create_field_decl): New prototypes. (objc_expand_function_end, comp_method_with_proto, objc_expr_last, gen_declaration_1, gen_declarator, is_complex_decl, adorn_decl, define_decl, create_builtin_decl, gen_declspecs): Remove prototypes. (TYPE_ID): Rename to OBJECT_TYPEDEF_NAME. (CLASS_TYPEDEF_NAME): New. (TAG_EXECCLASS): Change from a global variable to a #define. (TAG_RETURN_STRUCT): Delete. (TAG_GNUINIT): New, holds '__objc_gnu_init' name. (objc_inherit_code, objc_public_flag): New, moved from c-parse.in. (string_descriptor): New struct. (string_htab): New hash table. (string_hash, string_eq): New prototypes. (generate_struct_by_value_array): Call create_field_decl() instead of create_builtin_decl(). (objc_init): Do not initialize objc_ellipsis_node or TAG_EXECCLASS; In ObjC++ mode, call cxx_init() instead of c_objc_common_init(). (objc_finish_file): In ObjC++, call instantiate_pending_templates() and cp_finish_file(). (define_decl, get_static_reference, get_protocol_reference, create_builtin_decl): Remove functions. (objc_start_class_interface, objc_start_category_interface, objc_start_protocol, objc_continue_interface, objc_finish_interface, objc_start_class_implementation, objc_start_category_implementation, objc_continue_implementation, objc_finish_implementation, objc_set_visibility, objc_set_method_type, objc_build_method_signature, objc_add_method_declaration, objc_start_method_definition, objc_add_instance_variable, objc_get_protocol_qualified_type, create_field_decl, start_var_decl, finish_var_decl): New functions. (setup_string_decl): Simplify since it is only called once. (synth_module_prologue): Call build_class_template(); predefine 'id' and 'Class' as typedefs; rename 'temp_type' to 'type'; disable debug hooks for duration of function; fix GNU runtime messenger signatures to correspond to reality; forward-declare '__objc_exec_class' for the GNU runtime; call build_selector_table_decl(); in ObjC++ mode, generate 'extern "C" { ... }' wrappers around synthesized declarations; call build_protocol_template() and build_category_template(). (string_hash, string_eq): New functions. (objc_build_string_object): Check metaclass correctness only once; store string literals in hash table. (objc_build_constructor): Do not convert initializer elements; adjust for ObjC++ impedance mismatch. (build_objc_symtab_template): Call create_field_decl() instead of create_builtin_decl(). (init_objc_symtab): Add missing conversion to initializer element. (build_metadata_decl): Call start_var_decl() instead of define_decl(). (generate_objc_symtab_decl): Do not call build_category_template(); call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(). (build_module_descriptor): Call create_field_decl() instead of grokfield(); call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(); always mark module descriptor as used; move GNU runtime-specific functionality to build_module_initializer_routine(). (build_module_initializer_routine): New function, broken off of build_module_descriptor(). (objc_static_init_needed_p, objc_generate_static_init_call): New functions. (generate_static_references, generate_strings, build_selector_translation_table, generate_descriptor_table, generate_ivars_list, generate_dispatch_table, generate_category): Call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(); build a type directly instead of via groktypename(). (build_selector_reference_decl, build_selector_table_decl, build_class_reference_decl, build_protocol_reference, generate_objc_image_info): Call start_var_decl() instead of build_decl(). (build_selector_reference): For GNU runtime, do not call build_selector_reference_decl(). (build_selector, build_typed_selector_reference): Always convert result to the selector type. (add_objc_string): Cast return value to 'char *'. (build_method_prototype_template, build_selector_template, build_method_template): Use actual selector type for fields pointing to selectors. (finish_objc): For GNU runtime, call build_module_initializer_routine() after build_module_descriptor(). (generate_protocol_list, generate_shared_structures): Call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(); build a type directly instead of via groktypename(). (synth_id_with_class_suffix): Return a string. (get_arg_type_list): For instance methods, use the instance type for 'self'; do not call groktypename_in_parm_context(). (build_objc_string_decl): Squash redeclaration errors in ObjC++. (objc_is_class_name): Use OBJC_TYPE_NAME instead of TYPE_NAME; handle RECORD_TYPEs in ObjC as well as ObjC++. (objc_is_id): New function. (objc_is_object_ptr): Return the canonical type node. (objc_get_class_ivars): Simplify using get_class_ivars(). (get_class_ivars): Remove second parameter; create a fresh copy of the ivar list for each call; do not check for existence of super class. (objc_eh_runtime_type): Mark #ifndef OBJCPLUS. (objc_init_exceptions): When using SJLJ-style exceptions, require the use of '-fobjc-exceptions' flag; do not require it for DWARF-style exceptions. (objc_build_exc_ptr, next_sjlj_build_try_catch_finally): Use objc_object_type instead of objc_id_type. (objc_begin_catch_clause): Convert the incoming PARM_DECL into a VAR_DECL before placing it in the appropriate scope; do not call define_decl(); adjust call to c_begin_compound_stmt(); use objc_object_type instead of objc_id_type. (build_next_objc_exception_stuff): Call create_field_decl() instead of create_builtin_decl(); construct type directly instead of calling groktypename(); use OBJC_VOID_AT_END to mark end of function parameters. (build_private_template): Adjust call to get_class_ivars(); build a type directly instead of via groktypename(). (build_protocol_template, build_method_prototype_list_template, build_method_prototype_template, build_category_template, build_selector_template, build_class_template, build_super_template, build_ivar_template, build_ivar_list_template, build_method_list_template, build_method_template): Call create_field_decl() instead of grokfield(). (objc_method_parm_type): Do not call groktypename(). (generate_descriptor_table): Call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(). (generate_method_descriptors, build_protocol_initializer, generate_dispatch_tables, build_category_initializer, build_shared_structure_initializer): Do not call groktypename(). (generate_protocols): Call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(); do not call groktypename(). (error_with_ivar): Remove last parameter. (check_ivars): Do not iterate ovar CLASS_RAW_IVARS lists in addition to CLASS_IVARS lists; adjust calls to error_with_ivar(). (generate_ivar_lists): Convert one of the initializer elements; do not call groktypename(). (get_arg_type_list, start_method_def, gen_method_def): Account for new representation of variable arguments and '...' in Objective-C methods; add Objective-C++ impedance matching code. (is_objc_type_qualifier): Remove function. (adjust_type_for_id_default): Simplify; there is no longer a need to wade through declspecs. (lookup_interface, start_class, continue_class, finish_class, start_method_def, start_protocol, build_method_decl, objc_add_method, add_instance_variable, build_ivar_reference, is_ivar, is_private, get_super_receiver, objc_build_finally_epilogue): Make into static functions. (receiver_is_class_object): Use new IS_CLASS() macro. (objc_build_message_expr): Tweak ObjC++ message argument handling; call objc_finish_message_expr() instead of finish_message_expr(). (finish_message_expr): Rename to objc_finish_message_expr(); use OBJC_TYPE_NAME and OBJC_SET_TYPE_NAME macros instead of TYPE_NAME. call gen_type_name() instead of gen_declaration(); call objc_is_id() instead of using IS_ID and IS_CLASS; Use objc_class_name instead of calling get_identifier("Class"); handle CONVERT_EXPRs in receiver. (build_objc_method_call, warn_with_method): Do not call groktypename(). (build_ivar_reference): Call convert() instead of clobbering in a type. (hash_init): Initialize string_htab hash table. (add_instance_variable): Simplify parameter list; do not call grokfield(); do not populate CLASS_IVARS list. (start_class): Check for the existence of super class, if one was specified. (continue_class): Use CLASS_RAW_IVARS rather than CLASS_IVARS; do not call build_class_template(); adjust call to get_class_ivars(); call build_decl(), pushdecl() and finish_decl() instead of define_decl(). (finish_class): Call build_decl(), pushdecl() and finish_decl() instead of define_decl(). (add_protocols): Use PROTOCOL_BINFO_ELTS for the tree vector size. (start_protocol): Do not call build_protocol_template(); use PROTOCOL_BINFO_ELTS for the tree vector size. (encode_type_qualifiers): Do not handle the 'const' qualifier here. (encode_pointer): Encode 'const char *' as 'r*', for backwards compatibility. (encode_array): Use HOST_WIDE_INT_PRINT_DEC instead of "%ld". (encode_type): Handle the 'const' qualifier here. (objc_parmlist): New global variable, sued by objc_push_parm and objc_get_parm_info(). (objc_push_parm, objc_get_parm_info): New functions. (objc_expr_last): Remove function. (synth_self_and_ucmd_args): For instance methods, use the instance type for 'self'; call objc_push_parm() instead of push_parm_decl(). (start_method_def): Do not call push_scope(), declare_parm_level(), pop_scope(), push_parm_decl(), store_parm_decls() or objc_expr_last(); just use objc_push_parm() and objc_get_parm_info(). (comp_method_with_proto): Remove function. (objc_types_are_equivalent): Strip away indirections before comparing underlying types. (comp_proto_with_proto): Do not call groktypename(); types are no longer in raw declspec format. (objc_start_function): New function. (really_start_method): Call comp_proto_with_proto() instead of comp_method_with_proto(); call objc_start_function() instead of hand-crafting a function declarator. (continue_method_def, objc_expand_function_end): Remove functions. (get_super_receiver): Call objc_get_current_scope() instead of get_current_scope(); reference 'super_class' field (instead of 'class'). (finish_method_def): Rename to objc_finish_method_definition() and add a function decl parameter; move method encoding call from objc_expand_function_end(). (is_complex_decl, adorn_decl, gen_declarator, gen_declspecs, gen_declaration_1): Remove functions. (tmpbuf, RAW_DECLSPEC): Remove. (gen_declaration): Remove second parameter; simplify to deal with TYPE_P nodes instead of raw declspecs. (gen_type_name, gen_type_name_0): New functions. (gen_method_decl): Remove second parameter; call gen_type_name() instead of gen_declaration_1(). (dump_interface): Adjust calls to gen_declaration() and gen_method_decl(); do not allocate a separate string buffer. (init_objc): Allocate a larger string buffer to accommodate dump_interface(); adjust call to build_module_descriptor(); add call to build_module_initializer_routine() for the GNU runtime. (generate_classref_translation_entry): Do not call start_decl(); call finish_var_decl() instead of finish_decl(); call convert() instead of build_c_cast(). * objc-act.h (CLASS_OWN_IVARS): Remove accessor. (CLASS_BINFO_ELTS): Reduce from 6 to 5, now that CLASS_OWN_IVARS is gone. (OCTI_GNU_INIT_DECL, GNU_INIT_decl): New. (OCTI_ELLIPSIS_NODE, objc_ellipsis_node): Remove. (OCTI_ID_ID, id_type, objc_id_id): Rename to OCTI_ID_NAME, objc_object_type and objc_object_name, respectively. (OCTI_CLS_REF, OCTI_CLASS_NAME, objc_class_reference, objc_class_name): New. (IS_CLASS): New macro. (IS_ID, IS_SUPER): Robustify. (OCTI_EXECCLASS_DECL, execclass_decl): New. (finish_file, start_class, continue_class, finish_class, start_method_def, continue_method_def, finish_method_def, start_protocol, finish_protocol, objc_build_throw_stmt, objc_build_try_catch_finally_stmt, objc_build_synchronized_prologue, objc_build_synchronized_epilogue, objc_build_try_prologue, objc_build_try_epilogue, objc_build_catch_stmt, objc_build_catch_epilogue, objc_build_finally_prologue, objc_build_finally_epilogue, is_ivar, is_private, is_public, add_instance_variable, objc_add_method, get_super_receiver, objc_clear_super_receiver, get_class_ivars_from_name, get_class_reference, get_static_reference, get_object_reference, build_message_expr, finish_message_expr, build_selector_expr, build_ivar_reference, build_keyword_decl, build_method_decl, build_protocol_expr, build_objc_string_object, objc_declare_alias, objc_declare_class, objc_declare_protocols, objc_comptypes, objc_check_decl, build_encode_expr): Remove prototypes. (imp_count, cat_count): Make GGC-aware. (OBJC_SET_TYPE_NAME): New macro. From-SVN: r87168
2004-09-08 02:49:44 +02:00
while (CLASS_SUPER_NAME (interface))
{
Makefile.in (c-parse.o): Depend on $(C_COMMON_H). [gcc/ChangeLog] 2004-09-07 Ziemowit Laski <zlaski@apple.com> * Makefile.in (c-parse.o): Depend on $(C_COMMON_H). * c-parse.in: Include c-common.h instead of objc-act.h. (ivar_decl_list, ivar_decls, ivar_decl, ivars, ivar_declarator, myparms, myparm): Remove %type declarations. (methodtype, optparms, OBJC_TYPE_QUAL, objc_quals, objc_qual, objc_typename, objc_try_catch_stmt, optellipsis): Add %type declarations. (objc_inherit_code, objc_public_flag): Remove. (typespec_nonreserved_nonattr): Call objc_get_protocol_qualified_type() instead of get_static_reference() and get_protocol_reference(). (stmt_nocomp): Call grokparm() on @catch parameter. (objcdef): Move semantic action to objc_finish_implementation(). (classdef): Move semantic action to objc_start_class_interface(), objc_continue_interface(), objc_finish_interface(), objc_start_class_implementation(), objc_continue_implementation(), objc_start_category_interface() and objc_start_category_implementation(). (protocoldef): Move semantic actions to objc_start_protocol() and objc_finish_interface(). (ivar_decl_list): Remove nonterminal. (visibility_spec): Move semantic actions to objc_set_visibility(). (ivar_decls): Remove assignment to $$. (ivar_decl): Rephrase in terms of component_decl; call objc_add_instance_variable(). (ivars, ivar_declarator): Remove nonterminals. (opt_semi): New nonterminal. (methodtype): Remove semantic actions. (methoddef): Move semantic actions to objc_set_method_type(), objc_start_method_definition() and objc_finish_method_definition(). (methodproto): Move semantic actions to objc_set_method_type() and objc_add_method_declaration(). (methoddecl): Use objc_typename instead of typename; move semantic actions to objc_build_method_signature(). (optarglist, myxdecls, mydecl, myparms, myparm): Remove nonterminals. (optparmlist): Express in terms of optparms and optellipsis. (optparms, optellipsis, objc_qual, objc_quals, objc_typename): New nonterminals. (keyworddecl): Use objc_typename instead of typename. (rid_to_yy): Mark RID_IN, RID_OUT, RID_INOUT, RID_BYCOPY, RID_BYREF and RID_ONEWAY as returning OBJC_TYPE_QUAL to yyparse(). [gcc/objc/ChangeLog] 2004-09-07 Ziemowit Laski <zlaski@apple.com> * Make-lang.in (objc/objc-parse.o): Depend on $(C_COMMON_H) instead of objc/objc-act.h. (objc/objc-act.o): Depend on $(HASHTAB_H). * objc-act.c: Include hashtab.h; in ObjC++ mode, include cp-tree.h and objcp-decl.h instead of c-tree.h. (build_module_descriptor, get_class_ivars, synth_id_with_class_suffix, error_with_ivar, gen_method_decl, gen_declaration, setup_string_decl, build_protocol_template): Adjust prototypes. (build_module_initializer_routine, start_class, continue_class, finish_class, start_method_def, objc_start_function, start_protocol, build_method_decl, objc_add_method, add_instance_variable, build_ivar_reference, is_ivar, is_private, get_super_receiver, build_selector_table_decl, objc_push_parm, objc_get_parm_info, gen_type_name, gen_type_name_0, start_var_decl, finish_var_decl, create_field_decl): New prototypes. (objc_expand_function_end, comp_method_with_proto, objc_expr_last, gen_declaration_1, gen_declarator, is_complex_decl, adorn_decl, define_decl, create_builtin_decl, gen_declspecs): Remove prototypes. (TYPE_ID): Rename to OBJECT_TYPEDEF_NAME. (CLASS_TYPEDEF_NAME): New. (TAG_EXECCLASS): Change from a global variable to a #define. (TAG_RETURN_STRUCT): Delete. (TAG_GNUINIT): New, holds '__objc_gnu_init' name. (objc_inherit_code, objc_public_flag): New, moved from c-parse.in. (string_descriptor): New struct. (string_htab): New hash table. (string_hash, string_eq): New prototypes. (generate_struct_by_value_array): Call create_field_decl() instead of create_builtin_decl(). (objc_init): Do not initialize objc_ellipsis_node or TAG_EXECCLASS; In ObjC++ mode, call cxx_init() instead of c_objc_common_init(). (objc_finish_file): In ObjC++, call instantiate_pending_templates() and cp_finish_file(). (define_decl, get_static_reference, get_protocol_reference, create_builtin_decl): Remove functions. (objc_start_class_interface, objc_start_category_interface, objc_start_protocol, objc_continue_interface, objc_finish_interface, objc_start_class_implementation, objc_start_category_implementation, objc_continue_implementation, objc_finish_implementation, objc_set_visibility, objc_set_method_type, objc_build_method_signature, objc_add_method_declaration, objc_start_method_definition, objc_add_instance_variable, objc_get_protocol_qualified_type, create_field_decl, start_var_decl, finish_var_decl): New functions. (setup_string_decl): Simplify since it is only called once. (synth_module_prologue): Call build_class_template(); predefine 'id' and 'Class' as typedefs; rename 'temp_type' to 'type'; disable debug hooks for duration of function; fix GNU runtime messenger signatures to correspond to reality; forward-declare '__objc_exec_class' for the GNU runtime; call build_selector_table_decl(); in ObjC++ mode, generate 'extern "C" { ... }' wrappers around synthesized declarations; call build_protocol_template() and build_category_template(). (string_hash, string_eq): New functions. (objc_build_string_object): Check metaclass correctness only once; store string literals in hash table. (objc_build_constructor): Do not convert initializer elements; adjust for ObjC++ impedance mismatch. (build_objc_symtab_template): Call create_field_decl() instead of create_builtin_decl(). (init_objc_symtab): Add missing conversion to initializer element. (build_metadata_decl): Call start_var_decl() instead of define_decl(). (generate_objc_symtab_decl): Do not call build_category_template(); call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(). (build_module_descriptor): Call create_field_decl() instead of grokfield(); call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(); always mark module descriptor as used; move GNU runtime-specific functionality to build_module_initializer_routine(). (build_module_initializer_routine): New function, broken off of build_module_descriptor(). (objc_static_init_needed_p, objc_generate_static_init_call): New functions. (generate_static_references, generate_strings, build_selector_translation_table, generate_descriptor_table, generate_ivars_list, generate_dispatch_table, generate_category): Call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(); build a type directly instead of via groktypename(). (build_selector_reference_decl, build_selector_table_decl, build_class_reference_decl, build_protocol_reference, generate_objc_image_info): Call start_var_decl() instead of build_decl(). (build_selector_reference): For GNU runtime, do not call build_selector_reference_decl(). (build_selector, build_typed_selector_reference): Always convert result to the selector type. (add_objc_string): Cast return value to 'char *'. (build_method_prototype_template, build_selector_template, build_method_template): Use actual selector type for fields pointing to selectors. (finish_objc): For GNU runtime, call build_module_initializer_routine() after build_module_descriptor(). (generate_protocol_list, generate_shared_structures): Call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(); build a type directly instead of via groktypename(). (synth_id_with_class_suffix): Return a string. (get_arg_type_list): For instance methods, use the instance type for 'self'; do not call groktypename_in_parm_context(). (build_objc_string_decl): Squash redeclaration errors in ObjC++. (objc_is_class_name): Use OBJC_TYPE_NAME instead of TYPE_NAME; handle RECORD_TYPEs in ObjC as well as ObjC++. (objc_is_id): New function. (objc_is_object_ptr): Return the canonical type node. (objc_get_class_ivars): Simplify using get_class_ivars(). (get_class_ivars): Remove second parameter; create a fresh copy of the ivar list for each call; do not check for existence of super class. (objc_eh_runtime_type): Mark #ifndef OBJCPLUS. (objc_init_exceptions): When using SJLJ-style exceptions, require the use of '-fobjc-exceptions' flag; do not require it for DWARF-style exceptions. (objc_build_exc_ptr, next_sjlj_build_try_catch_finally): Use objc_object_type instead of objc_id_type. (objc_begin_catch_clause): Convert the incoming PARM_DECL into a VAR_DECL before placing it in the appropriate scope; do not call define_decl(); adjust call to c_begin_compound_stmt(); use objc_object_type instead of objc_id_type. (build_next_objc_exception_stuff): Call create_field_decl() instead of create_builtin_decl(); construct type directly instead of calling groktypename(); use OBJC_VOID_AT_END to mark end of function parameters. (build_private_template): Adjust call to get_class_ivars(); build a type directly instead of via groktypename(). (build_protocol_template, build_method_prototype_list_template, build_method_prototype_template, build_category_template, build_selector_template, build_class_template, build_super_template, build_ivar_template, build_ivar_list_template, build_method_list_template, build_method_template): Call create_field_decl() instead of grokfield(). (objc_method_parm_type): Do not call groktypename(). (generate_descriptor_table): Call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(). (generate_method_descriptors, build_protocol_initializer, generate_dispatch_tables, build_category_initializer, build_shared_structure_initializer): Do not call groktypename(). (generate_protocols): Call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(); do not call groktypename(). (error_with_ivar): Remove last parameter. (check_ivars): Do not iterate ovar CLASS_RAW_IVARS lists in addition to CLASS_IVARS lists; adjust calls to error_with_ivar(). (generate_ivar_lists): Convert one of the initializer elements; do not call groktypename(). (get_arg_type_list, start_method_def, gen_method_def): Account for new representation of variable arguments and '...' in Objective-C methods; add Objective-C++ impedance matching code. (is_objc_type_qualifier): Remove function. (adjust_type_for_id_default): Simplify; there is no longer a need to wade through declspecs. (lookup_interface, start_class, continue_class, finish_class, start_method_def, start_protocol, build_method_decl, objc_add_method, add_instance_variable, build_ivar_reference, is_ivar, is_private, get_super_receiver, objc_build_finally_epilogue): Make into static functions. (receiver_is_class_object): Use new IS_CLASS() macro. (objc_build_message_expr): Tweak ObjC++ message argument handling; call objc_finish_message_expr() instead of finish_message_expr(). (finish_message_expr): Rename to objc_finish_message_expr(); use OBJC_TYPE_NAME and OBJC_SET_TYPE_NAME macros instead of TYPE_NAME. call gen_type_name() instead of gen_declaration(); call objc_is_id() instead of using IS_ID and IS_CLASS; Use objc_class_name instead of calling get_identifier("Class"); handle CONVERT_EXPRs in receiver. (build_objc_method_call, warn_with_method): Do not call groktypename(). (build_ivar_reference): Call convert() instead of clobbering in a type. (hash_init): Initialize string_htab hash table. (add_instance_variable): Simplify parameter list; do not call grokfield(); do not populate CLASS_IVARS list. (start_class): Check for the existence of super class, if one was specified. (continue_class): Use CLASS_RAW_IVARS rather than CLASS_IVARS; do not call build_class_template(); adjust call to get_class_ivars(); call build_decl(), pushdecl() and finish_decl() instead of define_decl(). (finish_class): Call build_decl(), pushdecl() and finish_decl() instead of define_decl(). (add_protocols): Use PROTOCOL_BINFO_ELTS for the tree vector size. (start_protocol): Do not call build_protocol_template(); use PROTOCOL_BINFO_ELTS for the tree vector size. (encode_type_qualifiers): Do not handle the 'const' qualifier here. (encode_pointer): Encode 'const char *' as 'r*', for backwards compatibility. (encode_array): Use HOST_WIDE_INT_PRINT_DEC instead of "%ld". (encode_type): Handle the 'const' qualifier here. (objc_parmlist): New global variable, sued by objc_push_parm and objc_get_parm_info(). (objc_push_parm, objc_get_parm_info): New functions. (objc_expr_last): Remove function. (synth_self_and_ucmd_args): For instance methods, use the instance type for 'self'; call objc_push_parm() instead of push_parm_decl(). (start_method_def): Do not call push_scope(), declare_parm_level(), pop_scope(), push_parm_decl(), store_parm_decls() or objc_expr_last(); just use objc_push_parm() and objc_get_parm_info(). (comp_method_with_proto): Remove function. (objc_types_are_equivalent): Strip away indirections before comparing underlying types. (comp_proto_with_proto): Do not call groktypename(); types are no longer in raw declspec format. (objc_start_function): New function. (really_start_method): Call comp_proto_with_proto() instead of comp_method_with_proto(); call objc_start_function() instead of hand-crafting a function declarator. (continue_method_def, objc_expand_function_end): Remove functions. (get_super_receiver): Call objc_get_current_scope() instead of get_current_scope(); reference 'super_class' field (instead of 'class'). (finish_method_def): Rename to objc_finish_method_definition() and add a function decl parameter; move method encoding call from objc_expand_function_end(). (is_complex_decl, adorn_decl, gen_declarator, gen_declspecs, gen_declaration_1): Remove functions. (tmpbuf, RAW_DECLSPEC): Remove. (gen_declaration): Remove second parameter; simplify to deal with TYPE_P nodes instead of raw declspecs. (gen_type_name, gen_type_name_0): New functions. (gen_method_decl): Remove second parameter; call gen_type_name() instead of gen_declaration_1(). (dump_interface): Adjust calls to gen_declaration() and gen_method_decl(); do not allocate a separate string buffer. (init_objc): Allocate a larger string buffer to accommodate dump_interface(); adjust call to build_module_descriptor(); add call to build_module_initializer_routine() for the GNU runtime. (generate_classref_translation_entry): Do not call start_decl(); call finish_var_decl() instead of finish_decl(); call convert() instead of build_c_cast(). * objc-act.h (CLASS_OWN_IVARS): Remove accessor. (CLASS_BINFO_ELTS): Reduce from 6 to 5, now that CLASS_OWN_IVARS is gone. (OCTI_GNU_INIT_DECL, GNU_INIT_decl): New. (OCTI_ELLIPSIS_NODE, objc_ellipsis_node): Remove. (OCTI_ID_ID, id_type, objc_id_id): Rename to OCTI_ID_NAME, objc_object_type and objc_object_name, respectively. (OCTI_CLS_REF, OCTI_CLASS_NAME, objc_class_reference, objc_class_name): New. (IS_CLASS): New macro. (IS_ID, IS_SUPER): Robustify. (OCTI_EXECCLASS_DECL, execclass_decl): New. (finish_file, start_class, continue_class, finish_class, start_method_def, continue_method_def, finish_method_def, start_protocol, finish_protocol, objc_build_throw_stmt, objc_build_try_catch_finally_stmt, objc_build_synchronized_prologue, objc_build_synchronized_epilogue, objc_build_try_prologue, objc_build_try_epilogue, objc_build_catch_stmt, objc_build_catch_epilogue, objc_build_finally_prologue, objc_build_finally_epilogue, is_ivar, is_private, is_public, add_instance_variable, objc_add_method, get_super_receiver, objc_clear_super_receiver, get_class_ivars_from_name, get_class_reference, get_static_reference, get_object_reference, build_message_expr, finish_message_expr, build_selector_expr, build_ivar_reference, build_keyword_decl, build_method_decl, build_protocol_expr, build_objc_string_object, objc_declare_alias, objc_declare_class, objc_declare_protocols, objc_comptypes, objc_check_decl, build_encode_expr): Remove prototypes. (imp_count, cat_count): Make GGC-aware. (OBJC_SET_TYPE_NAME): New macro. From-SVN: r87168
2004-09-08 02:49:44 +02:00
/* Prepend super-class ivars. */
interface = lookup_interface (CLASS_SUPER_NAME (interface));
ivar_chain = chainon (copy_list (CLASS_RAW_IVARS (interface)),
ivar_chain);
}
return ivar_chain;
}
static tree
c-common.c (flag_objc_sjlj_exceptions): New. * c-common.c (flag_objc_sjlj_exceptions): New. * c-common.h (flag_objc_sjlj_exceptions): Declare. * c-opts.c (c_common_handle_option): Set it. (c_common_post_options): Handle interation of different objective-c exception and runtime switches. * c-decl.c (c_eh_initialized_p): New. (finish_decl): Use it instead of local eh_initialized_p. * c-parse.in (nested_function, notype_nested_function): Record the result of compstmt. (compstmt_or_error): Likewise. (compstmt): Don't add_stmt the result. (stmt): Don't return anything. Rewrite objc try and sync rules. (objc_try_stmt, objc_catch_list): Remove. (objc_catch_block, objc_finally_block): Remove. (objc_catch_prefix, objc_catch_clause, objc_opt_catch_list): New. (objc_try_catch_clause, objc_finally_clause): New. (objc_try_catch_stmt): Rewrite. * c-tree.h (c_eh_initialized_p): Declare. * c-opt (fobjc-sjlj-exceptions): New. * except.c (output_function_exception_table): Don't call cgraph on non-decls. * objc/objc-act.c (UTAG_EXCDATA_VAR, UTAG_CAUGHTEXC_VAR, UTAG_RETHROWEXC_VAR, UTAG_EVALONCE_VAR, struct val_stack, catch_count_stack, exc_binding_stack, if_nesting_count, blk_nesting_count, objc_enter_block, objc_exit_block, objc_declare_variable, 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): Remove. (objc_create_temporary_var, struct objc_try_context, cur_try_context, objc_eh_runtime_type, objc_init_exceptions, objc_build_exc_ptr, next_sjlj_build_try_exit, next_sjlj_build_enter_and_setjmp, next_sjlj_build_exc_extract, next_sjlj_build_catch_list, next_sjlj_build_try_catch_finally, objc_begin_try_stmt, objc_begin_catch_clause, objc_finish_catch_clause, objc_build_finally_clause, objc_finish_try_stmt, objc_build_synchronized): New. (objc_is_object_id, objc_is_class_id): New. (objc_comptypes): Use them. (build_next_objc_exception_stuff): Break NeXT sjlj out from build_objc_exception_stuff. (synth_module_prologue): Update to match. (objc_build_throw_stmt): Use cur_try_context to decide if we're in a @catch. * objc/objc-act.h: Update prototypes. (OCTI_EXCEPTION_BLK_STACK, objc_exception_block_stack): Remove. testsuite/ * objc.dg/sync-1.m: New. * objc.dg/try-catch-1.m: Don't force next runtime. * objc.dg/try-catch-3.m, objc.dg/try-catch-4.m: Likewise. * objc.dg/try-catch-2.m: Likewise. Enable everywhere. Remove shadowed catch clause. * objc.dg/try-catch-5.m: New. From-SVN: r83332
2004-06-18 03:20:53 +02:00
objc_create_temporary_var (tree type)
{
tree decl;
c-common.c (flag_objc_sjlj_exceptions): New. * c-common.c (flag_objc_sjlj_exceptions): New. * c-common.h (flag_objc_sjlj_exceptions): Declare. * c-opts.c (c_common_handle_option): Set it. (c_common_post_options): Handle interation of different objective-c exception and runtime switches. * c-decl.c (c_eh_initialized_p): New. (finish_decl): Use it instead of local eh_initialized_p. * c-parse.in (nested_function, notype_nested_function): Record the result of compstmt. (compstmt_or_error): Likewise. (compstmt): Don't add_stmt the result. (stmt): Don't return anything. Rewrite objc try and sync rules. (objc_try_stmt, objc_catch_list): Remove. (objc_catch_block, objc_finally_block): Remove. (objc_catch_prefix, objc_catch_clause, objc_opt_catch_list): New. (objc_try_catch_clause, objc_finally_clause): New. (objc_try_catch_stmt): Rewrite. * c-tree.h (c_eh_initialized_p): Declare. * c-opt (fobjc-sjlj-exceptions): New. * except.c (output_function_exception_table): Don't call cgraph on non-decls. * objc/objc-act.c (UTAG_EXCDATA_VAR, UTAG_CAUGHTEXC_VAR, UTAG_RETHROWEXC_VAR, UTAG_EVALONCE_VAR, struct val_stack, catch_count_stack, exc_binding_stack, if_nesting_count, blk_nesting_count, objc_enter_block, objc_exit_block, objc_declare_variable, 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): Remove. (objc_create_temporary_var, struct objc_try_context, cur_try_context, objc_eh_runtime_type, objc_init_exceptions, objc_build_exc_ptr, next_sjlj_build_try_exit, next_sjlj_build_enter_and_setjmp, next_sjlj_build_exc_extract, next_sjlj_build_catch_list, next_sjlj_build_try_catch_finally, objc_begin_try_stmt, objc_begin_catch_clause, objc_finish_catch_clause, objc_build_finally_clause, objc_finish_try_stmt, objc_build_synchronized): New. (objc_is_object_id, objc_is_class_id): New. (objc_comptypes): Use them. (build_next_objc_exception_stuff): Break NeXT sjlj out from build_objc_exception_stuff. (synth_module_prologue): Update to match. (objc_build_throw_stmt): Use cur_try_context to decide if we're in a @catch. * objc/objc-act.h: Update prototypes. (OCTI_EXCEPTION_BLK_STACK, objc_exception_block_stack): Remove. testsuite/ * objc.dg/sync-1.m: New. * objc.dg/try-catch-1.m: Don't force next runtime. * objc.dg/try-catch-3.m, objc.dg/try-catch-4.m: Likewise. * objc.dg/try-catch-2.m: Likewise. Enable everywhere. Remove shadowed catch clause. * objc.dg/try-catch-5.m: New. From-SVN: r83332
2004-06-18 03:20:53 +02:00
decl = build_decl (VAR_DECL, NULL_TREE, type);
TREE_USED (decl) = 1;
DECL_ARTIFICIAL (decl) = 1;
c-common.c (flag_objc_sjlj_exceptions): New. * c-common.c (flag_objc_sjlj_exceptions): New. * c-common.h (flag_objc_sjlj_exceptions): Declare. * c-opts.c (c_common_handle_option): Set it. (c_common_post_options): Handle interation of different objective-c exception and runtime switches. * c-decl.c (c_eh_initialized_p): New. (finish_decl): Use it instead of local eh_initialized_p. * c-parse.in (nested_function, notype_nested_function): Record the result of compstmt. (compstmt_or_error): Likewise. (compstmt): Don't add_stmt the result. (stmt): Don't return anything. Rewrite objc try and sync rules. (objc_try_stmt, objc_catch_list): Remove. (objc_catch_block, objc_finally_block): Remove. (objc_catch_prefix, objc_catch_clause, objc_opt_catch_list): New. (objc_try_catch_clause, objc_finally_clause): New. (objc_try_catch_stmt): Rewrite. * c-tree.h (c_eh_initialized_p): Declare. * c-opt (fobjc-sjlj-exceptions): New. * except.c (output_function_exception_table): Don't call cgraph on non-decls. * objc/objc-act.c (UTAG_EXCDATA_VAR, UTAG_CAUGHTEXC_VAR, UTAG_RETHROWEXC_VAR, UTAG_EVALONCE_VAR, struct val_stack, catch_count_stack, exc_binding_stack, if_nesting_count, blk_nesting_count, objc_enter_block, objc_exit_block, objc_declare_variable, 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): Remove. (objc_create_temporary_var, struct objc_try_context, cur_try_context, objc_eh_runtime_type, objc_init_exceptions, objc_build_exc_ptr, next_sjlj_build_try_exit, next_sjlj_build_enter_and_setjmp, next_sjlj_build_exc_extract, next_sjlj_build_catch_list, next_sjlj_build_try_catch_finally, objc_begin_try_stmt, objc_begin_catch_clause, objc_finish_catch_clause, objc_build_finally_clause, objc_finish_try_stmt, objc_build_synchronized): New. (objc_is_object_id, objc_is_class_id): New. (objc_comptypes): Use them. (build_next_objc_exception_stuff): Break NeXT sjlj out from build_objc_exception_stuff. (synth_module_prologue): Update to match. (objc_build_throw_stmt): Use cur_try_context to decide if we're in a @catch. * objc/objc-act.h: Update prototypes. (OCTI_EXCEPTION_BLK_STACK, objc_exception_block_stack): Remove. testsuite/ * objc.dg/sync-1.m: New. * objc.dg/try-catch-1.m: Don't force next runtime. * objc.dg/try-catch-3.m, objc.dg/try-catch-4.m: Likewise. * objc.dg/try-catch-2.m: Likewise. Enable everywhere. Remove shadowed catch clause. * objc.dg/try-catch-5.m: New. From-SVN: r83332
2004-06-18 03:20:53 +02:00
DECL_IGNORED_P (decl) = 1;
DECL_CONTEXT (decl) = current_function_decl;
return decl;
}
c-common.c (flag_objc_sjlj_exceptions): New. * c-common.c (flag_objc_sjlj_exceptions): New. * c-common.h (flag_objc_sjlj_exceptions): Declare. * c-opts.c (c_common_handle_option): Set it. (c_common_post_options): Handle interation of different objective-c exception and runtime switches. * c-decl.c (c_eh_initialized_p): New. (finish_decl): Use it instead of local eh_initialized_p. * c-parse.in (nested_function, notype_nested_function): Record the result of compstmt. (compstmt_or_error): Likewise. (compstmt): Don't add_stmt the result. (stmt): Don't return anything. Rewrite objc try and sync rules. (objc_try_stmt, objc_catch_list): Remove. (objc_catch_block, objc_finally_block): Remove. (objc_catch_prefix, objc_catch_clause, objc_opt_catch_list): New. (objc_try_catch_clause, objc_finally_clause): New. (objc_try_catch_stmt): Rewrite. * c-tree.h (c_eh_initialized_p): Declare. * c-opt (fobjc-sjlj-exceptions): New. * except.c (output_function_exception_table): Don't call cgraph on non-decls. * objc/objc-act.c (UTAG_EXCDATA_VAR, UTAG_CAUGHTEXC_VAR, UTAG_RETHROWEXC_VAR, UTAG_EVALONCE_VAR, struct val_stack, catch_count_stack, exc_binding_stack, if_nesting_count, blk_nesting_count, objc_enter_block, objc_exit_block, objc_declare_variable, 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): Remove. (objc_create_temporary_var, struct objc_try_context, cur_try_context, objc_eh_runtime_type, objc_init_exceptions, objc_build_exc_ptr, next_sjlj_build_try_exit, next_sjlj_build_enter_and_setjmp, next_sjlj_build_exc_extract, next_sjlj_build_catch_list, next_sjlj_build_try_catch_finally, objc_begin_try_stmt, objc_begin_catch_clause, objc_finish_catch_clause, objc_build_finally_clause, objc_finish_try_stmt, objc_build_synchronized): New. (objc_is_object_id, objc_is_class_id): New. (objc_comptypes): Use them. (build_next_objc_exception_stuff): Break NeXT sjlj out from build_objc_exception_stuff. (synth_module_prologue): Update to match. (objc_build_throw_stmt): Use cur_try_context to decide if we're in a @catch. * objc/objc-act.h: Update prototypes. (OCTI_EXCEPTION_BLK_STACK, objc_exception_block_stack): Remove. testsuite/ * objc.dg/sync-1.m: New. * objc.dg/try-catch-1.m: Don't force next runtime. * objc.dg/try-catch-3.m, objc.dg/try-catch-4.m: Likewise. * objc.dg/try-catch-2.m: Likewise. Enable everywhere. Remove shadowed catch clause. * objc.dg/try-catch-5.m: New. From-SVN: r83332
2004-06-18 03:20:53 +02:00
/* Exception handling constructs. We begin by having the parser do most
of the work and passing us blocks. What we do next depends on whether
we're doing "native" exception handling or legacy Darwin setjmp exceptions.
We abstract all of this in a handful of appropriately named routines. */
c-common.c (flag_objc_sjlj_exceptions): New. * c-common.c (flag_objc_sjlj_exceptions): New. * c-common.h (flag_objc_sjlj_exceptions): Declare. * c-opts.c (c_common_handle_option): Set it. (c_common_post_options): Handle interation of different objective-c exception and runtime switches. * c-decl.c (c_eh_initialized_p): New. (finish_decl): Use it instead of local eh_initialized_p. * c-parse.in (nested_function, notype_nested_function): Record the result of compstmt. (compstmt_or_error): Likewise. (compstmt): Don't add_stmt the result. (stmt): Don't return anything. Rewrite objc try and sync rules. (objc_try_stmt, objc_catch_list): Remove. (objc_catch_block, objc_finally_block): Remove. (objc_catch_prefix, objc_catch_clause, objc_opt_catch_list): New. (objc_try_catch_clause, objc_finally_clause): New. (objc_try_catch_stmt): Rewrite. * c-tree.h (c_eh_initialized_p): Declare. * c-opt (fobjc-sjlj-exceptions): New. * except.c (output_function_exception_table): Don't call cgraph on non-decls. * objc/objc-act.c (UTAG_EXCDATA_VAR, UTAG_CAUGHTEXC_VAR, UTAG_RETHROWEXC_VAR, UTAG_EVALONCE_VAR, struct val_stack, catch_count_stack, exc_binding_stack, if_nesting_count, blk_nesting_count, objc_enter_block, objc_exit_block, objc_declare_variable, 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): Remove. (objc_create_temporary_var, struct objc_try_context, cur_try_context, objc_eh_runtime_type, objc_init_exceptions, objc_build_exc_ptr, next_sjlj_build_try_exit, next_sjlj_build_enter_and_setjmp, next_sjlj_build_exc_extract, next_sjlj_build_catch_list, next_sjlj_build_try_catch_finally, objc_begin_try_stmt, objc_begin_catch_clause, objc_finish_catch_clause, objc_build_finally_clause, objc_finish_try_stmt, objc_build_synchronized): New. (objc_is_object_id, objc_is_class_id): New. (objc_comptypes): Use them. (build_next_objc_exception_stuff): Break NeXT sjlj out from build_objc_exception_stuff. (synth_module_prologue): Update to match. (objc_build_throw_stmt): Use cur_try_context to decide if we're in a @catch. * objc/objc-act.h: Update prototypes. (OCTI_EXCEPTION_BLK_STACK, objc_exception_block_stack): Remove. testsuite/ * objc.dg/sync-1.m: New. * objc.dg/try-catch-1.m: Don't force next runtime. * objc.dg/try-catch-3.m, objc.dg/try-catch-4.m: Likewise. * objc.dg/try-catch-2.m: Likewise. Enable everywhere. Remove shadowed catch clause. * objc.dg/try-catch-5.m: New. From-SVN: r83332
2004-06-18 03:20:53 +02:00
/* Stack of open try blocks. */
c-common.c (flag_objc_sjlj_exceptions): New. * c-common.c (flag_objc_sjlj_exceptions): New. * c-common.h (flag_objc_sjlj_exceptions): Declare. * c-opts.c (c_common_handle_option): Set it. (c_common_post_options): Handle interation of different objective-c exception and runtime switches. * c-decl.c (c_eh_initialized_p): New. (finish_decl): Use it instead of local eh_initialized_p. * c-parse.in (nested_function, notype_nested_function): Record the result of compstmt. (compstmt_or_error): Likewise. (compstmt): Don't add_stmt the result. (stmt): Don't return anything. Rewrite objc try and sync rules. (objc_try_stmt, objc_catch_list): Remove. (objc_catch_block, objc_finally_block): Remove. (objc_catch_prefix, objc_catch_clause, objc_opt_catch_list): New. (objc_try_catch_clause, objc_finally_clause): New. (objc_try_catch_stmt): Rewrite. * c-tree.h (c_eh_initialized_p): Declare. * c-opt (fobjc-sjlj-exceptions): New. * except.c (output_function_exception_table): Don't call cgraph on non-decls. * objc/objc-act.c (UTAG_EXCDATA_VAR, UTAG_CAUGHTEXC_VAR, UTAG_RETHROWEXC_VAR, UTAG_EVALONCE_VAR, struct val_stack, catch_count_stack, exc_binding_stack, if_nesting_count, blk_nesting_count, objc_enter_block, objc_exit_block, objc_declare_variable, 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): Remove. (objc_create_temporary_var, struct objc_try_context, cur_try_context, objc_eh_runtime_type, objc_init_exceptions, objc_build_exc_ptr, next_sjlj_build_try_exit, next_sjlj_build_enter_and_setjmp, next_sjlj_build_exc_extract, next_sjlj_build_catch_list, next_sjlj_build_try_catch_finally, objc_begin_try_stmt, objc_begin_catch_clause, objc_finish_catch_clause, objc_build_finally_clause, objc_finish_try_stmt, objc_build_synchronized): New. (objc_is_object_id, objc_is_class_id): New. (objc_comptypes): Use them. (build_next_objc_exception_stuff): Break NeXT sjlj out from build_objc_exception_stuff. (synth_module_prologue): Update to match. (objc_build_throw_stmt): Use cur_try_context to decide if we're in a @catch. * objc/objc-act.h: Update prototypes. (OCTI_EXCEPTION_BLK_STACK, objc_exception_block_stack): Remove. testsuite/ * objc.dg/sync-1.m: New. * objc.dg/try-catch-1.m: Don't force next runtime. * objc.dg/try-catch-3.m, objc.dg/try-catch-4.m: Likewise. * objc.dg/try-catch-2.m: Likewise. Enable everywhere. Remove shadowed catch clause. * objc.dg/try-catch-5.m: New. From-SVN: r83332
2004-06-18 03:20:53 +02:00
struct objc_try_context
{
c-common.c (flag_objc_sjlj_exceptions): New. * c-common.c (flag_objc_sjlj_exceptions): New. * c-common.h (flag_objc_sjlj_exceptions): Declare. * c-opts.c (c_common_handle_option): Set it. (c_common_post_options): Handle interation of different objective-c exception and runtime switches. * c-decl.c (c_eh_initialized_p): New. (finish_decl): Use it instead of local eh_initialized_p. * c-parse.in (nested_function, notype_nested_function): Record the result of compstmt. (compstmt_or_error): Likewise. (compstmt): Don't add_stmt the result. (stmt): Don't return anything. Rewrite objc try and sync rules. (objc_try_stmt, objc_catch_list): Remove. (objc_catch_block, objc_finally_block): Remove. (objc_catch_prefix, objc_catch_clause, objc_opt_catch_list): New. (objc_try_catch_clause, objc_finally_clause): New. (objc_try_catch_stmt): Rewrite. * c-tree.h (c_eh_initialized_p): Declare. * c-opt (fobjc-sjlj-exceptions): New. * except.c (output_function_exception_table): Don't call cgraph on non-decls. * objc/objc-act.c (UTAG_EXCDATA_VAR, UTAG_CAUGHTEXC_VAR, UTAG_RETHROWEXC_VAR, UTAG_EVALONCE_VAR, struct val_stack, catch_count_stack, exc_binding_stack, if_nesting_count, blk_nesting_count, objc_enter_block, objc_exit_block, objc_declare_variable, 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): Remove. (objc_create_temporary_var, struct objc_try_context, cur_try_context, objc_eh_runtime_type, objc_init_exceptions, objc_build_exc_ptr, next_sjlj_build_try_exit, next_sjlj_build_enter_and_setjmp, next_sjlj_build_exc_extract, next_sjlj_build_catch_list, next_sjlj_build_try_catch_finally, objc_begin_try_stmt, objc_begin_catch_clause, objc_finish_catch_clause, objc_build_finally_clause, objc_finish_try_stmt, objc_build_synchronized): New. (objc_is_object_id, objc_is_class_id): New. (objc_comptypes): Use them. (build_next_objc_exception_stuff): Break NeXT sjlj out from build_objc_exception_stuff. (synth_module_prologue): Update to match. (objc_build_throw_stmt): Use cur_try_context to decide if we're in a @catch. * objc/objc-act.h: Update prototypes. (OCTI_EXCEPTION_BLK_STACK, objc_exception_block_stack): Remove. testsuite/ * objc.dg/sync-1.m: New. * objc.dg/try-catch-1.m: Don't force next runtime. * objc.dg/try-catch-3.m, objc.dg/try-catch-4.m: Likewise. * objc.dg/try-catch-2.m: Likewise. Enable everywhere. Remove shadowed catch clause. * objc.dg/try-catch-5.m: New. From-SVN: r83332
2004-06-18 03:20:53 +02:00
struct objc_try_context *outer;
c-common.c (flag_objc_sjlj_exceptions): New. * c-common.c (flag_objc_sjlj_exceptions): New. * c-common.h (flag_objc_sjlj_exceptions): Declare. * c-opts.c (c_common_handle_option): Set it. (c_common_post_options): Handle interation of different objective-c exception and runtime switches. * c-decl.c (c_eh_initialized_p): New. (finish_decl): Use it instead of local eh_initialized_p. * c-parse.in (nested_function, notype_nested_function): Record the result of compstmt. (compstmt_or_error): Likewise. (compstmt): Don't add_stmt the result. (stmt): Don't return anything. Rewrite objc try and sync rules. (objc_try_stmt, objc_catch_list): Remove. (objc_catch_block, objc_finally_block): Remove. (objc_catch_prefix, objc_catch_clause, objc_opt_catch_list): New. (objc_try_catch_clause, objc_finally_clause): New. (objc_try_catch_stmt): Rewrite. * c-tree.h (c_eh_initialized_p): Declare. * c-opt (fobjc-sjlj-exceptions): New. * except.c (output_function_exception_table): Don't call cgraph on non-decls. * objc/objc-act.c (UTAG_EXCDATA_VAR, UTAG_CAUGHTEXC_VAR, UTAG_RETHROWEXC_VAR, UTAG_EVALONCE_VAR, struct val_stack, catch_count_stack, exc_binding_stack, if_nesting_count, blk_nesting_count, objc_enter_block, objc_exit_block, objc_declare_variable, 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): Remove. (objc_create_temporary_var, struct objc_try_context, cur_try_context, objc_eh_runtime_type, objc_init_exceptions, objc_build_exc_ptr, next_sjlj_build_try_exit, next_sjlj_build_enter_and_setjmp, next_sjlj_build_exc_extract, next_sjlj_build_catch_list, next_sjlj_build_try_catch_finally, objc_begin_try_stmt, objc_begin_catch_clause, objc_finish_catch_clause, objc_build_finally_clause, objc_finish_try_stmt, objc_build_synchronized): New. (objc_is_object_id, objc_is_class_id): New. (objc_comptypes): Use them. (build_next_objc_exception_stuff): Break NeXT sjlj out from build_objc_exception_stuff. (synth_module_prologue): Update to match. (objc_build_throw_stmt): Use cur_try_context to decide if we're in a @catch. * objc/objc-act.h: Update prototypes. (OCTI_EXCEPTION_BLK_STACK, objc_exception_block_stack): Remove. testsuite/ * objc.dg/sync-1.m: New. * objc.dg/try-catch-1.m: Don't force next runtime. * objc.dg/try-catch-3.m, objc.dg/try-catch-4.m: Likewise. * objc.dg/try-catch-2.m: Likewise. Enable everywhere. Remove shadowed catch clause. * objc.dg/try-catch-5.m: New. From-SVN: r83332
2004-06-18 03:20:53 +02:00
/* Statements (or statement lists) as processed by the parser. */
tree try_body;
tree finally_body;
c-common.c (flag_objc_sjlj_exceptions): New. * c-common.c (flag_objc_sjlj_exceptions): New. * c-common.h (flag_objc_sjlj_exceptions): Declare. * c-opts.c (c_common_handle_option): Set it. (c_common_post_options): Handle interation of different objective-c exception and runtime switches. * c-decl.c (c_eh_initialized_p): New. (finish_decl): Use it instead of local eh_initialized_p. * c-parse.in (nested_function, notype_nested_function): Record the result of compstmt. (compstmt_or_error): Likewise. (compstmt): Don't add_stmt the result. (stmt): Don't return anything. Rewrite objc try and sync rules. (objc_try_stmt, objc_catch_list): Remove. (objc_catch_block, objc_finally_block): Remove. (objc_catch_prefix, objc_catch_clause, objc_opt_catch_list): New. (objc_try_catch_clause, objc_finally_clause): New. (objc_try_catch_stmt): Rewrite. * c-tree.h (c_eh_initialized_p): Declare. * c-opt (fobjc-sjlj-exceptions): New. * except.c (output_function_exception_table): Don't call cgraph on non-decls. * objc/objc-act.c (UTAG_EXCDATA_VAR, UTAG_CAUGHTEXC_VAR, UTAG_RETHROWEXC_VAR, UTAG_EVALONCE_VAR, struct val_stack, catch_count_stack, exc_binding_stack, if_nesting_count, blk_nesting_count, objc_enter_block, objc_exit_block, objc_declare_variable, 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): Remove. (objc_create_temporary_var, struct objc_try_context, cur_try_context, objc_eh_runtime_type, objc_init_exceptions, objc_build_exc_ptr, next_sjlj_build_try_exit, next_sjlj_build_enter_and_setjmp, next_sjlj_build_exc_extract, next_sjlj_build_catch_list, next_sjlj_build_try_catch_finally, objc_begin_try_stmt, objc_begin_catch_clause, objc_finish_catch_clause, objc_build_finally_clause, objc_finish_try_stmt, objc_build_synchronized): New. (objc_is_object_id, objc_is_class_id): New. (objc_comptypes): Use them. (build_next_objc_exception_stuff): Break NeXT sjlj out from build_objc_exception_stuff. (synth_module_prologue): Update to match. (objc_build_throw_stmt): Use cur_try_context to decide if we're in a @catch. * objc/objc-act.h: Update prototypes. (OCTI_EXCEPTION_BLK_STACK, objc_exception_block_stack): Remove. testsuite/ * objc.dg/sync-1.m: New. * objc.dg/try-catch-1.m: Don't force next runtime. * objc.dg/try-catch-3.m, objc.dg/try-catch-4.m: Likewise. * objc.dg/try-catch-2.m: Likewise. Enable everywhere. Remove shadowed catch clause. * objc.dg/try-catch-5.m: New. From-SVN: r83332
2004-06-18 03:20:53 +02:00
/* Some file position locations. */
location_t try_locus;
location_t end_try_locus;
location_t end_catch_locus;
location_t finally_locus;
location_t end_finally_locus;
c-common.c (flag_objc_sjlj_exceptions): New. * c-common.c (flag_objc_sjlj_exceptions): New. * c-common.h (flag_objc_sjlj_exceptions): Declare. * c-opts.c (c_common_handle_option): Set it. (c_common_post_options): Handle interation of different objective-c exception and runtime switches. * c-decl.c (c_eh_initialized_p): New. (finish_decl): Use it instead of local eh_initialized_p. * c-parse.in (nested_function, notype_nested_function): Record the result of compstmt. (compstmt_or_error): Likewise. (compstmt): Don't add_stmt the result. (stmt): Don't return anything. Rewrite objc try and sync rules. (objc_try_stmt, objc_catch_list): Remove. (objc_catch_block, objc_finally_block): Remove. (objc_catch_prefix, objc_catch_clause, objc_opt_catch_list): New. (objc_try_catch_clause, objc_finally_clause): New. (objc_try_catch_stmt): Rewrite. * c-tree.h (c_eh_initialized_p): Declare. * c-opt (fobjc-sjlj-exceptions): New. * except.c (output_function_exception_table): Don't call cgraph on non-decls. * objc/objc-act.c (UTAG_EXCDATA_VAR, UTAG_CAUGHTEXC_VAR, UTAG_RETHROWEXC_VAR, UTAG_EVALONCE_VAR, struct val_stack, catch_count_stack, exc_binding_stack, if_nesting_count, blk_nesting_count, objc_enter_block, objc_exit_block, objc_declare_variable, 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): Remove. (objc_create_temporary_var, struct objc_try_context, cur_try_context, objc_eh_runtime_type, objc_init_exceptions, objc_build_exc_ptr, next_sjlj_build_try_exit, next_sjlj_build_enter_and_setjmp, next_sjlj_build_exc_extract, next_sjlj_build_catch_list, next_sjlj_build_try_catch_finally, objc_begin_try_stmt, objc_begin_catch_clause, objc_finish_catch_clause, objc_build_finally_clause, objc_finish_try_stmt, objc_build_synchronized): New. (objc_is_object_id, objc_is_class_id): New. (objc_comptypes): Use them. (build_next_objc_exception_stuff): Break NeXT sjlj out from build_objc_exception_stuff. (synth_module_prologue): Update to match. (objc_build_throw_stmt): Use cur_try_context to decide if we're in a @catch. * objc/objc-act.h: Update prototypes. (OCTI_EXCEPTION_BLK_STACK, objc_exception_block_stack): Remove. testsuite/ * objc.dg/sync-1.m: New. * objc.dg/try-catch-1.m: Don't force next runtime. * objc.dg/try-catch-3.m, objc.dg/try-catch-4.m: Likewise. * objc.dg/try-catch-2.m: Likewise. Enable everywhere. Remove shadowed catch clause. * objc.dg/try-catch-5.m: New. From-SVN: r83332
2004-06-18 03:20:53 +02:00
/* A STATEMENT_LIST of CATCH_EXPRs, appropriate for sticking into op1
of a TRY_CATCH_EXPR. Even when doing Darwin setjmp. */
tree catch_list;
c-common.c (flag_objc_sjlj_exceptions): New. * c-common.c (flag_objc_sjlj_exceptions): New. * c-common.h (flag_objc_sjlj_exceptions): Declare. * c-opts.c (c_common_handle_option): Set it. (c_common_post_options): Handle interation of different objective-c exception and runtime switches. * c-decl.c (c_eh_initialized_p): New. (finish_decl): Use it instead of local eh_initialized_p. * c-parse.in (nested_function, notype_nested_function): Record the result of compstmt. (compstmt_or_error): Likewise. (compstmt): Don't add_stmt the result. (stmt): Don't return anything. Rewrite objc try and sync rules. (objc_try_stmt, objc_catch_list): Remove. (objc_catch_block, objc_finally_block): Remove. (objc_catch_prefix, objc_catch_clause, objc_opt_catch_list): New. (objc_try_catch_clause, objc_finally_clause): New. (objc_try_catch_stmt): Rewrite. * c-tree.h (c_eh_initialized_p): Declare. * c-opt (fobjc-sjlj-exceptions): New. * except.c (output_function_exception_table): Don't call cgraph on non-decls. * objc/objc-act.c (UTAG_EXCDATA_VAR, UTAG_CAUGHTEXC_VAR, UTAG_RETHROWEXC_VAR, UTAG_EVALONCE_VAR, struct val_stack, catch_count_stack, exc_binding_stack, if_nesting_count, blk_nesting_count, objc_enter_block, objc_exit_block, objc_declare_variable, 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): Remove. (objc_create_temporary_var, struct objc_try_context, cur_try_context, objc_eh_runtime_type, objc_init_exceptions, objc_build_exc_ptr, next_sjlj_build_try_exit, next_sjlj_build_enter_and_setjmp, next_sjlj_build_exc_extract, next_sjlj_build_catch_list, next_sjlj_build_try_catch_finally, objc_begin_try_stmt, objc_begin_catch_clause, objc_finish_catch_clause, objc_build_finally_clause, objc_finish_try_stmt, objc_build_synchronized): New. (objc_is_object_id, objc_is_class_id): New. (objc_comptypes): Use them. (build_next_objc_exception_stuff): Break NeXT sjlj out from build_objc_exception_stuff. (synth_module_prologue): Update to match. (objc_build_throw_stmt): Use cur_try_context to decide if we're in a @catch. * objc/objc-act.h: Update prototypes. (OCTI_EXCEPTION_BLK_STACK, objc_exception_block_stack): Remove. testsuite/ * objc.dg/sync-1.m: New. * objc.dg/try-catch-1.m: Don't force next runtime. * objc.dg/try-catch-3.m, objc.dg/try-catch-4.m: Likewise. * objc.dg/try-catch-2.m: Likewise. Enable everywhere. Remove shadowed catch clause. * objc.dg/try-catch-5.m: New. From-SVN: r83332
2004-06-18 03:20:53 +02:00
/* The CATCH_EXPR of an open @catch clause. */
tree current_catch;
c-common.c (flag_objc_sjlj_exceptions): New. * c-common.c (flag_objc_sjlj_exceptions): New. * c-common.h (flag_objc_sjlj_exceptions): Declare. * c-opts.c (c_common_handle_option): Set it. (c_common_post_options): Handle interation of different objective-c exception and runtime switches. * c-decl.c (c_eh_initialized_p): New. (finish_decl): Use it instead of local eh_initialized_p. * c-parse.in (nested_function, notype_nested_function): Record the result of compstmt. (compstmt_or_error): Likewise. (compstmt): Don't add_stmt the result. (stmt): Don't return anything. Rewrite objc try and sync rules. (objc_try_stmt, objc_catch_list): Remove. (objc_catch_block, objc_finally_block): Remove. (objc_catch_prefix, objc_catch_clause, objc_opt_catch_list): New. (objc_try_catch_clause, objc_finally_clause): New. (objc_try_catch_stmt): Rewrite. * c-tree.h (c_eh_initialized_p): Declare. * c-opt (fobjc-sjlj-exceptions): New. * except.c (output_function_exception_table): Don't call cgraph on non-decls. * objc/objc-act.c (UTAG_EXCDATA_VAR, UTAG_CAUGHTEXC_VAR, UTAG_RETHROWEXC_VAR, UTAG_EVALONCE_VAR, struct val_stack, catch_count_stack, exc_binding_stack, if_nesting_count, blk_nesting_count, objc_enter_block, objc_exit_block, objc_declare_variable, 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): Remove. (objc_create_temporary_var, struct objc_try_context, cur_try_context, objc_eh_runtime_type, objc_init_exceptions, objc_build_exc_ptr, next_sjlj_build_try_exit, next_sjlj_build_enter_and_setjmp, next_sjlj_build_exc_extract, next_sjlj_build_catch_list, next_sjlj_build_try_catch_finally, objc_begin_try_stmt, objc_begin_catch_clause, objc_finish_catch_clause, objc_build_finally_clause, objc_finish_try_stmt, objc_build_synchronized): New. (objc_is_object_id, objc_is_class_id): New. (objc_comptypes): Use them. (build_next_objc_exception_stuff): Break NeXT sjlj out from build_objc_exception_stuff. (synth_module_prologue): Update to match. (objc_build_throw_stmt): Use cur_try_context to decide if we're in a @catch. * objc/objc-act.h: Update prototypes. (OCTI_EXCEPTION_BLK_STACK, objc_exception_block_stack): Remove. testsuite/ * objc.dg/sync-1.m: New. * objc.dg/try-catch-1.m: Don't force next runtime. * objc.dg/try-catch-3.m, objc.dg/try-catch-4.m: Likewise. * objc.dg/try-catch-2.m: Likewise. Enable everywhere. Remove shadowed catch clause. * objc.dg/try-catch-5.m: New. From-SVN: r83332
2004-06-18 03:20:53 +02:00
/* The VAR_DECL holding the Darwin equivalent of EXC_PTR_EXPR. */
tree caught_decl;
tree stack_decl;
tree rethrow_decl;
};
c-common.c (flag_objc_sjlj_exceptions): New. * c-common.c (flag_objc_sjlj_exceptions): New. * c-common.h (flag_objc_sjlj_exceptions): Declare. * c-opts.c (c_common_handle_option): Set it. (c_common_post_options): Handle interation of different objective-c exception and runtime switches. * c-decl.c (c_eh_initialized_p): New. (finish_decl): Use it instead of local eh_initialized_p. * c-parse.in (nested_function, notype_nested_function): Record the result of compstmt. (compstmt_or_error): Likewise. (compstmt): Don't add_stmt the result. (stmt): Don't return anything. Rewrite objc try and sync rules. (objc_try_stmt, objc_catch_list): Remove. (objc_catch_block, objc_finally_block): Remove. (objc_catch_prefix, objc_catch_clause, objc_opt_catch_list): New. (objc_try_catch_clause, objc_finally_clause): New. (objc_try_catch_stmt): Rewrite. * c-tree.h (c_eh_initialized_p): Declare. * c-opt (fobjc-sjlj-exceptions): New. * except.c (output_function_exception_table): Don't call cgraph on non-decls. * objc/objc-act.c (UTAG_EXCDATA_VAR, UTAG_CAUGHTEXC_VAR, UTAG_RETHROWEXC_VAR, UTAG_EVALONCE_VAR, struct val_stack, catch_count_stack, exc_binding_stack, if_nesting_count, blk_nesting_count, objc_enter_block, objc_exit_block, objc_declare_variable, 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): Remove. (objc_create_temporary_var, struct objc_try_context, cur_try_context, objc_eh_runtime_type, objc_init_exceptions, objc_build_exc_ptr, next_sjlj_build_try_exit, next_sjlj_build_enter_and_setjmp, next_sjlj_build_exc_extract, next_sjlj_build_catch_list, next_sjlj_build_try_catch_finally, objc_begin_try_stmt, objc_begin_catch_clause, objc_finish_catch_clause, objc_build_finally_clause, objc_finish_try_stmt, objc_build_synchronized): New. (objc_is_object_id, objc_is_class_id): New. (objc_comptypes): Use them. (build_next_objc_exception_stuff): Break NeXT sjlj out from build_objc_exception_stuff. (synth_module_prologue): Update to match. (objc_build_throw_stmt): Use cur_try_context to decide if we're in a @catch. * objc/objc-act.h: Update prototypes. (OCTI_EXCEPTION_BLK_STACK, objc_exception_block_stack): Remove. testsuite/ * objc.dg/sync-1.m: New. * objc.dg/try-catch-1.m: Don't force next runtime. * objc.dg/try-catch-3.m, objc.dg/try-catch-4.m: Likewise. * objc.dg/try-catch-2.m: Likewise. Enable everywhere. Remove shadowed catch clause. * objc.dg/try-catch-5.m: New. From-SVN: r83332
2004-06-18 03:20:53 +02:00
static struct objc_try_context *cur_try_context;
c-common.c (lang_gimplify_stmt): Remove next_p argument. * c-common.c (lang_gimplify_stmt): Remove next_p argument. (if_elt, if_stack, if_stack_space, c_expand_start_cond, c_finish_then, c_expand_end_cond, c_expand_start_else, c_finish_else, c_begin_if_stmt, c_begin_while_stmt, c_finish_while_stmt_cond): Move to c-typeck.c. (finish_fname_decls, fname_decl): Use statement_lists. (c_expand_expr_stmt): Don't set last_expr_type. (c_type_hash): Fix indentation. (c_safe_from_p): Don't follow TREE_CHAIN. (c_tree_chain_matters_p): Remove. * c-common.def (SCOPE_STMT): Remove. (CLEANUP_STMT): Redefine to contain its own body. * c-common.h (struct stmt_tree_s): Remove x_last_stmt, x_last_expr_type, x_last_expr_filename, x_scope_stmt_stack. Add x_cur_stmt_list. (last_tree, last_expr_type, last_expr_filename, RECHAIN_STMTS): Remove. (cur_stmt_list): New. (STATEMENT_LIST_STMT_EXPR): New. (SCOPE_BEGIN_P, SCOPE_END_P, SCOPE_STMT_BLOCK, SCOPE_NULLIFIED_P, SCOPE_NO_CLEANUPS_P, SCOPE_PARTIAL_P, NEW_FOR_SCOPE_P): Remove. (CLEANUP_BODY): New. (CLEANUP_DECL): Move to operand 2. (c_common_stmt_codes): Remove SCOPE_STMT. (COMPOUND_STMT_NO_SCOPE, COMPOUND_STMT_BODY_BLOCK): Remove. * c-decl.c (c_scope_stmt_stack, current_scope_stmt_stack): Remove. (c_push_function_context, c_pop_function_context): Don't save it. (finish_decl): Set TREE_USED on the decl for a cleanup. Use push_cleanup. (store_parm_decls): Use statement lists. (finish_function): Remove compstmt rule workaround. Use statement lists. Call finish_fname_decls after finalizing the body. (c_begin_compound_stmt): Move to c-typeck.c. * c-dump.c (c_dump_tree): Remove SCOPE_STMT. * c-gimplify.c (gimplify_cleanup_stmt, gimplify_cleanup_stmts): New. (c_genericize): Invoke them. (c_gimplify_stmt): Don't look through TREE_CHAIN. Kill SCOPE_STMT. (c_build_bind_expr): Export. (gimplify_block, gimplify_cleanup): Remove. (gimplify_condition): Use gimplify_stmt. (gimplify_for_stmt): Remove FOR_INIT_STMT chaining hack. (gimplify_if_stmt): Remove recursion hack. (c_gimplify_expr): Remove STMT_EXPR handling. (stmt_expr_last_stmt, gimplify_stmt_expr): Remove. (is_last_stmt_of_scope): Remove. * c-lang.c (LANG_HOOKS_TREE_INLINING_TREE_CHAIN_MATTERS_P): Remove. * c-mudflap.c (mflang_flush_calls): Use c_begin_compound_stmt, c_end_compound_stmt. * c-objc-common.c (build_cdtor): Likewise. * c-parse.in (primary): Use c_finish_stmt_expr. (push_scope, pop_scope): Remove. (c99_block_start, compstmt_start): Use c_begin_compound_stmt. (c99_block_end, compstmt): Use c_end_compound_stmt. (c99_block_lineno_labeled_stmt): Likewise. (compstmt_primary_start): Use c_begin_stmt_expr. (simple_if, select_or_iter_stmt): Update calls to stmt builders. (do_stmt_start): Fill in body directly. (lineno_stmt): Avoid setting lineno on constants. * c-pretty-print.c (pp_c_statement): Handle STATEMENT_LIST. Remove SCOPE_STMT. * c-semantics.c (begin_stmt_tree): Remove. (push_stmt_list, re_push_stmt_list, pop_stmt_list): New. (add_stmt): Use statement lists. (add_scope_stmt, finish_stmt_tree): Remove. (push_cleanup): New. * c-tree.h: Move some decls from c-common.h. * c-typeck.c (c_tree_expr_nonnegative_p): Simplify for statement lists. (do_case, c_finish_case): Likewise. (c_finish_then): Take body for then as argument. (c_finish_else): Similarly. (c_begin_for_stmt, c_finish_for_stmt_init, c_finish_for_stmt_cond, c_finish_for_stmt_incr, c_finish_for_stmt): New. (c_begin_stmt_expr, c_finish_stmt_expr): New. (c_begin_compound_stmt): Do scope management. (c_end_compound_stmt): New. * fold-const.c (tree_expr_nonnegative_p): Fix BIND_EXPR. * gimplify.c (voidify_wrapper_expr): Accept temporary argument. Look through exception handling constructs. (gimplify_bind_expr): Accept temporary argument. (gimplify_target_expr): Special case BIND_EXPR bodies. (gimplify_expr): Handle fallback == fb_none like a statement. * langhooks-def.h (LANG_HOOKS_TREE_INLINING_TREE_CHAIN_MATTERS_P): Kill. * langhooks.c (lhd_tree_inlining_tree_chain_matters_p): Remove. * langhooks.h (tree_chain_matters_p): Remove. * stub-objc.c (objc_clear_super_receiver): New. * tree-gimple.h (voidify_wrapper_expr): Update decl. (append_to_statement_list, append_to_statement_list_force): Move to tree-iterator.h. * tree-inline.c (expand_call_inline): Update call. (clone_body): Use statement lists. (walk_tree): Don't check tree_chain_matters_p. (copy_tree_r): Likewise. * tree-iterator.c (alloc_stmt_list): Clear lang bits. (tsi_link_before, tsi_link_after): Set TREE_SIDE_EFFECTS properly. * tree-iterator.h (append_to_statement_list, append_to_statement_list_force): Moved from tree-gimple.h. * tree-pretty-print.c (dump_generic_node): Clean up TARGET_EXPR dump. * objc/objc-act.c (build_module_descriptor): Use c_begin_compound_stmt. (objc_enter_block): Likewise. (objc_exit_block): Use c_end_compound_stmt. (objc_build_try_enter_fragment): Add #error and comment for rewriting for OBJCPLUS. (objc_build_extract_fragment, objc_build_try_epilogue, objc_build_catch_stmt, objc_build_finally_prologue, objc_build_finally_epilogue): Update for C statement builders. * objc/objc-lang.c (LANG_HOOKS_TREE_INLINING_TREE_CHAIN_MATTERS_P): Remove. cp/ * call.c (initialize_reference): Don't build CLEANUP_STMT here. * cp-gimplify.c (cp_gimplify_stmt): Remove next_p argument. (genericize_try_block): Use gimplify_stmt. (genericize_catch_block, genericize_eh_spec_block): Likewise. (cp_gimplify_init_expr): Remove STMT_EXPR special case. (gimplify_must_not_throw_expr): Update voidify_wrapper_expr call. * cp-lang.c (LANG_HOOKS_TREE_INLINING_TREE_CHAIN_MATTERS_P): Remove. (cp_tree_chain_matters_p): Remove. * cp-tree.h (COMPOUND_STMT_TRY_BLOCK): New. (COMPOUND_STMT_BODY_BLOCK): New. (STATEMENT_LIST_NO_SCOPE, STATEMENT_LIST_TRY_BLOCK): New. (EXPR_STMT_STMT_EXPR_RESULT): New. (building_stmt_tree): Check cur_stmt_list. (tf_stmt_expr_cmpd, tf_stmt_expr_body): Remove. (BCS_NO_SCOPE, BCS_TRY_BLOCK, BCS_FN_BODY): New. * decl.c (poplevel): Use pop_stmt_list for minding cleanups. (cp_finish_decl): Use push_cleanup. (start_function, finish_function): Use statement lists. (finish_stmt): Do nothing. * except.c (begin_eh_spec_block): Use statement lists. (check_handlers_1, check_handlers): Likewise. * init.c (construct_virtual_base): Don't add extra compound stmts. (build_vec_init): Likewise. * name-lookup.c (maybe_push_cleanup_level): Use statement lists. * name-lookup.h (struct cp_binding_level): Add statement_list. * parser.c (cp_parser_statement): Take the STMT_EXPR node, not a bool. (cp_parser_labeled_statement, cp_parser_expression_statement, cp_parser_statement_seq_opt): Likewise. (cp_parser_compound_statement): Likewise. Take bool for try block. (cp_parser_selection_statement): Tidy if processing. (cp_parser_already_scoped_statement): Rewrite to do what it says. * pt.c (tsubst_copy): Move STMT_EXPR to tsubst_expr. (tsubst_expr): Rewrite STMT_EXPR processing. Handle STATEMENT_LIST. Mind COMPOUND_STMT_TRY_BLOCK, EXPR_STMT_STMT_EXPR_RESULT. * semantics.c (do_poplevel, do_pushlevel): Use statement lists. (finish_cond): New, rewritten from FINISH_COND. (simplify_loop_decl_cond): New. (finish_expr_stmt): Avoid nested EXPR_STMTs. (begin_if_stmt, finish_if_stmt_cond, finish_then_clause, begin_else_clause, finish_else_clause, finish_if_stmt, begin_while_stmt, finish_while_stmt_cond, finish_while_stmt, begin_do_stmt, finish_do_body, begin_for_stmt, finish_for_init_stmt, finish_for_cond, finish_for_stmt, begin_switch_stmt, finish_switch_cond, finish_switch_stmt, begin_try_block, finish_try_block, finish_cleanup_try_block, finish_function_try_block, finish_handler_sequence, finish_function_handler_sequence, begin_handler, finish_handler_parms, finish_handler, begin_stmt_expr, finish_stmt_expr_expr, finish_stmt_expr): Rewrite using statement lists. (begin_compound_stmt): Replace has_no_scope argument with flags. Update all callers. Use statement lists. (finish_compound_stmt): Likewise. (finish_decl_cleanup, finish_eh_cleanup): Use push_cleanup. (current_scope_stmt_stack): Remove. (simplify_aggr_init_expr): Don't muck with TREE_CHAIN. * typeck2.c (split_nonconstant_init_1, split_nonconstant_init): Rewrite with statement lists. testsuite/ * g++.dg/ext/stmtexpr1.C: XFAIL. * gcc.dg/20030612-1.c: XFAIL. From-SVN: r83221
2004-06-16 03:21:38 +02:00
c-common.c (flag_objc_sjlj_exceptions): New. * c-common.c (flag_objc_sjlj_exceptions): New. * c-common.h (flag_objc_sjlj_exceptions): Declare. * c-opts.c (c_common_handle_option): Set it. (c_common_post_options): Handle interation of different objective-c exception and runtime switches. * c-decl.c (c_eh_initialized_p): New. (finish_decl): Use it instead of local eh_initialized_p. * c-parse.in (nested_function, notype_nested_function): Record the result of compstmt. (compstmt_or_error): Likewise. (compstmt): Don't add_stmt the result. (stmt): Don't return anything. Rewrite objc try and sync rules. (objc_try_stmt, objc_catch_list): Remove. (objc_catch_block, objc_finally_block): Remove. (objc_catch_prefix, objc_catch_clause, objc_opt_catch_list): New. (objc_try_catch_clause, objc_finally_clause): New. (objc_try_catch_stmt): Rewrite. * c-tree.h (c_eh_initialized_p): Declare. * c-opt (fobjc-sjlj-exceptions): New. * except.c (output_function_exception_table): Don't call cgraph on non-decls. * objc/objc-act.c (UTAG_EXCDATA_VAR, UTAG_CAUGHTEXC_VAR, UTAG_RETHROWEXC_VAR, UTAG_EVALONCE_VAR, struct val_stack, catch_count_stack, exc_binding_stack, if_nesting_count, blk_nesting_count, objc_enter_block, objc_exit_block, objc_declare_variable, 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): Remove. (objc_create_temporary_var, struct objc_try_context, cur_try_context, objc_eh_runtime_type, objc_init_exceptions, objc_build_exc_ptr, next_sjlj_build_try_exit, next_sjlj_build_enter_and_setjmp, next_sjlj_build_exc_extract, next_sjlj_build_catch_list, next_sjlj_build_try_catch_finally, objc_begin_try_stmt, objc_begin_catch_clause, objc_finish_catch_clause, objc_build_finally_clause, objc_finish_try_stmt, objc_build_synchronized): New. (objc_is_object_id, objc_is_class_id): New. (objc_comptypes): Use them. (build_next_objc_exception_stuff): Break NeXT sjlj out from build_objc_exception_stuff. (synth_module_prologue): Update to match. (objc_build_throw_stmt): Use cur_try_context to decide if we're in a @catch. * objc/objc-act.h: Update prototypes. (OCTI_EXCEPTION_BLK_STACK, objc_exception_block_stack): Remove. testsuite/ * objc.dg/sync-1.m: New. * objc.dg/try-catch-1.m: Don't force next runtime. * objc.dg/try-catch-3.m, objc.dg/try-catch-4.m: Likewise. * objc.dg/try-catch-2.m: Likewise. Enable everywhere. Remove shadowed catch clause. * objc.dg/try-catch-5.m: New. From-SVN: r83332
2004-06-18 03:20:53 +02:00
/* This hook, called via lang_eh_runtime_type, generates a runtime object
that represents TYPE. For Objective-C, this is just the class name. */
/* ??? Isn't there a class object or some such? Is it easy to get? */
Makefile.in (c-parse.o): Depend on $(C_COMMON_H). [gcc/ChangeLog] 2004-09-07 Ziemowit Laski <zlaski@apple.com> * Makefile.in (c-parse.o): Depend on $(C_COMMON_H). * c-parse.in: Include c-common.h instead of objc-act.h. (ivar_decl_list, ivar_decls, ivar_decl, ivars, ivar_declarator, myparms, myparm): Remove %type declarations. (methodtype, optparms, OBJC_TYPE_QUAL, objc_quals, objc_qual, objc_typename, objc_try_catch_stmt, optellipsis): Add %type declarations. (objc_inherit_code, objc_public_flag): Remove. (typespec_nonreserved_nonattr): Call objc_get_protocol_qualified_type() instead of get_static_reference() and get_protocol_reference(). (stmt_nocomp): Call grokparm() on @catch parameter. (objcdef): Move semantic action to objc_finish_implementation(). (classdef): Move semantic action to objc_start_class_interface(), objc_continue_interface(), objc_finish_interface(), objc_start_class_implementation(), objc_continue_implementation(), objc_start_category_interface() and objc_start_category_implementation(). (protocoldef): Move semantic actions to objc_start_protocol() and objc_finish_interface(). (ivar_decl_list): Remove nonterminal. (visibility_spec): Move semantic actions to objc_set_visibility(). (ivar_decls): Remove assignment to $$. (ivar_decl): Rephrase in terms of component_decl; call objc_add_instance_variable(). (ivars, ivar_declarator): Remove nonterminals. (opt_semi): New nonterminal. (methodtype): Remove semantic actions. (methoddef): Move semantic actions to objc_set_method_type(), objc_start_method_definition() and objc_finish_method_definition(). (methodproto): Move semantic actions to objc_set_method_type() and objc_add_method_declaration(). (methoddecl): Use objc_typename instead of typename; move semantic actions to objc_build_method_signature(). (optarglist, myxdecls, mydecl, myparms, myparm): Remove nonterminals. (optparmlist): Express in terms of optparms and optellipsis. (optparms, optellipsis, objc_qual, objc_quals, objc_typename): New nonterminals. (keyworddecl): Use objc_typename instead of typename. (rid_to_yy): Mark RID_IN, RID_OUT, RID_INOUT, RID_BYCOPY, RID_BYREF and RID_ONEWAY as returning OBJC_TYPE_QUAL to yyparse(). [gcc/objc/ChangeLog] 2004-09-07 Ziemowit Laski <zlaski@apple.com> * Make-lang.in (objc/objc-parse.o): Depend on $(C_COMMON_H) instead of objc/objc-act.h. (objc/objc-act.o): Depend on $(HASHTAB_H). * objc-act.c: Include hashtab.h; in ObjC++ mode, include cp-tree.h and objcp-decl.h instead of c-tree.h. (build_module_descriptor, get_class_ivars, synth_id_with_class_suffix, error_with_ivar, gen_method_decl, gen_declaration, setup_string_decl, build_protocol_template): Adjust prototypes. (build_module_initializer_routine, start_class, continue_class, finish_class, start_method_def, objc_start_function, start_protocol, build_method_decl, objc_add_method, add_instance_variable, build_ivar_reference, is_ivar, is_private, get_super_receiver, build_selector_table_decl, objc_push_parm, objc_get_parm_info, gen_type_name, gen_type_name_0, start_var_decl, finish_var_decl, create_field_decl): New prototypes. (objc_expand_function_end, comp_method_with_proto, objc_expr_last, gen_declaration_1, gen_declarator, is_complex_decl, adorn_decl, define_decl, create_builtin_decl, gen_declspecs): Remove prototypes. (TYPE_ID): Rename to OBJECT_TYPEDEF_NAME. (CLASS_TYPEDEF_NAME): New. (TAG_EXECCLASS): Change from a global variable to a #define. (TAG_RETURN_STRUCT): Delete. (TAG_GNUINIT): New, holds '__objc_gnu_init' name. (objc_inherit_code, objc_public_flag): New, moved from c-parse.in. (string_descriptor): New struct. (string_htab): New hash table. (string_hash, string_eq): New prototypes. (generate_struct_by_value_array): Call create_field_decl() instead of create_builtin_decl(). (objc_init): Do not initialize objc_ellipsis_node or TAG_EXECCLASS; In ObjC++ mode, call cxx_init() instead of c_objc_common_init(). (objc_finish_file): In ObjC++, call instantiate_pending_templates() and cp_finish_file(). (define_decl, get_static_reference, get_protocol_reference, create_builtin_decl): Remove functions. (objc_start_class_interface, objc_start_category_interface, objc_start_protocol, objc_continue_interface, objc_finish_interface, objc_start_class_implementation, objc_start_category_implementation, objc_continue_implementation, objc_finish_implementation, objc_set_visibility, objc_set_method_type, objc_build_method_signature, objc_add_method_declaration, objc_start_method_definition, objc_add_instance_variable, objc_get_protocol_qualified_type, create_field_decl, start_var_decl, finish_var_decl): New functions. (setup_string_decl): Simplify since it is only called once. (synth_module_prologue): Call build_class_template(); predefine 'id' and 'Class' as typedefs; rename 'temp_type' to 'type'; disable debug hooks for duration of function; fix GNU runtime messenger signatures to correspond to reality; forward-declare '__objc_exec_class' for the GNU runtime; call build_selector_table_decl(); in ObjC++ mode, generate 'extern "C" { ... }' wrappers around synthesized declarations; call build_protocol_template() and build_category_template(). (string_hash, string_eq): New functions. (objc_build_string_object): Check metaclass correctness only once; store string literals in hash table. (objc_build_constructor): Do not convert initializer elements; adjust for ObjC++ impedance mismatch. (build_objc_symtab_template): Call create_field_decl() instead of create_builtin_decl(). (init_objc_symtab): Add missing conversion to initializer element. (build_metadata_decl): Call start_var_decl() instead of define_decl(). (generate_objc_symtab_decl): Do not call build_category_template(); call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(). (build_module_descriptor): Call create_field_decl() instead of grokfield(); call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(); always mark module descriptor as used; move GNU runtime-specific functionality to build_module_initializer_routine(). (build_module_initializer_routine): New function, broken off of build_module_descriptor(). (objc_static_init_needed_p, objc_generate_static_init_call): New functions. (generate_static_references, generate_strings, build_selector_translation_table, generate_descriptor_table, generate_ivars_list, generate_dispatch_table, generate_category): Call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(); build a type directly instead of via groktypename(). (build_selector_reference_decl, build_selector_table_decl, build_class_reference_decl, build_protocol_reference, generate_objc_image_info): Call start_var_decl() instead of build_decl(). (build_selector_reference): For GNU runtime, do not call build_selector_reference_decl(). (build_selector, build_typed_selector_reference): Always convert result to the selector type. (add_objc_string): Cast return value to 'char *'. (build_method_prototype_template, build_selector_template, build_method_template): Use actual selector type for fields pointing to selectors. (finish_objc): For GNU runtime, call build_module_initializer_routine() after build_module_descriptor(). (generate_protocol_list, generate_shared_structures): Call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(); build a type directly instead of via groktypename(). (synth_id_with_class_suffix): Return a string. (get_arg_type_list): For instance methods, use the instance type for 'self'; do not call groktypename_in_parm_context(). (build_objc_string_decl): Squash redeclaration errors in ObjC++. (objc_is_class_name): Use OBJC_TYPE_NAME instead of TYPE_NAME; handle RECORD_TYPEs in ObjC as well as ObjC++. (objc_is_id): New function. (objc_is_object_ptr): Return the canonical type node. (objc_get_class_ivars): Simplify using get_class_ivars(). (get_class_ivars): Remove second parameter; create a fresh copy of the ivar list for each call; do not check for existence of super class. (objc_eh_runtime_type): Mark #ifndef OBJCPLUS. (objc_init_exceptions): When using SJLJ-style exceptions, require the use of '-fobjc-exceptions' flag; do not require it for DWARF-style exceptions. (objc_build_exc_ptr, next_sjlj_build_try_catch_finally): Use objc_object_type instead of objc_id_type. (objc_begin_catch_clause): Convert the incoming PARM_DECL into a VAR_DECL before placing it in the appropriate scope; do not call define_decl(); adjust call to c_begin_compound_stmt(); use objc_object_type instead of objc_id_type. (build_next_objc_exception_stuff): Call create_field_decl() instead of create_builtin_decl(); construct type directly instead of calling groktypename(); use OBJC_VOID_AT_END to mark end of function parameters. (build_private_template): Adjust call to get_class_ivars(); build a type directly instead of via groktypename(). (build_protocol_template, build_method_prototype_list_template, build_method_prototype_template, build_category_template, build_selector_template, build_class_template, build_super_template, build_ivar_template, build_ivar_list_template, build_method_list_template, build_method_template): Call create_field_decl() instead of grokfield(). (objc_method_parm_type): Do not call groktypename(). (generate_descriptor_table): Call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(). (generate_method_descriptors, build_protocol_initializer, generate_dispatch_tables, build_category_initializer, build_shared_structure_initializer): Do not call groktypename(). (generate_protocols): Call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(); do not call groktypename(). (error_with_ivar): Remove last parameter. (check_ivars): Do not iterate ovar CLASS_RAW_IVARS lists in addition to CLASS_IVARS lists; adjust calls to error_with_ivar(). (generate_ivar_lists): Convert one of the initializer elements; do not call groktypename(). (get_arg_type_list, start_method_def, gen_method_def): Account for new representation of variable arguments and '...' in Objective-C methods; add Objective-C++ impedance matching code. (is_objc_type_qualifier): Remove function. (adjust_type_for_id_default): Simplify; there is no longer a need to wade through declspecs. (lookup_interface, start_class, continue_class, finish_class, start_method_def, start_protocol, build_method_decl, objc_add_method, add_instance_variable, build_ivar_reference, is_ivar, is_private, get_super_receiver, objc_build_finally_epilogue): Make into static functions. (receiver_is_class_object): Use new IS_CLASS() macro. (objc_build_message_expr): Tweak ObjC++ message argument handling; call objc_finish_message_expr() instead of finish_message_expr(). (finish_message_expr): Rename to objc_finish_message_expr(); use OBJC_TYPE_NAME and OBJC_SET_TYPE_NAME macros instead of TYPE_NAME. call gen_type_name() instead of gen_declaration(); call objc_is_id() instead of using IS_ID and IS_CLASS; Use objc_class_name instead of calling get_identifier("Class"); handle CONVERT_EXPRs in receiver. (build_objc_method_call, warn_with_method): Do not call groktypename(). (build_ivar_reference): Call convert() instead of clobbering in a type. (hash_init): Initialize string_htab hash table. (add_instance_variable): Simplify parameter list; do not call grokfield(); do not populate CLASS_IVARS list. (start_class): Check for the existence of super class, if one was specified. (continue_class): Use CLASS_RAW_IVARS rather than CLASS_IVARS; do not call build_class_template(); adjust call to get_class_ivars(); call build_decl(), pushdecl() and finish_decl() instead of define_decl(). (finish_class): Call build_decl(), pushdecl() and finish_decl() instead of define_decl(). (add_protocols): Use PROTOCOL_BINFO_ELTS for the tree vector size. (start_protocol): Do not call build_protocol_template(); use PROTOCOL_BINFO_ELTS for the tree vector size. (encode_type_qualifiers): Do not handle the 'const' qualifier here. (encode_pointer): Encode 'const char *' as 'r*', for backwards compatibility. (encode_array): Use HOST_WIDE_INT_PRINT_DEC instead of "%ld". (encode_type): Handle the 'const' qualifier here. (objc_parmlist): New global variable, sued by objc_push_parm and objc_get_parm_info(). (objc_push_parm, objc_get_parm_info): New functions. (objc_expr_last): Remove function. (synth_self_and_ucmd_args): For instance methods, use the instance type for 'self'; call objc_push_parm() instead of push_parm_decl(). (start_method_def): Do not call push_scope(), declare_parm_level(), pop_scope(), push_parm_decl(), store_parm_decls() or objc_expr_last(); just use objc_push_parm() and objc_get_parm_info(). (comp_method_with_proto): Remove function. (objc_types_are_equivalent): Strip away indirections before comparing underlying types. (comp_proto_with_proto): Do not call groktypename(); types are no longer in raw declspec format. (objc_start_function): New function. (really_start_method): Call comp_proto_with_proto() instead of comp_method_with_proto(); call objc_start_function() instead of hand-crafting a function declarator. (continue_method_def, objc_expand_function_end): Remove functions. (get_super_receiver): Call objc_get_current_scope() instead of get_current_scope(); reference 'super_class' field (instead of 'class'). (finish_method_def): Rename to objc_finish_method_definition() and add a function decl parameter; move method encoding call from objc_expand_function_end(). (is_complex_decl, adorn_decl, gen_declarator, gen_declspecs, gen_declaration_1): Remove functions. (tmpbuf, RAW_DECLSPEC): Remove. (gen_declaration): Remove second parameter; simplify to deal with TYPE_P nodes instead of raw declspecs. (gen_type_name, gen_type_name_0): New functions. (gen_method_decl): Remove second parameter; call gen_type_name() instead of gen_declaration_1(). (dump_interface): Adjust calls to gen_declaration() and gen_method_decl(); do not allocate a separate string buffer. (init_objc): Allocate a larger string buffer to accommodate dump_interface(); adjust call to build_module_descriptor(); add call to build_module_initializer_routine() for the GNU runtime. (generate_classref_translation_entry): Do not call start_decl(); call finish_var_decl() instead of finish_decl(); call convert() instead of build_c_cast(). * objc-act.h (CLASS_OWN_IVARS): Remove accessor. (CLASS_BINFO_ELTS): Reduce from 6 to 5, now that CLASS_OWN_IVARS is gone. (OCTI_GNU_INIT_DECL, GNU_INIT_decl): New. (OCTI_ELLIPSIS_NODE, objc_ellipsis_node): Remove. (OCTI_ID_ID, id_type, objc_id_id): Rename to OCTI_ID_NAME, objc_object_type and objc_object_name, respectively. (OCTI_CLS_REF, OCTI_CLASS_NAME, objc_class_reference, objc_class_name): New. (IS_CLASS): New macro. (IS_ID, IS_SUPER): Robustify. (OCTI_EXECCLASS_DECL, execclass_decl): New. (finish_file, start_class, continue_class, finish_class, start_method_def, continue_method_def, finish_method_def, start_protocol, finish_protocol, objc_build_throw_stmt, objc_build_try_catch_finally_stmt, objc_build_synchronized_prologue, objc_build_synchronized_epilogue, objc_build_try_prologue, objc_build_try_epilogue, objc_build_catch_stmt, objc_build_catch_epilogue, objc_build_finally_prologue, objc_build_finally_epilogue, is_ivar, is_private, is_public, add_instance_variable, objc_add_method, get_super_receiver, objc_clear_super_receiver, get_class_ivars_from_name, get_class_reference, get_static_reference, get_object_reference, build_message_expr, finish_message_expr, build_selector_expr, build_ivar_reference, build_keyword_decl, build_method_decl, build_protocol_expr, build_objc_string_object, objc_declare_alias, objc_declare_class, objc_declare_protocols, objc_comptypes, objc_check_decl, build_encode_expr): Remove prototypes. (imp_count, cat_count): Make GGC-aware. (OBJC_SET_TYPE_NAME): New macro. From-SVN: r87168
2004-09-08 02:49:44 +02:00
#ifndef OBJCPLUS
static tree
c-common.c (flag_objc_sjlj_exceptions): New. * c-common.c (flag_objc_sjlj_exceptions): New. * c-common.h (flag_objc_sjlj_exceptions): Declare. * c-opts.c (c_common_handle_option): Set it. (c_common_post_options): Handle interation of different objective-c exception and runtime switches. * c-decl.c (c_eh_initialized_p): New. (finish_decl): Use it instead of local eh_initialized_p. * c-parse.in (nested_function, notype_nested_function): Record the result of compstmt. (compstmt_or_error): Likewise. (compstmt): Don't add_stmt the result. (stmt): Don't return anything. Rewrite objc try and sync rules. (objc_try_stmt, objc_catch_list): Remove. (objc_catch_block, objc_finally_block): Remove. (objc_catch_prefix, objc_catch_clause, objc_opt_catch_list): New. (objc_try_catch_clause, objc_finally_clause): New. (objc_try_catch_stmt): Rewrite. * c-tree.h (c_eh_initialized_p): Declare. * c-opt (fobjc-sjlj-exceptions): New. * except.c (output_function_exception_table): Don't call cgraph on non-decls. * objc/objc-act.c (UTAG_EXCDATA_VAR, UTAG_CAUGHTEXC_VAR, UTAG_RETHROWEXC_VAR, UTAG_EVALONCE_VAR, struct val_stack, catch_count_stack, exc_binding_stack, if_nesting_count, blk_nesting_count, objc_enter_block, objc_exit_block, objc_declare_variable, 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): Remove. (objc_create_temporary_var, struct objc_try_context, cur_try_context, objc_eh_runtime_type, objc_init_exceptions, objc_build_exc_ptr, next_sjlj_build_try_exit, next_sjlj_build_enter_and_setjmp, next_sjlj_build_exc_extract, next_sjlj_build_catch_list, next_sjlj_build_try_catch_finally, objc_begin_try_stmt, objc_begin_catch_clause, objc_finish_catch_clause, objc_build_finally_clause, objc_finish_try_stmt, objc_build_synchronized): New. (objc_is_object_id, objc_is_class_id): New. (objc_comptypes): Use them. (build_next_objc_exception_stuff): Break NeXT sjlj out from build_objc_exception_stuff. (synth_module_prologue): Update to match. (objc_build_throw_stmt): Use cur_try_context to decide if we're in a @catch. * objc/objc-act.h: Update prototypes. (OCTI_EXCEPTION_BLK_STACK, objc_exception_block_stack): Remove. testsuite/ * objc.dg/sync-1.m: New. * objc.dg/try-catch-1.m: Don't force next runtime. * objc.dg/try-catch-3.m, objc.dg/try-catch-4.m: Likewise. * objc.dg/try-catch-2.m: Likewise. Enable everywhere. Remove shadowed catch clause. * objc.dg/try-catch-5.m: New. From-SVN: r83332
2004-06-18 03:20:53 +02:00
objc_eh_runtime_type (tree type)
{
c-common.c (flag_objc_sjlj_exceptions): New. * c-common.c (flag_objc_sjlj_exceptions): New. * c-common.h (flag_objc_sjlj_exceptions): Declare. * c-opts.c (c_common_handle_option): Set it. (c_common_post_options): Handle interation of different objective-c exception and runtime switches. * c-decl.c (c_eh_initialized_p): New. (finish_decl): Use it instead of local eh_initialized_p. * c-parse.in (nested_function, notype_nested_function): Record the result of compstmt. (compstmt_or_error): Likewise. (compstmt): Don't add_stmt the result. (stmt): Don't return anything. Rewrite objc try and sync rules. (objc_try_stmt, objc_catch_list): Remove. (objc_catch_block, objc_finally_block): Remove. (objc_catch_prefix, objc_catch_clause, objc_opt_catch_list): New. (objc_try_catch_clause, objc_finally_clause): New. (objc_try_catch_stmt): Rewrite. * c-tree.h (c_eh_initialized_p): Declare. * c-opt (fobjc-sjlj-exceptions): New. * except.c (output_function_exception_table): Don't call cgraph on non-decls. * objc/objc-act.c (UTAG_EXCDATA_VAR, UTAG_CAUGHTEXC_VAR, UTAG_RETHROWEXC_VAR, UTAG_EVALONCE_VAR, struct val_stack, catch_count_stack, exc_binding_stack, if_nesting_count, blk_nesting_count, objc_enter_block, objc_exit_block, objc_declare_variable, 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): Remove. (objc_create_temporary_var, struct objc_try_context, cur_try_context, objc_eh_runtime_type, objc_init_exceptions, objc_build_exc_ptr, next_sjlj_build_try_exit, next_sjlj_build_enter_and_setjmp, next_sjlj_build_exc_extract, next_sjlj_build_catch_list, next_sjlj_build_try_catch_finally, objc_begin_try_stmt, objc_begin_catch_clause, objc_finish_catch_clause, objc_build_finally_clause, objc_finish_try_stmt, objc_build_synchronized): New. (objc_is_object_id, objc_is_class_id): New. (objc_comptypes): Use them. (build_next_objc_exception_stuff): Break NeXT sjlj out from build_objc_exception_stuff. (synth_module_prologue): Update to match. (objc_build_throw_stmt): Use cur_try_context to decide if we're in a @catch. * objc/objc-act.h: Update prototypes. (OCTI_EXCEPTION_BLK_STACK, objc_exception_block_stack): Remove. testsuite/ * objc.dg/sync-1.m: New. * objc.dg/try-catch-1.m: Don't force next runtime. * objc.dg/try-catch-3.m, objc.dg/try-catch-4.m: Likewise. * objc.dg/try-catch-2.m: Likewise. Enable everywhere. Remove shadowed catch clause. * objc.dg/try-catch-5.m: New. From-SVN: r83332
2004-06-18 03:20:53 +02:00
return add_objc_string (OBJC_TYPE_NAME (TREE_TYPE (type)), class_names);
}
Makefile.in (c-parse.o): Depend on $(C_COMMON_H). [gcc/ChangeLog] 2004-09-07 Ziemowit Laski <zlaski@apple.com> * Makefile.in (c-parse.o): Depend on $(C_COMMON_H). * c-parse.in: Include c-common.h instead of objc-act.h. (ivar_decl_list, ivar_decls, ivar_decl, ivars, ivar_declarator, myparms, myparm): Remove %type declarations. (methodtype, optparms, OBJC_TYPE_QUAL, objc_quals, objc_qual, objc_typename, objc_try_catch_stmt, optellipsis): Add %type declarations. (objc_inherit_code, objc_public_flag): Remove. (typespec_nonreserved_nonattr): Call objc_get_protocol_qualified_type() instead of get_static_reference() and get_protocol_reference(). (stmt_nocomp): Call grokparm() on @catch parameter. (objcdef): Move semantic action to objc_finish_implementation(). (classdef): Move semantic action to objc_start_class_interface(), objc_continue_interface(), objc_finish_interface(), objc_start_class_implementation(), objc_continue_implementation(), objc_start_category_interface() and objc_start_category_implementation(). (protocoldef): Move semantic actions to objc_start_protocol() and objc_finish_interface(). (ivar_decl_list): Remove nonterminal. (visibility_spec): Move semantic actions to objc_set_visibility(). (ivar_decls): Remove assignment to $$. (ivar_decl): Rephrase in terms of component_decl; call objc_add_instance_variable(). (ivars, ivar_declarator): Remove nonterminals. (opt_semi): New nonterminal. (methodtype): Remove semantic actions. (methoddef): Move semantic actions to objc_set_method_type(), objc_start_method_definition() and objc_finish_method_definition(). (methodproto): Move semantic actions to objc_set_method_type() and objc_add_method_declaration(). (methoddecl): Use objc_typename instead of typename; move semantic actions to objc_build_method_signature(). (optarglist, myxdecls, mydecl, myparms, myparm): Remove nonterminals. (optparmlist): Express in terms of optparms and optellipsis. (optparms, optellipsis, objc_qual, objc_quals, objc_typename): New nonterminals. (keyworddecl): Use objc_typename instead of typename. (rid_to_yy): Mark RID_IN, RID_OUT, RID_INOUT, RID_BYCOPY, RID_BYREF and RID_ONEWAY as returning OBJC_TYPE_QUAL to yyparse(). [gcc/objc/ChangeLog] 2004-09-07 Ziemowit Laski <zlaski@apple.com> * Make-lang.in (objc/objc-parse.o): Depend on $(C_COMMON_H) instead of objc/objc-act.h. (objc/objc-act.o): Depend on $(HASHTAB_H). * objc-act.c: Include hashtab.h; in ObjC++ mode, include cp-tree.h and objcp-decl.h instead of c-tree.h. (build_module_descriptor, get_class_ivars, synth_id_with_class_suffix, error_with_ivar, gen_method_decl, gen_declaration, setup_string_decl, build_protocol_template): Adjust prototypes. (build_module_initializer_routine, start_class, continue_class, finish_class, start_method_def, objc_start_function, start_protocol, build_method_decl, objc_add_method, add_instance_variable, build_ivar_reference, is_ivar, is_private, get_super_receiver, build_selector_table_decl, objc_push_parm, objc_get_parm_info, gen_type_name, gen_type_name_0, start_var_decl, finish_var_decl, create_field_decl): New prototypes. (objc_expand_function_end, comp_method_with_proto, objc_expr_last, gen_declaration_1, gen_declarator, is_complex_decl, adorn_decl, define_decl, create_builtin_decl, gen_declspecs): Remove prototypes. (TYPE_ID): Rename to OBJECT_TYPEDEF_NAME. (CLASS_TYPEDEF_NAME): New. (TAG_EXECCLASS): Change from a global variable to a #define. (TAG_RETURN_STRUCT): Delete. (TAG_GNUINIT): New, holds '__objc_gnu_init' name. (objc_inherit_code, objc_public_flag): New, moved from c-parse.in. (string_descriptor): New struct. (string_htab): New hash table. (string_hash, string_eq): New prototypes. (generate_struct_by_value_array): Call create_field_decl() instead of create_builtin_decl(). (objc_init): Do not initialize objc_ellipsis_node or TAG_EXECCLASS; In ObjC++ mode, call cxx_init() instead of c_objc_common_init(). (objc_finish_file): In ObjC++, call instantiate_pending_templates() and cp_finish_file(). (define_decl, get_static_reference, get_protocol_reference, create_builtin_decl): Remove functions. (objc_start_class_interface, objc_start_category_interface, objc_start_protocol, objc_continue_interface, objc_finish_interface, objc_start_class_implementation, objc_start_category_implementation, objc_continue_implementation, objc_finish_implementation, objc_set_visibility, objc_set_method_type, objc_build_method_signature, objc_add_method_declaration, objc_start_method_definition, objc_add_instance_variable, objc_get_protocol_qualified_type, create_field_decl, start_var_decl, finish_var_decl): New functions. (setup_string_decl): Simplify since it is only called once. (synth_module_prologue): Call build_class_template(); predefine 'id' and 'Class' as typedefs; rename 'temp_type' to 'type'; disable debug hooks for duration of function; fix GNU runtime messenger signatures to correspond to reality; forward-declare '__objc_exec_class' for the GNU runtime; call build_selector_table_decl(); in ObjC++ mode, generate 'extern "C" { ... }' wrappers around synthesized declarations; call build_protocol_template() and build_category_template(). (string_hash, string_eq): New functions. (objc_build_string_object): Check metaclass correctness only once; store string literals in hash table. (objc_build_constructor): Do not convert initializer elements; adjust for ObjC++ impedance mismatch. (build_objc_symtab_template): Call create_field_decl() instead of create_builtin_decl(). (init_objc_symtab): Add missing conversion to initializer element. (build_metadata_decl): Call start_var_decl() instead of define_decl(). (generate_objc_symtab_decl): Do not call build_category_template(); call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(). (build_module_descriptor): Call create_field_decl() instead of grokfield(); call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(); always mark module descriptor as used; move GNU runtime-specific functionality to build_module_initializer_routine(). (build_module_initializer_routine): New function, broken off of build_module_descriptor(). (objc_static_init_needed_p, objc_generate_static_init_call): New functions. (generate_static_references, generate_strings, build_selector_translation_table, generate_descriptor_table, generate_ivars_list, generate_dispatch_table, generate_category): Call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(); build a type directly instead of via groktypename(). (build_selector_reference_decl, build_selector_table_decl, build_class_reference_decl, build_protocol_reference, generate_objc_image_info): Call start_var_decl() instead of build_decl(). (build_selector_reference): For GNU runtime, do not call build_selector_reference_decl(). (build_selector, build_typed_selector_reference): Always convert result to the selector type. (add_objc_string): Cast return value to 'char *'. (build_method_prototype_template, build_selector_template, build_method_template): Use actual selector type for fields pointing to selectors. (finish_objc): For GNU runtime, call build_module_initializer_routine() after build_module_descriptor(). (generate_protocol_list, generate_shared_structures): Call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(); build a type directly instead of via groktypename(). (synth_id_with_class_suffix): Return a string. (get_arg_type_list): For instance methods, use the instance type for 'self'; do not call groktypename_in_parm_context(). (build_objc_string_decl): Squash redeclaration errors in ObjC++. (objc_is_class_name): Use OBJC_TYPE_NAME instead of TYPE_NAME; handle RECORD_TYPEs in ObjC as well as ObjC++. (objc_is_id): New function. (objc_is_object_ptr): Return the canonical type node. (objc_get_class_ivars): Simplify using get_class_ivars(). (get_class_ivars): Remove second parameter; create a fresh copy of the ivar list for each call; do not check for existence of super class. (objc_eh_runtime_type): Mark #ifndef OBJCPLUS. (objc_init_exceptions): When using SJLJ-style exceptions, require the use of '-fobjc-exceptions' flag; do not require it for DWARF-style exceptions. (objc_build_exc_ptr, next_sjlj_build_try_catch_finally): Use objc_object_type instead of objc_id_type. (objc_begin_catch_clause): Convert the incoming PARM_DECL into a VAR_DECL before placing it in the appropriate scope; do not call define_decl(); adjust call to c_begin_compound_stmt(); use objc_object_type instead of objc_id_type. (build_next_objc_exception_stuff): Call create_field_decl() instead of create_builtin_decl(); construct type directly instead of calling groktypename(); use OBJC_VOID_AT_END to mark end of function parameters. (build_private_template): Adjust call to get_class_ivars(); build a type directly instead of via groktypename(). (build_protocol_template, build_method_prototype_list_template, build_method_prototype_template, build_category_template, build_selector_template, build_class_template, build_super_template, build_ivar_template, build_ivar_list_template, build_method_list_template, build_method_template): Call create_field_decl() instead of grokfield(). (objc_method_parm_type): Do not call groktypename(). (generate_descriptor_table): Call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(). (generate_method_descriptors, build_protocol_initializer, generate_dispatch_tables, build_category_initializer, build_shared_structure_initializer): Do not call groktypename(). (generate_protocols): Call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(); do not call groktypename(). (error_with_ivar): Remove last parameter. (check_ivars): Do not iterate ovar CLASS_RAW_IVARS lists in addition to CLASS_IVARS lists; adjust calls to error_with_ivar(). (generate_ivar_lists): Convert one of the initializer elements; do not call groktypename(). (get_arg_type_list, start_method_def, gen_method_def): Account for new representation of variable arguments and '...' in Objective-C methods; add Objective-C++ impedance matching code. (is_objc_type_qualifier): Remove function. (adjust_type_for_id_default): Simplify; there is no longer a need to wade through declspecs. (lookup_interface, start_class, continue_class, finish_class, start_method_def, start_protocol, build_method_decl, objc_add_method, add_instance_variable, build_ivar_reference, is_ivar, is_private, get_super_receiver, objc_build_finally_epilogue): Make into static functions. (receiver_is_class_object): Use new IS_CLASS() macro. (objc_build_message_expr): Tweak ObjC++ message argument handling; call objc_finish_message_expr() instead of finish_message_expr(). (finish_message_expr): Rename to objc_finish_message_expr(); use OBJC_TYPE_NAME and OBJC_SET_TYPE_NAME macros instead of TYPE_NAME. call gen_type_name() instead of gen_declaration(); call objc_is_id() instead of using IS_ID and IS_CLASS; Use objc_class_name instead of calling get_identifier("Class"); handle CONVERT_EXPRs in receiver. (build_objc_method_call, warn_with_method): Do not call groktypename(). (build_ivar_reference): Call convert() instead of clobbering in a type. (hash_init): Initialize string_htab hash table. (add_instance_variable): Simplify parameter list; do not call grokfield(); do not populate CLASS_IVARS list. (start_class): Check for the existence of super class, if one was specified. (continue_class): Use CLASS_RAW_IVARS rather than CLASS_IVARS; do not call build_class_template(); adjust call to get_class_ivars(); call build_decl(), pushdecl() and finish_decl() instead of define_decl(). (finish_class): Call build_decl(), pushdecl() and finish_decl() instead of define_decl(). (add_protocols): Use PROTOCOL_BINFO_ELTS for the tree vector size. (start_protocol): Do not call build_protocol_template(); use PROTOCOL_BINFO_ELTS for the tree vector size. (encode_type_qualifiers): Do not handle the 'const' qualifier here. (encode_pointer): Encode 'const char *' as 'r*', for backwards compatibility. (encode_array): Use HOST_WIDE_INT_PRINT_DEC instead of "%ld". (encode_type): Handle the 'const' qualifier here. (objc_parmlist): New global variable, sued by objc_push_parm and objc_get_parm_info(). (objc_push_parm, objc_get_parm_info): New functions. (objc_expr_last): Remove function. (synth_self_and_ucmd_args): For instance methods, use the instance type for 'self'; call objc_push_parm() instead of push_parm_decl(). (start_method_def): Do not call push_scope(), declare_parm_level(), pop_scope(), push_parm_decl(), store_parm_decls() or objc_expr_last(); just use objc_push_parm() and objc_get_parm_info(). (comp_method_with_proto): Remove function. (objc_types_are_equivalent): Strip away indirections before comparing underlying types. (comp_proto_with_proto): Do not call groktypename(); types are no longer in raw declspec format. (objc_start_function): New function. (really_start_method): Call comp_proto_with_proto() instead of comp_method_with_proto(); call objc_start_function() instead of hand-crafting a function declarator. (continue_method_def, objc_expand_function_end): Remove functions. (get_super_receiver): Call objc_get_current_scope() instead of get_current_scope(); reference 'super_class' field (instead of 'class'). (finish_method_def): Rename to objc_finish_method_definition() and add a function decl parameter; move method encoding call from objc_expand_function_end(). (is_complex_decl, adorn_decl, gen_declarator, gen_declspecs, gen_declaration_1): Remove functions. (tmpbuf, RAW_DECLSPEC): Remove. (gen_declaration): Remove second parameter; simplify to deal with TYPE_P nodes instead of raw declspecs. (gen_type_name, gen_type_name_0): New functions. (gen_method_decl): Remove second parameter; call gen_type_name() instead of gen_declaration_1(). (dump_interface): Adjust calls to gen_declaration() and gen_method_decl(); do not allocate a separate string buffer. (init_objc): Allocate a larger string buffer to accommodate dump_interface(); adjust call to build_module_descriptor(); add call to build_module_initializer_routine() for the GNU runtime. (generate_classref_translation_entry): Do not call start_decl(); call finish_var_decl() instead of finish_decl(); call convert() instead of build_c_cast(). * objc-act.h (CLASS_OWN_IVARS): Remove accessor. (CLASS_BINFO_ELTS): Reduce from 6 to 5, now that CLASS_OWN_IVARS is gone. (OCTI_GNU_INIT_DECL, GNU_INIT_decl): New. (OCTI_ELLIPSIS_NODE, objc_ellipsis_node): Remove. (OCTI_ID_ID, id_type, objc_id_id): Rename to OCTI_ID_NAME, objc_object_type and objc_object_name, respectively. (OCTI_CLS_REF, OCTI_CLASS_NAME, objc_class_reference, objc_class_name): New. (IS_CLASS): New macro. (IS_ID, IS_SUPER): Robustify. (OCTI_EXECCLASS_DECL, execclass_decl): New. (finish_file, start_class, continue_class, finish_class, start_method_def, continue_method_def, finish_method_def, start_protocol, finish_protocol, objc_build_throw_stmt, objc_build_try_catch_finally_stmt, objc_build_synchronized_prologue, objc_build_synchronized_epilogue, objc_build_try_prologue, objc_build_try_epilogue, objc_build_catch_stmt, objc_build_catch_epilogue, objc_build_finally_prologue, objc_build_finally_epilogue, is_ivar, is_private, is_public, add_instance_variable, objc_add_method, get_super_receiver, objc_clear_super_receiver, get_class_ivars_from_name, get_class_reference, get_static_reference, get_object_reference, build_message_expr, finish_message_expr, build_selector_expr, build_ivar_reference, build_keyword_decl, build_method_decl, build_protocol_expr, build_objc_string_object, objc_declare_alias, objc_declare_class, objc_declare_protocols, objc_comptypes, objc_check_decl, build_encode_expr): Remove prototypes. (imp_count, cat_count): Make GGC-aware. (OBJC_SET_TYPE_NAME): New macro. From-SVN: r87168
2004-09-08 02:49:44 +02:00
#endif
c-common.c (flag_objc_sjlj_exceptions): New. * c-common.c (flag_objc_sjlj_exceptions): New. * c-common.h (flag_objc_sjlj_exceptions): Declare. * c-opts.c (c_common_handle_option): Set it. (c_common_post_options): Handle interation of different objective-c exception and runtime switches. * c-decl.c (c_eh_initialized_p): New. (finish_decl): Use it instead of local eh_initialized_p. * c-parse.in (nested_function, notype_nested_function): Record the result of compstmt. (compstmt_or_error): Likewise. (compstmt): Don't add_stmt the result. (stmt): Don't return anything. Rewrite objc try and sync rules. (objc_try_stmt, objc_catch_list): Remove. (objc_catch_block, objc_finally_block): Remove. (objc_catch_prefix, objc_catch_clause, objc_opt_catch_list): New. (objc_try_catch_clause, objc_finally_clause): New. (objc_try_catch_stmt): Rewrite. * c-tree.h (c_eh_initialized_p): Declare. * c-opt (fobjc-sjlj-exceptions): New. * except.c (output_function_exception_table): Don't call cgraph on non-decls. * objc/objc-act.c (UTAG_EXCDATA_VAR, UTAG_CAUGHTEXC_VAR, UTAG_RETHROWEXC_VAR, UTAG_EVALONCE_VAR, struct val_stack, catch_count_stack, exc_binding_stack, if_nesting_count, blk_nesting_count, objc_enter_block, objc_exit_block, objc_declare_variable, 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): Remove. (objc_create_temporary_var, struct objc_try_context, cur_try_context, objc_eh_runtime_type, objc_init_exceptions, objc_build_exc_ptr, next_sjlj_build_try_exit, next_sjlj_build_enter_and_setjmp, next_sjlj_build_exc_extract, next_sjlj_build_catch_list, next_sjlj_build_try_catch_finally, objc_begin_try_stmt, objc_begin_catch_clause, objc_finish_catch_clause, objc_build_finally_clause, objc_finish_try_stmt, objc_build_synchronized): New. (objc_is_object_id, objc_is_class_id): New. (objc_comptypes): Use them. (build_next_objc_exception_stuff): Break NeXT sjlj out from build_objc_exception_stuff. (synth_module_prologue): Update to match. (objc_build_throw_stmt): Use cur_try_context to decide if we're in a @catch. * objc/objc-act.h: Update prototypes. (OCTI_EXCEPTION_BLK_STACK, objc_exception_block_stack): Remove. testsuite/ * objc.dg/sync-1.m: New. * objc.dg/try-catch-1.m: Don't force next runtime. * objc.dg/try-catch-3.m, objc.dg/try-catch-4.m: Likewise. * objc.dg/try-catch-2.m: Likewise. Enable everywhere. Remove shadowed catch clause. * objc.dg/try-catch-5.m: New. From-SVN: r83332
2004-06-18 03:20:53 +02:00
/* Initialize exception handling. */
static void
c-common.c (flag_objc_sjlj_exceptions): New. * c-common.c (flag_objc_sjlj_exceptions): New. * c-common.h (flag_objc_sjlj_exceptions): Declare. * c-opts.c (c_common_handle_option): Set it. (c_common_post_options): Handle interation of different objective-c exception and runtime switches. * c-decl.c (c_eh_initialized_p): New. (finish_decl): Use it instead of local eh_initialized_p. * c-parse.in (nested_function, notype_nested_function): Record the result of compstmt. (compstmt_or_error): Likewise. (compstmt): Don't add_stmt the result. (stmt): Don't return anything. Rewrite objc try and sync rules. (objc_try_stmt, objc_catch_list): Remove. (objc_catch_block, objc_finally_block): Remove. (objc_catch_prefix, objc_catch_clause, objc_opt_catch_list): New. (objc_try_catch_clause, objc_finally_clause): New. (objc_try_catch_stmt): Rewrite. * c-tree.h (c_eh_initialized_p): Declare. * c-opt (fobjc-sjlj-exceptions): New. * except.c (output_function_exception_table): Don't call cgraph on non-decls. * objc/objc-act.c (UTAG_EXCDATA_VAR, UTAG_CAUGHTEXC_VAR, UTAG_RETHROWEXC_VAR, UTAG_EVALONCE_VAR, struct val_stack, catch_count_stack, exc_binding_stack, if_nesting_count, blk_nesting_count, objc_enter_block, objc_exit_block, objc_declare_variable, 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): Remove. (objc_create_temporary_var, struct objc_try_context, cur_try_context, objc_eh_runtime_type, objc_init_exceptions, objc_build_exc_ptr, next_sjlj_build_try_exit, next_sjlj_build_enter_and_setjmp, next_sjlj_build_exc_extract, next_sjlj_build_catch_list, next_sjlj_build_try_catch_finally, objc_begin_try_stmt, objc_begin_catch_clause, objc_finish_catch_clause, objc_build_finally_clause, objc_finish_try_stmt, objc_build_synchronized): New. (objc_is_object_id, objc_is_class_id): New. (objc_comptypes): Use them. (build_next_objc_exception_stuff): Break NeXT sjlj out from build_objc_exception_stuff. (synth_module_prologue): Update to match. (objc_build_throw_stmt): Use cur_try_context to decide if we're in a @catch. * objc/objc-act.h: Update prototypes. (OCTI_EXCEPTION_BLK_STACK, objc_exception_block_stack): Remove. testsuite/ * objc.dg/sync-1.m: New. * objc.dg/try-catch-1.m: Don't force next runtime. * objc.dg/try-catch-3.m, objc.dg/try-catch-4.m: Likewise. * objc.dg/try-catch-2.m: Likewise. Enable everywhere. Remove shadowed catch clause. * objc.dg/try-catch-5.m: New. From-SVN: r83332
2004-06-18 03:20:53 +02:00
objc_init_exceptions (void)
{
c-common.c (flag_objc_sjlj_exceptions): New. * c-common.c (flag_objc_sjlj_exceptions): New. * c-common.h (flag_objc_sjlj_exceptions): Declare. * c-opts.c (c_common_handle_option): Set it. (c_common_post_options): Handle interation of different objective-c exception and runtime switches. * c-decl.c (c_eh_initialized_p): New. (finish_decl): Use it instead of local eh_initialized_p. * c-parse.in (nested_function, notype_nested_function): Record the result of compstmt. (compstmt_or_error): Likewise. (compstmt): Don't add_stmt the result. (stmt): Don't return anything. Rewrite objc try and sync rules. (objc_try_stmt, objc_catch_list): Remove. (objc_catch_block, objc_finally_block): Remove. (objc_catch_prefix, objc_catch_clause, objc_opt_catch_list): New. (objc_try_catch_clause, objc_finally_clause): New. (objc_try_catch_stmt): Rewrite. * c-tree.h (c_eh_initialized_p): Declare. * c-opt (fobjc-sjlj-exceptions): New. * except.c (output_function_exception_table): Don't call cgraph on non-decls. * objc/objc-act.c (UTAG_EXCDATA_VAR, UTAG_CAUGHTEXC_VAR, UTAG_RETHROWEXC_VAR, UTAG_EVALONCE_VAR, struct val_stack, catch_count_stack, exc_binding_stack, if_nesting_count, blk_nesting_count, objc_enter_block, objc_exit_block, objc_declare_variable, 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): Remove. (objc_create_temporary_var, struct objc_try_context, cur_try_context, objc_eh_runtime_type, objc_init_exceptions, objc_build_exc_ptr, next_sjlj_build_try_exit, next_sjlj_build_enter_and_setjmp, next_sjlj_build_exc_extract, next_sjlj_build_catch_list, next_sjlj_build_try_catch_finally, objc_begin_try_stmt, objc_begin_catch_clause, objc_finish_catch_clause, objc_build_finally_clause, objc_finish_try_stmt, objc_build_synchronized): New. (objc_is_object_id, objc_is_class_id): New. (objc_comptypes): Use them. (build_next_objc_exception_stuff): Break NeXT sjlj out from build_objc_exception_stuff. (synth_module_prologue): Update to match. (objc_build_throw_stmt): Use cur_try_context to decide if we're in a @catch. * objc/objc-act.h: Update prototypes. (OCTI_EXCEPTION_BLK_STACK, objc_exception_block_stack): Remove. testsuite/ * objc.dg/sync-1.m: New. * objc.dg/try-catch-1.m: Don't force next runtime. * objc.dg/try-catch-3.m, objc.dg/try-catch-4.m: Likewise. * objc.dg/try-catch-2.m: Likewise. Enable everywhere. Remove shadowed catch clause. * objc.dg/try-catch-5.m: New. From-SVN: r83332
2004-06-18 03:20:53 +02:00
static bool done = false;
if (done)
return;
done = true;
Makefile.in (c-parse.o): Depend on $(C_COMMON_H). [gcc/ChangeLog] 2004-09-07 Ziemowit Laski <zlaski@apple.com> * Makefile.in (c-parse.o): Depend on $(C_COMMON_H). * c-parse.in: Include c-common.h instead of objc-act.h. (ivar_decl_list, ivar_decls, ivar_decl, ivars, ivar_declarator, myparms, myparm): Remove %type declarations. (methodtype, optparms, OBJC_TYPE_QUAL, objc_quals, objc_qual, objc_typename, objc_try_catch_stmt, optellipsis): Add %type declarations. (objc_inherit_code, objc_public_flag): Remove. (typespec_nonreserved_nonattr): Call objc_get_protocol_qualified_type() instead of get_static_reference() and get_protocol_reference(). (stmt_nocomp): Call grokparm() on @catch parameter. (objcdef): Move semantic action to objc_finish_implementation(). (classdef): Move semantic action to objc_start_class_interface(), objc_continue_interface(), objc_finish_interface(), objc_start_class_implementation(), objc_continue_implementation(), objc_start_category_interface() and objc_start_category_implementation(). (protocoldef): Move semantic actions to objc_start_protocol() and objc_finish_interface(). (ivar_decl_list): Remove nonterminal. (visibility_spec): Move semantic actions to objc_set_visibility(). (ivar_decls): Remove assignment to $$. (ivar_decl): Rephrase in terms of component_decl; call objc_add_instance_variable(). (ivars, ivar_declarator): Remove nonterminals. (opt_semi): New nonterminal. (methodtype): Remove semantic actions. (methoddef): Move semantic actions to objc_set_method_type(), objc_start_method_definition() and objc_finish_method_definition(). (methodproto): Move semantic actions to objc_set_method_type() and objc_add_method_declaration(). (methoddecl): Use objc_typename instead of typename; move semantic actions to objc_build_method_signature(). (optarglist, myxdecls, mydecl, myparms, myparm): Remove nonterminals. (optparmlist): Express in terms of optparms and optellipsis. (optparms, optellipsis, objc_qual, objc_quals, objc_typename): New nonterminals. (keyworddecl): Use objc_typename instead of typename. (rid_to_yy): Mark RID_IN, RID_OUT, RID_INOUT, RID_BYCOPY, RID_BYREF and RID_ONEWAY as returning OBJC_TYPE_QUAL to yyparse(). [gcc/objc/ChangeLog] 2004-09-07 Ziemowit Laski <zlaski@apple.com> * Make-lang.in (objc/objc-parse.o): Depend on $(C_COMMON_H) instead of objc/objc-act.h. (objc/objc-act.o): Depend on $(HASHTAB_H). * objc-act.c: Include hashtab.h; in ObjC++ mode, include cp-tree.h and objcp-decl.h instead of c-tree.h. (build_module_descriptor, get_class_ivars, synth_id_with_class_suffix, error_with_ivar, gen_method_decl, gen_declaration, setup_string_decl, build_protocol_template): Adjust prototypes. (build_module_initializer_routine, start_class, continue_class, finish_class, start_method_def, objc_start_function, start_protocol, build_method_decl, objc_add_method, add_instance_variable, build_ivar_reference, is_ivar, is_private, get_super_receiver, build_selector_table_decl, objc_push_parm, objc_get_parm_info, gen_type_name, gen_type_name_0, start_var_decl, finish_var_decl, create_field_decl): New prototypes. (objc_expand_function_end, comp_method_with_proto, objc_expr_last, gen_declaration_1, gen_declarator, is_complex_decl, adorn_decl, define_decl, create_builtin_decl, gen_declspecs): Remove prototypes. (TYPE_ID): Rename to OBJECT_TYPEDEF_NAME. (CLASS_TYPEDEF_NAME): New. (TAG_EXECCLASS): Change from a global variable to a #define. (TAG_RETURN_STRUCT): Delete. (TAG_GNUINIT): New, holds '__objc_gnu_init' name. (objc_inherit_code, objc_public_flag): New, moved from c-parse.in. (string_descriptor): New struct. (string_htab): New hash table. (string_hash, string_eq): New prototypes. (generate_struct_by_value_array): Call create_field_decl() instead of create_builtin_decl(). (objc_init): Do not initialize objc_ellipsis_node or TAG_EXECCLASS; In ObjC++ mode, call cxx_init() instead of c_objc_common_init(). (objc_finish_file): In ObjC++, call instantiate_pending_templates() and cp_finish_file(). (define_decl, get_static_reference, get_protocol_reference, create_builtin_decl): Remove functions. (objc_start_class_interface, objc_start_category_interface, objc_start_protocol, objc_continue_interface, objc_finish_interface, objc_start_class_implementation, objc_start_category_implementation, objc_continue_implementation, objc_finish_implementation, objc_set_visibility, objc_set_method_type, objc_build_method_signature, objc_add_method_declaration, objc_start_method_definition, objc_add_instance_variable, objc_get_protocol_qualified_type, create_field_decl, start_var_decl, finish_var_decl): New functions. (setup_string_decl): Simplify since it is only called once. (synth_module_prologue): Call build_class_template(); predefine 'id' and 'Class' as typedefs; rename 'temp_type' to 'type'; disable debug hooks for duration of function; fix GNU runtime messenger signatures to correspond to reality; forward-declare '__objc_exec_class' for the GNU runtime; call build_selector_table_decl(); in ObjC++ mode, generate 'extern "C" { ... }' wrappers around synthesized declarations; call build_protocol_template() and build_category_template(). (string_hash, string_eq): New functions. (objc_build_string_object): Check metaclass correctness only once; store string literals in hash table. (objc_build_constructor): Do not convert initializer elements; adjust for ObjC++ impedance mismatch. (build_objc_symtab_template): Call create_field_decl() instead of create_builtin_decl(). (init_objc_symtab): Add missing conversion to initializer element. (build_metadata_decl): Call start_var_decl() instead of define_decl(). (generate_objc_symtab_decl): Do not call build_category_template(); call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(). (build_module_descriptor): Call create_field_decl() instead of grokfield(); call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(); always mark module descriptor as used; move GNU runtime-specific functionality to build_module_initializer_routine(). (build_module_initializer_routine): New function, broken off of build_module_descriptor(). (objc_static_init_needed_p, objc_generate_static_init_call): New functions. (generate_static_references, generate_strings, build_selector_translation_table, generate_descriptor_table, generate_ivars_list, generate_dispatch_table, generate_category): Call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(); build a type directly instead of via groktypename(). (build_selector_reference_decl, build_selector_table_decl, build_class_reference_decl, build_protocol_reference, generate_objc_image_info): Call start_var_decl() instead of build_decl(). (build_selector_reference): For GNU runtime, do not call build_selector_reference_decl(). (build_selector, build_typed_selector_reference): Always convert result to the selector type. (add_objc_string): Cast return value to 'char *'. (build_method_prototype_template, build_selector_template, build_method_template): Use actual selector type for fields pointing to selectors. (finish_objc): For GNU runtime, call build_module_initializer_routine() after build_module_descriptor(). (generate_protocol_list, generate_shared_structures): Call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(); build a type directly instead of via groktypename(). (synth_id_with_class_suffix): Return a string. (get_arg_type_list): For instance methods, use the instance type for 'self'; do not call groktypename_in_parm_context(). (build_objc_string_decl): Squash redeclaration errors in ObjC++. (objc_is_class_name): Use OBJC_TYPE_NAME instead of TYPE_NAME; handle RECORD_TYPEs in ObjC as well as ObjC++. (objc_is_id): New function. (objc_is_object_ptr): Return the canonical type node. (objc_get_class_ivars): Simplify using get_class_ivars(). (get_class_ivars): Remove second parameter; create a fresh copy of the ivar list for each call; do not check for existence of super class. (objc_eh_runtime_type): Mark #ifndef OBJCPLUS. (objc_init_exceptions): When using SJLJ-style exceptions, require the use of '-fobjc-exceptions' flag; do not require it for DWARF-style exceptions. (objc_build_exc_ptr, next_sjlj_build_try_catch_finally): Use objc_object_type instead of objc_id_type. (objc_begin_catch_clause): Convert the incoming PARM_DECL into a VAR_DECL before placing it in the appropriate scope; do not call define_decl(); adjust call to c_begin_compound_stmt(); use objc_object_type instead of objc_id_type. (build_next_objc_exception_stuff): Call create_field_decl() instead of create_builtin_decl(); construct type directly instead of calling groktypename(); use OBJC_VOID_AT_END to mark end of function parameters. (build_private_template): Adjust call to get_class_ivars(); build a type directly instead of via groktypename(). (build_protocol_template, build_method_prototype_list_template, build_method_prototype_template, build_category_template, build_selector_template, build_class_template, build_super_template, build_ivar_template, build_ivar_list_template, build_method_list_template, build_method_template): Call create_field_decl() instead of grokfield(). (objc_method_parm_type): Do not call groktypename(). (generate_descriptor_table): Call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(). (generate_method_descriptors, build_protocol_initializer, generate_dispatch_tables, build_category_initializer, build_shared_structure_initializer): Do not call groktypename(). (generate_protocols): Call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(); do not call groktypename(). (error_with_ivar): Remove last parameter. (check_ivars): Do not iterate ovar CLASS_RAW_IVARS lists in addition to CLASS_IVARS lists; adjust calls to error_with_ivar(). (generate_ivar_lists): Convert one of the initializer elements; do not call groktypename(). (get_arg_type_list, start_method_def, gen_method_def): Account for new representation of variable arguments and '...' in Objective-C methods; add Objective-C++ impedance matching code. (is_objc_type_qualifier): Remove function. (adjust_type_for_id_default): Simplify; there is no longer a need to wade through declspecs. (lookup_interface, start_class, continue_class, finish_class, start_method_def, start_protocol, build_method_decl, objc_add_method, add_instance_variable, build_ivar_reference, is_ivar, is_private, get_super_receiver, objc_build_finally_epilogue): Make into static functions. (receiver_is_class_object): Use new IS_CLASS() macro. (objc_build_message_expr): Tweak ObjC++ message argument handling; call objc_finish_message_expr() instead of finish_message_expr(). (finish_message_expr): Rename to objc_finish_message_expr(); use OBJC_TYPE_NAME and OBJC_SET_TYPE_NAME macros instead of TYPE_NAME. call gen_type_name() instead of gen_declaration(); call objc_is_id() instead of using IS_ID and IS_CLASS; Use objc_class_name instead of calling get_identifier("Class"); handle CONVERT_EXPRs in receiver. (build_objc_method_call, warn_with_method): Do not call groktypename(). (build_ivar_reference): Call convert() instead of clobbering in a type. (hash_init): Initialize string_htab hash table. (add_instance_variable): Simplify parameter list; do not call grokfield(); do not populate CLASS_IVARS list. (start_class): Check for the existence of super class, if one was specified. (continue_class): Use CLASS_RAW_IVARS rather than CLASS_IVARS; do not call build_class_template(); adjust call to get_class_ivars(); call build_decl(), pushdecl() and finish_decl() instead of define_decl(). (finish_class): Call build_decl(), pushdecl() and finish_decl() instead of define_decl(). (add_protocols): Use PROTOCOL_BINFO_ELTS for the tree vector size. (start_protocol): Do not call build_protocol_template(); use PROTOCOL_BINFO_ELTS for the tree vector size. (encode_type_qualifiers): Do not handle the 'const' qualifier here. (encode_pointer): Encode 'const char *' as 'r*', for backwards compatibility. (encode_array): Use HOST_WIDE_INT_PRINT_DEC instead of "%ld". (encode_type): Handle the 'const' qualifier here. (objc_parmlist): New global variable, sued by objc_push_parm and objc_get_parm_info(). (objc_push_parm, objc_get_parm_info): New functions. (objc_expr_last): Remove function. (synth_self_and_ucmd_args): For instance methods, use the instance type for 'self'; call objc_push_parm() instead of push_parm_decl(). (start_method_def): Do not call push_scope(), declare_parm_level(), pop_scope(), push_parm_decl(), store_parm_decls() or objc_expr_last(); just use objc_push_parm() and objc_get_parm_info(). (comp_method_with_proto): Remove function. (objc_types_are_equivalent): Strip away indirections before comparing underlying types. (comp_proto_with_proto): Do not call groktypename(); types are no longer in raw declspec format. (objc_start_function): New function. (really_start_method): Call comp_proto_with_proto() instead of comp_method_with_proto(); call objc_start_function() instead of hand-crafting a function declarator. (continue_method_def, objc_expand_function_end): Remove functions. (get_super_receiver): Call objc_get_current_scope() instead of get_current_scope(); reference 'super_class' field (instead of 'class'). (finish_method_def): Rename to objc_finish_method_definition() and add a function decl parameter; move method encoding call from objc_expand_function_end(). (is_complex_decl, adorn_decl, gen_declarator, gen_declspecs, gen_declaration_1): Remove functions. (tmpbuf, RAW_DECLSPEC): Remove. (gen_declaration): Remove second parameter; simplify to deal with TYPE_P nodes instead of raw declspecs. (gen_type_name, gen_type_name_0): New functions. (gen_method_decl): Remove second parameter; call gen_type_name() instead of gen_declaration_1(). (dump_interface): Adjust calls to gen_declaration() and gen_method_decl(); do not allocate a separate string buffer. (init_objc): Allocate a larger string buffer to accommodate dump_interface(); adjust call to build_module_descriptor(); add call to build_module_initializer_routine() for the GNU runtime. (generate_classref_translation_entry): Do not call start_decl(); call finish_var_decl() instead of finish_decl(); call convert() instead of build_c_cast(). * objc-act.h (CLASS_OWN_IVARS): Remove accessor. (CLASS_BINFO_ELTS): Reduce from 6 to 5, now that CLASS_OWN_IVARS is gone. (OCTI_GNU_INIT_DECL, GNU_INIT_decl): New. (OCTI_ELLIPSIS_NODE, objc_ellipsis_node): Remove. (OCTI_ID_ID, id_type, objc_id_id): Rename to OCTI_ID_NAME, objc_object_type and objc_object_name, respectively. (OCTI_CLS_REF, OCTI_CLASS_NAME, objc_class_reference, objc_class_name): New. (IS_CLASS): New macro. (IS_ID, IS_SUPER): Robustify. (OCTI_EXECCLASS_DECL, execclass_decl): New. (finish_file, start_class, continue_class, finish_class, start_method_def, continue_method_def, finish_method_def, start_protocol, finish_protocol, objc_build_throw_stmt, objc_build_try_catch_finally_stmt, objc_build_synchronized_prologue, objc_build_synchronized_epilogue, objc_build_try_prologue, objc_build_try_epilogue, objc_build_catch_stmt, objc_build_catch_epilogue, objc_build_finally_prologue, objc_build_finally_epilogue, is_ivar, is_private, is_public, add_instance_variable, objc_add_method, get_super_receiver, objc_clear_super_receiver, get_class_ivars_from_name, get_class_reference, get_static_reference, get_object_reference, build_message_expr, finish_message_expr, build_selector_expr, build_ivar_reference, build_keyword_decl, build_method_decl, build_protocol_expr, build_objc_string_object, objc_declare_alias, objc_declare_class, objc_declare_protocols, objc_comptypes, objc_check_decl, build_encode_expr): Remove prototypes. (imp_count, cat_count): Make GGC-aware. (OBJC_SET_TYPE_NAME): New macro. From-SVN: r87168
2004-09-08 02:49:44 +02:00
if (flag_objc_sjlj_exceptions)
{
/* On Darwin, ObjC exceptions require a sufficiently recent
version of the runtime, so the user must ask for them explicitly. */
if (!flag_objc_exceptions)
diagnostic.c (warning): Accept parameter to classify warning option. * diagnostic.c (warning): Accept parameter to classify warning option. (warning0): New, for when a pointer to an error() like function is needed. * errors.c (warning): Likewise. * errors.h (warning, warning0): Adjust prototypes. * toplev.h (warning, warning0): Likewise. * attribs.c, builtins.c, c-common.c, c-decl.c, c-format.c, c-gimplify.c, c-lex.c, c-objc-common.c, c-opts.c, c-parser.c, c-pragma.c, c-typeck.c, calls.c, cgraph.c, coverage.c, emit-rtl.c, fold-const.c, fortran/trans-decl.c, function.c, gcse.c, genautomata.c, haifa-sched.c, opts.c, passes.c, regclass.c, reload1.c, stmt.c, stor-layout.c, toplev.c, tree-cfg.c, tree-dump.c, tree-inline.c, tree-mudflap.c, tree-optimize.c, tree-ssa.c, tree.c, varasm.c: Adjust warning() callers. * config/alpha/alpha.c, config/arc/arc.c, config/arm/arm.c, config/avr/avr.c, config/bfin/bfin.c, config/c4x/c4x-c.c, config/c4x/c4x.c, config/cris/cris.c, config/darwin-c.c, config/darwin.c, config/darwin.h, config/h8300/h8300.c, config/i386/cygming.h, config/i386/djgpp.h, config/i386/i386.c, config/i386/winnt.c, config/ia64/ia64-c.c, config/ia64/ia64.c, config/ip2k/ip2k.c, config/m32r/m32r.c, config/m68hc11/m68hc11.c, config/m68k/m68k.c, config/mcore/mcore.c, config/mips/mips.c, config/mmix/mmix.c, config/ns32k/ns32k.c, config/pa/pa-hpux11.h, config/pa/pa.c, config/rs6000/aix43.h, config/rs6000/aix51.h, config/rs6000/aix52.h, config/rs6000/darwin.h, config/rs6000/rs6000-c.c, config/rs6000/rs6000.c, config/s390/s390.c, config/sh/sh.c, config/sh/sh.h, config/sh/symbian.c, config/sol2-c.c, config/sol2.c, config/stormy16/stormy16.c, config/v850/v850-c.c, config/v850/v850.c, config/xtensa/xtensa.c: Adjust warning() callers. * ada/misc.c: Adjust warning() callers. * cp/call.c, cp/class.c, cp/cvt.c, cp/decl.c, cp/decl2.c, cp/except.c, cp/friend.c, cp/init.c, cp/lex.c, cp/mangle.c, cp/method.c, cp/name-lookup.c, cp/parser.c, cp/repo.c, cp/rtti.c, cp/tree.c, cp/typeck.c, cp/typeck2.c: Adjust warning() callers. * fortran/trans-decl.c: Adjust warning() callers. * java/class.c, java/decl.c, java/expr.c, java/jcf-io.c, java/jcf-parse.c, java/jv-scan.c, java/parse.y: Adjust warning() callers. * objc/objc-act.c: Adjust warning() callers. * treelang/parse.y: Adjust warning() callers. From-SVN: r98633
2005-04-23 23:29:07 +02:00
warning (0, "use %<-fobjc-exceptions%> to enable Objective-C "
Makefile.in (c-parse.o): Depend on $(C_COMMON_H). [gcc/ChangeLog] 2004-09-07 Ziemowit Laski <zlaski@apple.com> * Makefile.in (c-parse.o): Depend on $(C_COMMON_H). * c-parse.in: Include c-common.h instead of objc-act.h. (ivar_decl_list, ivar_decls, ivar_decl, ivars, ivar_declarator, myparms, myparm): Remove %type declarations. (methodtype, optparms, OBJC_TYPE_QUAL, objc_quals, objc_qual, objc_typename, objc_try_catch_stmt, optellipsis): Add %type declarations. (objc_inherit_code, objc_public_flag): Remove. (typespec_nonreserved_nonattr): Call objc_get_protocol_qualified_type() instead of get_static_reference() and get_protocol_reference(). (stmt_nocomp): Call grokparm() on @catch parameter. (objcdef): Move semantic action to objc_finish_implementation(). (classdef): Move semantic action to objc_start_class_interface(), objc_continue_interface(), objc_finish_interface(), objc_start_class_implementation(), objc_continue_implementation(), objc_start_category_interface() and objc_start_category_implementation(). (protocoldef): Move semantic actions to objc_start_protocol() and objc_finish_interface(). (ivar_decl_list): Remove nonterminal. (visibility_spec): Move semantic actions to objc_set_visibility(). (ivar_decls): Remove assignment to $$. (ivar_decl): Rephrase in terms of component_decl; call objc_add_instance_variable(). (ivars, ivar_declarator): Remove nonterminals. (opt_semi): New nonterminal. (methodtype): Remove semantic actions. (methoddef): Move semantic actions to objc_set_method_type(), objc_start_method_definition() and objc_finish_method_definition(). (methodproto): Move semantic actions to objc_set_method_type() and objc_add_method_declaration(). (methoddecl): Use objc_typename instead of typename; move semantic actions to objc_build_method_signature(). (optarglist, myxdecls, mydecl, myparms, myparm): Remove nonterminals. (optparmlist): Express in terms of optparms and optellipsis. (optparms, optellipsis, objc_qual, objc_quals, objc_typename): New nonterminals. (keyworddecl): Use objc_typename instead of typename. (rid_to_yy): Mark RID_IN, RID_OUT, RID_INOUT, RID_BYCOPY, RID_BYREF and RID_ONEWAY as returning OBJC_TYPE_QUAL to yyparse(). [gcc/objc/ChangeLog] 2004-09-07 Ziemowit Laski <zlaski@apple.com> * Make-lang.in (objc/objc-parse.o): Depend on $(C_COMMON_H) instead of objc/objc-act.h. (objc/objc-act.o): Depend on $(HASHTAB_H). * objc-act.c: Include hashtab.h; in ObjC++ mode, include cp-tree.h and objcp-decl.h instead of c-tree.h. (build_module_descriptor, get_class_ivars, synth_id_with_class_suffix, error_with_ivar, gen_method_decl, gen_declaration, setup_string_decl, build_protocol_template): Adjust prototypes. (build_module_initializer_routine, start_class, continue_class, finish_class, start_method_def, objc_start_function, start_protocol, build_method_decl, objc_add_method, add_instance_variable, build_ivar_reference, is_ivar, is_private, get_super_receiver, build_selector_table_decl, objc_push_parm, objc_get_parm_info, gen_type_name, gen_type_name_0, start_var_decl, finish_var_decl, create_field_decl): New prototypes. (objc_expand_function_end, comp_method_with_proto, objc_expr_last, gen_declaration_1, gen_declarator, is_complex_decl, adorn_decl, define_decl, create_builtin_decl, gen_declspecs): Remove prototypes. (TYPE_ID): Rename to OBJECT_TYPEDEF_NAME. (CLASS_TYPEDEF_NAME): New. (TAG_EXECCLASS): Change from a global variable to a #define. (TAG_RETURN_STRUCT): Delete. (TAG_GNUINIT): New, holds '__objc_gnu_init' name. (objc_inherit_code, objc_public_flag): New, moved from c-parse.in. (string_descriptor): New struct. (string_htab): New hash table. (string_hash, string_eq): New prototypes. (generate_struct_by_value_array): Call create_field_decl() instead of create_builtin_decl(). (objc_init): Do not initialize objc_ellipsis_node or TAG_EXECCLASS; In ObjC++ mode, call cxx_init() instead of c_objc_common_init(). (objc_finish_file): In ObjC++, call instantiate_pending_templates() and cp_finish_file(). (define_decl, get_static_reference, get_protocol_reference, create_builtin_decl): Remove functions. (objc_start_class_interface, objc_start_category_interface, objc_start_protocol, objc_continue_interface, objc_finish_interface, objc_start_class_implementation, objc_start_category_implementation, objc_continue_implementation, objc_finish_implementation, objc_set_visibility, objc_set_method_type, objc_build_method_signature, objc_add_method_declaration, objc_start_method_definition, objc_add_instance_variable, objc_get_protocol_qualified_type, create_field_decl, start_var_decl, finish_var_decl): New functions. (setup_string_decl): Simplify since it is only called once. (synth_module_prologue): Call build_class_template(); predefine 'id' and 'Class' as typedefs; rename 'temp_type' to 'type'; disable debug hooks for duration of function; fix GNU runtime messenger signatures to correspond to reality; forward-declare '__objc_exec_class' for the GNU runtime; call build_selector_table_decl(); in ObjC++ mode, generate 'extern "C" { ... }' wrappers around synthesized declarations; call build_protocol_template() and build_category_template(). (string_hash, string_eq): New functions. (objc_build_string_object): Check metaclass correctness only once; store string literals in hash table. (objc_build_constructor): Do not convert initializer elements; adjust for ObjC++ impedance mismatch. (build_objc_symtab_template): Call create_field_decl() instead of create_builtin_decl(). (init_objc_symtab): Add missing conversion to initializer element. (build_metadata_decl): Call start_var_decl() instead of define_decl(). (generate_objc_symtab_decl): Do not call build_category_template(); call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(). (build_module_descriptor): Call create_field_decl() instead of grokfield(); call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(); always mark module descriptor as used; move GNU runtime-specific functionality to build_module_initializer_routine(). (build_module_initializer_routine): New function, broken off of build_module_descriptor(). (objc_static_init_needed_p, objc_generate_static_init_call): New functions. (generate_static_references, generate_strings, build_selector_translation_table, generate_descriptor_table, generate_ivars_list, generate_dispatch_table, generate_category): Call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(); build a type directly instead of via groktypename(). (build_selector_reference_decl, build_selector_table_decl, build_class_reference_decl, build_protocol_reference, generate_objc_image_info): Call start_var_decl() instead of build_decl(). (build_selector_reference): For GNU runtime, do not call build_selector_reference_decl(). (build_selector, build_typed_selector_reference): Always convert result to the selector type. (add_objc_string): Cast return value to 'char *'. (build_method_prototype_template, build_selector_template, build_method_template): Use actual selector type for fields pointing to selectors. (finish_objc): For GNU runtime, call build_module_initializer_routine() after build_module_descriptor(). (generate_protocol_list, generate_shared_structures): Call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(); build a type directly instead of via groktypename(). (synth_id_with_class_suffix): Return a string. (get_arg_type_list): For instance methods, use the instance type for 'self'; do not call groktypename_in_parm_context(). (build_objc_string_decl): Squash redeclaration errors in ObjC++. (objc_is_class_name): Use OBJC_TYPE_NAME instead of TYPE_NAME; handle RECORD_TYPEs in ObjC as well as ObjC++. (objc_is_id): New function. (objc_is_object_ptr): Return the canonical type node. (objc_get_class_ivars): Simplify using get_class_ivars(). (get_class_ivars): Remove second parameter; create a fresh copy of the ivar list for each call; do not check for existence of super class. (objc_eh_runtime_type): Mark #ifndef OBJCPLUS. (objc_init_exceptions): When using SJLJ-style exceptions, require the use of '-fobjc-exceptions' flag; do not require it for DWARF-style exceptions. (objc_build_exc_ptr, next_sjlj_build_try_catch_finally): Use objc_object_type instead of objc_id_type. (objc_begin_catch_clause): Convert the incoming PARM_DECL into a VAR_DECL before placing it in the appropriate scope; do not call define_decl(); adjust call to c_begin_compound_stmt(); use objc_object_type instead of objc_id_type. (build_next_objc_exception_stuff): Call create_field_decl() instead of create_builtin_decl(); construct type directly instead of calling groktypename(); use OBJC_VOID_AT_END to mark end of function parameters. (build_private_template): Adjust call to get_class_ivars(); build a type directly instead of via groktypename(). (build_protocol_template, build_method_prototype_list_template, build_method_prototype_template, build_category_template, build_selector_template, build_class_template, build_super_template, build_ivar_template, build_ivar_list_template, build_method_list_template, build_method_template): Call create_field_decl() instead of grokfield(). (objc_method_parm_type): Do not call groktypename(). (generate_descriptor_table): Call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(). (generate_method_descriptors, build_protocol_initializer, generate_dispatch_tables, build_category_initializer, build_shared_structure_initializer): Do not call groktypename(). (generate_protocols): Call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(); do not call groktypename(). (error_with_ivar): Remove last parameter. (check_ivars): Do not iterate ovar CLASS_RAW_IVARS lists in addition to CLASS_IVARS lists; adjust calls to error_with_ivar(). (generate_ivar_lists): Convert one of the initializer elements; do not call groktypename(). (get_arg_type_list, start_method_def, gen_method_def): Account for new representation of variable arguments and '...' in Objective-C methods; add Objective-C++ impedance matching code. (is_objc_type_qualifier): Remove function. (adjust_type_for_id_default): Simplify; there is no longer a need to wade through declspecs. (lookup_interface, start_class, continue_class, finish_class, start_method_def, start_protocol, build_method_decl, objc_add_method, add_instance_variable, build_ivar_reference, is_ivar, is_private, get_super_receiver, objc_build_finally_epilogue): Make into static functions. (receiver_is_class_object): Use new IS_CLASS() macro. (objc_build_message_expr): Tweak ObjC++ message argument handling; call objc_finish_message_expr() instead of finish_message_expr(). (finish_message_expr): Rename to objc_finish_message_expr(); use OBJC_TYPE_NAME and OBJC_SET_TYPE_NAME macros instead of TYPE_NAME. call gen_type_name() instead of gen_declaration(); call objc_is_id() instead of using IS_ID and IS_CLASS; Use objc_class_name instead of calling get_identifier("Class"); handle CONVERT_EXPRs in receiver. (build_objc_method_call, warn_with_method): Do not call groktypename(). (build_ivar_reference): Call convert() instead of clobbering in a type. (hash_init): Initialize string_htab hash table. (add_instance_variable): Simplify parameter list; do not call grokfield(); do not populate CLASS_IVARS list. (start_class): Check for the existence of super class, if one was specified. (continue_class): Use CLASS_RAW_IVARS rather than CLASS_IVARS; do not call build_class_template(); adjust call to get_class_ivars(); call build_decl(), pushdecl() and finish_decl() instead of define_decl(). (finish_class): Call build_decl(), pushdecl() and finish_decl() instead of define_decl(). (add_protocols): Use PROTOCOL_BINFO_ELTS for the tree vector size. (start_protocol): Do not call build_protocol_template(); use PROTOCOL_BINFO_ELTS for the tree vector size. (encode_type_qualifiers): Do not handle the 'const' qualifier here. (encode_pointer): Encode 'const char *' as 'r*', for backwards compatibility. (encode_array): Use HOST_WIDE_INT_PRINT_DEC instead of "%ld". (encode_type): Handle the 'const' qualifier here. (objc_parmlist): New global variable, sued by objc_push_parm and objc_get_parm_info(). (objc_push_parm, objc_get_parm_info): New functions. (objc_expr_last): Remove function. (synth_self_and_ucmd_args): For instance methods, use the instance type for 'self'; call objc_push_parm() instead of push_parm_decl(). (start_method_def): Do not call push_scope(), declare_parm_level(), pop_scope(), push_parm_decl(), store_parm_decls() or objc_expr_last(); just use objc_push_parm() and objc_get_parm_info(). (comp_method_with_proto): Remove function. (objc_types_are_equivalent): Strip away indirections before comparing underlying types. (comp_proto_with_proto): Do not call groktypename(); types are no longer in raw declspec format. (objc_start_function): New function. (really_start_method): Call comp_proto_with_proto() instead of comp_method_with_proto(); call objc_start_function() instead of hand-crafting a function declarator. (continue_method_def, objc_expand_function_end): Remove functions. (get_super_receiver): Call objc_get_current_scope() instead of get_current_scope(); reference 'super_class' field (instead of 'class'). (finish_method_def): Rename to objc_finish_method_definition() and add a function decl parameter; move method encoding call from objc_expand_function_end(). (is_complex_decl, adorn_decl, gen_declarator, gen_declspecs, gen_declaration_1): Remove functions. (tmpbuf, RAW_DECLSPEC): Remove. (gen_declaration): Remove second parameter; simplify to deal with TYPE_P nodes instead of raw declspecs. (gen_type_name, gen_type_name_0): New functions. (gen_method_decl): Remove second parameter; call gen_type_name() instead of gen_declaration_1(). (dump_interface): Adjust calls to gen_declaration() and gen_method_decl(); do not allocate a separate string buffer. (init_objc): Allocate a larger string buffer to accommodate dump_interface(); adjust call to build_module_descriptor(); add call to build_module_initializer_routine() for the GNU runtime. (generate_classref_translation_entry): Do not call start_decl(); call finish_var_decl() instead of finish_decl(); call convert() instead of build_c_cast(). * objc-act.h (CLASS_OWN_IVARS): Remove accessor. (CLASS_BINFO_ELTS): Reduce from 6 to 5, now that CLASS_OWN_IVARS is gone. (OCTI_GNU_INIT_DECL, GNU_INIT_decl): New. (OCTI_ELLIPSIS_NODE, objc_ellipsis_node): Remove. (OCTI_ID_ID, id_type, objc_id_id): Rename to OCTI_ID_NAME, objc_object_type and objc_object_name, respectively. (OCTI_CLS_REF, OCTI_CLASS_NAME, objc_class_reference, objc_class_name): New. (IS_CLASS): New macro. (IS_ID, IS_SUPER): Robustify. (OCTI_EXECCLASS_DECL, execclass_decl): New. (finish_file, start_class, continue_class, finish_class, start_method_def, continue_method_def, finish_method_def, start_protocol, finish_protocol, objc_build_throw_stmt, objc_build_try_catch_finally_stmt, objc_build_synchronized_prologue, objc_build_synchronized_epilogue, objc_build_try_prologue, objc_build_try_epilogue, objc_build_catch_stmt, objc_build_catch_epilogue, objc_build_finally_prologue, objc_build_finally_epilogue, is_ivar, is_private, is_public, add_instance_variable, objc_add_method, get_super_receiver, objc_clear_super_receiver, get_class_ivars_from_name, get_class_reference, get_static_reference, get_object_reference, build_message_expr, finish_message_expr, build_selector_expr, build_ivar_reference, build_keyword_decl, build_method_decl, build_protocol_expr, build_objc_string_object, objc_declare_alias, objc_declare_class, objc_declare_protocols, objc_comptypes, objc_check_decl, build_encode_expr): Remove prototypes. (imp_count, cat_count): Make GGC-aware. (OBJC_SET_TYPE_NAME): New macro. From-SVN: r87168
2004-09-08 02:49:44 +02:00
"exception syntax");
}
#ifndef OBJCPLUS
else
c-common.c (flag_objc_sjlj_exceptions): New. * c-common.c (flag_objc_sjlj_exceptions): New. * c-common.h (flag_objc_sjlj_exceptions): Declare. * c-opts.c (c_common_handle_option): Set it. (c_common_post_options): Handle interation of different objective-c exception and runtime switches. * c-decl.c (c_eh_initialized_p): New. (finish_decl): Use it instead of local eh_initialized_p. * c-parse.in (nested_function, notype_nested_function): Record the result of compstmt. (compstmt_or_error): Likewise. (compstmt): Don't add_stmt the result. (stmt): Don't return anything. Rewrite objc try and sync rules. (objc_try_stmt, objc_catch_list): Remove. (objc_catch_block, objc_finally_block): Remove. (objc_catch_prefix, objc_catch_clause, objc_opt_catch_list): New. (objc_try_catch_clause, objc_finally_clause): New. (objc_try_catch_stmt): Rewrite. * c-tree.h (c_eh_initialized_p): Declare. * c-opt (fobjc-sjlj-exceptions): New. * except.c (output_function_exception_table): Don't call cgraph on non-decls. * objc/objc-act.c (UTAG_EXCDATA_VAR, UTAG_CAUGHTEXC_VAR, UTAG_RETHROWEXC_VAR, UTAG_EVALONCE_VAR, struct val_stack, catch_count_stack, exc_binding_stack, if_nesting_count, blk_nesting_count, objc_enter_block, objc_exit_block, objc_declare_variable, 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): Remove. (objc_create_temporary_var, struct objc_try_context, cur_try_context, objc_eh_runtime_type, objc_init_exceptions, objc_build_exc_ptr, next_sjlj_build_try_exit, next_sjlj_build_enter_and_setjmp, next_sjlj_build_exc_extract, next_sjlj_build_catch_list, next_sjlj_build_try_catch_finally, objc_begin_try_stmt, objc_begin_catch_clause, objc_finish_catch_clause, objc_build_finally_clause, objc_finish_try_stmt, objc_build_synchronized): New. (objc_is_object_id, objc_is_class_id): New. (objc_comptypes): Use them. (build_next_objc_exception_stuff): Break NeXT sjlj out from build_objc_exception_stuff. (synth_module_prologue): Update to match. (objc_build_throw_stmt): Use cur_try_context to decide if we're in a @catch. * objc/objc-act.h: Update prototypes. (OCTI_EXCEPTION_BLK_STACK, objc_exception_block_stack): Remove. testsuite/ * objc.dg/sync-1.m: New. * objc.dg/try-catch-1.m: Don't force next runtime. * objc.dg/try-catch-3.m, objc.dg/try-catch-4.m: Likewise. * objc.dg/try-catch-2.m: Likewise. Enable everywhere. Remove shadowed catch clause. * objc.dg/try-catch-5.m: New. From-SVN: r83332
2004-06-18 03:20:53 +02:00
{
c_eh_initialized_p = true;
eh_personality_libfunc
= init_one_libfunc (USING_SJLJ_EXCEPTIONS
? "__gnu_objc_personality_sj0"
: "__gnu_objc_personality_v0");
Makefile.in: Set and use UNWIND_H. 2005-06-28 Paul Brook <paul@codesourcery.com> gcc/ * Makefile.in: Set and use UNWIND_H. Install as unwind.h. * c-decl.c (finish_decl): Call default_init_unwind_resume_libfunc. * except.c (add_ehspec_entry): Generate arm eabi filter lists. (assign_filter_values): Ditto. (output_ttype): New function. (output_function_exception_table): Use output_ttype. Generate arm eabi filter lists. (default_init_unwind_resume_libfunc): New function. * except.h (default_init_unwind_resume_libfunc): Add prototype. * optabs.c (init_optabs): Don't set unwind_resume_libfunc. * opts.c (decode_options): Use targetm.unwind_tables_default. * target-def.h (TARGET_ASM_TTYPE): Provide and use definition. (TARGET_ARM_EABI_UNWINDER, TARGET_UNWIND_TABLES_DEFAULT): Ditto. * target.h (struct gcc_target): Add asm.ttype, unwind_tables_default and arm_eabi_unwinder. * unwind-c.c: Support Arm EABI unwinder. * unwind.h: Rename ... * unwind-generic.h: ... To this. * doc/tm.texi (TARGET_ASM_TTYPE, TARGET_ARM_EABI_UNWINDER): Document. (TARGET_UNWID_TABLES_DEFAULT): Document. * config/arm/arm-protos.h (arm_output_fn_unwind): Add prototype. * config/arm/arm.c (arm_unwind_emit, arm_output_ttype): New functions. (TARGET_UNWIND_EMIT, TARGET_ASM_TTYPE, TARGET_ARM_EABI_UNWINDER): Define. (thumb_pushpop, thumb_output_function_prologue): Output unwinding directives. (arm_unwind_emit_stm, arm_unwind_emit_set): New functions. * config/arm/arm.h (MUST_USE_SJLJ_EXCEPTIONS): Only define when !TARGET_UNWIND_INFO. (ARM_OUTPUT_FN_UNWIND, ARM_EABI_UNWIND_TABLES): Define. * config/arm/bpabi.h (TARGET_UNWIND_INFO): Define. * config/arm/elf.h (ASM_DECLARE_FUNCTION_NAME, ASM_DECLARE_FUNCTION_SIZE): Use ARM_OUTPUT_FN_UNWIND. * config/arm/lib1funcs.asm: Include libunwind.S. * config/arm/libgcc-bpabi.ver: Add unwinding routines. * config/arm/libunwind.S: New file. * config/arm/pr-support.c: New file. * config/arm/t-bpabi (LIB1ASMFUNCS): Add _unwind. (UNWIND_H, LIB2ADDEH, LIB2ADDEHDEP): Set. * config/arm/t-symbian (UNWIND_H, LIB2ADDEH, LIB2ADDEHDEP): Set. * config/arm/unwind-arm.c: New file. * config/arm/unwind-arm.h: New file. * config/i386/t-netware (USER_H): Remove unwind.h. * config/ia64/ia64.h (TARGET_UNWIND_TABLES_DEFAULT): Define. gcc/cp/ * Make-lang.in (cp/except.o): Depend on $(TARGET_H) * except.c: Include target.h. (init_exception_processing): Initialize unwind_resume_libfunc. * doc/tm.texi: Document TARGET_ASM_TTYPE gcc/ada/ * misc.c (gnat_init_gcc_eh): Call default_init_unwind_resume_libfunc. gcc/java/ * decl.c (java_init_decl_processing): Call default_init_unwind_resume_libfunc. gcc/objc/ * objc-act.c (objc_init_exceptions): Call default_init_unwind_resume_libfunc. libstdc++/ * acinclude.m4 (GLIBCXX_ENABLE_SJLJ_EXCEPTIONS): Check for __cxa_end_cleanup. * libsupc++/Makefile.am (sources): Add eh_call.c and eh_arm.c. * libsupc++/eh_arm.cc: New file. * libsupc++/eh_call.cc: New file. * libsupc++/eh_catch.cc (__cxa_get_exception_ptr): Use __gxx_caught_object. (__cxa_begin_catch): Ditto. Use __is_gxx_exception_class. Call _Unwind_Complete when using the ARM EABI. (__cxa_end_catch): Use __is_gxx_exception_class. * libsupc++/eh_personality.cc: Define NO_SIZE_OF_ENCODED_VALUE when using the ARM EABI. (save_caught_exception, restore_caught_exception): New functions. (_throw_typet): New typedef. (get_ttype_entry, get_adjusted_ptr, check_exception_spec): Add ARM EABI implementations. (PERSONALITY_FUNCTION): Use new functions. Addd support for ARM EABI unwinding libary. (__cxa_unexpected): Disable when using the ARM EABI. * libsupc++/eh_throw.cc (__cxa_throw): Use __GXX_INIT_EXCEPTION_CLASS. (__cxa_rethrow): Use __is_gxx_exception_class. Call _Unwind_RaiseException when using the ARM EABI. * libsupc++/unwind-cxx.h (struct __cxa_exception): Add fields for ARM EABI semantics. (struct __cxa_eh_globals): Ditto. (__cxa_call_terminate): Add prototype. (__cxa_type_match, __cxa_begin_cleanup, __cxa_end_cleanup): Add prototypes. (__get_exception_header_from_obj, __get_exception_header_from_ue): Move earlier in file. (__is_gxx_exception_class, __GXX_INIT_EXCEPTION_CLASS, __gxx_caught_object): New functions. * aclocal.m4: Regenerate. * configure: Regenerate. * Makefile.in: Regenerate. * include/Makefile.in: Regenerate. * libmath/Makefile.in: Regenerate. * libsupc++/Makefile.in: Regenerate. * po/Makefile.in: Regenerate. * src/Makefie.in: Regenerate. * testsuite/makefile.in: Regenerate. From-SVN: r101385
2005-06-28 21:52:27 +02:00
default_init_unwind_resume_libfunc ();
c-common.c (flag_objc_sjlj_exceptions): New. * c-common.c (flag_objc_sjlj_exceptions): New. * c-common.h (flag_objc_sjlj_exceptions): Declare. * c-opts.c (c_common_handle_option): Set it. (c_common_post_options): Handle interation of different objective-c exception and runtime switches. * c-decl.c (c_eh_initialized_p): New. (finish_decl): Use it instead of local eh_initialized_p. * c-parse.in (nested_function, notype_nested_function): Record the result of compstmt. (compstmt_or_error): Likewise. (compstmt): Don't add_stmt the result. (stmt): Don't return anything. Rewrite objc try and sync rules. (objc_try_stmt, objc_catch_list): Remove. (objc_catch_block, objc_finally_block): Remove. (objc_catch_prefix, objc_catch_clause, objc_opt_catch_list): New. (objc_try_catch_clause, objc_finally_clause): New. (objc_try_catch_stmt): Rewrite. * c-tree.h (c_eh_initialized_p): Declare. * c-opt (fobjc-sjlj-exceptions): New. * except.c (output_function_exception_table): Don't call cgraph on non-decls. * objc/objc-act.c (UTAG_EXCDATA_VAR, UTAG_CAUGHTEXC_VAR, UTAG_RETHROWEXC_VAR, UTAG_EVALONCE_VAR, struct val_stack, catch_count_stack, exc_binding_stack, if_nesting_count, blk_nesting_count, objc_enter_block, objc_exit_block, objc_declare_variable, 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): Remove. (objc_create_temporary_var, struct objc_try_context, cur_try_context, objc_eh_runtime_type, objc_init_exceptions, objc_build_exc_ptr, next_sjlj_build_try_exit, next_sjlj_build_enter_and_setjmp, next_sjlj_build_exc_extract, next_sjlj_build_catch_list, next_sjlj_build_try_catch_finally, objc_begin_try_stmt, objc_begin_catch_clause, objc_finish_catch_clause, objc_build_finally_clause, objc_finish_try_stmt, objc_build_synchronized): New. (objc_is_object_id, objc_is_class_id): New. (objc_comptypes): Use them. (build_next_objc_exception_stuff): Break NeXT sjlj out from build_objc_exception_stuff. (synth_module_prologue): Update to match. (objc_build_throw_stmt): Use cur_try_context to decide if we're in a @catch. * objc/objc-act.h: Update prototypes. (OCTI_EXCEPTION_BLK_STACK, objc_exception_block_stack): Remove. testsuite/ * objc.dg/sync-1.m: New. * objc.dg/try-catch-1.m: Don't force next runtime. * objc.dg/try-catch-3.m, objc.dg/try-catch-4.m: Likewise. * objc.dg/try-catch-2.m: Likewise. Enable everywhere. Remove shadowed catch clause. * objc.dg/try-catch-5.m: New. From-SVN: r83332
2004-06-18 03:20:53 +02:00
using_eh_for_cleanups ();
lang_eh_runtime_type = objc_eh_runtime_type;
}
Makefile.in (c-parse.o): Depend on $(C_COMMON_H). [gcc/ChangeLog] 2004-09-07 Ziemowit Laski <zlaski@apple.com> * Makefile.in (c-parse.o): Depend on $(C_COMMON_H). * c-parse.in: Include c-common.h instead of objc-act.h. (ivar_decl_list, ivar_decls, ivar_decl, ivars, ivar_declarator, myparms, myparm): Remove %type declarations. (methodtype, optparms, OBJC_TYPE_QUAL, objc_quals, objc_qual, objc_typename, objc_try_catch_stmt, optellipsis): Add %type declarations. (objc_inherit_code, objc_public_flag): Remove. (typespec_nonreserved_nonattr): Call objc_get_protocol_qualified_type() instead of get_static_reference() and get_protocol_reference(). (stmt_nocomp): Call grokparm() on @catch parameter. (objcdef): Move semantic action to objc_finish_implementation(). (classdef): Move semantic action to objc_start_class_interface(), objc_continue_interface(), objc_finish_interface(), objc_start_class_implementation(), objc_continue_implementation(), objc_start_category_interface() and objc_start_category_implementation(). (protocoldef): Move semantic actions to objc_start_protocol() and objc_finish_interface(). (ivar_decl_list): Remove nonterminal. (visibility_spec): Move semantic actions to objc_set_visibility(). (ivar_decls): Remove assignment to $$. (ivar_decl): Rephrase in terms of component_decl; call objc_add_instance_variable(). (ivars, ivar_declarator): Remove nonterminals. (opt_semi): New nonterminal. (methodtype): Remove semantic actions. (methoddef): Move semantic actions to objc_set_method_type(), objc_start_method_definition() and objc_finish_method_definition(). (methodproto): Move semantic actions to objc_set_method_type() and objc_add_method_declaration(). (methoddecl): Use objc_typename instead of typename; move semantic actions to objc_build_method_signature(). (optarglist, myxdecls, mydecl, myparms, myparm): Remove nonterminals. (optparmlist): Express in terms of optparms and optellipsis. (optparms, optellipsis, objc_qual, objc_quals, objc_typename): New nonterminals. (keyworddecl): Use objc_typename instead of typename. (rid_to_yy): Mark RID_IN, RID_OUT, RID_INOUT, RID_BYCOPY, RID_BYREF and RID_ONEWAY as returning OBJC_TYPE_QUAL to yyparse(). [gcc/objc/ChangeLog] 2004-09-07 Ziemowit Laski <zlaski@apple.com> * Make-lang.in (objc/objc-parse.o): Depend on $(C_COMMON_H) instead of objc/objc-act.h. (objc/objc-act.o): Depend on $(HASHTAB_H). * objc-act.c: Include hashtab.h; in ObjC++ mode, include cp-tree.h and objcp-decl.h instead of c-tree.h. (build_module_descriptor, get_class_ivars, synth_id_with_class_suffix, error_with_ivar, gen_method_decl, gen_declaration, setup_string_decl, build_protocol_template): Adjust prototypes. (build_module_initializer_routine, start_class, continue_class, finish_class, start_method_def, objc_start_function, start_protocol, build_method_decl, objc_add_method, add_instance_variable, build_ivar_reference, is_ivar, is_private, get_super_receiver, build_selector_table_decl, objc_push_parm, objc_get_parm_info, gen_type_name, gen_type_name_0, start_var_decl, finish_var_decl, create_field_decl): New prototypes. (objc_expand_function_end, comp_method_with_proto, objc_expr_last, gen_declaration_1, gen_declarator, is_complex_decl, adorn_decl, define_decl, create_builtin_decl, gen_declspecs): Remove prototypes. (TYPE_ID): Rename to OBJECT_TYPEDEF_NAME. (CLASS_TYPEDEF_NAME): New. (TAG_EXECCLASS): Change from a global variable to a #define. (TAG_RETURN_STRUCT): Delete. (TAG_GNUINIT): New, holds '__objc_gnu_init' name. (objc_inherit_code, objc_public_flag): New, moved from c-parse.in. (string_descriptor): New struct. (string_htab): New hash table. (string_hash, string_eq): New prototypes. (generate_struct_by_value_array): Call create_field_decl() instead of create_builtin_decl(). (objc_init): Do not initialize objc_ellipsis_node or TAG_EXECCLASS; In ObjC++ mode, call cxx_init() instead of c_objc_common_init(). (objc_finish_file): In ObjC++, call instantiate_pending_templates() and cp_finish_file(). (define_decl, get_static_reference, get_protocol_reference, create_builtin_decl): Remove functions. (objc_start_class_interface, objc_start_category_interface, objc_start_protocol, objc_continue_interface, objc_finish_interface, objc_start_class_implementation, objc_start_category_implementation, objc_continue_implementation, objc_finish_implementation, objc_set_visibility, objc_set_method_type, objc_build_method_signature, objc_add_method_declaration, objc_start_method_definition, objc_add_instance_variable, objc_get_protocol_qualified_type, create_field_decl, start_var_decl, finish_var_decl): New functions. (setup_string_decl): Simplify since it is only called once. (synth_module_prologue): Call build_class_template(); predefine 'id' and 'Class' as typedefs; rename 'temp_type' to 'type'; disable debug hooks for duration of function; fix GNU runtime messenger signatures to correspond to reality; forward-declare '__objc_exec_class' for the GNU runtime; call build_selector_table_decl(); in ObjC++ mode, generate 'extern "C" { ... }' wrappers around synthesized declarations; call build_protocol_template() and build_category_template(). (string_hash, string_eq): New functions. (objc_build_string_object): Check metaclass correctness only once; store string literals in hash table. (objc_build_constructor): Do not convert initializer elements; adjust for ObjC++ impedance mismatch. (build_objc_symtab_template): Call create_field_decl() instead of create_builtin_decl(). (init_objc_symtab): Add missing conversion to initializer element. (build_metadata_decl): Call start_var_decl() instead of define_decl(). (generate_objc_symtab_decl): Do not call build_category_template(); call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(). (build_module_descriptor): Call create_field_decl() instead of grokfield(); call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(); always mark module descriptor as used; move GNU runtime-specific functionality to build_module_initializer_routine(). (build_module_initializer_routine): New function, broken off of build_module_descriptor(). (objc_static_init_needed_p, objc_generate_static_init_call): New functions. (generate_static_references, generate_strings, build_selector_translation_table, generate_descriptor_table, generate_ivars_list, generate_dispatch_table, generate_category): Call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(); build a type directly instead of via groktypename(). (build_selector_reference_decl, build_selector_table_decl, build_class_reference_decl, build_protocol_reference, generate_objc_image_info): Call start_var_decl() instead of build_decl(). (build_selector_reference): For GNU runtime, do not call build_selector_reference_decl(). (build_selector, build_typed_selector_reference): Always convert result to the selector type. (add_objc_string): Cast return value to 'char *'. (build_method_prototype_template, build_selector_template, build_method_template): Use actual selector type for fields pointing to selectors. (finish_objc): For GNU runtime, call build_module_initializer_routine() after build_module_descriptor(). (generate_protocol_list, generate_shared_structures): Call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(); build a type directly instead of via groktypename(). (synth_id_with_class_suffix): Return a string. (get_arg_type_list): For instance methods, use the instance type for 'self'; do not call groktypename_in_parm_context(). (build_objc_string_decl): Squash redeclaration errors in ObjC++. (objc_is_class_name): Use OBJC_TYPE_NAME instead of TYPE_NAME; handle RECORD_TYPEs in ObjC as well as ObjC++. (objc_is_id): New function. (objc_is_object_ptr): Return the canonical type node. (objc_get_class_ivars): Simplify using get_class_ivars(). (get_class_ivars): Remove second parameter; create a fresh copy of the ivar list for each call; do not check for existence of super class. (objc_eh_runtime_type): Mark #ifndef OBJCPLUS. (objc_init_exceptions): When using SJLJ-style exceptions, require the use of '-fobjc-exceptions' flag; do not require it for DWARF-style exceptions. (objc_build_exc_ptr, next_sjlj_build_try_catch_finally): Use objc_object_type instead of objc_id_type. (objc_begin_catch_clause): Convert the incoming PARM_DECL into a VAR_DECL before placing it in the appropriate scope; do not call define_decl(); adjust call to c_begin_compound_stmt(); use objc_object_type instead of objc_id_type. (build_next_objc_exception_stuff): Call create_field_decl() instead of create_builtin_decl(); construct type directly instead of calling groktypename(); use OBJC_VOID_AT_END to mark end of function parameters. (build_private_template): Adjust call to get_class_ivars(); build a type directly instead of via groktypename(). (build_protocol_template, build_method_prototype_list_template, build_method_prototype_template, build_category_template, build_selector_template, build_class_template, build_super_template, build_ivar_template, build_ivar_list_template, build_method_list_template, build_method_template): Call create_field_decl() instead of grokfield(). (objc_method_parm_type): Do not call groktypename(). (generate_descriptor_table): Call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(). (generate_method_descriptors, build_protocol_initializer, generate_dispatch_tables, build_category_initializer, build_shared_structure_initializer): Do not call groktypename(). (generate_protocols): Call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(); do not call groktypename(). (error_with_ivar): Remove last parameter. (check_ivars): Do not iterate ovar CLASS_RAW_IVARS lists in addition to CLASS_IVARS lists; adjust calls to error_with_ivar(). (generate_ivar_lists): Convert one of the initializer elements; do not call groktypename(). (get_arg_type_list, start_method_def, gen_method_def): Account for new representation of variable arguments and '...' in Objective-C methods; add Objective-C++ impedance matching code. (is_objc_type_qualifier): Remove function. (adjust_type_for_id_default): Simplify; there is no longer a need to wade through declspecs. (lookup_interface, start_class, continue_class, finish_class, start_method_def, start_protocol, build_method_decl, objc_add_method, add_instance_variable, build_ivar_reference, is_ivar, is_private, get_super_receiver, objc_build_finally_epilogue): Make into static functions. (receiver_is_class_object): Use new IS_CLASS() macro. (objc_build_message_expr): Tweak ObjC++ message argument handling; call objc_finish_message_expr() instead of finish_message_expr(). (finish_message_expr): Rename to objc_finish_message_expr(); use OBJC_TYPE_NAME and OBJC_SET_TYPE_NAME macros instead of TYPE_NAME. call gen_type_name() instead of gen_declaration(); call objc_is_id() instead of using IS_ID and IS_CLASS; Use objc_class_name instead of calling get_identifier("Class"); handle CONVERT_EXPRs in receiver. (build_objc_method_call, warn_with_method): Do not call groktypename(). (build_ivar_reference): Call convert() instead of clobbering in a type. (hash_init): Initialize string_htab hash table. (add_instance_variable): Simplify parameter list; do not call grokfield(); do not populate CLASS_IVARS list. (start_class): Check for the existence of super class, if one was specified. (continue_class): Use CLASS_RAW_IVARS rather than CLASS_IVARS; do not call build_class_template(); adjust call to get_class_ivars(); call build_decl(), pushdecl() and finish_decl() instead of define_decl(). (finish_class): Call build_decl(), pushdecl() and finish_decl() instead of define_decl(). (add_protocols): Use PROTOCOL_BINFO_ELTS for the tree vector size. (start_protocol): Do not call build_protocol_template(); use PROTOCOL_BINFO_ELTS for the tree vector size. (encode_type_qualifiers): Do not handle the 'const' qualifier here. (encode_pointer): Encode 'const char *' as 'r*', for backwards compatibility. (encode_array): Use HOST_WIDE_INT_PRINT_DEC instead of "%ld". (encode_type): Handle the 'const' qualifier here. (objc_parmlist): New global variable, sued by objc_push_parm and objc_get_parm_info(). (objc_push_parm, objc_get_parm_info): New functions. (objc_expr_last): Remove function. (synth_self_and_ucmd_args): For instance methods, use the instance type for 'self'; call objc_push_parm() instead of push_parm_decl(). (start_method_def): Do not call push_scope(), declare_parm_level(), pop_scope(), push_parm_decl(), store_parm_decls() or objc_expr_last(); just use objc_push_parm() and objc_get_parm_info(). (comp_method_with_proto): Remove function. (objc_types_are_equivalent): Strip away indirections before comparing underlying types. (comp_proto_with_proto): Do not call groktypename(); types are no longer in raw declspec format. (objc_start_function): New function. (really_start_method): Call comp_proto_with_proto() instead of comp_method_with_proto(); call objc_start_function() instead of hand-crafting a function declarator. (continue_method_def, objc_expand_function_end): Remove functions. (get_super_receiver): Call objc_get_current_scope() instead of get_current_scope(); reference 'super_class' field (instead of 'class'). (finish_method_def): Rename to objc_finish_method_definition() and add a function decl parameter; move method encoding call from objc_expand_function_end(). (is_complex_decl, adorn_decl, gen_declarator, gen_declspecs, gen_declaration_1): Remove functions. (tmpbuf, RAW_DECLSPEC): Remove. (gen_declaration): Remove second parameter; simplify to deal with TYPE_P nodes instead of raw declspecs. (gen_type_name, gen_type_name_0): New functions. (gen_method_decl): Remove second parameter; call gen_type_name() instead of gen_declaration_1(). (dump_interface): Adjust calls to gen_declaration() and gen_method_decl(); do not allocate a separate string buffer. (init_objc): Allocate a larger string buffer to accommodate dump_interface(); adjust call to build_module_descriptor(); add call to build_module_initializer_routine() for the GNU runtime. (generate_classref_translation_entry): Do not call start_decl(); call finish_var_decl() instead of finish_decl(); call convert() instead of build_c_cast(). * objc-act.h (CLASS_OWN_IVARS): Remove accessor. (CLASS_BINFO_ELTS): Reduce from 6 to 5, now that CLASS_OWN_IVARS is gone. (OCTI_GNU_INIT_DECL, GNU_INIT_decl): New. (OCTI_ELLIPSIS_NODE, objc_ellipsis_node): Remove. (OCTI_ID_ID, id_type, objc_id_id): Rename to OCTI_ID_NAME, objc_object_type and objc_object_name, respectively. (OCTI_CLS_REF, OCTI_CLASS_NAME, objc_class_reference, objc_class_name): New. (IS_CLASS): New macro. (IS_ID, IS_SUPER): Robustify. (OCTI_EXECCLASS_DECL, execclass_decl): New. (finish_file, start_class, continue_class, finish_class, start_method_def, continue_method_def, finish_method_def, start_protocol, finish_protocol, objc_build_throw_stmt, objc_build_try_catch_finally_stmt, objc_build_synchronized_prologue, objc_build_synchronized_epilogue, objc_build_try_prologue, objc_build_try_epilogue, objc_build_catch_stmt, objc_build_catch_epilogue, objc_build_finally_prologue, objc_build_finally_epilogue, is_ivar, is_private, is_public, add_instance_variable, objc_add_method, get_super_receiver, objc_clear_super_receiver, get_class_ivars_from_name, get_class_reference, get_static_reference, get_object_reference, build_message_expr, finish_message_expr, build_selector_expr, build_ivar_reference, build_keyword_decl, build_method_decl, build_protocol_expr, build_objc_string_object, objc_declare_alias, objc_declare_class, objc_declare_protocols, objc_comptypes, objc_check_decl, build_encode_expr): Remove prototypes. (imp_count, cat_count): Make GGC-aware. (OBJC_SET_TYPE_NAME): New macro. From-SVN: r87168
2004-09-08 02:49:44 +02:00
#endif
}
c-common.c (flag_objc_sjlj_exceptions): New. * c-common.c (flag_objc_sjlj_exceptions): New. * c-common.h (flag_objc_sjlj_exceptions): Declare. * c-opts.c (c_common_handle_option): Set it. (c_common_post_options): Handle interation of different objective-c exception and runtime switches. * c-decl.c (c_eh_initialized_p): New. (finish_decl): Use it instead of local eh_initialized_p. * c-parse.in (nested_function, notype_nested_function): Record the result of compstmt. (compstmt_or_error): Likewise. (compstmt): Don't add_stmt the result. (stmt): Don't return anything. Rewrite objc try and sync rules. (objc_try_stmt, objc_catch_list): Remove. (objc_catch_block, objc_finally_block): Remove. (objc_catch_prefix, objc_catch_clause, objc_opt_catch_list): New. (objc_try_catch_clause, objc_finally_clause): New. (objc_try_catch_stmt): Rewrite. * c-tree.h (c_eh_initialized_p): Declare. * c-opt (fobjc-sjlj-exceptions): New. * except.c (output_function_exception_table): Don't call cgraph on non-decls. * objc/objc-act.c (UTAG_EXCDATA_VAR, UTAG_CAUGHTEXC_VAR, UTAG_RETHROWEXC_VAR, UTAG_EVALONCE_VAR, struct val_stack, catch_count_stack, exc_binding_stack, if_nesting_count, blk_nesting_count, objc_enter_block, objc_exit_block, objc_declare_variable, 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): Remove. (objc_create_temporary_var, struct objc_try_context, cur_try_context, objc_eh_runtime_type, objc_init_exceptions, objc_build_exc_ptr, next_sjlj_build_try_exit, next_sjlj_build_enter_and_setjmp, next_sjlj_build_exc_extract, next_sjlj_build_catch_list, next_sjlj_build_try_catch_finally, objc_begin_try_stmt, objc_begin_catch_clause, objc_finish_catch_clause, objc_build_finally_clause, objc_finish_try_stmt, objc_build_synchronized): New. (objc_is_object_id, objc_is_class_id): New. (objc_comptypes): Use them. (build_next_objc_exception_stuff): Break NeXT sjlj out from build_objc_exception_stuff. (synth_module_prologue): Update to match. (objc_build_throw_stmt): Use cur_try_context to decide if we're in a @catch. * objc/objc-act.h: Update prototypes. (OCTI_EXCEPTION_BLK_STACK, objc_exception_block_stack): Remove. testsuite/ * objc.dg/sync-1.m: New. * objc.dg/try-catch-1.m: Don't force next runtime. * objc.dg/try-catch-3.m, objc.dg/try-catch-4.m: Likewise. * objc.dg/try-catch-2.m: Likewise. Enable everywhere. Remove shadowed catch clause. * objc.dg/try-catch-5.m: New. From-SVN: r83332
2004-06-18 03:20:53 +02:00
/* Build an EXC_PTR_EXPR, or the moral equivalent. In the case of Darwin,
we'll arrange for it to be initialized (and associated with a binding)
later. */
static tree
objc_build_exc_ptr (void)
{
c-common.c (flag_objc_sjlj_exceptions): New. * c-common.c (flag_objc_sjlj_exceptions): New. * c-common.h (flag_objc_sjlj_exceptions): Declare. * c-opts.c (c_common_handle_option): Set it. (c_common_post_options): Handle interation of different objective-c exception and runtime switches. * c-decl.c (c_eh_initialized_p): New. (finish_decl): Use it instead of local eh_initialized_p. * c-parse.in (nested_function, notype_nested_function): Record the result of compstmt. (compstmt_or_error): Likewise. (compstmt): Don't add_stmt the result. (stmt): Don't return anything. Rewrite objc try and sync rules. (objc_try_stmt, objc_catch_list): Remove. (objc_catch_block, objc_finally_block): Remove. (objc_catch_prefix, objc_catch_clause, objc_opt_catch_list): New. (objc_try_catch_clause, objc_finally_clause): New. (objc_try_catch_stmt): Rewrite. * c-tree.h (c_eh_initialized_p): Declare. * c-opt (fobjc-sjlj-exceptions): New. * except.c (output_function_exception_table): Don't call cgraph on non-decls. * objc/objc-act.c (UTAG_EXCDATA_VAR, UTAG_CAUGHTEXC_VAR, UTAG_RETHROWEXC_VAR, UTAG_EVALONCE_VAR, struct val_stack, catch_count_stack, exc_binding_stack, if_nesting_count, blk_nesting_count, objc_enter_block, objc_exit_block, objc_declare_variable, 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): Remove. (objc_create_temporary_var, struct objc_try_context, cur_try_context, objc_eh_runtime_type, objc_init_exceptions, objc_build_exc_ptr, next_sjlj_build_try_exit, next_sjlj_build_enter_and_setjmp, next_sjlj_build_exc_extract, next_sjlj_build_catch_list, next_sjlj_build_try_catch_finally, objc_begin_try_stmt, objc_begin_catch_clause, objc_finish_catch_clause, objc_build_finally_clause, objc_finish_try_stmt, objc_build_synchronized): New. (objc_is_object_id, objc_is_class_id): New. (objc_comptypes): Use them. (build_next_objc_exception_stuff): Break NeXT sjlj out from build_objc_exception_stuff. (synth_module_prologue): Update to match. (objc_build_throw_stmt): Use cur_try_context to decide if we're in a @catch. * objc/objc-act.h: Update prototypes. (OCTI_EXCEPTION_BLK_STACK, objc_exception_block_stack): Remove. testsuite/ * objc.dg/sync-1.m: New. * objc.dg/try-catch-1.m: Don't force next runtime. * objc.dg/try-catch-3.m, objc.dg/try-catch-4.m: Likewise. * objc.dg/try-catch-2.m: Likewise. Enable everywhere. Remove shadowed catch clause. * objc.dg/try-catch-5.m: New. From-SVN: r83332
2004-06-18 03:20:53 +02:00
if (flag_objc_sjlj_exceptions)
{
tree var = cur_try_context->caught_decl;
if (!var)
{
Makefile.in (c-parse.o): Depend on $(C_COMMON_H). [gcc/ChangeLog] 2004-09-07 Ziemowit Laski <zlaski@apple.com> * Makefile.in (c-parse.o): Depend on $(C_COMMON_H). * c-parse.in: Include c-common.h instead of objc-act.h. (ivar_decl_list, ivar_decls, ivar_decl, ivars, ivar_declarator, myparms, myparm): Remove %type declarations. (methodtype, optparms, OBJC_TYPE_QUAL, objc_quals, objc_qual, objc_typename, objc_try_catch_stmt, optellipsis): Add %type declarations. (objc_inherit_code, objc_public_flag): Remove. (typespec_nonreserved_nonattr): Call objc_get_protocol_qualified_type() instead of get_static_reference() and get_protocol_reference(). (stmt_nocomp): Call grokparm() on @catch parameter. (objcdef): Move semantic action to objc_finish_implementation(). (classdef): Move semantic action to objc_start_class_interface(), objc_continue_interface(), objc_finish_interface(), objc_start_class_implementation(), objc_continue_implementation(), objc_start_category_interface() and objc_start_category_implementation(). (protocoldef): Move semantic actions to objc_start_protocol() and objc_finish_interface(). (ivar_decl_list): Remove nonterminal. (visibility_spec): Move semantic actions to objc_set_visibility(). (ivar_decls): Remove assignment to $$. (ivar_decl): Rephrase in terms of component_decl; call objc_add_instance_variable(). (ivars, ivar_declarator): Remove nonterminals. (opt_semi): New nonterminal. (methodtype): Remove semantic actions. (methoddef): Move semantic actions to objc_set_method_type(), objc_start_method_definition() and objc_finish_method_definition(). (methodproto): Move semantic actions to objc_set_method_type() and objc_add_method_declaration(). (methoddecl): Use objc_typename instead of typename; move semantic actions to objc_build_method_signature(). (optarglist, myxdecls, mydecl, myparms, myparm): Remove nonterminals. (optparmlist): Express in terms of optparms and optellipsis. (optparms, optellipsis, objc_qual, objc_quals, objc_typename): New nonterminals. (keyworddecl): Use objc_typename instead of typename. (rid_to_yy): Mark RID_IN, RID_OUT, RID_INOUT, RID_BYCOPY, RID_BYREF and RID_ONEWAY as returning OBJC_TYPE_QUAL to yyparse(). [gcc/objc/ChangeLog] 2004-09-07 Ziemowit Laski <zlaski@apple.com> * Make-lang.in (objc/objc-parse.o): Depend on $(C_COMMON_H) instead of objc/objc-act.h. (objc/objc-act.o): Depend on $(HASHTAB_H). * objc-act.c: Include hashtab.h; in ObjC++ mode, include cp-tree.h and objcp-decl.h instead of c-tree.h. (build_module_descriptor, get_class_ivars, synth_id_with_class_suffix, error_with_ivar, gen_method_decl, gen_declaration, setup_string_decl, build_protocol_template): Adjust prototypes. (build_module_initializer_routine, start_class, continue_class, finish_class, start_method_def, objc_start_function, start_protocol, build_method_decl, objc_add_method, add_instance_variable, build_ivar_reference, is_ivar, is_private, get_super_receiver, build_selector_table_decl, objc_push_parm, objc_get_parm_info, gen_type_name, gen_type_name_0, start_var_decl, finish_var_decl, create_field_decl): New prototypes. (objc_expand_function_end, comp_method_with_proto, objc_expr_last, gen_declaration_1, gen_declarator, is_complex_decl, adorn_decl, define_decl, create_builtin_decl, gen_declspecs): Remove prototypes. (TYPE_ID): Rename to OBJECT_TYPEDEF_NAME. (CLASS_TYPEDEF_NAME): New. (TAG_EXECCLASS): Change from a global variable to a #define. (TAG_RETURN_STRUCT): Delete. (TAG_GNUINIT): New, holds '__objc_gnu_init' name. (objc_inherit_code, objc_public_flag): New, moved from c-parse.in. (string_descriptor): New struct. (string_htab): New hash table. (string_hash, string_eq): New prototypes. (generate_struct_by_value_array): Call create_field_decl() instead of create_builtin_decl(). (objc_init): Do not initialize objc_ellipsis_node or TAG_EXECCLASS; In ObjC++ mode, call cxx_init() instead of c_objc_common_init(). (objc_finish_file): In ObjC++, call instantiate_pending_templates() and cp_finish_file(). (define_decl, get_static_reference, get_protocol_reference, create_builtin_decl): Remove functions. (objc_start_class_interface, objc_start_category_interface, objc_start_protocol, objc_continue_interface, objc_finish_interface, objc_start_class_implementation, objc_start_category_implementation, objc_continue_implementation, objc_finish_implementation, objc_set_visibility, objc_set_method_type, objc_build_method_signature, objc_add_method_declaration, objc_start_method_definition, objc_add_instance_variable, objc_get_protocol_qualified_type, create_field_decl, start_var_decl, finish_var_decl): New functions. (setup_string_decl): Simplify since it is only called once. (synth_module_prologue): Call build_class_template(); predefine 'id' and 'Class' as typedefs; rename 'temp_type' to 'type'; disable debug hooks for duration of function; fix GNU runtime messenger signatures to correspond to reality; forward-declare '__objc_exec_class' for the GNU runtime; call build_selector_table_decl(); in ObjC++ mode, generate 'extern "C" { ... }' wrappers around synthesized declarations; call build_protocol_template() and build_category_template(). (string_hash, string_eq): New functions. (objc_build_string_object): Check metaclass correctness only once; store string literals in hash table. (objc_build_constructor): Do not convert initializer elements; adjust for ObjC++ impedance mismatch. (build_objc_symtab_template): Call create_field_decl() instead of create_builtin_decl(). (init_objc_symtab): Add missing conversion to initializer element. (build_metadata_decl): Call start_var_decl() instead of define_decl(). (generate_objc_symtab_decl): Do not call build_category_template(); call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(). (build_module_descriptor): Call create_field_decl() instead of grokfield(); call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(); always mark module descriptor as used; move GNU runtime-specific functionality to build_module_initializer_routine(). (build_module_initializer_routine): New function, broken off of build_module_descriptor(). (objc_static_init_needed_p, objc_generate_static_init_call): New functions. (generate_static_references, generate_strings, build_selector_translation_table, generate_descriptor_table, generate_ivars_list, generate_dispatch_table, generate_category): Call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(); build a type directly instead of via groktypename(). (build_selector_reference_decl, build_selector_table_decl, build_class_reference_decl, build_protocol_reference, generate_objc_image_info): Call start_var_decl() instead of build_decl(). (build_selector_reference): For GNU runtime, do not call build_selector_reference_decl(). (build_selector, build_typed_selector_reference): Always convert result to the selector type. (add_objc_string): Cast return value to 'char *'. (build_method_prototype_template, build_selector_template, build_method_template): Use actual selector type for fields pointing to selectors. (finish_objc): For GNU runtime, call build_module_initializer_routine() after build_module_descriptor(). (generate_protocol_list, generate_shared_structures): Call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(); build a type directly instead of via groktypename(). (synth_id_with_class_suffix): Return a string. (get_arg_type_list): For instance methods, use the instance type for 'self'; do not call groktypename_in_parm_context(). (build_objc_string_decl): Squash redeclaration errors in ObjC++. (objc_is_class_name): Use OBJC_TYPE_NAME instead of TYPE_NAME; handle RECORD_TYPEs in ObjC as well as ObjC++. (objc_is_id): New function. (objc_is_object_ptr): Return the canonical type node. (objc_get_class_ivars): Simplify using get_class_ivars(). (get_class_ivars): Remove second parameter; create a fresh copy of the ivar list for each call; do not check for existence of super class. (objc_eh_runtime_type): Mark #ifndef OBJCPLUS. (objc_init_exceptions): When using SJLJ-style exceptions, require the use of '-fobjc-exceptions' flag; do not require it for DWARF-style exceptions. (objc_build_exc_ptr, next_sjlj_build_try_catch_finally): Use objc_object_type instead of objc_id_type. (objc_begin_catch_clause): Convert the incoming PARM_DECL into a VAR_DECL before placing it in the appropriate scope; do not call define_decl(); adjust call to c_begin_compound_stmt(); use objc_object_type instead of objc_id_type. (build_next_objc_exception_stuff): Call create_field_decl() instead of create_builtin_decl(); construct type directly instead of calling groktypename(); use OBJC_VOID_AT_END to mark end of function parameters. (build_private_template): Adjust call to get_class_ivars(); build a type directly instead of via groktypename(). (build_protocol_template, build_method_prototype_list_template, build_method_prototype_template, build_category_template, build_selector_template, build_class_template, build_super_template, build_ivar_template, build_ivar_list_template, build_method_list_template, build_method_template): Call create_field_decl() instead of grokfield(). (objc_method_parm_type): Do not call groktypename(). (generate_descriptor_table): Call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(). (generate_method_descriptors, build_protocol_initializer, generate_dispatch_tables, build_category_initializer, build_shared_structure_initializer): Do not call groktypename(). (generate_protocols): Call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(); do not call groktypename(). (error_with_ivar): Remove last parameter. (check_ivars): Do not iterate ovar CLASS_RAW_IVARS lists in addition to CLASS_IVARS lists; adjust calls to error_with_ivar(). (generate_ivar_lists): Convert one of the initializer elements; do not call groktypename(). (get_arg_type_list, start_method_def, gen_method_def): Account for new representation of variable arguments and '...' in Objective-C methods; add Objective-C++ impedance matching code. (is_objc_type_qualifier): Remove function. (adjust_type_for_id_default): Simplify; there is no longer a need to wade through declspecs. (lookup_interface, start_class, continue_class, finish_class, start_method_def, start_protocol, build_method_decl, objc_add_method, add_instance_variable, build_ivar_reference, is_ivar, is_private, get_super_receiver, objc_build_finally_epilogue): Make into static functions. (receiver_is_class_object): Use new IS_CLASS() macro. (objc_build_message_expr): Tweak ObjC++ message argument handling; call objc_finish_message_expr() instead of finish_message_expr(). (finish_message_expr): Rename to objc_finish_message_expr(); use OBJC_TYPE_NAME and OBJC_SET_TYPE_NAME macros instead of TYPE_NAME. call gen_type_name() instead of gen_declaration(); call objc_is_id() instead of using IS_ID and IS_CLASS; Use objc_class_name instead of calling get_identifier("Class"); handle CONVERT_EXPRs in receiver. (build_objc_method_call, warn_with_method): Do not call groktypename(). (build_ivar_reference): Call convert() instead of clobbering in a type. (hash_init): Initialize string_htab hash table. (add_instance_variable): Simplify parameter list; do not call grokfield(); do not populate CLASS_IVARS list. (start_class): Check for the existence of super class, if one was specified. (continue_class): Use CLASS_RAW_IVARS rather than CLASS_IVARS; do not call build_class_template(); adjust call to get_class_ivars(); call build_decl(), pushdecl() and finish_decl() instead of define_decl(). (finish_class): Call build_decl(), pushdecl() and finish_decl() instead of define_decl(). (add_protocols): Use PROTOCOL_BINFO_ELTS for the tree vector size. (start_protocol): Do not call build_protocol_template(); use PROTOCOL_BINFO_ELTS for the tree vector size. (encode_type_qualifiers): Do not handle the 'const' qualifier here. (encode_pointer): Encode 'const char *' as 'r*', for backwards compatibility. (encode_array): Use HOST_WIDE_INT_PRINT_DEC instead of "%ld". (encode_type): Handle the 'const' qualifier here. (objc_parmlist): New global variable, sued by objc_push_parm and objc_get_parm_info(). (objc_push_parm, objc_get_parm_info): New functions. (objc_expr_last): Remove function. (synth_self_and_ucmd_args): For instance methods, use the instance type for 'self'; call objc_push_parm() instead of push_parm_decl(). (start_method_def): Do not call push_scope(), declare_parm_level(), pop_scope(), push_parm_decl(), store_parm_decls() or objc_expr_last(); just use objc_push_parm() and objc_get_parm_info(). (comp_method_with_proto): Remove function. (objc_types_are_equivalent): Strip away indirections before comparing underlying types. (comp_proto_with_proto): Do not call groktypename(); types are no longer in raw declspec format. (objc_start_function): New function. (really_start_method): Call comp_proto_with_proto() instead of comp_method_with_proto(); call objc_start_function() instead of hand-crafting a function declarator. (continue_method_def, objc_expand_function_end): Remove functions. (get_super_receiver): Call objc_get_current_scope() instead of get_current_scope(); reference 'super_class' field (instead of 'class'). (finish_method_def): Rename to objc_finish_method_definition() and add a function decl parameter; move method encoding call from objc_expand_function_end(). (is_complex_decl, adorn_decl, gen_declarator, gen_declspecs, gen_declaration_1): Remove functions. (tmpbuf, RAW_DECLSPEC): Remove. (gen_declaration): Remove second parameter; simplify to deal with TYPE_P nodes instead of raw declspecs. (gen_type_name, gen_type_name_0): New functions. (gen_method_decl): Remove second parameter; call gen_type_name() instead of gen_declaration_1(). (dump_interface): Adjust calls to gen_declaration() and gen_method_decl(); do not allocate a separate string buffer. (init_objc): Allocate a larger string buffer to accommodate dump_interface(); adjust call to build_module_descriptor(); add call to build_module_initializer_routine() for the GNU runtime. (generate_classref_translation_entry): Do not call start_decl(); call finish_var_decl() instead of finish_decl(); call convert() instead of build_c_cast(). * objc-act.h (CLASS_OWN_IVARS): Remove accessor. (CLASS_BINFO_ELTS): Reduce from 6 to 5, now that CLASS_OWN_IVARS is gone. (OCTI_GNU_INIT_DECL, GNU_INIT_decl): New. (OCTI_ELLIPSIS_NODE, objc_ellipsis_node): Remove. (OCTI_ID_ID, id_type, objc_id_id): Rename to OCTI_ID_NAME, objc_object_type and objc_object_name, respectively. (OCTI_CLS_REF, OCTI_CLASS_NAME, objc_class_reference, objc_class_name): New. (IS_CLASS): New macro. (IS_ID, IS_SUPER): Robustify. (OCTI_EXECCLASS_DECL, execclass_decl): New. (finish_file, start_class, continue_class, finish_class, start_method_def, continue_method_def, finish_method_def, start_protocol, finish_protocol, objc_build_throw_stmt, objc_build_try_catch_finally_stmt, objc_build_synchronized_prologue, objc_build_synchronized_epilogue, objc_build_try_prologue, objc_build_try_epilogue, objc_build_catch_stmt, objc_build_catch_epilogue, objc_build_finally_prologue, objc_build_finally_epilogue, is_ivar, is_private, is_public, add_instance_variable, objc_add_method, get_super_receiver, objc_clear_super_receiver, get_class_ivars_from_name, get_class_reference, get_static_reference, get_object_reference, build_message_expr, finish_message_expr, build_selector_expr, build_ivar_reference, build_keyword_decl, build_method_decl, build_protocol_expr, build_objc_string_object, objc_declare_alias, objc_declare_class, objc_declare_protocols, objc_comptypes, objc_check_decl, build_encode_expr): Remove prototypes. (imp_count, cat_count): Make GGC-aware. (OBJC_SET_TYPE_NAME): New macro. From-SVN: r87168
2004-09-08 02:49:44 +02:00
var = objc_create_temporary_var (objc_object_type);
c-common.c (flag_objc_sjlj_exceptions): New. * c-common.c (flag_objc_sjlj_exceptions): New. * c-common.h (flag_objc_sjlj_exceptions): Declare. * c-opts.c (c_common_handle_option): Set it. (c_common_post_options): Handle interation of different objective-c exception and runtime switches. * c-decl.c (c_eh_initialized_p): New. (finish_decl): Use it instead of local eh_initialized_p. * c-parse.in (nested_function, notype_nested_function): Record the result of compstmt. (compstmt_or_error): Likewise. (compstmt): Don't add_stmt the result. (stmt): Don't return anything. Rewrite objc try and sync rules. (objc_try_stmt, objc_catch_list): Remove. (objc_catch_block, objc_finally_block): Remove. (objc_catch_prefix, objc_catch_clause, objc_opt_catch_list): New. (objc_try_catch_clause, objc_finally_clause): New. (objc_try_catch_stmt): Rewrite. * c-tree.h (c_eh_initialized_p): Declare. * c-opt (fobjc-sjlj-exceptions): New. * except.c (output_function_exception_table): Don't call cgraph on non-decls. * objc/objc-act.c (UTAG_EXCDATA_VAR, UTAG_CAUGHTEXC_VAR, UTAG_RETHROWEXC_VAR, UTAG_EVALONCE_VAR, struct val_stack, catch_count_stack, exc_binding_stack, if_nesting_count, blk_nesting_count, objc_enter_block, objc_exit_block, objc_declare_variable, 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): Remove. (objc_create_temporary_var, struct objc_try_context, cur_try_context, objc_eh_runtime_type, objc_init_exceptions, objc_build_exc_ptr, next_sjlj_build_try_exit, next_sjlj_build_enter_and_setjmp, next_sjlj_build_exc_extract, next_sjlj_build_catch_list, next_sjlj_build_try_catch_finally, objc_begin_try_stmt, objc_begin_catch_clause, objc_finish_catch_clause, objc_build_finally_clause, objc_finish_try_stmt, objc_build_synchronized): New. (objc_is_object_id, objc_is_class_id): New. (objc_comptypes): Use them. (build_next_objc_exception_stuff): Break NeXT sjlj out from build_objc_exception_stuff. (synth_module_prologue): Update to match. (objc_build_throw_stmt): Use cur_try_context to decide if we're in a @catch. * objc/objc-act.h: Update prototypes. (OCTI_EXCEPTION_BLK_STACK, objc_exception_block_stack): Remove. testsuite/ * objc.dg/sync-1.m: New. * objc.dg/try-catch-1.m: Don't force next runtime. * objc.dg/try-catch-3.m, objc.dg/try-catch-4.m: Likewise. * objc.dg/try-catch-2.m: Likewise. Enable everywhere. Remove shadowed catch clause. * objc.dg/try-catch-5.m: New. From-SVN: r83332
2004-06-18 03:20:53 +02:00
cur_try_context->caught_decl = var;
}
return var;
}
else
return build0 (EXC_PTR_EXPR, objc_object_type);
c-common.c (flag_objc_sjlj_exceptions): New. * c-common.c (flag_objc_sjlj_exceptions): New. * c-common.h (flag_objc_sjlj_exceptions): Declare. * c-opts.c (c_common_handle_option): Set it. (c_common_post_options): Handle interation of different objective-c exception and runtime switches. * c-decl.c (c_eh_initialized_p): New. (finish_decl): Use it instead of local eh_initialized_p. * c-parse.in (nested_function, notype_nested_function): Record the result of compstmt. (compstmt_or_error): Likewise. (compstmt): Don't add_stmt the result. (stmt): Don't return anything. Rewrite objc try and sync rules. (objc_try_stmt, objc_catch_list): Remove. (objc_catch_block, objc_finally_block): Remove. (objc_catch_prefix, objc_catch_clause, objc_opt_catch_list): New. (objc_try_catch_clause, objc_finally_clause): New. (objc_try_catch_stmt): Rewrite. * c-tree.h (c_eh_initialized_p): Declare. * c-opt (fobjc-sjlj-exceptions): New. * except.c (output_function_exception_table): Don't call cgraph on non-decls. * objc/objc-act.c (UTAG_EXCDATA_VAR, UTAG_CAUGHTEXC_VAR, UTAG_RETHROWEXC_VAR, UTAG_EVALONCE_VAR, struct val_stack, catch_count_stack, exc_binding_stack, if_nesting_count, blk_nesting_count, objc_enter_block, objc_exit_block, objc_declare_variable, 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): Remove. (objc_create_temporary_var, struct objc_try_context, cur_try_context, objc_eh_runtime_type, objc_init_exceptions, objc_build_exc_ptr, next_sjlj_build_try_exit, next_sjlj_build_enter_and_setjmp, next_sjlj_build_exc_extract, next_sjlj_build_catch_list, next_sjlj_build_try_catch_finally, objc_begin_try_stmt, objc_begin_catch_clause, objc_finish_catch_clause, objc_build_finally_clause, objc_finish_try_stmt, objc_build_synchronized): New. (objc_is_object_id, objc_is_class_id): New. (objc_comptypes): Use them. (build_next_objc_exception_stuff): Break NeXT sjlj out from build_objc_exception_stuff. (synth_module_prologue): Update to match. (objc_build_throw_stmt): Use cur_try_context to decide if we're in a @catch. * objc/objc-act.h: Update prototypes. (OCTI_EXCEPTION_BLK_STACK, objc_exception_block_stack): Remove. testsuite/ * objc.dg/sync-1.m: New. * objc.dg/try-catch-1.m: Don't force next runtime. * objc.dg/try-catch-3.m, objc.dg/try-catch-4.m: Likewise. * objc.dg/try-catch-2.m: Likewise. Enable everywhere. Remove shadowed catch clause. * objc.dg/try-catch-5.m: New. From-SVN: r83332
2004-06-18 03:20:53 +02:00
}
c-common.c (flag_objc_sjlj_exceptions): New. * c-common.c (flag_objc_sjlj_exceptions): New. * c-common.h (flag_objc_sjlj_exceptions): Declare. * c-opts.c (c_common_handle_option): Set it. (c_common_post_options): Handle interation of different objective-c exception and runtime switches. * c-decl.c (c_eh_initialized_p): New. (finish_decl): Use it instead of local eh_initialized_p. * c-parse.in (nested_function, notype_nested_function): Record the result of compstmt. (compstmt_or_error): Likewise. (compstmt): Don't add_stmt the result. (stmt): Don't return anything. Rewrite objc try and sync rules. (objc_try_stmt, objc_catch_list): Remove. (objc_catch_block, objc_finally_block): Remove. (objc_catch_prefix, objc_catch_clause, objc_opt_catch_list): New. (objc_try_catch_clause, objc_finally_clause): New. (objc_try_catch_stmt): Rewrite. * c-tree.h (c_eh_initialized_p): Declare. * c-opt (fobjc-sjlj-exceptions): New. * except.c (output_function_exception_table): Don't call cgraph on non-decls. * objc/objc-act.c (UTAG_EXCDATA_VAR, UTAG_CAUGHTEXC_VAR, UTAG_RETHROWEXC_VAR, UTAG_EVALONCE_VAR, struct val_stack, catch_count_stack, exc_binding_stack, if_nesting_count, blk_nesting_count, objc_enter_block, objc_exit_block, objc_declare_variable, 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): Remove. (objc_create_temporary_var, struct objc_try_context, cur_try_context, objc_eh_runtime_type, objc_init_exceptions, objc_build_exc_ptr, next_sjlj_build_try_exit, next_sjlj_build_enter_and_setjmp, next_sjlj_build_exc_extract, next_sjlj_build_catch_list, next_sjlj_build_try_catch_finally, objc_begin_try_stmt, objc_begin_catch_clause, objc_finish_catch_clause, objc_build_finally_clause, objc_finish_try_stmt, objc_build_synchronized): New. (objc_is_object_id, objc_is_class_id): New. (objc_comptypes): Use them. (build_next_objc_exception_stuff): Break NeXT sjlj out from build_objc_exception_stuff. (synth_module_prologue): Update to match. (objc_build_throw_stmt): Use cur_try_context to decide if we're in a @catch. * objc/objc-act.h: Update prototypes. (OCTI_EXCEPTION_BLK_STACK, objc_exception_block_stack): Remove. testsuite/ * objc.dg/sync-1.m: New. * objc.dg/try-catch-1.m: Don't force next runtime. * objc.dg/try-catch-3.m, objc.dg/try-catch-4.m: Likewise. * objc.dg/try-catch-2.m: Likewise. Enable everywhere. Remove shadowed catch clause. * objc.dg/try-catch-5.m: New. From-SVN: r83332
2004-06-18 03:20:53 +02:00
/* Build "objc_exception_try_exit(&_stack)". */
c-common.c (flag_objc_sjlj_exceptions): New. * c-common.c (flag_objc_sjlj_exceptions): New. * c-common.h (flag_objc_sjlj_exceptions): Declare. * c-opts.c (c_common_handle_option): Set it. (c_common_post_options): Handle interation of different objective-c exception and runtime switches. * c-decl.c (c_eh_initialized_p): New. (finish_decl): Use it instead of local eh_initialized_p. * c-parse.in (nested_function, notype_nested_function): Record the result of compstmt. (compstmt_or_error): Likewise. (compstmt): Don't add_stmt the result. (stmt): Don't return anything. Rewrite objc try and sync rules. (objc_try_stmt, objc_catch_list): Remove. (objc_catch_block, objc_finally_block): Remove. (objc_catch_prefix, objc_catch_clause, objc_opt_catch_list): New. (objc_try_catch_clause, objc_finally_clause): New. (objc_try_catch_stmt): Rewrite. * c-tree.h (c_eh_initialized_p): Declare. * c-opt (fobjc-sjlj-exceptions): New. * except.c (output_function_exception_table): Don't call cgraph on non-decls. * objc/objc-act.c (UTAG_EXCDATA_VAR, UTAG_CAUGHTEXC_VAR, UTAG_RETHROWEXC_VAR, UTAG_EVALONCE_VAR, struct val_stack, catch_count_stack, exc_binding_stack, if_nesting_count, blk_nesting_count, objc_enter_block, objc_exit_block, objc_declare_variable, 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): Remove. (objc_create_temporary_var, struct objc_try_context, cur_try_context, objc_eh_runtime_type, objc_init_exceptions, objc_build_exc_ptr, next_sjlj_build_try_exit, next_sjlj_build_enter_and_setjmp, next_sjlj_build_exc_extract, next_sjlj_build_catch_list, next_sjlj_build_try_catch_finally, objc_begin_try_stmt, objc_begin_catch_clause, objc_finish_catch_clause, objc_build_finally_clause, objc_finish_try_stmt, objc_build_synchronized): New. (objc_is_object_id, objc_is_class_id): New. (objc_comptypes): Use them. (build_next_objc_exception_stuff): Break NeXT sjlj out from build_objc_exception_stuff. (synth_module_prologue): Update to match. (objc_build_throw_stmt): Use cur_try_context to decide if we're in a @catch. * objc/objc-act.h: Update prototypes. (OCTI_EXCEPTION_BLK_STACK, objc_exception_block_stack): Remove. testsuite/ * objc.dg/sync-1.m: New. * objc.dg/try-catch-1.m: Don't force next runtime. * objc.dg/try-catch-3.m, objc.dg/try-catch-4.m: Likewise. * objc.dg/try-catch-2.m: Likewise. Enable everywhere. Remove shadowed catch clause. * objc.dg/try-catch-5.m: New. From-SVN: r83332
2004-06-18 03:20:53 +02:00
static tree
next_sjlj_build_try_exit (void)
{
tree t;
t = build_fold_addr_expr (cur_try_context->stack_decl);
t = tree_cons (NULL, t, NULL);
t = build_function_call (objc_exception_try_exit_decl, t);
return t;
}
c-common.c (flag_objc_sjlj_exceptions): New. * c-common.c (flag_objc_sjlj_exceptions): New. * c-common.h (flag_objc_sjlj_exceptions): Declare. * c-opts.c (c_common_handle_option): Set it. (c_common_post_options): Handle interation of different objective-c exception and runtime switches. * c-decl.c (c_eh_initialized_p): New. (finish_decl): Use it instead of local eh_initialized_p. * c-parse.in (nested_function, notype_nested_function): Record the result of compstmt. (compstmt_or_error): Likewise. (compstmt): Don't add_stmt the result. (stmt): Don't return anything. Rewrite objc try and sync rules. (objc_try_stmt, objc_catch_list): Remove. (objc_catch_block, objc_finally_block): Remove. (objc_catch_prefix, objc_catch_clause, objc_opt_catch_list): New. (objc_try_catch_clause, objc_finally_clause): New. (objc_try_catch_stmt): Rewrite. * c-tree.h (c_eh_initialized_p): Declare. * c-opt (fobjc-sjlj-exceptions): New. * except.c (output_function_exception_table): Don't call cgraph on non-decls. * objc/objc-act.c (UTAG_EXCDATA_VAR, UTAG_CAUGHTEXC_VAR, UTAG_RETHROWEXC_VAR, UTAG_EVALONCE_VAR, struct val_stack, catch_count_stack, exc_binding_stack, if_nesting_count, blk_nesting_count, objc_enter_block, objc_exit_block, objc_declare_variable, 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): Remove. (objc_create_temporary_var, struct objc_try_context, cur_try_context, objc_eh_runtime_type, objc_init_exceptions, objc_build_exc_ptr, next_sjlj_build_try_exit, next_sjlj_build_enter_and_setjmp, next_sjlj_build_exc_extract, next_sjlj_build_catch_list, next_sjlj_build_try_catch_finally, objc_begin_try_stmt, objc_begin_catch_clause, objc_finish_catch_clause, objc_build_finally_clause, objc_finish_try_stmt, objc_build_synchronized): New. (objc_is_object_id, objc_is_class_id): New. (objc_comptypes): Use them. (build_next_objc_exception_stuff): Break NeXT sjlj out from build_objc_exception_stuff. (synth_module_prologue): Update to match. (objc_build_throw_stmt): Use cur_try_context to decide if we're in a @catch. * objc/objc-act.h: Update prototypes. (OCTI_EXCEPTION_BLK_STACK, objc_exception_block_stack): Remove. testsuite/ * objc.dg/sync-1.m: New. * objc.dg/try-catch-1.m: Don't force next runtime. * objc.dg/try-catch-3.m, objc.dg/try-catch-4.m: Likewise. * objc.dg/try-catch-2.m: Likewise. Enable everywhere. Remove shadowed catch clause. * objc.dg/try-catch-5.m: New. From-SVN: r83332
2004-06-18 03:20:53 +02:00
/* Build
objc_exception_try_enter (&_stack);
if (_setjmp(&_stack.buf))
;
else
;
Return the COND_EXPR. Note that the THEN and ELSE fields are left
empty, ready for the caller to fill them in. */
static tree
next_sjlj_build_enter_and_setjmp (void)
{
c-common.c (flag_objc_sjlj_exceptions): New. * c-common.c (flag_objc_sjlj_exceptions): New. * c-common.h (flag_objc_sjlj_exceptions): Declare. * c-opts.c (c_common_handle_option): Set it. (c_common_post_options): Handle interation of different objective-c exception and runtime switches. * c-decl.c (c_eh_initialized_p): New. (finish_decl): Use it instead of local eh_initialized_p. * c-parse.in (nested_function, notype_nested_function): Record the result of compstmt. (compstmt_or_error): Likewise. (compstmt): Don't add_stmt the result. (stmt): Don't return anything. Rewrite objc try and sync rules. (objc_try_stmt, objc_catch_list): Remove. (objc_catch_block, objc_finally_block): Remove. (objc_catch_prefix, objc_catch_clause, objc_opt_catch_list): New. (objc_try_catch_clause, objc_finally_clause): New. (objc_try_catch_stmt): Rewrite. * c-tree.h (c_eh_initialized_p): Declare. * c-opt (fobjc-sjlj-exceptions): New. * except.c (output_function_exception_table): Don't call cgraph on non-decls. * objc/objc-act.c (UTAG_EXCDATA_VAR, UTAG_CAUGHTEXC_VAR, UTAG_RETHROWEXC_VAR, UTAG_EVALONCE_VAR, struct val_stack, catch_count_stack, exc_binding_stack, if_nesting_count, blk_nesting_count, objc_enter_block, objc_exit_block, objc_declare_variable, 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): Remove. (objc_create_temporary_var, struct objc_try_context, cur_try_context, objc_eh_runtime_type, objc_init_exceptions, objc_build_exc_ptr, next_sjlj_build_try_exit, next_sjlj_build_enter_and_setjmp, next_sjlj_build_exc_extract, next_sjlj_build_catch_list, next_sjlj_build_try_catch_finally, objc_begin_try_stmt, objc_begin_catch_clause, objc_finish_catch_clause, objc_build_finally_clause, objc_finish_try_stmt, objc_build_synchronized): New. (objc_is_object_id, objc_is_class_id): New. (objc_comptypes): Use them. (build_next_objc_exception_stuff): Break NeXT sjlj out from build_objc_exception_stuff. (synth_module_prologue): Update to match. (objc_build_throw_stmt): Use cur_try_context to decide if we're in a @catch. * objc/objc-act.h: Update prototypes. (OCTI_EXCEPTION_BLK_STACK, objc_exception_block_stack): Remove. testsuite/ * objc.dg/sync-1.m: New. * objc.dg/try-catch-1.m: Don't force next runtime. * objc.dg/try-catch-3.m, objc.dg/try-catch-4.m: Likewise. * objc.dg/try-catch-2.m: Likewise. Enable everywhere. Remove shadowed catch clause. * objc.dg/try-catch-5.m: New. From-SVN: r83332
2004-06-18 03:20:53 +02:00
tree t, enter, sj, cond;
c-common.c (flag_objc_sjlj_exceptions): New. * c-common.c (flag_objc_sjlj_exceptions): New. * c-common.h (flag_objc_sjlj_exceptions): Declare. * c-opts.c (c_common_handle_option): Set it. (c_common_post_options): Handle interation of different objective-c exception and runtime switches. * c-decl.c (c_eh_initialized_p): New. (finish_decl): Use it instead of local eh_initialized_p. * c-parse.in (nested_function, notype_nested_function): Record the result of compstmt. (compstmt_or_error): Likewise. (compstmt): Don't add_stmt the result. (stmt): Don't return anything. Rewrite objc try and sync rules. (objc_try_stmt, objc_catch_list): Remove. (objc_catch_block, objc_finally_block): Remove. (objc_catch_prefix, objc_catch_clause, objc_opt_catch_list): New. (objc_try_catch_clause, objc_finally_clause): New. (objc_try_catch_stmt): Rewrite. * c-tree.h (c_eh_initialized_p): Declare. * c-opt (fobjc-sjlj-exceptions): New. * except.c (output_function_exception_table): Don't call cgraph on non-decls. * objc/objc-act.c (UTAG_EXCDATA_VAR, UTAG_CAUGHTEXC_VAR, UTAG_RETHROWEXC_VAR, UTAG_EVALONCE_VAR, struct val_stack, catch_count_stack, exc_binding_stack, if_nesting_count, blk_nesting_count, objc_enter_block, objc_exit_block, objc_declare_variable, 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): Remove. (objc_create_temporary_var, struct objc_try_context, cur_try_context, objc_eh_runtime_type, objc_init_exceptions, objc_build_exc_ptr, next_sjlj_build_try_exit, next_sjlj_build_enter_and_setjmp, next_sjlj_build_exc_extract, next_sjlj_build_catch_list, next_sjlj_build_try_catch_finally, objc_begin_try_stmt, objc_begin_catch_clause, objc_finish_catch_clause, objc_build_finally_clause, objc_finish_try_stmt, objc_build_synchronized): New. (objc_is_object_id, objc_is_class_id): New. (objc_comptypes): Use them. (build_next_objc_exception_stuff): Break NeXT sjlj out from build_objc_exception_stuff. (synth_module_prologue): Update to match. (objc_build_throw_stmt): Use cur_try_context to decide if we're in a @catch. * objc/objc-act.h: Update prototypes. (OCTI_EXCEPTION_BLK_STACK, objc_exception_block_stack): Remove. testsuite/ * objc.dg/sync-1.m: New. * objc.dg/try-catch-1.m: Don't force next runtime. * objc.dg/try-catch-3.m, objc.dg/try-catch-4.m: Likewise. * objc.dg/try-catch-2.m: Likewise. Enable everywhere. Remove shadowed catch clause. * objc.dg/try-catch-5.m: New. From-SVN: r83332
2004-06-18 03:20:53 +02:00
t = build_fold_addr_expr (cur_try_context->stack_decl);
t = tree_cons (NULL, t, NULL);
enter = build_function_call (objc_exception_try_enter_decl, t);
objc-act.c (objc_build_struct): New function. * objc-act.c (objc_build_struct): New function. (objc_derived_from_p): Likewise. (objc_build_component_ref): Likewise. (objc_copy_binfo): Likewise. (objc_xref_basetypes): Likewise. (objc_lookup_protocol): Likewise. (objc_compare_protocols): Likewise. (objc_volatilize_decl): Likewise. (encode_aggregate_fields): Likewise. (volatilized_hash): Likewise. (volatilized_eq): Likewise. (objc_compare_types): Likewise. (objc_type_quals_match): Likewise. (DERIVED_FROM_P): New ObjC macro, corresponding to C++ macro of same name. (get_class_ivars): Add second parameter indicating if entire hierarchy is desired. (struct volatilized_type): New type. (volatilized_htab): New hash table. (objc_types_compatible_p, objc_comptypes): Remove functions. (synth_module_prologue): Do not initialize 'unused_list'. (objc_get_class_reference): Fix ObjC++ impedance mismatches. (objc_declare_alias): Implement as a typedef. (objc_substitute_decl, objc_gimplify_expr): Reformat. (objc_get_class_ivars): Adjust call to get_class_ivars(). (next_sjlj_build_enter_and_setjmp, synth_forward_declarations, build_ivar_reference, get_super_receiver): Call objc_build_component_ref() instead of build_component_ref(). (objc_begin_catch_clause): Use DERIVED_FROM_P() instead of objc_comptypes(). (build_private_template): Call objc_build_struct() instead of start_struct() and finish_struct(). (hash_init): Initialize volatilized_htab. (objc_is_public): Adjust calls to objc_get_ivars(); adjust ObjC++ impedance mismatches. (encode_aggregate_within): Streamline by calling encode_aggregate_fields(). * objc-act.h (objc_types_compatible_p): Remove prototype. (OCTI_UNUSED_LIST, unused_list): Remove slot. * objc-lang.c (LANG_HOOKS_TYPES_COMPATIBLE_P): Remove. From-SVN: r100123
2005-05-25 00:21:01 +02:00
t = objc_build_component_ref (cur_try_context->stack_decl,
get_identifier ("buf"));
c-common.c (flag_objc_sjlj_exceptions): New. * c-common.c (flag_objc_sjlj_exceptions): New. * c-common.h (flag_objc_sjlj_exceptions): Declare. * c-opts.c (c_common_handle_option): Set it. (c_common_post_options): Handle interation of different objective-c exception and runtime switches. * c-decl.c (c_eh_initialized_p): New. (finish_decl): Use it instead of local eh_initialized_p. * c-parse.in (nested_function, notype_nested_function): Record the result of compstmt. (compstmt_or_error): Likewise. (compstmt): Don't add_stmt the result. (stmt): Don't return anything. Rewrite objc try and sync rules. (objc_try_stmt, objc_catch_list): Remove. (objc_catch_block, objc_finally_block): Remove. (objc_catch_prefix, objc_catch_clause, objc_opt_catch_list): New. (objc_try_catch_clause, objc_finally_clause): New. (objc_try_catch_stmt): Rewrite. * c-tree.h (c_eh_initialized_p): Declare. * c-opt (fobjc-sjlj-exceptions): New. * except.c (output_function_exception_table): Don't call cgraph on non-decls. * objc/objc-act.c (UTAG_EXCDATA_VAR, UTAG_CAUGHTEXC_VAR, UTAG_RETHROWEXC_VAR, UTAG_EVALONCE_VAR, struct val_stack, catch_count_stack, exc_binding_stack, if_nesting_count, blk_nesting_count, objc_enter_block, objc_exit_block, objc_declare_variable, 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): Remove. (objc_create_temporary_var, struct objc_try_context, cur_try_context, objc_eh_runtime_type, objc_init_exceptions, objc_build_exc_ptr, next_sjlj_build_try_exit, next_sjlj_build_enter_and_setjmp, next_sjlj_build_exc_extract, next_sjlj_build_catch_list, next_sjlj_build_try_catch_finally, objc_begin_try_stmt, objc_begin_catch_clause, objc_finish_catch_clause, objc_build_finally_clause, objc_finish_try_stmt, objc_build_synchronized): New. (objc_is_object_id, objc_is_class_id): New. (objc_comptypes): Use them. (build_next_objc_exception_stuff): Break NeXT sjlj out from build_objc_exception_stuff. (synth_module_prologue): Update to match. (objc_build_throw_stmt): Use cur_try_context to decide if we're in a @catch. * objc/objc-act.h: Update prototypes. (OCTI_EXCEPTION_BLK_STACK, objc_exception_block_stack): Remove. testsuite/ * objc.dg/sync-1.m: New. * objc.dg/try-catch-1.m: Don't force next runtime. * objc.dg/try-catch-3.m, objc.dg/try-catch-4.m: Likewise. * objc.dg/try-catch-2.m: Likewise. Enable everywhere. Remove shadowed catch clause. * objc.dg/try-catch-5.m: New. From-SVN: r83332
2004-06-18 03:20:53 +02:00
t = build_fold_addr_expr (t);
Yet more Objective-C++... * objc-act.c (objc_finish_try_stmt): Add return value. (objc_build_synchronized): Likewise. * objc-act.c (objc_is_gcable_type): Add. (objc_substitute_decl): Add. (objc_build_ivar_assignment): Add. (objc_build_global_assignment): Add. (objc_build_strong_cast_assignment): Add. (objc_is_ivar_reference_p): Add. (objc_is_global_reference_p): Add. (objc_generate_write_barrier): Add. (objc_rewrite_function_call): Add. (objc_gimplify_expr): Add Objective-C++ support. * objc-act.h (ALLOC_OBJC_TYPE_LANG_SPECIFIC): Likewise. (SIZEOF_OBJC_TYPE_LANG_SPECIFIC): Add. (INIT_TYPE_OBJC_INFO): Add Objective-C++ support. (DUP_TYPE_OBJC_INFO): Likewise. (struct imp_entry): Add field has_cxx_cdtors. (struct imp_entry *imp_list): Add OCTI_UMSG_FAST_DECL, OCTI_METH_LIST_TEMPL, OCTI_METH_PROTO_LIST_TEMPL, OCTI_IVAR_LIST_TEMPL, OCTI_ASSIGN_IVAR_DECL, OCTI_ASSIGN_IVAR_FAST_DECL, OCTI_ASSIGN_GLOBAL_DECL, OCTI_ASSIGN_STRONGCAST_DECL. (umsg_fast_decl): Add. (objc_assign_ivar_decl): Add. (objc_assign_ivar_fast_decl): Add. (objc_assign_global_decl): Add. (objc_assign_strong_cast_decl): Add. (objc_method_list_ptr): Add. (objc_method_proto_list_ptr): Add. (objc_ivar_list_ptr): Add. * objc-act.c (should_call_super_dealloc): Add. (OBJC_VERSION): Bump to 6. (objc_is_gcable_type): Add. (objc_substitute_decl): Add. (objc_build_ivar_assignment): Add. (objc_build_global_assignment): Add. (objc_build_strong_cast_assignment): Add. (objc_is_gcable_p): Add. (objc_is_ivar_reference_p): Add. (objc_is_global_reference_p): Add. (generate_shared_structures): Add flags parameter. (objc_generate_cxx_ctor_or_dtor): Add. (objc_generate_cxx_cdtors): Add. (add_class): Add name parameter. (objc_types_share_size_and_alignment): Add. (comp_proto_with_proto): Add strict parameter. (CLS_HAS_CXX_STRUCTORS): Add. (TAG_ASSIGNIVAR): Add. (TAG_ASSIGNGLOBAL): Add. (TAG_ASSIGNSTRONGCAST): Add. (TAG_MSGSEND_FAST): Add. (TAG_ASSIGNIVAR_FAST): Add. (TAG_CXX_CONSTRUCT): Add. (TAG_CXX_DESTRUCT): Add. (OBJC_LOOKUP_CLASS): Add. (OBJC_LOOKUP_NO_SUPER): Add. (objc_finish_file): Add pch support. (objc_finish_implementation): Add Objective-C++ support. (synth_module_prologue): Likewise. (synth_module_prologue): Add fast dispatching. (objc_get_class_reference): Add Objective-C++ support. (objc_generate_write_barrier): Likewise. (next_sjlj_build_enter_and_setjmp): Likewise. (objc_begin_try_stmt): Likewise. (build_next_objc_exception_stuff): Add fast ivar support. (build_private_template): Mark the record as used so debug information is generated. (build_protocol_template): Add Objective-C++ support. (objc_method_parm_type) Likewise. (objc_generate_cxx_ctor_or_dtor): Likewise. (objc_generate_cxx_cdtors): Likewise. (build_protocol_initializer): Likewise. (build_category_template): Likewise. (build_class_template): Likewise. (build_method_list_template): Likewise. (build_category_initializer): Likewise. (build_shared_structure_initializer): Likewise. (objc_finish_message_expr): Likewise. (build_objc_method_call): Add fast dispatch support. (lookup_method_static): Add support to end search at superclasses. (add_method_to_hash_list): Add strict parameter to comp_proto_with_proto. (objc_add_method): Likewise. (objc_add_method): Also set the interface_value. (add_instance_variable): Add Objective-C++ support. (objc_is_public): Likewise. (start_class): Likewise. (continue_class): Likewise. (encode_aggregate_within): Likewise. (start_method_def): Likewise. (objc_start_function): Clear current_function_returns_value and current_function_returns_null. (really_start_method): Add Objective-C++ support. (objc_finish_method_definition): Add warning for missing [super dealloc]. (finish_objc): Add Objective-C++ support. (generate_objc_image_info): Likewise. (objc_lookup_ivar): Likewise. * objc-act.h (TYPE_HAS_OBJC_INFO): Likewise. (INIT_TYPE_OBJC_INFO): Likewise. (DUP_TYPE_OBJC_INFO): Likewise. From-SVN: r99857
2005-05-17 22:07:08 +02:00
#ifdef OBJCPLUS
/* Convert _setjmp argument to type that is expected. */
if (TYPE_ARG_TYPES (TREE_TYPE (objc_setjmp_decl)))
t = convert (TREE_VALUE (TYPE_ARG_TYPES (TREE_TYPE (objc_setjmp_decl))), t);
else
t = convert (ptr_type_node, t);
#else
c-common.c (flag_objc_sjlj_exceptions): New. * c-common.c (flag_objc_sjlj_exceptions): New. * c-common.h (flag_objc_sjlj_exceptions): Declare. * c-opts.c (c_common_handle_option): Set it. (c_common_post_options): Handle interation of different objective-c exception and runtime switches. * c-decl.c (c_eh_initialized_p): New. (finish_decl): Use it instead of local eh_initialized_p. * c-parse.in (nested_function, notype_nested_function): Record the result of compstmt. (compstmt_or_error): Likewise. (compstmt): Don't add_stmt the result. (stmt): Don't return anything. Rewrite objc try and sync rules. (objc_try_stmt, objc_catch_list): Remove. (objc_catch_block, objc_finally_block): Remove. (objc_catch_prefix, objc_catch_clause, objc_opt_catch_list): New. (objc_try_catch_clause, objc_finally_clause): New. (objc_try_catch_stmt): Rewrite. * c-tree.h (c_eh_initialized_p): Declare. * c-opt (fobjc-sjlj-exceptions): New. * except.c (output_function_exception_table): Don't call cgraph on non-decls. * objc/objc-act.c (UTAG_EXCDATA_VAR, UTAG_CAUGHTEXC_VAR, UTAG_RETHROWEXC_VAR, UTAG_EVALONCE_VAR, struct val_stack, catch_count_stack, exc_binding_stack, if_nesting_count, blk_nesting_count, objc_enter_block, objc_exit_block, objc_declare_variable, 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): Remove. (objc_create_temporary_var, struct objc_try_context, cur_try_context, objc_eh_runtime_type, objc_init_exceptions, objc_build_exc_ptr, next_sjlj_build_try_exit, next_sjlj_build_enter_and_setjmp, next_sjlj_build_exc_extract, next_sjlj_build_catch_list, next_sjlj_build_try_catch_finally, objc_begin_try_stmt, objc_begin_catch_clause, objc_finish_catch_clause, objc_build_finally_clause, objc_finish_try_stmt, objc_build_synchronized): New. (objc_is_object_id, objc_is_class_id): New. (objc_comptypes): Use them. (build_next_objc_exception_stuff): Break NeXT sjlj out from build_objc_exception_stuff. (synth_module_prologue): Update to match. (objc_build_throw_stmt): Use cur_try_context to decide if we're in a @catch. * objc/objc-act.h: Update prototypes. (OCTI_EXCEPTION_BLK_STACK, objc_exception_block_stack): Remove. testsuite/ * objc.dg/sync-1.m: New. * objc.dg/try-catch-1.m: Don't force next runtime. * objc.dg/try-catch-3.m, objc.dg/try-catch-4.m: Likewise. * objc.dg/try-catch-2.m: Likewise. Enable everywhere. Remove shadowed catch clause. * objc.dg/try-catch-5.m: New. From-SVN: r83332
2004-06-18 03:20:53 +02:00
t = convert (ptr_type_node, t);
Yet more Objective-C++... * objc-act.c (objc_finish_try_stmt): Add return value. (objc_build_synchronized): Likewise. * objc-act.c (objc_is_gcable_type): Add. (objc_substitute_decl): Add. (objc_build_ivar_assignment): Add. (objc_build_global_assignment): Add. (objc_build_strong_cast_assignment): Add. (objc_is_ivar_reference_p): Add. (objc_is_global_reference_p): Add. (objc_generate_write_barrier): Add. (objc_rewrite_function_call): Add. (objc_gimplify_expr): Add Objective-C++ support. * objc-act.h (ALLOC_OBJC_TYPE_LANG_SPECIFIC): Likewise. (SIZEOF_OBJC_TYPE_LANG_SPECIFIC): Add. (INIT_TYPE_OBJC_INFO): Add Objective-C++ support. (DUP_TYPE_OBJC_INFO): Likewise. (struct imp_entry): Add field has_cxx_cdtors. (struct imp_entry *imp_list): Add OCTI_UMSG_FAST_DECL, OCTI_METH_LIST_TEMPL, OCTI_METH_PROTO_LIST_TEMPL, OCTI_IVAR_LIST_TEMPL, OCTI_ASSIGN_IVAR_DECL, OCTI_ASSIGN_IVAR_FAST_DECL, OCTI_ASSIGN_GLOBAL_DECL, OCTI_ASSIGN_STRONGCAST_DECL. (umsg_fast_decl): Add. (objc_assign_ivar_decl): Add. (objc_assign_ivar_fast_decl): Add. (objc_assign_global_decl): Add. (objc_assign_strong_cast_decl): Add. (objc_method_list_ptr): Add. (objc_method_proto_list_ptr): Add. (objc_ivar_list_ptr): Add. * objc-act.c (should_call_super_dealloc): Add. (OBJC_VERSION): Bump to 6. (objc_is_gcable_type): Add. (objc_substitute_decl): Add. (objc_build_ivar_assignment): Add. (objc_build_global_assignment): Add. (objc_build_strong_cast_assignment): Add. (objc_is_gcable_p): Add. (objc_is_ivar_reference_p): Add. (objc_is_global_reference_p): Add. (generate_shared_structures): Add flags parameter. (objc_generate_cxx_ctor_or_dtor): Add. (objc_generate_cxx_cdtors): Add. (add_class): Add name parameter. (objc_types_share_size_and_alignment): Add. (comp_proto_with_proto): Add strict parameter. (CLS_HAS_CXX_STRUCTORS): Add. (TAG_ASSIGNIVAR): Add. (TAG_ASSIGNGLOBAL): Add. (TAG_ASSIGNSTRONGCAST): Add. (TAG_MSGSEND_FAST): Add. (TAG_ASSIGNIVAR_FAST): Add. (TAG_CXX_CONSTRUCT): Add. (TAG_CXX_DESTRUCT): Add. (OBJC_LOOKUP_CLASS): Add. (OBJC_LOOKUP_NO_SUPER): Add. (objc_finish_file): Add pch support. (objc_finish_implementation): Add Objective-C++ support. (synth_module_prologue): Likewise. (synth_module_prologue): Add fast dispatching. (objc_get_class_reference): Add Objective-C++ support. (objc_generate_write_barrier): Likewise. (next_sjlj_build_enter_and_setjmp): Likewise. (objc_begin_try_stmt): Likewise. (build_next_objc_exception_stuff): Add fast ivar support. (build_private_template): Mark the record as used so debug information is generated. (build_protocol_template): Add Objective-C++ support. (objc_method_parm_type) Likewise. (objc_generate_cxx_ctor_or_dtor): Likewise. (objc_generate_cxx_cdtors): Likewise. (build_protocol_initializer): Likewise. (build_category_template): Likewise. (build_class_template): Likewise. (build_method_list_template): Likewise. (build_category_initializer): Likewise. (build_shared_structure_initializer): Likewise. (objc_finish_message_expr): Likewise. (build_objc_method_call): Add fast dispatch support. (lookup_method_static): Add support to end search at superclasses. (add_method_to_hash_list): Add strict parameter to comp_proto_with_proto. (objc_add_method): Likewise. (objc_add_method): Also set the interface_value. (add_instance_variable): Add Objective-C++ support. (objc_is_public): Likewise. (start_class): Likewise. (continue_class): Likewise. (encode_aggregate_within): Likewise. (start_method_def): Likewise. (objc_start_function): Clear current_function_returns_value and current_function_returns_null. (really_start_method): Add Objective-C++ support. (objc_finish_method_definition): Add warning for missing [super dealloc]. (finish_objc): Add Objective-C++ support. (generate_objc_image_info): Likewise. (objc_lookup_ivar): Likewise. * objc-act.h (TYPE_HAS_OBJC_INFO): Likewise. (INIT_TYPE_OBJC_INFO): Likewise. (DUP_TYPE_OBJC_INFO): Likewise. From-SVN: r99857
2005-05-17 22:07:08 +02:00
#endif
c-common.c (flag_objc_sjlj_exceptions): New. * c-common.c (flag_objc_sjlj_exceptions): New. * c-common.h (flag_objc_sjlj_exceptions): Declare. * c-opts.c (c_common_handle_option): Set it. (c_common_post_options): Handle interation of different objective-c exception and runtime switches. * c-decl.c (c_eh_initialized_p): New. (finish_decl): Use it instead of local eh_initialized_p. * c-parse.in (nested_function, notype_nested_function): Record the result of compstmt. (compstmt_or_error): Likewise. (compstmt): Don't add_stmt the result. (stmt): Don't return anything. Rewrite objc try and sync rules. (objc_try_stmt, objc_catch_list): Remove. (objc_catch_block, objc_finally_block): Remove. (objc_catch_prefix, objc_catch_clause, objc_opt_catch_list): New. (objc_try_catch_clause, objc_finally_clause): New. (objc_try_catch_stmt): Rewrite. * c-tree.h (c_eh_initialized_p): Declare. * c-opt (fobjc-sjlj-exceptions): New. * except.c (output_function_exception_table): Don't call cgraph on non-decls. * objc/objc-act.c (UTAG_EXCDATA_VAR, UTAG_CAUGHTEXC_VAR, UTAG_RETHROWEXC_VAR, UTAG_EVALONCE_VAR, struct val_stack, catch_count_stack, exc_binding_stack, if_nesting_count, blk_nesting_count, objc_enter_block, objc_exit_block, objc_declare_variable, 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): Remove. (objc_create_temporary_var, struct objc_try_context, cur_try_context, objc_eh_runtime_type, objc_init_exceptions, objc_build_exc_ptr, next_sjlj_build_try_exit, next_sjlj_build_enter_and_setjmp, next_sjlj_build_exc_extract, next_sjlj_build_catch_list, next_sjlj_build_try_catch_finally, objc_begin_try_stmt, objc_begin_catch_clause, objc_finish_catch_clause, objc_build_finally_clause, objc_finish_try_stmt, objc_build_synchronized): New. (objc_is_object_id, objc_is_class_id): New. (objc_comptypes): Use them. (build_next_objc_exception_stuff): Break NeXT sjlj out from build_objc_exception_stuff. (synth_module_prologue): Update to match. (objc_build_throw_stmt): Use cur_try_context to decide if we're in a @catch. * objc/objc-act.h: Update prototypes. (OCTI_EXCEPTION_BLK_STACK, objc_exception_block_stack): Remove. testsuite/ * objc.dg/sync-1.m: New. * objc.dg/try-catch-1.m: Don't force next runtime. * objc.dg/try-catch-3.m, objc.dg/try-catch-4.m: Likewise. * objc.dg/try-catch-2.m: Likewise. Enable everywhere. Remove shadowed catch clause. * objc.dg/try-catch-5.m: New. From-SVN: r83332
2004-06-18 03:20:53 +02:00
t = tree_cons (NULL, t, NULL);
sj = build_function_call (objc_setjmp_decl, t);
cond = build2 (COMPOUND_EXPR, TREE_TYPE (sj), enter, sj);
cond = c_common_truthvalue_conversion (cond);
return build3 (COND_EXPR, void_type_node, cond, NULL, NULL);
}
2006-05-28 03:01:12 +02:00
/* Build:
DECL = objc_exception_extract(&_stack); */
c-common.c (flag_objc_sjlj_exceptions): New. * c-common.c (flag_objc_sjlj_exceptions): New. * c-common.h (flag_objc_sjlj_exceptions): Declare. * c-opts.c (c_common_handle_option): Set it. (c_common_post_options): Handle interation of different objective-c exception and runtime switches. * c-decl.c (c_eh_initialized_p): New. (finish_decl): Use it instead of local eh_initialized_p. * c-parse.in (nested_function, notype_nested_function): Record the result of compstmt. (compstmt_or_error): Likewise. (compstmt): Don't add_stmt the result. (stmt): Don't return anything. Rewrite objc try and sync rules. (objc_try_stmt, objc_catch_list): Remove. (objc_catch_block, objc_finally_block): Remove. (objc_catch_prefix, objc_catch_clause, objc_opt_catch_list): New. (objc_try_catch_clause, objc_finally_clause): New. (objc_try_catch_stmt): Rewrite. * c-tree.h (c_eh_initialized_p): Declare. * c-opt (fobjc-sjlj-exceptions): New. * except.c (output_function_exception_table): Don't call cgraph on non-decls. * objc/objc-act.c (UTAG_EXCDATA_VAR, UTAG_CAUGHTEXC_VAR, UTAG_RETHROWEXC_VAR, UTAG_EVALONCE_VAR, struct val_stack, catch_count_stack, exc_binding_stack, if_nesting_count, blk_nesting_count, objc_enter_block, objc_exit_block, objc_declare_variable, 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): Remove. (objc_create_temporary_var, struct objc_try_context, cur_try_context, objc_eh_runtime_type, objc_init_exceptions, objc_build_exc_ptr, next_sjlj_build_try_exit, next_sjlj_build_enter_and_setjmp, next_sjlj_build_exc_extract, next_sjlj_build_catch_list, next_sjlj_build_try_catch_finally, objc_begin_try_stmt, objc_begin_catch_clause, objc_finish_catch_clause, objc_build_finally_clause, objc_finish_try_stmt, objc_build_synchronized): New. (objc_is_object_id, objc_is_class_id): New. (objc_comptypes): Use them. (build_next_objc_exception_stuff): Break NeXT sjlj out from build_objc_exception_stuff. (synth_module_prologue): Update to match. (objc_build_throw_stmt): Use cur_try_context to decide if we're in a @catch. * objc/objc-act.h: Update prototypes. (OCTI_EXCEPTION_BLK_STACK, objc_exception_block_stack): Remove. testsuite/ * objc.dg/sync-1.m: New. * objc.dg/try-catch-1.m: Don't force next runtime. * objc.dg/try-catch-3.m, objc.dg/try-catch-4.m: Likewise. * objc.dg/try-catch-2.m: Likewise. Enable everywhere. Remove shadowed catch clause. * objc.dg/try-catch-5.m: New. From-SVN: r83332
2004-06-18 03:20:53 +02:00
static tree
next_sjlj_build_exc_extract (tree decl)
{
c-common.c (flag_objc_sjlj_exceptions): New. * c-common.c (flag_objc_sjlj_exceptions): New. * c-common.h (flag_objc_sjlj_exceptions): Declare. * c-opts.c (c_common_handle_option): Set it. (c_common_post_options): Handle interation of different objective-c exception and runtime switches. * c-decl.c (c_eh_initialized_p): New. (finish_decl): Use it instead of local eh_initialized_p. * c-parse.in (nested_function, notype_nested_function): Record the result of compstmt. (compstmt_or_error): Likewise. (compstmt): Don't add_stmt the result. (stmt): Don't return anything. Rewrite objc try and sync rules. (objc_try_stmt, objc_catch_list): Remove. (objc_catch_block, objc_finally_block): Remove. (objc_catch_prefix, objc_catch_clause, objc_opt_catch_list): New. (objc_try_catch_clause, objc_finally_clause): New. (objc_try_catch_stmt): Rewrite. * c-tree.h (c_eh_initialized_p): Declare. * c-opt (fobjc-sjlj-exceptions): New. * except.c (output_function_exception_table): Don't call cgraph on non-decls. * objc/objc-act.c (UTAG_EXCDATA_VAR, UTAG_CAUGHTEXC_VAR, UTAG_RETHROWEXC_VAR, UTAG_EVALONCE_VAR, struct val_stack, catch_count_stack, exc_binding_stack, if_nesting_count, blk_nesting_count, objc_enter_block, objc_exit_block, objc_declare_variable, 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): Remove. (objc_create_temporary_var, struct objc_try_context, cur_try_context, objc_eh_runtime_type, objc_init_exceptions, objc_build_exc_ptr, next_sjlj_build_try_exit, next_sjlj_build_enter_and_setjmp, next_sjlj_build_exc_extract, next_sjlj_build_catch_list, next_sjlj_build_try_catch_finally, objc_begin_try_stmt, objc_begin_catch_clause, objc_finish_catch_clause, objc_build_finally_clause, objc_finish_try_stmt, objc_build_synchronized): New. (objc_is_object_id, objc_is_class_id): New. (objc_comptypes): Use them. (build_next_objc_exception_stuff): Break NeXT sjlj out from build_objc_exception_stuff. (synth_module_prologue): Update to match. (objc_build_throw_stmt): Use cur_try_context to decide if we're in a @catch. * objc/objc-act.h: Update prototypes. (OCTI_EXCEPTION_BLK_STACK, objc_exception_block_stack): Remove. testsuite/ * objc.dg/sync-1.m: New. * objc.dg/try-catch-1.m: Don't force next runtime. * objc.dg/try-catch-3.m, objc.dg/try-catch-4.m: Likewise. * objc.dg/try-catch-2.m: Likewise. Enable everywhere. Remove shadowed catch clause. * objc.dg/try-catch-5.m: New. From-SVN: r83332
2004-06-18 03:20:53 +02:00
tree t;
c-common.c (flag_objc_sjlj_exceptions): New. * c-common.c (flag_objc_sjlj_exceptions): New. * c-common.h (flag_objc_sjlj_exceptions): Declare. * c-opts.c (c_common_handle_option): Set it. (c_common_post_options): Handle interation of different objective-c exception and runtime switches. * c-decl.c (c_eh_initialized_p): New. (finish_decl): Use it instead of local eh_initialized_p. * c-parse.in (nested_function, notype_nested_function): Record the result of compstmt. (compstmt_or_error): Likewise. (compstmt): Don't add_stmt the result. (stmt): Don't return anything. Rewrite objc try and sync rules. (objc_try_stmt, objc_catch_list): Remove. (objc_catch_block, objc_finally_block): Remove. (objc_catch_prefix, objc_catch_clause, objc_opt_catch_list): New. (objc_try_catch_clause, objc_finally_clause): New. (objc_try_catch_stmt): Rewrite. * c-tree.h (c_eh_initialized_p): Declare. * c-opt (fobjc-sjlj-exceptions): New. * except.c (output_function_exception_table): Don't call cgraph on non-decls. * objc/objc-act.c (UTAG_EXCDATA_VAR, UTAG_CAUGHTEXC_VAR, UTAG_RETHROWEXC_VAR, UTAG_EVALONCE_VAR, struct val_stack, catch_count_stack, exc_binding_stack, if_nesting_count, blk_nesting_count, objc_enter_block, objc_exit_block, objc_declare_variable, 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): Remove. (objc_create_temporary_var, struct objc_try_context, cur_try_context, objc_eh_runtime_type, objc_init_exceptions, objc_build_exc_ptr, next_sjlj_build_try_exit, next_sjlj_build_enter_and_setjmp, next_sjlj_build_exc_extract, next_sjlj_build_catch_list, next_sjlj_build_try_catch_finally, objc_begin_try_stmt, objc_begin_catch_clause, objc_finish_catch_clause, objc_build_finally_clause, objc_finish_try_stmt, objc_build_synchronized): New. (objc_is_object_id, objc_is_class_id): New. (objc_comptypes): Use them. (build_next_objc_exception_stuff): Break NeXT sjlj out from build_objc_exception_stuff. (synth_module_prologue): Update to match. (objc_build_throw_stmt): Use cur_try_context to decide if we're in a @catch. * objc/objc-act.h: Update prototypes. (OCTI_EXCEPTION_BLK_STACK, objc_exception_block_stack): Remove. testsuite/ * objc.dg/sync-1.m: New. * objc.dg/try-catch-1.m: Don't force next runtime. * objc.dg/try-catch-3.m, objc.dg/try-catch-4.m: Likewise. * objc.dg/try-catch-2.m: Likewise. Enable everywhere. Remove shadowed catch clause. * objc.dg/try-catch-5.m: New. From-SVN: r83332
2004-06-18 03:20:53 +02:00
t = build_fold_addr_expr (cur_try_context->stack_decl);
t = tree_cons (NULL, t, NULL);
t = build_function_call (objc_exception_extract_decl, t);
t = convert (TREE_TYPE (decl), t);
t = build2 (MODIFY_EXPR, void_type_node, decl, t);
c-common.c (flag_objc_sjlj_exceptions): New. * c-common.c (flag_objc_sjlj_exceptions): New. * c-common.h (flag_objc_sjlj_exceptions): Declare. * c-opts.c (c_common_handle_option): Set it. (c_common_post_options): Handle interation of different objective-c exception and runtime switches. * c-decl.c (c_eh_initialized_p): New. (finish_decl): Use it instead of local eh_initialized_p. * c-parse.in (nested_function, notype_nested_function): Record the result of compstmt. (compstmt_or_error): Likewise. (compstmt): Don't add_stmt the result. (stmt): Don't return anything. Rewrite objc try and sync rules. (objc_try_stmt, objc_catch_list): Remove. (objc_catch_block, objc_finally_block): Remove. (objc_catch_prefix, objc_catch_clause, objc_opt_catch_list): New. (objc_try_catch_clause, objc_finally_clause): New. (objc_try_catch_stmt): Rewrite. * c-tree.h (c_eh_initialized_p): Declare. * c-opt (fobjc-sjlj-exceptions): New. * except.c (output_function_exception_table): Don't call cgraph on non-decls. * objc/objc-act.c (UTAG_EXCDATA_VAR, UTAG_CAUGHTEXC_VAR, UTAG_RETHROWEXC_VAR, UTAG_EVALONCE_VAR, struct val_stack, catch_count_stack, exc_binding_stack, if_nesting_count, blk_nesting_count, objc_enter_block, objc_exit_block, objc_declare_variable, 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): Remove. (objc_create_temporary_var, struct objc_try_context, cur_try_context, objc_eh_runtime_type, objc_init_exceptions, objc_build_exc_ptr, next_sjlj_build_try_exit, next_sjlj_build_enter_and_setjmp, next_sjlj_build_exc_extract, next_sjlj_build_catch_list, next_sjlj_build_try_catch_finally, objc_begin_try_stmt, objc_begin_catch_clause, objc_finish_catch_clause, objc_build_finally_clause, objc_finish_try_stmt, objc_build_synchronized): New. (objc_is_object_id, objc_is_class_id): New. (objc_comptypes): Use them. (build_next_objc_exception_stuff): Break NeXT sjlj out from build_objc_exception_stuff. (synth_module_prologue): Update to match. (objc_build_throw_stmt): Use cur_try_context to decide if we're in a @catch. * objc/objc-act.h: Update prototypes. (OCTI_EXCEPTION_BLK_STACK, objc_exception_block_stack): Remove. testsuite/ * objc.dg/sync-1.m: New. * objc.dg/try-catch-1.m: Don't force next runtime. * objc.dg/try-catch-3.m, objc.dg/try-catch-4.m: Likewise. * objc.dg/try-catch-2.m: Likewise. Enable everywhere. Remove shadowed catch clause. * objc.dg/try-catch-5.m: New. From-SVN: r83332
2004-06-18 03:20:53 +02:00
return t;
}
c-common.c (flag_objc_sjlj_exceptions): New. * c-common.c (flag_objc_sjlj_exceptions): New. * c-common.h (flag_objc_sjlj_exceptions): Declare. * c-opts.c (c_common_handle_option): Set it. (c_common_post_options): Handle interation of different objective-c exception and runtime switches. * c-decl.c (c_eh_initialized_p): New. (finish_decl): Use it instead of local eh_initialized_p. * c-parse.in (nested_function, notype_nested_function): Record the result of compstmt. (compstmt_or_error): Likewise. (compstmt): Don't add_stmt the result. (stmt): Don't return anything. Rewrite objc try and sync rules. (objc_try_stmt, objc_catch_list): Remove. (objc_catch_block, objc_finally_block): Remove. (objc_catch_prefix, objc_catch_clause, objc_opt_catch_list): New. (objc_try_catch_clause, objc_finally_clause): New. (objc_try_catch_stmt): Rewrite. * c-tree.h (c_eh_initialized_p): Declare. * c-opt (fobjc-sjlj-exceptions): New. * except.c (output_function_exception_table): Don't call cgraph on non-decls. * objc/objc-act.c (UTAG_EXCDATA_VAR, UTAG_CAUGHTEXC_VAR, UTAG_RETHROWEXC_VAR, UTAG_EVALONCE_VAR, struct val_stack, catch_count_stack, exc_binding_stack, if_nesting_count, blk_nesting_count, objc_enter_block, objc_exit_block, objc_declare_variable, 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): Remove. (objc_create_temporary_var, struct objc_try_context, cur_try_context, objc_eh_runtime_type, objc_init_exceptions, objc_build_exc_ptr, next_sjlj_build_try_exit, next_sjlj_build_enter_and_setjmp, next_sjlj_build_exc_extract, next_sjlj_build_catch_list, next_sjlj_build_try_catch_finally, objc_begin_try_stmt, objc_begin_catch_clause, objc_finish_catch_clause, objc_build_finally_clause, objc_finish_try_stmt, objc_build_synchronized): New. (objc_is_object_id, objc_is_class_id): New. (objc_comptypes): Use them. (build_next_objc_exception_stuff): Break NeXT sjlj out from build_objc_exception_stuff. (synth_module_prologue): Update to match. (objc_build_throw_stmt): Use cur_try_context to decide if we're in a @catch. * objc/objc-act.h: Update prototypes. (OCTI_EXCEPTION_BLK_STACK, objc_exception_block_stack): Remove. testsuite/ * objc.dg/sync-1.m: New. * objc.dg/try-catch-1.m: Don't force next runtime. * objc.dg/try-catch-3.m, objc.dg/try-catch-4.m: Likewise. * objc.dg/try-catch-2.m: Likewise. Enable everywhere. Remove shadowed catch clause. * objc.dg/try-catch-5.m: New. From-SVN: r83332
2004-06-18 03:20:53 +02:00
/* Build
if (objc_exception_match(obj_get_class(TYPE), _caught)
BODY
else if (...)
...
else
{
_rethrow = _caught;
objc_exception_try_exit(&_stack);
}
from the sequence of CATCH_EXPRs in the current try context. */
c-common.c (flag_objc_sjlj_exceptions): New. * c-common.c (flag_objc_sjlj_exceptions): New. * c-common.h (flag_objc_sjlj_exceptions): Declare. * c-opts.c (c_common_handle_option): Set it. (c_common_post_options): Handle interation of different objective-c exception and runtime switches. * c-decl.c (c_eh_initialized_p): New. (finish_decl): Use it instead of local eh_initialized_p. * c-parse.in (nested_function, notype_nested_function): Record the result of compstmt. (compstmt_or_error): Likewise. (compstmt): Don't add_stmt the result. (stmt): Don't return anything. Rewrite objc try and sync rules. (objc_try_stmt, objc_catch_list): Remove. (objc_catch_block, objc_finally_block): Remove. (objc_catch_prefix, objc_catch_clause, objc_opt_catch_list): New. (objc_try_catch_clause, objc_finally_clause): New. (objc_try_catch_stmt): Rewrite. * c-tree.h (c_eh_initialized_p): Declare. * c-opt (fobjc-sjlj-exceptions): New. * except.c (output_function_exception_table): Don't call cgraph on non-decls. * objc/objc-act.c (UTAG_EXCDATA_VAR, UTAG_CAUGHTEXC_VAR, UTAG_RETHROWEXC_VAR, UTAG_EVALONCE_VAR, struct val_stack, catch_count_stack, exc_binding_stack, if_nesting_count, blk_nesting_count, objc_enter_block, objc_exit_block, objc_declare_variable, 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): Remove. (objc_create_temporary_var, struct objc_try_context, cur_try_context, objc_eh_runtime_type, objc_init_exceptions, objc_build_exc_ptr, next_sjlj_build_try_exit, next_sjlj_build_enter_and_setjmp, next_sjlj_build_exc_extract, next_sjlj_build_catch_list, next_sjlj_build_try_catch_finally, objc_begin_try_stmt, objc_begin_catch_clause, objc_finish_catch_clause, objc_build_finally_clause, objc_finish_try_stmt, objc_build_synchronized): New. (objc_is_object_id, objc_is_class_id): New. (objc_comptypes): Use them. (build_next_objc_exception_stuff): Break NeXT sjlj out from build_objc_exception_stuff. (synth_module_prologue): Update to match. (objc_build_throw_stmt): Use cur_try_context to decide if we're in a @catch. * objc/objc-act.h: Update prototypes. (OCTI_EXCEPTION_BLK_STACK, objc_exception_block_stack): Remove. testsuite/ * objc.dg/sync-1.m: New. * objc.dg/try-catch-1.m: Don't force next runtime. * objc.dg/try-catch-3.m, objc.dg/try-catch-4.m: Likewise. * objc.dg/try-catch-2.m: Likewise. Enable everywhere. Remove shadowed catch clause. * objc.dg/try-catch-5.m: New. From-SVN: r83332
2004-06-18 03:20:53 +02:00
static tree
next_sjlj_build_catch_list (void)
{
tree_stmt_iterator i = tsi_start (cur_try_context->catch_list);
tree catch_seq, t;
tree *last = &catch_seq;
bool saw_id = false;
c-common.c (flag_objc_sjlj_exceptions): New. * c-common.c (flag_objc_sjlj_exceptions): New. * c-common.h (flag_objc_sjlj_exceptions): Declare. * c-opts.c (c_common_handle_option): Set it. (c_common_post_options): Handle interation of different objective-c exception and runtime switches. * c-decl.c (c_eh_initialized_p): New. (finish_decl): Use it instead of local eh_initialized_p. * c-parse.in (nested_function, notype_nested_function): Record the result of compstmt. (compstmt_or_error): Likewise. (compstmt): Don't add_stmt the result. (stmt): Don't return anything. Rewrite objc try and sync rules. (objc_try_stmt, objc_catch_list): Remove. (objc_catch_block, objc_finally_block): Remove. (objc_catch_prefix, objc_catch_clause, objc_opt_catch_list): New. (objc_try_catch_clause, objc_finally_clause): New. (objc_try_catch_stmt): Rewrite. * c-tree.h (c_eh_initialized_p): Declare. * c-opt (fobjc-sjlj-exceptions): New. * except.c (output_function_exception_table): Don't call cgraph on non-decls. * objc/objc-act.c (UTAG_EXCDATA_VAR, UTAG_CAUGHTEXC_VAR, UTAG_RETHROWEXC_VAR, UTAG_EVALONCE_VAR, struct val_stack, catch_count_stack, exc_binding_stack, if_nesting_count, blk_nesting_count, objc_enter_block, objc_exit_block, objc_declare_variable, 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): Remove. (objc_create_temporary_var, struct objc_try_context, cur_try_context, objc_eh_runtime_type, objc_init_exceptions, objc_build_exc_ptr, next_sjlj_build_try_exit, next_sjlj_build_enter_and_setjmp, next_sjlj_build_exc_extract, next_sjlj_build_catch_list, next_sjlj_build_try_catch_finally, objc_begin_try_stmt, objc_begin_catch_clause, objc_finish_catch_clause, objc_build_finally_clause, objc_finish_try_stmt, objc_build_synchronized): New. (objc_is_object_id, objc_is_class_id): New. (objc_comptypes): Use them. (build_next_objc_exception_stuff): Break NeXT sjlj out from build_objc_exception_stuff. (synth_module_prologue): Update to match. (objc_build_throw_stmt): Use cur_try_context to decide if we're in a @catch. * objc/objc-act.h: Update prototypes. (OCTI_EXCEPTION_BLK_STACK, objc_exception_block_stack): Remove. testsuite/ * objc.dg/sync-1.m: New. * objc.dg/try-catch-1.m: Don't force next runtime. * objc.dg/try-catch-3.m, objc.dg/try-catch-4.m: Likewise. * objc.dg/try-catch-2.m: Likewise. Enable everywhere. Remove shadowed catch clause. * objc.dg/try-catch-5.m: New. From-SVN: r83332
2004-06-18 03:20:53 +02:00
for (; !tsi_end_p (i); tsi_next (&i))
{
c-common.c (flag_objc_sjlj_exceptions): New. * c-common.c (flag_objc_sjlj_exceptions): New. * c-common.h (flag_objc_sjlj_exceptions): Declare. * c-opts.c (c_common_handle_option): Set it. (c_common_post_options): Handle interation of different objective-c exception and runtime switches. * c-decl.c (c_eh_initialized_p): New. (finish_decl): Use it instead of local eh_initialized_p. * c-parse.in (nested_function, notype_nested_function): Record the result of compstmt. (compstmt_or_error): Likewise. (compstmt): Don't add_stmt the result. (stmt): Don't return anything. Rewrite objc try and sync rules. (objc_try_stmt, objc_catch_list): Remove. (objc_catch_block, objc_finally_block): Remove. (objc_catch_prefix, objc_catch_clause, objc_opt_catch_list): New. (objc_try_catch_clause, objc_finally_clause): New. (objc_try_catch_stmt): Rewrite. * c-tree.h (c_eh_initialized_p): Declare. * c-opt (fobjc-sjlj-exceptions): New. * except.c (output_function_exception_table): Don't call cgraph on non-decls. * objc/objc-act.c (UTAG_EXCDATA_VAR, UTAG_CAUGHTEXC_VAR, UTAG_RETHROWEXC_VAR, UTAG_EVALONCE_VAR, struct val_stack, catch_count_stack, exc_binding_stack, if_nesting_count, blk_nesting_count, objc_enter_block, objc_exit_block, objc_declare_variable, 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): Remove. (objc_create_temporary_var, struct objc_try_context, cur_try_context, objc_eh_runtime_type, objc_init_exceptions, objc_build_exc_ptr, next_sjlj_build_try_exit, next_sjlj_build_enter_and_setjmp, next_sjlj_build_exc_extract, next_sjlj_build_catch_list, next_sjlj_build_try_catch_finally, objc_begin_try_stmt, objc_begin_catch_clause, objc_finish_catch_clause, objc_build_finally_clause, objc_finish_try_stmt, objc_build_synchronized): New. (objc_is_object_id, objc_is_class_id): New. (objc_comptypes): Use them. (build_next_objc_exception_stuff): Break NeXT sjlj out from build_objc_exception_stuff. (synth_module_prologue): Update to match. (objc_build_throw_stmt): Use cur_try_context to decide if we're in a @catch. * objc/objc-act.h: Update prototypes. (OCTI_EXCEPTION_BLK_STACK, objc_exception_block_stack): Remove. testsuite/ * objc.dg/sync-1.m: New. * objc.dg/try-catch-1.m: Don't force next runtime. * objc.dg/try-catch-3.m, objc.dg/try-catch-4.m: Likewise. * objc.dg/try-catch-2.m: Likewise. Enable everywhere. Remove shadowed catch clause. * objc.dg/try-catch-5.m: New. From-SVN: r83332
2004-06-18 03:20:53 +02:00
tree stmt = tsi_stmt (i);
tree type = CATCH_TYPES (stmt);
tree body = CATCH_BODY (stmt);
if (type == NULL)
{
c-common.c (flag_objc_sjlj_exceptions): New. * c-common.c (flag_objc_sjlj_exceptions): New. * c-common.h (flag_objc_sjlj_exceptions): Declare. * c-opts.c (c_common_handle_option): Set it. (c_common_post_options): Handle interation of different objective-c exception and runtime switches. * c-decl.c (c_eh_initialized_p): New. (finish_decl): Use it instead of local eh_initialized_p. * c-parse.in (nested_function, notype_nested_function): Record the result of compstmt. (compstmt_or_error): Likewise. (compstmt): Don't add_stmt the result. (stmt): Don't return anything. Rewrite objc try and sync rules. (objc_try_stmt, objc_catch_list): Remove. (objc_catch_block, objc_finally_block): Remove. (objc_catch_prefix, objc_catch_clause, objc_opt_catch_list): New. (objc_try_catch_clause, objc_finally_clause): New. (objc_try_catch_stmt): Rewrite. * c-tree.h (c_eh_initialized_p): Declare. * c-opt (fobjc-sjlj-exceptions): New. * except.c (output_function_exception_table): Don't call cgraph on non-decls. * objc/objc-act.c (UTAG_EXCDATA_VAR, UTAG_CAUGHTEXC_VAR, UTAG_RETHROWEXC_VAR, UTAG_EVALONCE_VAR, struct val_stack, catch_count_stack, exc_binding_stack, if_nesting_count, blk_nesting_count, objc_enter_block, objc_exit_block, objc_declare_variable, 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): Remove. (objc_create_temporary_var, struct objc_try_context, cur_try_context, objc_eh_runtime_type, objc_init_exceptions, objc_build_exc_ptr, next_sjlj_build_try_exit, next_sjlj_build_enter_and_setjmp, next_sjlj_build_exc_extract, next_sjlj_build_catch_list, next_sjlj_build_try_catch_finally, objc_begin_try_stmt, objc_begin_catch_clause, objc_finish_catch_clause, objc_build_finally_clause, objc_finish_try_stmt, objc_build_synchronized): New. (objc_is_object_id, objc_is_class_id): New. (objc_comptypes): Use them. (build_next_objc_exception_stuff): Break NeXT sjlj out from build_objc_exception_stuff. (synth_module_prologue): Update to match. (objc_build_throw_stmt): Use cur_try_context to decide if we're in a @catch. * objc/objc-act.h: Update prototypes. (OCTI_EXCEPTION_BLK_STACK, objc_exception_block_stack): Remove. testsuite/ * objc.dg/sync-1.m: New. * objc.dg/try-catch-1.m: Don't force next runtime. * objc.dg/try-catch-3.m, objc.dg/try-catch-4.m: Likewise. * objc.dg/try-catch-2.m: Likewise. Enable everywhere. Remove shadowed catch clause. * objc.dg/try-catch-5.m: New. From-SVN: r83332
2004-06-18 03:20:53 +02:00
*last = body;
saw_id = true;
break;
}
c-common.c (flag_objc_sjlj_exceptions): New. * c-common.c (flag_objc_sjlj_exceptions): New. * c-common.h (flag_objc_sjlj_exceptions): Declare. * c-opts.c (c_common_handle_option): Set it. (c_common_post_options): Handle interation of different objective-c exception and runtime switches. * c-decl.c (c_eh_initialized_p): New. (finish_decl): Use it instead of local eh_initialized_p. * c-parse.in (nested_function, notype_nested_function): Record the result of compstmt. (compstmt_or_error): Likewise. (compstmt): Don't add_stmt the result. (stmt): Don't return anything. Rewrite objc try and sync rules. (objc_try_stmt, objc_catch_list): Remove. (objc_catch_block, objc_finally_block): Remove. (objc_catch_prefix, objc_catch_clause, objc_opt_catch_list): New. (objc_try_catch_clause, objc_finally_clause): New. (objc_try_catch_stmt): Rewrite. * c-tree.h (c_eh_initialized_p): Declare. * c-opt (fobjc-sjlj-exceptions): New. * except.c (output_function_exception_table): Don't call cgraph on non-decls. * objc/objc-act.c (UTAG_EXCDATA_VAR, UTAG_CAUGHTEXC_VAR, UTAG_RETHROWEXC_VAR, UTAG_EVALONCE_VAR, struct val_stack, catch_count_stack, exc_binding_stack, if_nesting_count, blk_nesting_count, objc_enter_block, objc_exit_block, objc_declare_variable, 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): Remove. (objc_create_temporary_var, struct objc_try_context, cur_try_context, objc_eh_runtime_type, objc_init_exceptions, objc_build_exc_ptr, next_sjlj_build_try_exit, next_sjlj_build_enter_and_setjmp, next_sjlj_build_exc_extract, next_sjlj_build_catch_list, next_sjlj_build_try_catch_finally, objc_begin_try_stmt, objc_begin_catch_clause, objc_finish_catch_clause, objc_build_finally_clause, objc_finish_try_stmt, objc_build_synchronized): New. (objc_is_object_id, objc_is_class_id): New. (objc_comptypes): Use them. (build_next_objc_exception_stuff): Break NeXT sjlj out from build_objc_exception_stuff. (synth_module_prologue): Update to match. (objc_build_throw_stmt): Use cur_try_context to decide if we're in a @catch. * objc/objc-act.h: Update prototypes. (OCTI_EXCEPTION_BLK_STACK, objc_exception_block_stack): Remove. testsuite/ * objc.dg/sync-1.m: New. * objc.dg/try-catch-1.m: Don't force next runtime. * objc.dg/try-catch-3.m, objc.dg/try-catch-4.m: Likewise. * objc.dg/try-catch-2.m: Likewise. Enable everywhere. Remove shadowed catch clause. * objc.dg/try-catch-5.m: New. From-SVN: r83332
2004-06-18 03:20:53 +02:00
else
{
tree args, cond;
c-common.c (flag_objc_sjlj_exceptions): New. * c-common.c (flag_objc_sjlj_exceptions): New. * c-common.h (flag_objc_sjlj_exceptions): Declare. * c-opts.c (c_common_handle_option): Set it. (c_common_post_options): Handle interation of different objective-c exception and runtime switches. * c-decl.c (c_eh_initialized_p): New. (finish_decl): Use it instead of local eh_initialized_p. * c-parse.in (nested_function, notype_nested_function): Record the result of compstmt. (compstmt_or_error): Likewise. (compstmt): Don't add_stmt the result. (stmt): Don't return anything. Rewrite objc try and sync rules. (objc_try_stmt, objc_catch_list): Remove. (objc_catch_block, objc_finally_block): Remove. (objc_catch_prefix, objc_catch_clause, objc_opt_catch_list): New. (objc_try_catch_clause, objc_finally_clause): New. (objc_try_catch_stmt): Rewrite. * c-tree.h (c_eh_initialized_p): Declare. * c-opt (fobjc-sjlj-exceptions): New. * except.c (output_function_exception_table): Don't call cgraph on non-decls. * objc/objc-act.c (UTAG_EXCDATA_VAR, UTAG_CAUGHTEXC_VAR, UTAG_RETHROWEXC_VAR, UTAG_EVALONCE_VAR, struct val_stack, catch_count_stack, exc_binding_stack, if_nesting_count, blk_nesting_count, objc_enter_block, objc_exit_block, objc_declare_variable, 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): Remove. (objc_create_temporary_var, struct objc_try_context, cur_try_context, objc_eh_runtime_type, objc_init_exceptions, objc_build_exc_ptr, next_sjlj_build_try_exit, next_sjlj_build_enter_and_setjmp, next_sjlj_build_exc_extract, next_sjlj_build_catch_list, next_sjlj_build_try_catch_finally, objc_begin_try_stmt, objc_begin_catch_clause, objc_finish_catch_clause, objc_build_finally_clause, objc_finish_try_stmt, objc_build_synchronized): New. (objc_is_object_id, objc_is_class_id): New. (objc_comptypes): Use them. (build_next_objc_exception_stuff): Break NeXT sjlj out from build_objc_exception_stuff. (synth_module_prologue): Update to match. (objc_build_throw_stmt): Use cur_try_context to decide if we're in a @catch. * objc/objc-act.h: Update prototypes. (OCTI_EXCEPTION_BLK_STACK, objc_exception_block_stack): Remove. testsuite/ * objc.dg/sync-1.m: New. * objc.dg/try-catch-1.m: Don't force next runtime. * objc.dg/try-catch-3.m, objc.dg/try-catch-4.m: Likewise. * objc.dg/try-catch-2.m: Likewise. Enable everywhere. Remove shadowed catch clause. * objc.dg/try-catch-5.m: New. From-SVN: r83332
2004-06-18 03:20:53 +02:00
if (type == error_mark_node)
cond = error_mark_node;
else
{
args = tree_cons (NULL, cur_try_context->caught_decl, NULL);
c-parse.in (primary): Call objc_build_message_expr()... [gcc/ChangeLog] 2004-09-01 Ziemowit Laski <zlaski@apple.com> * c-parse.in (primary): Call objc_build_message_expr(), objc_build_selector_expr(), objc_build_protocol_expr(), objc_build_encode_expr() and objc_build_string_object() instead of build_message_expr(), build_selector_expr(), build_protocol_expr(), build_encode_expr() and build_objc_string_object(), respectively. (component_decl_list2): Call objc_get_class_ivars() instead of get_class_ivars_from_name(). (keyworddecl): Call objc_build_keyword_decl() instead of build_keyword_decl(). (receiver): Call objc_get_class_reference() instead of get_class_reference(). (reswords): Add blank line before @@ifobjc section, for clarity. [gcc/objc/ChangeLog] 2004-09-01 Ziemowit Laski <zlaski@apple.com> * objc-act.c (objc_check_decl): Use OBJC_TYPE_NAME macro instead of TYPE_NAME. (build_objc_string_object): Rename to objc_build_string_object(). (get_class_reference): Rename to objc_get_class_reference(). (get_class_ivars_from_name): Rename to objc_get_class_ivars(). (next_sjlj_build_catch_list, get_super_receiver): Call objc_get_class_reference() instead of get_class_reference(). (build_keyword_decl): Rename to objc_build_keyword_decl(). (build_message_expr): Rename to objc_build_message_expr(). (build_protocol_expr): Rename to objc_build_protocol_expr(). (build_selector_expr): Rename to objc_build_selector_expr(). (build_encode_expr): Rename to objc_build_encode_expr(). * objc-act.h (get_class_ivars_from_name): Rename prototype to objc_get_class_ivars(). (get_class_reference): Rename prototype to objc_get_class_reference(). (build_message_expr): Rename prototype to objc_build_message_expr(). (build_selector_expr): Rename prototype to objc_build_selector_expr(). (build_keyword_decl): Rename prototype to objc_build_keyword_decl(). (build_protocol_expr): Rename prototype to objc_build_prototype_expr(). (build_objc_string_object): Rename prototype to objc_build_string_object(). From-SVN: r86950
2004-09-02 02:36:18 +02:00
t = objc_get_class_reference (OBJC_TYPE_NAME (TREE_TYPE (type)));
c-common.c (flag_objc_sjlj_exceptions): New. * c-common.c (flag_objc_sjlj_exceptions): New. * c-common.h (flag_objc_sjlj_exceptions): Declare. * c-opts.c (c_common_handle_option): Set it. (c_common_post_options): Handle interation of different objective-c exception and runtime switches. * c-decl.c (c_eh_initialized_p): New. (finish_decl): Use it instead of local eh_initialized_p. * c-parse.in (nested_function, notype_nested_function): Record the result of compstmt. (compstmt_or_error): Likewise. (compstmt): Don't add_stmt the result. (stmt): Don't return anything. Rewrite objc try and sync rules. (objc_try_stmt, objc_catch_list): Remove. (objc_catch_block, objc_finally_block): Remove. (objc_catch_prefix, objc_catch_clause, objc_opt_catch_list): New. (objc_try_catch_clause, objc_finally_clause): New. (objc_try_catch_stmt): Rewrite. * c-tree.h (c_eh_initialized_p): Declare. * c-opt (fobjc-sjlj-exceptions): New. * except.c (output_function_exception_table): Don't call cgraph on non-decls. * objc/objc-act.c (UTAG_EXCDATA_VAR, UTAG_CAUGHTEXC_VAR, UTAG_RETHROWEXC_VAR, UTAG_EVALONCE_VAR, struct val_stack, catch_count_stack, exc_binding_stack, if_nesting_count, blk_nesting_count, objc_enter_block, objc_exit_block, objc_declare_variable, 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): Remove. (objc_create_temporary_var, struct objc_try_context, cur_try_context, objc_eh_runtime_type, objc_init_exceptions, objc_build_exc_ptr, next_sjlj_build_try_exit, next_sjlj_build_enter_and_setjmp, next_sjlj_build_exc_extract, next_sjlj_build_catch_list, next_sjlj_build_try_catch_finally, objc_begin_try_stmt, objc_begin_catch_clause, objc_finish_catch_clause, objc_build_finally_clause, objc_finish_try_stmt, objc_build_synchronized): New. (objc_is_object_id, objc_is_class_id): New. (objc_comptypes): Use them. (build_next_objc_exception_stuff): Break NeXT sjlj out from build_objc_exception_stuff. (synth_module_prologue): Update to match. (objc_build_throw_stmt): Use cur_try_context to decide if we're in a @catch. * objc/objc-act.h: Update prototypes. (OCTI_EXCEPTION_BLK_STACK, objc_exception_block_stack): Remove. testsuite/ * objc.dg/sync-1.m: New. * objc.dg/try-catch-1.m: Don't force next runtime. * objc.dg/try-catch-3.m, objc.dg/try-catch-4.m: Likewise. * objc.dg/try-catch-2.m: Likewise. Enable everywhere. Remove shadowed catch clause. * objc.dg/try-catch-5.m: New. From-SVN: r83332
2004-06-18 03:20:53 +02:00
args = tree_cons (NULL, t, args);
t = build_function_call (objc_exception_match_decl, args);
cond = c_common_truthvalue_conversion (t);
c-common.c (flag_objc_sjlj_exceptions): New. * c-common.c (flag_objc_sjlj_exceptions): New. * c-common.h (flag_objc_sjlj_exceptions): Declare. * c-opts.c (c_common_handle_option): Set it. (c_common_post_options): Handle interation of different objective-c exception and runtime switches. * c-decl.c (c_eh_initialized_p): New. (finish_decl): Use it instead of local eh_initialized_p. * c-parse.in (nested_function, notype_nested_function): Record the result of compstmt. (compstmt_or_error): Likewise. (compstmt): Don't add_stmt the result. (stmt): Don't return anything. Rewrite objc try and sync rules. (objc_try_stmt, objc_catch_list): Remove. (objc_catch_block, objc_finally_block): Remove. (objc_catch_prefix, objc_catch_clause, objc_opt_catch_list): New. (objc_try_catch_clause, objc_finally_clause): New. (objc_try_catch_stmt): Rewrite. * c-tree.h (c_eh_initialized_p): Declare. * c-opt (fobjc-sjlj-exceptions): New. * except.c (output_function_exception_table): Don't call cgraph on non-decls. * objc/objc-act.c (UTAG_EXCDATA_VAR, UTAG_CAUGHTEXC_VAR, UTAG_RETHROWEXC_VAR, UTAG_EVALONCE_VAR, struct val_stack, catch_count_stack, exc_binding_stack, if_nesting_count, blk_nesting_count, objc_enter_block, objc_exit_block, objc_declare_variable, 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): Remove. (objc_create_temporary_var, struct objc_try_context, cur_try_context, objc_eh_runtime_type, objc_init_exceptions, objc_build_exc_ptr, next_sjlj_build_try_exit, next_sjlj_build_enter_and_setjmp, next_sjlj_build_exc_extract, next_sjlj_build_catch_list, next_sjlj_build_try_catch_finally, objc_begin_try_stmt, objc_begin_catch_clause, objc_finish_catch_clause, objc_build_finally_clause, objc_finish_try_stmt, objc_build_synchronized): New. (objc_is_object_id, objc_is_class_id): New. (objc_comptypes): Use them. (build_next_objc_exception_stuff): Break NeXT sjlj out from build_objc_exception_stuff. (synth_module_prologue): Update to match. (objc_build_throw_stmt): Use cur_try_context to decide if we're in a @catch. * objc/objc-act.h: Update prototypes. (OCTI_EXCEPTION_BLK_STACK, objc_exception_block_stack): Remove. testsuite/ * objc.dg/sync-1.m: New. * objc.dg/try-catch-1.m: Don't force next runtime. * objc.dg/try-catch-3.m, objc.dg/try-catch-4.m: Likewise. * objc.dg/try-catch-2.m: Likewise. Enable everywhere. Remove shadowed catch clause. * objc.dg/try-catch-5.m: New. From-SVN: r83332
2004-06-18 03:20:53 +02:00
}
t = build3 (COND_EXPR, void_type_node, cond, body, NULL);
c-common.c (flag_objc_sjlj_exceptions): New. * c-common.c (flag_objc_sjlj_exceptions): New. * c-common.h (flag_objc_sjlj_exceptions): Declare. * c-opts.c (c_common_handle_option): Set it. (c_common_post_options): Handle interation of different objective-c exception and runtime switches. * c-decl.c (c_eh_initialized_p): New. (finish_decl): Use it instead of local eh_initialized_p. * c-parse.in (nested_function, notype_nested_function): Record the result of compstmt. (compstmt_or_error): Likewise. (compstmt): Don't add_stmt the result. (stmt): Don't return anything. Rewrite objc try and sync rules. (objc_try_stmt, objc_catch_list): Remove. (objc_catch_block, objc_finally_block): Remove. (objc_catch_prefix, objc_catch_clause, objc_opt_catch_list): New. (objc_try_catch_clause, objc_finally_clause): New. (objc_try_catch_stmt): Rewrite. * c-tree.h (c_eh_initialized_p): Declare. * c-opt (fobjc-sjlj-exceptions): New. * except.c (output_function_exception_table): Don't call cgraph on non-decls. * objc/objc-act.c (UTAG_EXCDATA_VAR, UTAG_CAUGHTEXC_VAR, UTAG_RETHROWEXC_VAR, UTAG_EVALONCE_VAR, struct val_stack, catch_count_stack, exc_binding_stack, if_nesting_count, blk_nesting_count, objc_enter_block, objc_exit_block, objc_declare_variable, 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): Remove. (objc_create_temporary_var, struct objc_try_context, cur_try_context, objc_eh_runtime_type, objc_init_exceptions, objc_build_exc_ptr, next_sjlj_build_try_exit, next_sjlj_build_enter_and_setjmp, next_sjlj_build_exc_extract, next_sjlj_build_catch_list, next_sjlj_build_try_catch_finally, objc_begin_try_stmt, objc_begin_catch_clause, objc_finish_catch_clause, objc_build_finally_clause, objc_finish_try_stmt, objc_build_synchronized): New. (objc_is_object_id, objc_is_class_id): New. (objc_comptypes): Use them. (build_next_objc_exception_stuff): Break NeXT sjlj out from build_objc_exception_stuff. (synth_module_prologue): Update to match. (objc_build_throw_stmt): Use cur_try_context to decide if we're in a @catch. * objc/objc-act.h: Update prototypes. (OCTI_EXCEPTION_BLK_STACK, objc_exception_block_stack): Remove. testsuite/ * objc.dg/sync-1.m: New. * objc.dg/try-catch-1.m: Don't force next runtime. * objc.dg/try-catch-3.m, objc.dg/try-catch-4.m: Likewise. * objc.dg/try-catch-2.m: Likewise. Enable everywhere. Remove shadowed catch clause. * objc.dg/try-catch-5.m: New. From-SVN: r83332
2004-06-18 03:20:53 +02:00
SET_EXPR_LOCUS (t, EXPR_LOCUS (stmt));
c-common.c (flag_objc_sjlj_exceptions): New. * c-common.c (flag_objc_sjlj_exceptions): New. * c-common.h (flag_objc_sjlj_exceptions): Declare. * c-opts.c (c_common_handle_option): Set it. (c_common_post_options): Handle interation of different objective-c exception and runtime switches. * c-decl.c (c_eh_initialized_p): New. (finish_decl): Use it instead of local eh_initialized_p. * c-parse.in (nested_function, notype_nested_function): Record the result of compstmt. (compstmt_or_error): Likewise. (compstmt): Don't add_stmt the result. (stmt): Don't return anything. Rewrite objc try and sync rules. (objc_try_stmt, objc_catch_list): Remove. (objc_catch_block, objc_finally_block): Remove. (objc_catch_prefix, objc_catch_clause, objc_opt_catch_list): New. (objc_try_catch_clause, objc_finally_clause): New. (objc_try_catch_stmt): Rewrite. * c-tree.h (c_eh_initialized_p): Declare. * c-opt (fobjc-sjlj-exceptions): New. * except.c (output_function_exception_table): Don't call cgraph on non-decls. * objc/objc-act.c (UTAG_EXCDATA_VAR, UTAG_CAUGHTEXC_VAR, UTAG_RETHROWEXC_VAR, UTAG_EVALONCE_VAR, struct val_stack, catch_count_stack, exc_binding_stack, if_nesting_count, blk_nesting_count, objc_enter_block, objc_exit_block, objc_declare_variable, 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): Remove. (objc_create_temporary_var, struct objc_try_context, cur_try_context, objc_eh_runtime_type, objc_init_exceptions, objc_build_exc_ptr, next_sjlj_build_try_exit, next_sjlj_build_enter_and_setjmp, next_sjlj_build_exc_extract, next_sjlj_build_catch_list, next_sjlj_build_try_catch_finally, objc_begin_try_stmt, objc_begin_catch_clause, objc_finish_catch_clause, objc_build_finally_clause, objc_finish_try_stmt, objc_build_synchronized): New. (objc_is_object_id, objc_is_class_id): New. (objc_comptypes): Use them. (build_next_objc_exception_stuff): Break NeXT sjlj out from build_objc_exception_stuff. (synth_module_prologue): Update to match. (objc_build_throw_stmt): Use cur_try_context to decide if we're in a @catch. * objc/objc-act.h: Update prototypes. (OCTI_EXCEPTION_BLK_STACK, objc_exception_block_stack): Remove. testsuite/ * objc.dg/sync-1.m: New. * objc.dg/try-catch-1.m: Don't force next runtime. * objc.dg/try-catch-3.m, objc.dg/try-catch-4.m: Likewise. * objc.dg/try-catch-2.m: Likewise. Enable everywhere. Remove shadowed catch clause. * objc.dg/try-catch-5.m: New. From-SVN: r83332
2004-06-18 03:20:53 +02:00
*last = t;
last = &COND_EXPR_ELSE (t);
}
}
c-common.c (flag_objc_sjlj_exceptions): New. * c-common.c (flag_objc_sjlj_exceptions): New. * c-common.h (flag_objc_sjlj_exceptions): Declare. * c-opts.c (c_common_handle_option): Set it. (c_common_post_options): Handle interation of different objective-c exception and runtime switches. * c-decl.c (c_eh_initialized_p): New. (finish_decl): Use it instead of local eh_initialized_p. * c-parse.in (nested_function, notype_nested_function): Record the result of compstmt. (compstmt_or_error): Likewise. (compstmt): Don't add_stmt the result. (stmt): Don't return anything. Rewrite objc try and sync rules. (objc_try_stmt, objc_catch_list): Remove. (objc_catch_block, objc_finally_block): Remove. (objc_catch_prefix, objc_catch_clause, objc_opt_catch_list): New. (objc_try_catch_clause, objc_finally_clause): New. (objc_try_catch_stmt): Rewrite. * c-tree.h (c_eh_initialized_p): Declare. * c-opt (fobjc-sjlj-exceptions): New. * except.c (output_function_exception_table): Don't call cgraph on non-decls. * objc/objc-act.c (UTAG_EXCDATA_VAR, UTAG_CAUGHTEXC_VAR, UTAG_RETHROWEXC_VAR, UTAG_EVALONCE_VAR, struct val_stack, catch_count_stack, exc_binding_stack, if_nesting_count, blk_nesting_count, objc_enter_block, objc_exit_block, objc_declare_variable, 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): Remove. (objc_create_temporary_var, struct objc_try_context, cur_try_context, objc_eh_runtime_type, objc_init_exceptions, objc_build_exc_ptr, next_sjlj_build_try_exit, next_sjlj_build_enter_and_setjmp, next_sjlj_build_exc_extract, next_sjlj_build_catch_list, next_sjlj_build_try_catch_finally, objc_begin_try_stmt, objc_begin_catch_clause, objc_finish_catch_clause, objc_build_finally_clause, objc_finish_try_stmt, objc_build_synchronized): New. (objc_is_object_id, objc_is_class_id): New. (objc_comptypes): Use them. (build_next_objc_exception_stuff): Break NeXT sjlj out from build_objc_exception_stuff. (synth_module_prologue): Update to match. (objc_build_throw_stmt): Use cur_try_context to decide if we're in a @catch. * objc/objc-act.h: Update prototypes. (OCTI_EXCEPTION_BLK_STACK, objc_exception_block_stack): Remove. testsuite/ * objc.dg/sync-1.m: New. * objc.dg/try-catch-1.m: Don't force next runtime. * objc.dg/try-catch-3.m, objc.dg/try-catch-4.m: Likewise. * objc.dg/try-catch-2.m: Likewise. Enable everywhere. Remove shadowed catch clause. * objc.dg/try-catch-5.m: New. From-SVN: r83332
2004-06-18 03:20:53 +02:00
if (!saw_id)
{
t = build2 (MODIFY_EXPR, void_type_node, cur_try_context->rethrow_decl,
cur_try_context->caught_decl);
SET_EXPR_LOCATION (t, cur_try_context->end_catch_locus);
c-common.c (flag_objc_sjlj_exceptions): New. * c-common.c (flag_objc_sjlj_exceptions): New. * c-common.h (flag_objc_sjlj_exceptions): Declare. * c-opts.c (c_common_handle_option): Set it. (c_common_post_options): Handle interation of different objective-c exception and runtime switches. * c-decl.c (c_eh_initialized_p): New. (finish_decl): Use it instead of local eh_initialized_p. * c-parse.in (nested_function, notype_nested_function): Record the result of compstmt. (compstmt_or_error): Likewise. (compstmt): Don't add_stmt the result. (stmt): Don't return anything. Rewrite objc try and sync rules. (objc_try_stmt, objc_catch_list): Remove. (objc_catch_block, objc_finally_block): Remove. (objc_catch_prefix, objc_catch_clause, objc_opt_catch_list): New. (objc_try_catch_clause, objc_finally_clause): New. (objc_try_catch_stmt): Rewrite. * c-tree.h (c_eh_initialized_p): Declare. * c-opt (fobjc-sjlj-exceptions): New. * except.c (output_function_exception_table): Don't call cgraph on non-decls. * objc/objc-act.c (UTAG_EXCDATA_VAR, UTAG_CAUGHTEXC_VAR, UTAG_RETHROWEXC_VAR, UTAG_EVALONCE_VAR, struct val_stack, catch_count_stack, exc_binding_stack, if_nesting_count, blk_nesting_count, objc_enter_block, objc_exit_block, objc_declare_variable, 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): Remove. (objc_create_temporary_var, struct objc_try_context, cur_try_context, objc_eh_runtime_type, objc_init_exceptions, objc_build_exc_ptr, next_sjlj_build_try_exit, next_sjlj_build_enter_and_setjmp, next_sjlj_build_exc_extract, next_sjlj_build_catch_list, next_sjlj_build_try_catch_finally, objc_begin_try_stmt, objc_begin_catch_clause, objc_finish_catch_clause, objc_build_finally_clause, objc_finish_try_stmt, objc_build_synchronized): New. (objc_is_object_id, objc_is_class_id): New. (objc_comptypes): Use them. (build_next_objc_exception_stuff): Break NeXT sjlj out from build_objc_exception_stuff. (synth_module_prologue): Update to match. (objc_build_throw_stmt): Use cur_try_context to decide if we're in a @catch. * objc/objc-act.h: Update prototypes. (OCTI_EXCEPTION_BLK_STACK, objc_exception_block_stack): Remove. testsuite/ * objc.dg/sync-1.m: New. * objc.dg/try-catch-1.m: Don't force next runtime. * objc.dg/try-catch-3.m, objc.dg/try-catch-4.m: Likewise. * objc.dg/try-catch-2.m: Likewise. Enable everywhere. Remove shadowed catch clause. * objc.dg/try-catch-5.m: New. From-SVN: r83332
2004-06-18 03:20:53 +02:00
append_to_statement_list (t, last);
t = next_sjlj_build_try_exit ();
SET_EXPR_LOCATION (t, cur_try_context->end_catch_locus);
c-common.c (flag_objc_sjlj_exceptions): New. * c-common.c (flag_objc_sjlj_exceptions): New. * c-common.h (flag_objc_sjlj_exceptions): Declare. * c-opts.c (c_common_handle_option): Set it. (c_common_post_options): Handle interation of different objective-c exception and runtime switches. * c-decl.c (c_eh_initialized_p): New. (finish_decl): Use it instead of local eh_initialized_p. * c-parse.in (nested_function, notype_nested_function): Record the result of compstmt. (compstmt_or_error): Likewise. (compstmt): Don't add_stmt the result. (stmt): Don't return anything. Rewrite objc try and sync rules. (objc_try_stmt, objc_catch_list): Remove. (objc_catch_block, objc_finally_block): Remove. (objc_catch_prefix, objc_catch_clause, objc_opt_catch_list): New. (objc_try_catch_clause, objc_finally_clause): New. (objc_try_catch_stmt): Rewrite. * c-tree.h (c_eh_initialized_p): Declare. * c-opt (fobjc-sjlj-exceptions): New. * except.c (output_function_exception_table): Don't call cgraph on non-decls. * objc/objc-act.c (UTAG_EXCDATA_VAR, UTAG_CAUGHTEXC_VAR, UTAG_RETHROWEXC_VAR, UTAG_EVALONCE_VAR, struct val_stack, catch_count_stack, exc_binding_stack, if_nesting_count, blk_nesting_count, objc_enter_block, objc_exit_block, objc_declare_variable, 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): Remove. (objc_create_temporary_var, struct objc_try_context, cur_try_context, objc_eh_runtime_type, objc_init_exceptions, objc_build_exc_ptr, next_sjlj_build_try_exit, next_sjlj_build_enter_and_setjmp, next_sjlj_build_exc_extract, next_sjlj_build_catch_list, next_sjlj_build_try_catch_finally, objc_begin_try_stmt, objc_begin_catch_clause, objc_finish_catch_clause, objc_build_finally_clause, objc_finish_try_stmt, objc_build_synchronized): New. (objc_is_object_id, objc_is_class_id): New. (objc_comptypes): Use them. (build_next_objc_exception_stuff): Break NeXT sjlj out from build_objc_exception_stuff. (synth_module_prologue): Update to match. (objc_build_throw_stmt): Use cur_try_context to decide if we're in a @catch. * objc/objc-act.h: Update prototypes. (OCTI_EXCEPTION_BLK_STACK, objc_exception_block_stack): Remove. testsuite/ * objc.dg/sync-1.m: New. * objc.dg/try-catch-1.m: Don't force next runtime. * objc.dg/try-catch-3.m, objc.dg/try-catch-4.m: Likewise. * objc.dg/try-catch-2.m: Likewise. Enable everywhere. Remove shadowed catch clause. * objc.dg/try-catch-5.m: New. From-SVN: r83332
2004-06-18 03:20:53 +02:00
append_to_statement_list (t, last);
}
c-common.c (flag_objc_sjlj_exceptions): New. * c-common.c (flag_objc_sjlj_exceptions): New. * c-common.h (flag_objc_sjlj_exceptions): Declare. * c-opts.c (c_common_handle_option): Set it. (c_common_post_options): Handle interation of different objective-c exception and runtime switches. * c-decl.c (c_eh_initialized_p): New. (finish_decl): Use it instead of local eh_initialized_p. * c-parse.in (nested_function, notype_nested_function): Record the result of compstmt. (compstmt_or_error): Likewise. (compstmt): Don't add_stmt the result. (stmt): Don't return anything. Rewrite objc try and sync rules. (objc_try_stmt, objc_catch_list): Remove. (objc_catch_block, objc_finally_block): Remove. (objc_catch_prefix, objc_catch_clause, objc_opt_catch_list): New. (objc_try_catch_clause, objc_finally_clause): New. (objc_try_catch_stmt): Rewrite. * c-tree.h (c_eh_initialized_p): Declare. * c-opt (fobjc-sjlj-exceptions): New. * except.c (output_function_exception_table): Don't call cgraph on non-decls. * objc/objc-act.c (UTAG_EXCDATA_VAR, UTAG_CAUGHTEXC_VAR, UTAG_RETHROWEXC_VAR, UTAG_EVALONCE_VAR, struct val_stack, catch_count_stack, exc_binding_stack, if_nesting_count, blk_nesting_count, objc_enter_block, objc_exit_block, objc_declare_variable, 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): Remove. (objc_create_temporary_var, struct objc_try_context, cur_try_context, objc_eh_runtime_type, objc_init_exceptions, objc_build_exc_ptr, next_sjlj_build_try_exit, next_sjlj_build_enter_and_setjmp, next_sjlj_build_exc_extract, next_sjlj_build_catch_list, next_sjlj_build_try_catch_finally, objc_begin_try_stmt, objc_begin_catch_clause, objc_finish_catch_clause, objc_build_finally_clause, objc_finish_try_stmt, objc_build_synchronized): New. (objc_is_object_id, objc_is_class_id): New. (objc_comptypes): Use them. (build_next_objc_exception_stuff): Break NeXT sjlj out from build_objc_exception_stuff. (synth_module_prologue): Update to match. (objc_build_throw_stmt): Use cur_try_context to decide if we're in a @catch. * objc/objc-act.h: Update prototypes. (OCTI_EXCEPTION_BLK_STACK, objc_exception_block_stack): Remove. testsuite/ * objc.dg/sync-1.m: New. * objc.dg/try-catch-1.m: Don't force next runtime. * objc.dg/try-catch-3.m, objc.dg/try-catch-4.m: Likewise. * objc.dg/try-catch-2.m: Likewise. Enable everywhere. Remove shadowed catch clause. * objc.dg/try-catch-5.m: New. From-SVN: r83332
2004-06-18 03:20:53 +02:00
return catch_seq;
}
c-common.c (flag_objc_sjlj_exceptions): New. * c-common.c (flag_objc_sjlj_exceptions): New. * c-common.h (flag_objc_sjlj_exceptions): Declare. * c-opts.c (c_common_handle_option): Set it. (c_common_post_options): Handle interation of different objective-c exception and runtime switches. * c-decl.c (c_eh_initialized_p): New. (finish_decl): Use it instead of local eh_initialized_p. * c-parse.in (nested_function, notype_nested_function): Record the result of compstmt. (compstmt_or_error): Likewise. (compstmt): Don't add_stmt the result. (stmt): Don't return anything. Rewrite objc try and sync rules. (objc_try_stmt, objc_catch_list): Remove. (objc_catch_block, objc_finally_block): Remove. (objc_catch_prefix, objc_catch_clause, objc_opt_catch_list): New. (objc_try_catch_clause, objc_finally_clause): New. (objc_try_catch_stmt): Rewrite. * c-tree.h (c_eh_initialized_p): Declare. * c-opt (fobjc-sjlj-exceptions): New. * except.c (output_function_exception_table): Don't call cgraph on non-decls. * objc/objc-act.c (UTAG_EXCDATA_VAR, UTAG_CAUGHTEXC_VAR, UTAG_RETHROWEXC_VAR, UTAG_EVALONCE_VAR, struct val_stack, catch_count_stack, exc_binding_stack, if_nesting_count, blk_nesting_count, objc_enter_block, objc_exit_block, objc_declare_variable, 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): Remove. (objc_create_temporary_var, struct objc_try_context, cur_try_context, objc_eh_runtime_type, objc_init_exceptions, objc_build_exc_ptr, next_sjlj_build_try_exit, next_sjlj_build_enter_and_setjmp, next_sjlj_build_exc_extract, next_sjlj_build_catch_list, next_sjlj_build_try_catch_finally, objc_begin_try_stmt, objc_begin_catch_clause, objc_finish_catch_clause, objc_build_finally_clause, objc_finish_try_stmt, objc_build_synchronized): New. (objc_is_object_id, objc_is_class_id): New. (objc_comptypes): Use them. (build_next_objc_exception_stuff): Break NeXT sjlj out from build_objc_exception_stuff. (synth_module_prologue): Update to match. (objc_build_throw_stmt): Use cur_try_context to decide if we're in a @catch. * objc/objc-act.h: Update prototypes. (OCTI_EXCEPTION_BLK_STACK, objc_exception_block_stack): Remove. testsuite/ * objc.dg/sync-1.m: New. * objc.dg/try-catch-1.m: Don't force next runtime. * objc.dg/try-catch-3.m, objc.dg/try-catch-4.m: Likewise. * objc.dg/try-catch-2.m: Likewise. Enable everywhere. Remove shadowed catch clause. * objc.dg/try-catch-5.m: New. From-SVN: r83332
2004-06-18 03:20:53 +02:00
/* Build a complete @try-@catch-@finally block for legacy Darwin setjmp
exception handling. We aim to build:
{
struct _objc_exception_data _stack;
id volatile _rethrow = 0;
try
{
objc_exception_try_enter (&_stack);
if (_setjmp(&_stack.buf))
{
id _caught = objc_exception_extract(&_stack);
objc_exception_try_enter (&_stack);
if (_setjmp(&_stack.buf))
_rethrow = objc_exception_extract(&_stack);
else
CATCH-LIST
}
else
TRY-BLOCK
}
finally
{
if (!_rethrow)
objc_exception_try_exit(&_stack);
FINALLY-BLOCK
if (_rethrow)
objc_exception_throw(_rethrow);
}
}
c-common.c (flag_objc_sjlj_exceptions): New. * c-common.c (flag_objc_sjlj_exceptions): New. * c-common.h (flag_objc_sjlj_exceptions): Declare. * c-opts.c (c_common_handle_option): Set it. (c_common_post_options): Handle interation of different objective-c exception and runtime switches. * c-decl.c (c_eh_initialized_p): New. (finish_decl): Use it instead of local eh_initialized_p. * c-parse.in (nested_function, notype_nested_function): Record the result of compstmt. (compstmt_or_error): Likewise. (compstmt): Don't add_stmt the result. (stmt): Don't return anything. Rewrite objc try and sync rules. (objc_try_stmt, objc_catch_list): Remove. (objc_catch_block, objc_finally_block): Remove. (objc_catch_prefix, objc_catch_clause, objc_opt_catch_list): New. (objc_try_catch_clause, objc_finally_clause): New. (objc_try_catch_stmt): Rewrite. * c-tree.h (c_eh_initialized_p): Declare. * c-opt (fobjc-sjlj-exceptions): New. * except.c (output_function_exception_table): Don't call cgraph on non-decls. * objc/objc-act.c (UTAG_EXCDATA_VAR, UTAG_CAUGHTEXC_VAR, UTAG_RETHROWEXC_VAR, UTAG_EVALONCE_VAR, struct val_stack, catch_count_stack, exc_binding_stack, if_nesting_count, blk_nesting_count, objc_enter_block, objc_exit_block, objc_declare_variable, 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): Remove. (objc_create_temporary_var, struct objc_try_context, cur_try_context, objc_eh_runtime_type, objc_init_exceptions, objc_build_exc_ptr, next_sjlj_build_try_exit, next_sjlj_build_enter_and_setjmp, next_sjlj_build_exc_extract, next_sjlj_build_catch_list, next_sjlj_build_try_catch_finally, objc_begin_try_stmt, objc_begin_catch_clause, objc_finish_catch_clause, objc_build_finally_clause, objc_finish_try_stmt, objc_build_synchronized): New. (objc_is_object_id, objc_is_class_id): New. (objc_comptypes): Use them. (build_next_objc_exception_stuff): Break NeXT sjlj out from build_objc_exception_stuff. (synth_module_prologue): Update to match. (objc_build_throw_stmt): Use cur_try_context to decide if we're in a @catch. * objc/objc-act.h: Update prototypes. (OCTI_EXCEPTION_BLK_STACK, objc_exception_block_stack): Remove. testsuite/ * objc.dg/sync-1.m: New. * objc.dg/try-catch-1.m: Don't force next runtime. * objc.dg/try-catch-3.m, objc.dg/try-catch-4.m: Likewise. * objc.dg/try-catch-2.m: Likewise. Enable everywhere. Remove shadowed catch clause. * objc.dg/try-catch-5.m: New. From-SVN: r83332
2004-06-18 03:20:53 +02:00
If CATCH-LIST is empty, we can omit all of the block containing
"_caught" except for the setting of _rethrow. Note the use of
a real TRY_FINALLY_EXPR here, which is not involved in EH per-se,
but handles goto and other exits from the block. */
c-common.c (flag_objc_sjlj_exceptions): New. * c-common.c (flag_objc_sjlj_exceptions): New. * c-common.h (flag_objc_sjlj_exceptions): Declare. * c-opts.c (c_common_handle_option): Set it. (c_common_post_options): Handle interation of different objective-c exception and runtime switches. * c-decl.c (c_eh_initialized_p): New. (finish_decl): Use it instead of local eh_initialized_p. * c-parse.in (nested_function, notype_nested_function): Record the result of compstmt. (compstmt_or_error): Likewise. (compstmt): Don't add_stmt the result. (stmt): Don't return anything. Rewrite objc try and sync rules. (objc_try_stmt, objc_catch_list): Remove. (objc_catch_block, objc_finally_block): Remove. (objc_catch_prefix, objc_catch_clause, objc_opt_catch_list): New. (objc_try_catch_clause, objc_finally_clause): New. (objc_try_catch_stmt): Rewrite. * c-tree.h (c_eh_initialized_p): Declare. * c-opt (fobjc-sjlj-exceptions): New. * except.c (output_function_exception_table): Don't call cgraph on non-decls. * objc/objc-act.c (UTAG_EXCDATA_VAR, UTAG_CAUGHTEXC_VAR, UTAG_RETHROWEXC_VAR, UTAG_EVALONCE_VAR, struct val_stack, catch_count_stack, exc_binding_stack, if_nesting_count, blk_nesting_count, objc_enter_block, objc_exit_block, objc_declare_variable, 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): Remove. (objc_create_temporary_var, struct objc_try_context, cur_try_context, objc_eh_runtime_type, objc_init_exceptions, objc_build_exc_ptr, next_sjlj_build_try_exit, next_sjlj_build_enter_and_setjmp, next_sjlj_build_exc_extract, next_sjlj_build_catch_list, next_sjlj_build_try_catch_finally, objc_begin_try_stmt, objc_begin_catch_clause, objc_finish_catch_clause, objc_build_finally_clause, objc_finish_try_stmt, objc_build_synchronized): New. (objc_is_object_id, objc_is_class_id): New. (objc_comptypes): Use them. (build_next_objc_exception_stuff): Break NeXT sjlj out from build_objc_exception_stuff. (synth_module_prologue): Update to match. (objc_build_throw_stmt): Use cur_try_context to decide if we're in a @catch. * objc/objc-act.h: Update prototypes. (OCTI_EXCEPTION_BLK_STACK, objc_exception_block_stack): Remove. testsuite/ * objc.dg/sync-1.m: New. * objc.dg/try-catch-1.m: Don't force next runtime. * objc.dg/try-catch-3.m, objc.dg/try-catch-4.m: Likewise. * objc.dg/try-catch-2.m: Likewise. Enable everywhere. Remove shadowed catch clause. * objc.dg/try-catch-5.m: New. From-SVN: r83332
2004-06-18 03:20:53 +02:00
static tree
next_sjlj_build_try_catch_finally (void)
{
tree rethrow_decl, stack_decl, t;
tree catch_seq, try_fin, bind;
/* Create the declarations involved. */
t = xref_tag (RECORD_TYPE, get_identifier (UTAG_EXCDATA));
stack_decl = objc_create_temporary_var (t);
cur_try_context->stack_decl = stack_decl;
Makefile.in (c-parse.o): Depend on $(C_COMMON_H). [gcc/ChangeLog] 2004-09-07 Ziemowit Laski <zlaski@apple.com> * Makefile.in (c-parse.o): Depend on $(C_COMMON_H). * c-parse.in: Include c-common.h instead of objc-act.h. (ivar_decl_list, ivar_decls, ivar_decl, ivars, ivar_declarator, myparms, myparm): Remove %type declarations. (methodtype, optparms, OBJC_TYPE_QUAL, objc_quals, objc_qual, objc_typename, objc_try_catch_stmt, optellipsis): Add %type declarations. (objc_inherit_code, objc_public_flag): Remove. (typespec_nonreserved_nonattr): Call objc_get_protocol_qualified_type() instead of get_static_reference() and get_protocol_reference(). (stmt_nocomp): Call grokparm() on @catch parameter. (objcdef): Move semantic action to objc_finish_implementation(). (classdef): Move semantic action to objc_start_class_interface(), objc_continue_interface(), objc_finish_interface(), objc_start_class_implementation(), objc_continue_implementation(), objc_start_category_interface() and objc_start_category_implementation(). (protocoldef): Move semantic actions to objc_start_protocol() and objc_finish_interface(). (ivar_decl_list): Remove nonterminal. (visibility_spec): Move semantic actions to objc_set_visibility(). (ivar_decls): Remove assignment to $$. (ivar_decl): Rephrase in terms of component_decl; call objc_add_instance_variable(). (ivars, ivar_declarator): Remove nonterminals. (opt_semi): New nonterminal. (methodtype): Remove semantic actions. (methoddef): Move semantic actions to objc_set_method_type(), objc_start_method_definition() and objc_finish_method_definition(). (methodproto): Move semantic actions to objc_set_method_type() and objc_add_method_declaration(). (methoddecl): Use objc_typename instead of typename; move semantic actions to objc_build_method_signature(). (optarglist, myxdecls, mydecl, myparms, myparm): Remove nonterminals. (optparmlist): Express in terms of optparms and optellipsis. (optparms, optellipsis, objc_qual, objc_quals, objc_typename): New nonterminals. (keyworddecl): Use objc_typename instead of typename. (rid_to_yy): Mark RID_IN, RID_OUT, RID_INOUT, RID_BYCOPY, RID_BYREF and RID_ONEWAY as returning OBJC_TYPE_QUAL to yyparse(). [gcc/objc/ChangeLog] 2004-09-07 Ziemowit Laski <zlaski@apple.com> * Make-lang.in (objc/objc-parse.o): Depend on $(C_COMMON_H) instead of objc/objc-act.h. (objc/objc-act.o): Depend on $(HASHTAB_H). * objc-act.c: Include hashtab.h; in ObjC++ mode, include cp-tree.h and objcp-decl.h instead of c-tree.h. (build_module_descriptor, get_class_ivars, synth_id_with_class_suffix, error_with_ivar, gen_method_decl, gen_declaration, setup_string_decl, build_protocol_template): Adjust prototypes. (build_module_initializer_routine, start_class, continue_class, finish_class, start_method_def, objc_start_function, start_protocol, build_method_decl, objc_add_method, add_instance_variable, build_ivar_reference, is_ivar, is_private, get_super_receiver, build_selector_table_decl, objc_push_parm, objc_get_parm_info, gen_type_name, gen_type_name_0, start_var_decl, finish_var_decl, create_field_decl): New prototypes. (objc_expand_function_end, comp_method_with_proto, objc_expr_last, gen_declaration_1, gen_declarator, is_complex_decl, adorn_decl, define_decl, create_builtin_decl, gen_declspecs): Remove prototypes. (TYPE_ID): Rename to OBJECT_TYPEDEF_NAME. (CLASS_TYPEDEF_NAME): New. (TAG_EXECCLASS): Change from a global variable to a #define. (TAG_RETURN_STRUCT): Delete. (TAG_GNUINIT): New, holds '__objc_gnu_init' name. (objc_inherit_code, objc_public_flag): New, moved from c-parse.in. (string_descriptor): New struct. (string_htab): New hash table. (string_hash, string_eq): New prototypes. (generate_struct_by_value_array): Call create_field_decl() instead of create_builtin_decl(). (objc_init): Do not initialize objc_ellipsis_node or TAG_EXECCLASS; In ObjC++ mode, call cxx_init() instead of c_objc_common_init(). (objc_finish_file): In ObjC++, call instantiate_pending_templates() and cp_finish_file(). (define_decl, get_static_reference, get_protocol_reference, create_builtin_decl): Remove functions. (objc_start_class_interface, objc_start_category_interface, objc_start_protocol, objc_continue_interface, objc_finish_interface, objc_start_class_implementation, objc_start_category_implementation, objc_continue_implementation, objc_finish_implementation, objc_set_visibility, objc_set_method_type, objc_build_method_signature, objc_add_method_declaration, objc_start_method_definition, objc_add_instance_variable, objc_get_protocol_qualified_type, create_field_decl, start_var_decl, finish_var_decl): New functions. (setup_string_decl): Simplify since it is only called once. (synth_module_prologue): Call build_class_template(); predefine 'id' and 'Class' as typedefs; rename 'temp_type' to 'type'; disable debug hooks for duration of function; fix GNU runtime messenger signatures to correspond to reality; forward-declare '__objc_exec_class' for the GNU runtime; call build_selector_table_decl(); in ObjC++ mode, generate 'extern "C" { ... }' wrappers around synthesized declarations; call build_protocol_template() and build_category_template(). (string_hash, string_eq): New functions. (objc_build_string_object): Check metaclass correctness only once; store string literals in hash table. (objc_build_constructor): Do not convert initializer elements; adjust for ObjC++ impedance mismatch. (build_objc_symtab_template): Call create_field_decl() instead of create_builtin_decl(). (init_objc_symtab): Add missing conversion to initializer element. (build_metadata_decl): Call start_var_decl() instead of define_decl(). (generate_objc_symtab_decl): Do not call build_category_template(); call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(). (build_module_descriptor): Call create_field_decl() instead of grokfield(); call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(); always mark module descriptor as used; move GNU runtime-specific functionality to build_module_initializer_routine(). (build_module_initializer_routine): New function, broken off of build_module_descriptor(). (objc_static_init_needed_p, objc_generate_static_init_call): New functions. (generate_static_references, generate_strings, build_selector_translation_table, generate_descriptor_table, generate_ivars_list, generate_dispatch_table, generate_category): Call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(); build a type directly instead of via groktypename(). (build_selector_reference_decl, build_selector_table_decl, build_class_reference_decl, build_protocol_reference, generate_objc_image_info): Call start_var_decl() instead of build_decl(). (build_selector_reference): For GNU runtime, do not call build_selector_reference_decl(). (build_selector, build_typed_selector_reference): Always convert result to the selector type. (add_objc_string): Cast return value to 'char *'. (build_method_prototype_template, build_selector_template, build_method_template): Use actual selector type for fields pointing to selectors. (finish_objc): For GNU runtime, call build_module_initializer_routine() after build_module_descriptor(). (generate_protocol_list, generate_shared_structures): Call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(); build a type directly instead of via groktypename(). (synth_id_with_class_suffix): Return a string. (get_arg_type_list): For instance methods, use the instance type for 'self'; do not call groktypename_in_parm_context(). (build_objc_string_decl): Squash redeclaration errors in ObjC++. (objc_is_class_name): Use OBJC_TYPE_NAME instead of TYPE_NAME; handle RECORD_TYPEs in ObjC as well as ObjC++. (objc_is_id): New function. (objc_is_object_ptr): Return the canonical type node. (objc_get_class_ivars): Simplify using get_class_ivars(). (get_class_ivars): Remove second parameter; create a fresh copy of the ivar list for each call; do not check for existence of super class. (objc_eh_runtime_type): Mark #ifndef OBJCPLUS. (objc_init_exceptions): When using SJLJ-style exceptions, require the use of '-fobjc-exceptions' flag; do not require it for DWARF-style exceptions. (objc_build_exc_ptr, next_sjlj_build_try_catch_finally): Use objc_object_type instead of objc_id_type. (objc_begin_catch_clause): Convert the incoming PARM_DECL into a VAR_DECL before placing it in the appropriate scope; do not call define_decl(); adjust call to c_begin_compound_stmt(); use objc_object_type instead of objc_id_type. (build_next_objc_exception_stuff): Call create_field_decl() instead of create_builtin_decl(); construct type directly instead of calling groktypename(); use OBJC_VOID_AT_END to mark end of function parameters. (build_private_template): Adjust call to get_class_ivars(); build a type directly instead of via groktypename(). (build_protocol_template, build_method_prototype_list_template, build_method_prototype_template, build_category_template, build_selector_template, build_class_template, build_super_template, build_ivar_template, build_ivar_list_template, build_method_list_template, build_method_template): Call create_field_decl() instead of grokfield(). (objc_method_parm_type): Do not call groktypename(). (generate_descriptor_table): Call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(). (generate_method_descriptors, build_protocol_initializer, generate_dispatch_tables, build_category_initializer, build_shared_structure_initializer): Do not call groktypename(). (generate_protocols): Call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(); do not call groktypename(). (error_with_ivar): Remove last parameter. (check_ivars): Do not iterate ovar CLASS_RAW_IVARS lists in addition to CLASS_IVARS lists; adjust calls to error_with_ivar(). (generate_ivar_lists): Convert one of the initializer elements; do not call groktypename(). (get_arg_type_list, start_method_def, gen_method_def): Account for new representation of variable arguments and '...' in Objective-C methods; add Objective-C++ impedance matching code. (is_objc_type_qualifier): Remove function. (adjust_type_for_id_default): Simplify; there is no longer a need to wade through declspecs. (lookup_interface, start_class, continue_class, finish_class, start_method_def, start_protocol, build_method_decl, objc_add_method, add_instance_variable, build_ivar_reference, is_ivar, is_private, get_super_receiver, objc_build_finally_epilogue): Make into static functions. (receiver_is_class_object): Use new IS_CLASS() macro. (objc_build_message_expr): Tweak ObjC++ message argument handling; call objc_finish_message_expr() instead of finish_message_expr(). (finish_message_expr): Rename to objc_finish_message_expr(); use OBJC_TYPE_NAME and OBJC_SET_TYPE_NAME macros instead of TYPE_NAME. call gen_type_name() instead of gen_declaration(); call objc_is_id() instead of using IS_ID and IS_CLASS; Use objc_class_name instead of calling get_identifier("Class"); handle CONVERT_EXPRs in receiver. (build_objc_method_call, warn_with_method): Do not call groktypename(). (build_ivar_reference): Call convert() instead of clobbering in a type. (hash_init): Initialize string_htab hash table. (add_instance_variable): Simplify parameter list; do not call grokfield(); do not populate CLASS_IVARS list. (start_class): Check for the existence of super class, if one was specified. (continue_class): Use CLASS_RAW_IVARS rather than CLASS_IVARS; do not call build_class_template(); adjust call to get_class_ivars(); call build_decl(), pushdecl() and finish_decl() instead of define_decl(). (finish_class): Call build_decl(), pushdecl() and finish_decl() instead of define_decl(). (add_protocols): Use PROTOCOL_BINFO_ELTS for the tree vector size. (start_protocol): Do not call build_protocol_template(); use PROTOCOL_BINFO_ELTS for the tree vector size. (encode_type_qualifiers): Do not handle the 'const' qualifier here. (encode_pointer): Encode 'const char *' as 'r*', for backwards compatibility. (encode_array): Use HOST_WIDE_INT_PRINT_DEC instead of "%ld". (encode_type): Handle the 'const' qualifier here. (objc_parmlist): New global variable, sued by objc_push_parm and objc_get_parm_info(). (objc_push_parm, objc_get_parm_info): New functions. (objc_expr_last): Remove function. (synth_self_and_ucmd_args): For instance methods, use the instance type for 'self'; call objc_push_parm() instead of push_parm_decl(). (start_method_def): Do not call push_scope(), declare_parm_level(), pop_scope(), push_parm_decl(), store_parm_decls() or objc_expr_last(); just use objc_push_parm() and objc_get_parm_info(). (comp_method_with_proto): Remove function. (objc_types_are_equivalent): Strip away indirections before comparing underlying types. (comp_proto_with_proto): Do not call groktypename(); types are no longer in raw declspec format. (objc_start_function): New function. (really_start_method): Call comp_proto_with_proto() instead of comp_method_with_proto(); call objc_start_function() instead of hand-crafting a function declarator. (continue_method_def, objc_expand_function_end): Remove functions. (get_super_receiver): Call objc_get_current_scope() instead of get_current_scope(); reference 'super_class' field (instead of 'class'). (finish_method_def): Rename to objc_finish_method_definition() and add a function decl parameter; move method encoding call from objc_expand_function_end(). (is_complex_decl, adorn_decl, gen_declarator, gen_declspecs, gen_declaration_1): Remove functions. (tmpbuf, RAW_DECLSPEC): Remove. (gen_declaration): Remove second parameter; simplify to deal with TYPE_P nodes instead of raw declspecs. (gen_type_name, gen_type_name_0): New functions. (gen_method_decl): Remove second parameter; call gen_type_name() instead of gen_declaration_1(). (dump_interface): Adjust calls to gen_declaration() and gen_method_decl(); do not allocate a separate string buffer. (init_objc): Allocate a larger string buffer to accommodate dump_interface(); adjust call to build_module_descriptor(); add call to build_module_initializer_routine() for the GNU runtime. (generate_classref_translation_entry): Do not call start_decl(); call finish_var_decl() instead of finish_decl(); call convert() instead of build_c_cast(). * objc-act.h (CLASS_OWN_IVARS): Remove accessor. (CLASS_BINFO_ELTS): Reduce from 6 to 5, now that CLASS_OWN_IVARS is gone. (OCTI_GNU_INIT_DECL, GNU_INIT_decl): New. (OCTI_ELLIPSIS_NODE, objc_ellipsis_node): Remove. (OCTI_ID_ID, id_type, objc_id_id): Rename to OCTI_ID_NAME, objc_object_type and objc_object_name, respectively. (OCTI_CLS_REF, OCTI_CLASS_NAME, objc_class_reference, objc_class_name): New. (IS_CLASS): New macro. (IS_ID, IS_SUPER): Robustify. (OCTI_EXECCLASS_DECL, execclass_decl): New. (finish_file, start_class, continue_class, finish_class, start_method_def, continue_method_def, finish_method_def, start_protocol, finish_protocol, objc_build_throw_stmt, objc_build_try_catch_finally_stmt, objc_build_synchronized_prologue, objc_build_synchronized_epilogue, objc_build_try_prologue, objc_build_try_epilogue, objc_build_catch_stmt, objc_build_catch_epilogue, objc_build_finally_prologue, objc_build_finally_epilogue, is_ivar, is_private, is_public, add_instance_variable, objc_add_method, get_super_receiver, objc_clear_super_receiver, get_class_ivars_from_name, get_class_reference, get_static_reference, get_object_reference, build_message_expr, finish_message_expr, build_selector_expr, build_ivar_reference, build_keyword_decl, build_method_decl, build_protocol_expr, build_objc_string_object, objc_declare_alias, objc_declare_class, objc_declare_protocols, objc_comptypes, objc_check_decl, build_encode_expr): Remove prototypes. (imp_count, cat_count): Make GGC-aware. (OBJC_SET_TYPE_NAME): New macro. From-SVN: r87168
2004-09-08 02:49:44 +02:00
rethrow_decl = objc_create_temporary_var (objc_object_type);
c-common.c (flag_objc_sjlj_exceptions): New. * c-common.c (flag_objc_sjlj_exceptions): New. * c-common.h (flag_objc_sjlj_exceptions): Declare. * c-opts.c (c_common_handle_option): Set it. (c_common_post_options): Handle interation of different objective-c exception and runtime switches. * c-decl.c (c_eh_initialized_p): New. (finish_decl): Use it instead of local eh_initialized_p. * c-parse.in (nested_function, notype_nested_function): Record the result of compstmt. (compstmt_or_error): Likewise. (compstmt): Don't add_stmt the result. (stmt): Don't return anything. Rewrite objc try and sync rules. (objc_try_stmt, objc_catch_list): Remove. (objc_catch_block, objc_finally_block): Remove. (objc_catch_prefix, objc_catch_clause, objc_opt_catch_list): New. (objc_try_catch_clause, objc_finally_clause): New. (objc_try_catch_stmt): Rewrite. * c-tree.h (c_eh_initialized_p): Declare. * c-opt (fobjc-sjlj-exceptions): New. * except.c (output_function_exception_table): Don't call cgraph on non-decls. * objc/objc-act.c (UTAG_EXCDATA_VAR, UTAG_CAUGHTEXC_VAR, UTAG_RETHROWEXC_VAR, UTAG_EVALONCE_VAR, struct val_stack, catch_count_stack, exc_binding_stack, if_nesting_count, blk_nesting_count, objc_enter_block, objc_exit_block, objc_declare_variable, 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): Remove. (objc_create_temporary_var, struct objc_try_context, cur_try_context, objc_eh_runtime_type, objc_init_exceptions, objc_build_exc_ptr, next_sjlj_build_try_exit, next_sjlj_build_enter_and_setjmp, next_sjlj_build_exc_extract, next_sjlj_build_catch_list, next_sjlj_build_try_catch_finally, objc_begin_try_stmt, objc_begin_catch_clause, objc_finish_catch_clause, objc_build_finally_clause, objc_finish_try_stmt, objc_build_synchronized): New. (objc_is_object_id, objc_is_class_id): New. (objc_comptypes): Use them. (build_next_objc_exception_stuff): Break NeXT sjlj out from build_objc_exception_stuff. (synth_module_prologue): Update to match. (objc_build_throw_stmt): Use cur_try_context to decide if we're in a @catch. * objc/objc-act.h: Update prototypes. (OCTI_EXCEPTION_BLK_STACK, objc_exception_block_stack): Remove. testsuite/ * objc.dg/sync-1.m: New. * objc.dg/try-catch-1.m: Don't force next runtime. * objc.dg/try-catch-3.m, objc.dg/try-catch-4.m: Likewise. * objc.dg/try-catch-2.m: Likewise. Enable everywhere. Remove shadowed catch clause. * objc.dg/try-catch-5.m: New. From-SVN: r83332
2004-06-18 03:20:53 +02:00
cur_try_context->rethrow_decl = rethrow_decl;
TREE_THIS_VOLATILE (rethrow_decl) = 1;
TREE_CHAIN (rethrow_decl) = stack_decl;
/* Build the outermost variable binding level. */
bind = build3 (BIND_EXPR, void_type_node, rethrow_decl, NULL, NULL);
SET_EXPR_LOCATION (bind, cur_try_context->try_locus);
c-common.c (flag_objc_sjlj_exceptions): New. * c-common.c (flag_objc_sjlj_exceptions): New. * c-common.h (flag_objc_sjlj_exceptions): Declare. * c-opts.c (c_common_handle_option): Set it. (c_common_post_options): Handle interation of different objective-c exception and runtime switches. * c-decl.c (c_eh_initialized_p): New. (finish_decl): Use it instead of local eh_initialized_p. * c-parse.in (nested_function, notype_nested_function): Record the result of compstmt. (compstmt_or_error): Likewise. (compstmt): Don't add_stmt the result. (stmt): Don't return anything. Rewrite objc try and sync rules. (objc_try_stmt, objc_catch_list): Remove. (objc_catch_block, objc_finally_block): Remove. (objc_catch_prefix, objc_catch_clause, objc_opt_catch_list): New. (objc_try_catch_clause, objc_finally_clause): New. (objc_try_catch_stmt): Rewrite. * c-tree.h (c_eh_initialized_p): Declare. * c-opt (fobjc-sjlj-exceptions): New. * except.c (output_function_exception_table): Don't call cgraph on non-decls. * objc/objc-act.c (UTAG_EXCDATA_VAR, UTAG_CAUGHTEXC_VAR, UTAG_RETHROWEXC_VAR, UTAG_EVALONCE_VAR, struct val_stack, catch_count_stack, exc_binding_stack, if_nesting_count, blk_nesting_count, objc_enter_block, objc_exit_block, objc_declare_variable, 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): Remove. (objc_create_temporary_var, struct objc_try_context, cur_try_context, objc_eh_runtime_type, objc_init_exceptions, objc_build_exc_ptr, next_sjlj_build_try_exit, next_sjlj_build_enter_and_setjmp, next_sjlj_build_exc_extract, next_sjlj_build_catch_list, next_sjlj_build_try_catch_finally, objc_begin_try_stmt, objc_begin_catch_clause, objc_finish_catch_clause, objc_build_finally_clause, objc_finish_try_stmt, objc_build_synchronized): New. (objc_is_object_id, objc_is_class_id): New. (objc_comptypes): Use them. (build_next_objc_exception_stuff): Break NeXT sjlj out from build_objc_exception_stuff. (synth_module_prologue): Update to match. (objc_build_throw_stmt): Use cur_try_context to decide if we're in a @catch. * objc/objc-act.h: Update prototypes. (OCTI_EXCEPTION_BLK_STACK, objc_exception_block_stack): Remove. testsuite/ * objc.dg/sync-1.m: New. * objc.dg/try-catch-1.m: Don't force next runtime. * objc.dg/try-catch-3.m, objc.dg/try-catch-4.m: Likewise. * objc.dg/try-catch-2.m: Likewise. Enable everywhere. Remove shadowed catch clause. * objc.dg/try-catch-5.m: New. From-SVN: r83332
2004-06-18 03:20:53 +02:00
TREE_SIDE_EFFECTS (bind) = 1;
/* Initialize rethrow_decl. */
t = build2 (MODIFY_EXPR, void_type_node, rethrow_decl,
convert (objc_object_type, null_pointer_node));
SET_EXPR_LOCATION (t, cur_try_context->try_locus);
c-common.c (flag_objc_sjlj_exceptions): New. * c-common.c (flag_objc_sjlj_exceptions): New. * c-common.h (flag_objc_sjlj_exceptions): Declare. * c-opts.c (c_common_handle_option): Set it. (c_common_post_options): Handle interation of different objective-c exception and runtime switches. * c-decl.c (c_eh_initialized_p): New. (finish_decl): Use it instead of local eh_initialized_p. * c-parse.in (nested_function, notype_nested_function): Record the result of compstmt. (compstmt_or_error): Likewise. (compstmt): Don't add_stmt the result. (stmt): Don't return anything. Rewrite objc try and sync rules. (objc_try_stmt, objc_catch_list): Remove. (objc_catch_block, objc_finally_block): Remove. (objc_catch_prefix, objc_catch_clause, objc_opt_catch_list): New. (objc_try_catch_clause, objc_finally_clause): New. (objc_try_catch_stmt): Rewrite. * c-tree.h (c_eh_initialized_p): Declare. * c-opt (fobjc-sjlj-exceptions): New. * except.c (output_function_exception_table): Don't call cgraph on non-decls. * objc/objc-act.c (UTAG_EXCDATA_VAR, UTAG_CAUGHTEXC_VAR, UTAG_RETHROWEXC_VAR, UTAG_EVALONCE_VAR, struct val_stack, catch_count_stack, exc_binding_stack, if_nesting_count, blk_nesting_count, objc_enter_block, objc_exit_block, objc_declare_variable, 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): Remove. (objc_create_temporary_var, struct objc_try_context, cur_try_context, objc_eh_runtime_type, objc_init_exceptions, objc_build_exc_ptr, next_sjlj_build_try_exit, next_sjlj_build_enter_and_setjmp, next_sjlj_build_exc_extract, next_sjlj_build_catch_list, next_sjlj_build_try_catch_finally, objc_begin_try_stmt, objc_begin_catch_clause, objc_finish_catch_clause, objc_build_finally_clause, objc_finish_try_stmt, objc_build_synchronized): New. (objc_is_object_id, objc_is_class_id): New. (objc_comptypes): Use them. (build_next_objc_exception_stuff): Break NeXT sjlj out from build_objc_exception_stuff. (synth_module_prologue): Update to match. (objc_build_throw_stmt): Use cur_try_context to decide if we're in a @catch. * objc/objc-act.h: Update prototypes. (OCTI_EXCEPTION_BLK_STACK, objc_exception_block_stack): Remove. testsuite/ * objc.dg/sync-1.m: New. * objc.dg/try-catch-1.m: Don't force next runtime. * objc.dg/try-catch-3.m, objc.dg/try-catch-4.m: Likewise. * objc.dg/try-catch-2.m: Likewise. Enable everywhere. Remove shadowed catch clause. * objc.dg/try-catch-5.m: New. From-SVN: r83332
2004-06-18 03:20:53 +02:00
append_to_statement_list (t, &BIND_EXPR_BODY (bind));
/* Build the outermost TRY_FINALLY_EXPR. */
try_fin = build2 (TRY_FINALLY_EXPR, void_type_node, NULL, NULL);
SET_EXPR_LOCATION (try_fin, cur_try_context->try_locus);
c-common.c (flag_objc_sjlj_exceptions): New. * c-common.c (flag_objc_sjlj_exceptions): New. * c-common.h (flag_objc_sjlj_exceptions): Declare. * c-opts.c (c_common_handle_option): Set it. (c_common_post_options): Handle interation of different objective-c exception and runtime switches. * c-decl.c (c_eh_initialized_p): New. (finish_decl): Use it instead of local eh_initialized_p. * c-parse.in (nested_function, notype_nested_function): Record the result of compstmt. (compstmt_or_error): Likewise. (compstmt): Don't add_stmt the result. (stmt): Don't return anything. Rewrite objc try and sync rules. (objc_try_stmt, objc_catch_list): Remove. (objc_catch_block, objc_finally_block): Remove. (objc_catch_prefix, objc_catch_clause, objc_opt_catch_list): New. (objc_try_catch_clause, objc_finally_clause): New. (objc_try_catch_stmt): Rewrite. * c-tree.h (c_eh_initialized_p): Declare. * c-opt (fobjc-sjlj-exceptions): New. * except.c (output_function_exception_table): Don't call cgraph on non-decls. * objc/objc-act.c (UTAG_EXCDATA_VAR, UTAG_CAUGHTEXC_VAR, UTAG_RETHROWEXC_VAR, UTAG_EVALONCE_VAR, struct val_stack, catch_count_stack, exc_binding_stack, if_nesting_count, blk_nesting_count, objc_enter_block, objc_exit_block, objc_declare_variable, 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): Remove. (objc_create_temporary_var, struct objc_try_context, cur_try_context, objc_eh_runtime_type, objc_init_exceptions, objc_build_exc_ptr, next_sjlj_build_try_exit, next_sjlj_build_enter_and_setjmp, next_sjlj_build_exc_extract, next_sjlj_build_catch_list, next_sjlj_build_try_catch_finally, objc_begin_try_stmt, objc_begin_catch_clause, objc_finish_catch_clause, objc_build_finally_clause, objc_finish_try_stmt, objc_build_synchronized): New. (objc_is_object_id, objc_is_class_id): New. (objc_comptypes): Use them. (build_next_objc_exception_stuff): Break NeXT sjlj out from build_objc_exception_stuff. (synth_module_prologue): Update to match. (objc_build_throw_stmt): Use cur_try_context to decide if we're in a @catch. * objc/objc-act.h: Update prototypes. (OCTI_EXCEPTION_BLK_STACK, objc_exception_block_stack): Remove. testsuite/ * objc.dg/sync-1.m: New. * objc.dg/try-catch-1.m: Don't force next runtime. * objc.dg/try-catch-3.m, objc.dg/try-catch-4.m: Likewise. * objc.dg/try-catch-2.m: Likewise. Enable everywhere. Remove shadowed catch clause. * objc.dg/try-catch-5.m: New. From-SVN: r83332
2004-06-18 03:20:53 +02:00
TREE_SIDE_EFFECTS (try_fin) = 1;
append_to_statement_list (try_fin, &BIND_EXPR_BODY (bind));
/* Create the complete catch sequence. */
if (cur_try_context->catch_list)
{
c-common.c (flag_objc_sjlj_exceptions): New. * c-common.c (flag_objc_sjlj_exceptions): New. * c-common.h (flag_objc_sjlj_exceptions): Declare. * c-opts.c (c_common_handle_option): Set it. (c_common_post_options): Handle interation of different objective-c exception and runtime switches. * c-decl.c (c_eh_initialized_p): New. (finish_decl): Use it instead of local eh_initialized_p. * c-parse.in (nested_function, notype_nested_function): Record the result of compstmt. (compstmt_or_error): Likewise. (compstmt): Don't add_stmt the result. (stmt): Don't return anything. Rewrite objc try and sync rules. (objc_try_stmt, objc_catch_list): Remove. (objc_catch_block, objc_finally_block): Remove. (objc_catch_prefix, objc_catch_clause, objc_opt_catch_list): New. (objc_try_catch_clause, objc_finally_clause): New. (objc_try_catch_stmt): Rewrite. * c-tree.h (c_eh_initialized_p): Declare. * c-opt (fobjc-sjlj-exceptions): New. * except.c (output_function_exception_table): Don't call cgraph on non-decls. * objc/objc-act.c (UTAG_EXCDATA_VAR, UTAG_CAUGHTEXC_VAR, UTAG_RETHROWEXC_VAR, UTAG_EVALONCE_VAR, struct val_stack, catch_count_stack, exc_binding_stack, if_nesting_count, blk_nesting_count, objc_enter_block, objc_exit_block, objc_declare_variable, 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): Remove. (objc_create_temporary_var, struct objc_try_context, cur_try_context, objc_eh_runtime_type, objc_init_exceptions, objc_build_exc_ptr, next_sjlj_build_try_exit, next_sjlj_build_enter_and_setjmp, next_sjlj_build_exc_extract, next_sjlj_build_catch_list, next_sjlj_build_try_catch_finally, objc_begin_try_stmt, objc_begin_catch_clause, objc_finish_catch_clause, objc_build_finally_clause, objc_finish_try_stmt, objc_build_synchronized): New. (objc_is_object_id, objc_is_class_id): New. (objc_comptypes): Use them. (build_next_objc_exception_stuff): Break NeXT sjlj out from build_objc_exception_stuff. (synth_module_prologue): Update to match. (objc_build_throw_stmt): Use cur_try_context to decide if we're in a @catch. * objc/objc-act.h: Update prototypes. (OCTI_EXCEPTION_BLK_STACK, objc_exception_block_stack): Remove. testsuite/ * objc.dg/sync-1.m: New. * objc.dg/try-catch-1.m: Don't force next runtime. * objc.dg/try-catch-3.m, objc.dg/try-catch-4.m: Likewise. * objc.dg/try-catch-2.m: Likewise. Enable everywhere. Remove shadowed catch clause. * objc.dg/try-catch-5.m: New. From-SVN: r83332
2004-06-18 03:20:53 +02:00
tree caught_decl = objc_build_exc_ptr ();
catch_seq = build_stmt (BIND_EXPR, caught_decl, NULL, NULL);
TREE_SIDE_EFFECTS (catch_seq) = 1;
c-common.c (flag_objc_sjlj_exceptions): New. * c-common.c (flag_objc_sjlj_exceptions): New. * c-common.h (flag_objc_sjlj_exceptions): Declare. * c-opts.c (c_common_handle_option): Set it. (c_common_post_options): Handle interation of different objective-c exception and runtime switches. * c-decl.c (c_eh_initialized_p): New. (finish_decl): Use it instead of local eh_initialized_p. * c-parse.in (nested_function, notype_nested_function): Record the result of compstmt. (compstmt_or_error): Likewise. (compstmt): Don't add_stmt the result. (stmt): Don't return anything. Rewrite objc try and sync rules. (objc_try_stmt, objc_catch_list): Remove. (objc_catch_block, objc_finally_block): Remove. (objc_catch_prefix, objc_catch_clause, objc_opt_catch_list): New. (objc_try_catch_clause, objc_finally_clause): New. (objc_try_catch_stmt): Rewrite. * c-tree.h (c_eh_initialized_p): Declare. * c-opt (fobjc-sjlj-exceptions): New. * except.c (output_function_exception_table): Don't call cgraph on non-decls. * objc/objc-act.c (UTAG_EXCDATA_VAR, UTAG_CAUGHTEXC_VAR, UTAG_RETHROWEXC_VAR, UTAG_EVALONCE_VAR, struct val_stack, catch_count_stack, exc_binding_stack, if_nesting_count, blk_nesting_count, objc_enter_block, objc_exit_block, objc_declare_variable, 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): Remove. (objc_create_temporary_var, struct objc_try_context, cur_try_context, objc_eh_runtime_type, objc_init_exceptions, objc_build_exc_ptr, next_sjlj_build_try_exit, next_sjlj_build_enter_and_setjmp, next_sjlj_build_exc_extract, next_sjlj_build_catch_list, next_sjlj_build_try_catch_finally, objc_begin_try_stmt, objc_begin_catch_clause, objc_finish_catch_clause, objc_build_finally_clause, objc_finish_try_stmt, objc_build_synchronized): New. (objc_is_object_id, objc_is_class_id): New. (objc_comptypes): Use them. (build_next_objc_exception_stuff): Break NeXT sjlj out from build_objc_exception_stuff. (synth_module_prologue): Update to match. (objc_build_throw_stmt): Use cur_try_context to decide if we're in a @catch. * objc/objc-act.h: Update prototypes. (OCTI_EXCEPTION_BLK_STACK, objc_exception_block_stack): Remove. testsuite/ * objc.dg/sync-1.m: New. * objc.dg/try-catch-1.m: Don't force next runtime. * objc.dg/try-catch-3.m, objc.dg/try-catch-4.m: Likewise. * objc.dg/try-catch-2.m: Likewise. Enable everywhere. Remove shadowed catch clause. * objc.dg/try-catch-5.m: New. From-SVN: r83332
2004-06-18 03:20:53 +02:00
t = next_sjlj_build_exc_extract (caught_decl);
append_to_statement_list (t, &BIND_EXPR_BODY (catch_seq));
t = next_sjlj_build_enter_and_setjmp ();
COND_EXPR_THEN (t) = next_sjlj_build_exc_extract (rethrow_decl);
COND_EXPR_ELSE (t) = next_sjlj_build_catch_list ();
append_to_statement_list (t, &BIND_EXPR_BODY (catch_seq));
}
c-common.c (flag_objc_sjlj_exceptions): New. * c-common.c (flag_objc_sjlj_exceptions): New. * c-common.h (flag_objc_sjlj_exceptions): Declare. * c-opts.c (c_common_handle_option): Set it. (c_common_post_options): Handle interation of different objective-c exception and runtime switches. * c-decl.c (c_eh_initialized_p): New. (finish_decl): Use it instead of local eh_initialized_p. * c-parse.in (nested_function, notype_nested_function): Record the result of compstmt. (compstmt_or_error): Likewise. (compstmt): Don't add_stmt the result. (stmt): Don't return anything. Rewrite objc try and sync rules. (objc_try_stmt, objc_catch_list): Remove. (objc_catch_block, objc_finally_block): Remove. (objc_catch_prefix, objc_catch_clause, objc_opt_catch_list): New. (objc_try_catch_clause, objc_finally_clause): New. (objc_try_catch_stmt): Rewrite. * c-tree.h (c_eh_initialized_p): Declare. * c-opt (fobjc-sjlj-exceptions): New. * except.c (output_function_exception_table): Don't call cgraph on non-decls. * objc/objc-act.c (UTAG_EXCDATA_VAR, UTAG_CAUGHTEXC_VAR, UTAG_RETHROWEXC_VAR, UTAG_EVALONCE_VAR, struct val_stack, catch_count_stack, exc_binding_stack, if_nesting_count, blk_nesting_count, objc_enter_block, objc_exit_block, objc_declare_variable, 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): Remove. (objc_create_temporary_var, struct objc_try_context, cur_try_context, objc_eh_runtime_type, objc_init_exceptions, objc_build_exc_ptr, next_sjlj_build_try_exit, next_sjlj_build_enter_and_setjmp, next_sjlj_build_exc_extract, next_sjlj_build_catch_list, next_sjlj_build_try_catch_finally, objc_begin_try_stmt, objc_begin_catch_clause, objc_finish_catch_clause, objc_build_finally_clause, objc_finish_try_stmt, objc_build_synchronized): New. (objc_is_object_id, objc_is_class_id): New. (objc_comptypes): Use them. (build_next_objc_exception_stuff): Break NeXT sjlj out from build_objc_exception_stuff. (synth_module_prologue): Update to match. (objc_build_throw_stmt): Use cur_try_context to decide if we're in a @catch. * objc/objc-act.h: Update prototypes. (OCTI_EXCEPTION_BLK_STACK, objc_exception_block_stack): Remove. testsuite/ * objc.dg/sync-1.m: New. * objc.dg/try-catch-1.m: Don't force next runtime. * objc.dg/try-catch-3.m, objc.dg/try-catch-4.m: Likewise. * objc.dg/try-catch-2.m: Likewise. Enable everywhere. Remove shadowed catch clause. * objc.dg/try-catch-5.m: New. From-SVN: r83332
2004-06-18 03:20:53 +02:00
else
catch_seq = next_sjlj_build_exc_extract (rethrow_decl);
SET_EXPR_LOCATION (catch_seq, cur_try_context->end_try_locus);
c-common.c (flag_objc_sjlj_exceptions): New. * c-common.c (flag_objc_sjlj_exceptions): New. * c-common.h (flag_objc_sjlj_exceptions): Declare. * c-opts.c (c_common_handle_option): Set it. (c_common_post_options): Handle interation of different objective-c exception and runtime switches. * c-decl.c (c_eh_initialized_p): New. (finish_decl): Use it instead of local eh_initialized_p. * c-parse.in (nested_function, notype_nested_function): Record the result of compstmt. (compstmt_or_error): Likewise. (compstmt): Don't add_stmt the result. (stmt): Don't return anything. Rewrite objc try and sync rules. (objc_try_stmt, objc_catch_list): Remove. (objc_catch_block, objc_finally_block): Remove. (objc_catch_prefix, objc_catch_clause, objc_opt_catch_list): New. (objc_try_catch_clause, objc_finally_clause): New. (objc_try_catch_stmt): Rewrite. * c-tree.h (c_eh_initialized_p): Declare. * c-opt (fobjc-sjlj-exceptions): New. * except.c (output_function_exception_table): Don't call cgraph on non-decls. * objc/objc-act.c (UTAG_EXCDATA_VAR, UTAG_CAUGHTEXC_VAR, UTAG_RETHROWEXC_VAR, UTAG_EVALONCE_VAR, struct val_stack, catch_count_stack, exc_binding_stack, if_nesting_count, blk_nesting_count, objc_enter_block, objc_exit_block, objc_declare_variable, 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): Remove. (objc_create_temporary_var, struct objc_try_context, cur_try_context, objc_eh_runtime_type, objc_init_exceptions, objc_build_exc_ptr, next_sjlj_build_try_exit, next_sjlj_build_enter_and_setjmp, next_sjlj_build_exc_extract, next_sjlj_build_catch_list, next_sjlj_build_try_catch_finally, objc_begin_try_stmt, objc_begin_catch_clause, objc_finish_catch_clause, objc_build_finally_clause, objc_finish_try_stmt, objc_build_synchronized): New. (objc_is_object_id, objc_is_class_id): New. (objc_comptypes): Use them. (build_next_objc_exception_stuff): Break NeXT sjlj out from build_objc_exception_stuff. (synth_module_prologue): Update to match. (objc_build_throw_stmt): Use cur_try_context to decide if we're in a @catch. * objc/objc-act.h: Update prototypes. (OCTI_EXCEPTION_BLK_STACK, objc_exception_block_stack): Remove. testsuite/ * objc.dg/sync-1.m: New. * objc.dg/try-catch-1.m: Don't force next runtime. * objc.dg/try-catch-3.m, objc.dg/try-catch-4.m: Likewise. * objc.dg/try-catch-2.m: Likewise. Enable everywhere. Remove shadowed catch clause. * objc.dg/try-catch-5.m: New. From-SVN: r83332
2004-06-18 03:20:53 +02:00
/* Build the main register-and-try if statement. */
t = next_sjlj_build_enter_and_setjmp ();
SET_EXPR_LOCATION (t, cur_try_context->try_locus);
c-common.c (flag_objc_sjlj_exceptions): New. * c-common.c (flag_objc_sjlj_exceptions): New. * c-common.h (flag_objc_sjlj_exceptions): Declare. * c-opts.c (c_common_handle_option): Set it. (c_common_post_options): Handle interation of different objective-c exception and runtime switches. * c-decl.c (c_eh_initialized_p): New. (finish_decl): Use it instead of local eh_initialized_p. * c-parse.in (nested_function, notype_nested_function): Record the result of compstmt. (compstmt_or_error): Likewise. (compstmt): Don't add_stmt the result. (stmt): Don't return anything. Rewrite objc try and sync rules. (objc_try_stmt, objc_catch_list): Remove. (objc_catch_block, objc_finally_block): Remove. (objc_catch_prefix, objc_catch_clause, objc_opt_catch_list): New. (objc_try_catch_clause, objc_finally_clause): New. (objc_try_catch_stmt): Rewrite. * c-tree.h (c_eh_initialized_p): Declare. * c-opt (fobjc-sjlj-exceptions): New. * except.c (output_function_exception_table): Don't call cgraph on non-decls. * objc/objc-act.c (UTAG_EXCDATA_VAR, UTAG_CAUGHTEXC_VAR, UTAG_RETHROWEXC_VAR, UTAG_EVALONCE_VAR, struct val_stack, catch_count_stack, exc_binding_stack, if_nesting_count, blk_nesting_count, objc_enter_block, objc_exit_block, objc_declare_variable, 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): Remove. (objc_create_temporary_var, struct objc_try_context, cur_try_context, objc_eh_runtime_type, objc_init_exceptions, objc_build_exc_ptr, next_sjlj_build_try_exit, next_sjlj_build_enter_and_setjmp, next_sjlj_build_exc_extract, next_sjlj_build_catch_list, next_sjlj_build_try_catch_finally, objc_begin_try_stmt, objc_begin_catch_clause, objc_finish_catch_clause, objc_build_finally_clause, objc_finish_try_stmt, objc_build_synchronized): New. (objc_is_object_id, objc_is_class_id): New. (objc_comptypes): Use them. (build_next_objc_exception_stuff): Break NeXT sjlj out from build_objc_exception_stuff. (synth_module_prologue): Update to match. (objc_build_throw_stmt): Use cur_try_context to decide if we're in a @catch. * objc/objc-act.h: Update prototypes. (OCTI_EXCEPTION_BLK_STACK, objc_exception_block_stack): Remove. testsuite/ * objc.dg/sync-1.m: New. * objc.dg/try-catch-1.m: Don't force next runtime. * objc.dg/try-catch-3.m, objc.dg/try-catch-4.m: Likewise. * objc.dg/try-catch-2.m: Likewise. Enable everywhere. Remove shadowed catch clause. * objc.dg/try-catch-5.m: New. From-SVN: r83332
2004-06-18 03:20:53 +02:00
COND_EXPR_THEN (t) = catch_seq;
COND_EXPR_ELSE (t) = cur_try_context->try_body;
TREE_OPERAND (try_fin, 0) = t;
c-common.c (flag_objc_sjlj_exceptions): New. * c-common.c (flag_objc_sjlj_exceptions): New. * c-common.h (flag_objc_sjlj_exceptions): Declare. * c-opts.c (c_common_handle_option): Set it. (c_common_post_options): Handle interation of different objective-c exception and runtime switches. * c-decl.c (c_eh_initialized_p): New. (finish_decl): Use it instead of local eh_initialized_p. * c-parse.in (nested_function, notype_nested_function): Record the result of compstmt. (compstmt_or_error): Likewise. (compstmt): Don't add_stmt the result. (stmt): Don't return anything. Rewrite objc try and sync rules. (objc_try_stmt, objc_catch_list): Remove. (objc_catch_block, objc_finally_block): Remove. (objc_catch_prefix, objc_catch_clause, objc_opt_catch_list): New. (objc_try_catch_clause, objc_finally_clause): New. (objc_try_catch_stmt): Rewrite. * c-tree.h (c_eh_initialized_p): Declare. * c-opt (fobjc-sjlj-exceptions): New. * except.c (output_function_exception_table): Don't call cgraph on non-decls. * objc/objc-act.c (UTAG_EXCDATA_VAR, UTAG_CAUGHTEXC_VAR, UTAG_RETHROWEXC_VAR, UTAG_EVALONCE_VAR, struct val_stack, catch_count_stack, exc_binding_stack, if_nesting_count, blk_nesting_count, objc_enter_block, objc_exit_block, objc_declare_variable, 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): Remove. (objc_create_temporary_var, struct objc_try_context, cur_try_context, objc_eh_runtime_type, objc_init_exceptions, objc_build_exc_ptr, next_sjlj_build_try_exit, next_sjlj_build_enter_and_setjmp, next_sjlj_build_exc_extract, next_sjlj_build_catch_list, next_sjlj_build_try_catch_finally, objc_begin_try_stmt, objc_begin_catch_clause, objc_finish_catch_clause, objc_build_finally_clause, objc_finish_try_stmt, objc_build_synchronized): New. (objc_is_object_id, objc_is_class_id): New. (objc_comptypes): Use them. (build_next_objc_exception_stuff): Break NeXT sjlj out from build_objc_exception_stuff. (synth_module_prologue): Update to match. (objc_build_throw_stmt): Use cur_try_context to decide if we're in a @catch. * objc/objc-act.h: Update prototypes. (OCTI_EXCEPTION_BLK_STACK, objc_exception_block_stack): Remove. testsuite/ * objc.dg/sync-1.m: New. * objc.dg/try-catch-1.m: Don't force next runtime. * objc.dg/try-catch-3.m, objc.dg/try-catch-4.m: Likewise. * objc.dg/try-catch-2.m: Likewise. Enable everywhere. Remove shadowed catch clause. * objc.dg/try-catch-5.m: New. From-SVN: r83332
2004-06-18 03:20:53 +02:00
/* Build the complete FINALLY statement list. */
t = next_sjlj_build_try_exit ();
t = build_stmt (COND_EXPR,
c_common_truthvalue_conversion (rethrow_decl),
c-common.c (flag_objc_sjlj_exceptions): New. * c-common.c (flag_objc_sjlj_exceptions): New. * c-common.h (flag_objc_sjlj_exceptions): Declare. * c-opts.c (c_common_handle_option): Set it. (c_common_post_options): Handle interation of different objective-c exception and runtime switches. * c-decl.c (c_eh_initialized_p): New. (finish_decl): Use it instead of local eh_initialized_p. * c-parse.in (nested_function, notype_nested_function): Record the result of compstmt. (compstmt_or_error): Likewise. (compstmt): Don't add_stmt the result. (stmt): Don't return anything. Rewrite objc try and sync rules. (objc_try_stmt, objc_catch_list): Remove. (objc_catch_block, objc_finally_block): Remove. (objc_catch_prefix, objc_catch_clause, objc_opt_catch_list): New. (objc_try_catch_clause, objc_finally_clause): New. (objc_try_catch_stmt): Rewrite. * c-tree.h (c_eh_initialized_p): Declare. * c-opt (fobjc-sjlj-exceptions): New. * except.c (output_function_exception_table): Don't call cgraph on non-decls. * objc/objc-act.c (UTAG_EXCDATA_VAR, UTAG_CAUGHTEXC_VAR, UTAG_RETHROWEXC_VAR, UTAG_EVALONCE_VAR, struct val_stack, catch_count_stack, exc_binding_stack, if_nesting_count, blk_nesting_count, objc_enter_block, objc_exit_block, objc_declare_variable, 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): Remove. (objc_create_temporary_var, struct objc_try_context, cur_try_context, objc_eh_runtime_type, objc_init_exceptions, objc_build_exc_ptr, next_sjlj_build_try_exit, next_sjlj_build_enter_and_setjmp, next_sjlj_build_exc_extract, next_sjlj_build_catch_list, next_sjlj_build_try_catch_finally, objc_begin_try_stmt, objc_begin_catch_clause, objc_finish_catch_clause, objc_build_finally_clause, objc_finish_try_stmt, objc_build_synchronized): New. (objc_is_object_id, objc_is_class_id): New. (objc_comptypes): Use them. (build_next_objc_exception_stuff): Break NeXT sjlj out from build_objc_exception_stuff. (synth_module_prologue): Update to match. (objc_build_throw_stmt): Use cur_try_context to decide if we're in a @catch. * objc/objc-act.h: Update prototypes. (OCTI_EXCEPTION_BLK_STACK, objc_exception_block_stack): Remove. testsuite/ * objc.dg/sync-1.m: New. * objc.dg/try-catch-1.m: Don't force next runtime. * objc.dg/try-catch-3.m, objc.dg/try-catch-4.m: Likewise. * objc.dg/try-catch-2.m: Likewise. Enable everywhere. Remove shadowed catch clause. * objc.dg/try-catch-5.m: New. From-SVN: r83332
2004-06-18 03:20:53 +02:00
NULL, t);
SET_EXPR_LOCATION (t, cur_try_context->finally_locus);
c-common.c (flag_objc_sjlj_exceptions): New. * c-common.c (flag_objc_sjlj_exceptions): New. * c-common.h (flag_objc_sjlj_exceptions): Declare. * c-opts.c (c_common_handle_option): Set it. (c_common_post_options): Handle interation of different objective-c exception and runtime switches. * c-decl.c (c_eh_initialized_p): New. (finish_decl): Use it instead of local eh_initialized_p. * c-parse.in (nested_function, notype_nested_function): Record the result of compstmt. (compstmt_or_error): Likewise. (compstmt): Don't add_stmt the result. (stmt): Don't return anything. Rewrite objc try and sync rules. (objc_try_stmt, objc_catch_list): Remove. (objc_catch_block, objc_finally_block): Remove. (objc_catch_prefix, objc_catch_clause, objc_opt_catch_list): New. (objc_try_catch_clause, objc_finally_clause): New. (objc_try_catch_stmt): Rewrite. * c-tree.h (c_eh_initialized_p): Declare. * c-opt (fobjc-sjlj-exceptions): New. * except.c (output_function_exception_table): Don't call cgraph on non-decls. * objc/objc-act.c (UTAG_EXCDATA_VAR, UTAG_CAUGHTEXC_VAR, UTAG_RETHROWEXC_VAR, UTAG_EVALONCE_VAR, struct val_stack, catch_count_stack, exc_binding_stack, if_nesting_count, blk_nesting_count, objc_enter_block, objc_exit_block, objc_declare_variable, 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): Remove. (objc_create_temporary_var, struct objc_try_context, cur_try_context, objc_eh_runtime_type, objc_init_exceptions, objc_build_exc_ptr, next_sjlj_build_try_exit, next_sjlj_build_enter_and_setjmp, next_sjlj_build_exc_extract, next_sjlj_build_catch_list, next_sjlj_build_try_catch_finally, objc_begin_try_stmt, objc_begin_catch_clause, objc_finish_catch_clause, objc_build_finally_clause, objc_finish_try_stmt, objc_build_synchronized): New. (objc_is_object_id, objc_is_class_id): New. (objc_comptypes): Use them. (build_next_objc_exception_stuff): Break NeXT sjlj out from build_objc_exception_stuff. (synth_module_prologue): Update to match. (objc_build_throw_stmt): Use cur_try_context to decide if we're in a @catch. * objc/objc-act.h: Update prototypes. (OCTI_EXCEPTION_BLK_STACK, objc_exception_block_stack): Remove. testsuite/ * objc.dg/sync-1.m: New. * objc.dg/try-catch-1.m: Don't force next runtime. * objc.dg/try-catch-3.m, objc.dg/try-catch-4.m: Likewise. * objc.dg/try-catch-2.m: Likewise. Enable everywhere. Remove shadowed catch clause. * objc.dg/try-catch-5.m: New. From-SVN: r83332
2004-06-18 03:20:53 +02:00
append_to_statement_list (t, &TREE_OPERAND (try_fin, 1));
c-common.c (flag_objc_sjlj_exceptions): New. * c-common.c (flag_objc_sjlj_exceptions): New. * c-common.h (flag_objc_sjlj_exceptions): Declare. * c-opts.c (c_common_handle_option): Set it. (c_common_post_options): Handle interation of different objective-c exception and runtime switches. * c-decl.c (c_eh_initialized_p): New. (finish_decl): Use it instead of local eh_initialized_p. * c-parse.in (nested_function, notype_nested_function): Record the result of compstmt. (compstmt_or_error): Likewise. (compstmt): Don't add_stmt the result. (stmt): Don't return anything. Rewrite objc try and sync rules. (objc_try_stmt, objc_catch_list): Remove. (objc_catch_block, objc_finally_block): Remove. (objc_catch_prefix, objc_catch_clause, objc_opt_catch_list): New. (objc_try_catch_clause, objc_finally_clause): New. (objc_try_catch_stmt): Rewrite. * c-tree.h (c_eh_initialized_p): Declare. * c-opt (fobjc-sjlj-exceptions): New. * except.c (output_function_exception_table): Don't call cgraph on non-decls. * objc/objc-act.c (UTAG_EXCDATA_VAR, UTAG_CAUGHTEXC_VAR, UTAG_RETHROWEXC_VAR, UTAG_EVALONCE_VAR, struct val_stack, catch_count_stack, exc_binding_stack, if_nesting_count, blk_nesting_count, objc_enter_block, objc_exit_block, objc_declare_variable, 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): Remove. (objc_create_temporary_var, struct objc_try_context, cur_try_context, objc_eh_runtime_type, objc_init_exceptions, objc_build_exc_ptr, next_sjlj_build_try_exit, next_sjlj_build_enter_and_setjmp, next_sjlj_build_exc_extract, next_sjlj_build_catch_list, next_sjlj_build_try_catch_finally, objc_begin_try_stmt, objc_begin_catch_clause, objc_finish_catch_clause, objc_build_finally_clause, objc_finish_try_stmt, objc_build_synchronized): New. (objc_is_object_id, objc_is_class_id): New. (objc_comptypes): Use them. (build_next_objc_exception_stuff): Break NeXT sjlj out from build_objc_exception_stuff. (synth_module_prologue): Update to match. (objc_build_throw_stmt): Use cur_try_context to decide if we're in a @catch. * objc/objc-act.h: Update prototypes. (OCTI_EXCEPTION_BLK_STACK, objc_exception_block_stack): Remove. testsuite/ * objc.dg/sync-1.m: New. * objc.dg/try-catch-1.m: Don't force next runtime. * objc.dg/try-catch-3.m, objc.dg/try-catch-4.m: Likewise. * objc.dg/try-catch-2.m: Likewise. Enable everywhere. Remove shadowed catch clause. * objc.dg/try-catch-5.m: New. From-SVN: r83332
2004-06-18 03:20:53 +02:00
append_to_statement_list (cur_try_context->finally_body,
&TREE_OPERAND (try_fin, 1));
c-common.c (flag_objc_sjlj_exceptions): New. * c-common.c (flag_objc_sjlj_exceptions): New. * c-common.h (flag_objc_sjlj_exceptions): Declare. * c-opts.c (c_common_handle_option): Set it. (c_common_post_options): Handle interation of different objective-c exception and runtime switches. * c-decl.c (c_eh_initialized_p): New. (finish_decl): Use it instead of local eh_initialized_p. * c-parse.in (nested_function, notype_nested_function): Record the result of compstmt. (compstmt_or_error): Likewise. (compstmt): Don't add_stmt the result. (stmt): Don't return anything. Rewrite objc try and sync rules. (objc_try_stmt, objc_catch_list): Remove. (objc_catch_block, objc_finally_block): Remove. (objc_catch_prefix, objc_catch_clause, objc_opt_catch_list): New. (objc_try_catch_clause, objc_finally_clause): New. (objc_try_catch_stmt): Rewrite. * c-tree.h (c_eh_initialized_p): Declare. * c-opt (fobjc-sjlj-exceptions): New. * except.c (output_function_exception_table): Don't call cgraph on non-decls. * objc/objc-act.c (UTAG_EXCDATA_VAR, UTAG_CAUGHTEXC_VAR, UTAG_RETHROWEXC_VAR, UTAG_EVALONCE_VAR, struct val_stack, catch_count_stack, exc_binding_stack, if_nesting_count, blk_nesting_count, objc_enter_block, objc_exit_block, objc_declare_variable, 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): Remove. (objc_create_temporary_var, struct objc_try_context, cur_try_context, objc_eh_runtime_type, objc_init_exceptions, objc_build_exc_ptr, next_sjlj_build_try_exit, next_sjlj_build_enter_and_setjmp, next_sjlj_build_exc_extract, next_sjlj_build_catch_list, next_sjlj_build_try_catch_finally, objc_begin_try_stmt, objc_begin_catch_clause, objc_finish_catch_clause, objc_build_finally_clause, objc_finish_try_stmt, objc_build_synchronized): New. (objc_is_object_id, objc_is_class_id): New. (objc_comptypes): Use them. (build_next_objc_exception_stuff): Break NeXT sjlj out from build_objc_exception_stuff. (synth_module_prologue): Update to match. (objc_build_throw_stmt): Use cur_try_context to decide if we're in a @catch. * objc/objc-act.h: Update prototypes. (OCTI_EXCEPTION_BLK_STACK, objc_exception_block_stack): Remove. testsuite/ * objc.dg/sync-1.m: New. * objc.dg/try-catch-1.m: Don't force next runtime. * objc.dg/try-catch-3.m, objc.dg/try-catch-4.m: Likewise. * objc.dg/try-catch-2.m: Likewise. Enable everywhere. Remove shadowed catch clause. * objc.dg/try-catch-5.m: New. From-SVN: r83332
2004-06-18 03:20:53 +02:00
t = tree_cons (NULL, rethrow_decl, NULL);
t = build_function_call (objc_exception_throw_decl, t);
t = build_stmt (COND_EXPR,
c_common_truthvalue_conversion (rethrow_decl),
c-common.c (flag_objc_sjlj_exceptions): New. * c-common.c (flag_objc_sjlj_exceptions): New. * c-common.h (flag_objc_sjlj_exceptions): Declare. * c-opts.c (c_common_handle_option): Set it. (c_common_post_options): Handle interation of different objective-c exception and runtime switches. * c-decl.c (c_eh_initialized_p): New. (finish_decl): Use it instead of local eh_initialized_p. * c-parse.in (nested_function, notype_nested_function): Record the result of compstmt. (compstmt_or_error): Likewise. (compstmt): Don't add_stmt the result. (stmt): Don't return anything. Rewrite objc try and sync rules. (objc_try_stmt, objc_catch_list): Remove. (objc_catch_block, objc_finally_block): Remove. (objc_catch_prefix, objc_catch_clause, objc_opt_catch_list): New. (objc_try_catch_clause, objc_finally_clause): New. (objc_try_catch_stmt): Rewrite. * c-tree.h (c_eh_initialized_p): Declare. * c-opt (fobjc-sjlj-exceptions): New. * except.c (output_function_exception_table): Don't call cgraph on non-decls. * objc/objc-act.c (UTAG_EXCDATA_VAR, UTAG_CAUGHTEXC_VAR, UTAG_RETHROWEXC_VAR, UTAG_EVALONCE_VAR, struct val_stack, catch_count_stack, exc_binding_stack, if_nesting_count, blk_nesting_count, objc_enter_block, objc_exit_block, objc_declare_variable, 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): Remove. (objc_create_temporary_var, struct objc_try_context, cur_try_context, objc_eh_runtime_type, objc_init_exceptions, objc_build_exc_ptr, next_sjlj_build_try_exit, next_sjlj_build_enter_and_setjmp, next_sjlj_build_exc_extract, next_sjlj_build_catch_list, next_sjlj_build_try_catch_finally, objc_begin_try_stmt, objc_begin_catch_clause, objc_finish_catch_clause, objc_build_finally_clause, objc_finish_try_stmt, objc_build_synchronized): New. (objc_is_object_id, objc_is_class_id): New. (objc_comptypes): Use them. (build_next_objc_exception_stuff): Break NeXT sjlj out from build_objc_exception_stuff. (synth_module_prologue): Update to match. (objc_build_throw_stmt): Use cur_try_context to decide if we're in a @catch. * objc/objc-act.h: Update prototypes. (OCTI_EXCEPTION_BLK_STACK, objc_exception_block_stack): Remove. testsuite/ * objc.dg/sync-1.m: New. * objc.dg/try-catch-1.m: Don't force next runtime. * objc.dg/try-catch-3.m, objc.dg/try-catch-4.m: Likewise. * objc.dg/try-catch-2.m: Likewise. Enable everywhere. Remove shadowed catch clause. * objc.dg/try-catch-5.m: New. From-SVN: r83332
2004-06-18 03:20:53 +02:00
t, NULL);
SET_EXPR_LOCATION (t, cur_try_context->end_finally_locus);
c-common.c (flag_objc_sjlj_exceptions): New. * c-common.c (flag_objc_sjlj_exceptions): New. * c-common.h (flag_objc_sjlj_exceptions): Declare. * c-opts.c (c_common_handle_option): Set it. (c_common_post_options): Handle interation of different objective-c exception and runtime switches. * c-decl.c (c_eh_initialized_p): New. (finish_decl): Use it instead of local eh_initialized_p. * c-parse.in (nested_function, notype_nested_function): Record the result of compstmt. (compstmt_or_error): Likewise. (compstmt): Don't add_stmt the result. (stmt): Don't return anything. Rewrite objc try and sync rules. (objc_try_stmt, objc_catch_list): Remove. (objc_catch_block, objc_finally_block): Remove. (objc_catch_prefix, objc_catch_clause, objc_opt_catch_list): New. (objc_try_catch_clause, objc_finally_clause): New. (objc_try_catch_stmt): Rewrite. * c-tree.h (c_eh_initialized_p): Declare. * c-opt (fobjc-sjlj-exceptions): New. * except.c (output_function_exception_table): Don't call cgraph on non-decls. * objc/objc-act.c (UTAG_EXCDATA_VAR, UTAG_CAUGHTEXC_VAR, UTAG_RETHROWEXC_VAR, UTAG_EVALONCE_VAR, struct val_stack, catch_count_stack, exc_binding_stack, if_nesting_count, blk_nesting_count, objc_enter_block, objc_exit_block, objc_declare_variable, 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): Remove. (objc_create_temporary_var, struct objc_try_context, cur_try_context, objc_eh_runtime_type, objc_init_exceptions, objc_build_exc_ptr, next_sjlj_build_try_exit, next_sjlj_build_enter_and_setjmp, next_sjlj_build_exc_extract, next_sjlj_build_catch_list, next_sjlj_build_try_catch_finally, objc_begin_try_stmt, objc_begin_catch_clause, objc_finish_catch_clause, objc_build_finally_clause, objc_finish_try_stmt, objc_build_synchronized): New. (objc_is_object_id, objc_is_class_id): New. (objc_comptypes): Use them. (build_next_objc_exception_stuff): Break NeXT sjlj out from build_objc_exception_stuff. (synth_module_prologue): Update to match. (objc_build_throw_stmt): Use cur_try_context to decide if we're in a @catch. * objc/objc-act.h: Update prototypes. (OCTI_EXCEPTION_BLK_STACK, objc_exception_block_stack): Remove. testsuite/ * objc.dg/sync-1.m: New. * objc.dg/try-catch-1.m: Don't force next runtime. * objc.dg/try-catch-3.m, objc.dg/try-catch-4.m: Likewise. * objc.dg/try-catch-2.m: Likewise. Enable everywhere. Remove shadowed catch clause. * objc.dg/try-catch-5.m: New. From-SVN: r83332
2004-06-18 03:20:53 +02:00
append_to_statement_list (t, &TREE_OPERAND (try_fin, 1));
c-common.c (flag_objc_sjlj_exceptions): New. * c-common.c (flag_objc_sjlj_exceptions): New. * c-common.h (flag_objc_sjlj_exceptions): Declare. * c-opts.c (c_common_handle_option): Set it. (c_common_post_options): Handle interation of different objective-c exception and runtime switches. * c-decl.c (c_eh_initialized_p): New. (finish_decl): Use it instead of local eh_initialized_p. * c-parse.in (nested_function, notype_nested_function): Record the result of compstmt. (compstmt_or_error): Likewise. (compstmt): Don't add_stmt the result. (stmt): Don't return anything. Rewrite objc try and sync rules. (objc_try_stmt, objc_catch_list): Remove. (objc_catch_block, objc_finally_block): Remove. (objc_catch_prefix, objc_catch_clause, objc_opt_catch_list): New. (objc_try_catch_clause, objc_finally_clause): New. (objc_try_catch_stmt): Rewrite. * c-tree.h (c_eh_initialized_p): Declare. * c-opt (fobjc-sjlj-exceptions): New. * except.c (output_function_exception_table): Don't call cgraph on non-decls. * objc/objc-act.c (UTAG_EXCDATA_VAR, UTAG_CAUGHTEXC_VAR, UTAG_RETHROWEXC_VAR, UTAG_EVALONCE_VAR, struct val_stack, catch_count_stack, exc_binding_stack, if_nesting_count, blk_nesting_count, objc_enter_block, objc_exit_block, objc_declare_variable, 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): Remove. (objc_create_temporary_var, struct objc_try_context, cur_try_context, objc_eh_runtime_type, objc_init_exceptions, objc_build_exc_ptr, next_sjlj_build_try_exit, next_sjlj_build_enter_and_setjmp, next_sjlj_build_exc_extract, next_sjlj_build_catch_list, next_sjlj_build_try_catch_finally, objc_begin_try_stmt, objc_begin_catch_clause, objc_finish_catch_clause, objc_build_finally_clause, objc_finish_try_stmt, objc_build_synchronized): New. (objc_is_object_id, objc_is_class_id): New. (objc_comptypes): Use them. (build_next_objc_exception_stuff): Break NeXT sjlj out from build_objc_exception_stuff. (synth_module_prologue): Update to match. (objc_build_throw_stmt): Use cur_try_context to decide if we're in a @catch. * objc/objc-act.h: Update prototypes. (OCTI_EXCEPTION_BLK_STACK, objc_exception_block_stack): Remove. testsuite/ * objc.dg/sync-1.m: New. * objc.dg/try-catch-1.m: Don't force next runtime. * objc.dg/try-catch-3.m, objc.dg/try-catch-4.m: Likewise. * objc.dg/try-catch-2.m: Likewise. Enable everywhere. Remove shadowed catch clause. * objc.dg/try-catch-5.m: New. From-SVN: r83332
2004-06-18 03:20:53 +02:00
return bind;
}
c-common.c (flag_objc_sjlj_exceptions): New. * c-common.c (flag_objc_sjlj_exceptions): New. * c-common.h (flag_objc_sjlj_exceptions): Declare. * c-opts.c (c_common_handle_option): Set it. (c_common_post_options): Handle interation of different objective-c exception and runtime switches. * c-decl.c (c_eh_initialized_p): New. (finish_decl): Use it instead of local eh_initialized_p. * c-parse.in (nested_function, notype_nested_function): Record the result of compstmt. (compstmt_or_error): Likewise. (compstmt): Don't add_stmt the result. (stmt): Don't return anything. Rewrite objc try and sync rules. (objc_try_stmt, objc_catch_list): Remove. (objc_catch_block, objc_finally_block): Remove. (objc_catch_prefix, objc_catch_clause, objc_opt_catch_list): New. (objc_try_catch_clause, objc_finally_clause): New. (objc_try_catch_stmt): Rewrite. * c-tree.h (c_eh_initialized_p): Declare. * c-opt (fobjc-sjlj-exceptions): New. * except.c (output_function_exception_table): Don't call cgraph on non-decls. * objc/objc-act.c (UTAG_EXCDATA_VAR, UTAG_CAUGHTEXC_VAR, UTAG_RETHROWEXC_VAR, UTAG_EVALONCE_VAR, struct val_stack, catch_count_stack, exc_binding_stack, if_nesting_count, blk_nesting_count, objc_enter_block, objc_exit_block, objc_declare_variable, 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): Remove. (objc_create_temporary_var, struct objc_try_context, cur_try_context, objc_eh_runtime_type, objc_init_exceptions, objc_build_exc_ptr, next_sjlj_build_try_exit, next_sjlj_build_enter_and_setjmp, next_sjlj_build_exc_extract, next_sjlj_build_catch_list, next_sjlj_build_try_catch_finally, objc_begin_try_stmt, objc_begin_catch_clause, objc_finish_catch_clause, objc_build_finally_clause, objc_finish_try_stmt, objc_build_synchronized): New. (objc_is_object_id, objc_is_class_id): New. (objc_comptypes): Use them. (build_next_objc_exception_stuff): Break NeXT sjlj out from build_objc_exception_stuff. (synth_module_prologue): Update to match. (objc_build_throw_stmt): Use cur_try_context to decide if we're in a @catch. * objc/objc-act.h: Update prototypes. (OCTI_EXCEPTION_BLK_STACK, objc_exception_block_stack): Remove. testsuite/ * objc.dg/sync-1.m: New. * objc.dg/try-catch-1.m: Don't force next runtime. * objc.dg/try-catch-3.m, objc.dg/try-catch-4.m: Likewise. * objc.dg/try-catch-2.m: Likewise. Enable everywhere. Remove shadowed catch clause. * objc.dg/try-catch-5.m: New. From-SVN: r83332
2004-06-18 03:20:53 +02:00
/* Called just after parsing the @try and its associated BODY. We now
must prepare for the tricky bits -- handling the catches and finally. */
c-common.c (flag_objc_sjlj_exceptions): New. * c-common.c (flag_objc_sjlj_exceptions): New. * c-common.h (flag_objc_sjlj_exceptions): Declare. * c-opts.c (c_common_handle_option): Set it. (c_common_post_options): Handle interation of different objective-c exception and runtime switches. * c-decl.c (c_eh_initialized_p): New. (finish_decl): Use it instead of local eh_initialized_p. * c-parse.in (nested_function, notype_nested_function): Record the result of compstmt. (compstmt_or_error): Likewise. (compstmt): Don't add_stmt the result. (stmt): Don't return anything. Rewrite objc try and sync rules. (objc_try_stmt, objc_catch_list): Remove. (objc_catch_block, objc_finally_block): Remove. (objc_catch_prefix, objc_catch_clause, objc_opt_catch_list): New. (objc_try_catch_clause, objc_finally_clause): New. (objc_try_catch_stmt): Rewrite. * c-tree.h (c_eh_initialized_p): Declare. * c-opt (fobjc-sjlj-exceptions): New. * except.c (output_function_exception_table): Don't call cgraph on non-decls. * objc/objc-act.c (UTAG_EXCDATA_VAR, UTAG_CAUGHTEXC_VAR, UTAG_RETHROWEXC_VAR, UTAG_EVALONCE_VAR, struct val_stack, catch_count_stack, exc_binding_stack, if_nesting_count, blk_nesting_count, objc_enter_block, objc_exit_block, objc_declare_variable, 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): Remove. (objc_create_temporary_var, struct objc_try_context, cur_try_context, objc_eh_runtime_type, objc_init_exceptions, objc_build_exc_ptr, next_sjlj_build_try_exit, next_sjlj_build_enter_and_setjmp, next_sjlj_build_exc_extract, next_sjlj_build_catch_list, next_sjlj_build_try_catch_finally, objc_begin_try_stmt, objc_begin_catch_clause, objc_finish_catch_clause, objc_build_finally_clause, objc_finish_try_stmt, objc_build_synchronized): New. (objc_is_object_id, objc_is_class_id): New. (objc_comptypes): Use them. (build_next_objc_exception_stuff): Break NeXT sjlj out from build_objc_exception_stuff. (synth_module_prologue): Update to match. (objc_build_throw_stmt): Use cur_try_context to decide if we're in a @catch. * objc/objc-act.h: Update prototypes. (OCTI_EXCEPTION_BLK_STACK, objc_exception_block_stack): Remove. testsuite/ * objc.dg/sync-1.m: New. * objc.dg/try-catch-1.m: Don't force next runtime. * objc.dg/try-catch-3.m, objc.dg/try-catch-4.m: Likewise. * objc.dg/try-catch-2.m: Likewise. Enable everywhere. Remove shadowed catch clause. * objc.dg/try-catch-5.m: New. From-SVN: r83332
2004-06-18 03:20:53 +02:00
void
objc_begin_try_stmt (location_t try_locus, tree body)
{
struct objc_try_context *c = xcalloc (1, sizeof (*c));
c->outer = cur_try_context;
c->try_body = body;
c->try_locus = try_locus;
c->end_try_locus = input_location;
cur_try_context = c;
c-common.c (flag_objc_sjlj_exceptions): New. * c-common.c (flag_objc_sjlj_exceptions): New. * c-common.h (flag_objc_sjlj_exceptions): Declare. * c-opts.c (c_common_handle_option): Set it. (c_common_post_options): Handle interation of different objective-c exception and runtime switches. * c-decl.c (c_eh_initialized_p): New. (finish_decl): Use it instead of local eh_initialized_p. * c-parse.in (nested_function, notype_nested_function): Record the result of compstmt. (compstmt_or_error): Likewise. (compstmt): Don't add_stmt the result. (stmt): Don't return anything. Rewrite objc try and sync rules. (objc_try_stmt, objc_catch_list): Remove. (objc_catch_block, objc_finally_block): Remove. (objc_catch_prefix, objc_catch_clause, objc_opt_catch_list): New. (objc_try_catch_clause, objc_finally_clause): New. (objc_try_catch_stmt): Rewrite. * c-tree.h (c_eh_initialized_p): Declare. * c-opt (fobjc-sjlj-exceptions): New. * except.c (output_function_exception_table): Don't call cgraph on non-decls. * objc/objc-act.c (UTAG_EXCDATA_VAR, UTAG_CAUGHTEXC_VAR, UTAG_RETHROWEXC_VAR, UTAG_EVALONCE_VAR, struct val_stack, catch_count_stack, exc_binding_stack, if_nesting_count, blk_nesting_count, objc_enter_block, objc_exit_block, objc_declare_variable, 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): Remove. (objc_create_temporary_var, struct objc_try_context, cur_try_context, objc_eh_runtime_type, objc_init_exceptions, objc_build_exc_ptr, next_sjlj_build_try_exit, next_sjlj_build_enter_and_setjmp, next_sjlj_build_exc_extract, next_sjlj_build_catch_list, next_sjlj_build_try_catch_finally, objc_begin_try_stmt, objc_begin_catch_clause, objc_finish_catch_clause, objc_build_finally_clause, objc_finish_try_stmt, objc_build_synchronized): New. (objc_is_object_id, objc_is_class_id): New. (objc_comptypes): Use them. (build_next_objc_exception_stuff): Break NeXT sjlj out from build_objc_exception_stuff. (synth_module_prologue): Update to match. (objc_build_throw_stmt): Use cur_try_context to decide if we're in a @catch. * objc/objc-act.h: Update prototypes. (OCTI_EXCEPTION_BLK_STACK, objc_exception_block_stack): Remove. testsuite/ * objc.dg/sync-1.m: New. * objc.dg/try-catch-1.m: Don't force next runtime. * objc.dg/try-catch-3.m, objc.dg/try-catch-4.m: Likewise. * objc.dg/try-catch-2.m: Likewise. Enable everywhere. Remove shadowed catch clause. * objc.dg/try-catch-5.m: New. From-SVN: r83332
2004-06-18 03:20:53 +02:00
objc_init_exceptions ();
Yet more Objective-C++... * objc-act.c (objc_finish_try_stmt): Add return value. (objc_build_synchronized): Likewise. * objc-act.c (objc_is_gcable_type): Add. (objc_substitute_decl): Add. (objc_build_ivar_assignment): Add. (objc_build_global_assignment): Add. (objc_build_strong_cast_assignment): Add. (objc_is_ivar_reference_p): Add. (objc_is_global_reference_p): Add. (objc_generate_write_barrier): Add. (objc_rewrite_function_call): Add. (objc_gimplify_expr): Add Objective-C++ support. * objc-act.h (ALLOC_OBJC_TYPE_LANG_SPECIFIC): Likewise. (SIZEOF_OBJC_TYPE_LANG_SPECIFIC): Add. (INIT_TYPE_OBJC_INFO): Add Objective-C++ support. (DUP_TYPE_OBJC_INFO): Likewise. (struct imp_entry): Add field has_cxx_cdtors. (struct imp_entry *imp_list): Add OCTI_UMSG_FAST_DECL, OCTI_METH_LIST_TEMPL, OCTI_METH_PROTO_LIST_TEMPL, OCTI_IVAR_LIST_TEMPL, OCTI_ASSIGN_IVAR_DECL, OCTI_ASSIGN_IVAR_FAST_DECL, OCTI_ASSIGN_GLOBAL_DECL, OCTI_ASSIGN_STRONGCAST_DECL. (umsg_fast_decl): Add. (objc_assign_ivar_decl): Add. (objc_assign_ivar_fast_decl): Add. (objc_assign_global_decl): Add. (objc_assign_strong_cast_decl): Add. (objc_method_list_ptr): Add. (objc_method_proto_list_ptr): Add. (objc_ivar_list_ptr): Add. * objc-act.c (should_call_super_dealloc): Add. (OBJC_VERSION): Bump to 6. (objc_is_gcable_type): Add. (objc_substitute_decl): Add. (objc_build_ivar_assignment): Add. (objc_build_global_assignment): Add. (objc_build_strong_cast_assignment): Add. (objc_is_gcable_p): Add. (objc_is_ivar_reference_p): Add. (objc_is_global_reference_p): Add. (generate_shared_structures): Add flags parameter. (objc_generate_cxx_ctor_or_dtor): Add. (objc_generate_cxx_cdtors): Add. (add_class): Add name parameter. (objc_types_share_size_and_alignment): Add. (comp_proto_with_proto): Add strict parameter. (CLS_HAS_CXX_STRUCTORS): Add. (TAG_ASSIGNIVAR): Add. (TAG_ASSIGNGLOBAL): Add. (TAG_ASSIGNSTRONGCAST): Add. (TAG_MSGSEND_FAST): Add. (TAG_ASSIGNIVAR_FAST): Add. (TAG_CXX_CONSTRUCT): Add. (TAG_CXX_DESTRUCT): Add. (OBJC_LOOKUP_CLASS): Add. (OBJC_LOOKUP_NO_SUPER): Add. (objc_finish_file): Add pch support. (objc_finish_implementation): Add Objective-C++ support. (synth_module_prologue): Likewise. (synth_module_prologue): Add fast dispatching. (objc_get_class_reference): Add Objective-C++ support. (objc_generate_write_barrier): Likewise. (next_sjlj_build_enter_and_setjmp): Likewise. (objc_begin_try_stmt): Likewise. (build_next_objc_exception_stuff): Add fast ivar support. (build_private_template): Mark the record as used so debug information is generated. (build_protocol_template): Add Objective-C++ support. (objc_method_parm_type) Likewise. (objc_generate_cxx_ctor_or_dtor): Likewise. (objc_generate_cxx_cdtors): Likewise. (build_protocol_initializer): Likewise. (build_category_template): Likewise. (build_class_template): Likewise. (build_method_list_template): Likewise. (build_category_initializer): Likewise. (build_shared_structure_initializer): Likewise. (objc_finish_message_expr): Likewise. (build_objc_method_call): Add fast dispatch support. (lookup_method_static): Add support to end search at superclasses. (add_method_to_hash_list): Add strict parameter to comp_proto_with_proto. (objc_add_method): Likewise. (objc_add_method): Also set the interface_value. (add_instance_variable): Add Objective-C++ support. (objc_is_public): Likewise. (start_class): Likewise. (continue_class): Likewise. (encode_aggregate_within): Likewise. (start_method_def): Likewise. (objc_start_function): Clear current_function_returns_value and current_function_returns_null. (really_start_method): Add Objective-C++ support. (objc_finish_method_definition): Add warning for missing [super dealloc]. (finish_objc): Add Objective-C++ support. (generate_objc_image_info): Likewise. (objc_lookup_ivar): Likewise. * objc-act.h (TYPE_HAS_OBJC_INFO): Likewise. (INIT_TYPE_OBJC_INFO): Likewise. (DUP_TYPE_OBJC_INFO): Likewise. From-SVN: r99857
2005-05-17 22:07:08 +02:00
if (flag_objc_sjlj_exceptions)
objc_mark_locals_volatile (NULL);
}
/* Called just after parsing "@catch (parm)". Open a binding level,
Makefile.in (c-parse.o): Depend on $(C_COMMON_H). [gcc/ChangeLog] 2004-09-07 Ziemowit Laski <zlaski@apple.com> * Makefile.in (c-parse.o): Depend on $(C_COMMON_H). * c-parse.in: Include c-common.h instead of objc-act.h. (ivar_decl_list, ivar_decls, ivar_decl, ivars, ivar_declarator, myparms, myparm): Remove %type declarations. (methodtype, optparms, OBJC_TYPE_QUAL, objc_quals, objc_qual, objc_typename, objc_try_catch_stmt, optellipsis): Add %type declarations. (objc_inherit_code, objc_public_flag): Remove. (typespec_nonreserved_nonattr): Call objc_get_protocol_qualified_type() instead of get_static_reference() and get_protocol_reference(). (stmt_nocomp): Call grokparm() on @catch parameter. (objcdef): Move semantic action to objc_finish_implementation(). (classdef): Move semantic action to objc_start_class_interface(), objc_continue_interface(), objc_finish_interface(), objc_start_class_implementation(), objc_continue_implementation(), objc_start_category_interface() and objc_start_category_implementation(). (protocoldef): Move semantic actions to objc_start_protocol() and objc_finish_interface(). (ivar_decl_list): Remove nonterminal. (visibility_spec): Move semantic actions to objc_set_visibility(). (ivar_decls): Remove assignment to $$. (ivar_decl): Rephrase in terms of component_decl; call objc_add_instance_variable(). (ivars, ivar_declarator): Remove nonterminals. (opt_semi): New nonterminal. (methodtype): Remove semantic actions. (methoddef): Move semantic actions to objc_set_method_type(), objc_start_method_definition() and objc_finish_method_definition(). (methodproto): Move semantic actions to objc_set_method_type() and objc_add_method_declaration(). (methoddecl): Use objc_typename instead of typename; move semantic actions to objc_build_method_signature(). (optarglist, myxdecls, mydecl, myparms, myparm): Remove nonterminals. (optparmlist): Express in terms of optparms and optellipsis. (optparms, optellipsis, objc_qual, objc_quals, objc_typename): New nonterminals. (keyworddecl): Use objc_typename instead of typename. (rid_to_yy): Mark RID_IN, RID_OUT, RID_INOUT, RID_BYCOPY, RID_BYREF and RID_ONEWAY as returning OBJC_TYPE_QUAL to yyparse(). [gcc/objc/ChangeLog] 2004-09-07 Ziemowit Laski <zlaski@apple.com> * Make-lang.in (objc/objc-parse.o): Depend on $(C_COMMON_H) instead of objc/objc-act.h. (objc/objc-act.o): Depend on $(HASHTAB_H). * objc-act.c: Include hashtab.h; in ObjC++ mode, include cp-tree.h and objcp-decl.h instead of c-tree.h. (build_module_descriptor, get_class_ivars, synth_id_with_class_suffix, error_with_ivar, gen_method_decl, gen_declaration, setup_string_decl, build_protocol_template): Adjust prototypes. (build_module_initializer_routine, start_class, continue_class, finish_class, start_method_def, objc_start_function, start_protocol, build_method_decl, objc_add_method, add_instance_variable, build_ivar_reference, is_ivar, is_private, get_super_receiver, build_selector_table_decl, objc_push_parm, objc_get_parm_info, gen_type_name, gen_type_name_0, start_var_decl, finish_var_decl, create_field_decl): New prototypes. (objc_expand_function_end, comp_method_with_proto, objc_expr_last, gen_declaration_1, gen_declarator, is_complex_decl, adorn_decl, define_decl, create_builtin_decl, gen_declspecs): Remove prototypes. (TYPE_ID): Rename to OBJECT_TYPEDEF_NAME. (CLASS_TYPEDEF_NAME): New. (TAG_EXECCLASS): Change from a global variable to a #define. (TAG_RETURN_STRUCT): Delete. (TAG_GNUINIT): New, holds '__objc_gnu_init' name. (objc_inherit_code, objc_public_flag): New, moved from c-parse.in. (string_descriptor): New struct. (string_htab): New hash table. (string_hash, string_eq): New prototypes. (generate_struct_by_value_array): Call create_field_decl() instead of create_builtin_decl(). (objc_init): Do not initialize objc_ellipsis_node or TAG_EXECCLASS; In ObjC++ mode, call cxx_init() instead of c_objc_common_init(). (objc_finish_file): In ObjC++, call instantiate_pending_templates() and cp_finish_file(). (define_decl, get_static_reference, get_protocol_reference, create_builtin_decl): Remove functions. (objc_start_class_interface, objc_start_category_interface, objc_start_protocol, objc_continue_interface, objc_finish_interface, objc_start_class_implementation, objc_start_category_implementation, objc_continue_implementation, objc_finish_implementation, objc_set_visibility, objc_set_method_type, objc_build_method_signature, objc_add_method_declaration, objc_start_method_definition, objc_add_instance_variable, objc_get_protocol_qualified_type, create_field_decl, start_var_decl, finish_var_decl): New functions. (setup_string_decl): Simplify since it is only called once. (synth_module_prologue): Call build_class_template(); predefine 'id' and 'Class' as typedefs; rename 'temp_type' to 'type'; disable debug hooks for duration of function; fix GNU runtime messenger signatures to correspond to reality; forward-declare '__objc_exec_class' for the GNU runtime; call build_selector_table_decl(); in ObjC++ mode, generate 'extern "C" { ... }' wrappers around synthesized declarations; call build_protocol_template() and build_category_template(). (string_hash, string_eq): New functions. (objc_build_string_object): Check metaclass correctness only once; store string literals in hash table. (objc_build_constructor): Do not convert initializer elements; adjust for ObjC++ impedance mismatch. (build_objc_symtab_template): Call create_field_decl() instead of create_builtin_decl(). (init_objc_symtab): Add missing conversion to initializer element. (build_metadata_decl): Call start_var_decl() instead of define_decl(). (generate_objc_symtab_decl): Do not call build_category_template(); call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(). (build_module_descriptor): Call create_field_decl() instead of grokfield(); call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(); always mark module descriptor as used; move GNU runtime-specific functionality to build_module_initializer_routine(). (build_module_initializer_routine): New function, broken off of build_module_descriptor(). (objc_static_init_needed_p, objc_generate_static_init_call): New functions. (generate_static_references, generate_strings, build_selector_translation_table, generate_descriptor_table, generate_ivars_list, generate_dispatch_table, generate_category): Call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(); build a type directly instead of via groktypename(). (build_selector_reference_decl, build_selector_table_decl, build_class_reference_decl, build_protocol_reference, generate_objc_image_info): Call start_var_decl() instead of build_decl(). (build_selector_reference): For GNU runtime, do not call build_selector_reference_decl(). (build_selector, build_typed_selector_reference): Always convert result to the selector type. (add_objc_string): Cast return value to 'char *'. (build_method_prototype_template, build_selector_template, build_method_template): Use actual selector type for fields pointing to selectors. (finish_objc): For GNU runtime, call build_module_initializer_routine() after build_module_descriptor(). (generate_protocol_list, generate_shared_structures): Call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(); build a type directly instead of via groktypename(). (synth_id_with_class_suffix): Return a string. (get_arg_type_list): For instance methods, use the instance type for 'self'; do not call groktypename_in_parm_context(). (build_objc_string_decl): Squash redeclaration errors in ObjC++. (objc_is_class_name): Use OBJC_TYPE_NAME instead of TYPE_NAME; handle RECORD_TYPEs in ObjC as well as ObjC++. (objc_is_id): New function. (objc_is_object_ptr): Return the canonical type node. (objc_get_class_ivars): Simplify using get_class_ivars(). (get_class_ivars): Remove second parameter; create a fresh copy of the ivar list for each call; do not check for existence of super class. (objc_eh_runtime_type): Mark #ifndef OBJCPLUS. (objc_init_exceptions): When using SJLJ-style exceptions, require the use of '-fobjc-exceptions' flag; do not require it for DWARF-style exceptions. (objc_build_exc_ptr, next_sjlj_build_try_catch_finally): Use objc_object_type instead of objc_id_type. (objc_begin_catch_clause): Convert the incoming PARM_DECL into a VAR_DECL before placing it in the appropriate scope; do not call define_decl(); adjust call to c_begin_compound_stmt(); use objc_object_type instead of objc_id_type. (build_next_objc_exception_stuff): Call create_field_decl() instead of create_builtin_decl(); construct type directly instead of calling groktypename(); use OBJC_VOID_AT_END to mark end of function parameters. (build_private_template): Adjust call to get_class_ivars(); build a type directly instead of via groktypename(). (build_protocol_template, build_method_prototype_list_template, build_method_prototype_template, build_category_template, build_selector_template, build_class_template, build_super_template, build_ivar_template, build_ivar_list_template, build_method_list_template, build_method_template): Call create_field_decl() instead of grokfield(). (objc_method_parm_type): Do not call groktypename(). (generate_descriptor_table): Call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(). (generate_method_descriptors, build_protocol_initializer, generate_dispatch_tables, build_category_initializer, build_shared_structure_initializer): Do not call groktypename(). (generate_protocols): Call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(); do not call groktypename(). (error_with_ivar): Remove last parameter. (check_ivars): Do not iterate ovar CLASS_RAW_IVARS lists in addition to CLASS_IVARS lists; adjust calls to error_with_ivar(). (generate_ivar_lists): Convert one of the initializer elements; do not call groktypename(). (get_arg_type_list, start_method_def, gen_method_def): Account for new representation of variable arguments and '...' in Objective-C methods; add Objective-C++ impedance matching code. (is_objc_type_qualifier): Remove function. (adjust_type_for_id_default): Simplify; there is no longer a need to wade through declspecs. (lookup_interface, start_class, continue_class, finish_class, start_method_def, start_protocol, build_method_decl, objc_add_method, add_instance_variable, build_ivar_reference, is_ivar, is_private, get_super_receiver, objc_build_finally_epilogue): Make into static functions. (receiver_is_class_object): Use new IS_CLASS() macro. (objc_build_message_expr): Tweak ObjC++ message argument handling; call objc_finish_message_expr() instead of finish_message_expr(). (finish_message_expr): Rename to objc_finish_message_expr(); use OBJC_TYPE_NAME and OBJC_SET_TYPE_NAME macros instead of TYPE_NAME. call gen_type_name() instead of gen_declaration(); call objc_is_id() instead of using IS_ID and IS_CLASS; Use objc_class_name instead of calling get_identifier("Class"); handle CONVERT_EXPRs in receiver. (build_objc_method_call, warn_with_method): Do not call groktypename(). (build_ivar_reference): Call convert() instead of clobbering in a type. (hash_init): Initialize string_htab hash table. (add_instance_variable): Simplify parameter list; do not call grokfield(); do not populate CLASS_IVARS list. (start_class): Check for the existence of super class, if one was specified. (continue_class): Use CLASS_RAW_IVARS rather than CLASS_IVARS; do not call build_class_template(); adjust call to get_class_ivars(); call build_decl(), pushdecl() and finish_decl() instead of define_decl(). (finish_class): Call build_decl(), pushdecl() and finish_decl() instead of define_decl(). (add_protocols): Use PROTOCOL_BINFO_ELTS for the tree vector size. (start_protocol): Do not call build_protocol_template(); use PROTOCOL_BINFO_ELTS for the tree vector size. (encode_type_qualifiers): Do not handle the 'const' qualifier here. (encode_pointer): Encode 'const char *' as 'r*', for backwards compatibility. (encode_array): Use HOST_WIDE_INT_PRINT_DEC instead of "%ld". (encode_type): Handle the 'const' qualifier here. (objc_parmlist): New global variable, sued by objc_push_parm and objc_get_parm_info(). (objc_push_parm, objc_get_parm_info): New functions. (objc_expr_last): Remove function. (synth_self_and_ucmd_args): For instance methods, use the instance type for 'self'; call objc_push_parm() instead of push_parm_decl(). (start_method_def): Do not call push_scope(), declare_parm_level(), pop_scope(), push_parm_decl(), store_parm_decls() or objc_expr_last(); just use objc_push_parm() and objc_get_parm_info(). (comp_method_with_proto): Remove function. (objc_types_are_equivalent): Strip away indirections before comparing underlying types. (comp_proto_with_proto): Do not call groktypename(); types are no longer in raw declspec format. (objc_start_function): New function. (really_start_method): Call comp_proto_with_proto() instead of comp_method_with_proto(); call objc_start_function() instead of hand-crafting a function declarator. (continue_method_def, objc_expand_function_end): Remove functions. (get_super_receiver): Call objc_get_current_scope() instead of get_current_scope(); reference 'super_class' field (instead of 'class'). (finish_method_def): Rename to objc_finish_method_definition() and add a function decl parameter; move method encoding call from objc_expand_function_end(). (is_complex_decl, adorn_decl, gen_declarator, gen_declspecs, gen_declaration_1): Remove functions. (tmpbuf, RAW_DECLSPEC): Remove. (gen_declaration): Remove second parameter; simplify to deal with TYPE_P nodes instead of raw declspecs. (gen_type_name, gen_type_name_0): New functions. (gen_method_decl): Remove second parameter; call gen_type_name() instead of gen_declaration_1(). (dump_interface): Adjust calls to gen_declaration() and gen_method_decl(); do not allocate a separate string buffer. (init_objc): Allocate a larger string buffer to accommodate dump_interface(); adjust call to build_module_descriptor(); add call to build_module_initializer_routine() for the GNU runtime. (generate_classref_translation_entry): Do not call start_decl(); call finish_var_decl() instead of finish_decl(); call convert() instead of build_c_cast(). * objc-act.h (CLASS_OWN_IVARS): Remove accessor. (CLASS_BINFO_ELTS): Reduce from 6 to 5, now that CLASS_OWN_IVARS is gone. (OCTI_GNU_INIT_DECL, GNU_INIT_decl): New. (OCTI_ELLIPSIS_NODE, objc_ellipsis_node): Remove. (OCTI_ID_ID, id_type, objc_id_id): Rename to OCTI_ID_NAME, objc_object_type and objc_object_name, respectively. (OCTI_CLS_REF, OCTI_CLASS_NAME, objc_class_reference, objc_class_name): New. (IS_CLASS): New macro. (IS_ID, IS_SUPER): Robustify. (OCTI_EXECCLASS_DECL, execclass_decl): New. (finish_file, start_class, continue_class, finish_class, start_method_def, continue_method_def, finish_method_def, start_protocol, finish_protocol, objc_build_throw_stmt, objc_build_try_catch_finally_stmt, objc_build_synchronized_prologue, objc_build_synchronized_epilogue, objc_build_try_prologue, objc_build_try_epilogue, objc_build_catch_stmt, objc_build_catch_epilogue, objc_build_finally_prologue, objc_build_finally_epilogue, is_ivar, is_private, is_public, add_instance_variable, objc_add_method, get_super_receiver, objc_clear_super_receiver, get_class_ivars_from_name, get_class_reference, get_static_reference, get_object_reference, build_message_expr, finish_message_expr, build_selector_expr, build_ivar_reference, build_keyword_decl, build_method_decl, build_protocol_expr, build_objc_string_object, objc_declare_alias, objc_declare_class, objc_declare_protocols, objc_comptypes, objc_check_decl, build_encode_expr): Remove prototypes. (imp_count, cat_count): Make GGC-aware. (OBJC_SET_TYPE_NAME): New macro. From-SVN: r87168
2004-09-08 02:49:44 +02:00
enter DECL into the binding level, and initialize it. Leave the
c-common.c (flag_objc_sjlj_exceptions): New. * c-common.c (flag_objc_sjlj_exceptions): New. * c-common.h (flag_objc_sjlj_exceptions): Declare. * c-opts.c (c_common_handle_option): Set it. (c_common_post_options): Handle interation of different objective-c exception and runtime switches. * c-decl.c (c_eh_initialized_p): New. (finish_decl): Use it instead of local eh_initialized_p. * c-parse.in (nested_function, notype_nested_function): Record the result of compstmt. (compstmt_or_error): Likewise. (compstmt): Don't add_stmt the result. (stmt): Don't return anything. Rewrite objc try and sync rules. (objc_try_stmt, objc_catch_list): Remove. (objc_catch_block, objc_finally_block): Remove. (objc_catch_prefix, objc_catch_clause, objc_opt_catch_list): New. (objc_try_catch_clause, objc_finally_clause): New. (objc_try_catch_stmt): Rewrite. * c-tree.h (c_eh_initialized_p): Declare. * c-opt (fobjc-sjlj-exceptions): New. * except.c (output_function_exception_table): Don't call cgraph on non-decls. * objc/objc-act.c (UTAG_EXCDATA_VAR, UTAG_CAUGHTEXC_VAR, UTAG_RETHROWEXC_VAR, UTAG_EVALONCE_VAR, struct val_stack, catch_count_stack, exc_binding_stack, if_nesting_count, blk_nesting_count, objc_enter_block, objc_exit_block, objc_declare_variable, 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): Remove. (objc_create_temporary_var, struct objc_try_context, cur_try_context, objc_eh_runtime_type, objc_init_exceptions, objc_build_exc_ptr, next_sjlj_build_try_exit, next_sjlj_build_enter_and_setjmp, next_sjlj_build_exc_extract, next_sjlj_build_catch_list, next_sjlj_build_try_catch_finally, objc_begin_try_stmt, objc_begin_catch_clause, objc_finish_catch_clause, objc_build_finally_clause, objc_finish_try_stmt, objc_build_synchronized): New. (objc_is_object_id, objc_is_class_id): New. (objc_comptypes): Use them. (build_next_objc_exception_stuff): Break NeXT sjlj out from build_objc_exception_stuff. (synth_module_prologue): Update to match. (objc_build_throw_stmt): Use cur_try_context to decide if we're in a @catch. * objc/objc-act.h: Update prototypes. (OCTI_EXCEPTION_BLK_STACK, objc_exception_block_stack): Remove. testsuite/ * objc.dg/sync-1.m: New. * objc.dg/try-catch-1.m: Don't force next runtime. * objc.dg/try-catch-3.m, objc.dg/try-catch-4.m: Likewise. * objc.dg/try-catch-2.m: Likewise. Enable everywhere. Remove shadowed catch clause. * objc.dg/try-catch-5.m: New. From-SVN: r83332
2004-06-18 03:20:53 +02:00
binding level open while the body of the compound statement is parsed. */
c-common.c (flag_objc_sjlj_exceptions): New. * c-common.c (flag_objc_sjlj_exceptions): New. * c-common.h (flag_objc_sjlj_exceptions): Declare. * c-opts.c (c_common_handle_option): Set it. (c_common_post_options): Handle interation of different objective-c exception and runtime switches. * c-decl.c (c_eh_initialized_p): New. (finish_decl): Use it instead of local eh_initialized_p. * c-parse.in (nested_function, notype_nested_function): Record the result of compstmt. (compstmt_or_error): Likewise. (compstmt): Don't add_stmt the result. (stmt): Don't return anything. Rewrite objc try and sync rules. (objc_try_stmt, objc_catch_list): Remove. (objc_catch_block, objc_finally_block): Remove. (objc_catch_prefix, objc_catch_clause, objc_opt_catch_list): New. (objc_try_catch_clause, objc_finally_clause): New. (objc_try_catch_stmt): Rewrite. * c-tree.h (c_eh_initialized_p): Declare. * c-opt (fobjc-sjlj-exceptions): New. * except.c (output_function_exception_table): Don't call cgraph on non-decls. * objc/objc-act.c (UTAG_EXCDATA_VAR, UTAG_CAUGHTEXC_VAR, UTAG_RETHROWEXC_VAR, UTAG_EVALONCE_VAR, struct val_stack, catch_count_stack, exc_binding_stack, if_nesting_count, blk_nesting_count, objc_enter_block, objc_exit_block, objc_declare_variable, 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): Remove. (objc_create_temporary_var, struct objc_try_context, cur_try_context, objc_eh_runtime_type, objc_init_exceptions, objc_build_exc_ptr, next_sjlj_build_try_exit, next_sjlj_build_enter_and_setjmp, next_sjlj_build_exc_extract, next_sjlj_build_catch_list, next_sjlj_build_try_catch_finally, objc_begin_try_stmt, objc_begin_catch_clause, objc_finish_catch_clause, objc_build_finally_clause, objc_finish_try_stmt, objc_build_synchronized): New. (objc_is_object_id, objc_is_class_id): New. (objc_comptypes): Use them. (build_next_objc_exception_stuff): Break NeXT sjlj out from build_objc_exception_stuff. (synth_module_prologue): Update to match. (objc_build_throw_stmt): Use cur_try_context to decide if we're in a @catch. * objc/objc-act.h: Update prototypes. (OCTI_EXCEPTION_BLK_STACK, objc_exception_block_stack): Remove. testsuite/ * objc.dg/sync-1.m: New. * objc.dg/try-catch-1.m: Don't force next runtime. * objc.dg/try-catch-3.m, objc.dg/try-catch-4.m: Likewise. * objc.dg/try-catch-2.m: Likewise. Enable everywhere. Remove shadowed catch clause. * objc.dg/try-catch-5.m: New. From-SVN: r83332
2004-06-18 03:20:53 +02:00
void
Makefile.in (c-parse.o): Depend on $(C_COMMON_H). [gcc/ChangeLog] 2004-09-07 Ziemowit Laski <zlaski@apple.com> * Makefile.in (c-parse.o): Depend on $(C_COMMON_H). * c-parse.in: Include c-common.h instead of objc-act.h. (ivar_decl_list, ivar_decls, ivar_decl, ivars, ivar_declarator, myparms, myparm): Remove %type declarations. (methodtype, optparms, OBJC_TYPE_QUAL, objc_quals, objc_qual, objc_typename, objc_try_catch_stmt, optellipsis): Add %type declarations. (objc_inherit_code, objc_public_flag): Remove. (typespec_nonreserved_nonattr): Call objc_get_protocol_qualified_type() instead of get_static_reference() and get_protocol_reference(). (stmt_nocomp): Call grokparm() on @catch parameter. (objcdef): Move semantic action to objc_finish_implementation(). (classdef): Move semantic action to objc_start_class_interface(), objc_continue_interface(), objc_finish_interface(), objc_start_class_implementation(), objc_continue_implementation(), objc_start_category_interface() and objc_start_category_implementation(). (protocoldef): Move semantic actions to objc_start_protocol() and objc_finish_interface(). (ivar_decl_list): Remove nonterminal. (visibility_spec): Move semantic actions to objc_set_visibility(). (ivar_decls): Remove assignment to $$. (ivar_decl): Rephrase in terms of component_decl; call objc_add_instance_variable(). (ivars, ivar_declarator): Remove nonterminals. (opt_semi): New nonterminal. (methodtype): Remove semantic actions. (methoddef): Move semantic actions to objc_set_method_type(), objc_start_method_definition() and objc_finish_method_definition(). (methodproto): Move semantic actions to objc_set_method_type() and objc_add_method_declaration(). (methoddecl): Use objc_typename instead of typename; move semantic actions to objc_build_method_signature(). (optarglist, myxdecls, mydecl, myparms, myparm): Remove nonterminals. (optparmlist): Express in terms of optparms and optellipsis. (optparms, optellipsis, objc_qual, objc_quals, objc_typename): New nonterminals. (keyworddecl): Use objc_typename instead of typename. (rid_to_yy): Mark RID_IN, RID_OUT, RID_INOUT, RID_BYCOPY, RID_BYREF and RID_ONEWAY as returning OBJC_TYPE_QUAL to yyparse(). [gcc/objc/ChangeLog] 2004-09-07 Ziemowit Laski <zlaski@apple.com> * Make-lang.in (objc/objc-parse.o): Depend on $(C_COMMON_H) instead of objc/objc-act.h. (objc/objc-act.o): Depend on $(HASHTAB_H). * objc-act.c: Include hashtab.h; in ObjC++ mode, include cp-tree.h and objcp-decl.h instead of c-tree.h. (build_module_descriptor, get_class_ivars, synth_id_with_class_suffix, error_with_ivar, gen_method_decl, gen_declaration, setup_string_decl, build_protocol_template): Adjust prototypes. (build_module_initializer_routine, start_class, continue_class, finish_class, start_method_def, objc_start_function, start_protocol, build_method_decl, objc_add_method, add_instance_variable, build_ivar_reference, is_ivar, is_private, get_super_receiver, build_selector_table_decl, objc_push_parm, objc_get_parm_info, gen_type_name, gen_type_name_0, start_var_decl, finish_var_decl, create_field_decl): New prototypes. (objc_expand_function_end, comp_method_with_proto, objc_expr_last, gen_declaration_1, gen_declarator, is_complex_decl, adorn_decl, define_decl, create_builtin_decl, gen_declspecs): Remove prototypes. (TYPE_ID): Rename to OBJECT_TYPEDEF_NAME. (CLASS_TYPEDEF_NAME): New. (TAG_EXECCLASS): Change from a global variable to a #define. (TAG_RETURN_STRUCT): Delete. (TAG_GNUINIT): New, holds '__objc_gnu_init' name. (objc_inherit_code, objc_public_flag): New, moved from c-parse.in. (string_descriptor): New struct. (string_htab): New hash table. (string_hash, string_eq): New prototypes. (generate_struct_by_value_array): Call create_field_decl() instead of create_builtin_decl(). (objc_init): Do not initialize objc_ellipsis_node or TAG_EXECCLASS; In ObjC++ mode, call cxx_init() instead of c_objc_common_init(). (objc_finish_file): In ObjC++, call instantiate_pending_templates() and cp_finish_file(). (define_decl, get_static_reference, get_protocol_reference, create_builtin_decl): Remove functions. (objc_start_class_interface, objc_start_category_interface, objc_start_protocol, objc_continue_interface, objc_finish_interface, objc_start_class_implementation, objc_start_category_implementation, objc_continue_implementation, objc_finish_implementation, objc_set_visibility, objc_set_method_type, objc_build_method_signature, objc_add_method_declaration, objc_start_method_definition, objc_add_instance_variable, objc_get_protocol_qualified_type, create_field_decl, start_var_decl, finish_var_decl): New functions. (setup_string_decl): Simplify since it is only called once. (synth_module_prologue): Call build_class_template(); predefine 'id' and 'Class' as typedefs; rename 'temp_type' to 'type'; disable debug hooks for duration of function; fix GNU runtime messenger signatures to correspond to reality; forward-declare '__objc_exec_class' for the GNU runtime; call build_selector_table_decl(); in ObjC++ mode, generate 'extern "C" { ... }' wrappers around synthesized declarations; call build_protocol_template() and build_category_template(). (string_hash, string_eq): New functions. (objc_build_string_object): Check metaclass correctness only once; store string literals in hash table. (objc_build_constructor): Do not convert initializer elements; adjust for ObjC++ impedance mismatch. (build_objc_symtab_template): Call create_field_decl() instead of create_builtin_decl(). (init_objc_symtab): Add missing conversion to initializer element. (build_metadata_decl): Call start_var_decl() instead of define_decl(). (generate_objc_symtab_decl): Do not call build_category_template(); call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(). (build_module_descriptor): Call create_field_decl() instead of grokfield(); call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(); always mark module descriptor as used; move GNU runtime-specific functionality to build_module_initializer_routine(). (build_module_initializer_routine): New function, broken off of build_module_descriptor(). (objc_static_init_needed_p, objc_generate_static_init_call): New functions. (generate_static_references, generate_strings, build_selector_translation_table, generate_descriptor_table, generate_ivars_list, generate_dispatch_table, generate_category): Call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(); build a type directly instead of via groktypename(). (build_selector_reference_decl, build_selector_table_decl, build_class_reference_decl, build_protocol_reference, generate_objc_image_info): Call start_var_decl() instead of build_decl(). (build_selector_reference): For GNU runtime, do not call build_selector_reference_decl(). (build_selector, build_typed_selector_reference): Always convert result to the selector type. (add_objc_string): Cast return value to 'char *'. (build_method_prototype_template, build_selector_template, build_method_template): Use actual selector type for fields pointing to selectors. (finish_objc): For GNU runtime, call build_module_initializer_routine() after build_module_descriptor(). (generate_protocol_list, generate_shared_structures): Call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(); build a type directly instead of via groktypename(). (synth_id_with_class_suffix): Return a string. (get_arg_type_list): For instance methods, use the instance type for 'self'; do not call groktypename_in_parm_context(). (build_objc_string_decl): Squash redeclaration errors in ObjC++. (objc_is_class_name): Use OBJC_TYPE_NAME instead of TYPE_NAME; handle RECORD_TYPEs in ObjC as well as ObjC++. (objc_is_id): New function. (objc_is_object_ptr): Return the canonical type node. (objc_get_class_ivars): Simplify using get_class_ivars(). (get_class_ivars): Remove second parameter; create a fresh copy of the ivar list for each call; do not check for existence of super class. (objc_eh_runtime_type): Mark #ifndef OBJCPLUS. (objc_init_exceptions): When using SJLJ-style exceptions, require the use of '-fobjc-exceptions' flag; do not require it for DWARF-style exceptions. (objc_build_exc_ptr, next_sjlj_build_try_catch_finally): Use objc_object_type instead of objc_id_type. (objc_begin_catch_clause): Convert the incoming PARM_DECL into a VAR_DECL before placing it in the appropriate scope; do not call define_decl(); adjust call to c_begin_compound_stmt(); use objc_object_type instead of objc_id_type. (build_next_objc_exception_stuff): Call create_field_decl() instead of create_builtin_decl(); construct type directly instead of calling groktypename(); use OBJC_VOID_AT_END to mark end of function parameters. (build_private_template): Adjust call to get_class_ivars(); build a type directly instead of via groktypename(). (build_protocol_template, build_method_prototype_list_template, build_method_prototype_template, build_category_template, build_selector_template, build_class_template, build_super_template, build_ivar_template, build_ivar_list_template, build_method_list_template, build_method_template): Call create_field_decl() instead of grokfield(). (objc_method_parm_type): Do not call groktypename(). (generate_descriptor_table): Call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(). (generate_method_descriptors, build_protocol_initializer, generate_dispatch_tables, build_category_initializer, build_shared_structure_initializer): Do not call groktypename(). (generate_protocols): Call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(); do not call groktypename(). (error_with_ivar): Remove last parameter. (check_ivars): Do not iterate ovar CLASS_RAW_IVARS lists in addition to CLASS_IVARS lists; adjust calls to error_with_ivar(). (generate_ivar_lists): Convert one of the initializer elements; do not call groktypename(). (get_arg_type_list, start_method_def, gen_method_def): Account for new representation of variable arguments and '...' in Objective-C methods; add Objective-C++ impedance matching code. (is_objc_type_qualifier): Remove function. (adjust_type_for_id_default): Simplify; there is no longer a need to wade through declspecs. (lookup_interface, start_class, continue_class, finish_class, start_method_def, start_protocol, build_method_decl, objc_add_method, add_instance_variable, build_ivar_reference, is_ivar, is_private, get_super_receiver, objc_build_finally_epilogue): Make into static functions. (receiver_is_class_object): Use new IS_CLASS() macro. (objc_build_message_expr): Tweak ObjC++ message argument handling; call objc_finish_message_expr() instead of finish_message_expr(). (finish_message_expr): Rename to objc_finish_message_expr(); use OBJC_TYPE_NAME and OBJC_SET_TYPE_NAME macros instead of TYPE_NAME. call gen_type_name() instead of gen_declaration(); call objc_is_id() instead of using IS_ID and IS_CLASS; Use objc_class_name instead of calling get_identifier("Class"); handle CONVERT_EXPRs in receiver. (build_objc_method_call, warn_with_method): Do not call groktypename(). (build_ivar_reference): Call convert() instead of clobbering in a type. (hash_init): Initialize string_htab hash table. (add_instance_variable): Simplify parameter list; do not call grokfield(); do not populate CLASS_IVARS list. (start_class): Check for the existence of super class, if one was specified. (continue_class): Use CLASS_RAW_IVARS rather than CLASS_IVARS; do not call build_class_template(); adjust call to get_class_ivars(); call build_decl(), pushdecl() and finish_decl() instead of define_decl(). (finish_class): Call build_decl(), pushdecl() and finish_decl() instead of define_decl(). (add_protocols): Use PROTOCOL_BINFO_ELTS for the tree vector size. (start_protocol): Do not call build_protocol_template(); use PROTOCOL_BINFO_ELTS for the tree vector size. (encode_type_qualifiers): Do not handle the 'const' qualifier here. (encode_pointer): Encode 'const char *' as 'r*', for backwards compatibility. (encode_array): Use HOST_WIDE_INT_PRINT_DEC instead of "%ld". (encode_type): Handle the 'const' qualifier here. (objc_parmlist): New global variable, sued by objc_push_parm and objc_get_parm_info(). (objc_push_parm, objc_get_parm_info): New functions. (objc_expr_last): Remove function. (synth_self_and_ucmd_args): For instance methods, use the instance type for 'self'; call objc_push_parm() instead of push_parm_decl(). (start_method_def): Do not call push_scope(), declare_parm_level(), pop_scope(), push_parm_decl(), store_parm_decls() or objc_expr_last(); just use objc_push_parm() and objc_get_parm_info(). (comp_method_with_proto): Remove function. (objc_types_are_equivalent): Strip away indirections before comparing underlying types. (comp_proto_with_proto): Do not call groktypename(); types are no longer in raw declspec format. (objc_start_function): New function. (really_start_method): Call comp_proto_with_proto() instead of comp_method_with_proto(); call objc_start_function() instead of hand-crafting a function declarator. (continue_method_def, objc_expand_function_end): Remove functions. (get_super_receiver): Call objc_get_current_scope() instead of get_current_scope(); reference 'super_class' field (instead of 'class'). (finish_method_def): Rename to objc_finish_method_definition() and add a function decl parameter; move method encoding call from objc_expand_function_end(). (is_complex_decl, adorn_decl, gen_declarator, gen_declspecs, gen_declaration_1): Remove functions. (tmpbuf, RAW_DECLSPEC): Remove. (gen_declaration): Remove second parameter; simplify to deal with TYPE_P nodes instead of raw declspecs. (gen_type_name, gen_type_name_0): New functions. (gen_method_decl): Remove second parameter; call gen_type_name() instead of gen_declaration_1(). (dump_interface): Adjust calls to gen_declaration() and gen_method_decl(); do not allocate a separate string buffer. (init_objc): Allocate a larger string buffer to accommodate dump_interface(); adjust call to build_module_descriptor(); add call to build_module_initializer_routine() for the GNU runtime. (generate_classref_translation_entry): Do not call start_decl(); call finish_var_decl() instead of finish_decl(); call convert() instead of build_c_cast(). * objc-act.h (CLASS_OWN_IVARS): Remove accessor. (CLASS_BINFO_ELTS): Reduce from 6 to 5, now that CLASS_OWN_IVARS is gone. (OCTI_GNU_INIT_DECL, GNU_INIT_decl): New. (OCTI_ELLIPSIS_NODE, objc_ellipsis_node): Remove. (OCTI_ID_ID, id_type, objc_id_id): Rename to OCTI_ID_NAME, objc_object_type and objc_object_name, respectively. (OCTI_CLS_REF, OCTI_CLASS_NAME, objc_class_reference, objc_class_name): New. (IS_CLASS): New macro. (IS_ID, IS_SUPER): Robustify. (OCTI_EXECCLASS_DECL, execclass_decl): New. (finish_file, start_class, continue_class, finish_class, start_method_def, continue_method_def, finish_method_def, start_protocol, finish_protocol, objc_build_throw_stmt, objc_build_try_catch_finally_stmt, objc_build_synchronized_prologue, objc_build_synchronized_epilogue, objc_build_try_prologue, objc_build_try_epilogue, objc_build_catch_stmt, objc_build_catch_epilogue, objc_build_finally_prologue, objc_build_finally_epilogue, is_ivar, is_private, is_public, add_instance_variable, objc_add_method, get_super_receiver, objc_clear_super_receiver, get_class_ivars_from_name, get_class_reference, get_static_reference, get_object_reference, build_message_expr, finish_message_expr, build_selector_expr, build_ivar_reference, build_keyword_decl, build_method_decl, build_protocol_expr, build_objc_string_object, objc_declare_alias, objc_declare_class, objc_declare_protocols, objc_comptypes, objc_check_decl, build_encode_expr): Remove prototypes. (imp_count, cat_count): Make GGC-aware. (OBJC_SET_TYPE_NAME): New macro. From-SVN: r87168
2004-09-08 02:49:44 +02:00
objc_begin_catch_clause (tree decl)
{
Makefile.in (c-parse.o): Depend on $(C_COMMON_H). [gcc/ChangeLog] 2004-09-07 Ziemowit Laski <zlaski@apple.com> * Makefile.in (c-parse.o): Depend on $(C_COMMON_H). * c-parse.in: Include c-common.h instead of objc-act.h. (ivar_decl_list, ivar_decls, ivar_decl, ivars, ivar_declarator, myparms, myparm): Remove %type declarations. (methodtype, optparms, OBJC_TYPE_QUAL, objc_quals, objc_qual, objc_typename, objc_try_catch_stmt, optellipsis): Add %type declarations. (objc_inherit_code, objc_public_flag): Remove. (typespec_nonreserved_nonattr): Call objc_get_protocol_qualified_type() instead of get_static_reference() and get_protocol_reference(). (stmt_nocomp): Call grokparm() on @catch parameter. (objcdef): Move semantic action to objc_finish_implementation(). (classdef): Move semantic action to objc_start_class_interface(), objc_continue_interface(), objc_finish_interface(), objc_start_class_implementation(), objc_continue_implementation(), objc_start_category_interface() and objc_start_category_implementation(). (protocoldef): Move semantic actions to objc_start_protocol() and objc_finish_interface(). (ivar_decl_list): Remove nonterminal. (visibility_spec): Move semantic actions to objc_set_visibility(). (ivar_decls): Remove assignment to $$. (ivar_decl): Rephrase in terms of component_decl; call objc_add_instance_variable(). (ivars, ivar_declarator): Remove nonterminals. (opt_semi): New nonterminal. (methodtype): Remove semantic actions. (methoddef): Move semantic actions to objc_set_method_type(), objc_start_method_definition() and objc_finish_method_definition(). (methodproto): Move semantic actions to objc_set_method_type() and objc_add_method_declaration(). (methoddecl): Use objc_typename instead of typename; move semantic actions to objc_build_method_signature(). (optarglist, myxdecls, mydecl, myparms, myparm): Remove nonterminals. (optparmlist): Express in terms of optparms and optellipsis. (optparms, optellipsis, objc_qual, objc_quals, objc_typename): New nonterminals. (keyworddecl): Use objc_typename instead of typename. (rid_to_yy): Mark RID_IN, RID_OUT, RID_INOUT, RID_BYCOPY, RID_BYREF and RID_ONEWAY as returning OBJC_TYPE_QUAL to yyparse(). [gcc/objc/ChangeLog] 2004-09-07 Ziemowit Laski <zlaski@apple.com> * Make-lang.in (objc/objc-parse.o): Depend on $(C_COMMON_H) instead of objc/objc-act.h. (objc/objc-act.o): Depend on $(HASHTAB_H). * objc-act.c: Include hashtab.h; in ObjC++ mode, include cp-tree.h and objcp-decl.h instead of c-tree.h. (build_module_descriptor, get_class_ivars, synth_id_with_class_suffix, error_with_ivar, gen_method_decl, gen_declaration, setup_string_decl, build_protocol_template): Adjust prototypes. (build_module_initializer_routine, start_class, continue_class, finish_class, start_method_def, objc_start_function, start_protocol, build_method_decl, objc_add_method, add_instance_variable, build_ivar_reference, is_ivar, is_private, get_super_receiver, build_selector_table_decl, objc_push_parm, objc_get_parm_info, gen_type_name, gen_type_name_0, start_var_decl, finish_var_decl, create_field_decl): New prototypes. (objc_expand_function_end, comp_method_with_proto, objc_expr_last, gen_declaration_1, gen_declarator, is_complex_decl, adorn_decl, define_decl, create_builtin_decl, gen_declspecs): Remove prototypes. (TYPE_ID): Rename to OBJECT_TYPEDEF_NAME. (CLASS_TYPEDEF_NAME): New. (TAG_EXECCLASS): Change from a global variable to a #define. (TAG_RETURN_STRUCT): Delete. (TAG_GNUINIT): New, holds '__objc_gnu_init' name. (objc_inherit_code, objc_public_flag): New, moved from c-parse.in. (string_descriptor): New struct. (string_htab): New hash table. (string_hash, string_eq): New prototypes. (generate_struct_by_value_array): Call create_field_decl() instead of create_builtin_decl(). (objc_init): Do not initialize objc_ellipsis_node or TAG_EXECCLASS; In ObjC++ mode, call cxx_init() instead of c_objc_common_init(). (objc_finish_file): In ObjC++, call instantiate_pending_templates() and cp_finish_file(). (define_decl, get_static_reference, get_protocol_reference, create_builtin_decl): Remove functions. (objc_start_class_interface, objc_start_category_interface, objc_start_protocol, objc_continue_interface, objc_finish_interface, objc_start_class_implementation, objc_start_category_implementation, objc_continue_implementation, objc_finish_implementation, objc_set_visibility, objc_set_method_type, objc_build_method_signature, objc_add_method_declaration, objc_start_method_definition, objc_add_instance_variable, objc_get_protocol_qualified_type, create_field_decl, start_var_decl, finish_var_decl): New functions. (setup_string_decl): Simplify since it is only called once. (synth_module_prologue): Call build_class_template(); predefine 'id' and 'Class' as typedefs; rename 'temp_type' to 'type'; disable debug hooks for duration of function; fix GNU runtime messenger signatures to correspond to reality; forward-declare '__objc_exec_class' for the GNU runtime; call build_selector_table_decl(); in ObjC++ mode, generate 'extern "C" { ... }' wrappers around synthesized declarations; call build_protocol_template() and build_category_template(). (string_hash, string_eq): New functions. (objc_build_string_object): Check metaclass correctness only once; store string literals in hash table. (objc_build_constructor): Do not convert initializer elements; adjust for ObjC++ impedance mismatch. (build_objc_symtab_template): Call create_field_decl() instead of create_builtin_decl(). (init_objc_symtab): Add missing conversion to initializer element. (build_metadata_decl): Call start_var_decl() instead of define_decl(). (generate_objc_symtab_decl): Do not call build_category_template(); call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(). (build_module_descriptor): Call create_field_decl() instead of grokfield(); call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(); always mark module descriptor as used; move GNU runtime-specific functionality to build_module_initializer_routine(). (build_module_initializer_routine): New function, broken off of build_module_descriptor(). (objc_static_init_needed_p, objc_generate_static_init_call): New functions. (generate_static_references, generate_strings, build_selector_translation_table, generate_descriptor_table, generate_ivars_list, generate_dispatch_table, generate_category): Call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(); build a type directly instead of via groktypename(). (build_selector_reference_decl, build_selector_table_decl, build_class_reference_decl, build_protocol_reference, generate_objc_image_info): Call start_var_decl() instead of build_decl(). (build_selector_reference): For GNU runtime, do not call build_selector_reference_decl(). (build_selector, build_typed_selector_reference): Always convert result to the selector type. (add_objc_string): Cast return value to 'char *'. (build_method_prototype_template, build_selector_template, build_method_template): Use actual selector type for fields pointing to selectors. (finish_objc): For GNU runtime, call build_module_initializer_routine() after build_module_descriptor(). (generate_protocol_list, generate_shared_structures): Call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(); build a type directly instead of via groktypename(). (synth_id_with_class_suffix): Return a string. (get_arg_type_list): For instance methods, use the instance type for 'self'; do not call groktypename_in_parm_context(). (build_objc_string_decl): Squash redeclaration errors in ObjC++. (objc_is_class_name): Use OBJC_TYPE_NAME instead of TYPE_NAME; handle RECORD_TYPEs in ObjC as well as ObjC++. (objc_is_id): New function. (objc_is_object_ptr): Return the canonical type node. (objc_get_class_ivars): Simplify using get_class_ivars(). (get_class_ivars): Remove second parameter; create a fresh copy of the ivar list for each call; do not check for existence of super class. (objc_eh_runtime_type): Mark #ifndef OBJCPLUS. (objc_init_exceptions): When using SJLJ-style exceptions, require the use of '-fobjc-exceptions' flag; do not require it for DWARF-style exceptions. (objc_build_exc_ptr, next_sjlj_build_try_catch_finally): Use objc_object_type instead of objc_id_type. (objc_begin_catch_clause): Convert the incoming PARM_DECL into a VAR_DECL before placing it in the appropriate scope; do not call define_decl(); adjust call to c_begin_compound_stmt(); use objc_object_type instead of objc_id_type. (build_next_objc_exception_stuff): Call create_field_decl() instead of create_builtin_decl(); construct type directly instead of calling groktypename(); use OBJC_VOID_AT_END to mark end of function parameters. (build_private_template): Adjust call to get_class_ivars(); build a type directly instead of via groktypename(). (build_protocol_template, build_method_prototype_list_template, build_method_prototype_template, build_category_template, build_selector_template, build_class_template, build_super_template, build_ivar_template, build_ivar_list_template, build_method_list_template, build_method_template): Call create_field_decl() instead of grokfield(). (objc_method_parm_type): Do not call groktypename(). (generate_descriptor_table): Call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(). (generate_method_descriptors, build_protocol_initializer, generate_dispatch_tables, build_category_initializer, build_shared_structure_initializer): Do not call groktypename(). (generate_protocols): Call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(); do not call groktypename(). (error_with_ivar): Remove last parameter. (check_ivars): Do not iterate ovar CLASS_RAW_IVARS lists in addition to CLASS_IVARS lists; adjust calls to error_with_ivar(). (generate_ivar_lists): Convert one of the initializer elements; do not call groktypename(). (get_arg_type_list, start_method_def, gen_method_def): Account for new representation of variable arguments and '...' in Objective-C methods; add Objective-C++ impedance matching code. (is_objc_type_qualifier): Remove function. (adjust_type_for_id_default): Simplify; there is no longer a need to wade through declspecs. (lookup_interface, start_class, continue_class, finish_class, start_method_def, start_protocol, build_method_decl, objc_add_method, add_instance_variable, build_ivar_reference, is_ivar, is_private, get_super_receiver, objc_build_finally_epilogue): Make into static functions. (receiver_is_class_object): Use new IS_CLASS() macro. (objc_build_message_expr): Tweak ObjC++ message argument handling; call objc_finish_message_expr() instead of finish_message_expr(). (finish_message_expr): Rename to objc_finish_message_expr(); use OBJC_TYPE_NAME and OBJC_SET_TYPE_NAME macros instead of TYPE_NAME. call gen_type_name() instead of gen_declaration(); call objc_is_id() instead of using IS_ID and IS_CLASS; Use objc_class_name instead of calling get_identifier("Class"); handle CONVERT_EXPRs in receiver. (build_objc_method_call, warn_with_method): Do not call groktypename(). (build_ivar_reference): Call convert() instead of clobbering in a type. (hash_init): Initialize string_htab hash table. (add_instance_variable): Simplify parameter list; do not call grokfield(); do not populate CLASS_IVARS list. (start_class): Check for the existence of super class, if one was specified. (continue_class): Use CLASS_RAW_IVARS rather than CLASS_IVARS; do not call build_class_template(); adjust call to get_class_ivars(); call build_decl(), pushdecl() and finish_decl() instead of define_decl(). (finish_class): Call build_decl(), pushdecl() and finish_decl() instead of define_decl(). (add_protocols): Use PROTOCOL_BINFO_ELTS for the tree vector size. (start_protocol): Do not call build_protocol_template(); use PROTOCOL_BINFO_ELTS for the tree vector size. (encode_type_qualifiers): Do not handle the 'const' qualifier here. (encode_pointer): Encode 'const char *' as 'r*', for backwards compatibility. (encode_array): Use HOST_WIDE_INT_PRINT_DEC instead of "%ld". (encode_type): Handle the 'const' qualifier here. (objc_parmlist): New global variable, sued by objc_push_parm and objc_get_parm_info(). (objc_push_parm, objc_get_parm_info): New functions. (objc_expr_last): Remove function. (synth_self_and_ucmd_args): For instance methods, use the instance type for 'self'; call objc_push_parm() instead of push_parm_decl(). (start_method_def): Do not call push_scope(), declare_parm_level(), pop_scope(), push_parm_decl(), store_parm_decls() or objc_expr_last(); just use objc_push_parm() and objc_get_parm_info(). (comp_method_with_proto): Remove function. (objc_types_are_equivalent): Strip away indirections before comparing underlying types. (comp_proto_with_proto): Do not call groktypename(); types are no longer in raw declspec format. (objc_start_function): New function. (really_start_method): Call comp_proto_with_proto() instead of comp_method_with_proto(); call objc_start_function() instead of hand-crafting a function declarator. (continue_method_def, objc_expand_function_end): Remove functions. (get_super_receiver): Call objc_get_current_scope() instead of get_current_scope(); reference 'super_class' field (instead of 'class'). (finish_method_def): Rename to objc_finish_method_definition() and add a function decl parameter; move method encoding call from objc_expand_function_end(). (is_complex_decl, adorn_decl, gen_declarator, gen_declspecs, gen_declaration_1): Remove functions. (tmpbuf, RAW_DECLSPEC): Remove. (gen_declaration): Remove second parameter; simplify to deal with TYPE_P nodes instead of raw declspecs. (gen_type_name, gen_type_name_0): New functions. (gen_method_decl): Remove second parameter; call gen_type_name() instead of gen_declaration_1(). (dump_interface): Adjust calls to gen_declaration() and gen_method_decl(); do not allocate a separate string buffer. (init_objc): Allocate a larger string buffer to accommodate dump_interface(); adjust call to build_module_descriptor(); add call to build_module_initializer_routine() for the GNU runtime. (generate_classref_translation_entry): Do not call start_decl(); call finish_var_decl() instead of finish_decl(); call convert() instead of build_c_cast(). * objc-act.h (CLASS_OWN_IVARS): Remove accessor. (CLASS_BINFO_ELTS): Reduce from 6 to 5, now that CLASS_OWN_IVARS is gone. (OCTI_GNU_INIT_DECL, GNU_INIT_decl): New. (OCTI_ELLIPSIS_NODE, objc_ellipsis_node): Remove. (OCTI_ID_ID, id_type, objc_id_id): Rename to OCTI_ID_NAME, objc_object_type and objc_object_name, respectively. (OCTI_CLS_REF, OCTI_CLASS_NAME, objc_class_reference, objc_class_name): New. (IS_CLASS): New macro. (IS_ID, IS_SUPER): Robustify. (OCTI_EXECCLASS_DECL, execclass_decl): New. (finish_file, start_class, continue_class, finish_class, start_method_def, continue_method_def, finish_method_def, start_protocol, finish_protocol, objc_build_throw_stmt, objc_build_try_catch_finally_stmt, objc_build_synchronized_prologue, objc_build_synchronized_epilogue, objc_build_try_prologue, objc_build_try_epilogue, objc_build_catch_stmt, objc_build_catch_epilogue, objc_build_finally_prologue, objc_build_finally_epilogue, is_ivar, is_private, is_public, add_instance_variable, objc_add_method, get_super_receiver, objc_clear_super_receiver, get_class_ivars_from_name, get_class_reference, get_static_reference, get_object_reference, build_message_expr, finish_message_expr, build_selector_expr, build_ivar_reference, build_keyword_decl, build_method_decl, build_protocol_expr, build_objc_string_object, objc_declare_alias, objc_declare_class, objc_declare_protocols, objc_comptypes, objc_check_decl, build_encode_expr): Remove prototypes. (imp_count, cat_count): Make GGC-aware. (OBJC_SET_TYPE_NAME): New macro. From-SVN: r87168
2004-09-08 02:49:44 +02:00
tree compound, type, t;
c-common.c (flag_objc_sjlj_exceptions): New. * c-common.c (flag_objc_sjlj_exceptions): New. * c-common.h (flag_objc_sjlj_exceptions): Declare. * c-opts.c (c_common_handle_option): Set it. (c_common_post_options): Handle interation of different objective-c exception and runtime switches. * c-decl.c (c_eh_initialized_p): New. (finish_decl): Use it instead of local eh_initialized_p. * c-parse.in (nested_function, notype_nested_function): Record the result of compstmt. (compstmt_or_error): Likewise. (compstmt): Don't add_stmt the result. (stmt): Don't return anything. Rewrite objc try and sync rules. (objc_try_stmt, objc_catch_list): Remove. (objc_catch_block, objc_finally_block): Remove. (objc_catch_prefix, objc_catch_clause, objc_opt_catch_list): New. (objc_try_catch_clause, objc_finally_clause): New. (objc_try_catch_stmt): Rewrite. * c-tree.h (c_eh_initialized_p): Declare. * c-opt (fobjc-sjlj-exceptions): New. * except.c (output_function_exception_table): Don't call cgraph on non-decls. * objc/objc-act.c (UTAG_EXCDATA_VAR, UTAG_CAUGHTEXC_VAR, UTAG_RETHROWEXC_VAR, UTAG_EVALONCE_VAR, struct val_stack, catch_count_stack, exc_binding_stack, if_nesting_count, blk_nesting_count, objc_enter_block, objc_exit_block, objc_declare_variable, 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): Remove. (objc_create_temporary_var, struct objc_try_context, cur_try_context, objc_eh_runtime_type, objc_init_exceptions, objc_build_exc_ptr, next_sjlj_build_try_exit, next_sjlj_build_enter_and_setjmp, next_sjlj_build_exc_extract, next_sjlj_build_catch_list, next_sjlj_build_try_catch_finally, objc_begin_try_stmt, objc_begin_catch_clause, objc_finish_catch_clause, objc_build_finally_clause, objc_finish_try_stmt, objc_build_synchronized): New. (objc_is_object_id, objc_is_class_id): New. (objc_comptypes): Use them. (build_next_objc_exception_stuff): Break NeXT sjlj out from build_objc_exception_stuff. (synth_module_prologue): Update to match. (objc_build_throw_stmt): Use cur_try_context to decide if we're in a @catch. * objc/objc-act.h: Update prototypes. (OCTI_EXCEPTION_BLK_STACK, objc_exception_block_stack): Remove. testsuite/ * objc.dg/sync-1.m: New. * objc.dg/try-catch-1.m: Don't force next runtime. * objc.dg/try-catch-3.m, objc.dg/try-catch-4.m: Likewise. * objc.dg/try-catch-2.m: Likewise. Enable everywhere. Remove shadowed catch clause. * objc.dg/try-catch-5.m: New. From-SVN: r83332
2004-06-18 03:20:53 +02:00
/* Begin a new scope that the entire catch clause will live in. */
Makefile.in (c-parse.o): Depend on $(C_COMMON_H). [gcc/ChangeLog] 2004-09-07 Ziemowit Laski <zlaski@apple.com> * Makefile.in (c-parse.o): Depend on $(C_COMMON_H). * c-parse.in: Include c-common.h instead of objc-act.h. (ivar_decl_list, ivar_decls, ivar_decl, ivars, ivar_declarator, myparms, myparm): Remove %type declarations. (methodtype, optparms, OBJC_TYPE_QUAL, objc_quals, objc_qual, objc_typename, objc_try_catch_stmt, optellipsis): Add %type declarations. (objc_inherit_code, objc_public_flag): Remove. (typespec_nonreserved_nonattr): Call objc_get_protocol_qualified_type() instead of get_static_reference() and get_protocol_reference(). (stmt_nocomp): Call grokparm() on @catch parameter. (objcdef): Move semantic action to objc_finish_implementation(). (classdef): Move semantic action to objc_start_class_interface(), objc_continue_interface(), objc_finish_interface(), objc_start_class_implementation(), objc_continue_implementation(), objc_start_category_interface() and objc_start_category_implementation(). (protocoldef): Move semantic actions to objc_start_protocol() and objc_finish_interface(). (ivar_decl_list): Remove nonterminal. (visibility_spec): Move semantic actions to objc_set_visibility(). (ivar_decls): Remove assignment to $$. (ivar_decl): Rephrase in terms of component_decl; call objc_add_instance_variable(). (ivars, ivar_declarator): Remove nonterminals. (opt_semi): New nonterminal. (methodtype): Remove semantic actions. (methoddef): Move semantic actions to objc_set_method_type(), objc_start_method_definition() and objc_finish_method_definition(). (methodproto): Move semantic actions to objc_set_method_type() and objc_add_method_declaration(). (methoddecl): Use objc_typename instead of typename; move semantic actions to objc_build_method_signature(). (optarglist, myxdecls, mydecl, myparms, myparm): Remove nonterminals. (optparmlist): Express in terms of optparms and optellipsis. (optparms, optellipsis, objc_qual, objc_quals, objc_typename): New nonterminals. (keyworddecl): Use objc_typename instead of typename. (rid_to_yy): Mark RID_IN, RID_OUT, RID_INOUT, RID_BYCOPY, RID_BYREF and RID_ONEWAY as returning OBJC_TYPE_QUAL to yyparse(). [gcc/objc/ChangeLog] 2004-09-07 Ziemowit Laski <zlaski@apple.com> * Make-lang.in (objc/objc-parse.o): Depend on $(C_COMMON_H) instead of objc/objc-act.h. (objc/objc-act.o): Depend on $(HASHTAB_H). * objc-act.c: Include hashtab.h; in ObjC++ mode, include cp-tree.h and objcp-decl.h instead of c-tree.h. (build_module_descriptor, get_class_ivars, synth_id_with_class_suffix, error_with_ivar, gen_method_decl, gen_declaration, setup_string_decl, build_protocol_template): Adjust prototypes. (build_module_initializer_routine, start_class, continue_class, finish_class, start_method_def, objc_start_function, start_protocol, build_method_decl, objc_add_method, add_instance_variable, build_ivar_reference, is_ivar, is_private, get_super_receiver, build_selector_table_decl, objc_push_parm, objc_get_parm_info, gen_type_name, gen_type_name_0, start_var_decl, finish_var_decl, create_field_decl): New prototypes. (objc_expand_function_end, comp_method_with_proto, objc_expr_last, gen_declaration_1, gen_declarator, is_complex_decl, adorn_decl, define_decl, create_builtin_decl, gen_declspecs): Remove prototypes. (TYPE_ID): Rename to OBJECT_TYPEDEF_NAME. (CLASS_TYPEDEF_NAME): New. (TAG_EXECCLASS): Change from a global variable to a #define. (TAG_RETURN_STRUCT): Delete. (TAG_GNUINIT): New, holds '__objc_gnu_init' name. (objc_inherit_code, objc_public_flag): New, moved from c-parse.in. (string_descriptor): New struct. (string_htab): New hash table. (string_hash, string_eq): New prototypes. (generate_struct_by_value_array): Call create_field_decl() instead of create_builtin_decl(). (objc_init): Do not initialize objc_ellipsis_node or TAG_EXECCLASS; In ObjC++ mode, call cxx_init() instead of c_objc_common_init(). (objc_finish_file): In ObjC++, call instantiate_pending_templates() and cp_finish_file(). (define_decl, get_static_reference, get_protocol_reference, create_builtin_decl): Remove functions. (objc_start_class_interface, objc_start_category_interface, objc_start_protocol, objc_continue_interface, objc_finish_interface, objc_start_class_implementation, objc_start_category_implementation, objc_continue_implementation, objc_finish_implementation, objc_set_visibility, objc_set_method_type, objc_build_method_signature, objc_add_method_declaration, objc_start_method_definition, objc_add_instance_variable, objc_get_protocol_qualified_type, create_field_decl, start_var_decl, finish_var_decl): New functions. (setup_string_decl): Simplify since it is only called once. (synth_module_prologue): Call build_class_template(); predefine 'id' and 'Class' as typedefs; rename 'temp_type' to 'type'; disable debug hooks for duration of function; fix GNU runtime messenger signatures to correspond to reality; forward-declare '__objc_exec_class' for the GNU runtime; call build_selector_table_decl(); in ObjC++ mode, generate 'extern "C" { ... }' wrappers around synthesized declarations; call build_protocol_template() and build_category_template(). (string_hash, string_eq): New functions. (objc_build_string_object): Check metaclass correctness only once; store string literals in hash table. (objc_build_constructor): Do not convert initializer elements; adjust for ObjC++ impedance mismatch. (build_objc_symtab_template): Call create_field_decl() instead of create_builtin_decl(). (init_objc_symtab): Add missing conversion to initializer element. (build_metadata_decl): Call start_var_decl() instead of define_decl(). (generate_objc_symtab_decl): Do not call build_category_template(); call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(). (build_module_descriptor): Call create_field_decl() instead of grokfield(); call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(); always mark module descriptor as used; move GNU runtime-specific functionality to build_module_initializer_routine(). (build_module_initializer_routine): New function, broken off of build_module_descriptor(). (objc_static_init_needed_p, objc_generate_static_init_call): New functions. (generate_static_references, generate_strings, build_selector_translation_table, generate_descriptor_table, generate_ivars_list, generate_dispatch_table, generate_category): Call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(); build a type directly instead of via groktypename(). (build_selector_reference_decl, build_selector_table_decl, build_class_reference_decl, build_protocol_reference, generate_objc_image_info): Call start_var_decl() instead of build_decl(). (build_selector_reference): For GNU runtime, do not call build_selector_reference_decl(). (build_selector, build_typed_selector_reference): Always convert result to the selector type. (add_objc_string): Cast return value to 'char *'. (build_method_prototype_template, build_selector_template, build_method_template): Use actual selector type for fields pointing to selectors. (finish_objc): For GNU runtime, call build_module_initializer_routine() after build_module_descriptor(). (generate_protocol_list, generate_shared_structures): Call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(); build a type directly instead of via groktypename(). (synth_id_with_class_suffix): Return a string. (get_arg_type_list): For instance methods, use the instance type for 'self'; do not call groktypename_in_parm_context(). (build_objc_string_decl): Squash redeclaration errors in ObjC++. (objc_is_class_name): Use OBJC_TYPE_NAME instead of TYPE_NAME; handle RECORD_TYPEs in ObjC as well as ObjC++. (objc_is_id): New function. (objc_is_object_ptr): Return the canonical type node. (objc_get_class_ivars): Simplify using get_class_ivars(). (get_class_ivars): Remove second parameter; create a fresh copy of the ivar list for each call; do not check for existence of super class. (objc_eh_runtime_type): Mark #ifndef OBJCPLUS. (objc_init_exceptions): When using SJLJ-style exceptions, require the use of '-fobjc-exceptions' flag; do not require it for DWARF-style exceptions. (objc_build_exc_ptr, next_sjlj_build_try_catch_finally): Use objc_object_type instead of objc_id_type. (objc_begin_catch_clause): Convert the incoming PARM_DECL into a VAR_DECL before placing it in the appropriate scope; do not call define_decl(); adjust call to c_begin_compound_stmt(); use objc_object_type instead of objc_id_type. (build_next_objc_exception_stuff): Call create_field_decl() instead of create_builtin_decl(); construct type directly instead of calling groktypename(); use OBJC_VOID_AT_END to mark end of function parameters. (build_private_template): Adjust call to get_class_ivars(); build a type directly instead of via groktypename(). (build_protocol_template, build_method_prototype_list_template, build_method_prototype_template, build_category_template, build_selector_template, build_class_template, build_super_template, build_ivar_template, build_ivar_list_template, build_method_list_template, build_method_template): Call create_field_decl() instead of grokfield(). (objc_method_parm_type): Do not call groktypename(). (generate_descriptor_table): Call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(). (generate_method_descriptors, build_protocol_initializer, generate_dispatch_tables, build_category_initializer, build_shared_structure_initializer): Do not call groktypename(). (generate_protocols): Call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(); do not call groktypename(). (error_with_ivar): Remove last parameter. (check_ivars): Do not iterate ovar CLASS_RAW_IVARS lists in addition to CLASS_IVARS lists; adjust calls to error_with_ivar(). (generate_ivar_lists): Convert one of the initializer elements; do not call groktypename(). (get_arg_type_list, start_method_def, gen_method_def): Account for new representation of variable arguments and '...' in Objective-C methods; add Objective-C++ impedance matching code. (is_objc_type_qualifier): Remove function. (adjust_type_for_id_default): Simplify; there is no longer a need to wade through declspecs. (lookup_interface, start_class, continue_class, finish_class, start_method_def, start_protocol, build_method_decl, objc_add_method, add_instance_variable, build_ivar_reference, is_ivar, is_private, get_super_receiver, objc_build_finally_epilogue): Make into static functions. (receiver_is_class_object): Use new IS_CLASS() macro. (objc_build_message_expr): Tweak ObjC++ message argument handling; call objc_finish_message_expr() instead of finish_message_expr(). (finish_message_expr): Rename to objc_finish_message_expr(); use OBJC_TYPE_NAME and OBJC_SET_TYPE_NAME macros instead of TYPE_NAME. call gen_type_name() instead of gen_declaration(); call objc_is_id() instead of using IS_ID and IS_CLASS; Use objc_class_name instead of calling get_identifier("Class"); handle CONVERT_EXPRs in receiver. (build_objc_method_call, warn_with_method): Do not call groktypename(). (build_ivar_reference): Call convert() instead of clobbering in a type. (hash_init): Initialize string_htab hash table. (add_instance_variable): Simplify parameter list; do not call grokfield(); do not populate CLASS_IVARS list. (start_class): Check for the existence of super class, if one was specified. (continue_class): Use CLASS_RAW_IVARS rather than CLASS_IVARS; do not call build_class_template(); adjust call to get_class_ivars(); call build_decl(), pushdecl() and finish_decl() instead of define_decl(). (finish_class): Call build_decl(), pushdecl() and finish_decl() instead of define_decl(). (add_protocols): Use PROTOCOL_BINFO_ELTS for the tree vector size. (start_protocol): Do not call build_protocol_template(); use PROTOCOL_BINFO_ELTS for the tree vector size. (encode_type_qualifiers): Do not handle the 'const' qualifier here. (encode_pointer): Encode 'const char *' as 'r*', for backwards compatibility. (encode_array): Use HOST_WIDE_INT_PRINT_DEC instead of "%ld". (encode_type): Handle the 'const' qualifier here. (objc_parmlist): New global variable, sued by objc_push_parm and objc_get_parm_info(). (objc_push_parm, objc_get_parm_info): New functions. (objc_expr_last): Remove function. (synth_self_and_ucmd_args): For instance methods, use the instance type for 'self'; call objc_push_parm() instead of push_parm_decl(). (start_method_def): Do not call push_scope(), declare_parm_level(), pop_scope(), push_parm_decl(), store_parm_decls() or objc_expr_last(); just use objc_push_parm() and objc_get_parm_info(). (comp_method_with_proto): Remove function. (objc_types_are_equivalent): Strip away indirections before comparing underlying types. (comp_proto_with_proto): Do not call groktypename(); types are no longer in raw declspec format. (objc_start_function): New function. (really_start_method): Call comp_proto_with_proto() instead of comp_method_with_proto(); call objc_start_function() instead of hand-crafting a function declarator. (continue_method_def, objc_expand_function_end): Remove functions. (get_super_receiver): Call objc_get_current_scope() instead of get_current_scope(); reference 'super_class' field (instead of 'class'). (finish_method_def): Rename to objc_finish_method_definition() and add a function decl parameter; move method encoding call from objc_expand_function_end(). (is_complex_decl, adorn_decl, gen_declarator, gen_declspecs, gen_declaration_1): Remove functions. (tmpbuf, RAW_DECLSPEC): Remove. (gen_declaration): Remove second parameter; simplify to deal with TYPE_P nodes instead of raw declspecs. (gen_type_name, gen_type_name_0): New functions. (gen_method_decl): Remove second parameter; call gen_type_name() instead of gen_declaration_1(). (dump_interface): Adjust calls to gen_declaration() and gen_method_decl(); do not allocate a separate string buffer. (init_objc): Allocate a larger string buffer to accommodate dump_interface(); adjust call to build_module_descriptor(); add call to build_module_initializer_routine() for the GNU runtime. (generate_classref_translation_entry): Do not call start_decl(); call finish_var_decl() instead of finish_decl(); call convert() instead of build_c_cast(). * objc-act.h (CLASS_OWN_IVARS): Remove accessor. (CLASS_BINFO_ELTS): Reduce from 6 to 5, now that CLASS_OWN_IVARS is gone. (OCTI_GNU_INIT_DECL, GNU_INIT_decl): New. (OCTI_ELLIPSIS_NODE, objc_ellipsis_node): Remove. (OCTI_ID_ID, id_type, objc_id_id): Rename to OCTI_ID_NAME, objc_object_type and objc_object_name, respectively. (OCTI_CLS_REF, OCTI_CLASS_NAME, objc_class_reference, objc_class_name): New. (IS_CLASS): New macro. (IS_ID, IS_SUPER): Robustify. (OCTI_EXECCLASS_DECL, execclass_decl): New. (finish_file, start_class, continue_class, finish_class, start_method_def, continue_method_def, finish_method_def, start_protocol, finish_protocol, objc_build_throw_stmt, objc_build_try_catch_finally_stmt, objc_build_synchronized_prologue, objc_build_synchronized_epilogue, objc_build_try_prologue, objc_build_try_epilogue, objc_build_catch_stmt, objc_build_catch_epilogue, objc_build_finally_prologue, objc_build_finally_epilogue, is_ivar, is_private, is_public, add_instance_variable, objc_add_method, get_super_receiver, objc_clear_super_receiver, get_class_ivars_from_name, get_class_reference, get_static_reference, get_object_reference, build_message_expr, finish_message_expr, build_selector_expr, build_ivar_reference, build_keyword_decl, build_method_decl, build_protocol_expr, build_objc_string_object, objc_declare_alias, objc_declare_class, objc_declare_protocols, objc_comptypes, objc_check_decl, build_encode_expr): Remove prototypes. (imp_count, cat_count): Make GGC-aware. (OBJC_SET_TYPE_NAME): New macro. From-SVN: r87168
2004-09-08 02:49:44 +02:00
compound = c_begin_compound_stmt (true);
c-common.c (flag_objc_sjlj_exceptions): New. * c-common.c (flag_objc_sjlj_exceptions): New. * c-common.h (flag_objc_sjlj_exceptions): Declare. * c-opts.c (c_common_handle_option): Set it. (c_common_post_options): Handle interation of different objective-c exception and runtime switches. * c-decl.c (c_eh_initialized_p): New. (finish_decl): Use it instead of local eh_initialized_p. * c-parse.in (nested_function, notype_nested_function): Record the result of compstmt. (compstmt_or_error): Likewise. (compstmt): Don't add_stmt the result. (stmt): Don't return anything. Rewrite objc try and sync rules. (objc_try_stmt, objc_catch_list): Remove. (objc_catch_block, objc_finally_block): Remove. (objc_catch_prefix, objc_catch_clause, objc_opt_catch_list): New. (objc_try_catch_clause, objc_finally_clause): New. (objc_try_catch_stmt): Rewrite. * c-tree.h (c_eh_initialized_p): Declare. * c-opt (fobjc-sjlj-exceptions): New. * except.c (output_function_exception_table): Don't call cgraph on non-decls. * objc/objc-act.c (UTAG_EXCDATA_VAR, UTAG_CAUGHTEXC_VAR, UTAG_RETHROWEXC_VAR, UTAG_EVALONCE_VAR, struct val_stack, catch_count_stack, exc_binding_stack, if_nesting_count, blk_nesting_count, objc_enter_block, objc_exit_block, objc_declare_variable, 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): Remove. (objc_create_temporary_var, struct objc_try_context, cur_try_context, objc_eh_runtime_type, objc_init_exceptions, objc_build_exc_ptr, next_sjlj_build_try_exit, next_sjlj_build_enter_and_setjmp, next_sjlj_build_exc_extract, next_sjlj_build_catch_list, next_sjlj_build_try_catch_finally, objc_begin_try_stmt, objc_begin_catch_clause, objc_finish_catch_clause, objc_build_finally_clause, objc_finish_try_stmt, objc_build_synchronized): New. (objc_is_object_id, objc_is_class_id): New. (objc_comptypes): Use them. (build_next_objc_exception_stuff): Break NeXT sjlj out from build_objc_exception_stuff. (synth_module_prologue): Update to match. (objc_build_throw_stmt): Use cur_try_context to decide if we're in a @catch. * objc/objc-act.h: Update prototypes. (OCTI_EXCEPTION_BLK_STACK, objc_exception_block_stack): Remove. testsuite/ * objc.dg/sync-1.m: New. * objc.dg/try-catch-1.m: Don't force next runtime. * objc.dg/try-catch-3.m, objc.dg/try-catch-4.m: Likewise. * objc.dg/try-catch-2.m: Likewise. Enable everywhere. Remove shadowed catch clause. * objc.dg/try-catch-5.m: New. From-SVN: r83332
2004-06-18 03:20:53 +02:00
Makefile.in (c-parse.o): Depend on $(C_COMMON_H). [gcc/ChangeLog] 2004-09-07 Ziemowit Laski <zlaski@apple.com> * Makefile.in (c-parse.o): Depend on $(C_COMMON_H). * c-parse.in: Include c-common.h instead of objc-act.h. (ivar_decl_list, ivar_decls, ivar_decl, ivars, ivar_declarator, myparms, myparm): Remove %type declarations. (methodtype, optparms, OBJC_TYPE_QUAL, objc_quals, objc_qual, objc_typename, objc_try_catch_stmt, optellipsis): Add %type declarations. (objc_inherit_code, objc_public_flag): Remove. (typespec_nonreserved_nonattr): Call objc_get_protocol_qualified_type() instead of get_static_reference() and get_protocol_reference(). (stmt_nocomp): Call grokparm() on @catch parameter. (objcdef): Move semantic action to objc_finish_implementation(). (classdef): Move semantic action to objc_start_class_interface(), objc_continue_interface(), objc_finish_interface(), objc_start_class_implementation(), objc_continue_implementation(), objc_start_category_interface() and objc_start_category_implementation(). (protocoldef): Move semantic actions to objc_start_protocol() and objc_finish_interface(). (ivar_decl_list): Remove nonterminal. (visibility_spec): Move semantic actions to objc_set_visibility(). (ivar_decls): Remove assignment to $$. (ivar_decl): Rephrase in terms of component_decl; call objc_add_instance_variable(). (ivars, ivar_declarator): Remove nonterminals. (opt_semi): New nonterminal. (methodtype): Remove semantic actions. (methoddef): Move semantic actions to objc_set_method_type(), objc_start_method_definition() and objc_finish_method_definition(). (methodproto): Move semantic actions to objc_set_method_type() and objc_add_method_declaration(). (methoddecl): Use objc_typename instead of typename; move semantic actions to objc_build_method_signature(). (optarglist, myxdecls, mydecl, myparms, myparm): Remove nonterminals. (optparmlist): Express in terms of optparms and optellipsis. (optparms, optellipsis, objc_qual, objc_quals, objc_typename): New nonterminals. (keyworddecl): Use objc_typename instead of typename. (rid_to_yy): Mark RID_IN, RID_OUT, RID_INOUT, RID_BYCOPY, RID_BYREF and RID_ONEWAY as returning OBJC_TYPE_QUAL to yyparse(). [gcc/objc/ChangeLog] 2004-09-07 Ziemowit Laski <zlaski@apple.com> * Make-lang.in (objc/objc-parse.o): Depend on $(C_COMMON_H) instead of objc/objc-act.h. (objc/objc-act.o): Depend on $(HASHTAB_H). * objc-act.c: Include hashtab.h; in ObjC++ mode, include cp-tree.h and objcp-decl.h instead of c-tree.h. (build_module_descriptor, get_class_ivars, synth_id_with_class_suffix, error_with_ivar, gen_method_decl, gen_declaration, setup_string_decl, build_protocol_template): Adjust prototypes. (build_module_initializer_routine, start_class, continue_class, finish_class, start_method_def, objc_start_function, start_protocol, build_method_decl, objc_add_method, add_instance_variable, build_ivar_reference, is_ivar, is_private, get_super_receiver, build_selector_table_decl, objc_push_parm, objc_get_parm_info, gen_type_name, gen_type_name_0, start_var_decl, finish_var_decl, create_field_decl): New prototypes. (objc_expand_function_end, comp_method_with_proto, objc_expr_last, gen_declaration_1, gen_declarator, is_complex_decl, adorn_decl, define_decl, create_builtin_decl, gen_declspecs): Remove prototypes. (TYPE_ID): Rename to OBJECT_TYPEDEF_NAME. (CLASS_TYPEDEF_NAME): New. (TAG_EXECCLASS): Change from a global variable to a #define. (TAG_RETURN_STRUCT): Delete. (TAG_GNUINIT): New, holds '__objc_gnu_init' name. (objc_inherit_code, objc_public_flag): New, moved from c-parse.in. (string_descriptor): New struct. (string_htab): New hash table. (string_hash, string_eq): New prototypes. (generate_struct_by_value_array): Call create_field_decl() instead of create_builtin_decl(). (objc_init): Do not initialize objc_ellipsis_node or TAG_EXECCLASS; In ObjC++ mode, call cxx_init() instead of c_objc_common_init(). (objc_finish_file): In ObjC++, call instantiate_pending_templates() and cp_finish_file(). (define_decl, get_static_reference, get_protocol_reference, create_builtin_decl): Remove functions. (objc_start_class_interface, objc_start_category_interface, objc_start_protocol, objc_continue_interface, objc_finish_interface, objc_start_class_implementation, objc_start_category_implementation, objc_continue_implementation, objc_finish_implementation, objc_set_visibility, objc_set_method_type, objc_build_method_signature, objc_add_method_declaration, objc_start_method_definition, objc_add_instance_variable, objc_get_protocol_qualified_type, create_field_decl, start_var_decl, finish_var_decl): New functions. (setup_string_decl): Simplify since it is only called once. (synth_module_prologue): Call build_class_template(); predefine 'id' and 'Class' as typedefs; rename 'temp_type' to 'type'; disable debug hooks for duration of function; fix GNU runtime messenger signatures to correspond to reality; forward-declare '__objc_exec_class' for the GNU runtime; call build_selector_table_decl(); in ObjC++ mode, generate 'extern "C" { ... }' wrappers around synthesized declarations; call build_protocol_template() and build_category_template(). (string_hash, string_eq): New functions. (objc_build_string_object): Check metaclass correctness only once; store string literals in hash table. (objc_build_constructor): Do not convert initializer elements; adjust for ObjC++ impedance mismatch. (build_objc_symtab_template): Call create_field_decl() instead of create_builtin_decl(). (init_objc_symtab): Add missing conversion to initializer element. (build_metadata_decl): Call start_var_decl() instead of define_decl(). (generate_objc_symtab_decl): Do not call build_category_template(); call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(). (build_module_descriptor): Call create_field_decl() instead of grokfield(); call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(); always mark module descriptor as used; move GNU runtime-specific functionality to build_module_initializer_routine(). (build_module_initializer_routine): New function, broken off of build_module_descriptor(). (objc_static_init_needed_p, objc_generate_static_init_call): New functions. (generate_static_references, generate_strings, build_selector_translation_table, generate_descriptor_table, generate_ivars_list, generate_dispatch_table, generate_category): Call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(); build a type directly instead of via groktypename(). (build_selector_reference_decl, build_selector_table_decl, build_class_reference_decl, build_protocol_reference, generate_objc_image_info): Call start_var_decl() instead of build_decl(). (build_selector_reference): For GNU runtime, do not call build_selector_reference_decl(). (build_selector, build_typed_selector_reference): Always convert result to the selector type. (add_objc_string): Cast return value to 'char *'. (build_method_prototype_template, build_selector_template, build_method_template): Use actual selector type for fields pointing to selectors. (finish_objc): For GNU runtime, call build_module_initializer_routine() after build_module_descriptor(). (generate_protocol_list, generate_shared_structures): Call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(); build a type directly instead of via groktypename(). (synth_id_with_class_suffix): Return a string. (get_arg_type_list): For instance methods, use the instance type for 'self'; do not call groktypename_in_parm_context(). (build_objc_string_decl): Squash redeclaration errors in ObjC++. (objc_is_class_name): Use OBJC_TYPE_NAME instead of TYPE_NAME; handle RECORD_TYPEs in ObjC as well as ObjC++. (objc_is_id): New function. (objc_is_object_ptr): Return the canonical type node. (objc_get_class_ivars): Simplify using get_class_ivars(). (get_class_ivars): Remove second parameter; create a fresh copy of the ivar list for each call; do not check for existence of super class. (objc_eh_runtime_type): Mark #ifndef OBJCPLUS. (objc_init_exceptions): When using SJLJ-style exceptions, require the use of '-fobjc-exceptions' flag; do not require it for DWARF-style exceptions. (objc_build_exc_ptr, next_sjlj_build_try_catch_finally): Use objc_object_type instead of objc_id_type. (objc_begin_catch_clause): Convert the incoming PARM_DECL into a VAR_DECL before placing it in the appropriate scope; do not call define_decl(); adjust call to c_begin_compound_stmt(); use objc_object_type instead of objc_id_type. (build_next_objc_exception_stuff): Call create_field_decl() instead of create_builtin_decl(); construct type directly instead of calling groktypename(); use OBJC_VOID_AT_END to mark end of function parameters. (build_private_template): Adjust call to get_class_ivars(); build a type directly instead of via groktypename(). (build_protocol_template, build_method_prototype_list_template, build_method_prototype_template, build_category_template, build_selector_template, build_class_template, build_super_template, build_ivar_template, build_ivar_list_template, build_method_list_template, build_method_template): Call create_field_decl() instead of grokfield(). (objc_method_parm_type): Do not call groktypename(). (generate_descriptor_table): Call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(). (generate_method_descriptors, build_protocol_initializer, generate_dispatch_tables, build_category_initializer, build_shared_structure_initializer): Do not call groktypename(). (generate_protocols): Call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(); do not call groktypename(). (error_with_ivar): Remove last parameter. (check_ivars): Do not iterate ovar CLASS_RAW_IVARS lists in addition to CLASS_IVARS lists; adjust calls to error_with_ivar(). (generate_ivar_lists): Convert one of the initializer elements; do not call groktypename(). (get_arg_type_list, start_method_def, gen_method_def): Account for new representation of variable arguments and '...' in Objective-C methods; add Objective-C++ impedance matching code. (is_objc_type_qualifier): Remove function. (adjust_type_for_id_default): Simplify; there is no longer a need to wade through declspecs. (lookup_interface, start_class, continue_class, finish_class, start_method_def, start_protocol, build_method_decl, objc_add_method, add_instance_variable, build_ivar_reference, is_ivar, is_private, get_super_receiver, objc_build_finally_epilogue): Make into static functions. (receiver_is_class_object): Use new IS_CLASS() macro. (objc_build_message_expr): Tweak ObjC++ message argument handling; call objc_finish_message_expr() instead of finish_message_expr(). (finish_message_expr): Rename to objc_finish_message_expr(); use OBJC_TYPE_NAME and OBJC_SET_TYPE_NAME macros instead of TYPE_NAME. call gen_type_name() instead of gen_declaration(); call objc_is_id() instead of using IS_ID and IS_CLASS; Use objc_class_name instead of calling get_identifier("Class"); handle CONVERT_EXPRs in receiver. (build_objc_method_call, warn_with_method): Do not call groktypename(). (build_ivar_reference): Call convert() instead of clobbering in a type. (hash_init): Initialize string_htab hash table. (add_instance_variable): Simplify parameter list; do not call grokfield(); do not populate CLASS_IVARS list. (start_class): Check for the existence of super class, if one was specified. (continue_class): Use CLASS_RAW_IVARS rather than CLASS_IVARS; do not call build_class_template(); adjust call to get_class_ivars(); call build_decl(), pushdecl() and finish_decl() instead of define_decl(). (finish_class): Call build_decl(), pushdecl() and finish_decl() instead of define_decl(). (add_protocols): Use PROTOCOL_BINFO_ELTS for the tree vector size. (start_protocol): Do not call build_protocol_template(); use PROTOCOL_BINFO_ELTS for the tree vector size. (encode_type_qualifiers): Do not handle the 'const' qualifier here. (encode_pointer): Encode 'const char *' as 'r*', for backwards compatibility. (encode_array): Use HOST_WIDE_INT_PRINT_DEC instead of "%ld". (encode_type): Handle the 'const' qualifier here. (objc_parmlist): New global variable, sued by objc_push_parm and objc_get_parm_info(). (objc_push_parm, objc_get_parm_info): New functions. (objc_expr_last): Remove function. (synth_self_and_ucmd_args): For instance methods, use the instance type for 'self'; call objc_push_parm() instead of push_parm_decl(). (start_method_def): Do not call push_scope(), declare_parm_level(), pop_scope(), push_parm_decl(), store_parm_decls() or objc_expr_last(); just use objc_push_parm() and objc_get_parm_info(). (comp_method_with_proto): Remove function. (objc_types_are_equivalent): Strip away indirections before comparing underlying types. (comp_proto_with_proto): Do not call groktypename(); types are no longer in raw declspec format. (objc_start_function): New function. (really_start_method): Call comp_proto_with_proto() instead of comp_method_with_proto(); call objc_start_function() instead of hand-crafting a function declarator. (continue_method_def, objc_expand_function_end): Remove functions. (get_super_receiver): Call objc_get_current_scope() instead of get_current_scope(); reference 'super_class' field (instead of 'class'). (finish_method_def): Rename to objc_finish_method_definition() and add a function decl parameter; move method encoding call from objc_expand_function_end(). (is_complex_decl, adorn_decl, gen_declarator, gen_declspecs, gen_declaration_1): Remove functions. (tmpbuf, RAW_DECLSPEC): Remove. (gen_declaration): Remove second parameter; simplify to deal with TYPE_P nodes instead of raw declspecs. (gen_type_name, gen_type_name_0): New functions. (gen_method_decl): Remove second parameter; call gen_type_name() instead of gen_declaration_1(). (dump_interface): Adjust calls to gen_declaration() and gen_method_decl(); do not allocate a separate string buffer. (init_objc): Allocate a larger string buffer to accommodate dump_interface(); adjust call to build_module_descriptor(); add call to build_module_initializer_routine() for the GNU runtime. (generate_classref_translation_entry): Do not call start_decl(); call finish_var_decl() instead of finish_decl(); call convert() instead of build_c_cast(). * objc-act.h (CLASS_OWN_IVARS): Remove accessor. (CLASS_BINFO_ELTS): Reduce from 6 to 5, now that CLASS_OWN_IVARS is gone. (OCTI_GNU_INIT_DECL, GNU_INIT_decl): New. (OCTI_ELLIPSIS_NODE, objc_ellipsis_node): Remove. (OCTI_ID_ID, id_type, objc_id_id): Rename to OCTI_ID_NAME, objc_object_type and objc_object_name, respectively. (OCTI_CLS_REF, OCTI_CLASS_NAME, objc_class_reference, objc_class_name): New. (IS_CLASS): New macro. (IS_ID, IS_SUPER): Robustify. (OCTI_EXECCLASS_DECL, execclass_decl): New. (finish_file, start_class, continue_class, finish_class, start_method_def, continue_method_def, finish_method_def, start_protocol, finish_protocol, objc_build_throw_stmt, objc_build_try_catch_finally_stmt, objc_build_synchronized_prologue, objc_build_synchronized_epilogue, objc_build_try_prologue, objc_build_try_epilogue, objc_build_catch_stmt, objc_build_catch_epilogue, objc_build_finally_prologue, objc_build_finally_epilogue, is_ivar, is_private, is_public, add_instance_variable, objc_add_method, get_super_receiver, objc_clear_super_receiver, get_class_ivars_from_name, get_class_reference, get_static_reference, get_object_reference, build_message_expr, finish_message_expr, build_selector_expr, build_ivar_reference, build_keyword_decl, build_method_decl, build_protocol_expr, build_objc_string_object, objc_declare_alias, objc_declare_class, objc_declare_protocols, objc_comptypes, objc_check_decl, build_encode_expr): Remove prototypes. (imp_count, cat_count): Make GGC-aware. (OBJC_SET_TYPE_NAME): New macro. From-SVN: r87168
2004-09-08 02:49:44 +02:00
/* The parser passed in a PARM_DECL, but what we really want is a VAR_DECL. */
decl = build_decl (VAR_DECL, DECL_NAME (decl), TREE_TYPE (decl));
lang_hooks.decls.pushdecl (decl);
c-common.c (flag_objc_sjlj_exceptions): New. * c-common.c (flag_objc_sjlj_exceptions): New. * c-common.h (flag_objc_sjlj_exceptions): Declare. * c-opts.c (c_common_handle_option): Set it. (c_common_post_options): Handle interation of different objective-c exception and runtime switches. * c-decl.c (c_eh_initialized_p): New. (finish_decl): Use it instead of local eh_initialized_p. * c-parse.in (nested_function, notype_nested_function): Record the result of compstmt. (compstmt_or_error): Likewise. (compstmt): Don't add_stmt the result. (stmt): Don't return anything. Rewrite objc try and sync rules. (objc_try_stmt, objc_catch_list): Remove. (objc_catch_block, objc_finally_block): Remove. (objc_catch_prefix, objc_catch_clause, objc_opt_catch_list): New. (objc_try_catch_clause, objc_finally_clause): New. (objc_try_catch_stmt): Rewrite. * c-tree.h (c_eh_initialized_p): Declare. * c-opt (fobjc-sjlj-exceptions): New. * except.c (output_function_exception_table): Don't call cgraph on non-decls. * objc/objc-act.c (UTAG_EXCDATA_VAR, UTAG_CAUGHTEXC_VAR, UTAG_RETHROWEXC_VAR, UTAG_EVALONCE_VAR, struct val_stack, catch_count_stack, exc_binding_stack, if_nesting_count, blk_nesting_count, objc_enter_block, objc_exit_block, objc_declare_variable, 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): Remove. (objc_create_temporary_var, struct objc_try_context, cur_try_context, objc_eh_runtime_type, objc_init_exceptions, objc_build_exc_ptr, next_sjlj_build_try_exit, next_sjlj_build_enter_and_setjmp, next_sjlj_build_exc_extract, next_sjlj_build_catch_list, next_sjlj_build_try_catch_finally, objc_begin_try_stmt, objc_begin_catch_clause, objc_finish_catch_clause, objc_build_finally_clause, objc_finish_try_stmt, objc_build_synchronized): New. (objc_is_object_id, objc_is_class_id): New. (objc_comptypes): Use them. (build_next_objc_exception_stuff): Break NeXT sjlj out from build_objc_exception_stuff. (synth_module_prologue): Update to match. (objc_build_throw_stmt): Use cur_try_context to decide if we're in a @catch. * objc/objc-act.h: Update prototypes. (OCTI_EXCEPTION_BLK_STACK, objc_exception_block_stack): Remove. testsuite/ * objc.dg/sync-1.m: New. * objc.dg/try-catch-1.m: Don't force next runtime. * objc.dg/try-catch-3.m, objc.dg/try-catch-4.m: Likewise. * objc.dg/try-catch-2.m: Likewise. Enable everywhere. Remove shadowed catch clause. * objc.dg/try-catch-5.m: New. From-SVN: r83332
2004-06-18 03:20:53 +02:00
/* Since a decl is required here by syntax, don't warn if its unused. */
/* ??? As opposed to __attribute__((unused))? Anyway, this appears to
be what the previous objc implementation did. */
TREE_USED (decl) = 1;
/* Verify that the type of the catch is valid. It must be a pointer
to an Objective-C class, or "id" (which is catch-all). */
type = TREE_TYPE (decl);
Makefile.in (c-parse.o): Depend on $(C_COMMON_H). [gcc/ChangeLog] 2004-09-07 Ziemowit Laski <zlaski@apple.com> * Makefile.in (c-parse.o): Depend on $(C_COMMON_H). * c-parse.in: Include c-common.h instead of objc-act.h. (ivar_decl_list, ivar_decls, ivar_decl, ivars, ivar_declarator, myparms, myparm): Remove %type declarations. (methodtype, optparms, OBJC_TYPE_QUAL, objc_quals, objc_qual, objc_typename, objc_try_catch_stmt, optellipsis): Add %type declarations. (objc_inherit_code, objc_public_flag): Remove. (typespec_nonreserved_nonattr): Call objc_get_protocol_qualified_type() instead of get_static_reference() and get_protocol_reference(). (stmt_nocomp): Call grokparm() on @catch parameter. (objcdef): Move semantic action to objc_finish_implementation(). (classdef): Move semantic action to objc_start_class_interface(), objc_continue_interface(), objc_finish_interface(), objc_start_class_implementation(), objc_continue_implementation(), objc_start_category_interface() and objc_start_category_implementation(). (protocoldef): Move semantic actions to objc_start_protocol() and objc_finish_interface(). (ivar_decl_list): Remove nonterminal. (visibility_spec): Move semantic actions to objc_set_visibility(). (ivar_decls): Remove assignment to $$. (ivar_decl): Rephrase in terms of component_decl; call objc_add_instance_variable(). (ivars, ivar_declarator): Remove nonterminals. (opt_semi): New nonterminal. (methodtype): Remove semantic actions. (methoddef): Move semantic actions to objc_set_method_type(), objc_start_method_definition() and objc_finish_method_definition(). (methodproto): Move semantic actions to objc_set_method_type() and objc_add_method_declaration(). (methoddecl): Use objc_typename instead of typename; move semantic actions to objc_build_method_signature(). (optarglist, myxdecls, mydecl, myparms, myparm): Remove nonterminals. (optparmlist): Express in terms of optparms and optellipsis. (optparms, optellipsis, objc_qual, objc_quals, objc_typename): New nonterminals. (keyworddecl): Use objc_typename instead of typename. (rid_to_yy): Mark RID_IN, RID_OUT, RID_INOUT, RID_BYCOPY, RID_BYREF and RID_ONEWAY as returning OBJC_TYPE_QUAL to yyparse(). [gcc/objc/ChangeLog] 2004-09-07 Ziemowit Laski <zlaski@apple.com> * Make-lang.in (objc/objc-parse.o): Depend on $(C_COMMON_H) instead of objc/objc-act.h. (objc/objc-act.o): Depend on $(HASHTAB_H). * objc-act.c: Include hashtab.h; in ObjC++ mode, include cp-tree.h and objcp-decl.h instead of c-tree.h. (build_module_descriptor, get_class_ivars, synth_id_with_class_suffix, error_with_ivar, gen_method_decl, gen_declaration, setup_string_decl, build_protocol_template): Adjust prototypes. (build_module_initializer_routine, start_class, continue_class, finish_class, start_method_def, objc_start_function, start_protocol, build_method_decl, objc_add_method, add_instance_variable, build_ivar_reference, is_ivar, is_private, get_super_receiver, build_selector_table_decl, objc_push_parm, objc_get_parm_info, gen_type_name, gen_type_name_0, start_var_decl, finish_var_decl, create_field_decl): New prototypes. (objc_expand_function_end, comp_method_with_proto, objc_expr_last, gen_declaration_1, gen_declarator, is_complex_decl, adorn_decl, define_decl, create_builtin_decl, gen_declspecs): Remove prototypes. (TYPE_ID): Rename to OBJECT_TYPEDEF_NAME. (CLASS_TYPEDEF_NAME): New. (TAG_EXECCLASS): Change from a global variable to a #define. (TAG_RETURN_STRUCT): Delete. (TAG_GNUINIT): New, holds '__objc_gnu_init' name. (objc_inherit_code, objc_public_flag): New, moved from c-parse.in. (string_descriptor): New struct. (string_htab): New hash table. (string_hash, string_eq): New prototypes. (generate_struct_by_value_array): Call create_field_decl() instead of create_builtin_decl(). (objc_init): Do not initialize objc_ellipsis_node or TAG_EXECCLASS; In ObjC++ mode, call cxx_init() instead of c_objc_common_init(). (objc_finish_file): In ObjC++, call instantiate_pending_templates() and cp_finish_file(). (define_decl, get_static_reference, get_protocol_reference, create_builtin_decl): Remove functions. (objc_start_class_interface, objc_start_category_interface, objc_start_protocol, objc_continue_interface, objc_finish_interface, objc_start_class_implementation, objc_start_category_implementation, objc_continue_implementation, objc_finish_implementation, objc_set_visibility, objc_set_method_type, objc_build_method_signature, objc_add_method_declaration, objc_start_method_definition, objc_add_instance_variable, objc_get_protocol_qualified_type, create_field_decl, start_var_decl, finish_var_decl): New functions. (setup_string_decl): Simplify since it is only called once. (synth_module_prologue): Call build_class_template(); predefine 'id' and 'Class' as typedefs; rename 'temp_type' to 'type'; disable debug hooks for duration of function; fix GNU runtime messenger signatures to correspond to reality; forward-declare '__objc_exec_class' for the GNU runtime; call build_selector_table_decl(); in ObjC++ mode, generate 'extern "C" { ... }' wrappers around synthesized declarations; call build_protocol_template() and build_category_template(). (string_hash, string_eq): New functions. (objc_build_string_object): Check metaclass correctness only once; store string literals in hash table. (objc_build_constructor): Do not convert initializer elements; adjust for ObjC++ impedance mismatch. (build_objc_symtab_template): Call create_field_decl() instead of create_builtin_decl(). (init_objc_symtab): Add missing conversion to initializer element. (build_metadata_decl): Call start_var_decl() instead of define_decl(). (generate_objc_symtab_decl): Do not call build_category_template(); call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(). (build_module_descriptor): Call create_field_decl() instead of grokfield(); call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(); always mark module descriptor as used; move GNU runtime-specific functionality to build_module_initializer_routine(). (build_module_initializer_routine): New function, broken off of build_module_descriptor(). (objc_static_init_needed_p, objc_generate_static_init_call): New functions. (generate_static_references, generate_strings, build_selector_translation_table, generate_descriptor_table, generate_ivars_list, generate_dispatch_table, generate_category): Call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(); build a type directly instead of via groktypename(). (build_selector_reference_decl, build_selector_table_decl, build_class_reference_decl, build_protocol_reference, generate_objc_image_info): Call start_var_decl() instead of build_decl(). (build_selector_reference): For GNU runtime, do not call build_selector_reference_decl(). (build_selector, build_typed_selector_reference): Always convert result to the selector type. (add_objc_string): Cast return value to 'char *'. (build_method_prototype_template, build_selector_template, build_method_template): Use actual selector type for fields pointing to selectors. (finish_objc): For GNU runtime, call build_module_initializer_routine() after build_module_descriptor(). (generate_protocol_list, generate_shared_structures): Call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(); build a type directly instead of via groktypename(). (synth_id_with_class_suffix): Return a string. (get_arg_type_list): For instance methods, use the instance type for 'self'; do not call groktypename_in_parm_context(). (build_objc_string_decl): Squash redeclaration errors in ObjC++. (objc_is_class_name): Use OBJC_TYPE_NAME instead of TYPE_NAME; handle RECORD_TYPEs in ObjC as well as ObjC++. (objc_is_id): New function. (objc_is_object_ptr): Return the canonical type node. (objc_get_class_ivars): Simplify using get_class_ivars(). (get_class_ivars): Remove second parameter; create a fresh copy of the ivar list for each call; do not check for existence of super class. (objc_eh_runtime_type): Mark #ifndef OBJCPLUS. (objc_init_exceptions): When using SJLJ-style exceptions, require the use of '-fobjc-exceptions' flag; do not require it for DWARF-style exceptions. (objc_build_exc_ptr, next_sjlj_build_try_catch_finally): Use objc_object_type instead of objc_id_type. (objc_begin_catch_clause): Convert the incoming PARM_DECL into a VAR_DECL before placing it in the appropriate scope; do not call define_decl(); adjust call to c_begin_compound_stmt(); use objc_object_type instead of objc_id_type. (build_next_objc_exception_stuff): Call create_field_decl() instead of create_builtin_decl(); construct type directly instead of calling groktypename(); use OBJC_VOID_AT_END to mark end of function parameters. (build_private_template): Adjust call to get_class_ivars(); build a type directly instead of via groktypename(). (build_protocol_template, build_method_prototype_list_template, build_method_prototype_template, build_category_template, build_selector_template, build_class_template, build_super_template, build_ivar_template, build_ivar_list_template, build_method_list_template, build_method_template): Call create_field_decl() instead of grokfield(). (objc_method_parm_type): Do not call groktypename(). (generate_descriptor_table): Call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(). (generate_method_descriptors, build_protocol_initializer, generate_dispatch_tables, build_category_initializer, build_shared_structure_initializer): Do not call groktypename(). (generate_protocols): Call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(); do not call groktypename(). (error_with_ivar): Remove last parameter. (check_ivars): Do not iterate ovar CLASS_RAW_IVARS lists in addition to CLASS_IVARS lists; adjust calls to error_with_ivar(). (generate_ivar_lists): Convert one of the initializer elements; do not call groktypename(). (get_arg_type_list, start_method_def, gen_method_def): Account for new representation of variable arguments and '...' in Objective-C methods; add Objective-C++ impedance matching code. (is_objc_type_qualifier): Remove function. (adjust_type_for_id_default): Simplify; there is no longer a need to wade through declspecs. (lookup_interface, start_class, continue_class, finish_class, start_method_def, start_protocol, build_method_decl, objc_add_method, add_instance_variable, build_ivar_reference, is_ivar, is_private, get_super_receiver, objc_build_finally_epilogue): Make into static functions. (receiver_is_class_object): Use new IS_CLASS() macro. (objc_build_message_expr): Tweak ObjC++ message argument handling; call objc_finish_message_expr() instead of finish_message_expr(). (finish_message_expr): Rename to objc_finish_message_expr(); use OBJC_TYPE_NAME and OBJC_SET_TYPE_NAME macros instead of TYPE_NAME. call gen_type_name() instead of gen_declaration(); call objc_is_id() instead of using IS_ID and IS_CLASS; Use objc_class_name instead of calling get_identifier("Class"); handle CONVERT_EXPRs in receiver. (build_objc_method_call, warn_with_method): Do not call groktypename(). (build_ivar_reference): Call convert() instead of clobbering in a type. (hash_init): Initialize string_htab hash table. (add_instance_variable): Simplify parameter list; do not call grokfield(); do not populate CLASS_IVARS list. (start_class): Check for the existence of super class, if one was specified. (continue_class): Use CLASS_RAW_IVARS rather than CLASS_IVARS; do not call build_class_template(); adjust call to get_class_ivars(); call build_decl(), pushdecl() and finish_decl() instead of define_decl(). (finish_class): Call build_decl(), pushdecl() and finish_decl() instead of define_decl(). (add_protocols): Use PROTOCOL_BINFO_ELTS for the tree vector size. (start_protocol): Do not call build_protocol_template(); use PROTOCOL_BINFO_ELTS for the tree vector size. (encode_type_qualifiers): Do not handle the 'const' qualifier here. (encode_pointer): Encode 'const char *' as 'r*', for backwards compatibility. (encode_array): Use HOST_WIDE_INT_PRINT_DEC instead of "%ld". (encode_type): Handle the 'const' qualifier here. (objc_parmlist): New global variable, sued by objc_push_parm and objc_get_parm_info(). (objc_push_parm, objc_get_parm_info): New functions. (objc_expr_last): Remove function. (synth_self_and_ucmd_args): For instance methods, use the instance type for 'self'; call objc_push_parm() instead of push_parm_decl(). (start_method_def): Do not call push_scope(), declare_parm_level(), pop_scope(), push_parm_decl(), store_parm_decls() or objc_expr_last(); just use objc_push_parm() and objc_get_parm_info(). (comp_method_with_proto): Remove function. (objc_types_are_equivalent): Strip away indirections before comparing underlying types. (comp_proto_with_proto): Do not call groktypename(); types are no longer in raw declspec format. (objc_start_function): New function. (really_start_method): Call comp_proto_with_proto() instead of comp_method_with_proto(); call objc_start_function() instead of hand-crafting a function declarator. (continue_method_def, objc_expand_function_end): Remove functions. (get_super_receiver): Call objc_get_current_scope() instead of get_current_scope(); reference 'super_class' field (instead of 'class'). (finish_method_def): Rename to objc_finish_method_definition() and add a function decl parameter; move method encoding call from objc_expand_function_end(). (is_complex_decl, adorn_decl, gen_declarator, gen_declspecs, gen_declaration_1): Remove functions. (tmpbuf, RAW_DECLSPEC): Remove. (gen_declaration): Remove second parameter; simplify to deal with TYPE_P nodes instead of raw declspecs. (gen_type_name, gen_type_name_0): New functions. (gen_method_decl): Remove second parameter; call gen_type_name() instead of gen_declaration_1(). (dump_interface): Adjust calls to gen_declaration() and gen_method_decl(); do not allocate a separate string buffer. (init_objc): Allocate a larger string buffer to accommodate dump_interface(); adjust call to build_module_descriptor(); add call to build_module_initializer_routine() for the GNU runtime. (generate_classref_translation_entry): Do not call start_decl(); call finish_var_decl() instead of finish_decl(); call convert() instead of build_c_cast(). * objc-act.h (CLASS_OWN_IVARS): Remove accessor. (CLASS_BINFO_ELTS): Reduce from 6 to 5, now that CLASS_OWN_IVARS is gone. (OCTI_GNU_INIT_DECL, GNU_INIT_decl): New. (OCTI_ELLIPSIS_NODE, objc_ellipsis_node): Remove. (OCTI_ID_ID, id_type, objc_id_id): Rename to OCTI_ID_NAME, objc_object_type and objc_object_name, respectively. (OCTI_CLS_REF, OCTI_CLASS_NAME, objc_class_reference, objc_class_name): New. (IS_CLASS): New macro. (IS_ID, IS_SUPER): Robustify. (OCTI_EXECCLASS_DECL, execclass_decl): New. (finish_file, start_class, continue_class, finish_class, start_method_def, continue_method_def, finish_method_def, start_protocol, finish_protocol, objc_build_throw_stmt, objc_build_try_catch_finally_stmt, objc_build_synchronized_prologue, objc_build_synchronized_epilogue, objc_build_try_prologue, objc_build_try_epilogue, objc_build_catch_stmt, objc_build_catch_epilogue, objc_build_finally_prologue, objc_build_finally_epilogue, is_ivar, is_private, is_public, add_instance_variable, objc_add_method, get_super_receiver, objc_clear_super_receiver, get_class_ivars_from_name, get_class_reference, get_static_reference, get_object_reference, build_message_expr, finish_message_expr, build_selector_expr, build_ivar_reference, build_keyword_decl, build_method_decl, build_protocol_expr, build_objc_string_object, objc_declare_alias, objc_declare_class, objc_declare_protocols, objc_comptypes, objc_check_decl, build_encode_expr): Remove prototypes. (imp_count, cat_count): Make GGC-aware. (OBJC_SET_TYPE_NAME): New macro. From-SVN: r87168
2004-09-08 02:49:44 +02:00
c-common.c (flag_objc_sjlj_exceptions): New. * c-common.c (flag_objc_sjlj_exceptions): New. * c-common.h (flag_objc_sjlj_exceptions): Declare. * c-opts.c (c_common_handle_option): Set it. (c_common_post_options): Handle interation of different objective-c exception and runtime switches. * c-decl.c (c_eh_initialized_p): New. (finish_decl): Use it instead of local eh_initialized_p. * c-parse.in (nested_function, notype_nested_function): Record the result of compstmt. (compstmt_or_error): Likewise. (compstmt): Don't add_stmt the result. (stmt): Don't return anything. Rewrite objc try and sync rules. (objc_try_stmt, objc_catch_list): Remove. (objc_catch_block, objc_finally_block): Remove. (objc_catch_prefix, objc_catch_clause, objc_opt_catch_list): New. (objc_try_catch_clause, objc_finally_clause): New. (objc_try_catch_stmt): Rewrite. * c-tree.h (c_eh_initialized_p): Declare. * c-opt (fobjc-sjlj-exceptions): New. * except.c (output_function_exception_table): Don't call cgraph on non-decls. * objc/objc-act.c (UTAG_EXCDATA_VAR, UTAG_CAUGHTEXC_VAR, UTAG_RETHROWEXC_VAR, UTAG_EVALONCE_VAR, struct val_stack, catch_count_stack, exc_binding_stack, if_nesting_count, blk_nesting_count, objc_enter_block, objc_exit_block, objc_declare_variable, 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): Remove. (objc_create_temporary_var, struct objc_try_context, cur_try_context, objc_eh_runtime_type, objc_init_exceptions, objc_build_exc_ptr, next_sjlj_build_try_exit, next_sjlj_build_enter_and_setjmp, next_sjlj_build_exc_extract, next_sjlj_build_catch_list, next_sjlj_build_try_catch_finally, objc_begin_try_stmt, objc_begin_catch_clause, objc_finish_catch_clause, objc_build_finally_clause, objc_finish_try_stmt, objc_build_synchronized): New. (objc_is_object_id, objc_is_class_id): New. (objc_comptypes): Use them. (build_next_objc_exception_stuff): Break NeXT sjlj out from build_objc_exception_stuff. (synth_module_prologue): Update to match. (objc_build_throw_stmt): Use cur_try_context to decide if we're in a @catch. * objc/objc-act.h: Update prototypes. (OCTI_EXCEPTION_BLK_STACK, objc_exception_block_stack): Remove. testsuite/ * objc.dg/sync-1.m: New. * objc.dg/try-catch-1.m: Don't force next runtime. * objc.dg/try-catch-3.m, objc.dg/try-catch-4.m: Likewise. * objc.dg/try-catch-2.m: Likewise. Enable everywhere. Remove shadowed catch clause. * objc.dg/try-catch-5.m: New. From-SVN: r83332
2004-06-18 03:20:53 +02:00
if (POINTER_TYPE_P (type) && objc_is_object_id (TREE_TYPE (type)))
type = NULL;
else if (!POINTER_TYPE_P (type) || !TYPED_OBJECT (TREE_TYPE (type)))
{
error ("@catch parameter is not a known Objective-C class type");
type = error_mark_node;
}
else if (cur_try_context->catch_list)
{
/* Examine previous @catch clauses and see if we've already
caught the type in question. */
tree_stmt_iterator i = tsi_start (cur_try_context->catch_list);
for (; !tsi_end_p (i); tsi_next (&i))
{
tree stmt = tsi_stmt (i);
t = CATCH_TYPES (stmt);
if (t == error_mark_node)
continue;
objc-act.c (objc_build_struct): New function. * objc-act.c (objc_build_struct): New function. (objc_derived_from_p): Likewise. (objc_build_component_ref): Likewise. (objc_copy_binfo): Likewise. (objc_xref_basetypes): Likewise. (objc_lookup_protocol): Likewise. (objc_compare_protocols): Likewise. (objc_volatilize_decl): Likewise. (encode_aggregate_fields): Likewise. (volatilized_hash): Likewise. (volatilized_eq): Likewise. (objc_compare_types): Likewise. (objc_type_quals_match): Likewise. (DERIVED_FROM_P): New ObjC macro, corresponding to C++ macro of same name. (get_class_ivars): Add second parameter indicating if entire hierarchy is desired. (struct volatilized_type): New type. (volatilized_htab): New hash table. (objc_types_compatible_p, objc_comptypes): Remove functions. (synth_module_prologue): Do not initialize 'unused_list'. (objc_get_class_reference): Fix ObjC++ impedance mismatches. (objc_declare_alias): Implement as a typedef. (objc_substitute_decl, objc_gimplify_expr): Reformat. (objc_get_class_ivars): Adjust call to get_class_ivars(). (next_sjlj_build_enter_and_setjmp, synth_forward_declarations, build_ivar_reference, get_super_receiver): Call objc_build_component_ref() instead of build_component_ref(). (objc_begin_catch_clause): Use DERIVED_FROM_P() instead of objc_comptypes(). (build_private_template): Call objc_build_struct() instead of start_struct() and finish_struct(). (hash_init): Initialize volatilized_htab. (objc_is_public): Adjust calls to objc_get_ivars(); adjust ObjC++ impedance mismatches. (encode_aggregate_within): Streamline by calling encode_aggregate_fields(). * objc-act.h (objc_types_compatible_p): Remove prototype. (OCTI_UNUSED_LIST, unused_list): Remove slot. * objc-lang.c (LANG_HOOKS_TYPES_COMPATIBLE_P): Remove. From-SVN: r100123
2005-05-25 00:21:01 +02:00
if (!t || DERIVED_FROM_P (TREE_TYPE (t), TREE_TYPE (type)))
c-common.c (flag_objc_sjlj_exceptions): New. * c-common.c (flag_objc_sjlj_exceptions): New. * c-common.h (flag_objc_sjlj_exceptions): Declare. * c-opts.c (c_common_handle_option): Set it. (c_common_post_options): Handle interation of different objective-c exception and runtime switches. * c-decl.c (c_eh_initialized_p): New. (finish_decl): Use it instead of local eh_initialized_p. * c-parse.in (nested_function, notype_nested_function): Record the result of compstmt. (compstmt_or_error): Likewise. (compstmt): Don't add_stmt the result. (stmt): Don't return anything. Rewrite objc try and sync rules. (objc_try_stmt, objc_catch_list): Remove. (objc_catch_block, objc_finally_block): Remove. (objc_catch_prefix, objc_catch_clause, objc_opt_catch_list): New. (objc_try_catch_clause, objc_finally_clause): New. (objc_try_catch_stmt): Rewrite. * c-tree.h (c_eh_initialized_p): Declare. * c-opt (fobjc-sjlj-exceptions): New. * except.c (output_function_exception_table): Don't call cgraph on non-decls. * objc/objc-act.c (UTAG_EXCDATA_VAR, UTAG_CAUGHTEXC_VAR, UTAG_RETHROWEXC_VAR, UTAG_EVALONCE_VAR, struct val_stack, catch_count_stack, exc_binding_stack, if_nesting_count, blk_nesting_count, objc_enter_block, objc_exit_block, objc_declare_variable, 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): Remove. (objc_create_temporary_var, struct objc_try_context, cur_try_context, objc_eh_runtime_type, objc_init_exceptions, objc_build_exc_ptr, next_sjlj_build_try_exit, next_sjlj_build_enter_and_setjmp, next_sjlj_build_exc_extract, next_sjlj_build_catch_list, next_sjlj_build_try_catch_finally, objc_begin_try_stmt, objc_begin_catch_clause, objc_finish_catch_clause, objc_build_finally_clause, objc_finish_try_stmt, objc_build_synchronized): New. (objc_is_object_id, objc_is_class_id): New. (objc_comptypes): Use them. (build_next_objc_exception_stuff): Break NeXT sjlj out from build_objc_exception_stuff. (synth_module_prologue): Update to match. (objc_build_throw_stmt): Use cur_try_context to decide if we're in a @catch. * objc/objc-act.h: Update prototypes. (OCTI_EXCEPTION_BLK_STACK, objc_exception_block_stack): Remove. testsuite/ * objc.dg/sync-1.m: New. * objc.dg/try-catch-1.m: Don't force next runtime. * objc.dg/try-catch-3.m, objc.dg/try-catch-4.m: Likewise. * objc.dg/try-catch-2.m: Likewise. Enable everywhere. Remove shadowed catch clause. * objc.dg/try-catch-5.m: New. From-SVN: r83332
2004-06-18 03:20:53 +02:00
{
diagnostic.c (warning): Accept parameter to classify warning option. * diagnostic.c (warning): Accept parameter to classify warning option. (warning0): New, for when a pointer to an error() like function is needed. * errors.c (warning): Likewise. * errors.h (warning, warning0): Adjust prototypes. * toplev.h (warning, warning0): Likewise. * attribs.c, builtins.c, c-common.c, c-decl.c, c-format.c, c-gimplify.c, c-lex.c, c-objc-common.c, c-opts.c, c-parser.c, c-pragma.c, c-typeck.c, calls.c, cgraph.c, coverage.c, emit-rtl.c, fold-const.c, fortran/trans-decl.c, function.c, gcse.c, genautomata.c, haifa-sched.c, opts.c, passes.c, regclass.c, reload1.c, stmt.c, stor-layout.c, toplev.c, tree-cfg.c, tree-dump.c, tree-inline.c, tree-mudflap.c, tree-optimize.c, tree-ssa.c, tree.c, varasm.c: Adjust warning() callers. * config/alpha/alpha.c, config/arc/arc.c, config/arm/arm.c, config/avr/avr.c, config/bfin/bfin.c, config/c4x/c4x-c.c, config/c4x/c4x.c, config/cris/cris.c, config/darwin-c.c, config/darwin.c, config/darwin.h, config/h8300/h8300.c, config/i386/cygming.h, config/i386/djgpp.h, config/i386/i386.c, config/i386/winnt.c, config/ia64/ia64-c.c, config/ia64/ia64.c, config/ip2k/ip2k.c, config/m32r/m32r.c, config/m68hc11/m68hc11.c, config/m68k/m68k.c, config/mcore/mcore.c, config/mips/mips.c, config/mmix/mmix.c, config/ns32k/ns32k.c, config/pa/pa-hpux11.h, config/pa/pa.c, config/rs6000/aix43.h, config/rs6000/aix51.h, config/rs6000/aix52.h, config/rs6000/darwin.h, config/rs6000/rs6000-c.c, config/rs6000/rs6000.c, config/s390/s390.c, config/sh/sh.c, config/sh/sh.h, config/sh/symbian.c, config/sol2-c.c, config/sol2.c, config/stormy16/stormy16.c, config/v850/v850-c.c, config/v850/v850.c, config/xtensa/xtensa.c: Adjust warning() callers. * ada/misc.c: Adjust warning() callers. * cp/call.c, cp/class.c, cp/cvt.c, cp/decl.c, cp/decl2.c, cp/except.c, cp/friend.c, cp/init.c, cp/lex.c, cp/mangle.c, cp/method.c, cp/name-lookup.c, cp/parser.c, cp/repo.c, cp/rtti.c, cp/tree.c, cp/typeck.c, cp/typeck2.c: Adjust warning() callers. * fortran/trans-decl.c: Adjust warning() callers. * java/class.c, java/decl.c, java/expr.c, java/jcf-io.c, java/jcf-parse.c, java/jv-scan.c, java/parse.y: Adjust warning() callers. * objc/objc-act.c: Adjust warning() callers. * treelang/parse.y: Adjust warning() callers. From-SVN: r98633
2005-04-23 23:29:07 +02:00
warning (0, "exception of type %<%T%> will be caught",
c-common.c (flag_objc_sjlj_exceptions): New. * c-common.c (flag_objc_sjlj_exceptions): New. * c-common.h (flag_objc_sjlj_exceptions): Declare. * c-opts.c (c_common_handle_option): Set it. (c_common_post_options): Handle interation of different objective-c exception and runtime switches. * c-decl.c (c_eh_initialized_p): New. (finish_decl): Use it instead of local eh_initialized_p. * c-parse.in (nested_function, notype_nested_function): Record the result of compstmt. (compstmt_or_error): Likewise. (compstmt): Don't add_stmt the result. (stmt): Don't return anything. Rewrite objc try and sync rules. (objc_try_stmt, objc_catch_list): Remove. (objc_catch_block, objc_finally_block): Remove. (objc_catch_prefix, objc_catch_clause, objc_opt_catch_list): New. (objc_try_catch_clause, objc_finally_clause): New. (objc_try_catch_stmt): Rewrite. * c-tree.h (c_eh_initialized_p): Declare. * c-opt (fobjc-sjlj-exceptions): New. * except.c (output_function_exception_table): Don't call cgraph on non-decls. * objc/objc-act.c (UTAG_EXCDATA_VAR, UTAG_CAUGHTEXC_VAR, UTAG_RETHROWEXC_VAR, UTAG_EVALONCE_VAR, struct val_stack, catch_count_stack, exc_binding_stack, if_nesting_count, blk_nesting_count, objc_enter_block, objc_exit_block, objc_declare_variable, 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): Remove. (objc_create_temporary_var, struct objc_try_context, cur_try_context, objc_eh_runtime_type, objc_init_exceptions, objc_build_exc_ptr, next_sjlj_build_try_exit, next_sjlj_build_enter_and_setjmp, next_sjlj_build_exc_extract, next_sjlj_build_catch_list, next_sjlj_build_try_catch_finally, objc_begin_try_stmt, objc_begin_catch_clause, objc_finish_catch_clause, objc_build_finally_clause, objc_finish_try_stmt, objc_build_synchronized): New. (objc_is_object_id, objc_is_class_id): New. (objc_comptypes): Use them. (build_next_objc_exception_stuff): Break NeXT sjlj out from build_objc_exception_stuff. (synth_module_prologue): Update to match. (objc_build_throw_stmt): Use cur_try_context to decide if we're in a @catch. * objc/objc-act.h: Update prototypes. (OCTI_EXCEPTION_BLK_STACK, objc_exception_block_stack): Remove. testsuite/ * objc.dg/sync-1.m: New. * objc.dg/try-catch-1.m: Don't force next runtime. * objc.dg/try-catch-3.m, objc.dg/try-catch-4.m: Likewise. * objc.dg/try-catch-2.m: Likewise. Enable everywhere. Remove shadowed catch clause. * objc.dg/try-catch-5.m: New. From-SVN: r83332
2004-06-18 03:20:53 +02:00
TREE_TYPE (type));
diagnostic.c (warning): Accept parameter to classify warning option. * diagnostic.c (warning): Accept parameter to classify warning option. (warning0): New, for when a pointer to an error() like function is needed. * errors.c (warning): Likewise. * errors.h (warning, warning0): Adjust prototypes. * toplev.h (warning, warning0): Likewise. * attribs.c, builtins.c, c-common.c, c-decl.c, c-format.c, c-gimplify.c, c-lex.c, c-objc-common.c, c-opts.c, c-parser.c, c-pragma.c, c-typeck.c, calls.c, cgraph.c, coverage.c, emit-rtl.c, fold-const.c, fortran/trans-decl.c, function.c, gcse.c, genautomata.c, haifa-sched.c, opts.c, passes.c, regclass.c, reload1.c, stmt.c, stor-layout.c, toplev.c, tree-cfg.c, tree-dump.c, tree-inline.c, tree-mudflap.c, tree-optimize.c, tree-ssa.c, tree.c, varasm.c: Adjust warning() callers. * config/alpha/alpha.c, config/arc/arc.c, config/arm/arm.c, config/avr/avr.c, config/bfin/bfin.c, config/c4x/c4x-c.c, config/c4x/c4x.c, config/cris/cris.c, config/darwin-c.c, config/darwin.c, config/darwin.h, config/h8300/h8300.c, config/i386/cygming.h, config/i386/djgpp.h, config/i386/i386.c, config/i386/winnt.c, config/ia64/ia64-c.c, config/ia64/ia64.c, config/ip2k/ip2k.c, config/m32r/m32r.c, config/m68hc11/m68hc11.c, config/m68k/m68k.c, config/mcore/mcore.c, config/mips/mips.c, config/mmix/mmix.c, config/ns32k/ns32k.c, config/pa/pa-hpux11.h, config/pa/pa.c, config/rs6000/aix43.h, config/rs6000/aix51.h, config/rs6000/aix52.h, config/rs6000/darwin.h, config/rs6000/rs6000-c.c, config/rs6000/rs6000.c, config/s390/s390.c, config/sh/sh.c, config/sh/sh.h, config/sh/symbian.c, config/sol2-c.c, config/sol2.c, config/stormy16/stormy16.c, config/v850/v850-c.c, config/v850/v850.c, config/xtensa/xtensa.c: Adjust warning() callers. * ada/misc.c: Adjust warning() callers. * cp/call.c, cp/class.c, cp/cvt.c, cp/decl.c, cp/decl2.c, cp/except.c, cp/friend.c, cp/init.c, cp/lex.c, cp/mangle.c, cp/method.c, cp/name-lookup.c, cp/parser.c, cp/repo.c, cp/rtti.c, cp/tree.c, cp/typeck.c, cp/typeck2.c: Adjust warning() callers. * fortran/trans-decl.c: Adjust warning() callers. * java/class.c, java/decl.c, java/expr.c, java/jcf-io.c, java/jcf-parse.c, java/jv-scan.c, java/parse.y: Adjust warning() callers. * objc/objc-act.c: Adjust warning() callers. * treelang/parse.y: Adjust warning() callers. From-SVN: r98633
2005-04-23 23:29:07 +02:00
warning (0, "%H by earlier handler for %<%T%>",
Makefile.in (c-parse.o): Depend on $(C_COMMON_H). [gcc/ChangeLog] 2004-09-07 Ziemowit Laski <zlaski@apple.com> * Makefile.in (c-parse.o): Depend on $(C_COMMON_H). * c-parse.in: Include c-common.h instead of objc-act.h. (ivar_decl_list, ivar_decls, ivar_decl, ivars, ivar_declarator, myparms, myparm): Remove %type declarations. (methodtype, optparms, OBJC_TYPE_QUAL, objc_quals, objc_qual, objc_typename, objc_try_catch_stmt, optellipsis): Add %type declarations. (objc_inherit_code, objc_public_flag): Remove. (typespec_nonreserved_nonattr): Call objc_get_protocol_qualified_type() instead of get_static_reference() and get_protocol_reference(). (stmt_nocomp): Call grokparm() on @catch parameter. (objcdef): Move semantic action to objc_finish_implementation(). (classdef): Move semantic action to objc_start_class_interface(), objc_continue_interface(), objc_finish_interface(), objc_start_class_implementation(), objc_continue_implementation(), objc_start_category_interface() and objc_start_category_implementation(). (protocoldef): Move semantic actions to objc_start_protocol() and objc_finish_interface(). (ivar_decl_list): Remove nonterminal. (visibility_spec): Move semantic actions to objc_set_visibility(). (ivar_decls): Remove assignment to $$. (ivar_decl): Rephrase in terms of component_decl; call objc_add_instance_variable(). (ivars, ivar_declarator): Remove nonterminals. (opt_semi): New nonterminal. (methodtype): Remove semantic actions. (methoddef): Move semantic actions to objc_set_method_type(), objc_start_method_definition() and objc_finish_method_definition(). (methodproto): Move semantic actions to objc_set_method_type() and objc_add_method_declaration(). (methoddecl): Use objc_typename instead of typename; move semantic actions to objc_build_method_signature(). (optarglist, myxdecls, mydecl, myparms, myparm): Remove nonterminals. (optparmlist): Express in terms of optparms and optellipsis. (optparms, optellipsis, objc_qual, objc_quals, objc_typename): New nonterminals. (keyworddecl): Use objc_typename instead of typename. (rid_to_yy): Mark RID_IN, RID_OUT, RID_INOUT, RID_BYCOPY, RID_BYREF and RID_ONEWAY as returning OBJC_TYPE_QUAL to yyparse(). [gcc/objc/ChangeLog] 2004-09-07 Ziemowit Laski <zlaski@apple.com> * Make-lang.in (objc/objc-parse.o): Depend on $(C_COMMON_H) instead of objc/objc-act.h. (objc/objc-act.o): Depend on $(HASHTAB_H). * objc-act.c: Include hashtab.h; in ObjC++ mode, include cp-tree.h and objcp-decl.h instead of c-tree.h. (build_module_descriptor, get_class_ivars, synth_id_with_class_suffix, error_with_ivar, gen_method_decl, gen_declaration, setup_string_decl, build_protocol_template): Adjust prototypes. (build_module_initializer_routine, start_class, continue_class, finish_class, start_method_def, objc_start_function, start_protocol, build_method_decl, objc_add_method, add_instance_variable, build_ivar_reference, is_ivar, is_private, get_super_receiver, build_selector_table_decl, objc_push_parm, objc_get_parm_info, gen_type_name, gen_type_name_0, start_var_decl, finish_var_decl, create_field_decl): New prototypes. (objc_expand_function_end, comp_method_with_proto, objc_expr_last, gen_declaration_1, gen_declarator, is_complex_decl, adorn_decl, define_decl, create_builtin_decl, gen_declspecs): Remove prototypes. (TYPE_ID): Rename to OBJECT_TYPEDEF_NAME. (CLASS_TYPEDEF_NAME): New. (TAG_EXECCLASS): Change from a global variable to a #define. (TAG_RETURN_STRUCT): Delete. (TAG_GNUINIT): New, holds '__objc_gnu_init' name. (objc_inherit_code, objc_public_flag): New, moved from c-parse.in. (string_descriptor): New struct. (string_htab): New hash table. (string_hash, string_eq): New prototypes. (generate_struct_by_value_array): Call create_field_decl() instead of create_builtin_decl(). (objc_init): Do not initialize objc_ellipsis_node or TAG_EXECCLASS; In ObjC++ mode, call cxx_init() instead of c_objc_common_init(). (objc_finish_file): In ObjC++, call instantiate_pending_templates() and cp_finish_file(). (define_decl, get_static_reference, get_protocol_reference, create_builtin_decl): Remove functions. (objc_start_class_interface, objc_start_category_interface, objc_start_protocol, objc_continue_interface, objc_finish_interface, objc_start_class_implementation, objc_start_category_implementation, objc_continue_implementation, objc_finish_implementation, objc_set_visibility, objc_set_method_type, objc_build_method_signature, objc_add_method_declaration, objc_start_method_definition, objc_add_instance_variable, objc_get_protocol_qualified_type, create_field_decl, start_var_decl, finish_var_decl): New functions. (setup_string_decl): Simplify since it is only called once. (synth_module_prologue): Call build_class_template(); predefine 'id' and 'Class' as typedefs; rename 'temp_type' to 'type'; disable debug hooks for duration of function; fix GNU runtime messenger signatures to correspond to reality; forward-declare '__objc_exec_class' for the GNU runtime; call build_selector_table_decl(); in ObjC++ mode, generate 'extern "C" { ... }' wrappers around synthesized declarations; call build_protocol_template() and build_category_template(). (string_hash, string_eq): New functions. (objc_build_string_object): Check metaclass correctness only once; store string literals in hash table. (objc_build_constructor): Do not convert initializer elements; adjust for ObjC++ impedance mismatch. (build_objc_symtab_template): Call create_field_decl() instead of create_builtin_decl(). (init_objc_symtab): Add missing conversion to initializer element. (build_metadata_decl): Call start_var_decl() instead of define_decl(). (generate_objc_symtab_decl): Do not call build_category_template(); call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(). (build_module_descriptor): Call create_field_decl() instead of grokfield(); call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(); always mark module descriptor as used; move GNU runtime-specific functionality to build_module_initializer_routine(). (build_module_initializer_routine): New function, broken off of build_module_descriptor(). (objc_static_init_needed_p, objc_generate_static_init_call): New functions. (generate_static_references, generate_strings, build_selector_translation_table, generate_descriptor_table, generate_ivars_list, generate_dispatch_table, generate_category): Call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(); build a type directly instead of via groktypename(). (build_selector_reference_decl, build_selector_table_decl, build_class_reference_decl, build_protocol_reference, generate_objc_image_info): Call start_var_decl() instead of build_decl(). (build_selector_reference): For GNU runtime, do not call build_selector_reference_decl(). (build_selector, build_typed_selector_reference): Always convert result to the selector type. (add_objc_string): Cast return value to 'char *'. (build_method_prototype_template, build_selector_template, build_method_template): Use actual selector type for fields pointing to selectors. (finish_objc): For GNU runtime, call build_module_initializer_routine() after build_module_descriptor(). (generate_protocol_list, generate_shared_structures): Call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(); build a type directly instead of via groktypename(). (synth_id_with_class_suffix): Return a string. (get_arg_type_list): For instance methods, use the instance type for 'self'; do not call groktypename_in_parm_context(). (build_objc_string_decl): Squash redeclaration errors in ObjC++. (objc_is_class_name): Use OBJC_TYPE_NAME instead of TYPE_NAME; handle RECORD_TYPEs in ObjC as well as ObjC++. (objc_is_id): New function. (objc_is_object_ptr): Return the canonical type node. (objc_get_class_ivars): Simplify using get_class_ivars(). (get_class_ivars): Remove second parameter; create a fresh copy of the ivar list for each call; do not check for existence of super class. (objc_eh_runtime_type): Mark #ifndef OBJCPLUS. (objc_init_exceptions): When using SJLJ-style exceptions, require the use of '-fobjc-exceptions' flag; do not require it for DWARF-style exceptions. (objc_build_exc_ptr, next_sjlj_build_try_catch_finally): Use objc_object_type instead of objc_id_type. (objc_begin_catch_clause): Convert the incoming PARM_DECL into a VAR_DECL before placing it in the appropriate scope; do not call define_decl(); adjust call to c_begin_compound_stmt(); use objc_object_type instead of objc_id_type. (build_next_objc_exception_stuff): Call create_field_decl() instead of create_builtin_decl(); construct type directly instead of calling groktypename(); use OBJC_VOID_AT_END to mark end of function parameters. (build_private_template): Adjust call to get_class_ivars(); build a type directly instead of via groktypename(). (build_protocol_template, build_method_prototype_list_template, build_method_prototype_template, build_category_template, build_selector_template, build_class_template, build_super_template, build_ivar_template, build_ivar_list_template, build_method_list_template, build_method_template): Call create_field_decl() instead of grokfield(). (objc_method_parm_type): Do not call groktypename(). (generate_descriptor_table): Call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(). (generate_method_descriptors, build_protocol_initializer, generate_dispatch_tables, build_category_initializer, build_shared_structure_initializer): Do not call groktypename(). (generate_protocols): Call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(); do not call groktypename(). (error_with_ivar): Remove last parameter. (check_ivars): Do not iterate ovar CLASS_RAW_IVARS lists in addition to CLASS_IVARS lists; adjust calls to error_with_ivar(). (generate_ivar_lists): Convert one of the initializer elements; do not call groktypename(). (get_arg_type_list, start_method_def, gen_method_def): Account for new representation of variable arguments and '...' in Objective-C methods; add Objective-C++ impedance matching code. (is_objc_type_qualifier): Remove function. (adjust_type_for_id_default): Simplify; there is no longer a need to wade through declspecs. (lookup_interface, start_class, continue_class, finish_class, start_method_def, start_protocol, build_method_decl, objc_add_method, add_instance_variable, build_ivar_reference, is_ivar, is_private, get_super_receiver, objc_build_finally_epilogue): Make into static functions. (receiver_is_class_object): Use new IS_CLASS() macro. (objc_build_message_expr): Tweak ObjC++ message argument handling; call objc_finish_message_expr() instead of finish_message_expr(). (finish_message_expr): Rename to objc_finish_message_expr(); use OBJC_TYPE_NAME and OBJC_SET_TYPE_NAME macros instead of TYPE_NAME. call gen_type_name() instead of gen_declaration(); call objc_is_id() instead of using IS_ID and IS_CLASS; Use objc_class_name instead of calling get_identifier("Class"); handle CONVERT_EXPRs in receiver. (build_objc_method_call, warn_with_method): Do not call groktypename(). (build_ivar_reference): Call convert() instead of clobbering in a type. (hash_init): Initialize string_htab hash table. (add_instance_variable): Simplify parameter list; do not call grokfield(); do not populate CLASS_IVARS list. (start_class): Check for the existence of super class, if one was specified. (continue_class): Use CLASS_RAW_IVARS rather than CLASS_IVARS; do not call build_class_template(); adjust call to get_class_ivars(); call build_decl(), pushdecl() and finish_decl() instead of define_decl(). (finish_class): Call build_decl(), pushdecl() and finish_decl() instead of define_decl(). (add_protocols): Use PROTOCOL_BINFO_ELTS for the tree vector size. (start_protocol): Do not call build_protocol_template(); use PROTOCOL_BINFO_ELTS for the tree vector size. (encode_type_qualifiers): Do not handle the 'const' qualifier here. (encode_pointer): Encode 'const char *' as 'r*', for backwards compatibility. (encode_array): Use HOST_WIDE_INT_PRINT_DEC instead of "%ld". (encode_type): Handle the 'const' qualifier here. (objc_parmlist): New global variable, sued by objc_push_parm and objc_get_parm_info(). (objc_push_parm, objc_get_parm_info): New functions. (objc_expr_last): Remove function. (synth_self_and_ucmd_args): For instance methods, use the instance type for 'self'; call objc_push_parm() instead of push_parm_decl(). (start_method_def): Do not call push_scope(), declare_parm_level(), pop_scope(), push_parm_decl(), store_parm_decls() or objc_expr_last(); just use objc_push_parm() and objc_get_parm_info(). (comp_method_with_proto): Remove function. (objc_types_are_equivalent): Strip away indirections before comparing underlying types. (comp_proto_with_proto): Do not call groktypename(); types are no longer in raw declspec format. (objc_start_function): New function. (really_start_method): Call comp_proto_with_proto() instead of comp_method_with_proto(); call objc_start_function() instead of hand-crafting a function declarator. (continue_method_def, objc_expand_function_end): Remove functions. (get_super_receiver): Call objc_get_current_scope() instead of get_current_scope(); reference 'super_class' field (instead of 'class'). (finish_method_def): Rename to objc_finish_method_definition() and add a function decl parameter; move method encoding call from objc_expand_function_end(). (is_complex_decl, adorn_decl, gen_declarator, gen_declspecs, gen_declaration_1): Remove functions. (tmpbuf, RAW_DECLSPEC): Remove. (gen_declaration): Remove second parameter; simplify to deal with TYPE_P nodes instead of raw declspecs. (gen_type_name, gen_type_name_0): New functions. (gen_method_decl): Remove second parameter; call gen_type_name() instead of gen_declaration_1(). (dump_interface): Adjust calls to gen_declaration() and gen_method_decl(); do not allocate a separate string buffer. (init_objc): Allocate a larger string buffer to accommodate dump_interface(); adjust call to build_module_descriptor(); add call to build_module_initializer_routine() for the GNU runtime. (generate_classref_translation_entry): Do not call start_decl(); call finish_var_decl() instead of finish_decl(); call convert() instead of build_c_cast(). * objc-act.h (CLASS_OWN_IVARS): Remove accessor. (CLASS_BINFO_ELTS): Reduce from 6 to 5, now that CLASS_OWN_IVARS is gone. (OCTI_GNU_INIT_DECL, GNU_INIT_decl): New. (OCTI_ELLIPSIS_NODE, objc_ellipsis_node): Remove. (OCTI_ID_ID, id_type, objc_id_id): Rename to OCTI_ID_NAME, objc_object_type and objc_object_name, respectively. (OCTI_CLS_REF, OCTI_CLASS_NAME, objc_class_reference, objc_class_name): New. (IS_CLASS): New macro. (IS_ID, IS_SUPER): Robustify. (OCTI_EXECCLASS_DECL, execclass_decl): New. (finish_file, start_class, continue_class, finish_class, start_method_def, continue_method_def, finish_method_def, start_protocol, finish_protocol, objc_build_throw_stmt, objc_build_try_catch_finally_stmt, objc_build_synchronized_prologue, objc_build_synchronized_epilogue, objc_build_try_prologue, objc_build_try_epilogue, objc_build_catch_stmt, objc_build_catch_epilogue, objc_build_finally_prologue, objc_build_finally_epilogue, is_ivar, is_private, is_public, add_instance_variable, objc_add_method, get_super_receiver, objc_clear_super_receiver, get_class_ivars_from_name, get_class_reference, get_static_reference, get_object_reference, build_message_expr, finish_message_expr, build_selector_expr, build_ivar_reference, build_keyword_decl, build_method_decl, build_protocol_expr, build_objc_string_object, objc_declare_alias, objc_declare_class, objc_declare_protocols, objc_comptypes, objc_check_decl, build_encode_expr): Remove prototypes. (imp_count, cat_count): Make GGC-aware. (OBJC_SET_TYPE_NAME): New macro. From-SVN: r87168
2004-09-08 02:49:44 +02:00
EXPR_LOCUS (stmt), TREE_TYPE (t ? t : objc_object_type));
c-common.c (flag_objc_sjlj_exceptions): New. * c-common.c (flag_objc_sjlj_exceptions): New. * c-common.h (flag_objc_sjlj_exceptions): Declare. * c-opts.c (c_common_handle_option): Set it. (c_common_post_options): Handle interation of different objective-c exception and runtime switches. * c-decl.c (c_eh_initialized_p): New. (finish_decl): Use it instead of local eh_initialized_p. * c-parse.in (nested_function, notype_nested_function): Record the result of compstmt. (compstmt_or_error): Likewise. (compstmt): Don't add_stmt the result. (stmt): Don't return anything. Rewrite objc try and sync rules. (objc_try_stmt, objc_catch_list): Remove. (objc_catch_block, objc_finally_block): Remove. (objc_catch_prefix, objc_catch_clause, objc_opt_catch_list): New. (objc_try_catch_clause, objc_finally_clause): New. (objc_try_catch_stmt): Rewrite. * c-tree.h (c_eh_initialized_p): Declare. * c-opt (fobjc-sjlj-exceptions): New. * except.c (output_function_exception_table): Don't call cgraph on non-decls. * objc/objc-act.c (UTAG_EXCDATA_VAR, UTAG_CAUGHTEXC_VAR, UTAG_RETHROWEXC_VAR, UTAG_EVALONCE_VAR, struct val_stack, catch_count_stack, exc_binding_stack, if_nesting_count, blk_nesting_count, objc_enter_block, objc_exit_block, objc_declare_variable, 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): Remove. (objc_create_temporary_var, struct objc_try_context, cur_try_context, objc_eh_runtime_type, objc_init_exceptions, objc_build_exc_ptr, next_sjlj_build_try_exit, next_sjlj_build_enter_and_setjmp, next_sjlj_build_exc_extract, next_sjlj_build_catch_list, next_sjlj_build_try_catch_finally, objc_begin_try_stmt, objc_begin_catch_clause, objc_finish_catch_clause, objc_build_finally_clause, objc_finish_try_stmt, objc_build_synchronized): New. (objc_is_object_id, objc_is_class_id): New. (objc_comptypes): Use them. (build_next_objc_exception_stuff): Break NeXT sjlj out from build_objc_exception_stuff. (synth_module_prologue): Update to match. (objc_build_throw_stmt): Use cur_try_context to decide if we're in a @catch. * objc/objc-act.h: Update prototypes. (OCTI_EXCEPTION_BLK_STACK, objc_exception_block_stack): Remove. testsuite/ * objc.dg/sync-1.m: New. * objc.dg/try-catch-1.m: Don't force next runtime. * objc.dg/try-catch-3.m, objc.dg/try-catch-4.m: Likewise. * objc.dg/try-catch-2.m: Likewise. Enable everywhere. Remove shadowed catch clause. * objc.dg/try-catch-5.m: New. From-SVN: r83332
2004-06-18 03:20:53 +02:00
break;
}
}
c-common.c (flag_objc_sjlj_exceptions): New. * c-common.c (flag_objc_sjlj_exceptions): New. * c-common.h (flag_objc_sjlj_exceptions): Declare. * c-opts.c (c_common_handle_option): Set it. (c_common_post_options): Handle interation of different objective-c exception and runtime switches. * c-decl.c (c_eh_initialized_p): New. (finish_decl): Use it instead of local eh_initialized_p. * c-parse.in (nested_function, notype_nested_function): Record the result of compstmt. (compstmt_or_error): Likewise. (compstmt): Don't add_stmt the result. (stmt): Don't return anything. Rewrite objc try and sync rules. (objc_try_stmt, objc_catch_list): Remove. (objc_catch_block, objc_finally_block): Remove. (objc_catch_prefix, objc_catch_clause, objc_opt_catch_list): New. (objc_try_catch_clause, objc_finally_clause): New. (objc_try_catch_stmt): Rewrite. * c-tree.h (c_eh_initialized_p): Declare. * c-opt (fobjc-sjlj-exceptions): New. * except.c (output_function_exception_table): Don't call cgraph on non-decls. * objc/objc-act.c (UTAG_EXCDATA_VAR, UTAG_CAUGHTEXC_VAR, UTAG_RETHROWEXC_VAR, UTAG_EVALONCE_VAR, struct val_stack, catch_count_stack, exc_binding_stack, if_nesting_count, blk_nesting_count, objc_enter_block, objc_exit_block, objc_declare_variable, 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): Remove. (objc_create_temporary_var, struct objc_try_context, cur_try_context, objc_eh_runtime_type, objc_init_exceptions, objc_build_exc_ptr, next_sjlj_build_try_exit, next_sjlj_build_enter_and_setjmp, next_sjlj_build_exc_extract, next_sjlj_build_catch_list, next_sjlj_build_try_catch_finally, objc_begin_try_stmt, objc_begin_catch_clause, objc_finish_catch_clause, objc_build_finally_clause, objc_finish_try_stmt, objc_build_synchronized): New. (objc_is_object_id, objc_is_class_id): New. (objc_comptypes): Use them. (build_next_objc_exception_stuff): Break NeXT sjlj out from build_objc_exception_stuff. (synth_module_prologue): Update to match. (objc_build_throw_stmt): Use cur_try_context to decide if we're in a @catch. * objc/objc-act.h: Update prototypes. (OCTI_EXCEPTION_BLK_STACK, objc_exception_block_stack): Remove. testsuite/ * objc.dg/sync-1.m: New. * objc.dg/try-catch-1.m: Don't force next runtime. * objc.dg/try-catch-3.m, objc.dg/try-catch-4.m: Likewise. * objc.dg/try-catch-2.m: Likewise. Enable everywhere. Remove shadowed catch clause. * objc.dg/try-catch-5.m: New. From-SVN: r83332
2004-06-18 03:20:53 +02:00
}
/* Record the data for the catch in the try context so that we can
finalize it later. */
t = build_stmt (CATCH_EXPR, type, compound);
cur_try_context->current_catch = t;
c-common.c (flag_objc_sjlj_exceptions): New. * c-common.c (flag_objc_sjlj_exceptions): New. * c-common.h (flag_objc_sjlj_exceptions): Declare. * c-opts.c (c_common_handle_option): Set it. (c_common_post_options): Handle interation of different objective-c exception and runtime switches. * c-decl.c (c_eh_initialized_p): New. (finish_decl): Use it instead of local eh_initialized_p. * c-parse.in (nested_function, notype_nested_function): Record the result of compstmt. (compstmt_or_error): Likewise. (compstmt): Don't add_stmt the result. (stmt): Don't return anything. Rewrite objc try and sync rules. (objc_try_stmt, objc_catch_list): Remove. (objc_catch_block, objc_finally_block): Remove. (objc_catch_prefix, objc_catch_clause, objc_opt_catch_list): New. (objc_try_catch_clause, objc_finally_clause): New. (objc_try_catch_stmt): Rewrite. * c-tree.h (c_eh_initialized_p): Declare. * c-opt (fobjc-sjlj-exceptions): New. * except.c (output_function_exception_table): Don't call cgraph on non-decls. * objc/objc-act.c (UTAG_EXCDATA_VAR, UTAG_CAUGHTEXC_VAR, UTAG_RETHROWEXC_VAR, UTAG_EVALONCE_VAR, struct val_stack, catch_count_stack, exc_binding_stack, if_nesting_count, blk_nesting_count, objc_enter_block, objc_exit_block, objc_declare_variable, 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): Remove. (objc_create_temporary_var, struct objc_try_context, cur_try_context, objc_eh_runtime_type, objc_init_exceptions, objc_build_exc_ptr, next_sjlj_build_try_exit, next_sjlj_build_enter_and_setjmp, next_sjlj_build_exc_extract, next_sjlj_build_catch_list, next_sjlj_build_try_catch_finally, objc_begin_try_stmt, objc_begin_catch_clause, objc_finish_catch_clause, objc_build_finally_clause, objc_finish_try_stmt, objc_build_synchronized): New. (objc_is_object_id, objc_is_class_id): New. (objc_comptypes): Use them. (build_next_objc_exception_stuff): Break NeXT sjlj out from build_objc_exception_stuff. (synth_module_prologue): Update to match. (objc_build_throw_stmt): Use cur_try_context to decide if we're in a @catch. * objc/objc-act.h: Update prototypes. (OCTI_EXCEPTION_BLK_STACK, objc_exception_block_stack): Remove. testsuite/ * objc.dg/sync-1.m: New. * objc.dg/try-catch-1.m: Don't force next runtime. * objc.dg/try-catch-3.m, objc.dg/try-catch-4.m: Likewise. * objc.dg/try-catch-2.m: Likewise. Enable everywhere. Remove shadowed catch clause. * objc.dg/try-catch-5.m: New. From-SVN: r83332
2004-06-18 03:20:53 +02:00
/* Initialize the decl from the EXC_PTR_EXPR we get from the runtime. */
t = objc_build_exc_ptr ();
t = convert (TREE_TYPE (decl), t);
t = build2 (MODIFY_EXPR, void_type_node, decl, t);
c-common.c (flag_objc_sjlj_exceptions): New. * c-common.c (flag_objc_sjlj_exceptions): New. * c-common.h (flag_objc_sjlj_exceptions): Declare. * c-opts.c (c_common_handle_option): Set it. (c_common_post_options): Handle interation of different objective-c exception and runtime switches. * c-decl.c (c_eh_initialized_p): New. (finish_decl): Use it instead of local eh_initialized_p. * c-parse.in (nested_function, notype_nested_function): Record the result of compstmt. (compstmt_or_error): Likewise. (compstmt): Don't add_stmt the result. (stmt): Don't return anything. Rewrite objc try and sync rules. (objc_try_stmt, objc_catch_list): Remove. (objc_catch_block, objc_finally_block): Remove. (objc_catch_prefix, objc_catch_clause, objc_opt_catch_list): New. (objc_try_catch_clause, objc_finally_clause): New. (objc_try_catch_stmt): Rewrite. * c-tree.h (c_eh_initialized_p): Declare. * c-opt (fobjc-sjlj-exceptions): New. * except.c (output_function_exception_table): Don't call cgraph on non-decls. * objc/objc-act.c (UTAG_EXCDATA_VAR, UTAG_CAUGHTEXC_VAR, UTAG_RETHROWEXC_VAR, UTAG_EVALONCE_VAR, struct val_stack, catch_count_stack, exc_binding_stack, if_nesting_count, blk_nesting_count, objc_enter_block, objc_exit_block, objc_declare_variable, 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): Remove. (objc_create_temporary_var, struct objc_try_context, cur_try_context, objc_eh_runtime_type, objc_init_exceptions, objc_build_exc_ptr, next_sjlj_build_try_exit, next_sjlj_build_enter_and_setjmp, next_sjlj_build_exc_extract, next_sjlj_build_catch_list, next_sjlj_build_try_catch_finally, objc_begin_try_stmt, objc_begin_catch_clause, objc_finish_catch_clause, objc_build_finally_clause, objc_finish_try_stmt, objc_build_synchronized): New. (objc_is_object_id, objc_is_class_id): New. (objc_comptypes): Use them. (build_next_objc_exception_stuff): Break NeXT sjlj out from build_objc_exception_stuff. (synth_module_prologue): Update to match. (objc_build_throw_stmt): Use cur_try_context to decide if we're in a @catch. * objc/objc-act.h: Update prototypes. (OCTI_EXCEPTION_BLK_STACK, objc_exception_block_stack): Remove. testsuite/ * objc.dg/sync-1.m: New. * objc.dg/try-catch-1.m: Don't force next runtime. * objc.dg/try-catch-3.m, objc.dg/try-catch-4.m: Likewise. * objc.dg/try-catch-2.m: Likewise. Enable everywhere. Remove shadowed catch clause. * objc.dg/try-catch-5.m: New. From-SVN: r83332
2004-06-18 03:20:53 +02:00
add_stmt (t);
}
c-common.c (flag_objc_sjlj_exceptions): New. * c-common.c (flag_objc_sjlj_exceptions): New. * c-common.h (flag_objc_sjlj_exceptions): Declare. * c-opts.c (c_common_handle_option): Set it. (c_common_post_options): Handle interation of different objective-c exception and runtime switches. * c-decl.c (c_eh_initialized_p): New. (finish_decl): Use it instead of local eh_initialized_p. * c-parse.in (nested_function, notype_nested_function): Record the result of compstmt. (compstmt_or_error): Likewise. (compstmt): Don't add_stmt the result. (stmt): Don't return anything. Rewrite objc try and sync rules. (objc_try_stmt, objc_catch_list): Remove. (objc_catch_block, objc_finally_block): Remove. (objc_catch_prefix, objc_catch_clause, objc_opt_catch_list): New. (objc_try_catch_clause, objc_finally_clause): New. (objc_try_catch_stmt): Rewrite. * c-tree.h (c_eh_initialized_p): Declare. * c-opt (fobjc-sjlj-exceptions): New. * except.c (output_function_exception_table): Don't call cgraph on non-decls. * objc/objc-act.c (UTAG_EXCDATA_VAR, UTAG_CAUGHTEXC_VAR, UTAG_RETHROWEXC_VAR, UTAG_EVALONCE_VAR, struct val_stack, catch_count_stack, exc_binding_stack, if_nesting_count, blk_nesting_count, objc_enter_block, objc_exit_block, objc_declare_variable, 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): Remove. (objc_create_temporary_var, struct objc_try_context, cur_try_context, objc_eh_runtime_type, objc_init_exceptions, objc_build_exc_ptr, next_sjlj_build_try_exit, next_sjlj_build_enter_and_setjmp, next_sjlj_build_exc_extract, next_sjlj_build_catch_list, next_sjlj_build_try_catch_finally, objc_begin_try_stmt, objc_begin_catch_clause, objc_finish_catch_clause, objc_build_finally_clause, objc_finish_try_stmt, objc_build_synchronized): New. (objc_is_object_id, objc_is_class_id): New. (objc_comptypes): Use them. (build_next_objc_exception_stuff): Break NeXT sjlj out from build_objc_exception_stuff. (synth_module_prologue): Update to match. (objc_build_throw_stmt): Use cur_try_context to decide if we're in a @catch. * objc/objc-act.h: Update prototypes. (OCTI_EXCEPTION_BLK_STACK, objc_exception_block_stack): Remove. testsuite/ * objc.dg/sync-1.m: New. * objc.dg/try-catch-1.m: Don't force next runtime. * objc.dg/try-catch-3.m, objc.dg/try-catch-4.m: Likewise. * objc.dg/try-catch-2.m: Likewise. Enable everywhere. Remove shadowed catch clause. * objc.dg/try-catch-5.m: New. From-SVN: r83332
2004-06-18 03:20:53 +02:00
/* Called just after parsing the closing brace of a @catch clause. Close
the open binding level, and record a CATCH_EXPR for it. */
c-common.c (flag_objc_sjlj_exceptions): New. * c-common.c (flag_objc_sjlj_exceptions): New. * c-common.h (flag_objc_sjlj_exceptions): Declare. * c-opts.c (c_common_handle_option): Set it. (c_common_post_options): Handle interation of different objective-c exception and runtime switches. * c-decl.c (c_eh_initialized_p): New. (finish_decl): Use it instead of local eh_initialized_p. * c-parse.in (nested_function, notype_nested_function): Record the result of compstmt. (compstmt_or_error): Likewise. (compstmt): Don't add_stmt the result. (stmt): Don't return anything. Rewrite objc try and sync rules. (objc_try_stmt, objc_catch_list): Remove. (objc_catch_block, objc_finally_block): Remove. (objc_catch_prefix, objc_catch_clause, objc_opt_catch_list): New. (objc_try_catch_clause, objc_finally_clause): New. (objc_try_catch_stmt): Rewrite. * c-tree.h (c_eh_initialized_p): Declare. * c-opt (fobjc-sjlj-exceptions): New. * except.c (output_function_exception_table): Don't call cgraph on non-decls. * objc/objc-act.c (UTAG_EXCDATA_VAR, UTAG_CAUGHTEXC_VAR, UTAG_RETHROWEXC_VAR, UTAG_EVALONCE_VAR, struct val_stack, catch_count_stack, exc_binding_stack, if_nesting_count, blk_nesting_count, objc_enter_block, objc_exit_block, objc_declare_variable, 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): Remove. (objc_create_temporary_var, struct objc_try_context, cur_try_context, objc_eh_runtime_type, objc_init_exceptions, objc_build_exc_ptr, next_sjlj_build_try_exit, next_sjlj_build_enter_and_setjmp, next_sjlj_build_exc_extract, next_sjlj_build_catch_list, next_sjlj_build_try_catch_finally, objc_begin_try_stmt, objc_begin_catch_clause, objc_finish_catch_clause, objc_build_finally_clause, objc_finish_try_stmt, objc_build_synchronized): New. (objc_is_object_id, objc_is_class_id): New. (objc_comptypes): Use them. (build_next_objc_exception_stuff): Break NeXT sjlj out from build_objc_exception_stuff. (synth_module_prologue): Update to match. (objc_build_throw_stmt): Use cur_try_context to decide if we're in a @catch. * objc/objc-act.h: Update prototypes. (OCTI_EXCEPTION_BLK_STACK, objc_exception_block_stack): Remove. testsuite/ * objc.dg/sync-1.m: New. * objc.dg/try-catch-1.m: Don't force next runtime. * objc.dg/try-catch-3.m, objc.dg/try-catch-4.m: Likewise. * objc.dg/try-catch-2.m: Likewise. Enable everywhere. Remove shadowed catch clause. * objc.dg/try-catch-5.m: New. From-SVN: r83332
2004-06-18 03:20:53 +02:00
void
objc_finish_catch_clause (void)
{
tree c = cur_try_context->current_catch;
cur_try_context->current_catch = NULL;
cur_try_context->end_catch_locus = input_location;
c-common.c (flag_objc_sjlj_exceptions): New. * c-common.c (flag_objc_sjlj_exceptions): New. * c-common.h (flag_objc_sjlj_exceptions): Declare. * c-opts.c (c_common_handle_option): Set it. (c_common_post_options): Handle interation of different objective-c exception and runtime switches. * c-decl.c (c_eh_initialized_p): New. (finish_decl): Use it instead of local eh_initialized_p. * c-parse.in (nested_function, notype_nested_function): Record the result of compstmt. (compstmt_or_error): Likewise. (compstmt): Don't add_stmt the result. (stmt): Don't return anything. Rewrite objc try and sync rules. (objc_try_stmt, objc_catch_list): Remove. (objc_catch_block, objc_finally_block): Remove. (objc_catch_prefix, objc_catch_clause, objc_opt_catch_list): New. (objc_try_catch_clause, objc_finally_clause): New. (objc_try_catch_stmt): Rewrite. * c-tree.h (c_eh_initialized_p): Declare. * c-opt (fobjc-sjlj-exceptions): New. * except.c (output_function_exception_table): Don't call cgraph on non-decls. * objc/objc-act.c (UTAG_EXCDATA_VAR, UTAG_CAUGHTEXC_VAR, UTAG_RETHROWEXC_VAR, UTAG_EVALONCE_VAR, struct val_stack, catch_count_stack, exc_binding_stack, if_nesting_count, blk_nesting_count, objc_enter_block, objc_exit_block, objc_declare_variable, 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): Remove. (objc_create_temporary_var, struct objc_try_context, cur_try_context, objc_eh_runtime_type, objc_init_exceptions, objc_build_exc_ptr, next_sjlj_build_try_exit, next_sjlj_build_enter_and_setjmp, next_sjlj_build_exc_extract, next_sjlj_build_catch_list, next_sjlj_build_try_catch_finally, objc_begin_try_stmt, objc_begin_catch_clause, objc_finish_catch_clause, objc_build_finally_clause, objc_finish_try_stmt, objc_build_synchronized): New. (objc_is_object_id, objc_is_class_id): New. (objc_comptypes): Use them. (build_next_objc_exception_stuff): Break NeXT sjlj out from build_objc_exception_stuff. (synth_module_prologue): Update to match. (objc_build_throw_stmt): Use cur_try_context to decide if we're in a @catch. * objc/objc-act.h: Update prototypes. (OCTI_EXCEPTION_BLK_STACK, objc_exception_block_stack): Remove. testsuite/ * objc.dg/sync-1.m: New. * objc.dg/try-catch-1.m: Don't force next runtime. * objc.dg/try-catch-3.m, objc.dg/try-catch-4.m: Likewise. * objc.dg/try-catch-2.m: Likewise. Enable everywhere. Remove shadowed catch clause. * objc.dg/try-catch-5.m: New. From-SVN: r83332
2004-06-18 03:20:53 +02:00
CATCH_BODY (c) = c_end_compound_stmt (CATCH_BODY (c), 1);
append_to_statement_list (c, &cur_try_context->catch_list);
}
c-common.c (flag_objc_sjlj_exceptions): New. * c-common.c (flag_objc_sjlj_exceptions): New. * c-common.h (flag_objc_sjlj_exceptions): Declare. * c-opts.c (c_common_handle_option): Set it. (c_common_post_options): Handle interation of different objective-c exception and runtime switches. * c-decl.c (c_eh_initialized_p): New. (finish_decl): Use it instead of local eh_initialized_p. * c-parse.in (nested_function, notype_nested_function): Record the result of compstmt. (compstmt_or_error): Likewise. (compstmt): Don't add_stmt the result. (stmt): Don't return anything. Rewrite objc try and sync rules. (objc_try_stmt, objc_catch_list): Remove. (objc_catch_block, objc_finally_block): Remove. (objc_catch_prefix, objc_catch_clause, objc_opt_catch_list): New. (objc_try_catch_clause, objc_finally_clause): New. (objc_try_catch_stmt): Rewrite. * c-tree.h (c_eh_initialized_p): Declare. * c-opt (fobjc-sjlj-exceptions): New. * except.c (output_function_exception_table): Don't call cgraph on non-decls. * objc/objc-act.c (UTAG_EXCDATA_VAR, UTAG_CAUGHTEXC_VAR, UTAG_RETHROWEXC_VAR, UTAG_EVALONCE_VAR, struct val_stack, catch_count_stack, exc_binding_stack, if_nesting_count, blk_nesting_count, objc_enter_block, objc_exit_block, objc_declare_variable, 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): Remove. (objc_create_temporary_var, struct objc_try_context, cur_try_context, objc_eh_runtime_type, objc_init_exceptions, objc_build_exc_ptr, next_sjlj_build_try_exit, next_sjlj_build_enter_and_setjmp, next_sjlj_build_exc_extract, next_sjlj_build_catch_list, next_sjlj_build_try_catch_finally, objc_begin_try_stmt, objc_begin_catch_clause, objc_finish_catch_clause, objc_build_finally_clause, objc_finish_try_stmt, objc_build_synchronized): New. (objc_is_object_id, objc_is_class_id): New. (objc_comptypes): Use them. (build_next_objc_exception_stuff): Break NeXT sjlj out from build_objc_exception_stuff. (synth_module_prologue): Update to match. (objc_build_throw_stmt): Use cur_try_context to decide if we're in a @catch. * objc/objc-act.h: Update prototypes. (OCTI_EXCEPTION_BLK_STACK, objc_exception_block_stack): Remove. testsuite/ * objc.dg/sync-1.m: New. * objc.dg/try-catch-1.m: Don't force next runtime. * objc.dg/try-catch-3.m, objc.dg/try-catch-4.m: Likewise. * objc.dg/try-catch-2.m: Likewise. Enable everywhere. Remove shadowed catch clause. * objc.dg/try-catch-5.m: New. From-SVN: r83332
2004-06-18 03:20:53 +02:00
/* Called after parsing a @finally clause and its associated BODY.
Record the body for later placement. */
c-common.c (flag_objc_sjlj_exceptions): New. * c-common.c (flag_objc_sjlj_exceptions): New. * c-common.h (flag_objc_sjlj_exceptions): Declare. * c-opts.c (c_common_handle_option): Set it. (c_common_post_options): Handle interation of different objective-c exception and runtime switches. * c-decl.c (c_eh_initialized_p): New. (finish_decl): Use it instead of local eh_initialized_p. * c-parse.in (nested_function, notype_nested_function): Record the result of compstmt. (compstmt_or_error): Likewise. (compstmt): Don't add_stmt the result. (stmt): Don't return anything. Rewrite objc try and sync rules. (objc_try_stmt, objc_catch_list): Remove. (objc_catch_block, objc_finally_block): Remove. (objc_catch_prefix, objc_catch_clause, objc_opt_catch_list): New. (objc_try_catch_clause, objc_finally_clause): New. (objc_try_catch_stmt): Rewrite. * c-tree.h (c_eh_initialized_p): Declare. * c-opt (fobjc-sjlj-exceptions): New. * except.c (output_function_exception_table): Don't call cgraph on non-decls. * objc/objc-act.c (UTAG_EXCDATA_VAR, UTAG_CAUGHTEXC_VAR, UTAG_RETHROWEXC_VAR, UTAG_EVALONCE_VAR, struct val_stack, catch_count_stack, exc_binding_stack, if_nesting_count, blk_nesting_count, objc_enter_block, objc_exit_block, objc_declare_variable, 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): Remove. (objc_create_temporary_var, struct objc_try_context, cur_try_context, objc_eh_runtime_type, objc_init_exceptions, objc_build_exc_ptr, next_sjlj_build_try_exit, next_sjlj_build_enter_and_setjmp, next_sjlj_build_exc_extract, next_sjlj_build_catch_list, next_sjlj_build_try_catch_finally, objc_begin_try_stmt, objc_begin_catch_clause, objc_finish_catch_clause, objc_build_finally_clause, objc_finish_try_stmt, objc_build_synchronized): New. (objc_is_object_id, objc_is_class_id): New. (objc_comptypes): Use them. (build_next_objc_exception_stuff): Break NeXT sjlj out from build_objc_exception_stuff. (synth_module_prologue): Update to match. (objc_build_throw_stmt): Use cur_try_context to decide if we're in a @catch. * objc/objc-act.h: Update prototypes. (OCTI_EXCEPTION_BLK_STACK, objc_exception_block_stack): Remove. testsuite/ * objc.dg/sync-1.m: New. * objc.dg/try-catch-1.m: Don't force next runtime. * objc.dg/try-catch-3.m, objc.dg/try-catch-4.m: Likewise. * objc.dg/try-catch-2.m: Likewise. Enable everywhere. Remove shadowed catch clause. * objc.dg/try-catch-5.m: New. From-SVN: r83332
2004-06-18 03:20:53 +02:00
void
objc_build_finally_clause (location_t finally_locus, tree body)
{
cur_try_context->finally_body = body;
cur_try_context->finally_locus = finally_locus;
cur_try_context->end_finally_locus = input_location;
}
c-common.c (flag_objc_sjlj_exceptions): New. * c-common.c (flag_objc_sjlj_exceptions): New. * c-common.h (flag_objc_sjlj_exceptions): Declare. * c-opts.c (c_common_handle_option): Set it. (c_common_post_options): Handle interation of different objective-c exception and runtime switches. * c-decl.c (c_eh_initialized_p): New. (finish_decl): Use it instead of local eh_initialized_p. * c-parse.in (nested_function, notype_nested_function): Record the result of compstmt. (compstmt_or_error): Likewise. (compstmt): Don't add_stmt the result. (stmt): Don't return anything. Rewrite objc try and sync rules. (objc_try_stmt, objc_catch_list): Remove. (objc_catch_block, objc_finally_block): Remove. (objc_catch_prefix, objc_catch_clause, objc_opt_catch_list): New. (objc_try_catch_clause, objc_finally_clause): New. (objc_try_catch_stmt): Rewrite. * c-tree.h (c_eh_initialized_p): Declare. * c-opt (fobjc-sjlj-exceptions): New. * except.c (output_function_exception_table): Don't call cgraph on non-decls. * objc/objc-act.c (UTAG_EXCDATA_VAR, UTAG_CAUGHTEXC_VAR, UTAG_RETHROWEXC_VAR, UTAG_EVALONCE_VAR, struct val_stack, catch_count_stack, exc_binding_stack, if_nesting_count, blk_nesting_count, objc_enter_block, objc_exit_block, objc_declare_variable, 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): Remove. (objc_create_temporary_var, struct objc_try_context, cur_try_context, objc_eh_runtime_type, objc_init_exceptions, objc_build_exc_ptr, next_sjlj_build_try_exit, next_sjlj_build_enter_and_setjmp, next_sjlj_build_exc_extract, next_sjlj_build_catch_list, next_sjlj_build_try_catch_finally, objc_begin_try_stmt, objc_begin_catch_clause, objc_finish_catch_clause, objc_build_finally_clause, objc_finish_try_stmt, objc_build_synchronized): New. (objc_is_object_id, objc_is_class_id): New. (objc_comptypes): Use them. (build_next_objc_exception_stuff): Break NeXT sjlj out from build_objc_exception_stuff. (synth_module_prologue): Update to match. (objc_build_throw_stmt): Use cur_try_context to decide if we're in a @catch. * objc/objc-act.h: Update prototypes. (OCTI_EXCEPTION_BLK_STACK, objc_exception_block_stack): Remove. testsuite/ * objc.dg/sync-1.m: New. * objc.dg/try-catch-1.m: Don't force next runtime. * objc.dg/try-catch-3.m, objc.dg/try-catch-4.m: Likewise. * objc.dg/try-catch-2.m: Likewise. Enable everywhere. Remove shadowed catch clause. * objc.dg/try-catch-5.m: New. From-SVN: r83332
2004-06-18 03:20:53 +02:00
/* Called to finalize a @try construct. */
Yet more Objective-C++... * objc-act.c (objc_finish_try_stmt): Add return value. (objc_build_synchronized): Likewise. * objc-act.c (objc_is_gcable_type): Add. (objc_substitute_decl): Add. (objc_build_ivar_assignment): Add. (objc_build_global_assignment): Add. (objc_build_strong_cast_assignment): Add. (objc_is_ivar_reference_p): Add. (objc_is_global_reference_p): Add. (objc_generate_write_barrier): Add. (objc_rewrite_function_call): Add. (objc_gimplify_expr): Add Objective-C++ support. * objc-act.h (ALLOC_OBJC_TYPE_LANG_SPECIFIC): Likewise. (SIZEOF_OBJC_TYPE_LANG_SPECIFIC): Add. (INIT_TYPE_OBJC_INFO): Add Objective-C++ support. (DUP_TYPE_OBJC_INFO): Likewise. (struct imp_entry): Add field has_cxx_cdtors. (struct imp_entry *imp_list): Add OCTI_UMSG_FAST_DECL, OCTI_METH_LIST_TEMPL, OCTI_METH_PROTO_LIST_TEMPL, OCTI_IVAR_LIST_TEMPL, OCTI_ASSIGN_IVAR_DECL, OCTI_ASSIGN_IVAR_FAST_DECL, OCTI_ASSIGN_GLOBAL_DECL, OCTI_ASSIGN_STRONGCAST_DECL. (umsg_fast_decl): Add. (objc_assign_ivar_decl): Add. (objc_assign_ivar_fast_decl): Add. (objc_assign_global_decl): Add. (objc_assign_strong_cast_decl): Add. (objc_method_list_ptr): Add. (objc_method_proto_list_ptr): Add. (objc_ivar_list_ptr): Add. * objc-act.c (should_call_super_dealloc): Add. (OBJC_VERSION): Bump to 6. (objc_is_gcable_type): Add. (objc_substitute_decl): Add. (objc_build_ivar_assignment): Add. (objc_build_global_assignment): Add. (objc_build_strong_cast_assignment): Add. (objc_is_gcable_p): Add. (objc_is_ivar_reference_p): Add. (objc_is_global_reference_p): Add. (generate_shared_structures): Add flags parameter. (objc_generate_cxx_ctor_or_dtor): Add. (objc_generate_cxx_cdtors): Add. (add_class): Add name parameter. (objc_types_share_size_and_alignment): Add. (comp_proto_with_proto): Add strict parameter. (CLS_HAS_CXX_STRUCTORS): Add. (TAG_ASSIGNIVAR): Add. (TAG_ASSIGNGLOBAL): Add. (TAG_ASSIGNSTRONGCAST): Add. (TAG_MSGSEND_FAST): Add. (TAG_ASSIGNIVAR_FAST): Add. (TAG_CXX_CONSTRUCT): Add. (TAG_CXX_DESTRUCT): Add. (OBJC_LOOKUP_CLASS): Add. (OBJC_LOOKUP_NO_SUPER): Add. (objc_finish_file): Add pch support. (objc_finish_implementation): Add Objective-C++ support. (synth_module_prologue): Likewise. (synth_module_prologue): Add fast dispatching. (objc_get_class_reference): Add Objective-C++ support. (objc_generate_write_barrier): Likewise. (next_sjlj_build_enter_and_setjmp): Likewise. (objc_begin_try_stmt): Likewise. (build_next_objc_exception_stuff): Add fast ivar support. (build_private_template): Mark the record as used so debug information is generated. (build_protocol_template): Add Objective-C++ support. (objc_method_parm_type) Likewise. (objc_generate_cxx_ctor_or_dtor): Likewise. (objc_generate_cxx_cdtors): Likewise. (build_protocol_initializer): Likewise. (build_category_template): Likewise. (build_class_template): Likewise. (build_method_list_template): Likewise. (build_category_initializer): Likewise. (build_shared_structure_initializer): Likewise. (objc_finish_message_expr): Likewise. (build_objc_method_call): Add fast dispatch support. (lookup_method_static): Add support to end search at superclasses. (add_method_to_hash_list): Add strict parameter to comp_proto_with_proto. (objc_add_method): Likewise. (objc_add_method): Also set the interface_value. (add_instance_variable): Add Objective-C++ support. (objc_is_public): Likewise. (start_class): Likewise. (continue_class): Likewise. (encode_aggregate_within): Likewise. (start_method_def): Likewise. (objc_start_function): Clear current_function_returns_value and current_function_returns_null. (really_start_method): Add Objective-C++ support. (objc_finish_method_definition): Add warning for missing [super dealloc]. (finish_objc): Add Objective-C++ support. (generate_objc_image_info): Likewise. (objc_lookup_ivar): Likewise. * objc-act.h (TYPE_HAS_OBJC_INFO): Likewise. (INIT_TYPE_OBJC_INFO): Likewise. (DUP_TYPE_OBJC_INFO): Likewise. From-SVN: r99857
2005-05-17 22:07:08 +02:00
tree
c-common.c (flag_objc_sjlj_exceptions): New. * c-common.c (flag_objc_sjlj_exceptions): New. * c-common.h (flag_objc_sjlj_exceptions): Declare. * c-opts.c (c_common_handle_option): Set it. (c_common_post_options): Handle interation of different objective-c exception and runtime switches. * c-decl.c (c_eh_initialized_p): New. (finish_decl): Use it instead of local eh_initialized_p. * c-parse.in (nested_function, notype_nested_function): Record the result of compstmt. (compstmt_or_error): Likewise. (compstmt): Don't add_stmt the result. (stmt): Don't return anything. Rewrite objc try and sync rules. (objc_try_stmt, objc_catch_list): Remove. (objc_catch_block, objc_finally_block): Remove. (objc_catch_prefix, objc_catch_clause, objc_opt_catch_list): New. (objc_try_catch_clause, objc_finally_clause): New. (objc_try_catch_stmt): Rewrite. * c-tree.h (c_eh_initialized_p): Declare. * c-opt (fobjc-sjlj-exceptions): New. * except.c (output_function_exception_table): Don't call cgraph on non-decls. * objc/objc-act.c (UTAG_EXCDATA_VAR, UTAG_CAUGHTEXC_VAR, UTAG_RETHROWEXC_VAR, UTAG_EVALONCE_VAR, struct val_stack, catch_count_stack, exc_binding_stack, if_nesting_count, blk_nesting_count, objc_enter_block, objc_exit_block, objc_declare_variable, 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): Remove. (objc_create_temporary_var, struct objc_try_context, cur_try_context, objc_eh_runtime_type, objc_init_exceptions, objc_build_exc_ptr, next_sjlj_build_try_exit, next_sjlj_build_enter_and_setjmp, next_sjlj_build_exc_extract, next_sjlj_build_catch_list, next_sjlj_build_try_catch_finally, objc_begin_try_stmt, objc_begin_catch_clause, objc_finish_catch_clause, objc_build_finally_clause, objc_finish_try_stmt, objc_build_synchronized): New. (objc_is_object_id, objc_is_class_id): New. (objc_comptypes): Use them. (build_next_objc_exception_stuff): Break NeXT sjlj out from build_objc_exception_stuff. (synth_module_prologue): Update to match. (objc_build_throw_stmt): Use cur_try_context to decide if we're in a @catch. * objc/objc-act.h: Update prototypes. (OCTI_EXCEPTION_BLK_STACK, objc_exception_block_stack): Remove. testsuite/ * objc.dg/sync-1.m: New. * objc.dg/try-catch-1.m: Don't force next runtime. * objc.dg/try-catch-3.m, objc.dg/try-catch-4.m: Likewise. * objc.dg/try-catch-2.m: Likewise. Enable everywhere. Remove shadowed catch clause. * objc.dg/try-catch-5.m: New. From-SVN: r83332
2004-06-18 03:20:53 +02:00
objc_finish_try_stmt (void)
{
struct objc_try_context *c = cur_try_context;
tree stmt;
if (c->catch_list == NULL && c->finally_body == NULL)
builtins.c, [...]: Avoid "`" as left quote, using "'" or %q, %< and %> as appropriate. * builtins.c, c-common.c, c-decl.c, c-format.c, c-format.h, c-parse.in, c-pch.c, c-pragma.c, collect2.c, final.c, gcc.c, gcov.c, opts.c, pretty-print.h, protoize.c, reg-stack.c, rtl.c, tlink.c, config/alpha/alpha.c, config/arc/arc.c, config/arm/arm.c, config/avr/avr.c, config/c4x/c4x.c, config/darwin.c, config/frv/frv.c, config/h8300/h8300.c, config/i386/i386.c, config/i386/winnt.c, config/ia64/ia64.c, config/ip2k/ip2k.c, config/iq2000/iq2000.c, config/m32r/m32r.c, config/m68hc11/m68hc11.c, config/m68k/m68k.c, config/m68k/m68k.h, config/mcore/mcore.c, config/mips/mips.c, config/mmix/mmix.c, config/ns32k/ns32k.c, config/rs6000/host-darwin.c, config/rs6000/rs6000.c, config/s390/s390.c, config/sh/sh.c, config/sh/symbian.c, config/stormy16/stormy16.c, config/v850/v850.c: Avoid "`" as left quote, using "'" or %q, %< and %> as appropriate. Use %' as apostrophe in diagnostics where applicable. Use %< and %> in place of '' quotes where applicable. Use %qs in place of %<%s%>. Consistently quote __builtin function names. ada: * misc.c (gnat_handle_option): Use %< and %> for quoting in warning message. cp: * call.c, class.c, decl.c, decl2.c, error.c, mangle.c, parser.c, pt.c, search.c, semantics.c, typeck.c: Use %q, %< and %> for quoting in diagnostics. * parser.c (cp_parser_sizeof_operand): Use '' instead of `' for quoting in printf format. * decl.c (duplicate_decls, start_decl): Use %qD instead of unquoted %D. objc: * objc-act.c: Use %q, %< and %> for quoting in diagnostics. testsuite: * gcc.dg/builtin-prefetch-1.c: Adjust expected messages. From-SVN: r90337
2004-11-09 11:13:30 +01:00
error ("%<@try%> without %<@catch%> or %<@finally%>");
c-common.c (flag_objc_sjlj_exceptions): New. * c-common.c (flag_objc_sjlj_exceptions): New. * c-common.h (flag_objc_sjlj_exceptions): Declare. * c-opts.c (c_common_handle_option): Set it. (c_common_post_options): Handle interation of different objective-c exception and runtime switches. * c-decl.c (c_eh_initialized_p): New. (finish_decl): Use it instead of local eh_initialized_p. * c-parse.in (nested_function, notype_nested_function): Record the result of compstmt. (compstmt_or_error): Likewise. (compstmt): Don't add_stmt the result. (stmt): Don't return anything. Rewrite objc try and sync rules. (objc_try_stmt, objc_catch_list): Remove. (objc_catch_block, objc_finally_block): Remove. (objc_catch_prefix, objc_catch_clause, objc_opt_catch_list): New. (objc_try_catch_clause, objc_finally_clause): New. (objc_try_catch_stmt): Rewrite. * c-tree.h (c_eh_initialized_p): Declare. * c-opt (fobjc-sjlj-exceptions): New. * except.c (output_function_exception_table): Don't call cgraph on non-decls. * objc/objc-act.c (UTAG_EXCDATA_VAR, UTAG_CAUGHTEXC_VAR, UTAG_RETHROWEXC_VAR, UTAG_EVALONCE_VAR, struct val_stack, catch_count_stack, exc_binding_stack, if_nesting_count, blk_nesting_count, objc_enter_block, objc_exit_block, objc_declare_variable, 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): Remove. (objc_create_temporary_var, struct objc_try_context, cur_try_context, objc_eh_runtime_type, objc_init_exceptions, objc_build_exc_ptr, next_sjlj_build_try_exit, next_sjlj_build_enter_and_setjmp, next_sjlj_build_exc_extract, next_sjlj_build_catch_list, next_sjlj_build_try_catch_finally, objc_begin_try_stmt, objc_begin_catch_clause, objc_finish_catch_clause, objc_build_finally_clause, objc_finish_try_stmt, objc_build_synchronized): New. (objc_is_object_id, objc_is_class_id): New. (objc_comptypes): Use them. (build_next_objc_exception_stuff): Break NeXT sjlj out from build_objc_exception_stuff. (synth_module_prologue): Update to match. (objc_build_throw_stmt): Use cur_try_context to decide if we're in a @catch. * objc/objc-act.h: Update prototypes. (OCTI_EXCEPTION_BLK_STACK, objc_exception_block_stack): Remove. testsuite/ * objc.dg/sync-1.m: New. * objc.dg/try-catch-1.m: Don't force next runtime. * objc.dg/try-catch-3.m, objc.dg/try-catch-4.m: Likewise. * objc.dg/try-catch-2.m: Likewise. Enable everywhere. Remove shadowed catch clause. * objc.dg/try-catch-5.m: New. From-SVN: r83332
2004-06-18 03:20:53 +02:00
/* If we're doing Darwin setjmp exceptions, build the big nasty. */
if (flag_objc_sjlj_exceptions)
{
if (!cur_try_context->finally_body)
{
cur_try_context->finally_locus = input_location;
cur_try_context->end_finally_locus = input_location;
}
stmt = next_sjlj_build_try_catch_finally ();
}
else
{
/* Otherwise, nest the CATCH inside a FINALLY. */
stmt = c->try_body;
if (c->catch_list)
{
stmt = build_stmt (TRY_CATCH_EXPR, stmt, c->catch_list);
SET_EXPR_LOCATION (stmt, cur_try_context->try_locus);
c-common.c (flag_objc_sjlj_exceptions): New. * c-common.c (flag_objc_sjlj_exceptions): New. * c-common.h (flag_objc_sjlj_exceptions): Declare. * c-opts.c (c_common_handle_option): Set it. (c_common_post_options): Handle interation of different objective-c exception and runtime switches. * c-decl.c (c_eh_initialized_p): New. (finish_decl): Use it instead of local eh_initialized_p. * c-parse.in (nested_function, notype_nested_function): Record the result of compstmt. (compstmt_or_error): Likewise. (compstmt): Don't add_stmt the result. (stmt): Don't return anything. Rewrite objc try and sync rules. (objc_try_stmt, objc_catch_list): Remove. (objc_catch_block, objc_finally_block): Remove. (objc_catch_prefix, objc_catch_clause, objc_opt_catch_list): New. (objc_try_catch_clause, objc_finally_clause): New. (objc_try_catch_stmt): Rewrite. * c-tree.h (c_eh_initialized_p): Declare. * c-opt (fobjc-sjlj-exceptions): New. * except.c (output_function_exception_table): Don't call cgraph on non-decls. * objc/objc-act.c (UTAG_EXCDATA_VAR, UTAG_CAUGHTEXC_VAR, UTAG_RETHROWEXC_VAR, UTAG_EVALONCE_VAR, struct val_stack, catch_count_stack, exc_binding_stack, if_nesting_count, blk_nesting_count, objc_enter_block, objc_exit_block, objc_declare_variable, 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): Remove. (objc_create_temporary_var, struct objc_try_context, cur_try_context, objc_eh_runtime_type, objc_init_exceptions, objc_build_exc_ptr, next_sjlj_build_try_exit, next_sjlj_build_enter_and_setjmp, next_sjlj_build_exc_extract, next_sjlj_build_catch_list, next_sjlj_build_try_catch_finally, objc_begin_try_stmt, objc_begin_catch_clause, objc_finish_catch_clause, objc_build_finally_clause, objc_finish_try_stmt, objc_build_synchronized): New. (objc_is_object_id, objc_is_class_id): New. (objc_comptypes): Use them. (build_next_objc_exception_stuff): Break NeXT sjlj out from build_objc_exception_stuff. (synth_module_prologue): Update to match. (objc_build_throw_stmt): Use cur_try_context to decide if we're in a @catch. * objc/objc-act.h: Update prototypes. (OCTI_EXCEPTION_BLK_STACK, objc_exception_block_stack): Remove. testsuite/ * objc.dg/sync-1.m: New. * objc.dg/try-catch-1.m: Don't force next runtime. * objc.dg/try-catch-3.m, objc.dg/try-catch-4.m: Likewise. * objc.dg/try-catch-2.m: Likewise. Enable everywhere. Remove shadowed catch clause. * objc.dg/try-catch-5.m: New. From-SVN: r83332
2004-06-18 03:20:53 +02:00
}
if (c->finally_body)
{
stmt = build_stmt (TRY_FINALLY_EXPR, stmt, c->finally_body);
SET_EXPR_LOCATION (stmt, cur_try_context->try_locus);
c-common.c (flag_objc_sjlj_exceptions): New. * c-common.c (flag_objc_sjlj_exceptions): New. * c-common.h (flag_objc_sjlj_exceptions): Declare. * c-opts.c (c_common_handle_option): Set it. (c_common_post_options): Handle interation of different objective-c exception and runtime switches. * c-decl.c (c_eh_initialized_p): New. (finish_decl): Use it instead of local eh_initialized_p. * c-parse.in (nested_function, notype_nested_function): Record the result of compstmt. (compstmt_or_error): Likewise. (compstmt): Don't add_stmt the result. (stmt): Don't return anything. Rewrite objc try and sync rules. (objc_try_stmt, objc_catch_list): Remove. (objc_catch_block, objc_finally_block): Remove. (objc_catch_prefix, objc_catch_clause, objc_opt_catch_list): New. (objc_try_catch_clause, objc_finally_clause): New. (objc_try_catch_stmt): Rewrite. * c-tree.h (c_eh_initialized_p): Declare. * c-opt (fobjc-sjlj-exceptions): New. * except.c (output_function_exception_table): Don't call cgraph on non-decls. * objc/objc-act.c (UTAG_EXCDATA_VAR, UTAG_CAUGHTEXC_VAR, UTAG_RETHROWEXC_VAR, UTAG_EVALONCE_VAR, struct val_stack, catch_count_stack, exc_binding_stack, if_nesting_count, blk_nesting_count, objc_enter_block, objc_exit_block, objc_declare_variable, 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): Remove. (objc_create_temporary_var, struct objc_try_context, cur_try_context, objc_eh_runtime_type, objc_init_exceptions, objc_build_exc_ptr, next_sjlj_build_try_exit, next_sjlj_build_enter_and_setjmp, next_sjlj_build_exc_extract, next_sjlj_build_catch_list, next_sjlj_build_try_catch_finally, objc_begin_try_stmt, objc_begin_catch_clause, objc_finish_catch_clause, objc_build_finally_clause, objc_finish_try_stmt, objc_build_synchronized): New. (objc_is_object_id, objc_is_class_id): New. (objc_comptypes): Use them. (build_next_objc_exception_stuff): Break NeXT sjlj out from build_objc_exception_stuff. (synth_module_prologue): Update to match. (objc_build_throw_stmt): Use cur_try_context to decide if we're in a @catch. * objc/objc-act.h: Update prototypes. (OCTI_EXCEPTION_BLK_STACK, objc_exception_block_stack): Remove. testsuite/ * objc.dg/sync-1.m: New. * objc.dg/try-catch-1.m: Don't force next runtime. * objc.dg/try-catch-3.m, objc.dg/try-catch-4.m: Likewise. * objc.dg/try-catch-2.m: Likewise. Enable everywhere. Remove shadowed catch clause. * objc.dg/try-catch-5.m: New. From-SVN: r83332
2004-06-18 03:20:53 +02:00
}
}
add_stmt (stmt);
cur_try_context = c->outer;
free (c);
Yet more Objective-C++... * objc-act.c (objc_finish_try_stmt): Add return value. (objc_build_synchronized): Likewise. * objc-act.c (objc_is_gcable_type): Add. (objc_substitute_decl): Add. (objc_build_ivar_assignment): Add. (objc_build_global_assignment): Add. (objc_build_strong_cast_assignment): Add. (objc_is_ivar_reference_p): Add. (objc_is_global_reference_p): Add. (objc_generate_write_barrier): Add. (objc_rewrite_function_call): Add. (objc_gimplify_expr): Add Objective-C++ support. * objc-act.h (ALLOC_OBJC_TYPE_LANG_SPECIFIC): Likewise. (SIZEOF_OBJC_TYPE_LANG_SPECIFIC): Add. (INIT_TYPE_OBJC_INFO): Add Objective-C++ support. (DUP_TYPE_OBJC_INFO): Likewise. (struct imp_entry): Add field has_cxx_cdtors. (struct imp_entry *imp_list): Add OCTI_UMSG_FAST_DECL, OCTI_METH_LIST_TEMPL, OCTI_METH_PROTO_LIST_TEMPL, OCTI_IVAR_LIST_TEMPL, OCTI_ASSIGN_IVAR_DECL, OCTI_ASSIGN_IVAR_FAST_DECL, OCTI_ASSIGN_GLOBAL_DECL, OCTI_ASSIGN_STRONGCAST_DECL. (umsg_fast_decl): Add. (objc_assign_ivar_decl): Add. (objc_assign_ivar_fast_decl): Add. (objc_assign_global_decl): Add. (objc_assign_strong_cast_decl): Add. (objc_method_list_ptr): Add. (objc_method_proto_list_ptr): Add. (objc_ivar_list_ptr): Add. * objc-act.c (should_call_super_dealloc): Add. (OBJC_VERSION): Bump to 6. (objc_is_gcable_type): Add. (objc_substitute_decl): Add. (objc_build_ivar_assignment): Add. (objc_build_global_assignment): Add. (objc_build_strong_cast_assignment): Add. (objc_is_gcable_p): Add. (objc_is_ivar_reference_p): Add. (objc_is_global_reference_p): Add. (generate_shared_structures): Add flags parameter. (objc_generate_cxx_ctor_or_dtor): Add. (objc_generate_cxx_cdtors): Add. (add_class): Add name parameter. (objc_types_share_size_and_alignment): Add. (comp_proto_with_proto): Add strict parameter. (CLS_HAS_CXX_STRUCTORS): Add. (TAG_ASSIGNIVAR): Add. (TAG_ASSIGNGLOBAL): Add. (TAG_ASSIGNSTRONGCAST): Add. (TAG_MSGSEND_FAST): Add. (TAG_ASSIGNIVAR_FAST): Add. (TAG_CXX_CONSTRUCT): Add. (TAG_CXX_DESTRUCT): Add. (OBJC_LOOKUP_CLASS): Add. (OBJC_LOOKUP_NO_SUPER): Add. (objc_finish_file): Add pch support. (objc_finish_implementation): Add Objective-C++ support. (synth_module_prologue): Likewise. (synth_module_prologue): Add fast dispatching. (objc_get_class_reference): Add Objective-C++ support. (objc_generate_write_barrier): Likewise. (next_sjlj_build_enter_and_setjmp): Likewise. (objc_begin_try_stmt): Likewise. (build_next_objc_exception_stuff): Add fast ivar support. (build_private_template): Mark the record as used so debug information is generated. (build_protocol_template): Add Objective-C++ support. (objc_method_parm_type) Likewise. (objc_generate_cxx_ctor_or_dtor): Likewise. (objc_generate_cxx_cdtors): Likewise. (build_protocol_initializer): Likewise. (build_category_template): Likewise. (build_class_template): Likewise. (build_method_list_template): Likewise. (build_category_initializer): Likewise. (build_shared_structure_initializer): Likewise. (objc_finish_message_expr): Likewise. (build_objc_method_call): Add fast dispatch support. (lookup_method_static): Add support to end search at superclasses. (add_method_to_hash_list): Add strict parameter to comp_proto_with_proto. (objc_add_method): Likewise. (objc_add_method): Also set the interface_value. (add_instance_variable): Add Objective-C++ support. (objc_is_public): Likewise. (start_class): Likewise. (continue_class): Likewise. (encode_aggregate_within): Likewise. (start_method_def): Likewise. (objc_start_function): Clear current_function_returns_value and current_function_returns_null. (really_start_method): Add Objective-C++ support. (objc_finish_method_definition): Add warning for missing [super dealloc]. (finish_objc): Add Objective-C++ support. (generate_objc_image_info): Likewise. (objc_lookup_ivar): Likewise. * objc-act.h (TYPE_HAS_OBJC_INFO): Likewise. (INIT_TYPE_OBJC_INFO): Likewise. (DUP_TYPE_OBJC_INFO): Likewise. From-SVN: r99857
2005-05-17 22:07:08 +02:00
return stmt;
}
c-decl.c (c_in_iteration_stmt, [...]): Remove. * c-decl.c (c_in_iteration_stmt, c_in_case_stmt): Remove. (c_break_label, c_cont_label): New. (start_function): Update initializations. (c_push_function_context): Update saves. (c_pop_function_context): Update restores. * c-parse.in: Update expected conflicts. (stmt_count, compstmt_count): Remove. Remove all updates. (if_prefix, simple_if, do_stmt_start): Remove. (lineno_labeled_stmt): Remove. (lineno_labels): New. (c99_block_lineno_labeled_stmt): Use it. (lineno_stmt, lineno_label): Don't clear EXPR_LOCUS before calling annotate_with_locus. (select_or_iter_stmt): Replace by ... (condition, if_statement_1, if_statement_2, if_statement, start_break, start_continue, while_statement, do_statement, for_cond_expr, for_incr_expr, for_statement, switch_statement): New. (stmt): Split out ... (stmt_nocomp): ... this. Use c_finish_bc_stmt, c_finish_goto_label, c_finish_goto_ptr. * c-semantics.c (add_stmt): Don't add line numbers to labels. * c-tree.h: Update prototypes. (struct language_function): Remove x_in_iteration_stmt, x_in_case_stmt; add x_break_label, x_cont_label, x_switch_stack. (c_switch_stack): Declare. * c-typeck.c (c_finish_goto_label, c_finish_goto_ptr): New. (c_finish_return): Return the statement. (c_switch_stack): Rename from switch_stack; export. (if_elt, if_stack, if_stack_space, if_stack_pointer): Remove. (c_begin_if_stmt, c_finish_if_cond, c_finish_then, c_begin_else, c_finish_else): Remove. (c_finish_if_stmt): Rewrite to perform the entire operation. (c_begin_while_stmt, c_finish_while_stmt_cond, c_finish_while_stmt, c_begin_for_stmt, c_finish_for_stmt_init, c_finish_for_stmt_cond, c_finish_for_stmt_incr, c_finish_for_stmt): Remove. (c_finish_loop): New. (c_finish_bc_stmt): New. (c_finish_expr_stmt): Return the statement. Split out... (c_process_expr_stmt): ... this. Don't add locus to error marks. * gimplify.c (gimplify_cond_expr): Accept NULL type statements. * tree-gimple.c (is_gimple_stmt): Likewise. * tree-pretty-print.c (dump_generic_node <COND_EXPR>): Likewise. (print_struct_decl): Delete empty compound statement. * objc/objc-act.c (objc_build_throw_stmt): Return the statement. * objc/objc-act.h: Update decl. From-SVN: r83620
2004-06-25 01:12:30 +02:00
tree
c-common.c (flag_objc_sjlj_exceptions): New. * c-common.c (flag_objc_sjlj_exceptions): New. * c-common.h (flag_objc_sjlj_exceptions): Declare. * c-opts.c (c_common_handle_option): Set it. (c_common_post_options): Handle interation of different objective-c exception and runtime switches. * c-decl.c (c_eh_initialized_p): New. (finish_decl): Use it instead of local eh_initialized_p. * c-parse.in (nested_function, notype_nested_function): Record the result of compstmt. (compstmt_or_error): Likewise. (compstmt): Don't add_stmt the result. (stmt): Don't return anything. Rewrite objc try and sync rules. (objc_try_stmt, objc_catch_list): Remove. (objc_catch_block, objc_finally_block): Remove. (objc_catch_prefix, objc_catch_clause, objc_opt_catch_list): New. (objc_try_catch_clause, objc_finally_clause): New. (objc_try_catch_stmt): Rewrite. * c-tree.h (c_eh_initialized_p): Declare. * c-opt (fobjc-sjlj-exceptions): New. * except.c (output_function_exception_table): Don't call cgraph on non-decls. * objc/objc-act.c (UTAG_EXCDATA_VAR, UTAG_CAUGHTEXC_VAR, UTAG_RETHROWEXC_VAR, UTAG_EVALONCE_VAR, struct val_stack, catch_count_stack, exc_binding_stack, if_nesting_count, blk_nesting_count, objc_enter_block, objc_exit_block, objc_declare_variable, 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): Remove. (objc_create_temporary_var, struct objc_try_context, cur_try_context, objc_eh_runtime_type, objc_init_exceptions, objc_build_exc_ptr, next_sjlj_build_try_exit, next_sjlj_build_enter_and_setjmp, next_sjlj_build_exc_extract, next_sjlj_build_catch_list, next_sjlj_build_try_catch_finally, objc_begin_try_stmt, objc_begin_catch_clause, objc_finish_catch_clause, objc_build_finally_clause, objc_finish_try_stmt, objc_build_synchronized): New. (objc_is_object_id, objc_is_class_id): New. (objc_comptypes): Use them. (build_next_objc_exception_stuff): Break NeXT sjlj out from build_objc_exception_stuff. (synth_module_prologue): Update to match. (objc_build_throw_stmt): Use cur_try_context to decide if we're in a @catch. * objc/objc-act.h: Update prototypes. (OCTI_EXCEPTION_BLK_STACK, objc_exception_block_stack): Remove. testsuite/ * objc.dg/sync-1.m: New. * objc.dg/try-catch-1.m: Don't force next runtime. * objc.dg/try-catch-3.m, objc.dg/try-catch-4.m: Likewise. * objc.dg/try-catch-2.m: Likewise. Enable everywhere. Remove shadowed catch clause. * objc.dg/try-catch-5.m: New. From-SVN: r83332
2004-06-18 03:20:53 +02:00
objc_build_throw_stmt (tree throw_expr)
{
c-decl.c (c_in_iteration_stmt, [...]): Remove. * c-decl.c (c_in_iteration_stmt, c_in_case_stmt): Remove. (c_break_label, c_cont_label): New. (start_function): Update initializations. (c_push_function_context): Update saves. (c_pop_function_context): Update restores. * c-parse.in: Update expected conflicts. (stmt_count, compstmt_count): Remove. Remove all updates. (if_prefix, simple_if, do_stmt_start): Remove. (lineno_labeled_stmt): Remove. (lineno_labels): New. (c99_block_lineno_labeled_stmt): Use it. (lineno_stmt, lineno_label): Don't clear EXPR_LOCUS before calling annotate_with_locus. (select_or_iter_stmt): Replace by ... (condition, if_statement_1, if_statement_2, if_statement, start_break, start_continue, while_statement, do_statement, for_cond_expr, for_incr_expr, for_statement, switch_statement): New. (stmt): Split out ... (stmt_nocomp): ... this. Use c_finish_bc_stmt, c_finish_goto_label, c_finish_goto_ptr. * c-semantics.c (add_stmt): Don't add line numbers to labels. * c-tree.h: Update prototypes. (struct language_function): Remove x_in_iteration_stmt, x_in_case_stmt; add x_break_label, x_cont_label, x_switch_stack. (c_switch_stack): Declare. * c-typeck.c (c_finish_goto_label, c_finish_goto_ptr): New. (c_finish_return): Return the statement. (c_switch_stack): Rename from switch_stack; export. (if_elt, if_stack, if_stack_space, if_stack_pointer): Remove. (c_begin_if_stmt, c_finish_if_cond, c_finish_then, c_begin_else, c_finish_else): Remove. (c_finish_if_stmt): Rewrite to perform the entire operation. (c_begin_while_stmt, c_finish_while_stmt_cond, c_finish_while_stmt, c_begin_for_stmt, c_finish_for_stmt_init, c_finish_for_stmt_cond, c_finish_for_stmt_incr, c_finish_for_stmt): Remove. (c_finish_loop): New. (c_finish_bc_stmt): New. (c_finish_expr_stmt): Return the statement. Split out... (c_process_expr_stmt): ... this. Don't add locus to error marks. * gimplify.c (gimplify_cond_expr): Accept NULL type statements. * tree-gimple.c (is_gimple_stmt): Likewise. * tree-pretty-print.c (dump_generic_node <COND_EXPR>): Likewise. (print_struct_decl): Delete empty compound statement. * objc/objc-act.c (objc_build_throw_stmt): Return the statement. * objc/objc-act.h: Update decl. From-SVN: r83620
2004-06-25 01:12:30 +02:00
tree args;
objc_init_exceptions ();
c-common.c (flag_objc_sjlj_exceptions): New. * c-common.c (flag_objc_sjlj_exceptions): New. * c-common.h (flag_objc_sjlj_exceptions): Declare. * c-opts.c (c_common_handle_option): Set it. (c_common_post_options): Handle interation of different objective-c exception and runtime switches. * c-decl.c (c_eh_initialized_p): New. (finish_decl): Use it instead of local eh_initialized_p. * c-parse.in (nested_function, notype_nested_function): Record the result of compstmt. (compstmt_or_error): Likewise. (compstmt): Don't add_stmt the result. (stmt): Don't return anything. Rewrite objc try and sync rules. (objc_try_stmt, objc_catch_list): Remove. (objc_catch_block, objc_finally_block): Remove. (objc_catch_prefix, objc_catch_clause, objc_opt_catch_list): New. (objc_try_catch_clause, objc_finally_clause): New. (objc_try_catch_stmt): Rewrite. * c-tree.h (c_eh_initialized_p): Declare. * c-opt (fobjc-sjlj-exceptions): New. * except.c (output_function_exception_table): Don't call cgraph on non-decls. * objc/objc-act.c (UTAG_EXCDATA_VAR, UTAG_CAUGHTEXC_VAR, UTAG_RETHROWEXC_VAR, UTAG_EVALONCE_VAR, struct val_stack, catch_count_stack, exc_binding_stack, if_nesting_count, blk_nesting_count, objc_enter_block, objc_exit_block, objc_declare_variable, 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): Remove. (objc_create_temporary_var, struct objc_try_context, cur_try_context, objc_eh_runtime_type, objc_init_exceptions, objc_build_exc_ptr, next_sjlj_build_try_exit, next_sjlj_build_enter_and_setjmp, next_sjlj_build_exc_extract, next_sjlj_build_catch_list, next_sjlj_build_try_catch_finally, objc_begin_try_stmt, objc_begin_catch_clause, objc_finish_catch_clause, objc_build_finally_clause, objc_finish_try_stmt, objc_build_synchronized): New. (objc_is_object_id, objc_is_class_id): New. (objc_comptypes): Use them. (build_next_objc_exception_stuff): Break NeXT sjlj out from build_objc_exception_stuff. (synth_module_prologue): Update to match. (objc_build_throw_stmt): Use cur_try_context to decide if we're in a @catch. * objc/objc-act.h: Update prototypes. (OCTI_EXCEPTION_BLK_STACK, objc_exception_block_stack): Remove. testsuite/ * objc.dg/sync-1.m: New. * objc.dg/try-catch-1.m: Don't force next runtime. * objc.dg/try-catch-3.m, objc.dg/try-catch-4.m: Likewise. * objc.dg/try-catch-2.m: Likewise. Enable everywhere. Remove shadowed catch clause. * objc.dg/try-catch-5.m: New. From-SVN: r83332
2004-06-18 03:20:53 +02:00
if (throw_expr == NULL)
{
/* If we're not inside a @catch block, there is no "current
exception" to be rethrown. */
if (cur_try_context == NULL
|| cur_try_context->current_catch == NULL)
{
error ("%<@throw%> (rethrow) used outside of a @catch block");
c-decl.c (c_in_iteration_stmt, [...]): Remove. * c-decl.c (c_in_iteration_stmt, c_in_case_stmt): Remove. (c_break_label, c_cont_label): New. (start_function): Update initializations. (c_push_function_context): Update saves. (c_pop_function_context): Update restores. * c-parse.in: Update expected conflicts. (stmt_count, compstmt_count): Remove. Remove all updates. (if_prefix, simple_if, do_stmt_start): Remove. (lineno_labeled_stmt): Remove. (lineno_labels): New. (c99_block_lineno_labeled_stmt): Use it. (lineno_stmt, lineno_label): Don't clear EXPR_LOCUS before calling annotate_with_locus. (select_or_iter_stmt): Replace by ... (condition, if_statement_1, if_statement_2, if_statement, start_break, start_continue, while_statement, do_statement, for_cond_expr, for_incr_expr, for_statement, switch_statement): New. (stmt): Split out ... (stmt_nocomp): ... this. Use c_finish_bc_stmt, c_finish_goto_label, c_finish_goto_ptr. * c-semantics.c (add_stmt): Don't add line numbers to labels. * c-tree.h: Update prototypes. (struct language_function): Remove x_in_iteration_stmt, x_in_case_stmt; add x_break_label, x_cont_label, x_switch_stack. (c_switch_stack): Declare. * c-typeck.c (c_finish_goto_label, c_finish_goto_ptr): New. (c_finish_return): Return the statement. (c_switch_stack): Rename from switch_stack; export. (if_elt, if_stack, if_stack_space, if_stack_pointer): Remove. (c_begin_if_stmt, c_finish_if_cond, c_finish_then, c_begin_else, c_finish_else): Remove. (c_finish_if_stmt): Rewrite to perform the entire operation. (c_begin_while_stmt, c_finish_while_stmt_cond, c_finish_while_stmt, c_begin_for_stmt, c_finish_for_stmt_init, c_finish_for_stmt_cond, c_finish_for_stmt_incr, c_finish_for_stmt): Remove. (c_finish_loop): New. (c_finish_bc_stmt): New. (c_finish_expr_stmt): Return the statement. Split out... (c_process_expr_stmt): ... this. Don't add locus to error marks. * gimplify.c (gimplify_cond_expr): Accept NULL type statements. * tree-gimple.c (is_gimple_stmt): Likewise. * tree-pretty-print.c (dump_generic_node <COND_EXPR>): Likewise. (print_struct_decl): Delete empty compound statement. * objc/objc-act.c (objc_build_throw_stmt): Return the statement. * objc/objc-act.h: Update decl. From-SVN: r83620
2004-06-25 01:12:30 +02:00
return NULL_TREE;
c-common.c (flag_objc_sjlj_exceptions): New. * c-common.c (flag_objc_sjlj_exceptions): New. * c-common.h (flag_objc_sjlj_exceptions): Declare. * c-opts.c (c_common_handle_option): Set it. (c_common_post_options): Handle interation of different objective-c exception and runtime switches. * c-decl.c (c_eh_initialized_p): New. (finish_decl): Use it instead of local eh_initialized_p. * c-parse.in (nested_function, notype_nested_function): Record the result of compstmt. (compstmt_or_error): Likewise. (compstmt): Don't add_stmt the result. (stmt): Don't return anything. Rewrite objc try and sync rules. (objc_try_stmt, objc_catch_list): Remove. (objc_catch_block, objc_finally_block): Remove. (objc_catch_prefix, objc_catch_clause, objc_opt_catch_list): New. (objc_try_catch_clause, objc_finally_clause): New. (objc_try_catch_stmt): Rewrite. * c-tree.h (c_eh_initialized_p): Declare. * c-opt (fobjc-sjlj-exceptions): New. * except.c (output_function_exception_table): Don't call cgraph on non-decls. * objc/objc-act.c (UTAG_EXCDATA_VAR, UTAG_CAUGHTEXC_VAR, UTAG_RETHROWEXC_VAR, UTAG_EVALONCE_VAR, struct val_stack, catch_count_stack, exc_binding_stack, if_nesting_count, blk_nesting_count, objc_enter_block, objc_exit_block, objc_declare_variable, 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): Remove. (objc_create_temporary_var, struct objc_try_context, cur_try_context, objc_eh_runtime_type, objc_init_exceptions, objc_build_exc_ptr, next_sjlj_build_try_exit, next_sjlj_build_enter_and_setjmp, next_sjlj_build_exc_extract, next_sjlj_build_catch_list, next_sjlj_build_try_catch_finally, objc_begin_try_stmt, objc_begin_catch_clause, objc_finish_catch_clause, objc_build_finally_clause, objc_finish_try_stmt, objc_build_synchronized): New. (objc_is_object_id, objc_is_class_id): New. (objc_comptypes): Use them. (build_next_objc_exception_stuff): Break NeXT sjlj out from build_objc_exception_stuff. (synth_module_prologue): Update to match. (objc_build_throw_stmt): Use cur_try_context to decide if we're in a @catch. * objc/objc-act.h: Update prototypes. (OCTI_EXCEPTION_BLK_STACK, objc_exception_block_stack): Remove. testsuite/ * objc.dg/sync-1.m: New. * objc.dg/try-catch-1.m: Don't force next runtime. * objc.dg/try-catch-3.m, objc.dg/try-catch-4.m: Likewise. * objc.dg/try-catch-2.m: Likewise. Enable everywhere. Remove shadowed catch clause. * objc.dg/try-catch-5.m: New. From-SVN: r83332
2004-06-18 03:20:53 +02:00
}
/* Otherwise the object is still sitting in the EXC_PTR_EXPR
value that we get from the runtime. */
throw_expr = objc_build_exc_ptr ();
}
/* A throw is just a call to the runtime throw function with the
object as a parameter. */
c-decl.c (c_in_iteration_stmt, [...]): Remove. * c-decl.c (c_in_iteration_stmt, c_in_case_stmt): Remove. (c_break_label, c_cont_label): New. (start_function): Update initializations. (c_push_function_context): Update saves. (c_pop_function_context): Update restores. * c-parse.in: Update expected conflicts. (stmt_count, compstmt_count): Remove. Remove all updates. (if_prefix, simple_if, do_stmt_start): Remove. (lineno_labeled_stmt): Remove. (lineno_labels): New. (c99_block_lineno_labeled_stmt): Use it. (lineno_stmt, lineno_label): Don't clear EXPR_LOCUS before calling annotate_with_locus. (select_or_iter_stmt): Replace by ... (condition, if_statement_1, if_statement_2, if_statement, start_break, start_continue, while_statement, do_statement, for_cond_expr, for_incr_expr, for_statement, switch_statement): New. (stmt): Split out ... (stmt_nocomp): ... this. Use c_finish_bc_stmt, c_finish_goto_label, c_finish_goto_ptr. * c-semantics.c (add_stmt): Don't add line numbers to labels. * c-tree.h: Update prototypes. (struct language_function): Remove x_in_iteration_stmt, x_in_case_stmt; add x_break_label, x_cont_label, x_switch_stack. (c_switch_stack): Declare. * c-typeck.c (c_finish_goto_label, c_finish_goto_ptr): New. (c_finish_return): Return the statement. (c_switch_stack): Rename from switch_stack; export. (if_elt, if_stack, if_stack_space, if_stack_pointer): Remove. (c_begin_if_stmt, c_finish_if_cond, c_finish_then, c_begin_else, c_finish_else): Remove. (c_finish_if_stmt): Rewrite to perform the entire operation. (c_begin_while_stmt, c_finish_while_stmt_cond, c_finish_while_stmt, c_begin_for_stmt, c_finish_for_stmt_init, c_finish_for_stmt_cond, c_finish_for_stmt_incr, c_finish_for_stmt): Remove. (c_finish_loop): New. (c_finish_bc_stmt): New. (c_finish_expr_stmt): Return the statement. Split out... (c_process_expr_stmt): ... this. Don't add locus to error marks. * gimplify.c (gimplify_cond_expr): Accept NULL type statements. * tree-gimple.c (is_gimple_stmt): Likewise. * tree-pretty-print.c (dump_generic_node <COND_EXPR>): Likewise. (print_struct_decl): Delete empty compound statement. * objc/objc-act.c (objc_build_throw_stmt): Return the statement. * objc/objc-act.h: Update decl. From-SVN: r83620
2004-06-25 01:12:30 +02:00
args = tree_cons (NULL, throw_expr, NULL);
return add_stmt (build_function_call (objc_exception_throw_decl, args));
}
Yet more Objective-C++... * objc-act.c (objc_finish_try_stmt): Add return value. (objc_build_synchronized): Likewise. * objc-act.c (objc_is_gcable_type): Add. (objc_substitute_decl): Add. (objc_build_ivar_assignment): Add. (objc_build_global_assignment): Add. (objc_build_strong_cast_assignment): Add. (objc_is_ivar_reference_p): Add. (objc_is_global_reference_p): Add. (objc_generate_write_barrier): Add. (objc_rewrite_function_call): Add. (objc_gimplify_expr): Add Objective-C++ support. * objc-act.h (ALLOC_OBJC_TYPE_LANG_SPECIFIC): Likewise. (SIZEOF_OBJC_TYPE_LANG_SPECIFIC): Add. (INIT_TYPE_OBJC_INFO): Add Objective-C++ support. (DUP_TYPE_OBJC_INFO): Likewise. (struct imp_entry): Add field has_cxx_cdtors. (struct imp_entry *imp_list): Add OCTI_UMSG_FAST_DECL, OCTI_METH_LIST_TEMPL, OCTI_METH_PROTO_LIST_TEMPL, OCTI_IVAR_LIST_TEMPL, OCTI_ASSIGN_IVAR_DECL, OCTI_ASSIGN_IVAR_FAST_DECL, OCTI_ASSIGN_GLOBAL_DECL, OCTI_ASSIGN_STRONGCAST_DECL. (umsg_fast_decl): Add. (objc_assign_ivar_decl): Add. (objc_assign_ivar_fast_decl): Add. (objc_assign_global_decl): Add. (objc_assign_strong_cast_decl): Add. (objc_method_list_ptr): Add. (objc_method_proto_list_ptr): Add. (objc_ivar_list_ptr): Add. * objc-act.c (should_call_super_dealloc): Add. (OBJC_VERSION): Bump to 6. (objc_is_gcable_type): Add. (objc_substitute_decl): Add. (objc_build_ivar_assignment): Add. (objc_build_global_assignment): Add. (objc_build_strong_cast_assignment): Add. (objc_is_gcable_p): Add. (objc_is_ivar_reference_p): Add. (objc_is_global_reference_p): Add. (generate_shared_structures): Add flags parameter. (objc_generate_cxx_ctor_or_dtor): Add. (objc_generate_cxx_cdtors): Add. (add_class): Add name parameter. (objc_types_share_size_and_alignment): Add. (comp_proto_with_proto): Add strict parameter. (CLS_HAS_CXX_STRUCTORS): Add. (TAG_ASSIGNIVAR): Add. (TAG_ASSIGNGLOBAL): Add. (TAG_ASSIGNSTRONGCAST): Add. (TAG_MSGSEND_FAST): Add. (TAG_ASSIGNIVAR_FAST): Add. (TAG_CXX_CONSTRUCT): Add. (TAG_CXX_DESTRUCT): Add. (OBJC_LOOKUP_CLASS): Add. (OBJC_LOOKUP_NO_SUPER): Add. (objc_finish_file): Add pch support. (objc_finish_implementation): Add Objective-C++ support. (synth_module_prologue): Likewise. (synth_module_prologue): Add fast dispatching. (objc_get_class_reference): Add Objective-C++ support. (objc_generate_write_barrier): Likewise. (next_sjlj_build_enter_and_setjmp): Likewise. (objc_begin_try_stmt): Likewise. (build_next_objc_exception_stuff): Add fast ivar support. (build_private_template): Mark the record as used so debug information is generated. (build_protocol_template): Add Objective-C++ support. (objc_method_parm_type) Likewise. (objc_generate_cxx_ctor_or_dtor): Likewise. (objc_generate_cxx_cdtors): Likewise. (build_protocol_initializer): Likewise. (build_category_template): Likewise. (build_class_template): Likewise. (build_method_list_template): Likewise. (build_category_initializer): Likewise. (build_shared_structure_initializer): Likewise. (objc_finish_message_expr): Likewise. (build_objc_method_call): Add fast dispatch support. (lookup_method_static): Add support to end search at superclasses. (add_method_to_hash_list): Add strict parameter to comp_proto_with_proto. (objc_add_method): Likewise. (objc_add_method): Also set the interface_value. (add_instance_variable): Add Objective-C++ support. (objc_is_public): Likewise. (start_class): Likewise. (continue_class): Likewise. (encode_aggregate_within): Likewise. (start_method_def): Likewise. (objc_start_function): Clear current_function_returns_value and current_function_returns_null. (really_start_method): Add Objective-C++ support. (objc_finish_method_definition): Add warning for missing [super dealloc]. (finish_objc): Add Objective-C++ support. (generate_objc_image_info): Likewise. (objc_lookup_ivar): Likewise. * objc-act.h (TYPE_HAS_OBJC_INFO): Likewise. (INIT_TYPE_OBJC_INFO): Likewise. (DUP_TYPE_OBJC_INFO): Likewise. From-SVN: r99857
2005-05-17 22:07:08 +02:00
tree
c-common.c (flag_objc_sjlj_exceptions): New. * c-common.c (flag_objc_sjlj_exceptions): New. * c-common.h (flag_objc_sjlj_exceptions): Declare. * c-opts.c (c_common_handle_option): Set it. (c_common_post_options): Handle interation of different objective-c exception and runtime switches. * c-decl.c (c_eh_initialized_p): New. (finish_decl): Use it instead of local eh_initialized_p. * c-parse.in (nested_function, notype_nested_function): Record the result of compstmt. (compstmt_or_error): Likewise. (compstmt): Don't add_stmt the result. (stmt): Don't return anything. Rewrite objc try and sync rules. (objc_try_stmt, objc_catch_list): Remove. (objc_catch_block, objc_finally_block): Remove. (objc_catch_prefix, objc_catch_clause, objc_opt_catch_list): New. (objc_try_catch_clause, objc_finally_clause): New. (objc_try_catch_stmt): Rewrite. * c-tree.h (c_eh_initialized_p): Declare. * c-opt (fobjc-sjlj-exceptions): New. * except.c (output_function_exception_table): Don't call cgraph on non-decls. * objc/objc-act.c (UTAG_EXCDATA_VAR, UTAG_CAUGHTEXC_VAR, UTAG_RETHROWEXC_VAR, UTAG_EVALONCE_VAR, struct val_stack, catch_count_stack, exc_binding_stack, if_nesting_count, blk_nesting_count, objc_enter_block, objc_exit_block, objc_declare_variable, 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): Remove. (objc_create_temporary_var, struct objc_try_context, cur_try_context, objc_eh_runtime_type, objc_init_exceptions, objc_build_exc_ptr, next_sjlj_build_try_exit, next_sjlj_build_enter_and_setjmp, next_sjlj_build_exc_extract, next_sjlj_build_catch_list, next_sjlj_build_try_catch_finally, objc_begin_try_stmt, objc_begin_catch_clause, objc_finish_catch_clause, objc_build_finally_clause, objc_finish_try_stmt, objc_build_synchronized): New. (objc_is_object_id, objc_is_class_id): New. (objc_comptypes): Use them. (build_next_objc_exception_stuff): Break NeXT sjlj out from build_objc_exception_stuff. (synth_module_prologue): Update to match. (objc_build_throw_stmt): Use cur_try_context to decide if we're in a @catch. * objc/objc-act.h: Update prototypes. (OCTI_EXCEPTION_BLK_STACK, objc_exception_block_stack): Remove. testsuite/ * objc.dg/sync-1.m: New. * objc.dg/try-catch-1.m: Don't force next runtime. * objc.dg/try-catch-3.m, objc.dg/try-catch-4.m: Likewise. * objc.dg/try-catch-2.m: Likewise. Enable everywhere. Remove shadowed catch clause. * objc.dg/try-catch-5.m: New. From-SVN: r83332
2004-06-18 03:20:53 +02:00
objc_build_synchronized (location_t start_locus, tree mutex, tree body)
{
c-common.c (flag_objc_sjlj_exceptions): New. * c-common.c (flag_objc_sjlj_exceptions): New. * c-common.h (flag_objc_sjlj_exceptions): Declare. * c-opts.c (c_common_handle_option): Set it. (c_common_post_options): Handle interation of different objective-c exception and runtime switches. * c-decl.c (c_eh_initialized_p): New. (finish_decl): Use it instead of local eh_initialized_p. * c-parse.in (nested_function, notype_nested_function): Record the result of compstmt. (compstmt_or_error): Likewise. (compstmt): Don't add_stmt the result. (stmt): Don't return anything. Rewrite objc try and sync rules. (objc_try_stmt, objc_catch_list): Remove. (objc_catch_block, objc_finally_block): Remove. (objc_catch_prefix, objc_catch_clause, objc_opt_catch_list): New. (objc_try_catch_clause, objc_finally_clause): New. (objc_try_catch_stmt): Rewrite. * c-tree.h (c_eh_initialized_p): Declare. * c-opt (fobjc-sjlj-exceptions): New. * except.c (output_function_exception_table): Don't call cgraph on non-decls. * objc/objc-act.c (UTAG_EXCDATA_VAR, UTAG_CAUGHTEXC_VAR, UTAG_RETHROWEXC_VAR, UTAG_EVALONCE_VAR, struct val_stack, catch_count_stack, exc_binding_stack, if_nesting_count, blk_nesting_count, objc_enter_block, objc_exit_block, objc_declare_variable, 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): Remove. (objc_create_temporary_var, struct objc_try_context, cur_try_context, objc_eh_runtime_type, objc_init_exceptions, objc_build_exc_ptr, next_sjlj_build_try_exit, next_sjlj_build_enter_and_setjmp, next_sjlj_build_exc_extract, next_sjlj_build_catch_list, next_sjlj_build_try_catch_finally, objc_begin_try_stmt, objc_begin_catch_clause, objc_finish_catch_clause, objc_build_finally_clause, objc_finish_try_stmt, objc_build_synchronized): New. (objc_is_object_id, objc_is_class_id): New. (objc_comptypes): Use them. (build_next_objc_exception_stuff): Break NeXT sjlj out from build_objc_exception_stuff. (synth_module_prologue): Update to match. (objc_build_throw_stmt): Use cur_try_context to decide if we're in a @catch. * objc/objc-act.h: Update prototypes. (OCTI_EXCEPTION_BLK_STACK, objc_exception_block_stack): Remove. testsuite/ * objc.dg/sync-1.m: New. * objc.dg/try-catch-1.m: Don't force next runtime. * objc.dg/try-catch-3.m, objc.dg/try-catch-4.m: Likewise. * objc.dg/try-catch-2.m: Likewise. Enable everywhere. Remove shadowed catch clause. * objc.dg/try-catch-5.m: New. From-SVN: r83332
2004-06-18 03:20:53 +02:00
tree args, call;
c-common.c (flag_objc_sjlj_exceptions): New. * c-common.c (flag_objc_sjlj_exceptions): New. * c-common.h (flag_objc_sjlj_exceptions): Declare. * c-opts.c (c_common_handle_option): Set it. (c_common_post_options): Handle interation of different objective-c exception and runtime switches. * c-decl.c (c_eh_initialized_p): New. (finish_decl): Use it instead of local eh_initialized_p. * c-parse.in (nested_function, notype_nested_function): Record the result of compstmt. (compstmt_or_error): Likewise. (compstmt): Don't add_stmt the result. (stmt): Don't return anything. Rewrite objc try and sync rules. (objc_try_stmt, objc_catch_list): Remove. (objc_catch_block, objc_finally_block): Remove. (objc_catch_prefix, objc_catch_clause, objc_opt_catch_list): New. (objc_try_catch_clause, objc_finally_clause): New. (objc_try_catch_stmt): Rewrite. * c-tree.h (c_eh_initialized_p): Declare. * c-opt (fobjc-sjlj-exceptions): New. * except.c (output_function_exception_table): Don't call cgraph on non-decls. * objc/objc-act.c (UTAG_EXCDATA_VAR, UTAG_CAUGHTEXC_VAR, UTAG_RETHROWEXC_VAR, UTAG_EVALONCE_VAR, struct val_stack, catch_count_stack, exc_binding_stack, if_nesting_count, blk_nesting_count, objc_enter_block, objc_exit_block, objc_declare_variable, 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): Remove. (objc_create_temporary_var, struct objc_try_context, cur_try_context, objc_eh_runtime_type, objc_init_exceptions, objc_build_exc_ptr, next_sjlj_build_try_exit, next_sjlj_build_enter_and_setjmp, next_sjlj_build_exc_extract, next_sjlj_build_catch_list, next_sjlj_build_try_catch_finally, objc_begin_try_stmt, objc_begin_catch_clause, objc_finish_catch_clause, objc_build_finally_clause, objc_finish_try_stmt, objc_build_synchronized): New. (objc_is_object_id, objc_is_class_id): New. (objc_comptypes): Use them. (build_next_objc_exception_stuff): Break NeXT sjlj out from build_objc_exception_stuff. (synth_module_prologue): Update to match. (objc_build_throw_stmt): Use cur_try_context to decide if we're in a @catch. * objc/objc-act.h: Update prototypes. (OCTI_EXCEPTION_BLK_STACK, objc_exception_block_stack): Remove. testsuite/ * objc.dg/sync-1.m: New. * objc.dg/try-catch-1.m: Don't force next runtime. * objc.dg/try-catch-3.m, objc.dg/try-catch-4.m: Likewise. * objc.dg/try-catch-2.m: Likewise. Enable everywhere. Remove shadowed catch clause. * objc.dg/try-catch-5.m: New. From-SVN: r83332
2004-06-18 03:20:53 +02:00
/* First lock the mutex. */
mutex = save_expr (mutex);
args = tree_cons (NULL, mutex, NULL);
call = build_function_call (objc_sync_enter_decl, args);
SET_EXPR_LOCATION (call, start_locus);
c-common.c (flag_objc_sjlj_exceptions): New. * c-common.c (flag_objc_sjlj_exceptions): New. * c-common.h (flag_objc_sjlj_exceptions): Declare. * c-opts.c (c_common_handle_option): Set it. (c_common_post_options): Handle interation of different objective-c exception and runtime switches. * c-decl.c (c_eh_initialized_p): New. (finish_decl): Use it instead of local eh_initialized_p. * c-parse.in (nested_function, notype_nested_function): Record the result of compstmt. (compstmt_or_error): Likewise. (compstmt): Don't add_stmt the result. (stmt): Don't return anything. Rewrite objc try and sync rules. (objc_try_stmt, objc_catch_list): Remove. (objc_catch_block, objc_finally_block): Remove. (objc_catch_prefix, objc_catch_clause, objc_opt_catch_list): New. (objc_try_catch_clause, objc_finally_clause): New. (objc_try_catch_stmt): Rewrite. * c-tree.h (c_eh_initialized_p): Declare. * c-opt (fobjc-sjlj-exceptions): New. * except.c (output_function_exception_table): Don't call cgraph on non-decls. * objc/objc-act.c (UTAG_EXCDATA_VAR, UTAG_CAUGHTEXC_VAR, UTAG_RETHROWEXC_VAR, UTAG_EVALONCE_VAR, struct val_stack, catch_count_stack, exc_binding_stack, if_nesting_count, blk_nesting_count, objc_enter_block, objc_exit_block, objc_declare_variable, 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): Remove. (objc_create_temporary_var, struct objc_try_context, cur_try_context, objc_eh_runtime_type, objc_init_exceptions, objc_build_exc_ptr, next_sjlj_build_try_exit, next_sjlj_build_enter_and_setjmp, next_sjlj_build_exc_extract, next_sjlj_build_catch_list, next_sjlj_build_try_catch_finally, objc_begin_try_stmt, objc_begin_catch_clause, objc_finish_catch_clause, objc_build_finally_clause, objc_finish_try_stmt, objc_build_synchronized): New. (objc_is_object_id, objc_is_class_id): New. (objc_comptypes): Use them. (build_next_objc_exception_stuff): Break NeXT sjlj out from build_objc_exception_stuff. (synth_module_prologue): Update to match. (objc_build_throw_stmt): Use cur_try_context to decide if we're in a @catch. * objc/objc-act.h: Update prototypes. (OCTI_EXCEPTION_BLK_STACK, objc_exception_block_stack): Remove. testsuite/ * objc.dg/sync-1.m: New. * objc.dg/try-catch-1.m: Don't force next runtime. * objc.dg/try-catch-3.m, objc.dg/try-catch-4.m: Likewise. * objc.dg/try-catch-2.m: Likewise. Enable everywhere. Remove shadowed catch clause. * objc.dg/try-catch-5.m: New. From-SVN: r83332
2004-06-18 03:20:53 +02:00
add_stmt (call);
c-common.c (flag_objc_sjlj_exceptions): New. * c-common.c (flag_objc_sjlj_exceptions): New. * c-common.h (flag_objc_sjlj_exceptions): Declare. * c-opts.c (c_common_handle_option): Set it. (c_common_post_options): Handle interation of different objective-c exception and runtime switches. * c-decl.c (c_eh_initialized_p): New. (finish_decl): Use it instead of local eh_initialized_p. * c-parse.in (nested_function, notype_nested_function): Record the result of compstmt. (compstmt_or_error): Likewise. (compstmt): Don't add_stmt the result. (stmt): Don't return anything. Rewrite objc try and sync rules. (objc_try_stmt, objc_catch_list): Remove. (objc_catch_block, objc_finally_block): Remove. (objc_catch_prefix, objc_catch_clause, objc_opt_catch_list): New. (objc_try_catch_clause, objc_finally_clause): New. (objc_try_catch_stmt): Rewrite. * c-tree.h (c_eh_initialized_p): Declare. * c-opt (fobjc-sjlj-exceptions): New. * except.c (output_function_exception_table): Don't call cgraph on non-decls. * objc/objc-act.c (UTAG_EXCDATA_VAR, UTAG_CAUGHTEXC_VAR, UTAG_RETHROWEXC_VAR, UTAG_EVALONCE_VAR, struct val_stack, catch_count_stack, exc_binding_stack, if_nesting_count, blk_nesting_count, objc_enter_block, objc_exit_block, objc_declare_variable, 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): Remove. (objc_create_temporary_var, struct objc_try_context, cur_try_context, objc_eh_runtime_type, objc_init_exceptions, objc_build_exc_ptr, next_sjlj_build_try_exit, next_sjlj_build_enter_and_setjmp, next_sjlj_build_exc_extract, next_sjlj_build_catch_list, next_sjlj_build_try_catch_finally, objc_begin_try_stmt, objc_begin_catch_clause, objc_finish_catch_clause, objc_build_finally_clause, objc_finish_try_stmt, objc_build_synchronized): New. (objc_is_object_id, objc_is_class_id): New. (objc_comptypes): Use them. (build_next_objc_exception_stuff): Break NeXT sjlj out from build_objc_exception_stuff. (synth_module_prologue): Update to match. (objc_build_throw_stmt): Use cur_try_context to decide if we're in a @catch. * objc/objc-act.h: Update prototypes. (OCTI_EXCEPTION_BLK_STACK, objc_exception_block_stack): Remove. testsuite/ * objc.dg/sync-1.m: New. * objc.dg/try-catch-1.m: Don't force next runtime. * objc.dg/try-catch-3.m, objc.dg/try-catch-4.m: Likewise. * objc.dg/try-catch-2.m: Likewise. Enable everywhere. Remove shadowed catch clause. * objc.dg/try-catch-5.m: New. From-SVN: r83332
2004-06-18 03:20:53 +02:00
/* Build the mutex unlock. */
args = tree_cons (NULL, mutex, NULL);
call = build_function_call (objc_sync_exit_decl, args);
SET_EXPR_LOCATION (call, input_location);
c-common.c (flag_objc_sjlj_exceptions): New. * c-common.c (flag_objc_sjlj_exceptions): New. * c-common.h (flag_objc_sjlj_exceptions): Declare. * c-opts.c (c_common_handle_option): Set it. (c_common_post_options): Handle interation of different objective-c exception and runtime switches. * c-decl.c (c_eh_initialized_p): New. (finish_decl): Use it instead of local eh_initialized_p. * c-parse.in (nested_function, notype_nested_function): Record the result of compstmt. (compstmt_or_error): Likewise. (compstmt): Don't add_stmt the result. (stmt): Don't return anything. Rewrite objc try and sync rules. (objc_try_stmt, objc_catch_list): Remove. (objc_catch_block, objc_finally_block): Remove. (objc_catch_prefix, objc_catch_clause, objc_opt_catch_list): New. (objc_try_catch_clause, objc_finally_clause): New. (objc_try_catch_stmt): Rewrite. * c-tree.h (c_eh_initialized_p): Declare. * c-opt (fobjc-sjlj-exceptions): New. * except.c (output_function_exception_table): Don't call cgraph on non-decls. * objc/objc-act.c (UTAG_EXCDATA_VAR, UTAG_CAUGHTEXC_VAR, UTAG_RETHROWEXC_VAR, UTAG_EVALONCE_VAR, struct val_stack, catch_count_stack, exc_binding_stack, if_nesting_count, blk_nesting_count, objc_enter_block, objc_exit_block, objc_declare_variable, 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): Remove. (objc_create_temporary_var, struct objc_try_context, cur_try_context, objc_eh_runtime_type, objc_init_exceptions, objc_build_exc_ptr, next_sjlj_build_try_exit, next_sjlj_build_enter_and_setjmp, next_sjlj_build_exc_extract, next_sjlj_build_catch_list, next_sjlj_build_try_catch_finally, objc_begin_try_stmt, objc_begin_catch_clause, objc_finish_catch_clause, objc_build_finally_clause, objc_finish_try_stmt, objc_build_synchronized): New. (objc_is_object_id, objc_is_class_id): New. (objc_comptypes): Use them. (build_next_objc_exception_stuff): Break NeXT sjlj out from build_objc_exception_stuff. (synth_module_prologue): Update to match. (objc_build_throw_stmt): Use cur_try_context to decide if we're in a @catch. * objc/objc-act.h: Update prototypes. (OCTI_EXCEPTION_BLK_STACK, objc_exception_block_stack): Remove. testsuite/ * objc.dg/sync-1.m: New. * objc.dg/try-catch-1.m: Don't force next runtime. * objc.dg/try-catch-3.m, objc.dg/try-catch-4.m: Likewise. * objc.dg/try-catch-2.m: Likewise. Enable everywhere. Remove shadowed catch clause. * objc.dg/try-catch-5.m: New. From-SVN: r83332
2004-06-18 03:20:53 +02:00
/* Put the that and the body in a TRY_FINALLY. */
objc_begin_try_stmt (start_locus, body);
objc_build_finally_clause (input_location, call);
Yet more Objective-C++... * objc-act.c (objc_finish_try_stmt): Add return value. (objc_build_synchronized): Likewise. * objc-act.c (objc_is_gcable_type): Add. (objc_substitute_decl): Add. (objc_build_ivar_assignment): Add. (objc_build_global_assignment): Add. (objc_build_strong_cast_assignment): Add. (objc_is_ivar_reference_p): Add. (objc_is_global_reference_p): Add. (objc_generate_write_barrier): Add. (objc_rewrite_function_call): Add. (objc_gimplify_expr): Add Objective-C++ support. * objc-act.h (ALLOC_OBJC_TYPE_LANG_SPECIFIC): Likewise. (SIZEOF_OBJC_TYPE_LANG_SPECIFIC): Add. (INIT_TYPE_OBJC_INFO): Add Objective-C++ support. (DUP_TYPE_OBJC_INFO): Likewise. (struct imp_entry): Add field has_cxx_cdtors. (struct imp_entry *imp_list): Add OCTI_UMSG_FAST_DECL, OCTI_METH_LIST_TEMPL, OCTI_METH_PROTO_LIST_TEMPL, OCTI_IVAR_LIST_TEMPL, OCTI_ASSIGN_IVAR_DECL, OCTI_ASSIGN_IVAR_FAST_DECL, OCTI_ASSIGN_GLOBAL_DECL, OCTI_ASSIGN_STRONGCAST_DECL. (umsg_fast_decl): Add. (objc_assign_ivar_decl): Add. (objc_assign_ivar_fast_decl): Add. (objc_assign_global_decl): Add. (objc_assign_strong_cast_decl): Add. (objc_method_list_ptr): Add. (objc_method_proto_list_ptr): Add. (objc_ivar_list_ptr): Add. * objc-act.c (should_call_super_dealloc): Add. (OBJC_VERSION): Bump to 6. (objc_is_gcable_type): Add. (objc_substitute_decl): Add. (objc_build_ivar_assignment): Add. (objc_build_global_assignment): Add. (objc_build_strong_cast_assignment): Add. (objc_is_gcable_p): Add. (objc_is_ivar_reference_p): Add. (objc_is_global_reference_p): Add. (generate_shared_structures): Add flags parameter. (objc_generate_cxx_ctor_or_dtor): Add. (objc_generate_cxx_cdtors): Add. (add_class): Add name parameter. (objc_types_share_size_and_alignment): Add. (comp_proto_with_proto): Add strict parameter. (CLS_HAS_CXX_STRUCTORS): Add. (TAG_ASSIGNIVAR): Add. (TAG_ASSIGNGLOBAL): Add. (TAG_ASSIGNSTRONGCAST): Add. (TAG_MSGSEND_FAST): Add. (TAG_ASSIGNIVAR_FAST): Add. (TAG_CXX_CONSTRUCT): Add. (TAG_CXX_DESTRUCT): Add. (OBJC_LOOKUP_CLASS): Add. (OBJC_LOOKUP_NO_SUPER): Add. (objc_finish_file): Add pch support. (objc_finish_implementation): Add Objective-C++ support. (synth_module_prologue): Likewise. (synth_module_prologue): Add fast dispatching. (objc_get_class_reference): Add Objective-C++ support. (objc_generate_write_barrier): Likewise. (next_sjlj_build_enter_and_setjmp): Likewise. (objc_begin_try_stmt): Likewise. (build_next_objc_exception_stuff): Add fast ivar support. (build_private_template): Mark the record as used so debug information is generated. (build_protocol_template): Add Objective-C++ support. (objc_method_parm_type) Likewise. (objc_generate_cxx_ctor_or_dtor): Likewise. (objc_generate_cxx_cdtors): Likewise. (build_protocol_initializer): Likewise. (build_category_template): Likewise. (build_class_template): Likewise. (build_method_list_template): Likewise. (build_category_initializer): Likewise. (build_shared_structure_initializer): Likewise. (objc_finish_message_expr): Likewise. (build_objc_method_call): Add fast dispatch support. (lookup_method_static): Add support to end search at superclasses. (add_method_to_hash_list): Add strict parameter to comp_proto_with_proto. (objc_add_method): Likewise. (objc_add_method): Also set the interface_value. (add_instance_variable): Add Objective-C++ support. (objc_is_public): Likewise. (start_class): Likewise. (continue_class): Likewise. (encode_aggregate_within): Likewise. (start_method_def): Likewise. (objc_start_function): Clear current_function_returns_value and current_function_returns_null. (really_start_method): Add Objective-C++ support. (objc_finish_method_definition): Add warning for missing [super dealloc]. (finish_objc): Add Objective-C++ support. (generate_objc_image_info): Likewise. (objc_lookup_ivar): Likewise. * objc-act.h (TYPE_HAS_OBJC_INFO): Likewise. (INIT_TYPE_OBJC_INFO): Likewise. (DUP_TYPE_OBJC_INFO): Likewise. From-SVN: r99857
2005-05-17 22:07:08 +02:00
return objc_finish_try_stmt ();
}
c-common.c (flag_objc_sjlj_exceptions): New. * c-common.c (flag_objc_sjlj_exceptions): New. * c-common.h (flag_objc_sjlj_exceptions): Declare. * c-opts.c (c_common_handle_option): Set it. (c_common_post_options): Handle interation of different objective-c exception and runtime switches. * c-decl.c (c_eh_initialized_p): New. (finish_decl): Use it instead of local eh_initialized_p. * c-parse.in (nested_function, notype_nested_function): Record the result of compstmt. (compstmt_or_error): Likewise. (compstmt): Don't add_stmt the result. (stmt): Don't return anything. Rewrite objc try and sync rules. (objc_try_stmt, objc_catch_list): Remove. (objc_catch_block, objc_finally_block): Remove. (objc_catch_prefix, objc_catch_clause, objc_opt_catch_list): New. (objc_try_catch_clause, objc_finally_clause): New. (objc_try_catch_stmt): Rewrite. * c-tree.h (c_eh_initialized_p): Declare. * c-opt (fobjc-sjlj-exceptions): New. * except.c (output_function_exception_table): Don't call cgraph on non-decls. * objc/objc-act.c (UTAG_EXCDATA_VAR, UTAG_CAUGHTEXC_VAR, UTAG_RETHROWEXC_VAR, UTAG_EVALONCE_VAR, struct val_stack, catch_count_stack, exc_binding_stack, if_nesting_count, blk_nesting_count, objc_enter_block, objc_exit_block, objc_declare_variable, 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): Remove. (objc_create_temporary_var, struct objc_try_context, cur_try_context, objc_eh_runtime_type, objc_init_exceptions, objc_build_exc_ptr, next_sjlj_build_try_exit, next_sjlj_build_enter_and_setjmp, next_sjlj_build_exc_extract, next_sjlj_build_catch_list, next_sjlj_build_try_catch_finally, objc_begin_try_stmt, objc_begin_catch_clause, objc_finish_catch_clause, objc_build_finally_clause, objc_finish_try_stmt, objc_build_synchronized): New. (objc_is_object_id, objc_is_class_id): New. (objc_comptypes): Use them. (build_next_objc_exception_stuff): Break NeXT sjlj out from build_objc_exception_stuff. (synth_module_prologue): Update to match. (objc_build_throw_stmt): Use cur_try_context to decide if we're in a @catch. * objc/objc-act.h: Update prototypes. (OCTI_EXCEPTION_BLK_STACK, objc_exception_block_stack): Remove. testsuite/ * objc.dg/sync-1.m: New. * objc.dg/try-catch-1.m: Don't force next runtime. * objc.dg/try-catch-3.m, objc.dg/try-catch-4.m: Likewise. * objc.dg/try-catch-2.m: Likewise. Enable everywhere. Remove shadowed catch clause. * objc.dg/try-catch-5.m: New. From-SVN: r83332
2004-06-18 03:20:53 +02:00
/* Predefine the following data type:
struct _objc_exception_data
{
int buf[OBJC_JBLEN];
void *pointers[4];
}; */
/* The following yuckiness should prevent users from having to #include
<setjmp.h> in their code... */
/* Define to a harmless positive value so the below code doesn't die. */
#ifndef OBJC_JBLEN
#define OBJC_JBLEN 18
#endif
static void
c-common.c (flag_objc_sjlj_exceptions): New. * c-common.c (flag_objc_sjlj_exceptions): New. * c-common.h (flag_objc_sjlj_exceptions): Declare. * c-opts.c (c_common_handle_option): Set it. (c_common_post_options): Handle interation of different objective-c exception and runtime switches. * c-decl.c (c_eh_initialized_p): New. (finish_decl): Use it instead of local eh_initialized_p. * c-parse.in (nested_function, notype_nested_function): Record the result of compstmt. (compstmt_or_error): Likewise. (compstmt): Don't add_stmt the result. (stmt): Don't return anything. Rewrite objc try and sync rules. (objc_try_stmt, objc_catch_list): Remove. (objc_catch_block, objc_finally_block): Remove. (objc_catch_prefix, objc_catch_clause, objc_opt_catch_list): New. (objc_try_catch_clause, objc_finally_clause): New. (objc_try_catch_stmt): Rewrite. * c-tree.h (c_eh_initialized_p): Declare. * c-opt (fobjc-sjlj-exceptions): New. * except.c (output_function_exception_table): Don't call cgraph on non-decls. * objc/objc-act.c (UTAG_EXCDATA_VAR, UTAG_CAUGHTEXC_VAR, UTAG_RETHROWEXC_VAR, UTAG_EVALONCE_VAR, struct val_stack, catch_count_stack, exc_binding_stack, if_nesting_count, blk_nesting_count, objc_enter_block, objc_exit_block, objc_declare_variable, 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): Remove. (objc_create_temporary_var, struct objc_try_context, cur_try_context, objc_eh_runtime_type, objc_init_exceptions, objc_build_exc_ptr, next_sjlj_build_try_exit, next_sjlj_build_enter_and_setjmp, next_sjlj_build_exc_extract, next_sjlj_build_catch_list, next_sjlj_build_try_catch_finally, objc_begin_try_stmt, objc_begin_catch_clause, objc_finish_catch_clause, objc_build_finally_clause, objc_finish_try_stmt, objc_build_synchronized): New. (objc_is_object_id, objc_is_class_id): New. (objc_comptypes): Use them. (build_next_objc_exception_stuff): Break NeXT sjlj out from build_objc_exception_stuff. (synth_module_prologue): Update to match. (objc_build_throw_stmt): Use cur_try_context to decide if we're in a @catch. * objc/objc-act.h: Update prototypes. (OCTI_EXCEPTION_BLK_STACK, objc_exception_block_stack): Remove. testsuite/ * objc.dg/sync-1.m: New. * objc.dg/try-catch-1.m: Don't force next runtime. * objc.dg/try-catch-3.m, objc.dg/try-catch-4.m: Likewise. * objc.dg/try-catch-2.m: Likewise. Enable everywhere. Remove shadowed catch clause. * objc.dg/try-catch-5.m: New. From-SVN: r83332
2004-06-18 03:20:53 +02:00
build_next_objc_exception_stuff (void)
{
tree field_decl, field_decl_chain, index, temp_type;
objc_exception_data_template
= start_struct (RECORD_TYPE, get_identifier (UTAG_EXCDATA));
/* int buf[OBJC_JBLEN]; */
index = build_index_type (build_int_cst (NULL_TREE, OBJC_JBLEN - 1));
Makefile.in (c-parse.o): Depend on $(C_COMMON_H). [gcc/ChangeLog] 2004-09-07 Ziemowit Laski <zlaski@apple.com> * Makefile.in (c-parse.o): Depend on $(C_COMMON_H). * c-parse.in: Include c-common.h instead of objc-act.h. (ivar_decl_list, ivar_decls, ivar_decl, ivars, ivar_declarator, myparms, myparm): Remove %type declarations. (methodtype, optparms, OBJC_TYPE_QUAL, objc_quals, objc_qual, objc_typename, objc_try_catch_stmt, optellipsis): Add %type declarations. (objc_inherit_code, objc_public_flag): Remove. (typespec_nonreserved_nonattr): Call objc_get_protocol_qualified_type() instead of get_static_reference() and get_protocol_reference(). (stmt_nocomp): Call grokparm() on @catch parameter. (objcdef): Move semantic action to objc_finish_implementation(). (classdef): Move semantic action to objc_start_class_interface(), objc_continue_interface(), objc_finish_interface(), objc_start_class_implementation(), objc_continue_implementation(), objc_start_category_interface() and objc_start_category_implementation(). (protocoldef): Move semantic actions to objc_start_protocol() and objc_finish_interface(). (ivar_decl_list): Remove nonterminal. (visibility_spec): Move semantic actions to objc_set_visibility(). (ivar_decls): Remove assignment to $$. (ivar_decl): Rephrase in terms of component_decl; call objc_add_instance_variable(). (ivars, ivar_declarator): Remove nonterminals. (opt_semi): New nonterminal. (methodtype): Remove semantic actions. (methoddef): Move semantic actions to objc_set_method_type(), objc_start_method_definition() and objc_finish_method_definition(). (methodproto): Move semantic actions to objc_set_method_type() and objc_add_method_declaration(). (methoddecl): Use objc_typename instead of typename; move semantic actions to objc_build_method_signature(). (optarglist, myxdecls, mydecl, myparms, myparm): Remove nonterminals. (optparmlist): Express in terms of optparms and optellipsis. (optparms, optellipsis, objc_qual, objc_quals, objc_typename): New nonterminals. (keyworddecl): Use objc_typename instead of typename. (rid_to_yy): Mark RID_IN, RID_OUT, RID_INOUT, RID_BYCOPY, RID_BYREF and RID_ONEWAY as returning OBJC_TYPE_QUAL to yyparse(). [gcc/objc/ChangeLog] 2004-09-07 Ziemowit Laski <zlaski@apple.com> * Make-lang.in (objc/objc-parse.o): Depend on $(C_COMMON_H) instead of objc/objc-act.h. (objc/objc-act.o): Depend on $(HASHTAB_H). * objc-act.c: Include hashtab.h; in ObjC++ mode, include cp-tree.h and objcp-decl.h instead of c-tree.h. (build_module_descriptor, get_class_ivars, synth_id_with_class_suffix, error_with_ivar, gen_method_decl, gen_declaration, setup_string_decl, build_protocol_template): Adjust prototypes. (build_module_initializer_routine, start_class, continue_class, finish_class, start_method_def, objc_start_function, start_protocol, build_method_decl, objc_add_method, add_instance_variable, build_ivar_reference, is_ivar, is_private, get_super_receiver, build_selector_table_decl, objc_push_parm, objc_get_parm_info, gen_type_name, gen_type_name_0, start_var_decl, finish_var_decl, create_field_decl): New prototypes. (objc_expand_function_end, comp_method_with_proto, objc_expr_last, gen_declaration_1, gen_declarator, is_complex_decl, adorn_decl, define_decl, create_builtin_decl, gen_declspecs): Remove prototypes. (TYPE_ID): Rename to OBJECT_TYPEDEF_NAME. (CLASS_TYPEDEF_NAME): New. (TAG_EXECCLASS): Change from a global variable to a #define. (TAG_RETURN_STRUCT): Delete. (TAG_GNUINIT): New, holds '__objc_gnu_init' name. (objc_inherit_code, objc_public_flag): New, moved from c-parse.in. (string_descriptor): New struct. (string_htab): New hash table. (string_hash, string_eq): New prototypes. (generate_struct_by_value_array): Call create_field_decl() instead of create_builtin_decl(). (objc_init): Do not initialize objc_ellipsis_node or TAG_EXECCLASS; In ObjC++ mode, call cxx_init() instead of c_objc_common_init(). (objc_finish_file): In ObjC++, call instantiate_pending_templates() and cp_finish_file(). (define_decl, get_static_reference, get_protocol_reference, create_builtin_decl): Remove functions. (objc_start_class_interface, objc_start_category_interface, objc_start_protocol, objc_continue_interface, objc_finish_interface, objc_start_class_implementation, objc_start_category_implementation, objc_continue_implementation, objc_finish_implementation, objc_set_visibility, objc_set_method_type, objc_build_method_signature, objc_add_method_declaration, objc_start_method_definition, objc_add_instance_variable, objc_get_protocol_qualified_type, create_field_decl, start_var_decl, finish_var_decl): New functions. (setup_string_decl): Simplify since it is only called once. (synth_module_prologue): Call build_class_template(); predefine 'id' and 'Class' as typedefs; rename 'temp_type' to 'type'; disable debug hooks for duration of function; fix GNU runtime messenger signatures to correspond to reality; forward-declare '__objc_exec_class' for the GNU runtime; call build_selector_table_decl(); in ObjC++ mode, generate 'extern "C" { ... }' wrappers around synthesized declarations; call build_protocol_template() and build_category_template(). (string_hash, string_eq): New functions. (objc_build_string_object): Check metaclass correctness only once; store string literals in hash table. (objc_build_constructor): Do not convert initializer elements; adjust for ObjC++ impedance mismatch. (build_objc_symtab_template): Call create_field_decl() instead of create_builtin_decl(). (init_objc_symtab): Add missing conversion to initializer element. (build_metadata_decl): Call start_var_decl() instead of define_decl(). (generate_objc_symtab_decl): Do not call build_category_template(); call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(). (build_module_descriptor): Call create_field_decl() instead of grokfield(); call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(); always mark module descriptor as used; move GNU runtime-specific functionality to build_module_initializer_routine(). (build_module_initializer_routine): New function, broken off of build_module_descriptor(). (objc_static_init_needed_p, objc_generate_static_init_call): New functions. (generate_static_references, generate_strings, build_selector_translation_table, generate_descriptor_table, generate_ivars_list, generate_dispatch_table, generate_category): Call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(); build a type directly instead of via groktypename(). (build_selector_reference_decl, build_selector_table_decl, build_class_reference_decl, build_protocol_reference, generate_objc_image_info): Call start_var_decl() instead of build_decl(). (build_selector_reference): For GNU runtime, do not call build_selector_reference_decl(). (build_selector, build_typed_selector_reference): Always convert result to the selector type. (add_objc_string): Cast return value to 'char *'. (build_method_prototype_template, build_selector_template, build_method_template): Use actual selector type for fields pointing to selectors. (finish_objc): For GNU runtime, call build_module_initializer_routine() after build_module_descriptor(). (generate_protocol_list, generate_shared_structures): Call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(); build a type directly instead of via groktypename(). (synth_id_with_class_suffix): Return a string. (get_arg_type_list): For instance methods, use the instance type for 'self'; do not call groktypename_in_parm_context(). (build_objc_string_decl): Squash redeclaration errors in ObjC++. (objc_is_class_name): Use OBJC_TYPE_NAME instead of TYPE_NAME; handle RECORD_TYPEs in ObjC as well as ObjC++. (objc_is_id): New function. (objc_is_object_ptr): Return the canonical type node. (objc_get_class_ivars): Simplify using get_class_ivars(). (get_class_ivars): Remove second parameter; create a fresh copy of the ivar list for each call; do not check for existence of super class. (objc_eh_runtime_type): Mark #ifndef OBJCPLUS. (objc_init_exceptions): When using SJLJ-style exceptions, require the use of '-fobjc-exceptions' flag; do not require it for DWARF-style exceptions. (objc_build_exc_ptr, next_sjlj_build_try_catch_finally): Use objc_object_type instead of objc_id_type. (objc_begin_catch_clause): Convert the incoming PARM_DECL into a VAR_DECL before placing it in the appropriate scope; do not call define_decl(); adjust call to c_begin_compound_stmt(); use objc_object_type instead of objc_id_type. (build_next_objc_exception_stuff): Call create_field_decl() instead of create_builtin_decl(); construct type directly instead of calling groktypename(); use OBJC_VOID_AT_END to mark end of function parameters. (build_private_template): Adjust call to get_class_ivars(); build a type directly instead of via groktypename(). (build_protocol_template, build_method_prototype_list_template, build_method_prototype_template, build_category_template, build_selector_template, build_class_template, build_super_template, build_ivar_template, build_ivar_list_template, build_method_list_template, build_method_template): Call create_field_decl() instead of grokfield(). (objc_method_parm_type): Do not call groktypename(). (generate_descriptor_table): Call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(). (generate_method_descriptors, build_protocol_initializer, generate_dispatch_tables, build_category_initializer, build_shared_structure_initializer): Do not call groktypename(). (generate_protocols): Call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(); do not call groktypename(). (error_with_ivar): Remove last parameter. (check_ivars): Do not iterate ovar CLASS_RAW_IVARS lists in addition to CLASS_IVARS lists; adjust calls to error_with_ivar(). (generate_ivar_lists): Convert one of the initializer elements; do not call groktypename(). (get_arg_type_list, start_method_def, gen_method_def): Account for new representation of variable arguments and '...' in Objective-C methods; add Objective-C++ impedance matching code. (is_objc_type_qualifier): Remove function. (adjust_type_for_id_default): Simplify; there is no longer a need to wade through declspecs. (lookup_interface, start_class, continue_class, finish_class, start_method_def, start_protocol, build_method_decl, objc_add_method, add_instance_variable, build_ivar_reference, is_ivar, is_private, get_super_receiver, objc_build_finally_epilogue): Make into static functions. (receiver_is_class_object): Use new IS_CLASS() macro. (objc_build_message_expr): Tweak ObjC++ message argument handling; call objc_finish_message_expr() instead of finish_message_expr(). (finish_message_expr): Rename to objc_finish_message_expr(); use OBJC_TYPE_NAME and OBJC_SET_TYPE_NAME macros instead of TYPE_NAME. call gen_type_name() instead of gen_declaration(); call objc_is_id() instead of using IS_ID and IS_CLASS; Use objc_class_name instead of calling get_identifier("Class"); handle CONVERT_EXPRs in receiver. (build_objc_method_call, warn_with_method): Do not call groktypename(). (build_ivar_reference): Call convert() instead of clobbering in a type. (hash_init): Initialize string_htab hash table. (add_instance_variable): Simplify parameter list; do not call grokfield(); do not populate CLASS_IVARS list. (start_class): Check for the existence of super class, if one was specified. (continue_class): Use CLASS_RAW_IVARS rather than CLASS_IVARS; do not call build_class_template(); adjust call to get_class_ivars(); call build_decl(), pushdecl() and finish_decl() instead of define_decl(). (finish_class): Call build_decl(), pushdecl() and finish_decl() instead of define_decl(). (add_protocols): Use PROTOCOL_BINFO_ELTS for the tree vector size. (start_protocol): Do not call build_protocol_template(); use PROTOCOL_BINFO_ELTS for the tree vector size. (encode_type_qualifiers): Do not handle the 'const' qualifier here. (encode_pointer): Encode 'const char *' as 'r*', for backwards compatibility. (encode_array): Use HOST_WIDE_INT_PRINT_DEC instead of "%ld". (encode_type): Handle the 'const' qualifier here. (objc_parmlist): New global variable, sued by objc_push_parm and objc_get_parm_info(). (objc_push_parm, objc_get_parm_info): New functions. (objc_expr_last): Remove function. (synth_self_and_ucmd_args): For instance methods, use the instance type for 'self'; call objc_push_parm() instead of push_parm_decl(). (start_method_def): Do not call push_scope(), declare_parm_level(), pop_scope(), push_parm_decl(), store_parm_decls() or objc_expr_last(); just use objc_push_parm() and objc_get_parm_info(). (comp_method_with_proto): Remove function. (objc_types_are_equivalent): Strip away indirections before comparing underlying types. (comp_proto_with_proto): Do not call groktypename(); types are no longer in raw declspec format. (objc_start_function): New function. (really_start_method): Call comp_proto_with_proto() instead of comp_method_with_proto(); call objc_start_function() instead of hand-crafting a function declarator. (continue_method_def, objc_expand_function_end): Remove functions. (get_super_receiver): Call objc_get_current_scope() instead of get_current_scope(); reference 'super_class' field (instead of 'class'). (finish_method_def): Rename to objc_finish_method_definition() and add a function decl parameter; move method encoding call from objc_expand_function_end(). (is_complex_decl, adorn_decl, gen_declarator, gen_declspecs, gen_declaration_1): Remove functions. (tmpbuf, RAW_DECLSPEC): Remove. (gen_declaration): Remove second parameter; simplify to deal with TYPE_P nodes instead of raw declspecs. (gen_type_name, gen_type_name_0): New functions. (gen_method_decl): Remove second parameter; call gen_type_name() instead of gen_declaration_1(). (dump_interface): Adjust calls to gen_declaration() and gen_method_decl(); do not allocate a separate string buffer. (init_objc): Allocate a larger string buffer to accommodate dump_interface(); adjust call to build_module_descriptor(); add call to build_module_initializer_routine() for the GNU runtime. (generate_classref_translation_entry): Do not call start_decl(); call finish_var_decl() instead of finish_decl(); call convert() instead of build_c_cast(). * objc-act.h (CLASS_OWN_IVARS): Remove accessor. (CLASS_BINFO_ELTS): Reduce from 6 to 5, now that CLASS_OWN_IVARS is gone. (OCTI_GNU_INIT_DECL, GNU_INIT_decl): New. (OCTI_ELLIPSIS_NODE, objc_ellipsis_node): Remove. (OCTI_ID_ID, id_type, objc_id_id): Rename to OCTI_ID_NAME, objc_object_type and objc_object_name, respectively. (OCTI_CLS_REF, OCTI_CLASS_NAME, objc_class_reference, objc_class_name): New. (IS_CLASS): New macro. (IS_ID, IS_SUPER): Robustify. (OCTI_EXECCLASS_DECL, execclass_decl): New. (finish_file, start_class, continue_class, finish_class, start_method_def, continue_method_def, finish_method_def, start_protocol, finish_protocol, objc_build_throw_stmt, objc_build_try_catch_finally_stmt, objc_build_synchronized_prologue, objc_build_synchronized_epilogue, objc_build_try_prologue, objc_build_try_epilogue, objc_build_catch_stmt, objc_build_catch_epilogue, objc_build_finally_prologue, objc_build_finally_epilogue, is_ivar, is_private, is_public, add_instance_variable, objc_add_method, get_super_receiver, objc_clear_super_receiver, get_class_ivars_from_name, get_class_reference, get_static_reference, get_object_reference, build_message_expr, finish_message_expr, build_selector_expr, build_ivar_reference, build_keyword_decl, build_method_decl, build_protocol_expr, build_objc_string_object, objc_declare_alias, objc_declare_class, objc_declare_protocols, objc_comptypes, objc_check_decl, build_encode_expr): Remove prototypes. (imp_count, cat_count): Make GGC-aware. (OBJC_SET_TYPE_NAME): New macro. From-SVN: r87168
2004-09-08 02:49:44 +02:00
field_decl = create_field_decl (build_array_type (integer_type_node, index),
"buf");
field_decl_chain = field_decl;
/* void *pointers[4]; */
tree.h (build_int_cst): New, sign extended constant. * tree.h (build_int_cst): New, sign extended constant. (build_int_cstu): New, zero extended constant. (build_int_cst_wide): Renamed from build_int_cst. * tree.c (build_int_cst, build_int_cstu): New. (build_int_cst_wide): Renamed from build_int_cst. (make_vector_type, build_common_tree_nodes, build_common_tree_nodes_2): Adjust build_int_cst calls. * builtins.c (expand_builtin_prefetch, expand_builtin_strstr, expand_builtin_strpbrk, expand_builtin_fputs, build_string_literal, expand_builtin_printf, expand_builtin_sprintf, fold_builtin_classify_type, fold_builtin_lround, fold_builtin_bitop, fold_builtin_isascii, fold_builtin_toascii, fold_builtin_isdigit, simplify_builtin_strstr, simplify_builtin_strpbrk, fold_builtin_fputs, simplify_builtin_sprintf): Likewise. * c-common.c (start_fname_decls, fix_string_type, shorten_compare, DEF_ATTR_INT): Likewise. * c-decl.c (complete_array_type, check_bitfield_type_and_width): Likewise. * c-lex.c (interpret_integer, lex_charconst): Likewise. * c-parse.in (primary) <TYPES_COMPATIBLE_P> Likewise. * c-pretty-print.c (pp_c_integer_constant): Likewise. * c-typeck.c (really_start_incremental_init, push_init_level, set_nonincremental_init_from_string): Likewise. * calls.c (load_register_parameters): Likewise. convert.c (convert_to_pointer): Likewise. coverage.c (coverage_counter_alloc, tree_coverage_counter_ref, build_fn_info_type, build_fn_info_value, build_ctr_info_value, build_gcov_info): Likewise. * except.c (init_eh, assign_filter_values): Likewise. * expmed.c (store_fixed_bit_field, extract_bit_field, extract_fixed_bit_field, extract_split_bit_field, expand_shift, expand_mult_const, expand_mult_highpart_adjust, extract_high_half, expand_sdiv_pow2, expand_divmod, make_tree): Likewise. * expr.c (convert_move, emit_group_load, emit_group_store, expand_assignment, store_constructor, store_field, expand_expr_real_1, reduce_to_bit_field_precision): Likewise. fold-const.c (force_fit_type, int_const_binop, fold_convert_const, invert_truthvalue, optimize_bit_field_compare, decode_field_reference, all_ones_mask_p, constant_boolean_node, fold_div_compare, fold, fold_read_from_constant_string, fold_negate_const, fold_abs_const, fold_not_const, round_up, round_down): Likewise. * function.c (assign_parm_setup_block): Likewise. * stmt.c (shift_return_value, expand_case, estimate_case_costs): Likewise. * stor-layout.c (layout_type, initialize_sizetypes, set_min_and_max_values_for_integral_type): Likewise. * tree-chrec.c (chrec_fold_multiply_poly_poly, reset_evolution_in_loop): Likewise. * tree-chrec.h (build_polynomial_chrec): Likewise. * tree-complex.c (build_replicated_const): Likewise. * tree-eh.c (honor_protect_cleanup_actions, lower_try_finally_onedest, lower_try_finally_copy, lower_try_finally_switch): Likewise. * tree-mudflap.c (mf_build_string, mx_register_decls, mudflap_register_call, mudflap_enqueue_constant): Likewise. * tree-nested.c (get_trampoline_type, get_nl_goto_field): Likewise. * tree-pretty-print.c (dump_generic_node): Likewise. * tree-ssa-ccp.c (widen_bitfield, maybe_fold_offset_to_array_ref): Likewise. * tree-ssa-dom.c (simplify_rhs_and_lookup_avail_expr): Likewise. * tree-ssa-loop-niter.c (number_of_iterations_cond, loop_niter_by_eval, upper_bound_in_type, lower_bound_in_type): Likewise. * tree-ssa-loop-ivcanon.c (create_canonical_iv, canonicalize_loop_induction_variables): Likewise. * tree-vectorizer.c (vect_create_index_for_array_ref, vect_transform_loop_bound, vect_compute_data_ref_alignment): Likewise. * config/alpha/alpha.c (alpha_initialize_trampoline, alpha_va_start, alpha_gimplify_va_arg_1): Likewise. * config/arm/arm.c (arm_get_cookie_size): Likewise. * config/c4x/c4x.c (c4x_gimplify_va_arg_expr): Likewise. * config/i386/i386.c (ix86_va_start, ix86_gimplify_va_arg): Likewise. * config/ia64/ia64.c (ia64_gimplify_va_arg): Likewise. * config/mips/mips.c (mips_build_builtin_va_list, mips_va_start, mips_gimplify_va_arg_expr): Likewise. * config/pa/pa.c (hppa_gimplify_va_arg_expr): Likewise. * config/rs6000/rs6000.c (rs6000_va_start, rs6000_gimplify_va_arg, add_compiler_branch_island): Likewise. * config/s390/s390.c (s390_va_start): Likewise. * config/sh/sh.c (sh_va_start): Likewise. * config/stormy16/stormy16.c (xstormy16_expand_builtin_va_start): Likewise. * config/xtensa/xtensa.c (xtensa_va_start, xtensa_gimplify_va_arg_expr): Likewise. * objc/objc-act.c (build_objc_string_object, build_objc_symtab_template, init_def_list, init_objc_symtab, init_module_descriptor, generate_static_references, build_selector_translation_table, get_proto_encoding, build_typed_selector_reference, build_selector_reference, build_next_objc_exception_stuff, build_method_prototype_list_template, generate_descriptor_table, generate_protocols, build_protocol_initializer, build_ivar_list_template, build_method_list_template, build_ivar_list_initializer, generate_ivars_list, generate_dispatch_table, generate_protocol_list, build_category_initializer, build_shared_structure_initializer, generate_shared_structures, handle_impent, generate_objc_image_info): Likewise. 2004-04-25 Paolo Bonzini <bonzini@gnu.org> * cfglayout.c (duplicate_insn_chain): Remove references to NOTE_INSN_LOOP_VTOP and NOTE_INSN_LOOP_CONT. * cfgloop.h (struct loop): Remove fields vtop, cont and cont_dominator. * cfgrtl.c (rtl_delete_block): Remove handling of NOTE_INSN_LOOP_CONT. * final.c (final_scan_insn): Remove references to NOTE_INSN_LOOP_VTOP and NOTE_INSN_LOOP_CONT. * insn-notes.def (NOTE_INSN_LOOP_VTOP, NOTE_INSN_LOOP_CONT): Remove. * jump.c (squeeze_notes): Remove references to NOTE_INSN_LOOP_VTOP and NOTE_INSN_LOOP_CONT. * loop.c (scan_loops, find_and_verify_loops, for_each_insn_in_loop, check_dbra_loop, loop_dump_aux): Remove references to removed notes and fields. * reorg.c (mostly_true_jump): Do not rely on NOTE_INSN_LOOP_VTOPs. * unroll.c (unroll_loop, copy_loop_body, loop_iterations): Remove references to removed notes and fields. (subtract_reg_term, ujump_to_loop_cont): Remove. From-SVN: r86544
2004-08-25 11:52:54 +02:00
index = build_index_type (build_int_cst (NULL_TREE, 4 - 1));
Makefile.in (c-parse.o): Depend on $(C_COMMON_H). [gcc/ChangeLog] 2004-09-07 Ziemowit Laski <zlaski@apple.com> * Makefile.in (c-parse.o): Depend on $(C_COMMON_H). * c-parse.in: Include c-common.h instead of objc-act.h. (ivar_decl_list, ivar_decls, ivar_decl, ivars, ivar_declarator, myparms, myparm): Remove %type declarations. (methodtype, optparms, OBJC_TYPE_QUAL, objc_quals, objc_qual, objc_typename, objc_try_catch_stmt, optellipsis): Add %type declarations. (objc_inherit_code, objc_public_flag): Remove. (typespec_nonreserved_nonattr): Call objc_get_protocol_qualified_type() instead of get_static_reference() and get_protocol_reference(). (stmt_nocomp): Call grokparm() on @catch parameter. (objcdef): Move semantic action to objc_finish_implementation(). (classdef): Move semantic action to objc_start_class_interface(), objc_continue_interface(), objc_finish_interface(), objc_start_class_implementation(), objc_continue_implementation(), objc_start_category_interface() and objc_start_category_implementation(). (protocoldef): Move semantic actions to objc_start_protocol() and objc_finish_interface(). (ivar_decl_list): Remove nonterminal. (visibility_spec): Move semantic actions to objc_set_visibility(). (ivar_decls): Remove assignment to $$. (ivar_decl): Rephrase in terms of component_decl; call objc_add_instance_variable(). (ivars, ivar_declarator): Remove nonterminals. (opt_semi): New nonterminal. (methodtype): Remove semantic actions. (methoddef): Move semantic actions to objc_set_method_type(), objc_start_method_definition() and objc_finish_method_definition(). (methodproto): Move semantic actions to objc_set_method_type() and objc_add_method_declaration(). (methoddecl): Use objc_typename instead of typename; move semantic actions to objc_build_method_signature(). (optarglist, myxdecls, mydecl, myparms, myparm): Remove nonterminals. (optparmlist): Express in terms of optparms and optellipsis. (optparms, optellipsis, objc_qual, objc_quals, objc_typename): New nonterminals. (keyworddecl): Use objc_typename instead of typename. (rid_to_yy): Mark RID_IN, RID_OUT, RID_INOUT, RID_BYCOPY, RID_BYREF and RID_ONEWAY as returning OBJC_TYPE_QUAL to yyparse(). [gcc/objc/ChangeLog] 2004-09-07 Ziemowit Laski <zlaski@apple.com> * Make-lang.in (objc/objc-parse.o): Depend on $(C_COMMON_H) instead of objc/objc-act.h. (objc/objc-act.o): Depend on $(HASHTAB_H). * objc-act.c: Include hashtab.h; in ObjC++ mode, include cp-tree.h and objcp-decl.h instead of c-tree.h. (build_module_descriptor, get_class_ivars, synth_id_with_class_suffix, error_with_ivar, gen_method_decl, gen_declaration, setup_string_decl, build_protocol_template): Adjust prototypes. (build_module_initializer_routine, start_class, continue_class, finish_class, start_method_def, objc_start_function, start_protocol, build_method_decl, objc_add_method, add_instance_variable, build_ivar_reference, is_ivar, is_private, get_super_receiver, build_selector_table_decl, objc_push_parm, objc_get_parm_info, gen_type_name, gen_type_name_0, start_var_decl, finish_var_decl, create_field_decl): New prototypes. (objc_expand_function_end, comp_method_with_proto, objc_expr_last, gen_declaration_1, gen_declarator, is_complex_decl, adorn_decl, define_decl, create_builtin_decl, gen_declspecs): Remove prototypes. (TYPE_ID): Rename to OBJECT_TYPEDEF_NAME. (CLASS_TYPEDEF_NAME): New. (TAG_EXECCLASS): Change from a global variable to a #define. (TAG_RETURN_STRUCT): Delete. (TAG_GNUINIT): New, holds '__objc_gnu_init' name. (objc_inherit_code, objc_public_flag): New, moved from c-parse.in. (string_descriptor): New struct. (string_htab): New hash table. (string_hash, string_eq): New prototypes. (generate_struct_by_value_array): Call create_field_decl() instead of create_builtin_decl(). (objc_init): Do not initialize objc_ellipsis_node or TAG_EXECCLASS; In ObjC++ mode, call cxx_init() instead of c_objc_common_init(). (objc_finish_file): In ObjC++, call instantiate_pending_templates() and cp_finish_file(). (define_decl, get_static_reference, get_protocol_reference, create_builtin_decl): Remove functions. (objc_start_class_interface, objc_start_category_interface, objc_start_protocol, objc_continue_interface, objc_finish_interface, objc_start_class_implementation, objc_start_category_implementation, objc_continue_implementation, objc_finish_implementation, objc_set_visibility, objc_set_method_type, objc_build_method_signature, objc_add_method_declaration, objc_start_method_definition, objc_add_instance_variable, objc_get_protocol_qualified_type, create_field_decl, start_var_decl, finish_var_decl): New functions. (setup_string_decl): Simplify since it is only called once. (synth_module_prologue): Call build_class_template(); predefine 'id' and 'Class' as typedefs; rename 'temp_type' to 'type'; disable debug hooks for duration of function; fix GNU runtime messenger signatures to correspond to reality; forward-declare '__objc_exec_class' for the GNU runtime; call build_selector_table_decl(); in ObjC++ mode, generate 'extern "C" { ... }' wrappers around synthesized declarations; call build_protocol_template() and build_category_template(). (string_hash, string_eq): New functions. (objc_build_string_object): Check metaclass correctness only once; store string literals in hash table. (objc_build_constructor): Do not convert initializer elements; adjust for ObjC++ impedance mismatch. (build_objc_symtab_template): Call create_field_decl() instead of create_builtin_decl(). (init_objc_symtab): Add missing conversion to initializer element. (build_metadata_decl): Call start_var_decl() instead of define_decl(). (generate_objc_symtab_decl): Do not call build_category_template(); call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(). (build_module_descriptor): Call create_field_decl() instead of grokfield(); call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(); always mark module descriptor as used; move GNU runtime-specific functionality to build_module_initializer_routine(). (build_module_initializer_routine): New function, broken off of build_module_descriptor(). (objc_static_init_needed_p, objc_generate_static_init_call): New functions. (generate_static_references, generate_strings, build_selector_translation_table, generate_descriptor_table, generate_ivars_list, generate_dispatch_table, generate_category): Call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(); build a type directly instead of via groktypename(). (build_selector_reference_decl, build_selector_table_decl, build_class_reference_decl, build_protocol_reference, generate_objc_image_info): Call start_var_decl() instead of build_decl(). (build_selector_reference): For GNU runtime, do not call build_selector_reference_decl(). (build_selector, build_typed_selector_reference): Always convert result to the selector type. (add_objc_string): Cast return value to 'char *'. (build_method_prototype_template, build_selector_template, build_method_template): Use actual selector type for fields pointing to selectors. (finish_objc): For GNU runtime, call build_module_initializer_routine() after build_module_descriptor(). (generate_protocol_list, generate_shared_structures): Call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(); build a type directly instead of via groktypename(). (synth_id_with_class_suffix): Return a string. (get_arg_type_list): For instance methods, use the instance type for 'self'; do not call groktypename_in_parm_context(). (build_objc_string_decl): Squash redeclaration errors in ObjC++. (objc_is_class_name): Use OBJC_TYPE_NAME instead of TYPE_NAME; handle RECORD_TYPEs in ObjC as well as ObjC++. (objc_is_id): New function. (objc_is_object_ptr): Return the canonical type node. (objc_get_class_ivars): Simplify using get_class_ivars(). (get_class_ivars): Remove second parameter; create a fresh copy of the ivar list for each call; do not check for existence of super class. (objc_eh_runtime_type): Mark #ifndef OBJCPLUS. (objc_init_exceptions): When using SJLJ-style exceptions, require the use of '-fobjc-exceptions' flag; do not require it for DWARF-style exceptions. (objc_build_exc_ptr, next_sjlj_build_try_catch_finally): Use objc_object_type instead of objc_id_type. (objc_begin_catch_clause): Convert the incoming PARM_DECL into a VAR_DECL before placing it in the appropriate scope; do not call define_decl(); adjust call to c_begin_compound_stmt(); use objc_object_type instead of objc_id_type. (build_next_objc_exception_stuff): Call create_field_decl() instead of create_builtin_decl(); construct type directly instead of calling groktypename(); use OBJC_VOID_AT_END to mark end of function parameters. (build_private_template): Adjust call to get_class_ivars(); build a type directly instead of via groktypename(). (build_protocol_template, build_method_prototype_list_template, build_method_prototype_template, build_category_template, build_selector_template, build_class_template, build_super_template, build_ivar_template, build_ivar_list_template, build_method_list_template, build_method_template): Call create_field_decl() instead of grokfield(). (objc_method_parm_type): Do not call groktypename(). (generate_descriptor_table): Call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(). (generate_method_descriptors, build_protocol_initializer, generate_dispatch_tables, build_category_initializer, build_shared_structure_initializer): Do not call groktypename(). (generate_protocols): Call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(); do not call groktypename(). (error_with_ivar): Remove last parameter. (check_ivars): Do not iterate ovar CLASS_RAW_IVARS lists in addition to CLASS_IVARS lists; adjust calls to error_with_ivar(). (generate_ivar_lists): Convert one of the initializer elements; do not call groktypename(). (get_arg_type_list, start_method_def, gen_method_def): Account for new representation of variable arguments and '...' in Objective-C methods; add Objective-C++ impedance matching code. (is_objc_type_qualifier): Remove function. (adjust_type_for_id_default): Simplify; there is no longer a need to wade through declspecs. (lookup_interface, start_class, continue_class, finish_class, start_method_def, start_protocol, build_method_decl, objc_add_method, add_instance_variable, build_ivar_reference, is_ivar, is_private, get_super_receiver, objc_build_finally_epilogue): Make into static functions. (receiver_is_class_object): Use new IS_CLASS() macro. (objc_build_message_expr): Tweak ObjC++ message argument handling; call objc_finish_message_expr() instead of finish_message_expr(). (finish_message_expr): Rename to objc_finish_message_expr(); use OBJC_TYPE_NAME and OBJC_SET_TYPE_NAME macros instead of TYPE_NAME. call gen_type_name() instead of gen_declaration(); call objc_is_id() instead of using IS_ID and IS_CLASS; Use objc_class_name instead of calling get_identifier("Class"); handle CONVERT_EXPRs in receiver. (build_objc_method_call, warn_with_method): Do not call groktypename(). (build_ivar_reference): Call convert() instead of clobbering in a type. (hash_init): Initialize string_htab hash table. (add_instance_variable): Simplify parameter list; do not call grokfield(); do not populate CLASS_IVARS list. (start_class): Check for the existence of super class, if one was specified. (continue_class): Use CLASS_RAW_IVARS rather than CLASS_IVARS; do not call build_class_template(); adjust call to get_class_ivars(); call build_decl(), pushdecl() and finish_decl() instead of define_decl(). (finish_class): Call build_decl(), pushdecl() and finish_decl() instead of define_decl(). (add_protocols): Use PROTOCOL_BINFO_ELTS for the tree vector size. (start_protocol): Do not call build_protocol_template(); use PROTOCOL_BINFO_ELTS for the tree vector size. (encode_type_qualifiers): Do not handle the 'const' qualifier here. (encode_pointer): Encode 'const char *' as 'r*', for backwards compatibility. (encode_array): Use HOST_WIDE_INT_PRINT_DEC instead of "%ld". (encode_type): Handle the 'const' qualifier here. (objc_parmlist): New global variable, sued by objc_push_parm and objc_get_parm_info(). (objc_push_parm, objc_get_parm_info): New functions. (objc_expr_last): Remove function. (synth_self_and_ucmd_args): For instance methods, use the instance type for 'self'; call objc_push_parm() instead of push_parm_decl(). (start_method_def): Do not call push_scope(), declare_parm_level(), pop_scope(), push_parm_decl(), store_parm_decls() or objc_expr_last(); just use objc_push_parm() and objc_get_parm_info(). (comp_method_with_proto): Remove function. (objc_types_are_equivalent): Strip away indirections before comparing underlying types. (comp_proto_with_proto): Do not call groktypename(); types are no longer in raw declspec format. (objc_start_function): New function. (really_start_method): Call comp_proto_with_proto() instead of comp_method_with_proto(); call objc_start_function() instead of hand-crafting a function declarator. (continue_method_def, objc_expand_function_end): Remove functions. (get_super_receiver): Call objc_get_current_scope() instead of get_current_scope(); reference 'super_class' field (instead of 'class'). (finish_method_def): Rename to objc_finish_method_definition() and add a function decl parameter; move method encoding call from objc_expand_function_end(). (is_complex_decl, adorn_decl, gen_declarator, gen_declspecs, gen_declaration_1): Remove functions. (tmpbuf, RAW_DECLSPEC): Remove. (gen_declaration): Remove second parameter; simplify to deal with TYPE_P nodes instead of raw declspecs. (gen_type_name, gen_type_name_0): New functions. (gen_method_decl): Remove second parameter; call gen_type_name() instead of gen_declaration_1(). (dump_interface): Adjust calls to gen_declaration() and gen_method_decl(); do not allocate a separate string buffer. (init_objc): Allocate a larger string buffer to accommodate dump_interface(); adjust call to build_module_descriptor(); add call to build_module_initializer_routine() for the GNU runtime. (generate_classref_translation_entry): Do not call start_decl(); call finish_var_decl() instead of finish_decl(); call convert() instead of build_c_cast(). * objc-act.h (CLASS_OWN_IVARS): Remove accessor. (CLASS_BINFO_ELTS): Reduce from 6 to 5, now that CLASS_OWN_IVARS is gone. (OCTI_GNU_INIT_DECL, GNU_INIT_decl): New. (OCTI_ELLIPSIS_NODE, objc_ellipsis_node): Remove. (OCTI_ID_ID, id_type, objc_id_id): Rename to OCTI_ID_NAME, objc_object_type and objc_object_name, respectively. (OCTI_CLS_REF, OCTI_CLASS_NAME, objc_class_reference, objc_class_name): New. (IS_CLASS): New macro. (IS_ID, IS_SUPER): Robustify. (OCTI_EXECCLASS_DECL, execclass_decl): New. (finish_file, start_class, continue_class, finish_class, start_method_def, continue_method_def, finish_method_def, start_protocol, finish_protocol, objc_build_throw_stmt, objc_build_try_catch_finally_stmt, objc_build_synchronized_prologue, objc_build_synchronized_epilogue, objc_build_try_prologue, objc_build_try_epilogue, objc_build_catch_stmt, objc_build_catch_epilogue, objc_build_finally_prologue, objc_build_finally_epilogue, is_ivar, is_private, is_public, add_instance_variable, objc_add_method, get_super_receiver, objc_clear_super_receiver, get_class_ivars_from_name, get_class_reference, get_static_reference, get_object_reference, build_message_expr, finish_message_expr, build_selector_expr, build_ivar_reference, build_keyword_decl, build_method_decl, build_protocol_expr, build_objc_string_object, objc_declare_alias, objc_declare_class, objc_declare_protocols, objc_comptypes, objc_check_decl, build_encode_expr): Remove prototypes. (imp_count, cat_count): Make GGC-aware. (OBJC_SET_TYPE_NAME): New macro. From-SVN: r87168
2004-09-08 02:49:44 +02:00
field_decl = create_field_decl (build_array_type (ptr_type_node, index),
"pointers");
chainon (field_decl_chain, field_decl);
finish_struct (objc_exception_data_template, field_decl_chain, NULL_TREE);
/* int _setjmp(...); */
/* If the user includes <setjmp.h>, this shall be superseded by
'int _setjmp(jmp_buf);' */
temp_type = build_function_type (integer_type_node, NULL_TREE);
objc_setjmp_decl
decl.c: Include langhooks.h. * gcc/java/decl.c: Include langhooks.h. (builtin_function): Remove. (java_init_decl_processing): Replace calls to builtin_function with add_builtin_function. * gcc/java/Make-lang.in (jc1$(exeext)): Depend on and link with attribs.o. (java/decl.o): Depend on langhooks.h. * gcc/java/java-tree.h (builtin_function): Remove. * gcc/tree.c (local_define_builtin): Replace calls to lang_hooks.builtin_function with add_builtin_function. * gcc/objc/objc-act.c (synth_module_prologue): Replace calls to builtin_function with add_builtin_function. (build_next_objc_exception_stuff): Replace calls to builtin_function with add_builtin_function. (build_objc_exception_stuff): Replace calls to builtin_function with add_builtin_function. * gcc/objcp/objcp-decl.h (objcp_builtin_function): Remove. * gcc/cp/decl.c (builtin_function_1): Move common code to add_builtin_function. (builtin_function): Rename to cxx_builtin_function. Change the signature. * gcc/cp/call.c: Include langhooks.h. (build_java_interface_fn_ref): Replace calls to builtin_function with add_builtin_function. * gcc/cp/Make-lang.in (cp/call.o): Depend on langhooks.h. * gcc/cp/cp-objcp-common.h (LANG_HOOKS_BUILTIN_FUNCTION): Define as cxx_builtin_function. * gcc/cp/cp-tree.h (builtin_function): Rename to cxx_builtin_function. Change the signature. * gcc/c-objc-common.h (LANG_HOOKS_BUILTIN_FUNCTION): Define as c_builtin_function. * gcc/c-tree.h (builtin_function): Rename to c_builtin_function. Change the signature. * gcc/ada/utils.c (builtin_function): Rename to gnat_builtin_function. Move common code to add_builtin_function. * gcc/ada/misc.c (LANG_HOOKS_BUILTIN_FUNCTION): Define as gnat_builtin_function. * gcc/ada/gigi.h (builtin_function): Rename to gnat_builtin_function. Change the signature. * gcc/c-decl.c (builtin_function): Rename to c_builtin_function. Move common code to add_builtin_function. * gcc/fortran/Make-lang.in (f951$(exeext)): Depend on and link with attribs.o. * gcc/fortran/trans.h (builtin_function): Rename to gfc_builtin_function. Change the signature. * gcc/fortran/f95-lang.c (LANG_HOOKS_BUILTIN_FUNCTION): Define as gfc_builtin_function. (builtin_function): Rename to gfc_builtin_function. Move common code to builtin_function. (gfc_define_builtin): Replace calls to builtin_function with gfc_define_builtin. * gcc/langhooks.c (add_builtin_function): New function. (lhd_builtin_function): New function. * gcc/langhooks.h (struct lang_hooks): Change the signature of builtin_function. (add_builtin_function): New function. * gcc/treelang/treetree.c (builtin_function): Remove. * gcc/tree-ssa-loop-prefetch.c (tree_ssa_prefetch_arrays): Replace calls to lang_hooks.builtin_function with add_builtin_function. * gcc/c-common.c (decl_builtin_1): Replace calls to lang_hooks.builtin_function with add_builtin_function. * gcc/config/alpha/alpha.c (alpha_init_builtins): Replace calls to lang_hooks.builtin_function with add_builtin_function. * gcc/config/frv/frv.c (def_builtin): Replace calls to lang_hooks.builtin_function with add_builtin_function. * gcc/config/s390/s390.c (s390_init_builtins): Replace calls to lang_hooks.builtin_function with add_builtin_function. * gcc/config/sparc/sparc.c (def_builtin): Replace calls to lang_hooks.builtin_function with add_builtin_function. * gcc/config/i386/i386.c (def_builtin): Replace calls to lang_hooks.builtin_function with add_builtin_function. (def_builtin): Replace calls to lang_hooks.builtin_function with add_builtin_function. * gcc/config/sh/sh.c (sh_media_init_builtins): Replace calls to lang_hooks.builtin_function with add_builtin_function. * gcc/config/c4x/c4x.c (c4x_init_builtins): Replace calls to lang_hooks.builtin_function with add_builtin_function. * gcc/config/stormy16/stormy16.c (xstormy16_init_builtins): Replace calls to lang_hooks.builtin_function with add_builtin_function. * gcc/config/iq2000/iq2000.c (def_builtin): Replace calls to lang_hooks.builtin_function with add_builtin_function. * gcc/config/ia64/ia64.c (def_builtin): Replace calls to lang_hooks.builtin_function with add_builtin_function. * gcc/config/rs6000/rs6000.c (def_builtin): Replace calls to lang_hooks.builtin_function with add_builtin_function. (altivec_init_builtins): Replace calls to lang_hooks.builtin_function with add_builtin_function. * gcc/config/arm/arm.c (def_mbuiltin): Replace calls to lang_hooks.builtin_function with add_builtin_function. (arm_init_tls_builtins): Replace calls to lang_hooks.builtin_function with add_builtin_function. * gcc/config/mips/mips.c (mips_init_builtins): Replace calls to lang_hooks.builtin_function with add_builtin_function. * gcc/config/bfin/bfin.c (def_builtin): Replace calls to lang_hooks.builtin_function with add_builtin_function. * gcc/langhooks-def.h (lhd_builtin_function): New function. (LANG_HOOKS_BUILTIN_FUNCTION): Define as lhd_builtin_function. From-SVN: r117981
2006-10-23 21:47:58 +02:00
= add_builtin_function (TAG_SETJMP, temp_type, 0, NOT_BUILT_IN, NULL, NULL_TREE);
/* id objc_exception_extract(struct _objc_exception_data *); */
temp_type
Makefile.in (c-parse.o): Depend on $(C_COMMON_H). [gcc/ChangeLog] 2004-09-07 Ziemowit Laski <zlaski@apple.com> * Makefile.in (c-parse.o): Depend on $(C_COMMON_H). * c-parse.in: Include c-common.h instead of objc-act.h. (ivar_decl_list, ivar_decls, ivar_decl, ivars, ivar_declarator, myparms, myparm): Remove %type declarations. (methodtype, optparms, OBJC_TYPE_QUAL, objc_quals, objc_qual, objc_typename, objc_try_catch_stmt, optellipsis): Add %type declarations. (objc_inherit_code, objc_public_flag): Remove. (typespec_nonreserved_nonattr): Call objc_get_protocol_qualified_type() instead of get_static_reference() and get_protocol_reference(). (stmt_nocomp): Call grokparm() on @catch parameter. (objcdef): Move semantic action to objc_finish_implementation(). (classdef): Move semantic action to objc_start_class_interface(), objc_continue_interface(), objc_finish_interface(), objc_start_class_implementation(), objc_continue_implementation(), objc_start_category_interface() and objc_start_category_implementation(). (protocoldef): Move semantic actions to objc_start_protocol() and objc_finish_interface(). (ivar_decl_list): Remove nonterminal. (visibility_spec): Move semantic actions to objc_set_visibility(). (ivar_decls): Remove assignment to $$. (ivar_decl): Rephrase in terms of component_decl; call objc_add_instance_variable(). (ivars, ivar_declarator): Remove nonterminals. (opt_semi): New nonterminal. (methodtype): Remove semantic actions. (methoddef): Move semantic actions to objc_set_method_type(), objc_start_method_definition() and objc_finish_method_definition(). (methodproto): Move semantic actions to objc_set_method_type() and objc_add_method_declaration(). (methoddecl): Use objc_typename instead of typename; move semantic actions to objc_build_method_signature(). (optarglist, myxdecls, mydecl, myparms, myparm): Remove nonterminals. (optparmlist): Express in terms of optparms and optellipsis. (optparms, optellipsis, objc_qual, objc_quals, objc_typename): New nonterminals. (keyworddecl): Use objc_typename instead of typename. (rid_to_yy): Mark RID_IN, RID_OUT, RID_INOUT, RID_BYCOPY, RID_BYREF and RID_ONEWAY as returning OBJC_TYPE_QUAL to yyparse(). [gcc/objc/ChangeLog] 2004-09-07 Ziemowit Laski <zlaski@apple.com> * Make-lang.in (objc/objc-parse.o): Depend on $(C_COMMON_H) instead of objc/objc-act.h. (objc/objc-act.o): Depend on $(HASHTAB_H). * objc-act.c: Include hashtab.h; in ObjC++ mode, include cp-tree.h and objcp-decl.h instead of c-tree.h. (build_module_descriptor, get_class_ivars, synth_id_with_class_suffix, error_with_ivar, gen_method_decl, gen_declaration, setup_string_decl, build_protocol_template): Adjust prototypes. (build_module_initializer_routine, start_class, continue_class, finish_class, start_method_def, objc_start_function, start_protocol, build_method_decl, objc_add_method, add_instance_variable, build_ivar_reference, is_ivar, is_private, get_super_receiver, build_selector_table_decl, objc_push_parm, objc_get_parm_info, gen_type_name, gen_type_name_0, start_var_decl, finish_var_decl, create_field_decl): New prototypes. (objc_expand_function_end, comp_method_with_proto, objc_expr_last, gen_declaration_1, gen_declarator, is_complex_decl, adorn_decl, define_decl, create_builtin_decl, gen_declspecs): Remove prototypes. (TYPE_ID): Rename to OBJECT_TYPEDEF_NAME. (CLASS_TYPEDEF_NAME): New. (TAG_EXECCLASS): Change from a global variable to a #define. (TAG_RETURN_STRUCT): Delete. (TAG_GNUINIT): New, holds '__objc_gnu_init' name. (objc_inherit_code, objc_public_flag): New, moved from c-parse.in. (string_descriptor): New struct. (string_htab): New hash table. (string_hash, string_eq): New prototypes. (generate_struct_by_value_array): Call create_field_decl() instead of create_builtin_decl(). (objc_init): Do not initialize objc_ellipsis_node or TAG_EXECCLASS; In ObjC++ mode, call cxx_init() instead of c_objc_common_init(). (objc_finish_file): In ObjC++, call instantiate_pending_templates() and cp_finish_file(). (define_decl, get_static_reference, get_protocol_reference, create_builtin_decl): Remove functions. (objc_start_class_interface, objc_start_category_interface, objc_start_protocol, objc_continue_interface, objc_finish_interface, objc_start_class_implementation, objc_start_category_implementation, objc_continue_implementation, objc_finish_implementation, objc_set_visibility, objc_set_method_type, objc_build_method_signature, objc_add_method_declaration, objc_start_method_definition, objc_add_instance_variable, objc_get_protocol_qualified_type, create_field_decl, start_var_decl, finish_var_decl): New functions. (setup_string_decl): Simplify since it is only called once. (synth_module_prologue): Call build_class_template(); predefine 'id' and 'Class' as typedefs; rename 'temp_type' to 'type'; disable debug hooks for duration of function; fix GNU runtime messenger signatures to correspond to reality; forward-declare '__objc_exec_class' for the GNU runtime; call build_selector_table_decl(); in ObjC++ mode, generate 'extern "C" { ... }' wrappers around synthesized declarations; call build_protocol_template() and build_category_template(). (string_hash, string_eq): New functions. (objc_build_string_object): Check metaclass correctness only once; store string literals in hash table. (objc_build_constructor): Do not convert initializer elements; adjust for ObjC++ impedance mismatch. (build_objc_symtab_template): Call create_field_decl() instead of create_builtin_decl(). (init_objc_symtab): Add missing conversion to initializer element. (build_metadata_decl): Call start_var_decl() instead of define_decl(). (generate_objc_symtab_decl): Do not call build_category_template(); call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(). (build_module_descriptor): Call create_field_decl() instead of grokfield(); call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(); always mark module descriptor as used; move GNU runtime-specific functionality to build_module_initializer_routine(). (build_module_initializer_routine): New function, broken off of build_module_descriptor(). (objc_static_init_needed_p, objc_generate_static_init_call): New functions. (generate_static_references, generate_strings, build_selector_translation_table, generate_descriptor_table, generate_ivars_list, generate_dispatch_table, generate_category): Call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(); build a type directly instead of via groktypename(). (build_selector_reference_decl, build_selector_table_decl, build_class_reference_decl, build_protocol_reference, generate_objc_image_info): Call start_var_decl() instead of build_decl(). (build_selector_reference): For GNU runtime, do not call build_selector_reference_decl(). (build_selector, build_typed_selector_reference): Always convert result to the selector type. (add_objc_string): Cast return value to 'char *'. (build_method_prototype_template, build_selector_template, build_method_template): Use actual selector type for fields pointing to selectors. (finish_objc): For GNU runtime, call build_module_initializer_routine() after build_module_descriptor(). (generate_protocol_list, generate_shared_structures): Call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(); build a type directly instead of via groktypename(). (synth_id_with_class_suffix): Return a string. (get_arg_type_list): For instance methods, use the instance type for 'self'; do not call groktypename_in_parm_context(). (build_objc_string_decl): Squash redeclaration errors in ObjC++. (objc_is_class_name): Use OBJC_TYPE_NAME instead of TYPE_NAME; handle RECORD_TYPEs in ObjC as well as ObjC++. (objc_is_id): New function. (objc_is_object_ptr): Return the canonical type node. (objc_get_class_ivars): Simplify using get_class_ivars(). (get_class_ivars): Remove second parameter; create a fresh copy of the ivar list for each call; do not check for existence of super class. (objc_eh_runtime_type): Mark #ifndef OBJCPLUS. (objc_init_exceptions): When using SJLJ-style exceptions, require the use of '-fobjc-exceptions' flag; do not require it for DWARF-style exceptions. (objc_build_exc_ptr, next_sjlj_build_try_catch_finally): Use objc_object_type instead of objc_id_type. (objc_begin_catch_clause): Convert the incoming PARM_DECL into a VAR_DECL before placing it in the appropriate scope; do not call define_decl(); adjust call to c_begin_compound_stmt(); use objc_object_type instead of objc_id_type. (build_next_objc_exception_stuff): Call create_field_decl() instead of create_builtin_decl(); construct type directly instead of calling groktypename(); use OBJC_VOID_AT_END to mark end of function parameters. (build_private_template): Adjust call to get_class_ivars(); build a type directly instead of via groktypename(). (build_protocol_template, build_method_prototype_list_template, build_method_prototype_template, build_category_template, build_selector_template, build_class_template, build_super_template, build_ivar_template, build_ivar_list_template, build_method_list_template, build_method_template): Call create_field_decl() instead of grokfield(). (objc_method_parm_type): Do not call groktypename(). (generate_descriptor_table): Call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(). (generate_method_descriptors, build_protocol_initializer, generate_dispatch_tables, build_category_initializer, build_shared_structure_initializer): Do not call groktypename(). (generate_protocols): Call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(); do not call groktypename(). (error_with_ivar): Remove last parameter. (check_ivars): Do not iterate ovar CLASS_RAW_IVARS lists in addition to CLASS_IVARS lists; adjust calls to error_with_ivar(). (generate_ivar_lists): Convert one of the initializer elements; do not call groktypename(). (get_arg_type_list, start_method_def, gen_method_def): Account for new representation of variable arguments and '...' in Objective-C methods; add Objective-C++ impedance matching code. (is_objc_type_qualifier): Remove function. (adjust_type_for_id_default): Simplify; there is no longer a need to wade through declspecs. (lookup_interface, start_class, continue_class, finish_class, start_method_def, start_protocol, build_method_decl, objc_add_method, add_instance_variable, build_ivar_reference, is_ivar, is_private, get_super_receiver, objc_build_finally_epilogue): Make into static functions. (receiver_is_class_object): Use new IS_CLASS() macro. (objc_build_message_expr): Tweak ObjC++ message argument handling; call objc_finish_message_expr() instead of finish_message_expr(). (finish_message_expr): Rename to objc_finish_message_expr(); use OBJC_TYPE_NAME and OBJC_SET_TYPE_NAME macros instead of TYPE_NAME. call gen_type_name() instead of gen_declaration(); call objc_is_id() instead of using IS_ID and IS_CLASS; Use objc_class_name instead of calling get_identifier("Class"); handle CONVERT_EXPRs in receiver. (build_objc_method_call, warn_with_method): Do not call groktypename(). (build_ivar_reference): Call convert() instead of clobbering in a type. (hash_init): Initialize string_htab hash table. (add_instance_variable): Simplify parameter list; do not call grokfield(); do not populate CLASS_IVARS list. (start_class): Check for the existence of super class, if one was specified. (continue_class): Use CLASS_RAW_IVARS rather than CLASS_IVARS; do not call build_class_template(); adjust call to get_class_ivars(); call build_decl(), pushdecl() and finish_decl() instead of define_decl(). (finish_class): Call build_decl(), pushdecl() and finish_decl() instead of define_decl(). (add_protocols): Use PROTOCOL_BINFO_ELTS for the tree vector size. (start_protocol): Do not call build_protocol_template(); use PROTOCOL_BINFO_ELTS for the tree vector size. (encode_type_qualifiers): Do not handle the 'const' qualifier here. (encode_pointer): Encode 'const char *' as 'r*', for backwards compatibility. (encode_array): Use HOST_WIDE_INT_PRINT_DEC instead of "%ld". (encode_type): Handle the 'const' qualifier here. (objc_parmlist): New global variable, sued by objc_push_parm and objc_get_parm_info(). (objc_push_parm, objc_get_parm_info): New functions. (objc_expr_last): Remove function. (synth_self_and_ucmd_args): For instance methods, use the instance type for 'self'; call objc_push_parm() instead of push_parm_decl(). (start_method_def): Do not call push_scope(), declare_parm_level(), pop_scope(), push_parm_decl(), store_parm_decls() or objc_expr_last(); just use objc_push_parm() and objc_get_parm_info(). (comp_method_with_proto): Remove function. (objc_types_are_equivalent): Strip away indirections before comparing underlying types. (comp_proto_with_proto): Do not call groktypename(); types are no longer in raw declspec format. (objc_start_function): New function. (really_start_method): Call comp_proto_with_proto() instead of comp_method_with_proto(); call objc_start_function() instead of hand-crafting a function declarator. (continue_method_def, objc_expand_function_end): Remove functions. (get_super_receiver): Call objc_get_current_scope() instead of get_current_scope(); reference 'super_class' field (instead of 'class'). (finish_method_def): Rename to objc_finish_method_definition() and add a function decl parameter; move method encoding call from objc_expand_function_end(). (is_complex_decl, adorn_decl, gen_declarator, gen_declspecs, gen_declaration_1): Remove functions. (tmpbuf, RAW_DECLSPEC): Remove. (gen_declaration): Remove second parameter; simplify to deal with TYPE_P nodes instead of raw declspecs. (gen_type_name, gen_type_name_0): New functions. (gen_method_decl): Remove second parameter; call gen_type_name() instead of gen_declaration_1(). (dump_interface): Adjust calls to gen_declaration() and gen_method_decl(); do not allocate a separate string buffer. (init_objc): Allocate a larger string buffer to accommodate dump_interface(); adjust call to build_module_descriptor(); add call to build_module_initializer_routine() for the GNU runtime. (generate_classref_translation_entry): Do not call start_decl(); call finish_var_decl() instead of finish_decl(); call convert() instead of build_c_cast(). * objc-act.h (CLASS_OWN_IVARS): Remove accessor. (CLASS_BINFO_ELTS): Reduce from 6 to 5, now that CLASS_OWN_IVARS is gone. (OCTI_GNU_INIT_DECL, GNU_INIT_decl): New. (OCTI_ELLIPSIS_NODE, objc_ellipsis_node): Remove. (OCTI_ID_ID, id_type, objc_id_id): Rename to OCTI_ID_NAME, objc_object_type and objc_object_name, respectively. (OCTI_CLS_REF, OCTI_CLASS_NAME, objc_class_reference, objc_class_name): New. (IS_CLASS): New macro. (IS_ID, IS_SUPER): Robustify. (OCTI_EXECCLASS_DECL, execclass_decl): New. (finish_file, start_class, continue_class, finish_class, start_method_def, continue_method_def, finish_method_def, start_protocol, finish_protocol, objc_build_throw_stmt, objc_build_try_catch_finally_stmt, objc_build_synchronized_prologue, objc_build_synchronized_epilogue, objc_build_try_prologue, objc_build_try_epilogue, objc_build_catch_stmt, objc_build_catch_epilogue, objc_build_finally_prologue, objc_build_finally_epilogue, is_ivar, is_private, is_public, add_instance_variable, objc_add_method, get_super_receiver, objc_clear_super_receiver, get_class_ivars_from_name, get_class_reference, get_static_reference, get_object_reference, build_message_expr, finish_message_expr, build_selector_expr, build_ivar_reference, build_keyword_decl, build_method_decl, build_protocol_expr, build_objc_string_object, objc_declare_alias, objc_declare_class, objc_declare_protocols, objc_comptypes, objc_check_decl, build_encode_expr): Remove prototypes. (imp_count, cat_count): Make GGC-aware. (OBJC_SET_TYPE_NAME): New macro. From-SVN: r87168
2004-09-08 02:49:44 +02:00
= build_function_type (objc_object_type,
tree_cons (NULL_TREE,
build_pointer_type (objc_exception_data_template),
Makefile.in (c-parse.o): Depend on $(C_COMMON_H). [gcc/ChangeLog] 2004-09-07 Ziemowit Laski <zlaski@apple.com> * Makefile.in (c-parse.o): Depend on $(C_COMMON_H). * c-parse.in: Include c-common.h instead of objc-act.h. (ivar_decl_list, ivar_decls, ivar_decl, ivars, ivar_declarator, myparms, myparm): Remove %type declarations. (methodtype, optparms, OBJC_TYPE_QUAL, objc_quals, objc_qual, objc_typename, objc_try_catch_stmt, optellipsis): Add %type declarations. (objc_inherit_code, objc_public_flag): Remove. (typespec_nonreserved_nonattr): Call objc_get_protocol_qualified_type() instead of get_static_reference() and get_protocol_reference(). (stmt_nocomp): Call grokparm() on @catch parameter. (objcdef): Move semantic action to objc_finish_implementation(). (classdef): Move semantic action to objc_start_class_interface(), objc_continue_interface(), objc_finish_interface(), objc_start_class_implementation(), objc_continue_implementation(), objc_start_category_interface() and objc_start_category_implementation(). (protocoldef): Move semantic actions to objc_start_protocol() and objc_finish_interface(). (ivar_decl_list): Remove nonterminal. (visibility_spec): Move semantic actions to objc_set_visibility(). (ivar_decls): Remove assignment to $$. (ivar_decl): Rephrase in terms of component_decl; call objc_add_instance_variable(). (ivars, ivar_declarator): Remove nonterminals. (opt_semi): New nonterminal. (methodtype): Remove semantic actions. (methoddef): Move semantic actions to objc_set_method_type(), objc_start_method_definition() and objc_finish_method_definition(). (methodproto): Move semantic actions to objc_set_method_type() and objc_add_method_declaration(). (methoddecl): Use objc_typename instead of typename; move semantic actions to objc_build_method_signature(). (optarglist, myxdecls, mydecl, myparms, myparm): Remove nonterminals. (optparmlist): Express in terms of optparms and optellipsis. (optparms, optellipsis, objc_qual, objc_quals, objc_typename): New nonterminals. (keyworddecl): Use objc_typename instead of typename. (rid_to_yy): Mark RID_IN, RID_OUT, RID_INOUT, RID_BYCOPY, RID_BYREF and RID_ONEWAY as returning OBJC_TYPE_QUAL to yyparse(). [gcc/objc/ChangeLog] 2004-09-07 Ziemowit Laski <zlaski@apple.com> * Make-lang.in (objc/objc-parse.o): Depend on $(C_COMMON_H) instead of objc/objc-act.h. (objc/objc-act.o): Depend on $(HASHTAB_H). * objc-act.c: Include hashtab.h; in ObjC++ mode, include cp-tree.h and objcp-decl.h instead of c-tree.h. (build_module_descriptor, get_class_ivars, synth_id_with_class_suffix, error_with_ivar, gen_method_decl, gen_declaration, setup_string_decl, build_protocol_template): Adjust prototypes. (build_module_initializer_routine, start_class, continue_class, finish_class, start_method_def, objc_start_function, start_protocol, build_method_decl, objc_add_method, add_instance_variable, build_ivar_reference, is_ivar, is_private, get_super_receiver, build_selector_table_decl, objc_push_parm, objc_get_parm_info, gen_type_name, gen_type_name_0, start_var_decl, finish_var_decl, create_field_decl): New prototypes. (objc_expand_function_end, comp_method_with_proto, objc_expr_last, gen_declaration_1, gen_declarator, is_complex_decl, adorn_decl, define_decl, create_builtin_decl, gen_declspecs): Remove prototypes. (TYPE_ID): Rename to OBJECT_TYPEDEF_NAME. (CLASS_TYPEDEF_NAME): New. (TAG_EXECCLASS): Change from a global variable to a #define. (TAG_RETURN_STRUCT): Delete. (TAG_GNUINIT): New, holds '__objc_gnu_init' name. (objc_inherit_code, objc_public_flag): New, moved from c-parse.in. (string_descriptor): New struct. (string_htab): New hash table. (string_hash, string_eq): New prototypes. (generate_struct_by_value_array): Call create_field_decl() instead of create_builtin_decl(). (objc_init): Do not initialize objc_ellipsis_node or TAG_EXECCLASS; In ObjC++ mode, call cxx_init() instead of c_objc_common_init(). (objc_finish_file): In ObjC++, call instantiate_pending_templates() and cp_finish_file(). (define_decl, get_static_reference, get_protocol_reference, create_builtin_decl): Remove functions. (objc_start_class_interface, objc_start_category_interface, objc_start_protocol, objc_continue_interface, objc_finish_interface, objc_start_class_implementation, objc_start_category_implementation, objc_continue_implementation, objc_finish_implementation, objc_set_visibility, objc_set_method_type, objc_build_method_signature, objc_add_method_declaration, objc_start_method_definition, objc_add_instance_variable, objc_get_protocol_qualified_type, create_field_decl, start_var_decl, finish_var_decl): New functions. (setup_string_decl): Simplify since it is only called once. (synth_module_prologue): Call build_class_template(); predefine 'id' and 'Class' as typedefs; rename 'temp_type' to 'type'; disable debug hooks for duration of function; fix GNU runtime messenger signatures to correspond to reality; forward-declare '__objc_exec_class' for the GNU runtime; call build_selector_table_decl(); in ObjC++ mode, generate 'extern "C" { ... }' wrappers around synthesized declarations; call build_protocol_template() and build_category_template(). (string_hash, string_eq): New functions. (objc_build_string_object): Check metaclass correctness only once; store string literals in hash table. (objc_build_constructor): Do not convert initializer elements; adjust for ObjC++ impedance mismatch. (build_objc_symtab_template): Call create_field_decl() instead of create_builtin_decl(). (init_objc_symtab): Add missing conversion to initializer element. (build_metadata_decl): Call start_var_decl() instead of define_decl(). (generate_objc_symtab_decl): Do not call build_category_template(); call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(). (build_module_descriptor): Call create_field_decl() instead of grokfield(); call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(); always mark module descriptor as used; move GNU runtime-specific functionality to build_module_initializer_routine(). (build_module_initializer_routine): New function, broken off of build_module_descriptor(). (objc_static_init_needed_p, objc_generate_static_init_call): New functions. (generate_static_references, generate_strings, build_selector_translation_table, generate_descriptor_table, generate_ivars_list, generate_dispatch_table, generate_category): Call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(); build a type directly instead of via groktypename(). (build_selector_reference_decl, build_selector_table_decl, build_class_reference_decl, build_protocol_reference, generate_objc_image_info): Call start_var_decl() instead of build_decl(). (build_selector_reference): For GNU runtime, do not call build_selector_reference_decl(). (build_selector, build_typed_selector_reference): Always convert result to the selector type. (add_objc_string): Cast return value to 'char *'. (build_method_prototype_template, build_selector_template, build_method_template): Use actual selector type for fields pointing to selectors. (finish_objc): For GNU runtime, call build_module_initializer_routine() after build_module_descriptor(). (generate_protocol_list, generate_shared_structures): Call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(); build a type directly instead of via groktypename(). (synth_id_with_class_suffix): Return a string. (get_arg_type_list): For instance methods, use the instance type for 'self'; do not call groktypename_in_parm_context(). (build_objc_string_decl): Squash redeclaration errors in ObjC++. (objc_is_class_name): Use OBJC_TYPE_NAME instead of TYPE_NAME; handle RECORD_TYPEs in ObjC as well as ObjC++. (objc_is_id): New function. (objc_is_object_ptr): Return the canonical type node. (objc_get_class_ivars): Simplify using get_class_ivars(). (get_class_ivars): Remove second parameter; create a fresh copy of the ivar list for each call; do not check for existence of super class. (objc_eh_runtime_type): Mark #ifndef OBJCPLUS. (objc_init_exceptions): When using SJLJ-style exceptions, require the use of '-fobjc-exceptions' flag; do not require it for DWARF-style exceptions. (objc_build_exc_ptr, next_sjlj_build_try_catch_finally): Use objc_object_type instead of objc_id_type. (objc_begin_catch_clause): Convert the incoming PARM_DECL into a VAR_DECL before placing it in the appropriate scope; do not call define_decl(); adjust call to c_begin_compound_stmt(); use objc_object_type instead of objc_id_type. (build_next_objc_exception_stuff): Call create_field_decl() instead of create_builtin_decl(); construct type directly instead of calling groktypename(); use OBJC_VOID_AT_END to mark end of function parameters. (build_private_template): Adjust call to get_class_ivars(); build a type directly instead of via groktypename(). (build_protocol_template, build_method_prototype_list_template, build_method_prototype_template, build_category_template, build_selector_template, build_class_template, build_super_template, build_ivar_template, build_ivar_list_template, build_method_list_template, build_method_template): Call create_field_decl() instead of grokfield(). (objc_method_parm_type): Do not call groktypename(). (generate_descriptor_table): Call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(). (generate_method_descriptors, build_protocol_initializer, generate_dispatch_tables, build_category_initializer, build_shared_structure_initializer): Do not call groktypename(). (generate_protocols): Call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(); do not call groktypename(). (error_with_ivar): Remove last parameter. (check_ivars): Do not iterate ovar CLASS_RAW_IVARS lists in addition to CLASS_IVARS lists; adjust calls to error_with_ivar(). (generate_ivar_lists): Convert one of the initializer elements; do not call groktypename(). (get_arg_type_list, start_method_def, gen_method_def): Account for new representation of variable arguments and '...' in Objective-C methods; add Objective-C++ impedance matching code. (is_objc_type_qualifier): Remove function. (adjust_type_for_id_default): Simplify; there is no longer a need to wade through declspecs. (lookup_interface, start_class, continue_class, finish_class, start_method_def, start_protocol, build_method_decl, objc_add_method, add_instance_variable, build_ivar_reference, is_ivar, is_private, get_super_receiver, objc_build_finally_epilogue): Make into static functions. (receiver_is_class_object): Use new IS_CLASS() macro. (objc_build_message_expr): Tweak ObjC++ message argument handling; call objc_finish_message_expr() instead of finish_message_expr(). (finish_message_expr): Rename to objc_finish_message_expr(); use OBJC_TYPE_NAME and OBJC_SET_TYPE_NAME macros instead of TYPE_NAME. call gen_type_name() instead of gen_declaration(); call objc_is_id() instead of using IS_ID and IS_CLASS; Use objc_class_name instead of calling get_identifier("Class"); handle CONVERT_EXPRs in receiver. (build_objc_method_call, warn_with_method): Do not call groktypename(). (build_ivar_reference): Call convert() instead of clobbering in a type. (hash_init): Initialize string_htab hash table. (add_instance_variable): Simplify parameter list; do not call grokfield(); do not populate CLASS_IVARS list. (start_class): Check for the existence of super class, if one was specified. (continue_class): Use CLASS_RAW_IVARS rather than CLASS_IVARS; do not call build_class_template(); adjust call to get_class_ivars(); call build_decl(), pushdecl() and finish_decl() instead of define_decl(). (finish_class): Call build_decl(), pushdecl() and finish_decl() instead of define_decl(). (add_protocols): Use PROTOCOL_BINFO_ELTS for the tree vector size. (start_protocol): Do not call build_protocol_template(); use PROTOCOL_BINFO_ELTS for the tree vector size. (encode_type_qualifiers): Do not handle the 'const' qualifier here. (encode_pointer): Encode 'const char *' as 'r*', for backwards compatibility. (encode_array): Use HOST_WIDE_INT_PRINT_DEC instead of "%ld". (encode_type): Handle the 'const' qualifier here. (objc_parmlist): New global variable, sued by objc_push_parm and objc_get_parm_info(). (objc_push_parm, objc_get_parm_info): New functions. (objc_expr_last): Remove function. (synth_self_and_ucmd_args): For instance methods, use the instance type for 'self'; call objc_push_parm() instead of push_parm_decl(). (start_method_def): Do not call push_scope(), declare_parm_level(), pop_scope(), push_parm_decl(), store_parm_decls() or objc_expr_last(); just use objc_push_parm() and objc_get_parm_info(). (comp_method_with_proto): Remove function. (objc_types_are_equivalent): Strip away indirections before comparing underlying types. (comp_proto_with_proto): Do not call groktypename(); types are no longer in raw declspec format. (objc_start_function): New function. (really_start_method): Call comp_proto_with_proto() instead of comp_method_with_proto(); call objc_start_function() instead of hand-crafting a function declarator. (continue_method_def, objc_expand_function_end): Remove functions. (get_super_receiver): Call objc_get_current_scope() instead of get_current_scope(); reference 'super_class' field (instead of 'class'). (finish_method_def): Rename to objc_finish_method_definition() and add a function decl parameter; move method encoding call from objc_expand_function_end(). (is_complex_decl, adorn_decl, gen_declarator, gen_declspecs, gen_declaration_1): Remove functions. (tmpbuf, RAW_DECLSPEC): Remove. (gen_declaration): Remove second parameter; simplify to deal with TYPE_P nodes instead of raw declspecs. (gen_type_name, gen_type_name_0): New functions. (gen_method_decl): Remove second parameter; call gen_type_name() instead of gen_declaration_1(). (dump_interface): Adjust calls to gen_declaration() and gen_method_decl(); do not allocate a separate string buffer. (init_objc): Allocate a larger string buffer to accommodate dump_interface(); adjust call to build_module_descriptor(); add call to build_module_initializer_routine() for the GNU runtime. (generate_classref_translation_entry): Do not call start_decl(); call finish_var_decl() instead of finish_decl(); call convert() instead of build_c_cast(). * objc-act.h (CLASS_OWN_IVARS): Remove accessor. (CLASS_BINFO_ELTS): Reduce from 6 to 5, now that CLASS_OWN_IVARS is gone. (OCTI_GNU_INIT_DECL, GNU_INIT_decl): New. (OCTI_ELLIPSIS_NODE, objc_ellipsis_node): Remove. (OCTI_ID_ID, id_type, objc_id_id): Rename to OCTI_ID_NAME, objc_object_type and objc_object_name, respectively. (OCTI_CLS_REF, OCTI_CLASS_NAME, objc_class_reference, objc_class_name): New. (IS_CLASS): New macro. (IS_ID, IS_SUPER): Robustify. (OCTI_EXECCLASS_DECL, execclass_decl): New. (finish_file, start_class, continue_class, finish_class, start_method_def, continue_method_def, finish_method_def, start_protocol, finish_protocol, objc_build_throw_stmt, objc_build_try_catch_finally_stmt, objc_build_synchronized_prologue, objc_build_synchronized_epilogue, objc_build_try_prologue, objc_build_try_epilogue, objc_build_catch_stmt, objc_build_catch_epilogue, objc_build_finally_prologue, objc_build_finally_epilogue, is_ivar, is_private, is_public, add_instance_variable, objc_add_method, get_super_receiver, objc_clear_super_receiver, get_class_ivars_from_name, get_class_reference, get_static_reference, get_object_reference, build_message_expr, finish_message_expr, build_selector_expr, build_ivar_reference, build_keyword_decl, build_method_decl, build_protocol_expr, build_objc_string_object, objc_declare_alias, objc_declare_class, objc_declare_protocols, objc_comptypes, objc_check_decl, build_encode_expr): Remove prototypes. (imp_count, cat_count): Make GGC-aware. (OBJC_SET_TYPE_NAME): New macro. From-SVN: r87168
2004-09-08 02:49:44 +02:00
OBJC_VOID_AT_END));
objc_exception_extract_decl
decl.c: Include langhooks.h. * gcc/java/decl.c: Include langhooks.h. (builtin_function): Remove. (java_init_decl_processing): Replace calls to builtin_function with add_builtin_function. * gcc/java/Make-lang.in (jc1$(exeext)): Depend on and link with attribs.o. (java/decl.o): Depend on langhooks.h. * gcc/java/java-tree.h (builtin_function): Remove. * gcc/tree.c (local_define_builtin): Replace calls to lang_hooks.builtin_function with add_builtin_function. * gcc/objc/objc-act.c (synth_module_prologue): Replace calls to builtin_function with add_builtin_function. (build_next_objc_exception_stuff): Replace calls to builtin_function with add_builtin_function. (build_objc_exception_stuff): Replace calls to builtin_function with add_builtin_function. * gcc/objcp/objcp-decl.h (objcp_builtin_function): Remove. * gcc/cp/decl.c (builtin_function_1): Move common code to add_builtin_function. (builtin_function): Rename to cxx_builtin_function. Change the signature. * gcc/cp/call.c: Include langhooks.h. (build_java_interface_fn_ref): Replace calls to builtin_function with add_builtin_function. * gcc/cp/Make-lang.in (cp/call.o): Depend on langhooks.h. * gcc/cp/cp-objcp-common.h (LANG_HOOKS_BUILTIN_FUNCTION): Define as cxx_builtin_function. * gcc/cp/cp-tree.h (builtin_function): Rename to cxx_builtin_function. Change the signature. * gcc/c-objc-common.h (LANG_HOOKS_BUILTIN_FUNCTION): Define as c_builtin_function. * gcc/c-tree.h (builtin_function): Rename to c_builtin_function. Change the signature. * gcc/ada/utils.c (builtin_function): Rename to gnat_builtin_function. Move common code to add_builtin_function. * gcc/ada/misc.c (LANG_HOOKS_BUILTIN_FUNCTION): Define as gnat_builtin_function. * gcc/ada/gigi.h (builtin_function): Rename to gnat_builtin_function. Change the signature. * gcc/c-decl.c (builtin_function): Rename to c_builtin_function. Move common code to add_builtin_function. * gcc/fortran/Make-lang.in (f951$(exeext)): Depend on and link with attribs.o. * gcc/fortran/trans.h (builtin_function): Rename to gfc_builtin_function. Change the signature. * gcc/fortran/f95-lang.c (LANG_HOOKS_BUILTIN_FUNCTION): Define as gfc_builtin_function. (builtin_function): Rename to gfc_builtin_function. Move common code to builtin_function. (gfc_define_builtin): Replace calls to builtin_function with gfc_define_builtin. * gcc/langhooks.c (add_builtin_function): New function. (lhd_builtin_function): New function. * gcc/langhooks.h (struct lang_hooks): Change the signature of builtin_function. (add_builtin_function): New function. * gcc/treelang/treetree.c (builtin_function): Remove. * gcc/tree-ssa-loop-prefetch.c (tree_ssa_prefetch_arrays): Replace calls to lang_hooks.builtin_function with add_builtin_function. * gcc/c-common.c (decl_builtin_1): Replace calls to lang_hooks.builtin_function with add_builtin_function. * gcc/config/alpha/alpha.c (alpha_init_builtins): Replace calls to lang_hooks.builtin_function with add_builtin_function. * gcc/config/frv/frv.c (def_builtin): Replace calls to lang_hooks.builtin_function with add_builtin_function. * gcc/config/s390/s390.c (s390_init_builtins): Replace calls to lang_hooks.builtin_function with add_builtin_function. * gcc/config/sparc/sparc.c (def_builtin): Replace calls to lang_hooks.builtin_function with add_builtin_function. * gcc/config/i386/i386.c (def_builtin): Replace calls to lang_hooks.builtin_function with add_builtin_function. (def_builtin): Replace calls to lang_hooks.builtin_function with add_builtin_function. * gcc/config/sh/sh.c (sh_media_init_builtins): Replace calls to lang_hooks.builtin_function with add_builtin_function. * gcc/config/c4x/c4x.c (c4x_init_builtins): Replace calls to lang_hooks.builtin_function with add_builtin_function. * gcc/config/stormy16/stormy16.c (xstormy16_init_builtins): Replace calls to lang_hooks.builtin_function with add_builtin_function. * gcc/config/iq2000/iq2000.c (def_builtin): Replace calls to lang_hooks.builtin_function with add_builtin_function. * gcc/config/ia64/ia64.c (def_builtin): Replace calls to lang_hooks.builtin_function with add_builtin_function. * gcc/config/rs6000/rs6000.c (def_builtin): Replace calls to lang_hooks.builtin_function with add_builtin_function. (altivec_init_builtins): Replace calls to lang_hooks.builtin_function with add_builtin_function. * gcc/config/arm/arm.c (def_mbuiltin): Replace calls to lang_hooks.builtin_function with add_builtin_function. (arm_init_tls_builtins): Replace calls to lang_hooks.builtin_function with add_builtin_function. * gcc/config/mips/mips.c (mips_init_builtins): Replace calls to lang_hooks.builtin_function with add_builtin_function. * gcc/config/bfin/bfin.c (def_builtin): Replace calls to lang_hooks.builtin_function with add_builtin_function. * gcc/langhooks-def.h (lhd_builtin_function): New function. (LANG_HOOKS_BUILTIN_FUNCTION): Define as lhd_builtin_function. From-SVN: r117981
2006-10-23 21:47:58 +02:00
= add_builtin_function (TAG_EXCEPTIONEXTRACT, temp_type, 0, NOT_BUILT_IN, NULL,
NULL_TREE);
/* void objc_exception_try_enter(struct _objc_exception_data *); */
/* void objc_exception_try_exit(struct _objc_exception_data *); */
temp_type
= build_function_type (void_type_node,
tree_cons (NULL_TREE,
build_pointer_type (objc_exception_data_template),
Makefile.in (c-parse.o): Depend on $(C_COMMON_H). [gcc/ChangeLog] 2004-09-07 Ziemowit Laski <zlaski@apple.com> * Makefile.in (c-parse.o): Depend on $(C_COMMON_H). * c-parse.in: Include c-common.h instead of objc-act.h. (ivar_decl_list, ivar_decls, ivar_decl, ivars, ivar_declarator, myparms, myparm): Remove %type declarations. (methodtype, optparms, OBJC_TYPE_QUAL, objc_quals, objc_qual, objc_typename, objc_try_catch_stmt, optellipsis): Add %type declarations. (objc_inherit_code, objc_public_flag): Remove. (typespec_nonreserved_nonattr): Call objc_get_protocol_qualified_type() instead of get_static_reference() and get_protocol_reference(). (stmt_nocomp): Call grokparm() on @catch parameter. (objcdef): Move semantic action to objc_finish_implementation(). (classdef): Move semantic action to objc_start_class_interface(), objc_continue_interface(), objc_finish_interface(), objc_start_class_implementation(), objc_continue_implementation(), objc_start_category_interface() and objc_start_category_implementation(). (protocoldef): Move semantic actions to objc_start_protocol() and objc_finish_interface(). (ivar_decl_list): Remove nonterminal. (visibility_spec): Move semantic actions to objc_set_visibility(). (ivar_decls): Remove assignment to $$. (ivar_decl): Rephrase in terms of component_decl; call objc_add_instance_variable(). (ivars, ivar_declarator): Remove nonterminals. (opt_semi): New nonterminal. (methodtype): Remove semantic actions. (methoddef): Move semantic actions to objc_set_method_type(), objc_start_method_definition() and objc_finish_method_definition(). (methodproto): Move semantic actions to objc_set_method_type() and objc_add_method_declaration(). (methoddecl): Use objc_typename instead of typename; move semantic actions to objc_build_method_signature(). (optarglist, myxdecls, mydecl, myparms, myparm): Remove nonterminals. (optparmlist): Express in terms of optparms and optellipsis. (optparms, optellipsis, objc_qual, objc_quals, objc_typename): New nonterminals. (keyworddecl): Use objc_typename instead of typename. (rid_to_yy): Mark RID_IN, RID_OUT, RID_INOUT, RID_BYCOPY, RID_BYREF and RID_ONEWAY as returning OBJC_TYPE_QUAL to yyparse(). [gcc/objc/ChangeLog] 2004-09-07 Ziemowit Laski <zlaski@apple.com> * Make-lang.in (objc/objc-parse.o): Depend on $(C_COMMON_H) instead of objc/objc-act.h. (objc/objc-act.o): Depend on $(HASHTAB_H). * objc-act.c: Include hashtab.h; in ObjC++ mode, include cp-tree.h and objcp-decl.h instead of c-tree.h. (build_module_descriptor, get_class_ivars, synth_id_with_class_suffix, error_with_ivar, gen_method_decl, gen_declaration, setup_string_decl, build_protocol_template): Adjust prototypes. (build_module_initializer_routine, start_class, continue_class, finish_class, start_method_def, objc_start_function, start_protocol, build_method_decl, objc_add_method, add_instance_variable, build_ivar_reference, is_ivar, is_private, get_super_receiver, build_selector_table_decl, objc_push_parm, objc_get_parm_info, gen_type_name, gen_type_name_0, start_var_decl, finish_var_decl, create_field_decl): New prototypes. (objc_expand_function_end, comp_method_with_proto, objc_expr_last, gen_declaration_1, gen_declarator, is_complex_decl, adorn_decl, define_decl, create_builtin_decl, gen_declspecs): Remove prototypes. (TYPE_ID): Rename to OBJECT_TYPEDEF_NAME. (CLASS_TYPEDEF_NAME): New. (TAG_EXECCLASS): Change from a global variable to a #define. (TAG_RETURN_STRUCT): Delete. (TAG_GNUINIT): New, holds '__objc_gnu_init' name. (objc_inherit_code, objc_public_flag): New, moved from c-parse.in. (string_descriptor): New struct. (string_htab): New hash table. (string_hash, string_eq): New prototypes. (generate_struct_by_value_array): Call create_field_decl() instead of create_builtin_decl(). (objc_init): Do not initialize objc_ellipsis_node or TAG_EXECCLASS; In ObjC++ mode, call cxx_init() instead of c_objc_common_init(). (objc_finish_file): In ObjC++, call instantiate_pending_templates() and cp_finish_file(). (define_decl, get_static_reference, get_protocol_reference, create_builtin_decl): Remove functions. (objc_start_class_interface, objc_start_category_interface, objc_start_protocol, objc_continue_interface, objc_finish_interface, objc_start_class_implementation, objc_start_category_implementation, objc_continue_implementation, objc_finish_implementation, objc_set_visibility, objc_set_method_type, objc_build_method_signature, objc_add_method_declaration, objc_start_method_definition, objc_add_instance_variable, objc_get_protocol_qualified_type, create_field_decl, start_var_decl, finish_var_decl): New functions. (setup_string_decl): Simplify since it is only called once. (synth_module_prologue): Call build_class_template(); predefine 'id' and 'Class' as typedefs; rename 'temp_type' to 'type'; disable debug hooks for duration of function; fix GNU runtime messenger signatures to correspond to reality; forward-declare '__objc_exec_class' for the GNU runtime; call build_selector_table_decl(); in ObjC++ mode, generate 'extern "C" { ... }' wrappers around synthesized declarations; call build_protocol_template() and build_category_template(). (string_hash, string_eq): New functions. (objc_build_string_object): Check metaclass correctness only once; store string literals in hash table. (objc_build_constructor): Do not convert initializer elements; adjust for ObjC++ impedance mismatch. (build_objc_symtab_template): Call create_field_decl() instead of create_builtin_decl(). (init_objc_symtab): Add missing conversion to initializer element. (build_metadata_decl): Call start_var_decl() instead of define_decl(). (generate_objc_symtab_decl): Do not call build_category_template(); call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(). (build_module_descriptor): Call create_field_decl() instead of grokfield(); call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(); always mark module descriptor as used; move GNU runtime-specific functionality to build_module_initializer_routine(). (build_module_initializer_routine): New function, broken off of build_module_descriptor(). (objc_static_init_needed_p, objc_generate_static_init_call): New functions. (generate_static_references, generate_strings, build_selector_translation_table, generate_descriptor_table, generate_ivars_list, generate_dispatch_table, generate_category): Call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(); build a type directly instead of via groktypename(). (build_selector_reference_decl, build_selector_table_decl, build_class_reference_decl, build_protocol_reference, generate_objc_image_info): Call start_var_decl() instead of build_decl(). (build_selector_reference): For GNU runtime, do not call build_selector_reference_decl(). (build_selector, build_typed_selector_reference): Always convert result to the selector type. (add_objc_string): Cast return value to 'char *'. (build_method_prototype_template, build_selector_template, build_method_template): Use actual selector type for fields pointing to selectors. (finish_objc): For GNU runtime, call build_module_initializer_routine() after build_module_descriptor(). (generate_protocol_list, generate_shared_structures): Call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(); build a type directly instead of via groktypename(). (synth_id_with_class_suffix): Return a string. (get_arg_type_list): For instance methods, use the instance type for 'self'; do not call groktypename_in_parm_context(). (build_objc_string_decl): Squash redeclaration errors in ObjC++. (objc_is_class_name): Use OBJC_TYPE_NAME instead of TYPE_NAME; handle RECORD_TYPEs in ObjC as well as ObjC++. (objc_is_id): New function. (objc_is_object_ptr): Return the canonical type node. (objc_get_class_ivars): Simplify using get_class_ivars(). (get_class_ivars): Remove second parameter; create a fresh copy of the ivar list for each call; do not check for existence of super class. (objc_eh_runtime_type): Mark #ifndef OBJCPLUS. (objc_init_exceptions): When using SJLJ-style exceptions, require the use of '-fobjc-exceptions' flag; do not require it for DWARF-style exceptions. (objc_build_exc_ptr, next_sjlj_build_try_catch_finally): Use objc_object_type instead of objc_id_type. (objc_begin_catch_clause): Convert the incoming PARM_DECL into a VAR_DECL before placing it in the appropriate scope; do not call define_decl(); adjust call to c_begin_compound_stmt(); use objc_object_type instead of objc_id_type. (build_next_objc_exception_stuff): Call create_field_decl() instead of create_builtin_decl(); construct type directly instead of calling groktypename(); use OBJC_VOID_AT_END to mark end of function parameters. (build_private_template): Adjust call to get_class_ivars(); build a type directly instead of via groktypename(). (build_protocol_template, build_method_prototype_list_template, build_method_prototype_template, build_category_template, build_selector_template, build_class_template, build_super_template, build_ivar_template, build_ivar_list_template, build_method_list_template, build_method_template): Call create_field_decl() instead of grokfield(). (objc_method_parm_type): Do not call groktypename(). (generate_descriptor_table): Call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(). (generate_method_descriptors, build_protocol_initializer, generate_dispatch_tables, build_category_initializer, build_shared_structure_initializer): Do not call groktypename(). (generate_protocols): Call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(); do not call groktypename(). (error_with_ivar): Remove last parameter. (check_ivars): Do not iterate ovar CLASS_RAW_IVARS lists in addition to CLASS_IVARS lists; adjust calls to error_with_ivar(). (generate_ivar_lists): Convert one of the initializer elements; do not call groktypename(). (get_arg_type_list, start_method_def, gen_method_def): Account for new representation of variable arguments and '...' in Objective-C methods; add Objective-C++ impedance matching code. (is_objc_type_qualifier): Remove function. (adjust_type_for_id_default): Simplify; there is no longer a need to wade through declspecs. (lookup_interface, start_class, continue_class, finish_class, start_method_def, start_protocol, build_method_decl, objc_add_method, add_instance_variable, build_ivar_reference, is_ivar, is_private, get_super_receiver, objc_build_finally_epilogue): Make into static functions. (receiver_is_class_object): Use new IS_CLASS() macro. (objc_build_message_expr): Tweak ObjC++ message argument handling; call objc_finish_message_expr() instead of finish_message_expr(). (finish_message_expr): Rename to objc_finish_message_expr(); use OBJC_TYPE_NAME and OBJC_SET_TYPE_NAME macros instead of TYPE_NAME. call gen_type_name() instead of gen_declaration(); call objc_is_id() instead of using IS_ID and IS_CLASS; Use objc_class_name instead of calling get_identifier("Class"); handle CONVERT_EXPRs in receiver. (build_objc_method_call, warn_with_method): Do not call groktypename(). (build_ivar_reference): Call convert() instead of clobbering in a type. (hash_init): Initialize string_htab hash table. (add_instance_variable): Simplify parameter list; do not call grokfield(); do not populate CLASS_IVARS list. (start_class): Check for the existence of super class, if one was specified. (continue_class): Use CLASS_RAW_IVARS rather than CLASS_IVARS; do not call build_class_template(); adjust call to get_class_ivars(); call build_decl(), pushdecl() and finish_decl() instead of define_decl(). (finish_class): Call build_decl(), pushdecl() and finish_decl() instead of define_decl(). (add_protocols): Use PROTOCOL_BINFO_ELTS for the tree vector size. (start_protocol): Do not call build_protocol_template(); use PROTOCOL_BINFO_ELTS for the tree vector size. (encode_type_qualifiers): Do not handle the 'const' qualifier here. (encode_pointer): Encode 'const char *' as 'r*', for backwards compatibility. (encode_array): Use HOST_WIDE_INT_PRINT_DEC instead of "%ld". (encode_type): Handle the 'const' qualifier here. (objc_parmlist): New global variable, sued by objc_push_parm and objc_get_parm_info(). (objc_push_parm, objc_get_parm_info): New functions. (objc_expr_last): Remove function. (synth_self_and_ucmd_args): For instance methods, use the instance type for 'self'; call objc_push_parm() instead of push_parm_decl(). (start_method_def): Do not call push_scope(), declare_parm_level(), pop_scope(), push_parm_decl(), store_parm_decls() or objc_expr_last(); just use objc_push_parm() and objc_get_parm_info(). (comp_method_with_proto): Remove function. (objc_types_are_equivalent): Strip away indirections before comparing underlying types. (comp_proto_with_proto): Do not call groktypename(); types are no longer in raw declspec format. (objc_start_function): New function. (really_start_method): Call comp_proto_with_proto() instead of comp_method_with_proto(); call objc_start_function() instead of hand-crafting a function declarator. (continue_method_def, objc_expand_function_end): Remove functions. (get_super_receiver): Call objc_get_current_scope() instead of get_current_scope(); reference 'super_class' field (instead of 'class'). (finish_method_def): Rename to objc_finish_method_definition() and add a function decl parameter; move method encoding call from objc_expand_function_end(). (is_complex_decl, adorn_decl, gen_declarator, gen_declspecs, gen_declaration_1): Remove functions. (tmpbuf, RAW_DECLSPEC): Remove. (gen_declaration): Remove second parameter; simplify to deal with TYPE_P nodes instead of raw declspecs. (gen_type_name, gen_type_name_0): New functions. (gen_method_decl): Remove second parameter; call gen_type_name() instead of gen_declaration_1(). (dump_interface): Adjust calls to gen_declaration() and gen_method_decl(); do not allocate a separate string buffer. (init_objc): Allocate a larger string buffer to accommodate dump_interface(); adjust call to build_module_descriptor(); add call to build_module_initializer_routine() for the GNU runtime. (generate_classref_translation_entry): Do not call start_decl(); call finish_var_decl() instead of finish_decl(); call convert() instead of build_c_cast(). * objc-act.h (CLASS_OWN_IVARS): Remove accessor. (CLASS_BINFO_ELTS): Reduce from 6 to 5, now that CLASS_OWN_IVARS is gone. (OCTI_GNU_INIT_DECL, GNU_INIT_decl): New. (OCTI_ELLIPSIS_NODE, objc_ellipsis_node): Remove. (OCTI_ID_ID, id_type, objc_id_id): Rename to OCTI_ID_NAME, objc_object_type and objc_object_name, respectively. (OCTI_CLS_REF, OCTI_CLASS_NAME, objc_class_reference, objc_class_name): New. (IS_CLASS): New macro. (IS_ID, IS_SUPER): Robustify. (OCTI_EXECCLASS_DECL, execclass_decl): New. (finish_file, start_class, continue_class, finish_class, start_method_def, continue_method_def, finish_method_def, start_protocol, finish_protocol, objc_build_throw_stmt, objc_build_try_catch_finally_stmt, objc_build_synchronized_prologue, objc_build_synchronized_epilogue, objc_build_try_prologue, objc_build_try_epilogue, objc_build_catch_stmt, objc_build_catch_epilogue, objc_build_finally_prologue, objc_build_finally_epilogue, is_ivar, is_private, is_public, add_instance_variable, objc_add_method, get_super_receiver, objc_clear_super_receiver, get_class_ivars_from_name, get_class_reference, get_static_reference, get_object_reference, build_message_expr, finish_message_expr, build_selector_expr, build_ivar_reference, build_keyword_decl, build_method_decl, build_protocol_expr, build_objc_string_object, objc_declare_alias, objc_declare_class, objc_declare_protocols, objc_comptypes, objc_check_decl, build_encode_expr): Remove prototypes. (imp_count, cat_count): Make GGC-aware. (OBJC_SET_TYPE_NAME): New macro. From-SVN: r87168
2004-09-08 02:49:44 +02:00
OBJC_VOID_AT_END));
objc_exception_try_enter_decl
decl.c: Include langhooks.h. * gcc/java/decl.c: Include langhooks.h. (builtin_function): Remove. (java_init_decl_processing): Replace calls to builtin_function with add_builtin_function. * gcc/java/Make-lang.in (jc1$(exeext)): Depend on and link with attribs.o. (java/decl.o): Depend on langhooks.h. * gcc/java/java-tree.h (builtin_function): Remove. * gcc/tree.c (local_define_builtin): Replace calls to lang_hooks.builtin_function with add_builtin_function. * gcc/objc/objc-act.c (synth_module_prologue): Replace calls to builtin_function with add_builtin_function. (build_next_objc_exception_stuff): Replace calls to builtin_function with add_builtin_function. (build_objc_exception_stuff): Replace calls to builtin_function with add_builtin_function. * gcc/objcp/objcp-decl.h (objcp_builtin_function): Remove. * gcc/cp/decl.c (builtin_function_1): Move common code to add_builtin_function. (builtin_function): Rename to cxx_builtin_function. Change the signature. * gcc/cp/call.c: Include langhooks.h. (build_java_interface_fn_ref): Replace calls to builtin_function with add_builtin_function. * gcc/cp/Make-lang.in (cp/call.o): Depend on langhooks.h. * gcc/cp/cp-objcp-common.h (LANG_HOOKS_BUILTIN_FUNCTION): Define as cxx_builtin_function. * gcc/cp/cp-tree.h (builtin_function): Rename to cxx_builtin_function. Change the signature. * gcc/c-objc-common.h (LANG_HOOKS_BUILTIN_FUNCTION): Define as c_builtin_function. * gcc/c-tree.h (builtin_function): Rename to c_builtin_function. Change the signature. * gcc/ada/utils.c (builtin_function): Rename to gnat_builtin_function. Move common code to add_builtin_function. * gcc/ada/misc.c (LANG_HOOKS_BUILTIN_FUNCTION): Define as gnat_builtin_function. * gcc/ada/gigi.h (builtin_function): Rename to gnat_builtin_function. Change the signature. * gcc/c-decl.c (builtin_function): Rename to c_builtin_function. Move common code to add_builtin_function. * gcc/fortran/Make-lang.in (f951$(exeext)): Depend on and link with attribs.o. * gcc/fortran/trans.h (builtin_function): Rename to gfc_builtin_function. Change the signature. * gcc/fortran/f95-lang.c (LANG_HOOKS_BUILTIN_FUNCTION): Define as gfc_builtin_function. (builtin_function): Rename to gfc_builtin_function. Move common code to builtin_function. (gfc_define_builtin): Replace calls to builtin_function with gfc_define_builtin. * gcc/langhooks.c (add_builtin_function): New function. (lhd_builtin_function): New function. * gcc/langhooks.h (struct lang_hooks): Change the signature of builtin_function. (add_builtin_function): New function. * gcc/treelang/treetree.c (builtin_function): Remove. * gcc/tree-ssa-loop-prefetch.c (tree_ssa_prefetch_arrays): Replace calls to lang_hooks.builtin_function with add_builtin_function. * gcc/c-common.c (decl_builtin_1): Replace calls to lang_hooks.builtin_function with add_builtin_function. * gcc/config/alpha/alpha.c (alpha_init_builtins): Replace calls to lang_hooks.builtin_function with add_builtin_function. * gcc/config/frv/frv.c (def_builtin): Replace calls to lang_hooks.builtin_function with add_builtin_function. * gcc/config/s390/s390.c (s390_init_builtins): Replace calls to lang_hooks.builtin_function with add_builtin_function. * gcc/config/sparc/sparc.c (def_builtin): Replace calls to lang_hooks.builtin_function with add_builtin_function. * gcc/config/i386/i386.c (def_builtin): Replace calls to lang_hooks.builtin_function with add_builtin_function. (def_builtin): Replace calls to lang_hooks.builtin_function with add_builtin_function. * gcc/config/sh/sh.c (sh_media_init_builtins): Replace calls to lang_hooks.builtin_function with add_builtin_function. * gcc/config/c4x/c4x.c (c4x_init_builtins): Replace calls to lang_hooks.builtin_function with add_builtin_function. * gcc/config/stormy16/stormy16.c (xstormy16_init_builtins): Replace calls to lang_hooks.builtin_function with add_builtin_function. * gcc/config/iq2000/iq2000.c (def_builtin): Replace calls to lang_hooks.builtin_function with add_builtin_function. * gcc/config/ia64/ia64.c (def_builtin): Replace calls to lang_hooks.builtin_function with add_builtin_function. * gcc/config/rs6000/rs6000.c (def_builtin): Replace calls to lang_hooks.builtin_function with add_builtin_function. (altivec_init_builtins): Replace calls to lang_hooks.builtin_function with add_builtin_function. * gcc/config/arm/arm.c (def_mbuiltin): Replace calls to lang_hooks.builtin_function with add_builtin_function. (arm_init_tls_builtins): Replace calls to lang_hooks.builtin_function with add_builtin_function. * gcc/config/mips/mips.c (mips_init_builtins): Replace calls to lang_hooks.builtin_function with add_builtin_function. * gcc/config/bfin/bfin.c (def_builtin): Replace calls to lang_hooks.builtin_function with add_builtin_function. * gcc/langhooks-def.h (lhd_builtin_function): New function. (LANG_HOOKS_BUILTIN_FUNCTION): Define as lhd_builtin_function. From-SVN: r117981
2006-10-23 21:47:58 +02:00
= add_builtin_function (TAG_EXCEPTIONTRYENTER, temp_type, 0, NOT_BUILT_IN, NULL,
NULL_TREE);
objc_exception_try_exit_decl
decl.c: Include langhooks.h. * gcc/java/decl.c: Include langhooks.h. (builtin_function): Remove. (java_init_decl_processing): Replace calls to builtin_function with add_builtin_function. * gcc/java/Make-lang.in (jc1$(exeext)): Depend on and link with attribs.o. (java/decl.o): Depend on langhooks.h. * gcc/java/java-tree.h (builtin_function): Remove. * gcc/tree.c (local_define_builtin): Replace calls to lang_hooks.builtin_function with add_builtin_function. * gcc/objc/objc-act.c (synth_module_prologue): Replace calls to builtin_function with add_builtin_function. (build_next_objc_exception_stuff): Replace calls to builtin_function with add_builtin_function. (build_objc_exception_stuff): Replace calls to builtin_function with add_builtin_function. * gcc/objcp/objcp-decl.h (objcp_builtin_function): Remove. * gcc/cp/decl.c (builtin_function_1): Move common code to add_builtin_function. (builtin_function): Rename to cxx_builtin_function. Change the signature. * gcc/cp/call.c: Include langhooks.h. (build_java_interface_fn_ref): Replace calls to builtin_function with add_builtin_function. * gcc/cp/Make-lang.in (cp/call.o): Depend on langhooks.h. * gcc/cp/cp-objcp-common.h (LANG_HOOKS_BUILTIN_FUNCTION): Define as cxx_builtin_function. * gcc/cp/cp-tree.h (builtin_function): Rename to cxx_builtin_function. Change the signature. * gcc/c-objc-common.h (LANG_HOOKS_BUILTIN_FUNCTION): Define as c_builtin_function. * gcc/c-tree.h (builtin_function): Rename to c_builtin_function. Change the signature. * gcc/ada/utils.c (builtin_function): Rename to gnat_builtin_function. Move common code to add_builtin_function. * gcc/ada/misc.c (LANG_HOOKS_BUILTIN_FUNCTION): Define as gnat_builtin_function. * gcc/ada/gigi.h (builtin_function): Rename to gnat_builtin_function. Change the signature. * gcc/c-decl.c (builtin_function): Rename to c_builtin_function. Move common code to add_builtin_function. * gcc/fortran/Make-lang.in (f951$(exeext)): Depend on and link with attribs.o. * gcc/fortran/trans.h (builtin_function): Rename to gfc_builtin_function. Change the signature. * gcc/fortran/f95-lang.c (LANG_HOOKS_BUILTIN_FUNCTION): Define as gfc_builtin_function. (builtin_function): Rename to gfc_builtin_function. Move common code to builtin_function. (gfc_define_builtin): Replace calls to builtin_function with gfc_define_builtin. * gcc/langhooks.c (add_builtin_function): New function. (lhd_builtin_function): New function. * gcc/langhooks.h (struct lang_hooks): Change the signature of builtin_function. (add_builtin_function): New function. * gcc/treelang/treetree.c (builtin_function): Remove. * gcc/tree-ssa-loop-prefetch.c (tree_ssa_prefetch_arrays): Replace calls to lang_hooks.builtin_function with add_builtin_function. * gcc/c-common.c (decl_builtin_1): Replace calls to lang_hooks.builtin_function with add_builtin_function. * gcc/config/alpha/alpha.c (alpha_init_builtins): Replace calls to lang_hooks.builtin_function with add_builtin_function. * gcc/config/frv/frv.c (def_builtin): Replace calls to lang_hooks.builtin_function with add_builtin_function. * gcc/config/s390/s390.c (s390_init_builtins): Replace calls to lang_hooks.builtin_function with add_builtin_function. * gcc/config/sparc/sparc.c (def_builtin): Replace calls to lang_hooks.builtin_function with add_builtin_function. * gcc/config/i386/i386.c (def_builtin): Replace calls to lang_hooks.builtin_function with add_builtin_function. (def_builtin): Replace calls to lang_hooks.builtin_function with add_builtin_function. * gcc/config/sh/sh.c (sh_media_init_builtins): Replace calls to lang_hooks.builtin_function with add_builtin_function. * gcc/config/c4x/c4x.c (c4x_init_builtins): Replace calls to lang_hooks.builtin_function with add_builtin_function. * gcc/config/stormy16/stormy16.c (xstormy16_init_builtins): Replace calls to lang_hooks.builtin_function with add_builtin_function. * gcc/config/iq2000/iq2000.c (def_builtin): Replace calls to lang_hooks.builtin_function with add_builtin_function. * gcc/config/ia64/ia64.c (def_builtin): Replace calls to lang_hooks.builtin_function with add_builtin_function. * gcc/config/rs6000/rs6000.c (def_builtin): Replace calls to lang_hooks.builtin_function with add_builtin_function. (altivec_init_builtins): Replace calls to lang_hooks.builtin_function with add_builtin_function. * gcc/config/arm/arm.c (def_mbuiltin): Replace calls to lang_hooks.builtin_function with add_builtin_function. (arm_init_tls_builtins): Replace calls to lang_hooks.builtin_function with add_builtin_function. * gcc/config/mips/mips.c (mips_init_builtins): Replace calls to lang_hooks.builtin_function with add_builtin_function. * gcc/config/bfin/bfin.c (def_builtin): Replace calls to lang_hooks.builtin_function with add_builtin_function. * gcc/langhooks-def.h (lhd_builtin_function): New function. (LANG_HOOKS_BUILTIN_FUNCTION): Define as lhd_builtin_function. From-SVN: r117981
2006-10-23 21:47:58 +02:00
= add_builtin_function (TAG_EXCEPTIONTRYEXIT, temp_type, 0, NOT_BUILT_IN, NULL,
NULL_TREE);
c-common.c (flag_objc_sjlj_exceptions): New. * c-common.c (flag_objc_sjlj_exceptions): New. * c-common.h (flag_objc_sjlj_exceptions): Declare. * c-opts.c (c_common_handle_option): Set it. (c_common_post_options): Handle interation of different objective-c exception and runtime switches. * c-decl.c (c_eh_initialized_p): New. (finish_decl): Use it instead of local eh_initialized_p. * c-parse.in (nested_function, notype_nested_function): Record the result of compstmt. (compstmt_or_error): Likewise. (compstmt): Don't add_stmt the result. (stmt): Don't return anything. Rewrite objc try and sync rules. (objc_try_stmt, objc_catch_list): Remove. (objc_catch_block, objc_finally_block): Remove. (objc_catch_prefix, objc_catch_clause, objc_opt_catch_list): New. (objc_try_catch_clause, objc_finally_clause): New. (objc_try_catch_stmt): Rewrite. * c-tree.h (c_eh_initialized_p): Declare. * c-opt (fobjc-sjlj-exceptions): New. * except.c (output_function_exception_table): Don't call cgraph on non-decls. * objc/objc-act.c (UTAG_EXCDATA_VAR, UTAG_CAUGHTEXC_VAR, UTAG_RETHROWEXC_VAR, UTAG_EVALONCE_VAR, struct val_stack, catch_count_stack, exc_binding_stack, if_nesting_count, blk_nesting_count, objc_enter_block, objc_exit_block, objc_declare_variable, 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): Remove. (objc_create_temporary_var, struct objc_try_context, cur_try_context, objc_eh_runtime_type, objc_init_exceptions, objc_build_exc_ptr, next_sjlj_build_try_exit, next_sjlj_build_enter_and_setjmp, next_sjlj_build_exc_extract, next_sjlj_build_catch_list, next_sjlj_build_try_catch_finally, objc_begin_try_stmt, objc_begin_catch_clause, objc_finish_catch_clause, objc_build_finally_clause, objc_finish_try_stmt, objc_build_synchronized): New. (objc_is_object_id, objc_is_class_id): New. (objc_comptypes): Use them. (build_next_objc_exception_stuff): Break NeXT sjlj out from build_objc_exception_stuff. (synth_module_prologue): Update to match. (objc_build_throw_stmt): Use cur_try_context to decide if we're in a @catch. * objc/objc-act.h: Update prototypes. (OCTI_EXCEPTION_BLK_STACK, objc_exception_block_stack): Remove. testsuite/ * objc.dg/sync-1.m: New. * objc.dg/try-catch-1.m: Don't force next runtime. * objc.dg/try-catch-3.m, objc.dg/try-catch-4.m: Likewise. * objc.dg/try-catch-2.m: Likewise. Enable everywhere. Remove shadowed catch clause. * objc.dg/try-catch-5.m: New. From-SVN: r83332
2004-06-18 03:20:53 +02:00
/* int objc_exception_match(id, id); */
temp_type
objc-act.h (get_object_reference): Rename to get_protocol_reference. 2004-06-20 David Ayers <d.ayers@inode.at> * objc/objc-act.h (get_object_reference): Rename to get_protocol_reference. (super_type): Rename to objc_super_type. (selector_type): Rename to objc_selector_type. (id_type): Rename to objc_id_type. (instance_type): Rename to objc_instance_type. (protocol_type): Rename to objc_protocol_type. (IS_ID): Update reference to id_type. * objc/objc-act.c (get_object_reference): Rename to get_protocol_reference; add documentation; update references to id_type. (lookup_method_in_protocol_list): Rename class_meth to is_class; add documentation. (finish_message_expr): Rename is_class to class_tree. (synth_module_prologue, objc_is_object_ptr, objc_build_exc_ptr, next_sjlj_build_try_catch_finally, objc_begin_catch_clause, build_next_objc_exception_stuff, get_arg_type_list, build_objc_method_call): Update references to id_type. (synth_module_prologue, build_objc_symtab_template, build_selector_reference_decl, build_selector, build_selector_translation_table, build_typed_selector_reference, get_arg_type_list, synth_self_and_ucmd_args, get_arg_type_list, synth_self_and_ucmd_args): Update references to selector_type. (build_private_template, build_ivar_reference): Update references to instance_type. (synth_module_prologue, build_protocol_reference, build_protocol_expr, start_protocol): Update references to protocol_type. (synth_module_prologue, get_arg_type_list, build_objc_method_call): Update references to super_type. * c-parse.in: (typespec_nonreserved_nonattr): Update references to get_object_reference. * objc/objc-tree.def: Add C mode identifier sequence. From-SVN: r83425
2004-06-21 03:50:18 +02:00
= build_function_type (integer_type_node,
Makefile.in (c-parse.o): Depend on $(C_COMMON_H). [gcc/ChangeLog] 2004-09-07 Ziemowit Laski <zlaski@apple.com> * Makefile.in (c-parse.o): Depend on $(C_COMMON_H). * c-parse.in: Include c-common.h instead of objc-act.h. (ivar_decl_list, ivar_decls, ivar_decl, ivars, ivar_declarator, myparms, myparm): Remove %type declarations. (methodtype, optparms, OBJC_TYPE_QUAL, objc_quals, objc_qual, objc_typename, objc_try_catch_stmt, optellipsis): Add %type declarations. (objc_inherit_code, objc_public_flag): Remove. (typespec_nonreserved_nonattr): Call objc_get_protocol_qualified_type() instead of get_static_reference() and get_protocol_reference(). (stmt_nocomp): Call grokparm() on @catch parameter. (objcdef): Move semantic action to objc_finish_implementation(). (classdef): Move semantic action to objc_start_class_interface(), objc_continue_interface(), objc_finish_interface(), objc_start_class_implementation(), objc_continue_implementation(), objc_start_category_interface() and objc_start_category_implementation(). (protocoldef): Move semantic actions to objc_start_protocol() and objc_finish_interface(). (ivar_decl_list): Remove nonterminal. (visibility_spec): Move semantic actions to objc_set_visibility(). (ivar_decls): Remove assignment to $$. (ivar_decl): Rephrase in terms of component_decl; call objc_add_instance_variable(). (ivars, ivar_declarator): Remove nonterminals. (opt_semi): New nonterminal. (methodtype): Remove semantic actions. (methoddef): Move semantic actions to objc_set_method_type(), objc_start_method_definition() and objc_finish_method_definition(). (methodproto): Move semantic actions to objc_set_method_type() and objc_add_method_declaration(). (methoddecl): Use objc_typename instead of typename; move semantic actions to objc_build_method_signature(). (optarglist, myxdecls, mydecl, myparms, myparm): Remove nonterminals. (optparmlist): Express in terms of optparms and optellipsis. (optparms, optellipsis, objc_qual, objc_quals, objc_typename): New nonterminals. (keyworddecl): Use objc_typename instead of typename. (rid_to_yy): Mark RID_IN, RID_OUT, RID_INOUT, RID_BYCOPY, RID_BYREF and RID_ONEWAY as returning OBJC_TYPE_QUAL to yyparse(). [gcc/objc/ChangeLog] 2004-09-07 Ziemowit Laski <zlaski@apple.com> * Make-lang.in (objc/objc-parse.o): Depend on $(C_COMMON_H) instead of objc/objc-act.h. (objc/objc-act.o): Depend on $(HASHTAB_H). * objc-act.c: Include hashtab.h; in ObjC++ mode, include cp-tree.h and objcp-decl.h instead of c-tree.h. (build_module_descriptor, get_class_ivars, synth_id_with_class_suffix, error_with_ivar, gen_method_decl, gen_declaration, setup_string_decl, build_protocol_template): Adjust prototypes. (build_module_initializer_routine, start_class, continue_class, finish_class, start_method_def, objc_start_function, start_protocol, build_method_decl, objc_add_method, add_instance_variable, build_ivar_reference, is_ivar, is_private, get_super_receiver, build_selector_table_decl, objc_push_parm, objc_get_parm_info, gen_type_name, gen_type_name_0, start_var_decl, finish_var_decl, create_field_decl): New prototypes. (objc_expand_function_end, comp_method_with_proto, objc_expr_last, gen_declaration_1, gen_declarator, is_complex_decl, adorn_decl, define_decl, create_builtin_decl, gen_declspecs): Remove prototypes. (TYPE_ID): Rename to OBJECT_TYPEDEF_NAME. (CLASS_TYPEDEF_NAME): New. (TAG_EXECCLASS): Change from a global variable to a #define. (TAG_RETURN_STRUCT): Delete. (TAG_GNUINIT): New, holds '__objc_gnu_init' name. (objc_inherit_code, objc_public_flag): New, moved from c-parse.in. (string_descriptor): New struct. (string_htab): New hash table. (string_hash, string_eq): New prototypes. (generate_struct_by_value_array): Call create_field_decl() instead of create_builtin_decl(). (objc_init): Do not initialize objc_ellipsis_node or TAG_EXECCLASS; In ObjC++ mode, call cxx_init() instead of c_objc_common_init(). (objc_finish_file): In ObjC++, call instantiate_pending_templates() and cp_finish_file(). (define_decl, get_static_reference, get_protocol_reference, create_builtin_decl): Remove functions. (objc_start_class_interface, objc_start_category_interface, objc_start_protocol, objc_continue_interface, objc_finish_interface, objc_start_class_implementation, objc_start_category_implementation, objc_continue_implementation, objc_finish_implementation, objc_set_visibility, objc_set_method_type, objc_build_method_signature, objc_add_method_declaration, objc_start_method_definition, objc_add_instance_variable, objc_get_protocol_qualified_type, create_field_decl, start_var_decl, finish_var_decl): New functions. (setup_string_decl): Simplify since it is only called once. (synth_module_prologue): Call build_class_template(); predefine 'id' and 'Class' as typedefs; rename 'temp_type' to 'type'; disable debug hooks for duration of function; fix GNU runtime messenger signatures to correspond to reality; forward-declare '__objc_exec_class' for the GNU runtime; call build_selector_table_decl(); in ObjC++ mode, generate 'extern "C" { ... }' wrappers around synthesized declarations; call build_protocol_template() and build_category_template(). (string_hash, string_eq): New functions. (objc_build_string_object): Check metaclass correctness only once; store string literals in hash table. (objc_build_constructor): Do not convert initializer elements; adjust for ObjC++ impedance mismatch. (build_objc_symtab_template): Call create_field_decl() instead of create_builtin_decl(). (init_objc_symtab): Add missing conversion to initializer element. (build_metadata_decl): Call start_var_decl() instead of define_decl(). (generate_objc_symtab_decl): Do not call build_category_template(); call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(). (build_module_descriptor): Call create_field_decl() instead of grokfield(); call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(); always mark module descriptor as used; move GNU runtime-specific functionality to build_module_initializer_routine(). (build_module_initializer_routine): New function, broken off of build_module_descriptor(). (objc_static_init_needed_p, objc_generate_static_init_call): New functions. (generate_static_references, generate_strings, build_selector_translation_table, generate_descriptor_table, generate_ivars_list, generate_dispatch_table, generate_category): Call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(); build a type directly instead of via groktypename(). (build_selector_reference_decl, build_selector_table_decl, build_class_reference_decl, build_protocol_reference, generate_objc_image_info): Call start_var_decl() instead of build_decl(). (build_selector_reference): For GNU runtime, do not call build_selector_reference_decl(). (build_selector, build_typed_selector_reference): Always convert result to the selector type. (add_objc_string): Cast return value to 'char *'. (build_method_prototype_template, build_selector_template, build_method_template): Use actual selector type for fields pointing to selectors. (finish_objc): For GNU runtime, call build_module_initializer_routine() after build_module_descriptor(). (generate_protocol_list, generate_shared_structures): Call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(); build a type directly instead of via groktypename(). (synth_id_with_class_suffix): Return a string. (get_arg_type_list): For instance methods, use the instance type for 'self'; do not call groktypename_in_parm_context(). (build_objc_string_decl): Squash redeclaration errors in ObjC++. (objc_is_class_name): Use OBJC_TYPE_NAME instead of TYPE_NAME; handle RECORD_TYPEs in ObjC as well as ObjC++. (objc_is_id): New function. (objc_is_object_ptr): Return the canonical type node. (objc_get_class_ivars): Simplify using get_class_ivars(). (get_class_ivars): Remove second parameter; create a fresh copy of the ivar list for each call; do not check for existence of super class. (objc_eh_runtime_type): Mark #ifndef OBJCPLUS. (objc_init_exceptions): When using SJLJ-style exceptions, require the use of '-fobjc-exceptions' flag; do not require it for DWARF-style exceptions. (objc_build_exc_ptr, next_sjlj_build_try_catch_finally): Use objc_object_type instead of objc_id_type. (objc_begin_catch_clause): Convert the incoming PARM_DECL into a VAR_DECL before placing it in the appropriate scope; do not call define_decl(); adjust call to c_begin_compound_stmt(); use objc_object_type instead of objc_id_type. (build_next_objc_exception_stuff): Call create_field_decl() instead of create_builtin_decl(); construct type directly instead of calling groktypename(); use OBJC_VOID_AT_END to mark end of function parameters. (build_private_template): Adjust call to get_class_ivars(); build a type directly instead of via groktypename(). (build_protocol_template, build_method_prototype_list_template, build_method_prototype_template, build_category_template, build_selector_template, build_class_template, build_super_template, build_ivar_template, build_ivar_list_template, build_method_list_template, build_method_template): Call create_field_decl() instead of grokfield(). (objc_method_parm_type): Do not call groktypename(). (generate_descriptor_table): Call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(). (generate_method_descriptors, build_protocol_initializer, generate_dispatch_tables, build_category_initializer, build_shared_structure_initializer): Do not call groktypename(). (generate_protocols): Call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(); do not call groktypename(). (error_with_ivar): Remove last parameter. (check_ivars): Do not iterate ovar CLASS_RAW_IVARS lists in addition to CLASS_IVARS lists; adjust calls to error_with_ivar(). (generate_ivar_lists): Convert one of the initializer elements; do not call groktypename(). (get_arg_type_list, start_method_def, gen_method_def): Account for new representation of variable arguments and '...' in Objective-C methods; add Objective-C++ impedance matching code. (is_objc_type_qualifier): Remove function. (adjust_type_for_id_default): Simplify; there is no longer a need to wade through declspecs. (lookup_interface, start_class, continue_class, finish_class, start_method_def, start_protocol, build_method_decl, objc_add_method, add_instance_variable, build_ivar_reference, is_ivar, is_private, get_super_receiver, objc_build_finally_epilogue): Make into static functions. (receiver_is_class_object): Use new IS_CLASS() macro. (objc_build_message_expr): Tweak ObjC++ message argument handling; call objc_finish_message_expr() instead of finish_message_expr(). (finish_message_expr): Rename to objc_finish_message_expr(); use OBJC_TYPE_NAME and OBJC_SET_TYPE_NAME macros instead of TYPE_NAME. call gen_type_name() instead of gen_declaration(); call objc_is_id() instead of using IS_ID and IS_CLASS; Use objc_class_name instead of calling get_identifier("Class"); handle CONVERT_EXPRs in receiver. (build_objc_method_call, warn_with_method): Do not call groktypename(). (build_ivar_reference): Call convert() instead of clobbering in a type. (hash_init): Initialize string_htab hash table. (add_instance_variable): Simplify parameter list; do not call grokfield(); do not populate CLASS_IVARS list. (start_class): Check for the existence of super class, if one was specified. (continue_class): Use CLASS_RAW_IVARS rather than CLASS_IVARS; do not call build_class_template(); adjust call to get_class_ivars(); call build_decl(), pushdecl() and finish_decl() instead of define_decl(). (finish_class): Call build_decl(), pushdecl() and finish_decl() instead of define_decl(). (add_protocols): Use PROTOCOL_BINFO_ELTS for the tree vector size. (start_protocol): Do not call build_protocol_template(); use PROTOCOL_BINFO_ELTS for the tree vector size. (encode_type_qualifiers): Do not handle the 'const' qualifier here. (encode_pointer): Encode 'const char *' as 'r*', for backwards compatibility. (encode_array): Use HOST_WIDE_INT_PRINT_DEC instead of "%ld". (encode_type): Handle the 'const' qualifier here. (objc_parmlist): New global variable, sued by objc_push_parm and objc_get_parm_info(). (objc_push_parm, objc_get_parm_info): New functions. (objc_expr_last): Remove function. (synth_self_and_ucmd_args): For instance methods, use the instance type for 'self'; call objc_push_parm() instead of push_parm_decl(). (start_method_def): Do not call push_scope(), declare_parm_level(), pop_scope(), push_parm_decl(), store_parm_decls() or objc_expr_last(); just use objc_push_parm() and objc_get_parm_info(). (comp_method_with_proto): Remove function. (objc_types_are_equivalent): Strip away indirections before comparing underlying types. (comp_proto_with_proto): Do not call groktypename(); types are no longer in raw declspec format. (objc_start_function): New function. (really_start_method): Call comp_proto_with_proto() instead of comp_method_with_proto(); call objc_start_function() instead of hand-crafting a function declarator. (continue_method_def, objc_expand_function_end): Remove functions. (get_super_receiver): Call objc_get_current_scope() instead of get_current_scope(); reference 'super_class' field (instead of 'class'). (finish_method_def): Rename to objc_finish_method_definition() and add a function decl parameter; move method encoding call from objc_expand_function_end(). (is_complex_decl, adorn_decl, gen_declarator, gen_declspecs, gen_declaration_1): Remove functions. (tmpbuf, RAW_DECLSPEC): Remove. (gen_declaration): Remove second parameter; simplify to deal with TYPE_P nodes instead of raw declspecs. (gen_type_name, gen_type_name_0): New functions. (gen_method_decl): Remove second parameter; call gen_type_name() instead of gen_declaration_1(). (dump_interface): Adjust calls to gen_declaration() and gen_method_decl(); do not allocate a separate string buffer. (init_objc): Allocate a larger string buffer to accommodate dump_interface(); adjust call to build_module_descriptor(); add call to build_module_initializer_routine() for the GNU runtime. (generate_classref_translation_entry): Do not call start_decl(); call finish_var_decl() instead of finish_decl(); call convert() instead of build_c_cast(). * objc-act.h (CLASS_OWN_IVARS): Remove accessor. (CLASS_BINFO_ELTS): Reduce from 6 to 5, now that CLASS_OWN_IVARS is gone. (OCTI_GNU_INIT_DECL, GNU_INIT_decl): New. (OCTI_ELLIPSIS_NODE, objc_ellipsis_node): Remove. (OCTI_ID_ID, id_type, objc_id_id): Rename to OCTI_ID_NAME, objc_object_type and objc_object_name, respectively. (OCTI_CLS_REF, OCTI_CLASS_NAME, objc_class_reference, objc_class_name): New. (IS_CLASS): New macro. (IS_ID, IS_SUPER): Robustify. (OCTI_EXECCLASS_DECL, execclass_decl): New. (finish_file, start_class, continue_class, finish_class, start_method_def, continue_method_def, finish_method_def, start_protocol, finish_protocol, objc_build_throw_stmt, objc_build_try_catch_finally_stmt, objc_build_synchronized_prologue, objc_build_synchronized_epilogue, objc_build_try_prologue, objc_build_try_epilogue, objc_build_catch_stmt, objc_build_catch_epilogue, objc_build_finally_prologue, objc_build_finally_epilogue, is_ivar, is_private, is_public, add_instance_variable, objc_add_method, get_super_receiver, objc_clear_super_receiver, get_class_ivars_from_name, get_class_reference, get_static_reference, get_object_reference, build_message_expr, finish_message_expr, build_selector_expr, build_ivar_reference, build_keyword_decl, build_method_decl, build_protocol_expr, build_objc_string_object, objc_declare_alias, objc_declare_class, objc_declare_protocols, objc_comptypes, objc_check_decl, build_encode_expr): Remove prototypes. (imp_count, cat_count): Make GGC-aware. (OBJC_SET_TYPE_NAME): New macro. From-SVN: r87168
2004-09-08 02:49:44 +02:00
tree_cons (NULL_TREE, objc_object_type,
tree_cons (NULL_TREE, objc_object_type,
OBJC_VOID_AT_END)));
objc_exception_match_decl
decl.c: Include langhooks.h. * gcc/java/decl.c: Include langhooks.h. (builtin_function): Remove. (java_init_decl_processing): Replace calls to builtin_function with add_builtin_function. * gcc/java/Make-lang.in (jc1$(exeext)): Depend on and link with attribs.o. (java/decl.o): Depend on langhooks.h. * gcc/java/java-tree.h (builtin_function): Remove. * gcc/tree.c (local_define_builtin): Replace calls to lang_hooks.builtin_function with add_builtin_function. * gcc/objc/objc-act.c (synth_module_prologue): Replace calls to builtin_function with add_builtin_function. (build_next_objc_exception_stuff): Replace calls to builtin_function with add_builtin_function. (build_objc_exception_stuff): Replace calls to builtin_function with add_builtin_function. * gcc/objcp/objcp-decl.h (objcp_builtin_function): Remove. * gcc/cp/decl.c (builtin_function_1): Move common code to add_builtin_function. (builtin_function): Rename to cxx_builtin_function. Change the signature. * gcc/cp/call.c: Include langhooks.h. (build_java_interface_fn_ref): Replace calls to builtin_function with add_builtin_function. * gcc/cp/Make-lang.in (cp/call.o): Depend on langhooks.h. * gcc/cp/cp-objcp-common.h (LANG_HOOKS_BUILTIN_FUNCTION): Define as cxx_builtin_function. * gcc/cp/cp-tree.h (builtin_function): Rename to cxx_builtin_function. Change the signature. * gcc/c-objc-common.h (LANG_HOOKS_BUILTIN_FUNCTION): Define as c_builtin_function. * gcc/c-tree.h (builtin_function): Rename to c_builtin_function. Change the signature. * gcc/ada/utils.c (builtin_function): Rename to gnat_builtin_function. Move common code to add_builtin_function. * gcc/ada/misc.c (LANG_HOOKS_BUILTIN_FUNCTION): Define as gnat_builtin_function. * gcc/ada/gigi.h (builtin_function): Rename to gnat_builtin_function. Change the signature. * gcc/c-decl.c (builtin_function): Rename to c_builtin_function. Move common code to add_builtin_function. * gcc/fortran/Make-lang.in (f951$(exeext)): Depend on and link with attribs.o. * gcc/fortran/trans.h (builtin_function): Rename to gfc_builtin_function. Change the signature. * gcc/fortran/f95-lang.c (LANG_HOOKS_BUILTIN_FUNCTION): Define as gfc_builtin_function. (builtin_function): Rename to gfc_builtin_function. Move common code to builtin_function. (gfc_define_builtin): Replace calls to builtin_function with gfc_define_builtin. * gcc/langhooks.c (add_builtin_function): New function. (lhd_builtin_function): New function. * gcc/langhooks.h (struct lang_hooks): Change the signature of builtin_function. (add_builtin_function): New function. * gcc/treelang/treetree.c (builtin_function): Remove. * gcc/tree-ssa-loop-prefetch.c (tree_ssa_prefetch_arrays): Replace calls to lang_hooks.builtin_function with add_builtin_function. * gcc/c-common.c (decl_builtin_1): Replace calls to lang_hooks.builtin_function with add_builtin_function. * gcc/config/alpha/alpha.c (alpha_init_builtins): Replace calls to lang_hooks.builtin_function with add_builtin_function. * gcc/config/frv/frv.c (def_builtin): Replace calls to lang_hooks.builtin_function with add_builtin_function. * gcc/config/s390/s390.c (s390_init_builtins): Replace calls to lang_hooks.builtin_function with add_builtin_function. * gcc/config/sparc/sparc.c (def_builtin): Replace calls to lang_hooks.builtin_function with add_builtin_function. * gcc/config/i386/i386.c (def_builtin): Replace calls to lang_hooks.builtin_function with add_builtin_function. (def_builtin): Replace calls to lang_hooks.builtin_function with add_builtin_function. * gcc/config/sh/sh.c (sh_media_init_builtins): Replace calls to lang_hooks.builtin_function with add_builtin_function. * gcc/config/c4x/c4x.c (c4x_init_builtins): Replace calls to lang_hooks.builtin_function with add_builtin_function. * gcc/config/stormy16/stormy16.c (xstormy16_init_builtins): Replace calls to lang_hooks.builtin_function with add_builtin_function. * gcc/config/iq2000/iq2000.c (def_builtin): Replace calls to lang_hooks.builtin_function with add_builtin_function. * gcc/config/ia64/ia64.c (def_builtin): Replace calls to lang_hooks.builtin_function with add_builtin_function. * gcc/config/rs6000/rs6000.c (def_builtin): Replace calls to lang_hooks.builtin_function with add_builtin_function. (altivec_init_builtins): Replace calls to lang_hooks.builtin_function with add_builtin_function. * gcc/config/arm/arm.c (def_mbuiltin): Replace calls to lang_hooks.builtin_function with add_builtin_function. (arm_init_tls_builtins): Replace calls to lang_hooks.builtin_function with add_builtin_function. * gcc/config/mips/mips.c (mips_init_builtins): Replace calls to lang_hooks.builtin_function with add_builtin_function. * gcc/config/bfin/bfin.c (def_builtin): Replace calls to lang_hooks.builtin_function with add_builtin_function. * gcc/langhooks-def.h (lhd_builtin_function): New function. (LANG_HOOKS_BUILTIN_FUNCTION): Define as lhd_builtin_function. From-SVN: r117981
2006-10-23 21:47:58 +02:00
= add_builtin_function (TAG_EXCEPTIONMATCH, temp_type, 0, NOT_BUILT_IN, NULL,
NULL_TREE);
Yet more Objective-C++... * objc-act.c (objc_finish_try_stmt): Add return value. (objc_build_synchronized): Likewise. * objc-act.c (objc_is_gcable_type): Add. (objc_substitute_decl): Add. (objc_build_ivar_assignment): Add. (objc_build_global_assignment): Add. (objc_build_strong_cast_assignment): Add. (objc_is_ivar_reference_p): Add. (objc_is_global_reference_p): Add. (objc_generate_write_barrier): Add. (objc_rewrite_function_call): Add. (objc_gimplify_expr): Add Objective-C++ support. * objc-act.h (ALLOC_OBJC_TYPE_LANG_SPECIFIC): Likewise. (SIZEOF_OBJC_TYPE_LANG_SPECIFIC): Add. (INIT_TYPE_OBJC_INFO): Add Objective-C++ support. (DUP_TYPE_OBJC_INFO): Likewise. (struct imp_entry): Add field has_cxx_cdtors. (struct imp_entry *imp_list): Add OCTI_UMSG_FAST_DECL, OCTI_METH_LIST_TEMPL, OCTI_METH_PROTO_LIST_TEMPL, OCTI_IVAR_LIST_TEMPL, OCTI_ASSIGN_IVAR_DECL, OCTI_ASSIGN_IVAR_FAST_DECL, OCTI_ASSIGN_GLOBAL_DECL, OCTI_ASSIGN_STRONGCAST_DECL. (umsg_fast_decl): Add. (objc_assign_ivar_decl): Add. (objc_assign_ivar_fast_decl): Add. (objc_assign_global_decl): Add. (objc_assign_strong_cast_decl): Add. (objc_method_list_ptr): Add. (objc_method_proto_list_ptr): Add. (objc_ivar_list_ptr): Add. * objc-act.c (should_call_super_dealloc): Add. (OBJC_VERSION): Bump to 6. (objc_is_gcable_type): Add. (objc_substitute_decl): Add. (objc_build_ivar_assignment): Add. (objc_build_global_assignment): Add. (objc_build_strong_cast_assignment): Add. (objc_is_gcable_p): Add. (objc_is_ivar_reference_p): Add. (objc_is_global_reference_p): Add. (generate_shared_structures): Add flags parameter. (objc_generate_cxx_ctor_or_dtor): Add. (objc_generate_cxx_cdtors): Add. (add_class): Add name parameter. (objc_types_share_size_and_alignment): Add. (comp_proto_with_proto): Add strict parameter. (CLS_HAS_CXX_STRUCTORS): Add. (TAG_ASSIGNIVAR): Add. (TAG_ASSIGNGLOBAL): Add. (TAG_ASSIGNSTRONGCAST): Add. (TAG_MSGSEND_FAST): Add. (TAG_ASSIGNIVAR_FAST): Add. (TAG_CXX_CONSTRUCT): Add. (TAG_CXX_DESTRUCT): Add. (OBJC_LOOKUP_CLASS): Add. (OBJC_LOOKUP_NO_SUPER): Add. (objc_finish_file): Add pch support. (objc_finish_implementation): Add Objective-C++ support. (synth_module_prologue): Likewise. (synth_module_prologue): Add fast dispatching. (objc_get_class_reference): Add Objective-C++ support. (objc_generate_write_barrier): Likewise. (next_sjlj_build_enter_and_setjmp): Likewise. (objc_begin_try_stmt): Likewise. (build_next_objc_exception_stuff): Add fast ivar support. (build_private_template): Mark the record as used so debug information is generated. (build_protocol_template): Add Objective-C++ support. (objc_method_parm_type) Likewise. (objc_generate_cxx_ctor_or_dtor): Likewise. (objc_generate_cxx_cdtors): Likewise. (build_protocol_initializer): Likewise. (build_category_template): Likewise. (build_class_template): Likewise. (build_method_list_template): Likewise. (build_category_initializer): Likewise. (build_shared_structure_initializer): Likewise. (objc_finish_message_expr): Likewise. (build_objc_method_call): Add fast dispatch support. (lookup_method_static): Add support to end search at superclasses. (add_method_to_hash_list): Add strict parameter to comp_proto_with_proto. (objc_add_method): Likewise. (objc_add_method): Also set the interface_value. (add_instance_variable): Add Objective-C++ support. (objc_is_public): Likewise. (start_class): Likewise. (continue_class): Likewise. (encode_aggregate_within): Likewise. (start_method_def): Likewise. (objc_start_function): Clear current_function_returns_value and current_function_returns_null. (really_start_method): Add Objective-C++ support. (objc_finish_method_definition): Add warning for missing [super dealloc]. (finish_objc): Add Objective-C++ support. (generate_objc_image_info): Likewise. (objc_lookup_ivar): Likewise. * objc-act.h (TYPE_HAS_OBJC_INFO): Likewise. (INIT_TYPE_OBJC_INFO): Likewise. (DUP_TYPE_OBJC_INFO): Likewise. From-SVN: r99857
2005-05-17 22:07:08 +02:00
/* id objc_assign_ivar (id, id, unsigned int); */
/* id objc_assign_ivar_Fast (id, id, unsigned int)
__attribute__ ((hard_coded_address (OFFS_ASSIGNIVAR_FAST))); */
temp_type
= build_function_type (objc_object_type,
tree_cons
(NULL_TREE, objc_object_type,
tree_cons (NULL_TREE, objc_object_type,
tree_cons (NULL_TREE,
unsigned_type_node,
OBJC_VOID_AT_END))));
objc_assign_ivar_decl
decl.c: Include langhooks.h. * gcc/java/decl.c: Include langhooks.h. (builtin_function): Remove. (java_init_decl_processing): Replace calls to builtin_function with add_builtin_function. * gcc/java/Make-lang.in (jc1$(exeext)): Depend on and link with attribs.o. (java/decl.o): Depend on langhooks.h. * gcc/java/java-tree.h (builtin_function): Remove. * gcc/tree.c (local_define_builtin): Replace calls to lang_hooks.builtin_function with add_builtin_function. * gcc/objc/objc-act.c (synth_module_prologue): Replace calls to builtin_function with add_builtin_function. (build_next_objc_exception_stuff): Replace calls to builtin_function with add_builtin_function. (build_objc_exception_stuff): Replace calls to builtin_function with add_builtin_function. * gcc/objcp/objcp-decl.h (objcp_builtin_function): Remove. * gcc/cp/decl.c (builtin_function_1): Move common code to add_builtin_function. (builtin_function): Rename to cxx_builtin_function. Change the signature. * gcc/cp/call.c: Include langhooks.h. (build_java_interface_fn_ref): Replace calls to builtin_function with add_builtin_function. * gcc/cp/Make-lang.in (cp/call.o): Depend on langhooks.h. * gcc/cp/cp-objcp-common.h (LANG_HOOKS_BUILTIN_FUNCTION): Define as cxx_builtin_function. * gcc/cp/cp-tree.h (builtin_function): Rename to cxx_builtin_function. Change the signature. * gcc/c-objc-common.h (LANG_HOOKS_BUILTIN_FUNCTION): Define as c_builtin_function. * gcc/c-tree.h (builtin_function): Rename to c_builtin_function. Change the signature. * gcc/ada/utils.c (builtin_function): Rename to gnat_builtin_function. Move common code to add_builtin_function. * gcc/ada/misc.c (LANG_HOOKS_BUILTIN_FUNCTION): Define as gnat_builtin_function. * gcc/ada/gigi.h (builtin_function): Rename to gnat_builtin_function. Change the signature. * gcc/c-decl.c (builtin_function): Rename to c_builtin_function. Move common code to add_builtin_function. * gcc/fortran/Make-lang.in (f951$(exeext)): Depend on and link with attribs.o. * gcc/fortran/trans.h (builtin_function): Rename to gfc_builtin_function. Change the signature. * gcc/fortran/f95-lang.c (LANG_HOOKS_BUILTIN_FUNCTION): Define as gfc_builtin_function. (builtin_function): Rename to gfc_builtin_function. Move common code to builtin_function. (gfc_define_builtin): Replace calls to builtin_function with gfc_define_builtin. * gcc/langhooks.c (add_builtin_function): New function. (lhd_builtin_function): New function. * gcc/langhooks.h (struct lang_hooks): Change the signature of builtin_function. (add_builtin_function): New function. * gcc/treelang/treetree.c (builtin_function): Remove. * gcc/tree-ssa-loop-prefetch.c (tree_ssa_prefetch_arrays): Replace calls to lang_hooks.builtin_function with add_builtin_function. * gcc/c-common.c (decl_builtin_1): Replace calls to lang_hooks.builtin_function with add_builtin_function. * gcc/config/alpha/alpha.c (alpha_init_builtins): Replace calls to lang_hooks.builtin_function with add_builtin_function. * gcc/config/frv/frv.c (def_builtin): Replace calls to lang_hooks.builtin_function with add_builtin_function. * gcc/config/s390/s390.c (s390_init_builtins): Replace calls to lang_hooks.builtin_function with add_builtin_function. * gcc/config/sparc/sparc.c (def_builtin): Replace calls to lang_hooks.builtin_function with add_builtin_function. * gcc/config/i386/i386.c (def_builtin): Replace calls to lang_hooks.builtin_function with add_builtin_function. (def_builtin): Replace calls to lang_hooks.builtin_function with add_builtin_function. * gcc/config/sh/sh.c (sh_media_init_builtins): Replace calls to lang_hooks.builtin_function with add_builtin_function. * gcc/config/c4x/c4x.c (c4x_init_builtins): Replace calls to lang_hooks.builtin_function with add_builtin_function. * gcc/config/stormy16/stormy16.c (xstormy16_init_builtins): Replace calls to lang_hooks.builtin_function with add_builtin_function. * gcc/config/iq2000/iq2000.c (def_builtin): Replace calls to lang_hooks.builtin_function with add_builtin_function. * gcc/config/ia64/ia64.c (def_builtin): Replace calls to lang_hooks.builtin_function with add_builtin_function. * gcc/config/rs6000/rs6000.c (def_builtin): Replace calls to lang_hooks.builtin_function with add_builtin_function. (altivec_init_builtins): Replace calls to lang_hooks.builtin_function with add_builtin_function. * gcc/config/arm/arm.c (def_mbuiltin): Replace calls to lang_hooks.builtin_function with add_builtin_function. (arm_init_tls_builtins): Replace calls to lang_hooks.builtin_function with add_builtin_function. * gcc/config/mips/mips.c (mips_init_builtins): Replace calls to lang_hooks.builtin_function with add_builtin_function. * gcc/config/bfin/bfin.c (def_builtin): Replace calls to lang_hooks.builtin_function with add_builtin_function. * gcc/langhooks-def.h (lhd_builtin_function): New function. (LANG_HOOKS_BUILTIN_FUNCTION): Define as lhd_builtin_function. From-SVN: r117981
2006-10-23 21:47:58 +02:00
= add_builtin_function (TAG_ASSIGNIVAR, temp_type, 0, NOT_BUILT_IN,
NULL, NULL_TREE);
Yet more Objective-C++... * objc-act.c (objc_finish_try_stmt): Add return value. (objc_build_synchronized): Likewise. * objc-act.c (objc_is_gcable_type): Add. (objc_substitute_decl): Add. (objc_build_ivar_assignment): Add. (objc_build_global_assignment): Add. (objc_build_strong_cast_assignment): Add. (objc_is_ivar_reference_p): Add. (objc_is_global_reference_p): Add. (objc_generate_write_barrier): Add. (objc_rewrite_function_call): Add. (objc_gimplify_expr): Add Objective-C++ support. * objc-act.h (ALLOC_OBJC_TYPE_LANG_SPECIFIC): Likewise. (SIZEOF_OBJC_TYPE_LANG_SPECIFIC): Add. (INIT_TYPE_OBJC_INFO): Add Objective-C++ support. (DUP_TYPE_OBJC_INFO): Likewise. (struct imp_entry): Add field has_cxx_cdtors. (struct imp_entry *imp_list): Add OCTI_UMSG_FAST_DECL, OCTI_METH_LIST_TEMPL, OCTI_METH_PROTO_LIST_TEMPL, OCTI_IVAR_LIST_TEMPL, OCTI_ASSIGN_IVAR_DECL, OCTI_ASSIGN_IVAR_FAST_DECL, OCTI_ASSIGN_GLOBAL_DECL, OCTI_ASSIGN_STRONGCAST_DECL. (umsg_fast_decl): Add. (objc_assign_ivar_decl): Add. (objc_assign_ivar_fast_decl): Add. (objc_assign_global_decl): Add. (objc_assign_strong_cast_decl): Add. (objc_method_list_ptr): Add. (objc_method_proto_list_ptr): Add. (objc_ivar_list_ptr): Add. * objc-act.c (should_call_super_dealloc): Add. (OBJC_VERSION): Bump to 6. (objc_is_gcable_type): Add. (objc_substitute_decl): Add. (objc_build_ivar_assignment): Add. (objc_build_global_assignment): Add. (objc_build_strong_cast_assignment): Add. (objc_is_gcable_p): Add. (objc_is_ivar_reference_p): Add. (objc_is_global_reference_p): Add. (generate_shared_structures): Add flags parameter. (objc_generate_cxx_ctor_or_dtor): Add. (objc_generate_cxx_cdtors): Add. (add_class): Add name parameter. (objc_types_share_size_and_alignment): Add. (comp_proto_with_proto): Add strict parameter. (CLS_HAS_CXX_STRUCTORS): Add. (TAG_ASSIGNIVAR): Add. (TAG_ASSIGNGLOBAL): Add. (TAG_ASSIGNSTRONGCAST): Add. (TAG_MSGSEND_FAST): Add. (TAG_ASSIGNIVAR_FAST): Add. (TAG_CXX_CONSTRUCT): Add. (TAG_CXX_DESTRUCT): Add. (OBJC_LOOKUP_CLASS): Add. (OBJC_LOOKUP_NO_SUPER): Add. (objc_finish_file): Add pch support. (objc_finish_implementation): Add Objective-C++ support. (synth_module_prologue): Likewise. (synth_module_prologue): Add fast dispatching. (objc_get_class_reference): Add Objective-C++ support. (objc_generate_write_barrier): Likewise. (next_sjlj_build_enter_and_setjmp): Likewise. (objc_begin_try_stmt): Likewise. (build_next_objc_exception_stuff): Add fast ivar support. (build_private_template): Mark the record as used so debug information is generated. (build_protocol_template): Add Objective-C++ support. (objc_method_parm_type) Likewise. (objc_generate_cxx_ctor_or_dtor): Likewise. (objc_generate_cxx_cdtors): Likewise. (build_protocol_initializer): Likewise. (build_category_template): Likewise. (build_class_template): Likewise. (build_method_list_template): Likewise. (build_category_initializer): Likewise. (build_shared_structure_initializer): Likewise. (objc_finish_message_expr): Likewise. (build_objc_method_call): Add fast dispatch support. (lookup_method_static): Add support to end search at superclasses. (add_method_to_hash_list): Add strict parameter to comp_proto_with_proto. (objc_add_method): Likewise. (objc_add_method): Also set the interface_value. (add_instance_variable): Add Objective-C++ support. (objc_is_public): Likewise. (start_class): Likewise. (continue_class): Likewise. (encode_aggregate_within): Likewise. (start_method_def): Likewise. (objc_start_function): Clear current_function_returns_value and current_function_returns_null. (really_start_method): Add Objective-C++ support. (objc_finish_method_definition): Add warning for missing [super dealloc]. (finish_objc): Add Objective-C++ support. (generate_objc_image_info): Likewise. (objc_lookup_ivar): Likewise. * objc-act.h (TYPE_HAS_OBJC_INFO): Likewise. (INIT_TYPE_OBJC_INFO): Likewise. (DUP_TYPE_OBJC_INFO): Likewise. From-SVN: r99857
2005-05-17 22:07:08 +02:00
#ifdef OFFS_ASSIGNIVAR_FAST
objc_assign_ivar_fast_decl
decl.c: Include langhooks.h. * gcc/java/decl.c: Include langhooks.h. (builtin_function): Remove. (java_init_decl_processing): Replace calls to builtin_function with add_builtin_function. * gcc/java/Make-lang.in (jc1$(exeext)): Depend on and link with attribs.o. (java/decl.o): Depend on langhooks.h. * gcc/java/java-tree.h (builtin_function): Remove. * gcc/tree.c (local_define_builtin): Replace calls to lang_hooks.builtin_function with add_builtin_function. * gcc/objc/objc-act.c (synth_module_prologue): Replace calls to builtin_function with add_builtin_function. (build_next_objc_exception_stuff): Replace calls to builtin_function with add_builtin_function. (build_objc_exception_stuff): Replace calls to builtin_function with add_builtin_function. * gcc/objcp/objcp-decl.h (objcp_builtin_function): Remove. * gcc/cp/decl.c (builtin_function_1): Move common code to add_builtin_function. (builtin_function): Rename to cxx_builtin_function. Change the signature. * gcc/cp/call.c: Include langhooks.h. (build_java_interface_fn_ref): Replace calls to builtin_function with add_builtin_function. * gcc/cp/Make-lang.in (cp/call.o): Depend on langhooks.h. * gcc/cp/cp-objcp-common.h (LANG_HOOKS_BUILTIN_FUNCTION): Define as cxx_builtin_function. * gcc/cp/cp-tree.h (builtin_function): Rename to cxx_builtin_function. Change the signature. * gcc/c-objc-common.h (LANG_HOOKS_BUILTIN_FUNCTION): Define as c_builtin_function. * gcc/c-tree.h (builtin_function): Rename to c_builtin_function. Change the signature. * gcc/ada/utils.c (builtin_function): Rename to gnat_builtin_function. Move common code to add_builtin_function. * gcc/ada/misc.c (LANG_HOOKS_BUILTIN_FUNCTION): Define as gnat_builtin_function. * gcc/ada/gigi.h (builtin_function): Rename to gnat_builtin_function. Change the signature. * gcc/c-decl.c (builtin_function): Rename to c_builtin_function. Move common code to add_builtin_function. * gcc/fortran/Make-lang.in (f951$(exeext)): Depend on and link with attribs.o. * gcc/fortran/trans.h (builtin_function): Rename to gfc_builtin_function. Change the signature. * gcc/fortran/f95-lang.c (LANG_HOOKS_BUILTIN_FUNCTION): Define as gfc_builtin_function. (builtin_function): Rename to gfc_builtin_function. Move common code to builtin_function. (gfc_define_builtin): Replace calls to builtin_function with gfc_define_builtin. * gcc/langhooks.c (add_builtin_function): New function. (lhd_builtin_function): New function. * gcc/langhooks.h (struct lang_hooks): Change the signature of builtin_function. (add_builtin_function): New function. * gcc/treelang/treetree.c (builtin_function): Remove. * gcc/tree-ssa-loop-prefetch.c (tree_ssa_prefetch_arrays): Replace calls to lang_hooks.builtin_function with add_builtin_function. * gcc/c-common.c (decl_builtin_1): Replace calls to lang_hooks.builtin_function with add_builtin_function. * gcc/config/alpha/alpha.c (alpha_init_builtins): Replace calls to lang_hooks.builtin_function with add_builtin_function. * gcc/config/frv/frv.c (def_builtin): Replace calls to lang_hooks.builtin_function with add_builtin_function. * gcc/config/s390/s390.c (s390_init_builtins): Replace calls to lang_hooks.builtin_function with add_builtin_function. * gcc/config/sparc/sparc.c (def_builtin): Replace calls to lang_hooks.builtin_function with add_builtin_function. * gcc/config/i386/i386.c (def_builtin): Replace calls to lang_hooks.builtin_function with add_builtin_function. (def_builtin): Replace calls to lang_hooks.builtin_function with add_builtin_function. * gcc/config/sh/sh.c (sh_media_init_builtins): Replace calls to lang_hooks.builtin_function with add_builtin_function. * gcc/config/c4x/c4x.c (c4x_init_builtins): Replace calls to lang_hooks.builtin_function with add_builtin_function. * gcc/config/stormy16/stormy16.c (xstormy16_init_builtins): Replace calls to lang_hooks.builtin_function with add_builtin_function. * gcc/config/iq2000/iq2000.c (def_builtin): Replace calls to lang_hooks.builtin_function with add_builtin_function. * gcc/config/ia64/ia64.c (def_builtin): Replace calls to lang_hooks.builtin_function with add_builtin_function. * gcc/config/rs6000/rs6000.c (def_builtin): Replace calls to lang_hooks.builtin_function with add_builtin_function. (altivec_init_builtins): Replace calls to lang_hooks.builtin_function with add_builtin_function. * gcc/config/arm/arm.c (def_mbuiltin): Replace calls to lang_hooks.builtin_function with add_builtin_function. (arm_init_tls_builtins): Replace calls to lang_hooks.builtin_function with add_builtin_function. * gcc/config/mips/mips.c (mips_init_builtins): Replace calls to lang_hooks.builtin_function with add_builtin_function. * gcc/config/bfin/bfin.c (def_builtin): Replace calls to lang_hooks.builtin_function with add_builtin_function. * gcc/langhooks-def.h (lhd_builtin_function): New function. (LANG_HOOKS_BUILTIN_FUNCTION): Define as lhd_builtin_function. From-SVN: r117981
2006-10-23 21:47:58 +02:00
= add_builtin_function (TAG_ASSIGNIVAR_FAST, temp_type, 0,
NOT_BUILT_IN, NULL, NULL_TREE);
DECL_ATTRIBUTES (objc_assign_ivar_fast_decl)
= tree_cons (get_identifier ("hard_coded_address"),
Yet more Objective-C++... * objc-act.c (objc_finish_try_stmt): Add return value. (objc_build_synchronized): Likewise. * objc-act.c (objc_is_gcable_type): Add. (objc_substitute_decl): Add. (objc_build_ivar_assignment): Add. (objc_build_global_assignment): Add. (objc_build_strong_cast_assignment): Add. (objc_is_ivar_reference_p): Add. (objc_is_global_reference_p): Add. (objc_generate_write_barrier): Add. (objc_rewrite_function_call): Add. (objc_gimplify_expr): Add Objective-C++ support. * objc-act.h (ALLOC_OBJC_TYPE_LANG_SPECIFIC): Likewise. (SIZEOF_OBJC_TYPE_LANG_SPECIFIC): Add. (INIT_TYPE_OBJC_INFO): Add Objective-C++ support. (DUP_TYPE_OBJC_INFO): Likewise. (struct imp_entry): Add field has_cxx_cdtors. (struct imp_entry *imp_list): Add OCTI_UMSG_FAST_DECL, OCTI_METH_LIST_TEMPL, OCTI_METH_PROTO_LIST_TEMPL, OCTI_IVAR_LIST_TEMPL, OCTI_ASSIGN_IVAR_DECL, OCTI_ASSIGN_IVAR_FAST_DECL, OCTI_ASSIGN_GLOBAL_DECL, OCTI_ASSIGN_STRONGCAST_DECL. (umsg_fast_decl): Add. (objc_assign_ivar_decl): Add. (objc_assign_ivar_fast_decl): Add. (objc_assign_global_decl): Add. (objc_assign_strong_cast_decl): Add. (objc_method_list_ptr): Add. (objc_method_proto_list_ptr): Add. (objc_ivar_list_ptr): Add. * objc-act.c (should_call_super_dealloc): Add. (OBJC_VERSION): Bump to 6. (objc_is_gcable_type): Add. (objc_substitute_decl): Add. (objc_build_ivar_assignment): Add. (objc_build_global_assignment): Add. (objc_build_strong_cast_assignment): Add. (objc_is_gcable_p): Add. (objc_is_ivar_reference_p): Add. (objc_is_global_reference_p): Add. (generate_shared_structures): Add flags parameter. (objc_generate_cxx_ctor_or_dtor): Add. (objc_generate_cxx_cdtors): Add. (add_class): Add name parameter. (objc_types_share_size_and_alignment): Add. (comp_proto_with_proto): Add strict parameter. (CLS_HAS_CXX_STRUCTORS): Add. (TAG_ASSIGNIVAR): Add. (TAG_ASSIGNGLOBAL): Add. (TAG_ASSIGNSTRONGCAST): Add. (TAG_MSGSEND_FAST): Add. (TAG_ASSIGNIVAR_FAST): Add. (TAG_CXX_CONSTRUCT): Add. (TAG_CXX_DESTRUCT): Add. (OBJC_LOOKUP_CLASS): Add. (OBJC_LOOKUP_NO_SUPER): Add. (objc_finish_file): Add pch support. (objc_finish_implementation): Add Objective-C++ support. (synth_module_prologue): Likewise. (synth_module_prologue): Add fast dispatching. (objc_get_class_reference): Add Objective-C++ support. (objc_generate_write_barrier): Likewise. (next_sjlj_build_enter_and_setjmp): Likewise. (objc_begin_try_stmt): Likewise. (build_next_objc_exception_stuff): Add fast ivar support. (build_private_template): Mark the record as used so debug information is generated. (build_protocol_template): Add Objective-C++ support. (objc_method_parm_type) Likewise. (objc_generate_cxx_ctor_or_dtor): Likewise. (objc_generate_cxx_cdtors): Likewise. (build_protocol_initializer): Likewise. (build_category_template): Likewise. (build_class_template): Likewise. (build_method_list_template): Likewise. (build_category_initializer): Likewise. (build_shared_structure_initializer): Likewise. (objc_finish_message_expr): Likewise. (build_objc_method_call): Add fast dispatch support. (lookup_method_static): Add support to end search at superclasses. (add_method_to_hash_list): Add strict parameter to comp_proto_with_proto. (objc_add_method): Likewise. (objc_add_method): Also set the interface_value. (add_instance_variable): Add Objective-C++ support. (objc_is_public): Likewise. (start_class): Likewise. (continue_class): Likewise. (encode_aggregate_within): Likewise. (start_method_def): Likewise. (objc_start_function): Clear current_function_returns_value and current_function_returns_null. (really_start_method): Add Objective-C++ support. (objc_finish_method_definition): Add warning for missing [super dealloc]. (finish_objc): Add Objective-C++ support. (generate_objc_image_info): Likewise. (objc_lookup_ivar): Likewise. * objc-act.h (TYPE_HAS_OBJC_INFO): Likewise. (INIT_TYPE_OBJC_INFO): Likewise. (DUP_TYPE_OBJC_INFO): Likewise. From-SVN: r99857
2005-05-17 22:07:08 +02:00
build_int_cst (NULL_TREE, OFFS_ASSIGNIVAR_FAST),
NULL_TREE);
#else
/* Default to slower ivar method. */
objc_assign_ivar_fast_decl = objc_assign_ivar_decl;
#endif
/* id objc_assign_global (id, id *); */
/* id objc_assign_strongCast (id, id *); */
temp_type = build_function_type (objc_object_type,
tree_cons (NULL_TREE, objc_object_type,
tree_cons (NULL_TREE, build_pointer_type (objc_object_type),
OBJC_VOID_AT_END)));
objc_assign_global_decl
decl.c: Include langhooks.h. * gcc/java/decl.c: Include langhooks.h. (builtin_function): Remove. (java_init_decl_processing): Replace calls to builtin_function with add_builtin_function. * gcc/java/Make-lang.in (jc1$(exeext)): Depend on and link with attribs.o. (java/decl.o): Depend on langhooks.h. * gcc/java/java-tree.h (builtin_function): Remove. * gcc/tree.c (local_define_builtin): Replace calls to lang_hooks.builtin_function with add_builtin_function. * gcc/objc/objc-act.c (synth_module_prologue): Replace calls to builtin_function with add_builtin_function. (build_next_objc_exception_stuff): Replace calls to builtin_function with add_builtin_function. (build_objc_exception_stuff): Replace calls to builtin_function with add_builtin_function. * gcc/objcp/objcp-decl.h (objcp_builtin_function): Remove. * gcc/cp/decl.c (builtin_function_1): Move common code to add_builtin_function. (builtin_function): Rename to cxx_builtin_function. Change the signature. * gcc/cp/call.c: Include langhooks.h. (build_java_interface_fn_ref): Replace calls to builtin_function with add_builtin_function. * gcc/cp/Make-lang.in (cp/call.o): Depend on langhooks.h. * gcc/cp/cp-objcp-common.h (LANG_HOOKS_BUILTIN_FUNCTION): Define as cxx_builtin_function. * gcc/cp/cp-tree.h (builtin_function): Rename to cxx_builtin_function. Change the signature. * gcc/c-objc-common.h (LANG_HOOKS_BUILTIN_FUNCTION): Define as c_builtin_function. * gcc/c-tree.h (builtin_function): Rename to c_builtin_function. Change the signature. * gcc/ada/utils.c (builtin_function): Rename to gnat_builtin_function. Move common code to add_builtin_function. * gcc/ada/misc.c (LANG_HOOKS_BUILTIN_FUNCTION): Define as gnat_builtin_function. * gcc/ada/gigi.h (builtin_function): Rename to gnat_builtin_function. Change the signature. * gcc/c-decl.c (builtin_function): Rename to c_builtin_function. Move common code to add_builtin_function. * gcc/fortran/Make-lang.in (f951$(exeext)): Depend on and link with attribs.o. * gcc/fortran/trans.h (builtin_function): Rename to gfc_builtin_function. Change the signature. * gcc/fortran/f95-lang.c (LANG_HOOKS_BUILTIN_FUNCTION): Define as gfc_builtin_function. (builtin_function): Rename to gfc_builtin_function. Move common code to builtin_function. (gfc_define_builtin): Replace calls to builtin_function with gfc_define_builtin. * gcc/langhooks.c (add_builtin_function): New function. (lhd_builtin_function): New function. * gcc/langhooks.h (struct lang_hooks): Change the signature of builtin_function. (add_builtin_function): New function. * gcc/treelang/treetree.c (builtin_function): Remove. * gcc/tree-ssa-loop-prefetch.c (tree_ssa_prefetch_arrays): Replace calls to lang_hooks.builtin_function with add_builtin_function. * gcc/c-common.c (decl_builtin_1): Replace calls to lang_hooks.builtin_function with add_builtin_function. * gcc/config/alpha/alpha.c (alpha_init_builtins): Replace calls to lang_hooks.builtin_function with add_builtin_function. * gcc/config/frv/frv.c (def_builtin): Replace calls to lang_hooks.builtin_function with add_builtin_function. * gcc/config/s390/s390.c (s390_init_builtins): Replace calls to lang_hooks.builtin_function with add_builtin_function. * gcc/config/sparc/sparc.c (def_builtin): Replace calls to lang_hooks.builtin_function with add_builtin_function. * gcc/config/i386/i386.c (def_builtin): Replace calls to lang_hooks.builtin_function with add_builtin_function. (def_builtin): Replace calls to lang_hooks.builtin_function with add_builtin_function. * gcc/config/sh/sh.c (sh_media_init_builtins): Replace calls to lang_hooks.builtin_function with add_builtin_function. * gcc/config/c4x/c4x.c (c4x_init_builtins): Replace calls to lang_hooks.builtin_function with add_builtin_function. * gcc/config/stormy16/stormy16.c (xstormy16_init_builtins): Replace calls to lang_hooks.builtin_function with add_builtin_function. * gcc/config/iq2000/iq2000.c (def_builtin): Replace calls to lang_hooks.builtin_function with add_builtin_function. * gcc/config/ia64/ia64.c (def_builtin): Replace calls to lang_hooks.builtin_function with add_builtin_function. * gcc/config/rs6000/rs6000.c (def_builtin): Replace calls to lang_hooks.builtin_function with add_builtin_function. (altivec_init_builtins): Replace calls to lang_hooks.builtin_function with add_builtin_function. * gcc/config/arm/arm.c (def_mbuiltin): Replace calls to lang_hooks.builtin_function with add_builtin_function. (arm_init_tls_builtins): Replace calls to lang_hooks.builtin_function with add_builtin_function. * gcc/config/mips/mips.c (mips_init_builtins): Replace calls to lang_hooks.builtin_function with add_builtin_function. * gcc/config/bfin/bfin.c (def_builtin): Replace calls to lang_hooks.builtin_function with add_builtin_function. * gcc/langhooks-def.h (lhd_builtin_function): New function. (LANG_HOOKS_BUILTIN_FUNCTION): Define as lhd_builtin_function. From-SVN: r117981
2006-10-23 21:47:58 +02:00
= add_builtin_function (TAG_ASSIGNGLOBAL, temp_type, 0, NOT_BUILT_IN, NULL,
NULL_TREE);
Yet more Objective-C++... * objc-act.c (objc_finish_try_stmt): Add return value. (objc_build_synchronized): Likewise. * objc-act.c (objc_is_gcable_type): Add. (objc_substitute_decl): Add. (objc_build_ivar_assignment): Add. (objc_build_global_assignment): Add. (objc_build_strong_cast_assignment): Add. (objc_is_ivar_reference_p): Add. (objc_is_global_reference_p): Add. (objc_generate_write_barrier): Add. (objc_rewrite_function_call): Add. (objc_gimplify_expr): Add Objective-C++ support. * objc-act.h (ALLOC_OBJC_TYPE_LANG_SPECIFIC): Likewise. (SIZEOF_OBJC_TYPE_LANG_SPECIFIC): Add. (INIT_TYPE_OBJC_INFO): Add Objective-C++ support. (DUP_TYPE_OBJC_INFO): Likewise. (struct imp_entry): Add field has_cxx_cdtors. (struct imp_entry *imp_list): Add OCTI_UMSG_FAST_DECL, OCTI_METH_LIST_TEMPL, OCTI_METH_PROTO_LIST_TEMPL, OCTI_IVAR_LIST_TEMPL, OCTI_ASSIGN_IVAR_DECL, OCTI_ASSIGN_IVAR_FAST_DECL, OCTI_ASSIGN_GLOBAL_DECL, OCTI_ASSIGN_STRONGCAST_DECL. (umsg_fast_decl): Add. (objc_assign_ivar_decl): Add. (objc_assign_ivar_fast_decl): Add. (objc_assign_global_decl): Add. (objc_assign_strong_cast_decl): Add. (objc_method_list_ptr): Add. (objc_method_proto_list_ptr): Add. (objc_ivar_list_ptr): Add. * objc-act.c (should_call_super_dealloc): Add. (OBJC_VERSION): Bump to 6. (objc_is_gcable_type): Add. (objc_substitute_decl): Add. (objc_build_ivar_assignment): Add. (objc_build_global_assignment): Add. (objc_build_strong_cast_assignment): Add. (objc_is_gcable_p): Add. (objc_is_ivar_reference_p): Add. (objc_is_global_reference_p): Add. (generate_shared_structures): Add flags parameter. (objc_generate_cxx_ctor_or_dtor): Add. (objc_generate_cxx_cdtors): Add. (add_class): Add name parameter. (objc_types_share_size_and_alignment): Add. (comp_proto_with_proto): Add strict parameter. (CLS_HAS_CXX_STRUCTORS): Add. (TAG_ASSIGNIVAR): Add. (TAG_ASSIGNGLOBAL): Add. (TAG_ASSIGNSTRONGCAST): Add. (TAG_MSGSEND_FAST): Add. (TAG_ASSIGNIVAR_FAST): Add. (TAG_CXX_CONSTRUCT): Add. (TAG_CXX_DESTRUCT): Add. (OBJC_LOOKUP_CLASS): Add. (OBJC_LOOKUP_NO_SUPER): Add. (objc_finish_file): Add pch support. (objc_finish_implementation): Add Objective-C++ support. (synth_module_prologue): Likewise. (synth_module_prologue): Add fast dispatching. (objc_get_class_reference): Add Objective-C++ support. (objc_generate_write_barrier): Likewise. (next_sjlj_build_enter_and_setjmp): Likewise. (objc_begin_try_stmt): Likewise. (build_next_objc_exception_stuff): Add fast ivar support. (build_private_template): Mark the record as used so debug information is generated. (build_protocol_template): Add Objective-C++ support. (objc_method_parm_type) Likewise. (objc_generate_cxx_ctor_or_dtor): Likewise. (objc_generate_cxx_cdtors): Likewise. (build_protocol_initializer): Likewise. (build_category_template): Likewise. (build_class_template): Likewise. (build_method_list_template): Likewise. (build_category_initializer): Likewise. (build_shared_structure_initializer): Likewise. (objc_finish_message_expr): Likewise. (build_objc_method_call): Add fast dispatch support. (lookup_method_static): Add support to end search at superclasses. (add_method_to_hash_list): Add strict parameter to comp_proto_with_proto. (objc_add_method): Likewise. (objc_add_method): Also set the interface_value. (add_instance_variable): Add Objective-C++ support. (objc_is_public): Likewise. (start_class): Likewise. (continue_class): Likewise. (encode_aggregate_within): Likewise. (start_method_def): Likewise. (objc_start_function): Clear current_function_returns_value and current_function_returns_null. (really_start_method): Add Objective-C++ support. (objc_finish_method_definition): Add warning for missing [super dealloc]. (finish_objc): Add Objective-C++ support. (generate_objc_image_info): Likewise. (objc_lookup_ivar): Likewise. * objc-act.h (TYPE_HAS_OBJC_INFO): Likewise. (INIT_TYPE_OBJC_INFO): Likewise. (DUP_TYPE_OBJC_INFO): Likewise. From-SVN: r99857
2005-05-17 22:07:08 +02:00
objc_assign_strong_cast_decl
decl.c: Include langhooks.h. * gcc/java/decl.c: Include langhooks.h. (builtin_function): Remove. (java_init_decl_processing): Replace calls to builtin_function with add_builtin_function. * gcc/java/Make-lang.in (jc1$(exeext)): Depend on and link with attribs.o. (java/decl.o): Depend on langhooks.h. * gcc/java/java-tree.h (builtin_function): Remove. * gcc/tree.c (local_define_builtin): Replace calls to lang_hooks.builtin_function with add_builtin_function. * gcc/objc/objc-act.c (synth_module_prologue): Replace calls to builtin_function with add_builtin_function. (build_next_objc_exception_stuff): Replace calls to builtin_function with add_builtin_function. (build_objc_exception_stuff): Replace calls to builtin_function with add_builtin_function. * gcc/objcp/objcp-decl.h (objcp_builtin_function): Remove. * gcc/cp/decl.c (builtin_function_1): Move common code to add_builtin_function. (builtin_function): Rename to cxx_builtin_function. Change the signature. * gcc/cp/call.c: Include langhooks.h. (build_java_interface_fn_ref): Replace calls to builtin_function with add_builtin_function. * gcc/cp/Make-lang.in (cp/call.o): Depend on langhooks.h. * gcc/cp/cp-objcp-common.h (LANG_HOOKS_BUILTIN_FUNCTION): Define as cxx_builtin_function. * gcc/cp/cp-tree.h (builtin_function): Rename to cxx_builtin_function. Change the signature. * gcc/c-objc-common.h (LANG_HOOKS_BUILTIN_FUNCTION): Define as c_builtin_function. * gcc/c-tree.h (builtin_function): Rename to c_builtin_function. Change the signature. * gcc/ada/utils.c (builtin_function): Rename to gnat_builtin_function. Move common code to add_builtin_function. * gcc/ada/misc.c (LANG_HOOKS_BUILTIN_FUNCTION): Define as gnat_builtin_function. * gcc/ada/gigi.h (builtin_function): Rename to gnat_builtin_function. Change the signature. * gcc/c-decl.c (builtin_function): Rename to c_builtin_function. Move common code to add_builtin_function. * gcc/fortran/Make-lang.in (f951$(exeext)): Depend on and link with attribs.o. * gcc/fortran/trans.h (builtin_function): Rename to gfc_builtin_function. Change the signature. * gcc/fortran/f95-lang.c (LANG_HOOKS_BUILTIN_FUNCTION): Define as gfc_builtin_function. (builtin_function): Rename to gfc_builtin_function. Move common code to builtin_function. (gfc_define_builtin): Replace calls to builtin_function with gfc_define_builtin. * gcc/langhooks.c (add_builtin_function): New function. (lhd_builtin_function): New function. * gcc/langhooks.h (struct lang_hooks): Change the signature of builtin_function. (add_builtin_function): New function. * gcc/treelang/treetree.c (builtin_function): Remove. * gcc/tree-ssa-loop-prefetch.c (tree_ssa_prefetch_arrays): Replace calls to lang_hooks.builtin_function with add_builtin_function. * gcc/c-common.c (decl_builtin_1): Replace calls to lang_hooks.builtin_function with add_builtin_function. * gcc/config/alpha/alpha.c (alpha_init_builtins): Replace calls to lang_hooks.builtin_function with add_builtin_function. * gcc/config/frv/frv.c (def_builtin): Replace calls to lang_hooks.builtin_function with add_builtin_function. * gcc/config/s390/s390.c (s390_init_builtins): Replace calls to lang_hooks.builtin_function with add_builtin_function. * gcc/config/sparc/sparc.c (def_builtin): Replace calls to lang_hooks.builtin_function with add_builtin_function. * gcc/config/i386/i386.c (def_builtin): Replace calls to lang_hooks.builtin_function with add_builtin_function. (def_builtin): Replace calls to lang_hooks.builtin_function with add_builtin_function. * gcc/config/sh/sh.c (sh_media_init_builtins): Replace calls to lang_hooks.builtin_function with add_builtin_function. * gcc/config/c4x/c4x.c (c4x_init_builtins): Replace calls to lang_hooks.builtin_function with add_builtin_function. * gcc/config/stormy16/stormy16.c (xstormy16_init_builtins): Replace calls to lang_hooks.builtin_function with add_builtin_function. * gcc/config/iq2000/iq2000.c (def_builtin): Replace calls to lang_hooks.builtin_function with add_builtin_function. * gcc/config/ia64/ia64.c (def_builtin): Replace calls to lang_hooks.builtin_function with add_builtin_function. * gcc/config/rs6000/rs6000.c (def_builtin): Replace calls to lang_hooks.builtin_function with add_builtin_function. (altivec_init_builtins): Replace calls to lang_hooks.builtin_function with add_builtin_function. * gcc/config/arm/arm.c (def_mbuiltin): Replace calls to lang_hooks.builtin_function with add_builtin_function. (arm_init_tls_builtins): Replace calls to lang_hooks.builtin_function with add_builtin_function. * gcc/config/mips/mips.c (mips_init_builtins): Replace calls to lang_hooks.builtin_function with add_builtin_function. * gcc/config/bfin/bfin.c (def_builtin): Replace calls to lang_hooks.builtin_function with add_builtin_function. * gcc/langhooks-def.h (lhd_builtin_function): New function. (LANG_HOOKS_BUILTIN_FUNCTION): Define as lhd_builtin_function. From-SVN: r117981
2006-10-23 21:47:58 +02:00
= add_builtin_function (TAG_ASSIGNSTRONGCAST, temp_type, 0, NOT_BUILT_IN, NULL,
NULL_TREE);
}
c-common.c (flag_objc_sjlj_exceptions): New. * c-common.c (flag_objc_sjlj_exceptions): New. * c-common.h (flag_objc_sjlj_exceptions): Declare. * c-opts.c (c_common_handle_option): Set it. (c_common_post_options): Handle interation of different objective-c exception and runtime switches. * c-decl.c (c_eh_initialized_p): New. (finish_decl): Use it instead of local eh_initialized_p. * c-parse.in (nested_function, notype_nested_function): Record the result of compstmt. (compstmt_or_error): Likewise. (compstmt): Don't add_stmt the result. (stmt): Don't return anything. Rewrite objc try and sync rules. (objc_try_stmt, objc_catch_list): Remove. (objc_catch_block, objc_finally_block): Remove. (objc_catch_prefix, objc_catch_clause, objc_opt_catch_list): New. (objc_try_catch_clause, objc_finally_clause): New. (objc_try_catch_stmt): Rewrite. * c-tree.h (c_eh_initialized_p): Declare. * c-opt (fobjc-sjlj-exceptions): New. * except.c (output_function_exception_table): Don't call cgraph on non-decls. * objc/objc-act.c (UTAG_EXCDATA_VAR, UTAG_CAUGHTEXC_VAR, UTAG_RETHROWEXC_VAR, UTAG_EVALONCE_VAR, struct val_stack, catch_count_stack, exc_binding_stack, if_nesting_count, blk_nesting_count, objc_enter_block, objc_exit_block, objc_declare_variable, 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): Remove. (objc_create_temporary_var, struct objc_try_context, cur_try_context, objc_eh_runtime_type, objc_init_exceptions, objc_build_exc_ptr, next_sjlj_build_try_exit, next_sjlj_build_enter_and_setjmp, next_sjlj_build_exc_extract, next_sjlj_build_catch_list, next_sjlj_build_try_catch_finally, objc_begin_try_stmt, objc_begin_catch_clause, objc_finish_catch_clause, objc_build_finally_clause, objc_finish_try_stmt, objc_build_synchronized): New. (objc_is_object_id, objc_is_class_id): New. (objc_comptypes): Use them. (build_next_objc_exception_stuff): Break NeXT sjlj out from build_objc_exception_stuff. (synth_module_prologue): Update to match. (objc_build_throw_stmt): Use cur_try_context to decide if we're in a @catch. * objc/objc-act.h: Update prototypes. (OCTI_EXCEPTION_BLK_STACK, objc_exception_block_stack): Remove. testsuite/ * objc.dg/sync-1.m: New. * objc.dg/try-catch-1.m: Don't force next runtime. * objc.dg/try-catch-3.m, objc.dg/try-catch-4.m: Likewise. * objc.dg/try-catch-2.m: Likewise. Enable everywhere. Remove shadowed catch clause. * objc.dg/try-catch-5.m: New. From-SVN: r83332
2004-06-18 03:20:53 +02:00
static void
build_objc_exception_stuff (void)
{
tree noreturn_list, nothrow_list, temp_type;
noreturn_list = tree_cons (get_identifier ("noreturn"), NULL, NULL);
nothrow_list = tree_cons (get_identifier ("nothrow"), NULL, NULL);
/* void objc_exception_throw(id) __attribute__((noreturn)); */
/* void objc_sync_enter(id); */
/* void objc_sync_exit(id); */
temp_type = build_function_type (void_type_node,
Makefile.in (c-parse.o): Depend on $(C_COMMON_H). [gcc/ChangeLog] 2004-09-07 Ziemowit Laski <zlaski@apple.com> * Makefile.in (c-parse.o): Depend on $(C_COMMON_H). * c-parse.in: Include c-common.h instead of objc-act.h. (ivar_decl_list, ivar_decls, ivar_decl, ivars, ivar_declarator, myparms, myparm): Remove %type declarations. (methodtype, optparms, OBJC_TYPE_QUAL, objc_quals, objc_qual, objc_typename, objc_try_catch_stmt, optellipsis): Add %type declarations. (objc_inherit_code, objc_public_flag): Remove. (typespec_nonreserved_nonattr): Call objc_get_protocol_qualified_type() instead of get_static_reference() and get_protocol_reference(). (stmt_nocomp): Call grokparm() on @catch parameter. (objcdef): Move semantic action to objc_finish_implementation(). (classdef): Move semantic action to objc_start_class_interface(), objc_continue_interface(), objc_finish_interface(), objc_start_class_implementation(), objc_continue_implementation(), objc_start_category_interface() and objc_start_category_implementation(). (protocoldef): Move semantic actions to objc_start_protocol() and objc_finish_interface(). (ivar_decl_list): Remove nonterminal. (visibility_spec): Move semantic actions to objc_set_visibility(). (ivar_decls): Remove assignment to $$. (ivar_decl): Rephrase in terms of component_decl; call objc_add_instance_variable(). (ivars, ivar_declarator): Remove nonterminals. (opt_semi): New nonterminal. (methodtype): Remove semantic actions. (methoddef): Move semantic actions to objc_set_method_type(), objc_start_method_definition() and objc_finish_method_definition(). (methodproto): Move semantic actions to objc_set_method_type() and objc_add_method_declaration(). (methoddecl): Use objc_typename instead of typename; move semantic actions to objc_build_method_signature(). (optarglist, myxdecls, mydecl, myparms, myparm): Remove nonterminals. (optparmlist): Express in terms of optparms and optellipsis. (optparms, optellipsis, objc_qual, objc_quals, objc_typename): New nonterminals. (keyworddecl): Use objc_typename instead of typename. (rid_to_yy): Mark RID_IN, RID_OUT, RID_INOUT, RID_BYCOPY, RID_BYREF and RID_ONEWAY as returning OBJC_TYPE_QUAL to yyparse(). [gcc/objc/ChangeLog] 2004-09-07 Ziemowit Laski <zlaski@apple.com> * Make-lang.in (objc/objc-parse.o): Depend on $(C_COMMON_H) instead of objc/objc-act.h. (objc/objc-act.o): Depend on $(HASHTAB_H). * objc-act.c: Include hashtab.h; in ObjC++ mode, include cp-tree.h and objcp-decl.h instead of c-tree.h. (build_module_descriptor, get_class_ivars, synth_id_with_class_suffix, error_with_ivar, gen_method_decl, gen_declaration, setup_string_decl, build_protocol_template): Adjust prototypes. (build_module_initializer_routine, start_class, continue_class, finish_class, start_method_def, objc_start_function, start_protocol, build_method_decl, objc_add_method, add_instance_variable, build_ivar_reference, is_ivar, is_private, get_super_receiver, build_selector_table_decl, objc_push_parm, objc_get_parm_info, gen_type_name, gen_type_name_0, start_var_decl, finish_var_decl, create_field_decl): New prototypes. (objc_expand_function_end, comp_method_with_proto, objc_expr_last, gen_declaration_1, gen_declarator, is_complex_decl, adorn_decl, define_decl, create_builtin_decl, gen_declspecs): Remove prototypes. (TYPE_ID): Rename to OBJECT_TYPEDEF_NAME. (CLASS_TYPEDEF_NAME): New. (TAG_EXECCLASS): Change from a global variable to a #define. (TAG_RETURN_STRUCT): Delete. (TAG_GNUINIT): New, holds '__objc_gnu_init' name. (objc_inherit_code, objc_public_flag): New, moved from c-parse.in. (string_descriptor): New struct. (string_htab): New hash table. (string_hash, string_eq): New prototypes. (generate_struct_by_value_array): Call create_field_decl() instead of create_builtin_decl(). (objc_init): Do not initialize objc_ellipsis_node or TAG_EXECCLASS; In ObjC++ mode, call cxx_init() instead of c_objc_common_init(). (objc_finish_file): In ObjC++, call instantiate_pending_templates() and cp_finish_file(). (define_decl, get_static_reference, get_protocol_reference, create_builtin_decl): Remove functions. (objc_start_class_interface, objc_start_category_interface, objc_start_protocol, objc_continue_interface, objc_finish_interface, objc_start_class_implementation, objc_start_category_implementation, objc_continue_implementation, objc_finish_implementation, objc_set_visibility, objc_set_method_type, objc_build_method_signature, objc_add_method_declaration, objc_start_method_definition, objc_add_instance_variable, objc_get_protocol_qualified_type, create_field_decl, start_var_decl, finish_var_decl): New functions. (setup_string_decl): Simplify since it is only called once. (synth_module_prologue): Call build_class_template(); predefine 'id' and 'Class' as typedefs; rename 'temp_type' to 'type'; disable debug hooks for duration of function; fix GNU runtime messenger signatures to correspond to reality; forward-declare '__objc_exec_class' for the GNU runtime; call build_selector_table_decl(); in ObjC++ mode, generate 'extern "C" { ... }' wrappers around synthesized declarations; call build_protocol_template() and build_category_template(). (string_hash, string_eq): New functions. (objc_build_string_object): Check metaclass correctness only once; store string literals in hash table. (objc_build_constructor): Do not convert initializer elements; adjust for ObjC++ impedance mismatch. (build_objc_symtab_template): Call create_field_decl() instead of create_builtin_decl(). (init_objc_symtab): Add missing conversion to initializer element. (build_metadata_decl): Call start_var_decl() instead of define_decl(). (generate_objc_symtab_decl): Do not call build_category_template(); call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(). (build_module_descriptor): Call create_field_decl() instead of grokfield(); call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(); always mark module descriptor as used; move GNU runtime-specific functionality to build_module_initializer_routine(). (build_module_initializer_routine): New function, broken off of build_module_descriptor(). (objc_static_init_needed_p, objc_generate_static_init_call): New functions. (generate_static_references, generate_strings, build_selector_translation_table, generate_descriptor_table, generate_ivars_list, generate_dispatch_table, generate_category): Call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(); build a type directly instead of via groktypename(). (build_selector_reference_decl, build_selector_table_decl, build_class_reference_decl, build_protocol_reference, generate_objc_image_info): Call start_var_decl() instead of build_decl(). (build_selector_reference): For GNU runtime, do not call build_selector_reference_decl(). (build_selector, build_typed_selector_reference): Always convert result to the selector type. (add_objc_string): Cast return value to 'char *'. (build_method_prototype_template, build_selector_template, build_method_template): Use actual selector type for fields pointing to selectors. (finish_objc): For GNU runtime, call build_module_initializer_routine() after build_module_descriptor(). (generate_protocol_list, generate_shared_structures): Call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(); build a type directly instead of via groktypename(). (synth_id_with_class_suffix): Return a string. (get_arg_type_list): For instance methods, use the instance type for 'self'; do not call groktypename_in_parm_context(). (build_objc_string_decl): Squash redeclaration errors in ObjC++. (objc_is_class_name): Use OBJC_TYPE_NAME instead of TYPE_NAME; handle RECORD_TYPEs in ObjC as well as ObjC++. (objc_is_id): New function. (objc_is_object_ptr): Return the canonical type node. (objc_get_class_ivars): Simplify using get_class_ivars(). (get_class_ivars): Remove second parameter; create a fresh copy of the ivar list for each call; do not check for existence of super class. (objc_eh_runtime_type): Mark #ifndef OBJCPLUS. (objc_init_exceptions): When using SJLJ-style exceptions, require the use of '-fobjc-exceptions' flag; do not require it for DWARF-style exceptions. (objc_build_exc_ptr, next_sjlj_build_try_catch_finally): Use objc_object_type instead of objc_id_type. (objc_begin_catch_clause): Convert the incoming PARM_DECL into a VAR_DECL before placing it in the appropriate scope; do not call define_decl(); adjust call to c_begin_compound_stmt(); use objc_object_type instead of objc_id_type. (build_next_objc_exception_stuff): Call create_field_decl() instead of create_builtin_decl(); construct type directly instead of calling groktypename(); use OBJC_VOID_AT_END to mark end of function parameters. (build_private_template): Adjust call to get_class_ivars(); build a type directly instead of via groktypename(). (build_protocol_template, build_method_prototype_list_template, build_method_prototype_template, build_category_template, build_selector_template, build_class_template, build_super_template, build_ivar_template, build_ivar_list_template, build_method_list_template, build_method_template): Call create_field_decl() instead of grokfield(). (objc_method_parm_type): Do not call groktypename(). (generate_descriptor_table): Call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(). (generate_method_descriptors, build_protocol_initializer, generate_dispatch_tables, build_category_initializer, build_shared_structure_initializer): Do not call groktypename(). (generate_protocols): Call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(); do not call groktypename(). (error_with_ivar): Remove last parameter. (check_ivars): Do not iterate ovar CLASS_RAW_IVARS lists in addition to CLASS_IVARS lists; adjust calls to error_with_ivar(). (generate_ivar_lists): Convert one of the initializer elements; do not call groktypename(). (get_arg_type_list, start_method_def, gen_method_def): Account for new representation of variable arguments and '...' in Objective-C methods; add Objective-C++ impedance matching code. (is_objc_type_qualifier): Remove function. (adjust_type_for_id_default): Simplify; there is no longer a need to wade through declspecs. (lookup_interface, start_class, continue_class, finish_class, start_method_def, start_protocol, build_method_decl, objc_add_method, add_instance_variable, build_ivar_reference, is_ivar, is_private, get_super_receiver, objc_build_finally_epilogue): Make into static functions. (receiver_is_class_object): Use new IS_CLASS() macro. (objc_build_message_expr): Tweak ObjC++ message argument handling; call objc_finish_message_expr() instead of finish_message_expr(). (finish_message_expr): Rename to objc_finish_message_expr(); use OBJC_TYPE_NAME and OBJC_SET_TYPE_NAME macros instead of TYPE_NAME. call gen_type_name() instead of gen_declaration(); call objc_is_id() instead of using IS_ID and IS_CLASS; Use objc_class_name instead of calling get_identifier("Class"); handle CONVERT_EXPRs in receiver. (build_objc_method_call, warn_with_method): Do not call groktypename(). (build_ivar_reference): Call convert() instead of clobbering in a type. (hash_init): Initialize string_htab hash table. (add_instance_variable): Simplify parameter list; do not call grokfield(); do not populate CLASS_IVARS list. (start_class): Check for the existence of super class, if one was specified. (continue_class): Use CLASS_RAW_IVARS rather than CLASS_IVARS; do not call build_class_template(); adjust call to get_class_ivars(); call build_decl(), pushdecl() and finish_decl() instead of define_decl(). (finish_class): Call build_decl(), pushdecl() and finish_decl() instead of define_decl(). (add_protocols): Use PROTOCOL_BINFO_ELTS for the tree vector size. (start_protocol): Do not call build_protocol_template(); use PROTOCOL_BINFO_ELTS for the tree vector size. (encode_type_qualifiers): Do not handle the 'const' qualifier here. (encode_pointer): Encode 'const char *' as 'r*', for backwards compatibility. (encode_array): Use HOST_WIDE_INT_PRINT_DEC instead of "%ld". (encode_type): Handle the 'const' qualifier here. (objc_parmlist): New global variable, sued by objc_push_parm and objc_get_parm_info(). (objc_push_parm, objc_get_parm_info): New functions. (objc_expr_last): Remove function. (synth_self_and_ucmd_args): For instance methods, use the instance type for 'self'; call objc_push_parm() instead of push_parm_decl(). (start_method_def): Do not call push_scope(), declare_parm_level(), pop_scope(), push_parm_decl(), store_parm_decls() or objc_expr_last(); just use objc_push_parm() and objc_get_parm_info(). (comp_method_with_proto): Remove function. (objc_types_are_equivalent): Strip away indirections before comparing underlying types. (comp_proto_with_proto): Do not call groktypename(); types are no longer in raw declspec format. (objc_start_function): New function. (really_start_method): Call comp_proto_with_proto() instead of comp_method_with_proto(); call objc_start_function() instead of hand-crafting a function declarator. (continue_method_def, objc_expand_function_end): Remove functions. (get_super_receiver): Call objc_get_current_scope() instead of get_current_scope(); reference 'super_class' field (instead of 'class'). (finish_method_def): Rename to objc_finish_method_definition() and add a function decl parameter; move method encoding call from objc_expand_function_end(). (is_complex_decl, adorn_decl, gen_declarator, gen_declspecs, gen_declaration_1): Remove functions. (tmpbuf, RAW_DECLSPEC): Remove. (gen_declaration): Remove second parameter; simplify to deal with TYPE_P nodes instead of raw declspecs. (gen_type_name, gen_type_name_0): New functions. (gen_method_decl): Remove second parameter; call gen_type_name() instead of gen_declaration_1(). (dump_interface): Adjust calls to gen_declaration() and gen_method_decl(); do not allocate a separate string buffer. (init_objc): Allocate a larger string buffer to accommodate dump_interface(); adjust call to build_module_descriptor(); add call to build_module_initializer_routine() for the GNU runtime. (generate_classref_translation_entry): Do not call start_decl(); call finish_var_decl() instead of finish_decl(); call convert() instead of build_c_cast(). * objc-act.h (CLASS_OWN_IVARS): Remove accessor. (CLASS_BINFO_ELTS): Reduce from 6 to 5, now that CLASS_OWN_IVARS is gone. (OCTI_GNU_INIT_DECL, GNU_INIT_decl): New. (OCTI_ELLIPSIS_NODE, objc_ellipsis_node): Remove. (OCTI_ID_ID, id_type, objc_id_id): Rename to OCTI_ID_NAME, objc_object_type and objc_object_name, respectively. (OCTI_CLS_REF, OCTI_CLASS_NAME, objc_class_reference, objc_class_name): New. (IS_CLASS): New macro. (IS_ID, IS_SUPER): Robustify. (OCTI_EXECCLASS_DECL, execclass_decl): New. (finish_file, start_class, continue_class, finish_class, start_method_def, continue_method_def, finish_method_def, start_protocol, finish_protocol, objc_build_throw_stmt, objc_build_try_catch_finally_stmt, objc_build_synchronized_prologue, objc_build_synchronized_epilogue, objc_build_try_prologue, objc_build_try_epilogue, objc_build_catch_stmt, objc_build_catch_epilogue, objc_build_finally_prologue, objc_build_finally_epilogue, is_ivar, is_private, is_public, add_instance_variable, objc_add_method, get_super_receiver, objc_clear_super_receiver, get_class_ivars_from_name, get_class_reference, get_static_reference, get_object_reference, build_message_expr, finish_message_expr, build_selector_expr, build_ivar_reference, build_keyword_decl, build_method_decl, build_protocol_expr, build_objc_string_object, objc_declare_alias, objc_declare_class, objc_declare_protocols, objc_comptypes, objc_check_decl, build_encode_expr): Remove prototypes. (imp_count, cat_count): Make GGC-aware. (OBJC_SET_TYPE_NAME): New macro. From-SVN: r87168
2004-09-08 02:49:44 +02:00
tree_cons (NULL_TREE, objc_object_type,
OBJC_VOID_AT_END));
c-common.c (flag_objc_sjlj_exceptions): New. * c-common.c (flag_objc_sjlj_exceptions): New. * c-common.h (flag_objc_sjlj_exceptions): Declare. * c-opts.c (c_common_handle_option): Set it. (c_common_post_options): Handle interation of different objective-c exception and runtime switches. * c-decl.c (c_eh_initialized_p): New. (finish_decl): Use it instead of local eh_initialized_p. * c-parse.in (nested_function, notype_nested_function): Record the result of compstmt. (compstmt_or_error): Likewise. (compstmt): Don't add_stmt the result. (stmt): Don't return anything. Rewrite objc try and sync rules. (objc_try_stmt, objc_catch_list): Remove. (objc_catch_block, objc_finally_block): Remove. (objc_catch_prefix, objc_catch_clause, objc_opt_catch_list): New. (objc_try_catch_clause, objc_finally_clause): New. (objc_try_catch_stmt): Rewrite. * c-tree.h (c_eh_initialized_p): Declare. * c-opt (fobjc-sjlj-exceptions): New. * except.c (output_function_exception_table): Don't call cgraph on non-decls. * objc/objc-act.c (UTAG_EXCDATA_VAR, UTAG_CAUGHTEXC_VAR, UTAG_RETHROWEXC_VAR, UTAG_EVALONCE_VAR, struct val_stack, catch_count_stack, exc_binding_stack, if_nesting_count, blk_nesting_count, objc_enter_block, objc_exit_block, objc_declare_variable, 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): Remove. (objc_create_temporary_var, struct objc_try_context, cur_try_context, objc_eh_runtime_type, objc_init_exceptions, objc_build_exc_ptr, next_sjlj_build_try_exit, next_sjlj_build_enter_and_setjmp, next_sjlj_build_exc_extract, next_sjlj_build_catch_list, next_sjlj_build_try_catch_finally, objc_begin_try_stmt, objc_begin_catch_clause, objc_finish_catch_clause, objc_build_finally_clause, objc_finish_try_stmt, objc_build_synchronized): New. (objc_is_object_id, objc_is_class_id): New. (objc_comptypes): Use them. (build_next_objc_exception_stuff): Break NeXT sjlj out from build_objc_exception_stuff. (synth_module_prologue): Update to match. (objc_build_throw_stmt): Use cur_try_context to decide if we're in a @catch. * objc/objc-act.h: Update prototypes. (OCTI_EXCEPTION_BLK_STACK, objc_exception_block_stack): Remove. testsuite/ * objc.dg/sync-1.m: New. * objc.dg/try-catch-1.m: Don't force next runtime. * objc.dg/try-catch-3.m, objc.dg/try-catch-4.m: Likewise. * objc.dg/try-catch-2.m: Likewise. Enable everywhere. Remove shadowed catch clause. * objc.dg/try-catch-5.m: New. From-SVN: r83332
2004-06-18 03:20:53 +02:00
objc_exception_throw_decl
decl.c: Include langhooks.h. * gcc/java/decl.c: Include langhooks.h. (builtin_function): Remove. (java_init_decl_processing): Replace calls to builtin_function with add_builtin_function. * gcc/java/Make-lang.in (jc1$(exeext)): Depend on and link with attribs.o. (java/decl.o): Depend on langhooks.h. * gcc/java/java-tree.h (builtin_function): Remove. * gcc/tree.c (local_define_builtin): Replace calls to lang_hooks.builtin_function with add_builtin_function. * gcc/objc/objc-act.c (synth_module_prologue): Replace calls to builtin_function with add_builtin_function. (build_next_objc_exception_stuff): Replace calls to builtin_function with add_builtin_function. (build_objc_exception_stuff): Replace calls to builtin_function with add_builtin_function. * gcc/objcp/objcp-decl.h (objcp_builtin_function): Remove. * gcc/cp/decl.c (builtin_function_1): Move common code to add_builtin_function. (builtin_function): Rename to cxx_builtin_function. Change the signature. * gcc/cp/call.c: Include langhooks.h. (build_java_interface_fn_ref): Replace calls to builtin_function with add_builtin_function. * gcc/cp/Make-lang.in (cp/call.o): Depend on langhooks.h. * gcc/cp/cp-objcp-common.h (LANG_HOOKS_BUILTIN_FUNCTION): Define as cxx_builtin_function. * gcc/cp/cp-tree.h (builtin_function): Rename to cxx_builtin_function. Change the signature. * gcc/c-objc-common.h (LANG_HOOKS_BUILTIN_FUNCTION): Define as c_builtin_function. * gcc/c-tree.h (builtin_function): Rename to c_builtin_function. Change the signature. * gcc/ada/utils.c (builtin_function): Rename to gnat_builtin_function. Move common code to add_builtin_function. * gcc/ada/misc.c (LANG_HOOKS_BUILTIN_FUNCTION): Define as gnat_builtin_function. * gcc/ada/gigi.h (builtin_function): Rename to gnat_builtin_function. Change the signature. * gcc/c-decl.c (builtin_function): Rename to c_builtin_function. Move common code to add_builtin_function. * gcc/fortran/Make-lang.in (f951$(exeext)): Depend on and link with attribs.o. * gcc/fortran/trans.h (builtin_function): Rename to gfc_builtin_function. Change the signature. * gcc/fortran/f95-lang.c (LANG_HOOKS_BUILTIN_FUNCTION): Define as gfc_builtin_function. (builtin_function): Rename to gfc_builtin_function. Move common code to builtin_function. (gfc_define_builtin): Replace calls to builtin_function with gfc_define_builtin. * gcc/langhooks.c (add_builtin_function): New function. (lhd_builtin_function): New function. * gcc/langhooks.h (struct lang_hooks): Change the signature of builtin_function. (add_builtin_function): New function. * gcc/treelang/treetree.c (builtin_function): Remove. * gcc/tree-ssa-loop-prefetch.c (tree_ssa_prefetch_arrays): Replace calls to lang_hooks.builtin_function with add_builtin_function. * gcc/c-common.c (decl_builtin_1): Replace calls to lang_hooks.builtin_function with add_builtin_function. * gcc/config/alpha/alpha.c (alpha_init_builtins): Replace calls to lang_hooks.builtin_function with add_builtin_function. * gcc/config/frv/frv.c (def_builtin): Replace calls to lang_hooks.builtin_function with add_builtin_function. * gcc/config/s390/s390.c (s390_init_builtins): Replace calls to lang_hooks.builtin_function with add_builtin_function. * gcc/config/sparc/sparc.c (def_builtin): Replace calls to lang_hooks.builtin_function with add_builtin_function. * gcc/config/i386/i386.c (def_builtin): Replace calls to lang_hooks.builtin_function with add_builtin_function. (def_builtin): Replace calls to lang_hooks.builtin_function with add_builtin_function. * gcc/config/sh/sh.c (sh_media_init_builtins): Replace calls to lang_hooks.builtin_function with add_builtin_function. * gcc/config/c4x/c4x.c (c4x_init_builtins): Replace calls to lang_hooks.builtin_function with add_builtin_function. * gcc/config/stormy16/stormy16.c (xstormy16_init_builtins): Replace calls to lang_hooks.builtin_function with add_builtin_function. * gcc/config/iq2000/iq2000.c (def_builtin): Replace calls to lang_hooks.builtin_function with add_builtin_function. * gcc/config/ia64/ia64.c (def_builtin): Replace calls to lang_hooks.builtin_function with add_builtin_function. * gcc/config/rs6000/rs6000.c (def_builtin): Replace calls to lang_hooks.builtin_function with add_builtin_function. (altivec_init_builtins): Replace calls to lang_hooks.builtin_function with add_builtin_function. * gcc/config/arm/arm.c (def_mbuiltin): Replace calls to lang_hooks.builtin_function with add_builtin_function. (arm_init_tls_builtins): Replace calls to lang_hooks.builtin_function with add_builtin_function. * gcc/config/mips/mips.c (mips_init_builtins): Replace calls to lang_hooks.builtin_function with add_builtin_function. * gcc/config/bfin/bfin.c (def_builtin): Replace calls to lang_hooks.builtin_function with add_builtin_function. * gcc/langhooks-def.h (lhd_builtin_function): New function. (LANG_HOOKS_BUILTIN_FUNCTION): Define as lhd_builtin_function. From-SVN: r117981
2006-10-23 21:47:58 +02:00
= add_builtin_function (TAG_EXCEPTIONTHROW, temp_type, 0, NOT_BUILT_IN, NULL,
noreturn_list);
c-common.c (flag_objc_sjlj_exceptions): New. * c-common.c (flag_objc_sjlj_exceptions): New. * c-common.h (flag_objc_sjlj_exceptions): Declare. * c-opts.c (c_common_handle_option): Set it. (c_common_post_options): Handle interation of different objective-c exception and runtime switches. * c-decl.c (c_eh_initialized_p): New. (finish_decl): Use it instead of local eh_initialized_p. * c-parse.in (nested_function, notype_nested_function): Record the result of compstmt. (compstmt_or_error): Likewise. (compstmt): Don't add_stmt the result. (stmt): Don't return anything. Rewrite objc try and sync rules. (objc_try_stmt, objc_catch_list): Remove. (objc_catch_block, objc_finally_block): Remove. (objc_catch_prefix, objc_catch_clause, objc_opt_catch_list): New. (objc_try_catch_clause, objc_finally_clause): New. (objc_try_catch_stmt): Rewrite. * c-tree.h (c_eh_initialized_p): Declare. * c-opt (fobjc-sjlj-exceptions): New. * except.c (output_function_exception_table): Don't call cgraph on non-decls. * objc/objc-act.c (UTAG_EXCDATA_VAR, UTAG_CAUGHTEXC_VAR, UTAG_RETHROWEXC_VAR, UTAG_EVALONCE_VAR, struct val_stack, catch_count_stack, exc_binding_stack, if_nesting_count, blk_nesting_count, objc_enter_block, objc_exit_block, objc_declare_variable, 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): Remove. (objc_create_temporary_var, struct objc_try_context, cur_try_context, objc_eh_runtime_type, objc_init_exceptions, objc_build_exc_ptr, next_sjlj_build_try_exit, next_sjlj_build_enter_and_setjmp, next_sjlj_build_exc_extract, next_sjlj_build_catch_list, next_sjlj_build_try_catch_finally, objc_begin_try_stmt, objc_begin_catch_clause, objc_finish_catch_clause, objc_build_finally_clause, objc_finish_try_stmt, objc_build_synchronized): New. (objc_is_object_id, objc_is_class_id): New. (objc_comptypes): Use them. (build_next_objc_exception_stuff): Break NeXT sjlj out from build_objc_exception_stuff. (synth_module_prologue): Update to match. (objc_build_throw_stmt): Use cur_try_context to decide if we're in a @catch. * objc/objc-act.h: Update prototypes. (OCTI_EXCEPTION_BLK_STACK, objc_exception_block_stack): Remove. testsuite/ * objc.dg/sync-1.m: New. * objc.dg/try-catch-1.m: Don't force next runtime. * objc.dg/try-catch-3.m, objc.dg/try-catch-4.m: Likewise. * objc.dg/try-catch-2.m: Likewise. Enable everywhere. Remove shadowed catch clause. * objc.dg/try-catch-5.m: New. From-SVN: r83332
2004-06-18 03:20:53 +02:00
objc_sync_enter_decl
decl.c: Include langhooks.h. * gcc/java/decl.c: Include langhooks.h. (builtin_function): Remove. (java_init_decl_processing): Replace calls to builtin_function with add_builtin_function. * gcc/java/Make-lang.in (jc1$(exeext)): Depend on and link with attribs.o. (java/decl.o): Depend on langhooks.h. * gcc/java/java-tree.h (builtin_function): Remove. * gcc/tree.c (local_define_builtin): Replace calls to lang_hooks.builtin_function with add_builtin_function. * gcc/objc/objc-act.c (synth_module_prologue): Replace calls to builtin_function with add_builtin_function. (build_next_objc_exception_stuff): Replace calls to builtin_function with add_builtin_function. (build_objc_exception_stuff): Replace calls to builtin_function with add_builtin_function. * gcc/objcp/objcp-decl.h (objcp_builtin_function): Remove. * gcc/cp/decl.c (builtin_function_1): Move common code to add_builtin_function. (builtin_function): Rename to cxx_builtin_function. Change the signature. * gcc/cp/call.c: Include langhooks.h. (build_java_interface_fn_ref): Replace calls to builtin_function with add_builtin_function. * gcc/cp/Make-lang.in (cp/call.o): Depend on langhooks.h. * gcc/cp/cp-objcp-common.h (LANG_HOOKS_BUILTIN_FUNCTION): Define as cxx_builtin_function. * gcc/cp/cp-tree.h (builtin_function): Rename to cxx_builtin_function. Change the signature. * gcc/c-objc-common.h (LANG_HOOKS_BUILTIN_FUNCTION): Define as c_builtin_function. * gcc/c-tree.h (builtin_function): Rename to c_builtin_function. Change the signature. * gcc/ada/utils.c (builtin_function): Rename to gnat_builtin_function. Move common code to add_builtin_function. * gcc/ada/misc.c (LANG_HOOKS_BUILTIN_FUNCTION): Define as gnat_builtin_function. * gcc/ada/gigi.h (builtin_function): Rename to gnat_builtin_function. Change the signature. * gcc/c-decl.c (builtin_function): Rename to c_builtin_function. Move common code to add_builtin_function. * gcc/fortran/Make-lang.in (f951$(exeext)): Depend on and link with attribs.o. * gcc/fortran/trans.h (builtin_function): Rename to gfc_builtin_function. Change the signature. * gcc/fortran/f95-lang.c (LANG_HOOKS_BUILTIN_FUNCTION): Define as gfc_builtin_function. (builtin_function): Rename to gfc_builtin_function. Move common code to builtin_function. (gfc_define_builtin): Replace calls to builtin_function with gfc_define_builtin. * gcc/langhooks.c (add_builtin_function): New function. (lhd_builtin_function): New function. * gcc/langhooks.h (struct lang_hooks): Change the signature of builtin_function. (add_builtin_function): New function. * gcc/treelang/treetree.c (builtin_function): Remove. * gcc/tree-ssa-loop-prefetch.c (tree_ssa_prefetch_arrays): Replace calls to lang_hooks.builtin_function with add_builtin_function. * gcc/c-common.c (decl_builtin_1): Replace calls to lang_hooks.builtin_function with add_builtin_function. * gcc/config/alpha/alpha.c (alpha_init_builtins): Replace calls to lang_hooks.builtin_function with add_builtin_function. * gcc/config/frv/frv.c (def_builtin): Replace calls to lang_hooks.builtin_function with add_builtin_function. * gcc/config/s390/s390.c (s390_init_builtins): Replace calls to lang_hooks.builtin_function with add_builtin_function. * gcc/config/sparc/sparc.c (def_builtin): Replace calls to lang_hooks.builtin_function with add_builtin_function. * gcc/config/i386/i386.c (def_builtin): Replace calls to lang_hooks.builtin_function with add_builtin_function. (def_builtin): Replace calls to lang_hooks.builtin_function with add_builtin_function. * gcc/config/sh/sh.c (sh_media_init_builtins): Replace calls to lang_hooks.builtin_function with add_builtin_function. * gcc/config/c4x/c4x.c (c4x_init_builtins): Replace calls to lang_hooks.builtin_function with add_builtin_function. * gcc/config/stormy16/stormy16.c (xstormy16_init_builtins): Replace calls to lang_hooks.builtin_function with add_builtin_function. * gcc/config/iq2000/iq2000.c (def_builtin): Replace calls to lang_hooks.builtin_function with add_builtin_function. * gcc/config/ia64/ia64.c (def_builtin): Replace calls to lang_hooks.builtin_function with add_builtin_function. * gcc/config/rs6000/rs6000.c (def_builtin): Replace calls to lang_hooks.builtin_function with add_builtin_function. (altivec_init_builtins): Replace calls to lang_hooks.builtin_function with add_builtin_function. * gcc/config/arm/arm.c (def_mbuiltin): Replace calls to lang_hooks.builtin_function with add_builtin_function. (arm_init_tls_builtins): Replace calls to lang_hooks.builtin_function with add_builtin_function. * gcc/config/mips/mips.c (mips_init_builtins): Replace calls to lang_hooks.builtin_function with add_builtin_function. * gcc/config/bfin/bfin.c (def_builtin): Replace calls to lang_hooks.builtin_function with add_builtin_function. * gcc/langhooks-def.h (lhd_builtin_function): New function. (LANG_HOOKS_BUILTIN_FUNCTION): Define as lhd_builtin_function. From-SVN: r117981
2006-10-23 21:47:58 +02:00
= add_builtin_function (TAG_SYNCENTER, temp_type, 0, NOT_BUILT_IN,
NULL, nothrow_list);
c-common.c (flag_objc_sjlj_exceptions): New. * c-common.c (flag_objc_sjlj_exceptions): New. * c-common.h (flag_objc_sjlj_exceptions): Declare. * c-opts.c (c_common_handle_option): Set it. (c_common_post_options): Handle interation of different objective-c exception and runtime switches. * c-decl.c (c_eh_initialized_p): New. (finish_decl): Use it instead of local eh_initialized_p. * c-parse.in (nested_function, notype_nested_function): Record the result of compstmt. (compstmt_or_error): Likewise. (compstmt): Don't add_stmt the result. (stmt): Don't return anything. Rewrite objc try and sync rules. (objc_try_stmt, objc_catch_list): Remove. (objc_catch_block, objc_finally_block): Remove. (objc_catch_prefix, objc_catch_clause, objc_opt_catch_list): New. (objc_try_catch_clause, objc_finally_clause): New. (objc_try_catch_stmt): Rewrite. * c-tree.h (c_eh_initialized_p): Declare. * c-opt (fobjc-sjlj-exceptions): New. * except.c (output_function_exception_table): Don't call cgraph on non-decls. * objc/objc-act.c (UTAG_EXCDATA_VAR, UTAG_CAUGHTEXC_VAR, UTAG_RETHROWEXC_VAR, UTAG_EVALONCE_VAR, struct val_stack, catch_count_stack, exc_binding_stack, if_nesting_count, blk_nesting_count, objc_enter_block, objc_exit_block, objc_declare_variable, 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): Remove. (objc_create_temporary_var, struct objc_try_context, cur_try_context, objc_eh_runtime_type, objc_init_exceptions, objc_build_exc_ptr, next_sjlj_build_try_exit, next_sjlj_build_enter_and_setjmp, next_sjlj_build_exc_extract, next_sjlj_build_catch_list, next_sjlj_build_try_catch_finally, objc_begin_try_stmt, objc_begin_catch_clause, objc_finish_catch_clause, objc_build_finally_clause, objc_finish_try_stmt, objc_build_synchronized): New. (objc_is_object_id, objc_is_class_id): New. (objc_comptypes): Use them. (build_next_objc_exception_stuff): Break NeXT sjlj out from build_objc_exception_stuff. (synth_module_prologue): Update to match. (objc_build_throw_stmt): Use cur_try_context to decide if we're in a @catch. * objc/objc-act.h: Update prototypes. (OCTI_EXCEPTION_BLK_STACK, objc_exception_block_stack): Remove. testsuite/ * objc.dg/sync-1.m: New. * objc.dg/try-catch-1.m: Don't force next runtime. * objc.dg/try-catch-3.m, objc.dg/try-catch-4.m: Likewise. * objc.dg/try-catch-2.m: Likewise. Enable everywhere. Remove shadowed catch clause. * objc.dg/try-catch-5.m: New. From-SVN: r83332
2004-06-18 03:20:53 +02:00
objc_sync_exit_decl
decl.c: Include langhooks.h. * gcc/java/decl.c: Include langhooks.h. (builtin_function): Remove. (java_init_decl_processing): Replace calls to builtin_function with add_builtin_function. * gcc/java/Make-lang.in (jc1$(exeext)): Depend on and link with attribs.o. (java/decl.o): Depend on langhooks.h. * gcc/java/java-tree.h (builtin_function): Remove. * gcc/tree.c (local_define_builtin): Replace calls to lang_hooks.builtin_function with add_builtin_function. * gcc/objc/objc-act.c (synth_module_prologue): Replace calls to builtin_function with add_builtin_function. (build_next_objc_exception_stuff): Replace calls to builtin_function with add_builtin_function. (build_objc_exception_stuff): Replace calls to builtin_function with add_builtin_function. * gcc/objcp/objcp-decl.h (objcp_builtin_function): Remove. * gcc/cp/decl.c (builtin_function_1): Move common code to add_builtin_function. (builtin_function): Rename to cxx_builtin_function. Change the signature. * gcc/cp/call.c: Include langhooks.h. (build_java_interface_fn_ref): Replace calls to builtin_function with add_builtin_function. * gcc/cp/Make-lang.in (cp/call.o): Depend on langhooks.h. * gcc/cp/cp-objcp-common.h (LANG_HOOKS_BUILTIN_FUNCTION): Define as cxx_builtin_function. * gcc/cp/cp-tree.h (builtin_function): Rename to cxx_builtin_function. Change the signature. * gcc/c-objc-common.h (LANG_HOOKS_BUILTIN_FUNCTION): Define as c_builtin_function. * gcc/c-tree.h (builtin_function): Rename to c_builtin_function. Change the signature. * gcc/ada/utils.c (builtin_function): Rename to gnat_builtin_function. Move common code to add_builtin_function. * gcc/ada/misc.c (LANG_HOOKS_BUILTIN_FUNCTION): Define as gnat_builtin_function. * gcc/ada/gigi.h (builtin_function): Rename to gnat_builtin_function. Change the signature. * gcc/c-decl.c (builtin_function): Rename to c_builtin_function. Move common code to add_builtin_function. * gcc/fortran/Make-lang.in (f951$(exeext)): Depend on and link with attribs.o. * gcc/fortran/trans.h (builtin_function): Rename to gfc_builtin_function. Change the signature. * gcc/fortran/f95-lang.c (LANG_HOOKS_BUILTIN_FUNCTION): Define as gfc_builtin_function. (builtin_function): Rename to gfc_builtin_function. Move common code to builtin_function. (gfc_define_builtin): Replace calls to builtin_function with gfc_define_builtin. * gcc/langhooks.c (add_builtin_function): New function. (lhd_builtin_function): New function. * gcc/langhooks.h (struct lang_hooks): Change the signature of builtin_function. (add_builtin_function): New function. * gcc/treelang/treetree.c (builtin_function): Remove. * gcc/tree-ssa-loop-prefetch.c (tree_ssa_prefetch_arrays): Replace calls to lang_hooks.builtin_function with add_builtin_function. * gcc/c-common.c (decl_builtin_1): Replace calls to lang_hooks.builtin_function with add_builtin_function. * gcc/config/alpha/alpha.c (alpha_init_builtins): Replace calls to lang_hooks.builtin_function with add_builtin_function. * gcc/config/frv/frv.c (def_builtin): Replace calls to lang_hooks.builtin_function with add_builtin_function. * gcc/config/s390/s390.c (s390_init_builtins): Replace calls to lang_hooks.builtin_function with add_builtin_function. * gcc/config/sparc/sparc.c (def_builtin): Replace calls to lang_hooks.builtin_function with add_builtin_function. * gcc/config/i386/i386.c (def_builtin): Replace calls to lang_hooks.builtin_function with add_builtin_function. (def_builtin): Replace calls to lang_hooks.builtin_function with add_builtin_function. * gcc/config/sh/sh.c (sh_media_init_builtins): Replace calls to lang_hooks.builtin_function with add_builtin_function. * gcc/config/c4x/c4x.c (c4x_init_builtins): Replace calls to lang_hooks.builtin_function with add_builtin_function. * gcc/config/stormy16/stormy16.c (xstormy16_init_builtins): Replace calls to lang_hooks.builtin_function with add_builtin_function. * gcc/config/iq2000/iq2000.c (def_builtin): Replace calls to lang_hooks.builtin_function with add_builtin_function. * gcc/config/ia64/ia64.c (def_builtin): Replace calls to lang_hooks.builtin_function with add_builtin_function. * gcc/config/rs6000/rs6000.c (def_builtin): Replace calls to lang_hooks.builtin_function with add_builtin_function. (altivec_init_builtins): Replace calls to lang_hooks.builtin_function with add_builtin_function. * gcc/config/arm/arm.c (def_mbuiltin): Replace calls to lang_hooks.builtin_function with add_builtin_function. (arm_init_tls_builtins): Replace calls to lang_hooks.builtin_function with add_builtin_function. * gcc/config/mips/mips.c (mips_init_builtins): Replace calls to lang_hooks.builtin_function with add_builtin_function. * gcc/config/bfin/bfin.c (def_builtin): Replace calls to lang_hooks.builtin_function with add_builtin_function. * gcc/langhooks-def.h (lhd_builtin_function): New function. (LANG_HOOKS_BUILTIN_FUNCTION): Define as lhd_builtin_function. From-SVN: r117981
2006-10-23 21:47:58 +02:00
= add_builtin_function (TAG_SYNCEXIT, temp_type, 0, NOT_BUILT_IN,
NULL, nothrow_list);
c-common.c (flag_objc_sjlj_exceptions): New. * c-common.c (flag_objc_sjlj_exceptions): New. * c-common.h (flag_objc_sjlj_exceptions): Declare. * c-opts.c (c_common_handle_option): Set it. (c_common_post_options): Handle interation of different objective-c exception and runtime switches. * c-decl.c (c_eh_initialized_p): New. (finish_decl): Use it instead of local eh_initialized_p. * c-parse.in (nested_function, notype_nested_function): Record the result of compstmt. (compstmt_or_error): Likewise. (compstmt): Don't add_stmt the result. (stmt): Don't return anything. Rewrite objc try and sync rules. (objc_try_stmt, objc_catch_list): Remove. (objc_catch_block, objc_finally_block): Remove. (objc_catch_prefix, objc_catch_clause, objc_opt_catch_list): New. (objc_try_catch_clause, objc_finally_clause): New. (objc_try_catch_stmt): Rewrite. * c-tree.h (c_eh_initialized_p): Declare. * c-opt (fobjc-sjlj-exceptions): New. * except.c (output_function_exception_table): Don't call cgraph on non-decls. * objc/objc-act.c (UTAG_EXCDATA_VAR, UTAG_CAUGHTEXC_VAR, UTAG_RETHROWEXC_VAR, UTAG_EVALONCE_VAR, struct val_stack, catch_count_stack, exc_binding_stack, if_nesting_count, blk_nesting_count, objc_enter_block, objc_exit_block, objc_declare_variable, 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): Remove. (objc_create_temporary_var, struct objc_try_context, cur_try_context, objc_eh_runtime_type, objc_init_exceptions, objc_build_exc_ptr, next_sjlj_build_try_exit, next_sjlj_build_enter_and_setjmp, next_sjlj_build_exc_extract, next_sjlj_build_catch_list, next_sjlj_build_try_catch_finally, objc_begin_try_stmt, objc_begin_catch_clause, objc_finish_catch_clause, objc_build_finally_clause, objc_finish_try_stmt, objc_build_synchronized): New. (objc_is_object_id, objc_is_class_id): New. (objc_comptypes): Use them. (build_next_objc_exception_stuff): Break NeXT sjlj out from build_objc_exception_stuff. (synth_module_prologue): Update to match. (objc_build_throw_stmt): Use cur_try_context to decide if we're in a @catch. * objc/objc-act.h: Update prototypes. (OCTI_EXCEPTION_BLK_STACK, objc_exception_block_stack): Remove. testsuite/ * objc.dg/sync-1.m: New. * objc.dg/try-catch-1.m: Don't force next runtime. * objc.dg/try-catch-3.m, objc.dg/try-catch-4.m: Likewise. * objc.dg/try-catch-2.m: Likewise. Enable everywhere. Remove shadowed catch clause. * objc.dg/try-catch-5.m: New. From-SVN: r83332
2004-06-18 03:20:53 +02:00
}
objc-act.c (build_private_template): Change to return 'void'... [gcc/objc/ChangeLog] 2004-12-15 Ziemowit Laski <zlaski@apple.com> * objc-act.c (build_private_template): Change to return 'void'; do not set ivar_context, uprivate_record or objc_instance_type. (objc_comptypes, gen_type_name_0): For types 'id' and 'Class', retrieve protocol list from the pointee rather than the pointer itself; check TYPE_HAS_OBJC_INFO(...) precondition before accessing TYPE_OBJC_PROTOCOL_LIST. (objc_get_protocol_qualified_type): For types 'id' and 'Class', construct a variant of the pointee as well as the pointer, and store protocol information in the former. When creating variants of RECORD_TYPEs, clone their TYPE_LANG_SPECIFIC fields and propagate TYPE_OBJC_INTERFACE information. (objc_declare_class): If a TYPE_DECL is looked up, retrieve the underlying RECORD_TYPE to check for presence of TYPE_OBJC_INTERFACE; for newly-created RECORD_TYPEs, create a tentative TYPE_OBJC_INTERFACE holding an IDENTIFIER_NODE. (objc_finish_message_expr): Check TYPE_HAS_OBJC_INFO(...) before accessing TYPE_OBJC_PROTOCOL_LIST; Use TYPE_OBJC_INTERFACE instead of calling lookup_interface(); allow for TYPE_OBJC_INTERFACE holding an IDENTIFIER_NODE (meaning a @class forward-declaration only). (objc_is_public): Check TYPE_OBJC_INTERFACE instead of calling lookup_interface(). (continue_class): For @implementations, set ivar_context, uprivate_record and objc_instance_type, for @interfaces, call build_private_template(). (encode_pointer): Check TYPE_HAS_OBJC_INFO(...) before accessing TYPE_OBJC_INTERFACE. (objc_types_are_equivalent): Check TYPE_HAS_OBJC_INFO(...) before accessing TYPE_OBJC_PROTOCOL_LIST. * objc-act.h (OBJC_INFO_SLOT_ELTS, TYPE_OBJC_INFO, INIT_TYPE_OBJC_INFO, DUP_TYPE_OBJC_INFO, ALLOC_OBJC_TYPE_LANG_SPECIFIC, SIZEOF_OBJC_TYPE_LANG_SPECIFIC): New macros. (TYPE_OBJC_INTERFACE): Replaces TREE_STATIC_INSTANCE and now points to an actual @interface; stored in TYPE_LANG_SPECIFIC(...). (TYPE_OBJC_PROTOCOL_LIST): Replaces TYPE_PROTOCOL_LIST; stored in TYPE_LANG_SPECIFIC(...). (TREE_STATIC_INSTANCE, TYPE_PROTOCOL_LIST): Delete. (IS_ID, IS_CLASS, IS_PROTOCOL_QUALIFIED_UNTYPED, IS_SUPER, TYPED_OBJECT): Check for POINTER_TYPE rather than POINTER_TYPE_P; adjust for use of TYPE_OBJC_INTERFACE and TYPE_OBJC_PROTOCOL_LIST instead of TREE_STATIC_INSTANCE and TYPE_PROTOCOL_LIST. From-SVN: r92239
2004-12-16 02:10:38 +01:00
/* Construct a C struct corresponding to ObjC class CLASS, with the same
name as the class:
c-common.c (flag_objc_sjlj_exceptions): New. * c-common.c (flag_objc_sjlj_exceptions): New. * c-common.h (flag_objc_sjlj_exceptions): Declare. * c-opts.c (c_common_handle_option): Set it. (c_common_post_options): Handle interation of different objective-c exception and runtime switches. * c-decl.c (c_eh_initialized_p): New. (finish_decl): Use it instead of local eh_initialized_p. * c-parse.in (nested_function, notype_nested_function): Record the result of compstmt. (compstmt_or_error): Likewise. (compstmt): Don't add_stmt the result. (stmt): Don't return anything. Rewrite objc try and sync rules. (objc_try_stmt, objc_catch_list): Remove. (objc_catch_block, objc_finally_block): Remove. (objc_catch_prefix, objc_catch_clause, objc_opt_catch_list): New. (objc_try_catch_clause, objc_finally_clause): New. (objc_try_catch_stmt): Rewrite. * c-tree.h (c_eh_initialized_p): Declare. * c-opt (fobjc-sjlj-exceptions): New. * except.c (output_function_exception_table): Don't call cgraph on non-decls. * objc/objc-act.c (UTAG_EXCDATA_VAR, UTAG_CAUGHTEXC_VAR, UTAG_RETHROWEXC_VAR, UTAG_EVALONCE_VAR, struct val_stack, catch_count_stack, exc_binding_stack, if_nesting_count, blk_nesting_count, objc_enter_block, objc_exit_block, objc_declare_variable, 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): Remove. (objc_create_temporary_var, struct objc_try_context, cur_try_context, objc_eh_runtime_type, objc_init_exceptions, objc_build_exc_ptr, next_sjlj_build_try_exit, next_sjlj_build_enter_and_setjmp, next_sjlj_build_exc_extract, next_sjlj_build_catch_list, next_sjlj_build_try_catch_finally, objc_begin_try_stmt, objc_begin_catch_clause, objc_finish_catch_clause, objc_build_finally_clause, objc_finish_try_stmt, objc_build_synchronized): New. (objc_is_object_id, objc_is_class_id): New. (objc_comptypes): Use them. (build_next_objc_exception_stuff): Break NeXT sjlj out from build_objc_exception_stuff. (synth_module_prologue): Update to match. (objc_build_throw_stmt): Use cur_try_context to decide if we're in a @catch. * objc/objc-act.h: Update prototypes. (OCTI_EXCEPTION_BLK_STACK, objc_exception_block_stack): Remove. testsuite/ * objc.dg/sync-1.m: New. * objc.dg/try-catch-1.m: Don't force next runtime. * objc.dg/try-catch-3.m, objc.dg/try-catch-4.m: Likewise. * objc.dg/try-catch-2.m: Likewise. Enable everywhere. Remove shadowed catch clause. * objc.dg/try-catch-5.m: New. From-SVN: r83332
2004-06-18 03:20:53 +02:00
objc-act.c (build_private_template): Change to return 'void'... [gcc/objc/ChangeLog] 2004-12-15 Ziemowit Laski <zlaski@apple.com> * objc-act.c (build_private_template): Change to return 'void'; do not set ivar_context, uprivate_record or objc_instance_type. (objc_comptypes, gen_type_name_0): For types 'id' and 'Class', retrieve protocol list from the pointee rather than the pointer itself; check TYPE_HAS_OBJC_INFO(...) precondition before accessing TYPE_OBJC_PROTOCOL_LIST. (objc_get_protocol_qualified_type): For types 'id' and 'Class', construct a variant of the pointee as well as the pointer, and store protocol information in the former. When creating variants of RECORD_TYPEs, clone their TYPE_LANG_SPECIFIC fields and propagate TYPE_OBJC_INTERFACE information. (objc_declare_class): If a TYPE_DECL is looked up, retrieve the underlying RECORD_TYPE to check for presence of TYPE_OBJC_INTERFACE; for newly-created RECORD_TYPEs, create a tentative TYPE_OBJC_INTERFACE holding an IDENTIFIER_NODE. (objc_finish_message_expr): Check TYPE_HAS_OBJC_INFO(...) before accessing TYPE_OBJC_PROTOCOL_LIST; Use TYPE_OBJC_INTERFACE instead of calling lookup_interface(); allow for TYPE_OBJC_INTERFACE holding an IDENTIFIER_NODE (meaning a @class forward-declaration only). (objc_is_public): Check TYPE_OBJC_INTERFACE instead of calling lookup_interface(). (continue_class): For @implementations, set ivar_context, uprivate_record and objc_instance_type, for @interfaces, call build_private_template(). (encode_pointer): Check TYPE_HAS_OBJC_INFO(...) before accessing TYPE_OBJC_INTERFACE. (objc_types_are_equivalent): Check TYPE_HAS_OBJC_INFO(...) before accessing TYPE_OBJC_PROTOCOL_LIST. * objc-act.h (OBJC_INFO_SLOT_ELTS, TYPE_OBJC_INFO, INIT_TYPE_OBJC_INFO, DUP_TYPE_OBJC_INFO, ALLOC_OBJC_TYPE_LANG_SPECIFIC, SIZEOF_OBJC_TYPE_LANG_SPECIFIC): New macros. (TYPE_OBJC_INTERFACE): Replaces TREE_STATIC_INSTANCE and now points to an actual @interface; stored in TYPE_LANG_SPECIFIC(...). (TYPE_OBJC_PROTOCOL_LIST): Replaces TYPE_PROTOCOL_LIST; stored in TYPE_LANG_SPECIFIC(...). (TREE_STATIC_INSTANCE, TYPE_PROTOCOL_LIST): Delete. (IS_ID, IS_CLASS, IS_PROTOCOL_QUALIFIED_UNTYPED, IS_SUPER, TYPED_OBJECT): Check for POINTER_TYPE rather than POINTER_TYPE_P; adjust for use of TYPE_OBJC_INTERFACE and TYPE_OBJC_PROTOCOL_LIST instead of TREE_STATIC_INSTANCE and TYPE_PROTOCOL_LIST. From-SVN: r92239
2004-12-16 02:10:38 +01:00
struct <classname> {
Makefile.in (c-parse.o): Depend on $(C_COMMON_H). [gcc/ChangeLog] 2004-09-07 Ziemowit Laski <zlaski@apple.com> * Makefile.in (c-parse.o): Depend on $(C_COMMON_H). * c-parse.in: Include c-common.h instead of objc-act.h. (ivar_decl_list, ivar_decls, ivar_decl, ivars, ivar_declarator, myparms, myparm): Remove %type declarations. (methodtype, optparms, OBJC_TYPE_QUAL, objc_quals, objc_qual, objc_typename, objc_try_catch_stmt, optellipsis): Add %type declarations. (objc_inherit_code, objc_public_flag): Remove. (typespec_nonreserved_nonattr): Call objc_get_protocol_qualified_type() instead of get_static_reference() and get_protocol_reference(). (stmt_nocomp): Call grokparm() on @catch parameter. (objcdef): Move semantic action to objc_finish_implementation(). (classdef): Move semantic action to objc_start_class_interface(), objc_continue_interface(), objc_finish_interface(), objc_start_class_implementation(), objc_continue_implementation(), objc_start_category_interface() and objc_start_category_implementation(). (protocoldef): Move semantic actions to objc_start_protocol() and objc_finish_interface(). (ivar_decl_list): Remove nonterminal. (visibility_spec): Move semantic actions to objc_set_visibility(). (ivar_decls): Remove assignment to $$. (ivar_decl): Rephrase in terms of component_decl; call objc_add_instance_variable(). (ivars, ivar_declarator): Remove nonterminals. (opt_semi): New nonterminal. (methodtype): Remove semantic actions. (methoddef): Move semantic actions to objc_set_method_type(), objc_start_method_definition() and objc_finish_method_definition(). (methodproto): Move semantic actions to objc_set_method_type() and objc_add_method_declaration(). (methoddecl): Use objc_typename instead of typename; move semantic actions to objc_build_method_signature(). (optarglist, myxdecls, mydecl, myparms, myparm): Remove nonterminals. (optparmlist): Express in terms of optparms and optellipsis. (optparms, optellipsis, objc_qual, objc_quals, objc_typename): New nonterminals. (keyworddecl): Use objc_typename instead of typename. (rid_to_yy): Mark RID_IN, RID_OUT, RID_INOUT, RID_BYCOPY, RID_BYREF and RID_ONEWAY as returning OBJC_TYPE_QUAL to yyparse(). [gcc/objc/ChangeLog] 2004-09-07 Ziemowit Laski <zlaski@apple.com> * Make-lang.in (objc/objc-parse.o): Depend on $(C_COMMON_H) instead of objc/objc-act.h. (objc/objc-act.o): Depend on $(HASHTAB_H). * objc-act.c: Include hashtab.h; in ObjC++ mode, include cp-tree.h and objcp-decl.h instead of c-tree.h. (build_module_descriptor, get_class_ivars, synth_id_with_class_suffix, error_with_ivar, gen_method_decl, gen_declaration, setup_string_decl, build_protocol_template): Adjust prototypes. (build_module_initializer_routine, start_class, continue_class, finish_class, start_method_def, objc_start_function, start_protocol, build_method_decl, objc_add_method, add_instance_variable, build_ivar_reference, is_ivar, is_private, get_super_receiver, build_selector_table_decl, objc_push_parm, objc_get_parm_info, gen_type_name, gen_type_name_0, start_var_decl, finish_var_decl, create_field_decl): New prototypes. (objc_expand_function_end, comp_method_with_proto, objc_expr_last, gen_declaration_1, gen_declarator, is_complex_decl, adorn_decl, define_decl, create_builtin_decl, gen_declspecs): Remove prototypes. (TYPE_ID): Rename to OBJECT_TYPEDEF_NAME. (CLASS_TYPEDEF_NAME): New. (TAG_EXECCLASS): Change from a global variable to a #define. (TAG_RETURN_STRUCT): Delete. (TAG_GNUINIT): New, holds '__objc_gnu_init' name. (objc_inherit_code, objc_public_flag): New, moved from c-parse.in. (string_descriptor): New struct. (string_htab): New hash table. (string_hash, string_eq): New prototypes. (generate_struct_by_value_array): Call create_field_decl() instead of create_builtin_decl(). (objc_init): Do not initialize objc_ellipsis_node or TAG_EXECCLASS; In ObjC++ mode, call cxx_init() instead of c_objc_common_init(). (objc_finish_file): In ObjC++, call instantiate_pending_templates() and cp_finish_file(). (define_decl, get_static_reference, get_protocol_reference, create_builtin_decl): Remove functions. (objc_start_class_interface, objc_start_category_interface, objc_start_protocol, objc_continue_interface, objc_finish_interface, objc_start_class_implementation, objc_start_category_implementation, objc_continue_implementation, objc_finish_implementation, objc_set_visibility, objc_set_method_type, objc_build_method_signature, objc_add_method_declaration, objc_start_method_definition, objc_add_instance_variable, objc_get_protocol_qualified_type, create_field_decl, start_var_decl, finish_var_decl): New functions. (setup_string_decl): Simplify since it is only called once. (synth_module_prologue): Call build_class_template(); predefine 'id' and 'Class' as typedefs; rename 'temp_type' to 'type'; disable debug hooks for duration of function; fix GNU runtime messenger signatures to correspond to reality; forward-declare '__objc_exec_class' for the GNU runtime; call build_selector_table_decl(); in ObjC++ mode, generate 'extern "C" { ... }' wrappers around synthesized declarations; call build_protocol_template() and build_category_template(). (string_hash, string_eq): New functions. (objc_build_string_object): Check metaclass correctness only once; store string literals in hash table. (objc_build_constructor): Do not convert initializer elements; adjust for ObjC++ impedance mismatch. (build_objc_symtab_template): Call create_field_decl() instead of create_builtin_decl(). (init_objc_symtab): Add missing conversion to initializer element. (build_metadata_decl): Call start_var_decl() instead of define_decl(). (generate_objc_symtab_decl): Do not call build_category_template(); call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(). (build_module_descriptor): Call create_field_decl() instead of grokfield(); call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(); always mark module descriptor as used; move GNU runtime-specific functionality to build_module_initializer_routine(). (build_module_initializer_routine): New function, broken off of build_module_descriptor(). (objc_static_init_needed_p, objc_generate_static_init_call): New functions. (generate_static_references, generate_strings, build_selector_translation_table, generate_descriptor_table, generate_ivars_list, generate_dispatch_table, generate_category): Call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(); build a type directly instead of via groktypename(). (build_selector_reference_decl, build_selector_table_decl, build_class_reference_decl, build_protocol_reference, generate_objc_image_info): Call start_var_decl() instead of build_decl(). (build_selector_reference): For GNU runtime, do not call build_selector_reference_decl(). (build_selector, build_typed_selector_reference): Always convert result to the selector type. (add_objc_string): Cast return value to 'char *'. (build_method_prototype_template, build_selector_template, build_method_template): Use actual selector type for fields pointing to selectors. (finish_objc): For GNU runtime, call build_module_initializer_routine() after build_module_descriptor(). (generate_protocol_list, generate_shared_structures): Call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(); build a type directly instead of via groktypename(). (synth_id_with_class_suffix): Return a string. (get_arg_type_list): For instance methods, use the instance type for 'self'; do not call groktypename_in_parm_context(). (build_objc_string_decl): Squash redeclaration errors in ObjC++. (objc_is_class_name): Use OBJC_TYPE_NAME instead of TYPE_NAME; handle RECORD_TYPEs in ObjC as well as ObjC++. (objc_is_id): New function. (objc_is_object_ptr): Return the canonical type node. (objc_get_class_ivars): Simplify using get_class_ivars(). (get_class_ivars): Remove second parameter; create a fresh copy of the ivar list for each call; do not check for existence of super class. (objc_eh_runtime_type): Mark #ifndef OBJCPLUS. (objc_init_exceptions): When using SJLJ-style exceptions, require the use of '-fobjc-exceptions' flag; do not require it for DWARF-style exceptions. (objc_build_exc_ptr, next_sjlj_build_try_catch_finally): Use objc_object_type instead of objc_id_type. (objc_begin_catch_clause): Convert the incoming PARM_DECL into a VAR_DECL before placing it in the appropriate scope; do not call define_decl(); adjust call to c_begin_compound_stmt(); use objc_object_type instead of objc_id_type. (build_next_objc_exception_stuff): Call create_field_decl() instead of create_builtin_decl(); construct type directly instead of calling groktypename(); use OBJC_VOID_AT_END to mark end of function parameters. (build_private_template): Adjust call to get_class_ivars(); build a type directly instead of via groktypename(). (build_protocol_template, build_method_prototype_list_template, build_method_prototype_template, build_category_template, build_selector_template, build_class_template, build_super_template, build_ivar_template, build_ivar_list_template, build_method_list_template, build_method_template): Call create_field_decl() instead of grokfield(). (objc_method_parm_type): Do not call groktypename(). (generate_descriptor_table): Call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(). (generate_method_descriptors, build_protocol_initializer, generate_dispatch_tables, build_category_initializer, build_shared_structure_initializer): Do not call groktypename(). (generate_protocols): Call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(); do not call groktypename(). (error_with_ivar): Remove last parameter. (check_ivars): Do not iterate ovar CLASS_RAW_IVARS lists in addition to CLASS_IVARS lists; adjust calls to error_with_ivar(). (generate_ivar_lists): Convert one of the initializer elements; do not call groktypename(). (get_arg_type_list, start_method_def, gen_method_def): Account for new representation of variable arguments and '...' in Objective-C methods; add Objective-C++ impedance matching code. (is_objc_type_qualifier): Remove function. (adjust_type_for_id_default): Simplify; there is no longer a need to wade through declspecs. (lookup_interface, start_class, continue_class, finish_class, start_method_def, start_protocol, build_method_decl, objc_add_method, add_instance_variable, build_ivar_reference, is_ivar, is_private, get_super_receiver, objc_build_finally_epilogue): Make into static functions. (receiver_is_class_object): Use new IS_CLASS() macro. (objc_build_message_expr): Tweak ObjC++ message argument handling; call objc_finish_message_expr() instead of finish_message_expr(). (finish_message_expr): Rename to objc_finish_message_expr(); use OBJC_TYPE_NAME and OBJC_SET_TYPE_NAME macros instead of TYPE_NAME. call gen_type_name() instead of gen_declaration(); call objc_is_id() instead of using IS_ID and IS_CLASS; Use objc_class_name instead of calling get_identifier("Class"); handle CONVERT_EXPRs in receiver. (build_objc_method_call, warn_with_method): Do not call groktypename(). (build_ivar_reference): Call convert() instead of clobbering in a type. (hash_init): Initialize string_htab hash table. (add_instance_variable): Simplify parameter list; do not call grokfield(); do not populate CLASS_IVARS list. (start_class): Check for the existence of super class, if one was specified. (continue_class): Use CLASS_RAW_IVARS rather than CLASS_IVARS; do not call build_class_template(); adjust call to get_class_ivars(); call build_decl(), pushdecl() and finish_decl() instead of define_decl(). (finish_class): Call build_decl(), pushdecl() and finish_decl() instead of define_decl(). (add_protocols): Use PROTOCOL_BINFO_ELTS for the tree vector size. (start_protocol): Do not call build_protocol_template(); use PROTOCOL_BINFO_ELTS for the tree vector size. (encode_type_qualifiers): Do not handle the 'const' qualifier here. (encode_pointer): Encode 'const char *' as 'r*', for backwards compatibility. (encode_array): Use HOST_WIDE_INT_PRINT_DEC instead of "%ld". (encode_type): Handle the 'const' qualifier here. (objc_parmlist): New global variable, sued by objc_push_parm and objc_get_parm_info(). (objc_push_parm, objc_get_parm_info): New functions. (objc_expr_last): Remove function. (synth_self_and_ucmd_args): For instance methods, use the instance type for 'self'; call objc_push_parm() instead of push_parm_decl(). (start_method_def): Do not call push_scope(), declare_parm_level(), pop_scope(), push_parm_decl(), store_parm_decls() or objc_expr_last(); just use objc_push_parm() and objc_get_parm_info(). (comp_method_with_proto): Remove function. (objc_types_are_equivalent): Strip away indirections before comparing underlying types. (comp_proto_with_proto): Do not call groktypename(); types are no longer in raw declspec format. (objc_start_function): New function. (really_start_method): Call comp_proto_with_proto() instead of comp_method_with_proto(); call objc_start_function() instead of hand-crafting a function declarator. (continue_method_def, objc_expand_function_end): Remove functions. (get_super_receiver): Call objc_get_current_scope() instead of get_current_scope(); reference 'super_class' field (instead of 'class'). (finish_method_def): Rename to objc_finish_method_definition() and add a function decl parameter; move method encoding call from objc_expand_function_end(). (is_complex_decl, adorn_decl, gen_declarator, gen_declspecs, gen_declaration_1): Remove functions. (tmpbuf, RAW_DECLSPEC): Remove. (gen_declaration): Remove second parameter; simplify to deal with TYPE_P nodes instead of raw declspecs. (gen_type_name, gen_type_name_0): New functions. (gen_method_decl): Remove second parameter; call gen_type_name() instead of gen_declaration_1(). (dump_interface): Adjust calls to gen_declaration() and gen_method_decl(); do not allocate a separate string buffer. (init_objc): Allocate a larger string buffer to accommodate dump_interface(); adjust call to build_module_descriptor(); add call to build_module_initializer_routine() for the GNU runtime. (generate_classref_translation_entry): Do not call start_decl(); call finish_var_decl() instead of finish_decl(); call convert() instead of build_c_cast(). * objc-act.h (CLASS_OWN_IVARS): Remove accessor. (CLASS_BINFO_ELTS): Reduce from 6 to 5, now that CLASS_OWN_IVARS is gone. (OCTI_GNU_INIT_DECL, GNU_INIT_decl): New. (OCTI_ELLIPSIS_NODE, objc_ellipsis_node): Remove. (OCTI_ID_ID, id_type, objc_id_id): Rename to OCTI_ID_NAME, objc_object_type and objc_object_name, respectively. (OCTI_CLS_REF, OCTI_CLASS_NAME, objc_class_reference, objc_class_name): New. (IS_CLASS): New macro. (IS_ID, IS_SUPER): Robustify. (OCTI_EXECCLASS_DECL, execclass_decl): New. (finish_file, start_class, continue_class, finish_class, start_method_def, continue_method_def, finish_method_def, start_protocol, finish_protocol, objc_build_throw_stmt, objc_build_try_catch_finally_stmt, objc_build_synchronized_prologue, objc_build_synchronized_epilogue, objc_build_try_prologue, objc_build_try_epilogue, objc_build_catch_stmt, objc_build_catch_epilogue, objc_build_finally_prologue, objc_build_finally_epilogue, is_ivar, is_private, is_public, add_instance_variable, objc_add_method, get_super_receiver, objc_clear_super_receiver, get_class_ivars_from_name, get_class_reference, get_static_reference, get_object_reference, build_message_expr, finish_message_expr, build_selector_expr, build_ivar_reference, build_keyword_decl, build_method_decl, build_protocol_expr, build_objc_string_object, objc_declare_alias, objc_declare_class, objc_declare_protocols, objc_comptypes, objc_check_decl, build_encode_expr): Remove prototypes. (imp_count, cat_count): Make GGC-aware. (OBJC_SET_TYPE_NAME): New macro. From-SVN: r87168
2004-09-08 02:49:44 +02:00
struct _objc_class *isa;
...
}; */
objc-act.c (build_private_template): Change to return 'void'... [gcc/objc/ChangeLog] 2004-12-15 Ziemowit Laski <zlaski@apple.com> * objc-act.c (build_private_template): Change to return 'void'; do not set ivar_context, uprivate_record or objc_instance_type. (objc_comptypes, gen_type_name_0): For types 'id' and 'Class', retrieve protocol list from the pointee rather than the pointer itself; check TYPE_HAS_OBJC_INFO(...) precondition before accessing TYPE_OBJC_PROTOCOL_LIST. (objc_get_protocol_qualified_type): For types 'id' and 'Class', construct a variant of the pointee as well as the pointer, and store protocol information in the former. When creating variants of RECORD_TYPEs, clone their TYPE_LANG_SPECIFIC fields and propagate TYPE_OBJC_INTERFACE information. (objc_declare_class): If a TYPE_DECL is looked up, retrieve the underlying RECORD_TYPE to check for presence of TYPE_OBJC_INTERFACE; for newly-created RECORD_TYPEs, create a tentative TYPE_OBJC_INTERFACE holding an IDENTIFIER_NODE. (objc_finish_message_expr): Check TYPE_HAS_OBJC_INFO(...) before accessing TYPE_OBJC_PROTOCOL_LIST; Use TYPE_OBJC_INTERFACE instead of calling lookup_interface(); allow for TYPE_OBJC_INTERFACE holding an IDENTIFIER_NODE (meaning a @class forward-declaration only). (objc_is_public): Check TYPE_OBJC_INTERFACE instead of calling lookup_interface(). (continue_class): For @implementations, set ivar_context, uprivate_record and objc_instance_type, for @interfaces, call build_private_template(). (encode_pointer): Check TYPE_HAS_OBJC_INFO(...) before accessing TYPE_OBJC_INTERFACE. (objc_types_are_equivalent): Check TYPE_HAS_OBJC_INFO(...) before accessing TYPE_OBJC_PROTOCOL_LIST. * objc-act.h (OBJC_INFO_SLOT_ELTS, TYPE_OBJC_INFO, INIT_TYPE_OBJC_INFO, DUP_TYPE_OBJC_INFO, ALLOC_OBJC_TYPE_LANG_SPECIFIC, SIZEOF_OBJC_TYPE_LANG_SPECIFIC): New macros. (TYPE_OBJC_INTERFACE): Replaces TREE_STATIC_INSTANCE and now points to an actual @interface; stored in TYPE_LANG_SPECIFIC(...). (TYPE_OBJC_PROTOCOL_LIST): Replaces TYPE_PROTOCOL_LIST; stored in TYPE_LANG_SPECIFIC(...). (TREE_STATIC_INSTANCE, TYPE_PROTOCOL_LIST): Delete. (IS_ID, IS_CLASS, IS_PROTOCOL_QUALIFIED_UNTYPED, IS_SUPER, TYPED_OBJECT): Check for POINTER_TYPE rather than POINTER_TYPE_P; adjust for use of TYPE_OBJC_INTERFACE and TYPE_OBJC_PROTOCOL_LIST instead of TREE_STATIC_INSTANCE and TYPE_PROTOCOL_LIST. From-SVN: r92239
2004-12-16 02:10:38 +01:00
static void
build_private_template (tree class)
{
objc-act.c (build_private_template): Change to return 'void'... [gcc/objc/ChangeLog] 2004-12-15 Ziemowit Laski <zlaski@apple.com> * objc-act.c (build_private_template): Change to return 'void'; do not set ivar_context, uprivate_record or objc_instance_type. (objc_comptypes, gen_type_name_0): For types 'id' and 'Class', retrieve protocol list from the pointee rather than the pointer itself; check TYPE_HAS_OBJC_INFO(...) precondition before accessing TYPE_OBJC_PROTOCOL_LIST. (objc_get_protocol_qualified_type): For types 'id' and 'Class', construct a variant of the pointee as well as the pointer, and store protocol information in the former. When creating variants of RECORD_TYPEs, clone their TYPE_LANG_SPECIFIC fields and propagate TYPE_OBJC_INTERFACE information. (objc_declare_class): If a TYPE_DECL is looked up, retrieve the underlying RECORD_TYPE to check for presence of TYPE_OBJC_INTERFACE; for newly-created RECORD_TYPEs, create a tentative TYPE_OBJC_INTERFACE holding an IDENTIFIER_NODE. (objc_finish_message_expr): Check TYPE_HAS_OBJC_INFO(...) before accessing TYPE_OBJC_PROTOCOL_LIST; Use TYPE_OBJC_INTERFACE instead of calling lookup_interface(); allow for TYPE_OBJC_INTERFACE holding an IDENTIFIER_NODE (meaning a @class forward-declaration only). (objc_is_public): Check TYPE_OBJC_INTERFACE instead of calling lookup_interface(). (continue_class): For @implementations, set ivar_context, uprivate_record and objc_instance_type, for @interfaces, call build_private_template(). (encode_pointer): Check TYPE_HAS_OBJC_INFO(...) before accessing TYPE_OBJC_INTERFACE. (objc_types_are_equivalent): Check TYPE_HAS_OBJC_INFO(...) before accessing TYPE_OBJC_PROTOCOL_LIST. * objc-act.h (OBJC_INFO_SLOT_ELTS, TYPE_OBJC_INFO, INIT_TYPE_OBJC_INFO, DUP_TYPE_OBJC_INFO, ALLOC_OBJC_TYPE_LANG_SPECIFIC, SIZEOF_OBJC_TYPE_LANG_SPECIFIC): New macros. (TYPE_OBJC_INTERFACE): Replaces TREE_STATIC_INSTANCE and now points to an actual @interface; stored in TYPE_LANG_SPECIFIC(...). (TYPE_OBJC_PROTOCOL_LIST): Replaces TYPE_PROTOCOL_LIST; stored in TYPE_LANG_SPECIFIC(...). (TREE_STATIC_INSTANCE, TYPE_PROTOCOL_LIST): Delete. (IS_ID, IS_CLASS, IS_PROTOCOL_QUALIFIED_UNTYPED, IS_SUPER, TYPED_OBJECT): Check for POINTER_TYPE rather than POINTER_TYPE_P; adjust for use of TYPE_OBJC_INTERFACE and TYPE_OBJC_PROTOCOL_LIST instead of TREE_STATIC_INSTANCE and TYPE_PROTOCOL_LIST. From-SVN: r92239
2004-12-16 02:10:38 +01:00
if (!CLASS_STATIC_TEMPLATE (class))
{
tree record = objc_build_struct (class,
objc-act.c (objc_build_struct): New function. * objc-act.c (objc_build_struct): New function. (objc_derived_from_p): Likewise. (objc_build_component_ref): Likewise. (objc_copy_binfo): Likewise. (objc_xref_basetypes): Likewise. (objc_lookup_protocol): Likewise. (objc_compare_protocols): Likewise. (objc_volatilize_decl): Likewise. (encode_aggregate_fields): Likewise. (volatilized_hash): Likewise. (volatilized_eq): Likewise. (objc_compare_types): Likewise. (objc_type_quals_match): Likewise. (DERIVED_FROM_P): New ObjC macro, corresponding to C++ macro of same name. (get_class_ivars): Add second parameter indicating if entire hierarchy is desired. (struct volatilized_type): New type. (volatilized_htab): New hash table. (objc_types_compatible_p, objc_comptypes): Remove functions. (synth_module_prologue): Do not initialize 'unused_list'. (objc_get_class_reference): Fix ObjC++ impedance mismatches. (objc_declare_alias): Implement as a typedef. (objc_substitute_decl, objc_gimplify_expr): Reformat. (objc_get_class_ivars): Adjust call to get_class_ivars(). (next_sjlj_build_enter_and_setjmp, synth_forward_declarations, build_ivar_reference, get_super_receiver): Call objc_build_component_ref() instead of build_component_ref(). (objc_begin_catch_clause): Use DERIVED_FROM_P() instead of objc_comptypes(). (build_private_template): Call objc_build_struct() instead of start_struct() and finish_struct(). (hash_init): Initialize volatilized_htab. (objc_is_public): Adjust calls to objc_get_ivars(); adjust ObjC++ impedance mismatches. (encode_aggregate_within): Streamline by calling encode_aggregate_fields(). * objc-act.h (objc_types_compatible_p): Remove prototype. (OCTI_UNUSED_LIST, unused_list): Remove slot. * objc-lang.c (LANG_HOOKS_TYPES_COMPATIBLE_P): Remove. From-SVN: r100123
2005-05-25 00:21:01 +02:00
get_class_ivars (class, false),
CLASS_SUPER_NAME (class));
Yet more Objective-C++... * objc-act.c (objc_finish_try_stmt): Add return value. (objc_build_synchronized): Likewise. * objc-act.c (objc_is_gcable_type): Add. (objc_substitute_decl): Add. (objc_build_ivar_assignment): Add. (objc_build_global_assignment): Add. (objc_build_strong_cast_assignment): Add. (objc_is_ivar_reference_p): Add. (objc_is_global_reference_p): Add. (objc_generate_write_barrier): Add. (objc_rewrite_function_call): Add. (objc_gimplify_expr): Add Objective-C++ support. * objc-act.h (ALLOC_OBJC_TYPE_LANG_SPECIFIC): Likewise. (SIZEOF_OBJC_TYPE_LANG_SPECIFIC): Add. (INIT_TYPE_OBJC_INFO): Add Objective-C++ support. (DUP_TYPE_OBJC_INFO): Likewise. (struct imp_entry): Add field has_cxx_cdtors. (struct imp_entry *imp_list): Add OCTI_UMSG_FAST_DECL, OCTI_METH_LIST_TEMPL, OCTI_METH_PROTO_LIST_TEMPL, OCTI_IVAR_LIST_TEMPL, OCTI_ASSIGN_IVAR_DECL, OCTI_ASSIGN_IVAR_FAST_DECL, OCTI_ASSIGN_GLOBAL_DECL, OCTI_ASSIGN_STRONGCAST_DECL. (umsg_fast_decl): Add. (objc_assign_ivar_decl): Add. (objc_assign_ivar_fast_decl): Add. (objc_assign_global_decl): Add. (objc_assign_strong_cast_decl): Add. (objc_method_list_ptr): Add. (objc_method_proto_list_ptr): Add. (objc_ivar_list_ptr): Add. * objc-act.c (should_call_super_dealloc): Add. (OBJC_VERSION): Bump to 6. (objc_is_gcable_type): Add. (objc_substitute_decl): Add. (objc_build_ivar_assignment): Add. (objc_build_global_assignment): Add. (objc_build_strong_cast_assignment): Add. (objc_is_gcable_p): Add. (objc_is_ivar_reference_p): Add. (objc_is_global_reference_p): Add. (generate_shared_structures): Add flags parameter. (objc_generate_cxx_ctor_or_dtor): Add. (objc_generate_cxx_cdtors): Add. (add_class): Add name parameter. (objc_types_share_size_and_alignment): Add. (comp_proto_with_proto): Add strict parameter. (CLS_HAS_CXX_STRUCTORS): Add. (TAG_ASSIGNIVAR): Add. (TAG_ASSIGNGLOBAL): Add. (TAG_ASSIGNSTRONGCAST): Add. (TAG_MSGSEND_FAST): Add. (TAG_ASSIGNIVAR_FAST): Add. (TAG_CXX_CONSTRUCT): Add. (TAG_CXX_DESTRUCT): Add. (OBJC_LOOKUP_CLASS): Add. (OBJC_LOOKUP_NO_SUPER): Add. (objc_finish_file): Add pch support. (objc_finish_implementation): Add Objective-C++ support. (synth_module_prologue): Likewise. (synth_module_prologue): Add fast dispatching. (objc_get_class_reference): Add Objective-C++ support. (objc_generate_write_barrier): Likewise. (next_sjlj_build_enter_and_setjmp): Likewise. (objc_begin_try_stmt): Likewise. (build_next_objc_exception_stuff): Add fast ivar support. (build_private_template): Mark the record as used so debug information is generated. (build_protocol_template): Add Objective-C++ support. (objc_method_parm_type) Likewise. (objc_generate_cxx_ctor_or_dtor): Likewise. (objc_generate_cxx_cdtors): Likewise. (build_protocol_initializer): Likewise. (build_category_template): Likewise. (build_class_template): Likewise. (build_method_list_template): Likewise. (build_category_initializer): Likewise. (build_shared_structure_initializer): Likewise. (objc_finish_message_expr): Likewise. (build_objc_method_call): Add fast dispatch support. (lookup_method_static): Add support to end search at superclasses. (add_method_to_hash_list): Add strict parameter to comp_proto_with_proto. (objc_add_method): Likewise. (objc_add_method): Also set the interface_value. (add_instance_variable): Add Objective-C++ support. (objc_is_public): Likewise. (start_class): Likewise. (continue_class): Likewise. (encode_aggregate_within): Likewise. (start_method_def): Likewise. (objc_start_function): Clear current_function_returns_value and current_function_returns_null. (really_start_method): Add Objective-C++ support. (objc_finish_method_definition): Add warning for missing [super dealloc]. (finish_objc): Add Objective-C++ support. (generate_objc_image_info): Likewise. (objc_lookup_ivar): Likewise. * objc-act.h (TYPE_HAS_OBJC_INFO): Likewise. (INIT_TYPE_OBJC_INFO): Likewise. (DUP_TYPE_OBJC_INFO): Likewise. From-SVN: r99857
2005-05-17 22:07:08 +02:00
/* Set the TREE_USED bit for this struct, so that stab generator
can emit stabs for this struct type. */
if (flag_debug_only_used_symbols && TYPE_STUB_DECL (record))
TREE_USED (TYPE_STUB_DECL (record)) = 1;
}
}
1996-07-04 00:07:53 +02:00
/* Begin code generation for protocols... */
Makefile.in (c-parse.o): Depend on $(C_COMMON_H). [gcc/ChangeLog] 2004-09-07 Ziemowit Laski <zlaski@apple.com> * Makefile.in (c-parse.o): Depend on $(C_COMMON_H). * c-parse.in: Include c-common.h instead of objc-act.h. (ivar_decl_list, ivar_decls, ivar_decl, ivars, ivar_declarator, myparms, myparm): Remove %type declarations. (methodtype, optparms, OBJC_TYPE_QUAL, objc_quals, objc_qual, objc_typename, objc_try_catch_stmt, optellipsis): Add %type declarations. (objc_inherit_code, objc_public_flag): Remove. (typespec_nonreserved_nonattr): Call objc_get_protocol_qualified_type() instead of get_static_reference() and get_protocol_reference(). (stmt_nocomp): Call grokparm() on @catch parameter. (objcdef): Move semantic action to objc_finish_implementation(). (classdef): Move semantic action to objc_start_class_interface(), objc_continue_interface(), objc_finish_interface(), objc_start_class_implementation(), objc_continue_implementation(), objc_start_category_interface() and objc_start_category_implementation(). (protocoldef): Move semantic actions to objc_start_protocol() and objc_finish_interface(). (ivar_decl_list): Remove nonterminal. (visibility_spec): Move semantic actions to objc_set_visibility(). (ivar_decls): Remove assignment to $$. (ivar_decl): Rephrase in terms of component_decl; call objc_add_instance_variable(). (ivars, ivar_declarator): Remove nonterminals. (opt_semi): New nonterminal. (methodtype): Remove semantic actions. (methoddef): Move semantic actions to objc_set_method_type(), objc_start_method_definition() and objc_finish_method_definition(). (methodproto): Move semantic actions to objc_set_method_type() and objc_add_method_declaration(). (methoddecl): Use objc_typename instead of typename; move semantic actions to objc_build_method_signature(). (optarglist, myxdecls, mydecl, myparms, myparm): Remove nonterminals. (optparmlist): Express in terms of optparms and optellipsis. (optparms, optellipsis, objc_qual, objc_quals, objc_typename): New nonterminals. (keyworddecl): Use objc_typename instead of typename. (rid_to_yy): Mark RID_IN, RID_OUT, RID_INOUT, RID_BYCOPY, RID_BYREF and RID_ONEWAY as returning OBJC_TYPE_QUAL to yyparse(). [gcc/objc/ChangeLog] 2004-09-07 Ziemowit Laski <zlaski@apple.com> * Make-lang.in (objc/objc-parse.o): Depend on $(C_COMMON_H) instead of objc/objc-act.h. (objc/objc-act.o): Depend on $(HASHTAB_H). * objc-act.c: Include hashtab.h; in ObjC++ mode, include cp-tree.h and objcp-decl.h instead of c-tree.h. (build_module_descriptor, get_class_ivars, synth_id_with_class_suffix, error_with_ivar, gen_method_decl, gen_declaration, setup_string_decl, build_protocol_template): Adjust prototypes. (build_module_initializer_routine, start_class, continue_class, finish_class, start_method_def, objc_start_function, start_protocol, build_method_decl, objc_add_method, add_instance_variable, build_ivar_reference, is_ivar, is_private, get_super_receiver, build_selector_table_decl, objc_push_parm, objc_get_parm_info, gen_type_name, gen_type_name_0, start_var_decl, finish_var_decl, create_field_decl): New prototypes. (objc_expand_function_end, comp_method_with_proto, objc_expr_last, gen_declaration_1, gen_declarator, is_complex_decl, adorn_decl, define_decl, create_builtin_decl, gen_declspecs): Remove prototypes. (TYPE_ID): Rename to OBJECT_TYPEDEF_NAME. (CLASS_TYPEDEF_NAME): New. (TAG_EXECCLASS): Change from a global variable to a #define. (TAG_RETURN_STRUCT): Delete. (TAG_GNUINIT): New, holds '__objc_gnu_init' name. (objc_inherit_code, objc_public_flag): New, moved from c-parse.in. (string_descriptor): New struct. (string_htab): New hash table. (string_hash, string_eq): New prototypes. (generate_struct_by_value_array): Call create_field_decl() instead of create_builtin_decl(). (objc_init): Do not initialize objc_ellipsis_node or TAG_EXECCLASS; In ObjC++ mode, call cxx_init() instead of c_objc_common_init(). (objc_finish_file): In ObjC++, call instantiate_pending_templates() and cp_finish_file(). (define_decl, get_static_reference, get_protocol_reference, create_builtin_decl): Remove functions. (objc_start_class_interface, objc_start_category_interface, objc_start_protocol, objc_continue_interface, objc_finish_interface, objc_start_class_implementation, objc_start_category_implementation, objc_continue_implementation, objc_finish_implementation, objc_set_visibility, objc_set_method_type, objc_build_method_signature, objc_add_method_declaration, objc_start_method_definition, objc_add_instance_variable, objc_get_protocol_qualified_type, create_field_decl, start_var_decl, finish_var_decl): New functions. (setup_string_decl): Simplify since it is only called once. (synth_module_prologue): Call build_class_template(); predefine 'id' and 'Class' as typedefs; rename 'temp_type' to 'type'; disable debug hooks for duration of function; fix GNU runtime messenger signatures to correspond to reality; forward-declare '__objc_exec_class' for the GNU runtime; call build_selector_table_decl(); in ObjC++ mode, generate 'extern "C" { ... }' wrappers around synthesized declarations; call build_protocol_template() and build_category_template(). (string_hash, string_eq): New functions. (objc_build_string_object): Check metaclass correctness only once; store string literals in hash table. (objc_build_constructor): Do not convert initializer elements; adjust for ObjC++ impedance mismatch. (build_objc_symtab_template): Call create_field_decl() instead of create_builtin_decl(). (init_objc_symtab): Add missing conversion to initializer element. (build_metadata_decl): Call start_var_decl() instead of define_decl(). (generate_objc_symtab_decl): Do not call build_category_template(); call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(). (build_module_descriptor): Call create_field_decl() instead of grokfield(); call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(); always mark module descriptor as used; move GNU runtime-specific functionality to build_module_initializer_routine(). (build_module_initializer_routine): New function, broken off of build_module_descriptor(). (objc_static_init_needed_p, objc_generate_static_init_call): New functions. (generate_static_references, generate_strings, build_selector_translation_table, generate_descriptor_table, generate_ivars_list, generate_dispatch_table, generate_category): Call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(); build a type directly instead of via groktypename(). (build_selector_reference_decl, build_selector_table_decl, build_class_reference_decl, build_protocol_reference, generate_objc_image_info): Call start_var_decl() instead of build_decl(). (build_selector_reference): For GNU runtime, do not call build_selector_reference_decl(). (build_selector, build_typed_selector_reference): Always convert result to the selector type. (add_objc_string): Cast return value to 'char *'. (build_method_prototype_template, build_selector_template, build_method_template): Use actual selector type for fields pointing to selectors. (finish_objc): For GNU runtime, call build_module_initializer_routine() after build_module_descriptor(). (generate_protocol_list, generate_shared_structures): Call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(); build a type directly instead of via groktypename(). (synth_id_with_class_suffix): Return a string. (get_arg_type_list): For instance methods, use the instance type for 'self'; do not call groktypename_in_parm_context(). (build_objc_string_decl): Squash redeclaration errors in ObjC++. (objc_is_class_name): Use OBJC_TYPE_NAME instead of TYPE_NAME; handle RECORD_TYPEs in ObjC as well as ObjC++. (objc_is_id): New function. (objc_is_object_ptr): Return the canonical type node. (objc_get_class_ivars): Simplify using get_class_ivars(). (get_class_ivars): Remove second parameter; create a fresh copy of the ivar list for each call; do not check for existence of super class. (objc_eh_runtime_type): Mark #ifndef OBJCPLUS. (objc_init_exceptions): When using SJLJ-style exceptions, require the use of '-fobjc-exceptions' flag; do not require it for DWARF-style exceptions. (objc_build_exc_ptr, next_sjlj_build_try_catch_finally): Use objc_object_type instead of objc_id_type. (objc_begin_catch_clause): Convert the incoming PARM_DECL into a VAR_DECL before placing it in the appropriate scope; do not call define_decl(); adjust call to c_begin_compound_stmt(); use objc_object_type instead of objc_id_type. (build_next_objc_exception_stuff): Call create_field_decl() instead of create_builtin_decl(); construct type directly instead of calling groktypename(); use OBJC_VOID_AT_END to mark end of function parameters. (build_private_template): Adjust call to get_class_ivars(); build a type directly instead of via groktypename(). (build_protocol_template, build_method_prototype_list_template, build_method_prototype_template, build_category_template, build_selector_template, build_class_template, build_super_template, build_ivar_template, build_ivar_list_template, build_method_list_template, build_method_template): Call create_field_decl() instead of grokfield(). (objc_method_parm_type): Do not call groktypename(). (generate_descriptor_table): Call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(). (generate_method_descriptors, build_protocol_initializer, generate_dispatch_tables, build_category_initializer, build_shared_structure_initializer): Do not call groktypename(). (generate_protocols): Call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(); do not call groktypename(). (error_with_ivar): Remove last parameter. (check_ivars): Do not iterate ovar CLASS_RAW_IVARS lists in addition to CLASS_IVARS lists; adjust calls to error_with_ivar(). (generate_ivar_lists): Convert one of the initializer elements; do not call groktypename(). (get_arg_type_list, start_method_def, gen_method_def): Account for new representation of variable arguments and '...' in Objective-C methods; add Objective-C++ impedance matching code. (is_objc_type_qualifier): Remove function. (adjust_type_for_id_default): Simplify; there is no longer a need to wade through declspecs. (lookup_interface, start_class, continue_class, finish_class, start_method_def, start_protocol, build_method_decl, objc_add_method, add_instance_variable, build_ivar_reference, is_ivar, is_private, get_super_receiver, objc_build_finally_epilogue): Make into static functions. (receiver_is_class_object): Use new IS_CLASS() macro. (objc_build_message_expr): Tweak ObjC++ message argument handling; call objc_finish_message_expr() instead of finish_message_expr(). (finish_message_expr): Rename to objc_finish_message_expr(); use OBJC_TYPE_NAME and OBJC_SET_TYPE_NAME macros instead of TYPE_NAME. call gen_type_name() instead of gen_declaration(); call objc_is_id() instead of using IS_ID and IS_CLASS; Use objc_class_name instead of calling get_identifier("Class"); handle CONVERT_EXPRs in receiver. (build_objc_method_call, warn_with_method): Do not call groktypename(). (build_ivar_reference): Call convert() instead of clobbering in a type. (hash_init): Initialize string_htab hash table. (add_instance_variable): Simplify parameter list; do not call grokfield(); do not populate CLASS_IVARS list. (start_class): Check for the existence of super class, if one was specified. (continue_class): Use CLASS_RAW_IVARS rather than CLASS_IVARS; do not call build_class_template(); adjust call to get_class_ivars(); call build_decl(), pushdecl() and finish_decl() instead of define_decl(). (finish_class): Call build_decl(), pushdecl() and finish_decl() instead of define_decl(). (add_protocols): Use PROTOCOL_BINFO_ELTS for the tree vector size. (start_protocol): Do not call build_protocol_template(); use PROTOCOL_BINFO_ELTS for the tree vector size. (encode_type_qualifiers): Do not handle the 'const' qualifier here. (encode_pointer): Encode 'const char *' as 'r*', for backwards compatibility. (encode_array): Use HOST_WIDE_INT_PRINT_DEC instead of "%ld". (encode_type): Handle the 'const' qualifier here. (objc_parmlist): New global variable, sued by objc_push_parm and objc_get_parm_info(). (objc_push_parm, objc_get_parm_info): New functions. (objc_expr_last): Remove function. (synth_self_and_ucmd_args): For instance methods, use the instance type for 'self'; call objc_push_parm() instead of push_parm_decl(). (start_method_def): Do not call push_scope(), declare_parm_level(), pop_scope(), push_parm_decl(), store_parm_decls() or objc_expr_last(); just use objc_push_parm() and objc_get_parm_info(). (comp_method_with_proto): Remove function. (objc_types_are_equivalent): Strip away indirections before comparing underlying types. (comp_proto_with_proto): Do not call groktypename(); types are no longer in raw declspec format. (objc_start_function): New function. (really_start_method): Call comp_proto_with_proto() instead of comp_method_with_proto(); call objc_start_function() instead of hand-crafting a function declarator. (continue_method_def, objc_expand_function_end): Remove functions. (get_super_receiver): Call objc_get_current_scope() instead of get_current_scope(); reference 'super_class' field (instead of 'class'). (finish_method_def): Rename to objc_finish_method_definition() and add a function decl parameter; move method encoding call from objc_expand_function_end(). (is_complex_decl, adorn_decl, gen_declarator, gen_declspecs, gen_declaration_1): Remove functions. (tmpbuf, RAW_DECLSPEC): Remove. (gen_declaration): Remove second parameter; simplify to deal with TYPE_P nodes instead of raw declspecs. (gen_type_name, gen_type_name_0): New functions. (gen_method_decl): Remove second parameter; call gen_type_name() instead of gen_declaration_1(). (dump_interface): Adjust calls to gen_declaration() and gen_method_decl(); do not allocate a separate string buffer. (init_objc): Allocate a larger string buffer to accommodate dump_interface(); adjust call to build_module_descriptor(); add call to build_module_initializer_routine() for the GNU runtime. (generate_classref_translation_entry): Do not call start_decl(); call finish_var_decl() instead of finish_decl(); call convert() instead of build_c_cast(). * objc-act.h (CLASS_OWN_IVARS): Remove accessor. (CLASS_BINFO_ELTS): Reduce from 6 to 5, now that CLASS_OWN_IVARS is gone. (OCTI_GNU_INIT_DECL, GNU_INIT_decl): New. (OCTI_ELLIPSIS_NODE, objc_ellipsis_node): Remove. (OCTI_ID_ID, id_type, objc_id_id): Rename to OCTI_ID_NAME, objc_object_type and objc_object_name, respectively. (OCTI_CLS_REF, OCTI_CLASS_NAME, objc_class_reference, objc_class_name): New. (IS_CLASS): New macro. (IS_ID, IS_SUPER): Robustify. (OCTI_EXECCLASS_DECL, execclass_decl): New. (finish_file, start_class, continue_class, finish_class, start_method_def, continue_method_def, finish_method_def, start_protocol, finish_protocol, objc_build_throw_stmt, objc_build_try_catch_finally_stmt, objc_build_synchronized_prologue, objc_build_synchronized_epilogue, objc_build_try_prologue, objc_build_try_epilogue, objc_build_catch_stmt, objc_build_catch_epilogue, objc_build_finally_prologue, objc_build_finally_epilogue, is_ivar, is_private, is_public, add_instance_variable, objc_add_method, get_super_receiver, objc_clear_super_receiver, get_class_ivars_from_name, get_class_reference, get_static_reference, get_object_reference, build_message_expr, finish_message_expr, build_selector_expr, build_ivar_reference, build_keyword_decl, build_method_decl, build_protocol_expr, build_objc_string_object, objc_declare_alias, objc_declare_class, objc_declare_protocols, objc_comptypes, objc_check_decl, build_encode_expr): Remove prototypes. (imp_count, cat_count): Make GGC-aware. (OBJC_SET_TYPE_NAME): New macro. From-SVN: r87168
2004-09-08 02:49:44 +02:00
/* struct _objc_protocol {
struct _objc_class *isa;
char *protocol_name;
Makefile.in (c-parse.o): Depend on $(C_COMMON_H). [gcc/ChangeLog] 2004-09-07 Ziemowit Laski <zlaski@apple.com> * Makefile.in (c-parse.o): Depend on $(C_COMMON_H). * c-parse.in: Include c-common.h instead of objc-act.h. (ivar_decl_list, ivar_decls, ivar_decl, ivars, ivar_declarator, myparms, myparm): Remove %type declarations. (methodtype, optparms, OBJC_TYPE_QUAL, objc_quals, objc_qual, objc_typename, objc_try_catch_stmt, optellipsis): Add %type declarations. (objc_inherit_code, objc_public_flag): Remove. (typespec_nonreserved_nonattr): Call objc_get_protocol_qualified_type() instead of get_static_reference() and get_protocol_reference(). (stmt_nocomp): Call grokparm() on @catch parameter. (objcdef): Move semantic action to objc_finish_implementation(). (classdef): Move semantic action to objc_start_class_interface(), objc_continue_interface(), objc_finish_interface(), objc_start_class_implementation(), objc_continue_implementation(), objc_start_category_interface() and objc_start_category_implementation(). (protocoldef): Move semantic actions to objc_start_protocol() and objc_finish_interface(). (ivar_decl_list): Remove nonterminal. (visibility_spec): Move semantic actions to objc_set_visibility(). (ivar_decls): Remove assignment to $$. (ivar_decl): Rephrase in terms of component_decl; call objc_add_instance_variable(). (ivars, ivar_declarator): Remove nonterminals. (opt_semi): New nonterminal. (methodtype): Remove semantic actions. (methoddef): Move semantic actions to objc_set_method_type(), objc_start_method_definition() and objc_finish_method_definition(). (methodproto): Move semantic actions to objc_set_method_type() and objc_add_method_declaration(). (methoddecl): Use objc_typename instead of typename; move semantic actions to objc_build_method_signature(). (optarglist, myxdecls, mydecl, myparms, myparm): Remove nonterminals. (optparmlist): Express in terms of optparms and optellipsis. (optparms, optellipsis, objc_qual, objc_quals, objc_typename): New nonterminals. (keyworddecl): Use objc_typename instead of typename. (rid_to_yy): Mark RID_IN, RID_OUT, RID_INOUT, RID_BYCOPY, RID_BYREF and RID_ONEWAY as returning OBJC_TYPE_QUAL to yyparse(). [gcc/objc/ChangeLog] 2004-09-07 Ziemowit Laski <zlaski@apple.com> * Make-lang.in (objc/objc-parse.o): Depend on $(C_COMMON_H) instead of objc/objc-act.h. (objc/objc-act.o): Depend on $(HASHTAB_H). * objc-act.c: Include hashtab.h; in ObjC++ mode, include cp-tree.h and objcp-decl.h instead of c-tree.h. (build_module_descriptor, get_class_ivars, synth_id_with_class_suffix, error_with_ivar, gen_method_decl, gen_declaration, setup_string_decl, build_protocol_template): Adjust prototypes. (build_module_initializer_routine, start_class, continue_class, finish_class, start_method_def, objc_start_function, start_protocol, build_method_decl, objc_add_method, add_instance_variable, build_ivar_reference, is_ivar, is_private, get_super_receiver, build_selector_table_decl, objc_push_parm, objc_get_parm_info, gen_type_name, gen_type_name_0, start_var_decl, finish_var_decl, create_field_decl): New prototypes. (objc_expand_function_end, comp_method_with_proto, objc_expr_last, gen_declaration_1, gen_declarator, is_complex_decl, adorn_decl, define_decl, create_builtin_decl, gen_declspecs): Remove prototypes. (TYPE_ID): Rename to OBJECT_TYPEDEF_NAME. (CLASS_TYPEDEF_NAME): New. (TAG_EXECCLASS): Change from a global variable to a #define. (TAG_RETURN_STRUCT): Delete. (TAG_GNUINIT): New, holds '__objc_gnu_init' name. (objc_inherit_code, objc_public_flag): New, moved from c-parse.in. (string_descriptor): New struct. (string_htab): New hash table. (string_hash, string_eq): New prototypes. (generate_struct_by_value_array): Call create_field_decl() instead of create_builtin_decl(). (objc_init): Do not initialize objc_ellipsis_node or TAG_EXECCLASS; In ObjC++ mode, call cxx_init() instead of c_objc_common_init(). (objc_finish_file): In ObjC++, call instantiate_pending_templates() and cp_finish_file(). (define_decl, get_static_reference, get_protocol_reference, create_builtin_decl): Remove functions. (objc_start_class_interface, objc_start_category_interface, objc_start_protocol, objc_continue_interface, objc_finish_interface, objc_start_class_implementation, objc_start_category_implementation, objc_continue_implementation, objc_finish_implementation, objc_set_visibility, objc_set_method_type, objc_build_method_signature, objc_add_method_declaration, objc_start_method_definition, objc_add_instance_variable, objc_get_protocol_qualified_type, create_field_decl, start_var_decl, finish_var_decl): New functions. (setup_string_decl): Simplify since it is only called once. (synth_module_prologue): Call build_class_template(); predefine 'id' and 'Class' as typedefs; rename 'temp_type' to 'type'; disable debug hooks for duration of function; fix GNU runtime messenger signatures to correspond to reality; forward-declare '__objc_exec_class' for the GNU runtime; call build_selector_table_decl(); in ObjC++ mode, generate 'extern "C" { ... }' wrappers around synthesized declarations; call build_protocol_template() and build_category_template(). (string_hash, string_eq): New functions. (objc_build_string_object): Check metaclass correctness only once; store string literals in hash table. (objc_build_constructor): Do not convert initializer elements; adjust for ObjC++ impedance mismatch. (build_objc_symtab_template): Call create_field_decl() instead of create_builtin_decl(). (init_objc_symtab): Add missing conversion to initializer element. (build_metadata_decl): Call start_var_decl() instead of define_decl(). (generate_objc_symtab_decl): Do not call build_category_template(); call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(). (build_module_descriptor): Call create_field_decl() instead of grokfield(); call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(); always mark module descriptor as used; move GNU runtime-specific functionality to build_module_initializer_routine(). (build_module_initializer_routine): New function, broken off of build_module_descriptor(). (objc_static_init_needed_p, objc_generate_static_init_call): New functions. (generate_static_references, generate_strings, build_selector_translation_table, generate_descriptor_table, generate_ivars_list, generate_dispatch_table, generate_category): Call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(); build a type directly instead of via groktypename(). (build_selector_reference_decl, build_selector_table_decl, build_class_reference_decl, build_protocol_reference, generate_objc_image_info): Call start_var_decl() instead of build_decl(). (build_selector_reference): For GNU runtime, do not call build_selector_reference_decl(). (build_selector, build_typed_selector_reference): Always convert result to the selector type. (add_objc_string): Cast return value to 'char *'. (build_method_prototype_template, build_selector_template, build_method_template): Use actual selector type for fields pointing to selectors. (finish_objc): For GNU runtime, call build_module_initializer_routine() after build_module_descriptor(). (generate_protocol_list, generate_shared_structures): Call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(); build a type directly instead of via groktypename(). (synth_id_with_class_suffix): Return a string. (get_arg_type_list): For instance methods, use the instance type for 'self'; do not call groktypename_in_parm_context(). (build_objc_string_decl): Squash redeclaration errors in ObjC++. (objc_is_class_name): Use OBJC_TYPE_NAME instead of TYPE_NAME; handle RECORD_TYPEs in ObjC as well as ObjC++. (objc_is_id): New function. (objc_is_object_ptr): Return the canonical type node. (objc_get_class_ivars): Simplify using get_class_ivars(). (get_class_ivars): Remove second parameter; create a fresh copy of the ivar list for each call; do not check for existence of super class. (objc_eh_runtime_type): Mark #ifndef OBJCPLUS. (objc_init_exceptions): When using SJLJ-style exceptions, require the use of '-fobjc-exceptions' flag; do not require it for DWARF-style exceptions. (objc_build_exc_ptr, next_sjlj_build_try_catch_finally): Use objc_object_type instead of objc_id_type. (objc_begin_catch_clause): Convert the incoming PARM_DECL into a VAR_DECL before placing it in the appropriate scope; do not call define_decl(); adjust call to c_begin_compound_stmt(); use objc_object_type instead of objc_id_type. (build_next_objc_exception_stuff): Call create_field_decl() instead of create_builtin_decl(); construct type directly instead of calling groktypename(); use OBJC_VOID_AT_END to mark end of function parameters. (build_private_template): Adjust call to get_class_ivars(); build a type directly instead of via groktypename(). (build_protocol_template, build_method_prototype_list_template, build_method_prototype_template, build_category_template, build_selector_template, build_class_template, build_super_template, build_ivar_template, build_ivar_list_template, build_method_list_template, build_method_template): Call create_field_decl() instead of grokfield(). (objc_method_parm_type): Do not call groktypename(). (generate_descriptor_table): Call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(). (generate_method_descriptors, build_protocol_initializer, generate_dispatch_tables, build_category_initializer, build_shared_structure_initializer): Do not call groktypename(). (generate_protocols): Call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(); do not call groktypename(). (error_with_ivar): Remove last parameter. (check_ivars): Do not iterate ovar CLASS_RAW_IVARS lists in addition to CLASS_IVARS lists; adjust calls to error_with_ivar(). (generate_ivar_lists): Convert one of the initializer elements; do not call groktypename(). (get_arg_type_list, start_method_def, gen_method_def): Account for new representation of variable arguments and '...' in Objective-C methods; add Objective-C++ impedance matching code. (is_objc_type_qualifier): Remove function. (adjust_type_for_id_default): Simplify; there is no longer a need to wade through declspecs. (lookup_interface, start_class, continue_class, finish_class, start_method_def, start_protocol, build_method_decl, objc_add_method, add_instance_variable, build_ivar_reference, is_ivar, is_private, get_super_receiver, objc_build_finally_epilogue): Make into static functions. (receiver_is_class_object): Use new IS_CLASS() macro. (objc_build_message_expr): Tweak ObjC++ message argument handling; call objc_finish_message_expr() instead of finish_message_expr(). (finish_message_expr): Rename to objc_finish_message_expr(); use OBJC_TYPE_NAME and OBJC_SET_TYPE_NAME macros instead of TYPE_NAME. call gen_type_name() instead of gen_declaration(); call objc_is_id() instead of using IS_ID and IS_CLASS; Use objc_class_name instead of calling get_identifier("Class"); handle CONVERT_EXPRs in receiver. (build_objc_method_call, warn_with_method): Do not call groktypename(). (build_ivar_reference): Call convert() instead of clobbering in a type. (hash_init): Initialize string_htab hash table. (add_instance_variable): Simplify parameter list; do not call grokfield(); do not populate CLASS_IVARS list. (start_class): Check for the existence of super class, if one was specified. (continue_class): Use CLASS_RAW_IVARS rather than CLASS_IVARS; do not call build_class_template(); adjust call to get_class_ivars(); call build_decl(), pushdecl() and finish_decl() instead of define_decl(). (finish_class): Call build_decl(), pushdecl() and finish_decl() instead of define_decl(). (add_protocols): Use PROTOCOL_BINFO_ELTS for the tree vector size. (start_protocol): Do not call build_protocol_template(); use PROTOCOL_BINFO_ELTS for the tree vector size. (encode_type_qualifiers): Do not handle the 'const' qualifier here. (encode_pointer): Encode 'const char *' as 'r*', for backwards compatibility. (encode_array): Use HOST_WIDE_INT_PRINT_DEC instead of "%ld". (encode_type): Handle the 'const' qualifier here. (objc_parmlist): New global variable, sued by objc_push_parm and objc_get_parm_info(). (objc_push_parm, objc_get_parm_info): New functions. (objc_expr_last): Remove function. (synth_self_and_ucmd_args): For instance methods, use the instance type for 'self'; call objc_push_parm() instead of push_parm_decl(). (start_method_def): Do not call push_scope(), declare_parm_level(), pop_scope(), push_parm_decl(), store_parm_decls() or objc_expr_last(); just use objc_push_parm() and objc_get_parm_info(). (comp_method_with_proto): Remove function. (objc_types_are_equivalent): Strip away indirections before comparing underlying types. (comp_proto_with_proto): Do not call groktypename(); types are no longer in raw declspec format. (objc_start_function): New function. (really_start_method): Call comp_proto_with_proto() instead of comp_method_with_proto(); call objc_start_function() instead of hand-crafting a function declarator. (continue_method_def, objc_expand_function_end): Remove functions. (get_super_receiver): Call objc_get_current_scope() instead of get_current_scope(); reference 'super_class' field (instead of 'class'). (finish_method_def): Rename to objc_finish_method_definition() and add a function decl parameter; move method encoding call from objc_expand_function_end(). (is_complex_decl, adorn_decl, gen_declarator, gen_declspecs, gen_declaration_1): Remove functions. (tmpbuf, RAW_DECLSPEC): Remove. (gen_declaration): Remove second parameter; simplify to deal with TYPE_P nodes instead of raw declspecs. (gen_type_name, gen_type_name_0): New functions. (gen_method_decl): Remove second parameter; call gen_type_name() instead of gen_declaration_1(). (dump_interface): Adjust calls to gen_declaration() and gen_method_decl(); do not allocate a separate string buffer. (init_objc): Allocate a larger string buffer to accommodate dump_interface(); adjust call to build_module_descriptor(); add call to build_module_initializer_routine() for the GNU runtime. (generate_classref_translation_entry): Do not call start_decl(); call finish_var_decl() instead of finish_decl(); call convert() instead of build_c_cast(). * objc-act.h (CLASS_OWN_IVARS): Remove accessor. (CLASS_BINFO_ELTS): Reduce from 6 to 5, now that CLASS_OWN_IVARS is gone. (OCTI_GNU_INIT_DECL, GNU_INIT_decl): New. (OCTI_ELLIPSIS_NODE, objc_ellipsis_node): Remove. (OCTI_ID_ID, id_type, objc_id_id): Rename to OCTI_ID_NAME, objc_object_type and objc_object_name, respectively. (OCTI_CLS_REF, OCTI_CLASS_NAME, objc_class_reference, objc_class_name): New. (IS_CLASS): New macro. (IS_ID, IS_SUPER): Robustify. (OCTI_EXECCLASS_DECL, execclass_decl): New. (finish_file, start_class, continue_class, finish_class, start_method_def, continue_method_def, finish_method_def, start_protocol, finish_protocol, objc_build_throw_stmt, objc_build_try_catch_finally_stmt, objc_build_synchronized_prologue, objc_build_synchronized_epilogue, objc_build_try_prologue, objc_build_try_epilogue, objc_build_catch_stmt, objc_build_catch_epilogue, objc_build_finally_prologue, objc_build_finally_epilogue, is_ivar, is_private, is_public, add_instance_variable, objc_add_method, get_super_receiver, objc_clear_super_receiver, get_class_ivars_from_name, get_class_reference, get_static_reference, get_object_reference, build_message_expr, finish_message_expr, build_selector_expr, build_ivar_reference, build_keyword_decl, build_method_decl, build_protocol_expr, build_objc_string_object, objc_declare_alias, objc_declare_class, objc_declare_protocols, objc_comptypes, objc_check_decl, build_encode_expr): Remove prototypes. (imp_count, cat_count): Make GGC-aware. (OBJC_SET_TYPE_NAME): New macro. From-SVN: r87168
2004-09-08 02:49:44 +02:00
struct _objc_protocol **protocol_list;
struct _objc__method_prototype_list *instance_methods;
struct _objc__method_prototype_list *class_methods;
}; */
Makefile.in (c-parse.o): Depend on $(C_COMMON_H). [gcc/ChangeLog] 2004-09-07 Ziemowit Laski <zlaski@apple.com> * Makefile.in (c-parse.o): Depend on $(C_COMMON_H). * c-parse.in: Include c-common.h instead of objc-act.h. (ivar_decl_list, ivar_decls, ivar_decl, ivars, ivar_declarator, myparms, myparm): Remove %type declarations. (methodtype, optparms, OBJC_TYPE_QUAL, objc_quals, objc_qual, objc_typename, objc_try_catch_stmt, optellipsis): Add %type declarations. (objc_inherit_code, objc_public_flag): Remove. (typespec_nonreserved_nonattr): Call objc_get_protocol_qualified_type() instead of get_static_reference() and get_protocol_reference(). (stmt_nocomp): Call grokparm() on @catch parameter. (objcdef): Move semantic action to objc_finish_implementation(). (classdef): Move semantic action to objc_start_class_interface(), objc_continue_interface(), objc_finish_interface(), objc_start_class_implementation(), objc_continue_implementation(), objc_start_category_interface() and objc_start_category_implementation(). (protocoldef): Move semantic actions to objc_start_protocol() and objc_finish_interface(). (ivar_decl_list): Remove nonterminal. (visibility_spec): Move semantic actions to objc_set_visibility(). (ivar_decls): Remove assignment to $$. (ivar_decl): Rephrase in terms of component_decl; call objc_add_instance_variable(). (ivars, ivar_declarator): Remove nonterminals. (opt_semi): New nonterminal. (methodtype): Remove semantic actions. (methoddef): Move semantic actions to objc_set_method_type(), objc_start_method_definition() and objc_finish_method_definition(). (methodproto): Move semantic actions to objc_set_method_type() and objc_add_method_declaration(). (methoddecl): Use objc_typename instead of typename; move semantic actions to objc_build_method_signature(). (optarglist, myxdecls, mydecl, myparms, myparm): Remove nonterminals. (optparmlist): Express in terms of optparms and optellipsis. (optparms, optellipsis, objc_qual, objc_quals, objc_typename): New nonterminals. (keyworddecl): Use objc_typename instead of typename. (rid_to_yy): Mark RID_IN, RID_OUT, RID_INOUT, RID_BYCOPY, RID_BYREF and RID_ONEWAY as returning OBJC_TYPE_QUAL to yyparse(). [gcc/objc/ChangeLog] 2004-09-07 Ziemowit Laski <zlaski@apple.com> * Make-lang.in (objc/objc-parse.o): Depend on $(C_COMMON_H) instead of objc/objc-act.h. (objc/objc-act.o): Depend on $(HASHTAB_H). * objc-act.c: Include hashtab.h; in ObjC++ mode, include cp-tree.h and objcp-decl.h instead of c-tree.h. (build_module_descriptor, get_class_ivars, synth_id_with_class_suffix, error_with_ivar, gen_method_decl, gen_declaration, setup_string_decl, build_protocol_template): Adjust prototypes. (build_module_initializer_routine, start_class, continue_class, finish_class, start_method_def, objc_start_function, start_protocol, build_method_decl, objc_add_method, add_instance_variable, build_ivar_reference, is_ivar, is_private, get_super_receiver, build_selector_table_decl, objc_push_parm, objc_get_parm_info, gen_type_name, gen_type_name_0, start_var_decl, finish_var_decl, create_field_decl): New prototypes. (objc_expand_function_end, comp_method_with_proto, objc_expr_last, gen_declaration_1, gen_declarator, is_complex_decl, adorn_decl, define_decl, create_builtin_decl, gen_declspecs): Remove prototypes. (TYPE_ID): Rename to OBJECT_TYPEDEF_NAME. (CLASS_TYPEDEF_NAME): New. (TAG_EXECCLASS): Change from a global variable to a #define. (TAG_RETURN_STRUCT): Delete. (TAG_GNUINIT): New, holds '__objc_gnu_init' name. (objc_inherit_code, objc_public_flag): New, moved from c-parse.in. (string_descriptor): New struct. (string_htab): New hash table. (string_hash, string_eq): New prototypes. (generate_struct_by_value_array): Call create_field_decl() instead of create_builtin_decl(). (objc_init): Do not initialize objc_ellipsis_node or TAG_EXECCLASS; In ObjC++ mode, call cxx_init() instead of c_objc_common_init(). (objc_finish_file): In ObjC++, call instantiate_pending_templates() and cp_finish_file(). (define_decl, get_static_reference, get_protocol_reference, create_builtin_decl): Remove functions. (objc_start_class_interface, objc_start_category_interface, objc_start_protocol, objc_continue_interface, objc_finish_interface, objc_start_class_implementation, objc_start_category_implementation, objc_continue_implementation, objc_finish_implementation, objc_set_visibility, objc_set_method_type, objc_build_method_signature, objc_add_method_declaration, objc_start_method_definition, objc_add_instance_variable, objc_get_protocol_qualified_type, create_field_decl, start_var_decl, finish_var_decl): New functions. (setup_string_decl): Simplify since it is only called once. (synth_module_prologue): Call build_class_template(); predefine 'id' and 'Class' as typedefs; rename 'temp_type' to 'type'; disable debug hooks for duration of function; fix GNU runtime messenger signatures to correspond to reality; forward-declare '__objc_exec_class' for the GNU runtime; call build_selector_table_decl(); in ObjC++ mode, generate 'extern "C" { ... }' wrappers around synthesized declarations; call build_protocol_template() and build_category_template(). (string_hash, string_eq): New functions. (objc_build_string_object): Check metaclass correctness only once; store string literals in hash table. (objc_build_constructor): Do not convert initializer elements; adjust for ObjC++ impedance mismatch. (build_objc_symtab_template): Call create_field_decl() instead of create_builtin_decl(). (init_objc_symtab): Add missing conversion to initializer element. (build_metadata_decl): Call start_var_decl() instead of define_decl(). (generate_objc_symtab_decl): Do not call build_category_template(); call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(). (build_module_descriptor): Call create_field_decl() instead of grokfield(); call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(); always mark module descriptor as used; move GNU runtime-specific functionality to build_module_initializer_routine(). (build_module_initializer_routine): New function, broken off of build_module_descriptor(). (objc_static_init_needed_p, objc_generate_static_init_call): New functions. (generate_static_references, generate_strings, build_selector_translation_table, generate_descriptor_table, generate_ivars_list, generate_dispatch_table, generate_category): Call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(); build a type directly instead of via groktypename(). (build_selector_reference_decl, build_selector_table_decl, build_class_reference_decl, build_protocol_reference, generate_objc_image_info): Call start_var_decl() instead of build_decl(). (build_selector_reference): For GNU runtime, do not call build_selector_reference_decl(). (build_selector, build_typed_selector_reference): Always convert result to the selector type. (add_objc_string): Cast return value to 'char *'. (build_method_prototype_template, build_selector_template, build_method_template): Use actual selector type for fields pointing to selectors. (finish_objc): For GNU runtime, call build_module_initializer_routine() after build_module_descriptor(). (generate_protocol_list, generate_shared_structures): Call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(); build a type directly instead of via groktypename(). (synth_id_with_class_suffix): Return a string. (get_arg_type_list): For instance methods, use the instance type for 'self'; do not call groktypename_in_parm_context(). (build_objc_string_decl): Squash redeclaration errors in ObjC++. (objc_is_class_name): Use OBJC_TYPE_NAME instead of TYPE_NAME; handle RECORD_TYPEs in ObjC as well as ObjC++. (objc_is_id): New function. (objc_is_object_ptr): Return the canonical type node. (objc_get_class_ivars): Simplify using get_class_ivars(). (get_class_ivars): Remove second parameter; create a fresh copy of the ivar list for each call; do not check for existence of super class. (objc_eh_runtime_type): Mark #ifndef OBJCPLUS. (objc_init_exceptions): When using SJLJ-style exceptions, require the use of '-fobjc-exceptions' flag; do not require it for DWARF-style exceptions. (objc_build_exc_ptr, next_sjlj_build_try_catch_finally): Use objc_object_type instead of objc_id_type. (objc_begin_catch_clause): Convert the incoming PARM_DECL into a VAR_DECL before placing it in the appropriate scope; do not call define_decl(); adjust call to c_begin_compound_stmt(); use objc_object_type instead of objc_id_type. (build_next_objc_exception_stuff): Call create_field_decl() instead of create_builtin_decl(); construct type directly instead of calling groktypename(); use OBJC_VOID_AT_END to mark end of function parameters. (build_private_template): Adjust call to get_class_ivars(); build a type directly instead of via groktypename(). (build_protocol_template, build_method_prototype_list_template, build_method_prototype_template, build_category_template, build_selector_template, build_class_template, build_super_template, build_ivar_template, build_ivar_list_template, build_method_list_template, build_method_template): Call create_field_decl() instead of grokfield(). (objc_method_parm_type): Do not call groktypename(). (generate_descriptor_table): Call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(). (generate_method_descriptors, build_protocol_initializer, generate_dispatch_tables, build_category_initializer, build_shared_structure_initializer): Do not call groktypename(). (generate_protocols): Call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(); do not call groktypename(). (error_with_ivar): Remove last parameter. (check_ivars): Do not iterate ovar CLASS_RAW_IVARS lists in addition to CLASS_IVARS lists; adjust calls to error_with_ivar(). (generate_ivar_lists): Convert one of the initializer elements; do not call groktypename(). (get_arg_type_list, start_method_def, gen_method_def): Account for new representation of variable arguments and '...' in Objective-C methods; add Objective-C++ impedance matching code. (is_objc_type_qualifier): Remove function. (adjust_type_for_id_default): Simplify; there is no longer a need to wade through declspecs. (lookup_interface, start_class, continue_class, finish_class, start_method_def, start_protocol, build_method_decl, objc_add_method, add_instance_variable, build_ivar_reference, is_ivar, is_private, get_super_receiver, objc_build_finally_epilogue): Make into static functions. (receiver_is_class_object): Use new IS_CLASS() macro. (objc_build_message_expr): Tweak ObjC++ message argument handling; call objc_finish_message_expr() instead of finish_message_expr(). (finish_message_expr): Rename to objc_finish_message_expr(); use OBJC_TYPE_NAME and OBJC_SET_TYPE_NAME macros instead of TYPE_NAME. call gen_type_name() instead of gen_declaration(); call objc_is_id() instead of using IS_ID and IS_CLASS; Use objc_class_name instead of calling get_identifier("Class"); handle CONVERT_EXPRs in receiver. (build_objc_method_call, warn_with_method): Do not call groktypename(). (build_ivar_reference): Call convert() instead of clobbering in a type. (hash_init): Initialize string_htab hash table. (add_instance_variable): Simplify parameter list; do not call grokfield(); do not populate CLASS_IVARS list. (start_class): Check for the existence of super class, if one was specified. (continue_class): Use CLASS_RAW_IVARS rather than CLASS_IVARS; do not call build_class_template(); adjust call to get_class_ivars(); call build_decl(), pushdecl() and finish_decl() instead of define_decl(). (finish_class): Call build_decl(), pushdecl() and finish_decl() instead of define_decl(). (add_protocols): Use PROTOCOL_BINFO_ELTS for the tree vector size. (start_protocol): Do not call build_protocol_template(); use PROTOCOL_BINFO_ELTS for the tree vector size. (encode_type_qualifiers): Do not handle the 'const' qualifier here. (encode_pointer): Encode 'const char *' as 'r*', for backwards compatibility. (encode_array): Use HOST_WIDE_INT_PRINT_DEC instead of "%ld". (encode_type): Handle the 'const' qualifier here. (objc_parmlist): New global variable, sued by objc_push_parm and objc_get_parm_info(). (objc_push_parm, objc_get_parm_info): New functions. (objc_expr_last): Remove function. (synth_self_and_ucmd_args): For instance methods, use the instance type for 'self'; call objc_push_parm() instead of push_parm_decl(). (start_method_def): Do not call push_scope(), declare_parm_level(), pop_scope(), push_parm_decl(), store_parm_decls() or objc_expr_last(); just use objc_push_parm() and objc_get_parm_info(). (comp_method_with_proto): Remove function. (objc_types_are_equivalent): Strip away indirections before comparing underlying types. (comp_proto_with_proto): Do not call groktypename(); types are no longer in raw declspec format. (objc_start_function): New function. (really_start_method): Call comp_proto_with_proto() instead of comp_method_with_proto(); call objc_start_function() instead of hand-crafting a function declarator. (continue_method_def, objc_expand_function_end): Remove functions. (get_super_receiver): Call objc_get_current_scope() instead of get_current_scope(); reference 'super_class' field (instead of 'class'). (finish_method_def): Rename to objc_finish_method_definition() and add a function decl parameter; move method encoding call from objc_expand_function_end(). (is_complex_decl, adorn_decl, gen_declarator, gen_declspecs, gen_declaration_1): Remove functions. (tmpbuf, RAW_DECLSPEC): Remove. (gen_declaration): Remove second parameter; simplify to deal with TYPE_P nodes instead of raw declspecs. (gen_type_name, gen_type_name_0): New functions. (gen_method_decl): Remove second parameter; call gen_type_name() instead of gen_declaration_1(). (dump_interface): Adjust calls to gen_declaration() and gen_method_decl(); do not allocate a separate string buffer. (init_objc): Allocate a larger string buffer to accommodate dump_interface(); adjust call to build_module_descriptor(); add call to build_module_initializer_routine() for the GNU runtime. (generate_classref_translation_entry): Do not call start_decl(); call finish_var_decl() instead of finish_decl(); call convert() instead of build_c_cast(). * objc-act.h (CLASS_OWN_IVARS): Remove accessor. (CLASS_BINFO_ELTS): Reduce from 6 to 5, now that CLASS_OWN_IVARS is gone. (OCTI_GNU_INIT_DECL, GNU_INIT_decl): New. (OCTI_ELLIPSIS_NODE, objc_ellipsis_node): Remove. (OCTI_ID_ID, id_type, objc_id_id): Rename to OCTI_ID_NAME, objc_object_type and objc_object_name, respectively. (OCTI_CLS_REF, OCTI_CLASS_NAME, objc_class_reference, objc_class_name): New. (IS_CLASS): New macro. (IS_ID, IS_SUPER): Robustify. (OCTI_EXECCLASS_DECL, execclass_decl): New. (finish_file, start_class, continue_class, finish_class, start_method_def, continue_method_def, finish_method_def, start_protocol, finish_protocol, objc_build_throw_stmt, objc_build_try_catch_finally_stmt, objc_build_synchronized_prologue, objc_build_synchronized_epilogue, objc_build_try_prologue, objc_build_try_epilogue, objc_build_catch_stmt, objc_build_catch_epilogue, objc_build_finally_prologue, objc_build_finally_epilogue, is_ivar, is_private, is_public, add_instance_variable, objc_add_method, get_super_receiver, objc_clear_super_receiver, get_class_ivars_from_name, get_class_reference, get_static_reference, get_object_reference, build_message_expr, finish_message_expr, build_selector_expr, build_ivar_reference, build_keyword_decl, build_method_decl, build_protocol_expr, build_objc_string_object, objc_declare_alias, objc_declare_class, objc_declare_protocols, objc_comptypes, objc_check_decl, build_encode_expr): Remove prototypes. (imp_count, cat_count): Make GGC-aware. (OBJC_SET_TYPE_NAME): New macro. From-SVN: r87168
2004-09-08 02:49:44 +02:00
static void
build_protocol_template (void)
{
Makefile.in (c-parse.o): Depend on $(C_COMMON_H). [gcc/ChangeLog] 2004-09-07 Ziemowit Laski <zlaski@apple.com> * Makefile.in (c-parse.o): Depend on $(C_COMMON_H). * c-parse.in: Include c-common.h instead of objc-act.h. (ivar_decl_list, ivar_decls, ivar_decl, ivars, ivar_declarator, myparms, myparm): Remove %type declarations. (methodtype, optparms, OBJC_TYPE_QUAL, objc_quals, objc_qual, objc_typename, objc_try_catch_stmt, optellipsis): Add %type declarations. (objc_inherit_code, objc_public_flag): Remove. (typespec_nonreserved_nonattr): Call objc_get_protocol_qualified_type() instead of get_static_reference() and get_protocol_reference(). (stmt_nocomp): Call grokparm() on @catch parameter. (objcdef): Move semantic action to objc_finish_implementation(). (classdef): Move semantic action to objc_start_class_interface(), objc_continue_interface(), objc_finish_interface(), objc_start_class_implementation(), objc_continue_implementation(), objc_start_category_interface() and objc_start_category_implementation(). (protocoldef): Move semantic actions to objc_start_protocol() and objc_finish_interface(). (ivar_decl_list): Remove nonterminal. (visibility_spec): Move semantic actions to objc_set_visibility(). (ivar_decls): Remove assignment to $$. (ivar_decl): Rephrase in terms of component_decl; call objc_add_instance_variable(). (ivars, ivar_declarator): Remove nonterminals. (opt_semi): New nonterminal. (methodtype): Remove semantic actions. (methoddef): Move semantic actions to objc_set_method_type(), objc_start_method_definition() and objc_finish_method_definition(). (methodproto): Move semantic actions to objc_set_method_type() and objc_add_method_declaration(). (methoddecl): Use objc_typename instead of typename; move semantic actions to objc_build_method_signature(). (optarglist, myxdecls, mydecl, myparms, myparm): Remove nonterminals. (optparmlist): Express in terms of optparms and optellipsis. (optparms, optellipsis, objc_qual, objc_quals, objc_typename): New nonterminals. (keyworddecl): Use objc_typename instead of typename. (rid_to_yy): Mark RID_IN, RID_OUT, RID_INOUT, RID_BYCOPY, RID_BYREF and RID_ONEWAY as returning OBJC_TYPE_QUAL to yyparse(). [gcc/objc/ChangeLog] 2004-09-07 Ziemowit Laski <zlaski@apple.com> * Make-lang.in (objc/objc-parse.o): Depend on $(C_COMMON_H) instead of objc/objc-act.h. (objc/objc-act.o): Depend on $(HASHTAB_H). * objc-act.c: Include hashtab.h; in ObjC++ mode, include cp-tree.h and objcp-decl.h instead of c-tree.h. (build_module_descriptor, get_class_ivars, synth_id_with_class_suffix, error_with_ivar, gen_method_decl, gen_declaration, setup_string_decl, build_protocol_template): Adjust prototypes. (build_module_initializer_routine, start_class, continue_class, finish_class, start_method_def, objc_start_function, start_protocol, build_method_decl, objc_add_method, add_instance_variable, build_ivar_reference, is_ivar, is_private, get_super_receiver, build_selector_table_decl, objc_push_parm, objc_get_parm_info, gen_type_name, gen_type_name_0, start_var_decl, finish_var_decl, create_field_decl): New prototypes. (objc_expand_function_end, comp_method_with_proto, objc_expr_last, gen_declaration_1, gen_declarator, is_complex_decl, adorn_decl, define_decl, create_builtin_decl, gen_declspecs): Remove prototypes. (TYPE_ID): Rename to OBJECT_TYPEDEF_NAME. (CLASS_TYPEDEF_NAME): New. (TAG_EXECCLASS): Change from a global variable to a #define. (TAG_RETURN_STRUCT): Delete. (TAG_GNUINIT): New, holds '__objc_gnu_init' name. (objc_inherit_code, objc_public_flag): New, moved from c-parse.in. (string_descriptor): New struct. (string_htab): New hash table. (string_hash, string_eq): New prototypes. (generate_struct_by_value_array): Call create_field_decl() instead of create_builtin_decl(). (objc_init): Do not initialize objc_ellipsis_node or TAG_EXECCLASS; In ObjC++ mode, call cxx_init() instead of c_objc_common_init(). (objc_finish_file): In ObjC++, call instantiate_pending_templates() and cp_finish_file(). (define_decl, get_static_reference, get_protocol_reference, create_builtin_decl): Remove functions. (objc_start_class_interface, objc_start_category_interface, objc_start_protocol, objc_continue_interface, objc_finish_interface, objc_start_class_implementation, objc_start_category_implementation, objc_continue_implementation, objc_finish_implementation, objc_set_visibility, objc_set_method_type, objc_build_method_signature, objc_add_method_declaration, objc_start_method_definition, objc_add_instance_variable, objc_get_protocol_qualified_type, create_field_decl, start_var_decl, finish_var_decl): New functions. (setup_string_decl): Simplify since it is only called once. (synth_module_prologue): Call build_class_template(); predefine 'id' and 'Class' as typedefs; rename 'temp_type' to 'type'; disable debug hooks for duration of function; fix GNU runtime messenger signatures to correspond to reality; forward-declare '__objc_exec_class' for the GNU runtime; call build_selector_table_decl(); in ObjC++ mode, generate 'extern "C" { ... }' wrappers around synthesized declarations; call build_protocol_template() and build_category_template(). (string_hash, string_eq): New functions. (objc_build_string_object): Check metaclass correctness only once; store string literals in hash table. (objc_build_constructor): Do not convert initializer elements; adjust for ObjC++ impedance mismatch. (build_objc_symtab_template): Call create_field_decl() instead of create_builtin_decl(). (init_objc_symtab): Add missing conversion to initializer element. (build_metadata_decl): Call start_var_decl() instead of define_decl(). (generate_objc_symtab_decl): Do not call build_category_template(); call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(). (build_module_descriptor): Call create_field_decl() instead of grokfield(); call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(); always mark module descriptor as used; move GNU runtime-specific functionality to build_module_initializer_routine(). (build_module_initializer_routine): New function, broken off of build_module_descriptor(). (objc_static_init_needed_p, objc_generate_static_init_call): New functions. (generate_static_references, generate_strings, build_selector_translation_table, generate_descriptor_table, generate_ivars_list, generate_dispatch_table, generate_category): Call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(); build a type directly instead of via groktypename(). (build_selector_reference_decl, build_selector_table_decl, build_class_reference_decl, build_protocol_reference, generate_objc_image_info): Call start_var_decl() instead of build_decl(). (build_selector_reference): For GNU runtime, do not call build_selector_reference_decl(). (build_selector, build_typed_selector_reference): Always convert result to the selector type. (add_objc_string): Cast return value to 'char *'. (build_method_prototype_template, build_selector_template, build_method_template): Use actual selector type for fields pointing to selectors. (finish_objc): For GNU runtime, call build_module_initializer_routine() after build_module_descriptor(). (generate_protocol_list, generate_shared_structures): Call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(); build a type directly instead of via groktypename(). (synth_id_with_class_suffix): Return a string. (get_arg_type_list): For instance methods, use the instance type for 'self'; do not call groktypename_in_parm_context(). (build_objc_string_decl): Squash redeclaration errors in ObjC++. (objc_is_class_name): Use OBJC_TYPE_NAME instead of TYPE_NAME; handle RECORD_TYPEs in ObjC as well as ObjC++. (objc_is_id): New function. (objc_is_object_ptr): Return the canonical type node. (objc_get_class_ivars): Simplify using get_class_ivars(). (get_class_ivars): Remove second parameter; create a fresh copy of the ivar list for each call; do not check for existence of super class. (objc_eh_runtime_type): Mark #ifndef OBJCPLUS. (objc_init_exceptions): When using SJLJ-style exceptions, require the use of '-fobjc-exceptions' flag; do not require it for DWARF-style exceptions. (objc_build_exc_ptr, next_sjlj_build_try_catch_finally): Use objc_object_type instead of objc_id_type. (objc_begin_catch_clause): Convert the incoming PARM_DECL into a VAR_DECL before placing it in the appropriate scope; do not call define_decl(); adjust call to c_begin_compound_stmt(); use objc_object_type instead of objc_id_type. (build_next_objc_exception_stuff): Call create_field_decl() instead of create_builtin_decl(); construct type directly instead of calling groktypename(); use OBJC_VOID_AT_END to mark end of function parameters. (build_private_template): Adjust call to get_class_ivars(); build a type directly instead of via groktypename(). (build_protocol_template, build_method_prototype_list_template, build_method_prototype_template, build_category_template, build_selector_template, build_class_template, build_super_template, build_ivar_template, build_ivar_list_template, build_method_list_template, build_method_template): Call create_field_decl() instead of grokfield(). (objc_method_parm_type): Do not call groktypename(). (generate_descriptor_table): Call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(). (generate_method_descriptors, build_protocol_initializer, generate_dispatch_tables, build_category_initializer, build_shared_structure_initializer): Do not call groktypename(). (generate_protocols): Call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(); do not call groktypename(). (error_with_ivar): Remove last parameter. (check_ivars): Do not iterate ovar CLASS_RAW_IVARS lists in addition to CLASS_IVARS lists; adjust calls to error_with_ivar(). (generate_ivar_lists): Convert one of the initializer elements; do not call groktypename(). (get_arg_type_list, start_method_def, gen_method_def): Account for new representation of variable arguments and '...' in Objective-C methods; add Objective-C++ impedance matching code. (is_objc_type_qualifier): Remove function. (adjust_type_for_id_default): Simplify; there is no longer a need to wade through declspecs. (lookup_interface, start_class, continue_class, finish_class, start_method_def, start_protocol, build_method_decl, objc_add_method, add_instance_variable, build_ivar_reference, is_ivar, is_private, get_super_receiver, objc_build_finally_epilogue): Make into static functions. (receiver_is_class_object): Use new IS_CLASS() macro. (objc_build_message_expr): Tweak ObjC++ message argument handling; call objc_finish_message_expr() instead of finish_message_expr(). (finish_message_expr): Rename to objc_finish_message_expr(); use OBJC_TYPE_NAME and OBJC_SET_TYPE_NAME macros instead of TYPE_NAME. call gen_type_name() instead of gen_declaration(); call objc_is_id() instead of using IS_ID and IS_CLASS; Use objc_class_name instead of calling get_identifier("Class"); handle CONVERT_EXPRs in receiver. (build_objc_method_call, warn_with_method): Do not call groktypename(). (build_ivar_reference): Call convert() instead of clobbering in a type. (hash_init): Initialize string_htab hash table. (add_instance_variable): Simplify parameter list; do not call grokfield(); do not populate CLASS_IVARS list. (start_class): Check for the existence of super class, if one was specified. (continue_class): Use CLASS_RAW_IVARS rather than CLASS_IVARS; do not call build_class_template(); adjust call to get_class_ivars(); call build_decl(), pushdecl() and finish_decl() instead of define_decl(). (finish_class): Call build_decl(), pushdecl() and finish_decl() instead of define_decl(). (add_protocols): Use PROTOCOL_BINFO_ELTS for the tree vector size. (start_protocol): Do not call build_protocol_template(); use PROTOCOL_BINFO_ELTS for the tree vector size. (encode_type_qualifiers): Do not handle the 'const' qualifier here. (encode_pointer): Encode 'const char *' as 'r*', for backwards compatibility. (encode_array): Use HOST_WIDE_INT_PRINT_DEC instead of "%ld". (encode_type): Handle the 'const' qualifier here. (objc_parmlist): New global variable, sued by objc_push_parm and objc_get_parm_info(). (objc_push_parm, objc_get_parm_info): New functions. (objc_expr_last): Remove function. (synth_self_and_ucmd_args): For instance methods, use the instance type for 'self'; call objc_push_parm() instead of push_parm_decl(). (start_method_def): Do not call push_scope(), declare_parm_level(), pop_scope(), push_parm_decl(), store_parm_decls() or objc_expr_last(); just use objc_push_parm() and objc_get_parm_info(). (comp_method_with_proto): Remove function. (objc_types_are_equivalent): Strip away indirections before comparing underlying types. (comp_proto_with_proto): Do not call groktypename(); types are no longer in raw declspec format. (objc_start_function): New function. (really_start_method): Call comp_proto_with_proto() instead of comp_method_with_proto(); call objc_start_function() instead of hand-crafting a function declarator. (continue_method_def, objc_expand_function_end): Remove functions. (get_super_receiver): Call objc_get_current_scope() instead of get_current_scope(); reference 'super_class' field (instead of 'class'). (finish_method_def): Rename to objc_finish_method_definition() and add a function decl parameter; move method encoding call from objc_expand_function_end(). (is_complex_decl, adorn_decl, gen_declarator, gen_declspecs, gen_declaration_1): Remove functions. (tmpbuf, RAW_DECLSPEC): Remove. (gen_declaration): Remove second parameter; simplify to deal with TYPE_P nodes instead of raw declspecs. (gen_type_name, gen_type_name_0): New functions. (gen_method_decl): Remove second parameter; call gen_type_name() instead of gen_declaration_1(). (dump_interface): Adjust calls to gen_declaration() and gen_method_decl(); do not allocate a separate string buffer. (init_objc): Allocate a larger string buffer to accommodate dump_interface(); adjust call to build_module_descriptor(); add call to build_module_initializer_routine() for the GNU runtime. (generate_classref_translation_entry): Do not call start_decl(); call finish_var_decl() instead of finish_decl(); call convert() instead of build_c_cast(). * objc-act.h (CLASS_OWN_IVARS): Remove accessor. (CLASS_BINFO_ELTS): Reduce from 6 to 5, now that CLASS_OWN_IVARS is gone. (OCTI_GNU_INIT_DECL, GNU_INIT_decl): New. (OCTI_ELLIPSIS_NODE, objc_ellipsis_node): Remove. (OCTI_ID_ID, id_type, objc_id_id): Rename to OCTI_ID_NAME, objc_object_type and objc_object_name, respectively. (OCTI_CLS_REF, OCTI_CLASS_NAME, objc_class_reference, objc_class_name): New. (IS_CLASS): New macro. (IS_ID, IS_SUPER): Robustify. (OCTI_EXECCLASS_DECL, execclass_decl): New. (finish_file, start_class, continue_class, finish_class, start_method_def, continue_method_def, finish_method_def, start_protocol, finish_protocol, objc_build_throw_stmt, objc_build_try_catch_finally_stmt, objc_build_synchronized_prologue, objc_build_synchronized_epilogue, objc_build_try_prologue, objc_build_try_epilogue, objc_build_catch_stmt, objc_build_catch_epilogue, objc_build_finally_prologue, objc_build_finally_epilogue, is_ivar, is_private, is_public, add_instance_variable, objc_add_method, get_super_receiver, objc_clear_super_receiver, get_class_ivars_from_name, get_class_reference, get_static_reference, get_object_reference, build_message_expr, finish_message_expr, build_selector_expr, build_ivar_reference, build_keyword_decl, build_method_decl, build_protocol_expr, build_objc_string_object, objc_declare_alias, objc_declare_class, objc_declare_protocols, objc_comptypes, objc_check_decl, build_encode_expr): Remove prototypes. (imp_count, cat_count): Make GGC-aware. (OBJC_SET_TYPE_NAME): New macro. From-SVN: r87168
2004-09-08 02:49:44 +02:00
tree field_decl, field_decl_chain;
Makefile.in (c-parse.o): Depend on $(C_COMMON_H). [gcc/ChangeLog] 2004-09-07 Ziemowit Laski <zlaski@apple.com> * Makefile.in (c-parse.o): Depend on $(C_COMMON_H). * c-parse.in: Include c-common.h instead of objc-act.h. (ivar_decl_list, ivar_decls, ivar_decl, ivars, ivar_declarator, myparms, myparm): Remove %type declarations. (methodtype, optparms, OBJC_TYPE_QUAL, objc_quals, objc_qual, objc_typename, objc_try_catch_stmt, optellipsis): Add %type declarations. (objc_inherit_code, objc_public_flag): Remove. (typespec_nonreserved_nonattr): Call objc_get_protocol_qualified_type() instead of get_static_reference() and get_protocol_reference(). (stmt_nocomp): Call grokparm() on @catch parameter. (objcdef): Move semantic action to objc_finish_implementation(). (classdef): Move semantic action to objc_start_class_interface(), objc_continue_interface(), objc_finish_interface(), objc_start_class_implementation(), objc_continue_implementation(), objc_start_category_interface() and objc_start_category_implementation(). (protocoldef): Move semantic actions to objc_start_protocol() and objc_finish_interface(). (ivar_decl_list): Remove nonterminal. (visibility_spec): Move semantic actions to objc_set_visibility(). (ivar_decls): Remove assignment to $$. (ivar_decl): Rephrase in terms of component_decl; call objc_add_instance_variable(). (ivars, ivar_declarator): Remove nonterminals. (opt_semi): New nonterminal. (methodtype): Remove semantic actions. (methoddef): Move semantic actions to objc_set_method_type(), objc_start_method_definition() and objc_finish_method_definition(). (methodproto): Move semantic actions to objc_set_method_type() and objc_add_method_declaration(). (methoddecl): Use objc_typename instead of typename; move semantic actions to objc_build_method_signature(). (optarglist, myxdecls, mydecl, myparms, myparm): Remove nonterminals. (optparmlist): Express in terms of optparms and optellipsis. (optparms, optellipsis, objc_qual, objc_quals, objc_typename): New nonterminals. (keyworddecl): Use objc_typename instead of typename. (rid_to_yy): Mark RID_IN, RID_OUT, RID_INOUT, RID_BYCOPY, RID_BYREF and RID_ONEWAY as returning OBJC_TYPE_QUAL to yyparse(). [gcc/objc/ChangeLog] 2004-09-07 Ziemowit Laski <zlaski@apple.com> * Make-lang.in (objc/objc-parse.o): Depend on $(C_COMMON_H) instead of objc/objc-act.h. (objc/objc-act.o): Depend on $(HASHTAB_H). * objc-act.c: Include hashtab.h; in ObjC++ mode, include cp-tree.h and objcp-decl.h instead of c-tree.h. (build_module_descriptor, get_class_ivars, synth_id_with_class_suffix, error_with_ivar, gen_method_decl, gen_declaration, setup_string_decl, build_protocol_template): Adjust prototypes. (build_module_initializer_routine, start_class, continue_class, finish_class, start_method_def, objc_start_function, start_protocol, build_method_decl, objc_add_method, add_instance_variable, build_ivar_reference, is_ivar, is_private, get_super_receiver, build_selector_table_decl, objc_push_parm, objc_get_parm_info, gen_type_name, gen_type_name_0, start_var_decl, finish_var_decl, create_field_decl): New prototypes. (objc_expand_function_end, comp_method_with_proto, objc_expr_last, gen_declaration_1, gen_declarator, is_complex_decl, adorn_decl, define_decl, create_builtin_decl, gen_declspecs): Remove prototypes. (TYPE_ID): Rename to OBJECT_TYPEDEF_NAME. (CLASS_TYPEDEF_NAME): New. (TAG_EXECCLASS): Change from a global variable to a #define. (TAG_RETURN_STRUCT): Delete. (TAG_GNUINIT): New, holds '__objc_gnu_init' name. (objc_inherit_code, objc_public_flag): New, moved from c-parse.in. (string_descriptor): New struct. (string_htab): New hash table. (string_hash, string_eq): New prototypes. (generate_struct_by_value_array): Call create_field_decl() instead of create_builtin_decl(). (objc_init): Do not initialize objc_ellipsis_node or TAG_EXECCLASS; In ObjC++ mode, call cxx_init() instead of c_objc_common_init(). (objc_finish_file): In ObjC++, call instantiate_pending_templates() and cp_finish_file(). (define_decl, get_static_reference, get_protocol_reference, create_builtin_decl): Remove functions. (objc_start_class_interface, objc_start_category_interface, objc_start_protocol, objc_continue_interface, objc_finish_interface, objc_start_class_implementation, objc_start_category_implementation, objc_continue_implementation, objc_finish_implementation, objc_set_visibility, objc_set_method_type, objc_build_method_signature, objc_add_method_declaration, objc_start_method_definition, objc_add_instance_variable, objc_get_protocol_qualified_type, create_field_decl, start_var_decl, finish_var_decl): New functions. (setup_string_decl): Simplify since it is only called once. (synth_module_prologue): Call build_class_template(); predefine 'id' and 'Class' as typedefs; rename 'temp_type' to 'type'; disable debug hooks for duration of function; fix GNU runtime messenger signatures to correspond to reality; forward-declare '__objc_exec_class' for the GNU runtime; call build_selector_table_decl(); in ObjC++ mode, generate 'extern "C" { ... }' wrappers around synthesized declarations; call build_protocol_template() and build_category_template(). (string_hash, string_eq): New functions. (objc_build_string_object): Check metaclass correctness only once; store string literals in hash table. (objc_build_constructor): Do not convert initializer elements; adjust for ObjC++ impedance mismatch. (build_objc_symtab_template): Call create_field_decl() instead of create_builtin_decl(). (init_objc_symtab): Add missing conversion to initializer element. (build_metadata_decl): Call start_var_decl() instead of define_decl(). (generate_objc_symtab_decl): Do not call build_category_template(); call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(). (build_module_descriptor): Call create_field_decl() instead of grokfield(); call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(); always mark module descriptor as used; move GNU runtime-specific functionality to build_module_initializer_routine(). (build_module_initializer_routine): New function, broken off of build_module_descriptor(). (objc_static_init_needed_p, objc_generate_static_init_call): New functions. (generate_static_references, generate_strings, build_selector_translation_table, generate_descriptor_table, generate_ivars_list, generate_dispatch_table, generate_category): Call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(); build a type directly instead of via groktypename(). (build_selector_reference_decl, build_selector_table_decl, build_class_reference_decl, build_protocol_reference, generate_objc_image_info): Call start_var_decl() instead of build_decl(). (build_selector_reference): For GNU runtime, do not call build_selector_reference_decl(). (build_selector, build_typed_selector_reference): Always convert result to the selector type. (add_objc_string): Cast return value to 'char *'. (build_method_prototype_template, build_selector_template, build_method_template): Use actual selector type for fields pointing to selectors. (finish_objc): For GNU runtime, call build_module_initializer_routine() after build_module_descriptor(). (generate_protocol_list, generate_shared_structures): Call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(); build a type directly instead of via groktypename(). (synth_id_with_class_suffix): Return a string. (get_arg_type_list): For instance methods, use the instance type for 'self'; do not call groktypename_in_parm_context(). (build_objc_string_decl): Squash redeclaration errors in ObjC++. (objc_is_class_name): Use OBJC_TYPE_NAME instead of TYPE_NAME; handle RECORD_TYPEs in ObjC as well as ObjC++. (objc_is_id): New function. (objc_is_object_ptr): Return the canonical type node. (objc_get_class_ivars): Simplify using get_class_ivars(). (get_class_ivars): Remove second parameter; create a fresh copy of the ivar list for each call; do not check for existence of super class. (objc_eh_runtime_type): Mark #ifndef OBJCPLUS. (objc_init_exceptions): When using SJLJ-style exceptions, require the use of '-fobjc-exceptions' flag; do not require it for DWARF-style exceptions. (objc_build_exc_ptr, next_sjlj_build_try_catch_finally): Use objc_object_type instead of objc_id_type. (objc_begin_catch_clause): Convert the incoming PARM_DECL into a VAR_DECL before placing it in the appropriate scope; do not call define_decl(); adjust call to c_begin_compound_stmt(); use objc_object_type instead of objc_id_type. (build_next_objc_exception_stuff): Call create_field_decl() instead of create_builtin_decl(); construct type directly instead of calling groktypename(); use OBJC_VOID_AT_END to mark end of function parameters. (build_private_template): Adjust call to get_class_ivars(); build a type directly instead of via groktypename(). (build_protocol_template, build_method_prototype_list_template, build_method_prototype_template, build_category_template, build_selector_template, build_class_template, build_super_template, build_ivar_template, build_ivar_list_template, build_method_list_template, build_method_template): Call create_field_decl() instead of grokfield(). (objc_method_parm_type): Do not call groktypename(). (generate_descriptor_table): Call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(). (generate_method_descriptors, build_protocol_initializer, generate_dispatch_tables, build_category_initializer, build_shared_structure_initializer): Do not call groktypename(). (generate_protocols): Call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(); do not call groktypename(). (error_with_ivar): Remove last parameter. (check_ivars): Do not iterate ovar CLASS_RAW_IVARS lists in addition to CLASS_IVARS lists; adjust calls to error_with_ivar(). (generate_ivar_lists): Convert one of the initializer elements; do not call groktypename(). (get_arg_type_list, start_method_def, gen_method_def): Account for new representation of variable arguments and '...' in Objective-C methods; add Objective-C++ impedance matching code. (is_objc_type_qualifier): Remove function. (adjust_type_for_id_default): Simplify; there is no longer a need to wade through declspecs. (lookup_interface, start_class, continue_class, finish_class, start_method_def, start_protocol, build_method_decl, objc_add_method, add_instance_variable, build_ivar_reference, is_ivar, is_private, get_super_receiver, objc_build_finally_epilogue): Make into static functions. (receiver_is_class_object): Use new IS_CLASS() macro. (objc_build_message_expr): Tweak ObjC++ message argument handling; call objc_finish_message_expr() instead of finish_message_expr(). (finish_message_expr): Rename to objc_finish_message_expr(); use OBJC_TYPE_NAME and OBJC_SET_TYPE_NAME macros instead of TYPE_NAME. call gen_type_name() instead of gen_declaration(); call objc_is_id() instead of using IS_ID and IS_CLASS; Use objc_class_name instead of calling get_identifier("Class"); handle CONVERT_EXPRs in receiver. (build_objc_method_call, warn_with_method): Do not call groktypename(). (build_ivar_reference): Call convert() instead of clobbering in a type. (hash_init): Initialize string_htab hash table. (add_instance_variable): Simplify parameter list; do not call grokfield(); do not populate CLASS_IVARS list. (start_class): Check for the existence of super class, if one was specified. (continue_class): Use CLASS_RAW_IVARS rather than CLASS_IVARS; do not call build_class_template(); adjust call to get_class_ivars(); call build_decl(), pushdecl() and finish_decl() instead of define_decl(). (finish_class): Call build_decl(), pushdecl() and finish_decl() instead of define_decl(). (add_protocols): Use PROTOCOL_BINFO_ELTS for the tree vector size. (start_protocol): Do not call build_protocol_template(); use PROTOCOL_BINFO_ELTS for the tree vector size. (encode_type_qualifiers): Do not handle the 'const' qualifier here. (encode_pointer): Encode 'const char *' as 'r*', for backwards compatibility. (encode_array): Use HOST_WIDE_INT_PRINT_DEC instead of "%ld". (encode_type): Handle the 'const' qualifier here. (objc_parmlist): New global variable, sued by objc_push_parm and objc_get_parm_info(). (objc_push_parm, objc_get_parm_info): New functions. (objc_expr_last): Remove function. (synth_self_and_ucmd_args): For instance methods, use the instance type for 'self'; call objc_push_parm() instead of push_parm_decl(). (start_method_def): Do not call push_scope(), declare_parm_level(), pop_scope(), push_parm_decl(), store_parm_decls() or objc_expr_last(); just use objc_push_parm() and objc_get_parm_info(). (comp_method_with_proto): Remove function. (objc_types_are_equivalent): Strip away indirections before comparing underlying types. (comp_proto_with_proto): Do not call groktypename(); types are no longer in raw declspec format. (objc_start_function): New function. (really_start_method): Call comp_proto_with_proto() instead of comp_method_with_proto(); call objc_start_function() instead of hand-crafting a function declarator. (continue_method_def, objc_expand_function_end): Remove functions. (get_super_receiver): Call objc_get_current_scope() instead of get_current_scope(); reference 'super_class' field (instead of 'class'). (finish_method_def): Rename to objc_finish_method_definition() and add a function decl parameter; move method encoding call from objc_expand_function_end(). (is_complex_decl, adorn_decl, gen_declarator, gen_declspecs, gen_declaration_1): Remove functions. (tmpbuf, RAW_DECLSPEC): Remove. (gen_declaration): Remove second parameter; simplify to deal with TYPE_P nodes instead of raw declspecs. (gen_type_name, gen_type_name_0): New functions. (gen_method_decl): Remove second parameter; call gen_type_name() instead of gen_declaration_1(). (dump_interface): Adjust calls to gen_declaration() and gen_method_decl(); do not allocate a separate string buffer. (init_objc): Allocate a larger string buffer to accommodate dump_interface(); adjust call to build_module_descriptor(); add call to build_module_initializer_routine() for the GNU runtime. (generate_classref_translation_entry): Do not call start_decl(); call finish_var_decl() instead of finish_decl(); call convert() instead of build_c_cast(). * objc-act.h (CLASS_OWN_IVARS): Remove accessor. (CLASS_BINFO_ELTS): Reduce from 6 to 5, now that CLASS_OWN_IVARS is gone. (OCTI_GNU_INIT_DECL, GNU_INIT_decl): New. (OCTI_ELLIPSIS_NODE, objc_ellipsis_node): Remove. (OCTI_ID_ID, id_type, objc_id_id): Rename to OCTI_ID_NAME, objc_object_type and objc_object_name, respectively. (OCTI_CLS_REF, OCTI_CLASS_NAME, objc_class_reference, objc_class_name): New. (IS_CLASS): New macro. (IS_ID, IS_SUPER): Robustify. (OCTI_EXECCLASS_DECL, execclass_decl): New. (finish_file, start_class, continue_class, finish_class, start_method_def, continue_method_def, finish_method_def, start_protocol, finish_protocol, objc_build_throw_stmt, objc_build_try_catch_finally_stmt, objc_build_synchronized_prologue, objc_build_synchronized_epilogue, objc_build_try_prologue, objc_build_try_epilogue, objc_build_catch_stmt, objc_build_catch_epilogue, objc_build_finally_prologue, objc_build_finally_epilogue, is_ivar, is_private, is_public, add_instance_variable, objc_add_method, get_super_receiver, objc_clear_super_receiver, get_class_ivars_from_name, get_class_reference, get_static_reference, get_object_reference, build_message_expr, finish_message_expr, build_selector_expr, build_ivar_reference, build_keyword_decl, build_method_decl, build_protocol_expr, build_objc_string_object, objc_declare_alias, objc_declare_class, objc_declare_protocols, objc_comptypes, objc_check_decl, build_encode_expr): Remove prototypes. (imp_count, cat_count): Make GGC-aware. (OBJC_SET_TYPE_NAME): New macro. From-SVN: r87168
2004-09-08 02:49:44 +02:00
objc_protocol_template = start_struct (RECORD_TYPE,
get_identifier (UTAG_PROTOCOL));
Makefile.in (c-parse.o): Depend on $(C_COMMON_H). [gcc/ChangeLog] 2004-09-07 Ziemowit Laski <zlaski@apple.com> * Makefile.in (c-parse.o): Depend on $(C_COMMON_H). * c-parse.in: Include c-common.h instead of objc-act.h. (ivar_decl_list, ivar_decls, ivar_decl, ivars, ivar_declarator, myparms, myparm): Remove %type declarations. (methodtype, optparms, OBJC_TYPE_QUAL, objc_quals, objc_qual, objc_typename, objc_try_catch_stmt, optellipsis): Add %type declarations. (objc_inherit_code, objc_public_flag): Remove. (typespec_nonreserved_nonattr): Call objc_get_protocol_qualified_type() instead of get_static_reference() and get_protocol_reference(). (stmt_nocomp): Call grokparm() on @catch parameter. (objcdef): Move semantic action to objc_finish_implementation(). (classdef): Move semantic action to objc_start_class_interface(), objc_continue_interface(), objc_finish_interface(), objc_start_class_implementation(), objc_continue_implementation(), objc_start_category_interface() and objc_start_category_implementation(). (protocoldef): Move semantic actions to objc_start_protocol() and objc_finish_interface(). (ivar_decl_list): Remove nonterminal. (visibility_spec): Move semantic actions to objc_set_visibility(). (ivar_decls): Remove assignment to $$. (ivar_decl): Rephrase in terms of component_decl; call objc_add_instance_variable(). (ivars, ivar_declarator): Remove nonterminals. (opt_semi): New nonterminal. (methodtype): Remove semantic actions. (methoddef): Move semantic actions to objc_set_method_type(), objc_start_method_definition() and objc_finish_method_definition(). (methodproto): Move semantic actions to objc_set_method_type() and objc_add_method_declaration(). (methoddecl): Use objc_typename instead of typename; move semantic actions to objc_build_method_signature(). (optarglist, myxdecls, mydecl, myparms, myparm): Remove nonterminals. (optparmlist): Express in terms of optparms and optellipsis. (optparms, optellipsis, objc_qual, objc_quals, objc_typename): New nonterminals. (keyworddecl): Use objc_typename instead of typename. (rid_to_yy): Mark RID_IN, RID_OUT, RID_INOUT, RID_BYCOPY, RID_BYREF and RID_ONEWAY as returning OBJC_TYPE_QUAL to yyparse(). [gcc/objc/ChangeLog] 2004-09-07 Ziemowit Laski <zlaski@apple.com> * Make-lang.in (objc/objc-parse.o): Depend on $(C_COMMON_H) instead of objc/objc-act.h. (objc/objc-act.o): Depend on $(HASHTAB_H). * objc-act.c: Include hashtab.h; in ObjC++ mode, include cp-tree.h and objcp-decl.h instead of c-tree.h. (build_module_descriptor, get_class_ivars, synth_id_with_class_suffix, error_with_ivar, gen_method_decl, gen_declaration, setup_string_decl, build_protocol_template): Adjust prototypes. (build_module_initializer_routine, start_class, continue_class, finish_class, start_method_def, objc_start_function, start_protocol, build_method_decl, objc_add_method, add_instance_variable, build_ivar_reference, is_ivar, is_private, get_super_receiver, build_selector_table_decl, objc_push_parm, objc_get_parm_info, gen_type_name, gen_type_name_0, start_var_decl, finish_var_decl, create_field_decl): New prototypes. (objc_expand_function_end, comp_method_with_proto, objc_expr_last, gen_declaration_1, gen_declarator, is_complex_decl, adorn_decl, define_decl, create_builtin_decl, gen_declspecs): Remove prototypes. (TYPE_ID): Rename to OBJECT_TYPEDEF_NAME. (CLASS_TYPEDEF_NAME): New. (TAG_EXECCLASS): Change from a global variable to a #define. (TAG_RETURN_STRUCT): Delete. (TAG_GNUINIT): New, holds '__objc_gnu_init' name. (objc_inherit_code, objc_public_flag): New, moved from c-parse.in. (string_descriptor): New struct. (string_htab): New hash table. (string_hash, string_eq): New prototypes. (generate_struct_by_value_array): Call create_field_decl() instead of create_builtin_decl(). (objc_init): Do not initialize objc_ellipsis_node or TAG_EXECCLASS; In ObjC++ mode, call cxx_init() instead of c_objc_common_init(). (objc_finish_file): In ObjC++, call instantiate_pending_templates() and cp_finish_file(). (define_decl, get_static_reference, get_protocol_reference, create_builtin_decl): Remove functions. (objc_start_class_interface, objc_start_category_interface, objc_start_protocol, objc_continue_interface, objc_finish_interface, objc_start_class_implementation, objc_start_category_implementation, objc_continue_implementation, objc_finish_implementation, objc_set_visibility, objc_set_method_type, objc_build_method_signature, objc_add_method_declaration, objc_start_method_definition, objc_add_instance_variable, objc_get_protocol_qualified_type, create_field_decl, start_var_decl, finish_var_decl): New functions. (setup_string_decl): Simplify since it is only called once. (synth_module_prologue): Call build_class_template(); predefine 'id' and 'Class' as typedefs; rename 'temp_type' to 'type'; disable debug hooks for duration of function; fix GNU runtime messenger signatures to correspond to reality; forward-declare '__objc_exec_class' for the GNU runtime; call build_selector_table_decl(); in ObjC++ mode, generate 'extern "C" { ... }' wrappers around synthesized declarations; call build_protocol_template() and build_category_template(). (string_hash, string_eq): New functions. (objc_build_string_object): Check metaclass correctness only once; store string literals in hash table. (objc_build_constructor): Do not convert initializer elements; adjust for ObjC++ impedance mismatch. (build_objc_symtab_template): Call create_field_decl() instead of create_builtin_decl(). (init_objc_symtab): Add missing conversion to initializer element. (build_metadata_decl): Call start_var_decl() instead of define_decl(). (generate_objc_symtab_decl): Do not call build_category_template(); call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(). (build_module_descriptor): Call create_field_decl() instead of grokfield(); call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(); always mark module descriptor as used; move GNU runtime-specific functionality to build_module_initializer_routine(). (build_module_initializer_routine): New function, broken off of build_module_descriptor(). (objc_static_init_needed_p, objc_generate_static_init_call): New functions. (generate_static_references, generate_strings, build_selector_translation_table, generate_descriptor_table, generate_ivars_list, generate_dispatch_table, generate_category): Call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(); build a type directly instead of via groktypename(). (build_selector_reference_decl, build_selector_table_decl, build_class_reference_decl, build_protocol_reference, generate_objc_image_info): Call start_var_decl() instead of build_decl(). (build_selector_reference): For GNU runtime, do not call build_selector_reference_decl(). (build_selector, build_typed_selector_reference): Always convert result to the selector type. (add_objc_string): Cast return value to 'char *'. (build_method_prototype_template, build_selector_template, build_method_template): Use actual selector type for fields pointing to selectors. (finish_objc): For GNU runtime, call build_module_initializer_routine() after build_module_descriptor(). (generate_protocol_list, generate_shared_structures): Call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(); build a type directly instead of via groktypename(). (synth_id_with_class_suffix): Return a string. (get_arg_type_list): For instance methods, use the instance type for 'self'; do not call groktypename_in_parm_context(). (build_objc_string_decl): Squash redeclaration errors in ObjC++. (objc_is_class_name): Use OBJC_TYPE_NAME instead of TYPE_NAME; handle RECORD_TYPEs in ObjC as well as ObjC++. (objc_is_id): New function. (objc_is_object_ptr): Return the canonical type node. (objc_get_class_ivars): Simplify using get_class_ivars(). (get_class_ivars): Remove second parameter; create a fresh copy of the ivar list for each call; do not check for existence of super class. (objc_eh_runtime_type): Mark #ifndef OBJCPLUS. (objc_init_exceptions): When using SJLJ-style exceptions, require the use of '-fobjc-exceptions' flag; do not require it for DWARF-style exceptions. (objc_build_exc_ptr, next_sjlj_build_try_catch_finally): Use objc_object_type instead of objc_id_type. (objc_begin_catch_clause): Convert the incoming PARM_DECL into a VAR_DECL before placing it in the appropriate scope; do not call define_decl(); adjust call to c_begin_compound_stmt(); use objc_object_type instead of objc_id_type. (build_next_objc_exception_stuff): Call create_field_decl() instead of create_builtin_decl(); construct type directly instead of calling groktypename(); use OBJC_VOID_AT_END to mark end of function parameters. (build_private_template): Adjust call to get_class_ivars(); build a type directly instead of via groktypename(). (build_protocol_template, build_method_prototype_list_template, build_method_prototype_template, build_category_template, build_selector_template, build_class_template, build_super_template, build_ivar_template, build_ivar_list_template, build_method_list_template, build_method_template): Call create_field_decl() instead of grokfield(). (objc_method_parm_type): Do not call groktypename(). (generate_descriptor_table): Call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(). (generate_method_descriptors, build_protocol_initializer, generate_dispatch_tables, build_category_initializer, build_shared_structure_initializer): Do not call groktypename(). (generate_protocols): Call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(); do not call groktypename(). (error_with_ivar): Remove last parameter. (check_ivars): Do not iterate ovar CLASS_RAW_IVARS lists in addition to CLASS_IVARS lists; adjust calls to error_with_ivar(). (generate_ivar_lists): Convert one of the initializer elements; do not call groktypename(). (get_arg_type_list, start_method_def, gen_method_def): Account for new representation of variable arguments and '...' in Objective-C methods; add Objective-C++ impedance matching code. (is_objc_type_qualifier): Remove function. (adjust_type_for_id_default): Simplify; there is no longer a need to wade through declspecs. (lookup_interface, start_class, continue_class, finish_class, start_method_def, start_protocol, build_method_decl, objc_add_method, add_instance_variable, build_ivar_reference, is_ivar, is_private, get_super_receiver, objc_build_finally_epilogue): Make into static functions. (receiver_is_class_object): Use new IS_CLASS() macro. (objc_build_message_expr): Tweak ObjC++ message argument handling; call objc_finish_message_expr() instead of finish_message_expr(). (finish_message_expr): Rename to objc_finish_message_expr(); use OBJC_TYPE_NAME and OBJC_SET_TYPE_NAME macros instead of TYPE_NAME. call gen_type_name() instead of gen_declaration(); call objc_is_id() instead of using IS_ID and IS_CLASS; Use objc_class_name instead of calling get_identifier("Class"); handle CONVERT_EXPRs in receiver. (build_objc_method_call, warn_with_method): Do not call groktypename(). (build_ivar_reference): Call convert() instead of clobbering in a type. (hash_init): Initialize string_htab hash table. (add_instance_variable): Simplify parameter list; do not call grokfield(); do not populate CLASS_IVARS list. (start_class): Check for the existence of super class, if one was specified. (continue_class): Use CLASS_RAW_IVARS rather than CLASS_IVARS; do not call build_class_template(); adjust call to get_class_ivars(); call build_decl(), pushdecl() and finish_decl() instead of define_decl(). (finish_class): Call build_decl(), pushdecl() and finish_decl() instead of define_decl(). (add_protocols): Use PROTOCOL_BINFO_ELTS for the tree vector size. (start_protocol): Do not call build_protocol_template(); use PROTOCOL_BINFO_ELTS for the tree vector size. (encode_type_qualifiers): Do not handle the 'const' qualifier here. (encode_pointer): Encode 'const char *' as 'r*', for backwards compatibility. (encode_array): Use HOST_WIDE_INT_PRINT_DEC instead of "%ld". (encode_type): Handle the 'const' qualifier here. (objc_parmlist): New global variable, sued by objc_push_parm and objc_get_parm_info(). (objc_push_parm, objc_get_parm_info): New functions. (objc_expr_last): Remove function. (synth_self_and_ucmd_args): For instance methods, use the instance type for 'self'; call objc_push_parm() instead of push_parm_decl(). (start_method_def): Do not call push_scope(), declare_parm_level(), pop_scope(), push_parm_decl(), store_parm_decls() or objc_expr_last(); just use objc_push_parm() and objc_get_parm_info(). (comp_method_with_proto): Remove function. (objc_types_are_equivalent): Strip away indirections before comparing underlying types. (comp_proto_with_proto): Do not call groktypename(); types are no longer in raw declspec format. (objc_start_function): New function. (really_start_method): Call comp_proto_with_proto() instead of comp_method_with_proto(); call objc_start_function() instead of hand-crafting a function declarator. (continue_method_def, objc_expand_function_end): Remove functions. (get_super_receiver): Call objc_get_current_scope() instead of get_current_scope(); reference 'super_class' field (instead of 'class'). (finish_method_def): Rename to objc_finish_method_definition() and add a function decl parameter; move method encoding call from objc_expand_function_end(). (is_complex_decl, adorn_decl, gen_declarator, gen_declspecs, gen_declaration_1): Remove functions. (tmpbuf, RAW_DECLSPEC): Remove. (gen_declaration): Remove second parameter; simplify to deal with TYPE_P nodes instead of raw declspecs. (gen_type_name, gen_type_name_0): New functions. (gen_method_decl): Remove second parameter; call gen_type_name() instead of gen_declaration_1(). (dump_interface): Adjust calls to gen_declaration() and gen_method_decl(); do not allocate a separate string buffer. (init_objc): Allocate a larger string buffer to accommodate dump_interface(); adjust call to build_module_descriptor(); add call to build_module_initializer_routine() for the GNU runtime. (generate_classref_translation_entry): Do not call start_decl(); call finish_var_decl() instead of finish_decl(); call convert() instead of build_c_cast(). * objc-act.h (CLASS_OWN_IVARS): Remove accessor. (CLASS_BINFO_ELTS): Reduce from 6 to 5, now that CLASS_OWN_IVARS is gone. (OCTI_GNU_INIT_DECL, GNU_INIT_decl): New. (OCTI_ELLIPSIS_NODE, objc_ellipsis_node): Remove. (OCTI_ID_ID, id_type, objc_id_id): Rename to OCTI_ID_NAME, objc_object_type and objc_object_name, respectively. (OCTI_CLS_REF, OCTI_CLASS_NAME, objc_class_reference, objc_class_name): New. (IS_CLASS): New macro. (IS_ID, IS_SUPER): Robustify. (OCTI_EXECCLASS_DECL, execclass_decl): New. (finish_file, start_class, continue_class, finish_class, start_method_def, continue_method_def, finish_method_def, start_protocol, finish_protocol, objc_build_throw_stmt, objc_build_try_catch_finally_stmt, objc_build_synchronized_prologue, objc_build_synchronized_epilogue, objc_build_try_prologue, objc_build_try_epilogue, objc_build_catch_stmt, objc_build_catch_epilogue, objc_build_finally_prologue, objc_build_finally_epilogue, is_ivar, is_private, is_public, add_instance_variable, objc_add_method, get_super_receiver, objc_clear_super_receiver, get_class_ivars_from_name, get_class_reference, get_static_reference, get_object_reference, build_message_expr, finish_message_expr, build_selector_expr, build_ivar_reference, build_keyword_decl, build_method_decl, build_protocol_expr, build_objc_string_object, objc_declare_alias, objc_declare_class, objc_declare_protocols, objc_comptypes, objc_check_decl, build_encode_expr): Remove prototypes. (imp_count, cat_count): Make GGC-aware. (OBJC_SET_TYPE_NAME): New macro. From-SVN: r87168
2004-09-08 02:49:44 +02:00
/* struct _objc_class *isa; */
field_decl = create_field_decl (build_pointer_type
(xref_tag (RECORD_TYPE,
get_identifier (UTAG_CLASS))),
"isa");
field_decl_chain = field_decl;
/* char *protocol_name; */
Makefile.in (c-parse.o): Depend on $(C_COMMON_H). [gcc/ChangeLog] 2004-09-07 Ziemowit Laski <zlaski@apple.com> * Makefile.in (c-parse.o): Depend on $(C_COMMON_H). * c-parse.in: Include c-common.h instead of objc-act.h. (ivar_decl_list, ivar_decls, ivar_decl, ivars, ivar_declarator, myparms, myparm): Remove %type declarations. (methodtype, optparms, OBJC_TYPE_QUAL, objc_quals, objc_qual, objc_typename, objc_try_catch_stmt, optellipsis): Add %type declarations. (objc_inherit_code, objc_public_flag): Remove. (typespec_nonreserved_nonattr): Call objc_get_protocol_qualified_type() instead of get_static_reference() and get_protocol_reference(). (stmt_nocomp): Call grokparm() on @catch parameter. (objcdef): Move semantic action to objc_finish_implementation(). (classdef): Move semantic action to objc_start_class_interface(), objc_continue_interface(), objc_finish_interface(), objc_start_class_implementation(), objc_continue_implementation(), objc_start_category_interface() and objc_start_category_implementation(). (protocoldef): Move semantic actions to objc_start_protocol() and objc_finish_interface(). (ivar_decl_list): Remove nonterminal. (visibility_spec): Move semantic actions to objc_set_visibility(). (ivar_decls): Remove assignment to $$. (ivar_decl): Rephrase in terms of component_decl; call objc_add_instance_variable(). (ivars, ivar_declarator): Remove nonterminals. (opt_semi): New nonterminal. (methodtype): Remove semantic actions. (methoddef): Move semantic actions to objc_set_method_type(), objc_start_method_definition() and objc_finish_method_definition(). (methodproto): Move semantic actions to objc_set_method_type() and objc_add_method_declaration(). (methoddecl): Use objc_typename instead of typename; move semantic actions to objc_build_method_signature(). (optarglist, myxdecls, mydecl, myparms, myparm): Remove nonterminals. (optparmlist): Express in terms of optparms and optellipsis. (optparms, optellipsis, objc_qual, objc_quals, objc_typename): New nonterminals. (keyworddecl): Use objc_typename instead of typename. (rid_to_yy): Mark RID_IN, RID_OUT, RID_INOUT, RID_BYCOPY, RID_BYREF and RID_ONEWAY as returning OBJC_TYPE_QUAL to yyparse(). [gcc/objc/ChangeLog] 2004-09-07 Ziemowit Laski <zlaski@apple.com> * Make-lang.in (objc/objc-parse.o): Depend on $(C_COMMON_H) instead of objc/objc-act.h. (objc/objc-act.o): Depend on $(HASHTAB_H). * objc-act.c: Include hashtab.h; in ObjC++ mode, include cp-tree.h and objcp-decl.h instead of c-tree.h. (build_module_descriptor, get_class_ivars, synth_id_with_class_suffix, error_with_ivar, gen_method_decl, gen_declaration, setup_string_decl, build_protocol_template): Adjust prototypes. (build_module_initializer_routine, start_class, continue_class, finish_class, start_method_def, objc_start_function, start_protocol, build_method_decl, objc_add_method, add_instance_variable, build_ivar_reference, is_ivar, is_private, get_super_receiver, build_selector_table_decl, objc_push_parm, objc_get_parm_info, gen_type_name, gen_type_name_0, start_var_decl, finish_var_decl, create_field_decl): New prototypes. (objc_expand_function_end, comp_method_with_proto, objc_expr_last, gen_declaration_1, gen_declarator, is_complex_decl, adorn_decl, define_decl, create_builtin_decl, gen_declspecs): Remove prototypes. (TYPE_ID): Rename to OBJECT_TYPEDEF_NAME. (CLASS_TYPEDEF_NAME): New. (TAG_EXECCLASS): Change from a global variable to a #define. (TAG_RETURN_STRUCT): Delete. (TAG_GNUINIT): New, holds '__objc_gnu_init' name. (objc_inherit_code, objc_public_flag): New, moved from c-parse.in. (string_descriptor): New struct. (string_htab): New hash table. (string_hash, string_eq): New prototypes. (generate_struct_by_value_array): Call create_field_decl() instead of create_builtin_decl(). (objc_init): Do not initialize objc_ellipsis_node or TAG_EXECCLASS; In ObjC++ mode, call cxx_init() instead of c_objc_common_init(). (objc_finish_file): In ObjC++, call instantiate_pending_templates() and cp_finish_file(). (define_decl, get_static_reference, get_protocol_reference, create_builtin_decl): Remove functions. (objc_start_class_interface, objc_start_category_interface, objc_start_protocol, objc_continue_interface, objc_finish_interface, objc_start_class_implementation, objc_start_category_implementation, objc_continue_implementation, objc_finish_implementation, objc_set_visibility, objc_set_method_type, objc_build_method_signature, objc_add_method_declaration, objc_start_method_definition, objc_add_instance_variable, objc_get_protocol_qualified_type, create_field_decl, start_var_decl, finish_var_decl): New functions. (setup_string_decl): Simplify since it is only called once. (synth_module_prologue): Call build_class_template(); predefine 'id' and 'Class' as typedefs; rename 'temp_type' to 'type'; disable debug hooks for duration of function; fix GNU runtime messenger signatures to correspond to reality; forward-declare '__objc_exec_class' for the GNU runtime; call build_selector_table_decl(); in ObjC++ mode, generate 'extern "C" { ... }' wrappers around synthesized declarations; call build_protocol_template() and build_category_template(). (string_hash, string_eq): New functions. (objc_build_string_object): Check metaclass correctness only once; store string literals in hash table. (objc_build_constructor): Do not convert initializer elements; adjust for ObjC++ impedance mismatch. (build_objc_symtab_template): Call create_field_decl() instead of create_builtin_decl(). (init_objc_symtab): Add missing conversion to initializer element. (build_metadata_decl): Call start_var_decl() instead of define_decl(). (generate_objc_symtab_decl): Do not call build_category_template(); call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(). (build_module_descriptor): Call create_field_decl() instead of grokfield(); call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(); always mark module descriptor as used; move GNU runtime-specific functionality to build_module_initializer_routine(). (build_module_initializer_routine): New function, broken off of build_module_descriptor(). (objc_static_init_needed_p, objc_generate_static_init_call): New functions. (generate_static_references, generate_strings, build_selector_translation_table, generate_descriptor_table, generate_ivars_list, generate_dispatch_table, generate_category): Call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(); build a type directly instead of via groktypename(). (build_selector_reference_decl, build_selector_table_decl, build_class_reference_decl, build_protocol_reference, generate_objc_image_info): Call start_var_decl() instead of build_decl(). (build_selector_reference): For GNU runtime, do not call build_selector_reference_decl(). (build_selector, build_typed_selector_reference): Always convert result to the selector type. (add_objc_string): Cast return value to 'char *'. (build_method_prototype_template, build_selector_template, build_method_template): Use actual selector type for fields pointing to selectors. (finish_objc): For GNU runtime, call build_module_initializer_routine() after build_module_descriptor(). (generate_protocol_list, generate_shared_structures): Call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(); build a type directly instead of via groktypename(). (synth_id_with_class_suffix): Return a string. (get_arg_type_list): For instance methods, use the instance type for 'self'; do not call groktypename_in_parm_context(). (build_objc_string_decl): Squash redeclaration errors in ObjC++. (objc_is_class_name): Use OBJC_TYPE_NAME instead of TYPE_NAME; handle RECORD_TYPEs in ObjC as well as ObjC++. (objc_is_id): New function. (objc_is_object_ptr): Return the canonical type node. (objc_get_class_ivars): Simplify using get_class_ivars(). (get_class_ivars): Remove second parameter; create a fresh copy of the ivar list for each call; do not check for existence of super class. (objc_eh_runtime_type): Mark #ifndef OBJCPLUS. (objc_init_exceptions): When using SJLJ-style exceptions, require the use of '-fobjc-exceptions' flag; do not require it for DWARF-style exceptions. (objc_build_exc_ptr, next_sjlj_build_try_catch_finally): Use objc_object_type instead of objc_id_type. (objc_begin_catch_clause): Convert the incoming PARM_DECL into a VAR_DECL before placing it in the appropriate scope; do not call define_decl(); adjust call to c_begin_compound_stmt(); use objc_object_type instead of objc_id_type. (build_next_objc_exception_stuff): Call create_field_decl() instead of create_builtin_decl(); construct type directly instead of calling groktypename(); use OBJC_VOID_AT_END to mark end of function parameters. (build_private_template): Adjust call to get_class_ivars(); build a type directly instead of via groktypename(). (build_protocol_template, build_method_prototype_list_template, build_method_prototype_template, build_category_template, build_selector_template, build_class_template, build_super_template, build_ivar_template, build_ivar_list_template, build_method_list_template, build_method_template): Call create_field_decl() instead of grokfield(). (objc_method_parm_type): Do not call groktypename(). (generate_descriptor_table): Call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(). (generate_method_descriptors, build_protocol_initializer, generate_dispatch_tables, build_category_initializer, build_shared_structure_initializer): Do not call groktypename(). (generate_protocols): Call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(); do not call groktypename(). (error_with_ivar): Remove last parameter. (check_ivars): Do not iterate ovar CLASS_RAW_IVARS lists in addition to CLASS_IVARS lists; adjust calls to error_with_ivar(). (generate_ivar_lists): Convert one of the initializer elements; do not call groktypename(). (get_arg_type_list, start_method_def, gen_method_def): Account for new representation of variable arguments and '...' in Objective-C methods; add Objective-C++ impedance matching code. (is_objc_type_qualifier): Remove function. (adjust_type_for_id_default): Simplify; there is no longer a need to wade through declspecs. (lookup_interface, start_class, continue_class, finish_class, start_method_def, start_protocol, build_method_decl, objc_add_method, add_instance_variable, build_ivar_reference, is_ivar, is_private, get_super_receiver, objc_build_finally_epilogue): Make into static functions. (receiver_is_class_object): Use new IS_CLASS() macro. (objc_build_message_expr): Tweak ObjC++ message argument handling; call objc_finish_message_expr() instead of finish_message_expr(). (finish_message_expr): Rename to objc_finish_message_expr(); use OBJC_TYPE_NAME and OBJC_SET_TYPE_NAME macros instead of TYPE_NAME. call gen_type_name() instead of gen_declaration(); call objc_is_id() instead of using IS_ID and IS_CLASS; Use objc_class_name instead of calling get_identifier("Class"); handle CONVERT_EXPRs in receiver. (build_objc_method_call, warn_with_method): Do not call groktypename(). (build_ivar_reference): Call convert() instead of clobbering in a type. (hash_init): Initialize string_htab hash table. (add_instance_variable): Simplify parameter list; do not call grokfield(); do not populate CLASS_IVARS list. (start_class): Check for the existence of super class, if one was specified. (continue_class): Use CLASS_RAW_IVARS rather than CLASS_IVARS; do not call build_class_template(); adjust call to get_class_ivars(); call build_decl(), pushdecl() and finish_decl() instead of define_decl(). (finish_class): Call build_decl(), pushdecl() and finish_decl() instead of define_decl(). (add_protocols): Use PROTOCOL_BINFO_ELTS for the tree vector size. (start_protocol): Do not call build_protocol_template(); use PROTOCOL_BINFO_ELTS for the tree vector size. (encode_type_qualifiers): Do not handle the 'const' qualifier here. (encode_pointer): Encode 'const char *' as 'r*', for backwards compatibility. (encode_array): Use HOST_WIDE_INT_PRINT_DEC instead of "%ld". (encode_type): Handle the 'const' qualifier here. (objc_parmlist): New global variable, sued by objc_push_parm and objc_get_parm_info(). (objc_push_parm, objc_get_parm_info): New functions. (objc_expr_last): Remove function. (synth_self_and_ucmd_args): For instance methods, use the instance type for 'self'; call objc_push_parm() instead of push_parm_decl(). (start_method_def): Do not call push_scope(), declare_parm_level(), pop_scope(), push_parm_decl(), store_parm_decls() or objc_expr_last(); just use objc_push_parm() and objc_get_parm_info(). (comp_method_with_proto): Remove function. (objc_types_are_equivalent): Strip away indirections before comparing underlying types. (comp_proto_with_proto): Do not call groktypename(); types are no longer in raw declspec format. (objc_start_function): New function. (really_start_method): Call comp_proto_with_proto() instead of comp_method_with_proto(); call objc_start_function() instead of hand-crafting a function declarator. (continue_method_def, objc_expand_function_end): Remove functions. (get_super_receiver): Call objc_get_current_scope() instead of get_current_scope(); reference 'super_class' field (instead of 'class'). (finish_method_def): Rename to objc_finish_method_definition() and add a function decl parameter; move method encoding call from objc_expand_function_end(). (is_complex_decl, adorn_decl, gen_declarator, gen_declspecs, gen_declaration_1): Remove functions. (tmpbuf, RAW_DECLSPEC): Remove. (gen_declaration): Remove second parameter; simplify to deal with TYPE_P nodes instead of raw declspecs. (gen_type_name, gen_type_name_0): New functions. (gen_method_decl): Remove second parameter; call gen_type_name() instead of gen_declaration_1(). (dump_interface): Adjust calls to gen_declaration() and gen_method_decl(); do not allocate a separate string buffer. (init_objc): Allocate a larger string buffer to accommodate dump_interface(); adjust call to build_module_descriptor(); add call to build_module_initializer_routine() for the GNU runtime. (generate_classref_translation_entry): Do not call start_decl(); call finish_var_decl() instead of finish_decl(); call convert() instead of build_c_cast(). * objc-act.h (CLASS_OWN_IVARS): Remove accessor. (CLASS_BINFO_ELTS): Reduce from 6 to 5, now that CLASS_OWN_IVARS is gone. (OCTI_GNU_INIT_DECL, GNU_INIT_decl): New. (OCTI_ELLIPSIS_NODE, objc_ellipsis_node): Remove. (OCTI_ID_ID, id_type, objc_id_id): Rename to OCTI_ID_NAME, objc_object_type and objc_object_name, respectively. (OCTI_CLS_REF, OCTI_CLASS_NAME, objc_class_reference, objc_class_name): New. (IS_CLASS): New macro. (IS_ID, IS_SUPER): Robustify. (OCTI_EXECCLASS_DECL, execclass_decl): New. (finish_file, start_class, continue_class, finish_class, start_method_def, continue_method_def, finish_method_def, start_protocol, finish_protocol, objc_build_throw_stmt, objc_build_try_catch_finally_stmt, objc_build_synchronized_prologue, objc_build_synchronized_epilogue, objc_build_try_prologue, objc_build_try_epilogue, objc_build_catch_stmt, objc_build_catch_epilogue, objc_build_finally_prologue, objc_build_finally_epilogue, is_ivar, is_private, is_public, add_instance_variable, objc_add_method, get_super_receiver, objc_clear_super_receiver, get_class_ivars_from_name, get_class_reference, get_static_reference, get_object_reference, build_message_expr, finish_message_expr, build_selector_expr, build_ivar_reference, build_keyword_decl, build_method_decl, build_protocol_expr, build_objc_string_object, objc_declare_alias, objc_declare_class, objc_declare_protocols, objc_comptypes, objc_check_decl, build_encode_expr): Remove prototypes. (imp_count, cat_count): Make GGC-aware. (OBJC_SET_TYPE_NAME): New macro. From-SVN: r87168
2004-09-08 02:49:44 +02:00
field_decl = create_field_decl (string_type_node, "protocol_name");
chainon (field_decl_chain, field_decl);
Makefile.in (c-parse.o): Depend on $(C_COMMON_H). [gcc/ChangeLog] 2004-09-07 Ziemowit Laski <zlaski@apple.com> * Makefile.in (c-parse.o): Depend on $(C_COMMON_H). * c-parse.in: Include c-common.h instead of objc-act.h. (ivar_decl_list, ivar_decls, ivar_decl, ivars, ivar_declarator, myparms, myparm): Remove %type declarations. (methodtype, optparms, OBJC_TYPE_QUAL, objc_quals, objc_qual, objc_typename, objc_try_catch_stmt, optellipsis): Add %type declarations. (objc_inherit_code, objc_public_flag): Remove. (typespec_nonreserved_nonattr): Call objc_get_protocol_qualified_type() instead of get_static_reference() and get_protocol_reference(). (stmt_nocomp): Call grokparm() on @catch parameter. (objcdef): Move semantic action to objc_finish_implementation(). (classdef): Move semantic action to objc_start_class_interface(), objc_continue_interface(), objc_finish_interface(), objc_start_class_implementation(), objc_continue_implementation(), objc_start_category_interface() and objc_start_category_implementation(). (protocoldef): Move semantic actions to objc_start_protocol() and objc_finish_interface(). (ivar_decl_list): Remove nonterminal. (visibility_spec): Move semantic actions to objc_set_visibility(). (ivar_decls): Remove assignment to $$. (ivar_decl): Rephrase in terms of component_decl; call objc_add_instance_variable(). (ivars, ivar_declarator): Remove nonterminals. (opt_semi): New nonterminal. (methodtype): Remove semantic actions. (methoddef): Move semantic actions to objc_set_method_type(), objc_start_method_definition() and objc_finish_method_definition(). (methodproto): Move semantic actions to objc_set_method_type() and objc_add_method_declaration(). (methoddecl): Use objc_typename instead of typename; move semantic actions to objc_build_method_signature(). (optarglist, myxdecls, mydecl, myparms, myparm): Remove nonterminals. (optparmlist): Express in terms of optparms and optellipsis. (optparms, optellipsis, objc_qual, objc_quals, objc_typename): New nonterminals. (keyworddecl): Use objc_typename instead of typename. (rid_to_yy): Mark RID_IN, RID_OUT, RID_INOUT, RID_BYCOPY, RID_BYREF and RID_ONEWAY as returning OBJC_TYPE_QUAL to yyparse(). [gcc/objc/ChangeLog] 2004-09-07 Ziemowit Laski <zlaski@apple.com> * Make-lang.in (objc/objc-parse.o): Depend on $(C_COMMON_H) instead of objc/objc-act.h. (objc/objc-act.o): Depend on $(HASHTAB_H). * objc-act.c: Include hashtab.h; in ObjC++ mode, include cp-tree.h and objcp-decl.h instead of c-tree.h. (build_module_descriptor, get_class_ivars, synth_id_with_class_suffix, error_with_ivar, gen_method_decl, gen_declaration, setup_string_decl, build_protocol_template): Adjust prototypes. (build_module_initializer_routine, start_class, continue_class, finish_class, start_method_def, objc_start_function, start_protocol, build_method_decl, objc_add_method, add_instance_variable, build_ivar_reference, is_ivar, is_private, get_super_receiver, build_selector_table_decl, objc_push_parm, objc_get_parm_info, gen_type_name, gen_type_name_0, start_var_decl, finish_var_decl, create_field_decl): New prototypes. (objc_expand_function_end, comp_method_with_proto, objc_expr_last, gen_declaration_1, gen_declarator, is_complex_decl, adorn_decl, define_decl, create_builtin_decl, gen_declspecs): Remove prototypes. (TYPE_ID): Rename to OBJECT_TYPEDEF_NAME. (CLASS_TYPEDEF_NAME): New. (TAG_EXECCLASS): Change from a global variable to a #define. (TAG_RETURN_STRUCT): Delete. (TAG_GNUINIT): New, holds '__objc_gnu_init' name. (objc_inherit_code, objc_public_flag): New, moved from c-parse.in. (string_descriptor): New struct. (string_htab): New hash table. (string_hash, string_eq): New prototypes. (generate_struct_by_value_array): Call create_field_decl() instead of create_builtin_decl(). (objc_init): Do not initialize objc_ellipsis_node or TAG_EXECCLASS; In ObjC++ mode, call cxx_init() instead of c_objc_common_init(). (objc_finish_file): In ObjC++, call instantiate_pending_templates() and cp_finish_file(). (define_decl, get_static_reference, get_protocol_reference, create_builtin_decl): Remove functions. (objc_start_class_interface, objc_start_category_interface, objc_start_protocol, objc_continue_interface, objc_finish_interface, objc_start_class_implementation, objc_start_category_implementation, objc_continue_implementation, objc_finish_implementation, objc_set_visibility, objc_set_method_type, objc_build_method_signature, objc_add_method_declaration, objc_start_method_definition, objc_add_instance_variable, objc_get_protocol_qualified_type, create_field_decl, start_var_decl, finish_var_decl): New functions. (setup_string_decl): Simplify since it is only called once. (synth_module_prologue): Call build_class_template(); predefine 'id' and 'Class' as typedefs; rename 'temp_type' to 'type'; disable debug hooks for duration of function; fix GNU runtime messenger signatures to correspond to reality; forward-declare '__objc_exec_class' for the GNU runtime; call build_selector_table_decl(); in ObjC++ mode, generate 'extern "C" { ... }' wrappers around synthesized declarations; call build_protocol_template() and build_category_template(). (string_hash, string_eq): New functions. (objc_build_string_object): Check metaclass correctness only once; store string literals in hash table. (objc_build_constructor): Do not convert initializer elements; adjust for ObjC++ impedance mismatch. (build_objc_symtab_template): Call create_field_decl() instead of create_builtin_decl(). (init_objc_symtab): Add missing conversion to initializer element. (build_metadata_decl): Call start_var_decl() instead of define_decl(). (generate_objc_symtab_decl): Do not call build_category_template(); call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(). (build_module_descriptor): Call create_field_decl() instead of grokfield(); call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(); always mark module descriptor as used; move GNU runtime-specific functionality to build_module_initializer_routine(). (build_module_initializer_routine): New function, broken off of build_module_descriptor(). (objc_static_init_needed_p, objc_generate_static_init_call): New functions. (generate_static_references, generate_strings, build_selector_translation_table, generate_descriptor_table, generate_ivars_list, generate_dispatch_table, generate_category): Call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(); build a type directly instead of via groktypename(). (build_selector_reference_decl, build_selector_table_decl, build_class_reference_decl, build_protocol_reference, generate_objc_image_info): Call start_var_decl() instead of build_decl(). (build_selector_reference): For GNU runtime, do not call build_selector_reference_decl(). (build_selector, build_typed_selector_reference): Always convert result to the selector type. (add_objc_string): Cast return value to 'char *'. (build_method_prototype_template, build_selector_template, build_method_template): Use actual selector type for fields pointing to selectors. (finish_objc): For GNU runtime, call build_module_initializer_routine() after build_module_descriptor(). (generate_protocol_list, generate_shared_structures): Call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(); build a type directly instead of via groktypename(). (synth_id_with_class_suffix): Return a string. (get_arg_type_list): For instance methods, use the instance type for 'self'; do not call groktypename_in_parm_context(). (build_objc_string_decl): Squash redeclaration errors in ObjC++. (objc_is_class_name): Use OBJC_TYPE_NAME instead of TYPE_NAME; handle RECORD_TYPEs in ObjC as well as ObjC++. (objc_is_id): New function. (objc_is_object_ptr): Return the canonical type node. (objc_get_class_ivars): Simplify using get_class_ivars(). (get_class_ivars): Remove second parameter; create a fresh copy of the ivar list for each call; do not check for existence of super class. (objc_eh_runtime_type): Mark #ifndef OBJCPLUS. (objc_init_exceptions): When using SJLJ-style exceptions, require the use of '-fobjc-exceptions' flag; do not require it for DWARF-style exceptions. (objc_build_exc_ptr, next_sjlj_build_try_catch_finally): Use objc_object_type instead of objc_id_type. (objc_begin_catch_clause): Convert the incoming PARM_DECL into a VAR_DECL before placing it in the appropriate scope; do not call define_decl(); adjust call to c_begin_compound_stmt(); use objc_object_type instead of objc_id_type. (build_next_objc_exception_stuff): Call create_field_decl() instead of create_builtin_decl(); construct type directly instead of calling groktypename(); use OBJC_VOID_AT_END to mark end of function parameters. (build_private_template): Adjust call to get_class_ivars(); build a type directly instead of via groktypename(). (build_protocol_template, build_method_prototype_list_template, build_method_prototype_template, build_category_template, build_selector_template, build_class_template, build_super_template, build_ivar_template, build_ivar_list_template, build_method_list_template, build_method_template): Call create_field_decl() instead of grokfield(). (objc_method_parm_type): Do not call groktypename(). (generate_descriptor_table): Call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(). (generate_method_descriptors, build_protocol_initializer, generate_dispatch_tables, build_category_initializer, build_shared_structure_initializer): Do not call groktypename(). (generate_protocols): Call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(); do not call groktypename(). (error_with_ivar): Remove last parameter. (check_ivars): Do not iterate ovar CLASS_RAW_IVARS lists in addition to CLASS_IVARS lists; adjust calls to error_with_ivar(). (generate_ivar_lists): Convert one of the initializer elements; do not call groktypename(). (get_arg_type_list, start_method_def, gen_method_def): Account for new representation of variable arguments and '...' in Objective-C methods; add Objective-C++ impedance matching code. (is_objc_type_qualifier): Remove function. (adjust_type_for_id_default): Simplify; there is no longer a need to wade through declspecs. (lookup_interface, start_class, continue_class, finish_class, start_method_def, start_protocol, build_method_decl, objc_add_method, add_instance_variable, build_ivar_reference, is_ivar, is_private, get_super_receiver, objc_build_finally_epilogue): Make into static functions. (receiver_is_class_object): Use new IS_CLASS() macro. (objc_build_message_expr): Tweak ObjC++ message argument handling; call objc_finish_message_expr() instead of finish_message_expr(). (finish_message_expr): Rename to objc_finish_message_expr(); use OBJC_TYPE_NAME and OBJC_SET_TYPE_NAME macros instead of TYPE_NAME. call gen_type_name() instead of gen_declaration(); call objc_is_id() instead of using IS_ID and IS_CLASS; Use objc_class_name instead of calling get_identifier("Class"); handle CONVERT_EXPRs in receiver. (build_objc_method_call, warn_with_method): Do not call groktypename(). (build_ivar_reference): Call convert() instead of clobbering in a type. (hash_init): Initialize string_htab hash table. (add_instance_variable): Simplify parameter list; do not call grokfield(); do not populate CLASS_IVARS list. (start_class): Check for the existence of super class, if one was specified. (continue_class): Use CLASS_RAW_IVARS rather than CLASS_IVARS; do not call build_class_template(); adjust call to get_class_ivars(); call build_decl(), pushdecl() and finish_decl() instead of define_decl(). (finish_class): Call build_decl(), pushdecl() and finish_decl() instead of define_decl(). (add_protocols): Use PROTOCOL_BINFO_ELTS for the tree vector size. (start_protocol): Do not call build_protocol_template(); use PROTOCOL_BINFO_ELTS for the tree vector size. (encode_type_qualifiers): Do not handle the 'const' qualifier here. (encode_pointer): Encode 'const char *' as 'r*', for backwards compatibility. (encode_array): Use HOST_WIDE_INT_PRINT_DEC instead of "%ld". (encode_type): Handle the 'const' qualifier here. (objc_parmlist): New global variable, sued by objc_push_parm and objc_get_parm_info(). (objc_push_parm, objc_get_parm_info): New functions. (objc_expr_last): Remove function. (synth_self_and_ucmd_args): For instance methods, use the instance type for 'self'; call objc_push_parm() instead of push_parm_decl(). (start_method_def): Do not call push_scope(), declare_parm_level(), pop_scope(), push_parm_decl(), store_parm_decls() or objc_expr_last(); just use objc_push_parm() and objc_get_parm_info(). (comp_method_with_proto): Remove function. (objc_types_are_equivalent): Strip away indirections before comparing underlying types. (comp_proto_with_proto): Do not call groktypename(); types are no longer in raw declspec format. (objc_start_function): New function. (really_start_method): Call comp_proto_with_proto() instead of comp_method_with_proto(); call objc_start_function() instead of hand-crafting a function declarator. (continue_method_def, objc_expand_function_end): Remove functions. (get_super_receiver): Call objc_get_current_scope() instead of get_current_scope(); reference 'super_class' field (instead of 'class'). (finish_method_def): Rename to objc_finish_method_definition() and add a function decl parameter; move method encoding call from objc_expand_function_end(). (is_complex_decl, adorn_decl, gen_declarator, gen_declspecs, gen_declaration_1): Remove functions. (tmpbuf, RAW_DECLSPEC): Remove. (gen_declaration): Remove second parameter; simplify to deal with TYPE_P nodes instead of raw declspecs. (gen_type_name, gen_type_name_0): New functions. (gen_method_decl): Remove second parameter; call gen_type_name() instead of gen_declaration_1(). (dump_interface): Adjust calls to gen_declaration() and gen_method_decl(); do not allocate a separate string buffer. (init_objc): Allocate a larger string buffer to accommodate dump_interface(); adjust call to build_module_descriptor(); add call to build_module_initializer_routine() for the GNU runtime. (generate_classref_translation_entry): Do not call start_decl(); call finish_var_decl() instead of finish_decl(); call convert() instead of build_c_cast(). * objc-act.h (CLASS_OWN_IVARS): Remove accessor. (CLASS_BINFO_ELTS): Reduce from 6 to 5, now that CLASS_OWN_IVARS is gone. (OCTI_GNU_INIT_DECL, GNU_INIT_decl): New. (OCTI_ELLIPSIS_NODE, objc_ellipsis_node): Remove. (OCTI_ID_ID, id_type, objc_id_id): Rename to OCTI_ID_NAME, objc_object_type and objc_object_name, respectively. (OCTI_CLS_REF, OCTI_CLASS_NAME, objc_class_reference, objc_class_name): New. (IS_CLASS): New macro. (IS_ID, IS_SUPER): Robustify. (OCTI_EXECCLASS_DECL, execclass_decl): New. (finish_file, start_class, continue_class, finish_class, start_method_def, continue_method_def, finish_method_def, start_protocol, finish_protocol, objc_build_throw_stmt, objc_build_try_catch_finally_stmt, objc_build_synchronized_prologue, objc_build_synchronized_epilogue, objc_build_try_prologue, objc_build_try_epilogue, objc_build_catch_stmt, objc_build_catch_epilogue, objc_build_finally_prologue, objc_build_finally_epilogue, is_ivar, is_private, is_public, add_instance_variable, objc_add_method, get_super_receiver, objc_clear_super_receiver, get_class_ivars_from_name, get_class_reference, get_static_reference, get_object_reference, build_message_expr, finish_message_expr, build_selector_expr, build_ivar_reference, build_keyword_decl, build_method_decl, build_protocol_expr, build_objc_string_object, objc_declare_alias, objc_declare_class, objc_declare_protocols, objc_comptypes, objc_check_decl, build_encode_expr): Remove prototypes. (imp_count, cat_count): Make GGC-aware. (OBJC_SET_TYPE_NAME): New macro. From-SVN: r87168
2004-09-08 02:49:44 +02:00
/* struct _objc_protocol **protocol_list; */
field_decl = create_field_decl (build_pointer_type
(build_pointer_type
(objc_protocol_template)),
"protocol_list");
chainon (field_decl_chain, field_decl);
Yet more Objective-C++... * objc-act.c (objc_finish_try_stmt): Add return value. (objc_build_synchronized): Likewise. * objc-act.c (objc_is_gcable_type): Add. (objc_substitute_decl): Add. (objc_build_ivar_assignment): Add. (objc_build_global_assignment): Add. (objc_build_strong_cast_assignment): Add. (objc_is_ivar_reference_p): Add. (objc_is_global_reference_p): Add. (objc_generate_write_barrier): Add. (objc_rewrite_function_call): Add. (objc_gimplify_expr): Add Objective-C++ support. * objc-act.h (ALLOC_OBJC_TYPE_LANG_SPECIFIC): Likewise. (SIZEOF_OBJC_TYPE_LANG_SPECIFIC): Add. (INIT_TYPE_OBJC_INFO): Add Objective-C++ support. (DUP_TYPE_OBJC_INFO): Likewise. (struct imp_entry): Add field has_cxx_cdtors. (struct imp_entry *imp_list): Add OCTI_UMSG_FAST_DECL, OCTI_METH_LIST_TEMPL, OCTI_METH_PROTO_LIST_TEMPL, OCTI_IVAR_LIST_TEMPL, OCTI_ASSIGN_IVAR_DECL, OCTI_ASSIGN_IVAR_FAST_DECL, OCTI_ASSIGN_GLOBAL_DECL, OCTI_ASSIGN_STRONGCAST_DECL. (umsg_fast_decl): Add. (objc_assign_ivar_decl): Add. (objc_assign_ivar_fast_decl): Add. (objc_assign_global_decl): Add. (objc_assign_strong_cast_decl): Add. (objc_method_list_ptr): Add. (objc_method_proto_list_ptr): Add. (objc_ivar_list_ptr): Add. * objc-act.c (should_call_super_dealloc): Add. (OBJC_VERSION): Bump to 6. (objc_is_gcable_type): Add. (objc_substitute_decl): Add. (objc_build_ivar_assignment): Add. (objc_build_global_assignment): Add. (objc_build_strong_cast_assignment): Add. (objc_is_gcable_p): Add. (objc_is_ivar_reference_p): Add. (objc_is_global_reference_p): Add. (generate_shared_structures): Add flags parameter. (objc_generate_cxx_ctor_or_dtor): Add. (objc_generate_cxx_cdtors): Add. (add_class): Add name parameter. (objc_types_share_size_and_alignment): Add. (comp_proto_with_proto): Add strict parameter. (CLS_HAS_CXX_STRUCTORS): Add. (TAG_ASSIGNIVAR): Add. (TAG_ASSIGNGLOBAL): Add. (TAG_ASSIGNSTRONGCAST): Add. (TAG_MSGSEND_FAST): Add. (TAG_ASSIGNIVAR_FAST): Add. (TAG_CXX_CONSTRUCT): Add. (TAG_CXX_DESTRUCT): Add. (OBJC_LOOKUP_CLASS): Add. (OBJC_LOOKUP_NO_SUPER): Add. (objc_finish_file): Add pch support. (objc_finish_implementation): Add Objective-C++ support. (synth_module_prologue): Likewise. (synth_module_prologue): Add fast dispatching. (objc_get_class_reference): Add Objective-C++ support. (objc_generate_write_barrier): Likewise. (next_sjlj_build_enter_and_setjmp): Likewise. (objc_begin_try_stmt): Likewise. (build_next_objc_exception_stuff): Add fast ivar support. (build_private_template): Mark the record as used so debug information is generated. (build_protocol_template): Add Objective-C++ support. (objc_method_parm_type) Likewise. (objc_generate_cxx_ctor_or_dtor): Likewise. (objc_generate_cxx_cdtors): Likewise. (build_protocol_initializer): Likewise. (build_category_template): Likewise. (build_class_template): Likewise. (build_method_list_template): Likewise. (build_category_initializer): Likewise. (build_shared_structure_initializer): Likewise. (objc_finish_message_expr): Likewise. (build_objc_method_call): Add fast dispatch support. (lookup_method_static): Add support to end search at superclasses. (add_method_to_hash_list): Add strict parameter to comp_proto_with_proto. (objc_add_method): Likewise. (objc_add_method): Also set the interface_value. (add_instance_variable): Add Objective-C++ support. (objc_is_public): Likewise. (start_class): Likewise. (continue_class): Likewise. (encode_aggregate_within): Likewise. (start_method_def): Likewise. (objc_start_function): Clear current_function_returns_value and current_function_returns_null. (really_start_method): Add Objective-C++ support. (objc_finish_method_definition): Add warning for missing [super dealloc]. (finish_objc): Add Objective-C++ support. (generate_objc_image_info): Likewise. (objc_lookup_ivar): Likewise. * objc-act.h (TYPE_HAS_OBJC_INFO): Likewise. (INIT_TYPE_OBJC_INFO): Likewise. (DUP_TYPE_OBJC_INFO): Likewise. From-SVN: r99857
2005-05-17 22:07:08 +02:00
/* struct _objc__method_prototype_list *instance_methods; */
field_decl = create_field_decl (objc_method_proto_list_ptr,
Makefile.in (c-parse.o): Depend on $(C_COMMON_H). [gcc/ChangeLog] 2004-09-07 Ziemowit Laski <zlaski@apple.com> * Makefile.in (c-parse.o): Depend on $(C_COMMON_H). * c-parse.in: Include c-common.h instead of objc-act.h. (ivar_decl_list, ivar_decls, ivar_decl, ivars, ivar_declarator, myparms, myparm): Remove %type declarations. (methodtype, optparms, OBJC_TYPE_QUAL, objc_quals, objc_qual, objc_typename, objc_try_catch_stmt, optellipsis): Add %type declarations. (objc_inherit_code, objc_public_flag): Remove. (typespec_nonreserved_nonattr): Call objc_get_protocol_qualified_type() instead of get_static_reference() and get_protocol_reference(). (stmt_nocomp): Call grokparm() on @catch parameter. (objcdef): Move semantic action to objc_finish_implementation(). (classdef): Move semantic action to objc_start_class_interface(), objc_continue_interface(), objc_finish_interface(), objc_start_class_implementation(), objc_continue_implementation(), objc_start_category_interface() and objc_start_category_implementation(). (protocoldef): Move semantic actions to objc_start_protocol() and objc_finish_interface(). (ivar_decl_list): Remove nonterminal. (visibility_spec): Move semantic actions to objc_set_visibility(). (ivar_decls): Remove assignment to $$. (ivar_decl): Rephrase in terms of component_decl; call objc_add_instance_variable(). (ivars, ivar_declarator): Remove nonterminals. (opt_semi): New nonterminal. (methodtype): Remove semantic actions. (methoddef): Move semantic actions to objc_set_method_type(), objc_start_method_definition() and objc_finish_method_definition(). (methodproto): Move semantic actions to objc_set_method_type() and objc_add_method_declaration(). (methoddecl): Use objc_typename instead of typename; move semantic actions to objc_build_method_signature(). (optarglist, myxdecls, mydecl, myparms, myparm): Remove nonterminals. (optparmlist): Express in terms of optparms and optellipsis. (optparms, optellipsis, objc_qual, objc_quals, objc_typename): New nonterminals. (keyworddecl): Use objc_typename instead of typename. (rid_to_yy): Mark RID_IN, RID_OUT, RID_INOUT, RID_BYCOPY, RID_BYREF and RID_ONEWAY as returning OBJC_TYPE_QUAL to yyparse(). [gcc/objc/ChangeLog] 2004-09-07 Ziemowit Laski <zlaski@apple.com> * Make-lang.in (objc/objc-parse.o): Depend on $(C_COMMON_H) instead of objc/objc-act.h. (objc/objc-act.o): Depend on $(HASHTAB_H). * objc-act.c: Include hashtab.h; in ObjC++ mode, include cp-tree.h and objcp-decl.h instead of c-tree.h. (build_module_descriptor, get_class_ivars, synth_id_with_class_suffix, error_with_ivar, gen_method_decl, gen_declaration, setup_string_decl, build_protocol_template): Adjust prototypes. (build_module_initializer_routine, start_class, continue_class, finish_class, start_method_def, objc_start_function, start_protocol, build_method_decl, objc_add_method, add_instance_variable, build_ivar_reference, is_ivar, is_private, get_super_receiver, build_selector_table_decl, objc_push_parm, objc_get_parm_info, gen_type_name, gen_type_name_0, start_var_decl, finish_var_decl, create_field_decl): New prototypes. (objc_expand_function_end, comp_method_with_proto, objc_expr_last, gen_declaration_1, gen_declarator, is_complex_decl, adorn_decl, define_decl, create_builtin_decl, gen_declspecs): Remove prototypes. (TYPE_ID): Rename to OBJECT_TYPEDEF_NAME. (CLASS_TYPEDEF_NAME): New. (TAG_EXECCLASS): Change from a global variable to a #define. (TAG_RETURN_STRUCT): Delete. (TAG_GNUINIT): New, holds '__objc_gnu_init' name. (objc_inherit_code, objc_public_flag): New, moved from c-parse.in. (string_descriptor): New struct. (string_htab): New hash table. (string_hash, string_eq): New prototypes. (generate_struct_by_value_array): Call create_field_decl() instead of create_builtin_decl(). (objc_init): Do not initialize objc_ellipsis_node or TAG_EXECCLASS; In ObjC++ mode, call cxx_init() instead of c_objc_common_init(). (objc_finish_file): In ObjC++, call instantiate_pending_templates() and cp_finish_file(). (define_decl, get_static_reference, get_protocol_reference, create_builtin_decl): Remove functions. (objc_start_class_interface, objc_start_category_interface, objc_start_protocol, objc_continue_interface, objc_finish_interface, objc_start_class_implementation, objc_start_category_implementation, objc_continue_implementation, objc_finish_implementation, objc_set_visibility, objc_set_method_type, objc_build_method_signature, objc_add_method_declaration, objc_start_method_definition, objc_add_instance_variable, objc_get_protocol_qualified_type, create_field_decl, start_var_decl, finish_var_decl): New functions. (setup_string_decl): Simplify since it is only called once. (synth_module_prologue): Call build_class_template(); predefine 'id' and 'Class' as typedefs; rename 'temp_type' to 'type'; disable debug hooks for duration of function; fix GNU runtime messenger signatures to correspond to reality; forward-declare '__objc_exec_class' for the GNU runtime; call build_selector_table_decl(); in ObjC++ mode, generate 'extern "C" { ... }' wrappers around synthesized declarations; call build_protocol_template() and build_category_template(). (string_hash, string_eq): New functions. (objc_build_string_object): Check metaclass correctness only once; store string literals in hash table. (objc_build_constructor): Do not convert initializer elements; adjust for ObjC++ impedance mismatch. (build_objc_symtab_template): Call create_field_decl() instead of create_builtin_decl(). (init_objc_symtab): Add missing conversion to initializer element. (build_metadata_decl): Call start_var_decl() instead of define_decl(). (generate_objc_symtab_decl): Do not call build_category_template(); call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(). (build_module_descriptor): Call create_field_decl() instead of grokfield(); call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(); always mark module descriptor as used; move GNU runtime-specific functionality to build_module_initializer_routine(). (build_module_initializer_routine): New function, broken off of build_module_descriptor(). (objc_static_init_needed_p, objc_generate_static_init_call): New functions. (generate_static_references, generate_strings, build_selector_translation_table, generate_descriptor_table, generate_ivars_list, generate_dispatch_table, generate_category): Call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(); build a type directly instead of via groktypename(). (build_selector_reference_decl, build_selector_table_decl, build_class_reference_decl, build_protocol_reference, generate_objc_image_info): Call start_var_decl() instead of build_decl(). (build_selector_reference): For GNU runtime, do not call build_selector_reference_decl(). (build_selector, build_typed_selector_reference): Always convert result to the selector type. (add_objc_string): Cast return value to 'char *'. (build_method_prototype_template, build_selector_template, build_method_template): Use actual selector type for fields pointing to selectors. (finish_objc): For GNU runtime, call build_module_initializer_routine() after build_module_descriptor(). (generate_protocol_list, generate_shared_structures): Call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(); build a type directly instead of via groktypename(). (synth_id_with_class_suffix): Return a string. (get_arg_type_list): For instance methods, use the instance type for 'self'; do not call groktypename_in_parm_context(). (build_objc_string_decl): Squash redeclaration errors in ObjC++. (objc_is_class_name): Use OBJC_TYPE_NAME instead of TYPE_NAME; handle RECORD_TYPEs in ObjC as well as ObjC++. (objc_is_id): New function. (objc_is_object_ptr): Return the canonical type node. (objc_get_class_ivars): Simplify using get_class_ivars(). (get_class_ivars): Remove second parameter; create a fresh copy of the ivar list for each call; do not check for existence of super class. (objc_eh_runtime_type): Mark #ifndef OBJCPLUS. (objc_init_exceptions): When using SJLJ-style exceptions, require the use of '-fobjc-exceptions' flag; do not require it for DWARF-style exceptions. (objc_build_exc_ptr, next_sjlj_build_try_catch_finally): Use objc_object_type instead of objc_id_type. (objc_begin_catch_clause): Convert the incoming PARM_DECL into a VAR_DECL before placing it in the appropriate scope; do not call define_decl(); adjust call to c_begin_compound_stmt(); use objc_object_type instead of objc_id_type. (build_next_objc_exception_stuff): Call create_field_decl() instead of create_builtin_decl(); construct type directly instead of calling groktypename(); use OBJC_VOID_AT_END to mark end of function parameters. (build_private_template): Adjust call to get_class_ivars(); build a type directly instead of via groktypename(). (build_protocol_template, build_method_prototype_list_template, build_method_prototype_template, build_category_template, build_selector_template, build_class_template, build_super_template, build_ivar_template, build_ivar_list_template, build_method_list_template, build_method_template): Call create_field_decl() instead of grokfield(). (objc_method_parm_type): Do not call groktypename(). (generate_descriptor_table): Call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(). (generate_method_descriptors, build_protocol_initializer, generate_dispatch_tables, build_category_initializer, build_shared_structure_initializer): Do not call groktypename(). (generate_protocols): Call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(); do not call groktypename(). (error_with_ivar): Remove last parameter. (check_ivars): Do not iterate ovar CLASS_RAW_IVARS lists in addition to CLASS_IVARS lists; adjust calls to error_with_ivar(). (generate_ivar_lists): Convert one of the initializer elements; do not call groktypename(). (get_arg_type_list, start_method_def, gen_method_def): Account for new representation of variable arguments and '...' in Objective-C methods; add Objective-C++ impedance matching code. (is_objc_type_qualifier): Remove function. (adjust_type_for_id_default): Simplify; there is no longer a need to wade through declspecs. (lookup_interface, start_class, continue_class, finish_class, start_method_def, start_protocol, build_method_decl, objc_add_method, add_instance_variable, build_ivar_reference, is_ivar, is_private, get_super_receiver, objc_build_finally_epilogue): Make into static functions. (receiver_is_class_object): Use new IS_CLASS() macro. (objc_build_message_expr): Tweak ObjC++ message argument handling; call objc_finish_message_expr() instead of finish_message_expr(). (finish_message_expr): Rename to objc_finish_message_expr(); use OBJC_TYPE_NAME and OBJC_SET_TYPE_NAME macros instead of TYPE_NAME. call gen_type_name() instead of gen_declaration(); call objc_is_id() instead of using IS_ID and IS_CLASS; Use objc_class_name instead of calling get_identifier("Class"); handle CONVERT_EXPRs in receiver. (build_objc_method_call, warn_with_method): Do not call groktypename(). (build_ivar_reference): Call convert() instead of clobbering in a type. (hash_init): Initialize string_htab hash table. (add_instance_variable): Simplify parameter list; do not call grokfield(); do not populate CLASS_IVARS list. (start_class): Check for the existence of super class, if one was specified. (continue_class): Use CLASS_RAW_IVARS rather than CLASS_IVARS; do not call build_class_template(); adjust call to get_class_ivars(); call build_decl(), pushdecl() and finish_decl() instead of define_decl(). (finish_class): Call build_decl(), pushdecl() and finish_decl() instead of define_decl(). (add_protocols): Use PROTOCOL_BINFO_ELTS for the tree vector size. (start_protocol): Do not call build_protocol_template(); use PROTOCOL_BINFO_ELTS for the tree vector size. (encode_type_qualifiers): Do not handle the 'const' qualifier here. (encode_pointer): Encode 'const char *' as 'r*', for backwards compatibility. (encode_array): Use HOST_WIDE_INT_PRINT_DEC instead of "%ld". (encode_type): Handle the 'const' qualifier here. (objc_parmlist): New global variable, sued by objc_push_parm and objc_get_parm_info(). (objc_push_parm, objc_get_parm_info): New functions. (objc_expr_last): Remove function. (synth_self_and_ucmd_args): For instance methods, use the instance type for 'self'; call objc_push_parm() instead of push_parm_decl(). (start_method_def): Do not call push_scope(), declare_parm_level(), pop_scope(), push_parm_decl(), store_parm_decls() or objc_expr_last(); just use objc_push_parm() and objc_get_parm_info(). (comp_method_with_proto): Remove function. (objc_types_are_equivalent): Strip away indirections before comparing underlying types. (comp_proto_with_proto): Do not call groktypename(); types are no longer in raw declspec format. (objc_start_function): New function. (really_start_method): Call comp_proto_with_proto() instead of comp_method_with_proto(); call objc_start_function() instead of hand-crafting a function declarator. (continue_method_def, objc_expand_function_end): Remove functions. (get_super_receiver): Call objc_get_current_scope() instead of get_current_scope(); reference 'super_class' field (instead of 'class'). (finish_method_def): Rename to objc_finish_method_definition() and add a function decl parameter; move method encoding call from objc_expand_function_end(). (is_complex_decl, adorn_decl, gen_declarator, gen_declspecs, gen_declaration_1): Remove functions. (tmpbuf, RAW_DECLSPEC): Remove. (gen_declaration): Remove second parameter; simplify to deal with TYPE_P nodes instead of raw declspecs. (gen_type_name, gen_type_name_0): New functions. (gen_method_decl): Remove second parameter; call gen_type_name() instead of gen_declaration_1(). (dump_interface): Adjust calls to gen_declaration() and gen_method_decl(); do not allocate a separate string buffer. (init_objc): Allocate a larger string buffer to accommodate dump_interface(); adjust call to build_module_descriptor(); add call to build_module_initializer_routine() for the GNU runtime. (generate_classref_translation_entry): Do not call start_decl(); call finish_var_decl() instead of finish_decl(); call convert() instead of build_c_cast(). * objc-act.h (CLASS_OWN_IVARS): Remove accessor. (CLASS_BINFO_ELTS): Reduce from 6 to 5, now that CLASS_OWN_IVARS is gone. (OCTI_GNU_INIT_DECL, GNU_INIT_decl): New. (OCTI_ELLIPSIS_NODE, objc_ellipsis_node): Remove. (OCTI_ID_ID, id_type, objc_id_id): Rename to OCTI_ID_NAME, objc_object_type and objc_object_name, respectively. (OCTI_CLS_REF, OCTI_CLASS_NAME, objc_class_reference, objc_class_name): New. (IS_CLASS): New macro. (IS_ID, IS_SUPER): Robustify. (OCTI_EXECCLASS_DECL, execclass_decl): New. (finish_file, start_class, continue_class, finish_class, start_method_def, continue_method_def, finish_method_def, start_protocol, finish_protocol, objc_build_throw_stmt, objc_build_try_catch_finally_stmt, objc_build_synchronized_prologue, objc_build_synchronized_epilogue, objc_build_try_prologue, objc_build_try_epilogue, objc_build_catch_stmt, objc_build_catch_epilogue, objc_build_finally_prologue, objc_build_finally_epilogue, is_ivar, is_private, is_public, add_instance_variable, objc_add_method, get_super_receiver, objc_clear_super_receiver, get_class_ivars_from_name, get_class_reference, get_static_reference, get_object_reference, build_message_expr, finish_message_expr, build_selector_expr, build_ivar_reference, build_keyword_decl, build_method_decl, build_protocol_expr, build_objc_string_object, objc_declare_alias, objc_declare_class, objc_declare_protocols, objc_comptypes, objc_check_decl, build_encode_expr): Remove prototypes. (imp_count, cat_count): Make GGC-aware. (OBJC_SET_TYPE_NAME): New macro. From-SVN: r87168
2004-09-08 02:49:44 +02:00
"instance_methods");
chainon (field_decl_chain, field_decl);
Yet more Objective-C++... * objc-act.c (objc_finish_try_stmt): Add return value. (objc_build_synchronized): Likewise. * objc-act.c (objc_is_gcable_type): Add. (objc_substitute_decl): Add. (objc_build_ivar_assignment): Add. (objc_build_global_assignment): Add. (objc_build_strong_cast_assignment): Add. (objc_is_ivar_reference_p): Add. (objc_is_global_reference_p): Add. (objc_generate_write_barrier): Add. (objc_rewrite_function_call): Add. (objc_gimplify_expr): Add Objective-C++ support. * objc-act.h (ALLOC_OBJC_TYPE_LANG_SPECIFIC): Likewise. (SIZEOF_OBJC_TYPE_LANG_SPECIFIC): Add. (INIT_TYPE_OBJC_INFO): Add Objective-C++ support. (DUP_TYPE_OBJC_INFO): Likewise. (struct imp_entry): Add field has_cxx_cdtors. (struct imp_entry *imp_list): Add OCTI_UMSG_FAST_DECL, OCTI_METH_LIST_TEMPL, OCTI_METH_PROTO_LIST_TEMPL, OCTI_IVAR_LIST_TEMPL, OCTI_ASSIGN_IVAR_DECL, OCTI_ASSIGN_IVAR_FAST_DECL, OCTI_ASSIGN_GLOBAL_DECL, OCTI_ASSIGN_STRONGCAST_DECL. (umsg_fast_decl): Add. (objc_assign_ivar_decl): Add. (objc_assign_ivar_fast_decl): Add. (objc_assign_global_decl): Add. (objc_assign_strong_cast_decl): Add. (objc_method_list_ptr): Add. (objc_method_proto_list_ptr): Add. (objc_ivar_list_ptr): Add. * objc-act.c (should_call_super_dealloc): Add. (OBJC_VERSION): Bump to 6. (objc_is_gcable_type): Add. (objc_substitute_decl): Add. (objc_build_ivar_assignment): Add. (objc_build_global_assignment): Add. (objc_build_strong_cast_assignment): Add. (objc_is_gcable_p): Add. (objc_is_ivar_reference_p): Add. (objc_is_global_reference_p): Add. (generate_shared_structures): Add flags parameter. (objc_generate_cxx_ctor_or_dtor): Add. (objc_generate_cxx_cdtors): Add. (add_class): Add name parameter. (objc_types_share_size_and_alignment): Add. (comp_proto_with_proto): Add strict parameter. (CLS_HAS_CXX_STRUCTORS): Add. (TAG_ASSIGNIVAR): Add. (TAG_ASSIGNGLOBAL): Add. (TAG_ASSIGNSTRONGCAST): Add. (TAG_MSGSEND_FAST): Add. (TAG_ASSIGNIVAR_FAST): Add. (TAG_CXX_CONSTRUCT): Add. (TAG_CXX_DESTRUCT): Add. (OBJC_LOOKUP_CLASS): Add. (OBJC_LOOKUP_NO_SUPER): Add. (objc_finish_file): Add pch support. (objc_finish_implementation): Add Objective-C++ support. (synth_module_prologue): Likewise. (synth_module_prologue): Add fast dispatching. (objc_get_class_reference): Add Objective-C++ support. (objc_generate_write_barrier): Likewise. (next_sjlj_build_enter_and_setjmp): Likewise. (objc_begin_try_stmt): Likewise. (build_next_objc_exception_stuff): Add fast ivar support. (build_private_template): Mark the record as used so debug information is generated. (build_protocol_template): Add Objective-C++ support. (objc_method_parm_type) Likewise. (objc_generate_cxx_ctor_or_dtor): Likewise. (objc_generate_cxx_cdtors): Likewise. (build_protocol_initializer): Likewise. (build_category_template): Likewise. (build_class_template): Likewise. (build_method_list_template): Likewise. (build_category_initializer): Likewise. (build_shared_structure_initializer): Likewise. (objc_finish_message_expr): Likewise. (build_objc_method_call): Add fast dispatch support. (lookup_method_static): Add support to end search at superclasses. (add_method_to_hash_list): Add strict parameter to comp_proto_with_proto. (objc_add_method): Likewise. (objc_add_method): Also set the interface_value. (add_instance_variable): Add Objective-C++ support. (objc_is_public): Likewise. (start_class): Likewise. (continue_class): Likewise. (encode_aggregate_within): Likewise. (start_method_def): Likewise. (objc_start_function): Clear current_function_returns_value and current_function_returns_null. (really_start_method): Add Objective-C++ support. (objc_finish_method_definition): Add warning for missing [super dealloc]. (finish_objc): Add Objective-C++ support. (generate_objc_image_info): Likewise. (objc_lookup_ivar): Likewise. * objc-act.h (TYPE_HAS_OBJC_INFO): Likewise. (INIT_TYPE_OBJC_INFO): Likewise. (DUP_TYPE_OBJC_INFO): Likewise. From-SVN: r99857
2005-05-17 22:07:08 +02:00
/* struct _objc__method_prototype_list *class_methods; */
field_decl = create_field_decl (objc_method_proto_list_ptr,
Makefile.in (c-parse.o): Depend on $(C_COMMON_H). [gcc/ChangeLog] 2004-09-07 Ziemowit Laski <zlaski@apple.com> * Makefile.in (c-parse.o): Depend on $(C_COMMON_H). * c-parse.in: Include c-common.h instead of objc-act.h. (ivar_decl_list, ivar_decls, ivar_decl, ivars, ivar_declarator, myparms, myparm): Remove %type declarations. (methodtype, optparms, OBJC_TYPE_QUAL, objc_quals, objc_qual, objc_typename, objc_try_catch_stmt, optellipsis): Add %type declarations. (objc_inherit_code, objc_public_flag): Remove. (typespec_nonreserved_nonattr): Call objc_get_protocol_qualified_type() instead of get_static_reference() and get_protocol_reference(). (stmt_nocomp): Call grokparm() on @catch parameter. (objcdef): Move semantic action to objc_finish_implementation(). (classdef): Move semantic action to objc_start_class_interface(), objc_continue_interface(), objc_finish_interface(), objc_start_class_implementation(), objc_continue_implementation(), objc_start_category_interface() and objc_start_category_implementation(). (protocoldef): Move semantic actions to objc_start_protocol() and objc_finish_interface(). (ivar_decl_list): Remove nonterminal. (visibility_spec): Move semantic actions to objc_set_visibility(). (ivar_decls): Remove assignment to $$. (ivar_decl): Rephrase in terms of component_decl; call objc_add_instance_variable(). (ivars, ivar_declarator): Remove nonterminals. (opt_semi): New nonterminal. (methodtype): Remove semantic actions. (methoddef): Move semantic actions to objc_set_method_type(), objc_start_method_definition() and objc_finish_method_definition(). (methodproto): Move semantic actions to objc_set_method_type() and objc_add_method_declaration(). (methoddecl): Use objc_typename instead of typename; move semantic actions to objc_build_method_signature(). (optarglist, myxdecls, mydecl, myparms, myparm): Remove nonterminals. (optparmlist): Express in terms of optparms and optellipsis. (optparms, optellipsis, objc_qual, objc_quals, objc_typename): New nonterminals. (keyworddecl): Use objc_typename instead of typename. (rid_to_yy): Mark RID_IN, RID_OUT, RID_INOUT, RID_BYCOPY, RID_BYREF and RID_ONEWAY as returning OBJC_TYPE_QUAL to yyparse(). [gcc/objc/ChangeLog] 2004-09-07 Ziemowit Laski <zlaski@apple.com> * Make-lang.in (objc/objc-parse.o): Depend on $(C_COMMON_H) instead of objc/objc-act.h. (objc/objc-act.o): Depend on $(HASHTAB_H). * objc-act.c: Include hashtab.h; in ObjC++ mode, include cp-tree.h and objcp-decl.h instead of c-tree.h. (build_module_descriptor, get_class_ivars, synth_id_with_class_suffix, error_with_ivar, gen_method_decl, gen_declaration, setup_string_decl, build_protocol_template): Adjust prototypes. (build_module_initializer_routine, start_class, continue_class, finish_class, start_method_def, objc_start_function, start_protocol, build_method_decl, objc_add_method, add_instance_variable, build_ivar_reference, is_ivar, is_private, get_super_receiver, build_selector_table_decl, objc_push_parm, objc_get_parm_info, gen_type_name, gen_type_name_0, start_var_decl, finish_var_decl, create_field_decl): New prototypes. (objc_expand_function_end, comp_method_with_proto, objc_expr_last, gen_declaration_1, gen_declarator, is_complex_decl, adorn_decl, define_decl, create_builtin_decl, gen_declspecs): Remove prototypes. (TYPE_ID): Rename to OBJECT_TYPEDEF_NAME. (CLASS_TYPEDEF_NAME): New. (TAG_EXECCLASS): Change from a global variable to a #define. (TAG_RETURN_STRUCT): Delete. (TAG_GNUINIT): New, holds '__objc_gnu_init' name. (objc_inherit_code, objc_public_flag): New, moved from c-parse.in. (string_descriptor): New struct. (string_htab): New hash table. (string_hash, string_eq): New prototypes. (generate_struct_by_value_array): Call create_field_decl() instead of create_builtin_decl(). (objc_init): Do not initialize objc_ellipsis_node or TAG_EXECCLASS; In ObjC++ mode, call cxx_init() instead of c_objc_common_init(). (objc_finish_file): In ObjC++, call instantiate_pending_templates() and cp_finish_file(). (define_decl, get_static_reference, get_protocol_reference, create_builtin_decl): Remove functions. (objc_start_class_interface, objc_start_category_interface, objc_start_protocol, objc_continue_interface, objc_finish_interface, objc_start_class_implementation, objc_start_category_implementation, objc_continue_implementation, objc_finish_implementation, objc_set_visibility, objc_set_method_type, objc_build_method_signature, objc_add_method_declaration, objc_start_method_definition, objc_add_instance_variable, objc_get_protocol_qualified_type, create_field_decl, start_var_decl, finish_var_decl): New functions. (setup_string_decl): Simplify since it is only called once. (synth_module_prologue): Call build_class_template(); predefine 'id' and 'Class' as typedefs; rename 'temp_type' to 'type'; disable debug hooks for duration of function; fix GNU runtime messenger signatures to correspond to reality; forward-declare '__objc_exec_class' for the GNU runtime; call build_selector_table_decl(); in ObjC++ mode, generate 'extern "C" { ... }' wrappers around synthesized declarations; call build_protocol_template() and build_category_template(). (string_hash, string_eq): New functions. (objc_build_string_object): Check metaclass correctness only once; store string literals in hash table. (objc_build_constructor): Do not convert initializer elements; adjust for ObjC++ impedance mismatch. (build_objc_symtab_template): Call create_field_decl() instead of create_builtin_decl(). (init_objc_symtab): Add missing conversion to initializer element. (build_metadata_decl): Call start_var_decl() instead of define_decl(). (generate_objc_symtab_decl): Do not call build_category_template(); call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(). (build_module_descriptor): Call create_field_decl() instead of grokfield(); call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(); always mark module descriptor as used; move GNU runtime-specific functionality to build_module_initializer_routine(). (build_module_initializer_routine): New function, broken off of build_module_descriptor(). (objc_static_init_needed_p, objc_generate_static_init_call): New functions. (generate_static_references, generate_strings, build_selector_translation_table, generate_descriptor_table, generate_ivars_list, generate_dispatch_table, generate_category): Call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(); build a type directly instead of via groktypename(). (build_selector_reference_decl, build_selector_table_decl, build_class_reference_decl, build_protocol_reference, generate_objc_image_info): Call start_var_decl() instead of build_decl(). (build_selector_reference): For GNU runtime, do not call build_selector_reference_decl(). (build_selector, build_typed_selector_reference): Always convert result to the selector type. (add_objc_string): Cast return value to 'char *'. (build_method_prototype_template, build_selector_template, build_method_template): Use actual selector type for fields pointing to selectors. (finish_objc): For GNU runtime, call build_module_initializer_routine() after build_module_descriptor(). (generate_protocol_list, generate_shared_structures): Call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(); build a type directly instead of via groktypename(). (synth_id_with_class_suffix): Return a string. (get_arg_type_list): For instance methods, use the instance type for 'self'; do not call groktypename_in_parm_context(). (build_objc_string_decl): Squash redeclaration errors in ObjC++. (objc_is_class_name): Use OBJC_TYPE_NAME instead of TYPE_NAME; handle RECORD_TYPEs in ObjC as well as ObjC++. (objc_is_id): New function. (objc_is_object_ptr): Return the canonical type node. (objc_get_class_ivars): Simplify using get_class_ivars(). (get_class_ivars): Remove second parameter; create a fresh copy of the ivar list for each call; do not check for existence of super class. (objc_eh_runtime_type): Mark #ifndef OBJCPLUS. (objc_init_exceptions): When using SJLJ-style exceptions, require the use of '-fobjc-exceptions' flag; do not require it for DWARF-style exceptions. (objc_build_exc_ptr, next_sjlj_build_try_catch_finally): Use objc_object_type instead of objc_id_type. (objc_begin_catch_clause): Convert the incoming PARM_DECL into a VAR_DECL before placing it in the appropriate scope; do not call define_decl(); adjust call to c_begin_compound_stmt(); use objc_object_type instead of objc_id_type. (build_next_objc_exception_stuff): Call create_field_decl() instead of create_builtin_decl(); construct type directly instead of calling groktypename(); use OBJC_VOID_AT_END to mark end of function parameters. (build_private_template): Adjust call to get_class_ivars(); build a type directly instead of via groktypename(). (build_protocol_template, build_method_prototype_list_template, build_method_prototype_template, build_category_template, build_selector_template, build_class_template, build_super_template, build_ivar_template, build_ivar_list_template, build_method_list_template, build_method_template): Call create_field_decl() instead of grokfield(). (objc_method_parm_type): Do not call groktypename(). (generate_descriptor_table): Call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(). (generate_method_descriptors, build_protocol_initializer, generate_dispatch_tables, build_category_initializer, build_shared_structure_initializer): Do not call groktypename(). (generate_protocols): Call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(); do not call groktypename(). (error_with_ivar): Remove last parameter. (check_ivars): Do not iterate ovar CLASS_RAW_IVARS lists in addition to CLASS_IVARS lists; adjust calls to error_with_ivar(). (generate_ivar_lists): Convert one of the initializer elements; do not call groktypename(). (get_arg_type_list, start_method_def, gen_method_def): Account for new representation of variable arguments and '...' in Objective-C methods; add Objective-C++ impedance matching code. (is_objc_type_qualifier): Remove function. (adjust_type_for_id_default): Simplify; there is no longer a need to wade through declspecs. (lookup_interface, start_class, continue_class, finish_class, start_method_def, start_protocol, build_method_decl, objc_add_method, add_instance_variable, build_ivar_reference, is_ivar, is_private, get_super_receiver, objc_build_finally_epilogue): Make into static functions. (receiver_is_class_object): Use new IS_CLASS() macro. (objc_build_message_expr): Tweak ObjC++ message argument handling; call objc_finish_message_expr() instead of finish_message_expr(). (finish_message_expr): Rename to objc_finish_message_expr(); use OBJC_TYPE_NAME and OBJC_SET_TYPE_NAME macros instead of TYPE_NAME. call gen_type_name() instead of gen_declaration(); call objc_is_id() instead of using IS_ID and IS_CLASS; Use objc_class_name instead of calling get_identifier("Class"); handle CONVERT_EXPRs in receiver. (build_objc_method_call, warn_with_method): Do not call groktypename(). (build_ivar_reference): Call convert() instead of clobbering in a type. (hash_init): Initialize string_htab hash table. (add_instance_variable): Simplify parameter list; do not call grokfield(); do not populate CLASS_IVARS list. (start_class): Check for the existence of super class, if one was specified. (continue_class): Use CLASS_RAW_IVARS rather than CLASS_IVARS; do not call build_class_template(); adjust call to get_class_ivars(); call build_decl(), pushdecl() and finish_decl() instead of define_decl(). (finish_class): Call build_decl(), pushdecl() and finish_decl() instead of define_decl(). (add_protocols): Use PROTOCOL_BINFO_ELTS for the tree vector size. (start_protocol): Do not call build_protocol_template(); use PROTOCOL_BINFO_ELTS for the tree vector size. (encode_type_qualifiers): Do not handle the 'const' qualifier here. (encode_pointer): Encode 'const char *' as 'r*', for backwards compatibility. (encode_array): Use HOST_WIDE_INT_PRINT_DEC instead of "%ld". (encode_type): Handle the 'const' qualifier here. (objc_parmlist): New global variable, sued by objc_push_parm and objc_get_parm_info(). (objc_push_parm, objc_get_parm_info): New functions. (objc_expr_last): Remove function. (synth_self_and_ucmd_args): For instance methods, use the instance type for 'self'; call objc_push_parm() instead of push_parm_decl(). (start_method_def): Do not call push_scope(), declare_parm_level(), pop_scope(), push_parm_decl(), store_parm_decls() or objc_expr_last(); just use objc_push_parm() and objc_get_parm_info(). (comp_method_with_proto): Remove function. (objc_types_are_equivalent): Strip away indirections before comparing underlying types. (comp_proto_with_proto): Do not call groktypename(); types are no longer in raw declspec format. (objc_start_function): New function. (really_start_method): Call comp_proto_with_proto() instead of comp_method_with_proto(); call objc_start_function() instead of hand-crafting a function declarator. (continue_method_def, objc_expand_function_end): Remove functions. (get_super_receiver): Call objc_get_current_scope() instead of get_current_scope(); reference 'super_class' field (instead of 'class'). (finish_method_def): Rename to objc_finish_method_definition() and add a function decl parameter; move method encoding call from objc_expand_function_end(). (is_complex_decl, adorn_decl, gen_declarator, gen_declspecs, gen_declaration_1): Remove functions. (tmpbuf, RAW_DECLSPEC): Remove. (gen_declaration): Remove second parameter; simplify to deal with TYPE_P nodes instead of raw declspecs. (gen_type_name, gen_type_name_0): New functions. (gen_method_decl): Remove second parameter; call gen_type_name() instead of gen_declaration_1(). (dump_interface): Adjust calls to gen_declaration() and gen_method_decl(); do not allocate a separate string buffer. (init_objc): Allocate a larger string buffer to accommodate dump_interface(); adjust call to build_module_descriptor(); add call to build_module_initializer_routine() for the GNU runtime. (generate_classref_translation_entry): Do not call start_decl(); call finish_var_decl() instead of finish_decl(); call convert() instead of build_c_cast(). * objc-act.h (CLASS_OWN_IVARS): Remove accessor. (CLASS_BINFO_ELTS): Reduce from 6 to 5, now that CLASS_OWN_IVARS is gone. (OCTI_GNU_INIT_DECL, GNU_INIT_decl): New. (OCTI_ELLIPSIS_NODE, objc_ellipsis_node): Remove. (OCTI_ID_ID, id_type, objc_id_id): Rename to OCTI_ID_NAME, objc_object_type and objc_object_name, respectively. (OCTI_CLS_REF, OCTI_CLASS_NAME, objc_class_reference, objc_class_name): New. (IS_CLASS): New macro. (IS_ID, IS_SUPER): Robustify. (OCTI_EXECCLASS_DECL, execclass_decl): New. (finish_file, start_class, continue_class, finish_class, start_method_def, continue_method_def, finish_method_def, start_protocol, finish_protocol, objc_build_throw_stmt, objc_build_try_catch_finally_stmt, objc_build_synchronized_prologue, objc_build_synchronized_epilogue, objc_build_try_prologue, objc_build_try_epilogue, objc_build_catch_stmt, objc_build_catch_epilogue, objc_build_finally_prologue, objc_build_finally_epilogue, is_ivar, is_private, is_public, add_instance_variable, objc_add_method, get_super_receiver, objc_clear_super_receiver, get_class_ivars_from_name, get_class_reference, get_static_reference, get_object_reference, build_message_expr, finish_message_expr, build_selector_expr, build_ivar_reference, build_keyword_decl, build_method_decl, build_protocol_expr, build_objc_string_object, objc_declare_alias, objc_declare_class, objc_declare_protocols, objc_comptypes, objc_check_decl, build_encode_expr): Remove prototypes. (imp_count, cat_count): Make GGC-aware. (OBJC_SET_TYPE_NAME): New macro. From-SVN: r87168
2004-09-08 02:49:44 +02:00
"class_methods");
chainon (field_decl_chain, field_decl);
Makefile.in (c-parse.o): Depend on $(C_COMMON_H). [gcc/ChangeLog] 2004-09-07 Ziemowit Laski <zlaski@apple.com> * Makefile.in (c-parse.o): Depend on $(C_COMMON_H). * c-parse.in: Include c-common.h instead of objc-act.h. (ivar_decl_list, ivar_decls, ivar_decl, ivars, ivar_declarator, myparms, myparm): Remove %type declarations. (methodtype, optparms, OBJC_TYPE_QUAL, objc_quals, objc_qual, objc_typename, objc_try_catch_stmt, optellipsis): Add %type declarations. (objc_inherit_code, objc_public_flag): Remove. (typespec_nonreserved_nonattr): Call objc_get_protocol_qualified_type() instead of get_static_reference() and get_protocol_reference(). (stmt_nocomp): Call grokparm() on @catch parameter. (objcdef): Move semantic action to objc_finish_implementation(). (classdef): Move semantic action to objc_start_class_interface(), objc_continue_interface(), objc_finish_interface(), objc_start_class_implementation(), objc_continue_implementation(), objc_start_category_interface() and objc_start_category_implementation(). (protocoldef): Move semantic actions to objc_start_protocol() and objc_finish_interface(). (ivar_decl_list): Remove nonterminal. (visibility_spec): Move semantic actions to objc_set_visibility(). (ivar_decls): Remove assignment to $$. (ivar_decl): Rephrase in terms of component_decl; call objc_add_instance_variable(). (ivars, ivar_declarator): Remove nonterminals. (opt_semi): New nonterminal. (methodtype): Remove semantic actions. (methoddef): Move semantic actions to objc_set_method_type(), objc_start_method_definition() and objc_finish_method_definition(). (methodproto): Move semantic actions to objc_set_method_type() and objc_add_method_declaration(). (methoddecl): Use objc_typename instead of typename; move semantic actions to objc_build_method_signature(). (optarglist, myxdecls, mydecl, myparms, myparm): Remove nonterminals. (optparmlist): Express in terms of optparms and optellipsis. (optparms, optellipsis, objc_qual, objc_quals, objc_typename): New nonterminals. (keyworddecl): Use objc_typename instead of typename. (rid_to_yy): Mark RID_IN, RID_OUT, RID_INOUT, RID_BYCOPY, RID_BYREF and RID_ONEWAY as returning OBJC_TYPE_QUAL to yyparse(). [gcc/objc/ChangeLog] 2004-09-07 Ziemowit Laski <zlaski@apple.com> * Make-lang.in (objc/objc-parse.o): Depend on $(C_COMMON_H) instead of objc/objc-act.h. (objc/objc-act.o): Depend on $(HASHTAB_H). * objc-act.c: Include hashtab.h; in ObjC++ mode, include cp-tree.h and objcp-decl.h instead of c-tree.h. (build_module_descriptor, get_class_ivars, synth_id_with_class_suffix, error_with_ivar, gen_method_decl, gen_declaration, setup_string_decl, build_protocol_template): Adjust prototypes. (build_module_initializer_routine, start_class, continue_class, finish_class, start_method_def, objc_start_function, start_protocol, build_method_decl, objc_add_method, add_instance_variable, build_ivar_reference, is_ivar, is_private, get_super_receiver, build_selector_table_decl, objc_push_parm, objc_get_parm_info, gen_type_name, gen_type_name_0, start_var_decl, finish_var_decl, create_field_decl): New prototypes. (objc_expand_function_end, comp_method_with_proto, objc_expr_last, gen_declaration_1, gen_declarator, is_complex_decl, adorn_decl, define_decl, create_builtin_decl, gen_declspecs): Remove prototypes. (TYPE_ID): Rename to OBJECT_TYPEDEF_NAME. (CLASS_TYPEDEF_NAME): New. (TAG_EXECCLASS): Change from a global variable to a #define. (TAG_RETURN_STRUCT): Delete. (TAG_GNUINIT): New, holds '__objc_gnu_init' name. (objc_inherit_code, objc_public_flag): New, moved from c-parse.in. (string_descriptor): New struct. (string_htab): New hash table. (string_hash, string_eq): New prototypes. (generate_struct_by_value_array): Call create_field_decl() instead of create_builtin_decl(). (objc_init): Do not initialize objc_ellipsis_node or TAG_EXECCLASS; In ObjC++ mode, call cxx_init() instead of c_objc_common_init(). (objc_finish_file): In ObjC++, call instantiate_pending_templates() and cp_finish_file(). (define_decl, get_static_reference, get_protocol_reference, create_builtin_decl): Remove functions. (objc_start_class_interface, objc_start_category_interface, objc_start_protocol, objc_continue_interface, objc_finish_interface, objc_start_class_implementation, objc_start_category_implementation, objc_continue_implementation, objc_finish_implementation, objc_set_visibility, objc_set_method_type, objc_build_method_signature, objc_add_method_declaration, objc_start_method_definition, objc_add_instance_variable, objc_get_protocol_qualified_type, create_field_decl, start_var_decl, finish_var_decl): New functions. (setup_string_decl): Simplify since it is only called once. (synth_module_prologue): Call build_class_template(); predefine 'id' and 'Class' as typedefs; rename 'temp_type' to 'type'; disable debug hooks for duration of function; fix GNU runtime messenger signatures to correspond to reality; forward-declare '__objc_exec_class' for the GNU runtime; call build_selector_table_decl(); in ObjC++ mode, generate 'extern "C" { ... }' wrappers around synthesized declarations; call build_protocol_template() and build_category_template(). (string_hash, string_eq): New functions. (objc_build_string_object): Check metaclass correctness only once; store string literals in hash table. (objc_build_constructor): Do not convert initializer elements; adjust for ObjC++ impedance mismatch. (build_objc_symtab_template): Call create_field_decl() instead of create_builtin_decl(). (init_objc_symtab): Add missing conversion to initializer element. (build_metadata_decl): Call start_var_decl() instead of define_decl(). (generate_objc_symtab_decl): Do not call build_category_template(); call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(). (build_module_descriptor): Call create_field_decl() instead of grokfield(); call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(); always mark module descriptor as used; move GNU runtime-specific functionality to build_module_initializer_routine(). (build_module_initializer_routine): New function, broken off of build_module_descriptor(). (objc_static_init_needed_p, objc_generate_static_init_call): New functions. (generate_static_references, generate_strings, build_selector_translation_table, generate_descriptor_table, generate_ivars_list, generate_dispatch_table, generate_category): Call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(); build a type directly instead of via groktypename(). (build_selector_reference_decl, build_selector_table_decl, build_class_reference_decl, build_protocol_reference, generate_objc_image_info): Call start_var_decl() instead of build_decl(). (build_selector_reference): For GNU runtime, do not call build_selector_reference_decl(). (build_selector, build_typed_selector_reference): Always convert result to the selector type. (add_objc_string): Cast return value to 'char *'. (build_method_prototype_template, build_selector_template, build_method_template): Use actual selector type for fields pointing to selectors. (finish_objc): For GNU runtime, call build_module_initializer_routine() after build_module_descriptor(). (generate_protocol_list, generate_shared_structures): Call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(); build a type directly instead of via groktypename(). (synth_id_with_class_suffix): Return a string. (get_arg_type_list): For instance methods, use the instance type for 'self'; do not call groktypename_in_parm_context(). (build_objc_string_decl): Squash redeclaration errors in ObjC++. (objc_is_class_name): Use OBJC_TYPE_NAME instead of TYPE_NAME; handle RECORD_TYPEs in ObjC as well as ObjC++. (objc_is_id): New function. (objc_is_object_ptr): Return the canonical type node. (objc_get_class_ivars): Simplify using get_class_ivars(). (get_class_ivars): Remove second parameter; create a fresh copy of the ivar list for each call; do not check for existence of super class. (objc_eh_runtime_type): Mark #ifndef OBJCPLUS. (objc_init_exceptions): When using SJLJ-style exceptions, require the use of '-fobjc-exceptions' flag; do not require it for DWARF-style exceptions. (objc_build_exc_ptr, next_sjlj_build_try_catch_finally): Use objc_object_type instead of objc_id_type. (objc_begin_catch_clause): Convert the incoming PARM_DECL into a VAR_DECL before placing it in the appropriate scope; do not call define_decl(); adjust call to c_begin_compound_stmt(); use objc_object_type instead of objc_id_type. (build_next_objc_exception_stuff): Call create_field_decl() instead of create_builtin_decl(); construct type directly instead of calling groktypename(); use OBJC_VOID_AT_END to mark end of function parameters. (build_private_template): Adjust call to get_class_ivars(); build a type directly instead of via groktypename(). (build_protocol_template, build_method_prototype_list_template, build_method_prototype_template, build_category_template, build_selector_template, build_class_template, build_super_template, build_ivar_template, build_ivar_list_template, build_method_list_template, build_method_template): Call create_field_decl() instead of grokfield(). (objc_method_parm_type): Do not call groktypename(). (generate_descriptor_table): Call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(). (generate_method_descriptors, build_protocol_initializer, generate_dispatch_tables, build_category_initializer, build_shared_structure_initializer): Do not call groktypename(). (generate_protocols): Call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(); do not call groktypename(). (error_with_ivar): Remove last parameter. (check_ivars): Do not iterate ovar CLASS_RAW_IVARS lists in addition to CLASS_IVARS lists; adjust calls to error_with_ivar(). (generate_ivar_lists): Convert one of the initializer elements; do not call groktypename(). (get_arg_type_list, start_method_def, gen_method_def): Account for new representation of variable arguments and '...' in Objective-C methods; add Objective-C++ impedance matching code. (is_objc_type_qualifier): Remove function. (adjust_type_for_id_default): Simplify; there is no longer a need to wade through declspecs. (lookup_interface, start_class, continue_class, finish_class, start_method_def, start_protocol, build_method_decl, objc_add_method, add_instance_variable, build_ivar_reference, is_ivar, is_private, get_super_receiver, objc_build_finally_epilogue): Make into static functions. (receiver_is_class_object): Use new IS_CLASS() macro. (objc_build_message_expr): Tweak ObjC++ message argument handling; call objc_finish_message_expr() instead of finish_message_expr(). (finish_message_expr): Rename to objc_finish_message_expr(); use OBJC_TYPE_NAME and OBJC_SET_TYPE_NAME macros instead of TYPE_NAME. call gen_type_name() instead of gen_declaration(); call objc_is_id() instead of using IS_ID and IS_CLASS; Use objc_class_name instead of calling get_identifier("Class"); handle CONVERT_EXPRs in receiver. (build_objc_method_call, warn_with_method): Do not call groktypename(). (build_ivar_reference): Call convert() instead of clobbering in a type. (hash_init): Initialize string_htab hash table. (add_instance_variable): Simplify parameter list; do not call grokfield(); do not populate CLASS_IVARS list. (start_class): Check for the existence of super class, if one was specified. (continue_class): Use CLASS_RAW_IVARS rather than CLASS_IVARS; do not call build_class_template(); adjust call to get_class_ivars(); call build_decl(), pushdecl() and finish_decl() instead of define_decl(). (finish_class): Call build_decl(), pushdecl() and finish_decl() instead of define_decl(). (add_protocols): Use PROTOCOL_BINFO_ELTS for the tree vector size. (start_protocol): Do not call build_protocol_template(); use PROTOCOL_BINFO_ELTS for the tree vector size. (encode_type_qualifiers): Do not handle the 'const' qualifier here. (encode_pointer): Encode 'const char *' as 'r*', for backwards compatibility. (encode_array): Use HOST_WIDE_INT_PRINT_DEC instead of "%ld". (encode_type): Handle the 'const' qualifier here. (objc_parmlist): New global variable, sued by objc_push_parm and objc_get_parm_info(). (objc_push_parm, objc_get_parm_info): New functions. (objc_expr_last): Remove function. (synth_self_and_ucmd_args): For instance methods, use the instance type for 'self'; call objc_push_parm() instead of push_parm_decl(). (start_method_def): Do not call push_scope(), declare_parm_level(), pop_scope(), push_parm_decl(), store_parm_decls() or objc_expr_last(); just use objc_push_parm() and objc_get_parm_info(). (comp_method_with_proto): Remove function. (objc_types_are_equivalent): Strip away indirections before comparing underlying types. (comp_proto_with_proto): Do not call groktypename(); types are no longer in raw declspec format. (objc_start_function): New function. (really_start_method): Call comp_proto_with_proto() instead of comp_method_with_proto(); call objc_start_function() instead of hand-crafting a function declarator. (continue_method_def, objc_expand_function_end): Remove functions. (get_super_receiver): Call objc_get_current_scope() instead of get_current_scope(); reference 'super_class' field (instead of 'class'). (finish_method_def): Rename to objc_finish_method_definition() and add a function decl parameter; move method encoding call from objc_expand_function_end(). (is_complex_decl, adorn_decl, gen_declarator, gen_declspecs, gen_declaration_1): Remove functions. (tmpbuf, RAW_DECLSPEC): Remove. (gen_declaration): Remove second parameter; simplify to deal with TYPE_P nodes instead of raw declspecs. (gen_type_name, gen_type_name_0): New functions. (gen_method_decl): Remove second parameter; call gen_type_name() instead of gen_declaration_1(). (dump_interface): Adjust calls to gen_declaration() and gen_method_decl(); do not allocate a separate string buffer. (init_objc): Allocate a larger string buffer to accommodate dump_interface(); adjust call to build_module_descriptor(); add call to build_module_initializer_routine() for the GNU runtime. (generate_classref_translation_entry): Do not call start_decl(); call finish_var_decl() instead of finish_decl(); call convert() instead of build_c_cast(). * objc-act.h (CLASS_OWN_IVARS): Remove accessor. (CLASS_BINFO_ELTS): Reduce from 6 to 5, now that CLASS_OWN_IVARS is gone. (OCTI_GNU_INIT_DECL, GNU_INIT_decl): New. (OCTI_ELLIPSIS_NODE, objc_ellipsis_node): Remove. (OCTI_ID_ID, id_type, objc_id_id): Rename to OCTI_ID_NAME, objc_object_type and objc_object_name, respectively. (OCTI_CLS_REF, OCTI_CLASS_NAME, objc_class_reference, objc_class_name): New. (IS_CLASS): New macro. (IS_ID, IS_SUPER): Robustify. (OCTI_EXECCLASS_DECL, execclass_decl): New. (finish_file, start_class, continue_class, finish_class, start_method_def, continue_method_def, finish_method_def, start_protocol, finish_protocol, objc_build_throw_stmt, objc_build_try_catch_finally_stmt, objc_build_synchronized_prologue, objc_build_synchronized_epilogue, objc_build_try_prologue, objc_build_try_epilogue, objc_build_catch_stmt, objc_build_catch_epilogue, objc_build_finally_prologue, objc_build_finally_epilogue, is_ivar, is_private, is_public, add_instance_variable, objc_add_method, get_super_receiver, objc_clear_super_receiver, get_class_ivars_from_name, get_class_reference, get_static_reference, get_object_reference, build_message_expr, finish_message_expr, build_selector_expr, build_ivar_reference, build_keyword_decl, build_method_decl, build_protocol_expr, build_objc_string_object, objc_declare_alias, objc_declare_class, objc_declare_protocols, objc_comptypes, objc_check_decl, build_encode_expr): Remove prototypes. (imp_count, cat_count): Make GGC-aware. (OBJC_SET_TYPE_NAME): New macro. From-SVN: r87168
2004-09-08 02:49:44 +02:00
finish_struct (objc_protocol_template, field_decl_chain, NULL_TREE);
}
static tree
build_descriptor_table_initializer (tree type, tree entries)
{
tree initlist = NULL_TREE;
do
{
tree eltlist = NULL_TREE;
eltlist
= tree_cons (NULL_TREE,
build_selector (METHOD_SEL_NAME (entries)), NULL_TREE);
eltlist
= tree_cons (NULL_TREE,
add_objc_string (METHOD_ENCODING (entries),
meth_var_types),
eltlist);
initlist
= tree_cons (NULL_TREE,
tree.c (build_constructor): New function. * tree.c (build_constructor): New function. * tree.h: Prototype it. * c-typeck.c (build_c_cast, pop_init_level) * profile.c (build_function_info_value, build_gcov_info_value) (create_profiler): Use build_constructor. * builtins.c (expand_builtin_args_info): Remove #if 0 blocks. * objc/objc-act.c (build_constructor): Rename objc_build_constructor. Use build_constructor. (build_objc_string_object, objc_add_static_instance) (init_def_list, init_objc_symtab, init_module_descriptor) (generate_static_references, build_selector_translation_table) (build_descriptor_table_initializer, generate_descriptor_table) (build_protocol_initializer, build_ivar_list_initializer) (generate_ivars_list, build_dispatch_table_initializer) (generate_dispatch_table, generate_protocol_list) (build_category_initializer, build_shared_structure_initializer): Update to match. ada: * gigi.h, utils2.c (build_constructor): Rename gnat_build_constructor. Use build_constructor. * decl.c (gnat_to_gnu_entity) * trans.c (tree_transform, pos_to_constructor, extract_values) * ada/utils.c (build_template, convert_to_fat_pointer, convert) (unchecked_convert) * ada/utils2.c (build_binary_op, build_call_raise, build_allocator) (fill_vms_descriptor): Update to match. cp: * class.c (initialize_array) * decl.c (reshape_init) * decl2.c (build_expr_from_tree) * init.c (build_zero_init) * pt.c (tsubst_copy, tsubst_copy_and_build) * rtti.c (tinfo_base_init, generic_initializer, ptr_initializer) (ptm_initializer, class_initializer, get_pseudo_ti_init) * semantics.c (finish_compound_literal) * typeck.c (build_ptrmemfunc1) * typeck2.c (store_init_value, process_init_constructor) (build_functional_cast): Use build_constructor. f: * com.c (ffecom_build_complex_constant_, ffecom_expr_) (ffecom_init_zero_, ffecom_transform_namelist_, ffecom_vardesc_) (ffecom_vardesc_array_, ffecom_vardesc_dims_, ffecom_2) * ste.c (ffeste_io_ialist_, ffeste_io_cilist_, ffeste_io_cllist_) (ffeste_io_icilist_, ffeste_io_inlist_, ffeste_io_olist_): Use build_constructor. java: * class.c (make_field_value, make_method_value, get_dispatch_table) (make_class_data, emit_offset_symbol_table) * constants.c (build_constants_constructor) * java-tree.h (START_RECORD_CONSTRUCTOR) * parse.y (maybe_build_array_element_wfl): Use build_constructor. From-SVN: r65539
2003-04-13 03:45:35 +02:00
objc_build_constructor (type, nreverse (eltlist)),
initlist);
entries = TREE_CHAIN (entries);
}
while (entries);
tree.c (build_constructor): New function. * tree.c (build_constructor): New function. * tree.h: Prototype it. * c-typeck.c (build_c_cast, pop_init_level) * profile.c (build_function_info_value, build_gcov_info_value) (create_profiler): Use build_constructor. * builtins.c (expand_builtin_args_info): Remove #if 0 blocks. * objc/objc-act.c (build_constructor): Rename objc_build_constructor. Use build_constructor. (build_objc_string_object, objc_add_static_instance) (init_def_list, init_objc_symtab, init_module_descriptor) (generate_static_references, build_selector_translation_table) (build_descriptor_table_initializer, generate_descriptor_table) (build_protocol_initializer, build_ivar_list_initializer) (generate_ivars_list, build_dispatch_table_initializer) (generate_dispatch_table, generate_protocol_list) (build_category_initializer, build_shared_structure_initializer): Update to match. ada: * gigi.h, utils2.c (build_constructor): Rename gnat_build_constructor. Use build_constructor. * decl.c (gnat_to_gnu_entity) * trans.c (tree_transform, pos_to_constructor, extract_values) * ada/utils.c (build_template, convert_to_fat_pointer, convert) (unchecked_convert) * ada/utils2.c (build_binary_op, build_call_raise, build_allocator) (fill_vms_descriptor): Update to match. cp: * class.c (initialize_array) * decl.c (reshape_init) * decl2.c (build_expr_from_tree) * init.c (build_zero_init) * pt.c (tsubst_copy, tsubst_copy_and_build) * rtti.c (tinfo_base_init, generic_initializer, ptr_initializer) (ptm_initializer, class_initializer, get_pseudo_ti_init) * semantics.c (finish_compound_literal) * typeck.c (build_ptrmemfunc1) * typeck2.c (store_init_value, process_init_constructor) (build_functional_cast): Use build_constructor. f: * com.c (ffecom_build_complex_constant_, ffecom_expr_) (ffecom_init_zero_, ffecom_transform_namelist_, ffecom_vardesc_) (ffecom_vardesc_array_, ffecom_vardesc_dims_, ffecom_2) * ste.c (ffeste_io_ialist_, ffeste_io_cilist_, ffeste_io_cllist_) (ffeste_io_icilist_, ffeste_io_inlist_, ffeste_io_olist_): Use build_constructor. java: * class.c (make_field_value, make_method_value, get_dispatch_table) (make_class_data, emit_offset_symbol_table) * constants.c (build_constants_constructor) * java-tree.h (START_RECORD_CONSTRUCTOR) * parse.y (maybe_build_array_element_wfl): Use build_constructor. From-SVN: r65539
2003-04-13 03:45:35 +02:00
return objc_build_constructor (build_array_type (type, 0),
nreverse (initlist));
}
/* struct objc_method_prototype_list {
int count;
struct objc_method_prototype {
SEL name;
char *types;
} list[1];
}; */
static tree
build_method_prototype_list_template (tree list_type, int size)
{
tree objc_ivar_list_record;
Makefile.in (c-parse.o): Depend on $(C_COMMON_H). [gcc/ChangeLog] 2004-09-07 Ziemowit Laski <zlaski@apple.com> * Makefile.in (c-parse.o): Depend on $(C_COMMON_H). * c-parse.in: Include c-common.h instead of objc-act.h. (ivar_decl_list, ivar_decls, ivar_decl, ivars, ivar_declarator, myparms, myparm): Remove %type declarations. (methodtype, optparms, OBJC_TYPE_QUAL, objc_quals, objc_qual, objc_typename, objc_try_catch_stmt, optellipsis): Add %type declarations. (objc_inherit_code, objc_public_flag): Remove. (typespec_nonreserved_nonattr): Call objc_get_protocol_qualified_type() instead of get_static_reference() and get_protocol_reference(). (stmt_nocomp): Call grokparm() on @catch parameter. (objcdef): Move semantic action to objc_finish_implementation(). (classdef): Move semantic action to objc_start_class_interface(), objc_continue_interface(), objc_finish_interface(), objc_start_class_implementation(), objc_continue_implementation(), objc_start_category_interface() and objc_start_category_implementation(). (protocoldef): Move semantic actions to objc_start_protocol() and objc_finish_interface(). (ivar_decl_list): Remove nonterminal. (visibility_spec): Move semantic actions to objc_set_visibility(). (ivar_decls): Remove assignment to $$. (ivar_decl): Rephrase in terms of component_decl; call objc_add_instance_variable(). (ivars, ivar_declarator): Remove nonterminals. (opt_semi): New nonterminal. (methodtype): Remove semantic actions. (methoddef): Move semantic actions to objc_set_method_type(), objc_start_method_definition() and objc_finish_method_definition(). (methodproto): Move semantic actions to objc_set_method_type() and objc_add_method_declaration(). (methoddecl): Use objc_typename instead of typename; move semantic actions to objc_build_method_signature(). (optarglist, myxdecls, mydecl, myparms, myparm): Remove nonterminals. (optparmlist): Express in terms of optparms and optellipsis. (optparms, optellipsis, objc_qual, objc_quals, objc_typename): New nonterminals. (keyworddecl): Use objc_typename instead of typename. (rid_to_yy): Mark RID_IN, RID_OUT, RID_INOUT, RID_BYCOPY, RID_BYREF and RID_ONEWAY as returning OBJC_TYPE_QUAL to yyparse(). [gcc/objc/ChangeLog] 2004-09-07 Ziemowit Laski <zlaski@apple.com> * Make-lang.in (objc/objc-parse.o): Depend on $(C_COMMON_H) instead of objc/objc-act.h. (objc/objc-act.o): Depend on $(HASHTAB_H). * objc-act.c: Include hashtab.h; in ObjC++ mode, include cp-tree.h and objcp-decl.h instead of c-tree.h. (build_module_descriptor, get_class_ivars, synth_id_with_class_suffix, error_with_ivar, gen_method_decl, gen_declaration, setup_string_decl, build_protocol_template): Adjust prototypes. (build_module_initializer_routine, start_class, continue_class, finish_class, start_method_def, objc_start_function, start_protocol, build_method_decl, objc_add_method, add_instance_variable, build_ivar_reference, is_ivar, is_private, get_super_receiver, build_selector_table_decl, objc_push_parm, objc_get_parm_info, gen_type_name, gen_type_name_0, start_var_decl, finish_var_decl, create_field_decl): New prototypes. (objc_expand_function_end, comp_method_with_proto, objc_expr_last, gen_declaration_1, gen_declarator, is_complex_decl, adorn_decl, define_decl, create_builtin_decl, gen_declspecs): Remove prototypes. (TYPE_ID): Rename to OBJECT_TYPEDEF_NAME. (CLASS_TYPEDEF_NAME): New. (TAG_EXECCLASS): Change from a global variable to a #define. (TAG_RETURN_STRUCT): Delete. (TAG_GNUINIT): New, holds '__objc_gnu_init' name. (objc_inherit_code, objc_public_flag): New, moved from c-parse.in. (string_descriptor): New struct. (string_htab): New hash table. (string_hash, string_eq): New prototypes. (generate_struct_by_value_array): Call create_field_decl() instead of create_builtin_decl(). (objc_init): Do not initialize objc_ellipsis_node or TAG_EXECCLASS; In ObjC++ mode, call cxx_init() instead of c_objc_common_init(). (objc_finish_file): In ObjC++, call instantiate_pending_templates() and cp_finish_file(). (define_decl, get_static_reference, get_protocol_reference, create_builtin_decl): Remove functions. (objc_start_class_interface, objc_start_category_interface, objc_start_protocol, objc_continue_interface, objc_finish_interface, objc_start_class_implementation, objc_start_category_implementation, objc_continue_implementation, objc_finish_implementation, objc_set_visibility, objc_set_method_type, objc_build_method_signature, objc_add_method_declaration, objc_start_method_definition, objc_add_instance_variable, objc_get_protocol_qualified_type, create_field_decl, start_var_decl, finish_var_decl): New functions. (setup_string_decl): Simplify since it is only called once. (synth_module_prologue): Call build_class_template(); predefine 'id' and 'Class' as typedefs; rename 'temp_type' to 'type'; disable debug hooks for duration of function; fix GNU runtime messenger signatures to correspond to reality; forward-declare '__objc_exec_class' for the GNU runtime; call build_selector_table_decl(); in ObjC++ mode, generate 'extern "C" { ... }' wrappers around synthesized declarations; call build_protocol_template() and build_category_template(). (string_hash, string_eq): New functions. (objc_build_string_object): Check metaclass correctness only once; store string literals in hash table. (objc_build_constructor): Do not convert initializer elements; adjust for ObjC++ impedance mismatch. (build_objc_symtab_template): Call create_field_decl() instead of create_builtin_decl(). (init_objc_symtab): Add missing conversion to initializer element. (build_metadata_decl): Call start_var_decl() instead of define_decl(). (generate_objc_symtab_decl): Do not call build_category_template(); call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(). (build_module_descriptor): Call create_field_decl() instead of grokfield(); call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(); always mark module descriptor as used; move GNU runtime-specific functionality to build_module_initializer_routine(). (build_module_initializer_routine): New function, broken off of build_module_descriptor(). (objc_static_init_needed_p, objc_generate_static_init_call): New functions. (generate_static_references, generate_strings, build_selector_translation_table, generate_descriptor_table, generate_ivars_list, generate_dispatch_table, generate_category): Call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(); build a type directly instead of via groktypename(). (build_selector_reference_decl, build_selector_table_decl, build_class_reference_decl, build_protocol_reference, generate_objc_image_info): Call start_var_decl() instead of build_decl(). (build_selector_reference): For GNU runtime, do not call build_selector_reference_decl(). (build_selector, build_typed_selector_reference): Always convert result to the selector type. (add_objc_string): Cast return value to 'char *'. (build_method_prototype_template, build_selector_template, build_method_template): Use actual selector type for fields pointing to selectors. (finish_objc): For GNU runtime, call build_module_initializer_routine() after build_module_descriptor(). (generate_protocol_list, generate_shared_structures): Call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(); build a type directly instead of via groktypename(). (synth_id_with_class_suffix): Return a string. (get_arg_type_list): For instance methods, use the instance type for 'self'; do not call groktypename_in_parm_context(). (build_objc_string_decl): Squash redeclaration errors in ObjC++. (objc_is_class_name): Use OBJC_TYPE_NAME instead of TYPE_NAME; handle RECORD_TYPEs in ObjC as well as ObjC++. (objc_is_id): New function. (objc_is_object_ptr): Return the canonical type node. (objc_get_class_ivars): Simplify using get_class_ivars(). (get_class_ivars): Remove second parameter; create a fresh copy of the ivar list for each call; do not check for existence of super class. (objc_eh_runtime_type): Mark #ifndef OBJCPLUS. (objc_init_exceptions): When using SJLJ-style exceptions, require the use of '-fobjc-exceptions' flag; do not require it for DWARF-style exceptions. (objc_build_exc_ptr, next_sjlj_build_try_catch_finally): Use objc_object_type instead of objc_id_type. (objc_begin_catch_clause): Convert the incoming PARM_DECL into a VAR_DECL before placing it in the appropriate scope; do not call define_decl(); adjust call to c_begin_compound_stmt(); use objc_object_type instead of objc_id_type. (build_next_objc_exception_stuff): Call create_field_decl() instead of create_builtin_decl(); construct type directly instead of calling groktypename(); use OBJC_VOID_AT_END to mark end of function parameters. (build_private_template): Adjust call to get_class_ivars(); build a type directly instead of via groktypename(). (build_protocol_template, build_method_prototype_list_template, build_method_prototype_template, build_category_template, build_selector_template, build_class_template, build_super_template, build_ivar_template, build_ivar_list_template, build_method_list_template, build_method_template): Call create_field_decl() instead of grokfield(). (objc_method_parm_type): Do not call groktypename(). (generate_descriptor_table): Call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(). (generate_method_descriptors, build_protocol_initializer, generate_dispatch_tables, build_category_initializer, build_shared_structure_initializer): Do not call groktypename(). (generate_protocols): Call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(); do not call groktypename(). (error_with_ivar): Remove last parameter. (check_ivars): Do not iterate ovar CLASS_RAW_IVARS lists in addition to CLASS_IVARS lists; adjust calls to error_with_ivar(). (generate_ivar_lists): Convert one of the initializer elements; do not call groktypename(). (get_arg_type_list, start_method_def, gen_method_def): Account for new representation of variable arguments and '...' in Objective-C methods; add Objective-C++ impedance matching code. (is_objc_type_qualifier): Remove function. (adjust_type_for_id_default): Simplify; there is no longer a need to wade through declspecs. (lookup_interface, start_class, continue_class, finish_class, start_method_def, start_protocol, build_method_decl, objc_add_method, add_instance_variable, build_ivar_reference, is_ivar, is_private, get_super_receiver, objc_build_finally_epilogue): Make into static functions. (receiver_is_class_object): Use new IS_CLASS() macro. (objc_build_message_expr): Tweak ObjC++ message argument handling; call objc_finish_message_expr() instead of finish_message_expr(). (finish_message_expr): Rename to objc_finish_message_expr(); use OBJC_TYPE_NAME and OBJC_SET_TYPE_NAME macros instead of TYPE_NAME. call gen_type_name() instead of gen_declaration(); call objc_is_id() instead of using IS_ID and IS_CLASS; Use objc_class_name instead of calling get_identifier("Class"); handle CONVERT_EXPRs in receiver. (build_objc_method_call, warn_with_method): Do not call groktypename(). (build_ivar_reference): Call convert() instead of clobbering in a type. (hash_init): Initialize string_htab hash table. (add_instance_variable): Simplify parameter list; do not call grokfield(); do not populate CLASS_IVARS list. (start_class): Check for the existence of super class, if one was specified. (continue_class): Use CLASS_RAW_IVARS rather than CLASS_IVARS; do not call build_class_template(); adjust call to get_class_ivars(); call build_decl(), pushdecl() and finish_decl() instead of define_decl(). (finish_class): Call build_decl(), pushdecl() and finish_decl() instead of define_decl(). (add_protocols): Use PROTOCOL_BINFO_ELTS for the tree vector size. (start_protocol): Do not call build_protocol_template(); use PROTOCOL_BINFO_ELTS for the tree vector size. (encode_type_qualifiers): Do not handle the 'const' qualifier here. (encode_pointer): Encode 'const char *' as 'r*', for backwards compatibility. (encode_array): Use HOST_WIDE_INT_PRINT_DEC instead of "%ld". (encode_type): Handle the 'const' qualifier here. (objc_parmlist): New global variable, sued by objc_push_parm and objc_get_parm_info(). (objc_push_parm, objc_get_parm_info): New functions. (objc_expr_last): Remove function. (synth_self_and_ucmd_args): For instance methods, use the instance type for 'self'; call objc_push_parm() instead of push_parm_decl(). (start_method_def): Do not call push_scope(), declare_parm_level(), pop_scope(), push_parm_decl(), store_parm_decls() or objc_expr_last(); just use objc_push_parm() and objc_get_parm_info(). (comp_method_with_proto): Remove function. (objc_types_are_equivalent): Strip away indirections before comparing underlying types. (comp_proto_with_proto): Do not call groktypename(); types are no longer in raw declspec format. (objc_start_function): New function. (really_start_method): Call comp_proto_with_proto() instead of comp_method_with_proto(); call objc_start_function() instead of hand-crafting a function declarator. (continue_method_def, objc_expand_function_end): Remove functions. (get_super_receiver): Call objc_get_current_scope() instead of get_current_scope(); reference 'super_class' field (instead of 'class'). (finish_method_def): Rename to objc_finish_method_definition() and add a function decl parameter; move method encoding call from objc_expand_function_end(). (is_complex_decl, adorn_decl, gen_declarator, gen_declspecs, gen_declaration_1): Remove functions. (tmpbuf, RAW_DECLSPEC): Remove. (gen_declaration): Remove second parameter; simplify to deal with TYPE_P nodes instead of raw declspecs. (gen_type_name, gen_type_name_0): New functions. (gen_method_decl): Remove second parameter; call gen_type_name() instead of gen_declaration_1(). (dump_interface): Adjust calls to gen_declaration() and gen_method_decl(); do not allocate a separate string buffer. (init_objc): Allocate a larger string buffer to accommodate dump_interface(); adjust call to build_module_descriptor(); add call to build_module_initializer_routine() for the GNU runtime. (generate_classref_translation_entry): Do not call start_decl(); call finish_var_decl() instead of finish_decl(); call convert() instead of build_c_cast(). * objc-act.h (CLASS_OWN_IVARS): Remove accessor. (CLASS_BINFO_ELTS): Reduce from 6 to 5, now that CLASS_OWN_IVARS is gone. (OCTI_GNU_INIT_DECL, GNU_INIT_decl): New. (OCTI_ELLIPSIS_NODE, objc_ellipsis_node): Remove. (OCTI_ID_ID, id_type, objc_id_id): Rename to OCTI_ID_NAME, objc_object_type and objc_object_name, respectively. (OCTI_CLS_REF, OCTI_CLASS_NAME, objc_class_reference, objc_class_name): New. (IS_CLASS): New macro. (IS_ID, IS_SUPER): Robustify. (OCTI_EXECCLASS_DECL, execclass_decl): New. (finish_file, start_class, continue_class, finish_class, start_method_def, continue_method_def, finish_method_def, start_protocol, finish_protocol, objc_build_throw_stmt, objc_build_try_catch_finally_stmt, objc_build_synchronized_prologue, objc_build_synchronized_epilogue, objc_build_try_prologue, objc_build_try_epilogue, objc_build_catch_stmt, objc_build_catch_epilogue, objc_build_finally_prologue, objc_build_finally_epilogue, is_ivar, is_private, is_public, add_instance_variable, objc_add_method, get_super_receiver, objc_clear_super_receiver, get_class_ivars_from_name, get_class_reference, get_static_reference, get_object_reference, build_message_expr, finish_message_expr, build_selector_expr, build_ivar_reference, build_keyword_decl, build_method_decl, build_protocol_expr, build_objc_string_object, objc_declare_alias, objc_declare_class, objc_declare_protocols, objc_comptypes, objc_check_decl, build_encode_expr): Remove prototypes. (imp_count, cat_count): Make GGC-aware. (OBJC_SET_TYPE_NAME): New macro. From-SVN: r87168
2004-09-08 02:49:44 +02:00
tree field_decl, field_decl_chain;
1996-07-04 00:07:53 +02:00
/* Generate an unnamed struct definition. */
objc_ivar_list_record = start_struct (RECORD_TYPE, NULL_TREE);
/* int method_count; */
Makefile.in (c-parse.o): Depend on $(C_COMMON_H). [gcc/ChangeLog] 2004-09-07 Ziemowit Laski <zlaski@apple.com> * Makefile.in (c-parse.o): Depend on $(C_COMMON_H). * c-parse.in: Include c-common.h instead of objc-act.h. (ivar_decl_list, ivar_decls, ivar_decl, ivars, ivar_declarator, myparms, myparm): Remove %type declarations. (methodtype, optparms, OBJC_TYPE_QUAL, objc_quals, objc_qual, objc_typename, objc_try_catch_stmt, optellipsis): Add %type declarations. (objc_inherit_code, objc_public_flag): Remove. (typespec_nonreserved_nonattr): Call objc_get_protocol_qualified_type() instead of get_static_reference() and get_protocol_reference(). (stmt_nocomp): Call grokparm() on @catch parameter. (objcdef): Move semantic action to objc_finish_implementation(). (classdef): Move semantic action to objc_start_class_interface(), objc_continue_interface(), objc_finish_interface(), objc_start_class_implementation(), objc_continue_implementation(), objc_start_category_interface() and objc_start_category_implementation(). (protocoldef): Move semantic actions to objc_start_protocol() and objc_finish_interface(). (ivar_decl_list): Remove nonterminal. (visibility_spec): Move semantic actions to objc_set_visibility(). (ivar_decls): Remove assignment to $$. (ivar_decl): Rephrase in terms of component_decl; call objc_add_instance_variable(). (ivars, ivar_declarator): Remove nonterminals. (opt_semi): New nonterminal. (methodtype): Remove semantic actions. (methoddef): Move semantic actions to objc_set_method_type(), objc_start_method_definition() and objc_finish_method_definition(). (methodproto): Move semantic actions to objc_set_method_type() and objc_add_method_declaration(). (methoddecl): Use objc_typename instead of typename; move semantic actions to objc_build_method_signature(). (optarglist, myxdecls, mydecl, myparms, myparm): Remove nonterminals. (optparmlist): Express in terms of optparms and optellipsis. (optparms, optellipsis, objc_qual, objc_quals, objc_typename): New nonterminals. (keyworddecl): Use objc_typename instead of typename. (rid_to_yy): Mark RID_IN, RID_OUT, RID_INOUT, RID_BYCOPY, RID_BYREF and RID_ONEWAY as returning OBJC_TYPE_QUAL to yyparse(). [gcc/objc/ChangeLog] 2004-09-07 Ziemowit Laski <zlaski@apple.com> * Make-lang.in (objc/objc-parse.o): Depend on $(C_COMMON_H) instead of objc/objc-act.h. (objc/objc-act.o): Depend on $(HASHTAB_H). * objc-act.c: Include hashtab.h; in ObjC++ mode, include cp-tree.h and objcp-decl.h instead of c-tree.h. (build_module_descriptor, get_class_ivars, synth_id_with_class_suffix, error_with_ivar, gen_method_decl, gen_declaration, setup_string_decl, build_protocol_template): Adjust prototypes. (build_module_initializer_routine, start_class, continue_class, finish_class, start_method_def, objc_start_function, start_protocol, build_method_decl, objc_add_method, add_instance_variable, build_ivar_reference, is_ivar, is_private, get_super_receiver, build_selector_table_decl, objc_push_parm, objc_get_parm_info, gen_type_name, gen_type_name_0, start_var_decl, finish_var_decl, create_field_decl): New prototypes. (objc_expand_function_end, comp_method_with_proto, objc_expr_last, gen_declaration_1, gen_declarator, is_complex_decl, adorn_decl, define_decl, create_builtin_decl, gen_declspecs): Remove prototypes. (TYPE_ID): Rename to OBJECT_TYPEDEF_NAME. (CLASS_TYPEDEF_NAME): New. (TAG_EXECCLASS): Change from a global variable to a #define. (TAG_RETURN_STRUCT): Delete. (TAG_GNUINIT): New, holds '__objc_gnu_init' name. (objc_inherit_code, objc_public_flag): New, moved from c-parse.in. (string_descriptor): New struct. (string_htab): New hash table. (string_hash, string_eq): New prototypes. (generate_struct_by_value_array): Call create_field_decl() instead of create_builtin_decl(). (objc_init): Do not initialize objc_ellipsis_node or TAG_EXECCLASS; In ObjC++ mode, call cxx_init() instead of c_objc_common_init(). (objc_finish_file): In ObjC++, call instantiate_pending_templates() and cp_finish_file(). (define_decl, get_static_reference, get_protocol_reference, create_builtin_decl): Remove functions. (objc_start_class_interface, objc_start_category_interface, objc_start_protocol, objc_continue_interface, objc_finish_interface, objc_start_class_implementation, objc_start_category_implementation, objc_continue_implementation, objc_finish_implementation, objc_set_visibility, objc_set_method_type, objc_build_method_signature, objc_add_method_declaration, objc_start_method_definition, objc_add_instance_variable, objc_get_protocol_qualified_type, create_field_decl, start_var_decl, finish_var_decl): New functions. (setup_string_decl): Simplify since it is only called once. (synth_module_prologue): Call build_class_template(); predefine 'id' and 'Class' as typedefs; rename 'temp_type' to 'type'; disable debug hooks for duration of function; fix GNU runtime messenger signatures to correspond to reality; forward-declare '__objc_exec_class' for the GNU runtime; call build_selector_table_decl(); in ObjC++ mode, generate 'extern "C" { ... }' wrappers around synthesized declarations; call build_protocol_template() and build_category_template(). (string_hash, string_eq): New functions. (objc_build_string_object): Check metaclass correctness only once; store string literals in hash table. (objc_build_constructor): Do not convert initializer elements; adjust for ObjC++ impedance mismatch. (build_objc_symtab_template): Call create_field_decl() instead of create_builtin_decl(). (init_objc_symtab): Add missing conversion to initializer element. (build_metadata_decl): Call start_var_decl() instead of define_decl(). (generate_objc_symtab_decl): Do not call build_category_template(); call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(). (build_module_descriptor): Call create_field_decl() instead of grokfield(); call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(); always mark module descriptor as used; move GNU runtime-specific functionality to build_module_initializer_routine(). (build_module_initializer_routine): New function, broken off of build_module_descriptor(). (objc_static_init_needed_p, objc_generate_static_init_call): New functions. (generate_static_references, generate_strings, build_selector_translation_table, generate_descriptor_table, generate_ivars_list, generate_dispatch_table, generate_category): Call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(); build a type directly instead of via groktypename(). (build_selector_reference_decl, build_selector_table_decl, build_class_reference_decl, build_protocol_reference, generate_objc_image_info): Call start_var_decl() instead of build_decl(). (build_selector_reference): For GNU runtime, do not call build_selector_reference_decl(). (build_selector, build_typed_selector_reference): Always convert result to the selector type. (add_objc_string): Cast return value to 'char *'. (build_method_prototype_template, build_selector_template, build_method_template): Use actual selector type for fields pointing to selectors. (finish_objc): For GNU runtime, call build_module_initializer_routine() after build_module_descriptor(). (generate_protocol_list, generate_shared_structures): Call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(); build a type directly instead of via groktypename(). (synth_id_with_class_suffix): Return a string. (get_arg_type_list): For instance methods, use the instance type for 'self'; do not call groktypename_in_parm_context(). (build_objc_string_decl): Squash redeclaration errors in ObjC++. (objc_is_class_name): Use OBJC_TYPE_NAME instead of TYPE_NAME; handle RECORD_TYPEs in ObjC as well as ObjC++. (objc_is_id): New function. (objc_is_object_ptr): Return the canonical type node. (objc_get_class_ivars): Simplify using get_class_ivars(). (get_class_ivars): Remove second parameter; create a fresh copy of the ivar list for each call; do not check for existence of super class. (objc_eh_runtime_type): Mark #ifndef OBJCPLUS. (objc_init_exceptions): When using SJLJ-style exceptions, require the use of '-fobjc-exceptions' flag; do not require it for DWARF-style exceptions. (objc_build_exc_ptr, next_sjlj_build_try_catch_finally): Use objc_object_type instead of objc_id_type. (objc_begin_catch_clause): Convert the incoming PARM_DECL into a VAR_DECL before placing it in the appropriate scope; do not call define_decl(); adjust call to c_begin_compound_stmt(); use objc_object_type instead of objc_id_type. (build_next_objc_exception_stuff): Call create_field_decl() instead of create_builtin_decl(); construct type directly instead of calling groktypename(); use OBJC_VOID_AT_END to mark end of function parameters. (build_private_template): Adjust call to get_class_ivars(); build a type directly instead of via groktypename(). (build_protocol_template, build_method_prototype_list_template, build_method_prototype_template, build_category_template, build_selector_template, build_class_template, build_super_template, build_ivar_template, build_ivar_list_template, build_method_list_template, build_method_template): Call create_field_decl() instead of grokfield(). (objc_method_parm_type): Do not call groktypename(). (generate_descriptor_table): Call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(). (generate_method_descriptors, build_protocol_initializer, generate_dispatch_tables, build_category_initializer, build_shared_structure_initializer): Do not call groktypename(). (generate_protocols): Call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(); do not call groktypename(). (error_with_ivar): Remove last parameter. (check_ivars): Do not iterate ovar CLASS_RAW_IVARS lists in addition to CLASS_IVARS lists; adjust calls to error_with_ivar(). (generate_ivar_lists): Convert one of the initializer elements; do not call groktypename(). (get_arg_type_list, start_method_def, gen_method_def): Account for new representation of variable arguments and '...' in Objective-C methods; add Objective-C++ impedance matching code. (is_objc_type_qualifier): Remove function. (adjust_type_for_id_default): Simplify; there is no longer a need to wade through declspecs. (lookup_interface, start_class, continue_class, finish_class, start_method_def, start_protocol, build_method_decl, objc_add_method, add_instance_variable, build_ivar_reference, is_ivar, is_private, get_super_receiver, objc_build_finally_epilogue): Make into static functions. (receiver_is_class_object): Use new IS_CLASS() macro. (objc_build_message_expr): Tweak ObjC++ message argument handling; call objc_finish_message_expr() instead of finish_message_expr(). (finish_message_expr): Rename to objc_finish_message_expr(); use OBJC_TYPE_NAME and OBJC_SET_TYPE_NAME macros instead of TYPE_NAME. call gen_type_name() instead of gen_declaration(); call objc_is_id() instead of using IS_ID and IS_CLASS; Use objc_class_name instead of calling get_identifier("Class"); handle CONVERT_EXPRs in receiver. (build_objc_method_call, warn_with_method): Do not call groktypename(). (build_ivar_reference): Call convert() instead of clobbering in a type. (hash_init): Initialize string_htab hash table. (add_instance_variable): Simplify parameter list; do not call grokfield(); do not populate CLASS_IVARS list. (start_class): Check for the existence of super class, if one was specified. (continue_class): Use CLASS_RAW_IVARS rather than CLASS_IVARS; do not call build_class_template(); adjust call to get_class_ivars(); call build_decl(), pushdecl() and finish_decl() instead of define_decl(). (finish_class): Call build_decl(), pushdecl() and finish_decl() instead of define_decl(). (add_protocols): Use PROTOCOL_BINFO_ELTS for the tree vector size. (start_protocol): Do not call build_protocol_template(); use PROTOCOL_BINFO_ELTS for the tree vector size. (encode_type_qualifiers): Do not handle the 'const' qualifier here. (encode_pointer): Encode 'const char *' as 'r*', for backwards compatibility. (encode_array): Use HOST_WIDE_INT_PRINT_DEC instead of "%ld". (encode_type): Handle the 'const' qualifier here. (objc_parmlist): New global variable, sued by objc_push_parm and objc_get_parm_info(). (objc_push_parm, objc_get_parm_info): New functions. (objc_expr_last): Remove function. (synth_self_and_ucmd_args): For instance methods, use the instance type for 'self'; call objc_push_parm() instead of push_parm_decl(). (start_method_def): Do not call push_scope(), declare_parm_level(), pop_scope(), push_parm_decl(), store_parm_decls() or objc_expr_last(); just use objc_push_parm() and objc_get_parm_info(). (comp_method_with_proto): Remove function. (objc_types_are_equivalent): Strip away indirections before comparing underlying types. (comp_proto_with_proto): Do not call groktypename(); types are no longer in raw declspec format. (objc_start_function): New function. (really_start_method): Call comp_proto_with_proto() instead of comp_method_with_proto(); call objc_start_function() instead of hand-crafting a function declarator. (continue_method_def, objc_expand_function_end): Remove functions. (get_super_receiver): Call objc_get_current_scope() instead of get_current_scope(); reference 'super_class' field (instead of 'class'). (finish_method_def): Rename to objc_finish_method_definition() and add a function decl parameter; move method encoding call from objc_expand_function_end(). (is_complex_decl, adorn_decl, gen_declarator, gen_declspecs, gen_declaration_1): Remove functions. (tmpbuf, RAW_DECLSPEC): Remove. (gen_declaration): Remove second parameter; simplify to deal with TYPE_P nodes instead of raw declspecs. (gen_type_name, gen_type_name_0): New functions. (gen_method_decl): Remove second parameter; call gen_type_name() instead of gen_declaration_1(). (dump_interface): Adjust calls to gen_declaration() and gen_method_decl(); do not allocate a separate string buffer. (init_objc): Allocate a larger string buffer to accommodate dump_interface(); adjust call to build_module_descriptor(); add call to build_module_initializer_routine() for the GNU runtime. (generate_classref_translation_entry): Do not call start_decl(); call finish_var_decl() instead of finish_decl(); call convert() instead of build_c_cast(). * objc-act.h (CLASS_OWN_IVARS): Remove accessor. (CLASS_BINFO_ELTS): Reduce from 6 to 5, now that CLASS_OWN_IVARS is gone. (OCTI_GNU_INIT_DECL, GNU_INIT_decl): New. (OCTI_ELLIPSIS_NODE, objc_ellipsis_node): Remove. (OCTI_ID_ID, id_type, objc_id_id): Rename to OCTI_ID_NAME, objc_object_type and objc_object_name, respectively. (OCTI_CLS_REF, OCTI_CLASS_NAME, objc_class_reference, objc_class_name): New. (IS_CLASS): New macro. (IS_ID, IS_SUPER): Robustify. (OCTI_EXECCLASS_DECL, execclass_decl): New. (finish_file, start_class, continue_class, finish_class, start_method_def, continue_method_def, finish_method_def, start_protocol, finish_protocol, objc_build_throw_stmt, objc_build_try_catch_finally_stmt, objc_build_synchronized_prologue, objc_build_synchronized_epilogue, objc_build_try_prologue, objc_build_try_epilogue, objc_build_catch_stmt, objc_build_catch_epilogue, objc_build_finally_prologue, objc_build_finally_epilogue, is_ivar, is_private, is_public, add_instance_variable, objc_add_method, get_super_receiver, objc_clear_super_receiver, get_class_ivars_from_name, get_class_reference, get_static_reference, get_object_reference, build_message_expr, finish_message_expr, build_selector_expr, build_ivar_reference, build_keyword_decl, build_method_decl, build_protocol_expr, build_objc_string_object, objc_declare_alias, objc_declare_class, objc_declare_protocols, objc_comptypes, objc_check_decl, build_encode_expr): Remove prototypes. (imp_count, cat_count): Make GGC-aware. (OBJC_SET_TYPE_NAME): New macro. From-SVN: r87168
2004-09-08 02:49:44 +02:00
field_decl = create_field_decl (integer_type_node, "method_count");
field_decl_chain = field_decl;
/* struct objc_method method_list[]; */
Makefile.in (c-parse.o): Depend on $(C_COMMON_H). [gcc/ChangeLog] 2004-09-07 Ziemowit Laski <zlaski@apple.com> * Makefile.in (c-parse.o): Depend on $(C_COMMON_H). * c-parse.in: Include c-common.h instead of objc-act.h. (ivar_decl_list, ivar_decls, ivar_decl, ivars, ivar_declarator, myparms, myparm): Remove %type declarations. (methodtype, optparms, OBJC_TYPE_QUAL, objc_quals, objc_qual, objc_typename, objc_try_catch_stmt, optellipsis): Add %type declarations. (objc_inherit_code, objc_public_flag): Remove. (typespec_nonreserved_nonattr): Call objc_get_protocol_qualified_type() instead of get_static_reference() and get_protocol_reference(). (stmt_nocomp): Call grokparm() on @catch parameter. (objcdef): Move semantic action to objc_finish_implementation(). (classdef): Move semantic action to objc_start_class_interface(), objc_continue_interface(), objc_finish_interface(), objc_start_class_implementation(), objc_continue_implementation(), objc_start_category_interface() and objc_start_category_implementation(). (protocoldef): Move semantic actions to objc_start_protocol() and objc_finish_interface(). (ivar_decl_list): Remove nonterminal. (visibility_spec): Move semantic actions to objc_set_visibility(). (ivar_decls): Remove assignment to $$. (ivar_decl): Rephrase in terms of component_decl; call objc_add_instance_variable(). (ivars, ivar_declarator): Remove nonterminals. (opt_semi): New nonterminal. (methodtype): Remove semantic actions. (methoddef): Move semantic actions to objc_set_method_type(), objc_start_method_definition() and objc_finish_method_definition(). (methodproto): Move semantic actions to objc_set_method_type() and objc_add_method_declaration(). (methoddecl): Use objc_typename instead of typename; move semantic actions to objc_build_method_signature(). (optarglist, myxdecls, mydecl, myparms, myparm): Remove nonterminals. (optparmlist): Express in terms of optparms and optellipsis. (optparms, optellipsis, objc_qual, objc_quals, objc_typename): New nonterminals. (keyworddecl): Use objc_typename instead of typename. (rid_to_yy): Mark RID_IN, RID_OUT, RID_INOUT, RID_BYCOPY, RID_BYREF and RID_ONEWAY as returning OBJC_TYPE_QUAL to yyparse(). [gcc/objc/ChangeLog] 2004-09-07 Ziemowit Laski <zlaski@apple.com> * Make-lang.in (objc/objc-parse.o): Depend on $(C_COMMON_H) instead of objc/objc-act.h. (objc/objc-act.o): Depend on $(HASHTAB_H). * objc-act.c: Include hashtab.h; in ObjC++ mode, include cp-tree.h and objcp-decl.h instead of c-tree.h. (build_module_descriptor, get_class_ivars, synth_id_with_class_suffix, error_with_ivar, gen_method_decl, gen_declaration, setup_string_decl, build_protocol_template): Adjust prototypes. (build_module_initializer_routine, start_class, continue_class, finish_class, start_method_def, objc_start_function, start_protocol, build_method_decl, objc_add_method, add_instance_variable, build_ivar_reference, is_ivar, is_private, get_super_receiver, build_selector_table_decl, objc_push_parm, objc_get_parm_info, gen_type_name, gen_type_name_0, start_var_decl, finish_var_decl, create_field_decl): New prototypes. (objc_expand_function_end, comp_method_with_proto, objc_expr_last, gen_declaration_1, gen_declarator, is_complex_decl, adorn_decl, define_decl, create_builtin_decl, gen_declspecs): Remove prototypes. (TYPE_ID): Rename to OBJECT_TYPEDEF_NAME. (CLASS_TYPEDEF_NAME): New. (TAG_EXECCLASS): Change from a global variable to a #define. (TAG_RETURN_STRUCT): Delete. (TAG_GNUINIT): New, holds '__objc_gnu_init' name. (objc_inherit_code, objc_public_flag): New, moved from c-parse.in. (string_descriptor): New struct. (string_htab): New hash table. (string_hash, string_eq): New prototypes. (generate_struct_by_value_array): Call create_field_decl() instead of create_builtin_decl(). (objc_init): Do not initialize objc_ellipsis_node or TAG_EXECCLASS; In ObjC++ mode, call cxx_init() instead of c_objc_common_init(). (objc_finish_file): In ObjC++, call instantiate_pending_templates() and cp_finish_file(). (define_decl, get_static_reference, get_protocol_reference, create_builtin_decl): Remove functions. (objc_start_class_interface, objc_start_category_interface, objc_start_protocol, objc_continue_interface, objc_finish_interface, objc_start_class_implementation, objc_start_category_implementation, objc_continue_implementation, objc_finish_implementation, objc_set_visibility, objc_set_method_type, objc_build_method_signature, objc_add_method_declaration, objc_start_method_definition, objc_add_instance_variable, objc_get_protocol_qualified_type, create_field_decl, start_var_decl, finish_var_decl): New functions. (setup_string_decl): Simplify since it is only called once. (synth_module_prologue): Call build_class_template(); predefine 'id' and 'Class' as typedefs; rename 'temp_type' to 'type'; disable debug hooks for duration of function; fix GNU runtime messenger signatures to correspond to reality; forward-declare '__objc_exec_class' for the GNU runtime; call build_selector_table_decl(); in ObjC++ mode, generate 'extern "C" { ... }' wrappers around synthesized declarations; call build_protocol_template() and build_category_template(). (string_hash, string_eq): New functions. (objc_build_string_object): Check metaclass correctness only once; store string literals in hash table. (objc_build_constructor): Do not convert initializer elements; adjust for ObjC++ impedance mismatch. (build_objc_symtab_template): Call create_field_decl() instead of create_builtin_decl(). (init_objc_symtab): Add missing conversion to initializer element. (build_metadata_decl): Call start_var_decl() instead of define_decl(). (generate_objc_symtab_decl): Do not call build_category_template(); call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(). (build_module_descriptor): Call create_field_decl() instead of grokfield(); call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(); always mark module descriptor as used; move GNU runtime-specific functionality to build_module_initializer_routine(). (build_module_initializer_routine): New function, broken off of build_module_descriptor(). (objc_static_init_needed_p, objc_generate_static_init_call): New functions. (generate_static_references, generate_strings, build_selector_translation_table, generate_descriptor_table, generate_ivars_list, generate_dispatch_table, generate_category): Call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(); build a type directly instead of via groktypename(). (build_selector_reference_decl, build_selector_table_decl, build_class_reference_decl, build_protocol_reference, generate_objc_image_info): Call start_var_decl() instead of build_decl(). (build_selector_reference): For GNU runtime, do not call build_selector_reference_decl(). (build_selector, build_typed_selector_reference): Always convert result to the selector type. (add_objc_string): Cast return value to 'char *'. (build_method_prototype_template, build_selector_template, build_method_template): Use actual selector type for fields pointing to selectors. (finish_objc): For GNU runtime, call build_module_initializer_routine() after build_module_descriptor(). (generate_protocol_list, generate_shared_structures): Call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(); build a type directly instead of via groktypename(). (synth_id_with_class_suffix): Return a string. (get_arg_type_list): For instance methods, use the instance type for 'self'; do not call groktypename_in_parm_context(). (build_objc_string_decl): Squash redeclaration errors in ObjC++. (objc_is_class_name): Use OBJC_TYPE_NAME instead of TYPE_NAME; handle RECORD_TYPEs in ObjC as well as ObjC++. (objc_is_id): New function. (objc_is_object_ptr): Return the canonical type node. (objc_get_class_ivars): Simplify using get_class_ivars(). (get_class_ivars): Remove second parameter; create a fresh copy of the ivar list for each call; do not check for existence of super class. (objc_eh_runtime_type): Mark #ifndef OBJCPLUS. (objc_init_exceptions): When using SJLJ-style exceptions, require the use of '-fobjc-exceptions' flag; do not require it for DWARF-style exceptions. (objc_build_exc_ptr, next_sjlj_build_try_catch_finally): Use objc_object_type instead of objc_id_type. (objc_begin_catch_clause): Convert the incoming PARM_DECL into a VAR_DECL before placing it in the appropriate scope; do not call define_decl(); adjust call to c_begin_compound_stmt(); use objc_object_type instead of objc_id_type. (build_next_objc_exception_stuff): Call create_field_decl() instead of create_builtin_decl(); construct type directly instead of calling groktypename(); use OBJC_VOID_AT_END to mark end of function parameters. (build_private_template): Adjust call to get_class_ivars(); build a type directly instead of via groktypename(). (build_protocol_template, build_method_prototype_list_template, build_method_prototype_template, build_category_template, build_selector_template, build_class_template, build_super_template, build_ivar_template, build_ivar_list_template, build_method_list_template, build_method_template): Call create_field_decl() instead of grokfield(). (objc_method_parm_type): Do not call groktypename(). (generate_descriptor_table): Call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(). (generate_method_descriptors, build_protocol_initializer, generate_dispatch_tables, build_category_initializer, build_shared_structure_initializer): Do not call groktypename(). (generate_protocols): Call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(); do not call groktypename(). (error_with_ivar): Remove last parameter. (check_ivars): Do not iterate ovar CLASS_RAW_IVARS lists in addition to CLASS_IVARS lists; adjust calls to error_with_ivar(). (generate_ivar_lists): Convert one of the initializer elements; do not call groktypename(). (get_arg_type_list, start_method_def, gen_method_def): Account for new representation of variable arguments and '...' in Objective-C methods; add Objective-C++ impedance matching code. (is_objc_type_qualifier): Remove function. (adjust_type_for_id_default): Simplify; there is no longer a need to wade through declspecs. (lookup_interface, start_class, continue_class, finish_class, start_method_def, start_protocol, build_method_decl, objc_add_method, add_instance_variable, build_ivar_reference, is_ivar, is_private, get_super_receiver, objc_build_finally_epilogue): Make into static functions. (receiver_is_class_object): Use new IS_CLASS() macro. (objc_build_message_expr): Tweak ObjC++ message argument handling; call objc_finish_message_expr() instead of finish_message_expr(). (finish_message_expr): Rename to objc_finish_message_expr(); use OBJC_TYPE_NAME and OBJC_SET_TYPE_NAME macros instead of TYPE_NAME. call gen_type_name() instead of gen_declaration(); call objc_is_id() instead of using IS_ID and IS_CLASS; Use objc_class_name instead of calling get_identifier("Class"); handle CONVERT_EXPRs in receiver. (build_objc_method_call, warn_with_method): Do not call groktypename(). (build_ivar_reference): Call convert() instead of clobbering in a type. (hash_init): Initialize string_htab hash table. (add_instance_variable): Simplify parameter list; do not call grokfield(); do not populate CLASS_IVARS list. (start_class): Check for the existence of super class, if one was specified. (continue_class): Use CLASS_RAW_IVARS rather than CLASS_IVARS; do not call build_class_template(); adjust call to get_class_ivars(); call build_decl(), pushdecl() and finish_decl() instead of define_decl(). (finish_class): Call build_decl(), pushdecl() and finish_decl() instead of define_decl(). (add_protocols): Use PROTOCOL_BINFO_ELTS for the tree vector size. (start_protocol): Do not call build_protocol_template(); use PROTOCOL_BINFO_ELTS for the tree vector size. (encode_type_qualifiers): Do not handle the 'const' qualifier here. (encode_pointer): Encode 'const char *' as 'r*', for backwards compatibility. (encode_array): Use HOST_WIDE_INT_PRINT_DEC instead of "%ld". (encode_type): Handle the 'const' qualifier here. (objc_parmlist): New global variable, sued by objc_push_parm and objc_get_parm_info(). (objc_push_parm, objc_get_parm_info): New functions. (objc_expr_last): Remove function. (synth_self_and_ucmd_args): For instance methods, use the instance type for 'self'; call objc_push_parm() instead of push_parm_decl(). (start_method_def): Do not call push_scope(), declare_parm_level(), pop_scope(), push_parm_decl(), store_parm_decls() or objc_expr_last(); just use objc_push_parm() and objc_get_parm_info(). (comp_method_with_proto): Remove function. (objc_types_are_equivalent): Strip away indirections before comparing underlying types. (comp_proto_with_proto): Do not call groktypename(); types are no longer in raw declspec format. (objc_start_function): New function. (really_start_method): Call comp_proto_with_proto() instead of comp_method_with_proto(); call objc_start_function() instead of hand-crafting a function declarator. (continue_method_def, objc_expand_function_end): Remove functions. (get_super_receiver): Call objc_get_current_scope() instead of get_current_scope(); reference 'super_class' field (instead of 'class'). (finish_method_def): Rename to objc_finish_method_definition() and add a function decl parameter; move method encoding call from objc_expand_function_end(). (is_complex_decl, adorn_decl, gen_declarator, gen_declspecs, gen_declaration_1): Remove functions. (tmpbuf, RAW_DECLSPEC): Remove. (gen_declaration): Remove second parameter; simplify to deal with TYPE_P nodes instead of raw declspecs. (gen_type_name, gen_type_name_0): New functions. (gen_method_decl): Remove second parameter; call gen_type_name() instead of gen_declaration_1(). (dump_interface): Adjust calls to gen_declaration() and gen_method_decl(); do not allocate a separate string buffer. (init_objc): Allocate a larger string buffer to accommodate dump_interface(); adjust call to build_module_descriptor(); add call to build_module_initializer_routine() for the GNU runtime. (generate_classref_translation_entry): Do not call start_decl(); call finish_var_decl() instead of finish_decl(); call convert() instead of build_c_cast(). * objc-act.h (CLASS_OWN_IVARS): Remove accessor. (CLASS_BINFO_ELTS): Reduce from 6 to 5, now that CLASS_OWN_IVARS is gone. (OCTI_GNU_INIT_DECL, GNU_INIT_decl): New. (OCTI_ELLIPSIS_NODE, objc_ellipsis_node): Remove. (OCTI_ID_ID, id_type, objc_id_id): Rename to OCTI_ID_NAME, objc_object_type and objc_object_name, respectively. (OCTI_CLS_REF, OCTI_CLASS_NAME, objc_class_reference, objc_class_name): New. (IS_CLASS): New macro. (IS_ID, IS_SUPER): Robustify. (OCTI_EXECCLASS_DECL, execclass_decl): New. (finish_file, start_class, continue_class, finish_class, start_method_def, continue_method_def, finish_method_def, start_protocol, finish_protocol, objc_build_throw_stmt, objc_build_try_catch_finally_stmt, objc_build_synchronized_prologue, objc_build_synchronized_epilogue, objc_build_try_prologue, objc_build_try_epilogue, objc_build_catch_stmt, objc_build_catch_epilogue, objc_build_finally_prologue, objc_build_finally_epilogue, is_ivar, is_private, is_public, add_instance_variable, objc_add_method, get_super_receiver, objc_clear_super_receiver, get_class_ivars_from_name, get_class_reference, get_static_reference, get_object_reference, build_message_expr, finish_message_expr, build_selector_expr, build_ivar_reference, build_keyword_decl, build_method_decl, build_protocol_expr, build_objc_string_object, objc_declare_alias, objc_declare_class, objc_declare_protocols, objc_comptypes, objc_check_decl, build_encode_expr): Remove prototypes. (imp_count, cat_count): Make GGC-aware. (OBJC_SET_TYPE_NAME): New macro. From-SVN: r87168
2004-09-08 02:49:44 +02:00
field_decl = create_field_decl (build_array_type
(list_type,
build_index_type
(build_int_cst (NULL_TREE, size - 1))),
"method_list");
chainon (field_decl_chain, field_decl);
finish_struct (objc_ivar_list_record, field_decl_chain, NULL_TREE);
return objc_ivar_list_record;
}
static tree
build_method_prototype_template (void)
{
tree proto_record;
Makefile.in (c-parse.o): Depend on $(C_COMMON_H). [gcc/ChangeLog] 2004-09-07 Ziemowit Laski <zlaski@apple.com> * Makefile.in (c-parse.o): Depend on $(C_COMMON_H). * c-parse.in: Include c-common.h instead of objc-act.h. (ivar_decl_list, ivar_decls, ivar_decl, ivars, ivar_declarator, myparms, myparm): Remove %type declarations. (methodtype, optparms, OBJC_TYPE_QUAL, objc_quals, objc_qual, objc_typename, objc_try_catch_stmt, optellipsis): Add %type declarations. (objc_inherit_code, objc_public_flag): Remove. (typespec_nonreserved_nonattr): Call objc_get_protocol_qualified_type() instead of get_static_reference() and get_protocol_reference(). (stmt_nocomp): Call grokparm() on @catch parameter. (objcdef): Move semantic action to objc_finish_implementation(). (classdef): Move semantic action to objc_start_class_interface(), objc_continue_interface(), objc_finish_interface(), objc_start_class_implementation(), objc_continue_implementation(), objc_start_category_interface() and objc_start_category_implementation(). (protocoldef): Move semantic actions to objc_start_protocol() and objc_finish_interface(). (ivar_decl_list): Remove nonterminal. (visibility_spec): Move semantic actions to objc_set_visibility(). (ivar_decls): Remove assignment to $$. (ivar_decl): Rephrase in terms of component_decl; call objc_add_instance_variable(). (ivars, ivar_declarator): Remove nonterminals. (opt_semi): New nonterminal. (methodtype): Remove semantic actions. (methoddef): Move semantic actions to objc_set_method_type(), objc_start_method_definition() and objc_finish_method_definition(). (methodproto): Move semantic actions to objc_set_method_type() and objc_add_method_declaration(). (methoddecl): Use objc_typename instead of typename; move semantic actions to objc_build_method_signature(). (optarglist, myxdecls, mydecl, myparms, myparm): Remove nonterminals. (optparmlist): Express in terms of optparms and optellipsis. (optparms, optellipsis, objc_qual, objc_quals, objc_typename): New nonterminals. (keyworddecl): Use objc_typename instead of typename. (rid_to_yy): Mark RID_IN, RID_OUT, RID_INOUT, RID_BYCOPY, RID_BYREF and RID_ONEWAY as returning OBJC_TYPE_QUAL to yyparse(). [gcc/objc/ChangeLog] 2004-09-07 Ziemowit Laski <zlaski@apple.com> * Make-lang.in (objc/objc-parse.o): Depend on $(C_COMMON_H) instead of objc/objc-act.h. (objc/objc-act.o): Depend on $(HASHTAB_H). * objc-act.c: Include hashtab.h; in ObjC++ mode, include cp-tree.h and objcp-decl.h instead of c-tree.h. (build_module_descriptor, get_class_ivars, synth_id_with_class_suffix, error_with_ivar, gen_method_decl, gen_declaration, setup_string_decl, build_protocol_template): Adjust prototypes. (build_module_initializer_routine, start_class, continue_class, finish_class, start_method_def, objc_start_function, start_protocol, build_method_decl, objc_add_method, add_instance_variable, build_ivar_reference, is_ivar, is_private, get_super_receiver, build_selector_table_decl, objc_push_parm, objc_get_parm_info, gen_type_name, gen_type_name_0, start_var_decl, finish_var_decl, create_field_decl): New prototypes. (objc_expand_function_end, comp_method_with_proto, objc_expr_last, gen_declaration_1, gen_declarator, is_complex_decl, adorn_decl, define_decl, create_builtin_decl, gen_declspecs): Remove prototypes. (TYPE_ID): Rename to OBJECT_TYPEDEF_NAME. (CLASS_TYPEDEF_NAME): New. (TAG_EXECCLASS): Change from a global variable to a #define. (TAG_RETURN_STRUCT): Delete. (TAG_GNUINIT): New, holds '__objc_gnu_init' name. (objc_inherit_code, objc_public_flag): New, moved from c-parse.in. (string_descriptor): New struct. (string_htab): New hash table. (string_hash, string_eq): New prototypes. (generate_struct_by_value_array): Call create_field_decl() instead of create_builtin_decl(). (objc_init): Do not initialize objc_ellipsis_node or TAG_EXECCLASS; In ObjC++ mode, call cxx_init() instead of c_objc_common_init(). (objc_finish_file): In ObjC++, call instantiate_pending_templates() and cp_finish_file(). (define_decl, get_static_reference, get_protocol_reference, create_builtin_decl): Remove functions. (objc_start_class_interface, objc_start_category_interface, objc_start_protocol, objc_continue_interface, objc_finish_interface, objc_start_class_implementation, objc_start_category_implementation, objc_continue_implementation, objc_finish_implementation, objc_set_visibility, objc_set_method_type, objc_build_method_signature, objc_add_method_declaration, objc_start_method_definition, objc_add_instance_variable, objc_get_protocol_qualified_type, create_field_decl, start_var_decl, finish_var_decl): New functions. (setup_string_decl): Simplify since it is only called once. (synth_module_prologue): Call build_class_template(); predefine 'id' and 'Class' as typedefs; rename 'temp_type' to 'type'; disable debug hooks for duration of function; fix GNU runtime messenger signatures to correspond to reality; forward-declare '__objc_exec_class' for the GNU runtime; call build_selector_table_decl(); in ObjC++ mode, generate 'extern "C" { ... }' wrappers around synthesized declarations; call build_protocol_template() and build_category_template(). (string_hash, string_eq): New functions. (objc_build_string_object): Check metaclass correctness only once; store string literals in hash table. (objc_build_constructor): Do not convert initializer elements; adjust for ObjC++ impedance mismatch. (build_objc_symtab_template): Call create_field_decl() instead of create_builtin_decl(). (init_objc_symtab): Add missing conversion to initializer element. (build_metadata_decl): Call start_var_decl() instead of define_decl(). (generate_objc_symtab_decl): Do not call build_category_template(); call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(). (build_module_descriptor): Call create_field_decl() instead of grokfield(); call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(); always mark module descriptor as used; move GNU runtime-specific functionality to build_module_initializer_routine(). (build_module_initializer_routine): New function, broken off of build_module_descriptor(). (objc_static_init_needed_p, objc_generate_static_init_call): New functions. (generate_static_references, generate_strings, build_selector_translation_table, generate_descriptor_table, generate_ivars_list, generate_dispatch_table, generate_category): Call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(); build a type directly instead of via groktypename(). (build_selector_reference_decl, build_selector_table_decl, build_class_reference_decl, build_protocol_reference, generate_objc_image_info): Call start_var_decl() instead of build_decl(). (build_selector_reference): For GNU runtime, do not call build_selector_reference_decl(). (build_selector, build_typed_selector_reference): Always convert result to the selector type. (add_objc_string): Cast return value to 'char *'. (build_method_prototype_template, build_selector_template, build_method_template): Use actual selector type for fields pointing to selectors. (finish_objc): For GNU runtime, call build_module_initializer_routine() after build_module_descriptor(). (generate_protocol_list, generate_shared_structures): Call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(); build a type directly instead of via groktypename(). (synth_id_with_class_suffix): Return a string. (get_arg_type_list): For instance methods, use the instance type for 'self'; do not call groktypename_in_parm_context(). (build_objc_string_decl): Squash redeclaration errors in ObjC++. (objc_is_class_name): Use OBJC_TYPE_NAME instead of TYPE_NAME; handle RECORD_TYPEs in ObjC as well as ObjC++. (objc_is_id): New function. (objc_is_object_ptr): Return the canonical type node. (objc_get_class_ivars): Simplify using get_class_ivars(). (get_class_ivars): Remove second parameter; create a fresh copy of the ivar list for each call; do not check for existence of super class. (objc_eh_runtime_type): Mark #ifndef OBJCPLUS. (objc_init_exceptions): When using SJLJ-style exceptions, require the use of '-fobjc-exceptions' flag; do not require it for DWARF-style exceptions. (objc_build_exc_ptr, next_sjlj_build_try_catch_finally): Use objc_object_type instead of objc_id_type. (objc_begin_catch_clause): Convert the incoming PARM_DECL into a VAR_DECL before placing it in the appropriate scope; do not call define_decl(); adjust call to c_begin_compound_stmt(); use objc_object_type instead of objc_id_type. (build_next_objc_exception_stuff): Call create_field_decl() instead of create_builtin_decl(); construct type directly instead of calling groktypename(); use OBJC_VOID_AT_END to mark end of function parameters. (build_private_template): Adjust call to get_class_ivars(); build a type directly instead of via groktypename(). (build_protocol_template, build_method_prototype_list_template, build_method_prototype_template, build_category_template, build_selector_template, build_class_template, build_super_template, build_ivar_template, build_ivar_list_template, build_method_list_template, build_method_template): Call create_field_decl() instead of grokfield(). (objc_method_parm_type): Do not call groktypename(). (generate_descriptor_table): Call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(). (generate_method_descriptors, build_protocol_initializer, generate_dispatch_tables, build_category_initializer, build_shared_structure_initializer): Do not call groktypename(). (generate_protocols): Call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(); do not call groktypename(). (error_with_ivar): Remove last parameter. (check_ivars): Do not iterate ovar CLASS_RAW_IVARS lists in addition to CLASS_IVARS lists; adjust calls to error_with_ivar(). (generate_ivar_lists): Convert one of the initializer elements; do not call groktypename(). (get_arg_type_list, start_method_def, gen_method_def): Account for new representation of variable arguments and '...' in Objective-C methods; add Objective-C++ impedance matching code. (is_objc_type_qualifier): Remove function. (adjust_type_for_id_default): Simplify; there is no longer a need to wade through declspecs. (lookup_interface, start_class, continue_class, finish_class, start_method_def, start_protocol, build_method_decl, objc_add_method, add_instance_variable, build_ivar_reference, is_ivar, is_private, get_super_receiver, objc_build_finally_epilogue): Make into static functions. (receiver_is_class_object): Use new IS_CLASS() macro. (objc_build_message_expr): Tweak ObjC++ message argument handling; call objc_finish_message_expr() instead of finish_message_expr(). (finish_message_expr): Rename to objc_finish_message_expr(); use OBJC_TYPE_NAME and OBJC_SET_TYPE_NAME macros instead of TYPE_NAME. call gen_type_name() instead of gen_declaration(); call objc_is_id() instead of using IS_ID and IS_CLASS; Use objc_class_name instead of calling get_identifier("Class"); handle CONVERT_EXPRs in receiver. (build_objc_method_call, warn_with_method): Do not call groktypename(). (build_ivar_reference): Call convert() instead of clobbering in a type. (hash_init): Initialize string_htab hash table. (add_instance_variable): Simplify parameter list; do not call grokfield(); do not populate CLASS_IVARS list. (start_class): Check for the existence of super class, if one was specified. (continue_class): Use CLASS_RAW_IVARS rather than CLASS_IVARS; do not call build_class_template(); adjust call to get_class_ivars(); call build_decl(), pushdecl() and finish_decl() instead of define_decl(). (finish_class): Call build_decl(), pushdecl() and finish_decl() instead of define_decl(). (add_protocols): Use PROTOCOL_BINFO_ELTS for the tree vector size. (start_protocol): Do not call build_protocol_template(); use PROTOCOL_BINFO_ELTS for the tree vector size. (encode_type_qualifiers): Do not handle the 'const' qualifier here. (encode_pointer): Encode 'const char *' as 'r*', for backwards compatibility. (encode_array): Use HOST_WIDE_INT_PRINT_DEC instead of "%ld". (encode_type): Handle the 'const' qualifier here. (objc_parmlist): New global variable, sued by objc_push_parm and objc_get_parm_info(). (objc_push_parm, objc_get_parm_info): New functions. (objc_expr_last): Remove function. (synth_self_and_ucmd_args): For instance methods, use the instance type for 'self'; call objc_push_parm() instead of push_parm_decl(). (start_method_def): Do not call push_scope(), declare_parm_level(), pop_scope(), push_parm_decl(), store_parm_decls() or objc_expr_last(); just use objc_push_parm() and objc_get_parm_info(). (comp_method_with_proto): Remove function. (objc_types_are_equivalent): Strip away indirections before comparing underlying types. (comp_proto_with_proto): Do not call groktypename(); types are no longer in raw declspec format. (objc_start_function): New function. (really_start_method): Call comp_proto_with_proto() instead of comp_method_with_proto(); call objc_start_function() instead of hand-crafting a function declarator. (continue_method_def, objc_expand_function_end): Remove functions. (get_super_receiver): Call objc_get_current_scope() instead of get_current_scope(); reference 'super_class' field (instead of 'class'). (finish_method_def): Rename to objc_finish_method_definition() and add a function decl parameter; move method encoding call from objc_expand_function_end(). (is_complex_decl, adorn_decl, gen_declarator, gen_declspecs, gen_declaration_1): Remove functions. (tmpbuf, RAW_DECLSPEC): Remove. (gen_declaration): Remove second parameter; simplify to deal with TYPE_P nodes instead of raw declspecs. (gen_type_name, gen_type_name_0): New functions. (gen_method_decl): Remove second parameter; call gen_type_name() instead of gen_declaration_1(). (dump_interface): Adjust calls to gen_declaration() and gen_method_decl(); do not allocate a separate string buffer. (init_objc): Allocate a larger string buffer to accommodate dump_interface(); adjust call to build_module_descriptor(); add call to build_module_initializer_routine() for the GNU runtime. (generate_classref_translation_entry): Do not call start_decl(); call finish_var_decl() instead of finish_decl(); call convert() instead of build_c_cast(). * objc-act.h (CLASS_OWN_IVARS): Remove accessor. (CLASS_BINFO_ELTS): Reduce from 6 to 5, now that CLASS_OWN_IVARS is gone. (OCTI_GNU_INIT_DECL, GNU_INIT_decl): New. (OCTI_ELLIPSIS_NODE, objc_ellipsis_node): Remove. (OCTI_ID_ID, id_type, objc_id_id): Rename to OCTI_ID_NAME, objc_object_type and objc_object_name, respectively. (OCTI_CLS_REF, OCTI_CLASS_NAME, objc_class_reference, objc_class_name): New. (IS_CLASS): New macro. (IS_ID, IS_SUPER): Robustify. (OCTI_EXECCLASS_DECL, execclass_decl): New. (finish_file, start_class, continue_class, finish_class, start_method_def, continue_method_def, finish_method_def, start_protocol, finish_protocol, objc_build_throw_stmt, objc_build_try_catch_finally_stmt, objc_build_synchronized_prologue, objc_build_synchronized_epilogue, objc_build_try_prologue, objc_build_try_epilogue, objc_build_catch_stmt, objc_build_catch_epilogue, objc_build_finally_prologue, objc_build_finally_epilogue, is_ivar, is_private, is_public, add_instance_variable, objc_add_method, get_super_receiver, objc_clear_super_receiver, get_class_ivars_from_name, get_class_reference, get_static_reference, get_object_reference, build_message_expr, finish_message_expr, build_selector_expr, build_ivar_reference, build_keyword_decl, build_method_decl, build_protocol_expr, build_objc_string_object, objc_declare_alias, objc_declare_class, objc_declare_protocols, objc_comptypes, objc_check_decl, build_encode_expr): Remove prototypes. (imp_count, cat_count): Make GGC-aware. (OBJC_SET_TYPE_NAME): New macro. From-SVN: r87168
2004-09-08 02:49:44 +02:00
tree field_decl, field_decl_chain;
proto_record
= start_struct (RECORD_TYPE, get_identifier (UTAG_METHOD_PROTOTYPE));
Makefile.in (c-parse.o): Depend on $(C_COMMON_H). [gcc/ChangeLog] 2004-09-07 Ziemowit Laski <zlaski@apple.com> * Makefile.in (c-parse.o): Depend on $(C_COMMON_H). * c-parse.in: Include c-common.h instead of objc-act.h. (ivar_decl_list, ivar_decls, ivar_decl, ivars, ivar_declarator, myparms, myparm): Remove %type declarations. (methodtype, optparms, OBJC_TYPE_QUAL, objc_quals, objc_qual, objc_typename, objc_try_catch_stmt, optellipsis): Add %type declarations. (objc_inherit_code, objc_public_flag): Remove. (typespec_nonreserved_nonattr): Call objc_get_protocol_qualified_type() instead of get_static_reference() and get_protocol_reference(). (stmt_nocomp): Call grokparm() on @catch parameter. (objcdef): Move semantic action to objc_finish_implementation(). (classdef): Move semantic action to objc_start_class_interface(), objc_continue_interface(), objc_finish_interface(), objc_start_class_implementation(), objc_continue_implementation(), objc_start_category_interface() and objc_start_category_implementation(). (protocoldef): Move semantic actions to objc_start_protocol() and objc_finish_interface(). (ivar_decl_list): Remove nonterminal. (visibility_spec): Move semantic actions to objc_set_visibility(). (ivar_decls): Remove assignment to $$. (ivar_decl): Rephrase in terms of component_decl; call objc_add_instance_variable(). (ivars, ivar_declarator): Remove nonterminals. (opt_semi): New nonterminal. (methodtype): Remove semantic actions. (methoddef): Move semantic actions to objc_set_method_type(), objc_start_method_definition() and objc_finish_method_definition(). (methodproto): Move semantic actions to objc_set_method_type() and objc_add_method_declaration(). (methoddecl): Use objc_typename instead of typename; move semantic actions to objc_build_method_signature(). (optarglist, myxdecls, mydecl, myparms, myparm): Remove nonterminals. (optparmlist): Express in terms of optparms and optellipsis. (optparms, optellipsis, objc_qual, objc_quals, objc_typename): New nonterminals. (keyworddecl): Use objc_typename instead of typename. (rid_to_yy): Mark RID_IN, RID_OUT, RID_INOUT, RID_BYCOPY, RID_BYREF and RID_ONEWAY as returning OBJC_TYPE_QUAL to yyparse(). [gcc/objc/ChangeLog] 2004-09-07 Ziemowit Laski <zlaski@apple.com> * Make-lang.in (objc/objc-parse.o): Depend on $(C_COMMON_H) instead of objc/objc-act.h. (objc/objc-act.o): Depend on $(HASHTAB_H). * objc-act.c: Include hashtab.h; in ObjC++ mode, include cp-tree.h and objcp-decl.h instead of c-tree.h. (build_module_descriptor, get_class_ivars, synth_id_with_class_suffix, error_with_ivar, gen_method_decl, gen_declaration, setup_string_decl, build_protocol_template): Adjust prototypes. (build_module_initializer_routine, start_class, continue_class, finish_class, start_method_def, objc_start_function, start_protocol, build_method_decl, objc_add_method, add_instance_variable, build_ivar_reference, is_ivar, is_private, get_super_receiver, build_selector_table_decl, objc_push_parm, objc_get_parm_info, gen_type_name, gen_type_name_0, start_var_decl, finish_var_decl, create_field_decl): New prototypes. (objc_expand_function_end, comp_method_with_proto, objc_expr_last, gen_declaration_1, gen_declarator, is_complex_decl, adorn_decl, define_decl, create_builtin_decl, gen_declspecs): Remove prototypes. (TYPE_ID): Rename to OBJECT_TYPEDEF_NAME. (CLASS_TYPEDEF_NAME): New. (TAG_EXECCLASS): Change from a global variable to a #define. (TAG_RETURN_STRUCT): Delete. (TAG_GNUINIT): New, holds '__objc_gnu_init' name. (objc_inherit_code, objc_public_flag): New, moved from c-parse.in. (string_descriptor): New struct. (string_htab): New hash table. (string_hash, string_eq): New prototypes. (generate_struct_by_value_array): Call create_field_decl() instead of create_builtin_decl(). (objc_init): Do not initialize objc_ellipsis_node or TAG_EXECCLASS; In ObjC++ mode, call cxx_init() instead of c_objc_common_init(). (objc_finish_file): In ObjC++, call instantiate_pending_templates() and cp_finish_file(). (define_decl, get_static_reference, get_protocol_reference, create_builtin_decl): Remove functions. (objc_start_class_interface, objc_start_category_interface, objc_start_protocol, objc_continue_interface, objc_finish_interface, objc_start_class_implementation, objc_start_category_implementation, objc_continue_implementation, objc_finish_implementation, objc_set_visibility, objc_set_method_type, objc_build_method_signature, objc_add_method_declaration, objc_start_method_definition, objc_add_instance_variable, objc_get_protocol_qualified_type, create_field_decl, start_var_decl, finish_var_decl): New functions. (setup_string_decl): Simplify since it is only called once. (synth_module_prologue): Call build_class_template(); predefine 'id' and 'Class' as typedefs; rename 'temp_type' to 'type'; disable debug hooks for duration of function; fix GNU runtime messenger signatures to correspond to reality; forward-declare '__objc_exec_class' for the GNU runtime; call build_selector_table_decl(); in ObjC++ mode, generate 'extern "C" { ... }' wrappers around synthesized declarations; call build_protocol_template() and build_category_template(). (string_hash, string_eq): New functions. (objc_build_string_object): Check metaclass correctness only once; store string literals in hash table. (objc_build_constructor): Do not convert initializer elements; adjust for ObjC++ impedance mismatch. (build_objc_symtab_template): Call create_field_decl() instead of create_builtin_decl(). (init_objc_symtab): Add missing conversion to initializer element. (build_metadata_decl): Call start_var_decl() instead of define_decl(). (generate_objc_symtab_decl): Do not call build_category_template(); call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(). (build_module_descriptor): Call create_field_decl() instead of grokfield(); call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(); always mark module descriptor as used; move GNU runtime-specific functionality to build_module_initializer_routine(). (build_module_initializer_routine): New function, broken off of build_module_descriptor(). (objc_static_init_needed_p, objc_generate_static_init_call): New functions. (generate_static_references, generate_strings, build_selector_translation_table, generate_descriptor_table, generate_ivars_list, generate_dispatch_table, generate_category): Call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(); build a type directly instead of via groktypename(). (build_selector_reference_decl, build_selector_table_decl, build_class_reference_decl, build_protocol_reference, generate_objc_image_info): Call start_var_decl() instead of build_decl(). (build_selector_reference): For GNU runtime, do not call build_selector_reference_decl(). (build_selector, build_typed_selector_reference): Always convert result to the selector type. (add_objc_string): Cast return value to 'char *'. (build_method_prototype_template, build_selector_template, build_method_template): Use actual selector type for fields pointing to selectors. (finish_objc): For GNU runtime, call build_module_initializer_routine() after build_module_descriptor(). (generate_protocol_list, generate_shared_structures): Call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(); build a type directly instead of via groktypename(). (synth_id_with_class_suffix): Return a string. (get_arg_type_list): For instance methods, use the instance type for 'self'; do not call groktypename_in_parm_context(). (build_objc_string_decl): Squash redeclaration errors in ObjC++. (objc_is_class_name): Use OBJC_TYPE_NAME instead of TYPE_NAME; handle RECORD_TYPEs in ObjC as well as ObjC++. (objc_is_id): New function. (objc_is_object_ptr): Return the canonical type node. (objc_get_class_ivars): Simplify using get_class_ivars(). (get_class_ivars): Remove second parameter; create a fresh copy of the ivar list for each call; do not check for existence of super class. (objc_eh_runtime_type): Mark #ifndef OBJCPLUS. (objc_init_exceptions): When using SJLJ-style exceptions, require the use of '-fobjc-exceptions' flag; do not require it for DWARF-style exceptions. (objc_build_exc_ptr, next_sjlj_build_try_catch_finally): Use objc_object_type instead of objc_id_type. (objc_begin_catch_clause): Convert the incoming PARM_DECL into a VAR_DECL before placing it in the appropriate scope; do not call define_decl(); adjust call to c_begin_compound_stmt(); use objc_object_type instead of objc_id_type. (build_next_objc_exception_stuff): Call create_field_decl() instead of create_builtin_decl(); construct type directly instead of calling groktypename(); use OBJC_VOID_AT_END to mark end of function parameters. (build_private_template): Adjust call to get_class_ivars(); build a type directly instead of via groktypename(). (build_protocol_template, build_method_prototype_list_template, build_method_prototype_template, build_category_template, build_selector_template, build_class_template, build_super_template, build_ivar_template, build_ivar_list_template, build_method_list_template, build_method_template): Call create_field_decl() instead of grokfield(). (objc_method_parm_type): Do not call groktypename(). (generate_descriptor_table): Call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(). (generate_method_descriptors, build_protocol_initializer, generate_dispatch_tables, build_category_initializer, build_shared_structure_initializer): Do not call groktypename(). (generate_protocols): Call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(); do not call groktypename(). (error_with_ivar): Remove last parameter. (check_ivars): Do not iterate ovar CLASS_RAW_IVARS lists in addition to CLASS_IVARS lists; adjust calls to error_with_ivar(). (generate_ivar_lists): Convert one of the initializer elements; do not call groktypename(). (get_arg_type_list, start_method_def, gen_method_def): Account for new representation of variable arguments and '...' in Objective-C methods; add Objective-C++ impedance matching code. (is_objc_type_qualifier): Remove function. (adjust_type_for_id_default): Simplify; there is no longer a need to wade through declspecs. (lookup_interface, start_class, continue_class, finish_class, start_method_def, start_protocol, build_method_decl, objc_add_method, add_instance_variable, build_ivar_reference, is_ivar, is_private, get_super_receiver, objc_build_finally_epilogue): Make into static functions. (receiver_is_class_object): Use new IS_CLASS() macro. (objc_build_message_expr): Tweak ObjC++ message argument handling; call objc_finish_message_expr() instead of finish_message_expr(). (finish_message_expr): Rename to objc_finish_message_expr(); use OBJC_TYPE_NAME and OBJC_SET_TYPE_NAME macros instead of TYPE_NAME. call gen_type_name() instead of gen_declaration(); call objc_is_id() instead of using IS_ID and IS_CLASS; Use objc_class_name instead of calling get_identifier("Class"); handle CONVERT_EXPRs in receiver. (build_objc_method_call, warn_with_method): Do not call groktypename(). (build_ivar_reference): Call convert() instead of clobbering in a type. (hash_init): Initialize string_htab hash table. (add_instance_variable): Simplify parameter list; do not call grokfield(); do not populate CLASS_IVARS list. (start_class): Check for the existence of super class, if one was specified. (continue_class): Use CLASS_RAW_IVARS rather than CLASS_IVARS; do not call build_class_template(); adjust call to get_class_ivars(); call build_decl(), pushdecl() and finish_decl() instead of define_decl(). (finish_class): Call build_decl(), pushdecl() and finish_decl() instead of define_decl(). (add_protocols): Use PROTOCOL_BINFO_ELTS for the tree vector size. (start_protocol): Do not call build_protocol_template(); use PROTOCOL_BINFO_ELTS for the tree vector size. (encode_type_qualifiers): Do not handle the 'const' qualifier here. (encode_pointer): Encode 'const char *' as 'r*', for backwards compatibility. (encode_array): Use HOST_WIDE_INT_PRINT_DEC instead of "%ld". (encode_type): Handle the 'const' qualifier here. (objc_parmlist): New global variable, sued by objc_push_parm and objc_get_parm_info(). (objc_push_parm, objc_get_parm_info): New functions. (objc_expr_last): Remove function. (synth_self_and_ucmd_args): For instance methods, use the instance type for 'self'; call objc_push_parm() instead of push_parm_decl(). (start_method_def): Do not call push_scope(), declare_parm_level(), pop_scope(), push_parm_decl(), store_parm_decls() or objc_expr_last(); just use objc_push_parm() and objc_get_parm_info(). (comp_method_with_proto): Remove function. (objc_types_are_equivalent): Strip away indirections before comparing underlying types. (comp_proto_with_proto): Do not call groktypename(); types are no longer in raw declspec format. (objc_start_function): New function. (really_start_method): Call comp_proto_with_proto() instead of comp_method_with_proto(); call objc_start_function() instead of hand-crafting a function declarator. (continue_method_def, objc_expand_function_end): Remove functions. (get_super_receiver): Call objc_get_current_scope() instead of get_current_scope(); reference 'super_class' field (instead of 'class'). (finish_method_def): Rename to objc_finish_method_definition() and add a function decl parameter; move method encoding call from objc_expand_function_end(). (is_complex_decl, adorn_decl, gen_declarator, gen_declspecs, gen_declaration_1): Remove functions. (tmpbuf, RAW_DECLSPEC): Remove. (gen_declaration): Remove second parameter; simplify to deal with TYPE_P nodes instead of raw declspecs. (gen_type_name, gen_type_name_0): New functions. (gen_method_decl): Remove second parameter; call gen_type_name() instead of gen_declaration_1(). (dump_interface): Adjust calls to gen_declaration() and gen_method_decl(); do not allocate a separate string buffer. (init_objc): Allocate a larger string buffer to accommodate dump_interface(); adjust call to build_module_descriptor(); add call to build_module_initializer_routine() for the GNU runtime. (generate_classref_translation_entry): Do not call start_decl(); call finish_var_decl() instead of finish_decl(); call convert() instead of build_c_cast(). * objc-act.h (CLASS_OWN_IVARS): Remove accessor. (CLASS_BINFO_ELTS): Reduce from 6 to 5, now that CLASS_OWN_IVARS is gone. (OCTI_GNU_INIT_DECL, GNU_INIT_decl): New. (OCTI_ELLIPSIS_NODE, objc_ellipsis_node): Remove. (OCTI_ID_ID, id_type, objc_id_id): Rename to OCTI_ID_NAME, objc_object_type and objc_object_name, respectively. (OCTI_CLS_REF, OCTI_CLASS_NAME, objc_class_reference, objc_class_name): New. (IS_CLASS): New macro. (IS_ID, IS_SUPER): Robustify. (OCTI_EXECCLASS_DECL, execclass_decl): New. (finish_file, start_class, continue_class, finish_class, start_method_def, continue_method_def, finish_method_def, start_protocol, finish_protocol, objc_build_throw_stmt, objc_build_try_catch_finally_stmt, objc_build_synchronized_prologue, objc_build_synchronized_epilogue, objc_build_try_prologue, objc_build_try_epilogue, objc_build_catch_stmt, objc_build_catch_epilogue, objc_build_finally_prologue, objc_build_finally_epilogue, is_ivar, is_private, is_public, add_instance_variable, objc_add_method, get_super_receiver, objc_clear_super_receiver, get_class_ivars_from_name, get_class_reference, get_static_reference, get_object_reference, build_message_expr, finish_message_expr, build_selector_expr, build_ivar_reference, build_keyword_decl, build_method_decl, build_protocol_expr, build_objc_string_object, objc_declare_alias, objc_declare_class, objc_declare_protocols, objc_comptypes, objc_check_decl, build_encode_expr): Remove prototypes. (imp_count, cat_count): Make GGC-aware. (OBJC_SET_TYPE_NAME): New macro. From-SVN: r87168
2004-09-08 02:49:44 +02:00
/* SEL _cmd; */
field_decl = create_field_decl (objc_selector_type, "_cmd");
field_decl_chain = field_decl;
Makefile.in (c-parse.o): Depend on $(C_COMMON_H). [gcc/ChangeLog] 2004-09-07 Ziemowit Laski <zlaski@apple.com> * Makefile.in (c-parse.o): Depend on $(C_COMMON_H). * c-parse.in: Include c-common.h instead of objc-act.h. (ivar_decl_list, ivar_decls, ivar_decl, ivars, ivar_declarator, myparms, myparm): Remove %type declarations. (methodtype, optparms, OBJC_TYPE_QUAL, objc_quals, objc_qual, objc_typename, objc_try_catch_stmt, optellipsis): Add %type declarations. (objc_inherit_code, objc_public_flag): Remove. (typespec_nonreserved_nonattr): Call objc_get_protocol_qualified_type() instead of get_static_reference() and get_protocol_reference(). (stmt_nocomp): Call grokparm() on @catch parameter. (objcdef): Move semantic action to objc_finish_implementation(). (classdef): Move semantic action to objc_start_class_interface(), objc_continue_interface(), objc_finish_interface(), objc_start_class_implementation(), objc_continue_implementation(), objc_start_category_interface() and objc_start_category_implementation(). (protocoldef): Move semantic actions to objc_start_protocol() and objc_finish_interface(). (ivar_decl_list): Remove nonterminal. (visibility_spec): Move semantic actions to objc_set_visibility(). (ivar_decls): Remove assignment to $$. (ivar_decl): Rephrase in terms of component_decl; call objc_add_instance_variable(). (ivars, ivar_declarator): Remove nonterminals. (opt_semi): New nonterminal. (methodtype): Remove semantic actions. (methoddef): Move semantic actions to objc_set_method_type(), objc_start_method_definition() and objc_finish_method_definition(). (methodproto): Move semantic actions to objc_set_method_type() and objc_add_method_declaration(). (methoddecl): Use objc_typename instead of typename; move semantic actions to objc_build_method_signature(). (optarglist, myxdecls, mydecl, myparms, myparm): Remove nonterminals. (optparmlist): Express in terms of optparms and optellipsis. (optparms, optellipsis, objc_qual, objc_quals, objc_typename): New nonterminals. (keyworddecl): Use objc_typename instead of typename. (rid_to_yy): Mark RID_IN, RID_OUT, RID_INOUT, RID_BYCOPY, RID_BYREF and RID_ONEWAY as returning OBJC_TYPE_QUAL to yyparse(). [gcc/objc/ChangeLog] 2004-09-07 Ziemowit Laski <zlaski@apple.com> * Make-lang.in (objc/objc-parse.o): Depend on $(C_COMMON_H) instead of objc/objc-act.h. (objc/objc-act.o): Depend on $(HASHTAB_H). * objc-act.c: Include hashtab.h; in ObjC++ mode, include cp-tree.h and objcp-decl.h instead of c-tree.h. (build_module_descriptor, get_class_ivars, synth_id_with_class_suffix, error_with_ivar, gen_method_decl, gen_declaration, setup_string_decl, build_protocol_template): Adjust prototypes. (build_module_initializer_routine, start_class, continue_class, finish_class, start_method_def, objc_start_function, start_protocol, build_method_decl, objc_add_method, add_instance_variable, build_ivar_reference, is_ivar, is_private, get_super_receiver, build_selector_table_decl, objc_push_parm, objc_get_parm_info, gen_type_name, gen_type_name_0, start_var_decl, finish_var_decl, create_field_decl): New prototypes. (objc_expand_function_end, comp_method_with_proto, objc_expr_last, gen_declaration_1, gen_declarator, is_complex_decl, adorn_decl, define_decl, create_builtin_decl, gen_declspecs): Remove prototypes. (TYPE_ID): Rename to OBJECT_TYPEDEF_NAME. (CLASS_TYPEDEF_NAME): New. (TAG_EXECCLASS): Change from a global variable to a #define. (TAG_RETURN_STRUCT): Delete. (TAG_GNUINIT): New, holds '__objc_gnu_init' name. (objc_inherit_code, objc_public_flag): New, moved from c-parse.in. (string_descriptor): New struct. (string_htab): New hash table. (string_hash, string_eq): New prototypes. (generate_struct_by_value_array): Call create_field_decl() instead of create_builtin_decl(). (objc_init): Do not initialize objc_ellipsis_node or TAG_EXECCLASS; In ObjC++ mode, call cxx_init() instead of c_objc_common_init(). (objc_finish_file): In ObjC++, call instantiate_pending_templates() and cp_finish_file(). (define_decl, get_static_reference, get_protocol_reference, create_builtin_decl): Remove functions. (objc_start_class_interface, objc_start_category_interface, objc_start_protocol, objc_continue_interface, objc_finish_interface, objc_start_class_implementation, objc_start_category_implementation, objc_continue_implementation, objc_finish_implementation, objc_set_visibility, objc_set_method_type, objc_build_method_signature, objc_add_method_declaration, objc_start_method_definition, objc_add_instance_variable, objc_get_protocol_qualified_type, create_field_decl, start_var_decl, finish_var_decl): New functions. (setup_string_decl): Simplify since it is only called once. (synth_module_prologue): Call build_class_template(); predefine 'id' and 'Class' as typedefs; rename 'temp_type' to 'type'; disable debug hooks for duration of function; fix GNU runtime messenger signatures to correspond to reality; forward-declare '__objc_exec_class' for the GNU runtime; call build_selector_table_decl(); in ObjC++ mode, generate 'extern "C" { ... }' wrappers around synthesized declarations; call build_protocol_template() and build_category_template(). (string_hash, string_eq): New functions. (objc_build_string_object): Check metaclass correctness only once; store string literals in hash table. (objc_build_constructor): Do not convert initializer elements; adjust for ObjC++ impedance mismatch. (build_objc_symtab_template): Call create_field_decl() instead of create_builtin_decl(). (init_objc_symtab): Add missing conversion to initializer element. (build_metadata_decl): Call start_var_decl() instead of define_decl(). (generate_objc_symtab_decl): Do not call build_category_template(); call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(). (build_module_descriptor): Call create_field_decl() instead of grokfield(); call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(); always mark module descriptor as used; move GNU runtime-specific functionality to build_module_initializer_routine(). (build_module_initializer_routine): New function, broken off of build_module_descriptor(). (objc_static_init_needed_p, objc_generate_static_init_call): New functions. (generate_static_references, generate_strings, build_selector_translation_table, generate_descriptor_table, generate_ivars_list, generate_dispatch_table, generate_category): Call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(); build a type directly instead of via groktypename(). (build_selector_reference_decl, build_selector_table_decl, build_class_reference_decl, build_protocol_reference, generate_objc_image_info): Call start_var_decl() instead of build_decl(). (build_selector_reference): For GNU runtime, do not call build_selector_reference_decl(). (build_selector, build_typed_selector_reference): Always convert result to the selector type. (add_objc_string): Cast return value to 'char *'. (build_method_prototype_template, build_selector_template, build_method_template): Use actual selector type for fields pointing to selectors. (finish_objc): For GNU runtime, call build_module_initializer_routine() after build_module_descriptor(). (generate_protocol_list, generate_shared_structures): Call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(); build a type directly instead of via groktypename(). (synth_id_with_class_suffix): Return a string. (get_arg_type_list): For instance methods, use the instance type for 'self'; do not call groktypename_in_parm_context(). (build_objc_string_decl): Squash redeclaration errors in ObjC++. (objc_is_class_name): Use OBJC_TYPE_NAME instead of TYPE_NAME; handle RECORD_TYPEs in ObjC as well as ObjC++. (objc_is_id): New function. (objc_is_object_ptr): Return the canonical type node. (objc_get_class_ivars): Simplify using get_class_ivars(). (get_class_ivars): Remove second parameter; create a fresh copy of the ivar list for each call; do not check for existence of super class. (objc_eh_runtime_type): Mark #ifndef OBJCPLUS. (objc_init_exceptions): When using SJLJ-style exceptions, require the use of '-fobjc-exceptions' flag; do not require it for DWARF-style exceptions. (objc_build_exc_ptr, next_sjlj_build_try_catch_finally): Use objc_object_type instead of objc_id_type. (objc_begin_catch_clause): Convert the incoming PARM_DECL into a VAR_DECL before placing it in the appropriate scope; do not call define_decl(); adjust call to c_begin_compound_stmt(); use objc_object_type instead of objc_id_type. (build_next_objc_exception_stuff): Call create_field_decl() instead of create_builtin_decl(); construct type directly instead of calling groktypename(); use OBJC_VOID_AT_END to mark end of function parameters. (build_private_template): Adjust call to get_class_ivars(); build a type directly instead of via groktypename(). (build_protocol_template, build_method_prototype_list_template, build_method_prototype_template, build_category_template, build_selector_template, build_class_template, build_super_template, build_ivar_template, build_ivar_list_template, build_method_list_template, build_method_template): Call create_field_decl() instead of grokfield(). (objc_method_parm_type): Do not call groktypename(). (generate_descriptor_table): Call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(). (generate_method_descriptors, build_protocol_initializer, generate_dispatch_tables, build_category_initializer, build_shared_structure_initializer): Do not call groktypename(). (generate_protocols): Call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(); do not call groktypename(). (error_with_ivar): Remove last parameter. (check_ivars): Do not iterate ovar CLASS_RAW_IVARS lists in addition to CLASS_IVARS lists; adjust calls to error_with_ivar(). (generate_ivar_lists): Convert one of the initializer elements; do not call groktypename(). (get_arg_type_list, start_method_def, gen_method_def): Account for new representation of variable arguments and '...' in Objective-C methods; add Objective-C++ impedance matching code. (is_objc_type_qualifier): Remove function. (adjust_type_for_id_default): Simplify; there is no longer a need to wade through declspecs. (lookup_interface, start_class, continue_class, finish_class, start_method_def, start_protocol, build_method_decl, objc_add_method, add_instance_variable, build_ivar_reference, is_ivar, is_private, get_super_receiver, objc_build_finally_epilogue): Make into static functions. (receiver_is_class_object): Use new IS_CLASS() macro. (objc_build_message_expr): Tweak ObjC++ message argument handling; call objc_finish_message_expr() instead of finish_message_expr(). (finish_message_expr): Rename to objc_finish_message_expr(); use OBJC_TYPE_NAME and OBJC_SET_TYPE_NAME macros instead of TYPE_NAME. call gen_type_name() instead of gen_declaration(); call objc_is_id() instead of using IS_ID and IS_CLASS; Use objc_class_name instead of calling get_identifier("Class"); handle CONVERT_EXPRs in receiver. (build_objc_method_call, warn_with_method): Do not call groktypename(). (build_ivar_reference): Call convert() instead of clobbering in a type. (hash_init): Initialize string_htab hash table. (add_instance_variable): Simplify parameter list; do not call grokfield(); do not populate CLASS_IVARS list. (start_class): Check for the existence of super class, if one was specified. (continue_class): Use CLASS_RAW_IVARS rather than CLASS_IVARS; do not call build_class_template(); adjust call to get_class_ivars(); call build_decl(), pushdecl() and finish_decl() instead of define_decl(). (finish_class): Call build_decl(), pushdecl() and finish_decl() instead of define_decl(). (add_protocols): Use PROTOCOL_BINFO_ELTS for the tree vector size. (start_protocol): Do not call build_protocol_template(); use PROTOCOL_BINFO_ELTS for the tree vector size. (encode_type_qualifiers): Do not handle the 'const' qualifier here. (encode_pointer): Encode 'const char *' as 'r*', for backwards compatibility. (encode_array): Use HOST_WIDE_INT_PRINT_DEC instead of "%ld". (encode_type): Handle the 'const' qualifier here. (objc_parmlist): New global variable, sued by objc_push_parm and objc_get_parm_info(). (objc_push_parm, objc_get_parm_info): New functions. (objc_expr_last): Remove function. (synth_self_and_ucmd_args): For instance methods, use the instance type for 'self'; call objc_push_parm() instead of push_parm_decl(). (start_method_def): Do not call push_scope(), declare_parm_level(), pop_scope(), push_parm_decl(), store_parm_decls() or objc_expr_last(); just use objc_push_parm() and objc_get_parm_info(). (comp_method_with_proto): Remove function. (objc_types_are_equivalent): Strip away indirections before comparing underlying types. (comp_proto_with_proto): Do not call groktypename(); types are no longer in raw declspec format. (objc_start_function): New function. (really_start_method): Call comp_proto_with_proto() instead of comp_method_with_proto(); call objc_start_function() instead of hand-crafting a function declarator. (continue_method_def, objc_expand_function_end): Remove functions. (get_super_receiver): Call objc_get_current_scope() instead of get_current_scope(); reference 'super_class' field (instead of 'class'). (finish_method_def): Rename to objc_finish_method_definition() and add a function decl parameter; move method encoding call from objc_expand_function_end(). (is_complex_decl, adorn_decl, gen_declarator, gen_declspecs, gen_declaration_1): Remove functions. (tmpbuf, RAW_DECLSPEC): Remove. (gen_declaration): Remove second parameter; simplify to deal with TYPE_P nodes instead of raw declspecs. (gen_type_name, gen_type_name_0): New functions. (gen_method_decl): Remove second parameter; call gen_type_name() instead of gen_declaration_1(). (dump_interface): Adjust calls to gen_declaration() and gen_method_decl(); do not allocate a separate string buffer. (init_objc): Allocate a larger string buffer to accommodate dump_interface(); adjust call to build_module_descriptor(); add call to build_module_initializer_routine() for the GNU runtime. (generate_classref_translation_entry): Do not call start_decl(); call finish_var_decl() instead of finish_decl(); call convert() instead of build_c_cast(). * objc-act.h (CLASS_OWN_IVARS): Remove accessor. (CLASS_BINFO_ELTS): Reduce from 6 to 5, now that CLASS_OWN_IVARS is gone. (OCTI_GNU_INIT_DECL, GNU_INIT_decl): New. (OCTI_ELLIPSIS_NODE, objc_ellipsis_node): Remove. (OCTI_ID_ID, id_type, objc_id_id): Rename to OCTI_ID_NAME, objc_object_type and objc_object_name, respectively. (OCTI_CLS_REF, OCTI_CLASS_NAME, objc_class_reference, objc_class_name): New. (IS_CLASS): New macro. (IS_ID, IS_SUPER): Robustify. (OCTI_EXECCLASS_DECL, execclass_decl): New. (finish_file, start_class, continue_class, finish_class, start_method_def, continue_method_def, finish_method_def, start_protocol, finish_protocol, objc_build_throw_stmt, objc_build_try_catch_finally_stmt, objc_build_synchronized_prologue, objc_build_synchronized_epilogue, objc_build_try_prologue, objc_build_try_epilogue, objc_build_catch_stmt, objc_build_catch_epilogue, objc_build_finally_prologue, objc_build_finally_epilogue, is_ivar, is_private, is_public, add_instance_variable, objc_add_method, get_super_receiver, objc_clear_super_receiver, get_class_ivars_from_name, get_class_reference, get_static_reference, get_object_reference, build_message_expr, finish_message_expr, build_selector_expr, build_ivar_reference, build_keyword_decl, build_method_decl, build_protocol_expr, build_objc_string_object, objc_declare_alias, objc_declare_class, objc_declare_protocols, objc_comptypes, objc_check_decl, build_encode_expr): Remove prototypes. (imp_count, cat_count): Make GGC-aware. (OBJC_SET_TYPE_NAME): New macro. From-SVN: r87168
2004-09-08 02:49:44 +02:00
/* char *method_types; */
field_decl = create_field_decl (string_type_node, "method_types");
chainon (field_decl_chain, field_decl);
finish_struct (proto_record, field_decl_chain, NULL_TREE);
return proto_record;
}
static tree
objc_method_parm_type (tree type)
{
Makefile.in (c-parse.o): Depend on $(C_COMMON_H). [gcc/ChangeLog] 2004-09-07 Ziemowit Laski <zlaski@apple.com> * Makefile.in (c-parse.o): Depend on $(C_COMMON_H). * c-parse.in: Include c-common.h instead of objc-act.h. (ivar_decl_list, ivar_decls, ivar_decl, ivars, ivar_declarator, myparms, myparm): Remove %type declarations. (methodtype, optparms, OBJC_TYPE_QUAL, objc_quals, objc_qual, objc_typename, objc_try_catch_stmt, optellipsis): Add %type declarations. (objc_inherit_code, objc_public_flag): Remove. (typespec_nonreserved_nonattr): Call objc_get_protocol_qualified_type() instead of get_static_reference() and get_protocol_reference(). (stmt_nocomp): Call grokparm() on @catch parameter. (objcdef): Move semantic action to objc_finish_implementation(). (classdef): Move semantic action to objc_start_class_interface(), objc_continue_interface(), objc_finish_interface(), objc_start_class_implementation(), objc_continue_implementation(), objc_start_category_interface() and objc_start_category_implementation(). (protocoldef): Move semantic actions to objc_start_protocol() and objc_finish_interface(). (ivar_decl_list): Remove nonterminal. (visibility_spec): Move semantic actions to objc_set_visibility(). (ivar_decls): Remove assignment to $$. (ivar_decl): Rephrase in terms of component_decl; call objc_add_instance_variable(). (ivars, ivar_declarator): Remove nonterminals. (opt_semi): New nonterminal. (methodtype): Remove semantic actions. (methoddef): Move semantic actions to objc_set_method_type(), objc_start_method_definition() and objc_finish_method_definition(). (methodproto): Move semantic actions to objc_set_method_type() and objc_add_method_declaration(). (methoddecl): Use objc_typename instead of typename; move semantic actions to objc_build_method_signature(). (optarglist, myxdecls, mydecl, myparms, myparm): Remove nonterminals. (optparmlist): Express in terms of optparms and optellipsis. (optparms, optellipsis, objc_qual, objc_quals, objc_typename): New nonterminals. (keyworddecl): Use objc_typename instead of typename. (rid_to_yy): Mark RID_IN, RID_OUT, RID_INOUT, RID_BYCOPY, RID_BYREF and RID_ONEWAY as returning OBJC_TYPE_QUAL to yyparse(). [gcc/objc/ChangeLog] 2004-09-07 Ziemowit Laski <zlaski@apple.com> * Make-lang.in (objc/objc-parse.o): Depend on $(C_COMMON_H) instead of objc/objc-act.h. (objc/objc-act.o): Depend on $(HASHTAB_H). * objc-act.c: Include hashtab.h; in ObjC++ mode, include cp-tree.h and objcp-decl.h instead of c-tree.h. (build_module_descriptor, get_class_ivars, synth_id_with_class_suffix, error_with_ivar, gen_method_decl, gen_declaration, setup_string_decl, build_protocol_template): Adjust prototypes. (build_module_initializer_routine, start_class, continue_class, finish_class, start_method_def, objc_start_function, start_protocol, build_method_decl, objc_add_method, add_instance_variable, build_ivar_reference, is_ivar, is_private, get_super_receiver, build_selector_table_decl, objc_push_parm, objc_get_parm_info, gen_type_name, gen_type_name_0, start_var_decl, finish_var_decl, create_field_decl): New prototypes. (objc_expand_function_end, comp_method_with_proto, objc_expr_last, gen_declaration_1, gen_declarator, is_complex_decl, adorn_decl, define_decl, create_builtin_decl, gen_declspecs): Remove prototypes. (TYPE_ID): Rename to OBJECT_TYPEDEF_NAME. (CLASS_TYPEDEF_NAME): New. (TAG_EXECCLASS): Change from a global variable to a #define. (TAG_RETURN_STRUCT): Delete. (TAG_GNUINIT): New, holds '__objc_gnu_init' name. (objc_inherit_code, objc_public_flag): New, moved from c-parse.in. (string_descriptor): New struct. (string_htab): New hash table. (string_hash, string_eq): New prototypes. (generate_struct_by_value_array): Call create_field_decl() instead of create_builtin_decl(). (objc_init): Do not initialize objc_ellipsis_node or TAG_EXECCLASS; In ObjC++ mode, call cxx_init() instead of c_objc_common_init(). (objc_finish_file): In ObjC++, call instantiate_pending_templates() and cp_finish_file(). (define_decl, get_static_reference, get_protocol_reference, create_builtin_decl): Remove functions. (objc_start_class_interface, objc_start_category_interface, objc_start_protocol, objc_continue_interface, objc_finish_interface, objc_start_class_implementation, objc_start_category_implementation, objc_continue_implementation, objc_finish_implementation, objc_set_visibility, objc_set_method_type, objc_build_method_signature, objc_add_method_declaration, objc_start_method_definition, objc_add_instance_variable, objc_get_protocol_qualified_type, create_field_decl, start_var_decl, finish_var_decl): New functions. (setup_string_decl): Simplify since it is only called once. (synth_module_prologue): Call build_class_template(); predefine 'id' and 'Class' as typedefs; rename 'temp_type' to 'type'; disable debug hooks for duration of function; fix GNU runtime messenger signatures to correspond to reality; forward-declare '__objc_exec_class' for the GNU runtime; call build_selector_table_decl(); in ObjC++ mode, generate 'extern "C" { ... }' wrappers around synthesized declarations; call build_protocol_template() and build_category_template(). (string_hash, string_eq): New functions. (objc_build_string_object): Check metaclass correctness only once; store string literals in hash table. (objc_build_constructor): Do not convert initializer elements; adjust for ObjC++ impedance mismatch. (build_objc_symtab_template): Call create_field_decl() instead of create_builtin_decl(). (init_objc_symtab): Add missing conversion to initializer element. (build_metadata_decl): Call start_var_decl() instead of define_decl(). (generate_objc_symtab_decl): Do not call build_category_template(); call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(). (build_module_descriptor): Call create_field_decl() instead of grokfield(); call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(); always mark module descriptor as used; move GNU runtime-specific functionality to build_module_initializer_routine(). (build_module_initializer_routine): New function, broken off of build_module_descriptor(). (objc_static_init_needed_p, objc_generate_static_init_call): New functions. (generate_static_references, generate_strings, build_selector_translation_table, generate_descriptor_table, generate_ivars_list, generate_dispatch_table, generate_category): Call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(); build a type directly instead of via groktypename(). (build_selector_reference_decl, build_selector_table_decl, build_class_reference_decl, build_protocol_reference, generate_objc_image_info): Call start_var_decl() instead of build_decl(). (build_selector_reference): For GNU runtime, do not call build_selector_reference_decl(). (build_selector, build_typed_selector_reference): Always convert result to the selector type. (add_objc_string): Cast return value to 'char *'. (build_method_prototype_template, build_selector_template, build_method_template): Use actual selector type for fields pointing to selectors. (finish_objc): For GNU runtime, call build_module_initializer_routine() after build_module_descriptor(). (generate_protocol_list, generate_shared_structures): Call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(); build a type directly instead of via groktypename(). (synth_id_with_class_suffix): Return a string. (get_arg_type_list): For instance methods, use the instance type for 'self'; do not call groktypename_in_parm_context(). (build_objc_string_decl): Squash redeclaration errors in ObjC++. (objc_is_class_name): Use OBJC_TYPE_NAME instead of TYPE_NAME; handle RECORD_TYPEs in ObjC as well as ObjC++. (objc_is_id): New function. (objc_is_object_ptr): Return the canonical type node. (objc_get_class_ivars): Simplify using get_class_ivars(). (get_class_ivars): Remove second parameter; create a fresh copy of the ivar list for each call; do not check for existence of super class. (objc_eh_runtime_type): Mark #ifndef OBJCPLUS. (objc_init_exceptions): When using SJLJ-style exceptions, require the use of '-fobjc-exceptions' flag; do not require it for DWARF-style exceptions. (objc_build_exc_ptr, next_sjlj_build_try_catch_finally): Use objc_object_type instead of objc_id_type. (objc_begin_catch_clause): Convert the incoming PARM_DECL into a VAR_DECL before placing it in the appropriate scope; do not call define_decl(); adjust call to c_begin_compound_stmt(); use objc_object_type instead of objc_id_type. (build_next_objc_exception_stuff): Call create_field_decl() instead of create_builtin_decl(); construct type directly instead of calling groktypename(); use OBJC_VOID_AT_END to mark end of function parameters. (build_private_template): Adjust call to get_class_ivars(); build a type directly instead of via groktypename(). (build_protocol_template, build_method_prototype_list_template, build_method_prototype_template, build_category_template, build_selector_template, build_class_template, build_super_template, build_ivar_template, build_ivar_list_template, build_method_list_template, build_method_template): Call create_field_decl() instead of grokfield(). (objc_method_parm_type): Do not call groktypename(). (generate_descriptor_table): Call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(). (generate_method_descriptors, build_protocol_initializer, generate_dispatch_tables, build_category_initializer, build_shared_structure_initializer): Do not call groktypename(). (generate_protocols): Call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(); do not call groktypename(). (error_with_ivar): Remove last parameter. (check_ivars): Do not iterate ovar CLASS_RAW_IVARS lists in addition to CLASS_IVARS lists; adjust calls to error_with_ivar(). (generate_ivar_lists): Convert one of the initializer elements; do not call groktypename(). (get_arg_type_list, start_method_def, gen_method_def): Account for new representation of variable arguments and '...' in Objective-C methods; add Objective-C++ impedance matching code. (is_objc_type_qualifier): Remove function. (adjust_type_for_id_default): Simplify; there is no longer a need to wade through declspecs. (lookup_interface, start_class, continue_class, finish_class, start_method_def, start_protocol, build_method_decl, objc_add_method, add_instance_variable, build_ivar_reference, is_ivar, is_private, get_super_receiver, objc_build_finally_epilogue): Make into static functions. (receiver_is_class_object): Use new IS_CLASS() macro. (objc_build_message_expr): Tweak ObjC++ message argument handling; call objc_finish_message_expr() instead of finish_message_expr(). (finish_message_expr): Rename to objc_finish_message_expr(); use OBJC_TYPE_NAME and OBJC_SET_TYPE_NAME macros instead of TYPE_NAME. call gen_type_name() instead of gen_declaration(); call objc_is_id() instead of using IS_ID and IS_CLASS; Use objc_class_name instead of calling get_identifier("Class"); handle CONVERT_EXPRs in receiver. (build_objc_method_call, warn_with_method): Do not call groktypename(). (build_ivar_reference): Call convert() instead of clobbering in a type. (hash_init): Initialize string_htab hash table. (add_instance_variable): Simplify parameter list; do not call grokfield(); do not populate CLASS_IVARS list. (start_class): Check for the existence of super class, if one was specified. (continue_class): Use CLASS_RAW_IVARS rather than CLASS_IVARS; do not call build_class_template(); adjust call to get_class_ivars(); call build_decl(), pushdecl() and finish_decl() instead of define_decl(). (finish_class): Call build_decl(), pushdecl() and finish_decl() instead of define_decl(). (add_protocols): Use PROTOCOL_BINFO_ELTS for the tree vector size. (start_protocol): Do not call build_protocol_template(); use PROTOCOL_BINFO_ELTS for the tree vector size. (encode_type_qualifiers): Do not handle the 'const' qualifier here. (encode_pointer): Encode 'const char *' as 'r*', for backwards compatibility. (encode_array): Use HOST_WIDE_INT_PRINT_DEC instead of "%ld". (encode_type): Handle the 'const' qualifier here. (objc_parmlist): New global variable, sued by objc_push_parm and objc_get_parm_info(). (objc_push_parm, objc_get_parm_info): New functions. (objc_expr_last): Remove function. (synth_self_and_ucmd_args): For instance methods, use the instance type for 'self'; call objc_push_parm() instead of push_parm_decl(). (start_method_def): Do not call push_scope(), declare_parm_level(), pop_scope(), push_parm_decl(), store_parm_decls() or objc_expr_last(); just use objc_push_parm() and objc_get_parm_info(). (comp_method_with_proto): Remove function. (objc_types_are_equivalent): Strip away indirections before comparing underlying types. (comp_proto_with_proto): Do not call groktypename(); types are no longer in raw declspec format. (objc_start_function): New function. (really_start_method): Call comp_proto_with_proto() instead of comp_method_with_proto(); call objc_start_function() instead of hand-crafting a function declarator. (continue_method_def, objc_expand_function_end): Remove functions. (get_super_receiver): Call objc_get_current_scope() instead of get_current_scope(); reference 'super_class' field (instead of 'class'). (finish_method_def): Rename to objc_finish_method_definition() and add a function decl parameter; move method encoding call from objc_expand_function_end(). (is_complex_decl, adorn_decl, gen_declarator, gen_declspecs, gen_declaration_1): Remove functions. (tmpbuf, RAW_DECLSPEC): Remove. (gen_declaration): Remove second parameter; simplify to deal with TYPE_P nodes instead of raw declspecs. (gen_type_name, gen_type_name_0): New functions. (gen_method_decl): Remove second parameter; call gen_type_name() instead of gen_declaration_1(). (dump_interface): Adjust calls to gen_declaration() and gen_method_decl(); do not allocate a separate string buffer. (init_objc): Allocate a larger string buffer to accommodate dump_interface(); adjust call to build_module_descriptor(); add call to build_module_initializer_routine() for the GNU runtime. (generate_classref_translation_entry): Do not call start_decl(); call finish_var_decl() instead of finish_decl(); call convert() instead of build_c_cast(). * objc-act.h (CLASS_OWN_IVARS): Remove accessor. (CLASS_BINFO_ELTS): Reduce from 6 to 5, now that CLASS_OWN_IVARS is gone. (OCTI_GNU_INIT_DECL, GNU_INIT_decl): New. (OCTI_ELLIPSIS_NODE, objc_ellipsis_node): Remove. (OCTI_ID_ID, id_type, objc_id_id): Rename to OCTI_ID_NAME, objc_object_type and objc_object_name, respectively. (OCTI_CLS_REF, OCTI_CLASS_NAME, objc_class_reference, objc_class_name): New. (IS_CLASS): New macro. (IS_ID, IS_SUPER): Robustify. (OCTI_EXECCLASS_DECL, execclass_decl): New. (finish_file, start_class, continue_class, finish_class, start_method_def, continue_method_def, finish_method_def, start_protocol, finish_protocol, objc_build_throw_stmt, objc_build_try_catch_finally_stmt, objc_build_synchronized_prologue, objc_build_synchronized_epilogue, objc_build_try_prologue, objc_build_try_epilogue, objc_build_catch_stmt, objc_build_catch_epilogue, objc_build_finally_prologue, objc_build_finally_epilogue, is_ivar, is_private, is_public, add_instance_variable, objc_add_method, get_super_receiver, objc_clear_super_receiver, get_class_ivars_from_name, get_class_reference, get_static_reference, get_object_reference, build_message_expr, finish_message_expr, build_selector_expr, build_ivar_reference, build_keyword_decl, build_method_decl, build_protocol_expr, build_objc_string_object, objc_declare_alias, objc_declare_class, objc_declare_protocols, objc_comptypes, objc_check_decl, build_encode_expr): Remove prototypes. (imp_count, cat_count): Make GGC-aware. (OBJC_SET_TYPE_NAME): New macro. From-SVN: r87168
2004-09-08 02:49:44 +02:00
type = TREE_VALUE (TREE_TYPE (type));
if (TREE_CODE (type) == TYPE_DECL)
type = TREE_TYPE (type);
Yet more Objective-C++... * objc-act.c (objc_finish_try_stmt): Add return value. (objc_build_synchronized): Likewise. * objc-act.c (objc_is_gcable_type): Add. (objc_substitute_decl): Add. (objc_build_ivar_assignment): Add. (objc_build_global_assignment): Add. (objc_build_strong_cast_assignment): Add. (objc_is_ivar_reference_p): Add. (objc_is_global_reference_p): Add. (objc_generate_write_barrier): Add. (objc_rewrite_function_call): Add. (objc_gimplify_expr): Add Objective-C++ support. * objc-act.h (ALLOC_OBJC_TYPE_LANG_SPECIFIC): Likewise. (SIZEOF_OBJC_TYPE_LANG_SPECIFIC): Add. (INIT_TYPE_OBJC_INFO): Add Objective-C++ support. (DUP_TYPE_OBJC_INFO): Likewise. (struct imp_entry): Add field has_cxx_cdtors. (struct imp_entry *imp_list): Add OCTI_UMSG_FAST_DECL, OCTI_METH_LIST_TEMPL, OCTI_METH_PROTO_LIST_TEMPL, OCTI_IVAR_LIST_TEMPL, OCTI_ASSIGN_IVAR_DECL, OCTI_ASSIGN_IVAR_FAST_DECL, OCTI_ASSIGN_GLOBAL_DECL, OCTI_ASSIGN_STRONGCAST_DECL. (umsg_fast_decl): Add. (objc_assign_ivar_decl): Add. (objc_assign_ivar_fast_decl): Add. (objc_assign_global_decl): Add. (objc_assign_strong_cast_decl): Add. (objc_method_list_ptr): Add. (objc_method_proto_list_ptr): Add. (objc_ivar_list_ptr): Add. * objc-act.c (should_call_super_dealloc): Add. (OBJC_VERSION): Bump to 6. (objc_is_gcable_type): Add. (objc_substitute_decl): Add. (objc_build_ivar_assignment): Add. (objc_build_global_assignment): Add. (objc_build_strong_cast_assignment): Add. (objc_is_gcable_p): Add. (objc_is_ivar_reference_p): Add. (objc_is_global_reference_p): Add. (generate_shared_structures): Add flags parameter. (objc_generate_cxx_ctor_or_dtor): Add. (objc_generate_cxx_cdtors): Add. (add_class): Add name parameter. (objc_types_share_size_and_alignment): Add. (comp_proto_with_proto): Add strict parameter. (CLS_HAS_CXX_STRUCTORS): Add. (TAG_ASSIGNIVAR): Add. (TAG_ASSIGNGLOBAL): Add. (TAG_ASSIGNSTRONGCAST): Add. (TAG_MSGSEND_FAST): Add. (TAG_ASSIGNIVAR_FAST): Add. (TAG_CXX_CONSTRUCT): Add. (TAG_CXX_DESTRUCT): Add. (OBJC_LOOKUP_CLASS): Add. (OBJC_LOOKUP_NO_SUPER): Add. (objc_finish_file): Add pch support. (objc_finish_implementation): Add Objective-C++ support. (synth_module_prologue): Likewise. (synth_module_prologue): Add fast dispatching. (objc_get_class_reference): Add Objective-C++ support. (objc_generate_write_barrier): Likewise. (next_sjlj_build_enter_and_setjmp): Likewise. (objc_begin_try_stmt): Likewise. (build_next_objc_exception_stuff): Add fast ivar support. (build_private_template): Mark the record as used so debug information is generated. (build_protocol_template): Add Objective-C++ support. (objc_method_parm_type) Likewise. (objc_generate_cxx_ctor_or_dtor): Likewise. (objc_generate_cxx_cdtors): Likewise. (build_protocol_initializer): Likewise. (build_category_template): Likewise. (build_class_template): Likewise. (build_method_list_template): Likewise. (build_category_initializer): Likewise. (build_shared_structure_initializer): Likewise. (objc_finish_message_expr): Likewise. (build_objc_method_call): Add fast dispatch support. (lookup_method_static): Add support to end search at superclasses. (add_method_to_hash_list): Add strict parameter to comp_proto_with_proto. (objc_add_method): Likewise. (objc_add_method): Also set the interface_value. (add_instance_variable): Add Objective-C++ support. (objc_is_public): Likewise. (start_class): Likewise. (continue_class): Likewise. (encode_aggregate_within): Likewise. (start_method_def): Likewise. (objc_start_function): Clear current_function_returns_value and current_function_returns_null. (really_start_method): Add Objective-C++ support. (objc_finish_method_definition): Add warning for missing [super dealloc]. (finish_objc): Add Objective-C++ support. (generate_objc_image_info): Likewise. (objc_lookup_ivar): Likewise. * objc-act.h (TYPE_HAS_OBJC_INFO): Likewise. (INIT_TYPE_OBJC_INFO): Likewise. (DUP_TYPE_OBJC_INFO): Likewise. From-SVN: r99857
2005-05-17 22:07:08 +02:00
return type;
}
static int
objc_encoded_type_size (tree type)
{
int sz = int_size_in_bytes (type);
/* Make all integer and enum types at least as large
as an int. */
Makefile.in (c-parse.o): Depend on $(C_COMMON_H). [gcc/ChangeLog] 2004-09-07 Ziemowit Laski <zlaski@apple.com> * Makefile.in (c-parse.o): Depend on $(C_COMMON_H). * c-parse.in: Include c-common.h instead of objc-act.h. (ivar_decl_list, ivar_decls, ivar_decl, ivars, ivar_declarator, myparms, myparm): Remove %type declarations. (methodtype, optparms, OBJC_TYPE_QUAL, objc_quals, objc_qual, objc_typename, objc_try_catch_stmt, optellipsis): Add %type declarations. (objc_inherit_code, objc_public_flag): Remove. (typespec_nonreserved_nonattr): Call objc_get_protocol_qualified_type() instead of get_static_reference() and get_protocol_reference(). (stmt_nocomp): Call grokparm() on @catch parameter. (objcdef): Move semantic action to objc_finish_implementation(). (classdef): Move semantic action to objc_start_class_interface(), objc_continue_interface(), objc_finish_interface(), objc_start_class_implementation(), objc_continue_implementation(), objc_start_category_interface() and objc_start_category_implementation(). (protocoldef): Move semantic actions to objc_start_protocol() and objc_finish_interface(). (ivar_decl_list): Remove nonterminal. (visibility_spec): Move semantic actions to objc_set_visibility(). (ivar_decls): Remove assignment to $$. (ivar_decl): Rephrase in terms of component_decl; call objc_add_instance_variable(). (ivars, ivar_declarator): Remove nonterminals. (opt_semi): New nonterminal. (methodtype): Remove semantic actions. (methoddef): Move semantic actions to objc_set_method_type(), objc_start_method_definition() and objc_finish_method_definition(). (methodproto): Move semantic actions to objc_set_method_type() and objc_add_method_declaration(). (methoddecl): Use objc_typename instead of typename; move semantic actions to objc_build_method_signature(). (optarglist, myxdecls, mydecl, myparms, myparm): Remove nonterminals. (optparmlist): Express in terms of optparms and optellipsis. (optparms, optellipsis, objc_qual, objc_quals, objc_typename): New nonterminals. (keyworddecl): Use objc_typename instead of typename. (rid_to_yy): Mark RID_IN, RID_OUT, RID_INOUT, RID_BYCOPY, RID_BYREF and RID_ONEWAY as returning OBJC_TYPE_QUAL to yyparse(). [gcc/objc/ChangeLog] 2004-09-07 Ziemowit Laski <zlaski@apple.com> * Make-lang.in (objc/objc-parse.o): Depend on $(C_COMMON_H) instead of objc/objc-act.h. (objc/objc-act.o): Depend on $(HASHTAB_H). * objc-act.c: Include hashtab.h; in ObjC++ mode, include cp-tree.h and objcp-decl.h instead of c-tree.h. (build_module_descriptor, get_class_ivars, synth_id_with_class_suffix, error_with_ivar, gen_method_decl, gen_declaration, setup_string_decl, build_protocol_template): Adjust prototypes. (build_module_initializer_routine, start_class, continue_class, finish_class, start_method_def, objc_start_function, start_protocol, build_method_decl, objc_add_method, add_instance_variable, build_ivar_reference, is_ivar, is_private, get_super_receiver, build_selector_table_decl, objc_push_parm, objc_get_parm_info, gen_type_name, gen_type_name_0, start_var_decl, finish_var_decl, create_field_decl): New prototypes. (objc_expand_function_end, comp_method_with_proto, objc_expr_last, gen_declaration_1, gen_declarator, is_complex_decl, adorn_decl, define_decl, create_builtin_decl, gen_declspecs): Remove prototypes. (TYPE_ID): Rename to OBJECT_TYPEDEF_NAME. (CLASS_TYPEDEF_NAME): New. (TAG_EXECCLASS): Change from a global variable to a #define. (TAG_RETURN_STRUCT): Delete. (TAG_GNUINIT): New, holds '__objc_gnu_init' name. (objc_inherit_code, objc_public_flag): New, moved from c-parse.in. (string_descriptor): New struct. (string_htab): New hash table. (string_hash, string_eq): New prototypes. (generate_struct_by_value_array): Call create_field_decl() instead of create_builtin_decl(). (objc_init): Do not initialize objc_ellipsis_node or TAG_EXECCLASS; In ObjC++ mode, call cxx_init() instead of c_objc_common_init(). (objc_finish_file): In ObjC++, call instantiate_pending_templates() and cp_finish_file(). (define_decl, get_static_reference, get_protocol_reference, create_builtin_decl): Remove functions. (objc_start_class_interface, objc_start_category_interface, objc_start_protocol, objc_continue_interface, objc_finish_interface, objc_start_class_implementation, objc_start_category_implementation, objc_continue_implementation, objc_finish_implementation, objc_set_visibility, objc_set_method_type, objc_build_method_signature, objc_add_method_declaration, objc_start_method_definition, objc_add_instance_variable, objc_get_protocol_qualified_type, create_field_decl, start_var_decl, finish_var_decl): New functions. (setup_string_decl): Simplify since it is only called once. (synth_module_prologue): Call build_class_template(); predefine 'id' and 'Class' as typedefs; rename 'temp_type' to 'type'; disable debug hooks for duration of function; fix GNU runtime messenger signatures to correspond to reality; forward-declare '__objc_exec_class' for the GNU runtime; call build_selector_table_decl(); in ObjC++ mode, generate 'extern "C" { ... }' wrappers around synthesized declarations; call build_protocol_template() and build_category_template(). (string_hash, string_eq): New functions. (objc_build_string_object): Check metaclass correctness only once; store string literals in hash table. (objc_build_constructor): Do not convert initializer elements; adjust for ObjC++ impedance mismatch. (build_objc_symtab_template): Call create_field_decl() instead of create_builtin_decl(). (init_objc_symtab): Add missing conversion to initializer element. (build_metadata_decl): Call start_var_decl() instead of define_decl(). (generate_objc_symtab_decl): Do not call build_category_template(); call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(). (build_module_descriptor): Call create_field_decl() instead of grokfield(); call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(); always mark module descriptor as used; move GNU runtime-specific functionality to build_module_initializer_routine(). (build_module_initializer_routine): New function, broken off of build_module_descriptor(). (objc_static_init_needed_p, objc_generate_static_init_call): New functions. (generate_static_references, generate_strings, build_selector_translation_table, generate_descriptor_table, generate_ivars_list, generate_dispatch_table, generate_category): Call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(); build a type directly instead of via groktypename(). (build_selector_reference_decl, build_selector_table_decl, build_class_reference_decl, build_protocol_reference, generate_objc_image_info): Call start_var_decl() instead of build_decl(). (build_selector_reference): For GNU runtime, do not call build_selector_reference_decl(). (build_selector, build_typed_selector_reference): Always convert result to the selector type. (add_objc_string): Cast return value to 'char *'. (build_method_prototype_template, build_selector_template, build_method_template): Use actual selector type for fields pointing to selectors. (finish_objc): For GNU runtime, call build_module_initializer_routine() after build_module_descriptor(). (generate_protocol_list, generate_shared_structures): Call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(); build a type directly instead of via groktypename(). (synth_id_with_class_suffix): Return a string. (get_arg_type_list): For instance methods, use the instance type for 'self'; do not call groktypename_in_parm_context(). (build_objc_string_decl): Squash redeclaration errors in ObjC++. (objc_is_class_name): Use OBJC_TYPE_NAME instead of TYPE_NAME; handle RECORD_TYPEs in ObjC as well as ObjC++. (objc_is_id): New function. (objc_is_object_ptr): Return the canonical type node. (objc_get_class_ivars): Simplify using get_class_ivars(). (get_class_ivars): Remove second parameter; create a fresh copy of the ivar list for each call; do not check for existence of super class. (objc_eh_runtime_type): Mark #ifndef OBJCPLUS. (objc_init_exceptions): When using SJLJ-style exceptions, require the use of '-fobjc-exceptions' flag; do not require it for DWARF-style exceptions. (objc_build_exc_ptr, next_sjlj_build_try_catch_finally): Use objc_object_type instead of objc_id_type. (objc_begin_catch_clause): Convert the incoming PARM_DECL into a VAR_DECL before placing it in the appropriate scope; do not call define_decl(); adjust call to c_begin_compound_stmt(); use objc_object_type instead of objc_id_type. (build_next_objc_exception_stuff): Call create_field_decl() instead of create_builtin_decl(); construct type directly instead of calling groktypename(); use OBJC_VOID_AT_END to mark end of function parameters. (build_private_template): Adjust call to get_class_ivars(); build a type directly instead of via groktypename(). (build_protocol_template, build_method_prototype_list_template, build_method_prototype_template, build_category_template, build_selector_template, build_class_template, build_super_template, build_ivar_template, build_ivar_list_template, build_method_list_template, build_method_template): Call create_field_decl() instead of grokfield(). (objc_method_parm_type): Do not call groktypename(). (generate_descriptor_table): Call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(). (generate_method_descriptors, build_protocol_initializer, generate_dispatch_tables, build_category_initializer, build_shared_structure_initializer): Do not call groktypename(). (generate_protocols): Call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(); do not call groktypename(). (error_with_ivar): Remove last parameter. (check_ivars): Do not iterate ovar CLASS_RAW_IVARS lists in addition to CLASS_IVARS lists; adjust calls to error_with_ivar(). (generate_ivar_lists): Convert one of the initializer elements; do not call groktypename(). (get_arg_type_list, start_method_def, gen_method_def): Account for new representation of variable arguments and '...' in Objective-C methods; add Objective-C++ impedance matching code. (is_objc_type_qualifier): Remove function. (adjust_type_for_id_default): Simplify; there is no longer a need to wade through declspecs. (lookup_interface, start_class, continue_class, finish_class, start_method_def, start_protocol, build_method_decl, objc_add_method, add_instance_variable, build_ivar_reference, is_ivar, is_private, get_super_receiver, objc_build_finally_epilogue): Make into static functions. (receiver_is_class_object): Use new IS_CLASS() macro. (objc_build_message_expr): Tweak ObjC++ message argument handling; call objc_finish_message_expr() instead of finish_message_expr(). (finish_message_expr): Rename to objc_finish_message_expr(); use OBJC_TYPE_NAME and OBJC_SET_TYPE_NAME macros instead of TYPE_NAME. call gen_type_name() instead of gen_declaration(); call objc_is_id() instead of using IS_ID and IS_CLASS; Use objc_class_name instead of calling get_identifier("Class"); handle CONVERT_EXPRs in receiver. (build_objc_method_call, warn_with_method): Do not call groktypename(). (build_ivar_reference): Call convert() instead of clobbering in a type. (hash_init): Initialize string_htab hash table. (add_instance_variable): Simplify parameter list; do not call grokfield(); do not populate CLASS_IVARS list. (start_class): Check for the existence of super class, if one was specified. (continue_class): Use CLASS_RAW_IVARS rather than CLASS_IVARS; do not call build_class_template(); adjust call to get_class_ivars(); call build_decl(), pushdecl() and finish_decl() instead of define_decl(). (finish_class): Call build_decl(), pushdecl() and finish_decl() instead of define_decl(). (add_protocols): Use PROTOCOL_BINFO_ELTS for the tree vector size. (start_protocol): Do not call build_protocol_template(); use PROTOCOL_BINFO_ELTS for the tree vector size. (encode_type_qualifiers): Do not handle the 'const' qualifier here. (encode_pointer): Encode 'const char *' as 'r*', for backwards compatibility. (encode_array): Use HOST_WIDE_INT_PRINT_DEC instead of "%ld". (encode_type): Handle the 'const' qualifier here. (objc_parmlist): New global variable, sued by objc_push_parm and objc_get_parm_info(). (objc_push_parm, objc_get_parm_info): New functions. (objc_expr_last): Remove function. (synth_self_and_ucmd_args): For instance methods, use the instance type for 'self'; call objc_push_parm() instead of push_parm_decl(). (start_method_def): Do not call push_scope(), declare_parm_level(), pop_scope(), push_parm_decl(), store_parm_decls() or objc_expr_last(); just use objc_push_parm() and objc_get_parm_info(). (comp_method_with_proto): Remove function. (objc_types_are_equivalent): Strip away indirections before comparing underlying types. (comp_proto_with_proto): Do not call groktypename(); types are no longer in raw declspec format. (objc_start_function): New function. (really_start_method): Call comp_proto_with_proto() instead of comp_method_with_proto(); call objc_start_function() instead of hand-crafting a function declarator. (continue_method_def, objc_expand_function_end): Remove functions. (get_super_receiver): Call objc_get_current_scope() instead of get_current_scope(); reference 'super_class' field (instead of 'class'). (finish_method_def): Rename to objc_finish_method_definition() and add a function decl parameter; move method encoding call from objc_expand_function_end(). (is_complex_decl, adorn_decl, gen_declarator, gen_declspecs, gen_declaration_1): Remove functions. (tmpbuf, RAW_DECLSPEC): Remove. (gen_declaration): Remove second parameter; simplify to deal with TYPE_P nodes instead of raw declspecs. (gen_type_name, gen_type_name_0): New functions. (gen_method_decl): Remove second parameter; call gen_type_name() instead of gen_declaration_1(). (dump_interface): Adjust calls to gen_declaration() and gen_method_decl(); do not allocate a separate string buffer. (init_objc): Allocate a larger string buffer to accommodate dump_interface(); adjust call to build_module_descriptor(); add call to build_module_initializer_routine() for the GNU runtime. (generate_classref_translation_entry): Do not call start_decl(); call finish_var_decl() instead of finish_decl(); call convert() instead of build_c_cast(). * objc-act.h (CLASS_OWN_IVARS): Remove accessor. (CLASS_BINFO_ELTS): Reduce from 6 to 5, now that CLASS_OWN_IVARS is gone. (OCTI_GNU_INIT_DECL, GNU_INIT_decl): New. (OCTI_ELLIPSIS_NODE, objc_ellipsis_node): Remove. (OCTI_ID_ID, id_type, objc_id_id): Rename to OCTI_ID_NAME, objc_object_type and objc_object_name, respectively. (OCTI_CLS_REF, OCTI_CLASS_NAME, objc_class_reference, objc_class_name): New. (IS_CLASS): New macro. (IS_ID, IS_SUPER): Robustify. (OCTI_EXECCLASS_DECL, execclass_decl): New. (finish_file, start_class, continue_class, finish_class, start_method_def, continue_method_def, finish_method_def, start_protocol, finish_protocol, objc_build_throw_stmt, objc_build_try_catch_finally_stmt, objc_build_synchronized_prologue, objc_build_synchronized_epilogue, objc_build_try_prologue, objc_build_try_epilogue, objc_build_catch_stmt, objc_build_catch_epilogue, objc_build_finally_prologue, objc_build_finally_epilogue, is_ivar, is_private, is_public, add_instance_variable, objc_add_method, get_super_receiver, objc_clear_super_receiver, get_class_ivars_from_name, get_class_reference, get_static_reference, get_object_reference, build_message_expr, finish_message_expr, build_selector_expr, build_ivar_reference, build_keyword_decl, build_method_decl, build_protocol_expr, build_objc_string_object, objc_declare_alias, objc_declare_class, objc_declare_protocols, objc_comptypes, objc_check_decl, build_encode_expr): Remove prototypes. (imp_count, cat_count): Make GGC-aware. (OBJC_SET_TYPE_NAME): New macro. From-SVN: r87168
2004-09-08 02:49:44 +02:00
if (sz > 0 && INTEGRAL_TYPE_P (type))
sz = MAX (sz, int_size_in_bytes (integer_type_node));
/* Treat arrays as pointers, since that's how they're
passed in. */
else if (TREE_CODE (type) == ARRAY_TYPE)
sz = int_size_in_bytes (ptr_type_node);
return sz;
}
static tree
encode_method_prototype (tree method_decl)
{
tree parms;
int parm_offset, i;
char buf[40];
tree result;
1996-07-04 00:07:53 +02:00
/* ONEWAY and BYCOPY, for remote object are the only method qualifiers. */
encode_type_qualifiers (TREE_PURPOSE (TREE_TYPE (method_decl)));
/* Encode return type. */
encode_type (objc_method_parm_type (method_decl),
obstack_object_size (&util_obstack),
OBJC_ENCODE_INLINE_DEFS);
1996-07-04 00:07:53 +02:00
/* Stack size. */
/* The first two arguments (self and _cmd) are pointers; account for
their size. */
i = int_size_in_bytes (ptr_type_node);
parm_offset = 2 * i;
for (parms = METHOD_SEL_ARGS (method_decl); parms;
parms = TREE_CHAIN (parms))
{
tree type = objc_method_parm_type (parms);
int sz = objc_encoded_type_size (type);
/* If a type size is not known, bail out. */
if (sz < 0)
{
toplev.c (default_tree_printer): Handle setting location with '+' flag. 2005-07-02 Zack Weinberg <zack@codesourcery.com> Joseph S. Myers <joseph@codesourcery.com> * toplev.c (default_tree_printer): Handle setting location with '+' flag. * c-objc.common.c (c_tree_printer): Likewise. * c-format.c (gcc_diag_flag_specs): Add '+'. (gcc_cdiag_char_table): Allow '+' flag for tree formats. (format_types_orig): Allow '+' flag for gcc_diag and gcc_cdiag formats. * c-common.c, c-decl.c, c-objc-common.c, c-pragma.c, config/arm/pe.c, config/i386/winnt.c, config/ia64/ia64.c, config/mcore/mcore.c, config/sh/symbian.c, config/sol2.c, config/v850/v850.c, function.c, stor-layout.c, toplev.c, tree-inline.c, tree-optimize.c, tree.c, varasm.c: Use '+' flag instead of %J or %H. Use 'q' flag for quoting. Avoid '.' at end of diagnostics. Use %q+D not %s for a decl. Do not pass excess format arguments where %J is used without %D. cp: * error.c (location_of): Add comment. (locate_error, cp_error_at, cp_warning_at, cp_pedwarn_at): Remove. * cp-tree.h (cp_error_at, cp_warning_at, cp_pedwarn_at): Remove. * call.c, class.c, decl.c, decl2.c, friend.c, init.c, name-lookup.c, parser.c, pt.c, search.c, semantics.c, typeck.c, typeck2.c: Use '+' flag instead of %J, cp_error_at, cp_warning_at or cp_pedwarn_at. Mark up some diagnostic strings with N_. java: * class.c, decl.c, expr.c: Use '+' flag instead of %J. Use 'q' flag for quoting. objc: * objc-act.c: Use '+' flag instead of %J. Use 'q' flag for quoting. testsuite: * gcc.dg/format/gcc_diag-1.c: Update. From-SVN: r101532
2005-07-02 12:55:32 +02:00
error ("type %q+D does not have a known size",
type);
/* Pretend that the encoding succeeded; the compilation will
fail nevertheless. */
goto finish_encoding;
}
parm_offset += sz;
}
sprintf (buf, "%d@0:%d", parm_offset, i);
obstack_grow (&util_obstack, buf, strlen (buf));
1996-07-04 00:07:53 +02:00
/* Argument types. */
parm_offset = 2 * i;
for (parms = METHOD_SEL_ARGS (method_decl); parms;
parms = TREE_CHAIN (parms))
{
tree type = objc_method_parm_type (parms);
1996-07-04 00:07:53 +02:00
/* Process argument qualifiers for user supplied arguments. */
encode_type_qualifiers (TREE_PURPOSE (TREE_TYPE (parms)));
1996-07-04 00:07:53 +02:00
/* Type. */
encode_type (type, obstack_object_size (&util_obstack),
OBJC_ENCODE_INLINE_DEFS);
1996-07-04 00:07:53 +02:00
/* Compute offset. */
sprintf (buf, "%d", parm_offset);
parm_offset += objc_encoded_type_size (type);
obstack_grow (&util_obstack, buf, strlen (buf));
}
finish_encoding:
obstack_1grow (&util_obstack, '\0');
result = get_identifier (obstack_finish (&util_obstack));
obstack_free (&util_obstack, util_firstobj);
return result;
}
static tree
generate_descriptor_table (tree type, const char *name, int size, tree list,
tree proto)
{
Makefile.in (c-parse.o): Depend on $(C_COMMON_H). [gcc/ChangeLog] 2004-09-07 Ziemowit Laski <zlaski@apple.com> * Makefile.in (c-parse.o): Depend on $(C_COMMON_H). * c-parse.in: Include c-common.h instead of objc-act.h. (ivar_decl_list, ivar_decls, ivar_decl, ivars, ivar_declarator, myparms, myparm): Remove %type declarations. (methodtype, optparms, OBJC_TYPE_QUAL, objc_quals, objc_qual, objc_typename, objc_try_catch_stmt, optellipsis): Add %type declarations. (objc_inherit_code, objc_public_flag): Remove. (typespec_nonreserved_nonattr): Call objc_get_protocol_qualified_type() instead of get_static_reference() and get_protocol_reference(). (stmt_nocomp): Call grokparm() on @catch parameter. (objcdef): Move semantic action to objc_finish_implementation(). (classdef): Move semantic action to objc_start_class_interface(), objc_continue_interface(), objc_finish_interface(), objc_start_class_implementation(), objc_continue_implementation(), objc_start_category_interface() and objc_start_category_implementation(). (protocoldef): Move semantic actions to objc_start_protocol() and objc_finish_interface(). (ivar_decl_list): Remove nonterminal. (visibility_spec): Move semantic actions to objc_set_visibility(). (ivar_decls): Remove assignment to $$. (ivar_decl): Rephrase in terms of component_decl; call objc_add_instance_variable(). (ivars, ivar_declarator): Remove nonterminals. (opt_semi): New nonterminal. (methodtype): Remove semantic actions. (methoddef): Move semantic actions to objc_set_method_type(), objc_start_method_definition() and objc_finish_method_definition(). (methodproto): Move semantic actions to objc_set_method_type() and objc_add_method_declaration(). (methoddecl): Use objc_typename instead of typename; move semantic actions to objc_build_method_signature(). (optarglist, myxdecls, mydecl, myparms, myparm): Remove nonterminals. (optparmlist): Express in terms of optparms and optellipsis. (optparms, optellipsis, objc_qual, objc_quals, objc_typename): New nonterminals. (keyworddecl): Use objc_typename instead of typename. (rid_to_yy): Mark RID_IN, RID_OUT, RID_INOUT, RID_BYCOPY, RID_BYREF and RID_ONEWAY as returning OBJC_TYPE_QUAL to yyparse(). [gcc/objc/ChangeLog] 2004-09-07 Ziemowit Laski <zlaski@apple.com> * Make-lang.in (objc/objc-parse.o): Depend on $(C_COMMON_H) instead of objc/objc-act.h. (objc/objc-act.o): Depend on $(HASHTAB_H). * objc-act.c: Include hashtab.h; in ObjC++ mode, include cp-tree.h and objcp-decl.h instead of c-tree.h. (build_module_descriptor, get_class_ivars, synth_id_with_class_suffix, error_with_ivar, gen_method_decl, gen_declaration, setup_string_decl, build_protocol_template): Adjust prototypes. (build_module_initializer_routine, start_class, continue_class, finish_class, start_method_def, objc_start_function, start_protocol, build_method_decl, objc_add_method, add_instance_variable, build_ivar_reference, is_ivar, is_private, get_super_receiver, build_selector_table_decl, objc_push_parm, objc_get_parm_info, gen_type_name, gen_type_name_0, start_var_decl, finish_var_decl, create_field_decl): New prototypes. (objc_expand_function_end, comp_method_with_proto, objc_expr_last, gen_declaration_1, gen_declarator, is_complex_decl, adorn_decl, define_decl, create_builtin_decl, gen_declspecs): Remove prototypes. (TYPE_ID): Rename to OBJECT_TYPEDEF_NAME. (CLASS_TYPEDEF_NAME): New. (TAG_EXECCLASS): Change from a global variable to a #define. (TAG_RETURN_STRUCT): Delete. (TAG_GNUINIT): New, holds '__objc_gnu_init' name. (objc_inherit_code, objc_public_flag): New, moved from c-parse.in. (string_descriptor): New struct. (string_htab): New hash table. (string_hash, string_eq): New prototypes. (generate_struct_by_value_array): Call create_field_decl() instead of create_builtin_decl(). (objc_init): Do not initialize objc_ellipsis_node or TAG_EXECCLASS; In ObjC++ mode, call cxx_init() instead of c_objc_common_init(). (objc_finish_file): In ObjC++, call instantiate_pending_templates() and cp_finish_file(). (define_decl, get_static_reference, get_protocol_reference, create_builtin_decl): Remove functions. (objc_start_class_interface, objc_start_category_interface, objc_start_protocol, objc_continue_interface, objc_finish_interface, objc_start_class_implementation, objc_start_category_implementation, objc_continue_implementation, objc_finish_implementation, objc_set_visibility, objc_set_method_type, objc_build_method_signature, objc_add_method_declaration, objc_start_method_definition, objc_add_instance_variable, objc_get_protocol_qualified_type, create_field_decl, start_var_decl, finish_var_decl): New functions. (setup_string_decl): Simplify since it is only called once. (synth_module_prologue): Call build_class_template(); predefine 'id' and 'Class' as typedefs; rename 'temp_type' to 'type'; disable debug hooks for duration of function; fix GNU runtime messenger signatures to correspond to reality; forward-declare '__objc_exec_class' for the GNU runtime; call build_selector_table_decl(); in ObjC++ mode, generate 'extern "C" { ... }' wrappers around synthesized declarations; call build_protocol_template() and build_category_template(). (string_hash, string_eq): New functions. (objc_build_string_object): Check metaclass correctness only once; store string literals in hash table. (objc_build_constructor): Do not convert initializer elements; adjust for ObjC++ impedance mismatch. (build_objc_symtab_template): Call create_field_decl() instead of create_builtin_decl(). (init_objc_symtab): Add missing conversion to initializer element. (build_metadata_decl): Call start_var_decl() instead of define_decl(). (generate_objc_symtab_decl): Do not call build_category_template(); call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(). (build_module_descriptor): Call create_field_decl() instead of grokfield(); call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(); always mark module descriptor as used; move GNU runtime-specific functionality to build_module_initializer_routine(). (build_module_initializer_routine): New function, broken off of build_module_descriptor(). (objc_static_init_needed_p, objc_generate_static_init_call): New functions. (generate_static_references, generate_strings, build_selector_translation_table, generate_descriptor_table, generate_ivars_list, generate_dispatch_table, generate_category): Call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(); build a type directly instead of via groktypename(). (build_selector_reference_decl, build_selector_table_decl, build_class_reference_decl, build_protocol_reference, generate_objc_image_info): Call start_var_decl() instead of build_decl(). (build_selector_reference): For GNU runtime, do not call build_selector_reference_decl(). (build_selector, build_typed_selector_reference): Always convert result to the selector type. (add_objc_string): Cast return value to 'char *'. (build_method_prototype_template, build_selector_template, build_method_template): Use actual selector type for fields pointing to selectors. (finish_objc): For GNU runtime, call build_module_initializer_routine() after build_module_descriptor(). (generate_protocol_list, generate_shared_structures): Call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(); build a type directly instead of via groktypename(). (synth_id_with_class_suffix): Return a string. (get_arg_type_list): For instance methods, use the instance type for 'self'; do not call groktypename_in_parm_context(). (build_objc_string_decl): Squash redeclaration errors in ObjC++. (objc_is_class_name): Use OBJC_TYPE_NAME instead of TYPE_NAME; handle RECORD_TYPEs in ObjC as well as ObjC++. (objc_is_id): New function. (objc_is_object_ptr): Return the canonical type node. (objc_get_class_ivars): Simplify using get_class_ivars(). (get_class_ivars): Remove second parameter; create a fresh copy of the ivar list for each call; do not check for existence of super class. (objc_eh_runtime_type): Mark #ifndef OBJCPLUS. (objc_init_exceptions): When using SJLJ-style exceptions, require the use of '-fobjc-exceptions' flag; do not require it for DWARF-style exceptions. (objc_build_exc_ptr, next_sjlj_build_try_catch_finally): Use objc_object_type instead of objc_id_type. (objc_begin_catch_clause): Convert the incoming PARM_DECL into a VAR_DECL before placing it in the appropriate scope; do not call define_decl(); adjust call to c_begin_compound_stmt(); use objc_object_type instead of objc_id_type. (build_next_objc_exception_stuff): Call create_field_decl() instead of create_builtin_decl(); construct type directly instead of calling groktypename(); use OBJC_VOID_AT_END to mark end of function parameters. (build_private_template): Adjust call to get_class_ivars(); build a type directly instead of via groktypename(). (build_protocol_template, build_method_prototype_list_template, build_method_prototype_template, build_category_template, build_selector_template, build_class_template, build_super_template, build_ivar_template, build_ivar_list_template, build_method_list_template, build_method_template): Call create_field_decl() instead of grokfield(). (objc_method_parm_type): Do not call groktypename(). (generate_descriptor_table): Call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(). (generate_method_descriptors, build_protocol_initializer, generate_dispatch_tables, build_category_initializer, build_shared_structure_initializer): Do not call groktypename(). (generate_protocols): Call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(); do not call groktypename(). (error_with_ivar): Remove last parameter. (check_ivars): Do not iterate ovar CLASS_RAW_IVARS lists in addition to CLASS_IVARS lists; adjust calls to error_with_ivar(). (generate_ivar_lists): Convert one of the initializer elements; do not call groktypename(). (get_arg_type_list, start_method_def, gen_method_def): Account for new representation of variable arguments and '...' in Objective-C methods; add Objective-C++ impedance matching code. (is_objc_type_qualifier): Remove function. (adjust_type_for_id_default): Simplify; there is no longer a need to wade through declspecs. (lookup_interface, start_class, continue_class, finish_class, start_method_def, start_protocol, build_method_decl, objc_add_method, add_instance_variable, build_ivar_reference, is_ivar, is_private, get_super_receiver, objc_build_finally_epilogue): Make into static functions. (receiver_is_class_object): Use new IS_CLASS() macro. (objc_build_message_expr): Tweak ObjC++ message argument handling; call objc_finish_message_expr() instead of finish_message_expr(). (finish_message_expr): Rename to objc_finish_message_expr(); use OBJC_TYPE_NAME and OBJC_SET_TYPE_NAME macros instead of TYPE_NAME. call gen_type_name() instead of gen_declaration(); call objc_is_id() instead of using IS_ID and IS_CLASS; Use objc_class_name instead of calling get_identifier("Class"); handle CONVERT_EXPRs in receiver. (build_objc_method_call, warn_with_method): Do not call groktypename(). (build_ivar_reference): Call convert() instead of clobbering in a type. (hash_init): Initialize string_htab hash table. (add_instance_variable): Simplify parameter list; do not call grokfield(); do not populate CLASS_IVARS list. (start_class): Check for the existence of super class, if one was specified. (continue_class): Use CLASS_RAW_IVARS rather than CLASS_IVARS; do not call build_class_template(); adjust call to get_class_ivars(); call build_decl(), pushdecl() and finish_decl() instead of define_decl(). (finish_class): Call build_decl(), pushdecl() and finish_decl() instead of define_decl(). (add_protocols): Use PROTOCOL_BINFO_ELTS for the tree vector size. (start_protocol): Do not call build_protocol_template(); use PROTOCOL_BINFO_ELTS for the tree vector size. (encode_type_qualifiers): Do not handle the 'const' qualifier here. (encode_pointer): Encode 'const char *' as 'r*', for backwards compatibility. (encode_array): Use HOST_WIDE_INT_PRINT_DEC instead of "%ld". (encode_type): Handle the 'const' qualifier here. (objc_parmlist): New global variable, sued by objc_push_parm and objc_get_parm_info(). (objc_push_parm, objc_get_parm_info): New functions. (objc_expr_last): Remove function. (synth_self_and_ucmd_args): For instance methods, use the instance type for 'self'; call objc_push_parm() instead of push_parm_decl(). (start_method_def): Do not call push_scope(), declare_parm_level(), pop_scope(), push_parm_decl(), store_parm_decls() or objc_expr_last(); just use objc_push_parm() and objc_get_parm_info(). (comp_method_with_proto): Remove function. (objc_types_are_equivalent): Strip away indirections before comparing underlying types. (comp_proto_with_proto): Do not call groktypename(); types are no longer in raw declspec format. (objc_start_function): New function. (really_start_method): Call comp_proto_with_proto() instead of comp_method_with_proto(); call objc_start_function() instead of hand-crafting a function declarator. (continue_method_def, objc_expand_function_end): Remove functions. (get_super_receiver): Call objc_get_current_scope() instead of get_current_scope(); reference 'super_class' field (instead of 'class'). (finish_method_def): Rename to objc_finish_method_definition() and add a function decl parameter; move method encoding call from objc_expand_function_end(). (is_complex_decl, adorn_decl, gen_declarator, gen_declspecs, gen_declaration_1): Remove functions. (tmpbuf, RAW_DECLSPEC): Remove. (gen_declaration): Remove second parameter; simplify to deal with TYPE_P nodes instead of raw declspecs. (gen_type_name, gen_type_name_0): New functions. (gen_method_decl): Remove second parameter; call gen_type_name() instead of gen_declaration_1(). (dump_interface): Adjust calls to gen_declaration() and gen_method_decl(); do not allocate a separate string buffer. (init_objc): Allocate a larger string buffer to accommodate dump_interface(); adjust call to build_module_descriptor(); add call to build_module_initializer_routine() for the GNU runtime. (generate_classref_translation_entry): Do not call start_decl(); call finish_var_decl() instead of finish_decl(); call convert() instead of build_c_cast(). * objc-act.h (CLASS_OWN_IVARS): Remove accessor. (CLASS_BINFO_ELTS): Reduce from 6 to 5, now that CLASS_OWN_IVARS is gone. (OCTI_GNU_INIT_DECL, GNU_INIT_decl): New. (OCTI_ELLIPSIS_NODE, objc_ellipsis_node): Remove. (OCTI_ID_ID, id_type, objc_id_id): Rename to OCTI_ID_NAME, objc_object_type and objc_object_name, respectively. (OCTI_CLS_REF, OCTI_CLASS_NAME, objc_class_reference, objc_class_name): New. (IS_CLASS): New macro. (IS_ID, IS_SUPER): Robustify. (OCTI_EXECCLASS_DECL, execclass_decl): New. (finish_file, start_class, continue_class, finish_class, start_method_def, continue_method_def, finish_method_def, start_protocol, finish_protocol, objc_build_throw_stmt, objc_build_try_catch_finally_stmt, objc_build_synchronized_prologue, objc_build_synchronized_epilogue, objc_build_try_prologue, objc_build_try_epilogue, objc_build_catch_stmt, objc_build_catch_epilogue, objc_build_finally_prologue, objc_build_finally_epilogue, is_ivar, is_private, is_public, add_instance_variable, objc_add_method, get_super_receiver, objc_clear_super_receiver, get_class_ivars_from_name, get_class_reference, get_static_reference, get_object_reference, build_message_expr, finish_message_expr, build_selector_expr, build_ivar_reference, build_keyword_decl, build_method_decl, build_protocol_expr, build_objc_string_object, objc_declare_alias, objc_declare_class, objc_declare_protocols, objc_comptypes, objc_check_decl, build_encode_expr): Remove prototypes. (imp_count, cat_count): Make GGC-aware. (OBJC_SET_TYPE_NAME): New macro. From-SVN: r87168
2004-09-08 02:49:44 +02:00
tree decl, initlist;
Makefile.in (c-parse.o): Depend on $(C_COMMON_H). [gcc/ChangeLog] 2004-09-07 Ziemowit Laski <zlaski@apple.com> * Makefile.in (c-parse.o): Depend on $(C_COMMON_H). * c-parse.in: Include c-common.h instead of objc-act.h. (ivar_decl_list, ivar_decls, ivar_decl, ivars, ivar_declarator, myparms, myparm): Remove %type declarations. (methodtype, optparms, OBJC_TYPE_QUAL, objc_quals, objc_qual, objc_typename, objc_try_catch_stmt, optellipsis): Add %type declarations. (objc_inherit_code, objc_public_flag): Remove. (typespec_nonreserved_nonattr): Call objc_get_protocol_qualified_type() instead of get_static_reference() and get_protocol_reference(). (stmt_nocomp): Call grokparm() on @catch parameter. (objcdef): Move semantic action to objc_finish_implementation(). (classdef): Move semantic action to objc_start_class_interface(), objc_continue_interface(), objc_finish_interface(), objc_start_class_implementation(), objc_continue_implementation(), objc_start_category_interface() and objc_start_category_implementation(). (protocoldef): Move semantic actions to objc_start_protocol() and objc_finish_interface(). (ivar_decl_list): Remove nonterminal. (visibility_spec): Move semantic actions to objc_set_visibility(). (ivar_decls): Remove assignment to $$. (ivar_decl): Rephrase in terms of component_decl; call objc_add_instance_variable(). (ivars, ivar_declarator): Remove nonterminals. (opt_semi): New nonterminal. (methodtype): Remove semantic actions. (methoddef): Move semantic actions to objc_set_method_type(), objc_start_method_definition() and objc_finish_method_definition(). (methodproto): Move semantic actions to objc_set_method_type() and objc_add_method_declaration(). (methoddecl): Use objc_typename instead of typename; move semantic actions to objc_build_method_signature(). (optarglist, myxdecls, mydecl, myparms, myparm): Remove nonterminals. (optparmlist): Express in terms of optparms and optellipsis. (optparms, optellipsis, objc_qual, objc_quals, objc_typename): New nonterminals. (keyworddecl): Use objc_typename instead of typename. (rid_to_yy): Mark RID_IN, RID_OUT, RID_INOUT, RID_BYCOPY, RID_BYREF and RID_ONEWAY as returning OBJC_TYPE_QUAL to yyparse(). [gcc/objc/ChangeLog] 2004-09-07 Ziemowit Laski <zlaski@apple.com> * Make-lang.in (objc/objc-parse.o): Depend on $(C_COMMON_H) instead of objc/objc-act.h. (objc/objc-act.o): Depend on $(HASHTAB_H). * objc-act.c: Include hashtab.h; in ObjC++ mode, include cp-tree.h and objcp-decl.h instead of c-tree.h. (build_module_descriptor, get_class_ivars, synth_id_with_class_suffix, error_with_ivar, gen_method_decl, gen_declaration, setup_string_decl, build_protocol_template): Adjust prototypes. (build_module_initializer_routine, start_class, continue_class, finish_class, start_method_def, objc_start_function, start_protocol, build_method_decl, objc_add_method, add_instance_variable, build_ivar_reference, is_ivar, is_private, get_super_receiver, build_selector_table_decl, objc_push_parm, objc_get_parm_info, gen_type_name, gen_type_name_0, start_var_decl, finish_var_decl, create_field_decl): New prototypes. (objc_expand_function_end, comp_method_with_proto, objc_expr_last, gen_declaration_1, gen_declarator, is_complex_decl, adorn_decl, define_decl, create_builtin_decl, gen_declspecs): Remove prototypes. (TYPE_ID): Rename to OBJECT_TYPEDEF_NAME. (CLASS_TYPEDEF_NAME): New. (TAG_EXECCLASS): Change from a global variable to a #define. (TAG_RETURN_STRUCT): Delete. (TAG_GNUINIT): New, holds '__objc_gnu_init' name. (objc_inherit_code, objc_public_flag): New, moved from c-parse.in. (string_descriptor): New struct. (string_htab): New hash table. (string_hash, string_eq): New prototypes. (generate_struct_by_value_array): Call create_field_decl() instead of create_builtin_decl(). (objc_init): Do not initialize objc_ellipsis_node or TAG_EXECCLASS; In ObjC++ mode, call cxx_init() instead of c_objc_common_init(). (objc_finish_file): In ObjC++, call instantiate_pending_templates() and cp_finish_file(). (define_decl, get_static_reference, get_protocol_reference, create_builtin_decl): Remove functions. (objc_start_class_interface, objc_start_category_interface, objc_start_protocol, objc_continue_interface, objc_finish_interface, objc_start_class_implementation, objc_start_category_implementation, objc_continue_implementation, objc_finish_implementation, objc_set_visibility, objc_set_method_type, objc_build_method_signature, objc_add_method_declaration, objc_start_method_definition, objc_add_instance_variable, objc_get_protocol_qualified_type, create_field_decl, start_var_decl, finish_var_decl): New functions. (setup_string_decl): Simplify since it is only called once. (synth_module_prologue): Call build_class_template(); predefine 'id' and 'Class' as typedefs; rename 'temp_type' to 'type'; disable debug hooks for duration of function; fix GNU runtime messenger signatures to correspond to reality; forward-declare '__objc_exec_class' for the GNU runtime; call build_selector_table_decl(); in ObjC++ mode, generate 'extern "C" { ... }' wrappers around synthesized declarations; call build_protocol_template() and build_category_template(). (string_hash, string_eq): New functions. (objc_build_string_object): Check metaclass correctness only once; store string literals in hash table. (objc_build_constructor): Do not convert initializer elements; adjust for ObjC++ impedance mismatch. (build_objc_symtab_template): Call create_field_decl() instead of create_builtin_decl(). (init_objc_symtab): Add missing conversion to initializer element. (build_metadata_decl): Call start_var_decl() instead of define_decl(). (generate_objc_symtab_decl): Do not call build_category_template(); call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(). (build_module_descriptor): Call create_field_decl() instead of grokfield(); call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(); always mark module descriptor as used; move GNU runtime-specific functionality to build_module_initializer_routine(). (build_module_initializer_routine): New function, broken off of build_module_descriptor(). (objc_static_init_needed_p, objc_generate_static_init_call): New functions. (generate_static_references, generate_strings, build_selector_translation_table, generate_descriptor_table, generate_ivars_list, generate_dispatch_table, generate_category): Call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(); build a type directly instead of via groktypename(). (build_selector_reference_decl, build_selector_table_decl, build_class_reference_decl, build_protocol_reference, generate_objc_image_info): Call start_var_decl() instead of build_decl(). (build_selector_reference): For GNU runtime, do not call build_selector_reference_decl(). (build_selector, build_typed_selector_reference): Always convert result to the selector type. (add_objc_string): Cast return value to 'char *'. (build_method_prototype_template, build_selector_template, build_method_template): Use actual selector type for fields pointing to selectors. (finish_objc): For GNU runtime, call build_module_initializer_routine() after build_module_descriptor(). (generate_protocol_list, generate_shared_structures): Call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(); build a type directly instead of via groktypename(). (synth_id_with_class_suffix): Return a string. (get_arg_type_list): For instance methods, use the instance type for 'self'; do not call groktypename_in_parm_context(). (build_objc_string_decl): Squash redeclaration errors in ObjC++. (objc_is_class_name): Use OBJC_TYPE_NAME instead of TYPE_NAME; handle RECORD_TYPEs in ObjC as well as ObjC++. (objc_is_id): New function. (objc_is_object_ptr): Return the canonical type node. (objc_get_class_ivars): Simplify using get_class_ivars(). (get_class_ivars): Remove second parameter; create a fresh copy of the ivar list for each call; do not check for existence of super class. (objc_eh_runtime_type): Mark #ifndef OBJCPLUS. (objc_init_exceptions): When using SJLJ-style exceptions, require the use of '-fobjc-exceptions' flag; do not require it for DWARF-style exceptions. (objc_build_exc_ptr, next_sjlj_build_try_catch_finally): Use objc_object_type instead of objc_id_type. (objc_begin_catch_clause): Convert the incoming PARM_DECL into a VAR_DECL before placing it in the appropriate scope; do not call define_decl(); adjust call to c_begin_compound_stmt(); use objc_object_type instead of objc_id_type. (build_next_objc_exception_stuff): Call create_field_decl() instead of create_builtin_decl(); construct type directly instead of calling groktypename(); use OBJC_VOID_AT_END to mark end of function parameters. (build_private_template): Adjust call to get_class_ivars(); build a type directly instead of via groktypename(). (build_protocol_template, build_method_prototype_list_template, build_method_prototype_template, build_category_template, build_selector_template, build_class_template, build_super_template, build_ivar_template, build_ivar_list_template, build_method_list_template, build_method_template): Call create_field_decl() instead of grokfield(). (objc_method_parm_type): Do not call groktypename(). (generate_descriptor_table): Call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(). (generate_method_descriptors, build_protocol_initializer, generate_dispatch_tables, build_category_initializer, build_shared_structure_initializer): Do not call groktypename(). (generate_protocols): Call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(); do not call groktypename(). (error_with_ivar): Remove last parameter. (check_ivars): Do not iterate ovar CLASS_RAW_IVARS lists in addition to CLASS_IVARS lists; adjust calls to error_with_ivar(). (generate_ivar_lists): Convert one of the initializer elements; do not call groktypename(). (get_arg_type_list, start_method_def, gen_method_def): Account for new representation of variable arguments and '...' in Objective-C methods; add Objective-C++ impedance matching code. (is_objc_type_qualifier): Remove function. (adjust_type_for_id_default): Simplify; there is no longer a need to wade through declspecs. (lookup_interface, start_class, continue_class, finish_class, start_method_def, start_protocol, build_method_decl, objc_add_method, add_instance_variable, build_ivar_reference, is_ivar, is_private, get_super_receiver, objc_build_finally_epilogue): Make into static functions. (receiver_is_class_object): Use new IS_CLASS() macro. (objc_build_message_expr): Tweak ObjC++ message argument handling; call objc_finish_message_expr() instead of finish_message_expr(). (finish_message_expr): Rename to objc_finish_message_expr(); use OBJC_TYPE_NAME and OBJC_SET_TYPE_NAME macros instead of TYPE_NAME. call gen_type_name() instead of gen_declaration(); call objc_is_id() instead of using IS_ID and IS_CLASS; Use objc_class_name instead of calling get_identifier("Class"); handle CONVERT_EXPRs in receiver. (build_objc_method_call, warn_with_method): Do not call groktypename(). (build_ivar_reference): Call convert() instead of clobbering in a type. (hash_init): Initialize string_htab hash table. (add_instance_variable): Simplify parameter list; do not call grokfield(); do not populate CLASS_IVARS list. (start_class): Check for the existence of super class, if one was specified. (continue_class): Use CLASS_RAW_IVARS rather than CLASS_IVARS; do not call build_class_template(); adjust call to get_class_ivars(); call build_decl(), pushdecl() and finish_decl() instead of define_decl(). (finish_class): Call build_decl(), pushdecl() and finish_decl() instead of define_decl(). (add_protocols): Use PROTOCOL_BINFO_ELTS for the tree vector size. (start_protocol): Do not call build_protocol_template(); use PROTOCOL_BINFO_ELTS for the tree vector size. (encode_type_qualifiers): Do not handle the 'const' qualifier here. (encode_pointer): Encode 'const char *' as 'r*', for backwards compatibility. (encode_array): Use HOST_WIDE_INT_PRINT_DEC instead of "%ld". (encode_type): Handle the 'const' qualifier here. (objc_parmlist): New global variable, sued by objc_push_parm and objc_get_parm_info(). (objc_push_parm, objc_get_parm_info): New functions. (objc_expr_last): Remove function. (synth_self_and_ucmd_args): For instance methods, use the instance type for 'self'; call objc_push_parm() instead of push_parm_decl(). (start_method_def): Do not call push_scope(), declare_parm_level(), pop_scope(), push_parm_decl(), store_parm_decls() or objc_expr_last(); just use objc_push_parm() and objc_get_parm_info(). (comp_method_with_proto): Remove function. (objc_types_are_equivalent): Strip away indirections before comparing underlying types. (comp_proto_with_proto): Do not call groktypename(); types are no longer in raw declspec format. (objc_start_function): New function. (really_start_method): Call comp_proto_with_proto() instead of comp_method_with_proto(); call objc_start_function() instead of hand-crafting a function declarator. (continue_method_def, objc_expand_function_end): Remove functions. (get_super_receiver): Call objc_get_current_scope() instead of get_current_scope(); reference 'super_class' field (instead of 'class'). (finish_method_def): Rename to objc_finish_method_definition() and add a function decl parameter; move method encoding call from objc_expand_function_end(). (is_complex_decl, adorn_decl, gen_declarator, gen_declspecs, gen_declaration_1): Remove functions. (tmpbuf, RAW_DECLSPEC): Remove. (gen_declaration): Remove second parameter; simplify to deal with TYPE_P nodes instead of raw declspecs. (gen_type_name, gen_type_name_0): New functions. (gen_method_decl): Remove second parameter; call gen_type_name() instead of gen_declaration_1(). (dump_interface): Adjust calls to gen_declaration() and gen_method_decl(); do not allocate a separate string buffer. (init_objc): Allocate a larger string buffer to accommodate dump_interface(); adjust call to build_module_descriptor(); add call to build_module_initializer_routine() for the GNU runtime. (generate_classref_translation_entry): Do not call start_decl(); call finish_var_decl() instead of finish_decl(); call convert() instead of build_c_cast(). * objc-act.h (CLASS_OWN_IVARS): Remove accessor. (CLASS_BINFO_ELTS): Reduce from 6 to 5, now that CLASS_OWN_IVARS is gone. (OCTI_GNU_INIT_DECL, GNU_INIT_decl): New. (OCTI_ELLIPSIS_NODE, objc_ellipsis_node): Remove. (OCTI_ID_ID, id_type, objc_id_id): Rename to OCTI_ID_NAME, objc_object_type and objc_object_name, respectively. (OCTI_CLS_REF, OCTI_CLASS_NAME, objc_class_reference, objc_class_name): New. (IS_CLASS): New macro. (IS_ID, IS_SUPER): Robustify. (OCTI_EXECCLASS_DECL, execclass_decl): New. (finish_file, start_class, continue_class, finish_class, start_method_def, continue_method_def, finish_method_def, start_protocol, finish_protocol, objc_build_throw_stmt, objc_build_try_catch_finally_stmt, objc_build_synchronized_prologue, objc_build_synchronized_epilogue, objc_build_try_prologue, objc_build_try_epilogue, objc_build_catch_stmt, objc_build_catch_epilogue, objc_build_finally_prologue, objc_build_finally_epilogue, is_ivar, is_private, is_public, add_instance_variable, objc_add_method, get_super_receiver, objc_clear_super_receiver, get_class_ivars_from_name, get_class_reference, get_static_reference, get_object_reference, build_message_expr, finish_message_expr, build_selector_expr, build_ivar_reference, build_keyword_decl, build_method_decl, build_protocol_expr, build_objc_string_object, objc_declare_alias, objc_declare_class, objc_declare_protocols, objc_comptypes, objc_check_decl, build_encode_expr): Remove prototypes. (imp_count, cat_count): Make GGC-aware. (OBJC_SET_TYPE_NAME): New macro. From-SVN: r87168
2004-09-08 02:49:44 +02:00
decl = start_var_decl (type, synth_id_with_class_suffix (name, proto));
tree.h (build_int_cst): New, sign extended constant. * tree.h (build_int_cst): New, sign extended constant. (build_int_cstu): New, zero extended constant. (build_int_cst_wide): Renamed from build_int_cst. * tree.c (build_int_cst, build_int_cstu): New. (build_int_cst_wide): Renamed from build_int_cst. (make_vector_type, build_common_tree_nodes, build_common_tree_nodes_2): Adjust build_int_cst calls. * builtins.c (expand_builtin_prefetch, expand_builtin_strstr, expand_builtin_strpbrk, expand_builtin_fputs, build_string_literal, expand_builtin_printf, expand_builtin_sprintf, fold_builtin_classify_type, fold_builtin_lround, fold_builtin_bitop, fold_builtin_isascii, fold_builtin_toascii, fold_builtin_isdigit, simplify_builtin_strstr, simplify_builtin_strpbrk, fold_builtin_fputs, simplify_builtin_sprintf): Likewise. * c-common.c (start_fname_decls, fix_string_type, shorten_compare, DEF_ATTR_INT): Likewise. * c-decl.c (complete_array_type, check_bitfield_type_and_width): Likewise. * c-lex.c (interpret_integer, lex_charconst): Likewise. * c-parse.in (primary) <TYPES_COMPATIBLE_P> Likewise. * c-pretty-print.c (pp_c_integer_constant): Likewise. * c-typeck.c (really_start_incremental_init, push_init_level, set_nonincremental_init_from_string): Likewise. * calls.c (load_register_parameters): Likewise. convert.c (convert_to_pointer): Likewise. coverage.c (coverage_counter_alloc, tree_coverage_counter_ref, build_fn_info_type, build_fn_info_value, build_ctr_info_value, build_gcov_info): Likewise. * except.c (init_eh, assign_filter_values): Likewise. * expmed.c (store_fixed_bit_field, extract_bit_field, extract_fixed_bit_field, extract_split_bit_field, expand_shift, expand_mult_const, expand_mult_highpart_adjust, extract_high_half, expand_sdiv_pow2, expand_divmod, make_tree): Likewise. * expr.c (convert_move, emit_group_load, emit_group_store, expand_assignment, store_constructor, store_field, expand_expr_real_1, reduce_to_bit_field_precision): Likewise. fold-const.c (force_fit_type, int_const_binop, fold_convert_const, invert_truthvalue, optimize_bit_field_compare, decode_field_reference, all_ones_mask_p, constant_boolean_node, fold_div_compare, fold, fold_read_from_constant_string, fold_negate_const, fold_abs_const, fold_not_const, round_up, round_down): Likewise. * function.c (assign_parm_setup_block): Likewise. * stmt.c (shift_return_value, expand_case, estimate_case_costs): Likewise. * stor-layout.c (layout_type, initialize_sizetypes, set_min_and_max_values_for_integral_type): Likewise. * tree-chrec.c (chrec_fold_multiply_poly_poly, reset_evolution_in_loop): Likewise. * tree-chrec.h (build_polynomial_chrec): Likewise. * tree-complex.c (build_replicated_const): Likewise. * tree-eh.c (honor_protect_cleanup_actions, lower_try_finally_onedest, lower_try_finally_copy, lower_try_finally_switch): Likewise. * tree-mudflap.c (mf_build_string, mx_register_decls, mudflap_register_call, mudflap_enqueue_constant): Likewise. * tree-nested.c (get_trampoline_type, get_nl_goto_field): Likewise. * tree-pretty-print.c (dump_generic_node): Likewise. * tree-ssa-ccp.c (widen_bitfield, maybe_fold_offset_to_array_ref): Likewise. * tree-ssa-dom.c (simplify_rhs_and_lookup_avail_expr): Likewise. * tree-ssa-loop-niter.c (number_of_iterations_cond, loop_niter_by_eval, upper_bound_in_type, lower_bound_in_type): Likewise. * tree-ssa-loop-ivcanon.c (create_canonical_iv, canonicalize_loop_induction_variables): Likewise. * tree-vectorizer.c (vect_create_index_for_array_ref, vect_transform_loop_bound, vect_compute_data_ref_alignment): Likewise. * config/alpha/alpha.c (alpha_initialize_trampoline, alpha_va_start, alpha_gimplify_va_arg_1): Likewise. * config/arm/arm.c (arm_get_cookie_size): Likewise. * config/c4x/c4x.c (c4x_gimplify_va_arg_expr): Likewise. * config/i386/i386.c (ix86_va_start, ix86_gimplify_va_arg): Likewise. * config/ia64/ia64.c (ia64_gimplify_va_arg): Likewise. * config/mips/mips.c (mips_build_builtin_va_list, mips_va_start, mips_gimplify_va_arg_expr): Likewise. * config/pa/pa.c (hppa_gimplify_va_arg_expr): Likewise. * config/rs6000/rs6000.c (rs6000_va_start, rs6000_gimplify_va_arg, add_compiler_branch_island): Likewise. * config/s390/s390.c (s390_va_start): Likewise. * config/sh/sh.c (sh_va_start): Likewise. * config/stormy16/stormy16.c (xstormy16_expand_builtin_va_start): Likewise. * config/xtensa/xtensa.c (xtensa_va_start, xtensa_gimplify_va_arg_expr): Likewise. * objc/objc-act.c (build_objc_string_object, build_objc_symtab_template, init_def_list, init_objc_symtab, init_module_descriptor, generate_static_references, build_selector_translation_table, get_proto_encoding, build_typed_selector_reference, build_selector_reference, build_next_objc_exception_stuff, build_method_prototype_list_template, generate_descriptor_table, generate_protocols, build_protocol_initializer, build_ivar_list_template, build_method_list_template, build_ivar_list_initializer, generate_ivars_list, generate_dispatch_table, generate_protocol_list, build_category_initializer, build_shared_structure_initializer, generate_shared_structures, handle_impent, generate_objc_image_info): Likewise. 2004-04-25 Paolo Bonzini <bonzini@gnu.org> * cfglayout.c (duplicate_insn_chain): Remove references to NOTE_INSN_LOOP_VTOP and NOTE_INSN_LOOP_CONT. * cfgloop.h (struct loop): Remove fields vtop, cont and cont_dominator. * cfgrtl.c (rtl_delete_block): Remove handling of NOTE_INSN_LOOP_CONT. * final.c (final_scan_insn): Remove references to NOTE_INSN_LOOP_VTOP and NOTE_INSN_LOOP_CONT. * insn-notes.def (NOTE_INSN_LOOP_VTOP, NOTE_INSN_LOOP_CONT): Remove. * jump.c (squeeze_notes): Remove references to NOTE_INSN_LOOP_VTOP and NOTE_INSN_LOOP_CONT. * loop.c (scan_loops, find_and_verify_loops, for_each_insn_in_loop, check_dbra_loop, loop_dump_aux): Remove references to removed notes and fields. * reorg.c (mostly_true_jump): Do not rely on NOTE_INSN_LOOP_VTOPs. * unroll.c (unroll_loop, copy_loop_body, loop_iterations): Remove references to removed notes and fields. (subtract_reg_term, ujump_to_loop_cont): Remove. From-SVN: r86544
2004-08-25 11:52:54 +02:00
initlist = build_tree_list (NULL_TREE, build_int_cst (NULL_TREE, size));
initlist = tree_cons (NULL_TREE, list, initlist);
Makefile.in (c-parse.o): Depend on $(C_COMMON_H). [gcc/ChangeLog] 2004-09-07 Ziemowit Laski <zlaski@apple.com> * Makefile.in (c-parse.o): Depend on $(C_COMMON_H). * c-parse.in: Include c-common.h instead of objc-act.h. (ivar_decl_list, ivar_decls, ivar_decl, ivars, ivar_declarator, myparms, myparm): Remove %type declarations. (methodtype, optparms, OBJC_TYPE_QUAL, objc_quals, objc_qual, objc_typename, objc_try_catch_stmt, optellipsis): Add %type declarations. (objc_inherit_code, objc_public_flag): Remove. (typespec_nonreserved_nonattr): Call objc_get_protocol_qualified_type() instead of get_static_reference() and get_protocol_reference(). (stmt_nocomp): Call grokparm() on @catch parameter. (objcdef): Move semantic action to objc_finish_implementation(). (classdef): Move semantic action to objc_start_class_interface(), objc_continue_interface(), objc_finish_interface(), objc_start_class_implementation(), objc_continue_implementation(), objc_start_category_interface() and objc_start_category_implementation(). (protocoldef): Move semantic actions to objc_start_protocol() and objc_finish_interface(). (ivar_decl_list): Remove nonterminal. (visibility_spec): Move semantic actions to objc_set_visibility(). (ivar_decls): Remove assignment to $$. (ivar_decl): Rephrase in terms of component_decl; call objc_add_instance_variable(). (ivars, ivar_declarator): Remove nonterminals. (opt_semi): New nonterminal. (methodtype): Remove semantic actions. (methoddef): Move semantic actions to objc_set_method_type(), objc_start_method_definition() and objc_finish_method_definition(). (methodproto): Move semantic actions to objc_set_method_type() and objc_add_method_declaration(). (methoddecl): Use objc_typename instead of typename; move semantic actions to objc_build_method_signature(). (optarglist, myxdecls, mydecl, myparms, myparm): Remove nonterminals. (optparmlist): Express in terms of optparms and optellipsis. (optparms, optellipsis, objc_qual, objc_quals, objc_typename): New nonterminals. (keyworddecl): Use objc_typename instead of typename. (rid_to_yy): Mark RID_IN, RID_OUT, RID_INOUT, RID_BYCOPY, RID_BYREF and RID_ONEWAY as returning OBJC_TYPE_QUAL to yyparse(). [gcc/objc/ChangeLog] 2004-09-07 Ziemowit Laski <zlaski@apple.com> * Make-lang.in (objc/objc-parse.o): Depend on $(C_COMMON_H) instead of objc/objc-act.h. (objc/objc-act.o): Depend on $(HASHTAB_H). * objc-act.c: Include hashtab.h; in ObjC++ mode, include cp-tree.h and objcp-decl.h instead of c-tree.h. (build_module_descriptor, get_class_ivars, synth_id_with_class_suffix, error_with_ivar, gen_method_decl, gen_declaration, setup_string_decl, build_protocol_template): Adjust prototypes. (build_module_initializer_routine, start_class, continue_class, finish_class, start_method_def, objc_start_function, start_protocol, build_method_decl, objc_add_method, add_instance_variable, build_ivar_reference, is_ivar, is_private, get_super_receiver, build_selector_table_decl, objc_push_parm, objc_get_parm_info, gen_type_name, gen_type_name_0, start_var_decl, finish_var_decl, create_field_decl): New prototypes. (objc_expand_function_end, comp_method_with_proto, objc_expr_last, gen_declaration_1, gen_declarator, is_complex_decl, adorn_decl, define_decl, create_builtin_decl, gen_declspecs): Remove prototypes. (TYPE_ID): Rename to OBJECT_TYPEDEF_NAME. (CLASS_TYPEDEF_NAME): New. (TAG_EXECCLASS): Change from a global variable to a #define. (TAG_RETURN_STRUCT): Delete. (TAG_GNUINIT): New, holds '__objc_gnu_init' name. (objc_inherit_code, objc_public_flag): New, moved from c-parse.in. (string_descriptor): New struct. (string_htab): New hash table. (string_hash, string_eq): New prototypes. (generate_struct_by_value_array): Call create_field_decl() instead of create_builtin_decl(). (objc_init): Do not initialize objc_ellipsis_node or TAG_EXECCLASS; In ObjC++ mode, call cxx_init() instead of c_objc_common_init(). (objc_finish_file): In ObjC++, call instantiate_pending_templates() and cp_finish_file(). (define_decl, get_static_reference, get_protocol_reference, create_builtin_decl): Remove functions. (objc_start_class_interface, objc_start_category_interface, objc_start_protocol, objc_continue_interface, objc_finish_interface, objc_start_class_implementation, objc_start_category_implementation, objc_continue_implementation, objc_finish_implementation, objc_set_visibility, objc_set_method_type, objc_build_method_signature, objc_add_method_declaration, objc_start_method_definition, objc_add_instance_variable, objc_get_protocol_qualified_type, create_field_decl, start_var_decl, finish_var_decl): New functions. (setup_string_decl): Simplify since it is only called once. (synth_module_prologue): Call build_class_template(); predefine 'id' and 'Class' as typedefs; rename 'temp_type' to 'type'; disable debug hooks for duration of function; fix GNU runtime messenger signatures to correspond to reality; forward-declare '__objc_exec_class' for the GNU runtime; call build_selector_table_decl(); in ObjC++ mode, generate 'extern "C" { ... }' wrappers around synthesized declarations; call build_protocol_template() and build_category_template(). (string_hash, string_eq): New functions. (objc_build_string_object): Check metaclass correctness only once; store string literals in hash table. (objc_build_constructor): Do not convert initializer elements; adjust for ObjC++ impedance mismatch. (build_objc_symtab_template): Call create_field_decl() instead of create_builtin_decl(). (init_objc_symtab): Add missing conversion to initializer element. (build_metadata_decl): Call start_var_decl() instead of define_decl(). (generate_objc_symtab_decl): Do not call build_category_template(); call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(). (build_module_descriptor): Call create_field_decl() instead of grokfield(); call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(); always mark module descriptor as used; move GNU runtime-specific functionality to build_module_initializer_routine(). (build_module_initializer_routine): New function, broken off of build_module_descriptor(). (objc_static_init_needed_p, objc_generate_static_init_call): New functions. (generate_static_references, generate_strings, build_selector_translation_table, generate_descriptor_table, generate_ivars_list, generate_dispatch_table, generate_category): Call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(); build a type directly instead of via groktypename(). (build_selector_reference_decl, build_selector_table_decl, build_class_reference_decl, build_protocol_reference, generate_objc_image_info): Call start_var_decl() instead of build_decl(). (build_selector_reference): For GNU runtime, do not call build_selector_reference_decl(). (build_selector, build_typed_selector_reference): Always convert result to the selector type. (add_objc_string): Cast return value to 'char *'. (build_method_prototype_template, build_selector_template, build_method_template): Use actual selector type for fields pointing to selectors. (finish_objc): For GNU runtime, call build_module_initializer_routine() after build_module_descriptor(). (generate_protocol_list, generate_shared_structures): Call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(); build a type directly instead of via groktypename(). (synth_id_with_class_suffix): Return a string. (get_arg_type_list): For instance methods, use the instance type for 'self'; do not call groktypename_in_parm_context(). (build_objc_string_decl): Squash redeclaration errors in ObjC++. (objc_is_class_name): Use OBJC_TYPE_NAME instead of TYPE_NAME; handle RECORD_TYPEs in ObjC as well as ObjC++. (objc_is_id): New function. (objc_is_object_ptr): Return the canonical type node. (objc_get_class_ivars): Simplify using get_class_ivars(). (get_class_ivars): Remove second parameter; create a fresh copy of the ivar list for each call; do not check for existence of super class. (objc_eh_runtime_type): Mark #ifndef OBJCPLUS. (objc_init_exceptions): When using SJLJ-style exceptions, require the use of '-fobjc-exceptions' flag; do not require it for DWARF-style exceptions. (objc_build_exc_ptr, next_sjlj_build_try_catch_finally): Use objc_object_type instead of objc_id_type. (objc_begin_catch_clause): Convert the incoming PARM_DECL into a VAR_DECL before placing it in the appropriate scope; do not call define_decl(); adjust call to c_begin_compound_stmt(); use objc_object_type instead of objc_id_type. (build_next_objc_exception_stuff): Call create_field_decl() instead of create_builtin_decl(); construct type directly instead of calling groktypename(); use OBJC_VOID_AT_END to mark end of function parameters. (build_private_template): Adjust call to get_class_ivars(); build a type directly instead of via groktypename(). (build_protocol_template, build_method_prototype_list_template, build_method_prototype_template, build_category_template, build_selector_template, build_class_template, build_super_template, build_ivar_template, build_ivar_list_template, build_method_list_template, build_method_template): Call create_field_decl() instead of grokfield(). (objc_method_parm_type): Do not call groktypename(). (generate_descriptor_table): Call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(). (generate_method_descriptors, build_protocol_initializer, generate_dispatch_tables, build_category_initializer, build_shared_structure_initializer): Do not call groktypename(). (generate_protocols): Call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(); do not call groktypename(). (error_with_ivar): Remove last parameter. (check_ivars): Do not iterate ovar CLASS_RAW_IVARS lists in addition to CLASS_IVARS lists; adjust calls to error_with_ivar(). (generate_ivar_lists): Convert one of the initializer elements; do not call groktypename(). (get_arg_type_list, start_method_def, gen_method_def): Account for new representation of variable arguments and '...' in Objective-C methods; add Objective-C++ impedance matching code. (is_objc_type_qualifier): Remove function. (adjust_type_for_id_default): Simplify; there is no longer a need to wade through declspecs. (lookup_interface, start_class, continue_class, finish_class, start_method_def, start_protocol, build_method_decl, objc_add_method, add_instance_variable, build_ivar_reference, is_ivar, is_private, get_super_receiver, objc_build_finally_epilogue): Make into static functions. (receiver_is_class_object): Use new IS_CLASS() macro. (objc_build_message_expr): Tweak ObjC++ message argument handling; call objc_finish_message_expr() instead of finish_message_expr(). (finish_message_expr): Rename to objc_finish_message_expr(); use OBJC_TYPE_NAME and OBJC_SET_TYPE_NAME macros instead of TYPE_NAME. call gen_type_name() instead of gen_declaration(); call objc_is_id() instead of using IS_ID and IS_CLASS; Use objc_class_name instead of calling get_identifier("Class"); handle CONVERT_EXPRs in receiver. (build_objc_method_call, warn_with_method): Do not call groktypename(). (build_ivar_reference): Call convert() instead of clobbering in a type. (hash_init): Initialize string_htab hash table. (add_instance_variable): Simplify parameter list; do not call grokfield(); do not populate CLASS_IVARS list. (start_class): Check for the existence of super class, if one was specified. (continue_class): Use CLASS_RAW_IVARS rather than CLASS_IVARS; do not call build_class_template(); adjust call to get_class_ivars(); call build_decl(), pushdecl() and finish_decl() instead of define_decl(). (finish_class): Call build_decl(), pushdecl() and finish_decl() instead of define_decl(). (add_protocols): Use PROTOCOL_BINFO_ELTS for the tree vector size. (start_protocol): Do not call build_protocol_template(); use PROTOCOL_BINFO_ELTS for the tree vector size. (encode_type_qualifiers): Do not handle the 'const' qualifier here. (encode_pointer): Encode 'const char *' as 'r*', for backwards compatibility. (encode_array): Use HOST_WIDE_INT_PRINT_DEC instead of "%ld". (encode_type): Handle the 'const' qualifier here. (objc_parmlist): New global variable, sued by objc_push_parm and objc_get_parm_info(). (objc_push_parm, objc_get_parm_info): New functions. (objc_expr_last): Remove function. (synth_self_and_ucmd_args): For instance methods, use the instance type for 'self'; call objc_push_parm() instead of push_parm_decl(). (start_method_def): Do not call push_scope(), declare_parm_level(), pop_scope(), push_parm_decl(), store_parm_decls() or objc_expr_last(); just use objc_push_parm() and objc_get_parm_info(). (comp_method_with_proto): Remove function. (objc_types_are_equivalent): Strip away indirections before comparing underlying types. (comp_proto_with_proto): Do not call groktypename(); types are no longer in raw declspec format. (objc_start_function): New function. (really_start_method): Call comp_proto_with_proto() instead of comp_method_with_proto(); call objc_start_function() instead of hand-crafting a function declarator. (continue_method_def, objc_expand_function_end): Remove functions. (get_super_receiver): Call objc_get_current_scope() instead of get_current_scope(); reference 'super_class' field (instead of 'class'). (finish_method_def): Rename to objc_finish_method_definition() and add a function decl parameter; move method encoding call from objc_expand_function_end(). (is_complex_decl, adorn_decl, gen_declarator, gen_declspecs, gen_declaration_1): Remove functions. (tmpbuf, RAW_DECLSPEC): Remove. (gen_declaration): Remove second parameter; simplify to deal with TYPE_P nodes instead of raw declspecs. (gen_type_name, gen_type_name_0): New functions. (gen_method_decl): Remove second parameter; call gen_type_name() instead of gen_declaration_1(). (dump_interface): Adjust calls to gen_declaration() and gen_method_decl(); do not allocate a separate string buffer. (init_objc): Allocate a larger string buffer to accommodate dump_interface(); adjust call to build_module_descriptor(); add call to build_module_initializer_routine() for the GNU runtime. (generate_classref_translation_entry): Do not call start_decl(); call finish_var_decl() instead of finish_decl(); call convert() instead of build_c_cast(). * objc-act.h (CLASS_OWN_IVARS): Remove accessor. (CLASS_BINFO_ELTS): Reduce from 6 to 5, now that CLASS_OWN_IVARS is gone. (OCTI_GNU_INIT_DECL, GNU_INIT_decl): New. (OCTI_ELLIPSIS_NODE, objc_ellipsis_node): Remove. (OCTI_ID_ID, id_type, objc_id_id): Rename to OCTI_ID_NAME, objc_object_type and objc_object_name, respectively. (OCTI_CLS_REF, OCTI_CLASS_NAME, objc_class_reference, objc_class_name): New. (IS_CLASS): New macro. (IS_ID, IS_SUPER): Robustify. (OCTI_EXECCLASS_DECL, execclass_decl): New. (finish_file, start_class, continue_class, finish_class, start_method_def, continue_method_def, finish_method_def, start_protocol, finish_protocol, objc_build_throw_stmt, objc_build_try_catch_finally_stmt, objc_build_synchronized_prologue, objc_build_synchronized_epilogue, objc_build_try_prologue, objc_build_try_epilogue, objc_build_catch_stmt, objc_build_catch_epilogue, objc_build_finally_prologue, objc_build_finally_epilogue, is_ivar, is_private, is_public, add_instance_variable, objc_add_method, get_super_receiver, objc_clear_super_receiver, get_class_ivars_from_name, get_class_reference, get_static_reference, get_object_reference, build_message_expr, finish_message_expr, build_selector_expr, build_ivar_reference, build_keyword_decl, build_method_decl, build_protocol_expr, build_objc_string_object, objc_declare_alias, objc_declare_class, objc_declare_protocols, objc_comptypes, objc_check_decl, build_encode_expr): Remove prototypes. (imp_count, cat_count): Make GGC-aware. (OBJC_SET_TYPE_NAME): New macro. From-SVN: r87168
2004-09-08 02:49:44 +02:00
finish_var_decl (decl, objc_build_constructor (type, nreverse (initlist)));
return decl;
}
static void
generate_method_descriptors (tree protocol)
{
tree initlist, chain, method_list_template;
int size;
if (!objc_method_prototype_template)
objc_method_prototype_template = build_method_prototype_template ();
chain = PROTOCOL_CLS_METHODS (protocol);
if (chain)
{
size = list_length (chain);
method_list_template
= build_method_prototype_list_template (objc_method_prototype_template,
size);
initlist
= build_descriptor_table_initializer (objc_method_prototype_template,
chain);
UOBJC_CLASS_METHODS_decl
= generate_descriptor_table (method_list_template,
"_OBJC_PROTOCOL_CLASS_METHODS",
size, initlist, protocol);
}
else
UOBJC_CLASS_METHODS_decl = 0;
chain = PROTOCOL_NST_METHODS (protocol);
if (chain)
{
size = list_length (chain);
method_list_template
= build_method_prototype_list_template (objc_method_prototype_template,
size);
initlist
= build_descriptor_table_initializer (objc_method_prototype_template,
chain);
UOBJC_INSTANCE_METHODS_decl
= generate_descriptor_table (method_list_template,
"_OBJC_PROTOCOL_INSTANCE_METHODS",
size, initlist, protocol);
}
else
UOBJC_INSTANCE_METHODS_decl = 0;
}
static void
generate_protocol_references (tree plist)
{
tree lproto;
1996-07-04 00:07:53 +02:00
/* Forward declare protocols referenced. */
for (lproto = plist; lproto; lproto = TREE_CHAIN (lproto))
{
tree proto = TREE_VALUE (lproto);
if (TREE_CODE (proto) == PROTOCOL_INTERFACE_TYPE
&& PROTOCOL_NAME (proto))
{
if (! PROTOCOL_FORWARD_DECL (proto))
build_protocol_reference (proto);
if (PROTOCOL_LIST (proto))
generate_protocol_references (PROTOCOL_LIST (proto));
}
}
1992-01-18 00:15:38 +01:00
}
Yet more Objective-C++... * objc-act.c (objc_finish_try_stmt): Add return value. (objc_build_synchronized): Likewise. * objc-act.c (objc_is_gcable_type): Add. (objc_substitute_decl): Add. (objc_build_ivar_assignment): Add. (objc_build_global_assignment): Add. (objc_build_strong_cast_assignment): Add. (objc_is_ivar_reference_p): Add. (objc_is_global_reference_p): Add. (objc_generate_write_barrier): Add. (objc_rewrite_function_call): Add. (objc_gimplify_expr): Add Objective-C++ support. * objc-act.h (ALLOC_OBJC_TYPE_LANG_SPECIFIC): Likewise. (SIZEOF_OBJC_TYPE_LANG_SPECIFIC): Add. (INIT_TYPE_OBJC_INFO): Add Objective-C++ support. (DUP_TYPE_OBJC_INFO): Likewise. (struct imp_entry): Add field has_cxx_cdtors. (struct imp_entry *imp_list): Add OCTI_UMSG_FAST_DECL, OCTI_METH_LIST_TEMPL, OCTI_METH_PROTO_LIST_TEMPL, OCTI_IVAR_LIST_TEMPL, OCTI_ASSIGN_IVAR_DECL, OCTI_ASSIGN_IVAR_FAST_DECL, OCTI_ASSIGN_GLOBAL_DECL, OCTI_ASSIGN_STRONGCAST_DECL. (umsg_fast_decl): Add. (objc_assign_ivar_decl): Add. (objc_assign_ivar_fast_decl): Add. (objc_assign_global_decl): Add. (objc_assign_strong_cast_decl): Add. (objc_method_list_ptr): Add. (objc_method_proto_list_ptr): Add. (objc_ivar_list_ptr): Add. * objc-act.c (should_call_super_dealloc): Add. (OBJC_VERSION): Bump to 6. (objc_is_gcable_type): Add. (objc_substitute_decl): Add. (objc_build_ivar_assignment): Add. (objc_build_global_assignment): Add. (objc_build_strong_cast_assignment): Add. (objc_is_gcable_p): Add. (objc_is_ivar_reference_p): Add. (objc_is_global_reference_p): Add. (generate_shared_structures): Add flags parameter. (objc_generate_cxx_ctor_or_dtor): Add. (objc_generate_cxx_cdtors): Add. (add_class): Add name parameter. (objc_types_share_size_and_alignment): Add. (comp_proto_with_proto): Add strict parameter. (CLS_HAS_CXX_STRUCTORS): Add. (TAG_ASSIGNIVAR): Add. (TAG_ASSIGNGLOBAL): Add. (TAG_ASSIGNSTRONGCAST): Add. (TAG_MSGSEND_FAST): Add. (TAG_ASSIGNIVAR_FAST): Add. (TAG_CXX_CONSTRUCT): Add. (TAG_CXX_DESTRUCT): Add. (OBJC_LOOKUP_CLASS): Add. (OBJC_LOOKUP_NO_SUPER): Add. (objc_finish_file): Add pch support. (objc_finish_implementation): Add Objective-C++ support. (synth_module_prologue): Likewise. (synth_module_prologue): Add fast dispatching. (objc_get_class_reference): Add Objective-C++ support. (objc_generate_write_barrier): Likewise. (next_sjlj_build_enter_and_setjmp): Likewise. (objc_begin_try_stmt): Likewise. (build_next_objc_exception_stuff): Add fast ivar support. (build_private_template): Mark the record as used so debug information is generated. (build_protocol_template): Add Objective-C++ support. (objc_method_parm_type) Likewise. (objc_generate_cxx_ctor_or_dtor): Likewise. (objc_generate_cxx_cdtors): Likewise. (build_protocol_initializer): Likewise. (build_category_template): Likewise. (build_class_template): Likewise. (build_method_list_template): Likewise. (build_category_initializer): Likewise. (build_shared_structure_initializer): Likewise. (objc_finish_message_expr): Likewise. (build_objc_method_call): Add fast dispatch support. (lookup_method_static): Add support to end search at superclasses. (add_method_to_hash_list): Add strict parameter to comp_proto_with_proto. (objc_add_method): Likewise. (objc_add_method): Also set the interface_value. (add_instance_variable): Add Objective-C++ support. (objc_is_public): Likewise. (start_class): Likewise. (continue_class): Likewise. (encode_aggregate_within): Likewise. (start_method_def): Likewise. (objc_start_function): Clear current_function_returns_value and current_function_returns_null. (really_start_method): Add Objective-C++ support. (objc_finish_method_definition): Add warning for missing [super dealloc]. (finish_objc): Add Objective-C++ support. (generate_objc_image_info): Likewise. (objc_lookup_ivar): Likewise. * objc-act.h (TYPE_HAS_OBJC_INFO): Likewise. (INIT_TYPE_OBJC_INFO): Likewise. (DUP_TYPE_OBJC_INFO): Likewise. From-SVN: r99857
2005-05-17 22:07:08 +02:00
/* Generate either '- .cxx_construct' or '- .cxx_destruct' for the
current class. */
#ifdef OBJCPLUS
static void
objc_generate_cxx_ctor_or_dtor (bool dtor)
{
tree fn, body, compound_stmt, ivar;
/* - (id) .cxx_construct { ... return self; } */
/* - (void) .cxx_construct { ... } */
objc_set_method_type (MINUS_EXPR);
objc_start_method_definition
(objc_build_method_signature (build_tree_list (NULL_TREE,
dtor
? void_type_node
: objc_object_type),
get_identifier (dtor
? TAG_CXX_DESTRUCT
: TAG_CXX_CONSTRUCT),
make_node (TREE_LIST),
false));
body = begin_function_body ();
compound_stmt = begin_compound_stmt (0);
ivar = CLASS_IVARS (implementation_template);
/* Destroy ivars in reverse order. */
if (dtor)
ivar = nreverse (copy_list (ivar));
for (; ivar; ivar = TREE_CHAIN (ivar))
{
if (TREE_CODE (ivar) == FIELD_DECL)
{
tree type = TREE_TYPE (ivar);
/* Call the ivar's default constructor or destructor. Do not
call the destructor unless a corresponding constructor call
has also been made (or is not needed). */
if (IS_AGGR_TYPE (type)
&& (dtor
? (TYPE_HAS_NONTRIVIAL_DESTRUCTOR (type)
&& (!TYPE_NEEDS_CONSTRUCTING (type)
|| TYPE_HAS_DEFAULT_CONSTRUCTOR (type)))
: (TYPE_NEEDS_CONSTRUCTING (type)
&& TYPE_HAS_DEFAULT_CONSTRUCTOR (type))))
finish_expr_stmt
(build_special_member_call
(build_ivar_reference (DECL_NAME (ivar)),
dtor ? complete_dtor_identifier : complete_ctor_identifier,
NULL_TREE, type, LOOKUP_NORMAL));
}
}
/* The constructor returns 'self'. */
if (!dtor)
finish_return_stmt (self_decl);
finish_compound_stmt (compound_stmt);
finish_function_body (body);
fn = current_function_decl;
finish_function ();
objc_finish_method_definition (fn);
}
/* The following routine will examine the current @interface for any
non-POD C++ ivars requiring non-trivial construction and/or
destruction, and then synthesize special '- .cxx_construct' and/or
'- .cxx_destruct' methods which will run the appropriate
construction or destruction code. Note that ivars inherited from
super-classes are _not_ considered. */
static void
objc_generate_cxx_cdtors (void)
{
bool need_ctor = false, need_dtor = false;
tree ivar;
/* We do not want to do this for categories, since they do not have
their own ivars. */
if (TREE_CODE (objc_implementation_context) != CLASS_IMPLEMENTATION_TYPE)
return;
/* First, determine if we even need a constructor and/or destructor. */
for (ivar = CLASS_IVARS (implementation_template); ivar;
ivar = TREE_CHAIN (ivar))
{
if (TREE_CODE (ivar) == FIELD_DECL)
{
tree type = TREE_TYPE (ivar);
if (IS_AGGR_TYPE (type))
{
if (TYPE_NEEDS_CONSTRUCTING (type)
&& TYPE_HAS_DEFAULT_CONSTRUCTOR (type))
/* NB: If a default constructor is not available, we will not
be able to initialize this ivar; the add_instance_variable()
routine will already have warned about this. */
need_ctor = true;
if (TYPE_HAS_NONTRIVIAL_DESTRUCTOR (type)
&& (!TYPE_NEEDS_CONSTRUCTING (type)
|| TYPE_HAS_DEFAULT_CONSTRUCTOR (type)))
/* NB: If a default constructor is not available, we will not
call the destructor either, for symmetry. */
need_dtor = true;
}
}
}
/* Generate '- .cxx_construct' if needed. */
if (need_ctor)
objc_generate_cxx_ctor_or_dtor (false);
/* Generate '- .cxx_destruct' if needed. */
if (need_dtor)
objc_generate_cxx_ctor_or_dtor (true);
/* The 'imp_list' variable points at an imp_entry record for the current
@implementation. Record the existence of '- .cxx_construct' and/or
'- .cxx_destruct' methods therein; it will be included in the
metadata for the class. */
if (flag_next_runtime)
imp_list->has_cxx_cdtors = (need_ctor || need_dtor);
}
#endif
/* For each protocol which was referenced either from a @protocol()
expression, or because a class/category implements it (then a
pointer to the protocol is stored in the struct describing the
class/category), we create a statically allocated instance of the
Protocol class. The code is written in such a way as to generate
as few Protocol objects as possible; we generate a unique Protocol
instance for each protocol, and we don't generate a Protocol
instance if the protocol is never referenced (either from a
@protocol() or from a class/category implementation). These
statically allocated objects can be referred to via the static
(that is, private to this module) symbols _OBJC_PROTOCOL_n.
The statically allocated Protocol objects that we generate here
need to be fixed up at runtime in order to be used: the 'isa'
pointer of the objects need to be set up to point to the 'Protocol'
class, as known at runtime.
The NeXT runtime fixes up all protocols at program startup time,
before main() is entered. It uses a low-level trick to look up all
those symbols, then loops on them and fixes them up.
The GNU runtime as well fixes up all protocols before user code
from the module is executed; it requires pointers to those symbols
to be put in the objc_symtab (which is then passed as argument to
the function __objc_exec_class() which the compiler sets up to be
executed automatically when the module is loaded); setup of those
Protocol objects happen in two ways in the GNU runtime: all
Protocol objects referred to by a class or category implementation
are fixed up when the class/category is loaded; all Protocol
objects referred to by a @protocol() expression are added by the
compiler to the list of statically allocated instances to fixup
(the same list holding the statically allocated constant string
objects). Because, as explained above, the compiler generates as
few Protocol objects as possible, some Protocol object might end up
being referenced multiple times when compiled with the GNU runtime,
and end up being fixed up multiple times at runtime initialization.
But that doesn't hurt, it's just a little inefficient. */
static void
generate_protocols (void)
1992-01-18 00:15:38 +01:00
{
tree p, encoding;
Makefile.in (c-parse.o): Depend on $(C_COMMON_H). [gcc/ChangeLog] 2004-09-07 Ziemowit Laski <zlaski@apple.com> * Makefile.in (c-parse.o): Depend on $(C_COMMON_H). * c-parse.in: Include c-common.h instead of objc-act.h. (ivar_decl_list, ivar_decls, ivar_decl, ivars, ivar_declarator, myparms, myparm): Remove %type declarations. (methodtype, optparms, OBJC_TYPE_QUAL, objc_quals, objc_qual, objc_typename, objc_try_catch_stmt, optellipsis): Add %type declarations. (objc_inherit_code, objc_public_flag): Remove. (typespec_nonreserved_nonattr): Call objc_get_protocol_qualified_type() instead of get_static_reference() and get_protocol_reference(). (stmt_nocomp): Call grokparm() on @catch parameter. (objcdef): Move semantic action to objc_finish_implementation(). (classdef): Move semantic action to objc_start_class_interface(), objc_continue_interface(), objc_finish_interface(), objc_start_class_implementation(), objc_continue_implementation(), objc_start_category_interface() and objc_start_category_implementation(). (protocoldef): Move semantic actions to objc_start_protocol() and objc_finish_interface(). (ivar_decl_list): Remove nonterminal. (visibility_spec): Move semantic actions to objc_set_visibility(). (ivar_decls): Remove assignment to $$. (ivar_decl): Rephrase in terms of component_decl; call objc_add_instance_variable(). (ivars, ivar_declarator): Remove nonterminals. (opt_semi): New nonterminal. (methodtype): Remove semantic actions. (methoddef): Move semantic actions to objc_set_method_type(), objc_start_method_definition() and objc_finish_method_definition(). (methodproto): Move semantic actions to objc_set_method_type() and objc_add_method_declaration(). (methoddecl): Use objc_typename instead of typename; move semantic actions to objc_build_method_signature(). (optarglist, myxdecls, mydecl, myparms, myparm): Remove nonterminals. (optparmlist): Express in terms of optparms and optellipsis. (optparms, optellipsis, objc_qual, objc_quals, objc_typename): New nonterminals. (keyworddecl): Use objc_typename instead of typename. (rid_to_yy): Mark RID_IN, RID_OUT, RID_INOUT, RID_BYCOPY, RID_BYREF and RID_ONEWAY as returning OBJC_TYPE_QUAL to yyparse(). [gcc/objc/ChangeLog] 2004-09-07 Ziemowit Laski <zlaski@apple.com> * Make-lang.in (objc/objc-parse.o): Depend on $(C_COMMON_H) instead of objc/objc-act.h. (objc/objc-act.o): Depend on $(HASHTAB_H). * objc-act.c: Include hashtab.h; in ObjC++ mode, include cp-tree.h and objcp-decl.h instead of c-tree.h. (build_module_descriptor, get_class_ivars, synth_id_with_class_suffix, error_with_ivar, gen_method_decl, gen_declaration, setup_string_decl, build_protocol_template): Adjust prototypes. (build_module_initializer_routine, start_class, continue_class, finish_class, start_method_def, objc_start_function, start_protocol, build_method_decl, objc_add_method, add_instance_variable, build_ivar_reference, is_ivar, is_private, get_super_receiver, build_selector_table_decl, objc_push_parm, objc_get_parm_info, gen_type_name, gen_type_name_0, start_var_decl, finish_var_decl, create_field_decl): New prototypes. (objc_expand_function_end, comp_method_with_proto, objc_expr_last, gen_declaration_1, gen_declarator, is_complex_decl, adorn_decl, define_decl, create_builtin_decl, gen_declspecs): Remove prototypes. (TYPE_ID): Rename to OBJECT_TYPEDEF_NAME. (CLASS_TYPEDEF_NAME): New. (TAG_EXECCLASS): Change from a global variable to a #define. (TAG_RETURN_STRUCT): Delete. (TAG_GNUINIT): New, holds '__objc_gnu_init' name. (objc_inherit_code, objc_public_flag): New, moved from c-parse.in. (string_descriptor): New struct. (string_htab): New hash table. (string_hash, string_eq): New prototypes. (generate_struct_by_value_array): Call create_field_decl() instead of create_builtin_decl(). (objc_init): Do not initialize objc_ellipsis_node or TAG_EXECCLASS; In ObjC++ mode, call cxx_init() instead of c_objc_common_init(). (objc_finish_file): In ObjC++, call instantiate_pending_templates() and cp_finish_file(). (define_decl, get_static_reference, get_protocol_reference, create_builtin_decl): Remove functions. (objc_start_class_interface, objc_start_category_interface, objc_start_protocol, objc_continue_interface, objc_finish_interface, objc_start_class_implementation, objc_start_category_implementation, objc_continue_implementation, objc_finish_implementation, objc_set_visibility, objc_set_method_type, objc_build_method_signature, objc_add_method_declaration, objc_start_method_definition, objc_add_instance_variable, objc_get_protocol_qualified_type, create_field_decl, start_var_decl, finish_var_decl): New functions. (setup_string_decl): Simplify since it is only called once. (synth_module_prologue): Call build_class_template(); predefine 'id' and 'Class' as typedefs; rename 'temp_type' to 'type'; disable debug hooks for duration of function; fix GNU runtime messenger signatures to correspond to reality; forward-declare '__objc_exec_class' for the GNU runtime; call build_selector_table_decl(); in ObjC++ mode, generate 'extern "C" { ... }' wrappers around synthesized declarations; call build_protocol_template() and build_category_template(). (string_hash, string_eq): New functions. (objc_build_string_object): Check metaclass correctness only once; store string literals in hash table. (objc_build_constructor): Do not convert initializer elements; adjust for ObjC++ impedance mismatch. (build_objc_symtab_template): Call create_field_decl() instead of create_builtin_decl(). (init_objc_symtab): Add missing conversion to initializer element. (build_metadata_decl): Call start_var_decl() instead of define_decl(). (generate_objc_symtab_decl): Do not call build_category_template(); call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(). (build_module_descriptor): Call create_field_decl() instead of grokfield(); call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(); always mark module descriptor as used; move GNU runtime-specific functionality to build_module_initializer_routine(). (build_module_initializer_routine): New function, broken off of build_module_descriptor(). (objc_static_init_needed_p, objc_generate_static_init_call): New functions. (generate_static_references, generate_strings, build_selector_translation_table, generate_descriptor_table, generate_ivars_list, generate_dispatch_table, generate_category): Call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(); build a type directly instead of via groktypename(). (build_selector_reference_decl, build_selector_table_decl, build_class_reference_decl, build_protocol_reference, generate_objc_image_info): Call start_var_decl() instead of build_decl(). (build_selector_reference): For GNU runtime, do not call build_selector_reference_decl(). (build_selector, build_typed_selector_reference): Always convert result to the selector type. (add_objc_string): Cast return value to 'char *'. (build_method_prototype_template, build_selector_template, build_method_template): Use actual selector type for fields pointing to selectors. (finish_objc): For GNU runtime, call build_module_initializer_routine() after build_module_descriptor(). (generate_protocol_list, generate_shared_structures): Call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(); build a type directly instead of via groktypename(). (synth_id_with_class_suffix): Return a string. (get_arg_type_list): For instance methods, use the instance type for 'self'; do not call groktypename_in_parm_context(). (build_objc_string_decl): Squash redeclaration errors in ObjC++. (objc_is_class_name): Use OBJC_TYPE_NAME instead of TYPE_NAME; handle RECORD_TYPEs in ObjC as well as ObjC++. (objc_is_id): New function. (objc_is_object_ptr): Return the canonical type node. (objc_get_class_ivars): Simplify using get_class_ivars(). (get_class_ivars): Remove second parameter; create a fresh copy of the ivar list for each call; do not check for existence of super class. (objc_eh_runtime_type): Mark #ifndef OBJCPLUS. (objc_init_exceptions): When using SJLJ-style exceptions, require the use of '-fobjc-exceptions' flag; do not require it for DWARF-style exceptions. (objc_build_exc_ptr, next_sjlj_build_try_catch_finally): Use objc_object_type instead of objc_id_type. (objc_begin_catch_clause): Convert the incoming PARM_DECL into a VAR_DECL before placing it in the appropriate scope; do not call define_decl(); adjust call to c_begin_compound_stmt(); use objc_object_type instead of objc_id_type. (build_next_objc_exception_stuff): Call create_field_decl() instead of create_builtin_decl(); construct type directly instead of calling groktypename(); use OBJC_VOID_AT_END to mark end of function parameters. (build_private_template): Adjust call to get_class_ivars(); build a type directly instead of via groktypename(). (build_protocol_template, build_method_prototype_list_template, build_method_prototype_template, build_category_template, build_selector_template, build_class_template, build_super_template, build_ivar_template, build_ivar_list_template, build_method_list_template, build_method_template): Call create_field_decl() instead of grokfield(). (objc_method_parm_type): Do not call groktypename(). (generate_descriptor_table): Call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(). (generate_method_descriptors, build_protocol_initializer, generate_dispatch_tables, build_category_initializer, build_shared_structure_initializer): Do not call groktypename(). (generate_protocols): Call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(); do not call groktypename(). (error_with_ivar): Remove last parameter. (check_ivars): Do not iterate ovar CLASS_RAW_IVARS lists in addition to CLASS_IVARS lists; adjust calls to error_with_ivar(). (generate_ivar_lists): Convert one of the initializer elements; do not call groktypename(). (get_arg_type_list, start_method_def, gen_method_def): Account for new representation of variable arguments and '...' in Objective-C methods; add Objective-C++ impedance matching code. (is_objc_type_qualifier): Remove function. (adjust_type_for_id_default): Simplify; there is no longer a need to wade through declspecs. (lookup_interface, start_class, continue_class, finish_class, start_method_def, start_protocol, build_method_decl, objc_add_method, add_instance_variable, build_ivar_reference, is_ivar, is_private, get_super_receiver, objc_build_finally_epilogue): Make into static functions. (receiver_is_class_object): Use new IS_CLASS() macro. (objc_build_message_expr): Tweak ObjC++ message argument handling; call objc_finish_message_expr() instead of finish_message_expr(). (finish_message_expr): Rename to objc_finish_message_expr(); use OBJC_TYPE_NAME and OBJC_SET_TYPE_NAME macros instead of TYPE_NAME. call gen_type_name() instead of gen_declaration(); call objc_is_id() instead of using IS_ID and IS_CLASS; Use objc_class_name instead of calling get_identifier("Class"); handle CONVERT_EXPRs in receiver. (build_objc_method_call, warn_with_method): Do not call groktypename(). (build_ivar_reference): Call convert() instead of clobbering in a type. (hash_init): Initialize string_htab hash table. (add_instance_variable): Simplify parameter list; do not call grokfield(); do not populate CLASS_IVARS list. (start_class): Check for the existence of super class, if one was specified. (continue_class): Use CLASS_RAW_IVARS rather than CLASS_IVARS; do not call build_class_template(); adjust call to get_class_ivars(); call build_decl(), pushdecl() and finish_decl() instead of define_decl(). (finish_class): Call build_decl(), pushdecl() and finish_decl() instead of define_decl(). (add_protocols): Use PROTOCOL_BINFO_ELTS for the tree vector size. (start_protocol): Do not call build_protocol_template(); use PROTOCOL_BINFO_ELTS for the tree vector size. (encode_type_qualifiers): Do not handle the 'const' qualifier here. (encode_pointer): Encode 'const char *' as 'r*', for backwards compatibility. (encode_array): Use HOST_WIDE_INT_PRINT_DEC instead of "%ld". (encode_type): Handle the 'const' qualifier here. (objc_parmlist): New global variable, sued by objc_push_parm and objc_get_parm_info(). (objc_push_parm, objc_get_parm_info): New functions. (objc_expr_last): Remove function. (synth_self_and_ucmd_args): For instance methods, use the instance type for 'self'; call objc_push_parm() instead of push_parm_decl(). (start_method_def): Do not call push_scope(), declare_parm_level(), pop_scope(), push_parm_decl(), store_parm_decls() or objc_expr_last(); just use objc_push_parm() and objc_get_parm_info(). (comp_method_with_proto): Remove function. (objc_types_are_equivalent): Strip away indirections before comparing underlying types. (comp_proto_with_proto): Do not call groktypename(); types are no longer in raw declspec format. (objc_start_function): New function. (really_start_method): Call comp_proto_with_proto() instead of comp_method_with_proto(); call objc_start_function() instead of hand-crafting a function declarator. (continue_method_def, objc_expand_function_end): Remove functions. (get_super_receiver): Call objc_get_current_scope() instead of get_current_scope(); reference 'super_class' field (instead of 'class'). (finish_method_def): Rename to objc_finish_method_definition() and add a function decl parameter; move method encoding call from objc_expand_function_end(). (is_complex_decl, adorn_decl, gen_declarator, gen_declspecs, gen_declaration_1): Remove functions. (tmpbuf, RAW_DECLSPEC): Remove. (gen_declaration): Remove second parameter; simplify to deal with TYPE_P nodes instead of raw declspecs. (gen_type_name, gen_type_name_0): New functions. (gen_method_decl): Remove second parameter; call gen_type_name() instead of gen_declaration_1(). (dump_interface): Adjust calls to gen_declaration() and gen_method_decl(); do not allocate a separate string buffer. (init_objc): Allocate a larger string buffer to accommodate dump_interface(); adjust call to build_module_descriptor(); add call to build_module_initializer_routine() for the GNU runtime. (generate_classref_translation_entry): Do not call start_decl(); call finish_var_decl() instead of finish_decl(); call convert() instead of build_c_cast(). * objc-act.h (CLASS_OWN_IVARS): Remove accessor. (CLASS_BINFO_ELTS): Reduce from 6 to 5, now that CLASS_OWN_IVARS is gone. (OCTI_GNU_INIT_DECL, GNU_INIT_decl): New. (OCTI_ELLIPSIS_NODE, objc_ellipsis_node): Remove. (OCTI_ID_ID, id_type, objc_id_id): Rename to OCTI_ID_NAME, objc_object_type and objc_object_name, respectively. (OCTI_CLS_REF, OCTI_CLASS_NAME, objc_class_reference, objc_class_name): New. (IS_CLASS): New macro. (IS_ID, IS_SUPER): Robustify. (OCTI_EXECCLASS_DECL, execclass_decl): New. (finish_file, start_class, continue_class, finish_class, start_method_def, continue_method_def, finish_method_def, start_protocol, finish_protocol, objc_build_throw_stmt, objc_build_try_catch_finally_stmt, objc_build_synchronized_prologue, objc_build_synchronized_epilogue, objc_build_try_prologue, objc_build_try_epilogue, objc_build_catch_stmt, objc_build_catch_epilogue, objc_build_finally_prologue, objc_build_finally_epilogue, is_ivar, is_private, is_public, add_instance_variable, objc_add_method, get_super_receiver, objc_clear_super_receiver, get_class_ivars_from_name, get_class_reference, get_static_reference, get_object_reference, build_message_expr, finish_message_expr, build_selector_expr, build_ivar_reference, build_keyword_decl, build_method_decl, build_protocol_expr, build_objc_string_object, objc_declare_alias, objc_declare_class, objc_declare_protocols, objc_comptypes, objc_check_decl, build_encode_expr): Remove prototypes. (imp_count, cat_count): Make GGC-aware. (OBJC_SET_TYPE_NAME): New macro. From-SVN: r87168
2004-09-08 02:49:44 +02:00
tree decl;
tree initlist, protocol_name_expr, refs_decl, refs_expr;
1992-01-18 00:15:38 +01:00
/* If a protocol was directly referenced, pull in indirect references. */
for (p = protocol_chain; p; p = TREE_CHAIN (p))
if (PROTOCOL_FORWARD_DECL (p) && PROTOCOL_LIST (p))
generate_protocol_references (PROTOCOL_LIST (p));
for (p = protocol_chain; p; p = TREE_CHAIN (p))
1992-01-18 00:15:38 +01:00
{
tree nst_methods = PROTOCOL_NST_METHODS (p);
tree cls_methods = PROTOCOL_CLS_METHODS (p);
1992-01-18 00:15:38 +01:00
/* If protocol wasn't referenced, don't generate any code. */
Makefile.in (c-parse.o): Depend on $(C_COMMON_H). [gcc/ChangeLog] 2004-09-07 Ziemowit Laski <zlaski@apple.com> * Makefile.in (c-parse.o): Depend on $(C_COMMON_H). * c-parse.in: Include c-common.h instead of objc-act.h. (ivar_decl_list, ivar_decls, ivar_decl, ivars, ivar_declarator, myparms, myparm): Remove %type declarations. (methodtype, optparms, OBJC_TYPE_QUAL, objc_quals, objc_qual, objc_typename, objc_try_catch_stmt, optellipsis): Add %type declarations. (objc_inherit_code, objc_public_flag): Remove. (typespec_nonreserved_nonattr): Call objc_get_protocol_qualified_type() instead of get_static_reference() and get_protocol_reference(). (stmt_nocomp): Call grokparm() on @catch parameter. (objcdef): Move semantic action to objc_finish_implementation(). (classdef): Move semantic action to objc_start_class_interface(), objc_continue_interface(), objc_finish_interface(), objc_start_class_implementation(), objc_continue_implementation(), objc_start_category_interface() and objc_start_category_implementation(). (protocoldef): Move semantic actions to objc_start_protocol() and objc_finish_interface(). (ivar_decl_list): Remove nonterminal. (visibility_spec): Move semantic actions to objc_set_visibility(). (ivar_decls): Remove assignment to $$. (ivar_decl): Rephrase in terms of component_decl; call objc_add_instance_variable(). (ivars, ivar_declarator): Remove nonterminals. (opt_semi): New nonterminal. (methodtype): Remove semantic actions. (methoddef): Move semantic actions to objc_set_method_type(), objc_start_method_definition() and objc_finish_method_definition(). (methodproto): Move semantic actions to objc_set_method_type() and objc_add_method_declaration(). (methoddecl): Use objc_typename instead of typename; move semantic actions to objc_build_method_signature(). (optarglist, myxdecls, mydecl, myparms, myparm): Remove nonterminals. (optparmlist): Express in terms of optparms and optellipsis. (optparms, optellipsis, objc_qual, objc_quals, objc_typename): New nonterminals. (keyworddecl): Use objc_typename instead of typename. (rid_to_yy): Mark RID_IN, RID_OUT, RID_INOUT, RID_BYCOPY, RID_BYREF and RID_ONEWAY as returning OBJC_TYPE_QUAL to yyparse(). [gcc/objc/ChangeLog] 2004-09-07 Ziemowit Laski <zlaski@apple.com> * Make-lang.in (objc/objc-parse.o): Depend on $(C_COMMON_H) instead of objc/objc-act.h. (objc/objc-act.o): Depend on $(HASHTAB_H). * objc-act.c: Include hashtab.h; in ObjC++ mode, include cp-tree.h and objcp-decl.h instead of c-tree.h. (build_module_descriptor, get_class_ivars, synth_id_with_class_suffix, error_with_ivar, gen_method_decl, gen_declaration, setup_string_decl, build_protocol_template): Adjust prototypes. (build_module_initializer_routine, start_class, continue_class, finish_class, start_method_def, objc_start_function, start_protocol, build_method_decl, objc_add_method, add_instance_variable, build_ivar_reference, is_ivar, is_private, get_super_receiver, build_selector_table_decl, objc_push_parm, objc_get_parm_info, gen_type_name, gen_type_name_0, start_var_decl, finish_var_decl, create_field_decl): New prototypes. (objc_expand_function_end, comp_method_with_proto, objc_expr_last, gen_declaration_1, gen_declarator, is_complex_decl, adorn_decl, define_decl, create_builtin_decl, gen_declspecs): Remove prototypes. (TYPE_ID): Rename to OBJECT_TYPEDEF_NAME. (CLASS_TYPEDEF_NAME): New. (TAG_EXECCLASS): Change from a global variable to a #define. (TAG_RETURN_STRUCT): Delete. (TAG_GNUINIT): New, holds '__objc_gnu_init' name. (objc_inherit_code, objc_public_flag): New, moved from c-parse.in. (string_descriptor): New struct. (string_htab): New hash table. (string_hash, string_eq): New prototypes. (generate_struct_by_value_array): Call create_field_decl() instead of create_builtin_decl(). (objc_init): Do not initialize objc_ellipsis_node or TAG_EXECCLASS; In ObjC++ mode, call cxx_init() instead of c_objc_common_init(). (objc_finish_file): In ObjC++, call instantiate_pending_templates() and cp_finish_file(). (define_decl, get_static_reference, get_protocol_reference, create_builtin_decl): Remove functions. (objc_start_class_interface, objc_start_category_interface, objc_start_protocol, objc_continue_interface, objc_finish_interface, objc_start_class_implementation, objc_start_category_implementation, objc_continue_implementation, objc_finish_implementation, objc_set_visibility, objc_set_method_type, objc_build_method_signature, objc_add_method_declaration, objc_start_method_definition, objc_add_instance_variable, objc_get_protocol_qualified_type, create_field_decl, start_var_decl, finish_var_decl): New functions. (setup_string_decl): Simplify since it is only called once. (synth_module_prologue): Call build_class_template(); predefine 'id' and 'Class' as typedefs; rename 'temp_type' to 'type'; disable debug hooks for duration of function; fix GNU runtime messenger signatures to correspond to reality; forward-declare '__objc_exec_class' for the GNU runtime; call build_selector_table_decl(); in ObjC++ mode, generate 'extern "C" { ... }' wrappers around synthesized declarations; call build_protocol_template() and build_category_template(). (string_hash, string_eq): New functions. (objc_build_string_object): Check metaclass correctness only once; store string literals in hash table. (objc_build_constructor): Do not convert initializer elements; adjust for ObjC++ impedance mismatch. (build_objc_symtab_template): Call create_field_decl() instead of create_builtin_decl(). (init_objc_symtab): Add missing conversion to initializer element. (build_metadata_decl): Call start_var_decl() instead of define_decl(). (generate_objc_symtab_decl): Do not call build_category_template(); call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(). (build_module_descriptor): Call create_field_decl() instead of grokfield(); call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(); always mark module descriptor as used; move GNU runtime-specific functionality to build_module_initializer_routine(). (build_module_initializer_routine): New function, broken off of build_module_descriptor(). (objc_static_init_needed_p, objc_generate_static_init_call): New functions. (generate_static_references, generate_strings, build_selector_translation_table, generate_descriptor_table, generate_ivars_list, generate_dispatch_table, generate_category): Call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(); build a type directly instead of via groktypename(). (build_selector_reference_decl, build_selector_table_decl, build_class_reference_decl, build_protocol_reference, generate_objc_image_info): Call start_var_decl() instead of build_decl(). (build_selector_reference): For GNU runtime, do not call build_selector_reference_decl(). (build_selector, build_typed_selector_reference): Always convert result to the selector type. (add_objc_string): Cast return value to 'char *'. (build_method_prototype_template, build_selector_template, build_method_template): Use actual selector type for fields pointing to selectors. (finish_objc): For GNU runtime, call build_module_initializer_routine() after build_module_descriptor(). (generate_protocol_list, generate_shared_structures): Call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(); build a type directly instead of via groktypename(). (synth_id_with_class_suffix): Return a string. (get_arg_type_list): For instance methods, use the instance type for 'self'; do not call groktypename_in_parm_context(). (build_objc_string_decl): Squash redeclaration errors in ObjC++. (objc_is_class_name): Use OBJC_TYPE_NAME instead of TYPE_NAME; handle RECORD_TYPEs in ObjC as well as ObjC++. (objc_is_id): New function. (objc_is_object_ptr): Return the canonical type node. (objc_get_class_ivars): Simplify using get_class_ivars(). (get_class_ivars): Remove second parameter; create a fresh copy of the ivar list for each call; do not check for existence of super class. (objc_eh_runtime_type): Mark #ifndef OBJCPLUS. (objc_init_exceptions): When using SJLJ-style exceptions, require the use of '-fobjc-exceptions' flag; do not require it for DWARF-style exceptions. (objc_build_exc_ptr, next_sjlj_build_try_catch_finally): Use objc_object_type instead of objc_id_type. (objc_begin_catch_clause): Convert the incoming PARM_DECL into a VAR_DECL before placing it in the appropriate scope; do not call define_decl(); adjust call to c_begin_compound_stmt(); use objc_object_type instead of objc_id_type. (build_next_objc_exception_stuff): Call create_field_decl() instead of create_builtin_decl(); construct type directly instead of calling groktypename(); use OBJC_VOID_AT_END to mark end of function parameters. (build_private_template): Adjust call to get_class_ivars(); build a type directly instead of via groktypename(). (build_protocol_template, build_method_prototype_list_template, build_method_prototype_template, build_category_template, build_selector_template, build_class_template, build_super_template, build_ivar_template, build_ivar_list_template, build_method_list_template, build_method_template): Call create_field_decl() instead of grokfield(). (objc_method_parm_type): Do not call groktypename(). (generate_descriptor_table): Call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(). (generate_method_descriptors, build_protocol_initializer, generate_dispatch_tables, build_category_initializer, build_shared_structure_initializer): Do not call groktypename(). (generate_protocols): Call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(); do not call groktypename(). (error_with_ivar): Remove last parameter. (check_ivars): Do not iterate ovar CLASS_RAW_IVARS lists in addition to CLASS_IVARS lists; adjust calls to error_with_ivar(). (generate_ivar_lists): Convert one of the initializer elements; do not call groktypename(). (get_arg_type_list, start_method_def, gen_method_def): Account for new representation of variable arguments and '...' in Objective-C methods; add Objective-C++ impedance matching code. (is_objc_type_qualifier): Remove function. (adjust_type_for_id_default): Simplify; there is no longer a need to wade through declspecs. (lookup_interface, start_class, continue_class, finish_class, start_method_def, start_protocol, build_method_decl, objc_add_method, add_instance_variable, build_ivar_reference, is_ivar, is_private, get_super_receiver, objc_build_finally_epilogue): Make into static functions. (receiver_is_class_object): Use new IS_CLASS() macro. (objc_build_message_expr): Tweak ObjC++ message argument handling; call objc_finish_message_expr() instead of finish_message_expr(). (finish_message_expr): Rename to objc_finish_message_expr(); use OBJC_TYPE_NAME and OBJC_SET_TYPE_NAME macros instead of TYPE_NAME. call gen_type_name() instead of gen_declaration(); call objc_is_id() instead of using IS_ID and IS_CLASS; Use objc_class_name instead of calling get_identifier("Class"); handle CONVERT_EXPRs in receiver. (build_objc_method_call, warn_with_method): Do not call groktypename(). (build_ivar_reference): Call convert() instead of clobbering in a type. (hash_init): Initialize string_htab hash table. (add_instance_variable): Simplify parameter list; do not call grokfield(); do not populate CLASS_IVARS list. (start_class): Check for the existence of super class, if one was specified. (continue_class): Use CLASS_RAW_IVARS rather than CLASS_IVARS; do not call build_class_template(); adjust call to get_class_ivars(); call build_decl(), pushdecl() and finish_decl() instead of define_decl(). (finish_class): Call build_decl(), pushdecl() and finish_decl() instead of define_decl(). (add_protocols): Use PROTOCOL_BINFO_ELTS for the tree vector size. (start_protocol): Do not call build_protocol_template(); use PROTOCOL_BINFO_ELTS for the tree vector size. (encode_type_qualifiers): Do not handle the 'const' qualifier here. (encode_pointer): Encode 'const char *' as 'r*', for backwards compatibility. (encode_array): Use HOST_WIDE_INT_PRINT_DEC instead of "%ld". (encode_type): Handle the 'const' qualifier here. (objc_parmlist): New global variable, sued by objc_push_parm and objc_get_parm_info(). (objc_push_parm, objc_get_parm_info): New functions. (objc_expr_last): Remove function. (synth_self_and_ucmd_args): For instance methods, use the instance type for 'self'; call objc_push_parm() instead of push_parm_decl(). (start_method_def): Do not call push_scope(), declare_parm_level(), pop_scope(), push_parm_decl(), store_parm_decls() or objc_expr_last(); just use objc_push_parm() and objc_get_parm_info(). (comp_method_with_proto): Remove function. (objc_types_are_equivalent): Strip away indirections before comparing underlying types. (comp_proto_with_proto): Do not call groktypename(); types are no longer in raw declspec format. (objc_start_function): New function. (really_start_method): Call comp_proto_with_proto() instead of comp_method_with_proto(); call objc_start_function() instead of hand-crafting a function declarator. (continue_method_def, objc_expand_function_end): Remove functions. (get_super_receiver): Call objc_get_current_scope() instead of get_current_scope(); reference 'super_class' field (instead of 'class'). (finish_method_def): Rename to objc_finish_method_definition() and add a function decl parameter; move method encoding call from objc_expand_function_end(). (is_complex_decl, adorn_decl, gen_declarator, gen_declspecs, gen_declaration_1): Remove functions. (tmpbuf, RAW_DECLSPEC): Remove. (gen_declaration): Remove second parameter; simplify to deal with TYPE_P nodes instead of raw declspecs. (gen_type_name, gen_type_name_0): New functions. (gen_method_decl): Remove second parameter; call gen_type_name() instead of gen_declaration_1(). (dump_interface): Adjust calls to gen_declaration() and gen_method_decl(); do not allocate a separate string buffer. (init_objc): Allocate a larger string buffer to accommodate dump_interface(); adjust call to build_module_descriptor(); add call to build_module_initializer_routine() for the GNU runtime. (generate_classref_translation_entry): Do not call start_decl(); call finish_var_decl() instead of finish_decl(); call convert() instead of build_c_cast(). * objc-act.h (CLASS_OWN_IVARS): Remove accessor. (CLASS_BINFO_ELTS): Reduce from 6 to 5, now that CLASS_OWN_IVARS is gone. (OCTI_GNU_INIT_DECL, GNU_INIT_decl): New. (OCTI_ELLIPSIS_NODE, objc_ellipsis_node): Remove. (OCTI_ID_ID, id_type, objc_id_id): Rename to OCTI_ID_NAME, objc_object_type and objc_object_name, respectively. (OCTI_CLS_REF, OCTI_CLASS_NAME, objc_class_reference, objc_class_name): New. (IS_CLASS): New macro. (IS_ID, IS_SUPER): Robustify. (OCTI_EXECCLASS_DECL, execclass_decl): New. (finish_file, start_class, continue_class, finish_class, start_method_def, continue_method_def, finish_method_def, start_protocol, finish_protocol, objc_build_throw_stmt, objc_build_try_catch_finally_stmt, objc_build_synchronized_prologue, objc_build_synchronized_epilogue, objc_build_try_prologue, objc_build_try_epilogue, objc_build_catch_stmt, objc_build_catch_epilogue, objc_build_finally_prologue, objc_build_finally_epilogue, is_ivar, is_private, is_public, add_instance_variable, objc_add_method, get_super_receiver, objc_clear_super_receiver, get_class_ivars_from_name, get_class_reference, get_static_reference, get_object_reference, build_message_expr, finish_message_expr, build_selector_expr, build_ivar_reference, build_keyword_decl, build_method_decl, build_protocol_expr, build_objc_string_object, objc_declare_alias, objc_declare_class, objc_declare_protocols, objc_comptypes, objc_check_decl, build_encode_expr): Remove prototypes. (imp_count, cat_count): Make GGC-aware. (OBJC_SET_TYPE_NAME): New macro. From-SVN: r87168
2004-09-08 02:49:44 +02:00
decl = PROTOCOL_FORWARD_DECL (p);
if (!decl)
continue;
1992-01-18 00:15:38 +01:00
1996-07-04 00:07:53 +02:00
/* Make sure we link in the Protocol class. */
add_class_reference (get_identifier (PROTOCOL_OBJECT_CLASS_NAME));
1992-01-18 00:15:38 +01:00
while (nst_methods)
{
if (! METHOD_ENCODING (nst_methods))
{
encoding = encode_method_prototype (nst_methods);
METHOD_ENCODING (nst_methods) = encoding;
}
nst_methods = TREE_CHAIN (nst_methods);
}
while (cls_methods)
{
if (! METHOD_ENCODING (cls_methods))
{
encoding = encode_method_prototype (cls_methods);
METHOD_ENCODING (cls_methods) = encoding;
}
cls_methods = TREE_CHAIN (cls_methods);
}
generate_method_descriptors (p);
if (PROTOCOL_LIST (p))
refs_decl = generate_protocol_list (p);
else
refs_decl = 0;
/* static struct objc_protocol _OBJC_PROTOCOL_<mumble>; */
protocol_name_expr = add_objc_string (PROTOCOL_NAME (p), class_names);
if (refs_decl)
Makefile.in (c-parse.o): Depend on $(C_COMMON_H). [gcc/ChangeLog] 2004-09-07 Ziemowit Laski <zlaski@apple.com> * Makefile.in (c-parse.o): Depend on $(C_COMMON_H). * c-parse.in: Include c-common.h instead of objc-act.h. (ivar_decl_list, ivar_decls, ivar_decl, ivars, ivar_declarator, myparms, myparm): Remove %type declarations. (methodtype, optparms, OBJC_TYPE_QUAL, objc_quals, objc_qual, objc_typename, objc_try_catch_stmt, optellipsis): Add %type declarations. (objc_inherit_code, objc_public_flag): Remove. (typespec_nonreserved_nonattr): Call objc_get_protocol_qualified_type() instead of get_static_reference() and get_protocol_reference(). (stmt_nocomp): Call grokparm() on @catch parameter. (objcdef): Move semantic action to objc_finish_implementation(). (classdef): Move semantic action to objc_start_class_interface(), objc_continue_interface(), objc_finish_interface(), objc_start_class_implementation(), objc_continue_implementation(), objc_start_category_interface() and objc_start_category_implementation(). (protocoldef): Move semantic actions to objc_start_protocol() and objc_finish_interface(). (ivar_decl_list): Remove nonterminal. (visibility_spec): Move semantic actions to objc_set_visibility(). (ivar_decls): Remove assignment to $$. (ivar_decl): Rephrase in terms of component_decl; call objc_add_instance_variable(). (ivars, ivar_declarator): Remove nonterminals. (opt_semi): New nonterminal. (methodtype): Remove semantic actions. (methoddef): Move semantic actions to objc_set_method_type(), objc_start_method_definition() and objc_finish_method_definition(). (methodproto): Move semantic actions to objc_set_method_type() and objc_add_method_declaration(). (methoddecl): Use objc_typename instead of typename; move semantic actions to objc_build_method_signature(). (optarglist, myxdecls, mydecl, myparms, myparm): Remove nonterminals. (optparmlist): Express in terms of optparms and optellipsis. (optparms, optellipsis, objc_qual, objc_quals, objc_typename): New nonterminals. (keyworddecl): Use objc_typename instead of typename. (rid_to_yy): Mark RID_IN, RID_OUT, RID_INOUT, RID_BYCOPY, RID_BYREF and RID_ONEWAY as returning OBJC_TYPE_QUAL to yyparse(). [gcc/objc/ChangeLog] 2004-09-07 Ziemowit Laski <zlaski@apple.com> * Make-lang.in (objc/objc-parse.o): Depend on $(C_COMMON_H) instead of objc/objc-act.h. (objc/objc-act.o): Depend on $(HASHTAB_H). * objc-act.c: Include hashtab.h; in ObjC++ mode, include cp-tree.h and objcp-decl.h instead of c-tree.h. (build_module_descriptor, get_class_ivars, synth_id_with_class_suffix, error_with_ivar, gen_method_decl, gen_declaration, setup_string_decl, build_protocol_template): Adjust prototypes. (build_module_initializer_routine, start_class, continue_class, finish_class, start_method_def, objc_start_function, start_protocol, build_method_decl, objc_add_method, add_instance_variable, build_ivar_reference, is_ivar, is_private, get_super_receiver, build_selector_table_decl, objc_push_parm, objc_get_parm_info, gen_type_name, gen_type_name_0, start_var_decl, finish_var_decl, create_field_decl): New prototypes. (objc_expand_function_end, comp_method_with_proto, objc_expr_last, gen_declaration_1, gen_declarator, is_complex_decl, adorn_decl, define_decl, create_builtin_decl, gen_declspecs): Remove prototypes. (TYPE_ID): Rename to OBJECT_TYPEDEF_NAME. (CLASS_TYPEDEF_NAME): New. (TAG_EXECCLASS): Change from a global variable to a #define. (TAG_RETURN_STRUCT): Delete. (TAG_GNUINIT): New, holds '__objc_gnu_init' name. (objc_inherit_code, objc_public_flag): New, moved from c-parse.in. (string_descriptor): New struct. (string_htab): New hash table. (string_hash, string_eq): New prototypes. (generate_struct_by_value_array): Call create_field_decl() instead of create_builtin_decl(). (objc_init): Do not initialize objc_ellipsis_node or TAG_EXECCLASS; In ObjC++ mode, call cxx_init() instead of c_objc_common_init(). (objc_finish_file): In ObjC++, call instantiate_pending_templates() and cp_finish_file(). (define_decl, get_static_reference, get_protocol_reference, create_builtin_decl): Remove functions. (objc_start_class_interface, objc_start_category_interface, objc_start_protocol, objc_continue_interface, objc_finish_interface, objc_start_class_implementation, objc_start_category_implementation, objc_continue_implementation, objc_finish_implementation, objc_set_visibility, objc_set_method_type, objc_build_method_signature, objc_add_method_declaration, objc_start_method_definition, objc_add_instance_variable, objc_get_protocol_qualified_type, create_field_decl, start_var_decl, finish_var_decl): New functions. (setup_string_decl): Simplify since it is only called once. (synth_module_prologue): Call build_class_template(); predefine 'id' and 'Class' as typedefs; rename 'temp_type' to 'type'; disable debug hooks for duration of function; fix GNU runtime messenger signatures to correspond to reality; forward-declare '__objc_exec_class' for the GNU runtime; call build_selector_table_decl(); in ObjC++ mode, generate 'extern "C" { ... }' wrappers around synthesized declarations; call build_protocol_template() and build_category_template(). (string_hash, string_eq): New functions. (objc_build_string_object): Check metaclass correctness only once; store string literals in hash table. (objc_build_constructor): Do not convert initializer elements; adjust for ObjC++ impedance mismatch. (build_objc_symtab_template): Call create_field_decl() instead of create_builtin_decl(). (init_objc_symtab): Add missing conversion to initializer element. (build_metadata_decl): Call start_var_decl() instead of define_decl(). (generate_objc_symtab_decl): Do not call build_category_template(); call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(). (build_module_descriptor): Call create_field_decl() instead of grokfield(); call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(); always mark module descriptor as used; move GNU runtime-specific functionality to build_module_initializer_routine(). (build_module_initializer_routine): New function, broken off of build_module_descriptor(). (objc_static_init_needed_p, objc_generate_static_init_call): New functions. (generate_static_references, generate_strings, build_selector_translation_table, generate_descriptor_table, generate_ivars_list, generate_dispatch_table, generate_category): Call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(); build a type directly instead of via groktypename(). (build_selector_reference_decl, build_selector_table_decl, build_class_reference_decl, build_protocol_reference, generate_objc_image_info): Call start_var_decl() instead of build_decl(). (build_selector_reference): For GNU runtime, do not call build_selector_reference_decl(). (build_selector, build_typed_selector_reference): Always convert result to the selector type. (add_objc_string): Cast return value to 'char *'. (build_method_prototype_template, build_selector_template, build_method_template): Use actual selector type for fields pointing to selectors. (finish_objc): For GNU runtime, call build_module_initializer_routine() after build_module_descriptor(). (generate_protocol_list, generate_shared_structures): Call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(); build a type directly instead of via groktypename(). (synth_id_with_class_suffix): Return a string. (get_arg_type_list): For instance methods, use the instance type for 'self'; do not call groktypename_in_parm_context(). (build_objc_string_decl): Squash redeclaration errors in ObjC++. (objc_is_class_name): Use OBJC_TYPE_NAME instead of TYPE_NAME; handle RECORD_TYPEs in ObjC as well as ObjC++. (objc_is_id): New function. (objc_is_object_ptr): Return the canonical type node. (objc_get_class_ivars): Simplify using get_class_ivars(). (get_class_ivars): Remove second parameter; create a fresh copy of the ivar list for each call; do not check for existence of super class. (objc_eh_runtime_type): Mark #ifndef OBJCPLUS. (objc_init_exceptions): When using SJLJ-style exceptions, require the use of '-fobjc-exceptions' flag; do not require it for DWARF-style exceptions. (objc_build_exc_ptr, next_sjlj_build_try_catch_finally): Use objc_object_type instead of objc_id_type. (objc_begin_catch_clause): Convert the incoming PARM_DECL into a VAR_DECL before placing it in the appropriate scope; do not call define_decl(); adjust call to c_begin_compound_stmt(); use objc_object_type instead of objc_id_type. (build_next_objc_exception_stuff): Call create_field_decl() instead of create_builtin_decl(); construct type directly instead of calling groktypename(); use OBJC_VOID_AT_END to mark end of function parameters. (build_private_template): Adjust call to get_class_ivars(); build a type directly instead of via groktypename(). (build_protocol_template, build_method_prototype_list_template, build_method_prototype_template, build_category_template, build_selector_template, build_class_template, build_super_template, build_ivar_template, build_ivar_list_template, build_method_list_template, build_method_template): Call create_field_decl() instead of grokfield(). (objc_method_parm_type): Do not call groktypename(). (generate_descriptor_table): Call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(). (generate_method_descriptors, build_protocol_initializer, generate_dispatch_tables, build_category_initializer, build_shared_structure_initializer): Do not call groktypename(). (generate_protocols): Call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(); do not call groktypename(). (error_with_ivar): Remove last parameter. (check_ivars): Do not iterate ovar CLASS_RAW_IVARS lists in addition to CLASS_IVARS lists; adjust calls to error_with_ivar(). (generate_ivar_lists): Convert one of the initializer elements; do not call groktypename(). (get_arg_type_list, start_method_def, gen_method_def): Account for new representation of variable arguments and '...' in Objective-C methods; add Objective-C++ impedance matching code. (is_objc_type_qualifier): Remove function. (adjust_type_for_id_default): Simplify; there is no longer a need to wade through declspecs. (lookup_interface, start_class, continue_class, finish_class, start_method_def, start_protocol, build_method_decl, objc_add_method, add_instance_variable, build_ivar_reference, is_ivar, is_private, get_super_receiver, objc_build_finally_epilogue): Make into static functions. (receiver_is_class_object): Use new IS_CLASS() macro. (objc_build_message_expr): Tweak ObjC++ message argument handling; call objc_finish_message_expr() instead of finish_message_expr(). (finish_message_expr): Rename to objc_finish_message_expr(); use OBJC_TYPE_NAME and OBJC_SET_TYPE_NAME macros instead of TYPE_NAME. call gen_type_name() instead of gen_declaration(); call objc_is_id() instead of using IS_ID and IS_CLASS; Use objc_class_name instead of calling get_identifier("Class"); handle CONVERT_EXPRs in receiver. (build_objc_method_call, warn_with_method): Do not call groktypename(). (build_ivar_reference): Call convert() instead of clobbering in a type. (hash_init): Initialize string_htab hash table. (add_instance_variable): Simplify parameter list; do not call grokfield(); do not populate CLASS_IVARS list. (start_class): Check for the existence of super class, if one was specified. (continue_class): Use CLASS_RAW_IVARS rather than CLASS_IVARS; do not call build_class_template(); adjust call to get_class_ivars(); call build_decl(), pushdecl() and finish_decl() instead of define_decl(). (finish_class): Call build_decl(), pushdecl() and finish_decl() instead of define_decl(). (add_protocols): Use PROTOCOL_BINFO_ELTS for the tree vector size. (start_protocol): Do not call build_protocol_template(); use PROTOCOL_BINFO_ELTS for the tree vector size. (encode_type_qualifiers): Do not handle the 'const' qualifier here. (encode_pointer): Encode 'const char *' as 'r*', for backwards compatibility. (encode_array): Use HOST_WIDE_INT_PRINT_DEC instead of "%ld". (encode_type): Handle the 'const' qualifier here. (objc_parmlist): New global variable, sued by objc_push_parm and objc_get_parm_info(). (objc_push_parm, objc_get_parm_info): New functions. (objc_expr_last): Remove function. (synth_self_and_ucmd_args): For instance methods, use the instance type for 'self'; call objc_push_parm() instead of push_parm_decl(). (start_method_def): Do not call push_scope(), declare_parm_level(), pop_scope(), push_parm_decl(), store_parm_decls() or objc_expr_last(); just use objc_push_parm() and objc_get_parm_info(). (comp_method_with_proto): Remove function. (objc_types_are_equivalent): Strip away indirections before comparing underlying types. (comp_proto_with_proto): Do not call groktypename(); types are no longer in raw declspec format. (objc_start_function): New function. (really_start_method): Call comp_proto_with_proto() instead of comp_method_with_proto(); call objc_start_function() instead of hand-crafting a function declarator. (continue_method_def, objc_expand_function_end): Remove functions. (get_super_receiver): Call objc_get_current_scope() instead of get_current_scope(); reference 'super_class' field (instead of 'class'). (finish_method_def): Rename to objc_finish_method_definition() and add a function decl parameter; move method encoding call from objc_expand_function_end(). (is_complex_decl, adorn_decl, gen_declarator, gen_declspecs, gen_declaration_1): Remove functions. (tmpbuf, RAW_DECLSPEC): Remove. (gen_declaration): Remove second parameter; simplify to deal with TYPE_P nodes instead of raw declspecs. (gen_type_name, gen_type_name_0): New functions. (gen_method_decl): Remove second parameter; call gen_type_name() instead of gen_declaration_1(). (dump_interface): Adjust calls to gen_declaration() and gen_method_decl(); do not allocate a separate string buffer. (init_objc): Allocate a larger string buffer to accommodate dump_interface(); adjust call to build_module_descriptor(); add call to build_module_initializer_routine() for the GNU runtime. (generate_classref_translation_entry): Do not call start_decl(); call finish_var_decl() instead of finish_decl(); call convert() instead of build_c_cast(). * objc-act.h (CLASS_OWN_IVARS): Remove accessor. (CLASS_BINFO_ELTS): Reduce from 6 to 5, now that CLASS_OWN_IVARS is gone. (OCTI_GNU_INIT_DECL, GNU_INIT_decl): New. (OCTI_ELLIPSIS_NODE, objc_ellipsis_node): Remove. (OCTI_ID_ID, id_type, objc_id_id): Rename to OCTI_ID_NAME, objc_object_type and objc_object_name, respectively. (OCTI_CLS_REF, OCTI_CLASS_NAME, objc_class_reference, objc_class_name): New. (IS_CLASS): New macro. (IS_ID, IS_SUPER): Robustify. (OCTI_EXECCLASS_DECL, execclass_decl): New. (finish_file, start_class, continue_class, finish_class, start_method_def, continue_method_def, finish_method_def, start_protocol, finish_protocol, objc_build_throw_stmt, objc_build_try_catch_finally_stmt, objc_build_synchronized_prologue, objc_build_synchronized_epilogue, objc_build_try_prologue, objc_build_try_epilogue, objc_build_catch_stmt, objc_build_catch_epilogue, objc_build_finally_prologue, objc_build_finally_epilogue, is_ivar, is_private, is_public, add_instance_variable, objc_add_method, get_super_receiver, objc_clear_super_receiver, get_class_ivars_from_name, get_class_reference, get_static_reference, get_object_reference, build_message_expr, finish_message_expr, build_selector_expr, build_ivar_reference, build_keyword_decl, build_method_decl, build_protocol_expr, build_objc_string_object, objc_declare_alias, objc_declare_class, objc_declare_protocols, objc_comptypes, objc_check_decl, build_encode_expr): Remove prototypes. (imp_count, cat_count): Make GGC-aware. (OBJC_SET_TYPE_NAME): New macro. From-SVN: r87168
2004-09-08 02:49:44 +02:00
refs_expr = convert (build_pointer_type (build_pointer_type
(objc_protocol_template)),
build_unary_op (ADDR_EXPR, refs_decl, 0));
else
tree.h (build_int_cst): New, sign extended constant. * tree.h (build_int_cst): New, sign extended constant. (build_int_cstu): New, zero extended constant. (build_int_cst_wide): Renamed from build_int_cst. * tree.c (build_int_cst, build_int_cstu): New. (build_int_cst_wide): Renamed from build_int_cst. (make_vector_type, build_common_tree_nodes, build_common_tree_nodes_2): Adjust build_int_cst calls. * builtins.c (expand_builtin_prefetch, expand_builtin_strstr, expand_builtin_strpbrk, expand_builtin_fputs, build_string_literal, expand_builtin_printf, expand_builtin_sprintf, fold_builtin_classify_type, fold_builtin_lround, fold_builtin_bitop, fold_builtin_isascii, fold_builtin_toascii, fold_builtin_isdigit, simplify_builtin_strstr, simplify_builtin_strpbrk, fold_builtin_fputs, simplify_builtin_sprintf): Likewise. * c-common.c (start_fname_decls, fix_string_type, shorten_compare, DEF_ATTR_INT): Likewise. * c-decl.c (complete_array_type, check_bitfield_type_and_width): Likewise. * c-lex.c (interpret_integer, lex_charconst): Likewise. * c-parse.in (primary) <TYPES_COMPATIBLE_P> Likewise. * c-pretty-print.c (pp_c_integer_constant): Likewise. * c-typeck.c (really_start_incremental_init, push_init_level, set_nonincremental_init_from_string): Likewise. * calls.c (load_register_parameters): Likewise. convert.c (convert_to_pointer): Likewise. coverage.c (coverage_counter_alloc, tree_coverage_counter_ref, build_fn_info_type, build_fn_info_value, build_ctr_info_value, build_gcov_info): Likewise. * except.c (init_eh, assign_filter_values): Likewise. * expmed.c (store_fixed_bit_field, extract_bit_field, extract_fixed_bit_field, extract_split_bit_field, expand_shift, expand_mult_const, expand_mult_highpart_adjust, extract_high_half, expand_sdiv_pow2, expand_divmod, make_tree): Likewise. * expr.c (convert_move, emit_group_load, emit_group_store, expand_assignment, store_constructor, store_field, expand_expr_real_1, reduce_to_bit_field_precision): Likewise. fold-const.c (force_fit_type, int_const_binop, fold_convert_const, invert_truthvalue, optimize_bit_field_compare, decode_field_reference, all_ones_mask_p, constant_boolean_node, fold_div_compare, fold, fold_read_from_constant_string, fold_negate_const, fold_abs_const, fold_not_const, round_up, round_down): Likewise. * function.c (assign_parm_setup_block): Likewise. * stmt.c (shift_return_value, expand_case, estimate_case_costs): Likewise. * stor-layout.c (layout_type, initialize_sizetypes, set_min_and_max_values_for_integral_type): Likewise. * tree-chrec.c (chrec_fold_multiply_poly_poly, reset_evolution_in_loop): Likewise. * tree-chrec.h (build_polynomial_chrec): Likewise. * tree-complex.c (build_replicated_const): Likewise. * tree-eh.c (honor_protect_cleanup_actions, lower_try_finally_onedest, lower_try_finally_copy, lower_try_finally_switch): Likewise. * tree-mudflap.c (mf_build_string, mx_register_decls, mudflap_register_call, mudflap_enqueue_constant): Likewise. * tree-nested.c (get_trampoline_type, get_nl_goto_field): Likewise. * tree-pretty-print.c (dump_generic_node): Likewise. * tree-ssa-ccp.c (widen_bitfield, maybe_fold_offset_to_array_ref): Likewise. * tree-ssa-dom.c (simplify_rhs_and_lookup_avail_expr): Likewise. * tree-ssa-loop-niter.c (number_of_iterations_cond, loop_niter_by_eval, upper_bound_in_type, lower_bound_in_type): Likewise. * tree-ssa-loop-ivcanon.c (create_canonical_iv, canonicalize_loop_induction_variables): Likewise. * tree-vectorizer.c (vect_create_index_for_array_ref, vect_transform_loop_bound, vect_compute_data_ref_alignment): Likewise. * config/alpha/alpha.c (alpha_initialize_trampoline, alpha_va_start, alpha_gimplify_va_arg_1): Likewise. * config/arm/arm.c (arm_get_cookie_size): Likewise. * config/c4x/c4x.c (c4x_gimplify_va_arg_expr): Likewise. * config/i386/i386.c (ix86_va_start, ix86_gimplify_va_arg): Likewise. * config/ia64/ia64.c (ia64_gimplify_va_arg): Likewise. * config/mips/mips.c (mips_build_builtin_va_list, mips_va_start, mips_gimplify_va_arg_expr): Likewise. * config/pa/pa.c (hppa_gimplify_va_arg_expr): Likewise. * config/rs6000/rs6000.c (rs6000_va_start, rs6000_gimplify_va_arg, add_compiler_branch_island): Likewise. * config/s390/s390.c (s390_va_start): Likewise. * config/sh/sh.c (sh_va_start): Likewise. * config/stormy16/stormy16.c (xstormy16_expand_builtin_va_start): Likewise. * config/xtensa/xtensa.c (xtensa_va_start, xtensa_gimplify_va_arg_expr): Likewise. * objc/objc-act.c (build_objc_string_object, build_objc_symtab_template, init_def_list, init_objc_symtab, init_module_descriptor, generate_static_references, build_selector_translation_table, get_proto_encoding, build_typed_selector_reference, build_selector_reference, build_next_objc_exception_stuff, build_method_prototype_list_template, generate_descriptor_table, generate_protocols, build_protocol_initializer, build_ivar_list_template, build_method_list_template, build_ivar_list_initializer, generate_ivars_list, generate_dispatch_table, generate_protocol_list, build_category_initializer, build_shared_structure_initializer, generate_shared_structures, handle_impent, generate_objc_image_info): Likewise. 2004-04-25 Paolo Bonzini <bonzini@gnu.org> * cfglayout.c (duplicate_insn_chain): Remove references to NOTE_INSN_LOOP_VTOP and NOTE_INSN_LOOP_CONT. * cfgloop.h (struct loop): Remove fields vtop, cont and cont_dominator. * cfgrtl.c (rtl_delete_block): Remove handling of NOTE_INSN_LOOP_CONT. * final.c (final_scan_insn): Remove references to NOTE_INSN_LOOP_VTOP and NOTE_INSN_LOOP_CONT. * insn-notes.def (NOTE_INSN_LOOP_VTOP, NOTE_INSN_LOOP_CONT): Remove. * jump.c (squeeze_notes): Remove references to NOTE_INSN_LOOP_VTOP and NOTE_INSN_LOOP_CONT. * loop.c (scan_loops, find_and_verify_loops, for_each_insn_in_loop, check_dbra_loop, loop_dump_aux): Remove references to removed notes and fields. * reorg.c (mostly_true_jump): Do not rely on NOTE_INSN_LOOP_VTOPs. * unroll.c (unroll_loop, copy_loop_body, loop_iterations): Remove references to removed notes and fields. (subtract_reg_term, ujump_to_loop_cont): Remove. From-SVN: r86544
2004-08-25 11:52:54 +02:00
refs_expr = build_int_cst (NULL_TREE, 0);
/* UOBJC_INSTANCE_METHODS_decl/UOBJC_CLASS_METHODS_decl are set
by generate_method_descriptors, which is called above. */
initlist = build_protocol_initializer (TREE_TYPE (decl),
protocol_name_expr, refs_expr,
UOBJC_INSTANCE_METHODS_decl,
UOBJC_CLASS_METHODS_decl);
Makefile.in (c-parse.o): Depend on $(C_COMMON_H). [gcc/ChangeLog] 2004-09-07 Ziemowit Laski <zlaski@apple.com> * Makefile.in (c-parse.o): Depend on $(C_COMMON_H). * c-parse.in: Include c-common.h instead of objc-act.h. (ivar_decl_list, ivar_decls, ivar_decl, ivars, ivar_declarator, myparms, myparm): Remove %type declarations. (methodtype, optparms, OBJC_TYPE_QUAL, objc_quals, objc_qual, objc_typename, objc_try_catch_stmt, optellipsis): Add %type declarations. (objc_inherit_code, objc_public_flag): Remove. (typespec_nonreserved_nonattr): Call objc_get_protocol_qualified_type() instead of get_static_reference() and get_protocol_reference(). (stmt_nocomp): Call grokparm() on @catch parameter. (objcdef): Move semantic action to objc_finish_implementation(). (classdef): Move semantic action to objc_start_class_interface(), objc_continue_interface(), objc_finish_interface(), objc_start_class_implementation(), objc_continue_implementation(), objc_start_category_interface() and objc_start_category_implementation(). (protocoldef): Move semantic actions to objc_start_protocol() and objc_finish_interface(). (ivar_decl_list): Remove nonterminal. (visibility_spec): Move semantic actions to objc_set_visibility(). (ivar_decls): Remove assignment to $$. (ivar_decl): Rephrase in terms of component_decl; call objc_add_instance_variable(). (ivars, ivar_declarator): Remove nonterminals. (opt_semi): New nonterminal. (methodtype): Remove semantic actions. (methoddef): Move semantic actions to objc_set_method_type(), objc_start_method_definition() and objc_finish_method_definition(). (methodproto): Move semantic actions to objc_set_method_type() and objc_add_method_declaration(). (methoddecl): Use objc_typename instead of typename; move semantic actions to objc_build_method_signature(). (optarglist, myxdecls, mydecl, myparms, myparm): Remove nonterminals. (optparmlist): Express in terms of optparms and optellipsis. (optparms, optellipsis, objc_qual, objc_quals, objc_typename): New nonterminals. (keyworddecl): Use objc_typename instead of typename. (rid_to_yy): Mark RID_IN, RID_OUT, RID_INOUT, RID_BYCOPY, RID_BYREF and RID_ONEWAY as returning OBJC_TYPE_QUAL to yyparse(). [gcc/objc/ChangeLog] 2004-09-07 Ziemowit Laski <zlaski@apple.com> * Make-lang.in (objc/objc-parse.o): Depend on $(C_COMMON_H) instead of objc/objc-act.h. (objc/objc-act.o): Depend on $(HASHTAB_H). * objc-act.c: Include hashtab.h; in ObjC++ mode, include cp-tree.h and objcp-decl.h instead of c-tree.h. (build_module_descriptor, get_class_ivars, synth_id_with_class_suffix, error_with_ivar, gen_method_decl, gen_declaration, setup_string_decl, build_protocol_template): Adjust prototypes. (build_module_initializer_routine, start_class, continue_class, finish_class, start_method_def, objc_start_function, start_protocol, build_method_decl, objc_add_method, add_instance_variable, build_ivar_reference, is_ivar, is_private, get_super_receiver, build_selector_table_decl, objc_push_parm, objc_get_parm_info, gen_type_name, gen_type_name_0, start_var_decl, finish_var_decl, create_field_decl): New prototypes. (objc_expand_function_end, comp_method_with_proto, objc_expr_last, gen_declaration_1, gen_declarator, is_complex_decl, adorn_decl, define_decl, create_builtin_decl, gen_declspecs): Remove prototypes. (TYPE_ID): Rename to OBJECT_TYPEDEF_NAME. (CLASS_TYPEDEF_NAME): New. (TAG_EXECCLASS): Change from a global variable to a #define. (TAG_RETURN_STRUCT): Delete. (TAG_GNUINIT): New, holds '__objc_gnu_init' name. (objc_inherit_code, objc_public_flag): New, moved from c-parse.in. (string_descriptor): New struct. (string_htab): New hash table. (string_hash, string_eq): New prototypes. (generate_struct_by_value_array): Call create_field_decl() instead of create_builtin_decl(). (objc_init): Do not initialize objc_ellipsis_node or TAG_EXECCLASS; In ObjC++ mode, call cxx_init() instead of c_objc_common_init(). (objc_finish_file): In ObjC++, call instantiate_pending_templates() and cp_finish_file(). (define_decl, get_static_reference, get_protocol_reference, create_builtin_decl): Remove functions. (objc_start_class_interface, objc_start_category_interface, objc_start_protocol, objc_continue_interface, objc_finish_interface, objc_start_class_implementation, objc_start_category_implementation, objc_continue_implementation, objc_finish_implementation, objc_set_visibility, objc_set_method_type, objc_build_method_signature, objc_add_method_declaration, objc_start_method_definition, objc_add_instance_variable, objc_get_protocol_qualified_type, create_field_decl, start_var_decl, finish_var_decl): New functions. (setup_string_decl): Simplify since it is only called once. (synth_module_prologue): Call build_class_template(); predefine 'id' and 'Class' as typedefs; rename 'temp_type' to 'type'; disable debug hooks for duration of function; fix GNU runtime messenger signatures to correspond to reality; forward-declare '__objc_exec_class' for the GNU runtime; call build_selector_table_decl(); in ObjC++ mode, generate 'extern "C" { ... }' wrappers around synthesized declarations; call build_protocol_template() and build_category_template(). (string_hash, string_eq): New functions. (objc_build_string_object): Check metaclass correctness only once; store string literals in hash table. (objc_build_constructor): Do not convert initializer elements; adjust for ObjC++ impedance mismatch. (build_objc_symtab_template): Call create_field_decl() instead of create_builtin_decl(). (init_objc_symtab): Add missing conversion to initializer element. (build_metadata_decl): Call start_var_decl() instead of define_decl(). (generate_objc_symtab_decl): Do not call build_category_template(); call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(). (build_module_descriptor): Call create_field_decl() instead of grokfield(); call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(); always mark module descriptor as used; move GNU runtime-specific functionality to build_module_initializer_routine(). (build_module_initializer_routine): New function, broken off of build_module_descriptor(). (objc_static_init_needed_p, objc_generate_static_init_call): New functions. (generate_static_references, generate_strings, build_selector_translation_table, generate_descriptor_table, generate_ivars_list, generate_dispatch_table, generate_category): Call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(); build a type directly instead of via groktypename(). (build_selector_reference_decl, build_selector_table_decl, build_class_reference_decl, build_protocol_reference, generate_objc_image_info): Call start_var_decl() instead of build_decl(). (build_selector_reference): For GNU runtime, do not call build_selector_reference_decl(). (build_selector, build_typed_selector_reference): Always convert result to the selector type. (add_objc_string): Cast return value to 'char *'. (build_method_prototype_template, build_selector_template, build_method_template): Use actual selector type for fields pointing to selectors. (finish_objc): For GNU runtime, call build_module_initializer_routine() after build_module_descriptor(). (generate_protocol_list, generate_shared_structures): Call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(); build a type directly instead of via groktypename(). (synth_id_with_class_suffix): Return a string. (get_arg_type_list): For instance methods, use the instance type for 'self'; do not call groktypename_in_parm_context(). (build_objc_string_decl): Squash redeclaration errors in ObjC++. (objc_is_class_name): Use OBJC_TYPE_NAME instead of TYPE_NAME; handle RECORD_TYPEs in ObjC as well as ObjC++. (objc_is_id): New function. (objc_is_object_ptr): Return the canonical type node. (objc_get_class_ivars): Simplify using get_class_ivars(). (get_class_ivars): Remove second parameter; create a fresh copy of the ivar list for each call; do not check for existence of super class. (objc_eh_runtime_type): Mark #ifndef OBJCPLUS. (objc_init_exceptions): When using SJLJ-style exceptions, require the use of '-fobjc-exceptions' flag; do not require it for DWARF-style exceptions. (objc_build_exc_ptr, next_sjlj_build_try_catch_finally): Use objc_object_type instead of objc_id_type. (objc_begin_catch_clause): Convert the incoming PARM_DECL into a VAR_DECL before placing it in the appropriate scope; do not call define_decl(); adjust call to c_begin_compound_stmt(); use objc_object_type instead of objc_id_type. (build_next_objc_exception_stuff): Call create_field_decl() instead of create_builtin_decl(); construct type directly instead of calling groktypename(); use OBJC_VOID_AT_END to mark end of function parameters. (build_private_template): Adjust call to get_class_ivars(); build a type directly instead of via groktypename(). (build_protocol_template, build_method_prototype_list_template, build_method_prototype_template, build_category_template, build_selector_template, build_class_template, build_super_template, build_ivar_template, build_ivar_list_template, build_method_list_template, build_method_template): Call create_field_decl() instead of grokfield(). (objc_method_parm_type): Do not call groktypename(). (generate_descriptor_table): Call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(). (generate_method_descriptors, build_protocol_initializer, generate_dispatch_tables, build_category_initializer, build_shared_structure_initializer): Do not call groktypename(). (generate_protocols): Call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(); do not call groktypename(). (error_with_ivar): Remove last parameter. (check_ivars): Do not iterate ovar CLASS_RAW_IVARS lists in addition to CLASS_IVARS lists; adjust calls to error_with_ivar(). (generate_ivar_lists): Convert one of the initializer elements; do not call groktypename(). (get_arg_type_list, start_method_def, gen_method_def): Account for new representation of variable arguments and '...' in Objective-C methods; add Objective-C++ impedance matching code. (is_objc_type_qualifier): Remove function. (adjust_type_for_id_default): Simplify; there is no longer a need to wade through declspecs. (lookup_interface, start_class, continue_class, finish_class, start_method_def, start_protocol, build_method_decl, objc_add_method, add_instance_variable, build_ivar_reference, is_ivar, is_private, get_super_receiver, objc_build_finally_epilogue): Make into static functions. (receiver_is_class_object): Use new IS_CLASS() macro. (objc_build_message_expr): Tweak ObjC++ message argument handling; call objc_finish_message_expr() instead of finish_message_expr(). (finish_message_expr): Rename to objc_finish_message_expr(); use OBJC_TYPE_NAME and OBJC_SET_TYPE_NAME macros instead of TYPE_NAME. call gen_type_name() instead of gen_declaration(); call objc_is_id() instead of using IS_ID and IS_CLASS; Use objc_class_name instead of calling get_identifier("Class"); handle CONVERT_EXPRs in receiver. (build_objc_method_call, warn_with_method): Do not call groktypename(). (build_ivar_reference): Call convert() instead of clobbering in a type. (hash_init): Initialize string_htab hash table. (add_instance_variable): Simplify parameter list; do not call grokfield(); do not populate CLASS_IVARS list. (start_class): Check for the existence of super class, if one was specified. (continue_class): Use CLASS_RAW_IVARS rather than CLASS_IVARS; do not call build_class_template(); adjust call to get_class_ivars(); call build_decl(), pushdecl() and finish_decl() instead of define_decl(). (finish_class): Call build_decl(), pushdecl() and finish_decl() instead of define_decl(). (add_protocols): Use PROTOCOL_BINFO_ELTS for the tree vector size. (start_protocol): Do not call build_protocol_template(); use PROTOCOL_BINFO_ELTS for the tree vector size. (encode_type_qualifiers): Do not handle the 'const' qualifier here. (encode_pointer): Encode 'const char *' as 'r*', for backwards compatibility. (encode_array): Use HOST_WIDE_INT_PRINT_DEC instead of "%ld". (encode_type): Handle the 'const' qualifier here. (objc_parmlist): New global variable, sued by objc_push_parm and objc_get_parm_info(). (objc_push_parm, objc_get_parm_info): New functions. (objc_expr_last): Remove function. (synth_self_and_ucmd_args): For instance methods, use the instance type for 'self'; call objc_push_parm() instead of push_parm_decl(). (start_method_def): Do not call push_scope(), declare_parm_level(), pop_scope(), push_parm_decl(), store_parm_decls() or objc_expr_last(); just use objc_push_parm() and objc_get_parm_info(). (comp_method_with_proto): Remove function. (objc_types_are_equivalent): Strip away indirections before comparing underlying types. (comp_proto_with_proto): Do not call groktypename(); types are no longer in raw declspec format. (objc_start_function): New function. (really_start_method): Call comp_proto_with_proto() instead of comp_method_with_proto(); call objc_start_function() instead of hand-crafting a function declarator. (continue_method_def, objc_expand_function_end): Remove functions. (get_super_receiver): Call objc_get_current_scope() instead of get_current_scope(); reference 'super_class' field (instead of 'class'). (finish_method_def): Rename to objc_finish_method_definition() and add a function decl parameter; move method encoding call from objc_expand_function_end(). (is_complex_decl, adorn_decl, gen_declarator, gen_declspecs, gen_declaration_1): Remove functions. (tmpbuf, RAW_DECLSPEC): Remove. (gen_declaration): Remove second parameter; simplify to deal with TYPE_P nodes instead of raw declspecs. (gen_type_name, gen_type_name_0): New functions. (gen_method_decl): Remove second parameter; call gen_type_name() instead of gen_declaration_1(). (dump_interface): Adjust calls to gen_declaration() and gen_method_decl(); do not allocate a separate string buffer. (init_objc): Allocate a larger string buffer to accommodate dump_interface(); adjust call to build_module_descriptor(); add call to build_module_initializer_routine() for the GNU runtime. (generate_classref_translation_entry): Do not call start_decl(); call finish_var_decl() instead of finish_decl(); call convert() instead of build_c_cast(). * objc-act.h (CLASS_OWN_IVARS): Remove accessor. (CLASS_BINFO_ELTS): Reduce from 6 to 5, now that CLASS_OWN_IVARS is gone. (OCTI_GNU_INIT_DECL, GNU_INIT_decl): New. (OCTI_ELLIPSIS_NODE, objc_ellipsis_node): Remove. (OCTI_ID_ID, id_type, objc_id_id): Rename to OCTI_ID_NAME, objc_object_type and objc_object_name, respectively. (OCTI_CLS_REF, OCTI_CLASS_NAME, objc_class_reference, objc_class_name): New. (IS_CLASS): New macro. (IS_ID, IS_SUPER): Robustify. (OCTI_EXECCLASS_DECL, execclass_decl): New. (finish_file, start_class, continue_class, finish_class, start_method_def, continue_method_def, finish_method_def, start_protocol, finish_protocol, objc_build_throw_stmt, objc_build_try_catch_finally_stmt, objc_build_synchronized_prologue, objc_build_synchronized_epilogue, objc_build_try_prologue, objc_build_try_epilogue, objc_build_catch_stmt, objc_build_catch_epilogue, objc_build_finally_prologue, objc_build_finally_epilogue, is_ivar, is_private, is_public, add_instance_variable, objc_add_method, get_super_receiver, objc_clear_super_receiver, get_class_ivars_from_name, get_class_reference, get_static_reference, get_object_reference, build_message_expr, finish_message_expr, build_selector_expr, build_ivar_reference, build_keyword_decl, build_method_decl, build_protocol_expr, build_objc_string_object, objc_declare_alias, objc_declare_class, objc_declare_protocols, objc_comptypes, objc_check_decl, build_encode_expr): Remove prototypes. (imp_count, cat_count): Make GGC-aware. (OBJC_SET_TYPE_NAME): New macro. From-SVN: r87168
2004-09-08 02:49:44 +02:00
finish_var_decl (decl, initlist);
1992-01-18 00:15:38 +01:00
}
}
static tree
build_protocol_initializer (tree type, tree protocol_name,
tree protocol_list, tree instance_methods,
tree class_methods)
1992-01-18 00:15:38 +01:00
{
tree initlist = NULL_TREE, expr;
Makefile.in (c-parse.o): Depend on $(C_COMMON_H). [gcc/ChangeLog] 2004-09-07 Ziemowit Laski <zlaski@apple.com> * Makefile.in (c-parse.o): Depend on $(C_COMMON_H). * c-parse.in: Include c-common.h instead of objc-act.h. (ivar_decl_list, ivar_decls, ivar_decl, ivars, ivar_declarator, myparms, myparm): Remove %type declarations. (methodtype, optparms, OBJC_TYPE_QUAL, objc_quals, objc_qual, objc_typename, objc_try_catch_stmt, optellipsis): Add %type declarations. (objc_inherit_code, objc_public_flag): Remove. (typespec_nonreserved_nonattr): Call objc_get_protocol_qualified_type() instead of get_static_reference() and get_protocol_reference(). (stmt_nocomp): Call grokparm() on @catch parameter. (objcdef): Move semantic action to objc_finish_implementation(). (classdef): Move semantic action to objc_start_class_interface(), objc_continue_interface(), objc_finish_interface(), objc_start_class_implementation(), objc_continue_implementation(), objc_start_category_interface() and objc_start_category_implementation(). (protocoldef): Move semantic actions to objc_start_protocol() and objc_finish_interface(). (ivar_decl_list): Remove nonterminal. (visibility_spec): Move semantic actions to objc_set_visibility(). (ivar_decls): Remove assignment to $$. (ivar_decl): Rephrase in terms of component_decl; call objc_add_instance_variable(). (ivars, ivar_declarator): Remove nonterminals. (opt_semi): New nonterminal. (methodtype): Remove semantic actions. (methoddef): Move semantic actions to objc_set_method_type(), objc_start_method_definition() and objc_finish_method_definition(). (methodproto): Move semantic actions to objc_set_method_type() and objc_add_method_declaration(). (methoddecl): Use objc_typename instead of typename; move semantic actions to objc_build_method_signature(). (optarglist, myxdecls, mydecl, myparms, myparm): Remove nonterminals. (optparmlist): Express in terms of optparms and optellipsis. (optparms, optellipsis, objc_qual, objc_quals, objc_typename): New nonterminals. (keyworddecl): Use objc_typename instead of typename. (rid_to_yy): Mark RID_IN, RID_OUT, RID_INOUT, RID_BYCOPY, RID_BYREF and RID_ONEWAY as returning OBJC_TYPE_QUAL to yyparse(). [gcc/objc/ChangeLog] 2004-09-07 Ziemowit Laski <zlaski@apple.com> * Make-lang.in (objc/objc-parse.o): Depend on $(C_COMMON_H) instead of objc/objc-act.h. (objc/objc-act.o): Depend on $(HASHTAB_H). * objc-act.c: Include hashtab.h; in ObjC++ mode, include cp-tree.h and objcp-decl.h instead of c-tree.h. (build_module_descriptor, get_class_ivars, synth_id_with_class_suffix, error_with_ivar, gen_method_decl, gen_declaration, setup_string_decl, build_protocol_template): Adjust prototypes. (build_module_initializer_routine, start_class, continue_class, finish_class, start_method_def, objc_start_function, start_protocol, build_method_decl, objc_add_method, add_instance_variable, build_ivar_reference, is_ivar, is_private, get_super_receiver, build_selector_table_decl, objc_push_parm, objc_get_parm_info, gen_type_name, gen_type_name_0, start_var_decl, finish_var_decl, create_field_decl): New prototypes. (objc_expand_function_end, comp_method_with_proto, objc_expr_last, gen_declaration_1, gen_declarator, is_complex_decl, adorn_decl, define_decl, create_builtin_decl, gen_declspecs): Remove prototypes. (TYPE_ID): Rename to OBJECT_TYPEDEF_NAME. (CLASS_TYPEDEF_NAME): New. (TAG_EXECCLASS): Change from a global variable to a #define. (TAG_RETURN_STRUCT): Delete. (TAG_GNUINIT): New, holds '__objc_gnu_init' name. (objc_inherit_code, objc_public_flag): New, moved from c-parse.in. (string_descriptor): New struct. (string_htab): New hash table. (string_hash, string_eq): New prototypes. (generate_struct_by_value_array): Call create_field_decl() instead of create_builtin_decl(). (objc_init): Do not initialize objc_ellipsis_node or TAG_EXECCLASS; In ObjC++ mode, call cxx_init() instead of c_objc_common_init(). (objc_finish_file): In ObjC++, call instantiate_pending_templates() and cp_finish_file(). (define_decl, get_static_reference, get_protocol_reference, create_builtin_decl): Remove functions. (objc_start_class_interface, objc_start_category_interface, objc_start_protocol, objc_continue_interface, objc_finish_interface, objc_start_class_implementation, objc_start_category_implementation, objc_continue_implementation, objc_finish_implementation, objc_set_visibility, objc_set_method_type, objc_build_method_signature, objc_add_method_declaration, objc_start_method_definition, objc_add_instance_variable, objc_get_protocol_qualified_type, create_field_decl, start_var_decl, finish_var_decl): New functions. (setup_string_decl): Simplify since it is only called once. (synth_module_prologue): Call build_class_template(); predefine 'id' and 'Class' as typedefs; rename 'temp_type' to 'type'; disable debug hooks for duration of function; fix GNU runtime messenger signatures to correspond to reality; forward-declare '__objc_exec_class' for the GNU runtime; call build_selector_table_decl(); in ObjC++ mode, generate 'extern "C" { ... }' wrappers around synthesized declarations; call build_protocol_template() and build_category_template(). (string_hash, string_eq): New functions. (objc_build_string_object): Check metaclass correctness only once; store string literals in hash table. (objc_build_constructor): Do not convert initializer elements; adjust for ObjC++ impedance mismatch. (build_objc_symtab_template): Call create_field_decl() instead of create_builtin_decl(). (init_objc_symtab): Add missing conversion to initializer element. (build_metadata_decl): Call start_var_decl() instead of define_decl(). (generate_objc_symtab_decl): Do not call build_category_template(); call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(). (build_module_descriptor): Call create_field_decl() instead of grokfield(); call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(); always mark module descriptor as used; move GNU runtime-specific functionality to build_module_initializer_routine(). (build_module_initializer_routine): New function, broken off of build_module_descriptor(). (objc_static_init_needed_p, objc_generate_static_init_call): New functions. (generate_static_references, generate_strings, build_selector_translation_table, generate_descriptor_table, generate_ivars_list, generate_dispatch_table, generate_category): Call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(); build a type directly instead of via groktypename(). (build_selector_reference_decl, build_selector_table_decl, build_class_reference_decl, build_protocol_reference, generate_objc_image_info): Call start_var_decl() instead of build_decl(). (build_selector_reference): For GNU runtime, do not call build_selector_reference_decl(). (build_selector, build_typed_selector_reference): Always convert result to the selector type. (add_objc_string): Cast return value to 'char *'. (build_method_prototype_template, build_selector_template, build_method_template): Use actual selector type for fields pointing to selectors. (finish_objc): For GNU runtime, call build_module_initializer_routine() after build_module_descriptor(). (generate_protocol_list, generate_shared_structures): Call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(); build a type directly instead of via groktypename(). (synth_id_with_class_suffix): Return a string. (get_arg_type_list): For instance methods, use the instance type for 'self'; do not call groktypename_in_parm_context(). (build_objc_string_decl): Squash redeclaration errors in ObjC++. (objc_is_class_name): Use OBJC_TYPE_NAME instead of TYPE_NAME; handle RECORD_TYPEs in ObjC as well as ObjC++. (objc_is_id): New function. (objc_is_object_ptr): Return the canonical type node. (objc_get_class_ivars): Simplify using get_class_ivars(). (get_class_ivars): Remove second parameter; create a fresh copy of the ivar list for each call; do not check for existence of super class. (objc_eh_runtime_type): Mark #ifndef OBJCPLUS. (objc_init_exceptions): When using SJLJ-style exceptions, require the use of '-fobjc-exceptions' flag; do not require it for DWARF-style exceptions. (objc_build_exc_ptr, next_sjlj_build_try_catch_finally): Use objc_object_type instead of objc_id_type. (objc_begin_catch_clause): Convert the incoming PARM_DECL into a VAR_DECL before placing it in the appropriate scope; do not call define_decl(); adjust call to c_begin_compound_stmt(); use objc_object_type instead of objc_id_type. (build_next_objc_exception_stuff): Call create_field_decl() instead of create_builtin_decl(); construct type directly instead of calling groktypename(); use OBJC_VOID_AT_END to mark end of function parameters. (build_private_template): Adjust call to get_class_ivars(); build a type directly instead of via groktypename(). (build_protocol_template, build_method_prototype_list_template, build_method_prototype_template, build_category_template, build_selector_template, build_class_template, build_super_template, build_ivar_template, build_ivar_list_template, build_method_list_template, build_method_template): Call create_field_decl() instead of grokfield(). (objc_method_parm_type): Do not call groktypename(). (generate_descriptor_table): Call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(). (generate_method_descriptors, build_protocol_initializer, generate_dispatch_tables, build_category_initializer, build_shared_structure_initializer): Do not call groktypename(). (generate_protocols): Call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(); do not call groktypename(). (error_with_ivar): Remove last parameter. (check_ivars): Do not iterate ovar CLASS_RAW_IVARS lists in addition to CLASS_IVARS lists; adjust calls to error_with_ivar(). (generate_ivar_lists): Convert one of the initializer elements; do not call groktypename(). (get_arg_type_list, start_method_def, gen_method_def): Account for new representation of variable arguments and '...' in Objective-C methods; add Objective-C++ impedance matching code. (is_objc_type_qualifier): Remove function. (adjust_type_for_id_default): Simplify; there is no longer a need to wade through declspecs. (lookup_interface, start_class, continue_class, finish_class, start_method_def, start_protocol, build_method_decl, objc_add_method, add_instance_variable, build_ivar_reference, is_ivar, is_private, get_super_receiver, objc_build_finally_epilogue): Make into static functions. (receiver_is_class_object): Use new IS_CLASS() macro. (objc_build_message_expr): Tweak ObjC++ message argument handling; call objc_finish_message_expr() instead of finish_message_expr(). (finish_message_expr): Rename to objc_finish_message_expr(); use OBJC_TYPE_NAME and OBJC_SET_TYPE_NAME macros instead of TYPE_NAME. call gen_type_name() instead of gen_declaration(); call objc_is_id() instead of using IS_ID and IS_CLASS; Use objc_class_name instead of calling get_identifier("Class"); handle CONVERT_EXPRs in receiver. (build_objc_method_call, warn_with_method): Do not call groktypename(). (build_ivar_reference): Call convert() instead of clobbering in a type. (hash_init): Initialize string_htab hash table. (add_instance_variable): Simplify parameter list; do not call grokfield(); do not populate CLASS_IVARS list. (start_class): Check for the existence of super class, if one was specified. (continue_class): Use CLASS_RAW_IVARS rather than CLASS_IVARS; do not call build_class_template(); adjust call to get_class_ivars(); call build_decl(), pushdecl() and finish_decl() instead of define_decl(). (finish_class): Call build_decl(), pushdecl() and finish_decl() instead of define_decl(). (add_protocols): Use PROTOCOL_BINFO_ELTS for the tree vector size. (start_protocol): Do not call build_protocol_template(); use PROTOCOL_BINFO_ELTS for the tree vector size. (encode_type_qualifiers): Do not handle the 'const' qualifier here. (encode_pointer): Encode 'const char *' as 'r*', for backwards compatibility. (encode_array): Use HOST_WIDE_INT_PRINT_DEC instead of "%ld". (encode_type): Handle the 'const' qualifier here. (objc_parmlist): New global variable, sued by objc_push_parm and objc_get_parm_info(). (objc_push_parm, objc_get_parm_info): New functions. (objc_expr_last): Remove function. (synth_self_and_ucmd_args): For instance methods, use the instance type for 'self'; call objc_push_parm() instead of push_parm_decl(). (start_method_def): Do not call push_scope(), declare_parm_level(), pop_scope(), push_parm_decl(), store_parm_decls() or objc_expr_last(); just use objc_push_parm() and objc_get_parm_info(). (comp_method_with_proto): Remove function. (objc_types_are_equivalent): Strip away indirections before comparing underlying types. (comp_proto_with_proto): Do not call groktypename(); types are no longer in raw declspec format. (objc_start_function): New function. (really_start_method): Call comp_proto_with_proto() instead of comp_method_with_proto(); call objc_start_function() instead of hand-crafting a function declarator. (continue_method_def, objc_expand_function_end): Remove functions. (get_super_receiver): Call objc_get_current_scope() instead of get_current_scope(); reference 'super_class' field (instead of 'class'). (finish_method_def): Rename to objc_finish_method_definition() and add a function decl parameter; move method encoding call from objc_expand_function_end(). (is_complex_decl, adorn_decl, gen_declarator, gen_declspecs, gen_declaration_1): Remove functions. (tmpbuf, RAW_DECLSPEC): Remove. (gen_declaration): Remove second parameter; simplify to deal with TYPE_P nodes instead of raw declspecs. (gen_type_name, gen_type_name_0): New functions. (gen_method_decl): Remove second parameter; call gen_type_name() instead of gen_declaration_1(). (dump_interface): Adjust calls to gen_declaration() and gen_method_decl(); do not allocate a separate string buffer. (init_objc): Allocate a larger string buffer to accommodate dump_interface(); adjust call to build_module_descriptor(); add call to build_module_initializer_routine() for the GNU runtime. (generate_classref_translation_entry): Do not call start_decl(); call finish_var_decl() instead of finish_decl(); call convert() instead of build_c_cast(). * objc-act.h (CLASS_OWN_IVARS): Remove accessor. (CLASS_BINFO_ELTS): Reduce from 6 to 5, now that CLASS_OWN_IVARS is gone. (OCTI_GNU_INIT_DECL, GNU_INIT_decl): New. (OCTI_ELLIPSIS_NODE, objc_ellipsis_node): Remove. (OCTI_ID_ID, id_type, objc_id_id): Rename to OCTI_ID_NAME, objc_object_type and objc_object_name, respectively. (OCTI_CLS_REF, OCTI_CLASS_NAME, objc_class_reference, objc_class_name): New. (IS_CLASS): New macro. (IS_ID, IS_SUPER): Robustify. (OCTI_EXECCLASS_DECL, execclass_decl): New. (finish_file, start_class, continue_class, finish_class, start_method_def, continue_method_def, finish_method_def, start_protocol, finish_protocol, objc_build_throw_stmt, objc_build_try_catch_finally_stmt, objc_build_synchronized_prologue, objc_build_synchronized_epilogue, objc_build_try_prologue, objc_build_try_epilogue, objc_build_catch_stmt, objc_build_catch_epilogue, objc_build_finally_prologue, objc_build_finally_epilogue, is_ivar, is_private, is_public, add_instance_variable, objc_add_method, get_super_receiver, objc_clear_super_receiver, get_class_ivars_from_name, get_class_reference, get_static_reference, get_object_reference, build_message_expr, finish_message_expr, build_selector_expr, build_ivar_reference, build_keyword_decl, build_method_decl, build_protocol_expr, build_objc_string_object, objc_declare_alias, objc_declare_class, objc_declare_protocols, objc_comptypes, objc_check_decl, build_encode_expr): Remove prototypes. (imp_count, cat_count): Make GGC-aware. (OBJC_SET_TYPE_NAME): New macro. From-SVN: r87168
2004-09-08 02:49:44 +02:00
tree cast_type = build_pointer_type
(xref_tag (RECORD_TYPE,
get_identifier (UTAG_CLASS)));
/* Filling the "isa" in with one allows the runtime system to
detect that the version change...should remove before final release. */
tree.h (build_int_cst): New, sign extended constant. * tree.h (build_int_cst): New, sign extended constant. (build_int_cstu): New, zero extended constant. (build_int_cst_wide): Renamed from build_int_cst. * tree.c (build_int_cst, build_int_cstu): New. (build_int_cst_wide): Renamed from build_int_cst. (make_vector_type, build_common_tree_nodes, build_common_tree_nodes_2): Adjust build_int_cst calls. * builtins.c (expand_builtin_prefetch, expand_builtin_strstr, expand_builtin_strpbrk, expand_builtin_fputs, build_string_literal, expand_builtin_printf, expand_builtin_sprintf, fold_builtin_classify_type, fold_builtin_lround, fold_builtin_bitop, fold_builtin_isascii, fold_builtin_toascii, fold_builtin_isdigit, simplify_builtin_strstr, simplify_builtin_strpbrk, fold_builtin_fputs, simplify_builtin_sprintf): Likewise. * c-common.c (start_fname_decls, fix_string_type, shorten_compare, DEF_ATTR_INT): Likewise. * c-decl.c (complete_array_type, check_bitfield_type_and_width): Likewise. * c-lex.c (interpret_integer, lex_charconst): Likewise. * c-parse.in (primary) <TYPES_COMPATIBLE_P> Likewise. * c-pretty-print.c (pp_c_integer_constant): Likewise. * c-typeck.c (really_start_incremental_init, push_init_level, set_nonincremental_init_from_string): Likewise. * calls.c (load_register_parameters): Likewise. convert.c (convert_to_pointer): Likewise. coverage.c (coverage_counter_alloc, tree_coverage_counter_ref, build_fn_info_type, build_fn_info_value, build_ctr_info_value, build_gcov_info): Likewise. * except.c (init_eh, assign_filter_values): Likewise. * expmed.c (store_fixed_bit_field, extract_bit_field, extract_fixed_bit_field, extract_split_bit_field, expand_shift, expand_mult_const, expand_mult_highpart_adjust, extract_high_half, expand_sdiv_pow2, expand_divmod, make_tree): Likewise. * expr.c (convert_move, emit_group_load, emit_group_store, expand_assignment, store_constructor, store_field, expand_expr_real_1, reduce_to_bit_field_precision): Likewise. fold-const.c (force_fit_type, int_const_binop, fold_convert_const, invert_truthvalue, optimize_bit_field_compare, decode_field_reference, all_ones_mask_p, constant_boolean_node, fold_div_compare, fold, fold_read_from_constant_string, fold_negate_const, fold_abs_const, fold_not_const, round_up, round_down): Likewise. * function.c (assign_parm_setup_block): Likewise. * stmt.c (shift_return_value, expand_case, estimate_case_costs): Likewise. * stor-layout.c (layout_type, initialize_sizetypes, set_min_and_max_values_for_integral_type): Likewise. * tree-chrec.c (chrec_fold_multiply_poly_poly, reset_evolution_in_loop): Likewise. * tree-chrec.h (build_polynomial_chrec): Likewise. * tree-complex.c (build_replicated_const): Likewise. * tree-eh.c (honor_protect_cleanup_actions, lower_try_finally_onedest, lower_try_finally_copy, lower_try_finally_switch): Likewise. * tree-mudflap.c (mf_build_string, mx_register_decls, mudflap_register_call, mudflap_enqueue_constant): Likewise. * tree-nested.c (get_trampoline_type, get_nl_goto_field): Likewise. * tree-pretty-print.c (dump_generic_node): Likewise. * tree-ssa-ccp.c (widen_bitfield, maybe_fold_offset_to_array_ref): Likewise. * tree-ssa-dom.c (simplify_rhs_and_lookup_avail_expr): Likewise. * tree-ssa-loop-niter.c (number_of_iterations_cond, loop_niter_by_eval, upper_bound_in_type, lower_bound_in_type): Likewise. * tree-ssa-loop-ivcanon.c (create_canonical_iv, canonicalize_loop_induction_variables): Likewise. * tree-vectorizer.c (vect_create_index_for_array_ref, vect_transform_loop_bound, vect_compute_data_ref_alignment): Likewise. * config/alpha/alpha.c (alpha_initialize_trampoline, alpha_va_start, alpha_gimplify_va_arg_1): Likewise. * config/arm/arm.c (arm_get_cookie_size): Likewise. * config/c4x/c4x.c (c4x_gimplify_va_arg_expr): Likewise. * config/i386/i386.c (ix86_va_start, ix86_gimplify_va_arg): Likewise. * config/ia64/ia64.c (ia64_gimplify_va_arg): Likewise. * config/mips/mips.c (mips_build_builtin_va_list, mips_va_start, mips_gimplify_va_arg_expr): Likewise. * config/pa/pa.c (hppa_gimplify_va_arg_expr): Likewise. * config/rs6000/rs6000.c (rs6000_va_start, rs6000_gimplify_va_arg, add_compiler_branch_island): Likewise. * config/s390/s390.c (s390_va_start): Likewise. * config/sh/sh.c (sh_va_start): Likewise. * config/stormy16/stormy16.c (xstormy16_expand_builtin_va_start): Likewise. * config/xtensa/xtensa.c (xtensa_va_start, xtensa_gimplify_va_arg_expr): Likewise. * objc/objc-act.c (build_objc_string_object, build_objc_symtab_template, init_def_list, init_objc_symtab, init_module_descriptor, generate_static_references, build_selector_translation_table, get_proto_encoding, build_typed_selector_reference, build_selector_reference, build_next_objc_exception_stuff, build_method_prototype_list_template, generate_descriptor_table, generate_protocols, build_protocol_initializer, build_ivar_list_template, build_method_list_template, build_ivar_list_initializer, generate_ivars_list, generate_dispatch_table, generate_protocol_list, build_category_initializer, build_shared_structure_initializer, generate_shared_structures, handle_impent, generate_objc_image_info): Likewise. 2004-04-25 Paolo Bonzini <bonzini@gnu.org> * cfglayout.c (duplicate_insn_chain): Remove references to NOTE_INSN_LOOP_VTOP and NOTE_INSN_LOOP_CONT. * cfgloop.h (struct loop): Remove fields vtop, cont and cont_dominator. * cfgrtl.c (rtl_delete_block): Remove handling of NOTE_INSN_LOOP_CONT. * final.c (final_scan_insn): Remove references to NOTE_INSN_LOOP_VTOP and NOTE_INSN_LOOP_CONT. * insn-notes.def (NOTE_INSN_LOOP_VTOP, NOTE_INSN_LOOP_CONT): Remove. * jump.c (squeeze_notes): Remove references to NOTE_INSN_LOOP_VTOP and NOTE_INSN_LOOP_CONT. * loop.c (scan_loops, find_and_verify_loops, for_each_insn_in_loop, check_dbra_loop, loop_dump_aux): Remove references to removed notes and fields. * reorg.c (mostly_true_jump): Do not rely on NOTE_INSN_LOOP_VTOPs. * unroll.c (unroll_loop, copy_loop_body, loop_iterations): Remove references to removed notes and fields. (subtract_reg_term, ujump_to_loop_cont): Remove. From-SVN: r86544
2004-08-25 11:52:54 +02:00
expr = build_int_cst (cast_type, PROTOCOL_VERSION);
initlist = tree_cons (NULL_TREE, expr, initlist);
initlist = tree_cons (NULL_TREE, protocol_name, initlist);
initlist = tree_cons (NULL_TREE, protocol_list, initlist);
if (!instance_methods)
tree.h (build_int_cst): New, sign extended constant. * tree.h (build_int_cst): New, sign extended constant. (build_int_cstu): New, zero extended constant. (build_int_cst_wide): Renamed from build_int_cst. * tree.c (build_int_cst, build_int_cstu): New. (build_int_cst_wide): Renamed from build_int_cst. (make_vector_type, build_common_tree_nodes, build_common_tree_nodes_2): Adjust build_int_cst calls. * builtins.c (expand_builtin_prefetch, expand_builtin_strstr, expand_builtin_strpbrk, expand_builtin_fputs, build_string_literal, expand_builtin_printf, expand_builtin_sprintf, fold_builtin_classify_type, fold_builtin_lround, fold_builtin_bitop, fold_builtin_isascii, fold_builtin_toascii, fold_builtin_isdigit, simplify_builtin_strstr, simplify_builtin_strpbrk, fold_builtin_fputs, simplify_builtin_sprintf): Likewise. * c-common.c (start_fname_decls, fix_string_type, shorten_compare, DEF_ATTR_INT): Likewise. * c-decl.c (complete_array_type, check_bitfield_type_and_width): Likewise. * c-lex.c (interpret_integer, lex_charconst): Likewise. * c-parse.in (primary) <TYPES_COMPATIBLE_P> Likewise. * c-pretty-print.c (pp_c_integer_constant): Likewise. * c-typeck.c (really_start_incremental_init, push_init_level, set_nonincremental_init_from_string): Likewise. * calls.c (load_register_parameters): Likewise. convert.c (convert_to_pointer): Likewise. coverage.c (coverage_counter_alloc, tree_coverage_counter_ref, build_fn_info_type, build_fn_info_value, build_ctr_info_value, build_gcov_info): Likewise. * except.c (init_eh, assign_filter_values): Likewise. * expmed.c (store_fixed_bit_field, extract_bit_field, extract_fixed_bit_field, extract_split_bit_field, expand_shift, expand_mult_const, expand_mult_highpart_adjust, extract_high_half, expand_sdiv_pow2, expand_divmod, make_tree): Likewise. * expr.c (convert_move, emit_group_load, emit_group_store, expand_assignment, store_constructor, store_field, expand_expr_real_1, reduce_to_bit_field_precision): Likewise. fold-const.c (force_fit_type, int_const_binop, fold_convert_const, invert_truthvalue, optimize_bit_field_compare, decode_field_reference, all_ones_mask_p, constant_boolean_node, fold_div_compare, fold, fold_read_from_constant_string, fold_negate_const, fold_abs_const, fold_not_const, round_up, round_down): Likewise. * function.c (assign_parm_setup_block): Likewise. * stmt.c (shift_return_value, expand_case, estimate_case_costs): Likewise. * stor-layout.c (layout_type, initialize_sizetypes, set_min_and_max_values_for_integral_type): Likewise. * tree-chrec.c (chrec_fold_multiply_poly_poly, reset_evolution_in_loop): Likewise. * tree-chrec.h (build_polynomial_chrec): Likewise. * tree-complex.c (build_replicated_const): Likewise. * tree-eh.c (honor_protect_cleanup_actions, lower_try_finally_onedest, lower_try_finally_copy, lower_try_finally_switch): Likewise. * tree-mudflap.c (mf_build_string, mx_register_decls, mudflap_register_call, mudflap_enqueue_constant): Likewise. * tree-nested.c (get_trampoline_type, get_nl_goto_field): Likewise. * tree-pretty-print.c (dump_generic_node): Likewise. * tree-ssa-ccp.c (widen_bitfield, maybe_fold_offset_to_array_ref): Likewise. * tree-ssa-dom.c (simplify_rhs_and_lookup_avail_expr): Likewise. * tree-ssa-loop-niter.c (number_of_iterations_cond, loop_niter_by_eval, upper_bound_in_type, lower_bound_in_type): Likewise. * tree-ssa-loop-ivcanon.c (create_canonical_iv, canonicalize_loop_induction_variables): Likewise. * tree-vectorizer.c (vect_create_index_for_array_ref, vect_transform_loop_bound, vect_compute_data_ref_alignment): Likewise. * config/alpha/alpha.c (alpha_initialize_trampoline, alpha_va_start, alpha_gimplify_va_arg_1): Likewise. * config/arm/arm.c (arm_get_cookie_size): Likewise. * config/c4x/c4x.c (c4x_gimplify_va_arg_expr): Likewise. * config/i386/i386.c (ix86_va_start, ix86_gimplify_va_arg): Likewise. * config/ia64/ia64.c (ia64_gimplify_va_arg): Likewise. * config/mips/mips.c (mips_build_builtin_va_list, mips_va_start, mips_gimplify_va_arg_expr): Likewise. * config/pa/pa.c (hppa_gimplify_va_arg_expr): Likewise. * config/rs6000/rs6000.c (rs6000_va_start, rs6000_gimplify_va_arg, add_compiler_branch_island): Likewise. * config/s390/s390.c (s390_va_start): Likewise. * config/sh/sh.c (sh_va_start): Likewise. * config/stormy16/stormy16.c (xstormy16_expand_builtin_va_start): Likewise. * config/xtensa/xtensa.c (xtensa_va_start, xtensa_gimplify_va_arg_expr): Likewise. * objc/objc-act.c (build_objc_string_object, build_objc_symtab_template, init_def_list, init_objc_symtab, init_module_descriptor, generate_static_references, build_selector_translation_table, get_proto_encoding, build_typed_selector_reference, build_selector_reference, build_next_objc_exception_stuff, build_method_prototype_list_template, generate_descriptor_table, generate_protocols, build_protocol_initializer, build_ivar_list_template, build_method_list_template, build_ivar_list_initializer, generate_ivars_list, generate_dispatch_table, generate_protocol_list, build_category_initializer, build_shared_structure_initializer, generate_shared_structures, handle_impent, generate_objc_image_info): Likewise. 2004-04-25 Paolo Bonzini <bonzini@gnu.org> * cfglayout.c (duplicate_insn_chain): Remove references to NOTE_INSN_LOOP_VTOP and NOTE_INSN_LOOP_CONT. * cfgloop.h (struct loop): Remove fields vtop, cont and cont_dominator. * cfgrtl.c (rtl_delete_block): Remove handling of NOTE_INSN_LOOP_CONT. * final.c (final_scan_insn): Remove references to NOTE_INSN_LOOP_VTOP and NOTE_INSN_LOOP_CONT. * insn-notes.def (NOTE_INSN_LOOP_VTOP, NOTE_INSN_LOOP_CONT): Remove. * jump.c (squeeze_notes): Remove references to NOTE_INSN_LOOP_VTOP and NOTE_INSN_LOOP_CONT. * loop.c (scan_loops, find_and_verify_loops, for_each_insn_in_loop, check_dbra_loop, loop_dump_aux): Remove references to removed notes and fields. * reorg.c (mostly_true_jump): Do not rely on NOTE_INSN_LOOP_VTOPs. * unroll.c (unroll_loop, copy_loop_body, loop_iterations): Remove references to removed notes and fields. (subtract_reg_term, ujump_to_loop_cont): Remove. From-SVN: r86544
2004-08-25 11:52:54 +02:00
initlist = tree_cons (NULL_TREE, build_int_cst (NULL_TREE, 0), initlist);
else
1992-01-18 00:15:38 +01:00
{
Yet more Objective-C++... * objc-act.c (objc_finish_try_stmt): Add return value. (objc_build_synchronized): Likewise. * objc-act.c (objc_is_gcable_type): Add. (objc_substitute_decl): Add. (objc_build_ivar_assignment): Add. (objc_build_global_assignment): Add. (objc_build_strong_cast_assignment): Add. (objc_is_ivar_reference_p): Add. (objc_is_global_reference_p): Add. (objc_generate_write_barrier): Add. (objc_rewrite_function_call): Add. (objc_gimplify_expr): Add Objective-C++ support. * objc-act.h (ALLOC_OBJC_TYPE_LANG_SPECIFIC): Likewise. (SIZEOF_OBJC_TYPE_LANG_SPECIFIC): Add. (INIT_TYPE_OBJC_INFO): Add Objective-C++ support. (DUP_TYPE_OBJC_INFO): Likewise. (struct imp_entry): Add field has_cxx_cdtors. (struct imp_entry *imp_list): Add OCTI_UMSG_FAST_DECL, OCTI_METH_LIST_TEMPL, OCTI_METH_PROTO_LIST_TEMPL, OCTI_IVAR_LIST_TEMPL, OCTI_ASSIGN_IVAR_DECL, OCTI_ASSIGN_IVAR_FAST_DECL, OCTI_ASSIGN_GLOBAL_DECL, OCTI_ASSIGN_STRONGCAST_DECL. (umsg_fast_decl): Add. (objc_assign_ivar_decl): Add. (objc_assign_ivar_fast_decl): Add. (objc_assign_global_decl): Add. (objc_assign_strong_cast_decl): Add. (objc_method_list_ptr): Add. (objc_method_proto_list_ptr): Add. (objc_ivar_list_ptr): Add. * objc-act.c (should_call_super_dealloc): Add. (OBJC_VERSION): Bump to 6. (objc_is_gcable_type): Add. (objc_substitute_decl): Add. (objc_build_ivar_assignment): Add. (objc_build_global_assignment): Add. (objc_build_strong_cast_assignment): Add. (objc_is_gcable_p): Add. (objc_is_ivar_reference_p): Add. (objc_is_global_reference_p): Add. (generate_shared_structures): Add flags parameter. (objc_generate_cxx_ctor_or_dtor): Add. (objc_generate_cxx_cdtors): Add. (add_class): Add name parameter. (objc_types_share_size_and_alignment): Add. (comp_proto_with_proto): Add strict parameter. (CLS_HAS_CXX_STRUCTORS): Add. (TAG_ASSIGNIVAR): Add. (TAG_ASSIGNGLOBAL): Add. (TAG_ASSIGNSTRONGCAST): Add. (TAG_MSGSEND_FAST): Add. (TAG_ASSIGNIVAR_FAST): Add. (TAG_CXX_CONSTRUCT): Add. (TAG_CXX_DESTRUCT): Add. (OBJC_LOOKUP_CLASS): Add. (OBJC_LOOKUP_NO_SUPER): Add. (objc_finish_file): Add pch support. (objc_finish_implementation): Add Objective-C++ support. (synth_module_prologue): Likewise. (synth_module_prologue): Add fast dispatching. (objc_get_class_reference): Add Objective-C++ support. (objc_generate_write_barrier): Likewise. (next_sjlj_build_enter_and_setjmp): Likewise. (objc_begin_try_stmt): Likewise. (build_next_objc_exception_stuff): Add fast ivar support. (build_private_template): Mark the record as used so debug information is generated. (build_protocol_template): Add Objective-C++ support. (objc_method_parm_type) Likewise. (objc_generate_cxx_ctor_or_dtor): Likewise. (objc_generate_cxx_cdtors): Likewise. (build_protocol_initializer): Likewise. (build_category_template): Likewise. (build_class_template): Likewise. (build_method_list_template): Likewise. (build_category_initializer): Likewise. (build_shared_structure_initializer): Likewise. (objc_finish_message_expr): Likewise. (build_objc_method_call): Add fast dispatch support. (lookup_method_static): Add support to end search at superclasses. (add_method_to_hash_list): Add strict parameter to comp_proto_with_proto. (objc_add_method): Likewise. (objc_add_method): Also set the interface_value. (add_instance_variable): Add Objective-C++ support. (objc_is_public): Likewise. (start_class): Likewise. (continue_class): Likewise. (encode_aggregate_within): Likewise. (start_method_def): Likewise. (objc_start_function): Clear current_function_returns_value and current_function_returns_null. (really_start_method): Add Objective-C++ support. (objc_finish_method_definition): Add warning for missing [super dealloc]. (finish_objc): Add Objective-C++ support. (generate_objc_image_info): Likewise. (objc_lookup_ivar): Likewise. * objc-act.h (TYPE_HAS_OBJC_INFO): Likewise. (INIT_TYPE_OBJC_INFO): Likewise. (DUP_TYPE_OBJC_INFO): Likewise. From-SVN: r99857
2005-05-17 22:07:08 +02:00
expr = convert (objc_method_proto_list_ptr,
build_unary_op (ADDR_EXPR, instance_methods, 0));
initlist = tree_cons (NULL_TREE, expr, initlist);
1992-01-18 00:15:38 +01:00
}
if (!class_methods)
tree.h (build_int_cst): New, sign extended constant. * tree.h (build_int_cst): New, sign extended constant. (build_int_cstu): New, zero extended constant. (build_int_cst_wide): Renamed from build_int_cst. * tree.c (build_int_cst, build_int_cstu): New. (build_int_cst_wide): Renamed from build_int_cst. (make_vector_type, build_common_tree_nodes, build_common_tree_nodes_2): Adjust build_int_cst calls. * builtins.c (expand_builtin_prefetch, expand_builtin_strstr, expand_builtin_strpbrk, expand_builtin_fputs, build_string_literal, expand_builtin_printf, expand_builtin_sprintf, fold_builtin_classify_type, fold_builtin_lround, fold_builtin_bitop, fold_builtin_isascii, fold_builtin_toascii, fold_builtin_isdigit, simplify_builtin_strstr, simplify_builtin_strpbrk, fold_builtin_fputs, simplify_builtin_sprintf): Likewise. * c-common.c (start_fname_decls, fix_string_type, shorten_compare, DEF_ATTR_INT): Likewise. * c-decl.c (complete_array_type, check_bitfield_type_and_width): Likewise. * c-lex.c (interpret_integer, lex_charconst): Likewise. * c-parse.in (primary) <TYPES_COMPATIBLE_P> Likewise. * c-pretty-print.c (pp_c_integer_constant): Likewise. * c-typeck.c (really_start_incremental_init, push_init_level, set_nonincremental_init_from_string): Likewise. * calls.c (load_register_parameters): Likewise. convert.c (convert_to_pointer): Likewise. coverage.c (coverage_counter_alloc, tree_coverage_counter_ref, build_fn_info_type, build_fn_info_value, build_ctr_info_value, build_gcov_info): Likewise. * except.c (init_eh, assign_filter_values): Likewise. * expmed.c (store_fixed_bit_field, extract_bit_field, extract_fixed_bit_field, extract_split_bit_field, expand_shift, expand_mult_const, expand_mult_highpart_adjust, extract_high_half, expand_sdiv_pow2, expand_divmod, make_tree): Likewise. * expr.c (convert_move, emit_group_load, emit_group_store, expand_assignment, store_constructor, store_field, expand_expr_real_1, reduce_to_bit_field_precision): Likewise. fold-const.c (force_fit_type, int_const_binop, fold_convert_const, invert_truthvalue, optimize_bit_field_compare, decode_field_reference, all_ones_mask_p, constant_boolean_node, fold_div_compare, fold, fold_read_from_constant_string, fold_negate_const, fold_abs_const, fold_not_const, round_up, round_down): Likewise. * function.c (assign_parm_setup_block): Likewise. * stmt.c (shift_return_value, expand_case, estimate_case_costs): Likewise. * stor-layout.c (layout_type, initialize_sizetypes, set_min_and_max_values_for_integral_type): Likewise. * tree-chrec.c (chrec_fold_multiply_poly_poly, reset_evolution_in_loop): Likewise. * tree-chrec.h (build_polynomial_chrec): Likewise. * tree-complex.c (build_replicated_const): Likewise. * tree-eh.c (honor_protect_cleanup_actions, lower_try_finally_onedest, lower_try_finally_copy, lower_try_finally_switch): Likewise. * tree-mudflap.c (mf_build_string, mx_register_decls, mudflap_register_call, mudflap_enqueue_constant): Likewise. * tree-nested.c (get_trampoline_type, get_nl_goto_field): Likewise. * tree-pretty-print.c (dump_generic_node): Likewise. * tree-ssa-ccp.c (widen_bitfield, maybe_fold_offset_to_array_ref): Likewise. * tree-ssa-dom.c (simplify_rhs_and_lookup_avail_expr): Likewise. * tree-ssa-loop-niter.c (number_of_iterations_cond, loop_niter_by_eval, upper_bound_in_type, lower_bound_in_type): Likewise. * tree-ssa-loop-ivcanon.c (create_canonical_iv, canonicalize_loop_induction_variables): Likewise. * tree-vectorizer.c (vect_create_index_for_array_ref, vect_transform_loop_bound, vect_compute_data_ref_alignment): Likewise. * config/alpha/alpha.c (alpha_initialize_trampoline, alpha_va_start, alpha_gimplify_va_arg_1): Likewise. * config/arm/arm.c (arm_get_cookie_size): Likewise. * config/c4x/c4x.c (c4x_gimplify_va_arg_expr): Likewise. * config/i386/i386.c (ix86_va_start, ix86_gimplify_va_arg): Likewise. * config/ia64/ia64.c (ia64_gimplify_va_arg): Likewise. * config/mips/mips.c (mips_build_builtin_va_list, mips_va_start, mips_gimplify_va_arg_expr): Likewise. * config/pa/pa.c (hppa_gimplify_va_arg_expr): Likewise. * config/rs6000/rs6000.c (rs6000_va_start, rs6000_gimplify_va_arg, add_compiler_branch_island): Likewise. * config/s390/s390.c (s390_va_start): Likewise. * config/sh/sh.c (sh_va_start): Likewise. * config/stormy16/stormy16.c (xstormy16_expand_builtin_va_start): Likewise. * config/xtensa/xtensa.c (xtensa_va_start, xtensa_gimplify_va_arg_expr): Likewise. * objc/objc-act.c (build_objc_string_object, build_objc_symtab_template, init_def_list, init_objc_symtab, init_module_descriptor, generate_static_references, build_selector_translation_table, get_proto_encoding, build_typed_selector_reference, build_selector_reference, build_next_objc_exception_stuff, build_method_prototype_list_template, generate_descriptor_table, generate_protocols, build_protocol_initializer, build_ivar_list_template, build_method_list_template, build_ivar_list_initializer, generate_ivars_list, generate_dispatch_table, generate_protocol_list, build_category_initializer, build_shared_structure_initializer, generate_shared_structures, handle_impent, generate_objc_image_info): Likewise. 2004-04-25 Paolo Bonzini <bonzini@gnu.org> * cfglayout.c (duplicate_insn_chain): Remove references to NOTE_INSN_LOOP_VTOP and NOTE_INSN_LOOP_CONT. * cfgloop.h (struct loop): Remove fields vtop, cont and cont_dominator. * cfgrtl.c (rtl_delete_block): Remove handling of NOTE_INSN_LOOP_CONT. * final.c (final_scan_insn): Remove references to NOTE_INSN_LOOP_VTOP and NOTE_INSN_LOOP_CONT. * insn-notes.def (NOTE_INSN_LOOP_VTOP, NOTE_INSN_LOOP_CONT): Remove. * jump.c (squeeze_notes): Remove references to NOTE_INSN_LOOP_VTOP and NOTE_INSN_LOOP_CONT. * loop.c (scan_loops, find_and_verify_loops, for_each_insn_in_loop, check_dbra_loop, loop_dump_aux): Remove references to removed notes and fields. * reorg.c (mostly_true_jump): Do not rely on NOTE_INSN_LOOP_VTOPs. * unroll.c (unroll_loop, copy_loop_body, loop_iterations): Remove references to removed notes and fields. (subtract_reg_term, ujump_to_loop_cont): Remove. From-SVN: r86544
2004-08-25 11:52:54 +02:00
initlist = tree_cons (NULL_TREE, build_int_cst (NULL_TREE, 0), initlist);
1992-01-18 00:15:38 +01:00
else
{
Yet more Objective-C++... * objc-act.c (objc_finish_try_stmt): Add return value. (objc_build_synchronized): Likewise. * objc-act.c (objc_is_gcable_type): Add. (objc_substitute_decl): Add. (objc_build_ivar_assignment): Add. (objc_build_global_assignment): Add. (objc_build_strong_cast_assignment): Add. (objc_is_ivar_reference_p): Add. (objc_is_global_reference_p): Add. (objc_generate_write_barrier): Add. (objc_rewrite_function_call): Add. (objc_gimplify_expr): Add Objective-C++ support. * objc-act.h (ALLOC_OBJC_TYPE_LANG_SPECIFIC): Likewise. (SIZEOF_OBJC_TYPE_LANG_SPECIFIC): Add. (INIT_TYPE_OBJC_INFO): Add Objective-C++ support. (DUP_TYPE_OBJC_INFO): Likewise. (struct imp_entry): Add field has_cxx_cdtors. (struct imp_entry *imp_list): Add OCTI_UMSG_FAST_DECL, OCTI_METH_LIST_TEMPL, OCTI_METH_PROTO_LIST_TEMPL, OCTI_IVAR_LIST_TEMPL, OCTI_ASSIGN_IVAR_DECL, OCTI_ASSIGN_IVAR_FAST_DECL, OCTI_ASSIGN_GLOBAL_DECL, OCTI_ASSIGN_STRONGCAST_DECL. (umsg_fast_decl): Add. (objc_assign_ivar_decl): Add. (objc_assign_ivar_fast_decl): Add. (objc_assign_global_decl): Add. (objc_assign_strong_cast_decl): Add. (objc_method_list_ptr): Add. (objc_method_proto_list_ptr): Add. (objc_ivar_list_ptr): Add. * objc-act.c (should_call_super_dealloc): Add. (OBJC_VERSION): Bump to 6. (objc_is_gcable_type): Add. (objc_substitute_decl): Add. (objc_build_ivar_assignment): Add. (objc_build_global_assignment): Add. (objc_build_strong_cast_assignment): Add. (objc_is_gcable_p): Add. (objc_is_ivar_reference_p): Add. (objc_is_global_reference_p): Add. (generate_shared_structures): Add flags parameter. (objc_generate_cxx_ctor_or_dtor): Add. (objc_generate_cxx_cdtors): Add. (add_class): Add name parameter. (objc_types_share_size_and_alignment): Add. (comp_proto_with_proto): Add strict parameter. (CLS_HAS_CXX_STRUCTORS): Add. (TAG_ASSIGNIVAR): Add. (TAG_ASSIGNGLOBAL): Add. (TAG_ASSIGNSTRONGCAST): Add. (TAG_MSGSEND_FAST): Add. (TAG_ASSIGNIVAR_FAST): Add. (TAG_CXX_CONSTRUCT): Add. (TAG_CXX_DESTRUCT): Add. (OBJC_LOOKUP_CLASS): Add. (OBJC_LOOKUP_NO_SUPER): Add. (objc_finish_file): Add pch support. (objc_finish_implementation): Add Objective-C++ support. (synth_module_prologue): Likewise. (synth_module_prologue): Add fast dispatching. (objc_get_class_reference): Add Objective-C++ support. (objc_generate_write_barrier): Likewise. (next_sjlj_build_enter_and_setjmp): Likewise. (objc_begin_try_stmt): Likewise. (build_next_objc_exception_stuff): Add fast ivar support. (build_private_template): Mark the record as used so debug information is generated. (build_protocol_template): Add Objective-C++ support. (objc_method_parm_type) Likewise. (objc_generate_cxx_ctor_or_dtor): Likewise. (objc_generate_cxx_cdtors): Likewise. (build_protocol_initializer): Likewise. (build_category_template): Likewise. (build_class_template): Likewise. (build_method_list_template): Likewise. (build_category_initializer): Likewise. (build_shared_structure_initializer): Likewise. (objc_finish_message_expr): Likewise. (build_objc_method_call): Add fast dispatch support. (lookup_method_static): Add support to end search at superclasses. (add_method_to_hash_list): Add strict parameter to comp_proto_with_proto. (objc_add_method): Likewise. (objc_add_method): Also set the interface_value. (add_instance_variable): Add Objective-C++ support. (objc_is_public): Likewise. (start_class): Likewise. (continue_class): Likewise. (encode_aggregate_within): Likewise. (start_method_def): Likewise. (objc_start_function): Clear current_function_returns_value and current_function_returns_null. (really_start_method): Add Objective-C++ support. (objc_finish_method_definition): Add warning for missing [super dealloc]. (finish_objc): Add Objective-C++ support. (generate_objc_image_info): Likewise. (objc_lookup_ivar): Likewise. * objc-act.h (TYPE_HAS_OBJC_INFO): Likewise. (INIT_TYPE_OBJC_INFO): Likewise. (DUP_TYPE_OBJC_INFO): Likewise. From-SVN: r99857
2005-05-17 22:07:08 +02:00
expr = convert (objc_method_proto_list_ptr,
build_unary_op (ADDR_EXPR, class_methods, 0));
initlist = tree_cons (NULL_TREE, expr, initlist);
1992-01-18 00:15:38 +01:00
}
tree.c (build_constructor): New function. * tree.c (build_constructor): New function. * tree.h: Prototype it. * c-typeck.c (build_c_cast, pop_init_level) * profile.c (build_function_info_value, build_gcov_info_value) (create_profiler): Use build_constructor. * builtins.c (expand_builtin_args_info): Remove #if 0 blocks. * objc/objc-act.c (build_constructor): Rename objc_build_constructor. Use build_constructor. (build_objc_string_object, objc_add_static_instance) (init_def_list, init_objc_symtab, init_module_descriptor) (generate_static_references, build_selector_translation_table) (build_descriptor_table_initializer, generate_descriptor_table) (build_protocol_initializer, build_ivar_list_initializer) (generate_ivars_list, build_dispatch_table_initializer) (generate_dispatch_table, generate_protocol_list) (build_category_initializer, build_shared_structure_initializer): Update to match. ada: * gigi.h, utils2.c (build_constructor): Rename gnat_build_constructor. Use build_constructor. * decl.c (gnat_to_gnu_entity) * trans.c (tree_transform, pos_to_constructor, extract_values) * ada/utils.c (build_template, convert_to_fat_pointer, convert) (unchecked_convert) * ada/utils2.c (build_binary_op, build_call_raise, build_allocator) (fill_vms_descriptor): Update to match. cp: * class.c (initialize_array) * decl.c (reshape_init) * decl2.c (build_expr_from_tree) * init.c (build_zero_init) * pt.c (tsubst_copy, tsubst_copy_and_build) * rtti.c (tinfo_base_init, generic_initializer, ptr_initializer) (ptm_initializer, class_initializer, get_pseudo_ti_init) * semantics.c (finish_compound_literal) * typeck.c (build_ptrmemfunc1) * typeck2.c (store_init_value, process_init_constructor) (build_functional_cast): Use build_constructor. f: * com.c (ffecom_build_complex_constant_, ffecom_expr_) (ffecom_init_zero_, ffecom_transform_namelist_, ffecom_vardesc_) (ffecom_vardesc_array_, ffecom_vardesc_dims_, ffecom_2) * ste.c (ffeste_io_ialist_, ffeste_io_cilist_, ffeste_io_cllist_) (ffeste_io_icilist_, ffeste_io_inlist_, ffeste_io_olist_): Use build_constructor. java: * class.c (make_field_value, make_method_value, get_dispatch_table) (make_class_data, emit_offset_symbol_table) * constants.c (build_constants_constructor) * java-tree.h (START_RECORD_CONSTRUCTOR) * parse.y (maybe_build_array_element_wfl): Use build_constructor. From-SVN: r65539
2003-04-13 03:45:35 +02:00
return objc_build_constructor (type, nreverse (initlist));
1992-01-18 00:15:38 +01:00
}
Makefile.in (c-parse.o): Depend on $(C_COMMON_H). [gcc/ChangeLog] 2004-09-07 Ziemowit Laski <zlaski@apple.com> * Makefile.in (c-parse.o): Depend on $(C_COMMON_H). * c-parse.in: Include c-common.h instead of objc-act.h. (ivar_decl_list, ivar_decls, ivar_decl, ivars, ivar_declarator, myparms, myparm): Remove %type declarations. (methodtype, optparms, OBJC_TYPE_QUAL, objc_quals, objc_qual, objc_typename, objc_try_catch_stmt, optellipsis): Add %type declarations. (objc_inherit_code, objc_public_flag): Remove. (typespec_nonreserved_nonattr): Call objc_get_protocol_qualified_type() instead of get_static_reference() and get_protocol_reference(). (stmt_nocomp): Call grokparm() on @catch parameter. (objcdef): Move semantic action to objc_finish_implementation(). (classdef): Move semantic action to objc_start_class_interface(), objc_continue_interface(), objc_finish_interface(), objc_start_class_implementation(), objc_continue_implementation(), objc_start_category_interface() and objc_start_category_implementation(). (protocoldef): Move semantic actions to objc_start_protocol() and objc_finish_interface(). (ivar_decl_list): Remove nonterminal. (visibility_spec): Move semantic actions to objc_set_visibility(). (ivar_decls): Remove assignment to $$. (ivar_decl): Rephrase in terms of component_decl; call objc_add_instance_variable(). (ivars, ivar_declarator): Remove nonterminals. (opt_semi): New nonterminal. (methodtype): Remove semantic actions. (methoddef): Move semantic actions to objc_set_method_type(), objc_start_method_definition() and objc_finish_method_definition(). (methodproto): Move semantic actions to objc_set_method_type() and objc_add_method_declaration(). (methoddecl): Use objc_typename instead of typename; move semantic actions to objc_build_method_signature(). (optarglist, myxdecls, mydecl, myparms, myparm): Remove nonterminals. (optparmlist): Express in terms of optparms and optellipsis. (optparms, optellipsis, objc_qual, objc_quals, objc_typename): New nonterminals. (keyworddecl): Use objc_typename instead of typename. (rid_to_yy): Mark RID_IN, RID_OUT, RID_INOUT, RID_BYCOPY, RID_BYREF and RID_ONEWAY as returning OBJC_TYPE_QUAL to yyparse(). [gcc/objc/ChangeLog] 2004-09-07 Ziemowit Laski <zlaski@apple.com> * Make-lang.in (objc/objc-parse.o): Depend on $(C_COMMON_H) instead of objc/objc-act.h. (objc/objc-act.o): Depend on $(HASHTAB_H). * objc-act.c: Include hashtab.h; in ObjC++ mode, include cp-tree.h and objcp-decl.h instead of c-tree.h. (build_module_descriptor, get_class_ivars, synth_id_with_class_suffix, error_with_ivar, gen_method_decl, gen_declaration, setup_string_decl, build_protocol_template): Adjust prototypes. (build_module_initializer_routine, start_class, continue_class, finish_class, start_method_def, objc_start_function, start_protocol, build_method_decl, objc_add_method, add_instance_variable, build_ivar_reference, is_ivar, is_private, get_super_receiver, build_selector_table_decl, objc_push_parm, objc_get_parm_info, gen_type_name, gen_type_name_0, start_var_decl, finish_var_decl, create_field_decl): New prototypes. (objc_expand_function_end, comp_method_with_proto, objc_expr_last, gen_declaration_1, gen_declarator, is_complex_decl, adorn_decl, define_decl, create_builtin_decl, gen_declspecs): Remove prototypes. (TYPE_ID): Rename to OBJECT_TYPEDEF_NAME. (CLASS_TYPEDEF_NAME): New. (TAG_EXECCLASS): Change from a global variable to a #define. (TAG_RETURN_STRUCT): Delete. (TAG_GNUINIT): New, holds '__objc_gnu_init' name. (objc_inherit_code, objc_public_flag): New, moved from c-parse.in. (string_descriptor): New struct. (string_htab): New hash table. (string_hash, string_eq): New prototypes. (generate_struct_by_value_array): Call create_field_decl() instead of create_builtin_decl(). (objc_init): Do not initialize objc_ellipsis_node or TAG_EXECCLASS; In ObjC++ mode, call cxx_init() instead of c_objc_common_init(). (objc_finish_file): In ObjC++, call instantiate_pending_templates() and cp_finish_file(). (define_decl, get_static_reference, get_protocol_reference, create_builtin_decl): Remove functions. (objc_start_class_interface, objc_start_category_interface, objc_start_protocol, objc_continue_interface, objc_finish_interface, objc_start_class_implementation, objc_start_category_implementation, objc_continue_implementation, objc_finish_implementation, objc_set_visibility, objc_set_method_type, objc_build_method_signature, objc_add_method_declaration, objc_start_method_definition, objc_add_instance_variable, objc_get_protocol_qualified_type, create_field_decl, start_var_decl, finish_var_decl): New functions. (setup_string_decl): Simplify since it is only called once. (synth_module_prologue): Call build_class_template(); predefine 'id' and 'Class' as typedefs; rename 'temp_type' to 'type'; disable debug hooks for duration of function; fix GNU runtime messenger signatures to correspond to reality; forward-declare '__objc_exec_class' for the GNU runtime; call build_selector_table_decl(); in ObjC++ mode, generate 'extern "C" { ... }' wrappers around synthesized declarations; call build_protocol_template() and build_category_template(). (string_hash, string_eq): New functions. (objc_build_string_object): Check metaclass correctness only once; store string literals in hash table. (objc_build_constructor): Do not convert initializer elements; adjust for ObjC++ impedance mismatch. (build_objc_symtab_template): Call create_field_decl() instead of create_builtin_decl(). (init_objc_symtab): Add missing conversion to initializer element. (build_metadata_decl): Call start_var_decl() instead of define_decl(). (generate_objc_symtab_decl): Do not call build_category_template(); call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(). (build_module_descriptor): Call create_field_decl() instead of grokfield(); call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(); always mark module descriptor as used; move GNU runtime-specific functionality to build_module_initializer_routine(). (build_module_initializer_routine): New function, broken off of build_module_descriptor(). (objc_static_init_needed_p, objc_generate_static_init_call): New functions. (generate_static_references, generate_strings, build_selector_translation_table, generate_descriptor_table, generate_ivars_list, generate_dispatch_table, generate_category): Call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(); build a type directly instead of via groktypename(). (build_selector_reference_decl, build_selector_table_decl, build_class_reference_decl, build_protocol_reference, generate_objc_image_info): Call start_var_decl() instead of build_decl(). (build_selector_reference): For GNU runtime, do not call build_selector_reference_decl(). (build_selector, build_typed_selector_reference): Always convert result to the selector type. (add_objc_string): Cast return value to 'char *'. (build_method_prototype_template, build_selector_template, build_method_template): Use actual selector type for fields pointing to selectors. (finish_objc): For GNU runtime, call build_module_initializer_routine() after build_module_descriptor(). (generate_protocol_list, generate_shared_structures): Call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(); build a type directly instead of via groktypename(). (synth_id_with_class_suffix): Return a string. (get_arg_type_list): For instance methods, use the instance type for 'self'; do not call groktypename_in_parm_context(). (build_objc_string_decl): Squash redeclaration errors in ObjC++. (objc_is_class_name): Use OBJC_TYPE_NAME instead of TYPE_NAME; handle RECORD_TYPEs in ObjC as well as ObjC++. (objc_is_id): New function. (objc_is_object_ptr): Return the canonical type node. (objc_get_class_ivars): Simplify using get_class_ivars(). (get_class_ivars): Remove second parameter; create a fresh copy of the ivar list for each call; do not check for existence of super class. (objc_eh_runtime_type): Mark #ifndef OBJCPLUS. (objc_init_exceptions): When using SJLJ-style exceptions, require the use of '-fobjc-exceptions' flag; do not require it for DWARF-style exceptions. (objc_build_exc_ptr, next_sjlj_build_try_catch_finally): Use objc_object_type instead of objc_id_type. (objc_begin_catch_clause): Convert the incoming PARM_DECL into a VAR_DECL before placing it in the appropriate scope; do not call define_decl(); adjust call to c_begin_compound_stmt(); use objc_object_type instead of objc_id_type. (build_next_objc_exception_stuff): Call create_field_decl() instead of create_builtin_decl(); construct type directly instead of calling groktypename(); use OBJC_VOID_AT_END to mark end of function parameters. (build_private_template): Adjust call to get_class_ivars(); build a type directly instead of via groktypename(). (build_protocol_template, build_method_prototype_list_template, build_method_prototype_template, build_category_template, build_selector_template, build_class_template, build_super_template, build_ivar_template, build_ivar_list_template, build_method_list_template, build_method_template): Call create_field_decl() instead of grokfield(). (objc_method_parm_type): Do not call groktypename(). (generate_descriptor_table): Call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(). (generate_method_descriptors, build_protocol_initializer, generate_dispatch_tables, build_category_initializer, build_shared_structure_initializer): Do not call groktypename(). (generate_protocols): Call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(); do not call groktypename(). (error_with_ivar): Remove last parameter. (check_ivars): Do not iterate ovar CLASS_RAW_IVARS lists in addition to CLASS_IVARS lists; adjust calls to error_with_ivar(). (generate_ivar_lists): Convert one of the initializer elements; do not call groktypename(). (get_arg_type_list, start_method_def, gen_method_def): Account for new representation of variable arguments and '...' in Objective-C methods; add Objective-C++ impedance matching code. (is_objc_type_qualifier): Remove function. (adjust_type_for_id_default): Simplify; there is no longer a need to wade through declspecs. (lookup_interface, start_class, continue_class, finish_class, start_method_def, start_protocol, build_method_decl, objc_add_method, add_instance_variable, build_ivar_reference, is_ivar, is_private, get_super_receiver, objc_build_finally_epilogue): Make into static functions. (receiver_is_class_object): Use new IS_CLASS() macro. (objc_build_message_expr): Tweak ObjC++ message argument handling; call objc_finish_message_expr() instead of finish_message_expr(). (finish_message_expr): Rename to objc_finish_message_expr(); use OBJC_TYPE_NAME and OBJC_SET_TYPE_NAME macros instead of TYPE_NAME. call gen_type_name() instead of gen_declaration(); call objc_is_id() instead of using IS_ID and IS_CLASS; Use objc_class_name instead of calling get_identifier("Class"); handle CONVERT_EXPRs in receiver. (build_objc_method_call, warn_with_method): Do not call groktypename(). (build_ivar_reference): Call convert() instead of clobbering in a type. (hash_init): Initialize string_htab hash table. (add_instance_variable): Simplify parameter list; do not call grokfield(); do not populate CLASS_IVARS list. (start_class): Check for the existence of super class, if one was specified. (continue_class): Use CLASS_RAW_IVARS rather than CLASS_IVARS; do not call build_class_template(); adjust call to get_class_ivars(); call build_decl(), pushdecl() and finish_decl() instead of define_decl(). (finish_class): Call build_decl(), pushdecl() and finish_decl() instead of define_decl(). (add_protocols): Use PROTOCOL_BINFO_ELTS for the tree vector size. (start_protocol): Do not call build_protocol_template(); use PROTOCOL_BINFO_ELTS for the tree vector size. (encode_type_qualifiers): Do not handle the 'const' qualifier here. (encode_pointer): Encode 'const char *' as 'r*', for backwards compatibility. (encode_array): Use HOST_WIDE_INT_PRINT_DEC instead of "%ld". (encode_type): Handle the 'const' qualifier here. (objc_parmlist): New global variable, sued by objc_push_parm and objc_get_parm_info(). (objc_push_parm, objc_get_parm_info): New functions. (objc_expr_last): Remove function. (synth_self_and_ucmd_args): For instance methods, use the instance type for 'self'; call objc_push_parm() instead of push_parm_decl(). (start_method_def): Do not call push_scope(), declare_parm_level(), pop_scope(), push_parm_decl(), store_parm_decls() or objc_expr_last(); just use objc_push_parm() and objc_get_parm_info(). (comp_method_with_proto): Remove function. (objc_types_are_equivalent): Strip away indirections before comparing underlying types. (comp_proto_with_proto): Do not call groktypename(); types are no longer in raw declspec format. (objc_start_function): New function. (really_start_method): Call comp_proto_with_proto() instead of comp_method_with_proto(); call objc_start_function() instead of hand-crafting a function declarator. (continue_method_def, objc_expand_function_end): Remove functions. (get_super_receiver): Call objc_get_current_scope() instead of get_current_scope(); reference 'super_class' field (instead of 'class'). (finish_method_def): Rename to objc_finish_method_definition() and add a function decl parameter; move method encoding call from objc_expand_function_end(). (is_complex_decl, adorn_decl, gen_declarator, gen_declspecs, gen_declaration_1): Remove functions. (tmpbuf, RAW_DECLSPEC): Remove. (gen_declaration): Remove second parameter; simplify to deal with TYPE_P nodes instead of raw declspecs. (gen_type_name, gen_type_name_0): New functions. (gen_method_decl): Remove second parameter; call gen_type_name() instead of gen_declaration_1(). (dump_interface): Adjust calls to gen_declaration() and gen_method_decl(); do not allocate a separate string buffer. (init_objc): Allocate a larger string buffer to accommodate dump_interface(); adjust call to build_module_descriptor(); add call to build_module_initializer_routine() for the GNU runtime. (generate_classref_translation_entry): Do not call start_decl(); call finish_var_decl() instead of finish_decl(); call convert() instead of build_c_cast(). * objc-act.h (CLASS_OWN_IVARS): Remove accessor. (CLASS_BINFO_ELTS): Reduce from 6 to 5, now that CLASS_OWN_IVARS is gone. (OCTI_GNU_INIT_DECL, GNU_INIT_decl): New. (OCTI_ELLIPSIS_NODE, objc_ellipsis_node): Remove. (OCTI_ID_ID, id_type, objc_id_id): Rename to OCTI_ID_NAME, objc_object_type and objc_object_name, respectively. (OCTI_CLS_REF, OCTI_CLASS_NAME, objc_class_reference, objc_class_name): New. (IS_CLASS): New macro. (IS_ID, IS_SUPER): Robustify. (OCTI_EXECCLASS_DECL, execclass_decl): New. (finish_file, start_class, continue_class, finish_class, start_method_def, continue_method_def, finish_method_def, start_protocol, finish_protocol, objc_build_throw_stmt, objc_build_try_catch_finally_stmt, objc_build_synchronized_prologue, objc_build_synchronized_epilogue, objc_build_try_prologue, objc_build_try_epilogue, objc_build_catch_stmt, objc_build_catch_epilogue, objc_build_finally_prologue, objc_build_finally_epilogue, is_ivar, is_private, is_public, add_instance_variable, objc_add_method, get_super_receiver, objc_clear_super_receiver, get_class_ivars_from_name, get_class_reference, get_static_reference, get_object_reference, build_message_expr, finish_message_expr, build_selector_expr, build_ivar_reference, build_keyword_decl, build_method_decl, build_protocol_expr, build_objc_string_object, objc_declare_alias, objc_declare_class, objc_declare_protocols, objc_comptypes, objc_check_decl, build_encode_expr): Remove prototypes. (imp_count, cat_count): Make GGC-aware. (OBJC_SET_TYPE_NAME): New macro. From-SVN: r87168
2004-09-08 02:49:44 +02:00
/* struct _objc_category {
char *category_name;
char *class_name;
Makefile.in (c-parse.o): Depend on $(C_COMMON_H). [gcc/ChangeLog] 2004-09-07 Ziemowit Laski <zlaski@apple.com> * Makefile.in (c-parse.o): Depend on $(C_COMMON_H). * c-parse.in: Include c-common.h instead of objc-act.h. (ivar_decl_list, ivar_decls, ivar_decl, ivars, ivar_declarator, myparms, myparm): Remove %type declarations. (methodtype, optparms, OBJC_TYPE_QUAL, objc_quals, objc_qual, objc_typename, objc_try_catch_stmt, optellipsis): Add %type declarations. (objc_inherit_code, objc_public_flag): Remove. (typespec_nonreserved_nonattr): Call objc_get_protocol_qualified_type() instead of get_static_reference() and get_protocol_reference(). (stmt_nocomp): Call grokparm() on @catch parameter. (objcdef): Move semantic action to objc_finish_implementation(). (classdef): Move semantic action to objc_start_class_interface(), objc_continue_interface(), objc_finish_interface(), objc_start_class_implementation(), objc_continue_implementation(), objc_start_category_interface() and objc_start_category_implementation(). (protocoldef): Move semantic actions to objc_start_protocol() and objc_finish_interface(). (ivar_decl_list): Remove nonterminal. (visibility_spec): Move semantic actions to objc_set_visibility(). (ivar_decls): Remove assignment to $$. (ivar_decl): Rephrase in terms of component_decl; call objc_add_instance_variable(). (ivars, ivar_declarator): Remove nonterminals. (opt_semi): New nonterminal. (methodtype): Remove semantic actions. (methoddef): Move semantic actions to objc_set_method_type(), objc_start_method_definition() and objc_finish_method_definition(). (methodproto): Move semantic actions to objc_set_method_type() and objc_add_method_declaration(). (methoddecl): Use objc_typename instead of typename; move semantic actions to objc_build_method_signature(). (optarglist, myxdecls, mydecl, myparms, myparm): Remove nonterminals. (optparmlist): Express in terms of optparms and optellipsis. (optparms, optellipsis, objc_qual, objc_quals, objc_typename): New nonterminals. (keyworddecl): Use objc_typename instead of typename. (rid_to_yy): Mark RID_IN, RID_OUT, RID_INOUT, RID_BYCOPY, RID_BYREF and RID_ONEWAY as returning OBJC_TYPE_QUAL to yyparse(). [gcc/objc/ChangeLog] 2004-09-07 Ziemowit Laski <zlaski@apple.com> * Make-lang.in (objc/objc-parse.o): Depend on $(C_COMMON_H) instead of objc/objc-act.h. (objc/objc-act.o): Depend on $(HASHTAB_H). * objc-act.c: Include hashtab.h; in ObjC++ mode, include cp-tree.h and objcp-decl.h instead of c-tree.h. (build_module_descriptor, get_class_ivars, synth_id_with_class_suffix, error_with_ivar, gen_method_decl, gen_declaration, setup_string_decl, build_protocol_template): Adjust prototypes. (build_module_initializer_routine, start_class, continue_class, finish_class, start_method_def, objc_start_function, start_protocol, build_method_decl, objc_add_method, add_instance_variable, build_ivar_reference, is_ivar, is_private, get_super_receiver, build_selector_table_decl, objc_push_parm, objc_get_parm_info, gen_type_name, gen_type_name_0, start_var_decl, finish_var_decl, create_field_decl): New prototypes. (objc_expand_function_end, comp_method_with_proto, objc_expr_last, gen_declaration_1, gen_declarator, is_complex_decl, adorn_decl, define_decl, create_builtin_decl, gen_declspecs): Remove prototypes. (TYPE_ID): Rename to OBJECT_TYPEDEF_NAME. (CLASS_TYPEDEF_NAME): New. (TAG_EXECCLASS): Change from a global variable to a #define. (TAG_RETURN_STRUCT): Delete. (TAG_GNUINIT): New, holds '__objc_gnu_init' name. (objc_inherit_code, objc_public_flag): New, moved from c-parse.in. (string_descriptor): New struct. (string_htab): New hash table. (string_hash, string_eq): New prototypes. (generate_struct_by_value_array): Call create_field_decl() instead of create_builtin_decl(). (objc_init): Do not initialize objc_ellipsis_node or TAG_EXECCLASS; In ObjC++ mode, call cxx_init() instead of c_objc_common_init(). (objc_finish_file): In ObjC++, call instantiate_pending_templates() and cp_finish_file(). (define_decl, get_static_reference, get_protocol_reference, create_builtin_decl): Remove functions. (objc_start_class_interface, objc_start_category_interface, objc_start_protocol, objc_continue_interface, objc_finish_interface, objc_start_class_implementation, objc_start_category_implementation, objc_continue_implementation, objc_finish_implementation, objc_set_visibility, objc_set_method_type, objc_build_method_signature, objc_add_method_declaration, objc_start_method_definition, objc_add_instance_variable, objc_get_protocol_qualified_type, create_field_decl, start_var_decl, finish_var_decl): New functions. (setup_string_decl): Simplify since it is only called once. (synth_module_prologue): Call build_class_template(); predefine 'id' and 'Class' as typedefs; rename 'temp_type' to 'type'; disable debug hooks for duration of function; fix GNU runtime messenger signatures to correspond to reality; forward-declare '__objc_exec_class' for the GNU runtime; call build_selector_table_decl(); in ObjC++ mode, generate 'extern "C" { ... }' wrappers around synthesized declarations; call build_protocol_template() and build_category_template(). (string_hash, string_eq): New functions. (objc_build_string_object): Check metaclass correctness only once; store string literals in hash table. (objc_build_constructor): Do not convert initializer elements; adjust for ObjC++ impedance mismatch. (build_objc_symtab_template): Call create_field_decl() instead of create_builtin_decl(). (init_objc_symtab): Add missing conversion to initializer element. (build_metadata_decl): Call start_var_decl() instead of define_decl(). (generate_objc_symtab_decl): Do not call build_category_template(); call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(). (build_module_descriptor): Call create_field_decl() instead of grokfield(); call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(); always mark module descriptor as used; move GNU runtime-specific functionality to build_module_initializer_routine(). (build_module_initializer_routine): New function, broken off of build_module_descriptor(). (objc_static_init_needed_p, objc_generate_static_init_call): New functions. (generate_static_references, generate_strings, build_selector_translation_table, generate_descriptor_table, generate_ivars_list, generate_dispatch_table, generate_category): Call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(); build a type directly instead of via groktypename(). (build_selector_reference_decl, build_selector_table_decl, build_class_reference_decl, build_protocol_reference, generate_objc_image_info): Call start_var_decl() instead of build_decl(). (build_selector_reference): For GNU runtime, do not call build_selector_reference_decl(). (build_selector, build_typed_selector_reference): Always convert result to the selector type. (add_objc_string): Cast return value to 'char *'. (build_method_prototype_template, build_selector_template, build_method_template): Use actual selector type for fields pointing to selectors. (finish_objc): For GNU runtime, call build_module_initializer_routine() after build_module_descriptor(). (generate_protocol_list, generate_shared_structures): Call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(); build a type directly instead of via groktypename(). (synth_id_with_class_suffix): Return a string. (get_arg_type_list): For instance methods, use the instance type for 'self'; do not call groktypename_in_parm_context(). (build_objc_string_decl): Squash redeclaration errors in ObjC++. (objc_is_class_name): Use OBJC_TYPE_NAME instead of TYPE_NAME; handle RECORD_TYPEs in ObjC as well as ObjC++. (objc_is_id): New function. (objc_is_object_ptr): Return the canonical type node. (objc_get_class_ivars): Simplify using get_class_ivars(). (get_class_ivars): Remove second parameter; create a fresh copy of the ivar list for each call; do not check for existence of super class. (objc_eh_runtime_type): Mark #ifndef OBJCPLUS. (objc_init_exceptions): When using SJLJ-style exceptions, require the use of '-fobjc-exceptions' flag; do not require it for DWARF-style exceptions. (objc_build_exc_ptr, next_sjlj_build_try_catch_finally): Use objc_object_type instead of objc_id_type. (objc_begin_catch_clause): Convert the incoming PARM_DECL into a VAR_DECL before placing it in the appropriate scope; do not call define_decl(); adjust call to c_begin_compound_stmt(); use objc_object_type instead of objc_id_type. (build_next_objc_exception_stuff): Call create_field_decl() instead of create_builtin_decl(); construct type directly instead of calling groktypename(); use OBJC_VOID_AT_END to mark end of function parameters. (build_private_template): Adjust call to get_class_ivars(); build a type directly instead of via groktypename(). (build_protocol_template, build_method_prototype_list_template, build_method_prototype_template, build_category_template, build_selector_template, build_class_template, build_super_template, build_ivar_template, build_ivar_list_template, build_method_list_template, build_method_template): Call create_field_decl() instead of grokfield(). (objc_method_parm_type): Do not call groktypename(). (generate_descriptor_table): Call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(). (generate_method_descriptors, build_protocol_initializer, generate_dispatch_tables, build_category_initializer, build_shared_structure_initializer): Do not call groktypename(). (generate_protocols): Call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(); do not call groktypename(). (error_with_ivar): Remove last parameter. (check_ivars): Do not iterate ovar CLASS_RAW_IVARS lists in addition to CLASS_IVARS lists; adjust calls to error_with_ivar(). (generate_ivar_lists): Convert one of the initializer elements; do not call groktypename(). (get_arg_type_list, start_method_def, gen_method_def): Account for new representation of variable arguments and '...' in Objective-C methods; add Objective-C++ impedance matching code. (is_objc_type_qualifier): Remove function. (adjust_type_for_id_default): Simplify; there is no longer a need to wade through declspecs. (lookup_interface, start_class, continue_class, finish_class, start_method_def, start_protocol, build_method_decl, objc_add_method, add_instance_variable, build_ivar_reference, is_ivar, is_private, get_super_receiver, objc_build_finally_epilogue): Make into static functions. (receiver_is_class_object): Use new IS_CLASS() macro. (objc_build_message_expr): Tweak ObjC++ message argument handling; call objc_finish_message_expr() instead of finish_message_expr(). (finish_message_expr): Rename to objc_finish_message_expr(); use OBJC_TYPE_NAME and OBJC_SET_TYPE_NAME macros instead of TYPE_NAME. call gen_type_name() instead of gen_declaration(); call objc_is_id() instead of using IS_ID and IS_CLASS; Use objc_class_name instead of calling get_identifier("Class"); handle CONVERT_EXPRs in receiver. (build_objc_method_call, warn_with_method): Do not call groktypename(). (build_ivar_reference): Call convert() instead of clobbering in a type. (hash_init): Initialize string_htab hash table. (add_instance_variable): Simplify parameter list; do not call grokfield(); do not populate CLASS_IVARS list. (start_class): Check for the existence of super class, if one was specified. (continue_class): Use CLASS_RAW_IVARS rather than CLASS_IVARS; do not call build_class_template(); adjust call to get_class_ivars(); call build_decl(), pushdecl() and finish_decl() instead of define_decl(). (finish_class): Call build_decl(), pushdecl() and finish_decl() instead of define_decl(). (add_protocols): Use PROTOCOL_BINFO_ELTS for the tree vector size. (start_protocol): Do not call build_protocol_template(); use PROTOCOL_BINFO_ELTS for the tree vector size. (encode_type_qualifiers): Do not handle the 'const' qualifier here. (encode_pointer): Encode 'const char *' as 'r*', for backwards compatibility. (encode_array): Use HOST_WIDE_INT_PRINT_DEC instead of "%ld". (encode_type): Handle the 'const' qualifier here. (objc_parmlist): New global variable, sued by objc_push_parm and objc_get_parm_info(). (objc_push_parm, objc_get_parm_info): New functions. (objc_expr_last): Remove function. (synth_self_and_ucmd_args): For instance methods, use the instance type for 'self'; call objc_push_parm() instead of push_parm_decl(). (start_method_def): Do not call push_scope(), declare_parm_level(), pop_scope(), push_parm_decl(), store_parm_decls() or objc_expr_last(); just use objc_push_parm() and objc_get_parm_info(). (comp_method_with_proto): Remove function. (objc_types_are_equivalent): Strip away indirections before comparing underlying types. (comp_proto_with_proto): Do not call groktypename(); types are no longer in raw declspec format. (objc_start_function): New function. (really_start_method): Call comp_proto_with_proto() instead of comp_method_with_proto(); call objc_start_function() instead of hand-crafting a function declarator. (continue_method_def, objc_expand_function_end): Remove functions. (get_super_receiver): Call objc_get_current_scope() instead of get_current_scope(); reference 'super_class' field (instead of 'class'). (finish_method_def): Rename to objc_finish_method_definition() and add a function decl parameter; move method encoding call from objc_expand_function_end(). (is_complex_decl, adorn_decl, gen_declarator, gen_declspecs, gen_declaration_1): Remove functions. (tmpbuf, RAW_DECLSPEC): Remove. (gen_declaration): Remove second parameter; simplify to deal with TYPE_P nodes instead of raw declspecs. (gen_type_name, gen_type_name_0): New functions. (gen_method_decl): Remove second parameter; call gen_type_name() instead of gen_declaration_1(). (dump_interface): Adjust calls to gen_declaration() and gen_method_decl(); do not allocate a separate string buffer. (init_objc): Allocate a larger string buffer to accommodate dump_interface(); adjust call to build_module_descriptor(); add call to build_module_initializer_routine() for the GNU runtime. (generate_classref_translation_entry): Do not call start_decl(); call finish_var_decl() instead of finish_decl(); call convert() instead of build_c_cast(). * objc-act.h (CLASS_OWN_IVARS): Remove accessor. (CLASS_BINFO_ELTS): Reduce from 6 to 5, now that CLASS_OWN_IVARS is gone. (OCTI_GNU_INIT_DECL, GNU_INIT_decl): New. (OCTI_ELLIPSIS_NODE, objc_ellipsis_node): Remove. (OCTI_ID_ID, id_type, objc_id_id): Rename to OCTI_ID_NAME, objc_object_type and objc_object_name, respectively. (OCTI_CLS_REF, OCTI_CLASS_NAME, objc_class_reference, objc_class_name): New. (IS_CLASS): New macro. (IS_ID, IS_SUPER): Robustify. (OCTI_EXECCLASS_DECL, execclass_decl): New. (finish_file, start_class, continue_class, finish_class, start_method_def, continue_method_def, finish_method_def, start_protocol, finish_protocol, objc_build_throw_stmt, objc_build_try_catch_finally_stmt, objc_build_synchronized_prologue, objc_build_synchronized_epilogue, objc_build_try_prologue, objc_build_try_epilogue, objc_build_catch_stmt, objc_build_catch_epilogue, objc_build_finally_prologue, objc_build_finally_epilogue, is_ivar, is_private, is_public, add_instance_variable, objc_add_method, get_super_receiver, objc_clear_super_receiver, get_class_ivars_from_name, get_class_reference, get_static_reference, get_object_reference, build_message_expr, finish_message_expr, build_selector_expr, build_ivar_reference, build_keyword_decl, build_method_decl, build_protocol_expr, build_objc_string_object, objc_declare_alias, objc_declare_class, objc_declare_protocols, objc_comptypes, objc_check_decl, build_encode_expr): Remove prototypes. (imp_count, cat_count): Make GGC-aware. (OBJC_SET_TYPE_NAME): New macro. From-SVN: r87168
2004-09-08 02:49:44 +02:00
struct _objc_method_list *instance_methods;
struct _objc_method_list *class_methods;
struct _objc_protocol_list *protocols;
}; */
1992-01-18 00:15:38 +01:00
static void
build_category_template (void)
1992-01-18 00:15:38 +01:00
{
Makefile.in (c-parse.o): Depend on $(C_COMMON_H). [gcc/ChangeLog] 2004-09-07 Ziemowit Laski <zlaski@apple.com> * Makefile.in (c-parse.o): Depend on $(C_COMMON_H). * c-parse.in: Include c-common.h instead of objc-act.h. (ivar_decl_list, ivar_decls, ivar_decl, ivars, ivar_declarator, myparms, myparm): Remove %type declarations. (methodtype, optparms, OBJC_TYPE_QUAL, objc_quals, objc_qual, objc_typename, objc_try_catch_stmt, optellipsis): Add %type declarations. (objc_inherit_code, objc_public_flag): Remove. (typespec_nonreserved_nonattr): Call objc_get_protocol_qualified_type() instead of get_static_reference() and get_protocol_reference(). (stmt_nocomp): Call grokparm() on @catch parameter. (objcdef): Move semantic action to objc_finish_implementation(). (classdef): Move semantic action to objc_start_class_interface(), objc_continue_interface(), objc_finish_interface(), objc_start_class_implementation(), objc_continue_implementation(), objc_start_category_interface() and objc_start_category_implementation(). (protocoldef): Move semantic actions to objc_start_protocol() and objc_finish_interface(). (ivar_decl_list): Remove nonterminal. (visibility_spec): Move semantic actions to objc_set_visibility(). (ivar_decls): Remove assignment to $$. (ivar_decl): Rephrase in terms of component_decl; call objc_add_instance_variable(). (ivars, ivar_declarator): Remove nonterminals. (opt_semi): New nonterminal. (methodtype): Remove semantic actions. (methoddef): Move semantic actions to objc_set_method_type(), objc_start_method_definition() and objc_finish_method_definition(). (methodproto): Move semantic actions to objc_set_method_type() and objc_add_method_declaration(). (methoddecl): Use objc_typename instead of typename; move semantic actions to objc_build_method_signature(). (optarglist, myxdecls, mydecl, myparms, myparm): Remove nonterminals. (optparmlist): Express in terms of optparms and optellipsis. (optparms, optellipsis, objc_qual, objc_quals, objc_typename): New nonterminals. (keyworddecl): Use objc_typename instead of typename. (rid_to_yy): Mark RID_IN, RID_OUT, RID_INOUT, RID_BYCOPY, RID_BYREF and RID_ONEWAY as returning OBJC_TYPE_QUAL to yyparse(). [gcc/objc/ChangeLog] 2004-09-07 Ziemowit Laski <zlaski@apple.com> * Make-lang.in (objc/objc-parse.o): Depend on $(C_COMMON_H) instead of objc/objc-act.h. (objc/objc-act.o): Depend on $(HASHTAB_H). * objc-act.c: Include hashtab.h; in ObjC++ mode, include cp-tree.h and objcp-decl.h instead of c-tree.h. (build_module_descriptor, get_class_ivars, synth_id_with_class_suffix, error_with_ivar, gen_method_decl, gen_declaration, setup_string_decl, build_protocol_template): Adjust prototypes. (build_module_initializer_routine, start_class, continue_class, finish_class, start_method_def, objc_start_function, start_protocol, build_method_decl, objc_add_method, add_instance_variable, build_ivar_reference, is_ivar, is_private, get_super_receiver, build_selector_table_decl, objc_push_parm, objc_get_parm_info, gen_type_name, gen_type_name_0, start_var_decl, finish_var_decl, create_field_decl): New prototypes. (objc_expand_function_end, comp_method_with_proto, objc_expr_last, gen_declaration_1, gen_declarator, is_complex_decl, adorn_decl, define_decl, create_builtin_decl, gen_declspecs): Remove prototypes. (TYPE_ID): Rename to OBJECT_TYPEDEF_NAME. (CLASS_TYPEDEF_NAME): New. (TAG_EXECCLASS): Change from a global variable to a #define. (TAG_RETURN_STRUCT): Delete. (TAG_GNUINIT): New, holds '__objc_gnu_init' name. (objc_inherit_code, objc_public_flag): New, moved from c-parse.in. (string_descriptor): New struct. (string_htab): New hash table. (string_hash, string_eq): New prototypes. (generate_struct_by_value_array): Call create_field_decl() instead of create_builtin_decl(). (objc_init): Do not initialize objc_ellipsis_node or TAG_EXECCLASS; In ObjC++ mode, call cxx_init() instead of c_objc_common_init(). (objc_finish_file): In ObjC++, call instantiate_pending_templates() and cp_finish_file(). (define_decl, get_static_reference, get_protocol_reference, create_builtin_decl): Remove functions. (objc_start_class_interface, objc_start_category_interface, objc_start_protocol, objc_continue_interface, objc_finish_interface, objc_start_class_implementation, objc_start_category_implementation, objc_continue_implementation, objc_finish_implementation, objc_set_visibility, objc_set_method_type, objc_build_method_signature, objc_add_method_declaration, objc_start_method_definition, objc_add_instance_variable, objc_get_protocol_qualified_type, create_field_decl, start_var_decl, finish_var_decl): New functions. (setup_string_decl): Simplify since it is only called once. (synth_module_prologue): Call build_class_template(); predefine 'id' and 'Class' as typedefs; rename 'temp_type' to 'type'; disable debug hooks for duration of function; fix GNU runtime messenger signatures to correspond to reality; forward-declare '__objc_exec_class' for the GNU runtime; call build_selector_table_decl(); in ObjC++ mode, generate 'extern "C" { ... }' wrappers around synthesized declarations; call build_protocol_template() and build_category_template(). (string_hash, string_eq): New functions. (objc_build_string_object): Check metaclass correctness only once; store string literals in hash table. (objc_build_constructor): Do not convert initializer elements; adjust for ObjC++ impedance mismatch. (build_objc_symtab_template): Call create_field_decl() instead of create_builtin_decl(). (init_objc_symtab): Add missing conversion to initializer element. (build_metadata_decl): Call start_var_decl() instead of define_decl(). (generate_objc_symtab_decl): Do not call build_category_template(); call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(). (build_module_descriptor): Call create_field_decl() instead of grokfield(); call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(); always mark module descriptor as used; move GNU runtime-specific functionality to build_module_initializer_routine(). (build_module_initializer_routine): New function, broken off of build_module_descriptor(). (objc_static_init_needed_p, objc_generate_static_init_call): New functions. (generate_static_references, generate_strings, build_selector_translation_table, generate_descriptor_table, generate_ivars_list, generate_dispatch_table, generate_category): Call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(); build a type directly instead of via groktypename(). (build_selector_reference_decl, build_selector_table_decl, build_class_reference_decl, build_protocol_reference, generate_objc_image_info): Call start_var_decl() instead of build_decl(). (build_selector_reference): For GNU runtime, do not call build_selector_reference_decl(). (build_selector, build_typed_selector_reference): Always convert result to the selector type. (add_objc_string): Cast return value to 'char *'. (build_method_prototype_template, build_selector_template, build_method_template): Use actual selector type for fields pointing to selectors. (finish_objc): For GNU runtime, call build_module_initializer_routine() after build_module_descriptor(). (generate_protocol_list, generate_shared_structures): Call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(); build a type directly instead of via groktypename(). (synth_id_with_class_suffix): Return a string. (get_arg_type_list): For instance methods, use the instance type for 'self'; do not call groktypename_in_parm_context(). (build_objc_string_decl): Squash redeclaration errors in ObjC++. (objc_is_class_name): Use OBJC_TYPE_NAME instead of TYPE_NAME; handle RECORD_TYPEs in ObjC as well as ObjC++. (objc_is_id): New function. (objc_is_object_ptr): Return the canonical type node. (objc_get_class_ivars): Simplify using get_class_ivars(). (get_class_ivars): Remove second parameter; create a fresh copy of the ivar list for each call; do not check for existence of super class. (objc_eh_runtime_type): Mark #ifndef OBJCPLUS. (objc_init_exceptions): When using SJLJ-style exceptions, require the use of '-fobjc-exceptions' flag; do not require it for DWARF-style exceptions. (objc_build_exc_ptr, next_sjlj_build_try_catch_finally): Use objc_object_type instead of objc_id_type. (objc_begin_catch_clause): Convert the incoming PARM_DECL into a VAR_DECL before placing it in the appropriate scope; do not call define_decl(); adjust call to c_begin_compound_stmt(); use objc_object_type instead of objc_id_type. (build_next_objc_exception_stuff): Call create_field_decl() instead of create_builtin_decl(); construct type directly instead of calling groktypename(); use OBJC_VOID_AT_END to mark end of function parameters. (build_private_template): Adjust call to get_class_ivars(); build a type directly instead of via groktypename(). (build_protocol_template, build_method_prototype_list_template, build_method_prototype_template, build_category_template, build_selector_template, build_class_template, build_super_template, build_ivar_template, build_ivar_list_template, build_method_list_template, build_method_template): Call create_field_decl() instead of grokfield(). (objc_method_parm_type): Do not call groktypename(). (generate_descriptor_table): Call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(). (generate_method_descriptors, build_protocol_initializer, generate_dispatch_tables, build_category_initializer, build_shared_structure_initializer): Do not call groktypename(). (generate_protocols): Call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(); do not call groktypename(). (error_with_ivar): Remove last parameter. (check_ivars): Do not iterate ovar CLASS_RAW_IVARS lists in addition to CLASS_IVARS lists; adjust calls to error_with_ivar(). (generate_ivar_lists): Convert one of the initializer elements; do not call groktypename(). (get_arg_type_list, start_method_def, gen_method_def): Account for new representation of variable arguments and '...' in Objective-C methods; add Objective-C++ impedance matching code. (is_objc_type_qualifier): Remove function. (adjust_type_for_id_default): Simplify; there is no longer a need to wade through declspecs. (lookup_interface, start_class, continue_class, finish_class, start_method_def, start_protocol, build_method_decl, objc_add_method, add_instance_variable, build_ivar_reference, is_ivar, is_private, get_super_receiver, objc_build_finally_epilogue): Make into static functions. (receiver_is_class_object): Use new IS_CLASS() macro. (objc_build_message_expr): Tweak ObjC++ message argument handling; call objc_finish_message_expr() instead of finish_message_expr(). (finish_message_expr): Rename to objc_finish_message_expr(); use OBJC_TYPE_NAME and OBJC_SET_TYPE_NAME macros instead of TYPE_NAME. call gen_type_name() instead of gen_declaration(); call objc_is_id() instead of using IS_ID and IS_CLASS; Use objc_class_name instead of calling get_identifier("Class"); handle CONVERT_EXPRs in receiver. (build_objc_method_call, warn_with_method): Do not call groktypename(). (build_ivar_reference): Call convert() instead of clobbering in a type. (hash_init): Initialize string_htab hash table. (add_instance_variable): Simplify parameter list; do not call grokfield(); do not populate CLASS_IVARS list. (start_class): Check for the existence of super class, if one was specified. (continue_class): Use CLASS_RAW_IVARS rather than CLASS_IVARS; do not call build_class_template(); adjust call to get_class_ivars(); call build_decl(), pushdecl() and finish_decl() instead of define_decl(). (finish_class): Call build_decl(), pushdecl() and finish_decl() instead of define_decl(). (add_protocols): Use PROTOCOL_BINFO_ELTS for the tree vector size. (start_protocol): Do not call build_protocol_template(); use PROTOCOL_BINFO_ELTS for the tree vector size. (encode_type_qualifiers): Do not handle the 'const' qualifier here. (encode_pointer): Encode 'const char *' as 'r*', for backwards compatibility. (encode_array): Use HOST_WIDE_INT_PRINT_DEC instead of "%ld". (encode_type): Handle the 'const' qualifier here. (objc_parmlist): New global variable, sued by objc_push_parm and objc_get_parm_info(). (objc_push_parm, objc_get_parm_info): New functions. (objc_expr_last): Remove function. (synth_self_and_ucmd_args): For instance methods, use the instance type for 'self'; call objc_push_parm() instead of push_parm_decl(). (start_method_def): Do not call push_scope(), declare_parm_level(), pop_scope(), push_parm_decl(), store_parm_decls() or objc_expr_last(); just use objc_push_parm() and objc_get_parm_info(). (comp_method_with_proto): Remove function. (objc_types_are_equivalent): Strip away indirections before comparing underlying types. (comp_proto_with_proto): Do not call groktypename(); types are no longer in raw declspec format. (objc_start_function): New function. (really_start_method): Call comp_proto_with_proto() instead of comp_method_with_proto(); call objc_start_function() instead of hand-crafting a function declarator. (continue_method_def, objc_expand_function_end): Remove functions. (get_super_receiver): Call objc_get_current_scope() instead of get_current_scope(); reference 'super_class' field (instead of 'class'). (finish_method_def): Rename to objc_finish_method_definition() and add a function decl parameter; move method encoding call from objc_expand_function_end(). (is_complex_decl, adorn_decl, gen_declarator, gen_declspecs, gen_declaration_1): Remove functions. (tmpbuf, RAW_DECLSPEC): Remove. (gen_declaration): Remove second parameter; simplify to deal with TYPE_P nodes instead of raw declspecs. (gen_type_name, gen_type_name_0): New functions. (gen_method_decl): Remove second parameter; call gen_type_name() instead of gen_declaration_1(). (dump_interface): Adjust calls to gen_declaration() and gen_method_decl(); do not allocate a separate string buffer. (init_objc): Allocate a larger string buffer to accommodate dump_interface(); adjust call to build_module_descriptor(); add call to build_module_initializer_routine() for the GNU runtime. (generate_classref_translation_entry): Do not call start_decl(); call finish_var_decl() instead of finish_decl(); call convert() instead of build_c_cast(). * objc-act.h (CLASS_OWN_IVARS): Remove accessor. (CLASS_BINFO_ELTS): Reduce from 6 to 5, now that CLASS_OWN_IVARS is gone. (OCTI_GNU_INIT_DECL, GNU_INIT_decl): New. (OCTI_ELLIPSIS_NODE, objc_ellipsis_node): Remove. (OCTI_ID_ID, id_type, objc_id_id): Rename to OCTI_ID_NAME, objc_object_type and objc_object_name, respectively. (OCTI_CLS_REF, OCTI_CLASS_NAME, objc_class_reference, objc_class_name): New. (IS_CLASS): New macro. (IS_ID, IS_SUPER): Robustify. (OCTI_EXECCLASS_DECL, execclass_decl): New. (finish_file, start_class, continue_class, finish_class, start_method_def, continue_method_def, finish_method_def, start_protocol, finish_protocol, objc_build_throw_stmt, objc_build_try_catch_finally_stmt, objc_build_synchronized_prologue, objc_build_synchronized_epilogue, objc_build_try_prologue, objc_build_try_epilogue, objc_build_catch_stmt, objc_build_catch_epilogue, objc_build_finally_prologue, objc_build_finally_epilogue, is_ivar, is_private, is_public, add_instance_variable, objc_add_method, get_super_receiver, objc_clear_super_receiver, get_class_ivars_from_name, get_class_reference, get_static_reference, get_object_reference, build_message_expr, finish_message_expr, build_selector_expr, build_ivar_reference, build_keyword_decl, build_method_decl, build_protocol_expr, build_objc_string_object, objc_declare_alias, objc_declare_class, objc_declare_protocols, objc_comptypes, objc_check_decl, build_encode_expr): Remove prototypes. (imp_count, cat_count): Make GGC-aware. (OBJC_SET_TYPE_NAME): New macro. From-SVN: r87168
2004-09-08 02:49:44 +02:00
tree field_decl, field_decl_chain;
1992-01-18 00:15:38 +01:00
objc_category_template = start_struct (RECORD_TYPE,
get_identifier (UTAG_CATEGORY));
1992-01-18 00:15:38 +01:00
Makefile.in (c-parse.o): Depend on $(C_COMMON_H). [gcc/ChangeLog] 2004-09-07 Ziemowit Laski <zlaski@apple.com> * Makefile.in (c-parse.o): Depend on $(C_COMMON_H). * c-parse.in: Include c-common.h instead of objc-act.h. (ivar_decl_list, ivar_decls, ivar_decl, ivars, ivar_declarator, myparms, myparm): Remove %type declarations. (methodtype, optparms, OBJC_TYPE_QUAL, objc_quals, objc_qual, objc_typename, objc_try_catch_stmt, optellipsis): Add %type declarations. (objc_inherit_code, objc_public_flag): Remove. (typespec_nonreserved_nonattr): Call objc_get_protocol_qualified_type() instead of get_static_reference() and get_protocol_reference(). (stmt_nocomp): Call grokparm() on @catch parameter. (objcdef): Move semantic action to objc_finish_implementation(). (classdef): Move semantic action to objc_start_class_interface(), objc_continue_interface(), objc_finish_interface(), objc_start_class_implementation(), objc_continue_implementation(), objc_start_category_interface() and objc_start_category_implementation(). (protocoldef): Move semantic actions to objc_start_protocol() and objc_finish_interface(). (ivar_decl_list): Remove nonterminal. (visibility_spec): Move semantic actions to objc_set_visibility(). (ivar_decls): Remove assignment to $$. (ivar_decl): Rephrase in terms of component_decl; call objc_add_instance_variable(). (ivars, ivar_declarator): Remove nonterminals. (opt_semi): New nonterminal. (methodtype): Remove semantic actions. (methoddef): Move semantic actions to objc_set_method_type(), objc_start_method_definition() and objc_finish_method_definition(). (methodproto): Move semantic actions to objc_set_method_type() and objc_add_method_declaration(). (methoddecl): Use objc_typename instead of typename; move semantic actions to objc_build_method_signature(). (optarglist, myxdecls, mydecl, myparms, myparm): Remove nonterminals. (optparmlist): Express in terms of optparms and optellipsis. (optparms, optellipsis, objc_qual, objc_quals, objc_typename): New nonterminals. (keyworddecl): Use objc_typename instead of typename. (rid_to_yy): Mark RID_IN, RID_OUT, RID_INOUT, RID_BYCOPY, RID_BYREF and RID_ONEWAY as returning OBJC_TYPE_QUAL to yyparse(). [gcc/objc/ChangeLog] 2004-09-07 Ziemowit Laski <zlaski@apple.com> * Make-lang.in (objc/objc-parse.o): Depend on $(C_COMMON_H) instead of objc/objc-act.h. (objc/objc-act.o): Depend on $(HASHTAB_H). * objc-act.c: Include hashtab.h; in ObjC++ mode, include cp-tree.h and objcp-decl.h instead of c-tree.h. (build_module_descriptor, get_class_ivars, synth_id_with_class_suffix, error_with_ivar, gen_method_decl, gen_declaration, setup_string_decl, build_protocol_template): Adjust prototypes. (build_module_initializer_routine, start_class, continue_class, finish_class, start_method_def, objc_start_function, start_protocol, build_method_decl, objc_add_method, add_instance_variable, build_ivar_reference, is_ivar, is_private, get_super_receiver, build_selector_table_decl, objc_push_parm, objc_get_parm_info, gen_type_name, gen_type_name_0, start_var_decl, finish_var_decl, create_field_decl): New prototypes. (objc_expand_function_end, comp_method_with_proto, objc_expr_last, gen_declaration_1, gen_declarator, is_complex_decl, adorn_decl, define_decl, create_builtin_decl, gen_declspecs): Remove prototypes. (TYPE_ID): Rename to OBJECT_TYPEDEF_NAME. (CLASS_TYPEDEF_NAME): New. (TAG_EXECCLASS): Change from a global variable to a #define. (TAG_RETURN_STRUCT): Delete. (TAG_GNUINIT): New, holds '__objc_gnu_init' name. (objc_inherit_code, objc_public_flag): New, moved from c-parse.in. (string_descriptor): New struct. (string_htab): New hash table. (string_hash, string_eq): New prototypes. (generate_struct_by_value_array): Call create_field_decl() instead of create_builtin_decl(). (objc_init): Do not initialize objc_ellipsis_node or TAG_EXECCLASS; In ObjC++ mode, call cxx_init() instead of c_objc_common_init(). (objc_finish_file): In ObjC++, call instantiate_pending_templates() and cp_finish_file(). (define_decl, get_static_reference, get_protocol_reference, create_builtin_decl): Remove functions. (objc_start_class_interface, objc_start_category_interface, objc_start_protocol, objc_continue_interface, objc_finish_interface, objc_start_class_implementation, objc_start_category_implementation, objc_continue_implementation, objc_finish_implementation, objc_set_visibility, objc_set_method_type, objc_build_method_signature, objc_add_method_declaration, objc_start_method_definition, objc_add_instance_variable, objc_get_protocol_qualified_type, create_field_decl, start_var_decl, finish_var_decl): New functions. (setup_string_decl): Simplify since it is only called once. (synth_module_prologue): Call build_class_template(); predefine 'id' and 'Class' as typedefs; rename 'temp_type' to 'type'; disable debug hooks for duration of function; fix GNU runtime messenger signatures to correspond to reality; forward-declare '__objc_exec_class' for the GNU runtime; call build_selector_table_decl(); in ObjC++ mode, generate 'extern "C" { ... }' wrappers around synthesized declarations; call build_protocol_template() and build_category_template(). (string_hash, string_eq): New functions. (objc_build_string_object): Check metaclass correctness only once; store string literals in hash table. (objc_build_constructor): Do not convert initializer elements; adjust for ObjC++ impedance mismatch. (build_objc_symtab_template): Call create_field_decl() instead of create_builtin_decl(). (init_objc_symtab): Add missing conversion to initializer element. (build_metadata_decl): Call start_var_decl() instead of define_decl(). (generate_objc_symtab_decl): Do not call build_category_template(); call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(). (build_module_descriptor): Call create_field_decl() instead of grokfield(); call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(); always mark module descriptor as used; move GNU runtime-specific functionality to build_module_initializer_routine(). (build_module_initializer_routine): New function, broken off of build_module_descriptor(). (objc_static_init_needed_p, objc_generate_static_init_call): New functions. (generate_static_references, generate_strings, build_selector_translation_table, generate_descriptor_table, generate_ivars_list, generate_dispatch_table, generate_category): Call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(); build a type directly instead of via groktypename(). (build_selector_reference_decl, build_selector_table_decl, build_class_reference_decl, build_protocol_reference, generate_objc_image_info): Call start_var_decl() instead of build_decl(). (build_selector_reference): For GNU runtime, do not call build_selector_reference_decl(). (build_selector, build_typed_selector_reference): Always convert result to the selector type. (add_objc_string): Cast return value to 'char *'. (build_method_prototype_template, build_selector_template, build_method_template): Use actual selector type for fields pointing to selectors. (finish_objc): For GNU runtime, call build_module_initializer_routine() after build_module_descriptor(). (generate_protocol_list, generate_shared_structures): Call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(); build a type directly instead of via groktypename(). (synth_id_with_class_suffix): Return a string. (get_arg_type_list): For instance methods, use the instance type for 'self'; do not call groktypename_in_parm_context(). (build_objc_string_decl): Squash redeclaration errors in ObjC++. (objc_is_class_name): Use OBJC_TYPE_NAME instead of TYPE_NAME; handle RECORD_TYPEs in ObjC as well as ObjC++. (objc_is_id): New function. (objc_is_object_ptr): Return the canonical type node. (objc_get_class_ivars): Simplify using get_class_ivars(). (get_class_ivars): Remove second parameter; create a fresh copy of the ivar list for each call; do not check for existence of super class. (objc_eh_runtime_type): Mark #ifndef OBJCPLUS. (objc_init_exceptions): When using SJLJ-style exceptions, require the use of '-fobjc-exceptions' flag; do not require it for DWARF-style exceptions. (objc_build_exc_ptr, next_sjlj_build_try_catch_finally): Use objc_object_type instead of objc_id_type. (objc_begin_catch_clause): Convert the incoming PARM_DECL into a VAR_DECL before placing it in the appropriate scope; do not call define_decl(); adjust call to c_begin_compound_stmt(); use objc_object_type instead of objc_id_type. (build_next_objc_exception_stuff): Call create_field_decl() instead of create_builtin_decl(); construct type directly instead of calling groktypename(); use OBJC_VOID_AT_END to mark end of function parameters. (build_private_template): Adjust call to get_class_ivars(); build a type directly instead of via groktypename(). (build_protocol_template, build_method_prototype_list_template, build_method_prototype_template, build_category_template, build_selector_template, build_class_template, build_super_template, build_ivar_template, build_ivar_list_template, build_method_list_template, build_method_template): Call create_field_decl() instead of grokfield(). (objc_method_parm_type): Do not call groktypename(). (generate_descriptor_table): Call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(). (generate_method_descriptors, build_protocol_initializer, generate_dispatch_tables, build_category_initializer, build_shared_structure_initializer): Do not call groktypename(). (generate_protocols): Call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(); do not call groktypename(). (error_with_ivar): Remove last parameter. (check_ivars): Do not iterate ovar CLASS_RAW_IVARS lists in addition to CLASS_IVARS lists; adjust calls to error_with_ivar(). (generate_ivar_lists): Convert one of the initializer elements; do not call groktypename(). (get_arg_type_list, start_method_def, gen_method_def): Account for new representation of variable arguments and '...' in Objective-C methods; add Objective-C++ impedance matching code. (is_objc_type_qualifier): Remove function. (adjust_type_for_id_default): Simplify; there is no longer a need to wade through declspecs. (lookup_interface, start_class, continue_class, finish_class, start_method_def, start_protocol, build_method_decl, objc_add_method, add_instance_variable, build_ivar_reference, is_ivar, is_private, get_super_receiver, objc_build_finally_epilogue): Make into static functions. (receiver_is_class_object): Use new IS_CLASS() macro. (objc_build_message_expr): Tweak ObjC++ message argument handling; call objc_finish_message_expr() instead of finish_message_expr(). (finish_message_expr): Rename to objc_finish_message_expr(); use OBJC_TYPE_NAME and OBJC_SET_TYPE_NAME macros instead of TYPE_NAME. call gen_type_name() instead of gen_declaration(); call objc_is_id() instead of using IS_ID and IS_CLASS; Use objc_class_name instead of calling get_identifier("Class"); handle CONVERT_EXPRs in receiver. (build_objc_method_call, warn_with_method): Do not call groktypename(). (build_ivar_reference): Call convert() instead of clobbering in a type. (hash_init): Initialize string_htab hash table. (add_instance_variable): Simplify parameter list; do not call grokfield(); do not populate CLASS_IVARS list. (start_class): Check for the existence of super class, if one was specified. (continue_class): Use CLASS_RAW_IVARS rather than CLASS_IVARS; do not call build_class_template(); adjust call to get_class_ivars(); call build_decl(), pushdecl() and finish_decl() instead of define_decl(). (finish_class): Call build_decl(), pushdecl() and finish_decl() instead of define_decl(). (add_protocols): Use PROTOCOL_BINFO_ELTS for the tree vector size. (start_protocol): Do not call build_protocol_template(); use PROTOCOL_BINFO_ELTS for the tree vector size. (encode_type_qualifiers): Do not handle the 'const' qualifier here. (encode_pointer): Encode 'const char *' as 'r*', for backwards compatibility. (encode_array): Use HOST_WIDE_INT_PRINT_DEC instead of "%ld". (encode_type): Handle the 'const' qualifier here. (objc_parmlist): New global variable, sued by objc_push_parm and objc_get_parm_info(). (objc_push_parm, objc_get_parm_info): New functions. (objc_expr_last): Remove function. (synth_self_and_ucmd_args): For instance methods, use the instance type for 'self'; call objc_push_parm() instead of push_parm_decl(). (start_method_def): Do not call push_scope(), declare_parm_level(), pop_scope(), push_parm_decl(), store_parm_decls() or objc_expr_last(); just use objc_push_parm() and objc_get_parm_info(). (comp_method_with_proto): Remove function. (objc_types_are_equivalent): Strip away indirections before comparing underlying types. (comp_proto_with_proto): Do not call groktypename(); types are no longer in raw declspec format. (objc_start_function): New function. (really_start_method): Call comp_proto_with_proto() instead of comp_method_with_proto(); call objc_start_function() instead of hand-crafting a function declarator. (continue_method_def, objc_expand_function_end): Remove functions. (get_super_receiver): Call objc_get_current_scope() instead of get_current_scope(); reference 'super_class' field (instead of 'class'). (finish_method_def): Rename to objc_finish_method_definition() and add a function decl parameter; move method encoding call from objc_expand_function_end(). (is_complex_decl, adorn_decl, gen_declarator, gen_declspecs, gen_declaration_1): Remove functions. (tmpbuf, RAW_DECLSPEC): Remove. (gen_declaration): Remove second parameter; simplify to deal with TYPE_P nodes instead of raw declspecs. (gen_type_name, gen_type_name_0): New functions. (gen_method_decl): Remove second parameter; call gen_type_name() instead of gen_declaration_1(). (dump_interface): Adjust calls to gen_declaration() and gen_method_decl(); do not allocate a separate string buffer. (init_objc): Allocate a larger string buffer to accommodate dump_interface(); adjust call to build_module_descriptor(); add call to build_module_initializer_routine() for the GNU runtime. (generate_classref_translation_entry): Do not call start_decl(); call finish_var_decl() instead of finish_decl(); call convert() instead of build_c_cast(). * objc-act.h (CLASS_OWN_IVARS): Remove accessor. (CLASS_BINFO_ELTS): Reduce from 6 to 5, now that CLASS_OWN_IVARS is gone. (OCTI_GNU_INIT_DECL, GNU_INIT_decl): New. (OCTI_ELLIPSIS_NODE, objc_ellipsis_node): Remove. (OCTI_ID_ID, id_type, objc_id_id): Rename to OCTI_ID_NAME, objc_object_type and objc_object_name, respectively. (OCTI_CLS_REF, OCTI_CLASS_NAME, objc_class_reference, objc_class_name): New. (IS_CLASS): New macro. (IS_ID, IS_SUPER): Robustify. (OCTI_EXECCLASS_DECL, execclass_decl): New. (finish_file, start_class, continue_class, finish_class, start_method_def, continue_method_def, finish_method_def, start_protocol, finish_protocol, objc_build_throw_stmt, objc_build_try_catch_finally_stmt, objc_build_synchronized_prologue, objc_build_synchronized_epilogue, objc_build_try_prologue, objc_build_try_epilogue, objc_build_catch_stmt, objc_build_catch_epilogue, objc_build_finally_prologue, objc_build_finally_epilogue, is_ivar, is_private, is_public, add_instance_variable, objc_add_method, get_super_receiver, objc_clear_super_receiver, get_class_ivars_from_name, get_class_reference, get_static_reference, get_object_reference, build_message_expr, finish_message_expr, build_selector_expr, build_ivar_reference, build_keyword_decl, build_method_decl, build_protocol_expr, build_objc_string_object, objc_declare_alias, objc_declare_class, objc_declare_protocols, objc_comptypes, objc_check_decl, build_encode_expr): Remove prototypes. (imp_count, cat_count): Make GGC-aware. (OBJC_SET_TYPE_NAME): New macro. From-SVN: r87168
2004-09-08 02:49:44 +02:00
/* char *category_name; */
field_decl = create_field_decl (string_type_node, "category_name");
1992-01-18 00:15:38 +01:00
field_decl_chain = field_decl;
/* char *class_name; */
Makefile.in (c-parse.o): Depend on $(C_COMMON_H). [gcc/ChangeLog] 2004-09-07 Ziemowit Laski <zlaski@apple.com> * Makefile.in (c-parse.o): Depend on $(C_COMMON_H). * c-parse.in: Include c-common.h instead of objc-act.h. (ivar_decl_list, ivar_decls, ivar_decl, ivars, ivar_declarator, myparms, myparm): Remove %type declarations. (methodtype, optparms, OBJC_TYPE_QUAL, objc_quals, objc_qual, objc_typename, objc_try_catch_stmt, optellipsis): Add %type declarations. (objc_inherit_code, objc_public_flag): Remove. (typespec_nonreserved_nonattr): Call objc_get_protocol_qualified_type() instead of get_static_reference() and get_protocol_reference(). (stmt_nocomp): Call grokparm() on @catch parameter. (objcdef): Move semantic action to objc_finish_implementation(). (classdef): Move semantic action to objc_start_class_interface(), objc_continue_interface(), objc_finish_interface(), objc_start_class_implementation(), objc_continue_implementation(), objc_start_category_interface() and objc_start_category_implementation(). (protocoldef): Move semantic actions to objc_start_protocol() and objc_finish_interface(). (ivar_decl_list): Remove nonterminal. (visibility_spec): Move semantic actions to objc_set_visibility(). (ivar_decls): Remove assignment to $$. (ivar_decl): Rephrase in terms of component_decl; call objc_add_instance_variable(). (ivars, ivar_declarator): Remove nonterminals. (opt_semi): New nonterminal. (methodtype): Remove semantic actions. (methoddef): Move semantic actions to objc_set_method_type(), objc_start_method_definition() and objc_finish_method_definition(). (methodproto): Move semantic actions to objc_set_method_type() and objc_add_method_declaration(). (methoddecl): Use objc_typename instead of typename; move semantic actions to objc_build_method_signature(). (optarglist, myxdecls, mydecl, myparms, myparm): Remove nonterminals. (optparmlist): Express in terms of optparms and optellipsis. (optparms, optellipsis, objc_qual, objc_quals, objc_typename): New nonterminals. (keyworddecl): Use objc_typename instead of typename. (rid_to_yy): Mark RID_IN, RID_OUT, RID_INOUT, RID_BYCOPY, RID_BYREF and RID_ONEWAY as returning OBJC_TYPE_QUAL to yyparse(). [gcc/objc/ChangeLog] 2004-09-07 Ziemowit Laski <zlaski@apple.com> * Make-lang.in (objc/objc-parse.o): Depend on $(C_COMMON_H) instead of objc/objc-act.h. (objc/objc-act.o): Depend on $(HASHTAB_H). * objc-act.c: Include hashtab.h; in ObjC++ mode, include cp-tree.h and objcp-decl.h instead of c-tree.h. (build_module_descriptor, get_class_ivars, synth_id_with_class_suffix, error_with_ivar, gen_method_decl, gen_declaration, setup_string_decl, build_protocol_template): Adjust prototypes. (build_module_initializer_routine, start_class, continue_class, finish_class, start_method_def, objc_start_function, start_protocol, build_method_decl, objc_add_method, add_instance_variable, build_ivar_reference, is_ivar, is_private, get_super_receiver, build_selector_table_decl, objc_push_parm, objc_get_parm_info, gen_type_name, gen_type_name_0, start_var_decl, finish_var_decl, create_field_decl): New prototypes. (objc_expand_function_end, comp_method_with_proto, objc_expr_last, gen_declaration_1, gen_declarator, is_complex_decl, adorn_decl, define_decl, create_builtin_decl, gen_declspecs): Remove prototypes. (TYPE_ID): Rename to OBJECT_TYPEDEF_NAME. (CLASS_TYPEDEF_NAME): New. (TAG_EXECCLASS): Change from a global variable to a #define. (TAG_RETURN_STRUCT): Delete. (TAG_GNUINIT): New, holds '__objc_gnu_init' name. (objc_inherit_code, objc_public_flag): New, moved from c-parse.in. (string_descriptor): New struct. (string_htab): New hash table. (string_hash, string_eq): New prototypes. (generate_struct_by_value_array): Call create_field_decl() instead of create_builtin_decl(). (objc_init): Do not initialize objc_ellipsis_node or TAG_EXECCLASS; In ObjC++ mode, call cxx_init() instead of c_objc_common_init(). (objc_finish_file): In ObjC++, call instantiate_pending_templates() and cp_finish_file(). (define_decl, get_static_reference, get_protocol_reference, create_builtin_decl): Remove functions. (objc_start_class_interface, objc_start_category_interface, objc_start_protocol, objc_continue_interface, objc_finish_interface, objc_start_class_implementation, objc_start_category_implementation, objc_continue_implementation, objc_finish_implementation, objc_set_visibility, objc_set_method_type, objc_build_method_signature, objc_add_method_declaration, objc_start_method_definition, objc_add_instance_variable, objc_get_protocol_qualified_type, create_field_decl, start_var_decl, finish_var_decl): New functions. (setup_string_decl): Simplify since it is only called once. (synth_module_prologue): Call build_class_template(); predefine 'id' and 'Class' as typedefs; rename 'temp_type' to 'type'; disable debug hooks for duration of function; fix GNU runtime messenger signatures to correspond to reality; forward-declare '__objc_exec_class' for the GNU runtime; call build_selector_table_decl(); in ObjC++ mode, generate 'extern "C" { ... }' wrappers around synthesized declarations; call build_protocol_template() and build_category_template(). (string_hash, string_eq): New functions. (objc_build_string_object): Check metaclass correctness only once; store string literals in hash table. (objc_build_constructor): Do not convert initializer elements; adjust for ObjC++ impedance mismatch. (build_objc_symtab_template): Call create_field_decl() instead of create_builtin_decl(). (init_objc_symtab): Add missing conversion to initializer element. (build_metadata_decl): Call start_var_decl() instead of define_decl(). (generate_objc_symtab_decl): Do not call build_category_template(); call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(). (build_module_descriptor): Call create_field_decl() instead of grokfield(); call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(); always mark module descriptor as used; move GNU runtime-specific functionality to build_module_initializer_routine(). (build_module_initializer_routine): New function, broken off of build_module_descriptor(). (objc_static_init_needed_p, objc_generate_static_init_call): New functions. (generate_static_references, generate_strings, build_selector_translation_table, generate_descriptor_table, generate_ivars_list, generate_dispatch_table, generate_category): Call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(); build a type directly instead of via groktypename(). (build_selector_reference_decl, build_selector_table_decl, build_class_reference_decl, build_protocol_reference, generate_objc_image_info): Call start_var_decl() instead of build_decl(). (build_selector_reference): For GNU runtime, do not call build_selector_reference_decl(). (build_selector, build_typed_selector_reference): Always convert result to the selector type. (add_objc_string): Cast return value to 'char *'. (build_method_prototype_template, build_selector_template, build_method_template): Use actual selector type for fields pointing to selectors. (finish_objc): For GNU runtime, call build_module_initializer_routine() after build_module_descriptor(). (generate_protocol_list, generate_shared_structures): Call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(); build a type directly instead of via groktypename(). (synth_id_with_class_suffix): Return a string. (get_arg_type_list): For instance methods, use the instance type for 'self'; do not call groktypename_in_parm_context(). (build_objc_string_decl): Squash redeclaration errors in ObjC++. (objc_is_class_name): Use OBJC_TYPE_NAME instead of TYPE_NAME; handle RECORD_TYPEs in ObjC as well as ObjC++. (objc_is_id): New function. (objc_is_object_ptr): Return the canonical type node. (objc_get_class_ivars): Simplify using get_class_ivars(). (get_class_ivars): Remove second parameter; create a fresh copy of the ivar list for each call; do not check for existence of super class. (objc_eh_runtime_type): Mark #ifndef OBJCPLUS. (objc_init_exceptions): When using SJLJ-style exceptions, require the use of '-fobjc-exceptions' flag; do not require it for DWARF-style exceptions. (objc_build_exc_ptr, next_sjlj_build_try_catch_finally): Use objc_object_type instead of objc_id_type. (objc_begin_catch_clause): Convert the incoming PARM_DECL into a VAR_DECL before placing it in the appropriate scope; do not call define_decl(); adjust call to c_begin_compound_stmt(); use objc_object_type instead of objc_id_type. (build_next_objc_exception_stuff): Call create_field_decl() instead of create_builtin_decl(); construct type directly instead of calling groktypename(); use OBJC_VOID_AT_END to mark end of function parameters. (build_private_template): Adjust call to get_class_ivars(); build a type directly instead of via groktypename(). (build_protocol_template, build_method_prototype_list_template, build_method_prototype_template, build_category_template, build_selector_template, build_class_template, build_super_template, build_ivar_template, build_ivar_list_template, build_method_list_template, build_method_template): Call create_field_decl() instead of grokfield(). (objc_method_parm_type): Do not call groktypename(). (generate_descriptor_table): Call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(). (generate_method_descriptors, build_protocol_initializer, generate_dispatch_tables, build_category_initializer, build_shared_structure_initializer): Do not call groktypename(). (generate_protocols): Call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(); do not call groktypename(). (error_with_ivar): Remove last parameter. (check_ivars): Do not iterate ovar CLASS_RAW_IVARS lists in addition to CLASS_IVARS lists; adjust calls to error_with_ivar(). (generate_ivar_lists): Convert one of the initializer elements; do not call groktypename(). (get_arg_type_list, start_method_def, gen_method_def): Account for new representation of variable arguments and '...' in Objective-C methods; add Objective-C++ impedance matching code. (is_objc_type_qualifier): Remove function. (adjust_type_for_id_default): Simplify; there is no longer a need to wade through declspecs. (lookup_interface, start_class, continue_class, finish_class, start_method_def, start_protocol, build_method_decl, objc_add_method, add_instance_variable, build_ivar_reference, is_ivar, is_private, get_super_receiver, objc_build_finally_epilogue): Make into static functions. (receiver_is_class_object): Use new IS_CLASS() macro. (objc_build_message_expr): Tweak ObjC++ message argument handling; call objc_finish_message_expr() instead of finish_message_expr(). (finish_message_expr): Rename to objc_finish_message_expr(); use OBJC_TYPE_NAME and OBJC_SET_TYPE_NAME macros instead of TYPE_NAME. call gen_type_name() instead of gen_declaration(); call objc_is_id() instead of using IS_ID and IS_CLASS; Use objc_class_name instead of calling get_identifier("Class"); handle CONVERT_EXPRs in receiver. (build_objc_method_call, warn_with_method): Do not call groktypename(). (build_ivar_reference): Call convert() instead of clobbering in a type. (hash_init): Initialize string_htab hash table. (add_instance_variable): Simplify parameter list; do not call grokfield(); do not populate CLASS_IVARS list. (start_class): Check for the existence of super class, if one was specified. (continue_class): Use CLASS_RAW_IVARS rather than CLASS_IVARS; do not call build_class_template(); adjust call to get_class_ivars(); call build_decl(), pushdecl() and finish_decl() instead of define_decl(). (finish_class): Call build_decl(), pushdecl() and finish_decl() instead of define_decl(). (add_protocols): Use PROTOCOL_BINFO_ELTS for the tree vector size. (start_protocol): Do not call build_protocol_template(); use PROTOCOL_BINFO_ELTS for the tree vector size. (encode_type_qualifiers): Do not handle the 'const' qualifier here. (encode_pointer): Encode 'const char *' as 'r*', for backwards compatibility. (encode_array): Use HOST_WIDE_INT_PRINT_DEC instead of "%ld". (encode_type): Handle the 'const' qualifier here. (objc_parmlist): New global variable, sued by objc_push_parm and objc_get_parm_info(). (objc_push_parm, objc_get_parm_info): New functions. (objc_expr_last): Remove function. (synth_self_and_ucmd_args): For instance methods, use the instance type for 'self'; call objc_push_parm() instead of push_parm_decl(). (start_method_def): Do not call push_scope(), declare_parm_level(), pop_scope(), push_parm_decl(), store_parm_decls() or objc_expr_last(); just use objc_push_parm() and objc_get_parm_info(). (comp_method_with_proto): Remove function. (objc_types_are_equivalent): Strip away indirections before comparing underlying types. (comp_proto_with_proto): Do not call groktypename(); types are no longer in raw declspec format. (objc_start_function): New function. (really_start_method): Call comp_proto_with_proto() instead of comp_method_with_proto(); call objc_start_function() instead of hand-crafting a function declarator. (continue_method_def, objc_expand_function_end): Remove functions. (get_super_receiver): Call objc_get_current_scope() instead of get_current_scope(); reference 'super_class' field (instead of 'class'). (finish_method_def): Rename to objc_finish_method_definition() and add a function decl parameter; move method encoding call from objc_expand_function_end(). (is_complex_decl, adorn_decl, gen_declarator, gen_declspecs, gen_declaration_1): Remove functions. (tmpbuf, RAW_DECLSPEC): Remove. (gen_declaration): Remove second parameter; simplify to deal with TYPE_P nodes instead of raw declspecs. (gen_type_name, gen_type_name_0): New functions. (gen_method_decl): Remove second parameter; call gen_type_name() instead of gen_declaration_1(). (dump_interface): Adjust calls to gen_declaration() and gen_method_decl(); do not allocate a separate string buffer. (init_objc): Allocate a larger string buffer to accommodate dump_interface(); adjust call to build_module_descriptor(); add call to build_module_initializer_routine() for the GNU runtime. (generate_classref_translation_entry): Do not call start_decl(); call finish_var_decl() instead of finish_decl(); call convert() instead of build_c_cast(). * objc-act.h (CLASS_OWN_IVARS): Remove accessor. (CLASS_BINFO_ELTS): Reduce from 6 to 5, now that CLASS_OWN_IVARS is gone. (OCTI_GNU_INIT_DECL, GNU_INIT_decl): New. (OCTI_ELLIPSIS_NODE, objc_ellipsis_node): Remove. (OCTI_ID_ID, id_type, objc_id_id): Rename to OCTI_ID_NAME, objc_object_type and objc_object_name, respectively. (OCTI_CLS_REF, OCTI_CLASS_NAME, objc_class_reference, objc_class_name): New. (IS_CLASS): New macro. (IS_ID, IS_SUPER): Robustify. (OCTI_EXECCLASS_DECL, execclass_decl): New. (finish_file, start_class, continue_class, finish_class, start_method_def, continue_method_def, finish_method_def, start_protocol, finish_protocol, objc_build_throw_stmt, objc_build_try_catch_finally_stmt, objc_build_synchronized_prologue, objc_build_synchronized_epilogue, objc_build_try_prologue, objc_build_try_epilogue, objc_build_catch_stmt, objc_build_catch_epilogue, objc_build_finally_prologue, objc_build_finally_epilogue, is_ivar, is_private, is_public, add_instance_variable, objc_add_method, get_super_receiver, objc_clear_super_receiver, get_class_ivars_from_name, get_class_reference, get_static_reference, get_object_reference, build_message_expr, finish_message_expr, build_selector_expr, build_ivar_reference, build_keyword_decl, build_method_decl, build_protocol_expr, build_objc_string_object, objc_declare_alias, objc_declare_class, objc_declare_protocols, objc_comptypes, objc_check_decl, build_encode_expr): Remove prototypes. (imp_count, cat_count): Make GGC-aware. (OBJC_SET_TYPE_NAME): New macro. From-SVN: r87168
2004-09-08 02:49:44 +02:00
field_decl = create_field_decl (string_type_node, "class_name");
1992-01-18 00:15:38 +01:00
chainon (field_decl_chain, field_decl);
Makefile.in (c-parse.o): Depend on $(C_COMMON_H). [gcc/ChangeLog] 2004-09-07 Ziemowit Laski <zlaski@apple.com> * Makefile.in (c-parse.o): Depend on $(C_COMMON_H). * c-parse.in: Include c-common.h instead of objc-act.h. (ivar_decl_list, ivar_decls, ivar_decl, ivars, ivar_declarator, myparms, myparm): Remove %type declarations. (methodtype, optparms, OBJC_TYPE_QUAL, objc_quals, objc_qual, objc_typename, objc_try_catch_stmt, optellipsis): Add %type declarations. (objc_inherit_code, objc_public_flag): Remove. (typespec_nonreserved_nonattr): Call objc_get_protocol_qualified_type() instead of get_static_reference() and get_protocol_reference(). (stmt_nocomp): Call grokparm() on @catch parameter. (objcdef): Move semantic action to objc_finish_implementation(). (classdef): Move semantic action to objc_start_class_interface(), objc_continue_interface(), objc_finish_interface(), objc_start_class_implementation(), objc_continue_implementation(), objc_start_category_interface() and objc_start_category_implementation(). (protocoldef): Move semantic actions to objc_start_protocol() and objc_finish_interface(). (ivar_decl_list): Remove nonterminal. (visibility_spec): Move semantic actions to objc_set_visibility(). (ivar_decls): Remove assignment to $$. (ivar_decl): Rephrase in terms of component_decl; call objc_add_instance_variable(). (ivars, ivar_declarator): Remove nonterminals. (opt_semi): New nonterminal. (methodtype): Remove semantic actions. (methoddef): Move semantic actions to objc_set_method_type(), objc_start_method_definition() and objc_finish_method_definition(). (methodproto): Move semantic actions to objc_set_method_type() and objc_add_method_declaration(). (methoddecl): Use objc_typename instead of typename; move semantic actions to objc_build_method_signature(). (optarglist, myxdecls, mydecl, myparms, myparm): Remove nonterminals. (optparmlist): Express in terms of optparms and optellipsis. (optparms, optellipsis, objc_qual, objc_quals, objc_typename): New nonterminals. (keyworddecl): Use objc_typename instead of typename. (rid_to_yy): Mark RID_IN, RID_OUT, RID_INOUT, RID_BYCOPY, RID_BYREF and RID_ONEWAY as returning OBJC_TYPE_QUAL to yyparse(). [gcc/objc/ChangeLog] 2004-09-07 Ziemowit Laski <zlaski@apple.com> * Make-lang.in (objc/objc-parse.o): Depend on $(C_COMMON_H) instead of objc/objc-act.h. (objc/objc-act.o): Depend on $(HASHTAB_H). * objc-act.c: Include hashtab.h; in ObjC++ mode, include cp-tree.h and objcp-decl.h instead of c-tree.h. (build_module_descriptor, get_class_ivars, synth_id_with_class_suffix, error_with_ivar, gen_method_decl, gen_declaration, setup_string_decl, build_protocol_template): Adjust prototypes. (build_module_initializer_routine, start_class, continue_class, finish_class, start_method_def, objc_start_function, start_protocol, build_method_decl, objc_add_method, add_instance_variable, build_ivar_reference, is_ivar, is_private, get_super_receiver, build_selector_table_decl, objc_push_parm, objc_get_parm_info, gen_type_name, gen_type_name_0, start_var_decl, finish_var_decl, create_field_decl): New prototypes. (objc_expand_function_end, comp_method_with_proto, objc_expr_last, gen_declaration_1, gen_declarator, is_complex_decl, adorn_decl, define_decl, create_builtin_decl, gen_declspecs): Remove prototypes. (TYPE_ID): Rename to OBJECT_TYPEDEF_NAME. (CLASS_TYPEDEF_NAME): New. (TAG_EXECCLASS): Change from a global variable to a #define. (TAG_RETURN_STRUCT): Delete. (TAG_GNUINIT): New, holds '__objc_gnu_init' name. (objc_inherit_code, objc_public_flag): New, moved from c-parse.in. (string_descriptor): New struct. (string_htab): New hash table. (string_hash, string_eq): New prototypes. (generate_struct_by_value_array): Call create_field_decl() instead of create_builtin_decl(). (objc_init): Do not initialize objc_ellipsis_node or TAG_EXECCLASS; In ObjC++ mode, call cxx_init() instead of c_objc_common_init(). (objc_finish_file): In ObjC++, call instantiate_pending_templates() and cp_finish_file(). (define_decl, get_static_reference, get_protocol_reference, create_builtin_decl): Remove functions. (objc_start_class_interface, objc_start_category_interface, objc_start_protocol, objc_continue_interface, objc_finish_interface, objc_start_class_implementation, objc_start_category_implementation, objc_continue_implementation, objc_finish_implementation, objc_set_visibility, objc_set_method_type, objc_build_method_signature, objc_add_method_declaration, objc_start_method_definition, objc_add_instance_variable, objc_get_protocol_qualified_type, create_field_decl, start_var_decl, finish_var_decl): New functions. (setup_string_decl): Simplify since it is only called once. (synth_module_prologue): Call build_class_template(); predefine 'id' and 'Class' as typedefs; rename 'temp_type' to 'type'; disable debug hooks for duration of function; fix GNU runtime messenger signatures to correspond to reality; forward-declare '__objc_exec_class' for the GNU runtime; call build_selector_table_decl(); in ObjC++ mode, generate 'extern "C" { ... }' wrappers around synthesized declarations; call build_protocol_template() and build_category_template(). (string_hash, string_eq): New functions. (objc_build_string_object): Check metaclass correctness only once; store string literals in hash table. (objc_build_constructor): Do not convert initializer elements; adjust for ObjC++ impedance mismatch. (build_objc_symtab_template): Call create_field_decl() instead of create_builtin_decl(). (init_objc_symtab): Add missing conversion to initializer element. (build_metadata_decl): Call start_var_decl() instead of define_decl(). (generate_objc_symtab_decl): Do not call build_category_template(); call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(). (build_module_descriptor): Call create_field_decl() instead of grokfield(); call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(); always mark module descriptor as used; move GNU runtime-specific functionality to build_module_initializer_routine(). (build_module_initializer_routine): New function, broken off of build_module_descriptor(). (objc_static_init_needed_p, objc_generate_static_init_call): New functions. (generate_static_references, generate_strings, build_selector_translation_table, generate_descriptor_table, generate_ivars_list, generate_dispatch_table, generate_category): Call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(); build a type directly instead of via groktypename(). (build_selector_reference_decl, build_selector_table_decl, build_class_reference_decl, build_protocol_reference, generate_objc_image_info): Call start_var_decl() instead of build_decl(). (build_selector_reference): For GNU runtime, do not call build_selector_reference_decl(). (build_selector, build_typed_selector_reference): Always convert result to the selector type. (add_objc_string): Cast return value to 'char *'. (build_method_prototype_template, build_selector_template, build_method_template): Use actual selector type for fields pointing to selectors. (finish_objc): For GNU runtime, call build_module_initializer_routine() after build_module_descriptor(). (generate_protocol_list, generate_shared_structures): Call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(); build a type directly instead of via groktypename(). (synth_id_with_class_suffix): Return a string. (get_arg_type_list): For instance methods, use the instance type for 'self'; do not call groktypename_in_parm_context(). (build_objc_string_decl): Squash redeclaration errors in ObjC++. (objc_is_class_name): Use OBJC_TYPE_NAME instead of TYPE_NAME; handle RECORD_TYPEs in ObjC as well as ObjC++. (objc_is_id): New function. (objc_is_object_ptr): Return the canonical type node. (objc_get_class_ivars): Simplify using get_class_ivars(). (get_class_ivars): Remove second parameter; create a fresh copy of the ivar list for each call; do not check for existence of super class. (objc_eh_runtime_type): Mark #ifndef OBJCPLUS. (objc_init_exceptions): When using SJLJ-style exceptions, require the use of '-fobjc-exceptions' flag; do not require it for DWARF-style exceptions. (objc_build_exc_ptr, next_sjlj_build_try_catch_finally): Use objc_object_type instead of objc_id_type. (objc_begin_catch_clause): Convert the incoming PARM_DECL into a VAR_DECL before placing it in the appropriate scope; do not call define_decl(); adjust call to c_begin_compound_stmt(); use objc_object_type instead of objc_id_type. (build_next_objc_exception_stuff): Call create_field_decl() instead of create_builtin_decl(); construct type directly instead of calling groktypename(); use OBJC_VOID_AT_END to mark end of function parameters. (build_private_template): Adjust call to get_class_ivars(); build a type directly instead of via groktypename(). (build_protocol_template, build_method_prototype_list_template, build_method_prototype_template, build_category_template, build_selector_template, build_class_template, build_super_template, build_ivar_template, build_ivar_list_template, build_method_list_template, build_method_template): Call create_field_decl() instead of grokfield(). (objc_method_parm_type): Do not call groktypename(). (generate_descriptor_table): Call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(). (generate_method_descriptors, build_protocol_initializer, generate_dispatch_tables, build_category_initializer, build_shared_structure_initializer): Do not call groktypename(). (generate_protocols): Call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(); do not call groktypename(). (error_with_ivar): Remove last parameter. (check_ivars): Do not iterate ovar CLASS_RAW_IVARS lists in addition to CLASS_IVARS lists; adjust calls to error_with_ivar(). (generate_ivar_lists): Convert one of the initializer elements; do not call groktypename(). (get_arg_type_list, start_method_def, gen_method_def): Account for new representation of variable arguments and '...' in Objective-C methods; add Objective-C++ impedance matching code. (is_objc_type_qualifier): Remove function. (adjust_type_for_id_default): Simplify; there is no longer a need to wade through declspecs. (lookup_interface, start_class, continue_class, finish_class, start_method_def, start_protocol, build_method_decl, objc_add_method, add_instance_variable, build_ivar_reference, is_ivar, is_private, get_super_receiver, objc_build_finally_epilogue): Make into static functions. (receiver_is_class_object): Use new IS_CLASS() macro. (objc_build_message_expr): Tweak ObjC++ message argument handling; call objc_finish_message_expr() instead of finish_message_expr(). (finish_message_expr): Rename to objc_finish_message_expr(); use OBJC_TYPE_NAME and OBJC_SET_TYPE_NAME macros instead of TYPE_NAME. call gen_type_name() instead of gen_declaration(); call objc_is_id() instead of using IS_ID and IS_CLASS; Use objc_class_name instead of calling get_identifier("Class"); handle CONVERT_EXPRs in receiver. (build_objc_method_call, warn_with_method): Do not call groktypename(). (build_ivar_reference): Call convert() instead of clobbering in a type. (hash_init): Initialize string_htab hash table. (add_instance_variable): Simplify parameter list; do not call grokfield(); do not populate CLASS_IVARS list. (start_class): Check for the existence of super class, if one was specified. (continue_class): Use CLASS_RAW_IVARS rather than CLASS_IVARS; do not call build_class_template(); adjust call to get_class_ivars(); call build_decl(), pushdecl() and finish_decl() instead of define_decl(). (finish_class): Call build_decl(), pushdecl() and finish_decl() instead of define_decl(). (add_protocols): Use PROTOCOL_BINFO_ELTS for the tree vector size. (start_protocol): Do not call build_protocol_template(); use PROTOCOL_BINFO_ELTS for the tree vector size. (encode_type_qualifiers): Do not handle the 'const' qualifier here. (encode_pointer): Encode 'const char *' as 'r*', for backwards compatibility. (encode_array): Use HOST_WIDE_INT_PRINT_DEC instead of "%ld". (encode_type): Handle the 'const' qualifier here. (objc_parmlist): New global variable, sued by objc_push_parm and objc_get_parm_info(). (objc_push_parm, objc_get_parm_info): New functions. (objc_expr_last): Remove function. (synth_self_and_ucmd_args): For instance methods, use the instance type for 'self'; call objc_push_parm() instead of push_parm_decl(). (start_method_def): Do not call push_scope(), declare_parm_level(), pop_scope(), push_parm_decl(), store_parm_decls() or objc_expr_last(); just use objc_push_parm() and objc_get_parm_info(). (comp_method_with_proto): Remove function. (objc_types_are_equivalent): Strip away indirections before comparing underlying types. (comp_proto_with_proto): Do not call groktypename(); types are no longer in raw declspec format. (objc_start_function): New function. (really_start_method): Call comp_proto_with_proto() instead of comp_method_with_proto(); call objc_start_function() instead of hand-crafting a function declarator. (continue_method_def, objc_expand_function_end): Remove functions. (get_super_receiver): Call objc_get_current_scope() instead of get_current_scope(); reference 'super_class' field (instead of 'class'). (finish_method_def): Rename to objc_finish_method_definition() and add a function decl parameter; move method encoding call from objc_expand_function_end(). (is_complex_decl, adorn_decl, gen_declarator, gen_declspecs, gen_declaration_1): Remove functions. (tmpbuf, RAW_DECLSPEC): Remove. (gen_declaration): Remove second parameter; simplify to deal with TYPE_P nodes instead of raw declspecs. (gen_type_name, gen_type_name_0): New functions. (gen_method_decl): Remove second parameter; call gen_type_name() instead of gen_declaration_1(). (dump_interface): Adjust calls to gen_declaration() and gen_method_decl(); do not allocate a separate string buffer. (init_objc): Allocate a larger string buffer to accommodate dump_interface(); adjust call to build_module_descriptor(); add call to build_module_initializer_routine() for the GNU runtime. (generate_classref_translation_entry): Do not call start_decl(); call finish_var_decl() instead of finish_decl(); call convert() instead of build_c_cast(). * objc-act.h (CLASS_OWN_IVARS): Remove accessor. (CLASS_BINFO_ELTS): Reduce from 6 to 5, now that CLASS_OWN_IVARS is gone. (OCTI_GNU_INIT_DECL, GNU_INIT_decl): New. (OCTI_ELLIPSIS_NODE, objc_ellipsis_node): Remove. (OCTI_ID_ID, id_type, objc_id_id): Rename to OCTI_ID_NAME, objc_object_type and objc_object_name, respectively. (OCTI_CLS_REF, OCTI_CLASS_NAME, objc_class_reference, objc_class_name): New. (IS_CLASS): New macro. (IS_ID, IS_SUPER): Robustify. (OCTI_EXECCLASS_DECL, execclass_decl): New. (finish_file, start_class, continue_class, finish_class, start_method_def, continue_method_def, finish_method_def, start_protocol, finish_protocol, objc_build_throw_stmt, objc_build_try_catch_finally_stmt, objc_build_synchronized_prologue, objc_build_synchronized_epilogue, objc_build_try_prologue, objc_build_try_epilogue, objc_build_catch_stmt, objc_build_catch_epilogue, objc_build_finally_prologue, objc_build_finally_epilogue, is_ivar, is_private, is_public, add_instance_variable, objc_add_method, get_super_receiver, objc_clear_super_receiver, get_class_ivars_from_name, get_class_reference, get_static_reference, get_object_reference, build_message_expr, finish_message_expr, build_selector_expr, build_ivar_reference, build_keyword_decl, build_method_decl, build_protocol_expr, build_objc_string_object, objc_declare_alias, objc_declare_class, objc_declare_protocols, objc_comptypes, objc_check_decl, build_encode_expr): Remove prototypes. (imp_count, cat_count): Make GGC-aware. (OBJC_SET_TYPE_NAME): New macro. From-SVN: r87168
2004-09-08 02:49:44 +02:00
/* struct _objc_method_list *instance_methods; */
Yet more Objective-C++... * objc-act.c (objc_finish_try_stmt): Add return value. (objc_build_synchronized): Likewise. * objc-act.c (objc_is_gcable_type): Add. (objc_substitute_decl): Add. (objc_build_ivar_assignment): Add. (objc_build_global_assignment): Add. (objc_build_strong_cast_assignment): Add. (objc_is_ivar_reference_p): Add. (objc_is_global_reference_p): Add. (objc_generate_write_barrier): Add. (objc_rewrite_function_call): Add. (objc_gimplify_expr): Add Objective-C++ support. * objc-act.h (ALLOC_OBJC_TYPE_LANG_SPECIFIC): Likewise. (SIZEOF_OBJC_TYPE_LANG_SPECIFIC): Add. (INIT_TYPE_OBJC_INFO): Add Objective-C++ support. (DUP_TYPE_OBJC_INFO): Likewise. (struct imp_entry): Add field has_cxx_cdtors. (struct imp_entry *imp_list): Add OCTI_UMSG_FAST_DECL, OCTI_METH_LIST_TEMPL, OCTI_METH_PROTO_LIST_TEMPL, OCTI_IVAR_LIST_TEMPL, OCTI_ASSIGN_IVAR_DECL, OCTI_ASSIGN_IVAR_FAST_DECL, OCTI_ASSIGN_GLOBAL_DECL, OCTI_ASSIGN_STRONGCAST_DECL. (umsg_fast_decl): Add. (objc_assign_ivar_decl): Add. (objc_assign_ivar_fast_decl): Add. (objc_assign_global_decl): Add. (objc_assign_strong_cast_decl): Add. (objc_method_list_ptr): Add. (objc_method_proto_list_ptr): Add. (objc_ivar_list_ptr): Add. * objc-act.c (should_call_super_dealloc): Add. (OBJC_VERSION): Bump to 6. (objc_is_gcable_type): Add. (objc_substitute_decl): Add. (objc_build_ivar_assignment): Add. (objc_build_global_assignment): Add. (objc_build_strong_cast_assignment): Add. (objc_is_gcable_p): Add. (objc_is_ivar_reference_p): Add. (objc_is_global_reference_p): Add. (generate_shared_structures): Add flags parameter. (objc_generate_cxx_ctor_or_dtor): Add. (objc_generate_cxx_cdtors): Add. (add_class): Add name parameter. (objc_types_share_size_and_alignment): Add. (comp_proto_with_proto): Add strict parameter. (CLS_HAS_CXX_STRUCTORS): Add. (TAG_ASSIGNIVAR): Add. (TAG_ASSIGNGLOBAL): Add. (TAG_ASSIGNSTRONGCAST): Add. (TAG_MSGSEND_FAST): Add. (TAG_ASSIGNIVAR_FAST): Add. (TAG_CXX_CONSTRUCT): Add. (TAG_CXX_DESTRUCT): Add. (OBJC_LOOKUP_CLASS): Add. (OBJC_LOOKUP_NO_SUPER): Add. (objc_finish_file): Add pch support. (objc_finish_implementation): Add Objective-C++ support. (synth_module_prologue): Likewise. (synth_module_prologue): Add fast dispatching. (objc_get_class_reference): Add Objective-C++ support. (objc_generate_write_barrier): Likewise. (next_sjlj_build_enter_and_setjmp): Likewise. (objc_begin_try_stmt): Likewise. (build_next_objc_exception_stuff): Add fast ivar support. (build_private_template): Mark the record as used so debug information is generated. (build_protocol_template): Add Objective-C++ support. (objc_method_parm_type) Likewise. (objc_generate_cxx_ctor_or_dtor): Likewise. (objc_generate_cxx_cdtors): Likewise. (build_protocol_initializer): Likewise. (build_category_template): Likewise. (build_class_template): Likewise. (build_method_list_template): Likewise. (build_category_initializer): Likewise. (build_shared_structure_initializer): Likewise. (objc_finish_message_expr): Likewise. (build_objc_method_call): Add fast dispatch support. (lookup_method_static): Add support to end search at superclasses. (add_method_to_hash_list): Add strict parameter to comp_proto_with_proto. (objc_add_method): Likewise. (objc_add_method): Also set the interface_value. (add_instance_variable): Add Objective-C++ support. (objc_is_public): Likewise. (start_class): Likewise. (continue_class): Likewise. (encode_aggregate_within): Likewise. (start_method_def): Likewise. (objc_start_function): Clear current_function_returns_value and current_function_returns_null. (really_start_method): Add Objective-C++ support. (objc_finish_method_definition): Add warning for missing [super dealloc]. (finish_objc): Add Objective-C++ support. (generate_objc_image_info): Likewise. (objc_lookup_ivar): Likewise. * objc-act.h (TYPE_HAS_OBJC_INFO): Likewise. (INIT_TYPE_OBJC_INFO): Likewise. (DUP_TYPE_OBJC_INFO): Likewise. From-SVN: r99857
2005-05-17 22:07:08 +02:00
field_decl = create_field_decl (objc_method_list_ptr,
Makefile.in (c-parse.o): Depend on $(C_COMMON_H). [gcc/ChangeLog] 2004-09-07 Ziemowit Laski <zlaski@apple.com> * Makefile.in (c-parse.o): Depend on $(C_COMMON_H). * c-parse.in: Include c-common.h instead of objc-act.h. (ivar_decl_list, ivar_decls, ivar_decl, ivars, ivar_declarator, myparms, myparm): Remove %type declarations. (methodtype, optparms, OBJC_TYPE_QUAL, objc_quals, objc_qual, objc_typename, objc_try_catch_stmt, optellipsis): Add %type declarations. (objc_inherit_code, objc_public_flag): Remove. (typespec_nonreserved_nonattr): Call objc_get_protocol_qualified_type() instead of get_static_reference() and get_protocol_reference(). (stmt_nocomp): Call grokparm() on @catch parameter. (objcdef): Move semantic action to objc_finish_implementation(). (classdef): Move semantic action to objc_start_class_interface(), objc_continue_interface(), objc_finish_interface(), objc_start_class_implementation(), objc_continue_implementation(), objc_start_category_interface() and objc_start_category_implementation(). (protocoldef): Move semantic actions to objc_start_protocol() and objc_finish_interface(). (ivar_decl_list): Remove nonterminal. (visibility_spec): Move semantic actions to objc_set_visibility(). (ivar_decls): Remove assignment to $$. (ivar_decl): Rephrase in terms of component_decl; call objc_add_instance_variable(). (ivars, ivar_declarator): Remove nonterminals. (opt_semi): New nonterminal. (methodtype): Remove semantic actions. (methoddef): Move semantic actions to objc_set_method_type(), objc_start_method_definition() and objc_finish_method_definition(). (methodproto): Move semantic actions to objc_set_method_type() and objc_add_method_declaration(). (methoddecl): Use objc_typename instead of typename; move semantic actions to objc_build_method_signature(). (optarglist, myxdecls, mydecl, myparms, myparm): Remove nonterminals. (optparmlist): Express in terms of optparms and optellipsis. (optparms, optellipsis, objc_qual, objc_quals, objc_typename): New nonterminals. (keyworddecl): Use objc_typename instead of typename. (rid_to_yy): Mark RID_IN, RID_OUT, RID_INOUT, RID_BYCOPY, RID_BYREF and RID_ONEWAY as returning OBJC_TYPE_QUAL to yyparse(). [gcc/objc/ChangeLog] 2004-09-07 Ziemowit Laski <zlaski@apple.com> * Make-lang.in (objc/objc-parse.o): Depend on $(C_COMMON_H) instead of objc/objc-act.h. (objc/objc-act.o): Depend on $(HASHTAB_H). * objc-act.c: Include hashtab.h; in ObjC++ mode, include cp-tree.h and objcp-decl.h instead of c-tree.h. (build_module_descriptor, get_class_ivars, synth_id_with_class_suffix, error_with_ivar, gen_method_decl, gen_declaration, setup_string_decl, build_protocol_template): Adjust prototypes. (build_module_initializer_routine, start_class, continue_class, finish_class, start_method_def, objc_start_function, start_protocol, build_method_decl, objc_add_method, add_instance_variable, build_ivar_reference, is_ivar, is_private, get_super_receiver, build_selector_table_decl, objc_push_parm, objc_get_parm_info, gen_type_name, gen_type_name_0, start_var_decl, finish_var_decl, create_field_decl): New prototypes. (objc_expand_function_end, comp_method_with_proto, objc_expr_last, gen_declaration_1, gen_declarator, is_complex_decl, adorn_decl, define_decl, create_builtin_decl, gen_declspecs): Remove prototypes. (TYPE_ID): Rename to OBJECT_TYPEDEF_NAME. (CLASS_TYPEDEF_NAME): New. (TAG_EXECCLASS): Change from a global variable to a #define. (TAG_RETURN_STRUCT): Delete. (TAG_GNUINIT): New, holds '__objc_gnu_init' name. (objc_inherit_code, objc_public_flag): New, moved from c-parse.in. (string_descriptor): New struct. (string_htab): New hash table. (string_hash, string_eq): New prototypes. (generate_struct_by_value_array): Call create_field_decl() instead of create_builtin_decl(). (objc_init): Do not initialize objc_ellipsis_node or TAG_EXECCLASS; In ObjC++ mode, call cxx_init() instead of c_objc_common_init(). (objc_finish_file): In ObjC++, call instantiate_pending_templates() and cp_finish_file(). (define_decl, get_static_reference, get_protocol_reference, create_builtin_decl): Remove functions. (objc_start_class_interface, objc_start_category_interface, objc_start_protocol, objc_continue_interface, objc_finish_interface, objc_start_class_implementation, objc_start_category_implementation, objc_continue_implementation, objc_finish_implementation, objc_set_visibility, objc_set_method_type, objc_build_method_signature, objc_add_method_declaration, objc_start_method_definition, objc_add_instance_variable, objc_get_protocol_qualified_type, create_field_decl, start_var_decl, finish_var_decl): New functions. (setup_string_decl): Simplify since it is only called once. (synth_module_prologue): Call build_class_template(); predefine 'id' and 'Class' as typedefs; rename 'temp_type' to 'type'; disable debug hooks for duration of function; fix GNU runtime messenger signatures to correspond to reality; forward-declare '__objc_exec_class' for the GNU runtime; call build_selector_table_decl(); in ObjC++ mode, generate 'extern "C" { ... }' wrappers around synthesized declarations; call build_protocol_template() and build_category_template(). (string_hash, string_eq): New functions. (objc_build_string_object): Check metaclass correctness only once; store string literals in hash table. (objc_build_constructor): Do not convert initializer elements; adjust for ObjC++ impedance mismatch. (build_objc_symtab_template): Call create_field_decl() instead of create_builtin_decl(). (init_objc_symtab): Add missing conversion to initializer element. (build_metadata_decl): Call start_var_decl() instead of define_decl(). (generate_objc_symtab_decl): Do not call build_category_template(); call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(). (build_module_descriptor): Call create_field_decl() instead of grokfield(); call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(); always mark module descriptor as used; move GNU runtime-specific functionality to build_module_initializer_routine(). (build_module_initializer_routine): New function, broken off of build_module_descriptor(). (objc_static_init_needed_p, objc_generate_static_init_call): New functions. (generate_static_references, generate_strings, build_selector_translation_table, generate_descriptor_table, generate_ivars_list, generate_dispatch_table, generate_category): Call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(); build a type directly instead of via groktypename(). (build_selector_reference_decl, build_selector_table_decl, build_class_reference_decl, build_protocol_reference, generate_objc_image_info): Call start_var_decl() instead of build_decl(). (build_selector_reference): For GNU runtime, do not call build_selector_reference_decl(). (build_selector, build_typed_selector_reference): Always convert result to the selector type. (add_objc_string): Cast return value to 'char *'. (build_method_prototype_template, build_selector_template, build_method_template): Use actual selector type for fields pointing to selectors. (finish_objc): For GNU runtime, call build_module_initializer_routine() after build_module_descriptor(). (generate_protocol_list, generate_shared_structures): Call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(); build a type directly instead of via groktypename(). (synth_id_with_class_suffix): Return a string. (get_arg_type_list): For instance methods, use the instance type for 'self'; do not call groktypename_in_parm_context(). (build_objc_string_decl): Squash redeclaration errors in ObjC++. (objc_is_class_name): Use OBJC_TYPE_NAME instead of TYPE_NAME; handle RECORD_TYPEs in ObjC as well as ObjC++. (objc_is_id): New function. (objc_is_object_ptr): Return the canonical type node. (objc_get_class_ivars): Simplify using get_class_ivars(). (get_class_ivars): Remove second parameter; create a fresh copy of the ivar list for each call; do not check for existence of super class. (objc_eh_runtime_type): Mark #ifndef OBJCPLUS. (objc_init_exceptions): When using SJLJ-style exceptions, require the use of '-fobjc-exceptions' flag; do not require it for DWARF-style exceptions. (objc_build_exc_ptr, next_sjlj_build_try_catch_finally): Use objc_object_type instead of objc_id_type. (objc_begin_catch_clause): Convert the incoming PARM_DECL into a VAR_DECL before placing it in the appropriate scope; do not call define_decl(); adjust call to c_begin_compound_stmt(); use objc_object_type instead of objc_id_type. (build_next_objc_exception_stuff): Call create_field_decl() instead of create_builtin_decl(); construct type directly instead of calling groktypename(); use OBJC_VOID_AT_END to mark end of function parameters. (build_private_template): Adjust call to get_class_ivars(); build a type directly instead of via groktypename(). (build_protocol_template, build_method_prototype_list_template, build_method_prototype_template, build_category_template, build_selector_template, build_class_template, build_super_template, build_ivar_template, build_ivar_list_template, build_method_list_template, build_method_template): Call create_field_decl() instead of grokfield(). (objc_method_parm_type): Do not call groktypename(). (generate_descriptor_table): Call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(). (generate_method_descriptors, build_protocol_initializer, generate_dispatch_tables, build_category_initializer, build_shared_structure_initializer): Do not call groktypename(). (generate_protocols): Call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(); do not call groktypename(). (error_with_ivar): Remove last parameter. (check_ivars): Do not iterate ovar CLASS_RAW_IVARS lists in addition to CLASS_IVARS lists; adjust calls to error_with_ivar(). (generate_ivar_lists): Convert one of the initializer elements; do not call groktypename(). (get_arg_type_list, start_method_def, gen_method_def): Account for new representation of variable arguments and '...' in Objective-C methods; add Objective-C++ impedance matching code. (is_objc_type_qualifier): Remove function. (adjust_type_for_id_default): Simplify; there is no longer a need to wade through declspecs. (lookup_interface, start_class, continue_class, finish_class, start_method_def, start_protocol, build_method_decl, objc_add_method, add_instance_variable, build_ivar_reference, is_ivar, is_private, get_super_receiver, objc_build_finally_epilogue): Make into static functions. (receiver_is_class_object): Use new IS_CLASS() macro. (objc_build_message_expr): Tweak ObjC++ message argument handling; call objc_finish_message_expr() instead of finish_message_expr(). (finish_message_expr): Rename to objc_finish_message_expr(); use OBJC_TYPE_NAME and OBJC_SET_TYPE_NAME macros instead of TYPE_NAME. call gen_type_name() instead of gen_declaration(); call objc_is_id() instead of using IS_ID and IS_CLASS; Use objc_class_name instead of calling get_identifier("Class"); handle CONVERT_EXPRs in receiver. (build_objc_method_call, warn_with_method): Do not call groktypename(). (build_ivar_reference): Call convert() instead of clobbering in a type. (hash_init): Initialize string_htab hash table. (add_instance_variable): Simplify parameter list; do not call grokfield(); do not populate CLASS_IVARS list. (start_class): Check for the existence of super class, if one was specified. (continue_class): Use CLASS_RAW_IVARS rather than CLASS_IVARS; do not call build_class_template(); adjust call to get_class_ivars(); call build_decl(), pushdecl() and finish_decl() instead of define_decl(). (finish_class): Call build_decl(), pushdecl() and finish_decl() instead of define_decl(). (add_protocols): Use PROTOCOL_BINFO_ELTS for the tree vector size. (start_protocol): Do not call build_protocol_template(); use PROTOCOL_BINFO_ELTS for the tree vector size. (encode_type_qualifiers): Do not handle the 'const' qualifier here. (encode_pointer): Encode 'const char *' as 'r*', for backwards compatibility. (encode_array): Use HOST_WIDE_INT_PRINT_DEC instead of "%ld". (encode_type): Handle the 'const' qualifier here. (objc_parmlist): New global variable, sued by objc_push_parm and objc_get_parm_info(). (objc_push_parm, objc_get_parm_info): New functions. (objc_expr_last): Remove function. (synth_self_and_ucmd_args): For instance methods, use the instance type for 'self'; call objc_push_parm() instead of push_parm_decl(). (start_method_def): Do not call push_scope(), declare_parm_level(), pop_scope(), push_parm_decl(), store_parm_decls() or objc_expr_last(); just use objc_push_parm() and objc_get_parm_info(). (comp_method_with_proto): Remove function. (objc_types_are_equivalent): Strip away indirections before comparing underlying types. (comp_proto_with_proto): Do not call groktypename(); types are no longer in raw declspec format. (objc_start_function): New function. (really_start_method): Call comp_proto_with_proto() instead of comp_method_with_proto(); call objc_start_function() instead of hand-crafting a function declarator. (continue_method_def, objc_expand_function_end): Remove functions. (get_super_receiver): Call objc_get_current_scope() instead of get_current_scope(); reference 'super_class' field (instead of 'class'). (finish_method_def): Rename to objc_finish_method_definition() and add a function decl parameter; move method encoding call from objc_expand_function_end(). (is_complex_decl, adorn_decl, gen_declarator, gen_declspecs, gen_declaration_1): Remove functions. (tmpbuf, RAW_DECLSPEC): Remove. (gen_declaration): Remove second parameter; simplify to deal with TYPE_P nodes instead of raw declspecs. (gen_type_name, gen_type_name_0): New functions. (gen_method_decl): Remove second parameter; call gen_type_name() instead of gen_declaration_1(). (dump_interface): Adjust calls to gen_declaration() and gen_method_decl(); do not allocate a separate string buffer. (init_objc): Allocate a larger string buffer to accommodate dump_interface(); adjust call to build_module_descriptor(); add call to build_module_initializer_routine() for the GNU runtime. (generate_classref_translation_entry): Do not call start_decl(); call finish_var_decl() instead of finish_decl(); call convert() instead of build_c_cast(). * objc-act.h (CLASS_OWN_IVARS): Remove accessor. (CLASS_BINFO_ELTS): Reduce from 6 to 5, now that CLASS_OWN_IVARS is gone. (OCTI_GNU_INIT_DECL, GNU_INIT_decl): New. (OCTI_ELLIPSIS_NODE, objc_ellipsis_node): Remove. (OCTI_ID_ID, id_type, objc_id_id): Rename to OCTI_ID_NAME, objc_object_type and objc_object_name, respectively. (OCTI_CLS_REF, OCTI_CLASS_NAME, objc_class_reference, objc_class_name): New. (IS_CLASS): New macro. (IS_ID, IS_SUPER): Robustify. (OCTI_EXECCLASS_DECL, execclass_decl): New. (finish_file, start_class, continue_class, finish_class, start_method_def, continue_method_def, finish_method_def, start_protocol, finish_protocol, objc_build_throw_stmt, objc_build_try_catch_finally_stmt, objc_build_synchronized_prologue, objc_build_synchronized_epilogue, objc_build_try_prologue, objc_build_try_epilogue, objc_build_catch_stmt, objc_build_catch_epilogue, objc_build_finally_prologue, objc_build_finally_epilogue, is_ivar, is_private, is_public, add_instance_variable, objc_add_method, get_super_receiver, objc_clear_super_receiver, get_class_ivars_from_name, get_class_reference, get_static_reference, get_object_reference, build_message_expr, finish_message_expr, build_selector_expr, build_ivar_reference, build_keyword_decl, build_method_decl, build_protocol_expr, build_objc_string_object, objc_declare_alias, objc_declare_class, objc_declare_protocols, objc_comptypes, objc_check_decl, build_encode_expr): Remove prototypes. (imp_count, cat_count): Make GGC-aware. (OBJC_SET_TYPE_NAME): New macro. From-SVN: r87168
2004-09-08 02:49:44 +02:00
"instance_methods");
1992-01-18 00:15:38 +01:00
chainon (field_decl_chain, field_decl);
Makefile.in (c-parse.o): Depend on $(C_COMMON_H). [gcc/ChangeLog] 2004-09-07 Ziemowit Laski <zlaski@apple.com> * Makefile.in (c-parse.o): Depend on $(C_COMMON_H). * c-parse.in: Include c-common.h instead of objc-act.h. (ivar_decl_list, ivar_decls, ivar_decl, ivars, ivar_declarator, myparms, myparm): Remove %type declarations. (methodtype, optparms, OBJC_TYPE_QUAL, objc_quals, objc_qual, objc_typename, objc_try_catch_stmt, optellipsis): Add %type declarations. (objc_inherit_code, objc_public_flag): Remove. (typespec_nonreserved_nonattr): Call objc_get_protocol_qualified_type() instead of get_static_reference() and get_protocol_reference(). (stmt_nocomp): Call grokparm() on @catch parameter. (objcdef): Move semantic action to objc_finish_implementation(). (classdef): Move semantic action to objc_start_class_interface(), objc_continue_interface(), objc_finish_interface(), objc_start_class_implementation(), objc_continue_implementation(), objc_start_category_interface() and objc_start_category_implementation(). (protocoldef): Move semantic actions to objc_start_protocol() and objc_finish_interface(). (ivar_decl_list): Remove nonterminal. (visibility_spec): Move semantic actions to objc_set_visibility(). (ivar_decls): Remove assignment to $$. (ivar_decl): Rephrase in terms of component_decl; call objc_add_instance_variable(). (ivars, ivar_declarator): Remove nonterminals. (opt_semi): New nonterminal. (methodtype): Remove semantic actions. (methoddef): Move semantic actions to objc_set_method_type(), objc_start_method_definition() and objc_finish_method_definition(). (methodproto): Move semantic actions to objc_set_method_type() and objc_add_method_declaration(). (methoddecl): Use objc_typename instead of typename; move semantic actions to objc_build_method_signature(). (optarglist, myxdecls, mydecl, myparms, myparm): Remove nonterminals. (optparmlist): Express in terms of optparms and optellipsis. (optparms, optellipsis, objc_qual, objc_quals, objc_typename): New nonterminals. (keyworddecl): Use objc_typename instead of typename. (rid_to_yy): Mark RID_IN, RID_OUT, RID_INOUT, RID_BYCOPY, RID_BYREF and RID_ONEWAY as returning OBJC_TYPE_QUAL to yyparse(). [gcc/objc/ChangeLog] 2004-09-07 Ziemowit Laski <zlaski@apple.com> * Make-lang.in (objc/objc-parse.o): Depend on $(C_COMMON_H) instead of objc/objc-act.h. (objc/objc-act.o): Depend on $(HASHTAB_H). * objc-act.c: Include hashtab.h; in ObjC++ mode, include cp-tree.h and objcp-decl.h instead of c-tree.h. (build_module_descriptor, get_class_ivars, synth_id_with_class_suffix, error_with_ivar, gen_method_decl, gen_declaration, setup_string_decl, build_protocol_template): Adjust prototypes. (build_module_initializer_routine, start_class, continue_class, finish_class, start_method_def, objc_start_function, start_protocol, build_method_decl, objc_add_method, add_instance_variable, build_ivar_reference, is_ivar, is_private, get_super_receiver, build_selector_table_decl, objc_push_parm, objc_get_parm_info, gen_type_name, gen_type_name_0, start_var_decl, finish_var_decl, create_field_decl): New prototypes. (objc_expand_function_end, comp_method_with_proto, objc_expr_last, gen_declaration_1, gen_declarator, is_complex_decl, adorn_decl, define_decl, create_builtin_decl, gen_declspecs): Remove prototypes. (TYPE_ID): Rename to OBJECT_TYPEDEF_NAME. (CLASS_TYPEDEF_NAME): New. (TAG_EXECCLASS): Change from a global variable to a #define. (TAG_RETURN_STRUCT): Delete. (TAG_GNUINIT): New, holds '__objc_gnu_init' name. (objc_inherit_code, objc_public_flag): New, moved from c-parse.in. (string_descriptor): New struct. (string_htab): New hash table. (string_hash, string_eq): New prototypes. (generate_struct_by_value_array): Call create_field_decl() instead of create_builtin_decl(). (objc_init): Do not initialize objc_ellipsis_node or TAG_EXECCLASS; In ObjC++ mode, call cxx_init() instead of c_objc_common_init(). (objc_finish_file): In ObjC++, call instantiate_pending_templates() and cp_finish_file(). (define_decl, get_static_reference, get_protocol_reference, create_builtin_decl): Remove functions. (objc_start_class_interface, objc_start_category_interface, objc_start_protocol, objc_continue_interface, objc_finish_interface, objc_start_class_implementation, objc_start_category_implementation, objc_continue_implementation, objc_finish_implementation, objc_set_visibility, objc_set_method_type, objc_build_method_signature, objc_add_method_declaration, objc_start_method_definition, objc_add_instance_variable, objc_get_protocol_qualified_type, create_field_decl, start_var_decl, finish_var_decl): New functions. (setup_string_decl): Simplify since it is only called once. (synth_module_prologue): Call build_class_template(); predefine 'id' and 'Class' as typedefs; rename 'temp_type' to 'type'; disable debug hooks for duration of function; fix GNU runtime messenger signatures to correspond to reality; forward-declare '__objc_exec_class' for the GNU runtime; call build_selector_table_decl(); in ObjC++ mode, generate 'extern "C" { ... }' wrappers around synthesized declarations; call build_protocol_template() and build_category_template(). (string_hash, string_eq): New functions. (objc_build_string_object): Check metaclass correctness only once; store string literals in hash table. (objc_build_constructor): Do not convert initializer elements; adjust for ObjC++ impedance mismatch. (build_objc_symtab_template): Call create_field_decl() instead of create_builtin_decl(). (init_objc_symtab): Add missing conversion to initializer element. (build_metadata_decl): Call start_var_decl() instead of define_decl(). (generate_objc_symtab_decl): Do not call build_category_template(); call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(). (build_module_descriptor): Call create_field_decl() instead of grokfield(); call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(); always mark module descriptor as used; move GNU runtime-specific functionality to build_module_initializer_routine(). (build_module_initializer_routine): New function, broken off of build_module_descriptor(). (objc_static_init_needed_p, objc_generate_static_init_call): New functions. (generate_static_references, generate_strings, build_selector_translation_table, generate_descriptor_table, generate_ivars_list, generate_dispatch_table, generate_category): Call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(); build a type directly instead of via groktypename(). (build_selector_reference_decl, build_selector_table_decl, build_class_reference_decl, build_protocol_reference, generate_objc_image_info): Call start_var_decl() instead of build_decl(). (build_selector_reference): For GNU runtime, do not call build_selector_reference_decl(). (build_selector, build_typed_selector_reference): Always convert result to the selector type. (add_objc_string): Cast return value to 'char *'. (build_method_prototype_template, build_selector_template, build_method_template): Use actual selector type for fields pointing to selectors. (finish_objc): For GNU runtime, call build_module_initializer_routine() after build_module_descriptor(). (generate_protocol_list, generate_shared_structures): Call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(); build a type directly instead of via groktypename(). (synth_id_with_class_suffix): Return a string. (get_arg_type_list): For instance methods, use the instance type for 'self'; do not call groktypename_in_parm_context(). (build_objc_string_decl): Squash redeclaration errors in ObjC++. (objc_is_class_name): Use OBJC_TYPE_NAME instead of TYPE_NAME; handle RECORD_TYPEs in ObjC as well as ObjC++. (objc_is_id): New function. (objc_is_object_ptr): Return the canonical type node. (objc_get_class_ivars): Simplify using get_class_ivars(). (get_class_ivars): Remove second parameter; create a fresh copy of the ivar list for each call; do not check for existence of super class. (objc_eh_runtime_type): Mark #ifndef OBJCPLUS. (objc_init_exceptions): When using SJLJ-style exceptions, require the use of '-fobjc-exceptions' flag; do not require it for DWARF-style exceptions. (objc_build_exc_ptr, next_sjlj_build_try_catch_finally): Use objc_object_type instead of objc_id_type. (objc_begin_catch_clause): Convert the incoming PARM_DECL into a VAR_DECL before placing it in the appropriate scope; do not call define_decl(); adjust call to c_begin_compound_stmt(); use objc_object_type instead of objc_id_type. (build_next_objc_exception_stuff): Call create_field_decl() instead of create_builtin_decl(); construct type directly instead of calling groktypename(); use OBJC_VOID_AT_END to mark end of function parameters. (build_private_template): Adjust call to get_class_ivars(); build a type directly instead of via groktypename(). (build_protocol_template, build_method_prototype_list_template, build_method_prototype_template, build_category_template, build_selector_template, build_class_template, build_super_template, build_ivar_template, build_ivar_list_template, build_method_list_template, build_method_template): Call create_field_decl() instead of grokfield(). (objc_method_parm_type): Do not call groktypename(). (generate_descriptor_table): Call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(). (generate_method_descriptors, build_protocol_initializer, generate_dispatch_tables, build_category_initializer, build_shared_structure_initializer): Do not call groktypename(). (generate_protocols): Call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(); do not call groktypename(). (error_with_ivar): Remove last parameter. (check_ivars): Do not iterate ovar CLASS_RAW_IVARS lists in addition to CLASS_IVARS lists; adjust calls to error_with_ivar(). (generate_ivar_lists): Convert one of the initializer elements; do not call groktypename(). (get_arg_type_list, start_method_def, gen_method_def): Account for new representation of variable arguments and '...' in Objective-C methods; add Objective-C++ impedance matching code. (is_objc_type_qualifier): Remove function. (adjust_type_for_id_default): Simplify; there is no longer a need to wade through declspecs. (lookup_interface, start_class, continue_class, finish_class, start_method_def, start_protocol, build_method_decl, objc_add_method, add_instance_variable, build_ivar_reference, is_ivar, is_private, get_super_receiver, objc_build_finally_epilogue): Make into static functions. (receiver_is_class_object): Use new IS_CLASS() macro. (objc_build_message_expr): Tweak ObjC++ message argument handling; call objc_finish_message_expr() instead of finish_message_expr(). (finish_message_expr): Rename to objc_finish_message_expr(); use OBJC_TYPE_NAME and OBJC_SET_TYPE_NAME macros instead of TYPE_NAME. call gen_type_name() instead of gen_declaration(); call objc_is_id() instead of using IS_ID and IS_CLASS; Use objc_class_name instead of calling get_identifier("Class"); handle CONVERT_EXPRs in receiver. (build_objc_method_call, warn_with_method): Do not call groktypename(). (build_ivar_reference): Call convert() instead of clobbering in a type. (hash_init): Initialize string_htab hash table. (add_instance_variable): Simplify parameter list; do not call grokfield(); do not populate CLASS_IVARS list. (start_class): Check for the existence of super class, if one was specified. (continue_class): Use CLASS_RAW_IVARS rather than CLASS_IVARS; do not call build_class_template(); adjust call to get_class_ivars(); call build_decl(), pushdecl() and finish_decl() instead of define_decl(). (finish_class): Call build_decl(), pushdecl() and finish_decl() instead of define_decl(). (add_protocols): Use PROTOCOL_BINFO_ELTS for the tree vector size. (start_protocol): Do not call build_protocol_template(); use PROTOCOL_BINFO_ELTS for the tree vector size. (encode_type_qualifiers): Do not handle the 'const' qualifier here. (encode_pointer): Encode 'const char *' as 'r*', for backwards compatibility. (encode_array): Use HOST_WIDE_INT_PRINT_DEC instead of "%ld". (encode_type): Handle the 'const' qualifier here. (objc_parmlist): New global variable, sued by objc_push_parm and objc_get_parm_info(). (objc_push_parm, objc_get_parm_info): New functions. (objc_expr_last): Remove function. (synth_self_and_ucmd_args): For instance methods, use the instance type for 'self'; call objc_push_parm() instead of push_parm_decl(). (start_method_def): Do not call push_scope(), declare_parm_level(), pop_scope(), push_parm_decl(), store_parm_decls() or objc_expr_last(); just use objc_push_parm() and objc_get_parm_info(). (comp_method_with_proto): Remove function. (objc_types_are_equivalent): Strip away indirections before comparing underlying types. (comp_proto_with_proto): Do not call groktypename(); types are no longer in raw declspec format. (objc_start_function): New function. (really_start_method): Call comp_proto_with_proto() instead of comp_method_with_proto(); call objc_start_function() instead of hand-crafting a function declarator. (continue_method_def, objc_expand_function_end): Remove functions. (get_super_receiver): Call objc_get_current_scope() instead of get_current_scope(); reference 'super_class' field (instead of 'class'). (finish_method_def): Rename to objc_finish_method_definition() and add a function decl parameter; move method encoding call from objc_expand_function_end(). (is_complex_decl, adorn_decl, gen_declarator, gen_declspecs, gen_declaration_1): Remove functions. (tmpbuf, RAW_DECLSPEC): Remove. (gen_declaration): Remove second parameter; simplify to deal with TYPE_P nodes instead of raw declspecs. (gen_type_name, gen_type_name_0): New functions. (gen_method_decl): Remove second parameter; call gen_type_name() instead of gen_declaration_1(). (dump_interface): Adjust calls to gen_declaration() and gen_method_decl(); do not allocate a separate string buffer. (init_objc): Allocate a larger string buffer to accommodate dump_interface(); adjust call to build_module_descriptor(); add call to build_module_initializer_routine() for the GNU runtime. (generate_classref_translation_entry): Do not call start_decl(); call finish_var_decl() instead of finish_decl(); call convert() instead of build_c_cast(). * objc-act.h (CLASS_OWN_IVARS): Remove accessor. (CLASS_BINFO_ELTS): Reduce from 6 to 5, now that CLASS_OWN_IVARS is gone. (OCTI_GNU_INIT_DECL, GNU_INIT_decl): New. (OCTI_ELLIPSIS_NODE, objc_ellipsis_node): Remove. (OCTI_ID_ID, id_type, objc_id_id): Rename to OCTI_ID_NAME, objc_object_type and objc_object_name, respectively. (OCTI_CLS_REF, OCTI_CLASS_NAME, objc_class_reference, objc_class_name): New. (IS_CLASS): New macro. (IS_ID, IS_SUPER): Robustify. (OCTI_EXECCLASS_DECL, execclass_decl): New. (finish_file, start_class, continue_class, finish_class, start_method_def, continue_method_def, finish_method_def, start_protocol, finish_protocol, objc_build_throw_stmt, objc_build_try_catch_finally_stmt, objc_build_synchronized_prologue, objc_build_synchronized_epilogue, objc_build_try_prologue, objc_build_try_epilogue, objc_build_catch_stmt, objc_build_catch_epilogue, objc_build_finally_prologue, objc_build_finally_epilogue, is_ivar, is_private, is_public, add_instance_variable, objc_add_method, get_super_receiver, objc_clear_super_receiver, get_class_ivars_from_name, get_class_reference, get_static_reference, get_object_reference, build_message_expr, finish_message_expr, build_selector_expr, build_ivar_reference, build_keyword_decl, build_method_decl, build_protocol_expr, build_objc_string_object, objc_declare_alias, objc_declare_class, objc_declare_protocols, objc_comptypes, objc_check_decl, build_encode_expr): Remove prototypes. (imp_count, cat_count): Make GGC-aware. (OBJC_SET_TYPE_NAME): New macro. From-SVN: r87168
2004-09-08 02:49:44 +02:00
/* struct _objc_method_list *class_methods; */
Yet more Objective-C++... * objc-act.c (objc_finish_try_stmt): Add return value. (objc_build_synchronized): Likewise. * objc-act.c (objc_is_gcable_type): Add. (objc_substitute_decl): Add. (objc_build_ivar_assignment): Add. (objc_build_global_assignment): Add. (objc_build_strong_cast_assignment): Add. (objc_is_ivar_reference_p): Add. (objc_is_global_reference_p): Add. (objc_generate_write_barrier): Add. (objc_rewrite_function_call): Add. (objc_gimplify_expr): Add Objective-C++ support. * objc-act.h (ALLOC_OBJC_TYPE_LANG_SPECIFIC): Likewise. (SIZEOF_OBJC_TYPE_LANG_SPECIFIC): Add. (INIT_TYPE_OBJC_INFO): Add Objective-C++ support. (DUP_TYPE_OBJC_INFO): Likewise. (struct imp_entry): Add field has_cxx_cdtors. (struct imp_entry *imp_list): Add OCTI_UMSG_FAST_DECL, OCTI_METH_LIST_TEMPL, OCTI_METH_PROTO_LIST_TEMPL, OCTI_IVAR_LIST_TEMPL, OCTI_ASSIGN_IVAR_DECL, OCTI_ASSIGN_IVAR_FAST_DECL, OCTI_ASSIGN_GLOBAL_DECL, OCTI_ASSIGN_STRONGCAST_DECL. (umsg_fast_decl): Add. (objc_assign_ivar_decl): Add. (objc_assign_ivar_fast_decl): Add. (objc_assign_global_decl): Add. (objc_assign_strong_cast_decl): Add. (objc_method_list_ptr): Add. (objc_method_proto_list_ptr): Add. (objc_ivar_list_ptr): Add. * objc-act.c (should_call_super_dealloc): Add. (OBJC_VERSION): Bump to 6. (objc_is_gcable_type): Add. (objc_substitute_decl): Add. (objc_build_ivar_assignment): Add. (objc_build_global_assignment): Add. (objc_build_strong_cast_assignment): Add. (objc_is_gcable_p): Add. (objc_is_ivar_reference_p): Add. (objc_is_global_reference_p): Add. (generate_shared_structures): Add flags parameter. (objc_generate_cxx_ctor_or_dtor): Add. (objc_generate_cxx_cdtors): Add. (add_class): Add name parameter. (objc_types_share_size_and_alignment): Add. (comp_proto_with_proto): Add strict parameter. (CLS_HAS_CXX_STRUCTORS): Add. (TAG_ASSIGNIVAR): Add. (TAG_ASSIGNGLOBAL): Add. (TAG_ASSIGNSTRONGCAST): Add. (TAG_MSGSEND_FAST): Add. (TAG_ASSIGNIVAR_FAST): Add. (TAG_CXX_CONSTRUCT): Add. (TAG_CXX_DESTRUCT): Add. (OBJC_LOOKUP_CLASS): Add. (OBJC_LOOKUP_NO_SUPER): Add. (objc_finish_file): Add pch support. (objc_finish_implementation): Add Objective-C++ support. (synth_module_prologue): Likewise. (synth_module_prologue): Add fast dispatching. (objc_get_class_reference): Add Objective-C++ support. (objc_generate_write_barrier): Likewise. (next_sjlj_build_enter_and_setjmp): Likewise. (objc_begin_try_stmt): Likewise. (build_next_objc_exception_stuff): Add fast ivar support. (build_private_template): Mark the record as used so debug information is generated. (build_protocol_template): Add Objective-C++ support. (objc_method_parm_type) Likewise. (objc_generate_cxx_ctor_or_dtor): Likewise. (objc_generate_cxx_cdtors): Likewise. (build_protocol_initializer): Likewise. (build_category_template): Likewise. (build_class_template): Likewise. (build_method_list_template): Likewise. (build_category_initializer): Likewise. (build_shared_structure_initializer): Likewise. (objc_finish_message_expr): Likewise. (build_objc_method_call): Add fast dispatch support. (lookup_method_static): Add support to end search at superclasses. (add_method_to_hash_list): Add strict parameter to comp_proto_with_proto. (objc_add_method): Likewise. (objc_add_method): Also set the interface_value. (add_instance_variable): Add Objective-C++ support. (objc_is_public): Likewise. (start_class): Likewise. (continue_class): Likewise. (encode_aggregate_within): Likewise. (start_method_def): Likewise. (objc_start_function): Clear current_function_returns_value and current_function_returns_null. (really_start_method): Add Objective-C++ support. (objc_finish_method_definition): Add warning for missing [super dealloc]. (finish_objc): Add Objective-C++ support. (generate_objc_image_info): Likewise. (objc_lookup_ivar): Likewise. * objc-act.h (TYPE_HAS_OBJC_INFO): Likewise. (INIT_TYPE_OBJC_INFO): Likewise. (DUP_TYPE_OBJC_INFO): Likewise. From-SVN: r99857
2005-05-17 22:07:08 +02:00
field_decl = create_field_decl (objc_method_list_ptr,
Makefile.in (c-parse.o): Depend on $(C_COMMON_H). [gcc/ChangeLog] 2004-09-07 Ziemowit Laski <zlaski@apple.com> * Makefile.in (c-parse.o): Depend on $(C_COMMON_H). * c-parse.in: Include c-common.h instead of objc-act.h. (ivar_decl_list, ivar_decls, ivar_decl, ivars, ivar_declarator, myparms, myparm): Remove %type declarations. (methodtype, optparms, OBJC_TYPE_QUAL, objc_quals, objc_qual, objc_typename, objc_try_catch_stmt, optellipsis): Add %type declarations. (objc_inherit_code, objc_public_flag): Remove. (typespec_nonreserved_nonattr): Call objc_get_protocol_qualified_type() instead of get_static_reference() and get_protocol_reference(). (stmt_nocomp): Call grokparm() on @catch parameter. (objcdef): Move semantic action to objc_finish_implementation(). (classdef): Move semantic action to objc_start_class_interface(), objc_continue_interface(), objc_finish_interface(), objc_start_class_implementation(), objc_continue_implementation(), objc_start_category_interface() and objc_start_category_implementation(). (protocoldef): Move semantic actions to objc_start_protocol() and objc_finish_interface(). (ivar_decl_list): Remove nonterminal. (visibility_spec): Move semantic actions to objc_set_visibility(). (ivar_decls): Remove assignment to $$. (ivar_decl): Rephrase in terms of component_decl; call objc_add_instance_variable(). (ivars, ivar_declarator): Remove nonterminals. (opt_semi): New nonterminal. (methodtype): Remove semantic actions. (methoddef): Move semantic actions to objc_set_method_type(), objc_start_method_definition() and objc_finish_method_definition(). (methodproto): Move semantic actions to objc_set_method_type() and objc_add_method_declaration(). (methoddecl): Use objc_typename instead of typename; move semantic actions to objc_build_method_signature(). (optarglist, myxdecls, mydecl, myparms, myparm): Remove nonterminals. (optparmlist): Express in terms of optparms and optellipsis. (optparms, optellipsis, objc_qual, objc_quals, objc_typename): New nonterminals. (keyworddecl): Use objc_typename instead of typename. (rid_to_yy): Mark RID_IN, RID_OUT, RID_INOUT, RID_BYCOPY, RID_BYREF and RID_ONEWAY as returning OBJC_TYPE_QUAL to yyparse(). [gcc/objc/ChangeLog] 2004-09-07 Ziemowit Laski <zlaski@apple.com> * Make-lang.in (objc/objc-parse.o): Depend on $(C_COMMON_H) instead of objc/objc-act.h. (objc/objc-act.o): Depend on $(HASHTAB_H). * objc-act.c: Include hashtab.h; in ObjC++ mode, include cp-tree.h and objcp-decl.h instead of c-tree.h. (build_module_descriptor, get_class_ivars, synth_id_with_class_suffix, error_with_ivar, gen_method_decl, gen_declaration, setup_string_decl, build_protocol_template): Adjust prototypes. (build_module_initializer_routine, start_class, continue_class, finish_class, start_method_def, objc_start_function, start_protocol, build_method_decl, objc_add_method, add_instance_variable, build_ivar_reference, is_ivar, is_private, get_super_receiver, build_selector_table_decl, objc_push_parm, objc_get_parm_info, gen_type_name, gen_type_name_0, start_var_decl, finish_var_decl, create_field_decl): New prototypes. (objc_expand_function_end, comp_method_with_proto, objc_expr_last, gen_declaration_1, gen_declarator, is_complex_decl, adorn_decl, define_decl, create_builtin_decl, gen_declspecs): Remove prototypes. (TYPE_ID): Rename to OBJECT_TYPEDEF_NAME. (CLASS_TYPEDEF_NAME): New. (TAG_EXECCLASS): Change from a global variable to a #define. (TAG_RETURN_STRUCT): Delete. (TAG_GNUINIT): New, holds '__objc_gnu_init' name. (objc_inherit_code, objc_public_flag): New, moved from c-parse.in. (string_descriptor): New struct. (string_htab): New hash table. (string_hash, string_eq): New prototypes. (generate_struct_by_value_array): Call create_field_decl() instead of create_builtin_decl(). (objc_init): Do not initialize objc_ellipsis_node or TAG_EXECCLASS; In ObjC++ mode, call cxx_init() instead of c_objc_common_init(). (objc_finish_file): In ObjC++, call instantiate_pending_templates() and cp_finish_file(). (define_decl, get_static_reference, get_protocol_reference, create_builtin_decl): Remove functions. (objc_start_class_interface, objc_start_category_interface, objc_start_protocol, objc_continue_interface, objc_finish_interface, objc_start_class_implementation, objc_start_category_implementation, objc_continue_implementation, objc_finish_implementation, objc_set_visibility, objc_set_method_type, objc_build_method_signature, objc_add_method_declaration, objc_start_method_definition, objc_add_instance_variable, objc_get_protocol_qualified_type, create_field_decl, start_var_decl, finish_var_decl): New functions. (setup_string_decl): Simplify since it is only called once. (synth_module_prologue): Call build_class_template(); predefine 'id' and 'Class' as typedefs; rename 'temp_type' to 'type'; disable debug hooks for duration of function; fix GNU runtime messenger signatures to correspond to reality; forward-declare '__objc_exec_class' for the GNU runtime; call build_selector_table_decl(); in ObjC++ mode, generate 'extern "C" { ... }' wrappers around synthesized declarations; call build_protocol_template() and build_category_template(). (string_hash, string_eq): New functions. (objc_build_string_object): Check metaclass correctness only once; store string literals in hash table. (objc_build_constructor): Do not convert initializer elements; adjust for ObjC++ impedance mismatch. (build_objc_symtab_template): Call create_field_decl() instead of create_builtin_decl(). (init_objc_symtab): Add missing conversion to initializer element. (build_metadata_decl): Call start_var_decl() instead of define_decl(). (generate_objc_symtab_decl): Do not call build_category_template(); call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(). (build_module_descriptor): Call create_field_decl() instead of grokfield(); call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(); always mark module descriptor as used; move GNU runtime-specific functionality to build_module_initializer_routine(). (build_module_initializer_routine): New function, broken off of build_module_descriptor(). (objc_static_init_needed_p, objc_generate_static_init_call): New functions. (generate_static_references, generate_strings, build_selector_translation_table, generate_descriptor_table, generate_ivars_list, generate_dispatch_table, generate_category): Call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(); build a type directly instead of via groktypename(). (build_selector_reference_decl, build_selector_table_decl, build_class_reference_decl, build_protocol_reference, generate_objc_image_info): Call start_var_decl() instead of build_decl(). (build_selector_reference): For GNU runtime, do not call build_selector_reference_decl(). (build_selector, build_typed_selector_reference): Always convert result to the selector type. (add_objc_string): Cast return value to 'char *'. (build_method_prototype_template, build_selector_template, build_method_template): Use actual selector type for fields pointing to selectors. (finish_objc): For GNU runtime, call build_module_initializer_routine() after build_module_descriptor(). (generate_protocol_list, generate_shared_structures): Call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(); build a type directly instead of via groktypename(). (synth_id_with_class_suffix): Return a string. (get_arg_type_list): For instance methods, use the instance type for 'self'; do not call groktypename_in_parm_context(). (build_objc_string_decl): Squash redeclaration errors in ObjC++. (objc_is_class_name): Use OBJC_TYPE_NAME instead of TYPE_NAME; handle RECORD_TYPEs in ObjC as well as ObjC++. (objc_is_id): New function. (objc_is_object_ptr): Return the canonical type node. (objc_get_class_ivars): Simplify using get_class_ivars(). (get_class_ivars): Remove second parameter; create a fresh copy of the ivar list for each call; do not check for existence of super class. (objc_eh_runtime_type): Mark #ifndef OBJCPLUS. (objc_init_exceptions): When using SJLJ-style exceptions, require the use of '-fobjc-exceptions' flag; do not require it for DWARF-style exceptions. (objc_build_exc_ptr, next_sjlj_build_try_catch_finally): Use objc_object_type instead of objc_id_type. (objc_begin_catch_clause): Convert the incoming PARM_DECL into a VAR_DECL before placing it in the appropriate scope; do not call define_decl(); adjust call to c_begin_compound_stmt(); use objc_object_type instead of objc_id_type. (build_next_objc_exception_stuff): Call create_field_decl() instead of create_builtin_decl(); construct type directly instead of calling groktypename(); use OBJC_VOID_AT_END to mark end of function parameters. (build_private_template): Adjust call to get_class_ivars(); build a type directly instead of via groktypename(). (build_protocol_template, build_method_prototype_list_template, build_method_prototype_template, build_category_template, build_selector_template, build_class_template, build_super_template, build_ivar_template, build_ivar_list_template, build_method_list_template, build_method_template): Call create_field_decl() instead of grokfield(). (objc_method_parm_type): Do not call groktypename(). (generate_descriptor_table): Call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(). (generate_method_descriptors, build_protocol_initializer, generate_dispatch_tables, build_category_initializer, build_shared_structure_initializer): Do not call groktypename(). (generate_protocols): Call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(); do not call groktypename(). (error_with_ivar): Remove last parameter. (check_ivars): Do not iterate ovar CLASS_RAW_IVARS lists in addition to CLASS_IVARS lists; adjust calls to error_with_ivar(). (generate_ivar_lists): Convert one of the initializer elements; do not call groktypename(). (get_arg_type_list, start_method_def, gen_method_def): Account for new representation of variable arguments and '...' in Objective-C methods; add Objective-C++ impedance matching code. (is_objc_type_qualifier): Remove function. (adjust_type_for_id_default): Simplify; there is no longer a need to wade through declspecs. (lookup_interface, start_class, continue_class, finish_class, start_method_def, start_protocol, build_method_decl, objc_add_method, add_instance_variable, build_ivar_reference, is_ivar, is_private, get_super_receiver, objc_build_finally_epilogue): Make into static functions. (receiver_is_class_object): Use new IS_CLASS() macro. (objc_build_message_expr): Tweak ObjC++ message argument handling; call objc_finish_message_expr() instead of finish_message_expr(). (finish_message_expr): Rename to objc_finish_message_expr(); use OBJC_TYPE_NAME and OBJC_SET_TYPE_NAME macros instead of TYPE_NAME. call gen_type_name() instead of gen_declaration(); call objc_is_id() instead of using IS_ID and IS_CLASS; Use objc_class_name instead of calling get_identifier("Class"); handle CONVERT_EXPRs in receiver. (build_objc_method_call, warn_with_method): Do not call groktypename(). (build_ivar_reference): Call convert() instead of clobbering in a type. (hash_init): Initialize string_htab hash table. (add_instance_variable): Simplify parameter list; do not call grokfield(); do not populate CLASS_IVARS list. (start_class): Check for the existence of super class, if one was specified. (continue_class): Use CLASS_RAW_IVARS rather than CLASS_IVARS; do not call build_class_template(); adjust call to get_class_ivars(); call build_decl(), pushdecl() and finish_decl() instead of define_decl(). (finish_class): Call build_decl(), pushdecl() and finish_decl() instead of define_decl(). (add_protocols): Use PROTOCOL_BINFO_ELTS for the tree vector size. (start_protocol): Do not call build_protocol_template(); use PROTOCOL_BINFO_ELTS for the tree vector size. (encode_type_qualifiers): Do not handle the 'const' qualifier here. (encode_pointer): Encode 'const char *' as 'r*', for backwards compatibility. (encode_array): Use HOST_WIDE_INT_PRINT_DEC instead of "%ld". (encode_type): Handle the 'const' qualifier here. (objc_parmlist): New global variable, sued by objc_push_parm and objc_get_parm_info(). (objc_push_parm, objc_get_parm_info): New functions. (objc_expr_last): Remove function. (synth_self_and_ucmd_args): For instance methods, use the instance type for 'self'; call objc_push_parm() instead of push_parm_decl(). (start_method_def): Do not call push_scope(), declare_parm_level(), pop_scope(), push_parm_decl(), store_parm_decls() or objc_expr_last(); just use objc_push_parm() and objc_get_parm_info(). (comp_method_with_proto): Remove function. (objc_types_are_equivalent): Strip away indirections before comparing underlying types. (comp_proto_with_proto): Do not call groktypename(); types are no longer in raw declspec format. (objc_start_function): New function. (really_start_method): Call comp_proto_with_proto() instead of comp_method_with_proto(); call objc_start_function() instead of hand-crafting a function declarator. (continue_method_def, objc_expand_function_end): Remove functions. (get_super_receiver): Call objc_get_current_scope() instead of get_current_scope(); reference 'super_class' field (instead of 'class'). (finish_method_def): Rename to objc_finish_method_definition() and add a function decl parameter; move method encoding call from objc_expand_function_end(). (is_complex_decl, adorn_decl, gen_declarator, gen_declspecs, gen_declaration_1): Remove functions. (tmpbuf, RAW_DECLSPEC): Remove. (gen_declaration): Remove second parameter; simplify to deal with TYPE_P nodes instead of raw declspecs. (gen_type_name, gen_type_name_0): New functions. (gen_method_decl): Remove second parameter; call gen_type_name() instead of gen_declaration_1(). (dump_interface): Adjust calls to gen_declaration() and gen_method_decl(); do not allocate a separate string buffer. (init_objc): Allocate a larger string buffer to accommodate dump_interface(); adjust call to build_module_descriptor(); add call to build_module_initializer_routine() for the GNU runtime. (generate_classref_translation_entry): Do not call start_decl(); call finish_var_decl() instead of finish_decl(); call convert() instead of build_c_cast(). * objc-act.h (CLASS_OWN_IVARS): Remove accessor. (CLASS_BINFO_ELTS): Reduce from 6 to 5, now that CLASS_OWN_IVARS is gone. (OCTI_GNU_INIT_DECL, GNU_INIT_decl): New. (OCTI_ELLIPSIS_NODE, objc_ellipsis_node): Remove. (OCTI_ID_ID, id_type, objc_id_id): Rename to OCTI_ID_NAME, objc_object_type and objc_object_name, respectively. (OCTI_CLS_REF, OCTI_CLASS_NAME, objc_class_reference, objc_class_name): New. (IS_CLASS): New macro. (IS_ID, IS_SUPER): Robustify. (OCTI_EXECCLASS_DECL, execclass_decl): New. (finish_file, start_class, continue_class, finish_class, start_method_def, continue_method_def, finish_method_def, start_protocol, finish_protocol, objc_build_throw_stmt, objc_build_try_catch_finally_stmt, objc_build_synchronized_prologue, objc_build_synchronized_epilogue, objc_build_try_prologue, objc_build_try_epilogue, objc_build_catch_stmt, objc_build_catch_epilogue, objc_build_finally_prologue, objc_build_finally_epilogue, is_ivar, is_private, is_public, add_instance_variable, objc_add_method, get_super_receiver, objc_clear_super_receiver, get_class_ivars_from_name, get_class_reference, get_static_reference, get_object_reference, build_message_expr, finish_message_expr, build_selector_expr, build_ivar_reference, build_keyword_decl, build_method_decl, build_protocol_expr, build_objc_string_object, objc_declare_alias, objc_declare_class, objc_declare_protocols, objc_comptypes, objc_check_decl, build_encode_expr): Remove prototypes. (imp_count, cat_count): Make GGC-aware. (OBJC_SET_TYPE_NAME): New macro. From-SVN: r87168
2004-09-08 02:49:44 +02:00
"class_methods");
1992-01-18 00:15:38 +01:00
chainon (field_decl_chain, field_decl);
Makefile.in (c-parse.o): Depend on $(C_COMMON_H). [gcc/ChangeLog] 2004-09-07 Ziemowit Laski <zlaski@apple.com> * Makefile.in (c-parse.o): Depend on $(C_COMMON_H). * c-parse.in: Include c-common.h instead of objc-act.h. (ivar_decl_list, ivar_decls, ivar_decl, ivars, ivar_declarator, myparms, myparm): Remove %type declarations. (methodtype, optparms, OBJC_TYPE_QUAL, objc_quals, objc_qual, objc_typename, objc_try_catch_stmt, optellipsis): Add %type declarations. (objc_inherit_code, objc_public_flag): Remove. (typespec_nonreserved_nonattr): Call objc_get_protocol_qualified_type() instead of get_static_reference() and get_protocol_reference(). (stmt_nocomp): Call grokparm() on @catch parameter. (objcdef): Move semantic action to objc_finish_implementation(). (classdef): Move semantic action to objc_start_class_interface(), objc_continue_interface(), objc_finish_interface(), objc_start_class_implementation(), objc_continue_implementation(), objc_start_category_interface() and objc_start_category_implementation(). (protocoldef): Move semantic actions to objc_start_protocol() and objc_finish_interface(). (ivar_decl_list): Remove nonterminal. (visibility_spec): Move semantic actions to objc_set_visibility(). (ivar_decls): Remove assignment to $$. (ivar_decl): Rephrase in terms of component_decl; call objc_add_instance_variable(). (ivars, ivar_declarator): Remove nonterminals. (opt_semi): New nonterminal. (methodtype): Remove semantic actions. (methoddef): Move semantic actions to objc_set_method_type(), objc_start_method_definition() and objc_finish_method_definition(). (methodproto): Move semantic actions to objc_set_method_type() and objc_add_method_declaration(). (methoddecl): Use objc_typename instead of typename; move semantic actions to objc_build_method_signature(). (optarglist, myxdecls, mydecl, myparms, myparm): Remove nonterminals. (optparmlist): Express in terms of optparms and optellipsis. (optparms, optellipsis, objc_qual, objc_quals, objc_typename): New nonterminals. (keyworddecl): Use objc_typename instead of typename. (rid_to_yy): Mark RID_IN, RID_OUT, RID_INOUT, RID_BYCOPY, RID_BYREF and RID_ONEWAY as returning OBJC_TYPE_QUAL to yyparse(). [gcc/objc/ChangeLog] 2004-09-07 Ziemowit Laski <zlaski@apple.com> * Make-lang.in (objc/objc-parse.o): Depend on $(C_COMMON_H) instead of objc/objc-act.h. (objc/objc-act.o): Depend on $(HASHTAB_H). * objc-act.c: Include hashtab.h; in ObjC++ mode, include cp-tree.h and objcp-decl.h instead of c-tree.h. (build_module_descriptor, get_class_ivars, synth_id_with_class_suffix, error_with_ivar, gen_method_decl, gen_declaration, setup_string_decl, build_protocol_template): Adjust prototypes. (build_module_initializer_routine, start_class, continue_class, finish_class, start_method_def, objc_start_function, start_protocol, build_method_decl, objc_add_method, add_instance_variable, build_ivar_reference, is_ivar, is_private, get_super_receiver, build_selector_table_decl, objc_push_parm, objc_get_parm_info, gen_type_name, gen_type_name_0, start_var_decl, finish_var_decl, create_field_decl): New prototypes. (objc_expand_function_end, comp_method_with_proto, objc_expr_last, gen_declaration_1, gen_declarator, is_complex_decl, adorn_decl, define_decl, create_builtin_decl, gen_declspecs): Remove prototypes. (TYPE_ID): Rename to OBJECT_TYPEDEF_NAME. (CLASS_TYPEDEF_NAME): New. (TAG_EXECCLASS): Change from a global variable to a #define. (TAG_RETURN_STRUCT): Delete. (TAG_GNUINIT): New, holds '__objc_gnu_init' name. (objc_inherit_code, objc_public_flag): New, moved from c-parse.in. (string_descriptor): New struct. (string_htab): New hash table. (string_hash, string_eq): New prototypes. (generate_struct_by_value_array): Call create_field_decl() instead of create_builtin_decl(). (objc_init): Do not initialize objc_ellipsis_node or TAG_EXECCLASS; In ObjC++ mode, call cxx_init() instead of c_objc_common_init(). (objc_finish_file): In ObjC++, call instantiate_pending_templates() and cp_finish_file(). (define_decl, get_static_reference, get_protocol_reference, create_builtin_decl): Remove functions. (objc_start_class_interface, objc_start_category_interface, objc_start_protocol, objc_continue_interface, objc_finish_interface, objc_start_class_implementation, objc_start_category_implementation, objc_continue_implementation, objc_finish_implementation, objc_set_visibility, objc_set_method_type, objc_build_method_signature, objc_add_method_declaration, objc_start_method_definition, objc_add_instance_variable, objc_get_protocol_qualified_type, create_field_decl, start_var_decl, finish_var_decl): New functions. (setup_string_decl): Simplify since it is only called once. (synth_module_prologue): Call build_class_template(); predefine 'id' and 'Class' as typedefs; rename 'temp_type' to 'type'; disable debug hooks for duration of function; fix GNU runtime messenger signatures to correspond to reality; forward-declare '__objc_exec_class' for the GNU runtime; call build_selector_table_decl(); in ObjC++ mode, generate 'extern "C" { ... }' wrappers around synthesized declarations; call build_protocol_template() and build_category_template(). (string_hash, string_eq): New functions. (objc_build_string_object): Check metaclass correctness only once; store string literals in hash table. (objc_build_constructor): Do not convert initializer elements; adjust for ObjC++ impedance mismatch. (build_objc_symtab_template): Call create_field_decl() instead of create_builtin_decl(). (init_objc_symtab): Add missing conversion to initializer element. (build_metadata_decl): Call start_var_decl() instead of define_decl(). (generate_objc_symtab_decl): Do not call build_category_template(); call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(). (build_module_descriptor): Call create_field_decl() instead of grokfield(); call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(); always mark module descriptor as used; move GNU runtime-specific functionality to build_module_initializer_routine(). (build_module_initializer_routine): New function, broken off of build_module_descriptor(). (objc_static_init_needed_p, objc_generate_static_init_call): New functions. (generate_static_references, generate_strings, build_selector_translation_table, generate_descriptor_table, generate_ivars_list, generate_dispatch_table, generate_category): Call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(); build a type directly instead of via groktypename(). (build_selector_reference_decl, build_selector_table_decl, build_class_reference_decl, build_protocol_reference, generate_objc_image_info): Call start_var_decl() instead of build_decl(). (build_selector_reference): For GNU runtime, do not call build_selector_reference_decl(). (build_selector, build_typed_selector_reference): Always convert result to the selector type. (add_objc_string): Cast return value to 'char *'. (build_method_prototype_template, build_selector_template, build_method_template): Use actual selector type for fields pointing to selectors. (finish_objc): For GNU runtime, call build_module_initializer_routine() after build_module_descriptor(). (generate_protocol_list, generate_shared_structures): Call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(); build a type directly instead of via groktypename(). (synth_id_with_class_suffix): Return a string. (get_arg_type_list): For instance methods, use the instance type for 'self'; do not call groktypename_in_parm_context(). (build_objc_string_decl): Squash redeclaration errors in ObjC++. (objc_is_class_name): Use OBJC_TYPE_NAME instead of TYPE_NAME; handle RECORD_TYPEs in ObjC as well as ObjC++. (objc_is_id): New function. (objc_is_object_ptr): Return the canonical type node. (objc_get_class_ivars): Simplify using get_class_ivars(). (get_class_ivars): Remove second parameter; create a fresh copy of the ivar list for each call; do not check for existence of super class. (objc_eh_runtime_type): Mark #ifndef OBJCPLUS. (objc_init_exceptions): When using SJLJ-style exceptions, require the use of '-fobjc-exceptions' flag; do not require it for DWARF-style exceptions. (objc_build_exc_ptr, next_sjlj_build_try_catch_finally): Use objc_object_type instead of objc_id_type. (objc_begin_catch_clause): Convert the incoming PARM_DECL into a VAR_DECL before placing it in the appropriate scope; do not call define_decl(); adjust call to c_begin_compound_stmt(); use objc_object_type instead of objc_id_type. (build_next_objc_exception_stuff): Call create_field_decl() instead of create_builtin_decl(); construct type directly instead of calling groktypename(); use OBJC_VOID_AT_END to mark end of function parameters. (build_private_template): Adjust call to get_class_ivars(); build a type directly instead of via groktypename(). (build_protocol_template, build_method_prototype_list_template, build_method_prototype_template, build_category_template, build_selector_template, build_class_template, build_super_template, build_ivar_template, build_ivar_list_template, build_method_list_template, build_method_template): Call create_field_decl() instead of grokfield(). (objc_method_parm_type): Do not call groktypename(). (generate_descriptor_table): Call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(). (generate_method_descriptors, build_protocol_initializer, generate_dispatch_tables, build_category_initializer, build_shared_structure_initializer): Do not call groktypename(). (generate_protocols): Call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(); do not call groktypename(). (error_with_ivar): Remove last parameter. (check_ivars): Do not iterate ovar CLASS_RAW_IVARS lists in addition to CLASS_IVARS lists; adjust calls to error_with_ivar(). (generate_ivar_lists): Convert one of the initializer elements; do not call groktypename(). (get_arg_type_list, start_method_def, gen_method_def): Account for new representation of variable arguments and '...' in Objective-C methods; add Objective-C++ impedance matching code. (is_objc_type_qualifier): Remove function. (adjust_type_for_id_default): Simplify; there is no longer a need to wade through declspecs. (lookup_interface, start_class, continue_class, finish_class, start_method_def, start_protocol, build_method_decl, objc_add_method, add_instance_variable, build_ivar_reference, is_ivar, is_private, get_super_receiver, objc_build_finally_epilogue): Make into static functions. (receiver_is_class_object): Use new IS_CLASS() macro. (objc_build_message_expr): Tweak ObjC++ message argument handling; call objc_finish_message_expr() instead of finish_message_expr(). (finish_message_expr): Rename to objc_finish_message_expr(); use OBJC_TYPE_NAME and OBJC_SET_TYPE_NAME macros instead of TYPE_NAME. call gen_type_name() instead of gen_declaration(); call objc_is_id() instead of using IS_ID and IS_CLASS; Use objc_class_name instead of calling get_identifier("Class"); handle CONVERT_EXPRs in receiver. (build_objc_method_call, warn_with_method): Do not call groktypename(). (build_ivar_reference): Call convert() instead of clobbering in a type. (hash_init): Initialize string_htab hash table. (add_instance_variable): Simplify parameter list; do not call grokfield(); do not populate CLASS_IVARS list. (start_class): Check for the existence of super class, if one was specified. (continue_class): Use CLASS_RAW_IVARS rather than CLASS_IVARS; do not call build_class_template(); adjust call to get_class_ivars(); call build_decl(), pushdecl() and finish_decl() instead of define_decl(). (finish_class): Call build_decl(), pushdecl() and finish_decl() instead of define_decl(). (add_protocols): Use PROTOCOL_BINFO_ELTS for the tree vector size. (start_protocol): Do not call build_protocol_template(); use PROTOCOL_BINFO_ELTS for the tree vector size. (encode_type_qualifiers): Do not handle the 'const' qualifier here. (encode_pointer): Encode 'const char *' as 'r*', for backwards compatibility. (encode_array): Use HOST_WIDE_INT_PRINT_DEC instead of "%ld". (encode_type): Handle the 'const' qualifier here. (objc_parmlist): New global variable, sued by objc_push_parm and objc_get_parm_info(). (objc_push_parm, objc_get_parm_info): New functions. (objc_expr_last): Remove function. (synth_self_and_ucmd_args): For instance methods, use the instance type for 'self'; call objc_push_parm() instead of push_parm_decl(). (start_method_def): Do not call push_scope(), declare_parm_level(), pop_scope(), push_parm_decl(), store_parm_decls() or objc_expr_last(); just use objc_push_parm() and objc_get_parm_info(). (comp_method_with_proto): Remove function. (objc_types_are_equivalent): Strip away indirections before comparing underlying types. (comp_proto_with_proto): Do not call groktypename(); types are no longer in raw declspec format. (objc_start_function): New function. (really_start_method): Call comp_proto_with_proto() instead of comp_method_with_proto(); call objc_start_function() instead of hand-crafting a function declarator. (continue_method_def, objc_expand_function_end): Remove functions. (get_super_receiver): Call objc_get_current_scope() instead of get_current_scope(); reference 'super_class' field (instead of 'class'). (finish_method_def): Rename to objc_finish_method_definition() and add a function decl parameter; move method encoding call from objc_expand_function_end(). (is_complex_decl, adorn_decl, gen_declarator, gen_declspecs, gen_declaration_1): Remove functions. (tmpbuf, RAW_DECLSPEC): Remove. (gen_declaration): Remove second parameter; simplify to deal with TYPE_P nodes instead of raw declspecs. (gen_type_name, gen_type_name_0): New functions. (gen_method_decl): Remove second parameter; call gen_type_name() instead of gen_declaration_1(). (dump_interface): Adjust calls to gen_declaration() and gen_method_decl(); do not allocate a separate string buffer. (init_objc): Allocate a larger string buffer to accommodate dump_interface(); adjust call to build_module_descriptor(); add call to build_module_initializer_routine() for the GNU runtime. (generate_classref_translation_entry): Do not call start_decl(); call finish_var_decl() instead of finish_decl(); call convert() instead of build_c_cast(). * objc-act.h (CLASS_OWN_IVARS): Remove accessor. (CLASS_BINFO_ELTS): Reduce from 6 to 5, now that CLASS_OWN_IVARS is gone. (OCTI_GNU_INIT_DECL, GNU_INIT_decl): New. (OCTI_ELLIPSIS_NODE, objc_ellipsis_node): Remove. (OCTI_ID_ID, id_type, objc_id_id): Rename to OCTI_ID_NAME, objc_object_type and objc_object_name, respectively. (OCTI_CLS_REF, OCTI_CLASS_NAME, objc_class_reference, objc_class_name): New. (IS_CLASS): New macro. (IS_ID, IS_SUPER): Robustify. (OCTI_EXECCLASS_DECL, execclass_decl): New. (finish_file, start_class, continue_class, finish_class, start_method_def, continue_method_def, finish_method_def, start_protocol, finish_protocol, objc_build_throw_stmt, objc_build_try_catch_finally_stmt, objc_build_synchronized_prologue, objc_build_synchronized_epilogue, objc_build_try_prologue, objc_build_try_epilogue, objc_build_catch_stmt, objc_build_catch_epilogue, objc_build_finally_prologue, objc_build_finally_epilogue, is_ivar, is_private, is_public, add_instance_variable, objc_add_method, get_super_receiver, objc_clear_super_receiver, get_class_ivars_from_name, get_class_reference, get_static_reference, get_object_reference, build_message_expr, finish_message_expr, build_selector_expr, build_ivar_reference, build_keyword_decl, build_method_decl, build_protocol_expr, build_objc_string_object, objc_declare_alias, objc_declare_class, objc_declare_protocols, objc_comptypes, objc_check_decl, build_encode_expr): Remove prototypes. (imp_count, cat_count): Make GGC-aware. (OBJC_SET_TYPE_NAME): New macro. From-SVN: r87168
2004-09-08 02:49:44 +02:00
/* struct _objc_protocol **protocol_list; */
field_decl = create_field_decl (build_pointer_type
(build_pointer_type
(objc_protocol_template)),
"protocol_list");
chainon (field_decl_chain, field_decl);
finish_struct (objc_category_template, field_decl_chain, NULL_TREE);
1992-01-18 00:15:38 +01:00
}
Makefile.in (c-parse.o): Depend on $(C_COMMON_H). [gcc/ChangeLog] 2004-09-07 Ziemowit Laski <zlaski@apple.com> * Makefile.in (c-parse.o): Depend on $(C_COMMON_H). * c-parse.in: Include c-common.h instead of objc-act.h. (ivar_decl_list, ivar_decls, ivar_decl, ivars, ivar_declarator, myparms, myparm): Remove %type declarations. (methodtype, optparms, OBJC_TYPE_QUAL, objc_quals, objc_qual, objc_typename, objc_try_catch_stmt, optellipsis): Add %type declarations. (objc_inherit_code, objc_public_flag): Remove. (typespec_nonreserved_nonattr): Call objc_get_protocol_qualified_type() instead of get_static_reference() and get_protocol_reference(). (stmt_nocomp): Call grokparm() on @catch parameter. (objcdef): Move semantic action to objc_finish_implementation(). (classdef): Move semantic action to objc_start_class_interface(), objc_continue_interface(), objc_finish_interface(), objc_start_class_implementation(), objc_continue_implementation(), objc_start_category_interface() and objc_start_category_implementation(). (protocoldef): Move semantic actions to objc_start_protocol() and objc_finish_interface(). (ivar_decl_list): Remove nonterminal. (visibility_spec): Move semantic actions to objc_set_visibility(). (ivar_decls): Remove assignment to $$. (ivar_decl): Rephrase in terms of component_decl; call objc_add_instance_variable(). (ivars, ivar_declarator): Remove nonterminals. (opt_semi): New nonterminal. (methodtype): Remove semantic actions. (methoddef): Move semantic actions to objc_set_method_type(), objc_start_method_definition() and objc_finish_method_definition(). (methodproto): Move semantic actions to objc_set_method_type() and objc_add_method_declaration(). (methoddecl): Use objc_typename instead of typename; move semantic actions to objc_build_method_signature(). (optarglist, myxdecls, mydecl, myparms, myparm): Remove nonterminals. (optparmlist): Express in terms of optparms and optellipsis. (optparms, optellipsis, objc_qual, objc_quals, objc_typename): New nonterminals. (keyworddecl): Use objc_typename instead of typename. (rid_to_yy): Mark RID_IN, RID_OUT, RID_INOUT, RID_BYCOPY, RID_BYREF and RID_ONEWAY as returning OBJC_TYPE_QUAL to yyparse(). [gcc/objc/ChangeLog] 2004-09-07 Ziemowit Laski <zlaski@apple.com> * Make-lang.in (objc/objc-parse.o): Depend on $(C_COMMON_H) instead of objc/objc-act.h. (objc/objc-act.o): Depend on $(HASHTAB_H). * objc-act.c: Include hashtab.h; in ObjC++ mode, include cp-tree.h and objcp-decl.h instead of c-tree.h. (build_module_descriptor, get_class_ivars, synth_id_with_class_suffix, error_with_ivar, gen_method_decl, gen_declaration, setup_string_decl, build_protocol_template): Adjust prototypes. (build_module_initializer_routine, start_class, continue_class, finish_class, start_method_def, objc_start_function, start_protocol, build_method_decl, objc_add_method, add_instance_variable, build_ivar_reference, is_ivar, is_private, get_super_receiver, build_selector_table_decl, objc_push_parm, objc_get_parm_info, gen_type_name, gen_type_name_0, start_var_decl, finish_var_decl, create_field_decl): New prototypes. (objc_expand_function_end, comp_method_with_proto, objc_expr_last, gen_declaration_1, gen_declarator, is_complex_decl, adorn_decl, define_decl, create_builtin_decl, gen_declspecs): Remove prototypes. (TYPE_ID): Rename to OBJECT_TYPEDEF_NAME. (CLASS_TYPEDEF_NAME): New. (TAG_EXECCLASS): Change from a global variable to a #define. (TAG_RETURN_STRUCT): Delete. (TAG_GNUINIT): New, holds '__objc_gnu_init' name. (objc_inherit_code, objc_public_flag): New, moved from c-parse.in. (string_descriptor): New struct. (string_htab): New hash table. (string_hash, string_eq): New prototypes. (generate_struct_by_value_array): Call create_field_decl() instead of create_builtin_decl(). (objc_init): Do not initialize objc_ellipsis_node or TAG_EXECCLASS; In ObjC++ mode, call cxx_init() instead of c_objc_common_init(). (objc_finish_file): In ObjC++, call instantiate_pending_templates() and cp_finish_file(). (define_decl, get_static_reference, get_protocol_reference, create_builtin_decl): Remove functions. (objc_start_class_interface, objc_start_category_interface, objc_start_protocol, objc_continue_interface, objc_finish_interface, objc_start_class_implementation, objc_start_category_implementation, objc_continue_implementation, objc_finish_implementation, objc_set_visibility, objc_set_method_type, objc_build_method_signature, objc_add_method_declaration, objc_start_method_definition, objc_add_instance_variable, objc_get_protocol_qualified_type, create_field_decl, start_var_decl, finish_var_decl): New functions. (setup_string_decl): Simplify since it is only called once. (synth_module_prologue): Call build_class_template(); predefine 'id' and 'Class' as typedefs; rename 'temp_type' to 'type'; disable debug hooks for duration of function; fix GNU runtime messenger signatures to correspond to reality; forward-declare '__objc_exec_class' for the GNU runtime; call build_selector_table_decl(); in ObjC++ mode, generate 'extern "C" { ... }' wrappers around synthesized declarations; call build_protocol_template() and build_category_template(). (string_hash, string_eq): New functions. (objc_build_string_object): Check metaclass correctness only once; store string literals in hash table. (objc_build_constructor): Do not convert initializer elements; adjust for ObjC++ impedance mismatch. (build_objc_symtab_template): Call create_field_decl() instead of create_builtin_decl(). (init_objc_symtab): Add missing conversion to initializer element. (build_metadata_decl): Call start_var_decl() instead of define_decl(). (generate_objc_symtab_decl): Do not call build_category_template(); call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(). (build_module_descriptor): Call create_field_decl() instead of grokfield(); call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(); always mark module descriptor as used; move GNU runtime-specific functionality to build_module_initializer_routine(). (build_module_initializer_routine): New function, broken off of build_module_descriptor(). (objc_static_init_needed_p, objc_generate_static_init_call): New functions. (generate_static_references, generate_strings, build_selector_translation_table, generate_descriptor_table, generate_ivars_list, generate_dispatch_table, generate_category): Call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(); build a type directly instead of via groktypename(). (build_selector_reference_decl, build_selector_table_decl, build_class_reference_decl, build_protocol_reference, generate_objc_image_info): Call start_var_decl() instead of build_decl(). (build_selector_reference): For GNU runtime, do not call build_selector_reference_decl(). (build_selector, build_typed_selector_reference): Always convert result to the selector type. (add_objc_string): Cast return value to 'char *'. (build_method_prototype_template, build_selector_template, build_method_template): Use actual selector type for fields pointing to selectors. (finish_objc): For GNU runtime, call build_module_initializer_routine() after build_module_descriptor(). (generate_protocol_list, generate_shared_structures): Call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(); build a type directly instead of via groktypename(). (synth_id_with_class_suffix): Return a string. (get_arg_type_list): For instance methods, use the instance type for 'self'; do not call groktypename_in_parm_context(). (build_objc_string_decl): Squash redeclaration errors in ObjC++. (objc_is_class_name): Use OBJC_TYPE_NAME instead of TYPE_NAME; handle RECORD_TYPEs in ObjC as well as ObjC++. (objc_is_id): New function. (objc_is_object_ptr): Return the canonical type node. (objc_get_class_ivars): Simplify using get_class_ivars(). (get_class_ivars): Remove second parameter; create a fresh copy of the ivar list for each call; do not check for existence of super class. (objc_eh_runtime_type): Mark #ifndef OBJCPLUS. (objc_init_exceptions): When using SJLJ-style exceptions, require the use of '-fobjc-exceptions' flag; do not require it for DWARF-style exceptions. (objc_build_exc_ptr, next_sjlj_build_try_catch_finally): Use objc_object_type instead of objc_id_type. (objc_begin_catch_clause): Convert the incoming PARM_DECL into a VAR_DECL before placing it in the appropriate scope; do not call define_decl(); adjust call to c_begin_compound_stmt(); use objc_object_type instead of objc_id_type. (build_next_objc_exception_stuff): Call create_field_decl() instead of create_builtin_decl(); construct type directly instead of calling groktypename(); use OBJC_VOID_AT_END to mark end of function parameters. (build_private_template): Adjust call to get_class_ivars(); build a type directly instead of via groktypename(). (build_protocol_template, build_method_prototype_list_template, build_method_prototype_template, build_category_template, build_selector_template, build_class_template, build_super_template, build_ivar_template, build_ivar_list_template, build_method_list_template, build_method_template): Call create_field_decl() instead of grokfield(). (objc_method_parm_type): Do not call groktypename(). (generate_descriptor_table): Call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(). (generate_method_descriptors, build_protocol_initializer, generate_dispatch_tables, build_category_initializer, build_shared_structure_initializer): Do not call groktypename(). (generate_protocols): Call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(); do not call groktypename(). (error_with_ivar): Remove last parameter. (check_ivars): Do not iterate ovar CLASS_RAW_IVARS lists in addition to CLASS_IVARS lists; adjust calls to error_with_ivar(). (generate_ivar_lists): Convert one of the initializer elements; do not call groktypename(). (get_arg_type_list, start_method_def, gen_method_def): Account for new representation of variable arguments and '...' in Objective-C methods; add Objective-C++ impedance matching code. (is_objc_type_qualifier): Remove function. (adjust_type_for_id_default): Simplify; there is no longer a need to wade through declspecs. (lookup_interface, start_class, continue_class, finish_class, start_method_def, start_protocol, build_method_decl, objc_add_method, add_instance_variable, build_ivar_reference, is_ivar, is_private, get_super_receiver, objc_build_finally_epilogue): Make into static functions. (receiver_is_class_object): Use new IS_CLASS() macro. (objc_build_message_expr): Tweak ObjC++ message argument handling; call objc_finish_message_expr() instead of finish_message_expr(). (finish_message_expr): Rename to objc_finish_message_expr(); use OBJC_TYPE_NAME and OBJC_SET_TYPE_NAME macros instead of TYPE_NAME. call gen_type_name() instead of gen_declaration(); call objc_is_id() instead of using IS_ID and IS_CLASS; Use objc_class_name instead of calling get_identifier("Class"); handle CONVERT_EXPRs in receiver. (build_objc_method_call, warn_with_method): Do not call groktypename(). (build_ivar_reference): Call convert() instead of clobbering in a type. (hash_init): Initialize string_htab hash table. (add_instance_variable): Simplify parameter list; do not call grokfield(); do not populate CLASS_IVARS list. (start_class): Check for the existence of super class, if one was specified. (continue_class): Use CLASS_RAW_IVARS rather than CLASS_IVARS; do not call build_class_template(); adjust call to get_class_ivars(); call build_decl(), pushdecl() and finish_decl() instead of define_decl(). (finish_class): Call build_decl(), pushdecl() and finish_decl() instead of define_decl(). (add_protocols): Use PROTOCOL_BINFO_ELTS for the tree vector size. (start_protocol): Do not call build_protocol_template(); use PROTOCOL_BINFO_ELTS for the tree vector size. (encode_type_qualifiers): Do not handle the 'const' qualifier here. (encode_pointer): Encode 'const char *' as 'r*', for backwards compatibility. (encode_array): Use HOST_WIDE_INT_PRINT_DEC instead of "%ld". (encode_type): Handle the 'const' qualifier here. (objc_parmlist): New global variable, sued by objc_push_parm and objc_get_parm_info(). (objc_push_parm, objc_get_parm_info): New functions. (objc_expr_last): Remove function. (synth_self_and_ucmd_args): For instance methods, use the instance type for 'self'; call objc_push_parm() instead of push_parm_decl(). (start_method_def): Do not call push_scope(), declare_parm_level(), pop_scope(), push_parm_decl(), store_parm_decls() or objc_expr_last(); just use objc_push_parm() and objc_get_parm_info(). (comp_method_with_proto): Remove function. (objc_types_are_equivalent): Strip away indirections before comparing underlying types. (comp_proto_with_proto): Do not call groktypename(); types are no longer in raw declspec format. (objc_start_function): New function. (really_start_method): Call comp_proto_with_proto() instead of comp_method_with_proto(); call objc_start_function() instead of hand-crafting a function declarator. (continue_method_def, objc_expand_function_end): Remove functions. (get_super_receiver): Call objc_get_current_scope() instead of get_current_scope(); reference 'super_class' field (instead of 'class'). (finish_method_def): Rename to objc_finish_method_definition() and add a function decl parameter; move method encoding call from objc_expand_function_end(). (is_complex_decl, adorn_decl, gen_declarator, gen_declspecs, gen_declaration_1): Remove functions. (tmpbuf, RAW_DECLSPEC): Remove. (gen_declaration): Remove second parameter; simplify to deal with TYPE_P nodes instead of raw declspecs. (gen_type_name, gen_type_name_0): New functions. (gen_method_decl): Remove second parameter; call gen_type_name() instead of gen_declaration_1(). (dump_interface): Adjust calls to gen_declaration() and gen_method_decl(); do not allocate a separate string buffer. (init_objc): Allocate a larger string buffer to accommodate dump_interface(); adjust call to build_module_descriptor(); add call to build_module_initializer_routine() for the GNU runtime. (generate_classref_translation_entry): Do not call start_decl(); call finish_var_decl() instead of finish_decl(); call convert() instead of build_c_cast(). * objc-act.h (CLASS_OWN_IVARS): Remove accessor. (CLASS_BINFO_ELTS): Reduce from 6 to 5, now that CLASS_OWN_IVARS is gone. (OCTI_GNU_INIT_DECL, GNU_INIT_decl): New. (OCTI_ELLIPSIS_NODE, objc_ellipsis_node): Remove. (OCTI_ID_ID, id_type, objc_id_id): Rename to OCTI_ID_NAME, objc_object_type and objc_object_name, respectively. (OCTI_CLS_REF, OCTI_CLASS_NAME, objc_class_reference, objc_class_name): New. (IS_CLASS): New macro. (IS_ID, IS_SUPER): Robustify. (OCTI_EXECCLASS_DECL, execclass_decl): New. (finish_file, start_class, continue_class, finish_class, start_method_def, continue_method_def, finish_method_def, start_protocol, finish_protocol, objc_build_throw_stmt, objc_build_try_catch_finally_stmt, objc_build_synchronized_prologue, objc_build_synchronized_epilogue, objc_build_try_prologue, objc_build_try_epilogue, objc_build_catch_stmt, objc_build_catch_epilogue, objc_build_finally_prologue, objc_build_finally_epilogue, is_ivar, is_private, is_public, add_instance_variable, objc_add_method, get_super_receiver, objc_clear_super_receiver, get_class_ivars_from_name, get_class_reference, get_static_reference, get_object_reference, build_message_expr, finish_message_expr, build_selector_expr, build_ivar_reference, build_keyword_decl, build_method_decl, build_protocol_expr, build_objc_string_object, objc_declare_alias, objc_declare_class, objc_declare_protocols, objc_comptypes, objc_check_decl, build_encode_expr): Remove prototypes. (imp_count, cat_count): Make GGC-aware. (OBJC_SET_TYPE_NAME): New macro. From-SVN: r87168
2004-09-08 02:49:44 +02:00
/* struct _objc_selector {
SEL sel_id;
char *sel_type;
}; */
static void
build_selector_template (void)
{
Makefile.in (c-parse.o): Depend on $(C_COMMON_H). [gcc/ChangeLog] 2004-09-07 Ziemowit Laski <zlaski@apple.com> * Makefile.in (c-parse.o): Depend on $(C_COMMON_H). * c-parse.in: Include c-common.h instead of objc-act.h. (ivar_decl_list, ivar_decls, ivar_decl, ivars, ivar_declarator, myparms, myparm): Remove %type declarations. (methodtype, optparms, OBJC_TYPE_QUAL, objc_quals, objc_qual, objc_typename, objc_try_catch_stmt, optellipsis): Add %type declarations. (objc_inherit_code, objc_public_flag): Remove. (typespec_nonreserved_nonattr): Call objc_get_protocol_qualified_type() instead of get_static_reference() and get_protocol_reference(). (stmt_nocomp): Call grokparm() on @catch parameter. (objcdef): Move semantic action to objc_finish_implementation(). (classdef): Move semantic action to objc_start_class_interface(), objc_continue_interface(), objc_finish_interface(), objc_start_class_implementation(), objc_continue_implementation(), objc_start_category_interface() and objc_start_category_implementation(). (protocoldef): Move semantic actions to objc_start_protocol() and objc_finish_interface(). (ivar_decl_list): Remove nonterminal. (visibility_spec): Move semantic actions to objc_set_visibility(). (ivar_decls): Remove assignment to $$. (ivar_decl): Rephrase in terms of component_decl; call objc_add_instance_variable(). (ivars, ivar_declarator): Remove nonterminals. (opt_semi): New nonterminal. (methodtype): Remove semantic actions. (methoddef): Move semantic actions to objc_set_method_type(), objc_start_method_definition() and objc_finish_method_definition(). (methodproto): Move semantic actions to objc_set_method_type() and objc_add_method_declaration(). (methoddecl): Use objc_typename instead of typename; move semantic actions to objc_build_method_signature(). (optarglist, myxdecls, mydecl, myparms, myparm): Remove nonterminals. (optparmlist): Express in terms of optparms and optellipsis. (optparms, optellipsis, objc_qual, objc_quals, objc_typename): New nonterminals. (keyworddecl): Use objc_typename instead of typename. (rid_to_yy): Mark RID_IN, RID_OUT, RID_INOUT, RID_BYCOPY, RID_BYREF and RID_ONEWAY as returning OBJC_TYPE_QUAL to yyparse(). [gcc/objc/ChangeLog] 2004-09-07 Ziemowit Laski <zlaski@apple.com> * Make-lang.in (objc/objc-parse.o): Depend on $(C_COMMON_H) instead of objc/objc-act.h. (objc/objc-act.o): Depend on $(HASHTAB_H). * objc-act.c: Include hashtab.h; in ObjC++ mode, include cp-tree.h and objcp-decl.h instead of c-tree.h. (build_module_descriptor, get_class_ivars, synth_id_with_class_suffix, error_with_ivar, gen_method_decl, gen_declaration, setup_string_decl, build_protocol_template): Adjust prototypes. (build_module_initializer_routine, start_class, continue_class, finish_class, start_method_def, objc_start_function, start_protocol, build_method_decl, objc_add_method, add_instance_variable, build_ivar_reference, is_ivar, is_private, get_super_receiver, build_selector_table_decl, objc_push_parm, objc_get_parm_info, gen_type_name, gen_type_name_0, start_var_decl, finish_var_decl, create_field_decl): New prototypes. (objc_expand_function_end, comp_method_with_proto, objc_expr_last, gen_declaration_1, gen_declarator, is_complex_decl, adorn_decl, define_decl, create_builtin_decl, gen_declspecs): Remove prototypes. (TYPE_ID): Rename to OBJECT_TYPEDEF_NAME. (CLASS_TYPEDEF_NAME): New. (TAG_EXECCLASS): Change from a global variable to a #define. (TAG_RETURN_STRUCT): Delete. (TAG_GNUINIT): New, holds '__objc_gnu_init' name. (objc_inherit_code, objc_public_flag): New, moved from c-parse.in. (string_descriptor): New struct. (string_htab): New hash table. (string_hash, string_eq): New prototypes. (generate_struct_by_value_array): Call create_field_decl() instead of create_builtin_decl(). (objc_init): Do not initialize objc_ellipsis_node or TAG_EXECCLASS; In ObjC++ mode, call cxx_init() instead of c_objc_common_init(). (objc_finish_file): In ObjC++, call instantiate_pending_templates() and cp_finish_file(). (define_decl, get_static_reference, get_protocol_reference, create_builtin_decl): Remove functions. (objc_start_class_interface, objc_start_category_interface, objc_start_protocol, objc_continue_interface, objc_finish_interface, objc_start_class_implementation, objc_start_category_implementation, objc_continue_implementation, objc_finish_implementation, objc_set_visibility, objc_set_method_type, objc_build_method_signature, objc_add_method_declaration, objc_start_method_definition, objc_add_instance_variable, objc_get_protocol_qualified_type, create_field_decl, start_var_decl, finish_var_decl): New functions. (setup_string_decl): Simplify since it is only called once. (synth_module_prologue): Call build_class_template(); predefine 'id' and 'Class' as typedefs; rename 'temp_type' to 'type'; disable debug hooks for duration of function; fix GNU runtime messenger signatures to correspond to reality; forward-declare '__objc_exec_class' for the GNU runtime; call build_selector_table_decl(); in ObjC++ mode, generate 'extern "C" { ... }' wrappers around synthesized declarations; call build_protocol_template() and build_category_template(). (string_hash, string_eq): New functions. (objc_build_string_object): Check metaclass correctness only once; store string literals in hash table. (objc_build_constructor): Do not convert initializer elements; adjust for ObjC++ impedance mismatch. (build_objc_symtab_template): Call create_field_decl() instead of create_builtin_decl(). (init_objc_symtab): Add missing conversion to initializer element. (build_metadata_decl): Call start_var_decl() instead of define_decl(). (generate_objc_symtab_decl): Do not call build_category_template(); call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(). (build_module_descriptor): Call create_field_decl() instead of grokfield(); call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(); always mark module descriptor as used; move GNU runtime-specific functionality to build_module_initializer_routine(). (build_module_initializer_routine): New function, broken off of build_module_descriptor(). (objc_static_init_needed_p, objc_generate_static_init_call): New functions. (generate_static_references, generate_strings, build_selector_translation_table, generate_descriptor_table, generate_ivars_list, generate_dispatch_table, generate_category): Call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(); build a type directly instead of via groktypename(). (build_selector_reference_decl, build_selector_table_decl, build_class_reference_decl, build_protocol_reference, generate_objc_image_info): Call start_var_decl() instead of build_decl(). (build_selector_reference): For GNU runtime, do not call build_selector_reference_decl(). (build_selector, build_typed_selector_reference): Always convert result to the selector type. (add_objc_string): Cast return value to 'char *'. (build_method_prototype_template, build_selector_template, build_method_template): Use actual selector type for fields pointing to selectors. (finish_objc): For GNU runtime, call build_module_initializer_routine() after build_module_descriptor(). (generate_protocol_list, generate_shared_structures): Call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(); build a type directly instead of via groktypename(). (synth_id_with_class_suffix): Return a string. (get_arg_type_list): For instance methods, use the instance type for 'self'; do not call groktypename_in_parm_context(). (build_objc_string_decl): Squash redeclaration errors in ObjC++. (objc_is_class_name): Use OBJC_TYPE_NAME instead of TYPE_NAME; handle RECORD_TYPEs in ObjC as well as ObjC++. (objc_is_id): New function. (objc_is_object_ptr): Return the canonical type node. (objc_get_class_ivars): Simplify using get_class_ivars(). (get_class_ivars): Remove second parameter; create a fresh copy of the ivar list for each call; do not check for existence of super class. (objc_eh_runtime_type): Mark #ifndef OBJCPLUS. (objc_init_exceptions): When using SJLJ-style exceptions, require the use of '-fobjc-exceptions' flag; do not require it for DWARF-style exceptions. (objc_build_exc_ptr, next_sjlj_build_try_catch_finally): Use objc_object_type instead of objc_id_type. (objc_begin_catch_clause): Convert the incoming PARM_DECL into a VAR_DECL before placing it in the appropriate scope; do not call define_decl(); adjust call to c_begin_compound_stmt(); use objc_object_type instead of objc_id_type. (build_next_objc_exception_stuff): Call create_field_decl() instead of create_builtin_decl(); construct type directly instead of calling groktypename(); use OBJC_VOID_AT_END to mark end of function parameters. (build_private_template): Adjust call to get_class_ivars(); build a type directly instead of via groktypename(). (build_protocol_template, build_method_prototype_list_template, build_method_prototype_template, build_category_template, build_selector_template, build_class_template, build_super_template, build_ivar_template, build_ivar_list_template, build_method_list_template, build_method_template): Call create_field_decl() instead of grokfield(). (objc_method_parm_type): Do not call groktypename(). (generate_descriptor_table): Call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(). (generate_method_descriptors, build_protocol_initializer, generate_dispatch_tables, build_category_initializer, build_shared_structure_initializer): Do not call groktypename(). (generate_protocols): Call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(); do not call groktypename(). (error_with_ivar): Remove last parameter. (check_ivars): Do not iterate ovar CLASS_RAW_IVARS lists in addition to CLASS_IVARS lists; adjust calls to error_with_ivar(). (generate_ivar_lists): Convert one of the initializer elements; do not call groktypename(). (get_arg_type_list, start_method_def, gen_method_def): Account for new representation of variable arguments and '...' in Objective-C methods; add Objective-C++ impedance matching code. (is_objc_type_qualifier): Remove function. (adjust_type_for_id_default): Simplify; there is no longer a need to wade through declspecs. (lookup_interface, start_class, continue_class, finish_class, start_method_def, start_protocol, build_method_decl, objc_add_method, add_instance_variable, build_ivar_reference, is_ivar, is_private, get_super_receiver, objc_build_finally_epilogue): Make into static functions. (receiver_is_class_object): Use new IS_CLASS() macro. (objc_build_message_expr): Tweak ObjC++ message argument handling; call objc_finish_message_expr() instead of finish_message_expr(). (finish_message_expr): Rename to objc_finish_message_expr(); use OBJC_TYPE_NAME and OBJC_SET_TYPE_NAME macros instead of TYPE_NAME. call gen_type_name() instead of gen_declaration(); call objc_is_id() instead of using IS_ID and IS_CLASS; Use objc_class_name instead of calling get_identifier("Class"); handle CONVERT_EXPRs in receiver. (build_objc_method_call, warn_with_method): Do not call groktypename(). (build_ivar_reference): Call convert() instead of clobbering in a type. (hash_init): Initialize string_htab hash table. (add_instance_variable): Simplify parameter list; do not call grokfield(); do not populate CLASS_IVARS list. (start_class): Check for the existence of super class, if one was specified. (continue_class): Use CLASS_RAW_IVARS rather than CLASS_IVARS; do not call build_class_template(); adjust call to get_class_ivars(); call build_decl(), pushdecl() and finish_decl() instead of define_decl(). (finish_class): Call build_decl(), pushdecl() and finish_decl() instead of define_decl(). (add_protocols): Use PROTOCOL_BINFO_ELTS for the tree vector size. (start_protocol): Do not call build_protocol_template(); use PROTOCOL_BINFO_ELTS for the tree vector size. (encode_type_qualifiers): Do not handle the 'const' qualifier here. (encode_pointer): Encode 'const char *' as 'r*', for backwards compatibility. (encode_array): Use HOST_WIDE_INT_PRINT_DEC instead of "%ld". (encode_type): Handle the 'const' qualifier here. (objc_parmlist): New global variable, sued by objc_push_parm and objc_get_parm_info(). (objc_push_parm, objc_get_parm_info): New functions. (objc_expr_last): Remove function. (synth_self_and_ucmd_args): For instance methods, use the instance type for 'self'; call objc_push_parm() instead of push_parm_decl(). (start_method_def): Do not call push_scope(), declare_parm_level(), pop_scope(), push_parm_decl(), store_parm_decls() or objc_expr_last(); just use objc_push_parm() and objc_get_parm_info(). (comp_method_with_proto): Remove function. (objc_types_are_equivalent): Strip away indirections before comparing underlying types. (comp_proto_with_proto): Do not call groktypename(); types are no longer in raw declspec format. (objc_start_function): New function. (really_start_method): Call comp_proto_with_proto() instead of comp_method_with_proto(); call objc_start_function() instead of hand-crafting a function declarator. (continue_method_def, objc_expand_function_end): Remove functions. (get_super_receiver): Call objc_get_current_scope() instead of get_current_scope(); reference 'super_class' field (instead of 'class'). (finish_method_def): Rename to objc_finish_method_definition() and add a function decl parameter; move method encoding call from objc_expand_function_end(). (is_complex_decl, adorn_decl, gen_declarator, gen_declspecs, gen_declaration_1): Remove functions. (tmpbuf, RAW_DECLSPEC): Remove. (gen_declaration): Remove second parameter; simplify to deal with TYPE_P nodes instead of raw declspecs. (gen_type_name, gen_type_name_0): New functions. (gen_method_decl): Remove second parameter; call gen_type_name() instead of gen_declaration_1(). (dump_interface): Adjust calls to gen_declaration() and gen_method_decl(); do not allocate a separate string buffer. (init_objc): Allocate a larger string buffer to accommodate dump_interface(); adjust call to build_module_descriptor(); add call to build_module_initializer_routine() for the GNU runtime. (generate_classref_translation_entry): Do not call start_decl(); call finish_var_decl() instead of finish_decl(); call convert() instead of build_c_cast(). * objc-act.h (CLASS_OWN_IVARS): Remove accessor. (CLASS_BINFO_ELTS): Reduce from 6 to 5, now that CLASS_OWN_IVARS is gone. (OCTI_GNU_INIT_DECL, GNU_INIT_decl): New. (OCTI_ELLIPSIS_NODE, objc_ellipsis_node): Remove. (OCTI_ID_ID, id_type, objc_id_id): Rename to OCTI_ID_NAME, objc_object_type and objc_object_name, respectively. (OCTI_CLS_REF, OCTI_CLASS_NAME, objc_class_reference, objc_class_name): New. (IS_CLASS): New macro. (IS_ID, IS_SUPER): Robustify. (OCTI_EXECCLASS_DECL, execclass_decl): New. (finish_file, start_class, continue_class, finish_class, start_method_def, continue_method_def, finish_method_def, start_protocol, finish_protocol, objc_build_throw_stmt, objc_build_try_catch_finally_stmt, objc_build_synchronized_prologue, objc_build_synchronized_epilogue, objc_build_try_prologue, objc_build_try_epilogue, objc_build_catch_stmt, objc_build_catch_epilogue, objc_build_finally_prologue, objc_build_finally_epilogue, is_ivar, is_private, is_public, add_instance_variable, objc_add_method, get_super_receiver, objc_clear_super_receiver, get_class_ivars_from_name, get_class_reference, get_static_reference, get_object_reference, build_message_expr, finish_message_expr, build_selector_expr, build_ivar_reference, build_keyword_decl, build_method_decl, build_protocol_expr, build_objc_string_object, objc_declare_alias, objc_declare_class, objc_declare_protocols, objc_comptypes, objc_check_decl, build_encode_expr): Remove prototypes. (imp_count, cat_count): Make GGC-aware. (OBJC_SET_TYPE_NAME): New macro. From-SVN: r87168
2004-09-08 02:49:44 +02:00
tree field_decl, field_decl_chain;
objc_selector_template
= start_struct (RECORD_TYPE, get_identifier (UTAG_SELECTOR));
Makefile.in (c-parse.o): Depend on $(C_COMMON_H). [gcc/ChangeLog] 2004-09-07 Ziemowit Laski <zlaski@apple.com> * Makefile.in (c-parse.o): Depend on $(C_COMMON_H). * c-parse.in: Include c-common.h instead of objc-act.h. (ivar_decl_list, ivar_decls, ivar_decl, ivars, ivar_declarator, myparms, myparm): Remove %type declarations. (methodtype, optparms, OBJC_TYPE_QUAL, objc_quals, objc_qual, objc_typename, objc_try_catch_stmt, optellipsis): Add %type declarations. (objc_inherit_code, objc_public_flag): Remove. (typespec_nonreserved_nonattr): Call objc_get_protocol_qualified_type() instead of get_static_reference() and get_protocol_reference(). (stmt_nocomp): Call grokparm() on @catch parameter. (objcdef): Move semantic action to objc_finish_implementation(). (classdef): Move semantic action to objc_start_class_interface(), objc_continue_interface(), objc_finish_interface(), objc_start_class_implementation(), objc_continue_implementation(), objc_start_category_interface() and objc_start_category_implementation(). (protocoldef): Move semantic actions to objc_start_protocol() and objc_finish_interface(). (ivar_decl_list): Remove nonterminal. (visibility_spec): Move semantic actions to objc_set_visibility(). (ivar_decls): Remove assignment to $$. (ivar_decl): Rephrase in terms of component_decl; call objc_add_instance_variable(). (ivars, ivar_declarator): Remove nonterminals. (opt_semi): New nonterminal. (methodtype): Remove semantic actions. (methoddef): Move semantic actions to objc_set_method_type(), objc_start_method_definition() and objc_finish_method_definition(). (methodproto): Move semantic actions to objc_set_method_type() and objc_add_method_declaration(). (methoddecl): Use objc_typename instead of typename; move semantic actions to objc_build_method_signature(). (optarglist, myxdecls, mydecl, myparms, myparm): Remove nonterminals. (optparmlist): Express in terms of optparms and optellipsis. (optparms, optellipsis, objc_qual, objc_quals, objc_typename): New nonterminals. (keyworddecl): Use objc_typename instead of typename. (rid_to_yy): Mark RID_IN, RID_OUT, RID_INOUT, RID_BYCOPY, RID_BYREF and RID_ONEWAY as returning OBJC_TYPE_QUAL to yyparse(). [gcc/objc/ChangeLog] 2004-09-07 Ziemowit Laski <zlaski@apple.com> * Make-lang.in (objc/objc-parse.o): Depend on $(C_COMMON_H) instead of objc/objc-act.h. (objc/objc-act.o): Depend on $(HASHTAB_H). * objc-act.c: Include hashtab.h; in ObjC++ mode, include cp-tree.h and objcp-decl.h instead of c-tree.h. (build_module_descriptor, get_class_ivars, synth_id_with_class_suffix, error_with_ivar, gen_method_decl, gen_declaration, setup_string_decl, build_protocol_template): Adjust prototypes. (build_module_initializer_routine, start_class, continue_class, finish_class, start_method_def, objc_start_function, start_protocol, build_method_decl, objc_add_method, add_instance_variable, build_ivar_reference, is_ivar, is_private, get_super_receiver, build_selector_table_decl, objc_push_parm, objc_get_parm_info, gen_type_name, gen_type_name_0, start_var_decl, finish_var_decl, create_field_decl): New prototypes. (objc_expand_function_end, comp_method_with_proto, objc_expr_last, gen_declaration_1, gen_declarator, is_complex_decl, adorn_decl, define_decl, create_builtin_decl, gen_declspecs): Remove prototypes. (TYPE_ID): Rename to OBJECT_TYPEDEF_NAME. (CLASS_TYPEDEF_NAME): New. (TAG_EXECCLASS): Change from a global variable to a #define. (TAG_RETURN_STRUCT): Delete. (TAG_GNUINIT): New, holds '__objc_gnu_init' name. (objc_inherit_code, objc_public_flag): New, moved from c-parse.in. (string_descriptor): New struct. (string_htab): New hash table. (string_hash, string_eq): New prototypes. (generate_struct_by_value_array): Call create_field_decl() instead of create_builtin_decl(). (objc_init): Do not initialize objc_ellipsis_node or TAG_EXECCLASS; In ObjC++ mode, call cxx_init() instead of c_objc_common_init(). (objc_finish_file): In ObjC++, call instantiate_pending_templates() and cp_finish_file(). (define_decl, get_static_reference, get_protocol_reference, create_builtin_decl): Remove functions. (objc_start_class_interface, objc_start_category_interface, objc_start_protocol, objc_continue_interface, objc_finish_interface, objc_start_class_implementation, objc_start_category_implementation, objc_continue_implementation, objc_finish_implementation, objc_set_visibility, objc_set_method_type, objc_build_method_signature, objc_add_method_declaration, objc_start_method_definition, objc_add_instance_variable, objc_get_protocol_qualified_type, create_field_decl, start_var_decl, finish_var_decl): New functions. (setup_string_decl): Simplify since it is only called once. (synth_module_prologue): Call build_class_template(); predefine 'id' and 'Class' as typedefs; rename 'temp_type' to 'type'; disable debug hooks for duration of function; fix GNU runtime messenger signatures to correspond to reality; forward-declare '__objc_exec_class' for the GNU runtime; call build_selector_table_decl(); in ObjC++ mode, generate 'extern "C" { ... }' wrappers around synthesized declarations; call build_protocol_template() and build_category_template(). (string_hash, string_eq): New functions. (objc_build_string_object): Check metaclass correctness only once; store string literals in hash table. (objc_build_constructor): Do not convert initializer elements; adjust for ObjC++ impedance mismatch. (build_objc_symtab_template): Call create_field_decl() instead of create_builtin_decl(). (init_objc_symtab): Add missing conversion to initializer element. (build_metadata_decl): Call start_var_decl() instead of define_decl(). (generate_objc_symtab_decl): Do not call build_category_template(); call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(). (build_module_descriptor): Call create_field_decl() instead of grokfield(); call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(); always mark module descriptor as used; move GNU runtime-specific functionality to build_module_initializer_routine(). (build_module_initializer_routine): New function, broken off of build_module_descriptor(). (objc_static_init_needed_p, objc_generate_static_init_call): New functions. (generate_static_references, generate_strings, build_selector_translation_table, generate_descriptor_table, generate_ivars_list, generate_dispatch_table, generate_category): Call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(); build a type directly instead of via groktypename(). (build_selector_reference_decl, build_selector_table_decl, build_class_reference_decl, build_protocol_reference, generate_objc_image_info): Call start_var_decl() instead of build_decl(). (build_selector_reference): For GNU runtime, do not call build_selector_reference_decl(). (build_selector, build_typed_selector_reference): Always convert result to the selector type. (add_objc_string): Cast return value to 'char *'. (build_method_prototype_template, build_selector_template, build_method_template): Use actual selector type for fields pointing to selectors. (finish_objc): For GNU runtime, call build_module_initializer_routine() after build_module_descriptor(). (generate_protocol_list, generate_shared_structures): Call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(); build a type directly instead of via groktypename(). (synth_id_with_class_suffix): Return a string. (get_arg_type_list): For instance methods, use the instance type for 'self'; do not call groktypename_in_parm_context(). (build_objc_string_decl): Squash redeclaration errors in ObjC++. (objc_is_class_name): Use OBJC_TYPE_NAME instead of TYPE_NAME; handle RECORD_TYPEs in ObjC as well as ObjC++. (objc_is_id): New function. (objc_is_object_ptr): Return the canonical type node. (objc_get_class_ivars): Simplify using get_class_ivars(). (get_class_ivars): Remove second parameter; create a fresh copy of the ivar list for each call; do not check for existence of super class. (objc_eh_runtime_type): Mark #ifndef OBJCPLUS. (objc_init_exceptions): When using SJLJ-style exceptions, require the use of '-fobjc-exceptions' flag; do not require it for DWARF-style exceptions. (objc_build_exc_ptr, next_sjlj_build_try_catch_finally): Use objc_object_type instead of objc_id_type. (objc_begin_catch_clause): Convert the incoming PARM_DECL into a VAR_DECL before placing it in the appropriate scope; do not call define_decl(); adjust call to c_begin_compound_stmt(); use objc_object_type instead of objc_id_type. (build_next_objc_exception_stuff): Call create_field_decl() instead of create_builtin_decl(); construct type directly instead of calling groktypename(); use OBJC_VOID_AT_END to mark end of function parameters. (build_private_template): Adjust call to get_class_ivars(); build a type directly instead of via groktypename(). (build_protocol_template, build_method_prototype_list_template, build_method_prototype_template, build_category_template, build_selector_template, build_class_template, build_super_template, build_ivar_template, build_ivar_list_template, build_method_list_template, build_method_template): Call create_field_decl() instead of grokfield(). (objc_method_parm_type): Do not call groktypename(). (generate_descriptor_table): Call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(). (generate_method_descriptors, build_protocol_initializer, generate_dispatch_tables, build_category_initializer, build_shared_structure_initializer): Do not call groktypename(). (generate_protocols): Call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(); do not call groktypename(). (error_with_ivar): Remove last parameter. (check_ivars): Do not iterate ovar CLASS_RAW_IVARS lists in addition to CLASS_IVARS lists; adjust calls to error_with_ivar(). (generate_ivar_lists): Convert one of the initializer elements; do not call groktypename(). (get_arg_type_list, start_method_def, gen_method_def): Account for new representation of variable arguments and '...' in Objective-C methods; add Objective-C++ impedance matching code. (is_objc_type_qualifier): Remove function. (adjust_type_for_id_default): Simplify; there is no longer a need to wade through declspecs. (lookup_interface, start_class, continue_class, finish_class, start_method_def, start_protocol, build_method_decl, objc_add_method, add_instance_variable, build_ivar_reference, is_ivar, is_private, get_super_receiver, objc_build_finally_epilogue): Make into static functions. (receiver_is_class_object): Use new IS_CLASS() macro. (objc_build_message_expr): Tweak ObjC++ message argument handling; call objc_finish_message_expr() instead of finish_message_expr(). (finish_message_expr): Rename to objc_finish_message_expr(); use OBJC_TYPE_NAME and OBJC_SET_TYPE_NAME macros instead of TYPE_NAME. call gen_type_name() instead of gen_declaration(); call objc_is_id() instead of using IS_ID and IS_CLASS; Use objc_class_name instead of calling get_identifier("Class"); handle CONVERT_EXPRs in receiver. (build_objc_method_call, warn_with_method): Do not call groktypename(). (build_ivar_reference): Call convert() instead of clobbering in a type. (hash_init): Initialize string_htab hash table. (add_instance_variable): Simplify parameter list; do not call grokfield(); do not populate CLASS_IVARS list. (start_class): Check for the existence of super class, if one was specified. (continue_class): Use CLASS_RAW_IVARS rather than CLASS_IVARS; do not call build_class_template(); adjust call to get_class_ivars(); call build_decl(), pushdecl() and finish_decl() instead of define_decl(). (finish_class): Call build_decl(), pushdecl() and finish_decl() instead of define_decl(). (add_protocols): Use PROTOCOL_BINFO_ELTS for the tree vector size. (start_protocol): Do not call build_protocol_template(); use PROTOCOL_BINFO_ELTS for the tree vector size. (encode_type_qualifiers): Do not handle the 'const' qualifier here. (encode_pointer): Encode 'const char *' as 'r*', for backwards compatibility. (encode_array): Use HOST_WIDE_INT_PRINT_DEC instead of "%ld". (encode_type): Handle the 'const' qualifier here. (objc_parmlist): New global variable, sued by objc_push_parm and objc_get_parm_info(). (objc_push_parm, objc_get_parm_info): New functions. (objc_expr_last): Remove function. (synth_self_and_ucmd_args): For instance methods, use the instance type for 'self'; call objc_push_parm() instead of push_parm_decl(). (start_method_def): Do not call push_scope(), declare_parm_level(), pop_scope(), push_parm_decl(), store_parm_decls() or objc_expr_last(); just use objc_push_parm() and objc_get_parm_info(). (comp_method_with_proto): Remove function. (objc_types_are_equivalent): Strip away indirections before comparing underlying types. (comp_proto_with_proto): Do not call groktypename(); types are no longer in raw declspec format. (objc_start_function): New function. (really_start_method): Call comp_proto_with_proto() instead of comp_method_with_proto(); call objc_start_function() instead of hand-crafting a function declarator. (continue_method_def, objc_expand_function_end): Remove functions. (get_super_receiver): Call objc_get_current_scope() instead of get_current_scope(); reference 'super_class' field (instead of 'class'). (finish_method_def): Rename to objc_finish_method_definition() and add a function decl parameter; move method encoding call from objc_expand_function_end(). (is_complex_decl, adorn_decl, gen_declarator, gen_declspecs, gen_declaration_1): Remove functions. (tmpbuf, RAW_DECLSPEC): Remove. (gen_declaration): Remove second parameter; simplify to deal with TYPE_P nodes instead of raw declspecs. (gen_type_name, gen_type_name_0): New functions. (gen_method_decl): Remove second parameter; call gen_type_name() instead of gen_declaration_1(). (dump_interface): Adjust calls to gen_declaration() and gen_method_decl(); do not allocate a separate string buffer. (init_objc): Allocate a larger string buffer to accommodate dump_interface(); adjust call to build_module_descriptor(); add call to build_module_initializer_routine() for the GNU runtime. (generate_classref_translation_entry): Do not call start_decl(); call finish_var_decl() instead of finish_decl(); call convert() instead of build_c_cast(). * objc-act.h (CLASS_OWN_IVARS): Remove accessor. (CLASS_BINFO_ELTS): Reduce from 6 to 5, now that CLASS_OWN_IVARS is gone. (OCTI_GNU_INIT_DECL, GNU_INIT_decl): New. (OCTI_ELLIPSIS_NODE, objc_ellipsis_node): Remove. (OCTI_ID_ID, id_type, objc_id_id): Rename to OCTI_ID_NAME, objc_object_type and objc_object_name, respectively. (OCTI_CLS_REF, OCTI_CLASS_NAME, objc_class_reference, objc_class_name): New. (IS_CLASS): New macro. (IS_ID, IS_SUPER): Robustify. (OCTI_EXECCLASS_DECL, execclass_decl): New. (finish_file, start_class, continue_class, finish_class, start_method_def, continue_method_def, finish_method_def, start_protocol, finish_protocol, objc_build_throw_stmt, objc_build_try_catch_finally_stmt, objc_build_synchronized_prologue, objc_build_synchronized_epilogue, objc_build_try_prologue, objc_build_try_epilogue, objc_build_catch_stmt, objc_build_catch_epilogue, objc_build_finally_prologue, objc_build_finally_epilogue, is_ivar, is_private, is_public, add_instance_variable, objc_add_method, get_super_receiver, objc_clear_super_receiver, get_class_ivars_from_name, get_class_reference, get_static_reference, get_object_reference, build_message_expr, finish_message_expr, build_selector_expr, build_ivar_reference, build_keyword_decl, build_method_decl, build_protocol_expr, build_objc_string_object, objc_declare_alias, objc_declare_class, objc_declare_protocols, objc_comptypes, objc_check_decl, build_encode_expr): Remove prototypes. (imp_count, cat_count): Make GGC-aware. (OBJC_SET_TYPE_NAME): New macro. From-SVN: r87168
2004-09-08 02:49:44 +02:00
/* SEL sel_id; */
field_decl = create_field_decl (objc_selector_type, "sel_id");
field_decl_chain = field_decl;
/* char *sel_type; */
Makefile.in (c-parse.o): Depend on $(C_COMMON_H). [gcc/ChangeLog] 2004-09-07 Ziemowit Laski <zlaski@apple.com> * Makefile.in (c-parse.o): Depend on $(C_COMMON_H). * c-parse.in: Include c-common.h instead of objc-act.h. (ivar_decl_list, ivar_decls, ivar_decl, ivars, ivar_declarator, myparms, myparm): Remove %type declarations. (methodtype, optparms, OBJC_TYPE_QUAL, objc_quals, objc_qual, objc_typename, objc_try_catch_stmt, optellipsis): Add %type declarations. (objc_inherit_code, objc_public_flag): Remove. (typespec_nonreserved_nonattr): Call objc_get_protocol_qualified_type() instead of get_static_reference() and get_protocol_reference(). (stmt_nocomp): Call grokparm() on @catch parameter. (objcdef): Move semantic action to objc_finish_implementation(). (classdef): Move semantic action to objc_start_class_interface(), objc_continue_interface(), objc_finish_interface(), objc_start_class_implementation(), objc_continue_implementation(), objc_start_category_interface() and objc_start_category_implementation(). (protocoldef): Move semantic actions to objc_start_protocol() and objc_finish_interface(). (ivar_decl_list): Remove nonterminal. (visibility_spec): Move semantic actions to objc_set_visibility(). (ivar_decls): Remove assignment to $$. (ivar_decl): Rephrase in terms of component_decl; call objc_add_instance_variable(). (ivars, ivar_declarator): Remove nonterminals. (opt_semi): New nonterminal. (methodtype): Remove semantic actions. (methoddef): Move semantic actions to objc_set_method_type(), objc_start_method_definition() and objc_finish_method_definition(). (methodproto): Move semantic actions to objc_set_method_type() and objc_add_method_declaration(). (methoddecl): Use objc_typename instead of typename; move semantic actions to objc_build_method_signature(). (optarglist, myxdecls, mydecl, myparms, myparm): Remove nonterminals. (optparmlist): Express in terms of optparms and optellipsis. (optparms, optellipsis, objc_qual, objc_quals, objc_typename): New nonterminals. (keyworddecl): Use objc_typename instead of typename. (rid_to_yy): Mark RID_IN, RID_OUT, RID_INOUT, RID_BYCOPY, RID_BYREF and RID_ONEWAY as returning OBJC_TYPE_QUAL to yyparse(). [gcc/objc/ChangeLog] 2004-09-07 Ziemowit Laski <zlaski@apple.com> * Make-lang.in (objc/objc-parse.o): Depend on $(C_COMMON_H) instead of objc/objc-act.h. (objc/objc-act.o): Depend on $(HASHTAB_H). * objc-act.c: Include hashtab.h; in ObjC++ mode, include cp-tree.h and objcp-decl.h instead of c-tree.h. (build_module_descriptor, get_class_ivars, synth_id_with_class_suffix, error_with_ivar, gen_method_decl, gen_declaration, setup_string_decl, build_protocol_template): Adjust prototypes. (build_module_initializer_routine, start_class, continue_class, finish_class, start_method_def, objc_start_function, start_protocol, build_method_decl, objc_add_method, add_instance_variable, build_ivar_reference, is_ivar, is_private, get_super_receiver, build_selector_table_decl, objc_push_parm, objc_get_parm_info, gen_type_name, gen_type_name_0, start_var_decl, finish_var_decl, create_field_decl): New prototypes. (objc_expand_function_end, comp_method_with_proto, objc_expr_last, gen_declaration_1, gen_declarator, is_complex_decl, adorn_decl, define_decl, create_builtin_decl, gen_declspecs): Remove prototypes. (TYPE_ID): Rename to OBJECT_TYPEDEF_NAME. (CLASS_TYPEDEF_NAME): New. (TAG_EXECCLASS): Change from a global variable to a #define. (TAG_RETURN_STRUCT): Delete. (TAG_GNUINIT): New, holds '__objc_gnu_init' name. (objc_inherit_code, objc_public_flag): New, moved from c-parse.in. (string_descriptor): New struct. (string_htab): New hash table. (string_hash, string_eq): New prototypes. (generate_struct_by_value_array): Call create_field_decl() instead of create_builtin_decl(). (objc_init): Do not initialize objc_ellipsis_node or TAG_EXECCLASS; In ObjC++ mode, call cxx_init() instead of c_objc_common_init(). (objc_finish_file): In ObjC++, call instantiate_pending_templates() and cp_finish_file(). (define_decl, get_static_reference, get_protocol_reference, create_builtin_decl): Remove functions. (objc_start_class_interface, objc_start_category_interface, objc_start_protocol, objc_continue_interface, objc_finish_interface, objc_start_class_implementation, objc_start_category_implementation, objc_continue_implementation, objc_finish_implementation, objc_set_visibility, objc_set_method_type, objc_build_method_signature, objc_add_method_declaration, objc_start_method_definition, objc_add_instance_variable, objc_get_protocol_qualified_type, create_field_decl, start_var_decl, finish_var_decl): New functions. (setup_string_decl): Simplify since it is only called once. (synth_module_prologue): Call build_class_template(); predefine 'id' and 'Class' as typedefs; rename 'temp_type' to 'type'; disable debug hooks for duration of function; fix GNU runtime messenger signatures to correspond to reality; forward-declare '__objc_exec_class' for the GNU runtime; call build_selector_table_decl(); in ObjC++ mode, generate 'extern "C" { ... }' wrappers around synthesized declarations; call build_protocol_template() and build_category_template(). (string_hash, string_eq): New functions. (objc_build_string_object): Check metaclass correctness only once; store string literals in hash table. (objc_build_constructor): Do not convert initializer elements; adjust for ObjC++ impedance mismatch. (build_objc_symtab_template): Call create_field_decl() instead of create_builtin_decl(). (init_objc_symtab): Add missing conversion to initializer element. (build_metadata_decl): Call start_var_decl() instead of define_decl(). (generate_objc_symtab_decl): Do not call build_category_template(); call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(). (build_module_descriptor): Call create_field_decl() instead of grokfield(); call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(); always mark module descriptor as used; move GNU runtime-specific functionality to build_module_initializer_routine(). (build_module_initializer_routine): New function, broken off of build_module_descriptor(). (objc_static_init_needed_p, objc_generate_static_init_call): New functions. (generate_static_references, generate_strings, build_selector_translation_table, generate_descriptor_table, generate_ivars_list, generate_dispatch_table, generate_category): Call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(); build a type directly instead of via groktypename(). (build_selector_reference_decl, build_selector_table_decl, build_class_reference_decl, build_protocol_reference, generate_objc_image_info): Call start_var_decl() instead of build_decl(). (build_selector_reference): For GNU runtime, do not call build_selector_reference_decl(). (build_selector, build_typed_selector_reference): Always convert result to the selector type. (add_objc_string): Cast return value to 'char *'. (build_method_prototype_template, build_selector_template, build_method_template): Use actual selector type for fields pointing to selectors. (finish_objc): For GNU runtime, call build_module_initializer_routine() after build_module_descriptor(). (generate_protocol_list, generate_shared_structures): Call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(); build a type directly instead of via groktypename(). (synth_id_with_class_suffix): Return a string. (get_arg_type_list): For instance methods, use the instance type for 'self'; do not call groktypename_in_parm_context(). (build_objc_string_decl): Squash redeclaration errors in ObjC++. (objc_is_class_name): Use OBJC_TYPE_NAME instead of TYPE_NAME; handle RECORD_TYPEs in ObjC as well as ObjC++. (objc_is_id): New function. (objc_is_object_ptr): Return the canonical type node. (objc_get_class_ivars): Simplify using get_class_ivars(). (get_class_ivars): Remove second parameter; create a fresh copy of the ivar list for each call; do not check for existence of super class. (objc_eh_runtime_type): Mark #ifndef OBJCPLUS. (objc_init_exceptions): When using SJLJ-style exceptions, require the use of '-fobjc-exceptions' flag; do not require it for DWARF-style exceptions. (objc_build_exc_ptr, next_sjlj_build_try_catch_finally): Use objc_object_type instead of objc_id_type. (objc_begin_catch_clause): Convert the incoming PARM_DECL into a VAR_DECL before placing it in the appropriate scope; do not call define_decl(); adjust call to c_begin_compound_stmt(); use objc_object_type instead of objc_id_type. (build_next_objc_exception_stuff): Call create_field_decl() instead of create_builtin_decl(); construct type directly instead of calling groktypename(); use OBJC_VOID_AT_END to mark end of function parameters. (build_private_template): Adjust call to get_class_ivars(); build a type directly instead of via groktypename(). (build_protocol_template, build_method_prototype_list_template, build_method_prototype_template, build_category_template, build_selector_template, build_class_template, build_super_template, build_ivar_template, build_ivar_list_template, build_method_list_template, build_method_template): Call create_field_decl() instead of grokfield(). (objc_method_parm_type): Do not call groktypename(). (generate_descriptor_table): Call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(). (generate_method_descriptors, build_protocol_initializer, generate_dispatch_tables, build_category_initializer, build_shared_structure_initializer): Do not call groktypename(). (generate_protocols): Call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(); do not call groktypename(). (error_with_ivar): Remove last parameter. (check_ivars): Do not iterate ovar CLASS_RAW_IVARS lists in addition to CLASS_IVARS lists; adjust calls to error_with_ivar(). (generate_ivar_lists): Convert one of the initializer elements; do not call groktypename(). (get_arg_type_list, start_method_def, gen_method_def): Account for new representation of variable arguments and '...' in Objective-C methods; add Objective-C++ impedance matching code. (is_objc_type_qualifier): Remove function. (adjust_type_for_id_default): Simplify; there is no longer a need to wade through declspecs. (lookup_interface, start_class, continue_class, finish_class, start_method_def, start_protocol, build_method_decl, objc_add_method, add_instance_variable, build_ivar_reference, is_ivar, is_private, get_super_receiver, objc_build_finally_epilogue): Make into static functions. (receiver_is_class_object): Use new IS_CLASS() macro. (objc_build_message_expr): Tweak ObjC++ message argument handling; call objc_finish_message_expr() instead of finish_message_expr(). (finish_message_expr): Rename to objc_finish_message_expr(); use OBJC_TYPE_NAME and OBJC_SET_TYPE_NAME macros instead of TYPE_NAME. call gen_type_name() instead of gen_declaration(); call objc_is_id() instead of using IS_ID and IS_CLASS; Use objc_class_name instead of calling get_identifier("Class"); handle CONVERT_EXPRs in receiver. (build_objc_method_call, warn_with_method): Do not call groktypename(). (build_ivar_reference): Call convert() instead of clobbering in a type. (hash_init): Initialize string_htab hash table. (add_instance_variable): Simplify parameter list; do not call grokfield(); do not populate CLASS_IVARS list. (start_class): Check for the existence of super class, if one was specified. (continue_class): Use CLASS_RAW_IVARS rather than CLASS_IVARS; do not call build_class_template(); adjust call to get_class_ivars(); call build_decl(), pushdecl() and finish_decl() instead of define_decl(). (finish_class): Call build_decl(), pushdecl() and finish_decl() instead of define_decl(). (add_protocols): Use PROTOCOL_BINFO_ELTS for the tree vector size. (start_protocol): Do not call build_protocol_template(); use PROTOCOL_BINFO_ELTS for the tree vector size. (encode_type_qualifiers): Do not handle the 'const' qualifier here. (encode_pointer): Encode 'const char *' as 'r*', for backwards compatibility. (encode_array): Use HOST_WIDE_INT_PRINT_DEC instead of "%ld". (encode_type): Handle the 'const' qualifier here. (objc_parmlist): New global variable, sued by objc_push_parm and objc_get_parm_info(). (objc_push_parm, objc_get_parm_info): New functions. (objc_expr_last): Remove function. (synth_self_and_ucmd_args): For instance methods, use the instance type for 'self'; call objc_push_parm() instead of push_parm_decl(). (start_method_def): Do not call push_scope(), declare_parm_level(), pop_scope(), push_parm_decl(), store_parm_decls() or objc_expr_last(); just use objc_push_parm() and objc_get_parm_info(). (comp_method_with_proto): Remove function. (objc_types_are_equivalent): Strip away indirections before comparing underlying types. (comp_proto_with_proto): Do not call groktypename(); types are no longer in raw declspec format. (objc_start_function): New function. (really_start_method): Call comp_proto_with_proto() instead of comp_method_with_proto(); call objc_start_function() instead of hand-crafting a function declarator. (continue_method_def, objc_expand_function_end): Remove functions. (get_super_receiver): Call objc_get_current_scope() instead of get_current_scope(); reference 'super_class' field (instead of 'class'). (finish_method_def): Rename to objc_finish_method_definition() and add a function decl parameter; move method encoding call from objc_expand_function_end(). (is_complex_decl, adorn_decl, gen_declarator, gen_declspecs, gen_declaration_1): Remove functions. (tmpbuf, RAW_DECLSPEC): Remove. (gen_declaration): Remove second parameter; simplify to deal with TYPE_P nodes instead of raw declspecs. (gen_type_name, gen_type_name_0): New functions. (gen_method_decl): Remove second parameter; call gen_type_name() instead of gen_declaration_1(). (dump_interface): Adjust calls to gen_declaration() and gen_method_decl(); do not allocate a separate string buffer. (init_objc): Allocate a larger string buffer to accommodate dump_interface(); adjust call to build_module_descriptor(); add call to build_module_initializer_routine() for the GNU runtime. (generate_classref_translation_entry): Do not call start_decl(); call finish_var_decl() instead of finish_decl(); call convert() instead of build_c_cast(). * objc-act.h (CLASS_OWN_IVARS): Remove accessor. (CLASS_BINFO_ELTS): Reduce from 6 to 5, now that CLASS_OWN_IVARS is gone. (OCTI_GNU_INIT_DECL, GNU_INIT_decl): New. (OCTI_ELLIPSIS_NODE, objc_ellipsis_node): Remove. (OCTI_ID_ID, id_type, objc_id_id): Rename to OCTI_ID_NAME, objc_object_type and objc_object_name, respectively. (OCTI_CLS_REF, OCTI_CLASS_NAME, objc_class_reference, objc_class_name): New. (IS_CLASS): New macro. (IS_ID, IS_SUPER): Robustify. (OCTI_EXECCLASS_DECL, execclass_decl): New. (finish_file, start_class, continue_class, finish_class, start_method_def, continue_method_def, finish_method_def, start_protocol, finish_protocol, objc_build_throw_stmt, objc_build_try_catch_finally_stmt, objc_build_synchronized_prologue, objc_build_synchronized_epilogue, objc_build_try_prologue, objc_build_try_epilogue, objc_build_catch_stmt, objc_build_catch_epilogue, objc_build_finally_prologue, objc_build_finally_epilogue, is_ivar, is_private, is_public, add_instance_variable, objc_add_method, get_super_receiver, objc_clear_super_receiver, get_class_ivars_from_name, get_class_reference, get_static_reference, get_object_reference, build_message_expr, finish_message_expr, build_selector_expr, build_ivar_reference, build_keyword_decl, build_method_decl, build_protocol_expr, build_objc_string_object, objc_declare_alias, objc_declare_class, objc_declare_protocols, objc_comptypes, objc_check_decl, build_encode_expr): Remove prototypes. (imp_count, cat_count): Make GGC-aware. (OBJC_SET_TYPE_NAME): New macro. From-SVN: r87168
2004-09-08 02:49:44 +02:00
field_decl = create_field_decl (string_type_node, "sel_type");
chainon (field_decl_chain, field_decl);
finish_struct (objc_selector_template, field_decl_chain, NULL_TREE);
}
Makefile.in (c-parse.o): Depend on $(C_COMMON_H). [gcc/ChangeLog] 2004-09-07 Ziemowit Laski <zlaski@apple.com> * Makefile.in (c-parse.o): Depend on $(C_COMMON_H). * c-parse.in: Include c-common.h instead of objc-act.h. (ivar_decl_list, ivar_decls, ivar_decl, ivars, ivar_declarator, myparms, myparm): Remove %type declarations. (methodtype, optparms, OBJC_TYPE_QUAL, objc_quals, objc_qual, objc_typename, objc_try_catch_stmt, optellipsis): Add %type declarations. (objc_inherit_code, objc_public_flag): Remove. (typespec_nonreserved_nonattr): Call objc_get_protocol_qualified_type() instead of get_static_reference() and get_protocol_reference(). (stmt_nocomp): Call grokparm() on @catch parameter. (objcdef): Move semantic action to objc_finish_implementation(). (classdef): Move semantic action to objc_start_class_interface(), objc_continue_interface(), objc_finish_interface(), objc_start_class_implementation(), objc_continue_implementation(), objc_start_category_interface() and objc_start_category_implementation(). (protocoldef): Move semantic actions to objc_start_protocol() and objc_finish_interface(). (ivar_decl_list): Remove nonterminal. (visibility_spec): Move semantic actions to objc_set_visibility(). (ivar_decls): Remove assignment to $$. (ivar_decl): Rephrase in terms of component_decl; call objc_add_instance_variable(). (ivars, ivar_declarator): Remove nonterminals. (opt_semi): New nonterminal. (methodtype): Remove semantic actions. (methoddef): Move semantic actions to objc_set_method_type(), objc_start_method_definition() and objc_finish_method_definition(). (methodproto): Move semantic actions to objc_set_method_type() and objc_add_method_declaration(). (methoddecl): Use objc_typename instead of typename; move semantic actions to objc_build_method_signature(). (optarglist, myxdecls, mydecl, myparms, myparm): Remove nonterminals. (optparmlist): Express in terms of optparms and optellipsis. (optparms, optellipsis, objc_qual, objc_quals, objc_typename): New nonterminals. (keyworddecl): Use objc_typename instead of typename. (rid_to_yy): Mark RID_IN, RID_OUT, RID_INOUT, RID_BYCOPY, RID_BYREF and RID_ONEWAY as returning OBJC_TYPE_QUAL to yyparse(). [gcc/objc/ChangeLog] 2004-09-07 Ziemowit Laski <zlaski@apple.com> * Make-lang.in (objc/objc-parse.o): Depend on $(C_COMMON_H) instead of objc/objc-act.h. (objc/objc-act.o): Depend on $(HASHTAB_H). * objc-act.c: Include hashtab.h; in ObjC++ mode, include cp-tree.h and objcp-decl.h instead of c-tree.h. (build_module_descriptor, get_class_ivars, synth_id_with_class_suffix, error_with_ivar, gen_method_decl, gen_declaration, setup_string_decl, build_protocol_template): Adjust prototypes. (build_module_initializer_routine, start_class, continue_class, finish_class, start_method_def, objc_start_function, start_protocol, build_method_decl, objc_add_method, add_instance_variable, build_ivar_reference, is_ivar, is_private, get_super_receiver, build_selector_table_decl, objc_push_parm, objc_get_parm_info, gen_type_name, gen_type_name_0, start_var_decl, finish_var_decl, create_field_decl): New prototypes. (objc_expand_function_end, comp_method_with_proto, objc_expr_last, gen_declaration_1, gen_declarator, is_complex_decl, adorn_decl, define_decl, create_builtin_decl, gen_declspecs): Remove prototypes. (TYPE_ID): Rename to OBJECT_TYPEDEF_NAME. (CLASS_TYPEDEF_NAME): New. (TAG_EXECCLASS): Change from a global variable to a #define. (TAG_RETURN_STRUCT): Delete. (TAG_GNUINIT): New, holds '__objc_gnu_init' name. (objc_inherit_code, objc_public_flag): New, moved from c-parse.in. (string_descriptor): New struct. (string_htab): New hash table. (string_hash, string_eq): New prototypes. (generate_struct_by_value_array): Call create_field_decl() instead of create_builtin_decl(). (objc_init): Do not initialize objc_ellipsis_node or TAG_EXECCLASS; In ObjC++ mode, call cxx_init() instead of c_objc_common_init(). (objc_finish_file): In ObjC++, call instantiate_pending_templates() and cp_finish_file(). (define_decl, get_static_reference, get_protocol_reference, create_builtin_decl): Remove functions. (objc_start_class_interface, objc_start_category_interface, objc_start_protocol, objc_continue_interface, objc_finish_interface, objc_start_class_implementation, objc_start_category_implementation, objc_continue_implementation, objc_finish_implementation, objc_set_visibility, objc_set_method_type, objc_build_method_signature, objc_add_method_declaration, objc_start_method_definition, objc_add_instance_variable, objc_get_protocol_qualified_type, create_field_decl, start_var_decl, finish_var_decl): New functions. (setup_string_decl): Simplify since it is only called once. (synth_module_prologue): Call build_class_template(); predefine 'id' and 'Class' as typedefs; rename 'temp_type' to 'type'; disable debug hooks for duration of function; fix GNU runtime messenger signatures to correspond to reality; forward-declare '__objc_exec_class' for the GNU runtime; call build_selector_table_decl(); in ObjC++ mode, generate 'extern "C" { ... }' wrappers around synthesized declarations; call build_protocol_template() and build_category_template(). (string_hash, string_eq): New functions. (objc_build_string_object): Check metaclass correctness only once; store string literals in hash table. (objc_build_constructor): Do not convert initializer elements; adjust for ObjC++ impedance mismatch. (build_objc_symtab_template): Call create_field_decl() instead of create_builtin_decl(). (init_objc_symtab): Add missing conversion to initializer element. (build_metadata_decl): Call start_var_decl() instead of define_decl(). (generate_objc_symtab_decl): Do not call build_category_template(); call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(). (build_module_descriptor): Call create_field_decl() instead of grokfield(); call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(); always mark module descriptor as used; move GNU runtime-specific functionality to build_module_initializer_routine(). (build_module_initializer_routine): New function, broken off of build_module_descriptor(). (objc_static_init_needed_p, objc_generate_static_init_call): New functions. (generate_static_references, generate_strings, build_selector_translation_table, generate_descriptor_table, generate_ivars_list, generate_dispatch_table, generate_category): Call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(); build a type directly instead of via groktypename(). (build_selector_reference_decl, build_selector_table_decl, build_class_reference_decl, build_protocol_reference, generate_objc_image_info): Call start_var_decl() instead of build_decl(). (build_selector_reference): For GNU runtime, do not call build_selector_reference_decl(). (build_selector, build_typed_selector_reference): Always convert result to the selector type. (add_objc_string): Cast return value to 'char *'. (build_method_prototype_template, build_selector_template, build_method_template): Use actual selector type for fields pointing to selectors. (finish_objc): For GNU runtime, call build_module_initializer_routine() after build_module_descriptor(). (generate_protocol_list, generate_shared_structures): Call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(); build a type directly instead of via groktypename(). (synth_id_with_class_suffix): Return a string. (get_arg_type_list): For instance methods, use the instance type for 'self'; do not call groktypename_in_parm_context(). (build_objc_string_decl): Squash redeclaration errors in ObjC++. (objc_is_class_name): Use OBJC_TYPE_NAME instead of TYPE_NAME; handle RECORD_TYPEs in ObjC as well as ObjC++. (objc_is_id): New function. (objc_is_object_ptr): Return the canonical type node. (objc_get_class_ivars): Simplify using get_class_ivars(). (get_class_ivars): Remove second parameter; create a fresh copy of the ivar list for each call; do not check for existence of super class. (objc_eh_runtime_type): Mark #ifndef OBJCPLUS. (objc_init_exceptions): When using SJLJ-style exceptions, require the use of '-fobjc-exceptions' flag; do not require it for DWARF-style exceptions. (objc_build_exc_ptr, next_sjlj_build_try_catch_finally): Use objc_object_type instead of objc_id_type. (objc_begin_catch_clause): Convert the incoming PARM_DECL into a VAR_DECL before placing it in the appropriate scope; do not call define_decl(); adjust call to c_begin_compound_stmt(); use objc_object_type instead of objc_id_type. (build_next_objc_exception_stuff): Call create_field_decl() instead of create_builtin_decl(); construct type directly instead of calling groktypename(); use OBJC_VOID_AT_END to mark end of function parameters. (build_private_template): Adjust call to get_class_ivars(); build a type directly instead of via groktypename(). (build_protocol_template, build_method_prototype_list_template, build_method_prototype_template, build_category_template, build_selector_template, build_class_template, build_super_template, build_ivar_template, build_ivar_list_template, build_method_list_template, build_method_template): Call create_field_decl() instead of grokfield(). (objc_method_parm_type): Do not call groktypename(). (generate_descriptor_table): Call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(). (generate_method_descriptors, build_protocol_initializer, generate_dispatch_tables, build_category_initializer, build_shared_structure_initializer): Do not call groktypename(). (generate_protocols): Call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(); do not call groktypename(). (error_with_ivar): Remove last parameter. (check_ivars): Do not iterate ovar CLASS_RAW_IVARS lists in addition to CLASS_IVARS lists; adjust calls to error_with_ivar(). (generate_ivar_lists): Convert one of the initializer elements; do not call groktypename(). (get_arg_type_list, start_method_def, gen_method_def): Account for new representation of variable arguments and '...' in Objective-C methods; add Objective-C++ impedance matching code. (is_objc_type_qualifier): Remove function. (adjust_type_for_id_default): Simplify; there is no longer a need to wade through declspecs. (lookup_interface, start_class, continue_class, finish_class, start_method_def, start_protocol, build_method_decl, objc_add_method, add_instance_variable, build_ivar_reference, is_ivar, is_private, get_super_receiver, objc_build_finally_epilogue): Make into static functions. (receiver_is_class_object): Use new IS_CLASS() macro. (objc_build_message_expr): Tweak ObjC++ message argument handling; call objc_finish_message_expr() instead of finish_message_expr(). (finish_message_expr): Rename to objc_finish_message_expr(); use OBJC_TYPE_NAME and OBJC_SET_TYPE_NAME macros instead of TYPE_NAME. call gen_type_name() instead of gen_declaration(); call objc_is_id() instead of using IS_ID and IS_CLASS; Use objc_class_name instead of calling get_identifier("Class"); handle CONVERT_EXPRs in receiver. (build_objc_method_call, warn_with_method): Do not call groktypename(). (build_ivar_reference): Call convert() instead of clobbering in a type. (hash_init): Initialize string_htab hash table. (add_instance_variable): Simplify parameter list; do not call grokfield(); do not populate CLASS_IVARS list. (start_class): Check for the existence of super class, if one was specified. (continue_class): Use CLASS_RAW_IVARS rather than CLASS_IVARS; do not call build_class_template(); adjust call to get_class_ivars(); call build_decl(), pushdecl() and finish_decl() instead of define_decl(). (finish_class): Call build_decl(), pushdecl() and finish_decl() instead of define_decl(). (add_protocols): Use PROTOCOL_BINFO_ELTS for the tree vector size. (start_protocol): Do not call build_protocol_template(); use PROTOCOL_BINFO_ELTS for the tree vector size. (encode_type_qualifiers): Do not handle the 'const' qualifier here. (encode_pointer): Encode 'const char *' as 'r*', for backwards compatibility. (encode_array): Use HOST_WIDE_INT_PRINT_DEC instead of "%ld". (encode_type): Handle the 'const' qualifier here. (objc_parmlist): New global variable, sued by objc_push_parm and objc_get_parm_info(). (objc_push_parm, objc_get_parm_info): New functions. (objc_expr_last): Remove function. (synth_self_and_ucmd_args): For instance methods, use the instance type for 'self'; call objc_push_parm() instead of push_parm_decl(). (start_method_def): Do not call push_scope(), declare_parm_level(), pop_scope(), push_parm_decl(), store_parm_decls() or objc_expr_last(); just use objc_push_parm() and objc_get_parm_info(). (comp_method_with_proto): Remove function. (objc_types_are_equivalent): Strip away indirections before comparing underlying types. (comp_proto_with_proto): Do not call groktypename(); types are no longer in raw declspec format. (objc_start_function): New function. (really_start_method): Call comp_proto_with_proto() instead of comp_method_with_proto(); call objc_start_function() instead of hand-crafting a function declarator. (continue_method_def, objc_expand_function_end): Remove functions. (get_super_receiver): Call objc_get_current_scope() instead of get_current_scope(); reference 'super_class' field (instead of 'class'). (finish_method_def): Rename to objc_finish_method_definition() and add a function decl parameter; move method encoding call from objc_expand_function_end(). (is_complex_decl, adorn_decl, gen_declarator, gen_declspecs, gen_declaration_1): Remove functions. (tmpbuf, RAW_DECLSPEC): Remove. (gen_declaration): Remove second parameter; simplify to deal with TYPE_P nodes instead of raw declspecs. (gen_type_name, gen_type_name_0): New functions. (gen_method_decl): Remove second parameter; call gen_type_name() instead of gen_declaration_1(). (dump_interface): Adjust calls to gen_declaration() and gen_method_decl(); do not allocate a separate string buffer. (init_objc): Allocate a larger string buffer to accommodate dump_interface(); adjust call to build_module_descriptor(); add call to build_module_initializer_routine() for the GNU runtime. (generate_classref_translation_entry): Do not call start_decl(); call finish_var_decl() instead of finish_decl(); call convert() instead of build_c_cast(). * objc-act.h (CLASS_OWN_IVARS): Remove accessor. (CLASS_BINFO_ELTS): Reduce from 6 to 5, now that CLASS_OWN_IVARS is gone. (OCTI_GNU_INIT_DECL, GNU_INIT_decl): New. (OCTI_ELLIPSIS_NODE, objc_ellipsis_node): Remove. (OCTI_ID_ID, id_type, objc_id_id): Rename to OCTI_ID_NAME, objc_object_type and objc_object_name, respectively. (OCTI_CLS_REF, OCTI_CLASS_NAME, objc_class_reference, objc_class_name): New. (IS_CLASS): New macro. (IS_ID, IS_SUPER): Robustify. (OCTI_EXECCLASS_DECL, execclass_decl): New. (finish_file, start_class, continue_class, finish_class, start_method_def, continue_method_def, finish_method_def, start_protocol, finish_protocol, objc_build_throw_stmt, objc_build_try_catch_finally_stmt, objc_build_synchronized_prologue, objc_build_synchronized_epilogue, objc_build_try_prologue, objc_build_try_epilogue, objc_build_catch_stmt, objc_build_catch_epilogue, objc_build_finally_prologue, objc_build_finally_epilogue, is_ivar, is_private, is_public, add_instance_variable, objc_add_method, get_super_receiver, objc_clear_super_receiver, get_class_ivars_from_name, get_class_reference, get_static_reference, get_object_reference, build_message_expr, finish_message_expr, build_selector_expr, build_ivar_reference, build_keyword_decl, build_method_decl, build_protocol_expr, build_objc_string_object, objc_declare_alias, objc_declare_class, objc_declare_protocols, objc_comptypes, objc_check_decl, build_encode_expr): Remove prototypes. (imp_count, cat_count): Make GGC-aware. (OBJC_SET_TYPE_NAME): New macro. From-SVN: r87168
2004-09-08 02:49:44 +02:00
/* struct _objc_class {
struct _objc_class *isa;
struct _objc_class *super_class;
char *name;
long version;
long info;
long instance_size;
Makefile.in (c-parse.o): Depend on $(C_COMMON_H). [gcc/ChangeLog] 2004-09-07 Ziemowit Laski <zlaski@apple.com> * Makefile.in (c-parse.o): Depend on $(C_COMMON_H). * c-parse.in: Include c-common.h instead of objc-act.h. (ivar_decl_list, ivar_decls, ivar_decl, ivars, ivar_declarator, myparms, myparm): Remove %type declarations. (methodtype, optparms, OBJC_TYPE_QUAL, objc_quals, objc_qual, objc_typename, objc_try_catch_stmt, optellipsis): Add %type declarations. (objc_inherit_code, objc_public_flag): Remove. (typespec_nonreserved_nonattr): Call objc_get_protocol_qualified_type() instead of get_static_reference() and get_protocol_reference(). (stmt_nocomp): Call grokparm() on @catch parameter. (objcdef): Move semantic action to objc_finish_implementation(). (classdef): Move semantic action to objc_start_class_interface(), objc_continue_interface(), objc_finish_interface(), objc_start_class_implementation(), objc_continue_implementation(), objc_start_category_interface() and objc_start_category_implementation(). (protocoldef): Move semantic actions to objc_start_protocol() and objc_finish_interface(). (ivar_decl_list): Remove nonterminal. (visibility_spec): Move semantic actions to objc_set_visibility(). (ivar_decls): Remove assignment to $$. (ivar_decl): Rephrase in terms of component_decl; call objc_add_instance_variable(). (ivars, ivar_declarator): Remove nonterminals. (opt_semi): New nonterminal. (methodtype): Remove semantic actions. (methoddef): Move semantic actions to objc_set_method_type(), objc_start_method_definition() and objc_finish_method_definition(). (methodproto): Move semantic actions to objc_set_method_type() and objc_add_method_declaration(). (methoddecl): Use objc_typename instead of typename; move semantic actions to objc_build_method_signature(). (optarglist, myxdecls, mydecl, myparms, myparm): Remove nonterminals. (optparmlist): Express in terms of optparms and optellipsis. (optparms, optellipsis, objc_qual, objc_quals, objc_typename): New nonterminals. (keyworddecl): Use objc_typename instead of typename. (rid_to_yy): Mark RID_IN, RID_OUT, RID_INOUT, RID_BYCOPY, RID_BYREF and RID_ONEWAY as returning OBJC_TYPE_QUAL to yyparse(). [gcc/objc/ChangeLog] 2004-09-07 Ziemowit Laski <zlaski@apple.com> * Make-lang.in (objc/objc-parse.o): Depend on $(C_COMMON_H) instead of objc/objc-act.h. (objc/objc-act.o): Depend on $(HASHTAB_H). * objc-act.c: Include hashtab.h; in ObjC++ mode, include cp-tree.h and objcp-decl.h instead of c-tree.h. (build_module_descriptor, get_class_ivars, synth_id_with_class_suffix, error_with_ivar, gen_method_decl, gen_declaration, setup_string_decl, build_protocol_template): Adjust prototypes. (build_module_initializer_routine, start_class, continue_class, finish_class, start_method_def, objc_start_function, start_protocol, build_method_decl, objc_add_method, add_instance_variable, build_ivar_reference, is_ivar, is_private, get_super_receiver, build_selector_table_decl, objc_push_parm, objc_get_parm_info, gen_type_name, gen_type_name_0, start_var_decl, finish_var_decl, create_field_decl): New prototypes. (objc_expand_function_end, comp_method_with_proto, objc_expr_last, gen_declaration_1, gen_declarator, is_complex_decl, adorn_decl, define_decl, create_builtin_decl, gen_declspecs): Remove prototypes. (TYPE_ID): Rename to OBJECT_TYPEDEF_NAME. (CLASS_TYPEDEF_NAME): New. (TAG_EXECCLASS): Change from a global variable to a #define. (TAG_RETURN_STRUCT): Delete. (TAG_GNUINIT): New, holds '__objc_gnu_init' name. (objc_inherit_code, objc_public_flag): New, moved from c-parse.in. (string_descriptor): New struct. (string_htab): New hash table. (string_hash, string_eq): New prototypes. (generate_struct_by_value_array): Call create_field_decl() instead of create_builtin_decl(). (objc_init): Do not initialize objc_ellipsis_node or TAG_EXECCLASS; In ObjC++ mode, call cxx_init() instead of c_objc_common_init(). (objc_finish_file): In ObjC++, call instantiate_pending_templates() and cp_finish_file(). (define_decl, get_static_reference, get_protocol_reference, create_builtin_decl): Remove functions. (objc_start_class_interface, objc_start_category_interface, objc_start_protocol, objc_continue_interface, objc_finish_interface, objc_start_class_implementation, objc_start_category_implementation, objc_continue_implementation, objc_finish_implementation, objc_set_visibility, objc_set_method_type, objc_build_method_signature, objc_add_method_declaration, objc_start_method_definition, objc_add_instance_variable, objc_get_protocol_qualified_type, create_field_decl, start_var_decl, finish_var_decl): New functions. (setup_string_decl): Simplify since it is only called once. (synth_module_prologue): Call build_class_template(); predefine 'id' and 'Class' as typedefs; rename 'temp_type' to 'type'; disable debug hooks for duration of function; fix GNU runtime messenger signatures to correspond to reality; forward-declare '__objc_exec_class' for the GNU runtime; call build_selector_table_decl(); in ObjC++ mode, generate 'extern "C" { ... }' wrappers around synthesized declarations; call build_protocol_template() and build_category_template(). (string_hash, string_eq): New functions. (objc_build_string_object): Check metaclass correctness only once; store string literals in hash table. (objc_build_constructor): Do not convert initializer elements; adjust for ObjC++ impedance mismatch. (build_objc_symtab_template): Call create_field_decl() instead of create_builtin_decl(). (init_objc_symtab): Add missing conversion to initializer element. (build_metadata_decl): Call start_var_decl() instead of define_decl(). (generate_objc_symtab_decl): Do not call build_category_template(); call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(). (build_module_descriptor): Call create_field_decl() instead of grokfield(); call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(); always mark module descriptor as used; move GNU runtime-specific functionality to build_module_initializer_routine(). (build_module_initializer_routine): New function, broken off of build_module_descriptor(). (objc_static_init_needed_p, objc_generate_static_init_call): New functions. (generate_static_references, generate_strings, build_selector_translation_table, generate_descriptor_table, generate_ivars_list, generate_dispatch_table, generate_category): Call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(); build a type directly instead of via groktypename(). (build_selector_reference_decl, build_selector_table_decl, build_class_reference_decl, build_protocol_reference, generate_objc_image_info): Call start_var_decl() instead of build_decl(). (build_selector_reference): For GNU runtime, do not call build_selector_reference_decl(). (build_selector, build_typed_selector_reference): Always convert result to the selector type. (add_objc_string): Cast return value to 'char *'. (build_method_prototype_template, build_selector_template, build_method_template): Use actual selector type for fields pointing to selectors. (finish_objc): For GNU runtime, call build_module_initializer_routine() after build_module_descriptor(). (generate_protocol_list, generate_shared_structures): Call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(); build a type directly instead of via groktypename(). (synth_id_with_class_suffix): Return a string. (get_arg_type_list): For instance methods, use the instance type for 'self'; do not call groktypename_in_parm_context(). (build_objc_string_decl): Squash redeclaration errors in ObjC++. (objc_is_class_name): Use OBJC_TYPE_NAME instead of TYPE_NAME; handle RECORD_TYPEs in ObjC as well as ObjC++. (objc_is_id): New function. (objc_is_object_ptr): Return the canonical type node. (objc_get_class_ivars): Simplify using get_class_ivars(). (get_class_ivars): Remove second parameter; create a fresh copy of the ivar list for each call; do not check for existence of super class. (objc_eh_runtime_type): Mark #ifndef OBJCPLUS. (objc_init_exceptions): When using SJLJ-style exceptions, require the use of '-fobjc-exceptions' flag; do not require it for DWARF-style exceptions. (objc_build_exc_ptr, next_sjlj_build_try_catch_finally): Use objc_object_type instead of objc_id_type. (objc_begin_catch_clause): Convert the incoming PARM_DECL into a VAR_DECL before placing it in the appropriate scope; do not call define_decl(); adjust call to c_begin_compound_stmt(); use objc_object_type instead of objc_id_type. (build_next_objc_exception_stuff): Call create_field_decl() instead of create_builtin_decl(); construct type directly instead of calling groktypename(); use OBJC_VOID_AT_END to mark end of function parameters. (build_private_template): Adjust call to get_class_ivars(); build a type directly instead of via groktypename(). (build_protocol_template, build_method_prototype_list_template, build_method_prototype_template, build_category_template, build_selector_template, build_class_template, build_super_template, build_ivar_template, build_ivar_list_template, build_method_list_template, build_method_template): Call create_field_decl() instead of grokfield(). (objc_method_parm_type): Do not call groktypename(). (generate_descriptor_table): Call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(). (generate_method_descriptors, build_protocol_initializer, generate_dispatch_tables, build_category_initializer, build_shared_structure_initializer): Do not call groktypename(). (generate_protocols): Call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(); do not call groktypename(). (error_with_ivar): Remove last parameter. (check_ivars): Do not iterate ovar CLASS_RAW_IVARS lists in addition to CLASS_IVARS lists; adjust calls to error_with_ivar(). (generate_ivar_lists): Convert one of the initializer elements; do not call groktypename(). (get_arg_type_list, start_method_def, gen_method_def): Account for new representation of variable arguments and '...' in Objective-C methods; add Objective-C++ impedance matching code. (is_objc_type_qualifier): Remove function. (adjust_type_for_id_default): Simplify; there is no longer a need to wade through declspecs. (lookup_interface, start_class, continue_class, finish_class, start_method_def, start_protocol, build_method_decl, objc_add_method, add_instance_variable, build_ivar_reference, is_ivar, is_private, get_super_receiver, objc_build_finally_epilogue): Make into static functions. (receiver_is_class_object): Use new IS_CLASS() macro. (objc_build_message_expr): Tweak ObjC++ message argument handling; call objc_finish_message_expr() instead of finish_message_expr(). (finish_message_expr): Rename to objc_finish_message_expr(); use OBJC_TYPE_NAME and OBJC_SET_TYPE_NAME macros instead of TYPE_NAME. call gen_type_name() instead of gen_declaration(); call objc_is_id() instead of using IS_ID and IS_CLASS; Use objc_class_name instead of calling get_identifier("Class"); handle CONVERT_EXPRs in receiver. (build_objc_method_call, warn_with_method): Do not call groktypename(). (build_ivar_reference): Call convert() instead of clobbering in a type. (hash_init): Initialize string_htab hash table. (add_instance_variable): Simplify parameter list; do not call grokfield(); do not populate CLASS_IVARS list. (start_class): Check for the existence of super class, if one was specified. (continue_class): Use CLASS_RAW_IVARS rather than CLASS_IVARS; do not call build_class_template(); adjust call to get_class_ivars(); call build_decl(), pushdecl() and finish_decl() instead of define_decl(). (finish_class): Call build_decl(), pushdecl() and finish_decl() instead of define_decl(). (add_protocols): Use PROTOCOL_BINFO_ELTS for the tree vector size. (start_protocol): Do not call build_protocol_template(); use PROTOCOL_BINFO_ELTS for the tree vector size. (encode_type_qualifiers): Do not handle the 'const' qualifier here. (encode_pointer): Encode 'const char *' as 'r*', for backwards compatibility. (encode_array): Use HOST_WIDE_INT_PRINT_DEC instead of "%ld". (encode_type): Handle the 'const' qualifier here. (objc_parmlist): New global variable, sued by objc_push_parm and objc_get_parm_info(). (objc_push_parm, objc_get_parm_info): New functions. (objc_expr_last): Remove function. (synth_self_and_ucmd_args): For instance methods, use the instance type for 'self'; call objc_push_parm() instead of push_parm_decl(). (start_method_def): Do not call push_scope(), declare_parm_level(), pop_scope(), push_parm_decl(), store_parm_decls() or objc_expr_last(); just use objc_push_parm() and objc_get_parm_info(). (comp_method_with_proto): Remove function. (objc_types_are_equivalent): Strip away indirections before comparing underlying types. (comp_proto_with_proto): Do not call groktypename(); types are no longer in raw declspec format. (objc_start_function): New function. (really_start_method): Call comp_proto_with_proto() instead of comp_method_with_proto(); call objc_start_function() instead of hand-crafting a function declarator. (continue_method_def, objc_expand_function_end): Remove functions. (get_super_receiver): Call objc_get_current_scope() instead of get_current_scope(); reference 'super_class' field (instead of 'class'). (finish_method_def): Rename to objc_finish_method_definition() and add a function decl parameter; move method encoding call from objc_expand_function_end(). (is_complex_decl, adorn_decl, gen_declarator, gen_declspecs, gen_declaration_1): Remove functions. (tmpbuf, RAW_DECLSPEC): Remove. (gen_declaration): Remove second parameter; simplify to deal with TYPE_P nodes instead of raw declspecs. (gen_type_name, gen_type_name_0): New functions. (gen_method_decl): Remove second parameter; call gen_type_name() instead of gen_declaration_1(). (dump_interface): Adjust calls to gen_declaration() and gen_method_decl(); do not allocate a separate string buffer. (init_objc): Allocate a larger string buffer to accommodate dump_interface(); adjust call to build_module_descriptor(); add call to build_module_initializer_routine() for the GNU runtime. (generate_classref_translation_entry): Do not call start_decl(); call finish_var_decl() instead of finish_decl(); call convert() instead of build_c_cast(). * objc-act.h (CLASS_OWN_IVARS): Remove accessor. (CLASS_BINFO_ELTS): Reduce from 6 to 5, now that CLASS_OWN_IVARS is gone. (OCTI_GNU_INIT_DECL, GNU_INIT_decl): New. (OCTI_ELLIPSIS_NODE, objc_ellipsis_node): Remove. (OCTI_ID_ID, id_type, objc_id_id): Rename to OCTI_ID_NAME, objc_object_type and objc_object_name, respectively. (OCTI_CLS_REF, OCTI_CLASS_NAME, objc_class_reference, objc_class_name): New. (IS_CLASS): New macro. (IS_ID, IS_SUPER): Robustify. (OCTI_EXECCLASS_DECL, execclass_decl): New. (finish_file, start_class, continue_class, finish_class, start_method_def, continue_method_def, finish_method_def, start_protocol, finish_protocol, objc_build_throw_stmt, objc_build_try_catch_finally_stmt, objc_build_synchronized_prologue, objc_build_synchronized_epilogue, objc_build_try_prologue, objc_build_try_epilogue, objc_build_catch_stmt, objc_build_catch_epilogue, objc_build_finally_prologue, objc_build_finally_epilogue, is_ivar, is_private, is_public, add_instance_variable, objc_add_method, get_super_receiver, objc_clear_super_receiver, get_class_ivars_from_name, get_class_reference, get_static_reference, get_object_reference, build_message_expr, finish_message_expr, build_selector_expr, build_ivar_reference, build_keyword_decl, build_method_decl, build_protocol_expr, build_objc_string_object, objc_declare_alias, objc_declare_class, objc_declare_protocols, objc_comptypes, objc_check_decl, build_encode_expr): Remove prototypes. (imp_count, cat_count): Make GGC-aware. (OBJC_SET_TYPE_NAME): New macro. From-SVN: r87168
2004-09-08 02:49:44 +02:00
struct _objc_ivar_list *ivars;
struct _objc_method_list *methods;
#ifdef __NEXT_RUNTIME__
struct objc_cache *cache;
Makefile.in (c-parse.o): Depend on $(C_COMMON_H). [gcc/ChangeLog] 2004-09-07 Ziemowit Laski <zlaski@apple.com> * Makefile.in (c-parse.o): Depend on $(C_COMMON_H). * c-parse.in: Include c-common.h instead of objc-act.h. (ivar_decl_list, ivar_decls, ivar_decl, ivars, ivar_declarator, myparms, myparm): Remove %type declarations. (methodtype, optparms, OBJC_TYPE_QUAL, objc_quals, objc_qual, objc_typename, objc_try_catch_stmt, optellipsis): Add %type declarations. (objc_inherit_code, objc_public_flag): Remove. (typespec_nonreserved_nonattr): Call objc_get_protocol_qualified_type() instead of get_static_reference() and get_protocol_reference(). (stmt_nocomp): Call grokparm() on @catch parameter. (objcdef): Move semantic action to objc_finish_implementation(). (classdef): Move semantic action to objc_start_class_interface(), objc_continue_interface(), objc_finish_interface(), objc_start_class_implementation(), objc_continue_implementation(), objc_start_category_interface() and objc_start_category_implementation(). (protocoldef): Move semantic actions to objc_start_protocol() and objc_finish_interface(). (ivar_decl_list): Remove nonterminal. (visibility_spec): Move semantic actions to objc_set_visibility(). (ivar_decls): Remove assignment to $$. (ivar_decl): Rephrase in terms of component_decl; call objc_add_instance_variable(). (ivars, ivar_declarator): Remove nonterminals. (opt_semi): New nonterminal. (methodtype): Remove semantic actions. (methoddef): Move semantic actions to objc_set_method_type(), objc_start_method_definition() and objc_finish_method_definition(). (methodproto): Move semantic actions to objc_set_method_type() and objc_add_method_declaration(). (methoddecl): Use objc_typename instead of typename; move semantic actions to objc_build_method_signature(). (optarglist, myxdecls, mydecl, myparms, myparm): Remove nonterminals. (optparmlist): Express in terms of optparms and optellipsis. (optparms, optellipsis, objc_qual, objc_quals, objc_typename): New nonterminals. (keyworddecl): Use objc_typename instead of typename. (rid_to_yy): Mark RID_IN, RID_OUT, RID_INOUT, RID_BYCOPY, RID_BYREF and RID_ONEWAY as returning OBJC_TYPE_QUAL to yyparse(). [gcc/objc/ChangeLog] 2004-09-07 Ziemowit Laski <zlaski@apple.com> * Make-lang.in (objc/objc-parse.o): Depend on $(C_COMMON_H) instead of objc/objc-act.h. (objc/objc-act.o): Depend on $(HASHTAB_H). * objc-act.c: Include hashtab.h; in ObjC++ mode, include cp-tree.h and objcp-decl.h instead of c-tree.h. (build_module_descriptor, get_class_ivars, synth_id_with_class_suffix, error_with_ivar, gen_method_decl, gen_declaration, setup_string_decl, build_protocol_template): Adjust prototypes. (build_module_initializer_routine, start_class, continue_class, finish_class, start_method_def, objc_start_function, start_protocol, build_method_decl, objc_add_method, add_instance_variable, build_ivar_reference, is_ivar, is_private, get_super_receiver, build_selector_table_decl, objc_push_parm, objc_get_parm_info, gen_type_name, gen_type_name_0, start_var_decl, finish_var_decl, create_field_decl): New prototypes. (objc_expand_function_end, comp_method_with_proto, objc_expr_last, gen_declaration_1, gen_declarator, is_complex_decl, adorn_decl, define_decl, create_builtin_decl, gen_declspecs): Remove prototypes. (TYPE_ID): Rename to OBJECT_TYPEDEF_NAME. (CLASS_TYPEDEF_NAME): New. (TAG_EXECCLASS): Change from a global variable to a #define. (TAG_RETURN_STRUCT): Delete. (TAG_GNUINIT): New, holds '__objc_gnu_init' name. (objc_inherit_code, objc_public_flag): New, moved from c-parse.in. (string_descriptor): New struct. (string_htab): New hash table. (string_hash, string_eq): New prototypes. (generate_struct_by_value_array): Call create_field_decl() instead of create_builtin_decl(). (objc_init): Do not initialize objc_ellipsis_node or TAG_EXECCLASS; In ObjC++ mode, call cxx_init() instead of c_objc_common_init(). (objc_finish_file): In ObjC++, call instantiate_pending_templates() and cp_finish_file(). (define_decl, get_static_reference, get_protocol_reference, create_builtin_decl): Remove functions. (objc_start_class_interface, objc_start_category_interface, objc_start_protocol, objc_continue_interface, objc_finish_interface, objc_start_class_implementation, objc_start_category_implementation, objc_continue_implementation, objc_finish_implementation, objc_set_visibility, objc_set_method_type, objc_build_method_signature, objc_add_method_declaration, objc_start_method_definition, objc_add_instance_variable, objc_get_protocol_qualified_type, create_field_decl, start_var_decl, finish_var_decl): New functions. (setup_string_decl): Simplify since it is only called once. (synth_module_prologue): Call build_class_template(); predefine 'id' and 'Class' as typedefs; rename 'temp_type' to 'type'; disable debug hooks for duration of function; fix GNU runtime messenger signatures to correspond to reality; forward-declare '__objc_exec_class' for the GNU runtime; call build_selector_table_decl(); in ObjC++ mode, generate 'extern "C" { ... }' wrappers around synthesized declarations; call build_protocol_template() and build_category_template(). (string_hash, string_eq): New functions. (objc_build_string_object): Check metaclass correctness only once; store string literals in hash table. (objc_build_constructor): Do not convert initializer elements; adjust for ObjC++ impedance mismatch. (build_objc_symtab_template): Call create_field_decl() instead of create_builtin_decl(). (init_objc_symtab): Add missing conversion to initializer element. (build_metadata_decl): Call start_var_decl() instead of define_decl(). (generate_objc_symtab_decl): Do not call build_category_template(); call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(). (build_module_descriptor): Call create_field_decl() instead of grokfield(); call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(); always mark module descriptor as used; move GNU runtime-specific functionality to build_module_initializer_routine(). (build_module_initializer_routine): New function, broken off of build_module_descriptor(). (objc_static_init_needed_p, objc_generate_static_init_call): New functions. (generate_static_references, generate_strings, build_selector_translation_table, generate_descriptor_table, generate_ivars_list, generate_dispatch_table, generate_category): Call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(); build a type directly instead of via groktypename(). (build_selector_reference_decl, build_selector_table_decl, build_class_reference_decl, build_protocol_reference, generate_objc_image_info): Call start_var_decl() instead of build_decl(). (build_selector_reference): For GNU runtime, do not call build_selector_reference_decl(). (build_selector, build_typed_selector_reference): Always convert result to the selector type. (add_objc_string): Cast return value to 'char *'. (build_method_prototype_template, build_selector_template, build_method_template): Use actual selector type for fields pointing to selectors. (finish_objc): For GNU runtime, call build_module_initializer_routine() after build_module_descriptor(). (generate_protocol_list, generate_shared_structures): Call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(); build a type directly instead of via groktypename(). (synth_id_with_class_suffix): Return a string. (get_arg_type_list): For instance methods, use the instance type for 'self'; do not call groktypename_in_parm_context(). (build_objc_string_decl): Squash redeclaration errors in ObjC++. (objc_is_class_name): Use OBJC_TYPE_NAME instead of TYPE_NAME; handle RECORD_TYPEs in ObjC as well as ObjC++. (objc_is_id): New function. (objc_is_object_ptr): Return the canonical type node. (objc_get_class_ivars): Simplify using get_class_ivars(). (get_class_ivars): Remove second parameter; create a fresh copy of the ivar list for each call; do not check for existence of super class. (objc_eh_runtime_type): Mark #ifndef OBJCPLUS. (objc_init_exceptions): When using SJLJ-style exceptions, require the use of '-fobjc-exceptions' flag; do not require it for DWARF-style exceptions. (objc_build_exc_ptr, next_sjlj_build_try_catch_finally): Use objc_object_type instead of objc_id_type. (objc_begin_catch_clause): Convert the incoming PARM_DECL into a VAR_DECL before placing it in the appropriate scope; do not call define_decl(); adjust call to c_begin_compound_stmt(); use objc_object_type instead of objc_id_type. (build_next_objc_exception_stuff): Call create_field_decl() instead of create_builtin_decl(); construct type directly instead of calling groktypename(); use OBJC_VOID_AT_END to mark end of function parameters. (build_private_template): Adjust call to get_class_ivars(); build a type directly instead of via groktypename(). (build_protocol_template, build_method_prototype_list_template, build_method_prototype_template, build_category_template, build_selector_template, build_class_template, build_super_template, build_ivar_template, build_ivar_list_template, build_method_list_template, build_method_template): Call create_field_decl() instead of grokfield(). (objc_method_parm_type): Do not call groktypename(). (generate_descriptor_table): Call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(). (generate_method_descriptors, build_protocol_initializer, generate_dispatch_tables, build_category_initializer, build_shared_structure_initializer): Do not call groktypename(). (generate_protocols): Call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(); do not call groktypename(). (error_with_ivar): Remove last parameter. (check_ivars): Do not iterate ovar CLASS_RAW_IVARS lists in addition to CLASS_IVARS lists; adjust calls to error_with_ivar(). (generate_ivar_lists): Convert one of the initializer elements; do not call groktypename(). (get_arg_type_list, start_method_def, gen_method_def): Account for new representation of variable arguments and '...' in Objective-C methods; add Objective-C++ impedance matching code. (is_objc_type_qualifier): Remove function. (adjust_type_for_id_default): Simplify; there is no longer a need to wade through declspecs. (lookup_interface, start_class, continue_class, finish_class, start_method_def, start_protocol, build_method_decl, objc_add_method, add_instance_variable, build_ivar_reference, is_ivar, is_private, get_super_receiver, objc_build_finally_epilogue): Make into static functions. (receiver_is_class_object): Use new IS_CLASS() macro. (objc_build_message_expr): Tweak ObjC++ message argument handling; call objc_finish_message_expr() instead of finish_message_expr(). (finish_message_expr): Rename to objc_finish_message_expr(); use OBJC_TYPE_NAME and OBJC_SET_TYPE_NAME macros instead of TYPE_NAME. call gen_type_name() instead of gen_declaration(); call objc_is_id() instead of using IS_ID and IS_CLASS; Use objc_class_name instead of calling get_identifier("Class"); handle CONVERT_EXPRs in receiver. (build_objc_method_call, warn_with_method): Do not call groktypename(). (build_ivar_reference): Call convert() instead of clobbering in a type. (hash_init): Initialize string_htab hash table. (add_instance_variable): Simplify parameter list; do not call grokfield(); do not populate CLASS_IVARS list. (start_class): Check for the existence of super class, if one was specified. (continue_class): Use CLASS_RAW_IVARS rather than CLASS_IVARS; do not call build_class_template(); adjust call to get_class_ivars(); call build_decl(), pushdecl() and finish_decl() instead of define_decl(). (finish_class): Call build_decl(), pushdecl() and finish_decl() instead of define_decl(). (add_protocols): Use PROTOCOL_BINFO_ELTS for the tree vector size. (start_protocol): Do not call build_protocol_template(); use PROTOCOL_BINFO_ELTS for the tree vector size. (encode_type_qualifiers): Do not handle the 'const' qualifier here. (encode_pointer): Encode 'const char *' as 'r*', for backwards compatibility. (encode_array): Use HOST_WIDE_INT_PRINT_DEC instead of "%ld". (encode_type): Handle the 'const' qualifier here. (objc_parmlist): New global variable, sued by objc_push_parm and objc_get_parm_info(). (objc_push_parm, objc_get_parm_info): New functions. (objc_expr_last): Remove function. (synth_self_and_ucmd_args): For instance methods, use the instance type for 'self'; call objc_push_parm() instead of push_parm_decl(). (start_method_def): Do not call push_scope(), declare_parm_level(), pop_scope(), push_parm_decl(), store_parm_decls() or objc_expr_last(); just use objc_push_parm() and objc_get_parm_info(). (comp_method_with_proto): Remove function. (objc_types_are_equivalent): Strip away indirections before comparing underlying types. (comp_proto_with_proto): Do not call groktypename(); types are no longer in raw declspec format. (objc_start_function): New function. (really_start_method): Call comp_proto_with_proto() instead of comp_method_with_proto(); call objc_start_function() instead of hand-crafting a function declarator. (continue_method_def, objc_expand_function_end): Remove functions. (get_super_receiver): Call objc_get_current_scope() instead of get_current_scope(); reference 'super_class' field (instead of 'class'). (finish_method_def): Rename to objc_finish_method_definition() and add a function decl parameter; move method encoding call from objc_expand_function_end(). (is_complex_decl, adorn_decl, gen_declarator, gen_declspecs, gen_declaration_1): Remove functions. (tmpbuf, RAW_DECLSPEC): Remove. (gen_declaration): Remove second parameter; simplify to deal with TYPE_P nodes instead of raw declspecs. (gen_type_name, gen_type_name_0): New functions. (gen_method_decl): Remove second parameter; call gen_type_name() instead of gen_declaration_1(). (dump_interface): Adjust calls to gen_declaration() and gen_method_decl(); do not allocate a separate string buffer. (init_objc): Allocate a larger string buffer to accommodate dump_interface(); adjust call to build_module_descriptor(); add call to build_module_initializer_routine() for the GNU runtime. (generate_classref_translation_entry): Do not call start_decl(); call finish_var_decl() instead of finish_decl(); call convert() instead of build_c_cast(). * objc-act.h (CLASS_OWN_IVARS): Remove accessor. (CLASS_BINFO_ELTS): Reduce from 6 to 5, now that CLASS_OWN_IVARS is gone. (OCTI_GNU_INIT_DECL, GNU_INIT_decl): New. (OCTI_ELLIPSIS_NODE, objc_ellipsis_node): Remove. (OCTI_ID_ID, id_type, objc_id_id): Rename to OCTI_ID_NAME, objc_object_type and objc_object_name, respectively. (OCTI_CLS_REF, OCTI_CLASS_NAME, objc_class_reference, objc_class_name): New. (IS_CLASS): New macro. (IS_ID, IS_SUPER): Robustify. (OCTI_EXECCLASS_DECL, execclass_decl): New. (finish_file, start_class, continue_class, finish_class, start_method_def, continue_method_def, finish_method_def, start_protocol, finish_protocol, objc_build_throw_stmt, objc_build_try_catch_finally_stmt, objc_build_synchronized_prologue, objc_build_synchronized_epilogue, objc_build_try_prologue, objc_build_try_epilogue, objc_build_catch_stmt, objc_build_catch_epilogue, objc_build_finally_prologue, objc_build_finally_epilogue, is_ivar, is_private, is_public, add_instance_variable, objc_add_method, get_super_receiver, objc_clear_super_receiver, get_class_ivars_from_name, get_class_reference, get_static_reference, get_object_reference, build_message_expr, finish_message_expr, build_selector_expr, build_ivar_reference, build_keyword_decl, build_method_decl, build_protocol_expr, build_objc_string_object, objc_declare_alias, objc_declare_class, objc_declare_protocols, objc_comptypes, objc_check_decl, build_encode_expr): Remove prototypes. (imp_count, cat_count): Make GGC-aware. (OBJC_SET_TYPE_NAME): New macro. From-SVN: r87168
2004-09-08 02:49:44 +02:00
#else
struct sarray *dtable;
Makefile.in (c-parse.o): Depend on $(C_COMMON_H). [gcc/ChangeLog] 2004-09-07 Ziemowit Laski <zlaski@apple.com> * Makefile.in (c-parse.o): Depend on $(C_COMMON_H). * c-parse.in: Include c-common.h instead of objc-act.h. (ivar_decl_list, ivar_decls, ivar_decl, ivars, ivar_declarator, myparms, myparm): Remove %type declarations. (methodtype, optparms, OBJC_TYPE_QUAL, objc_quals, objc_qual, objc_typename, objc_try_catch_stmt, optellipsis): Add %type declarations. (objc_inherit_code, objc_public_flag): Remove. (typespec_nonreserved_nonattr): Call objc_get_protocol_qualified_type() instead of get_static_reference() and get_protocol_reference(). (stmt_nocomp): Call grokparm() on @catch parameter. (objcdef): Move semantic action to objc_finish_implementation(). (classdef): Move semantic action to objc_start_class_interface(), objc_continue_interface(), objc_finish_interface(), objc_start_class_implementation(), objc_continue_implementation(), objc_start_category_interface() and objc_start_category_implementation(). (protocoldef): Move semantic actions to objc_start_protocol() and objc_finish_interface(). (ivar_decl_list): Remove nonterminal. (visibility_spec): Move semantic actions to objc_set_visibility(). (ivar_decls): Remove assignment to $$. (ivar_decl): Rephrase in terms of component_decl; call objc_add_instance_variable(). (ivars, ivar_declarator): Remove nonterminals. (opt_semi): New nonterminal. (methodtype): Remove semantic actions. (methoddef): Move semantic actions to objc_set_method_type(), objc_start_method_definition() and objc_finish_method_definition(). (methodproto): Move semantic actions to objc_set_method_type() and objc_add_method_declaration(). (methoddecl): Use objc_typename instead of typename; move semantic actions to objc_build_method_signature(). (optarglist, myxdecls, mydecl, myparms, myparm): Remove nonterminals. (optparmlist): Express in terms of optparms and optellipsis. (optparms, optellipsis, objc_qual, objc_quals, objc_typename): New nonterminals. (keyworddecl): Use objc_typename instead of typename. (rid_to_yy): Mark RID_IN, RID_OUT, RID_INOUT, RID_BYCOPY, RID_BYREF and RID_ONEWAY as returning OBJC_TYPE_QUAL to yyparse(). [gcc/objc/ChangeLog] 2004-09-07 Ziemowit Laski <zlaski@apple.com> * Make-lang.in (objc/objc-parse.o): Depend on $(C_COMMON_H) instead of objc/objc-act.h. (objc/objc-act.o): Depend on $(HASHTAB_H). * objc-act.c: Include hashtab.h; in ObjC++ mode, include cp-tree.h and objcp-decl.h instead of c-tree.h. (build_module_descriptor, get_class_ivars, synth_id_with_class_suffix, error_with_ivar, gen_method_decl, gen_declaration, setup_string_decl, build_protocol_template): Adjust prototypes. (build_module_initializer_routine, start_class, continue_class, finish_class, start_method_def, objc_start_function, start_protocol, build_method_decl, objc_add_method, add_instance_variable, build_ivar_reference, is_ivar, is_private, get_super_receiver, build_selector_table_decl, objc_push_parm, objc_get_parm_info, gen_type_name, gen_type_name_0, start_var_decl, finish_var_decl, create_field_decl): New prototypes. (objc_expand_function_end, comp_method_with_proto, objc_expr_last, gen_declaration_1, gen_declarator, is_complex_decl, adorn_decl, define_decl, create_builtin_decl, gen_declspecs): Remove prototypes. (TYPE_ID): Rename to OBJECT_TYPEDEF_NAME. (CLASS_TYPEDEF_NAME): New. (TAG_EXECCLASS): Change from a global variable to a #define. (TAG_RETURN_STRUCT): Delete. (TAG_GNUINIT): New, holds '__objc_gnu_init' name. (objc_inherit_code, objc_public_flag): New, moved from c-parse.in. (string_descriptor): New struct. (string_htab): New hash table. (string_hash, string_eq): New prototypes. (generate_struct_by_value_array): Call create_field_decl() instead of create_builtin_decl(). (objc_init): Do not initialize objc_ellipsis_node or TAG_EXECCLASS; In ObjC++ mode, call cxx_init() instead of c_objc_common_init(). (objc_finish_file): In ObjC++, call instantiate_pending_templates() and cp_finish_file(). (define_decl, get_static_reference, get_protocol_reference, create_builtin_decl): Remove functions. (objc_start_class_interface, objc_start_category_interface, objc_start_protocol, objc_continue_interface, objc_finish_interface, objc_start_class_implementation, objc_start_category_implementation, objc_continue_implementation, objc_finish_implementation, objc_set_visibility, objc_set_method_type, objc_build_method_signature, objc_add_method_declaration, objc_start_method_definition, objc_add_instance_variable, objc_get_protocol_qualified_type, create_field_decl, start_var_decl, finish_var_decl): New functions. (setup_string_decl): Simplify since it is only called once. (synth_module_prologue): Call build_class_template(); predefine 'id' and 'Class' as typedefs; rename 'temp_type' to 'type'; disable debug hooks for duration of function; fix GNU runtime messenger signatures to correspond to reality; forward-declare '__objc_exec_class' for the GNU runtime; call build_selector_table_decl(); in ObjC++ mode, generate 'extern "C" { ... }' wrappers around synthesized declarations; call build_protocol_template() and build_category_template(). (string_hash, string_eq): New functions. (objc_build_string_object): Check metaclass correctness only once; store string literals in hash table. (objc_build_constructor): Do not convert initializer elements; adjust for ObjC++ impedance mismatch. (build_objc_symtab_template): Call create_field_decl() instead of create_builtin_decl(). (init_objc_symtab): Add missing conversion to initializer element. (build_metadata_decl): Call start_var_decl() instead of define_decl(). (generate_objc_symtab_decl): Do not call build_category_template(); call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(). (build_module_descriptor): Call create_field_decl() instead of grokfield(); call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(); always mark module descriptor as used; move GNU runtime-specific functionality to build_module_initializer_routine(). (build_module_initializer_routine): New function, broken off of build_module_descriptor(). (objc_static_init_needed_p, objc_generate_static_init_call): New functions. (generate_static_references, generate_strings, build_selector_translation_table, generate_descriptor_table, generate_ivars_list, generate_dispatch_table, generate_category): Call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(); build a type directly instead of via groktypename(). (build_selector_reference_decl, build_selector_table_decl, build_class_reference_decl, build_protocol_reference, generate_objc_image_info): Call start_var_decl() instead of build_decl(). (build_selector_reference): For GNU runtime, do not call build_selector_reference_decl(). (build_selector, build_typed_selector_reference): Always convert result to the selector type. (add_objc_string): Cast return value to 'char *'. (build_method_prototype_template, build_selector_template, build_method_template): Use actual selector type for fields pointing to selectors. (finish_objc): For GNU runtime, call build_module_initializer_routine() after build_module_descriptor(). (generate_protocol_list, generate_shared_structures): Call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(); build a type directly instead of via groktypename(). (synth_id_with_class_suffix): Return a string. (get_arg_type_list): For instance methods, use the instance type for 'self'; do not call groktypename_in_parm_context(). (build_objc_string_decl): Squash redeclaration errors in ObjC++. (objc_is_class_name): Use OBJC_TYPE_NAME instead of TYPE_NAME; handle RECORD_TYPEs in ObjC as well as ObjC++. (objc_is_id): New function. (objc_is_object_ptr): Return the canonical type node. (objc_get_class_ivars): Simplify using get_class_ivars(). (get_class_ivars): Remove second parameter; create a fresh copy of the ivar list for each call; do not check for existence of super class. (objc_eh_runtime_type): Mark #ifndef OBJCPLUS. (objc_init_exceptions): When using SJLJ-style exceptions, require the use of '-fobjc-exceptions' flag; do not require it for DWARF-style exceptions. (objc_build_exc_ptr, next_sjlj_build_try_catch_finally): Use objc_object_type instead of objc_id_type. (objc_begin_catch_clause): Convert the incoming PARM_DECL into a VAR_DECL before placing it in the appropriate scope; do not call define_decl(); adjust call to c_begin_compound_stmt(); use objc_object_type instead of objc_id_type. (build_next_objc_exception_stuff): Call create_field_decl() instead of create_builtin_decl(); construct type directly instead of calling groktypename(); use OBJC_VOID_AT_END to mark end of function parameters. (build_private_template): Adjust call to get_class_ivars(); build a type directly instead of via groktypename(). (build_protocol_template, build_method_prototype_list_template, build_method_prototype_template, build_category_template, build_selector_template, build_class_template, build_super_template, build_ivar_template, build_ivar_list_template, build_method_list_template, build_method_template): Call create_field_decl() instead of grokfield(). (objc_method_parm_type): Do not call groktypename(). (generate_descriptor_table): Call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(). (generate_method_descriptors, build_protocol_initializer, generate_dispatch_tables, build_category_initializer, build_shared_structure_initializer): Do not call groktypename(). (generate_protocols): Call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(); do not call groktypename(). (error_with_ivar): Remove last parameter. (check_ivars): Do not iterate ovar CLASS_RAW_IVARS lists in addition to CLASS_IVARS lists; adjust calls to error_with_ivar(). (generate_ivar_lists): Convert one of the initializer elements; do not call groktypename(). (get_arg_type_list, start_method_def, gen_method_def): Account for new representation of variable arguments and '...' in Objective-C methods; add Objective-C++ impedance matching code. (is_objc_type_qualifier): Remove function. (adjust_type_for_id_default): Simplify; there is no longer a need to wade through declspecs. (lookup_interface, start_class, continue_class, finish_class, start_method_def, start_protocol, build_method_decl, objc_add_method, add_instance_variable, build_ivar_reference, is_ivar, is_private, get_super_receiver, objc_build_finally_epilogue): Make into static functions. (receiver_is_class_object): Use new IS_CLASS() macro. (objc_build_message_expr): Tweak ObjC++ message argument handling; call objc_finish_message_expr() instead of finish_message_expr(). (finish_message_expr): Rename to objc_finish_message_expr(); use OBJC_TYPE_NAME and OBJC_SET_TYPE_NAME macros instead of TYPE_NAME. call gen_type_name() instead of gen_declaration(); call objc_is_id() instead of using IS_ID and IS_CLASS; Use objc_class_name instead of calling get_identifier("Class"); handle CONVERT_EXPRs in receiver. (build_objc_method_call, warn_with_method): Do not call groktypename(). (build_ivar_reference): Call convert() instead of clobbering in a type. (hash_init): Initialize string_htab hash table. (add_instance_variable): Simplify parameter list; do not call grokfield(); do not populate CLASS_IVARS list. (start_class): Check for the existence of super class, if one was specified. (continue_class): Use CLASS_RAW_IVARS rather than CLASS_IVARS; do not call build_class_template(); adjust call to get_class_ivars(); call build_decl(), pushdecl() and finish_decl() instead of define_decl(). (finish_class): Call build_decl(), pushdecl() and finish_decl() instead of define_decl(). (add_protocols): Use PROTOCOL_BINFO_ELTS for the tree vector size. (start_protocol): Do not call build_protocol_template(); use PROTOCOL_BINFO_ELTS for the tree vector size. (encode_type_qualifiers): Do not handle the 'const' qualifier here. (encode_pointer): Encode 'const char *' as 'r*', for backwards compatibility. (encode_array): Use HOST_WIDE_INT_PRINT_DEC instead of "%ld". (encode_type): Handle the 'const' qualifier here. (objc_parmlist): New global variable, sued by objc_push_parm and objc_get_parm_info(). (objc_push_parm, objc_get_parm_info): New functions. (objc_expr_last): Remove function. (synth_self_and_ucmd_args): For instance methods, use the instance type for 'self'; call objc_push_parm() instead of push_parm_decl(). (start_method_def): Do not call push_scope(), declare_parm_level(), pop_scope(), push_parm_decl(), store_parm_decls() or objc_expr_last(); just use objc_push_parm() and objc_get_parm_info(). (comp_method_with_proto): Remove function. (objc_types_are_equivalent): Strip away indirections before comparing underlying types. (comp_proto_with_proto): Do not call groktypename(); types are no longer in raw declspec format. (objc_start_function): New function. (really_start_method): Call comp_proto_with_proto() instead of comp_method_with_proto(); call objc_start_function() instead of hand-crafting a function declarator. (continue_method_def, objc_expand_function_end): Remove functions. (get_super_receiver): Call objc_get_current_scope() instead of get_current_scope(); reference 'super_class' field (instead of 'class'). (finish_method_def): Rename to objc_finish_method_definition() and add a function decl parameter; move method encoding call from objc_expand_function_end(). (is_complex_decl, adorn_decl, gen_declarator, gen_declspecs, gen_declaration_1): Remove functions. (tmpbuf, RAW_DECLSPEC): Remove. (gen_declaration): Remove second parameter; simplify to deal with TYPE_P nodes instead of raw declspecs. (gen_type_name, gen_type_name_0): New functions. (gen_method_decl): Remove second parameter; call gen_type_name() instead of gen_declaration_1(). (dump_interface): Adjust calls to gen_declaration() and gen_method_decl(); do not allocate a separate string buffer. (init_objc): Allocate a larger string buffer to accommodate dump_interface(); adjust call to build_module_descriptor(); add call to build_module_initializer_routine() for the GNU runtime. (generate_classref_translation_entry): Do not call start_decl(); call finish_var_decl() instead of finish_decl(); call convert() instead of build_c_cast(). * objc-act.h (CLASS_OWN_IVARS): Remove accessor. (CLASS_BINFO_ELTS): Reduce from 6 to 5, now that CLASS_OWN_IVARS is gone. (OCTI_GNU_INIT_DECL, GNU_INIT_decl): New. (OCTI_ELLIPSIS_NODE, objc_ellipsis_node): Remove. (OCTI_ID_ID, id_type, objc_id_id): Rename to OCTI_ID_NAME, objc_object_type and objc_object_name, respectively. (OCTI_CLS_REF, OCTI_CLASS_NAME, objc_class_reference, objc_class_name): New. (IS_CLASS): New macro. (IS_ID, IS_SUPER): Robustify. (OCTI_EXECCLASS_DECL, execclass_decl): New. (finish_file, start_class, continue_class, finish_class, start_method_def, continue_method_def, finish_method_def, start_protocol, finish_protocol, objc_build_throw_stmt, objc_build_try_catch_finally_stmt, objc_build_synchronized_prologue, objc_build_synchronized_epilogue, objc_build_try_prologue, objc_build_try_epilogue, objc_build_catch_stmt, objc_build_catch_epilogue, objc_build_finally_prologue, objc_build_finally_epilogue, is_ivar, is_private, is_public, add_instance_variable, objc_add_method, get_super_receiver, objc_clear_super_receiver, get_class_ivars_from_name, get_class_reference, get_static_reference, get_object_reference, build_message_expr, finish_message_expr, build_selector_expr, build_ivar_reference, build_keyword_decl, build_method_decl, build_protocol_expr, build_objc_string_object, objc_declare_alias, objc_declare_class, objc_declare_protocols, objc_comptypes, objc_check_decl, build_encode_expr): Remove prototypes. (imp_count, cat_count): Make GGC-aware. (OBJC_SET_TYPE_NAME): New macro. From-SVN: r87168
2004-09-08 02:49:44 +02:00
struct _objc_class *subclass_list;
struct _objc_class *sibling_class;
#endif
struct _objc_protocol_list *protocols;
#ifdef __NEXT_RUNTIME__
void *sel_id;
Makefile.in (c-parse.o): Depend on $(C_COMMON_H). [gcc/ChangeLog] 2004-09-07 Ziemowit Laski <zlaski@apple.com> * Makefile.in (c-parse.o): Depend on $(C_COMMON_H). * c-parse.in: Include c-common.h instead of objc-act.h. (ivar_decl_list, ivar_decls, ivar_decl, ivars, ivar_declarator, myparms, myparm): Remove %type declarations. (methodtype, optparms, OBJC_TYPE_QUAL, objc_quals, objc_qual, objc_typename, objc_try_catch_stmt, optellipsis): Add %type declarations. (objc_inherit_code, objc_public_flag): Remove. (typespec_nonreserved_nonattr): Call objc_get_protocol_qualified_type() instead of get_static_reference() and get_protocol_reference(). (stmt_nocomp): Call grokparm() on @catch parameter. (objcdef): Move semantic action to objc_finish_implementation(). (classdef): Move semantic action to objc_start_class_interface(), objc_continue_interface(), objc_finish_interface(), objc_start_class_implementation(), objc_continue_implementation(), objc_start_category_interface() and objc_start_category_implementation(). (protocoldef): Move semantic actions to objc_start_protocol() and objc_finish_interface(). (ivar_decl_list): Remove nonterminal. (visibility_spec): Move semantic actions to objc_set_visibility(). (ivar_decls): Remove assignment to $$. (ivar_decl): Rephrase in terms of component_decl; call objc_add_instance_variable(). (ivars, ivar_declarator): Remove nonterminals. (opt_semi): New nonterminal. (methodtype): Remove semantic actions. (methoddef): Move semantic actions to objc_set_method_type(), objc_start_method_definition() and objc_finish_method_definition(). (methodproto): Move semantic actions to objc_set_method_type() and objc_add_method_declaration(). (methoddecl): Use objc_typename instead of typename; move semantic actions to objc_build_method_signature(). (optarglist, myxdecls, mydecl, myparms, myparm): Remove nonterminals. (optparmlist): Express in terms of optparms and optellipsis. (optparms, optellipsis, objc_qual, objc_quals, objc_typename): New nonterminals. (keyworddecl): Use objc_typename instead of typename. (rid_to_yy): Mark RID_IN, RID_OUT, RID_INOUT, RID_BYCOPY, RID_BYREF and RID_ONEWAY as returning OBJC_TYPE_QUAL to yyparse(). [gcc/objc/ChangeLog] 2004-09-07 Ziemowit Laski <zlaski@apple.com> * Make-lang.in (objc/objc-parse.o): Depend on $(C_COMMON_H) instead of objc/objc-act.h. (objc/objc-act.o): Depend on $(HASHTAB_H). * objc-act.c: Include hashtab.h; in ObjC++ mode, include cp-tree.h and objcp-decl.h instead of c-tree.h. (build_module_descriptor, get_class_ivars, synth_id_with_class_suffix, error_with_ivar, gen_method_decl, gen_declaration, setup_string_decl, build_protocol_template): Adjust prototypes. (build_module_initializer_routine, start_class, continue_class, finish_class, start_method_def, objc_start_function, start_protocol, build_method_decl, objc_add_method, add_instance_variable, build_ivar_reference, is_ivar, is_private, get_super_receiver, build_selector_table_decl, objc_push_parm, objc_get_parm_info, gen_type_name, gen_type_name_0, start_var_decl, finish_var_decl, create_field_decl): New prototypes. (objc_expand_function_end, comp_method_with_proto, objc_expr_last, gen_declaration_1, gen_declarator, is_complex_decl, adorn_decl, define_decl, create_builtin_decl, gen_declspecs): Remove prototypes. (TYPE_ID): Rename to OBJECT_TYPEDEF_NAME. (CLASS_TYPEDEF_NAME): New. (TAG_EXECCLASS): Change from a global variable to a #define. (TAG_RETURN_STRUCT): Delete. (TAG_GNUINIT): New, holds '__objc_gnu_init' name. (objc_inherit_code, objc_public_flag): New, moved from c-parse.in. (string_descriptor): New struct. (string_htab): New hash table. (string_hash, string_eq): New prototypes. (generate_struct_by_value_array): Call create_field_decl() instead of create_builtin_decl(). (objc_init): Do not initialize objc_ellipsis_node or TAG_EXECCLASS; In ObjC++ mode, call cxx_init() instead of c_objc_common_init(). (objc_finish_file): In ObjC++, call instantiate_pending_templates() and cp_finish_file(). (define_decl, get_static_reference, get_protocol_reference, create_builtin_decl): Remove functions. (objc_start_class_interface, objc_start_category_interface, objc_start_protocol, objc_continue_interface, objc_finish_interface, objc_start_class_implementation, objc_start_category_implementation, objc_continue_implementation, objc_finish_implementation, objc_set_visibility, objc_set_method_type, objc_build_method_signature, objc_add_method_declaration, objc_start_method_definition, objc_add_instance_variable, objc_get_protocol_qualified_type, create_field_decl, start_var_decl, finish_var_decl): New functions. (setup_string_decl): Simplify since it is only called once. (synth_module_prologue): Call build_class_template(); predefine 'id' and 'Class' as typedefs; rename 'temp_type' to 'type'; disable debug hooks for duration of function; fix GNU runtime messenger signatures to correspond to reality; forward-declare '__objc_exec_class' for the GNU runtime; call build_selector_table_decl(); in ObjC++ mode, generate 'extern "C" { ... }' wrappers around synthesized declarations; call build_protocol_template() and build_category_template(). (string_hash, string_eq): New functions. (objc_build_string_object): Check metaclass correctness only once; store string literals in hash table. (objc_build_constructor): Do not convert initializer elements; adjust for ObjC++ impedance mismatch. (build_objc_symtab_template): Call create_field_decl() instead of create_builtin_decl(). (init_objc_symtab): Add missing conversion to initializer element. (build_metadata_decl): Call start_var_decl() instead of define_decl(). (generate_objc_symtab_decl): Do not call build_category_template(); call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(). (build_module_descriptor): Call create_field_decl() instead of grokfield(); call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(); always mark module descriptor as used; move GNU runtime-specific functionality to build_module_initializer_routine(). (build_module_initializer_routine): New function, broken off of build_module_descriptor(). (objc_static_init_needed_p, objc_generate_static_init_call): New functions. (generate_static_references, generate_strings, build_selector_translation_table, generate_descriptor_table, generate_ivars_list, generate_dispatch_table, generate_category): Call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(); build a type directly instead of via groktypename(). (build_selector_reference_decl, build_selector_table_decl, build_class_reference_decl, build_protocol_reference, generate_objc_image_info): Call start_var_decl() instead of build_decl(). (build_selector_reference): For GNU runtime, do not call build_selector_reference_decl(). (build_selector, build_typed_selector_reference): Always convert result to the selector type. (add_objc_string): Cast return value to 'char *'. (build_method_prototype_template, build_selector_template, build_method_template): Use actual selector type for fields pointing to selectors. (finish_objc): For GNU runtime, call build_module_initializer_routine() after build_module_descriptor(). (generate_protocol_list, generate_shared_structures): Call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(); build a type directly instead of via groktypename(). (synth_id_with_class_suffix): Return a string. (get_arg_type_list): For instance methods, use the instance type for 'self'; do not call groktypename_in_parm_context(). (build_objc_string_decl): Squash redeclaration errors in ObjC++. (objc_is_class_name): Use OBJC_TYPE_NAME instead of TYPE_NAME; handle RECORD_TYPEs in ObjC as well as ObjC++. (objc_is_id): New function. (objc_is_object_ptr): Return the canonical type node. (objc_get_class_ivars): Simplify using get_class_ivars(). (get_class_ivars): Remove second parameter; create a fresh copy of the ivar list for each call; do not check for existence of super class. (objc_eh_runtime_type): Mark #ifndef OBJCPLUS. (objc_init_exceptions): When using SJLJ-style exceptions, require the use of '-fobjc-exceptions' flag; do not require it for DWARF-style exceptions. (objc_build_exc_ptr, next_sjlj_build_try_catch_finally): Use objc_object_type instead of objc_id_type. (objc_begin_catch_clause): Convert the incoming PARM_DECL into a VAR_DECL before placing it in the appropriate scope; do not call define_decl(); adjust call to c_begin_compound_stmt(); use objc_object_type instead of objc_id_type. (build_next_objc_exception_stuff): Call create_field_decl() instead of create_builtin_decl(); construct type directly instead of calling groktypename(); use OBJC_VOID_AT_END to mark end of function parameters. (build_private_template): Adjust call to get_class_ivars(); build a type directly instead of via groktypename(). (build_protocol_template, build_method_prototype_list_template, build_method_prototype_template, build_category_template, build_selector_template, build_class_template, build_super_template, build_ivar_template, build_ivar_list_template, build_method_list_template, build_method_template): Call create_field_decl() instead of grokfield(). (objc_method_parm_type): Do not call groktypename(). (generate_descriptor_table): Call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(). (generate_method_descriptors, build_protocol_initializer, generate_dispatch_tables, build_category_initializer, build_shared_structure_initializer): Do not call groktypename(). (generate_protocols): Call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(); do not call groktypename(). (error_with_ivar): Remove last parameter. (check_ivars): Do not iterate ovar CLASS_RAW_IVARS lists in addition to CLASS_IVARS lists; adjust calls to error_with_ivar(). (generate_ivar_lists): Convert one of the initializer elements; do not call groktypename(). (get_arg_type_list, start_method_def, gen_method_def): Account for new representation of variable arguments and '...' in Objective-C methods; add Objective-C++ impedance matching code. (is_objc_type_qualifier): Remove function. (adjust_type_for_id_default): Simplify; there is no longer a need to wade through declspecs. (lookup_interface, start_class, continue_class, finish_class, start_method_def, start_protocol, build_method_decl, objc_add_method, add_instance_variable, build_ivar_reference, is_ivar, is_private, get_super_receiver, objc_build_finally_epilogue): Make into static functions. (receiver_is_class_object): Use new IS_CLASS() macro. (objc_build_message_expr): Tweak ObjC++ message argument handling; call objc_finish_message_expr() instead of finish_message_expr(). (finish_message_expr): Rename to objc_finish_message_expr(); use OBJC_TYPE_NAME and OBJC_SET_TYPE_NAME macros instead of TYPE_NAME. call gen_type_name() instead of gen_declaration(); call objc_is_id() instead of using IS_ID and IS_CLASS; Use objc_class_name instead of calling get_identifier("Class"); handle CONVERT_EXPRs in receiver. (build_objc_method_call, warn_with_method): Do not call groktypename(). (build_ivar_reference): Call convert() instead of clobbering in a type. (hash_init): Initialize string_htab hash table. (add_instance_variable): Simplify parameter list; do not call grokfield(); do not populate CLASS_IVARS list. (start_class): Check for the existence of super class, if one was specified. (continue_class): Use CLASS_RAW_IVARS rather than CLASS_IVARS; do not call build_class_template(); adjust call to get_class_ivars(); call build_decl(), pushdecl() and finish_decl() instead of define_decl(). (finish_class): Call build_decl(), pushdecl() and finish_decl() instead of define_decl(). (add_protocols): Use PROTOCOL_BINFO_ELTS for the tree vector size. (start_protocol): Do not call build_protocol_template(); use PROTOCOL_BINFO_ELTS for the tree vector size. (encode_type_qualifiers): Do not handle the 'const' qualifier here. (encode_pointer): Encode 'const char *' as 'r*', for backwards compatibility. (encode_array): Use HOST_WIDE_INT_PRINT_DEC instead of "%ld". (encode_type): Handle the 'const' qualifier here. (objc_parmlist): New global variable, sued by objc_push_parm and objc_get_parm_info(). (objc_push_parm, objc_get_parm_info): New functions. (objc_expr_last): Remove function. (synth_self_and_ucmd_args): For instance methods, use the instance type for 'self'; call objc_push_parm() instead of push_parm_decl(). (start_method_def): Do not call push_scope(), declare_parm_level(), pop_scope(), push_parm_decl(), store_parm_decls() or objc_expr_last(); just use objc_push_parm() and objc_get_parm_info(). (comp_method_with_proto): Remove function. (objc_types_are_equivalent): Strip away indirections before comparing underlying types. (comp_proto_with_proto): Do not call groktypename(); types are no longer in raw declspec format. (objc_start_function): New function. (really_start_method): Call comp_proto_with_proto() instead of comp_method_with_proto(); call objc_start_function() instead of hand-crafting a function declarator. (continue_method_def, objc_expand_function_end): Remove functions. (get_super_receiver): Call objc_get_current_scope() instead of get_current_scope(); reference 'super_class' field (instead of 'class'). (finish_method_def): Rename to objc_finish_method_definition() and add a function decl parameter; move method encoding call from objc_expand_function_end(). (is_complex_decl, adorn_decl, gen_declarator, gen_declspecs, gen_declaration_1): Remove functions. (tmpbuf, RAW_DECLSPEC): Remove. (gen_declaration): Remove second parameter; simplify to deal with TYPE_P nodes instead of raw declspecs. (gen_type_name, gen_type_name_0): New functions. (gen_method_decl): Remove second parameter; call gen_type_name() instead of gen_declaration_1(). (dump_interface): Adjust calls to gen_declaration() and gen_method_decl(); do not allocate a separate string buffer. (init_objc): Allocate a larger string buffer to accommodate dump_interface(); adjust call to build_module_descriptor(); add call to build_module_initializer_routine() for the GNU runtime. (generate_classref_translation_entry): Do not call start_decl(); call finish_var_decl() instead of finish_decl(); call convert() instead of build_c_cast(). * objc-act.h (CLASS_OWN_IVARS): Remove accessor. (CLASS_BINFO_ELTS): Reduce from 6 to 5, now that CLASS_OWN_IVARS is gone. (OCTI_GNU_INIT_DECL, GNU_INIT_decl): New. (OCTI_ELLIPSIS_NODE, objc_ellipsis_node): Remove. (OCTI_ID_ID, id_type, objc_id_id): Rename to OCTI_ID_NAME, objc_object_type and objc_object_name, respectively. (OCTI_CLS_REF, OCTI_CLASS_NAME, objc_class_reference, objc_class_name): New. (IS_CLASS): New macro. (IS_ID, IS_SUPER): Robustify. (OCTI_EXECCLASS_DECL, execclass_decl): New. (finish_file, start_class, continue_class, finish_class, start_method_def, continue_method_def, finish_method_def, start_protocol, finish_protocol, objc_build_throw_stmt, objc_build_try_catch_finally_stmt, objc_build_synchronized_prologue, objc_build_synchronized_epilogue, objc_build_try_prologue, objc_build_try_epilogue, objc_build_catch_stmt, objc_build_catch_epilogue, objc_build_finally_prologue, objc_build_finally_epilogue, is_ivar, is_private, is_public, add_instance_variable, objc_add_method, get_super_receiver, objc_clear_super_receiver, get_class_ivars_from_name, get_class_reference, get_static_reference, get_object_reference, build_message_expr, finish_message_expr, build_selector_expr, build_ivar_reference, build_keyword_decl, build_method_decl, build_protocol_expr, build_objc_string_object, objc_declare_alias, objc_declare_class, objc_declare_protocols, objc_comptypes, objc_check_decl, build_encode_expr): Remove prototypes. (imp_count, cat_count): Make GGC-aware. (OBJC_SET_TYPE_NAME): New macro. From-SVN: r87168
2004-09-08 02:49:44 +02:00
#endif
void *gc_object_type;
}; */
/* NB: The 'sel_id' and 'gc_object_type' fields are not being used by
the NeXT/Apple runtime; still, the compiler must generate them to
maintain backward binary compatibility (and to allow for future
expansion). */
1992-01-18 00:15:38 +01:00
static void
build_class_template (void)
1992-01-18 00:15:38 +01:00
{
Makefile.in (c-parse.o): Depend on $(C_COMMON_H). [gcc/ChangeLog] 2004-09-07 Ziemowit Laski <zlaski@apple.com> * Makefile.in (c-parse.o): Depend on $(C_COMMON_H). * c-parse.in: Include c-common.h instead of objc-act.h. (ivar_decl_list, ivar_decls, ivar_decl, ivars, ivar_declarator, myparms, myparm): Remove %type declarations. (methodtype, optparms, OBJC_TYPE_QUAL, objc_quals, objc_qual, objc_typename, objc_try_catch_stmt, optellipsis): Add %type declarations. (objc_inherit_code, objc_public_flag): Remove. (typespec_nonreserved_nonattr): Call objc_get_protocol_qualified_type() instead of get_static_reference() and get_protocol_reference(). (stmt_nocomp): Call grokparm() on @catch parameter. (objcdef): Move semantic action to objc_finish_implementation(). (classdef): Move semantic action to objc_start_class_interface(), objc_continue_interface(), objc_finish_interface(), objc_start_class_implementation(), objc_continue_implementation(), objc_start_category_interface() and objc_start_category_implementation(). (protocoldef): Move semantic actions to objc_start_protocol() and objc_finish_interface(). (ivar_decl_list): Remove nonterminal. (visibility_spec): Move semantic actions to objc_set_visibility(). (ivar_decls): Remove assignment to $$. (ivar_decl): Rephrase in terms of component_decl; call objc_add_instance_variable(). (ivars, ivar_declarator): Remove nonterminals. (opt_semi): New nonterminal. (methodtype): Remove semantic actions. (methoddef): Move semantic actions to objc_set_method_type(), objc_start_method_definition() and objc_finish_method_definition(). (methodproto): Move semantic actions to objc_set_method_type() and objc_add_method_declaration(). (methoddecl): Use objc_typename instead of typename; move semantic actions to objc_build_method_signature(). (optarglist, myxdecls, mydecl, myparms, myparm): Remove nonterminals. (optparmlist): Express in terms of optparms and optellipsis. (optparms, optellipsis, objc_qual, objc_quals, objc_typename): New nonterminals. (keyworddecl): Use objc_typename instead of typename. (rid_to_yy): Mark RID_IN, RID_OUT, RID_INOUT, RID_BYCOPY, RID_BYREF and RID_ONEWAY as returning OBJC_TYPE_QUAL to yyparse(). [gcc/objc/ChangeLog] 2004-09-07 Ziemowit Laski <zlaski@apple.com> * Make-lang.in (objc/objc-parse.o): Depend on $(C_COMMON_H) instead of objc/objc-act.h. (objc/objc-act.o): Depend on $(HASHTAB_H). * objc-act.c: Include hashtab.h; in ObjC++ mode, include cp-tree.h and objcp-decl.h instead of c-tree.h. (build_module_descriptor, get_class_ivars, synth_id_with_class_suffix, error_with_ivar, gen_method_decl, gen_declaration, setup_string_decl, build_protocol_template): Adjust prototypes. (build_module_initializer_routine, start_class, continue_class, finish_class, start_method_def, objc_start_function, start_protocol, build_method_decl, objc_add_method, add_instance_variable, build_ivar_reference, is_ivar, is_private, get_super_receiver, build_selector_table_decl, objc_push_parm, objc_get_parm_info, gen_type_name, gen_type_name_0, start_var_decl, finish_var_decl, create_field_decl): New prototypes. (objc_expand_function_end, comp_method_with_proto, objc_expr_last, gen_declaration_1, gen_declarator, is_complex_decl, adorn_decl, define_decl, create_builtin_decl, gen_declspecs): Remove prototypes. (TYPE_ID): Rename to OBJECT_TYPEDEF_NAME. (CLASS_TYPEDEF_NAME): New. (TAG_EXECCLASS): Change from a global variable to a #define. (TAG_RETURN_STRUCT): Delete. (TAG_GNUINIT): New, holds '__objc_gnu_init' name. (objc_inherit_code, objc_public_flag): New, moved from c-parse.in. (string_descriptor): New struct. (string_htab): New hash table. (string_hash, string_eq): New prototypes. (generate_struct_by_value_array): Call create_field_decl() instead of create_builtin_decl(). (objc_init): Do not initialize objc_ellipsis_node or TAG_EXECCLASS; In ObjC++ mode, call cxx_init() instead of c_objc_common_init(). (objc_finish_file): In ObjC++, call instantiate_pending_templates() and cp_finish_file(). (define_decl, get_static_reference, get_protocol_reference, create_builtin_decl): Remove functions. (objc_start_class_interface, objc_start_category_interface, objc_start_protocol, objc_continue_interface, objc_finish_interface, objc_start_class_implementation, objc_start_category_implementation, objc_continue_implementation, objc_finish_implementation, objc_set_visibility, objc_set_method_type, objc_build_method_signature, objc_add_method_declaration, objc_start_method_definition, objc_add_instance_variable, objc_get_protocol_qualified_type, create_field_decl, start_var_decl, finish_var_decl): New functions. (setup_string_decl): Simplify since it is only called once. (synth_module_prologue): Call build_class_template(); predefine 'id' and 'Class' as typedefs; rename 'temp_type' to 'type'; disable debug hooks for duration of function; fix GNU runtime messenger signatures to correspond to reality; forward-declare '__objc_exec_class' for the GNU runtime; call build_selector_table_decl(); in ObjC++ mode, generate 'extern "C" { ... }' wrappers around synthesized declarations; call build_protocol_template() and build_category_template(). (string_hash, string_eq): New functions. (objc_build_string_object): Check metaclass correctness only once; store string literals in hash table. (objc_build_constructor): Do not convert initializer elements; adjust for ObjC++ impedance mismatch. (build_objc_symtab_template): Call create_field_decl() instead of create_builtin_decl(). (init_objc_symtab): Add missing conversion to initializer element. (build_metadata_decl): Call start_var_decl() instead of define_decl(). (generate_objc_symtab_decl): Do not call build_category_template(); call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(). (build_module_descriptor): Call create_field_decl() instead of grokfield(); call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(); always mark module descriptor as used; move GNU runtime-specific functionality to build_module_initializer_routine(). (build_module_initializer_routine): New function, broken off of build_module_descriptor(). (objc_static_init_needed_p, objc_generate_static_init_call): New functions. (generate_static_references, generate_strings, build_selector_translation_table, generate_descriptor_table, generate_ivars_list, generate_dispatch_table, generate_category): Call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(); build a type directly instead of via groktypename(). (build_selector_reference_decl, build_selector_table_decl, build_class_reference_decl, build_protocol_reference, generate_objc_image_info): Call start_var_decl() instead of build_decl(). (build_selector_reference): For GNU runtime, do not call build_selector_reference_decl(). (build_selector, build_typed_selector_reference): Always convert result to the selector type. (add_objc_string): Cast return value to 'char *'. (build_method_prototype_template, build_selector_template, build_method_template): Use actual selector type for fields pointing to selectors. (finish_objc): For GNU runtime, call build_module_initializer_routine() after build_module_descriptor(). (generate_protocol_list, generate_shared_structures): Call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(); build a type directly instead of via groktypename(). (synth_id_with_class_suffix): Return a string. (get_arg_type_list): For instance methods, use the instance type for 'self'; do not call groktypename_in_parm_context(). (build_objc_string_decl): Squash redeclaration errors in ObjC++. (objc_is_class_name): Use OBJC_TYPE_NAME instead of TYPE_NAME; handle RECORD_TYPEs in ObjC as well as ObjC++. (objc_is_id): New function. (objc_is_object_ptr): Return the canonical type node. (objc_get_class_ivars): Simplify using get_class_ivars(). (get_class_ivars): Remove second parameter; create a fresh copy of the ivar list for each call; do not check for existence of super class. (objc_eh_runtime_type): Mark #ifndef OBJCPLUS. (objc_init_exceptions): When using SJLJ-style exceptions, require the use of '-fobjc-exceptions' flag; do not require it for DWARF-style exceptions. (objc_build_exc_ptr, next_sjlj_build_try_catch_finally): Use objc_object_type instead of objc_id_type. (objc_begin_catch_clause): Convert the incoming PARM_DECL into a VAR_DECL before placing it in the appropriate scope; do not call define_decl(); adjust call to c_begin_compound_stmt(); use objc_object_type instead of objc_id_type. (build_next_objc_exception_stuff): Call create_field_decl() instead of create_builtin_decl(); construct type directly instead of calling groktypename(); use OBJC_VOID_AT_END to mark end of function parameters. (build_private_template): Adjust call to get_class_ivars(); build a type directly instead of via groktypename(). (build_protocol_template, build_method_prototype_list_template, build_method_prototype_template, build_category_template, build_selector_template, build_class_template, build_super_template, build_ivar_template, build_ivar_list_template, build_method_list_template, build_method_template): Call create_field_decl() instead of grokfield(). (objc_method_parm_type): Do not call groktypename(). (generate_descriptor_table): Call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(). (generate_method_descriptors, build_protocol_initializer, generate_dispatch_tables, build_category_initializer, build_shared_structure_initializer): Do not call groktypename(). (generate_protocols): Call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(); do not call groktypename(). (error_with_ivar): Remove last parameter. (check_ivars): Do not iterate ovar CLASS_RAW_IVARS lists in addition to CLASS_IVARS lists; adjust calls to error_with_ivar(). (generate_ivar_lists): Convert one of the initializer elements; do not call groktypename(). (get_arg_type_list, start_method_def, gen_method_def): Account for new representation of variable arguments and '...' in Objective-C methods; add Objective-C++ impedance matching code. (is_objc_type_qualifier): Remove function. (adjust_type_for_id_default): Simplify; there is no longer a need to wade through declspecs. (lookup_interface, start_class, continue_class, finish_class, start_method_def, start_protocol, build_method_decl, objc_add_method, add_instance_variable, build_ivar_reference, is_ivar, is_private, get_super_receiver, objc_build_finally_epilogue): Make into static functions. (receiver_is_class_object): Use new IS_CLASS() macro. (objc_build_message_expr): Tweak ObjC++ message argument handling; call objc_finish_message_expr() instead of finish_message_expr(). (finish_message_expr): Rename to objc_finish_message_expr(); use OBJC_TYPE_NAME and OBJC_SET_TYPE_NAME macros instead of TYPE_NAME. call gen_type_name() instead of gen_declaration(); call objc_is_id() instead of using IS_ID and IS_CLASS; Use objc_class_name instead of calling get_identifier("Class"); handle CONVERT_EXPRs in receiver. (build_objc_method_call, warn_with_method): Do not call groktypename(). (build_ivar_reference): Call convert() instead of clobbering in a type. (hash_init): Initialize string_htab hash table. (add_instance_variable): Simplify parameter list; do not call grokfield(); do not populate CLASS_IVARS list. (start_class): Check for the existence of super class, if one was specified. (continue_class): Use CLASS_RAW_IVARS rather than CLASS_IVARS; do not call build_class_template(); adjust call to get_class_ivars(); call build_decl(), pushdecl() and finish_decl() instead of define_decl(). (finish_class): Call build_decl(), pushdecl() and finish_decl() instead of define_decl(). (add_protocols): Use PROTOCOL_BINFO_ELTS for the tree vector size. (start_protocol): Do not call build_protocol_template(); use PROTOCOL_BINFO_ELTS for the tree vector size. (encode_type_qualifiers): Do not handle the 'const' qualifier here. (encode_pointer): Encode 'const char *' as 'r*', for backwards compatibility. (encode_array): Use HOST_WIDE_INT_PRINT_DEC instead of "%ld". (encode_type): Handle the 'const' qualifier here. (objc_parmlist): New global variable, sued by objc_push_parm and objc_get_parm_info(). (objc_push_parm, objc_get_parm_info): New functions. (objc_expr_last): Remove function. (synth_self_and_ucmd_args): For instance methods, use the instance type for 'self'; call objc_push_parm() instead of push_parm_decl(). (start_method_def): Do not call push_scope(), declare_parm_level(), pop_scope(), push_parm_decl(), store_parm_decls() or objc_expr_last(); just use objc_push_parm() and objc_get_parm_info(). (comp_method_with_proto): Remove function. (objc_types_are_equivalent): Strip away indirections before comparing underlying types. (comp_proto_with_proto): Do not call groktypename(); types are no longer in raw declspec format. (objc_start_function): New function. (really_start_method): Call comp_proto_with_proto() instead of comp_method_with_proto(); call objc_start_function() instead of hand-crafting a function declarator. (continue_method_def, objc_expand_function_end): Remove functions. (get_super_receiver): Call objc_get_current_scope() instead of get_current_scope(); reference 'super_class' field (instead of 'class'). (finish_method_def): Rename to objc_finish_method_definition() and add a function decl parameter; move method encoding call from objc_expand_function_end(). (is_complex_decl, adorn_decl, gen_declarator, gen_declspecs, gen_declaration_1): Remove functions. (tmpbuf, RAW_DECLSPEC): Remove. (gen_declaration): Remove second parameter; simplify to deal with TYPE_P nodes instead of raw declspecs. (gen_type_name, gen_type_name_0): New functions. (gen_method_decl): Remove second parameter; call gen_type_name() instead of gen_declaration_1(). (dump_interface): Adjust calls to gen_declaration() and gen_method_decl(); do not allocate a separate string buffer. (init_objc): Allocate a larger string buffer to accommodate dump_interface(); adjust call to build_module_descriptor(); add call to build_module_initializer_routine() for the GNU runtime. (generate_classref_translation_entry): Do not call start_decl(); call finish_var_decl() instead of finish_decl(); call convert() instead of build_c_cast(). * objc-act.h (CLASS_OWN_IVARS): Remove accessor. (CLASS_BINFO_ELTS): Reduce from 6 to 5, now that CLASS_OWN_IVARS is gone. (OCTI_GNU_INIT_DECL, GNU_INIT_decl): New. (OCTI_ELLIPSIS_NODE, objc_ellipsis_node): Remove. (OCTI_ID_ID, id_type, objc_id_id): Rename to OCTI_ID_NAME, objc_object_type and objc_object_name, respectively. (OCTI_CLS_REF, OCTI_CLASS_NAME, objc_class_reference, objc_class_name): New. (IS_CLASS): New macro. (IS_ID, IS_SUPER): Robustify. (OCTI_EXECCLASS_DECL, execclass_decl): New. (finish_file, start_class, continue_class, finish_class, start_method_def, continue_method_def, finish_method_def, start_protocol, finish_protocol, objc_build_throw_stmt, objc_build_try_catch_finally_stmt, objc_build_synchronized_prologue, objc_build_synchronized_epilogue, objc_build_try_prologue, objc_build_try_epilogue, objc_build_catch_stmt, objc_build_catch_epilogue, objc_build_finally_prologue, objc_build_finally_epilogue, is_ivar, is_private, is_public, add_instance_variable, objc_add_method, get_super_receiver, objc_clear_super_receiver, get_class_ivars_from_name, get_class_reference, get_static_reference, get_object_reference, build_message_expr, finish_message_expr, build_selector_expr, build_ivar_reference, build_keyword_decl, build_method_decl, build_protocol_expr, build_objc_string_object, objc_declare_alias, objc_declare_class, objc_declare_protocols, objc_comptypes, objc_check_decl, build_encode_expr): Remove prototypes. (imp_count, cat_count): Make GGC-aware. (OBJC_SET_TYPE_NAME): New macro. From-SVN: r87168
2004-09-08 02:49:44 +02:00
tree field_decl, field_decl_chain;
1992-01-18 00:15:38 +01:00
objc_class_template
= start_struct (RECORD_TYPE, get_identifier (UTAG_CLASS));
1992-01-18 00:15:38 +01:00
Makefile.in (c-parse.o): Depend on $(C_COMMON_H). [gcc/ChangeLog] 2004-09-07 Ziemowit Laski <zlaski@apple.com> * Makefile.in (c-parse.o): Depend on $(C_COMMON_H). * c-parse.in: Include c-common.h instead of objc-act.h. (ivar_decl_list, ivar_decls, ivar_decl, ivars, ivar_declarator, myparms, myparm): Remove %type declarations. (methodtype, optparms, OBJC_TYPE_QUAL, objc_quals, objc_qual, objc_typename, objc_try_catch_stmt, optellipsis): Add %type declarations. (objc_inherit_code, objc_public_flag): Remove. (typespec_nonreserved_nonattr): Call objc_get_protocol_qualified_type() instead of get_static_reference() and get_protocol_reference(). (stmt_nocomp): Call grokparm() on @catch parameter. (objcdef): Move semantic action to objc_finish_implementation(). (classdef): Move semantic action to objc_start_class_interface(), objc_continue_interface(), objc_finish_interface(), objc_start_class_implementation(), objc_continue_implementation(), objc_start_category_interface() and objc_start_category_implementation(). (protocoldef): Move semantic actions to objc_start_protocol() and objc_finish_interface(). (ivar_decl_list): Remove nonterminal. (visibility_spec): Move semantic actions to objc_set_visibility(). (ivar_decls): Remove assignment to $$. (ivar_decl): Rephrase in terms of component_decl; call objc_add_instance_variable(). (ivars, ivar_declarator): Remove nonterminals. (opt_semi): New nonterminal. (methodtype): Remove semantic actions. (methoddef): Move semantic actions to objc_set_method_type(), objc_start_method_definition() and objc_finish_method_definition(). (methodproto): Move semantic actions to objc_set_method_type() and objc_add_method_declaration(). (methoddecl): Use objc_typename instead of typename; move semantic actions to objc_build_method_signature(). (optarglist, myxdecls, mydecl, myparms, myparm): Remove nonterminals. (optparmlist): Express in terms of optparms and optellipsis. (optparms, optellipsis, objc_qual, objc_quals, objc_typename): New nonterminals. (keyworddecl): Use objc_typename instead of typename. (rid_to_yy): Mark RID_IN, RID_OUT, RID_INOUT, RID_BYCOPY, RID_BYREF and RID_ONEWAY as returning OBJC_TYPE_QUAL to yyparse(). [gcc/objc/ChangeLog] 2004-09-07 Ziemowit Laski <zlaski@apple.com> * Make-lang.in (objc/objc-parse.o): Depend on $(C_COMMON_H) instead of objc/objc-act.h. (objc/objc-act.o): Depend on $(HASHTAB_H). * objc-act.c: Include hashtab.h; in ObjC++ mode, include cp-tree.h and objcp-decl.h instead of c-tree.h. (build_module_descriptor, get_class_ivars, synth_id_with_class_suffix, error_with_ivar, gen_method_decl, gen_declaration, setup_string_decl, build_protocol_template): Adjust prototypes. (build_module_initializer_routine, start_class, continue_class, finish_class, start_method_def, objc_start_function, start_protocol, build_method_decl, objc_add_method, add_instance_variable, build_ivar_reference, is_ivar, is_private, get_super_receiver, build_selector_table_decl, objc_push_parm, objc_get_parm_info, gen_type_name, gen_type_name_0, start_var_decl, finish_var_decl, create_field_decl): New prototypes. (objc_expand_function_end, comp_method_with_proto, objc_expr_last, gen_declaration_1, gen_declarator, is_complex_decl, adorn_decl, define_decl, create_builtin_decl, gen_declspecs): Remove prototypes. (TYPE_ID): Rename to OBJECT_TYPEDEF_NAME. (CLASS_TYPEDEF_NAME): New. (TAG_EXECCLASS): Change from a global variable to a #define. (TAG_RETURN_STRUCT): Delete. (TAG_GNUINIT): New, holds '__objc_gnu_init' name. (objc_inherit_code, objc_public_flag): New, moved from c-parse.in. (string_descriptor): New struct. (string_htab): New hash table. (string_hash, string_eq): New prototypes. (generate_struct_by_value_array): Call create_field_decl() instead of create_builtin_decl(). (objc_init): Do not initialize objc_ellipsis_node or TAG_EXECCLASS; In ObjC++ mode, call cxx_init() instead of c_objc_common_init(). (objc_finish_file): In ObjC++, call instantiate_pending_templates() and cp_finish_file(). (define_decl, get_static_reference, get_protocol_reference, create_builtin_decl): Remove functions. (objc_start_class_interface, objc_start_category_interface, objc_start_protocol, objc_continue_interface, objc_finish_interface, objc_start_class_implementation, objc_start_category_implementation, objc_continue_implementation, objc_finish_implementation, objc_set_visibility, objc_set_method_type, objc_build_method_signature, objc_add_method_declaration, objc_start_method_definition, objc_add_instance_variable, objc_get_protocol_qualified_type, create_field_decl, start_var_decl, finish_var_decl): New functions. (setup_string_decl): Simplify since it is only called once. (synth_module_prologue): Call build_class_template(); predefine 'id' and 'Class' as typedefs; rename 'temp_type' to 'type'; disable debug hooks for duration of function; fix GNU runtime messenger signatures to correspond to reality; forward-declare '__objc_exec_class' for the GNU runtime; call build_selector_table_decl(); in ObjC++ mode, generate 'extern "C" { ... }' wrappers around synthesized declarations; call build_protocol_template() and build_category_template(). (string_hash, string_eq): New functions. (objc_build_string_object): Check metaclass correctness only once; store string literals in hash table. (objc_build_constructor): Do not convert initializer elements; adjust for ObjC++ impedance mismatch. (build_objc_symtab_template): Call create_field_decl() instead of create_builtin_decl(). (init_objc_symtab): Add missing conversion to initializer element. (build_metadata_decl): Call start_var_decl() instead of define_decl(). (generate_objc_symtab_decl): Do not call build_category_template(); call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(). (build_module_descriptor): Call create_field_decl() instead of grokfield(); call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(); always mark module descriptor as used; move GNU runtime-specific functionality to build_module_initializer_routine(). (build_module_initializer_routine): New function, broken off of build_module_descriptor(). (objc_static_init_needed_p, objc_generate_static_init_call): New functions. (generate_static_references, generate_strings, build_selector_translation_table, generate_descriptor_table, generate_ivars_list, generate_dispatch_table, generate_category): Call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(); build a type directly instead of via groktypename(). (build_selector_reference_decl, build_selector_table_decl, build_class_reference_decl, build_protocol_reference, generate_objc_image_info): Call start_var_decl() instead of build_decl(). (build_selector_reference): For GNU runtime, do not call build_selector_reference_decl(). (build_selector, build_typed_selector_reference): Always convert result to the selector type. (add_objc_string): Cast return value to 'char *'. (build_method_prototype_template, build_selector_template, build_method_template): Use actual selector type for fields pointing to selectors. (finish_objc): For GNU runtime, call build_module_initializer_routine() after build_module_descriptor(). (generate_protocol_list, generate_shared_structures): Call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(); build a type directly instead of via groktypename(). (synth_id_with_class_suffix): Return a string. (get_arg_type_list): For instance methods, use the instance type for 'self'; do not call groktypename_in_parm_context(). (build_objc_string_decl): Squash redeclaration errors in ObjC++. (objc_is_class_name): Use OBJC_TYPE_NAME instead of TYPE_NAME; handle RECORD_TYPEs in ObjC as well as ObjC++. (objc_is_id): New function. (objc_is_object_ptr): Return the canonical type node. (objc_get_class_ivars): Simplify using get_class_ivars(). (get_class_ivars): Remove second parameter; create a fresh copy of the ivar list for each call; do not check for existence of super class. (objc_eh_runtime_type): Mark #ifndef OBJCPLUS. (objc_init_exceptions): When using SJLJ-style exceptions, require the use of '-fobjc-exceptions' flag; do not require it for DWARF-style exceptions. (objc_build_exc_ptr, next_sjlj_build_try_catch_finally): Use objc_object_type instead of objc_id_type. (objc_begin_catch_clause): Convert the incoming PARM_DECL into a VAR_DECL before placing it in the appropriate scope; do not call define_decl(); adjust call to c_begin_compound_stmt(); use objc_object_type instead of objc_id_type. (build_next_objc_exception_stuff): Call create_field_decl() instead of create_builtin_decl(); construct type directly instead of calling groktypename(); use OBJC_VOID_AT_END to mark end of function parameters. (build_private_template): Adjust call to get_class_ivars(); build a type directly instead of via groktypename(). (build_protocol_template, build_method_prototype_list_template, build_method_prototype_template, build_category_template, build_selector_template, build_class_template, build_super_template, build_ivar_template, build_ivar_list_template, build_method_list_template, build_method_template): Call create_field_decl() instead of grokfield(). (objc_method_parm_type): Do not call groktypename(). (generate_descriptor_table): Call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(). (generate_method_descriptors, build_protocol_initializer, generate_dispatch_tables, build_category_initializer, build_shared_structure_initializer): Do not call groktypename(). (generate_protocols): Call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(); do not call groktypename(). (error_with_ivar): Remove last parameter. (check_ivars): Do not iterate ovar CLASS_RAW_IVARS lists in addition to CLASS_IVARS lists; adjust calls to error_with_ivar(). (generate_ivar_lists): Convert one of the initializer elements; do not call groktypename(). (get_arg_type_list, start_method_def, gen_method_def): Account for new representation of variable arguments and '...' in Objective-C methods; add Objective-C++ impedance matching code. (is_objc_type_qualifier): Remove function. (adjust_type_for_id_default): Simplify; there is no longer a need to wade through declspecs. (lookup_interface, start_class, continue_class, finish_class, start_method_def, start_protocol, build_method_decl, objc_add_method, add_instance_variable, build_ivar_reference, is_ivar, is_private, get_super_receiver, objc_build_finally_epilogue): Make into static functions. (receiver_is_class_object): Use new IS_CLASS() macro. (objc_build_message_expr): Tweak ObjC++ message argument handling; call objc_finish_message_expr() instead of finish_message_expr(). (finish_message_expr): Rename to objc_finish_message_expr(); use OBJC_TYPE_NAME and OBJC_SET_TYPE_NAME macros instead of TYPE_NAME. call gen_type_name() instead of gen_declaration(); call objc_is_id() instead of using IS_ID and IS_CLASS; Use objc_class_name instead of calling get_identifier("Class"); handle CONVERT_EXPRs in receiver. (build_objc_method_call, warn_with_method): Do not call groktypename(). (build_ivar_reference): Call convert() instead of clobbering in a type. (hash_init): Initialize string_htab hash table. (add_instance_variable): Simplify parameter list; do not call grokfield(); do not populate CLASS_IVARS list. (start_class): Check for the existence of super class, if one was specified. (continue_class): Use CLASS_RAW_IVARS rather than CLASS_IVARS; do not call build_class_template(); adjust call to get_class_ivars(); call build_decl(), pushdecl() and finish_decl() instead of define_decl(). (finish_class): Call build_decl(), pushdecl() and finish_decl() instead of define_decl(). (add_protocols): Use PROTOCOL_BINFO_ELTS for the tree vector size. (start_protocol): Do not call build_protocol_template(); use PROTOCOL_BINFO_ELTS for the tree vector size. (encode_type_qualifiers): Do not handle the 'const' qualifier here. (encode_pointer): Encode 'const char *' as 'r*', for backwards compatibility. (encode_array): Use HOST_WIDE_INT_PRINT_DEC instead of "%ld". (encode_type): Handle the 'const' qualifier here. (objc_parmlist): New global variable, sued by objc_push_parm and objc_get_parm_info(). (objc_push_parm, objc_get_parm_info): New functions. (objc_expr_last): Remove function. (synth_self_and_ucmd_args): For instance methods, use the instance type for 'self'; call objc_push_parm() instead of push_parm_decl(). (start_method_def): Do not call push_scope(), declare_parm_level(), pop_scope(), push_parm_decl(), store_parm_decls() or objc_expr_last(); just use objc_push_parm() and objc_get_parm_info(). (comp_method_with_proto): Remove function. (objc_types_are_equivalent): Strip away indirections before comparing underlying types. (comp_proto_with_proto): Do not call groktypename(); types are no longer in raw declspec format. (objc_start_function): New function. (really_start_method): Call comp_proto_with_proto() instead of comp_method_with_proto(); call objc_start_function() instead of hand-crafting a function declarator. (continue_method_def, objc_expand_function_end): Remove functions. (get_super_receiver): Call objc_get_current_scope() instead of get_current_scope(); reference 'super_class' field (instead of 'class'). (finish_method_def): Rename to objc_finish_method_definition() and add a function decl parameter; move method encoding call from objc_expand_function_end(). (is_complex_decl, adorn_decl, gen_declarator, gen_declspecs, gen_declaration_1): Remove functions. (tmpbuf, RAW_DECLSPEC): Remove. (gen_declaration): Remove second parameter; simplify to deal with TYPE_P nodes instead of raw declspecs. (gen_type_name, gen_type_name_0): New functions. (gen_method_decl): Remove second parameter; call gen_type_name() instead of gen_declaration_1(). (dump_interface): Adjust calls to gen_declaration() and gen_method_decl(); do not allocate a separate string buffer. (init_objc): Allocate a larger string buffer to accommodate dump_interface(); adjust call to build_module_descriptor(); add call to build_module_initializer_routine() for the GNU runtime. (generate_classref_translation_entry): Do not call start_decl(); call finish_var_decl() instead of finish_decl(); call convert() instead of build_c_cast(). * objc-act.h (CLASS_OWN_IVARS): Remove accessor. (CLASS_BINFO_ELTS): Reduce from 6 to 5, now that CLASS_OWN_IVARS is gone. (OCTI_GNU_INIT_DECL, GNU_INIT_decl): New. (OCTI_ELLIPSIS_NODE, objc_ellipsis_node): Remove. (OCTI_ID_ID, id_type, objc_id_id): Rename to OCTI_ID_NAME, objc_object_type and objc_object_name, respectively. (OCTI_CLS_REF, OCTI_CLASS_NAME, objc_class_reference, objc_class_name): New. (IS_CLASS): New macro. (IS_ID, IS_SUPER): Robustify. (OCTI_EXECCLASS_DECL, execclass_decl): New. (finish_file, start_class, continue_class, finish_class, start_method_def, continue_method_def, finish_method_def, start_protocol, finish_protocol, objc_build_throw_stmt, objc_build_try_catch_finally_stmt, objc_build_synchronized_prologue, objc_build_synchronized_epilogue, objc_build_try_prologue, objc_build_try_epilogue, objc_build_catch_stmt, objc_build_catch_epilogue, objc_build_finally_prologue, objc_build_finally_epilogue, is_ivar, is_private, is_public, add_instance_variable, objc_add_method, get_super_receiver, objc_clear_super_receiver, get_class_ivars_from_name, get_class_reference, get_static_reference, get_object_reference, build_message_expr, finish_message_expr, build_selector_expr, build_ivar_reference, build_keyword_decl, build_method_decl, build_protocol_expr, build_objc_string_object, objc_declare_alias, objc_declare_class, objc_declare_protocols, objc_comptypes, objc_check_decl, build_encode_expr): Remove prototypes. (imp_count, cat_count): Make GGC-aware. (OBJC_SET_TYPE_NAME): New macro. From-SVN: r87168
2004-09-08 02:49:44 +02:00
/* struct _objc_class *isa; */
field_decl = create_field_decl (build_pointer_type (objc_class_template),
"isa");
1992-01-18 00:15:38 +01:00
field_decl_chain = field_decl;
Makefile.in (c-parse.o): Depend on $(C_COMMON_H). [gcc/ChangeLog] 2004-09-07 Ziemowit Laski <zlaski@apple.com> * Makefile.in (c-parse.o): Depend on $(C_COMMON_H). * c-parse.in: Include c-common.h instead of objc-act.h. (ivar_decl_list, ivar_decls, ivar_decl, ivars, ivar_declarator, myparms, myparm): Remove %type declarations. (methodtype, optparms, OBJC_TYPE_QUAL, objc_quals, objc_qual, objc_typename, objc_try_catch_stmt, optellipsis): Add %type declarations. (objc_inherit_code, objc_public_flag): Remove. (typespec_nonreserved_nonattr): Call objc_get_protocol_qualified_type() instead of get_static_reference() and get_protocol_reference(). (stmt_nocomp): Call grokparm() on @catch parameter. (objcdef): Move semantic action to objc_finish_implementation(). (classdef): Move semantic action to objc_start_class_interface(), objc_continue_interface(), objc_finish_interface(), objc_start_class_implementation(), objc_continue_implementation(), objc_start_category_interface() and objc_start_category_implementation(). (protocoldef): Move semantic actions to objc_start_protocol() and objc_finish_interface(). (ivar_decl_list): Remove nonterminal. (visibility_spec): Move semantic actions to objc_set_visibility(). (ivar_decls): Remove assignment to $$. (ivar_decl): Rephrase in terms of component_decl; call objc_add_instance_variable(). (ivars, ivar_declarator): Remove nonterminals. (opt_semi): New nonterminal. (methodtype): Remove semantic actions. (methoddef): Move semantic actions to objc_set_method_type(), objc_start_method_definition() and objc_finish_method_definition(). (methodproto): Move semantic actions to objc_set_method_type() and objc_add_method_declaration(). (methoddecl): Use objc_typename instead of typename; move semantic actions to objc_build_method_signature(). (optarglist, myxdecls, mydecl, myparms, myparm): Remove nonterminals. (optparmlist): Express in terms of optparms and optellipsis. (optparms, optellipsis, objc_qual, objc_quals, objc_typename): New nonterminals. (keyworddecl): Use objc_typename instead of typename. (rid_to_yy): Mark RID_IN, RID_OUT, RID_INOUT, RID_BYCOPY, RID_BYREF and RID_ONEWAY as returning OBJC_TYPE_QUAL to yyparse(). [gcc/objc/ChangeLog] 2004-09-07 Ziemowit Laski <zlaski@apple.com> * Make-lang.in (objc/objc-parse.o): Depend on $(C_COMMON_H) instead of objc/objc-act.h. (objc/objc-act.o): Depend on $(HASHTAB_H). * objc-act.c: Include hashtab.h; in ObjC++ mode, include cp-tree.h and objcp-decl.h instead of c-tree.h. (build_module_descriptor, get_class_ivars, synth_id_with_class_suffix, error_with_ivar, gen_method_decl, gen_declaration, setup_string_decl, build_protocol_template): Adjust prototypes. (build_module_initializer_routine, start_class, continue_class, finish_class, start_method_def, objc_start_function, start_protocol, build_method_decl, objc_add_method, add_instance_variable, build_ivar_reference, is_ivar, is_private, get_super_receiver, build_selector_table_decl, objc_push_parm, objc_get_parm_info, gen_type_name, gen_type_name_0, start_var_decl, finish_var_decl, create_field_decl): New prototypes. (objc_expand_function_end, comp_method_with_proto, objc_expr_last, gen_declaration_1, gen_declarator, is_complex_decl, adorn_decl, define_decl, create_builtin_decl, gen_declspecs): Remove prototypes. (TYPE_ID): Rename to OBJECT_TYPEDEF_NAME. (CLASS_TYPEDEF_NAME): New. (TAG_EXECCLASS): Change from a global variable to a #define. (TAG_RETURN_STRUCT): Delete. (TAG_GNUINIT): New, holds '__objc_gnu_init' name. (objc_inherit_code, objc_public_flag): New, moved from c-parse.in. (string_descriptor): New struct. (string_htab): New hash table. (string_hash, string_eq): New prototypes. (generate_struct_by_value_array): Call create_field_decl() instead of create_builtin_decl(). (objc_init): Do not initialize objc_ellipsis_node or TAG_EXECCLASS; In ObjC++ mode, call cxx_init() instead of c_objc_common_init(). (objc_finish_file): In ObjC++, call instantiate_pending_templates() and cp_finish_file(). (define_decl, get_static_reference, get_protocol_reference, create_builtin_decl): Remove functions. (objc_start_class_interface, objc_start_category_interface, objc_start_protocol, objc_continue_interface, objc_finish_interface, objc_start_class_implementation, objc_start_category_implementation, objc_continue_implementation, objc_finish_implementation, objc_set_visibility, objc_set_method_type, objc_build_method_signature, objc_add_method_declaration, objc_start_method_definition, objc_add_instance_variable, objc_get_protocol_qualified_type, create_field_decl, start_var_decl, finish_var_decl): New functions. (setup_string_decl): Simplify since it is only called once. (synth_module_prologue): Call build_class_template(); predefine 'id' and 'Class' as typedefs; rename 'temp_type' to 'type'; disable debug hooks for duration of function; fix GNU runtime messenger signatures to correspond to reality; forward-declare '__objc_exec_class' for the GNU runtime; call build_selector_table_decl(); in ObjC++ mode, generate 'extern "C" { ... }' wrappers around synthesized declarations; call build_protocol_template() and build_category_template(). (string_hash, string_eq): New functions. (objc_build_string_object): Check metaclass correctness only once; store string literals in hash table. (objc_build_constructor): Do not convert initializer elements; adjust for ObjC++ impedance mismatch. (build_objc_symtab_template): Call create_field_decl() instead of create_builtin_decl(). (init_objc_symtab): Add missing conversion to initializer element. (build_metadata_decl): Call start_var_decl() instead of define_decl(). (generate_objc_symtab_decl): Do not call build_category_template(); call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(). (build_module_descriptor): Call create_field_decl() instead of grokfield(); call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(); always mark module descriptor as used; move GNU runtime-specific functionality to build_module_initializer_routine(). (build_module_initializer_routine): New function, broken off of build_module_descriptor(). (objc_static_init_needed_p, objc_generate_static_init_call): New functions. (generate_static_references, generate_strings, build_selector_translation_table, generate_descriptor_table, generate_ivars_list, generate_dispatch_table, generate_category): Call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(); build a type directly instead of via groktypename(). (build_selector_reference_decl, build_selector_table_decl, build_class_reference_decl, build_protocol_reference, generate_objc_image_info): Call start_var_decl() instead of build_decl(). (build_selector_reference): For GNU runtime, do not call build_selector_reference_decl(). (build_selector, build_typed_selector_reference): Always convert result to the selector type. (add_objc_string): Cast return value to 'char *'. (build_method_prototype_template, build_selector_template, build_method_template): Use actual selector type for fields pointing to selectors. (finish_objc): For GNU runtime, call build_module_initializer_routine() after build_module_descriptor(). (generate_protocol_list, generate_shared_structures): Call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(); build a type directly instead of via groktypename(). (synth_id_with_class_suffix): Return a string. (get_arg_type_list): For instance methods, use the instance type for 'self'; do not call groktypename_in_parm_context(). (build_objc_string_decl): Squash redeclaration errors in ObjC++. (objc_is_class_name): Use OBJC_TYPE_NAME instead of TYPE_NAME; handle RECORD_TYPEs in ObjC as well as ObjC++. (objc_is_id): New function. (objc_is_object_ptr): Return the canonical type node. (objc_get_class_ivars): Simplify using get_class_ivars(). (get_class_ivars): Remove second parameter; create a fresh copy of the ivar list for each call; do not check for existence of super class. (objc_eh_runtime_type): Mark #ifndef OBJCPLUS. (objc_init_exceptions): When using SJLJ-style exceptions, require the use of '-fobjc-exceptions' flag; do not require it for DWARF-style exceptions. (objc_build_exc_ptr, next_sjlj_build_try_catch_finally): Use objc_object_type instead of objc_id_type. (objc_begin_catch_clause): Convert the incoming PARM_DECL into a VAR_DECL before placing it in the appropriate scope; do not call define_decl(); adjust call to c_begin_compound_stmt(); use objc_object_type instead of objc_id_type. (build_next_objc_exception_stuff): Call create_field_decl() instead of create_builtin_decl(); construct type directly instead of calling groktypename(); use OBJC_VOID_AT_END to mark end of function parameters. (build_private_template): Adjust call to get_class_ivars(); build a type directly instead of via groktypename(). (build_protocol_template, build_method_prototype_list_template, build_method_prototype_template, build_category_template, build_selector_template, build_class_template, build_super_template, build_ivar_template, build_ivar_list_template, build_method_list_template, build_method_template): Call create_field_decl() instead of grokfield(). (objc_method_parm_type): Do not call groktypename(). (generate_descriptor_table): Call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(). (generate_method_descriptors, build_protocol_initializer, generate_dispatch_tables, build_category_initializer, build_shared_structure_initializer): Do not call groktypename(). (generate_protocols): Call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(); do not call groktypename(). (error_with_ivar): Remove last parameter. (check_ivars): Do not iterate ovar CLASS_RAW_IVARS lists in addition to CLASS_IVARS lists; adjust calls to error_with_ivar(). (generate_ivar_lists): Convert one of the initializer elements; do not call groktypename(). (get_arg_type_list, start_method_def, gen_method_def): Account for new representation of variable arguments and '...' in Objective-C methods; add Objective-C++ impedance matching code. (is_objc_type_qualifier): Remove function. (adjust_type_for_id_default): Simplify; there is no longer a need to wade through declspecs. (lookup_interface, start_class, continue_class, finish_class, start_method_def, start_protocol, build_method_decl, objc_add_method, add_instance_variable, build_ivar_reference, is_ivar, is_private, get_super_receiver, objc_build_finally_epilogue): Make into static functions. (receiver_is_class_object): Use new IS_CLASS() macro. (objc_build_message_expr): Tweak ObjC++ message argument handling; call objc_finish_message_expr() instead of finish_message_expr(). (finish_message_expr): Rename to objc_finish_message_expr(); use OBJC_TYPE_NAME and OBJC_SET_TYPE_NAME macros instead of TYPE_NAME. call gen_type_name() instead of gen_declaration(); call objc_is_id() instead of using IS_ID and IS_CLASS; Use objc_class_name instead of calling get_identifier("Class"); handle CONVERT_EXPRs in receiver. (build_objc_method_call, warn_with_method): Do not call groktypename(). (build_ivar_reference): Call convert() instead of clobbering in a type. (hash_init): Initialize string_htab hash table. (add_instance_variable): Simplify parameter list; do not call grokfield(); do not populate CLASS_IVARS list. (start_class): Check for the existence of super class, if one was specified. (continue_class): Use CLASS_RAW_IVARS rather than CLASS_IVARS; do not call build_class_template(); adjust call to get_class_ivars(); call build_decl(), pushdecl() and finish_decl() instead of define_decl(). (finish_class): Call build_decl(), pushdecl() and finish_decl() instead of define_decl(). (add_protocols): Use PROTOCOL_BINFO_ELTS for the tree vector size. (start_protocol): Do not call build_protocol_template(); use PROTOCOL_BINFO_ELTS for the tree vector size. (encode_type_qualifiers): Do not handle the 'const' qualifier here. (encode_pointer): Encode 'const char *' as 'r*', for backwards compatibility. (encode_array): Use HOST_WIDE_INT_PRINT_DEC instead of "%ld". (encode_type): Handle the 'const' qualifier here. (objc_parmlist): New global variable, sued by objc_push_parm and objc_get_parm_info(). (objc_push_parm, objc_get_parm_info): New functions. (objc_expr_last): Remove function. (synth_self_and_ucmd_args): For instance methods, use the instance type for 'self'; call objc_push_parm() instead of push_parm_decl(). (start_method_def): Do not call push_scope(), declare_parm_level(), pop_scope(), push_parm_decl(), store_parm_decls() or objc_expr_last(); just use objc_push_parm() and objc_get_parm_info(). (comp_method_with_proto): Remove function. (objc_types_are_equivalent): Strip away indirections before comparing underlying types. (comp_proto_with_proto): Do not call groktypename(); types are no longer in raw declspec format. (objc_start_function): New function. (really_start_method): Call comp_proto_with_proto() instead of comp_method_with_proto(); call objc_start_function() instead of hand-crafting a function declarator. (continue_method_def, objc_expand_function_end): Remove functions. (get_super_receiver): Call objc_get_current_scope() instead of get_current_scope(); reference 'super_class' field (instead of 'class'). (finish_method_def): Rename to objc_finish_method_definition() and add a function decl parameter; move method encoding call from objc_expand_function_end(). (is_complex_decl, adorn_decl, gen_declarator, gen_declspecs, gen_declaration_1): Remove functions. (tmpbuf, RAW_DECLSPEC): Remove. (gen_declaration): Remove second parameter; simplify to deal with TYPE_P nodes instead of raw declspecs. (gen_type_name, gen_type_name_0): New functions. (gen_method_decl): Remove second parameter; call gen_type_name() instead of gen_declaration_1(). (dump_interface): Adjust calls to gen_declaration() and gen_method_decl(); do not allocate a separate string buffer. (init_objc): Allocate a larger string buffer to accommodate dump_interface(); adjust call to build_module_descriptor(); add call to build_module_initializer_routine() for the GNU runtime. (generate_classref_translation_entry): Do not call start_decl(); call finish_var_decl() instead of finish_decl(); call convert() instead of build_c_cast(). * objc-act.h (CLASS_OWN_IVARS): Remove accessor. (CLASS_BINFO_ELTS): Reduce from 6 to 5, now that CLASS_OWN_IVARS is gone. (OCTI_GNU_INIT_DECL, GNU_INIT_decl): New. (OCTI_ELLIPSIS_NODE, objc_ellipsis_node): Remove. (OCTI_ID_ID, id_type, objc_id_id): Rename to OCTI_ID_NAME, objc_object_type and objc_object_name, respectively. (OCTI_CLS_REF, OCTI_CLASS_NAME, objc_class_reference, objc_class_name): New. (IS_CLASS): New macro. (IS_ID, IS_SUPER): Robustify. (OCTI_EXECCLASS_DECL, execclass_decl): New. (finish_file, start_class, continue_class, finish_class, start_method_def, continue_method_def, finish_method_def, start_protocol, finish_protocol, objc_build_throw_stmt, objc_build_try_catch_finally_stmt, objc_build_synchronized_prologue, objc_build_synchronized_epilogue, objc_build_try_prologue, objc_build_try_epilogue, objc_build_catch_stmt, objc_build_catch_epilogue, objc_build_finally_prologue, objc_build_finally_epilogue, is_ivar, is_private, is_public, add_instance_variable, objc_add_method, get_super_receiver, objc_clear_super_receiver, get_class_ivars_from_name, get_class_reference, get_static_reference, get_object_reference, build_message_expr, finish_message_expr, build_selector_expr, build_ivar_reference, build_keyword_decl, build_method_decl, build_protocol_expr, build_objc_string_object, objc_declare_alias, objc_declare_class, objc_declare_protocols, objc_comptypes, objc_check_decl, build_encode_expr): Remove prototypes. (imp_count, cat_count): Make GGC-aware. (OBJC_SET_TYPE_NAME): New macro. From-SVN: r87168
2004-09-08 02:49:44 +02:00
/* struct _objc_class *super_class; */
field_decl = create_field_decl (build_pointer_type (objc_class_template),
"super_class");
1992-01-18 00:15:38 +01:00
chainon (field_decl_chain, field_decl);
/* char *name; */
Makefile.in (c-parse.o): Depend on $(C_COMMON_H). [gcc/ChangeLog] 2004-09-07 Ziemowit Laski <zlaski@apple.com> * Makefile.in (c-parse.o): Depend on $(C_COMMON_H). * c-parse.in: Include c-common.h instead of objc-act.h. (ivar_decl_list, ivar_decls, ivar_decl, ivars, ivar_declarator, myparms, myparm): Remove %type declarations. (methodtype, optparms, OBJC_TYPE_QUAL, objc_quals, objc_qual, objc_typename, objc_try_catch_stmt, optellipsis): Add %type declarations. (objc_inherit_code, objc_public_flag): Remove. (typespec_nonreserved_nonattr): Call objc_get_protocol_qualified_type() instead of get_static_reference() and get_protocol_reference(). (stmt_nocomp): Call grokparm() on @catch parameter. (objcdef): Move semantic action to objc_finish_implementation(). (classdef): Move semantic action to objc_start_class_interface(), objc_continue_interface(), objc_finish_interface(), objc_start_class_implementation(), objc_continue_implementation(), objc_start_category_interface() and objc_start_category_implementation(). (protocoldef): Move semantic actions to objc_start_protocol() and objc_finish_interface(). (ivar_decl_list): Remove nonterminal. (visibility_spec): Move semantic actions to objc_set_visibility(). (ivar_decls): Remove assignment to $$. (ivar_decl): Rephrase in terms of component_decl; call objc_add_instance_variable(). (ivars, ivar_declarator): Remove nonterminals. (opt_semi): New nonterminal. (methodtype): Remove semantic actions. (methoddef): Move semantic actions to objc_set_method_type(), objc_start_method_definition() and objc_finish_method_definition(). (methodproto): Move semantic actions to objc_set_method_type() and objc_add_method_declaration(). (methoddecl): Use objc_typename instead of typename; move semantic actions to objc_build_method_signature(). (optarglist, myxdecls, mydecl, myparms, myparm): Remove nonterminals. (optparmlist): Express in terms of optparms and optellipsis. (optparms, optellipsis, objc_qual, objc_quals, objc_typename): New nonterminals. (keyworddecl): Use objc_typename instead of typename. (rid_to_yy): Mark RID_IN, RID_OUT, RID_INOUT, RID_BYCOPY, RID_BYREF and RID_ONEWAY as returning OBJC_TYPE_QUAL to yyparse(). [gcc/objc/ChangeLog] 2004-09-07 Ziemowit Laski <zlaski@apple.com> * Make-lang.in (objc/objc-parse.o): Depend on $(C_COMMON_H) instead of objc/objc-act.h. (objc/objc-act.o): Depend on $(HASHTAB_H). * objc-act.c: Include hashtab.h; in ObjC++ mode, include cp-tree.h and objcp-decl.h instead of c-tree.h. (build_module_descriptor, get_class_ivars, synth_id_with_class_suffix, error_with_ivar, gen_method_decl, gen_declaration, setup_string_decl, build_protocol_template): Adjust prototypes. (build_module_initializer_routine, start_class, continue_class, finish_class, start_method_def, objc_start_function, start_protocol, build_method_decl, objc_add_method, add_instance_variable, build_ivar_reference, is_ivar, is_private, get_super_receiver, build_selector_table_decl, objc_push_parm, objc_get_parm_info, gen_type_name, gen_type_name_0, start_var_decl, finish_var_decl, create_field_decl): New prototypes. (objc_expand_function_end, comp_method_with_proto, objc_expr_last, gen_declaration_1, gen_declarator, is_complex_decl, adorn_decl, define_decl, create_builtin_decl, gen_declspecs): Remove prototypes. (TYPE_ID): Rename to OBJECT_TYPEDEF_NAME. (CLASS_TYPEDEF_NAME): New. (TAG_EXECCLASS): Change from a global variable to a #define. (TAG_RETURN_STRUCT): Delete. (TAG_GNUINIT): New, holds '__objc_gnu_init' name. (objc_inherit_code, objc_public_flag): New, moved from c-parse.in. (string_descriptor): New struct. (string_htab): New hash table. (string_hash, string_eq): New prototypes. (generate_struct_by_value_array): Call create_field_decl() instead of create_builtin_decl(). (objc_init): Do not initialize objc_ellipsis_node or TAG_EXECCLASS; In ObjC++ mode, call cxx_init() instead of c_objc_common_init(). (objc_finish_file): In ObjC++, call instantiate_pending_templates() and cp_finish_file(). (define_decl, get_static_reference, get_protocol_reference, create_builtin_decl): Remove functions. (objc_start_class_interface, objc_start_category_interface, objc_start_protocol, objc_continue_interface, objc_finish_interface, objc_start_class_implementation, objc_start_category_implementation, objc_continue_implementation, objc_finish_implementation, objc_set_visibility, objc_set_method_type, objc_build_method_signature, objc_add_method_declaration, objc_start_method_definition, objc_add_instance_variable, objc_get_protocol_qualified_type, create_field_decl, start_var_decl, finish_var_decl): New functions. (setup_string_decl): Simplify since it is only called once. (synth_module_prologue): Call build_class_template(); predefine 'id' and 'Class' as typedefs; rename 'temp_type' to 'type'; disable debug hooks for duration of function; fix GNU runtime messenger signatures to correspond to reality; forward-declare '__objc_exec_class' for the GNU runtime; call build_selector_table_decl(); in ObjC++ mode, generate 'extern "C" { ... }' wrappers around synthesized declarations; call build_protocol_template() and build_category_template(). (string_hash, string_eq): New functions. (objc_build_string_object): Check metaclass correctness only once; store string literals in hash table. (objc_build_constructor): Do not convert initializer elements; adjust for ObjC++ impedance mismatch. (build_objc_symtab_template): Call create_field_decl() instead of create_builtin_decl(). (init_objc_symtab): Add missing conversion to initializer element. (build_metadata_decl): Call start_var_decl() instead of define_decl(). (generate_objc_symtab_decl): Do not call build_category_template(); call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(). (build_module_descriptor): Call create_field_decl() instead of grokfield(); call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(); always mark module descriptor as used; move GNU runtime-specific functionality to build_module_initializer_routine(). (build_module_initializer_routine): New function, broken off of build_module_descriptor(). (objc_static_init_needed_p, objc_generate_static_init_call): New functions. (generate_static_references, generate_strings, build_selector_translation_table, generate_descriptor_table, generate_ivars_list, generate_dispatch_table, generate_category): Call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(); build a type directly instead of via groktypename(). (build_selector_reference_decl, build_selector_table_decl, build_class_reference_decl, build_protocol_reference, generate_objc_image_info): Call start_var_decl() instead of build_decl(). (build_selector_reference): For GNU runtime, do not call build_selector_reference_decl(). (build_selector, build_typed_selector_reference): Always convert result to the selector type. (add_objc_string): Cast return value to 'char *'. (build_method_prototype_template, build_selector_template, build_method_template): Use actual selector type for fields pointing to selectors. (finish_objc): For GNU runtime, call build_module_initializer_routine() after build_module_descriptor(). (generate_protocol_list, generate_shared_structures): Call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(); build a type directly instead of via groktypename(). (synth_id_with_class_suffix): Return a string. (get_arg_type_list): For instance methods, use the instance type for 'self'; do not call groktypename_in_parm_context(). (build_objc_string_decl): Squash redeclaration errors in ObjC++. (objc_is_class_name): Use OBJC_TYPE_NAME instead of TYPE_NAME; handle RECORD_TYPEs in ObjC as well as ObjC++. (objc_is_id): New function. (objc_is_object_ptr): Return the canonical type node. (objc_get_class_ivars): Simplify using get_class_ivars(). (get_class_ivars): Remove second parameter; create a fresh copy of the ivar list for each call; do not check for existence of super class. (objc_eh_runtime_type): Mark #ifndef OBJCPLUS. (objc_init_exceptions): When using SJLJ-style exceptions, require the use of '-fobjc-exceptions' flag; do not require it for DWARF-style exceptions. (objc_build_exc_ptr, next_sjlj_build_try_catch_finally): Use objc_object_type instead of objc_id_type. (objc_begin_catch_clause): Convert the incoming PARM_DECL into a VAR_DECL before placing it in the appropriate scope; do not call define_decl(); adjust call to c_begin_compound_stmt(); use objc_object_type instead of objc_id_type. (build_next_objc_exception_stuff): Call create_field_decl() instead of create_builtin_decl(); construct type directly instead of calling groktypename(); use OBJC_VOID_AT_END to mark end of function parameters. (build_private_template): Adjust call to get_class_ivars(); build a type directly instead of via groktypename(). (build_protocol_template, build_method_prototype_list_template, build_method_prototype_template, build_category_template, build_selector_template, build_class_template, build_super_template, build_ivar_template, build_ivar_list_template, build_method_list_template, build_method_template): Call create_field_decl() instead of grokfield(). (objc_method_parm_type): Do not call groktypename(). (generate_descriptor_table): Call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(). (generate_method_descriptors, build_protocol_initializer, generate_dispatch_tables, build_category_initializer, build_shared_structure_initializer): Do not call groktypename(). (generate_protocols): Call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(); do not call groktypename(). (error_with_ivar): Remove last parameter. (check_ivars): Do not iterate ovar CLASS_RAW_IVARS lists in addition to CLASS_IVARS lists; adjust calls to error_with_ivar(). (generate_ivar_lists): Convert one of the initializer elements; do not call groktypename(). (get_arg_type_list, start_method_def, gen_method_def): Account for new representation of variable arguments and '...' in Objective-C methods; add Objective-C++ impedance matching code. (is_objc_type_qualifier): Remove function. (adjust_type_for_id_default): Simplify; there is no longer a need to wade through declspecs. (lookup_interface, start_class, continue_class, finish_class, start_method_def, start_protocol, build_method_decl, objc_add_method, add_instance_variable, build_ivar_reference, is_ivar, is_private, get_super_receiver, objc_build_finally_epilogue): Make into static functions. (receiver_is_class_object): Use new IS_CLASS() macro. (objc_build_message_expr): Tweak ObjC++ message argument handling; call objc_finish_message_expr() instead of finish_message_expr(). (finish_message_expr): Rename to objc_finish_message_expr(); use OBJC_TYPE_NAME and OBJC_SET_TYPE_NAME macros instead of TYPE_NAME. call gen_type_name() instead of gen_declaration(); call objc_is_id() instead of using IS_ID and IS_CLASS; Use objc_class_name instead of calling get_identifier("Class"); handle CONVERT_EXPRs in receiver. (build_objc_method_call, warn_with_method): Do not call groktypename(). (build_ivar_reference): Call convert() instead of clobbering in a type. (hash_init): Initialize string_htab hash table. (add_instance_variable): Simplify parameter list; do not call grokfield(); do not populate CLASS_IVARS list. (start_class): Check for the existence of super class, if one was specified. (continue_class): Use CLASS_RAW_IVARS rather than CLASS_IVARS; do not call build_class_template(); adjust call to get_class_ivars(); call build_decl(), pushdecl() and finish_decl() instead of define_decl(). (finish_class): Call build_decl(), pushdecl() and finish_decl() instead of define_decl(). (add_protocols): Use PROTOCOL_BINFO_ELTS for the tree vector size. (start_protocol): Do not call build_protocol_template(); use PROTOCOL_BINFO_ELTS for the tree vector size. (encode_type_qualifiers): Do not handle the 'const' qualifier here. (encode_pointer): Encode 'const char *' as 'r*', for backwards compatibility. (encode_array): Use HOST_WIDE_INT_PRINT_DEC instead of "%ld". (encode_type): Handle the 'const' qualifier here. (objc_parmlist): New global variable, sued by objc_push_parm and objc_get_parm_info(). (objc_push_parm, objc_get_parm_info): New functions. (objc_expr_last): Remove function. (synth_self_and_ucmd_args): For instance methods, use the instance type for 'self'; call objc_push_parm() instead of push_parm_decl(). (start_method_def): Do not call push_scope(), declare_parm_level(), pop_scope(), push_parm_decl(), store_parm_decls() or objc_expr_last(); just use objc_push_parm() and objc_get_parm_info(). (comp_method_with_proto): Remove function. (objc_types_are_equivalent): Strip away indirections before comparing underlying types. (comp_proto_with_proto): Do not call groktypename(); types are no longer in raw declspec format. (objc_start_function): New function. (really_start_method): Call comp_proto_with_proto() instead of comp_method_with_proto(); call objc_start_function() instead of hand-crafting a function declarator. (continue_method_def, objc_expand_function_end): Remove functions. (get_super_receiver): Call objc_get_current_scope() instead of get_current_scope(); reference 'super_class' field (instead of 'class'). (finish_method_def): Rename to objc_finish_method_definition() and add a function decl parameter; move method encoding call from objc_expand_function_end(). (is_complex_decl, adorn_decl, gen_declarator, gen_declspecs, gen_declaration_1): Remove functions. (tmpbuf, RAW_DECLSPEC): Remove. (gen_declaration): Remove second parameter; simplify to deal with TYPE_P nodes instead of raw declspecs. (gen_type_name, gen_type_name_0): New functions. (gen_method_decl): Remove second parameter; call gen_type_name() instead of gen_declaration_1(). (dump_interface): Adjust calls to gen_declaration() and gen_method_decl(); do not allocate a separate string buffer. (init_objc): Allocate a larger string buffer to accommodate dump_interface(); adjust call to build_module_descriptor(); add call to build_module_initializer_routine() for the GNU runtime. (generate_classref_translation_entry): Do not call start_decl(); call finish_var_decl() instead of finish_decl(); call convert() instead of build_c_cast(). * objc-act.h (CLASS_OWN_IVARS): Remove accessor. (CLASS_BINFO_ELTS): Reduce from 6 to 5, now that CLASS_OWN_IVARS is gone. (OCTI_GNU_INIT_DECL, GNU_INIT_decl): New. (OCTI_ELLIPSIS_NODE, objc_ellipsis_node): Remove. (OCTI_ID_ID, id_type, objc_id_id): Rename to OCTI_ID_NAME, objc_object_type and objc_object_name, respectively. (OCTI_CLS_REF, OCTI_CLASS_NAME, objc_class_reference, objc_class_name): New. (IS_CLASS): New macro. (IS_ID, IS_SUPER): Robustify. (OCTI_EXECCLASS_DECL, execclass_decl): New. (finish_file, start_class, continue_class, finish_class, start_method_def, continue_method_def, finish_method_def, start_protocol, finish_protocol, objc_build_throw_stmt, objc_build_try_catch_finally_stmt, objc_build_synchronized_prologue, objc_build_synchronized_epilogue, objc_build_try_prologue, objc_build_try_epilogue, objc_build_catch_stmt, objc_build_catch_epilogue, objc_build_finally_prologue, objc_build_finally_epilogue, is_ivar, is_private, is_public, add_instance_variable, objc_add_method, get_super_receiver, objc_clear_super_receiver, get_class_ivars_from_name, get_class_reference, get_static_reference, get_object_reference, build_message_expr, finish_message_expr, build_selector_expr, build_ivar_reference, build_keyword_decl, build_method_decl, build_protocol_expr, build_objc_string_object, objc_declare_alias, objc_declare_class, objc_declare_protocols, objc_comptypes, objc_check_decl, build_encode_expr): Remove prototypes. (imp_count, cat_count): Make GGC-aware. (OBJC_SET_TYPE_NAME): New macro. From-SVN: r87168
2004-09-08 02:49:44 +02:00
field_decl = create_field_decl (string_type_node, "name");
1992-01-18 00:15:38 +01:00
chainon (field_decl_chain, field_decl);
/* long version; */
Makefile.in (c-parse.o): Depend on $(C_COMMON_H). [gcc/ChangeLog] 2004-09-07 Ziemowit Laski <zlaski@apple.com> * Makefile.in (c-parse.o): Depend on $(C_COMMON_H). * c-parse.in: Include c-common.h instead of objc-act.h. (ivar_decl_list, ivar_decls, ivar_decl, ivars, ivar_declarator, myparms, myparm): Remove %type declarations. (methodtype, optparms, OBJC_TYPE_QUAL, objc_quals, objc_qual, objc_typename, objc_try_catch_stmt, optellipsis): Add %type declarations. (objc_inherit_code, objc_public_flag): Remove. (typespec_nonreserved_nonattr): Call objc_get_protocol_qualified_type() instead of get_static_reference() and get_protocol_reference(). (stmt_nocomp): Call grokparm() on @catch parameter. (objcdef): Move semantic action to objc_finish_implementation(). (classdef): Move semantic action to objc_start_class_interface(), objc_continue_interface(), objc_finish_interface(), objc_start_class_implementation(), objc_continue_implementation(), objc_start_category_interface() and objc_start_category_implementation(). (protocoldef): Move semantic actions to objc_start_protocol() and objc_finish_interface(). (ivar_decl_list): Remove nonterminal. (visibility_spec): Move semantic actions to objc_set_visibility(). (ivar_decls): Remove assignment to $$. (ivar_decl): Rephrase in terms of component_decl; call objc_add_instance_variable(). (ivars, ivar_declarator): Remove nonterminals. (opt_semi): New nonterminal. (methodtype): Remove semantic actions. (methoddef): Move semantic actions to objc_set_method_type(), objc_start_method_definition() and objc_finish_method_definition(). (methodproto): Move semantic actions to objc_set_method_type() and objc_add_method_declaration(). (methoddecl): Use objc_typename instead of typename; move semantic actions to objc_build_method_signature(). (optarglist, myxdecls, mydecl, myparms, myparm): Remove nonterminals. (optparmlist): Express in terms of optparms and optellipsis. (optparms, optellipsis, objc_qual, objc_quals, objc_typename): New nonterminals. (keyworddecl): Use objc_typename instead of typename. (rid_to_yy): Mark RID_IN, RID_OUT, RID_INOUT, RID_BYCOPY, RID_BYREF and RID_ONEWAY as returning OBJC_TYPE_QUAL to yyparse(). [gcc/objc/ChangeLog] 2004-09-07 Ziemowit Laski <zlaski@apple.com> * Make-lang.in (objc/objc-parse.o): Depend on $(C_COMMON_H) instead of objc/objc-act.h. (objc/objc-act.o): Depend on $(HASHTAB_H). * objc-act.c: Include hashtab.h; in ObjC++ mode, include cp-tree.h and objcp-decl.h instead of c-tree.h. (build_module_descriptor, get_class_ivars, synth_id_with_class_suffix, error_with_ivar, gen_method_decl, gen_declaration, setup_string_decl, build_protocol_template): Adjust prototypes. (build_module_initializer_routine, start_class, continue_class, finish_class, start_method_def, objc_start_function, start_protocol, build_method_decl, objc_add_method, add_instance_variable, build_ivar_reference, is_ivar, is_private, get_super_receiver, build_selector_table_decl, objc_push_parm, objc_get_parm_info, gen_type_name, gen_type_name_0, start_var_decl, finish_var_decl, create_field_decl): New prototypes. (objc_expand_function_end, comp_method_with_proto, objc_expr_last, gen_declaration_1, gen_declarator, is_complex_decl, adorn_decl, define_decl, create_builtin_decl, gen_declspecs): Remove prototypes. (TYPE_ID): Rename to OBJECT_TYPEDEF_NAME. (CLASS_TYPEDEF_NAME): New. (TAG_EXECCLASS): Change from a global variable to a #define. (TAG_RETURN_STRUCT): Delete. (TAG_GNUINIT): New, holds '__objc_gnu_init' name. (objc_inherit_code, objc_public_flag): New, moved from c-parse.in. (string_descriptor): New struct. (string_htab): New hash table. (string_hash, string_eq): New prototypes. (generate_struct_by_value_array): Call create_field_decl() instead of create_builtin_decl(). (objc_init): Do not initialize objc_ellipsis_node or TAG_EXECCLASS; In ObjC++ mode, call cxx_init() instead of c_objc_common_init(). (objc_finish_file): In ObjC++, call instantiate_pending_templates() and cp_finish_file(). (define_decl, get_static_reference, get_protocol_reference, create_builtin_decl): Remove functions. (objc_start_class_interface, objc_start_category_interface, objc_start_protocol, objc_continue_interface, objc_finish_interface, objc_start_class_implementation, objc_start_category_implementation, objc_continue_implementation, objc_finish_implementation, objc_set_visibility, objc_set_method_type, objc_build_method_signature, objc_add_method_declaration, objc_start_method_definition, objc_add_instance_variable, objc_get_protocol_qualified_type, create_field_decl, start_var_decl, finish_var_decl): New functions. (setup_string_decl): Simplify since it is only called once. (synth_module_prologue): Call build_class_template(); predefine 'id' and 'Class' as typedefs; rename 'temp_type' to 'type'; disable debug hooks for duration of function; fix GNU runtime messenger signatures to correspond to reality; forward-declare '__objc_exec_class' for the GNU runtime; call build_selector_table_decl(); in ObjC++ mode, generate 'extern "C" { ... }' wrappers around synthesized declarations; call build_protocol_template() and build_category_template(). (string_hash, string_eq): New functions. (objc_build_string_object): Check metaclass correctness only once; store string literals in hash table. (objc_build_constructor): Do not convert initializer elements; adjust for ObjC++ impedance mismatch. (build_objc_symtab_template): Call create_field_decl() instead of create_builtin_decl(). (init_objc_symtab): Add missing conversion to initializer element. (build_metadata_decl): Call start_var_decl() instead of define_decl(). (generate_objc_symtab_decl): Do not call build_category_template(); call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(). (build_module_descriptor): Call create_field_decl() instead of grokfield(); call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(); always mark module descriptor as used; move GNU runtime-specific functionality to build_module_initializer_routine(). (build_module_initializer_routine): New function, broken off of build_module_descriptor(). (objc_static_init_needed_p, objc_generate_static_init_call): New functions. (generate_static_references, generate_strings, build_selector_translation_table, generate_descriptor_table, generate_ivars_list, generate_dispatch_table, generate_category): Call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(); build a type directly instead of via groktypename(). (build_selector_reference_decl, build_selector_table_decl, build_class_reference_decl, build_protocol_reference, generate_objc_image_info): Call start_var_decl() instead of build_decl(). (build_selector_reference): For GNU runtime, do not call build_selector_reference_decl(). (build_selector, build_typed_selector_reference): Always convert result to the selector type. (add_objc_string): Cast return value to 'char *'. (build_method_prototype_template, build_selector_template, build_method_template): Use actual selector type for fields pointing to selectors. (finish_objc): For GNU runtime, call build_module_initializer_routine() after build_module_descriptor(). (generate_protocol_list, generate_shared_structures): Call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(); build a type directly instead of via groktypename(). (synth_id_with_class_suffix): Return a string. (get_arg_type_list): For instance methods, use the instance type for 'self'; do not call groktypename_in_parm_context(). (build_objc_string_decl): Squash redeclaration errors in ObjC++. (objc_is_class_name): Use OBJC_TYPE_NAME instead of TYPE_NAME; handle RECORD_TYPEs in ObjC as well as ObjC++. (objc_is_id): New function. (objc_is_object_ptr): Return the canonical type node. (objc_get_class_ivars): Simplify using get_class_ivars(). (get_class_ivars): Remove second parameter; create a fresh copy of the ivar list for each call; do not check for existence of super class. (objc_eh_runtime_type): Mark #ifndef OBJCPLUS. (objc_init_exceptions): When using SJLJ-style exceptions, require the use of '-fobjc-exceptions' flag; do not require it for DWARF-style exceptions. (objc_build_exc_ptr, next_sjlj_build_try_catch_finally): Use objc_object_type instead of objc_id_type. (objc_begin_catch_clause): Convert the incoming PARM_DECL into a VAR_DECL before placing it in the appropriate scope; do not call define_decl(); adjust call to c_begin_compound_stmt(); use objc_object_type instead of objc_id_type. (build_next_objc_exception_stuff): Call create_field_decl() instead of create_builtin_decl(); construct type directly instead of calling groktypename(); use OBJC_VOID_AT_END to mark end of function parameters. (build_private_template): Adjust call to get_class_ivars(); build a type directly instead of via groktypename(). (build_protocol_template, build_method_prototype_list_template, build_method_prototype_template, build_category_template, build_selector_template, build_class_template, build_super_template, build_ivar_template, build_ivar_list_template, build_method_list_template, build_method_template): Call create_field_decl() instead of grokfield(). (objc_method_parm_type): Do not call groktypename(). (generate_descriptor_table): Call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(). (generate_method_descriptors, build_protocol_initializer, generate_dispatch_tables, build_category_initializer, build_shared_structure_initializer): Do not call groktypename(). (generate_protocols): Call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(); do not call groktypename(). (error_with_ivar): Remove last parameter. (check_ivars): Do not iterate ovar CLASS_RAW_IVARS lists in addition to CLASS_IVARS lists; adjust calls to error_with_ivar(). (generate_ivar_lists): Convert one of the initializer elements; do not call groktypename(). (get_arg_type_list, start_method_def, gen_method_def): Account for new representation of variable arguments and '...' in Objective-C methods; add Objective-C++ impedance matching code. (is_objc_type_qualifier): Remove function. (adjust_type_for_id_default): Simplify; there is no longer a need to wade through declspecs. (lookup_interface, start_class, continue_class, finish_class, start_method_def, start_protocol, build_method_decl, objc_add_method, add_instance_variable, build_ivar_reference, is_ivar, is_private, get_super_receiver, objc_build_finally_epilogue): Make into static functions. (receiver_is_class_object): Use new IS_CLASS() macro. (objc_build_message_expr): Tweak ObjC++ message argument handling; call objc_finish_message_expr() instead of finish_message_expr(). (finish_message_expr): Rename to objc_finish_message_expr(); use OBJC_TYPE_NAME and OBJC_SET_TYPE_NAME macros instead of TYPE_NAME. call gen_type_name() instead of gen_declaration(); call objc_is_id() instead of using IS_ID and IS_CLASS; Use objc_class_name instead of calling get_identifier("Class"); handle CONVERT_EXPRs in receiver. (build_objc_method_call, warn_with_method): Do not call groktypename(). (build_ivar_reference): Call convert() instead of clobbering in a type. (hash_init): Initialize string_htab hash table. (add_instance_variable): Simplify parameter list; do not call grokfield(); do not populate CLASS_IVARS list. (start_class): Check for the existence of super class, if one was specified. (continue_class): Use CLASS_RAW_IVARS rather than CLASS_IVARS; do not call build_class_template(); adjust call to get_class_ivars(); call build_decl(), pushdecl() and finish_decl() instead of define_decl(). (finish_class): Call build_decl(), pushdecl() and finish_decl() instead of define_decl(). (add_protocols): Use PROTOCOL_BINFO_ELTS for the tree vector size. (start_protocol): Do not call build_protocol_template(); use PROTOCOL_BINFO_ELTS for the tree vector size. (encode_type_qualifiers): Do not handle the 'const' qualifier here. (encode_pointer): Encode 'const char *' as 'r*', for backwards compatibility. (encode_array): Use HOST_WIDE_INT_PRINT_DEC instead of "%ld". (encode_type): Handle the 'const' qualifier here. (objc_parmlist): New global variable, sued by objc_push_parm and objc_get_parm_info(). (objc_push_parm, objc_get_parm_info): New functions. (objc_expr_last): Remove function. (synth_self_and_ucmd_args): For instance methods, use the instance type for 'self'; call objc_push_parm() instead of push_parm_decl(). (start_method_def): Do not call push_scope(), declare_parm_level(), pop_scope(), push_parm_decl(), store_parm_decls() or objc_expr_last(); just use objc_push_parm() and objc_get_parm_info(). (comp_method_with_proto): Remove function. (objc_types_are_equivalent): Strip away indirections before comparing underlying types. (comp_proto_with_proto): Do not call groktypename(); types are no longer in raw declspec format. (objc_start_function): New function. (really_start_method): Call comp_proto_with_proto() instead of comp_method_with_proto(); call objc_start_function() instead of hand-crafting a function declarator. (continue_method_def, objc_expand_function_end): Remove functions. (get_super_receiver): Call objc_get_current_scope() instead of get_current_scope(); reference 'super_class' field (instead of 'class'). (finish_method_def): Rename to objc_finish_method_definition() and add a function decl parameter; move method encoding call from objc_expand_function_end(). (is_complex_decl, adorn_decl, gen_declarator, gen_declspecs, gen_declaration_1): Remove functions. (tmpbuf, RAW_DECLSPEC): Remove. (gen_declaration): Remove second parameter; simplify to deal with TYPE_P nodes instead of raw declspecs. (gen_type_name, gen_type_name_0): New functions. (gen_method_decl): Remove second parameter; call gen_type_name() instead of gen_declaration_1(). (dump_interface): Adjust calls to gen_declaration() and gen_method_decl(); do not allocate a separate string buffer. (init_objc): Allocate a larger string buffer to accommodate dump_interface(); adjust call to build_module_descriptor(); add call to build_module_initializer_routine() for the GNU runtime. (generate_classref_translation_entry): Do not call start_decl(); call finish_var_decl() instead of finish_decl(); call convert() instead of build_c_cast(). * objc-act.h (CLASS_OWN_IVARS): Remove accessor. (CLASS_BINFO_ELTS): Reduce from 6 to 5, now that CLASS_OWN_IVARS is gone. (OCTI_GNU_INIT_DECL, GNU_INIT_decl): New. (OCTI_ELLIPSIS_NODE, objc_ellipsis_node): Remove. (OCTI_ID_ID, id_type, objc_id_id): Rename to OCTI_ID_NAME, objc_object_type and objc_object_name, respectively. (OCTI_CLS_REF, OCTI_CLASS_NAME, objc_class_reference, objc_class_name): New. (IS_CLASS): New macro. (IS_ID, IS_SUPER): Robustify. (OCTI_EXECCLASS_DECL, execclass_decl): New. (finish_file, start_class, continue_class, finish_class, start_method_def, continue_method_def, finish_method_def, start_protocol, finish_protocol, objc_build_throw_stmt, objc_build_try_catch_finally_stmt, objc_build_synchronized_prologue, objc_build_synchronized_epilogue, objc_build_try_prologue, objc_build_try_epilogue, objc_build_catch_stmt, objc_build_catch_epilogue, objc_build_finally_prologue, objc_build_finally_epilogue, is_ivar, is_private, is_public, add_instance_variable, objc_add_method, get_super_receiver, objc_clear_super_receiver, get_class_ivars_from_name, get_class_reference, get_static_reference, get_object_reference, build_message_expr, finish_message_expr, build_selector_expr, build_ivar_reference, build_keyword_decl, build_method_decl, build_protocol_expr, build_objc_string_object, objc_declare_alias, objc_declare_class, objc_declare_protocols, objc_comptypes, objc_check_decl, build_encode_expr): Remove prototypes. (imp_count, cat_count): Make GGC-aware. (OBJC_SET_TYPE_NAME): New macro. From-SVN: r87168
2004-09-08 02:49:44 +02:00
field_decl = create_field_decl (long_integer_type_node, "version");
1992-01-18 00:15:38 +01:00
chainon (field_decl_chain, field_decl);
/* long info; */
Makefile.in (c-parse.o): Depend on $(C_COMMON_H). [gcc/ChangeLog] 2004-09-07 Ziemowit Laski <zlaski@apple.com> * Makefile.in (c-parse.o): Depend on $(C_COMMON_H). * c-parse.in: Include c-common.h instead of objc-act.h. (ivar_decl_list, ivar_decls, ivar_decl, ivars, ivar_declarator, myparms, myparm): Remove %type declarations. (methodtype, optparms, OBJC_TYPE_QUAL, objc_quals, objc_qual, objc_typename, objc_try_catch_stmt, optellipsis): Add %type declarations. (objc_inherit_code, objc_public_flag): Remove. (typespec_nonreserved_nonattr): Call objc_get_protocol_qualified_type() instead of get_static_reference() and get_protocol_reference(). (stmt_nocomp): Call grokparm() on @catch parameter. (objcdef): Move semantic action to objc_finish_implementation(). (classdef): Move semantic action to objc_start_class_interface(), objc_continue_interface(), objc_finish_interface(), objc_start_class_implementation(), objc_continue_implementation(), objc_start_category_interface() and objc_start_category_implementation(). (protocoldef): Move semantic actions to objc_start_protocol() and objc_finish_interface(). (ivar_decl_list): Remove nonterminal. (visibility_spec): Move semantic actions to objc_set_visibility(). (ivar_decls): Remove assignment to $$. (ivar_decl): Rephrase in terms of component_decl; call objc_add_instance_variable(). (ivars, ivar_declarator): Remove nonterminals. (opt_semi): New nonterminal. (methodtype): Remove semantic actions. (methoddef): Move semantic actions to objc_set_method_type(), objc_start_method_definition() and objc_finish_method_definition(). (methodproto): Move semantic actions to objc_set_method_type() and objc_add_method_declaration(). (methoddecl): Use objc_typename instead of typename; move semantic actions to objc_build_method_signature(). (optarglist, myxdecls, mydecl, myparms, myparm): Remove nonterminals. (optparmlist): Express in terms of optparms and optellipsis. (optparms, optellipsis, objc_qual, objc_quals, objc_typename): New nonterminals. (keyworddecl): Use objc_typename instead of typename. (rid_to_yy): Mark RID_IN, RID_OUT, RID_INOUT, RID_BYCOPY, RID_BYREF and RID_ONEWAY as returning OBJC_TYPE_QUAL to yyparse(). [gcc/objc/ChangeLog] 2004-09-07 Ziemowit Laski <zlaski@apple.com> * Make-lang.in (objc/objc-parse.o): Depend on $(C_COMMON_H) instead of objc/objc-act.h. (objc/objc-act.o): Depend on $(HASHTAB_H). * objc-act.c: Include hashtab.h; in ObjC++ mode, include cp-tree.h and objcp-decl.h instead of c-tree.h. (build_module_descriptor, get_class_ivars, synth_id_with_class_suffix, error_with_ivar, gen_method_decl, gen_declaration, setup_string_decl, build_protocol_template): Adjust prototypes. (build_module_initializer_routine, start_class, continue_class, finish_class, start_method_def, objc_start_function, start_protocol, build_method_decl, objc_add_method, add_instance_variable, build_ivar_reference, is_ivar, is_private, get_super_receiver, build_selector_table_decl, objc_push_parm, objc_get_parm_info, gen_type_name, gen_type_name_0, start_var_decl, finish_var_decl, create_field_decl): New prototypes. (objc_expand_function_end, comp_method_with_proto, objc_expr_last, gen_declaration_1, gen_declarator, is_complex_decl, adorn_decl, define_decl, create_builtin_decl, gen_declspecs): Remove prototypes. (TYPE_ID): Rename to OBJECT_TYPEDEF_NAME. (CLASS_TYPEDEF_NAME): New. (TAG_EXECCLASS): Change from a global variable to a #define. (TAG_RETURN_STRUCT): Delete. (TAG_GNUINIT): New, holds '__objc_gnu_init' name. (objc_inherit_code, objc_public_flag): New, moved from c-parse.in. (string_descriptor): New struct. (string_htab): New hash table. (string_hash, string_eq): New prototypes. (generate_struct_by_value_array): Call create_field_decl() instead of create_builtin_decl(). (objc_init): Do not initialize objc_ellipsis_node or TAG_EXECCLASS; In ObjC++ mode, call cxx_init() instead of c_objc_common_init(). (objc_finish_file): In ObjC++, call instantiate_pending_templates() and cp_finish_file(). (define_decl, get_static_reference, get_protocol_reference, create_builtin_decl): Remove functions. (objc_start_class_interface, objc_start_category_interface, objc_start_protocol, objc_continue_interface, objc_finish_interface, objc_start_class_implementation, objc_start_category_implementation, objc_continue_implementation, objc_finish_implementation, objc_set_visibility, objc_set_method_type, objc_build_method_signature, objc_add_method_declaration, objc_start_method_definition, objc_add_instance_variable, objc_get_protocol_qualified_type, create_field_decl, start_var_decl, finish_var_decl): New functions. (setup_string_decl): Simplify since it is only called once. (synth_module_prologue): Call build_class_template(); predefine 'id' and 'Class' as typedefs; rename 'temp_type' to 'type'; disable debug hooks for duration of function; fix GNU runtime messenger signatures to correspond to reality; forward-declare '__objc_exec_class' for the GNU runtime; call build_selector_table_decl(); in ObjC++ mode, generate 'extern "C" { ... }' wrappers around synthesized declarations; call build_protocol_template() and build_category_template(). (string_hash, string_eq): New functions. (objc_build_string_object): Check metaclass correctness only once; store string literals in hash table. (objc_build_constructor): Do not convert initializer elements; adjust for ObjC++ impedance mismatch. (build_objc_symtab_template): Call create_field_decl() instead of create_builtin_decl(). (init_objc_symtab): Add missing conversion to initializer element. (build_metadata_decl): Call start_var_decl() instead of define_decl(). (generate_objc_symtab_decl): Do not call build_category_template(); call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(). (build_module_descriptor): Call create_field_decl() instead of grokfield(); call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(); always mark module descriptor as used; move GNU runtime-specific functionality to build_module_initializer_routine(). (build_module_initializer_routine): New function, broken off of build_module_descriptor(). (objc_static_init_needed_p, objc_generate_static_init_call): New functions. (generate_static_references, generate_strings, build_selector_translation_table, generate_descriptor_table, generate_ivars_list, generate_dispatch_table, generate_category): Call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(); build a type directly instead of via groktypename(). (build_selector_reference_decl, build_selector_table_decl, build_class_reference_decl, build_protocol_reference, generate_objc_image_info): Call start_var_decl() instead of build_decl(). (build_selector_reference): For GNU runtime, do not call build_selector_reference_decl(). (build_selector, build_typed_selector_reference): Always convert result to the selector type. (add_objc_string): Cast return value to 'char *'. (build_method_prototype_template, build_selector_template, build_method_template): Use actual selector type for fields pointing to selectors. (finish_objc): For GNU runtime, call build_module_initializer_routine() after build_module_descriptor(). (generate_protocol_list, generate_shared_structures): Call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(); build a type directly instead of via groktypename(). (synth_id_with_class_suffix): Return a string. (get_arg_type_list): For instance methods, use the instance type for 'self'; do not call groktypename_in_parm_context(). (build_objc_string_decl): Squash redeclaration errors in ObjC++. (objc_is_class_name): Use OBJC_TYPE_NAME instead of TYPE_NAME; handle RECORD_TYPEs in ObjC as well as ObjC++. (objc_is_id): New function. (objc_is_object_ptr): Return the canonical type node. (objc_get_class_ivars): Simplify using get_class_ivars(). (get_class_ivars): Remove second parameter; create a fresh copy of the ivar list for each call; do not check for existence of super class. (objc_eh_runtime_type): Mark #ifndef OBJCPLUS. (objc_init_exceptions): When using SJLJ-style exceptions, require the use of '-fobjc-exceptions' flag; do not require it for DWARF-style exceptions. (objc_build_exc_ptr, next_sjlj_build_try_catch_finally): Use objc_object_type instead of objc_id_type. (objc_begin_catch_clause): Convert the incoming PARM_DECL into a VAR_DECL before placing it in the appropriate scope; do not call define_decl(); adjust call to c_begin_compound_stmt(); use objc_object_type instead of objc_id_type. (build_next_objc_exception_stuff): Call create_field_decl() instead of create_builtin_decl(); construct type directly instead of calling groktypename(); use OBJC_VOID_AT_END to mark end of function parameters. (build_private_template): Adjust call to get_class_ivars(); build a type directly instead of via groktypename(). (build_protocol_template, build_method_prototype_list_template, build_method_prototype_template, build_category_template, build_selector_template, build_class_template, build_super_template, build_ivar_template, build_ivar_list_template, build_method_list_template, build_method_template): Call create_field_decl() instead of grokfield(). (objc_method_parm_type): Do not call groktypename(). (generate_descriptor_table): Call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(). (generate_method_descriptors, build_protocol_initializer, generate_dispatch_tables, build_category_initializer, build_shared_structure_initializer): Do not call groktypename(). (generate_protocols): Call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(); do not call groktypename(). (error_with_ivar): Remove last parameter. (check_ivars): Do not iterate ovar CLASS_RAW_IVARS lists in addition to CLASS_IVARS lists; adjust calls to error_with_ivar(). (generate_ivar_lists): Convert one of the initializer elements; do not call groktypename(). (get_arg_type_list, start_method_def, gen_method_def): Account for new representation of variable arguments and '...' in Objective-C methods; add Objective-C++ impedance matching code. (is_objc_type_qualifier): Remove function. (adjust_type_for_id_default): Simplify; there is no longer a need to wade through declspecs. (lookup_interface, start_class, continue_class, finish_class, start_method_def, start_protocol, build_method_decl, objc_add_method, add_instance_variable, build_ivar_reference, is_ivar, is_private, get_super_receiver, objc_build_finally_epilogue): Make into static functions. (receiver_is_class_object): Use new IS_CLASS() macro. (objc_build_message_expr): Tweak ObjC++ message argument handling; call objc_finish_message_expr() instead of finish_message_expr(). (finish_message_expr): Rename to objc_finish_message_expr(); use OBJC_TYPE_NAME and OBJC_SET_TYPE_NAME macros instead of TYPE_NAME. call gen_type_name() instead of gen_declaration(); call objc_is_id() instead of using IS_ID and IS_CLASS; Use objc_class_name instead of calling get_identifier("Class"); handle CONVERT_EXPRs in receiver. (build_objc_method_call, warn_with_method): Do not call groktypename(). (build_ivar_reference): Call convert() instead of clobbering in a type. (hash_init): Initialize string_htab hash table. (add_instance_variable): Simplify parameter list; do not call grokfield(); do not populate CLASS_IVARS list. (start_class): Check for the existence of super class, if one was specified. (continue_class): Use CLASS_RAW_IVARS rather than CLASS_IVARS; do not call build_class_template(); adjust call to get_class_ivars(); call build_decl(), pushdecl() and finish_decl() instead of define_decl(). (finish_class): Call build_decl(), pushdecl() and finish_decl() instead of define_decl(). (add_protocols): Use PROTOCOL_BINFO_ELTS for the tree vector size. (start_protocol): Do not call build_protocol_template(); use PROTOCOL_BINFO_ELTS for the tree vector size. (encode_type_qualifiers): Do not handle the 'const' qualifier here. (encode_pointer): Encode 'const char *' as 'r*', for backwards compatibility. (encode_array): Use HOST_WIDE_INT_PRINT_DEC instead of "%ld". (encode_type): Handle the 'const' qualifier here. (objc_parmlist): New global variable, sued by objc_push_parm and objc_get_parm_info(). (objc_push_parm, objc_get_parm_info): New functions. (objc_expr_last): Remove function. (synth_self_and_ucmd_args): For instance methods, use the instance type for 'self'; call objc_push_parm() instead of push_parm_decl(). (start_method_def): Do not call push_scope(), declare_parm_level(), pop_scope(), push_parm_decl(), store_parm_decls() or objc_expr_last(); just use objc_push_parm() and objc_get_parm_info(). (comp_method_with_proto): Remove function. (objc_types_are_equivalent): Strip away indirections before comparing underlying types. (comp_proto_with_proto): Do not call groktypename(); types are no longer in raw declspec format. (objc_start_function): New function. (really_start_method): Call comp_proto_with_proto() instead of comp_method_with_proto(); call objc_start_function() instead of hand-crafting a function declarator. (continue_method_def, objc_expand_function_end): Remove functions. (get_super_receiver): Call objc_get_current_scope() instead of get_current_scope(); reference 'super_class' field (instead of 'class'). (finish_method_def): Rename to objc_finish_method_definition() and add a function decl parameter; move method encoding call from objc_expand_function_end(). (is_complex_decl, adorn_decl, gen_declarator, gen_declspecs, gen_declaration_1): Remove functions. (tmpbuf, RAW_DECLSPEC): Remove. (gen_declaration): Remove second parameter; simplify to deal with TYPE_P nodes instead of raw declspecs. (gen_type_name, gen_type_name_0): New functions. (gen_method_decl): Remove second parameter; call gen_type_name() instead of gen_declaration_1(). (dump_interface): Adjust calls to gen_declaration() and gen_method_decl(); do not allocate a separate string buffer. (init_objc): Allocate a larger string buffer to accommodate dump_interface(); adjust call to build_module_descriptor(); add call to build_module_initializer_routine() for the GNU runtime. (generate_classref_translation_entry): Do not call start_decl(); call finish_var_decl() instead of finish_decl(); call convert() instead of build_c_cast(). * objc-act.h (CLASS_OWN_IVARS): Remove accessor. (CLASS_BINFO_ELTS): Reduce from 6 to 5, now that CLASS_OWN_IVARS is gone. (OCTI_GNU_INIT_DECL, GNU_INIT_decl): New. (OCTI_ELLIPSIS_NODE, objc_ellipsis_node): Remove. (OCTI_ID_ID, id_type, objc_id_id): Rename to OCTI_ID_NAME, objc_object_type and objc_object_name, respectively. (OCTI_CLS_REF, OCTI_CLASS_NAME, objc_class_reference, objc_class_name): New. (IS_CLASS): New macro. (IS_ID, IS_SUPER): Robustify. (OCTI_EXECCLASS_DECL, execclass_decl): New. (finish_file, start_class, continue_class, finish_class, start_method_def, continue_method_def, finish_method_def, start_protocol, finish_protocol, objc_build_throw_stmt, objc_build_try_catch_finally_stmt, objc_build_synchronized_prologue, objc_build_synchronized_epilogue, objc_build_try_prologue, objc_build_try_epilogue, objc_build_catch_stmt, objc_build_catch_epilogue, objc_build_finally_prologue, objc_build_finally_epilogue, is_ivar, is_private, is_public, add_instance_variable, objc_add_method, get_super_receiver, objc_clear_super_receiver, get_class_ivars_from_name, get_class_reference, get_static_reference, get_object_reference, build_message_expr, finish_message_expr, build_selector_expr, build_ivar_reference, build_keyword_decl, build_method_decl, build_protocol_expr, build_objc_string_object, objc_declare_alias, objc_declare_class, objc_declare_protocols, objc_comptypes, objc_check_decl, build_encode_expr): Remove prototypes. (imp_count, cat_count): Make GGC-aware. (OBJC_SET_TYPE_NAME): New macro. From-SVN: r87168
2004-09-08 02:49:44 +02:00
field_decl = create_field_decl (long_integer_type_node, "info");
1992-01-18 00:15:38 +01:00
chainon (field_decl_chain, field_decl);
/* long instance_size; */
Makefile.in (c-parse.o): Depend on $(C_COMMON_H). [gcc/ChangeLog] 2004-09-07 Ziemowit Laski <zlaski@apple.com> * Makefile.in (c-parse.o): Depend on $(C_COMMON_H). * c-parse.in: Include c-common.h instead of objc-act.h. (ivar_decl_list, ivar_decls, ivar_decl, ivars, ivar_declarator, myparms, myparm): Remove %type declarations. (methodtype, optparms, OBJC_TYPE_QUAL, objc_quals, objc_qual, objc_typename, objc_try_catch_stmt, optellipsis): Add %type declarations. (objc_inherit_code, objc_public_flag): Remove. (typespec_nonreserved_nonattr): Call objc_get_protocol_qualified_type() instead of get_static_reference() and get_protocol_reference(). (stmt_nocomp): Call grokparm() on @catch parameter. (objcdef): Move semantic action to objc_finish_implementation(). (classdef): Move semantic action to objc_start_class_interface(), objc_continue_interface(), objc_finish_interface(), objc_start_class_implementation(), objc_continue_implementation(), objc_start_category_interface() and objc_start_category_implementation(). (protocoldef): Move semantic actions to objc_start_protocol() and objc_finish_interface(). (ivar_decl_list): Remove nonterminal. (visibility_spec): Move semantic actions to objc_set_visibility(). (ivar_decls): Remove assignment to $$. (ivar_decl): Rephrase in terms of component_decl; call objc_add_instance_variable(). (ivars, ivar_declarator): Remove nonterminals. (opt_semi): New nonterminal. (methodtype): Remove semantic actions. (methoddef): Move semantic actions to objc_set_method_type(), objc_start_method_definition() and objc_finish_method_definition(). (methodproto): Move semantic actions to objc_set_method_type() and objc_add_method_declaration(). (methoddecl): Use objc_typename instead of typename; move semantic actions to objc_build_method_signature(). (optarglist, myxdecls, mydecl, myparms, myparm): Remove nonterminals. (optparmlist): Express in terms of optparms and optellipsis. (optparms, optellipsis, objc_qual, objc_quals, objc_typename): New nonterminals. (keyworddecl): Use objc_typename instead of typename. (rid_to_yy): Mark RID_IN, RID_OUT, RID_INOUT, RID_BYCOPY, RID_BYREF and RID_ONEWAY as returning OBJC_TYPE_QUAL to yyparse(). [gcc/objc/ChangeLog] 2004-09-07 Ziemowit Laski <zlaski@apple.com> * Make-lang.in (objc/objc-parse.o): Depend on $(C_COMMON_H) instead of objc/objc-act.h. (objc/objc-act.o): Depend on $(HASHTAB_H). * objc-act.c: Include hashtab.h; in ObjC++ mode, include cp-tree.h and objcp-decl.h instead of c-tree.h. (build_module_descriptor, get_class_ivars, synth_id_with_class_suffix, error_with_ivar, gen_method_decl, gen_declaration, setup_string_decl, build_protocol_template): Adjust prototypes. (build_module_initializer_routine, start_class, continue_class, finish_class, start_method_def, objc_start_function, start_protocol, build_method_decl, objc_add_method, add_instance_variable, build_ivar_reference, is_ivar, is_private, get_super_receiver, build_selector_table_decl, objc_push_parm, objc_get_parm_info, gen_type_name, gen_type_name_0, start_var_decl, finish_var_decl, create_field_decl): New prototypes. (objc_expand_function_end, comp_method_with_proto, objc_expr_last, gen_declaration_1, gen_declarator, is_complex_decl, adorn_decl, define_decl, create_builtin_decl, gen_declspecs): Remove prototypes. (TYPE_ID): Rename to OBJECT_TYPEDEF_NAME. (CLASS_TYPEDEF_NAME): New. (TAG_EXECCLASS): Change from a global variable to a #define. (TAG_RETURN_STRUCT): Delete. (TAG_GNUINIT): New, holds '__objc_gnu_init' name. (objc_inherit_code, objc_public_flag): New, moved from c-parse.in. (string_descriptor): New struct. (string_htab): New hash table. (string_hash, string_eq): New prototypes. (generate_struct_by_value_array): Call create_field_decl() instead of create_builtin_decl(). (objc_init): Do not initialize objc_ellipsis_node or TAG_EXECCLASS; In ObjC++ mode, call cxx_init() instead of c_objc_common_init(). (objc_finish_file): In ObjC++, call instantiate_pending_templates() and cp_finish_file(). (define_decl, get_static_reference, get_protocol_reference, create_builtin_decl): Remove functions. (objc_start_class_interface, objc_start_category_interface, objc_start_protocol, objc_continue_interface, objc_finish_interface, objc_start_class_implementation, objc_start_category_implementation, objc_continue_implementation, objc_finish_implementation, objc_set_visibility, objc_set_method_type, objc_build_method_signature, objc_add_method_declaration, objc_start_method_definition, objc_add_instance_variable, objc_get_protocol_qualified_type, create_field_decl, start_var_decl, finish_var_decl): New functions. (setup_string_decl): Simplify since it is only called once. (synth_module_prologue): Call build_class_template(); predefine 'id' and 'Class' as typedefs; rename 'temp_type' to 'type'; disable debug hooks for duration of function; fix GNU runtime messenger signatures to correspond to reality; forward-declare '__objc_exec_class' for the GNU runtime; call build_selector_table_decl(); in ObjC++ mode, generate 'extern "C" { ... }' wrappers around synthesized declarations; call build_protocol_template() and build_category_template(). (string_hash, string_eq): New functions. (objc_build_string_object): Check metaclass correctness only once; store string literals in hash table. (objc_build_constructor): Do not convert initializer elements; adjust for ObjC++ impedance mismatch. (build_objc_symtab_template): Call create_field_decl() instead of create_builtin_decl(). (init_objc_symtab): Add missing conversion to initializer element. (build_metadata_decl): Call start_var_decl() instead of define_decl(). (generate_objc_symtab_decl): Do not call build_category_template(); call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(). (build_module_descriptor): Call create_field_decl() instead of grokfield(); call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(); always mark module descriptor as used; move GNU runtime-specific functionality to build_module_initializer_routine(). (build_module_initializer_routine): New function, broken off of build_module_descriptor(). (objc_static_init_needed_p, objc_generate_static_init_call): New functions. (generate_static_references, generate_strings, build_selector_translation_table, generate_descriptor_table, generate_ivars_list, generate_dispatch_table, generate_category): Call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(); build a type directly instead of via groktypename(). (build_selector_reference_decl, build_selector_table_decl, build_class_reference_decl, build_protocol_reference, generate_objc_image_info): Call start_var_decl() instead of build_decl(). (build_selector_reference): For GNU runtime, do not call build_selector_reference_decl(). (build_selector, build_typed_selector_reference): Always convert result to the selector type. (add_objc_string): Cast return value to 'char *'. (build_method_prototype_template, build_selector_template, build_method_template): Use actual selector type for fields pointing to selectors. (finish_objc): For GNU runtime, call build_module_initializer_routine() after build_module_descriptor(). (generate_protocol_list, generate_shared_structures): Call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(); build a type directly instead of via groktypename(). (synth_id_with_class_suffix): Return a string. (get_arg_type_list): For instance methods, use the instance type for 'self'; do not call groktypename_in_parm_context(). (build_objc_string_decl): Squash redeclaration errors in ObjC++. (objc_is_class_name): Use OBJC_TYPE_NAME instead of TYPE_NAME; handle RECORD_TYPEs in ObjC as well as ObjC++. (objc_is_id): New function. (objc_is_object_ptr): Return the canonical type node. (objc_get_class_ivars): Simplify using get_class_ivars(). (get_class_ivars): Remove second parameter; create a fresh copy of the ivar list for each call; do not check for existence of super class. (objc_eh_runtime_type): Mark #ifndef OBJCPLUS. (objc_init_exceptions): When using SJLJ-style exceptions, require the use of '-fobjc-exceptions' flag; do not require it for DWARF-style exceptions. (objc_build_exc_ptr, next_sjlj_build_try_catch_finally): Use objc_object_type instead of objc_id_type. (objc_begin_catch_clause): Convert the incoming PARM_DECL into a VAR_DECL before placing it in the appropriate scope; do not call define_decl(); adjust call to c_begin_compound_stmt(); use objc_object_type instead of objc_id_type. (build_next_objc_exception_stuff): Call create_field_decl() instead of create_builtin_decl(); construct type directly instead of calling groktypename(); use OBJC_VOID_AT_END to mark end of function parameters. (build_private_template): Adjust call to get_class_ivars(); build a type directly instead of via groktypename(). (build_protocol_template, build_method_prototype_list_template, build_method_prototype_template, build_category_template, build_selector_template, build_class_template, build_super_template, build_ivar_template, build_ivar_list_template, build_method_list_template, build_method_template): Call create_field_decl() instead of grokfield(). (objc_method_parm_type): Do not call groktypename(). (generate_descriptor_table): Call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(). (generate_method_descriptors, build_protocol_initializer, generate_dispatch_tables, build_category_initializer, build_shared_structure_initializer): Do not call groktypename(). (generate_protocols): Call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(); do not call groktypename(). (error_with_ivar): Remove last parameter. (check_ivars): Do not iterate ovar CLASS_RAW_IVARS lists in addition to CLASS_IVARS lists; adjust calls to error_with_ivar(). (generate_ivar_lists): Convert one of the initializer elements; do not call groktypename(). (get_arg_type_list, start_method_def, gen_method_def): Account for new representation of variable arguments and '...' in Objective-C methods; add Objective-C++ impedance matching code. (is_objc_type_qualifier): Remove function. (adjust_type_for_id_default): Simplify; there is no longer a need to wade through declspecs. (lookup_interface, start_class, continue_class, finish_class, start_method_def, start_protocol, build_method_decl, objc_add_method, add_instance_variable, build_ivar_reference, is_ivar, is_private, get_super_receiver, objc_build_finally_epilogue): Make into static functions. (receiver_is_class_object): Use new IS_CLASS() macro. (objc_build_message_expr): Tweak ObjC++ message argument handling; call objc_finish_message_expr() instead of finish_message_expr(). (finish_message_expr): Rename to objc_finish_message_expr(); use OBJC_TYPE_NAME and OBJC_SET_TYPE_NAME macros instead of TYPE_NAME. call gen_type_name() instead of gen_declaration(); call objc_is_id() instead of using IS_ID and IS_CLASS; Use objc_class_name instead of calling get_identifier("Class"); handle CONVERT_EXPRs in receiver. (build_objc_method_call, warn_with_method): Do not call groktypename(). (build_ivar_reference): Call convert() instead of clobbering in a type. (hash_init): Initialize string_htab hash table. (add_instance_variable): Simplify parameter list; do not call grokfield(); do not populate CLASS_IVARS list. (start_class): Check for the existence of super class, if one was specified. (continue_class): Use CLASS_RAW_IVARS rather than CLASS_IVARS; do not call build_class_template(); adjust call to get_class_ivars(); call build_decl(), pushdecl() and finish_decl() instead of define_decl(). (finish_class): Call build_decl(), pushdecl() and finish_decl() instead of define_decl(). (add_protocols): Use PROTOCOL_BINFO_ELTS for the tree vector size. (start_protocol): Do not call build_protocol_template(); use PROTOCOL_BINFO_ELTS for the tree vector size. (encode_type_qualifiers): Do not handle the 'const' qualifier here. (encode_pointer): Encode 'const char *' as 'r*', for backwards compatibility. (encode_array): Use HOST_WIDE_INT_PRINT_DEC instead of "%ld". (encode_type): Handle the 'const' qualifier here. (objc_parmlist): New global variable, sued by objc_push_parm and objc_get_parm_info(). (objc_push_parm, objc_get_parm_info): New functions. (objc_expr_last): Remove function. (synth_self_and_ucmd_args): For instance methods, use the instance type for 'self'; call objc_push_parm() instead of push_parm_decl(). (start_method_def): Do not call push_scope(), declare_parm_level(), pop_scope(), push_parm_decl(), store_parm_decls() or objc_expr_last(); just use objc_push_parm() and objc_get_parm_info(). (comp_method_with_proto): Remove function. (objc_types_are_equivalent): Strip away indirections before comparing underlying types. (comp_proto_with_proto): Do not call groktypename(); types are no longer in raw declspec format. (objc_start_function): New function. (really_start_method): Call comp_proto_with_proto() instead of comp_method_with_proto(); call objc_start_function() instead of hand-crafting a function declarator. (continue_method_def, objc_expand_function_end): Remove functions. (get_super_receiver): Call objc_get_current_scope() instead of get_current_scope(); reference 'super_class' field (instead of 'class'). (finish_method_def): Rename to objc_finish_method_definition() and add a function decl parameter; move method encoding call from objc_expand_function_end(). (is_complex_decl, adorn_decl, gen_declarator, gen_declspecs, gen_declaration_1): Remove functions. (tmpbuf, RAW_DECLSPEC): Remove. (gen_declaration): Remove second parameter; simplify to deal with TYPE_P nodes instead of raw declspecs. (gen_type_name, gen_type_name_0): New functions. (gen_method_decl): Remove second parameter; call gen_type_name() instead of gen_declaration_1(). (dump_interface): Adjust calls to gen_declaration() and gen_method_decl(); do not allocate a separate string buffer. (init_objc): Allocate a larger string buffer to accommodate dump_interface(); adjust call to build_module_descriptor(); add call to build_module_initializer_routine() for the GNU runtime. (generate_classref_translation_entry): Do not call start_decl(); call finish_var_decl() instead of finish_decl(); call convert() instead of build_c_cast(). * objc-act.h (CLASS_OWN_IVARS): Remove accessor. (CLASS_BINFO_ELTS): Reduce from 6 to 5, now that CLASS_OWN_IVARS is gone. (OCTI_GNU_INIT_DECL, GNU_INIT_decl): New. (OCTI_ELLIPSIS_NODE, objc_ellipsis_node): Remove. (OCTI_ID_ID, id_type, objc_id_id): Rename to OCTI_ID_NAME, objc_object_type and objc_object_name, respectively. (OCTI_CLS_REF, OCTI_CLASS_NAME, objc_class_reference, objc_class_name): New. (IS_CLASS): New macro. (IS_ID, IS_SUPER): Robustify. (OCTI_EXECCLASS_DECL, execclass_decl): New. (finish_file, start_class, continue_class, finish_class, start_method_def, continue_method_def, finish_method_def, start_protocol, finish_protocol, objc_build_throw_stmt, objc_build_try_catch_finally_stmt, objc_build_synchronized_prologue, objc_build_synchronized_epilogue, objc_build_try_prologue, objc_build_try_epilogue, objc_build_catch_stmt, objc_build_catch_epilogue, objc_build_finally_prologue, objc_build_finally_epilogue, is_ivar, is_private, is_public, add_instance_variable, objc_add_method, get_super_receiver, objc_clear_super_receiver, get_class_ivars_from_name, get_class_reference, get_static_reference, get_object_reference, build_message_expr, finish_message_expr, build_selector_expr, build_ivar_reference, build_keyword_decl, build_method_decl, build_protocol_expr, build_objc_string_object, objc_declare_alias, objc_declare_class, objc_declare_protocols, objc_comptypes, objc_check_decl, build_encode_expr): Remove prototypes. (imp_count, cat_count): Make GGC-aware. (OBJC_SET_TYPE_NAME): New macro. From-SVN: r87168
2004-09-08 02:49:44 +02:00
field_decl = create_field_decl (long_integer_type_node, "instance_size");
1992-01-18 00:15:38 +01:00
chainon (field_decl_chain, field_decl);
Makefile.in (c-parse.o): Depend on $(C_COMMON_H). [gcc/ChangeLog] 2004-09-07 Ziemowit Laski <zlaski@apple.com> * Makefile.in (c-parse.o): Depend on $(C_COMMON_H). * c-parse.in: Include c-common.h instead of objc-act.h. (ivar_decl_list, ivar_decls, ivar_decl, ivars, ivar_declarator, myparms, myparm): Remove %type declarations. (methodtype, optparms, OBJC_TYPE_QUAL, objc_quals, objc_qual, objc_typename, objc_try_catch_stmt, optellipsis): Add %type declarations. (objc_inherit_code, objc_public_flag): Remove. (typespec_nonreserved_nonattr): Call objc_get_protocol_qualified_type() instead of get_static_reference() and get_protocol_reference(). (stmt_nocomp): Call grokparm() on @catch parameter. (objcdef): Move semantic action to objc_finish_implementation(). (classdef): Move semantic action to objc_start_class_interface(), objc_continue_interface(), objc_finish_interface(), objc_start_class_implementation(), objc_continue_implementation(), objc_start_category_interface() and objc_start_category_implementation(). (protocoldef): Move semantic actions to objc_start_protocol() and objc_finish_interface(). (ivar_decl_list): Remove nonterminal. (visibility_spec): Move semantic actions to objc_set_visibility(). (ivar_decls): Remove assignment to $$. (ivar_decl): Rephrase in terms of component_decl; call objc_add_instance_variable(). (ivars, ivar_declarator): Remove nonterminals. (opt_semi): New nonterminal. (methodtype): Remove semantic actions. (methoddef): Move semantic actions to objc_set_method_type(), objc_start_method_definition() and objc_finish_method_definition(). (methodproto): Move semantic actions to objc_set_method_type() and objc_add_method_declaration(). (methoddecl): Use objc_typename instead of typename; move semantic actions to objc_build_method_signature(). (optarglist, myxdecls, mydecl, myparms, myparm): Remove nonterminals. (optparmlist): Express in terms of optparms and optellipsis. (optparms, optellipsis, objc_qual, objc_quals, objc_typename): New nonterminals. (keyworddecl): Use objc_typename instead of typename. (rid_to_yy): Mark RID_IN, RID_OUT, RID_INOUT, RID_BYCOPY, RID_BYREF and RID_ONEWAY as returning OBJC_TYPE_QUAL to yyparse(). [gcc/objc/ChangeLog] 2004-09-07 Ziemowit Laski <zlaski@apple.com> * Make-lang.in (objc/objc-parse.o): Depend on $(C_COMMON_H) instead of objc/objc-act.h. (objc/objc-act.o): Depend on $(HASHTAB_H). * objc-act.c: Include hashtab.h; in ObjC++ mode, include cp-tree.h and objcp-decl.h instead of c-tree.h. (build_module_descriptor, get_class_ivars, synth_id_with_class_suffix, error_with_ivar, gen_method_decl, gen_declaration, setup_string_decl, build_protocol_template): Adjust prototypes. (build_module_initializer_routine, start_class, continue_class, finish_class, start_method_def, objc_start_function, start_protocol, build_method_decl, objc_add_method, add_instance_variable, build_ivar_reference, is_ivar, is_private, get_super_receiver, build_selector_table_decl, objc_push_parm, objc_get_parm_info, gen_type_name, gen_type_name_0, start_var_decl, finish_var_decl, create_field_decl): New prototypes. (objc_expand_function_end, comp_method_with_proto, objc_expr_last, gen_declaration_1, gen_declarator, is_complex_decl, adorn_decl, define_decl, create_builtin_decl, gen_declspecs): Remove prototypes. (TYPE_ID): Rename to OBJECT_TYPEDEF_NAME. (CLASS_TYPEDEF_NAME): New. (TAG_EXECCLASS): Change from a global variable to a #define. (TAG_RETURN_STRUCT): Delete. (TAG_GNUINIT): New, holds '__objc_gnu_init' name. (objc_inherit_code, objc_public_flag): New, moved from c-parse.in. (string_descriptor): New struct. (string_htab): New hash table. (string_hash, string_eq): New prototypes. (generate_struct_by_value_array): Call create_field_decl() instead of create_builtin_decl(). (objc_init): Do not initialize objc_ellipsis_node or TAG_EXECCLASS; In ObjC++ mode, call cxx_init() instead of c_objc_common_init(). (objc_finish_file): In ObjC++, call instantiate_pending_templates() and cp_finish_file(). (define_decl, get_static_reference, get_protocol_reference, create_builtin_decl): Remove functions. (objc_start_class_interface, objc_start_category_interface, objc_start_protocol, objc_continue_interface, objc_finish_interface, objc_start_class_implementation, objc_start_category_implementation, objc_continue_implementation, objc_finish_implementation, objc_set_visibility, objc_set_method_type, objc_build_method_signature, objc_add_method_declaration, objc_start_method_definition, objc_add_instance_variable, objc_get_protocol_qualified_type, create_field_decl, start_var_decl, finish_var_decl): New functions. (setup_string_decl): Simplify since it is only called once. (synth_module_prologue): Call build_class_template(); predefine 'id' and 'Class' as typedefs; rename 'temp_type' to 'type'; disable debug hooks for duration of function; fix GNU runtime messenger signatures to correspond to reality; forward-declare '__objc_exec_class' for the GNU runtime; call build_selector_table_decl(); in ObjC++ mode, generate 'extern "C" { ... }' wrappers around synthesized declarations; call build_protocol_template() and build_category_template(). (string_hash, string_eq): New functions. (objc_build_string_object): Check metaclass correctness only once; store string literals in hash table. (objc_build_constructor): Do not convert initializer elements; adjust for ObjC++ impedance mismatch. (build_objc_symtab_template): Call create_field_decl() instead of create_builtin_decl(). (init_objc_symtab): Add missing conversion to initializer element. (build_metadata_decl): Call start_var_decl() instead of define_decl(). (generate_objc_symtab_decl): Do not call build_category_template(); call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(). (build_module_descriptor): Call create_field_decl() instead of grokfield(); call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(); always mark module descriptor as used; move GNU runtime-specific functionality to build_module_initializer_routine(). (build_module_initializer_routine): New function, broken off of build_module_descriptor(). (objc_static_init_needed_p, objc_generate_static_init_call): New functions. (generate_static_references, generate_strings, build_selector_translation_table, generate_descriptor_table, generate_ivars_list, generate_dispatch_table, generate_category): Call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(); build a type directly instead of via groktypename(). (build_selector_reference_decl, build_selector_table_decl, build_class_reference_decl, build_protocol_reference, generate_objc_image_info): Call start_var_decl() instead of build_decl(). (build_selector_reference): For GNU runtime, do not call build_selector_reference_decl(). (build_selector, build_typed_selector_reference): Always convert result to the selector type. (add_objc_string): Cast return value to 'char *'. (build_method_prototype_template, build_selector_template, build_method_template): Use actual selector type for fields pointing to selectors. (finish_objc): For GNU runtime, call build_module_initializer_routine() after build_module_descriptor(). (generate_protocol_list, generate_shared_structures): Call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(); build a type directly instead of via groktypename(). (synth_id_with_class_suffix): Return a string. (get_arg_type_list): For instance methods, use the instance type for 'self'; do not call groktypename_in_parm_context(). (build_objc_string_decl): Squash redeclaration errors in ObjC++. (objc_is_class_name): Use OBJC_TYPE_NAME instead of TYPE_NAME; handle RECORD_TYPEs in ObjC as well as ObjC++. (objc_is_id): New function. (objc_is_object_ptr): Return the canonical type node. (objc_get_class_ivars): Simplify using get_class_ivars(). (get_class_ivars): Remove second parameter; create a fresh copy of the ivar list for each call; do not check for existence of super class. (objc_eh_runtime_type): Mark #ifndef OBJCPLUS. (objc_init_exceptions): When using SJLJ-style exceptions, require the use of '-fobjc-exceptions' flag; do not require it for DWARF-style exceptions. (objc_build_exc_ptr, next_sjlj_build_try_catch_finally): Use objc_object_type instead of objc_id_type. (objc_begin_catch_clause): Convert the incoming PARM_DECL into a VAR_DECL before placing it in the appropriate scope; do not call define_decl(); adjust call to c_begin_compound_stmt(); use objc_object_type instead of objc_id_type. (build_next_objc_exception_stuff): Call create_field_decl() instead of create_builtin_decl(); construct type directly instead of calling groktypename(); use OBJC_VOID_AT_END to mark end of function parameters. (build_private_template): Adjust call to get_class_ivars(); build a type directly instead of via groktypename(). (build_protocol_template, build_method_prototype_list_template, build_method_prototype_template, build_category_template, build_selector_template, build_class_template, build_super_template, build_ivar_template, build_ivar_list_template, build_method_list_template, build_method_template): Call create_field_decl() instead of grokfield(). (objc_method_parm_type): Do not call groktypename(). (generate_descriptor_table): Call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(). (generate_method_descriptors, build_protocol_initializer, generate_dispatch_tables, build_category_initializer, build_shared_structure_initializer): Do not call groktypename(). (generate_protocols): Call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(); do not call groktypename(). (error_with_ivar): Remove last parameter. (check_ivars): Do not iterate ovar CLASS_RAW_IVARS lists in addition to CLASS_IVARS lists; adjust calls to error_with_ivar(). (generate_ivar_lists): Convert one of the initializer elements; do not call groktypename(). (get_arg_type_list, start_method_def, gen_method_def): Account for new representation of variable arguments and '...' in Objective-C methods; add Objective-C++ impedance matching code. (is_objc_type_qualifier): Remove function. (adjust_type_for_id_default): Simplify; there is no longer a need to wade through declspecs. (lookup_interface, start_class, continue_class, finish_class, start_method_def, start_protocol, build_method_decl, objc_add_method, add_instance_variable, build_ivar_reference, is_ivar, is_private, get_super_receiver, objc_build_finally_epilogue): Make into static functions. (receiver_is_class_object): Use new IS_CLASS() macro. (objc_build_message_expr): Tweak ObjC++ message argument handling; call objc_finish_message_expr() instead of finish_message_expr(). (finish_message_expr): Rename to objc_finish_message_expr(); use OBJC_TYPE_NAME and OBJC_SET_TYPE_NAME macros instead of TYPE_NAME. call gen_type_name() instead of gen_declaration(); call objc_is_id() instead of using IS_ID and IS_CLASS; Use objc_class_name instead of calling get_identifier("Class"); handle CONVERT_EXPRs in receiver. (build_objc_method_call, warn_with_method): Do not call groktypename(). (build_ivar_reference): Call convert() instead of clobbering in a type. (hash_init): Initialize string_htab hash table. (add_instance_variable): Simplify parameter list; do not call grokfield(); do not populate CLASS_IVARS list. (start_class): Check for the existence of super class, if one was specified. (continue_class): Use CLASS_RAW_IVARS rather than CLASS_IVARS; do not call build_class_template(); adjust call to get_class_ivars(); call build_decl(), pushdecl() and finish_decl() instead of define_decl(). (finish_class): Call build_decl(), pushdecl() and finish_decl() instead of define_decl(). (add_protocols): Use PROTOCOL_BINFO_ELTS for the tree vector size. (start_protocol): Do not call build_protocol_template(); use PROTOCOL_BINFO_ELTS for the tree vector size. (encode_type_qualifiers): Do not handle the 'const' qualifier here. (encode_pointer): Encode 'const char *' as 'r*', for backwards compatibility. (encode_array): Use HOST_WIDE_INT_PRINT_DEC instead of "%ld". (encode_type): Handle the 'const' qualifier here. (objc_parmlist): New global variable, sued by objc_push_parm and objc_get_parm_info(). (objc_push_parm, objc_get_parm_info): New functions. (objc_expr_last): Remove function. (synth_self_and_ucmd_args): For instance methods, use the instance type for 'self'; call objc_push_parm() instead of push_parm_decl(). (start_method_def): Do not call push_scope(), declare_parm_level(), pop_scope(), push_parm_decl(), store_parm_decls() or objc_expr_last(); just use objc_push_parm() and objc_get_parm_info(). (comp_method_with_proto): Remove function. (objc_types_are_equivalent): Strip away indirections before comparing underlying types. (comp_proto_with_proto): Do not call groktypename(); types are no longer in raw declspec format. (objc_start_function): New function. (really_start_method): Call comp_proto_with_proto() instead of comp_method_with_proto(); call objc_start_function() instead of hand-crafting a function declarator. (continue_method_def, objc_expand_function_end): Remove functions. (get_super_receiver): Call objc_get_current_scope() instead of get_current_scope(); reference 'super_class' field (instead of 'class'). (finish_method_def): Rename to objc_finish_method_definition() and add a function decl parameter; move method encoding call from objc_expand_function_end(). (is_complex_decl, adorn_decl, gen_declarator, gen_declspecs, gen_declaration_1): Remove functions. (tmpbuf, RAW_DECLSPEC): Remove. (gen_declaration): Remove second parameter; simplify to deal with TYPE_P nodes instead of raw declspecs. (gen_type_name, gen_type_name_0): New functions. (gen_method_decl): Remove second parameter; call gen_type_name() instead of gen_declaration_1(). (dump_interface): Adjust calls to gen_declaration() and gen_method_decl(); do not allocate a separate string buffer. (init_objc): Allocate a larger string buffer to accommodate dump_interface(); adjust call to build_module_descriptor(); add call to build_module_initializer_routine() for the GNU runtime. (generate_classref_translation_entry): Do not call start_decl(); call finish_var_decl() instead of finish_decl(); call convert() instead of build_c_cast(). * objc-act.h (CLASS_OWN_IVARS): Remove accessor. (CLASS_BINFO_ELTS): Reduce from 6 to 5, now that CLASS_OWN_IVARS is gone. (OCTI_GNU_INIT_DECL, GNU_INIT_decl): New. (OCTI_ELLIPSIS_NODE, objc_ellipsis_node): Remove. (OCTI_ID_ID, id_type, objc_id_id): Rename to OCTI_ID_NAME, objc_object_type and objc_object_name, respectively. (OCTI_CLS_REF, OCTI_CLASS_NAME, objc_class_reference, objc_class_name): New. (IS_CLASS): New macro. (IS_ID, IS_SUPER): Robustify. (OCTI_EXECCLASS_DECL, execclass_decl): New. (finish_file, start_class, continue_class, finish_class, start_method_def, continue_method_def, finish_method_def, start_protocol, finish_protocol, objc_build_throw_stmt, objc_build_try_catch_finally_stmt, objc_build_synchronized_prologue, objc_build_synchronized_epilogue, objc_build_try_prologue, objc_build_try_epilogue, objc_build_catch_stmt, objc_build_catch_epilogue, objc_build_finally_prologue, objc_build_finally_epilogue, is_ivar, is_private, is_public, add_instance_variable, objc_add_method, get_super_receiver, objc_clear_super_receiver, get_class_ivars_from_name, get_class_reference, get_static_reference, get_object_reference, build_message_expr, finish_message_expr, build_selector_expr, build_ivar_reference, build_keyword_decl, build_method_decl, build_protocol_expr, build_objc_string_object, objc_declare_alias, objc_declare_class, objc_declare_protocols, objc_comptypes, objc_check_decl, build_encode_expr): Remove prototypes. (imp_count, cat_count): Make GGC-aware. (OBJC_SET_TYPE_NAME): New macro. From-SVN: r87168
2004-09-08 02:49:44 +02:00
/* struct _objc_ivar_list *ivars; */
Yet more Objective-C++... * objc-act.c (objc_finish_try_stmt): Add return value. (objc_build_synchronized): Likewise. * objc-act.c (objc_is_gcable_type): Add. (objc_substitute_decl): Add. (objc_build_ivar_assignment): Add. (objc_build_global_assignment): Add. (objc_build_strong_cast_assignment): Add. (objc_is_ivar_reference_p): Add. (objc_is_global_reference_p): Add. (objc_generate_write_barrier): Add. (objc_rewrite_function_call): Add. (objc_gimplify_expr): Add Objective-C++ support. * objc-act.h (ALLOC_OBJC_TYPE_LANG_SPECIFIC): Likewise. (SIZEOF_OBJC_TYPE_LANG_SPECIFIC): Add. (INIT_TYPE_OBJC_INFO): Add Objective-C++ support. (DUP_TYPE_OBJC_INFO): Likewise. (struct imp_entry): Add field has_cxx_cdtors. (struct imp_entry *imp_list): Add OCTI_UMSG_FAST_DECL, OCTI_METH_LIST_TEMPL, OCTI_METH_PROTO_LIST_TEMPL, OCTI_IVAR_LIST_TEMPL, OCTI_ASSIGN_IVAR_DECL, OCTI_ASSIGN_IVAR_FAST_DECL, OCTI_ASSIGN_GLOBAL_DECL, OCTI_ASSIGN_STRONGCAST_DECL. (umsg_fast_decl): Add. (objc_assign_ivar_decl): Add. (objc_assign_ivar_fast_decl): Add. (objc_assign_global_decl): Add. (objc_assign_strong_cast_decl): Add. (objc_method_list_ptr): Add. (objc_method_proto_list_ptr): Add. (objc_ivar_list_ptr): Add. * objc-act.c (should_call_super_dealloc): Add. (OBJC_VERSION): Bump to 6. (objc_is_gcable_type): Add. (objc_substitute_decl): Add. (objc_build_ivar_assignment): Add. (objc_build_global_assignment): Add. (objc_build_strong_cast_assignment): Add. (objc_is_gcable_p): Add. (objc_is_ivar_reference_p): Add. (objc_is_global_reference_p): Add. (generate_shared_structures): Add flags parameter. (objc_generate_cxx_ctor_or_dtor): Add. (objc_generate_cxx_cdtors): Add. (add_class): Add name parameter. (objc_types_share_size_and_alignment): Add. (comp_proto_with_proto): Add strict parameter. (CLS_HAS_CXX_STRUCTORS): Add. (TAG_ASSIGNIVAR): Add. (TAG_ASSIGNGLOBAL): Add. (TAG_ASSIGNSTRONGCAST): Add. (TAG_MSGSEND_FAST): Add. (TAG_ASSIGNIVAR_FAST): Add. (TAG_CXX_CONSTRUCT): Add. (TAG_CXX_DESTRUCT): Add. (OBJC_LOOKUP_CLASS): Add. (OBJC_LOOKUP_NO_SUPER): Add. (objc_finish_file): Add pch support. (objc_finish_implementation): Add Objective-C++ support. (synth_module_prologue): Likewise. (synth_module_prologue): Add fast dispatching. (objc_get_class_reference): Add Objective-C++ support. (objc_generate_write_barrier): Likewise. (next_sjlj_build_enter_and_setjmp): Likewise. (objc_begin_try_stmt): Likewise. (build_next_objc_exception_stuff): Add fast ivar support. (build_private_template): Mark the record as used so debug information is generated. (build_protocol_template): Add Objective-C++ support. (objc_method_parm_type) Likewise. (objc_generate_cxx_ctor_or_dtor): Likewise. (objc_generate_cxx_cdtors): Likewise. (build_protocol_initializer): Likewise. (build_category_template): Likewise. (build_class_template): Likewise. (build_method_list_template): Likewise. (build_category_initializer): Likewise. (build_shared_structure_initializer): Likewise. (objc_finish_message_expr): Likewise. (build_objc_method_call): Add fast dispatch support. (lookup_method_static): Add support to end search at superclasses. (add_method_to_hash_list): Add strict parameter to comp_proto_with_proto. (objc_add_method): Likewise. (objc_add_method): Also set the interface_value. (add_instance_variable): Add Objective-C++ support. (objc_is_public): Likewise. (start_class): Likewise. (continue_class): Likewise. (encode_aggregate_within): Likewise. (start_method_def): Likewise. (objc_start_function): Clear current_function_returns_value and current_function_returns_null. (really_start_method): Add Objective-C++ support. (objc_finish_method_definition): Add warning for missing [super dealloc]. (finish_objc): Add Objective-C++ support. (generate_objc_image_info): Likewise. (objc_lookup_ivar): Likewise. * objc-act.h (TYPE_HAS_OBJC_INFO): Likewise. (INIT_TYPE_OBJC_INFO): Likewise. (DUP_TYPE_OBJC_INFO): Likewise. From-SVN: r99857
2005-05-17 22:07:08 +02:00
field_decl = create_field_decl (objc_ivar_list_ptr,
Makefile.in (c-parse.o): Depend on $(C_COMMON_H). [gcc/ChangeLog] 2004-09-07 Ziemowit Laski <zlaski@apple.com> * Makefile.in (c-parse.o): Depend on $(C_COMMON_H). * c-parse.in: Include c-common.h instead of objc-act.h. (ivar_decl_list, ivar_decls, ivar_decl, ivars, ivar_declarator, myparms, myparm): Remove %type declarations. (methodtype, optparms, OBJC_TYPE_QUAL, objc_quals, objc_qual, objc_typename, objc_try_catch_stmt, optellipsis): Add %type declarations. (objc_inherit_code, objc_public_flag): Remove. (typespec_nonreserved_nonattr): Call objc_get_protocol_qualified_type() instead of get_static_reference() and get_protocol_reference(). (stmt_nocomp): Call grokparm() on @catch parameter. (objcdef): Move semantic action to objc_finish_implementation(). (classdef): Move semantic action to objc_start_class_interface(), objc_continue_interface(), objc_finish_interface(), objc_start_class_implementation(), objc_continue_implementation(), objc_start_category_interface() and objc_start_category_implementation(). (protocoldef): Move semantic actions to objc_start_protocol() and objc_finish_interface(). (ivar_decl_list): Remove nonterminal. (visibility_spec): Move semantic actions to objc_set_visibility(). (ivar_decls): Remove assignment to $$. (ivar_decl): Rephrase in terms of component_decl; call objc_add_instance_variable(). (ivars, ivar_declarator): Remove nonterminals. (opt_semi): New nonterminal. (methodtype): Remove semantic actions. (methoddef): Move semantic actions to objc_set_method_type(), objc_start_method_definition() and objc_finish_method_definition(). (methodproto): Move semantic actions to objc_set_method_type() and objc_add_method_declaration(). (methoddecl): Use objc_typename instead of typename; move semantic actions to objc_build_method_signature(). (optarglist, myxdecls, mydecl, myparms, myparm): Remove nonterminals. (optparmlist): Express in terms of optparms and optellipsis. (optparms, optellipsis, objc_qual, objc_quals, objc_typename): New nonterminals. (keyworddecl): Use objc_typename instead of typename. (rid_to_yy): Mark RID_IN, RID_OUT, RID_INOUT, RID_BYCOPY, RID_BYREF and RID_ONEWAY as returning OBJC_TYPE_QUAL to yyparse(). [gcc/objc/ChangeLog] 2004-09-07 Ziemowit Laski <zlaski@apple.com> * Make-lang.in (objc/objc-parse.o): Depend on $(C_COMMON_H) instead of objc/objc-act.h. (objc/objc-act.o): Depend on $(HASHTAB_H). * objc-act.c: Include hashtab.h; in ObjC++ mode, include cp-tree.h and objcp-decl.h instead of c-tree.h. (build_module_descriptor, get_class_ivars, synth_id_with_class_suffix, error_with_ivar, gen_method_decl, gen_declaration, setup_string_decl, build_protocol_template): Adjust prototypes. (build_module_initializer_routine, start_class, continue_class, finish_class, start_method_def, objc_start_function, start_protocol, build_method_decl, objc_add_method, add_instance_variable, build_ivar_reference, is_ivar, is_private, get_super_receiver, build_selector_table_decl, objc_push_parm, objc_get_parm_info, gen_type_name, gen_type_name_0, start_var_decl, finish_var_decl, create_field_decl): New prototypes. (objc_expand_function_end, comp_method_with_proto, objc_expr_last, gen_declaration_1, gen_declarator, is_complex_decl, adorn_decl, define_decl, create_builtin_decl, gen_declspecs): Remove prototypes. (TYPE_ID): Rename to OBJECT_TYPEDEF_NAME. (CLASS_TYPEDEF_NAME): New. (TAG_EXECCLASS): Change from a global variable to a #define. (TAG_RETURN_STRUCT): Delete. (TAG_GNUINIT): New, holds '__objc_gnu_init' name. (objc_inherit_code, objc_public_flag): New, moved from c-parse.in. (string_descriptor): New struct. (string_htab): New hash table. (string_hash, string_eq): New prototypes. (generate_struct_by_value_array): Call create_field_decl() instead of create_builtin_decl(). (objc_init): Do not initialize objc_ellipsis_node or TAG_EXECCLASS; In ObjC++ mode, call cxx_init() instead of c_objc_common_init(). (objc_finish_file): In ObjC++, call instantiate_pending_templates() and cp_finish_file(). (define_decl, get_static_reference, get_protocol_reference, create_builtin_decl): Remove functions. (objc_start_class_interface, objc_start_category_interface, objc_start_protocol, objc_continue_interface, objc_finish_interface, objc_start_class_implementation, objc_start_category_implementation, objc_continue_implementation, objc_finish_implementation, objc_set_visibility, objc_set_method_type, objc_build_method_signature, objc_add_method_declaration, objc_start_method_definition, objc_add_instance_variable, objc_get_protocol_qualified_type, create_field_decl, start_var_decl, finish_var_decl): New functions. (setup_string_decl): Simplify since it is only called once. (synth_module_prologue): Call build_class_template(); predefine 'id' and 'Class' as typedefs; rename 'temp_type' to 'type'; disable debug hooks for duration of function; fix GNU runtime messenger signatures to correspond to reality; forward-declare '__objc_exec_class' for the GNU runtime; call build_selector_table_decl(); in ObjC++ mode, generate 'extern "C" { ... }' wrappers around synthesized declarations; call build_protocol_template() and build_category_template(). (string_hash, string_eq): New functions. (objc_build_string_object): Check metaclass correctness only once; store string literals in hash table. (objc_build_constructor): Do not convert initializer elements; adjust for ObjC++ impedance mismatch. (build_objc_symtab_template): Call create_field_decl() instead of create_builtin_decl(). (init_objc_symtab): Add missing conversion to initializer element. (build_metadata_decl): Call start_var_decl() instead of define_decl(). (generate_objc_symtab_decl): Do not call build_category_template(); call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(). (build_module_descriptor): Call create_field_decl() instead of grokfield(); call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(); always mark module descriptor as used; move GNU runtime-specific functionality to build_module_initializer_routine(). (build_module_initializer_routine): New function, broken off of build_module_descriptor(). (objc_static_init_needed_p, objc_generate_static_init_call): New functions. (generate_static_references, generate_strings, build_selector_translation_table, generate_descriptor_table, generate_ivars_list, generate_dispatch_table, generate_category): Call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(); build a type directly instead of via groktypename(). (build_selector_reference_decl, build_selector_table_decl, build_class_reference_decl, build_protocol_reference, generate_objc_image_info): Call start_var_decl() instead of build_decl(). (build_selector_reference): For GNU runtime, do not call build_selector_reference_decl(). (build_selector, build_typed_selector_reference): Always convert result to the selector type. (add_objc_string): Cast return value to 'char *'. (build_method_prototype_template, build_selector_template, build_method_template): Use actual selector type for fields pointing to selectors. (finish_objc): For GNU runtime, call build_module_initializer_routine() after build_module_descriptor(). (generate_protocol_list, generate_shared_structures): Call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(); build a type directly instead of via groktypename(). (synth_id_with_class_suffix): Return a string. (get_arg_type_list): For instance methods, use the instance type for 'self'; do not call groktypename_in_parm_context(). (build_objc_string_decl): Squash redeclaration errors in ObjC++. (objc_is_class_name): Use OBJC_TYPE_NAME instead of TYPE_NAME; handle RECORD_TYPEs in ObjC as well as ObjC++. (objc_is_id): New function. (objc_is_object_ptr): Return the canonical type node. (objc_get_class_ivars): Simplify using get_class_ivars(). (get_class_ivars): Remove second parameter; create a fresh copy of the ivar list for each call; do not check for existence of super class. (objc_eh_runtime_type): Mark #ifndef OBJCPLUS. (objc_init_exceptions): When using SJLJ-style exceptions, require the use of '-fobjc-exceptions' flag; do not require it for DWARF-style exceptions. (objc_build_exc_ptr, next_sjlj_build_try_catch_finally): Use objc_object_type instead of objc_id_type. (objc_begin_catch_clause): Convert the incoming PARM_DECL into a VAR_DECL before placing it in the appropriate scope; do not call define_decl(); adjust call to c_begin_compound_stmt(); use objc_object_type instead of objc_id_type. (build_next_objc_exception_stuff): Call create_field_decl() instead of create_builtin_decl(); construct type directly instead of calling groktypename(); use OBJC_VOID_AT_END to mark end of function parameters. (build_private_template): Adjust call to get_class_ivars(); build a type directly instead of via groktypename(). (build_protocol_template, build_method_prototype_list_template, build_method_prototype_template, build_category_template, build_selector_template, build_class_template, build_super_template, build_ivar_template, build_ivar_list_template, build_method_list_template, build_method_template): Call create_field_decl() instead of grokfield(). (objc_method_parm_type): Do not call groktypename(). (generate_descriptor_table): Call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(). (generate_method_descriptors, build_protocol_initializer, generate_dispatch_tables, build_category_initializer, build_shared_structure_initializer): Do not call groktypename(). (generate_protocols): Call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(); do not call groktypename(). (error_with_ivar): Remove last parameter. (check_ivars): Do not iterate ovar CLASS_RAW_IVARS lists in addition to CLASS_IVARS lists; adjust calls to error_with_ivar(). (generate_ivar_lists): Convert one of the initializer elements; do not call groktypename(). (get_arg_type_list, start_method_def, gen_method_def): Account for new representation of variable arguments and '...' in Objective-C methods; add Objective-C++ impedance matching code. (is_objc_type_qualifier): Remove function. (adjust_type_for_id_default): Simplify; there is no longer a need to wade through declspecs. (lookup_interface, start_class, continue_class, finish_class, start_method_def, start_protocol, build_method_decl, objc_add_method, add_instance_variable, build_ivar_reference, is_ivar, is_private, get_super_receiver, objc_build_finally_epilogue): Make into static functions. (receiver_is_class_object): Use new IS_CLASS() macro. (objc_build_message_expr): Tweak ObjC++ message argument handling; call objc_finish_message_expr() instead of finish_message_expr(). (finish_message_expr): Rename to objc_finish_message_expr(); use OBJC_TYPE_NAME and OBJC_SET_TYPE_NAME macros instead of TYPE_NAME. call gen_type_name() instead of gen_declaration(); call objc_is_id() instead of using IS_ID and IS_CLASS; Use objc_class_name instead of calling get_identifier("Class"); handle CONVERT_EXPRs in receiver. (build_objc_method_call, warn_with_method): Do not call groktypename(). (build_ivar_reference): Call convert() instead of clobbering in a type. (hash_init): Initialize string_htab hash table. (add_instance_variable): Simplify parameter list; do not call grokfield(); do not populate CLASS_IVARS list. (start_class): Check for the existence of super class, if one was specified. (continue_class): Use CLASS_RAW_IVARS rather than CLASS_IVARS; do not call build_class_template(); adjust call to get_class_ivars(); call build_decl(), pushdecl() and finish_decl() instead of define_decl(). (finish_class): Call build_decl(), pushdecl() and finish_decl() instead of define_decl(). (add_protocols): Use PROTOCOL_BINFO_ELTS for the tree vector size. (start_protocol): Do not call build_protocol_template(); use PROTOCOL_BINFO_ELTS for the tree vector size. (encode_type_qualifiers): Do not handle the 'const' qualifier here. (encode_pointer): Encode 'const char *' as 'r*', for backwards compatibility. (encode_array): Use HOST_WIDE_INT_PRINT_DEC instead of "%ld". (encode_type): Handle the 'const' qualifier here. (objc_parmlist): New global variable, sued by objc_push_parm and objc_get_parm_info(). (objc_push_parm, objc_get_parm_info): New functions. (objc_expr_last): Remove function. (synth_self_and_ucmd_args): For instance methods, use the instance type for 'self'; call objc_push_parm() instead of push_parm_decl(). (start_method_def): Do not call push_scope(), declare_parm_level(), pop_scope(), push_parm_decl(), store_parm_decls() or objc_expr_last(); just use objc_push_parm() and objc_get_parm_info(). (comp_method_with_proto): Remove function. (objc_types_are_equivalent): Strip away indirections before comparing underlying types. (comp_proto_with_proto): Do not call groktypename(); types are no longer in raw declspec format. (objc_start_function): New function. (really_start_method): Call comp_proto_with_proto() instead of comp_method_with_proto(); call objc_start_function() instead of hand-crafting a function declarator. (continue_method_def, objc_expand_function_end): Remove functions. (get_super_receiver): Call objc_get_current_scope() instead of get_current_scope(); reference 'super_class' field (instead of 'class'). (finish_method_def): Rename to objc_finish_method_definition() and add a function decl parameter; move method encoding call from objc_expand_function_end(). (is_complex_decl, adorn_decl, gen_declarator, gen_declspecs, gen_declaration_1): Remove functions. (tmpbuf, RAW_DECLSPEC): Remove. (gen_declaration): Remove second parameter; simplify to deal with TYPE_P nodes instead of raw declspecs. (gen_type_name, gen_type_name_0): New functions. (gen_method_decl): Remove second parameter; call gen_type_name() instead of gen_declaration_1(). (dump_interface): Adjust calls to gen_declaration() and gen_method_decl(); do not allocate a separate string buffer. (init_objc): Allocate a larger string buffer to accommodate dump_interface(); adjust call to build_module_descriptor(); add call to build_module_initializer_routine() for the GNU runtime. (generate_classref_translation_entry): Do not call start_decl(); call finish_var_decl() instead of finish_decl(); call convert() instead of build_c_cast(). * objc-act.h (CLASS_OWN_IVARS): Remove accessor. (CLASS_BINFO_ELTS): Reduce from 6 to 5, now that CLASS_OWN_IVARS is gone. (OCTI_GNU_INIT_DECL, GNU_INIT_decl): New. (OCTI_ELLIPSIS_NODE, objc_ellipsis_node): Remove. (OCTI_ID_ID, id_type, objc_id_id): Rename to OCTI_ID_NAME, objc_object_type and objc_object_name, respectively. (OCTI_CLS_REF, OCTI_CLASS_NAME, objc_class_reference, objc_class_name): New. (IS_CLASS): New macro. (IS_ID, IS_SUPER): Robustify. (OCTI_EXECCLASS_DECL, execclass_decl): New. (finish_file, start_class, continue_class, finish_class, start_method_def, continue_method_def, finish_method_def, start_protocol, finish_protocol, objc_build_throw_stmt, objc_build_try_catch_finally_stmt, objc_build_synchronized_prologue, objc_build_synchronized_epilogue, objc_build_try_prologue, objc_build_try_epilogue, objc_build_catch_stmt, objc_build_catch_epilogue, objc_build_finally_prologue, objc_build_finally_epilogue, is_ivar, is_private, is_public, add_instance_variable, objc_add_method, get_super_receiver, objc_clear_super_receiver, get_class_ivars_from_name, get_class_reference, get_static_reference, get_object_reference, build_message_expr, finish_message_expr, build_selector_expr, build_ivar_reference, build_keyword_decl, build_method_decl, build_protocol_expr, build_objc_string_object, objc_declare_alias, objc_declare_class, objc_declare_protocols, objc_comptypes, objc_check_decl, build_encode_expr): Remove prototypes. (imp_count, cat_count): Make GGC-aware. (OBJC_SET_TYPE_NAME): New macro. From-SVN: r87168
2004-09-08 02:49:44 +02:00
"ivars");
1992-01-18 00:15:38 +01:00
chainon (field_decl_chain, field_decl);
Makefile.in (c-parse.o): Depend on $(C_COMMON_H). [gcc/ChangeLog] 2004-09-07 Ziemowit Laski <zlaski@apple.com> * Makefile.in (c-parse.o): Depend on $(C_COMMON_H). * c-parse.in: Include c-common.h instead of objc-act.h. (ivar_decl_list, ivar_decls, ivar_decl, ivars, ivar_declarator, myparms, myparm): Remove %type declarations. (methodtype, optparms, OBJC_TYPE_QUAL, objc_quals, objc_qual, objc_typename, objc_try_catch_stmt, optellipsis): Add %type declarations. (objc_inherit_code, objc_public_flag): Remove. (typespec_nonreserved_nonattr): Call objc_get_protocol_qualified_type() instead of get_static_reference() and get_protocol_reference(). (stmt_nocomp): Call grokparm() on @catch parameter. (objcdef): Move semantic action to objc_finish_implementation(). (classdef): Move semantic action to objc_start_class_interface(), objc_continue_interface(), objc_finish_interface(), objc_start_class_implementation(), objc_continue_implementation(), objc_start_category_interface() and objc_start_category_implementation(). (protocoldef): Move semantic actions to objc_start_protocol() and objc_finish_interface(). (ivar_decl_list): Remove nonterminal. (visibility_spec): Move semantic actions to objc_set_visibility(). (ivar_decls): Remove assignment to $$. (ivar_decl): Rephrase in terms of component_decl; call objc_add_instance_variable(). (ivars, ivar_declarator): Remove nonterminals. (opt_semi): New nonterminal. (methodtype): Remove semantic actions. (methoddef): Move semantic actions to objc_set_method_type(), objc_start_method_definition() and objc_finish_method_definition(). (methodproto): Move semantic actions to objc_set_method_type() and objc_add_method_declaration(). (methoddecl): Use objc_typename instead of typename; move semantic actions to objc_build_method_signature(). (optarglist, myxdecls, mydecl, myparms, myparm): Remove nonterminals. (optparmlist): Express in terms of optparms and optellipsis. (optparms, optellipsis, objc_qual, objc_quals, objc_typename): New nonterminals. (keyworddecl): Use objc_typename instead of typename. (rid_to_yy): Mark RID_IN, RID_OUT, RID_INOUT, RID_BYCOPY, RID_BYREF and RID_ONEWAY as returning OBJC_TYPE_QUAL to yyparse(). [gcc/objc/ChangeLog] 2004-09-07 Ziemowit Laski <zlaski@apple.com> * Make-lang.in (objc/objc-parse.o): Depend on $(C_COMMON_H) instead of objc/objc-act.h. (objc/objc-act.o): Depend on $(HASHTAB_H). * objc-act.c: Include hashtab.h; in ObjC++ mode, include cp-tree.h and objcp-decl.h instead of c-tree.h. (build_module_descriptor, get_class_ivars, synth_id_with_class_suffix, error_with_ivar, gen_method_decl, gen_declaration, setup_string_decl, build_protocol_template): Adjust prototypes. (build_module_initializer_routine, start_class, continue_class, finish_class, start_method_def, objc_start_function, start_protocol, build_method_decl, objc_add_method, add_instance_variable, build_ivar_reference, is_ivar, is_private, get_super_receiver, build_selector_table_decl, objc_push_parm, objc_get_parm_info, gen_type_name, gen_type_name_0, start_var_decl, finish_var_decl, create_field_decl): New prototypes. (objc_expand_function_end, comp_method_with_proto, objc_expr_last, gen_declaration_1, gen_declarator, is_complex_decl, adorn_decl, define_decl, create_builtin_decl, gen_declspecs): Remove prototypes. (TYPE_ID): Rename to OBJECT_TYPEDEF_NAME. (CLASS_TYPEDEF_NAME): New. (TAG_EXECCLASS): Change from a global variable to a #define. (TAG_RETURN_STRUCT): Delete. (TAG_GNUINIT): New, holds '__objc_gnu_init' name. (objc_inherit_code, objc_public_flag): New, moved from c-parse.in. (string_descriptor): New struct. (string_htab): New hash table. (string_hash, string_eq): New prototypes. (generate_struct_by_value_array): Call create_field_decl() instead of create_builtin_decl(). (objc_init): Do not initialize objc_ellipsis_node or TAG_EXECCLASS; In ObjC++ mode, call cxx_init() instead of c_objc_common_init(). (objc_finish_file): In ObjC++, call instantiate_pending_templates() and cp_finish_file(). (define_decl, get_static_reference, get_protocol_reference, create_builtin_decl): Remove functions. (objc_start_class_interface, objc_start_category_interface, objc_start_protocol, objc_continue_interface, objc_finish_interface, objc_start_class_implementation, objc_start_category_implementation, objc_continue_implementation, objc_finish_implementation, objc_set_visibility, objc_set_method_type, objc_build_method_signature, objc_add_method_declaration, objc_start_method_definition, objc_add_instance_variable, objc_get_protocol_qualified_type, create_field_decl, start_var_decl, finish_var_decl): New functions. (setup_string_decl): Simplify since it is only called once. (synth_module_prologue): Call build_class_template(); predefine 'id' and 'Class' as typedefs; rename 'temp_type' to 'type'; disable debug hooks for duration of function; fix GNU runtime messenger signatures to correspond to reality; forward-declare '__objc_exec_class' for the GNU runtime; call build_selector_table_decl(); in ObjC++ mode, generate 'extern "C" { ... }' wrappers around synthesized declarations; call build_protocol_template() and build_category_template(). (string_hash, string_eq): New functions. (objc_build_string_object): Check metaclass correctness only once; store string literals in hash table. (objc_build_constructor): Do not convert initializer elements; adjust for ObjC++ impedance mismatch. (build_objc_symtab_template): Call create_field_decl() instead of create_builtin_decl(). (init_objc_symtab): Add missing conversion to initializer element. (build_metadata_decl): Call start_var_decl() instead of define_decl(). (generate_objc_symtab_decl): Do not call build_category_template(); call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(). (build_module_descriptor): Call create_field_decl() instead of grokfield(); call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(); always mark module descriptor as used; move GNU runtime-specific functionality to build_module_initializer_routine(). (build_module_initializer_routine): New function, broken off of build_module_descriptor(). (objc_static_init_needed_p, objc_generate_static_init_call): New functions. (generate_static_references, generate_strings, build_selector_translation_table, generate_descriptor_table, generate_ivars_list, generate_dispatch_table, generate_category): Call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(); build a type directly instead of via groktypename(). (build_selector_reference_decl, build_selector_table_decl, build_class_reference_decl, build_protocol_reference, generate_objc_image_info): Call start_var_decl() instead of build_decl(). (build_selector_reference): For GNU runtime, do not call build_selector_reference_decl(). (build_selector, build_typed_selector_reference): Always convert result to the selector type. (add_objc_string): Cast return value to 'char *'. (build_method_prototype_template, build_selector_template, build_method_template): Use actual selector type for fields pointing to selectors. (finish_objc): For GNU runtime, call build_module_initializer_routine() after build_module_descriptor(). (generate_protocol_list, generate_shared_structures): Call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(); build a type directly instead of via groktypename(). (synth_id_with_class_suffix): Return a string. (get_arg_type_list): For instance methods, use the instance type for 'self'; do not call groktypename_in_parm_context(). (build_objc_string_decl): Squash redeclaration errors in ObjC++. (objc_is_class_name): Use OBJC_TYPE_NAME instead of TYPE_NAME; handle RECORD_TYPEs in ObjC as well as ObjC++. (objc_is_id): New function. (objc_is_object_ptr): Return the canonical type node. (objc_get_class_ivars): Simplify using get_class_ivars(). (get_class_ivars): Remove second parameter; create a fresh copy of the ivar list for each call; do not check for existence of super class. (objc_eh_runtime_type): Mark #ifndef OBJCPLUS. (objc_init_exceptions): When using SJLJ-style exceptions, require the use of '-fobjc-exceptions' flag; do not require it for DWARF-style exceptions. (objc_build_exc_ptr, next_sjlj_build_try_catch_finally): Use objc_object_type instead of objc_id_type. (objc_begin_catch_clause): Convert the incoming PARM_DECL into a VAR_DECL before placing it in the appropriate scope; do not call define_decl(); adjust call to c_begin_compound_stmt(); use objc_object_type instead of objc_id_type. (build_next_objc_exception_stuff): Call create_field_decl() instead of create_builtin_decl(); construct type directly instead of calling groktypename(); use OBJC_VOID_AT_END to mark end of function parameters. (build_private_template): Adjust call to get_class_ivars(); build a type directly instead of via groktypename(). (build_protocol_template, build_method_prototype_list_template, build_method_prototype_template, build_category_template, build_selector_template, build_class_template, build_super_template, build_ivar_template, build_ivar_list_template, build_method_list_template, build_method_template): Call create_field_decl() instead of grokfield(). (objc_method_parm_type): Do not call groktypename(). (generate_descriptor_table): Call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(). (generate_method_descriptors, build_protocol_initializer, generate_dispatch_tables, build_category_initializer, build_shared_structure_initializer): Do not call groktypename(). (generate_protocols): Call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(); do not call groktypename(). (error_with_ivar): Remove last parameter. (check_ivars): Do not iterate ovar CLASS_RAW_IVARS lists in addition to CLASS_IVARS lists; adjust calls to error_with_ivar(). (generate_ivar_lists): Convert one of the initializer elements; do not call groktypename(). (get_arg_type_list, start_method_def, gen_method_def): Account for new representation of variable arguments and '...' in Objective-C methods; add Objective-C++ impedance matching code. (is_objc_type_qualifier): Remove function. (adjust_type_for_id_default): Simplify; there is no longer a need to wade through declspecs. (lookup_interface, start_class, continue_class, finish_class, start_method_def, start_protocol, build_method_decl, objc_add_method, add_instance_variable, build_ivar_reference, is_ivar, is_private, get_super_receiver, objc_build_finally_epilogue): Make into static functions. (receiver_is_class_object): Use new IS_CLASS() macro. (objc_build_message_expr): Tweak ObjC++ message argument handling; call objc_finish_message_expr() instead of finish_message_expr(). (finish_message_expr): Rename to objc_finish_message_expr(); use OBJC_TYPE_NAME and OBJC_SET_TYPE_NAME macros instead of TYPE_NAME. call gen_type_name() instead of gen_declaration(); call objc_is_id() instead of using IS_ID and IS_CLASS; Use objc_class_name instead of calling get_identifier("Class"); handle CONVERT_EXPRs in receiver. (build_objc_method_call, warn_with_method): Do not call groktypename(). (build_ivar_reference): Call convert() instead of clobbering in a type. (hash_init): Initialize string_htab hash table. (add_instance_variable): Simplify parameter list; do not call grokfield(); do not populate CLASS_IVARS list. (start_class): Check for the existence of super class, if one was specified. (continue_class): Use CLASS_RAW_IVARS rather than CLASS_IVARS; do not call build_class_template(); adjust call to get_class_ivars(); call build_decl(), pushdecl() and finish_decl() instead of define_decl(). (finish_class): Call build_decl(), pushdecl() and finish_decl() instead of define_decl(). (add_protocols): Use PROTOCOL_BINFO_ELTS for the tree vector size. (start_protocol): Do not call build_protocol_template(); use PROTOCOL_BINFO_ELTS for the tree vector size. (encode_type_qualifiers): Do not handle the 'const' qualifier here. (encode_pointer): Encode 'const char *' as 'r*', for backwards compatibility. (encode_array): Use HOST_WIDE_INT_PRINT_DEC instead of "%ld". (encode_type): Handle the 'const' qualifier here. (objc_parmlist): New global variable, sued by objc_push_parm and objc_get_parm_info(). (objc_push_parm, objc_get_parm_info): New functions. (objc_expr_last): Remove function. (synth_self_and_ucmd_args): For instance methods, use the instance type for 'self'; call objc_push_parm() instead of push_parm_decl(). (start_method_def): Do not call push_scope(), declare_parm_level(), pop_scope(), push_parm_decl(), store_parm_decls() or objc_expr_last(); just use objc_push_parm() and objc_get_parm_info(). (comp_method_with_proto): Remove function. (objc_types_are_equivalent): Strip away indirections before comparing underlying types. (comp_proto_with_proto): Do not call groktypename(); types are no longer in raw declspec format. (objc_start_function): New function. (really_start_method): Call comp_proto_with_proto() instead of comp_method_with_proto(); call objc_start_function() instead of hand-crafting a function declarator. (continue_method_def, objc_expand_function_end): Remove functions. (get_super_receiver): Call objc_get_current_scope() instead of get_current_scope(); reference 'super_class' field (instead of 'class'). (finish_method_def): Rename to objc_finish_method_definition() and add a function decl parameter; move method encoding call from objc_expand_function_end(). (is_complex_decl, adorn_decl, gen_declarator, gen_declspecs, gen_declaration_1): Remove functions. (tmpbuf, RAW_DECLSPEC): Remove. (gen_declaration): Remove second parameter; simplify to deal with TYPE_P nodes instead of raw declspecs. (gen_type_name, gen_type_name_0): New functions. (gen_method_decl): Remove second parameter; call gen_type_name() instead of gen_declaration_1(). (dump_interface): Adjust calls to gen_declaration() and gen_method_decl(); do not allocate a separate string buffer. (init_objc): Allocate a larger string buffer to accommodate dump_interface(); adjust call to build_module_descriptor(); add call to build_module_initializer_routine() for the GNU runtime. (generate_classref_translation_entry): Do not call start_decl(); call finish_var_decl() instead of finish_decl(); call convert() instead of build_c_cast(). * objc-act.h (CLASS_OWN_IVARS): Remove accessor. (CLASS_BINFO_ELTS): Reduce from 6 to 5, now that CLASS_OWN_IVARS is gone. (OCTI_GNU_INIT_DECL, GNU_INIT_decl): New. (OCTI_ELLIPSIS_NODE, objc_ellipsis_node): Remove. (OCTI_ID_ID, id_type, objc_id_id): Rename to OCTI_ID_NAME, objc_object_type and objc_object_name, respectively. (OCTI_CLS_REF, OCTI_CLASS_NAME, objc_class_reference, objc_class_name): New. (IS_CLASS): New macro. (IS_ID, IS_SUPER): Robustify. (OCTI_EXECCLASS_DECL, execclass_decl): New. (finish_file, start_class, continue_class, finish_class, start_method_def, continue_method_def, finish_method_def, start_protocol, finish_protocol, objc_build_throw_stmt, objc_build_try_catch_finally_stmt, objc_build_synchronized_prologue, objc_build_synchronized_epilogue, objc_build_try_prologue, objc_build_try_epilogue, objc_build_catch_stmt, objc_build_catch_epilogue, objc_build_finally_prologue, objc_build_finally_epilogue, is_ivar, is_private, is_public, add_instance_variable, objc_add_method, get_super_receiver, objc_clear_super_receiver, get_class_ivars_from_name, get_class_reference, get_static_reference, get_object_reference, build_message_expr, finish_message_expr, build_selector_expr, build_ivar_reference, build_keyword_decl, build_method_decl, build_protocol_expr, build_objc_string_object, objc_declare_alias, objc_declare_class, objc_declare_protocols, objc_comptypes, objc_check_decl, build_encode_expr): Remove prototypes. (imp_count, cat_count): Make GGC-aware. (OBJC_SET_TYPE_NAME): New macro. From-SVN: r87168
2004-09-08 02:49:44 +02:00
/* struct _objc_method_list *methods; */
Yet more Objective-C++... * objc-act.c (objc_finish_try_stmt): Add return value. (objc_build_synchronized): Likewise. * objc-act.c (objc_is_gcable_type): Add. (objc_substitute_decl): Add. (objc_build_ivar_assignment): Add. (objc_build_global_assignment): Add. (objc_build_strong_cast_assignment): Add. (objc_is_ivar_reference_p): Add. (objc_is_global_reference_p): Add. (objc_generate_write_barrier): Add. (objc_rewrite_function_call): Add. (objc_gimplify_expr): Add Objective-C++ support. * objc-act.h (ALLOC_OBJC_TYPE_LANG_SPECIFIC): Likewise. (SIZEOF_OBJC_TYPE_LANG_SPECIFIC): Add. (INIT_TYPE_OBJC_INFO): Add Objective-C++ support. (DUP_TYPE_OBJC_INFO): Likewise. (struct imp_entry): Add field has_cxx_cdtors. (struct imp_entry *imp_list): Add OCTI_UMSG_FAST_DECL, OCTI_METH_LIST_TEMPL, OCTI_METH_PROTO_LIST_TEMPL, OCTI_IVAR_LIST_TEMPL, OCTI_ASSIGN_IVAR_DECL, OCTI_ASSIGN_IVAR_FAST_DECL, OCTI_ASSIGN_GLOBAL_DECL, OCTI_ASSIGN_STRONGCAST_DECL. (umsg_fast_decl): Add. (objc_assign_ivar_decl): Add. (objc_assign_ivar_fast_decl): Add. (objc_assign_global_decl): Add. (objc_assign_strong_cast_decl): Add. (objc_method_list_ptr): Add. (objc_method_proto_list_ptr): Add. (objc_ivar_list_ptr): Add. * objc-act.c (should_call_super_dealloc): Add. (OBJC_VERSION): Bump to 6. (objc_is_gcable_type): Add. (objc_substitute_decl): Add. (objc_build_ivar_assignment): Add. (objc_build_global_assignment): Add. (objc_build_strong_cast_assignment): Add. (objc_is_gcable_p): Add. (objc_is_ivar_reference_p): Add. (objc_is_global_reference_p): Add. (generate_shared_structures): Add flags parameter. (objc_generate_cxx_ctor_or_dtor): Add. (objc_generate_cxx_cdtors): Add. (add_class): Add name parameter. (objc_types_share_size_and_alignment): Add. (comp_proto_with_proto): Add strict parameter. (CLS_HAS_CXX_STRUCTORS): Add. (TAG_ASSIGNIVAR): Add. (TAG_ASSIGNGLOBAL): Add. (TAG_ASSIGNSTRONGCAST): Add. (TAG_MSGSEND_FAST): Add. (TAG_ASSIGNIVAR_FAST): Add. (TAG_CXX_CONSTRUCT): Add. (TAG_CXX_DESTRUCT): Add. (OBJC_LOOKUP_CLASS): Add. (OBJC_LOOKUP_NO_SUPER): Add. (objc_finish_file): Add pch support. (objc_finish_implementation): Add Objective-C++ support. (synth_module_prologue): Likewise. (synth_module_prologue): Add fast dispatching. (objc_get_class_reference): Add Objective-C++ support. (objc_generate_write_barrier): Likewise. (next_sjlj_build_enter_and_setjmp): Likewise. (objc_begin_try_stmt): Likewise. (build_next_objc_exception_stuff): Add fast ivar support. (build_private_template): Mark the record as used so debug information is generated. (build_protocol_template): Add Objective-C++ support. (objc_method_parm_type) Likewise. (objc_generate_cxx_ctor_or_dtor): Likewise. (objc_generate_cxx_cdtors): Likewise. (build_protocol_initializer): Likewise. (build_category_template): Likewise. (build_class_template): Likewise. (build_method_list_template): Likewise. (build_category_initializer): Likewise. (build_shared_structure_initializer): Likewise. (objc_finish_message_expr): Likewise. (build_objc_method_call): Add fast dispatch support. (lookup_method_static): Add support to end search at superclasses. (add_method_to_hash_list): Add strict parameter to comp_proto_with_proto. (objc_add_method): Likewise. (objc_add_method): Also set the interface_value. (add_instance_variable): Add Objective-C++ support. (objc_is_public): Likewise. (start_class): Likewise. (continue_class): Likewise. (encode_aggregate_within): Likewise. (start_method_def): Likewise. (objc_start_function): Clear current_function_returns_value and current_function_returns_null. (really_start_method): Add Objective-C++ support. (objc_finish_method_definition): Add warning for missing [super dealloc]. (finish_objc): Add Objective-C++ support. (generate_objc_image_info): Likewise. (objc_lookup_ivar): Likewise. * objc-act.h (TYPE_HAS_OBJC_INFO): Likewise. (INIT_TYPE_OBJC_INFO): Likewise. (DUP_TYPE_OBJC_INFO): Likewise. From-SVN: r99857
2005-05-17 22:07:08 +02:00
field_decl = create_field_decl (objc_method_list_ptr,
Makefile.in (c-parse.o): Depend on $(C_COMMON_H). [gcc/ChangeLog] 2004-09-07 Ziemowit Laski <zlaski@apple.com> * Makefile.in (c-parse.o): Depend on $(C_COMMON_H). * c-parse.in: Include c-common.h instead of objc-act.h. (ivar_decl_list, ivar_decls, ivar_decl, ivars, ivar_declarator, myparms, myparm): Remove %type declarations. (methodtype, optparms, OBJC_TYPE_QUAL, objc_quals, objc_qual, objc_typename, objc_try_catch_stmt, optellipsis): Add %type declarations. (objc_inherit_code, objc_public_flag): Remove. (typespec_nonreserved_nonattr): Call objc_get_protocol_qualified_type() instead of get_static_reference() and get_protocol_reference(). (stmt_nocomp): Call grokparm() on @catch parameter. (objcdef): Move semantic action to objc_finish_implementation(). (classdef): Move semantic action to objc_start_class_interface(), objc_continue_interface(), objc_finish_interface(), objc_start_class_implementation(), objc_continue_implementation(), objc_start_category_interface() and objc_start_category_implementation(). (protocoldef): Move semantic actions to objc_start_protocol() and objc_finish_interface(). (ivar_decl_list): Remove nonterminal. (visibility_spec): Move semantic actions to objc_set_visibility(). (ivar_decls): Remove assignment to $$. (ivar_decl): Rephrase in terms of component_decl; call objc_add_instance_variable(). (ivars, ivar_declarator): Remove nonterminals. (opt_semi): New nonterminal. (methodtype): Remove semantic actions. (methoddef): Move semantic actions to objc_set_method_type(), objc_start_method_definition() and objc_finish_method_definition(). (methodproto): Move semantic actions to objc_set_method_type() and objc_add_method_declaration(). (methoddecl): Use objc_typename instead of typename; move semantic actions to objc_build_method_signature(). (optarglist, myxdecls, mydecl, myparms, myparm): Remove nonterminals. (optparmlist): Express in terms of optparms and optellipsis. (optparms, optellipsis, objc_qual, objc_quals, objc_typename): New nonterminals. (keyworddecl): Use objc_typename instead of typename. (rid_to_yy): Mark RID_IN, RID_OUT, RID_INOUT, RID_BYCOPY, RID_BYREF and RID_ONEWAY as returning OBJC_TYPE_QUAL to yyparse(). [gcc/objc/ChangeLog] 2004-09-07 Ziemowit Laski <zlaski@apple.com> * Make-lang.in (objc/objc-parse.o): Depend on $(C_COMMON_H) instead of objc/objc-act.h. (objc/objc-act.o): Depend on $(HASHTAB_H). * objc-act.c: Include hashtab.h; in ObjC++ mode, include cp-tree.h and objcp-decl.h instead of c-tree.h. (build_module_descriptor, get_class_ivars, synth_id_with_class_suffix, error_with_ivar, gen_method_decl, gen_declaration, setup_string_decl, build_protocol_template): Adjust prototypes. (build_module_initializer_routine, start_class, continue_class, finish_class, start_method_def, objc_start_function, start_protocol, build_method_decl, objc_add_method, add_instance_variable, build_ivar_reference, is_ivar, is_private, get_super_receiver, build_selector_table_decl, objc_push_parm, objc_get_parm_info, gen_type_name, gen_type_name_0, start_var_decl, finish_var_decl, create_field_decl): New prototypes. (objc_expand_function_end, comp_method_with_proto, objc_expr_last, gen_declaration_1, gen_declarator, is_complex_decl, adorn_decl, define_decl, create_builtin_decl, gen_declspecs): Remove prototypes. (TYPE_ID): Rename to OBJECT_TYPEDEF_NAME. (CLASS_TYPEDEF_NAME): New. (TAG_EXECCLASS): Change from a global variable to a #define. (TAG_RETURN_STRUCT): Delete. (TAG_GNUINIT): New, holds '__objc_gnu_init' name. (objc_inherit_code, objc_public_flag): New, moved from c-parse.in. (string_descriptor): New struct. (string_htab): New hash table. (string_hash, string_eq): New prototypes. (generate_struct_by_value_array): Call create_field_decl() instead of create_builtin_decl(). (objc_init): Do not initialize objc_ellipsis_node or TAG_EXECCLASS; In ObjC++ mode, call cxx_init() instead of c_objc_common_init(). (objc_finish_file): In ObjC++, call instantiate_pending_templates() and cp_finish_file(). (define_decl, get_static_reference, get_protocol_reference, create_builtin_decl): Remove functions. (objc_start_class_interface, objc_start_category_interface, objc_start_protocol, objc_continue_interface, objc_finish_interface, objc_start_class_implementation, objc_start_category_implementation, objc_continue_implementation, objc_finish_implementation, objc_set_visibility, objc_set_method_type, objc_build_method_signature, objc_add_method_declaration, objc_start_method_definition, objc_add_instance_variable, objc_get_protocol_qualified_type, create_field_decl, start_var_decl, finish_var_decl): New functions. (setup_string_decl): Simplify since it is only called once. (synth_module_prologue): Call build_class_template(); predefine 'id' and 'Class' as typedefs; rename 'temp_type' to 'type'; disable debug hooks for duration of function; fix GNU runtime messenger signatures to correspond to reality; forward-declare '__objc_exec_class' for the GNU runtime; call build_selector_table_decl(); in ObjC++ mode, generate 'extern "C" { ... }' wrappers around synthesized declarations; call build_protocol_template() and build_category_template(). (string_hash, string_eq): New functions. (objc_build_string_object): Check metaclass correctness only once; store string literals in hash table. (objc_build_constructor): Do not convert initializer elements; adjust for ObjC++ impedance mismatch. (build_objc_symtab_template): Call create_field_decl() instead of create_builtin_decl(). (init_objc_symtab): Add missing conversion to initializer element. (build_metadata_decl): Call start_var_decl() instead of define_decl(). (generate_objc_symtab_decl): Do not call build_category_template(); call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(). (build_module_descriptor): Call create_field_decl() instead of grokfield(); call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(); always mark module descriptor as used; move GNU runtime-specific functionality to build_module_initializer_routine(). (build_module_initializer_routine): New function, broken off of build_module_descriptor(). (objc_static_init_needed_p, objc_generate_static_init_call): New functions. (generate_static_references, generate_strings, build_selector_translation_table, generate_descriptor_table, generate_ivars_list, generate_dispatch_table, generate_category): Call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(); build a type directly instead of via groktypename(). (build_selector_reference_decl, build_selector_table_decl, build_class_reference_decl, build_protocol_reference, generate_objc_image_info): Call start_var_decl() instead of build_decl(). (build_selector_reference): For GNU runtime, do not call build_selector_reference_decl(). (build_selector, build_typed_selector_reference): Always convert result to the selector type. (add_objc_string): Cast return value to 'char *'. (build_method_prototype_template, build_selector_template, build_method_template): Use actual selector type for fields pointing to selectors. (finish_objc): For GNU runtime, call build_module_initializer_routine() after build_module_descriptor(). (generate_protocol_list, generate_shared_structures): Call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(); build a type directly instead of via groktypename(). (synth_id_with_class_suffix): Return a string. (get_arg_type_list): For instance methods, use the instance type for 'self'; do not call groktypename_in_parm_context(). (build_objc_string_decl): Squash redeclaration errors in ObjC++. (objc_is_class_name): Use OBJC_TYPE_NAME instead of TYPE_NAME; handle RECORD_TYPEs in ObjC as well as ObjC++. (objc_is_id): New function. (objc_is_object_ptr): Return the canonical type node. (objc_get_class_ivars): Simplify using get_class_ivars(). (get_class_ivars): Remove second parameter; create a fresh copy of the ivar list for each call; do not check for existence of super class. (objc_eh_runtime_type): Mark #ifndef OBJCPLUS. (objc_init_exceptions): When using SJLJ-style exceptions, require the use of '-fobjc-exceptions' flag; do not require it for DWARF-style exceptions. (objc_build_exc_ptr, next_sjlj_build_try_catch_finally): Use objc_object_type instead of objc_id_type. (objc_begin_catch_clause): Convert the incoming PARM_DECL into a VAR_DECL before placing it in the appropriate scope; do not call define_decl(); adjust call to c_begin_compound_stmt(); use objc_object_type instead of objc_id_type. (build_next_objc_exception_stuff): Call create_field_decl() instead of create_builtin_decl(); construct type directly instead of calling groktypename(); use OBJC_VOID_AT_END to mark end of function parameters. (build_private_template): Adjust call to get_class_ivars(); build a type directly instead of via groktypename(). (build_protocol_template, build_method_prototype_list_template, build_method_prototype_template, build_category_template, build_selector_template, build_class_template, build_super_template, build_ivar_template, build_ivar_list_template, build_method_list_template, build_method_template): Call create_field_decl() instead of grokfield(). (objc_method_parm_type): Do not call groktypename(). (generate_descriptor_table): Call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(). (generate_method_descriptors, build_protocol_initializer, generate_dispatch_tables, build_category_initializer, build_shared_structure_initializer): Do not call groktypename(). (generate_protocols): Call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(); do not call groktypename(). (error_with_ivar): Remove last parameter. (check_ivars): Do not iterate ovar CLASS_RAW_IVARS lists in addition to CLASS_IVARS lists; adjust calls to error_with_ivar(). (generate_ivar_lists): Convert one of the initializer elements; do not call groktypename(). (get_arg_type_list, start_method_def, gen_method_def): Account for new representation of variable arguments and '...' in Objective-C methods; add Objective-C++ impedance matching code. (is_objc_type_qualifier): Remove function. (adjust_type_for_id_default): Simplify; there is no longer a need to wade through declspecs. (lookup_interface, start_class, continue_class, finish_class, start_method_def, start_protocol, build_method_decl, objc_add_method, add_instance_variable, build_ivar_reference, is_ivar, is_private, get_super_receiver, objc_build_finally_epilogue): Make into static functions. (receiver_is_class_object): Use new IS_CLASS() macro. (objc_build_message_expr): Tweak ObjC++ message argument handling; call objc_finish_message_expr() instead of finish_message_expr(). (finish_message_expr): Rename to objc_finish_message_expr(); use OBJC_TYPE_NAME and OBJC_SET_TYPE_NAME macros instead of TYPE_NAME. call gen_type_name() instead of gen_declaration(); call objc_is_id() instead of using IS_ID and IS_CLASS; Use objc_class_name instead of calling get_identifier("Class"); handle CONVERT_EXPRs in receiver. (build_objc_method_call, warn_with_method): Do not call groktypename(). (build_ivar_reference): Call convert() instead of clobbering in a type. (hash_init): Initialize string_htab hash table. (add_instance_variable): Simplify parameter list; do not call grokfield(); do not populate CLASS_IVARS list. (start_class): Check for the existence of super class, if one was specified. (continue_class): Use CLASS_RAW_IVARS rather than CLASS_IVARS; do not call build_class_template(); adjust call to get_class_ivars(); call build_decl(), pushdecl() and finish_decl() instead of define_decl(). (finish_class): Call build_decl(), pushdecl() and finish_decl() instead of define_decl(). (add_protocols): Use PROTOCOL_BINFO_ELTS for the tree vector size. (start_protocol): Do not call build_protocol_template(); use PROTOCOL_BINFO_ELTS for the tree vector size. (encode_type_qualifiers): Do not handle the 'const' qualifier here. (encode_pointer): Encode 'const char *' as 'r*', for backwards compatibility. (encode_array): Use HOST_WIDE_INT_PRINT_DEC instead of "%ld". (encode_type): Handle the 'const' qualifier here. (objc_parmlist): New global variable, sued by objc_push_parm and objc_get_parm_info(). (objc_push_parm, objc_get_parm_info): New functions. (objc_expr_last): Remove function. (synth_self_and_ucmd_args): For instance methods, use the instance type for 'self'; call objc_push_parm() instead of push_parm_decl(). (start_method_def): Do not call push_scope(), declare_parm_level(), pop_scope(), push_parm_decl(), store_parm_decls() or objc_expr_last(); just use objc_push_parm() and objc_get_parm_info(). (comp_method_with_proto): Remove function. (objc_types_are_equivalent): Strip away indirections before comparing underlying types. (comp_proto_with_proto): Do not call groktypename(); types are no longer in raw declspec format. (objc_start_function): New function. (really_start_method): Call comp_proto_with_proto() instead of comp_method_with_proto(); call objc_start_function() instead of hand-crafting a function declarator. (continue_method_def, objc_expand_function_end): Remove functions. (get_super_receiver): Call objc_get_current_scope() instead of get_current_scope(); reference 'super_class' field (instead of 'class'). (finish_method_def): Rename to objc_finish_method_definition() and add a function decl parameter; move method encoding call from objc_expand_function_end(). (is_complex_decl, adorn_decl, gen_declarator, gen_declspecs, gen_declaration_1): Remove functions. (tmpbuf, RAW_DECLSPEC): Remove. (gen_declaration): Remove second parameter; simplify to deal with TYPE_P nodes instead of raw declspecs. (gen_type_name, gen_type_name_0): New functions. (gen_method_decl): Remove second parameter; call gen_type_name() instead of gen_declaration_1(). (dump_interface): Adjust calls to gen_declaration() and gen_method_decl(); do not allocate a separate string buffer. (init_objc): Allocate a larger string buffer to accommodate dump_interface(); adjust call to build_module_descriptor(); add call to build_module_initializer_routine() for the GNU runtime. (generate_classref_translation_entry): Do not call start_decl(); call finish_var_decl() instead of finish_decl(); call convert() instead of build_c_cast(). * objc-act.h (CLASS_OWN_IVARS): Remove accessor. (CLASS_BINFO_ELTS): Reduce from 6 to 5, now that CLASS_OWN_IVARS is gone. (OCTI_GNU_INIT_DECL, GNU_INIT_decl): New. (OCTI_ELLIPSIS_NODE, objc_ellipsis_node): Remove. (OCTI_ID_ID, id_type, objc_id_id): Rename to OCTI_ID_NAME, objc_object_type and objc_object_name, respectively. (OCTI_CLS_REF, OCTI_CLASS_NAME, objc_class_reference, objc_class_name): New. (IS_CLASS): New macro. (IS_ID, IS_SUPER): Robustify. (OCTI_EXECCLASS_DECL, execclass_decl): New. (finish_file, start_class, continue_class, finish_class, start_method_def, continue_method_def, finish_method_def, start_protocol, finish_protocol, objc_build_throw_stmt, objc_build_try_catch_finally_stmt, objc_build_synchronized_prologue, objc_build_synchronized_epilogue, objc_build_try_prologue, objc_build_try_epilogue, objc_build_catch_stmt, objc_build_catch_epilogue, objc_build_finally_prologue, objc_build_finally_epilogue, is_ivar, is_private, is_public, add_instance_variable, objc_add_method, get_super_receiver, objc_clear_super_receiver, get_class_ivars_from_name, get_class_reference, get_static_reference, get_object_reference, build_message_expr, finish_message_expr, build_selector_expr, build_ivar_reference, build_keyword_decl, build_method_decl, build_protocol_expr, build_objc_string_object, objc_declare_alias, objc_declare_class, objc_declare_protocols, objc_comptypes, objc_check_decl, build_encode_expr): Remove prototypes. (imp_count, cat_count): Make GGC-aware. (OBJC_SET_TYPE_NAME): New macro. From-SVN: r87168
2004-09-08 02:49:44 +02:00
"methods");
1992-01-18 00:15:38 +01:00
chainon (field_decl_chain, field_decl);
if (flag_next_runtime)
{
/* struct objc_cache *cache; */
Makefile.in (c-parse.o): Depend on $(C_COMMON_H). [gcc/ChangeLog] 2004-09-07 Ziemowit Laski <zlaski@apple.com> * Makefile.in (c-parse.o): Depend on $(C_COMMON_H). * c-parse.in: Include c-common.h instead of objc-act.h. (ivar_decl_list, ivar_decls, ivar_decl, ivars, ivar_declarator, myparms, myparm): Remove %type declarations. (methodtype, optparms, OBJC_TYPE_QUAL, objc_quals, objc_qual, objc_typename, objc_try_catch_stmt, optellipsis): Add %type declarations. (objc_inherit_code, objc_public_flag): Remove. (typespec_nonreserved_nonattr): Call objc_get_protocol_qualified_type() instead of get_static_reference() and get_protocol_reference(). (stmt_nocomp): Call grokparm() on @catch parameter. (objcdef): Move semantic action to objc_finish_implementation(). (classdef): Move semantic action to objc_start_class_interface(), objc_continue_interface(), objc_finish_interface(), objc_start_class_implementation(), objc_continue_implementation(), objc_start_category_interface() and objc_start_category_implementation(). (protocoldef): Move semantic actions to objc_start_protocol() and objc_finish_interface(). (ivar_decl_list): Remove nonterminal. (visibility_spec): Move semantic actions to objc_set_visibility(). (ivar_decls): Remove assignment to $$. (ivar_decl): Rephrase in terms of component_decl; call objc_add_instance_variable(). (ivars, ivar_declarator): Remove nonterminals. (opt_semi): New nonterminal. (methodtype): Remove semantic actions. (methoddef): Move semantic actions to objc_set_method_type(), objc_start_method_definition() and objc_finish_method_definition(). (methodproto): Move semantic actions to objc_set_method_type() and objc_add_method_declaration(). (methoddecl): Use objc_typename instead of typename; move semantic actions to objc_build_method_signature(). (optarglist, myxdecls, mydecl, myparms, myparm): Remove nonterminals. (optparmlist): Express in terms of optparms and optellipsis. (optparms, optellipsis, objc_qual, objc_quals, objc_typename): New nonterminals. (keyworddecl): Use objc_typename instead of typename. (rid_to_yy): Mark RID_IN, RID_OUT, RID_INOUT, RID_BYCOPY, RID_BYREF and RID_ONEWAY as returning OBJC_TYPE_QUAL to yyparse(). [gcc/objc/ChangeLog] 2004-09-07 Ziemowit Laski <zlaski@apple.com> * Make-lang.in (objc/objc-parse.o): Depend on $(C_COMMON_H) instead of objc/objc-act.h. (objc/objc-act.o): Depend on $(HASHTAB_H). * objc-act.c: Include hashtab.h; in ObjC++ mode, include cp-tree.h and objcp-decl.h instead of c-tree.h. (build_module_descriptor, get_class_ivars, synth_id_with_class_suffix, error_with_ivar, gen_method_decl, gen_declaration, setup_string_decl, build_protocol_template): Adjust prototypes. (build_module_initializer_routine, start_class, continue_class, finish_class, start_method_def, objc_start_function, start_protocol, build_method_decl, objc_add_method, add_instance_variable, build_ivar_reference, is_ivar, is_private, get_super_receiver, build_selector_table_decl, objc_push_parm, objc_get_parm_info, gen_type_name, gen_type_name_0, start_var_decl, finish_var_decl, create_field_decl): New prototypes. (objc_expand_function_end, comp_method_with_proto, objc_expr_last, gen_declaration_1, gen_declarator, is_complex_decl, adorn_decl, define_decl, create_builtin_decl, gen_declspecs): Remove prototypes. (TYPE_ID): Rename to OBJECT_TYPEDEF_NAME. (CLASS_TYPEDEF_NAME): New. (TAG_EXECCLASS): Change from a global variable to a #define. (TAG_RETURN_STRUCT): Delete. (TAG_GNUINIT): New, holds '__objc_gnu_init' name. (objc_inherit_code, objc_public_flag): New, moved from c-parse.in. (string_descriptor): New struct. (string_htab): New hash table. (string_hash, string_eq): New prototypes. (generate_struct_by_value_array): Call create_field_decl() instead of create_builtin_decl(). (objc_init): Do not initialize objc_ellipsis_node or TAG_EXECCLASS; In ObjC++ mode, call cxx_init() instead of c_objc_common_init(). (objc_finish_file): In ObjC++, call instantiate_pending_templates() and cp_finish_file(). (define_decl, get_static_reference, get_protocol_reference, create_builtin_decl): Remove functions. (objc_start_class_interface, objc_start_category_interface, objc_start_protocol, objc_continue_interface, objc_finish_interface, objc_start_class_implementation, objc_start_category_implementation, objc_continue_implementation, objc_finish_implementation, objc_set_visibility, objc_set_method_type, objc_build_method_signature, objc_add_method_declaration, objc_start_method_definition, objc_add_instance_variable, objc_get_protocol_qualified_type, create_field_decl, start_var_decl, finish_var_decl): New functions. (setup_string_decl): Simplify since it is only called once. (synth_module_prologue): Call build_class_template(); predefine 'id' and 'Class' as typedefs; rename 'temp_type' to 'type'; disable debug hooks for duration of function; fix GNU runtime messenger signatures to correspond to reality; forward-declare '__objc_exec_class' for the GNU runtime; call build_selector_table_decl(); in ObjC++ mode, generate 'extern "C" { ... }' wrappers around synthesized declarations; call build_protocol_template() and build_category_template(). (string_hash, string_eq): New functions. (objc_build_string_object): Check metaclass correctness only once; store string literals in hash table. (objc_build_constructor): Do not convert initializer elements; adjust for ObjC++ impedance mismatch. (build_objc_symtab_template): Call create_field_decl() instead of create_builtin_decl(). (init_objc_symtab): Add missing conversion to initializer element. (build_metadata_decl): Call start_var_decl() instead of define_decl(). (generate_objc_symtab_decl): Do not call build_category_template(); call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(). (build_module_descriptor): Call create_field_decl() instead of grokfield(); call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(); always mark module descriptor as used; move GNU runtime-specific functionality to build_module_initializer_routine(). (build_module_initializer_routine): New function, broken off of build_module_descriptor(). (objc_static_init_needed_p, objc_generate_static_init_call): New functions. (generate_static_references, generate_strings, build_selector_translation_table, generate_descriptor_table, generate_ivars_list, generate_dispatch_table, generate_category): Call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(); build a type directly instead of via groktypename(). (build_selector_reference_decl, build_selector_table_decl, build_class_reference_decl, build_protocol_reference, generate_objc_image_info): Call start_var_decl() instead of build_decl(). (build_selector_reference): For GNU runtime, do not call build_selector_reference_decl(). (build_selector, build_typed_selector_reference): Always convert result to the selector type. (add_objc_string): Cast return value to 'char *'. (build_method_prototype_template, build_selector_template, build_method_template): Use actual selector type for fields pointing to selectors. (finish_objc): For GNU runtime, call build_module_initializer_routine() after build_module_descriptor(). (generate_protocol_list, generate_shared_structures): Call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(); build a type directly instead of via groktypename(). (synth_id_with_class_suffix): Return a string. (get_arg_type_list): For instance methods, use the instance type for 'self'; do not call groktypename_in_parm_context(). (build_objc_string_decl): Squash redeclaration errors in ObjC++. (objc_is_class_name): Use OBJC_TYPE_NAME instead of TYPE_NAME; handle RECORD_TYPEs in ObjC as well as ObjC++. (objc_is_id): New function. (objc_is_object_ptr): Return the canonical type node. (objc_get_class_ivars): Simplify using get_class_ivars(). (get_class_ivars): Remove second parameter; create a fresh copy of the ivar list for each call; do not check for existence of super class. (objc_eh_runtime_type): Mark #ifndef OBJCPLUS. (objc_init_exceptions): When using SJLJ-style exceptions, require the use of '-fobjc-exceptions' flag; do not require it for DWARF-style exceptions. (objc_build_exc_ptr, next_sjlj_build_try_catch_finally): Use objc_object_type instead of objc_id_type. (objc_begin_catch_clause): Convert the incoming PARM_DECL into a VAR_DECL before placing it in the appropriate scope; do not call define_decl(); adjust call to c_begin_compound_stmt(); use objc_object_type instead of objc_id_type. (build_next_objc_exception_stuff): Call create_field_decl() instead of create_builtin_decl(); construct type directly instead of calling groktypename(); use OBJC_VOID_AT_END to mark end of function parameters. (build_private_template): Adjust call to get_class_ivars(); build a type directly instead of via groktypename(). (build_protocol_template, build_method_prototype_list_template, build_method_prototype_template, build_category_template, build_selector_template, build_class_template, build_super_template, build_ivar_template, build_ivar_list_template, build_method_list_template, build_method_template): Call create_field_decl() instead of grokfield(). (objc_method_parm_type): Do not call groktypename(). (generate_descriptor_table): Call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(). (generate_method_descriptors, build_protocol_initializer, generate_dispatch_tables, build_category_initializer, build_shared_structure_initializer): Do not call groktypename(). (generate_protocols): Call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(); do not call groktypename(). (error_with_ivar): Remove last parameter. (check_ivars): Do not iterate ovar CLASS_RAW_IVARS lists in addition to CLASS_IVARS lists; adjust calls to error_with_ivar(). (generate_ivar_lists): Convert one of the initializer elements; do not call groktypename(). (get_arg_type_list, start_method_def, gen_method_def): Account for new representation of variable arguments and '...' in Objective-C methods; add Objective-C++ impedance matching code. (is_objc_type_qualifier): Remove function. (adjust_type_for_id_default): Simplify; there is no longer a need to wade through declspecs. (lookup_interface, start_class, continue_class, finish_class, start_method_def, start_protocol, build_method_decl, objc_add_method, add_instance_variable, build_ivar_reference, is_ivar, is_private, get_super_receiver, objc_build_finally_epilogue): Make into static functions. (receiver_is_class_object): Use new IS_CLASS() macro. (objc_build_message_expr): Tweak ObjC++ message argument handling; call objc_finish_message_expr() instead of finish_message_expr(). (finish_message_expr): Rename to objc_finish_message_expr(); use OBJC_TYPE_NAME and OBJC_SET_TYPE_NAME macros instead of TYPE_NAME. call gen_type_name() instead of gen_declaration(); call objc_is_id() instead of using IS_ID and IS_CLASS; Use objc_class_name instead of calling get_identifier("Class"); handle CONVERT_EXPRs in receiver. (build_objc_method_call, warn_with_method): Do not call groktypename(). (build_ivar_reference): Call convert() instead of clobbering in a type. (hash_init): Initialize string_htab hash table. (add_instance_variable): Simplify parameter list; do not call grokfield(); do not populate CLASS_IVARS list. (start_class): Check for the existence of super class, if one was specified. (continue_class): Use CLASS_RAW_IVARS rather than CLASS_IVARS; do not call build_class_template(); adjust call to get_class_ivars(); call build_decl(), pushdecl() and finish_decl() instead of define_decl(). (finish_class): Call build_decl(), pushdecl() and finish_decl() instead of define_decl(). (add_protocols): Use PROTOCOL_BINFO_ELTS for the tree vector size. (start_protocol): Do not call build_protocol_template(); use PROTOCOL_BINFO_ELTS for the tree vector size. (encode_type_qualifiers): Do not handle the 'const' qualifier here. (encode_pointer): Encode 'const char *' as 'r*', for backwards compatibility. (encode_array): Use HOST_WIDE_INT_PRINT_DEC instead of "%ld". (encode_type): Handle the 'const' qualifier here. (objc_parmlist): New global variable, sued by objc_push_parm and objc_get_parm_info(). (objc_push_parm, objc_get_parm_info): New functions. (objc_expr_last): Remove function. (synth_self_and_ucmd_args): For instance methods, use the instance type for 'self'; call objc_push_parm() instead of push_parm_decl(). (start_method_def): Do not call push_scope(), declare_parm_level(), pop_scope(), push_parm_decl(), store_parm_decls() or objc_expr_last(); just use objc_push_parm() and objc_get_parm_info(). (comp_method_with_proto): Remove function. (objc_types_are_equivalent): Strip away indirections before comparing underlying types. (comp_proto_with_proto): Do not call groktypename(); types are no longer in raw declspec format. (objc_start_function): New function. (really_start_method): Call comp_proto_with_proto() instead of comp_method_with_proto(); call objc_start_function() instead of hand-crafting a function declarator. (continue_method_def, objc_expand_function_end): Remove functions. (get_super_receiver): Call objc_get_current_scope() instead of get_current_scope(); reference 'super_class' field (instead of 'class'). (finish_method_def): Rename to objc_finish_method_definition() and add a function decl parameter; move method encoding call from objc_expand_function_end(). (is_complex_decl, adorn_decl, gen_declarator, gen_declspecs, gen_declaration_1): Remove functions. (tmpbuf, RAW_DECLSPEC): Remove. (gen_declaration): Remove second parameter; simplify to deal with TYPE_P nodes instead of raw declspecs. (gen_type_name, gen_type_name_0): New functions. (gen_method_decl): Remove second parameter; call gen_type_name() instead of gen_declaration_1(). (dump_interface): Adjust calls to gen_declaration() and gen_method_decl(); do not allocate a separate string buffer. (init_objc): Allocate a larger string buffer to accommodate dump_interface(); adjust call to build_module_descriptor(); add call to build_module_initializer_routine() for the GNU runtime. (generate_classref_translation_entry): Do not call start_decl(); call finish_var_decl() instead of finish_decl(); call convert() instead of build_c_cast(). * objc-act.h (CLASS_OWN_IVARS): Remove accessor. (CLASS_BINFO_ELTS): Reduce from 6 to 5, now that CLASS_OWN_IVARS is gone. (OCTI_GNU_INIT_DECL, GNU_INIT_decl): New. (OCTI_ELLIPSIS_NODE, objc_ellipsis_node): Remove. (OCTI_ID_ID, id_type, objc_id_id): Rename to OCTI_ID_NAME, objc_object_type and objc_object_name, respectively. (OCTI_CLS_REF, OCTI_CLASS_NAME, objc_class_reference, objc_class_name): New. (IS_CLASS): New macro. (IS_ID, IS_SUPER): Robustify. (OCTI_EXECCLASS_DECL, execclass_decl): New. (finish_file, start_class, continue_class, finish_class, start_method_def, continue_method_def, finish_method_def, start_protocol, finish_protocol, objc_build_throw_stmt, objc_build_try_catch_finally_stmt, objc_build_synchronized_prologue, objc_build_synchronized_epilogue, objc_build_try_prologue, objc_build_try_epilogue, objc_build_catch_stmt, objc_build_catch_epilogue, objc_build_finally_prologue, objc_build_finally_epilogue, is_ivar, is_private, is_public, add_instance_variable, objc_add_method, get_super_receiver, objc_clear_super_receiver, get_class_ivars_from_name, get_class_reference, get_static_reference, get_object_reference, build_message_expr, finish_message_expr, build_selector_expr, build_ivar_reference, build_keyword_decl, build_method_decl, build_protocol_expr, build_objc_string_object, objc_declare_alias, objc_declare_class, objc_declare_protocols, objc_comptypes, objc_check_decl, build_encode_expr): Remove prototypes. (imp_count, cat_count): Make GGC-aware. (OBJC_SET_TYPE_NAME): New macro. From-SVN: r87168
2004-09-08 02:49:44 +02:00
field_decl = create_field_decl (build_pointer_type
(xref_tag (RECORD_TYPE,
get_identifier
("objc_cache"))),
"cache");
chainon (field_decl_chain, field_decl);
}
else
{
/* struct sarray *dtable; */
Makefile.in (c-parse.o): Depend on $(C_COMMON_H). [gcc/ChangeLog] 2004-09-07 Ziemowit Laski <zlaski@apple.com> * Makefile.in (c-parse.o): Depend on $(C_COMMON_H). * c-parse.in: Include c-common.h instead of objc-act.h. (ivar_decl_list, ivar_decls, ivar_decl, ivars, ivar_declarator, myparms, myparm): Remove %type declarations. (methodtype, optparms, OBJC_TYPE_QUAL, objc_quals, objc_qual, objc_typename, objc_try_catch_stmt, optellipsis): Add %type declarations. (objc_inherit_code, objc_public_flag): Remove. (typespec_nonreserved_nonattr): Call objc_get_protocol_qualified_type() instead of get_static_reference() and get_protocol_reference(). (stmt_nocomp): Call grokparm() on @catch parameter. (objcdef): Move semantic action to objc_finish_implementation(). (classdef): Move semantic action to objc_start_class_interface(), objc_continue_interface(), objc_finish_interface(), objc_start_class_implementation(), objc_continue_implementation(), objc_start_category_interface() and objc_start_category_implementation(). (protocoldef): Move semantic actions to objc_start_protocol() and objc_finish_interface(). (ivar_decl_list): Remove nonterminal. (visibility_spec): Move semantic actions to objc_set_visibility(). (ivar_decls): Remove assignment to $$. (ivar_decl): Rephrase in terms of component_decl; call objc_add_instance_variable(). (ivars, ivar_declarator): Remove nonterminals. (opt_semi): New nonterminal. (methodtype): Remove semantic actions. (methoddef): Move semantic actions to objc_set_method_type(), objc_start_method_definition() and objc_finish_method_definition(). (methodproto): Move semantic actions to objc_set_method_type() and objc_add_method_declaration(). (methoddecl): Use objc_typename instead of typename; move semantic actions to objc_build_method_signature(). (optarglist, myxdecls, mydecl, myparms, myparm): Remove nonterminals. (optparmlist): Express in terms of optparms and optellipsis. (optparms, optellipsis, objc_qual, objc_quals, objc_typename): New nonterminals. (keyworddecl): Use objc_typename instead of typename. (rid_to_yy): Mark RID_IN, RID_OUT, RID_INOUT, RID_BYCOPY, RID_BYREF and RID_ONEWAY as returning OBJC_TYPE_QUAL to yyparse(). [gcc/objc/ChangeLog] 2004-09-07 Ziemowit Laski <zlaski@apple.com> * Make-lang.in (objc/objc-parse.o): Depend on $(C_COMMON_H) instead of objc/objc-act.h. (objc/objc-act.o): Depend on $(HASHTAB_H). * objc-act.c: Include hashtab.h; in ObjC++ mode, include cp-tree.h and objcp-decl.h instead of c-tree.h. (build_module_descriptor, get_class_ivars, synth_id_with_class_suffix, error_with_ivar, gen_method_decl, gen_declaration, setup_string_decl, build_protocol_template): Adjust prototypes. (build_module_initializer_routine, start_class, continue_class, finish_class, start_method_def, objc_start_function, start_protocol, build_method_decl, objc_add_method, add_instance_variable, build_ivar_reference, is_ivar, is_private, get_super_receiver, build_selector_table_decl, objc_push_parm, objc_get_parm_info, gen_type_name, gen_type_name_0, start_var_decl, finish_var_decl, create_field_decl): New prototypes. (objc_expand_function_end, comp_method_with_proto, objc_expr_last, gen_declaration_1, gen_declarator, is_complex_decl, adorn_decl, define_decl, create_builtin_decl, gen_declspecs): Remove prototypes. (TYPE_ID): Rename to OBJECT_TYPEDEF_NAME. (CLASS_TYPEDEF_NAME): New. (TAG_EXECCLASS): Change from a global variable to a #define. (TAG_RETURN_STRUCT): Delete. (TAG_GNUINIT): New, holds '__objc_gnu_init' name. (objc_inherit_code, objc_public_flag): New, moved from c-parse.in. (string_descriptor): New struct. (string_htab): New hash table. (string_hash, string_eq): New prototypes. (generate_struct_by_value_array): Call create_field_decl() instead of create_builtin_decl(). (objc_init): Do not initialize objc_ellipsis_node or TAG_EXECCLASS; In ObjC++ mode, call cxx_init() instead of c_objc_common_init(). (objc_finish_file): In ObjC++, call instantiate_pending_templates() and cp_finish_file(). (define_decl, get_static_reference, get_protocol_reference, create_builtin_decl): Remove functions. (objc_start_class_interface, objc_start_category_interface, objc_start_protocol, objc_continue_interface, objc_finish_interface, objc_start_class_implementation, objc_start_category_implementation, objc_continue_implementation, objc_finish_implementation, objc_set_visibility, objc_set_method_type, objc_build_method_signature, objc_add_method_declaration, objc_start_method_definition, objc_add_instance_variable, objc_get_protocol_qualified_type, create_field_decl, start_var_decl, finish_var_decl): New functions. (setup_string_decl): Simplify since it is only called once. (synth_module_prologue): Call build_class_template(); predefine 'id' and 'Class' as typedefs; rename 'temp_type' to 'type'; disable debug hooks for duration of function; fix GNU runtime messenger signatures to correspond to reality; forward-declare '__objc_exec_class' for the GNU runtime; call build_selector_table_decl(); in ObjC++ mode, generate 'extern "C" { ... }' wrappers around synthesized declarations; call build_protocol_template() and build_category_template(). (string_hash, string_eq): New functions. (objc_build_string_object): Check metaclass correctness only once; store string literals in hash table. (objc_build_constructor): Do not convert initializer elements; adjust for ObjC++ impedance mismatch. (build_objc_symtab_template): Call create_field_decl() instead of create_builtin_decl(). (init_objc_symtab): Add missing conversion to initializer element. (build_metadata_decl): Call start_var_decl() instead of define_decl(). (generate_objc_symtab_decl): Do not call build_category_template(); call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(). (build_module_descriptor): Call create_field_decl() instead of grokfield(); call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(); always mark module descriptor as used; move GNU runtime-specific functionality to build_module_initializer_routine(). (build_module_initializer_routine): New function, broken off of build_module_descriptor(). (objc_static_init_needed_p, objc_generate_static_init_call): New functions. (generate_static_references, generate_strings, build_selector_translation_table, generate_descriptor_table, generate_ivars_list, generate_dispatch_table, generate_category): Call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(); build a type directly instead of via groktypename(). (build_selector_reference_decl, build_selector_table_decl, build_class_reference_decl, build_protocol_reference, generate_objc_image_info): Call start_var_decl() instead of build_decl(). (build_selector_reference): For GNU runtime, do not call build_selector_reference_decl(). (build_selector, build_typed_selector_reference): Always convert result to the selector type. (add_objc_string): Cast return value to 'char *'. (build_method_prototype_template, build_selector_template, build_method_template): Use actual selector type for fields pointing to selectors. (finish_objc): For GNU runtime, call build_module_initializer_routine() after build_module_descriptor(). (generate_protocol_list, generate_shared_structures): Call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(); build a type directly instead of via groktypename(). (synth_id_with_class_suffix): Return a string. (get_arg_type_list): For instance methods, use the instance type for 'self'; do not call groktypename_in_parm_context(). (build_objc_string_decl): Squash redeclaration errors in ObjC++. (objc_is_class_name): Use OBJC_TYPE_NAME instead of TYPE_NAME; handle RECORD_TYPEs in ObjC as well as ObjC++. (objc_is_id): New function. (objc_is_object_ptr): Return the canonical type node. (objc_get_class_ivars): Simplify using get_class_ivars(). (get_class_ivars): Remove second parameter; create a fresh copy of the ivar list for each call; do not check for existence of super class. (objc_eh_runtime_type): Mark #ifndef OBJCPLUS. (objc_init_exceptions): When using SJLJ-style exceptions, require the use of '-fobjc-exceptions' flag; do not require it for DWARF-style exceptions. (objc_build_exc_ptr, next_sjlj_build_try_catch_finally): Use objc_object_type instead of objc_id_type. (objc_begin_catch_clause): Convert the incoming PARM_DECL into a VAR_DECL before placing it in the appropriate scope; do not call define_decl(); adjust call to c_begin_compound_stmt(); use objc_object_type instead of objc_id_type. (build_next_objc_exception_stuff): Call create_field_decl() instead of create_builtin_decl(); construct type directly instead of calling groktypename(); use OBJC_VOID_AT_END to mark end of function parameters. (build_private_template): Adjust call to get_class_ivars(); build a type directly instead of via groktypename(). (build_protocol_template, build_method_prototype_list_template, build_method_prototype_template, build_category_template, build_selector_template, build_class_template, build_super_template, build_ivar_template, build_ivar_list_template, build_method_list_template, build_method_template): Call create_field_decl() instead of grokfield(). (objc_method_parm_type): Do not call groktypename(). (generate_descriptor_table): Call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(). (generate_method_descriptors, build_protocol_initializer, generate_dispatch_tables, build_category_initializer, build_shared_structure_initializer): Do not call groktypename(). (generate_protocols): Call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(); do not call groktypename(). (error_with_ivar): Remove last parameter. (check_ivars): Do not iterate ovar CLASS_RAW_IVARS lists in addition to CLASS_IVARS lists; adjust calls to error_with_ivar(). (generate_ivar_lists): Convert one of the initializer elements; do not call groktypename(). (get_arg_type_list, start_method_def, gen_method_def): Account for new representation of variable arguments and '...' in Objective-C methods; add Objective-C++ impedance matching code. (is_objc_type_qualifier): Remove function. (adjust_type_for_id_default): Simplify; there is no longer a need to wade through declspecs. (lookup_interface, start_class, continue_class, finish_class, start_method_def, start_protocol, build_method_decl, objc_add_method, add_instance_variable, build_ivar_reference, is_ivar, is_private, get_super_receiver, objc_build_finally_epilogue): Make into static functions. (receiver_is_class_object): Use new IS_CLASS() macro. (objc_build_message_expr): Tweak ObjC++ message argument handling; call objc_finish_message_expr() instead of finish_message_expr(). (finish_message_expr): Rename to objc_finish_message_expr(); use OBJC_TYPE_NAME and OBJC_SET_TYPE_NAME macros instead of TYPE_NAME. call gen_type_name() instead of gen_declaration(); call objc_is_id() instead of using IS_ID and IS_CLASS; Use objc_class_name instead of calling get_identifier("Class"); handle CONVERT_EXPRs in receiver. (build_objc_method_call, warn_with_method): Do not call groktypename(). (build_ivar_reference): Call convert() instead of clobbering in a type. (hash_init): Initialize string_htab hash table. (add_instance_variable): Simplify parameter list; do not call grokfield(); do not populate CLASS_IVARS list. (start_class): Check for the existence of super class, if one was specified. (continue_class): Use CLASS_RAW_IVARS rather than CLASS_IVARS; do not call build_class_template(); adjust call to get_class_ivars(); call build_decl(), pushdecl() and finish_decl() instead of define_decl(). (finish_class): Call build_decl(), pushdecl() and finish_decl() instead of define_decl(). (add_protocols): Use PROTOCOL_BINFO_ELTS for the tree vector size. (start_protocol): Do not call build_protocol_template(); use PROTOCOL_BINFO_ELTS for the tree vector size. (encode_type_qualifiers): Do not handle the 'const' qualifier here. (encode_pointer): Encode 'const char *' as 'r*', for backwards compatibility. (encode_array): Use HOST_WIDE_INT_PRINT_DEC instead of "%ld". (encode_type): Handle the 'const' qualifier here. (objc_parmlist): New global variable, sued by objc_push_parm and objc_get_parm_info(). (objc_push_parm, objc_get_parm_info): New functions. (objc_expr_last): Remove function. (synth_self_and_ucmd_args): For instance methods, use the instance type for 'self'; call objc_push_parm() instead of push_parm_decl(). (start_method_def): Do not call push_scope(), declare_parm_level(), pop_scope(), push_parm_decl(), store_parm_decls() or objc_expr_last(); just use objc_push_parm() and objc_get_parm_info(). (comp_method_with_proto): Remove function. (objc_types_are_equivalent): Strip away indirections before comparing underlying types. (comp_proto_with_proto): Do not call groktypename(); types are no longer in raw declspec format. (objc_start_function): New function. (really_start_method): Call comp_proto_with_proto() instead of comp_method_with_proto(); call objc_start_function() instead of hand-crafting a function declarator. (continue_method_def, objc_expand_function_end): Remove functions. (get_super_receiver): Call objc_get_current_scope() instead of get_current_scope(); reference 'super_class' field (instead of 'class'). (finish_method_def): Rename to objc_finish_method_definition() and add a function decl parameter; move method encoding call from objc_expand_function_end(). (is_complex_decl, adorn_decl, gen_declarator, gen_declspecs, gen_declaration_1): Remove functions. (tmpbuf, RAW_DECLSPEC): Remove. (gen_declaration): Remove second parameter; simplify to deal with TYPE_P nodes instead of raw declspecs. (gen_type_name, gen_type_name_0): New functions. (gen_method_decl): Remove second parameter; call gen_type_name() instead of gen_declaration_1(). (dump_interface): Adjust calls to gen_declaration() and gen_method_decl(); do not allocate a separate string buffer. (init_objc): Allocate a larger string buffer to accommodate dump_interface(); adjust call to build_module_descriptor(); add call to build_module_initializer_routine() for the GNU runtime. (generate_classref_translation_entry): Do not call start_decl(); call finish_var_decl() instead of finish_decl(); call convert() instead of build_c_cast(). * objc-act.h (CLASS_OWN_IVARS): Remove accessor. (CLASS_BINFO_ELTS): Reduce from 6 to 5, now that CLASS_OWN_IVARS is gone. (OCTI_GNU_INIT_DECL, GNU_INIT_decl): New. (OCTI_ELLIPSIS_NODE, objc_ellipsis_node): Remove. (OCTI_ID_ID, id_type, objc_id_id): Rename to OCTI_ID_NAME, objc_object_type and objc_object_name, respectively. (OCTI_CLS_REF, OCTI_CLASS_NAME, objc_class_reference, objc_class_name): New. (IS_CLASS): New macro. (IS_ID, IS_SUPER): Robustify. (OCTI_EXECCLASS_DECL, execclass_decl): New. (finish_file, start_class, continue_class, finish_class, start_method_def, continue_method_def, finish_method_def, start_protocol, finish_protocol, objc_build_throw_stmt, objc_build_try_catch_finally_stmt, objc_build_synchronized_prologue, objc_build_synchronized_epilogue, objc_build_try_prologue, objc_build_try_epilogue, objc_build_catch_stmt, objc_build_catch_epilogue, objc_build_finally_prologue, objc_build_finally_epilogue, is_ivar, is_private, is_public, add_instance_variable, objc_add_method, get_super_receiver, objc_clear_super_receiver, get_class_ivars_from_name, get_class_reference, get_static_reference, get_object_reference, build_message_expr, finish_message_expr, build_selector_expr, build_ivar_reference, build_keyword_decl, build_method_decl, build_protocol_expr, build_objc_string_object, objc_declare_alias, objc_declare_class, objc_declare_protocols, objc_comptypes, objc_check_decl, build_encode_expr): Remove prototypes. (imp_count, cat_count): Make GGC-aware. (OBJC_SET_TYPE_NAME): New macro. From-SVN: r87168
2004-09-08 02:49:44 +02:00
field_decl = create_field_decl (build_pointer_type
(xref_tag (RECORD_TYPE,
get_identifier
("sarray"))),
"dtable");
chainon (field_decl_chain, field_decl);
/* struct objc_class *subclass_list; */
Makefile.in (c-parse.o): Depend on $(C_COMMON_H). [gcc/ChangeLog] 2004-09-07 Ziemowit Laski <zlaski@apple.com> * Makefile.in (c-parse.o): Depend on $(C_COMMON_H). * c-parse.in: Include c-common.h instead of objc-act.h. (ivar_decl_list, ivar_decls, ivar_decl, ivars, ivar_declarator, myparms, myparm): Remove %type declarations. (methodtype, optparms, OBJC_TYPE_QUAL, objc_quals, objc_qual, objc_typename, objc_try_catch_stmt, optellipsis): Add %type declarations. (objc_inherit_code, objc_public_flag): Remove. (typespec_nonreserved_nonattr): Call objc_get_protocol_qualified_type() instead of get_static_reference() and get_protocol_reference(). (stmt_nocomp): Call grokparm() on @catch parameter. (objcdef): Move semantic action to objc_finish_implementation(). (classdef): Move semantic action to objc_start_class_interface(), objc_continue_interface(), objc_finish_interface(), objc_start_class_implementation(), objc_continue_implementation(), objc_start_category_interface() and objc_start_category_implementation(). (protocoldef): Move semantic actions to objc_start_protocol() and objc_finish_interface(). (ivar_decl_list): Remove nonterminal. (visibility_spec): Move semantic actions to objc_set_visibility(). (ivar_decls): Remove assignment to $$. (ivar_decl): Rephrase in terms of component_decl; call objc_add_instance_variable(). (ivars, ivar_declarator): Remove nonterminals. (opt_semi): New nonterminal. (methodtype): Remove semantic actions. (methoddef): Move semantic actions to objc_set_method_type(), objc_start_method_definition() and objc_finish_method_definition(). (methodproto): Move semantic actions to objc_set_method_type() and objc_add_method_declaration(). (methoddecl): Use objc_typename instead of typename; move semantic actions to objc_build_method_signature(). (optarglist, myxdecls, mydecl, myparms, myparm): Remove nonterminals. (optparmlist): Express in terms of optparms and optellipsis. (optparms, optellipsis, objc_qual, objc_quals, objc_typename): New nonterminals. (keyworddecl): Use objc_typename instead of typename. (rid_to_yy): Mark RID_IN, RID_OUT, RID_INOUT, RID_BYCOPY, RID_BYREF and RID_ONEWAY as returning OBJC_TYPE_QUAL to yyparse(). [gcc/objc/ChangeLog] 2004-09-07 Ziemowit Laski <zlaski@apple.com> * Make-lang.in (objc/objc-parse.o): Depend on $(C_COMMON_H) instead of objc/objc-act.h. (objc/objc-act.o): Depend on $(HASHTAB_H). * objc-act.c: Include hashtab.h; in ObjC++ mode, include cp-tree.h and objcp-decl.h instead of c-tree.h. (build_module_descriptor, get_class_ivars, synth_id_with_class_suffix, error_with_ivar, gen_method_decl, gen_declaration, setup_string_decl, build_protocol_template): Adjust prototypes. (build_module_initializer_routine, start_class, continue_class, finish_class, start_method_def, objc_start_function, start_protocol, build_method_decl, objc_add_method, add_instance_variable, build_ivar_reference, is_ivar, is_private, get_super_receiver, build_selector_table_decl, objc_push_parm, objc_get_parm_info, gen_type_name, gen_type_name_0, start_var_decl, finish_var_decl, create_field_decl): New prototypes. (objc_expand_function_end, comp_method_with_proto, objc_expr_last, gen_declaration_1, gen_declarator, is_complex_decl, adorn_decl, define_decl, create_builtin_decl, gen_declspecs): Remove prototypes. (TYPE_ID): Rename to OBJECT_TYPEDEF_NAME. (CLASS_TYPEDEF_NAME): New. (TAG_EXECCLASS): Change from a global variable to a #define. (TAG_RETURN_STRUCT): Delete. (TAG_GNUINIT): New, holds '__objc_gnu_init' name. (objc_inherit_code, objc_public_flag): New, moved from c-parse.in. (string_descriptor): New struct. (string_htab): New hash table. (string_hash, string_eq): New prototypes. (generate_struct_by_value_array): Call create_field_decl() instead of create_builtin_decl(). (objc_init): Do not initialize objc_ellipsis_node or TAG_EXECCLASS; In ObjC++ mode, call cxx_init() instead of c_objc_common_init(). (objc_finish_file): In ObjC++, call instantiate_pending_templates() and cp_finish_file(). (define_decl, get_static_reference, get_protocol_reference, create_builtin_decl): Remove functions. (objc_start_class_interface, objc_start_category_interface, objc_start_protocol, objc_continue_interface, objc_finish_interface, objc_start_class_implementation, objc_start_category_implementation, objc_continue_implementation, objc_finish_implementation, objc_set_visibility, objc_set_method_type, objc_build_method_signature, objc_add_method_declaration, objc_start_method_definition, objc_add_instance_variable, objc_get_protocol_qualified_type, create_field_decl, start_var_decl, finish_var_decl): New functions. (setup_string_decl): Simplify since it is only called once. (synth_module_prologue): Call build_class_template(); predefine 'id' and 'Class' as typedefs; rename 'temp_type' to 'type'; disable debug hooks for duration of function; fix GNU runtime messenger signatures to correspond to reality; forward-declare '__objc_exec_class' for the GNU runtime; call build_selector_table_decl(); in ObjC++ mode, generate 'extern "C" { ... }' wrappers around synthesized declarations; call build_protocol_template() and build_category_template(). (string_hash, string_eq): New functions. (objc_build_string_object): Check metaclass correctness only once; store string literals in hash table. (objc_build_constructor): Do not convert initializer elements; adjust for ObjC++ impedance mismatch. (build_objc_symtab_template): Call create_field_decl() instead of create_builtin_decl(). (init_objc_symtab): Add missing conversion to initializer element. (build_metadata_decl): Call start_var_decl() instead of define_decl(). (generate_objc_symtab_decl): Do not call build_category_template(); call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(). (build_module_descriptor): Call create_field_decl() instead of grokfield(); call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(); always mark module descriptor as used; move GNU runtime-specific functionality to build_module_initializer_routine(). (build_module_initializer_routine): New function, broken off of build_module_descriptor(). (objc_static_init_needed_p, objc_generate_static_init_call): New functions. (generate_static_references, generate_strings, build_selector_translation_table, generate_descriptor_table, generate_ivars_list, generate_dispatch_table, generate_category): Call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(); build a type directly instead of via groktypename(). (build_selector_reference_decl, build_selector_table_decl, build_class_reference_decl, build_protocol_reference, generate_objc_image_info): Call start_var_decl() instead of build_decl(). (build_selector_reference): For GNU runtime, do not call build_selector_reference_decl(). (build_selector, build_typed_selector_reference): Always convert result to the selector type. (add_objc_string): Cast return value to 'char *'. (build_method_prototype_template, build_selector_template, build_method_template): Use actual selector type for fields pointing to selectors. (finish_objc): For GNU runtime, call build_module_initializer_routine() after build_module_descriptor(). (generate_protocol_list, generate_shared_structures): Call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(); build a type directly instead of via groktypename(). (synth_id_with_class_suffix): Return a string. (get_arg_type_list): For instance methods, use the instance type for 'self'; do not call groktypename_in_parm_context(). (build_objc_string_decl): Squash redeclaration errors in ObjC++. (objc_is_class_name): Use OBJC_TYPE_NAME instead of TYPE_NAME; handle RECORD_TYPEs in ObjC as well as ObjC++. (objc_is_id): New function. (objc_is_object_ptr): Return the canonical type node. (objc_get_class_ivars): Simplify using get_class_ivars(). (get_class_ivars): Remove second parameter; create a fresh copy of the ivar list for each call; do not check for existence of super class. (objc_eh_runtime_type): Mark #ifndef OBJCPLUS. (objc_init_exceptions): When using SJLJ-style exceptions, require the use of '-fobjc-exceptions' flag; do not require it for DWARF-style exceptions. (objc_build_exc_ptr, next_sjlj_build_try_catch_finally): Use objc_object_type instead of objc_id_type. (objc_begin_catch_clause): Convert the incoming PARM_DECL into a VAR_DECL before placing it in the appropriate scope; do not call define_decl(); adjust call to c_begin_compound_stmt(); use objc_object_type instead of objc_id_type. (build_next_objc_exception_stuff): Call create_field_decl() instead of create_builtin_decl(); construct type directly instead of calling groktypename(); use OBJC_VOID_AT_END to mark end of function parameters. (build_private_template): Adjust call to get_class_ivars(); build a type directly instead of via groktypename(). (build_protocol_template, build_method_prototype_list_template, build_method_prototype_template, build_category_template, build_selector_template, build_class_template, build_super_template, build_ivar_template, build_ivar_list_template, build_method_list_template, build_method_template): Call create_field_decl() instead of grokfield(). (objc_method_parm_type): Do not call groktypename(). (generate_descriptor_table): Call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(). (generate_method_descriptors, build_protocol_initializer, generate_dispatch_tables, build_category_initializer, build_shared_structure_initializer): Do not call groktypename(). (generate_protocols): Call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(); do not call groktypename(). (error_with_ivar): Remove last parameter. (check_ivars): Do not iterate ovar CLASS_RAW_IVARS lists in addition to CLASS_IVARS lists; adjust calls to error_with_ivar(). (generate_ivar_lists): Convert one of the initializer elements; do not call groktypename(). (get_arg_type_list, start_method_def, gen_method_def): Account for new representation of variable arguments and '...' in Objective-C methods; add Objective-C++ impedance matching code. (is_objc_type_qualifier): Remove function. (adjust_type_for_id_default): Simplify; there is no longer a need to wade through declspecs. (lookup_interface, start_class, continue_class, finish_class, start_method_def, start_protocol, build_method_decl, objc_add_method, add_instance_variable, build_ivar_reference, is_ivar, is_private, get_super_receiver, objc_build_finally_epilogue): Make into static functions. (receiver_is_class_object): Use new IS_CLASS() macro. (objc_build_message_expr): Tweak ObjC++ message argument handling; call objc_finish_message_expr() instead of finish_message_expr(). (finish_message_expr): Rename to objc_finish_message_expr(); use OBJC_TYPE_NAME and OBJC_SET_TYPE_NAME macros instead of TYPE_NAME. call gen_type_name() instead of gen_declaration(); call objc_is_id() instead of using IS_ID and IS_CLASS; Use objc_class_name instead of calling get_identifier("Class"); handle CONVERT_EXPRs in receiver. (build_objc_method_call, warn_with_method): Do not call groktypename(). (build_ivar_reference): Call convert() instead of clobbering in a type. (hash_init): Initialize string_htab hash table. (add_instance_variable): Simplify parameter list; do not call grokfield(); do not populate CLASS_IVARS list. (start_class): Check for the existence of super class, if one was specified. (continue_class): Use CLASS_RAW_IVARS rather than CLASS_IVARS; do not call build_class_template(); adjust call to get_class_ivars(); call build_decl(), pushdecl() and finish_decl() instead of define_decl(). (finish_class): Call build_decl(), pushdecl() and finish_decl() instead of define_decl(). (add_protocols): Use PROTOCOL_BINFO_ELTS for the tree vector size. (start_protocol): Do not call build_protocol_template(); use PROTOCOL_BINFO_ELTS for the tree vector size. (encode_type_qualifiers): Do not handle the 'const' qualifier here. (encode_pointer): Encode 'const char *' as 'r*', for backwards compatibility. (encode_array): Use HOST_WIDE_INT_PRINT_DEC instead of "%ld". (encode_type): Handle the 'const' qualifier here. (objc_parmlist): New global variable, sued by objc_push_parm and objc_get_parm_info(). (objc_push_parm, objc_get_parm_info): New functions. (objc_expr_last): Remove function. (synth_self_and_ucmd_args): For instance methods, use the instance type for 'self'; call objc_push_parm() instead of push_parm_decl(). (start_method_def): Do not call push_scope(), declare_parm_level(), pop_scope(), push_parm_decl(), store_parm_decls() or objc_expr_last(); just use objc_push_parm() and objc_get_parm_info(). (comp_method_with_proto): Remove function. (objc_types_are_equivalent): Strip away indirections before comparing underlying types. (comp_proto_with_proto): Do not call groktypename(); types are no longer in raw declspec format. (objc_start_function): New function. (really_start_method): Call comp_proto_with_proto() instead of comp_method_with_proto(); call objc_start_function() instead of hand-crafting a function declarator. (continue_method_def, objc_expand_function_end): Remove functions. (get_super_receiver): Call objc_get_current_scope() instead of get_current_scope(); reference 'super_class' field (instead of 'class'). (finish_method_def): Rename to objc_finish_method_definition() and add a function decl parameter; move method encoding call from objc_expand_function_end(). (is_complex_decl, adorn_decl, gen_declarator, gen_declspecs, gen_declaration_1): Remove functions. (tmpbuf, RAW_DECLSPEC): Remove. (gen_declaration): Remove second parameter; simplify to deal with TYPE_P nodes instead of raw declspecs. (gen_type_name, gen_type_name_0): New functions. (gen_method_decl): Remove second parameter; call gen_type_name() instead of gen_declaration_1(). (dump_interface): Adjust calls to gen_declaration() and gen_method_decl(); do not allocate a separate string buffer. (init_objc): Allocate a larger string buffer to accommodate dump_interface(); adjust call to build_module_descriptor(); add call to build_module_initializer_routine() for the GNU runtime. (generate_classref_translation_entry): Do not call start_decl(); call finish_var_decl() instead of finish_decl(); call convert() instead of build_c_cast(). * objc-act.h (CLASS_OWN_IVARS): Remove accessor. (CLASS_BINFO_ELTS): Reduce from 6 to 5, now that CLASS_OWN_IVARS is gone. (OCTI_GNU_INIT_DECL, GNU_INIT_decl): New. (OCTI_ELLIPSIS_NODE, objc_ellipsis_node): Remove. (OCTI_ID_ID, id_type, objc_id_id): Rename to OCTI_ID_NAME, objc_object_type and objc_object_name, respectively. (OCTI_CLS_REF, OCTI_CLASS_NAME, objc_class_reference, objc_class_name): New. (IS_CLASS): New macro. (IS_ID, IS_SUPER): Robustify. (OCTI_EXECCLASS_DECL, execclass_decl): New. (finish_file, start_class, continue_class, finish_class, start_method_def, continue_method_def, finish_method_def, start_protocol, finish_protocol, objc_build_throw_stmt, objc_build_try_catch_finally_stmt, objc_build_synchronized_prologue, objc_build_synchronized_epilogue, objc_build_try_prologue, objc_build_try_epilogue, objc_build_catch_stmt, objc_build_catch_epilogue, objc_build_finally_prologue, objc_build_finally_epilogue, is_ivar, is_private, is_public, add_instance_variable, objc_add_method, get_super_receiver, objc_clear_super_receiver, get_class_ivars_from_name, get_class_reference, get_static_reference, get_object_reference, build_message_expr, finish_message_expr, build_selector_expr, build_ivar_reference, build_keyword_decl, build_method_decl, build_protocol_expr, build_objc_string_object, objc_declare_alias, objc_declare_class, objc_declare_protocols, objc_comptypes, objc_check_decl, build_encode_expr): Remove prototypes. (imp_count, cat_count): Make GGC-aware. (OBJC_SET_TYPE_NAME): New macro. From-SVN: r87168
2004-09-08 02:49:44 +02:00
field_decl = create_field_decl (build_pointer_type
(objc_class_template),
"subclass_list");
chainon (field_decl_chain, field_decl);
/* struct objc_class *sibling_class; */
Makefile.in (c-parse.o): Depend on $(C_COMMON_H). [gcc/ChangeLog] 2004-09-07 Ziemowit Laski <zlaski@apple.com> * Makefile.in (c-parse.o): Depend on $(C_COMMON_H). * c-parse.in: Include c-common.h instead of objc-act.h. (ivar_decl_list, ivar_decls, ivar_decl, ivars, ivar_declarator, myparms, myparm): Remove %type declarations. (methodtype, optparms, OBJC_TYPE_QUAL, objc_quals, objc_qual, objc_typename, objc_try_catch_stmt, optellipsis): Add %type declarations. (objc_inherit_code, objc_public_flag): Remove. (typespec_nonreserved_nonattr): Call objc_get_protocol_qualified_type() instead of get_static_reference() and get_protocol_reference(). (stmt_nocomp): Call grokparm() on @catch parameter. (objcdef): Move semantic action to objc_finish_implementation(). (classdef): Move semantic action to objc_start_class_interface(), objc_continue_interface(), objc_finish_interface(), objc_start_class_implementation(), objc_continue_implementation(), objc_start_category_interface() and objc_start_category_implementation(). (protocoldef): Move semantic actions to objc_start_protocol() and objc_finish_interface(). (ivar_decl_list): Remove nonterminal. (visibility_spec): Move semantic actions to objc_set_visibility(). (ivar_decls): Remove assignment to $$. (ivar_decl): Rephrase in terms of component_decl; call objc_add_instance_variable(). (ivars, ivar_declarator): Remove nonterminals. (opt_semi): New nonterminal. (methodtype): Remove semantic actions. (methoddef): Move semantic actions to objc_set_method_type(), objc_start_method_definition() and objc_finish_method_definition(). (methodproto): Move semantic actions to objc_set_method_type() and objc_add_method_declaration(). (methoddecl): Use objc_typename instead of typename; move semantic actions to objc_build_method_signature(). (optarglist, myxdecls, mydecl, myparms, myparm): Remove nonterminals. (optparmlist): Express in terms of optparms and optellipsis. (optparms, optellipsis, objc_qual, objc_quals, objc_typename): New nonterminals. (keyworddecl): Use objc_typename instead of typename. (rid_to_yy): Mark RID_IN, RID_OUT, RID_INOUT, RID_BYCOPY, RID_BYREF and RID_ONEWAY as returning OBJC_TYPE_QUAL to yyparse(). [gcc/objc/ChangeLog] 2004-09-07 Ziemowit Laski <zlaski@apple.com> * Make-lang.in (objc/objc-parse.o): Depend on $(C_COMMON_H) instead of objc/objc-act.h. (objc/objc-act.o): Depend on $(HASHTAB_H). * objc-act.c: Include hashtab.h; in ObjC++ mode, include cp-tree.h and objcp-decl.h instead of c-tree.h. (build_module_descriptor, get_class_ivars, synth_id_with_class_suffix, error_with_ivar, gen_method_decl, gen_declaration, setup_string_decl, build_protocol_template): Adjust prototypes. (build_module_initializer_routine, start_class, continue_class, finish_class, start_method_def, objc_start_function, start_protocol, build_method_decl, objc_add_method, add_instance_variable, build_ivar_reference, is_ivar, is_private, get_super_receiver, build_selector_table_decl, objc_push_parm, objc_get_parm_info, gen_type_name, gen_type_name_0, start_var_decl, finish_var_decl, create_field_decl): New prototypes. (objc_expand_function_end, comp_method_with_proto, objc_expr_last, gen_declaration_1, gen_declarator, is_complex_decl, adorn_decl, define_decl, create_builtin_decl, gen_declspecs): Remove prototypes. (TYPE_ID): Rename to OBJECT_TYPEDEF_NAME. (CLASS_TYPEDEF_NAME): New. (TAG_EXECCLASS): Change from a global variable to a #define. (TAG_RETURN_STRUCT): Delete. (TAG_GNUINIT): New, holds '__objc_gnu_init' name. (objc_inherit_code, objc_public_flag): New, moved from c-parse.in. (string_descriptor): New struct. (string_htab): New hash table. (string_hash, string_eq): New prototypes. (generate_struct_by_value_array): Call create_field_decl() instead of create_builtin_decl(). (objc_init): Do not initialize objc_ellipsis_node or TAG_EXECCLASS; In ObjC++ mode, call cxx_init() instead of c_objc_common_init(). (objc_finish_file): In ObjC++, call instantiate_pending_templates() and cp_finish_file(). (define_decl, get_static_reference, get_protocol_reference, create_builtin_decl): Remove functions. (objc_start_class_interface, objc_start_category_interface, objc_start_protocol, objc_continue_interface, objc_finish_interface, objc_start_class_implementation, objc_start_category_implementation, objc_continue_implementation, objc_finish_implementation, objc_set_visibility, objc_set_method_type, objc_build_method_signature, objc_add_method_declaration, objc_start_method_definition, objc_add_instance_variable, objc_get_protocol_qualified_type, create_field_decl, start_var_decl, finish_var_decl): New functions. (setup_string_decl): Simplify since it is only called once. (synth_module_prologue): Call build_class_template(); predefine 'id' and 'Class' as typedefs; rename 'temp_type' to 'type'; disable debug hooks for duration of function; fix GNU runtime messenger signatures to correspond to reality; forward-declare '__objc_exec_class' for the GNU runtime; call build_selector_table_decl(); in ObjC++ mode, generate 'extern "C" { ... }' wrappers around synthesized declarations; call build_protocol_template() and build_category_template(). (string_hash, string_eq): New functions. (objc_build_string_object): Check metaclass correctness only once; store string literals in hash table. (objc_build_constructor): Do not convert initializer elements; adjust for ObjC++ impedance mismatch. (build_objc_symtab_template): Call create_field_decl() instead of create_builtin_decl(). (init_objc_symtab): Add missing conversion to initializer element. (build_metadata_decl): Call start_var_decl() instead of define_decl(). (generate_objc_symtab_decl): Do not call build_category_template(); call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(). (build_module_descriptor): Call create_field_decl() instead of grokfield(); call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(); always mark module descriptor as used; move GNU runtime-specific functionality to build_module_initializer_routine(). (build_module_initializer_routine): New function, broken off of build_module_descriptor(). (objc_static_init_needed_p, objc_generate_static_init_call): New functions. (generate_static_references, generate_strings, build_selector_translation_table, generate_descriptor_table, generate_ivars_list, generate_dispatch_table, generate_category): Call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(); build a type directly instead of via groktypename(). (build_selector_reference_decl, build_selector_table_decl, build_class_reference_decl, build_protocol_reference, generate_objc_image_info): Call start_var_decl() instead of build_decl(). (build_selector_reference): For GNU runtime, do not call build_selector_reference_decl(). (build_selector, build_typed_selector_reference): Always convert result to the selector type. (add_objc_string): Cast return value to 'char *'. (build_method_prototype_template, build_selector_template, build_method_template): Use actual selector type for fields pointing to selectors. (finish_objc): For GNU runtime, call build_module_initializer_routine() after build_module_descriptor(). (generate_protocol_list, generate_shared_structures): Call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(); build a type directly instead of via groktypename(). (synth_id_with_class_suffix): Return a string. (get_arg_type_list): For instance methods, use the instance type for 'self'; do not call groktypename_in_parm_context(). (build_objc_string_decl): Squash redeclaration errors in ObjC++. (objc_is_class_name): Use OBJC_TYPE_NAME instead of TYPE_NAME; handle RECORD_TYPEs in ObjC as well as ObjC++. (objc_is_id): New function. (objc_is_object_ptr): Return the canonical type node. (objc_get_class_ivars): Simplify using get_class_ivars(). (get_class_ivars): Remove second parameter; create a fresh copy of the ivar list for each call; do not check for existence of super class. (objc_eh_runtime_type): Mark #ifndef OBJCPLUS. (objc_init_exceptions): When using SJLJ-style exceptions, require the use of '-fobjc-exceptions' flag; do not require it for DWARF-style exceptions. (objc_build_exc_ptr, next_sjlj_build_try_catch_finally): Use objc_object_type instead of objc_id_type. (objc_begin_catch_clause): Convert the incoming PARM_DECL into a VAR_DECL before placing it in the appropriate scope; do not call define_decl(); adjust call to c_begin_compound_stmt(); use objc_object_type instead of objc_id_type. (build_next_objc_exception_stuff): Call create_field_decl() instead of create_builtin_decl(); construct type directly instead of calling groktypename(); use OBJC_VOID_AT_END to mark end of function parameters. (build_private_template): Adjust call to get_class_ivars(); build a type directly instead of via groktypename(). (build_protocol_template, build_method_prototype_list_template, build_method_prototype_template, build_category_template, build_selector_template, build_class_template, build_super_template, build_ivar_template, build_ivar_list_template, build_method_list_template, build_method_template): Call create_field_decl() instead of grokfield(). (objc_method_parm_type): Do not call groktypename(). (generate_descriptor_table): Call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(). (generate_method_descriptors, build_protocol_initializer, generate_dispatch_tables, build_category_initializer, build_shared_structure_initializer): Do not call groktypename(). (generate_protocols): Call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(); do not call groktypename(). (error_with_ivar): Remove last parameter. (check_ivars): Do not iterate ovar CLASS_RAW_IVARS lists in addition to CLASS_IVARS lists; adjust calls to error_with_ivar(). (generate_ivar_lists): Convert one of the initializer elements; do not call groktypename(). (get_arg_type_list, start_method_def, gen_method_def): Account for new representation of variable arguments and '...' in Objective-C methods; add Objective-C++ impedance matching code. (is_objc_type_qualifier): Remove function. (adjust_type_for_id_default): Simplify; there is no longer a need to wade through declspecs. (lookup_interface, start_class, continue_class, finish_class, start_method_def, start_protocol, build_method_decl, objc_add_method, add_instance_variable, build_ivar_reference, is_ivar, is_private, get_super_receiver, objc_build_finally_epilogue): Make into static functions. (receiver_is_class_object): Use new IS_CLASS() macro. (objc_build_message_expr): Tweak ObjC++ message argument handling; call objc_finish_message_expr() instead of finish_message_expr(). (finish_message_expr): Rename to objc_finish_message_expr(); use OBJC_TYPE_NAME and OBJC_SET_TYPE_NAME macros instead of TYPE_NAME. call gen_type_name() instead of gen_declaration(); call objc_is_id() instead of using IS_ID and IS_CLASS; Use objc_class_name instead of calling get_identifier("Class"); handle CONVERT_EXPRs in receiver. (build_objc_method_call, warn_with_method): Do not call groktypename(). (build_ivar_reference): Call convert() instead of clobbering in a type. (hash_init): Initialize string_htab hash table. (add_instance_variable): Simplify parameter list; do not call grokfield(); do not populate CLASS_IVARS list. (start_class): Check for the existence of super class, if one was specified. (continue_class): Use CLASS_RAW_IVARS rather than CLASS_IVARS; do not call build_class_template(); adjust call to get_class_ivars(); call build_decl(), pushdecl() and finish_decl() instead of define_decl(). (finish_class): Call build_decl(), pushdecl() and finish_decl() instead of define_decl(). (add_protocols): Use PROTOCOL_BINFO_ELTS for the tree vector size. (start_protocol): Do not call build_protocol_template(); use PROTOCOL_BINFO_ELTS for the tree vector size. (encode_type_qualifiers): Do not handle the 'const' qualifier here. (encode_pointer): Encode 'const char *' as 'r*', for backwards compatibility. (encode_array): Use HOST_WIDE_INT_PRINT_DEC instead of "%ld". (encode_type): Handle the 'const' qualifier here. (objc_parmlist): New global variable, sued by objc_push_parm and objc_get_parm_info(). (objc_push_parm, objc_get_parm_info): New functions. (objc_expr_last): Remove function. (synth_self_and_ucmd_args): For instance methods, use the instance type for 'self'; call objc_push_parm() instead of push_parm_decl(). (start_method_def): Do not call push_scope(), declare_parm_level(), pop_scope(), push_parm_decl(), store_parm_decls() or objc_expr_last(); just use objc_push_parm() and objc_get_parm_info(). (comp_method_with_proto): Remove function. (objc_types_are_equivalent): Strip away indirections before comparing underlying types. (comp_proto_with_proto): Do not call groktypename(); types are no longer in raw declspec format. (objc_start_function): New function. (really_start_method): Call comp_proto_with_proto() instead of comp_method_with_proto(); call objc_start_function() instead of hand-crafting a function declarator. (continue_method_def, objc_expand_function_end): Remove functions. (get_super_receiver): Call objc_get_current_scope() instead of get_current_scope(); reference 'super_class' field (instead of 'class'). (finish_method_def): Rename to objc_finish_method_definition() and add a function decl parameter; move method encoding call from objc_expand_function_end(). (is_complex_decl, adorn_decl, gen_declarator, gen_declspecs, gen_declaration_1): Remove functions. (tmpbuf, RAW_DECLSPEC): Remove. (gen_declaration): Remove second parameter; simplify to deal with TYPE_P nodes instead of raw declspecs. (gen_type_name, gen_type_name_0): New functions. (gen_method_decl): Remove second parameter; call gen_type_name() instead of gen_declaration_1(). (dump_interface): Adjust calls to gen_declaration() and gen_method_decl(); do not allocate a separate string buffer. (init_objc): Allocate a larger string buffer to accommodate dump_interface(); adjust call to build_module_descriptor(); add call to build_module_initializer_routine() for the GNU runtime. (generate_classref_translation_entry): Do not call start_decl(); call finish_var_decl() instead of finish_decl(); call convert() instead of build_c_cast(). * objc-act.h (CLASS_OWN_IVARS): Remove accessor. (CLASS_BINFO_ELTS): Reduce from 6 to 5, now that CLASS_OWN_IVARS is gone. (OCTI_GNU_INIT_DECL, GNU_INIT_decl): New. (OCTI_ELLIPSIS_NODE, objc_ellipsis_node): Remove. (OCTI_ID_ID, id_type, objc_id_id): Rename to OCTI_ID_NAME, objc_object_type and objc_object_name, respectively. (OCTI_CLS_REF, OCTI_CLASS_NAME, objc_class_reference, objc_class_name): New. (IS_CLASS): New macro. (IS_ID, IS_SUPER): Robustify. (OCTI_EXECCLASS_DECL, execclass_decl): New. (finish_file, start_class, continue_class, finish_class, start_method_def, continue_method_def, finish_method_def, start_protocol, finish_protocol, objc_build_throw_stmt, objc_build_try_catch_finally_stmt, objc_build_synchronized_prologue, objc_build_synchronized_epilogue, objc_build_try_prologue, objc_build_try_epilogue, objc_build_catch_stmt, objc_build_catch_epilogue, objc_build_finally_prologue, objc_build_finally_epilogue, is_ivar, is_private, is_public, add_instance_variable, objc_add_method, get_super_receiver, objc_clear_super_receiver, get_class_ivars_from_name, get_class_reference, get_static_reference, get_object_reference, build_message_expr, finish_message_expr, build_selector_expr, build_ivar_reference, build_keyword_decl, build_method_decl, build_protocol_expr, build_objc_string_object, objc_declare_alias, objc_declare_class, objc_declare_protocols, objc_comptypes, objc_check_decl, build_encode_expr): Remove prototypes. (imp_count, cat_count): Make GGC-aware. (OBJC_SET_TYPE_NAME): New macro. From-SVN: r87168
2004-09-08 02:49:44 +02:00
field_decl = create_field_decl (build_pointer_type
(objc_class_template),
"sibling_class");
chainon (field_decl_chain, field_decl);
}
Makefile.in (c-parse.o): Depend on $(C_COMMON_H). [gcc/ChangeLog] 2004-09-07 Ziemowit Laski <zlaski@apple.com> * Makefile.in (c-parse.o): Depend on $(C_COMMON_H). * c-parse.in: Include c-common.h instead of objc-act.h. (ivar_decl_list, ivar_decls, ivar_decl, ivars, ivar_declarator, myparms, myparm): Remove %type declarations. (methodtype, optparms, OBJC_TYPE_QUAL, objc_quals, objc_qual, objc_typename, objc_try_catch_stmt, optellipsis): Add %type declarations. (objc_inherit_code, objc_public_flag): Remove. (typespec_nonreserved_nonattr): Call objc_get_protocol_qualified_type() instead of get_static_reference() and get_protocol_reference(). (stmt_nocomp): Call grokparm() on @catch parameter. (objcdef): Move semantic action to objc_finish_implementation(). (classdef): Move semantic action to objc_start_class_interface(), objc_continue_interface(), objc_finish_interface(), objc_start_class_implementation(), objc_continue_implementation(), objc_start_category_interface() and objc_start_category_implementation(). (protocoldef): Move semantic actions to objc_start_protocol() and objc_finish_interface(). (ivar_decl_list): Remove nonterminal. (visibility_spec): Move semantic actions to objc_set_visibility(). (ivar_decls): Remove assignment to $$. (ivar_decl): Rephrase in terms of component_decl; call objc_add_instance_variable(). (ivars, ivar_declarator): Remove nonterminals. (opt_semi): New nonterminal. (methodtype): Remove semantic actions. (methoddef): Move semantic actions to objc_set_method_type(), objc_start_method_definition() and objc_finish_method_definition(). (methodproto): Move semantic actions to objc_set_method_type() and objc_add_method_declaration(). (methoddecl): Use objc_typename instead of typename; move semantic actions to objc_build_method_signature(). (optarglist, myxdecls, mydecl, myparms, myparm): Remove nonterminals. (optparmlist): Express in terms of optparms and optellipsis. (optparms, optellipsis, objc_qual, objc_quals, objc_typename): New nonterminals. (keyworddecl): Use objc_typename instead of typename. (rid_to_yy): Mark RID_IN, RID_OUT, RID_INOUT, RID_BYCOPY, RID_BYREF and RID_ONEWAY as returning OBJC_TYPE_QUAL to yyparse(). [gcc/objc/ChangeLog] 2004-09-07 Ziemowit Laski <zlaski@apple.com> * Make-lang.in (objc/objc-parse.o): Depend on $(C_COMMON_H) instead of objc/objc-act.h. (objc/objc-act.o): Depend on $(HASHTAB_H). * objc-act.c: Include hashtab.h; in ObjC++ mode, include cp-tree.h and objcp-decl.h instead of c-tree.h. (build_module_descriptor, get_class_ivars, synth_id_with_class_suffix, error_with_ivar, gen_method_decl, gen_declaration, setup_string_decl, build_protocol_template): Adjust prototypes. (build_module_initializer_routine, start_class, continue_class, finish_class, start_method_def, objc_start_function, start_protocol, build_method_decl, objc_add_method, add_instance_variable, build_ivar_reference, is_ivar, is_private, get_super_receiver, build_selector_table_decl, objc_push_parm, objc_get_parm_info, gen_type_name, gen_type_name_0, start_var_decl, finish_var_decl, create_field_decl): New prototypes. (objc_expand_function_end, comp_method_with_proto, objc_expr_last, gen_declaration_1, gen_declarator, is_complex_decl, adorn_decl, define_decl, create_builtin_decl, gen_declspecs): Remove prototypes. (TYPE_ID): Rename to OBJECT_TYPEDEF_NAME. (CLASS_TYPEDEF_NAME): New. (TAG_EXECCLASS): Change from a global variable to a #define. (TAG_RETURN_STRUCT): Delete. (TAG_GNUINIT): New, holds '__objc_gnu_init' name. (objc_inherit_code, objc_public_flag): New, moved from c-parse.in. (string_descriptor): New struct. (string_htab): New hash table. (string_hash, string_eq): New prototypes. (generate_struct_by_value_array): Call create_field_decl() instead of create_builtin_decl(). (objc_init): Do not initialize objc_ellipsis_node or TAG_EXECCLASS; In ObjC++ mode, call cxx_init() instead of c_objc_common_init(). (objc_finish_file): In ObjC++, call instantiate_pending_templates() and cp_finish_file(). (define_decl, get_static_reference, get_protocol_reference, create_builtin_decl): Remove functions. (objc_start_class_interface, objc_start_category_interface, objc_start_protocol, objc_continue_interface, objc_finish_interface, objc_start_class_implementation, objc_start_category_implementation, objc_continue_implementation, objc_finish_implementation, objc_set_visibility, objc_set_method_type, objc_build_method_signature, objc_add_method_declaration, objc_start_method_definition, objc_add_instance_variable, objc_get_protocol_qualified_type, create_field_decl, start_var_decl, finish_var_decl): New functions. (setup_string_decl): Simplify since it is only called once. (synth_module_prologue): Call build_class_template(); predefine 'id' and 'Class' as typedefs; rename 'temp_type' to 'type'; disable debug hooks for duration of function; fix GNU runtime messenger signatures to correspond to reality; forward-declare '__objc_exec_class' for the GNU runtime; call build_selector_table_decl(); in ObjC++ mode, generate 'extern "C" { ... }' wrappers around synthesized declarations; call build_protocol_template() and build_category_template(). (string_hash, string_eq): New functions. (objc_build_string_object): Check metaclass correctness only once; store string literals in hash table. (objc_build_constructor): Do not convert initializer elements; adjust for ObjC++ impedance mismatch. (build_objc_symtab_template): Call create_field_decl() instead of create_builtin_decl(). (init_objc_symtab): Add missing conversion to initializer element. (build_metadata_decl): Call start_var_decl() instead of define_decl(). (generate_objc_symtab_decl): Do not call build_category_template(); call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(). (build_module_descriptor): Call create_field_decl() instead of grokfield(); call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(); always mark module descriptor as used; move GNU runtime-specific functionality to build_module_initializer_routine(). (build_module_initializer_routine): New function, broken off of build_module_descriptor(). (objc_static_init_needed_p, objc_generate_static_init_call): New functions. (generate_static_references, generate_strings, build_selector_translation_table, generate_descriptor_table, generate_ivars_list, generate_dispatch_table, generate_category): Call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(); build a type directly instead of via groktypename(). (build_selector_reference_decl, build_selector_table_decl, build_class_reference_decl, build_protocol_reference, generate_objc_image_info): Call start_var_decl() instead of build_decl(). (build_selector_reference): For GNU runtime, do not call build_selector_reference_decl(). (build_selector, build_typed_selector_reference): Always convert result to the selector type. (add_objc_string): Cast return value to 'char *'. (build_method_prototype_template, build_selector_template, build_method_template): Use actual selector type for fields pointing to selectors. (finish_objc): For GNU runtime, call build_module_initializer_routine() after build_module_descriptor(). (generate_protocol_list, generate_shared_structures): Call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(); build a type directly instead of via groktypename(). (synth_id_with_class_suffix): Return a string. (get_arg_type_list): For instance methods, use the instance type for 'self'; do not call groktypename_in_parm_context(). (build_objc_string_decl): Squash redeclaration errors in ObjC++. (objc_is_class_name): Use OBJC_TYPE_NAME instead of TYPE_NAME; handle RECORD_TYPEs in ObjC as well as ObjC++. (objc_is_id): New function. (objc_is_object_ptr): Return the canonical type node. (objc_get_class_ivars): Simplify using get_class_ivars(). (get_class_ivars): Remove second parameter; create a fresh copy of the ivar list for each call; do not check for existence of super class. (objc_eh_runtime_type): Mark #ifndef OBJCPLUS. (objc_init_exceptions): When using SJLJ-style exceptions, require the use of '-fobjc-exceptions' flag; do not require it for DWARF-style exceptions. (objc_build_exc_ptr, next_sjlj_build_try_catch_finally): Use objc_object_type instead of objc_id_type. (objc_begin_catch_clause): Convert the incoming PARM_DECL into a VAR_DECL before placing it in the appropriate scope; do not call define_decl(); adjust call to c_begin_compound_stmt(); use objc_object_type instead of objc_id_type. (build_next_objc_exception_stuff): Call create_field_decl() instead of create_builtin_decl(); construct type directly instead of calling groktypename(); use OBJC_VOID_AT_END to mark end of function parameters. (build_private_template): Adjust call to get_class_ivars(); build a type directly instead of via groktypename(). (build_protocol_template, build_method_prototype_list_template, build_method_prototype_template, build_category_template, build_selector_template, build_class_template, build_super_template, build_ivar_template, build_ivar_list_template, build_method_list_template, build_method_template): Call create_field_decl() instead of grokfield(). (objc_method_parm_type): Do not call groktypename(). (generate_descriptor_table): Call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(). (generate_method_descriptors, build_protocol_initializer, generate_dispatch_tables, build_category_initializer, build_shared_structure_initializer): Do not call groktypename(). (generate_protocols): Call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(); do not call groktypename(). (error_with_ivar): Remove last parameter. (check_ivars): Do not iterate ovar CLASS_RAW_IVARS lists in addition to CLASS_IVARS lists; adjust calls to error_with_ivar(). (generate_ivar_lists): Convert one of the initializer elements; do not call groktypename(). (get_arg_type_list, start_method_def, gen_method_def): Account for new representation of variable arguments and '...' in Objective-C methods; add Objective-C++ impedance matching code. (is_objc_type_qualifier): Remove function. (adjust_type_for_id_default): Simplify; there is no longer a need to wade through declspecs. (lookup_interface, start_class, continue_class, finish_class, start_method_def, start_protocol, build_method_decl, objc_add_method, add_instance_variable, build_ivar_reference, is_ivar, is_private, get_super_receiver, objc_build_finally_epilogue): Make into static functions. (receiver_is_class_object): Use new IS_CLASS() macro. (objc_build_message_expr): Tweak ObjC++ message argument handling; call objc_finish_message_expr() instead of finish_message_expr(). (finish_message_expr): Rename to objc_finish_message_expr(); use OBJC_TYPE_NAME and OBJC_SET_TYPE_NAME macros instead of TYPE_NAME. call gen_type_name() instead of gen_declaration(); call objc_is_id() instead of using IS_ID and IS_CLASS; Use objc_class_name instead of calling get_identifier("Class"); handle CONVERT_EXPRs in receiver. (build_objc_method_call, warn_with_method): Do not call groktypename(). (build_ivar_reference): Call convert() instead of clobbering in a type. (hash_init): Initialize string_htab hash table. (add_instance_variable): Simplify parameter list; do not call grokfield(); do not populate CLASS_IVARS list. (start_class): Check for the existence of super class, if one was specified. (continue_class): Use CLASS_RAW_IVARS rather than CLASS_IVARS; do not call build_class_template(); adjust call to get_class_ivars(); call build_decl(), pushdecl() and finish_decl() instead of define_decl(). (finish_class): Call build_decl(), pushdecl() and finish_decl() instead of define_decl(). (add_protocols): Use PROTOCOL_BINFO_ELTS for the tree vector size. (start_protocol): Do not call build_protocol_template(); use PROTOCOL_BINFO_ELTS for the tree vector size. (encode_type_qualifiers): Do not handle the 'const' qualifier here. (encode_pointer): Encode 'const char *' as 'r*', for backwards compatibility. (encode_array): Use HOST_WIDE_INT_PRINT_DEC instead of "%ld". (encode_type): Handle the 'const' qualifier here. (objc_parmlist): New global variable, sued by objc_push_parm and objc_get_parm_info(). (objc_push_parm, objc_get_parm_info): New functions. (objc_expr_last): Remove function. (synth_self_and_ucmd_args): For instance methods, use the instance type for 'self'; call objc_push_parm() instead of push_parm_decl(). (start_method_def): Do not call push_scope(), declare_parm_level(), pop_scope(), push_parm_decl(), store_parm_decls() or objc_expr_last(); just use objc_push_parm() and objc_get_parm_info(). (comp_method_with_proto): Remove function. (objc_types_are_equivalent): Strip away indirections before comparing underlying types. (comp_proto_with_proto): Do not call groktypename(); types are no longer in raw declspec format. (objc_start_function): New function. (really_start_method): Call comp_proto_with_proto() instead of comp_method_with_proto(); call objc_start_function() instead of hand-crafting a function declarator. (continue_method_def, objc_expand_function_end): Remove functions. (get_super_receiver): Call objc_get_current_scope() instead of get_current_scope(); reference 'super_class' field (instead of 'class'). (finish_method_def): Rename to objc_finish_method_definition() and add a function decl parameter; move method encoding call from objc_expand_function_end(). (is_complex_decl, adorn_decl, gen_declarator, gen_declspecs, gen_declaration_1): Remove functions. (tmpbuf, RAW_DECLSPEC): Remove. (gen_declaration): Remove second parameter; simplify to deal with TYPE_P nodes instead of raw declspecs. (gen_type_name, gen_type_name_0): New functions. (gen_method_decl): Remove second parameter; call gen_type_name() instead of gen_declaration_1(). (dump_interface): Adjust calls to gen_declaration() and gen_method_decl(); do not allocate a separate string buffer. (init_objc): Allocate a larger string buffer to accommodate dump_interface(); adjust call to build_module_descriptor(); add call to build_module_initializer_routine() for the GNU runtime. (generate_classref_translation_entry): Do not call start_decl(); call finish_var_decl() instead of finish_decl(); call convert() instead of build_c_cast(). * objc-act.h (CLASS_OWN_IVARS): Remove accessor. (CLASS_BINFO_ELTS): Reduce from 6 to 5, now that CLASS_OWN_IVARS is gone. (OCTI_GNU_INIT_DECL, GNU_INIT_decl): New. (OCTI_ELLIPSIS_NODE, objc_ellipsis_node): Remove. (OCTI_ID_ID, id_type, objc_id_id): Rename to OCTI_ID_NAME, objc_object_type and objc_object_name, respectively. (OCTI_CLS_REF, OCTI_CLASS_NAME, objc_class_reference, objc_class_name): New. (IS_CLASS): New macro. (IS_ID, IS_SUPER): Robustify. (OCTI_EXECCLASS_DECL, execclass_decl): New. (finish_file, start_class, continue_class, finish_class, start_method_def, continue_method_def, finish_method_def, start_protocol, finish_protocol, objc_build_throw_stmt, objc_build_try_catch_finally_stmt, objc_build_synchronized_prologue, objc_build_synchronized_epilogue, objc_build_try_prologue, objc_build_try_epilogue, objc_build_catch_stmt, objc_build_catch_epilogue, objc_build_finally_prologue, objc_build_finally_epilogue, is_ivar, is_private, is_public, add_instance_variable, objc_add_method, get_super_receiver, objc_clear_super_receiver, get_class_ivars_from_name, get_class_reference, get_static_reference, get_object_reference, build_message_expr, finish_message_expr, build_selector_expr, build_ivar_reference, build_keyword_decl, build_method_decl, build_protocol_expr, build_objc_string_object, objc_declare_alias, objc_declare_class, objc_declare_protocols, objc_comptypes, objc_check_decl, build_encode_expr): Remove prototypes. (imp_count, cat_count): Make GGC-aware. (OBJC_SET_TYPE_NAME): New macro. From-SVN: r87168
2004-09-08 02:49:44 +02:00
/* struct _objc_protocol **protocol_list; */
field_decl = create_field_decl (build_pointer_type
(build_pointer_type
(xref_tag (RECORD_TYPE,
get_identifier
(UTAG_PROTOCOL)))),
"protocol_list");
1992-01-18 00:15:38 +01:00
chainon (field_decl_chain, field_decl);
if (flag_next_runtime)
{
/* void *sel_id; */
Makefile.in (c-parse.o): Depend on $(C_COMMON_H). [gcc/ChangeLog] 2004-09-07 Ziemowit Laski <zlaski@apple.com> * Makefile.in (c-parse.o): Depend on $(C_COMMON_H). * c-parse.in: Include c-common.h instead of objc-act.h. (ivar_decl_list, ivar_decls, ivar_decl, ivars, ivar_declarator, myparms, myparm): Remove %type declarations. (methodtype, optparms, OBJC_TYPE_QUAL, objc_quals, objc_qual, objc_typename, objc_try_catch_stmt, optellipsis): Add %type declarations. (objc_inherit_code, objc_public_flag): Remove. (typespec_nonreserved_nonattr): Call objc_get_protocol_qualified_type() instead of get_static_reference() and get_protocol_reference(). (stmt_nocomp): Call grokparm() on @catch parameter. (objcdef): Move semantic action to objc_finish_implementation(). (classdef): Move semantic action to objc_start_class_interface(), objc_continue_interface(), objc_finish_interface(), objc_start_class_implementation(), objc_continue_implementation(), objc_start_category_interface() and objc_start_category_implementation(). (protocoldef): Move semantic actions to objc_start_protocol() and objc_finish_interface(). (ivar_decl_list): Remove nonterminal. (visibility_spec): Move semantic actions to objc_set_visibility(). (ivar_decls): Remove assignment to $$. (ivar_decl): Rephrase in terms of component_decl; call objc_add_instance_variable(). (ivars, ivar_declarator): Remove nonterminals. (opt_semi): New nonterminal. (methodtype): Remove semantic actions. (methoddef): Move semantic actions to objc_set_method_type(), objc_start_method_definition() and objc_finish_method_definition(). (methodproto): Move semantic actions to objc_set_method_type() and objc_add_method_declaration(). (methoddecl): Use objc_typename instead of typename; move semantic actions to objc_build_method_signature(). (optarglist, myxdecls, mydecl, myparms, myparm): Remove nonterminals. (optparmlist): Express in terms of optparms and optellipsis. (optparms, optellipsis, objc_qual, objc_quals, objc_typename): New nonterminals. (keyworddecl): Use objc_typename instead of typename. (rid_to_yy): Mark RID_IN, RID_OUT, RID_INOUT, RID_BYCOPY, RID_BYREF and RID_ONEWAY as returning OBJC_TYPE_QUAL to yyparse(). [gcc/objc/ChangeLog] 2004-09-07 Ziemowit Laski <zlaski@apple.com> * Make-lang.in (objc/objc-parse.o): Depend on $(C_COMMON_H) instead of objc/objc-act.h. (objc/objc-act.o): Depend on $(HASHTAB_H). * objc-act.c: Include hashtab.h; in ObjC++ mode, include cp-tree.h and objcp-decl.h instead of c-tree.h. (build_module_descriptor, get_class_ivars, synth_id_with_class_suffix, error_with_ivar, gen_method_decl, gen_declaration, setup_string_decl, build_protocol_template): Adjust prototypes. (build_module_initializer_routine, start_class, continue_class, finish_class, start_method_def, objc_start_function, start_protocol, build_method_decl, objc_add_method, add_instance_variable, build_ivar_reference, is_ivar, is_private, get_super_receiver, build_selector_table_decl, objc_push_parm, objc_get_parm_info, gen_type_name, gen_type_name_0, start_var_decl, finish_var_decl, create_field_decl): New prototypes. (objc_expand_function_end, comp_method_with_proto, objc_expr_last, gen_declaration_1, gen_declarator, is_complex_decl, adorn_decl, define_decl, create_builtin_decl, gen_declspecs): Remove prototypes. (TYPE_ID): Rename to OBJECT_TYPEDEF_NAME. (CLASS_TYPEDEF_NAME): New. (TAG_EXECCLASS): Change from a global variable to a #define. (TAG_RETURN_STRUCT): Delete. (TAG_GNUINIT): New, holds '__objc_gnu_init' name. (objc_inherit_code, objc_public_flag): New, moved from c-parse.in. (string_descriptor): New struct. (string_htab): New hash table. (string_hash, string_eq): New prototypes. (generate_struct_by_value_array): Call create_field_decl() instead of create_builtin_decl(). (objc_init): Do not initialize objc_ellipsis_node or TAG_EXECCLASS; In ObjC++ mode, call cxx_init() instead of c_objc_common_init(). (objc_finish_file): In ObjC++, call instantiate_pending_templates() and cp_finish_file(). (define_decl, get_static_reference, get_protocol_reference, create_builtin_decl): Remove functions. (objc_start_class_interface, objc_start_category_interface, objc_start_protocol, objc_continue_interface, objc_finish_interface, objc_start_class_implementation, objc_start_category_implementation, objc_continue_implementation, objc_finish_implementation, objc_set_visibility, objc_set_method_type, objc_build_method_signature, objc_add_method_declaration, objc_start_method_definition, objc_add_instance_variable, objc_get_protocol_qualified_type, create_field_decl, start_var_decl, finish_var_decl): New functions. (setup_string_decl): Simplify since it is only called once. (synth_module_prologue): Call build_class_template(); predefine 'id' and 'Class' as typedefs; rename 'temp_type' to 'type'; disable debug hooks for duration of function; fix GNU runtime messenger signatures to correspond to reality; forward-declare '__objc_exec_class' for the GNU runtime; call build_selector_table_decl(); in ObjC++ mode, generate 'extern "C" { ... }' wrappers around synthesized declarations; call build_protocol_template() and build_category_template(). (string_hash, string_eq): New functions. (objc_build_string_object): Check metaclass correctness only once; store string literals in hash table. (objc_build_constructor): Do not convert initializer elements; adjust for ObjC++ impedance mismatch. (build_objc_symtab_template): Call create_field_decl() instead of create_builtin_decl(). (init_objc_symtab): Add missing conversion to initializer element. (build_metadata_decl): Call start_var_decl() instead of define_decl(). (generate_objc_symtab_decl): Do not call build_category_template(); call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(). (build_module_descriptor): Call create_field_decl() instead of grokfield(); call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(); always mark module descriptor as used; move GNU runtime-specific functionality to build_module_initializer_routine(). (build_module_initializer_routine): New function, broken off of build_module_descriptor(). (objc_static_init_needed_p, objc_generate_static_init_call): New functions. (generate_static_references, generate_strings, build_selector_translation_table, generate_descriptor_table, generate_ivars_list, generate_dispatch_table, generate_category): Call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(); build a type directly instead of via groktypename(). (build_selector_reference_decl, build_selector_table_decl, build_class_reference_decl, build_protocol_reference, generate_objc_image_info): Call start_var_decl() instead of build_decl(). (build_selector_reference): For GNU runtime, do not call build_selector_reference_decl(). (build_selector, build_typed_selector_reference): Always convert result to the selector type. (add_objc_string): Cast return value to 'char *'. (build_method_prototype_template, build_selector_template, build_method_template): Use actual selector type for fields pointing to selectors. (finish_objc): For GNU runtime, call build_module_initializer_routine() after build_module_descriptor(). (generate_protocol_list, generate_shared_structures): Call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(); build a type directly instead of via groktypename(). (synth_id_with_class_suffix): Return a string. (get_arg_type_list): For instance methods, use the instance type for 'self'; do not call groktypename_in_parm_context(). (build_objc_string_decl): Squash redeclaration errors in ObjC++. (objc_is_class_name): Use OBJC_TYPE_NAME instead of TYPE_NAME; handle RECORD_TYPEs in ObjC as well as ObjC++. (objc_is_id): New function. (objc_is_object_ptr): Return the canonical type node. (objc_get_class_ivars): Simplify using get_class_ivars(). (get_class_ivars): Remove second parameter; create a fresh copy of the ivar list for each call; do not check for existence of super class. (objc_eh_runtime_type): Mark #ifndef OBJCPLUS. (objc_init_exceptions): When using SJLJ-style exceptions, require the use of '-fobjc-exceptions' flag; do not require it for DWARF-style exceptions. (objc_build_exc_ptr, next_sjlj_build_try_catch_finally): Use objc_object_type instead of objc_id_type. (objc_begin_catch_clause): Convert the incoming PARM_DECL into a VAR_DECL before placing it in the appropriate scope; do not call define_decl(); adjust call to c_begin_compound_stmt(); use objc_object_type instead of objc_id_type. (build_next_objc_exception_stuff): Call create_field_decl() instead of create_builtin_decl(); construct type directly instead of calling groktypename(); use OBJC_VOID_AT_END to mark end of function parameters. (build_private_template): Adjust call to get_class_ivars(); build a type directly instead of via groktypename(). (build_protocol_template, build_method_prototype_list_template, build_method_prototype_template, build_category_template, build_selector_template, build_class_template, build_super_template, build_ivar_template, build_ivar_list_template, build_method_list_template, build_method_template): Call create_field_decl() instead of grokfield(). (objc_method_parm_type): Do not call groktypename(). (generate_descriptor_table): Call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(). (generate_method_descriptors, build_protocol_initializer, generate_dispatch_tables, build_category_initializer, build_shared_structure_initializer): Do not call groktypename(). (generate_protocols): Call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(); do not call groktypename(). (error_with_ivar): Remove last parameter. (check_ivars): Do not iterate ovar CLASS_RAW_IVARS lists in addition to CLASS_IVARS lists; adjust calls to error_with_ivar(). (generate_ivar_lists): Convert one of the initializer elements; do not call groktypename(). (get_arg_type_list, start_method_def, gen_method_def): Account for new representation of variable arguments and '...' in Objective-C methods; add Objective-C++ impedance matching code. (is_objc_type_qualifier): Remove function. (adjust_type_for_id_default): Simplify; there is no longer a need to wade through declspecs. (lookup_interface, start_class, continue_class, finish_class, start_method_def, start_protocol, build_method_decl, objc_add_method, add_instance_variable, build_ivar_reference, is_ivar, is_private, get_super_receiver, objc_build_finally_epilogue): Make into static functions. (receiver_is_class_object): Use new IS_CLASS() macro. (objc_build_message_expr): Tweak ObjC++ message argument handling; call objc_finish_message_expr() instead of finish_message_expr(). (finish_message_expr): Rename to objc_finish_message_expr(); use OBJC_TYPE_NAME and OBJC_SET_TYPE_NAME macros instead of TYPE_NAME. call gen_type_name() instead of gen_declaration(); call objc_is_id() instead of using IS_ID and IS_CLASS; Use objc_class_name instead of calling get_identifier("Class"); handle CONVERT_EXPRs in receiver. (build_objc_method_call, warn_with_method): Do not call groktypename(). (build_ivar_reference): Call convert() instead of clobbering in a type. (hash_init): Initialize string_htab hash table. (add_instance_variable): Simplify parameter list; do not call grokfield(); do not populate CLASS_IVARS list. (start_class): Check for the existence of super class, if one was specified. (continue_class): Use CLASS_RAW_IVARS rather than CLASS_IVARS; do not call build_class_template(); adjust call to get_class_ivars(); call build_decl(), pushdecl() and finish_decl() instead of define_decl(). (finish_class): Call build_decl(), pushdecl() and finish_decl() instead of define_decl(). (add_protocols): Use PROTOCOL_BINFO_ELTS for the tree vector size. (start_protocol): Do not call build_protocol_template(); use PROTOCOL_BINFO_ELTS for the tree vector size. (encode_type_qualifiers): Do not handle the 'const' qualifier here. (encode_pointer): Encode 'const char *' as 'r*', for backwards compatibility. (encode_array): Use HOST_WIDE_INT_PRINT_DEC instead of "%ld". (encode_type): Handle the 'const' qualifier here. (objc_parmlist): New global variable, sued by objc_push_parm and objc_get_parm_info(). (objc_push_parm, objc_get_parm_info): New functions. (objc_expr_last): Remove function. (synth_self_and_ucmd_args): For instance methods, use the instance type for 'self'; call objc_push_parm() instead of push_parm_decl(). (start_method_def): Do not call push_scope(), declare_parm_level(), pop_scope(), push_parm_decl(), store_parm_decls() or objc_expr_last(); just use objc_push_parm() and objc_get_parm_info(). (comp_method_with_proto): Remove function. (objc_types_are_equivalent): Strip away indirections before comparing underlying types. (comp_proto_with_proto): Do not call groktypename(); types are no longer in raw declspec format. (objc_start_function): New function. (really_start_method): Call comp_proto_with_proto() instead of comp_method_with_proto(); call objc_start_function() instead of hand-crafting a function declarator. (continue_method_def, objc_expand_function_end): Remove functions. (get_super_receiver): Call objc_get_current_scope() instead of get_current_scope(); reference 'super_class' field (instead of 'class'). (finish_method_def): Rename to objc_finish_method_definition() and add a function decl parameter; move method encoding call from objc_expand_function_end(). (is_complex_decl, adorn_decl, gen_declarator, gen_declspecs, gen_declaration_1): Remove functions. (tmpbuf, RAW_DECLSPEC): Remove. (gen_declaration): Remove second parameter; simplify to deal with TYPE_P nodes instead of raw declspecs. (gen_type_name, gen_type_name_0): New functions. (gen_method_decl): Remove second parameter; call gen_type_name() instead of gen_declaration_1(). (dump_interface): Adjust calls to gen_declaration() and gen_method_decl(); do not allocate a separate string buffer. (init_objc): Allocate a larger string buffer to accommodate dump_interface(); adjust call to build_module_descriptor(); add call to build_module_initializer_routine() for the GNU runtime. (generate_classref_translation_entry): Do not call start_decl(); call finish_var_decl() instead of finish_decl(); call convert() instead of build_c_cast(). * objc-act.h (CLASS_OWN_IVARS): Remove accessor. (CLASS_BINFO_ELTS): Reduce from 6 to 5, now that CLASS_OWN_IVARS is gone. (OCTI_GNU_INIT_DECL, GNU_INIT_decl): New. (OCTI_ELLIPSIS_NODE, objc_ellipsis_node): Remove. (OCTI_ID_ID, id_type, objc_id_id): Rename to OCTI_ID_NAME, objc_object_type and objc_object_name, respectively. (OCTI_CLS_REF, OCTI_CLASS_NAME, objc_class_reference, objc_class_name): New. (IS_CLASS): New macro. (IS_ID, IS_SUPER): Robustify. (OCTI_EXECCLASS_DECL, execclass_decl): New. (finish_file, start_class, continue_class, finish_class, start_method_def, continue_method_def, finish_method_def, start_protocol, finish_protocol, objc_build_throw_stmt, objc_build_try_catch_finally_stmt, objc_build_synchronized_prologue, objc_build_synchronized_epilogue, objc_build_try_prologue, objc_build_try_epilogue, objc_build_catch_stmt, objc_build_catch_epilogue, objc_build_finally_prologue, objc_build_finally_epilogue, is_ivar, is_private, is_public, add_instance_variable, objc_add_method, get_super_receiver, objc_clear_super_receiver, get_class_ivars_from_name, get_class_reference, get_static_reference, get_object_reference, build_message_expr, finish_message_expr, build_selector_expr, build_ivar_reference, build_keyword_decl, build_method_decl, build_protocol_expr, build_objc_string_object, objc_declare_alias, objc_declare_class, objc_declare_protocols, objc_comptypes, objc_check_decl, build_encode_expr): Remove prototypes. (imp_count, cat_count): Make GGC-aware. (OBJC_SET_TYPE_NAME): New macro. From-SVN: r87168
2004-09-08 02:49:44 +02:00
field_decl = create_field_decl (build_pointer_type (void_type_node),
"sel_id");
chainon (field_decl_chain, field_decl);
}
/* void *gc_object_type; */
Makefile.in (c-parse.o): Depend on $(C_COMMON_H). [gcc/ChangeLog] 2004-09-07 Ziemowit Laski <zlaski@apple.com> * Makefile.in (c-parse.o): Depend on $(C_COMMON_H). * c-parse.in: Include c-common.h instead of objc-act.h. (ivar_decl_list, ivar_decls, ivar_decl, ivars, ivar_declarator, myparms, myparm): Remove %type declarations. (methodtype, optparms, OBJC_TYPE_QUAL, objc_quals, objc_qual, objc_typename, objc_try_catch_stmt, optellipsis): Add %type declarations. (objc_inherit_code, objc_public_flag): Remove. (typespec_nonreserved_nonattr): Call objc_get_protocol_qualified_type() instead of get_static_reference() and get_protocol_reference(). (stmt_nocomp): Call grokparm() on @catch parameter. (objcdef): Move semantic action to objc_finish_implementation(). (classdef): Move semantic action to objc_start_class_interface(), objc_continue_interface(), objc_finish_interface(), objc_start_class_implementation(), objc_continue_implementation(), objc_start_category_interface() and objc_start_category_implementation(). (protocoldef): Move semantic actions to objc_start_protocol() and objc_finish_interface(). (ivar_decl_list): Remove nonterminal. (visibility_spec): Move semantic actions to objc_set_visibility(). (ivar_decls): Remove assignment to $$. (ivar_decl): Rephrase in terms of component_decl; call objc_add_instance_variable(). (ivars, ivar_declarator): Remove nonterminals. (opt_semi): New nonterminal. (methodtype): Remove semantic actions. (methoddef): Move semantic actions to objc_set_method_type(), objc_start_method_definition() and objc_finish_method_definition(). (methodproto): Move semantic actions to objc_set_method_type() and objc_add_method_declaration(). (methoddecl): Use objc_typename instead of typename; move semantic actions to objc_build_method_signature(). (optarglist, myxdecls, mydecl, myparms, myparm): Remove nonterminals. (optparmlist): Express in terms of optparms and optellipsis. (optparms, optellipsis, objc_qual, objc_quals, objc_typename): New nonterminals. (keyworddecl): Use objc_typename instead of typename. (rid_to_yy): Mark RID_IN, RID_OUT, RID_INOUT, RID_BYCOPY, RID_BYREF and RID_ONEWAY as returning OBJC_TYPE_QUAL to yyparse(). [gcc/objc/ChangeLog] 2004-09-07 Ziemowit Laski <zlaski@apple.com> * Make-lang.in (objc/objc-parse.o): Depend on $(C_COMMON_H) instead of objc/objc-act.h. (objc/objc-act.o): Depend on $(HASHTAB_H). * objc-act.c: Include hashtab.h; in ObjC++ mode, include cp-tree.h and objcp-decl.h instead of c-tree.h. (build_module_descriptor, get_class_ivars, synth_id_with_class_suffix, error_with_ivar, gen_method_decl, gen_declaration, setup_string_decl, build_protocol_template): Adjust prototypes. (build_module_initializer_routine, start_class, continue_class, finish_class, start_method_def, objc_start_function, start_protocol, build_method_decl, objc_add_method, add_instance_variable, build_ivar_reference, is_ivar, is_private, get_super_receiver, build_selector_table_decl, objc_push_parm, objc_get_parm_info, gen_type_name, gen_type_name_0, start_var_decl, finish_var_decl, create_field_decl): New prototypes. (objc_expand_function_end, comp_method_with_proto, objc_expr_last, gen_declaration_1, gen_declarator, is_complex_decl, adorn_decl, define_decl, create_builtin_decl, gen_declspecs): Remove prototypes. (TYPE_ID): Rename to OBJECT_TYPEDEF_NAME. (CLASS_TYPEDEF_NAME): New. (TAG_EXECCLASS): Change from a global variable to a #define. (TAG_RETURN_STRUCT): Delete. (TAG_GNUINIT): New, holds '__objc_gnu_init' name. (objc_inherit_code, objc_public_flag): New, moved from c-parse.in. (string_descriptor): New struct. (string_htab): New hash table. (string_hash, string_eq): New prototypes. (generate_struct_by_value_array): Call create_field_decl() instead of create_builtin_decl(). (objc_init): Do not initialize objc_ellipsis_node or TAG_EXECCLASS; In ObjC++ mode, call cxx_init() instead of c_objc_common_init(). (objc_finish_file): In ObjC++, call instantiate_pending_templates() and cp_finish_file(). (define_decl, get_static_reference, get_protocol_reference, create_builtin_decl): Remove functions. (objc_start_class_interface, objc_start_category_interface, objc_start_protocol, objc_continue_interface, objc_finish_interface, objc_start_class_implementation, objc_start_category_implementation, objc_continue_implementation, objc_finish_implementation, objc_set_visibility, objc_set_method_type, objc_build_method_signature, objc_add_method_declaration, objc_start_method_definition, objc_add_instance_variable, objc_get_protocol_qualified_type, create_field_decl, start_var_decl, finish_var_decl): New functions. (setup_string_decl): Simplify since it is only called once. (synth_module_prologue): Call build_class_template(); predefine 'id' and 'Class' as typedefs; rename 'temp_type' to 'type'; disable debug hooks for duration of function; fix GNU runtime messenger signatures to correspond to reality; forward-declare '__objc_exec_class' for the GNU runtime; call build_selector_table_decl(); in ObjC++ mode, generate 'extern "C" { ... }' wrappers around synthesized declarations; call build_protocol_template() and build_category_template(). (string_hash, string_eq): New functions. (objc_build_string_object): Check metaclass correctness only once; store string literals in hash table. (objc_build_constructor): Do not convert initializer elements; adjust for ObjC++ impedance mismatch. (build_objc_symtab_template): Call create_field_decl() instead of create_builtin_decl(). (init_objc_symtab): Add missing conversion to initializer element. (build_metadata_decl): Call start_var_decl() instead of define_decl(). (generate_objc_symtab_decl): Do not call build_category_template(); call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(). (build_module_descriptor): Call create_field_decl() instead of grokfield(); call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(); always mark module descriptor as used; move GNU runtime-specific functionality to build_module_initializer_routine(). (build_module_initializer_routine): New function, broken off of build_module_descriptor(). (objc_static_init_needed_p, objc_generate_static_init_call): New functions. (generate_static_references, generate_strings, build_selector_translation_table, generate_descriptor_table, generate_ivars_list, generate_dispatch_table, generate_category): Call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(); build a type directly instead of via groktypename(). (build_selector_reference_decl, build_selector_table_decl, build_class_reference_decl, build_protocol_reference, generate_objc_image_info): Call start_var_decl() instead of build_decl(). (build_selector_reference): For GNU runtime, do not call build_selector_reference_decl(). (build_selector, build_typed_selector_reference): Always convert result to the selector type. (add_objc_string): Cast return value to 'char *'. (build_method_prototype_template, build_selector_template, build_method_template): Use actual selector type for fields pointing to selectors. (finish_objc): For GNU runtime, call build_module_initializer_routine() after build_module_descriptor(). (generate_protocol_list, generate_shared_structures): Call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(); build a type directly instead of via groktypename(). (synth_id_with_class_suffix): Return a string. (get_arg_type_list): For instance methods, use the instance type for 'self'; do not call groktypename_in_parm_context(). (build_objc_string_decl): Squash redeclaration errors in ObjC++. (objc_is_class_name): Use OBJC_TYPE_NAME instead of TYPE_NAME; handle RECORD_TYPEs in ObjC as well as ObjC++. (objc_is_id): New function. (objc_is_object_ptr): Return the canonical type node. (objc_get_class_ivars): Simplify using get_class_ivars(). (get_class_ivars): Remove second parameter; create a fresh copy of the ivar list for each call; do not check for existence of super class. (objc_eh_runtime_type): Mark #ifndef OBJCPLUS. (objc_init_exceptions): When using SJLJ-style exceptions, require the use of '-fobjc-exceptions' flag; do not require it for DWARF-style exceptions. (objc_build_exc_ptr, next_sjlj_build_try_catch_finally): Use objc_object_type instead of objc_id_type. (objc_begin_catch_clause): Convert the incoming PARM_DECL into a VAR_DECL before placing it in the appropriate scope; do not call define_decl(); adjust call to c_begin_compound_stmt(); use objc_object_type instead of objc_id_type. (build_next_objc_exception_stuff): Call create_field_decl() instead of create_builtin_decl(); construct type directly instead of calling groktypename(); use OBJC_VOID_AT_END to mark end of function parameters. (build_private_template): Adjust call to get_class_ivars(); build a type directly instead of via groktypename(). (build_protocol_template, build_method_prototype_list_template, build_method_prototype_template, build_category_template, build_selector_template, build_class_template, build_super_template, build_ivar_template, build_ivar_list_template, build_method_list_template, build_method_template): Call create_field_decl() instead of grokfield(). (objc_method_parm_type): Do not call groktypename(). (generate_descriptor_table): Call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(). (generate_method_descriptors, build_protocol_initializer, generate_dispatch_tables, build_category_initializer, build_shared_structure_initializer): Do not call groktypename(). (generate_protocols): Call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(); do not call groktypename(). (error_with_ivar): Remove last parameter. (check_ivars): Do not iterate ovar CLASS_RAW_IVARS lists in addition to CLASS_IVARS lists; adjust calls to error_with_ivar(). (generate_ivar_lists): Convert one of the initializer elements; do not call groktypename(). (get_arg_type_list, start_method_def, gen_method_def): Account for new representation of variable arguments and '...' in Objective-C methods; add Objective-C++ impedance matching code. (is_objc_type_qualifier): Remove function. (adjust_type_for_id_default): Simplify; there is no longer a need to wade through declspecs. (lookup_interface, start_class, continue_class, finish_class, start_method_def, start_protocol, build_method_decl, objc_add_method, add_instance_variable, build_ivar_reference, is_ivar, is_private, get_super_receiver, objc_build_finally_epilogue): Make into static functions. (receiver_is_class_object): Use new IS_CLASS() macro. (objc_build_message_expr): Tweak ObjC++ message argument handling; call objc_finish_message_expr() instead of finish_message_expr(). (finish_message_expr): Rename to objc_finish_message_expr(); use OBJC_TYPE_NAME and OBJC_SET_TYPE_NAME macros instead of TYPE_NAME. call gen_type_name() instead of gen_declaration(); call objc_is_id() instead of using IS_ID and IS_CLASS; Use objc_class_name instead of calling get_identifier("Class"); handle CONVERT_EXPRs in receiver. (build_objc_method_call, warn_with_method): Do not call groktypename(). (build_ivar_reference): Call convert() instead of clobbering in a type. (hash_init): Initialize string_htab hash table. (add_instance_variable): Simplify parameter list; do not call grokfield(); do not populate CLASS_IVARS list. (start_class): Check for the existence of super class, if one was specified. (continue_class): Use CLASS_RAW_IVARS rather than CLASS_IVARS; do not call build_class_template(); adjust call to get_class_ivars(); call build_decl(), pushdecl() and finish_decl() instead of define_decl(). (finish_class): Call build_decl(), pushdecl() and finish_decl() instead of define_decl(). (add_protocols): Use PROTOCOL_BINFO_ELTS for the tree vector size. (start_protocol): Do not call build_protocol_template(); use PROTOCOL_BINFO_ELTS for the tree vector size. (encode_type_qualifiers): Do not handle the 'const' qualifier here. (encode_pointer): Encode 'const char *' as 'r*', for backwards compatibility. (encode_array): Use HOST_WIDE_INT_PRINT_DEC instead of "%ld". (encode_type): Handle the 'const' qualifier here. (objc_parmlist): New global variable, sued by objc_push_parm and objc_get_parm_info(). (objc_push_parm, objc_get_parm_info): New functions. (objc_expr_last): Remove function. (synth_self_and_ucmd_args): For instance methods, use the instance type for 'self'; call objc_push_parm() instead of push_parm_decl(). (start_method_def): Do not call push_scope(), declare_parm_level(), pop_scope(), push_parm_decl(), store_parm_decls() or objc_expr_last(); just use objc_push_parm() and objc_get_parm_info(). (comp_method_with_proto): Remove function. (objc_types_are_equivalent): Strip away indirections before comparing underlying types. (comp_proto_with_proto): Do not call groktypename(); types are no longer in raw declspec format. (objc_start_function): New function. (really_start_method): Call comp_proto_with_proto() instead of comp_method_with_proto(); call objc_start_function() instead of hand-crafting a function declarator. (continue_method_def, objc_expand_function_end): Remove functions. (get_super_receiver): Call objc_get_current_scope() instead of get_current_scope(); reference 'super_class' field (instead of 'class'). (finish_method_def): Rename to objc_finish_method_definition() and add a function decl parameter; move method encoding call from objc_expand_function_end(). (is_complex_decl, adorn_decl, gen_declarator, gen_declspecs, gen_declaration_1): Remove functions. (tmpbuf, RAW_DECLSPEC): Remove. (gen_declaration): Remove second parameter; simplify to deal with TYPE_P nodes instead of raw declspecs. (gen_type_name, gen_type_name_0): New functions. (gen_method_decl): Remove second parameter; call gen_type_name() instead of gen_declaration_1(). (dump_interface): Adjust calls to gen_declaration() and gen_method_decl(); do not allocate a separate string buffer. (init_objc): Allocate a larger string buffer to accommodate dump_interface(); adjust call to build_module_descriptor(); add call to build_module_initializer_routine() for the GNU runtime. (generate_classref_translation_entry): Do not call start_decl(); call finish_var_decl() instead of finish_decl(); call convert() instead of build_c_cast(). * objc-act.h (CLASS_OWN_IVARS): Remove accessor. (CLASS_BINFO_ELTS): Reduce from 6 to 5, now that CLASS_OWN_IVARS is gone. (OCTI_GNU_INIT_DECL, GNU_INIT_decl): New. (OCTI_ELLIPSIS_NODE, objc_ellipsis_node): Remove. (OCTI_ID_ID, id_type, objc_id_id): Rename to OCTI_ID_NAME, objc_object_type and objc_object_name, respectively. (OCTI_CLS_REF, OCTI_CLASS_NAME, objc_class_reference, objc_class_name): New. (IS_CLASS): New macro. (IS_ID, IS_SUPER): Robustify. (OCTI_EXECCLASS_DECL, execclass_decl): New. (finish_file, start_class, continue_class, finish_class, start_method_def, continue_method_def, finish_method_def, start_protocol, finish_protocol, objc_build_throw_stmt, objc_build_try_catch_finally_stmt, objc_build_synchronized_prologue, objc_build_synchronized_epilogue, objc_build_try_prologue, objc_build_try_epilogue, objc_build_catch_stmt, objc_build_catch_epilogue, objc_build_finally_prologue, objc_build_finally_epilogue, is_ivar, is_private, is_public, add_instance_variable, objc_add_method, get_super_receiver, objc_clear_super_receiver, get_class_ivars_from_name, get_class_reference, get_static_reference, get_object_reference, build_message_expr, finish_message_expr, build_selector_expr, build_ivar_reference, build_keyword_decl, build_method_decl, build_protocol_expr, build_objc_string_object, objc_declare_alias, objc_declare_class, objc_declare_protocols, objc_comptypes, objc_check_decl, build_encode_expr): Remove prototypes. (imp_count, cat_count): Make GGC-aware. (OBJC_SET_TYPE_NAME): New macro. From-SVN: r87168
2004-09-08 02:49:44 +02:00
field_decl = create_field_decl (build_pointer_type (void_type_node),
"gc_object_type");
chainon (field_decl_chain, field_decl);
finish_struct (objc_class_template, field_decl_chain, NULL_TREE);
1992-01-18 00:15:38 +01:00
}
/* Generate appropriate forward declarations for an implementation. */
1992-01-18 00:15:38 +01:00
static void
synth_forward_declarations (void)
1992-01-18 00:15:38 +01:00
{
tree an_id;
1992-01-18 00:15:38 +01:00
/* static struct objc_class _OBJC_CLASS_<my_name>; */
UOBJC_CLASS_decl = build_metadata_decl ("_OBJC_CLASS",
Makefile.in (c-parse.o): Depend on $(C_COMMON_H). [gcc/ChangeLog] 2004-09-07 Ziemowit Laski <zlaski@apple.com> * Makefile.in (c-parse.o): Depend on $(C_COMMON_H). * c-parse.in: Include c-common.h instead of objc-act.h. (ivar_decl_list, ivar_decls, ivar_decl, ivars, ivar_declarator, myparms, myparm): Remove %type declarations. (methodtype, optparms, OBJC_TYPE_QUAL, objc_quals, objc_qual, objc_typename, objc_try_catch_stmt, optellipsis): Add %type declarations. (objc_inherit_code, objc_public_flag): Remove. (typespec_nonreserved_nonattr): Call objc_get_protocol_qualified_type() instead of get_static_reference() and get_protocol_reference(). (stmt_nocomp): Call grokparm() on @catch parameter. (objcdef): Move semantic action to objc_finish_implementation(). (classdef): Move semantic action to objc_start_class_interface(), objc_continue_interface(), objc_finish_interface(), objc_start_class_implementation(), objc_continue_implementation(), objc_start_category_interface() and objc_start_category_implementation(). (protocoldef): Move semantic actions to objc_start_protocol() and objc_finish_interface(). (ivar_decl_list): Remove nonterminal. (visibility_spec): Move semantic actions to objc_set_visibility(). (ivar_decls): Remove assignment to $$. (ivar_decl): Rephrase in terms of component_decl; call objc_add_instance_variable(). (ivars, ivar_declarator): Remove nonterminals. (opt_semi): New nonterminal. (methodtype): Remove semantic actions. (methoddef): Move semantic actions to objc_set_method_type(), objc_start_method_definition() and objc_finish_method_definition(). (methodproto): Move semantic actions to objc_set_method_type() and objc_add_method_declaration(). (methoddecl): Use objc_typename instead of typename; move semantic actions to objc_build_method_signature(). (optarglist, myxdecls, mydecl, myparms, myparm): Remove nonterminals. (optparmlist): Express in terms of optparms and optellipsis. (optparms, optellipsis, objc_qual, objc_quals, objc_typename): New nonterminals. (keyworddecl): Use objc_typename instead of typename. (rid_to_yy): Mark RID_IN, RID_OUT, RID_INOUT, RID_BYCOPY, RID_BYREF and RID_ONEWAY as returning OBJC_TYPE_QUAL to yyparse(). [gcc/objc/ChangeLog] 2004-09-07 Ziemowit Laski <zlaski@apple.com> * Make-lang.in (objc/objc-parse.o): Depend on $(C_COMMON_H) instead of objc/objc-act.h. (objc/objc-act.o): Depend on $(HASHTAB_H). * objc-act.c: Include hashtab.h; in ObjC++ mode, include cp-tree.h and objcp-decl.h instead of c-tree.h. (build_module_descriptor, get_class_ivars, synth_id_with_class_suffix, error_with_ivar, gen_method_decl, gen_declaration, setup_string_decl, build_protocol_template): Adjust prototypes. (build_module_initializer_routine, start_class, continue_class, finish_class, start_method_def, objc_start_function, start_protocol, build_method_decl, objc_add_method, add_instance_variable, build_ivar_reference, is_ivar, is_private, get_super_receiver, build_selector_table_decl, objc_push_parm, objc_get_parm_info, gen_type_name, gen_type_name_0, start_var_decl, finish_var_decl, create_field_decl): New prototypes. (objc_expand_function_end, comp_method_with_proto, objc_expr_last, gen_declaration_1, gen_declarator, is_complex_decl, adorn_decl, define_decl, create_builtin_decl, gen_declspecs): Remove prototypes. (TYPE_ID): Rename to OBJECT_TYPEDEF_NAME. (CLASS_TYPEDEF_NAME): New. (TAG_EXECCLASS): Change from a global variable to a #define. (TAG_RETURN_STRUCT): Delete. (TAG_GNUINIT): New, holds '__objc_gnu_init' name. (objc_inherit_code, objc_public_flag): New, moved from c-parse.in. (string_descriptor): New struct. (string_htab): New hash table. (string_hash, string_eq): New prototypes. (generate_struct_by_value_array): Call create_field_decl() instead of create_builtin_decl(). (objc_init): Do not initialize objc_ellipsis_node or TAG_EXECCLASS; In ObjC++ mode, call cxx_init() instead of c_objc_common_init(). (objc_finish_file): In ObjC++, call instantiate_pending_templates() and cp_finish_file(). (define_decl, get_static_reference, get_protocol_reference, create_builtin_decl): Remove functions. (objc_start_class_interface, objc_start_category_interface, objc_start_protocol, objc_continue_interface, objc_finish_interface, objc_start_class_implementation, objc_start_category_implementation, objc_continue_implementation, objc_finish_implementation, objc_set_visibility, objc_set_method_type, objc_build_method_signature, objc_add_method_declaration, objc_start_method_definition, objc_add_instance_variable, objc_get_protocol_qualified_type, create_field_decl, start_var_decl, finish_var_decl): New functions. (setup_string_decl): Simplify since it is only called once. (synth_module_prologue): Call build_class_template(); predefine 'id' and 'Class' as typedefs; rename 'temp_type' to 'type'; disable debug hooks for duration of function; fix GNU runtime messenger signatures to correspond to reality; forward-declare '__objc_exec_class' for the GNU runtime; call build_selector_table_decl(); in ObjC++ mode, generate 'extern "C" { ... }' wrappers around synthesized declarations; call build_protocol_template() and build_category_template(). (string_hash, string_eq): New functions. (objc_build_string_object): Check metaclass correctness only once; store string literals in hash table. (objc_build_constructor): Do not convert initializer elements; adjust for ObjC++ impedance mismatch. (build_objc_symtab_template): Call create_field_decl() instead of create_builtin_decl(). (init_objc_symtab): Add missing conversion to initializer element. (build_metadata_decl): Call start_var_decl() instead of define_decl(). (generate_objc_symtab_decl): Do not call build_category_template(); call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(). (build_module_descriptor): Call create_field_decl() instead of grokfield(); call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(); always mark module descriptor as used; move GNU runtime-specific functionality to build_module_initializer_routine(). (build_module_initializer_routine): New function, broken off of build_module_descriptor(). (objc_static_init_needed_p, objc_generate_static_init_call): New functions. (generate_static_references, generate_strings, build_selector_translation_table, generate_descriptor_table, generate_ivars_list, generate_dispatch_table, generate_category): Call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(); build a type directly instead of via groktypename(). (build_selector_reference_decl, build_selector_table_decl, build_class_reference_decl, build_protocol_reference, generate_objc_image_info): Call start_var_decl() instead of build_decl(). (build_selector_reference): For GNU runtime, do not call build_selector_reference_decl(). (build_selector, build_typed_selector_reference): Always convert result to the selector type. (add_objc_string): Cast return value to 'char *'. (build_method_prototype_template, build_selector_template, build_method_template): Use actual selector type for fields pointing to selectors. (finish_objc): For GNU runtime, call build_module_initializer_routine() after build_module_descriptor(). (generate_protocol_list, generate_shared_structures): Call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(); build a type directly instead of via groktypename(). (synth_id_with_class_suffix): Return a string. (get_arg_type_list): For instance methods, use the instance type for 'self'; do not call groktypename_in_parm_context(). (build_objc_string_decl): Squash redeclaration errors in ObjC++. (objc_is_class_name): Use OBJC_TYPE_NAME instead of TYPE_NAME; handle RECORD_TYPEs in ObjC as well as ObjC++. (objc_is_id): New function. (objc_is_object_ptr): Return the canonical type node. (objc_get_class_ivars): Simplify using get_class_ivars(). (get_class_ivars): Remove second parameter; create a fresh copy of the ivar list for each call; do not check for existence of super class. (objc_eh_runtime_type): Mark #ifndef OBJCPLUS. (objc_init_exceptions): When using SJLJ-style exceptions, require the use of '-fobjc-exceptions' flag; do not require it for DWARF-style exceptions. (objc_build_exc_ptr, next_sjlj_build_try_catch_finally): Use objc_object_type instead of objc_id_type. (objc_begin_catch_clause): Convert the incoming PARM_DECL into a VAR_DECL before placing it in the appropriate scope; do not call define_decl(); adjust call to c_begin_compound_stmt(); use objc_object_type instead of objc_id_type. (build_next_objc_exception_stuff): Call create_field_decl() instead of create_builtin_decl(); construct type directly instead of calling groktypename(); use OBJC_VOID_AT_END to mark end of function parameters. (build_private_template): Adjust call to get_class_ivars(); build a type directly instead of via groktypename(). (build_protocol_template, build_method_prototype_list_template, build_method_prototype_template, build_category_template, build_selector_template, build_class_template, build_super_template, build_ivar_template, build_ivar_list_template, build_method_list_template, build_method_template): Call create_field_decl() instead of grokfield(). (objc_method_parm_type): Do not call groktypename(). (generate_descriptor_table): Call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(). (generate_method_descriptors, build_protocol_initializer, generate_dispatch_tables, build_category_initializer, build_shared_structure_initializer): Do not call groktypename(). (generate_protocols): Call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(); do not call groktypename(). (error_with_ivar): Remove last parameter. (check_ivars): Do not iterate ovar CLASS_RAW_IVARS lists in addition to CLASS_IVARS lists; adjust calls to error_with_ivar(). (generate_ivar_lists): Convert one of the initializer elements; do not call groktypename(). (get_arg_type_list, start_method_def, gen_method_def): Account for new representation of variable arguments and '...' in Objective-C methods; add Objective-C++ impedance matching code. (is_objc_type_qualifier): Remove function. (adjust_type_for_id_default): Simplify; there is no longer a need to wade through declspecs. (lookup_interface, start_class, continue_class, finish_class, start_method_def, start_protocol, build_method_decl, objc_add_method, add_instance_variable, build_ivar_reference, is_ivar, is_private, get_super_receiver, objc_build_finally_epilogue): Make into static functions. (receiver_is_class_object): Use new IS_CLASS() macro. (objc_build_message_expr): Tweak ObjC++ message argument handling; call objc_finish_message_expr() instead of finish_message_expr(). (finish_message_expr): Rename to objc_finish_message_expr(); use OBJC_TYPE_NAME and OBJC_SET_TYPE_NAME macros instead of TYPE_NAME. call gen_type_name() instead of gen_declaration(); call objc_is_id() instead of using IS_ID and IS_CLASS; Use objc_class_name instead of calling get_identifier("Class"); handle CONVERT_EXPRs in receiver. (build_objc_method_call, warn_with_method): Do not call groktypename(). (build_ivar_reference): Call convert() instead of clobbering in a type. (hash_init): Initialize string_htab hash table. (add_instance_variable): Simplify parameter list; do not call grokfield(); do not populate CLASS_IVARS list. (start_class): Check for the existence of super class, if one was specified. (continue_class): Use CLASS_RAW_IVARS rather than CLASS_IVARS; do not call build_class_template(); adjust call to get_class_ivars(); call build_decl(), pushdecl() and finish_decl() instead of define_decl(). (finish_class): Call build_decl(), pushdecl() and finish_decl() instead of define_decl(). (add_protocols): Use PROTOCOL_BINFO_ELTS for the tree vector size. (start_protocol): Do not call build_protocol_template(); use PROTOCOL_BINFO_ELTS for the tree vector size. (encode_type_qualifiers): Do not handle the 'const' qualifier here. (encode_pointer): Encode 'const char *' as 'r*', for backwards compatibility. (encode_array): Use HOST_WIDE_INT_PRINT_DEC instead of "%ld". (encode_type): Handle the 'const' qualifier here. (objc_parmlist): New global variable, sued by objc_push_parm and objc_get_parm_info(). (objc_push_parm, objc_get_parm_info): New functions. (objc_expr_last): Remove function. (synth_self_and_ucmd_args): For instance methods, use the instance type for 'self'; call objc_push_parm() instead of push_parm_decl(). (start_method_def): Do not call push_scope(), declare_parm_level(), pop_scope(), push_parm_decl(), store_parm_decls() or objc_expr_last(); just use objc_push_parm() and objc_get_parm_info(). (comp_method_with_proto): Remove function. (objc_types_are_equivalent): Strip away indirections before comparing underlying types. (comp_proto_with_proto): Do not call groktypename(); types are no longer in raw declspec format. (objc_start_function): New function. (really_start_method): Call comp_proto_with_proto() instead of comp_method_with_proto(); call objc_start_function() instead of hand-crafting a function declarator. (continue_method_def, objc_expand_function_end): Remove functions. (get_super_receiver): Call objc_get_current_scope() instead of get_current_scope(); reference 'super_class' field (instead of 'class'). (finish_method_def): Rename to objc_finish_method_definition() and add a function decl parameter; move method encoding call from objc_expand_function_end(). (is_complex_decl, adorn_decl, gen_declarator, gen_declspecs, gen_declaration_1): Remove functions. (tmpbuf, RAW_DECLSPEC): Remove. (gen_declaration): Remove second parameter; simplify to deal with TYPE_P nodes instead of raw declspecs. (gen_type_name, gen_type_name_0): New functions. (gen_method_decl): Remove second parameter; call gen_type_name() instead of gen_declaration_1(). (dump_interface): Adjust calls to gen_declaration() and gen_method_decl(); do not allocate a separate string buffer. (init_objc): Allocate a larger string buffer to accommodate dump_interface(); adjust call to build_module_descriptor(); add call to build_module_initializer_routine() for the GNU runtime. (generate_classref_translation_entry): Do not call start_decl(); call finish_var_decl() instead of finish_decl(); call convert() instead of build_c_cast(). * objc-act.h (CLASS_OWN_IVARS): Remove accessor. (CLASS_BINFO_ELTS): Reduce from 6 to 5, now that CLASS_OWN_IVARS is gone. (OCTI_GNU_INIT_DECL, GNU_INIT_decl): New. (OCTI_ELLIPSIS_NODE, objc_ellipsis_node): Remove. (OCTI_ID_ID, id_type, objc_id_id): Rename to OCTI_ID_NAME, objc_object_type and objc_object_name, respectively. (OCTI_CLS_REF, OCTI_CLASS_NAME, objc_class_reference, objc_class_name): New. (IS_CLASS): New macro. (IS_ID, IS_SUPER): Robustify. (OCTI_EXECCLASS_DECL, execclass_decl): New. (finish_file, start_class, continue_class, finish_class, start_method_def, continue_method_def, finish_method_def, start_protocol, finish_protocol, objc_build_throw_stmt, objc_build_try_catch_finally_stmt, objc_build_synchronized_prologue, objc_build_synchronized_epilogue, objc_build_try_prologue, objc_build_try_epilogue, objc_build_catch_stmt, objc_build_catch_epilogue, objc_build_finally_prologue, objc_build_finally_epilogue, is_ivar, is_private, is_public, add_instance_variable, objc_add_method, get_super_receiver, objc_clear_super_receiver, get_class_ivars_from_name, get_class_reference, get_static_reference, get_object_reference, build_message_expr, finish_message_expr, build_selector_expr, build_ivar_reference, build_keyword_decl, build_method_decl, build_protocol_expr, build_objc_string_object, objc_declare_alias, objc_declare_class, objc_declare_protocols, objc_comptypes, objc_check_decl, build_encode_expr): Remove prototypes. (imp_count, cat_count): Make GGC-aware. (OBJC_SET_TYPE_NAME): New macro. From-SVN: r87168
2004-09-08 02:49:44 +02:00
objc_class_template);
1992-01-18 00:15:38 +01:00
/* static struct objc_class _OBJC_METACLASS_<my_name>; */
UOBJC_METACLASS_decl = build_metadata_decl ("_OBJC_METACLASS",
objc_class_template);
1992-01-18 00:15:38 +01:00
1996-07-04 00:07:53 +02:00
/* Pre-build the following entities - for speed/convenience. */
1992-01-18 00:15:38 +01:00
an_id = get_identifier ("super_class");
objc-act.c (objc_build_struct): New function. * objc-act.c (objc_build_struct): New function. (objc_derived_from_p): Likewise. (objc_build_component_ref): Likewise. (objc_copy_binfo): Likewise. (objc_xref_basetypes): Likewise. (objc_lookup_protocol): Likewise. (objc_compare_protocols): Likewise. (objc_volatilize_decl): Likewise. (encode_aggregate_fields): Likewise. (volatilized_hash): Likewise. (volatilized_eq): Likewise. (objc_compare_types): Likewise. (objc_type_quals_match): Likewise. (DERIVED_FROM_P): New ObjC macro, corresponding to C++ macro of same name. (get_class_ivars): Add second parameter indicating if entire hierarchy is desired. (struct volatilized_type): New type. (volatilized_htab): New hash table. (objc_types_compatible_p, objc_comptypes): Remove functions. (synth_module_prologue): Do not initialize 'unused_list'. (objc_get_class_reference): Fix ObjC++ impedance mismatches. (objc_declare_alias): Implement as a typedef. (objc_substitute_decl, objc_gimplify_expr): Reformat. (objc_get_class_ivars): Adjust call to get_class_ivars(). (next_sjlj_build_enter_and_setjmp, synth_forward_declarations, build_ivar_reference, get_super_receiver): Call objc_build_component_ref() instead of build_component_ref(). (objc_begin_catch_clause): Use DERIVED_FROM_P() instead of objc_comptypes(). (build_private_template): Call objc_build_struct() instead of start_struct() and finish_struct(). (hash_init): Initialize volatilized_htab. (objc_is_public): Adjust calls to objc_get_ivars(); adjust ObjC++ impedance mismatches. (encode_aggregate_within): Streamline by calling encode_aggregate_fields(). * objc-act.h (objc_types_compatible_p): Remove prototype. (OCTI_UNUSED_LIST, unused_list): Remove slot. * objc-lang.c (LANG_HOOKS_TYPES_COMPATIBLE_P): Remove. From-SVN: r100123
2005-05-25 00:21:01 +02:00
ucls_super_ref = objc_build_component_ref (UOBJC_CLASS_decl, an_id);
uucls_super_ref = objc_build_component_ref (UOBJC_METACLASS_decl, an_id);
1992-01-18 00:15:38 +01:00
}
static void
Makefile.in (c-parse.o): Depend on $(C_COMMON_H). [gcc/ChangeLog] 2004-09-07 Ziemowit Laski <zlaski@apple.com> * Makefile.in (c-parse.o): Depend on $(C_COMMON_H). * c-parse.in: Include c-common.h instead of objc-act.h. (ivar_decl_list, ivar_decls, ivar_decl, ivars, ivar_declarator, myparms, myparm): Remove %type declarations. (methodtype, optparms, OBJC_TYPE_QUAL, objc_quals, objc_qual, objc_typename, objc_try_catch_stmt, optellipsis): Add %type declarations. (objc_inherit_code, objc_public_flag): Remove. (typespec_nonreserved_nonattr): Call objc_get_protocol_qualified_type() instead of get_static_reference() and get_protocol_reference(). (stmt_nocomp): Call grokparm() on @catch parameter. (objcdef): Move semantic action to objc_finish_implementation(). (classdef): Move semantic action to objc_start_class_interface(), objc_continue_interface(), objc_finish_interface(), objc_start_class_implementation(), objc_continue_implementation(), objc_start_category_interface() and objc_start_category_implementation(). (protocoldef): Move semantic actions to objc_start_protocol() and objc_finish_interface(). (ivar_decl_list): Remove nonterminal. (visibility_spec): Move semantic actions to objc_set_visibility(). (ivar_decls): Remove assignment to $$. (ivar_decl): Rephrase in terms of component_decl; call objc_add_instance_variable(). (ivars, ivar_declarator): Remove nonterminals. (opt_semi): New nonterminal. (methodtype): Remove semantic actions. (methoddef): Move semantic actions to objc_set_method_type(), objc_start_method_definition() and objc_finish_method_definition(). (methodproto): Move semantic actions to objc_set_method_type() and objc_add_method_declaration(). (methoddecl): Use objc_typename instead of typename; move semantic actions to objc_build_method_signature(). (optarglist, myxdecls, mydecl, myparms, myparm): Remove nonterminals. (optparmlist): Express in terms of optparms and optellipsis. (optparms, optellipsis, objc_qual, objc_quals, objc_typename): New nonterminals. (keyworddecl): Use objc_typename instead of typename. (rid_to_yy): Mark RID_IN, RID_OUT, RID_INOUT, RID_BYCOPY, RID_BYREF and RID_ONEWAY as returning OBJC_TYPE_QUAL to yyparse(). [gcc/objc/ChangeLog] 2004-09-07 Ziemowit Laski <zlaski@apple.com> * Make-lang.in (objc/objc-parse.o): Depend on $(C_COMMON_H) instead of objc/objc-act.h. (objc/objc-act.o): Depend on $(HASHTAB_H). * objc-act.c: Include hashtab.h; in ObjC++ mode, include cp-tree.h and objcp-decl.h instead of c-tree.h. (build_module_descriptor, get_class_ivars, synth_id_with_class_suffix, error_with_ivar, gen_method_decl, gen_declaration, setup_string_decl, build_protocol_template): Adjust prototypes. (build_module_initializer_routine, start_class, continue_class, finish_class, start_method_def, objc_start_function, start_protocol, build_method_decl, objc_add_method, add_instance_variable, build_ivar_reference, is_ivar, is_private, get_super_receiver, build_selector_table_decl, objc_push_parm, objc_get_parm_info, gen_type_name, gen_type_name_0, start_var_decl, finish_var_decl, create_field_decl): New prototypes. (objc_expand_function_end, comp_method_with_proto, objc_expr_last, gen_declaration_1, gen_declarator, is_complex_decl, adorn_decl, define_decl, create_builtin_decl, gen_declspecs): Remove prototypes. (TYPE_ID): Rename to OBJECT_TYPEDEF_NAME. (CLASS_TYPEDEF_NAME): New. (TAG_EXECCLASS): Change from a global variable to a #define. (TAG_RETURN_STRUCT): Delete. (TAG_GNUINIT): New, holds '__objc_gnu_init' name. (objc_inherit_code, objc_public_flag): New, moved from c-parse.in. (string_descriptor): New struct. (string_htab): New hash table. (string_hash, string_eq): New prototypes. (generate_struct_by_value_array): Call create_field_decl() instead of create_builtin_decl(). (objc_init): Do not initialize objc_ellipsis_node or TAG_EXECCLASS; In ObjC++ mode, call cxx_init() instead of c_objc_common_init(). (objc_finish_file): In ObjC++, call instantiate_pending_templates() and cp_finish_file(). (define_decl, get_static_reference, get_protocol_reference, create_builtin_decl): Remove functions. (objc_start_class_interface, objc_start_category_interface, objc_start_protocol, objc_continue_interface, objc_finish_interface, objc_start_class_implementation, objc_start_category_implementation, objc_continue_implementation, objc_finish_implementation, objc_set_visibility, objc_set_method_type, objc_build_method_signature, objc_add_method_declaration, objc_start_method_definition, objc_add_instance_variable, objc_get_protocol_qualified_type, create_field_decl, start_var_decl, finish_var_decl): New functions. (setup_string_decl): Simplify since it is only called once. (synth_module_prologue): Call build_class_template(); predefine 'id' and 'Class' as typedefs; rename 'temp_type' to 'type'; disable debug hooks for duration of function; fix GNU runtime messenger signatures to correspond to reality; forward-declare '__objc_exec_class' for the GNU runtime; call build_selector_table_decl(); in ObjC++ mode, generate 'extern "C" { ... }' wrappers around synthesized declarations; call build_protocol_template() and build_category_template(). (string_hash, string_eq): New functions. (objc_build_string_object): Check metaclass correctness only once; store string literals in hash table. (objc_build_constructor): Do not convert initializer elements; adjust for ObjC++ impedance mismatch. (build_objc_symtab_template): Call create_field_decl() instead of create_builtin_decl(). (init_objc_symtab): Add missing conversion to initializer element. (build_metadata_decl): Call start_var_decl() instead of define_decl(). (generate_objc_symtab_decl): Do not call build_category_template(); call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(). (build_module_descriptor): Call create_field_decl() instead of grokfield(); call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(); always mark module descriptor as used; move GNU runtime-specific functionality to build_module_initializer_routine(). (build_module_initializer_routine): New function, broken off of build_module_descriptor(). (objc_static_init_needed_p, objc_generate_static_init_call): New functions. (generate_static_references, generate_strings, build_selector_translation_table, generate_descriptor_table, generate_ivars_list, generate_dispatch_table, generate_category): Call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(); build a type directly instead of via groktypename(). (build_selector_reference_decl, build_selector_table_decl, build_class_reference_decl, build_protocol_reference, generate_objc_image_info): Call start_var_decl() instead of build_decl(). (build_selector_reference): For GNU runtime, do not call build_selector_reference_decl(). (build_selector, build_typed_selector_reference): Always convert result to the selector type. (add_objc_string): Cast return value to 'char *'. (build_method_prototype_template, build_selector_template, build_method_template): Use actual selector type for fields pointing to selectors. (finish_objc): For GNU runtime, call build_module_initializer_routine() after build_module_descriptor(). (generate_protocol_list, generate_shared_structures): Call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(); build a type directly instead of via groktypename(). (synth_id_with_class_suffix): Return a string. (get_arg_type_list): For instance methods, use the instance type for 'self'; do not call groktypename_in_parm_context(). (build_objc_string_decl): Squash redeclaration errors in ObjC++. (objc_is_class_name): Use OBJC_TYPE_NAME instead of TYPE_NAME; handle RECORD_TYPEs in ObjC as well as ObjC++. (objc_is_id): New function. (objc_is_object_ptr): Return the canonical type node. (objc_get_class_ivars): Simplify using get_class_ivars(). (get_class_ivars): Remove second parameter; create a fresh copy of the ivar list for each call; do not check for existence of super class. (objc_eh_runtime_type): Mark #ifndef OBJCPLUS. (objc_init_exceptions): When using SJLJ-style exceptions, require the use of '-fobjc-exceptions' flag; do not require it for DWARF-style exceptions. (objc_build_exc_ptr, next_sjlj_build_try_catch_finally): Use objc_object_type instead of objc_id_type. (objc_begin_catch_clause): Convert the incoming PARM_DECL into a VAR_DECL before placing it in the appropriate scope; do not call define_decl(); adjust call to c_begin_compound_stmt(); use objc_object_type instead of objc_id_type. (build_next_objc_exception_stuff): Call create_field_decl() instead of create_builtin_decl(); construct type directly instead of calling groktypename(); use OBJC_VOID_AT_END to mark end of function parameters. (build_private_template): Adjust call to get_class_ivars(); build a type directly instead of via groktypename(). (build_protocol_template, build_method_prototype_list_template, build_method_prototype_template, build_category_template, build_selector_template, build_class_template, build_super_template, build_ivar_template, build_ivar_list_template, build_method_list_template, build_method_template): Call create_field_decl() instead of grokfield(). (objc_method_parm_type): Do not call groktypename(). (generate_descriptor_table): Call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(). (generate_method_descriptors, build_protocol_initializer, generate_dispatch_tables, build_category_initializer, build_shared_structure_initializer): Do not call groktypename(). (generate_protocols): Call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(); do not call groktypename(). (error_with_ivar): Remove last parameter. (check_ivars): Do not iterate ovar CLASS_RAW_IVARS lists in addition to CLASS_IVARS lists; adjust calls to error_with_ivar(). (generate_ivar_lists): Convert one of the initializer elements; do not call groktypename(). (get_arg_type_list, start_method_def, gen_method_def): Account for new representation of variable arguments and '...' in Objective-C methods; add Objective-C++ impedance matching code. (is_objc_type_qualifier): Remove function. (adjust_type_for_id_default): Simplify; there is no longer a need to wade through declspecs. (lookup_interface, start_class, continue_class, finish_class, start_method_def, start_protocol, build_method_decl, objc_add_method, add_instance_variable, build_ivar_reference, is_ivar, is_private, get_super_receiver, objc_build_finally_epilogue): Make into static functions. (receiver_is_class_object): Use new IS_CLASS() macro. (objc_build_message_expr): Tweak ObjC++ message argument handling; call objc_finish_message_expr() instead of finish_message_expr(). (finish_message_expr): Rename to objc_finish_message_expr(); use OBJC_TYPE_NAME and OBJC_SET_TYPE_NAME macros instead of TYPE_NAME. call gen_type_name() instead of gen_declaration(); call objc_is_id() instead of using IS_ID and IS_CLASS; Use objc_class_name instead of calling get_identifier("Class"); handle CONVERT_EXPRs in receiver. (build_objc_method_call, warn_with_method): Do not call groktypename(). (build_ivar_reference): Call convert() instead of clobbering in a type. (hash_init): Initialize string_htab hash table. (add_instance_variable): Simplify parameter list; do not call grokfield(); do not populate CLASS_IVARS list. (start_class): Check for the existence of super class, if one was specified. (continue_class): Use CLASS_RAW_IVARS rather than CLASS_IVARS; do not call build_class_template(); adjust call to get_class_ivars(); call build_decl(), pushdecl() and finish_decl() instead of define_decl(). (finish_class): Call build_decl(), pushdecl() and finish_decl() instead of define_decl(). (add_protocols): Use PROTOCOL_BINFO_ELTS for the tree vector size. (start_protocol): Do not call build_protocol_template(); use PROTOCOL_BINFO_ELTS for the tree vector size. (encode_type_qualifiers): Do not handle the 'const' qualifier here. (encode_pointer): Encode 'const char *' as 'r*', for backwards compatibility. (encode_array): Use HOST_WIDE_INT_PRINT_DEC instead of "%ld". (encode_type): Handle the 'const' qualifier here. (objc_parmlist): New global variable, sued by objc_push_parm and objc_get_parm_info(). (objc_push_parm, objc_get_parm_info): New functions. (objc_expr_last): Remove function. (synth_self_and_ucmd_args): For instance methods, use the instance type for 'self'; call objc_push_parm() instead of push_parm_decl(). (start_method_def): Do not call push_scope(), declare_parm_level(), pop_scope(), push_parm_decl(), store_parm_decls() or objc_expr_last(); just use objc_push_parm() and objc_get_parm_info(). (comp_method_with_proto): Remove function. (objc_types_are_equivalent): Strip away indirections before comparing underlying types. (comp_proto_with_proto): Do not call groktypename(); types are no longer in raw declspec format. (objc_start_function): New function. (really_start_method): Call comp_proto_with_proto() instead of comp_method_with_proto(); call objc_start_function() instead of hand-crafting a function declarator. (continue_method_def, objc_expand_function_end): Remove functions. (get_super_receiver): Call objc_get_current_scope() instead of get_current_scope(); reference 'super_class' field (instead of 'class'). (finish_method_def): Rename to objc_finish_method_definition() and add a function decl parameter; move method encoding call from objc_expand_function_end(). (is_complex_decl, adorn_decl, gen_declarator, gen_declspecs, gen_declaration_1): Remove functions. (tmpbuf, RAW_DECLSPEC): Remove. (gen_declaration): Remove second parameter; simplify to deal with TYPE_P nodes instead of raw declspecs. (gen_type_name, gen_type_name_0): New functions. (gen_method_decl): Remove second parameter; call gen_type_name() instead of gen_declaration_1(). (dump_interface): Adjust calls to gen_declaration() and gen_method_decl(); do not allocate a separate string buffer. (init_objc): Allocate a larger string buffer to accommodate dump_interface(); adjust call to build_module_descriptor(); add call to build_module_initializer_routine() for the GNU runtime. (generate_classref_translation_entry): Do not call start_decl(); call finish_var_decl() instead of finish_decl(); call convert() instead of build_c_cast(). * objc-act.h (CLASS_OWN_IVARS): Remove accessor. (CLASS_BINFO_ELTS): Reduce from 6 to 5, now that CLASS_OWN_IVARS is gone. (OCTI_GNU_INIT_DECL, GNU_INIT_decl): New. (OCTI_ELLIPSIS_NODE, objc_ellipsis_node): Remove. (OCTI_ID_ID, id_type, objc_id_id): Rename to OCTI_ID_NAME, objc_object_type and objc_object_name, respectively. (OCTI_CLS_REF, OCTI_CLASS_NAME, objc_class_reference, objc_class_name): New. (IS_CLASS): New macro. (IS_ID, IS_SUPER): Robustify. (OCTI_EXECCLASS_DECL, execclass_decl): New. (finish_file, start_class, continue_class, finish_class, start_method_def, continue_method_def, finish_method_def, start_protocol, finish_protocol, objc_build_throw_stmt, objc_build_try_catch_finally_stmt, objc_build_synchronized_prologue, objc_build_synchronized_epilogue, objc_build_try_prologue, objc_build_try_epilogue, objc_build_catch_stmt, objc_build_catch_epilogue, objc_build_finally_prologue, objc_build_finally_epilogue, is_ivar, is_private, is_public, add_instance_variable, objc_add_method, get_super_receiver, objc_clear_super_receiver, get_class_ivars_from_name, get_class_reference, get_static_reference, get_object_reference, build_message_expr, finish_message_expr, build_selector_expr, build_ivar_reference, build_keyword_decl, build_method_decl, build_protocol_expr, build_objc_string_object, objc_declare_alias, objc_declare_class, objc_declare_protocols, objc_comptypes, objc_check_decl, build_encode_expr): Remove prototypes. (imp_count, cat_count): Make GGC-aware. (OBJC_SET_TYPE_NAME): New macro. From-SVN: r87168
2004-09-08 02:49:44 +02:00
error_with_ivar (const char *message, tree decl)
1992-01-18 00:15:38 +01:00
{
builtins.c, [...]: Avoid "`" as left quote, using "'" or %q, %< and %> as appropriate. * builtins.c, c-common.c, c-decl.c, c-format.c, c-format.h, c-parse.in, c-pch.c, c-pragma.c, collect2.c, final.c, gcc.c, gcov.c, opts.c, pretty-print.h, protoize.c, reg-stack.c, rtl.c, tlink.c, config/alpha/alpha.c, config/arc/arc.c, config/arm/arm.c, config/avr/avr.c, config/c4x/c4x.c, config/darwin.c, config/frv/frv.c, config/h8300/h8300.c, config/i386/i386.c, config/i386/winnt.c, config/ia64/ia64.c, config/ip2k/ip2k.c, config/iq2000/iq2000.c, config/m32r/m32r.c, config/m68hc11/m68hc11.c, config/m68k/m68k.c, config/m68k/m68k.h, config/mcore/mcore.c, config/mips/mips.c, config/mmix/mmix.c, config/ns32k/ns32k.c, config/rs6000/host-darwin.c, config/rs6000/rs6000.c, config/s390/s390.c, config/sh/sh.c, config/sh/symbian.c, config/stormy16/stormy16.c, config/v850/v850.c: Avoid "`" as left quote, using "'" or %q, %< and %> as appropriate. Use %' as apostrophe in diagnostics where applicable. Use %< and %> in place of '' quotes where applicable. Use %qs in place of %<%s%>. Consistently quote __builtin function names. ada: * misc.c (gnat_handle_option): Use %< and %> for quoting in warning message. cp: * call.c, class.c, decl.c, decl2.c, error.c, mangle.c, parser.c, pt.c, search.c, semantics.c, typeck.c: Use %q, %< and %> for quoting in diagnostics. * parser.c (cp_parser_sizeof_operand): Use '' instead of `' for quoting in printf format. * decl.c (duplicate_decls, start_decl): Use %qD instead of unquoted %D. objc: * objc-act.c: Use %q, %< and %> for quoting in diagnostics. testsuite: * gcc.dg/builtin-prefetch-1.c: Adjust expected messages. From-SVN: r90337
2004-11-09 11:13:30 +01:00
error ("%J%s %qs", decl,
Makefile.in (c-parse.o): Depend on $(C_COMMON_H). [gcc/ChangeLog] 2004-09-07 Ziemowit Laski <zlaski@apple.com> * Makefile.in (c-parse.o): Depend on $(C_COMMON_H). * c-parse.in: Include c-common.h instead of objc-act.h. (ivar_decl_list, ivar_decls, ivar_decl, ivars, ivar_declarator, myparms, myparm): Remove %type declarations. (methodtype, optparms, OBJC_TYPE_QUAL, objc_quals, objc_qual, objc_typename, objc_try_catch_stmt, optellipsis): Add %type declarations. (objc_inherit_code, objc_public_flag): Remove. (typespec_nonreserved_nonattr): Call objc_get_protocol_qualified_type() instead of get_static_reference() and get_protocol_reference(). (stmt_nocomp): Call grokparm() on @catch parameter. (objcdef): Move semantic action to objc_finish_implementation(). (classdef): Move semantic action to objc_start_class_interface(), objc_continue_interface(), objc_finish_interface(), objc_start_class_implementation(), objc_continue_implementation(), objc_start_category_interface() and objc_start_category_implementation(). (protocoldef): Move semantic actions to objc_start_protocol() and objc_finish_interface(). (ivar_decl_list): Remove nonterminal. (visibility_spec): Move semantic actions to objc_set_visibility(). (ivar_decls): Remove assignment to $$. (ivar_decl): Rephrase in terms of component_decl; call objc_add_instance_variable(). (ivars, ivar_declarator): Remove nonterminals. (opt_semi): New nonterminal. (methodtype): Remove semantic actions. (methoddef): Move semantic actions to objc_set_method_type(), objc_start_method_definition() and objc_finish_method_definition(). (methodproto): Move semantic actions to objc_set_method_type() and objc_add_method_declaration(). (methoddecl): Use objc_typename instead of typename; move semantic actions to objc_build_method_signature(). (optarglist, myxdecls, mydecl, myparms, myparm): Remove nonterminals. (optparmlist): Express in terms of optparms and optellipsis. (optparms, optellipsis, objc_qual, objc_quals, objc_typename): New nonterminals. (keyworddecl): Use objc_typename instead of typename. (rid_to_yy): Mark RID_IN, RID_OUT, RID_INOUT, RID_BYCOPY, RID_BYREF and RID_ONEWAY as returning OBJC_TYPE_QUAL to yyparse(). [gcc/objc/ChangeLog] 2004-09-07 Ziemowit Laski <zlaski@apple.com> * Make-lang.in (objc/objc-parse.o): Depend on $(C_COMMON_H) instead of objc/objc-act.h. (objc/objc-act.o): Depend on $(HASHTAB_H). * objc-act.c: Include hashtab.h; in ObjC++ mode, include cp-tree.h and objcp-decl.h instead of c-tree.h. (build_module_descriptor, get_class_ivars, synth_id_with_class_suffix, error_with_ivar, gen_method_decl, gen_declaration, setup_string_decl, build_protocol_template): Adjust prototypes. (build_module_initializer_routine, start_class, continue_class, finish_class, start_method_def, objc_start_function, start_protocol, build_method_decl, objc_add_method, add_instance_variable, build_ivar_reference, is_ivar, is_private, get_super_receiver, build_selector_table_decl, objc_push_parm, objc_get_parm_info, gen_type_name, gen_type_name_0, start_var_decl, finish_var_decl, create_field_decl): New prototypes. (objc_expand_function_end, comp_method_with_proto, objc_expr_last, gen_declaration_1, gen_declarator, is_complex_decl, adorn_decl, define_decl, create_builtin_decl, gen_declspecs): Remove prototypes. (TYPE_ID): Rename to OBJECT_TYPEDEF_NAME. (CLASS_TYPEDEF_NAME): New. (TAG_EXECCLASS): Change from a global variable to a #define. (TAG_RETURN_STRUCT): Delete. (TAG_GNUINIT): New, holds '__objc_gnu_init' name. (objc_inherit_code, objc_public_flag): New, moved from c-parse.in. (string_descriptor): New struct. (string_htab): New hash table. (string_hash, string_eq): New prototypes. (generate_struct_by_value_array): Call create_field_decl() instead of create_builtin_decl(). (objc_init): Do not initialize objc_ellipsis_node or TAG_EXECCLASS; In ObjC++ mode, call cxx_init() instead of c_objc_common_init(). (objc_finish_file): In ObjC++, call instantiate_pending_templates() and cp_finish_file(). (define_decl, get_static_reference, get_protocol_reference, create_builtin_decl): Remove functions. (objc_start_class_interface, objc_start_category_interface, objc_start_protocol, objc_continue_interface, objc_finish_interface, objc_start_class_implementation, objc_start_category_implementation, objc_continue_implementation, objc_finish_implementation, objc_set_visibility, objc_set_method_type, objc_build_method_signature, objc_add_method_declaration, objc_start_method_definition, objc_add_instance_variable, objc_get_protocol_qualified_type, create_field_decl, start_var_decl, finish_var_decl): New functions. (setup_string_decl): Simplify since it is only called once. (synth_module_prologue): Call build_class_template(); predefine 'id' and 'Class' as typedefs; rename 'temp_type' to 'type'; disable debug hooks for duration of function; fix GNU runtime messenger signatures to correspond to reality; forward-declare '__objc_exec_class' for the GNU runtime; call build_selector_table_decl(); in ObjC++ mode, generate 'extern "C" { ... }' wrappers around synthesized declarations; call build_protocol_template() and build_category_template(). (string_hash, string_eq): New functions. (objc_build_string_object): Check metaclass correctness only once; store string literals in hash table. (objc_build_constructor): Do not convert initializer elements; adjust for ObjC++ impedance mismatch. (build_objc_symtab_template): Call create_field_decl() instead of create_builtin_decl(). (init_objc_symtab): Add missing conversion to initializer element. (build_metadata_decl): Call start_var_decl() instead of define_decl(). (generate_objc_symtab_decl): Do not call build_category_template(); call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(). (build_module_descriptor): Call create_field_decl() instead of grokfield(); call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(); always mark module descriptor as used; move GNU runtime-specific functionality to build_module_initializer_routine(). (build_module_initializer_routine): New function, broken off of build_module_descriptor(). (objc_static_init_needed_p, objc_generate_static_init_call): New functions. (generate_static_references, generate_strings, build_selector_translation_table, generate_descriptor_table, generate_ivars_list, generate_dispatch_table, generate_category): Call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(); build a type directly instead of via groktypename(). (build_selector_reference_decl, build_selector_table_decl, build_class_reference_decl, build_protocol_reference, generate_objc_image_info): Call start_var_decl() instead of build_decl(). (build_selector_reference): For GNU runtime, do not call build_selector_reference_decl(). (build_selector, build_typed_selector_reference): Always convert result to the selector type. (add_objc_string): Cast return value to 'char *'. (build_method_prototype_template, build_selector_template, build_method_template): Use actual selector type for fields pointing to selectors. (finish_objc): For GNU runtime, call build_module_initializer_routine() after build_module_descriptor(). (generate_protocol_list, generate_shared_structures): Call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(); build a type directly instead of via groktypename(). (synth_id_with_class_suffix): Return a string. (get_arg_type_list): For instance methods, use the instance type for 'self'; do not call groktypename_in_parm_context(). (build_objc_string_decl): Squash redeclaration errors in ObjC++. (objc_is_class_name): Use OBJC_TYPE_NAME instead of TYPE_NAME; handle RECORD_TYPEs in ObjC as well as ObjC++. (objc_is_id): New function. (objc_is_object_ptr): Return the canonical type node. (objc_get_class_ivars): Simplify using get_class_ivars(). (get_class_ivars): Remove second parameter; create a fresh copy of the ivar list for each call; do not check for existence of super class. (objc_eh_runtime_type): Mark #ifndef OBJCPLUS. (objc_init_exceptions): When using SJLJ-style exceptions, require the use of '-fobjc-exceptions' flag; do not require it for DWARF-style exceptions. (objc_build_exc_ptr, next_sjlj_build_try_catch_finally): Use objc_object_type instead of objc_id_type. (objc_begin_catch_clause): Convert the incoming PARM_DECL into a VAR_DECL before placing it in the appropriate scope; do not call define_decl(); adjust call to c_begin_compound_stmt(); use objc_object_type instead of objc_id_type. (build_next_objc_exception_stuff): Call create_field_decl() instead of create_builtin_decl(); construct type directly instead of calling groktypename(); use OBJC_VOID_AT_END to mark end of function parameters. (build_private_template): Adjust call to get_class_ivars(); build a type directly instead of via groktypename(). (build_protocol_template, build_method_prototype_list_template, build_method_prototype_template, build_category_template, build_selector_template, build_class_template, build_super_template, build_ivar_template, build_ivar_list_template, build_method_list_template, build_method_template): Call create_field_decl() instead of grokfield(). (objc_method_parm_type): Do not call groktypename(). (generate_descriptor_table): Call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(). (generate_method_descriptors, build_protocol_initializer, generate_dispatch_tables, build_category_initializer, build_shared_structure_initializer): Do not call groktypename(). (generate_protocols): Call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(); do not call groktypename(). (error_with_ivar): Remove last parameter. (check_ivars): Do not iterate ovar CLASS_RAW_IVARS lists in addition to CLASS_IVARS lists; adjust calls to error_with_ivar(). (generate_ivar_lists): Convert one of the initializer elements; do not call groktypename(). (get_arg_type_list, start_method_def, gen_method_def): Account for new representation of variable arguments and '...' in Objective-C methods; add Objective-C++ impedance matching code. (is_objc_type_qualifier): Remove function. (adjust_type_for_id_default): Simplify; there is no longer a need to wade through declspecs. (lookup_interface, start_class, continue_class, finish_class, start_method_def, start_protocol, build_method_decl, objc_add_method, add_instance_variable, build_ivar_reference, is_ivar, is_private, get_super_receiver, objc_build_finally_epilogue): Make into static functions. (receiver_is_class_object): Use new IS_CLASS() macro. (objc_build_message_expr): Tweak ObjC++ message argument handling; call objc_finish_message_expr() instead of finish_message_expr(). (finish_message_expr): Rename to objc_finish_message_expr(); use OBJC_TYPE_NAME and OBJC_SET_TYPE_NAME macros instead of TYPE_NAME. call gen_type_name() instead of gen_declaration(); call objc_is_id() instead of using IS_ID and IS_CLASS; Use objc_class_name instead of calling get_identifier("Class"); handle CONVERT_EXPRs in receiver. (build_objc_method_call, warn_with_method): Do not call groktypename(). (build_ivar_reference): Call convert() instead of clobbering in a type. (hash_init): Initialize string_htab hash table. (add_instance_variable): Simplify parameter list; do not call grokfield(); do not populate CLASS_IVARS list. (start_class): Check for the existence of super class, if one was specified. (continue_class): Use CLASS_RAW_IVARS rather than CLASS_IVARS; do not call build_class_template(); adjust call to get_class_ivars(); call build_decl(), pushdecl() and finish_decl() instead of define_decl(). (finish_class): Call build_decl(), pushdecl() and finish_decl() instead of define_decl(). (add_protocols): Use PROTOCOL_BINFO_ELTS for the tree vector size. (start_protocol): Do not call build_protocol_template(); use PROTOCOL_BINFO_ELTS for the tree vector size. (encode_type_qualifiers): Do not handle the 'const' qualifier here. (encode_pointer): Encode 'const char *' as 'r*', for backwards compatibility. (encode_array): Use HOST_WIDE_INT_PRINT_DEC instead of "%ld". (encode_type): Handle the 'const' qualifier here. (objc_parmlist): New global variable, sued by objc_push_parm and objc_get_parm_info(). (objc_push_parm, objc_get_parm_info): New functions. (objc_expr_last): Remove function. (synth_self_and_ucmd_args): For instance methods, use the instance type for 'self'; call objc_push_parm() instead of push_parm_decl(). (start_method_def): Do not call push_scope(), declare_parm_level(), pop_scope(), push_parm_decl(), store_parm_decls() or objc_expr_last(); just use objc_push_parm() and objc_get_parm_info(). (comp_method_with_proto): Remove function. (objc_types_are_equivalent): Strip away indirections before comparing underlying types. (comp_proto_with_proto): Do not call groktypename(); types are no longer in raw declspec format. (objc_start_function): New function. (really_start_method): Call comp_proto_with_proto() instead of comp_method_with_proto(); call objc_start_function() instead of hand-crafting a function declarator. (continue_method_def, objc_expand_function_end): Remove functions. (get_super_receiver): Call objc_get_current_scope() instead of get_current_scope(); reference 'super_class' field (instead of 'class'). (finish_method_def): Rename to objc_finish_method_definition() and add a function decl parameter; move method encoding call from objc_expand_function_end(). (is_complex_decl, adorn_decl, gen_declarator, gen_declspecs, gen_declaration_1): Remove functions. (tmpbuf, RAW_DECLSPEC): Remove. (gen_declaration): Remove second parameter; simplify to deal with TYPE_P nodes instead of raw declspecs. (gen_type_name, gen_type_name_0): New functions. (gen_method_decl): Remove second parameter; call gen_type_name() instead of gen_declaration_1(). (dump_interface): Adjust calls to gen_declaration() and gen_method_decl(); do not allocate a separate string buffer. (init_objc): Allocate a larger string buffer to accommodate dump_interface(); adjust call to build_module_descriptor(); add call to build_module_initializer_routine() for the GNU runtime. (generate_classref_translation_entry): Do not call start_decl(); call finish_var_decl() instead of finish_decl(); call convert() instead of build_c_cast(). * objc-act.h (CLASS_OWN_IVARS): Remove accessor. (CLASS_BINFO_ELTS): Reduce from 6 to 5, now that CLASS_OWN_IVARS is gone. (OCTI_GNU_INIT_DECL, GNU_INIT_decl): New. (OCTI_ELLIPSIS_NODE, objc_ellipsis_node): Remove. (OCTI_ID_ID, id_type, objc_id_id): Rename to OCTI_ID_NAME, objc_object_type and objc_object_name, respectively. (OCTI_CLS_REF, OCTI_CLASS_NAME, objc_class_reference, objc_class_name): New. (IS_CLASS): New macro. (IS_ID, IS_SUPER): Robustify. (OCTI_EXECCLASS_DECL, execclass_decl): New. (finish_file, start_class, continue_class, finish_class, start_method_def, continue_method_def, finish_method_def, start_protocol, finish_protocol, objc_build_throw_stmt, objc_build_try_catch_finally_stmt, objc_build_synchronized_prologue, objc_build_synchronized_epilogue, objc_build_try_prologue, objc_build_try_epilogue, objc_build_catch_stmt, objc_build_catch_epilogue, objc_build_finally_prologue, objc_build_finally_epilogue, is_ivar, is_private, is_public, add_instance_variable, objc_add_method, get_super_receiver, objc_clear_super_receiver, get_class_ivars_from_name, get_class_reference, get_static_reference, get_object_reference, build_message_expr, finish_message_expr, build_selector_expr, build_ivar_reference, build_keyword_decl, build_method_decl, build_protocol_expr, build_objc_string_object, objc_declare_alias, objc_declare_class, objc_declare_protocols, objc_comptypes, objc_check_decl, build_encode_expr): Remove prototypes. (imp_count, cat_count): Make GGC-aware. (OBJC_SET_TYPE_NAME): New macro. From-SVN: r87168
2004-09-08 02:49:44 +02:00
message, gen_declaration (decl));
1992-01-18 00:15:38 +01:00
}
static void
check_ivars (tree inter, tree imp)
1992-01-18 00:15:38 +01:00
{
Makefile.in (c-parse.o): Depend on $(C_COMMON_H). [gcc/ChangeLog] 2004-09-07 Ziemowit Laski <zlaski@apple.com> * Makefile.in (c-parse.o): Depend on $(C_COMMON_H). * c-parse.in: Include c-common.h instead of objc-act.h. (ivar_decl_list, ivar_decls, ivar_decl, ivars, ivar_declarator, myparms, myparm): Remove %type declarations. (methodtype, optparms, OBJC_TYPE_QUAL, objc_quals, objc_qual, objc_typename, objc_try_catch_stmt, optellipsis): Add %type declarations. (objc_inherit_code, objc_public_flag): Remove. (typespec_nonreserved_nonattr): Call objc_get_protocol_qualified_type() instead of get_static_reference() and get_protocol_reference(). (stmt_nocomp): Call grokparm() on @catch parameter. (objcdef): Move semantic action to objc_finish_implementation(). (classdef): Move semantic action to objc_start_class_interface(), objc_continue_interface(), objc_finish_interface(), objc_start_class_implementation(), objc_continue_implementation(), objc_start_category_interface() and objc_start_category_implementation(). (protocoldef): Move semantic actions to objc_start_protocol() and objc_finish_interface(). (ivar_decl_list): Remove nonterminal. (visibility_spec): Move semantic actions to objc_set_visibility(). (ivar_decls): Remove assignment to $$. (ivar_decl): Rephrase in terms of component_decl; call objc_add_instance_variable(). (ivars, ivar_declarator): Remove nonterminals. (opt_semi): New nonterminal. (methodtype): Remove semantic actions. (methoddef): Move semantic actions to objc_set_method_type(), objc_start_method_definition() and objc_finish_method_definition(). (methodproto): Move semantic actions to objc_set_method_type() and objc_add_method_declaration(). (methoddecl): Use objc_typename instead of typename; move semantic actions to objc_build_method_signature(). (optarglist, myxdecls, mydecl, myparms, myparm): Remove nonterminals. (optparmlist): Express in terms of optparms and optellipsis. (optparms, optellipsis, objc_qual, objc_quals, objc_typename): New nonterminals. (keyworddecl): Use objc_typename instead of typename. (rid_to_yy): Mark RID_IN, RID_OUT, RID_INOUT, RID_BYCOPY, RID_BYREF and RID_ONEWAY as returning OBJC_TYPE_QUAL to yyparse(). [gcc/objc/ChangeLog] 2004-09-07 Ziemowit Laski <zlaski@apple.com> * Make-lang.in (objc/objc-parse.o): Depend on $(C_COMMON_H) instead of objc/objc-act.h. (objc/objc-act.o): Depend on $(HASHTAB_H). * objc-act.c: Include hashtab.h; in ObjC++ mode, include cp-tree.h and objcp-decl.h instead of c-tree.h. (build_module_descriptor, get_class_ivars, synth_id_with_class_suffix, error_with_ivar, gen_method_decl, gen_declaration, setup_string_decl, build_protocol_template): Adjust prototypes. (build_module_initializer_routine, start_class, continue_class, finish_class, start_method_def, objc_start_function, start_protocol, build_method_decl, objc_add_method, add_instance_variable, build_ivar_reference, is_ivar, is_private, get_super_receiver, build_selector_table_decl, objc_push_parm, objc_get_parm_info, gen_type_name, gen_type_name_0, start_var_decl, finish_var_decl, create_field_decl): New prototypes. (objc_expand_function_end, comp_method_with_proto, objc_expr_last, gen_declaration_1, gen_declarator, is_complex_decl, adorn_decl, define_decl, create_builtin_decl, gen_declspecs): Remove prototypes. (TYPE_ID): Rename to OBJECT_TYPEDEF_NAME. (CLASS_TYPEDEF_NAME): New. (TAG_EXECCLASS): Change from a global variable to a #define. (TAG_RETURN_STRUCT): Delete. (TAG_GNUINIT): New, holds '__objc_gnu_init' name. (objc_inherit_code, objc_public_flag): New, moved from c-parse.in. (string_descriptor): New struct. (string_htab): New hash table. (string_hash, string_eq): New prototypes. (generate_struct_by_value_array): Call create_field_decl() instead of create_builtin_decl(). (objc_init): Do not initialize objc_ellipsis_node or TAG_EXECCLASS; In ObjC++ mode, call cxx_init() instead of c_objc_common_init(). (objc_finish_file): In ObjC++, call instantiate_pending_templates() and cp_finish_file(). (define_decl, get_static_reference, get_protocol_reference, create_builtin_decl): Remove functions. (objc_start_class_interface, objc_start_category_interface, objc_start_protocol, objc_continue_interface, objc_finish_interface, objc_start_class_implementation, objc_start_category_implementation, objc_continue_implementation, objc_finish_implementation, objc_set_visibility, objc_set_method_type, objc_build_method_signature, objc_add_method_declaration, objc_start_method_definition, objc_add_instance_variable, objc_get_protocol_qualified_type, create_field_decl, start_var_decl, finish_var_decl): New functions. (setup_string_decl): Simplify since it is only called once. (synth_module_prologue): Call build_class_template(); predefine 'id' and 'Class' as typedefs; rename 'temp_type' to 'type'; disable debug hooks for duration of function; fix GNU runtime messenger signatures to correspond to reality; forward-declare '__objc_exec_class' for the GNU runtime; call build_selector_table_decl(); in ObjC++ mode, generate 'extern "C" { ... }' wrappers around synthesized declarations; call build_protocol_template() and build_category_template(). (string_hash, string_eq): New functions. (objc_build_string_object): Check metaclass correctness only once; store string literals in hash table. (objc_build_constructor): Do not convert initializer elements; adjust for ObjC++ impedance mismatch. (build_objc_symtab_template): Call create_field_decl() instead of create_builtin_decl(). (init_objc_symtab): Add missing conversion to initializer element. (build_metadata_decl): Call start_var_decl() instead of define_decl(). (generate_objc_symtab_decl): Do not call build_category_template(); call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(). (build_module_descriptor): Call create_field_decl() instead of grokfield(); call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(); always mark module descriptor as used; move GNU runtime-specific functionality to build_module_initializer_routine(). (build_module_initializer_routine): New function, broken off of build_module_descriptor(). (objc_static_init_needed_p, objc_generate_static_init_call): New functions. (generate_static_references, generate_strings, build_selector_translation_table, generate_descriptor_table, generate_ivars_list, generate_dispatch_table, generate_category): Call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(); build a type directly instead of via groktypename(). (build_selector_reference_decl, build_selector_table_decl, build_class_reference_decl, build_protocol_reference, generate_objc_image_info): Call start_var_decl() instead of build_decl(). (build_selector_reference): For GNU runtime, do not call build_selector_reference_decl(). (build_selector, build_typed_selector_reference): Always convert result to the selector type. (add_objc_string): Cast return value to 'char *'. (build_method_prototype_template, build_selector_template, build_method_template): Use actual selector type for fields pointing to selectors. (finish_objc): For GNU runtime, call build_module_initializer_routine() after build_module_descriptor(). (generate_protocol_list, generate_shared_structures): Call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(); build a type directly instead of via groktypename(). (synth_id_with_class_suffix): Return a string. (get_arg_type_list): For instance methods, use the instance type for 'self'; do not call groktypename_in_parm_context(). (build_objc_string_decl): Squash redeclaration errors in ObjC++. (objc_is_class_name): Use OBJC_TYPE_NAME instead of TYPE_NAME; handle RECORD_TYPEs in ObjC as well as ObjC++. (objc_is_id): New function. (objc_is_object_ptr): Return the canonical type node. (objc_get_class_ivars): Simplify using get_class_ivars(). (get_class_ivars): Remove second parameter; create a fresh copy of the ivar list for each call; do not check for existence of super class. (objc_eh_runtime_type): Mark #ifndef OBJCPLUS. (objc_init_exceptions): When using SJLJ-style exceptions, require the use of '-fobjc-exceptions' flag; do not require it for DWARF-style exceptions. (objc_build_exc_ptr, next_sjlj_build_try_catch_finally): Use objc_object_type instead of objc_id_type. (objc_begin_catch_clause): Convert the incoming PARM_DECL into a VAR_DECL before placing it in the appropriate scope; do not call define_decl(); adjust call to c_begin_compound_stmt(); use objc_object_type instead of objc_id_type. (build_next_objc_exception_stuff): Call create_field_decl() instead of create_builtin_decl(); construct type directly instead of calling groktypename(); use OBJC_VOID_AT_END to mark end of function parameters. (build_private_template): Adjust call to get_class_ivars(); build a type directly instead of via groktypename(). (build_protocol_template, build_method_prototype_list_template, build_method_prototype_template, build_category_template, build_selector_template, build_class_template, build_super_template, build_ivar_template, build_ivar_list_template, build_method_list_template, build_method_template): Call create_field_decl() instead of grokfield(). (objc_method_parm_type): Do not call groktypename(). (generate_descriptor_table): Call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(). (generate_method_descriptors, build_protocol_initializer, generate_dispatch_tables, build_category_initializer, build_shared_structure_initializer): Do not call groktypename(). (generate_protocols): Call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(); do not call groktypename(). (error_with_ivar): Remove last parameter. (check_ivars): Do not iterate ovar CLASS_RAW_IVARS lists in addition to CLASS_IVARS lists; adjust calls to error_with_ivar(). (generate_ivar_lists): Convert one of the initializer elements; do not call groktypename(). (get_arg_type_list, start_method_def, gen_method_def): Account for new representation of variable arguments and '...' in Objective-C methods; add Objective-C++ impedance matching code. (is_objc_type_qualifier): Remove function. (adjust_type_for_id_default): Simplify; there is no longer a need to wade through declspecs. (lookup_interface, start_class, continue_class, finish_class, start_method_def, start_protocol, build_method_decl, objc_add_method, add_instance_variable, build_ivar_reference, is_ivar, is_private, get_super_receiver, objc_build_finally_epilogue): Make into static functions. (receiver_is_class_object): Use new IS_CLASS() macro. (objc_build_message_expr): Tweak ObjC++ message argument handling; call objc_finish_message_expr() instead of finish_message_expr(). (finish_message_expr): Rename to objc_finish_message_expr(); use OBJC_TYPE_NAME and OBJC_SET_TYPE_NAME macros instead of TYPE_NAME. call gen_type_name() instead of gen_declaration(); call objc_is_id() instead of using IS_ID and IS_CLASS; Use objc_class_name instead of calling get_identifier("Class"); handle CONVERT_EXPRs in receiver. (build_objc_method_call, warn_with_method): Do not call groktypename(). (build_ivar_reference): Call convert() instead of clobbering in a type. (hash_init): Initialize string_htab hash table. (add_instance_variable): Simplify parameter list; do not call grokfield(); do not populate CLASS_IVARS list. (start_class): Check for the existence of super class, if one was specified. (continue_class): Use CLASS_RAW_IVARS rather than CLASS_IVARS; do not call build_class_template(); adjust call to get_class_ivars(); call build_decl(), pushdecl() and finish_decl() instead of define_decl(). (finish_class): Call build_decl(), pushdecl() and finish_decl() instead of define_decl(). (add_protocols): Use PROTOCOL_BINFO_ELTS for the tree vector size. (start_protocol): Do not call build_protocol_template(); use PROTOCOL_BINFO_ELTS for the tree vector size. (encode_type_qualifiers): Do not handle the 'const' qualifier here. (encode_pointer): Encode 'const char *' as 'r*', for backwards compatibility. (encode_array): Use HOST_WIDE_INT_PRINT_DEC instead of "%ld". (encode_type): Handle the 'const' qualifier here. (objc_parmlist): New global variable, sued by objc_push_parm and objc_get_parm_info(). (objc_push_parm, objc_get_parm_info): New functions. (objc_expr_last): Remove function. (synth_self_and_ucmd_args): For instance methods, use the instance type for 'self'; call objc_push_parm() instead of push_parm_decl(). (start_method_def): Do not call push_scope(), declare_parm_level(), pop_scope(), push_parm_decl(), store_parm_decls() or objc_expr_last(); just use objc_push_parm() and objc_get_parm_info(). (comp_method_with_proto): Remove function. (objc_types_are_equivalent): Strip away indirections before comparing underlying types. (comp_proto_with_proto): Do not call groktypename(); types are no longer in raw declspec format. (objc_start_function): New function. (really_start_method): Call comp_proto_with_proto() instead of comp_method_with_proto(); call objc_start_function() instead of hand-crafting a function declarator. (continue_method_def, objc_expand_function_end): Remove functions. (get_super_receiver): Call objc_get_current_scope() instead of get_current_scope(); reference 'super_class' field (instead of 'class'). (finish_method_def): Rename to objc_finish_method_definition() and add a function decl parameter; move method encoding call from objc_expand_function_end(). (is_complex_decl, adorn_decl, gen_declarator, gen_declspecs, gen_declaration_1): Remove functions. (tmpbuf, RAW_DECLSPEC): Remove. (gen_declaration): Remove second parameter; simplify to deal with TYPE_P nodes instead of raw declspecs. (gen_type_name, gen_type_name_0): New functions. (gen_method_decl): Remove second parameter; call gen_type_name() instead of gen_declaration_1(). (dump_interface): Adjust calls to gen_declaration() and gen_method_decl(); do not allocate a separate string buffer. (init_objc): Allocate a larger string buffer to accommodate dump_interface(); adjust call to build_module_descriptor(); add call to build_module_initializer_routine() for the GNU runtime. (generate_classref_translation_entry): Do not call start_decl(); call finish_var_decl() instead of finish_decl(); call convert() instead of build_c_cast(). * objc-act.h (CLASS_OWN_IVARS): Remove accessor. (CLASS_BINFO_ELTS): Reduce from 6 to 5, now that CLASS_OWN_IVARS is gone. (OCTI_GNU_INIT_DECL, GNU_INIT_decl): New. (OCTI_ELLIPSIS_NODE, objc_ellipsis_node): Remove. (OCTI_ID_ID, id_type, objc_id_id): Rename to OCTI_ID_NAME, objc_object_type and objc_object_name, respectively. (OCTI_CLS_REF, OCTI_CLASS_NAME, objc_class_reference, objc_class_name): New. (IS_CLASS): New macro. (IS_ID, IS_SUPER): Robustify. (OCTI_EXECCLASS_DECL, execclass_decl): New. (finish_file, start_class, continue_class, finish_class, start_method_def, continue_method_def, finish_method_def, start_protocol, finish_protocol, objc_build_throw_stmt, objc_build_try_catch_finally_stmt, objc_build_synchronized_prologue, objc_build_synchronized_epilogue, objc_build_try_prologue, objc_build_try_epilogue, objc_build_catch_stmt, objc_build_catch_epilogue, objc_build_finally_prologue, objc_build_finally_epilogue, is_ivar, is_private, is_public, add_instance_variable, objc_add_method, get_super_receiver, objc_clear_super_receiver, get_class_ivars_from_name, get_class_reference, get_static_reference, get_object_reference, build_message_expr, finish_message_expr, build_selector_expr, build_ivar_reference, build_keyword_decl, build_method_decl, build_protocol_expr, build_objc_string_object, objc_declare_alias, objc_declare_class, objc_declare_protocols, objc_comptypes, objc_check_decl, build_encode_expr): Remove prototypes. (imp_count, cat_count): Make GGC-aware. (OBJC_SET_TYPE_NAME): New macro. From-SVN: r87168
2004-09-08 02:49:44 +02:00
tree intdecls = CLASS_RAW_IVARS (inter);
tree impdecls = CLASS_RAW_IVARS (imp);
1992-01-18 00:15:38 +01:00
while (1)
{
tree t1, t2;
#ifdef OBJCPLUS
if (intdecls && TREE_CODE (intdecls) == TYPE_DECL)
intdecls = TREE_CHAIN (intdecls);
#endif
1992-01-18 00:15:38 +01:00
if (intdecls == 0 && impdecls == 0)
break;
if (intdecls == 0 || impdecls == 0)
{
error ("inconsistent instance variable specification");
break;
}
1992-01-18 00:15:38 +01:00
t1 = TREE_TYPE (intdecls); t2 = TREE_TYPE (impdecls);
if (!comptypes (t1, t2)
Makefile.in (c-parse.o): Depend on $(C_COMMON_H). [gcc/ChangeLog] 2004-09-07 Ziemowit Laski <zlaski@apple.com> * Makefile.in (c-parse.o): Depend on $(C_COMMON_H). * c-parse.in: Include c-common.h instead of objc-act.h. (ivar_decl_list, ivar_decls, ivar_decl, ivars, ivar_declarator, myparms, myparm): Remove %type declarations. (methodtype, optparms, OBJC_TYPE_QUAL, objc_quals, objc_qual, objc_typename, objc_try_catch_stmt, optellipsis): Add %type declarations. (objc_inherit_code, objc_public_flag): Remove. (typespec_nonreserved_nonattr): Call objc_get_protocol_qualified_type() instead of get_static_reference() and get_protocol_reference(). (stmt_nocomp): Call grokparm() on @catch parameter. (objcdef): Move semantic action to objc_finish_implementation(). (classdef): Move semantic action to objc_start_class_interface(), objc_continue_interface(), objc_finish_interface(), objc_start_class_implementation(), objc_continue_implementation(), objc_start_category_interface() and objc_start_category_implementation(). (protocoldef): Move semantic actions to objc_start_protocol() and objc_finish_interface(). (ivar_decl_list): Remove nonterminal. (visibility_spec): Move semantic actions to objc_set_visibility(). (ivar_decls): Remove assignment to $$. (ivar_decl): Rephrase in terms of component_decl; call objc_add_instance_variable(). (ivars, ivar_declarator): Remove nonterminals. (opt_semi): New nonterminal. (methodtype): Remove semantic actions. (methoddef): Move semantic actions to objc_set_method_type(), objc_start_method_definition() and objc_finish_method_definition(). (methodproto): Move semantic actions to objc_set_method_type() and objc_add_method_declaration(). (methoddecl): Use objc_typename instead of typename; move semantic actions to objc_build_method_signature(). (optarglist, myxdecls, mydecl, myparms, myparm): Remove nonterminals. (optparmlist): Express in terms of optparms and optellipsis. (optparms, optellipsis, objc_qual, objc_quals, objc_typename): New nonterminals. (keyworddecl): Use objc_typename instead of typename. (rid_to_yy): Mark RID_IN, RID_OUT, RID_INOUT, RID_BYCOPY, RID_BYREF and RID_ONEWAY as returning OBJC_TYPE_QUAL to yyparse(). [gcc/objc/ChangeLog] 2004-09-07 Ziemowit Laski <zlaski@apple.com> * Make-lang.in (objc/objc-parse.o): Depend on $(C_COMMON_H) instead of objc/objc-act.h. (objc/objc-act.o): Depend on $(HASHTAB_H). * objc-act.c: Include hashtab.h; in ObjC++ mode, include cp-tree.h and objcp-decl.h instead of c-tree.h. (build_module_descriptor, get_class_ivars, synth_id_with_class_suffix, error_with_ivar, gen_method_decl, gen_declaration, setup_string_decl, build_protocol_template): Adjust prototypes. (build_module_initializer_routine, start_class, continue_class, finish_class, start_method_def, objc_start_function, start_protocol, build_method_decl, objc_add_method, add_instance_variable, build_ivar_reference, is_ivar, is_private, get_super_receiver, build_selector_table_decl, objc_push_parm, objc_get_parm_info, gen_type_name, gen_type_name_0, start_var_decl, finish_var_decl, create_field_decl): New prototypes. (objc_expand_function_end, comp_method_with_proto, objc_expr_last, gen_declaration_1, gen_declarator, is_complex_decl, adorn_decl, define_decl, create_builtin_decl, gen_declspecs): Remove prototypes. (TYPE_ID): Rename to OBJECT_TYPEDEF_NAME. (CLASS_TYPEDEF_NAME): New. (TAG_EXECCLASS): Change from a global variable to a #define. (TAG_RETURN_STRUCT): Delete. (TAG_GNUINIT): New, holds '__objc_gnu_init' name. (objc_inherit_code, objc_public_flag): New, moved from c-parse.in. (string_descriptor): New struct. (string_htab): New hash table. (string_hash, string_eq): New prototypes. (generate_struct_by_value_array): Call create_field_decl() instead of create_builtin_decl(). (objc_init): Do not initialize objc_ellipsis_node or TAG_EXECCLASS; In ObjC++ mode, call cxx_init() instead of c_objc_common_init(). (objc_finish_file): In ObjC++, call instantiate_pending_templates() and cp_finish_file(). (define_decl, get_static_reference, get_protocol_reference, create_builtin_decl): Remove functions. (objc_start_class_interface, objc_start_category_interface, objc_start_protocol, objc_continue_interface, objc_finish_interface, objc_start_class_implementation, objc_start_category_implementation, objc_continue_implementation, objc_finish_implementation, objc_set_visibility, objc_set_method_type, objc_build_method_signature, objc_add_method_declaration, objc_start_method_definition, objc_add_instance_variable, objc_get_protocol_qualified_type, create_field_decl, start_var_decl, finish_var_decl): New functions. (setup_string_decl): Simplify since it is only called once. (synth_module_prologue): Call build_class_template(); predefine 'id' and 'Class' as typedefs; rename 'temp_type' to 'type'; disable debug hooks for duration of function; fix GNU runtime messenger signatures to correspond to reality; forward-declare '__objc_exec_class' for the GNU runtime; call build_selector_table_decl(); in ObjC++ mode, generate 'extern "C" { ... }' wrappers around synthesized declarations; call build_protocol_template() and build_category_template(). (string_hash, string_eq): New functions. (objc_build_string_object): Check metaclass correctness only once; store string literals in hash table. (objc_build_constructor): Do not convert initializer elements; adjust for ObjC++ impedance mismatch. (build_objc_symtab_template): Call create_field_decl() instead of create_builtin_decl(). (init_objc_symtab): Add missing conversion to initializer element. (build_metadata_decl): Call start_var_decl() instead of define_decl(). (generate_objc_symtab_decl): Do not call build_category_template(); call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(). (build_module_descriptor): Call create_field_decl() instead of grokfield(); call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(); always mark module descriptor as used; move GNU runtime-specific functionality to build_module_initializer_routine(). (build_module_initializer_routine): New function, broken off of build_module_descriptor(). (objc_static_init_needed_p, objc_generate_static_init_call): New functions. (generate_static_references, generate_strings, build_selector_translation_table, generate_descriptor_table, generate_ivars_list, generate_dispatch_table, generate_category): Call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(); build a type directly instead of via groktypename(). (build_selector_reference_decl, build_selector_table_decl, build_class_reference_decl, build_protocol_reference, generate_objc_image_info): Call start_var_decl() instead of build_decl(). (build_selector_reference): For GNU runtime, do not call build_selector_reference_decl(). (build_selector, build_typed_selector_reference): Always convert result to the selector type. (add_objc_string): Cast return value to 'char *'. (build_method_prototype_template, build_selector_template, build_method_template): Use actual selector type for fields pointing to selectors. (finish_objc): For GNU runtime, call build_module_initializer_routine() after build_module_descriptor(). (generate_protocol_list, generate_shared_structures): Call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(); build a type directly instead of via groktypename(). (synth_id_with_class_suffix): Return a string. (get_arg_type_list): For instance methods, use the instance type for 'self'; do not call groktypename_in_parm_context(). (build_objc_string_decl): Squash redeclaration errors in ObjC++. (objc_is_class_name): Use OBJC_TYPE_NAME instead of TYPE_NAME; handle RECORD_TYPEs in ObjC as well as ObjC++. (objc_is_id): New function. (objc_is_object_ptr): Return the canonical type node. (objc_get_class_ivars): Simplify using get_class_ivars(). (get_class_ivars): Remove second parameter; create a fresh copy of the ivar list for each call; do not check for existence of super class. (objc_eh_runtime_type): Mark #ifndef OBJCPLUS. (objc_init_exceptions): When using SJLJ-style exceptions, require the use of '-fobjc-exceptions' flag; do not require it for DWARF-style exceptions. (objc_build_exc_ptr, next_sjlj_build_try_catch_finally): Use objc_object_type instead of objc_id_type. (objc_begin_catch_clause): Convert the incoming PARM_DECL into a VAR_DECL before placing it in the appropriate scope; do not call define_decl(); adjust call to c_begin_compound_stmt(); use objc_object_type instead of objc_id_type. (build_next_objc_exception_stuff): Call create_field_decl() instead of create_builtin_decl(); construct type directly instead of calling groktypename(); use OBJC_VOID_AT_END to mark end of function parameters. (build_private_template): Adjust call to get_class_ivars(); build a type directly instead of via groktypename(). (build_protocol_template, build_method_prototype_list_template, build_method_prototype_template, build_category_template, build_selector_template, build_class_template, build_super_template, build_ivar_template, build_ivar_list_template, build_method_list_template, build_method_template): Call create_field_decl() instead of grokfield(). (objc_method_parm_type): Do not call groktypename(). (generate_descriptor_table): Call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(). (generate_method_descriptors, build_protocol_initializer, generate_dispatch_tables, build_category_initializer, build_shared_structure_initializer): Do not call groktypename(). (generate_protocols): Call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(); do not call groktypename(). (error_with_ivar): Remove last parameter. (check_ivars): Do not iterate ovar CLASS_RAW_IVARS lists in addition to CLASS_IVARS lists; adjust calls to error_with_ivar(). (generate_ivar_lists): Convert one of the initializer elements; do not call groktypename(). (get_arg_type_list, start_method_def, gen_method_def): Account for new representation of variable arguments and '...' in Objective-C methods; add Objective-C++ impedance matching code. (is_objc_type_qualifier): Remove function. (adjust_type_for_id_default): Simplify; there is no longer a need to wade through declspecs. (lookup_interface, start_class, continue_class, finish_class, start_method_def, start_protocol, build_method_decl, objc_add_method, add_instance_variable, build_ivar_reference, is_ivar, is_private, get_super_receiver, objc_build_finally_epilogue): Make into static functions. (receiver_is_class_object): Use new IS_CLASS() macro. (objc_build_message_expr): Tweak ObjC++ message argument handling; call objc_finish_message_expr() instead of finish_message_expr(). (finish_message_expr): Rename to objc_finish_message_expr(); use OBJC_TYPE_NAME and OBJC_SET_TYPE_NAME macros instead of TYPE_NAME. call gen_type_name() instead of gen_declaration(); call objc_is_id() instead of using IS_ID and IS_CLASS; Use objc_class_name instead of calling get_identifier("Class"); handle CONVERT_EXPRs in receiver. (build_objc_method_call, warn_with_method): Do not call groktypename(). (build_ivar_reference): Call convert() instead of clobbering in a type. (hash_init): Initialize string_htab hash table. (add_instance_variable): Simplify parameter list; do not call grokfield(); do not populate CLASS_IVARS list. (start_class): Check for the existence of super class, if one was specified. (continue_class): Use CLASS_RAW_IVARS rather than CLASS_IVARS; do not call build_class_template(); adjust call to get_class_ivars(); call build_decl(), pushdecl() and finish_decl() instead of define_decl(). (finish_class): Call build_decl(), pushdecl() and finish_decl() instead of define_decl(). (add_protocols): Use PROTOCOL_BINFO_ELTS for the tree vector size. (start_protocol): Do not call build_protocol_template(); use PROTOCOL_BINFO_ELTS for the tree vector size. (encode_type_qualifiers): Do not handle the 'const' qualifier here. (encode_pointer): Encode 'const char *' as 'r*', for backwards compatibility. (encode_array): Use HOST_WIDE_INT_PRINT_DEC instead of "%ld". (encode_type): Handle the 'const' qualifier here. (objc_parmlist): New global variable, sued by objc_push_parm and objc_get_parm_info(). (objc_push_parm, objc_get_parm_info): New functions. (objc_expr_last): Remove function. (synth_self_and_ucmd_args): For instance methods, use the instance type for 'self'; call objc_push_parm() instead of push_parm_decl(). (start_method_def): Do not call push_scope(), declare_parm_level(), pop_scope(), push_parm_decl(), store_parm_decls() or objc_expr_last(); just use objc_push_parm() and objc_get_parm_info(). (comp_method_with_proto): Remove function. (objc_types_are_equivalent): Strip away indirections before comparing underlying types. (comp_proto_with_proto): Do not call groktypename(); types are no longer in raw declspec format. (objc_start_function): New function. (really_start_method): Call comp_proto_with_proto() instead of comp_method_with_proto(); call objc_start_function() instead of hand-crafting a function declarator. (continue_method_def, objc_expand_function_end): Remove functions. (get_super_receiver): Call objc_get_current_scope() instead of get_current_scope(); reference 'super_class' field (instead of 'class'). (finish_method_def): Rename to objc_finish_method_definition() and add a function decl parameter; move method encoding call from objc_expand_function_end(). (is_complex_decl, adorn_decl, gen_declarator, gen_declspecs, gen_declaration_1): Remove functions. (tmpbuf, RAW_DECLSPEC): Remove. (gen_declaration): Remove second parameter; simplify to deal with TYPE_P nodes instead of raw declspecs. (gen_type_name, gen_type_name_0): New functions. (gen_method_decl): Remove second parameter; call gen_type_name() instead of gen_declaration_1(). (dump_interface): Adjust calls to gen_declaration() and gen_method_decl(); do not allocate a separate string buffer. (init_objc): Allocate a larger string buffer to accommodate dump_interface(); adjust call to build_module_descriptor(); add call to build_module_initializer_routine() for the GNU runtime. (generate_classref_translation_entry): Do not call start_decl(); call finish_var_decl() instead of finish_decl(); call convert() instead of build_c_cast(). * objc-act.h (CLASS_OWN_IVARS): Remove accessor. (CLASS_BINFO_ELTS): Reduce from 6 to 5, now that CLASS_OWN_IVARS is gone. (OCTI_GNU_INIT_DECL, GNU_INIT_decl): New. (OCTI_ELLIPSIS_NODE, objc_ellipsis_node): Remove. (OCTI_ID_ID, id_type, objc_id_id): Rename to OCTI_ID_NAME, objc_object_type and objc_object_name, respectively. (OCTI_CLS_REF, OCTI_CLASS_NAME, objc_class_reference, objc_class_name): New. (IS_CLASS): New macro. (IS_ID, IS_SUPER): Robustify. (OCTI_EXECCLASS_DECL, execclass_decl): New. (finish_file, start_class, continue_class, finish_class, start_method_def, continue_method_def, finish_method_def, start_protocol, finish_protocol, objc_build_throw_stmt, objc_build_try_catch_finally_stmt, objc_build_synchronized_prologue, objc_build_synchronized_epilogue, objc_build_try_prologue, objc_build_try_epilogue, objc_build_catch_stmt, objc_build_catch_epilogue, objc_build_finally_prologue, objc_build_finally_epilogue, is_ivar, is_private, is_public, add_instance_variable, objc_add_method, get_super_receiver, objc_clear_super_receiver, get_class_ivars_from_name, get_class_reference, get_static_reference, get_object_reference, build_message_expr, finish_message_expr, build_selector_expr, build_ivar_reference, build_keyword_decl, build_method_decl, build_protocol_expr, build_objc_string_object, objc_declare_alias, objc_declare_class, objc_declare_protocols, objc_comptypes, objc_check_decl, build_encode_expr): Remove prototypes. (imp_count, cat_count): Make GGC-aware. (OBJC_SET_TYPE_NAME): New macro. From-SVN: r87168
2004-09-08 02:49:44 +02:00
|| !tree_int_cst_equal (DECL_INITIAL (intdecls),
DECL_INITIAL (impdecls)))
1992-01-18 00:15:38 +01:00
{
if (DECL_NAME (intdecls) == DECL_NAME (impdecls))
{
error_with_ivar ("conflicting instance variable type",
Makefile.in (c-parse.o): Depend on $(C_COMMON_H). [gcc/ChangeLog] 2004-09-07 Ziemowit Laski <zlaski@apple.com> * Makefile.in (c-parse.o): Depend on $(C_COMMON_H). * c-parse.in: Include c-common.h instead of objc-act.h. (ivar_decl_list, ivar_decls, ivar_decl, ivars, ivar_declarator, myparms, myparm): Remove %type declarations. (methodtype, optparms, OBJC_TYPE_QUAL, objc_quals, objc_qual, objc_typename, objc_try_catch_stmt, optellipsis): Add %type declarations. (objc_inherit_code, objc_public_flag): Remove. (typespec_nonreserved_nonattr): Call objc_get_protocol_qualified_type() instead of get_static_reference() and get_protocol_reference(). (stmt_nocomp): Call grokparm() on @catch parameter. (objcdef): Move semantic action to objc_finish_implementation(). (classdef): Move semantic action to objc_start_class_interface(), objc_continue_interface(), objc_finish_interface(), objc_start_class_implementation(), objc_continue_implementation(), objc_start_category_interface() and objc_start_category_implementation(). (protocoldef): Move semantic actions to objc_start_protocol() and objc_finish_interface(). (ivar_decl_list): Remove nonterminal. (visibility_spec): Move semantic actions to objc_set_visibility(). (ivar_decls): Remove assignment to $$. (ivar_decl): Rephrase in terms of component_decl; call objc_add_instance_variable(). (ivars, ivar_declarator): Remove nonterminals. (opt_semi): New nonterminal. (methodtype): Remove semantic actions. (methoddef): Move semantic actions to objc_set_method_type(), objc_start_method_definition() and objc_finish_method_definition(). (methodproto): Move semantic actions to objc_set_method_type() and objc_add_method_declaration(). (methoddecl): Use objc_typename instead of typename; move semantic actions to objc_build_method_signature(). (optarglist, myxdecls, mydecl, myparms, myparm): Remove nonterminals. (optparmlist): Express in terms of optparms and optellipsis. (optparms, optellipsis, objc_qual, objc_quals, objc_typename): New nonterminals. (keyworddecl): Use objc_typename instead of typename. (rid_to_yy): Mark RID_IN, RID_OUT, RID_INOUT, RID_BYCOPY, RID_BYREF and RID_ONEWAY as returning OBJC_TYPE_QUAL to yyparse(). [gcc/objc/ChangeLog] 2004-09-07 Ziemowit Laski <zlaski@apple.com> * Make-lang.in (objc/objc-parse.o): Depend on $(C_COMMON_H) instead of objc/objc-act.h. (objc/objc-act.o): Depend on $(HASHTAB_H). * objc-act.c: Include hashtab.h; in ObjC++ mode, include cp-tree.h and objcp-decl.h instead of c-tree.h. (build_module_descriptor, get_class_ivars, synth_id_with_class_suffix, error_with_ivar, gen_method_decl, gen_declaration, setup_string_decl, build_protocol_template): Adjust prototypes. (build_module_initializer_routine, start_class, continue_class, finish_class, start_method_def, objc_start_function, start_protocol, build_method_decl, objc_add_method, add_instance_variable, build_ivar_reference, is_ivar, is_private, get_super_receiver, build_selector_table_decl, objc_push_parm, objc_get_parm_info, gen_type_name, gen_type_name_0, start_var_decl, finish_var_decl, create_field_decl): New prototypes. (objc_expand_function_end, comp_method_with_proto, objc_expr_last, gen_declaration_1, gen_declarator, is_complex_decl, adorn_decl, define_decl, create_builtin_decl, gen_declspecs): Remove prototypes. (TYPE_ID): Rename to OBJECT_TYPEDEF_NAME. (CLASS_TYPEDEF_NAME): New. (TAG_EXECCLASS): Change from a global variable to a #define. (TAG_RETURN_STRUCT): Delete. (TAG_GNUINIT): New, holds '__objc_gnu_init' name. (objc_inherit_code, objc_public_flag): New, moved from c-parse.in. (string_descriptor): New struct. (string_htab): New hash table. (string_hash, string_eq): New prototypes. (generate_struct_by_value_array): Call create_field_decl() instead of create_builtin_decl(). (objc_init): Do not initialize objc_ellipsis_node or TAG_EXECCLASS; In ObjC++ mode, call cxx_init() instead of c_objc_common_init(). (objc_finish_file): In ObjC++, call instantiate_pending_templates() and cp_finish_file(). (define_decl, get_static_reference, get_protocol_reference, create_builtin_decl): Remove functions. (objc_start_class_interface, objc_start_category_interface, objc_start_protocol, objc_continue_interface, objc_finish_interface, objc_start_class_implementation, objc_start_category_implementation, objc_continue_implementation, objc_finish_implementation, objc_set_visibility, objc_set_method_type, objc_build_method_signature, objc_add_method_declaration, objc_start_method_definition, objc_add_instance_variable, objc_get_protocol_qualified_type, create_field_decl, start_var_decl, finish_var_decl): New functions. (setup_string_decl): Simplify since it is only called once. (synth_module_prologue): Call build_class_template(); predefine 'id' and 'Class' as typedefs; rename 'temp_type' to 'type'; disable debug hooks for duration of function; fix GNU runtime messenger signatures to correspond to reality; forward-declare '__objc_exec_class' for the GNU runtime; call build_selector_table_decl(); in ObjC++ mode, generate 'extern "C" { ... }' wrappers around synthesized declarations; call build_protocol_template() and build_category_template(). (string_hash, string_eq): New functions. (objc_build_string_object): Check metaclass correctness only once; store string literals in hash table. (objc_build_constructor): Do not convert initializer elements; adjust for ObjC++ impedance mismatch. (build_objc_symtab_template): Call create_field_decl() instead of create_builtin_decl(). (init_objc_symtab): Add missing conversion to initializer element. (build_metadata_decl): Call start_var_decl() instead of define_decl(). (generate_objc_symtab_decl): Do not call build_category_template(); call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(). (build_module_descriptor): Call create_field_decl() instead of grokfield(); call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(); always mark module descriptor as used; move GNU runtime-specific functionality to build_module_initializer_routine(). (build_module_initializer_routine): New function, broken off of build_module_descriptor(). (objc_static_init_needed_p, objc_generate_static_init_call): New functions. (generate_static_references, generate_strings, build_selector_translation_table, generate_descriptor_table, generate_ivars_list, generate_dispatch_table, generate_category): Call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(); build a type directly instead of via groktypename(). (build_selector_reference_decl, build_selector_table_decl, build_class_reference_decl, build_protocol_reference, generate_objc_image_info): Call start_var_decl() instead of build_decl(). (build_selector_reference): For GNU runtime, do not call build_selector_reference_decl(). (build_selector, build_typed_selector_reference): Always convert result to the selector type. (add_objc_string): Cast return value to 'char *'. (build_method_prototype_template, build_selector_template, build_method_template): Use actual selector type for fields pointing to selectors. (finish_objc): For GNU runtime, call build_module_initializer_routine() after build_module_descriptor(). (generate_protocol_list, generate_shared_structures): Call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(); build a type directly instead of via groktypename(). (synth_id_with_class_suffix): Return a string. (get_arg_type_list): For instance methods, use the instance type for 'self'; do not call groktypename_in_parm_context(). (build_objc_string_decl): Squash redeclaration errors in ObjC++. (objc_is_class_name): Use OBJC_TYPE_NAME instead of TYPE_NAME; handle RECORD_TYPEs in ObjC as well as ObjC++. (objc_is_id): New function. (objc_is_object_ptr): Return the canonical type node. (objc_get_class_ivars): Simplify using get_class_ivars(). (get_class_ivars): Remove second parameter; create a fresh copy of the ivar list for each call; do not check for existence of super class. (objc_eh_runtime_type): Mark #ifndef OBJCPLUS. (objc_init_exceptions): When using SJLJ-style exceptions, require the use of '-fobjc-exceptions' flag; do not require it for DWARF-style exceptions. (objc_build_exc_ptr, next_sjlj_build_try_catch_finally): Use objc_object_type instead of objc_id_type. (objc_begin_catch_clause): Convert the incoming PARM_DECL into a VAR_DECL before placing it in the appropriate scope; do not call define_decl(); adjust call to c_begin_compound_stmt(); use objc_object_type instead of objc_id_type. (build_next_objc_exception_stuff): Call create_field_decl() instead of create_builtin_decl(); construct type directly instead of calling groktypename(); use OBJC_VOID_AT_END to mark end of function parameters. (build_private_template): Adjust call to get_class_ivars(); build a type directly instead of via groktypename(). (build_protocol_template, build_method_prototype_list_template, build_method_prototype_template, build_category_template, build_selector_template, build_class_template, build_super_template, build_ivar_template, build_ivar_list_template, build_method_list_template, build_method_template): Call create_field_decl() instead of grokfield(). (objc_method_parm_type): Do not call groktypename(). (generate_descriptor_table): Call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(). (generate_method_descriptors, build_protocol_initializer, generate_dispatch_tables, build_category_initializer, build_shared_structure_initializer): Do not call groktypename(). (generate_protocols): Call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(); do not call groktypename(). (error_with_ivar): Remove last parameter. (check_ivars): Do not iterate ovar CLASS_RAW_IVARS lists in addition to CLASS_IVARS lists; adjust calls to error_with_ivar(). (generate_ivar_lists): Convert one of the initializer elements; do not call groktypename(). (get_arg_type_list, start_method_def, gen_method_def): Account for new representation of variable arguments and '...' in Objective-C methods; add Objective-C++ impedance matching code. (is_objc_type_qualifier): Remove function. (adjust_type_for_id_default): Simplify; there is no longer a need to wade through declspecs. (lookup_interface, start_class, continue_class, finish_class, start_method_def, start_protocol, build_method_decl, objc_add_method, add_instance_variable, build_ivar_reference, is_ivar, is_private, get_super_receiver, objc_build_finally_epilogue): Make into static functions. (receiver_is_class_object): Use new IS_CLASS() macro. (objc_build_message_expr): Tweak ObjC++ message argument handling; call objc_finish_message_expr() instead of finish_message_expr(). (finish_message_expr): Rename to objc_finish_message_expr(); use OBJC_TYPE_NAME and OBJC_SET_TYPE_NAME macros instead of TYPE_NAME. call gen_type_name() instead of gen_declaration(); call objc_is_id() instead of using IS_ID and IS_CLASS; Use objc_class_name instead of calling get_identifier("Class"); handle CONVERT_EXPRs in receiver. (build_objc_method_call, warn_with_method): Do not call groktypename(). (build_ivar_reference): Call convert() instead of clobbering in a type. (hash_init): Initialize string_htab hash table. (add_instance_variable): Simplify parameter list; do not call grokfield(); do not populate CLASS_IVARS list. (start_class): Check for the existence of super class, if one was specified. (continue_class): Use CLASS_RAW_IVARS rather than CLASS_IVARS; do not call build_class_template(); adjust call to get_class_ivars(); call build_decl(), pushdecl() and finish_decl() instead of define_decl(). (finish_class): Call build_decl(), pushdecl() and finish_decl() instead of define_decl(). (add_protocols): Use PROTOCOL_BINFO_ELTS for the tree vector size. (start_protocol): Do not call build_protocol_template(); use PROTOCOL_BINFO_ELTS for the tree vector size. (encode_type_qualifiers): Do not handle the 'const' qualifier here. (encode_pointer): Encode 'const char *' as 'r*', for backwards compatibility. (encode_array): Use HOST_WIDE_INT_PRINT_DEC instead of "%ld". (encode_type): Handle the 'const' qualifier here. (objc_parmlist): New global variable, sued by objc_push_parm and objc_get_parm_info(). (objc_push_parm, objc_get_parm_info): New functions. (objc_expr_last): Remove function. (synth_self_and_ucmd_args): For instance methods, use the instance type for 'self'; call objc_push_parm() instead of push_parm_decl(). (start_method_def): Do not call push_scope(), declare_parm_level(), pop_scope(), push_parm_decl(), store_parm_decls() or objc_expr_last(); just use objc_push_parm() and objc_get_parm_info(). (comp_method_with_proto): Remove function. (objc_types_are_equivalent): Strip away indirections before comparing underlying types. (comp_proto_with_proto): Do not call groktypename(); types are no longer in raw declspec format. (objc_start_function): New function. (really_start_method): Call comp_proto_with_proto() instead of comp_method_with_proto(); call objc_start_function() instead of hand-crafting a function declarator. (continue_method_def, objc_expand_function_end): Remove functions. (get_super_receiver): Call objc_get_current_scope() instead of get_current_scope(); reference 'super_class' field (instead of 'class'). (finish_method_def): Rename to objc_finish_method_definition() and add a function decl parameter; move method encoding call from objc_expand_function_end(). (is_complex_decl, adorn_decl, gen_declarator, gen_declspecs, gen_declaration_1): Remove functions. (tmpbuf, RAW_DECLSPEC): Remove. (gen_declaration): Remove second parameter; simplify to deal with TYPE_P nodes instead of raw declspecs. (gen_type_name, gen_type_name_0): New functions. (gen_method_decl): Remove second parameter; call gen_type_name() instead of gen_declaration_1(). (dump_interface): Adjust calls to gen_declaration() and gen_method_decl(); do not allocate a separate string buffer. (init_objc): Allocate a larger string buffer to accommodate dump_interface(); adjust call to build_module_descriptor(); add call to build_module_initializer_routine() for the GNU runtime. (generate_classref_translation_entry): Do not call start_decl(); call finish_var_decl() instead of finish_decl(); call convert() instead of build_c_cast(). * objc-act.h (CLASS_OWN_IVARS): Remove accessor. (CLASS_BINFO_ELTS): Reduce from 6 to 5, now that CLASS_OWN_IVARS is gone. (OCTI_GNU_INIT_DECL, GNU_INIT_decl): New. (OCTI_ELLIPSIS_NODE, objc_ellipsis_node): Remove. (OCTI_ID_ID, id_type, objc_id_id): Rename to OCTI_ID_NAME, objc_object_type and objc_object_name, respectively. (OCTI_CLS_REF, OCTI_CLASS_NAME, objc_class_reference, objc_class_name): New. (IS_CLASS): New macro. (IS_ID, IS_SUPER): Robustify. (OCTI_EXECCLASS_DECL, execclass_decl): New. (finish_file, start_class, continue_class, finish_class, start_method_def, continue_method_def, finish_method_def, start_protocol, finish_protocol, objc_build_throw_stmt, objc_build_try_catch_finally_stmt, objc_build_synchronized_prologue, objc_build_synchronized_epilogue, objc_build_try_prologue, objc_build_try_epilogue, objc_build_catch_stmt, objc_build_catch_epilogue, objc_build_finally_prologue, objc_build_finally_epilogue, is_ivar, is_private, is_public, add_instance_variable, objc_add_method, get_super_receiver, objc_clear_super_receiver, get_class_ivars_from_name, get_class_reference, get_static_reference, get_object_reference, build_message_expr, finish_message_expr, build_selector_expr, build_ivar_reference, build_keyword_decl, build_method_decl, build_protocol_expr, build_objc_string_object, objc_declare_alias, objc_declare_class, objc_declare_protocols, objc_comptypes, objc_check_decl, build_encode_expr): Remove prototypes. (imp_count, cat_count): Make GGC-aware. (OBJC_SET_TYPE_NAME): New macro. From-SVN: r87168
2004-09-08 02:49:44 +02:00
impdecls);
1992-01-18 00:15:38 +01:00
error_with_ivar ("previous declaration of",
Makefile.in (c-parse.o): Depend on $(C_COMMON_H). [gcc/ChangeLog] 2004-09-07 Ziemowit Laski <zlaski@apple.com> * Makefile.in (c-parse.o): Depend on $(C_COMMON_H). * c-parse.in: Include c-common.h instead of objc-act.h. (ivar_decl_list, ivar_decls, ivar_decl, ivars, ivar_declarator, myparms, myparm): Remove %type declarations. (methodtype, optparms, OBJC_TYPE_QUAL, objc_quals, objc_qual, objc_typename, objc_try_catch_stmt, optellipsis): Add %type declarations. (objc_inherit_code, objc_public_flag): Remove. (typespec_nonreserved_nonattr): Call objc_get_protocol_qualified_type() instead of get_static_reference() and get_protocol_reference(). (stmt_nocomp): Call grokparm() on @catch parameter. (objcdef): Move semantic action to objc_finish_implementation(). (classdef): Move semantic action to objc_start_class_interface(), objc_continue_interface(), objc_finish_interface(), objc_start_class_implementation(), objc_continue_implementation(), objc_start_category_interface() and objc_start_category_implementation(). (protocoldef): Move semantic actions to objc_start_protocol() and objc_finish_interface(). (ivar_decl_list): Remove nonterminal. (visibility_spec): Move semantic actions to objc_set_visibility(). (ivar_decls): Remove assignment to $$. (ivar_decl): Rephrase in terms of component_decl; call objc_add_instance_variable(). (ivars, ivar_declarator): Remove nonterminals. (opt_semi): New nonterminal. (methodtype): Remove semantic actions. (methoddef): Move semantic actions to objc_set_method_type(), objc_start_method_definition() and objc_finish_method_definition(). (methodproto): Move semantic actions to objc_set_method_type() and objc_add_method_declaration(). (methoddecl): Use objc_typename instead of typename; move semantic actions to objc_build_method_signature(). (optarglist, myxdecls, mydecl, myparms, myparm): Remove nonterminals. (optparmlist): Express in terms of optparms and optellipsis. (optparms, optellipsis, objc_qual, objc_quals, objc_typename): New nonterminals. (keyworddecl): Use objc_typename instead of typename. (rid_to_yy): Mark RID_IN, RID_OUT, RID_INOUT, RID_BYCOPY, RID_BYREF and RID_ONEWAY as returning OBJC_TYPE_QUAL to yyparse(). [gcc/objc/ChangeLog] 2004-09-07 Ziemowit Laski <zlaski@apple.com> * Make-lang.in (objc/objc-parse.o): Depend on $(C_COMMON_H) instead of objc/objc-act.h. (objc/objc-act.o): Depend on $(HASHTAB_H). * objc-act.c: Include hashtab.h; in ObjC++ mode, include cp-tree.h and objcp-decl.h instead of c-tree.h. (build_module_descriptor, get_class_ivars, synth_id_with_class_suffix, error_with_ivar, gen_method_decl, gen_declaration, setup_string_decl, build_protocol_template): Adjust prototypes. (build_module_initializer_routine, start_class, continue_class, finish_class, start_method_def, objc_start_function, start_protocol, build_method_decl, objc_add_method, add_instance_variable, build_ivar_reference, is_ivar, is_private, get_super_receiver, build_selector_table_decl, objc_push_parm, objc_get_parm_info, gen_type_name, gen_type_name_0, start_var_decl, finish_var_decl, create_field_decl): New prototypes. (objc_expand_function_end, comp_method_with_proto, objc_expr_last, gen_declaration_1, gen_declarator, is_complex_decl, adorn_decl, define_decl, create_builtin_decl, gen_declspecs): Remove prototypes. (TYPE_ID): Rename to OBJECT_TYPEDEF_NAME. (CLASS_TYPEDEF_NAME): New. (TAG_EXECCLASS): Change from a global variable to a #define. (TAG_RETURN_STRUCT): Delete. (TAG_GNUINIT): New, holds '__objc_gnu_init' name. (objc_inherit_code, objc_public_flag): New, moved from c-parse.in. (string_descriptor): New struct. (string_htab): New hash table. (string_hash, string_eq): New prototypes. (generate_struct_by_value_array): Call create_field_decl() instead of create_builtin_decl(). (objc_init): Do not initialize objc_ellipsis_node or TAG_EXECCLASS; In ObjC++ mode, call cxx_init() instead of c_objc_common_init(). (objc_finish_file): In ObjC++, call instantiate_pending_templates() and cp_finish_file(). (define_decl, get_static_reference, get_protocol_reference, create_builtin_decl): Remove functions. (objc_start_class_interface, objc_start_category_interface, objc_start_protocol, objc_continue_interface, objc_finish_interface, objc_start_class_implementation, objc_start_category_implementation, objc_continue_implementation, objc_finish_implementation, objc_set_visibility, objc_set_method_type, objc_build_method_signature, objc_add_method_declaration, objc_start_method_definition, objc_add_instance_variable, objc_get_protocol_qualified_type, create_field_decl, start_var_decl, finish_var_decl): New functions. (setup_string_decl): Simplify since it is only called once. (synth_module_prologue): Call build_class_template(); predefine 'id' and 'Class' as typedefs; rename 'temp_type' to 'type'; disable debug hooks for duration of function; fix GNU runtime messenger signatures to correspond to reality; forward-declare '__objc_exec_class' for the GNU runtime; call build_selector_table_decl(); in ObjC++ mode, generate 'extern "C" { ... }' wrappers around synthesized declarations; call build_protocol_template() and build_category_template(). (string_hash, string_eq): New functions. (objc_build_string_object): Check metaclass correctness only once; store string literals in hash table. (objc_build_constructor): Do not convert initializer elements; adjust for ObjC++ impedance mismatch. (build_objc_symtab_template): Call create_field_decl() instead of create_builtin_decl(). (init_objc_symtab): Add missing conversion to initializer element. (build_metadata_decl): Call start_var_decl() instead of define_decl(). (generate_objc_symtab_decl): Do not call build_category_template(); call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(). (build_module_descriptor): Call create_field_decl() instead of grokfield(); call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(); always mark module descriptor as used; move GNU runtime-specific functionality to build_module_initializer_routine(). (build_module_initializer_routine): New function, broken off of build_module_descriptor(). (objc_static_init_needed_p, objc_generate_static_init_call): New functions. (generate_static_references, generate_strings, build_selector_translation_table, generate_descriptor_table, generate_ivars_list, generate_dispatch_table, generate_category): Call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(); build a type directly instead of via groktypename(). (build_selector_reference_decl, build_selector_table_decl, build_class_reference_decl, build_protocol_reference, generate_objc_image_info): Call start_var_decl() instead of build_decl(). (build_selector_reference): For GNU runtime, do not call build_selector_reference_decl(). (build_selector, build_typed_selector_reference): Always convert result to the selector type. (add_objc_string): Cast return value to 'char *'. (build_method_prototype_template, build_selector_template, build_method_template): Use actual selector type for fields pointing to selectors. (finish_objc): For GNU runtime, call build_module_initializer_routine() after build_module_descriptor(). (generate_protocol_list, generate_shared_structures): Call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(); build a type directly instead of via groktypename(). (synth_id_with_class_suffix): Return a string. (get_arg_type_list): For instance methods, use the instance type for 'self'; do not call groktypename_in_parm_context(). (build_objc_string_decl): Squash redeclaration errors in ObjC++. (objc_is_class_name): Use OBJC_TYPE_NAME instead of TYPE_NAME; handle RECORD_TYPEs in ObjC as well as ObjC++. (objc_is_id): New function. (objc_is_object_ptr): Return the canonical type node. (objc_get_class_ivars): Simplify using get_class_ivars(). (get_class_ivars): Remove second parameter; create a fresh copy of the ivar list for each call; do not check for existence of super class. (objc_eh_runtime_type): Mark #ifndef OBJCPLUS. (objc_init_exceptions): When using SJLJ-style exceptions, require the use of '-fobjc-exceptions' flag; do not require it for DWARF-style exceptions. (objc_build_exc_ptr, next_sjlj_build_try_catch_finally): Use objc_object_type instead of objc_id_type. (objc_begin_catch_clause): Convert the incoming PARM_DECL into a VAR_DECL before placing it in the appropriate scope; do not call define_decl(); adjust call to c_begin_compound_stmt(); use objc_object_type instead of objc_id_type. (build_next_objc_exception_stuff): Call create_field_decl() instead of create_builtin_decl(); construct type directly instead of calling groktypename(); use OBJC_VOID_AT_END to mark end of function parameters. (build_private_template): Adjust call to get_class_ivars(); build a type directly instead of via groktypename(). (build_protocol_template, build_method_prototype_list_template, build_method_prototype_template, build_category_template, build_selector_template, build_class_template, build_super_template, build_ivar_template, build_ivar_list_template, build_method_list_template, build_method_template): Call create_field_decl() instead of grokfield(). (objc_method_parm_type): Do not call groktypename(). (generate_descriptor_table): Call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(). (generate_method_descriptors, build_protocol_initializer, generate_dispatch_tables, build_category_initializer, build_shared_structure_initializer): Do not call groktypename(). (generate_protocols): Call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(); do not call groktypename(). (error_with_ivar): Remove last parameter. (check_ivars): Do not iterate ovar CLASS_RAW_IVARS lists in addition to CLASS_IVARS lists; adjust calls to error_with_ivar(). (generate_ivar_lists): Convert one of the initializer elements; do not call groktypename(). (get_arg_type_list, start_method_def, gen_method_def): Account for new representation of variable arguments and '...' in Objective-C methods; add Objective-C++ impedance matching code. (is_objc_type_qualifier): Remove function. (adjust_type_for_id_default): Simplify; there is no longer a need to wade through declspecs. (lookup_interface, start_class, continue_class, finish_class, start_method_def, start_protocol, build_method_decl, objc_add_method, add_instance_variable, build_ivar_reference, is_ivar, is_private, get_super_receiver, objc_build_finally_epilogue): Make into static functions. (receiver_is_class_object): Use new IS_CLASS() macro. (objc_build_message_expr): Tweak ObjC++ message argument handling; call objc_finish_message_expr() instead of finish_message_expr(). (finish_message_expr): Rename to objc_finish_message_expr(); use OBJC_TYPE_NAME and OBJC_SET_TYPE_NAME macros instead of TYPE_NAME. call gen_type_name() instead of gen_declaration(); call objc_is_id() instead of using IS_ID and IS_CLASS; Use objc_class_name instead of calling get_identifier("Class"); handle CONVERT_EXPRs in receiver. (build_objc_method_call, warn_with_method): Do not call groktypename(). (build_ivar_reference): Call convert() instead of clobbering in a type. (hash_init): Initialize string_htab hash table. (add_instance_variable): Simplify parameter list; do not call grokfield(); do not populate CLASS_IVARS list. (start_class): Check for the existence of super class, if one was specified. (continue_class): Use CLASS_RAW_IVARS rather than CLASS_IVARS; do not call build_class_template(); adjust call to get_class_ivars(); call build_decl(), pushdecl() and finish_decl() instead of define_decl(). (finish_class): Call build_decl(), pushdecl() and finish_decl() instead of define_decl(). (add_protocols): Use PROTOCOL_BINFO_ELTS for the tree vector size. (start_protocol): Do not call build_protocol_template(); use PROTOCOL_BINFO_ELTS for the tree vector size. (encode_type_qualifiers): Do not handle the 'const' qualifier here. (encode_pointer): Encode 'const char *' as 'r*', for backwards compatibility. (encode_array): Use HOST_WIDE_INT_PRINT_DEC instead of "%ld". (encode_type): Handle the 'const' qualifier here. (objc_parmlist): New global variable, sued by objc_push_parm and objc_get_parm_info(). (objc_push_parm, objc_get_parm_info): New functions. (objc_expr_last): Remove function. (synth_self_and_ucmd_args): For instance methods, use the instance type for 'self'; call objc_push_parm() instead of push_parm_decl(). (start_method_def): Do not call push_scope(), declare_parm_level(), pop_scope(), push_parm_decl(), store_parm_decls() or objc_expr_last(); just use objc_push_parm() and objc_get_parm_info(). (comp_method_with_proto): Remove function. (objc_types_are_equivalent): Strip away indirections before comparing underlying types. (comp_proto_with_proto): Do not call groktypename(); types are no longer in raw declspec format. (objc_start_function): New function. (really_start_method): Call comp_proto_with_proto() instead of comp_method_with_proto(); call objc_start_function() instead of hand-crafting a function declarator. (continue_method_def, objc_expand_function_end): Remove functions. (get_super_receiver): Call objc_get_current_scope() instead of get_current_scope(); reference 'super_class' field (instead of 'class'). (finish_method_def): Rename to objc_finish_method_definition() and add a function decl parameter; move method encoding call from objc_expand_function_end(). (is_complex_decl, adorn_decl, gen_declarator, gen_declspecs, gen_declaration_1): Remove functions. (tmpbuf, RAW_DECLSPEC): Remove. (gen_declaration): Remove second parameter; simplify to deal with TYPE_P nodes instead of raw declspecs. (gen_type_name, gen_type_name_0): New functions. (gen_method_decl): Remove second parameter; call gen_type_name() instead of gen_declaration_1(). (dump_interface): Adjust calls to gen_declaration() and gen_method_decl(); do not allocate a separate string buffer. (init_objc): Allocate a larger string buffer to accommodate dump_interface(); adjust call to build_module_descriptor(); add call to build_module_initializer_routine() for the GNU runtime. (generate_classref_translation_entry): Do not call start_decl(); call finish_var_decl() instead of finish_decl(); call convert() instead of build_c_cast(). * objc-act.h (CLASS_OWN_IVARS): Remove accessor. (CLASS_BINFO_ELTS): Reduce from 6 to 5, now that CLASS_OWN_IVARS is gone. (OCTI_GNU_INIT_DECL, GNU_INIT_decl): New. (OCTI_ELLIPSIS_NODE, objc_ellipsis_node): Remove. (OCTI_ID_ID, id_type, objc_id_id): Rename to OCTI_ID_NAME, objc_object_type and objc_object_name, respectively. (OCTI_CLS_REF, OCTI_CLASS_NAME, objc_class_reference, objc_class_name): New. (IS_CLASS): New macro. (IS_ID, IS_SUPER): Robustify. (OCTI_EXECCLASS_DECL, execclass_decl): New. (finish_file, start_class, continue_class, finish_class, start_method_def, continue_method_def, finish_method_def, start_protocol, finish_protocol, objc_build_throw_stmt, objc_build_try_catch_finally_stmt, objc_build_synchronized_prologue, objc_build_synchronized_epilogue, objc_build_try_prologue, objc_build_try_epilogue, objc_build_catch_stmt, objc_build_catch_epilogue, objc_build_finally_prologue, objc_build_finally_epilogue, is_ivar, is_private, is_public, add_instance_variable, objc_add_method, get_super_receiver, objc_clear_super_receiver, get_class_ivars_from_name, get_class_reference, get_static_reference, get_object_reference, build_message_expr, finish_message_expr, build_selector_expr, build_ivar_reference, build_keyword_decl, build_method_decl, build_protocol_expr, build_objc_string_object, objc_declare_alias, objc_declare_class, objc_declare_protocols, objc_comptypes, objc_check_decl, build_encode_expr): Remove prototypes. (imp_count, cat_count): Make GGC-aware. (OBJC_SET_TYPE_NAME): New macro. From-SVN: r87168
2004-09-08 02:49:44 +02:00
intdecls);
1992-01-18 00:15:38 +01:00
}
else /* both the type and the name don't match */
{
error ("inconsistent instance variable specification");
break;
}
}
1992-01-18 00:15:38 +01:00
else if (DECL_NAME (intdecls) != DECL_NAME (impdecls))
{
error_with_ivar ("conflicting instance variable name",
Makefile.in (c-parse.o): Depend on $(C_COMMON_H). [gcc/ChangeLog] 2004-09-07 Ziemowit Laski <zlaski@apple.com> * Makefile.in (c-parse.o): Depend on $(C_COMMON_H). * c-parse.in: Include c-common.h instead of objc-act.h. (ivar_decl_list, ivar_decls, ivar_decl, ivars, ivar_declarator, myparms, myparm): Remove %type declarations. (methodtype, optparms, OBJC_TYPE_QUAL, objc_quals, objc_qual, objc_typename, objc_try_catch_stmt, optellipsis): Add %type declarations. (objc_inherit_code, objc_public_flag): Remove. (typespec_nonreserved_nonattr): Call objc_get_protocol_qualified_type() instead of get_static_reference() and get_protocol_reference(). (stmt_nocomp): Call grokparm() on @catch parameter. (objcdef): Move semantic action to objc_finish_implementation(). (classdef): Move semantic action to objc_start_class_interface(), objc_continue_interface(), objc_finish_interface(), objc_start_class_implementation(), objc_continue_implementation(), objc_start_category_interface() and objc_start_category_implementation(). (protocoldef): Move semantic actions to objc_start_protocol() and objc_finish_interface(). (ivar_decl_list): Remove nonterminal. (visibility_spec): Move semantic actions to objc_set_visibility(). (ivar_decls): Remove assignment to $$. (ivar_decl): Rephrase in terms of component_decl; call objc_add_instance_variable(). (ivars, ivar_declarator): Remove nonterminals. (opt_semi): New nonterminal. (methodtype): Remove semantic actions. (methoddef): Move semantic actions to objc_set_method_type(), objc_start_method_definition() and objc_finish_method_definition(). (methodproto): Move semantic actions to objc_set_method_type() and objc_add_method_declaration(). (methoddecl): Use objc_typename instead of typename; move semantic actions to objc_build_method_signature(). (optarglist, myxdecls, mydecl, myparms, myparm): Remove nonterminals. (optparmlist): Express in terms of optparms and optellipsis. (optparms, optellipsis, objc_qual, objc_quals, objc_typename): New nonterminals. (keyworddecl): Use objc_typename instead of typename. (rid_to_yy): Mark RID_IN, RID_OUT, RID_INOUT, RID_BYCOPY, RID_BYREF and RID_ONEWAY as returning OBJC_TYPE_QUAL to yyparse(). [gcc/objc/ChangeLog] 2004-09-07 Ziemowit Laski <zlaski@apple.com> * Make-lang.in (objc/objc-parse.o): Depend on $(C_COMMON_H) instead of objc/objc-act.h. (objc/objc-act.o): Depend on $(HASHTAB_H). * objc-act.c: Include hashtab.h; in ObjC++ mode, include cp-tree.h and objcp-decl.h instead of c-tree.h. (build_module_descriptor, get_class_ivars, synth_id_with_class_suffix, error_with_ivar, gen_method_decl, gen_declaration, setup_string_decl, build_protocol_template): Adjust prototypes. (build_module_initializer_routine, start_class, continue_class, finish_class, start_method_def, objc_start_function, start_protocol, build_method_decl, objc_add_method, add_instance_variable, build_ivar_reference, is_ivar, is_private, get_super_receiver, build_selector_table_decl, objc_push_parm, objc_get_parm_info, gen_type_name, gen_type_name_0, start_var_decl, finish_var_decl, create_field_decl): New prototypes. (objc_expand_function_end, comp_method_with_proto, objc_expr_last, gen_declaration_1, gen_declarator, is_complex_decl, adorn_decl, define_decl, create_builtin_decl, gen_declspecs): Remove prototypes. (TYPE_ID): Rename to OBJECT_TYPEDEF_NAME. (CLASS_TYPEDEF_NAME): New. (TAG_EXECCLASS): Change from a global variable to a #define. (TAG_RETURN_STRUCT): Delete. (TAG_GNUINIT): New, holds '__objc_gnu_init' name. (objc_inherit_code, objc_public_flag): New, moved from c-parse.in. (string_descriptor): New struct. (string_htab): New hash table. (string_hash, string_eq): New prototypes. (generate_struct_by_value_array): Call create_field_decl() instead of create_builtin_decl(). (objc_init): Do not initialize objc_ellipsis_node or TAG_EXECCLASS; In ObjC++ mode, call cxx_init() instead of c_objc_common_init(). (objc_finish_file): In ObjC++, call instantiate_pending_templates() and cp_finish_file(). (define_decl, get_static_reference, get_protocol_reference, create_builtin_decl): Remove functions. (objc_start_class_interface, objc_start_category_interface, objc_start_protocol, objc_continue_interface, objc_finish_interface, objc_start_class_implementation, objc_start_category_implementation, objc_continue_implementation, objc_finish_implementation, objc_set_visibility, objc_set_method_type, objc_build_method_signature, objc_add_method_declaration, objc_start_method_definition, objc_add_instance_variable, objc_get_protocol_qualified_type, create_field_decl, start_var_decl, finish_var_decl): New functions. (setup_string_decl): Simplify since it is only called once. (synth_module_prologue): Call build_class_template(); predefine 'id' and 'Class' as typedefs; rename 'temp_type' to 'type'; disable debug hooks for duration of function; fix GNU runtime messenger signatures to correspond to reality; forward-declare '__objc_exec_class' for the GNU runtime; call build_selector_table_decl(); in ObjC++ mode, generate 'extern "C" { ... }' wrappers around synthesized declarations; call build_protocol_template() and build_category_template(). (string_hash, string_eq): New functions. (objc_build_string_object): Check metaclass correctness only once; store string literals in hash table. (objc_build_constructor): Do not convert initializer elements; adjust for ObjC++ impedance mismatch. (build_objc_symtab_template): Call create_field_decl() instead of create_builtin_decl(). (init_objc_symtab): Add missing conversion to initializer element. (build_metadata_decl): Call start_var_decl() instead of define_decl(). (generate_objc_symtab_decl): Do not call build_category_template(); call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(). (build_module_descriptor): Call create_field_decl() instead of grokfield(); call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(); always mark module descriptor as used; move GNU runtime-specific functionality to build_module_initializer_routine(). (build_module_initializer_routine): New function, broken off of build_module_descriptor(). (objc_static_init_needed_p, objc_generate_static_init_call): New functions. (generate_static_references, generate_strings, build_selector_translation_table, generate_descriptor_table, generate_ivars_list, generate_dispatch_table, generate_category): Call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(); build a type directly instead of via groktypename(). (build_selector_reference_decl, build_selector_table_decl, build_class_reference_decl, build_protocol_reference, generate_objc_image_info): Call start_var_decl() instead of build_decl(). (build_selector_reference): For GNU runtime, do not call build_selector_reference_decl(). (build_selector, build_typed_selector_reference): Always convert result to the selector type. (add_objc_string): Cast return value to 'char *'. (build_method_prototype_template, build_selector_template, build_method_template): Use actual selector type for fields pointing to selectors. (finish_objc): For GNU runtime, call build_module_initializer_routine() after build_module_descriptor(). (generate_protocol_list, generate_shared_structures): Call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(); build a type directly instead of via groktypename(). (synth_id_with_class_suffix): Return a string. (get_arg_type_list): For instance methods, use the instance type for 'self'; do not call groktypename_in_parm_context(). (build_objc_string_decl): Squash redeclaration errors in ObjC++. (objc_is_class_name): Use OBJC_TYPE_NAME instead of TYPE_NAME; handle RECORD_TYPEs in ObjC as well as ObjC++. (objc_is_id): New function. (objc_is_object_ptr): Return the canonical type node. (objc_get_class_ivars): Simplify using get_class_ivars(). (get_class_ivars): Remove second parameter; create a fresh copy of the ivar list for each call; do not check for existence of super class. (objc_eh_runtime_type): Mark #ifndef OBJCPLUS. (objc_init_exceptions): When using SJLJ-style exceptions, require the use of '-fobjc-exceptions' flag; do not require it for DWARF-style exceptions. (objc_build_exc_ptr, next_sjlj_build_try_catch_finally): Use objc_object_type instead of objc_id_type. (objc_begin_catch_clause): Convert the incoming PARM_DECL into a VAR_DECL before placing it in the appropriate scope; do not call define_decl(); adjust call to c_begin_compound_stmt(); use objc_object_type instead of objc_id_type. (build_next_objc_exception_stuff): Call create_field_decl() instead of create_builtin_decl(); construct type directly instead of calling groktypename(); use OBJC_VOID_AT_END to mark end of function parameters. (build_private_template): Adjust call to get_class_ivars(); build a type directly instead of via groktypename(). (build_protocol_template, build_method_prototype_list_template, build_method_prototype_template, build_category_template, build_selector_template, build_class_template, build_super_template, build_ivar_template, build_ivar_list_template, build_method_list_template, build_method_template): Call create_field_decl() instead of grokfield(). (objc_method_parm_type): Do not call groktypename(). (generate_descriptor_table): Call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(). (generate_method_descriptors, build_protocol_initializer, generate_dispatch_tables, build_category_initializer, build_shared_structure_initializer): Do not call groktypename(). (generate_protocols): Call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(); do not call groktypename(). (error_with_ivar): Remove last parameter. (check_ivars): Do not iterate ovar CLASS_RAW_IVARS lists in addition to CLASS_IVARS lists; adjust calls to error_with_ivar(). (generate_ivar_lists): Convert one of the initializer elements; do not call groktypename(). (get_arg_type_list, start_method_def, gen_method_def): Account for new representation of variable arguments and '...' in Objective-C methods; add Objective-C++ impedance matching code. (is_objc_type_qualifier): Remove function. (adjust_type_for_id_default): Simplify; there is no longer a need to wade through declspecs. (lookup_interface, start_class, continue_class, finish_class, start_method_def, start_protocol, build_method_decl, objc_add_method, add_instance_variable, build_ivar_reference, is_ivar, is_private, get_super_receiver, objc_build_finally_epilogue): Make into static functions. (receiver_is_class_object): Use new IS_CLASS() macro. (objc_build_message_expr): Tweak ObjC++ message argument handling; call objc_finish_message_expr() instead of finish_message_expr(). (finish_message_expr): Rename to objc_finish_message_expr(); use OBJC_TYPE_NAME and OBJC_SET_TYPE_NAME macros instead of TYPE_NAME. call gen_type_name() instead of gen_declaration(); call objc_is_id() instead of using IS_ID and IS_CLASS; Use objc_class_name instead of calling get_identifier("Class"); handle CONVERT_EXPRs in receiver. (build_objc_method_call, warn_with_method): Do not call groktypename(). (build_ivar_reference): Call convert() instead of clobbering in a type. (hash_init): Initialize string_htab hash table. (add_instance_variable): Simplify parameter list; do not call grokfield(); do not populate CLASS_IVARS list. (start_class): Check for the existence of super class, if one was specified. (continue_class): Use CLASS_RAW_IVARS rather than CLASS_IVARS; do not call build_class_template(); adjust call to get_class_ivars(); call build_decl(), pushdecl() and finish_decl() instead of define_decl(). (finish_class): Call build_decl(), pushdecl() and finish_decl() instead of define_decl(). (add_protocols): Use PROTOCOL_BINFO_ELTS for the tree vector size. (start_protocol): Do not call build_protocol_template(); use PROTOCOL_BINFO_ELTS for the tree vector size. (encode_type_qualifiers): Do not handle the 'const' qualifier here. (encode_pointer): Encode 'const char *' as 'r*', for backwards compatibility. (encode_array): Use HOST_WIDE_INT_PRINT_DEC instead of "%ld". (encode_type): Handle the 'const' qualifier here. (objc_parmlist): New global variable, sued by objc_push_parm and objc_get_parm_info(). (objc_push_parm, objc_get_parm_info): New functions. (objc_expr_last): Remove function. (synth_self_and_ucmd_args): For instance methods, use the instance type for 'self'; call objc_push_parm() instead of push_parm_decl(). (start_method_def): Do not call push_scope(), declare_parm_level(), pop_scope(), push_parm_decl(), store_parm_decls() or objc_expr_last(); just use objc_push_parm() and objc_get_parm_info(). (comp_method_with_proto): Remove function. (objc_types_are_equivalent): Strip away indirections before comparing underlying types. (comp_proto_with_proto): Do not call groktypename(); types are no longer in raw declspec format. (objc_start_function): New function. (really_start_method): Call comp_proto_with_proto() instead of comp_method_with_proto(); call objc_start_function() instead of hand-crafting a function declarator. (continue_method_def, objc_expand_function_end): Remove functions. (get_super_receiver): Call objc_get_current_scope() instead of get_current_scope(); reference 'super_class' field (instead of 'class'). (finish_method_def): Rename to objc_finish_method_definition() and add a function decl parameter; move method encoding call from objc_expand_function_end(). (is_complex_decl, adorn_decl, gen_declarator, gen_declspecs, gen_declaration_1): Remove functions. (tmpbuf, RAW_DECLSPEC): Remove. (gen_declaration): Remove second parameter; simplify to deal with TYPE_P nodes instead of raw declspecs. (gen_type_name, gen_type_name_0): New functions. (gen_method_decl): Remove second parameter; call gen_type_name() instead of gen_declaration_1(). (dump_interface): Adjust calls to gen_declaration() and gen_method_decl(); do not allocate a separate string buffer. (init_objc): Allocate a larger string buffer to accommodate dump_interface(); adjust call to build_module_descriptor(); add call to build_module_initializer_routine() for the GNU runtime. (generate_classref_translation_entry): Do not call start_decl(); call finish_var_decl() instead of finish_decl(); call convert() instead of build_c_cast(). * objc-act.h (CLASS_OWN_IVARS): Remove accessor. (CLASS_BINFO_ELTS): Reduce from 6 to 5, now that CLASS_OWN_IVARS is gone. (OCTI_GNU_INIT_DECL, GNU_INIT_decl): New. (OCTI_ELLIPSIS_NODE, objc_ellipsis_node): Remove. (OCTI_ID_ID, id_type, objc_id_id): Rename to OCTI_ID_NAME, objc_object_type and objc_object_name, respectively. (OCTI_CLS_REF, OCTI_CLASS_NAME, objc_class_reference, objc_class_name): New. (IS_CLASS): New macro. (IS_ID, IS_SUPER): Robustify. (OCTI_EXECCLASS_DECL, execclass_decl): New. (finish_file, start_class, continue_class, finish_class, start_method_def, continue_method_def, finish_method_def, start_protocol, finish_protocol, objc_build_throw_stmt, objc_build_try_catch_finally_stmt, objc_build_synchronized_prologue, objc_build_synchronized_epilogue, objc_build_try_prologue, objc_build_try_epilogue, objc_build_catch_stmt, objc_build_catch_epilogue, objc_build_finally_prologue, objc_build_finally_epilogue, is_ivar, is_private, is_public, add_instance_variable, objc_add_method, get_super_receiver, objc_clear_super_receiver, get_class_ivars_from_name, get_class_reference, get_static_reference, get_object_reference, build_message_expr, finish_message_expr, build_selector_expr, build_ivar_reference, build_keyword_decl, build_method_decl, build_protocol_expr, build_objc_string_object, objc_declare_alias, objc_declare_class, objc_declare_protocols, objc_comptypes, objc_check_decl, build_encode_expr): Remove prototypes. (imp_count, cat_count): Make GGC-aware. (OBJC_SET_TYPE_NAME): New macro. From-SVN: r87168
2004-09-08 02:49:44 +02:00
impdecls);
1992-01-18 00:15:38 +01:00
error_with_ivar ("previous declaration of",
Makefile.in (c-parse.o): Depend on $(C_COMMON_H). [gcc/ChangeLog] 2004-09-07 Ziemowit Laski <zlaski@apple.com> * Makefile.in (c-parse.o): Depend on $(C_COMMON_H). * c-parse.in: Include c-common.h instead of objc-act.h. (ivar_decl_list, ivar_decls, ivar_decl, ivars, ivar_declarator, myparms, myparm): Remove %type declarations. (methodtype, optparms, OBJC_TYPE_QUAL, objc_quals, objc_qual, objc_typename, objc_try_catch_stmt, optellipsis): Add %type declarations. (objc_inherit_code, objc_public_flag): Remove. (typespec_nonreserved_nonattr): Call objc_get_protocol_qualified_type() instead of get_static_reference() and get_protocol_reference(). (stmt_nocomp): Call grokparm() on @catch parameter. (objcdef): Move semantic action to objc_finish_implementation(). (classdef): Move semantic action to objc_start_class_interface(), objc_continue_interface(), objc_finish_interface(), objc_start_class_implementation(), objc_continue_implementation(), objc_start_category_interface() and objc_start_category_implementation(). (protocoldef): Move semantic actions to objc_start_protocol() and objc_finish_interface(). (ivar_decl_list): Remove nonterminal. (visibility_spec): Move semantic actions to objc_set_visibility(). (ivar_decls): Remove assignment to $$. (ivar_decl): Rephrase in terms of component_decl; call objc_add_instance_variable(). (ivars, ivar_declarator): Remove nonterminals. (opt_semi): New nonterminal. (methodtype): Remove semantic actions. (methoddef): Move semantic actions to objc_set_method_type(), objc_start_method_definition() and objc_finish_method_definition(). (methodproto): Move semantic actions to objc_set_method_type() and objc_add_method_declaration(). (methoddecl): Use objc_typename instead of typename; move semantic actions to objc_build_method_signature(). (optarglist, myxdecls, mydecl, myparms, myparm): Remove nonterminals. (optparmlist): Express in terms of optparms and optellipsis. (optparms, optellipsis, objc_qual, objc_quals, objc_typename): New nonterminals. (keyworddecl): Use objc_typename instead of typename. (rid_to_yy): Mark RID_IN, RID_OUT, RID_INOUT, RID_BYCOPY, RID_BYREF and RID_ONEWAY as returning OBJC_TYPE_QUAL to yyparse(). [gcc/objc/ChangeLog] 2004-09-07 Ziemowit Laski <zlaski@apple.com> * Make-lang.in (objc/objc-parse.o): Depend on $(C_COMMON_H) instead of objc/objc-act.h. (objc/objc-act.o): Depend on $(HASHTAB_H). * objc-act.c: Include hashtab.h; in ObjC++ mode, include cp-tree.h and objcp-decl.h instead of c-tree.h. (build_module_descriptor, get_class_ivars, synth_id_with_class_suffix, error_with_ivar, gen_method_decl, gen_declaration, setup_string_decl, build_protocol_template): Adjust prototypes. (build_module_initializer_routine, start_class, continue_class, finish_class, start_method_def, objc_start_function, start_protocol, build_method_decl, objc_add_method, add_instance_variable, build_ivar_reference, is_ivar, is_private, get_super_receiver, build_selector_table_decl, objc_push_parm, objc_get_parm_info, gen_type_name, gen_type_name_0, start_var_decl, finish_var_decl, create_field_decl): New prototypes. (objc_expand_function_end, comp_method_with_proto, objc_expr_last, gen_declaration_1, gen_declarator, is_complex_decl, adorn_decl, define_decl, create_builtin_decl, gen_declspecs): Remove prototypes. (TYPE_ID): Rename to OBJECT_TYPEDEF_NAME. (CLASS_TYPEDEF_NAME): New. (TAG_EXECCLASS): Change from a global variable to a #define. (TAG_RETURN_STRUCT): Delete. (TAG_GNUINIT): New, holds '__objc_gnu_init' name. (objc_inherit_code, objc_public_flag): New, moved from c-parse.in. (string_descriptor): New struct. (string_htab): New hash table. (string_hash, string_eq): New prototypes. (generate_struct_by_value_array): Call create_field_decl() instead of create_builtin_decl(). (objc_init): Do not initialize objc_ellipsis_node or TAG_EXECCLASS; In ObjC++ mode, call cxx_init() instead of c_objc_common_init(). (objc_finish_file): In ObjC++, call instantiate_pending_templates() and cp_finish_file(). (define_decl, get_static_reference, get_protocol_reference, create_builtin_decl): Remove functions. (objc_start_class_interface, objc_start_category_interface, objc_start_protocol, objc_continue_interface, objc_finish_interface, objc_start_class_implementation, objc_start_category_implementation, objc_continue_implementation, objc_finish_implementation, objc_set_visibility, objc_set_method_type, objc_build_method_signature, objc_add_method_declaration, objc_start_method_definition, objc_add_instance_variable, objc_get_protocol_qualified_type, create_field_decl, start_var_decl, finish_var_decl): New functions. (setup_string_decl): Simplify since it is only called once. (synth_module_prologue): Call build_class_template(); predefine 'id' and 'Class' as typedefs; rename 'temp_type' to 'type'; disable debug hooks for duration of function; fix GNU runtime messenger signatures to correspond to reality; forward-declare '__objc_exec_class' for the GNU runtime; call build_selector_table_decl(); in ObjC++ mode, generate 'extern "C" { ... }' wrappers around synthesized declarations; call build_protocol_template() and build_category_template(). (string_hash, string_eq): New functions. (objc_build_string_object): Check metaclass correctness only once; store string literals in hash table. (objc_build_constructor): Do not convert initializer elements; adjust for ObjC++ impedance mismatch. (build_objc_symtab_template): Call create_field_decl() instead of create_builtin_decl(). (init_objc_symtab): Add missing conversion to initializer element. (build_metadata_decl): Call start_var_decl() instead of define_decl(). (generate_objc_symtab_decl): Do not call build_category_template(); call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(). (build_module_descriptor): Call create_field_decl() instead of grokfield(); call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(); always mark module descriptor as used; move GNU runtime-specific functionality to build_module_initializer_routine(). (build_module_initializer_routine): New function, broken off of build_module_descriptor(). (objc_static_init_needed_p, objc_generate_static_init_call): New functions. (generate_static_references, generate_strings, build_selector_translation_table, generate_descriptor_table, generate_ivars_list, generate_dispatch_table, generate_category): Call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(); build a type directly instead of via groktypename(). (build_selector_reference_decl, build_selector_table_decl, build_class_reference_decl, build_protocol_reference, generate_objc_image_info): Call start_var_decl() instead of build_decl(). (build_selector_reference): For GNU runtime, do not call build_selector_reference_decl(). (build_selector, build_typed_selector_reference): Always convert result to the selector type. (add_objc_string): Cast return value to 'char *'. (build_method_prototype_template, build_selector_template, build_method_template): Use actual selector type for fields pointing to selectors. (finish_objc): For GNU runtime, call build_module_initializer_routine() after build_module_descriptor(). (generate_protocol_list, generate_shared_structures): Call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(); build a type directly instead of via groktypename(). (synth_id_with_class_suffix): Return a string. (get_arg_type_list): For instance methods, use the instance type for 'self'; do not call groktypename_in_parm_context(). (build_objc_string_decl): Squash redeclaration errors in ObjC++. (objc_is_class_name): Use OBJC_TYPE_NAME instead of TYPE_NAME; handle RECORD_TYPEs in ObjC as well as ObjC++. (objc_is_id): New function. (objc_is_object_ptr): Return the canonical type node. (objc_get_class_ivars): Simplify using get_class_ivars(). (get_class_ivars): Remove second parameter; create a fresh copy of the ivar list for each call; do not check for existence of super class. (objc_eh_runtime_type): Mark #ifndef OBJCPLUS. (objc_init_exceptions): When using SJLJ-style exceptions, require the use of '-fobjc-exceptions' flag; do not require it for DWARF-style exceptions. (objc_build_exc_ptr, next_sjlj_build_try_catch_finally): Use objc_object_type instead of objc_id_type. (objc_begin_catch_clause): Convert the incoming PARM_DECL into a VAR_DECL before placing it in the appropriate scope; do not call define_decl(); adjust call to c_begin_compound_stmt(); use objc_object_type instead of objc_id_type. (build_next_objc_exception_stuff): Call create_field_decl() instead of create_builtin_decl(); construct type directly instead of calling groktypename(); use OBJC_VOID_AT_END to mark end of function parameters. (build_private_template): Adjust call to get_class_ivars(); build a type directly instead of via groktypename(). (build_protocol_template, build_method_prototype_list_template, build_method_prototype_template, build_category_template, build_selector_template, build_class_template, build_super_template, build_ivar_template, build_ivar_list_template, build_method_list_template, build_method_template): Call create_field_decl() instead of grokfield(). (objc_method_parm_type): Do not call groktypename(). (generate_descriptor_table): Call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(). (generate_method_descriptors, build_protocol_initializer, generate_dispatch_tables, build_category_initializer, build_shared_structure_initializer): Do not call groktypename(). (generate_protocols): Call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(); do not call groktypename(). (error_with_ivar): Remove last parameter. (check_ivars): Do not iterate ovar CLASS_RAW_IVARS lists in addition to CLASS_IVARS lists; adjust calls to error_with_ivar(). (generate_ivar_lists): Convert one of the initializer elements; do not call groktypename(). (get_arg_type_list, start_method_def, gen_method_def): Account for new representation of variable arguments and '...' in Objective-C methods; add Objective-C++ impedance matching code. (is_objc_type_qualifier): Remove function. (adjust_type_for_id_default): Simplify; there is no longer a need to wade through declspecs. (lookup_interface, start_class, continue_class, finish_class, start_method_def, start_protocol, build_method_decl, objc_add_method, add_instance_variable, build_ivar_reference, is_ivar, is_private, get_super_receiver, objc_build_finally_epilogue): Make into static functions. (receiver_is_class_object): Use new IS_CLASS() macro. (objc_build_message_expr): Tweak ObjC++ message argument handling; call objc_finish_message_expr() instead of finish_message_expr(). (finish_message_expr): Rename to objc_finish_message_expr(); use OBJC_TYPE_NAME and OBJC_SET_TYPE_NAME macros instead of TYPE_NAME. call gen_type_name() instead of gen_declaration(); call objc_is_id() instead of using IS_ID and IS_CLASS; Use objc_class_name instead of calling get_identifier("Class"); handle CONVERT_EXPRs in receiver. (build_objc_method_call, warn_with_method): Do not call groktypename(). (build_ivar_reference): Call convert() instead of clobbering in a type. (hash_init): Initialize string_htab hash table. (add_instance_variable): Simplify parameter list; do not call grokfield(); do not populate CLASS_IVARS list. (start_class): Check for the existence of super class, if one was specified. (continue_class): Use CLASS_RAW_IVARS rather than CLASS_IVARS; do not call build_class_template(); adjust call to get_class_ivars(); call build_decl(), pushdecl() and finish_decl() instead of define_decl(). (finish_class): Call build_decl(), pushdecl() and finish_decl() instead of define_decl(). (add_protocols): Use PROTOCOL_BINFO_ELTS for the tree vector size. (start_protocol): Do not call build_protocol_template(); use PROTOCOL_BINFO_ELTS for the tree vector size. (encode_type_qualifiers): Do not handle the 'const' qualifier here. (encode_pointer): Encode 'const char *' as 'r*', for backwards compatibility. (encode_array): Use HOST_WIDE_INT_PRINT_DEC instead of "%ld". (encode_type): Handle the 'const' qualifier here. (objc_parmlist): New global variable, sued by objc_push_parm and objc_get_parm_info(). (objc_push_parm, objc_get_parm_info): New functions. (objc_expr_last): Remove function. (synth_self_and_ucmd_args): For instance methods, use the instance type for 'self'; call objc_push_parm() instead of push_parm_decl(). (start_method_def): Do not call push_scope(), declare_parm_level(), pop_scope(), push_parm_decl(), store_parm_decls() or objc_expr_last(); just use objc_push_parm() and objc_get_parm_info(). (comp_method_with_proto): Remove function. (objc_types_are_equivalent): Strip away indirections before comparing underlying types. (comp_proto_with_proto): Do not call groktypename(); types are no longer in raw declspec format. (objc_start_function): New function. (really_start_method): Call comp_proto_with_proto() instead of comp_method_with_proto(); call objc_start_function() instead of hand-crafting a function declarator. (continue_method_def, objc_expand_function_end): Remove functions. (get_super_receiver): Call objc_get_current_scope() instead of get_current_scope(); reference 'super_class' field (instead of 'class'). (finish_method_def): Rename to objc_finish_method_definition() and add a function decl parameter; move method encoding call from objc_expand_function_end(). (is_complex_decl, adorn_decl, gen_declarator, gen_declspecs, gen_declaration_1): Remove functions. (tmpbuf, RAW_DECLSPEC): Remove. (gen_declaration): Remove second parameter; simplify to deal with TYPE_P nodes instead of raw declspecs. (gen_type_name, gen_type_name_0): New functions. (gen_method_decl): Remove second parameter; call gen_type_name() instead of gen_declaration_1(). (dump_interface): Adjust calls to gen_declaration() and gen_method_decl(); do not allocate a separate string buffer. (init_objc): Allocate a larger string buffer to accommodate dump_interface(); adjust call to build_module_descriptor(); add call to build_module_initializer_routine() for the GNU runtime. (generate_classref_translation_entry): Do not call start_decl(); call finish_var_decl() instead of finish_decl(); call convert() instead of build_c_cast(). * objc-act.h (CLASS_OWN_IVARS): Remove accessor. (CLASS_BINFO_ELTS): Reduce from 6 to 5, now that CLASS_OWN_IVARS is gone. (OCTI_GNU_INIT_DECL, GNU_INIT_decl): New. (OCTI_ELLIPSIS_NODE, objc_ellipsis_node): Remove. (OCTI_ID_ID, id_type, objc_id_id): Rename to OCTI_ID_NAME, objc_object_type and objc_object_name, respectively. (OCTI_CLS_REF, OCTI_CLASS_NAME, objc_class_reference, objc_class_name): New. (IS_CLASS): New macro. (IS_ID, IS_SUPER): Robustify. (OCTI_EXECCLASS_DECL, execclass_decl): New. (finish_file, start_class, continue_class, finish_class, start_method_def, continue_method_def, finish_method_def, start_protocol, finish_protocol, objc_build_throw_stmt, objc_build_try_catch_finally_stmt, objc_build_synchronized_prologue, objc_build_synchronized_epilogue, objc_build_try_prologue, objc_build_try_epilogue, objc_build_catch_stmt, objc_build_catch_epilogue, objc_build_finally_prologue, objc_build_finally_epilogue, is_ivar, is_private, is_public, add_instance_variable, objc_add_method, get_super_receiver, objc_clear_super_receiver, get_class_ivars_from_name, get_class_reference, get_static_reference, get_object_reference, build_message_expr, finish_message_expr, build_selector_expr, build_ivar_reference, build_keyword_decl, build_method_decl, build_protocol_expr, build_objc_string_object, objc_declare_alias, objc_declare_class, objc_declare_protocols, objc_comptypes, objc_check_decl, build_encode_expr): Remove prototypes. (imp_count, cat_count): Make GGC-aware. (OBJC_SET_TYPE_NAME): New macro. From-SVN: r87168
2004-09-08 02:49:44 +02:00
intdecls);
1992-01-18 00:15:38 +01:00
}
1992-01-18 00:15:38 +01:00
intdecls = TREE_CHAIN (intdecls);
impdecls = TREE_CHAIN (impdecls);
}
}
/* Set 'objc_super_template' to the data type node for 'struct _objc_super'.
This needs to be done just once per compilation. */
Makefile.in (c-parse.o): Depend on $(C_COMMON_H). [gcc/ChangeLog] 2004-09-07 Ziemowit Laski <zlaski@apple.com> * Makefile.in (c-parse.o): Depend on $(C_COMMON_H). * c-parse.in: Include c-common.h instead of objc-act.h. (ivar_decl_list, ivar_decls, ivar_decl, ivars, ivar_declarator, myparms, myparm): Remove %type declarations. (methodtype, optparms, OBJC_TYPE_QUAL, objc_quals, objc_qual, objc_typename, objc_try_catch_stmt, optellipsis): Add %type declarations. (objc_inherit_code, objc_public_flag): Remove. (typespec_nonreserved_nonattr): Call objc_get_protocol_qualified_type() instead of get_static_reference() and get_protocol_reference(). (stmt_nocomp): Call grokparm() on @catch parameter. (objcdef): Move semantic action to objc_finish_implementation(). (classdef): Move semantic action to objc_start_class_interface(), objc_continue_interface(), objc_finish_interface(), objc_start_class_implementation(), objc_continue_implementation(), objc_start_category_interface() and objc_start_category_implementation(). (protocoldef): Move semantic actions to objc_start_protocol() and objc_finish_interface(). (ivar_decl_list): Remove nonterminal. (visibility_spec): Move semantic actions to objc_set_visibility(). (ivar_decls): Remove assignment to $$. (ivar_decl): Rephrase in terms of component_decl; call objc_add_instance_variable(). (ivars, ivar_declarator): Remove nonterminals. (opt_semi): New nonterminal. (methodtype): Remove semantic actions. (methoddef): Move semantic actions to objc_set_method_type(), objc_start_method_definition() and objc_finish_method_definition(). (methodproto): Move semantic actions to objc_set_method_type() and objc_add_method_declaration(). (methoddecl): Use objc_typename instead of typename; move semantic actions to objc_build_method_signature(). (optarglist, myxdecls, mydecl, myparms, myparm): Remove nonterminals. (optparmlist): Express in terms of optparms and optellipsis. (optparms, optellipsis, objc_qual, objc_quals, objc_typename): New nonterminals. (keyworddecl): Use objc_typename instead of typename. (rid_to_yy): Mark RID_IN, RID_OUT, RID_INOUT, RID_BYCOPY, RID_BYREF and RID_ONEWAY as returning OBJC_TYPE_QUAL to yyparse(). [gcc/objc/ChangeLog] 2004-09-07 Ziemowit Laski <zlaski@apple.com> * Make-lang.in (objc/objc-parse.o): Depend on $(C_COMMON_H) instead of objc/objc-act.h. (objc/objc-act.o): Depend on $(HASHTAB_H). * objc-act.c: Include hashtab.h; in ObjC++ mode, include cp-tree.h and objcp-decl.h instead of c-tree.h. (build_module_descriptor, get_class_ivars, synth_id_with_class_suffix, error_with_ivar, gen_method_decl, gen_declaration, setup_string_decl, build_protocol_template): Adjust prototypes. (build_module_initializer_routine, start_class, continue_class, finish_class, start_method_def, objc_start_function, start_protocol, build_method_decl, objc_add_method, add_instance_variable, build_ivar_reference, is_ivar, is_private, get_super_receiver, build_selector_table_decl, objc_push_parm, objc_get_parm_info, gen_type_name, gen_type_name_0, start_var_decl, finish_var_decl, create_field_decl): New prototypes. (objc_expand_function_end, comp_method_with_proto, objc_expr_last, gen_declaration_1, gen_declarator, is_complex_decl, adorn_decl, define_decl, create_builtin_decl, gen_declspecs): Remove prototypes. (TYPE_ID): Rename to OBJECT_TYPEDEF_NAME. (CLASS_TYPEDEF_NAME): New. (TAG_EXECCLASS): Change from a global variable to a #define. (TAG_RETURN_STRUCT): Delete. (TAG_GNUINIT): New, holds '__objc_gnu_init' name. (objc_inherit_code, objc_public_flag): New, moved from c-parse.in. (string_descriptor): New struct. (string_htab): New hash table. (string_hash, string_eq): New prototypes. (generate_struct_by_value_array): Call create_field_decl() instead of create_builtin_decl(). (objc_init): Do not initialize objc_ellipsis_node or TAG_EXECCLASS; In ObjC++ mode, call cxx_init() instead of c_objc_common_init(). (objc_finish_file): In ObjC++, call instantiate_pending_templates() and cp_finish_file(). (define_decl, get_static_reference, get_protocol_reference, create_builtin_decl): Remove functions. (objc_start_class_interface, objc_start_category_interface, objc_start_protocol, objc_continue_interface, objc_finish_interface, objc_start_class_implementation, objc_start_category_implementation, objc_continue_implementation, objc_finish_implementation, objc_set_visibility, objc_set_method_type, objc_build_method_signature, objc_add_method_declaration, objc_start_method_definition, objc_add_instance_variable, objc_get_protocol_qualified_type, create_field_decl, start_var_decl, finish_var_decl): New functions. (setup_string_decl): Simplify since it is only called once. (synth_module_prologue): Call build_class_template(); predefine 'id' and 'Class' as typedefs; rename 'temp_type' to 'type'; disable debug hooks for duration of function; fix GNU runtime messenger signatures to correspond to reality; forward-declare '__objc_exec_class' for the GNU runtime; call build_selector_table_decl(); in ObjC++ mode, generate 'extern "C" { ... }' wrappers around synthesized declarations; call build_protocol_template() and build_category_template(). (string_hash, string_eq): New functions. (objc_build_string_object): Check metaclass correctness only once; store string literals in hash table. (objc_build_constructor): Do not convert initializer elements; adjust for ObjC++ impedance mismatch. (build_objc_symtab_template): Call create_field_decl() instead of create_builtin_decl(). (init_objc_symtab): Add missing conversion to initializer element. (build_metadata_decl): Call start_var_decl() instead of define_decl(). (generate_objc_symtab_decl): Do not call build_category_template(); call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(). (build_module_descriptor): Call create_field_decl() instead of grokfield(); call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(); always mark module descriptor as used; move GNU runtime-specific functionality to build_module_initializer_routine(). (build_module_initializer_routine): New function, broken off of build_module_descriptor(). (objc_static_init_needed_p, objc_generate_static_init_call): New functions. (generate_static_references, generate_strings, build_selector_translation_table, generate_descriptor_table, generate_ivars_list, generate_dispatch_table, generate_category): Call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(); build a type directly instead of via groktypename(). (build_selector_reference_decl, build_selector_table_decl, build_class_reference_decl, build_protocol_reference, generate_objc_image_info): Call start_var_decl() instead of build_decl(). (build_selector_reference): For GNU runtime, do not call build_selector_reference_decl(). (build_selector, build_typed_selector_reference): Always convert result to the selector type. (add_objc_string): Cast return value to 'char *'. (build_method_prototype_template, build_selector_template, build_method_template): Use actual selector type for fields pointing to selectors. (finish_objc): For GNU runtime, call build_module_initializer_routine() after build_module_descriptor(). (generate_protocol_list, generate_shared_structures): Call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(); build a type directly instead of via groktypename(). (synth_id_with_class_suffix): Return a string. (get_arg_type_list): For instance methods, use the instance type for 'self'; do not call groktypename_in_parm_context(). (build_objc_string_decl): Squash redeclaration errors in ObjC++. (objc_is_class_name): Use OBJC_TYPE_NAME instead of TYPE_NAME; handle RECORD_TYPEs in ObjC as well as ObjC++. (objc_is_id): New function. (objc_is_object_ptr): Return the canonical type node. (objc_get_class_ivars): Simplify using get_class_ivars(). (get_class_ivars): Remove second parameter; create a fresh copy of the ivar list for each call; do not check for existence of super class. (objc_eh_runtime_type): Mark #ifndef OBJCPLUS. (objc_init_exceptions): When using SJLJ-style exceptions, require the use of '-fobjc-exceptions' flag; do not require it for DWARF-style exceptions. (objc_build_exc_ptr, next_sjlj_build_try_catch_finally): Use objc_object_type instead of objc_id_type. (objc_begin_catch_clause): Convert the incoming PARM_DECL into a VAR_DECL before placing it in the appropriate scope; do not call define_decl(); adjust call to c_begin_compound_stmt(); use objc_object_type instead of objc_id_type. (build_next_objc_exception_stuff): Call create_field_decl() instead of create_builtin_decl(); construct type directly instead of calling groktypename(); use OBJC_VOID_AT_END to mark end of function parameters. (build_private_template): Adjust call to get_class_ivars(); build a type directly instead of via groktypename(). (build_protocol_template, build_method_prototype_list_template, build_method_prototype_template, build_category_template, build_selector_template, build_class_template, build_super_template, build_ivar_template, build_ivar_list_template, build_method_list_template, build_method_template): Call create_field_decl() instead of grokfield(). (objc_method_parm_type): Do not call groktypename(). (generate_descriptor_table): Call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(). (generate_method_descriptors, build_protocol_initializer, generate_dispatch_tables, build_category_initializer, build_shared_structure_initializer): Do not call groktypename(). (generate_protocols): Call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(); do not call groktypename(). (error_with_ivar): Remove last parameter. (check_ivars): Do not iterate ovar CLASS_RAW_IVARS lists in addition to CLASS_IVARS lists; adjust calls to error_with_ivar(). (generate_ivar_lists): Convert one of the initializer elements; do not call groktypename(). (get_arg_type_list, start_method_def, gen_method_def): Account for new representation of variable arguments and '...' in Objective-C methods; add Objective-C++ impedance matching code. (is_objc_type_qualifier): Remove function. (adjust_type_for_id_default): Simplify; there is no longer a need to wade through declspecs. (lookup_interface, start_class, continue_class, finish_class, start_method_def, start_protocol, build_method_decl, objc_add_method, add_instance_variable, build_ivar_reference, is_ivar, is_private, get_super_receiver, objc_build_finally_epilogue): Make into static functions. (receiver_is_class_object): Use new IS_CLASS() macro. (objc_build_message_expr): Tweak ObjC++ message argument handling; call objc_finish_message_expr() instead of finish_message_expr(). (finish_message_expr): Rename to objc_finish_message_expr(); use OBJC_TYPE_NAME and OBJC_SET_TYPE_NAME macros instead of TYPE_NAME. call gen_type_name() instead of gen_declaration(); call objc_is_id() instead of using IS_ID and IS_CLASS; Use objc_class_name instead of calling get_identifier("Class"); handle CONVERT_EXPRs in receiver. (build_objc_method_call, warn_with_method): Do not call groktypename(). (build_ivar_reference): Call convert() instead of clobbering in a type. (hash_init): Initialize string_htab hash table. (add_instance_variable): Simplify parameter list; do not call grokfield(); do not populate CLASS_IVARS list. (start_class): Check for the existence of super class, if one was specified. (continue_class): Use CLASS_RAW_IVARS rather than CLASS_IVARS; do not call build_class_template(); adjust call to get_class_ivars(); call build_decl(), pushdecl() and finish_decl() instead of define_decl(). (finish_class): Call build_decl(), pushdecl() and finish_decl() instead of define_decl(). (add_protocols): Use PROTOCOL_BINFO_ELTS for the tree vector size. (start_protocol): Do not call build_protocol_template(); use PROTOCOL_BINFO_ELTS for the tree vector size. (encode_type_qualifiers): Do not handle the 'const' qualifier here. (encode_pointer): Encode 'const char *' as 'r*', for backwards compatibility. (encode_array): Use HOST_WIDE_INT_PRINT_DEC instead of "%ld". (encode_type): Handle the 'const' qualifier here. (objc_parmlist): New global variable, sued by objc_push_parm and objc_get_parm_info(). (objc_push_parm, objc_get_parm_info): New functions. (objc_expr_last): Remove function. (synth_self_and_ucmd_args): For instance methods, use the instance type for 'self'; call objc_push_parm() instead of push_parm_decl(). (start_method_def): Do not call push_scope(), declare_parm_level(), pop_scope(), push_parm_decl(), store_parm_decls() or objc_expr_last(); just use objc_push_parm() and objc_get_parm_info(). (comp_method_with_proto): Remove function. (objc_types_are_equivalent): Strip away indirections before comparing underlying types. (comp_proto_with_proto): Do not call groktypename(); types are no longer in raw declspec format. (objc_start_function): New function. (really_start_method): Call comp_proto_with_proto() instead of comp_method_with_proto(); call objc_start_function() instead of hand-crafting a function declarator. (continue_method_def, objc_expand_function_end): Remove functions. (get_super_receiver): Call objc_get_current_scope() instead of get_current_scope(); reference 'super_class' field (instead of 'class'). (finish_method_def): Rename to objc_finish_method_definition() and add a function decl parameter; move method encoding call from objc_expand_function_end(). (is_complex_decl, adorn_decl, gen_declarator, gen_declspecs, gen_declaration_1): Remove functions. (tmpbuf, RAW_DECLSPEC): Remove. (gen_declaration): Remove second parameter; simplify to deal with TYPE_P nodes instead of raw declspecs. (gen_type_name, gen_type_name_0): New functions. (gen_method_decl): Remove second parameter; call gen_type_name() instead of gen_declaration_1(). (dump_interface): Adjust calls to gen_declaration() and gen_method_decl(); do not allocate a separate string buffer. (init_objc): Allocate a larger string buffer to accommodate dump_interface(); adjust call to build_module_descriptor(); add call to build_module_initializer_routine() for the GNU runtime. (generate_classref_translation_entry): Do not call start_decl(); call finish_var_decl() instead of finish_decl(); call convert() instead of build_c_cast(). * objc-act.h (CLASS_OWN_IVARS): Remove accessor. (CLASS_BINFO_ELTS): Reduce from 6 to 5, now that CLASS_OWN_IVARS is gone. (OCTI_GNU_INIT_DECL, GNU_INIT_decl): New. (OCTI_ELLIPSIS_NODE, objc_ellipsis_node): Remove. (OCTI_ID_ID, id_type, objc_id_id): Rename to OCTI_ID_NAME, objc_object_type and objc_object_name, respectively. (OCTI_CLS_REF, OCTI_CLASS_NAME, objc_class_reference, objc_class_name): New. (IS_CLASS): New macro. (IS_ID, IS_SUPER): Robustify. (OCTI_EXECCLASS_DECL, execclass_decl): New. (finish_file, start_class, continue_class, finish_class, start_method_def, continue_method_def, finish_method_def, start_protocol, finish_protocol, objc_build_throw_stmt, objc_build_try_catch_finally_stmt, objc_build_synchronized_prologue, objc_build_synchronized_epilogue, objc_build_try_prologue, objc_build_try_epilogue, objc_build_catch_stmt, objc_build_catch_epilogue, objc_build_finally_prologue, objc_build_finally_epilogue, is_ivar, is_private, is_public, add_instance_variable, objc_add_method, get_super_receiver, objc_clear_super_receiver, get_class_ivars_from_name, get_class_reference, get_static_reference, get_object_reference, build_message_expr, finish_message_expr, build_selector_expr, build_ivar_reference, build_keyword_decl, build_method_decl, build_protocol_expr, build_objc_string_object, objc_declare_alias, objc_declare_class, objc_declare_protocols, objc_comptypes, objc_check_decl, build_encode_expr): Remove prototypes. (imp_count, cat_count): Make GGC-aware. (OBJC_SET_TYPE_NAME): New macro. From-SVN: r87168
2004-09-08 02:49:44 +02:00
/* struct _objc_super {
struct _objc_object *self;
struct _objc_class *super_class;
}; */
static void
build_super_template (void)
1992-01-18 00:15:38 +01:00
{
Makefile.in (c-parse.o): Depend on $(C_COMMON_H). [gcc/ChangeLog] 2004-09-07 Ziemowit Laski <zlaski@apple.com> * Makefile.in (c-parse.o): Depend on $(C_COMMON_H). * c-parse.in: Include c-common.h instead of objc-act.h. (ivar_decl_list, ivar_decls, ivar_decl, ivars, ivar_declarator, myparms, myparm): Remove %type declarations. (methodtype, optparms, OBJC_TYPE_QUAL, objc_quals, objc_qual, objc_typename, objc_try_catch_stmt, optellipsis): Add %type declarations. (objc_inherit_code, objc_public_flag): Remove. (typespec_nonreserved_nonattr): Call objc_get_protocol_qualified_type() instead of get_static_reference() and get_protocol_reference(). (stmt_nocomp): Call grokparm() on @catch parameter. (objcdef): Move semantic action to objc_finish_implementation(). (classdef): Move semantic action to objc_start_class_interface(), objc_continue_interface(), objc_finish_interface(), objc_start_class_implementation(), objc_continue_implementation(), objc_start_category_interface() and objc_start_category_implementation(). (protocoldef): Move semantic actions to objc_start_protocol() and objc_finish_interface(). (ivar_decl_list): Remove nonterminal. (visibility_spec): Move semantic actions to objc_set_visibility(). (ivar_decls): Remove assignment to $$. (ivar_decl): Rephrase in terms of component_decl; call objc_add_instance_variable(). (ivars, ivar_declarator): Remove nonterminals. (opt_semi): New nonterminal. (methodtype): Remove semantic actions. (methoddef): Move semantic actions to objc_set_method_type(), objc_start_method_definition() and objc_finish_method_definition(). (methodproto): Move semantic actions to objc_set_method_type() and objc_add_method_declaration(). (methoddecl): Use objc_typename instead of typename; move semantic actions to objc_build_method_signature(). (optarglist, myxdecls, mydecl, myparms, myparm): Remove nonterminals. (optparmlist): Express in terms of optparms and optellipsis. (optparms, optellipsis, objc_qual, objc_quals, objc_typename): New nonterminals. (keyworddecl): Use objc_typename instead of typename. (rid_to_yy): Mark RID_IN, RID_OUT, RID_INOUT, RID_BYCOPY, RID_BYREF and RID_ONEWAY as returning OBJC_TYPE_QUAL to yyparse(). [gcc/objc/ChangeLog] 2004-09-07 Ziemowit Laski <zlaski@apple.com> * Make-lang.in (objc/objc-parse.o): Depend on $(C_COMMON_H) instead of objc/objc-act.h. (objc/objc-act.o): Depend on $(HASHTAB_H). * objc-act.c: Include hashtab.h; in ObjC++ mode, include cp-tree.h and objcp-decl.h instead of c-tree.h. (build_module_descriptor, get_class_ivars, synth_id_with_class_suffix, error_with_ivar, gen_method_decl, gen_declaration, setup_string_decl, build_protocol_template): Adjust prototypes. (build_module_initializer_routine, start_class, continue_class, finish_class, start_method_def, objc_start_function, start_protocol, build_method_decl, objc_add_method, add_instance_variable, build_ivar_reference, is_ivar, is_private, get_super_receiver, build_selector_table_decl, objc_push_parm, objc_get_parm_info, gen_type_name, gen_type_name_0, start_var_decl, finish_var_decl, create_field_decl): New prototypes. (objc_expand_function_end, comp_method_with_proto, objc_expr_last, gen_declaration_1, gen_declarator, is_complex_decl, adorn_decl, define_decl, create_builtin_decl, gen_declspecs): Remove prototypes. (TYPE_ID): Rename to OBJECT_TYPEDEF_NAME. (CLASS_TYPEDEF_NAME): New. (TAG_EXECCLASS): Change from a global variable to a #define. (TAG_RETURN_STRUCT): Delete. (TAG_GNUINIT): New, holds '__objc_gnu_init' name. (objc_inherit_code, objc_public_flag): New, moved from c-parse.in. (string_descriptor): New struct. (string_htab): New hash table. (string_hash, string_eq): New prototypes. (generate_struct_by_value_array): Call create_field_decl() instead of create_builtin_decl(). (objc_init): Do not initialize objc_ellipsis_node or TAG_EXECCLASS; In ObjC++ mode, call cxx_init() instead of c_objc_common_init(). (objc_finish_file): In ObjC++, call instantiate_pending_templates() and cp_finish_file(). (define_decl, get_static_reference, get_protocol_reference, create_builtin_decl): Remove functions. (objc_start_class_interface, objc_start_category_interface, objc_start_protocol, objc_continue_interface, objc_finish_interface, objc_start_class_implementation, objc_start_category_implementation, objc_continue_implementation, objc_finish_implementation, objc_set_visibility, objc_set_method_type, objc_build_method_signature, objc_add_method_declaration, objc_start_method_definition, objc_add_instance_variable, objc_get_protocol_qualified_type, create_field_decl, start_var_decl, finish_var_decl): New functions. (setup_string_decl): Simplify since it is only called once. (synth_module_prologue): Call build_class_template(); predefine 'id' and 'Class' as typedefs; rename 'temp_type' to 'type'; disable debug hooks for duration of function; fix GNU runtime messenger signatures to correspond to reality; forward-declare '__objc_exec_class' for the GNU runtime; call build_selector_table_decl(); in ObjC++ mode, generate 'extern "C" { ... }' wrappers around synthesized declarations; call build_protocol_template() and build_category_template(). (string_hash, string_eq): New functions. (objc_build_string_object): Check metaclass correctness only once; store string literals in hash table. (objc_build_constructor): Do not convert initializer elements; adjust for ObjC++ impedance mismatch. (build_objc_symtab_template): Call create_field_decl() instead of create_builtin_decl(). (init_objc_symtab): Add missing conversion to initializer element. (build_metadata_decl): Call start_var_decl() instead of define_decl(). (generate_objc_symtab_decl): Do not call build_category_template(); call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(). (build_module_descriptor): Call create_field_decl() instead of grokfield(); call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(); always mark module descriptor as used; move GNU runtime-specific functionality to build_module_initializer_routine(). (build_module_initializer_routine): New function, broken off of build_module_descriptor(). (objc_static_init_needed_p, objc_generate_static_init_call): New functions. (generate_static_references, generate_strings, build_selector_translation_table, generate_descriptor_table, generate_ivars_list, generate_dispatch_table, generate_category): Call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(); build a type directly instead of via groktypename(). (build_selector_reference_decl, build_selector_table_decl, build_class_reference_decl, build_protocol_reference, generate_objc_image_info): Call start_var_decl() instead of build_decl(). (build_selector_reference): For GNU runtime, do not call build_selector_reference_decl(). (build_selector, build_typed_selector_reference): Always convert result to the selector type. (add_objc_string): Cast return value to 'char *'. (build_method_prototype_template, build_selector_template, build_method_template): Use actual selector type for fields pointing to selectors. (finish_objc): For GNU runtime, call build_module_initializer_routine() after build_module_descriptor(). (generate_protocol_list, generate_shared_structures): Call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(); build a type directly instead of via groktypename(). (synth_id_with_class_suffix): Return a string. (get_arg_type_list): For instance methods, use the instance type for 'self'; do not call groktypename_in_parm_context(). (build_objc_string_decl): Squash redeclaration errors in ObjC++. (objc_is_class_name): Use OBJC_TYPE_NAME instead of TYPE_NAME; handle RECORD_TYPEs in ObjC as well as ObjC++. (objc_is_id): New function. (objc_is_object_ptr): Return the canonical type node. (objc_get_class_ivars): Simplify using get_class_ivars(). (get_class_ivars): Remove second parameter; create a fresh copy of the ivar list for each call; do not check for existence of super class. (objc_eh_runtime_type): Mark #ifndef OBJCPLUS. (objc_init_exceptions): When using SJLJ-style exceptions, require the use of '-fobjc-exceptions' flag; do not require it for DWARF-style exceptions. (objc_build_exc_ptr, next_sjlj_build_try_catch_finally): Use objc_object_type instead of objc_id_type. (objc_begin_catch_clause): Convert the incoming PARM_DECL into a VAR_DECL before placing it in the appropriate scope; do not call define_decl(); adjust call to c_begin_compound_stmt(); use objc_object_type instead of objc_id_type. (build_next_objc_exception_stuff): Call create_field_decl() instead of create_builtin_decl(); construct type directly instead of calling groktypename(); use OBJC_VOID_AT_END to mark end of function parameters. (build_private_template): Adjust call to get_class_ivars(); build a type directly instead of via groktypename(). (build_protocol_template, build_method_prototype_list_template, build_method_prototype_template, build_category_template, build_selector_template, build_class_template, build_super_template, build_ivar_template, build_ivar_list_template, build_method_list_template, build_method_template): Call create_field_decl() instead of grokfield(). (objc_method_parm_type): Do not call groktypename(). (generate_descriptor_table): Call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(). (generate_method_descriptors, build_protocol_initializer, generate_dispatch_tables, build_category_initializer, build_shared_structure_initializer): Do not call groktypename(). (generate_protocols): Call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(); do not call groktypename(). (error_with_ivar): Remove last parameter. (check_ivars): Do not iterate ovar CLASS_RAW_IVARS lists in addition to CLASS_IVARS lists; adjust calls to error_with_ivar(). (generate_ivar_lists): Convert one of the initializer elements; do not call groktypename(). (get_arg_type_list, start_method_def, gen_method_def): Account for new representation of variable arguments and '...' in Objective-C methods; add Objective-C++ impedance matching code. (is_objc_type_qualifier): Remove function. (adjust_type_for_id_default): Simplify; there is no longer a need to wade through declspecs. (lookup_interface, start_class, continue_class, finish_class, start_method_def, start_protocol, build_method_decl, objc_add_method, add_instance_variable, build_ivar_reference, is_ivar, is_private, get_super_receiver, objc_build_finally_epilogue): Make into static functions. (receiver_is_class_object): Use new IS_CLASS() macro. (objc_build_message_expr): Tweak ObjC++ message argument handling; call objc_finish_message_expr() instead of finish_message_expr(). (finish_message_expr): Rename to objc_finish_message_expr(); use OBJC_TYPE_NAME and OBJC_SET_TYPE_NAME macros instead of TYPE_NAME. call gen_type_name() instead of gen_declaration(); call objc_is_id() instead of using IS_ID and IS_CLASS; Use objc_class_name instead of calling get_identifier("Class"); handle CONVERT_EXPRs in receiver. (build_objc_method_call, warn_with_method): Do not call groktypename(). (build_ivar_reference): Call convert() instead of clobbering in a type. (hash_init): Initialize string_htab hash table. (add_instance_variable): Simplify parameter list; do not call grokfield(); do not populate CLASS_IVARS list. (start_class): Check for the existence of super class, if one was specified. (continue_class): Use CLASS_RAW_IVARS rather than CLASS_IVARS; do not call build_class_template(); adjust call to get_class_ivars(); call build_decl(), pushdecl() and finish_decl() instead of define_decl(). (finish_class): Call build_decl(), pushdecl() and finish_decl() instead of define_decl(). (add_protocols): Use PROTOCOL_BINFO_ELTS for the tree vector size. (start_protocol): Do not call build_protocol_template(); use PROTOCOL_BINFO_ELTS for the tree vector size. (encode_type_qualifiers): Do not handle the 'const' qualifier here. (encode_pointer): Encode 'const char *' as 'r*', for backwards compatibility. (encode_array): Use HOST_WIDE_INT_PRINT_DEC instead of "%ld". (encode_type): Handle the 'const' qualifier here. (objc_parmlist): New global variable, sued by objc_push_parm and objc_get_parm_info(). (objc_push_parm, objc_get_parm_info): New functions. (objc_expr_last): Remove function. (synth_self_and_ucmd_args): For instance methods, use the instance type for 'self'; call objc_push_parm() instead of push_parm_decl(). (start_method_def): Do not call push_scope(), declare_parm_level(), pop_scope(), push_parm_decl(), store_parm_decls() or objc_expr_last(); just use objc_push_parm() and objc_get_parm_info(). (comp_method_with_proto): Remove function. (objc_types_are_equivalent): Strip away indirections before comparing underlying types. (comp_proto_with_proto): Do not call groktypename(); types are no longer in raw declspec format. (objc_start_function): New function. (really_start_method): Call comp_proto_with_proto() instead of comp_method_with_proto(); call objc_start_function() instead of hand-crafting a function declarator. (continue_method_def, objc_expand_function_end): Remove functions. (get_super_receiver): Call objc_get_current_scope() instead of get_current_scope(); reference 'super_class' field (instead of 'class'). (finish_method_def): Rename to objc_finish_method_definition() and add a function decl parameter; move method encoding call from objc_expand_function_end(). (is_complex_decl, adorn_decl, gen_declarator, gen_declspecs, gen_declaration_1): Remove functions. (tmpbuf, RAW_DECLSPEC): Remove. (gen_declaration): Remove second parameter; simplify to deal with TYPE_P nodes instead of raw declspecs. (gen_type_name, gen_type_name_0): New functions. (gen_method_decl): Remove second parameter; call gen_type_name() instead of gen_declaration_1(). (dump_interface): Adjust calls to gen_declaration() and gen_method_decl(); do not allocate a separate string buffer. (init_objc): Allocate a larger string buffer to accommodate dump_interface(); adjust call to build_module_descriptor(); add call to build_module_initializer_routine() for the GNU runtime. (generate_classref_translation_entry): Do not call start_decl(); call finish_var_decl() instead of finish_decl(); call convert() instead of build_c_cast(). * objc-act.h (CLASS_OWN_IVARS): Remove accessor. (CLASS_BINFO_ELTS): Reduce from 6 to 5, now that CLASS_OWN_IVARS is gone. (OCTI_GNU_INIT_DECL, GNU_INIT_decl): New. (OCTI_ELLIPSIS_NODE, objc_ellipsis_node): Remove. (OCTI_ID_ID, id_type, objc_id_id): Rename to OCTI_ID_NAME, objc_object_type and objc_object_name, respectively. (OCTI_CLS_REF, OCTI_CLASS_NAME, objc_class_reference, objc_class_name): New. (IS_CLASS): New macro. (IS_ID, IS_SUPER): Robustify. (OCTI_EXECCLASS_DECL, execclass_decl): New. (finish_file, start_class, continue_class, finish_class, start_method_def, continue_method_def, finish_method_def, start_protocol, finish_protocol, objc_build_throw_stmt, objc_build_try_catch_finally_stmt, objc_build_synchronized_prologue, objc_build_synchronized_epilogue, objc_build_try_prologue, objc_build_try_epilogue, objc_build_catch_stmt, objc_build_catch_epilogue, objc_build_finally_prologue, objc_build_finally_epilogue, is_ivar, is_private, is_public, add_instance_variable, objc_add_method, get_super_receiver, objc_clear_super_receiver, get_class_ivars_from_name, get_class_reference, get_static_reference, get_object_reference, build_message_expr, finish_message_expr, build_selector_expr, build_ivar_reference, build_keyword_decl, build_method_decl, build_protocol_expr, build_objc_string_object, objc_declare_alias, objc_declare_class, objc_declare_protocols, objc_comptypes, objc_check_decl, build_encode_expr): Remove prototypes. (imp_count, cat_count): Make GGC-aware. (OBJC_SET_TYPE_NAME): New macro. From-SVN: r87168
2004-09-08 02:49:44 +02:00
tree field_decl, field_decl_chain;
objc_super_template = start_struct (RECORD_TYPE, get_identifier (UTAG_SUPER));
1992-01-18 00:15:38 +01:00
Makefile.in (c-parse.o): Depend on $(C_COMMON_H). [gcc/ChangeLog] 2004-09-07 Ziemowit Laski <zlaski@apple.com> * Makefile.in (c-parse.o): Depend on $(C_COMMON_H). * c-parse.in: Include c-common.h instead of objc-act.h. (ivar_decl_list, ivar_decls, ivar_decl, ivars, ivar_declarator, myparms, myparm): Remove %type declarations. (methodtype, optparms, OBJC_TYPE_QUAL, objc_quals, objc_qual, objc_typename, objc_try_catch_stmt, optellipsis): Add %type declarations. (objc_inherit_code, objc_public_flag): Remove. (typespec_nonreserved_nonattr): Call objc_get_protocol_qualified_type() instead of get_static_reference() and get_protocol_reference(). (stmt_nocomp): Call grokparm() on @catch parameter. (objcdef): Move semantic action to objc_finish_implementation(). (classdef): Move semantic action to objc_start_class_interface(), objc_continue_interface(), objc_finish_interface(), objc_start_class_implementation(), objc_continue_implementation(), objc_start_category_interface() and objc_start_category_implementation(). (protocoldef): Move semantic actions to objc_start_protocol() and objc_finish_interface(). (ivar_decl_list): Remove nonterminal. (visibility_spec): Move semantic actions to objc_set_visibility(). (ivar_decls): Remove assignment to $$. (ivar_decl): Rephrase in terms of component_decl; call objc_add_instance_variable(). (ivars, ivar_declarator): Remove nonterminals. (opt_semi): New nonterminal. (methodtype): Remove semantic actions. (methoddef): Move semantic actions to objc_set_method_type(), objc_start_method_definition() and objc_finish_method_definition(). (methodproto): Move semantic actions to objc_set_method_type() and objc_add_method_declaration(). (methoddecl): Use objc_typename instead of typename; move semantic actions to objc_build_method_signature(). (optarglist, myxdecls, mydecl, myparms, myparm): Remove nonterminals. (optparmlist): Express in terms of optparms and optellipsis. (optparms, optellipsis, objc_qual, objc_quals, objc_typename): New nonterminals. (keyworddecl): Use objc_typename instead of typename. (rid_to_yy): Mark RID_IN, RID_OUT, RID_INOUT, RID_BYCOPY, RID_BYREF and RID_ONEWAY as returning OBJC_TYPE_QUAL to yyparse(). [gcc/objc/ChangeLog] 2004-09-07 Ziemowit Laski <zlaski@apple.com> * Make-lang.in (objc/objc-parse.o): Depend on $(C_COMMON_H) instead of objc/objc-act.h. (objc/objc-act.o): Depend on $(HASHTAB_H). * objc-act.c: Include hashtab.h; in ObjC++ mode, include cp-tree.h and objcp-decl.h instead of c-tree.h. (build_module_descriptor, get_class_ivars, synth_id_with_class_suffix, error_with_ivar, gen_method_decl, gen_declaration, setup_string_decl, build_protocol_template): Adjust prototypes. (build_module_initializer_routine, start_class, continue_class, finish_class, start_method_def, objc_start_function, start_protocol, build_method_decl, objc_add_method, add_instance_variable, build_ivar_reference, is_ivar, is_private, get_super_receiver, build_selector_table_decl, objc_push_parm, objc_get_parm_info, gen_type_name, gen_type_name_0, start_var_decl, finish_var_decl, create_field_decl): New prototypes. (objc_expand_function_end, comp_method_with_proto, objc_expr_last, gen_declaration_1, gen_declarator, is_complex_decl, adorn_decl, define_decl, create_builtin_decl, gen_declspecs): Remove prototypes. (TYPE_ID): Rename to OBJECT_TYPEDEF_NAME. (CLASS_TYPEDEF_NAME): New. (TAG_EXECCLASS): Change from a global variable to a #define. (TAG_RETURN_STRUCT): Delete. (TAG_GNUINIT): New, holds '__objc_gnu_init' name. (objc_inherit_code, objc_public_flag): New, moved from c-parse.in. (string_descriptor): New struct. (string_htab): New hash table. (string_hash, string_eq): New prototypes. (generate_struct_by_value_array): Call create_field_decl() instead of create_builtin_decl(). (objc_init): Do not initialize objc_ellipsis_node or TAG_EXECCLASS; In ObjC++ mode, call cxx_init() instead of c_objc_common_init(). (objc_finish_file): In ObjC++, call instantiate_pending_templates() and cp_finish_file(). (define_decl, get_static_reference, get_protocol_reference, create_builtin_decl): Remove functions. (objc_start_class_interface, objc_start_category_interface, objc_start_protocol, objc_continue_interface, objc_finish_interface, objc_start_class_implementation, objc_start_category_implementation, objc_continue_implementation, objc_finish_implementation, objc_set_visibility, objc_set_method_type, objc_build_method_signature, objc_add_method_declaration, objc_start_method_definition, objc_add_instance_variable, objc_get_protocol_qualified_type, create_field_decl, start_var_decl, finish_var_decl): New functions. (setup_string_decl): Simplify since it is only called once. (synth_module_prologue): Call build_class_template(); predefine 'id' and 'Class' as typedefs; rename 'temp_type' to 'type'; disable debug hooks for duration of function; fix GNU runtime messenger signatures to correspond to reality; forward-declare '__objc_exec_class' for the GNU runtime; call build_selector_table_decl(); in ObjC++ mode, generate 'extern "C" { ... }' wrappers around synthesized declarations; call build_protocol_template() and build_category_template(). (string_hash, string_eq): New functions. (objc_build_string_object): Check metaclass correctness only once; store string literals in hash table. (objc_build_constructor): Do not convert initializer elements; adjust for ObjC++ impedance mismatch. (build_objc_symtab_template): Call create_field_decl() instead of create_builtin_decl(). (init_objc_symtab): Add missing conversion to initializer element. (build_metadata_decl): Call start_var_decl() instead of define_decl(). (generate_objc_symtab_decl): Do not call build_category_template(); call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(). (build_module_descriptor): Call create_field_decl() instead of grokfield(); call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(); always mark module descriptor as used; move GNU runtime-specific functionality to build_module_initializer_routine(). (build_module_initializer_routine): New function, broken off of build_module_descriptor(). (objc_static_init_needed_p, objc_generate_static_init_call): New functions. (generate_static_references, generate_strings, build_selector_translation_table, generate_descriptor_table, generate_ivars_list, generate_dispatch_table, generate_category): Call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(); build a type directly instead of via groktypename(). (build_selector_reference_decl, build_selector_table_decl, build_class_reference_decl, build_protocol_reference, generate_objc_image_info): Call start_var_decl() instead of build_decl(). (build_selector_reference): For GNU runtime, do not call build_selector_reference_decl(). (build_selector, build_typed_selector_reference): Always convert result to the selector type. (add_objc_string): Cast return value to 'char *'. (build_method_prototype_template, build_selector_template, build_method_template): Use actual selector type for fields pointing to selectors. (finish_objc): For GNU runtime, call build_module_initializer_routine() after build_module_descriptor(). (generate_protocol_list, generate_shared_structures): Call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(); build a type directly instead of via groktypename(). (synth_id_with_class_suffix): Return a string. (get_arg_type_list): For instance methods, use the instance type for 'self'; do not call groktypename_in_parm_context(). (build_objc_string_decl): Squash redeclaration errors in ObjC++. (objc_is_class_name): Use OBJC_TYPE_NAME instead of TYPE_NAME; handle RECORD_TYPEs in ObjC as well as ObjC++. (objc_is_id): New function. (objc_is_object_ptr): Return the canonical type node. (objc_get_class_ivars): Simplify using get_class_ivars(). (get_class_ivars): Remove second parameter; create a fresh copy of the ivar list for each call; do not check for existence of super class. (objc_eh_runtime_type): Mark #ifndef OBJCPLUS. (objc_init_exceptions): When using SJLJ-style exceptions, require the use of '-fobjc-exceptions' flag; do not require it for DWARF-style exceptions. (objc_build_exc_ptr, next_sjlj_build_try_catch_finally): Use objc_object_type instead of objc_id_type. (objc_begin_catch_clause): Convert the incoming PARM_DECL into a VAR_DECL before placing it in the appropriate scope; do not call define_decl(); adjust call to c_begin_compound_stmt(); use objc_object_type instead of objc_id_type. (build_next_objc_exception_stuff): Call create_field_decl() instead of create_builtin_decl(); construct type directly instead of calling groktypename(); use OBJC_VOID_AT_END to mark end of function parameters. (build_private_template): Adjust call to get_class_ivars(); build a type directly instead of via groktypename(). (build_protocol_template, build_method_prototype_list_template, build_method_prototype_template, build_category_template, build_selector_template, build_class_template, build_super_template, build_ivar_template, build_ivar_list_template, build_method_list_template, build_method_template): Call create_field_decl() instead of grokfield(). (objc_method_parm_type): Do not call groktypename(). (generate_descriptor_table): Call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(). (generate_method_descriptors, build_protocol_initializer, generate_dispatch_tables, build_category_initializer, build_shared_structure_initializer): Do not call groktypename(). (generate_protocols): Call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(); do not call groktypename(). (error_with_ivar): Remove last parameter. (check_ivars): Do not iterate ovar CLASS_RAW_IVARS lists in addition to CLASS_IVARS lists; adjust calls to error_with_ivar(). (generate_ivar_lists): Convert one of the initializer elements; do not call groktypename(). (get_arg_type_list, start_method_def, gen_method_def): Account for new representation of variable arguments and '...' in Objective-C methods; add Objective-C++ impedance matching code. (is_objc_type_qualifier): Remove function. (adjust_type_for_id_default): Simplify; there is no longer a need to wade through declspecs. (lookup_interface, start_class, continue_class, finish_class, start_method_def, start_protocol, build_method_decl, objc_add_method, add_instance_variable, build_ivar_reference, is_ivar, is_private, get_super_receiver, objc_build_finally_epilogue): Make into static functions. (receiver_is_class_object): Use new IS_CLASS() macro. (objc_build_message_expr): Tweak ObjC++ message argument handling; call objc_finish_message_expr() instead of finish_message_expr(). (finish_message_expr): Rename to objc_finish_message_expr(); use OBJC_TYPE_NAME and OBJC_SET_TYPE_NAME macros instead of TYPE_NAME. call gen_type_name() instead of gen_declaration(); call objc_is_id() instead of using IS_ID and IS_CLASS; Use objc_class_name instead of calling get_identifier("Class"); handle CONVERT_EXPRs in receiver. (build_objc_method_call, warn_with_method): Do not call groktypename(). (build_ivar_reference): Call convert() instead of clobbering in a type. (hash_init): Initialize string_htab hash table. (add_instance_variable): Simplify parameter list; do not call grokfield(); do not populate CLASS_IVARS list. (start_class): Check for the existence of super class, if one was specified. (continue_class): Use CLASS_RAW_IVARS rather than CLASS_IVARS; do not call build_class_template(); adjust call to get_class_ivars(); call build_decl(), pushdecl() and finish_decl() instead of define_decl(). (finish_class): Call build_decl(), pushdecl() and finish_decl() instead of define_decl(). (add_protocols): Use PROTOCOL_BINFO_ELTS for the tree vector size. (start_protocol): Do not call build_protocol_template(); use PROTOCOL_BINFO_ELTS for the tree vector size. (encode_type_qualifiers): Do not handle the 'const' qualifier here. (encode_pointer): Encode 'const char *' as 'r*', for backwards compatibility. (encode_array): Use HOST_WIDE_INT_PRINT_DEC instead of "%ld". (encode_type): Handle the 'const' qualifier here. (objc_parmlist): New global variable, sued by objc_push_parm and objc_get_parm_info(). (objc_push_parm, objc_get_parm_info): New functions. (objc_expr_last): Remove function. (synth_self_and_ucmd_args): For instance methods, use the instance type for 'self'; call objc_push_parm() instead of push_parm_decl(). (start_method_def): Do not call push_scope(), declare_parm_level(), pop_scope(), push_parm_decl(), store_parm_decls() or objc_expr_last(); just use objc_push_parm() and objc_get_parm_info(). (comp_method_with_proto): Remove function. (objc_types_are_equivalent): Strip away indirections before comparing underlying types. (comp_proto_with_proto): Do not call groktypename(); types are no longer in raw declspec format. (objc_start_function): New function. (really_start_method): Call comp_proto_with_proto() instead of comp_method_with_proto(); call objc_start_function() instead of hand-crafting a function declarator. (continue_method_def, objc_expand_function_end): Remove functions. (get_super_receiver): Call objc_get_current_scope() instead of get_current_scope(); reference 'super_class' field (instead of 'class'). (finish_method_def): Rename to objc_finish_method_definition() and add a function decl parameter; move method encoding call from objc_expand_function_end(). (is_complex_decl, adorn_decl, gen_declarator, gen_declspecs, gen_declaration_1): Remove functions. (tmpbuf, RAW_DECLSPEC): Remove. (gen_declaration): Remove second parameter; simplify to deal with TYPE_P nodes instead of raw declspecs. (gen_type_name, gen_type_name_0): New functions. (gen_method_decl): Remove second parameter; call gen_type_name() instead of gen_declaration_1(). (dump_interface): Adjust calls to gen_declaration() and gen_method_decl(); do not allocate a separate string buffer. (init_objc): Allocate a larger string buffer to accommodate dump_interface(); adjust call to build_module_descriptor(); add call to build_module_initializer_routine() for the GNU runtime. (generate_classref_translation_entry): Do not call start_decl(); call finish_var_decl() instead of finish_decl(); call convert() instead of build_c_cast(). * objc-act.h (CLASS_OWN_IVARS): Remove accessor. (CLASS_BINFO_ELTS): Reduce from 6 to 5, now that CLASS_OWN_IVARS is gone. (OCTI_GNU_INIT_DECL, GNU_INIT_decl): New. (OCTI_ELLIPSIS_NODE, objc_ellipsis_node): Remove. (OCTI_ID_ID, id_type, objc_id_id): Rename to OCTI_ID_NAME, objc_object_type and objc_object_name, respectively. (OCTI_CLS_REF, OCTI_CLASS_NAME, objc_class_reference, objc_class_name): New. (IS_CLASS): New macro. (IS_ID, IS_SUPER): Robustify. (OCTI_EXECCLASS_DECL, execclass_decl): New. (finish_file, start_class, continue_class, finish_class, start_method_def, continue_method_def, finish_method_def, start_protocol, finish_protocol, objc_build_throw_stmt, objc_build_try_catch_finally_stmt, objc_build_synchronized_prologue, objc_build_synchronized_epilogue, objc_build_try_prologue, objc_build_try_epilogue, objc_build_catch_stmt, objc_build_catch_epilogue, objc_build_finally_prologue, objc_build_finally_epilogue, is_ivar, is_private, is_public, add_instance_variable, objc_add_method, get_super_receiver, objc_clear_super_receiver, get_class_ivars_from_name, get_class_reference, get_static_reference, get_object_reference, build_message_expr, finish_message_expr, build_selector_expr, build_ivar_reference, build_keyword_decl, build_method_decl, build_protocol_expr, build_objc_string_object, objc_declare_alias, objc_declare_class, objc_declare_protocols, objc_comptypes, objc_check_decl, build_encode_expr): Remove prototypes. (imp_count, cat_count): Make GGC-aware. (OBJC_SET_TYPE_NAME): New macro. From-SVN: r87168
2004-09-08 02:49:44 +02:00
/* struct _objc_object *self; */
field_decl = create_field_decl (objc_object_type, "self");
1992-01-18 00:15:38 +01:00
field_decl_chain = field_decl;
Makefile.in (c-parse.o): Depend on $(C_COMMON_H). [gcc/ChangeLog] 2004-09-07 Ziemowit Laski <zlaski@apple.com> * Makefile.in (c-parse.o): Depend on $(C_COMMON_H). * c-parse.in: Include c-common.h instead of objc-act.h. (ivar_decl_list, ivar_decls, ivar_decl, ivars, ivar_declarator, myparms, myparm): Remove %type declarations. (methodtype, optparms, OBJC_TYPE_QUAL, objc_quals, objc_qual, objc_typename, objc_try_catch_stmt, optellipsis): Add %type declarations. (objc_inherit_code, objc_public_flag): Remove. (typespec_nonreserved_nonattr): Call objc_get_protocol_qualified_type() instead of get_static_reference() and get_protocol_reference(). (stmt_nocomp): Call grokparm() on @catch parameter. (objcdef): Move semantic action to objc_finish_implementation(). (classdef): Move semantic action to objc_start_class_interface(), objc_continue_interface(), objc_finish_interface(), objc_start_class_implementation(), objc_continue_implementation(), objc_start_category_interface() and objc_start_category_implementation(). (protocoldef): Move semantic actions to objc_start_protocol() and objc_finish_interface(). (ivar_decl_list): Remove nonterminal. (visibility_spec): Move semantic actions to objc_set_visibility(). (ivar_decls): Remove assignment to $$. (ivar_decl): Rephrase in terms of component_decl; call objc_add_instance_variable(). (ivars, ivar_declarator): Remove nonterminals. (opt_semi): New nonterminal. (methodtype): Remove semantic actions. (methoddef): Move semantic actions to objc_set_method_type(), objc_start_method_definition() and objc_finish_method_definition(). (methodproto): Move semantic actions to objc_set_method_type() and objc_add_method_declaration(). (methoddecl): Use objc_typename instead of typename; move semantic actions to objc_build_method_signature(). (optarglist, myxdecls, mydecl, myparms, myparm): Remove nonterminals. (optparmlist): Express in terms of optparms and optellipsis. (optparms, optellipsis, objc_qual, objc_quals, objc_typename): New nonterminals. (keyworddecl): Use objc_typename instead of typename. (rid_to_yy): Mark RID_IN, RID_OUT, RID_INOUT, RID_BYCOPY, RID_BYREF and RID_ONEWAY as returning OBJC_TYPE_QUAL to yyparse(). [gcc/objc/ChangeLog] 2004-09-07 Ziemowit Laski <zlaski@apple.com> * Make-lang.in (objc/objc-parse.o): Depend on $(C_COMMON_H) instead of objc/objc-act.h. (objc/objc-act.o): Depend on $(HASHTAB_H). * objc-act.c: Include hashtab.h; in ObjC++ mode, include cp-tree.h and objcp-decl.h instead of c-tree.h. (build_module_descriptor, get_class_ivars, synth_id_with_class_suffix, error_with_ivar, gen_method_decl, gen_declaration, setup_string_decl, build_protocol_template): Adjust prototypes. (build_module_initializer_routine, start_class, continue_class, finish_class, start_method_def, objc_start_function, start_protocol, build_method_decl, objc_add_method, add_instance_variable, build_ivar_reference, is_ivar, is_private, get_super_receiver, build_selector_table_decl, objc_push_parm, objc_get_parm_info, gen_type_name, gen_type_name_0, start_var_decl, finish_var_decl, create_field_decl): New prototypes. (objc_expand_function_end, comp_method_with_proto, objc_expr_last, gen_declaration_1, gen_declarator, is_complex_decl, adorn_decl, define_decl, create_builtin_decl, gen_declspecs): Remove prototypes. (TYPE_ID): Rename to OBJECT_TYPEDEF_NAME. (CLASS_TYPEDEF_NAME): New. (TAG_EXECCLASS): Change from a global variable to a #define. (TAG_RETURN_STRUCT): Delete. (TAG_GNUINIT): New, holds '__objc_gnu_init' name. (objc_inherit_code, objc_public_flag): New, moved from c-parse.in. (string_descriptor): New struct. (string_htab): New hash table. (string_hash, string_eq): New prototypes. (generate_struct_by_value_array): Call create_field_decl() instead of create_builtin_decl(). (objc_init): Do not initialize objc_ellipsis_node or TAG_EXECCLASS; In ObjC++ mode, call cxx_init() instead of c_objc_common_init(). (objc_finish_file): In ObjC++, call instantiate_pending_templates() and cp_finish_file(). (define_decl, get_static_reference, get_protocol_reference, create_builtin_decl): Remove functions. (objc_start_class_interface, objc_start_category_interface, objc_start_protocol, objc_continue_interface, objc_finish_interface, objc_start_class_implementation, objc_start_category_implementation, objc_continue_implementation, objc_finish_implementation, objc_set_visibility, objc_set_method_type, objc_build_method_signature, objc_add_method_declaration, objc_start_method_definition, objc_add_instance_variable, objc_get_protocol_qualified_type, create_field_decl, start_var_decl, finish_var_decl): New functions. (setup_string_decl): Simplify since it is only called once. (synth_module_prologue): Call build_class_template(); predefine 'id' and 'Class' as typedefs; rename 'temp_type' to 'type'; disable debug hooks for duration of function; fix GNU runtime messenger signatures to correspond to reality; forward-declare '__objc_exec_class' for the GNU runtime; call build_selector_table_decl(); in ObjC++ mode, generate 'extern "C" { ... }' wrappers around synthesized declarations; call build_protocol_template() and build_category_template(). (string_hash, string_eq): New functions. (objc_build_string_object): Check metaclass correctness only once; store string literals in hash table. (objc_build_constructor): Do not convert initializer elements; adjust for ObjC++ impedance mismatch. (build_objc_symtab_template): Call create_field_decl() instead of create_builtin_decl(). (init_objc_symtab): Add missing conversion to initializer element. (build_metadata_decl): Call start_var_decl() instead of define_decl(). (generate_objc_symtab_decl): Do not call build_category_template(); call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(). (build_module_descriptor): Call create_field_decl() instead of grokfield(); call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(); always mark module descriptor as used; move GNU runtime-specific functionality to build_module_initializer_routine(). (build_module_initializer_routine): New function, broken off of build_module_descriptor(). (objc_static_init_needed_p, objc_generate_static_init_call): New functions. (generate_static_references, generate_strings, build_selector_translation_table, generate_descriptor_table, generate_ivars_list, generate_dispatch_table, generate_category): Call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(); build a type directly instead of via groktypename(). (build_selector_reference_decl, build_selector_table_decl, build_class_reference_decl, build_protocol_reference, generate_objc_image_info): Call start_var_decl() instead of build_decl(). (build_selector_reference): For GNU runtime, do not call build_selector_reference_decl(). (build_selector, build_typed_selector_reference): Always convert result to the selector type. (add_objc_string): Cast return value to 'char *'. (build_method_prototype_template, build_selector_template, build_method_template): Use actual selector type for fields pointing to selectors. (finish_objc): For GNU runtime, call build_module_initializer_routine() after build_module_descriptor(). (generate_protocol_list, generate_shared_structures): Call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(); build a type directly instead of via groktypename(). (synth_id_with_class_suffix): Return a string. (get_arg_type_list): For instance methods, use the instance type for 'self'; do not call groktypename_in_parm_context(). (build_objc_string_decl): Squash redeclaration errors in ObjC++. (objc_is_class_name): Use OBJC_TYPE_NAME instead of TYPE_NAME; handle RECORD_TYPEs in ObjC as well as ObjC++. (objc_is_id): New function. (objc_is_object_ptr): Return the canonical type node. (objc_get_class_ivars): Simplify using get_class_ivars(). (get_class_ivars): Remove second parameter; create a fresh copy of the ivar list for each call; do not check for existence of super class. (objc_eh_runtime_type): Mark #ifndef OBJCPLUS. (objc_init_exceptions): When using SJLJ-style exceptions, require the use of '-fobjc-exceptions' flag; do not require it for DWARF-style exceptions. (objc_build_exc_ptr, next_sjlj_build_try_catch_finally): Use objc_object_type instead of objc_id_type. (objc_begin_catch_clause): Convert the incoming PARM_DECL into a VAR_DECL before placing it in the appropriate scope; do not call define_decl(); adjust call to c_begin_compound_stmt(); use objc_object_type instead of objc_id_type. (build_next_objc_exception_stuff): Call create_field_decl() instead of create_builtin_decl(); construct type directly instead of calling groktypename(); use OBJC_VOID_AT_END to mark end of function parameters. (build_private_template): Adjust call to get_class_ivars(); build a type directly instead of via groktypename(). (build_protocol_template, build_method_prototype_list_template, build_method_prototype_template, build_category_template, build_selector_template, build_class_template, build_super_template, build_ivar_template, build_ivar_list_template, build_method_list_template, build_method_template): Call create_field_decl() instead of grokfield(). (objc_method_parm_type): Do not call groktypename(). (generate_descriptor_table): Call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(). (generate_method_descriptors, build_protocol_initializer, generate_dispatch_tables, build_category_initializer, build_shared_structure_initializer): Do not call groktypename(). (generate_protocols): Call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(); do not call groktypename(). (error_with_ivar): Remove last parameter. (check_ivars): Do not iterate ovar CLASS_RAW_IVARS lists in addition to CLASS_IVARS lists; adjust calls to error_with_ivar(). (generate_ivar_lists): Convert one of the initializer elements; do not call groktypename(). (get_arg_type_list, start_method_def, gen_method_def): Account for new representation of variable arguments and '...' in Objective-C methods; add Objective-C++ impedance matching code. (is_objc_type_qualifier): Remove function. (adjust_type_for_id_default): Simplify; there is no longer a need to wade through declspecs. (lookup_interface, start_class, continue_class, finish_class, start_method_def, start_protocol, build_method_decl, objc_add_method, add_instance_variable, build_ivar_reference, is_ivar, is_private, get_super_receiver, objc_build_finally_epilogue): Make into static functions. (receiver_is_class_object): Use new IS_CLASS() macro. (objc_build_message_expr): Tweak ObjC++ message argument handling; call objc_finish_message_expr() instead of finish_message_expr(). (finish_message_expr): Rename to objc_finish_message_expr(); use OBJC_TYPE_NAME and OBJC_SET_TYPE_NAME macros instead of TYPE_NAME. call gen_type_name() instead of gen_declaration(); call objc_is_id() instead of using IS_ID and IS_CLASS; Use objc_class_name instead of calling get_identifier("Class"); handle CONVERT_EXPRs in receiver. (build_objc_method_call, warn_with_method): Do not call groktypename(). (build_ivar_reference): Call convert() instead of clobbering in a type. (hash_init): Initialize string_htab hash table. (add_instance_variable): Simplify parameter list; do not call grokfield(); do not populate CLASS_IVARS list. (start_class): Check for the existence of super class, if one was specified. (continue_class): Use CLASS_RAW_IVARS rather than CLASS_IVARS; do not call build_class_template(); adjust call to get_class_ivars(); call build_decl(), pushdecl() and finish_decl() instead of define_decl(). (finish_class): Call build_decl(), pushdecl() and finish_decl() instead of define_decl(). (add_protocols): Use PROTOCOL_BINFO_ELTS for the tree vector size. (start_protocol): Do not call build_protocol_template(); use PROTOCOL_BINFO_ELTS for the tree vector size. (encode_type_qualifiers): Do not handle the 'const' qualifier here. (encode_pointer): Encode 'const char *' as 'r*', for backwards compatibility. (encode_array): Use HOST_WIDE_INT_PRINT_DEC instead of "%ld". (encode_type): Handle the 'const' qualifier here. (objc_parmlist): New global variable, sued by objc_push_parm and objc_get_parm_info(). (objc_push_parm, objc_get_parm_info): New functions. (objc_expr_last): Remove function. (synth_self_and_ucmd_args): For instance methods, use the instance type for 'self'; call objc_push_parm() instead of push_parm_decl(). (start_method_def): Do not call push_scope(), declare_parm_level(), pop_scope(), push_parm_decl(), store_parm_decls() or objc_expr_last(); just use objc_push_parm() and objc_get_parm_info(). (comp_method_with_proto): Remove function. (objc_types_are_equivalent): Strip away indirections before comparing underlying types. (comp_proto_with_proto): Do not call groktypename(); types are no longer in raw declspec format. (objc_start_function): New function. (really_start_method): Call comp_proto_with_proto() instead of comp_method_with_proto(); call objc_start_function() instead of hand-crafting a function declarator. (continue_method_def, objc_expand_function_end): Remove functions. (get_super_receiver): Call objc_get_current_scope() instead of get_current_scope(); reference 'super_class' field (instead of 'class'). (finish_method_def): Rename to objc_finish_method_definition() and add a function decl parameter; move method encoding call from objc_expand_function_end(). (is_complex_decl, adorn_decl, gen_declarator, gen_declspecs, gen_declaration_1): Remove functions. (tmpbuf, RAW_DECLSPEC): Remove. (gen_declaration): Remove second parameter; simplify to deal with TYPE_P nodes instead of raw declspecs. (gen_type_name, gen_type_name_0): New functions. (gen_method_decl): Remove second parameter; call gen_type_name() instead of gen_declaration_1(). (dump_interface): Adjust calls to gen_declaration() and gen_method_decl(); do not allocate a separate string buffer. (init_objc): Allocate a larger string buffer to accommodate dump_interface(); adjust call to build_module_descriptor(); add call to build_module_initializer_routine() for the GNU runtime. (generate_classref_translation_entry): Do not call start_decl(); call finish_var_decl() instead of finish_decl(); call convert() instead of build_c_cast(). * objc-act.h (CLASS_OWN_IVARS): Remove accessor. (CLASS_BINFO_ELTS): Reduce from 6 to 5, now that CLASS_OWN_IVARS is gone. (OCTI_GNU_INIT_DECL, GNU_INIT_decl): New. (OCTI_ELLIPSIS_NODE, objc_ellipsis_node): Remove. (OCTI_ID_ID, id_type, objc_id_id): Rename to OCTI_ID_NAME, objc_object_type and objc_object_name, respectively. (OCTI_CLS_REF, OCTI_CLASS_NAME, objc_class_reference, objc_class_name): New. (IS_CLASS): New macro. (IS_ID, IS_SUPER): Robustify. (OCTI_EXECCLASS_DECL, execclass_decl): New. (finish_file, start_class, continue_class, finish_class, start_method_def, continue_method_def, finish_method_def, start_protocol, finish_protocol, objc_build_throw_stmt, objc_build_try_catch_finally_stmt, objc_build_synchronized_prologue, objc_build_synchronized_epilogue, objc_build_try_prologue, objc_build_try_epilogue, objc_build_catch_stmt, objc_build_catch_epilogue, objc_build_finally_prologue, objc_build_finally_epilogue, is_ivar, is_private, is_public, add_instance_variable, objc_add_method, get_super_receiver, objc_clear_super_receiver, get_class_ivars_from_name, get_class_reference, get_static_reference, get_object_reference, build_message_expr, finish_message_expr, build_selector_expr, build_ivar_reference, build_keyword_decl, build_method_decl, build_protocol_expr, build_objc_string_object, objc_declare_alias, objc_declare_class, objc_declare_protocols, objc_comptypes, objc_check_decl, build_encode_expr): Remove prototypes. (imp_count, cat_count): Make GGC-aware. (OBJC_SET_TYPE_NAME): New macro. From-SVN: r87168
2004-09-08 02:49:44 +02:00
/* struct _objc_class *super_class; */
field_decl = create_field_decl (build_pointer_type (objc_class_template),
"super_class");
1992-01-18 00:15:38 +01:00
chainon (field_decl_chain, field_decl);
finish_struct (objc_super_template, field_decl_chain, NULL_TREE);
Makefile.in (c-parse.o): Depend on $(C_COMMON_H). [gcc/ChangeLog] 2004-09-07 Ziemowit Laski <zlaski@apple.com> * Makefile.in (c-parse.o): Depend on $(C_COMMON_H). * c-parse.in: Include c-common.h instead of objc-act.h. (ivar_decl_list, ivar_decls, ivar_decl, ivars, ivar_declarator, myparms, myparm): Remove %type declarations. (methodtype, optparms, OBJC_TYPE_QUAL, objc_quals, objc_qual, objc_typename, objc_try_catch_stmt, optellipsis): Add %type declarations. (objc_inherit_code, objc_public_flag): Remove. (typespec_nonreserved_nonattr): Call objc_get_protocol_qualified_type() instead of get_static_reference() and get_protocol_reference(). (stmt_nocomp): Call grokparm() on @catch parameter. (objcdef): Move semantic action to objc_finish_implementation(). (classdef): Move semantic action to objc_start_class_interface(), objc_continue_interface(), objc_finish_interface(), objc_start_class_implementation(), objc_continue_implementation(), objc_start_category_interface() and objc_start_category_implementation(). (protocoldef): Move semantic actions to objc_start_protocol() and objc_finish_interface(). (ivar_decl_list): Remove nonterminal. (visibility_spec): Move semantic actions to objc_set_visibility(). (ivar_decls): Remove assignment to $$. (ivar_decl): Rephrase in terms of component_decl; call objc_add_instance_variable(). (ivars, ivar_declarator): Remove nonterminals. (opt_semi): New nonterminal. (methodtype): Remove semantic actions. (methoddef): Move semantic actions to objc_set_method_type(), objc_start_method_definition() and objc_finish_method_definition(). (methodproto): Move semantic actions to objc_set_method_type() and objc_add_method_declaration(). (methoddecl): Use objc_typename instead of typename; move semantic actions to objc_build_method_signature(). (optarglist, myxdecls, mydecl, myparms, myparm): Remove nonterminals. (optparmlist): Express in terms of optparms and optellipsis. (optparms, optellipsis, objc_qual, objc_quals, objc_typename): New nonterminals. (keyworddecl): Use objc_typename instead of typename. (rid_to_yy): Mark RID_IN, RID_OUT, RID_INOUT, RID_BYCOPY, RID_BYREF and RID_ONEWAY as returning OBJC_TYPE_QUAL to yyparse(). [gcc/objc/ChangeLog] 2004-09-07 Ziemowit Laski <zlaski@apple.com> * Make-lang.in (objc/objc-parse.o): Depend on $(C_COMMON_H) instead of objc/objc-act.h. (objc/objc-act.o): Depend on $(HASHTAB_H). * objc-act.c: Include hashtab.h; in ObjC++ mode, include cp-tree.h and objcp-decl.h instead of c-tree.h. (build_module_descriptor, get_class_ivars, synth_id_with_class_suffix, error_with_ivar, gen_method_decl, gen_declaration, setup_string_decl, build_protocol_template): Adjust prototypes. (build_module_initializer_routine, start_class, continue_class, finish_class, start_method_def, objc_start_function, start_protocol, build_method_decl, objc_add_method, add_instance_variable, build_ivar_reference, is_ivar, is_private, get_super_receiver, build_selector_table_decl, objc_push_parm, objc_get_parm_info, gen_type_name, gen_type_name_0, start_var_decl, finish_var_decl, create_field_decl): New prototypes. (objc_expand_function_end, comp_method_with_proto, objc_expr_last, gen_declaration_1, gen_declarator, is_complex_decl, adorn_decl, define_decl, create_builtin_decl, gen_declspecs): Remove prototypes. (TYPE_ID): Rename to OBJECT_TYPEDEF_NAME. (CLASS_TYPEDEF_NAME): New. (TAG_EXECCLASS): Change from a global variable to a #define. (TAG_RETURN_STRUCT): Delete. (TAG_GNUINIT): New, holds '__objc_gnu_init' name. (objc_inherit_code, objc_public_flag): New, moved from c-parse.in. (string_descriptor): New struct. (string_htab): New hash table. (string_hash, string_eq): New prototypes. (generate_struct_by_value_array): Call create_field_decl() instead of create_builtin_decl(). (objc_init): Do not initialize objc_ellipsis_node or TAG_EXECCLASS; In ObjC++ mode, call cxx_init() instead of c_objc_common_init(). (objc_finish_file): In ObjC++, call instantiate_pending_templates() and cp_finish_file(). (define_decl, get_static_reference, get_protocol_reference, create_builtin_decl): Remove functions. (objc_start_class_interface, objc_start_category_interface, objc_start_protocol, objc_continue_interface, objc_finish_interface, objc_start_class_implementation, objc_start_category_implementation, objc_continue_implementation, objc_finish_implementation, objc_set_visibility, objc_set_method_type, objc_build_method_signature, objc_add_method_declaration, objc_start_method_definition, objc_add_instance_variable, objc_get_protocol_qualified_type, create_field_decl, start_var_decl, finish_var_decl): New functions. (setup_string_decl): Simplify since it is only called once. (synth_module_prologue): Call build_class_template(); predefine 'id' and 'Class' as typedefs; rename 'temp_type' to 'type'; disable debug hooks for duration of function; fix GNU runtime messenger signatures to correspond to reality; forward-declare '__objc_exec_class' for the GNU runtime; call build_selector_table_decl(); in ObjC++ mode, generate 'extern "C" { ... }' wrappers around synthesized declarations; call build_protocol_template() and build_category_template(). (string_hash, string_eq): New functions. (objc_build_string_object): Check metaclass correctness only once; store string literals in hash table. (objc_build_constructor): Do not convert initializer elements; adjust for ObjC++ impedance mismatch. (build_objc_symtab_template): Call create_field_decl() instead of create_builtin_decl(). (init_objc_symtab): Add missing conversion to initializer element. (build_metadata_decl): Call start_var_decl() instead of define_decl(). (generate_objc_symtab_decl): Do not call build_category_template(); call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(). (build_module_descriptor): Call create_field_decl() instead of grokfield(); call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(); always mark module descriptor as used; move GNU runtime-specific functionality to build_module_initializer_routine(). (build_module_initializer_routine): New function, broken off of build_module_descriptor(). (objc_static_init_needed_p, objc_generate_static_init_call): New functions. (generate_static_references, generate_strings, build_selector_translation_table, generate_descriptor_table, generate_ivars_list, generate_dispatch_table, generate_category): Call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(); build a type directly instead of via groktypename(). (build_selector_reference_decl, build_selector_table_decl, build_class_reference_decl, build_protocol_reference, generate_objc_image_info): Call start_var_decl() instead of build_decl(). (build_selector_reference): For GNU runtime, do not call build_selector_reference_decl(). (build_selector, build_typed_selector_reference): Always convert result to the selector type. (add_objc_string): Cast return value to 'char *'. (build_method_prototype_template, build_selector_template, build_method_template): Use actual selector type for fields pointing to selectors. (finish_objc): For GNU runtime, call build_module_initializer_routine() after build_module_descriptor(). (generate_protocol_list, generate_shared_structures): Call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(); build a type directly instead of via groktypename(). (synth_id_with_class_suffix): Return a string. (get_arg_type_list): For instance methods, use the instance type for 'self'; do not call groktypename_in_parm_context(). (build_objc_string_decl): Squash redeclaration errors in ObjC++. (objc_is_class_name): Use OBJC_TYPE_NAME instead of TYPE_NAME; handle RECORD_TYPEs in ObjC as well as ObjC++. (objc_is_id): New function. (objc_is_object_ptr): Return the canonical type node. (objc_get_class_ivars): Simplify using get_class_ivars(). (get_class_ivars): Remove second parameter; create a fresh copy of the ivar list for each call; do not check for existence of super class. (objc_eh_runtime_type): Mark #ifndef OBJCPLUS. (objc_init_exceptions): When using SJLJ-style exceptions, require the use of '-fobjc-exceptions' flag; do not require it for DWARF-style exceptions. (objc_build_exc_ptr, next_sjlj_build_try_catch_finally): Use objc_object_type instead of objc_id_type. (objc_begin_catch_clause): Convert the incoming PARM_DECL into a VAR_DECL before placing it in the appropriate scope; do not call define_decl(); adjust call to c_begin_compound_stmt(); use objc_object_type instead of objc_id_type. (build_next_objc_exception_stuff): Call create_field_decl() instead of create_builtin_decl(); construct type directly instead of calling groktypename(); use OBJC_VOID_AT_END to mark end of function parameters. (build_private_template): Adjust call to get_class_ivars(); build a type directly instead of via groktypename(). (build_protocol_template, build_method_prototype_list_template, build_method_prototype_template, build_category_template, build_selector_template, build_class_template, build_super_template, build_ivar_template, build_ivar_list_template, build_method_list_template, build_method_template): Call create_field_decl() instead of grokfield(). (objc_method_parm_type): Do not call groktypename(). (generate_descriptor_table): Call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(). (generate_method_descriptors, build_protocol_initializer, generate_dispatch_tables, build_category_initializer, build_shared_structure_initializer): Do not call groktypename(). (generate_protocols): Call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(); do not call groktypename(). (error_with_ivar): Remove last parameter. (check_ivars): Do not iterate ovar CLASS_RAW_IVARS lists in addition to CLASS_IVARS lists; adjust calls to error_with_ivar(). (generate_ivar_lists): Convert one of the initializer elements; do not call groktypename(). (get_arg_type_list, start_method_def, gen_method_def): Account for new representation of variable arguments and '...' in Objective-C methods; add Objective-C++ impedance matching code. (is_objc_type_qualifier): Remove function. (adjust_type_for_id_default): Simplify; there is no longer a need to wade through declspecs. (lookup_interface, start_class, continue_class, finish_class, start_method_def, start_protocol, build_method_decl, objc_add_method, add_instance_variable, build_ivar_reference, is_ivar, is_private, get_super_receiver, objc_build_finally_epilogue): Make into static functions. (receiver_is_class_object): Use new IS_CLASS() macro. (objc_build_message_expr): Tweak ObjC++ message argument handling; call objc_finish_message_expr() instead of finish_message_expr(). (finish_message_expr): Rename to objc_finish_message_expr(); use OBJC_TYPE_NAME and OBJC_SET_TYPE_NAME macros instead of TYPE_NAME. call gen_type_name() instead of gen_declaration(); call objc_is_id() instead of using IS_ID and IS_CLASS; Use objc_class_name instead of calling get_identifier("Class"); handle CONVERT_EXPRs in receiver. (build_objc_method_call, warn_with_method): Do not call groktypename(). (build_ivar_reference): Call convert() instead of clobbering in a type. (hash_init): Initialize string_htab hash table. (add_instance_variable): Simplify parameter list; do not call grokfield(); do not populate CLASS_IVARS list. (start_class): Check for the existence of super class, if one was specified. (continue_class): Use CLASS_RAW_IVARS rather than CLASS_IVARS; do not call build_class_template(); adjust call to get_class_ivars(); call build_decl(), pushdecl() and finish_decl() instead of define_decl(). (finish_class): Call build_decl(), pushdecl() and finish_decl() instead of define_decl(). (add_protocols): Use PROTOCOL_BINFO_ELTS for the tree vector size. (start_protocol): Do not call build_protocol_template(); use PROTOCOL_BINFO_ELTS for the tree vector size. (encode_type_qualifiers): Do not handle the 'const' qualifier here. (encode_pointer): Encode 'const char *' as 'r*', for backwards compatibility. (encode_array): Use HOST_WIDE_INT_PRINT_DEC instead of "%ld". (encode_type): Handle the 'const' qualifier here. (objc_parmlist): New global variable, sued by objc_push_parm and objc_get_parm_info(). (objc_push_parm, objc_get_parm_info): New functions. (objc_expr_last): Remove function. (synth_self_and_ucmd_args): For instance methods, use the instance type for 'self'; call objc_push_parm() instead of push_parm_decl(). (start_method_def): Do not call push_scope(), declare_parm_level(), pop_scope(), push_parm_decl(), store_parm_decls() or objc_expr_last(); just use objc_push_parm() and objc_get_parm_info(). (comp_method_with_proto): Remove function. (objc_types_are_equivalent): Strip away indirections before comparing underlying types. (comp_proto_with_proto): Do not call groktypename(); types are no longer in raw declspec format. (objc_start_function): New function. (really_start_method): Call comp_proto_with_proto() instead of comp_method_with_proto(); call objc_start_function() instead of hand-crafting a function declarator. (continue_method_def, objc_expand_function_end): Remove functions. (get_super_receiver): Call objc_get_current_scope() instead of get_current_scope(); reference 'super_class' field (instead of 'class'). (finish_method_def): Rename to objc_finish_method_definition() and add a function decl parameter; move method encoding call from objc_expand_function_end(). (is_complex_decl, adorn_decl, gen_declarator, gen_declspecs, gen_declaration_1): Remove functions. (tmpbuf, RAW_DECLSPEC): Remove. (gen_declaration): Remove second parameter; simplify to deal with TYPE_P nodes instead of raw declspecs. (gen_type_name, gen_type_name_0): New functions. (gen_method_decl): Remove second parameter; call gen_type_name() instead of gen_declaration_1(). (dump_interface): Adjust calls to gen_declaration() and gen_method_decl(); do not allocate a separate string buffer. (init_objc): Allocate a larger string buffer to accommodate dump_interface(); adjust call to build_module_descriptor(); add call to build_module_initializer_routine() for the GNU runtime. (generate_classref_translation_entry): Do not call start_decl(); call finish_var_decl() instead of finish_decl(); call convert() instead of build_c_cast(). * objc-act.h (CLASS_OWN_IVARS): Remove accessor. (CLASS_BINFO_ELTS): Reduce from 6 to 5, now that CLASS_OWN_IVARS is gone. (OCTI_GNU_INIT_DECL, GNU_INIT_decl): New. (OCTI_ELLIPSIS_NODE, objc_ellipsis_node): Remove. (OCTI_ID_ID, id_type, objc_id_id): Rename to OCTI_ID_NAME, objc_object_type and objc_object_name, respectively. (OCTI_CLS_REF, OCTI_CLASS_NAME, objc_class_reference, objc_class_name): New. (IS_CLASS): New macro. (IS_ID, IS_SUPER): Robustify. (OCTI_EXECCLASS_DECL, execclass_decl): New. (finish_file, start_class, continue_class, finish_class, start_method_def, continue_method_def, finish_method_def, start_protocol, finish_protocol, objc_build_throw_stmt, objc_build_try_catch_finally_stmt, objc_build_synchronized_prologue, objc_build_synchronized_epilogue, objc_build_try_prologue, objc_build_try_epilogue, objc_build_catch_stmt, objc_build_catch_epilogue, objc_build_finally_prologue, objc_build_finally_epilogue, is_ivar, is_private, is_public, add_instance_variable, objc_add_method, get_super_receiver, objc_clear_super_receiver, get_class_ivars_from_name, get_class_reference, get_static_reference, get_object_reference, build_message_expr, finish_message_expr, build_selector_expr, build_ivar_reference, build_keyword_decl, build_method_decl, build_protocol_expr, build_objc_string_object, objc_declare_alias, objc_declare_class, objc_declare_protocols, objc_comptypes, objc_check_decl, build_encode_expr): Remove prototypes. (imp_count, cat_count): Make GGC-aware. (OBJC_SET_TYPE_NAME): New macro. From-SVN: r87168
2004-09-08 02:49:44 +02:00
}
1992-01-18 00:15:38 +01:00
Makefile.in (c-parse.o): Depend on $(C_COMMON_H). [gcc/ChangeLog] 2004-09-07 Ziemowit Laski <zlaski@apple.com> * Makefile.in (c-parse.o): Depend on $(C_COMMON_H). * c-parse.in: Include c-common.h instead of objc-act.h. (ivar_decl_list, ivar_decls, ivar_decl, ivars, ivar_declarator, myparms, myparm): Remove %type declarations. (methodtype, optparms, OBJC_TYPE_QUAL, objc_quals, objc_qual, objc_typename, objc_try_catch_stmt, optellipsis): Add %type declarations. (objc_inherit_code, objc_public_flag): Remove. (typespec_nonreserved_nonattr): Call objc_get_protocol_qualified_type() instead of get_static_reference() and get_protocol_reference(). (stmt_nocomp): Call grokparm() on @catch parameter. (objcdef): Move semantic action to objc_finish_implementation(). (classdef): Move semantic action to objc_start_class_interface(), objc_continue_interface(), objc_finish_interface(), objc_start_class_implementation(), objc_continue_implementation(), objc_start_category_interface() and objc_start_category_implementation(). (protocoldef): Move semantic actions to objc_start_protocol() and objc_finish_interface(). (ivar_decl_list): Remove nonterminal. (visibility_spec): Move semantic actions to objc_set_visibility(). (ivar_decls): Remove assignment to $$. (ivar_decl): Rephrase in terms of component_decl; call objc_add_instance_variable(). (ivars, ivar_declarator): Remove nonterminals. (opt_semi): New nonterminal. (methodtype): Remove semantic actions. (methoddef): Move semantic actions to objc_set_method_type(), objc_start_method_definition() and objc_finish_method_definition(). (methodproto): Move semantic actions to objc_set_method_type() and objc_add_method_declaration(). (methoddecl): Use objc_typename instead of typename; move semantic actions to objc_build_method_signature(). (optarglist, myxdecls, mydecl, myparms, myparm): Remove nonterminals. (optparmlist): Express in terms of optparms and optellipsis. (optparms, optellipsis, objc_qual, objc_quals, objc_typename): New nonterminals. (keyworddecl): Use objc_typename instead of typename. (rid_to_yy): Mark RID_IN, RID_OUT, RID_INOUT, RID_BYCOPY, RID_BYREF and RID_ONEWAY as returning OBJC_TYPE_QUAL to yyparse(). [gcc/objc/ChangeLog] 2004-09-07 Ziemowit Laski <zlaski@apple.com> * Make-lang.in (objc/objc-parse.o): Depend on $(C_COMMON_H) instead of objc/objc-act.h. (objc/objc-act.o): Depend on $(HASHTAB_H). * objc-act.c: Include hashtab.h; in ObjC++ mode, include cp-tree.h and objcp-decl.h instead of c-tree.h. (build_module_descriptor, get_class_ivars, synth_id_with_class_suffix, error_with_ivar, gen_method_decl, gen_declaration, setup_string_decl, build_protocol_template): Adjust prototypes. (build_module_initializer_routine, start_class, continue_class, finish_class, start_method_def, objc_start_function, start_protocol, build_method_decl, objc_add_method, add_instance_variable, build_ivar_reference, is_ivar, is_private, get_super_receiver, build_selector_table_decl, objc_push_parm, objc_get_parm_info, gen_type_name, gen_type_name_0, start_var_decl, finish_var_decl, create_field_decl): New prototypes. (objc_expand_function_end, comp_method_with_proto, objc_expr_last, gen_declaration_1, gen_declarator, is_complex_decl, adorn_decl, define_decl, create_builtin_decl, gen_declspecs): Remove prototypes. (TYPE_ID): Rename to OBJECT_TYPEDEF_NAME. (CLASS_TYPEDEF_NAME): New. (TAG_EXECCLASS): Change from a global variable to a #define. (TAG_RETURN_STRUCT): Delete. (TAG_GNUINIT): New, holds '__objc_gnu_init' name. (objc_inherit_code, objc_public_flag): New, moved from c-parse.in. (string_descriptor): New struct. (string_htab): New hash table. (string_hash, string_eq): New prototypes. (generate_struct_by_value_array): Call create_field_decl() instead of create_builtin_decl(). (objc_init): Do not initialize objc_ellipsis_node or TAG_EXECCLASS; In ObjC++ mode, call cxx_init() instead of c_objc_common_init(). (objc_finish_file): In ObjC++, call instantiate_pending_templates() and cp_finish_file(). (define_decl, get_static_reference, get_protocol_reference, create_builtin_decl): Remove functions. (objc_start_class_interface, objc_start_category_interface, objc_start_protocol, objc_continue_interface, objc_finish_interface, objc_start_class_implementation, objc_start_category_implementation, objc_continue_implementation, objc_finish_implementation, objc_set_visibility, objc_set_method_type, objc_build_method_signature, objc_add_method_declaration, objc_start_method_definition, objc_add_instance_variable, objc_get_protocol_qualified_type, create_field_decl, start_var_decl, finish_var_decl): New functions. (setup_string_decl): Simplify since it is only called once. (synth_module_prologue): Call build_class_template(); predefine 'id' and 'Class' as typedefs; rename 'temp_type' to 'type'; disable debug hooks for duration of function; fix GNU runtime messenger signatures to correspond to reality; forward-declare '__objc_exec_class' for the GNU runtime; call build_selector_table_decl(); in ObjC++ mode, generate 'extern "C" { ... }' wrappers around synthesized declarations; call build_protocol_template() and build_category_template(). (string_hash, string_eq): New functions. (objc_build_string_object): Check metaclass correctness only once; store string literals in hash table. (objc_build_constructor): Do not convert initializer elements; adjust for ObjC++ impedance mismatch. (build_objc_symtab_template): Call create_field_decl() instead of create_builtin_decl(). (init_objc_symtab): Add missing conversion to initializer element. (build_metadata_decl): Call start_var_decl() instead of define_decl(). (generate_objc_symtab_decl): Do not call build_category_template(); call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(). (build_module_descriptor): Call create_field_decl() instead of grokfield(); call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(); always mark module descriptor as used; move GNU runtime-specific functionality to build_module_initializer_routine(). (build_module_initializer_routine): New function, broken off of build_module_descriptor(). (objc_static_init_needed_p, objc_generate_static_init_call): New functions. (generate_static_references, generate_strings, build_selector_translation_table, generate_descriptor_table, generate_ivars_list, generate_dispatch_table, generate_category): Call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(); build a type directly instead of via groktypename(). (build_selector_reference_decl, build_selector_table_decl, build_class_reference_decl, build_protocol_reference, generate_objc_image_info): Call start_var_decl() instead of build_decl(). (build_selector_reference): For GNU runtime, do not call build_selector_reference_decl(). (build_selector, build_typed_selector_reference): Always convert result to the selector type. (add_objc_string): Cast return value to 'char *'. (build_method_prototype_template, build_selector_template, build_method_template): Use actual selector type for fields pointing to selectors. (finish_objc): For GNU runtime, call build_module_initializer_routine() after build_module_descriptor(). (generate_protocol_list, generate_shared_structures): Call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(); build a type directly instead of via groktypename(). (synth_id_with_class_suffix): Return a string. (get_arg_type_list): For instance methods, use the instance type for 'self'; do not call groktypename_in_parm_context(). (build_objc_string_decl): Squash redeclaration errors in ObjC++. (objc_is_class_name): Use OBJC_TYPE_NAME instead of TYPE_NAME; handle RECORD_TYPEs in ObjC as well as ObjC++. (objc_is_id): New function. (objc_is_object_ptr): Return the canonical type node. (objc_get_class_ivars): Simplify using get_class_ivars(). (get_class_ivars): Remove second parameter; create a fresh copy of the ivar list for each call; do not check for existence of super class. (objc_eh_runtime_type): Mark #ifndef OBJCPLUS. (objc_init_exceptions): When using SJLJ-style exceptions, require the use of '-fobjc-exceptions' flag; do not require it for DWARF-style exceptions. (objc_build_exc_ptr, next_sjlj_build_try_catch_finally): Use objc_object_type instead of objc_id_type. (objc_begin_catch_clause): Convert the incoming PARM_DECL into a VAR_DECL before placing it in the appropriate scope; do not call define_decl(); adjust call to c_begin_compound_stmt(); use objc_object_type instead of objc_id_type. (build_next_objc_exception_stuff): Call create_field_decl() instead of create_builtin_decl(); construct type directly instead of calling groktypename(); use OBJC_VOID_AT_END to mark end of function parameters. (build_private_template): Adjust call to get_class_ivars(); build a type directly instead of via groktypename(). (build_protocol_template, build_method_prototype_list_template, build_method_prototype_template, build_category_template, build_selector_template, build_class_template, build_super_template, build_ivar_template, build_ivar_list_template, build_method_list_template, build_method_template): Call create_field_decl() instead of grokfield(). (objc_method_parm_type): Do not call groktypename(). (generate_descriptor_table): Call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(). (generate_method_descriptors, build_protocol_initializer, generate_dispatch_tables, build_category_initializer, build_shared_structure_initializer): Do not call groktypename(). (generate_protocols): Call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(); do not call groktypename(). (error_with_ivar): Remove last parameter. (check_ivars): Do not iterate ovar CLASS_RAW_IVARS lists in addition to CLASS_IVARS lists; adjust calls to error_with_ivar(). (generate_ivar_lists): Convert one of the initializer elements; do not call groktypename(). (get_arg_type_list, start_method_def, gen_method_def): Account for new representation of variable arguments and '...' in Objective-C methods; add Objective-C++ impedance matching code. (is_objc_type_qualifier): Remove function. (adjust_type_for_id_default): Simplify; there is no longer a need to wade through declspecs. (lookup_interface, start_class, continue_class, finish_class, start_method_def, start_protocol, build_method_decl, objc_add_method, add_instance_variable, build_ivar_reference, is_ivar, is_private, get_super_receiver, objc_build_finally_epilogue): Make into static functions. (receiver_is_class_object): Use new IS_CLASS() macro. (objc_build_message_expr): Tweak ObjC++ message argument handling; call objc_finish_message_expr() instead of finish_message_expr(). (finish_message_expr): Rename to objc_finish_message_expr(); use OBJC_TYPE_NAME and OBJC_SET_TYPE_NAME macros instead of TYPE_NAME. call gen_type_name() instead of gen_declaration(); call objc_is_id() instead of using IS_ID and IS_CLASS; Use objc_class_name instead of calling get_identifier("Class"); handle CONVERT_EXPRs in receiver. (build_objc_method_call, warn_with_method): Do not call groktypename(). (build_ivar_reference): Call convert() instead of clobbering in a type. (hash_init): Initialize string_htab hash table. (add_instance_variable): Simplify parameter list; do not call grokfield(); do not populate CLASS_IVARS list. (start_class): Check for the existence of super class, if one was specified. (continue_class): Use CLASS_RAW_IVARS rather than CLASS_IVARS; do not call build_class_template(); adjust call to get_class_ivars(); call build_decl(), pushdecl() and finish_decl() instead of define_decl(). (finish_class): Call build_decl(), pushdecl() and finish_decl() instead of define_decl(). (add_protocols): Use PROTOCOL_BINFO_ELTS for the tree vector size. (start_protocol): Do not call build_protocol_template(); use PROTOCOL_BINFO_ELTS for the tree vector size. (encode_type_qualifiers): Do not handle the 'const' qualifier here. (encode_pointer): Encode 'const char *' as 'r*', for backwards compatibility. (encode_array): Use HOST_WIDE_INT_PRINT_DEC instead of "%ld". (encode_type): Handle the 'const' qualifier here. (objc_parmlist): New global variable, sued by objc_push_parm and objc_get_parm_info(). (objc_push_parm, objc_get_parm_info): New functions. (objc_expr_last): Remove function. (synth_self_and_ucmd_args): For instance methods, use the instance type for 'self'; call objc_push_parm() instead of push_parm_decl(). (start_method_def): Do not call push_scope(), declare_parm_level(), pop_scope(), push_parm_decl(), store_parm_decls() or objc_expr_last(); just use objc_push_parm() and objc_get_parm_info(). (comp_method_with_proto): Remove function. (objc_types_are_equivalent): Strip away indirections before comparing underlying types. (comp_proto_with_proto): Do not call groktypename(); types are no longer in raw declspec format. (objc_start_function): New function. (really_start_method): Call comp_proto_with_proto() instead of comp_method_with_proto(); call objc_start_function() instead of hand-crafting a function declarator. (continue_method_def, objc_expand_function_end): Remove functions. (get_super_receiver): Call objc_get_current_scope() instead of get_current_scope(); reference 'super_class' field (instead of 'class'). (finish_method_def): Rename to objc_finish_method_definition() and add a function decl parameter; move method encoding call from objc_expand_function_end(). (is_complex_decl, adorn_decl, gen_declarator, gen_declspecs, gen_declaration_1): Remove functions. (tmpbuf, RAW_DECLSPEC): Remove. (gen_declaration): Remove second parameter; simplify to deal with TYPE_P nodes instead of raw declspecs. (gen_type_name, gen_type_name_0): New functions. (gen_method_decl): Remove second parameter; call gen_type_name() instead of gen_declaration_1(). (dump_interface): Adjust calls to gen_declaration() and gen_method_decl(); do not allocate a separate string buffer. (init_objc): Allocate a larger string buffer to accommodate dump_interface(); adjust call to build_module_descriptor(); add call to build_module_initializer_routine() for the GNU runtime. (generate_classref_translation_entry): Do not call start_decl(); call finish_var_decl() instead of finish_decl(); call convert() instead of build_c_cast(). * objc-act.h (CLASS_OWN_IVARS): Remove accessor. (CLASS_BINFO_ELTS): Reduce from 6 to 5, now that CLASS_OWN_IVARS is gone. (OCTI_GNU_INIT_DECL, GNU_INIT_decl): New. (OCTI_ELLIPSIS_NODE, objc_ellipsis_node): Remove. (OCTI_ID_ID, id_type, objc_id_id): Rename to OCTI_ID_NAME, objc_object_type and objc_object_name, respectively. (OCTI_CLS_REF, OCTI_CLASS_NAME, objc_class_reference, objc_class_name): New. (IS_CLASS): New macro. (IS_ID, IS_SUPER): Robustify. (OCTI_EXECCLASS_DECL, execclass_decl): New. (finish_file, start_class, continue_class, finish_class, start_method_def, continue_method_def, finish_method_def, start_protocol, finish_protocol, objc_build_throw_stmt, objc_build_try_catch_finally_stmt, objc_build_synchronized_prologue, objc_build_synchronized_epilogue, objc_build_try_prologue, objc_build_try_epilogue, objc_build_catch_stmt, objc_build_catch_epilogue, objc_build_finally_prologue, objc_build_finally_epilogue, is_ivar, is_private, is_public, add_instance_variable, objc_add_method, get_super_receiver, objc_clear_super_receiver, get_class_ivars_from_name, get_class_reference, get_static_reference, get_object_reference, build_message_expr, finish_message_expr, build_selector_expr, build_ivar_reference, build_keyword_decl, build_method_decl, build_protocol_expr, build_objc_string_object, objc_declare_alias, objc_declare_class, objc_declare_protocols, objc_comptypes, objc_check_decl, build_encode_expr): Remove prototypes. (imp_count, cat_count): Make GGC-aware. (OBJC_SET_TYPE_NAME): New macro. From-SVN: r87168
2004-09-08 02:49:44 +02:00
/* struct _objc_ivar {
char *ivar_name;
char *ivar_type;
int ivar_offset;
}; */
1992-01-18 00:15:38 +01:00
static tree
build_ivar_template (void)
1992-01-18 00:15:38 +01:00
{
tree objc_ivar_id, objc_ivar_record;
Makefile.in (c-parse.o): Depend on $(C_COMMON_H). [gcc/ChangeLog] 2004-09-07 Ziemowit Laski <zlaski@apple.com> * Makefile.in (c-parse.o): Depend on $(C_COMMON_H). * c-parse.in: Include c-common.h instead of objc-act.h. (ivar_decl_list, ivar_decls, ivar_decl, ivars, ivar_declarator, myparms, myparm): Remove %type declarations. (methodtype, optparms, OBJC_TYPE_QUAL, objc_quals, objc_qual, objc_typename, objc_try_catch_stmt, optellipsis): Add %type declarations. (objc_inherit_code, objc_public_flag): Remove. (typespec_nonreserved_nonattr): Call objc_get_protocol_qualified_type() instead of get_static_reference() and get_protocol_reference(). (stmt_nocomp): Call grokparm() on @catch parameter. (objcdef): Move semantic action to objc_finish_implementation(). (classdef): Move semantic action to objc_start_class_interface(), objc_continue_interface(), objc_finish_interface(), objc_start_class_implementation(), objc_continue_implementation(), objc_start_category_interface() and objc_start_category_implementation(). (protocoldef): Move semantic actions to objc_start_protocol() and objc_finish_interface(). (ivar_decl_list): Remove nonterminal. (visibility_spec): Move semantic actions to objc_set_visibility(). (ivar_decls): Remove assignment to $$. (ivar_decl): Rephrase in terms of component_decl; call objc_add_instance_variable(). (ivars, ivar_declarator): Remove nonterminals. (opt_semi): New nonterminal. (methodtype): Remove semantic actions. (methoddef): Move semantic actions to objc_set_method_type(), objc_start_method_definition() and objc_finish_method_definition(). (methodproto): Move semantic actions to objc_set_method_type() and objc_add_method_declaration(). (methoddecl): Use objc_typename instead of typename; move semantic actions to objc_build_method_signature(). (optarglist, myxdecls, mydecl, myparms, myparm): Remove nonterminals. (optparmlist): Express in terms of optparms and optellipsis. (optparms, optellipsis, objc_qual, objc_quals, objc_typename): New nonterminals. (keyworddecl): Use objc_typename instead of typename. (rid_to_yy): Mark RID_IN, RID_OUT, RID_INOUT, RID_BYCOPY, RID_BYREF and RID_ONEWAY as returning OBJC_TYPE_QUAL to yyparse(). [gcc/objc/ChangeLog] 2004-09-07 Ziemowit Laski <zlaski@apple.com> * Make-lang.in (objc/objc-parse.o): Depend on $(C_COMMON_H) instead of objc/objc-act.h. (objc/objc-act.o): Depend on $(HASHTAB_H). * objc-act.c: Include hashtab.h; in ObjC++ mode, include cp-tree.h and objcp-decl.h instead of c-tree.h. (build_module_descriptor, get_class_ivars, synth_id_with_class_suffix, error_with_ivar, gen_method_decl, gen_declaration, setup_string_decl, build_protocol_template): Adjust prototypes. (build_module_initializer_routine, start_class, continue_class, finish_class, start_method_def, objc_start_function, start_protocol, build_method_decl, objc_add_method, add_instance_variable, build_ivar_reference, is_ivar, is_private, get_super_receiver, build_selector_table_decl, objc_push_parm, objc_get_parm_info, gen_type_name, gen_type_name_0, start_var_decl, finish_var_decl, create_field_decl): New prototypes. (objc_expand_function_end, comp_method_with_proto, objc_expr_last, gen_declaration_1, gen_declarator, is_complex_decl, adorn_decl, define_decl, create_builtin_decl, gen_declspecs): Remove prototypes. (TYPE_ID): Rename to OBJECT_TYPEDEF_NAME. (CLASS_TYPEDEF_NAME): New. (TAG_EXECCLASS): Change from a global variable to a #define. (TAG_RETURN_STRUCT): Delete. (TAG_GNUINIT): New, holds '__objc_gnu_init' name. (objc_inherit_code, objc_public_flag): New, moved from c-parse.in. (string_descriptor): New struct. (string_htab): New hash table. (string_hash, string_eq): New prototypes. (generate_struct_by_value_array): Call create_field_decl() instead of create_builtin_decl(). (objc_init): Do not initialize objc_ellipsis_node or TAG_EXECCLASS; In ObjC++ mode, call cxx_init() instead of c_objc_common_init(). (objc_finish_file): In ObjC++, call instantiate_pending_templates() and cp_finish_file(). (define_decl, get_static_reference, get_protocol_reference, create_builtin_decl): Remove functions. (objc_start_class_interface, objc_start_category_interface, objc_start_protocol, objc_continue_interface, objc_finish_interface, objc_start_class_implementation, objc_start_category_implementation, objc_continue_implementation, objc_finish_implementation, objc_set_visibility, objc_set_method_type, objc_build_method_signature, objc_add_method_declaration, objc_start_method_definition, objc_add_instance_variable, objc_get_protocol_qualified_type, create_field_decl, start_var_decl, finish_var_decl): New functions. (setup_string_decl): Simplify since it is only called once. (synth_module_prologue): Call build_class_template(); predefine 'id' and 'Class' as typedefs; rename 'temp_type' to 'type'; disable debug hooks for duration of function; fix GNU runtime messenger signatures to correspond to reality; forward-declare '__objc_exec_class' for the GNU runtime; call build_selector_table_decl(); in ObjC++ mode, generate 'extern "C" { ... }' wrappers around synthesized declarations; call build_protocol_template() and build_category_template(). (string_hash, string_eq): New functions. (objc_build_string_object): Check metaclass correctness only once; store string literals in hash table. (objc_build_constructor): Do not convert initializer elements; adjust for ObjC++ impedance mismatch. (build_objc_symtab_template): Call create_field_decl() instead of create_builtin_decl(). (init_objc_symtab): Add missing conversion to initializer element. (build_metadata_decl): Call start_var_decl() instead of define_decl(). (generate_objc_symtab_decl): Do not call build_category_template(); call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(). (build_module_descriptor): Call create_field_decl() instead of grokfield(); call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(); always mark module descriptor as used; move GNU runtime-specific functionality to build_module_initializer_routine(). (build_module_initializer_routine): New function, broken off of build_module_descriptor(). (objc_static_init_needed_p, objc_generate_static_init_call): New functions. (generate_static_references, generate_strings, build_selector_translation_table, generate_descriptor_table, generate_ivars_list, generate_dispatch_table, generate_category): Call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(); build a type directly instead of via groktypename(). (build_selector_reference_decl, build_selector_table_decl, build_class_reference_decl, build_protocol_reference, generate_objc_image_info): Call start_var_decl() instead of build_decl(). (build_selector_reference): For GNU runtime, do not call build_selector_reference_decl(). (build_selector, build_typed_selector_reference): Always convert result to the selector type. (add_objc_string): Cast return value to 'char *'. (build_method_prototype_template, build_selector_template, build_method_template): Use actual selector type for fields pointing to selectors. (finish_objc): For GNU runtime, call build_module_initializer_routine() after build_module_descriptor(). (generate_protocol_list, generate_shared_structures): Call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(); build a type directly instead of via groktypename(). (synth_id_with_class_suffix): Return a string. (get_arg_type_list): For instance methods, use the instance type for 'self'; do not call groktypename_in_parm_context(). (build_objc_string_decl): Squash redeclaration errors in ObjC++. (objc_is_class_name): Use OBJC_TYPE_NAME instead of TYPE_NAME; handle RECORD_TYPEs in ObjC as well as ObjC++. (objc_is_id): New function. (objc_is_object_ptr): Return the canonical type node. (objc_get_class_ivars): Simplify using get_class_ivars(). (get_class_ivars): Remove second parameter; create a fresh copy of the ivar list for each call; do not check for existence of super class. (objc_eh_runtime_type): Mark #ifndef OBJCPLUS. (objc_init_exceptions): When using SJLJ-style exceptions, require the use of '-fobjc-exceptions' flag; do not require it for DWARF-style exceptions. (objc_build_exc_ptr, next_sjlj_build_try_catch_finally): Use objc_object_type instead of objc_id_type. (objc_begin_catch_clause): Convert the incoming PARM_DECL into a VAR_DECL before placing it in the appropriate scope; do not call define_decl(); adjust call to c_begin_compound_stmt(); use objc_object_type instead of objc_id_type. (build_next_objc_exception_stuff): Call create_field_decl() instead of create_builtin_decl(); construct type directly instead of calling groktypename(); use OBJC_VOID_AT_END to mark end of function parameters. (build_private_template): Adjust call to get_class_ivars(); build a type directly instead of via groktypename(). (build_protocol_template, build_method_prototype_list_template, build_method_prototype_template, build_category_template, build_selector_template, build_class_template, build_super_template, build_ivar_template, build_ivar_list_template, build_method_list_template, build_method_template): Call create_field_decl() instead of grokfield(). (objc_method_parm_type): Do not call groktypename(). (generate_descriptor_table): Call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(). (generate_method_descriptors, build_protocol_initializer, generate_dispatch_tables, build_category_initializer, build_shared_structure_initializer): Do not call groktypename(). (generate_protocols): Call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(); do not call groktypename(). (error_with_ivar): Remove last parameter. (check_ivars): Do not iterate ovar CLASS_RAW_IVARS lists in addition to CLASS_IVARS lists; adjust calls to error_with_ivar(). (generate_ivar_lists): Convert one of the initializer elements; do not call groktypename(). (get_arg_type_list, start_method_def, gen_method_def): Account for new representation of variable arguments and '...' in Objective-C methods; add Objective-C++ impedance matching code. (is_objc_type_qualifier): Remove function. (adjust_type_for_id_default): Simplify; there is no longer a need to wade through declspecs. (lookup_interface, start_class, continue_class, finish_class, start_method_def, start_protocol, build_method_decl, objc_add_method, add_instance_variable, build_ivar_reference, is_ivar, is_private, get_super_receiver, objc_build_finally_epilogue): Make into static functions. (receiver_is_class_object): Use new IS_CLASS() macro. (objc_build_message_expr): Tweak ObjC++ message argument handling; call objc_finish_message_expr() instead of finish_message_expr(). (finish_message_expr): Rename to objc_finish_message_expr(); use OBJC_TYPE_NAME and OBJC_SET_TYPE_NAME macros instead of TYPE_NAME. call gen_type_name() instead of gen_declaration(); call objc_is_id() instead of using IS_ID and IS_CLASS; Use objc_class_name instead of calling get_identifier("Class"); handle CONVERT_EXPRs in receiver. (build_objc_method_call, warn_with_method): Do not call groktypename(). (build_ivar_reference): Call convert() instead of clobbering in a type. (hash_init): Initialize string_htab hash table. (add_instance_variable): Simplify parameter list; do not call grokfield(); do not populate CLASS_IVARS list. (start_class): Check for the existence of super class, if one was specified. (continue_class): Use CLASS_RAW_IVARS rather than CLASS_IVARS; do not call build_class_template(); adjust call to get_class_ivars(); call build_decl(), pushdecl() and finish_decl() instead of define_decl(). (finish_class): Call build_decl(), pushdecl() and finish_decl() instead of define_decl(). (add_protocols): Use PROTOCOL_BINFO_ELTS for the tree vector size. (start_protocol): Do not call build_protocol_template(); use PROTOCOL_BINFO_ELTS for the tree vector size. (encode_type_qualifiers): Do not handle the 'const' qualifier here. (encode_pointer): Encode 'const char *' as 'r*', for backwards compatibility. (encode_array): Use HOST_WIDE_INT_PRINT_DEC instead of "%ld". (encode_type): Handle the 'const' qualifier here. (objc_parmlist): New global variable, sued by objc_push_parm and objc_get_parm_info(). (objc_push_parm, objc_get_parm_info): New functions. (objc_expr_last): Remove function. (synth_self_and_ucmd_args): For instance methods, use the instance type for 'self'; call objc_push_parm() instead of push_parm_decl(). (start_method_def): Do not call push_scope(), declare_parm_level(), pop_scope(), push_parm_decl(), store_parm_decls() or objc_expr_last(); just use objc_push_parm() and objc_get_parm_info(). (comp_method_with_proto): Remove function. (objc_types_are_equivalent): Strip away indirections before comparing underlying types. (comp_proto_with_proto): Do not call groktypename(); types are no longer in raw declspec format. (objc_start_function): New function. (really_start_method): Call comp_proto_with_proto() instead of comp_method_with_proto(); call objc_start_function() instead of hand-crafting a function declarator. (continue_method_def, objc_expand_function_end): Remove functions. (get_super_receiver): Call objc_get_current_scope() instead of get_current_scope(); reference 'super_class' field (instead of 'class'). (finish_method_def): Rename to objc_finish_method_definition() and add a function decl parameter; move method encoding call from objc_expand_function_end(). (is_complex_decl, adorn_decl, gen_declarator, gen_declspecs, gen_declaration_1): Remove functions. (tmpbuf, RAW_DECLSPEC): Remove. (gen_declaration): Remove second parameter; simplify to deal with TYPE_P nodes instead of raw declspecs. (gen_type_name, gen_type_name_0): New functions. (gen_method_decl): Remove second parameter; call gen_type_name() instead of gen_declaration_1(). (dump_interface): Adjust calls to gen_declaration() and gen_method_decl(); do not allocate a separate string buffer. (init_objc): Allocate a larger string buffer to accommodate dump_interface(); adjust call to build_module_descriptor(); add call to build_module_initializer_routine() for the GNU runtime. (generate_classref_translation_entry): Do not call start_decl(); call finish_var_decl() instead of finish_decl(); call convert() instead of build_c_cast(). * objc-act.h (CLASS_OWN_IVARS): Remove accessor. (CLASS_BINFO_ELTS): Reduce from 6 to 5, now that CLASS_OWN_IVARS is gone. (OCTI_GNU_INIT_DECL, GNU_INIT_decl): New. (OCTI_ELLIPSIS_NODE, objc_ellipsis_node): Remove. (OCTI_ID_ID, id_type, objc_id_id): Rename to OCTI_ID_NAME, objc_object_type and objc_object_name, respectively. (OCTI_CLS_REF, OCTI_CLASS_NAME, objc_class_reference, objc_class_name): New. (IS_CLASS): New macro. (IS_ID, IS_SUPER): Robustify. (OCTI_EXECCLASS_DECL, execclass_decl): New. (finish_file, start_class, continue_class, finish_class, start_method_def, continue_method_def, finish_method_def, start_protocol, finish_protocol, objc_build_throw_stmt, objc_build_try_catch_finally_stmt, objc_build_synchronized_prologue, objc_build_synchronized_epilogue, objc_build_try_prologue, objc_build_try_epilogue, objc_build_catch_stmt, objc_build_catch_epilogue, objc_build_finally_prologue, objc_build_finally_epilogue, is_ivar, is_private, is_public, add_instance_variable, objc_add_method, get_super_receiver, objc_clear_super_receiver, get_class_ivars_from_name, get_class_reference, get_static_reference, get_object_reference, build_message_expr, finish_message_expr, build_selector_expr, build_ivar_reference, build_keyword_decl, build_method_decl, build_protocol_expr, build_objc_string_object, objc_declare_alias, objc_declare_class, objc_declare_protocols, objc_comptypes, objc_check_decl, build_encode_expr): Remove prototypes. (imp_count, cat_count): Make GGC-aware. (OBJC_SET_TYPE_NAME): New macro. From-SVN: r87168
2004-09-08 02:49:44 +02:00
tree field_decl, field_decl_chain;
1992-01-18 00:15:38 +01:00
objc_ivar_id = get_identifier (UTAG_IVAR);
1992-01-18 00:15:38 +01:00
objc_ivar_record = start_struct (RECORD_TYPE, objc_ivar_id);
/* char *ivar_name; */
Makefile.in (c-parse.o): Depend on $(C_COMMON_H). [gcc/ChangeLog] 2004-09-07 Ziemowit Laski <zlaski@apple.com> * Makefile.in (c-parse.o): Depend on $(C_COMMON_H). * c-parse.in: Include c-common.h instead of objc-act.h. (ivar_decl_list, ivar_decls, ivar_decl, ivars, ivar_declarator, myparms, myparm): Remove %type declarations. (methodtype, optparms, OBJC_TYPE_QUAL, objc_quals, objc_qual, objc_typename, objc_try_catch_stmt, optellipsis): Add %type declarations. (objc_inherit_code, objc_public_flag): Remove. (typespec_nonreserved_nonattr): Call objc_get_protocol_qualified_type() instead of get_static_reference() and get_protocol_reference(). (stmt_nocomp): Call grokparm() on @catch parameter. (objcdef): Move semantic action to objc_finish_implementation(). (classdef): Move semantic action to objc_start_class_interface(), objc_continue_interface(), objc_finish_interface(), objc_start_class_implementation(), objc_continue_implementation(), objc_start_category_interface() and objc_start_category_implementation(). (protocoldef): Move semantic actions to objc_start_protocol() and objc_finish_interface(). (ivar_decl_list): Remove nonterminal. (visibility_spec): Move semantic actions to objc_set_visibility(). (ivar_decls): Remove assignment to $$. (ivar_decl): Rephrase in terms of component_decl; call objc_add_instance_variable(). (ivars, ivar_declarator): Remove nonterminals. (opt_semi): New nonterminal. (methodtype): Remove semantic actions. (methoddef): Move semantic actions to objc_set_method_type(), objc_start_method_definition() and objc_finish_method_definition(). (methodproto): Move semantic actions to objc_set_method_type() and objc_add_method_declaration(). (methoddecl): Use objc_typename instead of typename; move semantic actions to objc_build_method_signature(). (optarglist, myxdecls, mydecl, myparms, myparm): Remove nonterminals. (optparmlist): Express in terms of optparms and optellipsis. (optparms, optellipsis, objc_qual, objc_quals, objc_typename): New nonterminals. (keyworddecl): Use objc_typename instead of typename. (rid_to_yy): Mark RID_IN, RID_OUT, RID_INOUT, RID_BYCOPY, RID_BYREF and RID_ONEWAY as returning OBJC_TYPE_QUAL to yyparse(). [gcc/objc/ChangeLog] 2004-09-07 Ziemowit Laski <zlaski@apple.com> * Make-lang.in (objc/objc-parse.o): Depend on $(C_COMMON_H) instead of objc/objc-act.h. (objc/objc-act.o): Depend on $(HASHTAB_H). * objc-act.c: Include hashtab.h; in ObjC++ mode, include cp-tree.h and objcp-decl.h instead of c-tree.h. (build_module_descriptor, get_class_ivars, synth_id_with_class_suffix, error_with_ivar, gen_method_decl, gen_declaration, setup_string_decl, build_protocol_template): Adjust prototypes. (build_module_initializer_routine, start_class, continue_class, finish_class, start_method_def, objc_start_function, start_protocol, build_method_decl, objc_add_method, add_instance_variable, build_ivar_reference, is_ivar, is_private, get_super_receiver, build_selector_table_decl, objc_push_parm, objc_get_parm_info, gen_type_name, gen_type_name_0, start_var_decl, finish_var_decl, create_field_decl): New prototypes. (objc_expand_function_end, comp_method_with_proto, objc_expr_last, gen_declaration_1, gen_declarator, is_complex_decl, adorn_decl, define_decl, create_builtin_decl, gen_declspecs): Remove prototypes. (TYPE_ID): Rename to OBJECT_TYPEDEF_NAME. (CLASS_TYPEDEF_NAME): New. (TAG_EXECCLASS): Change from a global variable to a #define. (TAG_RETURN_STRUCT): Delete. (TAG_GNUINIT): New, holds '__objc_gnu_init' name. (objc_inherit_code, objc_public_flag): New, moved from c-parse.in. (string_descriptor): New struct. (string_htab): New hash table. (string_hash, string_eq): New prototypes. (generate_struct_by_value_array): Call create_field_decl() instead of create_builtin_decl(). (objc_init): Do not initialize objc_ellipsis_node or TAG_EXECCLASS; In ObjC++ mode, call cxx_init() instead of c_objc_common_init(). (objc_finish_file): In ObjC++, call instantiate_pending_templates() and cp_finish_file(). (define_decl, get_static_reference, get_protocol_reference, create_builtin_decl): Remove functions. (objc_start_class_interface, objc_start_category_interface, objc_start_protocol, objc_continue_interface, objc_finish_interface, objc_start_class_implementation, objc_start_category_implementation, objc_continue_implementation, objc_finish_implementation, objc_set_visibility, objc_set_method_type, objc_build_method_signature, objc_add_method_declaration, objc_start_method_definition, objc_add_instance_variable, objc_get_protocol_qualified_type, create_field_decl, start_var_decl, finish_var_decl): New functions. (setup_string_decl): Simplify since it is only called once. (synth_module_prologue): Call build_class_template(); predefine 'id' and 'Class' as typedefs; rename 'temp_type' to 'type'; disable debug hooks for duration of function; fix GNU runtime messenger signatures to correspond to reality; forward-declare '__objc_exec_class' for the GNU runtime; call build_selector_table_decl(); in ObjC++ mode, generate 'extern "C" { ... }' wrappers around synthesized declarations; call build_protocol_template() and build_category_template(). (string_hash, string_eq): New functions. (objc_build_string_object): Check metaclass correctness only once; store string literals in hash table. (objc_build_constructor): Do not convert initializer elements; adjust for ObjC++ impedance mismatch. (build_objc_symtab_template): Call create_field_decl() instead of create_builtin_decl(). (init_objc_symtab): Add missing conversion to initializer element. (build_metadata_decl): Call start_var_decl() instead of define_decl(). (generate_objc_symtab_decl): Do not call build_category_template(); call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(). (build_module_descriptor): Call create_field_decl() instead of grokfield(); call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(); always mark module descriptor as used; move GNU runtime-specific functionality to build_module_initializer_routine(). (build_module_initializer_routine): New function, broken off of build_module_descriptor(). (objc_static_init_needed_p, objc_generate_static_init_call): New functions. (generate_static_references, generate_strings, build_selector_translation_table, generate_descriptor_table, generate_ivars_list, generate_dispatch_table, generate_category): Call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(); build a type directly instead of via groktypename(). (build_selector_reference_decl, build_selector_table_decl, build_class_reference_decl, build_protocol_reference, generate_objc_image_info): Call start_var_decl() instead of build_decl(). (build_selector_reference): For GNU runtime, do not call build_selector_reference_decl(). (build_selector, build_typed_selector_reference): Always convert result to the selector type. (add_objc_string): Cast return value to 'char *'. (build_method_prototype_template, build_selector_template, build_method_template): Use actual selector type for fields pointing to selectors. (finish_objc): For GNU runtime, call build_module_initializer_routine() after build_module_descriptor(). (generate_protocol_list, generate_shared_structures): Call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(); build a type directly instead of via groktypename(). (synth_id_with_class_suffix): Return a string. (get_arg_type_list): For instance methods, use the instance type for 'self'; do not call groktypename_in_parm_context(). (build_objc_string_decl): Squash redeclaration errors in ObjC++. (objc_is_class_name): Use OBJC_TYPE_NAME instead of TYPE_NAME; handle RECORD_TYPEs in ObjC as well as ObjC++. (objc_is_id): New function. (objc_is_object_ptr): Return the canonical type node. (objc_get_class_ivars): Simplify using get_class_ivars(). (get_class_ivars): Remove second parameter; create a fresh copy of the ivar list for each call; do not check for existence of super class. (objc_eh_runtime_type): Mark #ifndef OBJCPLUS. (objc_init_exceptions): When using SJLJ-style exceptions, require the use of '-fobjc-exceptions' flag; do not require it for DWARF-style exceptions. (objc_build_exc_ptr, next_sjlj_build_try_catch_finally): Use objc_object_type instead of objc_id_type. (objc_begin_catch_clause): Convert the incoming PARM_DECL into a VAR_DECL before placing it in the appropriate scope; do not call define_decl(); adjust call to c_begin_compound_stmt(); use objc_object_type instead of objc_id_type. (build_next_objc_exception_stuff): Call create_field_decl() instead of create_builtin_decl(); construct type directly instead of calling groktypename(); use OBJC_VOID_AT_END to mark end of function parameters. (build_private_template): Adjust call to get_class_ivars(); build a type directly instead of via groktypename(). (build_protocol_template, build_method_prototype_list_template, build_method_prototype_template, build_category_template, build_selector_template, build_class_template, build_super_template, build_ivar_template, build_ivar_list_template, build_method_list_template, build_method_template): Call create_field_decl() instead of grokfield(). (objc_method_parm_type): Do not call groktypename(). (generate_descriptor_table): Call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(). (generate_method_descriptors, build_protocol_initializer, generate_dispatch_tables, build_category_initializer, build_shared_structure_initializer): Do not call groktypename(). (generate_protocols): Call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(); do not call groktypename(). (error_with_ivar): Remove last parameter. (check_ivars): Do not iterate ovar CLASS_RAW_IVARS lists in addition to CLASS_IVARS lists; adjust calls to error_with_ivar(). (generate_ivar_lists): Convert one of the initializer elements; do not call groktypename(). (get_arg_type_list, start_method_def, gen_method_def): Account for new representation of variable arguments and '...' in Objective-C methods; add Objective-C++ impedance matching code. (is_objc_type_qualifier): Remove function. (adjust_type_for_id_default): Simplify; there is no longer a need to wade through declspecs. (lookup_interface, start_class, continue_class, finish_class, start_method_def, start_protocol, build_method_decl, objc_add_method, add_instance_variable, build_ivar_reference, is_ivar, is_private, get_super_receiver, objc_build_finally_epilogue): Make into static functions. (receiver_is_class_object): Use new IS_CLASS() macro. (objc_build_message_expr): Tweak ObjC++ message argument handling; call objc_finish_message_expr() instead of finish_message_expr(). (finish_message_expr): Rename to objc_finish_message_expr(); use OBJC_TYPE_NAME and OBJC_SET_TYPE_NAME macros instead of TYPE_NAME. call gen_type_name() instead of gen_declaration(); call objc_is_id() instead of using IS_ID and IS_CLASS; Use objc_class_name instead of calling get_identifier("Class"); handle CONVERT_EXPRs in receiver. (build_objc_method_call, warn_with_method): Do not call groktypename(). (build_ivar_reference): Call convert() instead of clobbering in a type. (hash_init): Initialize string_htab hash table. (add_instance_variable): Simplify parameter list; do not call grokfield(); do not populate CLASS_IVARS list. (start_class): Check for the existence of super class, if one was specified. (continue_class): Use CLASS_RAW_IVARS rather than CLASS_IVARS; do not call build_class_template(); adjust call to get_class_ivars(); call build_decl(), pushdecl() and finish_decl() instead of define_decl(). (finish_class): Call build_decl(), pushdecl() and finish_decl() instead of define_decl(). (add_protocols): Use PROTOCOL_BINFO_ELTS for the tree vector size. (start_protocol): Do not call build_protocol_template(); use PROTOCOL_BINFO_ELTS for the tree vector size. (encode_type_qualifiers): Do not handle the 'const' qualifier here. (encode_pointer): Encode 'const char *' as 'r*', for backwards compatibility. (encode_array): Use HOST_WIDE_INT_PRINT_DEC instead of "%ld". (encode_type): Handle the 'const' qualifier here. (objc_parmlist): New global variable, sued by objc_push_parm and objc_get_parm_info(). (objc_push_parm, objc_get_parm_info): New functions. (objc_expr_last): Remove function. (synth_self_and_ucmd_args): For instance methods, use the instance type for 'self'; call objc_push_parm() instead of push_parm_decl(). (start_method_def): Do not call push_scope(), declare_parm_level(), pop_scope(), push_parm_decl(), store_parm_decls() or objc_expr_last(); just use objc_push_parm() and objc_get_parm_info(). (comp_method_with_proto): Remove function. (objc_types_are_equivalent): Strip away indirections before comparing underlying types. (comp_proto_with_proto): Do not call groktypename(); types are no longer in raw declspec format. (objc_start_function): New function. (really_start_method): Call comp_proto_with_proto() instead of comp_method_with_proto(); call objc_start_function() instead of hand-crafting a function declarator. (continue_method_def, objc_expand_function_end): Remove functions. (get_super_receiver): Call objc_get_current_scope() instead of get_current_scope(); reference 'super_class' field (instead of 'class'). (finish_method_def): Rename to objc_finish_method_definition() and add a function decl parameter; move method encoding call from objc_expand_function_end(). (is_complex_decl, adorn_decl, gen_declarator, gen_declspecs, gen_declaration_1): Remove functions. (tmpbuf, RAW_DECLSPEC): Remove. (gen_declaration): Remove second parameter; simplify to deal with TYPE_P nodes instead of raw declspecs. (gen_type_name, gen_type_name_0): New functions. (gen_method_decl): Remove second parameter; call gen_type_name() instead of gen_declaration_1(). (dump_interface): Adjust calls to gen_declaration() and gen_method_decl(); do not allocate a separate string buffer. (init_objc): Allocate a larger string buffer to accommodate dump_interface(); adjust call to build_module_descriptor(); add call to build_module_initializer_routine() for the GNU runtime. (generate_classref_translation_entry): Do not call start_decl(); call finish_var_decl() instead of finish_decl(); call convert() instead of build_c_cast(). * objc-act.h (CLASS_OWN_IVARS): Remove accessor. (CLASS_BINFO_ELTS): Reduce from 6 to 5, now that CLASS_OWN_IVARS is gone. (OCTI_GNU_INIT_DECL, GNU_INIT_decl): New. (OCTI_ELLIPSIS_NODE, objc_ellipsis_node): Remove. (OCTI_ID_ID, id_type, objc_id_id): Rename to OCTI_ID_NAME, objc_object_type and objc_object_name, respectively. (OCTI_CLS_REF, OCTI_CLASS_NAME, objc_class_reference, objc_class_name): New. (IS_CLASS): New macro. (IS_ID, IS_SUPER): Robustify. (OCTI_EXECCLASS_DECL, execclass_decl): New. (finish_file, start_class, continue_class, finish_class, start_method_def, continue_method_def, finish_method_def, start_protocol, finish_protocol, objc_build_throw_stmt, objc_build_try_catch_finally_stmt, objc_build_synchronized_prologue, objc_build_synchronized_epilogue, objc_build_try_prologue, objc_build_try_epilogue, objc_build_catch_stmt, objc_build_catch_epilogue, objc_build_finally_prologue, objc_build_finally_epilogue, is_ivar, is_private, is_public, add_instance_variable, objc_add_method, get_super_receiver, objc_clear_super_receiver, get_class_ivars_from_name, get_class_reference, get_static_reference, get_object_reference, build_message_expr, finish_message_expr, build_selector_expr, build_ivar_reference, build_keyword_decl, build_method_decl, build_protocol_expr, build_objc_string_object, objc_declare_alias, objc_declare_class, objc_declare_protocols, objc_comptypes, objc_check_decl, build_encode_expr): Remove prototypes. (imp_count, cat_count): Make GGC-aware. (OBJC_SET_TYPE_NAME): New macro. From-SVN: r87168
2004-09-08 02:49:44 +02:00
field_decl = create_field_decl (string_type_node, "ivar_name");
1992-01-18 00:15:38 +01:00
field_decl_chain = field_decl;
/* char *ivar_type; */
Makefile.in (c-parse.o): Depend on $(C_COMMON_H). [gcc/ChangeLog] 2004-09-07 Ziemowit Laski <zlaski@apple.com> * Makefile.in (c-parse.o): Depend on $(C_COMMON_H). * c-parse.in: Include c-common.h instead of objc-act.h. (ivar_decl_list, ivar_decls, ivar_decl, ivars, ivar_declarator, myparms, myparm): Remove %type declarations. (methodtype, optparms, OBJC_TYPE_QUAL, objc_quals, objc_qual, objc_typename, objc_try_catch_stmt, optellipsis): Add %type declarations. (objc_inherit_code, objc_public_flag): Remove. (typespec_nonreserved_nonattr): Call objc_get_protocol_qualified_type() instead of get_static_reference() and get_protocol_reference(). (stmt_nocomp): Call grokparm() on @catch parameter. (objcdef): Move semantic action to objc_finish_implementation(). (classdef): Move semantic action to objc_start_class_interface(), objc_continue_interface(), objc_finish_interface(), objc_start_class_implementation(), objc_continue_implementation(), objc_start_category_interface() and objc_start_category_implementation(). (protocoldef): Move semantic actions to objc_start_protocol() and objc_finish_interface(). (ivar_decl_list): Remove nonterminal. (visibility_spec): Move semantic actions to objc_set_visibility(). (ivar_decls): Remove assignment to $$. (ivar_decl): Rephrase in terms of component_decl; call objc_add_instance_variable(). (ivars, ivar_declarator): Remove nonterminals. (opt_semi): New nonterminal. (methodtype): Remove semantic actions. (methoddef): Move semantic actions to objc_set_method_type(), objc_start_method_definition() and objc_finish_method_definition(). (methodproto): Move semantic actions to objc_set_method_type() and objc_add_method_declaration(). (methoddecl): Use objc_typename instead of typename; move semantic actions to objc_build_method_signature(). (optarglist, myxdecls, mydecl, myparms, myparm): Remove nonterminals. (optparmlist): Express in terms of optparms and optellipsis. (optparms, optellipsis, objc_qual, objc_quals, objc_typename): New nonterminals. (keyworddecl): Use objc_typename instead of typename. (rid_to_yy): Mark RID_IN, RID_OUT, RID_INOUT, RID_BYCOPY, RID_BYREF and RID_ONEWAY as returning OBJC_TYPE_QUAL to yyparse(). [gcc/objc/ChangeLog] 2004-09-07 Ziemowit Laski <zlaski@apple.com> * Make-lang.in (objc/objc-parse.o): Depend on $(C_COMMON_H) instead of objc/objc-act.h. (objc/objc-act.o): Depend on $(HASHTAB_H). * objc-act.c: Include hashtab.h; in ObjC++ mode, include cp-tree.h and objcp-decl.h instead of c-tree.h. (build_module_descriptor, get_class_ivars, synth_id_with_class_suffix, error_with_ivar, gen_method_decl, gen_declaration, setup_string_decl, build_protocol_template): Adjust prototypes. (build_module_initializer_routine, start_class, continue_class, finish_class, start_method_def, objc_start_function, start_protocol, build_method_decl, objc_add_method, add_instance_variable, build_ivar_reference, is_ivar, is_private, get_super_receiver, build_selector_table_decl, objc_push_parm, objc_get_parm_info, gen_type_name, gen_type_name_0, start_var_decl, finish_var_decl, create_field_decl): New prototypes. (objc_expand_function_end, comp_method_with_proto, objc_expr_last, gen_declaration_1, gen_declarator, is_complex_decl, adorn_decl, define_decl, create_builtin_decl, gen_declspecs): Remove prototypes. (TYPE_ID): Rename to OBJECT_TYPEDEF_NAME. (CLASS_TYPEDEF_NAME): New. (TAG_EXECCLASS): Change from a global variable to a #define. (TAG_RETURN_STRUCT): Delete. (TAG_GNUINIT): New, holds '__objc_gnu_init' name. (objc_inherit_code, objc_public_flag): New, moved from c-parse.in. (string_descriptor): New struct. (string_htab): New hash table. (string_hash, string_eq): New prototypes. (generate_struct_by_value_array): Call create_field_decl() instead of create_builtin_decl(). (objc_init): Do not initialize objc_ellipsis_node or TAG_EXECCLASS; In ObjC++ mode, call cxx_init() instead of c_objc_common_init(). (objc_finish_file): In ObjC++, call instantiate_pending_templates() and cp_finish_file(). (define_decl, get_static_reference, get_protocol_reference, create_builtin_decl): Remove functions. (objc_start_class_interface, objc_start_category_interface, objc_start_protocol, objc_continue_interface, objc_finish_interface, objc_start_class_implementation, objc_start_category_implementation, objc_continue_implementation, objc_finish_implementation, objc_set_visibility, objc_set_method_type, objc_build_method_signature, objc_add_method_declaration, objc_start_method_definition, objc_add_instance_variable, objc_get_protocol_qualified_type, create_field_decl, start_var_decl, finish_var_decl): New functions. (setup_string_decl): Simplify since it is only called once. (synth_module_prologue): Call build_class_template(); predefine 'id' and 'Class' as typedefs; rename 'temp_type' to 'type'; disable debug hooks for duration of function; fix GNU runtime messenger signatures to correspond to reality; forward-declare '__objc_exec_class' for the GNU runtime; call build_selector_table_decl(); in ObjC++ mode, generate 'extern "C" { ... }' wrappers around synthesized declarations; call build_protocol_template() and build_category_template(). (string_hash, string_eq): New functions. (objc_build_string_object): Check metaclass correctness only once; store string literals in hash table. (objc_build_constructor): Do not convert initializer elements; adjust for ObjC++ impedance mismatch. (build_objc_symtab_template): Call create_field_decl() instead of create_builtin_decl(). (init_objc_symtab): Add missing conversion to initializer element. (build_metadata_decl): Call start_var_decl() instead of define_decl(). (generate_objc_symtab_decl): Do not call build_category_template(); call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(). (build_module_descriptor): Call create_field_decl() instead of grokfield(); call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(); always mark module descriptor as used; move GNU runtime-specific functionality to build_module_initializer_routine(). (build_module_initializer_routine): New function, broken off of build_module_descriptor(). (objc_static_init_needed_p, objc_generate_static_init_call): New functions. (generate_static_references, generate_strings, build_selector_translation_table, generate_descriptor_table, generate_ivars_list, generate_dispatch_table, generate_category): Call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(); build a type directly instead of via groktypename(). (build_selector_reference_decl, build_selector_table_decl, build_class_reference_decl, build_protocol_reference, generate_objc_image_info): Call start_var_decl() instead of build_decl(). (build_selector_reference): For GNU runtime, do not call build_selector_reference_decl(). (build_selector, build_typed_selector_reference): Always convert result to the selector type. (add_objc_string): Cast return value to 'char *'. (build_method_prototype_template, build_selector_template, build_method_template): Use actual selector type for fields pointing to selectors. (finish_objc): For GNU runtime, call build_module_initializer_routine() after build_module_descriptor(). (generate_protocol_list, generate_shared_structures): Call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(); build a type directly instead of via groktypename(). (synth_id_with_class_suffix): Return a string. (get_arg_type_list): For instance methods, use the instance type for 'self'; do not call groktypename_in_parm_context(). (build_objc_string_decl): Squash redeclaration errors in ObjC++. (objc_is_class_name): Use OBJC_TYPE_NAME instead of TYPE_NAME; handle RECORD_TYPEs in ObjC as well as ObjC++. (objc_is_id): New function. (objc_is_object_ptr): Return the canonical type node. (objc_get_class_ivars): Simplify using get_class_ivars(). (get_class_ivars): Remove second parameter; create a fresh copy of the ivar list for each call; do not check for existence of super class. (objc_eh_runtime_type): Mark #ifndef OBJCPLUS. (objc_init_exceptions): When using SJLJ-style exceptions, require the use of '-fobjc-exceptions' flag; do not require it for DWARF-style exceptions. (objc_build_exc_ptr, next_sjlj_build_try_catch_finally): Use objc_object_type instead of objc_id_type. (objc_begin_catch_clause): Convert the incoming PARM_DECL into a VAR_DECL before placing it in the appropriate scope; do not call define_decl(); adjust call to c_begin_compound_stmt(); use objc_object_type instead of objc_id_type. (build_next_objc_exception_stuff): Call create_field_decl() instead of create_builtin_decl(); construct type directly instead of calling groktypename(); use OBJC_VOID_AT_END to mark end of function parameters. (build_private_template): Adjust call to get_class_ivars(); build a type directly instead of via groktypename(). (build_protocol_template, build_method_prototype_list_template, build_method_prototype_template, build_category_template, build_selector_template, build_class_template, build_super_template, build_ivar_template, build_ivar_list_template, build_method_list_template, build_method_template): Call create_field_decl() instead of grokfield(). (objc_method_parm_type): Do not call groktypename(). (generate_descriptor_table): Call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(). (generate_method_descriptors, build_protocol_initializer, generate_dispatch_tables, build_category_initializer, build_shared_structure_initializer): Do not call groktypename(). (generate_protocols): Call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(); do not call groktypename(). (error_with_ivar): Remove last parameter. (check_ivars): Do not iterate ovar CLASS_RAW_IVARS lists in addition to CLASS_IVARS lists; adjust calls to error_with_ivar(). (generate_ivar_lists): Convert one of the initializer elements; do not call groktypename(). (get_arg_type_list, start_method_def, gen_method_def): Account for new representation of variable arguments and '...' in Objective-C methods; add Objective-C++ impedance matching code. (is_objc_type_qualifier): Remove function. (adjust_type_for_id_default): Simplify; there is no longer a need to wade through declspecs. (lookup_interface, start_class, continue_class, finish_class, start_method_def, start_protocol, build_method_decl, objc_add_method, add_instance_variable, build_ivar_reference, is_ivar, is_private, get_super_receiver, objc_build_finally_epilogue): Make into static functions. (receiver_is_class_object): Use new IS_CLASS() macro. (objc_build_message_expr): Tweak ObjC++ message argument handling; call objc_finish_message_expr() instead of finish_message_expr(). (finish_message_expr): Rename to objc_finish_message_expr(); use OBJC_TYPE_NAME and OBJC_SET_TYPE_NAME macros instead of TYPE_NAME. call gen_type_name() instead of gen_declaration(); call objc_is_id() instead of using IS_ID and IS_CLASS; Use objc_class_name instead of calling get_identifier("Class"); handle CONVERT_EXPRs in receiver. (build_objc_method_call, warn_with_method): Do not call groktypename(). (build_ivar_reference): Call convert() instead of clobbering in a type. (hash_init): Initialize string_htab hash table. (add_instance_variable): Simplify parameter list; do not call grokfield(); do not populate CLASS_IVARS list. (start_class): Check for the existence of super class, if one was specified. (continue_class): Use CLASS_RAW_IVARS rather than CLASS_IVARS; do not call build_class_template(); adjust call to get_class_ivars(); call build_decl(), pushdecl() and finish_decl() instead of define_decl(). (finish_class): Call build_decl(), pushdecl() and finish_decl() instead of define_decl(). (add_protocols): Use PROTOCOL_BINFO_ELTS for the tree vector size. (start_protocol): Do not call build_protocol_template(); use PROTOCOL_BINFO_ELTS for the tree vector size. (encode_type_qualifiers): Do not handle the 'const' qualifier here. (encode_pointer): Encode 'const char *' as 'r*', for backwards compatibility. (encode_array): Use HOST_WIDE_INT_PRINT_DEC instead of "%ld". (encode_type): Handle the 'const' qualifier here. (objc_parmlist): New global variable, sued by objc_push_parm and objc_get_parm_info(). (objc_push_parm, objc_get_parm_info): New functions. (objc_expr_last): Remove function. (synth_self_and_ucmd_args): For instance methods, use the instance type for 'self'; call objc_push_parm() instead of push_parm_decl(). (start_method_def): Do not call push_scope(), declare_parm_level(), pop_scope(), push_parm_decl(), store_parm_decls() or objc_expr_last(); just use objc_push_parm() and objc_get_parm_info(). (comp_method_with_proto): Remove function. (objc_types_are_equivalent): Strip away indirections before comparing underlying types. (comp_proto_with_proto): Do not call groktypename(); types are no longer in raw declspec format. (objc_start_function): New function. (really_start_method): Call comp_proto_with_proto() instead of comp_method_with_proto(); call objc_start_function() instead of hand-crafting a function declarator. (continue_method_def, objc_expand_function_end): Remove functions. (get_super_receiver): Call objc_get_current_scope() instead of get_current_scope(); reference 'super_class' field (instead of 'class'). (finish_method_def): Rename to objc_finish_method_definition() and add a function decl parameter; move method encoding call from objc_expand_function_end(). (is_complex_decl, adorn_decl, gen_declarator, gen_declspecs, gen_declaration_1): Remove functions. (tmpbuf, RAW_DECLSPEC): Remove. (gen_declaration): Remove second parameter; simplify to deal with TYPE_P nodes instead of raw declspecs. (gen_type_name, gen_type_name_0): New functions. (gen_method_decl): Remove second parameter; call gen_type_name() instead of gen_declaration_1(). (dump_interface): Adjust calls to gen_declaration() and gen_method_decl(); do not allocate a separate string buffer. (init_objc): Allocate a larger string buffer to accommodate dump_interface(); adjust call to build_module_descriptor(); add call to build_module_initializer_routine() for the GNU runtime. (generate_classref_translation_entry): Do not call start_decl(); call finish_var_decl() instead of finish_decl(); call convert() instead of build_c_cast(). * objc-act.h (CLASS_OWN_IVARS): Remove accessor. (CLASS_BINFO_ELTS): Reduce from 6 to 5, now that CLASS_OWN_IVARS is gone. (OCTI_GNU_INIT_DECL, GNU_INIT_decl): New. (OCTI_ELLIPSIS_NODE, objc_ellipsis_node): Remove. (OCTI_ID_ID, id_type, objc_id_id): Rename to OCTI_ID_NAME, objc_object_type and objc_object_name, respectively. (OCTI_CLS_REF, OCTI_CLASS_NAME, objc_class_reference, objc_class_name): New. (IS_CLASS): New macro. (IS_ID, IS_SUPER): Robustify. (OCTI_EXECCLASS_DECL, execclass_decl): New. (finish_file, start_class, continue_class, finish_class, start_method_def, continue_method_def, finish_method_def, start_protocol, finish_protocol, objc_build_throw_stmt, objc_build_try_catch_finally_stmt, objc_build_synchronized_prologue, objc_build_synchronized_epilogue, objc_build_try_prologue, objc_build_try_epilogue, objc_build_catch_stmt, objc_build_catch_epilogue, objc_build_finally_prologue, objc_build_finally_epilogue, is_ivar, is_private, is_public, add_instance_variable, objc_add_method, get_super_receiver, objc_clear_super_receiver, get_class_ivars_from_name, get_class_reference, get_static_reference, get_object_reference, build_message_expr, finish_message_expr, build_selector_expr, build_ivar_reference, build_keyword_decl, build_method_decl, build_protocol_expr, build_objc_string_object, objc_declare_alias, objc_declare_class, objc_declare_protocols, objc_comptypes, objc_check_decl, build_encode_expr): Remove prototypes. (imp_count, cat_count): Make GGC-aware. (OBJC_SET_TYPE_NAME): New macro. From-SVN: r87168
2004-09-08 02:49:44 +02:00
field_decl = create_field_decl (string_type_node, "ivar_type");
1992-01-18 00:15:38 +01:00
chainon (field_decl_chain, field_decl);
/* int ivar_offset; */
Makefile.in (c-parse.o): Depend on $(C_COMMON_H). [gcc/ChangeLog] 2004-09-07 Ziemowit Laski <zlaski@apple.com> * Makefile.in (c-parse.o): Depend on $(C_COMMON_H). * c-parse.in: Include c-common.h instead of objc-act.h. (ivar_decl_list, ivar_decls, ivar_decl, ivars, ivar_declarator, myparms, myparm): Remove %type declarations. (methodtype, optparms, OBJC_TYPE_QUAL, objc_quals, objc_qual, objc_typename, objc_try_catch_stmt, optellipsis): Add %type declarations. (objc_inherit_code, objc_public_flag): Remove. (typespec_nonreserved_nonattr): Call objc_get_protocol_qualified_type() instead of get_static_reference() and get_protocol_reference(). (stmt_nocomp): Call grokparm() on @catch parameter. (objcdef): Move semantic action to objc_finish_implementation(). (classdef): Move semantic action to objc_start_class_interface(), objc_continue_interface(), objc_finish_interface(), objc_start_class_implementation(), objc_continue_implementation(), objc_start_category_interface() and objc_start_category_implementation(). (protocoldef): Move semantic actions to objc_start_protocol() and objc_finish_interface(). (ivar_decl_list): Remove nonterminal. (visibility_spec): Move semantic actions to objc_set_visibility(). (ivar_decls): Remove assignment to $$. (ivar_decl): Rephrase in terms of component_decl; call objc_add_instance_variable(). (ivars, ivar_declarator): Remove nonterminals. (opt_semi): New nonterminal. (methodtype): Remove semantic actions. (methoddef): Move semantic actions to objc_set_method_type(), objc_start_method_definition() and objc_finish_method_definition(). (methodproto): Move semantic actions to objc_set_method_type() and objc_add_method_declaration(). (methoddecl): Use objc_typename instead of typename; move semantic actions to objc_build_method_signature(). (optarglist, myxdecls, mydecl, myparms, myparm): Remove nonterminals. (optparmlist): Express in terms of optparms and optellipsis. (optparms, optellipsis, objc_qual, objc_quals, objc_typename): New nonterminals. (keyworddecl): Use objc_typename instead of typename. (rid_to_yy): Mark RID_IN, RID_OUT, RID_INOUT, RID_BYCOPY, RID_BYREF and RID_ONEWAY as returning OBJC_TYPE_QUAL to yyparse(). [gcc/objc/ChangeLog] 2004-09-07 Ziemowit Laski <zlaski@apple.com> * Make-lang.in (objc/objc-parse.o): Depend on $(C_COMMON_H) instead of objc/objc-act.h. (objc/objc-act.o): Depend on $(HASHTAB_H). * objc-act.c: Include hashtab.h; in ObjC++ mode, include cp-tree.h and objcp-decl.h instead of c-tree.h. (build_module_descriptor, get_class_ivars, synth_id_with_class_suffix, error_with_ivar, gen_method_decl, gen_declaration, setup_string_decl, build_protocol_template): Adjust prototypes. (build_module_initializer_routine, start_class, continue_class, finish_class, start_method_def, objc_start_function, start_protocol, build_method_decl, objc_add_method, add_instance_variable, build_ivar_reference, is_ivar, is_private, get_super_receiver, build_selector_table_decl, objc_push_parm, objc_get_parm_info, gen_type_name, gen_type_name_0, start_var_decl, finish_var_decl, create_field_decl): New prototypes. (objc_expand_function_end, comp_method_with_proto, objc_expr_last, gen_declaration_1, gen_declarator, is_complex_decl, adorn_decl, define_decl, create_builtin_decl, gen_declspecs): Remove prototypes. (TYPE_ID): Rename to OBJECT_TYPEDEF_NAME. (CLASS_TYPEDEF_NAME): New. (TAG_EXECCLASS): Change from a global variable to a #define. (TAG_RETURN_STRUCT): Delete. (TAG_GNUINIT): New, holds '__objc_gnu_init' name. (objc_inherit_code, objc_public_flag): New, moved from c-parse.in. (string_descriptor): New struct. (string_htab): New hash table. (string_hash, string_eq): New prototypes. (generate_struct_by_value_array): Call create_field_decl() instead of create_builtin_decl(). (objc_init): Do not initialize objc_ellipsis_node or TAG_EXECCLASS; In ObjC++ mode, call cxx_init() instead of c_objc_common_init(). (objc_finish_file): In ObjC++, call instantiate_pending_templates() and cp_finish_file(). (define_decl, get_static_reference, get_protocol_reference, create_builtin_decl): Remove functions. (objc_start_class_interface, objc_start_category_interface, objc_start_protocol, objc_continue_interface, objc_finish_interface, objc_start_class_implementation, objc_start_category_implementation, objc_continue_implementation, objc_finish_implementation, objc_set_visibility, objc_set_method_type, objc_build_method_signature, objc_add_method_declaration, objc_start_method_definition, objc_add_instance_variable, objc_get_protocol_qualified_type, create_field_decl, start_var_decl, finish_var_decl): New functions. (setup_string_decl): Simplify since it is only called once. (synth_module_prologue): Call build_class_template(); predefine 'id' and 'Class' as typedefs; rename 'temp_type' to 'type'; disable debug hooks for duration of function; fix GNU runtime messenger signatures to correspond to reality; forward-declare '__objc_exec_class' for the GNU runtime; call build_selector_table_decl(); in ObjC++ mode, generate 'extern "C" { ... }' wrappers around synthesized declarations; call build_protocol_template() and build_category_template(). (string_hash, string_eq): New functions. (objc_build_string_object): Check metaclass correctness only once; store string literals in hash table. (objc_build_constructor): Do not convert initializer elements; adjust for ObjC++ impedance mismatch. (build_objc_symtab_template): Call create_field_decl() instead of create_builtin_decl(). (init_objc_symtab): Add missing conversion to initializer element. (build_metadata_decl): Call start_var_decl() instead of define_decl(). (generate_objc_symtab_decl): Do not call build_category_template(); call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(). (build_module_descriptor): Call create_field_decl() instead of grokfield(); call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(); always mark module descriptor as used; move GNU runtime-specific functionality to build_module_initializer_routine(). (build_module_initializer_routine): New function, broken off of build_module_descriptor(). (objc_static_init_needed_p, objc_generate_static_init_call): New functions. (generate_static_references, generate_strings, build_selector_translation_table, generate_descriptor_table, generate_ivars_list, generate_dispatch_table, generate_category): Call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(); build a type directly instead of via groktypename(). (build_selector_reference_decl, build_selector_table_decl, build_class_reference_decl, build_protocol_reference, generate_objc_image_info): Call start_var_decl() instead of build_decl(). (build_selector_reference): For GNU runtime, do not call build_selector_reference_decl(). (build_selector, build_typed_selector_reference): Always convert result to the selector type. (add_objc_string): Cast return value to 'char *'. (build_method_prototype_template, build_selector_template, build_method_template): Use actual selector type for fields pointing to selectors. (finish_objc): For GNU runtime, call build_module_initializer_routine() after build_module_descriptor(). (generate_protocol_list, generate_shared_structures): Call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(); build a type directly instead of via groktypename(). (synth_id_with_class_suffix): Return a string. (get_arg_type_list): For instance methods, use the instance type for 'self'; do not call groktypename_in_parm_context(). (build_objc_string_decl): Squash redeclaration errors in ObjC++. (objc_is_class_name): Use OBJC_TYPE_NAME instead of TYPE_NAME; handle RECORD_TYPEs in ObjC as well as ObjC++. (objc_is_id): New function. (objc_is_object_ptr): Return the canonical type node. (objc_get_class_ivars): Simplify using get_class_ivars(). (get_class_ivars): Remove second parameter; create a fresh copy of the ivar list for each call; do not check for existence of super class. (objc_eh_runtime_type): Mark #ifndef OBJCPLUS. (objc_init_exceptions): When using SJLJ-style exceptions, require the use of '-fobjc-exceptions' flag; do not require it for DWARF-style exceptions. (objc_build_exc_ptr, next_sjlj_build_try_catch_finally): Use objc_object_type instead of objc_id_type. (objc_begin_catch_clause): Convert the incoming PARM_DECL into a VAR_DECL before placing it in the appropriate scope; do not call define_decl(); adjust call to c_begin_compound_stmt(); use objc_object_type instead of objc_id_type. (build_next_objc_exception_stuff): Call create_field_decl() instead of create_builtin_decl(); construct type directly instead of calling groktypename(); use OBJC_VOID_AT_END to mark end of function parameters. (build_private_template): Adjust call to get_class_ivars(); build a type directly instead of via groktypename(). (build_protocol_template, build_method_prototype_list_template, build_method_prototype_template, build_category_template, build_selector_template, build_class_template, build_super_template, build_ivar_template, build_ivar_list_template, build_method_list_template, build_method_template): Call create_field_decl() instead of grokfield(). (objc_method_parm_type): Do not call groktypename(). (generate_descriptor_table): Call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(). (generate_method_descriptors, build_protocol_initializer, generate_dispatch_tables, build_category_initializer, build_shared_structure_initializer): Do not call groktypename(). (generate_protocols): Call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(); do not call groktypename(). (error_with_ivar): Remove last parameter. (check_ivars): Do not iterate ovar CLASS_RAW_IVARS lists in addition to CLASS_IVARS lists; adjust calls to error_with_ivar(). (generate_ivar_lists): Convert one of the initializer elements; do not call groktypename(). (get_arg_type_list, start_method_def, gen_method_def): Account for new representation of variable arguments and '...' in Objective-C methods; add Objective-C++ impedance matching code. (is_objc_type_qualifier): Remove function. (adjust_type_for_id_default): Simplify; there is no longer a need to wade through declspecs. (lookup_interface, start_class, continue_class, finish_class, start_method_def, start_protocol, build_method_decl, objc_add_method, add_instance_variable, build_ivar_reference, is_ivar, is_private, get_super_receiver, objc_build_finally_epilogue): Make into static functions. (receiver_is_class_object): Use new IS_CLASS() macro. (objc_build_message_expr): Tweak ObjC++ message argument handling; call objc_finish_message_expr() instead of finish_message_expr(). (finish_message_expr): Rename to objc_finish_message_expr(); use OBJC_TYPE_NAME and OBJC_SET_TYPE_NAME macros instead of TYPE_NAME. call gen_type_name() instead of gen_declaration(); call objc_is_id() instead of using IS_ID and IS_CLASS; Use objc_class_name instead of calling get_identifier("Class"); handle CONVERT_EXPRs in receiver. (build_objc_method_call, warn_with_method): Do not call groktypename(). (build_ivar_reference): Call convert() instead of clobbering in a type. (hash_init): Initialize string_htab hash table. (add_instance_variable): Simplify parameter list; do not call grokfield(); do not populate CLASS_IVARS list. (start_class): Check for the existence of super class, if one was specified. (continue_class): Use CLASS_RAW_IVARS rather than CLASS_IVARS; do not call build_class_template(); adjust call to get_class_ivars(); call build_decl(), pushdecl() and finish_decl() instead of define_decl(). (finish_class): Call build_decl(), pushdecl() and finish_decl() instead of define_decl(). (add_protocols): Use PROTOCOL_BINFO_ELTS for the tree vector size. (start_protocol): Do not call build_protocol_template(); use PROTOCOL_BINFO_ELTS for the tree vector size. (encode_type_qualifiers): Do not handle the 'const' qualifier here. (encode_pointer): Encode 'const char *' as 'r*', for backwards compatibility. (encode_array): Use HOST_WIDE_INT_PRINT_DEC instead of "%ld". (encode_type): Handle the 'const' qualifier here. (objc_parmlist): New global variable, sued by objc_push_parm and objc_get_parm_info(). (objc_push_parm, objc_get_parm_info): New functions. (objc_expr_last): Remove function. (synth_self_and_ucmd_args): For instance methods, use the instance type for 'self'; call objc_push_parm() instead of push_parm_decl(). (start_method_def): Do not call push_scope(), declare_parm_level(), pop_scope(), push_parm_decl(), store_parm_decls() or objc_expr_last(); just use objc_push_parm() and objc_get_parm_info(). (comp_method_with_proto): Remove function. (objc_types_are_equivalent): Strip away indirections before comparing underlying types. (comp_proto_with_proto): Do not call groktypename(); types are no longer in raw declspec format. (objc_start_function): New function. (really_start_method): Call comp_proto_with_proto() instead of comp_method_with_proto(); call objc_start_function() instead of hand-crafting a function declarator. (continue_method_def, objc_expand_function_end): Remove functions. (get_super_receiver): Call objc_get_current_scope() instead of get_current_scope(); reference 'super_class' field (instead of 'class'). (finish_method_def): Rename to objc_finish_method_definition() and add a function decl parameter; move method encoding call from objc_expand_function_end(). (is_complex_decl, adorn_decl, gen_declarator, gen_declspecs, gen_declaration_1): Remove functions. (tmpbuf, RAW_DECLSPEC): Remove. (gen_declaration): Remove second parameter; simplify to deal with TYPE_P nodes instead of raw declspecs. (gen_type_name, gen_type_name_0): New functions. (gen_method_decl): Remove second parameter; call gen_type_name() instead of gen_declaration_1(). (dump_interface): Adjust calls to gen_declaration() and gen_method_decl(); do not allocate a separate string buffer. (init_objc): Allocate a larger string buffer to accommodate dump_interface(); adjust call to build_module_descriptor(); add call to build_module_initializer_routine() for the GNU runtime. (generate_classref_translation_entry): Do not call start_decl(); call finish_var_decl() instead of finish_decl(); call convert() instead of build_c_cast(). * objc-act.h (CLASS_OWN_IVARS): Remove accessor. (CLASS_BINFO_ELTS): Reduce from 6 to 5, now that CLASS_OWN_IVARS is gone. (OCTI_GNU_INIT_DECL, GNU_INIT_decl): New. (OCTI_ELLIPSIS_NODE, objc_ellipsis_node): Remove. (OCTI_ID_ID, id_type, objc_id_id): Rename to OCTI_ID_NAME, objc_object_type and objc_object_name, respectively. (OCTI_CLS_REF, OCTI_CLASS_NAME, objc_class_reference, objc_class_name): New. (IS_CLASS): New macro. (IS_ID, IS_SUPER): Robustify. (OCTI_EXECCLASS_DECL, execclass_decl): New. (finish_file, start_class, continue_class, finish_class, start_method_def, continue_method_def, finish_method_def, start_protocol, finish_protocol, objc_build_throw_stmt, objc_build_try_catch_finally_stmt, objc_build_synchronized_prologue, objc_build_synchronized_epilogue, objc_build_try_prologue, objc_build_try_epilogue, objc_build_catch_stmt, objc_build_catch_epilogue, objc_build_finally_prologue, objc_build_finally_epilogue, is_ivar, is_private, is_public, add_instance_variable, objc_add_method, get_super_receiver, objc_clear_super_receiver, get_class_ivars_from_name, get_class_reference, get_static_reference, get_object_reference, build_message_expr, finish_message_expr, build_selector_expr, build_ivar_reference, build_keyword_decl, build_method_decl, build_protocol_expr, build_objc_string_object, objc_declare_alias, objc_declare_class, objc_declare_protocols, objc_comptypes, objc_check_decl, build_encode_expr): Remove prototypes. (imp_count, cat_count): Make GGC-aware. (OBJC_SET_TYPE_NAME): New macro. From-SVN: r87168
2004-09-08 02:49:44 +02:00
field_decl = create_field_decl (integer_type_node, "ivar_offset");
1992-01-18 00:15:38 +01:00
chainon (field_decl_chain, field_decl);
finish_struct (objc_ivar_record, field_decl_chain, NULL_TREE);
1992-01-18 00:15:38 +01:00
return objc_ivar_record;
}
/* struct {
int ivar_count;
struct objc_ivar ivar_list[ivar_count];
}; */
1992-01-18 00:15:38 +01:00
static tree
build_ivar_list_template (tree list_type, int size)
1992-01-18 00:15:38 +01:00
{
tree objc_ivar_list_record;
Makefile.in (c-parse.o): Depend on $(C_COMMON_H). [gcc/ChangeLog] 2004-09-07 Ziemowit Laski <zlaski@apple.com> * Makefile.in (c-parse.o): Depend on $(C_COMMON_H). * c-parse.in: Include c-common.h instead of objc-act.h. (ivar_decl_list, ivar_decls, ivar_decl, ivars, ivar_declarator, myparms, myparm): Remove %type declarations. (methodtype, optparms, OBJC_TYPE_QUAL, objc_quals, objc_qual, objc_typename, objc_try_catch_stmt, optellipsis): Add %type declarations. (objc_inherit_code, objc_public_flag): Remove. (typespec_nonreserved_nonattr): Call objc_get_protocol_qualified_type() instead of get_static_reference() and get_protocol_reference(). (stmt_nocomp): Call grokparm() on @catch parameter. (objcdef): Move semantic action to objc_finish_implementation(). (classdef): Move semantic action to objc_start_class_interface(), objc_continue_interface(), objc_finish_interface(), objc_start_class_implementation(), objc_continue_implementation(), objc_start_category_interface() and objc_start_category_implementation(). (protocoldef): Move semantic actions to objc_start_protocol() and objc_finish_interface(). (ivar_decl_list): Remove nonterminal. (visibility_spec): Move semantic actions to objc_set_visibility(). (ivar_decls): Remove assignment to $$. (ivar_decl): Rephrase in terms of component_decl; call objc_add_instance_variable(). (ivars, ivar_declarator): Remove nonterminals. (opt_semi): New nonterminal. (methodtype): Remove semantic actions. (methoddef): Move semantic actions to objc_set_method_type(), objc_start_method_definition() and objc_finish_method_definition(). (methodproto): Move semantic actions to objc_set_method_type() and objc_add_method_declaration(). (methoddecl): Use objc_typename instead of typename; move semantic actions to objc_build_method_signature(). (optarglist, myxdecls, mydecl, myparms, myparm): Remove nonterminals. (optparmlist): Express in terms of optparms and optellipsis. (optparms, optellipsis, objc_qual, objc_quals, objc_typename): New nonterminals. (keyworddecl): Use objc_typename instead of typename. (rid_to_yy): Mark RID_IN, RID_OUT, RID_INOUT, RID_BYCOPY, RID_BYREF and RID_ONEWAY as returning OBJC_TYPE_QUAL to yyparse(). [gcc/objc/ChangeLog] 2004-09-07 Ziemowit Laski <zlaski@apple.com> * Make-lang.in (objc/objc-parse.o): Depend on $(C_COMMON_H) instead of objc/objc-act.h. (objc/objc-act.o): Depend on $(HASHTAB_H). * objc-act.c: Include hashtab.h; in ObjC++ mode, include cp-tree.h and objcp-decl.h instead of c-tree.h. (build_module_descriptor, get_class_ivars, synth_id_with_class_suffix, error_with_ivar, gen_method_decl, gen_declaration, setup_string_decl, build_protocol_template): Adjust prototypes. (build_module_initializer_routine, start_class, continue_class, finish_class, start_method_def, objc_start_function, start_protocol, build_method_decl, objc_add_method, add_instance_variable, build_ivar_reference, is_ivar, is_private, get_super_receiver, build_selector_table_decl, objc_push_parm, objc_get_parm_info, gen_type_name, gen_type_name_0, start_var_decl, finish_var_decl, create_field_decl): New prototypes. (objc_expand_function_end, comp_method_with_proto, objc_expr_last, gen_declaration_1, gen_declarator, is_complex_decl, adorn_decl, define_decl, create_builtin_decl, gen_declspecs): Remove prototypes. (TYPE_ID): Rename to OBJECT_TYPEDEF_NAME. (CLASS_TYPEDEF_NAME): New. (TAG_EXECCLASS): Change from a global variable to a #define. (TAG_RETURN_STRUCT): Delete. (TAG_GNUINIT): New, holds '__objc_gnu_init' name. (objc_inherit_code, objc_public_flag): New, moved from c-parse.in. (string_descriptor): New struct. (string_htab): New hash table. (string_hash, string_eq): New prototypes. (generate_struct_by_value_array): Call create_field_decl() instead of create_builtin_decl(). (objc_init): Do not initialize objc_ellipsis_node or TAG_EXECCLASS; In ObjC++ mode, call cxx_init() instead of c_objc_common_init(). (objc_finish_file): In ObjC++, call instantiate_pending_templates() and cp_finish_file(). (define_decl, get_static_reference, get_protocol_reference, create_builtin_decl): Remove functions. (objc_start_class_interface, objc_start_category_interface, objc_start_protocol, objc_continue_interface, objc_finish_interface, objc_start_class_implementation, objc_start_category_implementation, objc_continue_implementation, objc_finish_implementation, objc_set_visibility, objc_set_method_type, objc_build_method_signature, objc_add_method_declaration, objc_start_method_definition, objc_add_instance_variable, objc_get_protocol_qualified_type, create_field_decl, start_var_decl, finish_var_decl): New functions. (setup_string_decl): Simplify since it is only called once. (synth_module_prologue): Call build_class_template(); predefine 'id' and 'Class' as typedefs; rename 'temp_type' to 'type'; disable debug hooks for duration of function; fix GNU runtime messenger signatures to correspond to reality; forward-declare '__objc_exec_class' for the GNU runtime; call build_selector_table_decl(); in ObjC++ mode, generate 'extern "C" { ... }' wrappers around synthesized declarations; call build_protocol_template() and build_category_template(). (string_hash, string_eq): New functions. (objc_build_string_object): Check metaclass correctness only once; store string literals in hash table. (objc_build_constructor): Do not convert initializer elements; adjust for ObjC++ impedance mismatch. (build_objc_symtab_template): Call create_field_decl() instead of create_builtin_decl(). (init_objc_symtab): Add missing conversion to initializer element. (build_metadata_decl): Call start_var_decl() instead of define_decl(). (generate_objc_symtab_decl): Do not call build_category_template(); call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(). (build_module_descriptor): Call create_field_decl() instead of grokfield(); call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(); always mark module descriptor as used; move GNU runtime-specific functionality to build_module_initializer_routine(). (build_module_initializer_routine): New function, broken off of build_module_descriptor(). (objc_static_init_needed_p, objc_generate_static_init_call): New functions. (generate_static_references, generate_strings, build_selector_translation_table, generate_descriptor_table, generate_ivars_list, generate_dispatch_table, generate_category): Call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(); build a type directly instead of via groktypename(). (build_selector_reference_decl, build_selector_table_decl, build_class_reference_decl, build_protocol_reference, generate_objc_image_info): Call start_var_decl() instead of build_decl(). (build_selector_reference): For GNU runtime, do not call build_selector_reference_decl(). (build_selector, build_typed_selector_reference): Always convert result to the selector type. (add_objc_string): Cast return value to 'char *'. (build_method_prototype_template, build_selector_template, build_method_template): Use actual selector type for fields pointing to selectors. (finish_objc): For GNU runtime, call build_module_initializer_routine() after build_module_descriptor(). (generate_protocol_list, generate_shared_structures): Call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(); build a type directly instead of via groktypename(). (synth_id_with_class_suffix): Return a string. (get_arg_type_list): For instance methods, use the instance type for 'self'; do not call groktypename_in_parm_context(). (build_objc_string_decl): Squash redeclaration errors in ObjC++. (objc_is_class_name): Use OBJC_TYPE_NAME instead of TYPE_NAME; handle RECORD_TYPEs in ObjC as well as ObjC++. (objc_is_id): New function. (objc_is_object_ptr): Return the canonical type node. (objc_get_class_ivars): Simplify using get_class_ivars(). (get_class_ivars): Remove second parameter; create a fresh copy of the ivar list for each call; do not check for existence of super class. (objc_eh_runtime_type): Mark #ifndef OBJCPLUS. (objc_init_exceptions): When using SJLJ-style exceptions, require the use of '-fobjc-exceptions' flag; do not require it for DWARF-style exceptions. (objc_build_exc_ptr, next_sjlj_build_try_catch_finally): Use objc_object_type instead of objc_id_type. (objc_begin_catch_clause): Convert the incoming PARM_DECL into a VAR_DECL before placing it in the appropriate scope; do not call define_decl(); adjust call to c_begin_compound_stmt(); use objc_object_type instead of objc_id_type. (build_next_objc_exception_stuff): Call create_field_decl() instead of create_builtin_decl(); construct type directly instead of calling groktypename(); use OBJC_VOID_AT_END to mark end of function parameters. (build_private_template): Adjust call to get_class_ivars(); build a type directly instead of via groktypename(). (build_protocol_template, build_method_prototype_list_template, build_method_prototype_template, build_category_template, build_selector_template, build_class_template, build_super_template, build_ivar_template, build_ivar_list_template, build_method_list_template, build_method_template): Call create_field_decl() instead of grokfield(). (objc_method_parm_type): Do not call groktypename(). (generate_descriptor_table): Call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(). (generate_method_descriptors, build_protocol_initializer, generate_dispatch_tables, build_category_initializer, build_shared_structure_initializer): Do not call groktypename(). (generate_protocols): Call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(); do not call groktypename(). (error_with_ivar): Remove last parameter. (check_ivars): Do not iterate ovar CLASS_RAW_IVARS lists in addition to CLASS_IVARS lists; adjust calls to error_with_ivar(). (generate_ivar_lists): Convert one of the initializer elements; do not call groktypename(). (get_arg_type_list, start_method_def, gen_method_def): Account for new representation of variable arguments and '...' in Objective-C methods; add Objective-C++ impedance matching code. (is_objc_type_qualifier): Remove function. (adjust_type_for_id_default): Simplify; there is no longer a need to wade through declspecs. (lookup_interface, start_class, continue_class, finish_class, start_method_def, start_protocol, build_method_decl, objc_add_method, add_instance_variable, build_ivar_reference, is_ivar, is_private, get_super_receiver, objc_build_finally_epilogue): Make into static functions. (receiver_is_class_object): Use new IS_CLASS() macro. (objc_build_message_expr): Tweak ObjC++ message argument handling; call objc_finish_message_expr() instead of finish_message_expr(). (finish_message_expr): Rename to objc_finish_message_expr(); use OBJC_TYPE_NAME and OBJC_SET_TYPE_NAME macros instead of TYPE_NAME. call gen_type_name() instead of gen_declaration(); call objc_is_id() instead of using IS_ID and IS_CLASS; Use objc_class_name instead of calling get_identifier("Class"); handle CONVERT_EXPRs in receiver. (build_objc_method_call, warn_with_method): Do not call groktypename(). (build_ivar_reference): Call convert() instead of clobbering in a type. (hash_init): Initialize string_htab hash table. (add_instance_variable): Simplify parameter list; do not call grokfield(); do not populate CLASS_IVARS list. (start_class): Check for the existence of super class, if one was specified. (continue_class): Use CLASS_RAW_IVARS rather than CLASS_IVARS; do not call build_class_template(); adjust call to get_class_ivars(); call build_decl(), pushdecl() and finish_decl() instead of define_decl(). (finish_class): Call build_decl(), pushdecl() and finish_decl() instead of define_decl(). (add_protocols): Use PROTOCOL_BINFO_ELTS for the tree vector size. (start_protocol): Do not call build_protocol_template(); use PROTOCOL_BINFO_ELTS for the tree vector size. (encode_type_qualifiers): Do not handle the 'const' qualifier here. (encode_pointer): Encode 'const char *' as 'r*', for backwards compatibility. (encode_array): Use HOST_WIDE_INT_PRINT_DEC instead of "%ld". (encode_type): Handle the 'const' qualifier here. (objc_parmlist): New global variable, sued by objc_push_parm and objc_get_parm_info(). (objc_push_parm, objc_get_parm_info): New functions. (objc_expr_last): Remove function. (synth_self_and_ucmd_args): For instance methods, use the instance type for 'self'; call objc_push_parm() instead of push_parm_decl(). (start_method_def): Do not call push_scope(), declare_parm_level(), pop_scope(), push_parm_decl(), store_parm_decls() or objc_expr_last(); just use objc_push_parm() and objc_get_parm_info(). (comp_method_with_proto): Remove function. (objc_types_are_equivalent): Strip away indirections before comparing underlying types. (comp_proto_with_proto): Do not call groktypename(); types are no longer in raw declspec format. (objc_start_function): New function. (really_start_method): Call comp_proto_with_proto() instead of comp_method_with_proto(); call objc_start_function() instead of hand-crafting a function declarator. (continue_method_def, objc_expand_function_end): Remove functions. (get_super_receiver): Call objc_get_current_scope() instead of get_current_scope(); reference 'super_class' field (instead of 'class'). (finish_method_def): Rename to objc_finish_method_definition() and add a function decl parameter; move method encoding call from objc_expand_function_end(). (is_complex_decl, adorn_decl, gen_declarator, gen_declspecs, gen_declaration_1): Remove functions. (tmpbuf, RAW_DECLSPEC): Remove. (gen_declaration): Remove second parameter; simplify to deal with TYPE_P nodes instead of raw declspecs. (gen_type_name, gen_type_name_0): New functions. (gen_method_decl): Remove second parameter; call gen_type_name() instead of gen_declaration_1(). (dump_interface): Adjust calls to gen_declaration() and gen_method_decl(); do not allocate a separate string buffer. (init_objc): Allocate a larger string buffer to accommodate dump_interface(); adjust call to build_module_descriptor(); add call to build_module_initializer_routine() for the GNU runtime. (generate_classref_translation_entry): Do not call start_decl(); call finish_var_decl() instead of finish_decl(); call convert() instead of build_c_cast(). * objc-act.h (CLASS_OWN_IVARS): Remove accessor. (CLASS_BINFO_ELTS): Reduce from 6 to 5, now that CLASS_OWN_IVARS is gone. (OCTI_GNU_INIT_DECL, GNU_INIT_decl): New. (OCTI_ELLIPSIS_NODE, objc_ellipsis_node): Remove. (OCTI_ID_ID, id_type, objc_id_id): Rename to OCTI_ID_NAME, objc_object_type and objc_object_name, respectively. (OCTI_CLS_REF, OCTI_CLASS_NAME, objc_class_reference, objc_class_name): New. (IS_CLASS): New macro. (IS_ID, IS_SUPER): Robustify. (OCTI_EXECCLASS_DECL, execclass_decl): New. (finish_file, start_class, continue_class, finish_class, start_method_def, continue_method_def, finish_method_def, start_protocol, finish_protocol, objc_build_throw_stmt, objc_build_try_catch_finally_stmt, objc_build_synchronized_prologue, objc_build_synchronized_epilogue, objc_build_try_prologue, objc_build_try_epilogue, objc_build_catch_stmt, objc_build_catch_epilogue, objc_build_finally_prologue, objc_build_finally_epilogue, is_ivar, is_private, is_public, add_instance_variable, objc_add_method, get_super_receiver, objc_clear_super_receiver, get_class_ivars_from_name, get_class_reference, get_static_reference, get_object_reference, build_message_expr, finish_message_expr, build_selector_expr, build_ivar_reference, build_keyword_decl, build_method_decl, build_protocol_expr, build_objc_string_object, objc_declare_alias, objc_declare_class, objc_declare_protocols, objc_comptypes, objc_check_decl, build_encode_expr): Remove prototypes. (imp_count, cat_count): Make GGC-aware. (OBJC_SET_TYPE_NAME): New macro. From-SVN: r87168
2004-09-08 02:49:44 +02:00
tree field_decl, field_decl_chain;
1992-01-18 00:15:38 +01:00
objc_ivar_list_record = start_struct (RECORD_TYPE, NULL_TREE);
1992-01-18 00:15:38 +01:00
/* int ivar_count; */
Makefile.in (c-parse.o): Depend on $(C_COMMON_H). [gcc/ChangeLog] 2004-09-07 Ziemowit Laski <zlaski@apple.com> * Makefile.in (c-parse.o): Depend on $(C_COMMON_H). * c-parse.in: Include c-common.h instead of objc-act.h. (ivar_decl_list, ivar_decls, ivar_decl, ivars, ivar_declarator, myparms, myparm): Remove %type declarations. (methodtype, optparms, OBJC_TYPE_QUAL, objc_quals, objc_qual, objc_typename, objc_try_catch_stmt, optellipsis): Add %type declarations. (objc_inherit_code, objc_public_flag): Remove. (typespec_nonreserved_nonattr): Call objc_get_protocol_qualified_type() instead of get_static_reference() and get_protocol_reference(). (stmt_nocomp): Call grokparm() on @catch parameter. (objcdef): Move semantic action to objc_finish_implementation(). (classdef): Move semantic action to objc_start_class_interface(), objc_continue_interface(), objc_finish_interface(), objc_start_class_implementation(), objc_continue_implementation(), objc_start_category_interface() and objc_start_category_implementation(). (protocoldef): Move semantic actions to objc_start_protocol() and objc_finish_interface(). (ivar_decl_list): Remove nonterminal. (visibility_spec): Move semantic actions to objc_set_visibility(). (ivar_decls): Remove assignment to $$. (ivar_decl): Rephrase in terms of component_decl; call objc_add_instance_variable(). (ivars, ivar_declarator): Remove nonterminals. (opt_semi): New nonterminal. (methodtype): Remove semantic actions. (methoddef): Move semantic actions to objc_set_method_type(), objc_start_method_definition() and objc_finish_method_definition(). (methodproto): Move semantic actions to objc_set_method_type() and objc_add_method_declaration(). (methoddecl): Use objc_typename instead of typename; move semantic actions to objc_build_method_signature(). (optarglist, myxdecls, mydecl, myparms, myparm): Remove nonterminals. (optparmlist): Express in terms of optparms and optellipsis. (optparms, optellipsis, objc_qual, objc_quals, objc_typename): New nonterminals. (keyworddecl): Use objc_typename instead of typename. (rid_to_yy): Mark RID_IN, RID_OUT, RID_INOUT, RID_BYCOPY, RID_BYREF and RID_ONEWAY as returning OBJC_TYPE_QUAL to yyparse(). [gcc/objc/ChangeLog] 2004-09-07 Ziemowit Laski <zlaski@apple.com> * Make-lang.in (objc/objc-parse.o): Depend on $(C_COMMON_H) instead of objc/objc-act.h. (objc/objc-act.o): Depend on $(HASHTAB_H). * objc-act.c: Include hashtab.h; in ObjC++ mode, include cp-tree.h and objcp-decl.h instead of c-tree.h. (build_module_descriptor, get_class_ivars, synth_id_with_class_suffix, error_with_ivar, gen_method_decl, gen_declaration, setup_string_decl, build_protocol_template): Adjust prototypes. (build_module_initializer_routine, start_class, continue_class, finish_class, start_method_def, objc_start_function, start_protocol, build_method_decl, objc_add_method, add_instance_variable, build_ivar_reference, is_ivar, is_private, get_super_receiver, build_selector_table_decl, objc_push_parm, objc_get_parm_info, gen_type_name, gen_type_name_0, start_var_decl, finish_var_decl, create_field_decl): New prototypes. (objc_expand_function_end, comp_method_with_proto, objc_expr_last, gen_declaration_1, gen_declarator, is_complex_decl, adorn_decl, define_decl, create_builtin_decl, gen_declspecs): Remove prototypes. (TYPE_ID): Rename to OBJECT_TYPEDEF_NAME. (CLASS_TYPEDEF_NAME): New. (TAG_EXECCLASS): Change from a global variable to a #define. (TAG_RETURN_STRUCT): Delete. (TAG_GNUINIT): New, holds '__objc_gnu_init' name. (objc_inherit_code, objc_public_flag): New, moved from c-parse.in. (string_descriptor): New struct. (string_htab): New hash table. (string_hash, string_eq): New prototypes. (generate_struct_by_value_array): Call create_field_decl() instead of create_builtin_decl(). (objc_init): Do not initialize objc_ellipsis_node or TAG_EXECCLASS; In ObjC++ mode, call cxx_init() instead of c_objc_common_init(). (objc_finish_file): In ObjC++, call instantiate_pending_templates() and cp_finish_file(). (define_decl, get_static_reference, get_protocol_reference, create_builtin_decl): Remove functions. (objc_start_class_interface, objc_start_category_interface, objc_start_protocol, objc_continue_interface, objc_finish_interface, objc_start_class_implementation, objc_start_category_implementation, objc_continue_implementation, objc_finish_implementation, objc_set_visibility, objc_set_method_type, objc_build_method_signature, objc_add_method_declaration, objc_start_method_definition, objc_add_instance_variable, objc_get_protocol_qualified_type, create_field_decl, start_var_decl, finish_var_decl): New functions. (setup_string_decl): Simplify since it is only called once. (synth_module_prologue): Call build_class_template(); predefine 'id' and 'Class' as typedefs; rename 'temp_type' to 'type'; disable debug hooks for duration of function; fix GNU runtime messenger signatures to correspond to reality; forward-declare '__objc_exec_class' for the GNU runtime; call build_selector_table_decl(); in ObjC++ mode, generate 'extern "C" { ... }' wrappers around synthesized declarations; call build_protocol_template() and build_category_template(). (string_hash, string_eq): New functions. (objc_build_string_object): Check metaclass correctness only once; store string literals in hash table. (objc_build_constructor): Do not convert initializer elements; adjust for ObjC++ impedance mismatch. (build_objc_symtab_template): Call create_field_decl() instead of create_builtin_decl(). (init_objc_symtab): Add missing conversion to initializer element. (build_metadata_decl): Call start_var_decl() instead of define_decl(). (generate_objc_symtab_decl): Do not call build_category_template(); call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(). (build_module_descriptor): Call create_field_decl() instead of grokfield(); call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(); always mark module descriptor as used; move GNU runtime-specific functionality to build_module_initializer_routine(). (build_module_initializer_routine): New function, broken off of build_module_descriptor(). (objc_static_init_needed_p, objc_generate_static_init_call): New functions. (generate_static_references, generate_strings, build_selector_translation_table, generate_descriptor_table, generate_ivars_list, generate_dispatch_table, generate_category): Call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(); build a type directly instead of via groktypename(). (build_selector_reference_decl, build_selector_table_decl, build_class_reference_decl, build_protocol_reference, generate_objc_image_info): Call start_var_decl() instead of build_decl(). (build_selector_reference): For GNU runtime, do not call build_selector_reference_decl(). (build_selector, build_typed_selector_reference): Always convert result to the selector type. (add_objc_string): Cast return value to 'char *'. (build_method_prototype_template, build_selector_template, build_method_template): Use actual selector type for fields pointing to selectors. (finish_objc): For GNU runtime, call build_module_initializer_routine() after build_module_descriptor(). (generate_protocol_list, generate_shared_structures): Call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(); build a type directly instead of via groktypename(). (synth_id_with_class_suffix): Return a string. (get_arg_type_list): For instance methods, use the instance type for 'self'; do not call groktypename_in_parm_context(). (build_objc_string_decl): Squash redeclaration errors in ObjC++. (objc_is_class_name): Use OBJC_TYPE_NAME instead of TYPE_NAME; handle RECORD_TYPEs in ObjC as well as ObjC++. (objc_is_id): New function. (objc_is_object_ptr): Return the canonical type node. (objc_get_class_ivars): Simplify using get_class_ivars(). (get_class_ivars): Remove second parameter; create a fresh copy of the ivar list for each call; do not check for existence of super class. (objc_eh_runtime_type): Mark #ifndef OBJCPLUS. (objc_init_exceptions): When using SJLJ-style exceptions, require the use of '-fobjc-exceptions' flag; do not require it for DWARF-style exceptions. (objc_build_exc_ptr, next_sjlj_build_try_catch_finally): Use objc_object_type instead of objc_id_type. (objc_begin_catch_clause): Convert the incoming PARM_DECL into a VAR_DECL before placing it in the appropriate scope; do not call define_decl(); adjust call to c_begin_compound_stmt(); use objc_object_type instead of objc_id_type. (build_next_objc_exception_stuff): Call create_field_decl() instead of create_builtin_decl(); construct type directly instead of calling groktypename(); use OBJC_VOID_AT_END to mark end of function parameters. (build_private_template): Adjust call to get_class_ivars(); build a type directly instead of via groktypename(). (build_protocol_template, build_method_prototype_list_template, build_method_prototype_template, build_category_template, build_selector_template, build_class_template, build_super_template, build_ivar_template, build_ivar_list_template, build_method_list_template, build_method_template): Call create_field_decl() instead of grokfield(). (objc_method_parm_type): Do not call groktypename(). (generate_descriptor_table): Call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(). (generate_method_descriptors, build_protocol_initializer, generate_dispatch_tables, build_category_initializer, build_shared_structure_initializer): Do not call groktypename(). (generate_protocols): Call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(); do not call groktypename(). (error_with_ivar): Remove last parameter. (check_ivars): Do not iterate ovar CLASS_RAW_IVARS lists in addition to CLASS_IVARS lists; adjust calls to error_with_ivar(). (generate_ivar_lists): Convert one of the initializer elements; do not call groktypename(). (get_arg_type_list, start_method_def, gen_method_def): Account for new representation of variable arguments and '...' in Objective-C methods; add Objective-C++ impedance matching code. (is_objc_type_qualifier): Remove function. (adjust_type_for_id_default): Simplify; there is no longer a need to wade through declspecs. (lookup_interface, start_class, continue_class, finish_class, start_method_def, start_protocol, build_method_decl, objc_add_method, add_instance_variable, build_ivar_reference, is_ivar, is_private, get_super_receiver, objc_build_finally_epilogue): Make into static functions. (receiver_is_class_object): Use new IS_CLASS() macro. (objc_build_message_expr): Tweak ObjC++ message argument handling; call objc_finish_message_expr() instead of finish_message_expr(). (finish_message_expr): Rename to objc_finish_message_expr(); use OBJC_TYPE_NAME and OBJC_SET_TYPE_NAME macros instead of TYPE_NAME. call gen_type_name() instead of gen_declaration(); call objc_is_id() instead of using IS_ID and IS_CLASS; Use objc_class_name instead of calling get_identifier("Class"); handle CONVERT_EXPRs in receiver. (build_objc_method_call, warn_with_method): Do not call groktypename(). (build_ivar_reference): Call convert() instead of clobbering in a type. (hash_init): Initialize string_htab hash table. (add_instance_variable): Simplify parameter list; do not call grokfield(); do not populate CLASS_IVARS list. (start_class): Check for the existence of super class, if one was specified. (continue_class): Use CLASS_RAW_IVARS rather than CLASS_IVARS; do not call build_class_template(); adjust call to get_class_ivars(); call build_decl(), pushdecl() and finish_decl() instead of define_decl(). (finish_class): Call build_decl(), pushdecl() and finish_decl() instead of define_decl(). (add_protocols): Use PROTOCOL_BINFO_ELTS for the tree vector size. (start_protocol): Do not call build_protocol_template(); use PROTOCOL_BINFO_ELTS for the tree vector size. (encode_type_qualifiers): Do not handle the 'const' qualifier here. (encode_pointer): Encode 'const char *' as 'r*', for backwards compatibility. (encode_array): Use HOST_WIDE_INT_PRINT_DEC instead of "%ld". (encode_type): Handle the 'const' qualifier here. (objc_parmlist): New global variable, sued by objc_push_parm and objc_get_parm_info(). (objc_push_parm, objc_get_parm_info): New functions. (objc_expr_last): Remove function. (synth_self_and_ucmd_args): For instance methods, use the instance type for 'self'; call objc_push_parm() instead of push_parm_decl(). (start_method_def): Do not call push_scope(), declare_parm_level(), pop_scope(), push_parm_decl(), store_parm_decls() or objc_expr_last(); just use objc_push_parm() and objc_get_parm_info(). (comp_method_with_proto): Remove function. (objc_types_are_equivalent): Strip away indirections before comparing underlying types. (comp_proto_with_proto): Do not call groktypename(); types are no longer in raw declspec format. (objc_start_function): New function. (really_start_method): Call comp_proto_with_proto() instead of comp_method_with_proto(); call objc_start_function() instead of hand-crafting a function declarator. (continue_method_def, objc_expand_function_end): Remove functions. (get_super_receiver): Call objc_get_current_scope() instead of get_current_scope(); reference 'super_class' field (instead of 'class'). (finish_method_def): Rename to objc_finish_method_definition() and add a function decl parameter; move method encoding call from objc_expand_function_end(). (is_complex_decl, adorn_decl, gen_declarator, gen_declspecs, gen_declaration_1): Remove functions. (tmpbuf, RAW_DECLSPEC): Remove. (gen_declaration): Remove second parameter; simplify to deal with TYPE_P nodes instead of raw declspecs. (gen_type_name, gen_type_name_0): New functions. (gen_method_decl): Remove second parameter; call gen_type_name() instead of gen_declaration_1(). (dump_interface): Adjust calls to gen_declaration() and gen_method_decl(); do not allocate a separate string buffer. (init_objc): Allocate a larger string buffer to accommodate dump_interface(); adjust call to build_module_descriptor(); add call to build_module_initializer_routine() for the GNU runtime. (generate_classref_translation_entry): Do not call start_decl(); call finish_var_decl() instead of finish_decl(); call convert() instead of build_c_cast(). * objc-act.h (CLASS_OWN_IVARS): Remove accessor. (CLASS_BINFO_ELTS): Reduce from 6 to 5, now that CLASS_OWN_IVARS is gone. (OCTI_GNU_INIT_DECL, GNU_INIT_decl): New. (OCTI_ELLIPSIS_NODE, objc_ellipsis_node): Remove. (OCTI_ID_ID, id_type, objc_id_id): Rename to OCTI_ID_NAME, objc_object_type and objc_object_name, respectively. (OCTI_CLS_REF, OCTI_CLASS_NAME, objc_class_reference, objc_class_name): New. (IS_CLASS): New macro. (IS_ID, IS_SUPER): Robustify. (OCTI_EXECCLASS_DECL, execclass_decl): New. (finish_file, start_class, continue_class, finish_class, start_method_def, continue_method_def, finish_method_def, start_protocol, finish_protocol, objc_build_throw_stmt, objc_build_try_catch_finally_stmt, objc_build_synchronized_prologue, objc_build_synchronized_epilogue, objc_build_try_prologue, objc_build_try_epilogue, objc_build_catch_stmt, objc_build_catch_epilogue, objc_build_finally_prologue, objc_build_finally_epilogue, is_ivar, is_private, is_public, add_instance_variable, objc_add_method, get_super_receiver, objc_clear_super_receiver, get_class_ivars_from_name, get_class_reference, get_static_reference, get_object_reference, build_message_expr, finish_message_expr, build_selector_expr, build_ivar_reference, build_keyword_decl, build_method_decl, build_protocol_expr, build_objc_string_object, objc_declare_alias, objc_declare_class, objc_declare_protocols, objc_comptypes, objc_check_decl, build_encode_expr): Remove prototypes. (imp_count, cat_count): Make GGC-aware. (OBJC_SET_TYPE_NAME): New macro. From-SVN: r87168
2004-09-08 02:49:44 +02:00
field_decl = create_field_decl (integer_type_node, "ivar_count");
1992-01-18 00:15:38 +01:00
field_decl_chain = field_decl;
/* struct objc_ivar ivar_list[]; */
Makefile.in (c-parse.o): Depend on $(C_COMMON_H). [gcc/ChangeLog] 2004-09-07 Ziemowit Laski <zlaski@apple.com> * Makefile.in (c-parse.o): Depend on $(C_COMMON_H). * c-parse.in: Include c-common.h instead of objc-act.h. (ivar_decl_list, ivar_decls, ivar_decl, ivars, ivar_declarator, myparms, myparm): Remove %type declarations. (methodtype, optparms, OBJC_TYPE_QUAL, objc_quals, objc_qual, objc_typename, objc_try_catch_stmt, optellipsis): Add %type declarations. (objc_inherit_code, objc_public_flag): Remove. (typespec_nonreserved_nonattr): Call objc_get_protocol_qualified_type() instead of get_static_reference() and get_protocol_reference(). (stmt_nocomp): Call grokparm() on @catch parameter. (objcdef): Move semantic action to objc_finish_implementation(). (classdef): Move semantic action to objc_start_class_interface(), objc_continue_interface(), objc_finish_interface(), objc_start_class_implementation(), objc_continue_implementation(), objc_start_category_interface() and objc_start_category_implementation(). (protocoldef): Move semantic actions to objc_start_protocol() and objc_finish_interface(). (ivar_decl_list): Remove nonterminal. (visibility_spec): Move semantic actions to objc_set_visibility(). (ivar_decls): Remove assignment to $$. (ivar_decl): Rephrase in terms of component_decl; call objc_add_instance_variable(). (ivars, ivar_declarator): Remove nonterminals. (opt_semi): New nonterminal. (methodtype): Remove semantic actions. (methoddef): Move semantic actions to objc_set_method_type(), objc_start_method_definition() and objc_finish_method_definition(). (methodproto): Move semantic actions to objc_set_method_type() and objc_add_method_declaration(). (methoddecl): Use objc_typename instead of typename; move semantic actions to objc_build_method_signature(). (optarglist, myxdecls, mydecl, myparms, myparm): Remove nonterminals. (optparmlist): Express in terms of optparms and optellipsis. (optparms, optellipsis, objc_qual, objc_quals, objc_typename): New nonterminals. (keyworddecl): Use objc_typename instead of typename. (rid_to_yy): Mark RID_IN, RID_OUT, RID_INOUT, RID_BYCOPY, RID_BYREF and RID_ONEWAY as returning OBJC_TYPE_QUAL to yyparse(). [gcc/objc/ChangeLog] 2004-09-07 Ziemowit Laski <zlaski@apple.com> * Make-lang.in (objc/objc-parse.o): Depend on $(C_COMMON_H) instead of objc/objc-act.h. (objc/objc-act.o): Depend on $(HASHTAB_H). * objc-act.c: Include hashtab.h; in ObjC++ mode, include cp-tree.h and objcp-decl.h instead of c-tree.h. (build_module_descriptor, get_class_ivars, synth_id_with_class_suffix, error_with_ivar, gen_method_decl, gen_declaration, setup_string_decl, build_protocol_template): Adjust prototypes. (build_module_initializer_routine, start_class, continue_class, finish_class, start_method_def, objc_start_function, start_protocol, build_method_decl, objc_add_method, add_instance_variable, build_ivar_reference, is_ivar, is_private, get_super_receiver, build_selector_table_decl, objc_push_parm, objc_get_parm_info, gen_type_name, gen_type_name_0, start_var_decl, finish_var_decl, create_field_decl): New prototypes. (objc_expand_function_end, comp_method_with_proto, objc_expr_last, gen_declaration_1, gen_declarator, is_complex_decl, adorn_decl, define_decl, create_builtin_decl, gen_declspecs): Remove prototypes. (TYPE_ID): Rename to OBJECT_TYPEDEF_NAME. (CLASS_TYPEDEF_NAME): New. (TAG_EXECCLASS): Change from a global variable to a #define. (TAG_RETURN_STRUCT): Delete. (TAG_GNUINIT): New, holds '__objc_gnu_init' name. (objc_inherit_code, objc_public_flag): New, moved from c-parse.in. (string_descriptor): New struct. (string_htab): New hash table. (string_hash, string_eq): New prototypes. (generate_struct_by_value_array): Call create_field_decl() instead of create_builtin_decl(). (objc_init): Do not initialize objc_ellipsis_node or TAG_EXECCLASS; In ObjC++ mode, call cxx_init() instead of c_objc_common_init(). (objc_finish_file): In ObjC++, call instantiate_pending_templates() and cp_finish_file(). (define_decl, get_static_reference, get_protocol_reference, create_builtin_decl): Remove functions. (objc_start_class_interface, objc_start_category_interface, objc_start_protocol, objc_continue_interface, objc_finish_interface, objc_start_class_implementation, objc_start_category_implementation, objc_continue_implementation, objc_finish_implementation, objc_set_visibility, objc_set_method_type, objc_build_method_signature, objc_add_method_declaration, objc_start_method_definition, objc_add_instance_variable, objc_get_protocol_qualified_type, create_field_decl, start_var_decl, finish_var_decl): New functions. (setup_string_decl): Simplify since it is only called once. (synth_module_prologue): Call build_class_template(); predefine 'id' and 'Class' as typedefs; rename 'temp_type' to 'type'; disable debug hooks for duration of function; fix GNU runtime messenger signatures to correspond to reality; forward-declare '__objc_exec_class' for the GNU runtime; call build_selector_table_decl(); in ObjC++ mode, generate 'extern "C" { ... }' wrappers around synthesized declarations; call build_protocol_template() and build_category_template(). (string_hash, string_eq): New functions. (objc_build_string_object): Check metaclass correctness only once; store string literals in hash table. (objc_build_constructor): Do not convert initializer elements; adjust for ObjC++ impedance mismatch. (build_objc_symtab_template): Call create_field_decl() instead of create_builtin_decl(). (init_objc_symtab): Add missing conversion to initializer element. (build_metadata_decl): Call start_var_decl() instead of define_decl(). (generate_objc_symtab_decl): Do not call build_category_template(); call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(). (build_module_descriptor): Call create_field_decl() instead of grokfield(); call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(); always mark module descriptor as used; move GNU runtime-specific functionality to build_module_initializer_routine(). (build_module_initializer_routine): New function, broken off of build_module_descriptor(). (objc_static_init_needed_p, objc_generate_static_init_call): New functions. (generate_static_references, generate_strings, build_selector_translation_table, generate_descriptor_table, generate_ivars_list, generate_dispatch_table, generate_category): Call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(); build a type directly instead of via groktypename(). (build_selector_reference_decl, build_selector_table_decl, build_class_reference_decl, build_protocol_reference, generate_objc_image_info): Call start_var_decl() instead of build_decl(). (build_selector_reference): For GNU runtime, do not call build_selector_reference_decl(). (build_selector, build_typed_selector_reference): Always convert result to the selector type. (add_objc_string): Cast return value to 'char *'. (build_method_prototype_template, build_selector_template, build_method_template): Use actual selector type for fields pointing to selectors. (finish_objc): For GNU runtime, call build_module_initializer_routine() after build_module_descriptor(). (generate_protocol_list, generate_shared_structures): Call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(); build a type directly instead of via groktypename(). (synth_id_with_class_suffix): Return a string. (get_arg_type_list): For instance methods, use the instance type for 'self'; do not call groktypename_in_parm_context(). (build_objc_string_decl): Squash redeclaration errors in ObjC++. (objc_is_class_name): Use OBJC_TYPE_NAME instead of TYPE_NAME; handle RECORD_TYPEs in ObjC as well as ObjC++. (objc_is_id): New function. (objc_is_object_ptr): Return the canonical type node. (objc_get_class_ivars): Simplify using get_class_ivars(). (get_class_ivars): Remove second parameter; create a fresh copy of the ivar list for each call; do not check for existence of super class. (objc_eh_runtime_type): Mark #ifndef OBJCPLUS. (objc_init_exceptions): When using SJLJ-style exceptions, require the use of '-fobjc-exceptions' flag; do not require it for DWARF-style exceptions. (objc_build_exc_ptr, next_sjlj_build_try_catch_finally): Use objc_object_type instead of objc_id_type. (objc_begin_catch_clause): Convert the incoming PARM_DECL into a VAR_DECL before placing it in the appropriate scope; do not call define_decl(); adjust call to c_begin_compound_stmt(); use objc_object_type instead of objc_id_type. (build_next_objc_exception_stuff): Call create_field_decl() instead of create_builtin_decl(); construct type directly instead of calling groktypename(); use OBJC_VOID_AT_END to mark end of function parameters. (build_private_template): Adjust call to get_class_ivars(); build a type directly instead of via groktypename(). (build_protocol_template, build_method_prototype_list_template, build_method_prototype_template, build_category_template, build_selector_template, build_class_template, build_super_template, build_ivar_template, build_ivar_list_template, build_method_list_template, build_method_template): Call create_field_decl() instead of grokfield(). (objc_method_parm_type): Do not call groktypename(). (generate_descriptor_table): Call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(). (generate_method_descriptors, build_protocol_initializer, generate_dispatch_tables, build_category_initializer, build_shared_structure_initializer): Do not call groktypename(). (generate_protocols): Call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(); do not call groktypename(). (error_with_ivar): Remove last parameter. (check_ivars): Do not iterate ovar CLASS_RAW_IVARS lists in addition to CLASS_IVARS lists; adjust calls to error_with_ivar(). (generate_ivar_lists): Convert one of the initializer elements; do not call groktypename(). (get_arg_type_list, start_method_def, gen_method_def): Account for new representation of variable arguments and '...' in Objective-C methods; add Objective-C++ impedance matching code. (is_objc_type_qualifier): Remove function. (adjust_type_for_id_default): Simplify; there is no longer a need to wade through declspecs. (lookup_interface, start_class, continue_class, finish_class, start_method_def, start_protocol, build_method_decl, objc_add_method, add_instance_variable, build_ivar_reference, is_ivar, is_private, get_super_receiver, objc_build_finally_epilogue): Make into static functions. (receiver_is_class_object): Use new IS_CLASS() macro. (objc_build_message_expr): Tweak ObjC++ message argument handling; call objc_finish_message_expr() instead of finish_message_expr(). (finish_message_expr): Rename to objc_finish_message_expr(); use OBJC_TYPE_NAME and OBJC_SET_TYPE_NAME macros instead of TYPE_NAME. call gen_type_name() instead of gen_declaration(); call objc_is_id() instead of using IS_ID and IS_CLASS; Use objc_class_name instead of calling get_identifier("Class"); handle CONVERT_EXPRs in receiver. (build_objc_method_call, warn_with_method): Do not call groktypename(). (build_ivar_reference): Call convert() instead of clobbering in a type. (hash_init): Initialize string_htab hash table. (add_instance_variable): Simplify parameter list; do not call grokfield(); do not populate CLASS_IVARS list. (start_class): Check for the existence of super class, if one was specified. (continue_class): Use CLASS_RAW_IVARS rather than CLASS_IVARS; do not call build_class_template(); adjust call to get_class_ivars(); call build_decl(), pushdecl() and finish_decl() instead of define_decl(). (finish_class): Call build_decl(), pushdecl() and finish_decl() instead of define_decl(). (add_protocols): Use PROTOCOL_BINFO_ELTS for the tree vector size. (start_protocol): Do not call build_protocol_template(); use PROTOCOL_BINFO_ELTS for the tree vector size. (encode_type_qualifiers): Do not handle the 'const' qualifier here. (encode_pointer): Encode 'const char *' as 'r*', for backwards compatibility. (encode_array): Use HOST_WIDE_INT_PRINT_DEC instead of "%ld". (encode_type): Handle the 'const' qualifier here. (objc_parmlist): New global variable, sued by objc_push_parm and objc_get_parm_info(). (objc_push_parm, objc_get_parm_info): New functions. (objc_expr_last): Remove function. (synth_self_and_ucmd_args): For instance methods, use the instance type for 'self'; call objc_push_parm() instead of push_parm_decl(). (start_method_def): Do not call push_scope(), declare_parm_level(), pop_scope(), push_parm_decl(), store_parm_decls() or objc_expr_last(); just use objc_push_parm() and objc_get_parm_info(). (comp_method_with_proto): Remove function. (objc_types_are_equivalent): Strip away indirections before comparing underlying types. (comp_proto_with_proto): Do not call groktypename(); types are no longer in raw declspec format. (objc_start_function): New function. (really_start_method): Call comp_proto_with_proto() instead of comp_method_with_proto(); call objc_start_function() instead of hand-crafting a function declarator. (continue_method_def, objc_expand_function_end): Remove functions. (get_super_receiver): Call objc_get_current_scope() instead of get_current_scope(); reference 'super_class' field (instead of 'class'). (finish_method_def): Rename to objc_finish_method_definition() and add a function decl parameter; move method encoding call from objc_expand_function_end(). (is_complex_decl, adorn_decl, gen_declarator, gen_declspecs, gen_declaration_1): Remove functions. (tmpbuf, RAW_DECLSPEC): Remove. (gen_declaration): Remove second parameter; simplify to deal with TYPE_P nodes instead of raw declspecs. (gen_type_name, gen_type_name_0): New functions. (gen_method_decl): Remove second parameter; call gen_type_name() instead of gen_declaration_1(). (dump_interface): Adjust calls to gen_declaration() and gen_method_decl(); do not allocate a separate string buffer. (init_objc): Allocate a larger string buffer to accommodate dump_interface(); adjust call to build_module_descriptor(); add call to build_module_initializer_routine() for the GNU runtime. (generate_classref_translation_entry): Do not call start_decl(); call finish_var_decl() instead of finish_decl(); call convert() instead of build_c_cast(). * objc-act.h (CLASS_OWN_IVARS): Remove accessor. (CLASS_BINFO_ELTS): Reduce from 6 to 5, now that CLASS_OWN_IVARS is gone. (OCTI_GNU_INIT_DECL, GNU_INIT_decl): New. (OCTI_ELLIPSIS_NODE, objc_ellipsis_node): Remove. (OCTI_ID_ID, id_type, objc_id_id): Rename to OCTI_ID_NAME, objc_object_type and objc_object_name, respectively. (OCTI_CLS_REF, OCTI_CLASS_NAME, objc_class_reference, objc_class_name): New. (IS_CLASS): New macro. (IS_ID, IS_SUPER): Robustify. (OCTI_EXECCLASS_DECL, execclass_decl): New. (finish_file, start_class, continue_class, finish_class, start_method_def, continue_method_def, finish_method_def, start_protocol, finish_protocol, objc_build_throw_stmt, objc_build_try_catch_finally_stmt, objc_build_synchronized_prologue, objc_build_synchronized_epilogue, objc_build_try_prologue, objc_build_try_epilogue, objc_build_catch_stmt, objc_build_catch_epilogue, objc_build_finally_prologue, objc_build_finally_epilogue, is_ivar, is_private, is_public, add_instance_variable, objc_add_method, get_super_receiver, objc_clear_super_receiver, get_class_ivars_from_name, get_class_reference, get_static_reference, get_object_reference, build_message_expr, finish_message_expr, build_selector_expr, build_ivar_reference, build_keyword_decl, build_method_decl, build_protocol_expr, build_objc_string_object, objc_declare_alias, objc_declare_class, objc_declare_protocols, objc_comptypes, objc_check_decl, build_encode_expr): Remove prototypes. (imp_count, cat_count): Make GGC-aware. (OBJC_SET_TYPE_NAME): New macro. From-SVN: r87168
2004-09-08 02:49:44 +02:00
field_decl = create_field_decl (build_array_type
(list_type,
build_index_type
(build_int_cst (NULL_TREE, size - 1))),
"ivar_list");
1992-01-18 00:15:38 +01:00
chainon (field_decl_chain, field_decl);
finish_struct (objc_ivar_list_record, field_decl_chain, NULL_TREE);
1992-01-18 00:15:38 +01:00
return objc_ivar_list_record;
}
/* struct {
Makefile.in (c-parse.o): Depend on $(C_COMMON_H). [gcc/ChangeLog] 2004-09-07 Ziemowit Laski <zlaski@apple.com> * Makefile.in (c-parse.o): Depend on $(C_COMMON_H). * c-parse.in: Include c-common.h instead of objc-act.h. (ivar_decl_list, ivar_decls, ivar_decl, ivars, ivar_declarator, myparms, myparm): Remove %type declarations. (methodtype, optparms, OBJC_TYPE_QUAL, objc_quals, objc_qual, objc_typename, objc_try_catch_stmt, optellipsis): Add %type declarations. (objc_inherit_code, objc_public_flag): Remove. (typespec_nonreserved_nonattr): Call objc_get_protocol_qualified_type() instead of get_static_reference() and get_protocol_reference(). (stmt_nocomp): Call grokparm() on @catch parameter. (objcdef): Move semantic action to objc_finish_implementation(). (classdef): Move semantic action to objc_start_class_interface(), objc_continue_interface(), objc_finish_interface(), objc_start_class_implementation(), objc_continue_implementation(), objc_start_category_interface() and objc_start_category_implementation(). (protocoldef): Move semantic actions to objc_start_protocol() and objc_finish_interface(). (ivar_decl_list): Remove nonterminal. (visibility_spec): Move semantic actions to objc_set_visibility(). (ivar_decls): Remove assignment to $$. (ivar_decl): Rephrase in terms of component_decl; call objc_add_instance_variable(). (ivars, ivar_declarator): Remove nonterminals. (opt_semi): New nonterminal. (methodtype): Remove semantic actions. (methoddef): Move semantic actions to objc_set_method_type(), objc_start_method_definition() and objc_finish_method_definition(). (methodproto): Move semantic actions to objc_set_method_type() and objc_add_method_declaration(). (methoddecl): Use objc_typename instead of typename; move semantic actions to objc_build_method_signature(). (optarglist, myxdecls, mydecl, myparms, myparm): Remove nonterminals. (optparmlist): Express in terms of optparms and optellipsis. (optparms, optellipsis, objc_qual, objc_quals, objc_typename): New nonterminals. (keyworddecl): Use objc_typename instead of typename. (rid_to_yy): Mark RID_IN, RID_OUT, RID_INOUT, RID_BYCOPY, RID_BYREF and RID_ONEWAY as returning OBJC_TYPE_QUAL to yyparse(). [gcc/objc/ChangeLog] 2004-09-07 Ziemowit Laski <zlaski@apple.com> * Make-lang.in (objc/objc-parse.o): Depend on $(C_COMMON_H) instead of objc/objc-act.h. (objc/objc-act.o): Depend on $(HASHTAB_H). * objc-act.c: Include hashtab.h; in ObjC++ mode, include cp-tree.h and objcp-decl.h instead of c-tree.h. (build_module_descriptor, get_class_ivars, synth_id_with_class_suffix, error_with_ivar, gen_method_decl, gen_declaration, setup_string_decl, build_protocol_template): Adjust prototypes. (build_module_initializer_routine, start_class, continue_class, finish_class, start_method_def, objc_start_function, start_protocol, build_method_decl, objc_add_method, add_instance_variable, build_ivar_reference, is_ivar, is_private, get_super_receiver, build_selector_table_decl, objc_push_parm, objc_get_parm_info, gen_type_name, gen_type_name_0, start_var_decl, finish_var_decl, create_field_decl): New prototypes. (objc_expand_function_end, comp_method_with_proto, objc_expr_last, gen_declaration_1, gen_declarator, is_complex_decl, adorn_decl, define_decl, create_builtin_decl, gen_declspecs): Remove prototypes. (TYPE_ID): Rename to OBJECT_TYPEDEF_NAME. (CLASS_TYPEDEF_NAME): New. (TAG_EXECCLASS): Change from a global variable to a #define. (TAG_RETURN_STRUCT): Delete. (TAG_GNUINIT): New, holds '__objc_gnu_init' name. (objc_inherit_code, objc_public_flag): New, moved from c-parse.in. (string_descriptor): New struct. (string_htab): New hash table. (string_hash, string_eq): New prototypes. (generate_struct_by_value_array): Call create_field_decl() instead of create_builtin_decl(). (objc_init): Do not initialize objc_ellipsis_node or TAG_EXECCLASS; In ObjC++ mode, call cxx_init() instead of c_objc_common_init(). (objc_finish_file): In ObjC++, call instantiate_pending_templates() and cp_finish_file(). (define_decl, get_static_reference, get_protocol_reference, create_builtin_decl): Remove functions. (objc_start_class_interface, objc_start_category_interface, objc_start_protocol, objc_continue_interface, objc_finish_interface, objc_start_class_implementation, objc_start_category_implementation, objc_continue_implementation, objc_finish_implementation, objc_set_visibility, objc_set_method_type, objc_build_method_signature, objc_add_method_declaration, objc_start_method_definition, objc_add_instance_variable, objc_get_protocol_qualified_type, create_field_decl, start_var_decl, finish_var_decl): New functions. (setup_string_decl): Simplify since it is only called once. (synth_module_prologue): Call build_class_template(); predefine 'id' and 'Class' as typedefs; rename 'temp_type' to 'type'; disable debug hooks for duration of function; fix GNU runtime messenger signatures to correspond to reality; forward-declare '__objc_exec_class' for the GNU runtime; call build_selector_table_decl(); in ObjC++ mode, generate 'extern "C" { ... }' wrappers around synthesized declarations; call build_protocol_template() and build_category_template(). (string_hash, string_eq): New functions. (objc_build_string_object): Check metaclass correctness only once; store string literals in hash table. (objc_build_constructor): Do not convert initializer elements; adjust for ObjC++ impedance mismatch. (build_objc_symtab_template): Call create_field_decl() instead of create_builtin_decl(). (init_objc_symtab): Add missing conversion to initializer element. (build_metadata_decl): Call start_var_decl() instead of define_decl(). (generate_objc_symtab_decl): Do not call build_category_template(); call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(). (build_module_descriptor): Call create_field_decl() instead of grokfield(); call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(); always mark module descriptor as used; move GNU runtime-specific functionality to build_module_initializer_routine(). (build_module_initializer_routine): New function, broken off of build_module_descriptor(). (objc_static_init_needed_p, objc_generate_static_init_call): New functions. (generate_static_references, generate_strings, build_selector_translation_table, generate_descriptor_table, generate_ivars_list, generate_dispatch_table, generate_category): Call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(); build a type directly instead of via groktypename(). (build_selector_reference_decl, build_selector_table_decl, build_class_reference_decl, build_protocol_reference, generate_objc_image_info): Call start_var_decl() instead of build_decl(). (build_selector_reference): For GNU runtime, do not call build_selector_reference_decl(). (build_selector, build_typed_selector_reference): Always convert result to the selector type. (add_objc_string): Cast return value to 'char *'. (build_method_prototype_template, build_selector_template, build_method_template): Use actual selector type for fields pointing to selectors. (finish_objc): For GNU runtime, call build_module_initializer_routine() after build_module_descriptor(). (generate_protocol_list, generate_shared_structures): Call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(); build a type directly instead of via groktypename(). (synth_id_with_class_suffix): Return a string. (get_arg_type_list): For instance methods, use the instance type for 'self'; do not call groktypename_in_parm_context(). (build_objc_string_decl): Squash redeclaration errors in ObjC++. (objc_is_class_name): Use OBJC_TYPE_NAME instead of TYPE_NAME; handle RECORD_TYPEs in ObjC as well as ObjC++. (objc_is_id): New function. (objc_is_object_ptr): Return the canonical type node. (objc_get_class_ivars): Simplify using get_class_ivars(). (get_class_ivars): Remove second parameter; create a fresh copy of the ivar list for each call; do not check for existence of super class. (objc_eh_runtime_type): Mark #ifndef OBJCPLUS. (objc_init_exceptions): When using SJLJ-style exceptions, require the use of '-fobjc-exceptions' flag; do not require it for DWARF-style exceptions. (objc_build_exc_ptr, next_sjlj_build_try_catch_finally): Use objc_object_type instead of objc_id_type. (objc_begin_catch_clause): Convert the incoming PARM_DECL into a VAR_DECL before placing it in the appropriate scope; do not call define_decl(); adjust call to c_begin_compound_stmt(); use objc_object_type instead of objc_id_type. (build_next_objc_exception_stuff): Call create_field_decl() instead of create_builtin_decl(); construct type directly instead of calling groktypename(); use OBJC_VOID_AT_END to mark end of function parameters. (build_private_template): Adjust call to get_class_ivars(); build a type directly instead of via groktypename(). (build_protocol_template, build_method_prototype_list_template, build_method_prototype_template, build_category_template, build_selector_template, build_class_template, build_super_template, build_ivar_template, build_ivar_list_template, build_method_list_template, build_method_template): Call create_field_decl() instead of grokfield(). (objc_method_parm_type): Do not call groktypename(). (generate_descriptor_table): Call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(). (generate_method_descriptors, build_protocol_initializer, generate_dispatch_tables, build_category_initializer, build_shared_structure_initializer): Do not call groktypename(). (generate_protocols): Call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(); do not call groktypename(). (error_with_ivar): Remove last parameter. (check_ivars): Do not iterate ovar CLASS_RAW_IVARS lists in addition to CLASS_IVARS lists; adjust calls to error_with_ivar(). (generate_ivar_lists): Convert one of the initializer elements; do not call groktypename(). (get_arg_type_list, start_method_def, gen_method_def): Account for new representation of variable arguments and '...' in Objective-C methods; add Objective-C++ impedance matching code. (is_objc_type_qualifier): Remove function. (adjust_type_for_id_default): Simplify; there is no longer a need to wade through declspecs. (lookup_interface, start_class, continue_class, finish_class, start_method_def, start_protocol, build_method_decl, objc_add_method, add_instance_variable, build_ivar_reference, is_ivar, is_private, get_super_receiver, objc_build_finally_epilogue): Make into static functions. (receiver_is_class_object): Use new IS_CLASS() macro. (objc_build_message_expr): Tweak ObjC++ message argument handling; call objc_finish_message_expr() instead of finish_message_expr(). (finish_message_expr): Rename to objc_finish_message_expr(); use OBJC_TYPE_NAME and OBJC_SET_TYPE_NAME macros instead of TYPE_NAME. call gen_type_name() instead of gen_declaration(); call objc_is_id() instead of using IS_ID and IS_CLASS; Use objc_class_name instead of calling get_identifier("Class"); handle CONVERT_EXPRs in receiver. (build_objc_method_call, warn_with_method): Do not call groktypename(). (build_ivar_reference): Call convert() instead of clobbering in a type. (hash_init): Initialize string_htab hash table. (add_instance_variable): Simplify parameter list; do not call grokfield(); do not populate CLASS_IVARS list. (start_class): Check for the existence of super class, if one was specified. (continue_class): Use CLASS_RAW_IVARS rather than CLASS_IVARS; do not call build_class_template(); adjust call to get_class_ivars(); call build_decl(), pushdecl() and finish_decl() instead of define_decl(). (finish_class): Call build_decl(), pushdecl() and finish_decl() instead of define_decl(). (add_protocols): Use PROTOCOL_BINFO_ELTS for the tree vector size. (start_protocol): Do not call build_protocol_template(); use PROTOCOL_BINFO_ELTS for the tree vector size. (encode_type_qualifiers): Do not handle the 'const' qualifier here. (encode_pointer): Encode 'const char *' as 'r*', for backwards compatibility. (encode_array): Use HOST_WIDE_INT_PRINT_DEC instead of "%ld". (encode_type): Handle the 'const' qualifier here. (objc_parmlist): New global variable, sued by objc_push_parm and objc_get_parm_info(). (objc_push_parm, objc_get_parm_info): New functions. (objc_expr_last): Remove function. (synth_self_and_ucmd_args): For instance methods, use the instance type for 'self'; call objc_push_parm() instead of push_parm_decl(). (start_method_def): Do not call push_scope(), declare_parm_level(), pop_scope(), push_parm_decl(), store_parm_decls() or objc_expr_last(); just use objc_push_parm() and objc_get_parm_info(). (comp_method_with_proto): Remove function. (objc_types_are_equivalent): Strip away indirections before comparing underlying types. (comp_proto_with_proto): Do not call groktypename(); types are no longer in raw declspec format. (objc_start_function): New function. (really_start_method): Call comp_proto_with_proto() instead of comp_method_with_proto(); call objc_start_function() instead of hand-crafting a function declarator. (continue_method_def, objc_expand_function_end): Remove functions. (get_super_receiver): Call objc_get_current_scope() instead of get_current_scope(); reference 'super_class' field (instead of 'class'). (finish_method_def): Rename to objc_finish_method_definition() and add a function decl parameter; move method encoding call from objc_expand_function_end(). (is_complex_decl, adorn_decl, gen_declarator, gen_declspecs, gen_declaration_1): Remove functions. (tmpbuf, RAW_DECLSPEC): Remove. (gen_declaration): Remove second parameter; simplify to deal with TYPE_P nodes instead of raw declspecs. (gen_type_name, gen_type_name_0): New functions. (gen_method_decl): Remove second parameter; call gen_type_name() instead of gen_declaration_1(). (dump_interface): Adjust calls to gen_declaration() and gen_method_decl(); do not allocate a separate string buffer. (init_objc): Allocate a larger string buffer to accommodate dump_interface(); adjust call to build_module_descriptor(); add call to build_module_initializer_routine() for the GNU runtime. (generate_classref_translation_entry): Do not call start_decl(); call finish_var_decl() instead of finish_decl(); call convert() instead of build_c_cast(). * objc-act.h (CLASS_OWN_IVARS): Remove accessor. (CLASS_BINFO_ELTS): Reduce from 6 to 5, now that CLASS_OWN_IVARS is gone. (OCTI_GNU_INIT_DECL, GNU_INIT_decl): New. (OCTI_ELLIPSIS_NODE, objc_ellipsis_node): Remove. (OCTI_ID_ID, id_type, objc_id_id): Rename to OCTI_ID_NAME, objc_object_type and objc_object_name, respectively. (OCTI_CLS_REF, OCTI_CLASS_NAME, objc_class_reference, objc_class_name): New. (IS_CLASS): New macro. (IS_ID, IS_SUPER): Robustify. (OCTI_EXECCLASS_DECL, execclass_decl): New. (finish_file, start_class, continue_class, finish_class, start_method_def, continue_method_def, finish_method_def, start_protocol, finish_protocol, objc_build_throw_stmt, objc_build_try_catch_finally_stmt, objc_build_synchronized_prologue, objc_build_synchronized_epilogue, objc_build_try_prologue, objc_build_try_epilogue, objc_build_catch_stmt, objc_build_catch_epilogue, objc_build_finally_prologue, objc_build_finally_epilogue, is_ivar, is_private, is_public, add_instance_variable, objc_add_method, get_super_receiver, objc_clear_super_receiver, get_class_ivars_from_name, get_class_reference, get_static_reference, get_object_reference, build_message_expr, finish_message_expr, build_selector_expr, build_ivar_reference, build_keyword_decl, build_method_decl, build_protocol_expr, build_objc_string_object, objc_declare_alias, objc_declare_class, objc_declare_protocols, objc_comptypes, objc_check_decl, build_encode_expr): Remove prototypes. (imp_count, cat_count): Make GGC-aware. (OBJC_SET_TYPE_NAME): New macro. From-SVN: r87168
2004-09-08 02:49:44 +02:00
struct _objc__method_prototype_list *method_next;
int method_count;
struct objc_method method_list[method_count];
}; */
1992-01-18 00:15:38 +01:00
static tree
build_method_list_template (tree list_type, int size)
1992-01-18 00:15:38 +01:00
{
tree objc_ivar_list_record;
Makefile.in (c-parse.o): Depend on $(C_COMMON_H). [gcc/ChangeLog] 2004-09-07 Ziemowit Laski <zlaski@apple.com> * Makefile.in (c-parse.o): Depend on $(C_COMMON_H). * c-parse.in: Include c-common.h instead of objc-act.h. (ivar_decl_list, ivar_decls, ivar_decl, ivars, ivar_declarator, myparms, myparm): Remove %type declarations. (methodtype, optparms, OBJC_TYPE_QUAL, objc_quals, objc_qual, objc_typename, objc_try_catch_stmt, optellipsis): Add %type declarations. (objc_inherit_code, objc_public_flag): Remove. (typespec_nonreserved_nonattr): Call objc_get_protocol_qualified_type() instead of get_static_reference() and get_protocol_reference(). (stmt_nocomp): Call grokparm() on @catch parameter. (objcdef): Move semantic action to objc_finish_implementation(). (classdef): Move semantic action to objc_start_class_interface(), objc_continue_interface(), objc_finish_interface(), objc_start_class_implementation(), objc_continue_implementation(), objc_start_category_interface() and objc_start_category_implementation(). (protocoldef): Move semantic actions to objc_start_protocol() and objc_finish_interface(). (ivar_decl_list): Remove nonterminal. (visibility_spec): Move semantic actions to objc_set_visibility(). (ivar_decls): Remove assignment to $$. (ivar_decl): Rephrase in terms of component_decl; call objc_add_instance_variable(). (ivars, ivar_declarator): Remove nonterminals. (opt_semi): New nonterminal. (methodtype): Remove semantic actions. (methoddef): Move semantic actions to objc_set_method_type(), objc_start_method_definition() and objc_finish_method_definition(). (methodproto): Move semantic actions to objc_set_method_type() and objc_add_method_declaration(). (methoddecl): Use objc_typename instead of typename; move semantic actions to objc_build_method_signature(). (optarglist, myxdecls, mydecl, myparms, myparm): Remove nonterminals. (optparmlist): Express in terms of optparms and optellipsis. (optparms, optellipsis, objc_qual, objc_quals, objc_typename): New nonterminals. (keyworddecl): Use objc_typename instead of typename. (rid_to_yy): Mark RID_IN, RID_OUT, RID_INOUT, RID_BYCOPY, RID_BYREF and RID_ONEWAY as returning OBJC_TYPE_QUAL to yyparse(). [gcc/objc/ChangeLog] 2004-09-07 Ziemowit Laski <zlaski@apple.com> * Make-lang.in (objc/objc-parse.o): Depend on $(C_COMMON_H) instead of objc/objc-act.h. (objc/objc-act.o): Depend on $(HASHTAB_H). * objc-act.c: Include hashtab.h; in ObjC++ mode, include cp-tree.h and objcp-decl.h instead of c-tree.h. (build_module_descriptor, get_class_ivars, synth_id_with_class_suffix, error_with_ivar, gen_method_decl, gen_declaration, setup_string_decl, build_protocol_template): Adjust prototypes. (build_module_initializer_routine, start_class, continue_class, finish_class, start_method_def, objc_start_function, start_protocol, build_method_decl, objc_add_method, add_instance_variable, build_ivar_reference, is_ivar, is_private, get_super_receiver, build_selector_table_decl, objc_push_parm, objc_get_parm_info, gen_type_name, gen_type_name_0, start_var_decl, finish_var_decl, create_field_decl): New prototypes. (objc_expand_function_end, comp_method_with_proto, objc_expr_last, gen_declaration_1, gen_declarator, is_complex_decl, adorn_decl, define_decl, create_builtin_decl, gen_declspecs): Remove prototypes. (TYPE_ID): Rename to OBJECT_TYPEDEF_NAME. (CLASS_TYPEDEF_NAME): New. (TAG_EXECCLASS): Change from a global variable to a #define. (TAG_RETURN_STRUCT): Delete. (TAG_GNUINIT): New, holds '__objc_gnu_init' name. (objc_inherit_code, objc_public_flag): New, moved from c-parse.in. (string_descriptor): New struct. (string_htab): New hash table. (string_hash, string_eq): New prototypes. (generate_struct_by_value_array): Call create_field_decl() instead of create_builtin_decl(). (objc_init): Do not initialize objc_ellipsis_node or TAG_EXECCLASS; In ObjC++ mode, call cxx_init() instead of c_objc_common_init(). (objc_finish_file): In ObjC++, call instantiate_pending_templates() and cp_finish_file(). (define_decl, get_static_reference, get_protocol_reference, create_builtin_decl): Remove functions. (objc_start_class_interface, objc_start_category_interface, objc_start_protocol, objc_continue_interface, objc_finish_interface, objc_start_class_implementation, objc_start_category_implementation, objc_continue_implementation, objc_finish_implementation, objc_set_visibility, objc_set_method_type, objc_build_method_signature, objc_add_method_declaration, objc_start_method_definition, objc_add_instance_variable, objc_get_protocol_qualified_type, create_field_decl, start_var_decl, finish_var_decl): New functions. (setup_string_decl): Simplify since it is only called once. (synth_module_prologue): Call build_class_template(); predefine 'id' and 'Class' as typedefs; rename 'temp_type' to 'type'; disable debug hooks for duration of function; fix GNU runtime messenger signatures to correspond to reality; forward-declare '__objc_exec_class' for the GNU runtime; call build_selector_table_decl(); in ObjC++ mode, generate 'extern "C" { ... }' wrappers around synthesized declarations; call build_protocol_template() and build_category_template(). (string_hash, string_eq): New functions. (objc_build_string_object): Check metaclass correctness only once; store string literals in hash table. (objc_build_constructor): Do not convert initializer elements; adjust for ObjC++ impedance mismatch. (build_objc_symtab_template): Call create_field_decl() instead of create_builtin_decl(). (init_objc_symtab): Add missing conversion to initializer element. (build_metadata_decl): Call start_var_decl() instead of define_decl(). (generate_objc_symtab_decl): Do not call build_category_template(); call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(). (build_module_descriptor): Call create_field_decl() instead of grokfield(); call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(); always mark module descriptor as used; move GNU runtime-specific functionality to build_module_initializer_routine(). (build_module_initializer_routine): New function, broken off of build_module_descriptor(). (objc_static_init_needed_p, objc_generate_static_init_call): New functions. (generate_static_references, generate_strings, build_selector_translation_table, generate_descriptor_table, generate_ivars_list, generate_dispatch_table, generate_category): Call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(); build a type directly instead of via groktypename(). (build_selector_reference_decl, build_selector_table_decl, build_class_reference_decl, build_protocol_reference, generate_objc_image_info): Call start_var_decl() instead of build_decl(). (build_selector_reference): For GNU runtime, do not call build_selector_reference_decl(). (build_selector, build_typed_selector_reference): Always convert result to the selector type. (add_objc_string): Cast return value to 'char *'. (build_method_prototype_template, build_selector_template, build_method_template): Use actual selector type for fields pointing to selectors. (finish_objc): For GNU runtime, call build_module_initializer_routine() after build_module_descriptor(). (generate_protocol_list, generate_shared_structures): Call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(); build a type directly instead of via groktypename(). (synth_id_with_class_suffix): Return a string. (get_arg_type_list): For instance methods, use the instance type for 'self'; do not call groktypename_in_parm_context(). (build_objc_string_decl): Squash redeclaration errors in ObjC++. (objc_is_class_name): Use OBJC_TYPE_NAME instead of TYPE_NAME; handle RECORD_TYPEs in ObjC as well as ObjC++. (objc_is_id): New function. (objc_is_object_ptr): Return the canonical type node. (objc_get_class_ivars): Simplify using get_class_ivars(). (get_class_ivars): Remove second parameter; create a fresh copy of the ivar list for each call; do not check for existence of super class. (objc_eh_runtime_type): Mark #ifndef OBJCPLUS. (objc_init_exceptions): When using SJLJ-style exceptions, require the use of '-fobjc-exceptions' flag; do not require it for DWARF-style exceptions. (objc_build_exc_ptr, next_sjlj_build_try_catch_finally): Use objc_object_type instead of objc_id_type. (objc_begin_catch_clause): Convert the incoming PARM_DECL into a VAR_DECL before placing it in the appropriate scope; do not call define_decl(); adjust call to c_begin_compound_stmt(); use objc_object_type instead of objc_id_type. (build_next_objc_exception_stuff): Call create_field_decl() instead of create_builtin_decl(); construct type directly instead of calling groktypename(); use OBJC_VOID_AT_END to mark end of function parameters. (build_private_template): Adjust call to get_class_ivars(); build a type directly instead of via groktypename(). (build_protocol_template, build_method_prototype_list_template, build_method_prototype_template, build_category_template, build_selector_template, build_class_template, build_super_template, build_ivar_template, build_ivar_list_template, build_method_list_template, build_method_template): Call create_field_decl() instead of grokfield(). (objc_method_parm_type): Do not call groktypename(). (generate_descriptor_table): Call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(). (generate_method_descriptors, build_protocol_initializer, generate_dispatch_tables, build_category_initializer, build_shared_structure_initializer): Do not call groktypename(). (generate_protocols): Call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(); do not call groktypename(). (error_with_ivar): Remove last parameter. (check_ivars): Do not iterate ovar CLASS_RAW_IVARS lists in addition to CLASS_IVARS lists; adjust calls to error_with_ivar(). (generate_ivar_lists): Convert one of the initializer elements; do not call groktypename(). (get_arg_type_list, start_method_def, gen_method_def): Account for new representation of variable arguments and '...' in Objective-C methods; add Objective-C++ impedance matching code. (is_objc_type_qualifier): Remove function. (adjust_type_for_id_default): Simplify; there is no longer a need to wade through declspecs. (lookup_interface, start_class, continue_class, finish_class, start_method_def, start_protocol, build_method_decl, objc_add_method, add_instance_variable, build_ivar_reference, is_ivar, is_private, get_super_receiver, objc_build_finally_epilogue): Make into static functions. (receiver_is_class_object): Use new IS_CLASS() macro. (objc_build_message_expr): Tweak ObjC++ message argument handling; call objc_finish_message_expr() instead of finish_message_expr(). (finish_message_expr): Rename to objc_finish_message_expr(); use OBJC_TYPE_NAME and OBJC_SET_TYPE_NAME macros instead of TYPE_NAME. call gen_type_name() instead of gen_declaration(); call objc_is_id() instead of using IS_ID and IS_CLASS; Use objc_class_name instead of calling get_identifier("Class"); handle CONVERT_EXPRs in receiver. (build_objc_method_call, warn_with_method): Do not call groktypename(). (build_ivar_reference): Call convert() instead of clobbering in a type. (hash_init): Initialize string_htab hash table. (add_instance_variable): Simplify parameter list; do not call grokfield(); do not populate CLASS_IVARS list. (start_class): Check for the existence of super class, if one was specified. (continue_class): Use CLASS_RAW_IVARS rather than CLASS_IVARS; do not call build_class_template(); adjust call to get_class_ivars(); call build_decl(), pushdecl() and finish_decl() instead of define_decl(). (finish_class): Call build_decl(), pushdecl() and finish_decl() instead of define_decl(). (add_protocols): Use PROTOCOL_BINFO_ELTS for the tree vector size. (start_protocol): Do not call build_protocol_template(); use PROTOCOL_BINFO_ELTS for the tree vector size. (encode_type_qualifiers): Do not handle the 'const' qualifier here. (encode_pointer): Encode 'const char *' as 'r*', for backwards compatibility. (encode_array): Use HOST_WIDE_INT_PRINT_DEC instead of "%ld". (encode_type): Handle the 'const' qualifier here. (objc_parmlist): New global variable, sued by objc_push_parm and objc_get_parm_info(). (objc_push_parm, objc_get_parm_info): New functions. (objc_expr_last): Remove function. (synth_self_and_ucmd_args): For instance methods, use the instance type for 'self'; call objc_push_parm() instead of push_parm_decl(). (start_method_def): Do not call push_scope(), declare_parm_level(), pop_scope(), push_parm_decl(), store_parm_decls() or objc_expr_last(); just use objc_push_parm() and objc_get_parm_info(). (comp_method_with_proto): Remove function. (objc_types_are_equivalent): Strip away indirections before comparing underlying types. (comp_proto_with_proto): Do not call groktypename(); types are no longer in raw declspec format. (objc_start_function): New function. (really_start_method): Call comp_proto_with_proto() instead of comp_method_with_proto(); call objc_start_function() instead of hand-crafting a function declarator. (continue_method_def, objc_expand_function_end): Remove functions. (get_super_receiver): Call objc_get_current_scope() instead of get_current_scope(); reference 'super_class' field (instead of 'class'). (finish_method_def): Rename to objc_finish_method_definition() and add a function decl parameter; move method encoding call from objc_expand_function_end(). (is_complex_decl, adorn_decl, gen_declarator, gen_declspecs, gen_declaration_1): Remove functions. (tmpbuf, RAW_DECLSPEC): Remove. (gen_declaration): Remove second parameter; simplify to deal with TYPE_P nodes instead of raw declspecs. (gen_type_name, gen_type_name_0): New functions. (gen_method_decl): Remove second parameter; call gen_type_name() instead of gen_declaration_1(). (dump_interface): Adjust calls to gen_declaration() and gen_method_decl(); do not allocate a separate string buffer. (init_objc): Allocate a larger string buffer to accommodate dump_interface(); adjust call to build_module_descriptor(); add call to build_module_initializer_routine() for the GNU runtime. (generate_classref_translation_entry): Do not call start_decl(); call finish_var_decl() instead of finish_decl(); call convert() instead of build_c_cast(). * objc-act.h (CLASS_OWN_IVARS): Remove accessor. (CLASS_BINFO_ELTS): Reduce from 6 to 5, now that CLASS_OWN_IVARS is gone. (OCTI_GNU_INIT_DECL, GNU_INIT_decl): New. (OCTI_ELLIPSIS_NODE, objc_ellipsis_node): Remove. (OCTI_ID_ID, id_type, objc_id_id): Rename to OCTI_ID_NAME, objc_object_type and objc_object_name, respectively. (OCTI_CLS_REF, OCTI_CLASS_NAME, objc_class_reference, objc_class_name): New. (IS_CLASS): New macro. (IS_ID, IS_SUPER): Robustify. (OCTI_EXECCLASS_DECL, execclass_decl): New. (finish_file, start_class, continue_class, finish_class, start_method_def, continue_method_def, finish_method_def, start_protocol, finish_protocol, objc_build_throw_stmt, objc_build_try_catch_finally_stmt, objc_build_synchronized_prologue, objc_build_synchronized_epilogue, objc_build_try_prologue, objc_build_try_epilogue, objc_build_catch_stmt, objc_build_catch_epilogue, objc_build_finally_prologue, objc_build_finally_epilogue, is_ivar, is_private, is_public, add_instance_variable, objc_add_method, get_super_receiver, objc_clear_super_receiver, get_class_ivars_from_name, get_class_reference, get_static_reference, get_object_reference, build_message_expr, finish_message_expr, build_selector_expr, build_ivar_reference, build_keyword_decl, build_method_decl, build_protocol_expr, build_objc_string_object, objc_declare_alias, objc_declare_class, objc_declare_protocols, objc_comptypes, objc_check_decl, build_encode_expr): Remove prototypes. (imp_count, cat_count): Make GGC-aware. (OBJC_SET_TYPE_NAME): New macro. From-SVN: r87168
2004-09-08 02:49:44 +02:00
tree field_decl, field_decl_chain;
1992-01-18 00:15:38 +01:00
objc_ivar_list_record = start_struct (RECORD_TYPE, NULL_TREE);
1992-01-18 00:15:38 +01:00
Makefile.in (c-parse.o): Depend on $(C_COMMON_H). [gcc/ChangeLog] 2004-09-07 Ziemowit Laski <zlaski@apple.com> * Makefile.in (c-parse.o): Depend on $(C_COMMON_H). * c-parse.in: Include c-common.h instead of objc-act.h. (ivar_decl_list, ivar_decls, ivar_decl, ivars, ivar_declarator, myparms, myparm): Remove %type declarations. (methodtype, optparms, OBJC_TYPE_QUAL, objc_quals, objc_qual, objc_typename, objc_try_catch_stmt, optellipsis): Add %type declarations. (objc_inherit_code, objc_public_flag): Remove. (typespec_nonreserved_nonattr): Call objc_get_protocol_qualified_type() instead of get_static_reference() and get_protocol_reference(). (stmt_nocomp): Call grokparm() on @catch parameter. (objcdef): Move semantic action to objc_finish_implementation(). (classdef): Move semantic action to objc_start_class_interface(), objc_continue_interface(), objc_finish_interface(), objc_start_class_implementation(), objc_continue_implementation(), objc_start_category_interface() and objc_start_category_implementation(). (protocoldef): Move semantic actions to objc_start_protocol() and objc_finish_interface(). (ivar_decl_list): Remove nonterminal. (visibility_spec): Move semantic actions to objc_set_visibility(). (ivar_decls): Remove assignment to $$. (ivar_decl): Rephrase in terms of component_decl; call objc_add_instance_variable(). (ivars, ivar_declarator): Remove nonterminals. (opt_semi): New nonterminal. (methodtype): Remove semantic actions. (methoddef): Move semantic actions to objc_set_method_type(), objc_start_method_definition() and objc_finish_method_definition(). (methodproto): Move semantic actions to objc_set_method_type() and objc_add_method_declaration(). (methoddecl): Use objc_typename instead of typename; move semantic actions to objc_build_method_signature(). (optarglist, myxdecls, mydecl, myparms, myparm): Remove nonterminals. (optparmlist): Express in terms of optparms and optellipsis. (optparms, optellipsis, objc_qual, objc_quals, objc_typename): New nonterminals. (keyworddecl): Use objc_typename instead of typename. (rid_to_yy): Mark RID_IN, RID_OUT, RID_INOUT, RID_BYCOPY, RID_BYREF and RID_ONEWAY as returning OBJC_TYPE_QUAL to yyparse(). [gcc/objc/ChangeLog] 2004-09-07 Ziemowit Laski <zlaski@apple.com> * Make-lang.in (objc/objc-parse.o): Depend on $(C_COMMON_H) instead of objc/objc-act.h. (objc/objc-act.o): Depend on $(HASHTAB_H). * objc-act.c: Include hashtab.h; in ObjC++ mode, include cp-tree.h and objcp-decl.h instead of c-tree.h. (build_module_descriptor, get_class_ivars, synth_id_with_class_suffix, error_with_ivar, gen_method_decl, gen_declaration, setup_string_decl, build_protocol_template): Adjust prototypes. (build_module_initializer_routine, start_class, continue_class, finish_class, start_method_def, objc_start_function, start_protocol, build_method_decl, objc_add_method, add_instance_variable, build_ivar_reference, is_ivar, is_private, get_super_receiver, build_selector_table_decl, objc_push_parm, objc_get_parm_info, gen_type_name, gen_type_name_0, start_var_decl, finish_var_decl, create_field_decl): New prototypes. (objc_expand_function_end, comp_method_with_proto, objc_expr_last, gen_declaration_1, gen_declarator, is_complex_decl, adorn_decl, define_decl, create_builtin_decl, gen_declspecs): Remove prototypes. (TYPE_ID): Rename to OBJECT_TYPEDEF_NAME. (CLASS_TYPEDEF_NAME): New. (TAG_EXECCLASS): Change from a global variable to a #define. (TAG_RETURN_STRUCT): Delete. (TAG_GNUINIT): New, holds '__objc_gnu_init' name. (objc_inherit_code, objc_public_flag): New, moved from c-parse.in. (string_descriptor): New struct. (string_htab): New hash table. (string_hash, string_eq): New prototypes. (generate_struct_by_value_array): Call create_field_decl() instead of create_builtin_decl(). (objc_init): Do not initialize objc_ellipsis_node or TAG_EXECCLASS; In ObjC++ mode, call cxx_init() instead of c_objc_common_init(). (objc_finish_file): In ObjC++, call instantiate_pending_templates() and cp_finish_file(). (define_decl, get_static_reference, get_protocol_reference, create_builtin_decl): Remove functions. (objc_start_class_interface, objc_start_category_interface, objc_start_protocol, objc_continue_interface, objc_finish_interface, objc_start_class_implementation, objc_start_category_implementation, objc_continue_implementation, objc_finish_implementation, objc_set_visibility, objc_set_method_type, objc_build_method_signature, objc_add_method_declaration, objc_start_method_definition, objc_add_instance_variable, objc_get_protocol_qualified_type, create_field_decl, start_var_decl, finish_var_decl): New functions. (setup_string_decl): Simplify since it is only called once. (synth_module_prologue): Call build_class_template(); predefine 'id' and 'Class' as typedefs; rename 'temp_type' to 'type'; disable debug hooks for duration of function; fix GNU runtime messenger signatures to correspond to reality; forward-declare '__objc_exec_class' for the GNU runtime; call build_selector_table_decl(); in ObjC++ mode, generate 'extern "C" { ... }' wrappers around synthesized declarations; call build_protocol_template() and build_category_template(). (string_hash, string_eq): New functions. (objc_build_string_object): Check metaclass correctness only once; store string literals in hash table. (objc_build_constructor): Do not convert initializer elements; adjust for ObjC++ impedance mismatch. (build_objc_symtab_template): Call create_field_decl() instead of create_builtin_decl(). (init_objc_symtab): Add missing conversion to initializer element. (build_metadata_decl): Call start_var_decl() instead of define_decl(). (generate_objc_symtab_decl): Do not call build_category_template(); call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(). (build_module_descriptor): Call create_field_decl() instead of grokfield(); call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(); always mark module descriptor as used; move GNU runtime-specific functionality to build_module_initializer_routine(). (build_module_initializer_routine): New function, broken off of build_module_descriptor(). (objc_static_init_needed_p, objc_generate_static_init_call): New functions. (generate_static_references, generate_strings, build_selector_translation_table, generate_descriptor_table, generate_ivars_list, generate_dispatch_table, generate_category): Call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(); build a type directly instead of via groktypename(). (build_selector_reference_decl, build_selector_table_decl, build_class_reference_decl, build_protocol_reference, generate_objc_image_info): Call start_var_decl() instead of build_decl(). (build_selector_reference): For GNU runtime, do not call build_selector_reference_decl(). (build_selector, build_typed_selector_reference): Always convert result to the selector type. (add_objc_string): Cast return value to 'char *'. (build_method_prototype_template, build_selector_template, build_method_template): Use actual selector type for fields pointing to selectors. (finish_objc): For GNU runtime, call build_module_initializer_routine() after build_module_descriptor(). (generate_protocol_list, generate_shared_structures): Call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(); build a type directly instead of via groktypename(). (synth_id_with_class_suffix): Return a string. (get_arg_type_list): For instance methods, use the instance type for 'self'; do not call groktypename_in_parm_context(). (build_objc_string_decl): Squash redeclaration errors in ObjC++. (objc_is_class_name): Use OBJC_TYPE_NAME instead of TYPE_NAME; handle RECORD_TYPEs in ObjC as well as ObjC++. (objc_is_id): New function. (objc_is_object_ptr): Return the canonical type node. (objc_get_class_ivars): Simplify using get_class_ivars(). (get_class_ivars): Remove second parameter; create a fresh copy of the ivar list for each call; do not check for existence of super class. (objc_eh_runtime_type): Mark #ifndef OBJCPLUS. (objc_init_exceptions): When using SJLJ-style exceptions, require the use of '-fobjc-exceptions' flag; do not require it for DWARF-style exceptions. (objc_build_exc_ptr, next_sjlj_build_try_catch_finally): Use objc_object_type instead of objc_id_type. (objc_begin_catch_clause): Convert the incoming PARM_DECL into a VAR_DECL before placing it in the appropriate scope; do not call define_decl(); adjust call to c_begin_compound_stmt(); use objc_object_type instead of objc_id_type. (build_next_objc_exception_stuff): Call create_field_decl() instead of create_builtin_decl(); construct type directly instead of calling groktypename(); use OBJC_VOID_AT_END to mark end of function parameters. (build_private_template): Adjust call to get_class_ivars(); build a type directly instead of via groktypename(). (build_protocol_template, build_method_prototype_list_template, build_method_prototype_template, build_category_template, build_selector_template, build_class_template, build_super_template, build_ivar_template, build_ivar_list_template, build_method_list_template, build_method_template): Call create_field_decl() instead of grokfield(). (objc_method_parm_type): Do not call groktypename(). (generate_descriptor_table): Call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(). (generate_method_descriptors, build_protocol_initializer, generate_dispatch_tables, build_category_initializer, build_shared_structure_initializer): Do not call groktypename(). (generate_protocols): Call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(); do not call groktypename(). (error_with_ivar): Remove last parameter. (check_ivars): Do not iterate ovar CLASS_RAW_IVARS lists in addition to CLASS_IVARS lists; adjust calls to error_with_ivar(). (generate_ivar_lists): Convert one of the initializer elements; do not call groktypename(). (get_arg_type_list, start_method_def, gen_method_def): Account for new representation of variable arguments and '...' in Objective-C methods; add Objective-C++ impedance matching code. (is_objc_type_qualifier): Remove function. (adjust_type_for_id_default): Simplify; there is no longer a need to wade through declspecs. (lookup_interface, start_class, continue_class, finish_class, start_method_def, start_protocol, build_method_decl, objc_add_method, add_instance_variable, build_ivar_reference, is_ivar, is_private, get_super_receiver, objc_build_finally_epilogue): Make into static functions. (receiver_is_class_object): Use new IS_CLASS() macro. (objc_build_message_expr): Tweak ObjC++ message argument handling; call objc_finish_message_expr() instead of finish_message_expr(). (finish_message_expr): Rename to objc_finish_message_expr(); use OBJC_TYPE_NAME and OBJC_SET_TYPE_NAME macros instead of TYPE_NAME. call gen_type_name() instead of gen_declaration(); call objc_is_id() instead of using IS_ID and IS_CLASS; Use objc_class_name instead of calling get_identifier("Class"); handle CONVERT_EXPRs in receiver. (build_objc_method_call, warn_with_method): Do not call groktypename(). (build_ivar_reference): Call convert() instead of clobbering in a type. (hash_init): Initialize string_htab hash table. (add_instance_variable): Simplify parameter list; do not call grokfield(); do not populate CLASS_IVARS list. (start_class): Check for the existence of super class, if one was specified. (continue_class): Use CLASS_RAW_IVARS rather than CLASS_IVARS; do not call build_class_template(); adjust call to get_class_ivars(); call build_decl(), pushdecl() and finish_decl() instead of define_decl(). (finish_class): Call build_decl(), pushdecl() and finish_decl() instead of define_decl(). (add_protocols): Use PROTOCOL_BINFO_ELTS for the tree vector size. (start_protocol): Do not call build_protocol_template(); use PROTOCOL_BINFO_ELTS for the tree vector size. (encode_type_qualifiers): Do not handle the 'const' qualifier here. (encode_pointer): Encode 'const char *' as 'r*', for backwards compatibility. (encode_array): Use HOST_WIDE_INT_PRINT_DEC instead of "%ld". (encode_type): Handle the 'const' qualifier here. (objc_parmlist): New global variable, sued by objc_push_parm and objc_get_parm_info(). (objc_push_parm, objc_get_parm_info): New functions. (objc_expr_last): Remove function. (synth_self_and_ucmd_args): For instance methods, use the instance type for 'self'; call objc_push_parm() instead of push_parm_decl(). (start_method_def): Do not call push_scope(), declare_parm_level(), pop_scope(), push_parm_decl(), store_parm_decls() or objc_expr_last(); just use objc_push_parm() and objc_get_parm_info(). (comp_method_with_proto): Remove function. (objc_types_are_equivalent): Strip away indirections before comparing underlying types. (comp_proto_with_proto): Do not call groktypename(); types are no longer in raw declspec format. (objc_start_function): New function. (really_start_method): Call comp_proto_with_proto() instead of comp_method_with_proto(); call objc_start_function() instead of hand-crafting a function declarator. (continue_method_def, objc_expand_function_end): Remove functions. (get_super_receiver): Call objc_get_current_scope() instead of get_current_scope(); reference 'super_class' field (instead of 'class'). (finish_method_def): Rename to objc_finish_method_definition() and add a function decl parameter; move method encoding call from objc_expand_function_end(). (is_complex_decl, adorn_decl, gen_declarator, gen_declspecs, gen_declaration_1): Remove functions. (tmpbuf, RAW_DECLSPEC): Remove. (gen_declaration): Remove second parameter; simplify to deal with TYPE_P nodes instead of raw declspecs. (gen_type_name, gen_type_name_0): New functions. (gen_method_decl): Remove second parameter; call gen_type_name() instead of gen_declaration_1(). (dump_interface): Adjust calls to gen_declaration() and gen_method_decl(); do not allocate a separate string buffer. (init_objc): Allocate a larger string buffer to accommodate dump_interface(); adjust call to build_module_descriptor(); add call to build_module_initializer_routine() for the GNU runtime. (generate_classref_translation_entry): Do not call start_decl(); call finish_var_decl() instead of finish_decl(); call convert() instead of build_c_cast(). * objc-act.h (CLASS_OWN_IVARS): Remove accessor. (CLASS_BINFO_ELTS): Reduce from 6 to 5, now that CLASS_OWN_IVARS is gone. (OCTI_GNU_INIT_DECL, GNU_INIT_decl): New. (OCTI_ELLIPSIS_NODE, objc_ellipsis_node): Remove. (OCTI_ID_ID, id_type, objc_id_id): Rename to OCTI_ID_NAME, objc_object_type and objc_object_name, respectively. (OCTI_CLS_REF, OCTI_CLASS_NAME, objc_class_reference, objc_class_name): New. (IS_CLASS): New macro. (IS_ID, IS_SUPER): Robustify. (OCTI_EXECCLASS_DECL, execclass_decl): New. (finish_file, start_class, continue_class, finish_class, start_method_def, continue_method_def, finish_method_def, start_protocol, finish_protocol, objc_build_throw_stmt, objc_build_try_catch_finally_stmt, objc_build_synchronized_prologue, objc_build_synchronized_epilogue, objc_build_try_prologue, objc_build_try_epilogue, objc_build_catch_stmt, objc_build_catch_epilogue, objc_build_finally_prologue, objc_build_finally_epilogue, is_ivar, is_private, is_public, add_instance_variable, objc_add_method, get_super_receiver, objc_clear_super_receiver, get_class_ivars_from_name, get_class_reference, get_static_reference, get_object_reference, build_message_expr, finish_message_expr, build_selector_expr, build_ivar_reference, build_keyword_decl, build_method_decl, build_protocol_expr, build_objc_string_object, objc_declare_alias, objc_declare_class, objc_declare_protocols, objc_comptypes, objc_check_decl, build_encode_expr): Remove prototypes. (imp_count, cat_count): Make GGC-aware. (OBJC_SET_TYPE_NAME): New macro. From-SVN: r87168
2004-09-08 02:49:44 +02:00
/* struct _objc__method_prototype_list *method_next; */
Yet more Objective-C++... * objc-act.c (objc_finish_try_stmt): Add return value. (objc_build_synchronized): Likewise. * objc-act.c (objc_is_gcable_type): Add. (objc_substitute_decl): Add. (objc_build_ivar_assignment): Add. (objc_build_global_assignment): Add. (objc_build_strong_cast_assignment): Add. (objc_is_ivar_reference_p): Add. (objc_is_global_reference_p): Add. (objc_generate_write_barrier): Add. (objc_rewrite_function_call): Add. (objc_gimplify_expr): Add Objective-C++ support. * objc-act.h (ALLOC_OBJC_TYPE_LANG_SPECIFIC): Likewise. (SIZEOF_OBJC_TYPE_LANG_SPECIFIC): Add. (INIT_TYPE_OBJC_INFO): Add Objective-C++ support. (DUP_TYPE_OBJC_INFO): Likewise. (struct imp_entry): Add field has_cxx_cdtors. (struct imp_entry *imp_list): Add OCTI_UMSG_FAST_DECL, OCTI_METH_LIST_TEMPL, OCTI_METH_PROTO_LIST_TEMPL, OCTI_IVAR_LIST_TEMPL, OCTI_ASSIGN_IVAR_DECL, OCTI_ASSIGN_IVAR_FAST_DECL, OCTI_ASSIGN_GLOBAL_DECL, OCTI_ASSIGN_STRONGCAST_DECL. (umsg_fast_decl): Add. (objc_assign_ivar_decl): Add. (objc_assign_ivar_fast_decl): Add. (objc_assign_global_decl): Add. (objc_assign_strong_cast_decl): Add. (objc_method_list_ptr): Add. (objc_method_proto_list_ptr): Add. (objc_ivar_list_ptr): Add. * objc-act.c (should_call_super_dealloc): Add. (OBJC_VERSION): Bump to 6. (objc_is_gcable_type): Add. (objc_substitute_decl): Add. (objc_build_ivar_assignment): Add. (objc_build_global_assignment): Add. (objc_build_strong_cast_assignment): Add. (objc_is_gcable_p): Add. (objc_is_ivar_reference_p): Add. (objc_is_global_reference_p): Add. (generate_shared_structures): Add flags parameter. (objc_generate_cxx_ctor_or_dtor): Add. (objc_generate_cxx_cdtors): Add. (add_class): Add name parameter. (objc_types_share_size_and_alignment): Add. (comp_proto_with_proto): Add strict parameter. (CLS_HAS_CXX_STRUCTORS): Add. (TAG_ASSIGNIVAR): Add. (TAG_ASSIGNGLOBAL): Add. (TAG_ASSIGNSTRONGCAST): Add. (TAG_MSGSEND_FAST): Add. (TAG_ASSIGNIVAR_FAST): Add. (TAG_CXX_CONSTRUCT): Add. (TAG_CXX_DESTRUCT): Add. (OBJC_LOOKUP_CLASS): Add. (OBJC_LOOKUP_NO_SUPER): Add. (objc_finish_file): Add pch support. (objc_finish_implementation): Add Objective-C++ support. (synth_module_prologue): Likewise. (synth_module_prologue): Add fast dispatching. (objc_get_class_reference): Add Objective-C++ support. (objc_generate_write_barrier): Likewise. (next_sjlj_build_enter_and_setjmp): Likewise. (objc_begin_try_stmt): Likewise. (build_next_objc_exception_stuff): Add fast ivar support. (build_private_template): Mark the record as used so debug information is generated. (build_protocol_template): Add Objective-C++ support. (objc_method_parm_type) Likewise. (objc_generate_cxx_ctor_or_dtor): Likewise. (objc_generate_cxx_cdtors): Likewise. (build_protocol_initializer): Likewise. (build_category_template): Likewise. (build_class_template): Likewise. (build_method_list_template): Likewise. (build_category_initializer): Likewise. (build_shared_structure_initializer): Likewise. (objc_finish_message_expr): Likewise. (build_objc_method_call): Add fast dispatch support. (lookup_method_static): Add support to end search at superclasses. (add_method_to_hash_list): Add strict parameter to comp_proto_with_proto. (objc_add_method): Likewise. (objc_add_method): Also set the interface_value. (add_instance_variable): Add Objective-C++ support. (objc_is_public): Likewise. (start_class): Likewise. (continue_class): Likewise. (encode_aggregate_within): Likewise. (start_method_def): Likewise. (objc_start_function): Clear current_function_returns_value and current_function_returns_null. (really_start_method): Add Objective-C++ support. (objc_finish_method_definition): Add warning for missing [super dealloc]. (finish_objc): Add Objective-C++ support. (generate_objc_image_info): Likewise. (objc_lookup_ivar): Likewise. * objc-act.h (TYPE_HAS_OBJC_INFO): Likewise. (INIT_TYPE_OBJC_INFO): Likewise. (DUP_TYPE_OBJC_INFO): Likewise. From-SVN: r99857
2005-05-17 22:07:08 +02:00
field_decl = create_field_decl (objc_method_proto_list_ptr,
Makefile.in (c-parse.o): Depend on $(C_COMMON_H). [gcc/ChangeLog] 2004-09-07 Ziemowit Laski <zlaski@apple.com> * Makefile.in (c-parse.o): Depend on $(C_COMMON_H). * c-parse.in: Include c-common.h instead of objc-act.h. (ivar_decl_list, ivar_decls, ivar_decl, ivars, ivar_declarator, myparms, myparm): Remove %type declarations. (methodtype, optparms, OBJC_TYPE_QUAL, objc_quals, objc_qual, objc_typename, objc_try_catch_stmt, optellipsis): Add %type declarations. (objc_inherit_code, objc_public_flag): Remove. (typespec_nonreserved_nonattr): Call objc_get_protocol_qualified_type() instead of get_static_reference() and get_protocol_reference(). (stmt_nocomp): Call grokparm() on @catch parameter. (objcdef): Move semantic action to objc_finish_implementation(). (classdef): Move semantic action to objc_start_class_interface(), objc_continue_interface(), objc_finish_interface(), objc_start_class_implementation(), objc_continue_implementation(), objc_start_category_interface() and objc_start_category_implementation(). (protocoldef): Move semantic actions to objc_start_protocol() and objc_finish_interface(). (ivar_decl_list): Remove nonterminal. (visibility_spec): Move semantic actions to objc_set_visibility(). (ivar_decls): Remove assignment to $$. (ivar_decl): Rephrase in terms of component_decl; call objc_add_instance_variable(). (ivars, ivar_declarator): Remove nonterminals. (opt_semi): New nonterminal. (methodtype): Remove semantic actions. (methoddef): Move semantic actions to objc_set_method_type(), objc_start_method_definition() and objc_finish_method_definition(). (methodproto): Move semantic actions to objc_set_method_type() and objc_add_method_declaration(). (methoddecl): Use objc_typename instead of typename; move semantic actions to objc_build_method_signature(). (optarglist, myxdecls, mydecl, myparms, myparm): Remove nonterminals. (optparmlist): Express in terms of optparms and optellipsis. (optparms, optellipsis, objc_qual, objc_quals, objc_typename): New nonterminals. (keyworddecl): Use objc_typename instead of typename. (rid_to_yy): Mark RID_IN, RID_OUT, RID_INOUT, RID_BYCOPY, RID_BYREF and RID_ONEWAY as returning OBJC_TYPE_QUAL to yyparse(). [gcc/objc/ChangeLog] 2004-09-07 Ziemowit Laski <zlaski@apple.com> * Make-lang.in (objc/objc-parse.o): Depend on $(C_COMMON_H) instead of objc/objc-act.h. (objc/objc-act.o): Depend on $(HASHTAB_H). * objc-act.c: Include hashtab.h; in ObjC++ mode, include cp-tree.h and objcp-decl.h instead of c-tree.h. (build_module_descriptor, get_class_ivars, synth_id_with_class_suffix, error_with_ivar, gen_method_decl, gen_declaration, setup_string_decl, build_protocol_template): Adjust prototypes. (build_module_initializer_routine, start_class, continue_class, finish_class, start_method_def, objc_start_function, start_protocol, build_method_decl, objc_add_method, add_instance_variable, build_ivar_reference, is_ivar, is_private, get_super_receiver, build_selector_table_decl, objc_push_parm, objc_get_parm_info, gen_type_name, gen_type_name_0, start_var_decl, finish_var_decl, create_field_decl): New prototypes. (objc_expand_function_end, comp_method_with_proto, objc_expr_last, gen_declaration_1, gen_declarator, is_complex_decl, adorn_decl, define_decl, create_builtin_decl, gen_declspecs): Remove prototypes. (TYPE_ID): Rename to OBJECT_TYPEDEF_NAME. (CLASS_TYPEDEF_NAME): New. (TAG_EXECCLASS): Change from a global variable to a #define. (TAG_RETURN_STRUCT): Delete. (TAG_GNUINIT): New, holds '__objc_gnu_init' name. (objc_inherit_code, objc_public_flag): New, moved from c-parse.in. (string_descriptor): New struct. (string_htab): New hash table. (string_hash, string_eq): New prototypes. (generate_struct_by_value_array): Call create_field_decl() instead of create_builtin_decl(). (objc_init): Do not initialize objc_ellipsis_node or TAG_EXECCLASS; In ObjC++ mode, call cxx_init() instead of c_objc_common_init(). (objc_finish_file): In ObjC++, call instantiate_pending_templates() and cp_finish_file(). (define_decl, get_static_reference, get_protocol_reference, create_builtin_decl): Remove functions. (objc_start_class_interface, objc_start_category_interface, objc_start_protocol, objc_continue_interface, objc_finish_interface, objc_start_class_implementation, objc_start_category_implementation, objc_continue_implementation, objc_finish_implementation, objc_set_visibility, objc_set_method_type, objc_build_method_signature, objc_add_method_declaration, objc_start_method_definition, objc_add_instance_variable, objc_get_protocol_qualified_type, create_field_decl, start_var_decl, finish_var_decl): New functions. (setup_string_decl): Simplify since it is only called once. (synth_module_prologue): Call build_class_template(); predefine 'id' and 'Class' as typedefs; rename 'temp_type' to 'type'; disable debug hooks for duration of function; fix GNU runtime messenger signatures to correspond to reality; forward-declare '__objc_exec_class' for the GNU runtime; call build_selector_table_decl(); in ObjC++ mode, generate 'extern "C" { ... }' wrappers around synthesized declarations; call build_protocol_template() and build_category_template(). (string_hash, string_eq): New functions. (objc_build_string_object): Check metaclass correctness only once; store string literals in hash table. (objc_build_constructor): Do not convert initializer elements; adjust for ObjC++ impedance mismatch. (build_objc_symtab_template): Call create_field_decl() instead of create_builtin_decl(). (init_objc_symtab): Add missing conversion to initializer element. (build_metadata_decl): Call start_var_decl() instead of define_decl(). (generate_objc_symtab_decl): Do not call build_category_template(); call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(). (build_module_descriptor): Call create_field_decl() instead of grokfield(); call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(); always mark module descriptor as used; move GNU runtime-specific functionality to build_module_initializer_routine(). (build_module_initializer_routine): New function, broken off of build_module_descriptor(). (objc_static_init_needed_p, objc_generate_static_init_call): New functions. (generate_static_references, generate_strings, build_selector_translation_table, generate_descriptor_table, generate_ivars_list, generate_dispatch_table, generate_category): Call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(); build a type directly instead of via groktypename(). (build_selector_reference_decl, build_selector_table_decl, build_class_reference_decl, build_protocol_reference, generate_objc_image_info): Call start_var_decl() instead of build_decl(). (build_selector_reference): For GNU runtime, do not call build_selector_reference_decl(). (build_selector, build_typed_selector_reference): Always convert result to the selector type. (add_objc_string): Cast return value to 'char *'. (build_method_prototype_template, build_selector_template, build_method_template): Use actual selector type for fields pointing to selectors. (finish_objc): For GNU runtime, call build_module_initializer_routine() after build_module_descriptor(). (generate_protocol_list, generate_shared_structures): Call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(); build a type directly instead of via groktypename(). (synth_id_with_class_suffix): Return a string. (get_arg_type_list): For instance methods, use the instance type for 'self'; do not call groktypename_in_parm_context(). (build_objc_string_decl): Squash redeclaration errors in ObjC++. (objc_is_class_name): Use OBJC_TYPE_NAME instead of TYPE_NAME; handle RECORD_TYPEs in ObjC as well as ObjC++. (objc_is_id): New function. (objc_is_object_ptr): Return the canonical type node. (objc_get_class_ivars): Simplify using get_class_ivars(). (get_class_ivars): Remove second parameter; create a fresh copy of the ivar list for each call; do not check for existence of super class. (objc_eh_runtime_type): Mark #ifndef OBJCPLUS. (objc_init_exceptions): When using SJLJ-style exceptions, require the use of '-fobjc-exceptions' flag; do not require it for DWARF-style exceptions. (objc_build_exc_ptr, next_sjlj_build_try_catch_finally): Use objc_object_type instead of objc_id_type. (objc_begin_catch_clause): Convert the incoming PARM_DECL into a VAR_DECL before placing it in the appropriate scope; do not call define_decl(); adjust call to c_begin_compound_stmt(); use objc_object_type instead of objc_id_type. (build_next_objc_exception_stuff): Call create_field_decl() instead of create_builtin_decl(); construct type directly instead of calling groktypename(); use OBJC_VOID_AT_END to mark end of function parameters. (build_private_template): Adjust call to get_class_ivars(); build a type directly instead of via groktypename(). (build_protocol_template, build_method_prototype_list_template, build_method_prototype_template, build_category_template, build_selector_template, build_class_template, build_super_template, build_ivar_template, build_ivar_list_template, build_method_list_template, build_method_template): Call create_field_decl() instead of grokfield(). (objc_method_parm_type): Do not call groktypename(). (generate_descriptor_table): Call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(). (generate_method_descriptors, build_protocol_initializer, generate_dispatch_tables, build_category_initializer, build_shared_structure_initializer): Do not call groktypename(). (generate_protocols): Call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(); do not call groktypename(). (error_with_ivar): Remove last parameter. (check_ivars): Do not iterate ovar CLASS_RAW_IVARS lists in addition to CLASS_IVARS lists; adjust calls to error_with_ivar(). (generate_ivar_lists): Convert one of the initializer elements; do not call groktypename(). (get_arg_type_list, start_method_def, gen_method_def): Account for new representation of variable arguments and '...' in Objective-C methods; add Objective-C++ impedance matching code. (is_objc_type_qualifier): Remove function. (adjust_type_for_id_default): Simplify; there is no longer a need to wade through declspecs. (lookup_interface, start_class, continue_class, finish_class, start_method_def, start_protocol, build_method_decl, objc_add_method, add_instance_variable, build_ivar_reference, is_ivar, is_private, get_super_receiver, objc_build_finally_epilogue): Make into static functions. (receiver_is_class_object): Use new IS_CLASS() macro. (objc_build_message_expr): Tweak ObjC++ message argument handling; call objc_finish_message_expr() instead of finish_message_expr(). (finish_message_expr): Rename to objc_finish_message_expr(); use OBJC_TYPE_NAME and OBJC_SET_TYPE_NAME macros instead of TYPE_NAME. call gen_type_name() instead of gen_declaration(); call objc_is_id() instead of using IS_ID and IS_CLASS; Use objc_class_name instead of calling get_identifier("Class"); handle CONVERT_EXPRs in receiver. (build_objc_method_call, warn_with_method): Do not call groktypename(). (build_ivar_reference): Call convert() instead of clobbering in a type. (hash_init): Initialize string_htab hash table. (add_instance_variable): Simplify parameter list; do not call grokfield(); do not populate CLASS_IVARS list. (start_class): Check for the existence of super class, if one was specified. (continue_class): Use CLASS_RAW_IVARS rather than CLASS_IVARS; do not call build_class_template(); adjust call to get_class_ivars(); call build_decl(), pushdecl() and finish_decl() instead of define_decl(). (finish_class): Call build_decl(), pushdecl() and finish_decl() instead of define_decl(). (add_protocols): Use PROTOCOL_BINFO_ELTS for the tree vector size. (start_protocol): Do not call build_protocol_template(); use PROTOCOL_BINFO_ELTS for the tree vector size. (encode_type_qualifiers): Do not handle the 'const' qualifier here. (encode_pointer): Encode 'const char *' as 'r*', for backwards compatibility. (encode_array): Use HOST_WIDE_INT_PRINT_DEC instead of "%ld". (encode_type): Handle the 'const' qualifier here. (objc_parmlist): New global variable, sued by objc_push_parm and objc_get_parm_info(). (objc_push_parm, objc_get_parm_info): New functions. (objc_expr_last): Remove function. (synth_self_and_ucmd_args): For instance methods, use the instance type for 'self'; call objc_push_parm() instead of push_parm_decl(). (start_method_def): Do not call push_scope(), declare_parm_level(), pop_scope(), push_parm_decl(), store_parm_decls() or objc_expr_last(); just use objc_push_parm() and objc_get_parm_info(). (comp_method_with_proto): Remove function. (objc_types_are_equivalent): Strip away indirections before comparing underlying types. (comp_proto_with_proto): Do not call groktypename(); types are no longer in raw declspec format. (objc_start_function): New function. (really_start_method): Call comp_proto_with_proto() instead of comp_method_with_proto(); call objc_start_function() instead of hand-crafting a function declarator. (continue_method_def, objc_expand_function_end): Remove functions. (get_super_receiver): Call objc_get_current_scope() instead of get_current_scope(); reference 'super_class' field (instead of 'class'). (finish_method_def): Rename to objc_finish_method_definition() and add a function decl parameter; move method encoding call from objc_expand_function_end(). (is_complex_decl, adorn_decl, gen_declarator, gen_declspecs, gen_declaration_1): Remove functions. (tmpbuf, RAW_DECLSPEC): Remove. (gen_declaration): Remove second parameter; simplify to deal with TYPE_P nodes instead of raw declspecs. (gen_type_name, gen_type_name_0): New functions. (gen_method_decl): Remove second parameter; call gen_type_name() instead of gen_declaration_1(). (dump_interface): Adjust calls to gen_declaration() and gen_method_decl(); do not allocate a separate string buffer. (init_objc): Allocate a larger string buffer to accommodate dump_interface(); adjust call to build_module_descriptor(); add call to build_module_initializer_routine() for the GNU runtime. (generate_classref_translation_entry): Do not call start_decl(); call finish_var_decl() instead of finish_decl(); call convert() instead of build_c_cast(). * objc-act.h (CLASS_OWN_IVARS): Remove accessor. (CLASS_BINFO_ELTS): Reduce from 6 to 5, now that CLASS_OWN_IVARS is gone. (OCTI_GNU_INIT_DECL, GNU_INIT_decl): New. (OCTI_ELLIPSIS_NODE, objc_ellipsis_node): Remove. (OCTI_ID_ID, id_type, objc_id_id): Rename to OCTI_ID_NAME, objc_object_type and objc_object_name, respectively. (OCTI_CLS_REF, OCTI_CLASS_NAME, objc_class_reference, objc_class_name): New. (IS_CLASS): New macro. (IS_ID, IS_SUPER): Robustify. (OCTI_EXECCLASS_DECL, execclass_decl): New. (finish_file, start_class, continue_class, finish_class, start_method_def, continue_method_def, finish_method_def, start_protocol, finish_protocol, objc_build_throw_stmt, objc_build_try_catch_finally_stmt, objc_build_synchronized_prologue, objc_build_synchronized_epilogue, objc_build_try_prologue, objc_build_try_epilogue, objc_build_catch_stmt, objc_build_catch_epilogue, objc_build_finally_prologue, objc_build_finally_epilogue, is_ivar, is_private, is_public, add_instance_variable, objc_add_method, get_super_receiver, objc_clear_super_receiver, get_class_ivars_from_name, get_class_reference, get_static_reference, get_object_reference, build_message_expr, finish_message_expr, build_selector_expr, build_ivar_reference, build_keyword_decl, build_method_decl, build_protocol_expr, build_objc_string_object, objc_declare_alias, objc_declare_class, objc_declare_protocols, objc_comptypes, objc_check_decl, build_encode_expr): Remove prototypes. (imp_count, cat_count): Make GGC-aware. (OBJC_SET_TYPE_NAME): New macro. From-SVN: r87168
2004-09-08 02:49:44 +02:00
"method_next");
1992-01-18 00:15:38 +01:00
field_decl_chain = field_decl;
/* int method_count; */
Makefile.in (c-parse.o): Depend on $(C_COMMON_H). [gcc/ChangeLog] 2004-09-07 Ziemowit Laski <zlaski@apple.com> * Makefile.in (c-parse.o): Depend on $(C_COMMON_H). * c-parse.in: Include c-common.h instead of objc-act.h. (ivar_decl_list, ivar_decls, ivar_decl, ivars, ivar_declarator, myparms, myparm): Remove %type declarations. (methodtype, optparms, OBJC_TYPE_QUAL, objc_quals, objc_qual, objc_typename, objc_try_catch_stmt, optellipsis): Add %type declarations. (objc_inherit_code, objc_public_flag): Remove. (typespec_nonreserved_nonattr): Call objc_get_protocol_qualified_type() instead of get_static_reference() and get_protocol_reference(). (stmt_nocomp): Call grokparm() on @catch parameter. (objcdef): Move semantic action to objc_finish_implementation(). (classdef): Move semantic action to objc_start_class_interface(), objc_continue_interface(), objc_finish_interface(), objc_start_class_implementation(), objc_continue_implementation(), objc_start_category_interface() and objc_start_category_implementation(). (protocoldef): Move semantic actions to objc_start_protocol() and objc_finish_interface(). (ivar_decl_list): Remove nonterminal. (visibility_spec): Move semantic actions to objc_set_visibility(). (ivar_decls): Remove assignment to $$. (ivar_decl): Rephrase in terms of component_decl; call objc_add_instance_variable(). (ivars, ivar_declarator): Remove nonterminals. (opt_semi): New nonterminal. (methodtype): Remove semantic actions. (methoddef): Move semantic actions to objc_set_method_type(), objc_start_method_definition() and objc_finish_method_definition(). (methodproto): Move semantic actions to objc_set_method_type() and objc_add_method_declaration(). (methoddecl): Use objc_typename instead of typename; move semantic actions to objc_build_method_signature(). (optarglist, myxdecls, mydecl, myparms, myparm): Remove nonterminals. (optparmlist): Express in terms of optparms and optellipsis. (optparms, optellipsis, objc_qual, objc_quals, objc_typename): New nonterminals. (keyworddecl): Use objc_typename instead of typename. (rid_to_yy): Mark RID_IN, RID_OUT, RID_INOUT, RID_BYCOPY, RID_BYREF and RID_ONEWAY as returning OBJC_TYPE_QUAL to yyparse(). [gcc/objc/ChangeLog] 2004-09-07 Ziemowit Laski <zlaski@apple.com> * Make-lang.in (objc/objc-parse.o): Depend on $(C_COMMON_H) instead of objc/objc-act.h. (objc/objc-act.o): Depend on $(HASHTAB_H). * objc-act.c: Include hashtab.h; in ObjC++ mode, include cp-tree.h and objcp-decl.h instead of c-tree.h. (build_module_descriptor, get_class_ivars, synth_id_with_class_suffix, error_with_ivar, gen_method_decl, gen_declaration, setup_string_decl, build_protocol_template): Adjust prototypes. (build_module_initializer_routine, start_class, continue_class, finish_class, start_method_def, objc_start_function, start_protocol, build_method_decl, objc_add_method, add_instance_variable, build_ivar_reference, is_ivar, is_private, get_super_receiver, build_selector_table_decl, objc_push_parm, objc_get_parm_info, gen_type_name, gen_type_name_0, start_var_decl, finish_var_decl, create_field_decl): New prototypes. (objc_expand_function_end, comp_method_with_proto, objc_expr_last, gen_declaration_1, gen_declarator, is_complex_decl, adorn_decl, define_decl, create_builtin_decl, gen_declspecs): Remove prototypes. (TYPE_ID): Rename to OBJECT_TYPEDEF_NAME. (CLASS_TYPEDEF_NAME): New. (TAG_EXECCLASS): Change from a global variable to a #define. (TAG_RETURN_STRUCT): Delete. (TAG_GNUINIT): New, holds '__objc_gnu_init' name. (objc_inherit_code, objc_public_flag): New, moved from c-parse.in. (string_descriptor): New struct. (string_htab): New hash table. (string_hash, string_eq): New prototypes. (generate_struct_by_value_array): Call create_field_decl() instead of create_builtin_decl(). (objc_init): Do not initialize objc_ellipsis_node or TAG_EXECCLASS; In ObjC++ mode, call cxx_init() instead of c_objc_common_init(). (objc_finish_file): In ObjC++, call instantiate_pending_templates() and cp_finish_file(). (define_decl, get_static_reference, get_protocol_reference, create_builtin_decl): Remove functions. (objc_start_class_interface, objc_start_category_interface, objc_start_protocol, objc_continue_interface, objc_finish_interface, objc_start_class_implementation, objc_start_category_implementation, objc_continue_implementation, objc_finish_implementation, objc_set_visibility, objc_set_method_type, objc_build_method_signature, objc_add_method_declaration, objc_start_method_definition, objc_add_instance_variable, objc_get_protocol_qualified_type, create_field_decl, start_var_decl, finish_var_decl): New functions. (setup_string_decl): Simplify since it is only called once. (synth_module_prologue): Call build_class_template(); predefine 'id' and 'Class' as typedefs; rename 'temp_type' to 'type'; disable debug hooks for duration of function; fix GNU runtime messenger signatures to correspond to reality; forward-declare '__objc_exec_class' for the GNU runtime; call build_selector_table_decl(); in ObjC++ mode, generate 'extern "C" { ... }' wrappers around synthesized declarations; call build_protocol_template() and build_category_template(). (string_hash, string_eq): New functions. (objc_build_string_object): Check metaclass correctness only once; store string literals in hash table. (objc_build_constructor): Do not convert initializer elements; adjust for ObjC++ impedance mismatch. (build_objc_symtab_template): Call create_field_decl() instead of create_builtin_decl(). (init_objc_symtab): Add missing conversion to initializer element. (build_metadata_decl): Call start_var_decl() instead of define_decl(). (generate_objc_symtab_decl): Do not call build_category_template(); call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(). (build_module_descriptor): Call create_field_decl() instead of grokfield(); call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(); always mark module descriptor as used; move GNU runtime-specific functionality to build_module_initializer_routine(). (build_module_initializer_routine): New function, broken off of build_module_descriptor(). (objc_static_init_needed_p, objc_generate_static_init_call): New functions. (generate_static_references, generate_strings, build_selector_translation_table, generate_descriptor_table, generate_ivars_list, generate_dispatch_table, generate_category): Call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(); build a type directly instead of via groktypename(). (build_selector_reference_decl, build_selector_table_decl, build_class_reference_decl, build_protocol_reference, generate_objc_image_info): Call start_var_decl() instead of build_decl(). (build_selector_reference): For GNU runtime, do not call build_selector_reference_decl(). (build_selector, build_typed_selector_reference): Always convert result to the selector type. (add_objc_string): Cast return value to 'char *'. (build_method_prototype_template, build_selector_template, build_method_template): Use actual selector type for fields pointing to selectors. (finish_objc): For GNU runtime, call build_module_initializer_routine() after build_module_descriptor(). (generate_protocol_list, generate_shared_structures): Call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(); build a type directly instead of via groktypename(). (synth_id_with_class_suffix): Return a string. (get_arg_type_list): For instance methods, use the instance type for 'self'; do not call groktypename_in_parm_context(). (build_objc_string_decl): Squash redeclaration errors in ObjC++. (objc_is_class_name): Use OBJC_TYPE_NAME instead of TYPE_NAME; handle RECORD_TYPEs in ObjC as well as ObjC++. (objc_is_id): New function. (objc_is_object_ptr): Return the canonical type node. (objc_get_class_ivars): Simplify using get_class_ivars(). (get_class_ivars): Remove second parameter; create a fresh copy of the ivar list for each call; do not check for existence of super class. (objc_eh_runtime_type): Mark #ifndef OBJCPLUS. (objc_init_exceptions): When using SJLJ-style exceptions, require the use of '-fobjc-exceptions' flag; do not require it for DWARF-style exceptions. (objc_build_exc_ptr, next_sjlj_build_try_catch_finally): Use objc_object_type instead of objc_id_type. (objc_begin_catch_clause): Convert the incoming PARM_DECL into a VAR_DECL before placing it in the appropriate scope; do not call define_decl(); adjust call to c_begin_compound_stmt(); use objc_object_type instead of objc_id_type. (build_next_objc_exception_stuff): Call create_field_decl() instead of create_builtin_decl(); construct type directly instead of calling groktypename(); use OBJC_VOID_AT_END to mark end of function parameters. (build_private_template): Adjust call to get_class_ivars(); build a type directly instead of via groktypename(). (build_protocol_template, build_method_prototype_list_template, build_method_prototype_template, build_category_template, build_selector_template, build_class_template, build_super_template, build_ivar_template, build_ivar_list_template, build_method_list_template, build_method_template): Call create_field_decl() instead of grokfield(). (objc_method_parm_type): Do not call groktypename(). (generate_descriptor_table): Call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(). (generate_method_descriptors, build_protocol_initializer, generate_dispatch_tables, build_category_initializer, build_shared_structure_initializer): Do not call groktypename(). (generate_protocols): Call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(); do not call groktypename(). (error_with_ivar): Remove last parameter. (check_ivars): Do not iterate ovar CLASS_RAW_IVARS lists in addition to CLASS_IVARS lists; adjust calls to error_with_ivar(). (generate_ivar_lists): Convert one of the initializer elements; do not call groktypename(). (get_arg_type_list, start_method_def, gen_method_def): Account for new representation of variable arguments and '...' in Objective-C methods; add Objective-C++ impedance matching code. (is_objc_type_qualifier): Remove function. (adjust_type_for_id_default): Simplify; there is no longer a need to wade through declspecs. (lookup_interface, start_class, continue_class, finish_class, start_method_def, start_protocol, build_method_decl, objc_add_method, add_instance_variable, build_ivar_reference, is_ivar, is_private, get_super_receiver, objc_build_finally_epilogue): Make into static functions. (receiver_is_class_object): Use new IS_CLASS() macro. (objc_build_message_expr): Tweak ObjC++ message argument handling; call objc_finish_message_expr() instead of finish_message_expr(). (finish_message_expr): Rename to objc_finish_message_expr(); use OBJC_TYPE_NAME and OBJC_SET_TYPE_NAME macros instead of TYPE_NAME. call gen_type_name() instead of gen_declaration(); call objc_is_id() instead of using IS_ID and IS_CLASS; Use objc_class_name instead of calling get_identifier("Class"); handle CONVERT_EXPRs in receiver. (build_objc_method_call, warn_with_method): Do not call groktypename(). (build_ivar_reference): Call convert() instead of clobbering in a type. (hash_init): Initialize string_htab hash table. (add_instance_variable): Simplify parameter list; do not call grokfield(); do not populate CLASS_IVARS list. (start_class): Check for the existence of super class, if one was specified. (continue_class): Use CLASS_RAW_IVARS rather than CLASS_IVARS; do not call build_class_template(); adjust call to get_class_ivars(); call build_decl(), pushdecl() and finish_decl() instead of define_decl(). (finish_class): Call build_decl(), pushdecl() and finish_decl() instead of define_decl(). (add_protocols): Use PROTOCOL_BINFO_ELTS for the tree vector size. (start_protocol): Do not call build_protocol_template(); use PROTOCOL_BINFO_ELTS for the tree vector size. (encode_type_qualifiers): Do not handle the 'const' qualifier here. (encode_pointer): Encode 'const char *' as 'r*', for backwards compatibility. (encode_array): Use HOST_WIDE_INT_PRINT_DEC instead of "%ld". (encode_type): Handle the 'const' qualifier here. (objc_parmlist): New global variable, sued by objc_push_parm and objc_get_parm_info(). (objc_push_parm, objc_get_parm_info): New functions. (objc_expr_last): Remove function. (synth_self_and_ucmd_args): For instance methods, use the instance type for 'self'; call objc_push_parm() instead of push_parm_decl(). (start_method_def): Do not call push_scope(), declare_parm_level(), pop_scope(), push_parm_decl(), store_parm_decls() or objc_expr_last(); just use objc_push_parm() and objc_get_parm_info(). (comp_method_with_proto): Remove function. (objc_types_are_equivalent): Strip away indirections before comparing underlying types. (comp_proto_with_proto): Do not call groktypename(); types are no longer in raw declspec format. (objc_start_function): New function. (really_start_method): Call comp_proto_with_proto() instead of comp_method_with_proto(); call objc_start_function() instead of hand-crafting a function declarator. (continue_method_def, objc_expand_function_end): Remove functions. (get_super_receiver): Call objc_get_current_scope() instead of get_current_scope(); reference 'super_class' field (instead of 'class'). (finish_method_def): Rename to objc_finish_method_definition() and add a function decl parameter; move method encoding call from objc_expand_function_end(). (is_complex_decl, adorn_decl, gen_declarator, gen_declspecs, gen_declaration_1): Remove functions. (tmpbuf, RAW_DECLSPEC): Remove. (gen_declaration): Remove second parameter; simplify to deal with TYPE_P nodes instead of raw declspecs. (gen_type_name, gen_type_name_0): New functions. (gen_method_decl): Remove second parameter; call gen_type_name() instead of gen_declaration_1(). (dump_interface): Adjust calls to gen_declaration() and gen_method_decl(); do not allocate a separate string buffer. (init_objc): Allocate a larger string buffer to accommodate dump_interface(); adjust call to build_module_descriptor(); add call to build_module_initializer_routine() for the GNU runtime. (generate_classref_translation_entry): Do not call start_decl(); call finish_var_decl() instead of finish_decl(); call convert() instead of build_c_cast(). * objc-act.h (CLASS_OWN_IVARS): Remove accessor. (CLASS_BINFO_ELTS): Reduce from 6 to 5, now that CLASS_OWN_IVARS is gone. (OCTI_GNU_INIT_DECL, GNU_INIT_decl): New. (OCTI_ELLIPSIS_NODE, objc_ellipsis_node): Remove. (OCTI_ID_ID, id_type, objc_id_id): Rename to OCTI_ID_NAME, objc_object_type and objc_object_name, respectively. (OCTI_CLS_REF, OCTI_CLASS_NAME, objc_class_reference, objc_class_name): New. (IS_CLASS): New macro. (IS_ID, IS_SUPER): Robustify. (OCTI_EXECCLASS_DECL, execclass_decl): New. (finish_file, start_class, continue_class, finish_class, start_method_def, continue_method_def, finish_method_def, start_protocol, finish_protocol, objc_build_throw_stmt, objc_build_try_catch_finally_stmt, objc_build_synchronized_prologue, objc_build_synchronized_epilogue, objc_build_try_prologue, objc_build_try_epilogue, objc_build_catch_stmt, objc_build_catch_epilogue, objc_build_finally_prologue, objc_build_finally_epilogue, is_ivar, is_private, is_public, add_instance_variable, objc_add_method, get_super_receiver, objc_clear_super_receiver, get_class_ivars_from_name, get_class_reference, get_static_reference, get_object_reference, build_message_expr, finish_message_expr, build_selector_expr, build_ivar_reference, build_keyword_decl, build_method_decl, build_protocol_expr, build_objc_string_object, objc_declare_alias, objc_declare_class, objc_declare_protocols, objc_comptypes, objc_check_decl, build_encode_expr): Remove prototypes. (imp_count, cat_count): Make GGC-aware. (OBJC_SET_TYPE_NAME): New macro. From-SVN: r87168
2004-09-08 02:49:44 +02:00
field_decl = create_field_decl (integer_type_node, "method_count");
1992-01-18 00:15:38 +01:00
chainon (field_decl_chain, field_decl);
/* struct objc_method method_list[]; */
Makefile.in (c-parse.o): Depend on $(C_COMMON_H). [gcc/ChangeLog] 2004-09-07 Ziemowit Laski <zlaski@apple.com> * Makefile.in (c-parse.o): Depend on $(C_COMMON_H). * c-parse.in: Include c-common.h instead of objc-act.h. (ivar_decl_list, ivar_decls, ivar_decl, ivars, ivar_declarator, myparms, myparm): Remove %type declarations. (methodtype, optparms, OBJC_TYPE_QUAL, objc_quals, objc_qual, objc_typename, objc_try_catch_stmt, optellipsis): Add %type declarations. (objc_inherit_code, objc_public_flag): Remove. (typespec_nonreserved_nonattr): Call objc_get_protocol_qualified_type() instead of get_static_reference() and get_protocol_reference(). (stmt_nocomp): Call grokparm() on @catch parameter. (objcdef): Move semantic action to objc_finish_implementation(). (classdef): Move semantic action to objc_start_class_interface(), objc_continue_interface(), objc_finish_interface(), objc_start_class_implementation(), objc_continue_implementation(), objc_start_category_interface() and objc_start_category_implementation(). (protocoldef): Move semantic actions to objc_start_protocol() and objc_finish_interface(). (ivar_decl_list): Remove nonterminal. (visibility_spec): Move semantic actions to objc_set_visibility(). (ivar_decls): Remove assignment to $$. (ivar_decl): Rephrase in terms of component_decl; call objc_add_instance_variable(). (ivars, ivar_declarator): Remove nonterminals. (opt_semi): New nonterminal. (methodtype): Remove semantic actions. (methoddef): Move semantic actions to objc_set_method_type(), objc_start_method_definition() and objc_finish_method_definition(). (methodproto): Move semantic actions to objc_set_method_type() and objc_add_method_declaration(). (methoddecl): Use objc_typename instead of typename; move semantic actions to objc_build_method_signature(). (optarglist, myxdecls, mydecl, myparms, myparm): Remove nonterminals. (optparmlist): Express in terms of optparms and optellipsis. (optparms, optellipsis, objc_qual, objc_quals, objc_typename): New nonterminals. (keyworddecl): Use objc_typename instead of typename. (rid_to_yy): Mark RID_IN, RID_OUT, RID_INOUT, RID_BYCOPY, RID_BYREF and RID_ONEWAY as returning OBJC_TYPE_QUAL to yyparse(). [gcc/objc/ChangeLog] 2004-09-07 Ziemowit Laski <zlaski@apple.com> * Make-lang.in (objc/objc-parse.o): Depend on $(C_COMMON_H) instead of objc/objc-act.h. (objc/objc-act.o): Depend on $(HASHTAB_H). * objc-act.c: Include hashtab.h; in ObjC++ mode, include cp-tree.h and objcp-decl.h instead of c-tree.h. (build_module_descriptor, get_class_ivars, synth_id_with_class_suffix, error_with_ivar, gen_method_decl, gen_declaration, setup_string_decl, build_protocol_template): Adjust prototypes. (build_module_initializer_routine, start_class, continue_class, finish_class, start_method_def, objc_start_function, start_protocol, build_method_decl, objc_add_method, add_instance_variable, build_ivar_reference, is_ivar, is_private, get_super_receiver, build_selector_table_decl, objc_push_parm, objc_get_parm_info, gen_type_name, gen_type_name_0, start_var_decl, finish_var_decl, create_field_decl): New prototypes. (objc_expand_function_end, comp_method_with_proto, objc_expr_last, gen_declaration_1, gen_declarator, is_complex_decl, adorn_decl, define_decl, create_builtin_decl, gen_declspecs): Remove prototypes. (TYPE_ID): Rename to OBJECT_TYPEDEF_NAME. (CLASS_TYPEDEF_NAME): New. (TAG_EXECCLASS): Change from a global variable to a #define. (TAG_RETURN_STRUCT): Delete. (TAG_GNUINIT): New, holds '__objc_gnu_init' name. (objc_inherit_code, objc_public_flag): New, moved from c-parse.in. (string_descriptor): New struct. (string_htab): New hash table. (string_hash, string_eq): New prototypes. (generate_struct_by_value_array): Call create_field_decl() instead of create_builtin_decl(). (objc_init): Do not initialize objc_ellipsis_node or TAG_EXECCLASS; In ObjC++ mode, call cxx_init() instead of c_objc_common_init(). (objc_finish_file): In ObjC++, call instantiate_pending_templates() and cp_finish_file(). (define_decl, get_static_reference, get_protocol_reference, create_builtin_decl): Remove functions. (objc_start_class_interface, objc_start_category_interface, objc_start_protocol, objc_continue_interface, objc_finish_interface, objc_start_class_implementation, objc_start_category_implementation, objc_continue_implementation, objc_finish_implementation, objc_set_visibility, objc_set_method_type, objc_build_method_signature, objc_add_method_declaration, objc_start_method_definition, objc_add_instance_variable, objc_get_protocol_qualified_type, create_field_decl, start_var_decl, finish_var_decl): New functions. (setup_string_decl): Simplify since it is only called once. (synth_module_prologue): Call build_class_template(); predefine 'id' and 'Class' as typedefs; rename 'temp_type' to 'type'; disable debug hooks for duration of function; fix GNU runtime messenger signatures to correspond to reality; forward-declare '__objc_exec_class' for the GNU runtime; call build_selector_table_decl(); in ObjC++ mode, generate 'extern "C" { ... }' wrappers around synthesized declarations; call build_protocol_template() and build_category_template(). (string_hash, string_eq): New functions. (objc_build_string_object): Check metaclass correctness only once; store string literals in hash table. (objc_build_constructor): Do not convert initializer elements; adjust for ObjC++ impedance mismatch. (build_objc_symtab_template): Call create_field_decl() instead of create_builtin_decl(). (init_objc_symtab): Add missing conversion to initializer element. (build_metadata_decl): Call start_var_decl() instead of define_decl(). (generate_objc_symtab_decl): Do not call build_category_template(); call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(). (build_module_descriptor): Call create_field_decl() instead of grokfield(); call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(); always mark module descriptor as used; move GNU runtime-specific functionality to build_module_initializer_routine(). (build_module_initializer_routine): New function, broken off of build_module_descriptor(). (objc_static_init_needed_p, objc_generate_static_init_call): New functions. (generate_static_references, generate_strings, build_selector_translation_table, generate_descriptor_table, generate_ivars_list, generate_dispatch_table, generate_category): Call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(); build a type directly instead of via groktypename(). (build_selector_reference_decl, build_selector_table_decl, build_class_reference_decl, build_protocol_reference, generate_objc_image_info): Call start_var_decl() instead of build_decl(). (build_selector_reference): For GNU runtime, do not call build_selector_reference_decl(). (build_selector, build_typed_selector_reference): Always convert result to the selector type. (add_objc_string): Cast return value to 'char *'. (build_method_prototype_template, build_selector_template, build_method_template): Use actual selector type for fields pointing to selectors. (finish_objc): For GNU runtime, call build_module_initializer_routine() after build_module_descriptor(). (generate_protocol_list, generate_shared_structures): Call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(); build a type directly instead of via groktypename(). (synth_id_with_class_suffix): Return a string. (get_arg_type_list): For instance methods, use the instance type for 'self'; do not call groktypename_in_parm_context(). (build_objc_string_decl): Squash redeclaration errors in ObjC++. (objc_is_class_name): Use OBJC_TYPE_NAME instead of TYPE_NAME; handle RECORD_TYPEs in ObjC as well as ObjC++. (objc_is_id): New function. (objc_is_object_ptr): Return the canonical type node. (objc_get_class_ivars): Simplify using get_class_ivars(). (get_class_ivars): Remove second parameter; create a fresh copy of the ivar list for each call; do not check for existence of super class. (objc_eh_runtime_type): Mark #ifndef OBJCPLUS. (objc_init_exceptions): When using SJLJ-style exceptions, require the use of '-fobjc-exceptions' flag; do not require it for DWARF-style exceptions. (objc_build_exc_ptr, next_sjlj_build_try_catch_finally): Use objc_object_type instead of objc_id_type. (objc_begin_catch_clause): Convert the incoming PARM_DECL into a VAR_DECL before placing it in the appropriate scope; do not call define_decl(); adjust call to c_begin_compound_stmt(); use objc_object_type instead of objc_id_type. (build_next_objc_exception_stuff): Call create_field_decl() instead of create_builtin_decl(); construct type directly instead of calling groktypename(); use OBJC_VOID_AT_END to mark end of function parameters. (build_private_template): Adjust call to get_class_ivars(); build a type directly instead of via groktypename(). (build_protocol_template, build_method_prototype_list_template, build_method_prototype_template, build_category_template, build_selector_template, build_class_template, build_super_template, build_ivar_template, build_ivar_list_template, build_method_list_template, build_method_template): Call create_field_decl() instead of grokfield(). (objc_method_parm_type): Do not call groktypename(). (generate_descriptor_table): Call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(). (generate_method_descriptors, build_protocol_initializer, generate_dispatch_tables, build_category_initializer, build_shared_structure_initializer): Do not call groktypename(). (generate_protocols): Call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(); do not call groktypename(). (error_with_ivar): Remove last parameter. (check_ivars): Do not iterate ovar CLASS_RAW_IVARS lists in addition to CLASS_IVARS lists; adjust calls to error_with_ivar(). (generate_ivar_lists): Convert one of the initializer elements; do not call groktypename(). (get_arg_type_list, start_method_def, gen_method_def): Account for new representation of variable arguments and '...' in Objective-C methods; add Objective-C++ impedance matching code. (is_objc_type_qualifier): Remove function. (adjust_type_for_id_default): Simplify; there is no longer a need to wade through declspecs. (lookup_interface, start_class, continue_class, finish_class, start_method_def, start_protocol, build_method_decl, objc_add_method, add_instance_variable, build_ivar_reference, is_ivar, is_private, get_super_receiver, objc_build_finally_epilogue): Make into static functions. (receiver_is_class_object): Use new IS_CLASS() macro. (objc_build_message_expr): Tweak ObjC++ message argument handling; call objc_finish_message_expr() instead of finish_message_expr(). (finish_message_expr): Rename to objc_finish_message_expr(); use OBJC_TYPE_NAME and OBJC_SET_TYPE_NAME macros instead of TYPE_NAME. call gen_type_name() instead of gen_declaration(); call objc_is_id() instead of using IS_ID and IS_CLASS; Use objc_class_name instead of calling get_identifier("Class"); handle CONVERT_EXPRs in receiver. (build_objc_method_call, warn_with_method): Do not call groktypename(). (build_ivar_reference): Call convert() instead of clobbering in a type. (hash_init): Initialize string_htab hash table. (add_instance_variable): Simplify parameter list; do not call grokfield(); do not populate CLASS_IVARS list. (start_class): Check for the existence of super class, if one was specified. (continue_class): Use CLASS_RAW_IVARS rather than CLASS_IVARS; do not call build_class_template(); adjust call to get_class_ivars(); call build_decl(), pushdecl() and finish_decl() instead of define_decl(). (finish_class): Call build_decl(), pushdecl() and finish_decl() instead of define_decl(). (add_protocols): Use PROTOCOL_BINFO_ELTS for the tree vector size. (start_protocol): Do not call build_protocol_template(); use PROTOCOL_BINFO_ELTS for the tree vector size. (encode_type_qualifiers): Do not handle the 'const' qualifier here. (encode_pointer): Encode 'const char *' as 'r*', for backwards compatibility. (encode_array): Use HOST_WIDE_INT_PRINT_DEC instead of "%ld". (encode_type): Handle the 'const' qualifier here. (objc_parmlist): New global variable, sued by objc_push_parm and objc_get_parm_info(). (objc_push_parm, objc_get_parm_info): New functions. (objc_expr_last): Remove function. (synth_self_and_ucmd_args): For instance methods, use the instance type for 'self'; call objc_push_parm() instead of push_parm_decl(). (start_method_def): Do not call push_scope(), declare_parm_level(), pop_scope(), push_parm_decl(), store_parm_decls() or objc_expr_last(); just use objc_push_parm() and objc_get_parm_info(). (comp_method_with_proto): Remove function. (objc_types_are_equivalent): Strip away indirections before comparing underlying types. (comp_proto_with_proto): Do not call groktypename(); types are no longer in raw declspec format. (objc_start_function): New function. (really_start_method): Call comp_proto_with_proto() instead of comp_method_with_proto(); call objc_start_function() instead of hand-crafting a function declarator. (continue_method_def, objc_expand_function_end): Remove functions. (get_super_receiver): Call objc_get_current_scope() instead of get_current_scope(); reference 'super_class' field (instead of 'class'). (finish_method_def): Rename to objc_finish_method_definition() and add a function decl parameter; move method encoding call from objc_expand_function_end(). (is_complex_decl, adorn_decl, gen_declarator, gen_declspecs, gen_declaration_1): Remove functions. (tmpbuf, RAW_DECLSPEC): Remove. (gen_declaration): Remove second parameter; simplify to deal with TYPE_P nodes instead of raw declspecs. (gen_type_name, gen_type_name_0): New functions. (gen_method_decl): Remove second parameter; call gen_type_name() instead of gen_declaration_1(). (dump_interface): Adjust calls to gen_declaration() and gen_method_decl(); do not allocate a separate string buffer. (init_objc): Allocate a larger string buffer to accommodate dump_interface(); adjust call to build_module_descriptor(); add call to build_module_initializer_routine() for the GNU runtime. (generate_classref_translation_entry): Do not call start_decl(); call finish_var_decl() instead of finish_decl(); call convert() instead of build_c_cast(). * objc-act.h (CLASS_OWN_IVARS): Remove accessor. (CLASS_BINFO_ELTS): Reduce from 6 to 5, now that CLASS_OWN_IVARS is gone. (OCTI_GNU_INIT_DECL, GNU_INIT_decl): New. (OCTI_ELLIPSIS_NODE, objc_ellipsis_node): Remove. (OCTI_ID_ID, id_type, objc_id_id): Rename to OCTI_ID_NAME, objc_object_type and objc_object_name, respectively. (OCTI_CLS_REF, OCTI_CLASS_NAME, objc_class_reference, objc_class_name): New. (IS_CLASS): New macro. (IS_ID, IS_SUPER): Robustify. (OCTI_EXECCLASS_DECL, execclass_decl): New. (finish_file, start_class, continue_class, finish_class, start_method_def, continue_method_def, finish_method_def, start_protocol, finish_protocol, objc_build_throw_stmt, objc_build_try_catch_finally_stmt, objc_build_synchronized_prologue, objc_build_synchronized_epilogue, objc_build_try_prologue, objc_build_try_epilogue, objc_build_catch_stmt, objc_build_catch_epilogue, objc_build_finally_prologue, objc_build_finally_epilogue, is_ivar, is_private, is_public, add_instance_variable, objc_add_method, get_super_receiver, objc_clear_super_receiver, get_class_ivars_from_name, get_class_reference, get_static_reference, get_object_reference, build_message_expr, finish_message_expr, build_selector_expr, build_ivar_reference, build_keyword_decl, build_method_decl, build_protocol_expr, build_objc_string_object, objc_declare_alias, objc_declare_class, objc_declare_protocols, objc_comptypes, objc_check_decl, build_encode_expr): Remove prototypes. (imp_count, cat_count): Make GGC-aware. (OBJC_SET_TYPE_NAME): New macro. From-SVN: r87168
2004-09-08 02:49:44 +02:00
field_decl = create_field_decl (build_array_type
(list_type,
build_index_type
(build_int_cst (NULL_TREE, size - 1))),
"method_list");
1992-01-18 00:15:38 +01:00
chainon (field_decl_chain, field_decl);
finish_struct (objc_ivar_list_record, field_decl_chain, NULL_TREE);
1992-01-18 00:15:38 +01:00
return objc_ivar_list_record;
}
static tree
build_ivar_list_initializer (tree type, tree field_decl)
1992-01-18 00:15:38 +01:00
{
tree initlist = NULL_TREE;
1992-01-18 00:15:38 +01:00
do
{
tree ivar = NULL_TREE;
1996-07-04 00:07:53 +02:00
/* Set name. */
if (DECL_NAME (field_decl))
ivar = tree_cons (NULL_TREE,
add_objc_string (DECL_NAME (field_decl),
meth_var_names),
ivar);
else
1996-07-04 00:07:53 +02:00
/* Unnamed bit-field ivar (yuck). */
tree.h (build_int_cst): New, sign extended constant. * tree.h (build_int_cst): New, sign extended constant. (build_int_cstu): New, zero extended constant. (build_int_cst_wide): Renamed from build_int_cst. * tree.c (build_int_cst, build_int_cstu): New. (build_int_cst_wide): Renamed from build_int_cst. (make_vector_type, build_common_tree_nodes, build_common_tree_nodes_2): Adjust build_int_cst calls. * builtins.c (expand_builtin_prefetch, expand_builtin_strstr, expand_builtin_strpbrk, expand_builtin_fputs, build_string_literal, expand_builtin_printf, expand_builtin_sprintf, fold_builtin_classify_type, fold_builtin_lround, fold_builtin_bitop, fold_builtin_isascii, fold_builtin_toascii, fold_builtin_isdigit, simplify_builtin_strstr, simplify_builtin_strpbrk, fold_builtin_fputs, simplify_builtin_sprintf): Likewise. * c-common.c (start_fname_decls, fix_string_type, shorten_compare, DEF_ATTR_INT): Likewise. * c-decl.c (complete_array_type, check_bitfield_type_and_width): Likewise. * c-lex.c (interpret_integer, lex_charconst): Likewise. * c-parse.in (primary) <TYPES_COMPATIBLE_P> Likewise. * c-pretty-print.c (pp_c_integer_constant): Likewise. * c-typeck.c (really_start_incremental_init, push_init_level, set_nonincremental_init_from_string): Likewise. * calls.c (load_register_parameters): Likewise. convert.c (convert_to_pointer): Likewise. coverage.c (coverage_counter_alloc, tree_coverage_counter_ref, build_fn_info_type, build_fn_info_value, build_ctr_info_value, build_gcov_info): Likewise. * except.c (init_eh, assign_filter_values): Likewise. * expmed.c (store_fixed_bit_field, extract_bit_field, extract_fixed_bit_field, extract_split_bit_field, expand_shift, expand_mult_const, expand_mult_highpart_adjust, extract_high_half, expand_sdiv_pow2, expand_divmod, make_tree): Likewise. * expr.c (convert_move, emit_group_load, emit_group_store, expand_assignment, store_constructor, store_field, expand_expr_real_1, reduce_to_bit_field_precision): Likewise. fold-const.c (force_fit_type, int_const_binop, fold_convert_const, invert_truthvalue, optimize_bit_field_compare, decode_field_reference, all_ones_mask_p, constant_boolean_node, fold_div_compare, fold, fold_read_from_constant_string, fold_negate_const, fold_abs_const, fold_not_const, round_up, round_down): Likewise. * function.c (assign_parm_setup_block): Likewise. * stmt.c (shift_return_value, expand_case, estimate_case_costs): Likewise. * stor-layout.c (layout_type, initialize_sizetypes, set_min_and_max_values_for_integral_type): Likewise. * tree-chrec.c (chrec_fold_multiply_poly_poly, reset_evolution_in_loop): Likewise. * tree-chrec.h (build_polynomial_chrec): Likewise. * tree-complex.c (build_replicated_const): Likewise. * tree-eh.c (honor_protect_cleanup_actions, lower_try_finally_onedest, lower_try_finally_copy, lower_try_finally_switch): Likewise. * tree-mudflap.c (mf_build_string, mx_register_decls, mudflap_register_call, mudflap_enqueue_constant): Likewise. * tree-nested.c (get_trampoline_type, get_nl_goto_field): Likewise. * tree-pretty-print.c (dump_generic_node): Likewise. * tree-ssa-ccp.c (widen_bitfield, maybe_fold_offset_to_array_ref): Likewise. * tree-ssa-dom.c (simplify_rhs_and_lookup_avail_expr): Likewise. * tree-ssa-loop-niter.c (number_of_iterations_cond, loop_niter_by_eval, upper_bound_in_type, lower_bound_in_type): Likewise. * tree-ssa-loop-ivcanon.c (create_canonical_iv, canonicalize_loop_induction_variables): Likewise. * tree-vectorizer.c (vect_create_index_for_array_ref, vect_transform_loop_bound, vect_compute_data_ref_alignment): Likewise. * config/alpha/alpha.c (alpha_initialize_trampoline, alpha_va_start, alpha_gimplify_va_arg_1): Likewise. * config/arm/arm.c (arm_get_cookie_size): Likewise. * config/c4x/c4x.c (c4x_gimplify_va_arg_expr): Likewise. * config/i386/i386.c (ix86_va_start, ix86_gimplify_va_arg): Likewise. * config/ia64/ia64.c (ia64_gimplify_va_arg): Likewise. * config/mips/mips.c (mips_build_builtin_va_list, mips_va_start, mips_gimplify_va_arg_expr): Likewise. * config/pa/pa.c (hppa_gimplify_va_arg_expr): Likewise. * config/rs6000/rs6000.c (rs6000_va_start, rs6000_gimplify_va_arg, add_compiler_branch_island): Likewise. * config/s390/s390.c (s390_va_start): Likewise. * config/sh/sh.c (sh_va_start): Likewise. * config/stormy16/stormy16.c (xstormy16_expand_builtin_va_start): Likewise. * config/xtensa/xtensa.c (xtensa_va_start, xtensa_gimplify_va_arg_expr): Likewise. * objc/objc-act.c (build_objc_string_object, build_objc_symtab_template, init_def_list, init_objc_symtab, init_module_descriptor, generate_static_references, build_selector_translation_table, get_proto_encoding, build_typed_selector_reference, build_selector_reference, build_next_objc_exception_stuff, build_method_prototype_list_template, generate_descriptor_table, generate_protocols, build_protocol_initializer, build_ivar_list_template, build_method_list_template, build_ivar_list_initializer, generate_ivars_list, generate_dispatch_table, generate_protocol_list, build_category_initializer, build_shared_structure_initializer, generate_shared_structures, handle_impent, generate_objc_image_info): Likewise. 2004-04-25 Paolo Bonzini <bonzini@gnu.org> * cfglayout.c (duplicate_insn_chain): Remove references to NOTE_INSN_LOOP_VTOP and NOTE_INSN_LOOP_CONT. * cfgloop.h (struct loop): Remove fields vtop, cont and cont_dominator. * cfgrtl.c (rtl_delete_block): Remove handling of NOTE_INSN_LOOP_CONT. * final.c (final_scan_insn): Remove references to NOTE_INSN_LOOP_VTOP and NOTE_INSN_LOOP_CONT. * insn-notes.def (NOTE_INSN_LOOP_VTOP, NOTE_INSN_LOOP_CONT): Remove. * jump.c (squeeze_notes): Remove references to NOTE_INSN_LOOP_VTOP and NOTE_INSN_LOOP_CONT. * loop.c (scan_loops, find_and_verify_loops, for_each_insn_in_loop, check_dbra_loop, loop_dump_aux): Remove references to removed notes and fields. * reorg.c (mostly_true_jump): Do not rely on NOTE_INSN_LOOP_VTOPs. * unroll.c (unroll_loop, copy_loop_body, loop_iterations): Remove references to removed notes and fields. (subtract_reg_term, ujump_to_loop_cont): Remove. From-SVN: r86544
2004-08-25 11:52:54 +02:00
ivar = tree_cons (NULL_TREE, build_int_cst (NULL_TREE, 0), ivar);
1992-01-18 00:15:38 +01:00
1996-07-04 00:07:53 +02:00
/* Set type. */
encode_field_decl (field_decl,
obstack_object_size (&util_obstack),
OBJC_ENCODE_DONT_INLINE_DEFS);
/* Null terminate string. */
obstack_1grow (&util_obstack, 0);
ivar
= tree_cons
(NULL_TREE,
add_objc_string (get_identifier (obstack_finish (&util_obstack)),
meth_var_types),
ivar);
obstack_free (&util_obstack, util_firstobj);
1992-01-18 00:15:38 +01:00
/* Set offset. */
* Rework fields used to describe positions of bitfields and modify sizes to be unsigned and use HOST_WIDE_INT. * alias.c (reg_known_value_size): Now unsigned. * c-typeck.c (build_unary_op, case ADDR_EXPR): Use byte_position. (really_start_incremental_init): Use bitsize_zero_node. (push_init_level, pop_init_level, output_init_element): Likewise. Use bitsize_unit_node and bitsize_one_node. (output_pending_init_elements, process_init_element): Likewise. * combine.c (combine_max_regno, reg_sign_bit_copies): Now unsigned. (make_extraction): Position and length HOST_WIDE_INT and unsigned HOST_WIDE_INT, respectively. (get_pos_from_mask): Passed in value is unsigned HOST_WIDE_INT. (num_sign_bit_copies): Returns unsigned. BITWIDTH now unsigned; rework arithmetic. Remove recursive call from arg to MAX. (combine_instructions, init_reg_last_arrays): NREGS now unsigned. (setup_incoming_promotions, can_combine_p, try_combine, simplify_set): REGNO now unsigned. (set_nonzero_bit_and_sign_copies): NUM now unsigned. (find_split_point, expand_compound_operation, make_extraction): LEN now unsigned HOST_WIDE_INT, POS now HOST_WIDE_INT. (make_field_assignment): Likewise. (combine_simplify_rtx): Add cast. (expand_compound_operation): MODEWIDTH now unsigned; rework arithmetic. (force_to_mode): WIDTH now unsigned; add cast. (if_then_else_cond): SIZE now unsigned. (nonzero_bits): MODE_WIDTH, RESULT_WIDTH, and WIDTH now unsigned. (extended_count): Now returns unsigned. (simplify_shift_const): COUNT unsigned; arg is now INPUT_COUNT. Add SIGNED_COUNT variable; MODE_WORDS and FIRST_COUNT now unsigned. (simplify_comparison): MODE_WIDTH now unsigned. (update_table_tick): REGNO and ENDREGNO now unsigned; new var R. (mark_used_regs_combine): Likewise; rework arithmetic. (record_value_for_reg): REGNO, ENDREGNO, and I now unsigned. (record_dead_and_set_regs, reg_dead_at_p, distribute_notes): Likewise. (record_promoted_value): REGNO now unsigned. (get_last_value_validate): REGNO, ENDREGNO, and J now unsigned. (get_last_value): REGNO now unsigned. (use_crosses_set_p): REGNO and ENDREGNO now unsigned. (reg_dead_regno, reg_dead_endregno): Now unsigned. (remove_death): Arg REGNO now unsigned. (move_deaths): REGNO, DEADREGNO, DEADEND, OUREND, and I now unsigned. (reg_bitfield_target_p): REGNO, REGNO, ENDREGNO, and ENDTREGNO now unsigned. * convert.c (convert_to_integer): INPREC and OUTPREC now unsigned. * cse.c (struct qty_table_elem): FIRST_REG and LAST_REG now unsigned. (struct cse_reg_info): REGNO now unsigned. (cached_regno): Now unsigned. (REGNO_QTY_VALID_P): Add cast. (make_new_qty, make_regs_eqv, delete_reg_eqiv): Regno args unsigned. (remove_invalid_regs): Likewise. (remove_invalid_subreg_refs): Likewise; arg WORD also unsigned as are variables END and I. (get_cse_reg_info, insert): Likewise. (mention_regs, invalidate_for_call): REGNO, ENDREGNO, and I unsigned. (canon_hash): Likewise. (insert_regs, lookup_for_remove): REGNO now unsigned. (invalidate): REGNO, ENDREGNO, TREGNO, and TENDREGNO now unsigned. New variable RN. * dbxout.c (dbxout_parms, dbxout_reg_parms): Don't check for REGNO < 0. * dwarf2out.c (dwarf2ou_frame_debug_expr): Remove cast. * emit-rtl.c (subreg_realpart_p): Add cast. (operand_subword): Arg I is now unsigned as is var PARTWORDS. (operand_subword_force): Arg I is now unsigned. * except.c (eh_regs): Variable I is now unsigned. * explow.c (hard_function_value): BYTES is unsigned HOST_WIDE_INT. * expmed.c (store_fixed_bit_field): Position is HOST_WIDE_INT; length is unsigned HOST_WIDE_INT; likewise for internal variables. (store_split_bit_field, extract_fixed_bit_field): Likewise. (extract_split_bit_field, store_bit_field, extract_bit_field): Likewise. * expr.c (store_constructor_fields, store_constructor, store_field): Positions are HOST_WIDE_INT and lengths are unsigned HOST_WIDE_INT. (expand_assignment, expand_expr, expand_expr_unaligned): Likewise. (do_jump): Likewise. (move_by_pieces, move_by_pieces_ninsns, clear_by_pieces): MAX_SIZE is now unsigned. (emit_group_load): BYTEPOS is HOST_WIDE_INT; BYTELEN is unsigned. (emit_group_store): Likewise. (emit_move_insn): I now unsigned. (store_constructor): Use host_integerp, tree_low_cst, and bitsize_unit_node. (get_inner_reference): Return bitpos and bitsize as HOST_WIDE_INT. Rework all calculations to use trees and new fields. * expr.h (promoted_input_arg): Regno now unsigned. (store_bit_field, extract_bit_field): Adjust types of pos and size. (mark_seen_cases): Arg is HOST_WIDE_INT. * flow.c (verify_wide_reg_1): REGNO now unsigned. * fold-const.c (decode_field_reference): Size and pos HOST_WIDE_INT; precisions and alignments are unsigned. (optimize_bit_field_compare, fold_truthop): Likewise. (int_const_binop): Adjust threshold for size_int_type_wide call. (fold_convert): Likewise. (size_int_type_wide): Make table larger and fix thinko that only had half of table used. (all_ones_mask_p, fold): Precisions are unsigned. * function.c (put_reg_info_stack): REGNO is unsigned. (instantiate_decl): Size is HOST_WIDE_INT. (instantiate_virtual_regs): I is unsigned. (assign_parms): REGNO, REGNOI, and REGNOR are unsigned. (promoted_input_arg): REGNO is unsigned. * function.h (struct function): x_max_parm_reg is now unsigned. * gcse.c (max_gcse_regno): Now unsigned. (struct null_pointer_info): min_reg and max_reg now unsigned. (lookup_set, next_set): REGNO arg now unsigned. (compute_hash_table): REGNO and I now unsigned. (handle_avail_expr): regnum_for_replacing now unsigned. (cprop_insn): REGNO now unsigned. (delete_null_pointer_checks_1): BLOCK_REG now pointer to unsigned. * ggc-common.c (ggc_mark_tree_children, case FIELD_DECL): New case. * global.c (set_preference): SRC_REGNO, DEST_REGNO, and I now unsigned. * hard-reg-set.h (reg_class_size): Now unsigned. * integrate.c (mark_stores): LAST_REG and I now unsigned; new UREGNO. * jump.c (mark_modified_reg): I now unsigned; add cast. (rtx_equal_for_thread_p): Add cast. * loop.c (max_reg_before_loop): Now unsigned. (struct_movable): REGNO now unsigned. (try_copy_prop): REGNO arg unsigned. (regs_match_p): XN and YN now unsigned. (consec_sets_invariant_p, maybe_eliminate_biv): REGNO now unsigned. (strength_reduce): Likewise; NREGS also unsigned. (first_increment_giv, last_increment_giv unsigned): Now unsigned. * loop.h (struct iv_class): REGNO now unsigned. (max_reg_before_loop, first_increment_giv, last_increment_giv): Now unsigned. * machmode.h (mode_size, mode_unit_size): Now unsigned. (mode_for_size, smallest_mode_for_size): Pass size as unsigned. * optabs.c (expand_binop): I and NWORDS now unsigned. (expand_unop): I now unsigned. * print-tree.c (print_node): Don't print DECL_FIELD_BITPOS, but do print DECL_FIELD_OFFSET and DECL_FIELD_BIT_OFFSET. * real.c (significand_size): Now returns unsigned. * real.h (significand_size): Likewise. * regclass.c (reg_class_size): Now unsigned. (choose_hard_reg_mode): Both operands now unsigned. (record_reg_classes): REGNO and NR now unsigned. (reg_scan): NREGS now unsigned. (reg_scan_update): old_max_regno now unsigned. (reg_scan_mark_refs): Arg MIN_REGNO and var REGNO now unsigned. * reload.c (find_valid_class): BEST_SIZE now unsigned. (find_dummy_reload): REGNO, NWORDS, and I now unsigned. (hard_reg_set_here_p): Args BEG_REGNO and END_REGNO now unsigned. Likewise for variable R. (refers_to_regno_for_reload_p): Args REGNO and END_REGNO now unsigned, as are variables INNER_REGNO and INNER_ENDREGNO; add new variable R. (find_equiv_reg): Add casts. (regno_clobbered_p): Arg REGNO now unsigned. * reload.h (struct reload): NREGS now unsigned. (refers_to_regno_for_reload_p): Regno args are unsigned. (regno_clobbered_p): Likewise. * reload1.c (reg_max_ref_width, spill_stack_slot_width): Now unsigned. (compute_use_by_pseudos): REGNO now unsigned. (find_reg): I and J now unsigned, new variable K, and change loop variables accordingly; THIS_NREGS now unsigned. (alter_reg): INHERENT_SIZE and TOTAL_SIZE now unsigned. (spill_hard_reg): REGNO arg now unsigned; add casts. (forget_old_reloads_1): REGNO, NR, and I now unsigned. (mark_reload_reg_in_use): Arg REGNO and vars NREGS and I now unsigned. (clear_reload_reg_in_use): Arg REGNO and vars NREGS, START_REGNO, END_REGNO, CONFLICT_START, and CONFLICT_END now unsigned. (reload_reg_free_p, reload_reg_reaches_end_p): Arg REGNO now unsigned. (choose_reload_regs): MAX_GROUP_SIZE now unsigned. (emit_reload_insns): REGNO now unsigned. (reload_cse_move2add): Add cast. (move2add_note_store): REGNO and I now unsigned; new variable ENDREGNO and rework loop. * resource.c (mark_referenced_resources, mark_set_resources): New variable R; REGNO and LAST_REGNO now unsigned. (mark_target_live_regs): J and REGNO now unsigned. * rtl.c (mode_size, mode_unit_size): Now unsigned. * rtl.h (union rtunion_def): New field rtuint. (XCUINT): New macro. (ADDRESSOF_REGNO, REGNO, SUBREG_WORD): New XCUINT. (operand_subword, operand_subword_force): Word number is unsigned. (choose_hard_reg_mode): Operands are unsigned. (refers_to-regno_p, dead_or_set_regno_p): Regno arg is unsigned. (find_regno_note, find_regno_fusage, replace_regs): Likewise. (regno_use_in, combine_instructions, remove_death): Likewise. (reg_scan, reg_scan_update): Likewise. (extended_count): Return is unsigned. * rtlanal.c (refers_to_regno_p): Args REGNO and ENDREGNO and vars I, INNER_REGNO, and INNER_ENDREGNO now unsigned; new variable X_REGNO. (reg_overlap_mentioned_p): REGNO and ENDREGNO now unsigned. (reg_set_last_first_regno, reg_set_last_last_regno): Now unsigned. (reg_reg_last_1): FIRS and LAST now unsigned. (dead_or_set_p): REGNO, LAST_REGNO, and I now unsigned. (dead_or_set_regno_p): Arg TEST_REGNO and vars REGNO and ENDREGNO now unsigned. (find_regno_note, regno_use_in): Arg REGNO now unsigned. (find_regno_fusage): Likewise; also var REGNOTE now unsigned. (find_reg_fusage): Variables REGNO, END_REGNO, and I now unsigned. (replace_regs): Arg NREGS now unsigned. * sdbout.c (sdbout_parms, sdbout_reg_parms): Don't check REGNO < 0. * simplify-rtx.c (simplify_unary_operation): WIDTH now unsigned. (simplify_binary_operation): Likewise. (cselib_invalidate_regno): Arg REGNO and variables ENDREGNO, I, and THIS_LAST now unsigned. (cselib_record_set): Add cast. * ssa.c (ssa_max_reg_num): Now unsigned. (rename_block): REGNO now unsigned. * stmt.c (expand_return): Bit positions unsigned HOST_WIDE_INT; sizes now unsigned. (all_cases_count): Just return -1 not -2. COUNT, MINVAL, and LASTVAL now HOST_WIDE_INT. Rework tests to use trees whenever possible. Use host_integerp and tree_low_cst. (mark_seen_cases): COUNT arg now HOST_WIDE_INT; Likewise variable NEXT_NODE_OFFSET; XLO now unsigned. (check_for_full_enumeration_handing): BYTES_NEEDED, I to HOST_WIDE_INT. * stor-layout.c (mode_for_size): SIZE arg now unsigned. (smallest_mode_for_size): Likewise. (layout_decl): Simplify handing of a specified DECL_SIZE_UNIT. KNOWN_ALIGN is now an alignment, so simplify code. Don't turn off DECL_BIT_FIELD if field is BLKmode, but not type. (start_record_layout): Renamed from new_record_layout_info. Update to new fields. (debug_rli, normalize_rli, rli_size_unit_so_far, rli_size_so_far): New functions. (place_union_field): Renamed from layout_union_field. Update to use new fields in rli. (place_field): Renamed from layout_field. Major rewrite to use new fields in rli; pass alignment to layout_decl. (finalize_record_size): Rework to use new fields in rli and handle union. (compute_record_mode): Rework to simplify and to use new DECL fields. (finalize_type_size): Make rounding more consistent. (finish_union_layout): Deleted. (layout_type, case VOID_TYPE): Don't set TYPE_SIZE_UNIT either. (layout_type, case RECORD_TYPE): Call new function names. (initialize_sizetypes): Set TYPE_IS_SIZETYPE. (set_sizetype): Set TYPE_IS_SIZETYPE earlier. (get_best_mode): UNIT is now unsigned; remove casts. * tree.c (bit_position): Compute from new fields. (byte_position, int_byte_position): New functions. (print_type_hash_statistics): Cast to remove warning. (build_range_type): Use host_integerp and tree_low_cst to try to hash. (build_index_type): Likewise; make subtype of sizetype. (build_index_2_type): Pass sizetype to build_range_type. (build_common_tree_nodes): Use size_int and bitsize_int to initialize nodes; add bitsize_{zero,one,unit}_node. * tree.h (DECL_FIELD_CONTEXT): Use FIELD_DECL_CHECK. (DECL_BIT_FIELD_TYPE, DECL_QUALIFIER, DECL_FCONTEXT): Likewise. (DECL_PACKED, DECL_BIT_FIELD): Likewise. (DECL_FIELD_BITPOS): Deleted. (DECL_FIELD_OFFSET, DECL_FIELD_BIT_OFFSET): New fields. (DECL_RESULT, DECL_SAVED_INSNS): Use FUNCTION_DECL_CHECK. (DECL_FRAME_SIZE, DECL_FUNCTION_CODE, DECL_NO_STATIC_CHAIN): Likewise. (DECL_INLINE, DECL_BUILT_IN_NONANSI, DECL_IS_MALLOC): Likewise. (DECL_BUILT_IN_CLASS, DECL_STATIC_CONSTRUCTOR): Likewise. (DECL_STATIC_DESTRUCTOR, DECL_NO_CHECK_MEMORY_USAGE): Likewise. (DECL_NO_INSTRUMENT_FUNCTION_ENTRY_EXIT, DECL_NO_LIMIT_STACK) Likewise. (DECL_ORIGINAL_TYPE, TYPE_DECL_SUPPRESS_DEBUG): Use TYPE_DECL_CHECK. (DECL_ARG_TYPE_AS_WRITEN, DECL_ARG_TYPE): Use PARM_DECL_CHECK. (DECL_INCOMING_RTL, DECL_TRANSPARENT_UNION): Likewise. (DECL_ALIGN): Adjust to new field in union. (DECL_OFFSET_ALIGN): New field. (DECL_ERROR_ISSUED, DECL_TOO_LATE): Use LABEL_DECL_CHECK. (DECL_IN_TEXT_SECTION): Use VAR_DECL_CHECK. (union tree_decl): Add struct for both aligns. (enum tree_index): Add TI_BITSIZE_{ZERO,ONE,UNIT}. (bitsize_zero_node, bitsize_one_node, bitsize_unit_node): Added. (struct record_layout_info): Rework fields to have offset alignment and byte and bit position. (start_record_layout, place_field): Renamed from old names. (rli_size_so_far, rli_size_unit_so_far, normalize_rli): New decls. (byte_position, int_byte_position): Likewise. (get_inner_reference): Change types of position and length. * unroll.c (unroll_loop): New variable R; use for some loops. MAX_LOCAL_REGNUM and MAXREGNUM now unsigned. (calculate_giv_inc): Arg REGNO now unsigned. (copy_loop_body): REGNO and SRC_REGNO now unsigned. * varasm.c (assemble_variable): Clean up handling of size using host_integerp and tree_low_cst. (decode_addr_const): Use byte, not bit, position. (output_constructor): bitpos and offsets are HOST_WIDE_INT; use tree_low_cst and int_bit_position. * objc/objc-act.c (build_ivar_list_initializer): Use byte_position. * ch/actions.c (check_missing_cases): BYTES_NEEDED is HOST_WIDE_INT. * ch/typeck.c (expand_constant_to_buffer): Use int_byte_position. (extract_constant_from_buffer): Likewise. * cp/class.c (build_vbase_pointer_fields): layout_field now place_field. (get_vfield_offset): Use byte_position. (set_rtti_entry): Set OFFSET to ssizetype zero. (get_binfo_offset_as_int): Deleted. (dfs_record_base_offsets): Use tree_low_cst. (dfs_search_base_offsets): Likewise. (layout_nonempty_base_or_field): Reflect changes in RLI format and call byte_position. (layout_empty_base): Convert offset to ssizetype. (build_base_field): use rli_size_unit_so_far. (dfs_propagate_binfo_offsets): Do computation in proper type. (layout_virtual_bases): Pass ssizetype to propagate_binfo_offsets. (layout_class_type): Reflect changes in RLI names and fields. (finish_struct_1): Set DECL_FIELD_OFFSET. * cp/dump.c (dequeue_and_dump): Call bit_position. * cp/expr.c (cplus_expand_constant): Use byte_position. * cp/rtti.c (expand_class_desc): Use bitsize_one_node. * cp/typeck.c (build_component_addr): Use byte_position and don't special case for zero offset. * f/com.c (ffecom_tree_canonize_ptr_): Use bitsize_zero_node. (ffecom_tree_canonize_ref_): Likewise. * java/class.c (make_field_value): Use byte_position. * java/expr.c (JAVA_ARRAY_LENGTH_OFFSET): Use byte_position. (java_array_data_offset): Likewise. * java/java-tree.h (MAYBE_CREATE_TYPE_TYPE_LANG_SPECIFIC): Add case to bzero call. From-SVN: r32742
2000-03-25 19:34:13 +01:00
ivar = tree_cons (NULL_TREE, byte_position (field_decl), ivar);
initlist = tree_cons (NULL_TREE,
tree.c (build_constructor): New function. * tree.c (build_constructor): New function. * tree.h: Prototype it. * c-typeck.c (build_c_cast, pop_init_level) * profile.c (build_function_info_value, build_gcov_info_value) (create_profiler): Use build_constructor. * builtins.c (expand_builtin_args_info): Remove #if 0 blocks. * objc/objc-act.c (build_constructor): Rename objc_build_constructor. Use build_constructor. (build_objc_string_object, objc_add_static_instance) (init_def_list, init_objc_symtab, init_module_descriptor) (generate_static_references, build_selector_translation_table) (build_descriptor_table_initializer, generate_descriptor_table) (build_protocol_initializer, build_ivar_list_initializer) (generate_ivars_list, build_dispatch_table_initializer) (generate_dispatch_table, generate_protocol_list) (build_category_initializer, build_shared_structure_initializer): Update to match. ada: * gigi.h, utils2.c (build_constructor): Rename gnat_build_constructor. Use build_constructor. * decl.c (gnat_to_gnu_entity) * trans.c (tree_transform, pos_to_constructor, extract_values) * ada/utils.c (build_template, convert_to_fat_pointer, convert) (unchecked_convert) * ada/utils2.c (build_binary_op, build_call_raise, build_allocator) (fill_vms_descriptor): Update to match. cp: * class.c (initialize_array) * decl.c (reshape_init) * decl2.c (build_expr_from_tree) * init.c (build_zero_init) * pt.c (tsubst_copy, tsubst_copy_and_build) * rtti.c (tinfo_base_init, generic_initializer, ptr_initializer) (ptm_initializer, class_initializer, get_pseudo_ti_init) * semantics.c (finish_compound_literal) * typeck.c (build_ptrmemfunc1) * typeck2.c (store_init_value, process_init_constructor) (build_functional_cast): Use build_constructor. f: * com.c (ffecom_build_complex_constant_, ffecom_expr_) (ffecom_init_zero_, ffecom_transform_namelist_, ffecom_vardesc_) (ffecom_vardesc_array_, ffecom_vardesc_dims_, ffecom_2) * ste.c (ffeste_io_ialist_, ffeste_io_cilist_, ffeste_io_cllist_) (ffeste_io_icilist_, ffeste_io_inlist_, ffeste_io_olist_): Use build_constructor. java: * class.c (make_field_value, make_method_value, get_dispatch_table) (make_class_data, emit_offset_symbol_table) * constants.c (build_constants_constructor) * java-tree.h (START_RECORD_CONSTRUCTOR) * parse.y (maybe_build_array_element_wfl): Use build_constructor. From-SVN: r65539
2003-04-13 03:45:35 +02:00
objc_build_constructor (type, nreverse (ivar)),
initlist);
do
field_decl = TREE_CHAIN (field_decl);
while (field_decl && TREE_CODE (field_decl) != FIELD_DECL);
1992-01-18 00:15:38 +01:00
}
while (field_decl);
tree.c (build_constructor): New function. * tree.c (build_constructor): New function. * tree.h: Prototype it. * c-typeck.c (build_c_cast, pop_init_level) * profile.c (build_function_info_value, build_gcov_info_value) (create_profiler): Use build_constructor. * builtins.c (expand_builtin_args_info): Remove #if 0 blocks. * objc/objc-act.c (build_constructor): Rename objc_build_constructor. Use build_constructor. (build_objc_string_object, objc_add_static_instance) (init_def_list, init_objc_symtab, init_module_descriptor) (generate_static_references, build_selector_translation_table) (build_descriptor_table_initializer, generate_descriptor_table) (build_protocol_initializer, build_ivar_list_initializer) (generate_ivars_list, build_dispatch_table_initializer) (generate_dispatch_table, generate_protocol_list) (build_category_initializer, build_shared_structure_initializer): Update to match. ada: * gigi.h, utils2.c (build_constructor): Rename gnat_build_constructor. Use build_constructor. * decl.c (gnat_to_gnu_entity) * trans.c (tree_transform, pos_to_constructor, extract_values) * ada/utils.c (build_template, convert_to_fat_pointer, convert) (unchecked_convert) * ada/utils2.c (build_binary_op, build_call_raise, build_allocator) (fill_vms_descriptor): Update to match. cp: * class.c (initialize_array) * decl.c (reshape_init) * decl2.c (build_expr_from_tree) * init.c (build_zero_init) * pt.c (tsubst_copy, tsubst_copy_and_build) * rtti.c (tinfo_base_init, generic_initializer, ptr_initializer) (ptm_initializer, class_initializer, get_pseudo_ti_init) * semantics.c (finish_compound_literal) * typeck.c (build_ptrmemfunc1) * typeck2.c (store_init_value, process_init_constructor) (build_functional_cast): Use build_constructor. f: * com.c (ffecom_build_complex_constant_, ffecom_expr_) (ffecom_init_zero_, ffecom_transform_namelist_, ffecom_vardesc_) (ffecom_vardesc_array_, ffecom_vardesc_dims_, ffecom_2) * ste.c (ffeste_io_ialist_, ffeste_io_cilist_, ffeste_io_cllist_) (ffeste_io_icilist_, ffeste_io_inlist_, ffeste_io_olist_): Use build_constructor. java: * class.c (make_field_value, make_method_value, get_dispatch_table) (make_class_data, emit_offset_symbol_table) * constants.c (build_constants_constructor) * java-tree.h (START_RECORD_CONSTRUCTOR) * parse.y (maybe_build_array_element_wfl): Use build_constructor. From-SVN: r65539
2003-04-13 03:45:35 +02:00
return objc_build_constructor (build_array_type (type, 0),
nreverse (initlist));
1992-01-18 00:15:38 +01:00
}
static tree
generate_ivars_list (tree type, const char *name, int size, tree list)
1992-01-18 00:15:38 +01:00
{
Makefile.in (c-parse.o): Depend on $(C_COMMON_H). [gcc/ChangeLog] 2004-09-07 Ziemowit Laski <zlaski@apple.com> * Makefile.in (c-parse.o): Depend on $(C_COMMON_H). * c-parse.in: Include c-common.h instead of objc-act.h. (ivar_decl_list, ivar_decls, ivar_decl, ivars, ivar_declarator, myparms, myparm): Remove %type declarations. (methodtype, optparms, OBJC_TYPE_QUAL, objc_quals, objc_qual, objc_typename, objc_try_catch_stmt, optellipsis): Add %type declarations. (objc_inherit_code, objc_public_flag): Remove. (typespec_nonreserved_nonattr): Call objc_get_protocol_qualified_type() instead of get_static_reference() and get_protocol_reference(). (stmt_nocomp): Call grokparm() on @catch parameter. (objcdef): Move semantic action to objc_finish_implementation(). (classdef): Move semantic action to objc_start_class_interface(), objc_continue_interface(), objc_finish_interface(), objc_start_class_implementation(), objc_continue_implementation(), objc_start_category_interface() and objc_start_category_implementation(). (protocoldef): Move semantic actions to objc_start_protocol() and objc_finish_interface(). (ivar_decl_list): Remove nonterminal. (visibility_spec): Move semantic actions to objc_set_visibility(). (ivar_decls): Remove assignment to $$. (ivar_decl): Rephrase in terms of component_decl; call objc_add_instance_variable(). (ivars, ivar_declarator): Remove nonterminals. (opt_semi): New nonterminal. (methodtype): Remove semantic actions. (methoddef): Move semantic actions to objc_set_method_type(), objc_start_method_definition() and objc_finish_method_definition(). (methodproto): Move semantic actions to objc_set_method_type() and objc_add_method_declaration(). (methoddecl): Use objc_typename instead of typename; move semantic actions to objc_build_method_signature(). (optarglist, myxdecls, mydecl, myparms, myparm): Remove nonterminals. (optparmlist): Express in terms of optparms and optellipsis. (optparms, optellipsis, objc_qual, objc_quals, objc_typename): New nonterminals. (keyworddecl): Use objc_typename instead of typename. (rid_to_yy): Mark RID_IN, RID_OUT, RID_INOUT, RID_BYCOPY, RID_BYREF and RID_ONEWAY as returning OBJC_TYPE_QUAL to yyparse(). [gcc/objc/ChangeLog] 2004-09-07 Ziemowit Laski <zlaski@apple.com> * Make-lang.in (objc/objc-parse.o): Depend on $(C_COMMON_H) instead of objc/objc-act.h. (objc/objc-act.o): Depend on $(HASHTAB_H). * objc-act.c: Include hashtab.h; in ObjC++ mode, include cp-tree.h and objcp-decl.h instead of c-tree.h. (build_module_descriptor, get_class_ivars, synth_id_with_class_suffix, error_with_ivar, gen_method_decl, gen_declaration, setup_string_decl, build_protocol_template): Adjust prototypes. (build_module_initializer_routine, start_class, continue_class, finish_class, start_method_def, objc_start_function, start_protocol, build_method_decl, objc_add_method, add_instance_variable, build_ivar_reference, is_ivar, is_private, get_super_receiver, build_selector_table_decl, objc_push_parm, objc_get_parm_info, gen_type_name, gen_type_name_0, start_var_decl, finish_var_decl, create_field_decl): New prototypes. (objc_expand_function_end, comp_method_with_proto, objc_expr_last, gen_declaration_1, gen_declarator, is_complex_decl, adorn_decl, define_decl, create_builtin_decl, gen_declspecs): Remove prototypes. (TYPE_ID): Rename to OBJECT_TYPEDEF_NAME. (CLASS_TYPEDEF_NAME): New. (TAG_EXECCLASS): Change from a global variable to a #define. (TAG_RETURN_STRUCT): Delete. (TAG_GNUINIT): New, holds '__objc_gnu_init' name. (objc_inherit_code, objc_public_flag): New, moved from c-parse.in. (string_descriptor): New struct. (string_htab): New hash table. (string_hash, string_eq): New prototypes. (generate_struct_by_value_array): Call create_field_decl() instead of create_builtin_decl(). (objc_init): Do not initialize objc_ellipsis_node or TAG_EXECCLASS; In ObjC++ mode, call cxx_init() instead of c_objc_common_init(). (objc_finish_file): In ObjC++, call instantiate_pending_templates() and cp_finish_file(). (define_decl, get_static_reference, get_protocol_reference, create_builtin_decl): Remove functions. (objc_start_class_interface, objc_start_category_interface, objc_start_protocol, objc_continue_interface, objc_finish_interface, objc_start_class_implementation, objc_start_category_implementation, objc_continue_implementation, objc_finish_implementation, objc_set_visibility, objc_set_method_type, objc_build_method_signature, objc_add_method_declaration, objc_start_method_definition, objc_add_instance_variable, objc_get_protocol_qualified_type, create_field_decl, start_var_decl, finish_var_decl): New functions. (setup_string_decl): Simplify since it is only called once. (synth_module_prologue): Call build_class_template(); predefine 'id' and 'Class' as typedefs; rename 'temp_type' to 'type'; disable debug hooks for duration of function; fix GNU runtime messenger signatures to correspond to reality; forward-declare '__objc_exec_class' for the GNU runtime; call build_selector_table_decl(); in ObjC++ mode, generate 'extern "C" { ... }' wrappers around synthesized declarations; call build_protocol_template() and build_category_template(). (string_hash, string_eq): New functions. (objc_build_string_object): Check metaclass correctness only once; store string literals in hash table. (objc_build_constructor): Do not convert initializer elements; adjust for ObjC++ impedance mismatch. (build_objc_symtab_template): Call create_field_decl() instead of create_builtin_decl(). (init_objc_symtab): Add missing conversion to initializer element. (build_metadata_decl): Call start_var_decl() instead of define_decl(). (generate_objc_symtab_decl): Do not call build_category_template(); call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(). (build_module_descriptor): Call create_field_decl() instead of grokfield(); call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(); always mark module descriptor as used; move GNU runtime-specific functionality to build_module_initializer_routine(). (build_module_initializer_routine): New function, broken off of build_module_descriptor(). (objc_static_init_needed_p, objc_generate_static_init_call): New functions. (generate_static_references, generate_strings, build_selector_translation_table, generate_descriptor_table, generate_ivars_list, generate_dispatch_table, generate_category): Call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(); build a type directly instead of via groktypename(). (build_selector_reference_decl, build_selector_table_decl, build_class_reference_decl, build_protocol_reference, generate_objc_image_info): Call start_var_decl() instead of build_decl(). (build_selector_reference): For GNU runtime, do not call build_selector_reference_decl(). (build_selector, build_typed_selector_reference): Always convert result to the selector type. (add_objc_string): Cast return value to 'char *'. (build_method_prototype_template, build_selector_template, build_method_template): Use actual selector type for fields pointing to selectors. (finish_objc): For GNU runtime, call build_module_initializer_routine() after build_module_descriptor(). (generate_protocol_list, generate_shared_structures): Call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(); build a type directly instead of via groktypename(). (synth_id_with_class_suffix): Return a string. (get_arg_type_list): For instance methods, use the instance type for 'self'; do not call groktypename_in_parm_context(). (build_objc_string_decl): Squash redeclaration errors in ObjC++. (objc_is_class_name): Use OBJC_TYPE_NAME instead of TYPE_NAME; handle RECORD_TYPEs in ObjC as well as ObjC++. (objc_is_id): New function. (objc_is_object_ptr): Return the canonical type node. (objc_get_class_ivars): Simplify using get_class_ivars(). (get_class_ivars): Remove second parameter; create a fresh copy of the ivar list for each call; do not check for existence of super class. (objc_eh_runtime_type): Mark #ifndef OBJCPLUS. (objc_init_exceptions): When using SJLJ-style exceptions, require the use of '-fobjc-exceptions' flag; do not require it for DWARF-style exceptions. (objc_build_exc_ptr, next_sjlj_build_try_catch_finally): Use objc_object_type instead of objc_id_type. (objc_begin_catch_clause): Convert the incoming PARM_DECL into a VAR_DECL before placing it in the appropriate scope; do not call define_decl(); adjust call to c_begin_compound_stmt(); use objc_object_type instead of objc_id_type. (build_next_objc_exception_stuff): Call create_field_decl() instead of create_builtin_decl(); construct type directly instead of calling groktypename(); use OBJC_VOID_AT_END to mark end of function parameters. (build_private_template): Adjust call to get_class_ivars(); build a type directly instead of via groktypename(). (build_protocol_template, build_method_prototype_list_template, build_method_prototype_template, build_category_template, build_selector_template, build_class_template, build_super_template, build_ivar_template, build_ivar_list_template, build_method_list_template, build_method_template): Call create_field_decl() instead of grokfield(). (objc_method_parm_type): Do not call groktypename(). (generate_descriptor_table): Call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(). (generate_method_descriptors, build_protocol_initializer, generate_dispatch_tables, build_category_initializer, build_shared_structure_initializer): Do not call groktypename(). (generate_protocols): Call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(); do not call groktypename(). (error_with_ivar): Remove last parameter. (check_ivars): Do not iterate ovar CLASS_RAW_IVARS lists in addition to CLASS_IVARS lists; adjust calls to error_with_ivar(). (generate_ivar_lists): Convert one of the initializer elements; do not call groktypename(). (get_arg_type_list, start_method_def, gen_method_def): Account for new representation of variable arguments and '...' in Objective-C methods; add Objective-C++ impedance matching code. (is_objc_type_qualifier): Remove function. (adjust_type_for_id_default): Simplify; there is no longer a need to wade through declspecs. (lookup_interface, start_class, continue_class, finish_class, start_method_def, start_protocol, build_method_decl, objc_add_method, add_instance_variable, build_ivar_reference, is_ivar, is_private, get_super_receiver, objc_build_finally_epilogue): Make into static functions. (receiver_is_class_object): Use new IS_CLASS() macro. (objc_build_message_expr): Tweak ObjC++ message argument handling; call objc_finish_message_expr() instead of finish_message_expr(). (finish_message_expr): Rename to objc_finish_message_expr(); use OBJC_TYPE_NAME and OBJC_SET_TYPE_NAME macros instead of TYPE_NAME. call gen_type_name() instead of gen_declaration(); call objc_is_id() instead of using IS_ID and IS_CLASS; Use objc_class_name instead of calling get_identifier("Class"); handle CONVERT_EXPRs in receiver. (build_objc_method_call, warn_with_method): Do not call groktypename(). (build_ivar_reference): Call convert() instead of clobbering in a type. (hash_init): Initialize string_htab hash table. (add_instance_variable): Simplify parameter list; do not call grokfield(); do not populate CLASS_IVARS list. (start_class): Check for the existence of super class, if one was specified. (continue_class): Use CLASS_RAW_IVARS rather than CLASS_IVARS; do not call build_class_template(); adjust call to get_class_ivars(); call build_decl(), pushdecl() and finish_decl() instead of define_decl(). (finish_class): Call build_decl(), pushdecl() and finish_decl() instead of define_decl(). (add_protocols): Use PROTOCOL_BINFO_ELTS for the tree vector size. (start_protocol): Do not call build_protocol_template(); use PROTOCOL_BINFO_ELTS for the tree vector size. (encode_type_qualifiers): Do not handle the 'const' qualifier here. (encode_pointer): Encode 'const char *' as 'r*', for backwards compatibility. (encode_array): Use HOST_WIDE_INT_PRINT_DEC instead of "%ld". (encode_type): Handle the 'const' qualifier here. (objc_parmlist): New global variable, sued by objc_push_parm and objc_get_parm_info(). (objc_push_parm, objc_get_parm_info): New functions. (objc_expr_last): Remove function. (synth_self_and_ucmd_args): For instance methods, use the instance type for 'self'; call objc_push_parm() instead of push_parm_decl(). (start_method_def): Do not call push_scope(), declare_parm_level(), pop_scope(), push_parm_decl(), store_parm_decls() or objc_expr_last(); just use objc_push_parm() and objc_get_parm_info(). (comp_method_with_proto): Remove function. (objc_types_are_equivalent): Strip away indirections before comparing underlying types. (comp_proto_with_proto): Do not call groktypename(); types are no longer in raw declspec format. (objc_start_function): New function. (really_start_method): Call comp_proto_with_proto() instead of comp_method_with_proto(); call objc_start_function() instead of hand-crafting a function declarator. (continue_method_def, objc_expand_function_end): Remove functions. (get_super_receiver): Call objc_get_current_scope() instead of get_current_scope(); reference 'super_class' field (instead of 'class'). (finish_method_def): Rename to objc_finish_method_definition() and add a function decl parameter; move method encoding call from objc_expand_function_end(). (is_complex_decl, adorn_decl, gen_declarator, gen_declspecs, gen_declaration_1): Remove functions. (tmpbuf, RAW_DECLSPEC): Remove. (gen_declaration): Remove second parameter; simplify to deal with TYPE_P nodes instead of raw declspecs. (gen_type_name, gen_type_name_0): New functions. (gen_method_decl): Remove second parameter; call gen_type_name() instead of gen_declaration_1(). (dump_interface): Adjust calls to gen_declaration() and gen_method_decl(); do not allocate a separate string buffer. (init_objc): Allocate a larger string buffer to accommodate dump_interface(); adjust call to build_module_descriptor(); add call to build_module_initializer_routine() for the GNU runtime. (generate_classref_translation_entry): Do not call start_decl(); call finish_var_decl() instead of finish_decl(); call convert() instead of build_c_cast(). * objc-act.h (CLASS_OWN_IVARS): Remove accessor. (CLASS_BINFO_ELTS): Reduce from 6 to 5, now that CLASS_OWN_IVARS is gone. (OCTI_GNU_INIT_DECL, GNU_INIT_decl): New. (OCTI_ELLIPSIS_NODE, objc_ellipsis_node): Remove. (OCTI_ID_ID, id_type, objc_id_id): Rename to OCTI_ID_NAME, objc_object_type and objc_object_name, respectively. (OCTI_CLS_REF, OCTI_CLASS_NAME, objc_class_reference, objc_class_name): New. (IS_CLASS): New macro. (IS_ID, IS_SUPER): Robustify. (OCTI_EXECCLASS_DECL, execclass_decl): New. (finish_file, start_class, continue_class, finish_class, start_method_def, continue_method_def, finish_method_def, start_protocol, finish_protocol, objc_build_throw_stmt, objc_build_try_catch_finally_stmt, objc_build_synchronized_prologue, objc_build_synchronized_epilogue, objc_build_try_prologue, objc_build_try_epilogue, objc_build_catch_stmt, objc_build_catch_epilogue, objc_build_finally_prologue, objc_build_finally_epilogue, is_ivar, is_private, is_public, add_instance_variable, objc_add_method, get_super_receiver, objc_clear_super_receiver, get_class_ivars_from_name, get_class_reference, get_static_reference, get_object_reference, build_message_expr, finish_message_expr, build_selector_expr, build_ivar_reference, build_keyword_decl, build_method_decl, build_protocol_expr, build_objc_string_object, objc_declare_alias, objc_declare_class, objc_declare_protocols, objc_comptypes, objc_check_decl, build_encode_expr): Remove prototypes. (imp_count, cat_count): Make GGC-aware. (OBJC_SET_TYPE_NAME): New macro. From-SVN: r87168
2004-09-08 02:49:44 +02:00
tree decl, initlist;
1992-01-18 00:15:38 +01:00
Makefile.in (c-parse.o): Depend on $(C_COMMON_H). [gcc/ChangeLog] 2004-09-07 Ziemowit Laski <zlaski@apple.com> * Makefile.in (c-parse.o): Depend on $(C_COMMON_H). * c-parse.in: Include c-common.h instead of objc-act.h. (ivar_decl_list, ivar_decls, ivar_decl, ivars, ivar_declarator, myparms, myparm): Remove %type declarations. (methodtype, optparms, OBJC_TYPE_QUAL, objc_quals, objc_qual, objc_typename, objc_try_catch_stmt, optellipsis): Add %type declarations. (objc_inherit_code, objc_public_flag): Remove. (typespec_nonreserved_nonattr): Call objc_get_protocol_qualified_type() instead of get_static_reference() and get_protocol_reference(). (stmt_nocomp): Call grokparm() on @catch parameter. (objcdef): Move semantic action to objc_finish_implementation(). (classdef): Move semantic action to objc_start_class_interface(), objc_continue_interface(), objc_finish_interface(), objc_start_class_implementation(), objc_continue_implementation(), objc_start_category_interface() and objc_start_category_implementation(). (protocoldef): Move semantic actions to objc_start_protocol() and objc_finish_interface(). (ivar_decl_list): Remove nonterminal. (visibility_spec): Move semantic actions to objc_set_visibility(). (ivar_decls): Remove assignment to $$. (ivar_decl): Rephrase in terms of component_decl; call objc_add_instance_variable(). (ivars, ivar_declarator): Remove nonterminals. (opt_semi): New nonterminal. (methodtype): Remove semantic actions. (methoddef): Move semantic actions to objc_set_method_type(), objc_start_method_definition() and objc_finish_method_definition(). (methodproto): Move semantic actions to objc_set_method_type() and objc_add_method_declaration(). (methoddecl): Use objc_typename instead of typename; move semantic actions to objc_build_method_signature(). (optarglist, myxdecls, mydecl, myparms, myparm): Remove nonterminals. (optparmlist): Express in terms of optparms and optellipsis. (optparms, optellipsis, objc_qual, objc_quals, objc_typename): New nonterminals. (keyworddecl): Use objc_typename instead of typename. (rid_to_yy): Mark RID_IN, RID_OUT, RID_INOUT, RID_BYCOPY, RID_BYREF and RID_ONEWAY as returning OBJC_TYPE_QUAL to yyparse(). [gcc/objc/ChangeLog] 2004-09-07 Ziemowit Laski <zlaski@apple.com> * Make-lang.in (objc/objc-parse.o): Depend on $(C_COMMON_H) instead of objc/objc-act.h. (objc/objc-act.o): Depend on $(HASHTAB_H). * objc-act.c: Include hashtab.h; in ObjC++ mode, include cp-tree.h and objcp-decl.h instead of c-tree.h. (build_module_descriptor, get_class_ivars, synth_id_with_class_suffix, error_with_ivar, gen_method_decl, gen_declaration, setup_string_decl, build_protocol_template): Adjust prototypes. (build_module_initializer_routine, start_class, continue_class, finish_class, start_method_def, objc_start_function, start_protocol, build_method_decl, objc_add_method, add_instance_variable, build_ivar_reference, is_ivar, is_private, get_super_receiver, build_selector_table_decl, objc_push_parm, objc_get_parm_info, gen_type_name, gen_type_name_0, start_var_decl, finish_var_decl, create_field_decl): New prototypes. (objc_expand_function_end, comp_method_with_proto, objc_expr_last, gen_declaration_1, gen_declarator, is_complex_decl, adorn_decl, define_decl, create_builtin_decl, gen_declspecs): Remove prototypes. (TYPE_ID): Rename to OBJECT_TYPEDEF_NAME. (CLASS_TYPEDEF_NAME): New. (TAG_EXECCLASS): Change from a global variable to a #define. (TAG_RETURN_STRUCT): Delete. (TAG_GNUINIT): New, holds '__objc_gnu_init' name. (objc_inherit_code, objc_public_flag): New, moved from c-parse.in. (string_descriptor): New struct. (string_htab): New hash table. (string_hash, string_eq): New prototypes. (generate_struct_by_value_array): Call create_field_decl() instead of create_builtin_decl(). (objc_init): Do not initialize objc_ellipsis_node or TAG_EXECCLASS; In ObjC++ mode, call cxx_init() instead of c_objc_common_init(). (objc_finish_file): In ObjC++, call instantiate_pending_templates() and cp_finish_file(). (define_decl, get_static_reference, get_protocol_reference, create_builtin_decl): Remove functions. (objc_start_class_interface, objc_start_category_interface, objc_start_protocol, objc_continue_interface, objc_finish_interface, objc_start_class_implementation, objc_start_category_implementation, objc_continue_implementation, objc_finish_implementation, objc_set_visibility, objc_set_method_type, objc_build_method_signature, objc_add_method_declaration, objc_start_method_definition, objc_add_instance_variable, objc_get_protocol_qualified_type, create_field_decl, start_var_decl, finish_var_decl): New functions. (setup_string_decl): Simplify since it is only called once. (synth_module_prologue): Call build_class_template(); predefine 'id' and 'Class' as typedefs; rename 'temp_type' to 'type'; disable debug hooks for duration of function; fix GNU runtime messenger signatures to correspond to reality; forward-declare '__objc_exec_class' for the GNU runtime; call build_selector_table_decl(); in ObjC++ mode, generate 'extern "C" { ... }' wrappers around synthesized declarations; call build_protocol_template() and build_category_template(). (string_hash, string_eq): New functions. (objc_build_string_object): Check metaclass correctness only once; store string literals in hash table. (objc_build_constructor): Do not convert initializer elements; adjust for ObjC++ impedance mismatch. (build_objc_symtab_template): Call create_field_decl() instead of create_builtin_decl(). (init_objc_symtab): Add missing conversion to initializer element. (build_metadata_decl): Call start_var_decl() instead of define_decl(). (generate_objc_symtab_decl): Do not call build_category_template(); call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(). (build_module_descriptor): Call create_field_decl() instead of grokfield(); call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(); always mark module descriptor as used; move GNU runtime-specific functionality to build_module_initializer_routine(). (build_module_initializer_routine): New function, broken off of build_module_descriptor(). (objc_static_init_needed_p, objc_generate_static_init_call): New functions. (generate_static_references, generate_strings, build_selector_translation_table, generate_descriptor_table, generate_ivars_list, generate_dispatch_table, generate_category): Call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(); build a type directly instead of via groktypename(). (build_selector_reference_decl, build_selector_table_decl, build_class_reference_decl, build_protocol_reference, generate_objc_image_info): Call start_var_decl() instead of build_decl(). (build_selector_reference): For GNU runtime, do not call build_selector_reference_decl(). (build_selector, build_typed_selector_reference): Always convert result to the selector type. (add_objc_string): Cast return value to 'char *'. (build_method_prototype_template, build_selector_template, build_method_template): Use actual selector type for fields pointing to selectors. (finish_objc): For GNU runtime, call build_module_initializer_routine() after build_module_descriptor(). (generate_protocol_list, generate_shared_structures): Call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(); build a type directly instead of via groktypename(). (synth_id_with_class_suffix): Return a string. (get_arg_type_list): For instance methods, use the instance type for 'self'; do not call groktypename_in_parm_context(). (build_objc_string_decl): Squash redeclaration errors in ObjC++. (objc_is_class_name): Use OBJC_TYPE_NAME instead of TYPE_NAME; handle RECORD_TYPEs in ObjC as well as ObjC++. (objc_is_id): New function. (objc_is_object_ptr): Return the canonical type node. (objc_get_class_ivars): Simplify using get_class_ivars(). (get_class_ivars): Remove second parameter; create a fresh copy of the ivar list for each call; do not check for existence of super class. (objc_eh_runtime_type): Mark #ifndef OBJCPLUS. (objc_init_exceptions): When using SJLJ-style exceptions, require the use of '-fobjc-exceptions' flag; do not require it for DWARF-style exceptions. (objc_build_exc_ptr, next_sjlj_build_try_catch_finally): Use objc_object_type instead of objc_id_type. (objc_begin_catch_clause): Convert the incoming PARM_DECL into a VAR_DECL before placing it in the appropriate scope; do not call define_decl(); adjust call to c_begin_compound_stmt(); use objc_object_type instead of objc_id_type. (build_next_objc_exception_stuff): Call create_field_decl() instead of create_builtin_decl(); construct type directly instead of calling groktypename(); use OBJC_VOID_AT_END to mark end of function parameters. (build_private_template): Adjust call to get_class_ivars(); build a type directly instead of via groktypename(). (build_protocol_template, build_method_prototype_list_template, build_method_prototype_template, build_category_template, build_selector_template, build_class_template, build_super_template, build_ivar_template, build_ivar_list_template, build_method_list_template, build_method_template): Call create_field_decl() instead of grokfield(). (objc_method_parm_type): Do not call groktypename(). (generate_descriptor_table): Call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(). (generate_method_descriptors, build_protocol_initializer, generate_dispatch_tables, build_category_initializer, build_shared_structure_initializer): Do not call groktypename(). (generate_protocols): Call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(); do not call groktypename(). (error_with_ivar): Remove last parameter. (check_ivars): Do not iterate ovar CLASS_RAW_IVARS lists in addition to CLASS_IVARS lists; adjust calls to error_with_ivar(). (generate_ivar_lists): Convert one of the initializer elements; do not call groktypename(). (get_arg_type_list, start_method_def, gen_method_def): Account for new representation of variable arguments and '...' in Objective-C methods; add Objective-C++ impedance matching code. (is_objc_type_qualifier): Remove function. (adjust_type_for_id_default): Simplify; there is no longer a need to wade through declspecs. (lookup_interface, start_class, continue_class, finish_class, start_method_def, start_protocol, build_method_decl, objc_add_method, add_instance_variable, build_ivar_reference, is_ivar, is_private, get_super_receiver, objc_build_finally_epilogue): Make into static functions. (receiver_is_class_object): Use new IS_CLASS() macro. (objc_build_message_expr): Tweak ObjC++ message argument handling; call objc_finish_message_expr() instead of finish_message_expr(). (finish_message_expr): Rename to objc_finish_message_expr(); use OBJC_TYPE_NAME and OBJC_SET_TYPE_NAME macros instead of TYPE_NAME. call gen_type_name() instead of gen_declaration(); call objc_is_id() instead of using IS_ID and IS_CLASS; Use objc_class_name instead of calling get_identifier("Class"); handle CONVERT_EXPRs in receiver. (build_objc_method_call, warn_with_method): Do not call groktypename(). (build_ivar_reference): Call convert() instead of clobbering in a type. (hash_init): Initialize string_htab hash table. (add_instance_variable): Simplify parameter list; do not call grokfield(); do not populate CLASS_IVARS list. (start_class): Check for the existence of super class, if one was specified. (continue_class): Use CLASS_RAW_IVARS rather than CLASS_IVARS; do not call build_class_template(); adjust call to get_class_ivars(); call build_decl(), pushdecl() and finish_decl() instead of define_decl(). (finish_class): Call build_decl(), pushdecl() and finish_decl() instead of define_decl(). (add_protocols): Use PROTOCOL_BINFO_ELTS for the tree vector size. (start_protocol): Do not call build_protocol_template(); use PROTOCOL_BINFO_ELTS for the tree vector size. (encode_type_qualifiers): Do not handle the 'const' qualifier here. (encode_pointer): Encode 'const char *' as 'r*', for backwards compatibility. (encode_array): Use HOST_WIDE_INT_PRINT_DEC instead of "%ld". (encode_type): Handle the 'const' qualifier here. (objc_parmlist): New global variable, sued by objc_push_parm and objc_get_parm_info(). (objc_push_parm, objc_get_parm_info): New functions. (objc_expr_last): Remove function. (synth_self_and_ucmd_args): For instance methods, use the instance type for 'self'; call objc_push_parm() instead of push_parm_decl(). (start_method_def): Do not call push_scope(), declare_parm_level(), pop_scope(), push_parm_decl(), store_parm_decls() or objc_expr_last(); just use objc_push_parm() and objc_get_parm_info(). (comp_method_with_proto): Remove function. (objc_types_are_equivalent): Strip away indirections before comparing underlying types. (comp_proto_with_proto): Do not call groktypename(); types are no longer in raw declspec format. (objc_start_function): New function. (really_start_method): Call comp_proto_with_proto() instead of comp_method_with_proto(); call objc_start_function() instead of hand-crafting a function declarator. (continue_method_def, objc_expand_function_end): Remove functions. (get_super_receiver): Call objc_get_current_scope() instead of get_current_scope(); reference 'super_class' field (instead of 'class'). (finish_method_def): Rename to objc_finish_method_definition() and add a function decl parameter; move method encoding call from objc_expand_function_end(). (is_complex_decl, adorn_decl, gen_declarator, gen_declspecs, gen_declaration_1): Remove functions. (tmpbuf, RAW_DECLSPEC): Remove. (gen_declaration): Remove second parameter; simplify to deal with TYPE_P nodes instead of raw declspecs. (gen_type_name, gen_type_name_0): New functions. (gen_method_decl): Remove second parameter; call gen_type_name() instead of gen_declaration_1(). (dump_interface): Adjust calls to gen_declaration() and gen_method_decl(); do not allocate a separate string buffer. (init_objc): Allocate a larger string buffer to accommodate dump_interface(); adjust call to build_module_descriptor(); add call to build_module_initializer_routine() for the GNU runtime. (generate_classref_translation_entry): Do not call start_decl(); call finish_var_decl() instead of finish_decl(); call convert() instead of build_c_cast(). * objc-act.h (CLASS_OWN_IVARS): Remove accessor. (CLASS_BINFO_ELTS): Reduce from 6 to 5, now that CLASS_OWN_IVARS is gone. (OCTI_GNU_INIT_DECL, GNU_INIT_decl): New. (OCTI_ELLIPSIS_NODE, objc_ellipsis_node): Remove. (OCTI_ID_ID, id_type, objc_id_id): Rename to OCTI_ID_NAME, objc_object_type and objc_object_name, respectively. (OCTI_CLS_REF, OCTI_CLASS_NAME, objc_class_reference, objc_class_name): New. (IS_CLASS): New macro. (IS_ID, IS_SUPER): Robustify. (OCTI_EXECCLASS_DECL, execclass_decl): New. (finish_file, start_class, continue_class, finish_class, start_method_def, continue_method_def, finish_method_def, start_protocol, finish_protocol, objc_build_throw_stmt, objc_build_try_catch_finally_stmt, objc_build_synchronized_prologue, objc_build_synchronized_epilogue, objc_build_try_prologue, objc_build_try_epilogue, objc_build_catch_stmt, objc_build_catch_epilogue, objc_build_finally_prologue, objc_build_finally_epilogue, is_ivar, is_private, is_public, add_instance_variable, objc_add_method, get_super_receiver, objc_clear_super_receiver, get_class_ivars_from_name, get_class_reference, get_static_reference, get_object_reference, build_message_expr, finish_message_expr, build_selector_expr, build_ivar_reference, build_keyword_decl, build_method_decl, build_protocol_expr, build_objc_string_object, objc_declare_alias, objc_declare_class, objc_declare_protocols, objc_comptypes, objc_check_decl, build_encode_expr): Remove prototypes. (imp_count, cat_count): Make GGC-aware. (OBJC_SET_TYPE_NAME): New macro. From-SVN: r87168
2004-09-08 02:49:44 +02:00
decl = start_var_decl (type, synth_id_with_class_suffix
(name, objc_implementation_context));
1992-01-18 00:15:38 +01:00
tree.h (build_int_cst): New, sign extended constant. * tree.h (build_int_cst): New, sign extended constant. (build_int_cstu): New, zero extended constant. (build_int_cst_wide): Renamed from build_int_cst. * tree.c (build_int_cst, build_int_cstu): New. (build_int_cst_wide): Renamed from build_int_cst. (make_vector_type, build_common_tree_nodes, build_common_tree_nodes_2): Adjust build_int_cst calls. * builtins.c (expand_builtin_prefetch, expand_builtin_strstr, expand_builtin_strpbrk, expand_builtin_fputs, build_string_literal, expand_builtin_printf, expand_builtin_sprintf, fold_builtin_classify_type, fold_builtin_lround, fold_builtin_bitop, fold_builtin_isascii, fold_builtin_toascii, fold_builtin_isdigit, simplify_builtin_strstr, simplify_builtin_strpbrk, fold_builtin_fputs, simplify_builtin_sprintf): Likewise. * c-common.c (start_fname_decls, fix_string_type, shorten_compare, DEF_ATTR_INT): Likewise. * c-decl.c (complete_array_type, check_bitfield_type_and_width): Likewise. * c-lex.c (interpret_integer, lex_charconst): Likewise. * c-parse.in (primary) <TYPES_COMPATIBLE_P> Likewise. * c-pretty-print.c (pp_c_integer_constant): Likewise. * c-typeck.c (really_start_incremental_init, push_init_level, set_nonincremental_init_from_string): Likewise. * calls.c (load_register_parameters): Likewise. convert.c (convert_to_pointer): Likewise. coverage.c (coverage_counter_alloc, tree_coverage_counter_ref, build_fn_info_type, build_fn_info_value, build_ctr_info_value, build_gcov_info): Likewise. * except.c (init_eh, assign_filter_values): Likewise. * expmed.c (store_fixed_bit_field, extract_bit_field, extract_fixed_bit_field, extract_split_bit_field, expand_shift, expand_mult_const, expand_mult_highpart_adjust, extract_high_half, expand_sdiv_pow2, expand_divmod, make_tree): Likewise. * expr.c (convert_move, emit_group_load, emit_group_store, expand_assignment, store_constructor, store_field, expand_expr_real_1, reduce_to_bit_field_precision): Likewise. fold-const.c (force_fit_type, int_const_binop, fold_convert_const, invert_truthvalue, optimize_bit_field_compare, decode_field_reference, all_ones_mask_p, constant_boolean_node, fold_div_compare, fold, fold_read_from_constant_string, fold_negate_const, fold_abs_const, fold_not_const, round_up, round_down): Likewise. * function.c (assign_parm_setup_block): Likewise. * stmt.c (shift_return_value, expand_case, estimate_case_costs): Likewise. * stor-layout.c (layout_type, initialize_sizetypes, set_min_and_max_values_for_integral_type): Likewise. * tree-chrec.c (chrec_fold_multiply_poly_poly, reset_evolution_in_loop): Likewise. * tree-chrec.h (build_polynomial_chrec): Likewise. * tree-complex.c (build_replicated_const): Likewise. * tree-eh.c (honor_protect_cleanup_actions, lower_try_finally_onedest, lower_try_finally_copy, lower_try_finally_switch): Likewise. * tree-mudflap.c (mf_build_string, mx_register_decls, mudflap_register_call, mudflap_enqueue_constant): Likewise. * tree-nested.c (get_trampoline_type, get_nl_goto_field): Likewise. * tree-pretty-print.c (dump_generic_node): Likewise. * tree-ssa-ccp.c (widen_bitfield, maybe_fold_offset_to_array_ref): Likewise. * tree-ssa-dom.c (simplify_rhs_and_lookup_avail_expr): Likewise. * tree-ssa-loop-niter.c (number_of_iterations_cond, loop_niter_by_eval, upper_bound_in_type, lower_bound_in_type): Likewise. * tree-ssa-loop-ivcanon.c (create_canonical_iv, canonicalize_loop_induction_variables): Likewise. * tree-vectorizer.c (vect_create_index_for_array_ref, vect_transform_loop_bound, vect_compute_data_ref_alignment): Likewise. * config/alpha/alpha.c (alpha_initialize_trampoline, alpha_va_start, alpha_gimplify_va_arg_1): Likewise. * config/arm/arm.c (arm_get_cookie_size): Likewise. * config/c4x/c4x.c (c4x_gimplify_va_arg_expr): Likewise. * config/i386/i386.c (ix86_va_start, ix86_gimplify_va_arg): Likewise. * config/ia64/ia64.c (ia64_gimplify_va_arg): Likewise. * config/mips/mips.c (mips_build_builtin_va_list, mips_va_start, mips_gimplify_va_arg_expr): Likewise. * config/pa/pa.c (hppa_gimplify_va_arg_expr): Likewise. * config/rs6000/rs6000.c (rs6000_va_start, rs6000_gimplify_va_arg, add_compiler_branch_island): Likewise. * config/s390/s390.c (s390_va_start): Likewise. * config/sh/sh.c (sh_va_start): Likewise. * config/stormy16/stormy16.c (xstormy16_expand_builtin_va_start): Likewise. * config/xtensa/xtensa.c (xtensa_va_start, xtensa_gimplify_va_arg_expr): Likewise. * objc/objc-act.c (build_objc_string_object, build_objc_symtab_template, init_def_list, init_objc_symtab, init_module_descriptor, generate_static_references, build_selector_translation_table, get_proto_encoding, build_typed_selector_reference, build_selector_reference, build_next_objc_exception_stuff, build_method_prototype_list_template, generate_descriptor_table, generate_protocols, build_protocol_initializer, build_ivar_list_template, build_method_list_template, build_ivar_list_initializer, generate_ivars_list, generate_dispatch_table, generate_protocol_list, build_category_initializer, build_shared_structure_initializer, generate_shared_structures, handle_impent, generate_objc_image_info): Likewise. 2004-04-25 Paolo Bonzini <bonzini@gnu.org> * cfglayout.c (duplicate_insn_chain): Remove references to NOTE_INSN_LOOP_VTOP and NOTE_INSN_LOOP_CONT. * cfgloop.h (struct loop): Remove fields vtop, cont and cont_dominator. * cfgrtl.c (rtl_delete_block): Remove handling of NOTE_INSN_LOOP_CONT. * final.c (final_scan_insn): Remove references to NOTE_INSN_LOOP_VTOP and NOTE_INSN_LOOP_CONT. * insn-notes.def (NOTE_INSN_LOOP_VTOP, NOTE_INSN_LOOP_CONT): Remove. * jump.c (squeeze_notes): Remove references to NOTE_INSN_LOOP_VTOP and NOTE_INSN_LOOP_CONT. * loop.c (scan_loops, find_and_verify_loops, for_each_insn_in_loop, check_dbra_loop, loop_dump_aux): Remove references to removed notes and fields. * reorg.c (mostly_true_jump): Do not rely on NOTE_INSN_LOOP_VTOPs. * unroll.c (unroll_loop, copy_loop_body, loop_iterations): Remove references to removed notes and fields. (subtract_reg_term, ujump_to_loop_cont): Remove. From-SVN: r86544
2004-08-25 11:52:54 +02:00
initlist = build_tree_list (NULL_TREE, build_int_cst (NULL_TREE, size));
initlist = tree_cons (NULL_TREE, list, initlist);
1992-01-18 00:15:38 +01:00
Makefile.in (c-parse.o): Depend on $(C_COMMON_H). [gcc/ChangeLog] 2004-09-07 Ziemowit Laski <zlaski@apple.com> * Makefile.in (c-parse.o): Depend on $(C_COMMON_H). * c-parse.in: Include c-common.h instead of objc-act.h. (ivar_decl_list, ivar_decls, ivar_decl, ivars, ivar_declarator, myparms, myparm): Remove %type declarations. (methodtype, optparms, OBJC_TYPE_QUAL, objc_quals, objc_qual, objc_typename, objc_try_catch_stmt, optellipsis): Add %type declarations. (objc_inherit_code, objc_public_flag): Remove. (typespec_nonreserved_nonattr): Call objc_get_protocol_qualified_type() instead of get_static_reference() and get_protocol_reference(). (stmt_nocomp): Call grokparm() on @catch parameter. (objcdef): Move semantic action to objc_finish_implementation(). (classdef): Move semantic action to objc_start_class_interface(), objc_continue_interface(), objc_finish_interface(), objc_start_class_implementation(), objc_continue_implementation(), objc_start_category_interface() and objc_start_category_implementation(). (protocoldef): Move semantic actions to objc_start_protocol() and objc_finish_interface(). (ivar_decl_list): Remove nonterminal. (visibility_spec): Move semantic actions to objc_set_visibility(). (ivar_decls): Remove assignment to $$. (ivar_decl): Rephrase in terms of component_decl; call objc_add_instance_variable(). (ivars, ivar_declarator): Remove nonterminals. (opt_semi): New nonterminal. (methodtype): Remove semantic actions. (methoddef): Move semantic actions to objc_set_method_type(), objc_start_method_definition() and objc_finish_method_definition(). (methodproto): Move semantic actions to objc_set_method_type() and objc_add_method_declaration(). (methoddecl): Use objc_typename instead of typename; move semantic actions to objc_build_method_signature(). (optarglist, myxdecls, mydecl, myparms, myparm): Remove nonterminals. (optparmlist): Express in terms of optparms and optellipsis. (optparms, optellipsis, objc_qual, objc_quals, objc_typename): New nonterminals. (keyworddecl): Use objc_typename instead of typename. (rid_to_yy): Mark RID_IN, RID_OUT, RID_INOUT, RID_BYCOPY, RID_BYREF and RID_ONEWAY as returning OBJC_TYPE_QUAL to yyparse(). [gcc/objc/ChangeLog] 2004-09-07 Ziemowit Laski <zlaski@apple.com> * Make-lang.in (objc/objc-parse.o): Depend on $(C_COMMON_H) instead of objc/objc-act.h. (objc/objc-act.o): Depend on $(HASHTAB_H). * objc-act.c: Include hashtab.h; in ObjC++ mode, include cp-tree.h and objcp-decl.h instead of c-tree.h. (build_module_descriptor, get_class_ivars, synth_id_with_class_suffix, error_with_ivar, gen_method_decl, gen_declaration, setup_string_decl, build_protocol_template): Adjust prototypes. (build_module_initializer_routine, start_class, continue_class, finish_class, start_method_def, objc_start_function, start_protocol, build_method_decl, objc_add_method, add_instance_variable, build_ivar_reference, is_ivar, is_private, get_super_receiver, build_selector_table_decl, objc_push_parm, objc_get_parm_info, gen_type_name, gen_type_name_0, start_var_decl, finish_var_decl, create_field_decl): New prototypes. (objc_expand_function_end, comp_method_with_proto, objc_expr_last, gen_declaration_1, gen_declarator, is_complex_decl, adorn_decl, define_decl, create_builtin_decl, gen_declspecs): Remove prototypes. (TYPE_ID): Rename to OBJECT_TYPEDEF_NAME. (CLASS_TYPEDEF_NAME): New. (TAG_EXECCLASS): Change from a global variable to a #define. (TAG_RETURN_STRUCT): Delete. (TAG_GNUINIT): New, holds '__objc_gnu_init' name. (objc_inherit_code, objc_public_flag): New, moved from c-parse.in. (string_descriptor): New struct. (string_htab): New hash table. (string_hash, string_eq): New prototypes. (generate_struct_by_value_array): Call create_field_decl() instead of create_builtin_decl(). (objc_init): Do not initialize objc_ellipsis_node or TAG_EXECCLASS; In ObjC++ mode, call cxx_init() instead of c_objc_common_init(). (objc_finish_file): In ObjC++, call instantiate_pending_templates() and cp_finish_file(). (define_decl, get_static_reference, get_protocol_reference, create_builtin_decl): Remove functions. (objc_start_class_interface, objc_start_category_interface, objc_start_protocol, objc_continue_interface, objc_finish_interface, objc_start_class_implementation, objc_start_category_implementation, objc_continue_implementation, objc_finish_implementation, objc_set_visibility, objc_set_method_type, objc_build_method_signature, objc_add_method_declaration, objc_start_method_definition, objc_add_instance_variable, objc_get_protocol_qualified_type, create_field_decl, start_var_decl, finish_var_decl): New functions. (setup_string_decl): Simplify since it is only called once. (synth_module_prologue): Call build_class_template(); predefine 'id' and 'Class' as typedefs; rename 'temp_type' to 'type'; disable debug hooks for duration of function; fix GNU runtime messenger signatures to correspond to reality; forward-declare '__objc_exec_class' for the GNU runtime; call build_selector_table_decl(); in ObjC++ mode, generate 'extern "C" { ... }' wrappers around synthesized declarations; call build_protocol_template() and build_category_template(). (string_hash, string_eq): New functions. (objc_build_string_object): Check metaclass correctness only once; store string literals in hash table. (objc_build_constructor): Do not convert initializer elements; adjust for ObjC++ impedance mismatch. (build_objc_symtab_template): Call create_field_decl() instead of create_builtin_decl(). (init_objc_symtab): Add missing conversion to initializer element. (build_metadata_decl): Call start_var_decl() instead of define_decl(). (generate_objc_symtab_decl): Do not call build_category_template(); call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(). (build_module_descriptor): Call create_field_decl() instead of grokfield(); call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(); always mark module descriptor as used; move GNU runtime-specific functionality to build_module_initializer_routine(). (build_module_initializer_routine): New function, broken off of build_module_descriptor(). (objc_static_init_needed_p, objc_generate_static_init_call): New functions. (generate_static_references, generate_strings, build_selector_translation_table, generate_descriptor_table, generate_ivars_list, generate_dispatch_table, generate_category): Call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(); build a type directly instead of via groktypename(). (build_selector_reference_decl, build_selector_table_decl, build_class_reference_decl, build_protocol_reference, generate_objc_image_info): Call start_var_decl() instead of build_decl(). (build_selector_reference): For GNU runtime, do not call build_selector_reference_decl(). (build_selector, build_typed_selector_reference): Always convert result to the selector type. (add_objc_string): Cast return value to 'char *'. (build_method_prototype_template, build_selector_template, build_method_template): Use actual selector type for fields pointing to selectors. (finish_objc): For GNU runtime, call build_module_initializer_routine() after build_module_descriptor(). (generate_protocol_list, generate_shared_structures): Call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(); build a type directly instead of via groktypename(). (synth_id_with_class_suffix): Return a string. (get_arg_type_list): For instance methods, use the instance type for 'self'; do not call groktypename_in_parm_context(). (build_objc_string_decl): Squash redeclaration errors in ObjC++. (objc_is_class_name): Use OBJC_TYPE_NAME instead of TYPE_NAME; handle RECORD_TYPEs in ObjC as well as ObjC++. (objc_is_id): New function. (objc_is_object_ptr): Return the canonical type node. (objc_get_class_ivars): Simplify using get_class_ivars(). (get_class_ivars): Remove second parameter; create a fresh copy of the ivar list for each call; do not check for existence of super class. (objc_eh_runtime_type): Mark #ifndef OBJCPLUS. (objc_init_exceptions): When using SJLJ-style exceptions, require the use of '-fobjc-exceptions' flag; do not require it for DWARF-style exceptions. (objc_build_exc_ptr, next_sjlj_build_try_catch_finally): Use objc_object_type instead of objc_id_type. (objc_begin_catch_clause): Convert the incoming PARM_DECL into a VAR_DECL before placing it in the appropriate scope; do not call define_decl(); adjust call to c_begin_compound_stmt(); use objc_object_type instead of objc_id_type. (build_next_objc_exception_stuff): Call create_field_decl() instead of create_builtin_decl(); construct type directly instead of calling groktypename(); use OBJC_VOID_AT_END to mark end of function parameters. (build_private_template): Adjust call to get_class_ivars(); build a type directly instead of via groktypename(). (build_protocol_template, build_method_prototype_list_template, build_method_prototype_template, build_category_template, build_selector_template, build_class_template, build_super_template, build_ivar_template, build_ivar_list_template, build_method_list_template, build_method_template): Call create_field_decl() instead of grokfield(). (objc_method_parm_type): Do not call groktypename(). (generate_descriptor_table): Call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(). (generate_method_descriptors, build_protocol_initializer, generate_dispatch_tables, build_category_initializer, build_shared_structure_initializer): Do not call groktypename(). (generate_protocols): Call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(); do not call groktypename(). (error_with_ivar): Remove last parameter. (check_ivars): Do not iterate ovar CLASS_RAW_IVARS lists in addition to CLASS_IVARS lists; adjust calls to error_with_ivar(). (generate_ivar_lists): Convert one of the initializer elements; do not call groktypename(). (get_arg_type_list, start_method_def, gen_method_def): Account for new representation of variable arguments and '...' in Objective-C methods; add Objective-C++ impedance matching code. (is_objc_type_qualifier): Remove function. (adjust_type_for_id_default): Simplify; there is no longer a need to wade through declspecs. (lookup_interface, start_class, continue_class, finish_class, start_method_def, start_protocol, build_method_decl, objc_add_method, add_instance_variable, build_ivar_reference, is_ivar, is_private, get_super_receiver, objc_build_finally_epilogue): Make into static functions. (receiver_is_class_object): Use new IS_CLASS() macro. (objc_build_message_expr): Tweak ObjC++ message argument handling; call objc_finish_message_expr() instead of finish_message_expr(). (finish_message_expr): Rename to objc_finish_message_expr(); use OBJC_TYPE_NAME and OBJC_SET_TYPE_NAME macros instead of TYPE_NAME. call gen_type_name() instead of gen_declaration(); call objc_is_id() instead of using IS_ID and IS_CLASS; Use objc_class_name instead of calling get_identifier("Class"); handle CONVERT_EXPRs in receiver. (build_objc_method_call, warn_with_method): Do not call groktypename(). (build_ivar_reference): Call convert() instead of clobbering in a type. (hash_init): Initialize string_htab hash table. (add_instance_variable): Simplify parameter list; do not call grokfield(); do not populate CLASS_IVARS list. (start_class): Check for the existence of super class, if one was specified. (continue_class): Use CLASS_RAW_IVARS rather than CLASS_IVARS; do not call build_class_template(); adjust call to get_class_ivars(); call build_decl(), pushdecl() and finish_decl() instead of define_decl(). (finish_class): Call build_decl(), pushdecl() and finish_decl() instead of define_decl(). (add_protocols): Use PROTOCOL_BINFO_ELTS for the tree vector size. (start_protocol): Do not call build_protocol_template(); use PROTOCOL_BINFO_ELTS for the tree vector size. (encode_type_qualifiers): Do not handle the 'const' qualifier here. (encode_pointer): Encode 'const char *' as 'r*', for backwards compatibility. (encode_array): Use HOST_WIDE_INT_PRINT_DEC instead of "%ld". (encode_type): Handle the 'const' qualifier here. (objc_parmlist): New global variable, sued by objc_push_parm and objc_get_parm_info(). (objc_push_parm, objc_get_parm_info): New functions. (objc_expr_last): Remove function. (synth_self_and_ucmd_args): For instance methods, use the instance type for 'self'; call objc_push_parm() instead of push_parm_decl(). (start_method_def): Do not call push_scope(), declare_parm_level(), pop_scope(), push_parm_decl(), store_parm_decls() or objc_expr_last(); just use objc_push_parm() and objc_get_parm_info(). (comp_method_with_proto): Remove function. (objc_types_are_equivalent): Strip away indirections before comparing underlying types. (comp_proto_with_proto): Do not call groktypename(); types are no longer in raw declspec format. (objc_start_function): New function. (really_start_method): Call comp_proto_with_proto() instead of comp_method_with_proto(); call objc_start_function() instead of hand-crafting a function declarator. (continue_method_def, objc_expand_function_end): Remove functions. (get_super_receiver): Call objc_get_current_scope() instead of get_current_scope(); reference 'super_class' field (instead of 'class'). (finish_method_def): Rename to objc_finish_method_definition() and add a function decl parameter; move method encoding call from objc_expand_function_end(). (is_complex_decl, adorn_decl, gen_declarator, gen_declspecs, gen_declaration_1): Remove functions. (tmpbuf, RAW_DECLSPEC): Remove. (gen_declaration): Remove second parameter; simplify to deal with TYPE_P nodes instead of raw declspecs. (gen_type_name, gen_type_name_0): New functions. (gen_method_decl): Remove second parameter; call gen_type_name() instead of gen_declaration_1(). (dump_interface): Adjust calls to gen_declaration() and gen_method_decl(); do not allocate a separate string buffer. (init_objc): Allocate a larger string buffer to accommodate dump_interface(); adjust call to build_module_descriptor(); add call to build_module_initializer_routine() for the GNU runtime. (generate_classref_translation_entry): Do not call start_decl(); call finish_var_decl() instead of finish_decl(); call convert() instead of build_c_cast(). * objc-act.h (CLASS_OWN_IVARS): Remove accessor. (CLASS_BINFO_ELTS): Reduce from 6 to 5, now that CLASS_OWN_IVARS is gone. (OCTI_GNU_INIT_DECL, GNU_INIT_decl): New. (OCTI_ELLIPSIS_NODE, objc_ellipsis_node): Remove. (OCTI_ID_ID, id_type, objc_id_id): Rename to OCTI_ID_NAME, objc_object_type and objc_object_name, respectively. (OCTI_CLS_REF, OCTI_CLASS_NAME, objc_class_reference, objc_class_name): New. (IS_CLASS): New macro. (IS_ID, IS_SUPER): Robustify. (OCTI_EXECCLASS_DECL, execclass_decl): New. (finish_file, start_class, continue_class, finish_class, start_method_def, continue_method_def, finish_method_def, start_protocol, finish_protocol, objc_build_throw_stmt, objc_build_try_catch_finally_stmt, objc_build_synchronized_prologue, objc_build_synchronized_epilogue, objc_build_try_prologue, objc_build_try_epilogue, objc_build_catch_stmt, objc_build_catch_epilogue, objc_build_finally_prologue, objc_build_finally_epilogue, is_ivar, is_private, is_public, add_instance_variable, objc_add_method, get_super_receiver, objc_clear_super_receiver, get_class_ivars_from_name, get_class_reference, get_static_reference, get_object_reference, build_message_expr, finish_message_expr, build_selector_expr, build_ivar_reference, build_keyword_decl, build_method_decl, build_protocol_expr, build_objc_string_object, objc_declare_alias, objc_declare_class, objc_declare_protocols, objc_comptypes, objc_check_decl, build_encode_expr): Remove prototypes. (imp_count, cat_count): Make GGC-aware. (OBJC_SET_TYPE_NAME): New macro. From-SVN: r87168
2004-09-08 02:49:44 +02:00
finish_var_decl (decl,
objc_build_constructor (TREE_TYPE (decl),
nreverse (initlist)));
1992-01-18 00:15:38 +01:00
return decl;
}
/* Count only the fields occurring in T. */
2006-05-28 03:01:12 +02:00
static int
ivar_list_length (tree t)
{
int count = 0;
for (; t; t = TREE_CHAIN (t))
if (TREE_CODE (t) == FIELD_DECL)
++count;
return count;
}
1992-01-18 00:15:38 +01:00
static void
generate_ivar_lists (void)
1992-01-18 00:15:38 +01:00
{
tree initlist, ivar_list_template, chain;
int size;
generating_instance_variables = 1;
1992-01-18 00:15:38 +01:00
if (!objc_ivar_template)
objc_ivar_template = build_ivar_template ();
/* Only generate class variables for the root of the inheritance
1996-07-04 00:07:53 +02:00
hierarchy since these will be the same for every class. */
1992-01-18 00:15:38 +01:00
if (CLASS_SUPER_NAME (implementation_template) == NULL_TREE
1992-01-18 00:15:38 +01:00
&& (chain = TYPE_FIELDS (objc_class_template)))
{
size = ivar_list_length (chain);
1992-01-18 00:15:38 +01:00
ivar_list_template = build_ivar_list_template (objc_ivar_template, size);
initlist = build_ivar_list_initializer (objc_ivar_template, chain);
1992-01-18 00:15:38 +01:00
UOBJC_CLASS_VARIABLES_decl
= generate_ivars_list (ivar_list_template, "_OBJC_CLASS_VARIABLES",
size, initlist);
1992-01-18 00:15:38 +01:00
}
else
UOBJC_CLASS_VARIABLES_decl = 0;
1992-01-18 00:15:38 +01:00
chain = CLASS_IVARS (implementation_template);
if (chain)
{
size = ivar_list_length (chain);
1992-01-18 00:15:38 +01:00
ivar_list_template = build_ivar_list_template (objc_ivar_template, size);
initlist = build_ivar_list_initializer (objc_ivar_template, chain);
1992-01-18 00:15:38 +01:00
UOBJC_INSTANCE_VARIABLES_decl
= generate_ivars_list (ivar_list_template, "_OBJC_INSTANCE_VARIABLES",
size, initlist);
1992-01-18 00:15:38 +01:00
}
else
UOBJC_INSTANCE_VARIABLES_decl = 0;
generating_instance_variables = 0;
1992-01-18 00:15:38 +01:00
}
static tree
build_dispatch_table_initializer (tree type, tree entries)
1992-01-18 00:15:38 +01:00
{
tree initlist = NULL_TREE;
1992-01-18 00:15:38 +01:00
do
{
tree elemlist = NULL_TREE;
elemlist = tree_cons (NULL_TREE,
build_selector (METHOD_SEL_NAME (entries)),
NULL_TREE);
1992-01-18 00:15:38 +01:00
/* Generate the method encoding if we don't have one already. */
if (! METHOD_ENCODING (entries))
METHOD_ENCODING (entries) =
encode_method_prototype (entries);
elemlist = tree_cons (NULL_TREE,
add_objc_string (METHOD_ENCODING (entries),
meth_var_types),
elemlist);
1992-01-18 00:15:38 +01:00
Makefile.in (c-parse.o): Depend on $(C_COMMON_H). [gcc/ChangeLog] 2004-09-07 Ziemowit Laski <zlaski@apple.com> * Makefile.in (c-parse.o): Depend on $(C_COMMON_H). * c-parse.in: Include c-common.h instead of objc-act.h. (ivar_decl_list, ivar_decls, ivar_decl, ivars, ivar_declarator, myparms, myparm): Remove %type declarations. (methodtype, optparms, OBJC_TYPE_QUAL, objc_quals, objc_qual, objc_typename, objc_try_catch_stmt, optellipsis): Add %type declarations. (objc_inherit_code, objc_public_flag): Remove. (typespec_nonreserved_nonattr): Call objc_get_protocol_qualified_type() instead of get_static_reference() and get_protocol_reference(). (stmt_nocomp): Call grokparm() on @catch parameter. (objcdef): Move semantic action to objc_finish_implementation(). (classdef): Move semantic action to objc_start_class_interface(), objc_continue_interface(), objc_finish_interface(), objc_start_class_implementation(), objc_continue_implementation(), objc_start_category_interface() and objc_start_category_implementation(). (protocoldef): Move semantic actions to objc_start_protocol() and objc_finish_interface(). (ivar_decl_list): Remove nonterminal. (visibility_spec): Move semantic actions to objc_set_visibility(). (ivar_decls): Remove assignment to $$. (ivar_decl): Rephrase in terms of component_decl; call objc_add_instance_variable(). (ivars, ivar_declarator): Remove nonterminals. (opt_semi): New nonterminal. (methodtype): Remove semantic actions. (methoddef): Move semantic actions to objc_set_method_type(), objc_start_method_definition() and objc_finish_method_definition(). (methodproto): Move semantic actions to objc_set_method_type() and objc_add_method_declaration(). (methoddecl): Use objc_typename instead of typename; move semantic actions to objc_build_method_signature(). (optarglist, myxdecls, mydecl, myparms, myparm): Remove nonterminals. (optparmlist): Express in terms of optparms and optellipsis. (optparms, optellipsis, objc_qual, objc_quals, objc_typename): New nonterminals. (keyworddecl): Use objc_typename instead of typename. (rid_to_yy): Mark RID_IN, RID_OUT, RID_INOUT, RID_BYCOPY, RID_BYREF and RID_ONEWAY as returning OBJC_TYPE_QUAL to yyparse(). [gcc/objc/ChangeLog] 2004-09-07 Ziemowit Laski <zlaski@apple.com> * Make-lang.in (objc/objc-parse.o): Depend on $(C_COMMON_H) instead of objc/objc-act.h. (objc/objc-act.o): Depend on $(HASHTAB_H). * objc-act.c: Include hashtab.h; in ObjC++ mode, include cp-tree.h and objcp-decl.h instead of c-tree.h. (build_module_descriptor, get_class_ivars, synth_id_with_class_suffix, error_with_ivar, gen_method_decl, gen_declaration, setup_string_decl, build_protocol_template): Adjust prototypes. (build_module_initializer_routine, start_class, continue_class, finish_class, start_method_def, objc_start_function, start_protocol, build_method_decl, objc_add_method, add_instance_variable, build_ivar_reference, is_ivar, is_private, get_super_receiver, build_selector_table_decl, objc_push_parm, objc_get_parm_info, gen_type_name, gen_type_name_0, start_var_decl, finish_var_decl, create_field_decl): New prototypes. (objc_expand_function_end, comp_method_with_proto, objc_expr_last, gen_declaration_1, gen_declarator, is_complex_decl, adorn_decl, define_decl, create_builtin_decl, gen_declspecs): Remove prototypes. (TYPE_ID): Rename to OBJECT_TYPEDEF_NAME. (CLASS_TYPEDEF_NAME): New. (TAG_EXECCLASS): Change from a global variable to a #define. (TAG_RETURN_STRUCT): Delete. (TAG_GNUINIT): New, holds '__objc_gnu_init' name. (objc_inherit_code, objc_public_flag): New, moved from c-parse.in. (string_descriptor): New struct. (string_htab): New hash table. (string_hash, string_eq): New prototypes. (generate_struct_by_value_array): Call create_field_decl() instead of create_builtin_decl(). (objc_init): Do not initialize objc_ellipsis_node or TAG_EXECCLASS; In ObjC++ mode, call cxx_init() instead of c_objc_common_init(). (objc_finish_file): In ObjC++, call instantiate_pending_templates() and cp_finish_file(). (define_decl, get_static_reference, get_protocol_reference, create_builtin_decl): Remove functions. (objc_start_class_interface, objc_start_category_interface, objc_start_protocol, objc_continue_interface, objc_finish_interface, objc_start_class_implementation, objc_start_category_implementation, objc_continue_implementation, objc_finish_implementation, objc_set_visibility, objc_set_method_type, objc_build_method_signature, objc_add_method_declaration, objc_start_method_definition, objc_add_instance_variable, objc_get_protocol_qualified_type, create_field_decl, start_var_decl, finish_var_decl): New functions. (setup_string_decl): Simplify since it is only called once. (synth_module_prologue): Call build_class_template(); predefine 'id' and 'Class' as typedefs; rename 'temp_type' to 'type'; disable debug hooks for duration of function; fix GNU runtime messenger signatures to correspond to reality; forward-declare '__objc_exec_class' for the GNU runtime; call build_selector_table_decl(); in ObjC++ mode, generate 'extern "C" { ... }' wrappers around synthesized declarations; call build_protocol_template() and build_category_template(). (string_hash, string_eq): New functions. (objc_build_string_object): Check metaclass correctness only once; store string literals in hash table. (objc_build_constructor): Do not convert initializer elements; adjust for ObjC++ impedance mismatch. (build_objc_symtab_template): Call create_field_decl() instead of create_builtin_decl(). (init_objc_symtab): Add missing conversion to initializer element. (build_metadata_decl): Call start_var_decl() instead of define_decl(). (generate_objc_symtab_decl): Do not call build_category_template(); call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(). (build_module_descriptor): Call create_field_decl() instead of grokfield(); call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(); always mark module descriptor as used; move GNU runtime-specific functionality to build_module_initializer_routine(). (build_module_initializer_routine): New function, broken off of build_module_descriptor(). (objc_static_init_needed_p, objc_generate_static_init_call): New functions. (generate_static_references, generate_strings, build_selector_translation_table, generate_descriptor_table, generate_ivars_list, generate_dispatch_table, generate_category): Call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(); build a type directly instead of via groktypename(). (build_selector_reference_decl, build_selector_table_decl, build_class_reference_decl, build_protocol_reference, generate_objc_image_info): Call start_var_decl() instead of build_decl(). (build_selector_reference): For GNU runtime, do not call build_selector_reference_decl(). (build_selector, build_typed_selector_reference): Always convert result to the selector type. (add_objc_string): Cast return value to 'char *'. (build_method_prototype_template, build_selector_template, build_method_template): Use actual selector type for fields pointing to selectors. (finish_objc): For GNU runtime, call build_module_initializer_routine() after build_module_descriptor(). (generate_protocol_list, generate_shared_structures): Call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(); build a type directly instead of via groktypename(). (synth_id_with_class_suffix): Return a string. (get_arg_type_list): For instance methods, use the instance type for 'self'; do not call groktypename_in_parm_context(). (build_objc_string_decl): Squash redeclaration errors in ObjC++. (objc_is_class_name): Use OBJC_TYPE_NAME instead of TYPE_NAME; handle RECORD_TYPEs in ObjC as well as ObjC++. (objc_is_id): New function. (objc_is_object_ptr): Return the canonical type node. (objc_get_class_ivars): Simplify using get_class_ivars(). (get_class_ivars): Remove second parameter; create a fresh copy of the ivar list for each call; do not check for existence of super class. (objc_eh_runtime_type): Mark #ifndef OBJCPLUS. (objc_init_exceptions): When using SJLJ-style exceptions, require the use of '-fobjc-exceptions' flag; do not require it for DWARF-style exceptions. (objc_build_exc_ptr, next_sjlj_build_try_catch_finally): Use objc_object_type instead of objc_id_type. (objc_begin_catch_clause): Convert the incoming PARM_DECL into a VAR_DECL before placing it in the appropriate scope; do not call define_decl(); adjust call to c_begin_compound_stmt(); use objc_object_type instead of objc_id_type. (build_next_objc_exception_stuff): Call create_field_decl() instead of create_builtin_decl(); construct type directly instead of calling groktypename(); use OBJC_VOID_AT_END to mark end of function parameters. (build_private_template): Adjust call to get_class_ivars(); build a type directly instead of via groktypename(). (build_protocol_template, build_method_prototype_list_template, build_method_prototype_template, build_category_template, build_selector_template, build_class_template, build_super_template, build_ivar_template, build_ivar_list_template, build_method_list_template, build_method_template): Call create_field_decl() instead of grokfield(). (objc_method_parm_type): Do not call groktypename(). (generate_descriptor_table): Call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(). (generate_method_descriptors, build_protocol_initializer, generate_dispatch_tables, build_category_initializer, build_shared_structure_initializer): Do not call groktypename(). (generate_protocols): Call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(); do not call groktypename(). (error_with_ivar): Remove last parameter. (check_ivars): Do not iterate ovar CLASS_RAW_IVARS lists in addition to CLASS_IVARS lists; adjust calls to error_with_ivar(). (generate_ivar_lists): Convert one of the initializer elements; do not call groktypename(). (get_arg_type_list, start_method_def, gen_method_def): Account for new representation of variable arguments and '...' in Objective-C methods; add Objective-C++ impedance matching code. (is_objc_type_qualifier): Remove function. (adjust_type_for_id_default): Simplify; there is no longer a need to wade through declspecs. (lookup_interface, start_class, continue_class, finish_class, start_method_def, start_protocol, build_method_decl, objc_add_method, add_instance_variable, build_ivar_reference, is_ivar, is_private, get_super_receiver, objc_build_finally_epilogue): Make into static functions. (receiver_is_class_object): Use new IS_CLASS() macro. (objc_build_message_expr): Tweak ObjC++ message argument handling; call objc_finish_message_expr() instead of finish_message_expr(). (finish_message_expr): Rename to objc_finish_message_expr(); use OBJC_TYPE_NAME and OBJC_SET_TYPE_NAME macros instead of TYPE_NAME. call gen_type_name() instead of gen_declaration(); call objc_is_id() instead of using IS_ID and IS_CLASS; Use objc_class_name instead of calling get_identifier("Class"); handle CONVERT_EXPRs in receiver. (build_objc_method_call, warn_with_method): Do not call groktypename(). (build_ivar_reference): Call convert() instead of clobbering in a type. (hash_init): Initialize string_htab hash table. (add_instance_variable): Simplify parameter list; do not call grokfield(); do not populate CLASS_IVARS list. (start_class): Check for the existence of super class, if one was specified. (continue_class): Use CLASS_RAW_IVARS rather than CLASS_IVARS; do not call build_class_template(); adjust call to get_class_ivars(); call build_decl(), pushdecl() and finish_decl() instead of define_decl(). (finish_class): Call build_decl(), pushdecl() and finish_decl() instead of define_decl(). (add_protocols): Use PROTOCOL_BINFO_ELTS for the tree vector size. (start_protocol): Do not call build_protocol_template(); use PROTOCOL_BINFO_ELTS for the tree vector size. (encode_type_qualifiers): Do not handle the 'const' qualifier here. (encode_pointer): Encode 'const char *' as 'r*', for backwards compatibility. (encode_array): Use HOST_WIDE_INT_PRINT_DEC instead of "%ld". (encode_type): Handle the 'const' qualifier here. (objc_parmlist): New global variable, sued by objc_push_parm and objc_get_parm_info(). (objc_push_parm, objc_get_parm_info): New functions. (objc_expr_last): Remove function. (synth_self_and_ucmd_args): For instance methods, use the instance type for 'self'; call objc_push_parm() instead of push_parm_decl(). (start_method_def): Do not call push_scope(), declare_parm_level(), pop_scope(), push_parm_decl(), store_parm_decls() or objc_expr_last(); just use objc_push_parm() and objc_get_parm_info(). (comp_method_with_proto): Remove function. (objc_types_are_equivalent): Strip away indirections before comparing underlying types. (comp_proto_with_proto): Do not call groktypename(); types are no longer in raw declspec format. (objc_start_function): New function. (really_start_method): Call comp_proto_with_proto() instead of comp_method_with_proto(); call objc_start_function() instead of hand-crafting a function declarator. (continue_method_def, objc_expand_function_end): Remove functions. (get_super_receiver): Call objc_get_current_scope() instead of get_current_scope(); reference 'super_class' field (instead of 'class'). (finish_method_def): Rename to objc_finish_method_definition() and add a function decl parameter; move method encoding call from objc_expand_function_end(). (is_complex_decl, adorn_decl, gen_declarator, gen_declspecs, gen_declaration_1): Remove functions. (tmpbuf, RAW_DECLSPEC): Remove. (gen_declaration): Remove second parameter; simplify to deal with TYPE_P nodes instead of raw declspecs. (gen_type_name, gen_type_name_0): New functions. (gen_method_decl): Remove second parameter; call gen_type_name() instead of gen_declaration_1(). (dump_interface): Adjust calls to gen_declaration() and gen_method_decl(); do not allocate a separate string buffer. (init_objc): Allocate a larger string buffer to accommodate dump_interface(); adjust call to build_module_descriptor(); add call to build_module_initializer_routine() for the GNU runtime. (generate_classref_translation_entry): Do not call start_decl(); call finish_var_decl() instead of finish_decl(); call convert() instead of build_c_cast(). * objc-act.h (CLASS_OWN_IVARS): Remove accessor. (CLASS_BINFO_ELTS): Reduce from 6 to 5, now that CLASS_OWN_IVARS is gone. (OCTI_GNU_INIT_DECL, GNU_INIT_decl): New. (OCTI_ELLIPSIS_NODE, objc_ellipsis_node): Remove. (OCTI_ID_ID, id_type, objc_id_id): Rename to OCTI_ID_NAME, objc_object_type and objc_object_name, respectively. (OCTI_CLS_REF, OCTI_CLASS_NAME, objc_class_reference, objc_class_name): New. (IS_CLASS): New macro. (IS_ID, IS_SUPER): Robustify. (OCTI_EXECCLASS_DECL, execclass_decl): New. (finish_file, start_class, continue_class, finish_class, start_method_def, continue_method_def, finish_method_def, start_protocol, finish_protocol, objc_build_throw_stmt, objc_build_try_catch_finally_stmt, objc_build_synchronized_prologue, objc_build_synchronized_epilogue, objc_build_try_prologue, objc_build_try_epilogue, objc_build_catch_stmt, objc_build_catch_epilogue, objc_build_finally_prologue, objc_build_finally_epilogue, is_ivar, is_private, is_public, add_instance_variable, objc_add_method, get_super_receiver, objc_clear_super_receiver, get_class_ivars_from_name, get_class_reference, get_static_reference, get_object_reference, build_message_expr, finish_message_expr, build_selector_expr, build_ivar_reference, build_keyword_decl, build_method_decl, build_protocol_expr, build_objc_string_object, objc_declare_alias, objc_declare_class, objc_declare_protocols, objc_comptypes, objc_check_decl, build_encode_expr): Remove prototypes. (imp_count, cat_count): Make GGC-aware. (OBJC_SET_TYPE_NAME): New macro. From-SVN: r87168
2004-09-08 02:49:44 +02:00
elemlist
= tree_cons (NULL_TREE,
convert (ptr_type_node,
Makefile.in (c-parse.o): Depend on $(C_COMMON_H). [gcc/ChangeLog] 2004-09-07 Ziemowit Laski <zlaski@apple.com> * Makefile.in (c-parse.o): Depend on $(C_COMMON_H). * c-parse.in: Include c-common.h instead of objc-act.h. (ivar_decl_list, ivar_decls, ivar_decl, ivars, ivar_declarator, myparms, myparm): Remove %type declarations. (methodtype, optparms, OBJC_TYPE_QUAL, objc_quals, objc_qual, objc_typename, objc_try_catch_stmt, optellipsis): Add %type declarations. (objc_inherit_code, objc_public_flag): Remove. (typespec_nonreserved_nonattr): Call objc_get_protocol_qualified_type() instead of get_static_reference() and get_protocol_reference(). (stmt_nocomp): Call grokparm() on @catch parameter. (objcdef): Move semantic action to objc_finish_implementation(). (classdef): Move semantic action to objc_start_class_interface(), objc_continue_interface(), objc_finish_interface(), objc_start_class_implementation(), objc_continue_implementation(), objc_start_category_interface() and objc_start_category_implementation(). (protocoldef): Move semantic actions to objc_start_protocol() and objc_finish_interface(). (ivar_decl_list): Remove nonterminal. (visibility_spec): Move semantic actions to objc_set_visibility(). (ivar_decls): Remove assignment to $$. (ivar_decl): Rephrase in terms of component_decl; call objc_add_instance_variable(). (ivars, ivar_declarator): Remove nonterminals. (opt_semi): New nonterminal. (methodtype): Remove semantic actions. (methoddef): Move semantic actions to objc_set_method_type(), objc_start_method_definition() and objc_finish_method_definition(). (methodproto): Move semantic actions to objc_set_method_type() and objc_add_method_declaration(). (methoddecl): Use objc_typename instead of typename; move semantic actions to objc_build_method_signature(). (optarglist, myxdecls, mydecl, myparms, myparm): Remove nonterminals. (optparmlist): Express in terms of optparms and optellipsis. (optparms, optellipsis, objc_qual, objc_quals, objc_typename): New nonterminals. (keyworddecl): Use objc_typename instead of typename. (rid_to_yy): Mark RID_IN, RID_OUT, RID_INOUT, RID_BYCOPY, RID_BYREF and RID_ONEWAY as returning OBJC_TYPE_QUAL to yyparse(). [gcc/objc/ChangeLog] 2004-09-07 Ziemowit Laski <zlaski@apple.com> * Make-lang.in (objc/objc-parse.o): Depend on $(C_COMMON_H) instead of objc/objc-act.h. (objc/objc-act.o): Depend on $(HASHTAB_H). * objc-act.c: Include hashtab.h; in ObjC++ mode, include cp-tree.h and objcp-decl.h instead of c-tree.h. (build_module_descriptor, get_class_ivars, synth_id_with_class_suffix, error_with_ivar, gen_method_decl, gen_declaration, setup_string_decl, build_protocol_template): Adjust prototypes. (build_module_initializer_routine, start_class, continue_class, finish_class, start_method_def, objc_start_function, start_protocol, build_method_decl, objc_add_method, add_instance_variable, build_ivar_reference, is_ivar, is_private, get_super_receiver, build_selector_table_decl, objc_push_parm, objc_get_parm_info, gen_type_name, gen_type_name_0, start_var_decl, finish_var_decl, create_field_decl): New prototypes. (objc_expand_function_end, comp_method_with_proto, objc_expr_last, gen_declaration_1, gen_declarator, is_complex_decl, adorn_decl, define_decl, create_builtin_decl, gen_declspecs): Remove prototypes. (TYPE_ID): Rename to OBJECT_TYPEDEF_NAME. (CLASS_TYPEDEF_NAME): New. (TAG_EXECCLASS): Change from a global variable to a #define. (TAG_RETURN_STRUCT): Delete. (TAG_GNUINIT): New, holds '__objc_gnu_init' name. (objc_inherit_code, objc_public_flag): New, moved from c-parse.in. (string_descriptor): New struct. (string_htab): New hash table. (string_hash, string_eq): New prototypes. (generate_struct_by_value_array): Call create_field_decl() instead of create_builtin_decl(). (objc_init): Do not initialize objc_ellipsis_node or TAG_EXECCLASS; In ObjC++ mode, call cxx_init() instead of c_objc_common_init(). (objc_finish_file): In ObjC++, call instantiate_pending_templates() and cp_finish_file(). (define_decl, get_static_reference, get_protocol_reference, create_builtin_decl): Remove functions. (objc_start_class_interface, objc_start_category_interface, objc_start_protocol, objc_continue_interface, objc_finish_interface, objc_start_class_implementation, objc_start_category_implementation, objc_continue_implementation, objc_finish_implementation, objc_set_visibility, objc_set_method_type, objc_build_method_signature, objc_add_method_declaration, objc_start_method_definition, objc_add_instance_variable, objc_get_protocol_qualified_type, create_field_decl, start_var_decl, finish_var_decl): New functions. (setup_string_decl): Simplify since it is only called once. (synth_module_prologue): Call build_class_template(); predefine 'id' and 'Class' as typedefs; rename 'temp_type' to 'type'; disable debug hooks for duration of function; fix GNU runtime messenger signatures to correspond to reality; forward-declare '__objc_exec_class' for the GNU runtime; call build_selector_table_decl(); in ObjC++ mode, generate 'extern "C" { ... }' wrappers around synthesized declarations; call build_protocol_template() and build_category_template(). (string_hash, string_eq): New functions. (objc_build_string_object): Check metaclass correctness only once; store string literals in hash table. (objc_build_constructor): Do not convert initializer elements; adjust for ObjC++ impedance mismatch. (build_objc_symtab_template): Call create_field_decl() instead of create_builtin_decl(). (init_objc_symtab): Add missing conversion to initializer element. (build_metadata_decl): Call start_var_decl() instead of define_decl(). (generate_objc_symtab_decl): Do not call build_category_template(); call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(). (build_module_descriptor): Call create_field_decl() instead of grokfield(); call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(); always mark module descriptor as used; move GNU runtime-specific functionality to build_module_initializer_routine(). (build_module_initializer_routine): New function, broken off of build_module_descriptor(). (objc_static_init_needed_p, objc_generate_static_init_call): New functions. (generate_static_references, generate_strings, build_selector_translation_table, generate_descriptor_table, generate_ivars_list, generate_dispatch_table, generate_category): Call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(); build a type directly instead of via groktypename(). (build_selector_reference_decl, build_selector_table_decl, build_class_reference_decl, build_protocol_reference, generate_objc_image_info): Call start_var_decl() instead of build_decl(). (build_selector_reference): For GNU runtime, do not call build_selector_reference_decl(). (build_selector, build_typed_selector_reference): Always convert result to the selector type. (add_objc_string): Cast return value to 'char *'. (build_method_prototype_template, build_selector_template, build_method_template): Use actual selector type for fields pointing to selectors. (finish_objc): For GNU runtime, call build_module_initializer_routine() after build_module_descriptor(). (generate_protocol_list, generate_shared_structures): Call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(); build a type directly instead of via groktypename(). (synth_id_with_class_suffix): Return a string. (get_arg_type_list): For instance methods, use the instance type for 'self'; do not call groktypename_in_parm_context(). (build_objc_string_decl): Squash redeclaration errors in ObjC++. (objc_is_class_name): Use OBJC_TYPE_NAME instead of TYPE_NAME; handle RECORD_TYPEs in ObjC as well as ObjC++. (objc_is_id): New function. (objc_is_object_ptr): Return the canonical type node. (objc_get_class_ivars): Simplify using get_class_ivars(). (get_class_ivars): Remove second parameter; create a fresh copy of the ivar list for each call; do not check for existence of super class. (objc_eh_runtime_type): Mark #ifndef OBJCPLUS. (objc_init_exceptions): When using SJLJ-style exceptions, require the use of '-fobjc-exceptions' flag; do not require it for DWARF-style exceptions. (objc_build_exc_ptr, next_sjlj_build_try_catch_finally): Use objc_object_type instead of objc_id_type. (objc_begin_catch_clause): Convert the incoming PARM_DECL into a VAR_DECL before placing it in the appropriate scope; do not call define_decl(); adjust call to c_begin_compound_stmt(); use objc_object_type instead of objc_id_type. (build_next_objc_exception_stuff): Call create_field_decl() instead of create_builtin_decl(); construct type directly instead of calling groktypename(); use OBJC_VOID_AT_END to mark end of function parameters. (build_private_template): Adjust call to get_class_ivars(); build a type directly instead of via groktypename(). (build_protocol_template, build_method_prototype_list_template, build_method_prototype_template, build_category_template, build_selector_template, build_class_template, build_super_template, build_ivar_template, build_ivar_list_template, build_method_list_template, build_method_template): Call create_field_decl() instead of grokfield(). (objc_method_parm_type): Do not call groktypename(). (generate_descriptor_table): Call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(). (generate_method_descriptors, build_protocol_initializer, generate_dispatch_tables, build_category_initializer, build_shared_structure_initializer): Do not call groktypename(). (generate_protocols): Call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(); do not call groktypename(). (error_with_ivar): Remove last parameter. (check_ivars): Do not iterate ovar CLASS_RAW_IVARS lists in addition to CLASS_IVARS lists; adjust calls to error_with_ivar(). (generate_ivar_lists): Convert one of the initializer elements; do not call groktypename(). (get_arg_type_list, start_method_def, gen_method_def): Account for new representation of variable arguments and '...' in Objective-C methods; add Objective-C++ impedance matching code. (is_objc_type_qualifier): Remove function. (adjust_type_for_id_default): Simplify; there is no longer a need to wade through declspecs. (lookup_interface, start_class, continue_class, finish_class, start_method_def, start_protocol, build_method_decl, objc_add_method, add_instance_variable, build_ivar_reference, is_ivar, is_private, get_super_receiver, objc_build_finally_epilogue): Make into static functions. (receiver_is_class_object): Use new IS_CLASS() macro. (objc_build_message_expr): Tweak ObjC++ message argument handling; call objc_finish_message_expr() instead of finish_message_expr(). (finish_message_expr): Rename to objc_finish_message_expr(); use OBJC_TYPE_NAME and OBJC_SET_TYPE_NAME macros instead of TYPE_NAME. call gen_type_name() instead of gen_declaration(); call objc_is_id() instead of using IS_ID and IS_CLASS; Use objc_class_name instead of calling get_identifier("Class"); handle CONVERT_EXPRs in receiver. (build_objc_method_call, warn_with_method): Do not call groktypename(). (build_ivar_reference): Call convert() instead of clobbering in a type. (hash_init): Initialize string_htab hash table. (add_instance_variable): Simplify parameter list; do not call grokfield(); do not populate CLASS_IVARS list. (start_class): Check for the existence of super class, if one was specified. (continue_class): Use CLASS_RAW_IVARS rather than CLASS_IVARS; do not call build_class_template(); adjust call to get_class_ivars(); call build_decl(), pushdecl() and finish_decl() instead of define_decl(). (finish_class): Call build_decl(), pushdecl() and finish_decl() instead of define_decl(). (add_protocols): Use PROTOCOL_BINFO_ELTS for the tree vector size. (start_protocol): Do not call build_protocol_template(); use PROTOCOL_BINFO_ELTS for the tree vector size. (encode_type_qualifiers): Do not handle the 'const' qualifier here. (encode_pointer): Encode 'const char *' as 'r*', for backwards compatibility. (encode_array): Use HOST_WIDE_INT_PRINT_DEC instead of "%ld". (encode_type): Handle the 'const' qualifier here. (objc_parmlist): New global variable, sued by objc_push_parm and objc_get_parm_info(). (objc_push_parm, objc_get_parm_info): New functions. (objc_expr_last): Remove function. (synth_self_and_ucmd_args): For instance methods, use the instance type for 'self'; call objc_push_parm() instead of push_parm_decl(). (start_method_def): Do not call push_scope(), declare_parm_level(), pop_scope(), push_parm_decl(), store_parm_decls() or objc_expr_last(); just use objc_push_parm() and objc_get_parm_info(). (comp_method_with_proto): Remove function. (objc_types_are_equivalent): Strip away indirections before comparing underlying types. (comp_proto_with_proto): Do not call groktypename(); types are no longer in raw declspec format. (objc_start_function): New function. (really_start_method): Call comp_proto_with_proto() instead of comp_method_with_proto(); call objc_start_function() instead of hand-crafting a function declarator. (continue_method_def, objc_expand_function_end): Remove functions. (get_super_receiver): Call objc_get_current_scope() instead of get_current_scope(); reference 'super_class' field (instead of 'class'). (finish_method_def): Rename to objc_finish_method_definition() and add a function decl parameter; move method encoding call from objc_expand_function_end(). (is_complex_decl, adorn_decl, gen_declarator, gen_declspecs, gen_declaration_1): Remove functions. (tmpbuf, RAW_DECLSPEC): Remove. (gen_declaration): Remove second parameter; simplify to deal with TYPE_P nodes instead of raw declspecs. (gen_type_name, gen_type_name_0): New functions. (gen_method_decl): Remove second parameter; call gen_type_name() instead of gen_declaration_1(). (dump_interface): Adjust calls to gen_declaration() and gen_method_decl(); do not allocate a separate string buffer. (init_objc): Allocate a larger string buffer to accommodate dump_interface(); adjust call to build_module_descriptor(); add call to build_module_initializer_routine() for the GNU runtime. (generate_classref_translation_entry): Do not call start_decl(); call finish_var_decl() instead of finish_decl(); call convert() instead of build_c_cast(). * objc-act.h (CLASS_OWN_IVARS): Remove accessor. (CLASS_BINFO_ELTS): Reduce from 6 to 5, now that CLASS_OWN_IVARS is gone. (OCTI_GNU_INIT_DECL, GNU_INIT_decl): New. (OCTI_ELLIPSIS_NODE, objc_ellipsis_node): Remove. (OCTI_ID_ID, id_type, objc_id_id): Rename to OCTI_ID_NAME, objc_object_type and objc_object_name, respectively. (OCTI_CLS_REF, OCTI_CLASS_NAME, objc_class_reference, objc_class_name): New. (IS_CLASS): New macro. (IS_ID, IS_SUPER): Robustify. (OCTI_EXECCLASS_DECL, execclass_decl): New. (finish_file, start_class, continue_class, finish_class, start_method_def, continue_method_def, finish_method_def, start_protocol, finish_protocol, objc_build_throw_stmt, objc_build_try_catch_finally_stmt, objc_build_synchronized_prologue, objc_build_synchronized_epilogue, objc_build_try_prologue, objc_build_try_epilogue, objc_build_catch_stmt, objc_build_catch_epilogue, objc_build_finally_prologue, objc_build_finally_epilogue, is_ivar, is_private, is_public, add_instance_variable, objc_add_method, get_super_receiver, objc_clear_super_receiver, get_class_ivars_from_name, get_class_reference, get_static_reference, get_object_reference, build_message_expr, finish_message_expr, build_selector_expr, build_ivar_reference, build_keyword_decl, build_method_decl, build_protocol_expr, build_objc_string_object, objc_declare_alias, objc_declare_class, objc_declare_protocols, objc_comptypes, objc_check_decl, build_encode_expr): Remove prototypes. (imp_count, cat_count): Make GGC-aware. (OBJC_SET_TYPE_NAME): New macro. From-SVN: r87168
2004-09-08 02:49:44 +02:00
build_unary_op (ADDR_EXPR,
METHOD_DEFINITION (entries), 1)),
elemlist);
initlist = tree_cons (NULL_TREE,
tree.c (build_constructor): New function. * tree.c (build_constructor): New function. * tree.h: Prototype it. * c-typeck.c (build_c_cast, pop_init_level) * profile.c (build_function_info_value, build_gcov_info_value) (create_profiler): Use build_constructor. * builtins.c (expand_builtin_args_info): Remove #if 0 blocks. * objc/objc-act.c (build_constructor): Rename objc_build_constructor. Use build_constructor. (build_objc_string_object, objc_add_static_instance) (init_def_list, init_objc_symtab, init_module_descriptor) (generate_static_references, build_selector_translation_table) (build_descriptor_table_initializer, generate_descriptor_table) (build_protocol_initializer, build_ivar_list_initializer) (generate_ivars_list, build_dispatch_table_initializer) (generate_dispatch_table, generate_protocol_list) (build_category_initializer, build_shared_structure_initializer): Update to match. ada: * gigi.h, utils2.c (build_constructor): Rename gnat_build_constructor. Use build_constructor. * decl.c (gnat_to_gnu_entity) * trans.c (tree_transform, pos_to_constructor, extract_values) * ada/utils.c (build_template, convert_to_fat_pointer, convert) (unchecked_convert) * ada/utils2.c (build_binary_op, build_call_raise, build_allocator) (fill_vms_descriptor): Update to match. cp: * class.c (initialize_array) * decl.c (reshape_init) * decl2.c (build_expr_from_tree) * init.c (build_zero_init) * pt.c (tsubst_copy, tsubst_copy_and_build) * rtti.c (tinfo_base_init, generic_initializer, ptr_initializer) (ptm_initializer, class_initializer, get_pseudo_ti_init) * semantics.c (finish_compound_literal) * typeck.c (build_ptrmemfunc1) * typeck2.c (store_init_value, process_init_constructor) (build_functional_cast): Use build_constructor. f: * com.c (ffecom_build_complex_constant_, ffecom_expr_) (ffecom_init_zero_, ffecom_transform_namelist_, ffecom_vardesc_) (ffecom_vardesc_array_, ffecom_vardesc_dims_, ffecom_2) * ste.c (ffeste_io_ialist_, ffeste_io_cilist_, ffeste_io_cllist_) (ffeste_io_icilist_, ffeste_io_inlist_, ffeste_io_olist_): Use build_constructor. java: * class.c (make_field_value, make_method_value, get_dispatch_table) (make_class_data, emit_offset_symbol_table) * constants.c (build_constants_constructor) * java-tree.h (START_RECORD_CONSTRUCTOR) * parse.y (maybe_build_array_element_wfl): Use build_constructor. From-SVN: r65539
2003-04-13 03:45:35 +02:00
objc_build_constructor (type, nreverse (elemlist)),
initlist);
1992-01-18 00:15:38 +01:00
entries = TREE_CHAIN (entries);
}
while (entries);
tree.c (build_constructor): New function. * tree.c (build_constructor): New function. * tree.h: Prototype it. * c-typeck.c (build_c_cast, pop_init_level) * profile.c (build_function_info_value, build_gcov_info_value) (create_profiler): Use build_constructor. * builtins.c (expand_builtin_args_info): Remove #if 0 blocks. * objc/objc-act.c (build_constructor): Rename objc_build_constructor. Use build_constructor. (build_objc_string_object, objc_add_static_instance) (init_def_list, init_objc_symtab, init_module_descriptor) (generate_static_references, build_selector_translation_table) (build_descriptor_table_initializer, generate_descriptor_table) (build_protocol_initializer, build_ivar_list_initializer) (generate_ivars_list, build_dispatch_table_initializer) (generate_dispatch_table, generate_protocol_list) (build_category_initializer, build_shared_structure_initializer): Update to match. ada: * gigi.h, utils2.c (build_constructor): Rename gnat_build_constructor. Use build_constructor. * decl.c (gnat_to_gnu_entity) * trans.c (tree_transform, pos_to_constructor, extract_values) * ada/utils.c (build_template, convert_to_fat_pointer, convert) (unchecked_convert) * ada/utils2.c (build_binary_op, build_call_raise, build_allocator) (fill_vms_descriptor): Update to match. cp: * class.c (initialize_array) * decl.c (reshape_init) * decl2.c (build_expr_from_tree) * init.c (build_zero_init) * pt.c (tsubst_copy, tsubst_copy_and_build) * rtti.c (tinfo_base_init, generic_initializer, ptr_initializer) (ptm_initializer, class_initializer, get_pseudo_ti_init) * semantics.c (finish_compound_literal) * typeck.c (build_ptrmemfunc1) * typeck2.c (store_init_value, process_init_constructor) (build_functional_cast): Use build_constructor. f: * com.c (ffecom_build_complex_constant_, ffecom_expr_) (ffecom_init_zero_, ffecom_transform_namelist_, ffecom_vardesc_) (ffecom_vardesc_array_, ffecom_vardesc_dims_, ffecom_2) * ste.c (ffeste_io_ialist_, ffeste_io_cilist_, ffeste_io_cllist_) (ffeste_io_icilist_, ffeste_io_inlist_, ffeste_io_olist_): Use build_constructor. java: * class.c (make_field_value, make_method_value, get_dispatch_table) (make_class_data, emit_offset_symbol_table) * constants.c (build_constants_constructor) * java-tree.h (START_RECORD_CONSTRUCTOR) * parse.y (maybe_build_array_element_wfl): Use build_constructor. From-SVN: r65539
2003-04-13 03:45:35 +02:00
return objc_build_constructor (build_array_type (type, 0),
nreverse (initlist));
1992-01-18 00:15:38 +01:00
}
/* To accomplish method prototyping without generating all kinds of
inane warnings, the definition of the dispatch table entries were
changed from:
struct objc_method { SEL _cmd; ...; id (*_imp)(); };
to:
struct objc_method { SEL _cmd; ...; void *_imp; }; */
1992-01-18 00:15:38 +01:00
static tree
build_method_template (void)
1992-01-18 00:15:38 +01:00
{
tree _SLT_record;
Makefile.in (c-parse.o): Depend on $(C_COMMON_H). [gcc/ChangeLog] 2004-09-07 Ziemowit Laski <zlaski@apple.com> * Makefile.in (c-parse.o): Depend on $(C_COMMON_H). * c-parse.in: Include c-common.h instead of objc-act.h. (ivar_decl_list, ivar_decls, ivar_decl, ivars, ivar_declarator, myparms, myparm): Remove %type declarations. (methodtype, optparms, OBJC_TYPE_QUAL, objc_quals, objc_qual, objc_typename, objc_try_catch_stmt, optellipsis): Add %type declarations. (objc_inherit_code, objc_public_flag): Remove. (typespec_nonreserved_nonattr): Call objc_get_protocol_qualified_type() instead of get_static_reference() and get_protocol_reference(). (stmt_nocomp): Call grokparm() on @catch parameter. (objcdef): Move semantic action to objc_finish_implementation(). (classdef): Move semantic action to objc_start_class_interface(), objc_continue_interface(), objc_finish_interface(), objc_start_class_implementation(), objc_continue_implementation(), objc_start_category_interface() and objc_start_category_implementation(). (protocoldef): Move semantic actions to objc_start_protocol() and objc_finish_interface(). (ivar_decl_list): Remove nonterminal. (visibility_spec): Move semantic actions to objc_set_visibility(). (ivar_decls): Remove assignment to $$. (ivar_decl): Rephrase in terms of component_decl; call objc_add_instance_variable(). (ivars, ivar_declarator): Remove nonterminals. (opt_semi): New nonterminal. (methodtype): Remove semantic actions. (methoddef): Move semantic actions to objc_set_method_type(), objc_start_method_definition() and objc_finish_method_definition(). (methodproto): Move semantic actions to objc_set_method_type() and objc_add_method_declaration(). (methoddecl): Use objc_typename instead of typename; move semantic actions to objc_build_method_signature(). (optarglist, myxdecls, mydecl, myparms, myparm): Remove nonterminals. (optparmlist): Express in terms of optparms and optellipsis. (optparms, optellipsis, objc_qual, objc_quals, objc_typename): New nonterminals. (keyworddecl): Use objc_typename instead of typename. (rid_to_yy): Mark RID_IN, RID_OUT, RID_INOUT, RID_BYCOPY, RID_BYREF and RID_ONEWAY as returning OBJC_TYPE_QUAL to yyparse(). [gcc/objc/ChangeLog] 2004-09-07 Ziemowit Laski <zlaski@apple.com> * Make-lang.in (objc/objc-parse.o): Depend on $(C_COMMON_H) instead of objc/objc-act.h. (objc/objc-act.o): Depend on $(HASHTAB_H). * objc-act.c: Include hashtab.h; in ObjC++ mode, include cp-tree.h and objcp-decl.h instead of c-tree.h. (build_module_descriptor, get_class_ivars, synth_id_with_class_suffix, error_with_ivar, gen_method_decl, gen_declaration, setup_string_decl, build_protocol_template): Adjust prototypes. (build_module_initializer_routine, start_class, continue_class, finish_class, start_method_def, objc_start_function, start_protocol, build_method_decl, objc_add_method, add_instance_variable, build_ivar_reference, is_ivar, is_private, get_super_receiver, build_selector_table_decl, objc_push_parm, objc_get_parm_info, gen_type_name, gen_type_name_0, start_var_decl, finish_var_decl, create_field_decl): New prototypes. (objc_expand_function_end, comp_method_with_proto, objc_expr_last, gen_declaration_1, gen_declarator, is_complex_decl, adorn_decl, define_decl, create_builtin_decl, gen_declspecs): Remove prototypes. (TYPE_ID): Rename to OBJECT_TYPEDEF_NAME. (CLASS_TYPEDEF_NAME): New. (TAG_EXECCLASS): Change from a global variable to a #define. (TAG_RETURN_STRUCT): Delete. (TAG_GNUINIT): New, holds '__objc_gnu_init' name. (objc_inherit_code, objc_public_flag): New, moved from c-parse.in. (string_descriptor): New struct. (string_htab): New hash table. (string_hash, string_eq): New prototypes. (generate_struct_by_value_array): Call create_field_decl() instead of create_builtin_decl(). (objc_init): Do not initialize objc_ellipsis_node or TAG_EXECCLASS; In ObjC++ mode, call cxx_init() instead of c_objc_common_init(). (objc_finish_file): In ObjC++, call instantiate_pending_templates() and cp_finish_file(). (define_decl, get_static_reference, get_protocol_reference, create_builtin_decl): Remove functions. (objc_start_class_interface, objc_start_category_interface, objc_start_protocol, objc_continue_interface, objc_finish_interface, objc_start_class_implementation, objc_start_category_implementation, objc_continue_implementation, objc_finish_implementation, objc_set_visibility, objc_set_method_type, objc_build_method_signature, objc_add_method_declaration, objc_start_method_definition, objc_add_instance_variable, objc_get_protocol_qualified_type, create_field_decl, start_var_decl, finish_var_decl): New functions. (setup_string_decl): Simplify since it is only called once. (synth_module_prologue): Call build_class_template(); predefine 'id' and 'Class' as typedefs; rename 'temp_type' to 'type'; disable debug hooks for duration of function; fix GNU runtime messenger signatures to correspond to reality; forward-declare '__objc_exec_class' for the GNU runtime; call build_selector_table_decl(); in ObjC++ mode, generate 'extern "C" { ... }' wrappers around synthesized declarations; call build_protocol_template() and build_category_template(). (string_hash, string_eq): New functions. (objc_build_string_object): Check metaclass correctness only once; store string literals in hash table. (objc_build_constructor): Do not convert initializer elements; adjust for ObjC++ impedance mismatch. (build_objc_symtab_template): Call create_field_decl() instead of create_builtin_decl(). (init_objc_symtab): Add missing conversion to initializer element. (build_metadata_decl): Call start_var_decl() instead of define_decl(). (generate_objc_symtab_decl): Do not call build_category_template(); call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(). (build_module_descriptor): Call create_field_decl() instead of grokfield(); call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(); always mark module descriptor as used; move GNU runtime-specific functionality to build_module_initializer_routine(). (build_module_initializer_routine): New function, broken off of build_module_descriptor(). (objc_static_init_needed_p, objc_generate_static_init_call): New functions. (generate_static_references, generate_strings, build_selector_translation_table, generate_descriptor_table, generate_ivars_list, generate_dispatch_table, generate_category): Call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(); build a type directly instead of via groktypename(). (build_selector_reference_decl, build_selector_table_decl, build_class_reference_decl, build_protocol_reference, generate_objc_image_info): Call start_var_decl() instead of build_decl(). (build_selector_reference): For GNU runtime, do not call build_selector_reference_decl(). (build_selector, build_typed_selector_reference): Always convert result to the selector type. (add_objc_string): Cast return value to 'char *'. (build_method_prototype_template, build_selector_template, build_method_template): Use actual selector type for fields pointing to selectors. (finish_objc): For GNU runtime, call build_module_initializer_routine() after build_module_descriptor(). (generate_protocol_list, generate_shared_structures): Call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(); build a type directly instead of via groktypename(). (synth_id_with_class_suffix): Return a string. (get_arg_type_list): For instance methods, use the instance type for 'self'; do not call groktypename_in_parm_context(). (build_objc_string_decl): Squash redeclaration errors in ObjC++. (objc_is_class_name): Use OBJC_TYPE_NAME instead of TYPE_NAME; handle RECORD_TYPEs in ObjC as well as ObjC++. (objc_is_id): New function. (objc_is_object_ptr): Return the canonical type node. (objc_get_class_ivars): Simplify using get_class_ivars(). (get_class_ivars): Remove second parameter; create a fresh copy of the ivar list for each call; do not check for existence of super class. (objc_eh_runtime_type): Mark #ifndef OBJCPLUS. (objc_init_exceptions): When using SJLJ-style exceptions, require the use of '-fobjc-exceptions' flag; do not require it for DWARF-style exceptions. (objc_build_exc_ptr, next_sjlj_build_try_catch_finally): Use objc_object_type instead of objc_id_type. (objc_begin_catch_clause): Convert the incoming PARM_DECL into a VAR_DECL before placing it in the appropriate scope; do not call define_decl(); adjust call to c_begin_compound_stmt(); use objc_object_type instead of objc_id_type. (build_next_objc_exception_stuff): Call create_field_decl() instead of create_builtin_decl(); construct type directly instead of calling groktypename(); use OBJC_VOID_AT_END to mark end of function parameters. (build_private_template): Adjust call to get_class_ivars(); build a type directly instead of via groktypename(). (build_protocol_template, build_method_prototype_list_template, build_method_prototype_template, build_category_template, build_selector_template, build_class_template, build_super_template, build_ivar_template, build_ivar_list_template, build_method_list_template, build_method_template): Call create_field_decl() instead of grokfield(). (objc_method_parm_type): Do not call groktypename(). (generate_descriptor_table): Call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(). (generate_method_descriptors, build_protocol_initializer, generate_dispatch_tables, build_category_initializer, build_shared_structure_initializer): Do not call groktypename(). (generate_protocols): Call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(); do not call groktypename(). (error_with_ivar): Remove last parameter. (check_ivars): Do not iterate ovar CLASS_RAW_IVARS lists in addition to CLASS_IVARS lists; adjust calls to error_with_ivar(). (generate_ivar_lists): Convert one of the initializer elements; do not call groktypename(). (get_arg_type_list, start_method_def, gen_method_def): Account for new representation of variable arguments and '...' in Objective-C methods; add Objective-C++ impedance matching code. (is_objc_type_qualifier): Remove function. (adjust_type_for_id_default): Simplify; there is no longer a need to wade through declspecs. (lookup_interface, start_class, continue_class, finish_class, start_method_def, start_protocol, build_method_decl, objc_add_method, add_instance_variable, build_ivar_reference, is_ivar, is_private, get_super_receiver, objc_build_finally_epilogue): Make into static functions. (receiver_is_class_object): Use new IS_CLASS() macro. (objc_build_message_expr): Tweak ObjC++ message argument handling; call objc_finish_message_expr() instead of finish_message_expr(). (finish_message_expr): Rename to objc_finish_message_expr(); use OBJC_TYPE_NAME and OBJC_SET_TYPE_NAME macros instead of TYPE_NAME. call gen_type_name() instead of gen_declaration(); call objc_is_id() instead of using IS_ID and IS_CLASS; Use objc_class_name instead of calling get_identifier("Class"); handle CONVERT_EXPRs in receiver. (build_objc_method_call, warn_with_method): Do not call groktypename(). (build_ivar_reference): Call convert() instead of clobbering in a type. (hash_init): Initialize string_htab hash table. (add_instance_variable): Simplify parameter list; do not call grokfield(); do not populate CLASS_IVARS list. (start_class): Check for the existence of super class, if one was specified. (continue_class): Use CLASS_RAW_IVARS rather than CLASS_IVARS; do not call build_class_template(); adjust call to get_class_ivars(); call build_decl(), pushdecl() and finish_decl() instead of define_decl(). (finish_class): Call build_decl(), pushdecl() and finish_decl() instead of define_decl(). (add_protocols): Use PROTOCOL_BINFO_ELTS for the tree vector size. (start_protocol): Do not call build_protocol_template(); use PROTOCOL_BINFO_ELTS for the tree vector size. (encode_type_qualifiers): Do not handle the 'const' qualifier here. (encode_pointer): Encode 'const char *' as 'r*', for backwards compatibility. (encode_array): Use HOST_WIDE_INT_PRINT_DEC instead of "%ld". (encode_type): Handle the 'const' qualifier here. (objc_parmlist): New global variable, sued by objc_push_parm and objc_get_parm_info(). (objc_push_parm, objc_get_parm_info): New functions. (objc_expr_last): Remove function. (synth_self_and_ucmd_args): For instance methods, use the instance type for 'self'; call objc_push_parm() instead of push_parm_decl(). (start_method_def): Do not call push_scope(), declare_parm_level(), pop_scope(), push_parm_decl(), store_parm_decls() or objc_expr_last(); just use objc_push_parm() and objc_get_parm_info(). (comp_method_with_proto): Remove function. (objc_types_are_equivalent): Strip away indirections before comparing underlying types. (comp_proto_with_proto): Do not call groktypename(); types are no longer in raw declspec format. (objc_start_function): New function. (really_start_method): Call comp_proto_with_proto() instead of comp_method_with_proto(); call objc_start_function() instead of hand-crafting a function declarator. (continue_method_def, objc_expand_function_end): Remove functions. (get_super_receiver): Call objc_get_current_scope() instead of get_current_scope(); reference 'super_class' field (instead of 'class'). (finish_method_def): Rename to objc_finish_method_definition() and add a function decl parameter; move method encoding call from objc_expand_function_end(). (is_complex_decl, adorn_decl, gen_declarator, gen_declspecs, gen_declaration_1): Remove functions. (tmpbuf, RAW_DECLSPEC): Remove. (gen_declaration): Remove second parameter; simplify to deal with TYPE_P nodes instead of raw declspecs. (gen_type_name, gen_type_name_0): New functions. (gen_method_decl): Remove second parameter; call gen_type_name() instead of gen_declaration_1(). (dump_interface): Adjust calls to gen_declaration() and gen_method_decl(); do not allocate a separate string buffer. (init_objc): Allocate a larger string buffer to accommodate dump_interface(); adjust call to build_module_descriptor(); add call to build_module_initializer_routine() for the GNU runtime. (generate_classref_translation_entry): Do not call start_decl(); call finish_var_decl() instead of finish_decl(); call convert() instead of build_c_cast(). * objc-act.h (CLASS_OWN_IVARS): Remove accessor. (CLASS_BINFO_ELTS): Reduce from 6 to 5, now that CLASS_OWN_IVARS is gone. (OCTI_GNU_INIT_DECL, GNU_INIT_decl): New. (OCTI_ELLIPSIS_NODE, objc_ellipsis_node): Remove. (OCTI_ID_ID, id_type, objc_id_id): Rename to OCTI_ID_NAME, objc_object_type and objc_object_name, respectively. (OCTI_CLS_REF, OCTI_CLASS_NAME, objc_class_reference, objc_class_name): New. (IS_CLASS): New macro. (IS_ID, IS_SUPER): Robustify. (OCTI_EXECCLASS_DECL, execclass_decl): New. (finish_file, start_class, continue_class, finish_class, start_method_def, continue_method_def, finish_method_def, start_protocol, finish_protocol, objc_build_throw_stmt, objc_build_try_catch_finally_stmt, objc_build_synchronized_prologue, objc_build_synchronized_epilogue, objc_build_try_prologue, objc_build_try_epilogue, objc_build_catch_stmt, objc_build_catch_epilogue, objc_build_finally_prologue, objc_build_finally_epilogue, is_ivar, is_private, is_public, add_instance_variable, objc_add_method, get_super_receiver, objc_clear_super_receiver, get_class_ivars_from_name, get_class_reference, get_static_reference, get_object_reference, build_message_expr, finish_message_expr, build_selector_expr, build_ivar_reference, build_keyword_decl, build_method_decl, build_protocol_expr, build_objc_string_object, objc_declare_alias, objc_declare_class, objc_declare_protocols, objc_comptypes, objc_check_decl, build_encode_expr): Remove prototypes. (imp_count, cat_count): Make GGC-aware. (OBJC_SET_TYPE_NAME): New macro. From-SVN: r87168
2004-09-08 02:49:44 +02:00
tree field_decl, field_decl_chain;
1992-01-18 00:15:38 +01:00
_SLT_record = start_struct (RECORD_TYPE, get_identifier (UTAG_METHOD));
1992-01-18 00:15:38 +01:00
Makefile.in (c-parse.o): Depend on $(C_COMMON_H). [gcc/ChangeLog] 2004-09-07 Ziemowit Laski <zlaski@apple.com> * Makefile.in (c-parse.o): Depend on $(C_COMMON_H). * c-parse.in: Include c-common.h instead of objc-act.h. (ivar_decl_list, ivar_decls, ivar_decl, ivars, ivar_declarator, myparms, myparm): Remove %type declarations. (methodtype, optparms, OBJC_TYPE_QUAL, objc_quals, objc_qual, objc_typename, objc_try_catch_stmt, optellipsis): Add %type declarations. (objc_inherit_code, objc_public_flag): Remove. (typespec_nonreserved_nonattr): Call objc_get_protocol_qualified_type() instead of get_static_reference() and get_protocol_reference(). (stmt_nocomp): Call grokparm() on @catch parameter. (objcdef): Move semantic action to objc_finish_implementation(). (classdef): Move semantic action to objc_start_class_interface(), objc_continue_interface(), objc_finish_interface(), objc_start_class_implementation(), objc_continue_implementation(), objc_start_category_interface() and objc_start_category_implementation(). (protocoldef): Move semantic actions to objc_start_protocol() and objc_finish_interface(). (ivar_decl_list): Remove nonterminal. (visibility_spec): Move semantic actions to objc_set_visibility(). (ivar_decls): Remove assignment to $$. (ivar_decl): Rephrase in terms of component_decl; call objc_add_instance_variable(). (ivars, ivar_declarator): Remove nonterminals. (opt_semi): New nonterminal. (methodtype): Remove semantic actions. (methoddef): Move semantic actions to objc_set_method_type(), objc_start_method_definition() and objc_finish_method_definition(). (methodproto): Move semantic actions to objc_set_method_type() and objc_add_method_declaration(). (methoddecl): Use objc_typename instead of typename; move semantic actions to objc_build_method_signature(). (optarglist, myxdecls, mydecl, myparms, myparm): Remove nonterminals. (optparmlist): Express in terms of optparms and optellipsis. (optparms, optellipsis, objc_qual, objc_quals, objc_typename): New nonterminals. (keyworddecl): Use objc_typename instead of typename. (rid_to_yy): Mark RID_IN, RID_OUT, RID_INOUT, RID_BYCOPY, RID_BYREF and RID_ONEWAY as returning OBJC_TYPE_QUAL to yyparse(). [gcc/objc/ChangeLog] 2004-09-07 Ziemowit Laski <zlaski@apple.com> * Make-lang.in (objc/objc-parse.o): Depend on $(C_COMMON_H) instead of objc/objc-act.h. (objc/objc-act.o): Depend on $(HASHTAB_H). * objc-act.c: Include hashtab.h; in ObjC++ mode, include cp-tree.h and objcp-decl.h instead of c-tree.h. (build_module_descriptor, get_class_ivars, synth_id_with_class_suffix, error_with_ivar, gen_method_decl, gen_declaration, setup_string_decl, build_protocol_template): Adjust prototypes. (build_module_initializer_routine, start_class, continue_class, finish_class, start_method_def, objc_start_function, start_protocol, build_method_decl, objc_add_method, add_instance_variable, build_ivar_reference, is_ivar, is_private, get_super_receiver, build_selector_table_decl, objc_push_parm, objc_get_parm_info, gen_type_name, gen_type_name_0, start_var_decl, finish_var_decl, create_field_decl): New prototypes. (objc_expand_function_end, comp_method_with_proto, objc_expr_last, gen_declaration_1, gen_declarator, is_complex_decl, adorn_decl, define_decl, create_builtin_decl, gen_declspecs): Remove prototypes. (TYPE_ID): Rename to OBJECT_TYPEDEF_NAME. (CLASS_TYPEDEF_NAME): New. (TAG_EXECCLASS): Change from a global variable to a #define. (TAG_RETURN_STRUCT): Delete. (TAG_GNUINIT): New, holds '__objc_gnu_init' name. (objc_inherit_code, objc_public_flag): New, moved from c-parse.in. (string_descriptor): New struct. (string_htab): New hash table. (string_hash, string_eq): New prototypes. (generate_struct_by_value_array): Call create_field_decl() instead of create_builtin_decl(). (objc_init): Do not initialize objc_ellipsis_node or TAG_EXECCLASS; In ObjC++ mode, call cxx_init() instead of c_objc_common_init(). (objc_finish_file): In ObjC++, call instantiate_pending_templates() and cp_finish_file(). (define_decl, get_static_reference, get_protocol_reference, create_builtin_decl): Remove functions. (objc_start_class_interface, objc_start_category_interface, objc_start_protocol, objc_continue_interface, objc_finish_interface, objc_start_class_implementation, objc_start_category_implementation, objc_continue_implementation, objc_finish_implementation, objc_set_visibility, objc_set_method_type, objc_build_method_signature, objc_add_method_declaration, objc_start_method_definition, objc_add_instance_variable, objc_get_protocol_qualified_type, create_field_decl, start_var_decl, finish_var_decl): New functions. (setup_string_decl): Simplify since it is only called once. (synth_module_prologue): Call build_class_template(); predefine 'id' and 'Class' as typedefs; rename 'temp_type' to 'type'; disable debug hooks for duration of function; fix GNU runtime messenger signatures to correspond to reality; forward-declare '__objc_exec_class' for the GNU runtime; call build_selector_table_decl(); in ObjC++ mode, generate 'extern "C" { ... }' wrappers around synthesized declarations; call build_protocol_template() and build_category_template(). (string_hash, string_eq): New functions. (objc_build_string_object): Check metaclass correctness only once; store string literals in hash table. (objc_build_constructor): Do not convert initializer elements; adjust for ObjC++ impedance mismatch. (build_objc_symtab_template): Call create_field_decl() instead of create_builtin_decl(). (init_objc_symtab): Add missing conversion to initializer element. (build_metadata_decl): Call start_var_decl() instead of define_decl(). (generate_objc_symtab_decl): Do not call build_category_template(); call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(). (build_module_descriptor): Call create_field_decl() instead of grokfield(); call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(); always mark module descriptor as used; move GNU runtime-specific functionality to build_module_initializer_routine(). (build_module_initializer_routine): New function, broken off of build_module_descriptor(). (objc_static_init_needed_p, objc_generate_static_init_call): New functions. (generate_static_references, generate_strings, build_selector_translation_table, generate_descriptor_table, generate_ivars_list, generate_dispatch_table, generate_category): Call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(); build a type directly instead of via groktypename(). (build_selector_reference_decl, build_selector_table_decl, build_class_reference_decl, build_protocol_reference, generate_objc_image_info): Call start_var_decl() instead of build_decl(). (build_selector_reference): For GNU runtime, do not call build_selector_reference_decl(). (build_selector, build_typed_selector_reference): Always convert result to the selector type. (add_objc_string): Cast return value to 'char *'. (build_method_prototype_template, build_selector_template, build_method_template): Use actual selector type for fields pointing to selectors. (finish_objc): For GNU runtime, call build_module_initializer_routine() after build_module_descriptor(). (generate_protocol_list, generate_shared_structures): Call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(); build a type directly instead of via groktypename(). (synth_id_with_class_suffix): Return a string. (get_arg_type_list): For instance methods, use the instance type for 'self'; do not call groktypename_in_parm_context(). (build_objc_string_decl): Squash redeclaration errors in ObjC++. (objc_is_class_name): Use OBJC_TYPE_NAME instead of TYPE_NAME; handle RECORD_TYPEs in ObjC as well as ObjC++. (objc_is_id): New function. (objc_is_object_ptr): Return the canonical type node. (objc_get_class_ivars): Simplify using get_class_ivars(). (get_class_ivars): Remove second parameter; create a fresh copy of the ivar list for each call; do not check for existence of super class. (objc_eh_runtime_type): Mark #ifndef OBJCPLUS. (objc_init_exceptions): When using SJLJ-style exceptions, require the use of '-fobjc-exceptions' flag; do not require it for DWARF-style exceptions. (objc_build_exc_ptr, next_sjlj_build_try_catch_finally): Use objc_object_type instead of objc_id_type. (objc_begin_catch_clause): Convert the incoming PARM_DECL into a VAR_DECL before placing it in the appropriate scope; do not call define_decl(); adjust call to c_begin_compound_stmt(); use objc_object_type instead of objc_id_type. (build_next_objc_exception_stuff): Call create_field_decl() instead of create_builtin_decl(); construct type directly instead of calling groktypename(); use OBJC_VOID_AT_END to mark end of function parameters. (build_private_template): Adjust call to get_class_ivars(); build a type directly instead of via groktypename(). (build_protocol_template, build_method_prototype_list_template, build_method_prototype_template, build_category_template, build_selector_template, build_class_template, build_super_template, build_ivar_template, build_ivar_list_template, build_method_list_template, build_method_template): Call create_field_decl() instead of grokfield(). (objc_method_parm_type): Do not call groktypename(). (generate_descriptor_table): Call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(). (generate_method_descriptors, build_protocol_initializer, generate_dispatch_tables, build_category_initializer, build_shared_structure_initializer): Do not call groktypename(). (generate_protocols): Call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(); do not call groktypename(). (error_with_ivar): Remove last parameter. (check_ivars): Do not iterate ovar CLASS_RAW_IVARS lists in addition to CLASS_IVARS lists; adjust calls to error_with_ivar(). (generate_ivar_lists): Convert one of the initializer elements; do not call groktypename(). (get_arg_type_list, start_method_def, gen_method_def): Account for new representation of variable arguments and '...' in Objective-C methods; add Objective-C++ impedance matching code. (is_objc_type_qualifier): Remove function. (adjust_type_for_id_default): Simplify; there is no longer a need to wade through declspecs. (lookup_interface, start_class, continue_class, finish_class, start_method_def, start_protocol, build_method_decl, objc_add_method, add_instance_variable, build_ivar_reference, is_ivar, is_private, get_super_receiver, objc_build_finally_epilogue): Make into static functions. (receiver_is_class_object): Use new IS_CLASS() macro. (objc_build_message_expr): Tweak ObjC++ message argument handling; call objc_finish_message_expr() instead of finish_message_expr(). (finish_message_expr): Rename to objc_finish_message_expr(); use OBJC_TYPE_NAME and OBJC_SET_TYPE_NAME macros instead of TYPE_NAME. call gen_type_name() instead of gen_declaration(); call objc_is_id() instead of using IS_ID and IS_CLASS; Use objc_class_name instead of calling get_identifier("Class"); handle CONVERT_EXPRs in receiver. (build_objc_method_call, warn_with_method): Do not call groktypename(). (build_ivar_reference): Call convert() instead of clobbering in a type. (hash_init): Initialize string_htab hash table. (add_instance_variable): Simplify parameter list; do not call grokfield(); do not populate CLASS_IVARS list. (start_class): Check for the existence of super class, if one was specified. (continue_class): Use CLASS_RAW_IVARS rather than CLASS_IVARS; do not call build_class_template(); adjust call to get_class_ivars(); call build_decl(), pushdecl() and finish_decl() instead of define_decl(). (finish_class): Call build_decl(), pushdecl() and finish_decl() instead of define_decl(). (add_protocols): Use PROTOCOL_BINFO_ELTS for the tree vector size. (start_protocol): Do not call build_protocol_template(); use PROTOCOL_BINFO_ELTS for the tree vector size. (encode_type_qualifiers): Do not handle the 'const' qualifier here. (encode_pointer): Encode 'const char *' as 'r*', for backwards compatibility. (encode_array): Use HOST_WIDE_INT_PRINT_DEC instead of "%ld". (encode_type): Handle the 'const' qualifier here. (objc_parmlist): New global variable, sued by objc_push_parm and objc_get_parm_info(). (objc_push_parm, objc_get_parm_info): New functions. (objc_expr_last): Remove function. (synth_self_and_ucmd_args): For instance methods, use the instance type for 'self'; call objc_push_parm() instead of push_parm_decl(). (start_method_def): Do not call push_scope(), declare_parm_level(), pop_scope(), push_parm_decl(), store_parm_decls() or objc_expr_last(); just use objc_push_parm() and objc_get_parm_info(). (comp_method_with_proto): Remove function. (objc_types_are_equivalent): Strip away indirections before comparing underlying types. (comp_proto_with_proto): Do not call groktypename(); types are no longer in raw declspec format. (objc_start_function): New function. (really_start_method): Call comp_proto_with_proto() instead of comp_method_with_proto(); call objc_start_function() instead of hand-crafting a function declarator. (continue_method_def, objc_expand_function_end): Remove functions. (get_super_receiver): Call objc_get_current_scope() instead of get_current_scope(); reference 'super_class' field (instead of 'class'). (finish_method_def): Rename to objc_finish_method_definition() and add a function decl parameter; move method encoding call from objc_expand_function_end(). (is_complex_decl, adorn_decl, gen_declarator, gen_declspecs, gen_declaration_1): Remove functions. (tmpbuf, RAW_DECLSPEC): Remove. (gen_declaration): Remove second parameter; simplify to deal with TYPE_P nodes instead of raw declspecs. (gen_type_name, gen_type_name_0): New functions. (gen_method_decl): Remove second parameter; call gen_type_name() instead of gen_declaration_1(). (dump_interface): Adjust calls to gen_declaration() and gen_method_decl(); do not allocate a separate string buffer. (init_objc): Allocate a larger string buffer to accommodate dump_interface(); adjust call to build_module_descriptor(); add call to build_module_initializer_routine() for the GNU runtime. (generate_classref_translation_entry): Do not call start_decl(); call finish_var_decl() instead of finish_decl(); call convert() instead of build_c_cast(). * objc-act.h (CLASS_OWN_IVARS): Remove accessor. (CLASS_BINFO_ELTS): Reduce from 6 to 5, now that CLASS_OWN_IVARS is gone. (OCTI_GNU_INIT_DECL, GNU_INIT_decl): New. (OCTI_ELLIPSIS_NODE, objc_ellipsis_node): Remove. (OCTI_ID_ID, id_type, objc_id_id): Rename to OCTI_ID_NAME, objc_object_type and objc_object_name, respectively. (OCTI_CLS_REF, OCTI_CLASS_NAME, objc_class_reference, objc_class_name): New. (IS_CLASS): New macro. (IS_ID, IS_SUPER): Robustify. (OCTI_EXECCLASS_DECL, execclass_decl): New. (finish_file, start_class, continue_class, finish_class, start_method_def, continue_method_def, finish_method_def, start_protocol, finish_protocol, objc_build_throw_stmt, objc_build_try_catch_finally_stmt, objc_build_synchronized_prologue, objc_build_synchronized_epilogue, objc_build_try_prologue, objc_build_try_epilogue, objc_build_catch_stmt, objc_build_catch_epilogue, objc_build_finally_prologue, objc_build_finally_epilogue, is_ivar, is_private, is_public, add_instance_variable, objc_add_method, get_super_receiver, objc_clear_super_receiver, get_class_ivars_from_name, get_class_reference, get_static_reference, get_object_reference, build_message_expr, finish_message_expr, build_selector_expr, build_ivar_reference, build_keyword_decl, build_method_decl, build_protocol_expr, build_objc_string_object, objc_declare_alias, objc_declare_class, objc_declare_protocols, objc_comptypes, objc_check_decl, build_encode_expr): Remove prototypes. (imp_count, cat_count): Make GGC-aware. (OBJC_SET_TYPE_NAME): New macro. From-SVN: r87168
2004-09-08 02:49:44 +02:00
/* SEL _cmd; */
field_decl = create_field_decl (objc_selector_type, "_cmd");
1992-01-18 00:15:38 +01:00
field_decl_chain = field_decl;
Makefile.in (c-parse.o): Depend on $(C_COMMON_H). [gcc/ChangeLog] 2004-09-07 Ziemowit Laski <zlaski@apple.com> * Makefile.in (c-parse.o): Depend on $(C_COMMON_H). * c-parse.in: Include c-common.h instead of objc-act.h. (ivar_decl_list, ivar_decls, ivar_decl, ivars, ivar_declarator, myparms, myparm): Remove %type declarations. (methodtype, optparms, OBJC_TYPE_QUAL, objc_quals, objc_qual, objc_typename, objc_try_catch_stmt, optellipsis): Add %type declarations. (objc_inherit_code, objc_public_flag): Remove. (typespec_nonreserved_nonattr): Call objc_get_protocol_qualified_type() instead of get_static_reference() and get_protocol_reference(). (stmt_nocomp): Call grokparm() on @catch parameter. (objcdef): Move semantic action to objc_finish_implementation(). (classdef): Move semantic action to objc_start_class_interface(), objc_continue_interface(), objc_finish_interface(), objc_start_class_implementation(), objc_continue_implementation(), objc_start_category_interface() and objc_start_category_implementation(). (protocoldef): Move semantic actions to objc_start_protocol() and objc_finish_interface(). (ivar_decl_list): Remove nonterminal. (visibility_spec): Move semantic actions to objc_set_visibility(). (ivar_decls): Remove assignment to $$. (ivar_decl): Rephrase in terms of component_decl; call objc_add_instance_variable(). (ivars, ivar_declarator): Remove nonterminals. (opt_semi): New nonterminal. (methodtype): Remove semantic actions. (methoddef): Move semantic actions to objc_set_method_type(), objc_start_method_definition() and objc_finish_method_definition(). (methodproto): Move semantic actions to objc_set_method_type() and objc_add_method_declaration(). (methoddecl): Use objc_typename instead of typename; move semantic actions to objc_build_method_signature(). (optarglist, myxdecls, mydecl, myparms, myparm): Remove nonterminals. (optparmlist): Express in terms of optparms and optellipsis. (optparms, optellipsis, objc_qual, objc_quals, objc_typename): New nonterminals. (keyworddecl): Use objc_typename instead of typename. (rid_to_yy): Mark RID_IN, RID_OUT, RID_INOUT, RID_BYCOPY, RID_BYREF and RID_ONEWAY as returning OBJC_TYPE_QUAL to yyparse(). [gcc/objc/ChangeLog] 2004-09-07 Ziemowit Laski <zlaski@apple.com> * Make-lang.in (objc/objc-parse.o): Depend on $(C_COMMON_H) instead of objc/objc-act.h. (objc/objc-act.o): Depend on $(HASHTAB_H). * objc-act.c: Include hashtab.h; in ObjC++ mode, include cp-tree.h and objcp-decl.h instead of c-tree.h. (build_module_descriptor, get_class_ivars, synth_id_with_class_suffix, error_with_ivar, gen_method_decl, gen_declaration, setup_string_decl, build_protocol_template): Adjust prototypes. (build_module_initializer_routine, start_class, continue_class, finish_class, start_method_def, objc_start_function, start_protocol, build_method_decl, objc_add_method, add_instance_variable, build_ivar_reference, is_ivar, is_private, get_super_receiver, build_selector_table_decl, objc_push_parm, objc_get_parm_info, gen_type_name, gen_type_name_0, start_var_decl, finish_var_decl, create_field_decl): New prototypes. (objc_expand_function_end, comp_method_with_proto, objc_expr_last, gen_declaration_1, gen_declarator, is_complex_decl, adorn_decl, define_decl, create_builtin_decl, gen_declspecs): Remove prototypes. (TYPE_ID): Rename to OBJECT_TYPEDEF_NAME. (CLASS_TYPEDEF_NAME): New. (TAG_EXECCLASS): Change from a global variable to a #define. (TAG_RETURN_STRUCT): Delete. (TAG_GNUINIT): New, holds '__objc_gnu_init' name. (objc_inherit_code, objc_public_flag): New, moved from c-parse.in. (string_descriptor): New struct. (string_htab): New hash table. (string_hash, string_eq): New prototypes. (generate_struct_by_value_array): Call create_field_decl() instead of create_builtin_decl(). (objc_init): Do not initialize objc_ellipsis_node or TAG_EXECCLASS; In ObjC++ mode, call cxx_init() instead of c_objc_common_init(). (objc_finish_file): In ObjC++, call instantiate_pending_templates() and cp_finish_file(). (define_decl, get_static_reference, get_protocol_reference, create_builtin_decl): Remove functions. (objc_start_class_interface, objc_start_category_interface, objc_start_protocol, objc_continue_interface, objc_finish_interface, objc_start_class_implementation, objc_start_category_implementation, objc_continue_implementation, objc_finish_implementation, objc_set_visibility, objc_set_method_type, objc_build_method_signature, objc_add_method_declaration, objc_start_method_definition, objc_add_instance_variable, objc_get_protocol_qualified_type, create_field_decl, start_var_decl, finish_var_decl): New functions. (setup_string_decl): Simplify since it is only called once. (synth_module_prologue): Call build_class_template(); predefine 'id' and 'Class' as typedefs; rename 'temp_type' to 'type'; disable debug hooks for duration of function; fix GNU runtime messenger signatures to correspond to reality; forward-declare '__objc_exec_class' for the GNU runtime; call build_selector_table_decl(); in ObjC++ mode, generate 'extern "C" { ... }' wrappers around synthesized declarations; call build_protocol_template() and build_category_template(). (string_hash, string_eq): New functions. (objc_build_string_object): Check metaclass correctness only once; store string literals in hash table. (objc_build_constructor): Do not convert initializer elements; adjust for ObjC++ impedance mismatch. (build_objc_symtab_template): Call create_field_decl() instead of create_builtin_decl(). (init_objc_symtab): Add missing conversion to initializer element. (build_metadata_decl): Call start_var_decl() instead of define_decl(). (generate_objc_symtab_decl): Do not call build_category_template(); call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(). (build_module_descriptor): Call create_field_decl() instead of grokfield(); call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(); always mark module descriptor as used; move GNU runtime-specific functionality to build_module_initializer_routine(). (build_module_initializer_routine): New function, broken off of build_module_descriptor(). (objc_static_init_needed_p, objc_generate_static_init_call): New functions. (generate_static_references, generate_strings, build_selector_translation_table, generate_descriptor_table, generate_ivars_list, generate_dispatch_table, generate_category): Call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(); build a type directly instead of via groktypename(). (build_selector_reference_decl, build_selector_table_decl, build_class_reference_decl, build_protocol_reference, generate_objc_image_info): Call start_var_decl() instead of build_decl(). (build_selector_reference): For GNU runtime, do not call build_selector_reference_decl(). (build_selector, build_typed_selector_reference): Always convert result to the selector type. (add_objc_string): Cast return value to 'char *'. (build_method_prototype_template, build_selector_template, build_method_template): Use actual selector type for fields pointing to selectors. (finish_objc): For GNU runtime, call build_module_initializer_routine() after build_module_descriptor(). (generate_protocol_list, generate_shared_structures): Call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(); build a type directly instead of via groktypename(). (synth_id_with_class_suffix): Return a string. (get_arg_type_list): For instance methods, use the instance type for 'self'; do not call groktypename_in_parm_context(). (build_objc_string_decl): Squash redeclaration errors in ObjC++. (objc_is_class_name): Use OBJC_TYPE_NAME instead of TYPE_NAME; handle RECORD_TYPEs in ObjC as well as ObjC++. (objc_is_id): New function. (objc_is_object_ptr): Return the canonical type node. (objc_get_class_ivars): Simplify using get_class_ivars(). (get_class_ivars): Remove second parameter; create a fresh copy of the ivar list for each call; do not check for existence of super class. (objc_eh_runtime_type): Mark #ifndef OBJCPLUS. (objc_init_exceptions): When using SJLJ-style exceptions, require the use of '-fobjc-exceptions' flag; do not require it for DWARF-style exceptions. (objc_build_exc_ptr, next_sjlj_build_try_catch_finally): Use objc_object_type instead of objc_id_type. (objc_begin_catch_clause): Convert the incoming PARM_DECL into a VAR_DECL before placing it in the appropriate scope; do not call define_decl(); adjust call to c_begin_compound_stmt(); use objc_object_type instead of objc_id_type. (build_next_objc_exception_stuff): Call create_field_decl() instead of create_builtin_decl(); construct type directly instead of calling groktypename(); use OBJC_VOID_AT_END to mark end of function parameters. (build_private_template): Adjust call to get_class_ivars(); build a type directly instead of via groktypename(). (build_protocol_template, build_method_prototype_list_template, build_method_prototype_template, build_category_template, build_selector_template, build_class_template, build_super_template, build_ivar_template, build_ivar_list_template, build_method_list_template, build_method_template): Call create_field_decl() instead of grokfield(). (objc_method_parm_type): Do not call groktypename(). (generate_descriptor_table): Call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(). (generate_method_descriptors, build_protocol_initializer, generate_dispatch_tables, build_category_initializer, build_shared_structure_initializer): Do not call groktypename(). (generate_protocols): Call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(); do not call groktypename(). (error_with_ivar): Remove last parameter. (check_ivars): Do not iterate ovar CLASS_RAW_IVARS lists in addition to CLASS_IVARS lists; adjust calls to error_with_ivar(). (generate_ivar_lists): Convert one of the initializer elements; do not call groktypename(). (get_arg_type_list, start_method_def, gen_method_def): Account for new representation of variable arguments and '...' in Objective-C methods; add Objective-C++ impedance matching code. (is_objc_type_qualifier): Remove function. (adjust_type_for_id_default): Simplify; there is no longer a need to wade through declspecs. (lookup_interface, start_class, continue_class, finish_class, start_method_def, start_protocol, build_method_decl, objc_add_method, add_instance_variable, build_ivar_reference, is_ivar, is_private, get_super_receiver, objc_build_finally_epilogue): Make into static functions. (receiver_is_class_object): Use new IS_CLASS() macro. (objc_build_message_expr): Tweak ObjC++ message argument handling; call objc_finish_message_expr() instead of finish_message_expr(). (finish_message_expr): Rename to objc_finish_message_expr(); use OBJC_TYPE_NAME and OBJC_SET_TYPE_NAME macros instead of TYPE_NAME. call gen_type_name() instead of gen_declaration(); call objc_is_id() instead of using IS_ID and IS_CLASS; Use objc_class_name instead of calling get_identifier("Class"); handle CONVERT_EXPRs in receiver. (build_objc_method_call, warn_with_method): Do not call groktypename(). (build_ivar_reference): Call convert() instead of clobbering in a type. (hash_init): Initialize string_htab hash table. (add_instance_variable): Simplify parameter list; do not call grokfield(); do not populate CLASS_IVARS list. (start_class): Check for the existence of super class, if one was specified. (continue_class): Use CLASS_RAW_IVARS rather than CLASS_IVARS; do not call build_class_template(); adjust call to get_class_ivars(); call build_decl(), pushdecl() and finish_decl() instead of define_decl(). (finish_class): Call build_decl(), pushdecl() and finish_decl() instead of define_decl(). (add_protocols): Use PROTOCOL_BINFO_ELTS for the tree vector size. (start_protocol): Do not call build_protocol_template(); use PROTOCOL_BINFO_ELTS for the tree vector size. (encode_type_qualifiers): Do not handle the 'const' qualifier here. (encode_pointer): Encode 'const char *' as 'r*', for backwards compatibility. (encode_array): Use HOST_WIDE_INT_PRINT_DEC instead of "%ld". (encode_type): Handle the 'const' qualifier here. (objc_parmlist): New global variable, sued by objc_push_parm and objc_get_parm_info(). (objc_push_parm, objc_get_parm_info): New functions. (objc_expr_last): Remove function. (synth_self_and_ucmd_args): For instance methods, use the instance type for 'self'; call objc_push_parm() instead of push_parm_decl(). (start_method_def): Do not call push_scope(), declare_parm_level(), pop_scope(), push_parm_decl(), store_parm_decls() or objc_expr_last(); just use objc_push_parm() and objc_get_parm_info(). (comp_method_with_proto): Remove function. (objc_types_are_equivalent): Strip away indirections before comparing underlying types. (comp_proto_with_proto): Do not call groktypename(); types are no longer in raw declspec format. (objc_start_function): New function. (really_start_method): Call comp_proto_with_proto() instead of comp_method_with_proto(); call objc_start_function() instead of hand-crafting a function declarator. (continue_method_def, objc_expand_function_end): Remove functions. (get_super_receiver): Call objc_get_current_scope() instead of get_current_scope(); reference 'super_class' field (instead of 'class'). (finish_method_def): Rename to objc_finish_method_definition() and add a function decl parameter; move method encoding call from objc_expand_function_end(). (is_complex_decl, adorn_decl, gen_declarator, gen_declspecs, gen_declaration_1): Remove functions. (tmpbuf, RAW_DECLSPEC): Remove. (gen_declaration): Remove second parameter; simplify to deal with TYPE_P nodes instead of raw declspecs. (gen_type_name, gen_type_name_0): New functions. (gen_method_decl): Remove second parameter; call gen_type_name() instead of gen_declaration_1(). (dump_interface): Adjust calls to gen_declaration() and gen_method_decl(); do not allocate a separate string buffer. (init_objc): Allocate a larger string buffer to accommodate dump_interface(); adjust call to build_module_descriptor(); add call to build_module_initializer_routine() for the GNU runtime. (generate_classref_translation_entry): Do not call start_decl(); call finish_var_decl() instead of finish_decl(); call convert() instead of build_c_cast(). * objc-act.h (CLASS_OWN_IVARS): Remove accessor. (CLASS_BINFO_ELTS): Reduce from 6 to 5, now that CLASS_OWN_IVARS is gone. (OCTI_GNU_INIT_DECL, GNU_INIT_decl): New. (OCTI_ELLIPSIS_NODE, objc_ellipsis_node): Remove. (OCTI_ID_ID, id_type, objc_id_id): Rename to OCTI_ID_NAME, objc_object_type and objc_object_name, respectively. (OCTI_CLS_REF, OCTI_CLASS_NAME, objc_class_reference, objc_class_name): New. (IS_CLASS): New macro. (IS_ID, IS_SUPER): Robustify. (OCTI_EXECCLASS_DECL, execclass_decl): New. (finish_file, start_class, continue_class, finish_class, start_method_def, continue_method_def, finish_method_def, start_protocol, finish_protocol, objc_build_throw_stmt, objc_build_try_catch_finally_stmt, objc_build_synchronized_prologue, objc_build_synchronized_epilogue, objc_build_try_prologue, objc_build_try_epilogue, objc_build_catch_stmt, objc_build_catch_epilogue, objc_build_finally_prologue, objc_build_finally_epilogue, is_ivar, is_private, is_public, add_instance_variable, objc_add_method, get_super_receiver, objc_clear_super_receiver, get_class_ivars_from_name, get_class_reference, get_static_reference, get_object_reference, build_message_expr, finish_message_expr, build_selector_expr, build_ivar_reference, build_keyword_decl, build_method_decl, build_protocol_expr, build_objc_string_object, objc_declare_alias, objc_declare_class, objc_declare_protocols, objc_comptypes, objc_check_decl, build_encode_expr): Remove prototypes. (imp_count, cat_count): Make GGC-aware. (OBJC_SET_TYPE_NAME): New macro. From-SVN: r87168
2004-09-08 02:49:44 +02:00
/* char *method_types; */
field_decl = create_field_decl (string_type_node, "method_types");
1992-01-18 00:15:38 +01:00
chainon (field_decl_chain, field_decl);
/* void *_imp; */
Makefile.in (c-parse.o): Depend on $(C_COMMON_H). [gcc/ChangeLog] 2004-09-07 Ziemowit Laski <zlaski@apple.com> * Makefile.in (c-parse.o): Depend on $(C_COMMON_H). * c-parse.in: Include c-common.h instead of objc-act.h. (ivar_decl_list, ivar_decls, ivar_decl, ivars, ivar_declarator, myparms, myparm): Remove %type declarations. (methodtype, optparms, OBJC_TYPE_QUAL, objc_quals, objc_qual, objc_typename, objc_try_catch_stmt, optellipsis): Add %type declarations. (objc_inherit_code, objc_public_flag): Remove. (typespec_nonreserved_nonattr): Call objc_get_protocol_qualified_type() instead of get_static_reference() and get_protocol_reference(). (stmt_nocomp): Call grokparm() on @catch parameter. (objcdef): Move semantic action to objc_finish_implementation(). (classdef): Move semantic action to objc_start_class_interface(), objc_continue_interface(), objc_finish_interface(), objc_start_class_implementation(), objc_continue_implementation(), objc_start_category_interface() and objc_start_category_implementation(). (protocoldef): Move semantic actions to objc_start_protocol() and objc_finish_interface(). (ivar_decl_list): Remove nonterminal. (visibility_spec): Move semantic actions to objc_set_visibility(). (ivar_decls): Remove assignment to $$. (ivar_decl): Rephrase in terms of component_decl; call objc_add_instance_variable(). (ivars, ivar_declarator): Remove nonterminals. (opt_semi): New nonterminal. (methodtype): Remove semantic actions. (methoddef): Move semantic actions to objc_set_method_type(), objc_start_method_definition() and objc_finish_method_definition(). (methodproto): Move semantic actions to objc_set_method_type() and objc_add_method_declaration(). (methoddecl): Use objc_typename instead of typename; move semantic actions to objc_build_method_signature(). (optarglist, myxdecls, mydecl, myparms, myparm): Remove nonterminals. (optparmlist): Express in terms of optparms and optellipsis. (optparms, optellipsis, objc_qual, objc_quals, objc_typename): New nonterminals. (keyworddecl): Use objc_typename instead of typename. (rid_to_yy): Mark RID_IN, RID_OUT, RID_INOUT, RID_BYCOPY, RID_BYREF and RID_ONEWAY as returning OBJC_TYPE_QUAL to yyparse(). [gcc/objc/ChangeLog] 2004-09-07 Ziemowit Laski <zlaski@apple.com> * Make-lang.in (objc/objc-parse.o): Depend on $(C_COMMON_H) instead of objc/objc-act.h. (objc/objc-act.o): Depend on $(HASHTAB_H). * objc-act.c: Include hashtab.h; in ObjC++ mode, include cp-tree.h and objcp-decl.h instead of c-tree.h. (build_module_descriptor, get_class_ivars, synth_id_with_class_suffix, error_with_ivar, gen_method_decl, gen_declaration, setup_string_decl, build_protocol_template): Adjust prototypes. (build_module_initializer_routine, start_class, continue_class, finish_class, start_method_def, objc_start_function, start_protocol, build_method_decl, objc_add_method, add_instance_variable, build_ivar_reference, is_ivar, is_private, get_super_receiver, build_selector_table_decl, objc_push_parm, objc_get_parm_info, gen_type_name, gen_type_name_0, start_var_decl, finish_var_decl, create_field_decl): New prototypes. (objc_expand_function_end, comp_method_with_proto, objc_expr_last, gen_declaration_1, gen_declarator, is_complex_decl, adorn_decl, define_decl, create_builtin_decl, gen_declspecs): Remove prototypes. (TYPE_ID): Rename to OBJECT_TYPEDEF_NAME. (CLASS_TYPEDEF_NAME): New. (TAG_EXECCLASS): Change from a global variable to a #define. (TAG_RETURN_STRUCT): Delete. (TAG_GNUINIT): New, holds '__objc_gnu_init' name. (objc_inherit_code, objc_public_flag): New, moved from c-parse.in. (string_descriptor): New struct. (string_htab): New hash table. (string_hash, string_eq): New prototypes. (generate_struct_by_value_array): Call create_field_decl() instead of create_builtin_decl(). (objc_init): Do not initialize objc_ellipsis_node or TAG_EXECCLASS; In ObjC++ mode, call cxx_init() instead of c_objc_common_init(). (objc_finish_file): In ObjC++, call instantiate_pending_templates() and cp_finish_file(). (define_decl, get_static_reference, get_protocol_reference, create_builtin_decl): Remove functions. (objc_start_class_interface, objc_start_category_interface, objc_start_protocol, objc_continue_interface, objc_finish_interface, objc_start_class_implementation, objc_start_category_implementation, objc_continue_implementation, objc_finish_implementation, objc_set_visibility, objc_set_method_type, objc_build_method_signature, objc_add_method_declaration, objc_start_method_definition, objc_add_instance_variable, objc_get_protocol_qualified_type, create_field_decl, start_var_decl, finish_var_decl): New functions. (setup_string_decl): Simplify since it is only called once. (synth_module_prologue): Call build_class_template(); predefine 'id' and 'Class' as typedefs; rename 'temp_type' to 'type'; disable debug hooks for duration of function; fix GNU runtime messenger signatures to correspond to reality; forward-declare '__objc_exec_class' for the GNU runtime; call build_selector_table_decl(); in ObjC++ mode, generate 'extern "C" { ... }' wrappers around synthesized declarations; call build_protocol_template() and build_category_template(). (string_hash, string_eq): New functions. (objc_build_string_object): Check metaclass correctness only once; store string literals in hash table. (objc_build_constructor): Do not convert initializer elements; adjust for ObjC++ impedance mismatch. (build_objc_symtab_template): Call create_field_decl() instead of create_builtin_decl(). (init_objc_symtab): Add missing conversion to initializer element. (build_metadata_decl): Call start_var_decl() instead of define_decl(). (generate_objc_symtab_decl): Do not call build_category_template(); call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(). (build_module_descriptor): Call create_field_decl() instead of grokfield(); call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(); always mark module descriptor as used; move GNU runtime-specific functionality to build_module_initializer_routine(). (build_module_initializer_routine): New function, broken off of build_module_descriptor(). (objc_static_init_needed_p, objc_generate_static_init_call): New functions. (generate_static_references, generate_strings, build_selector_translation_table, generate_descriptor_table, generate_ivars_list, generate_dispatch_table, generate_category): Call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(); build a type directly instead of via groktypename(). (build_selector_reference_decl, build_selector_table_decl, build_class_reference_decl, build_protocol_reference, generate_objc_image_info): Call start_var_decl() instead of build_decl(). (build_selector_reference): For GNU runtime, do not call build_selector_reference_decl(). (build_selector, build_typed_selector_reference): Always convert result to the selector type. (add_objc_string): Cast return value to 'char *'. (build_method_prototype_template, build_selector_template, build_method_template): Use actual selector type for fields pointing to selectors. (finish_objc): For GNU runtime, call build_module_initializer_routine() after build_module_descriptor(). (generate_protocol_list, generate_shared_structures): Call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(); build a type directly instead of via groktypename(). (synth_id_with_class_suffix): Return a string. (get_arg_type_list): For instance methods, use the instance type for 'self'; do not call groktypename_in_parm_context(). (build_objc_string_decl): Squash redeclaration errors in ObjC++. (objc_is_class_name): Use OBJC_TYPE_NAME instead of TYPE_NAME; handle RECORD_TYPEs in ObjC as well as ObjC++. (objc_is_id): New function. (objc_is_object_ptr): Return the canonical type node. (objc_get_class_ivars): Simplify using get_class_ivars(). (get_class_ivars): Remove second parameter; create a fresh copy of the ivar list for each call; do not check for existence of super class. (objc_eh_runtime_type): Mark #ifndef OBJCPLUS. (objc_init_exceptions): When using SJLJ-style exceptions, require the use of '-fobjc-exceptions' flag; do not require it for DWARF-style exceptions. (objc_build_exc_ptr, next_sjlj_build_try_catch_finally): Use objc_object_type instead of objc_id_type. (objc_begin_catch_clause): Convert the incoming PARM_DECL into a VAR_DECL before placing it in the appropriate scope; do not call define_decl(); adjust call to c_begin_compound_stmt(); use objc_object_type instead of objc_id_type. (build_next_objc_exception_stuff): Call create_field_decl() instead of create_builtin_decl(); construct type directly instead of calling groktypename(); use OBJC_VOID_AT_END to mark end of function parameters. (build_private_template): Adjust call to get_class_ivars(); build a type directly instead of via groktypename(). (build_protocol_template, build_method_prototype_list_template, build_method_prototype_template, build_category_template, build_selector_template, build_class_template, build_super_template, build_ivar_template, build_ivar_list_template, build_method_list_template, build_method_template): Call create_field_decl() instead of grokfield(). (objc_method_parm_type): Do not call groktypename(). (generate_descriptor_table): Call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(). (generate_method_descriptors, build_protocol_initializer, generate_dispatch_tables, build_category_initializer, build_shared_structure_initializer): Do not call groktypename(). (generate_protocols): Call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(); do not call groktypename(). (error_with_ivar): Remove last parameter. (check_ivars): Do not iterate ovar CLASS_RAW_IVARS lists in addition to CLASS_IVARS lists; adjust calls to error_with_ivar(). (generate_ivar_lists): Convert one of the initializer elements; do not call groktypename(). (get_arg_type_list, start_method_def, gen_method_def): Account for new representation of variable arguments and '...' in Objective-C methods; add Objective-C++ impedance matching code. (is_objc_type_qualifier): Remove function. (adjust_type_for_id_default): Simplify; there is no longer a need to wade through declspecs. (lookup_interface, start_class, continue_class, finish_class, start_method_def, start_protocol, build_method_decl, objc_add_method, add_instance_variable, build_ivar_reference, is_ivar, is_private, get_super_receiver, objc_build_finally_epilogue): Make into static functions. (receiver_is_class_object): Use new IS_CLASS() macro. (objc_build_message_expr): Tweak ObjC++ message argument handling; call objc_finish_message_expr() instead of finish_message_expr(). (finish_message_expr): Rename to objc_finish_message_expr(); use OBJC_TYPE_NAME and OBJC_SET_TYPE_NAME macros instead of TYPE_NAME. call gen_type_name() instead of gen_declaration(); call objc_is_id() instead of using IS_ID and IS_CLASS; Use objc_class_name instead of calling get_identifier("Class"); handle CONVERT_EXPRs in receiver. (build_objc_method_call, warn_with_method): Do not call groktypename(). (build_ivar_reference): Call convert() instead of clobbering in a type. (hash_init): Initialize string_htab hash table. (add_instance_variable): Simplify parameter list; do not call grokfield(); do not populate CLASS_IVARS list. (start_class): Check for the existence of super class, if one was specified. (continue_class): Use CLASS_RAW_IVARS rather than CLASS_IVARS; do not call build_class_template(); adjust call to get_class_ivars(); call build_decl(), pushdecl() and finish_decl() instead of define_decl(). (finish_class): Call build_decl(), pushdecl() and finish_decl() instead of define_decl(). (add_protocols): Use PROTOCOL_BINFO_ELTS for the tree vector size. (start_protocol): Do not call build_protocol_template(); use PROTOCOL_BINFO_ELTS for the tree vector size. (encode_type_qualifiers): Do not handle the 'const' qualifier here. (encode_pointer): Encode 'const char *' as 'r*', for backwards compatibility. (encode_array): Use HOST_WIDE_INT_PRINT_DEC instead of "%ld". (encode_type): Handle the 'const' qualifier here. (objc_parmlist): New global variable, sued by objc_push_parm and objc_get_parm_info(). (objc_push_parm, objc_get_parm_info): New functions. (objc_expr_last): Remove function. (synth_self_and_ucmd_args): For instance methods, use the instance type for 'self'; call objc_push_parm() instead of push_parm_decl(). (start_method_def): Do not call push_scope(), declare_parm_level(), pop_scope(), push_parm_decl(), store_parm_decls() or objc_expr_last(); just use objc_push_parm() and objc_get_parm_info(). (comp_method_with_proto): Remove function. (objc_types_are_equivalent): Strip away indirections before comparing underlying types. (comp_proto_with_proto): Do not call groktypename(); types are no longer in raw declspec format. (objc_start_function): New function. (really_start_method): Call comp_proto_with_proto() instead of comp_method_with_proto(); call objc_start_function() instead of hand-crafting a function declarator. (continue_method_def, objc_expand_function_end): Remove functions. (get_super_receiver): Call objc_get_current_scope() instead of get_current_scope(); reference 'super_class' field (instead of 'class'). (finish_method_def): Rename to objc_finish_method_definition() and add a function decl parameter; move method encoding call from objc_expand_function_end(). (is_complex_decl, adorn_decl, gen_declarator, gen_declspecs, gen_declaration_1): Remove functions. (tmpbuf, RAW_DECLSPEC): Remove. (gen_declaration): Remove second parameter; simplify to deal with TYPE_P nodes instead of raw declspecs. (gen_type_name, gen_type_name_0): New functions. (gen_method_decl): Remove second parameter; call gen_type_name() instead of gen_declaration_1(). (dump_interface): Adjust calls to gen_declaration() and gen_method_decl(); do not allocate a separate string buffer. (init_objc): Allocate a larger string buffer to accommodate dump_interface(); adjust call to build_module_descriptor(); add call to build_module_initializer_routine() for the GNU runtime. (generate_classref_translation_entry): Do not call start_decl(); call finish_var_decl() instead of finish_decl(); call convert() instead of build_c_cast(). * objc-act.h (CLASS_OWN_IVARS): Remove accessor. (CLASS_BINFO_ELTS): Reduce from 6 to 5, now that CLASS_OWN_IVARS is gone. (OCTI_GNU_INIT_DECL, GNU_INIT_decl): New. (OCTI_ELLIPSIS_NODE, objc_ellipsis_node): Remove. (OCTI_ID_ID, id_type, objc_id_id): Rename to OCTI_ID_NAME, objc_object_type and objc_object_name, respectively. (OCTI_CLS_REF, OCTI_CLASS_NAME, objc_class_reference, objc_class_name): New. (IS_CLASS): New macro. (IS_ID, IS_SUPER): Robustify. (OCTI_EXECCLASS_DECL, execclass_decl): New. (finish_file, start_class, continue_class, finish_class, start_method_def, continue_method_def, finish_method_def, start_protocol, finish_protocol, objc_build_throw_stmt, objc_build_try_catch_finally_stmt, objc_build_synchronized_prologue, objc_build_synchronized_epilogue, objc_build_try_prologue, objc_build_try_epilogue, objc_build_catch_stmt, objc_build_catch_epilogue, objc_build_finally_prologue, objc_build_finally_epilogue, is_ivar, is_private, is_public, add_instance_variable, objc_add_method, get_super_receiver, objc_clear_super_receiver, get_class_ivars_from_name, get_class_reference, get_static_reference, get_object_reference, build_message_expr, finish_message_expr, build_selector_expr, build_ivar_reference, build_keyword_decl, build_method_decl, build_protocol_expr, build_objc_string_object, objc_declare_alias, objc_declare_class, objc_declare_protocols, objc_comptypes, objc_check_decl, build_encode_expr): Remove prototypes. (imp_count, cat_count): Make GGC-aware. (OBJC_SET_TYPE_NAME): New macro. From-SVN: r87168
2004-09-08 02:49:44 +02:00
field_decl = create_field_decl (build_pointer_type (void_type_node),
"_imp");
1992-01-18 00:15:38 +01:00
chainon (field_decl_chain, field_decl);
finish_struct (_SLT_record, field_decl_chain, NULL_TREE);
1992-01-18 00:15:38 +01:00
return _SLT_record;
}
static tree
generate_dispatch_table (tree type, const char *name, int size, tree list)
1992-01-18 00:15:38 +01:00
{
Makefile.in (c-parse.o): Depend on $(C_COMMON_H). [gcc/ChangeLog] 2004-09-07 Ziemowit Laski <zlaski@apple.com> * Makefile.in (c-parse.o): Depend on $(C_COMMON_H). * c-parse.in: Include c-common.h instead of objc-act.h. (ivar_decl_list, ivar_decls, ivar_decl, ivars, ivar_declarator, myparms, myparm): Remove %type declarations. (methodtype, optparms, OBJC_TYPE_QUAL, objc_quals, objc_qual, objc_typename, objc_try_catch_stmt, optellipsis): Add %type declarations. (objc_inherit_code, objc_public_flag): Remove. (typespec_nonreserved_nonattr): Call objc_get_protocol_qualified_type() instead of get_static_reference() and get_protocol_reference(). (stmt_nocomp): Call grokparm() on @catch parameter. (objcdef): Move semantic action to objc_finish_implementation(). (classdef): Move semantic action to objc_start_class_interface(), objc_continue_interface(), objc_finish_interface(), objc_start_class_implementation(), objc_continue_implementation(), objc_start_category_interface() and objc_start_category_implementation(). (protocoldef): Move semantic actions to objc_start_protocol() and objc_finish_interface(). (ivar_decl_list): Remove nonterminal. (visibility_spec): Move semantic actions to objc_set_visibility(). (ivar_decls): Remove assignment to $$. (ivar_decl): Rephrase in terms of component_decl; call objc_add_instance_variable(). (ivars, ivar_declarator): Remove nonterminals. (opt_semi): New nonterminal. (methodtype): Remove semantic actions. (methoddef): Move semantic actions to objc_set_method_type(), objc_start_method_definition() and objc_finish_method_definition(). (methodproto): Move semantic actions to objc_set_method_type() and objc_add_method_declaration(). (methoddecl): Use objc_typename instead of typename; move semantic actions to objc_build_method_signature(). (optarglist, myxdecls, mydecl, myparms, myparm): Remove nonterminals. (optparmlist): Express in terms of optparms and optellipsis. (optparms, optellipsis, objc_qual, objc_quals, objc_typename): New nonterminals. (keyworddecl): Use objc_typename instead of typename. (rid_to_yy): Mark RID_IN, RID_OUT, RID_INOUT, RID_BYCOPY, RID_BYREF and RID_ONEWAY as returning OBJC_TYPE_QUAL to yyparse(). [gcc/objc/ChangeLog] 2004-09-07 Ziemowit Laski <zlaski@apple.com> * Make-lang.in (objc/objc-parse.o): Depend on $(C_COMMON_H) instead of objc/objc-act.h. (objc/objc-act.o): Depend on $(HASHTAB_H). * objc-act.c: Include hashtab.h; in ObjC++ mode, include cp-tree.h and objcp-decl.h instead of c-tree.h. (build_module_descriptor, get_class_ivars, synth_id_with_class_suffix, error_with_ivar, gen_method_decl, gen_declaration, setup_string_decl, build_protocol_template): Adjust prototypes. (build_module_initializer_routine, start_class, continue_class, finish_class, start_method_def, objc_start_function, start_protocol, build_method_decl, objc_add_method, add_instance_variable, build_ivar_reference, is_ivar, is_private, get_super_receiver, build_selector_table_decl, objc_push_parm, objc_get_parm_info, gen_type_name, gen_type_name_0, start_var_decl, finish_var_decl, create_field_decl): New prototypes. (objc_expand_function_end, comp_method_with_proto, objc_expr_last, gen_declaration_1, gen_declarator, is_complex_decl, adorn_decl, define_decl, create_builtin_decl, gen_declspecs): Remove prototypes. (TYPE_ID): Rename to OBJECT_TYPEDEF_NAME. (CLASS_TYPEDEF_NAME): New. (TAG_EXECCLASS): Change from a global variable to a #define. (TAG_RETURN_STRUCT): Delete. (TAG_GNUINIT): New, holds '__objc_gnu_init' name. (objc_inherit_code, objc_public_flag): New, moved from c-parse.in. (string_descriptor): New struct. (string_htab): New hash table. (string_hash, string_eq): New prototypes. (generate_struct_by_value_array): Call create_field_decl() instead of create_builtin_decl(). (objc_init): Do not initialize objc_ellipsis_node or TAG_EXECCLASS; In ObjC++ mode, call cxx_init() instead of c_objc_common_init(). (objc_finish_file): In ObjC++, call instantiate_pending_templates() and cp_finish_file(). (define_decl, get_static_reference, get_protocol_reference, create_builtin_decl): Remove functions. (objc_start_class_interface, objc_start_category_interface, objc_start_protocol, objc_continue_interface, objc_finish_interface, objc_start_class_implementation, objc_start_category_implementation, objc_continue_implementation, objc_finish_implementation, objc_set_visibility, objc_set_method_type, objc_build_method_signature, objc_add_method_declaration, objc_start_method_definition, objc_add_instance_variable, objc_get_protocol_qualified_type, create_field_decl, start_var_decl, finish_var_decl): New functions. (setup_string_decl): Simplify since it is only called once. (synth_module_prologue): Call build_class_template(); predefine 'id' and 'Class' as typedefs; rename 'temp_type' to 'type'; disable debug hooks for duration of function; fix GNU runtime messenger signatures to correspond to reality; forward-declare '__objc_exec_class' for the GNU runtime; call build_selector_table_decl(); in ObjC++ mode, generate 'extern "C" { ... }' wrappers around synthesized declarations; call build_protocol_template() and build_category_template(). (string_hash, string_eq): New functions. (objc_build_string_object): Check metaclass correctness only once; store string literals in hash table. (objc_build_constructor): Do not convert initializer elements; adjust for ObjC++ impedance mismatch. (build_objc_symtab_template): Call create_field_decl() instead of create_builtin_decl(). (init_objc_symtab): Add missing conversion to initializer element. (build_metadata_decl): Call start_var_decl() instead of define_decl(). (generate_objc_symtab_decl): Do not call build_category_template(); call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(). (build_module_descriptor): Call create_field_decl() instead of grokfield(); call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(); always mark module descriptor as used; move GNU runtime-specific functionality to build_module_initializer_routine(). (build_module_initializer_routine): New function, broken off of build_module_descriptor(). (objc_static_init_needed_p, objc_generate_static_init_call): New functions. (generate_static_references, generate_strings, build_selector_translation_table, generate_descriptor_table, generate_ivars_list, generate_dispatch_table, generate_category): Call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(); build a type directly instead of via groktypename(). (build_selector_reference_decl, build_selector_table_decl, build_class_reference_decl, build_protocol_reference, generate_objc_image_info): Call start_var_decl() instead of build_decl(). (build_selector_reference): For GNU runtime, do not call build_selector_reference_decl(). (build_selector, build_typed_selector_reference): Always convert result to the selector type. (add_objc_string): Cast return value to 'char *'. (build_method_prototype_template, build_selector_template, build_method_template): Use actual selector type for fields pointing to selectors. (finish_objc): For GNU runtime, call build_module_initializer_routine() after build_module_descriptor(). (generate_protocol_list, generate_shared_structures): Call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(); build a type directly instead of via groktypename(). (synth_id_with_class_suffix): Return a string. (get_arg_type_list): For instance methods, use the instance type for 'self'; do not call groktypename_in_parm_context(). (build_objc_string_decl): Squash redeclaration errors in ObjC++. (objc_is_class_name): Use OBJC_TYPE_NAME instead of TYPE_NAME; handle RECORD_TYPEs in ObjC as well as ObjC++. (objc_is_id): New function. (objc_is_object_ptr): Return the canonical type node. (objc_get_class_ivars): Simplify using get_class_ivars(). (get_class_ivars): Remove second parameter; create a fresh copy of the ivar list for each call; do not check for existence of super class. (objc_eh_runtime_type): Mark #ifndef OBJCPLUS. (objc_init_exceptions): When using SJLJ-style exceptions, require the use of '-fobjc-exceptions' flag; do not require it for DWARF-style exceptions. (objc_build_exc_ptr, next_sjlj_build_try_catch_finally): Use objc_object_type instead of objc_id_type. (objc_begin_catch_clause): Convert the incoming PARM_DECL into a VAR_DECL before placing it in the appropriate scope; do not call define_decl(); adjust call to c_begin_compound_stmt(); use objc_object_type instead of objc_id_type. (build_next_objc_exception_stuff): Call create_field_decl() instead of create_builtin_decl(); construct type directly instead of calling groktypename(); use OBJC_VOID_AT_END to mark end of function parameters. (build_private_template): Adjust call to get_class_ivars(); build a type directly instead of via groktypename(). (build_protocol_template, build_method_prototype_list_template, build_method_prototype_template, build_category_template, build_selector_template, build_class_template, build_super_template, build_ivar_template, build_ivar_list_template, build_method_list_template, build_method_template): Call create_field_decl() instead of grokfield(). (objc_method_parm_type): Do not call groktypename(). (generate_descriptor_table): Call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(). (generate_method_descriptors, build_protocol_initializer, generate_dispatch_tables, build_category_initializer, build_shared_structure_initializer): Do not call groktypename(). (generate_protocols): Call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(); do not call groktypename(). (error_with_ivar): Remove last parameter. (check_ivars): Do not iterate ovar CLASS_RAW_IVARS lists in addition to CLASS_IVARS lists; adjust calls to error_with_ivar(). (generate_ivar_lists): Convert one of the initializer elements; do not call groktypename(). (get_arg_type_list, start_method_def, gen_method_def): Account for new representation of variable arguments and '...' in Objective-C methods; add Objective-C++ impedance matching code. (is_objc_type_qualifier): Remove function. (adjust_type_for_id_default): Simplify; there is no longer a need to wade through declspecs. (lookup_interface, start_class, continue_class, finish_class, start_method_def, start_protocol, build_method_decl, objc_add_method, add_instance_variable, build_ivar_reference, is_ivar, is_private, get_super_receiver, objc_build_finally_epilogue): Make into static functions. (receiver_is_class_object): Use new IS_CLASS() macro. (objc_build_message_expr): Tweak ObjC++ message argument handling; call objc_finish_message_expr() instead of finish_message_expr(). (finish_message_expr): Rename to objc_finish_message_expr(); use OBJC_TYPE_NAME and OBJC_SET_TYPE_NAME macros instead of TYPE_NAME. call gen_type_name() instead of gen_declaration(); call objc_is_id() instead of using IS_ID and IS_CLASS; Use objc_class_name instead of calling get_identifier("Class"); handle CONVERT_EXPRs in receiver. (build_objc_method_call, warn_with_method): Do not call groktypename(). (build_ivar_reference): Call convert() instead of clobbering in a type. (hash_init): Initialize string_htab hash table. (add_instance_variable): Simplify parameter list; do not call grokfield(); do not populate CLASS_IVARS list. (start_class): Check for the existence of super class, if one was specified. (continue_class): Use CLASS_RAW_IVARS rather than CLASS_IVARS; do not call build_class_template(); adjust call to get_class_ivars(); call build_decl(), pushdecl() and finish_decl() instead of define_decl(). (finish_class): Call build_decl(), pushdecl() and finish_decl() instead of define_decl(). (add_protocols): Use PROTOCOL_BINFO_ELTS for the tree vector size. (start_protocol): Do not call build_protocol_template(); use PROTOCOL_BINFO_ELTS for the tree vector size. (encode_type_qualifiers): Do not handle the 'const' qualifier here. (encode_pointer): Encode 'const char *' as 'r*', for backwards compatibility. (encode_array): Use HOST_WIDE_INT_PRINT_DEC instead of "%ld". (encode_type): Handle the 'const' qualifier here. (objc_parmlist): New global variable, sued by objc_push_parm and objc_get_parm_info(). (objc_push_parm, objc_get_parm_info): New functions. (objc_expr_last): Remove function. (synth_self_and_ucmd_args): For instance methods, use the instance type for 'self'; call objc_push_parm() instead of push_parm_decl(). (start_method_def): Do not call push_scope(), declare_parm_level(), pop_scope(), push_parm_decl(), store_parm_decls() or objc_expr_last(); just use objc_push_parm() and objc_get_parm_info(). (comp_method_with_proto): Remove function. (objc_types_are_equivalent): Strip away indirections before comparing underlying types. (comp_proto_with_proto): Do not call groktypename(); types are no longer in raw declspec format. (objc_start_function): New function. (really_start_method): Call comp_proto_with_proto() instead of comp_method_with_proto(); call objc_start_function() instead of hand-crafting a function declarator. (continue_method_def, objc_expand_function_end): Remove functions. (get_super_receiver): Call objc_get_current_scope() instead of get_current_scope(); reference 'super_class' field (instead of 'class'). (finish_method_def): Rename to objc_finish_method_definition() and add a function decl parameter; move method encoding call from objc_expand_function_end(). (is_complex_decl, adorn_decl, gen_declarator, gen_declspecs, gen_declaration_1): Remove functions. (tmpbuf, RAW_DECLSPEC): Remove. (gen_declaration): Remove second parameter; simplify to deal with TYPE_P nodes instead of raw declspecs. (gen_type_name, gen_type_name_0): New functions. (gen_method_decl): Remove second parameter; call gen_type_name() instead of gen_declaration_1(). (dump_interface): Adjust calls to gen_declaration() and gen_method_decl(); do not allocate a separate string buffer. (init_objc): Allocate a larger string buffer to accommodate dump_interface(); adjust call to build_module_descriptor(); add call to build_module_initializer_routine() for the GNU runtime. (generate_classref_translation_entry): Do not call start_decl(); call finish_var_decl() instead of finish_decl(); call convert() instead of build_c_cast(). * objc-act.h (CLASS_OWN_IVARS): Remove accessor. (CLASS_BINFO_ELTS): Reduce from 6 to 5, now that CLASS_OWN_IVARS is gone. (OCTI_GNU_INIT_DECL, GNU_INIT_decl): New. (OCTI_ELLIPSIS_NODE, objc_ellipsis_node): Remove. (OCTI_ID_ID, id_type, objc_id_id): Rename to OCTI_ID_NAME, objc_object_type and objc_object_name, respectively. (OCTI_CLS_REF, OCTI_CLASS_NAME, objc_class_reference, objc_class_name): New. (IS_CLASS): New macro. (IS_ID, IS_SUPER): Robustify. (OCTI_EXECCLASS_DECL, execclass_decl): New. (finish_file, start_class, continue_class, finish_class, start_method_def, continue_method_def, finish_method_def, start_protocol, finish_protocol, objc_build_throw_stmt, objc_build_try_catch_finally_stmt, objc_build_synchronized_prologue, objc_build_synchronized_epilogue, objc_build_try_prologue, objc_build_try_epilogue, objc_build_catch_stmt, objc_build_catch_epilogue, objc_build_finally_prologue, objc_build_finally_epilogue, is_ivar, is_private, is_public, add_instance_variable, objc_add_method, get_super_receiver, objc_clear_super_receiver, get_class_ivars_from_name, get_class_reference, get_static_reference, get_object_reference, build_message_expr, finish_message_expr, build_selector_expr, build_ivar_reference, build_keyword_decl, build_method_decl, build_protocol_expr, build_objc_string_object, objc_declare_alias, objc_declare_class, objc_declare_protocols, objc_comptypes, objc_check_decl, build_encode_expr): Remove prototypes. (imp_count, cat_count): Make GGC-aware. (OBJC_SET_TYPE_NAME): New macro. From-SVN: r87168
2004-09-08 02:49:44 +02:00
tree decl, initlist;
1992-01-18 00:15:38 +01:00
Makefile.in (c-parse.o): Depend on $(C_COMMON_H). [gcc/ChangeLog] 2004-09-07 Ziemowit Laski <zlaski@apple.com> * Makefile.in (c-parse.o): Depend on $(C_COMMON_H). * c-parse.in: Include c-common.h instead of objc-act.h. (ivar_decl_list, ivar_decls, ivar_decl, ivars, ivar_declarator, myparms, myparm): Remove %type declarations. (methodtype, optparms, OBJC_TYPE_QUAL, objc_quals, objc_qual, objc_typename, objc_try_catch_stmt, optellipsis): Add %type declarations. (objc_inherit_code, objc_public_flag): Remove. (typespec_nonreserved_nonattr): Call objc_get_protocol_qualified_type() instead of get_static_reference() and get_protocol_reference(). (stmt_nocomp): Call grokparm() on @catch parameter. (objcdef): Move semantic action to objc_finish_implementation(). (classdef): Move semantic action to objc_start_class_interface(), objc_continue_interface(), objc_finish_interface(), objc_start_class_implementation(), objc_continue_implementation(), objc_start_category_interface() and objc_start_category_implementation(). (protocoldef): Move semantic actions to objc_start_protocol() and objc_finish_interface(). (ivar_decl_list): Remove nonterminal. (visibility_spec): Move semantic actions to objc_set_visibility(). (ivar_decls): Remove assignment to $$. (ivar_decl): Rephrase in terms of component_decl; call objc_add_instance_variable(). (ivars, ivar_declarator): Remove nonterminals. (opt_semi): New nonterminal. (methodtype): Remove semantic actions. (methoddef): Move semantic actions to objc_set_method_type(), objc_start_method_definition() and objc_finish_method_definition(). (methodproto): Move semantic actions to objc_set_method_type() and objc_add_method_declaration(). (methoddecl): Use objc_typename instead of typename; move semantic actions to objc_build_method_signature(). (optarglist, myxdecls, mydecl, myparms, myparm): Remove nonterminals. (optparmlist): Express in terms of optparms and optellipsis. (optparms, optellipsis, objc_qual, objc_quals, objc_typename): New nonterminals. (keyworddecl): Use objc_typename instead of typename. (rid_to_yy): Mark RID_IN, RID_OUT, RID_INOUT, RID_BYCOPY, RID_BYREF and RID_ONEWAY as returning OBJC_TYPE_QUAL to yyparse(). [gcc/objc/ChangeLog] 2004-09-07 Ziemowit Laski <zlaski@apple.com> * Make-lang.in (objc/objc-parse.o): Depend on $(C_COMMON_H) instead of objc/objc-act.h. (objc/objc-act.o): Depend on $(HASHTAB_H). * objc-act.c: Include hashtab.h; in ObjC++ mode, include cp-tree.h and objcp-decl.h instead of c-tree.h. (build_module_descriptor, get_class_ivars, synth_id_with_class_suffix, error_with_ivar, gen_method_decl, gen_declaration, setup_string_decl, build_protocol_template): Adjust prototypes. (build_module_initializer_routine, start_class, continue_class, finish_class, start_method_def, objc_start_function, start_protocol, build_method_decl, objc_add_method, add_instance_variable, build_ivar_reference, is_ivar, is_private, get_super_receiver, build_selector_table_decl, objc_push_parm, objc_get_parm_info, gen_type_name, gen_type_name_0, start_var_decl, finish_var_decl, create_field_decl): New prototypes. (objc_expand_function_end, comp_method_with_proto, objc_expr_last, gen_declaration_1, gen_declarator, is_complex_decl, adorn_decl, define_decl, create_builtin_decl, gen_declspecs): Remove prototypes. (TYPE_ID): Rename to OBJECT_TYPEDEF_NAME. (CLASS_TYPEDEF_NAME): New. (TAG_EXECCLASS): Change from a global variable to a #define. (TAG_RETURN_STRUCT): Delete. (TAG_GNUINIT): New, holds '__objc_gnu_init' name. (objc_inherit_code, objc_public_flag): New, moved from c-parse.in. (string_descriptor): New struct. (string_htab): New hash table. (string_hash, string_eq): New prototypes. (generate_struct_by_value_array): Call create_field_decl() instead of create_builtin_decl(). (objc_init): Do not initialize objc_ellipsis_node or TAG_EXECCLASS; In ObjC++ mode, call cxx_init() instead of c_objc_common_init(). (objc_finish_file): In ObjC++, call instantiate_pending_templates() and cp_finish_file(). (define_decl, get_static_reference, get_protocol_reference, create_builtin_decl): Remove functions. (objc_start_class_interface, objc_start_category_interface, objc_start_protocol, objc_continue_interface, objc_finish_interface, objc_start_class_implementation, objc_start_category_implementation, objc_continue_implementation, objc_finish_implementation, objc_set_visibility, objc_set_method_type, objc_build_method_signature, objc_add_method_declaration, objc_start_method_definition, objc_add_instance_variable, objc_get_protocol_qualified_type, create_field_decl, start_var_decl, finish_var_decl): New functions. (setup_string_decl): Simplify since it is only called once. (synth_module_prologue): Call build_class_template(); predefine 'id' and 'Class' as typedefs; rename 'temp_type' to 'type'; disable debug hooks for duration of function; fix GNU runtime messenger signatures to correspond to reality; forward-declare '__objc_exec_class' for the GNU runtime; call build_selector_table_decl(); in ObjC++ mode, generate 'extern "C" { ... }' wrappers around synthesized declarations; call build_protocol_template() and build_category_template(). (string_hash, string_eq): New functions. (objc_build_string_object): Check metaclass correctness only once; store string literals in hash table. (objc_build_constructor): Do not convert initializer elements; adjust for ObjC++ impedance mismatch. (build_objc_symtab_template): Call create_field_decl() instead of create_builtin_decl(). (init_objc_symtab): Add missing conversion to initializer element. (build_metadata_decl): Call start_var_decl() instead of define_decl(). (generate_objc_symtab_decl): Do not call build_category_template(); call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(). (build_module_descriptor): Call create_field_decl() instead of grokfield(); call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(); always mark module descriptor as used; move GNU runtime-specific functionality to build_module_initializer_routine(). (build_module_initializer_routine): New function, broken off of build_module_descriptor(). (objc_static_init_needed_p, objc_generate_static_init_call): New functions. (generate_static_references, generate_strings, build_selector_translation_table, generate_descriptor_table, generate_ivars_list, generate_dispatch_table, generate_category): Call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(); build a type directly instead of via groktypename(). (build_selector_reference_decl, build_selector_table_decl, build_class_reference_decl, build_protocol_reference, generate_objc_image_info): Call start_var_decl() instead of build_decl(). (build_selector_reference): For GNU runtime, do not call build_selector_reference_decl(). (build_selector, build_typed_selector_reference): Always convert result to the selector type. (add_objc_string): Cast return value to 'char *'. (build_method_prototype_template, build_selector_template, build_method_template): Use actual selector type for fields pointing to selectors. (finish_objc): For GNU runtime, call build_module_initializer_routine() after build_module_descriptor(). (generate_protocol_list, generate_shared_structures): Call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(); build a type directly instead of via groktypename(). (synth_id_with_class_suffix): Return a string. (get_arg_type_list): For instance methods, use the instance type for 'self'; do not call groktypename_in_parm_context(). (build_objc_string_decl): Squash redeclaration errors in ObjC++. (objc_is_class_name): Use OBJC_TYPE_NAME instead of TYPE_NAME; handle RECORD_TYPEs in ObjC as well as ObjC++. (objc_is_id): New function. (objc_is_object_ptr): Return the canonical type node. (objc_get_class_ivars): Simplify using get_class_ivars(). (get_class_ivars): Remove second parameter; create a fresh copy of the ivar list for each call; do not check for existence of super class. (objc_eh_runtime_type): Mark #ifndef OBJCPLUS. (objc_init_exceptions): When using SJLJ-style exceptions, require the use of '-fobjc-exceptions' flag; do not require it for DWARF-style exceptions. (objc_build_exc_ptr, next_sjlj_build_try_catch_finally): Use objc_object_type instead of objc_id_type. (objc_begin_catch_clause): Convert the incoming PARM_DECL into a VAR_DECL before placing it in the appropriate scope; do not call define_decl(); adjust call to c_begin_compound_stmt(); use objc_object_type instead of objc_id_type. (build_next_objc_exception_stuff): Call create_field_decl() instead of create_builtin_decl(); construct type directly instead of calling groktypename(); use OBJC_VOID_AT_END to mark end of function parameters. (build_private_template): Adjust call to get_class_ivars(); build a type directly instead of via groktypename(). (build_protocol_template, build_method_prototype_list_template, build_method_prototype_template, build_category_template, build_selector_template, build_class_template, build_super_template, build_ivar_template, build_ivar_list_template, build_method_list_template, build_method_template): Call create_field_decl() instead of grokfield(). (objc_method_parm_type): Do not call groktypename(). (generate_descriptor_table): Call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(). (generate_method_descriptors, build_protocol_initializer, generate_dispatch_tables, build_category_initializer, build_shared_structure_initializer): Do not call groktypename(). (generate_protocols): Call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(); do not call groktypename(). (error_with_ivar): Remove last parameter. (check_ivars): Do not iterate ovar CLASS_RAW_IVARS lists in addition to CLASS_IVARS lists; adjust calls to error_with_ivar(). (generate_ivar_lists): Convert one of the initializer elements; do not call groktypename(). (get_arg_type_list, start_method_def, gen_method_def): Account for new representation of variable arguments and '...' in Objective-C methods; add Objective-C++ impedance matching code. (is_objc_type_qualifier): Remove function. (adjust_type_for_id_default): Simplify; there is no longer a need to wade through declspecs. (lookup_interface, start_class, continue_class, finish_class, start_method_def, start_protocol, build_method_decl, objc_add_method, add_instance_variable, build_ivar_reference, is_ivar, is_private, get_super_receiver, objc_build_finally_epilogue): Make into static functions. (receiver_is_class_object): Use new IS_CLASS() macro. (objc_build_message_expr): Tweak ObjC++ message argument handling; call objc_finish_message_expr() instead of finish_message_expr(). (finish_message_expr): Rename to objc_finish_message_expr(); use OBJC_TYPE_NAME and OBJC_SET_TYPE_NAME macros instead of TYPE_NAME. call gen_type_name() instead of gen_declaration(); call objc_is_id() instead of using IS_ID and IS_CLASS; Use objc_class_name instead of calling get_identifier("Class"); handle CONVERT_EXPRs in receiver. (build_objc_method_call, warn_with_method): Do not call groktypename(). (build_ivar_reference): Call convert() instead of clobbering in a type. (hash_init): Initialize string_htab hash table. (add_instance_variable): Simplify parameter list; do not call grokfield(); do not populate CLASS_IVARS list. (start_class): Check for the existence of super class, if one was specified. (continue_class): Use CLASS_RAW_IVARS rather than CLASS_IVARS; do not call build_class_template(); adjust call to get_class_ivars(); call build_decl(), pushdecl() and finish_decl() instead of define_decl(). (finish_class): Call build_decl(), pushdecl() and finish_decl() instead of define_decl(). (add_protocols): Use PROTOCOL_BINFO_ELTS for the tree vector size. (start_protocol): Do not call build_protocol_template(); use PROTOCOL_BINFO_ELTS for the tree vector size. (encode_type_qualifiers): Do not handle the 'const' qualifier here. (encode_pointer): Encode 'const char *' as 'r*', for backwards compatibility. (encode_array): Use HOST_WIDE_INT_PRINT_DEC instead of "%ld". (encode_type): Handle the 'const' qualifier here. (objc_parmlist): New global variable, sued by objc_push_parm and objc_get_parm_info(). (objc_push_parm, objc_get_parm_info): New functions. (objc_expr_last): Remove function. (synth_self_and_ucmd_args): For instance methods, use the instance type for 'self'; call objc_push_parm() instead of push_parm_decl(). (start_method_def): Do not call push_scope(), declare_parm_level(), pop_scope(), push_parm_decl(), store_parm_decls() or objc_expr_last(); just use objc_push_parm() and objc_get_parm_info(). (comp_method_with_proto): Remove function. (objc_types_are_equivalent): Strip away indirections before comparing underlying types. (comp_proto_with_proto): Do not call groktypename(); types are no longer in raw declspec format. (objc_start_function): New function. (really_start_method): Call comp_proto_with_proto() instead of comp_method_with_proto(); call objc_start_function() instead of hand-crafting a function declarator. (continue_method_def, objc_expand_function_end): Remove functions. (get_super_receiver): Call objc_get_current_scope() instead of get_current_scope(); reference 'super_class' field (instead of 'class'). (finish_method_def): Rename to objc_finish_method_definition() and add a function decl parameter; move method encoding call from objc_expand_function_end(). (is_complex_decl, adorn_decl, gen_declarator, gen_declspecs, gen_declaration_1): Remove functions. (tmpbuf, RAW_DECLSPEC): Remove. (gen_declaration): Remove second parameter; simplify to deal with TYPE_P nodes instead of raw declspecs. (gen_type_name, gen_type_name_0): New functions. (gen_method_decl): Remove second parameter; call gen_type_name() instead of gen_declaration_1(). (dump_interface): Adjust calls to gen_declaration() and gen_method_decl(); do not allocate a separate string buffer. (init_objc): Allocate a larger string buffer to accommodate dump_interface(); adjust call to build_module_descriptor(); add call to build_module_initializer_routine() for the GNU runtime. (generate_classref_translation_entry): Do not call start_decl(); call finish_var_decl() instead of finish_decl(); call convert() instead of build_c_cast(). * objc-act.h (CLASS_OWN_IVARS): Remove accessor. (CLASS_BINFO_ELTS): Reduce from 6 to 5, now that CLASS_OWN_IVARS is gone. (OCTI_GNU_INIT_DECL, GNU_INIT_decl): New. (OCTI_ELLIPSIS_NODE, objc_ellipsis_node): Remove. (OCTI_ID_ID, id_type, objc_id_id): Rename to OCTI_ID_NAME, objc_object_type and objc_object_name, respectively. (OCTI_CLS_REF, OCTI_CLASS_NAME, objc_class_reference, objc_class_name): New. (IS_CLASS): New macro. (IS_ID, IS_SUPER): Robustify. (OCTI_EXECCLASS_DECL, execclass_decl): New. (finish_file, start_class, continue_class, finish_class, start_method_def, continue_method_def, finish_method_def, start_protocol, finish_protocol, objc_build_throw_stmt, objc_build_try_catch_finally_stmt, objc_build_synchronized_prologue, objc_build_synchronized_epilogue, objc_build_try_prologue, objc_build_try_epilogue, objc_build_catch_stmt, objc_build_catch_epilogue, objc_build_finally_prologue, objc_build_finally_epilogue, is_ivar, is_private, is_public, add_instance_variable, objc_add_method, get_super_receiver, objc_clear_super_receiver, get_class_ivars_from_name, get_class_reference, get_static_reference, get_object_reference, build_message_expr, finish_message_expr, build_selector_expr, build_ivar_reference, build_keyword_decl, build_method_decl, build_protocol_expr, build_objc_string_object, objc_declare_alias, objc_declare_class, objc_declare_protocols, objc_comptypes, objc_check_decl, build_encode_expr): Remove prototypes. (imp_count, cat_count): Make GGC-aware. (OBJC_SET_TYPE_NAME): New macro. From-SVN: r87168
2004-09-08 02:49:44 +02:00
decl = start_var_decl (type, synth_id_with_class_suffix
(name, objc_implementation_context));
1992-01-18 00:15:38 +01:00
tree.h (build_int_cst): New, sign extended constant. * tree.h (build_int_cst): New, sign extended constant. (build_int_cstu): New, zero extended constant. (build_int_cst_wide): Renamed from build_int_cst. * tree.c (build_int_cst, build_int_cstu): New. (build_int_cst_wide): Renamed from build_int_cst. (make_vector_type, build_common_tree_nodes, build_common_tree_nodes_2): Adjust build_int_cst calls. * builtins.c (expand_builtin_prefetch, expand_builtin_strstr, expand_builtin_strpbrk, expand_builtin_fputs, build_string_literal, expand_builtin_printf, expand_builtin_sprintf, fold_builtin_classify_type, fold_builtin_lround, fold_builtin_bitop, fold_builtin_isascii, fold_builtin_toascii, fold_builtin_isdigit, simplify_builtin_strstr, simplify_builtin_strpbrk, fold_builtin_fputs, simplify_builtin_sprintf): Likewise. * c-common.c (start_fname_decls, fix_string_type, shorten_compare, DEF_ATTR_INT): Likewise. * c-decl.c (complete_array_type, check_bitfield_type_and_width): Likewise. * c-lex.c (interpret_integer, lex_charconst): Likewise. * c-parse.in (primary) <TYPES_COMPATIBLE_P> Likewise. * c-pretty-print.c (pp_c_integer_constant): Likewise. * c-typeck.c (really_start_incremental_init, push_init_level, set_nonincremental_init_from_string): Likewise. * calls.c (load_register_parameters): Likewise. convert.c (convert_to_pointer): Likewise. coverage.c (coverage_counter_alloc, tree_coverage_counter_ref, build_fn_info_type, build_fn_info_value, build_ctr_info_value, build_gcov_info): Likewise. * except.c (init_eh, assign_filter_values): Likewise. * expmed.c (store_fixed_bit_field, extract_bit_field, extract_fixed_bit_field, extract_split_bit_field, expand_shift, expand_mult_const, expand_mult_highpart_adjust, extract_high_half, expand_sdiv_pow2, expand_divmod, make_tree): Likewise. * expr.c (convert_move, emit_group_load, emit_group_store, expand_assignment, store_constructor, store_field, expand_expr_real_1, reduce_to_bit_field_precision): Likewise. fold-const.c (force_fit_type, int_const_binop, fold_convert_const, invert_truthvalue, optimize_bit_field_compare, decode_field_reference, all_ones_mask_p, constant_boolean_node, fold_div_compare, fold, fold_read_from_constant_string, fold_negate_const, fold_abs_const, fold_not_const, round_up, round_down): Likewise. * function.c (assign_parm_setup_block): Likewise. * stmt.c (shift_return_value, expand_case, estimate_case_costs): Likewise. * stor-layout.c (layout_type, initialize_sizetypes, set_min_and_max_values_for_integral_type): Likewise. * tree-chrec.c (chrec_fold_multiply_poly_poly, reset_evolution_in_loop): Likewise. * tree-chrec.h (build_polynomial_chrec): Likewise. * tree-complex.c (build_replicated_const): Likewise. * tree-eh.c (honor_protect_cleanup_actions, lower_try_finally_onedest, lower_try_finally_copy, lower_try_finally_switch): Likewise. * tree-mudflap.c (mf_build_string, mx_register_decls, mudflap_register_call, mudflap_enqueue_constant): Likewise. * tree-nested.c (get_trampoline_type, get_nl_goto_field): Likewise. * tree-pretty-print.c (dump_generic_node): Likewise. * tree-ssa-ccp.c (widen_bitfield, maybe_fold_offset_to_array_ref): Likewise. * tree-ssa-dom.c (simplify_rhs_and_lookup_avail_expr): Likewise. * tree-ssa-loop-niter.c (number_of_iterations_cond, loop_niter_by_eval, upper_bound_in_type, lower_bound_in_type): Likewise. * tree-ssa-loop-ivcanon.c (create_canonical_iv, canonicalize_loop_induction_variables): Likewise. * tree-vectorizer.c (vect_create_index_for_array_ref, vect_transform_loop_bound, vect_compute_data_ref_alignment): Likewise. * config/alpha/alpha.c (alpha_initialize_trampoline, alpha_va_start, alpha_gimplify_va_arg_1): Likewise. * config/arm/arm.c (arm_get_cookie_size): Likewise. * config/c4x/c4x.c (c4x_gimplify_va_arg_expr): Likewise. * config/i386/i386.c (ix86_va_start, ix86_gimplify_va_arg): Likewise. * config/ia64/ia64.c (ia64_gimplify_va_arg): Likewise. * config/mips/mips.c (mips_build_builtin_va_list, mips_va_start, mips_gimplify_va_arg_expr): Likewise. * config/pa/pa.c (hppa_gimplify_va_arg_expr): Likewise. * config/rs6000/rs6000.c (rs6000_va_start, rs6000_gimplify_va_arg, add_compiler_branch_island): Likewise. * config/s390/s390.c (s390_va_start): Likewise. * config/sh/sh.c (sh_va_start): Likewise. * config/stormy16/stormy16.c (xstormy16_expand_builtin_va_start): Likewise. * config/xtensa/xtensa.c (xtensa_va_start, xtensa_gimplify_va_arg_expr): Likewise. * objc/objc-act.c (build_objc_string_object, build_objc_symtab_template, init_def_list, init_objc_symtab, init_module_descriptor, generate_static_references, build_selector_translation_table, get_proto_encoding, build_typed_selector_reference, build_selector_reference, build_next_objc_exception_stuff, build_method_prototype_list_template, generate_descriptor_table, generate_protocols, build_protocol_initializer, build_ivar_list_template, build_method_list_template, build_ivar_list_initializer, generate_ivars_list, generate_dispatch_table, generate_protocol_list, build_category_initializer, build_shared_structure_initializer, generate_shared_structures, handle_impent, generate_objc_image_info): Likewise. 2004-04-25 Paolo Bonzini <bonzini@gnu.org> * cfglayout.c (duplicate_insn_chain): Remove references to NOTE_INSN_LOOP_VTOP and NOTE_INSN_LOOP_CONT. * cfgloop.h (struct loop): Remove fields vtop, cont and cont_dominator. * cfgrtl.c (rtl_delete_block): Remove handling of NOTE_INSN_LOOP_CONT. * final.c (final_scan_insn): Remove references to NOTE_INSN_LOOP_VTOP and NOTE_INSN_LOOP_CONT. * insn-notes.def (NOTE_INSN_LOOP_VTOP, NOTE_INSN_LOOP_CONT): Remove. * jump.c (squeeze_notes): Remove references to NOTE_INSN_LOOP_VTOP and NOTE_INSN_LOOP_CONT. * loop.c (scan_loops, find_and_verify_loops, for_each_insn_in_loop, check_dbra_loop, loop_dump_aux): Remove references to removed notes and fields. * reorg.c (mostly_true_jump): Do not rely on NOTE_INSN_LOOP_VTOPs. * unroll.c (unroll_loop, copy_loop_body, loop_iterations): Remove references to removed notes and fields. (subtract_reg_term, ujump_to_loop_cont): Remove. From-SVN: r86544
2004-08-25 11:52:54 +02:00
initlist = build_tree_list (NULL_TREE, build_int_cst (NULL_TREE, 0));
initlist = tree_cons (NULL_TREE, build_int_cst (NULL_TREE, size), initlist);
initlist = tree_cons (NULL_TREE, list, initlist);
1992-01-18 00:15:38 +01:00
Makefile.in (c-parse.o): Depend on $(C_COMMON_H). [gcc/ChangeLog] 2004-09-07 Ziemowit Laski <zlaski@apple.com> * Makefile.in (c-parse.o): Depend on $(C_COMMON_H). * c-parse.in: Include c-common.h instead of objc-act.h. (ivar_decl_list, ivar_decls, ivar_decl, ivars, ivar_declarator, myparms, myparm): Remove %type declarations. (methodtype, optparms, OBJC_TYPE_QUAL, objc_quals, objc_qual, objc_typename, objc_try_catch_stmt, optellipsis): Add %type declarations. (objc_inherit_code, objc_public_flag): Remove. (typespec_nonreserved_nonattr): Call objc_get_protocol_qualified_type() instead of get_static_reference() and get_protocol_reference(). (stmt_nocomp): Call grokparm() on @catch parameter. (objcdef): Move semantic action to objc_finish_implementation(). (classdef): Move semantic action to objc_start_class_interface(), objc_continue_interface(), objc_finish_interface(), objc_start_class_implementation(), objc_continue_implementation(), objc_start_category_interface() and objc_start_category_implementation(). (protocoldef): Move semantic actions to objc_start_protocol() and objc_finish_interface(). (ivar_decl_list): Remove nonterminal. (visibility_spec): Move semantic actions to objc_set_visibility(). (ivar_decls): Remove assignment to $$. (ivar_decl): Rephrase in terms of component_decl; call objc_add_instance_variable(). (ivars, ivar_declarator): Remove nonterminals. (opt_semi): New nonterminal. (methodtype): Remove semantic actions. (methoddef): Move semantic actions to objc_set_method_type(), objc_start_method_definition() and objc_finish_method_definition(). (methodproto): Move semantic actions to objc_set_method_type() and objc_add_method_declaration(). (methoddecl): Use objc_typename instead of typename; move semantic actions to objc_build_method_signature(). (optarglist, myxdecls, mydecl, myparms, myparm): Remove nonterminals. (optparmlist): Express in terms of optparms and optellipsis. (optparms, optellipsis, objc_qual, objc_quals, objc_typename): New nonterminals. (keyworddecl): Use objc_typename instead of typename. (rid_to_yy): Mark RID_IN, RID_OUT, RID_INOUT, RID_BYCOPY, RID_BYREF and RID_ONEWAY as returning OBJC_TYPE_QUAL to yyparse(). [gcc/objc/ChangeLog] 2004-09-07 Ziemowit Laski <zlaski@apple.com> * Make-lang.in (objc/objc-parse.o): Depend on $(C_COMMON_H) instead of objc/objc-act.h. (objc/objc-act.o): Depend on $(HASHTAB_H). * objc-act.c: Include hashtab.h; in ObjC++ mode, include cp-tree.h and objcp-decl.h instead of c-tree.h. (build_module_descriptor, get_class_ivars, synth_id_with_class_suffix, error_with_ivar, gen_method_decl, gen_declaration, setup_string_decl, build_protocol_template): Adjust prototypes. (build_module_initializer_routine, start_class, continue_class, finish_class, start_method_def, objc_start_function, start_protocol, build_method_decl, objc_add_method, add_instance_variable, build_ivar_reference, is_ivar, is_private, get_super_receiver, build_selector_table_decl, objc_push_parm, objc_get_parm_info, gen_type_name, gen_type_name_0, start_var_decl, finish_var_decl, create_field_decl): New prototypes. (objc_expand_function_end, comp_method_with_proto, objc_expr_last, gen_declaration_1, gen_declarator, is_complex_decl, adorn_decl, define_decl, create_builtin_decl, gen_declspecs): Remove prototypes. (TYPE_ID): Rename to OBJECT_TYPEDEF_NAME. (CLASS_TYPEDEF_NAME): New. (TAG_EXECCLASS): Change from a global variable to a #define. (TAG_RETURN_STRUCT): Delete. (TAG_GNUINIT): New, holds '__objc_gnu_init' name. (objc_inherit_code, objc_public_flag): New, moved from c-parse.in. (string_descriptor): New struct. (string_htab): New hash table. (string_hash, string_eq): New prototypes. (generate_struct_by_value_array): Call create_field_decl() instead of create_builtin_decl(). (objc_init): Do not initialize objc_ellipsis_node or TAG_EXECCLASS; In ObjC++ mode, call cxx_init() instead of c_objc_common_init(). (objc_finish_file): In ObjC++, call instantiate_pending_templates() and cp_finish_file(). (define_decl, get_static_reference, get_protocol_reference, create_builtin_decl): Remove functions. (objc_start_class_interface, objc_start_category_interface, objc_start_protocol, objc_continue_interface, objc_finish_interface, objc_start_class_implementation, objc_start_category_implementation, objc_continue_implementation, objc_finish_implementation, objc_set_visibility, objc_set_method_type, objc_build_method_signature, objc_add_method_declaration, objc_start_method_definition, objc_add_instance_variable, objc_get_protocol_qualified_type, create_field_decl, start_var_decl, finish_var_decl): New functions. (setup_string_decl): Simplify since it is only called once. (synth_module_prologue): Call build_class_template(); predefine 'id' and 'Class' as typedefs; rename 'temp_type' to 'type'; disable debug hooks for duration of function; fix GNU runtime messenger signatures to correspond to reality; forward-declare '__objc_exec_class' for the GNU runtime; call build_selector_table_decl(); in ObjC++ mode, generate 'extern "C" { ... }' wrappers around synthesized declarations; call build_protocol_template() and build_category_template(). (string_hash, string_eq): New functions. (objc_build_string_object): Check metaclass correctness only once; store string literals in hash table. (objc_build_constructor): Do not convert initializer elements; adjust for ObjC++ impedance mismatch. (build_objc_symtab_template): Call create_field_decl() instead of create_builtin_decl(). (init_objc_symtab): Add missing conversion to initializer element. (build_metadata_decl): Call start_var_decl() instead of define_decl(). (generate_objc_symtab_decl): Do not call build_category_template(); call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(). (build_module_descriptor): Call create_field_decl() instead of grokfield(); call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(); always mark module descriptor as used; move GNU runtime-specific functionality to build_module_initializer_routine(). (build_module_initializer_routine): New function, broken off of build_module_descriptor(). (objc_static_init_needed_p, objc_generate_static_init_call): New functions. (generate_static_references, generate_strings, build_selector_translation_table, generate_descriptor_table, generate_ivars_list, generate_dispatch_table, generate_category): Call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(); build a type directly instead of via groktypename(). (build_selector_reference_decl, build_selector_table_decl, build_class_reference_decl, build_protocol_reference, generate_objc_image_info): Call start_var_decl() instead of build_decl(). (build_selector_reference): For GNU runtime, do not call build_selector_reference_decl(). (build_selector, build_typed_selector_reference): Always convert result to the selector type. (add_objc_string): Cast return value to 'char *'. (build_method_prototype_template, build_selector_template, build_method_template): Use actual selector type for fields pointing to selectors. (finish_objc): For GNU runtime, call build_module_initializer_routine() after build_module_descriptor(). (generate_protocol_list, generate_shared_structures): Call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(); build a type directly instead of via groktypename(). (synth_id_with_class_suffix): Return a string. (get_arg_type_list): For instance methods, use the instance type for 'self'; do not call groktypename_in_parm_context(). (build_objc_string_decl): Squash redeclaration errors in ObjC++. (objc_is_class_name): Use OBJC_TYPE_NAME instead of TYPE_NAME; handle RECORD_TYPEs in ObjC as well as ObjC++. (objc_is_id): New function. (objc_is_object_ptr): Return the canonical type node. (objc_get_class_ivars): Simplify using get_class_ivars(). (get_class_ivars): Remove second parameter; create a fresh copy of the ivar list for each call; do not check for existence of super class. (objc_eh_runtime_type): Mark #ifndef OBJCPLUS. (objc_init_exceptions): When using SJLJ-style exceptions, require the use of '-fobjc-exceptions' flag; do not require it for DWARF-style exceptions. (objc_build_exc_ptr, next_sjlj_build_try_catch_finally): Use objc_object_type instead of objc_id_type. (objc_begin_catch_clause): Convert the incoming PARM_DECL into a VAR_DECL before placing it in the appropriate scope; do not call define_decl(); adjust call to c_begin_compound_stmt(); use objc_object_type instead of objc_id_type. (build_next_objc_exception_stuff): Call create_field_decl() instead of create_builtin_decl(); construct type directly instead of calling groktypename(); use OBJC_VOID_AT_END to mark end of function parameters. (build_private_template): Adjust call to get_class_ivars(); build a type directly instead of via groktypename(). (build_protocol_template, build_method_prototype_list_template, build_method_prototype_template, build_category_template, build_selector_template, build_class_template, build_super_template, build_ivar_template, build_ivar_list_template, build_method_list_template, build_method_template): Call create_field_decl() instead of grokfield(). (objc_method_parm_type): Do not call groktypename(). (generate_descriptor_table): Call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(). (generate_method_descriptors, build_protocol_initializer, generate_dispatch_tables, build_category_initializer, build_shared_structure_initializer): Do not call groktypename(). (generate_protocols): Call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(); do not call groktypename(). (error_with_ivar): Remove last parameter. (check_ivars): Do not iterate ovar CLASS_RAW_IVARS lists in addition to CLASS_IVARS lists; adjust calls to error_with_ivar(). (generate_ivar_lists): Convert one of the initializer elements; do not call groktypename(). (get_arg_type_list, start_method_def, gen_method_def): Account for new representation of variable arguments and '...' in Objective-C methods; add Objective-C++ impedance matching code. (is_objc_type_qualifier): Remove function. (adjust_type_for_id_default): Simplify; there is no longer a need to wade through declspecs. (lookup_interface, start_class, continue_class, finish_class, start_method_def, start_protocol, build_method_decl, objc_add_method, add_instance_variable, build_ivar_reference, is_ivar, is_private, get_super_receiver, objc_build_finally_epilogue): Make into static functions. (receiver_is_class_object): Use new IS_CLASS() macro. (objc_build_message_expr): Tweak ObjC++ message argument handling; call objc_finish_message_expr() instead of finish_message_expr(). (finish_message_expr): Rename to objc_finish_message_expr(); use OBJC_TYPE_NAME and OBJC_SET_TYPE_NAME macros instead of TYPE_NAME. call gen_type_name() instead of gen_declaration(); call objc_is_id() instead of using IS_ID and IS_CLASS; Use objc_class_name instead of calling get_identifier("Class"); handle CONVERT_EXPRs in receiver. (build_objc_method_call, warn_with_method): Do not call groktypename(). (build_ivar_reference): Call convert() instead of clobbering in a type. (hash_init): Initialize string_htab hash table. (add_instance_variable): Simplify parameter list; do not call grokfield(); do not populate CLASS_IVARS list. (start_class): Check for the existence of super class, if one was specified. (continue_class): Use CLASS_RAW_IVARS rather than CLASS_IVARS; do not call build_class_template(); adjust call to get_class_ivars(); call build_decl(), pushdecl() and finish_decl() instead of define_decl(). (finish_class): Call build_decl(), pushdecl() and finish_decl() instead of define_decl(). (add_protocols): Use PROTOCOL_BINFO_ELTS for the tree vector size. (start_protocol): Do not call build_protocol_template(); use PROTOCOL_BINFO_ELTS for the tree vector size. (encode_type_qualifiers): Do not handle the 'const' qualifier here. (encode_pointer): Encode 'const char *' as 'r*', for backwards compatibility. (encode_array): Use HOST_WIDE_INT_PRINT_DEC instead of "%ld". (encode_type): Handle the 'const' qualifier here. (objc_parmlist): New global variable, sued by objc_push_parm and objc_get_parm_info(). (objc_push_parm, objc_get_parm_info): New functions. (objc_expr_last): Remove function. (synth_self_and_ucmd_args): For instance methods, use the instance type for 'self'; call objc_push_parm() instead of push_parm_decl(). (start_method_def): Do not call push_scope(), declare_parm_level(), pop_scope(), push_parm_decl(), store_parm_decls() or objc_expr_last(); just use objc_push_parm() and objc_get_parm_info(). (comp_method_with_proto): Remove function. (objc_types_are_equivalent): Strip away indirections before comparing underlying types. (comp_proto_with_proto): Do not call groktypename(); types are no longer in raw declspec format. (objc_start_function): New function. (really_start_method): Call comp_proto_with_proto() instead of comp_method_with_proto(); call objc_start_function() instead of hand-crafting a function declarator. (continue_method_def, objc_expand_function_end): Remove functions. (get_super_receiver): Call objc_get_current_scope() instead of get_current_scope(); reference 'super_class' field (instead of 'class'). (finish_method_def): Rename to objc_finish_method_definition() and add a function decl parameter; move method encoding call from objc_expand_function_end(). (is_complex_decl, adorn_decl, gen_declarator, gen_declspecs, gen_declaration_1): Remove functions. (tmpbuf, RAW_DECLSPEC): Remove. (gen_declaration): Remove second parameter; simplify to deal with TYPE_P nodes instead of raw declspecs. (gen_type_name, gen_type_name_0): New functions. (gen_method_decl): Remove second parameter; call gen_type_name() instead of gen_declaration_1(). (dump_interface): Adjust calls to gen_declaration() and gen_method_decl(); do not allocate a separate string buffer. (init_objc): Allocate a larger string buffer to accommodate dump_interface(); adjust call to build_module_descriptor(); add call to build_module_initializer_routine() for the GNU runtime. (generate_classref_translation_entry): Do not call start_decl(); call finish_var_decl() instead of finish_decl(); call convert() instead of build_c_cast(). * objc-act.h (CLASS_OWN_IVARS): Remove accessor. (CLASS_BINFO_ELTS): Reduce from 6 to 5, now that CLASS_OWN_IVARS is gone. (OCTI_GNU_INIT_DECL, GNU_INIT_decl): New. (OCTI_ELLIPSIS_NODE, objc_ellipsis_node): Remove. (OCTI_ID_ID, id_type, objc_id_id): Rename to OCTI_ID_NAME, objc_object_type and objc_object_name, respectively. (OCTI_CLS_REF, OCTI_CLASS_NAME, objc_class_reference, objc_class_name): New. (IS_CLASS): New macro. (IS_ID, IS_SUPER): Robustify. (OCTI_EXECCLASS_DECL, execclass_decl): New. (finish_file, start_class, continue_class, finish_class, start_method_def, continue_method_def, finish_method_def, start_protocol, finish_protocol, objc_build_throw_stmt, objc_build_try_catch_finally_stmt, objc_build_synchronized_prologue, objc_build_synchronized_epilogue, objc_build_try_prologue, objc_build_try_epilogue, objc_build_catch_stmt, objc_build_catch_epilogue, objc_build_finally_prologue, objc_build_finally_epilogue, is_ivar, is_private, is_public, add_instance_variable, objc_add_method, get_super_receiver, objc_clear_super_receiver, get_class_ivars_from_name, get_class_reference, get_static_reference, get_object_reference, build_message_expr, finish_message_expr, build_selector_expr, build_ivar_reference, build_keyword_decl, build_method_decl, build_protocol_expr, build_objc_string_object, objc_declare_alias, objc_declare_class, objc_declare_protocols, objc_comptypes, objc_check_decl, build_encode_expr): Remove prototypes. (imp_count, cat_count): Make GGC-aware. (OBJC_SET_TYPE_NAME): New macro. From-SVN: r87168
2004-09-08 02:49:44 +02:00
finish_var_decl (decl,
objc_build_constructor (TREE_TYPE (decl),
nreverse (initlist)));
1992-01-18 00:15:38 +01:00
return decl;
}
static void
mark_referenced_methods (void)
{
struct imp_entry *impent;
tree chain;
for (impent = imp_list; impent; impent = impent->next)
{
chain = CLASS_CLS_METHODS (impent->imp_context);
while (chain)
{
cgraph_mark_needed_node (cgraph_node (METHOD_DEFINITION (chain)));
chain = TREE_CHAIN (chain);
}
chain = CLASS_NST_METHODS (impent->imp_context);
while (chain)
{
cgraph_mark_needed_node (cgraph_node (METHOD_DEFINITION (chain)));
chain = TREE_CHAIN (chain);
}
}
}
1992-01-18 00:15:38 +01:00
static void
generate_dispatch_tables (void)
1992-01-18 00:15:38 +01:00
{
tree initlist, chain, method_list_template;
int size;
if (!objc_method_template)
objc_method_template = build_method_template ();
c-parse.in (objc_inherit_code, [...]): Make static. 2001-10-03 Ziemowit Laski <zlaski@apple.com> * c-parse.in (objc_inherit_code, objc_pq_context, objc_public_flag): Make static. (objc_interface_context, objc_implementation_context, objc_method_context, objc_ivar_chain, objc_ivar_context): Move to global tree array in objc/objc-act.[ch]. (methoddef): Remove unnecessary code. * objc/objc-act.c: (hashed_attribute, hashed_entry, imp_entry): Hoist struct definitions to objc-act.h. (nst_method_hash_list, cls_method_hash_list, imp_list, imp_count, cat_count): Place declaration in objc-act.h. (objc_tree_index): Move enumeration to objc-act.h. (objc_global_trees): Place declaration and macro accessors in objc-act.h. (implementation_context): Remove duplicate; use objc_implementation_context instead: (method_context): Remove duplicate; use objc_method_context instead. (objc_ellipsis_node, objc_method_prototype_template, implemented_classes, function_type): Move global vars to objc_global_trees. (init_objc): Use LAST_BASE_TREE_CODE instead of LAST_CODE. (build_message_expr): Move actual construction of ObjC message send nodes to finish_message_expr. (finish_message_expr): New routine, contains code formerly in build_message_expr. * objc/objc-act.h (finish_message_expr): New prototype. (objc_ivar_chain, objc_method_context, objc_ellipsis_node): Remove declarations; these vars are now part of objc_global_trees. (objc_tree_index, objc_global_trees): Move definitions from objc-act.c. * objc/objc-tree.def: Update copyright info. From-SVN: r46000
2001-10-04 00:05:57 +02:00
chain = CLASS_CLS_METHODS (objc_implementation_context);
1992-01-18 00:15:38 +01:00
if (chain)
{
size = list_length (chain);
1992-01-18 00:15:38 +01:00
method_list_template
= build_method_list_template (objc_method_template, size);
initlist
= build_dispatch_table_initializer (objc_method_template, chain);
UOBJC_CLASS_METHODS_decl
= generate_dispatch_table (method_list_template,
c-parse.in (objc_inherit_code, [...]): Make static. 2001-10-03 Ziemowit Laski <zlaski@apple.com> * c-parse.in (objc_inherit_code, objc_pq_context, objc_public_flag): Make static. (objc_interface_context, objc_implementation_context, objc_method_context, objc_ivar_chain, objc_ivar_context): Move to global tree array in objc/objc-act.[ch]. (methoddef): Remove unnecessary code. * objc/objc-act.c: (hashed_attribute, hashed_entry, imp_entry): Hoist struct definitions to objc-act.h. (nst_method_hash_list, cls_method_hash_list, imp_list, imp_count, cat_count): Place declaration in objc-act.h. (objc_tree_index): Move enumeration to objc-act.h. (objc_global_trees): Place declaration and macro accessors in objc-act.h. (implementation_context): Remove duplicate; use objc_implementation_context instead: (method_context): Remove duplicate; use objc_method_context instead. (objc_ellipsis_node, objc_method_prototype_template, implemented_classes, function_type): Move global vars to objc_global_trees. (init_objc): Use LAST_BASE_TREE_CODE instead of LAST_CODE. (build_message_expr): Move actual construction of ObjC message send nodes to finish_message_expr. (finish_message_expr): New routine, contains code formerly in build_message_expr. * objc/objc-act.h (finish_message_expr): New prototype. (objc_ivar_chain, objc_method_context, objc_ellipsis_node): Remove declarations; these vars are now part of objc_global_trees. (objc_tree_index, objc_global_trees): Move definitions from objc-act.c. * objc/objc-tree.def: Update copyright info. From-SVN: r46000
2001-10-04 00:05:57 +02:00
((TREE_CODE (objc_implementation_context)
== CLASS_IMPLEMENTATION_TYPE)
? "_OBJC_CLASS_METHODS"
: "_OBJC_CATEGORY_CLASS_METHODS"),
size, initlist);
1992-01-18 00:15:38 +01:00
}
else
UOBJC_CLASS_METHODS_decl = 0;
1992-01-18 00:15:38 +01:00
c-parse.in (objc_inherit_code, [...]): Make static. 2001-10-03 Ziemowit Laski <zlaski@apple.com> * c-parse.in (objc_inherit_code, objc_pq_context, objc_public_flag): Make static. (objc_interface_context, objc_implementation_context, objc_method_context, objc_ivar_chain, objc_ivar_context): Move to global tree array in objc/objc-act.[ch]. (methoddef): Remove unnecessary code. * objc/objc-act.c: (hashed_attribute, hashed_entry, imp_entry): Hoist struct definitions to objc-act.h. (nst_method_hash_list, cls_method_hash_list, imp_list, imp_count, cat_count): Place declaration in objc-act.h. (objc_tree_index): Move enumeration to objc-act.h. (objc_global_trees): Place declaration and macro accessors in objc-act.h. (implementation_context): Remove duplicate; use objc_implementation_context instead: (method_context): Remove duplicate; use objc_method_context instead. (objc_ellipsis_node, objc_method_prototype_template, implemented_classes, function_type): Move global vars to objc_global_trees. (init_objc): Use LAST_BASE_TREE_CODE instead of LAST_CODE. (build_message_expr): Move actual construction of ObjC message send nodes to finish_message_expr. (finish_message_expr): New routine, contains code formerly in build_message_expr. * objc/objc-act.h (finish_message_expr): New prototype. (objc_ivar_chain, objc_method_context, objc_ellipsis_node): Remove declarations; these vars are now part of objc_global_trees. (objc_tree_index, objc_global_trees): Move definitions from objc-act.c. * objc/objc-tree.def: Update copyright info. From-SVN: r46000
2001-10-04 00:05:57 +02:00
chain = CLASS_NST_METHODS (objc_implementation_context);
1992-01-18 00:15:38 +01:00
if (chain)
{
size = list_length (chain);
method_list_template
= build_method_list_template (objc_method_template, size);
initlist
= build_dispatch_table_initializer (objc_method_template, chain);
1992-01-18 00:15:38 +01:00
c-parse.in (objc_inherit_code, [...]): Make static. 2001-10-03 Ziemowit Laski <zlaski@apple.com> * c-parse.in (objc_inherit_code, objc_pq_context, objc_public_flag): Make static. (objc_interface_context, objc_implementation_context, objc_method_context, objc_ivar_chain, objc_ivar_context): Move to global tree array in objc/objc-act.[ch]. (methoddef): Remove unnecessary code. * objc/objc-act.c: (hashed_attribute, hashed_entry, imp_entry): Hoist struct definitions to objc-act.h. (nst_method_hash_list, cls_method_hash_list, imp_list, imp_count, cat_count): Place declaration in objc-act.h. (objc_tree_index): Move enumeration to objc-act.h. (objc_global_trees): Place declaration and macro accessors in objc-act.h. (implementation_context): Remove duplicate; use objc_implementation_context instead: (method_context): Remove duplicate; use objc_method_context instead. (objc_ellipsis_node, objc_method_prototype_template, implemented_classes, function_type): Move global vars to objc_global_trees. (init_objc): Use LAST_BASE_TREE_CODE instead of LAST_CODE. (build_message_expr): Move actual construction of ObjC message send nodes to finish_message_expr. (finish_message_expr): New routine, contains code formerly in build_message_expr. * objc/objc-act.h (finish_message_expr): New prototype. (objc_ivar_chain, objc_method_context, objc_ellipsis_node): Remove declarations; these vars are now part of objc_global_trees. (objc_tree_index, objc_global_trees): Move definitions from objc-act.c. * objc/objc-tree.def: Update copyright info. From-SVN: r46000
2001-10-04 00:05:57 +02:00
if (TREE_CODE (objc_implementation_context) == CLASS_IMPLEMENTATION_TYPE)
UOBJC_INSTANCE_METHODS_decl
= generate_dispatch_table (method_list_template,
"_OBJC_INSTANCE_METHODS",
1992-01-18 00:15:38 +01:00
size, initlist);
else
1996-07-04 00:07:53 +02:00
/* We have a category. */
UOBJC_INSTANCE_METHODS_decl
= generate_dispatch_table (method_list_template,
"_OBJC_CATEGORY_INSTANCE_METHODS",
1992-01-18 00:15:38 +01:00
size, initlist);
}
else
UOBJC_INSTANCE_METHODS_decl = 0;
}
static tree
generate_protocol_list (tree i_or_p)
{
Makefile.in (c-parse.o): Depend on $(C_COMMON_H). [gcc/ChangeLog] 2004-09-07 Ziemowit Laski <zlaski@apple.com> * Makefile.in (c-parse.o): Depend on $(C_COMMON_H). * c-parse.in: Include c-common.h instead of objc-act.h. (ivar_decl_list, ivar_decls, ivar_decl, ivars, ivar_declarator, myparms, myparm): Remove %type declarations. (methodtype, optparms, OBJC_TYPE_QUAL, objc_quals, objc_qual, objc_typename, objc_try_catch_stmt, optellipsis): Add %type declarations. (objc_inherit_code, objc_public_flag): Remove. (typespec_nonreserved_nonattr): Call objc_get_protocol_qualified_type() instead of get_static_reference() and get_protocol_reference(). (stmt_nocomp): Call grokparm() on @catch parameter. (objcdef): Move semantic action to objc_finish_implementation(). (classdef): Move semantic action to objc_start_class_interface(), objc_continue_interface(), objc_finish_interface(), objc_start_class_implementation(), objc_continue_implementation(), objc_start_category_interface() and objc_start_category_implementation(). (protocoldef): Move semantic actions to objc_start_protocol() and objc_finish_interface(). (ivar_decl_list): Remove nonterminal. (visibility_spec): Move semantic actions to objc_set_visibility(). (ivar_decls): Remove assignment to $$. (ivar_decl): Rephrase in terms of component_decl; call objc_add_instance_variable(). (ivars, ivar_declarator): Remove nonterminals. (opt_semi): New nonterminal. (methodtype): Remove semantic actions. (methoddef): Move semantic actions to objc_set_method_type(), objc_start_method_definition() and objc_finish_method_definition(). (methodproto): Move semantic actions to objc_set_method_type() and objc_add_method_declaration(). (methoddecl): Use objc_typename instead of typename; move semantic actions to objc_build_method_signature(). (optarglist, myxdecls, mydecl, myparms, myparm): Remove nonterminals. (optparmlist): Express in terms of optparms and optellipsis. (optparms, optellipsis, objc_qual, objc_quals, objc_typename): New nonterminals. (keyworddecl): Use objc_typename instead of typename. (rid_to_yy): Mark RID_IN, RID_OUT, RID_INOUT, RID_BYCOPY, RID_BYREF and RID_ONEWAY as returning OBJC_TYPE_QUAL to yyparse(). [gcc/objc/ChangeLog] 2004-09-07 Ziemowit Laski <zlaski@apple.com> * Make-lang.in (objc/objc-parse.o): Depend on $(C_COMMON_H) instead of objc/objc-act.h. (objc/objc-act.o): Depend on $(HASHTAB_H). * objc-act.c: Include hashtab.h; in ObjC++ mode, include cp-tree.h and objcp-decl.h instead of c-tree.h. (build_module_descriptor, get_class_ivars, synth_id_with_class_suffix, error_with_ivar, gen_method_decl, gen_declaration, setup_string_decl, build_protocol_template): Adjust prototypes. (build_module_initializer_routine, start_class, continue_class, finish_class, start_method_def, objc_start_function, start_protocol, build_method_decl, objc_add_method, add_instance_variable, build_ivar_reference, is_ivar, is_private, get_super_receiver, build_selector_table_decl, objc_push_parm, objc_get_parm_info, gen_type_name, gen_type_name_0, start_var_decl, finish_var_decl, create_field_decl): New prototypes. (objc_expand_function_end, comp_method_with_proto, objc_expr_last, gen_declaration_1, gen_declarator, is_complex_decl, adorn_decl, define_decl, create_builtin_decl, gen_declspecs): Remove prototypes. (TYPE_ID): Rename to OBJECT_TYPEDEF_NAME. (CLASS_TYPEDEF_NAME): New. (TAG_EXECCLASS): Change from a global variable to a #define. (TAG_RETURN_STRUCT): Delete. (TAG_GNUINIT): New, holds '__objc_gnu_init' name. (objc_inherit_code, objc_public_flag): New, moved from c-parse.in. (string_descriptor): New struct. (string_htab): New hash table. (string_hash, string_eq): New prototypes. (generate_struct_by_value_array): Call create_field_decl() instead of create_builtin_decl(). (objc_init): Do not initialize objc_ellipsis_node or TAG_EXECCLASS; In ObjC++ mode, call cxx_init() instead of c_objc_common_init(). (objc_finish_file): In ObjC++, call instantiate_pending_templates() and cp_finish_file(). (define_decl, get_static_reference, get_protocol_reference, create_builtin_decl): Remove functions. (objc_start_class_interface, objc_start_category_interface, objc_start_protocol, objc_continue_interface, objc_finish_interface, objc_start_class_implementation, objc_start_category_implementation, objc_continue_implementation, objc_finish_implementation, objc_set_visibility, objc_set_method_type, objc_build_method_signature, objc_add_method_declaration, objc_start_method_definition, objc_add_instance_variable, objc_get_protocol_qualified_type, create_field_decl, start_var_decl, finish_var_decl): New functions. (setup_string_decl): Simplify since it is only called once. (synth_module_prologue): Call build_class_template(); predefine 'id' and 'Class' as typedefs; rename 'temp_type' to 'type'; disable debug hooks for duration of function; fix GNU runtime messenger signatures to correspond to reality; forward-declare '__objc_exec_class' for the GNU runtime; call build_selector_table_decl(); in ObjC++ mode, generate 'extern "C" { ... }' wrappers around synthesized declarations; call build_protocol_template() and build_category_template(). (string_hash, string_eq): New functions. (objc_build_string_object): Check metaclass correctness only once; store string literals in hash table. (objc_build_constructor): Do not convert initializer elements; adjust for ObjC++ impedance mismatch. (build_objc_symtab_template): Call create_field_decl() instead of create_builtin_decl(). (init_objc_symtab): Add missing conversion to initializer element. (build_metadata_decl): Call start_var_decl() instead of define_decl(). (generate_objc_symtab_decl): Do not call build_category_template(); call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(). (build_module_descriptor): Call create_field_decl() instead of grokfield(); call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(); always mark module descriptor as used; move GNU runtime-specific functionality to build_module_initializer_routine(). (build_module_initializer_routine): New function, broken off of build_module_descriptor(). (objc_static_init_needed_p, objc_generate_static_init_call): New functions. (generate_static_references, generate_strings, build_selector_translation_table, generate_descriptor_table, generate_ivars_list, generate_dispatch_table, generate_category): Call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(); build a type directly instead of via groktypename(). (build_selector_reference_decl, build_selector_table_decl, build_class_reference_decl, build_protocol_reference, generate_objc_image_info): Call start_var_decl() instead of build_decl(). (build_selector_reference): For GNU runtime, do not call build_selector_reference_decl(). (build_selector, build_typed_selector_reference): Always convert result to the selector type. (add_objc_string): Cast return value to 'char *'. (build_method_prototype_template, build_selector_template, build_method_template): Use actual selector type for fields pointing to selectors. (finish_objc): For GNU runtime, call build_module_initializer_routine() after build_module_descriptor(). (generate_protocol_list, generate_shared_structures): Call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(); build a type directly instead of via groktypename(). (synth_id_with_class_suffix): Return a string. (get_arg_type_list): For instance methods, use the instance type for 'self'; do not call groktypename_in_parm_context(). (build_objc_string_decl): Squash redeclaration errors in ObjC++. (objc_is_class_name): Use OBJC_TYPE_NAME instead of TYPE_NAME; handle RECORD_TYPEs in ObjC as well as ObjC++. (objc_is_id): New function. (objc_is_object_ptr): Return the canonical type node. (objc_get_class_ivars): Simplify using get_class_ivars(). (get_class_ivars): Remove second parameter; create a fresh copy of the ivar list for each call; do not check for existence of super class. (objc_eh_runtime_type): Mark #ifndef OBJCPLUS. (objc_init_exceptions): When using SJLJ-style exceptions, require the use of '-fobjc-exceptions' flag; do not require it for DWARF-style exceptions. (objc_build_exc_ptr, next_sjlj_build_try_catch_finally): Use objc_object_type instead of objc_id_type. (objc_begin_catch_clause): Convert the incoming PARM_DECL into a VAR_DECL before placing it in the appropriate scope; do not call define_decl(); adjust call to c_begin_compound_stmt(); use objc_object_type instead of objc_id_type. (build_next_objc_exception_stuff): Call create_field_decl() instead of create_builtin_decl(); construct type directly instead of calling groktypename(); use OBJC_VOID_AT_END to mark end of function parameters. (build_private_template): Adjust call to get_class_ivars(); build a type directly instead of via groktypename(). (build_protocol_template, build_method_prototype_list_template, build_method_prototype_template, build_category_template, build_selector_template, build_class_template, build_super_template, build_ivar_template, build_ivar_list_template, build_method_list_template, build_method_template): Call create_field_decl() instead of grokfield(). (objc_method_parm_type): Do not call groktypename(). (generate_descriptor_table): Call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(). (generate_method_descriptors, build_protocol_initializer, generate_dispatch_tables, build_category_initializer, build_shared_structure_initializer): Do not call groktypename(). (generate_protocols): Call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(); do not call groktypename(). (error_with_ivar): Remove last parameter. (check_ivars): Do not iterate ovar CLASS_RAW_IVARS lists in addition to CLASS_IVARS lists; adjust calls to error_with_ivar(). (generate_ivar_lists): Convert one of the initializer elements; do not call groktypename(). (get_arg_type_list, start_method_def, gen_method_def): Account for new representation of variable arguments and '...' in Objective-C methods; add Objective-C++ impedance matching code. (is_objc_type_qualifier): Remove function. (adjust_type_for_id_default): Simplify; there is no longer a need to wade through declspecs. (lookup_interface, start_class, continue_class, finish_class, start_method_def, start_protocol, build_method_decl, objc_add_method, add_instance_variable, build_ivar_reference, is_ivar, is_private, get_super_receiver, objc_build_finally_epilogue): Make into static functions. (receiver_is_class_object): Use new IS_CLASS() macro. (objc_build_message_expr): Tweak ObjC++ message argument handling; call objc_finish_message_expr() instead of finish_message_expr(). (finish_message_expr): Rename to objc_finish_message_expr(); use OBJC_TYPE_NAME and OBJC_SET_TYPE_NAME macros instead of TYPE_NAME. call gen_type_name() instead of gen_declaration(); call objc_is_id() instead of using IS_ID and IS_CLASS; Use objc_class_name instead of calling get_identifier("Class"); handle CONVERT_EXPRs in receiver. (build_objc_method_call, warn_with_method): Do not call groktypename(). (build_ivar_reference): Call convert() instead of clobbering in a type. (hash_init): Initialize string_htab hash table. (add_instance_variable): Simplify parameter list; do not call grokfield(); do not populate CLASS_IVARS list. (start_class): Check for the existence of super class, if one was specified. (continue_class): Use CLASS_RAW_IVARS rather than CLASS_IVARS; do not call build_class_template(); adjust call to get_class_ivars(); call build_decl(), pushdecl() and finish_decl() instead of define_decl(). (finish_class): Call build_decl(), pushdecl() and finish_decl() instead of define_decl(). (add_protocols): Use PROTOCOL_BINFO_ELTS for the tree vector size. (start_protocol): Do not call build_protocol_template(); use PROTOCOL_BINFO_ELTS for the tree vector size. (encode_type_qualifiers): Do not handle the 'const' qualifier here. (encode_pointer): Encode 'const char *' as 'r*', for backwards compatibility. (encode_array): Use HOST_WIDE_INT_PRINT_DEC instead of "%ld". (encode_type): Handle the 'const' qualifier here. (objc_parmlist): New global variable, sued by objc_push_parm and objc_get_parm_info(). (objc_push_parm, objc_get_parm_info): New functions. (objc_expr_last): Remove function. (synth_self_and_ucmd_args): For instance methods, use the instance type for 'self'; call objc_push_parm() instead of push_parm_decl(). (start_method_def): Do not call push_scope(), declare_parm_level(), pop_scope(), push_parm_decl(), store_parm_decls() or objc_expr_last(); just use objc_push_parm() and objc_get_parm_info(). (comp_method_with_proto): Remove function. (objc_types_are_equivalent): Strip away indirections before comparing underlying types. (comp_proto_with_proto): Do not call groktypename(); types are no longer in raw declspec format. (objc_start_function): New function. (really_start_method): Call comp_proto_with_proto() instead of comp_method_with_proto(); call objc_start_function() instead of hand-crafting a function declarator. (continue_method_def, objc_expand_function_end): Remove functions. (get_super_receiver): Call objc_get_current_scope() instead of get_current_scope(); reference 'super_class' field (instead of 'class'). (finish_method_def): Rename to objc_finish_method_definition() and add a function decl parameter; move method encoding call from objc_expand_function_end(). (is_complex_decl, adorn_decl, gen_declarator, gen_declspecs, gen_declaration_1): Remove functions. (tmpbuf, RAW_DECLSPEC): Remove. (gen_declaration): Remove second parameter; simplify to deal with TYPE_P nodes instead of raw declspecs. (gen_type_name, gen_type_name_0): New functions. (gen_method_decl): Remove second parameter; call gen_type_name() instead of gen_declaration_1(). (dump_interface): Adjust calls to gen_declaration() and gen_method_decl(); do not allocate a separate string buffer. (init_objc): Allocate a larger string buffer to accommodate dump_interface(); adjust call to build_module_descriptor(); add call to build_module_initializer_routine() for the GNU runtime. (generate_classref_translation_entry): Do not call start_decl(); call finish_var_decl() instead of finish_decl(); call convert() instead of build_c_cast(). * objc-act.h (CLASS_OWN_IVARS): Remove accessor. (CLASS_BINFO_ELTS): Reduce from 6 to 5, now that CLASS_OWN_IVARS is gone. (OCTI_GNU_INIT_DECL, GNU_INIT_decl): New. (OCTI_ELLIPSIS_NODE, objc_ellipsis_node): Remove. (OCTI_ID_ID, id_type, objc_id_id): Rename to OCTI_ID_NAME, objc_object_type and objc_object_name, respectively. (OCTI_CLS_REF, OCTI_CLASS_NAME, objc_class_reference, objc_class_name): New. (IS_CLASS): New macro. (IS_ID, IS_SUPER): Robustify. (OCTI_EXECCLASS_DECL, execclass_decl): New. (finish_file, start_class, continue_class, finish_class, start_method_def, continue_method_def, finish_method_def, start_protocol, finish_protocol, objc_build_throw_stmt, objc_build_try_catch_finally_stmt, objc_build_synchronized_prologue, objc_build_synchronized_epilogue, objc_build_try_prologue, objc_build_try_epilogue, objc_build_catch_stmt, objc_build_catch_epilogue, objc_build_finally_prologue, objc_build_finally_epilogue, is_ivar, is_private, is_public, add_instance_variable, objc_add_method, get_super_receiver, objc_clear_super_receiver, get_class_ivars_from_name, get_class_reference, get_static_reference, get_object_reference, build_message_expr, finish_message_expr, build_selector_expr, build_ivar_reference, build_keyword_decl, build_method_decl, build_protocol_expr, build_objc_string_object, objc_declare_alias, objc_declare_class, objc_declare_protocols, objc_comptypes, objc_check_decl, build_encode_expr): Remove prototypes. (imp_count, cat_count): Make GGC-aware. (OBJC_SET_TYPE_NAME): New macro. From-SVN: r87168
2004-09-08 02:49:44 +02:00
tree initlist;
tree refs_decl, lproto, e, plist;
int size = 0;
Makefile.in (c-parse.o): Depend on $(C_COMMON_H). [gcc/ChangeLog] 2004-09-07 Ziemowit Laski <zlaski@apple.com> * Makefile.in (c-parse.o): Depend on $(C_COMMON_H). * c-parse.in: Include c-common.h instead of objc-act.h. (ivar_decl_list, ivar_decls, ivar_decl, ivars, ivar_declarator, myparms, myparm): Remove %type declarations. (methodtype, optparms, OBJC_TYPE_QUAL, objc_quals, objc_qual, objc_typename, objc_try_catch_stmt, optellipsis): Add %type declarations. (objc_inherit_code, objc_public_flag): Remove. (typespec_nonreserved_nonattr): Call objc_get_protocol_qualified_type() instead of get_static_reference() and get_protocol_reference(). (stmt_nocomp): Call grokparm() on @catch parameter. (objcdef): Move semantic action to objc_finish_implementation(). (classdef): Move semantic action to objc_start_class_interface(), objc_continue_interface(), objc_finish_interface(), objc_start_class_implementation(), objc_continue_implementation(), objc_start_category_interface() and objc_start_category_implementation(). (protocoldef): Move semantic actions to objc_start_protocol() and objc_finish_interface(). (ivar_decl_list): Remove nonterminal. (visibility_spec): Move semantic actions to objc_set_visibility(). (ivar_decls): Remove assignment to $$. (ivar_decl): Rephrase in terms of component_decl; call objc_add_instance_variable(). (ivars, ivar_declarator): Remove nonterminals. (opt_semi): New nonterminal. (methodtype): Remove semantic actions. (methoddef): Move semantic actions to objc_set_method_type(), objc_start_method_definition() and objc_finish_method_definition(). (methodproto): Move semantic actions to objc_set_method_type() and objc_add_method_declaration(). (methoddecl): Use objc_typename instead of typename; move semantic actions to objc_build_method_signature(). (optarglist, myxdecls, mydecl, myparms, myparm): Remove nonterminals. (optparmlist): Express in terms of optparms and optellipsis. (optparms, optellipsis, objc_qual, objc_quals, objc_typename): New nonterminals. (keyworddecl): Use objc_typename instead of typename. (rid_to_yy): Mark RID_IN, RID_OUT, RID_INOUT, RID_BYCOPY, RID_BYREF and RID_ONEWAY as returning OBJC_TYPE_QUAL to yyparse(). [gcc/objc/ChangeLog] 2004-09-07 Ziemowit Laski <zlaski@apple.com> * Make-lang.in (objc/objc-parse.o): Depend on $(C_COMMON_H) instead of objc/objc-act.h. (objc/objc-act.o): Depend on $(HASHTAB_H). * objc-act.c: Include hashtab.h; in ObjC++ mode, include cp-tree.h and objcp-decl.h instead of c-tree.h. (build_module_descriptor, get_class_ivars, synth_id_with_class_suffix, error_with_ivar, gen_method_decl, gen_declaration, setup_string_decl, build_protocol_template): Adjust prototypes. (build_module_initializer_routine, start_class, continue_class, finish_class, start_method_def, objc_start_function, start_protocol, build_method_decl, objc_add_method, add_instance_variable, build_ivar_reference, is_ivar, is_private, get_super_receiver, build_selector_table_decl, objc_push_parm, objc_get_parm_info, gen_type_name, gen_type_name_0, start_var_decl, finish_var_decl, create_field_decl): New prototypes. (objc_expand_function_end, comp_method_with_proto, objc_expr_last, gen_declaration_1, gen_declarator, is_complex_decl, adorn_decl, define_decl, create_builtin_decl, gen_declspecs): Remove prototypes. (TYPE_ID): Rename to OBJECT_TYPEDEF_NAME. (CLASS_TYPEDEF_NAME): New. (TAG_EXECCLASS): Change from a global variable to a #define. (TAG_RETURN_STRUCT): Delete. (TAG_GNUINIT): New, holds '__objc_gnu_init' name. (objc_inherit_code, objc_public_flag): New, moved from c-parse.in. (string_descriptor): New struct. (string_htab): New hash table. (string_hash, string_eq): New prototypes. (generate_struct_by_value_array): Call create_field_decl() instead of create_builtin_decl(). (objc_init): Do not initialize objc_ellipsis_node or TAG_EXECCLASS; In ObjC++ mode, call cxx_init() instead of c_objc_common_init(). (objc_finish_file): In ObjC++, call instantiate_pending_templates() and cp_finish_file(). (define_decl, get_static_reference, get_protocol_reference, create_builtin_decl): Remove functions. (objc_start_class_interface, objc_start_category_interface, objc_start_protocol, objc_continue_interface, objc_finish_interface, objc_start_class_implementation, objc_start_category_implementation, objc_continue_implementation, objc_finish_implementation, objc_set_visibility, objc_set_method_type, objc_build_method_signature, objc_add_method_declaration, objc_start_method_definition, objc_add_instance_variable, objc_get_protocol_qualified_type, create_field_decl, start_var_decl, finish_var_decl): New functions. (setup_string_decl): Simplify since it is only called once. (synth_module_prologue): Call build_class_template(); predefine 'id' and 'Class' as typedefs; rename 'temp_type' to 'type'; disable debug hooks for duration of function; fix GNU runtime messenger signatures to correspond to reality; forward-declare '__objc_exec_class' for the GNU runtime; call build_selector_table_decl(); in ObjC++ mode, generate 'extern "C" { ... }' wrappers around synthesized declarations; call build_protocol_template() and build_category_template(). (string_hash, string_eq): New functions. (objc_build_string_object): Check metaclass correctness only once; store string literals in hash table. (objc_build_constructor): Do not convert initializer elements; adjust for ObjC++ impedance mismatch. (build_objc_symtab_template): Call create_field_decl() instead of create_builtin_decl(). (init_objc_symtab): Add missing conversion to initializer element. (build_metadata_decl): Call start_var_decl() instead of define_decl(). (generate_objc_symtab_decl): Do not call build_category_template(); call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(). (build_module_descriptor): Call create_field_decl() instead of grokfield(); call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(); always mark module descriptor as used; move GNU runtime-specific functionality to build_module_initializer_routine(). (build_module_initializer_routine): New function, broken off of build_module_descriptor(). (objc_static_init_needed_p, objc_generate_static_init_call): New functions. (generate_static_references, generate_strings, build_selector_translation_table, generate_descriptor_table, generate_ivars_list, generate_dispatch_table, generate_category): Call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(); build a type directly instead of via groktypename(). (build_selector_reference_decl, build_selector_table_decl, build_class_reference_decl, build_protocol_reference, generate_objc_image_info): Call start_var_decl() instead of build_decl(). (build_selector_reference): For GNU runtime, do not call build_selector_reference_decl(). (build_selector, build_typed_selector_reference): Always convert result to the selector type. (add_objc_string): Cast return value to 'char *'. (build_method_prototype_template, build_selector_template, build_method_template): Use actual selector type for fields pointing to selectors. (finish_objc): For GNU runtime, call build_module_initializer_routine() after build_module_descriptor(). (generate_protocol_list, generate_shared_structures): Call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(); build a type directly instead of via groktypename(). (synth_id_with_class_suffix): Return a string. (get_arg_type_list): For instance methods, use the instance type for 'self'; do not call groktypename_in_parm_context(). (build_objc_string_decl): Squash redeclaration errors in ObjC++. (objc_is_class_name): Use OBJC_TYPE_NAME instead of TYPE_NAME; handle RECORD_TYPEs in ObjC as well as ObjC++. (objc_is_id): New function. (objc_is_object_ptr): Return the canonical type node. (objc_get_class_ivars): Simplify using get_class_ivars(). (get_class_ivars): Remove second parameter; create a fresh copy of the ivar list for each call; do not check for existence of super class. (objc_eh_runtime_type): Mark #ifndef OBJCPLUS. (objc_init_exceptions): When using SJLJ-style exceptions, require the use of '-fobjc-exceptions' flag; do not require it for DWARF-style exceptions. (objc_build_exc_ptr, next_sjlj_build_try_catch_finally): Use objc_object_type instead of objc_id_type. (objc_begin_catch_clause): Convert the incoming PARM_DECL into a VAR_DECL before placing it in the appropriate scope; do not call define_decl(); adjust call to c_begin_compound_stmt(); use objc_object_type instead of objc_id_type. (build_next_objc_exception_stuff): Call create_field_decl() instead of create_builtin_decl(); construct type directly instead of calling groktypename(); use OBJC_VOID_AT_END to mark end of function parameters. (build_private_template): Adjust call to get_class_ivars(); build a type directly instead of via groktypename(). (build_protocol_template, build_method_prototype_list_template, build_method_prototype_template, build_category_template, build_selector_template, build_class_template, build_super_template, build_ivar_template, build_ivar_list_template, build_method_list_template, build_method_template): Call create_field_decl() instead of grokfield(). (objc_method_parm_type): Do not call groktypename(). (generate_descriptor_table): Call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(). (generate_method_descriptors, build_protocol_initializer, generate_dispatch_tables, build_category_initializer, build_shared_structure_initializer): Do not call groktypename(). (generate_protocols): Call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(); do not call groktypename(). (error_with_ivar): Remove last parameter. (check_ivars): Do not iterate ovar CLASS_RAW_IVARS lists in addition to CLASS_IVARS lists; adjust calls to error_with_ivar(). (generate_ivar_lists): Convert one of the initializer elements; do not call groktypename(). (get_arg_type_list, start_method_def, gen_method_def): Account for new representation of variable arguments and '...' in Objective-C methods; add Objective-C++ impedance matching code. (is_objc_type_qualifier): Remove function. (adjust_type_for_id_default): Simplify; there is no longer a need to wade through declspecs. (lookup_interface, start_class, continue_class, finish_class, start_method_def, start_protocol, build_method_decl, objc_add_method, add_instance_variable, build_ivar_reference, is_ivar, is_private, get_super_receiver, objc_build_finally_epilogue): Make into static functions. (receiver_is_class_object): Use new IS_CLASS() macro. (objc_build_message_expr): Tweak ObjC++ message argument handling; call objc_finish_message_expr() instead of finish_message_expr(). (finish_message_expr): Rename to objc_finish_message_expr(); use OBJC_TYPE_NAME and OBJC_SET_TYPE_NAME macros instead of TYPE_NAME. call gen_type_name() instead of gen_declaration(); call objc_is_id() instead of using IS_ID and IS_CLASS; Use objc_class_name instead of calling get_identifier("Class"); handle CONVERT_EXPRs in receiver. (build_objc_method_call, warn_with_method): Do not call groktypename(). (build_ivar_reference): Call convert() instead of clobbering in a type. (hash_init): Initialize string_htab hash table. (add_instance_variable): Simplify parameter list; do not call grokfield(); do not populate CLASS_IVARS list. (start_class): Check for the existence of super class, if one was specified. (continue_class): Use CLASS_RAW_IVARS rather than CLASS_IVARS; do not call build_class_template(); adjust call to get_class_ivars(); call build_decl(), pushdecl() and finish_decl() instead of define_decl(). (finish_class): Call build_decl(), pushdecl() and finish_decl() instead of define_decl(). (add_protocols): Use PROTOCOL_BINFO_ELTS for the tree vector size. (start_protocol): Do not call build_protocol_template(); use PROTOCOL_BINFO_ELTS for the tree vector size. (encode_type_qualifiers): Do not handle the 'const' qualifier here. (encode_pointer): Encode 'const char *' as 'r*', for backwards compatibility. (encode_array): Use HOST_WIDE_INT_PRINT_DEC instead of "%ld". (encode_type): Handle the 'const' qualifier here. (objc_parmlist): New global variable, sued by objc_push_parm and objc_get_parm_info(). (objc_push_parm, objc_get_parm_info): New functions. (objc_expr_last): Remove function. (synth_self_and_ucmd_args): For instance methods, use the instance type for 'self'; call objc_push_parm() instead of push_parm_decl(). (start_method_def): Do not call push_scope(), declare_parm_level(), pop_scope(), push_parm_decl(), store_parm_decls() or objc_expr_last(); just use objc_push_parm() and objc_get_parm_info(). (comp_method_with_proto): Remove function. (objc_types_are_equivalent): Strip away indirections before comparing underlying types. (comp_proto_with_proto): Do not call groktypename(); types are no longer in raw declspec format. (objc_start_function): New function. (really_start_method): Call comp_proto_with_proto() instead of comp_method_with_proto(); call objc_start_function() instead of hand-crafting a function declarator. (continue_method_def, objc_expand_function_end): Remove functions. (get_super_receiver): Call objc_get_current_scope() instead of get_current_scope(); reference 'super_class' field (instead of 'class'). (finish_method_def): Rename to objc_finish_method_definition() and add a function decl parameter; move method encoding call from objc_expand_function_end(). (is_complex_decl, adorn_decl, gen_declarator, gen_declspecs, gen_declaration_1): Remove functions. (tmpbuf, RAW_DECLSPEC): Remove. (gen_declaration): Remove second parameter; simplify to deal with TYPE_P nodes instead of raw declspecs. (gen_type_name, gen_type_name_0): New functions. (gen_method_decl): Remove second parameter; call gen_type_name() instead of gen_declaration_1(). (dump_interface): Adjust calls to gen_declaration() and gen_method_decl(); do not allocate a separate string buffer. (init_objc): Allocate a larger string buffer to accommodate dump_interface(); adjust call to build_module_descriptor(); add call to build_module_initializer_routine() for the GNU runtime. (generate_classref_translation_entry): Do not call start_decl(); call finish_var_decl() instead of finish_decl(); call convert() instead of build_c_cast(). * objc-act.h (CLASS_OWN_IVARS): Remove accessor. (CLASS_BINFO_ELTS): Reduce from 6 to 5, now that CLASS_OWN_IVARS is gone. (OCTI_GNU_INIT_DECL, GNU_INIT_decl): New. (OCTI_ELLIPSIS_NODE, objc_ellipsis_node): Remove. (OCTI_ID_ID, id_type, objc_id_id): Rename to OCTI_ID_NAME, objc_object_type and objc_object_name, respectively. (OCTI_CLS_REF, OCTI_CLASS_NAME, objc_class_reference, objc_class_name): New. (IS_CLASS): New macro. (IS_ID, IS_SUPER): Robustify. (OCTI_EXECCLASS_DECL, execclass_decl): New. (finish_file, start_class, continue_class, finish_class, start_method_def, continue_method_def, finish_method_def, start_protocol, finish_protocol, objc_build_throw_stmt, objc_build_try_catch_finally_stmt, objc_build_synchronized_prologue, objc_build_synchronized_epilogue, objc_build_try_prologue, objc_build_try_epilogue, objc_build_catch_stmt, objc_build_catch_epilogue, objc_build_finally_prologue, objc_build_finally_epilogue, is_ivar, is_private, is_public, add_instance_variable, objc_add_method, get_super_receiver, objc_clear_super_receiver, get_class_ivars_from_name, get_class_reference, get_static_reference, get_object_reference, build_message_expr, finish_message_expr, build_selector_expr, build_ivar_reference, build_keyword_decl, build_method_decl, build_protocol_expr, build_objc_string_object, objc_declare_alias, objc_declare_class, objc_declare_protocols, objc_comptypes, objc_check_decl, build_encode_expr): Remove prototypes. (imp_count, cat_count): Make GGC-aware. (OBJC_SET_TYPE_NAME): New macro. From-SVN: r87168
2004-09-08 02:49:44 +02:00
const char *ref_name;
if (TREE_CODE (i_or_p) == CLASS_INTERFACE_TYPE
|| TREE_CODE (i_or_p) == CATEGORY_INTERFACE_TYPE)
plist = CLASS_PROTOCOL_LIST (i_or_p);
else if (TREE_CODE (i_or_p) == PROTOCOL_INTERFACE_TYPE)
plist = PROTOCOL_LIST (i_or_p);
else
abort ();
1996-07-04 00:07:53 +02:00
/* Compute size. */
for (lproto = plist; lproto; lproto = TREE_CHAIN (lproto))
if (TREE_CODE (TREE_VALUE (lproto)) == PROTOCOL_INTERFACE_TYPE
&& PROTOCOL_FORWARD_DECL (TREE_VALUE (lproto)))
size++;
1996-07-04 00:07:53 +02:00
/* Build initializer. */
tree.h (build_int_cst): New, sign extended constant. * tree.h (build_int_cst): New, sign extended constant. (build_int_cstu): New, zero extended constant. (build_int_cst_wide): Renamed from build_int_cst. * tree.c (build_int_cst, build_int_cstu): New. (build_int_cst_wide): Renamed from build_int_cst. (make_vector_type, build_common_tree_nodes, build_common_tree_nodes_2): Adjust build_int_cst calls. * builtins.c (expand_builtin_prefetch, expand_builtin_strstr, expand_builtin_strpbrk, expand_builtin_fputs, build_string_literal, expand_builtin_printf, expand_builtin_sprintf, fold_builtin_classify_type, fold_builtin_lround, fold_builtin_bitop, fold_builtin_isascii, fold_builtin_toascii, fold_builtin_isdigit, simplify_builtin_strstr, simplify_builtin_strpbrk, fold_builtin_fputs, simplify_builtin_sprintf): Likewise. * c-common.c (start_fname_decls, fix_string_type, shorten_compare, DEF_ATTR_INT): Likewise. * c-decl.c (complete_array_type, check_bitfield_type_and_width): Likewise. * c-lex.c (interpret_integer, lex_charconst): Likewise. * c-parse.in (primary) <TYPES_COMPATIBLE_P> Likewise. * c-pretty-print.c (pp_c_integer_constant): Likewise. * c-typeck.c (really_start_incremental_init, push_init_level, set_nonincremental_init_from_string): Likewise. * calls.c (load_register_parameters): Likewise. convert.c (convert_to_pointer): Likewise. coverage.c (coverage_counter_alloc, tree_coverage_counter_ref, build_fn_info_type, build_fn_info_value, build_ctr_info_value, build_gcov_info): Likewise. * except.c (init_eh, assign_filter_values): Likewise. * expmed.c (store_fixed_bit_field, extract_bit_field, extract_fixed_bit_field, extract_split_bit_field, expand_shift, expand_mult_const, expand_mult_highpart_adjust, extract_high_half, expand_sdiv_pow2, expand_divmod, make_tree): Likewise. * expr.c (convert_move, emit_group_load, emit_group_store, expand_assignment, store_constructor, store_field, expand_expr_real_1, reduce_to_bit_field_precision): Likewise. fold-const.c (force_fit_type, int_const_binop, fold_convert_const, invert_truthvalue, optimize_bit_field_compare, decode_field_reference, all_ones_mask_p, constant_boolean_node, fold_div_compare, fold, fold_read_from_constant_string, fold_negate_const, fold_abs_const, fold_not_const, round_up, round_down): Likewise. * function.c (assign_parm_setup_block): Likewise. * stmt.c (shift_return_value, expand_case, estimate_case_costs): Likewise. * stor-layout.c (layout_type, initialize_sizetypes, set_min_and_max_values_for_integral_type): Likewise. * tree-chrec.c (chrec_fold_multiply_poly_poly, reset_evolution_in_loop): Likewise. * tree-chrec.h (build_polynomial_chrec): Likewise. * tree-complex.c (build_replicated_const): Likewise. * tree-eh.c (honor_protect_cleanup_actions, lower_try_finally_onedest, lower_try_finally_copy, lower_try_finally_switch): Likewise. * tree-mudflap.c (mf_build_string, mx_register_decls, mudflap_register_call, mudflap_enqueue_constant): Likewise. * tree-nested.c (get_trampoline_type, get_nl_goto_field): Likewise. * tree-pretty-print.c (dump_generic_node): Likewise. * tree-ssa-ccp.c (widen_bitfield, maybe_fold_offset_to_array_ref): Likewise. * tree-ssa-dom.c (simplify_rhs_and_lookup_avail_expr): Likewise. * tree-ssa-loop-niter.c (number_of_iterations_cond, loop_niter_by_eval, upper_bound_in_type, lower_bound_in_type): Likewise. * tree-ssa-loop-ivcanon.c (create_canonical_iv, canonicalize_loop_induction_variables): Likewise. * tree-vectorizer.c (vect_create_index_for_array_ref, vect_transform_loop_bound, vect_compute_data_ref_alignment): Likewise. * config/alpha/alpha.c (alpha_initialize_trampoline, alpha_va_start, alpha_gimplify_va_arg_1): Likewise. * config/arm/arm.c (arm_get_cookie_size): Likewise. * config/c4x/c4x.c (c4x_gimplify_va_arg_expr): Likewise. * config/i386/i386.c (ix86_va_start, ix86_gimplify_va_arg): Likewise. * config/ia64/ia64.c (ia64_gimplify_va_arg): Likewise. * config/mips/mips.c (mips_build_builtin_va_list, mips_va_start, mips_gimplify_va_arg_expr): Likewise. * config/pa/pa.c (hppa_gimplify_va_arg_expr): Likewise. * config/rs6000/rs6000.c (rs6000_va_start, rs6000_gimplify_va_arg, add_compiler_branch_island): Likewise. * config/s390/s390.c (s390_va_start): Likewise. * config/sh/sh.c (sh_va_start): Likewise. * config/stormy16/stormy16.c (xstormy16_expand_builtin_va_start): Likewise. * config/xtensa/xtensa.c (xtensa_va_start, xtensa_gimplify_va_arg_expr): Likewise. * objc/objc-act.c (build_objc_string_object, build_objc_symtab_template, init_def_list, init_objc_symtab, init_module_descriptor, generate_static_references, build_selector_translation_table, get_proto_encoding, build_typed_selector_reference, build_selector_reference, build_next_objc_exception_stuff, build_method_prototype_list_template, generate_descriptor_table, generate_protocols, build_protocol_initializer, build_ivar_list_template, build_method_list_template, build_ivar_list_initializer, generate_ivars_list, generate_dispatch_table, generate_protocol_list, build_category_initializer, build_shared_structure_initializer, generate_shared_structures, handle_impent, generate_objc_image_info): Likewise. 2004-04-25 Paolo Bonzini <bonzini@gnu.org> * cfglayout.c (duplicate_insn_chain): Remove references to NOTE_INSN_LOOP_VTOP and NOTE_INSN_LOOP_CONT. * cfgloop.h (struct loop): Remove fields vtop, cont and cont_dominator. * cfgrtl.c (rtl_delete_block): Remove handling of NOTE_INSN_LOOP_CONT. * final.c (final_scan_insn): Remove references to NOTE_INSN_LOOP_VTOP and NOTE_INSN_LOOP_CONT. * insn-notes.def (NOTE_INSN_LOOP_VTOP, NOTE_INSN_LOOP_CONT): Remove. * jump.c (squeeze_notes): Remove references to NOTE_INSN_LOOP_VTOP and NOTE_INSN_LOOP_CONT. * loop.c (scan_loops, find_and_verify_loops, for_each_insn_in_loop, check_dbra_loop, loop_dump_aux): Remove references to removed notes and fields. * reorg.c (mostly_true_jump): Do not rely on NOTE_INSN_LOOP_VTOPs. * unroll.c (unroll_loop, copy_loop_body, loop_iterations): Remove references to removed notes and fields. (subtract_reg_term, ujump_to_loop_cont): Remove. From-SVN: r86544
2004-08-25 11:52:54 +02:00
initlist = tree_cons (NULL_TREE, build_int_cst (NULL_TREE, 0), NULL_TREE);
Makefile.in (c-parse.o): Depend on $(C_COMMON_H). [gcc/ChangeLog] 2004-09-07 Ziemowit Laski <zlaski@apple.com> * Makefile.in (c-parse.o): Depend on $(C_COMMON_H). * c-parse.in: Include c-common.h instead of objc-act.h. (ivar_decl_list, ivar_decls, ivar_decl, ivars, ivar_declarator, myparms, myparm): Remove %type declarations. (methodtype, optparms, OBJC_TYPE_QUAL, objc_quals, objc_qual, objc_typename, objc_try_catch_stmt, optellipsis): Add %type declarations. (objc_inherit_code, objc_public_flag): Remove. (typespec_nonreserved_nonattr): Call objc_get_protocol_qualified_type() instead of get_static_reference() and get_protocol_reference(). (stmt_nocomp): Call grokparm() on @catch parameter. (objcdef): Move semantic action to objc_finish_implementation(). (classdef): Move semantic action to objc_start_class_interface(), objc_continue_interface(), objc_finish_interface(), objc_start_class_implementation(), objc_continue_implementation(), objc_start_category_interface() and objc_start_category_implementation(). (protocoldef): Move semantic actions to objc_start_protocol() and objc_finish_interface(). (ivar_decl_list): Remove nonterminal. (visibility_spec): Move semantic actions to objc_set_visibility(). (ivar_decls): Remove assignment to $$. (ivar_decl): Rephrase in terms of component_decl; call objc_add_instance_variable(). (ivars, ivar_declarator): Remove nonterminals. (opt_semi): New nonterminal. (methodtype): Remove semantic actions. (methoddef): Move semantic actions to objc_set_method_type(), objc_start_method_definition() and objc_finish_method_definition(). (methodproto): Move semantic actions to objc_set_method_type() and objc_add_method_declaration(). (methoddecl): Use objc_typename instead of typename; move semantic actions to objc_build_method_signature(). (optarglist, myxdecls, mydecl, myparms, myparm): Remove nonterminals. (optparmlist): Express in terms of optparms and optellipsis. (optparms, optellipsis, objc_qual, objc_quals, objc_typename): New nonterminals. (keyworddecl): Use objc_typename instead of typename. (rid_to_yy): Mark RID_IN, RID_OUT, RID_INOUT, RID_BYCOPY, RID_BYREF and RID_ONEWAY as returning OBJC_TYPE_QUAL to yyparse(). [gcc/objc/ChangeLog] 2004-09-07 Ziemowit Laski <zlaski@apple.com> * Make-lang.in (objc/objc-parse.o): Depend on $(C_COMMON_H) instead of objc/objc-act.h. (objc/objc-act.o): Depend on $(HASHTAB_H). * objc-act.c: Include hashtab.h; in ObjC++ mode, include cp-tree.h and objcp-decl.h instead of c-tree.h. (build_module_descriptor, get_class_ivars, synth_id_with_class_suffix, error_with_ivar, gen_method_decl, gen_declaration, setup_string_decl, build_protocol_template): Adjust prototypes. (build_module_initializer_routine, start_class, continue_class, finish_class, start_method_def, objc_start_function, start_protocol, build_method_decl, objc_add_method, add_instance_variable, build_ivar_reference, is_ivar, is_private, get_super_receiver, build_selector_table_decl, objc_push_parm, objc_get_parm_info, gen_type_name, gen_type_name_0, start_var_decl, finish_var_decl, create_field_decl): New prototypes. (objc_expand_function_end, comp_method_with_proto, objc_expr_last, gen_declaration_1, gen_declarator, is_complex_decl, adorn_decl, define_decl, create_builtin_decl, gen_declspecs): Remove prototypes. (TYPE_ID): Rename to OBJECT_TYPEDEF_NAME. (CLASS_TYPEDEF_NAME): New. (TAG_EXECCLASS): Change from a global variable to a #define. (TAG_RETURN_STRUCT): Delete. (TAG_GNUINIT): New, holds '__objc_gnu_init' name. (objc_inherit_code, objc_public_flag): New, moved from c-parse.in. (string_descriptor): New struct. (string_htab): New hash table. (string_hash, string_eq): New prototypes. (generate_struct_by_value_array): Call create_field_decl() instead of create_builtin_decl(). (objc_init): Do not initialize objc_ellipsis_node or TAG_EXECCLASS; In ObjC++ mode, call cxx_init() instead of c_objc_common_init(). (objc_finish_file): In ObjC++, call instantiate_pending_templates() and cp_finish_file(). (define_decl, get_static_reference, get_protocol_reference, create_builtin_decl): Remove functions. (objc_start_class_interface, objc_start_category_interface, objc_start_protocol, objc_continue_interface, objc_finish_interface, objc_start_class_implementation, objc_start_category_implementation, objc_continue_implementation, objc_finish_implementation, objc_set_visibility, objc_set_method_type, objc_build_method_signature, objc_add_method_declaration, objc_start_method_definition, objc_add_instance_variable, objc_get_protocol_qualified_type, create_field_decl, start_var_decl, finish_var_decl): New functions. (setup_string_decl): Simplify since it is only called once. (synth_module_prologue): Call build_class_template(); predefine 'id' and 'Class' as typedefs; rename 'temp_type' to 'type'; disable debug hooks for duration of function; fix GNU runtime messenger signatures to correspond to reality; forward-declare '__objc_exec_class' for the GNU runtime; call build_selector_table_decl(); in ObjC++ mode, generate 'extern "C" { ... }' wrappers around synthesized declarations; call build_protocol_template() and build_category_template(). (string_hash, string_eq): New functions. (objc_build_string_object): Check metaclass correctness only once; store string literals in hash table. (objc_build_constructor): Do not convert initializer elements; adjust for ObjC++ impedance mismatch. (build_objc_symtab_template): Call create_field_decl() instead of create_builtin_decl(). (init_objc_symtab): Add missing conversion to initializer element. (build_metadata_decl): Call start_var_decl() instead of define_decl(). (generate_objc_symtab_decl): Do not call build_category_template(); call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(). (build_module_descriptor): Call create_field_decl() instead of grokfield(); call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(); always mark module descriptor as used; move GNU runtime-specific functionality to build_module_initializer_routine(). (build_module_initializer_routine): New function, broken off of build_module_descriptor(). (objc_static_init_needed_p, objc_generate_static_init_call): New functions. (generate_static_references, generate_strings, build_selector_translation_table, generate_descriptor_table, generate_ivars_list, generate_dispatch_table, generate_category): Call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(); build a type directly instead of via groktypename(). (build_selector_reference_decl, build_selector_table_decl, build_class_reference_decl, build_protocol_reference, generate_objc_image_info): Call start_var_decl() instead of build_decl(). (build_selector_reference): For GNU runtime, do not call build_selector_reference_decl(). (build_selector, build_typed_selector_reference): Always convert result to the selector type. (add_objc_string): Cast return value to 'char *'. (build_method_prototype_template, build_selector_template, build_method_template): Use actual selector type for fields pointing to selectors. (finish_objc): For GNU runtime, call build_module_initializer_routine() after build_module_descriptor(). (generate_protocol_list, generate_shared_structures): Call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(); build a type directly instead of via groktypename(). (synth_id_with_class_suffix): Return a string. (get_arg_type_list): For instance methods, use the instance type for 'self'; do not call groktypename_in_parm_context(). (build_objc_string_decl): Squash redeclaration errors in ObjC++. (objc_is_class_name): Use OBJC_TYPE_NAME instead of TYPE_NAME; handle RECORD_TYPEs in ObjC as well as ObjC++. (objc_is_id): New function. (objc_is_object_ptr): Return the canonical type node. (objc_get_class_ivars): Simplify using get_class_ivars(). (get_class_ivars): Remove second parameter; create a fresh copy of the ivar list for each call; do not check for existence of super class. (objc_eh_runtime_type): Mark #ifndef OBJCPLUS. (objc_init_exceptions): When using SJLJ-style exceptions, require the use of '-fobjc-exceptions' flag; do not require it for DWARF-style exceptions. (objc_build_exc_ptr, next_sjlj_build_try_catch_finally): Use objc_object_type instead of objc_id_type. (objc_begin_catch_clause): Convert the incoming PARM_DECL into a VAR_DECL before placing it in the appropriate scope; do not call define_decl(); adjust call to c_begin_compound_stmt(); use objc_object_type instead of objc_id_type. (build_next_objc_exception_stuff): Call create_field_decl() instead of create_builtin_decl(); construct type directly instead of calling groktypename(); use OBJC_VOID_AT_END to mark end of function parameters. (build_private_template): Adjust call to get_class_ivars(); build a type directly instead of via groktypename(). (build_protocol_template, build_method_prototype_list_template, build_method_prototype_template, build_category_template, build_selector_template, build_class_template, build_super_template, build_ivar_template, build_ivar_list_template, build_method_list_template, build_method_template): Call create_field_decl() instead of grokfield(). (objc_method_parm_type): Do not call groktypename(). (generate_descriptor_table): Call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(). (generate_method_descriptors, build_protocol_initializer, generate_dispatch_tables, build_category_initializer, build_shared_structure_initializer): Do not call groktypename(). (generate_protocols): Call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(); do not call groktypename(). (error_with_ivar): Remove last parameter. (check_ivars): Do not iterate ovar CLASS_RAW_IVARS lists in addition to CLASS_IVARS lists; adjust calls to error_with_ivar(). (generate_ivar_lists): Convert one of the initializer elements; do not call groktypename(). (get_arg_type_list, start_method_def, gen_method_def): Account for new representation of variable arguments and '...' in Objective-C methods; add Objective-C++ impedance matching code. (is_objc_type_qualifier): Remove function. (adjust_type_for_id_default): Simplify; there is no longer a need to wade through declspecs. (lookup_interface, start_class, continue_class, finish_class, start_method_def, start_protocol, build_method_decl, objc_add_method, add_instance_variable, build_ivar_reference, is_ivar, is_private, get_super_receiver, objc_build_finally_epilogue): Make into static functions. (receiver_is_class_object): Use new IS_CLASS() macro. (objc_build_message_expr): Tweak ObjC++ message argument handling; call objc_finish_message_expr() instead of finish_message_expr(). (finish_message_expr): Rename to objc_finish_message_expr(); use OBJC_TYPE_NAME and OBJC_SET_TYPE_NAME macros instead of TYPE_NAME. call gen_type_name() instead of gen_declaration(); call objc_is_id() instead of using IS_ID and IS_CLASS; Use objc_class_name instead of calling get_identifier("Class"); handle CONVERT_EXPRs in receiver. (build_objc_method_call, warn_with_method): Do not call groktypename(). (build_ivar_reference): Call convert() instead of clobbering in a type. (hash_init): Initialize string_htab hash table. (add_instance_variable): Simplify parameter list; do not call grokfield(); do not populate CLASS_IVARS list. (start_class): Check for the existence of super class, if one was specified. (continue_class): Use CLASS_RAW_IVARS rather than CLASS_IVARS; do not call build_class_template(); adjust call to get_class_ivars(); call build_decl(), pushdecl() and finish_decl() instead of define_decl(). (finish_class): Call build_decl(), pushdecl() and finish_decl() instead of define_decl(). (add_protocols): Use PROTOCOL_BINFO_ELTS for the tree vector size. (start_protocol): Do not call build_protocol_template(); use PROTOCOL_BINFO_ELTS for the tree vector size. (encode_type_qualifiers): Do not handle the 'const' qualifier here. (encode_pointer): Encode 'const char *' as 'r*', for backwards compatibility. (encode_array): Use HOST_WIDE_INT_PRINT_DEC instead of "%ld". (encode_type): Handle the 'const' qualifier here. (objc_parmlist): New global variable, sued by objc_push_parm and objc_get_parm_info(). (objc_push_parm, objc_get_parm_info): New functions. (objc_expr_last): Remove function. (synth_self_and_ucmd_args): For instance methods, use the instance type for 'self'; call objc_push_parm() instead of push_parm_decl(). (start_method_def): Do not call push_scope(), declare_parm_level(), pop_scope(), push_parm_decl(), store_parm_decls() or objc_expr_last(); just use objc_push_parm() and objc_get_parm_info(). (comp_method_with_proto): Remove function. (objc_types_are_equivalent): Strip away indirections before comparing underlying types. (comp_proto_with_proto): Do not call groktypename(); types are no longer in raw declspec format. (objc_start_function): New function. (really_start_method): Call comp_proto_with_proto() instead of comp_method_with_proto(); call objc_start_function() instead of hand-crafting a function declarator. (continue_method_def, objc_expand_function_end): Remove functions. (get_super_receiver): Call objc_get_current_scope() instead of get_current_scope(); reference 'super_class' field (instead of 'class'). (finish_method_def): Rename to objc_finish_method_definition() and add a function decl parameter; move method encoding call from objc_expand_function_end(). (is_complex_decl, adorn_decl, gen_declarator, gen_declspecs, gen_declaration_1): Remove functions. (tmpbuf, RAW_DECLSPEC): Remove. (gen_declaration): Remove second parameter; simplify to deal with TYPE_P nodes instead of raw declspecs. (gen_type_name, gen_type_name_0): New functions. (gen_method_decl): Remove second parameter; call gen_type_name() instead of gen_declaration_1(). (dump_interface): Adjust calls to gen_declaration() and gen_method_decl(); do not allocate a separate string buffer. (init_objc): Allocate a larger string buffer to accommodate dump_interface(); adjust call to build_module_descriptor(); add call to build_module_initializer_routine() for the GNU runtime. (generate_classref_translation_entry): Do not call start_decl(); call finish_var_decl() instead of finish_decl(); call convert() instead of build_c_cast(). * objc-act.h (CLASS_OWN_IVARS): Remove accessor. (CLASS_BINFO_ELTS): Reduce from 6 to 5, now that CLASS_OWN_IVARS is gone. (OCTI_GNU_INIT_DECL, GNU_INIT_decl): New. (OCTI_ELLIPSIS_NODE, objc_ellipsis_node): Remove. (OCTI_ID_ID, id_type, objc_id_id): Rename to OCTI_ID_NAME, objc_object_type and objc_object_name, respectively. (OCTI_CLS_REF, OCTI_CLASS_NAME, objc_class_reference, objc_class_name): New. (IS_CLASS): New macro. (IS_ID, IS_SUPER): Robustify. (OCTI_EXECCLASS_DECL, execclass_decl): New. (finish_file, start_class, continue_class, finish_class, start_method_def, continue_method_def, finish_method_def, start_protocol, finish_protocol, objc_build_throw_stmt, objc_build_try_catch_finally_stmt, objc_build_synchronized_prologue, objc_build_synchronized_epilogue, objc_build_try_prologue, objc_build_try_epilogue, objc_build_catch_stmt, objc_build_catch_epilogue, objc_build_finally_prologue, objc_build_finally_epilogue, is_ivar, is_private, is_public, add_instance_variable, objc_add_method, get_super_receiver, objc_clear_super_receiver, get_class_ivars_from_name, get_class_reference, get_static_reference, get_object_reference, build_message_expr, finish_message_expr, build_selector_expr, build_ivar_reference, build_keyword_decl, build_method_decl, build_protocol_expr, build_objc_string_object, objc_declare_alias, objc_declare_class, objc_declare_protocols, objc_comptypes, objc_check_decl, build_encode_expr): Remove prototypes. (imp_count, cat_count): Make GGC-aware. (OBJC_SET_TYPE_NAME): New macro. From-SVN: r87168
2004-09-08 02:49:44 +02:00
e = build_int_cst (build_pointer_type (objc_protocol_template), size);
initlist = tree_cons (NULL_TREE, e, initlist);
for (lproto = plist; lproto; lproto = TREE_CHAIN (lproto))
{
tree pval = TREE_VALUE (lproto);
if (TREE_CODE (pval) == PROTOCOL_INTERFACE_TYPE
&& PROTOCOL_FORWARD_DECL (pval))
{
e = build_unary_op (ADDR_EXPR, PROTOCOL_FORWARD_DECL (pval), 0);
initlist = tree_cons (NULL_TREE, e, initlist);
}
}
/* static struct objc_protocol *refs[n]; */
if (TREE_CODE (i_or_p) == PROTOCOL_INTERFACE_TYPE)
Makefile.in (c-parse.o): Depend on $(C_COMMON_H). [gcc/ChangeLog] 2004-09-07 Ziemowit Laski <zlaski@apple.com> * Makefile.in (c-parse.o): Depend on $(C_COMMON_H). * c-parse.in: Include c-common.h instead of objc-act.h. (ivar_decl_list, ivar_decls, ivar_decl, ivars, ivar_declarator, myparms, myparm): Remove %type declarations. (methodtype, optparms, OBJC_TYPE_QUAL, objc_quals, objc_qual, objc_typename, objc_try_catch_stmt, optellipsis): Add %type declarations. (objc_inherit_code, objc_public_flag): Remove. (typespec_nonreserved_nonattr): Call objc_get_protocol_qualified_type() instead of get_static_reference() and get_protocol_reference(). (stmt_nocomp): Call grokparm() on @catch parameter. (objcdef): Move semantic action to objc_finish_implementation(). (classdef): Move semantic action to objc_start_class_interface(), objc_continue_interface(), objc_finish_interface(), objc_start_class_implementation(), objc_continue_implementation(), objc_start_category_interface() and objc_start_category_implementation(). (protocoldef): Move semantic actions to objc_start_protocol() and objc_finish_interface(). (ivar_decl_list): Remove nonterminal. (visibility_spec): Move semantic actions to objc_set_visibility(). (ivar_decls): Remove assignment to $$. (ivar_decl): Rephrase in terms of component_decl; call objc_add_instance_variable(). (ivars, ivar_declarator): Remove nonterminals. (opt_semi): New nonterminal. (methodtype): Remove semantic actions. (methoddef): Move semantic actions to objc_set_method_type(), objc_start_method_definition() and objc_finish_method_definition(). (methodproto): Move semantic actions to objc_set_method_type() and objc_add_method_declaration(). (methoddecl): Use objc_typename instead of typename; move semantic actions to objc_build_method_signature(). (optarglist, myxdecls, mydecl, myparms, myparm): Remove nonterminals. (optparmlist): Express in terms of optparms and optellipsis. (optparms, optellipsis, objc_qual, objc_quals, objc_typename): New nonterminals. (keyworddecl): Use objc_typename instead of typename. (rid_to_yy): Mark RID_IN, RID_OUT, RID_INOUT, RID_BYCOPY, RID_BYREF and RID_ONEWAY as returning OBJC_TYPE_QUAL to yyparse(). [gcc/objc/ChangeLog] 2004-09-07 Ziemowit Laski <zlaski@apple.com> * Make-lang.in (objc/objc-parse.o): Depend on $(C_COMMON_H) instead of objc/objc-act.h. (objc/objc-act.o): Depend on $(HASHTAB_H). * objc-act.c: Include hashtab.h; in ObjC++ mode, include cp-tree.h and objcp-decl.h instead of c-tree.h. (build_module_descriptor, get_class_ivars, synth_id_with_class_suffix, error_with_ivar, gen_method_decl, gen_declaration, setup_string_decl, build_protocol_template): Adjust prototypes. (build_module_initializer_routine, start_class, continue_class, finish_class, start_method_def, objc_start_function, start_protocol, build_method_decl, objc_add_method, add_instance_variable, build_ivar_reference, is_ivar, is_private, get_super_receiver, build_selector_table_decl, objc_push_parm, objc_get_parm_info, gen_type_name, gen_type_name_0, start_var_decl, finish_var_decl, create_field_decl): New prototypes. (objc_expand_function_end, comp_method_with_proto, objc_expr_last, gen_declaration_1, gen_declarator, is_complex_decl, adorn_decl, define_decl, create_builtin_decl, gen_declspecs): Remove prototypes. (TYPE_ID): Rename to OBJECT_TYPEDEF_NAME. (CLASS_TYPEDEF_NAME): New. (TAG_EXECCLASS): Change from a global variable to a #define. (TAG_RETURN_STRUCT): Delete. (TAG_GNUINIT): New, holds '__objc_gnu_init' name. (objc_inherit_code, objc_public_flag): New, moved from c-parse.in. (string_descriptor): New struct. (string_htab): New hash table. (string_hash, string_eq): New prototypes. (generate_struct_by_value_array): Call create_field_decl() instead of create_builtin_decl(). (objc_init): Do not initialize objc_ellipsis_node or TAG_EXECCLASS; In ObjC++ mode, call cxx_init() instead of c_objc_common_init(). (objc_finish_file): In ObjC++, call instantiate_pending_templates() and cp_finish_file(). (define_decl, get_static_reference, get_protocol_reference, create_builtin_decl): Remove functions. (objc_start_class_interface, objc_start_category_interface, objc_start_protocol, objc_continue_interface, objc_finish_interface, objc_start_class_implementation, objc_start_category_implementation, objc_continue_implementation, objc_finish_implementation, objc_set_visibility, objc_set_method_type, objc_build_method_signature, objc_add_method_declaration, objc_start_method_definition, objc_add_instance_variable, objc_get_protocol_qualified_type, create_field_decl, start_var_decl, finish_var_decl): New functions. (setup_string_decl): Simplify since it is only called once. (synth_module_prologue): Call build_class_template(); predefine 'id' and 'Class' as typedefs; rename 'temp_type' to 'type'; disable debug hooks for duration of function; fix GNU runtime messenger signatures to correspond to reality; forward-declare '__objc_exec_class' for the GNU runtime; call build_selector_table_decl(); in ObjC++ mode, generate 'extern "C" { ... }' wrappers around synthesized declarations; call build_protocol_template() and build_category_template(). (string_hash, string_eq): New functions. (objc_build_string_object): Check metaclass correctness only once; store string literals in hash table. (objc_build_constructor): Do not convert initializer elements; adjust for ObjC++ impedance mismatch. (build_objc_symtab_template): Call create_field_decl() instead of create_builtin_decl(). (init_objc_symtab): Add missing conversion to initializer element. (build_metadata_decl): Call start_var_decl() instead of define_decl(). (generate_objc_symtab_decl): Do not call build_category_template(); call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(). (build_module_descriptor): Call create_field_decl() instead of grokfield(); call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(); always mark module descriptor as used; move GNU runtime-specific functionality to build_module_initializer_routine(). (build_module_initializer_routine): New function, broken off of build_module_descriptor(). (objc_static_init_needed_p, objc_generate_static_init_call): New functions. (generate_static_references, generate_strings, build_selector_translation_table, generate_descriptor_table, generate_ivars_list, generate_dispatch_table, generate_category): Call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(); build a type directly instead of via groktypename(). (build_selector_reference_decl, build_selector_table_decl, build_class_reference_decl, build_protocol_reference, generate_objc_image_info): Call start_var_decl() instead of build_decl(). (build_selector_reference): For GNU runtime, do not call build_selector_reference_decl(). (build_selector, build_typed_selector_reference): Always convert result to the selector type. (add_objc_string): Cast return value to 'char *'. (build_method_prototype_template, build_selector_template, build_method_template): Use actual selector type for fields pointing to selectors. (finish_objc): For GNU runtime, call build_module_initializer_routine() after build_module_descriptor(). (generate_protocol_list, generate_shared_structures): Call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(); build a type directly instead of via groktypename(). (synth_id_with_class_suffix): Return a string. (get_arg_type_list): For instance methods, use the instance type for 'self'; do not call groktypename_in_parm_context(). (build_objc_string_decl): Squash redeclaration errors in ObjC++. (objc_is_class_name): Use OBJC_TYPE_NAME instead of TYPE_NAME; handle RECORD_TYPEs in ObjC as well as ObjC++. (objc_is_id): New function. (objc_is_object_ptr): Return the canonical type node. (objc_get_class_ivars): Simplify using get_class_ivars(). (get_class_ivars): Remove second parameter; create a fresh copy of the ivar list for each call; do not check for existence of super class. (objc_eh_runtime_type): Mark #ifndef OBJCPLUS. (objc_init_exceptions): When using SJLJ-style exceptions, require the use of '-fobjc-exceptions' flag; do not require it for DWARF-style exceptions. (objc_build_exc_ptr, next_sjlj_build_try_catch_finally): Use objc_object_type instead of objc_id_type. (objc_begin_catch_clause): Convert the incoming PARM_DECL into a VAR_DECL before placing it in the appropriate scope; do not call define_decl(); adjust call to c_begin_compound_stmt(); use objc_object_type instead of objc_id_type. (build_next_objc_exception_stuff): Call create_field_decl() instead of create_builtin_decl(); construct type directly instead of calling groktypename(); use OBJC_VOID_AT_END to mark end of function parameters. (build_private_template): Adjust call to get_class_ivars(); build a type directly instead of via groktypename(). (build_protocol_template, build_method_prototype_list_template, build_method_prototype_template, build_category_template, build_selector_template, build_class_template, build_super_template, build_ivar_template, build_ivar_list_template, build_method_list_template, build_method_template): Call create_field_decl() instead of grokfield(). (objc_method_parm_type): Do not call groktypename(). (generate_descriptor_table): Call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(). (generate_method_descriptors, build_protocol_initializer, generate_dispatch_tables, build_category_initializer, build_shared_structure_initializer): Do not call groktypename(). (generate_protocols): Call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(); do not call groktypename(). (error_with_ivar): Remove last parameter. (check_ivars): Do not iterate ovar CLASS_RAW_IVARS lists in addition to CLASS_IVARS lists; adjust calls to error_with_ivar(). (generate_ivar_lists): Convert one of the initializer elements; do not call groktypename(). (get_arg_type_list, start_method_def, gen_method_def): Account for new representation of variable arguments and '...' in Objective-C methods; add Objective-C++ impedance matching code. (is_objc_type_qualifier): Remove function. (adjust_type_for_id_default): Simplify; there is no longer a need to wade through declspecs. (lookup_interface, start_class, continue_class, finish_class, start_method_def, start_protocol, build_method_decl, objc_add_method, add_instance_variable, build_ivar_reference, is_ivar, is_private, get_super_receiver, objc_build_finally_epilogue): Make into static functions. (receiver_is_class_object): Use new IS_CLASS() macro. (objc_build_message_expr): Tweak ObjC++ message argument handling; call objc_finish_message_expr() instead of finish_message_expr(). (finish_message_expr): Rename to objc_finish_message_expr(); use OBJC_TYPE_NAME and OBJC_SET_TYPE_NAME macros instead of TYPE_NAME. call gen_type_name() instead of gen_declaration(); call objc_is_id() instead of using IS_ID and IS_CLASS; Use objc_class_name instead of calling get_identifier("Class"); handle CONVERT_EXPRs in receiver. (build_objc_method_call, warn_with_method): Do not call groktypename(). (build_ivar_reference): Call convert() instead of clobbering in a type. (hash_init): Initialize string_htab hash table. (add_instance_variable): Simplify parameter list; do not call grokfield(); do not populate CLASS_IVARS list. (start_class): Check for the existence of super class, if one was specified. (continue_class): Use CLASS_RAW_IVARS rather than CLASS_IVARS; do not call build_class_template(); adjust call to get_class_ivars(); call build_decl(), pushdecl() and finish_decl() instead of define_decl(). (finish_class): Call build_decl(), pushdecl() and finish_decl() instead of define_decl(). (add_protocols): Use PROTOCOL_BINFO_ELTS for the tree vector size. (start_protocol): Do not call build_protocol_template(); use PROTOCOL_BINFO_ELTS for the tree vector size. (encode_type_qualifiers): Do not handle the 'const' qualifier here. (encode_pointer): Encode 'const char *' as 'r*', for backwards compatibility. (encode_array): Use HOST_WIDE_INT_PRINT_DEC instead of "%ld". (encode_type): Handle the 'const' qualifier here. (objc_parmlist): New global variable, sued by objc_push_parm and objc_get_parm_info(). (objc_push_parm, objc_get_parm_info): New functions. (objc_expr_last): Remove function. (synth_self_and_ucmd_args): For instance methods, use the instance type for 'self'; call objc_push_parm() instead of push_parm_decl(). (start_method_def): Do not call push_scope(), declare_parm_level(), pop_scope(), push_parm_decl(), store_parm_decls() or objc_expr_last(); just use objc_push_parm() and objc_get_parm_info(). (comp_method_with_proto): Remove function. (objc_types_are_equivalent): Strip away indirections before comparing underlying types. (comp_proto_with_proto): Do not call groktypename(); types are no longer in raw declspec format. (objc_start_function): New function. (really_start_method): Call comp_proto_with_proto() instead of comp_method_with_proto(); call objc_start_function() instead of hand-crafting a function declarator. (continue_method_def, objc_expand_function_end): Remove functions. (get_super_receiver): Call objc_get_current_scope() instead of get_current_scope(); reference 'super_class' field (instead of 'class'). (finish_method_def): Rename to objc_finish_method_definition() and add a function decl parameter; move method encoding call from objc_expand_function_end(). (is_complex_decl, adorn_decl, gen_declarator, gen_declspecs, gen_declaration_1): Remove functions. (tmpbuf, RAW_DECLSPEC): Remove. (gen_declaration): Remove second parameter; simplify to deal with TYPE_P nodes instead of raw declspecs. (gen_type_name, gen_type_name_0): New functions. (gen_method_decl): Remove second parameter; call gen_type_name() instead of gen_declaration_1(). (dump_interface): Adjust calls to gen_declaration() and gen_method_decl(); do not allocate a separate string buffer. (init_objc): Allocate a larger string buffer to accommodate dump_interface(); adjust call to build_module_descriptor(); add call to build_module_initializer_routine() for the GNU runtime. (generate_classref_translation_entry): Do not call start_decl(); call finish_var_decl() instead of finish_decl(); call convert() instead of build_c_cast(). * objc-act.h (CLASS_OWN_IVARS): Remove accessor. (CLASS_BINFO_ELTS): Reduce from 6 to 5, now that CLASS_OWN_IVARS is gone. (OCTI_GNU_INIT_DECL, GNU_INIT_decl): New. (OCTI_ELLIPSIS_NODE, objc_ellipsis_node): Remove. (OCTI_ID_ID, id_type, objc_id_id): Rename to OCTI_ID_NAME, objc_object_type and objc_object_name, respectively. (OCTI_CLS_REF, OCTI_CLASS_NAME, objc_class_reference, objc_class_name): New. (IS_CLASS): New macro. (IS_ID, IS_SUPER): Robustify. (OCTI_EXECCLASS_DECL, execclass_decl): New. (finish_file, start_class, continue_class, finish_class, start_method_def, continue_method_def, finish_method_def, start_protocol, finish_protocol, objc_build_throw_stmt, objc_build_try_catch_finally_stmt, objc_build_synchronized_prologue, objc_build_synchronized_epilogue, objc_build_try_prologue, objc_build_try_epilogue, objc_build_catch_stmt, objc_build_catch_epilogue, objc_build_finally_prologue, objc_build_finally_epilogue, is_ivar, is_private, is_public, add_instance_variable, objc_add_method, get_super_receiver, objc_clear_super_receiver, get_class_ivars_from_name, get_class_reference, get_static_reference, get_object_reference, build_message_expr, finish_message_expr, build_selector_expr, build_ivar_reference, build_keyword_decl, build_method_decl, build_protocol_expr, build_objc_string_object, objc_declare_alias, objc_declare_class, objc_declare_protocols, objc_comptypes, objc_check_decl, build_encode_expr): Remove prototypes. (imp_count, cat_count): Make GGC-aware. (OBJC_SET_TYPE_NAME): New macro. From-SVN: r87168
2004-09-08 02:49:44 +02:00
ref_name = synth_id_with_class_suffix ("_OBJC_PROTOCOL_REFS", i_or_p);
else if (TREE_CODE (i_or_p) == CLASS_INTERFACE_TYPE)
Makefile.in (c-parse.o): Depend on $(C_COMMON_H). [gcc/ChangeLog] 2004-09-07 Ziemowit Laski <zlaski@apple.com> * Makefile.in (c-parse.o): Depend on $(C_COMMON_H). * c-parse.in: Include c-common.h instead of objc-act.h. (ivar_decl_list, ivar_decls, ivar_decl, ivars, ivar_declarator, myparms, myparm): Remove %type declarations. (methodtype, optparms, OBJC_TYPE_QUAL, objc_quals, objc_qual, objc_typename, objc_try_catch_stmt, optellipsis): Add %type declarations. (objc_inherit_code, objc_public_flag): Remove. (typespec_nonreserved_nonattr): Call objc_get_protocol_qualified_type() instead of get_static_reference() and get_protocol_reference(). (stmt_nocomp): Call grokparm() on @catch parameter. (objcdef): Move semantic action to objc_finish_implementation(). (classdef): Move semantic action to objc_start_class_interface(), objc_continue_interface(), objc_finish_interface(), objc_start_class_implementation(), objc_continue_implementation(), objc_start_category_interface() and objc_start_category_implementation(). (protocoldef): Move semantic actions to objc_start_protocol() and objc_finish_interface(). (ivar_decl_list): Remove nonterminal. (visibility_spec): Move semantic actions to objc_set_visibility(). (ivar_decls): Remove assignment to $$. (ivar_decl): Rephrase in terms of component_decl; call objc_add_instance_variable(). (ivars, ivar_declarator): Remove nonterminals. (opt_semi): New nonterminal. (methodtype): Remove semantic actions. (methoddef): Move semantic actions to objc_set_method_type(), objc_start_method_definition() and objc_finish_method_definition(). (methodproto): Move semantic actions to objc_set_method_type() and objc_add_method_declaration(). (methoddecl): Use objc_typename instead of typename; move semantic actions to objc_build_method_signature(). (optarglist, myxdecls, mydecl, myparms, myparm): Remove nonterminals. (optparmlist): Express in terms of optparms and optellipsis. (optparms, optellipsis, objc_qual, objc_quals, objc_typename): New nonterminals. (keyworddecl): Use objc_typename instead of typename. (rid_to_yy): Mark RID_IN, RID_OUT, RID_INOUT, RID_BYCOPY, RID_BYREF and RID_ONEWAY as returning OBJC_TYPE_QUAL to yyparse(). [gcc/objc/ChangeLog] 2004-09-07 Ziemowit Laski <zlaski@apple.com> * Make-lang.in (objc/objc-parse.o): Depend on $(C_COMMON_H) instead of objc/objc-act.h. (objc/objc-act.o): Depend on $(HASHTAB_H). * objc-act.c: Include hashtab.h; in ObjC++ mode, include cp-tree.h and objcp-decl.h instead of c-tree.h. (build_module_descriptor, get_class_ivars, synth_id_with_class_suffix, error_with_ivar, gen_method_decl, gen_declaration, setup_string_decl, build_protocol_template): Adjust prototypes. (build_module_initializer_routine, start_class, continue_class, finish_class, start_method_def, objc_start_function, start_protocol, build_method_decl, objc_add_method, add_instance_variable, build_ivar_reference, is_ivar, is_private, get_super_receiver, build_selector_table_decl, objc_push_parm, objc_get_parm_info, gen_type_name, gen_type_name_0, start_var_decl, finish_var_decl, create_field_decl): New prototypes. (objc_expand_function_end, comp_method_with_proto, objc_expr_last, gen_declaration_1, gen_declarator, is_complex_decl, adorn_decl, define_decl, create_builtin_decl, gen_declspecs): Remove prototypes. (TYPE_ID): Rename to OBJECT_TYPEDEF_NAME. (CLASS_TYPEDEF_NAME): New. (TAG_EXECCLASS): Change from a global variable to a #define. (TAG_RETURN_STRUCT): Delete. (TAG_GNUINIT): New, holds '__objc_gnu_init' name. (objc_inherit_code, objc_public_flag): New, moved from c-parse.in. (string_descriptor): New struct. (string_htab): New hash table. (string_hash, string_eq): New prototypes. (generate_struct_by_value_array): Call create_field_decl() instead of create_builtin_decl(). (objc_init): Do not initialize objc_ellipsis_node or TAG_EXECCLASS; In ObjC++ mode, call cxx_init() instead of c_objc_common_init(). (objc_finish_file): In ObjC++, call instantiate_pending_templates() and cp_finish_file(). (define_decl, get_static_reference, get_protocol_reference, create_builtin_decl): Remove functions. (objc_start_class_interface, objc_start_category_interface, objc_start_protocol, objc_continue_interface, objc_finish_interface, objc_start_class_implementation, objc_start_category_implementation, objc_continue_implementation, objc_finish_implementation, objc_set_visibility, objc_set_method_type, objc_build_method_signature, objc_add_method_declaration, objc_start_method_definition, objc_add_instance_variable, objc_get_protocol_qualified_type, create_field_decl, start_var_decl, finish_var_decl): New functions. (setup_string_decl): Simplify since it is only called once. (synth_module_prologue): Call build_class_template(); predefine 'id' and 'Class' as typedefs; rename 'temp_type' to 'type'; disable debug hooks for duration of function; fix GNU runtime messenger signatures to correspond to reality; forward-declare '__objc_exec_class' for the GNU runtime; call build_selector_table_decl(); in ObjC++ mode, generate 'extern "C" { ... }' wrappers around synthesized declarations; call build_protocol_template() and build_category_template(). (string_hash, string_eq): New functions. (objc_build_string_object): Check metaclass correctness only once; store string literals in hash table. (objc_build_constructor): Do not convert initializer elements; adjust for ObjC++ impedance mismatch. (build_objc_symtab_template): Call create_field_decl() instead of create_builtin_decl(). (init_objc_symtab): Add missing conversion to initializer element. (build_metadata_decl): Call start_var_decl() instead of define_decl(). (generate_objc_symtab_decl): Do not call build_category_template(); call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(). (build_module_descriptor): Call create_field_decl() instead of grokfield(); call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(); always mark module descriptor as used; move GNU runtime-specific functionality to build_module_initializer_routine(). (build_module_initializer_routine): New function, broken off of build_module_descriptor(). (objc_static_init_needed_p, objc_generate_static_init_call): New functions. (generate_static_references, generate_strings, build_selector_translation_table, generate_descriptor_table, generate_ivars_list, generate_dispatch_table, generate_category): Call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(); build a type directly instead of via groktypename(). (build_selector_reference_decl, build_selector_table_decl, build_class_reference_decl, build_protocol_reference, generate_objc_image_info): Call start_var_decl() instead of build_decl(). (build_selector_reference): For GNU runtime, do not call build_selector_reference_decl(). (build_selector, build_typed_selector_reference): Always convert result to the selector type. (add_objc_string): Cast return value to 'char *'. (build_method_prototype_template, build_selector_template, build_method_template): Use actual selector type for fields pointing to selectors. (finish_objc): For GNU runtime, call build_module_initializer_routine() after build_module_descriptor(). (generate_protocol_list, generate_shared_structures): Call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(); build a type directly instead of via groktypename(). (synth_id_with_class_suffix): Return a string. (get_arg_type_list): For instance methods, use the instance type for 'self'; do not call groktypename_in_parm_context(). (build_objc_string_decl): Squash redeclaration errors in ObjC++. (objc_is_class_name): Use OBJC_TYPE_NAME instead of TYPE_NAME; handle RECORD_TYPEs in ObjC as well as ObjC++. (objc_is_id): New function. (objc_is_object_ptr): Return the canonical type node. (objc_get_class_ivars): Simplify using get_class_ivars(). (get_class_ivars): Remove second parameter; create a fresh copy of the ivar list for each call; do not check for existence of super class. (objc_eh_runtime_type): Mark #ifndef OBJCPLUS. (objc_init_exceptions): When using SJLJ-style exceptions, require the use of '-fobjc-exceptions' flag; do not require it for DWARF-style exceptions. (objc_build_exc_ptr, next_sjlj_build_try_catch_finally): Use objc_object_type instead of objc_id_type. (objc_begin_catch_clause): Convert the incoming PARM_DECL into a VAR_DECL before placing it in the appropriate scope; do not call define_decl(); adjust call to c_begin_compound_stmt(); use objc_object_type instead of objc_id_type. (build_next_objc_exception_stuff): Call create_field_decl() instead of create_builtin_decl(); construct type directly instead of calling groktypename(); use OBJC_VOID_AT_END to mark end of function parameters. (build_private_template): Adjust call to get_class_ivars(); build a type directly instead of via groktypename(). (build_protocol_template, build_method_prototype_list_template, build_method_prototype_template, build_category_template, build_selector_template, build_class_template, build_super_template, build_ivar_template, build_ivar_list_template, build_method_list_template, build_method_template): Call create_field_decl() instead of grokfield(). (objc_method_parm_type): Do not call groktypename(). (generate_descriptor_table): Call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(). (generate_method_descriptors, build_protocol_initializer, generate_dispatch_tables, build_category_initializer, build_shared_structure_initializer): Do not call groktypename(). (generate_protocols): Call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(); do not call groktypename(). (error_with_ivar): Remove last parameter. (check_ivars): Do not iterate ovar CLASS_RAW_IVARS lists in addition to CLASS_IVARS lists; adjust calls to error_with_ivar(). (generate_ivar_lists): Convert one of the initializer elements; do not call groktypename(). (get_arg_type_list, start_method_def, gen_method_def): Account for new representation of variable arguments and '...' in Objective-C methods; add Objective-C++ impedance matching code. (is_objc_type_qualifier): Remove function. (adjust_type_for_id_default): Simplify; there is no longer a need to wade through declspecs. (lookup_interface, start_class, continue_class, finish_class, start_method_def, start_protocol, build_method_decl, objc_add_method, add_instance_variable, build_ivar_reference, is_ivar, is_private, get_super_receiver, objc_build_finally_epilogue): Make into static functions. (receiver_is_class_object): Use new IS_CLASS() macro. (objc_build_message_expr): Tweak ObjC++ message argument handling; call objc_finish_message_expr() instead of finish_message_expr(). (finish_message_expr): Rename to objc_finish_message_expr(); use OBJC_TYPE_NAME and OBJC_SET_TYPE_NAME macros instead of TYPE_NAME. call gen_type_name() instead of gen_declaration(); call objc_is_id() instead of using IS_ID and IS_CLASS; Use objc_class_name instead of calling get_identifier("Class"); handle CONVERT_EXPRs in receiver. (build_objc_method_call, warn_with_method): Do not call groktypename(). (build_ivar_reference): Call convert() instead of clobbering in a type. (hash_init): Initialize string_htab hash table. (add_instance_variable): Simplify parameter list; do not call grokfield(); do not populate CLASS_IVARS list. (start_class): Check for the existence of super class, if one was specified. (continue_class): Use CLASS_RAW_IVARS rather than CLASS_IVARS; do not call build_class_template(); adjust call to get_class_ivars(); call build_decl(), pushdecl() and finish_decl() instead of define_decl(). (finish_class): Call build_decl(), pushdecl() and finish_decl() instead of define_decl(). (add_protocols): Use PROTOCOL_BINFO_ELTS for the tree vector size. (start_protocol): Do not call build_protocol_template(); use PROTOCOL_BINFO_ELTS for the tree vector size. (encode_type_qualifiers): Do not handle the 'const' qualifier here. (encode_pointer): Encode 'const char *' as 'r*', for backwards compatibility. (encode_array): Use HOST_WIDE_INT_PRINT_DEC instead of "%ld". (encode_type): Handle the 'const' qualifier here. (objc_parmlist): New global variable, sued by objc_push_parm and objc_get_parm_info(). (objc_push_parm, objc_get_parm_info): New functions. (objc_expr_last): Remove function. (synth_self_and_ucmd_args): For instance methods, use the instance type for 'self'; call objc_push_parm() instead of push_parm_decl(). (start_method_def): Do not call push_scope(), declare_parm_level(), pop_scope(), push_parm_decl(), store_parm_decls() or objc_expr_last(); just use objc_push_parm() and objc_get_parm_info(). (comp_method_with_proto): Remove function. (objc_types_are_equivalent): Strip away indirections before comparing underlying types. (comp_proto_with_proto): Do not call groktypename(); types are no longer in raw declspec format. (objc_start_function): New function. (really_start_method): Call comp_proto_with_proto() instead of comp_method_with_proto(); call objc_start_function() instead of hand-crafting a function declarator. (continue_method_def, objc_expand_function_end): Remove functions. (get_super_receiver): Call objc_get_current_scope() instead of get_current_scope(); reference 'super_class' field (instead of 'class'). (finish_method_def): Rename to objc_finish_method_definition() and add a function decl parameter; move method encoding call from objc_expand_function_end(). (is_complex_decl, adorn_decl, gen_declarator, gen_declspecs, gen_declaration_1): Remove functions. (tmpbuf, RAW_DECLSPEC): Remove. (gen_declaration): Remove second parameter; simplify to deal with TYPE_P nodes instead of raw declspecs. (gen_type_name, gen_type_name_0): New functions. (gen_method_decl): Remove second parameter; call gen_type_name() instead of gen_declaration_1(). (dump_interface): Adjust calls to gen_declaration() and gen_method_decl(); do not allocate a separate string buffer. (init_objc): Allocate a larger string buffer to accommodate dump_interface(); adjust call to build_module_descriptor(); add call to build_module_initializer_routine() for the GNU runtime. (generate_classref_translation_entry): Do not call start_decl(); call finish_var_decl() instead of finish_decl(); call convert() instead of build_c_cast(). * objc-act.h (CLASS_OWN_IVARS): Remove accessor. (CLASS_BINFO_ELTS): Reduce from 6 to 5, now that CLASS_OWN_IVARS is gone. (OCTI_GNU_INIT_DECL, GNU_INIT_decl): New. (OCTI_ELLIPSIS_NODE, objc_ellipsis_node): Remove. (OCTI_ID_ID, id_type, objc_id_id): Rename to OCTI_ID_NAME, objc_object_type and objc_object_name, respectively. (OCTI_CLS_REF, OCTI_CLASS_NAME, objc_class_reference, objc_class_name): New. (IS_CLASS): New macro. (IS_ID, IS_SUPER): Robustify. (OCTI_EXECCLASS_DECL, execclass_decl): New. (finish_file, start_class, continue_class, finish_class, start_method_def, continue_method_def, finish_method_def, start_protocol, finish_protocol, objc_build_throw_stmt, objc_build_try_catch_finally_stmt, objc_build_synchronized_prologue, objc_build_synchronized_epilogue, objc_build_try_prologue, objc_build_try_epilogue, objc_build_catch_stmt, objc_build_catch_epilogue, objc_build_finally_prologue, objc_build_finally_epilogue, is_ivar, is_private, is_public, add_instance_variable, objc_add_method, get_super_receiver, objc_clear_super_receiver, get_class_ivars_from_name, get_class_reference, get_static_reference, get_object_reference, build_message_expr, finish_message_expr, build_selector_expr, build_ivar_reference, build_keyword_decl, build_method_decl, build_protocol_expr, build_objc_string_object, objc_declare_alias, objc_declare_class, objc_declare_protocols, objc_comptypes, objc_check_decl, build_encode_expr): Remove prototypes. (imp_count, cat_count): Make GGC-aware. (OBJC_SET_TYPE_NAME): New macro. From-SVN: r87168
2004-09-08 02:49:44 +02:00
ref_name = synth_id_with_class_suffix ("_OBJC_CLASS_PROTOCOLS", i_or_p);
else if (TREE_CODE (i_or_p) == CATEGORY_INTERFACE_TYPE)
Makefile.in (c-parse.o): Depend on $(C_COMMON_H). [gcc/ChangeLog] 2004-09-07 Ziemowit Laski <zlaski@apple.com> * Makefile.in (c-parse.o): Depend on $(C_COMMON_H). * c-parse.in: Include c-common.h instead of objc-act.h. (ivar_decl_list, ivar_decls, ivar_decl, ivars, ivar_declarator, myparms, myparm): Remove %type declarations. (methodtype, optparms, OBJC_TYPE_QUAL, objc_quals, objc_qual, objc_typename, objc_try_catch_stmt, optellipsis): Add %type declarations. (objc_inherit_code, objc_public_flag): Remove. (typespec_nonreserved_nonattr): Call objc_get_protocol_qualified_type() instead of get_static_reference() and get_protocol_reference(). (stmt_nocomp): Call grokparm() on @catch parameter. (objcdef): Move semantic action to objc_finish_implementation(). (classdef): Move semantic action to objc_start_class_interface(), objc_continue_interface(), objc_finish_interface(), objc_start_class_implementation(), objc_continue_implementation(), objc_start_category_interface() and objc_start_category_implementation(). (protocoldef): Move semantic actions to objc_start_protocol() and objc_finish_interface(). (ivar_decl_list): Remove nonterminal. (visibility_spec): Move semantic actions to objc_set_visibility(). (ivar_decls): Remove assignment to $$. (ivar_decl): Rephrase in terms of component_decl; call objc_add_instance_variable(). (ivars, ivar_declarator): Remove nonterminals. (opt_semi): New nonterminal. (methodtype): Remove semantic actions. (methoddef): Move semantic actions to objc_set_method_type(), objc_start_method_definition() and objc_finish_method_definition(). (methodproto): Move semantic actions to objc_set_method_type() and objc_add_method_declaration(). (methoddecl): Use objc_typename instead of typename; move semantic actions to objc_build_method_signature(). (optarglist, myxdecls, mydecl, myparms, myparm): Remove nonterminals. (optparmlist): Express in terms of optparms and optellipsis. (optparms, optellipsis, objc_qual, objc_quals, objc_typename): New nonterminals. (keyworddecl): Use objc_typename instead of typename. (rid_to_yy): Mark RID_IN, RID_OUT, RID_INOUT, RID_BYCOPY, RID_BYREF and RID_ONEWAY as returning OBJC_TYPE_QUAL to yyparse(). [gcc/objc/ChangeLog] 2004-09-07 Ziemowit Laski <zlaski@apple.com> * Make-lang.in (objc/objc-parse.o): Depend on $(C_COMMON_H) instead of objc/objc-act.h. (objc/objc-act.o): Depend on $(HASHTAB_H). * objc-act.c: Include hashtab.h; in ObjC++ mode, include cp-tree.h and objcp-decl.h instead of c-tree.h. (build_module_descriptor, get_class_ivars, synth_id_with_class_suffix, error_with_ivar, gen_method_decl, gen_declaration, setup_string_decl, build_protocol_template): Adjust prototypes. (build_module_initializer_routine, start_class, continue_class, finish_class, start_method_def, objc_start_function, start_protocol, build_method_decl, objc_add_method, add_instance_variable, build_ivar_reference, is_ivar, is_private, get_super_receiver, build_selector_table_decl, objc_push_parm, objc_get_parm_info, gen_type_name, gen_type_name_0, start_var_decl, finish_var_decl, create_field_decl): New prototypes. (objc_expand_function_end, comp_method_with_proto, objc_expr_last, gen_declaration_1, gen_declarator, is_complex_decl, adorn_decl, define_decl, create_builtin_decl, gen_declspecs): Remove prototypes. (TYPE_ID): Rename to OBJECT_TYPEDEF_NAME. (CLASS_TYPEDEF_NAME): New. (TAG_EXECCLASS): Change from a global variable to a #define. (TAG_RETURN_STRUCT): Delete. (TAG_GNUINIT): New, holds '__objc_gnu_init' name. (objc_inherit_code, objc_public_flag): New, moved from c-parse.in. (string_descriptor): New struct. (string_htab): New hash table. (string_hash, string_eq): New prototypes. (generate_struct_by_value_array): Call create_field_decl() instead of create_builtin_decl(). (objc_init): Do not initialize objc_ellipsis_node or TAG_EXECCLASS; In ObjC++ mode, call cxx_init() instead of c_objc_common_init(). (objc_finish_file): In ObjC++, call instantiate_pending_templates() and cp_finish_file(). (define_decl, get_static_reference, get_protocol_reference, create_builtin_decl): Remove functions. (objc_start_class_interface, objc_start_category_interface, objc_start_protocol, objc_continue_interface, objc_finish_interface, objc_start_class_implementation, objc_start_category_implementation, objc_continue_implementation, objc_finish_implementation, objc_set_visibility, objc_set_method_type, objc_build_method_signature, objc_add_method_declaration, objc_start_method_definition, objc_add_instance_variable, objc_get_protocol_qualified_type, create_field_decl, start_var_decl, finish_var_decl): New functions. (setup_string_decl): Simplify since it is only called once. (synth_module_prologue): Call build_class_template(); predefine 'id' and 'Class' as typedefs; rename 'temp_type' to 'type'; disable debug hooks for duration of function; fix GNU runtime messenger signatures to correspond to reality; forward-declare '__objc_exec_class' for the GNU runtime; call build_selector_table_decl(); in ObjC++ mode, generate 'extern "C" { ... }' wrappers around synthesized declarations; call build_protocol_template() and build_category_template(). (string_hash, string_eq): New functions. (objc_build_string_object): Check metaclass correctness only once; store string literals in hash table. (objc_build_constructor): Do not convert initializer elements; adjust for ObjC++ impedance mismatch. (build_objc_symtab_template): Call create_field_decl() instead of create_builtin_decl(). (init_objc_symtab): Add missing conversion to initializer element. (build_metadata_decl): Call start_var_decl() instead of define_decl(). (generate_objc_symtab_decl): Do not call build_category_template(); call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(). (build_module_descriptor): Call create_field_decl() instead of grokfield(); call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(); always mark module descriptor as used; move GNU runtime-specific functionality to build_module_initializer_routine(). (build_module_initializer_routine): New function, broken off of build_module_descriptor(). (objc_static_init_needed_p, objc_generate_static_init_call): New functions. (generate_static_references, generate_strings, build_selector_translation_table, generate_descriptor_table, generate_ivars_list, generate_dispatch_table, generate_category): Call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(); build a type directly instead of via groktypename(). (build_selector_reference_decl, build_selector_table_decl, build_class_reference_decl, build_protocol_reference, generate_objc_image_info): Call start_var_decl() instead of build_decl(). (build_selector_reference): For GNU runtime, do not call build_selector_reference_decl(). (build_selector, build_typed_selector_reference): Always convert result to the selector type. (add_objc_string): Cast return value to 'char *'. (build_method_prototype_template, build_selector_template, build_method_template): Use actual selector type for fields pointing to selectors. (finish_objc): For GNU runtime, call build_module_initializer_routine() after build_module_descriptor(). (generate_protocol_list, generate_shared_structures): Call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(); build a type directly instead of via groktypename(). (synth_id_with_class_suffix): Return a string. (get_arg_type_list): For instance methods, use the instance type for 'self'; do not call groktypename_in_parm_context(). (build_objc_string_decl): Squash redeclaration errors in ObjC++. (objc_is_class_name): Use OBJC_TYPE_NAME instead of TYPE_NAME; handle RECORD_TYPEs in ObjC as well as ObjC++. (objc_is_id): New function. (objc_is_object_ptr): Return the canonical type node. (objc_get_class_ivars): Simplify using get_class_ivars(). (get_class_ivars): Remove second parameter; create a fresh copy of the ivar list for each call; do not check for existence of super class. (objc_eh_runtime_type): Mark #ifndef OBJCPLUS. (objc_init_exceptions): When using SJLJ-style exceptions, require the use of '-fobjc-exceptions' flag; do not require it for DWARF-style exceptions. (objc_build_exc_ptr, next_sjlj_build_try_catch_finally): Use objc_object_type instead of objc_id_type. (objc_begin_catch_clause): Convert the incoming PARM_DECL into a VAR_DECL before placing it in the appropriate scope; do not call define_decl(); adjust call to c_begin_compound_stmt(); use objc_object_type instead of objc_id_type. (build_next_objc_exception_stuff): Call create_field_decl() instead of create_builtin_decl(); construct type directly instead of calling groktypename(); use OBJC_VOID_AT_END to mark end of function parameters. (build_private_template): Adjust call to get_class_ivars(); build a type directly instead of via groktypename(). (build_protocol_template, build_method_prototype_list_template, build_method_prototype_template, build_category_template, build_selector_template, build_class_template, build_super_template, build_ivar_template, build_ivar_list_template, build_method_list_template, build_method_template): Call create_field_decl() instead of grokfield(). (objc_method_parm_type): Do not call groktypename(). (generate_descriptor_table): Call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(). (generate_method_descriptors, build_protocol_initializer, generate_dispatch_tables, build_category_initializer, build_shared_structure_initializer): Do not call groktypename(). (generate_protocols): Call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(); do not call groktypename(). (error_with_ivar): Remove last parameter. (check_ivars): Do not iterate ovar CLASS_RAW_IVARS lists in addition to CLASS_IVARS lists; adjust calls to error_with_ivar(). (generate_ivar_lists): Convert one of the initializer elements; do not call groktypename(). (get_arg_type_list, start_method_def, gen_method_def): Account for new representation of variable arguments and '...' in Objective-C methods; add Objective-C++ impedance matching code. (is_objc_type_qualifier): Remove function. (adjust_type_for_id_default): Simplify; there is no longer a need to wade through declspecs. (lookup_interface, start_class, continue_class, finish_class, start_method_def, start_protocol, build_method_decl, objc_add_method, add_instance_variable, build_ivar_reference, is_ivar, is_private, get_super_receiver, objc_build_finally_epilogue): Make into static functions. (receiver_is_class_object): Use new IS_CLASS() macro. (objc_build_message_expr): Tweak ObjC++ message argument handling; call objc_finish_message_expr() instead of finish_message_expr(). (finish_message_expr): Rename to objc_finish_message_expr(); use OBJC_TYPE_NAME and OBJC_SET_TYPE_NAME macros instead of TYPE_NAME. call gen_type_name() instead of gen_declaration(); call objc_is_id() instead of using IS_ID and IS_CLASS; Use objc_class_name instead of calling get_identifier("Class"); handle CONVERT_EXPRs in receiver. (build_objc_method_call, warn_with_method): Do not call groktypename(). (build_ivar_reference): Call convert() instead of clobbering in a type. (hash_init): Initialize string_htab hash table. (add_instance_variable): Simplify parameter list; do not call grokfield(); do not populate CLASS_IVARS list. (start_class): Check for the existence of super class, if one was specified. (continue_class): Use CLASS_RAW_IVARS rather than CLASS_IVARS; do not call build_class_template(); adjust call to get_class_ivars(); call build_decl(), pushdecl() and finish_decl() instead of define_decl(). (finish_class): Call build_decl(), pushdecl() and finish_decl() instead of define_decl(). (add_protocols): Use PROTOCOL_BINFO_ELTS for the tree vector size. (start_protocol): Do not call build_protocol_template(); use PROTOCOL_BINFO_ELTS for the tree vector size. (encode_type_qualifiers): Do not handle the 'const' qualifier here. (encode_pointer): Encode 'const char *' as 'r*', for backwards compatibility. (encode_array): Use HOST_WIDE_INT_PRINT_DEC instead of "%ld". (encode_type): Handle the 'const' qualifier here. (objc_parmlist): New global variable, sued by objc_push_parm and objc_get_parm_info(). (objc_push_parm, objc_get_parm_info): New functions. (objc_expr_last): Remove function. (synth_self_and_ucmd_args): For instance methods, use the instance type for 'self'; call objc_push_parm() instead of push_parm_decl(). (start_method_def): Do not call push_scope(), declare_parm_level(), pop_scope(), push_parm_decl(), store_parm_decls() or objc_expr_last(); just use objc_push_parm() and objc_get_parm_info(). (comp_method_with_proto): Remove function. (objc_types_are_equivalent): Strip away indirections before comparing underlying types. (comp_proto_with_proto): Do not call groktypename(); types are no longer in raw declspec format. (objc_start_function): New function. (really_start_method): Call comp_proto_with_proto() instead of comp_method_with_proto(); call objc_start_function() instead of hand-crafting a function declarator. (continue_method_def, objc_expand_function_end): Remove functions. (get_super_receiver): Call objc_get_current_scope() instead of get_current_scope(); reference 'super_class' field (instead of 'class'). (finish_method_def): Rename to objc_finish_method_definition() and add a function decl parameter; move method encoding call from objc_expand_function_end(). (is_complex_decl, adorn_decl, gen_declarator, gen_declspecs, gen_declaration_1): Remove functions. (tmpbuf, RAW_DECLSPEC): Remove. (gen_declaration): Remove second parameter; simplify to deal with TYPE_P nodes instead of raw declspecs. (gen_type_name, gen_type_name_0): New functions. (gen_method_decl): Remove second parameter; call gen_type_name() instead of gen_declaration_1(). (dump_interface): Adjust calls to gen_declaration() and gen_method_decl(); do not allocate a separate string buffer. (init_objc): Allocate a larger string buffer to accommodate dump_interface(); adjust call to build_module_descriptor(); add call to build_module_initializer_routine() for the GNU runtime. (generate_classref_translation_entry): Do not call start_decl(); call finish_var_decl() instead of finish_decl(); call convert() instead of build_c_cast(). * objc-act.h (CLASS_OWN_IVARS): Remove accessor. (CLASS_BINFO_ELTS): Reduce from 6 to 5, now that CLASS_OWN_IVARS is gone. (OCTI_GNU_INIT_DECL, GNU_INIT_decl): New. (OCTI_ELLIPSIS_NODE, objc_ellipsis_node): Remove. (OCTI_ID_ID, id_type, objc_id_id): Rename to OCTI_ID_NAME, objc_object_type and objc_object_name, respectively. (OCTI_CLS_REF, OCTI_CLASS_NAME, objc_class_reference, objc_class_name): New. (IS_CLASS): New macro. (IS_ID, IS_SUPER): Robustify. (OCTI_EXECCLASS_DECL, execclass_decl): New. (finish_file, start_class, continue_class, finish_class, start_method_def, continue_method_def, finish_method_def, start_protocol, finish_protocol, objc_build_throw_stmt, objc_build_try_catch_finally_stmt, objc_build_synchronized_prologue, objc_build_synchronized_epilogue, objc_build_try_prologue, objc_build_try_epilogue, objc_build_catch_stmt, objc_build_catch_epilogue, objc_build_finally_prologue, objc_build_finally_epilogue, is_ivar, is_private, is_public, add_instance_variable, objc_add_method, get_super_receiver, objc_clear_super_receiver, get_class_ivars_from_name, get_class_reference, get_static_reference, get_object_reference, build_message_expr, finish_message_expr, build_selector_expr, build_ivar_reference, build_keyword_decl, build_method_decl, build_protocol_expr, build_objc_string_object, objc_declare_alias, objc_declare_class, objc_declare_protocols, objc_comptypes, objc_check_decl, build_encode_expr): Remove prototypes. (imp_count, cat_count): Make GGC-aware. (OBJC_SET_TYPE_NAME): New macro. From-SVN: r87168
2004-09-08 02:49:44 +02:00
ref_name = synth_id_with_class_suffix ("_OBJC_CATEGORY_PROTOCOLS", i_or_p);
else
abort ();
Makefile.in (c-parse.o): Depend on $(C_COMMON_H). [gcc/ChangeLog] 2004-09-07 Ziemowit Laski <zlaski@apple.com> * Makefile.in (c-parse.o): Depend on $(C_COMMON_H). * c-parse.in: Include c-common.h instead of objc-act.h. (ivar_decl_list, ivar_decls, ivar_decl, ivars, ivar_declarator, myparms, myparm): Remove %type declarations. (methodtype, optparms, OBJC_TYPE_QUAL, objc_quals, objc_qual, objc_typename, objc_try_catch_stmt, optellipsis): Add %type declarations. (objc_inherit_code, objc_public_flag): Remove. (typespec_nonreserved_nonattr): Call objc_get_protocol_qualified_type() instead of get_static_reference() and get_protocol_reference(). (stmt_nocomp): Call grokparm() on @catch parameter. (objcdef): Move semantic action to objc_finish_implementation(). (classdef): Move semantic action to objc_start_class_interface(), objc_continue_interface(), objc_finish_interface(), objc_start_class_implementation(), objc_continue_implementation(), objc_start_category_interface() and objc_start_category_implementation(). (protocoldef): Move semantic actions to objc_start_protocol() and objc_finish_interface(). (ivar_decl_list): Remove nonterminal. (visibility_spec): Move semantic actions to objc_set_visibility(). (ivar_decls): Remove assignment to $$. (ivar_decl): Rephrase in terms of component_decl; call objc_add_instance_variable(). (ivars, ivar_declarator): Remove nonterminals. (opt_semi): New nonterminal. (methodtype): Remove semantic actions. (methoddef): Move semantic actions to objc_set_method_type(), objc_start_method_definition() and objc_finish_method_definition(). (methodproto): Move semantic actions to objc_set_method_type() and objc_add_method_declaration(). (methoddecl): Use objc_typename instead of typename; move semantic actions to objc_build_method_signature(). (optarglist, myxdecls, mydecl, myparms, myparm): Remove nonterminals. (optparmlist): Express in terms of optparms and optellipsis. (optparms, optellipsis, objc_qual, objc_quals, objc_typename): New nonterminals. (keyworddecl): Use objc_typename instead of typename. (rid_to_yy): Mark RID_IN, RID_OUT, RID_INOUT, RID_BYCOPY, RID_BYREF and RID_ONEWAY as returning OBJC_TYPE_QUAL to yyparse(). [gcc/objc/ChangeLog] 2004-09-07 Ziemowit Laski <zlaski@apple.com> * Make-lang.in (objc/objc-parse.o): Depend on $(C_COMMON_H) instead of objc/objc-act.h. (objc/objc-act.o): Depend on $(HASHTAB_H). * objc-act.c: Include hashtab.h; in ObjC++ mode, include cp-tree.h and objcp-decl.h instead of c-tree.h. (build_module_descriptor, get_class_ivars, synth_id_with_class_suffix, error_with_ivar, gen_method_decl, gen_declaration, setup_string_decl, build_protocol_template): Adjust prototypes. (build_module_initializer_routine, start_class, continue_class, finish_class, start_method_def, objc_start_function, start_protocol, build_method_decl, objc_add_method, add_instance_variable, build_ivar_reference, is_ivar, is_private, get_super_receiver, build_selector_table_decl, objc_push_parm, objc_get_parm_info, gen_type_name, gen_type_name_0, start_var_decl, finish_var_decl, create_field_decl): New prototypes. (objc_expand_function_end, comp_method_with_proto, objc_expr_last, gen_declaration_1, gen_declarator, is_complex_decl, adorn_decl, define_decl, create_builtin_decl, gen_declspecs): Remove prototypes. (TYPE_ID): Rename to OBJECT_TYPEDEF_NAME. (CLASS_TYPEDEF_NAME): New. (TAG_EXECCLASS): Change from a global variable to a #define. (TAG_RETURN_STRUCT): Delete. (TAG_GNUINIT): New, holds '__objc_gnu_init' name. (objc_inherit_code, objc_public_flag): New, moved from c-parse.in. (string_descriptor): New struct. (string_htab): New hash table. (string_hash, string_eq): New prototypes. (generate_struct_by_value_array): Call create_field_decl() instead of create_builtin_decl(). (objc_init): Do not initialize objc_ellipsis_node or TAG_EXECCLASS; In ObjC++ mode, call cxx_init() instead of c_objc_common_init(). (objc_finish_file): In ObjC++, call instantiate_pending_templates() and cp_finish_file(). (define_decl, get_static_reference, get_protocol_reference, create_builtin_decl): Remove functions. (objc_start_class_interface, objc_start_category_interface, objc_start_protocol, objc_continue_interface, objc_finish_interface, objc_start_class_implementation, objc_start_category_implementation, objc_continue_implementation, objc_finish_implementation, objc_set_visibility, objc_set_method_type, objc_build_method_signature, objc_add_method_declaration, objc_start_method_definition, objc_add_instance_variable, objc_get_protocol_qualified_type, create_field_decl, start_var_decl, finish_var_decl): New functions. (setup_string_decl): Simplify since it is only called once. (synth_module_prologue): Call build_class_template(); predefine 'id' and 'Class' as typedefs; rename 'temp_type' to 'type'; disable debug hooks for duration of function; fix GNU runtime messenger signatures to correspond to reality; forward-declare '__objc_exec_class' for the GNU runtime; call build_selector_table_decl(); in ObjC++ mode, generate 'extern "C" { ... }' wrappers around synthesized declarations; call build_protocol_template() and build_category_template(). (string_hash, string_eq): New functions. (objc_build_string_object): Check metaclass correctness only once; store string literals in hash table. (objc_build_constructor): Do not convert initializer elements; adjust for ObjC++ impedance mismatch. (build_objc_symtab_template): Call create_field_decl() instead of create_builtin_decl(). (init_objc_symtab): Add missing conversion to initializer element. (build_metadata_decl): Call start_var_decl() instead of define_decl(). (generate_objc_symtab_decl): Do not call build_category_template(); call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(). (build_module_descriptor): Call create_field_decl() instead of grokfield(); call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(); always mark module descriptor as used; move GNU runtime-specific functionality to build_module_initializer_routine(). (build_module_initializer_routine): New function, broken off of build_module_descriptor(). (objc_static_init_needed_p, objc_generate_static_init_call): New functions. (generate_static_references, generate_strings, build_selector_translation_table, generate_descriptor_table, generate_ivars_list, generate_dispatch_table, generate_category): Call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(); build a type directly instead of via groktypename(). (build_selector_reference_decl, build_selector_table_decl, build_class_reference_decl, build_protocol_reference, generate_objc_image_info): Call start_var_decl() instead of build_decl(). (build_selector_reference): For GNU runtime, do not call build_selector_reference_decl(). (build_selector, build_typed_selector_reference): Always convert result to the selector type. (add_objc_string): Cast return value to 'char *'. (build_method_prototype_template, build_selector_template, build_method_template): Use actual selector type for fields pointing to selectors. (finish_objc): For GNU runtime, call build_module_initializer_routine() after build_module_descriptor(). (generate_protocol_list, generate_shared_structures): Call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(); build a type directly instead of via groktypename(). (synth_id_with_class_suffix): Return a string. (get_arg_type_list): For instance methods, use the instance type for 'self'; do not call groktypename_in_parm_context(). (build_objc_string_decl): Squash redeclaration errors in ObjC++. (objc_is_class_name): Use OBJC_TYPE_NAME instead of TYPE_NAME; handle RECORD_TYPEs in ObjC as well as ObjC++. (objc_is_id): New function. (objc_is_object_ptr): Return the canonical type node. (objc_get_class_ivars): Simplify using get_class_ivars(). (get_class_ivars): Remove second parameter; create a fresh copy of the ivar list for each call; do not check for existence of super class. (objc_eh_runtime_type): Mark #ifndef OBJCPLUS. (objc_init_exceptions): When using SJLJ-style exceptions, require the use of '-fobjc-exceptions' flag; do not require it for DWARF-style exceptions. (objc_build_exc_ptr, next_sjlj_build_try_catch_finally): Use objc_object_type instead of objc_id_type. (objc_begin_catch_clause): Convert the incoming PARM_DECL into a VAR_DECL before placing it in the appropriate scope; do not call define_decl(); adjust call to c_begin_compound_stmt(); use objc_object_type instead of objc_id_type. (build_next_objc_exception_stuff): Call create_field_decl() instead of create_builtin_decl(); construct type directly instead of calling groktypename(); use OBJC_VOID_AT_END to mark end of function parameters. (build_private_template): Adjust call to get_class_ivars(); build a type directly instead of via groktypename(). (build_protocol_template, build_method_prototype_list_template, build_method_prototype_template, build_category_template, build_selector_template, build_class_template, build_super_template, build_ivar_template, build_ivar_list_template, build_method_list_template, build_method_template): Call create_field_decl() instead of grokfield(). (objc_method_parm_type): Do not call groktypename(). (generate_descriptor_table): Call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(). (generate_method_descriptors, build_protocol_initializer, generate_dispatch_tables, build_category_initializer, build_shared_structure_initializer): Do not call groktypename(). (generate_protocols): Call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(); do not call groktypename(). (error_with_ivar): Remove last parameter. (check_ivars): Do not iterate ovar CLASS_RAW_IVARS lists in addition to CLASS_IVARS lists; adjust calls to error_with_ivar(). (generate_ivar_lists): Convert one of the initializer elements; do not call groktypename(). (get_arg_type_list, start_method_def, gen_method_def): Account for new representation of variable arguments and '...' in Objective-C methods; add Objective-C++ impedance matching code. (is_objc_type_qualifier): Remove function. (adjust_type_for_id_default): Simplify; there is no longer a need to wade through declspecs. (lookup_interface, start_class, continue_class, finish_class, start_method_def, start_protocol, build_method_decl, objc_add_method, add_instance_variable, build_ivar_reference, is_ivar, is_private, get_super_receiver, objc_build_finally_epilogue): Make into static functions. (receiver_is_class_object): Use new IS_CLASS() macro. (objc_build_message_expr): Tweak ObjC++ message argument handling; call objc_finish_message_expr() instead of finish_message_expr(). (finish_message_expr): Rename to objc_finish_message_expr(); use OBJC_TYPE_NAME and OBJC_SET_TYPE_NAME macros instead of TYPE_NAME. call gen_type_name() instead of gen_declaration(); call objc_is_id() instead of using IS_ID and IS_CLASS; Use objc_class_name instead of calling get_identifier("Class"); handle CONVERT_EXPRs in receiver. (build_objc_method_call, warn_with_method): Do not call groktypename(). (build_ivar_reference): Call convert() instead of clobbering in a type. (hash_init): Initialize string_htab hash table. (add_instance_variable): Simplify parameter list; do not call grokfield(); do not populate CLASS_IVARS list. (start_class): Check for the existence of super class, if one was specified. (continue_class): Use CLASS_RAW_IVARS rather than CLASS_IVARS; do not call build_class_template(); adjust call to get_class_ivars(); call build_decl(), pushdecl() and finish_decl() instead of define_decl(). (finish_class): Call build_decl(), pushdecl() and finish_decl() instead of define_decl(). (add_protocols): Use PROTOCOL_BINFO_ELTS for the tree vector size. (start_protocol): Do not call build_protocol_template(); use PROTOCOL_BINFO_ELTS for the tree vector size. (encode_type_qualifiers): Do not handle the 'const' qualifier here. (encode_pointer): Encode 'const char *' as 'r*', for backwards compatibility. (encode_array): Use HOST_WIDE_INT_PRINT_DEC instead of "%ld". (encode_type): Handle the 'const' qualifier here. (objc_parmlist): New global variable, sued by objc_push_parm and objc_get_parm_info(). (objc_push_parm, objc_get_parm_info): New functions. (objc_expr_last): Remove function. (synth_self_and_ucmd_args): For instance methods, use the instance type for 'self'; call objc_push_parm() instead of push_parm_decl(). (start_method_def): Do not call push_scope(), declare_parm_level(), pop_scope(), push_parm_decl(), store_parm_decls() or objc_expr_last(); just use objc_push_parm() and objc_get_parm_info(). (comp_method_with_proto): Remove function. (objc_types_are_equivalent): Strip away indirections before comparing underlying types. (comp_proto_with_proto): Do not call groktypename(); types are no longer in raw declspec format. (objc_start_function): New function. (really_start_method): Call comp_proto_with_proto() instead of comp_method_with_proto(); call objc_start_function() instead of hand-crafting a function declarator. (continue_method_def, objc_expand_function_end): Remove functions. (get_super_receiver): Call objc_get_current_scope() instead of get_current_scope(); reference 'super_class' field (instead of 'class'). (finish_method_def): Rename to objc_finish_method_definition() and add a function decl parameter; move method encoding call from objc_expand_function_end(). (is_complex_decl, adorn_decl, gen_declarator, gen_declspecs, gen_declaration_1): Remove functions. (tmpbuf, RAW_DECLSPEC): Remove. (gen_declaration): Remove second parameter; simplify to deal with TYPE_P nodes instead of raw declspecs. (gen_type_name, gen_type_name_0): New functions. (gen_method_decl): Remove second parameter; call gen_type_name() instead of gen_declaration_1(). (dump_interface): Adjust calls to gen_declaration() and gen_method_decl(); do not allocate a separate string buffer. (init_objc): Allocate a larger string buffer to accommodate dump_interface(); adjust call to build_module_descriptor(); add call to build_module_initializer_routine() for the GNU runtime. (generate_classref_translation_entry): Do not call start_decl(); call finish_var_decl() instead of finish_decl(); call convert() instead of build_c_cast(). * objc-act.h (CLASS_OWN_IVARS): Remove accessor. (CLASS_BINFO_ELTS): Reduce from 6 to 5, now that CLASS_OWN_IVARS is gone. (OCTI_GNU_INIT_DECL, GNU_INIT_decl): New. (OCTI_ELLIPSIS_NODE, objc_ellipsis_node): Remove. (OCTI_ID_ID, id_type, objc_id_id): Rename to OCTI_ID_NAME, objc_object_type and objc_object_name, respectively. (OCTI_CLS_REF, OCTI_CLASS_NAME, objc_class_reference, objc_class_name): New. (IS_CLASS): New macro. (IS_ID, IS_SUPER): Robustify. (OCTI_EXECCLASS_DECL, execclass_decl): New. (finish_file, start_class, continue_class, finish_class, start_method_def, continue_method_def, finish_method_def, start_protocol, finish_protocol, objc_build_throw_stmt, objc_build_try_catch_finally_stmt, objc_build_synchronized_prologue, objc_build_synchronized_epilogue, objc_build_try_prologue, objc_build_try_epilogue, objc_build_catch_stmt, objc_build_catch_epilogue, objc_build_finally_prologue, objc_build_finally_epilogue, is_ivar, is_private, is_public, add_instance_variable, objc_add_method, get_super_receiver, objc_clear_super_receiver, get_class_ivars_from_name, get_class_reference, get_static_reference, get_object_reference, build_message_expr, finish_message_expr, build_selector_expr, build_ivar_reference, build_keyword_decl, build_method_decl, build_protocol_expr, build_objc_string_object, objc_declare_alias, objc_declare_class, objc_declare_protocols, objc_comptypes, objc_check_decl, build_encode_expr): Remove prototypes. (imp_count, cat_count): Make GGC-aware. (OBJC_SET_TYPE_NAME): New macro. From-SVN: r87168
2004-09-08 02:49:44 +02:00
refs_decl = start_var_decl
(build_array_type
(build_pointer_type (objc_protocol_template),
build_index_type (build_int_cst (NULL_TREE, size + 2))),
ref_name);
Makefile.in (c-parse.o): Depend on $(C_COMMON_H). [gcc/ChangeLog] 2004-09-07 Ziemowit Laski <zlaski@apple.com> * Makefile.in (c-parse.o): Depend on $(C_COMMON_H). * c-parse.in: Include c-common.h instead of objc-act.h. (ivar_decl_list, ivar_decls, ivar_decl, ivars, ivar_declarator, myparms, myparm): Remove %type declarations. (methodtype, optparms, OBJC_TYPE_QUAL, objc_quals, objc_qual, objc_typename, objc_try_catch_stmt, optellipsis): Add %type declarations. (objc_inherit_code, objc_public_flag): Remove. (typespec_nonreserved_nonattr): Call objc_get_protocol_qualified_type() instead of get_static_reference() and get_protocol_reference(). (stmt_nocomp): Call grokparm() on @catch parameter. (objcdef): Move semantic action to objc_finish_implementation(). (classdef): Move semantic action to objc_start_class_interface(), objc_continue_interface(), objc_finish_interface(), objc_start_class_implementation(), objc_continue_implementation(), objc_start_category_interface() and objc_start_category_implementation(). (protocoldef): Move semantic actions to objc_start_protocol() and objc_finish_interface(). (ivar_decl_list): Remove nonterminal. (visibility_spec): Move semantic actions to objc_set_visibility(). (ivar_decls): Remove assignment to $$. (ivar_decl): Rephrase in terms of component_decl; call objc_add_instance_variable(). (ivars, ivar_declarator): Remove nonterminals. (opt_semi): New nonterminal. (methodtype): Remove semantic actions. (methoddef): Move semantic actions to objc_set_method_type(), objc_start_method_definition() and objc_finish_method_definition(). (methodproto): Move semantic actions to objc_set_method_type() and objc_add_method_declaration(). (methoddecl): Use objc_typename instead of typename; move semantic actions to objc_build_method_signature(). (optarglist, myxdecls, mydecl, myparms, myparm): Remove nonterminals. (optparmlist): Express in terms of optparms and optellipsis. (optparms, optellipsis, objc_qual, objc_quals, objc_typename): New nonterminals. (keyworddecl): Use objc_typename instead of typename. (rid_to_yy): Mark RID_IN, RID_OUT, RID_INOUT, RID_BYCOPY, RID_BYREF and RID_ONEWAY as returning OBJC_TYPE_QUAL to yyparse(). [gcc/objc/ChangeLog] 2004-09-07 Ziemowit Laski <zlaski@apple.com> * Make-lang.in (objc/objc-parse.o): Depend on $(C_COMMON_H) instead of objc/objc-act.h. (objc/objc-act.o): Depend on $(HASHTAB_H). * objc-act.c: Include hashtab.h; in ObjC++ mode, include cp-tree.h and objcp-decl.h instead of c-tree.h. (build_module_descriptor, get_class_ivars, synth_id_with_class_suffix, error_with_ivar, gen_method_decl, gen_declaration, setup_string_decl, build_protocol_template): Adjust prototypes. (build_module_initializer_routine, start_class, continue_class, finish_class, start_method_def, objc_start_function, start_protocol, build_method_decl, objc_add_method, add_instance_variable, build_ivar_reference, is_ivar, is_private, get_super_receiver, build_selector_table_decl, objc_push_parm, objc_get_parm_info, gen_type_name, gen_type_name_0, start_var_decl, finish_var_decl, create_field_decl): New prototypes. (objc_expand_function_end, comp_method_with_proto, objc_expr_last, gen_declaration_1, gen_declarator, is_complex_decl, adorn_decl, define_decl, create_builtin_decl, gen_declspecs): Remove prototypes. (TYPE_ID): Rename to OBJECT_TYPEDEF_NAME. (CLASS_TYPEDEF_NAME): New. (TAG_EXECCLASS): Change from a global variable to a #define. (TAG_RETURN_STRUCT): Delete. (TAG_GNUINIT): New, holds '__objc_gnu_init' name. (objc_inherit_code, objc_public_flag): New, moved from c-parse.in. (string_descriptor): New struct. (string_htab): New hash table. (string_hash, string_eq): New prototypes. (generate_struct_by_value_array): Call create_field_decl() instead of create_builtin_decl(). (objc_init): Do not initialize objc_ellipsis_node or TAG_EXECCLASS; In ObjC++ mode, call cxx_init() instead of c_objc_common_init(). (objc_finish_file): In ObjC++, call instantiate_pending_templates() and cp_finish_file(). (define_decl, get_static_reference, get_protocol_reference, create_builtin_decl): Remove functions. (objc_start_class_interface, objc_start_category_interface, objc_start_protocol, objc_continue_interface, objc_finish_interface, objc_start_class_implementation, objc_start_category_implementation, objc_continue_implementation, objc_finish_implementation, objc_set_visibility, objc_set_method_type, objc_build_method_signature, objc_add_method_declaration, objc_start_method_definition, objc_add_instance_variable, objc_get_protocol_qualified_type, create_field_decl, start_var_decl, finish_var_decl): New functions. (setup_string_decl): Simplify since it is only called once. (synth_module_prologue): Call build_class_template(); predefine 'id' and 'Class' as typedefs; rename 'temp_type' to 'type'; disable debug hooks for duration of function; fix GNU runtime messenger signatures to correspond to reality; forward-declare '__objc_exec_class' for the GNU runtime; call build_selector_table_decl(); in ObjC++ mode, generate 'extern "C" { ... }' wrappers around synthesized declarations; call build_protocol_template() and build_category_template(). (string_hash, string_eq): New functions. (objc_build_string_object): Check metaclass correctness only once; store string literals in hash table. (objc_build_constructor): Do not convert initializer elements; adjust for ObjC++ impedance mismatch. (build_objc_symtab_template): Call create_field_decl() instead of create_builtin_decl(). (init_objc_symtab): Add missing conversion to initializer element. (build_metadata_decl): Call start_var_decl() instead of define_decl(). (generate_objc_symtab_decl): Do not call build_category_template(); call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(). (build_module_descriptor): Call create_field_decl() instead of grokfield(); call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(); always mark module descriptor as used; move GNU runtime-specific functionality to build_module_initializer_routine(). (build_module_initializer_routine): New function, broken off of build_module_descriptor(). (objc_static_init_needed_p, objc_generate_static_init_call): New functions. (generate_static_references, generate_strings, build_selector_translation_table, generate_descriptor_table, generate_ivars_list, generate_dispatch_table, generate_category): Call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(); build a type directly instead of via groktypename(). (build_selector_reference_decl, build_selector_table_decl, build_class_reference_decl, build_protocol_reference, generate_objc_image_info): Call start_var_decl() instead of build_decl(). (build_selector_reference): For GNU runtime, do not call build_selector_reference_decl(). (build_selector, build_typed_selector_reference): Always convert result to the selector type. (add_objc_string): Cast return value to 'char *'. (build_method_prototype_template, build_selector_template, build_method_template): Use actual selector type for fields pointing to selectors. (finish_objc): For GNU runtime, call build_module_initializer_routine() after build_module_descriptor(). (generate_protocol_list, generate_shared_structures): Call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(); build a type directly instead of via groktypename(). (synth_id_with_class_suffix): Return a string. (get_arg_type_list): For instance methods, use the instance type for 'self'; do not call groktypename_in_parm_context(). (build_objc_string_decl): Squash redeclaration errors in ObjC++. (objc_is_class_name): Use OBJC_TYPE_NAME instead of TYPE_NAME; handle RECORD_TYPEs in ObjC as well as ObjC++. (objc_is_id): New function. (objc_is_object_ptr): Return the canonical type node. (objc_get_class_ivars): Simplify using get_class_ivars(). (get_class_ivars): Remove second parameter; create a fresh copy of the ivar list for each call; do not check for existence of super class. (objc_eh_runtime_type): Mark #ifndef OBJCPLUS. (objc_init_exceptions): When using SJLJ-style exceptions, require the use of '-fobjc-exceptions' flag; do not require it for DWARF-style exceptions. (objc_build_exc_ptr, next_sjlj_build_try_catch_finally): Use objc_object_type instead of objc_id_type. (objc_begin_catch_clause): Convert the incoming PARM_DECL into a VAR_DECL before placing it in the appropriate scope; do not call define_decl(); adjust call to c_begin_compound_stmt(); use objc_object_type instead of objc_id_type. (build_next_objc_exception_stuff): Call create_field_decl() instead of create_builtin_decl(); construct type directly instead of calling groktypename(); use OBJC_VOID_AT_END to mark end of function parameters. (build_private_template): Adjust call to get_class_ivars(); build a type directly instead of via groktypename(). (build_protocol_template, build_method_prototype_list_template, build_method_prototype_template, build_category_template, build_selector_template, build_class_template, build_super_template, build_ivar_template, build_ivar_list_template, build_method_list_template, build_method_template): Call create_field_decl() instead of grokfield(). (objc_method_parm_type): Do not call groktypename(). (generate_descriptor_table): Call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(). (generate_method_descriptors, build_protocol_initializer, generate_dispatch_tables, build_category_initializer, build_shared_structure_initializer): Do not call groktypename(). (generate_protocols): Call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(); do not call groktypename(). (error_with_ivar): Remove last parameter. (check_ivars): Do not iterate ovar CLASS_RAW_IVARS lists in addition to CLASS_IVARS lists; adjust calls to error_with_ivar(). (generate_ivar_lists): Convert one of the initializer elements; do not call groktypename(). (get_arg_type_list, start_method_def, gen_method_def): Account for new representation of variable arguments and '...' in Objective-C methods; add Objective-C++ impedance matching code. (is_objc_type_qualifier): Remove function. (adjust_type_for_id_default): Simplify; there is no longer a need to wade through declspecs. (lookup_interface, start_class, continue_class, finish_class, start_method_def, start_protocol, build_method_decl, objc_add_method, add_instance_variable, build_ivar_reference, is_ivar, is_private, get_super_receiver, objc_build_finally_epilogue): Make into static functions. (receiver_is_class_object): Use new IS_CLASS() macro. (objc_build_message_expr): Tweak ObjC++ message argument handling; call objc_finish_message_expr() instead of finish_message_expr(). (finish_message_expr): Rename to objc_finish_message_expr(); use OBJC_TYPE_NAME and OBJC_SET_TYPE_NAME macros instead of TYPE_NAME. call gen_type_name() instead of gen_declaration(); call objc_is_id() instead of using IS_ID and IS_CLASS; Use objc_class_name instead of calling get_identifier("Class"); handle CONVERT_EXPRs in receiver. (build_objc_method_call, warn_with_method): Do not call groktypename(). (build_ivar_reference): Call convert() instead of clobbering in a type. (hash_init): Initialize string_htab hash table. (add_instance_variable): Simplify parameter list; do not call grokfield(); do not populate CLASS_IVARS list. (start_class): Check for the existence of super class, if one was specified. (continue_class): Use CLASS_RAW_IVARS rather than CLASS_IVARS; do not call build_class_template(); adjust call to get_class_ivars(); call build_decl(), pushdecl() and finish_decl() instead of define_decl(). (finish_class): Call build_decl(), pushdecl() and finish_decl() instead of define_decl(). (add_protocols): Use PROTOCOL_BINFO_ELTS for the tree vector size. (start_protocol): Do not call build_protocol_template(); use PROTOCOL_BINFO_ELTS for the tree vector size. (encode_type_qualifiers): Do not handle the 'const' qualifier here. (encode_pointer): Encode 'const char *' as 'r*', for backwards compatibility. (encode_array): Use HOST_WIDE_INT_PRINT_DEC instead of "%ld". (encode_type): Handle the 'const' qualifier here. (objc_parmlist): New global variable, sued by objc_push_parm and objc_get_parm_info(). (objc_push_parm, objc_get_parm_info): New functions. (objc_expr_last): Remove function. (synth_self_and_ucmd_args): For instance methods, use the instance type for 'self'; call objc_push_parm() instead of push_parm_decl(). (start_method_def): Do not call push_scope(), declare_parm_level(), pop_scope(), push_parm_decl(), store_parm_decls() or objc_expr_last(); just use objc_push_parm() and objc_get_parm_info(). (comp_method_with_proto): Remove function. (objc_types_are_equivalent): Strip away indirections before comparing underlying types. (comp_proto_with_proto): Do not call groktypename(); types are no longer in raw declspec format. (objc_start_function): New function. (really_start_method): Call comp_proto_with_proto() instead of comp_method_with_proto(); call objc_start_function() instead of hand-crafting a function declarator. (continue_method_def, objc_expand_function_end): Remove functions. (get_super_receiver): Call objc_get_current_scope() instead of get_current_scope(); reference 'super_class' field (instead of 'class'). (finish_method_def): Rename to objc_finish_method_definition() and add a function decl parameter; move method encoding call from objc_expand_function_end(). (is_complex_decl, adorn_decl, gen_declarator, gen_declspecs, gen_declaration_1): Remove functions. (tmpbuf, RAW_DECLSPEC): Remove. (gen_declaration): Remove second parameter; simplify to deal with TYPE_P nodes instead of raw declspecs. (gen_type_name, gen_type_name_0): New functions. (gen_method_decl): Remove second parameter; call gen_type_name() instead of gen_declaration_1(). (dump_interface): Adjust calls to gen_declaration() and gen_method_decl(); do not allocate a separate string buffer. (init_objc): Allocate a larger string buffer to accommodate dump_interface(); adjust call to build_module_descriptor(); add call to build_module_initializer_routine() for the GNU runtime. (generate_classref_translation_entry): Do not call start_decl(); call finish_var_decl() instead of finish_decl(); call convert() instead of build_c_cast(). * objc-act.h (CLASS_OWN_IVARS): Remove accessor. (CLASS_BINFO_ELTS): Reduce from 6 to 5, now that CLASS_OWN_IVARS is gone. (OCTI_GNU_INIT_DECL, GNU_INIT_decl): New. (OCTI_ELLIPSIS_NODE, objc_ellipsis_node): Remove. (OCTI_ID_ID, id_type, objc_id_id): Rename to OCTI_ID_NAME, objc_object_type and objc_object_name, respectively. (OCTI_CLS_REF, OCTI_CLASS_NAME, objc_class_reference, objc_class_name): New. (IS_CLASS): New macro. (IS_ID, IS_SUPER): Robustify. (OCTI_EXECCLASS_DECL, execclass_decl): New. (finish_file, start_class, continue_class, finish_class, start_method_def, continue_method_def, finish_method_def, start_protocol, finish_protocol, objc_build_throw_stmt, objc_build_try_catch_finally_stmt, objc_build_synchronized_prologue, objc_build_synchronized_epilogue, objc_build_try_prologue, objc_build_try_epilogue, objc_build_catch_stmt, objc_build_catch_epilogue, objc_build_finally_prologue, objc_build_finally_epilogue, is_ivar, is_private, is_public, add_instance_variable, objc_add_method, get_super_receiver, objc_clear_super_receiver, get_class_ivars_from_name, get_class_reference, get_static_reference, get_object_reference, build_message_expr, finish_message_expr, build_selector_expr, build_ivar_reference, build_keyword_decl, build_method_decl, build_protocol_expr, build_objc_string_object, objc_declare_alias, objc_declare_class, objc_declare_protocols, objc_comptypes, objc_check_decl, build_encode_expr): Remove prototypes. (imp_count, cat_count): Make GGC-aware. (OBJC_SET_TYPE_NAME): New macro. From-SVN: r87168
2004-09-08 02:49:44 +02:00
finish_var_decl (refs_decl, objc_build_constructor (TREE_TYPE (refs_decl),
nreverse (initlist)));
return refs_decl;
1992-01-18 00:15:38 +01:00
}
static tree
build_category_initializer (tree type, tree cat_name, tree class_name,
tree instance_methods, tree class_methods,
tree protocol_list)
1992-01-18 00:15:38 +01:00
{
tree initlist = NULL_TREE, expr;
1992-01-18 00:15:38 +01:00
initlist = tree_cons (NULL_TREE, cat_name, initlist);
initlist = tree_cons (NULL_TREE, class_name, initlist);
1992-01-18 00:15:38 +01:00
if (!instance_methods)
tree.h (build_int_cst): New, sign extended constant. * tree.h (build_int_cst): New, sign extended constant. (build_int_cstu): New, zero extended constant. (build_int_cst_wide): Renamed from build_int_cst. * tree.c (build_int_cst, build_int_cstu): New. (build_int_cst_wide): Renamed from build_int_cst. (make_vector_type, build_common_tree_nodes, build_common_tree_nodes_2): Adjust build_int_cst calls. * builtins.c (expand_builtin_prefetch, expand_builtin_strstr, expand_builtin_strpbrk, expand_builtin_fputs, build_string_literal, expand_builtin_printf, expand_builtin_sprintf, fold_builtin_classify_type, fold_builtin_lround, fold_builtin_bitop, fold_builtin_isascii, fold_builtin_toascii, fold_builtin_isdigit, simplify_builtin_strstr, simplify_builtin_strpbrk, fold_builtin_fputs, simplify_builtin_sprintf): Likewise. * c-common.c (start_fname_decls, fix_string_type, shorten_compare, DEF_ATTR_INT): Likewise. * c-decl.c (complete_array_type, check_bitfield_type_and_width): Likewise. * c-lex.c (interpret_integer, lex_charconst): Likewise. * c-parse.in (primary) <TYPES_COMPATIBLE_P> Likewise. * c-pretty-print.c (pp_c_integer_constant): Likewise. * c-typeck.c (really_start_incremental_init, push_init_level, set_nonincremental_init_from_string): Likewise. * calls.c (load_register_parameters): Likewise. convert.c (convert_to_pointer): Likewise. coverage.c (coverage_counter_alloc, tree_coverage_counter_ref, build_fn_info_type, build_fn_info_value, build_ctr_info_value, build_gcov_info): Likewise. * except.c (init_eh, assign_filter_values): Likewise. * expmed.c (store_fixed_bit_field, extract_bit_field, extract_fixed_bit_field, extract_split_bit_field, expand_shift, expand_mult_const, expand_mult_highpart_adjust, extract_high_half, expand_sdiv_pow2, expand_divmod, make_tree): Likewise. * expr.c (convert_move, emit_group_load, emit_group_store, expand_assignment, store_constructor, store_field, expand_expr_real_1, reduce_to_bit_field_precision): Likewise. fold-const.c (force_fit_type, int_const_binop, fold_convert_const, invert_truthvalue, optimize_bit_field_compare, decode_field_reference, all_ones_mask_p, constant_boolean_node, fold_div_compare, fold, fold_read_from_constant_string, fold_negate_const, fold_abs_const, fold_not_const, round_up, round_down): Likewise. * function.c (assign_parm_setup_block): Likewise. * stmt.c (shift_return_value, expand_case, estimate_case_costs): Likewise. * stor-layout.c (layout_type, initialize_sizetypes, set_min_and_max_values_for_integral_type): Likewise. * tree-chrec.c (chrec_fold_multiply_poly_poly, reset_evolution_in_loop): Likewise. * tree-chrec.h (build_polynomial_chrec): Likewise. * tree-complex.c (build_replicated_const): Likewise. * tree-eh.c (honor_protect_cleanup_actions, lower_try_finally_onedest, lower_try_finally_copy, lower_try_finally_switch): Likewise. * tree-mudflap.c (mf_build_string, mx_register_decls, mudflap_register_call, mudflap_enqueue_constant): Likewise. * tree-nested.c (get_trampoline_type, get_nl_goto_field): Likewise. * tree-pretty-print.c (dump_generic_node): Likewise. * tree-ssa-ccp.c (widen_bitfield, maybe_fold_offset_to_array_ref): Likewise. * tree-ssa-dom.c (simplify_rhs_and_lookup_avail_expr): Likewise. * tree-ssa-loop-niter.c (number_of_iterations_cond, loop_niter_by_eval, upper_bound_in_type, lower_bound_in_type): Likewise. * tree-ssa-loop-ivcanon.c (create_canonical_iv, canonicalize_loop_induction_variables): Likewise. * tree-vectorizer.c (vect_create_index_for_array_ref, vect_transform_loop_bound, vect_compute_data_ref_alignment): Likewise. * config/alpha/alpha.c (alpha_initialize_trampoline, alpha_va_start, alpha_gimplify_va_arg_1): Likewise. * config/arm/arm.c (arm_get_cookie_size): Likewise. * config/c4x/c4x.c (c4x_gimplify_va_arg_expr): Likewise. * config/i386/i386.c (ix86_va_start, ix86_gimplify_va_arg): Likewise. * config/ia64/ia64.c (ia64_gimplify_va_arg): Likewise. * config/mips/mips.c (mips_build_builtin_va_list, mips_va_start, mips_gimplify_va_arg_expr): Likewise. * config/pa/pa.c (hppa_gimplify_va_arg_expr): Likewise. * config/rs6000/rs6000.c (rs6000_va_start, rs6000_gimplify_va_arg, add_compiler_branch_island): Likewise. * config/s390/s390.c (s390_va_start): Likewise. * config/sh/sh.c (sh_va_start): Likewise. * config/stormy16/stormy16.c (xstormy16_expand_builtin_va_start): Likewise. * config/xtensa/xtensa.c (xtensa_va_start, xtensa_gimplify_va_arg_expr): Likewise. * objc/objc-act.c (build_objc_string_object, build_objc_symtab_template, init_def_list, init_objc_symtab, init_module_descriptor, generate_static_references, build_selector_translation_table, get_proto_encoding, build_typed_selector_reference, build_selector_reference, build_next_objc_exception_stuff, build_method_prototype_list_template, generate_descriptor_table, generate_protocols, build_protocol_initializer, build_ivar_list_template, build_method_list_template, build_ivar_list_initializer, generate_ivars_list, generate_dispatch_table, generate_protocol_list, build_category_initializer, build_shared_structure_initializer, generate_shared_structures, handle_impent, generate_objc_image_info): Likewise. 2004-04-25 Paolo Bonzini <bonzini@gnu.org> * cfglayout.c (duplicate_insn_chain): Remove references to NOTE_INSN_LOOP_VTOP and NOTE_INSN_LOOP_CONT. * cfgloop.h (struct loop): Remove fields vtop, cont and cont_dominator. * cfgrtl.c (rtl_delete_block): Remove handling of NOTE_INSN_LOOP_CONT. * final.c (final_scan_insn): Remove references to NOTE_INSN_LOOP_VTOP and NOTE_INSN_LOOP_CONT. * insn-notes.def (NOTE_INSN_LOOP_VTOP, NOTE_INSN_LOOP_CONT): Remove. * jump.c (squeeze_notes): Remove references to NOTE_INSN_LOOP_VTOP and NOTE_INSN_LOOP_CONT. * loop.c (scan_loops, find_and_verify_loops, for_each_insn_in_loop, check_dbra_loop, loop_dump_aux): Remove references to removed notes and fields. * reorg.c (mostly_true_jump): Do not rely on NOTE_INSN_LOOP_VTOPs. * unroll.c (unroll_loop, copy_loop_body, loop_iterations): Remove references to removed notes and fields. (subtract_reg_term, ujump_to_loop_cont): Remove. From-SVN: r86544
2004-08-25 11:52:54 +02:00
initlist = tree_cons (NULL_TREE, build_int_cst (NULL_TREE, 0), initlist);
1992-01-18 00:15:38 +01:00
else
{
Yet more Objective-C++... * objc-act.c (objc_finish_try_stmt): Add return value. (objc_build_synchronized): Likewise. * objc-act.c (objc_is_gcable_type): Add. (objc_substitute_decl): Add. (objc_build_ivar_assignment): Add. (objc_build_global_assignment): Add. (objc_build_strong_cast_assignment): Add. (objc_is_ivar_reference_p): Add. (objc_is_global_reference_p): Add. (objc_generate_write_barrier): Add. (objc_rewrite_function_call): Add. (objc_gimplify_expr): Add Objective-C++ support. * objc-act.h (ALLOC_OBJC_TYPE_LANG_SPECIFIC): Likewise. (SIZEOF_OBJC_TYPE_LANG_SPECIFIC): Add. (INIT_TYPE_OBJC_INFO): Add Objective-C++ support. (DUP_TYPE_OBJC_INFO): Likewise. (struct imp_entry): Add field has_cxx_cdtors. (struct imp_entry *imp_list): Add OCTI_UMSG_FAST_DECL, OCTI_METH_LIST_TEMPL, OCTI_METH_PROTO_LIST_TEMPL, OCTI_IVAR_LIST_TEMPL, OCTI_ASSIGN_IVAR_DECL, OCTI_ASSIGN_IVAR_FAST_DECL, OCTI_ASSIGN_GLOBAL_DECL, OCTI_ASSIGN_STRONGCAST_DECL. (umsg_fast_decl): Add. (objc_assign_ivar_decl): Add. (objc_assign_ivar_fast_decl): Add. (objc_assign_global_decl): Add. (objc_assign_strong_cast_decl): Add. (objc_method_list_ptr): Add. (objc_method_proto_list_ptr): Add. (objc_ivar_list_ptr): Add. * objc-act.c (should_call_super_dealloc): Add. (OBJC_VERSION): Bump to 6. (objc_is_gcable_type): Add. (objc_substitute_decl): Add. (objc_build_ivar_assignment): Add. (objc_build_global_assignment): Add. (objc_build_strong_cast_assignment): Add. (objc_is_gcable_p): Add. (objc_is_ivar_reference_p): Add. (objc_is_global_reference_p): Add. (generate_shared_structures): Add flags parameter. (objc_generate_cxx_ctor_or_dtor): Add. (objc_generate_cxx_cdtors): Add. (add_class): Add name parameter. (objc_types_share_size_and_alignment): Add. (comp_proto_with_proto): Add strict parameter. (CLS_HAS_CXX_STRUCTORS): Add. (TAG_ASSIGNIVAR): Add. (TAG_ASSIGNGLOBAL): Add. (TAG_ASSIGNSTRONGCAST): Add. (TAG_MSGSEND_FAST): Add. (TAG_ASSIGNIVAR_FAST): Add. (TAG_CXX_CONSTRUCT): Add. (TAG_CXX_DESTRUCT): Add. (OBJC_LOOKUP_CLASS): Add. (OBJC_LOOKUP_NO_SUPER): Add. (objc_finish_file): Add pch support. (objc_finish_implementation): Add Objective-C++ support. (synth_module_prologue): Likewise. (synth_module_prologue): Add fast dispatching. (objc_get_class_reference): Add Objective-C++ support. (objc_generate_write_barrier): Likewise. (next_sjlj_build_enter_and_setjmp): Likewise. (objc_begin_try_stmt): Likewise. (build_next_objc_exception_stuff): Add fast ivar support. (build_private_template): Mark the record as used so debug information is generated. (build_protocol_template): Add Objective-C++ support. (objc_method_parm_type) Likewise. (objc_generate_cxx_ctor_or_dtor): Likewise. (objc_generate_cxx_cdtors): Likewise. (build_protocol_initializer): Likewise. (build_category_template): Likewise. (build_class_template): Likewise. (build_method_list_template): Likewise. (build_category_initializer): Likewise. (build_shared_structure_initializer): Likewise. (objc_finish_message_expr): Likewise. (build_objc_method_call): Add fast dispatch support. (lookup_method_static): Add support to end search at superclasses. (add_method_to_hash_list): Add strict parameter to comp_proto_with_proto. (objc_add_method): Likewise. (objc_add_method): Also set the interface_value. (add_instance_variable): Add Objective-C++ support. (objc_is_public): Likewise. (start_class): Likewise. (continue_class): Likewise. (encode_aggregate_within): Likewise. (start_method_def): Likewise. (objc_start_function): Clear current_function_returns_value and current_function_returns_null. (really_start_method): Add Objective-C++ support. (objc_finish_method_definition): Add warning for missing [super dealloc]. (finish_objc): Add Objective-C++ support. (generate_objc_image_info): Likewise. (objc_lookup_ivar): Likewise. * objc-act.h (TYPE_HAS_OBJC_INFO): Likewise. (INIT_TYPE_OBJC_INFO): Likewise. (DUP_TYPE_OBJC_INFO): Likewise. From-SVN: r99857
2005-05-17 22:07:08 +02:00
expr = convert (objc_method_list_ptr,
build_unary_op (ADDR_EXPR, instance_methods, 0));
initlist = tree_cons (NULL_TREE, expr, initlist);
1992-01-18 00:15:38 +01:00
}
if (!class_methods)
tree.h (build_int_cst): New, sign extended constant. * tree.h (build_int_cst): New, sign extended constant. (build_int_cstu): New, zero extended constant. (build_int_cst_wide): Renamed from build_int_cst. * tree.c (build_int_cst, build_int_cstu): New. (build_int_cst_wide): Renamed from build_int_cst. (make_vector_type, build_common_tree_nodes, build_common_tree_nodes_2): Adjust build_int_cst calls. * builtins.c (expand_builtin_prefetch, expand_builtin_strstr, expand_builtin_strpbrk, expand_builtin_fputs, build_string_literal, expand_builtin_printf, expand_builtin_sprintf, fold_builtin_classify_type, fold_builtin_lround, fold_builtin_bitop, fold_builtin_isascii, fold_builtin_toascii, fold_builtin_isdigit, simplify_builtin_strstr, simplify_builtin_strpbrk, fold_builtin_fputs, simplify_builtin_sprintf): Likewise. * c-common.c (start_fname_decls, fix_string_type, shorten_compare, DEF_ATTR_INT): Likewise. * c-decl.c (complete_array_type, check_bitfield_type_and_width): Likewise. * c-lex.c (interpret_integer, lex_charconst): Likewise. * c-parse.in (primary) <TYPES_COMPATIBLE_P> Likewise. * c-pretty-print.c (pp_c_integer_constant): Likewise. * c-typeck.c (really_start_incremental_init, push_init_level, set_nonincremental_init_from_string): Likewise. * calls.c (load_register_parameters): Likewise. convert.c (convert_to_pointer): Likewise. coverage.c (coverage_counter_alloc, tree_coverage_counter_ref, build_fn_info_type, build_fn_info_value, build_ctr_info_value, build_gcov_info): Likewise. * except.c (init_eh, assign_filter_values): Likewise. * expmed.c (store_fixed_bit_field, extract_bit_field, extract_fixed_bit_field, extract_split_bit_field, expand_shift, expand_mult_const, expand_mult_highpart_adjust, extract_high_half, expand_sdiv_pow2, expand_divmod, make_tree): Likewise. * expr.c (convert_move, emit_group_load, emit_group_store, expand_assignment, store_constructor, store_field, expand_expr_real_1, reduce_to_bit_field_precision): Likewise. fold-const.c (force_fit_type, int_const_binop, fold_convert_const, invert_truthvalue, optimize_bit_field_compare, decode_field_reference, all_ones_mask_p, constant_boolean_node, fold_div_compare, fold, fold_read_from_constant_string, fold_negate_const, fold_abs_const, fold_not_const, round_up, round_down): Likewise. * function.c (assign_parm_setup_block): Likewise. * stmt.c (shift_return_value, expand_case, estimate_case_costs): Likewise. * stor-layout.c (layout_type, initialize_sizetypes, set_min_and_max_values_for_integral_type): Likewise. * tree-chrec.c (chrec_fold_multiply_poly_poly, reset_evolution_in_loop): Likewise. * tree-chrec.h (build_polynomial_chrec): Likewise. * tree-complex.c (build_replicated_const): Likewise. * tree-eh.c (honor_protect_cleanup_actions, lower_try_finally_onedest, lower_try_finally_copy, lower_try_finally_switch): Likewise. * tree-mudflap.c (mf_build_string, mx_register_decls, mudflap_register_call, mudflap_enqueue_constant): Likewise. * tree-nested.c (get_trampoline_type, get_nl_goto_field): Likewise. * tree-pretty-print.c (dump_generic_node): Likewise. * tree-ssa-ccp.c (widen_bitfield, maybe_fold_offset_to_array_ref): Likewise. * tree-ssa-dom.c (simplify_rhs_and_lookup_avail_expr): Likewise. * tree-ssa-loop-niter.c (number_of_iterations_cond, loop_niter_by_eval, upper_bound_in_type, lower_bound_in_type): Likewise. * tree-ssa-loop-ivcanon.c (create_canonical_iv, canonicalize_loop_induction_variables): Likewise. * tree-vectorizer.c (vect_create_index_for_array_ref, vect_transform_loop_bound, vect_compute_data_ref_alignment): Likewise. * config/alpha/alpha.c (alpha_initialize_trampoline, alpha_va_start, alpha_gimplify_va_arg_1): Likewise. * config/arm/arm.c (arm_get_cookie_size): Likewise. * config/c4x/c4x.c (c4x_gimplify_va_arg_expr): Likewise. * config/i386/i386.c (ix86_va_start, ix86_gimplify_va_arg): Likewise. * config/ia64/ia64.c (ia64_gimplify_va_arg): Likewise. * config/mips/mips.c (mips_build_builtin_va_list, mips_va_start, mips_gimplify_va_arg_expr): Likewise. * config/pa/pa.c (hppa_gimplify_va_arg_expr): Likewise. * config/rs6000/rs6000.c (rs6000_va_start, rs6000_gimplify_va_arg, add_compiler_branch_island): Likewise. * config/s390/s390.c (s390_va_start): Likewise. * config/sh/sh.c (sh_va_start): Likewise. * config/stormy16/stormy16.c (xstormy16_expand_builtin_va_start): Likewise. * config/xtensa/xtensa.c (xtensa_va_start, xtensa_gimplify_va_arg_expr): Likewise. * objc/objc-act.c (build_objc_string_object, build_objc_symtab_template, init_def_list, init_objc_symtab, init_module_descriptor, generate_static_references, build_selector_translation_table, get_proto_encoding, build_typed_selector_reference, build_selector_reference, build_next_objc_exception_stuff, build_method_prototype_list_template, generate_descriptor_table, generate_protocols, build_protocol_initializer, build_ivar_list_template, build_method_list_template, build_ivar_list_initializer, generate_ivars_list, generate_dispatch_table, generate_protocol_list, build_category_initializer, build_shared_structure_initializer, generate_shared_structures, handle_impent, generate_objc_image_info): Likewise. 2004-04-25 Paolo Bonzini <bonzini@gnu.org> * cfglayout.c (duplicate_insn_chain): Remove references to NOTE_INSN_LOOP_VTOP and NOTE_INSN_LOOP_CONT. * cfgloop.h (struct loop): Remove fields vtop, cont and cont_dominator. * cfgrtl.c (rtl_delete_block): Remove handling of NOTE_INSN_LOOP_CONT. * final.c (final_scan_insn): Remove references to NOTE_INSN_LOOP_VTOP and NOTE_INSN_LOOP_CONT. * insn-notes.def (NOTE_INSN_LOOP_VTOP, NOTE_INSN_LOOP_CONT): Remove. * jump.c (squeeze_notes): Remove references to NOTE_INSN_LOOP_VTOP and NOTE_INSN_LOOP_CONT. * loop.c (scan_loops, find_and_verify_loops, for_each_insn_in_loop, check_dbra_loop, loop_dump_aux): Remove references to removed notes and fields. * reorg.c (mostly_true_jump): Do not rely on NOTE_INSN_LOOP_VTOPs. * unroll.c (unroll_loop, copy_loop_body, loop_iterations): Remove references to removed notes and fields. (subtract_reg_term, ujump_to_loop_cont): Remove. From-SVN: r86544
2004-08-25 11:52:54 +02:00
initlist = tree_cons (NULL_TREE, build_int_cst (NULL_TREE, 0), initlist);
1992-01-18 00:15:38 +01:00
else
{
Yet more Objective-C++... * objc-act.c (objc_finish_try_stmt): Add return value. (objc_build_synchronized): Likewise. * objc-act.c (objc_is_gcable_type): Add. (objc_substitute_decl): Add. (objc_build_ivar_assignment): Add. (objc_build_global_assignment): Add. (objc_build_strong_cast_assignment): Add. (objc_is_ivar_reference_p): Add. (objc_is_global_reference_p): Add. (objc_generate_write_barrier): Add. (objc_rewrite_function_call): Add. (objc_gimplify_expr): Add Objective-C++ support. * objc-act.h (ALLOC_OBJC_TYPE_LANG_SPECIFIC): Likewise. (SIZEOF_OBJC_TYPE_LANG_SPECIFIC): Add. (INIT_TYPE_OBJC_INFO): Add Objective-C++ support. (DUP_TYPE_OBJC_INFO): Likewise. (struct imp_entry): Add field has_cxx_cdtors. (struct imp_entry *imp_list): Add OCTI_UMSG_FAST_DECL, OCTI_METH_LIST_TEMPL, OCTI_METH_PROTO_LIST_TEMPL, OCTI_IVAR_LIST_TEMPL, OCTI_ASSIGN_IVAR_DECL, OCTI_ASSIGN_IVAR_FAST_DECL, OCTI_ASSIGN_GLOBAL_DECL, OCTI_ASSIGN_STRONGCAST_DECL. (umsg_fast_decl): Add. (objc_assign_ivar_decl): Add. (objc_assign_ivar_fast_decl): Add. (objc_assign_global_decl): Add. (objc_assign_strong_cast_decl): Add. (objc_method_list_ptr): Add. (objc_method_proto_list_ptr): Add. (objc_ivar_list_ptr): Add. * objc-act.c (should_call_super_dealloc): Add. (OBJC_VERSION): Bump to 6. (objc_is_gcable_type): Add. (objc_substitute_decl): Add. (objc_build_ivar_assignment): Add. (objc_build_global_assignment): Add. (objc_build_strong_cast_assignment): Add. (objc_is_gcable_p): Add. (objc_is_ivar_reference_p): Add. (objc_is_global_reference_p): Add. (generate_shared_structures): Add flags parameter. (objc_generate_cxx_ctor_or_dtor): Add. (objc_generate_cxx_cdtors): Add. (add_class): Add name parameter. (objc_types_share_size_and_alignment): Add. (comp_proto_with_proto): Add strict parameter. (CLS_HAS_CXX_STRUCTORS): Add. (TAG_ASSIGNIVAR): Add. (TAG_ASSIGNGLOBAL): Add. (TAG_ASSIGNSTRONGCAST): Add. (TAG_MSGSEND_FAST): Add. (TAG_ASSIGNIVAR_FAST): Add. (TAG_CXX_CONSTRUCT): Add. (TAG_CXX_DESTRUCT): Add. (OBJC_LOOKUP_CLASS): Add. (OBJC_LOOKUP_NO_SUPER): Add. (objc_finish_file): Add pch support. (objc_finish_implementation): Add Objective-C++ support. (synth_module_prologue): Likewise. (synth_module_prologue): Add fast dispatching. (objc_get_class_reference): Add Objective-C++ support. (objc_generate_write_barrier): Likewise. (next_sjlj_build_enter_and_setjmp): Likewise. (objc_begin_try_stmt): Likewise. (build_next_objc_exception_stuff): Add fast ivar support. (build_private_template): Mark the record as used so debug information is generated. (build_protocol_template): Add Objective-C++ support. (objc_method_parm_type) Likewise. (objc_generate_cxx_ctor_or_dtor): Likewise. (objc_generate_cxx_cdtors): Likewise. (build_protocol_initializer): Likewise. (build_category_template): Likewise. (build_class_template): Likewise. (build_method_list_template): Likewise. (build_category_initializer): Likewise. (build_shared_structure_initializer): Likewise. (objc_finish_message_expr): Likewise. (build_objc_method_call): Add fast dispatch support. (lookup_method_static): Add support to end search at superclasses. (add_method_to_hash_list): Add strict parameter to comp_proto_with_proto. (objc_add_method): Likewise. (objc_add_method): Also set the interface_value. (add_instance_variable): Add Objective-C++ support. (objc_is_public): Likewise. (start_class): Likewise. (continue_class): Likewise. (encode_aggregate_within): Likewise. (start_method_def): Likewise. (objc_start_function): Clear current_function_returns_value and current_function_returns_null. (really_start_method): Add Objective-C++ support. (objc_finish_method_definition): Add warning for missing [super dealloc]. (finish_objc): Add Objective-C++ support. (generate_objc_image_info): Likewise. (objc_lookup_ivar): Likewise. * objc-act.h (TYPE_HAS_OBJC_INFO): Likewise. (INIT_TYPE_OBJC_INFO): Likewise. (DUP_TYPE_OBJC_INFO): Likewise. From-SVN: r99857
2005-05-17 22:07:08 +02:00
expr = convert (objc_method_list_ptr,
build_unary_op (ADDR_EXPR, class_methods, 0));
initlist = tree_cons (NULL_TREE, expr, initlist);
1992-01-18 00:15:38 +01:00
}
/* protocol_list = */
if (!protocol_list)
tree.h (build_int_cst): New, sign extended constant. * tree.h (build_int_cst): New, sign extended constant. (build_int_cstu): New, zero extended constant. (build_int_cst_wide): Renamed from build_int_cst. * tree.c (build_int_cst, build_int_cstu): New. (build_int_cst_wide): Renamed from build_int_cst. (make_vector_type, build_common_tree_nodes, build_common_tree_nodes_2): Adjust build_int_cst calls. * builtins.c (expand_builtin_prefetch, expand_builtin_strstr, expand_builtin_strpbrk, expand_builtin_fputs, build_string_literal, expand_builtin_printf, expand_builtin_sprintf, fold_builtin_classify_type, fold_builtin_lround, fold_builtin_bitop, fold_builtin_isascii, fold_builtin_toascii, fold_builtin_isdigit, simplify_builtin_strstr, simplify_builtin_strpbrk, fold_builtin_fputs, simplify_builtin_sprintf): Likewise. * c-common.c (start_fname_decls, fix_string_type, shorten_compare, DEF_ATTR_INT): Likewise. * c-decl.c (complete_array_type, check_bitfield_type_and_width): Likewise. * c-lex.c (interpret_integer, lex_charconst): Likewise. * c-parse.in (primary) <TYPES_COMPATIBLE_P> Likewise. * c-pretty-print.c (pp_c_integer_constant): Likewise. * c-typeck.c (really_start_incremental_init, push_init_level, set_nonincremental_init_from_string): Likewise. * calls.c (load_register_parameters): Likewise. convert.c (convert_to_pointer): Likewise. coverage.c (coverage_counter_alloc, tree_coverage_counter_ref, build_fn_info_type, build_fn_info_value, build_ctr_info_value, build_gcov_info): Likewise. * except.c (init_eh, assign_filter_values): Likewise. * expmed.c (store_fixed_bit_field, extract_bit_field, extract_fixed_bit_field, extract_split_bit_field, expand_shift, expand_mult_const, expand_mult_highpart_adjust, extract_high_half, expand_sdiv_pow2, expand_divmod, make_tree): Likewise. * expr.c (convert_move, emit_group_load, emit_group_store, expand_assignment, store_constructor, store_field, expand_expr_real_1, reduce_to_bit_field_precision): Likewise. fold-const.c (force_fit_type, int_const_binop, fold_convert_const, invert_truthvalue, optimize_bit_field_compare, decode_field_reference, all_ones_mask_p, constant_boolean_node, fold_div_compare, fold, fold_read_from_constant_string, fold_negate_const, fold_abs_const, fold_not_const, round_up, round_down): Likewise. * function.c (assign_parm_setup_block): Likewise. * stmt.c (shift_return_value, expand_case, estimate_case_costs): Likewise. * stor-layout.c (layout_type, initialize_sizetypes, set_min_and_max_values_for_integral_type): Likewise. * tree-chrec.c (chrec_fold_multiply_poly_poly, reset_evolution_in_loop): Likewise. * tree-chrec.h (build_polynomial_chrec): Likewise. * tree-complex.c (build_replicated_const): Likewise. * tree-eh.c (honor_protect_cleanup_actions, lower_try_finally_onedest, lower_try_finally_copy, lower_try_finally_switch): Likewise. * tree-mudflap.c (mf_build_string, mx_register_decls, mudflap_register_call, mudflap_enqueue_constant): Likewise. * tree-nested.c (get_trampoline_type, get_nl_goto_field): Likewise. * tree-pretty-print.c (dump_generic_node): Likewise. * tree-ssa-ccp.c (widen_bitfield, maybe_fold_offset_to_array_ref): Likewise. * tree-ssa-dom.c (simplify_rhs_and_lookup_avail_expr): Likewise. * tree-ssa-loop-niter.c (number_of_iterations_cond, loop_niter_by_eval, upper_bound_in_type, lower_bound_in_type): Likewise. * tree-ssa-loop-ivcanon.c (create_canonical_iv, canonicalize_loop_induction_variables): Likewise. * tree-vectorizer.c (vect_create_index_for_array_ref, vect_transform_loop_bound, vect_compute_data_ref_alignment): Likewise. * config/alpha/alpha.c (alpha_initialize_trampoline, alpha_va_start, alpha_gimplify_va_arg_1): Likewise. * config/arm/arm.c (arm_get_cookie_size): Likewise. * config/c4x/c4x.c (c4x_gimplify_va_arg_expr): Likewise. * config/i386/i386.c (ix86_va_start, ix86_gimplify_va_arg): Likewise. * config/ia64/ia64.c (ia64_gimplify_va_arg): Likewise. * config/mips/mips.c (mips_build_builtin_va_list, mips_va_start, mips_gimplify_va_arg_expr): Likewise. * config/pa/pa.c (hppa_gimplify_va_arg_expr): Likewise. * config/rs6000/rs6000.c (rs6000_va_start, rs6000_gimplify_va_arg, add_compiler_branch_island): Likewise. * config/s390/s390.c (s390_va_start): Likewise. * config/sh/sh.c (sh_va_start): Likewise. * config/stormy16/stormy16.c (xstormy16_expand_builtin_va_start): Likewise. * config/xtensa/xtensa.c (xtensa_va_start, xtensa_gimplify_va_arg_expr): Likewise. * objc/objc-act.c (build_objc_string_object, build_objc_symtab_template, init_def_list, init_objc_symtab, init_module_descriptor, generate_static_references, build_selector_translation_table, get_proto_encoding, build_typed_selector_reference, build_selector_reference, build_next_objc_exception_stuff, build_method_prototype_list_template, generate_descriptor_table, generate_protocols, build_protocol_initializer, build_ivar_list_template, build_method_list_template, build_ivar_list_initializer, generate_ivars_list, generate_dispatch_table, generate_protocol_list, build_category_initializer, build_shared_structure_initializer, generate_shared_structures, handle_impent, generate_objc_image_info): Likewise. 2004-04-25 Paolo Bonzini <bonzini@gnu.org> * cfglayout.c (duplicate_insn_chain): Remove references to NOTE_INSN_LOOP_VTOP and NOTE_INSN_LOOP_CONT. * cfgloop.h (struct loop): Remove fields vtop, cont and cont_dominator. * cfgrtl.c (rtl_delete_block): Remove handling of NOTE_INSN_LOOP_CONT. * final.c (final_scan_insn): Remove references to NOTE_INSN_LOOP_VTOP and NOTE_INSN_LOOP_CONT. * insn-notes.def (NOTE_INSN_LOOP_VTOP, NOTE_INSN_LOOP_CONT): Remove. * jump.c (squeeze_notes): Remove references to NOTE_INSN_LOOP_VTOP and NOTE_INSN_LOOP_CONT. * loop.c (scan_loops, find_and_verify_loops, for_each_insn_in_loop, check_dbra_loop, loop_dump_aux): Remove references to removed notes and fields. * reorg.c (mostly_true_jump): Do not rely on NOTE_INSN_LOOP_VTOPs. * unroll.c (unroll_loop, copy_loop_body, loop_iterations): Remove references to removed notes and fields. (subtract_reg_term, ujump_to_loop_cont): Remove. From-SVN: r86544
2004-08-25 11:52:54 +02:00
initlist = tree_cons (NULL_TREE, build_int_cst (NULL_TREE, 0), initlist);
else
Makefile.in (c-parse.o): Depend on $(C_COMMON_H). [gcc/ChangeLog] 2004-09-07 Ziemowit Laski <zlaski@apple.com> * Makefile.in (c-parse.o): Depend on $(C_COMMON_H). * c-parse.in: Include c-common.h instead of objc-act.h. (ivar_decl_list, ivar_decls, ivar_decl, ivars, ivar_declarator, myparms, myparm): Remove %type declarations. (methodtype, optparms, OBJC_TYPE_QUAL, objc_quals, objc_qual, objc_typename, objc_try_catch_stmt, optellipsis): Add %type declarations. (objc_inherit_code, objc_public_flag): Remove. (typespec_nonreserved_nonattr): Call objc_get_protocol_qualified_type() instead of get_static_reference() and get_protocol_reference(). (stmt_nocomp): Call grokparm() on @catch parameter. (objcdef): Move semantic action to objc_finish_implementation(). (classdef): Move semantic action to objc_start_class_interface(), objc_continue_interface(), objc_finish_interface(), objc_start_class_implementation(), objc_continue_implementation(), objc_start_category_interface() and objc_start_category_implementation(). (protocoldef): Move semantic actions to objc_start_protocol() and objc_finish_interface(). (ivar_decl_list): Remove nonterminal. (visibility_spec): Move semantic actions to objc_set_visibility(). (ivar_decls): Remove assignment to $$. (ivar_decl): Rephrase in terms of component_decl; call objc_add_instance_variable(). (ivars, ivar_declarator): Remove nonterminals. (opt_semi): New nonterminal. (methodtype): Remove semantic actions. (methoddef): Move semantic actions to objc_set_method_type(), objc_start_method_definition() and objc_finish_method_definition(). (methodproto): Move semantic actions to objc_set_method_type() and objc_add_method_declaration(). (methoddecl): Use objc_typename instead of typename; move semantic actions to objc_build_method_signature(). (optarglist, myxdecls, mydecl, myparms, myparm): Remove nonterminals. (optparmlist): Express in terms of optparms and optellipsis. (optparms, optellipsis, objc_qual, objc_quals, objc_typename): New nonterminals. (keyworddecl): Use objc_typename instead of typename. (rid_to_yy): Mark RID_IN, RID_OUT, RID_INOUT, RID_BYCOPY, RID_BYREF and RID_ONEWAY as returning OBJC_TYPE_QUAL to yyparse(). [gcc/objc/ChangeLog] 2004-09-07 Ziemowit Laski <zlaski@apple.com> * Make-lang.in (objc/objc-parse.o): Depend on $(C_COMMON_H) instead of objc/objc-act.h. (objc/objc-act.o): Depend on $(HASHTAB_H). * objc-act.c: Include hashtab.h; in ObjC++ mode, include cp-tree.h and objcp-decl.h instead of c-tree.h. (build_module_descriptor, get_class_ivars, synth_id_with_class_suffix, error_with_ivar, gen_method_decl, gen_declaration, setup_string_decl, build_protocol_template): Adjust prototypes. (build_module_initializer_routine, start_class, continue_class, finish_class, start_method_def, objc_start_function, start_protocol, build_method_decl, objc_add_method, add_instance_variable, build_ivar_reference, is_ivar, is_private, get_super_receiver, build_selector_table_decl, objc_push_parm, objc_get_parm_info, gen_type_name, gen_type_name_0, start_var_decl, finish_var_decl, create_field_decl): New prototypes. (objc_expand_function_end, comp_method_with_proto, objc_expr_last, gen_declaration_1, gen_declarator, is_complex_decl, adorn_decl, define_decl, create_builtin_decl, gen_declspecs): Remove prototypes. (TYPE_ID): Rename to OBJECT_TYPEDEF_NAME. (CLASS_TYPEDEF_NAME): New. (TAG_EXECCLASS): Change from a global variable to a #define. (TAG_RETURN_STRUCT): Delete. (TAG_GNUINIT): New, holds '__objc_gnu_init' name. (objc_inherit_code, objc_public_flag): New, moved from c-parse.in. (string_descriptor): New struct. (string_htab): New hash table. (string_hash, string_eq): New prototypes. (generate_struct_by_value_array): Call create_field_decl() instead of create_builtin_decl(). (objc_init): Do not initialize objc_ellipsis_node or TAG_EXECCLASS; In ObjC++ mode, call cxx_init() instead of c_objc_common_init(). (objc_finish_file): In ObjC++, call instantiate_pending_templates() and cp_finish_file(). (define_decl, get_static_reference, get_protocol_reference, create_builtin_decl): Remove functions. (objc_start_class_interface, objc_start_category_interface, objc_start_protocol, objc_continue_interface, objc_finish_interface, objc_start_class_implementation, objc_start_category_implementation, objc_continue_implementation, objc_finish_implementation, objc_set_visibility, objc_set_method_type, objc_build_method_signature, objc_add_method_declaration, objc_start_method_definition, objc_add_instance_variable, objc_get_protocol_qualified_type, create_field_decl, start_var_decl, finish_var_decl): New functions. (setup_string_decl): Simplify since it is only called once. (synth_module_prologue): Call build_class_template(); predefine 'id' and 'Class' as typedefs; rename 'temp_type' to 'type'; disable debug hooks for duration of function; fix GNU runtime messenger signatures to correspond to reality; forward-declare '__objc_exec_class' for the GNU runtime; call build_selector_table_decl(); in ObjC++ mode, generate 'extern "C" { ... }' wrappers around synthesized declarations; call build_protocol_template() and build_category_template(). (string_hash, string_eq): New functions. (objc_build_string_object): Check metaclass correctness only once; store string literals in hash table. (objc_build_constructor): Do not convert initializer elements; adjust for ObjC++ impedance mismatch. (build_objc_symtab_template): Call create_field_decl() instead of create_builtin_decl(). (init_objc_symtab): Add missing conversion to initializer element. (build_metadata_decl): Call start_var_decl() instead of define_decl(). (generate_objc_symtab_decl): Do not call build_category_template(); call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(). (build_module_descriptor): Call create_field_decl() instead of grokfield(); call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(); always mark module descriptor as used; move GNU runtime-specific functionality to build_module_initializer_routine(). (build_module_initializer_routine): New function, broken off of build_module_descriptor(). (objc_static_init_needed_p, objc_generate_static_init_call): New functions. (generate_static_references, generate_strings, build_selector_translation_table, generate_descriptor_table, generate_ivars_list, generate_dispatch_table, generate_category): Call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(); build a type directly instead of via groktypename(). (build_selector_reference_decl, build_selector_table_decl, build_class_reference_decl, build_protocol_reference, generate_objc_image_info): Call start_var_decl() instead of build_decl(). (build_selector_reference): For GNU runtime, do not call build_selector_reference_decl(). (build_selector, build_typed_selector_reference): Always convert result to the selector type. (add_objc_string): Cast return value to 'char *'. (build_method_prototype_template, build_selector_template, build_method_template): Use actual selector type for fields pointing to selectors. (finish_objc): For GNU runtime, call build_module_initializer_routine() after build_module_descriptor(). (generate_protocol_list, generate_shared_structures): Call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(); build a type directly instead of via groktypename(). (synth_id_with_class_suffix): Return a string. (get_arg_type_list): For instance methods, use the instance type for 'self'; do not call groktypename_in_parm_context(). (build_objc_string_decl): Squash redeclaration errors in ObjC++. (objc_is_class_name): Use OBJC_TYPE_NAME instead of TYPE_NAME; handle RECORD_TYPEs in ObjC as well as ObjC++. (objc_is_id): New function. (objc_is_object_ptr): Return the canonical type node. (objc_get_class_ivars): Simplify using get_class_ivars(). (get_class_ivars): Remove second parameter; create a fresh copy of the ivar list for each call; do not check for existence of super class. (objc_eh_runtime_type): Mark #ifndef OBJCPLUS. (objc_init_exceptions): When using SJLJ-style exceptions, require the use of '-fobjc-exceptions' flag; do not require it for DWARF-style exceptions. (objc_build_exc_ptr, next_sjlj_build_try_catch_finally): Use objc_object_type instead of objc_id_type. (objc_begin_catch_clause): Convert the incoming PARM_DECL into a VAR_DECL before placing it in the appropriate scope; do not call define_decl(); adjust call to c_begin_compound_stmt(); use objc_object_type instead of objc_id_type. (build_next_objc_exception_stuff): Call create_field_decl() instead of create_builtin_decl(); construct type directly instead of calling groktypename(); use OBJC_VOID_AT_END to mark end of function parameters. (build_private_template): Adjust call to get_class_ivars(); build a type directly instead of via groktypename(). (build_protocol_template, build_method_prototype_list_template, build_method_prototype_template, build_category_template, build_selector_template, build_class_template, build_super_template, build_ivar_template, build_ivar_list_template, build_method_list_template, build_method_template): Call create_field_decl() instead of grokfield(). (objc_method_parm_type): Do not call groktypename(). (generate_descriptor_table): Call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(). (generate_method_descriptors, build_protocol_initializer, generate_dispatch_tables, build_category_initializer, build_shared_structure_initializer): Do not call groktypename(). (generate_protocols): Call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(); do not call groktypename(). (error_with_ivar): Remove last parameter. (check_ivars): Do not iterate ovar CLASS_RAW_IVARS lists in addition to CLASS_IVARS lists; adjust calls to error_with_ivar(). (generate_ivar_lists): Convert one of the initializer elements; do not call groktypename(). (get_arg_type_list, start_method_def, gen_method_def): Account for new representation of variable arguments and '...' in Objective-C methods; add Objective-C++ impedance matching code. (is_objc_type_qualifier): Remove function. (adjust_type_for_id_default): Simplify; there is no longer a need to wade through declspecs. (lookup_interface, start_class, continue_class, finish_class, start_method_def, start_protocol, build_method_decl, objc_add_method, add_instance_variable, build_ivar_reference, is_ivar, is_private, get_super_receiver, objc_build_finally_epilogue): Make into static functions. (receiver_is_class_object): Use new IS_CLASS() macro. (objc_build_message_expr): Tweak ObjC++ message argument handling; call objc_finish_message_expr() instead of finish_message_expr(). (finish_message_expr): Rename to objc_finish_message_expr(); use OBJC_TYPE_NAME and OBJC_SET_TYPE_NAME macros instead of TYPE_NAME. call gen_type_name() instead of gen_declaration(); call objc_is_id() instead of using IS_ID and IS_CLASS; Use objc_class_name instead of calling get_identifier("Class"); handle CONVERT_EXPRs in receiver. (build_objc_method_call, warn_with_method): Do not call groktypename(). (build_ivar_reference): Call convert() instead of clobbering in a type. (hash_init): Initialize string_htab hash table. (add_instance_variable): Simplify parameter list; do not call grokfield(); do not populate CLASS_IVARS list. (start_class): Check for the existence of super class, if one was specified. (continue_class): Use CLASS_RAW_IVARS rather than CLASS_IVARS; do not call build_class_template(); adjust call to get_class_ivars(); call build_decl(), pushdecl() and finish_decl() instead of define_decl(). (finish_class): Call build_decl(), pushdecl() and finish_decl() instead of define_decl(). (add_protocols): Use PROTOCOL_BINFO_ELTS for the tree vector size. (start_protocol): Do not call build_protocol_template(); use PROTOCOL_BINFO_ELTS for the tree vector size. (encode_type_qualifiers): Do not handle the 'const' qualifier here. (encode_pointer): Encode 'const char *' as 'r*', for backwards compatibility. (encode_array): Use HOST_WIDE_INT_PRINT_DEC instead of "%ld". (encode_type): Handle the 'const' qualifier here. (objc_parmlist): New global variable, sued by objc_push_parm and objc_get_parm_info(). (objc_push_parm, objc_get_parm_info): New functions. (objc_expr_last): Remove function. (synth_self_and_ucmd_args): For instance methods, use the instance type for 'self'; call objc_push_parm() instead of push_parm_decl(). (start_method_def): Do not call push_scope(), declare_parm_level(), pop_scope(), push_parm_decl(), store_parm_decls() or objc_expr_last(); just use objc_push_parm() and objc_get_parm_info(). (comp_method_with_proto): Remove function. (objc_types_are_equivalent): Strip away indirections before comparing underlying types. (comp_proto_with_proto): Do not call groktypename(); types are no longer in raw declspec format. (objc_start_function): New function. (really_start_method): Call comp_proto_with_proto() instead of comp_method_with_proto(); call objc_start_function() instead of hand-crafting a function declarator. (continue_method_def, objc_expand_function_end): Remove functions. (get_super_receiver): Call objc_get_current_scope() instead of get_current_scope(); reference 'super_class' field (instead of 'class'). (finish_method_def): Rename to objc_finish_method_definition() and add a function decl parameter; move method encoding call from objc_expand_function_end(). (is_complex_decl, adorn_decl, gen_declarator, gen_declspecs, gen_declaration_1): Remove functions. (tmpbuf, RAW_DECLSPEC): Remove. (gen_declaration): Remove second parameter; simplify to deal with TYPE_P nodes instead of raw declspecs. (gen_type_name, gen_type_name_0): New functions. (gen_method_decl): Remove second parameter; call gen_type_name() instead of gen_declaration_1(). (dump_interface): Adjust calls to gen_declaration() and gen_method_decl(); do not allocate a separate string buffer. (init_objc): Allocate a larger string buffer to accommodate dump_interface(); adjust call to build_module_descriptor(); add call to build_module_initializer_routine() for the GNU runtime. (generate_classref_translation_entry): Do not call start_decl(); call finish_var_decl() instead of finish_decl(); call convert() instead of build_c_cast(). * objc-act.h (CLASS_OWN_IVARS): Remove accessor. (CLASS_BINFO_ELTS): Reduce from 6 to 5, now that CLASS_OWN_IVARS is gone. (OCTI_GNU_INIT_DECL, GNU_INIT_decl): New. (OCTI_ELLIPSIS_NODE, objc_ellipsis_node): Remove. (OCTI_ID_ID, id_type, objc_id_id): Rename to OCTI_ID_NAME, objc_object_type and objc_object_name, respectively. (OCTI_CLS_REF, OCTI_CLASS_NAME, objc_class_reference, objc_class_name): New. (IS_CLASS): New macro. (IS_ID, IS_SUPER): Robustify. (OCTI_EXECCLASS_DECL, execclass_decl): New. (finish_file, start_class, continue_class, finish_class, start_method_def, continue_method_def, finish_method_def, start_protocol, finish_protocol, objc_build_throw_stmt, objc_build_try_catch_finally_stmt, objc_build_synchronized_prologue, objc_build_synchronized_epilogue, objc_build_try_prologue, objc_build_try_epilogue, objc_build_catch_stmt, objc_build_catch_epilogue, objc_build_finally_prologue, objc_build_finally_epilogue, is_ivar, is_private, is_public, add_instance_variable, objc_add_method, get_super_receiver, objc_clear_super_receiver, get_class_ivars_from_name, get_class_reference, get_static_reference, get_object_reference, build_message_expr, finish_message_expr, build_selector_expr, build_ivar_reference, build_keyword_decl, build_method_decl, build_protocol_expr, build_objc_string_object, objc_declare_alias, objc_declare_class, objc_declare_protocols, objc_comptypes, objc_check_decl, build_encode_expr): Remove prototypes. (imp_count, cat_count): Make GGC-aware. (OBJC_SET_TYPE_NAME): New macro. From-SVN: r87168
2004-09-08 02:49:44 +02:00
{
expr = convert (build_pointer_type
(build_pointer_type
Makefile.in (c-parse.o): Depend on $(C_COMMON_H). [gcc/ChangeLog] 2004-09-07 Ziemowit Laski <zlaski@apple.com> * Makefile.in (c-parse.o): Depend on $(C_COMMON_H). * c-parse.in: Include c-common.h instead of objc-act.h. (ivar_decl_list, ivar_decls, ivar_decl, ivars, ivar_declarator, myparms, myparm): Remove %type declarations. (methodtype, optparms, OBJC_TYPE_QUAL, objc_quals, objc_qual, objc_typename, objc_try_catch_stmt, optellipsis): Add %type declarations. (objc_inherit_code, objc_public_flag): Remove. (typespec_nonreserved_nonattr): Call objc_get_protocol_qualified_type() instead of get_static_reference() and get_protocol_reference(). (stmt_nocomp): Call grokparm() on @catch parameter. (objcdef): Move semantic action to objc_finish_implementation(). (classdef): Move semantic action to objc_start_class_interface(), objc_continue_interface(), objc_finish_interface(), objc_start_class_implementation(), objc_continue_implementation(), objc_start_category_interface() and objc_start_category_implementation(). (protocoldef): Move semantic actions to objc_start_protocol() and objc_finish_interface(). (ivar_decl_list): Remove nonterminal. (visibility_spec): Move semantic actions to objc_set_visibility(). (ivar_decls): Remove assignment to $$. (ivar_decl): Rephrase in terms of component_decl; call objc_add_instance_variable(). (ivars, ivar_declarator): Remove nonterminals. (opt_semi): New nonterminal. (methodtype): Remove semantic actions. (methoddef): Move semantic actions to objc_set_method_type(), objc_start_method_definition() and objc_finish_method_definition(). (methodproto): Move semantic actions to objc_set_method_type() and objc_add_method_declaration(). (methoddecl): Use objc_typename instead of typename; move semantic actions to objc_build_method_signature(). (optarglist, myxdecls, mydecl, myparms, myparm): Remove nonterminals. (optparmlist): Express in terms of optparms and optellipsis. (optparms, optellipsis, objc_qual, objc_quals, objc_typename): New nonterminals. (keyworddecl): Use objc_typename instead of typename. (rid_to_yy): Mark RID_IN, RID_OUT, RID_INOUT, RID_BYCOPY, RID_BYREF and RID_ONEWAY as returning OBJC_TYPE_QUAL to yyparse(). [gcc/objc/ChangeLog] 2004-09-07 Ziemowit Laski <zlaski@apple.com> * Make-lang.in (objc/objc-parse.o): Depend on $(C_COMMON_H) instead of objc/objc-act.h. (objc/objc-act.o): Depend on $(HASHTAB_H). * objc-act.c: Include hashtab.h; in ObjC++ mode, include cp-tree.h and objcp-decl.h instead of c-tree.h. (build_module_descriptor, get_class_ivars, synth_id_with_class_suffix, error_with_ivar, gen_method_decl, gen_declaration, setup_string_decl, build_protocol_template): Adjust prototypes. (build_module_initializer_routine, start_class, continue_class, finish_class, start_method_def, objc_start_function, start_protocol, build_method_decl, objc_add_method, add_instance_variable, build_ivar_reference, is_ivar, is_private, get_super_receiver, build_selector_table_decl, objc_push_parm, objc_get_parm_info, gen_type_name, gen_type_name_0, start_var_decl, finish_var_decl, create_field_decl): New prototypes. (objc_expand_function_end, comp_method_with_proto, objc_expr_last, gen_declaration_1, gen_declarator, is_complex_decl, adorn_decl, define_decl, create_builtin_decl, gen_declspecs): Remove prototypes. (TYPE_ID): Rename to OBJECT_TYPEDEF_NAME. (CLASS_TYPEDEF_NAME): New. (TAG_EXECCLASS): Change from a global variable to a #define. (TAG_RETURN_STRUCT): Delete. (TAG_GNUINIT): New, holds '__objc_gnu_init' name. (objc_inherit_code, objc_public_flag): New, moved from c-parse.in. (string_descriptor): New struct. (string_htab): New hash table. (string_hash, string_eq): New prototypes. (generate_struct_by_value_array): Call create_field_decl() instead of create_builtin_decl(). (objc_init): Do not initialize objc_ellipsis_node or TAG_EXECCLASS; In ObjC++ mode, call cxx_init() instead of c_objc_common_init(). (objc_finish_file): In ObjC++, call instantiate_pending_templates() and cp_finish_file(). (define_decl, get_static_reference, get_protocol_reference, create_builtin_decl): Remove functions. (objc_start_class_interface, objc_start_category_interface, objc_start_protocol, objc_continue_interface, objc_finish_interface, objc_start_class_implementation, objc_start_category_implementation, objc_continue_implementation, objc_finish_implementation, objc_set_visibility, objc_set_method_type, objc_build_method_signature, objc_add_method_declaration, objc_start_method_definition, objc_add_instance_variable, objc_get_protocol_qualified_type, create_field_decl, start_var_decl, finish_var_decl): New functions. (setup_string_decl): Simplify since it is only called once. (synth_module_prologue): Call build_class_template(); predefine 'id' and 'Class' as typedefs; rename 'temp_type' to 'type'; disable debug hooks for duration of function; fix GNU runtime messenger signatures to correspond to reality; forward-declare '__objc_exec_class' for the GNU runtime; call build_selector_table_decl(); in ObjC++ mode, generate 'extern "C" { ... }' wrappers around synthesized declarations; call build_protocol_template() and build_category_template(). (string_hash, string_eq): New functions. (objc_build_string_object): Check metaclass correctness only once; store string literals in hash table. (objc_build_constructor): Do not convert initializer elements; adjust for ObjC++ impedance mismatch. (build_objc_symtab_template): Call create_field_decl() instead of create_builtin_decl(). (init_objc_symtab): Add missing conversion to initializer element. (build_metadata_decl): Call start_var_decl() instead of define_decl(). (generate_objc_symtab_decl): Do not call build_category_template(); call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(). (build_module_descriptor): Call create_field_decl() instead of grokfield(); call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(); always mark module descriptor as used; move GNU runtime-specific functionality to build_module_initializer_routine(). (build_module_initializer_routine): New function, broken off of build_module_descriptor(). (objc_static_init_needed_p, objc_generate_static_init_call): New functions. (generate_static_references, generate_strings, build_selector_translation_table, generate_descriptor_table, generate_ivars_list, generate_dispatch_table, generate_category): Call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(); build a type directly instead of via groktypename(). (build_selector_reference_decl, build_selector_table_decl, build_class_reference_decl, build_protocol_reference, generate_objc_image_info): Call start_var_decl() instead of build_decl(). (build_selector_reference): For GNU runtime, do not call build_selector_reference_decl(). (build_selector, build_typed_selector_reference): Always convert result to the selector type. (add_objc_string): Cast return value to 'char *'. (build_method_prototype_template, build_selector_template, build_method_template): Use actual selector type for fields pointing to selectors. (finish_objc): For GNU runtime, call build_module_initializer_routine() after build_module_descriptor(). (generate_protocol_list, generate_shared_structures): Call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(); build a type directly instead of via groktypename(). (synth_id_with_class_suffix): Return a string. (get_arg_type_list): For instance methods, use the instance type for 'self'; do not call groktypename_in_parm_context(). (build_objc_string_decl): Squash redeclaration errors in ObjC++. (objc_is_class_name): Use OBJC_TYPE_NAME instead of TYPE_NAME; handle RECORD_TYPEs in ObjC as well as ObjC++. (objc_is_id): New function. (objc_is_object_ptr): Return the canonical type node. (objc_get_class_ivars): Simplify using get_class_ivars(). (get_class_ivars): Remove second parameter; create a fresh copy of the ivar list for each call; do not check for existence of super class. (objc_eh_runtime_type): Mark #ifndef OBJCPLUS. (objc_init_exceptions): When using SJLJ-style exceptions, require the use of '-fobjc-exceptions' flag; do not require it for DWARF-style exceptions. (objc_build_exc_ptr, next_sjlj_build_try_catch_finally): Use objc_object_type instead of objc_id_type. (objc_begin_catch_clause): Convert the incoming PARM_DECL into a VAR_DECL before placing it in the appropriate scope; do not call define_decl(); adjust call to c_begin_compound_stmt(); use objc_object_type instead of objc_id_type. (build_next_objc_exception_stuff): Call create_field_decl() instead of create_builtin_decl(); construct type directly instead of calling groktypename(); use OBJC_VOID_AT_END to mark end of function parameters. (build_private_template): Adjust call to get_class_ivars(); build a type directly instead of via groktypename(). (build_protocol_template, build_method_prototype_list_template, build_method_prototype_template, build_category_template, build_selector_template, build_class_template, build_super_template, build_ivar_template, build_ivar_list_template, build_method_list_template, build_method_template): Call create_field_decl() instead of grokfield(). (objc_method_parm_type): Do not call groktypename(). (generate_descriptor_table): Call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(). (generate_method_descriptors, build_protocol_initializer, generate_dispatch_tables, build_category_initializer, build_shared_structure_initializer): Do not call groktypename(). (generate_protocols): Call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(); do not call groktypename(). (error_with_ivar): Remove last parameter. (check_ivars): Do not iterate ovar CLASS_RAW_IVARS lists in addition to CLASS_IVARS lists; adjust calls to error_with_ivar(). (generate_ivar_lists): Convert one of the initializer elements; do not call groktypename(). (get_arg_type_list, start_method_def, gen_method_def): Account for new representation of variable arguments and '...' in Objective-C methods; add Objective-C++ impedance matching code. (is_objc_type_qualifier): Remove function. (adjust_type_for_id_default): Simplify; there is no longer a need to wade through declspecs. (lookup_interface, start_class, continue_class, finish_class, start_method_def, start_protocol, build_method_decl, objc_add_method, add_instance_variable, build_ivar_reference, is_ivar, is_private, get_super_receiver, objc_build_finally_epilogue): Make into static functions. (receiver_is_class_object): Use new IS_CLASS() macro. (objc_build_message_expr): Tweak ObjC++ message argument handling; call objc_finish_message_expr() instead of finish_message_expr(). (finish_message_expr): Rename to objc_finish_message_expr(); use OBJC_TYPE_NAME and OBJC_SET_TYPE_NAME macros instead of TYPE_NAME. call gen_type_name() instead of gen_declaration(); call objc_is_id() instead of using IS_ID and IS_CLASS; Use objc_class_name instead of calling get_identifier("Class"); handle CONVERT_EXPRs in receiver. (build_objc_method_call, warn_with_method): Do not call groktypename(). (build_ivar_reference): Call convert() instead of clobbering in a type. (hash_init): Initialize string_htab hash table. (add_instance_variable): Simplify parameter list; do not call grokfield(); do not populate CLASS_IVARS list. (start_class): Check for the existence of super class, if one was specified. (continue_class): Use CLASS_RAW_IVARS rather than CLASS_IVARS; do not call build_class_template(); adjust call to get_class_ivars(); call build_decl(), pushdecl() and finish_decl() instead of define_decl(). (finish_class): Call build_decl(), pushdecl() and finish_decl() instead of define_decl(). (add_protocols): Use PROTOCOL_BINFO_ELTS for the tree vector size. (start_protocol): Do not call build_protocol_template(); use PROTOCOL_BINFO_ELTS for the tree vector size. (encode_type_qualifiers): Do not handle the 'const' qualifier here. (encode_pointer): Encode 'const char *' as 'r*', for backwards compatibility. (encode_array): Use HOST_WIDE_INT_PRINT_DEC instead of "%ld". (encode_type): Handle the 'const' qualifier here. (objc_parmlist): New global variable, sued by objc_push_parm and objc_get_parm_info(). (objc_push_parm, objc_get_parm_info): New functions. (objc_expr_last): Remove function. (synth_self_and_ucmd_args): For instance methods, use the instance type for 'self'; call objc_push_parm() instead of push_parm_decl(). (start_method_def): Do not call push_scope(), declare_parm_level(), pop_scope(), push_parm_decl(), store_parm_decls() or objc_expr_last(); just use objc_push_parm() and objc_get_parm_info(). (comp_method_with_proto): Remove function. (objc_types_are_equivalent): Strip away indirections before comparing underlying types. (comp_proto_with_proto): Do not call groktypename(); types are no longer in raw declspec format. (objc_start_function): New function. (really_start_method): Call comp_proto_with_proto() instead of comp_method_with_proto(); call objc_start_function() instead of hand-crafting a function declarator. (continue_method_def, objc_expand_function_end): Remove functions. (get_super_receiver): Call objc_get_current_scope() instead of get_current_scope(); reference 'super_class' field (instead of 'class'). (finish_method_def): Rename to objc_finish_method_definition() and add a function decl parameter; move method encoding call from objc_expand_function_end(). (is_complex_decl, adorn_decl, gen_declarator, gen_declspecs, gen_declaration_1): Remove functions. (tmpbuf, RAW_DECLSPEC): Remove. (gen_declaration): Remove second parameter; simplify to deal with TYPE_P nodes instead of raw declspecs. (gen_type_name, gen_type_name_0): New functions. (gen_method_decl): Remove second parameter; call gen_type_name() instead of gen_declaration_1(). (dump_interface): Adjust calls to gen_declaration() and gen_method_decl(); do not allocate a separate string buffer. (init_objc): Allocate a larger string buffer to accommodate dump_interface(); adjust call to build_module_descriptor(); add call to build_module_initializer_routine() for the GNU runtime. (generate_classref_translation_entry): Do not call start_decl(); call finish_var_decl() instead of finish_decl(); call convert() instead of build_c_cast(). * objc-act.h (CLASS_OWN_IVARS): Remove accessor. (CLASS_BINFO_ELTS): Reduce from 6 to 5, now that CLASS_OWN_IVARS is gone. (OCTI_GNU_INIT_DECL, GNU_INIT_decl): New. (OCTI_ELLIPSIS_NODE, objc_ellipsis_node): Remove. (OCTI_ID_ID, id_type, objc_id_id): Rename to OCTI_ID_NAME, objc_object_type and objc_object_name, respectively. (OCTI_CLS_REF, OCTI_CLASS_NAME, objc_class_reference, objc_class_name): New. (IS_CLASS): New macro. (IS_ID, IS_SUPER): Robustify. (OCTI_EXECCLASS_DECL, execclass_decl): New. (finish_file, start_class, continue_class, finish_class, start_method_def, continue_method_def, finish_method_def, start_protocol, finish_protocol, objc_build_throw_stmt, objc_build_try_catch_finally_stmt, objc_build_synchronized_prologue, objc_build_synchronized_epilogue, objc_build_try_prologue, objc_build_try_epilogue, objc_build_catch_stmt, objc_build_catch_epilogue, objc_build_finally_prologue, objc_build_finally_epilogue, is_ivar, is_private, is_public, add_instance_variable, objc_add_method, get_super_receiver, objc_clear_super_receiver, get_class_ivars_from_name, get_class_reference, get_static_reference, get_object_reference, build_message_expr, finish_message_expr, build_selector_expr, build_ivar_reference, build_keyword_decl, build_method_decl, build_protocol_expr, build_objc_string_object, objc_declare_alias, objc_declare_class, objc_declare_protocols, objc_comptypes, objc_check_decl, build_encode_expr): Remove prototypes. (imp_count, cat_count): Make GGC-aware. (OBJC_SET_TYPE_NAME): New macro. From-SVN: r87168
2004-09-08 02:49:44 +02:00
(objc_protocol_template)),
build_unary_op (ADDR_EXPR, protocol_list, 0));
initlist = tree_cons (NULL_TREE, expr, initlist);
}
tree.c (build_constructor): New function. * tree.c (build_constructor): New function. * tree.h: Prototype it. * c-typeck.c (build_c_cast, pop_init_level) * profile.c (build_function_info_value, build_gcov_info_value) (create_profiler): Use build_constructor. * builtins.c (expand_builtin_args_info): Remove #if 0 blocks. * objc/objc-act.c (build_constructor): Rename objc_build_constructor. Use build_constructor. (build_objc_string_object, objc_add_static_instance) (init_def_list, init_objc_symtab, init_module_descriptor) (generate_static_references, build_selector_translation_table) (build_descriptor_table_initializer, generate_descriptor_table) (build_protocol_initializer, build_ivar_list_initializer) (generate_ivars_list, build_dispatch_table_initializer) (generate_dispatch_table, generate_protocol_list) (build_category_initializer, build_shared_structure_initializer): Update to match. ada: * gigi.h, utils2.c (build_constructor): Rename gnat_build_constructor. Use build_constructor. * decl.c (gnat_to_gnu_entity) * trans.c (tree_transform, pos_to_constructor, extract_values) * ada/utils.c (build_template, convert_to_fat_pointer, convert) (unchecked_convert) * ada/utils2.c (build_binary_op, build_call_raise, build_allocator) (fill_vms_descriptor): Update to match. cp: * class.c (initialize_array) * decl.c (reshape_init) * decl2.c (build_expr_from_tree) * init.c (build_zero_init) * pt.c (tsubst_copy, tsubst_copy_and_build) * rtti.c (tinfo_base_init, generic_initializer, ptr_initializer) (ptm_initializer, class_initializer, get_pseudo_ti_init) * semantics.c (finish_compound_literal) * typeck.c (build_ptrmemfunc1) * typeck2.c (store_init_value, process_init_constructor) (build_functional_cast): Use build_constructor. f: * com.c (ffecom_build_complex_constant_, ffecom_expr_) (ffecom_init_zero_, ffecom_transform_namelist_, ffecom_vardesc_) (ffecom_vardesc_array_, ffecom_vardesc_dims_, ffecom_2) * ste.c (ffeste_io_ialist_, ffeste_io_cilist_, ffeste_io_cllist_) (ffeste_io_icilist_, ffeste_io_inlist_, ffeste_io_olist_): Use build_constructor. java: * class.c (make_field_value, make_method_value, get_dispatch_table) (make_class_data, emit_offset_symbol_table) * constants.c (build_constants_constructor) * java-tree.h (START_RECORD_CONSTRUCTOR) * parse.y (maybe_build_array_element_wfl): Use build_constructor. From-SVN: r65539
2003-04-13 03:45:35 +02:00
return objc_build_constructor (type, nreverse (initlist));
1992-01-18 00:15:38 +01:00
}
Makefile.in (c-parse.o): Depend on $(C_COMMON_H). [gcc/ChangeLog] 2004-09-07 Ziemowit Laski <zlaski@apple.com> * Makefile.in (c-parse.o): Depend on $(C_COMMON_H). * c-parse.in: Include c-common.h instead of objc-act.h. (ivar_decl_list, ivar_decls, ivar_decl, ivars, ivar_declarator, myparms, myparm): Remove %type declarations. (methodtype, optparms, OBJC_TYPE_QUAL, objc_quals, objc_qual, objc_typename, objc_try_catch_stmt, optellipsis): Add %type declarations. (objc_inherit_code, objc_public_flag): Remove. (typespec_nonreserved_nonattr): Call objc_get_protocol_qualified_type() instead of get_static_reference() and get_protocol_reference(). (stmt_nocomp): Call grokparm() on @catch parameter. (objcdef): Move semantic action to objc_finish_implementation(). (classdef): Move semantic action to objc_start_class_interface(), objc_continue_interface(), objc_finish_interface(), objc_start_class_implementation(), objc_continue_implementation(), objc_start_category_interface() and objc_start_category_implementation(). (protocoldef): Move semantic actions to objc_start_protocol() and objc_finish_interface(). (ivar_decl_list): Remove nonterminal. (visibility_spec): Move semantic actions to objc_set_visibility(). (ivar_decls): Remove assignment to $$. (ivar_decl): Rephrase in terms of component_decl; call objc_add_instance_variable(). (ivars, ivar_declarator): Remove nonterminals. (opt_semi): New nonterminal. (methodtype): Remove semantic actions. (methoddef): Move semantic actions to objc_set_method_type(), objc_start_method_definition() and objc_finish_method_definition(). (methodproto): Move semantic actions to objc_set_method_type() and objc_add_method_declaration(). (methoddecl): Use objc_typename instead of typename; move semantic actions to objc_build_method_signature(). (optarglist, myxdecls, mydecl, myparms, myparm): Remove nonterminals. (optparmlist): Express in terms of optparms and optellipsis. (optparms, optellipsis, objc_qual, objc_quals, objc_typename): New nonterminals. (keyworddecl): Use objc_typename instead of typename. (rid_to_yy): Mark RID_IN, RID_OUT, RID_INOUT, RID_BYCOPY, RID_BYREF and RID_ONEWAY as returning OBJC_TYPE_QUAL to yyparse(). [gcc/objc/ChangeLog] 2004-09-07 Ziemowit Laski <zlaski@apple.com> * Make-lang.in (objc/objc-parse.o): Depend on $(C_COMMON_H) instead of objc/objc-act.h. (objc/objc-act.o): Depend on $(HASHTAB_H). * objc-act.c: Include hashtab.h; in ObjC++ mode, include cp-tree.h and objcp-decl.h instead of c-tree.h. (build_module_descriptor, get_class_ivars, synth_id_with_class_suffix, error_with_ivar, gen_method_decl, gen_declaration, setup_string_decl, build_protocol_template): Adjust prototypes. (build_module_initializer_routine, start_class, continue_class, finish_class, start_method_def, objc_start_function, start_protocol, build_method_decl, objc_add_method, add_instance_variable, build_ivar_reference, is_ivar, is_private, get_super_receiver, build_selector_table_decl, objc_push_parm, objc_get_parm_info, gen_type_name, gen_type_name_0, start_var_decl, finish_var_decl, create_field_decl): New prototypes. (objc_expand_function_end, comp_method_with_proto, objc_expr_last, gen_declaration_1, gen_declarator, is_complex_decl, adorn_decl, define_decl, create_builtin_decl, gen_declspecs): Remove prototypes. (TYPE_ID): Rename to OBJECT_TYPEDEF_NAME. (CLASS_TYPEDEF_NAME): New. (TAG_EXECCLASS): Change from a global variable to a #define. (TAG_RETURN_STRUCT): Delete. (TAG_GNUINIT): New, holds '__objc_gnu_init' name. (objc_inherit_code, objc_public_flag): New, moved from c-parse.in. (string_descriptor): New struct. (string_htab): New hash table. (string_hash, string_eq): New prototypes. (generate_struct_by_value_array): Call create_field_decl() instead of create_builtin_decl(). (objc_init): Do not initialize objc_ellipsis_node or TAG_EXECCLASS; In ObjC++ mode, call cxx_init() instead of c_objc_common_init(). (objc_finish_file): In ObjC++, call instantiate_pending_templates() and cp_finish_file(). (define_decl, get_static_reference, get_protocol_reference, create_builtin_decl): Remove functions. (objc_start_class_interface, objc_start_category_interface, objc_start_protocol, objc_continue_interface, objc_finish_interface, objc_start_class_implementation, objc_start_category_implementation, objc_continue_implementation, objc_finish_implementation, objc_set_visibility, objc_set_method_type, objc_build_method_signature, objc_add_method_declaration, objc_start_method_definition, objc_add_instance_variable, objc_get_protocol_qualified_type, create_field_decl, start_var_decl, finish_var_decl): New functions. (setup_string_decl): Simplify since it is only called once. (synth_module_prologue): Call build_class_template(); predefine 'id' and 'Class' as typedefs; rename 'temp_type' to 'type'; disable debug hooks for duration of function; fix GNU runtime messenger signatures to correspond to reality; forward-declare '__objc_exec_class' for the GNU runtime; call build_selector_table_decl(); in ObjC++ mode, generate 'extern "C" { ... }' wrappers around synthesized declarations; call build_protocol_template() and build_category_template(). (string_hash, string_eq): New functions. (objc_build_string_object): Check metaclass correctness only once; store string literals in hash table. (objc_build_constructor): Do not convert initializer elements; adjust for ObjC++ impedance mismatch. (build_objc_symtab_template): Call create_field_decl() instead of create_builtin_decl(). (init_objc_symtab): Add missing conversion to initializer element. (build_metadata_decl): Call start_var_decl() instead of define_decl(). (generate_objc_symtab_decl): Do not call build_category_template(); call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(). (build_module_descriptor): Call create_field_decl() instead of grokfield(); call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(); always mark module descriptor as used; move GNU runtime-specific functionality to build_module_initializer_routine(). (build_module_initializer_routine): New function, broken off of build_module_descriptor(). (objc_static_init_needed_p, objc_generate_static_init_call): New functions. (generate_static_references, generate_strings, build_selector_translation_table, generate_descriptor_table, generate_ivars_list, generate_dispatch_table, generate_category): Call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(); build a type directly instead of via groktypename(). (build_selector_reference_decl, build_selector_table_decl, build_class_reference_decl, build_protocol_reference, generate_objc_image_info): Call start_var_decl() instead of build_decl(). (build_selector_reference): For GNU runtime, do not call build_selector_reference_decl(). (build_selector, build_typed_selector_reference): Always convert result to the selector type. (add_objc_string): Cast return value to 'char *'. (build_method_prototype_template, build_selector_template, build_method_template): Use actual selector type for fields pointing to selectors. (finish_objc): For GNU runtime, call build_module_initializer_routine() after build_module_descriptor(). (generate_protocol_list, generate_shared_structures): Call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(); build a type directly instead of via groktypename(). (synth_id_with_class_suffix): Return a string. (get_arg_type_list): For instance methods, use the instance type for 'self'; do not call groktypename_in_parm_context(). (build_objc_string_decl): Squash redeclaration errors in ObjC++. (objc_is_class_name): Use OBJC_TYPE_NAME instead of TYPE_NAME; handle RECORD_TYPEs in ObjC as well as ObjC++. (objc_is_id): New function. (objc_is_object_ptr): Return the canonical type node. (objc_get_class_ivars): Simplify using get_class_ivars(). (get_class_ivars): Remove second parameter; create a fresh copy of the ivar list for each call; do not check for existence of super class. (objc_eh_runtime_type): Mark #ifndef OBJCPLUS. (objc_init_exceptions): When using SJLJ-style exceptions, require the use of '-fobjc-exceptions' flag; do not require it for DWARF-style exceptions. (objc_build_exc_ptr, next_sjlj_build_try_catch_finally): Use objc_object_type instead of objc_id_type. (objc_begin_catch_clause): Convert the incoming PARM_DECL into a VAR_DECL before placing it in the appropriate scope; do not call define_decl(); adjust call to c_begin_compound_stmt(); use objc_object_type instead of objc_id_type. (build_next_objc_exception_stuff): Call create_field_decl() instead of create_builtin_decl(); construct type directly instead of calling groktypename(); use OBJC_VOID_AT_END to mark end of function parameters. (build_private_template): Adjust call to get_class_ivars(); build a type directly instead of via groktypename(). (build_protocol_template, build_method_prototype_list_template, build_method_prototype_template, build_category_template, build_selector_template, build_class_template, build_super_template, build_ivar_template, build_ivar_list_template, build_method_list_template, build_method_template): Call create_field_decl() instead of grokfield(). (objc_method_parm_type): Do not call groktypename(). (generate_descriptor_table): Call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(). (generate_method_descriptors, build_protocol_initializer, generate_dispatch_tables, build_category_initializer, build_shared_structure_initializer): Do not call groktypename(). (generate_protocols): Call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(); do not call groktypename(). (error_with_ivar): Remove last parameter. (check_ivars): Do not iterate ovar CLASS_RAW_IVARS lists in addition to CLASS_IVARS lists; adjust calls to error_with_ivar(). (generate_ivar_lists): Convert one of the initializer elements; do not call groktypename(). (get_arg_type_list, start_method_def, gen_method_def): Account for new representation of variable arguments and '...' in Objective-C methods; add Objective-C++ impedance matching code. (is_objc_type_qualifier): Remove function. (adjust_type_for_id_default): Simplify; there is no longer a need to wade through declspecs. (lookup_interface, start_class, continue_class, finish_class, start_method_def, start_protocol, build_method_decl, objc_add_method, add_instance_variable, build_ivar_reference, is_ivar, is_private, get_super_receiver, objc_build_finally_epilogue): Make into static functions. (receiver_is_class_object): Use new IS_CLASS() macro. (objc_build_message_expr): Tweak ObjC++ message argument handling; call objc_finish_message_expr() instead of finish_message_expr(). (finish_message_expr): Rename to objc_finish_message_expr(); use OBJC_TYPE_NAME and OBJC_SET_TYPE_NAME macros instead of TYPE_NAME. call gen_type_name() instead of gen_declaration(); call objc_is_id() instead of using IS_ID and IS_CLASS; Use objc_class_name instead of calling get_identifier("Class"); handle CONVERT_EXPRs in receiver. (build_objc_method_call, warn_with_method): Do not call groktypename(). (build_ivar_reference): Call convert() instead of clobbering in a type. (hash_init): Initialize string_htab hash table. (add_instance_variable): Simplify parameter list; do not call grokfield(); do not populate CLASS_IVARS list. (start_class): Check for the existence of super class, if one was specified. (continue_class): Use CLASS_RAW_IVARS rather than CLASS_IVARS; do not call build_class_template(); adjust call to get_class_ivars(); call build_decl(), pushdecl() and finish_decl() instead of define_decl(). (finish_class): Call build_decl(), pushdecl() and finish_decl() instead of define_decl(). (add_protocols): Use PROTOCOL_BINFO_ELTS for the tree vector size. (start_protocol): Do not call build_protocol_template(); use PROTOCOL_BINFO_ELTS for the tree vector size. (encode_type_qualifiers): Do not handle the 'const' qualifier here. (encode_pointer): Encode 'const char *' as 'r*', for backwards compatibility. (encode_array): Use HOST_WIDE_INT_PRINT_DEC instead of "%ld". (encode_type): Handle the 'const' qualifier here. (objc_parmlist): New global variable, sued by objc_push_parm and objc_get_parm_info(). (objc_push_parm, objc_get_parm_info): New functions. (objc_expr_last): Remove function. (synth_self_and_ucmd_args): For instance methods, use the instance type for 'self'; call objc_push_parm() instead of push_parm_decl(). (start_method_def): Do not call push_scope(), declare_parm_level(), pop_scope(), push_parm_decl(), store_parm_decls() or objc_expr_last(); just use objc_push_parm() and objc_get_parm_info(). (comp_method_with_proto): Remove function. (objc_types_are_equivalent): Strip away indirections before comparing underlying types. (comp_proto_with_proto): Do not call groktypename(); types are no longer in raw declspec format. (objc_start_function): New function. (really_start_method): Call comp_proto_with_proto() instead of comp_method_with_proto(); call objc_start_function() instead of hand-crafting a function declarator. (continue_method_def, objc_expand_function_end): Remove functions. (get_super_receiver): Call objc_get_current_scope() instead of get_current_scope(); reference 'super_class' field (instead of 'class'). (finish_method_def): Rename to objc_finish_method_definition() and add a function decl parameter; move method encoding call from objc_expand_function_end(). (is_complex_decl, adorn_decl, gen_declarator, gen_declspecs, gen_declaration_1): Remove functions. (tmpbuf, RAW_DECLSPEC): Remove. (gen_declaration): Remove second parameter; simplify to deal with TYPE_P nodes instead of raw declspecs. (gen_type_name, gen_type_name_0): New functions. (gen_method_decl): Remove second parameter; call gen_type_name() instead of gen_declaration_1(). (dump_interface): Adjust calls to gen_declaration() and gen_method_decl(); do not allocate a separate string buffer. (init_objc): Allocate a larger string buffer to accommodate dump_interface(); adjust call to build_module_descriptor(); add call to build_module_initializer_routine() for the GNU runtime. (generate_classref_translation_entry): Do not call start_decl(); call finish_var_decl() instead of finish_decl(); call convert() instead of build_c_cast(). * objc-act.h (CLASS_OWN_IVARS): Remove accessor. (CLASS_BINFO_ELTS): Reduce from 6 to 5, now that CLASS_OWN_IVARS is gone. (OCTI_GNU_INIT_DECL, GNU_INIT_decl): New. (OCTI_ELLIPSIS_NODE, objc_ellipsis_node): Remove. (OCTI_ID_ID, id_type, objc_id_id): Rename to OCTI_ID_NAME, objc_object_type and objc_object_name, respectively. (OCTI_CLS_REF, OCTI_CLASS_NAME, objc_class_reference, objc_class_name): New. (IS_CLASS): New macro. (IS_ID, IS_SUPER): Robustify. (OCTI_EXECCLASS_DECL, execclass_decl): New. (finish_file, start_class, continue_class, finish_class, start_method_def, continue_method_def, finish_method_def, start_protocol, finish_protocol, objc_build_throw_stmt, objc_build_try_catch_finally_stmt, objc_build_synchronized_prologue, objc_build_synchronized_epilogue, objc_build_try_prologue, objc_build_try_epilogue, objc_build_catch_stmt, objc_build_catch_epilogue, objc_build_finally_prologue, objc_build_finally_epilogue, is_ivar, is_private, is_public, add_instance_variable, objc_add_method, get_super_receiver, objc_clear_super_receiver, get_class_ivars_from_name, get_class_reference, get_static_reference, get_object_reference, build_message_expr, finish_message_expr, build_selector_expr, build_ivar_reference, build_keyword_decl, build_method_decl, build_protocol_expr, build_objc_string_object, objc_declare_alias, objc_declare_class, objc_declare_protocols, objc_comptypes, objc_check_decl, build_encode_expr): Remove prototypes. (imp_count, cat_count): Make GGC-aware. (OBJC_SET_TYPE_NAME): New macro. From-SVN: r87168
2004-09-08 02:49:44 +02:00
/* struct _objc_class {
struct objc_class *isa;
struct objc_class *super_class;
char *name;
long version;
long info;
long instance_size;
struct objc_ivar_list *ivars;
struct objc_method_list *methods;
if (flag_next_runtime)
struct objc_cache *cache;
else {
struct sarray *dtable;
struct objc_class *subclass_list;
struct objc_class *sibling_class;
}
struct objc_protocol_list *protocols;
if (flag_next_runtime)
void *sel_id;
void *gc_object_type;
}; */
1992-01-18 00:15:38 +01:00
static tree
build_shared_structure_initializer (tree type, tree isa, tree super,
tree name, tree size, int status,
tree dispatch_table, tree ivar_list,
tree protocol_list)
1992-01-18 00:15:38 +01:00
{
tree initlist = NULL_TREE, expr;
1992-01-18 00:15:38 +01:00
/* isa = */
initlist = tree_cons (NULL_TREE, isa, initlist);
1992-01-18 00:15:38 +01:00
/* super_class = */
initlist = tree_cons (NULL_TREE, super, initlist);
1992-01-18 00:15:38 +01:00
/* name = */
initlist = tree_cons (NULL_TREE, default_conversion (name), initlist);
1992-01-18 00:15:38 +01:00
/* version = */
initlist = tree_cons (NULL_TREE, build_int_cst (long_integer_type_node, 0),
initlist);
1992-01-18 00:15:38 +01:00
/* info = */
initlist = tree_cons (NULL_TREE,
build_int_cst (long_integer_type_node, status),
initlist);
1992-01-18 00:15:38 +01:00
/* instance_size = */
initlist = tree_cons (NULL_TREE, convert (long_integer_type_node, size),
initlist);
1992-01-18 00:15:38 +01:00
/* objc_ivar_list = */
if (!ivar_list)
tree.h (build_int_cst): New, sign extended constant. * tree.h (build_int_cst): New, sign extended constant. (build_int_cstu): New, zero extended constant. (build_int_cst_wide): Renamed from build_int_cst. * tree.c (build_int_cst, build_int_cstu): New. (build_int_cst_wide): Renamed from build_int_cst. (make_vector_type, build_common_tree_nodes, build_common_tree_nodes_2): Adjust build_int_cst calls. * builtins.c (expand_builtin_prefetch, expand_builtin_strstr, expand_builtin_strpbrk, expand_builtin_fputs, build_string_literal, expand_builtin_printf, expand_builtin_sprintf, fold_builtin_classify_type, fold_builtin_lround, fold_builtin_bitop, fold_builtin_isascii, fold_builtin_toascii, fold_builtin_isdigit, simplify_builtin_strstr, simplify_builtin_strpbrk, fold_builtin_fputs, simplify_builtin_sprintf): Likewise. * c-common.c (start_fname_decls, fix_string_type, shorten_compare, DEF_ATTR_INT): Likewise. * c-decl.c (complete_array_type, check_bitfield_type_and_width): Likewise. * c-lex.c (interpret_integer, lex_charconst): Likewise. * c-parse.in (primary) <TYPES_COMPATIBLE_P> Likewise. * c-pretty-print.c (pp_c_integer_constant): Likewise. * c-typeck.c (really_start_incremental_init, push_init_level, set_nonincremental_init_from_string): Likewise. * calls.c (load_register_parameters): Likewise. convert.c (convert_to_pointer): Likewise. coverage.c (coverage_counter_alloc, tree_coverage_counter_ref, build_fn_info_type, build_fn_info_value, build_ctr_info_value, build_gcov_info): Likewise. * except.c (init_eh, assign_filter_values): Likewise. * expmed.c (store_fixed_bit_field, extract_bit_field, extract_fixed_bit_field, extract_split_bit_field, expand_shift, expand_mult_const, expand_mult_highpart_adjust, extract_high_half, expand_sdiv_pow2, expand_divmod, make_tree): Likewise. * expr.c (convert_move, emit_group_load, emit_group_store, expand_assignment, store_constructor, store_field, expand_expr_real_1, reduce_to_bit_field_precision): Likewise. fold-const.c (force_fit_type, int_const_binop, fold_convert_const, invert_truthvalue, optimize_bit_field_compare, decode_field_reference, all_ones_mask_p, constant_boolean_node, fold_div_compare, fold, fold_read_from_constant_string, fold_negate_const, fold_abs_const, fold_not_const, round_up, round_down): Likewise. * function.c (assign_parm_setup_block): Likewise. * stmt.c (shift_return_value, expand_case, estimate_case_costs): Likewise. * stor-layout.c (layout_type, initialize_sizetypes, set_min_and_max_values_for_integral_type): Likewise. * tree-chrec.c (chrec_fold_multiply_poly_poly, reset_evolution_in_loop): Likewise. * tree-chrec.h (build_polynomial_chrec): Likewise. * tree-complex.c (build_replicated_const): Likewise. * tree-eh.c (honor_protect_cleanup_actions, lower_try_finally_onedest, lower_try_finally_copy, lower_try_finally_switch): Likewise. * tree-mudflap.c (mf_build_string, mx_register_decls, mudflap_register_call, mudflap_enqueue_constant): Likewise. * tree-nested.c (get_trampoline_type, get_nl_goto_field): Likewise. * tree-pretty-print.c (dump_generic_node): Likewise. * tree-ssa-ccp.c (widen_bitfield, maybe_fold_offset_to_array_ref): Likewise. * tree-ssa-dom.c (simplify_rhs_and_lookup_avail_expr): Likewise. * tree-ssa-loop-niter.c (number_of_iterations_cond, loop_niter_by_eval, upper_bound_in_type, lower_bound_in_type): Likewise. * tree-ssa-loop-ivcanon.c (create_canonical_iv, canonicalize_loop_induction_variables): Likewise. * tree-vectorizer.c (vect_create_index_for_array_ref, vect_transform_loop_bound, vect_compute_data_ref_alignment): Likewise. * config/alpha/alpha.c (alpha_initialize_trampoline, alpha_va_start, alpha_gimplify_va_arg_1): Likewise. * config/arm/arm.c (arm_get_cookie_size): Likewise. * config/c4x/c4x.c (c4x_gimplify_va_arg_expr): Likewise. * config/i386/i386.c (ix86_va_start, ix86_gimplify_va_arg): Likewise. * config/ia64/ia64.c (ia64_gimplify_va_arg): Likewise. * config/mips/mips.c (mips_build_builtin_va_list, mips_va_start, mips_gimplify_va_arg_expr): Likewise. * config/pa/pa.c (hppa_gimplify_va_arg_expr): Likewise. * config/rs6000/rs6000.c (rs6000_va_start, rs6000_gimplify_va_arg, add_compiler_branch_island): Likewise. * config/s390/s390.c (s390_va_start): Likewise. * config/sh/sh.c (sh_va_start): Likewise. * config/stormy16/stormy16.c (xstormy16_expand_builtin_va_start): Likewise. * config/xtensa/xtensa.c (xtensa_va_start, xtensa_gimplify_va_arg_expr): Likewise. * objc/objc-act.c (build_objc_string_object, build_objc_symtab_template, init_def_list, init_objc_symtab, init_module_descriptor, generate_static_references, build_selector_translation_table, get_proto_encoding, build_typed_selector_reference, build_selector_reference, build_next_objc_exception_stuff, build_method_prototype_list_template, generate_descriptor_table, generate_protocols, build_protocol_initializer, build_ivar_list_template, build_method_list_template, build_ivar_list_initializer, generate_ivars_list, generate_dispatch_table, generate_protocol_list, build_category_initializer, build_shared_structure_initializer, generate_shared_structures, handle_impent, generate_objc_image_info): Likewise. 2004-04-25 Paolo Bonzini <bonzini@gnu.org> * cfglayout.c (duplicate_insn_chain): Remove references to NOTE_INSN_LOOP_VTOP and NOTE_INSN_LOOP_CONT. * cfgloop.h (struct loop): Remove fields vtop, cont and cont_dominator. * cfgrtl.c (rtl_delete_block): Remove handling of NOTE_INSN_LOOP_CONT. * final.c (final_scan_insn): Remove references to NOTE_INSN_LOOP_VTOP and NOTE_INSN_LOOP_CONT. * insn-notes.def (NOTE_INSN_LOOP_VTOP, NOTE_INSN_LOOP_CONT): Remove. * jump.c (squeeze_notes): Remove references to NOTE_INSN_LOOP_VTOP and NOTE_INSN_LOOP_CONT. * loop.c (scan_loops, find_and_verify_loops, for_each_insn_in_loop, check_dbra_loop, loop_dump_aux): Remove references to removed notes and fields. * reorg.c (mostly_true_jump): Do not rely on NOTE_INSN_LOOP_VTOPs. * unroll.c (unroll_loop, copy_loop_body, loop_iterations): Remove references to removed notes and fields. (subtract_reg_term, ujump_to_loop_cont): Remove. From-SVN: r86544
2004-08-25 11:52:54 +02:00
initlist = tree_cons (NULL_TREE, build_int_cst (NULL_TREE, 0), initlist);
1992-01-18 00:15:38 +01:00
else
{
Yet more Objective-C++... * objc-act.c (objc_finish_try_stmt): Add return value. (objc_build_synchronized): Likewise. * objc-act.c (objc_is_gcable_type): Add. (objc_substitute_decl): Add. (objc_build_ivar_assignment): Add. (objc_build_global_assignment): Add. (objc_build_strong_cast_assignment): Add. (objc_is_ivar_reference_p): Add. (objc_is_global_reference_p): Add. (objc_generate_write_barrier): Add. (objc_rewrite_function_call): Add. (objc_gimplify_expr): Add Objective-C++ support. * objc-act.h (ALLOC_OBJC_TYPE_LANG_SPECIFIC): Likewise. (SIZEOF_OBJC_TYPE_LANG_SPECIFIC): Add. (INIT_TYPE_OBJC_INFO): Add Objective-C++ support. (DUP_TYPE_OBJC_INFO): Likewise. (struct imp_entry): Add field has_cxx_cdtors. (struct imp_entry *imp_list): Add OCTI_UMSG_FAST_DECL, OCTI_METH_LIST_TEMPL, OCTI_METH_PROTO_LIST_TEMPL, OCTI_IVAR_LIST_TEMPL, OCTI_ASSIGN_IVAR_DECL, OCTI_ASSIGN_IVAR_FAST_DECL, OCTI_ASSIGN_GLOBAL_DECL, OCTI_ASSIGN_STRONGCAST_DECL. (umsg_fast_decl): Add. (objc_assign_ivar_decl): Add. (objc_assign_ivar_fast_decl): Add. (objc_assign_global_decl): Add. (objc_assign_strong_cast_decl): Add. (objc_method_list_ptr): Add. (objc_method_proto_list_ptr): Add. (objc_ivar_list_ptr): Add. * objc-act.c (should_call_super_dealloc): Add. (OBJC_VERSION): Bump to 6. (objc_is_gcable_type): Add. (objc_substitute_decl): Add. (objc_build_ivar_assignment): Add. (objc_build_global_assignment): Add. (objc_build_strong_cast_assignment): Add. (objc_is_gcable_p): Add. (objc_is_ivar_reference_p): Add. (objc_is_global_reference_p): Add. (generate_shared_structures): Add flags parameter. (objc_generate_cxx_ctor_or_dtor): Add. (objc_generate_cxx_cdtors): Add. (add_class): Add name parameter. (objc_types_share_size_and_alignment): Add. (comp_proto_with_proto): Add strict parameter. (CLS_HAS_CXX_STRUCTORS): Add. (TAG_ASSIGNIVAR): Add. (TAG_ASSIGNGLOBAL): Add. (TAG_ASSIGNSTRONGCAST): Add. (TAG_MSGSEND_FAST): Add. (TAG_ASSIGNIVAR_FAST): Add. (TAG_CXX_CONSTRUCT): Add. (TAG_CXX_DESTRUCT): Add. (OBJC_LOOKUP_CLASS): Add. (OBJC_LOOKUP_NO_SUPER): Add. (objc_finish_file): Add pch support. (objc_finish_implementation): Add Objective-C++ support. (synth_module_prologue): Likewise. (synth_module_prologue): Add fast dispatching. (objc_get_class_reference): Add Objective-C++ support. (objc_generate_write_barrier): Likewise. (next_sjlj_build_enter_and_setjmp): Likewise. (objc_begin_try_stmt): Likewise. (build_next_objc_exception_stuff): Add fast ivar support. (build_private_template): Mark the record as used so debug information is generated. (build_protocol_template): Add Objective-C++ support. (objc_method_parm_type) Likewise. (objc_generate_cxx_ctor_or_dtor): Likewise. (objc_generate_cxx_cdtors): Likewise. (build_protocol_initializer): Likewise. (build_category_template): Likewise. (build_class_template): Likewise. (build_method_list_template): Likewise. (build_category_initializer): Likewise. (build_shared_structure_initializer): Likewise. (objc_finish_message_expr): Likewise. (build_objc_method_call): Add fast dispatch support. (lookup_method_static): Add support to end search at superclasses. (add_method_to_hash_list): Add strict parameter to comp_proto_with_proto. (objc_add_method): Likewise. (objc_add_method): Also set the interface_value. (add_instance_variable): Add Objective-C++ support. (objc_is_public): Likewise. (start_class): Likewise. (continue_class): Likewise. (encode_aggregate_within): Likewise. (start_method_def): Likewise. (objc_start_function): Clear current_function_returns_value and current_function_returns_null. (really_start_method): Add Objective-C++ support. (objc_finish_method_definition): Add warning for missing [super dealloc]. (finish_objc): Add Objective-C++ support. (generate_objc_image_info): Likewise. (objc_lookup_ivar): Likewise. * objc-act.h (TYPE_HAS_OBJC_INFO): Likewise. (INIT_TYPE_OBJC_INFO): Likewise. (DUP_TYPE_OBJC_INFO): Likewise. From-SVN: r99857
2005-05-17 22:07:08 +02:00
expr = convert (objc_ivar_list_ptr,
build_unary_op (ADDR_EXPR, ivar_list, 0));
initlist = tree_cons (NULL_TREE, expr, initlist);
1992-01-18 00:15:38 +01:00
}
/* objc_method_list = */
if (!dispatch_table)
tree.h (build_int_cst): New, sign extended constant. * tree.h (build_int_cst): New, sign extended constant. (build_int_cstu): New, zero extended constant. (build_int_cst_wide): Renamed from build_int_cst. * tree.c (build_int_cst, build_int_cstu): New. (build_int_cst_wide): Renamed from build_int_cst. (make_vector_type, build_common_tree_nodes, build_common_tree_nodes_2): Adjust build_int_cst calls. * builtins.c (expand_builtin_prefetch, expand_builtin_strstr, expand_builtin_strpbrk, expand_builtin_fputs, build_string_literal, expand_builtin_printf, expand_builtin_sprintf, fold_builtin_classify_type, fold_builtin_lround, fold_builtin_bitop, fold_builtin_isascii, fold_builtin_toascii, fold_builtin_isdigit, simplify_builtin_strstr, simplify_builtin_strpbrk, fold_builtin_fputs, simplify_builtin_sprintf): Likewise. * c-common.c (start_fname_decls, fix_string_type, shorten_compare, DEF_ATTR_INT): Likewise. * c-decl.c (complete_array_type, check_bitfield_type_and_width): Likewise. * c-lex.c (interpret_integer, lex_charconst): Likewise. * c-parse.in (primary) <TYPES_COMPATIBLE_P> Likewise. * c-pretty-print.c (pp_c_integer_constant): Likewise. * c-typeck.c (really_start_incremental_init, push_init_level, set_nonincremental_init_from_string): Likewise. * calls.c (load_register_parameters): Likewise. convert.c (convert_to_pointer): Likewise. coverage.c (coverage_counter_alloc, tree_coverage_counter_ref, build_fn_info_type, build_fn_info_value, build_ctr_info_value, build_gcov_info): Likewise. * except.c (init_eh, assign_filter_values): Likewise. * expmed.c (store_fixed_bit_field, extract_bit_field, extract_fixed_bit_field, extract_split_bit_field, expand_shift, expand_mult_const, expand_mult_highpart_adjust, extract_high_half, expand_sdiv_pow2, expand_divmod, make_tree): Likewise. * expr.c (convert_move, emit_group_load, emit_group_store, expand_assignment, store_constructor, store_field, expand_expr_real_1, reduce_to_bit_field_precision): Likewise. fold-const.c (force_fit_type, int_const_binop, fold_convert_const, invert_truthvalue, optimize_bit_field_compare, decode_field_reference, all_ones_mask_p, constant_boolean_node, fold_div_compare, fold, fold_read_from_constant_string, fold_negate_const, fold_abs_const, fold_not_const, round_up, round_down): Likewise. * function.c (assign_parm_setup_block): Likewise. * stmt.c (shift_return_value, expand_case, estimate_case_costs): Likewise. * stor-layout.c (layout_type, initialize_sizetypes, set_min_and_max_values_for_integral_type): Likewise. * tree-chrec.c (chrec_fold_multiply_poly_poly, reset_evolution_in_loop): Likewise. * tree-chrec.h (build_polynomial_chrec): Likewise. * tree-complex.c (build_replicated_const): Likewise. * tree-eh.c (honor_protect_cleanup_actions, lower_try_finally_onedest, lower_try_finally_copy, lower_try_finally_switch): Likewise. * tree-mudflap.c (mf_build_string, mx_register_decls, mudflap_register_call, mudflap_enqueue_constant): Likewise. * tree-nested.c (get_trampoline_type, get_nl_goto_field): Likewise. * tree-pretty-print.c (dump_generic_node): Likewise. * tree-ssa-ccp.c (widen_bitfield, maybe_fold_offset_to_array_ref): Likewise. * tree-ssa-dom.c (simplify_rhs_and_lookup_avail_expr): Likewise. * tree-ssa-loop-niter.c (number_of_iterations_cond, loop_niter_by_eval, upper_bound_in_type, lower_bound_in_type): Likewise. * tree-ssa-loop-ivcanon.c (create_canonical_iv, canonicalize_loop_induction_variables): Likewise. * tree-vectorizer.c (vect_create_index_for_array_ref, vect_transform_loop_bound, vect_compute_data_ref_alignment): Likewise. * config/alpha/alpha.c (alpha_initialize_trampoline, alpha_va_start, alpha_gimplify_va_arg_1): Likewise. * config/arm/arm.c (arm_get_cookie_size): Likewise. * config/c4x/c4x.c (c4x_gimplify_va_arg_expr): Likewise. * config/i386/i386.c (ix86_va_start, ix86_gimplify_va_arg): Likewise. * config/ia64/ia64.c (ia64_gimplify_va_arg): Likewise. * config/mips/mips.c (mips_build_builtin_va_list, mips_va_start, mips_gimplify_va_arg_expr): Likewise. * config/pa/pa.c (hppa_gimplify_va_arg_expr): Likewise. * config/rs6000/rs6000.c (rs6000_va_start, rs6000_gimplify_va_arg, add_compiler_branch_island): Likewise. * config/s390/s390.c (s390_va_start): Likewise. * config/sh/sh.c (sh_va_start): Likewise. * config/stormy16/stormy16.c (xstormy16_expand_builtin_va_start): Likewise. * config/xtensa/xtensa.c (xtensa_va_start, xtensa_gimplify_va_arg_expr): Likewise. * objc/objc-act.c (build_objc_string_object, build_objc_symtab_template, init_def_list, init_objc_symtab, init_module_descriptor, generate_static_references, build_selector_translation_table, get_proto_encoding, build_typed_selector_reference, build_selector_reference, build_next_objc_exception_stuff, build_method_prototype_list_template, generate_descriptor_table, generate_protocols, build_protocol_initializer, build_ivar_list_template, build_method_list_template, build_ivar_list_initializer, generate_ivars_list, generate_dispatch_table, generate_protocol_list, build_category_initializer, build_shared_structure_initializer, generate_shared_structures, handle_impent, generate_objc_image_info): Likewise. 2004-04-25 Paolo Bonzini <bonzini@gnu.org> * cfglayout.c (duplicate_insn_chain): Remove references to NOTE_INSN_LOOP_VTOP and NOTE_INSN_LOOP_CONT. * cfgloop.h (struct loop): Remove fields vtop, cont and cont_dominator. * cfgrtl.c (rtl_delete_block): Remove handling of NOTE_INSN_LOOP_CONT. * final.c (final_scan_insn): Remove references to NOTE_INSN_LOOP_VTOP and NOTE_INSN_LOOP_CONT. * insn-notes.def (NOTE_INSN_LOOP_VTOP, NOTE_INSN_LOOP_CONT): Remove. * jump.c (squeeze_notes): Remove references to NOTE_INSN_LOOP_VTOP and NOTE_INSN_LOOP_CONT. * loop.c (scan_loops, find_and_verify_loops, for_each_insn_in_loop, check_dbra_loop, loop_dump_aux): Remove references to removed notes and fields. * reorg.c (mostly_true_jump): Do not rely on NOTE_INSN_LOOP_VTOPs. * unroll.c (unroll_loop, copy_loop_body, loop_iterations): Remove references to removed notes and fields. (subtract_reg_term, ujump_to_loop_cont): Remove. From-SVN: r86544
2004-08-25 11:52:54 +02:00
initlist = tree_cons (NULL_TREE, build_int_cst (NULL_TREE, 0), initlist);
1992-01-18 00:15:38 +01:00
else
{
Yet more Objective-C++... * objc-act.c (objc_finish_try_stmt): Add return value. (objc_build_synchronized): Likewise. * objc-act.c (objc_is_gcable_type): Add. (objc_substitute_decl): Add. (objc_build_ivar_assignment): Add. (objc_build_global_assignment): Add. (objc_build_strong_cast_assignment): Add. (objc_is_ivar_reference_p): Add. (objc_is_global_reference_p): Add. (objc_generate_write_barrier): Add. (objc_rewrite_function_call): Add. (objc_gimplify_expr): Add Objective-C++ support. * objc-act.h (ALLOC_OBJC_TYPE_LANG_SPECIFIC): Likewise. (SIZEOF_OBJC_TYPE_LANG_SPECIFIC): Add. (INIT_TYPE_OBJC_INFO): Add Objective-C++ support. (DUP_TYPE_OBJC_INFO): Likewise. (struct imp_entry): Add field has_cxx_cdtors. (struct imp_entry *imp_list): Add OCTI_UMSG_FAST_DECL, OCTI_METH_LIST_TEMPL, OCTI_METH_PROTO_LIST_TEMPL, OCTI_IVAR_LIST_TEMPL, OCTI_ASSIGN_IVAR_DECL, OCTI_ASSIGN_IVAR_FAST_DECL, OCTI_ASSIGN_GLOBAL_DECL, OCTI_ASSIGN_STRONGCAST_DECL. (umsg_fast_decl): Add. (objc_assign_ivar_decl): Add. (objc_assign_ivar_fast_decl): Add. (objc_assign_global_decl): Add. (objc_assign_strong_cast_decl): Add. (objc_method_list_ptr): Add. (objc_method_proto_list_ptr): Add. (objc_ivar_list_ptr): Add. * objc-act.c (should_call_super_dealloc): Add. (OBJC_VERSION): Bump to 6. (objc_is_gcable_type): Add. (objc_substitute_decl): Add. (objc_build_ivar_assignment): Add. (objc_build_global_assignment): Add. (objc_build_strong_cast_assignment): Add. (objc_is_gcable_p): Add. (objc_is_ivar_reference_p): Add. (objc_is_global_reference_p): Add. (generate_shared_structures): Add flags parameter. (objc_generate_cxx_ctor_or_dtor): Add. (objc_generate_cxx_cdtors): Add. (add_class): Add name parameter. (objc_types_share_size_and_alignment): Add. (comp_proto_with_proto): Add strict parameter. (CLS_HAS_CXX_STRUCTORS): Add. (TAG_ASSIGNIVAR): Add. (TAG_ASSIGNGLOBAL): Add. (TAG_ASSIGNSTRONGCAST): Add. (TAG_MSGSEND_FAST): Add. (TAG_ASSIGNIVAR_FAST): Add. (TAG_CXX_CONSTRUCT): Add. (TAG_CXX_DESTRUCT): Add. (OBJC_LOOKUP_CLASS): Add. (OBJC_LOOKUP_NO_SUPER): Add. (objc_finish_file): Add pch support. (objc_finish_implementation): Add Objective-C++ support. (synth_module_prologue): Likewise. (synth_module_prologue): Add fast dispatching. (objc_get_class_reference): Add Objective-C++ support. (objc_generate_write_barrier): Likewise. (next_sjlj_build_enter_and_setjmp): Likewise. (objc_begin_try_stmt): Likewise. (build_next_objc_exception_stuff): Add fast ivar support. (build_private_template): Mark the record as used so debug information is generated. (build_protocol_template): Add Objective-C++ support. (objc_method_parm_type) Likewise. (objc_generate_cxx_ctor_or_dtor): Likewise. (objc_generate_cxx_cdtors): Likewise. (build_protocol_initializer): Likewise. (build_category_template): Likewise. (build_class_template): Likewise. (build_method_list_template): Likewise. (build_category_initializer): Likewise. (build_shared_structure_initializer): Likewise. (objc_finish_message_expr): Likewise. (build_objc_method_call): Add fast dispatch support. (lookup_method_static): Add support to end search at superclasses. (add_method_to_hash_list): Add strict parameter to comp_proto_with_proto. (objc_add_method): Likewise. (objc_add_method): Also set the interface_value. (add_instance_variable): Add Objective-C++ support. (objc_is_public): Likewise. (start_class): Likewise. (continue_class): Likewise. (encode_aggregate_within): Likewise. (start_method_def): Likewise. (objc_start_function): Clear current_function_returns_value and current_function_returns_null. (really_start_method): Add Objective-C++ support. (objc_finish_method_definition): Add warning for missing [super dealloc]. (finish_objc): Add Objective-C++ support. (generate_objc_image_info): Likewise. (objc_lookup_ivar): Likewise. * objc-act.h (TYPE_HAS_OBJC_INFO): Likewise. (INIT_TYPE_OBJC_INFO): Likewise. (DUP_TYPE_OBJC_INFO): Likewise. From-SVN: r99857
2005-05-17 22:07:08 +02:00
expr = convert (objc_method_list_ptr,
build_unary_op (ADDR_EXPR, dispatch_table, 0));
initlist = tree_cons (NULL_TREE, expr, initlist);
1992-01-18 00:15:38 +01:00
}
if (flag_next_runtime)
/* method_cache = */
tree.h (build_int_cst): New, sign extended constant. * tree.h (build_int_cst): New, sign extended constant. (build_int_cstu): New, zero extended constant. (build_int_cst_wide): Renamed from build_int_cst. * tree.c (build_int_cst, build_int_cstu): New. (build_int_cst_wide): Renamed from build_int_cst. (make_vector_type, build_common_tree_nodes, build_common_tree_nodes_2): Adjust build_int_cst calls. * builtins.c (expand_builtin_prefetch, expand_builtin_strstr, expand_builtin_strpbrk, expand_builtin_fputs, build_string_literal, expand_builtin_printf, expand_builtin_sprintf, fold_builtin_classify_type, fold_builtin_lround, fold_builtin_bitop, fold_builtin_isascii, fold_builtin_toascii, fold_builtin_isdigit, simplify_builtin_strstr, simplify_builtin_strpbrk, fold_builtin_fputs, simplify_builtin_sprintf): Likewise. * c-common.c (start_fname_decls, fix_string_type, shorten_compare, DEF_ATTR_INT): Likewise. * c-decl.c (complete_array_type, check_bitfield_type_and_width): Likewise. * c-lex.c (interpret_integer, lex_charconst): Likewise. * c-parse.in (primary) <TYPES_COMPATIBLE_P> Likewise. * c-pretty-print.c (pp_c_integer_constant): Likewise. * c-typeck.c (really_start_incremental_init, push_init_level, set_nonincremental_init_from_string): Likewise. * calls.c (load_register_parameters): Likewise. convert.c (convert_to_pointer): Likewise. coverage.c (coverage_counter_alloc, tree_coverage_counter_ref, build_fn_info_type, build_fn_info_value, build_ctr_info_value, build_gcov_info): Likewise. * except.c (init_eh, assign_filter_values): Likewise. * expmed.c (store_fixed_bit_field, extract_bit_field, extract_fixed_bit_field, extract_split_bit_field, expand_shift, expand_mult_const, expand_mult_highpart_adjust, extract_high_half, expand_sdiv_pow2, expand_divmod, make_tree): Likewise. * expr.c (convert_move, emit_group_load, emit_group_store, expand_assignment, store_constructor, store_field, expand_expr_real_1, reduce_to_bit_field_precision): Likewise. fold-const.c (force_fit_type, int_const_binop, fold_convert_const, invert_truthvalue, optimize_bit_field_compare, decode_field_reference, all_ones_mask_p, constant_boolean_node, fold_div_compare, fold, fold_read_from_constant_string, fold_negate_const, fold_abs_const, fold_not_const, round_up, round_down): Likewise. * function.c (assign_parm_setup_block): Likewise. * stmt.c (shift_return_value, expand_case, estimate_case_costs): Likewise. * stor-layout.c (layout_type, initialize_sizetypes, set_min_and_max_values_for_integral_type): Likewise. * tree-chrec.c (chrec_fold_multiply_poly_poly, reset_evolution_in_loop): Likewise. * tree-chrec.h (build_polynomial_chrec): Likewise. * tree-complex.c (build_replicated_const): Likewise. * tree-eh.c (honor_protect_cleanup_actions, lower_try_finally_onedest, lower_try_finally_copy, lower_try_finally_switch): Likewise. * tree-mudflap.c (mf_build_string, mx_register_decls, mudflap_register_call, mudflap_enqueue_constant): Likewise. * tree-nested.c (get_trampoline_type, get_nl_goto_field): Likewise. * tree-pretty-print.c (dump_generic_node): Likewise. * tree-ssa-ccp.c (widen_bitfield, maybe_fold_offset_to_array_ref): Likewise. * tree-ssa-dom.c (simplify_rhs_and_lookup_avail_expr): Likewise. * tree-ssa-loop-niter.c (number_of_iterations_cond, loop_niter_by_eval, upper_bound_in_type, lower_bound_in_type): Likewise. * tree-ssa-loop-ivcanon.c (create_canonical_iv, canonicalize_loop_induction_variables): Likewise. * tree-vectorizer.c (vect_create_index_for_array_ref, vect_transform_loop_bound, vect_compute_data_ref_alignment): Likewise. * config/alpha/alpha.c (alpha_initialize_trampoline, alpha_va_start, alpha_gimplify_va_arg_1): Likewise. * config/arm/arm.c (arm_get_cookie_size): Likewise. * config/c4x/c4x.c (c4x_gimplify_va_arg_expr): Likewise. * config/i386/i386.c (ix86_va_start, ix86_gimplify_va_arg): Likewise. * config/ia64/ia64.c (ia64_gimplify_va_arg): Likewise. * config/mips/mips.c (mips_build_builtin_va_list, mips_va_start, mips_gimplify_va_arg_expr): Likewise. * config/pa/pa.c (hppa_gimplify_va_arg_expr): Likewise. * config/rs6000/rs6000.c (rs6000_va_start, rs6000_gimplify_va_arg, add_compiler_branch_island): Likewise. * config/s390/s390.c (s390_va_start): Likewise. * config/sh/sh.c (sh_va_start): Likewise. * config/stormy16/stormy16.c (xstormy16_expand_builtin_va_start): Likewise. * config/xtensa/xtensa.c (xtensa_va_start, xtensa_gimplify_va_arg_expr): Likewise. * objc/objc-act.c (build_objc_string_object, build_objc_symtab_template, init_def_list, init_objc_symtab, init_module_descriptor, generate_static_references, build_selector_translation_table, get_proto_encoding, build_typed_selector_reference, build_selector_reference, build_next_objc_exception_stuff, build_method_prototype_list_template, generate_descriptor_table, generate_protocols, build_protocol_initializer, build_ivar_list_template, build_method_list_template, build_ivar_list_initializer, generate_ivars_list, generate_dispatch_table, generate_protocol_list, build_category_initializer, build_shared_structure_initializer, generate_shared_structures, handle_impent, generate_objc_image_info): Likewise. 2004-04-25 Paolo Bonzini <bonzini@gnu.org> * cfglayout.c (duplicate_insn_chain): Remove references to NOTE_INSN_LOOP_VTOP and NOTE_INSN_LOOP_CONT. * cfgloop.h (struct loop): Remove fields vtop, cont and cont_dominator. * cfgrtl.c (rtl_delete_block): Remove handling of NOTE_INSN_LOOP_CONT. * final.c (final_scan_insn): Remove references to NOTE_INSN_LOOP_VTOP and NOTE_INSN_LOOP_CONT. * insn-notes.def (NOTE_INSN_LOOP_VTOP, NOTE_INSN_LOOP_CONT): Remove. * jump.c (squeeze_notes): Remove references to NOTE_INSN_LOOP_VTOP and NOTE_INSN_LOOP_CONT. * loop.c (scan_loops, find_and_verify_loops, for_each_insn_in_loop, check_dbra_loop, loop_dump_aux): Remove references to removed notes and fields. * reorg.c (mostly_true_jump): Do not rely on NOTE_INSN_LOOP_VTOPs. * unroll.c (unroll_loop, copy_loop_body, loop_iterations): Remove references to removed notes and fields. (subtract_reg_term, ujump_to_loop_cont): Remove. From-SVN: r86544
2004-08-25 11:52:54 +02:00
initlist = tree_cons (NULL_TREE, build_int_cst (NULL_TREE, 0), initlist);
else
{
/* dtable = */
tree.h (build_int_cst): New, sign extended constant. * tree.h (build_int_cst): New, sign extended constant. (build_int_cstu): New, zero extended constant. (build_int_cst_wide): Renamed from build_int_cst. * tree.c (build_int_cst, build_int_cstu): New. (build_int_cst_wide): Renamed from build_int_cst. (make_vector_type, build_common_tree_nodes, build_common_tree_nodes_2): Adjust build_int_cst calls. * builtins.c (expand_builtin_prefetch, expand_builtin_strstr, expand_builtin_strpbrk, expand_builtin_fputs, build_string_literal, expand_builtin_printf, expand_builtin_sprintf, fold_builtin_classify_type, fold_builtin_lround, fold_builtin_bitop, fold_builtin_isascii, fold_builtin_toascii, fold_builtin_isdigit, simplify_builtin_strstr, simplify_builtin_strpbrk, fold_builtin_fputs, simplify_builtin_sprintf): Likewise. * c-common.c (start_fname_decls, fix_string_type, shorten_compare, DEF_ATTR_INT): Likewise. * c-decl.c (complete_array_type, check_bitfield_type_and_width): Likewise. * c-lex.c (interpret_integer, lex_charconst): Likewise. * c-parse.in (primary) <TYPES_COMPATIBLE_P> Likewise. * c-pretty-print.c (pp_c_integer_constant): Likewise. * c-typeck.c (really_start_incremental_init, push_init_level, set_nonincremental_init_from_string): Likewise. * calls.c (load_register_parameters): Likewise. convert.c (convert_to_pointer): Likewise. coverage.c (coverage_counter_alloc, tree_coverage_counter_ref, build_fn_info_type, build_fn_info_value, build_ctr_info_value, build_gcov_info): Likewise. * except.c (init_eh, assign_filter_values): Likewise. * expmed.c (store_fixed_bit_field, extract_bit_field, extract_fixed_bit_field, extract_split_bit_field, expand_shift, expand_mult_const, expand_mult_highpart_adjust, extract_high_half, expand_sdiv_pow2, expand_divmod, make_tree): Likewise. * expr.c (convert_move, emit_group_load, emit_group_store, expand_assignment, store_constructor, store_field, expand_expr_real_1, reduce_to_bit_field_precision): Likewise. fold-const.c (force_fit_type, int_const_binop, fold_convert_const, invert_truthvalue, optimize_bit_field_compare, decode_field_reference, all_ones_mask_p, constant_boolean_node, fold_div_compare, fold, fold_read_from_constant_string, fold_negate_const, fold_abs_const, fold_not_const, round_up, round_down): Likewise. * function.c (assign_parm_setup_block): Likewise. * stmt.c (shift_return_value, expand_case, estimate_case_costs): Likewise. * stor-layout.c (layout_type, initialize_sizetypes, set_min_and_max_values_for_integral_type): Likewise. * tree-chrec.c (chrec_fold_multiply_poly_poly, reset_evolution_in_loop): Likewise. * tree-chrec.h (build_polynomial_chrec): Likewise. * tree-complex.c (build_replicated_const): Likewise. * tree-eh.c (honor_protect_cleanup_actions, lower_try_finally_onedest, lower_try_finally_copy, lower_try_finally_switch): Likewise. * tree-mudflap.c (mf_build_string, mx_register_decls, mudflap_register_call, mudflap_enqueue_constant): Likewise. * tree-nested.c (get_trampoline_type, get_nl_goto_field): Likewise. * tree-pretty-print.c (dump_generic_node): Likewise. * tree-ssa-ccp.c (widen_bitfield, maybe_fold_offset_to_array_ref): Likewise. * tree-ssa-dom.c (simplify_rhs_and_lookup_avail_expr): Likewise. * tree-ssa-loop-niter.c (number_of_iterations_cond, loop_niter_by_eval, upper_bound_in_type, lower_bound_in_type): Likewise. * tree-ssa-loop-ivcanon.c (create_canonical_iv, canonicalize_loop_induction_variables): Likewise. * tree-vectorizer.c (vect_create_index_for_array_ref, vect_transform_loop_bound, vect_compute_data_ref_alignment): Likewise. * config/alpha/alpha.c (alpha_initialize_trampoline, alpha_va_start, alpha_gimplify_va_arg_1): Likewise. * config/arm/arm.c (arm_get_cookie_size): Likewise. * config/c4x/c4x.c (c4x_gimplify_va_arg_expr): Likewise. * config/i386/i386.c (ix86_va_start, ix86_gimplify_va_arg): Likewise. * config/ia64/ia64.c (ia64_gimplify_va_arg): Likewise. * config/mips/mips.c (mips_build_builtin_va_list, mips_va_start, mips_gimplify_va_arg_expr): Likewise. * config/pa/pa.c (hppa_gimplify_va_arg_expr): Likewise. * config/rs6000/rs6000.c (rs6000_va_start, rs6000_gimplify_va_arg, add_compiler_branch_island): Likewise. * config/s390/s390.c (s390_va_start): Likewise. * config/sh/sh.c (sh_va_start): Likewise. * config/stormy16/stormy16.c (xstormy16_expand_builtin_va_start): Likewise. * config/xtensa/xtensa.c (xtensa_va_start, xtensa_gimplify_va_arg_expr): Likewise. * objc/objc-act.c (build_objc_string_object, build_objc_symtab_template, init_def_list, init_objc_symtab, init_module_descriptor, generate_static_references, build_selector_translation_table, get_proto_encoding, build_typed_selector_reference, build_selector_reference, build_next_objc_exception_stuff, build_method_prototype_list_template, generate_descriptor_table, generate_protocols, build_protocol_initializer, build_ivar_list_template, build_method_list_template, build_ivar_list_initializer, generate_ivars_list, generate_dispatch_table, generate_protocol_list, build_category_initializer, build_shared_structure_initializer, generate_shared_structures, handle_impent, generate_objc_image_info): Likewise. 2004-04-25 Paolo Bonzini <bonzini@gnu.org> * cfglayout.c (duplicate_insn_chain): Remove references to NOTE_INSN_LOOP_VTOP and NOTE_INSN_LOOP_CONT. * cfgloop.h (struct loop): Remove fields vtop, cont and cont_dominator. * cfgrtl.c (rtl_delete_block): Remove handling of NOTE_INSN_LOOP_CONT. * final.c (final_scan_insn): Remove references to NOTE_INSN_LOOP_VTOP and NOTE_INSN_LOOP_CONT. * insn-notes.def (NOTE_INSN_LOOP_VTOP, NOTE_INSN_LOOP_CONT): Remove. * jump.c (squeeze_notes): Remove references to NOTE_INSN_LOOP_VTOP and NOTE_INSN_LOOP_CONT. * loop.c (scan_loops, find_and_verify_loops, for_each_insn_in_loop, check_dbra_loop, loop_dump_aux): Remove references to removed notes and fields. * reorg.c (mostly_true_jump): Do not rely on NOTE_INSN_LOOP_VTOPs. * unroll.c (unroll_loop, copy_loop_body, loop_iterations): Remove references to removed notes and fields. (subtract_reg_term, ujump_to_loop_cont): Remove. From-SVN: r86544
2004-08-25 11:52:54 +02:00
initlist = tree_cons (NULL_TREE, build_int_cst (NULL_TREE, 0), initlist);
/* subclass_list = */
tree.h (build_int_cst): New, sign extended constant. * tree.h (build_int_cst): New, sign extended constant. (build_int_cstu): New, zero extended constant. (build_int_cst_wide): Renamed from build_int_cst. * tree.c (build_int_cst, build_int_cstu): New. (build_int_cst_wide): Renamed from build_int_cst. (make_vector_type, build_common_tree_nodes, build_common_tree_nodes_2): Adjust build_int_cst calls. * builtins.c (expand_builtin_prefetch, expand_builtin_strstr, expand_builtin_strpbrk, expand_builtin_fputs, build_string_literal, expand_builtin_printf, expand_builtin_sprintf, fold_builtin_classify_type, fold_builtin_lround, fold_builtin_bitop, fold_builtin_isascii, fold_builtin_toascii, fold_builtin_isdigit, simplify_builtin_strstr, simplify_builtin_strpbrk, fold_builtin_fputs, simplify_builtin_sprintf): Likewise. * c-common.c (start_fname_decls, fix_string_type, shorten_compare, DEF_ATTR_INT): Likewise. * c-decl.c (complete_array_type, check_bitfield_type_and_width): Likewise. * c-lex.c (interpret_integer, lex_charconst): Likewise. * c-parse.in (primary) <TYPES_COMPATIBLE_P> Likewise. * c-pretty-print.c (pp_c_integer_constant): Likewise. * c-typeck.c (really_start_incremental_init, push_init_level, set_nonincremental_init_from_string): Likewise. * calls.c (load_register_parameters): Likewise. convert.c (convert_to_pointer): Likewise. coverage.c (coverage_counter_alloc, tree_coverage_counter_ref, build_fn_info_type, build_fn_info_value, build_ctr_info_value, build_gcov_info): Likewise. * except.c (init_eh, assign_filter_values): Likewise. * expmed.c (store_fixed_bit_field, extract_bit_field, extract_fixed_bit_field, extract_split_bit_field, expand_shift, expand_mult_const, expand_mult_highpart_adjust, extract_high_half, expand_sdiv_pow2, expand_divmod, make_tree): Likewise. * expr.c (convert_move, emit_group_load, emit_group_store, expand_assignment, store_constructor, store_field, expand_expr_real_1, reduce_to_bit_field_precision): Likewise. fold-const.c (force_fit_type, int_const_binop, fold_convert_const, invert_truthvalue, optimize_bit_field_compare, decode_field_reference, all_ones_mask_p, constant_boolean_node, fold_div_compare, fold, fold_read_from_constant_string, fold_negate_const, fold_abs_const, fold_not_const, round_up, round_down): Likewise. * function.c (assign_parm_setup_block): Likewise. * stmt.c (shift_return_value, expand_case, estimate_case_costs): Likewise. * stor-layout.c (layout_type, initialize_sizetypes, set_min_and_max_values_for_integral_type): Likewise. * tree-chrec.c (chrec_fold_multiply_poly_poly, reset_evolution_in_loop): Likewise. * tree-chrec.h (build_polynomial_chrec): Likewise. * tree-complex.c (build_replicated_const): Likewise. * tree-eh.c (honor_protect_cleanup_actions, lower_try_finally_onedest, lower_try_finally_copy, lower_try_finally_switch): Likewise. * tree-mudflap.c (mf_build_string, mx_register_decls, mudflap_register_call, mudflap_enqueue_constant): Likewise. * tree-nested.c (get_trampoline_type, get_nl_goto_field): Likewise. * tree-pretty-print.c (dump_generic_node): Likewise. * tree-ssa-ccp.c (widen_bitfield, maybe_fold_offset_to_array_ref): Likewise. * tree-ssa-dom.c (simplify_rhs_and_lookup_avail_expr): Likewise. * tree-ssa-loop-niter.c (number_of_iterations_cond, loop_niter_by_eval, upper_bound_in_type, lower_bound_in_type): Likewise. * tree-ssa-loop-ivcanon.c (create_canonical_iv, canonicalize_loop_induction_variables): Likewise. * tree-vectorizer.c (vect_create_index_for_array_ref, vect_transform_loop_bound, vect_compute_data_ref_alignment): Likewise. * config/alpha/alpha.c (alpha_initialize_trampoline, alpha_va_start, alpha_gimplify_va_arg_1): Likewise. * config/arm/arm.c (arm_get_cookie_size): Likewise. * config/c4x/c4x.c (c4x_gimplify_va_arg_expr): Likewise. * config/i386/i386.c (ix86_va_start, ix86_gimplify_va_arg): Likewise. * config/ia64/ia64.c (ia64_gimplify_va_arg): Likewise. * config/mips/mips.c (mips_build_builtin_va_list, mips_va_start, mips_gimplify_va_arg_expr): Likewise. * config/pa/pa.c (hppa_gimplify_va_arg_expr): Likewise. * config/rs6000/rs6000.c (rs6000_va_start, rs6000_gimplify_va_arg, add_compiler_branch_island): Likewise. * config/s390/s390.c (s390_va_start): Likewise. * config/sh/sh.c (sh_va_start): Likewise. * config/stormy16/stormy16.c (xstormy16_expand_builtin_va_start): Likewise. * config/xtensa/xtensa.c (xtensa_va_start, xtensa_gimplify_va_arg_expr): Likewise. * objc/objc-act.c (build_objc_string_object, build_objc_symtab_template, init_def_list, init_objc_symtab, init_module_descriptor, generate_static_references, build_selector_translation_table, get_proto_encoding, build_typed_selector_reference, build_selector_reference, build_next_objc_exception_stuff, build_method_prototype_list_template, generate_descriptor_table, generate_protocols, build_protocol_initializer, build_ivar_list_template, build_method_list_template, build_ivar_list_initializer, generate_ivars_list, generate_dispatch_table, generate_protocol_list, build_category_initializer, build_shared_structure_initializer, generate_shared_structures, handle_impent, generate_objc_image_info): Likewise. 2004-04-25 Paolo Bonzini <bonzini@gnu.org> * cfglayout.c (duplicate_insn_chain): Remove references to NOTE_INSN_LOOP_VTOP and NOTE_INSN_LOOP_CONT. * cfgloop.h (struct loop): Remove fields vtop, cont and cont_dominator. * cfgrtl.c (rtl_delete_block): Remove handling of NOTE_INSN_LOOP_CONT. * final.c (final_scan_insn): Remove references to NOTE_INSN_LOOP_VTOP and NOTE_INSN_LOOP_CONT. * insn-notes.def (NOTE_INSN_LOOP_VTOP, NOTE_INSN_LOOP_CONT): Remove. * jump.c (squeeze_notes): Remove references to NOTE_INSN_LOOP_VTOP and NOTE_INSN_LOOP_CONT. * loop.c (scan_loops, find_and_verify_loops, for_each_insn_in_loop, check_dbra_loop, loop_dump_aux): Remove references to removed notes and fields. * reorg.c (mostly_true_jump): Do not rely on NOTE_INSN_LOOP_VTOPs. * unroll.c (unroll_loop, copy_loop_body, loop_iterations): Remove references to removed notes and fields. (subtract_reg_term, ujump_to_loop_cont): Remove. From-SVN: r86544
2004-08-25 11:52:54 +02:00
initlist = tree_cons (NULL_TREE, build_int_cst (NULL_TREE, 0), initlist);
/* sibling_class = */
tree.h (build_int_cst): New, sign extended constant. * tree.h (build_int_cst): New, sign extended constant. (build_int_cstu): New, zero extended constant. (build_int_cst_wide): Renamed from build_int_cst. * tree.c (build_int_cst, build_int_cstu): New. (build_int_cst_wide): Renamed from build_int_cst. (make_vector_type, build_common_tree_nodes, build_common_tree_nodes_2): Adjust build_int_cst calls. * builtins.c (expand_builtin_prefetch, expand_builtin_strstr, expand_builtin_strpbrk, expand_builtin_fputs, build_string_literal, expand_builtin_printf, expand_builtin_sprintf, fold_builtin_classify_type, fold_builtin_lround, fold_builtin_bitop, fold_builtin_isascii, fold_builtin_toascii, fold_builtin_isdigit, simplify_builtin_strstr, simplify_builtin_strpbrk, fold_builtin_fputs, simplify_builtin_sprintf): Likewise. * c-common.c (start_fname_decls, fix_string_type, shorten_compare, DEF_ATTR_INT): Likewise. * c-decl.c (complete_array_type, check_bitfield_type_and_width): Likewise. * c-lex.c (interpret_integer, lex_charconst): Likewise. * c-parse.in (primary) <TYPES_COMPATIBLE_P> Likewise. * c-pretty-print.c (pp_c_integer_constant): Likewise. * c-typeck.c (really_start_incremental_init, push_init_level, set_nonincremental_init_from_string): Likewise. * calls.c (load_register_parameters): Likewise. convert.c (convert_to_pointer): Likewise. coverage.c (coverage_counter_alloc, tree_coverage_counter_ref, build_fn_info_type, build_fn_info_value, build_ctr_info_value, build_gcov_info): Likewise. * except.c (init_eh, assign_filter_values): Likewise. * expmed.c (store_fixed_bit_field, extract_bit_field, extract_fixed_bit_field, extract_split_bit_field, expand_shift, expand_mult_const, expand_mult_highpart_adjust, extract_high_half, expand_sdiv_pow2, expand_divmod, make_tree): Likewise. * expr.c (convert_move, emit_group_load, emit_group_store, expand_assignment, store_constructor, store_field, expand_expr_real_1, reduce_to_bit_field_precision): Likewise. fold-const.c (force_fit_type, int_const_binop, fold_convert_const, invert_truthvalue, optimize_bit_field_compare, decode_field_reference, all_ones_mask_p, constant_boolean_node, fold_div_compare, fold, fold_read_from_constant_string, fold_negate_const, fold_abs_const, fold_not_const, round_up, round_down): Likewise. * function.c (assign_parm_setup_block): Likewise. * stmt.c (shift_return_value, expand_case, estimate_case_costs): Likewise. * stor-layout.c (layout_type, initialize_sizetypes, set_min_and_max_values_for_integral_type): Likewise. * tree-chrec.c (chrec_fold_multiply_poly_poly, reset_evolution_in_loop): Likewise. * tree-chrec.h (build_polynomial_chrec): Likewise. * tree-complex.c (build_replicated_const): Likewise. * tree-eh.c (honor_protect_cleanup_actions, lower_try_finally_onedest, lower_try_finally_copy, lower_try_finally_switch): Likewise. * tree-mudflap.c (mf_build_string, mx_register_decls, mudflap_register_call, mudflap_enqueue_constant): Likewise. * tree-nested.c (get_trampoline_type, get_nl_goto_field): Likewise. * tree-pretty-print.c (dump_generic_node): Likewise. * tree-ssa-ccp.c (widen_bitfield, maybe_fold_offset_to_array_ref): Likewise. * tree-ssa-dom.c (simplify_rhs_and_lookup_avail_expr): Likewise. * tree-ssa-loop-niter.c (number_of_iterations_cond, loop_niter_by_eval, upper_bound_in_type, lower_bound_in_type): Likewise. * tree-ssa-loop-ivcanon.c (create_canonical_iv, canonicalize_loop_induction_variables): Likewise. * tree-vectorizer.c (vect_create_index_for_array_ref, vect_transform_loop_bound, vect_compute_data_ref_alignment): Likewise. * config/alpha/alpha.c (alpha_initialize_trampoline, alpha_va_start, alpha_gimplify_va_arg_1): Likewise. * config/arm/arm.c (arm_get_cookie_size): Likewise. * config/c4x/c4x.c (c4x_gimplify_va_arg_expr): Likewise. * config/i386/i386.c (ix86_va_start, ix86_gimplify_va_arg): Likewise. * config/ia64/ia64.c (ia64_gimplify_va_arg): Likewise. * config/mips/mips.c (mips_build_builtin_va_list, mips_va_start, mips_gimplify_va_arg_expr): Likewise. * config/pa/pa.c (hppa_gimplify_va_arg_expr): Likewise. * config/rs6000/rs6000.c (rs6000_va_start, rs6000_gimplify_va_arg, add_compiler_branch_island): Likewise. * config/s390/s390.c (s390_va_start): Likewise. * config/sh/sh.c (sh_va_start): Likewise. * config/stormy16/stormy16.c (xstormy16_expand_builtin_va_start): Likewise. * config/xtensa/xtensa.c (xtensa_va_start, xtensa_gimplify_va_arg_expr): Likewise. * objc/objc-act.c (build_objc_string_object, build_objc_symtab_template, init_def_list, init_objc_symtab, init_module_descriptor, generate_static_references, build_selector_translation_table, get_proto_encoding, build_typed_selector_reference, build_selector_reference, build_next_objc_exception_stuff, build_method_prototype_list_template, generate_descriptor_table, generate_protocols, build_protocol_initializer, build_ivar_list_template, build_method_list_template, build_ivar_list_initializer, generate_ivars_list, generate_dispatch_table, generate_protocol_list, build_category_initializer, build_shared_structure_initializer, generate_shared_structures, handle_impent, generate_objc_image_info): Likewise. 2004-04-25 Paolo Bonzini <bonzini@gnu.org> * cfglayout.c (duplicate_insn_chain): Remove references to NOTE_INSN_LOOP_VTOP and NOTE_INSN_LOOP_CONT. * cfgloop.h (struct loop): Remove fields vtop, cont and cont_dominator. * cfgrtl.c (rtl_delete_block): Remove handling of NOTE_INSN_LOOP_CONT. * final.c (final_scan_insn): Remove references to NOTE_INSN_LOOP_VTOP and NOTE_INSN_LOOP_CONT. * insn-notes.def (NOTE_INSN_LOOP_VTOP, NOTE_INSN_LOOP_CONT): Remove. * jump.c (squeeze_notes): Remove references to NOTE_INSN_LOOP_VTOP and NOTE_INSN_LOOP_CONT. * loop.c (scan_loops, find_and_verify_loops, for_each_insn_in_loop, check_dbra_loop, loop_dump_aux): Remove references to removed notes and fields. * reorg.c (mostly_true_jump): Do not rely on NOTE_INSN_LOOP_VTOPs. * unroll.c (unroll_loop, copy_loop_body, loop_iterations): Remove references to removed notes and fields. (subtract_reg_term, ujump_to_loop_cont): Remove. From-SVN: r86544
2004-08-25 11:52:54 +02:00
initlist = tree_cons (NULL_TREE, build_int_cst (NULL_TREE, 0), initlist);
}
/* protocol_list = */
if (! protocol_list)
tree.h (build_int_cst): New, sign extended constant. * tree.h (build_int_cst): New, sign extended constant. (build_int_cstu): New, zero extended constant. (build_int_cst_wide): Renamed from build_int_cst. * tree.c (build_int_cst, build_int_cstu): New. (build_int_cst_wide): Renamed from build_int_cst. (make_vector_type, build_common_tree_nodes, build_common_tree_nodes_2): Adjust build_int_cst calls. * builtins.c (expand_builtin_prefetch, expand_builtin_strstr, expand_builtin_strpbrk, expand_builtin_fputs, build_string_literal, expand_builtin_printf, expand_builtin_sprintf, fold_builtin_classify_type, fold_builtin_lround, fold_builtin_bitop, fold_builtin_isascii, fold_builtin_toascii, fold_builtin_isdigit, simplify_builtin_strstr, simplify_builtin_strpbrk, fold_builtin_fputs, simplify_builtin_sprintf): Likewise. * c-common.c (start_fname_decls, fix_string_type, shorten_compare, DEF_ATTR_INT): Likewise. * c-decl.c (complete_array_type, check_bitfield_type_and_width): Likewise. * c-lex.c (interpret_integer, lex_charconst): Likewise. * c-parse.in (primary) <TYPES_COMPATIBLE_P> Likewise. * c-pretty-print.c (pp_c_integer_constant): Likewise. * c-typeck.c (really_start_incremental_init, push_init_level, set_nonincremental_init_from_string): Likewise. * calls.c (load_register_parameters): Likewise. convert.c (convert_to_pointer): Likewise. coverage.c (coverage_counter_alloc, tree_coverage_counter_ref, build_fn_info_type, build_fn_info_value, build_ctr_info_value, build_gcov_info): Likewise. * except.c (init_eh, assign_filter_values): Likewise. * expmed.c (store_fixed_bit_field, extract_bit_field, extract_fixed_bit_field, extract_split_bit_field, expand_shift, expand_mult_const, expand_mult_highpart_adjust, extract_high_half, expand_sdiv_pow2, expand_divmod, make_tree): Likewise. * expr.c (convert_move, emit_group_load, emit_group_store, expand_assignment, store_constructor, store_field, expand_expr_real_1, reduce_to_bit_field_precision): Likewise. fold-const.c (force_fit_type, int_const_binop, fold_convert_const, invert_truthvalue, optimize_bit_field_compare, decode_field_reference, all_ones_mask_p, constant_boolean_node, fold_div_compare, fold, fold_read_from_constant_string, fold_negate_const, fold_abs_const, fold_not_const, round_up, round_down): Likewise. * function.c (assign_parm_setup_block): Likewise. * stmt.c (shift_return_value, expand_case, estimate_case_costs): Likewise. * stor-layout.c (layout_type, initialize_sizetypes, set_min_and_max_values_for_integral_type): Likewise. * tree-chrec.c (chrec_fold_multiply_poly_poly, reset_evolution_in_loop): Likewise. * tree-chrec.h (build_polynomial_chrec): Likewise. * tree-complex.c (build_replicated_const): Likewise. * tree-eh.c (honor_protect_cleanup_actions, lower_try_finally_onedest, lower_try_finally_copy, lower_try_finally_switch): Likewise. * tree-mudflap.c (mf_build_string, mx_register_decls, mudflap_register_call, mudflap_enqueue_constant): Likewise. * tree-nested.c (get_trampoline_type, get_nl_goto_field): Likewise. * tree-pretty-print.c (dump_generic_node): Likewise. * tree-ssa-ccp.c (widen_bitfield, maybe_fold_offset_to_array_ref): Likewise. * tree-ssa-dom.c (simplify_rhs_and_lookup_avail_expr): Likewise. * tree-ssa-loop-niter.c (number_of_iterations_cond, loop_niter_by_eval, upper_bound_in_type, lower_bound_in_type): Likewise. * tree-ssa-loop-ivcanon.c (create_canonical_iv, canonicalize_loop_induction_variables): Likewise. * tree-vectorizer.c (vect_create_index_for_array_ref, vect_transform_loop_bound, vect_compute_data_ref_alignment): Likewise. * config/alpha/alpha.c (alpha_initialize_trampoline, alpha_va_start, alpha_gimplify_va_arg_1): Likewise. * config/arm/arm.c (arm_get_cookie_size): Likewise. * config/c4x/c4x.c (c4x_gimplify_va_arg_expr): Likewise. * config/i386/i386.c (ix86_va_start, ix86_gimplify_va_arg): Likewise. * config/ia64/ia64.c (ia64_gimplify_va_arg): Likewise. * config/mips/mips.c (mips_build_builtin_va_list, mips_va_start, mips_gimplify_va_arg_expr): Likewise. * config/pa/pa.c (hppa_gimplify_va_arg_expr): Likewise. * config/rs6000/rs6000.c (rs6000_va_start, rs6000_gimplify_va_arg, add_compiler_branch_island): Likewise. * config/s390/s390.c (s390_va_start): Likewise. * config/sh/sh.c (sh_va_start): Likewise. * config/stormy16/stormy16.c (xstormy16_expand_builtin_va_start): Likewise. * config/xtensa/xtensa.c (xtensa_va_start, xtensa_gimplify_va_arg_expr): Likewise. * objc/objc-act.c (build_objc_string_object, build_objc_symtab_template, init_def_list, init_objc_symtab, init_module_descriptor, generate_static_references, build_selector_translation_table, get_proto_encoding, build_typed_selector_reference, build_selector_reference, build_next_objc_exception_stuff, build_method_prototype_list_template, generate_descriptor_table, generate_protocols, build_protocol_initializer, build_ivar_list_template, build_method_list_template, build_ivar_list_initializer, generate_ivars_list, generate_dispatch_table, generate_protocol_list, build_category_initializer, build_shared_structure_initializer, generate_shared_structures, handle_impent, generate_objc_image_info): Likewise. 2004-04-25 Paolo Bonzini <bonzini@gnu.org> * cfglayout.c (duplicate_insn_chain): Remove references to NOTE_INSN_LOOP_VTOP and NOTE_INSN_LOOP_CONT. * cfgloop.h (struct loop): Remove fields vtop, cont and cont_dominator. * cfgrtl.c (rtl_delete_block): Remove handling of NOTE_INSN_LOOP_CONT. * final.c (final_scan_insn): Remove references to NOTE_INSN_LOOP_VTOP and NOTE_INSN_LOOP_CONT. * insn-notes.def (NOTE_INSN_LOOP_VTOP, NOTE_INSN_LOOP_CONT): Remove. * jump.c (squeeze_notes): Remove references to NOTE_INSN_LOOP_VTOP and NOTE_INSN_LOOP_CONT. * loop.c (scan_loops, find_and_verify_loops, for_each_insn_in_loop, check_dbra_loop, loop_dump_aux): Remove references to removed notes and fields. * reorg.c (mostly_true_jump): Do not rely on NOTE_INSN_LOOP_VTOPs. * unroll.c (unroll_loop, copy_loop_body, loop_iterations): Remove references to removed notes and fields. (subtract_reg_term, ujump_to_loop_cont): Remove. From-SVN: r86544
2004-08-25 11:52:54 +02:00
initlist = tree_cons (NULL_TREE, build_int_cst (NULL_TREE, 0), initlist);
else
Makefile.in (c-parse.o): Depend on $(C_COMMON_H). [gcc/ChangeLog] 2004-09-07 Ziemowit Laski <zlaski@apple.com> * Makefile.in (c-parse.o): Depend on $(C_COMMON_H). * c-parse.in: Include c-common.h instead of objc-act.h. (ivar_decl_list, ivar_decls, ivar_decl, ivars, ivar_declarator, myparms, myparm): Remove %type declarations. (methodtype, optparms, OBJC_TYPE_QUAL, objc_quals, objc_qual, objc_typename, objc_try_catch_stmt, optellipsis): Add %type declarations. (objc_inherit_code, objc_public_flag): Remove. (typespec_nonreserved_nonattr): Call objc_get_protocol_qualified_type() instead of get_static_reference() and get_protocol_reference(). (stmt_nocomp): Call grokparm() on @catch parameter. (objcdef): Move semantic action to objc_finish_implementation(). (classdef): Move semantic action to objc_start_class_interface(), objc_continue_interface(), objc_finish_interface(), objc_start_class_implementation(), objc_continue_implementation(), objc_start_category_interface() and objc_start_category_implementation(). (protocoldef): Move semantic actions to objc_start_protocol() and objc_finish_interface(). (ivar_decl_list): Remove nonterminal. (visibility_spec): Move semantic actions to objc_set_visibility(). (ivar_decls): Remove assignment to $$. (ivar_decl): Rephrase in terms of component_decl; call objc_add_instance_variable(). (ivars, ivar_declarator): Remove nonterminals. (opt_semi): New nonterminal. (methodtype): Remove semantic actions. (methoddef): Move semantic actions to objc_set_method_type(), objc_start_method_definition() and objc_finish_method_definition(). (methodproto): Move semantic actions to objc_set_method_type() and objc_add_method_declaration(). (methoddecl): Use objc_typename instead of typename; move semantic actions to objc_build_method_signature(). (optarglist, myxdecls, mydecl, myparms, myparm): Remove nonterminals. (optparmlist): Express in terms of optparms and optellipsis. (optparms, optellipsis, objc_qual, objc_quals, objc_typename): New nonterminals. (keyworddecl): Use objc_typename instead of typename. (rid_to_yy): Mark RID_IN, RID_OUT, RID_INOUT, RID_BYCOPY, RID_BYREF and RID_ONEWAY as returning OBJC_TYPE_QUAL to yyparse(). [gcc/objc/ChangeLog] 2004-09-07 Ziemowit Laski <zlaski@apple.com> * Make-lang.in (objc/objc-parse.o): Depend on $(C_COMMON_H) instead of objc/objc-act.h. (objc/objc-act.o): Depend on $(HASHTAB_H). * objc-act.c: Include hashtab.h; in ObjC++ mode, include cp-tree.h and objcp-decl.h instead of c-tree.h. (build_module_descriptor, get_class_ivars, synth_id_with_class_suffix, error_with_ivar, gen_method_decl, gen_declaration, setup_string_decl, build_protocol_template): Adjust prototypes. (build_module_initializer_routine, start_class, continue_class, finish_class, start_method_def, objc_start_function, start_protocol, build_method_decl, objc_add_method, add_instance_variable, build_ivar_reference, is_ivar, is_private, get_super_receiver, build_selector_table_decl, objc_push_parm, objc_get_parm_info, gen_type_name, gen_type_name_0, start_var_decl, finish_var_decl, create_field_decl): New prototypes. (objc_expand_function_end, comp_method_with_proto, objc_expr_last, gen_declaration_1, gen_declarator, is_complex_decl, adorn_decl, define_decl, create_builtin_decl, gen_declspecs): Remove prototypes. (TYPE_ID): Rename to OBJECT_TYPEDEF_NAME. (CLASS_TYPEDEF_NAME): New. (TAG_EXECCLASS): Change from a global variable to a #define. (TAG_RETURN_STRUCT): Delete. (TAG_GNUINIT): New, holds '__objc_gnu_init' name. (objc_inherit_code, objc_public_flag): New, moved from c-parse.in. (string_descriptor): New struct. (string_htab): New hash table. (string_hash, string_eq): New prototypes. (generate_struct_by_value_array): Call create_field_decl() instead of create_builtin_decl(). (objc_init): Do not initialize objc_ellipsis_node or TAG_EXECCLASS; In ObjC++ mode, call cxx_init() instead of c_objc_common_init(). (objc_finish_file): In ObjC++, call instantiate_pending_templates() and cp_finish_file(). (define_decl, get_static_reference, get_protocol_reference, create_builtin_decl): Remove functions. (objc_start_class_interface, objc_start_category_interface, objc_start_protocol, objc_continue_interface, objc_finish_interface, objc_start_class_implementation, objc_start_category_implementation, objc_continue_implementation, objc_finish_implementation, objc_set_visibility, objc_set_method_type, objc_build_method_signature, objc_add_method_declaration, objc_start_method_definition, objc_add_instance_variable, objc_get_protocol_qualified_type, create_field_decl, start_var_decl, finish_var_decl): New functions. (setup_string_decl): Simplify since it is only called once. (synth_module_prologue): Call build_class_template(); predefine 'id' and 'Class' as typedefs; rename 'temp_type' to 'type'; disable debug hooks for duration of function; fix GNU runtime messenger signatures to correspond to reality; forward-declare '__objc_exec_class' for the GNU runtime; call build_selector_table_decl(); in ObjC++ mode, generate 'extern "C" { ... }' wrappers around synthesized declarations; call build_protocol_template() and build_category_template(). (string_hash, string_eq): New functions. (objc_build_string_object): Check metaclass correctness only once; store string literals in hash table. (objc_build_constructor): Do not convert initializer elements; adjust for ObjC++ impedance mismatch. (build_objc_symtab_template): Call create_field_decl() instead of create_builtin_decl(). (init_objc_symtab): Add missing conversion to initializer element. (build_metadata_decl): Call start_var_decl() instead of define_decl(). (generate_objc_symtab_decl): Do not call build_category_template(); call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(). (build_module_descriptor): Call create_field_decl() instead of grokfield(); call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(); always mark module descriptor as used; move GNU runtime-specific functionality to build_module_initializer_routine(). (build_module_initializer_routine): New function, broken off of build_module_descriptor(). (objc_static_init_needed_p, objc_generate_static_init_call): New functions. (generate_static_references, generate_strings, build_selector_translation_table, generate_descriptor_table, generate_ivars_list, generate_dispatch_table, generate_category): Call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(); build a type directly instead of via groktypename(). (build_selector_reference_decl, build_selector_table_decl, build_class_reference_decl, build_protocol_reference, generate_objc_image_info): Call start_var_decl() instead of build_decl(). (build_selector_reference): For GNU runtime, do not call build_selector_reference_decl(). (build_selector, build_typed_selector_reference): Always convert result to the selector type. (add_objc_string): Cast return value to 'char *'. (build_method_prototype_template, build_selector_template, build_method_template): Use actual selector type for fields pointing to selectors. (finish_objc): For GNU runtime, call build_module_initializer_routine() after build_module_descriptor(). (generate_protocol_list, generate_shared_structures): Call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(); build a type directly instead of via groktypename(). (synth_id_with_class_suffix): Return a string. (get_arg_type_list): For instance methods, use the instance type for 'self'; do not call groktypename_in_parm_context(). (build_objc_string_decl): Squash redeclaration errors in ObjC++. (objc_is_class_name): Use OBJC_TYPE_NAME instead of TYPE_NAME; handle RECORD_TYPEs in ObjC as well as ObjC++. (objc_is_id): New function. (objc_is_object_ptr): Return the canonical type node. (objc_get_class_ivars): Simplify using get_class_ivars(). (get_class_ivars): Remove second parameter; create a fresh copy of the ivar list for each call; do not check for existence of super class. (objc_eh_runtime_type): Mark #ifndef OBJCPLUS. (objc_init_exceptions): When using SJLJ-style exceptions, require the use of '-fobjc-exceptions' flag; do not require it for DWARF-style exceptions. (objc_build_exc_ptr, next_sjlj_build_try_catch_finally): Use objc_object_type instead of objc_id_type. (objc_begin_catch_clause): Convert the incoming PARM_DECL into a VAR_DECL before placing it in the appropriate scope; do not call define_decl(); adjust call to c_begin_compound_stmt(); use objc_object_type instead of objc_id_type. (build_next_objc_exception_stuff): Call create_field_decl() instead of create_builtin_decl(); construct type directly instead of calling groktypename(); use OBJC_VOID_AT_END to mark end of function parameters. (build_private_template): Adjust call to get_class_ivars(); build a type directly instead of via groktypename(). (build_protocol_template, build_method_prototype_list_template, build_method_prototype_template, build_category_template, build_selector_template, build_class_template, build_super_template, build_ivar_template, build_ivar_list_template, build_method_list_template, build_method_template): Call create_field_decl() instead of grokfield(). (objc_method_parm_type): Do not call groktypename(). (generate_descriptor_table): Call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(). (generate_method_descriptors, build_protocol_initializer, generate_dispatch_tables, build_category_initializer, build_shared_structure_initializer): Do not call groktypename(). (generate_protocols): Call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(); do not call groktypename(). (error_with_ivar): Remove last parameter. (check_ivars): Do not iterate ovar CLASS_RAW_IVARS lists in addition to CLASS_IVARS lists; adjust calls to error_with_ivar(). (generate_ivar_lists): Convert one of the initializer elements; do not call groktypename(). (get_arg_type_list, start_method_def, gen_method_def): Account for new representation of variable arguments and '...' in Objective-C methods; add Objective-C++ impedance matching code. (is_objc_type_qualifier): Remove function. (adjust_type_for_id_default): Simplify; there is no longer a need to wade through declspecs. (lookup_interface, start_class, continue_class, finish_class, start_method_def, start_protocol, build_method_decl, objc_add_method, add_instance_variable, build_ivar_reference, is_ivar, is_private, get_super_receiver, objc_build_finally_epilogue): Make into static functions. (receiver_is_class_object): Use new IS_CLASS() macro. (objc_build_message_expr): Tweak ObjC++ message argument handling; call objc_finish_message_expr() instead of finish_message_expr(). (finish_message_expr): Rename to objc_finish_message_expr(); use OBJC_TYPE_NAME and OBJC_SET_TYPE_NAME macros instead of TYPE_NAME. call gen_type_name() instead of gen_declaration(); call objc_is_id() instead of using IS_ID and IS_CLASS; Use objc_class_name instead of calling get_identifier("Class"); handle CONVERT_EXPRs in receiver. (build_objc_method_call, warn_with_method): Do not call groktypename(). (build_ivar_reference): Call convert() instead of clobbering in a type. (hash_init): Initialize string_htab hash table. (add_instance_variable): Simplify parameter list; do not call grokfield(); do not populate CLASS_IVARS list. (start_class): Check for the existence of super class, if one was specified. (continue_class): Use CLASS_RAW_IVARS rather than CLASS_IVARS; do not call build_class_template(); adjust call to get_class_ivars(); call build_decl(), pushdecl() and finish_decl() instead of define_decl(). (finish_class): Call build_decl(), pushdecl() and finish_decl() instead of define_decl(). (add_protocols): Use PROTOCOL_BINFO_ELTS for the tree vector size. (start_protocol): Do not call build_protocol_template(); use PROTOCOL_BINFO_ELTS for the tree vector size. (encode_type_qualifiers): Do not handle the 'const' qualifier here. (encode_pointer): Encode 'const char *' as 'r*', for backwards compatibility. (encode_array): Use HOST_WIDE_INT_PRINT_DEC instead of "%ld". (encode_type): Handle the 'const' qualifier here. (objc_parmlist): New global variable, sued by objc_push_parm and objc_get_parm_info(). (objc_push_parm, objc_get_parm_info): New functions. (objc_expr_last): Remove function. (synth_self_and_ucmd_args): For instance methods, use the instance type for 'self'; call objc_push_parm() instead of push_parm_decl(). (start_method_def): Do not call push_scope(), declare_parm_level(), pop_scope(), push_parm_decl(), store_parm_decls() or objc_expr_last(); just use objc_push_parm() and objc_get_parm_info(). (comp_method_with_proto): Remove function. (objc_types_are_equivalent): Strip away indirections before comparing underlying types. (comp_proto_with_proto): Do not call groktypename(); types are no longer in raw declspec format. (objc_start_function): New function. (really_start_method): Call comp_proto_with_proto() instead of comp_method_with_proto(); call objc_start_function() instead of hand-crafting a function declarator. (continue_method_def, objc_expand_function_end): Remove functions. (get_super_receiver): Call objc_get_current_scope() instead of get_current_scope(); reference 'super_class' field (instead of 'class'). (finish_method_def): Rename to objc_finish_method_definition() and add a function decl parameter; move method encoding call from objc_expand_function_end(). (is_complex_decl, adorn_decl, gen_declarator, gen_declspecs, gen_declaration_1): Remove functions. (tmpbuf, RAW_DECLSPEC): Remove. (gen_declaration): Remove second parameter; simplify to deal with TYPE_P nodes instead of raw declspecs. (gen_type_name, gen_type_name_0): New functions. (gen_method_decl): Remove second parameter; call gen_type_name() instead of gen_declaration_1(). (dump_interface): Adjust calls to gen_declaration() and gen_method_decl(); do not allocate a separate string buffer. (init_objc): Allocate a larger string buffer to accommodate dump_interface(); adjust call to build_module_descriptor(); add call to build_module_initializer_routine() for the GNU runtime. (generate_classref_translation_entry): Do not call start_decl(); call finish_var_decl() instead of finish_decl(); call convert() instead of build_c_cast(). * objc-act.h (CLASS_OWN_IVARS): Remove accessor. (CLASS_BINFO_ELTS): Reduce from 6 to 5, now that CLASS_OWN_IVARS is gone. (OCTI_GNU_INIT_DECL, GNU_INIT_decl): New. (OCTI_ELLIPSIS_NODE, objc_ellipsis_node): Remove. (OCTI_ID_ID, id_type, objc_id_id): Rename to OCTI_ID_NAME, objc_object_type and objc_object_name, respectively. (OCTI_CLS_REF, OCTI_CLASS_NAME, objc_class_reference, objc_class_name): New. (IS_CLASS): New macro. (IS_ID, IS_SUPER): Robustify. (OCTI_EXECCLASS_DECL, execclass_decl): New. (finish_file, start_class, continue_class, finish_class, start_method_def, continue_method_def, finish_method_def, start_protocol, finish_protocol, objc_build_throw_stmt, objc_build_try_catch_finally_stmt, objc_build_synchronized_prologue, objc_build_synchronized_epilogue, objc_build_try_prologue, objc_build_try_epilogue, objc_build_catch_stmt, objc_build_catch_epilogue, objc_build_finally_prologue, objc_build_finally_epilogue, is_ivar, is_private, is_public, add_instance_variable, objc_add_method, get_super_receiver, objc_clear_super_receiver, get_class_ivars_from_name, get_class_reference, get_static_reference, get_object_reference, build_message_expr, finish_message_expr, build_selector_expr, build_ivar_reference, build_keyword_decl, build_method_decl, build_protocol_expr, build_objc_string_object, objc_declare_alias, objc_declare_class, objc_declare_protocols, objc_comptypes, objc_check_decl, build_encode_expr): Remove prototypes. (imp_count, cat_count): Make GGC-aware. (OBJC_SET_TYPE_NAME): New macro. From-SVN: r87168
2004-09-08 02:49:44 +02:00
{
expr = convert (build_pointer_type
(build_pointer_type
Makefile.in (c-parse.o): Depend on $(C_COMMON_H). [gcc/ChangeLog] 2004-09-07 Ziemowit Laski <zlaski@apple.com> * Makefile.in (c-parse.o): Depend on $(C_COMMON_H). * c-parse.in: Include c-common.h instead of objc-act.h. (ivar_decl_list, ivar_decls, ivar_decl, ivars, ivar_declarator, myparms, myparm): Remove %type declarations. (methodtype, optparms, OBJC_TYPE_QUAL, objc_quals, objc_qual, objc_typename, objc_try_catch_stmt, optellipsis): Add %type declarations. (objc_inherit_code, objc_public_flag): Remove. (typespec_nonreserved_nonattr): Call objc_get_protocol_qualified_type() instead of get_static_reference() and get_protocol_reference(). (stmt_nocomp): Call grokparm() on @catch parameter. (objcdef): Move semantic action to objc_finish_implementation(). (classdef): Move semantic action to objc_start_class_interface(), objc_continue_interface(), objc_finish_interface(), objc_start_class_implementation(), objc_continue_implementation(), objc_start_category_interface() and objc_start_category_implementation(). (protocoldef): Move semantic actions to objc_start_protocol() and objc_finish_interface(). (ivar_decl_list): Remove nonterminal. (visibility_spec): Move semantic actions to objc_set_visibility(). (ivar_decls): Remove assignment to $$. (ivar_decl): Rephrase in terms of component_decl; call objc_add_instance_variable(). (ivars, ivar_declarator): Remove nonterminals. (opt_semi): New nonterminal. (methodtype): Remove semantic actions. (methoddef): Move semantic actions to objc_set_method_type(), objc_start_method_definition() and objc_finish_method_definition(). (methodproto): Move semantic actions to objc_set_method_type() and objc_add_method_declaration(). (methoddecl): Use objc_typename instead of typename; move semantic actions to objc_build_method_signature(). (optarglist, myxdecls, mydecl, myparms, myparm): Remove nonterminals. (optparmlist): Express in terms of optparms and optellipsis. (optparms, optellipsis, objc_qual, objc_quals, objc_typename): New nonterminals. (keyworddecl): Use objc_typename instead of typename. (rid_to_yy): Mark RID_IN, RID_OUT, RID_INOUT, RID_BYCOPY, RID_BYREF and RID_ONEWAY as returning OBJC_TYPE_QUAL to yyparse(). [gcc/objc/ChangeLog] 2004-09-07 Ziemowit Laski <zlaski@apple.com> * Make-lang.in (objc/objc-parse.o): Depend on $(C_COMMON_H) instead of objc/objc-act.h. (objc/objc-act.o): Depend on $(HASHTAB_H). * objc-act.c: Include hashtab.h; in ObjC++ mode, include cp-tree.h and objcp-decl.h instead of c-tree.h. (build_module_descriptor, get_class_ivars, synth_id_with_class_suffix, error_with_ivar, gen_method_decl, gen_declaration, setup_string_decl, build_protocol_template): Adjust prototypes. (build_module_initializer_routine, start_class, continue_class, finish_class, start_method_def, objc_start_function, start_protocol, build_method_decl, objc_add_method, add_instance_variable, build_ivar_reference, is_ivar, is_private, get_super_receiver, build_selector_table_decl, objc_push_parm, objc_get_parm_info, gen_type_name, gen_type_name_0, start_var_decl, finish_var_decl, create_field_decl): New prototypes. (objc_expand_function_end, comp_method_with_proto, objc_expr_last, gen_declaration_1, gen_declarator, is_complex_decl, adorn_decl, define_decl, create_builtin_decl, gen_declspecs): Remove prototypes. (TYPE_ID): Rename to OBJECT_TYPEDEF_NAME. (CLASS_TYPEDEF_NAME): New. (TAG_EXECCLASS): Change from a global variable to a #define. (TAG_RETURN_STRUCT): Delete. (TAG_GNUINIT): New, holds '__objc_gnu_init' name. (objc_inherit_code, objc_public_flag): New, moved from c-parse.in. (string_descriptor): New struct. (string_htab): New hash table. (string_hash, string_eq): New prototypes. (generate_struct_by_value_array): Call create_field_decl() instead of create_builtin_decl(). (objc_init): Do not initialize objc_ellipsis_node or TAG_EXECCLASS; In ObjC++ mode, call cxx_init() instead of c_objc_common_init(). (objc_finish_file): In ObjC++, call instantiate_pending_templates() and cp_finish_file(). (define_decl, get_static_reference, get_protocol_reference, create_builtin_decl): Remove functions. (objc_start_class_interface, objc_start_category_interface, objc_start_protocol, objc_continue_interface, objc_finish_interface, objc_start_class_implementation, objc_start_category_implementation, objc_continue_implementation, objc_finish_implementation, objc_set_visibility, objc_set_method_type, objc_build_method_signature, objc_add_method_declaration, objc_start_method_definition, objc_add_instance_variable, objc_get_protocol_qualified_type, create_field_decl, start_var_decl, finish_var_decl): New functions. (setup_string_decl): Simplify since it is only called once. (synth_module_prologue): Call build_class_template(); predefine 'id' and 'Class' as typedefs; rename 'temp_type' to 'type'; disable debug hooks for duration of function; fix GNU runtime messenger signatures to correspond to reality; forward-declare '__objc_exec_class' for the GNU runtime; call build_selector_table_decl(); in ObjC++ mode, generate 'extern "C" { ... }' wrappers around synthesized declarations; call build_protocol_template() and build_category_template(). (string_hash, string_eq): New functions. (objc_build_string_object): Check metaclass correctness only once; store string literals in hash table. (objc_build_constructor): Do not convert initializer elements; adjust for ObjC++ impedance mismatch. (build_objc_symtab_template): Call create_field_decl() instead of create_builtin_decl(). (init_objc_symtab): Add missing conversion to initializer element. (build_metadata_decl): Call start_var_decl() instead of define_decl(). (generate_objc_symtab_decl): Do not call build_category_template(); call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(). (build_module_descriptor): Call create_field_decl() instead of grokfield(); call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(); always mark module descriptor as used; move GNU runtime-specific functionality to build_module_initializer_routine(). (build_module_initializer_routine): New function, broken off of build_module_descriptor(). (objc_static_init_needed_p, objc_generate_static_init_call): New functions. (generate_static_references, generate_strings, build_selector_translation_table, generate_descriptor_table, generate_ivars_list, generate_dispatch_table, generate_category): Call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(); build a type directly instead of via groktypename(). (build_selector_reference_decl, build_selector_table_decl, build_class_reference_decl, build_protocol_reference, generate_objc_image_info): Call start_var_decl() instead of build_decl(). (build_selector_reference): For GNU runtime, do not call build_selector_reference_decl(). (build_selector, build_typed_selector_reference): Always convert result to the selector type. (add_objc_string): Cast return value to 'char *'. (build_method_prototype_template, build_selector_template, build_method_template): Use actual selector type for fields pointing to selectors. (finish_objc): For GNU runtime, call build_module_initializer_routine() after build_module_descriptor(). (generate_protocol_list, generate_shared_structures): Call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(); build a type directly instead of via groktypename(). (synth_id_with_class_suffix): Return a string. (get_arg_type_list): For instance methods, use the instance type for 'self'; do not call groktypename_in_parm_context(). (build_objc_string_decl): Squash redeclaration errors in ObjC++. (objc_is_class_name): Use OBJC_TYPE_NAME instead of TYPE_NAME; handle RECORD_TYPEs in ObjC as well as ObjC++. (objc_is_id): New function. (objc_is_object_ptr): Return the canonical type node. (objc_get_class_ivars): Simplify using get_class_ivars(). (get_class_ivars): Remove second parameter; create a fresh copy of the ivar list for each call; do not check for existence of super class. (objc_eh_runtime_type): Mark #ifndef OBJCPLUS. (objc_init_exceptions): When using SJLJ-style exceptions, require the use of '-fobjc-exceptions' flag; do not require it for DWARF-style exceptions. (objc_build_exc_ptr, next_sjlj_build_try_catch_finally): Use objc_object_type instead of objc_id_type. (objc_begin_catch_clause): Convert the incoming PARM_DECL into a VAR_DECL before placing it in the appropriate scope; do not call define_decl(); adjust call to c_begin_compound_stmt(); use objc_object_type instead of objc_id_type. (build_next_objc_exception_stuff): Call create_field_decl() instead of create_builtin_decl(); construct type directly instead of calling groktypename(); use OBJC_VOID_AT_END to mark end of function parameters. (build_private_template): Adjust call to get_class_ivars(); build a type directly instead of via groktypename(). (build_protocol_template, build_method_prototype_list_template, build_method_prototype_template, build_category_template, build_selector_template, build_class_template, build_super_template, build_ivar_template, build_ivar_list_template, build_method_list_template, build_method_template): Call create_field_decl() instead of grokfield(). (objc_method_parm_type): Do not call groktypename(). (generate_descriptor_table): Call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(). (generate_method_descriptors, build_protocol_initializer, generate_dispatch_tables, build_category_initializer, build_shared_structure_initializer): Do not call groktypename(). (generate_protocols): Call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(); do not call groktypename(). (error_with_ivar): Remove last parameter. (check_ivars): Do not iterate ovar CLASS_RAW_IVARS lists in addition to CLASS_IVARS lists; adjust calls to error_with_ivar(). (generate_ivar_lists): Convert one of the initializer elements; do not call groktypename(). (get_arg_type_list, start_method_def, gen_method_def): Account for new representation of variable arguments and '...' in Objective-C methods; add Objective-C++ impedance matching code. (is_objc_type_qualifier): Remove function. (adjust_type_for_id_default): Simplify; there is no longer a need to wade through declspecs. (lookup_interface, start_class, continue_class, finish_class, start_method_def, start_protocol, build_method_decl, objc_add_method, add_instance_variable, build_ivar_reference, is_ivar, is_private, get_super_receiver, objc_build_finally_epilogue): Make into static functions. (receiver_is_class_object): Use new IS_CLASS() macro. (objc_build_message_expr): Tweak ObjC++ message argument handling; call objc_finish_message_expr() instead of finish_message_expr(). (finish_message_expr): Rename to objc_finish_message_expr(); use OBJC_TYPE_NAME and OBJC_SET_TYPE_NAME macros instead of TYPE_NAME. call gen_type_name() instead of gen_declaration(); call objc_is_id() instead of using IS_ID and IS_CLASS; Use objc_class_name instead of calling get_identifier("Class"); handle CONVERT_EXPRs in receiver. (build_objc_method_call, warn_with_method): Do not call groktypename(). (build_ivar_reference): Call convert() instead of clobbering in a type. (hash_init): Initialize string_htab hash table. (add_instance_variable): Simplify parameter list; do not call grokfield(); do not populate CLASS_IVARS list. (start_class): Check for the existence of super class, if one was specified. (continue_class): Use CLASS_RAW_IVARS rather than CLASS_IVARS; do not call build_class_template(); adjust call to get_class_ivars(); call build_decl(), pushdecl() and finish_decl() instead of define_decl(). (finish_class): Call build_decl(), pushdecl() and finish_decl() instead of define_decl(). (add_protocols): Use PROTOCOL_BINFO_ELTS for the tree vector size. (start_protocol): Do not call build_protocol_template(); use PROTOCOL_BINFO_ELTS for the tree vector size. (encode_type_qualifiers): Do not handle the 'const' qualifier here. (encode_pointer): Encode 'const char *' as 'r*', for backwards compatibility. (encode_array): Use HOST_WIDE_INT_PRINT_DEC instead of "%ld". (encode_type): Handle the 'const' qualifier here. (objc_parmlist): New global variable, sued by objc_push_parm and objc_get_parm_info(). (objc_push_parm, objc_get_parm_info): New functions. (objc_expr_last): Remove function. (synth_self_and_ucmd_args): For instance methods, use the instance type for 'self'; call objc_push_parm() instead of push_parm_decl(). (start_method_def): Do not call push_scope(), declare_parm_level(), pop_scope(), push_parm_decl(), store_parm_decls() or objc_expr_last(); just use objc_push_parm() and objc_get_parm_info(). (comp_method_with_proto): Remove function. (objc_types_are_equivalent): Strip away indirections before comparing underlying types. (comp_proto_with_proto): Do not call groktypename(); types are no longer in raw declspec format. (objc_start_function): New function. (really_start_method): Call comp_proto_with_proto() instead of comp_method_with_proto(); call objc_start_function() instead of hand-crafting a function declarator. (continue_method_def, objc_expand_function_end): Remove functions. (get_super_receiver): Call objc_get_current_scope() instead of get_current_scope(); reference 'super_class' field (instead of 'class'). (finish_method_def): Rename to objc_finish_method_definition() and add a function decl parameter; move method encoding call from objc_expand_function_end(). (is_complex_decl, adorn_decl, gen_declarator, gen_declspecs, gen_declaration_1): Remove functions. (tmpbuf, RAW_DECLSPEC): Remove. (gen_declaration): Remove second parameter; simplify to deal with TYPE_P nodes instead of raw declspecs. (gen_type_name, gen_type_name_0): New functions. (gen_method_decl): Remove second parameter; call gen_type_name() instead of gen_declaration_1(). (dump_interface): Adjust calls to gen_declaration() and gen_method_decl(); do not allocate a separate string buffer. (init_objc): Allocate a larger string buffer to accommodate dump_interface(); adjust call to build_module_descriptor(); add call to build_module_initializer_routine() for the GNU runtime. (generate_classref_translation_entry): Do not call start_decl(); call finish_var_decl() instead of finish_decl(); call convert() instead of build_c_cast(). * objc-act.h (CLASS_OWN_IVARS): Remove accessor. (CLASS_BINFO_ELTS): Reduce from 6 to 5, now that CLASS_OWN_IVARS is gone. (OCTI_GNU_INIT_DECL, GNU_INIT_decl): New. (OCTI_ELLIPSIS_NODE, objc_ellipsis_node): Remove. (OCTI_ID_ID, id_type, objc_id_id): Rename to OCTI_ID_NAME, objc_object_type and objc_object_name, respectively. (OCTI_CLS_REF, OCTI_CLASS_NAME, objc_class_reference, objc_class_name): New. (IS_CLASS): New macro. (IS_ID, IS_SUPER): Robustify. (OCTI_EXECCLASS_DECL, execclass_decl): New. (finish_file, start_class, continue_class, finish_class, start_method_def, continue_method_def, finish_method_def, start_protocol, finish_protocol, objc_build_throw_stmt, objc_build_try_catch_finally_stmt, objc_build_synchronized_prologue, objc_build_synchronized_epilogue, objc_build_try_prologue, objc_build_try_epilogue, objc_build_catch_stmt, objc_build_catch_epilogue, objc_build_finally_prologue, objc_build_finally_epilogue, is_ivar, is_private, is_public, add_instance_variable, objc_add_method, get_super_receiver, objc_clear_super_receiver, get_class_ivars_from_name, get_class_reference, get_static_reference, get_object_reference, build_message_expr, finish_message_expr, build_selector_expr, build_ivar_reference, build_keyword_decl, build_method_decl, build_protocol_expr, build_objc_string_object, objc_declare_alias, objc_declare_class, objc_declare_protocols, objc_comptypes, objc_check_decl, build_encode_expr): Remove prototypes. (imp_count, cat_count): Make GGC-aware. (OBJC_SET_TYPE_NAME): New macro. From-SVN: r87168
2004-09-08 02:49:44 +02:00
(objc_protocol_template)),
build_unary_op (ADDR_EXPR, protocol_list, 0));
initlist = tree_cons (NULL_TREE, expr, initlist);
}
1992-01-18 00:15:38 +01:00
if (flag_next_runtime)
/* sel_id = NULL */
tree.h (build_int_cst): New, sign extended constant. * tree.h (build_int_cst): New, sign extended constant. (build_int_cstu): New, zero extended constant. (build_int_cst_wide): Renamed from build_int_cst. * tree.c (build_int_cst, build_int_cstu): New. (build_int_cst_wide): Renamed from build_int_cst. (make_vector_type, build_common_tree_nodes, build_common_tree_nodes_2): Adjust build_int_cst calls. * builtins.c (expand_builtin_prefetch, expand_builtin_strstr, expand_builtin_strpbrk, expand_builtin_fputs, build_string_literal, expand_builtin_printf, expand_builtin_sprintf, fold_builtin_classify_type, fold_builtin_lround, fold_builtin_bitop, fold_builtin_isascii, fold_builtin_toascii, fold_builtin_isdigit, simplify_builtin_strstr, simplify_builtin_strpbrk, fold_builtin_fputs, simplify_builtin_sprintf): Likewise. * c-common.c (start_fname_decls, fix_string_type, shorten_compare, DEF_ATTR_INT): Likewise. * c-decl.c (complete_array_type, check_bitfield_type_and_width): Likewise. * c-lex.c (interpret_integer, lex_charconst): Likewise. * c-parse.in (primary) <TYPES_COMPATIBLE_P> Likewise. * c-pretty-print.c (pp_c_integer_constant): Likewise. * c-typeck.c (really_start_incremental_init, push_init_level, set_nonincremental_init_from_string): Likewise. * calls.c (load_register_parameters): Likewise. convert.c (convert_to_pointer): Likewise. coverage.c (coverage_counter_alloc, tree_coverage_counter_ref, build_fn_info_type, build_fn_info_value, build_ctr_info_value, build_gcov_info): Likewise. * except.c (init_eh, assign_filter_values): Likewise. * expmed.c (store_fixed_bit_field, extract_bit_field, extract_fixed_bit_field, extract_split_bit_field, expand_shift, expand_mult_const, expand_mult_highpart_adjust, extract_high_half, expand_sdiv_pow2, expand_divmod, make_tree): Likewise. * expr.c (convert_move, emit_group_load, emit_group_store, expand_assignment, store_constructor, store_field, expand_expr_real_1, reduce_to_bit_field_precision): Likewise. fold-const.c (force_fit_type, int_const_binop, fold_convert_const, invert_truthvalue, optimize_bit_field_compare, decode_field_reference, all_ones_mask_p, constant_boolean_node, fold_div_compare, fold, fold_read_from_constant_string, fold_negate_const, fold_abs_const, fold_not_const, round_up, round_down): Likewise. * function.c (assign_parm_setup_block): Likewise. * stmt.c (shift_return_value, expand_case, estimate_case_costs): Likewise. * stor-layout.c (layout_type, initialize_sizetypes, set_min_and_max_values_for_integral_type): Likewise. * tree-chrec.c (chrec_fold_multiply_poly_poly, reset_evolution_in_loop): Likewise. * tree-chrec.h (build_polynomial_chrec): Likewise. * tree-complex.c (build_replicated_const): Likewise. * tree-eh.c (honor_protect_cleanup_actions, lower_try_finally_onedest, lower_try_finally_copy, lower_try_finally_switch): Likewise. * tree-mudflap.c (mf_build_string, mx_register_decls, mudflap_register_call, mudflap_enqueue_constant): Likewise. * tree-nested.c (get_trampoline_type, get_nl_goto_field): Likewise. * tree-pretty-print.c (dump_generic_node): Likewise. * tree-ssa-ccp.c (widen_bitfield, maybe_fold_offset_to_array_ref): Likewise. * tree-ssa-dom.c (simplify_rhs_and_lookup_avail_expr): Likewise. * tree-ssa-loop-niter.c (number_of_iterations_cond, loop_niter_by_eval, upper_bound_in_type, lower_bound_in_type): Likewise. * tree-ssa-loop-ivcanon.c (create_canonical_iv, canonicalize_loop_induction_variables): Likewise. * tree-vectorizer.c (vect_create_index_for_array_ref, vect_transform_loop_bound, vect_compute_data_ref_alignment): Likewise. * config/alpha/alpha.c (alpha_initialize_trampoline, alpha_va_start, alpha_gimplify_va_arg_1): Likewise. * config/arm/arm.c (arm_get_cookie_size): Likewise. * config/c4x/c4x.c (c4x_gimplify_va_arg_expr): Likewise. * config/i386/i386.c (ix86_va_start, ix86_gimplify_va_arg): Likewise. * config/ia64/ia64.c (ia64_gimplify_va_arg): Likewise. * config/mips/mips.c (mips_build_builtin_va_list, mips_va_start, mips_gimplify_va_arg_expr): Likewise. * config/pa/pa.c (hppa_gimplify_va_arg_expr): Likewise. * config/rs6000/rs6000.c (rs6000_va_start, rs6000_gimplify_va_arg, add_compiler_branch_island): Likewise. * config/s390/s390.c (s390_va_start): Likewise. * config/sh/sh.c (sh_va_start): Likewise. * config/stormy16/stormy16.c (xstormy16_expand_builtin_va_start): Likewise. * config/xtensa/xtensa.c (xtensa_va_start, xtensa_gimplify_va_arg_expr): Likewise. * objc/objc-act.c (build_objc_string_object, build_objc_symtab_template, init_def_list, init_objc_symtab, init_module_descriptor, generate_static_references, build_selector_translation_table, get_proto_encoding, build_typed_selector_reference, build_selector_reference, build_next_objc_exception_stuff, build_method_prototype_list_template, generate_descriptor_table, generate_protocols, build_protocol_initializer, build_ivar_list_template, build_method_list_template, build_ivar_list_initializer, generate_ivars_list, generate_dispatch_table, generate_protocol_list, build_category_initializer, build_shared_structure_initializer, generate_shared_structures, handle_impent, generate_objc_image_info): Likewise. 2004-04-25 Paolo Bonzini <bonzini@gnu.org> * cfglayout.c (duplicate_insn_chain): Remove references to NOTE_INSN_LOOP_VTOP and NOTE_INSN_LOOP_CONT. * cfgloop.h (struct loop): Remove fields vtop, cont and cont_dominator. * cfgrtl.c (rtl_delete_block): Remove handling of NOTE_INSN_LOOP_CONT. * final.c (final_scan_insn): Remove references to NOTE_INSN_LOOP_VTOP and NOTE_INSN_LOOP_CONT. * insn-notes.def (NOTE_INSN_LOOP_VTOP, NOTE_INSN_LOOP_CONT): Remove. * jump.c (squeeze_notes): Remove references to NOTE_INSN_LOOP_VTOP and NOTE_INSN_LOOP_CONT. * loop.c (scan_loops, find_and_verify_loops, for_each_insn_in_loop, check_dbra_loop, loop_dump_aux): Remove references to removed notes and fields. * reorg.c (mostly_true_jump): Do not rely on NOTE_INSN_LOOP_VTOPs. * unroll.c (unroll_loop, copy_loop_body, loop_iterations): Remove references to removed notes and fields. (subtract_reg_term, ujump_to_loop_cont): Remove. From-SVN: r86544
2004-08-25 11:52:54 +02:00
initlist = tree_cons (NULL_TREE, build_int_cst (NULL_TREE, 0), initlist);
/* gc_object_type = NULL */
tree.h (build_int_cst): New, sign extended constant. * tree.h (build_int_cst): New, sign extended constant. (build_int_cstu): New, zero extended constant. (build_int_cst_wide): Renamed from build_int_cst. * tree.c (build_int_cst, build_int_cstu): New. (build_int_cst_wide): Renamed from build_int_cst. (make_vector_type, build_common_tree_nodes, build_common_tree_nodes_2): Adjust build_int_cst calls. * builtins.c (expand_builtin_prefetch, expand_builtin_strstr, expand_builtin_strpbrk, expand_builtin_fputs, build_string_literal, expand_builtin_printf, expand_builtin_sprintf, fold_builtin_classify_type, fold_builtin_lround, fold_builtin_bitop, fold_builtin_isascii, fold_builtin_toascii, fold_builtin_isdigit, simplify_builtin_strstr, simplify_builtin_strpbrk, fold_builtin_fputs, simplify_builtin_sprintf): Likewise. * c-common.c (start_fname_decls, fix_string_type, shorten_compare, DEF_ATTR_INT): Likewise. * c-decl.c (complete_array_type, check_bitfield_type_and_width): Likewise. * c-lex.c (interpret_integer, lex_charconst): Likewise. * c-parse.in (primary) <TYPES_COMPATIBLE_P> Likewise. * c-pretty-print.c (pp_c_integer_constant): Likewise. * c-typeck.c (really_start_incremental_init, push_init_level, set_nonincremental_init_from_string): Likewise. * calls.c (load_register_parameters): Likewise. convert.c (convert_to_pointer): Likewise. coverage.c (coverage_counter_alloc, tree_coverage_counter_ref, build_fn_info_type, build_fn_info_value, build_ctr_info_value, build_gcov_info): Likewise. * except.c (init_eh, assign_filter_values): Likewise. * expmed.c (store_fixed_bit_field, extract_bit_field, extract_fixed_bit_field, extract_split_bit_field, expand_shift, expand_mult_const, expand_mult_highpart_adjust, extract_high_half, expand_sdiv_pow2, expand_divmod, make_tree): Likewise. * expr.c (convert_move, emit_group_load, emit_group_store, expand_assignment, store_constructor, store_field, expand_expr_real_1, reduce_to_bit_field_precision): Likewise. fold-const.c (force_fit_type, int_const_binop, fold_convert_const, invert_truthvalue, optimize_bit_field_compare, decode_field_reference, all_ones_mask_p, constant_boolean_node, fold_div_compare, fold, fold_read_from_constant_string, fold_negate_const, fold_abs_const, fold_not_const, round_up, round_down): Likewise. * function.c (assign_parm_setup_block): Likewise. * stmt.c (shift_return_value, expand_case, estimate_case_costs): Likewise. * stor-layout.c (layout_type, initialize_sizetypes, set_min_and_max_values_for_integral_type): Likewise. * tree-chrec.c (chrec_fold_multiply_poly_poly, reset_evolution_in_loop): Likewise. * tree-chrec.h (build_polynomial_chrec): Likewise. * tree-complex.c (build_replicated_const): Likewise. * tree-eh.c (honor_protect_cleanup_actions, lower_try_finally_onedest, lower_try_finally_copy, lower_try_finally_switch): Likewise. * tree-mudflap.c (mf_build_string, mx_register_decls, mudflap_register_call, mudflap_enqueue_constant): Likewise. * tree-nested.c (get_trampoline_type, get_nl_goto_field): Likewise. * tree-pretty-print.c (dump_generic_node): Likewise. * tree-ssa-ccp.c (widen_bitfield, maybe_fold_offset_to_array_ref): Likewise. * tree-ssa-dom.c (simplify_rhs_and_lookup_avail_expr): Likewise. * tree-ssa-loop-niter.c (number_of_iterations_cond, loop_niter_by_eval, upper_bound_in_type, lower_bound_in_type): Likewise. * tree-ssa-loop-ivcanon.c (create_canonical_iv, canonicalize_loop_induction_variables): Likewise. * tree-vectorizer.c (vect_create_index_for_array_ref, vect_transform_loop_bound, vect_compute_data_ref_alignment): Likewise. * config/alpha/alpha.c (alpha_initialize_trampoline, alpha_va_start, alpha_gimplify_va_arg_1): Likewise. * config/arm/arm.c (arm_get_cookie_size): Likewise. * config/c4x/c4x.c (c4x_gimplify_va_arg_expr): Likewise. * config/i386/i386.c (ix86_va_start, ix86_gimplify_va_arg): Likewise. * config/ia64/ia64.c (ia64_gimplify_va_arg): Likewise. * config/mips/mips.c (mips_build_builtin_va_list, mips_va_start, mips_gimplify_va_arg_expr): Likewise. * config/pa/pa.c (hppa_gimplify_va_arg_expr): Likewise. * config/rs6000/rs6000.c (rs6000_va_start, rs6000_gimplify_va_arg, add_compiler_branch_island): Likewise. * config/s390/s390.c (s390_va_start): Likewise. * config/sh/sh.c (sh_va_start): Likewise. * config/stormy16/stormy16.c (xstormy16_expand_builtin_va_start): Likewise. * config/xtensa/xtensa.c (xtensa_va_start, xtensa_gimplify_va_arg_expr): Likewise. * objc/objc-act.c (build_objc_string_object, build_objc_symtab_template, init_def_list, init_objc_symtab, init_module_descriptor, generate_static_references, build_selector_translation_table, get_proto_encoding, build_typed_selector_reference, build_selector_reference, build_next_objc_exception_stuff, build_method_prototype_list_template, generate_descriptor_table, generate_protocols, build_protocol_initializer, build_ivar_list_template, build_method_list_template, build_ivar_list_initializer, generate_ivars_list, generate_dispatch_table, generate_protocol_list, build_category_initializer, build_shared_structure_initializer, generate_shared_structures, handle_impent, generate_objc_image_info): Likewise. 2004-04-25 Paolo Bonzini <bonzini@gnu.org> * cfglayout.c (duplicate_insn_chain): Remove references to NOTE_INSN_LOOP_VTOP and NOTE_INSN_LOOP_CONT. * cfgloop.h (struct loop): Remove fields vtop, cont and cont_dominator. * cfgrtl.c (rtl_delete_block): Remove handling of NOTE_INSN_LOOP_CONT. * final.c (final_scan_insn): Remove references to NOTE_INSN_LOOP_VTOP and NOTE_INSN_LOOP_CONT. * insn-notes.def (NOTE_INSN_LOOP_VTOP, NOTE_INSN_LOOP_CONT): Remove. * jump.c (squeeze_notes): Remove references to NOTE_INSN_LOOP_VTOP and NOTE_INSN_LOOP_CONT. * loop.c (scan_loops, find_and_verify_loops, for_each_insn_in_loop, check_dbra_loop, loop_dump_aux): Remove references to removed notes and fields. * reorg.c (mostly_true_jump): Do not rely on NOTE_INSN_LOOP_VTOPs. * unroll.c (unroll_loop, copy_loop_body, loop_iterations): Remove references to removed notes and fields. (subtract_reg_term, ujump_to_loop_cont): Remove. From-SVN: r86544
2004-08-25 11:52:54 +02:00
initlist = tree_cons (NULL_TREE, build_int_cst (NULL_TREE, 0), initlist);
tree.c (build_constructor): New function. * tree.c (build_constructor): New function. * tree.h: Prototype it. * c-typeck.c (build_c_cast, pop_init_level) * profile.c (build_function_info_value, build_gcov_info_value) (create_profiler): Use build_constructor. * builtins.c (expand_builtin_args_info): Remove #if 0 blocks. * objc/objc-act.c (build_constructor): Rename objc_build_constructor. Use build_constructor. (build_objc_string_object, objc_add_static_instance) (init_def_list, init_objc_symtab, init_module_descriptor) (generate_static_references, build_selector_translation_table) (build_descriptor_table_initializer, generate_descriptor_table) (build_protocol_initializer, build_ivar_list_initializer) (generate_ivars_list, build_dispatch_table_initializer) (generate_dispatch_table, generate_protocol_list) (build_category_initializer, build_shared_structure_initializer): Update to match. ada: * gigi.h, utils2.c (build_constructor): Rename gnat_build_constructor. Use build_constructor. * decl.c (gnat_to_gnu_entity) * trans.c (tree_transform, pos_to_constructor, extract_values) * ada/utils.c (build_template, convert_to_fat_pointer, convert) (unchecked_convert) * ada/utils2.c (build_binary_op, build_call_raise, build_allocator) (fill_vms_descriptor): Update to match. cp: * class.c (initialize_array) * decl.c (reshape_init) * decl2.c (build_expr_from_tree) * init.c (build_zero_init) * pt.c (tsubst_copy, tsubst_copy_and_build) * rtti.c (tinfo_base_init, generic_initializer, ptr_initializer) (ptm_initializer, class_initializer, get_pseudo_ti_init) * semantics.c (finish_compound_literal) * typeck.c (build_ptrmemfunc1) * typeck2.c (store_init_value, process_init_constructor) (build_functional_cast): Use build_constructor. f: * com.c (ffecom_build_complex_constant_, ffecom_expr_) (ffecom_init_zero_, ffecom_transform_namelist_, ffecom_vardesc_) (ffecom_vardesc_array_, ffecom_vardesc_dims_, ffecom_2) * ste.c (ffeste_io_ialist_, ffeste_io_cilist_, ffeste_io_cllist_) (ffeste_io_icilist_, ffeste_io_inlist_, ffeste_io_olist_): Use build_constructor. java: * class.c (make_field_value, make_method_value, get_dispatch_table) (make_class_data, emit_offset_symbol_table) * constants.c (build_constants_constructor) * java-tree.h (START_RECORD_CONSTRUCTOR) * parse.y (maybe_build_array_element_wfl): Use build_constructor. From-SVN: r65539
2003-04-13 03:45:35 +02:00
return objc_build_constructor (type, nreverse (initlist));
1992-01-18 00:15:38 +01:00
}
/* Retrieve category interface CAT_NAME (if any) associated with CLASS. */
static inline tree
lookup_category (tree class, tree cat_name)
{
tree category = CLASS_CATEGORY_LIST (class);
while (category && CLASS_SUPER_NAME (category) != cat_name)
category = CLASS_CATEGORY_LIST (category);
return category;
}
/* static struct objc_category _OBJC_CATEGORY_<name> = { ... }; */
1996-07-04 00:07:53 +02:00
1992-01-18 00:15:38 +01:00
static void
generate_category (tree cat)
1992-01-18 00:15:38 +01:00
{
Makefile.in (c-parse.o): Depend on $(C_COMMON_H). [gcc/ChangeLog] 2004-09-07 Ziemowit Laski <zlaski@apple.com> * Makefile.in (c-parse.o): Depend on $(C_COMMON_H). * c-parse.in: Include c-common.h instead of objc-act.h. (ivar_decl_list, ivar_decls, ivar_decl, ivars, ivar_declarator, myparms, myparm): Remove %type declarations. (methodtype, optparms, OBJC_TYPE_QUAL, objc_quals, objc_qual, objc_typename, objc_try_catch_stmt, optellipsis): Add %type declarations. (objc_inherit_code, objc_public_flag): Remove. (typespec_nonreserved_nonattr): Call objc_get_protocol_qualified_type() instead of get_static_reference() and get_protocol_reference(). (stmt_nocomp): Call grokparm() on @catch parameter. (objcdef): Move semantic action to objc_finish_implementation(). (classdef): Move semantic action to objc_start_class_interface(), objc_continue_interface(), objc_finish_interface(), objc_start_class_implementation(), objc_continue_implementation(), objc_start_category_interface() and objc_start_category_implementation(). (protocoldef): Move semantic actions to objc_start_protocol() and objc_finish_interface(). (ivar_decl_list): Remove nonterminal. (visibility_spec): Move semantic actions to objc_set_visibility(). (ivar_decls): Remove assignment to $$. (ivar_decl): Rephrase in terms of component_decl; call objc_add_instance_variable(). (ivars, ivar_declarator): Remove nonterminals. (opt_semi): New nonterminal. (methodtype): Remove semantic actions. (methoddef): Move semantic actions to objc_set_method_type(), objc_start_method_definition() and objc_finish_method_definition(). (methodproto): Move semantic actions to objc_set_method_type() and objc_add_method_declaration(). (methoddecl): Use objc_typename instead of typename; move semantic actions to objc_build_method_signature(). (optarglist, myxdecls, mydecl, myparms, myparm): Remove nonterminals. (optparmlist): Express in terms of optparms and optellipsis. (optparms, optellipsis, objc_qual, objc_quals, objc_typename): New nonterminals. (keyworddecl): Use objc_typename instead of typename. (rid_to_yy): Mark RID_IN, RID_OUT, RID_INOUT, RID_BYCOPY, RID_BYREF and RID_ONEWAY as returning OBJC_TYPE_QUAL to yyparse(). [gcc/objc/ChangeLog] 2004-09-07 Ziemowit Laski <zlaski@apple.com> * Make-lang.in (objc/objc-parse.o): Depend on $(C_COMMON_H) instead of objc/objc-act.h. (objc/objc-act.o): Depend on $(HASHTAB_H). * objc-act.c: Include hashtab.h; in ObjC++ mode, include cp-tree.h and objcp-decl.h instead of c-tree.h. (build_module_descriptor, get_class_ivars, synth_id_with_class_suffix, error_with_ivar, gen_method_decl, gen_declaration, setup_string_decl, build_protocol_template): Adjust prototypes. (build_module_initializer_routine, start_class, continue_class, finish_class, start_method_def, objc_start_function, start_protocol, build_method_decl, objc_add_method, add_instance_variable, build_ivar_reference, is_ivar, is_private, get_super_receiver, build_selector_table_decl, objc_push_parm, objc_get_parm_info, gen_type_name, gen_type_name_0, start_var_decl, finish_var_decl, create_field_decl): New prototypes. (objc_expand_function_end, comp_method_with_proto, objc_expr_last, gen_declaration_1, gen_declarator, is_complex_decl, adorn_decl, define_decl, create_builtin_decl, gen_declspecs): Remove prototypes. (TYPE_ID): Rename to OBJECT_TYPEDEF_NAME. (CLASS_TYPEDEF_NAME): New. (TAG_EXECCLASS): Change from a global variable to a #define. (TAG_RETURN_STRUCT): Delete. (TAG_GNUINIT): New, holds '__objc_gnu_init' name. (objc_inherit_code, objc_public_flag): New, moved from c-parse.in. (string_descriptor): New struct. (string_htab): New hash table. (string_hash, string_eq): New prototypes. (generate_struct_by_value_array): Call create_field_decl() instead of create_builtin_decl(). (objc_init): Do not initialize objc_ellipsis_node or TAG_EXECCLASS; In ObjC++ mode, call cxx_init() instead of c_objc_common_init(). (objc_finish_file): In ObjC++, call instantiate_pending_templates() and cp_finish_file(). (define_decl, get_static_reference, get_protocol_reference, create_builtin_decl): Remove functions. (objc_start_class_interface, objc_start_category_interface, objc_start_protocol, objc_continue_interface, objc_finish_interface, objc_start_class_implementation, objc_start_category_implementation, objc_continue_implementation, objc_finish_implementation, objc_set_visibility, objc_set_method_type, objc_build_method_signature, objc_add_method_declaration, objc_start_method_definition, objc_add_instance_variable, objc_get_protocol_qualified_type, create_field_decl, start_var_decl, finish_var_decl): New functions. (setup_string_decl): Simplify since it is only called once. (synth_module_prologue): Call build_class_template(); predefine 'id' and 'Class' as typedefs; rename 'temp_type' to 'type'; disable debug hooks for duration of function; fix GNU runtime messenger signatures to correspond to reality; forward-declare '__objc_exec_class' for the GNU runtime; call build_selector_table_decl(); in ObjC++ mode, generate 'extern "C" { ... }' wrappers around synthesized declarations; call build_protocol_template() and build_category_template(). (string_hash, string_eq): New functions. (objc_build_string_object): Check metaclass correctness only once; store string literals in hash table. (objc_build_constructor): Do not convert initializer elements; adjust for ObjC++ impedance mismatch. (build_objc_symtab_template): Call create_field_decl() instead of create_builtin_decl(). (init_objc_symtab): Add missing conversion to initializer element. (build_metadata_decl): Call start_var_decl() instead of define_decl(). (generate_objc_symtab_decl): Do not call build_category_template(); call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(). (build_module_descriptor): Call create_field_decl() instead of grokfield(); call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(); always mark module descriptor as used; move GNU runtime-specific functionality to build_module_initializer_routine(). (build_module_initializer_routine): New function, broken off of build_module_descriptor(). (objc_static_init_needed_p, objc_generate_static_init_call): New functions. (generate_static_references, generate_strings, build_selector_translation_table, generate_descriptor_table, generate_ivars_list, generate_dispatch_table, generate_category): Call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(); build a type directly instead of via groktypename(). (build_selector_reference_decl, build_selector_table_decl, build_class_reference_decl, build_protocol_reference, generate_objc_image_info): Call start_var_decl() instead of build_decl(). (build_selector_reference): For GNU runtime, do not call build_selector_reference_decl(). (build_selector, build_typed_selector_reference): Always convert result to the selector type. (add_objc_string): Cast return value to 'char *'. (build_method_prototype_template, build_selector_template, build_method_template): Use actual selector type for fields pointing to selectors. (finish_objc): For GNU runtime, call build_module_initializer_routine() after build_module_descriptor(). (generate_protocol_list, generate_shared_structures): Call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(); build a type directly instead of via groktypename(). (synth_id_with_class_suffix): Return a string. (get_arg_type_list): For instance methods, use the instance type for 'self'; do not call groktypename_in_parm_context(). (build_objc_string_decl): Squash redeclaration errors in ObjC++. (objc_is_class_name): Use OBJC_TYPE_NAME instead of TYPE_NAME; handle RECORD_TYPEs in ObjC as well as ObjC++. (objc_is_id): New function. (objc_is_object_ptr): Return the canonical type node. (objc_get_class_ivars): Simplify using get_class_ivars(). (get_class_ivars): Remove second parameter; create a fresh copy of the ivar list for each call; do not check for existence of super class. (objc_eh_runtime_type): Mark #ifndef OBJCPLUS. (objc_init_exceptions): When using SJLJ-style exceptions, require the use of '-fobjc-exceptions' flag; do not require it for DWARF-style exceptions. (objc_build_exc_ptr, next_sjlj_build_try_catch_finally): Use objc_object_type instead of objc_id_type. (objc_begin_catch_clause): Convert the incoming PARM_DECL into a VAR_DECL before placing it in the appropriate scope; do not call define_decl(); adjust call to c_begin_compound_stmt(); use objc_object_type instead of objc_id_type. (build_next_objc_exception_stuff): Call create_field_decl() instead of create_builtin_decl(); construct type directly instead of calling groktypename(); use OBJC_VOID_AT_END to mark end of function parameters. (build_private_template): Adjust call to get_class_ivars(); build a type directly instead of via groktypename(). (build_protocol_template, build_method_prototype_list_template, build_method_prototype_template, build_category_template, build_selector_template, build_class_template, build_super_template, build_ivar_template, build_ivar_list_template, build_method_list_template, build_method_template): Call create_field_decl() instead of grokfield(). (objc_method_parm_type): Do not call groktypename(). (generate_descriptor_table): Call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(). (generate_method_descriptors, build_protocol_initializer, generate_dispatch_tables, build_category_initializer, build_shared_structure_initializer): Do not call groktypename(). (generate_protocols): Call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(); do not call groktypename(). (error_with_ivar): Remove last parameter. (check_ivars): Do not iterate ovar CLASS_RAW_IVARS lists in addition to CLASS_IVARS lists; adjust calls to error_with_ivar(). (generate_ivar_lists): Convert one of the initializer elements; do not call groktypename(). (get_arg_type_list, start_method_def, gen_method_def): Account for new representation of variable arguments and '...' in Objective-C methods; add Objective-C++ impedance matching code. (is_objc_type_qualifier): Remove function. (adjust_type_for_id_default): Simplify; there is no longer a need to wade through declspecs. (lookup_interface, start_class, continue_class, finish_class, start_method_def, start_protocol, build_method_decl, objc_add_method, add_instance_variable, build_ivar_reference, is_ivar, is_private, get_super_receiver, objc_build_finally_epilogue): Make into static functions. (receiver_is_class_object): Use new IS_CLASS() macro. (objc_build_message_expr): Tweak ObjC++ message argument handling; call objc_finish_message_expr() instead of finish_message_expr(). (finish_message_expr): Rename to objc_finish_message_expr(); use OBJC_TYPE_NAME and OBJC_SET_TYPE_NAME macros instead of TYPE_NAME. call gen_type_name() instead of gen_declaration(); call objc_is_id() instead of using IS_ID and IS_CLASS; Use objc_class_name instead of calling get_identifier("Class"); handle CONVERT_EXPRs in receiver. (build_objc_method_call, warn_with_method): Do not call groktypename(). (build_ivar_reference): Call convert() instead of clobbering in a type. (hash_init): Initialize string_htab hash table. (add_instance_variable): Simplify parameter list; do not call grokfield(); do not populate CLASS_IVARS list. (start_class): Check for the existence of super class, if one was specified. (continue_class): Use CLASS_RAW_IVARS rather than CLASS_IVARS; do not call build_class_template(); adjust call to get_class_ivars(); call build_decl(), pushdecl() and finish_decl() instead of define_decl(). (finish_class): Call build_decl(), pushdecl() and finish_decl() instead of define_decl(). (add_protocols): Use PROTOCOL_BINFO_ELTS for the tree vector size. (start_protocol): Do not call build_protocol_template(); use PROTOCOL_BINFO_ELTS for the tree vector size. (encode_type_qualifiers): Do not handle the 'const' qualifier here. (encode_pointer): Encode 'const char *' as 'r*', for backwards compatibility. (encode_array): Use HOST_WIDE_INT_PRINT_DEC instead of "%ld". (encode_type): Handle the 'const' qualifier here. (objc_parmlist): New global variable, sued by objc_push_parm and objc_get_parm_info(). (objc_push_parm, objc_get_parm_info): New functions. (objc_expr_last): Remove function. (synth_self_and_ucmd_args): For instance methods, use the instance type for 'self'; call objc_push_parm() instead of push_parm_decl(). (start_method_def): Do not call push_scope(), declare_parm_level(), pop_scope(), push_parm_decl(), store_parm_decls() or objc_expr_last(); just use objc_push_parm() and objc_get_parm_info(). (comp_method_with_proto): Remove function. (objc_types_are_equivalent): Strip away indirections before comparing underlying types. (comp_proto_with_proto): Do not call groktypename(); types are no longer in raw declspec format. (objc_start_function): New function. (really_start_method): Call comp_proto_with_proto() instead of comp_method_with_proto(); call objc_start_function() instead of hand-crafting a function declarator. (continue_method_def, objc_expand_function_end): Remove functions. (get_super_receiver): Call objc_get_current_scope() instead of get_current_scope(); reference 'super_class' field (instead of 'class'). (finish_method_def): Rename to objc_finish_method_definition() and add a function decl parameter; move method encoding call from objc_expand_function_end(). (is_complex_decl, adorn_decl, gen_declarator, gen_declspecs, gen_declaration_1): Remove functions. (tmpbuf, RAW_DECLSPEC): Remove. (gen_declaration): Remove second parameter; simplify to deal with TYPE_P nodes instead of raw declspecs. (gen_type_name, gen_type_name_0): New functions. (gen_method_decl): Remove second parameter; call gen_type_name() instead of gen_declaration_1(). (dump_interface): Adjust calls to gen_declaration() and gen_method_decl(); do not allocate a separate string buffer. (init_objc): Allocate a larger string buffer to accommodate dump_interface(); adjust call to build_module_descriptor(); add call to build_module_initializer_routine() for the GNU runtime. (generate_classref_translation_entry): Do not call start_decl(); call finish_var_decl() instead of finish_decl(); call convert() instead of build_c_cast(). * objc-act.h (CLASS_OWN_IVARS): Remove accessor. (CLASS_BINFO_ELTS): Reduce from 6 to 5, now that CLASS_OWN_IVARS is gone. (OCTI_GNU_INIT_DECL, GNU_INIT_decl): New. (OCTI_ELLIPSIS_NODE, objc_ellipsis_node): Remove. (OCTI_ID_ID, id_type, objc_id_id): Rename to OCTI_ID_NAME, objc_object_type and objc_object_name, respectively. (OCTI_CLS_REF, OCTI_CLASS_NAME, objc_class_reference, objc_class_name): New. (IS_CLASS): New macro. (IS_ID, IS_SUPER): Robustify. (OCTI_EXECCLASS_DECL, execclass_decl): New. (finish_file, start_class, continue_class, finish_class, start_method_def, continue_method_def, finish_method_def, start_protocol, finish_protocol, objc_build_throw_stmt, objc_build_try_catch_finally_stmt, objc_build_synchronized_prologue, objc_build_synchronized_epilogue, objc_build_try_prologue, objc_build_try_epilogue, objc_build_catch_stmt, objc_build_catch_epilogue, objc_build_finally_prologue, objc_build_finally_epilogue, is_ivar, is_private, is_public, add_instance_variable, objc_add_method, get_super_receiver, objc_clear_super_receiver, get_class_ivars_from_name, get_class_reference, get_static_reference, get_object_reference, build_message_expr, finish_message_expr, build_selector_expr, build_ivar_reference, build_keyword_decl, build_method_decl, build_protocol_expr, build_objc_string_object, objc_declare_alias, objc_declare_class, objc_declare_protocols, objc_comptypes, objc_check_decl, build_encode_expr): Remove prototypes. (imp_count, cat_count): Make GGC-aware. (OBJC_SET_TYPE_NAME): New macro. From-SVN: r87168
2004-09-08 02:49:44 +02:00
tree decl;
1992-01-18 00:15:38 +01:00
tree initlist, cat_name_expr, class_name_expr;
tree protocol_decl, category;
add_class_reference (CLASS_NAME (cat));
cat_name_expr = add_objc_string (CLASS_SUPER_NAME (cat), class_names);
class_name_expr = add_objc_string (CLASS_NAME (cat), class_names);
category = lookup_category (implementation_template,
CLASS_SUPER_NAME (cat));
if (category && CLASS_PROTOCOL_LIST (category))
{
generate_protocol_references (CLASS_PROTOCOL_LIST (category));
protocol_decl = generate_protocol_list (category);
}
else
protocol_decl = 0;
1992-01-18 00:15:38 +01:00
Makefile.in (c-parse.o): Depend on $(C_COMMON_H). [gcc/ChangeLog] 2004-09-07 Ziemowit Laski <zlaski@apple.com> * Makefile.in (c-parse.o): Depend on $(C_COMMON_H). * c-parse.in: Include c-common.h instead of objc-act.h. (ivar_decl_list, ivar_decls, ivar_decl, ivars, ivar_declarator, myparms, myparm): Remove %type declarations. (methodtype, optparms, OBJC_TYPE_QUAL, objc_quals, objc_qual, objc_typename, objc_try_catch_stmt, optellipsis): Add %type declarations. (objc_inherit_code, objc_public_flag): Remove. (typespec_nonreserved_nonattr): Call objc_get_protocol_qualified_type() instead of get_static_reference() and get_protocol_reference(). (stmt_nocomp): Call grokparm() on @catch parameter. (objcdef): Move semantic action to objc_finish_implementation(). (classdef): Move semantic action to objc_start_class_interface(), objc_continue_interface(), objc_finish_interface(), objc_start_class_implementation(), objc_continue_implementation(), objc_start_category_interface() and objc_start_category_implementation(). (protocoldef): Move semantic actions to objc_start_protocol() and objc_finish_interface(). (ivar_decl_list): Remove nonterminal. (visibility_spec): Move semantic actions to objc_set_visibility(). (ivar_decls): Remove assignment to $$. (ivar_decl): Rephrase in terms of component_decl; call objc_add_instance_variable(). (ivars, ivar_declarator): Remove nonterminals. (opt_semi): New nonterminal. (methodtype): Remove semantic actions. (methoddef): Move semantic actions to objc_set_method_type(), objc_start_method_definition() and objc_finish_method_definition(). (methodproto): Move semantic actions to objc_set_method_type() and objc_add_method_declaration(). (methoddecl): Use objc_typename instead of typename; move semantic actions to objc_build_method_signature(). (optarglist, myxdecls, mydecl, myparms, myparm): Remove nonterminals. (optparmlist): Express in terms of optparms and optellipsis. (optparms, optellipsis, objc_qual, objc_quals, objc_typename): New nonterminals. (keyworddecl): Use objc_typename instead of typename. (rid_to_yy): Mark RID_IN, RID_OUT, RID_INOUT, RID_BYCOPY, RID_BYREF and RID_ONEWAY as returning OBJC_TYPE_QUAL to yyparse(). [gcc/objc/ChangeLog] 2004-09-07 Ziemowit Laski <zlaski@apple.com> * Make-lang.in (objc/objc-parse.o): Depend on $(C_COMMON_H) instead of objc/objc-act.h. (objc/objc-act.o): Depend on $(HASHTAB_H). * objc-act.c: Include hashtab.h; in ObjC++ mode, include cp-tree.h and objcp-decl.h instead of c-tree.h. (build_module_descriptor, get_class_ivars, synth_id_with_class_suffix, error_with_ivar, gen_method_decl, gen_declaration, setup_string_decl, build_protocol_template): Adjust prototypes. (build_module_initializer_routine, start_class, continue_class, finish_class, start_method_def, objc_start_function, start_protocol, build_method_decl, objc_add_method, add_instance_variable, build_ivar_reference, is_ivar, is_private, get_super_receiver, build_selector_table_decl, objc_push_parm, objc_get_parm_info, gen_type_name, gen_type_name_0, start_var_decl, finish_var_decl, create_field_decl): New prototypes. (objc_expand_function_end, comp_method_with_proto, objc_expr_last, gen_declaration_1, gen_declarator, is_complex_decl, adorn_decl, define_decl, create_builtin_decl, gen_declspecs): Remove prototypes. (TYPE_ID): Rename to OBJECT_TYPEDEF_NAME. (CLASS_TYPEDEF_NAME): New. (TAG_EXECCLASS): Change from a global variable to a #define. (TAG_RETURN_STRUCT): Delete. (TAG_GNUINIT): New, holds '__objc_gnu_init' name. (objc_inherit_code, objc_public_flag): New, moved from c-parse.in. (string_descriptor): New struct. (string_htab): New hash table. (string_hash, string_eq): New prototypes. (generate_struct_by_value_array): Call create_field_decl() instead of create_builtin_decl(). (objc_init): Do not initialize objc_ellipsis_node or TAG_EXECCLASS; In ObjC++ mode, call cxx_init() instead of c_objc_common_init(). (objc_finish_file): In ObjC++, call instantiate_pending_templates() and cp_finish_file(). (define_decl, get_static_reference, get_protocol_reference, create_builtin_decl): Remove functions. (objc_start_class_interface, objc_start_category_interface, objc_start_protocol, objc_continue_interface, objc_finish_interface, objc_start_class_implementation, objc_start_category_implementation, objc_continue_implementation, objc_finish_implementation, objc_set_visibility, objc_set_method_type, objc_build_method_signature, objc_add_method_declaration, objc_start_method_definition, objc_add_instance_variable, objc_get_protocol_qualified_type, create_field_decl, start_var_decl, finish_var_decl): New functions. (setup_string_decl): Simplify since it is only called once. (synth_module_prologue): Call build_class_template(); predefine 'id' and 'Class' as typedefs; rename 'temp_type' to 'type'; disable debug hooks for duration of function; fix GNU runtime messenger signatures to correspond to reality; forward-declare '__objc_exec_class' for the GNU runtime; call build_selector_table_decl(); in ObjC++ mode, generate 'extern "C" { ... }' wrappers around synthesized declarations; call build_protocol_template() and build_category_template(). (string_hash, string_eq): New functions. (objc_build_string_object): Check metaclass correctness only once; store string literals in hash table. (objc_build_constructor): Do not convert initializer elements; adjust for ObjC++ impedance mismatch. (build_objc_symtab_template): Call create_field_decl() instead of create_builtin_decl(). (init_objc_symtab): Add missing conversion to initializer element. (build_metadata_decl): Call start_var_decl() instead of define_decl(). (generate_objc_symtab_decl): Do not call build_category_template(); call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(). (build_module_descriptor): Call create_field_decl() instead of grokfield(); call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(); always mark module descriptor as used; move GNU runtime-specific functionality to build_module_initializer_routine(). (build_module_initializer_routine): New function, broken off of build_module_descriptor(). (objc_static_init_needed_p, objc_generate_static_init_call): New functions. (generate_static_references, generate_strings, build_selector_translation_table, generate_descriptor_table, generate_ivars_list, generate_dispatch_table, generate_category): Call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(); build a type directly instead of via groktypename(). (build_selector_reference_decl, build_selector_table_decl, build_class_reference_decl, build_protocol_reference, generate_objc_image_info): Call start_var_decl() instead of build_decl(). (build_selector_reference): For GNU runtime, do not call build_selector_reference_decl(). (build_selector, build_typed_selector_reference): Always convert result to the selector type. (add_objc_string): Cast return value to 'char *'. (build_method_prototype_template, build_selector_template, build_method_template): Use actual selector type for fields pointing to selectors. (finish_objc): For GNU runtime, call build_module_initializer_routine() after build_module_descriptor(). (generate_protocol_list, generate_shared_structures): Call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(); build a type directly instead of via groktypename(). (synth_id_with_class_suffix): Return a string. (get_arg_type_list): For instance methods, use the instance type for 'self'; do not call groktypename_in_parm_context(). (build_objc_string_decl): Squash redeclaration errors in ObjC++. (objc_is_class_name): Use OBJC_TYPE_NAME instead of TYPE_NAME; handle RECORD_TYPEs in ObjC as well as ObjC++. (objc_is_id): New function. (objc_is_object_ptr): Return the canonical type node. (objc_get_class_ivars): Simplify using get_class_ivars(). (get_class_ivars): Remove second parameter; create a fresh copy of the ivar list for each call; do not check for existence of super class. (objc_eh_runtime_type): Mark #ifndef OBJCPLUS. (objc_init_exceptions): When using SJLJ-style exceptions, require the use of '-fobjc-exceptions' flag; do not require it for DWARF-style exceptions. (objc_build_exc_ptr, next_sjlj_build_try_catch_finally): Use objc_object_type instead of objc_id_type. (objc_begin_catch_clause): Convert the incoming PARM_DECL into a VAR_DECL before placing it in the appropriate scope; do not call define_decl(); adjust call to c_begin_compound_stmt(); use objc_object_type instead of objc_id_type. (build_next_objc_exception_stuff): Call create_field_decl() instead of create_builtin_decl(); construct type directly instead of calling groktypename(); use OBJC_VOID_AT_END to mark end of function parameters. (build_private_template): Adjust call to get_class_ivars(); build a type directly instead of via groktypename(). (build_protocol_template, build_method_prototype_list_template, build_method_prototype_template, build_category_template, build_selector_template, build_class_template, build_super_template, build_ivar_template, build_ivar_list_template, build_method_list_template, build_method_template): Call create_field_decl() instead of grokfield(). (objc_method_parm_type): Do not call groktypename(). (generate_descriptor_table): Call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(). (generate_method_descriptors, build_protocol_initializer, generate_dispatch_tables, build_category_initializer, build_shared_structure_initializer): Do not call groktypename(). (generate_protocols): Call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(); do not call groktypename(). (error_with_ivar): Remove last parameter. (check_ivars): Do not iterate ovar CLASS_RAW_IVARS lists in addition to CLASS_IVARS lists; adjust calls to error_with_ivar(). (generate_ivar_lists): Convert one of the initializer elements; do not call groktypename(). (get_arg_type_list, start_method_def, gen_method_def): Account for new representation of variable arguments and '...' in Objective-C methods; add Objective-C++ impedance matching code. (is_objc_type_qualifier): Remove function. (adjust_type_for_id_default): Simplify; there is no longer a need to wade through declspecs. (lookup_interface, start_class, continue_class, finish_class, start_method_def, start_protocol, build_method_decl, objc_add_method, add_instance_variable, build_ivar_reference, is_ivar, is_private, get_super_receiver, objc_build_finally_epilogue): Make into static functions. (receiver_is_class_object): Use new IS_CLASS() macro. (objc_build_message_expr): Tweak ObjC++ message argument handling; call objc_finish_message_expr() instead of finish_message_expr(). (finish_message_expr): Rename to objc_finish_message_expr(); use OBJC_TYPE_NAME and OBJC_SET_TYPE_NAME macros instead of TYPE_NAME. call gen_type_name() instead of gen_declaration(); call objc_is_id() instead of using IS_ID and IS_CLASS; Use objc_class_name instead of calling get_identifier("Class"); handle CONVERT_EXPRs in receiver. (build_objc_method_call, warn_with_method): Do not call groktypename(). (build_ivar_reference): Call convert() instead of clobbering in a type. (hash_init): Initialize string_htab hash table. (add_instance_variable): Simplify parameter list; do not call grokfield(); do not populate CLASS_IVARS list. (start_class): Check for the existence of super class, if one was specified. (continue_class): Use CLASS_RAW_IVARS rather than CLASS_IVARS; do not call build_class_template(); adjust call to get_class_ivars(); call build_decl(), pushdecl() and finish_decl() instead of define_decl(). (finish_class): Call build_decl(), pushdecl() and finish_decl() instead of define_decl(). (add_protocols): Use PROTOCOL_BINFO_ELTS for the tree vector size. (start_protocol): Do not call build_protocol_template(); use PROTOCOL_BINFO_ELTS for the tree vector size. (encode_type_qualifiers): Do not handle the 'const' qualifier here. (encode_pointer): Encode 'const char *' as 'r*', for backwards compatibility. (encode_array): Use HOST_WIDE_INT_PRINT_DEC instead of "%ld". (encode_type): Handle the 'const' qualifier here. (objc_parmlist): New global variable, sued by objc_push_parm and objc_get_parm_info(). (objc_push_parm, objc_get_parm_info): New functions. (objc_expr_last): Remove function. (synth_self_and_ucmd_args): For instance methods, use the instance type for 'self'; call objc_push_parm() instead of push_parm_decl(). (start_method_def): Do not call push_scope(), declare_parm_level(), pop_scope(), push_parm_decl(), store_parm_decls() or objc_expr_last(); just use objc_push_parm() and objc_get_parm_info(). (comp_method_with_proto): Remove function. (objc_types_are_equivalent): Strip away indirections before comparing underlying types. (comp_proto_with_proto): Do not call groktypename(); types are no longer in raw declspec format. (objc_start_function): New function. (really_start_method): Call comp_proto_with_proto() instead of comp_method_with_proto(); call objc_start_function() instead of hand-crafting a function declarator. (continue_method_def, objc_expand_function_end): Remove functions. (get_super_receiver): Call objc_get_current_scope() instead of get_current_scope(); reference 'super_class' field (instead of 'class'). (finish_method_def): Rename to objc_finish_method_definition() and add a function decl parameter; move method encoding call from objc_expand_function_end(). (is_complex_decl, adorn_decl, gen_declarator, gen_declspecs, gen_declaration_1): Remove functions. (tmpbuf, RAW_DECLSPEC): Remove. (gen_declaration): Remove second parameter; simplify to deal with TYPE_P nodes instead of raw declspecs. (gen_type_name, gen_type_name_0): New functions. (gen_method_decl): Remove second parameter; call gen_type_name() instead of gen_declaration_1(). (dump_interface): Adjust calls to gen_declaration() and gen_method_decl(); do not allocate a separate string buffer. (init_objc): Allocate a larger string buffer to accommodate dump_interface(); adjust call to build_module_descriptor(); add call to build_module_initializer_routine() for the GNU runtime. (generate_classref_translation_entry): Do not call start_decl(); call finish_var_decl() instead of finish_decl(); call convert() instead of build_c_cast(). * objc-act.h (CLASS_OWN_IVARS): Remove accessor. (CLASS_BINFO_ELTS): Reduce from 6 to 5, now that CLASS_OWN_IVARS is gone. (OCTI_GNU_INIT_DECL, GNU_INIT_decl): New. (OCTI_ELLIPSIS_NODE, objc_ellipsis_node): Remove. (OCTI_ID_ID, id_type, objc_id_id): Rename to OCTI_ID_NAME, objc_object_type and objc_object_name, respectively. (OCTI_CLS_REF, OCTI_CLASS_NAME, objc_class_reference, objc_class_name): New. (IS_CLASS): New macro. (IS_ID, IS_SUPER): Robustify. (OCTI_EXECCLASS_DECL, execclass_decl): New. (finish_file, start_class, continue_class, finish_class, start_method_def, continue_method_def, finish_method_def, start_protocol, finish_protocol, objc_build_throw_stmt, objc_build_try_catch_finally_stmt, objc_build_synchronized_prologue, objc_build_synchronized_epilogue, objc_build_try_prologue, objc_build_try_epilogue, objc_build_catch_stmt, objc_build_catch_epilogue, objc_build_finally_prologue, objc_build_finally_epilogue, is_ivar, is_private, is_public, add_instance_variable, objc_add_method, get_super_receiver, objc_clear_super_receiver, get_class_ivars_from_name, get_class_reference, get_static_reference, get_object_reference, build_message_expr, finish_message_expr, build_selector_expr, build_ivar_reference, build_keyword_decl, build_method_decl, build_protocol_expr, build_objc_string_object, objc_declare_alias, objc_declare_class, objc_declare_protocols, objc_comptypes, objc_check_decl, build_encode_expr): Remove prototypes. (imp_count, cat_count): Make GGC-aware. (OBJC_SET_TYPE_NAME): New macro. From-SVN: r87168
2004-09-08 02:49:44 +02:00
decl = start_var_decl (objc_category_template,
synth_id_with_class_suffix
("_OBJC_CATEGORY", objc_implementation_context));
1992-01-18 00:15:38 +01:00
initlist = build_category_initializer (TREE_TYPE (decl),
cat_name_expr, class_name_expr,
UOBJC_INSTANCE_METHODS_decl,
UOBJC_CLASS_METHODS_decl,
protocol_decl);
1992-01-18 00:15:38 +01:00
Makefile.in (c-parse.o): Depend on $(C_COMMON_H). [gcc/ChangeLog] 2004-09-07 Ziemowit Laski <zlaski@apple.com> * Makefile.in (c-parse.o): Depend on $(C_COMMON_H). * c-parse.in: Include c-common.h instead of objc-act.h. (ivar_decl_list, ivar_decls, ivar_decl, ivars, ivar_declarator, myparms, myparm): Remove %type declarations. (methodtype, optparms, OBJC_TYPE_QUAL, objc_quals, objc_qual, objc_typename, objc_try_catch_stmt, optellipsis): Add %type declarations. (objc_inherit_code, objc_public_flag): Remove. (typespec_nonreserved_nonattr): Call objc_get_protocol_qualified_type() instead of get_static_reference() and get_protocol_reference(). (stmt_nocomp): Call grokparm() on @catch parameter. (objcdef): Move semantic action to objc_finish_implementation(). (classdef): Move semantic action to objc_start_class_interface(), objc_continue_interface(), objc_finish_interface(), objc_start_class_implementation(), objc_continue_implementation(), objc_start_category_interface() and objc_start_category_implementation(). (protocoldef): Move semantic actions to objc_start_protocol() and objc_finish_interface(). (ivar_decl_list): Remove nonterminal. (visibility_spec): Move semantic actions to objc_set_visibility(). (ivar_decls): Remove assignment to $$. (ivar_decl): Rephrase in terms of component_decl; call objc_add_instance_variable(). (ivars, ivar_declarator): Remove nonterminals. (opt_semi): New nonterminal. (methodtype): Remove semantic actions. (methoddef): Move semantic actions to objc_set_method_type(), objc_start_method_definition() and objc_finish_method_definition(). (methodproto): Move semantic actions to objc_set_method_type() and objc_add_method_declaration(). (methoddecl): Use objc_typename instead of typename; move semantic actions to objc_build_method_signature(). (optarglist, myxdecls, mydecl, myparms, myparm): Remove nonterminals. (optparmlist): Express in terms of optparms and optellipsis. (optparms, optellipsis, objc_qual, objc_quals, objc_typename): New nonterminals. (keyworddecl): Use objc_typename instead of typename. (rid_to_yy): Mark RID_IN, RID_OUT, RID_INOUT, RID_BYCOPY, RID_BYREF and RID_ONEWAY as returning OBJC_TYPE_QUAL to yyparse(). [gcc/objc/ChangeLog] 2004-09-07 Ziemowit Laski <zlaski@apple.com> * Make-lang.in (objc/objc-parse.o): Depend on $(C_COMMON_H) instead of objc/objc-act.h. (objc/objc-act.o): Depend on $(HASHTAB_H). * objc-act.c: Include hashtab.h; in ObjC++ mode, include cp-tree.h and objcp-decl.h instead of c-tree.h. (build_module_descriptor, get_class_ivars, synth_id_with_class_suffix, error_with_ivar, gen_method_decl, gen_declaration, setup_string_decl, build_protocol_template): Adjust prototypes. (build_module_initializer_routine, start_class, continue_class, finish_class, start_method_def, objc_start_function, start_protocol, build_method_decl, objc_add_method, add_instance_variable, build_ivar_reference, is_ivar, is_private, get_super_receiver, build_selector_table_decl, objc_push_parm, objc_get_parm_info, gen_type_name, gen_type_name_0, start_var_decl, finish_var_decl, create_field_decl): New prototypes. (objc_expand_function_end, comp_method_with_proto, objc_expr_last, gen_declaration_1, gen_declarator, is_complex_decl, adorn_decl, define_decl, create_builtin_decl, gen_declspecs): Remove prototypes. (TYPE_ID): Rename to OBJECT_TYPEDEF_NAME. (CLASS_TYPEDEF_NAME): New. (TAG_EXECCLASS): Change from a global variable to a #define. (TAG_RETURN_STRUCT): Delete. (TAG_GNUINIT): New, holds '__objc_gnu_init' name. (objc_inherit_code, objc_public_flag): New, moved from c-parse.in. (string_descriptor): New struct. (string_htab): New hash table. (string_hash, string_eq): New prototypes. (generate_struct_by_value_array): Call create_field_decl() instead of create_builtin_decl(). (objc_init): Do not initialize objc_ellipsis_node or TAG_EXECCLASS; In ObjC++ mode, call cxx_init() instead of c_objc_common_init(). (objc_finish_file): In ObjC++, call instantiate_pending_templates() and cp_finish_file(). (define_decl, get_static_reference, get_protocol_reference, create_builtin_decl): Remove functions. (objc_start_class_interface, objc_start_category_interface, objc_start_protocol, objc_continue_interface, objc_finish_interface, objc_start_class_implementation, objc_start_category_implementation, objc_continue_implementation, objc_finish_implementation, objc_set_visibility, objc_set_method_type, objc_build_method_signature, objc_add_method_declaration, objc_start_method_definition, objc_add_instance_variable, objc_get_protocol_qualified_type, create_field_decl, start_var_decl, finish_var_decl): New functions. (setup_string_decl): Simplify since it is only called once. (synth_module_prologue): Call build_class_template(); predefine 'id' and 'Class' as typedefs; rename 'temp_type' to 'type'; disable debug hooks for duration of function; fix GNU runtime messenger signatures to correspond to reality; forward-declare '__objc_exec_class' for the GNU runtime; call build_selector_table_decl(); in ObjC++ mode, generate 'extern "C" { ... }' wrappers around synthesized declarations; call build_protocol_template() and build_category_template(). (string_hash, string_eq): New functions. (objc_build_string_object): Check metaclass correctness only once; store string literals in hash table. (objc_build_constructor): Do not convert initializer elements; adjust for ObjC++ impedance mismatch. (build_objc_symtab_template): Call create_field_decl() instead of create_builtin_decl(). (init_objc_symtab): Add missing conversion to initializer element. (build_metadata_decl): Call start_var_decl() instead of define_decl(). (generate_objc_symtab_decl): Do not call build_category_template(); call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(). (build_module_descriptor): Call create_field_decl() instead of grokfield(); call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(); always mark module descriptor as used; move GNU runtime-specific functionality to build_module_initializer_routine(). (build_module_initializer_routine): New function, broken off of build_module_descriptor(). (objc_static_init_needed_p, objc_generate_static_init_call): New functions. (generate_static_references, generate_strings, build_selector_translation_table, generate_descriptor_table, generate_ivars_list, generate_dispatch_table, generate_category): Call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(); build a type directly instead of via groktypename(). (build_selector_reference_decl, build_selector_table_decl, build_class_reference_decl, build_protocol_reference, generate_objc_image_info): Call start_var_decl() instead of build_decl(). (build_selector_reference): For GNU runtime, do not call build_selector_reference_decl(). (build_selector, build_typed_selector_reference): Always convert result to the selector type. (add_objc_string): Cast return value to 'char *'. (build_method_prototype_template, build_selector_template, build_method_template): Use actual selector type for fields pointing to selectors. (finish_objc): For GNU runtime, call build_module_initializer_routine() after build_module_descriptor(). (generate_protocol_list, generate_shared_structures): Call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(); build a type directly instead of via groktypename(). (synth_id_with_class_suffix): Return a string. (get_arg_type_list): For instance methods, use the instance type for 'self'; do not call groktypename_in_parm_context(). (build_objc_string_decl): Squash redeclaration errors in ObjC++. (objc_is_class_name): Use OBJC_TYPE_NAME instead of TYPE_NAME; handle RECORD_TYPEs in ObjC as well as ObjC++. (objc_is_id): New function. (objc_is_object_ptr): Return the canonical type node. (objc_get_class_ivars): Simplify using get_class_ivars(). (get_class_ivars): Remove second parameter; create a fresh copy of the ivar list for each call; do not check for existence of super class. (objc_eh_runtime_type): Mark #ifndef OBJCPLUS. (objc_init_exceptions): When using SJLJ-style exceptions, require the use of '-fobjc-exceptions' flag; do not require it for DWARF-style exceptions. (objc_build_exc_ptr, next_sjlj_build_try_catch_finally): Use objc_object_type instead of objc_id_type. (objc_begin_catch_clause): Convert the incoming PARM_DECL into a VAR_DECL before placing it in the appropriate scope; do not call define_decl(); adjust call to c_begin_compound_stmt(); use objc_object_type instead of objc_id_type. (build_next_objc_exception_stuff): Call create_field_decl() instead of create_builtin_decl(); construct type directly instead of calling groktypename(); use OBJC_VOID_AT_END to mark end of function parameters. (build_private_template): Adjust call to get_class_ivars(); build a type directly instead of via groktypename(). (build_protocol_template, build_method_prototype_list_template, build_method_prototype_template, build_category_template, build_selector_template, build_class_template, build_super_template, build_ivar_template, build_ivar_list_template, build_method_list_template, build_method_template): Call create_field_decl() instead of grokfield(). (objc_method_parm_type): Do not call groktypename(). (generate_descriptor_table): Call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(). (generate_method_descriptors, build_protocol_initializer, generate_dispatch_tables, build_category_initializer, build_shared_structure_initializer): Do not call groktypename(). (generate_protocols): Call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(); do not call groktypename(). (error_with_ivar): Remove last parameter. (check_ivars): Do not iterate ovar CLASS_RAW_IVARS lists in addition to CLASS_IVARS lists; adjust calls to error_with_ivar(). (generate_ivar_lists): Convert one of the initializer elements; do not call groktypename(). (get_arg_type_list, start_method_def, gen_method_def): Account for new representation of variable arguments and '...' in Objective-C methods; add Objective-C++ impedance matching code. (is_objc_type_qualifier): Remove function. (adjust_type_for_id_default): Simplify; there is no longer a need to wade through declspecs. (lookup_interface, start_class, continue_class, finish_class, start_method_def, start_protocol, build_method_decl, objc_add_method, add_instance_variable, build_ivar_reference, is_ivar, is_private, get_super_receiver, objc_build_finally_epilogue): Make into static functions. (receiver_is_class_object): Use new IS_CLASS() macro. (objc_build_message_expr): Tweak ObjC++ message argument handling; call objc_finish_message_expr() instead of finish_message_expr(). (finish_message_expr): Rename to objc_finish_message_expr(); use OBJC_TYPE_NAME and OBJC_SET_TYPE_NAME macros instead of TYPE_NAME. call gen_type_name() instead of gen_declaration(); call objc_is_id() instead of using IS_ID and IS_CLASS; Use objc_class_name instead of calling get_identifier("Class"); handle CONVERT_EXPRs in receiver. (build_objc_method_call, warn_with_method): Do not call groktypename(). (build_ivar_reference): Call convert() instead of clobbering in a type. (hash_init): Initialize string_htab hash table. (add_instance_variable): Simplify parameter list; do not call grokfield(); do not populate CLASS_IVARS list. (start_class): Check for the existence of super class, if one was specified. (continue_class): Use CLASS_RAW_IVARS rather than CLASS_IVARS; do not call build_class_template(); adjust call to get_class_ivars(); call build_decl(), pushdecl() and finish_decl() instead of define_decl(). (finish_class): Call build_decl(), pushdecl() and finish_decl() instead of define_decl(). (add_protocols): Use PROTOCOL_BINFO_ELTS for the tree vector size. (start_protocol): Do not call build_protocol_template(); use PROTOCOL_BINFO_ELTS for the tree vector size. (encode_type_qualifiers): Do not handle the 'const' qualifier here. (encode_pointer): Encode 'const char *' as 'r*', for backwards compatibility. (encode_array): Use HOST_WIDE_INT_PRINT_DEC instead of "%ld". (encode_type): Handle the 'const' qualifier here. (objc_parmlist): New global variable, sued by objc_push_parm and objc_get_parm_info(). (objc_push_parm, objc_get_parm_info): New functions. (objc_expr_last): Remove function. (synth_self_and_ucmd_args): For instance methods, use the instance type for 'self'; call objc_push_parm() instead of push_parm_decl(). (start_method_def): Do not call push_scope(), declare_parm_level(), pop_scope(), push_parm_decl(), store_parm_decls() or objc_expr_last(); just use objc_push_parm() and objc_get_parm_info(). (comp_method_with_proto): Remove function. (objc_types_are_equivalent): Strip away indirections before comparing underlying types. (comp_proto_with_proto): Do not call groktypename(); types are no longer in raw declspec format. (objc_start_function): New function. (really_start_method): Call comp_proto_with_proto() instead of comp_method_with_proto(); call objc_start_function() instead of hand-crafting a function declarator. (continue_method_def, objc_expand_function_end): Remove functions. (get_super_receiver): Call objc_get_current_scope() instead of get_current_scope(); reference 'super_class' field (instead of 'class'). (finish_method_def): Rename to objc_finish_method_definition() and add a function decl parameter; move method encoding call from objc_expand_function_end(). (is_complex_decl, adorn_decl, gen_declarator, gen_declspecs, gen_declaration_1): Remove functions. (tmpbuf, RAW_DECLSPEC): Remove. (gen_declaration): Remove second parameter; simplify to deal with TYPE_P nodes instead of raw declspecs. (gen_type_name, gen_type_name_0): New functions. (gen_method_decl): Remove second parameter; call gen_type_name() instead of gen_declaration_1(). (dump_interface): Adjust calls to gen_declaration() and gen_method_decl(); do not allocate a separate string buffer. (init_objc): Allocate a larger string buffer to accommodate dump_interface(); adjust call to build_module_descriptor(); add call to build_module_initializer_routine() for the GNU runtime. (generate_classref_translation_entry): Do not call start_decl(); call finish_var_decl() instead of finish_decl(); call convert() instead of build_c_cast(). * objc-act.h (CLASS_OWN_IVARS): Remove accessor. (CLASS_BINFO_ELTS): Reduce from 6 to 5, now that CLASS_OWN_IVARS is gone. (OCTI_GNU_INIT_DECL, GNU_INIT_decl): New. (OCTI_ELLIPSIS_NODE, objc_ellipsis_node): Remove. (OCTI_ID_ID, id_type, objc_id_id): Rename to OCTI_ID_NAME, objc_object_type and objc_object_name, respectively. (OCTI_CLS_REF, OCTI_CLASS_NAME, objc_class_reference, objc_class_name): New. (IS_CLASS): New macro. (IS_ID, IS_SUPER): Robustify. (OCTI_EXECCLASS_DECL, execclass_decl): New. (finish_file, start_class, continue_class, finish_class, start_method_def, continue_method_def, finish_method_def, start_protocol, finish_protocol, objc_build_throw_stmt, objc_build_try_catch_finally_stmt, objc_build_synchronized_prologue, objc_build_synchronized_epilogue, objc_build_try_prologue, objc_build_try_epilogue, objc_build_catch_stmt, objc_build_catch_epilogue, objc_build_finally_prologue, objc_build_finally_epilogue, is_ivar, is_private, is_public, add_instance_variable, objc_add_method, get_super_receiver, objc_clear_super_receiver, get_class_ivars_from_name, get_class_reference, get_static_reference, get_object_reference, build_message_expr, finish_message_expr, build_selector_expr, build_ivar_reference, build_keyword_decl, build_method_decl, build_protocol_expr, build_objc_string_object, objc_declare_alias, objc_declare_class, objc_declare_protocols, objc_comptypes, objc_check_decl, build_encode_expr): Remove prototypes. (imp_count, cat_count): Make GGC-aware. (OBJC_SET_TYPE_NAME): New macro. From-SVN: r87168
2004-09-08 02:49:44 +02:00
finish_var_decl (decl, initlist);
1992-01-18 00:15:38 +01:00
}
/* static struct objc_class _OBJC_METACLASS_Foo={ ... };
static struct objc_class _OBJC_CLASS_Foo={ ... }; */
1992-01-18 00:15:38 +01:00
static void
Yet more Objective-C++... * objc-act.c (objc_finish_try_stmt): Add return value. (objc_build_synchronized): Likewise. * objc-act.c (objc_is_gcable_type): Add. (objc_substitute_decl): Add. (objc_build_ivar_assignment): Add. (objc_build_global_assignment): Add. (objc_build_strong_cast_assignment): Add. (objc_is_ivar_reference_p): Add. (objc_is_global_reference_p): Add. (objc_generate_write_barrier): Add. (objc_rewrite_function_call): Add. (objc_gimplify_expr): Add Objective-C++ support. * objc-act.h (ALLOC_OBJC_TYPE_LANG_SPECIFIC): Likewise. (SIZEOF_OBJC_TYPE_LANG_SPECIFIC): Add. (INIT_TYPE_OBJC_INFO): Add Objective-C++ support. (DUP_TYPE_OBJC_INFO): Likewise. (struct imp_entry): Add field has_cxx_cdtors. (struct imp_entry *imp_list): Add OCTI_UMSG_FAST_DECL, OCTI_METH_LIST_TEMPL, OCTI_METH_PROTO_LIST_TEMPL, OCTI_IVAR_LIST_TEMPL, OCTI_ASSIGN_IVAR_DECL, OCTI_ASSIGN_IVAR_FAST_DECL, OCTI_ASSIGN_GLOBAL_DECL, OCTI_ASSIGN_STRONGCAST_DECL. (umsg_fast_decl): Add. (objc_assign_ivar_decl): Add. (objc_assign_ivar_fast_decl): Add. (objc_assign_global_decl): Add. (objc_assign_strong_cast_decl): Add. (objc_method_list_ptr): Add. (objc_method_proto_list_ptr): Add. (objc_ivar_list_ptr): Add. * objc-act.c (should_call_super_dealloc): Add. (OBJC_VERSION): Bump to 6. (objc_is_gcable_type): Add. (objc_substitute_decl): Add. (objc_build_ivar_assignment): Add. (objc_build_global_assignment): Add. (objc_build_strong_cast_assignment): Add. (objc_is_gcable_p): Add. (objc_is_ivar_reference_p): Add. (objc_is_global_reference_p): Add. (generate_shared_structures): Add flags parameter. (objc_generate_cxx_ctor_or_dtor): Add. (objc_generate_cxx_cdtors): Add. (add_class): Add name parameter. (objc_types_share_size_and_alignment): Add. (comp_proto_with_proto): Add strict parameter. (CLS_HAS_CXX_STRUCTORS): Add. (TAG_ASSIGNIVAR): Add. (TAG_ASSIGNGLOBAL): Add. (TAG_ASSIGNSTRONGCAST): Add. (TAG_MSGSEND_FAST): Add. (TAG_ASSIGNIVAR_FAST): Add. (TAG_CXX_CONSTRUCT): Add. (TAG_CXX_DESTRUCT): Add. (OBJC_LOOKUP_CLASS): Add. (OBJC_LOOKUP_NO_SUPER): Add. (objc_finish_file): Add pch support. (objc_finish_implementation): Add Objective-C++ support. (synth_module_prologue): Likewise. (synth_module_prologue): Add fast dispatching. (objc_get_class_reference): Add Objective-C++ support. (objc_generate_write_barrier): Likewise. (next_sjlj_build_enter_and_setjmp): Likewise. (objc_begin_try_stmt): Likewise. (build_next_objc_exception_stuff): Add fast ivar support. (build_private_template): Mark the record as used so debug information is generated. (build_protocol_template): Add Objective-C++ support. (objc_method_parm_type) Likewise. (objc_generate_cxx_ctor_or_dtor): Likewise. (objc_generate_cxx_cdtors): Likewise. (build_protocol_initializer): Likewise. (build_category_template): Likewise. (build_class_template): Likewise. (build_method_list_template): Likewise. (build_category_initializer): Likewise. (build_shared_structure_initializer): Likewise. (objc_finish_message_expr): Likewise. (build_objc_method_call): Add fast dispatch support. (lookup_method_static): Add support to end search at superclasses. (add_method_to_hash_list): Add strict parameter to comp_proto_with_proto. (objc_add_method): Likewise. (objc_add_method): Also set the interface_value. (add_instance_variable): Add Objective-C++ support. (objc_is_public): Likewise. (start_class): Likewise. (continue_class): Likewise. (encode_aggregate_within): Likewise. (start_method_def): Likewise. (objc_start_function): Clear current_function_returns_value and current_function_returns_null. (really_start_method): Add Objective-C++ support. (objc_finish_method_definition): Add warning for missing [super dealloc]. (finish_objc): Add Objective-C++ support. (generate_objc_image_info): Likewise. (objc_lookup_ivar): Likewise. * objc-act.h (TYPE_HAS_OBJC_INFO): Likewise. (INIT_TYPE_OBJC_INFO): Likewise. (DUP_TYPE_OBJC_INFO): Likewise. From-SVN: r99857
2005-05-17 22:07:08 +02:00
generate_shared_structures (int cls_flags)
1992-01-18 00:15:38 +01:00
{
tree sc_spec, decl_specs, decl;
1992-01-18 00:15:38 +01:00
tree name_expr, super_expr, root_expr;
tree my_root_id = NULL_TREE, my_super_id = NULL_TREE;
tree cast_type, initlist, protocol_decl;
1992-01-18 00:15:38 +01:00
my_super_id = CLASS_SUPER_NAME (implementation_template);
if (my_super_id)
{
add_class_reference (my_super_id);
/* Compute "my_root_id" - this is required for code generation.
the "isa" for all meta class structures points to the root of
the inheritance hierarchy (e.g. "__Object")... */
1992-01-18 00:15:38 +01:00
my_root_id = my_super_id;
do
{
tree my_root_int = lookup_interface (my_root_id);
if (my_root_int && CLASS_SUPER_NAME (my_root_int))
my_root_id = CLASS_SUPER_NAME (my_root_int);
else
break;
}
while (1);
}
else
1996-07-04 00:07:53 +02:00
/* No super class. */
my_root_id = CLASS_NAME (implementation_template);
1992-01-18 00:15:38 +01:00
Makefile.in (c-parse.o): Depend on $(C_COMMON_H). [gcc/ChangeLog] 2004-09-07 Ziemowit Laski <zlaski@apple.com> * Makefile.in (c-parse.o): Depend on $(C_COMMON_H). * c-parse.in: Include c-common.h instead of objc-act.h. (ivar_decl_list, ivar_decls, ivar_decl, ivars, ivar_declarator, myparms, myparm): Remove %type declarations. (methodtype, optparms, OBJC_TYPE_QUAL, objc_quals, objc_qual, objc_typename, objc_try_catch_stmt, optellipsis): Add %type declarations. (objc_inherit_code, objc_public_flag): Remove. (typespec_nonreserved_nonattr): Call objc_get_protocol_qualified_type() instead of get_static_reference() and get_protocol_reference(). (stmt_nocomp): Call grokparm() on @catch parameter. (objcdef): Move semantic action to objc_finish_implementation(). (classdef): Move semantic action to objc_start_class_interface(), objc_continue_interface(), objc_finish_interface(), objc_start_class_implementation(), objc_continue_implementation(), objc_start_category_interface() and objc_start_category_implementation(). (protocoldef): Move semantic actions to objc_start_protocol() and objc_finish_interface(). (ivar_decl_list): Remove nonterminal. (visibility_spec): Move semantic actions to objc_set_visibility(). (ivar_decls): Remove assignment to $$. (ivar_decl): Rephrase in terms of component_decl; call objc_add_instance_variable(). (ivars, ivar_declarator): Remove nonterminals. (opt_semi): New nonterminal. (methodtype): Remove semantic actions. (methoddef): Move semantic actions to objc_set_method_type(), objc_start_method_definition() and objc_finish_method_definition(). (methodproto): Move semantic actions to objc_set_method_type() and objc_add_method_declaration(). (methoddecl): Use objc_typename instead of typename; move semantic actions to objc_build_method_signature(). (optarglist, myxdecls, mydecl, myparms, myparm): Remove nonterminals. (optparmlist): Express in terms of optparms and optellipsis. (optparms, optellipsis, objc_qual, objc_quals, objc_typename): New nonterminals. (keyworddecl): Use objc_typename instead of typename. (rid_to_yy): Mark RID_IN, RID_OUT, RID_INOUT, RID_BYCOPY, RID_BYREF and RID_ONEWAY as returning OBJC_TYPE_QUAL to yyparse(). [gcc/objc/ChangeLog] 2004-09-07 Ziemowit Laski <zlaski@apple.com> * Make-lang.in (objc/objc-parse.o): Depend on $(C_COMMON_H) instead of objc/objc-act.h. (objc/objc-act.o): Depend on $(HASHTAB_H). * objc-act.c: Include hashtab.h; in ObjC++ mode, include cp-tree.h and objcp-decl.h instead of c-tree.h. (build_module_descriptor, get_class_ivars, synth_id_with_class_suffix, error_with_ivar, gen_method_decl, gen_declaration, setup_string_decl, build_protocol_template): Adjust prototypes. (build_module_initializer_routine, start_class, continue_class, finish_class, start_method_def, objc_start_function, start_protocol, build_method_decl, objc_add_method, add_instance_variable, build_ivar_reference, is_ivar, is_private, get_super_receiver, build_selector_table_decl, objc_push_parm, objc_get_parm_info, gen_type_name, gen_type_name_0, start_var_decl, finish_var_decl, create_field_decl): New prototypes. (objc_expand_function_end, comp_method_with_proto, objc_expr_last, gen_declaration_1, gen_declarator, is_complex_decl, adorn_decl, define_decl, create_builtin_decl, gen_declspecs): Remove prototypes. (TYPE_ID): Rename to OBJECT_TYPEDEF_NAME. (CLASS_TYPEDEF_NAME): New. (TAG_EXECCLASS): Change from a global variable to a #define. (TAG_RETURN_STRUCT): Delete. (TAG_GNUINIT): New, holds '__objc_gnu_init' name. (objc_inherit_code, objc_public_flag): New, moved from c-parse.in. (string_descriptor): New struct. (string_htab): New hash table. (string_hash, string_eq): New prototypes. (generate_struct_by_value_array): Call create_field_decl() instead of create_builtin_decl(). (objc_init): Do not initialize objc_ellipsis_node or TAG_EXECCLASS; In ObjC++ mode, call cxx_init() instead of c_objc_common_init(). (objc_finish_file): In ObjC++, call instantiate_pending_templates() and cp_finish_file(). (define_decl, get_static_reference, get_protocol_reference, create_builtin_decl): Remove functions. (objc_start_class_interface, objc_start_category_interface, objc_start_protocol, objc_continue_interface, objc_finish_interface, objc_start_class_implementation, objc_start_category_implementation, objc_continue_implementation, objc_finish_implementation, objc_set_visibility, objc_set_method_type, objc_build_method_signature, objc_add_method_declaration, objc_start_method_definition, objc_add_instance_variable, objc_get_protocol_qualified_type, create_field_decl, start_var_decl, finish_var_decl): New functions. (setup_string_decl): Simplify since it is only called once. (synth_module_prologue): Call build_class_template(); predefine 'id' and 'Class' as typedefs; rename 'temp_type' to 'type'; disable debug hooks for duration of function; fix GNU runtime messenger signatures to correspond to reality; forward-declare '__objc_exec_class' for the GNU runtime; call build_selector_table_decl(); in ObjC++ mode, generate 'extern "C" { ... }' wrappers around synthesized declarations; call build_protocol_template() and build_category_template(). (string_hash, string_eq): New functions. (objc_build_string_object): Check metaclass correctness only once; store string literals in hash table. (objc_build_constructor): Do not convert initializer elements; adjust for ObjC++ impedance mismatch. (build_objc_symtab_template): Call create_field_decl() instead of create_builtin_decl(). (init_objc_symtab): Add missing conversion to initializer element. (build_metadata_decl): Call start_var_decl() instead of define_decl(). (generate_objc_symtab_decl): Do not call build_category_template(); call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(). (build_module_descriptor): Call create_field_decl() instead of grokfield(); call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(); always mark module descriptor as used; move GNU runtime-specific functionality to build_module_initializer_routine(). (build_module_initializer_routine): New function, broken off of build_module_descriptor(). (objc_static_init_needed_p, objc_generate_static_init_call): New functions. (generate_static_references, generate_strings, build_selector_translation_table, generate_descriptor_table, generate_ivars_list, generate_dispatch_table, generate_category): Call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(); build a type directly instead of via groktypename(). (build_selector_reference_decl, build_selector_table_decl, build_class_reference_decl, build_protocol_reference, generate_objc_image_info): Call start_var_decl() instead of build_decl(). (build_selector_reference): For GNU runtime, do not call build_selector_reference_decl(). (build_selector, build_typed_selector_reference): Always convert result to the selector type. (add_objc_string): Cast return value to 'char *'. (build_method_prototype_template, build_selector_template, build_method_template): Use actual selector type for fields pointing to selectors. (finish_objc): For GNU runtime, call build_module_initializer_routine() after build_module_descriptor(). (generate_protocol_list, generate_shared_structures): Call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(); build a type directly instead of via groktypename(). (synth_id_with_class_suffix): Return a string. (get_arg_type_list): For instance methods, use the instance type for 'self'; do not call groktypename_in_parm_context(). (build_objc_string_decl): Squash redeclaration errors in ObjC++. (objc_is_class_name): Use OBJC_TYPE_NAME instead of TYPE_NAME; handle RECORD_TYPEs in ObjC as well as ObjC++. (objc_is_id): New function. (objc_is_object_ptr): Return the canonical type node. (objc_get_class_ivars): Simplify using get_class_ivars(). (get_class_ivars): Remove second parameter; create a fresh copy of the ivar list for each call; do not check for existence of super class. (objc_eh_runtime_type): Mark #ifndef OBJCPLUS. (objc_init_exceptions): When using SJLJ-style exceptions, require the use of '-fobjc-exceptions' flag; do not require it for DWARF-style exceptions. (objc_build_exc_ptr, next_sjlj_build_try_catch_finally): Use objc_object_type instead of objc_id_type. (objc_begin_catch_clause): Convert the incoming PARM_DECL into a VAR_DECL before placing it in the appropriate scope; do not call define_decl(); adjust call to c_begin_compound_stmt(); use objc_object_type instead of objc_id_type. (build_next_objc_exception_stuff): Call create_field_decl() instead of create_builtin_decl(); construct type directly instead of calling groktypename(); use OBJC_VOID_AT_END to mark end of function parameters. (build_private_template): Adjust call to get_class_ivars(); build a type directly instead of via groktypename(). (build_protocol_template, build_method_prototype_list_template, build_method_prototype_template, build_category_template, build_selector_template, build_class_template, build_super_template, build_ivar_template, build_ivar_list_template, build_method_list_template, build_method_template): Call create_field_decl() instead of grokfield(). (objc_method_parm_type): Do not call groktypename(). (generate_descriptor_table): Call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(). (generate_method_descriptors, build_protocol_initializer, generate_dispatch_tables, build_category_initializer, build_shared_structure_initializer): Do not call groktypename(). (generate_protocols): Call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(); do not call groktypename(). (error_with_ivar): Remove last parameter. (check_ivars): Do not iterate ovar CLASS_RAW_IVARS lists in addition to CLASS_IVARS lists; adjust calls to error_with_ivar(). (generate_ivar_lists): Convert one of the initializer elements; do not call groktypename(). (get_arg_type_list, start_method_def, gen_method_def): Account for new representation of variable arguments and '...' in Objective-C methods; add Objective-C++ impedance matching code. (is_objc_type_qualifier): Remove function. (adjust_type_for_id_default): Simplify; there is no longer a need to wade through declspecs. (lookup_interface, start_class, continue_class, finish_class, start_method_def, start_protocol, build_method_decl, objc_add_method, add_instance_variable, build_ivar_reference, is_ivar, is_private, get_super_receiver, objc_build_finally_epilogue): Make into static functions. (receiver_is_class_object): Use new IS_CLASS() macro. (objc_build_message_expr): Tweak ObjC++ message argument handling; call objc_finish_message_expr() instead of finish_message_expr(). (finish_message_expr): Rename to objc_finish_message_expr(); use OBJC_TYPE_NAME and OBJC_SET_TYPE_NAME macros instead of TYPE_NAME. call gen_type_name() instead of gen_declaration(); call objc_is_id() instead of using IS_ID and IS_CLASS; Use objc_class_name instead of calling get_identifier("Class"); handle CONVERT_EXPRs in receiver. (build_objc_method_call, warn_with_method): Do not call groktypename(). (build_ivar_reference): Call convert() instead of clobbering in a type. (hash_init): Initialize string_htab hash table. (add_instance_variable): Simplify parameter list; do not call grokfield(); do not populate CLASS_IVARS list. (start_class): Check for the existence of super class, if one was specified. (continue_class): Use CLASS_RAW_IVARS rather than CLASS_IVARS; do not call build_class_template(); adjust call to get_class_ivars(); call build_decl(), pushdecl() and finish_decl() instead of define_decl(). (finish_class): Call build_decl(), pushdecl() and finish_decl() instead of define_decl(). (add_protocols): Use PROTOCOL_BINFO_ELTS for the tree vector size. (start_protocol): Do not call build_protocol_template(); use PROTOCOL_BINFO_ELTS for the tree vector size. (encode_type_qualifiers): Do not handle the 'const' qualifier here. (encode_pointer): Encode 'const char *' as 'r*', for backwards compatibility. (encode_array): Use HOST_WIDE_INT_PRINT_DEC instead of "%ld". (encode_type): Handle the 'const' qualifier here. (objc_parmlist): New global variable, sued by objc_push_parm and objc_get_parm_info(). (objc_push_parm, objc_get_parm_info): New functions. (objc_expr_last): Remove function. (synth_self_and_ucmd_args): For instance methods, use the instance type for 'self'; call objc_push_parm() instead of push_parm_decl(). (start_method_def): Do not call push_scope(), declare_parm_level(), pop_scope(), push_parm_decl(), store_parm_decls() or objc_expr_last(); just use objc_push_parm() and objc_get_parm_info(). (comp_method_with_proto): Remove function. (objc_types_are_equivalent): Strip away indirections before comparing underlying types. (comp_proto_with_proto): Do not call groktypename(); types are no longer in raw declspec format. (objc_start_function): New function. (really_start_method): Call comp_proto_with_proto() instead of comp_method_with_proto(); call objc_start_function() instead of hand-crafting a function declarator. (continue_method_def, objc_expand_function_end): Remove functions. (get_super_receiver): Call objc_get_current_scope() instead of get_current_scope(); reference 'super_class' field (instead of 'class'). (finish_method_def): Rename to objc_finish_method_definition() and add a function decl parameter; move method encoding call from objc_expand_function_end(). (is_complex_decl, adorn_decl, gen_declarator, gen_declspecs, gen_declaration_1): Remove functions. (tmpbuf, RAW_DECLSPEC): Remove. (gen_declaration): Remove second parameter; simplify to deal with TYPE_P nodes instead of raw declspecs. (gen_type_name, gen_type_name_0): New functions. (gen_method_decl): Remove second parameter; call gen_type_name() instead of gen_declaration_1(). (dump_interface): Adjust calls to gen_declaration() and gen_method_decl(); do not allocate a separate string buffer. (init_objc): Allocate a larger string buffer to accommodate dump_interface(); adjust call to build_module_descriptor(); add call to build_module_initializer_routine() for the GNU runtime. (generate_classref_translation_entry): Do not call start_decl(); call finish_var_decl() instead of finish_decl(); call convert() instead of build_c_cast(). * objc-act.h (CLASS_OWN_IVARS): Remove accessor. (CLASS_BINFO_ELTS): Reduce from 6 to 5, now that CLASS_OWN_IVARS is gone. (OCTI_GNU_INIT_DECL, GNU_INIT_decl): New. (OCTI_ELLIPSIS_NODE, objc_ellipsis_node): Remove. (OCTI_ID_ID, id_type, objc_id_id): Rename to OCTI_ID_NAME, objc_object_type and objc_object_name, respectively. (OCTI_CLS_REF, OCTI_CLASS_NAME, objc_class_reference, objc_class_name): New. (IS_CLASS): New macro. (IS_ID, IS_SUPER): Robustify. (OCTI_EXECCLASS_DECL, execclass_decl): New. (finish_file, start_class, continue_class, finish_class, start_method_def, continue_method_def, finish_method_def, start_protocol, finish_protocol, objc_build_throw_stmt, objc_build_try_catch_finally_stmt, objc_build_synchronized_prologue, objc_build_synchronized_epilogue, objc_build_try_prologue, objc_build_try_epilogue, objc_build_catch_stmt, objc_build_catch_epilogue, objc_build_finally_prologue, objc_build_finally_epilogue, is_ivar, is_private, is_public, add_instance_variable, objc_add_method, get_super_receiver, objc_clear_super_receiver, get_class_ivars_from_name, get_class_reference, get_static_reference, get_object_reference, build_message_expr, finish_message_expr, build_selector_expr, build_ivar_reference, build_keyword_decl, build_method_decl, build_protocol_expr, build_objc_string_object, objc_declare_alias, objc_declare_class, objc_declare_protocols, objc_comptypes, objc_check_decl, build_encode_expr): Remove prototypes. (imp_count, cat_count): Make GGC-aware. (OBJC_SET_TYPE_NAME): New macro. From-SVN: r87168
2004-09-08 02:49:44 +02:00
cast_type = build_pointer_type (objc_class_template);
name_expr = add_objc_string (CLASS_NAME (implementation_template),
class_names);
1992-01-18 00:15:38 +01:00
1996-07-04 00:07:53 +02:00
/* Install class `isa' and `super' pointers at runtime. */
1992-01-18 00:15:38 +01:00
if (my_super_id)
{
super_expr = add_objc_string (my_super_id, class_names);
super_expr = build_c_cast (cast_type, super_expr); /* cast! */
1992-01-18 00:15:38 +01:00
}
else
tree.h (build_int_cst): New, sign extended constant. * tree.h (build_int_cst): New, sign extended constant. (build_int_cstu): New, zero extended constant. (build_int_cst_wide): Renamed from build_int_cst. * tree.c (build_int_cst, build_int_cstu): New. (build_int_cst_wide): Renamed from build_int_cst. (make_vector_type, build_common_tree_nodes, build_common_tree_nodes_2): Adjust build_int_cst calls. * builtins.c (expand_builtin_prefetch, expand_builtin_strstr, expand_builtin_strpbrk, expand_builtin_fputs, build_string_literal, expand_builtin_printf, expand_builtin_sprintf, fold_builtin_classify_type, fold_builtin_lround, fold_builtin_bitop, fold_builtin_isascii, fold_builtin_toascii, fold_builtin_isdigit, simplify_builtin_strstr, simplify_builtin_strpbrk, fold_builtin_fputs, simplify_builtin_sprintf): Likewise. * c-common.c (start_fname_decls, fix_string_type, shorten_compare, DEF_ATTR_INT): Likewise. * c-decl.c (complete_array_type, check_bitfield_type_and_width): Likewise. * c-lex.c (interpret_integer, lex_charconst): Likewise. * c-parse.in (primary) <TYPES_COMPATIBLE_P> Likewise. * c-pretty-print.c (pp_c_integer_constant): Likewise. * c-typeck.c (really_start_incremental_init, push_init_level, set_nonincremental_init_from_string): Likewise. * calls.c (load_register_parameters): Likewise. convert.c (convert_to_pointer): Likewise. coverage.c (coverage_counter_alloc, tree_coverage_counter_ref, build_fn_info_type, build_fn_info_value, build_ctr_info_value, build_gcov_info): Likewise. * except.c (init_eh, assign_filter_values): Likewise. * expmed.c (store_fixed_bit_field, extract_bit_field, extract_fixed_bit_field, extract_split_bit_field, expand_shift, expand_mult_const, expand_mult_highpart_adjust, extract_high_half, expand_sdiv_pow2, expand_divmod, make_tree): Likewise. * expr.c (convert_move, emit_group_load, emit_group_store, expand_assignment, store_constructor, store_field, expand_expr_real_1, reduce_to_bit_field_precision): Likewise. fold-const.c (force_fit_type, int_const_binop, fold_convert_const, invert_truthvalue, optimize_bit_field_compare, decode_field_reference, all_ones_mask_p, constant_boolean_node, fold_div_compare, fold, fold_read_from_constant_string, fold_negate_const, fold_abs_const, fold_not_const, round_up, round_down): Likewise. * function.c (assign_parm_setup_block): Likewise. * stmt.c (shift_return_value, expand_case, estimate_case_costs): Likewise. * stor-layout.c (layout_type, initialize_sizetypes, set_min_and_max_values_for_integral_type): Likewise. * tree-chrec.c (chrec_fold_multiply_poly_poly, reset_evolution_in_loop): Likewise. * tree-chrec.h (build_polynomial_chrec): Likewise. * tree-complex.c (build_replicated_const): Likewise. * tree-eh.c (honor_protect_cleanup_actions, lower_try_finally_onedest, lower_try_finally_copy, lower_try_finally_switch): Likewise. * tree-mudflap.c (mf_build_string, mx_register_decls, mudflap_register_call, mudflap_enqueue_constant): Likewise. * tree-nested.c (get_trampoline_type, get_nl_goto_field): Likewise. * tree-pretty-print.c (dump_generic_node): Likewise. * tree-ssa-ccp.c (widen_bitfield, maybe_fold_offset_to_array_ref): Likewise. * tree-ssa-dom.c (simplify_rhs_and_lookup_avail_expr): Likewise. * tree-ssa-loop-niter.c (number_of_iterations_cond, loop_niter_by_eval, upper_bound_in_type, lower_bound_in_type): Likewise. * tree-ssa-loop-ivcanon.c (create_canonical_iv, canonicalize_loop_induction_variables): Likewise. * tree-vectorizer.c (vect_create_index_for_array_ref, vect_transform_loop_bound, vect_compute_data_ref_alignment): Likewise. * config/alpha/alpha.c (alpha_initialize_trampoline, alpha_va_start, alpha_gimplify_va_arg_1): Likewise. * config/arm/arm.c (arm_get_cookie_size): Likewise. * config/c4x/c4x.c (c4x_gimplify_va_arg_expr): Likewise. * config/i386/i386.c (ix86_va_start, ix86_gimplify_va_arg): Likewise. * config/ia64/ia64.c (ia64_gimplify_va_arg): Likewise. * config/mips/mips.c (mips_build_builtin_va_list, mips_va_start, mips_gimplify_va_arg_expr): Likewise. * config/pa/pa.c (hppa_gimplify_va_arg_expr): Likewise. * config/rs6000/rs6000.c (rs6000_va_start, rs6000_gimplify_va_arg, add_compiler_branch_island): Likewise. * config/s390/s390.c (s390_va_start): Likewise. * config/sh/sh.c (sh_va_start): Likewise. * config/stormy16/stormy16.c (xstormy16_expand_builtin_va_start): Likewise. * config/xtensa/xtensa.c (xtensa_va_start, xtensa_gimplify_va_arg_expr): Likewise. * objc/objc-act.c (build_objc_string_object, build_objc_symtab_template, init_def_list, init_objc_symtab, init_module_descriptor, generate_static_references, build_selector_translation_table, get_proto_encoding, build_typed_selector_reference, build_selector_reference, build_next_objc_exception_stuff, build_method_prototype_list_template, generate_descriptor_table, generate_protocols, build_protocol_initializer, build_ivar_list_template, build_method_list_template, build_ivar_list_initializer, generate_ivars_list, generate_dispatch_table, generate_protocol_list, build_category_initializer, build_shared_structure_initializer, generate_shared_structures, handle_impent, generate_objc_image_info): Likewise. 2004-04-25 Paolo Bonzini <bonzini@gnu.org> * cfglayout.c (duplicate_insn_chain): Remove references to NOTE_INSN_LOOP_VTOP and NOTE_INSN_LOOP_CONT. * cfgloop.h (struct loop): Remove fields vtop, cont and cont_dominator. * cfgrtl.c (rtl_delete_block): Remove handling of NOTE_INSN_LOOP_CONT. * final.c (final_scan_insn): Remove references to NOTE_INSN_LOOP_VTOP and NOTE_INSN_LOOP_CONT. * insn-notes.def (NOTE_INSN_LOOP_VTOP, NOTE_INSN_LOOP_CONT): Remove. * jump.c (squeeze_notes): Remove references to NOTE_INSN_LOOP_VTOP and NOTE_INSN_LOOP_CONT. * loop.c (scan_loops, find_and_verify_loops, for_each_insn_in_loop, check_dbra_loop, loop_dump_aux): Remove references to removed notes and fields. * reorg.c (mostly_true_jump): Do not rely on NOTE_INSN_LOOP_VTOPs. * unroll.c (unroll_loop, copy_loop_body, loop_iterations): Remove references to removed notes and fields. (subtract_reg_term, ujump_to_loop_cont): Remove. From-SVN: r86544
2004-08-25 11:52:54 +02:00
super_expr = build_int_cst (NULL_TREE, 0);
1992-01-18 00:15:38 +01:00
root_expr = add_objc_string (my_root_id, class_names);
root_expr = build_c_cast (cast_type, root_expr); /* cast! */
if (CLASS_PROTOCOL_LIST (implementation_template))
{
generate_protocol_references
(CLASS_PROTOCOL_LIST (implementation_template));
protocol_decl = generate_protocol_list (implementation_template);
}
else
protocol_decl = 0;
1992-01-18 00:15:38 +01:00
/* static struct objc_class _OBJC_METACLASS_Foo = { ... }; */
sc_spec = build_tree_list (NULL_TREE, ridpointers[(int) RID_STATIC]);
decl_specs = tree_cons (NULL_TREE, objc_class_template, sc_spec);
1992-01-18 00:15:38 +01:00
Makefile.in (c-parse.o): Depend on $(C_COMMON_H). [gcc/ChangeLog] 2004-09-07 Ziemowit Laski <zlaski@apple.com> * Makefile.in (c-parse.o): Depend on $(C_COMMON_H). * c-parse.in: Include c-common.h instead of objc-act.h. (ivar_decl_list, ivar_decls, ivar_decl, ivars, ivar_declarator, myparms, myparm): Remove %type declarations. (methodtype, optparms, OBJC_TYPE_QUAL, objc_quals, objc_qual, objc_typename, objc_try_catch_stmt, optellipsis): Add %type declarations. (objc_inherit_code, objc_public_flag): Remove. (typespec_nonreserved_nonattr): Call objc_get_protocol_qualified_type() instead of get_static_reference() and get_protocol_reference(). (stmt_nocomp): Call grokparm() on @catch parameter. (objcdef): Move semantic action to objc_finish_implementation(). (classdef): Move semantic action to objc_start_class_interface(), objc_continue_interface(), objc_finish_interface(), objc_start_class_implementation(), objc_continue_implementation(), objc_start_category_interface() and objc_start_category_implementation(). (protocoldef): Move semantic actions to objc_start_protocol() and objc_finish_interface(). (ivar_decl_list): Remove nonterminal. (visibility_spec): Move semantic actions to objc_set_visibility(). (ivar_decls): Remove assignment to $$. (ivar_decl): Rephrase in terms of component_decl; call objc_add_instance_variable(). (ivars, ivar_declarator): Remove nonterminals. (opt_semi): New nonterminal. (methodtype): Remove semantic actions. (methoddef): Move semantic actions to objc_set_method_type(), objc_start_method_definition() and objc_finish_method_definition(). (methodproto): Move semantic actions to objc_set_method_type() and objc_add_method_declaration(). (methoddecl): Use objc_typename instead of typename; move semantic actions to objc_build_method_signature(). (optarglist, myxdecls, mydecl, myparms, myparm): Remove nonterminals. (optparmlist): Express in terms of optparms and optellipsis. (optparms, optellipsis, objc_qual, objc_quals, objc_typename): New nonterminals. (keyworddecl): Use objc_typename instead of typename. (rid_to_yy): Mark RID_IN, RID_OUT, RID_INOUT, RID_BYCOPY, RID_BYREF and RID_ONEWAY as returning OBJC_TYPE_QUAL to yyparse(). [gcc/objc/ChangeLog] 2004-09-07 Ziemowit Laski <zlaski@apple.com> * Make-lang.in (objc/objc-parse.o): Depend on $(C_COMMON_H) instead of objc/objc-act.h. (objc/objc-act.o): Depend on $(HASHTAB_H). * objc-act.c: Include hashtab.h; in ObjC++ mode, include cp-tree.h and objcp-decl.h instead of c-tree.h. (build_module_descriptor, get_class_ivars, synth_id_with_class_suffix, error_with_ivar, gen_method_decl, gen_declaration, setup_string_decl, build_protocol_template): Adjust prototypes. (build_module_initializer_routine, start_class, continue_class, finish_class, start_method_def, objc_start_function, start_protocol, build_method_decl, objc_add_method, add_instance_variable, build_ivar_reference, is_ivar, is_private, get_super_receiver, build_selector_table_decl, objc_push_parm, objc_get_parm_info, gen_type_name, gen_type_name_0, start_var_decl, finish_var_decl, create_field_decl): New prototypes. (objc_expand_function_end, comp_method_with_proto, objc_expr_last, gen_declaration_1, gen_declarator, is_complex_decl, adorn_decl, define_decl, create_builtin_decl, gen_declspecs): Remove prototypes. (TYPE_ID): Rename to OBJECT_TYPEDEF_NAME. (CLASS_TYPEDEF_NAME): New. (TAG_EXECCLASS): Change from a global variable to a #define. (TAG_RETURN_STRUCT): Delete. (TAG_GNUINIT): New, holds '__objc_gnu_init' name. (objc_inherit_code, objc_public_flag): New, moved from c-parse.in. (string_descriptor): New struct. (string_htab): New hash table. (string_hash, string_eq): New prototypes. (generate_struct_by_value_array): Call create_field_decl() instead of create_builtin_decl(). (objc_init): Do not initialize objc_ellipsis_node or TAG_EXECCLASS; In ObjC++ mode, call cxx_init() instead of c_objc_common_init(). (objc_finish_file): In ObjC++, call instantiate_pending_templates() and cp_finish_file(). (define_decl, get_static_reference, get_protocol_reference, create_builtin_decl): Remove functions. (objc_start_class_interface, objc_start_category_interface, objc_start_protocol, objc_continue_interface, objc_finish_interface, objc_start_class_implementation, objc_start_category_implementation, objc_continue_implementation, objc_finish_implementation, objc_set_visibility, objc_set_method_type, objc_build_method_signature, objc_add_method_declaration, objc_start_method_definition, objc_add_instance_variable, objc_get_protocol_qualified_type, create_field_decl, start_var_decl, finish_var_decl): New functions. (setup_string_decl): Simplify since it is only called once. (synth_module_prologue): Call build_class_template(); predefine 'id' and 'Class' as typedefs; rename 'temp_type' to 'type'; disable debug hooks for duration of function; fix GNU runtime messenger signatures to correspond to reality; forward-declare '__objc_exec_class' for the GNU runtime; call build_selector_table_decl(); in ObjC++ mode, generate 'extern "C" { ... }' wrappers around synthesized declarations; call build_protocol_template() and build_category_template(). (string_hash, string_eq): New functions. (objc_build_string_object): Check metaclass correctness only once; store string literals in hash table. (objc_build_constructor): Do not convert initializer elements; adjust for ObjC++ impedance mismatch. (build_objc_symtab_template): Call create_field_decl() instead of create_builtin_decl(). (init_objc_symtab): Add missing conversion to initializer element. (build_metadata_decl): Call start_var_decl() instead of define_decl(). (generate_objc_symtab_decl): Do not call build_category_template(); call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(). (build_module_descriptor): Call create_field_decl() instead of grokfield(); call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(); always mark module descriptor as used; move GNU runtime-specific functionality to build_module_initializer_routine(). (build_module_initializer_routine): New function, broken off of build_module_descriptor(). (objc_static_init_needed_p, objc_generate_static_init_call): New functions. (generate_static_references, generate_strings, build_selector_translation_table, generate_descriptor_table, generate_ivars_list, generate_dispatch_table, generate_category): Call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(); build a type directly instead of via groktypename(). (build_selector_reference_decl, build_selector_table_decl, build_class_reference_decl, build_protocol_reference, generate_objc_image_info): Call start_var_decl() instead of build_decl(). (build_selector_reference): For GNU runtime, do not call build_selector_reference_decl(). (build_selector, build_typed_selector_reference): Always convert result to the selector type. (add_objc_string): Cast return value to 'char *'. (build_method_prototype_template, build_selector_template, build_method_template): Use actual selector type for fields pointing to selectors. (finish_objc): For GNU runtime, call build_module_initializer_routine() after build_module_descriptor(). (generate_protocol_list, generate_shared_structures): Call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(); build a type directly instead of via groktypename(). (synth_id_with_class_suffix): Return a string. (get_arg_type_list): For instance methods, use the instance type for 'self'; do not call groktypename_in_parm_context(). (build_objc_string_decl): Squash redeclaration errors in ObjC++. (objc_is_class_name): Use OBJC_TYPE_NAME instead of TYPE_NAME; handle RECORD_TYPEs in ObjC as well as ObjC++. (objc_is_id): New function. (objc_is_object_ptr): Return the canonical type node. (objc_get_class_ivars): Simplify using get_class_ivars(). (get_class_ivars): Remove second parameter; create a fresh copy of the ivar list for each call; do not check for existence of super class. (objc_eh_runtime_type): Mark #ifndef OBJCPLUS. (objc_init_exceptions): When using SJLJ-style exceptions, require the use of '-fobjc-exceptions' flag; do not require it for DWARF-style exceptions. (objc_build_exc_ptr, next_sjlj_build_try_catch_finally): Use objc_object_type instead of objc_id_type. (objc_begin_catch_clause): Convert the incoming PARM_DECL into a VAR_DECL before placing it in the appropriate scope; do not call define_decl(); adjust call to c_begin_compound_stmt(); use objc_object_type instead of objc_id_type. (build_next_objc_exception_stuff): Call create_field_decl() instead of create_builtin_decl(); construct type directly instead of calling groktypename(); use OBJC_VOID_AT_END to mark end of function parameters. (build_private_template): Adjust call to get_class_ivars(); build a type directly instead of via groktypename(). (build_protocol_template, build_method_prototype_list_template, build_method_prototype_template, build_category_template, build_selector_template, build_class_template, build_super_template, build_ivar_template, build_ivar_list_template, build_method_list_template, build_method_template): Call create_field_decl() instead of grokfield(). (objc_method_parm_type): Do not call groktypename(). (generate_descriptor_table): Call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(). (generate_method_descriptors, build_protocol_initializer, generate_dispatch_tables, build_category_initializer, build_shared_structure_initializer): Do not call groktypename(). (generate_protocols): Call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(); do not call groktypename(). (error_with_ivar): Remove last parameter. (check_ivars): Do not iterate ovar CLASS_RAW_IVARS lists in addition to CLASS_IVARS lists; adjust calls to error_with_ivar(). (generate_ivar_lists): Convert one of the initializer elements; do not call groktypename(). (get_arg_type_list, start_method_def, gen_method_def): Account for new representation of variable arguments and '...' in Objective-C methods; add Objective-C++ impedance matching code. (is_objc_type_qualifier): Remove function. (adjust_type_for_id_default): Simplify; there is no longer a need to wade through declspecs. (lookup_interface, start_class, continue_class, finish_class, start_method_def, start_protocol, build_method_decl, objc_add_method, add_instance_variable, build_ivar_reference, is_ivar, is_private, get_super_receiver, objc_build_finally_epilogue): Make into static functions. (receiver_is_class_object): Use new IS_CLASS() macro. (objc_build_message_expr): Tweak ObjC++ message argument handling; call objc_finish_message_expr() instead of finish_message_expr(). (finish_message_expr): Rename to objc_finish_message_expr(); use OBJC_TYPE_NAME and OBJC_SET_TYPE_NAME macros instead of TYPE_NAME. call gen_type_name() instead of gen_declaration(); call objc_is_id() instead of using IS_ID and IS_CLASS; Use objc_class_name instead of calling get_identifier("Class"); handle CONVERT_EXPRs in receiver. (build_objc_method_call, warn_with_method): Do not call groktypename(). (build_ivar_reference): Call convert() instead of clobbering in a type. (hash_init): Initialize string_htab hash table. (add_instance_variable): Simplify parameter list; do not call grokfield(); do not populate CLASS_IVARS list. (start_class): Check for the existence of super class, if one was specified. (continue_class): Use CLASS_RAW_IVARS rather than CLASS_IVARS; do not call build_class_template(); adjust call to get_class_ivars(); call build_decl(), pushdecl() and finish_decl() instead of define_decl(). (finish_class): Call build_decl(), pushdecl() and finish_decl() instead of define_decl(). (add_protocols): Use PROTOCOL_BINFO_ELTS for the tree vector size. (start_protocol): Do not call build_protocol_template(); use PROTOCOL_BINFO_ELTS for the tree vector size. (encode_type_qualifiers): Do not handle the 'const' qualifier here. (encode_pointer): Encode 'const char *' as 'r*', for backwards compatibility. (encode_array): Use HOST_WIDE_INT_PRINT_DEC instead of "%ld". (encode_type): Handle the 'const' qualifier here. (objc_parmlist): New global variable, sued by objc_push_parm and objc_get_parm_info(). (objc_push_parm, objc_get_parm_info): New functions. (objc_expr_last): Remove function. (synth_self_and_ucmd_args): For instance methods, use the instance type for 'self'; call objc_push_parm() instead of push_parm_decl(). (start_method_def): Do not call push_scope(), declare_parm_level(), pop_scope(), push_parm_decl(), store_parm_decls() or objc_expr_last(); just use objc_push_parm() and objc_get_parm_info(). (comp_method_with_proto): Remove function. (objc_types_are_equivalent): Strip away indirections before comparing underlying types. (comp_proto_with_proto): Do not call groktypename(); types are no longer in raw declspec format. (objc_start_function): New function. (really_start_method): Call comp_proto_with_proto() instead of comp_method_with_proto(); call objc_start_function() instead of hand-crafting a function declarator. (continue_method_def, objc_expand_function_end): Remove functions. (get_super_receiver): Call objc_get_current_scope() instead of get_current_scope(); reference 'super_class' field (instead of 'class'). (finish_method_def): Rename to objc_finish_method_definition() and add a function decl parameter; move method encoding call from objc_expand_function_end(). (is_complex_decl, adorn_decl, gen_declarator, gen_declspecs, gen_declaration_1): Remove functions. (tmpbuf, RAW_DECLSPEC): Remove. (gen_declaration): Remove second parameter; simplify to deal with TYPE_P nodes instead of raw declspecs. (gen_type_name, gen_type_name_0): New functions. (gen_method_decl): Remove second parameter; call gen_type_name() instead of gen_declaration_1(). (dump_interface): Adjust calls to gen_declaration() and gen_method_decl(); do not allocate a separate string buffer. (init_objc): Allocate a larger string buffer to accommodate dump_interface(); adjust call to build_module_descriptor(); add call to build_module_initializer_routine() for the GNU runtime. (generate_classref_translation_entry): Do not call start_decl(); call finish_var_decl() instead of finish_decl(); call convert() instead of build_c_cast(). * objc-act.h (CLASS_OWN_IVARS): Remove accessor. (CLASS_BINFO_ELTS): Reduce from 6 to 5, now that CLASS_OWN_IVARS is gone. (OCTI_GNU_INIT_DECL, GNU_INIT_decl): New. (OCTI_ELLIPSIS_NODE, objc_ellipsis_node): Remove. (OCTI_ID_ID, id_type, objc_id_id): Rename to OCTI_ID_NAME, objc_object_type and objc_object_name, respectively. (OCTI_CLS_REF, OCTI_CLASS_NAME, objc_class_reference, objc_class_name): New. (IS_CLASS): New macro. (IS_ID, IS_SUPER): Robustify. (OCTI_EXECCLASS_DECL, execclass_decl): New. (finish_file, start_class, continue_class, finish_class, start_method_def, continue_method_def, finish_method_def, start_protocol, finish_protocol, objc_build_throw_stmt, objc_build_try_catch_finally_stmt, objc_build_synchronized_prologue, objc_build_synchronized_epilogue, objc_build_try_prologue, objc_build_try_epilogue, objc_build_catch_stmt, objc_build_catch_epilogue, objc_build_finally_prologue, objc_build_finally_epilogue, is_ivar, is_private, is_public, add_instance_variable, objc_add_method, get_super_receiver, objc_clear_super_receiver, get_class_ivars_from_name, get_class_reference, get_static_reference, get_object_reference, build_message_expr, finish_message_expr, build_selector_expr, build_ivar_reference, build_keyword_decl, build_method_decl, build_protocol_expr, build_objc_string_object, objc_declare_alias, objc_declare_class, objc_declare_protocols, objc_comptypes, objc_check_decl, build_encode_expr): Remove prototypes. (imp_count, cat_count): Make GGC-aware. (OBJC_SET_TYPE_NAME): New macro. From-SVN: r87168
2004-09-08 02:49:44 +02:00
decl = start_var_decl (objc_class_template,
IDENTIFIER_POINTER
(DECL_NAME (UOBJC_METACLASS_decl)));
1992-01-18 00:15:38 +01:00
initlist
= build_shared_structure_initializer
(TREE_TYPE (decl),
root_expr, super_expr, name_expr,
* Clean up usages of TREE_INT_CST_LOW. * c-parse.in (RESTORE_WARN_FLAGS): Use tree_low_cst. * c-parse.y, c-parse.c, objc/objc-parse.y, objc/objc-parse.c: Regenerated. * c-tree.h (min_precision): Move declaration to here. * c-typeck.c (build_binary_op): Use host_integerp and tree_low_cst. (build_unary_op, add_pending_init): Use bit_position. (pending_init_member, process_init_element): Likewise. (really_start_incremental_init, push_init_level, pop_init_level): Don't make copies of nodes or modify them in place, use consistent types when tracking positions, and use tree routines computations. (set_init_index, output_init_element): Likewise. (output_pending_init_elements, process_init_element): Likewise. * dbxout.c (dbxout_type_fields): Use bit_position, host_integerp, tree_low_cst and int_bit_position; also minor cleanup. (dbxout_type_method_1, dbxout_range_type, dbxout_type): Likewise. (print_cst_octal): Precision is unsigned. (dbxout_symbol): Ensure DECL_INITIAL is in-range and use tree_low_cst. * dwarf2out.c (ceiling): Input and output are unsigned HOST_WIDE_INT. (simple_type_align_in_bits): Result is unsigned int. Use tree_int_low_cst and host_integerp. (simple_type_size_in_bits): Result is unsigned HOST_WIDE_INT. (field_byte_offset): Result is HOST_WIDE_INT. Change types of internal variables so alignments are unsigned int, offsets are HOST_WIDE_INT and sizes are unsigned HOST_WIDE_INT. Use host_integerp, tree_low_cst, and int_bit_position. (add_bit_offset_attribute): Likewise. (add_data_member_location_attribute): Use tree_cst_low. (add_bound_info): Use host_integerp, integer_zerop, and integer_onep. (add_bit_size_attribute): Use tree_low_cst. (add_pure_or_virtual_attribute, gen_enumeration_type_die): Likewise. * dwarfout.c: Similar changes to dwarf2out.c. * expr.c (expand_expr, case ARRAY_REF): Remove redundant code. * genoutput.c (n_occurences): Return -1 for null string. (strip_whitespace): Accept null string and make into function. (scan_operands): Reflect above changes. * sdbout.c (plain_type_1): Use host_integerp and tree_low_cst. (sdbout_field_types, sdbout_one_type): Likewise; also use bit_position. * ssa.c (rename_registers): Add missing cast of arg to bzero. * tree.c (int_size_in_bytes): Check for too big to represent. (bit_position, int_bit_position, host_integerp, tree_low_cst): New fns. * tree.h (host_integerp, tree_low_cst, bit_position, int_bit_position): New declarations. (min_precision): Delete from here. * varasm.c (decode_addr_const): Use host_integerp, bit_position, and int_bit_position. * objc/objc-act.c (encode_method_prototype): Sizes are HOST_WIDE_INT. (encode_method_def): Likewise. (build_ivar_list_initializer): Use int_bit_position. (generate_shared_structures): Convert size. (encode_type, encode_complete_bitfield): Use integer_zerop. (encode_bitfield): Use tree_low_cst and int_bit_position. * ch/typeck.c (min_precision): New function. (build_chill_slice): Use host_integerp and tree_low_cst. (expand_constant_to_buffer): Likewise and also int_bit_position. LO is unsigned HOST_WIDE_INT (build_chill_array_ref_1): Make `i' be HOST_WIDE_INT; use tree_low_cst. (extract_constant_from_buffer): Sizes are now HOST_WIDE_INT. Use host_integerp and tree_low_cst. (build_chill_bin_type): Use host_integerp and tree_low_cst. (layout_chill_range_type): Use tree_int_cst_sgn, compare_tree_int, tree_low_cst, and min_precision. (apply_chill_array_layout): Cleanups for types of variables and use tree_int_cst_sgn, compare_tree_int, and tree_low_cst. (apply_chill_field_layout): Likewise. * cp/class.c (build_vbase_path): Use integer_zerop. (build_vtable_entry): Use tree_low_cst. (get_vfield_offset): Use bit_position. (dfs_modify_vtables): New variable vindex_val; `i' is HOST_WIDE_INT. Use tree_low_cst. (check_bitfield_decl): Set DECL_SIZE using convert. (build_base_field): Set DECL_SIZE and DECL_SIZE_UNIT using size_binop. (layout_virtual_bases): DSIZE is unsigned HOST_WIDE_INT. Use tree_low_cst. (finish_struct_1): Use bit_position. (dump_class_hierarchy): Use tree_low_cst. * cp/cp-tree.h (min_precision): Add declaration. * cp/decl.c (xref_tag, xref_basetypes): Use tree_low_cst. * cp/error.c (dump_type_suffix): Use host_integerp and tree_low_cst. (dump_expr): Use integer_zerop, host_integerp, and tree_low_cst. * cp/expr.c (cplus_expand_constant): Use bit_position. * cp/init.c (build_vec_init): Use host_integerp and tree_low_cst. * cp/rtti.c (get_base_offset): Use bit_position. * cp/typeck.c (build_binary_op): Use integer_zerop, compare_tree_int, host_integerp, and tree_low_cst. (pointer_int_sum): Use integer_zerop. (build_component_addr): Use bit_position. * java/class.c (make_field_value): Properly handle sizes. (get_dispatch_vector): Use tree_low_cst and host_integerp. (layout_class_method): Count using trees. * java/decl.c (push_promoted_type): Set TYPE_{MIN,MAX}_VALUE with copy_node. * java/expr.c (java_array_data_offset): Use int_bit_position. (build_newarray, build_anewarray): Use host_integerp and tree_low_cst. (build_invokevirtual): Use tree_low_cst and do computations with trees. From-SVN: r32607
2000-03-17 18:31:58 +01:00
convert (integer_type_node, TYPE_SIZE_UNIT (objc_class_template)),
2 /*CLS_META*/,
UOBJC_CLASS_METHODS_decl,
UOBJC_CLASS_VARIABLES_decl,
protocol_decl);
1992-01-18 00:15:38 +01:00
Makefile.in (c-parse.o): Depend on $(C_COMMON_H). [gcc/ChangeLog] 2004-09-07 Ziemowit Laski <zlaski@apple.com> * Makefile.in (c-parse.o): Depend on $(C_COMMON_H). * c-parse.in: Include c-common.h instead of objc-act.h. (ivar_decl_list, ivar_decls, ivar_decl, ivars, ivar_declarator, myparms, myparm): Remove %type declarations. (methodtype, optparms, OBJC_TYPE_QUAL, objc_quals, objc_qual, objc_typename, objc_try_catch_stmt, optellipsis): Add %type declarations. (objc_inherit_code, objc_public_flag): Remove. (typespec_nonreserved_nonattr): Call objc_get_protocol_qualified_type() instead of get_static_reference() and get_protocol_reference(). (stmt_nocomp): Call grokparm() on @catch parameter. (objcdef): Move semantic action to objc_finish_implementation(). (classdef): Move semantic action to objc_start_class_interface(), objc_continue_interface(), objc_finish_interface(), objc_start_class_implementation(), objc_continue_implementation(), objc_start_category_interface() and objc_start_category_implementation(). (protocoldef): Move semantic actions to objc_start_protocol() and objc_finish_interface(). (ivar_decl_list): Remove nonterminal. (visibility_spec): Move semantic actions to objc_set_visibility(). (ivar_decls): Remove assignment to $$. (ivar_decl): Rephrase in terms of component_decl; call objc_add_instance_variable(). (ivars, ivar_declarator): Remove nonterminals. (opt_semi): New nonterminal. (methodtype): Remove semantic actions. (methoddef): Move semantic actions to objc_set_method_type(), objc_start_method_definition() and objc_finish_method_definition(). (methodproto): Move semantic actions to objc_set_method_type() and objc_add_method_declaration(). (methoddecl): Use objc_typename instead of typename; move semantic actions to objc_build_method_signature(). (optarglist, myxdecls, mydecl, myparms, myparm): Remove nonterminals. (optparmlist): Express in terms of optparms and optellipsis. (optparms, optellipsis, objc_qual, objc_quals, objc_typename): New nonterminals. (keyworddecl): Use objc_typename instead of typename. (rid_to_yy): Mark RID_IN, RID_OUT, RID_INOUT, RID_BYCOPY, RID_BYREF and RID_ONEWAY as returning OBJC_TYPE_QUAL to yyparse(). [gcc/objc/ChangeLog] 2004-09-07 Ziemowit Laski <zlaski@apple.com> * Make-lang.in (objc/objc-parse.o): Depend on $(C_COMMON_H) instead of objc/objc-act.h. (objc/objc-act.o): Depend on $(HASHTAB_H). * objc-act.c: Include hashtab.h; in ObjC++ mode, include cp-tree.h and objcp-decl.h instead of c-tree.h. (build_module_descriptor, get_class_ivars, synth_id_with_class_suffix, error_with_ivar, gen_method_decl, gen_declaration, setup_string_decl, build_protocol_template): Adjust prototypes. (build_module_initializer_routine, start_class, continue_class, finish_class, start_method_def, objc_start_function, start_protocol, build_method_decl, objc_add_method, add_instance_variable, build_ivar_reference, is_ivar, is_private, get_super_receiver, build_selector_table_decl, objc_push_parm, objc_get_parm_info, gen_type_name, gen_type_name_0, start_var_decl, finish_var_decl, create_field_decl): New prototypes. (objc_expand_function_end, comp_method_with_proto, objc_expr_last, gen_declaration_1, gen_declarator, is_complex_decl, adorn_decl, define_decl, create_builtin_decl, gen_declspecs): Remove prototypes. (TYPE_ID): Rename to OBJECT_TYPEDEF_NAME. (CLASS_TYPEDEF_NAME): New. (TAG_EXECCLASS): Change from a global variable to a #define. (TAG_RETURN_STRUCT): Delete. (TAG_GNUINIT): New, holds '__objc_gnu_init' name. (objc_inherit_code, objc_public_flag): New, moved from c-parse.in. (string_descriptor): New struct. (string_htab): New hash table. (string_hash, string_eq): New prototypes. (generate_struct_by_value_array): Call create_field_decl() instead of create_builtin_decl(). (objc_init): Do not initialize objc_ellipsis_node or TAG_EXECCLASS; In ObjC++ mode, call cxx_init() instead of c_objc_common_init(). (objc_finish_file): In ObjC++, call instantiate_pending_templates() and cp_finish_file(). (define_decl, get_static_reference, get_protocol_reference, create_builtin_decl): Remove functions. (objc_start_class_interface, objc_start_category_interface, objc_start_protocol, objc_continue_interface, objc_finish_interface, objc_start_class_implementation, objc_start_category_implementation, objc_continue_implementation, objc_finish_implementation, objc_set_visibility, objc_set_method_type, objc_build_method_signature, objc_add_method_declaration, objc_start_method_definition, objc_add_instance_variable, objc_get_protocol_qualified_type, create_field_decl, start_var_decl, finish_var_decl): New functions. (setup_string_decl): Simplify since it is only called once. (synth_module_prologue): Call build_class_template(); predefine 'id' and 'Class' as typedefs; rename 'temp_type' to 'type'; disable debug hooks for duration of function; fix GNU runtime messenger signatures to correspond to reality; forward-declare '__objc_exec_class' for the GNU runtime; call build_selector_table_decl(); in ObjC++ mode, generate 'extern "C" { ... }' wrappers around synthesized declarations; call build_protocol_template() and build_category_template(). (string_hash, string_eq): New functions. (objc_build_string_object): Check metaclass correctness only once; store string literals in hash table. (objc_build_constructor): Do not convert initializer elements; adjust for ObjC++ impedance mismatch. (build_objc_symtab_template): Call create_field_decl() instead of create_builtin_decl(). (init_objc_symtab): Add missing conversion to initializer element. (build_metadata_decl): Call start_var_decl() instead of define_decl(). (generate_objc_symtab_decl): Do not call build_category_template(); call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(). (build_module_descriptor): Call create_field_decl() instead of grokfield(); call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(); always mark module descriptor as used; move GNU runtime-specific functionality to build_module_initializer_routine(). (build_module_initializer_routine): New function, broken off of build_module_descriptor(). (objc_static_init_needed_p, objc_generate_static_init_call): New functions. (generate_static_references, generate_strings, build_selector_translation_table, generate_descriptor_table, generate_ivars_list, generate_dispatch_table, generate_category): Call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(); build a type directly instead of via groktypename(). (build_selector_reference_decl, build_selector_table_decl, build_class_reference_decl, build_protocol_reference, generate_objc_image_info): Call start_var_decl() instead of build_decl(). (build_selector_reference): For GNU runtime, do not call build_selector_reference_decl(). (build_selector, build_typed_selector_reference): Always convert result to the selector type. (add_objc_string): Cast return value to 'char *'. (build_method_prototype_template, build_selector_template, build_method_template): Use actual selector type for fields pointing to selectors. (finish_objc): For GNU runtime, call build_module_initializer_routine() after build_module_descriptor(). (generate_protocol_list, generate_shared_structures): Call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(); build a type directly instead of via groktypename(). (synth_id_with_class_suffix): Return a string. (get_arg_type_list): For instance methods, use the instance type for 'self'; do not call groktypename_in_parm_context(). (build_objc_string_decl): Squash redeclaration errors in ObjC++. (objc_is_class_name): Use OBJC_TYPE_NAME instead of TYPE_NAME; handle RECORD_TYPEs in ObjC as well as ObjC++. (objc_is_id): New function. (objc_is_object_ptr): Return the canonical type node. (objc_get_class_ivars): Simplify using get_class_ivars(). (get_class_ivars): Remove second parameter; create a fresh copy of the ivar list for each call; do not check for existence of super class. (objc_eh_runtime_type): Mark #ifndef OBJCPLUS. (objc_init_exceptions): When using SJLJ-style exceptions, require the use of '-fobjc-exceptions' flag; do not require it for DWARF-style exceptions. (objc_build_exc_ptr, next_sjlj_build_try_catch_finally): Use objc_object_type instead of objc_id_type. (objc_begin_catch_clause): Convert the incoming PARM_DECL into a VAR_DECL before placing it in the appropriate scope; do not call define_decl(); adjust call to c_begin_compound_stmt(); use objc_object_type instead of objc_id_type. (build_next_objc_exception_stuff): Call create_field_decl() instead of create_builtin_decl(); construct type directly instead of calling groktypename(); use OBJC_VOID_AT_END to mark end of function parameters. (build_private_template): Adjust call to get_class_ivars(); build a type directly instead of via groktypename(). (build_protocol_template, build_method_prototype_list_template, build_method_prototype_template, build_category_template, build_selector_template, build_class_template, build_super_template, build_ivar_template, build_ivar_list_template, build_method_list_template, build_method_template): Call create_field_decl() instead of grokfield(). (objc_method_parm_type): Do not call groktypename(). (generate_descriptor_table): Call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(). (generate_method_descriptors, build_protocol_initializer, generate_dispatch_tables, build_category_initializer, build_shared_structure_initializer): Do not call groktypename(). (generate_protocols): Call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(); do not call groktypename(). (error_with_ivar): Remove last parameter. (check_ivars): Do not iterate ovar CLASS_RAW_IVARS lists in addition to CLASS_IVARS lists; adjust calls to error_with_ivar(). (generate_ivar_lists): Convert one of the initializer elements; do not call groktypename(). (get_arg_type_list, start_method_def, gen_method_def): Account for new representation of variable arguments and '...' in Objective-C methods; add Objective-C++ impedance matching code. (is_objc_type_qualifier): Remove function. (adjust_type_for_id_default): Simplify; there is no longer a need to wade through declspecs. (lookup_interface, start_class, continue_class, finish_class, start_method_def, start_protocol, build_method_decl, objc_add_method, add_instance_variable, build_ivar_reference, is_ivar, is_private, get_super_receiver, objc_build_finally_epilogue): Make into static functions. (receiver_is_class_object): Use new IS_CLASS() macro. (objc_build_message_expr): Tweak ObjC++ message argument handling; call objc_finish_message_expr() instead of finish_message_expr(). (finish_message_expr): Rename to objc_finish_message_expr(); use OBJC_TYPE_NAME and OBJC_SET_TYPE_NAME macros instead of TYPE_NAME. call gen_type_name() instead of gen_declaration(); call objc_is_id() instead of using IS_ID and IS_CLASS; Use objc_class_name instead of calling get_identifier("Class"); handle CONVERT_EXPRs in receiver. (build_objc_method_call, warn_with_method): Do not call groktypename(). (build_ivar_reference): Call convert() instead of clobbering in a type. (hash_init): Initialize string_htab hash table. (add_instance_variable): Simplify parameter list; do not call grokfield(); do not populate CLASS_IVARS list. (start_class): Check for the existence of super class, if one was specified. (continue_class): Use CLASS_RAW_IVARS rather than CLASS_IVARS; do not call build_class_template(); adjust call to get_class_ivars(); call build_decl(), pushdecl() and finish_decl() instead of define_decl(). (finish_class): Call build_decl(), pushdecl() and finish_decl() instead of define_decl(). (add_protocols): Use PROTOCOL_BINFO_ELTS for the tree vector size. (start_protocol): Do not call build_protocol_template(); use PROTOCOL_BINFO_ELTS for the tree vector size. (encode_type_qualifiers): Do not handle the 'const' qualifier here. (encode_pointer): Encode 'const char *' as 'r*', for backwards compatibility. (encode_array): Use HOST_WIDE_INT_PRINT_DEC instead of "%ld". (encode_type): Handle the 'const' qualifier here. (objc_parmlist): New global variable, sued by objc_push_parm and objc_get_parm_info(). (objc_push_parm, objc_get_parm_info): New functions. (objc_expr_last): Remove function. (synth_self_and_ucmd_args): For instance methods, use the instance type for 'self'; call objc_push_parm() instead of push_parm_decl(). (start_method_def): Do not call push_scope(), declare_parm_level(), pop_scope(), push_parm_decl(), store_parm_decls() or objc_expr_last(); just use objc_push_parm() and objc_get_parm_info(). (comp_method_with_proto): Remove function. (objc_types_are_equivalent): Strip away indirections before comparing underlying types. (comp_proto_with_proto): Do not call groktypename(); types are no longer in raw declspec format. (objc_start_function): New function. (really_start_method): Call comp_proto_with_proto() instead of comp_method_with_proto(); call objc_start_function() instead of hand-crafting a function declarator. (continue_method_def, objc_expand_function_end): Remove functions. (get_super_receiver): Call objc_get_current_scope() instead of get_current_scope(); reference 'super_class' field (instead of 'class'). (finish_method_def): Rename to objc_finish_method_definition() and add a function decl parameter; move method encoding call from objc_expand_function_end(). (is_complex_decl, adorn_decl, gen_declarator, gen_declspecs, gen_declaration_1): Remove functions. (tmpbuf, RAW_DECLSPEC): Remove. (gen_declaration): Remove second parameter; simplify to deal with TYPE_P nodes instead of raw declspecs. (gen_type_name, gen_type_name_0): New functions. (gen_method_decl): Remove second parameter; call gen_type_name() instead of gen_declaration_1(). (dump_interface): Adjust calls to gen_declaration() and gen_method_decl(); do not allocate a separate string buffer. (init_objc): Allocate a larger string buffer to accommodate dump_interface(); adjust call to build_module_descriptor(); add call to build_module_initializer_routine() for the GNU runtime. (generate_classref_translation_entry): Do not call start_decl(); call finish_var_decl() instead of finish_decl(); call convert() instead of build_c_cast(). * objc-act.h (CLASS_OWN_IVARS): Remove accessor. (CLASS_BINFO_ELTS): Reduce from 6 to 5, now that CLASS_OWN_IVARS is gone. (OCTI_GNU_INIT_DECL, GNU_INIT_decl): New. (OCTI_ELLIPSIS_NODE, objc_ellipsis_node): Remove. (OCTI_ID_ID, id_type, objc_id_id): Rename to OCTI_ID_NAME, objc_object_type and objc_object_name, respectively. (OCTI_CLS_REF, OCTI_CLASS_NAME, objc_class_reference, objc_class_name): New. (IS_CLASS): New macro. (IS_ID, IS_SUPER): Robustify. (OCTI_EXECCLASS_DECL, execclass_decl): New. (finish_file, start_class, continue_class, finish_class, start_method_def, continue_method_def, finish_method_def, start_protocol, finish_protocol, objc_build_throw_stmt, objc_build_try_catch_finally_stmt, objc_build_synchronized_prologue, objc_build_synchronized_epilogue, objc_build_try_prologue, objc_build_try_epilogue, objc_build_catch_stmt, objc_build_catch_epilogue, objc_build_finally_prologue, objc_build_finally_epilogue, is_ivar, is_private, is_public, add_instance_variable, objc_add_method, get_super_receiver, objc_clear_super_receiver, get_class_ivars_from_name, get_class_reference, get_static_reference, get_object_reference, build_message_expr, finish_message_expr, build_selector_expr, build_ivar_reference, build_keyword_decl, build_method_decl, build_protocol_expr, build_objc_string_object, objc_declare_alias, objc_declare_class, objc_declare_protocols, objc_comptypes, objc_check_decl, build_encode_expr): Remove prototypes. (imp_count, cat_count): Make GGC-aware. (OBJC_SET_TYPE_NAME): New macro. From-SVN: r87168
2004-09-08 02:49:44 +02:00
finish_var_decl (decl, initlist);
1992-01-18 00:15:38 +01:00
/* static struct objc_class _OBJC_CLASS_Foo={ ... }; */
Makefile.in (c-parse.o): Depend on $(C_COMMON_H). [gcc/ChangeLog] 2004-09-07 Ziemowit Laski <zlaski@apple.com> * Makefile.in (c-parse.o): Depend on $(C_COMMON_H). * c-parse.in: Include c-common.h instead of objc-act.h. (ivar_decl_list, ivar_decls, ivar_decl, ivars, ivar_declarator, myparms, myparm): Remove %type declarations. (methodtype, optparms, OBJC_TYPE_QUAL, objc_quals, objc_qual, objc_typename, objc_try_catch_stmt, optellipsis): Add %type declarations. (objc_inherit_code, objc_public_flag): Remove. (typespec_nonreserved_nonattr): Call objc_get_protocol_qualified_type() instead of get_static_reference() and get_protocol_reference(). (stmt_nocomp): Call grokparm() on @catch parameter. (objcdef): Move semantic action to objc_finish_implementation(). (classdef): Move semantic action to objc_start_class_interface(), objc_continue_interface(), objc_finish_interface(), objc_start_class_implementation(), objc_continue_implementation(), objc_start_category_interface() and objc_start_category_implementation(). (protocoldef): Move semantic actions to objc_start_protocol() and objc_finish_interface(). (ivar_decl_list): Remove nonterminal. (visibility_spec): Move semantic actions to objc_set_visibility(). (ivar_decls): Remove assignment to $$. (ivar_decl): Rephrase in terms of component_decl; call objc_add_instance_variable(). (ivars, ivar_declarator): Remove nonterminals. (opt_semi): New nonterminal. (methodtype): Remove semantic actions. (methoddef): Move semantic actions to objc_set_method_type(), objc_start_method_definition() and objc_finish_method_definition(). (methodproto): Move semantic actions to objc_set_method_type() and objc_add_method_declaration(). (methoddecl): Use objc_typename instead of typename; move semantic actions to objc_build_method_signature(). (optarglist, myxdecls, mydecl, myparms, myparm): Remove nonterminals. (optparmlist): Express in terms of optparms and optellipsis. (optparms, optellipsis, objc_qual, objc_quals, objc_typename): New nonterminals. (keyworddecl): Use objc_typename instead of typename. (rid_to_yy): Mark RID_IN, RID_OUT, RID_INOUT, RID_BYCOPY, RID_BYREF and RID_ONEWAY as returning OBJC_TYPE_QUAL to yyparse(). [gcc/objc/ChangeLog] 2004-09-07 Ziemowit Laski <zlaski@apple.com> * Make-lang.in (objc/objc-parse.o): Depend on $(C_COMMON_H) instead of objc/objc-act.h. (objc/objc-act.o): Depend on $(HASHTAB_H). * objc-act.c: Include hashtab.h; in ObjC++ mode, include cp-tree.h and objcp-decl.h instead of c-tree.h. (build_module_descriptor, get_class_ivars, synth_id_with_class_suffix, error_with_ivar, gen_method_decl, gen_declaration, setup_string_decl, build_protocol_template): Adjust prototypes. (build_module_initializer_routine, start_class, continue_class, finish_class, start_method_def, objc_start_function, start_protocol, build_method_decl, objc_add_method, add_instance_variable, build_ivar_reference, is_ivar, is_private, get_super_receiver, build_selector_table_decl, objc_push_parm, objc_get_parm_info, gen_type_name, gen_type_name_0, start_var_decl, finish_var_decl, create_field_decl): New prototypes. (objc_expand_function_end, comp_method_with_proto, objc_expr_last, gen_declaration_1, gen_declarator, is_complex_decl, adorn_decl, define_decl, create_builtin_decl, gen_declspecs): Remove prototypes. (TYPE_ID): Rename to OBJECT_TYPEDEF_NAME. (CLASS_TYPEDEF_NAME): New. (TAG_EXECCLASS): Change from a global variable to a #define. (TAG_RETURN_STRUCT): Delete. (TAG_GNUINIT): New, holds '__objc_gnu_init' name. (objc_inherit_code, objc_public_flag): New, moved from c-parse.in. (string_descriptor): New struct. (string_htab): New hash table. (string_hash, string_eq): New prototypes. (generate_struct_by_value_array): Call create_field_decl() instead of create_builtin_decl(). (objc_init): Do not initialize objc_ellipsis_node or TAG_EXECCLASS; In ObjC++ mode, call cxx_init() instead of c_objc_common_init(). (objc_finish_file): In ObjC++, call instantiate_pending_templates() and cp_finish_file(). (define_decl, get_static_reference, get_protocol_reference, create_builtin_decl): Remove functions. (objc_start_class_interface, objc_start_category_interface, objc_start_protocol, objc_continue_interface, objc_finish_interface, objc_start_class_implementation, objc_start_category_implementation, objc_continue_implementation, objc_finish_implementation, objc_set_visibility, objc_set_method_type, objc_build_method_signature, objc_add_method_declaration, objc_start_method_definition, objc_add_instance_variable, objc_get_protocol_qualified_type, create_field_decl, start_var_decl, finish_var_decl): New functions. (setup_string_decl): Simplify since it is only called once. (synth_module_prologue): Call build_class_template(); predefine 'id' and 'Class' as typedefs; rename 'temp_type' to 'type'; disable debug hooks for duration of function; fix GNU runtime messenger signatures to correspond to reality; forward-declare '__objc_exec_class' for the GNU runtime; call build_selector_table_decl(); in ObjC++ mode, generate 'extern "C" { ... }' wrappers around synthesized declarations; call build_protocol_template() and build_category_template(). (string_hash, string_eq): New functions. (objc_build_string_object): Check metaclass correctness only once; store string literals in hash table. (objc_build_constructor): Do not convert initializer elements; adjust for ObjC++ impedance mismatch. (build_objc_symtab_template): Call create_field_decl() instead of create_builtin_decl(). (init_objc_symtab): Add missing conversion to initializer element. (build_metadata_decl): Call start_var_decl() instead of define_decl(). (generate_objc_symtab_decl): Do not call build_category_template(); call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(). (build_module_descriptor): Call create_field_decl() instead of grokfield(); call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(); always mark module descriptor as used; move GNU runtime-specific functionality to build_module_initializer_routine(). (build_module_initializer_routine): New function, broken off of build_module_descriptor(). (objc_static_init_needed_p, objc_generate_static_init_call): New functions. (generate_static_references, generate_strings, build_selector_translation_table, generate_descriptor_table, generate_ivars_list, generate_dispatch_table, generate_category): Call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(); build a type directly instead of via groktypename(). (build_selector_reference_decl, build_selector_table_decl, build_class_reference_decl, build_protocol_reference, generate_objc_image_info): Call start_var_decl() instead of build_decl(). (build_selector_reference): For GNU runtime, do not call build_selector_reference_decl(). (build_selector, build_typed_selector_reference): Always convert result to the selector type. (add_objc_string): Cast return value to 'char *'. (build_method_prototype_template, build_selector_template, build_method_template): Use actual selector type for fields pointing to selectors. (finish_objc): For GNU runtime, call build_module_initializer_routine() after build_module_descriptor(). (generate_protocol_list, generate_shared_structures): Call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(); build a type directly instead of via groktypename(). (synth_id_with_class_suffix): Return a string. (get_arg_type_list): For instance methods, use the instance type for 'self'; do not call groktypename_in_parm_context(). (build_objc_string_decl): Squash redeclaration errors in ObjC++. (objc_is_class_name): Use OBJC_TYPE_NAME instead of TYPE_NAME; handle RECORD_TYPEs in ObjC as well as ObjC++. (objc_is_id): New function. (objc_is_object_ptr): Return the canonical type node. (objc_get_class_ivars): Simplify using get_class_ivars(). (get_class_ivars): Remove second parameter; create a fresh copy of the ivar list for each call; do not check for existence of super class. (objc_eh_runtime_type): Mark #ifndef OBJCPLUS. (objc_init_exceptions): When using SJLJ-style exceptions, require the use of '-fobjc-exceptions' flag; do not require it for DWARF-style exceptions. (objc_build_exc_ptr, next_sjlj_build_try_catch_finally): Use objc_object_type instead of objc_id_type. (objc_begin_catch_clause): Convert the incoming PARM_DECL into a VAR_DECL before placing it in the appropriate scope; do not call define_decl(); adjust call to c_begin_compound_stmt(); use objc_object_type instead of objc_id_type. (build_next_objc_exception_stuff): Call create_field_decl() instead of create_builtin_decl(); construct type directly instead of calling groktypename(); use OBJC_VOID_AT_END to mark end of function parameters. (build_private_template): Adjust call to get_class_ivars(); build a type directly instead of via groktypename(). (build_protocol_template, build_method_prototype_list_template, build_method_prototype_template, build_category_template, build_selector_template, build_class_template, build_super_template, build_ivar_template, build_ivar_list_template, build_method_list_template, build_method_template): Call create_field_decl() instead of grokfield(). (objc_method_parm_type): Do not call groktypename(). (generate_descriptor_table): Call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(). (generate_method_descriptors, build_protocol_initializer, generate_dispatch_tables, build_category_initializer, build_shared_structure_initializer): Do not call groktypename(). (generate_protocols): Call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(); do not call groktypename(). (error_with_ivar): Remove last parameter. (check_ivars): Do not iterate ovar CLASS_RAW_IVARS lists in addition to CLASS_IVARS lists; adjust calls to error_with_ivar(). (generate_ivar_lists): Convert one of the initializer elements; do not call groktypename(). (get_arg_type_list, start_method_def, gen_method_def): Account for new representation of variable arguments and '...' in Objective-C methods; add Objective-C++ impedance matching code. (is_objc_type_qualifier): Remove function. (adjust_type_for_id_default): Simplify; there is no longer a need to wade through declspecs. (lookup_interface, start_class, continue_class, finish_class, start_method_def, start_protocol, build_method_decl, objc_add_method, add_instance_variable, build_ivar_reference, is_ivar, is_private, get_super_receiver, objc_build_finally_epilogue): Make into static functions. (receiver_is_class_object): Use new IS_CLASS() macro. (objc_build_message_expr): Tweak ObjC++ message argument handling; call objc_finish_message_expr() instead of finish_message_expr(). (finish_message_expr): Rename to objc_finish_message_expr(); use OBJC_TYPE_NAME and OBJC_SET_TYPE_NAME macros instead of TYPE_NAME. call gen_type_name() instead of gen_declaration(); call objc_is_id() instead of using IS_ID and IS_CLASS; Use objc_class_name instead of calling get_identifier("Class"); handle CONVERT_EXPRs in receiver. (build_objc_method_call, warn_with_method): Do not call groktypename(). (build_ivar_reference): Call convert() instead of clobbering in a type. (hash_init): Initialize string_htab hash table. (add_instance_variable): Simplify parameter list; do not call grokfield(); do not populate CLASS_IVARS list. (start_class): Check for the existence of super class, if one was specified. (continue_class): Use CLASS_RAW_IVARS rather than CLASS_IVARS; do not call build_class_template(); adjust call to get_class_ivars(); call build_decl(), pushdecl() and finish_decl() instead of define_decl(). (finish_class): Call build_decl(), pushdecl() and finish_decl() instead of define_decl(). (add_protocols): Use PROTOCOL_BINFO_ELTS for the tree vector size. (start_protocol): Do not call build_protocol_template(); use PROTOCOL_BINFO_ELTS for the tree vector size. (encode_type_qualifiers): Do not handle the 'const' qualifier here. (encode_pointer): Encode 'const char *' as 'r*', for backwards compatibility. (encode_array): Use HOST_WIDE_INT_PRINT_DEC instead of "%ld". (encode_type): Handle the 'const' qualifier here. (objc_parmlist): New global variable, sued by objc_push_parm and objc_get_parm_info(). (objc_push_parm, objc_get_parm_info): New functions. (objc_expr_last): Remove function. (synth_self_and_ucmd_args): For instance methods, use the instance type for 'self'; call objc_push_parm() instead of push_parm_decl(). (start_method_def): Do not call push_scope(), declare_parm_level(), pop_scope(), push_parm_decl(), store_parm_decls() or objc_expr_last(); just use objc_push_parm() and objc_get_parm_info(). (comp_method_with_proto): Remove function. (objc_types_are_equivalent): Strip away indirections before comparing underlying types. (comp_proto_with_proto): Do not call groktypename(); types are no longer in raw declspec format. (objc_start_function): New function. (really_start_method): Call comp_proto_with_proto() instead of comp_method_with_proto(); call objc_start_function() instead of hand-crafting a function declarator. (continue_method_def, objc_expand_function_end): Remove functions. (get_super_receiver): Call objc_get_current_scope() instead of get_current_scope(); reference 'super_class' field (instead of 'class'). (finish_method_def): Rename to objc_finish_method_definition() and add a function decl parameter; move method encoding call from objc_expand_function_end(). (is_complex_decl, adorn_decl, gen_declarator, gen_declspecs, gen_declaration_1): Remove functions. (tmpbuf, RAW_DECLSPEC): Remove. (gen_declaration): Remove second parameter; simplify to deal with TYPE_P nodes instead of raw declspecs. (gen_type_name, gen_type_name_0): New functions. (gen_method_decl): Remove second parameter; call gen_type_name() instead of gen_declaration_1(). (dump_interface): Adjust calls to gen_declaration() and gen_method_decl(); do not allocate a separate string buffer. (init_objc): Allocate a larger string buffer to accommodate dump_interface(); adjust call to build_module_descriptor(); add call to build_module_initializer_routine() for the GNU runtime. (generate_classref_translation_entry): Do not call start_decl(); call finish_var_decl() instead of finish_decl(); call convert() instead of build_c_cast(). * objc-act.h (CLASS_OWN_IVARS): Remove accessor. (CLASS_BINFO_ELTS): Reduce from 6 to 5, now that CLASS_OWN_IVARS is gone. (OCTI_GNU_INIT_DECL, GNU_INIT_decl): New. (OCTI_ELLIPSIS_NODE, objc_ellipsis_node): Remove. (OCTI_ID_ID, id_type, objc_id_id): Rename to OCTI_ID_NAME, objc_object_type and objc_object_name, respectively. (OCTI_CLS_REF, OCTI_CLASS_NAME, objc_class_reference, objc_class_name): New. (IS_CLASS): New macro. (IS_ID, IS_SUPER): Robustify. (OCTI_EXECCLASS_DECL, execclass_decl): New. (finish_file, start_class, continue_class, finish_class, start_method_def, continue_method_def, finish_method_def, start_protocol, finish_protocol, objc_build_throw_stmt, objc_build_try_catch_finally_stmt, objc_build_synchronized_prologue, objc_build_synchronized_epilogue, objc_build_try_prologue, objc_build_try_epilogue, objc_build_catch_stmt, objc_build_catch_epilogue, objc_build_finally_prologue, objc_build_finally_epilogue, is_ivar, is_private, is_public, add_instance_variable, objc_add_method, get_super_receiver, objc_clear_super_receiver, get_class_ivars_from_name, get_class_reference, get_static_reference, get_object_reference, build_message_expr, finish_message_expr, build_selector_expr, build_ivar_reference, build_keyword_decl, build_method_decl, build_protocol_expr, build_objc_string_object, objc_declare_alias, objc_declare_class, objc_declare_protocols, objc_comptypes, objc_check_decl, build_encode_expr): Remove prototypes. (imp_count, cat_count): Make GGC-aware. (OBJC_SET_TYPE_NAME): New macro. From-SVN: r87168
2004-09-08 02:49:44 +02:00
decl = start_var_decl (objc_class_template,
IDENTIFIER_POINTER
(DECL_NAME (UOBJC_CLASS_decl)));
initlist
= build_shared_structure_initializer
(TREE_TYPE (decl),
build_unary_op (ADDR_EXPR, UOBJC_METACLASS_decl, 0),
super_expr, name_expr,
* Clean up usages of TREE_INT_CST_LOW. * c-parse.in (RESTORE_WARN_FLAGS): Use tree_low_cst. * c-parse.y, c-parse.c, objc/objc-parse.y, objc/objc-parse.c: Regenerated. * c-tree.h (min_precision): Move declaration to here. * c-typeck.c (build_binary_op): Use host_integerp and tree_low_cst. (build_unary_op, add_pending_init): Use bit_position. (pending_init_member, process_init_element): Likewise. (really_start_incremental_init, push_init_level, pop_init_level): Don't make copies of nodes or modify them in place, use consistent types when tracking positions, and use tree routines computations. (set_init_index, output_init_element): Likewise. (output_pending_init_elements, process_init_element): Likewise. * dbxout.c (dbxout_type_fields): Use bit_position, host_integerp, tree_low_cst and int_bit_position; also minor cleanup. (dbxout_type_method_1, dbxout_range_type, dbxout_type): Likewise. (print_cst_octal): Precision is unsigned. (dbxout_symbol): Ensure DECL_INITIAL is in-range and use tree_low_cst. * dwarf2out.c (ceiling): Input and output are unsigned HOST_WIDE_INT. (simple_type_align_in_bits): Result is unsigned int. Use tree_int_low_cst and host_integerp. (simple_type_size_in_bits): Result is unsigned HOST_WIDE_INT. (field_byte_offset): Result is HOST_WIDE_INT. Change types of internal variables so alignments are unsigned int, offsets are HOST_WIDE_INT and sizes are unsigned HOST_WIDE_INT. Use host_integerp, tree_low_cst, and int_bit_position. (add_bit_offset_attribute): Likewise. (add_data_member_location_attribute): Use tree_cst_low. (add_bound_info): Use host_integerp, integer_zerop, and integer_onep. (add_bit_size_attribute): Use tree_low_cst. (add_pure_or_virtual_attribute, gen_enumeration_type_die): Likewise. * dwarfout.c: Similar changes to dwarf2out.c. * expr.c (expand_expr, case ARRAY_REF): Remove redundant code. * genoutput.c (n_occurences): Return -1 for null string. (strip_whitespace): Accept null string and make into function. (scan_operands): Reflect above changes. * sdbout.c (plain_type_1): Use host_integerp and tree_low_cst. (sdbout_field_types, sdbout_one_type): Likewise; also use bit_position. * ssa.c (rename_registers): Add missing cast of arg to bzero. * tree.c (int_size_in_bytes): Check for too big to represent. (bit_position, int_bit_position, host_integerp, tree_low_cst): New fns. * tree.h (host_integerp, tree_low_cst, bit_position, int_bit_position): New declarations. (min_precision): Delete from here. * varasm.c (decode_addr_const): Use host_integerp, bit_position, and int_bit_position. * objc/objc-act.c (encode_method_prototype): Sizes are HOST_WIDE_INT. (encode_method_def): Likewise. (build_ivar_list_initializer): Use int_bit_position. (generate_shared_structures): Convert size. (encode_type, encode_complete_bitfield): Use integer_zerop. (encode_bitfield): Use tree_low_cst and int_bit_position. * ch/typeck.c (min_precision): New function. (build_chill_slice): Use host_integerp and tree_low_cst. (expand_constant_to_buffer): Likewise and also int_bit_position. LO is unsigned HOST_WIDE_INT (build_chill_array_ref_1): Make `i' be HOST_WIDE_INT; use tree_low_cst. (extract_constant_from_buffer): Sizes are now HOST_WIDE_INT. Use host_integerp and tree_low_cst. (build_chill_bin_type): Use host_integerp and tree_low_cst. (layout_chill_range_type): Use tree_int_cst_sgn, compare_tree_int, tree_low_cst, and min_precision. (apply_chill_array_layout): Cleanups for types of variables and use tree_int_cst_sgn, compare_tree_int, and tree_low_cst. (apply_chill_field_layout): Likewise. * cp/class.c (build_vbase_path): Use integer_zerop. (build_vtable_entry): Use tree_low_cst. (get_vfield_offset): Use bit_position. (dfs_modify_vtables): New variable vindex_val; `i' is HOST_WIDE_INT. Use tree_low_cst. (check_bitfield_decl): Set DECL_SIZE using convert. (build_base_field): Set DECL_SIZE and DECL_SIZE_UNIT using size_binop. (layout_virtual_bases): DSIZE is unsigned HOST_WIDE_INT. Use tree_low_cst. (finish_struct_1): Use bit_position. (dump_class_hierarchy): Use tree_low_cst. * cp/cp-tree.h (min_precision): Add declaration. * cp/decl.c (xref_tag, xref_basetypes): Use tree_low_cst. * cp/error.c (dump_type_suffix): Use host_integerp and tree_low_cst. (dump_expr): Use integer_zerop, host_integerp, and tree_low_cst. * cp/expr.c (cplus_expand_constant): Use bit_position. * cp/init.c (build_vec_init): Use host_integerp and tree_low_cst. * cp/rtti.c (get_base_offset): Use bit_position. * cp/typeck.c (build_binary_op): Use integer_zerop, compare_tree_int, host_integerp, and tree_low_cst. (pointer_int_sum): Use integer_zerop. (build_component_addr): Use bit_position. * java/class.c (make_field_value): Properly handle sizes. (get_dispatch_vector): Use tree_low_cst and host_integerp. (layout_class_method): Count using trees. * java/decl.c (push_promoted_type): Set TYPE_{MIN,MAX}_VALUE with copy_node. * java/expr.c (java_array_data_offset): Use int_bit_position. (build_newarray, build_anewarray): Use host_integerp and tree_low_cst. (build_invokevirtual): Use tree_low_cst and do computations with trees. From-SVN: r32607
2000-03-17 18:31:58 +01:00
convert (integer_type_node,
TYPE_SIZE_UNIT (CLASS_STATIC_TEMPLATE
(implementation_template))),
Yet more Objective-C++... * objc-act.c (objc_finish_try_stmt): Add return value. (objc_build_synchronized): Likewise. * objc-act.c (objc_is_gcable_type): Add. (objc_substitute_decl): Add. (objc_build_ivar_assignment): Add. (objc_build_global_assignment): Add. (objc_build_strong_cast_assignment): Add. (objc_is_ivar_reference_p): Add. (objc_is_global_reference_p): Add. (objc_generate_write_barrier): Add. (objc_rewrite_function_call): Add. (objc_gimplify_expr): Add Objective-C++ support. * objc-act.h (ALLOC_OBJC_TYPE_LANG_SPECIFIC): Likewise. (SIZEOF_OBJC_TYPE_LANG_SPECIFIC): Add. (INIT_TYPE_OBJC_INFO): Add Objective-C++ support. (DUP_TYPE_OBJC_INFO): Likewise. (struct imp_entry): Add field has_cxx_cdtors. (struct imp_entry *imp_list): Add OCTI_UMSG_FAST_DECL, OCTI_METH_LIST_TEMPL, OCTI_METH_PROTO_LIST_TEMPL, OCTI_IVAR_LIST_TEMPL, OCTI_ASSIGN_IVAR_DECL, OCTI_ASSIGN_IVAR_FAST_DECL, OCTI_ASSIGN_GLOBAL_DECL, OCTI_ASSIGN_STRONGCAST_DECL. (umsg_fast_decl): Add. (objc_assign_ivar_decl): Add. (objc_assign_ivar_fast_decl): Add. (objc_assign_global_decl): Add. (objc_assign_strong_cast_decl): Add. (objc_method_list_ptr): Add. (objc_method_proto_list_ptr): Add. (objc_ivar_list_ptr): Add. * objc-act.c (should_call_super_dealloc): Add. (OBJC_VERSION): Bump to 6. (objc_is_gcable_type): Add. (objc_substitute_decl): Add. (objc_build_ivar_assignment): Add. (objc_build_global_assignment): Add. (objc_build_strong_cast_assignment): Add. (objc_is_gcable_p): Add. (objc_is_ivar_reference_p): Add. (objc_is_global_reference_p): Add. (generate_shared_structures): Add flags parameter. (objc_generate_cxx_ctor_or_dtor): Add. (objc_generate_cxx_cdtors): Add. (add_class): Add name parameter. (objc_types_share_size_and_alignment): Add. (comp_proto_with_proto): Add strict parameter. (CLS_HAS_CXX_STRUCTORS): Add. (TAG_ASSIGNIVAR): Add. (TAG_ASSIGNGLOBAL): Add. (TAG_ASSIGNSTRONGCAST): Add. (TAG_MSGSEND_FAST): Add. (TAG_ASSIGNIVAR_FAST): Add. (TAG_CXX_CONSTRUCT): Add. (TAG_CXX_DESTRUCT): Add. (OBJC_LOOKUP_CLASS): Add. (OBJC_LOOKUP_NO_SUPER): Add. (objc_finish_file): Add pch support. (objc_finish_implementation): Add Objective-C++ support. (synth_module_prologue): Likewise. (synth_module_prologue): Add fast dispatching. (objc_get_class_reference): Add Objective-C++ support. (objc_generate_write_barrier): Likewise. (next_sjlj_build_enter_and_setjmp): Likewise. (objc_begin_try_stmt): Likewise. (build_next_objc_exception_stuff): Add fast ivar support. (build_private_template): Mark the record as used so debug information is generated. (build_protocol_template): Add Objective-C++ support. (objc_method_parm_type) Likewise. (objc_generate_cxx_ctor_or_dtor): Likewise. (objc_generate_cxx_cdtors): Likewise. (build_protocol_initializer): Likewise. (build_category_template): Likewise. (build_class_template): Likewise. (build_method_list_template): Likewise. (build_category_initializer): Likewise. (build_shared_structure_initializer): Likewise. (objc_finish_message_expr): Likewise. (build_objc_method_call): Add fast dispatch support. (lookup_method_static): Add support to end search at superclasses. (add_method_to_hash_list): Add strict parameter to comp_proto_with_proto. (objc_add_method): Likewise. (objc_add_method): Also set the interface_value. (add_instance_variable): Add Objective-C++ support. (objc_is_public): Likewise. (start_class): Likewise. (continue_class): Likewise. (encode_aggregate_within): Likewise. (start_method_def): Likewise. (objc_start_function): Clear current_function_returns_value and current_function_returns_null. (really_start_method): Add Objective-C++ support. (objc_finish_method_definition): Add warning for missing [super dealloc]. (finish_objc): Add Objective-C++ support. (generate_objc_image_info): Likewise. (objc_lookup_ivar): Likewise. * objc-act.h (TYPE_HAS_OBJC_INFO): Likewise. (INIT_TYPE_OBJC_INFO): Likewise. (DUP_TYPE_OBJC_INFO): Likewise. From-SVN: r99857
2005-05-17 22:07:08 +02:00
1 /*CLS_FACTORY*/ | cls_flags,
UOBJC_INSTANCE_METHODS_decl,
UOBJC_INSTANCE_VARIABLES_decl,
protocol_decl);
1992-01-18 00:15:38 +01:00
Makefile.in (c-parse.o): Depend on $(C_COMMON_H). [gcc/ChangeLog] 2004-09-07 Ziemowit Laski <zlaski@apple.com> * Makefile.in (c-parse.o): Depend on $(C_COMMON_H). * c-parse.in: Include c-common.h instead of objc-act.h. (ivar_decl_list, ivar_decls, ivar_decl, ivars, ivar_declarator, myparms, myparm): Remove %type declarations. (methodtype, optparms, OBJC_TYPE_QUAL, objc_quals, objc_qual, objc_typename, objc_try_catch_stmt, optellipsis): Add %type declarations. (objc_inherit_code, objc_public_flag): Remove. (typespec_nonreserved_nonattr): Call objc_get_protocol_qualified_type() instead of get_static_reference() and get_protocol_reference(). (stmt_nocomp): Call grokparm() on @catch parameter. (objcdef): Move semantic action to objc_finish_implementation(). (classdef): Move semantic action to objc_start_class_interface(), objc_continue_interface(), objc_finish_interface(), objc_start_class_implementation(), objc_continue_implementation(), objc_start_category_interface() and objc_start_category_implementation(). (protocoldef): Move semantic actions to objc_start_protocol() and objc_finish_interface(). (ivar_decl_list): Remove nonterminal. (visibility_spec): Move semantic actions to objc_set_visibility(). (ivar_decls): Remove assignment to $$. (ivar_decl): Rephrase in terms of component_decl; call objc_add_instance_variable(). (ivars, ivar_declarator): Remove nonterminals. (opt_semi): New nonterminal. (methodtype): Remove semantic actions. (methoddef): Move semantic actions to objc_set_method_type(), objc_start_method_definition() and objc_finish_method_definition(). (methodproto): Move semantic actions to objc_set_method_type() and objc_add_method_declaration(). (methoddecl): Use objc_typename instead of typename; move semantic actions to objc_build_method_signature(). (optarglist, myxdecls, mydecl, myparms, myparm): Remove nonterminals. (optparmlist): Express in terms of optparms and optellipsis. (optparms, optellipsis, objc_qual, objc_quals, objc_typename): New nonterminals. (keyworddecl): Use objc_typename instead of typename. (rid_to_yy): Mark RID_IN, RID_OUT, RID_INOUT, RID_BYCOPY, RID_BYREF and RID_ONEWAY as returning OBJC_TYPE_QUAL to yyparse(). [gcc/objc/ChangeLog] 2004-09-07 Ziemowit Laski <zlaski@apple.com> * Make-lang.in (objc/objc-parse.o): Depend on $(C_COMMON_H) instead of objc/objc-act.h. (objc/objc-act.o): Depend on $(HASHTAB_H). * objc-act.c: Include hashtab.h; in ObjC++ mode, include cp-tree.h and objcp-decl.h instead of c-tree.h. (build_module_descriptor, get_class_ivars, synth_id_with_class_suffix, error_with_ivar, gen_method_decl, gen_declaration, setup_string_decl, build_protocol_template): Adjust prototypes. (build_module_initializer_routine, start_class, continue_class, finish_class, start_method_def, objc_start_function, start_protocol, build_method_decl, objc_add_method, add_instance_variable, build_ivar_reference, is_ivar, is_private, get_super_receiver, build_selector_table_decl, objc_push_parm, objc_get_parm_info, gen_type_name, gen_type_name_0, start_var_decl, finish_var_decl, create_field_decl): New prototypes. (objc_expand_function_end, comp_method_with_proto, objc_expr_last, gen_declaration_1, gen_declarator, is_complex_decl, adorn_decl, define_decl, create_builtin_decl, gen_declspecs): Remove prototypes. (TYPE_ID): Rename to OBJECT_TYPEDEF_NAME. (CLASS_TYPEDEF_NAME): New. (TAG_EXECCLASS): Change from a global variable to a #define. (TAG_RETURN_STRUCT): Delete. (TAG_GNUINIT): New, holds '__objc_gnu_init' name. (objc_inherit_code, objc_public_flag): New, moved from c-parse.in. (string_descriptor): New struct. (string_htab): New hash table. (string_hash, string_eq): New prototypes. (generate_struct_by_value_array): Call create_field_decl() instead of create_builtin_decl(). (objc_init): Do not initialize objc_ellipsis_node or TAG_EXECCLASS; In ObjC++ mode, call cxx_init() instead of c_objc_common_init(). (objc_finish_file): In ObjC++, call instantiate_pending_templates() and cp_finish_file(). (define_decl, get_static_reference, get_protocol_reference, create_builtin_decl): Remove functions. (objc_start_class_interface, objc_start_category_interface, objc_start_protocol, objc_continue_interface, objc_finish_interface, objc_start_class_implementation, objc_start_category_implementation, objc_continue_implementation, objc_finish_implementation, objc_set_visibility, objc_set_method_type, objc_build_method_signature, objc_add_method_declaration, objc_start_method_definition, objc_add_instance_variable, objc_get_protocol_qualified_type, create_field_decl, start_var_decl, finish_var_decl): New functions. (setup_string_decl): Simplify since it is only called once. (synth_module_prologue): Call build_class_template(); predefine 'id' and 'Class' as typedefs; rename 'temp_type' to 'type'; disable debug hooks for duration of function; fix GNU runtime messenger signatures to correspond to reality; forward-declare '__objc_exec_class' for the GNU runtime; call build_selector_table_decl(); in ObjC++ mode, generate 'extern "C" { ... }' wrappers around synthesized declarations; call build_protocol_template() and build_category_template(). (string_hash, string_eq): New functions. (objc_build_string_object): Check metaclass correctness only once; store string literals in hash table. (objc_build_constructor): Do not convert initializer elements; adjust for ObjC++ impedance mismatch. (build_objc_symtab_template): Call create_field_decl() instead of create_builtin_decl(). (init_objc_symtab): Add missing conversion to initializer element. (build_metadata_decl): Call start_var_decl() instead of define_decl(). (generate_objc_symtab_decl): Do not call build_category_template(); call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(). (build_module_descriptor): Call create_field_decl() instead of grokfield(); call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(); always mark module descriptor as used; move GNU runtime-specific functionality to build_module_initializer_routine(). (build_module_initializer_routine): New function, broken off of build_module_descriptor(). (objc_static_init_needed_p, objc_generate_static_init_call): New functions. (generate_static_references, generate_strings, build_selector_translation_table, generate_descriptor_table, generate_ivars_list, generate_dispatch_table, generate_category): Call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(); build a type directly instead of via groktypename(). (build_selector_reference_decl, build_selector_table_decl, build_class_reference_decl, build_protocol_reference, generate_objc_image_info): Call start_var_decl() instead of build_decl(). (build_selector_reference): For GNU runtime, do not call build_selector_reference_decl(). (build_selector, build_typed_selector_reference): Always convert result to the selector type. (add_objc_string): Cast return value to 'char *'. (build_method_prototype_template, build_selector_template, build_method_template): Use actual selector type for fields pointing to selectors. (finish_objc): For GNU runtime, call build_module_initializer_routine() after build_module_descriptor(). (generate_protocol_list, generate_shared_structures): Call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(); build a type directly instead of via groktypename(). (synth_id_with_class_suffix): Return a string. (get_arg_type_list): For instance methods, use the instance type for 'self'; do not call groktypename_in_parm_context(). (build_objc_string_decl): Squash redeclaration errors in ObjC++. (objc_is_class_name): Use OBJC_TYPE_NAME instead of TYPE_NAME; handle RECORD_TYPEs in ObjC as well as ObjC++. (objc_is_id): New function. (objc_is_object_ptr): Return the canonical type node. (objc_get_class_ivars): Simplify using get_class_ivars(). (get_class_ivars): Remove second parameter; create a fresh copy of the ivar list for each call; do not check for existence of super class. (objc_eh_runtime_type): Mark #ifndef OBJCPLUS. (objc_init_exceptions): When using SJLJ-style exceptions, require the use of '-fobjc-exceptions' flag; do not require it for DWARF-style exceptions. (objc_build_exc_ptr, next_sjlj_build_try_catch_finally): Use objc_object_type instead of objc_id_type. (objc_begin_catch_clause): Convert the incoming PARM_DECL into a VAR_DECL before placing it in the appropriate scope; do not call define_decl(); adjust call to c_begin_compound_stmt(); use objc_object_type instead of objc_id_type. (build_next_objc_exception_stuff): Call create_field_decl() instead of create_builtin_decl(); construct type directly instead of calling groktypename(); use OBJC_VOID_AT_END to mark end of function parameters. (build_private_template): Adjust call to get_class_ivars(); build a type directly instead of via groktypename(). (build_protocol_template, build_method_prototype_list_template, build_method_prototype_template, build_category_template, build_selector_template, build_class_template, build_super_template, build_ivar_template, build_ivar_list_template, build_method_list_template, build_method_template): Call create_field_decl() instead of grokfield(). (objc_method_parm_type): Do not call groktypename(). (generate_descriptor_table): Call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(). (generate_method_descriptors, build_protocol_initializer, generate_dispatch_tables, build_category_initializer, build_shared_structure_initializer): Do not call groktypename(). (generate_protocols): Call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(); do not call groktypename(). (error_with_ivar): Remove last parameter. (check_ivars): Do not iterate ovar CLASS_RAW_IVARS lists in addition to CLASS_IVARS lists; adjust calls to error_with_ivar(). (generate_ivar_lists): Convert one of the initializer elements; do not call groktypename(). (get_arg_type_list, start_method_def, gen_method_def): Account for new representation of variable arguments and '...' in Objective-C methods; add Objective-C++ impedance matching code. (is_objc_type_qualifier): Remove function. (adjust_type_for_id_default): Simplify; there is no longer a need to wade through declspecs. (lookup_interface, start_class, continue_class, finish_class, start_method_def, start_protocol, build_method_decl, objc_add_method, add_instance_variable, build_ivar_reference, is_ivar, is_private, get_super_receiver, objc_build_finally_epilogue): Make into static functions. (receiver_is_class_object): Use new IS_CLASS() macro. (objc_build_message_expr): Tweak ObjC++ message argument handling; call objc_finish_message_expr() instead of finish_message_expr(). (finish_message_expr): Rename to objc_finish_message_expr(); use OBJC_TYPE_NAME and OBJC_SET_TYPE_NAME macros instead of TYPE_NAME. call gen_type_name() instead of gen_declaration(); call objc_is_id() instead of using IS_ID and IS_CLASS; Use objc_class_name instead of calling get_identifier("Class"); handle CONVERT_EXPRs in receiver. (build_objc_method_call, warn_with_method): Do not call groktypename(). (build_ivar_reference): Call convert() instead of clobbering in a type. (hash_init): Initialize string_htab hash table. (add_instance_variable): Simplify parameter list; do not call grokfield(); do not populate CLASS_IVARS list. (start_class): Check for the existence of super class, if one was specified. (continue_class): Use CLASS_RAW_IVARS rather than CLASS_IVARS; do not call build_class_template(); adjust call to get_class_ivars(); call build_decl(), pushdecl() and finish_decl() instead of define_decl(). (finish_class): Call build_decl(), pushdecl() and finish_decl() instead of define_decl(). (add_protocols): Use PROTOCOL_BINFO_ELTS for the tree vector size. (start_protocol): Do not call build_protocol_template(); use PROTOCOL_BINFO_ELTS for the tree vector size. (encode_type_qualifiers): Do not handle the 'const' qualifier here. (encode_pointer): Encode 'const char *' as 'r*', for backwards compatibility. (encode_array): Use HOST_WIDE_INT_PRINT_DEC instead of "%ld". (encode_type): Handle the 'const' qualifier here. (objc_parmlist): New global variable, sued by objc_push_parm and objc_get_parm_info(). (objc_push_parm, objc_get_parm_info): New functions. (objc_expr_last): Remove function. (synth_self_and_ucmd_args): For instance methods, use the instance type for 'self'; call objc_push_parm() instead of push_parm_decl(). (start_method_def): Do not call push_scope(), declare_parm_level(), pop_scope(), push_parm_decl(), store_parm_decls() or objc_expr_last(); just use objc_push_parm() and objc_get_parm_info(). (comp_method_with_proto): Remove function. (objc_types_are_equivalent): Strip away indirections before comparing underlying types. (comp_proto_with_proto): Do not call groktypename(); types are no longer in raw declspec format. (objc_start_function): New function. (really_start_method): Call comp_proto_with_proto() instead of comp_method_with_proto(); call objc_start_function() instead of hand-crafting a function declarator. (continue_method_def, objc_expand_function_end): Remove functions. (get_super_receiver): Call objc_get_current_scope() instead of get_current_scope(); reference 'super_class' field (instead of 'class'). (finish_method_def): Rename to objc_finish_method_definition() and add a function decl parameter; move method encoding call from objc_expand_function_end(). (is_complex_decl, adorn_decl, gen_declarator, gen_declspecs, gen_declaration_1): Remove functions. (tmpbuf, RAW_DECLSPEC): Remove. (gen_declaration): Remove second parameter; simplify to deal with TYPE_P nodes instead of raw declspecs. (gen_type_name, gen_type_name_0): New functions. (gen_method_decl): Remove second parameter; call gen_type_name() instead of gen_declaration_1(). (dump_interface): Adjust calls to gen_declaration() and gen_method_decl(); do not allocate a separate string buffer. (init_objc): Allocate a larger string buffer to accommodate dump_interface(); adjust call to build_module_descriptor(); add call to build_module_initializer_routine() for the GNU runtime. (generate_classref_translation_entry): Do not call start_decl(); call finish_var_decl() instead of finish_decl(); call convert() instead of build_c_cast(). * objc-act.h (CLASS_OWN_IVARS): Remove accessor. (CLASS_BINFO_ELTS): Reduce from 6 to 5, now that CLASS_OWN_IVARS is gone. (OCTI_GNU_INIT_DECL, GNU_INIT_decl): New. (OCTI_ELLIPSIS_NODE, objc_ellipsis_node): Remove. (OCTI_ID_ID, id_type, objc_id_id): Rename to OCTI_ID_NAME, objc_object_type and objc_object_name, respectively. (OCTI_CLS_REF, OCTI_CLASS_NAME, objc_class_reference, objc_class_name): New. (IS_CLASS): New macro. (IS_ID, IS_SUPER): Robustify. (OCTI_EXECCLASS_DECL, execclass_decl): New. (finish_file, start_class, continue_class, finish_class, start_method_def, continue_method_def, finish_method_def, start_protocol, finish_protocol, objc_build_throw_stmt, objc_build_try_catch_finally_stmt, objc_build_synchronized_prologue, objc_build_synchronized_epilogue, objc_build_try_prologue, objc_build_try_epilogue, objc_build_catch_stmt, objc_build_catch_epilogue, objc_build_finally_prologue, objc_build_finally_epilogue, is_ivar, is_private, is_public, add_instance_variable, objc_add_method, get_super_receiver, objc_clear_super_receiver, get_class_ivars_from_name, get_class_reference, get_static_reference, get_object_reference, build_message_expr, finish_message_expr, build_selector_expr, build_ivar_reference, build_keyword_decl, build_method_decl, build_protocol_expr, build_objc_string_object, objc_declare_alias, objc_declare_class, objc_declare_protocols, objc_comptypes, objc_check_decl, build_encode_expr): Remove prototypes. (imp_count, cat_count): Make GGC-aware. (OBJC_SET_TYPE_NAME): New macro. From-SVN: r87168
2004-09-08 02:49:44 +02:00
finish_var_decl (decl, initlist);
1992-01-18 00:15:38 +01:00
}
Makefile.in (c-parse.o): Depend on $(C_COMMON_H). [gcc/ChangeLog] 2004-09-07 Ziemowit Laski <zlaski@apple.com> * Makefile.in (c-parse.o): Depend on $(C_COMMON_H). * c-parse.in: Include c-common.h instead of objc-act.h. (ivar_decl_list, ivar_decls, ivar_decl, ivars, ivar_declarator, myparms, myparm): Remove %type declarations. (methodtype, optparms, OBJC_TYPE_QUAL, objc_quals, objc_qual, objc_typename, objc_try_catch_stmt, optellipsis): Add %type declarations. (objc_inherit_code, objc_public_flag): Remove. (typespec_nonreserved_nonattr): Call objc_get_protocol_qualified_type() instead of get_static_reference() and get_protocol_reference(). (stmt_nocomp): Call grokparm() on @catch parameter. (objcdef): Move semantic action to objc_finish_implementation(). (classdef): Move semantic action to objc_start_class_interface(), objc_continue_interface(), objc_finish_interface(), objc_start_class_implementation(), objc_continue_implementation(), objc_start_category_interface() and objc_start_category_implementation(). (protocoldef): Move semantic actions to objc_start_protocol() and objc_finish_interface(). (ivar_decl_list): Remove nonterminal. (visibility_spec): Move semantic actions to objc_set_visibility(). (ivar_decls): Remove assignment to $$. (ivar_decl): Rephrase in terms of component_decl; call objc_add_instance_variable(). (ivars, ivar_declarator): Remove nonterminals. (opt_semi): New nonterminal. (methodtype): Remove semantic actions. (methoddef): Move semantic actions to objc_set_method_type(), objc_start_method_definition() and objc_finish_method_definition(). (methodproto): Move semantic actions to objc_set_method_type() and objc_add_method_declaration(). (methoddecl): Use objc_typename instead of typename; move semantic actions to objc_build_method_signature(). (optarglist, myxdecls, mydecl, myparms, myparm): Remove nonterminals. (optparmlist): Express in terms of optparms and optellipsis. (optparms, optellipsis, objc_qual, objc_quals, objc_typename): New nonterminals. (keyworddecl): Use objc_typename instead of typename. (rid_to_yy): Mark RID_IN, RID_OUT, RID_INOUT, RID_BYCOPY, RID_BYREF and RID_ONEWAY as returning OBJC_TYPE_QUAL to yyparse(). [gcc/objc/ChangeLog] 2004-09-07 Ziemowit Laski <zlaski@apple.com> * Make-lang.in (objc/objc-parse.o): Depend on $(C_COMMON_H) instead of objc/objc-act.h. (objc/objc-act.o): Depend on $(HASHTAB_H). * objc-act.c: Include hashtab.h; in ObjC++ mode, include cp-tree.h and objcp-decl.h instead of c-tree.h. (build_module_descriptor, get_class_ivars, synth_id_with_class_suffix, error_with_ivar, gen_method_decl, gen_declaration, setup_string_decl, build_protocol_template): Adjust prototypes. (build_module_initializer_routine, start_class, continue_class, finish_class, start_method_def, objc_start_function, start_protocol, build_method_decl, objc_add_method, add_instance_variable, build_ivar_reference, is_ivar, is_private, get_super_receiver, build_selector_table_decl, objc_push_parm, objc_get_parm_info, gen_type_name, gen_type_name_0, start_var_decl, finish_var_decl, create_field_decl): New prototypes. (objc_expand_function_end, comp_method_with_proto, objc_expr_last, gen_declaration_1, gen_declarator, is_complex_decl, adorn_decl, define_decl, create_builtin_decl, gen_declspecs): Remove prototypes. (TYPE_ID): Rename to OBJECT_TYPEDEF_NAME. (CLASS_TYPEDEF_NAME): New. (TAG_EXECCLASS): Change from a global variable to a #define. (TAG_RETURN_STRUCT): Delete. (TAG_GNUINIT): New, holds '__objc_gnu_init' name. (objc_inherit_code, objc_public_flag): New, moved from c-parse.in. (string_descriptor): New struct. (string_htab): New hash table. (string_hash, string_eq): New prototypes. (generate_struct_by_value_array): Call create_field_decl() instead of create_builtin_decl(). (objc_init): Do not initialize objc_ellipsis_node or TAG_EXECCLASS; In ObjC++ mode, call cxx_init() instead of c_objc_common_init(). (objc_finish_file): In ObjC++, call instantiate_pending_templates() and cp_finish_file(). (define_decl, get_static_reference, get_protocol_reference, create_builtin_decl): Remove functions. (objc_start_class_interface, objc_start_category_interface, objc_start_protocol, objc_continue_interface, objc_finish_interface, objc_start_class_implementation, objc_start_category_implementation, objc_continue_implementation, objc_finish_implementation, objc_set_visibility, objc_set_method_type, objc_build_method_signature, objc_add_method_declaration, objc_start_method_definition, objc_add_instance_variable, objc_get_protocol_qualified_type, create_field_decl, start_var_decl, finish_var_decl): New functions. (setup_string_decl): Simplify since it is only called once. (synth_module_prologue): Call build_class_template(); predefine 'id' and 'Class' as typedefs; rename 'temp_type' to 'type'; disable debug hooks for duration of function; fix GNU runtime messenger signatures to correspond to reality; forward-declare '__objc_exec_class' for the GNU runtime; call build_selector_table_decl(); in ObjC++ mode, generate 'extern "C" { ... }' wrappers around synthesized declarations; call build_protocol_template() and build_category_template(). (string_hash, string_eq): New functions. (objc_build_string_object): Check metaclass correctness only once; store string literals in hash table. (objc_build_constructor): Do not convert initializer elements; adjust for ObjC++ impedance mismatch. (build_objc_symtab_template): Call create_field_decl() instead of create_builtin_decl(). (init_objc_symtab): Add missing conversion to initializer element. (build_metadata_decl): Call start_var_decl() instead of define_decl(). (generate_objc_symtab_decl): Do not call build_category_template(); call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(). (build_module_descriptor): Call create_field_decl() instead of grokfield(); call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(); always mark module descriptor as used; move GNU runtime-specific functionality to build_module_initializer_routine(). (build_module_initializer_routine): New function, broken off of build_module_descriptor(). (objc_static_init_needed_p, objc_generate_static_init_call): New functions. (generate_static_references, generate_strings, build_selector_translation_table, generate_descriptor_table, generate_ivars_list, generate_dispatch_table, generate_category): Call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(); build a type directly instead of via groktypename(). (build_selector_reference_decl, build_selector_table_decl, build_class_reference_decl, build_protocol_reference, generate_objc_image_info): Call start_var_decl() instead of build_decl(). (build_selector_reference): For GNU runtime, do not call build_selector_reference_decl(). (build_selector, build_typed_selector_reference): Always convert result to the selector type. (add_objc_string): Cast return value to 'char *'. (build_method_prototype_template, build_selector_template, build_method_template): Use actual selector type for fields pointing to selectors. (finish_objc): For GNU runtime, call build_module_initializer_routine() after build_module_descriptor(). (generate_protocol_list, generate_shared_structures): Call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(); build a type directly instead of via groktypename(). (synth_id_with_class_suffix): Return a string. (get_arg_type_list): For instance methods, use the instance type for 'self'; do not call groktypename_in_parm_context(). (build_objc_string_decl): Squash redeclaration errors in ObjC++. (objc_is_class_name): Use OBJC_TYPE_NAME instead of TYPE_NAME; handle RECORD_TYPEs in ObjC as well as ObjC++. (objc_is_id): New function. (objc_is_object_ptr): Return the canonical type node. (objc_get_class_ivars): Simplify using get_class_ivars(). (get_class_ivars): Remove second parameter; create a fresh copy of the ivar list for each call; do not check for existence of super class. (objc_eh_runtime_type): Mark #ifndef OBJCPLUS. (objc_init_exceptions): When using SJLJ-style exceptions, require the use of '-fobjc-exceptions' flag; do not require it for DWARF-style exceptions. (objc_build_exc_ptr, next_sjlj_build_try_catch_finally): Use objc_object_type instead of objc_id_type. (objc_begin_catch_clause): Convert the incoming PARM_DECL into a VAR_DECL before placing it in the appropriate scope; do not call define_decl(); adjust call to c_begin_compound_stmt(); use objc_object_type instead of objc_id_type. (build_next_objc_exception_stuff): Call create_field_decl() instead of create_builtin_decl(); construct type directly instead of calling groktypename(); use OBJC_VOID_AT_END to mark end of function parameters. (build_private_template): Adjust call to get_class_ivars(); build a type directly instead of via groktypename(). (build_protocol_template, build_method_prototype_list_template, build_method_prototype_template, build_category_template, build_selector_template, build_class_template, build_super_template, build_ivar_template, build_ivar_list_template, build_method_list_template, build_method_template): Call create_field_decl() instead of grokfield(). (objc_method_parm_type): Do not call groktypename(). (generate_descriptor_table): Call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(). (generate_method_descriptors, build_protocol_initializer, generate_dispatch_tables, build_category_initializer, build_shared_structure_initializer): Do not call groktypename(). (generate_protocols): Call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(); do not call groktypename(). (error_with_ivar): Remove last parameter. (check_ivars): Do not iterate ovar CLASS_RAW_IVARS lists in addition to CLASS_IVARS lists; adjust calls to error_with_ivar(). (generate_ivar_lists): Convert one of the initializer elements; do not call groktypename(). (get_arg_type_list, start_method_def, gen_method_def): Account for new representation of variable arguments and '...' in Objective-C methods; add Objective-C++ impedance matching code. (is_objc_type_qualifier): Remove function. (adjust_type_for_id_default): Simplify; there is no longer a need to wade through declspecs. (lookup_interface, start_class, continue_class, finish_class, start_method_def, start_protocol, build_method_decl, objc_add_method, add_instance_variable, build_ivar_reference, is_ivar, is_private, get_super_receiver, objc_build_finally_epilogue): Make into static functions. (receiver_is_class_object): Use new IS_CLASS() macro. (objc_build_message_expr): Tweak ObjC++ message argument handling; call objc_finish_message_expr() instead of finish_message_expr(). (finish_message_expr): Rename to objc_finish_message_expr(); use OBJC_TYPE_NAME and OBJC_SET_TYPE_NAME macros instead of TYPE_NAME. call gen_type_name() instead of gen_declaration(); call objc_is_id() instead of using IS_ID and IS_CLASS; Use objc_class_name instead of calling get_identifier("Class"); handle CONVERT_EXPRs in receiver. (build_objc_method_call, warn_with_method): Do not call groktypename(). (build_ivar_reference): Call convert() instead of clobbering in a type. (hash_init): Initialize string_htab hash table. (add_instance_variable): Simplify parameter list; do not call grokfield(); do not populate CLASS_IVARS list. (start_class): Check for the existence of super class, if one was specified. (continue_class): Use CLASS_RAW_IVARS rather than CLASS_IVARS; do not call build_class_template(); adjust call to get_class_ivars(); call build_decl(), pushdecl() and finish_decl() instead of define_decl(). (finish_class): Call build_decl(), pushdecl() and finish_decl() instead of define_decl(). (add_protocols): Use PROTOCOL_BINFO_ELTS for the tree vector size. (start_protocol): Do not call build_protocol_template(); use PROTOCOL_BINFO_ELTS for the tree vector size. (encode_type_qualifiers): Do not handle the 'const' qualifier here. (encode_pointer): Encode 'const char *' as 'r*', for backwards compatibility. (encode_array): Use HOST_WIDE_INT_PRINT_DEC instead of "%ld". (encode_type): Handle the 'const' qualifier here. (objc_parmlist): New global variable, sued by objc_push_parm and objc_get_parm_info(). (objc_push_parm, objc_get_parm_info): New functions. (objc_expr_last): Remove function. (synth_self_and_ucmd_args): For instance methods, use the instance type for 'self'; call objc_push_parm() instead of push_parm_decl(). (start_method_def): Do not call push_scope(), declare_parm_level(), pop_scope(), push_parm_decl(), store_parm_decls() or objc_expr_last(); just use objc_push_parm() and objc_get_parm_info(). (comp_method_with_proto): Remove function. (objc_types_are_equivalent): Strip away indirections before comparing underlying types. (comp_proto_with_proto): Do not call groktypename(); types are no longer in raw declspec format. (objc_start_function): New function. (really_start_method): Call comp_proto_with_proto() instead of comp_method_with_proto(); call objc_start_function() instead of hand-crafting a function declarator. (continue_method_def, objc_expand_function_end): Remove functions. (get_super_receiver): Call objc_get_current_scope() instead of get_current_scope(); reference 'super_class' field (instead of 'class'). (finish_method_def): Rename to objc_finish_method_definition() and add a function decl parameter; move method encoding call from objc_expand_function_end(). (is_complex_decl, adorn_decl, gen_declarator, gen_declspecs, gen_declaration_1): Remove functions. (tmpbuf, RAW_DECLSPEC): Remove. (gen_declaration): Remove second parameter; simplify to deal with TYPE_P nodes instead of raw declspecs. (gen_type_name, gen_type_name_0): New functions. (gen_method_decl): Remove second parameter; call gen_type_name() instead of gen_declaration_1(). (dump_interface): Adjust calls to gen_declaration() and gen_method_decl(); do not allocate a separate string buffer. (init_objc): Allocate a larger string buffer to accommodate dump_interface(); adjust call to build_module_descriptor(); add call to build_module_initializer_routine() for the GNU runtime. (generate_classref_translation_entry): Do not call start_decl(); call finish_var_decl() instead of finish_decl(); call convert() instead of build_c_cast(). * objc-act.h (CLASS_OWN_IVARS): Remove accessor. (CLASS_BINFO_ELTS): Reduce from 6 to 5, now that CLASS_OWN_IVARS is gone. (OCTI_GNU_INIT_DECL, GNU_INIT_decl): New. (OCTI_ELLIPSIS_NODE, objc_ellipsis_node): Remove. (OCTI_ID_ID, id_type, objc_id_id): Rename to OCTI_ID_NAME, objc_object_type and objc_object_name, respectively. (OCTI_CLS_REF, OCTI_CLASS_NAME, objc_class_reference, objc_class_name): New. (IS_CLASS): New macro. (IS_ID, IS_SUPER): Robustify. (OCTI_EXECCLASS_DECL, execclass_decl): New. (finish_file, start_class, continue_class, finish_class, start_method_def, continue_method_def, finish_method_def, start_protocol, finish_protocol, objc_build_throw_stmt, objc_build_try_catch_finally_stmt, objc_build_synchronized_prologue, objc_build_synchronized_epilogue, objc_build_try_prologue, objc_build_try_epilogue, objc_build_catch_stmt, objc_build_catch_epilogue, objc_build_finally_prologue, objc_build_finally_epilogue, is_ivar, is_private, is_public, add_instance_variable, objc_add_method, get_super_receiver, objc_clear_super_receiver, get_class_ivars_from_name, get_class_reference, get_static_reference, get_object_reference, build_message_expr, finish_message_expr, build_selector_expr, build_ivar_reference, build_keyword_decl, build_method_decl, build_protocol_expr, build_objc_string_object, objc_declare_alias, objc_declare_class, objc_declare_protocols, objc_comptypes, objc_check_decl, build_encode_expr): Remove prototypes. (imp_count, cat_count): Make GGC-aware. (OBJC_SET_TYPE_NAME): New macro. From-SVN: r87168
2004-09-08 02:49:44 +02:00
static const char *
synth_id_with_class_suffix (const char *preamble, tree ctxt)
1992-01-18 00:15:38 +01:00
{
Makefile.in (c-parse.o): Depend on $(C_COMMON_H). [gcc/ChangeLog] 2004-09-07 Ziemowit Laski <zlaski@apple.com> * Makefile.in (c-parse.o): Depend on $(C_COMMON_H). * c-parse.in: Include c-common.h instead of objc-act.h. (ivar_decl_list, ivar_decls, ivar_decl, ivars, ivar_declarator, myparms, myparm): Remove %type declarations. (methodtype, optparms, OBJC_TYPE_QUAL, objc_quals, objc_qual, objc_typename, objc_try_catch_stmt, optellipsis): Add %type declarations. (objc_inherit_code, objc_public_flag): Remove. (typespec_nonreserved_nonattr): Call objc_get_protocol_qualified_type() instead of get_static_reference() and get_protocol_reference(). (stmt_nocomp): Call grokparm() on @catch parameter. (objcdef): Move semantic action to objc_finish_implementation(). (classdef): Move semantic action to objc_start_class_interface(), objc_continue_interface(), objc_finish_interface(), objc_start_class_implementation(), objc_continue_implementation(), objc_start_category_interface() and objc_start_category_implementation(). (protocoldef): Move semantic actions to objc_start_protocol() and objc_finish_interface(). (ivar_decl_list): Remove nonterminal. (visibility_spec): Move semantic actions to objc_set_visibility(). (ivar_decls): Remove assignment to $$. (ivar_decl): Rephrase in terms of component_decl; call objc_add_instance_variable(). (ivars, ivar_declarator): Remove nonterminals. (opt_semi): New nonterminal. (methodtype): Remove semantic actions. (methoddef): Move semantic actions to objc_set_method_type(), objc_start_method_definition() and objc_finish_method_definition(). (methodproto): Move semantic actions to objc_set_method_type() and objc_add_method_declaration(). (methoddecl): Use objc_typename instead of typename; move semantic actions to objc_build_method_signature(). (optarglist, myxdecls, mydecl, myparms, myparm): Remove nonterminals. (optparmlist): Express in terms of optparms and optellipsis. (optparms, optellipsis, objc_qual, objc_quals, objc_typename): New nonterminals. (keyworddecl): Use objc_typename instead of typename. (rid_to_yy): Mark RID_IN, RID_OUT, RID_INOUT, RID_BYCOPY, RID_BYREF and RID_ONEWAY as returning OBJC_TYPE_QUAL to yyparse(). [gcc/objc/ChangeLog] 2004-09-07 Ziemowit Laski <zlaski@apple.com> * Make-lang.in (objc/objc-parse.o): Depend on $(C_COMMON_H) instead of objc/objc-act.h. (objc/objc-act.o): Depend on $(HASHTAB_H). * objc-act.c: Include hashtab.h; in ObjC++ mode, include cp-tree.h and objcp-decl.h instead of c-tree.h. (build_module_descriptor, get_class_ivars, synth_id_with_class_suffix, error_with_ivar, gen_method_decl, gen_declaration, setup_string_decl, build_protocol_template): Adjust prototypes. (build_module_initializer_routine, start_class, continue_class, finish_class, start_method_def, objc_start_function, start_protocol, build_method_decl, objc_add_method, add_instance_variable, build_ivar_reference, is_ivar, is_private, get_super_receiver, build_selector_table_decl, objc_push_parm, objc_get_parm_info, gen_type_name, gen_type_name_0, start_var_decl, finish_var_decl, create_field_decl): New prototypes. (objc_expand_function_end, comp_method_with_proto, objc_expr_last, gen_declaration_1, gen_declarator, is_complex_decl, adorn_decl, define_decl, create_builtin_decl, gen_declspecs): Remove prototypes. (TYPE_ID): Rename to OBJECT_TYPEDEF_NAME. (CLASS_TYPEDEF_NAME): New. (TAG_EXECCLASS): Change from a global variable to a #define. (TAG_RETURN_STRUCT): Delete. (TAG_GNUINIT): New, holds '__objc_gnu_init' name. (objc_inherit_code, objc_public_flag): New, moved from c-parse.in. (string_descriptor): New struct. (string_htab): New hash table. (string_hash, string_eq): New prototypes. (generate_struct_by_value_array): Call create_field_decl() instead of create_builtin_decl(). (objc_init): Do not initialize objc_ellipsis_node or TAG_EXECCLASS; In ObjC++ mode, call cxx_init() instead of c_objc_common_init(). (objc_finish_file): In ObjC++, call instantiate_pending_templates() and cp_finish_file(). (define_decl, get_static_reference, get_protocol_reference, create_builtin_decl): Remove functions. (objc_start_class_interface, objc_start_category_interface, objc_start_protocol, objc_continue_interface, objc_finish_interface, objc_start_class_implementation, objc_start_category_implementation, objc_continue_implementation, objc_finish_implementation, objc_set_visibility, objc_set_method_type, objc_build_method_signature, objc_add_method_declaration, objc_start_method_definition, objc_add_instance_variable, objc_get_protocol_qualified_type, create_field_decl, start_var_decl, finish_var_decl): New functions. (setup_string_decl): Simplify since it is only called once. (synth_module_prologue): Call build_class_template(); predefine 'id' and 'Class' as typedefs; rename 'temp_type' to 'type'; disable debug hooks for duration of function; fix GNU runtime messenger signatures to correspond to reality; forward-declare '__objc_exec_class' for the GNU runtime; call build_selector_table_decl(); in ObjC++ mode, generate 'extern "C" { ... }' wrappers around synthesized declarations; call build_protocol_template() and build_category_template(). (string_hash, string_eq): New functions. (objc_build_string_object): Check metaclass correctness only once; store string literals in hash table. (objc_build_constructor): Do not convert initializer elements; adjust for ObjC++ impedance mismatch. (build_objc_symtab_template): Call create_field_decl() instead of create_builtin_decl(). (init_objc_symtab): Add missing conversion to initializer element. (build_metadata_decl): Call start_var_decl() instead of define_decl(). (generate_objc_symtab_decl): Do not call build_category_template(); call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(). (build_module_descriptor): Call create_field_decl() instead of grokfield(); call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(); always mark module descriptor as used; move GNU runtime-specific functionality to build_module_initializer_routine(). (build_module_initializer_routine): New function, broken off of build_module_descriptor(). (objc_static_init_needed_p, objc_generate_static_init_call): New functions. (generate_static_references, generate_strings, build_selector_translation_table, generate_descriptor_table, generate_ivars_list, generate_dispatch_table, generate_category): Call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(); build a type directly instead of via groktypename(). (build_selector_reference_decl, build_selector_table_decl, build_class_reference_decl, build_protocol_reference, generate_objc_image_info): Call start_var_decl() instead of build_decl(). (build_selector_reference): For GNU runtime, do not call build_selector_reference_decl(). (build_selector, build_typed_selector_reference): Always convert result to the selector type. (add_objc_string): Cast return value to 'char *'. (build_method_prototype_template, build_selector_template, build_method_template): Use actual selector type for fields pointing to selectors. (finish_objc): For GNU runtime, call build_module_initializer_routine() after build_module_descriptor(). (generate_protocol_list, generate_shared_structures): Call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(); build a type directly instead of via groktypename(). (synth_id_with_class_suffix): Return a string. (get_arg_type_list): For instance methods, use the instance type for 'self'; do not call groktypename_in_parm_context(). (build_objc_string_decl): Squash redeclaration errors in ObjC++. (objc_is_class_name): Use OBJC_TYPE_NAME instead of TYPE_NAME; handle RECORD_TYPEs in ObjC as well as ObjC++. (objc_is_id): New function. (objc_is_object_ptr): Return the canonical type node. (objc_get_class_ivars): Simplify using get_class_ivars(). (get_class_ivars): Remove second parameter; create a fresh copy of the ivar list for each call; do not check for existence of super class. (objc_eh_runtime_type): Mark #ifndef OBJCPLUS. (objc_init_exceptions): When using SJLJ-style exceptions, require the use of '-fobjc-exceptions' flag; do not require it for DWARF-style exceptions. (objc_build_exc_ptr, next_sjlj_build_try_catch_finally): Use objc_object_type instead of objc_id_type. (objc_begin_catch_clause): Convert the incoming PARM_DECL into a VAR_DECL before placing it in the appropriate scope; do not call define_decl(); adjust call to c_begin_compound_stmt(); use objc_object_type instead of objc_id_type. (build_next_objc_exception_stuff): Call create_field_decl() instead of create_builtin_decl(); construct type directly instead of calling groktypename(); use OBJC_VOID_AT_END to mark end of function parameters. (build_private_template): Adjust call to get_class_ivars(); build a type directly instead of via groktypename(). (build_protocol_template, build_method_prototype_list_template, build_method_prototype_template, build_category_template, build_selector_template, build_class_template, build_super_template, build_ivar_template, build_ivar_list_template, build_method_list_template, build_method_template): Call create_field_decl() instead of grokfield(). (objc_method_parm_type): Do not call groktypename(). (generate_descriptor_table): Call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(). (generate_method_descriptors, build_protocol_initializer, generate_dispatch_tables, build_category_initializer, build_shared_structure_initializer): Do not call groktypename(). (generate_protocols): Call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(); do not call groktypename(). (error_with_ivar): Remove last parameter. (check_ivars): Do not iterate ovar CLASS_RAW_IVARS lists in addition to CLASS_IVARS lists; adjust calls to error_with_ivar(). (generate_ivar_lists): Convert one of the initializer elements; do not call groktypename(). (get_arg_type_list, start_method_def, gen_method_def): Account for new representation of variable arguments and '...' in Objective-C methods; add Objective-C++ impedance matching code. (is_objc_type_qualifier): Remove function. (adjust_type_for_id_default): Simplify; there is no longer a need to wade through declspecs. (lookup_interface, start_class, continue_class, finish_class, start_method_def, start_protocol, build_method_decl, objc_add_method, add_instance_variable, build_ivar_reference, is_ivar, is_private, get_super_receiver, objc_build_finally_epilogue): Make into static functions. (receiver_is_class_object): Use new IS_CLASS() macro. (objc_build_message_expr): Tweak ObjC++ message argument handling; call objc_finish_message_expr() instead of finish_message_expr(). (finish_message_expr): Rename to objc_finish_message_expr(); use OBJC_TYPE_NAME and OBJC_SET_TYPE_NAME macros instead of TYPE_NAME. call gen_type_name() instead of gen_declaration(); call objc_is_id() instead of using IS_ID and IS_CLASS; Use objc_class_name instead of calling get_identifier("Class"); handle CONVERT_EXPRs in receiver. (build_objc_method_call, warn_with_method): Do not call groktypename(). (build_ivar_reference): Call convert() instead of clobbering in a type. (hash_init): Initialize string_htab hash table. (add_instance_variable): Simplify parameter list; do not call grokfield(); do not populate CLASS_IVARS list. (start_class): Check for the existence of super class, if one was specified. (continue_class): Use CLASS_RAW_IVARS rather than CLASS_IVARS; do not call build_class_template(); adjust call to get_class_ivars(); call build_decl(), pushdecl() and finish_decl() instead of define_decl(). (finish_class): Call build_decl(), pushdecl() and finish_decl() instead of define_decl(). (add_protocols): Use PROTOCOL_BINFO_ELTS for the tree vector size. (start_protocol): Do not call build_protocol_template(); use PROTOCOL_BINFO_ELTS for the tree vector size. (encode_type_qualifiers): Do not handle the 'const' qualifier here. (encode_pointer): Encode 'const char *' as 'r*', for backwards compatibility. (encode_array): Use HOST_WIDE_INT_PRINT_DEC instead of "%ld". (encode_type): Handle the 'const' qualifier here. (objc_parmlist): New global variable, sued by objc_push_parm and objc_get_parm_info(). (objc_push_parm, objc_get_parm_info): New functions. (objc_expr_last): Remove function. (synth_self_and_ucmd_args): For instance methods, use the instance type for 'self'; call objc_push_parm() instead of push_parm_decl(). (start_method_def): Do not call push_scope(), declare_parm_level(), pop_scope(), push_parm_decl(), store_parm_decls() or objc_expr_last(); just use objc_push_parm() and objc_get_parm_info(). (comp_method_with_proto): Remove function. (objc_types_are_equivalent): Strip away indirections before comparing underlying types. (comp_proto_with_proto): Do not call groktypename(); types are no longer in raw declspec format. (objc_start_function): New function. (really_start_method): Call comp_proto_with_proto() instead of comp_method_with_proto(); call objc_start_function() instead of hand-crafting a function declarator. (continue_method_def, objc_expand_function_end): Remove functions. (get_super_receiver): Call objc_get_current_scope() instead of get_current_scope(); reference 'super_class' field (instead of 'class'). (finish_method_def): Rename to objc_finish_method_definition() and add a function decl parameter; move method encoding call from objc_expand_function_end(). (is_complex_decl, adorn_decl, gen_declarator, gen_declspecs, gen_declaration_1): Remove functions. (tmpbuf, RAW_DECLSPEC): Remove. (gen_declaration): Remove second parameter; simplify to deal with TYPE_P nodes instead of raw declspecs. (gen_type_name, gen_type_name_0): New functions. (gen_method_decl): Remove second parameter; call gen_type_name() instead of gen_declaration_1(). (dump_interface): Adjust calls to gen_declaration() and gen_method_decl(); do not allocate a separate string buffer. (init_objc): Allocate a larger string buffer to accommodate dump_interface(); adjust call to build_module_descriptor(); add call to build_module_initializer_routine() for the GNU runtime. (generate_classref_translation_entry): Do not call start_decl(); call finish_var_decl() instead of finish_decl(); call convert() instead of build_c_cast(). * objc-act.h (CLASS_OWN_IVARS): Remove accessor. (CLASS_BINFO_ELTS): Reduce from 6 to 5, now that CLASS_OWN_IVARS is gone. (OCTI_GNU_INIT_DECL, GNU_INIT_decl): New. (OCTI_ELLIPSIS_NODE, objc_ellipsis_node): Remove. (OCTI_ID_ID, id_type, objc_id_id): Rename to OCTI_ID_NAME, objc_object_type and objc_object_name, respectively. (OCTI_CLS_REF, OCTI_CLASS_NAME, objc_class_reference, objc_class_name): New. (IS_CLASS): New macro. (IS_ID, IS_SUPER): Robustify. (OCTI_EXECCLASS_DECL, execclass_decl): New. (finish_file, start_class, continue_class, finish_class, start_method_def, continue_method_def, finish_method_def, start_protocol, finish_protocol, objc_build_throw_stmt, objc_build_try_catch_finally_stmt, objc_build_synchronized_prologue, objc_build_synchronized_epilogue, objc_build_try_prologue, objc_build_try_epilogue, objc_build_catch_stmt, objc_build_catch_epilogue, objc_build_finally_prologue, objc_build_finally_epilogue, is_ivar, is_private, is_public, add_instance_variable, objc_add_method, get_super_receiver, objc_clear_super_receiver, get_class_ivars_from_name, get_class_reference, get_static_reference, get_object_reference, build_message_expr, finish_message_expr, build_selector_expr, build_ivar_reference, build_keyword_decl, build_method_decl, build_protocol_expr, build_objc_string_object, objc_declare_alias, objc_declare_class, objc_declare_protocols, objc_comptypes, objc_check_decl, build_encode_expr): Remove prototypes. (imp_count, cat_count): Make GGC-aware. (OBJC_SET_TYPE_NAME): New macro. From-SVN: r87168
2004-09-08 02:49:44 +02:00
static char string[BUFSIZE];
if (TREE_CODE (ctxt) == CLASS_IMPLEMENTATION_TYPE
|| TREE_CODE (ctxt) == CLASS_INTERFACE_TYPE)
{
sprintf (string, "%s_%s", preamble,
IDENTIFIER_POINTER (CLASS_NAME (ctxt)));
}
else if (TREE_CODE (ctxt) == CATEGORY_IMPLEMENTATION_TYPE
|| TREE_CODE (ctxt) == CATEGORY_INTERFACE_TYPE)
{
1996-07-04 00:07:53 +02:00
/* We have a category. */
c-parse.in (yyerror): Const-ification and/or static-ization. * c-parse.in (yyerror): Const-ification and/or static-ization. * c-typeck.c (push_member_name): Likewise. * collect2.c (main): Likewise. * dbxout.c (dbxout_parms): Likewise. * diagnostic.c (format_with_decl): Likewise. * dwarf2out.c (output_ranges): Likewise. * dwarfout.c (fundamental_type_code): Likewise. * except.c (dw2_output_call_site_table): Likewise. * gcc.c (do_spec_1): Likewise. * genopinit.c (optabs): Likewise. * objc/objc-act.c (synth_id_with_class_suffix, start_class, gen_declaration_1, handle_impent): Likewise. * protoize.c (default_include, in_system_include_dir, abspath): Likewise. * sched-vis.c (visualize_stall_cycles): Likewise. * sdbout.c (plain_type_1, sdbout_end_function, sdbout_end_epilogue): Likewise. * varasm.c (decode_reg_name): Likewise. * 1750a.c (mod_regno_adjust): Likewise. * alpha.c (alpha_write_one_linkage, unicosmk_output_default_externs): Likewise. * arm.c (arm_condition_codes): Likewise. * arm.h (arm_condition_codes): Likewise. * avr.c (output_movsisf, encode_section_info): Likewise. * darwin.h (GEN_BINDER_NAME_FOR_STUB, GEN_SYMBOL_NAME_FOR_SYMBOL): Likewise. * i386.c (hi_reg_name, qi_reg_name, qi_high_reg_name): Likewise. * i386.h (hi_reg_name, qi_reg_name, qi_high_reg_name): Likewise. * m88k.c (output_function_profiler): Likewise. * mips.c (mips_output_conditional_branch): Likewise. * ns32k.c (ns32k_out_reg_names): Likewise. * ns32k.h (ns32k_out_reg_names): Likewise. * pj.c (pj_output_rval): Likewise. * rs6000.c (GEN_LOCAL_LABEL_FOR_SYMBOL): Likewise. * sparc.c (sparc_flat_function_prologue, sparc_flat_function_epilogue): Likewise. cp: * decl.c (warn_extern_redeclared_static, cp_make_fname_decl): Const-ification. * pt.c (tsubst_decl): Likewise. f: * bad.c (ffebad_finish): Const-ification and/or static-ization. * intrin.c (ffeintrin_cmp_name_): Likewise. * stc.c (ffestc_R904): Likewise. java: * expr.c (expand_invoke): Const-ification. * parse.y (patch_method_invocation): Likewise. From-SVN: r45581
2001-09-13 16:37:29 +02:00
const char *const class_name
c-parse.in (objc_inherit_code, [...]): Make static. 2001-10-03 Ziemowit Laski <zlaski@apple.com> * c-parse.in (objc_inherit_code, objc_pq_context, objc_public_flag): Make static. (objc_interface_context, objc_implementation_context, objc_method_context, objc_ivar_chain, objc_ivar_context): Move to global tree array in objc/objc-act.[ch]. (methoddef): Remove unnecessary code. * objc/objc-act.c: (hashed_attribute, hashed_entry, imp_entry): Hoist struct definitions to objc-act.h. (nst_method_hash_list, cls_method_hash_list, imp_list, imp_count, cat_count): Place declaration in objc-act.h. (objc_tree_index): Move enumeration to objc-act.h. (objc_global_trees): Place declaration and macro accessors in objc-act.h. (implementation_context): Remove duplicate; use objc_implementation_context instead: (method_context): Remove duplicate; use objc_method_context instead. (objc_ellipsis_node, objc_method_prototype_template, implemented_classes, function_type): Move global vars to objc_global_trees. (init_objc): Use LAST_BASE_TREE_CODE instead of LAST_CODE. (build_message_expr): Move actual construction of ObjC message send nodes to finish_message_expr. (finish_message_expr): New routine, contains code formerly in build_message_expr. * objc/objc-act.h (finish_message_expr): New prototype. (objc_ivar_chain, objc_method_context, objc_ellipsis_node): Remove declarations; these vars are now part of objc_global_trees. (objc_tree_index, objc_global_trees): Move definitions from objc-act.c. * objc/objc-tree.def: Update copyright info. From-SVN: r46000
2001-10-04 00:05:57 +02:00
= IDENTIFIER_POINTER (CLASS_NAME (objc_implementation_context));
c-parse.in (yyerror): Const-ification and/or static-ization. * c-parse.in (yyerror): Const-ification and/or static-ization. * c-typeck.c (push_member_name): Likewise. * collect2.c (main): Likewise. * dbxout.c (dbxout_parms): Likewise. * diagnostic.c (format_with_decl): Likewise. * dwarf2out.c (output_ranges): Likewise. * dwarfout.c (fundamental_type_code): Likewise. * except.c (dw2_output_call_site_table): Likewise. * gcc.c (do_spec_1): Likewise. * genopinit.c (optabs): Likewise. * objc/objc-act.c (synth_id_with_class_suffix, start_class, gen_declaration_1, handle_impent): Likewise. * protoize.c (default_include, in_system_include_dir, abspath): Likewise. * sched-vis.c (visualize_stall_cycles): Likewise. * sdbout.c (plain_type_1, sdbout_end_function, sdbout_end_epilogue): Likewise. * varasm.c (decode_reg_name): Likewise. * 1750a.c (mod_regno_adjust): Likewise. * alpha.c (alpha_write_one_linkage, unicosmk_output_default_externs): Likewise. * arm.c (arm_condition_codes): Likewise. * arm.h (arm_condition_codes): Likewise. * avr.c (output_movsisf, encode_section_info): Likewise. * darwin.h (GEN_BINDER_NAME_FOR_STUB, GEN_SYMBOL_NAME_FOR_SYMBOL): Likewise. * i386.c (hi_reg_name, qi_reg_name, qi_high_reg_name): Likewise. * i386.h (hi_reg_name, qi_reg_name, qi_high_reg_name): Likewise. * m88k.c (output_function_profiler): Likewise. * mips.c (mips_output_conditional_branch): Likewise. * ns32k.c (ns32k_out_reg_names): Likewise. * ns32k.h (ns32k_out_reg_names): Likewise. * pj.c (pj_output_rval): Likewise. * rs6000.c (GEN_LOCAL_LABEL_FOR_SYMBOL): Likewise. * sparc.c (sparc_flat_function_prologue, sparc_flat_function_epilogue): Likewise. cp: * decl.c (warn_extern_redeclared_static, cp_make_fname_decl): Const-ification. * pt.c (tsubst_decl): Likewise. f: * bad.c (ffebad_finish): Const-ification and/or static-ization. * intrin.c (ffeintrin_cmp_name_): Likewise. * stc.c (ffestc_R904): Likewise. java: * expr.c (expand_invoke): Const-ification. * parse.y (patch_method_invocation): Likewise. From-SVN: r45581
2001-09-13 16:37:29 +02:00
const char *const class_super_name
c-parse.in (objc_inherit_code, [...]): Make static. 2001-10-03 Ziemowit Laski <zlaski@apple.com> * c-parse.in (objc_inherit_code, objc_pq_context, objc_public_flag): Make static. (objc_interface_context, objc_implementation_context, objc_method_context, objc_ivar_chain, objc_ivar_context): Move to global tree array in objc/objc-act.[ch]. (methoddef): Remove unnecessary code. * objc/objc-act.c: (hashed_attribute, hashed_entry, imp_entry): Hoist struct definitions to objc-act.h. (nst_method_hash_list, cls_method_hash_list, imp_list, imp_count, cat_count): Place declaration in objc-act.h. (objc_tree_index): Move enumeration to objc-act.h. (objc_global_trees): Place declaration and macro accessors in objc-act.h. (implementation_context): Remove duplicate; use objc_implementation_context instead: (method_context): Remove duplicate; use objc_method_context instead. (objc_ellipsis_node, objc_method_prototype_template, implemented_classes, function_type): Move global vars to objc_global_trees. (init_objc): Use LAST_BASE_TREE_CODE instead of LAST_CODE. (build_message_expr): Move actual construction of ObjC message send nodes to finish_message_expr. (finish_message_expr): New routine, contains code formerly in build_message_expr. * objc/objc-act.h (finish_message_expr): New prototype. (objc_ivar_chain, objc_method_context, objc_ellipsis_node): Remove declarations; these vars are now part of objc_global_trees. (objc_tree_index, objc_global_trees): Move definitions from objc-act.c. * objc/objc-tree.def: Update copyright info. From-SVN: r46000
2001-10-04 00:05:57 +02:00
= IDENTIFIER_POINTER (CLASS_SUPER_NAME (objc_implementation_context));
sprintf (string, "%s_%s_%s", preamble, class_name, class_super_name);
}
else if (TREE_CODE (ctxt) == PROTOCOL_INTERFACE_TYPE)
{
const char *protocol_name = IDENTIFIER_POINTER (PROTOCOL_NAME (ctxt));
sprintf (string, "%s_%s", preamble, protocol_name);
}
else
abort ();
Makefile.in (c-parse.o): Depend on $(C_COMMON_H). [gcc/ChangeLog] 2004-09-07 Ziemowit Laski <zlaski@apple.com> * Makefile.in (c-parse.o): Depend on $(C_COMMON_H). * c-parse.in: Include c-common.h instead of objc-act.h. (ivar_decl_list, ivar_decls, ivar_decl, ivars, ivar_declarator, myparms, myparm): Remove %type declarations. (methodtype, optparms, OBJC_TYPE_QUAL, objc_quals, objc_qual, objc_typename, objc_try_catch_stmt, optellipsis): Add %type declarations. (objc_inherit_code, objc_public_flag): Remove. (typespec_nonreserved_nonattr): Call objc_get_protocol_qualified_type() instead of get_static_reference() and get_protocol_reference(). (stmt_nocomp): Call grokparm() on @catch parameter. (objcdef): Move semantic action to objc_finish_implementation(). (classdef): Move semantic action to objc_start_class_interface(), objc_continue_interface(), objc_finish_interface(), objc_start_class_implementation(), objc_continue_implementation(), objc_start_category_interface() and objc_start_category_implementation(). (protocoldef): Move semantic actions to objc_start_protocol() and objc_finish_interface(). (ivar_decl_list): Remove nonterminal. (visibility_spec): Move semantic actions to objc_set_visibility(). (ivar_decls): Remove assignment to $$. (ivar_decl): Rephrase in terms of component_decl; call objc_add_instance_variable(). (ivars, ivar_declarator): Remove nonterminals. (opt_semi): New nonterminal. (methodtype): Remove semantic actions. (methoddef): Move semantic actions to objc_set_method_type(), objc_start_method_definition() and objc_finish_method_definition(). (methodproto): Move semantic actions to objc_set_method_type() and objc_add_method_declaration(). (methoddecl): Use objc_typename instead of typename; move semantic actions to objc_build_method_signature(). (optarglist, myxdecls, mydecl, myparms, myparm): Remove nonterminals. (optparmlist): Express in terms of optparms and optellipsis. (optparms, optellipsis, objc_qual, objc_quals, objc_typename): New nonterminals. (keyworddecl): Use objc_typename instead of typename. (rid_to_yy): Mark RID_IN, RID_OUT, RID_INOUT, RID_BYCOPY, RID_BYREF and RID_ONEWAY as returning OBJC_TYPE_QUAL to yyparse(). [gcc/objc/ChangeLog] 2004-09-07 Ziemowit Laski <zlaski@apple.com> * Make-lang.in (objc/objc-parse.o): Depend on $(C_COMMON_H) instead of objc/objc-act.h. (objc/objc-act.o): Depend on $(HASHTAB_H). * objc-act.c: Include hashtab.h; in ObjC++ mode, include cp-tree.h and objcp-decl.h instead of c-tree.h. (build_module_descriptor, get_class_ivars, synth_id_with_class_suffix, error_with_ivar, gen_method_decl, gen_declaration, setup_string_decl, build_protocol_template): Adjust prototypes. (build_module_initializer_routine, start_class, continue_class, finish_class, start_method_def, objc_start_function, start_protocol, build_method_decl, objc_add_method, add_instance_variable, build_ivar_reference, is_ivar, is_private, get_super_receiver, build_selector_table_decl, objc_push_parm, objc_get_parm_info, gen_type_name, gen_type_name_0, start_var_decl, finish_var_decl, create_field_decl): New prototypes. (objc_expand_function_end, comp_method_with_proto, objc_expr_last, gen_declaration_1, gen_declarator, is_complex_decl, adorn_decl, define_decl, create_builtin_decl, gen_declspecs): Remove prototypes. (TYPE_ID): Rename to OBJECT_TYPEDEF_NAME. (CLASS_TYPEDEF_NAME): New. (TAG_EXECCLASS): Change from a global variable to a #define. (TAG_RETURN_STRUCT): Delete. (TAG_GNUINIT): New, holds '__objc_gnu_init' name. (objc_inherit_code, objc_public_flag): New, moved from c-parse.in. (string_descriptor): New struct. (string_htab): New hash table. (string_hash, string_eq): New prototypes. (generate_struct_by_value_array): Call create_field_decl() instead of create_builtin_decl(). (objc_init): Do not initialize objc_ellipsis_node or TAG_EXECCLASS; In ObjC++ mode, call cxx_init() instead of c_objc_common_init(). (objc_finish_file): In ObjC++, call instantiate_pending_templates() and cp_finish_file(). (define_decl, get_static_reference, get_protocol_reference, create_builtin_decl): Remove functions. (objc_start_class_interface, objc_start_category_interface, objc_start_protocol, objc_continue_interface, objc_finish_interface, objc_start_class_implementation, objc_start_category_implementation, objc_continue_implementation, objc_finish_implementation, objc_set_visibility, objc_set_method_type, objc_build_method_signature, objc_add_method_declaration, objc_start_method_definition, objc_add_instance_variable, objc_get_protocol_qualified_type, create_field_decl, start_var_decl, finish_var_decl): New functions. (setup_string_decl): Simplify since it is only called once. (synth_module_prologue): Call build_class_template(); predefine 'id' and 'Class' as typedefs; rename 'temp_type' to 'type'; disable debug hooks for duration of function; fix GNU runtime messenger signatures to correspond to reality; forward-declare '__objc_exec_class' for the GNU runtime; call build_selector_table_decl(); in ObjC++ mode, generate 'extern "C" { ... }' wrappers around synthesized declarations; call build_protocol_template() and build_category_template(). (string_hash, string_eq): New functions. (objc_build_string_object): Check metaclass correctness only once; store string literals in hash table. (objc_build_constructor): Do not convert initializer elements; adjust for ObjC++ impedance mismatch. (build_objc_symtab_template): Call create_field_decl() instead of create_builtin_decl(). (init_objc_symtab): Add missing conversion to initializer element. (build_metadata_decl): Call start_var_decl() instead of define_decl(). (generate_objc_symtab_decl): Do not call build_category_template(); call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(). (build_module_descriptor): Call create_field_decl() instead of grokfield(); call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(); always mark module descriptor as used; move GNU runtime-specific functionality to build_module_initializer_routine(). (build_module_initializer_routine): New function, broken off of build_module_descriptor(). (objc_static_init_needed_p, objc_generate_static_init_call): New functions. (generate_static_references, generate_strings, build_selector_translation_table, generate_descriptor_table, generate_ivars_list, generate_dispatch_table, generate_category): Call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(); build a type directly instead of via groktypename(). (build_selector_reference_decl, build_selector_table_decl, build_class_reference_decl, build_protocol_reference, generate_objc_image_info): Call start_var_decl() instead of build_decl(). (build_selector_reference): For GNU runtime, do not call build_selector_reference_decl(). (build_selector, build_typed_selector_reference): Always convert result to the selector type. (add_objc_string): Cast return value to 'char *'. (build_method_prototype_template, build_selector_template, build_method_template): Use actual selector type for fields pointing to selectors. (finish_objc): For GNU runtime, call build_module_initializer_routine() after build_module_descriptor(). (generate_protocol_list, generate_shared_structures): Call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(); build a type directly instead of via groktypename(). (synth_id_with_class_suffix): Return a string. (get_arg_type_list): For instance methods, use the instance type for 'self'; do not call groktypename_in_parm_context(). (build_objc_string_decl): Squash redeclaration errors in ObjC++. (objc_is_class_name): Use OBJC_TYPE_NAME instead of TYPE_NAME; handle RECORD_TYPEs in ObjC as well as ObjC++. (objc_is_id): New function. (objc_is_object_ptr): Return the canonical type node. (objc_get_class_ivars): Simplify using get_class_ivars(). (get_class_ivars): Remove second parameter; create a fresh copy of the ivar list for each call; do not check for existence of super class. (objc_eh_runtime_type): Mark #ifndef OBJCPLUS. (objc_init_exceptions): When using SJLJ-style exceptions, require the use of '-fobjc-exceptions' flag; do not require it for DWARF-style exceptions. (objc_build_exc_ptr, next_sjlj_build_try_catch_finally): Use objc_object_type instead of objc_id_type. (objc_begin_catch_clause): Convert the incoming PARM_DECL into a VAR_DECL before placing it in the appropriate scope; do not call define_decl(); adjust call to c_begin_compound_stmt(); use objc_object_type instead of objc_id_type. (build_next_objc_exception_stuff): Call create_field_decl() instead of create_builtin_decl(); construct type directly instead of calling groktypename(); use OBJC_VOID_AT_END to mark end of function parameters. (build_private_template): Adjust call to get_class_ivars(); build a type directly instead of via groktypename(). (build_protocol_template, build_method_prototype_list_template, build_method_prototype_template, build_category_template, build_selector_template, build_class_template, build_super_template, build_ivar_template, build_ivar_list_template, build_method_list_template, build_method_template): Call create_field_decl() instead of grokfield(). (objc_method_parm_type): Do not call groktypename(). (generate_descriptor_table): Call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(). (generate_method_descriptors, build_protocol_initializer, generate_dispatch_tables, build_category_initializer, build_shared_structure_initializer): Do not call groktypename(). (generate_protocols): Call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(); do not call groktypename(). (error_with_ivar): Remove last parameter. (check_ivars): Do not iterate ovar CLASS_RAW_IVARS lists in addition to CLASS_IVARS lists; adjust calls to error_with_ivar(). (generate_ivar_lists): Convert one of the initializer elements; do not call groktypename(). (get_arg_type_list, start_method_def, gen_method_def): Account for new representation of variable arguments and '...' in Objective-C methods; add Objective-C++ impedance matching code. (is_objc_type_qualifier): Remove function. (adjust_type_for_id_default): Simplify; there is no longer a need to wade through declspecs. (lookup_interface, start_class, continue_class, finish_class, start_method_def, start_protocol, build_method_decl, objc_add_method, add_instance_variable, build_ivar_reference, is_ivar, is_private, get_super_receiver, objc_build_finally_epilogue): Make into static functions. (receiver_is_class_object): Use new IS_CLASS() macro. (objc_build_message_expr): Tweak ObjC++ message argument handling; call objc_finish_message_expr() instead of finish_message_expr(). (finish_message_expr): Rename to objc_finish_message_expr(); use OBJC_TYPE_NAME and OBJC_SET_TYPE_NAME macros instead of TYPE_NAME. call gen_type_name() instead of gen_declaration(); call objc_is_id() instead of using IS_ID and IS_CLASS; Use objc_class_name instead of calling get_identifier("Class"); handle CONVERT_EXPRs in receiver. (build_objc_method_call, warn_with_method): Do not call groktypename(). (build_ivar_reference): Call convert() instead of clobbering in a type. (hash_init): Initialize string_htab hash table. (add_instance_variable): Simplify parameter list; do not call grokfield(); do not populate CLASS_IVARS list. (start_class): Check for the existence of super class, if one was specified. (continue_class): Use CLASS_RAW_IVARS rather than CLASS_IVARS; do not call build_class_template(); adjust call to get_class_ivars(); call build_decl(), pushdecl() and finish_decl() instead of define_decl(). (finish_class): Call build_decl(), pushdecl() and finish_decl() instead of define_decl(). (add_protocols): Use PROTOCOL_BINFO_ELTS for the tree vector size. (start_protocol): Do not call build_protocol_template(); use PROTOCOL_BINFO_ELTS for the tree vector size. (encode_type_qualifiers): Do not handle the 'const' qualifier here. (encode_pointer): Encode 'const char *' as 'r*', for backwards compatibility. (encode_array): Use HOST_WIDE_INT_PRINT_DEC instead of "%ld". (encode_type): Handle the 'const' qualifier here. (objc_parmlist): New global variable, sued by objc_push_parm and objc_get_parm_info(). (objc_push_parm, objc_get_parm_info): New functions. (objc_expr_last): Remove function. (synth_self_and_ucmd_args): For instance methods, use the instance type for 'self'; call objc_push_parm() instead of push_parm_decl(). (start_method_def): Do not call push_scope(), declare_parm_level(), pop_scope(), push_parm_decl(), store_parm_decls() or objc_expr_last(); just use objc_push_parm() and objc_get_parm_info(). (comp_method_with_proto): Remove function. (objc_types_are_equivalent): Strip away indirections before comparing underlying types. (comp_proto_with_proto): Do not call groktypename(); types are no longer in raw declspec format. (objc_start_function): New function. (really_start_method): Call comp_proto_with_proto() instead of comp_method_with_proto(); call objc_start_function() instead of hand-crafting a function declarator. (continue_method_def, objc_expand_function_end): Remove functions. (get_super_receiver): Call objc_get_current_scope() instead of get_current_scope(); reference 'super_class' field (instead of 'class'). (finish_method_def): Rename to objc_finish_method_definition() and add a function decl parameter; move method encoding call from objc_expand_function_end(). (is_complex_decl, adorn_decl, gen_declarator, gen_declspecs, gen_declaration_1): Remove functions. (tmpbuf, RAW_DECLSPEC): Remove. (gen_declaration): Remove second parameter; simplify to deal with TYPE_P nodes instead of raw declspecs. (gen_type_name, gen_type_name_0): New functions. (gen_method_decl): Remove second parameter; call gen_type_name() instead of gen_declaration_1(). (dump_interface): Adjust calls to gen_declaration() and gen_method_decl(); do not allocate a separate string buffer. (init_objc): Allocate a larger string buffer to accommodate dump_interface(); adjust call to build_module_descriptor(); add call to build_module_initializer_routine() for the GNU runtime. (generate_classref_translation_entry): Do not call start_decl(); call finish_var_decl() instead of finish_decl(); call convert() instead of build_c_cast(). * objc-act.h (CLASS_OWN_IVARS): Remove accessor. (CLASS_BINFO_ELTS): Reduce from 6 to 5, now that CLASS_OWN_IVARS is gone. (OCTI_GNU_INIT_DECL, GNU_INIT_decl): New. (OCTI_ELLIPSIS_NODE, objc_ellipsis_node): Remove. (OCTI_ID_ID, id_type, objc_id_id): Rename to OCTI_ID_NAME, objc_object_type and objc_object_name, respectively. (OCTI_CLS_REF, OCTI_CLASS_NAME, objc_class_reference, objc_class_name): New. (IS_CLASS): New macro. (IS_ID, IS_SUPER): Robustify. (OCTI_EXECCLASS_DECL, execclass_decl): New. (finish_file, start_class, continue_class, finish_class, start_method_def, continue_method_def, finish_method_def, start_protocol, finish_protocol, objc_build_throw_stmt, objc_build_try_catch_finally_stmt, objc_build_synchronized_prologue, objc_build_synchronized_epilogue, objc_build_try_prologue, objc_build_try_epilogue, objc_build_catch_stmt, objc_build_catch_epilogue, objc_build_finally_prologue, objc_build_finally_epilogue, is_ivar, is_private, is_public, add_instance_variable, objc_add_method, get_super_receiver, objc_clear_super_receiver, get_class_ivars_from_name, get_class_reference, get_static_reference, get_object_reference, build_message_expr, finish_message_expr, build_selector_expr, build_ivar_reference, build_keyword_decl, build_method_decl, build_protocol_expr, build_objc_string_object, objc_declare_alias, objc_declare_class, objc_declare_protocols, objc_comptypes, objc_check_decl, build_encode_expr): Remove prototypes. (imp_count, cat_count): Make GGC-aware. (OBJC_SET_TYPE_NAME): New macro. From-SVN: r87168
2004-09-08 02:49:44 +02:00
return string;
}
/* If type is empty or only type qualifiers are present, add default
type of id (otherwise grokdeclarator will default to int). */
static tree
adjust_type_for_id_default (tree type)
{
if (!type)
Makefile.in (c-parse.o): Depend on $(C_COMMON_H). [gcc/ChangeLog] 2004-09-07 Ziemowit Laski <zlaski@apple.com> * Makefile.in (c-parse.o): Depend on $(C_COMMON_H). * c-parse.in: Include c-common.h instead of objc-act.h. (ivar_decl_list, ivar_decls, ivar_decl, ivars, ivar_declarator, myparms, myparm): Remove %type declarations. (methodtype, optparms, OBJC_TYPE_QUAL, objc_quals, objc_qual, objc_typename, objc_try_catch_stmt, optellipsis): Add %type declarations. (objc_inherit_code, objc_public_flag): Remove. (typespec_nonreserved_nonattr): Call objc_get_protocol_qualified_type() instead of get_static_reference() and get_protocol_reference(). (stmt_nocomp): Call grokparm() on @catch parameter. (objcdef): Move semantic action to objc_finish_implementation(). (classdef): Move semantic action to objc_start_class_interface(), objc_continue_interface(), objc_finish_interface(), objc_start_class_implementation(), objc_continue_implementation(), objc_start_category_interface() and objc_start_category_implementation(). (protocoldef): Move semantic actions to objc_start_protocol() and objc_finish_interface(). (ivar_decl_list): Remove nonterminal. (visibility_spec): Move semantic actions to objc_set_visibility(). (ivar_decls): Remove assignment to $$. (ivar_decl): Rephrase in terms of component_decl; call objc_add_instance_variable(). (ivars, ivar_declarator): Remove nonterminals. (opt_semi): New nonterminal. (methodtype): Remove semantic actions. (methoddef): Move semantic actions to objc_set_method_type(), objc_start_method_definition() and objc_finish_method_definition(). (methodproto): Move semantic actions to objc_set_method_type() and objc_add_method_declaration(). (methoddecl): Use objc_typename instead of typename; move semantic actions to objc_build_method_signature(). (optarglist, myxdecls, mydecl, myparms, myparm): Remove nonterminals. (optparmlist): Express in terms of optparms and optellipsis. (optparms, optellipsis, objc_qual, objc_quals, objc_typename): New nonterminals. (keyworddecl): Use objc_typename instead of typename. (rid_to_yy): Mark RID_IN, RID_OUT, RID_INOUT, RID_BYCOPY, RID_BYREF and RID_ONEWAY as returning OBJC_TYPE_QUAL to yyparse(). [gcc/objc/ChangeLog] 2004-09-07 Ziemowit Laski <zlaski@apple.com> * Make-lang.in (objc/objc-parse.o): Depend on $(C_COMMON_H) instead of objc/objc-act.h. (objc/objc-act.o): Depend on $(HASHTAB_H). * objc-act.c: Include hashtab.h; in ObjC++ mode, include cp-tree.h and objcp-decl.h instead of c-tree.h. (build_module_descriptor, get_class_ivars, synth_id_with_class_suffix, error_with_ivar, gen_method_decl, gen_declaration, setup_string_decl, build_protocol_template): Adjust prototypes. (build_module_initializer_routine, start_class, continue_class, finish_class, start_method_def, objc_start_function, start_protocol, build_method_decl, objc_add_method, add_instance_variable, build_ivar_reference, is_ivar, is_private, get_super_receiver, build_selector_table_decl, objc_push_parm, objc_get_parm_info, gen_type_name, gen_type_name_0, start_var_decl, finish_var_decl, create_field_decl): New prototypes. (objc_expand_function_end, comp_method_with_proto, objc_expr_last, gen_declaration_1, gen_declarator, is_complex_decl, adorn_decl, define_decl, create_builtin_decl, gen_declspecs): Remove prototypes. (TYPE_ID): Rename to OBJECT_TYPEDEF_NAME. (CLASS_TYPEDEF_NAME): New. (TAG_EXECCLASS): Change from a global variable to a #define. (TAG_RETURN_STRUCT): Delete. (TAG_GNUINIT): New, holds '__objc_gnu_init' name. (objc_inherit_code, objc_public_flag): New, moved from c-parse.in. (string_descriptor): New struct. (string_htab): New hash table. (string_hash, string_eq): New prototypes. (generate_struct_by_value_array): Call create_field_decl() instead of create_builtin_decl(). (objc_init): Do not initialize objc_ellipsis_node or TAG_EXECCLASS; In ObjC++ mode, call cxx_init() instead of c_objc_common_init(). (objc_finish_file): In ObjC++, call instantiate_pending_templates() and cp_finish_file(). (define_decl, get_static_reference, get_protocol_reference, create_builtin_decl): Remove functions. (objc_start_class_interface, objc_start_category_interface, objc_start_protocol, objc_continue_interface, objc_finish_interface, objc_start_class_implementation, objc_start_category_implementation, objc_continue_implementation, objc_finish_implementation, objc_set_visibility, objc_set_method_type, objc_build_method_signature, objc_add_method_declaration, objc_start_method_definition, objc_add_instance_variable, objc_get_protocol_qualified_type, create_field_decl, start_var_decl, finish_var_decl): New functions. (setup_string_decl): Simplify since it is only called once. (synth_module_prologue): Call build_class_template(); predefine 'id' and 'Class' as typedefs; rename 'temp_type' to 'type'; disable debug hooks for duration of function; fix GNU runtime messenger signatures to correspond to reality; forward-declare '__objc_exec_class' for the GNU runtime; call build_selector_table_decl(); in ObjC++ mode, generate 'extern "C" { ... }' wrappers around synthesized declarations; call build_protocol_template() and build_category_template(). (string_hash, string_eq): New functions. (objc_build_string_object): Check metaclass correctness only once; store string literals in hash table. (objc_build_constructor): Do not convert initializer elements; adjust for ObjC++ impedance mismatch. (build_objc_symtab_template): Call create_field_decl() instead of create_builtin_decl(). (init_objc_symtab): Add missing conversion to initializer element. (build_metadata_decl): Call start_var_decl() instead of define_decl(). (generate_objc_symtab_decl): Do not call build_category_template(); call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(). (build_module_descriptor): Call create_field_decl() instead of grokfield(); call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(); always mark module descriptor as used; move GNU runtime-specific functionality to build_module_initializer_routine(). (build_module_initializer_routine): New function, broken off of build_module_descriptor(). (objc_static_init_needed_p, objc_generate_static_init_call): New functions. (generate_static_references, generate_strings, build_selector_translation_table, generate_descriptor_table, generate_ivars_list, generate_dispatch_table, generate_category): Call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(); build a type directly instead of via groktypename(). (build_selector_reference_decl, build_selector_table_decl, build_class_reference_decl, build_protocol_reference, generate_objc_image_info): Call start_var_decl() instead of build_decl(). (build_selector_reference): For GNU runtime, do not call build_selector_reference_decl(). (build_selector, build_typed_selector_reference): Always convert result to the selector type. (add_objc_string): Cast return value to 'char *'. (build_method_prototype_template, build_selector_template, build_method_template): Use actual selector type for fields pointing to selectors. (finish_objc): For GNU runtime, call build_module_initializer_routine() after build_module_descriptor(). (generate_protocol_list, generate_shared_structures): Call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(); build a type directly instead of via groktypename(). (synth_id_with_class_suffix): Return a string. (get_arg_type_list): For instance methods, use the instance type for 'self'; do not call groktypename_in_parm_context(). (build_objc_string_decl): Squash redeclaration errors in ObjC++. (objc_is_class_name): Use OBJC_TYPE_NAME instead of TYPE_NAME; handle RECORD_TYPEs in ObjC as well as ObjC++. (objc_is_id): New function. (objc_is_object_ptr): Return the canonical type node. (objc_get_class_ivars): Simplify using get_class_ivars(). (get_class_ivars): Remove second parameter; create a fresh copy of the ivar list for each call; do not check for existence of super class. (objc_eh_runtime_type): Mark #ifndef OBJCPLUS. (objc_init_exceptions): When using SJLJ-style exceptions, require the use of '-fobjc-exceptions' flag; do not require it for DWARF-style exceptions. (objc_build_exc_ptr, next_sjlj_build_try_catch_finally): Use objc_object_type instead of objc_id_type. (objc_begin_catch_clause): Convert the incoming PARM_DECL into a VAR_DECL before placing it in the appropriate scope; do not call define_decl(); adjust call to c_begin_compound_stmt(); use objc_object_type instead of objc_id_type. (build_next_objc_exception_stuff): Call create_field_decl() instead of create_builtin_decl(); construct type directly instead of calling groktypename(); use OBJC_VOID_AT_END to mark end of function parameters. (build_private_template): Adjust call to get_class_ivars(); build a type directly instead of via groktypename(). (build_protocol_template, build_method_prototype_list_template, build_method_prototype_template, build_category_template, build_selector_template, build_class_template, build_super_template, build_ivar_template, build_ivar_list_template, build_method_list_template, build_method_template): Call create_field_decl() instead of grokfield(). (objc_method_parm_type): Do not call groktypename(). (generate_descriptor_table): Call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(). (generate_method_descriptors, build_protocol_initializer, generate_dispatch_tables, build_category_initializer, build_shared_structure_initializer): Do not call groktypename(). (generate_protocols): Call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(); do not call groktypename(). (error_with_ivar): Remove last parameter. (check_ivars): Do not iterate ovar CLASS_RAW_IVARS lists in addition to CLASS_IVARS lists; adjust calls to error_with_ivar(). (generate_ivar_lists): Convert one of the initializer elements; do not call groktypename(). (get_arg_type_list, start_method_def, gen_method_def): Account for new representation of variable arguments and '...' in Objective-C methods; add Objective-C++ impedance matching code. (is_objc_type_qualifier): Remove function. (adjust_type_for_id_default): Simplify; there is no longer a need to wade through declspecs. (lookup_interface, start_class, continue_class, finish_class, start_method_def, start_protocol, build_method_decl, objc_add_method, add_instance_variable, build_ivar_reference, is_ivar, is_private, get_super_receiver, objc_build_finally_epilogue): Make into static functions. (receiver_is_class_object): Use new IS_CLASS() macro. (objc_build_message_expr): Tweak ObjC++ message argument handling; call objc_finish_message_expr() instead of finish_message_expr(). (finish_message_expr): Rename to objc_finish_message_expr(); use OBJC_TYPE_NAME and OBJC_SET_TYPE_NAME macros instead of TYPE_NAME. call gen_type_name() instead of gen_declaration(); call objc_is_id() instead of using IS_ID and IS_CLASS; Use objc_class_name instead of calling get_identifier("Class"); handle CONVERT_EXPRs in receiver. (build_objc_method_call, warn_with_method): Do not call groktypename(). (build_ivar_reference): Call convert() instead of clobbering in a type. (hash_init): Initialize string_htab hash table. (add_instance_variable): Simplify parameter list; do not call grokfield(); do not populate CLASS_IVARS list. (start_class): Check for the existence of super class, if one was specified. (continue_class): Use CLASS_RAW_IVARS rather than CLASS_IVARS; do not call build_class_template(); adjust call to get_class_ivars(); call build_decl(), pushdecl() and finish_decl() instead of define_decl(). (finish_class): Call build_decl(), pushdecl() and finish_decl() instead of define_decl(). (add_protocols): Use PROTOCOL_BINFO_ELTS for the tree vector size. (start_protocol): Do not call build_protocol_template(); use PROTOCOL_BINFO_ELTS for the tree vector size. (encode_type_qualifiers): Do not handle the 'const' qualifier here. (encode_pointer): Encode 'const char *' as 'r*', for backwards compatibility. (encode_array): Use HOST_WIDE_INT_PRINT_DEC instead of "%ld". (encode_type): Handle the 'const' qualifier here. (objc_parmlist): New global variable, sued by objc_push_parm and objc_get_parm_info(). (objc_push_parm, objc_get_parm_info): New functions. (objc_expr_last): Remove function. (synth_self_and_ucmd_args): For instance methods, use the instance type for 'self'; call objc_push_parm() instead of push_parm_decl(). (start_method_def): Do not call push_scope(), declare_parm_level(), pop_scope(), push_parm_decl(), store_parm_decls() or objc_expr_last(); just use objc_push_parm() and objc_get_parm_info(). (comp_method_with_proto): Remove function. (objc_types_are_equivalent): Strip away indirections before comparing underlying types. (comp_proto_with_proto): Do not call groktypename(); types are no longer in raw declspec format. (objc_start_function): New function. (really_start_method): Call comp_proto_with_proto() instead of comp_method_with_proto(); call objc_start_function() instead of hand-crafting a function declarator. (continue_method_def, objc_expand_function_end): Remove functions. (get_super_receiver): Call objc_get_current_scope() instead of get_current_scope(); reference 'super_class' field (instead of 'class'). (finish_method_def): Rename to objc_finish_method_definition() and add a function decl parameter; move method encoding call from objc_expand_function_end(). (is_complex_decl, adorn_decl, gen_declarator, gen_declspecs, gen_declaration_1): Remove functions. (tmpbuf, RAW_DECLSPEC): Remove. (gen_declaration): Remove second parameter; simplify to deal with TYPE_P nodes instead of raw declspecs. (gen_type_name, gen_type_name_0): New functions. (gen_method_decl): Remove second parameter; call gen_type_name() instead of gen_declaration_1(). (dump_interface): Adjust calls to gen_declaration() and gen_method_decl(); do not allocate a separate string buffer. (init_objc): Allocate a larger string buffer to accommodate dump_interface(); adjust call to build_module_descriptor(); add call to build_module_initializer_routine() for the GNU runtime. (generate_classref_translation_entry): Do not call start_decl(); call finish_var_decl() instead of finish_decl(); call convert() instead of build_c_cast(). * objc-act.h (CLASS_OWN_IVARS): Remove accessor. (CLASS_BINFO_ELTS): Reduce from 6 to 5, now that CLASS_OWN_IVARS is gone. (OCTI_GNU_INIT_DECL, GNU_INIT_decl): New. (OCTI_ELLIPSIS_NODE, objc_ellipsis_node): Remove. (OCTI_ID_ID, id_type, objc_id_id): Rename to OCTI_ID_NAME, objc_object_type and objc_object_name, respectively. (OCTI_CLS_REF, OCTI_CLASS_NAME, objc_class_reference, objc_class_name): New. (IS_CLASS): New macro. (IS_ID, IS_SUPER): Robustify. (OCTI_EXECCLASS_DECL, execclass_decl): New. (finish_file, start_class, continue_class, finish_class, start_method_def, continue_method_def, finish_method_def, start_protocol, finish_protocol, objc_build_throw_stmt, objc_build_try_catch_finally_stmt, objc_build_synchronized_prologue, objc_build_synchronized_epilogue, objc_build_try_prologue, objc_build_try_epilogue, objc_build_catch_stmt, objc_build_catch_epilogue, objc_build_finally_prologue, objc_build_finally_epilogue, is_ivar, is_private, is_public, add_instance_variable, objc_add_method, get_super_receiver, objc_clear_super_receiver, get_class_ivars_from_name, get_class_reference, get_static_reference, get_object_reference, build_message_expr, finish_message_expr, build_selector_expr, build_ivar_reference, build_keyword_decl, build_method_decl, build_protocol_expr, build_objc_string_object, objc_declare_alias, objc_declare_class, objc_declare_protocols, objc_comptypes, objc_check_decl, build_encode_expr): Remove prototypes. (imp_count, cat_count): Make GGC-aware. (OBJC_SET_TYPE_NAME): New macro. From-SVN: r87168
2004-09-08 02:49:44 +02:00
type = make_node (TREE_LIST);
Makefile.in (c-parse.o): Depend on $(C_COMMON_H). [gcc/ChangeLog] 2004-09-07 Ziemowit Laski <zlaski@apple.com> * Makefile.in (c-parse.o): Depend on $(C_COMMON_H). * c-parse.in: Include c-common.h instead of objc-act.h. (ivar_decl_list, ivar_decls, ivar_decl, ivars, ivar_declarator, myparms, myparm): Remove %type declarations. (methodtype, optparms, OBJC_TYPE_QUAL, objc_quals, objc_qual, objc_typename, objc_try_catch_stmt, optellipsis): Add %type declarations. (objc_inherit_code, objc_public_flag): Remove. (typespec_nonreserved_nonattr): Call objc_get_protocol_qualified_type() instead of get_static_reference() and get_protocol_reference(). (stmt_nocomp): Call grokparm() on @catch parameter. (objcdef): Move semantic action to objc_finish_implementation(). (classdef): Move semantic action to objc_start_class_interface(), objc_continue_interface(), objc_finish_interface(), objc_start_class_implementation(), objc_continue_implementation(), objc_start_category_interface() and objc_start_category_implementation(). (protocoldef): Move semantic actions to objc_start_protocol() and objc_finish_interface(). (ivar_decl_list): Remove nonterminal. (visibility_spec): Move semantic actions to objc_set_visibility(). (ivar_decls): Remove assignment to $$. (ivar_decl): Rephrase in terms of component_decl; call objc_add_instance_variable(). (ivars, ivar_declarator): Remove nonterminals. (opt_semi): New nonterminal. (methodtype): Remove semantic actions. (methoddef): Move semantic actions to objc_set_method_type(), objc_start_method_definition() and objc_finish_method_definition(). (methodproto): Move semantic actions to objc_set_method_type() and objc_add_method_declaration(). (methoddecl): Use objc_typename instead of typename; move semantic actions to objc_build_method_signature(). (optarglist, myxdecls, mydecl, myparms, myparm): Remove nonterminals. (optparmlist): Express in terms of optparms and optellipsis. (optparms, optellipsis, objc_qual, objc_quals, objc_typename): New nonterminals. (keyworddecl): Use objc_typename instead of typename. (rid_to_yy): Mark RID_IN, RID_OUT, RID_INOUT, RID_BYCOPY, RID_BYREF and RID_ONEWAY as returning OBJC_TYPE_QUAL to yyparse(). [gcc/objc/ChangeLog] 2004-09-07 Ziemowit Laski <zlaski@apple.com> * Make-lang.in (objc/objc-parse.o): Depend on $(C_COMMON_H) instead of objc/objc-act.h. (objc/objc-act.o): Depend on $(HASHTAB_H). * objc-act.c: Include hashtab.h; in ObjC++ mode, include cp-tree.h and objcp-decl.h instead of c-tree.h. (build_module_descriptor, get_class_ivars, synth_id_with_class_suffix, error_with_ivar, gen_method_decl, gen_declaration, setup_string_decl, build_protocol_template): Adjust prototypes. (build_module_initializer_routine, start_class, continue_class, finish_class, start_method_def, objc_start_function, start_protocol, build_method_decl, objc_add_method, add_instance_variable, build_ivar_reference, is_ivar, is_private, get_super_receiver, build_selector_table_decl, objc_push_parm, objc_get_parm_info, gen_type_name, gen_type_name_0, start_var_decl, finish_var_decl, create_field_decl): New prototypes. (objc_expand_function_end, comp_method_with_proto, objc_expr_last, gen_declaration_1, gen_declarator, is_complex_decl, adorn_decl, define_decl, create_builtin_decl, gen_declspecs): Remove prototypes. (TYPE_ID): Rename to OBJECT_TYPEDEF_NAME. (CLASS_TYPEDEF_NAME): New. (TAG_EXECCLASS): Change from a global variable to a #define. (TAG_RETURN_STRUCT): Delete. (TAG_GNUINIT): New, holds '__objc_gnu_init' name. (objc_inherit_code, objc_public_flag): New, moved from c-parse.in. (string_descriptor): New struct. (string_htab): New hash table. (string_hash, string_eq): New prototypes. (generate_struct_by_value_array): Call create_field_decl() instead of create_builtin_decl(). (objc_init): Do not initialize objc_ellipsis_node or TAG_EXECCLASS; In ObjC++ mode, call cxx_init() instead of c_objc_common_init(). (objc_finish_file): In ObjC++, call instantiate_pending_templates() and cp_finish_file(). (define_decl, get_static_reference, get_protocol_reference, create_builtin_decl): Remove functions. (objc_start_class_interface, objc_start_category_interface, objc_start_protocol, objc_continue_interface, objc_finish_interface, objc_start_class_implementation, objc_start_category_implementation, objc_continue_implementation, objc_finish_implementation, objc_set_visibility, objc_set_method_type, objc_build_method_signature, objc_add_method_declaration, objc_start_method_definition, objc_add_instance_variable, objc_get_protocol_qualified_type, create_field_decl, start_var_decl, finish_var_decl): New functions. (setup_string_decl): Simplify since it is only called once. (synth_module_prologue): Call build_class_template(); predefine 'id' and 'Class' as typedefs; rename 'temp_type' to 'type'; disable debug hooks for duration of function; fix GNU runtime messenger signatures to correspond to reality; forward-declare '__objc_exec_class' for the GNU runtime; call build_selector_table_decl(); in ObjC++ mode, generate 'extern "C" { ... }' wrappers around synthesized declarations; call build_protocol_template() and build_category_template(). (string_hash, string_eq): New functions. (objc_build_string_object): Check metaclass correctness only once; store string literals in hash table. (objc_build_constructor): Do not convert initializer elements; adjust for ObjC++ impedance mismatch. (build_objc_symtab_template): Call create_field_decl() instead of create_builtin_decl(). (init_objc_symtab): Add missing conversion to initializer element. (build_metadata_decl): Call start_var_decl() instead of define_decl(). (generate_objc_symtab_decl): Do not call build_category_template(); call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(). (build_module_descriptor): Call create_field_decl() instead of grokfield(); call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(); always mark module descriptor as used; move GNU runtime-specific functionality to build_module_initializer_routine(). (build_module_initializer_routine): New function, broken off of build_module_descriptor(). (objc_static_init_needed_p, objc_generate_static_init_call): New functions. (generate_static_references, generate_strings, build_selector_translation_table, generate_descriptor_table, generate_ivars_list, generate_dispatch_table, generate_category): Call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(); build a type directly instead of via groktypename(). (build_selector_reference_decl, build_selector_table_decl, build_class_reference_decl, build_protocol_reference, generate_objc_image_info): Call start_var_decl() instead of build_decl(). (build_selector_reference): For GNU runtime, do not call build_selector_reference_decl(). (build_selector, build_typed_selector_reference): Always convert result to the selector type. (add_objc_string): Cast return value to 'char *'. (build_method_prototype_template, build_selector_template, build_method_template): Use actual selector type for fields pointing to selectors. (finish_objc): For GNU runtime, call build_module_initializer_routine() after build_module_descriptor(). (generate_protocol_list, generate_shared_structures): Call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(); build a type directly instead of via groktypename(). (synth_id_with_class_suffix): Return a string. (get_arg_type_list): For instance methods, use the instance type for 'self'; do not call groktypename_in_parm_context(). (build_objc_string_decl): Squash redeclaration errors in ObjC++. (objc_is_class_name): Use OBJC_TYPE_NAME instead of TYPE_NAME; handle RECORD_TYPEs in ObjC as well as ObjC++. (objc_is_id): New function. (objc_is_object_ptr): Return the canonical type node. (objc_get_class_ivars): Simplify using get_class_ivars(). (get_class_ivars): Remove second parameter; create a fresh copy of the ivar list for each call; do not check for existence of super class. (objc_eh_runtime_type): Mark #ifndef OBJCPLUS. (objc_init_exceptions): When using SJLJ-style exceptions, require the use of '-fobjc-exceptions' flag; do not require it for DWARF-style exceptions. (objc_build_exc_ptr, next_sjlj_build_try_catch_finally): Use objc_object_type instead of objc_id_type. (objc_begin_catch_clause): Convert the incoming PARM_DECL into a VAR_DECL before placing it in the appropriate scope; do not call define_decl(); adjust call to c_begin_compound_stmt(); use objc_object_type instead of objc_id_type. (build_next_objc_exception_stuff): Call create_field_decl() instead of create_builtin_decl(); construct type directly instead of calling groktypename(); use OBJC_VOID_AT_END to mark end of function parameters. (build_private_template): Adjust call to get_class_ivars(); build a type directly instead of via groktypename(). (build_protocol_template, build_method_prototype_list_template, build_method_prototype_template, build_category_template, build_selector_template, build_class_template, build_super_template, build_ivar_template, build_ivar_list_template, build_method_list_template, build_method_template): Call create_field_decl() instead of grokfield(). (objc_method_parm_type): Do not call groktypename(). (generate_descriptor_table): Call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(). (generate_method_descriptors, build_protocol_initializer, generate_dispatch_tables, build_category_initializer, build_shared_structure_initializer): Do not call groktypename(). (generate_protocols): Call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(); do not call groktypename(). (error_with_ivar): Remove last parameter. (check_ivars): Do not iterate ovar CLASS_RAW_IVARS lists in addition to CLASS_IVARS lists; adjust calls to error_with_ivar(). (generate_ivar_lists): Convert one of the initializer elements; do not call groktypename(). (get_arg_type_list, start_method_def, gen_method_def): Account for new representation of variable arguments and '...' in Objective-C methods; add Objective-C++ impedance matching code. (is_objc_type_qualifier): Remove function. (adjust_type_for_id_default): Simplify; there is no longer a need to wade through declspecs. (lookup_interface, start_class, continue_class, finish_class, start_method_def, start_protocol, build_method_decl, objc_add_method, add_instance_variable, build_ivar_reference, is_ivar, is_private, get_super_receiver, objc_build_finally_epilogue): Make into static functions. (receiver_is_class_object): Use new IS_CLASS() macro. (objc_build_message_expr): Tweak ObjC++ message argument handling; call objc_finish_message_expr() instead of finish_message_expr(). (finish_message_expr): Rename to objc_finish_message_expr(); use OBJC_TYPE_NAME and OBJC_SET_TYPE_NAME macros instead of TYPE_NAME. call gen_type_name() instead of gen_declaration(); call objc_is_id() instead of using IS_ID and IS_CLASS; Use objc_class_name instead of calling get_identifier("Class"); handle CONVERT_EXPRs in receiver. (build_objc_method_call, warn_with_method): Do not call groktypename(). (build_ivar_reference): Call convert() instead of clobbering in a type. (hash_init): Initialize string_htab hash table. (add_instance_variable): Simplify parameter list; do not call grokfield(); do not populate CLASS_IVARS list. (start_class): Check for the existence of super class, if one was specified. (continue_class): Use CLASS_RAW_IVARS rather than CLASS_IVARS; do not call build_class_template(); adjust call to get_class_ivars(); call build_decl(), pushdecl() and finish_decl() instead of define_decl(). (finish_class): Call build_decl(), pushdecl() and finish_decl() instead of define_decl(). (add_protocols): Use PROTOCOL_BINFO_ELTS for the tree vector size. (start_protocol): Do not call build_protocol_template(); use PROTOCOL_BINFO_ELTS for the tree vector size. (encode_type_qualifiers): Do not handle the 'const' qualifier here. (encode_pointer): Encode 'const char *' as 'r*', for backwards compatibility. (encode_array): Use HOST_WIDE_INT_PRINT_DEC instead of "%ld". (encode_type): Handle the 'const' qualifier here. (objc_parmlist): New global variable, sued by objc_push_parm and objc_get_parm_info(). (objc_push_parm, objc_get_parm_info): New functions. (objc_expr_last): Remove function. (synth_self_and_ucmd_args): For instance methods, use the instance type for 'self'; call objc_push_parm() instead of push_parm_decl(). (start_method_def): Do not call push_scope(), declare_parm_level(), pop_scope(), push_parm_decl(), store_parm_decls() or objc_expr_last(); just use objc_push_parm() and objc_get_parm_info(). (comp_method_with_proto): Remove function. (objc_types_are_equivalent): Strip away indirections before comparing underlying types. (comp_proto_with_proto): Do not call groktypename(); types are no longer in raw declspec format. (objc_start_function): New function. (really_start_method): Call comp_proto_with_proto() instead of comp_method_with_proto(); call objc_start_function() instead of hand-crafting a function declarator. (continue_method_def, objc_expand_function_end): Remove functions. (get_super_receiver): Call objc_get_current_scope() instead of get_current_scope(); reference 'super_class' field (instead of 'class'). (finish_method_def): Rename to objc_finish_method_definition() and add a function decl parameter; move method encoding call from objc_expand_function_end(). (is_complex_decl, adorn_decl, gen_declarator, gen_declspecs, gen_declaration_1): Remove functions. (tmpbuf, RAW_DECLSPEC): Remove. (gen_declaration): Remove second parameter; simplify to deal with TYPE_P nodes instead of raw declspecs. (gen_type_name, gen_type_name_0): New functions. (gen_method_decl): Remove second parameter; call gen_type_name() instead of gen_declaration_1(). (dump_interface): Adjust calls to gen_declaration() and gen_method_decl(); do not allocate a separate string buffer. (init_objc): Allocate a larger string buffer to accommodate dump_interface(); adjust call to build_module_descriptor(); add call to build_module_initializer_routine() for the GNU runtime. (generate_classref_translation_entry): Do not call start_decl(); call finish_var_decl() instead of finish_decl(); call convert() instead of build_c_cast(). * objc-act.h (CLASS_OWN_IVARS): Remove accessor. (CLASS_BINFO_ELTS): Reduce from 6 to 5, now that CLASS_OWN_IVARS is gone. (OCTI_GNU_INIT_DECL, GNU_INIT_decl): New. (OCTI_ELLIPSIS_NODE, objc_ellipsis_node): Remove. (OCTI_ID_ID, id_type, objc_id_id): Rename to OCTI_ID_NAME, objc_object_type and objc_object_name, respectively. (OCTI_CLS_REF, OCTI_CLASS_NAME, objc_class_reference, objc_class_name): New. (IS_CLASS): New macro. (IS_ID, IS_SUPER): Robustify. (OCTI_EXECCLASS_DECL, execclass_decl): New. (finish_file, start_class, continue_class, finish_class, start_method_def, continue_method_def, finish_method_def, start_protocol, finish_protocol, objc_build_throw_stmt, objc_build_try_catch_finally_stmt, objc_build_synchronized_prologue, objc_build_synchronized_epilogue, objc_build_try_prologue, objc_build_try_epilogue, objc_build_catch_stmt, objc_build_catch_epilogue, objc_build_finally_prologue, objc_build_finally_epilogue, is_ivar, is_private, is_public, add_instance_variable, objc_add_method, get_super_receiver, objc_clear_super_receiver, get_class_ivars_from_name, get_class_reference, get_static_reference, get_object_reference, build_message_expr, finish_message_expr, build_selector_expr, build_ivar_reference, build_keyword_decl, build_method_decl, build_protocol_expr, build_objc_string_object, objc_declare_alias, objc_declare_class, objc_declare_protocols, objc_comptypes, objc_check_decl, build_encode_expr): Remove prototypes. (imp_count, cat_count): Make GGC-aware. (OBJC_SET_TYPE_NAME): New macro. From-SVN: r87168
2004-09-08 02:49:44 +02:00
if (!TREE_VALUE (type))
TREE_VALUE (type) = objc_object_type;
else if (TREE_CODE (TREE_VALUE (type)) == RECORD_TYPE
&& TYPED_OBJECT (TREE_VALUE (type)))
error ("can not use an object as parameter to a method");
Makefile.in (c-parse.o): Depend on $(C_COMMON_H). [gcc/ChangeLog] 2004-09-07 Ziemowit Laski <zlaski@apple.com> * Makefile.in (c-parse.o): Depend on $(C_COMMON_H). * c-parse.in: Include c-common.h instead of objc-act.h. (ivar_decl_list, ivar_decls, ivar_decl, ivars, ivar_declarator, myparms, myparm): Remove %type declarations. (methodtype, optparms, OBJC_TYPE_QUAL, objc_quals, objc_qual, objc_typename, objc_try_catch_stmt, optellipsis): Add %type declarations. (objc_inherit_code, objc_public_flag): Remove. (typespec_nonreserved_nonattr): Call objc_get_protocol_qualified_type() instead of get_static_reference() and get_protocol_reference(). (stmt_nocomp): Call grokparm() on @catch parameter. (objcdef): Move semantic action to objc_finish_implementation(). (classdef): Move semantic action to objc_start_class_interface(), objc_continue_interface(), objc_finish_interface(), objc_start_class_implementation(), objc_continue_implementation(), objc_start_category_interface() and objc_start_category_implementation(). (protocoldef): Move semantic actions to objc_start_protocol() and objc_finish_interface(). (ivar_decl_list): Remove nonterminal. (visibility_spec): Move semantic actions to objc_set_visibility(). (ivar_decls): Remove assignment to $$. (ivar_decl): Rephrase in terms of component_decl; call objc_add_instance_variable(). (ivars, ivar_declarator): Remove nonterminals. (opt_semi): New nonterminal. (methodtype): Remove semantic actions. (methoddef): Move semantic actions to objc_set_method_type(), objc_start_method_definition() and objc_finish_method_definition(). (methodproto): Move semantic actions to objc_set_method_type() and objc_add_method_declaration(). (methoddecl): Use objc_typename instead of typename; move semantic actions to objc_build_method_signature(). (optarglist, myxdecls, mydecl, myparms, myparm): Remove nonterminals. (optparmlist): Express in terms of optparms and optellipsis. (optparms, optellipsis, objc_qual, objc_quals, objc_typename): New nonterminals. (keyworddecl): Use objc_typename instead of typename. (rid_to_yy): Mark RID_IN, RID_OUT, RID_INOUT, RID_BYCOPY, RID_BYREF and RID_ONEWAY as returning OBJC_TYPE_QUAL to yyparse(). [gcc/objc/ChangeLog] 2004-09-07 Ziemowit Laski <zlaski@apple.com> * Make-lang.in (objc/objc-parse.o): Depend on $(C_COMMON_H) instead of objc/objc-act.h. (objc/objc-act.o): Depend on $(HASHTAB_H). * objc-act.c: Include hashtab.h; in ObjC++ mode, include cp-tree.h and objcp-decl.h instead of c-tree.h. (build_module_descriptor, get_class_ivars, synth_id_with_class_suffix, error_with_ivar, gen_method_decl, gen_declaration, setup_string_decl, build_protocol_template): Adjust prototypes. (build_module_initializer_routine, start_class, continue_class, finish_class, start_method_def, objc_start_function, start_protocol, build_method_decl, objc_add_method, add_instance_variable, build_ivar_reference, is_ivar, is_private, get_super_receiver, build_selector_table_decl, objc_push_parm, objc_get_parm_info, gen_type_name, gen_type_name_0, start_var_decl, finish_var_decl, create_field_decl): New prototypes. (objc_expand_function_end, comp_method_with_proto, objc_expr_last, gen_declaration_1, gen_declarator, is_complex_decl, adorn_decl, define_decl, create_builtin_decl, gen_declspecs): Remove prototypes. (TYPE_ID): Rename to OBJECT_TYPEDEF_NAME. (CLASS_TYPEDEF_NAME): New. (TAG_EXECCLASS): Change from a global variable to a #define. (TAG_RETURN_STRUCT): Delete. (TAG_GNUINIT): New, holds '__objc_gnu_init' name. (objc_inherit_code, objc_public_flag): New, moved from c-parse.in. (string_descriptor): New struct. (string_htab): New hash table. (string_hash, string_eq): New prototypes. (generate_struct_by_value_array): Call create_field_decl() instead of create_builtin_decl(). (objc_init): Do not initialize objc_ellipsis_node or TAG_EXECCLASS; In ObjC++ mode, call cxx_init() instead of c_objc_common_init(). (objc_finish_file): In ObjC++, call instantiate_pending_templates() and cp_finish_file(). (define_decl, get_static_reference, get_protocol_reference, create_builtin_decl): Remove functions. (objc_start_class_interface, objc_start_category_interface, objc_start_protocol, objc_continue_interface, objc_finish_interface, objc_start_class_implementation, objc_start_category_implementation, objc_continue_implementation, objc_finish_implementation, objc_set_visibility, objc_set_method_type, objc_build_method_signature, objc_add_method_declaration, objc_start_method_definition, objc_add_instance_variable, objc_get_protocol_qualified_type, create_field_decl, start_var_decl, finish_var_decl): New functions. (setup_string_decl): Simplify since it is only called once. (synth_module_prologue): Call build_class_template(); predefine 'id' and 'Class' as typedefs; rename 'temp_type' to 'type'; disable debug hooks for duration of function; fix GNU runtime messenger signatures to correspond to reality; forward-declare '__objc_exec_class' for the GNU runtime; call build_selector_table_decl(); in ObjC++ mode, generate 'extern "C" { ... }' wrappers around synthesized declarations; call build_protocol_template() and build_category_template(). (string_hash, string_eq): New functions. (objc_build_string_object): Check metaclass correctness only once; store string literals in hash table. (objc_build_constructor): Do not convert initializer elements; adjust for ObjC++ impedance mismatch. (build_objc_symtab_template): Call create_field_decl() instead of create_builtin_decl(). (init_objc_symtab): Add missing conversion to initializer element. (build_metadata_decl): Call start_var_decl() instead of define_decl(). (generate_objc_symtab_decl): Do not call build_category_template(); call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(). (build_module_descriptor): Call create_field_decl() instead of grokfield(); call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(); always mark module descriptor as used; move GNU runtime-specific functionality to build_module_initializer_routine(). (build_module_initializer_routine): New function, broken off of build_module_descriptor(). (objc_static_init_needed_p, objc_generate_static_init_call): New functions. (generate_static_references, generate_strings, build_selector_translation_table, generate_descriptor_table, generate_ivars_list, generate_dispatch_table, generate_category): Call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(); build a type directly instead of via groktypename(). (build_selector_reference_decl, build_selector_table_decl, build_class_reference_decl, build_protocol_reference, generate_objc_image_info): Call start_var_decl() instead of build_decl(). (build_selector_reference): For GNU runtime, do not call build_selector_reference_decl(). (build_selector, build_typed_selector_reference): Always convert result to the selector type. (add_objc_string): Cast return value to 'char *'. (build_method_prototype_template, build_selector_template, build_method_template): Use actual selector type for fields pointing to selectors. (finish_objc): For GNU runtime, call build_module_initializer_routine() after build_module_descriptor(). (generate_protocol_list, generate_shared_structures): Call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(); build a type directly instead of via groktypename(). (synth_id_with_class_suffix): Return a string. (get_arg_type_list): For instance methods, use the instance type for 'self'; do not call groktypename_in_parm_context(). (build_objc_string_decl): Squash redeclaration errors in ObjC++. (objc_is_class_name): Use OBJC_TYPE_NAME instead of TYPE_NAME; handle RECORD_TYPEs in ObjC as well as ObjC++. (objc_is_id): New function. (objc_is_object_ptr): Return the canonical type node. (objc_get_class_ivars): Simplify using get_class_ivars(). (get_class_ivars): Remove second parameter; create a fresh copy of the ivar list for each call; do not check for existence of super class. (objc_eh_runtime_type): Mark #ifndef OBJCPLUS. (objc_init_exceptions): When using SJLJ-style exceptions, require the use of '-fobjc-exceptions' flag; do not require it for DWARF-style exceptions. (objc_build_exc_ptr, next_sjlj_build_try_catch_finally): Use objc_object_type instead of objc_id_type. (objc_begin_catch_clause): Convert the incoming PARM_DECL into a VAR_DECL before placing it in the appropriate scope; do not call define_decl(); adjust call to c_begin_compound_stmt(); use objc_object_type instead of objc_id_type. (build_next_objc_exception_stuff): Call create_field_decl() instead of create_builtin_decl(); construct type directly instead of calling groktypename(); use OBJC_VOID_AT_END to mark end of function parameters. (build_private_template): Adjust call to get_class_ivars(); build a type directly instead of via groktypename(). (build_protocol_template, build_method_prototype_list_template, build_method_prototype_template, build_category_template, build_selector_template, build_class_template, build_super_template, build_ivar_template, build_ivar_list_template, build_method_list_template, build_method_template): Call create_field_decl() instead of grokfield(). (objc_method_parm_type): Do not call groktypename(). (generate_descriptor_table): Call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(). (generate_method_descriptors, build_protocol_initializer, generate_dispatch_tables, build_category_initializer, build_shared_structure_initializer): Do not call groktypename(). (generate_protocols): Call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(); do not call groktypename(). (error_with_ivar): Remove last parameter. (check_ivars): Do not iterate ovar CLASS_RAW_IVARS lists in addition to CLASS_IVARS lists; adjust calls to error_with_ivar(). (generate_ivar_lists): Convert one of the initializer elements; do not call groktypename(). (get_arg_type_list, start_method_def, gen_method_def): Account for new representation of variable arguments and '...' in Objective-C methods; add Objective-C++ impedance matching code. (is_objc_type_qualifier): Remove function. (adjust_type_for_id_default): Simplify; there is no longer a need to wade through declspecs. (lookup_interface, start_class, continue_class, finish_class, start_method_def, start_protocol, build_method_decl, objc_add_method, add_instance_variable, build_ivar_reference, is_ivar, is_private, get_super_receiver, objc_build_finally_epilogue): Make into static functions. (receiver_is_class_object): Use new IS_CLASS() macro. (objc_build_message_expr): Tweak ObjC++ message argument handling; call objc_finish_message_expr() instead of finish_message_expr(). (finish_message_expr): Rename to objc_finish_message_expr(); use OBJC_TYPE_NAME and OBJC_SET_TYPE_NAME macros instead of TYPE_NAME. call gen_type_name() instead of gen_declaration(); call objc_is_id() instead of using IS_ID and IS_CLASS; Use objc_class_name instead of calling get_identifier("Class"); handle CONVERT_EXPRs in receiver. (build_objc_method_call, warn_with_method): Do not call groktypename(). (build_ivar_reference): Call convert() instead of clobbering in a type. (hash_init): Initialize string_htab hash table. (add_instance_variable): Simplify parameter list; do not call grokfield(); do not populate CLASS_IVARS list. (start_class): Check for the existence of super class, if one was specified. (continue_class): Use CLASS_RAW_IVARS rather than CLASS_IVARS; do not call build_class_template(); adjust call to get_class_ivars(); call build_decl(), pushdecl() and finish_decl() instead of define_decl(). (finish_class): Call build_decl(), pushdecl() and finish_decl() instead of define_decl(). (add_protocols): Use PROTOCOL_BINFO_ELTS for the tree vector size. (start_protocol): Do not call build_protocol_template(); use PROTOCOL_BINFO_ELTS for the tree vector size. (encode_type_qualifiers): Do not handle the 'const' qualifier here. (encode_pointer): Encode 'const char *' as 'r*', for backwards compatibility. (encode_array): Use HOST_WIDE_INT_PRINT_DEC instead of "%ld". (encode_type): Handle the 'const' qualifier here. (objc_parmlist): New global variable, sued by objc_push_parm and objc_get_parm_info(). (objc_push_parm, objc_get_parm_info): New functions. (objc_expr_last): Remove function. (synth_self_and_ucmd_args): For instance methods, use the instance type for 'self'; call objc_push_parm() instead of push_parm_decl(). (start_method_def): Do not call push_scope(), declare_parm_level(), pop_scope(), push_parm_decl(), store_parm_decls() or objc_expr_last(); just use objc_push_parm() and objc_get_parm_info(). (comp_method_with_proto): Remove function. (objc_types_are_equivalent): Strip away indirections before comparing underlying types. (comp_proto_with_proto): Do not call groktypename(); types are no longer in raw declspec format. (objc_start_function): New function. (really_start_method): Call comp_proto_with_proto() instead of comp_method_with_proto(); call objc_start_function() instead of hand-crafting a function declarator. (continue_method_def, objc_expand_function_end): Remove functions. (get_super_receiver): Call objc_get_current_scope() instead of get_current_scope(); reference 'super_class' field (instead of 'class'). (finish_method_def): Rename to objc_finish_method_definition() and add a function decl parameter; move method encoding call from objc_expand_function_end(). (is_complex_decl, adorn_decl, gen_declarator, gen_declspecs, gen_declaration_1): Remove functions. (tmpbuf, RAW_DECLSPEC): Remove. (gen_declaration): Remove second parameter; simplify to deal with TYPE_P nodes instead of raw declspecs. (gen_type_name, gen_type_name_0): New functions. (gen_method_decl): Remove second parameter; call gen_type_name() instead of gen_declaration_1(). (dump_interface): Adjust calls to gen_declaration() and gen_method_decl(); do not allocate a separate string buffer. (init_objc): Allocate a larger string buffer to accommodate dump_interface(); adjust call to build_module_descriptor(); add call to build_module_initializer_routine() for the GNU runtime. (generate_classref_translation_entry): Do not call start_decl(); call finish_var_decl() instead of finish_decl(); call convert() instead of build_c_cast(). * objc-act.h (CLASS_OWN_IVARS): Remove accessor. (CLASS_BINFO_ELTS): Reduce from 6 to 5, now that CLASS_OWN_IVARS is gone. (OCTI_GNU_INIT_DECL, GNU_INIT_decl): New. (OCTI_ELLIPSIS_NODE, objc_ellipsis_node): Remove. (OCTI_ID_ID, id_type, objc_id_id): Rename to OCTI_ID_NAME, objc_object_type and objc_object_name, respectively. (OCTI_CLS_REF, OCTI_CLASS_NAME, objc_class_reference, objc_class_name): New. (IS_CLASS): New macro. (IS_ID, IS_SUPER): Robustify. (OCTI_EXECCLASS_DECL, execclass_decl): New. (finish_file, start_class, continue_class, finish_class, start_method_def, continue_method_def, finish_method_def, start_protocol, finish_protocol, objc_build_throw_stmt, objc_build_try_catch_finally_stmt, objc_build_synchronized_prologue, objc_build_synchronized_epilogue, objc_build_try_prologue, objc_build_try_epilogue, objc_build_catch_stmt, objc_build_catch_epilogue, objc_build_finally_prologue, objc_build_finally_epilogue, is_ivar, is_private, is_public, add_instance_variable, objc_add_method, get_super_receiver, objc_clear_super_receiver, get_class_ivars_from_name, get_class_reference, get_static_reference, get_object_reference, build_message_expr, finish_message_expr, build_selector_expr, build_ivar_reference, build_keyword_decl, build_method_decl, build_protocol_expr, build_objc_string_object, objc_declare_alias, objc_declare_class, objc_declare_protocols, objc_comptypes, objc_check_decl, build_encode_expr): Remove prototypes. (imp_count, cat_count): Make GGC-aware. (OBJC_SET_TYPE_NAME): New macro. From-SVN: r87168
2004-09-08 02:49:44 +02:00
return type;
}
/* Usage:
keyworddecl:
selector ':' '(' typename ')' identifier
Purpose:
Transform an Objective-C keyword argument into
the C equivalent parameter declarator.
In: key_name, an "identifier_node" (optional).
arg_type, a "tree_list" (optional).
arg_name, an "identifier_node".
Note: It would be really nice to strongly type the preceding
arguments in the function prototype; however, then I
could not use the "accessor" macros defined in "tree.h".
Out: an instance of "keyword_decl". */
1992-01-18 00:15:38 +01:00
tree
c-parse.in (primary): Call objc_build_message_expr()... [gcc/ChangeLog] 2004-09-01 Ziemowit Laski <zlaski@apple.com> * c-parse.in (primary): Call objc_build_message_expr(), objc_build_selector_expr(), objc_build_protocol_expr(), objc_build_encode_expr() and objc_build_string_object() instead of build_message_expr(), build_selector_expr(), build_protocol_expr(), build_encode_expr() and build_objc_string_object(), respectively. (component_decl_list2): Call objc_get_class_ivars() instead of get_class_ivars_from_name(). (keyworddecl): Call objc_build_keyword_decl() instead of build_keyword_decl(). (receiver): Call objc_get_class_reference() instead of get_class_reference(). (reswords): Add blank line before @@ifobjc section, for clarity. [gcc/objc/ChangeLog] 2004-09-01 Ziemowit Laski <zlaski@apple.com> * objc-act.c (objc_check_decl): Use OBJC_TYPE_NAME macro instead of TYPE_NAME. (build_objc_string_object): Rename to objc_build_string_object(). (get_class_reference): Rename to objc_get_class_reference(). (get_class_ivars_from_name): Rename to objc_get_class_ivars(). (next_sjlj_build_catch_list, get_super_receiver): Call objc_get_class_reference() instead of get_class_reference(). (build_keyword_decl): Rename to objc_build_keyword_decl(). (build_message_expr): Rename to objc_build_message_expr(). (build_protocol_expr): Rename to objc_build_protocol_expr(). (build_selector_expr): Rename to objc_build_selector_expr(). (build_encode_expr): Rename to objc_build_encode_expr(). * objc-act.h (get_class_ivars_from_name): Rename prototype to objc_get_class_ivars(). (get_class_reference): Rename prototype to objc_get_class_reference(). (build_message_expr): Rename prototype to objc_build_message_expr(). (build_selector_expr): Rename prototype to objc_build_selector_expr(). (build_keyword_decl): Rename prototype to objc_build_keyword_decl(). (build_protocol_expr): Rename prototype to objc_build_prototype_expr(). (build_objc_string_object): Rename prototype to objc_build_string_object(). From-SVN: r86950
2004-09-02 02:36:18 +02:00
objc_build_keyword_decl (tree key_name, tree arg_type, tree arg_name)
1992-01-18 00:15:38 +01:00
{
tree keyword_decl;
1996-07-04 00:07:53 +02:00
/* If no type is specified, default to "id". */
arg_type = adjust_type_for_id_default (arg_type);
1992-01-18 00:15:38 +01:00
keyword_decl = make_node (KEYWORD_DECL);
TREE_TYPE (keyword_decl) = arg_type;
KEYWORD_ARG_NAME (keyword_decl) = arg_name;
KEYWORD_KEY_NAME (keyword_decl) = key_name;
return keyword_decl;
}
/* Given a chain of keyword_decl's, synthesize the full keyword selector. */
1992-01-18 00:15:38 +01:00
static tree
build_keyword_selector (tree selector)
1992-01-18 00:15:38 +01:00
{
int len = 0;
tree key_chain, key_name;
char *buf;
/* Scan the selector to see how much space we'll need. */
1992-01-18 00:15:38 +01:00
for (key_chain = selector; key_chain; key_chain = TREE_CHAIN (key_chain))
{
if (TREE_CODE (selector) == KEYWORD_DECL)
key_name = KEYWORD_KEY_NAME (key_chain);
else if (TREE_CODE (selector) == TREE_LIST)
key_name = TREE_PURPOSE (key_chain);
else
abort ();
1992-01-18 00:15:38 +01:00
if (key_name)
len += IDENTIFIER_LENGTH (key_name) + 1;
else
1996-07-04 00:07:53 +02:00
/* Just a ':' arg. */
1992-01-18 00:15:38 +01:00
len++;
}
buf = (char *) alloca (len + 1);
/* Start the buffer out as an empty string. */
buf[0] = '\0';
1992-01-18 00:15:38 +01:00
for (key_chain = selector; key_chain; key_chain = TREE_CHAIN (key_chain))
{
if (TREE_CODE (selector) == KEYWORD_DECL)
key_name = KEYWORD_KEY_NAME (key_chain);
else if (TREE_CODE (selector) == TREE_LIST)
{
key_name = TREE_PURPOSE (key_chain);
/* The keyword decl chain will later be used as a function argument
chain. Unhook the selector itself so as to not confuse other
parts of the compiler. */
TREE_PURPOSE (key_chain) = NULL_TREE;
}
else
abort ();
1992-01-18 00:15:38 +01:00
if (key_name)
strcat (buf, IDENTIFIER_POINTER (key_name));
strcat (buf, ":");
}
1992-01-18 00:15:38 +01:00
return get_identifier (buf);
}
1996-07-04 00:07:53 +02:00
/* Used for declarations and definitions. */
1992-01-18 00:15:38 +01:00
Makefile.in (c-parse.o): Depend on $(C_COMMON_H). [gcc/ChangeLog] 2004-09-07 Ziemowit Laski <zlaski@apple.com> * Makefile.in (c-parse.o): Depend on $(C_COMMON_H). * c-parse.in: Include c-common.h instead of objc-act.h. (ivar_decl_list, ivar_decls, ivar_decl, ivars, ivar_declarator, myparms, myparm): Remove %type declarations. (methodtype, optparms, OBJC_TYPE_QUAL, objc_quals, objc_qual, objc_typename, objc_try_catch_stmt, optellipsis): Add %type declarations. (objc_inherit_code, objc_public_flag): Remove. (typespec_nonreserved_nonattr): Call objc_get_protocol_qualified_type() instead of get_static_reference() and get_protocol_reference(). (stmt_nocomp): Call grokparm() on @catch parameter. (objcdef): Move semantic action to objc_finish_implementation(). (classdef): Move semantic action to objc_start_class_interface(), objc_continue_interface(), objc_finish_interface(), objc_start_class_implementation(), objc_continue_implementation(), objc_start_category_interface() and objc_start_category_implementation(). (protocoldef): Move semantic actions to objc_start_protocol() and objc_finish_interface(). (ivar_decl_list): Remove nonterminal. (visibility_spec): Move semantic actions to objc_set_visibility(). (ivar_decls): Remove assignment to $$. (ivar_decl): Rephrase in terms of component_decl; call objc_add_instance_variable(). (ivars, ivar_declarator): Remove nonterminals. (opt_semi): New nonterminal. (methodtype): Remove semantic actions. (methoddef): Move semantic actions to objc_set_method_type(), objc_start_method_definition() and objc_finish_method_definition(). (methodproto): Move semantic actions to objc_set_method_type() and objc_add_method_declaration(). (methoddecl): Use objc_typename instead of typename; move semantic actions to objc_build_method_signature(). (optarglist, myxdecls, mydecl, myparms, myparm): Remove nonterminals. (optparmlist): Express in terms of optparms and optellipsis. (optparms, optellipsis, objc_qual, objc_quals, objc_typename): New nonterminals. (keyworddecl): Use objc_typename instead of typename. (rid_to_yy): Mark RID_IN, RID_OUT, RID_INOUT, RID_BYCOPY, RID_BYREF and RID_ONEWAY as returning OBJC_TYPE_QUAL to yyparse(). [gcc/objc/ChangeLog] 2004-09-07 Ziemowit Laski <zlaski@apple.com> * Make-lang.in (objc/objc-parse.o): Depend on $(C_COMMON_H) instead of objc/objc-act.h. (objc/objc-act.o): Depend on $(HASHTAB_H). * objc-act.c: Include hashtab.h; in ObjC++ mode, include cp-tree.h and objcp-decl.h instead of c-tree.h. (build_module_descriptor, get_class_ivars, synth_id_with_class_suffix, error_with_ivar, gen_method_decl, gen_declaration, setup_string_decl, build_protocol_template): Adjust prototypes. (build_module_initializer_routine, start_class, continue_class, finish_class, start_method_def, objc_start_function, start_protocol, build_method_decl, objc_add_method, add_instance_variable, build_ivar_reference, is_ivar, is_private, get_super_receiver, build_selector_table_decl, objc_push_parm, objc_get_parm_info, gen_type_name, gen_type_name_0, start_var_decl, finish_var_decl, create_field_decl): New prototypes. (objc_expand_function_end, comp_method_with_proto, objc_expr_last, gen_declaration_1, gen_declarator, is_complex_decl, adorn_decl, define_decl, create_builtin_decl, gen_declspecs): Remove prototypes. (TYPE_ID): Rename to OBJECT_TYPEDEF_NAME. (CLASS_TYPEDEF_NAME): New. (TAG_EXECCLASS): Change from a global variable to a #define. (TAG_RETURN_STRUCT): Delete. (TAG_GNUINIT): New, holds '__objc_gnu_init' name. (objc_inherit_code, objc_public_flag): New, moved from c-parse.in. (string_descriptor): New struct. (string_htab): New hash table. (string_hash, string_eq): New prototypes. (generate_struct_by_value_array): Call create_field_decl() instead of create_builtin_decl(). (objc_init): Do not initialize objc_ellipsis_node or TAG_EXECCLASS; In ObjC++ mode, call cxx_init() instead of c_objc_common_init(). (objc_finish_file): In ObjC++, call instantiate_pending_templates() and cp_finish_file(). (define_decl, get_static_reference, get_protocol_reference, create_builtin_decl): Remove functions. (objc_start_class_interface, objc_start_category_interface, objc_start_protocol, objc_continue_interface, objc_finish_interface, objc_start_class_implementation, objc_start_category_implementation, objc_continue_implementation, objc_finish_implementation, objc_set_visibility, objc_set_method_type, objc_build_method_signature, objc_add_method_declaration, objc_start_method_definition, objc_add_instance_variable, objc_get_protocol_qualified_type, create_field_decl, start_var_decl, finish_var_decl): New functions. (setup_string_decl): Simplify since it is only called once. (synth_module_prologue): Call build_class_template(); predefine 'id' and 'Class' as typedefs; rename 'temp_type' to 'type'; disable debug hooks for duration of function; fix GNU runtime messenger signatures to correspond to reality; forward-declare '__objc_exec_class' for the GNU runtime; call build_selector_table_decl(); in ObjC++ mode, generate 'extern "C" { ... }' wrappers around synthesized declarations; call build_protocol_template() and build_category_template(). (string_hash, string_eq): New functions. (objc_build_string_object): Check metaclass correctness only once; store string literals in hash table. (objc_build_constructor): Do not convert initializer elements; adjust for ObjC++ impedance mismatch. (build_objc_symtab_template): Call create_field_decl() instead of create_builtin_decl(). (init_objc_symtab): Add missing conversion to initializer element. (build_metadata_decl): Call start_var_decl() instead of define_decl(). (generate_objc_symtab_decl): Do not call build_category_template(); call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(). (build_module_descriptor): Call create_field_decl() instead of grokfield(); call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(); always mark module descriptor as used; move GNU runtime-specific functionality to build_module_initializer_routine(). (build_module_initializer_routine): New function, broken off of build_module_descriptor(). (objc_static_init_needed_p, objc_generate_static_init_call): New functions. (generate_static_references, generate_strings, build_selector_translation_table, generate_descriptor_table, generate_ivars_list, generate_dispatch_table, generate_category): Call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(); build a type directly instead of via groktypename(). (build_selector_reference_decl, build_selector_table_decl, build_class_reference_decl, build_protocol_reference, generate_objc_image_info): Call start_var_decl() instead of build_decl(). (build_selector_reference): For GNU runtime, do not call build_selector_reference_decl(). (build_selector, build_typed_selector_reference): Always convert result to the selector type. (add_objc_string): Cast return value to 'char *'. (build_method_prototype_template, build_selector_template, build_method_template): Use actual selector type for fields pointing to selectors. (finish_objc): For GNU runtime, call build_module_initializer_routine() after build_module_descriptor(). (generate_protocol_list, generate_shared_structures): Call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(); build a type directly instead of via groktypename(). (synth_id_with_class_suffix): Return a string. (get_arg_type_list): For instance methods, use the instance type for 'self'; do not call groktypename_in_parm_context(). (build_objc_string_decl): Squash redeclaration errors in ObjC++. (objc_is_class_name): Use OBJC_TYPE_NAME instead of TYPE_NAME; handle RECORD_TYPEs in ObjC as well as ObjC++. (objc_is_id): New function. (objc_is_object_ptr): Return the canonical type node. (objc_get_class_ivars): Simplify using get_class_ivars(). (get_class_ivars): Remove second parameter; create a fresh copy of the ivar list for each call; do not check for existence of super class. (objc_eh_runtime_type): Mark #ifndef OBJCPLUS. (objc_init_exceptions): When using SJLJ-style exceptions, require the use of '-fobjc-exceptions' flag; do not require it for DWARF-style exceptions. (objc_build_exc_ptr, next_sjlj_build_try_catch_finally): Use objc_object_type instead of objc_id_type. (objc_begin_catch_clause): Convert the incoming PARM_DECL into a VAR_DECL before placing it in the appropriate scope; do not call define_decl(); adjust call to c_begin_compound_stmt(); use objc_object_type instead of objc_id_type. (build_next_objc_exception_stuff): Call create_field_decl() instead of create_builtin_decl(); construct type directly instead of calling groktypename(); use OBJC_VOID_AT_END to mark end of function parameters. (build_private_template): Adjust call to get_class_ivars(); build a type directly instead of via groktypename(). (build_protocol_template, build_method_prototype_list_template, build_method_prototype_template, build_category_template, build_selector_template, build_class_template, build_super_template, build_ivar_template, build_ivar_list_template, build_method_list_template, build_method_template): Call create_field_decl() instead of grokfield(). (objc_method_parm_type): Do not call groktypename(). (generate_descriptor_table): Call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(). (generate_method_descriptors, build_protocol_initializer, generate_dispatch_tables, build_category_initializer, build_shared_structure_initializer): Do not call groktypename(). (generate_protocols): Call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(); do not call groktypename(). (error_with_ivar): Remove last parameter. (check_ivars): Do not iterate ovar CLASS_RAW_IVARS lists in addition to CLASS_IVARS lists; adjust calls to error_with_ivar(). (generate_ivar_lists): Convert one of the initializer elements; do not call groktypename(). (get_arg_type_list, start_method_def, gen_method_def): Account for new representation of variable arguments and '...' in Objective-C methods; add Objective-C++ impedance matching code. (is_objc_type_qualifier): Remove function. (adjust_type_for_id_default): Simplify; there is no longer a need to wade through declspecs. (lookup_interface, start_class, continue_class, finish_class, start_method_def, start_protocol, build_method_decl, objc_add_method, add_instance_variable, build_ivar_reference, is_ivar, is_private, get_super_receiver, objc_build_finally_epilogue): Make into static functions. (receiver_is_class_object): Use new IS_CLASS() macro. (objc_build_message_expr): Tweak ObjC++ message argument handling; call objc_finish_message_expr() instead of finish_message_expr(). (finish_message_expr): Rename to objc_finish_message_expr(); use OBJC_TYPE_NAME and OBJC_SET_TYPE_NAME macros instead of TYPE_NAME. call gen_type_name() instead of gen_declaration(); call objc_is_id() instead of using IS_ID and IS_CLASS; Use objc_class_name instead of calling get_identifier("Class"); handle CONVERT_EXPRs in receiver. (build_objc_method_call, warn_with_method): Do not call groktypename(). (build_ivar_reference): Call convert() instead of clobbering in a type. (hash_init): Initialize string_htab hash table. (add_instance_variable): Simplify parameter list; do not call grokfield(); do not populate CLASS_IVARS list. (start_class): Check for the existence of super class, if one was specified. (continue_class): Use CLASS_RAW_IVARS rather than CLASS_IVARS; do not call build_class_template(); adjust call to get_class_ivars(); call build_decl(), pushdecl() and finish_decl() instead of define_decl(). (finish_class): Call build_decl(), pushdecl() and finish_decl() instead of define_decl(). (add_protocols): Use PROTOCOL_BINFO_ELTS for the tree vector size. (start_protocol): Do not call build_protocol_template(); use PROTOCOL_BINFO_ELTS for the tree vector size. (encode_type_qualifiers): Do not handle the 'const' qualifier here. (encode_pointer): Encode 'const char *' as 'r*', for backwards compatibility. (encode_array): Use HOST_WIDE_INT_PRINT_DEC instead of "%ld". (encode_type): Handle the 'const' qualifier here. (objc_parmlist): New global variable, sued by objc_push_parm and objc_get_parm_info(). (objc_push_parm, objc_get_parm_info): New functions. (objc_expr_last): Remove function. (synth_self_and_ucmd_args): For instance methods, use the instance type for 'self'; call objc_push_parm() instead of push_parm_decl(). (start_method_def): Do not call push_scope(), declare_parm_level(), pop_scope(), push_parm_decl(), store_parm_decls() or objc_expr_last(); just use objc_push_parm() and objc_get_parm_info(). (comp_method_with_proto): Remove function. (objc_types_are_equivalent): Strip away indirections before comparing underlying types. (comp_proto_with_proto): Do not call groktypename(); types are no longer in raw declspec format. (objc_start_function): New function. (really_start_method): Call comp_proto_with_proto() instead of comp_method_with_proto(); call objc_start_function() instead of hand-crafting a function declarator. (continue_method_def, objc_expand_function_end): Remove functions. (get_super_receiver): Call objc_get_current_scope() instead of get_current_scope(); reference 'super_class' field (instead of 'class'). (finish_method_def): Rename to objc_finish_method_definition() and add a function decl parameter; move method encoding call from objc_expand_function_end(). (is_complex_decl, adorn_decl, gen_declarator, gen_declspecs, gen_declaration_1): Remove functions. (tmpbuf, RAW_DECLSPEC): Remove. (gen_declaration): Remove second parameter; simplify to deal with TYPE_P nodes instead of raw declspecs. (gen_type_name, gen_type_name_0): New functions. (gen_method_decl): Remove second parameter; call gen_type_name() instead of gen_declaration_1(). (dump_interface): Adjust calls to gen_declaration() and gen_method_decl(); do not allocate a separate string buffer. (init_objc): Allocate a larger string buffer to accommodate dump_interface(); adjust call to build_module_descriptor(); add call to build_module_initializer_routine() for the GNU runtime. (generate_classref_translation_entry): Do not call start_decl(); call finish_var_decl() instead of finish_decl(); call convert() instead of build_c_cast(). * objc-act.h (CLASS_OWN_IVARS): Remove accessor. (CLASS_BINFO_ELTS): Reduce from 6 to 5, now that CLASS_OWN_IVARS is gone. (OCTI_GNU_INIT_DECL, GNU_INIT_decl): New. (OCTI_ELLIPSIS_NODE, objc_ellipsis_node): Remove. (OCTI_ID_ID, id_type, objc_id_id): Rename to OCTI_ID_NAME, objc_object_type and objc_object_name, respectively. (OCTI_CLS_REF, OCTI_CLASS_NAME, objc_class_reference, objc_class_name): New. (IS_CLASS): New macro. (IS_ID, IS_SUPER): Robustify. (OCTI_EXECCLASS_DECL, execclass_decl): New. (finish_file, start_class, continue_class, finish_class, start_method_def, continue_method_def, finish_method_def, start_protocol, finish_protocol, objc_build_throw_stmt, objc_build_try_catch_finally_stmt, objc_build_synchronized_prologue, objc_build_synchronized_epilogue, objc_build_try_prologue, objc_build_try_epilogue, objc_build_catch_stmt, objc_build_catch_epilogue, objc_build_finally_prologue, objc_build_finally_epilogue, is_ivar, is_private, is_public, add_instance_variable, objc_add_method, get_super_receiver, objc_clear_super_receiver, get_class_ivars_from_name, get_class_reference, get_static_reference, get_object_reference, build_message_expr, finish_message_expr, build_selector_expr, build_ivar_reference, build_keyword_decl, build_method_decl, build_protocol_expr, build_objc_string_object, objc_declare_alias, objc_declare_class, objc_declare_protocols, objc_comptypes, objc_check_decl, build_encode_expr): Remove prototypes. (imp_count, cat_count): Make GGC-aware. (OBJC_SET_TYPE_NAME): New macro. From-SVN: r87168
2004-09-08 02:49:44 +02:00
static tree
build_method_decl (enum tree_code code, tree ret_type, tree selector,
tree add_args, bool ellipsis)
1992-01-18 00:15:38 +01:00
{
tree method_decl;
1996-07-04 00:07:53 +02:00
/* If no type is specified, default to "id". */
ret_type = adjust_type_for_id_default (ret_type);
1992-01-18 00:15:38 +01:00
method_decl = make_node (code);
TREE_TYPE (method_decl) = ret_type;
/* If we have a keyword selector, create an identifier_node that
represents the full selector name (`:' included)... */
1992-01-18 00:15:38 +01:00
if (TREE_CODE (selector) == KEYWORD_DECL)
{
METHOD_SEL_NAME (method_decl) = build_keyword_selector (selector);
METHOD_SEL_ARGS (method_decl) = selector;
METHOD_ADD_ARGS (method_decl) = add_args;
METHOD_ADD_ARGS_ELLIPSIS_P (method_decl) = ellipsis;
1992-01-18 00:15:38 +01:00
}
else
{
METHOD_SEL_NAME (method_decl) = selector;
METHOD_SEL_ARGS (method_decl) = NULL_TREE;
METHOD_ADD_ARGS (method_decl) = NULL_TREE;
1992-01-18 00:15:38 +01:00
}
return method_decl;
}
#define METHOD_DEF 0
#define METHOD_REF 1
/* Used by `build_objc_method_call' and `comp_proto_with_proto'. Return
c-parse.in (objc_inherit_code, [...]): Make static. 2001-10-03 Ziemowit Laski <zlaski@apple.com> * c-parse.in (objc_inherit_code, objc_pq_context, objc_public_flag): Make static. (objc_interface_context, objc_implementation_context, objc_method_context, objc_ivar_chain, objc_ivar_context): Move to global tree array in objc/objc-act.[ch]. (methoddef): Remove unnecessary code. * objc/objc-act.c: (hashed_attribute, hashed_entry, imp_entry): Hoist struct definitions to objc-act.h. (nst_method_hash_list, cls_method_hash_list, imp_list, imp_count, cat_count): Place declaration in objc-act.h. (objc_tree_index): Move enumeration to objc-act.h. (objc_global_trees): Place declaration and macro accessors in objc-act.h. (implementation_context): Remove duplicate; use objc_implementation_context instead: (method_context): Remove duplicate; use objc_method_context instead. (objc_ellipsis_node, objc_method_prototype_template, implemented_classes, function_type): Move global vars to objc_global_trees. (init_objc): Use LAST_BASE_TREE_CODE instead of LAST_CODE. (build_message_expr): Move actual construction of ObjC message send nodes to finish_message_expr. (finish_message_expr): New routine, contains code formerly in build_message_expr. * objc/objc-act.h (finish_message_expr): New prototype. (objc_ivar_chain, objc_method_context, objc_ellipsis_node): Remove declarations; these vars are now part of objc_global_trees. (objc_tree_index, objc_global_trees): Move definitions from objc-act.c. * objc/objc-tree.def: Update copyright info. From-SVN: r46000
2001-10-04 00:05:57 +02:00
an argument list for method METH. 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; this makes a
difference for the NeXT calling sequence in which the lookup and
the method call are done together. If METH is null, user-defined
arguments (i.e., beyond self and _cmd) shall be represented by `...'. */
1992-01-18 00:15:38 +01:00
static tree
get_arg_type_list (tree meth, int context, int superflag)
1992-01-18 00:15:38 +01:00
{
tree arglist, akey;
1996-07-04 00:07:53 +02:00
/* Receiver type. */
if (flag_next_runtime && superflag)
objc-act.h (get_object_reference): Rename to get_protocol_reference. 2004-06-20 David Ayers <d.ayers@inode.at> * objc/objc-act.h (get_object_reference): Rename to get_protocol_reference. (super_type): Rename to objc_super_type. (selector_type): Rename to objc_selector_type. (id_type): Rename to objc_id_type. (instance_type): Rename to objc_instance_type. (protocol_type): Rename to objc_protocol_type. (IS_ID): Update reference to id_type. * objc/objc-act.c (get_object_reference): Rename to get_protocol_reference; add documentation; update references to id_type. (lookup_method_in_protocol_list): Rename class_meth to is_class; add documentation. (finish_message_expr): Rename is_class to class_tree. (synth_module_prologue, objc_is_object_ptr, objc_build_exc_ptr, next_sjlj_build_try_catch_finally, objc_begin_catch_clause, build_next_objc_exception_stuff, get_arg_type_list, build_objc_method_call): Update references to id_type. (synth_module_prologue, build_objc_symtab_template, build_selector_reference_decl, build_selector, build_selector_translation_table, build_typed_selector_reference, get_arg_type_list, synth_self_and_ucmd_args, get_arg_type_list, synth_self_and_ucmd_args): Update references to selector_type. (build_private_template, build_ivar_reference): Update references to instance_type. (synth_module_prologue, build_protocol_reference, build_protocol_expr, start_protocol): Update references to protocol_type. (synth_module_prologue, get_arg_type_list, build_objc_method_call): Update references to super_type. * c-parse.in: (typespec_nonreserved_nonattr): Update references to get_object_reference. * objc/objc-tree.def: Add C mode identifier sequence. From-SVN: r83425
2004-06-21 03:50:18 +02:00
arglist = build_tree_list (NULL_TREE, objc_super_type);
Makefile.in (c-parse.o): Depend on $(C_COMMON_H). [gcc/ChangeLog] 2004-09-07 Ziemowit Laski <zlaski@apple.com> * Makefile.in (c-parse.o): Depend on $(C_COMMON_H). * c-parse.in: Include c-common.h instead of objc-act.h. (ivar_decl_list, ivar_decls, ivar_decl, ivars, ivar_declarator, myparms, myparm): Remove %type declarations. (methodtype, optparms, OBJC_TYPE_QUAL, objc_quals, objc_qual, objc_typename, objc_try_catch_stmt, optellipsis): Add %type declarations. (objc_inherit_code, objc_public_flag): Remove. (typespec_nonreserved_nonattr): Call objc_get_protocol_qualified_type() instead of get_static_reference() and get_protocol_reference(). (stmt_nocomp): Call grokparm() on @catch parameter. (objcdef): Move semantic action to objc_finish_implementation(). (classdef): Move semantic action to objc_start_class_interface(), objc_continue_interface(), objc_finish_interface(), objc_start_class_implementation(), objc_continue_implementation(), objc_start_category_interface() and objc_start_category_implementation(). (protocoldef): Move semantic actions to objc_start_protocol() and objc_finish_interface(). (ivar_decl_list): Remove nonterminal. (visibility_spec): Move semantic actions to objc_set_visibility(). (ivar_decls): Remove assignment to $$. (ivar_decl): Rephrase in terms of component_decl; call objc_add_instance_variable(). (ivars, ivar_declarator): Remove nonterminals. (opt_semi): New nonterminal. (methodtype): Remove semantic actions. (methoddef): Move semantic actions to objc_set_method_type(), objc_start_method_definition() and objc_finish_method_definition(). (methodproto): Move semantic actions to objc_set_method_type() and objc_add_method_declaration(). (methoddecl): Use objc_typename instead of typename; move semantic actions to objc_build_method_signature(). (optarglist, myxdecls, mydecl, myparms, myparm): Remove nonterminals. (optparmlist): Express in terms of optparms and optellipsis. (optparms, optellipsis, objc_qual, objc_quals, objc_typename): New nonterminals. (keyworddecl): Use objc_typename instead of typename. (rid_to_yy): Mark RID_IN, RID_OUT, RID_INOUT, RID_BYCOPY, RID_BYREF and RID_ONEWAY as returning OBJC_TYPE_QUAL to yyparse(). [gcc/objc/ChangeLog] 2004-09-07 Ziemowit Laski <zlaski@apple.com> * Make-lang.in (objc/objc-parse.o): Depend on $(C_COMMON_H) instead of objc/objc-act.h. (objc/objc-act.o): Depend on $(HASHTAB_H). * objc-act.c: Include hashtab.h; in ObjC++ mode, include cp-tree.h and objcp-decl.h instead of c-tree.h. (build_module_descriptor, get_class_ivars, synth_id_with_class_suffix, error_with_ivar, gen_method_decl, gen_declaration, setup_string_decl, build_protocol_template): Adjust prototypes. (build_module_initializer_routine, start_class, continue_class, finish_class, start_method_def, objc_start_function, start_protocol, build_method_decl, objc_add_method, add_instance_variable, build_ivar_reference, is_ivar, is_private, get_super_receiver, build_selector_table_decl, objc_push_parm, objc_get_parm_info, gen_type_name, gen_type_name_0, start_var_decl, finish_var_decl, create_field_decl): New prototypes. (objc_expand_function_end, comp_method_with_proto, objc_expr_last, gen_declaration_1, gen_declarator, is_complex_decl, adorn_decl, define_decl, create_builtin_decl, gen_declspecs): Remove prototypes. (TYPE_ID): Rename to OBJECT_TYPEDEF_NAME. (CLASS_TYPEDEF_NAME): New. (TAG_EXECCLASS): Change from a global variable to a #define. (TAG_RETURN_STRUCT): Delete. (TAG_GNUINIT): New, holds '__objc_gnu_init' name. (objc_inherit_code, objc_public_flag): New, moved from c-parse.in. (string_descriptor): New struct. (string_htab): New hash table. (string_hash, string_eq): New prototypes. (generate_struct_by_value_array): Call create_field_decl() instead of create_builtin_decl(). (objc_init): Do not initialize objc_ellipsis_node or TAG_EXECCLASS; In ObjC++ mode, call cxx_init() instead of c_objc_common_init(). (objc_finish_file): In ObjC++, call instantiate_pending_templates() and cp_finish_file(). (define_decl, get_static_reference, get_protocol_reference, create_builtin_decl): Remove functions. (objc_start_class_interface, objc_start_category_interface, objc_start_protocol, objc_continue_interface, objc_finish_interface, objc_start_class_implementation, objc_start_category_implementation, objc_continue_implementation, objc_finish_implementation, objc_set_visibility, objc_set_method_type, objc_build_method_signature, objc_add_method_declaration, objc_start_method_definition, objc_add_instance_variable, objc_get_protocol_qualified_type, create_field_decl, start_var_decl, finish_var_decl): New functions. (setup_string_decl): Simplify since it is only called once. (synth_module_prologue): Call build_class_template(); predefine 'id' and 'Class' as typedefs; rename 'temp_type' to 'type'; disable debug hooks for duration of function; fix GNU runtime messenger signatures to correspond to reality; forward-declare '__objc_exec_class' for the GNU runtime; call build_selector_table_decl(); in ObjC++ mode, generate 'extern "C" { ... }' wrappers around synthesized declarations; call build_protocol_template() and build_category_template(). (string_hash, string_eq): New functions. (objc_build_string_object): Check metaclass correctness only once; store string literals in hash table. (objc_build_constructor): Do not convert initializer elements; adjust for ObjC++ impedance mismatch. (build_objc_symtab_template): Call create_field_decl() instead of create_builtin_decl(). (init_objc_symtab): Add missing conversion to initializer element. (build_metadata_decl): Call start_var_decl() instead of define_decl(). (generate_objc_symtab_decl): Do not call build_category_template(); call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(). (build_module_descriptor): Call create_field_decl() instead of grokfield(); call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(); always mark module descriptor as used; move GNU runtime-specific functionality to build_module_initializer_routine(). (build_module_initializer_routine): New function, broken off of build_module_descriptor(). (objc_static_init_needed_p, objc_generate_static_init_call): New functions. (generate_static_references, generate_strings, build_selector_translation_table, generate_descriptor_table, generate_ivars_list, generate_dispatch_table, generate_category): Call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(); build a type directly instead of via groktypename(). (build_selector_reference_decl, build_selector_table_decl, build_class_reference_decl, build_protocol_reference, generate_objc_image_info): Call start_var_decl() instead of build_decl(). (build_selector_reference): For GNU runtime, do not call build_selector_reference_decl(). (build_selector, build_typed_selector_reference): Always convert result to the selector type. (add_objc_string): Cast return value to 'char *'. (build_method_prototype_template, build_selector_template, build_method_template): Use actual selector type for fields pointing to selectors. (finish_objc): For GNU runtime, call build_module_initializer_routine() after build_module_descriptor(). (generate_protocol_list, generate_shared_structures): Call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(); build a type directly instead of via groktypename(). (synth_id_with_class_suffix): Return a string. (get_arg_type_list): For instance methods, use the instance type for 'self'; do not call groktypename_in_parm_context(). (build_objc_string_decl): Squash redeclaration errors in ObjC++. (objc_is_class_name): Use OBJC_TYPE_NAME instead of TYPE_NAME; handle RECORD_TYPEs in ObjC as well as ObjC++. (objc_is_id): New function. (objc_is_object_ptr): Return the canonical type node. (objc_get_class_ivars): Simplify using get_class_ivars(). (get_class_ivars): Remove second parameter; create a fresh copy of the ivar list for each call; do not check for existence of super class. (objc_eh_runtime_type): Mark #ifndef OBJCPLUS. (objc_init_exceptions): When using SJLJ-style exceptions, require the use of '-fobjc-exceptions' flag; do not require it for DWARF-style exceptions. (objc_build_exc_ptr, next_sjlj_build_try_catch_finally): Use objc_object_type instead of objc_id_type. (objc_begin_catch_clause): Convert the incoming PARM_DECL into a VAR_DECL before placing it in the appropriate scope; do not call define_decl(); adjust call to c_begin_compound_stmt(); use objc_object_type instead of objc_id_type. (build_next_objc_exception_stuff): Call create_field_decl() instead of create_builtin_decl(); construct type directly instead of calling groktypename(); use OBJC_VOID_AT_END to mark end of function parameters. (build_private_template): Adjust call to get_class_ivars(); build a type directly instead of via groktypename(). (build_protocol_template, build_method_prototype_list_template, build_method_prototype_template, build_category_template, build_selector_template, build_class_template, build_super_template, build_ivar_template, build_ivar_list_template, build_method_list_template, build_method_template): Call create_field_decl() instead of grokfield(). (objc_method_parm_type): Do not call groktypename(). (generate_descriptor_table): Call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(). (generate_method_descriptors, build_protocol_initializer, generate_dispatch_tables, build_category_initializer, build_shared_structure_initializer): Do not call groktypename(). (generate_protocols): Call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(); do not call groktypename(). (error_with_ivar): Remove last parameter. (check_ivars): Do not iterate ovar CLASS_RAW_IVARS lists in addition to CLASS_IVARS lists; adjust calls to error_with_ivar(). (generate_ivar_lists): Convert one of the initializer elements; do not call groktypename(). (get_arg_type_list, start_method_def, gen_method_def): Account for new representation of variable arguments and '...' in Objective-C methods; add Objective-C++ impedance matching code. (is_objc_type_qualifier): Remove function. (adjust_type_for_id_default): Simplify; there is no longer a need to wade through declspecs. (lookup_interface, start_class, continue_class, finish_class, start_method_def, start_protocol, build_method_decl, objc_add_method, add_instance_variable, build_ivar_reference, is_ivar, is_private, get_super_receiver, objc_build_finally_epilogue): Make into static functions. (receiver_is_class_object): Use new IS_CLASS() macro. (objc_build_message_expr): Tweak ObjC++ message argument handling; call objc_finish_message_expr() instead of finish_message_expr(). (finish_message_expr): Rename to objc_finish_message_expr(); use OBJC_TYPE_NAME and OBJC_SET_TYPE_NAME macros instead of TYPE_NAME. call gen_type_name() instead of gen_declaration(); call objc_is_id() instead of using IS_ID and IS_CLASS; Use objc_class_name instead of calling get_identifier("Class"); handle CONVERT_EXPRs in receiver. (build_objc_method_call, warn_with_method): Do not call groktypename(). (build_ivar_reference): Call convert() instead of clobbering in a type. (hash_init): Initialize string_htab hash table. (add_instance_variable): Simplify parameter list; do not call grokfield(); do not populate CLASS_IVARS list. (start_class): Check for the existence of super class, if one was specified. (continue_class): Use CLASS_RAW_IVARS rather than CLASS_IVARS; do not call build_class_template(); adjust call to get_class_ivars(); call build_decl(), pushdecl() and finish_decl() instead of define_decl(). (finish_class): Call build_decl(), pushdecl() and finish_decl() instead of define_decl(). (add_protocols): Use PROTOCOL_BINFO_ELTS for the tree vector size. (start_protocol): Do not call build_protocol_template(); use PROTOCOL_BINFO_ELTS for the tree vector size. (encode_type_qualifiers): Do not handle the 'const' qualifier here. (encode_pointer): Encode 'const char *' as 'r*', for backwards compatibility. (encode_array): Use HOST_WIDE_INT_PRINT_DEC instead of "%ld". (encode_type): Handle the 'const' qualifier here. (objc_parmlist): New global variable, sued by objc_push_parm and objc_get_parm_info(). (objc_push_parm, objc_get_parm_info): New functions. (objc_expr_last): Remove function. (synth_self_and_ucmd_args): For instance methods, use the instance type for 'self'; call objc_push_parm() instead of push_parm_decl(). (start_method_def): Do not call push_scope(), declare_parm_level(), pop_scope(), push_parm_decl(), store_parm_decls() or objc_expr_last(); just use objc_push_parm() and objc_get_parm_info(). (comp_method_with_proto): Remove function. (objc_types_are_equivalent): Strip away indirections before comparing underlying types. (comp_proto_with_proto): Do not call groktypename(); types are no longer in raw declspec format. (objc_start_function): New function. (really_start_method): Call comp_proto_with_proto() instead of comp_method_with_proto(); call objc_start_function() instead of hand-crafting a function declarator. (continue_method_def, objc_expand_function_end): Remove functions. (get_super_receiver): Call objc_get_current_scope() instead of get_current_scope(); reference 'super_class' field (instead of 'class'). (finish_method_def): Rename to objc_finish_method_definition() and add a function decl parameter; move method encoding call from objc_expand_function_end(). (is_complex_decl, adorn_decl, gen_declarator, gen_declspecs, gen_declaration_1): Remove functions. (tmpbuf, RAW_DECLSPEC): Remove. (gen_declaration): Remove second parameter; simplify to deal with TYPE_P nodes instead of raw declspecs. (gen_type_name, gen_type_name_0): New functions. (gen_method_decl): Remove second parameter; call gen_type_name() instead of gen_declaration_1(). (dump_interface): Adjust calls to gen_declaration() and gen_method_decl(); do not allocate a separate string buffer. (init_objc): Allocate a larger string buffer to accommodate dump_interface(); adjust call to build_module_descriptor(); add call to build_module_initializer_routine() for the GNU runtime. (generate_classref_translation_entry): Do not call start_decl(); call finish_var_decl() instead of finish_decl(); call convert() instead of build_c_cast(). * objc-act.h (CLASS_OWN_IVARS): Remove accessor. (CLASS_BINFO_ELTS): Reduce from 6 to 5, now that CLASS_OWN_IVARS is gone. (OCTI_GNU_INIT_DECL, GNU_INIT_decl): New. (OCTI_ELLIPSIS_NODE, objc_ellipsis_node): Remove. (OCTI_ID_ID, id_type, objc_id_id): Rename to OCTI_ID_NAME, objc_object_type and objc_object_name, respectively. (OCTI_CLS_REF, OCTI_CLASS_NAME, objc_class_reference, objc_class_name): New. (IS_CLASS): New macro. (IS_ID, IS_SUPER): Robustify. (OCTI_EXECCLASS_DECL, execclass_decl): New. (finish_file, start_class, continue_class, finish_class, start_method_def, continue_method_def, finish_method_def, start_protocol, finish_protocol, objc_build_throw_stmt, objc_build_try_catch_finally_stmt, objc_build_synchronized_prologue, objc_build_synchronized_epilogue, objc_build_try_prologue, objc_build_try_epilogue, objc_build_catch_stmt, objc_build_catch_epilogue, objc_build_finally_prologue, objc_build_finally_epilogue, is_ivar, is_private, is_public, add_instance_variable, objc_add_method, get_super_receiver, objc_clear_super_receiver, get_class_ivars_from_name, get_class_reference, get_static_reference, get_object_reference, build_message_expr, finish_message_expr, build_selector_expr, build_ivar_reference, build_keyword_decl, build_method_decl, build_protocol_expr, build_objc_string_object, objc_declare_alias, objc_declare_class, objc_declare_protocols, objc_comptypes, objc_check_decl, build_encode_expr): Remove prototypes. (imp_count, cat_count): Make GGC-aware. (OBJC_SET_TYPE_NAME): New macro. From-SVN: r87168
2004-09-08 02:49:44 +02:00
else if (context == METHOD_DEF && TREE_CODE (meth) == INSTANCE_METHOD_DECL)
arglist = build_tree_list (NULL_TREE, objc_instance_type);
1992-01-18 00:15:38 +01:00
else
Makefile.in (c-parse.o): Depend on $(C_COMMON_H). [gcc/ChangeLog] 2004-09-07 Ziemowit Laski <zlaski@apple.com> * Makefile.in (c-parse.o): Depend on $(C_COMMON_H). * c-parse.in: Include c-common.h instead of objc-act.h. (ivar_decl_list, ivar_decls, ivar_decl, ivars, ivar_declarator, myparms, myparm): Remove %type declarations. (methodtype, optparms, OBJC_TYPE_QUAL, objc_quals, objc_qual, objc_typename, objc_try_catch_stmt, optellipsis): Add %type declarations. (objc_inherit_code, objc_public_flag): Remove. (typespec_nonreserved_nonattr): Call objc_get_protocol_qualified_type() instead of get_static_reference() and get_protocol_reference(). (stmt_nocomp): Call grokparm() on @catch parameter. (objcdef): Move semantic action to objc_finish_implementation(). (classdef): Move semantic action to objc_start_class_interface(), objc_continue_interface(), objc_finish_interface(), objc_start_class_implementation(), objc_continue_implementation(), objc_start_category_interface() and objc_start_category_implementation(). (protocoldef): Move semantic actions to objc_start_protocol() and objc_finish_interface(). (ivar_decl_list): Remove nonterminal. (visibility_spec): Move semantic actions to objc_set_visibility(). (ivar_decls): Remove assignment to $$. (ivar_decl): Rephrase in terms of component_decl; call objc_add_instance_variable(). (ivars, ivar_declarator): Remove nonterminals. (opt_semi): New nonterminal. (methodtype): Remove semantic actions. (methoddef): Move semantic actions to objc_set_method_type(), objc_start_method_definition() and objc_finish_method_definition(). (methodproto): Move semantic actions to objc_set_method_type() and objc_add_method_declaration(). (methoddecl): Use objc_typename instead of typename; move semantic actions to objc_build_method_signature(). (optarglist, myxdecls, mydecl, myparms, myparm): Remove nonterminals. (optparmlist): Express in terms of optparms and optellipsis. (optparms, optellipsis, objc_qual, objc_quals, objc_typename): New nonterminals. (keyworddecl): Use objc_typename instead of typename. (rid_to_yy): Mark RID_IN, RID_OUT, RID_INOUT, RID_BYCOPY, RID_BYREF and RID_ONEWAY as returning OBJC_TYPE_QUAL to yyparse(). [gcc/objc/ChangeLog] 2004-09-07 Ziemowit Laski <zlaski@apple.com> * Make-lang.in (objc/objc-parse.o): Depend on $(C_COMMON_H) instead of objc/objc-act.h. (objc/objc-act.o): Depend on $(HASHTAB_H). * objc-act.c: Include hashtab.h; in ObjC++ mode, include cp-tree.h and objcp-decl.h instead of c-tree.h. (build_module_descriptor, get_class_ivars, synth_id_with_class_suffix, error_with_ivar, gen_method_decl, gen_declaration, setup_string_decl, build_protocol_template): Adjust prototypes. (build_module_initializer_routine, start_class, continue_class, finish_class, start_method_def, objc_start_function, start_protocol, build_method_decl, objc_add_method, add_instance_variable, build_ivar_reference, is_ivar, is_private, get_super_receiver, build_selector_table_decl, objc_push_parm, objc_get_parm_info, gen_type_name, gen_type_name_0, start_var_decl, finish_var_decl, create_field_decl): New prototypes. (objc_expand_function_end, comp_method_with_proto, objc_expr_last, gen_declaration_1, gen_declarator, is_complex_decl, adorn_decl, define_decl, create_builtin_decl, gen_declspecs): Remove prototypes. (TYPE_ID): Rename to OBJECT_TYPEDEF_NAME. (CLASS_TYPEDEF_NAME): New. (TAG_EXECCLASS): Change from a global variable to a #define. (TAG_RETURN_STRUCT): Delete. (TAG_GNUINIT): New, holds '__objc_gnu_init' name. (objc_inherit_code, objc_public_flag): New, moved from c-parse.in. (string_descriptor): New struct. (string_htab): New hash table. (string_hash, string_eq): New prototypes. (generate_struct_by_value_array): Call create_field_decl() instead of create_builtin_decl(). (objc_init): Do not initialize objc_ellipsis_node or TAG_EXECCLASS; In ObjC++ mode, call cxx_init() instead of c_objc_common_init(). (objc_finish_file): In ObjC++, call instantiate_pending_templates() and cp_finish_file(). (define_decl, get_static_reference, get_protocol_reference, create_builtin_decl): Remove functions. (objc_start_class_interface, objc_start_category_interface, objc_start_protocol, objc_continue_interface, objc_finish_interface, objc_start_class_implementation, objc_start_category_implementation, objc_continue_implementation, objc_finish_implementation, objc_set_visibility, objc_set_method_type, objc_build_method_signature, objc_add_method_declaration, objc_start_method_definition, objc_add_instance_variable, objc_get_protocol_qualified_type, create_field_decl, start_var_decl, finish_var_decl): New functions. (setup_string_decl): Simplify since it is only called once. (synth_module_prologue): Call build_class_template(); predefine 'id' and 'Class' as typedefs; rename 'temp_type' to 'type'; disable debug hooks for duration of function; fix GNU runtime messenger signatures to correspond to reality; forward-declare '__objc_exec_class' for the GNU runtime; call build_selector_table_decl(); in ObjC++ mode, generate 'extern "C" { ... }' wrappers around synthesized declarations; call build_protocol_template() and build_category_template(). (string_hash, string_eq): New functions. (objc_build_string_object): Check metaclass correctness only once; store string literals in hash table. (objc_build_constructor): Do not convert initializer elements; adjust for ObjC++ impedance mismatch. (build_objc_symtab_template): Call create_field_decl() instead of create_builtin_decl(). (init_objc_symtab): Add missing conversion to initializer element. (build_metadata_decl): Call start_var_decl() instead of define_decl(). (generate_objc_symtab_decl): Do not call build_category_template(); call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(). (build_module_descriptor): Call create_field_decl() instead of grokfield(); call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(); always mark module descriptor as used; move GNU runtime-specific functionality to build_module_initializer_routine(). (build_module_initializer_routine): New function, broken off of build_module_descriptor(). (objc_static_init_needed_p, objc_generate_static_init_call): New functions. (generate_static_references, generate_strings, build_selector_translation_table, generate_descriptor_table, generate_ivars_list, generate_dispatch_table, generate_category): Call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(); build a type directly instead of via groktypename(). (build_selector_reference_decl, build_selector_table_decl, build_class_reference_decl, build_protocol_reference, generate_objc_image_info): Call start_var_decl() instead of build_decl(). (build_selector_reference): For GNU runtime, do not call build_selector_reference_decl(). (build_selector, build_typed_selector_reference): Always convert result to the selector type. (add_objc_string): Cast return value to 'char *'. (build_method_prototype_template, build_selector_template, build_method_template): Use actual selector type for fields pointing to selectors. (finish_objc): For GNU runtime, call build_module_initializer_routine() after build_module_descriptor(). (generate_protocol_list, generate_shared_structures): Call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(); build a type directly instead of via groktypename(). (synth_id_with_class_suffix): Return a string. (get_arg_type_list): For instance methods, use the instance type for 'self'; do not call groktypename_in_parm_context(). (build_objc_string_decl): Squash redeclaration errors in ObjC++. (objc_is_class_name): Use OBJC_TYPE_NAME instead of TYPE_NAME; handle RECORD_TYPEs in ObjC as well as ObjC++. (objc_is_id): New function. (objc_is_object_ptr): Return the canonical type node. (objc_get_class_ivars): Simplify using get_class_ivars(). (get_class_ivars): Remove second parameter; create a fresh copy of the ivar list for each call; do not check for existence of super class. (objc_eh_runtime_type): Mark #ifndef OBJCPLUS. (objc_init_exceptions): When using SJLJ-style exceptions, require the use of '-fobjc-exceptions' flag; do not require it for DWARF-style exceptions. (objc_build_exc_ptr, next_sjlj_build_try_catch_finally): Use objc_object_type instead of objc_id_type. (objc_begin_catch_clause): Convert the incoming PARM_DECL into a VAR_DECL before placing it in the appropriate scope; do not call define_decl(); adjust call to c_begin_compound_stmt(); use objc_object_type instead of objc_id_type. (build_next_objc_exception_stuff): Call create_field_decl() instead of create_builtin_decl(); construct type directly instead of calling groktypename(); use OBJC_VOID_AT_END to mark end of function parameters. (build_private_template): Adjust call to get_class_ivars(); build a type directly instead of via groktypename(). (build_protocol_template, build_method_prototype_list_template, build_method_prototype_template, build_category_template, build_selector_template, build_class_template, build_super_template, build_ivar_template, build_ivar_list_template, build_method_list_template, build_method_template): Call create_field_decl() instead of grokfield(). (objc_method_parm_type): Do not call groktypename(). (generate_descriptor_table): Call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(). (generate_method_descriptors, build_protocol_initializer, generate_dispatch_tables, build_category_initializer, build_shared_structure_initializer): Do not call groktypename(). (generate_protocols): Call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(); do not call groktypename(). (error_with_ivar): Remove last parameter. (check_ivars): Do not iterate ovar CLASS_RAW_IVARS lists in addition to CLASS_IVARS lists; adjust calls to error_with_ivar(). (generate_ivar_lists): Convert one of the initializer elements; do not call groktypename(). (get_arg_type_list, start_method_def, gen_method_def): Account for new representation of variable arguments and '...' in Objective-C methods; add Objective-C++ impedance matching code. (is_objc_type_qualifier): Remove function. (adjust_type_for_id_default): Simplify; there is no longer a need to wade through declspecs. (lookup_interface, start_class, continue_class, finish_class, start_method_def, start_protocol, build_method_decl, objc_add_method, add_instance_variable, build_ivar_reference, is_ivar, is_private, get_super_receiver, objc_build_finally_epilogue): Make into static functions. (receiver_is_class_object): Use new IS_CLASS() macro. (objc_build_message_expr): Tweak ObjC++ message argument handling; call objc_finish_message_expr() instead of finish_message_expr(). (finish_message_expr): Rename to objc_finish_message_expr(); use OBJC_TYPE_NAME and OBJC_SET_TYPE_NAME macros instead of TYPE_NAME. call gen_type_name() instead of gen_declaration(); call objc_is_id() instead of using IS_ID and IS_CLASS; Use objc_class_name instead of calling get_identifier("Class"); handle CONVERT_EXPRs in receiver. (build_objc_method_call, warn_with_method): Do not call groktypename(). (build_ivar_reference): Call convert() instead of clobbering in a type. (hash_init): Initialize string_htab hash table. (add_instance_variable): Simplify parameter list; do not call grokfield(); do not populate CLASS_IVARS list. (start_class): Check for the existence of super class, if one was specified. (continue_class): Use CLASS_RAW_IVARS rather than CLASS_IVARS; do not call build_class_template(); adjust call to get_class_ivars(); call build_decl(), pushdecl() and finish_decl() instead of define_decl(). (finish_class): Call build_decl(), pushdecl() and finish_decl() instead of define_decl(). (add_protocols): Use PROTOCOL_BINFO_ELTS for the tree vector size. (start_protocol): Do not call build_protocol_template(); use PROTOCOL_BINFO_ELTS for the tree vector size. (encode_type_qualifiers): Do not handle the 'const' qualifier here. (encode_pointer): Encode 'const char *' as 'r*', for backwards compatibility. (encode_array): Use HOST_WIDE_INT_PRINT_DEC instead of "%ld". (encode_type): Handle the 'const' qualifier here. (objc_parmlist): New global variable, sued by objc_push_parm and objc_get_parm_info(). (objc_push_parm, objc_get_parm_info): New functions. (objc_expr_last): Remove function. (synth_self_and_ucmd_args): For instance methods, use the instance type for 'self'; call objc_push_parm() instead of push_parm_decl(). (start_method_def): Do not call push_scope(), declare_parm_level(), pop_scope(), push_parm_decl(), store_parm_decls() or objc_expr_last(); just use objc_push_parm() and objc_get_parm_info(). (comp_method_with_proto): Remove function. (objc_types_are_equivalent): Strip away indirections before comparing underlying types. (comp_proto_with_proto): Do not call groktypename(); types are no longer in raw declspec format. (objc_start_function): New function. (really_start_method): Call comp_proto_with_proto() instead of comp_method_with_proto(); call objc_start_function() instead of hand-crafting a function declarator. (continue_method_def, objc_expand_function_end): Remove functions. (get_super_receiver): Call objc_get_current_scope() instead of get_current_scope(); reference 'super_class' field (instead of 'class'). (finish_method_def): Rename to objc_finish_method_definition() and add a function decl parameter; move method encoding call from objc_expand_function_end(). (is_complex_decl, adorn_decl, gen_declarator, gen_declspecs, gen_declaration_1): Remove functions. (tmpbuf, RAW_DECLSPEC): Remove. (gen_declaration): Remove second parameter; simplify to deal with TYPE_P nodes instead of raw declspecs. (gen_type_name, gen_type_name_0): New functions. (gen_method_decl): Remove second parameter; call gen_type_name() instead of gen_declaration_1(). (dump_interface): Adjust calls to gen_declaration() and gen_method_decl(); do not allocate a separate string buffer. (init_objc): Allocate a larger string buffer to accommodate dump_interface(); adjust call to build_module_descriptor(); add call to build_module_initializer_routine() for the GNU runtime. (generate_classref_translation_entry): Do not call start_decl(); call finish_var_decl() instead of finish_decl(); call convert() instead of build_c_cast(). * objc-act.h (CLASS_OWN_IVARS): Remove accessor. (CLASS_BINFO_ELTS): Reduce from 6 to 5, now that CLASS_OWN_IVARS is gone. (OCTI_GNU_INIT_DECL, GNU_INIT_decl): New. (OCTI_ELLIPSIS_NODE, objc_ellipsis_node): Remove. (OCTI_ID_ID, id_type, objc_id_id): Rename to OCTI_ID_NAME, objc_object_type and objc_object_name, respectively. (OCTI_CLS_REF, OCTI_CLASS_NAME, objc_class_reference, objc_class_name): New. (IS_CLASS): New macro. (IS_ID, IS_SUPER): Robustify. (OCTI_EXECCLASS_DECL, execclass_decl): New. (finish_file, start_class, continue_class, finish_class, start_method_def, continue_method_def, finish_method_def, start_protocol, finish_protocol, objc_build_throw_stmt, objc_build_try_catch_finally_stmt, objc_build_synchronized_prologue, objc_build_synchronized_epilogue, objc_build_try_prologue, objc_build_try_epilogue, objc_build_catch_stmt, objc_build_catch_epilogue, objc_build_finally_prologue, objc_build_finally_epilogue, is_ivar, is_private, is_public, add_instance_variable, objc_add_method, get_super_receiver, objc_clear_super_receiver, get_class_ivars_from_name, get_class_reference, get_static_reference, get_object_reference, build_message_expr, finish_message_expr, build_selector_expr, build_ivar_reference, build_keyword_decl, build_method_decl, build_protocol_expr, build_objc_string_object, objc_declare_alias, objc_declare_class, objc_declare_protocols, objc_comptypes, objc_check_decl, build_encode_expr): Remove prototypes. (imp_count, cat_count): Make GGC-aware. (OBJC_SET_TYPE_NAME): New macro. From-SVN: r87168
2004-09-08 02:49:44 +02:00
arglist = build_tree_list (NULL_TREE, objc_object_type);
1992-01-18 00:15:38 +01:00
1996-07-04 00:07:53 +02:00
/* Selector type - will eventually change to `int'. */
objc-act.h (get_object_reference): Rename to get_protocol_reference. 2004-06-20 David Ayers <d.ayers@inode.at> * objc/objc-act.h (get_object_reference): Rename to get_protocol_reference. (super_type): Rename to objc_super_type. (selector_type): Rename to objc_selector_type. (id_type): Rename to objc_id_type. (instance_type): Rename to objc_instance_type. (protocol_type): Rename to objc_protocol_type. (IS_ID): Update reference to id_type. * objc/objc-act.c (get_object_reference): Rename to get_protocol_reference; add documentation; update references to id_type. (lookup_method_in_protocol_list): Rename class_meth to is_class; add documentation. (finish_message_expr): Rename is_class to class_tree. (synth_module_prologue, objc_is_object_ptr, objc_build_exc_ptr, next_sjlj_build_try_catch_finally, objc_begin_catch_clause, build_next_objc_exception_stuff, get_arg_type_list, build_objc_method_call): Update references to id_type. (synth_module_prologue, build_objc_symtab_template, build_selector_reference_decl, build_selector, build_selector_translation_table, build_typed_selector_reference, get_arg_type_list, synth_self_and_ucmd_args, get_arg_type_list, synth_self_and_ucmd_args): Update references to selector_type. (build_private_template, build_ivar_reference): Update references to instance_type. (synth_module_prologue, build_protocol_reference, build_protocol_expr, start_protocol): Update references to protocol_type. (synth_module_prologue, get_arg_type_list, build_objc_method_call): Update references to super_type. * c-parse.in: (typespec_nonreserved_nonattr): Update references to get_object_reference. * objc/objc-tree.def: Add C mode identifier sequence. From-SVN: r83425
2004-06-21 03:50:18 +02:00
chainon (arglist, build_tree_list (NULL_TREE, objc_selector_type));
1992-01-18 00:15:38 +01:00
/* No actual method prototype given -- assume that remaining arguments
are `...'. */
if (!meth)
return arglist;
1996-07-04 00:07:53 +02:00
/* Build a list of argument types. */
1992-01-18 00:15:38 +01:00
for (akey = METHOD_SEL_ARGS (meth); akey; akey = TREE_CHAIN (akey))
{
Makefile.in (c-parse.o): Depend on $(C_COMMON_H). [gcc/ChangeLog] 2004-09-07 Ziemowit Laski <zlaski@apple.com> * Makefile.in (c-parse.o): Depend on $(C_COMMON_H). * c-parse.in: Include c-common.h instead of objc-act.h. (ivar_decl_list, ivar_decls, ivar_decl, ivars, ivar_declarator, myparms, myparm): Remove %type declarations. (methodtype, optparms, OBJC_TYPE_QUAL, objc_quals, objc_qual, objc_typename, objc_try_catch_stmt, optellipsis): Add %type declarations. (objc_inherit_code, objc_public_flag): Remove. (typespec_nonreserved_nonattr): Call objc_get_protocol_qualified_type() instead of get_static_reference() and get_protocol_reference(). (stmt_nocomp): Call grokparm() on @catch parameter. (objcdef): Move semantic action to objc_finish_implementation(). (classdef): Move semantic action to objc_start_class_interface(), objc_continue_interface(), objc_finish_interface(), objc_start_class_implementation(), objc_continue_implementation(), objc_start_category_interface() and objc_start_category_implementation(). (protocoldef): Move semantic actions to objc_start_protocol() and objc_finish_interface(). (ivar_decl_list): Remove nonterminal. (visibility_spec): Move semantic actions to objc_set_visibility(). (ivar_decls): Remove assignment to $$. (ivar_decl): Rephrase in terms of component_decl; call objc_add_instance_variable(). (ivars, ivar_declarator): Remove nonterminals. (opt_semi): New nonterminal. (methodtype): Remove semantic actions. (methoddef): Move semantic actions to objc_set_method_type(), objc_start_method_definition() and objc_finish_method_definition(). (methodproto): Move semantic actions to objc_set_method_type() and objc_add_method_declaration(). (methoddecl): Use objc_typename instead of typename; move semantic actions to objc_build_method_signature(). (optarglist, myxdecls, mydecl, myparms, myparm): Remove nonterminals. (optparmlist): Express in terms of optparms and optellipsis. (optparms, optellipsis, objc_qual, objc_quals, objc_typename): New nonterminals. (keyworddecl): Use objc_typename instead of typename. (rid_to_yy): Mark RID_IN, RID_OUT, RID_INOUT, RID_BYCOPY, RID_BYREF and RID_ONEWAY as returning OBJC_TYPE_QUAL to yyparse(). [gcc/objc/ChangeLog] 2004-09-07 Ziemowit Laski <zlaski@apple.com> * Make-lang.in (objc/objc-parse.o): Depend on $(C_COMMON_H) instead of objc/objc-act.h. (objc/objc-act.o): Depend on $(HASHTAB_H). * objc-act.c: Include hashtab.h; in ObjC++ mode, include cp-tree.h and objcp-decl.h instead of c-tree.h. (build_module_descriptor, get_class_ivars, synth_id_with_class_suffix, error_with_ivar, gen_method_decl, gen_declaration, setup_string_decl, build_protocol_template): Adjust prototypes. (build_module_initializer_routine, start_class, continue_class, finish_class, start_method_def, objc_start_function, start_protocol, build_method_decl, objc_add_method, add_instance_variable, build_ivar_reference, is_ivar, is_private, get_super_receiver, build_selector_table_decl, objc_push_parm, objc_get_parm_info, gen_type_name, gen_type_name_0, start_var_decl, finish_var_decl, create_field_decl): New prototypes. (objc_expand_function_end, comp_method_with_proto, objc_expr_last, gen_declaration_1, gen_declarator, is_complex_decl, adorn_decl, define_decl, create_builtin_decl, gen_declspecs): Remove prototypes. (TYPE_ID): Rename to OBJECT_TYPEDEF_NAME. (CLASS_TYPEDEF_NAME): New. (TAG_EXECCLASS): Change from a global variable to a #define. (TAG_RETURN_STRUCT): Delete. (TAG_GNUINIT): New, holds '__objc_gnu_init' name. (objc_inherit_code, objc_public_flag): New, moved from c-parse.in. (string_descriptor): New struct. (string_htab): New hash table. (string_hash, string_eq): New prototypes. (generate_struct_by_value_array): Call create_field_decl() instead of create_builtin_decl(). (objc_init): Do not initialize objc_ellipsis_node or TAG_EXECCLASS; In ObjC++ mode, call cxx_init() instead of c_objc_common_init(). (objc_finish_file): In ObjC++, call instantiate_pending_templates() and cp_finish_file(). (define_decl, get_static_reference, get_protocol_reference, create_builtin_decl): Remove functions. (objc_start_class_interface, objc_start_category_interface, objc_start_protocol, objc_continue_interface, objc_finish_interface, objc_start_class_implementation, objc_start_category_implementation, objc_continue_implementation, objc_finish_implementation, objc_set_visibility, objc_set_method_type, objc_build_method_signature, objc_add_method_declaration, objc_start_method_definition, objc_add_instance_variable, objc_get_protocol_qualified_type, create_field_decl, start_var_decl, finish_var_decl): New functions. (setup_string_decl): Simplify since it is only called once. (synth_module_prologue): Call build_class_template(); predefine 'id' and 'Class' as typedefs; rename 'temp_type' to 'type'; disable debug hooks for duration of function; fix GNU runtime messenger signatures to correspond to reality; forward-declare '__objc_exec_class' for the GNU runtime; call build_selector_table_decl(); in ObjC++ mode, generate 'extern "C" { ... }' wrappers around synthesized declarations; call build_protocol_template() and build_category_template(). (string_hash, string_eq): New functions. (objc_build_string_object): Check metaclass correctness only once; store string literals in hash table. (objc_build_constructor): Do not convert initializer elements; adjust for ObjC++ impedance mismatch. (build_objc_symtab_template): Call create_field_decl() instead of create_builtin_decl(). (init_objc_symtab): Add missing conversion to initializer element. (build_metadata_decl): Call start_var_decl() instead of define_decl(). (generate_objc_symtab_decl): Do not call build_category_template(); call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(). (build_module_descriptor): Call create_field_decl() instead of grokfield(); call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(); always mark module descriptor as used; move GNU runtime-specific functionality to build_module_initializer_routine(). (build_module_initializer_routine): New function, broken off of build_module_descriptor(). (objc_static_init_needed_p, objc_generate_static_init_call): New functions. (generate_static_references, generate_strings, build_selector_translation_table, generate_descriptor_table, generate_ivars_list, generate_dispatch_table, generate_category): Call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(); build a type directly instead of via groktypename(). (build_selector_reference_decl, build_selector_table_decl, build_class_reference_decl, build_protocol_reference, generate_objc_image_info): Call start_var_decl() instead of build_decl(). (build_selector_reference): For GNU runtime, do not call build_selector_reference_decl(). (build_selector, build_typed_selector_reference): Always convert result to the selector type. (add_objc_string): Cast return value to 'char *'. (build_method_prototype_template, build_selector_template, build_method_template): Use actual selector type for fields pointing to selectors. (finish_objc): For GNU runtime, call build_module_initializer_routine() after build_module_descriptor(). (generate_protocol_list, generate_shared_structures): Call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(); build a type directly instead of via groktypename(). (synth_id_with_class_suffix): Return a string. (get_arg_type_list): For instance methods, use the instance type for 'self'; do not call groktypename_in_parm_context(). (build_objc_string_decl): Squash redeclaration errors in ObjC++. (objc_is_class_name): Use OBJC_TYPE_NAME instead of TYPE_NAME; handle RECORD_TYPEs in ObjC as well as ObjC++. (objc_is_id): New function. (objc_is_object_ptr): Return the canonical type node. (objc_get_class_ivars): Simplify using get_class_ivars(). (get_class_ivars): Remove second parameter; create a fresh copy of the ivar list for each call; do not check for existence of super class. (objc_eh_runtime_type): Mark #ifndef OBJCPLUS. (objc_init_exceptions): When using SJLJ-style exceptions, require the use of '-fobjc-exceptions' flag; do not require it for DWARF-style exceptions. (objc_build_exc_ptr, next_sjlj_build_try_catch_finally): Use objc_object_type instead of objc_id_type. (objc_begin_catch_clause): Convert the incoming PARM_DECL into a VAR_DECL before placing it in the appropriate scope; do not call define_decl(); adjust call to c_begin_compound_stmt(); use objc_object_type instead of objc_id_type. (build_next_objc_exception_stuff): Call create_field_decl() instead of create_builtin_decl(); construct type directly instead of calling groktypename(); use OBJC_VOID_AT_END to mark end of function parameters. (build_private_template): Adjust call to get_class_ivars(); build a type directly instead of via groktypename(). (build_protocol_template, build_method_prototype_list_template, build_method_prototype_template, build_category_template, build_selector_template, build_class_template, build_super_template, build_ivar_template, build_ivar_list_template, build_method_list_template, build_method_template): Call create_field_decl() instead of grokfield(). (objc_method_parm_type): Do not call groktypename(). (generate_descriptor_table): Call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(). (generate_method_descriptors, build_protocol_initializer, generate_dispatch_tables, build_category_initializer, build_shared_structure_initializer): Do not call groktypename(). (generate_protocols): Call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(); do not call groktypename(). (error_with_ivar): Remove last parameter. (check_ivars): Do not iterate ovar CLASS_RAW_IVARS lists in addition to CLASS_IVARS lists; adjust calls to error_with_ivar(). (generate_ivar_lists): Convert one of the initializer elements; do not call groktypename(). (get_arg_type_list, start_method_def, gen_method_def): Account for new representation of variable arguments and '...' in Objective-C methods; add Objective-C++ impedance matching code. (is_objc_type_qualifier): Remove function. (adjust_type_for_id_default): Simplify; there is no longer a need to wade through declspecs. (lookup_interface, start_class, continue_class, finish_class, start_method_def, start_protocol, build_method_decl, objc_add_method, add_instance_variable, build_ivar_reference, is_ivar, is_private, get_super_receiver, objc_build_finally_epilogue): Make into static functions. (receiver_is_class_object): Use new IS_CLASS() macro. (objc_build_message_expr): Tweak ObjC++ message argument handling; call objc_finish_message_expr() instead of finish_message_expr(). (finish_message_expr): Rename to objc_finish_message_expr(); use OBJC_TYPE_NAME and OBJC_SET_TYPE_NAME macros instead of TYPE_NAME. call gen_type_name() instead of gen_declaration(); call objc_is_id() instead of using IS_ID and IS_CLASS; Use objc_class_name instead of calling get_identifier("Class"); handle CONVERT_EXPRs in receiver. (build_objc_method_call, warn_with_method): Do not call groktypename(). (build_ivar_reference): Call convert() instead of clobbering in a type. (hash_init): Initialize string_htab hash table. (add_instance_variable): Simplify parameter list; do not call grokfield(); do not populate CLASS_IVARS list. (start_class): Check for the existence of super class, if one was specified. (continue_class): Use CLASS_RAW_IVARS rather than CLASS_IVARS; do not call build_class_template(); adjust call to get_class_ivars(); call build_decl(), pushdecl() and finish_decl() instead of define_decl(). (finish_class): Call build_decl(), pushdecl() and finish_decl() instead of define_decl(). (add_protocols): Use PROTOCOL_BINFO_ELTS for the tree vector size. (start_protocol): Do not call build_protocol_template(); use PROTOCOL_BINFO_ELTS for the tree vector size. (encode_type_qualifiers): Do not handle the 'const' qualifier here. (encode_pointer): Encode 'const char *' as 'r*', for backwards compatibility. (encode_array): Use HOST_WIDE_INT_PRINT_DEC instead of "%ld". (encode_type): Handle the 'const' qualifier here. (objc_parmlist): New global variable, sued by objc_push_parm and objc_get_parm_info(). (objc_push_parm, objc_get_parm_info): New functions. (objc_expr_last): Remove function. (synth_self_and_ucmd_args): For instance methods, use the instance type for 'self'; call objc_push_parm() instead of push_parm_decl(). (start_method_def): Do not call push_scope(), declare_parm_level(), pop_scope(), push_parm_decl(), store_parm_decls() or objc_expr_last(); just use objc_push_parm() and objc_get_parm_info(). (comp_method_with_proto): Remove function. (objc_types_are_equivalent): Strip away indirections before comparing underlying types. (comp_proto_with_proto): Do not call groktypename(); types are no longer in raw declspec format. (objc_start_function): New function. (really_start_method): Call comp_proto_with_proto() instead of comp_method_with_proto(); call objc_start_function() instead of hand-crafting a function declarator. (continue_method_def, objc_expand_function_end): Remove functions. (get_super_receiver): Call objc_get_current_scope() instead of get_current_scope(); reference 'super_class' field (instead of 'class'). (finish_method_def): Rename to objc_finish_method_definition() and add a function decl parameter; move method encoding call from objc_expand_function_end(). (is_complex_decl, adorn_decl, gen_declarator, gen_declspecs, gen_declaration_1): Remove functions. (tmpbuf, RAW_DECLSPEC): Remove. (gen_declaration): Remove second parameter; simplify to deal with TYPE_P nodes instead of raw declspecs. (gen_type_name, gen_type_name_0): New functions. (gen_method_decl): Remove second parameter; call gen_type_name() instead of gen_declaration_1(). (dump_interface): Adjust calls to gen_declaration() and gen_method_decl(); do not allocate a separate string buffer. (init_objc): Allocate a larger string buffer to accommodate dump_interface(); adjust call to build_module_descriptor(); add call to build_module_initializer_routine() for the GNU runtime. (generate_classref_translation_entry): Do not call start_decl(); call finish_var_decl() instead of finish_decl(); call convert() instead of build_c_cast(). * objc-act.h (CLASS_OWN_IVARS): Remove accessor. (CLASS_BINFO_ELTS): Reduce from 6 to 5, now that CLASS_OWN_IVARS is gone. (OCTI_GNU_INIT_DECL, GNU_INIT_decl): New. (OCTI_ELLIPSIS_NODE, objc_ellipsis_node): Remove. (OCTI_ID_ID, id_type, objc_id_id): Rename to OCTI_ID_NAME, objc_object_type and objc_object_name, respectively. (OCTI_CLS_REF, OCTI_CLASS_NAME, objc_class_reference, objc_class_name): New. (IS_CLASS): New macro. (IS_ID, IS_SUPER): Robustify. (OCTI_EXECCLASS_DECL, execclass_decl): New. (finish_file, start_class, continue_class, finish_class, start_method_def, continue_method_def, finish_method_def, start_protocol, finish_protocol, objc_build_throw_stmt, objc_build_try_catch_finally_stmt, objc_build_synchronized_prologue, objc_build_synchronized_epilogue, objc_build_try_prologue, objc_build_try_epilogue, objc_build_catch_stmt, objc_build_catch_epilogue, objc_build_finally_prologue, objc_build_finally_epilogue, is_ivar, is_private, is_public, add_instance_variable, objc_add_method, get_super_receiver, objc_clear_super_receiver, get_class_ivars_from_name, get_class_reference, get_static_reference, get_object_reference, build_message_expr, finish_message_expr, build_selector_expr, build_ivar_reference, build_keyword_decl, build_method_decl, build_protocol_expr, build_objc_string_object, objc_declare_alias, objc_declare_class, objc_declare_protocols, objc_comptypes, objc_check_decl, build_encode_expr): Remove prototypes. (imp_count, cat_count): Make GGC-aware. (OBJC_SET_TYPE_NAME): New macro. From-SVN: r87168
2004-09-08 02:49:44 +02:00
tree arg_type = TREE_VALUE (TREE_TYPE (akey));
/* Decay arrays and functions into pointers. */
if (TREE_CODE (arg_type) == ARRAY_TYPE)
arg_type = build_pointer_type (TREE_TYPE (arg_type));
else if (TREE_CODE (arg_type) == FUNCTION_TYPE)
arg_type = build_pointer_type (arg_type);
Makefile.in (c-parse.o): Depend on $(C_COMMON_H). [gcc/ChangeLog] 2004-09-07 Ziemowit Laski <zlaski@apple.com> * Makefile.in (c-parse.o): Depend on $(C_COMMON_H). * c-parse.in: Include c-common.h instead of objc-act.h. (ivar_decl_list, ivar_decls, ivar_decl, ivars, ivar_declarator, myparms, myparm): Remove %type declarations. (methodtype, optparms, OBJC_TYPE_QUAL, objc_quals, objc_qual, objc_typename, objc_try_catch_stmt, optellipsis): Add %type declarations. (objc_inherit_code, objc_public_flag): Remove. (typespec_nonreserved_nonattr): Call objc_get_protocol_qualified_type() instead of get_static_reference() and get_protocol_reference(). (stmt_nocomp): Call grokparm() on @catch parameter. (objcdef): Move semantic action to objc_finish_implementation(). (classdef): Move semantic action to objc_start_class_interface(), objc_continue_interface(), objc_finish_interface(), objc_start_class_implementation(), objc_continue_implementation(), objc_start_category_interface() and objc_start_category_implementation(). (protocoldef): Move semantic actions to objc_start_protocol() and objc_finish_interface(). (ivar_decl_list): Remove nonterminal. (visibility_spec): Move semantic actions to objc_set_visibility(). (ivar_decls): Remove assignment to $$. (ivar_decl): Rephrase in terms of component_decl; call objc_add_instance_variable(). (ivars, ivar_declarator): Remove nonterminals. (opt_semi): New nonterminal. (methodtype): Remove semantic actions. (methoddef): Move semantic actions to objc_set_method_type(), objc_start_method_definition() and objc_finish_method_definition(). (methodproto): Move semantic actions to objc_set_method_type() and objc_add_method_declaration(). (methoddecl): Use objc_typename instead of typename; move semantic actions to objc_build_method_signature(). (optarglist, myxdecls, mydecl, myparms, myparm): Remove nonterminals. (optparmlist): Express in terms of optparms and optellipsis. (optparms, optellipsis, objc_qual, objc_quals, objc_typename): New nonterminals. (keyworddecl): Use objc_typename instead of typename. (rid_to_yy): Mark RID_IN, RID_OUT, RID_INOUT, RID_BYCOPY, RID_BYREF and RID_ONEWAY as returning OBJC_TYPE_QUAL to yyparse(). [gcc/objc/ChangeLog] 2004-09-07 Ziemowit Laski <zlaski@apple.com> * Make-lang.in (objc/objc-parse.o): Depend on $(C_COMMON_H) instead of objc/objc-act.h. (objc/objc-act.o): Depend on $(HASHTAB_H). * objc-act.c: Include hashtab.h; in ObjC++ mode, include cp-tree.h and objcp-decl.h instead of c-tree.h. (build_module_descriptor, get_class_ivars, synth_id_with_class_suffix, error_with_ivar, gen_method_decl, gen_declaration, setup_string_decl, build_protocol_template): Adjust prototypes. (build_module_initializer_routine, start_class, continue_class, finish_class, start_method_def, objc_start_function, start_protocol, build_method_decl, objc_add_method, add_instance_variable, build_ivar_reference, is_ivar, is_private, get_super_receiver, build_selector_table_decl, objc_push_parm, objc_get_parm_info, gen_type_name, gen_type_name_0, start_var_decl, finish_var_decl, create_field_decl): New prototypes. (objc_expand_function_end, comp_method_with_proto, objc_expr_last, gen_declaration_1, gen_declarator, is_complex_decl, adorn_decl, define_decl, create_builtin_decl, gen_declspecs): Remove prototypes. (TYPE_ID): Rename to OBJECT_TYPEDEF_NAME. (CLASS_TYPEDEF_NAME): New. (TAG_EXECCLASS): Change from a global variable to a #define. (TAG_RETURN_STRUCT): Delete. (TAG_GNUINIT): New, holds '__objc_gnu_init' name. (objc_inherit_code, objc_public_flag): New, moved from c-parse.in. (string_descriptor): New struct. (string_htab): New hash table. (string_hash, string_eq): New prototypes. (generate_struct_by_value_array): Call create_field_decl() instead of create_builtin_decl(). (objc_init): Do not initialize objc_ellipsis_node or TAG_EXECCLASS; In ObjC++ mode, call cxx_init() instead of c_objc_common_init(). (objc_finish_file): In ObjC++, call instantiate_pending_templates() and cp_finish_file(). (define_decl, get_static_reference, get_protocol_reference, create_builtin_decl): Remove functions. (objc_start_class_interface, objc_start_category_interface, objc_start_protocol, objc_continue_interface, objc_finish_interface, objc_start_class_implementation, objc_start_category_implementation, objc_continue_implementation, objc_finish_implementation, objc_set_visibility, objc_set_method_type, objc_build_method_signature, objc_add_method_declaration, objc_start_method_definition, objc_add_instance_variable, objc_get_protocol_qualified_type, create_field_decl, start_var_decl, finish_var_decl): New functions. (setup_string_decl): Simplify since it is only called once. (synth_module_prologue): Call build_class_template(); predefine 'id' and 'Class' as typedefs; rename 'temp_type' to 'type'; disable debug hooks for duration of function; fix GNU runtime messenger signatures to correspond to reality; forward-declare '__objc_exec_class' for the GNU runtime; call build_selector_table_decl(); in ObjC++ mode, generate 'extern "C" { ... }' wrappers around synthesized declarations; call build_protocol_template() and build_category_template(). (string_hash, string_eq): New functions. (objc_build_string_object): Check metaclass correctness only once; store string literals in hash table. (objc_build_constructor): Do not convert initializer elements; adjust for ObjC++ impedance mismatch. (build_objc_symtab_template): Call create_field_decl() instead of create_builtin_decl(). (init_objc_symtab): Add missing conversion to initializer element. (build_metadata_decl): Call start_var_decl() instead of define_decl(). (generate_objc_symtab_decl): Do not call build_category_template(); call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(). (build_module_descriptor): Call create_field_decl() instead of grokfield(); call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(); always mark module descriptor as used; move GNU runtime-specific functionality to build_module_initializer_routine(). (build_module_initializer_routine): New function, broken off of build_module_descriptor(). (objc_static_init_needed_p, objc_generate_static_init_call): New functions. (generate_static_references, generate_strings, build_selector_translation_table, generate_descriptor_table, generate_ivars_list, generate_dispatch_table, generate_category): Call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(); build a type directly instead of via groktypename(). (build_selector_reference_decl, build_selector_table_decl, build_class_reference_decl, build_protocol_reference, generate_objc_image_info): Call start_var_decl() instead of build_decl(). (build_selector_reference): For GNU runtime, do not call build_selector_reference_decl(). (build_selector, build_typed_selector_reference): Always convert result to the selector type. (add_objc_string): Cast return value to 'char *'. (build_method_prototype_template, build_selector_template, build_method_template): Use actual selector type for fields pointing to selectors. (finish_objc): For GNU runtime, call build_module_initializer_routine() after build_module_descriptor(). (generate_protocol_list, generate_shared_structures): Call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(); build a type directly instead of via groktypename(). (synth_id_with_class_suffix): Return a string. (get_arg_type_list): For instance methods, use the instance type for 'self'; do not call groktypename_in_parm_context(). (build_objc_string_decl): Squash redeclaration errors in ObjC++. (objc_is_class_name): Use OBJC_TYPE_NAME instead of TYPE_NAME; handle RECORD_TYPEs in ObjC as well as ObjC++. (objc_is_id): New function. (objc_is_object_ptr): Return the canonical type node. (objc_get_class_ivars): Simplify using get_class_ivars(). (get_class_ivars): Remove second parameter; create a fresh copy of the ivar list for each call; do not check for existence of super class. (objc_eh_runtime_type): Mark #ifndef OBJCPLUS. (objc_init_exceptions): When using SJLJ-style exceptions, require the use of '-fobjc-exceptions' flag; do not require it for DWARF-style exceptions. (objc_build_exc_ptr, next_sjlj_build_try_catch_finally): Use objc_object_type instead of objc_id_type. (objc_begin_catch_clause): Convert the incoming PARM_DECL into a VAR_DECL before placing it in the appropriate scope; do not call define_decl(); adjust call to c_begin_compound_stmt(); use objc_object_type instead of objc_id_type. (build_next_objc_exception_stuff): Call create_field_decl() instead of create_builtin_decl(); construct type directly instead of calling groktypename(); use OBJC_VOID_AT_END to mark end of function parameters. (build_private_template): Adjust call to get_class_ivars(); build a type directly instead of via groktypename(). (build_protocol_template, build_method_prototype_list_template, build_method_prototype_template, build_category_template, build_selector_template, build_class_template, build_super_template, build_ivar_template, build_ivar_list_template, build_method_list_template, build_method_template): Call create_field_decl() instead of grokfield(). (objc_method_parm_type): Do not call groktypename(). (generate_descriptor_table): Call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(). (generate_method_descriptors, build_protocol_initializer, generate_dispatch_tables, build_category_initializer, build_shared_structure_initializer): Do not call groktypename(). (generate_protocols): Call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(); do not call groktypename(). (error_with_ivar): Remove last parameter. (check_ivars): Do not iterate ovar CLASS_RAW_IVARS lists in addition to CLASS_IVARS lists; adjust calls to error_with_ivar(). (generate_ivar_lists): Convert one of the initializer elements; do not call groktypename(). (get_arg_type_list, start_method_def, gen_method_def): Account for new representation of variable arguments and '...' in Objective-C methods; add Objective-C++ impedance matching code. (is_objc_type_qualifier): Remove function. (adjust_type_for_id_default): Simplify; there is no longer a need to wade through declspecs. (lookup_interface, start_class, continue_class, finish_class, start_method_def, start_protocol, build_method_decl, objc_add_method, add_instance_variable, build_ivar_reference, is_ivar, is_private, get_super_receiver, objc_build_finally_epilogue): Make into static functions. (receiver_is_class_object): Use new IS_CLASS() macro. (objc_build_message_expr): Tweak ObjC++ message argument handling; call objc_finish_message_expr() instead of finish_message_expr(). (finish_message_expr): Rename to objc_finish_message_expr(); use OBJC_TYPE_NAME and OBJC_SET_TYPE_NAME macros instead of TYPE_NAME. call gen_type_name() instead of gen_declaration(); call objc_is_id() instead of using IS_ID and IS_CLASS; Use objc_class_name instead of calling get_identifier("Class"); handle CONVERT_EXPRs in receiver. (build_objc_method_call, warn_with_method): Do not call groktypename(). (build_ivar_reference): Call convert() instead of clobbering in a type. (hash_init): Initialize string_htab hash table. (add_instance_variable): Simplify parameter list; do not call grokfield(); do not populate CLASS_IVARS list. (start_class): Check for the existence of super class, if one was specified. (continue_class): Use CLASS_RAW_IVARS rather than CLASS_IVARS; do not call build_class_template(); adjust call to get_class_ivars(); call build_decl(), pushdecl() and finish_decl() instead of define_decl(). (finish_class): Call build_decl(), pushdecl() and finish_decl() instead of define_decl(). (add_protocols): Use PROTOCOL_BINFO_ELTS for the tree vector size. (start_protocol): Do not call build_protocol_template(); use PROTOCOL_BINFO_ELTS for the tree vector size. (encode_type_qualifiers): Do not handle the 'const' qualifier here. (encode_pointer): Encode 'const char *' as 'r*', for backwards compatibility. (encode_array): Use HOST_WIDE_INT_PRINT_DEC instead of "%ld". (encode_type): Handle the 'const' qualifier here. (objc_parmlist): New global variable, sued by objc_push_parm and objc_get_parm_info(). (objc_push_parm, objc_get_parm_info): New functions. (objc_expr_last): Remove function. (synth_self_and_ucmd_args): For instance methods, use the instance type for 'self'; call objc_push_parm() instead of push_parm_decl(). (start_method_def): Do not call push_scope(), declare_parm_level(), pop_scope(), push_parm_decl(), store_parm_decls() or objc_expr_last(); just use objc_push_parm() and objc_get_parm_info(). (comp_method_with_proto): Remove function. (objc_types_are_equivalent): Strip away indirections before comparing underlying types. (comp_proto_with_proto): Do not call groktypename(); types are no longer in raw declspec format. (objc_start_function): New function. (really_start_method): Call comp_proto_with_proto() instead of comp_method_with_proto(); call objc_start_function() instead of hand-crafting a function declarator. (continue_method_def, objc_expand_function_end): Remove functions. (get_super_receiver): Call objc_get_current_scope() instead of get_current_scope(); reference 'super_class' field (instead of 'class'). (finish_method_def): Rename to objc_finish_method_definition() and add a function decl parameter; move method encoding call from objc_expand_function_end(). (is_complex_decl, adorn_decl, gen_declarator, gen_declspecs, gen_declaration_1): Remove functions. (tmpbuf, RAW_DECLSPEC): Remove. (gen_declaration): Remove second parameter; simplify to deal with TYPE_P nodes instead of raw declspecs. (gen_type_name, gen_type_name_0): New functions. (gen_method_decl): Remove second parameter; call gen_type_name() instead of gen_declaration_1(). (dump_interface): Adjust calls to gen_declaration() and gen_method_decl(); do not allocate a separate string buffer. (init_objc): Allocate a larger string buffer to accommodate dump_interface(); adjust call to build_module_descriptor(); add call to build_module_initializer_routine() for the GNU runtime. (generate_classref_translation_entry): Do not call start_decl(); call finish_var_decl() instead of finish_decl(); call convert() instead of build_c_cast(). * objc-act.h (CLASS_OWN_IVARS): Remove accessor. (CLASS_BINFO_ELTS): Reduce from 6 to 5, now that CLASS_OWN_IVARS is gone. (OCTI_GNU_INIT_DECL, GNU_INIT_decl): New. (OCTI_ELLIPSIS_NODE, objc_ellipsis_node): Remove. (OCTI_ID_ID, id_type, objc_id_id): Rename to OCTI_ID_NAME, objc_object_type and objc_object_name, respectively. (OCTI_CLS_REF, OCTI_CLASS_NAME, objc_class_reference, objc_class_name): New. (IS_CLASS): New macro. (IS_ID, IS_SUPER): Robustify. (OCTI_EXECCLASS_DECL, execclass_decl): New. (finish_file, start_class, continue_class, finish_class, start_method_def, continue_method_def, finish_method_def, start_protocol, finish_protocol, objc_build_throw_stmt, objc_build_try_catch_finally_stmt, objc_build_synchronized_prologue, objc_build_synchronized_epilogue, objc_build_try_prologue, objc_build_try_epilogue, objc_build_catch_stmt, objc_build_catch_epilogue, objc_build_finally_prologue, objc_build_finally_epilogue, is_ivar, is_private, is_public, add_instance_variable, objc_add_method, get_super_receiver, objc_clear_super_receiver, get_class_ivars_from_name, get_class_reference, get_static_reference, get_object_reference, build_message_expr, finish_message_expr, build_selector_expr, build_ivar_reference, build_keyword_decl, build_method_decl, build_protocol_expr, build_objc_string_object, objc_declare_alias, objc_declare_class, objc_declare_protocols, objc_comptypes, objc_check_decl, build_encode_expr): Remove prototypes. (imp_count, cat_count): Make GGC-aware. (OBJC_SET_TYPE_NAME): New macro. From-SVN: r87168
2004-09-08 02:49:44 +02:00
chainon (arglist, build_tree_list (NULL_TREE, arg_type));
1992-01-18 00:15:38 +01:00
}
Makefile.in (c-parse.o): Depend on $(C_COMMON_H). [gcc/ChangeLog] 2004-09-07 Ziemowit Laski <zlaski@apple.com> * Makefile.in (c-parse.o): Depend on $(C_COMMON_H). * c-parse.in: Include c-common.h instead of objc-act.h. (ivar_decl_list, ivar_decls, ivar_decl, ivars, ivar_declarator, myparms, myparm): Remove %type declarations. (methodtype, optparms, OBJC_TYPE_QUAL, objc_quals, objc_qual, objc_typename, objc_try_catch_stmt, optellipsis): Add %type declarations. (objc_inherit_code, objc_public_flag): Remove. (typespec_nonreserved_nonattr): Call objc_get_protocol_qualified_type() instead of get_static_reference() and get_protocol_reference(). (stmt_nocomp): Call grokparm() on @catch parameter. (objcdef): Move semantic action to objc_finish_implementation(). (classdef): Move semantic action to objc_start_class_interface(), objc_continue_interface(), objc_finish_interface(), objc_start_class_implementation(), objc_continue_implementation(), objc_start_category_interface() and objc_start_category_implementation(). (protocoldef): Move semantic actions to objc_start_protocol() and objc_finish_interface(). (ivar_decl_list): Remove nonterminal. (visibility_spec): Move semantic actions to objc_set_visibility(). (ivar_decls): Remove assignment to $$. (ivar_decl): Rephrase in terms of component_decl; call objc_add_instance_variable(). (ivars, ivar_declarator): Remove nonterminals. (opt_semi): New nonterminal. (methodtype): Remove semantic actions. (methoddef): Move semantic actions to objc_set_method_type(), objc_start_method_definition() and objc_finish_method_definition(). (methodproto): Move semantic actions to objc_set_method_type() and objc_add_method_declaration(). (methoddecl): Use objc_typename instead of typename; move semantic actions to objc_build_method_signature(). (optarglist, myxdecls, mydecl, myparms, myparm): Remove nonterminals. (optparmlist): Express in terms of optparms and optellipsis. (optparms, optellipsis, objc_qual, objc_quals, objc_typename): New nonterminals. (keyworddecl): Use objc_typename instead of typename. (rid_to_yy): Mark RID_IN, RID_OUT, RID_INOUT, RID_BYCOPY, RID_BYREF and RID_ONEWAY as returning OBJC_TYPE_QUAL to yyparse(). [gcc/objc/ChangeLog] 2004-09-07 Ziemowit Laski <zlaski@apple.com> * Make-lang.in (objc/objc-parse.o): Depend on $(C_COMMON_H) instead of objc/objc-act.h. (objc/objc-act.o): Depend on $(HASHTAB_H). * objc-act.c: Include hashtab.h; in ObjC++ mode, include cp-tree.h and objcp-decl.h instead of c-tree.h. (build_module_descriptor, get_class_ivars, synth_id_with_class_suffix, error_with_ivar, gen_method_decl, gen_declaration, setup_string_decl, build_protocol_template): Adjust prototypes. (build_module_initializer_routine, start_class, continue_class, finish_class, start_method_def, objc_start_function, start_protocol, build_method_decl, objc_add_method, add_instance_variable, build_ivar_reference, is_ivar, is_private, get_super_receiver, build_selector_table_decl, objc_push_parm, objc_get_parm_info, gen_type_name, gen_type_name_0, start_var_decl, finish_var_decl, create_field_decl): New prototypes. (objc_expand_function_end, comp_method_with_proto, objc_expr_last, gen_declaration_1, gen_declarator, is_complex_decl, adorn_decl, define_decl, create_builtin_decl, gen_declspecs): Remove prototypes. (TYPE_ID): Rename to OBJECT_TYPEDEF_NAME. (CLASS_TYPEDEF_NAME): New. (TAG_EXECCLASS): Change from a global variable to a #define. (TAG_RETURN_STRUCT): Delete. (TAG_GNUINIT): New, holds '__objc_gnu_init' name. (objc_inherit_code, objc_public_flag): New, moved from c-parse.in. (string_descriptor): New struct. (string_htab): New hash table. (string_hash, string_eq): New prototypes. (generate_struct_by_value_array): Call create_field_decl() instead of create_builtin_decl(). (objc_init): Do not initialize objc_ellipsis_node or TAG_EXECCLASS; In ObjC++ mode, call cxx_init() instead of c_objc_common_init(). (objc_finish_file): In ObjC++, call instantiate_pending_templates() and cp_finish_file(). (define_decl, get_static_reference, get_protocol_reference, create_builtin_decl): Remove functions. (objc_start_class_interface, objc_start_category_interface, objc_start_protocol, objc_continue_interface, objc_finish_interface, objc_start_class_implementation, objc_start_category_implementation, objc_continue_implementation, objc_finish_implementation, objc_set_visibility, objc_set_method_type, objc_build_method_signature, objc_add_method_declaration, objc_start_method_definition, objc_add_instance_variable, objc_get_protocol_qualified_type, create_field_decl, start_var_decl, finish_var_decl): New functions. (setup_string_decl): Simplify since it is only called once. (synth_module_prologue): Call build_class_template(); predefine 'id' and 'Class' as typedefs; rename 'temp_type' to 'type'; disable debug hooks for duration of function; fix GNU runtime messenger signatures to correspond to reality; forward-declare '__objc_exec_class' for the GNU runtime; call build_selector_table_decl(); in ObjC++ mode, generate 'extern "C" { ... }' wrappers around synthesized declarations; call build_protocol_template() and build_category_template(). (string_hash, string_eq): New functions. (objc_build_string_object): Check metaclass correctness only once; store string literals in hash table. (objc_build_constructor): Do not convert initializer elements; adjust for ObjC++ impedance mismatch. (build_objc_symtab_template): Call create_field_decl() instead of create_builtin_decl(). (init_objc_symtab): Add missing conversion to initializer element. (build_metadata_decl): Call start_var_decl() instead of define_decl(). (generate_objc_symtab_decl): Do not call build_category_template(); call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(). (build_module_descriptor): Call create_field_decl() instead of grokfield(); call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(); always mark module descriptor as used; move GNU runtime-specific functionality to build_module_initializer_routine(). (build_module_initializer_routine): New function, broken off of build_module_descriptor(). (objc_static_init_needed_p, objc_generate_static_init_call): New functions. (generate_static_references, generate_strings, build_selector_translation_table, generate_descriptor_table, generate_ivars_list, generate_dispatch_table, generate_category): Call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(); build a type directly instead of via groktypename(). (build_selector_reference_decl, build_selector_table_decl, build_class_reference_decl, build_protocol_reference, generate_objc_image_info): Call start_var_decl() instead of build_decl(). (build_selector_reference): For GNU runtime, do not call build_selector_reference_decl(). (build_selector, build_typed_selector_reference): Always convert result to the selector type. (add_objc_string): Cast return value to 'char *'. (build_method_prototype_template, build_selector_template, build_method_template): Use actual selector type for fields pointing to selectors. (finish_objc): For GNU runtime, call build_module_initializer_routine() after build_module_descriptor(). (generate_protocol_list, generate_shared_structures): Call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(); build a type directly instead of via groktypename(). (synth_id_with_class_suffix): Return a string. (get_arg_type_list): For instance methods, use the instance type for 'self'; do not call groktypename_in_parm_context(). (build_objc_string_decl): Squash redeclaration errors in ObjC++. (objc_is_class_name): Use OBJC_TYPE_NAME instead of TYPE_NAME; handle RECORD_TYPEs in ObjC as well as ObjC++. (objc_is_id): New function. (objc_is_object_ptr): Return the canonical type node. (objc_get_class_ivars): Simplify using get_class_ivars(). (get_class_ivars): Remove second parameter; create a fresh copy of the ivar list for each call; do not check for existence of super class. (objc_eh_runtime_type): Mark #ifndef OBJCPLUS. (objc_init_exceptions): When using SJLJ-style exceptions, require the use of '-fobjc-exceptions' flag; do not require it for DWARF-style exceptions. (objc_build_exc_ptr, next_sjlj_build_try_catch_finally): Use objc_object_type instead of objc_id_type. (objc_begin_catch_clause): Convert the incoming PARM_DECL into a VAR_DECL before placing it in the appropriate scope; do not call define_decl(); adjust call to c_begin_compound_stmt(); use objc_object_type instead of objc_id_type. (build_next_objc_exception_stuff): Call create_field_decl() instead of create_builtin_decl(); construct type directly instead of calling groktypename(); use OBJC_VOID_AT_END to mark end of function parameters. (build_private_template): Adjust call to get_class_ivars(); build a type directly instead of via groktypename(). (build_protocol_template, build_method_prototype_list_template, build_method_prototype_template, build_category_template, build_selector_template, build_class_template, build_super_template, build_ivar_template, build_ivar_list_template, build_method_list_template, build_method_template): Call create_field_decl() instead of grokfield(). (objc_method_parm_type): Do not call groktypename(). (generate_descriptor_table): Call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(). (generate_method_descriptors, build_protocol_initializer, generate_dispatch_tables, build_category_initializer, build_shared_structure_initializer): Do not call groktypename(). (generate_protocols): Call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(); do not call groktypename(). (error_with_ivar): Remove last parameter. (check_ivars): Do not iterate ovar CLASS_RAW_IVARS lists in addition to CLASS_IVARS lists; adjust calls to error_with_ivar(). (generate_ivar_lists): Convert one of the initializer elements; do not call groktypename(). (get_arg_type_list, start_method_def, gen_method_def): Account for new representation of variable arguments and '...' in Objective-C methods; add Objective-C++ impedance matching code. (is_objc_type_qualifier): Remove function. (adjust_type_for_id_default): Simplify; there is no longer a need to wade through declspecs. (lookup_interface, start_class, continue_class, finish_class, start_method_def, start_protocol, build_method_decl, objc_add_method, add_instance_variable, build_ivar_reference, is_ivar, is_private, get_super_receiver, objc_build_finally_epilogue): Make into static functions. (receiver_is_class_object): Use new IS_CLASS() macro. (objc_build_message_expr): Tweak ObjC++ message argument handling; call objc_finish_message_expr() instead of finish_message_expr(). (finish_message_expr): Rename to objc_finish_message_expr(); use OBJC_TYPE_NAME and OBJC_SET_TYPE_NAME macros instead of TYPE_NAME. call gen_type_name() instead of gen_declaration(); call objc_is_id() instead of using IS_ID and IS_CLASS; Use objc_class_name instead of calling get_identifier("Class"); handle CONVERT_EXPRs in receiver. (build_objc_method_call, warn_with_method): Do not call groktypename(). (build_ivar_reference): Call convert() instead of clobbering in a type. (hash_init): Initialize string_htab hash table. (add_instance_variable): Simplify parameter list; do not call grokfield(); do not populate CLASS_IVARS list. (start_class): Check for the existence of super class, if one was specified. (continue_class): Use CLASS_RAW_IVARS rather than CLASS_IVARS; do not call build_class_template(); adjust call to get_class_ivars(); call build_decl(), pushdecl() and finish_decl() instead of define_decl(). (finish_class): Call build_decl(), pushdecl() and finish_decl() instead of define_decl(). (add_protocols): Use PROTOCOL_BINFO_ELTS for the tree vector size. (start_protocol): Do not call build_protocol_template(); use PROTOCOL_BINFO_ELTS for the tree vector size. (encode_type_qualifiers): Do not handle the 'const' qualifier here. (encode_pointer): Encode 'const char *' as 'r*', for backwards compatibility. (encode_array): Use HOST_WIDE_INT_PRINT_DEC instead of "%ld". (encode_type): Handle the 'const' qualifier here. (objc_parmlist): New global variable, sued by objc_push_parm and objc_get_parm_info(). (objc_push_parm, objc_get_parm_info): New functions. (objc_expr_last): Remove function. (synth_self_and_ucmd_args): For instance methods, use the instance type for 'self'; call objc_push_parm() instead of push_parm_decl(). (start_method_def): Do not call push_scope(), declare_parm_level(), pop_scope(), push_parm_decl(), store_parm_decls() or objc_expr_last(); just use objc_push_parm() and objc_get_parm_info(). (comp_method_with_proto): Remove function. (objc_types_are_equivalent): Strip away indirections before comparing underlying types. (comp_proto_with_proto): Do not call groktypename(); types are no longer in raw declspec format. (objc_start_function): New function. (really_start_method): Call comp_proto_with_proto() instead of comp_method_with_proto(); call objc_start_function() instead of hand-crafting a function declarator. (continue_method_def, objc_expand_function_end): Remove functions. (get_super_receiver): Call objc_get_current_scope() instead of get_current_scope(); reference 'super_class' field (instead of 'class'). (finish_method_def): Rename to objc_finish_method_definition() and add a function decl parameter; move method encoding call from objc_expand_function_end(). (is_complex_decl, adorn_decl, gen_declarator, gen_declspecs, gen_declaration_1): Remove functions. (tmpbuf, RAW_DECLSPEC): Remove. (gen_declaration): Remove second parameter; simplify to deal with TYPE_P nodes instead of raw declspecs. (gen_type_name, gen_type_name_0): New functions. (gen_method_decl): Remove second parameter; call gen_type_name() instead of gen_declaration_1(). (dump_interface): Adjust calls to gen_declaration() and gen_method_decl(); do not allocate a separate string buffer. (init_objc): Allocate a larger string buffer to accommodate dump_interface(); adjust call to build_module_descriptor(); add call to build_module_initializer_routine() for the GNU runtime. (generate_classref_translation_entry): Do not call start_decl(); call finish_var_decl() instead of finish_decl(); call convert() instead of build_c_cast(). * objc-act.h (CLASS_OWN_IVARS): Remove accessor. (CLASS_BINFO_ELTS): Reduce from 6 to 5, now that CLASS_OWN_IVARS is gone. (OCTI_GNU_INIT_DECL, GNU_INIT_decl): New. (OCTI_ELLIPSIS_NODE, objc_ellipsis_node): Remove. (OCTI_ID_ID, id_type, objc_id_id): Rename to OCTI_ID_NAME, objc_object_type and objc_object_name, respectively. (OCTI_CLS_REF, OCTI_CLASS_NAME, objc_class_reference, objc_class_name): New. (IS_CLASS): New macro. (IS_ID, IS_SUPER): Robustify. (OCTI_EXECCLASS_DECL, execclass_decl): New. (finish_file, start_class, continue_class, finish_class, start_method_def, continue_method_def, finish_method_def, start_protocol, finish_protocol, objc_build_throw_stmt, objc_build_try_catch_finally_stmt, objc_build_synchronized_prologue, objc_build_synchronized_epilogue, objc_build_try_prologue, objc_build_try_epilogue, objc_build_catch_stmt, objc_build_catch_epilogue, objc_build_finally_prologue, objc_build_finally_epilogue, is_ivar, is_private, is_public, add_instance_variable, objc_add_method, get_super_receiver, objc_clear_super_receiver, get_class_ivars_from_name, get_class_reference, get_static_reference, get_object_reference, build_message_expr, finish_message_expr, build_selector_expr, build_ivar_reference, build_keyword_decl, build_method_decl, build_protocol_expr, build_objc_string_object, objc_declare_alias, objc_declare_class, objc_declare_protocols, objc_comptypes, objc_check_decl, build_encode_expr): Remove prototypes. (imp_count, cat_count): Make GGC-aware. (OBJC_SET_TYPE_NAME): New macro. From-SVN: r87168
2004-09-08 02:49:44 +02:00
if (METHOD_ADD_ARGS (meth))
1992-01-18 00:15:38 +01:00
{
Makefile.in (c-parse.o): Depend on $(C_COMMON_H). [gcc/ChangeLog] 2004-09-07 Ziemowit Laski <zlaski@apple.com> * Makefile.in (c-parse.o): Depend on $(C_COMMON_H). * c-parse.in: Include c-common.h instead of objc-act.h. (ivar_decl_list, ivar_decls, ivar_decl, ivars, ivar_declarator, myparms, myparm): Remove %type declarations. (methodtype, optparms, OBJC_TYPE_QUAL, objc_quals, objc_qual, objc_typename, objc_try_catch_stmt, optellipsis): Add %type declarations. (objc_inherit_code, objc_public_flag): Remove. (typespec_nonreserved_nonattr): Call objc_get_protocol_qualified_type() instead of get_static_reference() and get_protocol_reference(). (stmt_nocomp): Call grokparm() on @catch parameter. (objcdef): Move semantic action to objc_finish_implementation(). (classdef): Move semantic action to objc_start_class_interface(), objc_continue_interface(), objc_finish_interface(), objc_start_class_implementation(), objc_continue_implementation(), objc_start_category_interface() and objc_start_category_implementation(). (protocoldef): Move semantic actions to objc_start_protocol() and objc_finish_interface(). (ivar_decl_list): Remove nonterminal. (visibility_spec): Move semantic actions to objc_set_visibility(). (ivar_decls): Remove assignment to $$. (ivar_decl): Rephrase in terms of component_decl; call objc_add_instance_variable(). (ivars, ivar_declarator): Remove nonterminals. (opt_semi): New nonterminal. (methodtype): Remove semantic actions. (methoddef): Move semantic actions to objc_set_method_type(), objc_start_method_definition() and objc_finish_method_definition(). (methodproto): Move semantic actions to objc_set_method_type() and objc_add_method_declaration(). (methoddecl): Use objc_typename instead of typename; move semantic actions to objc_build_method_signature(). (optarglist, myxdecls, mydecl, myparms, myparm): Remove nonterminals. (optparmlist): Express in terms of optparms and optellipsis. (optparms, optellipsis, objc_qual, objc_quals, objc_typename): New nonterminals. (keyworddecl): Use objc_typename instead of typename. (rid_to_yy): Mark RID_IN, RID_OUT, RID_INOUT, RID_BYCOPY, RID_BYREF and RID_ONEWAY as returning OBJC_TYPE_QUAL to yyparse(). [gcc/objc/ChangeLog] 2004-09-07 Ziemowit Laski <zlaski@apple.com> * Make-lang.in (objc/objc-parse.o): Depend on $(C_COMMON_H) instead of objc/objc-act.h. (objc/objc-act.o): Depend on $(HASHTAB_H). * objc-act.c: Include hashtab.h; in ObjC++ mode, include cp-tree.h and objcp-decl.h instead of c-tree.h. (build_module_descriptor, get_class_ivars, synth_id_with_class_suffix, error_with_ivar, gen_method_decl, gen_declaration, setup_string_decl, build_protocol_template): Adjust prototypes. (build_module_initializer_routine, start_class, continue_class, finish_class, start_method_def, objc_start_function, start_protocol, build_method_decl, objc_add_method, add_instance_variable, build_ivar_reference, is_ivar, is_private, get_super_receiver, build_selector_table_decl, objc_push_parm, objc_get_parm_info, gen_type_name, gen_type_name_0, start_var_decl, finish_var_decl, create_field_decl): New prototypes. (objc_expand_function_end, comp_method_with_proto, objc_expr_last, gen_declaration_1, gen_declarator, is_complex_decl, adorn_decl, define_decl, create_builtin_decl, gen_declspecs): Remove prototypes. (TYPE_ID): Rename to OBJECT_TYPEDEF_NAME. (CLASS_TYPEDEF_NAME): New. (TAG_EXECCLASS): Change from a global variable to a #define. (TAG_RETURN_STRUCT): Delete. (TAG_GNUINIT): New, holds '__objc_gnu_init' name. (objc_inherit_code, objc_public_flag): New, moved from c-parse.in. (string_descriptor): New struct. (string_htab): New hash table. (string_hash, string_eq): New prototypes. (generate_struct_by_value_array): Call create_field_decl() instead of create_builtin_decl(). (objc_init): Do not initialize objc_ellipsis_node or TAG_EXECCLASS; In ObjC++ mode, call cxx_init() instead of c_objc_common_init(). (objc_finish_file): In ObjC++, call instantiate_pending_templates() and cp_finish_file(). (define_decl, get_static_reference, get_protocol_reference, create_builtin_decl): Remove functions. (objc_start_class_interface, objc_start_category_interface, objc_start_protocol, objc_continue_interface, objc_finish_interface, objc_start_class_implementation, objc_start_category_implementation, objc_continue_implementation, objc_finish_implementation, objc_set_visibility, objc_set_method_type, objc_build_method_signature, objc_add_method_declaration, objc_start_method_definition, objc_add_instance_variable, objc_get_protocol_qualified_type, create_field_decl, start_var_decl, finish_var_decl): New functions. (setup_string_decl): Simplify since it is only called once. (synth_module_prologue): Call build_class_template(); predefine 'id' and 'Class' as typedefs; rename 'temp_type' to 'type'; disable debug hooks for duration of function; fix GNU runtime messenger signatures to correspond to reality; forward-declare '__objc_exec_class' for the GNU runtime; call build_selector_table_decl(); in ObjC++ mode, generate 'extern "C" { ... }' wrappers around synthesized declarations; call build_protocol_template() and build_category_template(). (string_hash, string_eq): New functions. (objc_build_string_object): Check metaclass correctness only once; store string literals in hash table. (objc_build_constructor): Do not convert initializer elements; adjust for ObjC++ impedance mismatch. (build_objc_symtab_template): Call create_field_decl() instead of create_builtin_decl(). (init_objc_symtab): Add missing conversion to initializer element. (build_metadata_decl): Call start_var_decl() instead of define_decl(). (generate_objc_symtab_decl): Do not call build_category_template(); call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(). (build_module_descriptor): Call create_field_decl() instead of grokfield(); call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(); always mark module descriptor as used; move GNU runtime-specific functionality to build_module_initializer_routine(). (build_module_initializer_routine): New function, broken off of build_module_descriptor(). (objc_static_init_needed_p, objc_generate_static_init_call): New functions. (generate_static_references, generate_strings, build_selector_translation_table, generate_descriptor_table, generate_ivars_list, generate_dispatch_table, generate_category): Call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(); build a type directly instead of via groktypename(). (build_selector_reference_decl, build_selector_table_decl, build_class_reference_decl, build_protocol_reference, generate_objc_image_info): Call start_var_decl() instead of build_decl(). (build_selector_reference): For GNU runtime, do not call build_selector_reference_decl(). (build_selector, build_typed_selector_reference): Always convert result to the selector type. (add_objc_string): Cast return value to 'char *'. (build_method_prototype_template, build_selector_template, build_method_template): Use actual selector type for fields pointing to selectors. (finish_objc): For GNU runtime, call build_module_initializer_routine() after build_module_descriptor(). (generate_protocol_list, generate_shared_structures): Call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(); build a type directly instead of via groktypename(). (synth_id_with_class_suffix): Return a string. (get_arg_type_list): For instance methods, use the instance type for 'self'; do not call groktypename_in_parm_context(). (build_objc_string_decl): Squash redeclaration errors in ObjC++. (objc_is_class_name): Use OBJC_TYPE_NAME instead of TYPE_NAME; handle RECORD_TYPEs in ObjC as well as ObjC++. (objc_is_id): New function. (objc_is_object_ptr): Return the canonical type node. (objc_get_class_ivars): Simplify using get_class_ivars(). (get_class_ivars): Remove second parameter; create a fresh copy of the ivar list for each call; do not check for existence of super class. (objc_eh_runtime_type): Mark #ifndef OBJCPLUS. (objc_init_exceptions): When using SJLJ-style exceptions, require the use of '-fobjc-exceptions' flag; do not require it for DWARF-style exceptions. (objc_build_exc_ptr, next_sjlj_build_try_catch_finally): Use objc_object_type instead of objc_id_type. (objc_begin_catch_clause): Convert the incoming PARM_DECL into a VAR_DECL before placing it in the appropriate scope; do not call define_decl(); adjust call to c_begin_compound_stmt(); use objc_object_type instead of objc_id_type. (build_next_objc_exception_stuff): Call create_field_decl() instead of create_builtin_decl(); construct type directly instead of calling groktypename(); use OBJC_VOID_AT_END to mark end of function parameters. (build_private_template): Adjust call to get_class_ivars(); build a type directly instead of via groktypename(). (build_protocol_template, build_method_prototype_list_template, build_method_prototype_template, build_category_template, build_selector_template, build_class_template, build_super_template, build_ivar_template, build_ivar_list_template, build_method_list_template, build_method_template): Call create_field_decl() instead of grokfield(). (objc_method_parm_type): Do not call groktypename(). (generate_descriptor_table): Call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(). (generate_method_descriptors, build_protocol_initializer, generate_dispatch_tables, build_category_initializer, build_shared_structure_initializer): Do not call groktypename(). (generate_protocols): Call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(); do not call groktypename(). (error_with_ivar): Remove last parameter. (check_ivars): Do not iterate ovar CLASS_RAW_IVARS lists in addition to CLASS_IVARS lists; adjust calls to error_with_ivar(). (generate_ivar_lists): Convert one of the initializer elements; do not call groktypename(). (get_arg_type_list, start_method_def, gen_method_def): Account for new representation of variable arguments and '...' in Objective-C methods; add Objective-C++ impedance matching code. (is_objc_type_qualifier): Remove function. (adjust_type_for_id_default): Simplify; there is no longer a need to wade through declspecs. (lookup_interface, start_class, continue_class, finish_class, start_method_def, start_protocol, build_method_decl, objc_add_method, add_instance_variable, build_ivar_reference, is_ivar, is_private, get_super_receiver, objc_build_finally_epilogue): Make into static functions. (receiver_is_class_object): Use new IS_CLASS() macro. (objc_build_message_expr): Tweak ObjC++ message argument handling; call objc_finish_message_expr() instead of finish_message_expr(). (finish_message_expr): Rename to objc_finish_message_expr(); use OBJC_TYPE_NAME and OBJC_SET_TYPE_NAME macros instead of TYPE_NAME. call gen_type_name() instead of gen_declaration(); call objc_is_id() instead of using IS_ID and IS_CLASS; Use objc_class_name instead of calling get_identifier("Class"); handle CONVERT_EXPRs in receiver. (build_objc_method_call, warn_with_method): Do not call groktypename(). (build_ivar_reference): Call convert() instead of clobbering in a type. (hash_init): Initialize string_htab hash table. (add_instance_variable): Simplify parameter list; do not call grokfield(); do not populate CLASS_IVARS list. (start_class): Check for the existence of super class, if one was specified. (continue_class): Use CLASS_RAW_IVARS rather than CLASS_IVARS; do not call build_class_template(); adjust call to get_class_ivars(); call build_decl(), pushdecl() and finish_decl() instead of define_decl(). (finish_class): Call build_decl(), pushdecl() and finish_decl() instead of define_decl(). (add_protocols): Use PROTOCOL_BINFO_ELTS for the tree vector size. (start_protocol): Do not call build_protocol_template(); use PROTOCOL_BINFO_ELTS for the tree vector size. (encode_type_qualifiers): Do not handle the 'const' qualifier here. (encode_pointer): Encode 'const char *' as 'r*', for backwards compatibility. (encode_array): Use HOST_WIDE_INT_PRINT_DEC instead of "%ld". (encode_type): Handle the 'const' qualifier here. (objc_parmlist): New global variable, sued by objc_push_parm and objc_get_parm_info(). (objc_push_parm, objc_get_parm_info): New functions. (objc_expr_last): Remove function. (synth_self_and_ucmd_args): For instance methods, use the instance type for 'self'; call objc_push_parm() instead of push_parm_decl(). (start_method_def): Do not call push_scope(), declare_parm_level(), pop_scope(), push_parm_decl(), store_parm_decls() or objc_expr_last(); just use objc_push_parm() and objc_get_parm_info(). (comp_method_with_proto): Remove function. (objc_types_are_equivalent): Strip away indirections before comparing underlying types. (comp_proto_with_proto): Do not call groktypename(); types are no longer in raw declspec format. (objc_start_function): New function. (really_start_method): Call comp_proto_with_proto() instead of comp_method_with_proto(); call objc_start_function() instead of hand-crafting a function declarator. (continue_method_def, objc_expand_function_end): Remove functions. (get_super_receiver): Call objc_get_current_scope() instead of get_current_scope(); reference 'super_class' field (instead of 'class'). (finish_method_def): Rename to objc_finish_method_definition() and add a function decl parameter; move method encoding call from objc_expand_function_end(). (is_complex_decl, adorn_decl, gen_declarator, gen_declspecs, gen_declaration_1): Remove functions. (tmpbuf, RAW_DECLSPEC): Remove. (gen_declaration): Remove second parameter; simplify to deal with TYPE_P nodes instead of raw declspecs. (gen_type_name, gen_type_name_0): New functions. (gen_method_decl): Remove second parameter; call gen_type_name() instead of gen_declaration_1(). (dump_interface): Adjust calls to gen_declaration() and gen_method_decl(); do not allocate a separate string buffer. (init_objc): Allocate a larger string buffer to accommodate dump_interface(); adjust call to build_module_descriptor(); add call to build_module_initializer_routine() for the GNU runtime. (generate_classref_translation_entry): Do not call start_decl(); call finish_var_decl() instead of finish_decl(); call convert() instead of build_c_cast(). * objc-act.h (CLASS_OWN_IVARS): Remove accessor. (CLASS_BINFO_ELTS): Reduce from 6 to 5, now that CLASS_OWN_IVARS is gone. (OCTI_GNU_INIT_DECL, GNU_INIT_decl): New. (OCTI_ELLIPSIS_NODE, objc_ellipsis_node): Remove. (OCTI_ID_ID, id_type, objc_id_id): Rename to OCTI_ID_NAME, objc_object_type and objc_object_name, respectively. (OCTI_CLS_REF, OCTI_CLASS_NAME, objc_class_reference, objc_class_name): New. (IS_CLASS): New macro. (IS_ID, IS_SUPER): Robustify. (OCTI_EXECCLASS_DECL, execclass_decl): New. (finish_file, start_class, continue_class, finish_class, start_method_def, continue_method_def, finish_method_def, start_protocol, finish_protocol, objc_build_throw_stmt, objc_build_try_catch_finally_stmt, objc_build_synchronized_prologue, objc_build_synchronized_epilogue, objc_build_try_prologue, objc_build_try_epilogue, objc_build_catch_stmt, objc_build_catch_epilogue, objc_build_finally_prologue, objc_build_finally_epilogue, is_ivar, is_private, is_public, add_instance_variable, objc_add_method, get_super_receiver, objc_clear_super_receiver, get_class_ivars_from_name, get_class_reference, get_static_reference, get_object_reference, build_message_expr, finish_message_expr, build_selector_expr, build_ivar_reference, build_keyword_decl, build_method_decl, build_protocol_expr, build_objc_string_object, objc_declare_alias, objc_declare_class, objc_declare_protocols, objc_comptypes, objc_check_decl, build_encode_expr): Remove prototypes. (imp_count, cat_count): Make GGC-aware. (OBJC_SET_TYPE_NAME): New macro. From-SVN: r87168
2004-09-08 02:49:44 +02:00
for (akey = TREE_CHAIN (METHOD_ADD_ARGS (meth));
akey; akey = TREE_CHAIN (akey))
{
tree arg_type = TREE_TYPE (TREE_VALUE (akey));
chainon (arglist, build_tree_list (NULL_TREE, arg_type));
}
if (!METHOD_ADD_ARGS_ELLIPSIS_P (meth))
Makefile.in (c-parse.o): Depend on $(C_COMMON_H). [gcc/ChangeLog] 2004-09-07 Ziemowit Laski <zlaski@apple.com> * Makefile.in (c-parse.o): Depend on $(C_COMMON_H). * c-parse.in: Include c-common.h instead of objc-act.h. (ivar_decl_list, ivar_decls, ivar_decl, ivars, ivar_declarator, myparms, myparm): Remove %type declarations. (methodtype, optparms, OBJC_TYPE_QUAL, objc_quals, objc_qual, objc_typename, objc_try_catch_stmt, optellipsis): Add %type declarations. (objc_inherit_code, objc_public_flag): Remove. (typespec_nonreserved_nonattr): Call objc_get_protocol_qualified_type() instead of get_static_reference() and get_protocol_reference(). (stmt_nocomp): Call grokparm() on @catch parameter. (objcdef): Move semantic action to objc_finish_implementation(). (classdef): Move semantic action to objc_start_class_interface(), objc_continue_interface(), objc_finish_interface(), objc_start_class_implementation(), objc_continue_implementation(), objc_start_category_interface() and objc_start_category_implementation(). (protocoldef): Move semantic actions to objc_start_protocol() and objc_finish_interface(). (ivar_decl_list): Remove nonterminal. (visibility_spec): Move semantic actions to objc_set_visibility(). (ivar_decls): Remove assignment to $$. (ivar_decl): Rephrase in terms of component_decl; call objc_add_instance_variable(). (ivars, ivar_declarator): Remove nonterminals. (opt_semi): New nonterminal. (methodtype): Remove semantic actions. (methoddef): Move semantic actions to objc_set_method_type(), objc_start_method_definition() and objc_finish_method_definition(). (methodproto): Move semantic actions to objc_set_method_type() and objc_add_method_declaration(). (methoddecl): Use objc_typename instead of typename; move semantic actions to objc_build_method_signature(). (optarglist, myxdecls, mydecl, myparms, myparm): Remove nonterminals. (optparmlist): Express in terms of optparms and optellipsis. (optparms, optellipsis, objc_qual, objc_quals, objc_typename): New nonterminals. (keyworddecl): Use objc_typename instead of typename. (rid_to_yy): Mark RID_IN, RID_OUT, RID_INOUT, RID_BYCOPY, RID_BYREF and RID_ONEWAY as returning OBJC_TYPE_QUAL to yyparse(). [gcc/objc/ChangeLog] 2004-09-07 Ziemowit Laski <zlaski@apple.com> * Make-lang.in (objc/objc-parse.o): Depend on $(C_COMMON_H) instead of objc/objc-act.h. (objc/objc-act.o): Depend on $(HASHTAB_H). * objc-act.c: Include hashtab.h; in ObjC++ mode, include cp-tree.h and objcp-decl.h instead of c-tree.h. (build_module_descriptor, get_class_ivars, synth_id_with_class_suffix, error_with_ivar, gen_method_decl, gen_declaration, setup_string_decl, build_protocol_template): Adjust prototypes. (build_module_initializer_routine, start_class, continue_class, finish_class, start_method_def, objc_start_function, start_protocol, build_method_decl, objc_add_method, add_instance_variable, build_ivar_reference, is_ivar, is_private, get_super_receiver, build_selector_table_decl, objc_push_parm, objc_get_parm_info, gen_type_name, gen_type_name_0, start_var_decl, finish_var_decl, create_field_decl): New prototypes. (objc_expand_function_end, comp_method_with_proto, objc_expr_last, gen_declaration_1, gen_declarator, is_complex_decl, adorn_decl, define_decl, create_builtin_decl, gen_declspecs): Remove prototypes. (TYPE_ID): Rename to OBJECT_TYPEDEF_NAME. (CLASS_TYPEDEF_NAME): New. (TAG_EXECCLASS): Change from a global variable to a #define. (TAG_RETURN_STRUCT): Delete. (TAG_GNUINIT): New, holds '__objc_gnu_init' name. (objc_inherit_code, objc_public_flag): New, moved from c-parse.in. (string_descriptor): New struct. (string_htab): New hash table. (string_hash, string_eq): New prototypes. (generate_struct_by_value_array): Call create_field_decl() instead of create_builtin_decl(). (objc_init): Do not initialize objc_ellipsis_node or TAG_EXECCLASS; In ObjC++ mode, call cxx_init() instead of c_objc_common_init(). (objc_finish_file): In ObjC++, call instantiate_pending_templates() and cp_finish_file(). (define_decl, get_static_reference, get_protocol_reference, create_builtin_decl): Remove functions. (objc_start_class_interface, objc_start_category_interface, objc_start_protocol, objc_continue_interface, objc_finish_interface, objc_start_class_implementation, objc_start_category_implementation, objc_continue_implementation, objc_finish_implementation, objc_set_visibility, objc_set_method_type, objc_build_method_signature, objc_add_method_declaration, objc_start_method_definition, objc_add_instance_variable, objc_get_protocol_qualified_type, create_field_decl, start_var_decl, finish_var_decl): New functions. (setup_string_decl): Simplify since it is only called once. (synth_module_prologue): Call build_class_template(); predefine 'id' and 'Class' as typedefs; rename 'temp_type' to 'type'; disable debug hooks for duration of function; fix GNU runtime messenger signatures to correspond to reality; forward-declare '__objc_exec_class' for the GNU runtime; call build_selector_table_decl(); in ObjC++ mode, generate 'extern "C" { ... }' wrappers around synthesized declarations; call build_protocol_template() and build_category_template(). (string_hash, string_eq): New functions. (objc_build_string_object): Check metaclass correctness only once; store string literals in hash table. (objc_build_constructor): Do not convert initializer elements; adjust for ObjC++ impedance mismatch. (build_objc_symtab_template): Call create_field_decl() instead of create_builtin_decl(). (init_objc_symtab): Add missing conversion to initializer element. (build_metadata_decl): Call start_var_decl() instead of define_decl(). (generate_objc_symtab_decl): Do not call build_category_template(); call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(). (build_module_descriptor): Call create_field_decl() instead of grokfield(); call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(); always mark module descriptor as used; move GNU runtime-specific functionality to build_module_initializer_routine(). (build_module_initializer_routine): New function, broken off of build_module_descriptor(). (objc_static_init_needed_p, objc_generate_static_init_call): New functions. (generate_static_references, generate_strings, build_selector_translation_table, generate_descriptor_table, generate_ivars_list, generate_dispatch_table, generate_category): Call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(); build a type directly instead of via groktypename(). (build_selector_reference_decl, build_selector_table_decl, build_class_reference_decl, build_protocol_reference, generate_objc_image_info): Call start_var_decl() instead of build_decl(). (build_selector_reference): For GNU runtime, do not call build_selector_reference_decl(). (build_selector, build_typed_selector_reference): Always convert result to the selector type. (add_objc_string): Cast return value to 'char *'. (build_method_prototype_template, build_selector_template, build_method_template): Use actual selector type for fields pointing to selectors. (finish_objc): For GNU runtime, call build_module_initializer_routine() after build_module_descriptor(). (generate_protocol_list, generate_shared_structures): Call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(); build a type directly instead of via groktypename(). (synth_id_with_class_suffix): Return a string. (get_arg_type_list): For instance methods, use the instance type for 'self'; do not call groktypename_in_parm_context(). (build_objc_string_decl): Squash redeclaration errors in ObjC++. (objc_is_class_name): Use OBJC_TYPE_NAME instead of TYPE_NAME; handle RECORD_TYPEs in ObjC as well as ObjC++. (objc_is_id): New function. (objc_is_object_ptr): Return the canonical type node. (objc_get_class_ivars): Simplify using get_class_ivars(). (get_class_ivars): Remove second parameter; create a fresh copy of the ivar list for each call; do not check for existence of super class. (objc_eh_runtime_type): Mark #ifndef OBJCPLUS. (objc_init_exceptions): When using SJLJ-style exceptions, require the use of '-fobjc-exceptions' flag; do not require it for DWARF-style exceptions. (objc_build_exc_ptr, next_sjlj_build_try_catch_finally): Use objc_object_type instead of objc_id_type. (objc_begin_catch_clause): Convert the incoming PARM_DECL into a VAR_DECL before placing it in the appropriate scope; do not call define_decl(); adjust call to c_begin_compound_stmt(); use objc_object_type instead of objc_id_type. (build_next_objc_exception_stuff): Call create_field_decl() instead of create_builtin_decl(); construct type directly instead of calling groktypename(); use OBJC_VOID_AT_END to mark end of function parameters. (build_private_template): Adjust call to get_class_ivars(); build a type directly instead of via groktypename(). (build_protocol_template, build_method_prototype_list_template, build_method_prototype_template, build_category_template, build_selector_template, build_class_template, build_super_template, build_ivar_template, build_ivar_list_template, build_method_list_template, build_method_template): Call create_field_decl() instead of grokfield(). (objc_method_parm_type): Do not call groktypename(). (generate_descriptor_table): Call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(). (generate_method_descriptors, build_protocol_initializer, generate_dispatch_tables, build_category_initializer, build_shared_structure_initializer): Do not call groktypename(). (generate_protocols): Call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(); do not call groktypename(). (error_with_ivar): Remove last parameter. (check_ivars): Do not iterate ovar CLASS_RAW_IVARS lists in addition to CLASS_IVARS lists; adjust calls to error_with_ivar(). (generate_ivar_lists): Convert one of the initializer elements; do not call groktypename(). (get_arg_type_list, start_method_def, gen_method_def): Account for new representation of variable arguments and '...' in Objective-C methods; add Objective-C++ impedance matching code. (is_objc_type_qualifier): Remove function. (adjust_type_for_id_default): Simplify; there is no longer a need to wade through declspecs. (lookup_interface, start_class, continue_class, finish_class, start_method_def, start_protocol, build_method_decl, objc_add_method, add_instance_variable, build_ivar_reference, is_ivar, is_private, get_super_receiver, objc_build_finally_epilogue): Make into static functions. (receiver_is_class_object): Use new IS_CLASS() macro. (objc_build_message_expr): Tweak ObjC++ message argument handling; call objc_finish_message_expr() instead of finish_message_expr(). (finish_message_expr): Rename to objc_finish_message_expr(); use OBJC_TYPE_NAME and OBJC_SET_TYPE_NAME macros instead of TYPE_NAME. call gen_type_name() instead of gen_declaration(); call objc_is_id() instead of using IS_ID and IS_CLASS; Use objc_class_name instead of calling get_identifier("Class"); handle CONVERT_EXPRs in receiver. (build_objc_method_call, warn_with_method): Do not call groktypename(). (build_ivar_reference): Call convert() instead of clobbering in a type. (hash_init): Initialize string_htab hash table. (add_instance_variable): Simplify parameter list; do not call grokfield(); do not populate CLASS_IVARS list. (start_class): Check for the existence of super class, if one was specified. (continue_class): Use CLASS_RAW_IVARS rather than CLASS_IVARS; do not call build_class_template(); adjust call to get_class_ivars(); call build_decl(), pushdecl() and finish_decl() instead of define_decl(). (finish_class): Call build_decl(), pushdecl() and finish_decl() instead of define_decl(). (add_protocols): Use PROTOCOL_BINFO_ELTS for the tree vector size. (start_protocol): Do not call build_protocol_template(); use PROTOCOL_BINFO_ELTS for the tree vector size. (encode_type_qualifiers): Do not handle the 'const' qualifier here. (encode_pointer): Encode 'const char *' as 'r*', for backwards compatibility. (encode_array): Use HOST_WIDE_INT_PRINT_DEC instead of "%ld". (encode_type): Handle the 'const' qualifier here. (objc_parmlist): New global variable, sued by objc_push_parm and objc_get_parm_info(). (objc_push_parm, objc_get_parm_info): New functions. (objc_expr_last): Remove function. (synth_self_and_ucmd_args): For instance methods, use the instance type for 'self'; call objc_push_parm() instead of push_parm_decl(). (start_method_def): Do not call push_scope(), declare_parm_level(), pop_scope(), push_parm_decl(), store_parm_decls() or objc_expr_last(); just use objc_push_parm() and objc_get_parm_info(). (comp_method_with_proto): Remove function. (objc_types_are_equivalent): Strip away indirections before comparing underlying types. (comp_proto_with_proto): Do not call groktypename(); types are no longer in raw declspec format. (objc_start_function): New function. (really_start_method): Call comp_proto_with_proto() instead of comp_method_with_proto(); call objc_start_function() instead of hand-crafting a function declarator. (continue_method_def, objc_expand_function_end): Remove functions. (get_super_receiver): Call objc_get_current_scope() instead of get_current_scope(); reference 'super_class' field (instead of 'class'). (finish_method_def): Rename to objc_finish_method_definition() and add a function decl parameter; move method encoding call from objc_expand_function_end(). (is_complex_decl, adorn_decl, gen_declarator, gen_declspecs, gen_declaration_1): Remove functions. (tmpbuf, RAW_DECLSPEC): Remove. (gen_declaration): Remove second parameter; simplify to deal with TYPE_P nodes instead of raw declspecs. (gen_type_name, gen_type_name_0): New functions. (gen_method_decl): Remove second parameter; call gen_type_name() instead of gen_declaration_1(). (dump_interface): Adjust calls to gen_declaration() and gen_method_decl(); do not allocate a separate string buffer. (init_objc): Allocate a larger string buffer to accommodate dump_interface(); adjust call to build_module_descriptor(); add call to build_module_initializer_routine() for the GNU runtime. (generate_classref_translation_entry): Do not call start_decl(); call finish_var_decl() instead of finish_decl(); call convert() instead of build_c_cast(). * objc-act.h (CLASS_OWN_IVARS): Remove accessor. (CLASS_BINFO_ELTS): Reduce from 6 to 5, now that CLASS_OWN_IVARS is gone. (OCTI_GNU_INIT_DECL, GNU_INIT_decl): New. (OCTI_ELLIPSIS_NODE, objc_ellipsis_node): Remove. (OCTI_ID_ID, id_type, objc_id_id): Rename to OCTI_ID_NAME, objc_object_type and objc_object_name, respectively. (OCTI_CLS_REF, OCTI_CLASS_NAME, objc_class_reference, objc_class_name): New. (IS_CLASS): New macro. (IS_ID, IS_SUPER): Robustify. (OCTI_EXECCLASS_DECL, execclass_decl): New. (finish_file, start_class, continue_class, finish_class, start_method_def, continue_method_def, finish_method_def, start_protocol, finish_protocol, objc_build_throw_stmt, objc_build_try_catch_finally_stmt, objc_build_synchronized_prologue, objc_build_synchronized_epilogue, objc_build_try_prologue, objc_build_try_epilogue, objc_build_catch_stmt, objc_build_catch_epilogue, objc_build_finally_prologue, objc_build_finally_epilogue, is_ivar, is_private, is_public, add_instance_variable, objc_add_method, get_super_receiver, objc_clear_super_receiver, get_class_ivars_from_name, get_class_reference, get_static_reference, get_object_reference, build_message_expr, finish_message_expr, build_selector_expr, build_ivar_reference, build_keyword_decl, build_method_decl, build_protocol_expr, build_objc_string_object, objc_declare_alias, objc_declare_class, objc_declare_protocols, objc_comptypes, objc_check_decl, build_encode_expr): Remove prototypes. (imp_count, cat_count): Make GGC-aware. (OBJC_SET_TYPE_NAME): New macro. From-SVN: r87168
2004-09-08 02:49:44 +02:00
goto lack_of_ellipsis;
1992-01-18 00:15:38 +01:00
}
else
Makefile.in (c-parse.o): Depend on $(C_COMMON_H). [gcc/ChangeLog] 2004-09-07 Ziemowit Laski <zlaski@apple.com> * Makefile.in (c-parse.o): Depend on $(C_COMMON_H). * c-parse.in: Include c-common.h instead of objc-act.h. (ivar_decl_list, ivar_decls, ivar_decl, ivars, ivar_declarator, myparms, myparm): Remove %type declarations. (methodtype, optparms, OBJC_TYPE_QUAL, objc_quals, objc_qual, objc_typename, objc_try_catch_stmt, optellipsis): Add %type declarations. (objc_inherit_code, objc_public_flag): Remove. (typespec_nonreserved_nonattr): Call objc_get_protocol_qualified_type() instead of get_static_reference() and get_protocol_reference(). (stmt_nocomp): Call grokparm() on @catch parameter. (objcdef): Move semantic action to objc_finish_implementation(). (classdef): Move semantic action to objc_start_class_interface(), objc_continue_interface(), objc_finish_interface(), objc_start_class_implementation(), objc_continue_implementation(), objc_start_category_interface() and objc_start_category_implementation(). (protocoldef): Move semantic actions to objc_start_protocol() and objc_finish_interface(). (ivar_decl_list): Remove nonterminal. (visibility_spec): Move semantic actions to objc_set_visibility(). (ivar_decls): Remove assignment to $$. (ivar_decl): Rephrase in terms of component_decl; call objc_add_instance_variable(). (ivars, ivar_declarator): Remove nonterminals. (opt_semi): New nonterminal. (methodtype): Remove semantic actions. (methoddef): Move semantic actions to objc_set_method_type(), objc_start_method_definition() and objc_finish_method_definition(). (methodproto): Move semantic actions to objc_set_method_type() and objc_add_method_declaration(). (methoddecl): Use objc_typename instead of typename; move semantic actions to objc_build_method_signature(). (optarglist, myxdecls, mydecl, myparms, myparm): Remove nonterminals. (optparmlist): Express in terms of optparms and optellipsis. (optparms, optellipsis, objc_qual, objc_quals, objc_typename): New nonterminals. (keyworddecl): Use objc_typename instead of typename. (rid_to_yy): Mark RID_IN, RID_OUT, RID_INOUT, RID_BYCOPY, RID_BYREF and RID_ONEWAY as returning OBJC_TYPE_QUAL to yyparse(). [gcc/objc/ChangeLog] 2004-09-07 Ziemowit Laski <zlaski@apple.com> * Make-lang.in (objc/objc-parse.o): Depend on $(C_COMMON_H) instead of objc/objc-act.h. (objc/objc-act.o): Depend on $(HASHTAB_H). * objc-act.c: Include hashtab.h; in ObjC++ mode, include cp-tree.h and objcp-decl.h instead of c-tree.h. (build_module_descriptor, get_class_ivars, synth_id_with_class_suffix, error_with_ivar, gen_method_decl, gen_declaration, setup_string_decl, build_protocol_template): Adjust prototypes. (build_module_initializer_routine, start_class, continue_class, finish_class, start_method_def, objc_start_function, start_protocol, build_method_decl, objc_add_method, add_instance_variable, build_ivar_reference, is_ivar, is_private, get_super_receiver, build_selector_table_decl, objc_push_parm, objc_get_parm_info, gen_type_name, gen_type_name_0, start_var_decl, finish_var_decl, create_field_decl): New prototypes. (objc_expand_function_end, comp_method_with_proto, objc_expr_last, gen_declaration_1, gen_declarator, is_complex_decl, adorn_decl, define_decl, create_builtin_decl, gen_declspecs): Remove prototypes. (TYPE_ID): Rename to OBJECT_TYPEDEF_NAME. (CLASS_TYPEDEF_NAME): New. (TAG_EXECCLASS): Change from a global variable to a #define. (TAG_RETURN_STRUCT): Delete. (TAG_GNUINIT): New, holds '__objc_gnu_init' name. (objc_inherit_code, objc_public_flag): New, moved from c-parse.in. (string_descriptor): New struct. (string_htab): New hash table. (string_hash, string_eq): New prototypes. (generate_struct_by_value_array): Call create_field_decl() instead of create_builtin_decl(). (objc_init): Do not initialize objc_ellipsis_node or TAG_EXECCLASS; In ObjC++ mode, call cxx_init() instead of c_objc_common_init(). (objc_finish_file): In ObjC++, call instantiate_pending_templates() and cp_finish_file(). (define_decl, get_static_reference, get_protocol_reference, create_builtin_decl): Remove functions. (objc_start_class_interface, objc_start_category_interface, objc_start_protocol, objc_continue_interface, objc_finish_interface, objc_start_class_implementation, objc_start_category_implementation, objc_continue_implementation, objc_finish_implementation, objc_set_visibility, objc_set_method_type, objc_build_method_signature, objc_add_method_declaration, objc_start_method_definition, objc_add_instance_variable, objc_get_protocol_qualified_type, create_field_decl, start_var_decl, finish_var_decl): New functions. (setup_string_decl): Simplify since it is only called once. (synth_module_prologue): Call build_class_template(); predefine 'id' and 'Class' as typedefs; rename 'temp_type' to 'type'; disable debug hooks for duration of function; fix GNU runtime messenger signatures to correspond to reality; forward-declare '__objc_exec_class' for the GNU runtime; call build_selector_table_decl(); in ObjC++ mode, generate 'extern "C" { ... }' wrappers around synthesized declarations; call build_protocol_template() and build_category_template(). (string_hash, string_eq): New functions. (objc_build_string_object): Check metaclass correctness only once; store string literals in hash table. (objc_build_constructor): Do not convert initializer elements; adjust for ObjC++ impedance mismatch. (build_objc_symtab_template): Call create_field_decl() instead of create_builtin_decl(). (init_objc_symtab): Add missing conversion to initializer element. (build_metadata_decl): Call start_var_decl() instead of define_decl(). (generate_objc_symtab_decl): Do not call build_category_template(); call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(). (build_module_descriptor): Call create_field_decl() instead of grokfield(); call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(); always mark module descriptor as used; move GNU runtime-specific functionality to build_module_initializer_routine(). (build_module_initializer_routine): New function, broken off of build_module_descriptor(). (objc_static_init_needed_p, objc_generate_static_init_call): New functions. (generate_static_references, generate_strings, build_selector_translation_table, generate_descriptor_table, generate_ivars_list, generate_dispatch_table, generate_category): Call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(); build a type directly instead of via groktypename(). (build_selector_reference_decl, build_selector_table_decl, build_class_reference_decl, build_protocol_reference, generate_objc_image_info): Call start_var_decl() instead of build_decl(). (build_selector_reference): For GNU runtime, do not call build_selector_reference_decl(). (build_selector, build_typed_selector_reference): Always convert result to the selector type. (add_objc_string): Cast return value to 'char *'. (build_method_prototype_template, build_selector_template, build_method_template): Use actual selector type for fields pointing to selectors. (finish_objc): For GNU runtime, call build_module_initializer_routine() after build_module_descriptor(). (generate_protocol_list, generate_shared_structures): Call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(); build a type directly instead of via groktypename(). (synth_id_with_class_suffix): Return a string. (get_arg_type_list): For instance methods, use the instance type for 'self'; do not call groktypename_in_parm_context(). (build_objc_string_decl): Squash redeclaration errors in ObjC++. (objc_is_class_name): Use OBJC_TYPE_NAME instead of TYPE_NAME; handle RECORD_TYPEs in ObjC as well as ObjC++. (objc_is_id): New function. (objc_is_object_ptr): Return the canonical type node. (objc_get_class_ivars): Simplify using get_class_ivars(). (get_class_ivars): Remove second parameter; create a fresh copy of the ivar list for each call; do not check for existence of super class. (objc_eh_runtime_type): Mark #ifndef OBJCPLUS. (objc_init_exceptions): When using SJLJ-style exceptions, require the use of '-fobjc-exceptions' flag; do not require it for DWARF-style exceptions. (objc_build_exc_ptr, next_sjlj_build_try_catch_finally): Use objc_object_type instead of objc_id_type. (objc_begin_catch_clause): Convert the incoming PARM_DECL into a VAR_DECL before placing it in the appropriate scope; do not call define_decl(); adjust call to c_begin_compound_stmt(); use objc_object_type instead of objc_id_type. (build_next_objc_exception_stuff): Call create_field_decl() instead of create_builtin_decl(); construct type directly instead of calling groktypename(); use OBJC_VOID_AT_END to mark end of function parameters. (build_private_template): Adjust call to get_class_ivars(); build a type directly instead of via groktypename(). (build_protocol_template, build_method_prototype_list_template, build_method_prototype_template, build_category_template, build_selector_template, build_class_template, build_super_template, build_ivar_template, build_ivar_list_template, build_method_list_template, build_method_template): Call create_field_decl() instead of grokfield(). (objc_method_parm_type): Do not call groktypename(). (generate_descriptor_table): Call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(). (generate_method_descriptors, build_protocol_initializer, generate_dispatch_tables, build_category_initializer, build_shared_structure_initializer): Do not call groktypename(). (generate_protocols): Call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(); do not call groktypename(). (error_with_ivar): Remove last parameter. (check_ivars): Do not iterate ovar CLASS_RAW_IVARS lists in addition to CLASS_IVARS lists; adjust calls to error_with_ivar(). (generate_ivar_lists): Convert one of the initializer elements; do not call groktypename(). (get_arg_type_list, start_method_def, gen_method_def): Account for new representation of variable arguments and '...' in Objective-C methods; add Objective-C++ impedance matching code. (is_objc_type_qualifier): Remove function. (adjust_type_for_id_default): Simplify; there is no longer a need to wade through declspecs. (lookup_interface, start_class, continue_class, finish_class, start_method_def, start_protocol, build_method_decl, objc_add_method, add_instance_variable, build_ivar_reference, is_ivar, is_private, get_super_receiver, objc_build_finally_epilogue): Make into static functions. (receiver_is_class_object): Use new IS_CLASS() macro. (objc_build_message_expr): Tweak ObjC++ message argument handling; call objc_finish_message_expr() instead of finish_message_expr(). (finish_message_expr): Rename to objc_finish_message_expr(); use OBJC_TYPE_NAME and OBJC_SET_TYPE_NAME macros instead of TYPE_NAME. call gen_type_name() instead of gen_declaration(); call objc_is_id() instead of using IS_ID and IS_CLASS; Use objc_class_name instead of calling get_identifier("Class"); handle CONVERT_EXPRs in receiver. (build_objc_method_call, warn_with_method): Do not call groktypename(). (build_ivar_reference): Call convert() instead of clobbering in a type. (hash_init): Initialize string_htab hash table. (add_instance_variable): Simplify parameter list; do not call grokfield(); do not populate CLASS_IVARS list. (start_class): Check for the existence of super class, if one was specified. (continue_class): Use CLASS_RAW_IVARS rather than CLASS_IVARS; do not call build_class_template(); adjust call to get_class_ivars(); call build_decl(), pushdecl() and finish_decl() instead of define_decl(). (finish_class): Call build_decl(), pushdecl() and finish_decl() instead of define_decl(). (add_protocols): Use PROTOCOL_BINFO_ELTS for the tree vector size. (start_protocol): Do not call build_protocol_template(); use PROTOCOL_BINFO_ELTS for the tree vector size. (encode_type_qualifiers): Do not handle the 'const' qualifier here. (encode_pointer): Encode 'const char *' as 'r*', for backwards compatibility. (encode_array): Use HOST_WIDE_INT_PRINT_DEC instead of "%ld". (encode_type): Handle the 'const' qualifier here. (objc_parmlist): New global variable, sued by objc_push_parm and objc_get_parm_info(). (objc_push_parm, objc_get_parm_info): New functions. (objc_expr_last): Remove function. (synth_self_and_ucmd_args): For instance methods, use the instance type for 'self'; call objc_push_parm() instead of push_parm_decl(). (start_method_def): Do not call push_scope(), declare_parm_level(), pop_scope(), push_parm_decl(), store_parm_decls() or objc_expr_last(); just use objc_push_parm() and objc_get_parm_info(). (comp_method_with_proto): Remove function. (objc_types_are_equivalent): Strip away indirections before comparing underlying types. (comp_proto_with_proto): Do not call groktypename(); types are no longer in raw declspec format. (objc_start_function): New function. (really_start_method): Call comp_proto_with_proto() instead of comp_method_with_proto(); call objc_start_function() instead of hand-crafting a function declarator. (continue_method_def, objc_expand_function_end): Remove functions. (get_super_receiver): Call objc_get_current_scope() instead of get_current_scope(); reference 'super_class' field (instead of 'class'). (finish_method_def): Rename to objc_finish_method_definition() and add a function decl parameter; move method encoding call from objc_expand_function_end(). (is_complex_decl, adorn_decl, gen_declarator, gen_declspecs, gen_declaration_1): Remove functions. (tmpbuf, RAW_DECLSPEC): Remove. (gen_declaration): Remove second parameter; simplify to deal with TYPE_P nodes instead of raw declspecs. (gen_type_name, gen_type_name_0): New functions. (gen_method_decl): Remove second parameter; call gen_type_name() instead of gen_declaration_1(). (dump_interface): Adjust calls to gen_declaration() and gen_method_decl(); do not allocate a separate string buffer. (init_objc): Allocate a larger string buffer to accommodate dump_interface(); adjust call to build_module_descriptor(); add call to build_module_initializer_routine() for the GNU runtime. (generate_classref_translation_entry): Do not call start_decl(); call finish_var_decl() instead of finish_decl(); call convert() instead of build_c_cast(). * objc-act.h (CLASS_OWN_IVARS): Remove accessor. (CLASS_BINFO_ELTS): Reduce from 6 to 5, now that CLASS_OWN_IVARS is gone. (OCTI_GNU_INIT_DECL, GNU_INIT_decl): New. (OCTI_ELLIPSIS_NODE, objc_ellipsis_node): Remove. (OCTI_ID_ID, id_type, objc_id_id): Rename to OCTI_ID_NAME, objc_object_type and objc_object_name, respectively. (OCTI_CLS_REF, OCTI_CLASS_NAME, objc_class_reference, objc_class_name): New. (IS_CLASS): New macro. (IS_ID, IS_SUPER): Robustify. (OCTI_EXECCLASS_DECL, execclass_decl): New. (finish_file, start_class, continue_class, finish_class, start_method_def, continue_method_def, finish_method_def, start_protocol, finish_protocol, objc_build_throw_stmt, objc_build_try_catch_finally_stmt, objc_build_synchronized_prologue, objc_build_synchronized_epilogue, objc_build_try_prologue, objc_build_try_epilogue, objc_build_catch_stmt, objc_build_catch_epilogue, objc_build_finally_prologue, objc_build_finally_epilogue, is_ivar, is_private, is_public, add_instance_variable, objc_add_method, get_super_receiver, objc_clear_super_receiver, get_class_ivars_from_name, get_class_reference, get_static_reference, get_object_reference, build_message_expr, finish_message_expr, build_selector_expr, build_ivar_reference, build_keyword_decl, build_method_decl, build_protocol_expr, build_objc_string_object, objc_declare_alias, objc_declare_class, objc_declare_protocols, objc_comptypes, objc_check_decl, build_encode_expr): Remove prototypes. (imp_count, cat_count): Make GGC-aware. (OBJC_SET_TYPE_NAME): New macro. From-SVN: r87168
2004-09-08 02:49:44 +02:00
{
lack_of_ellipsis:
chainon (arglist, OBJC_VOID_AT_END);
}
1992-01-18 00:15:38 +01:00
return arglist;
}
static tree
check_duplicates (hash hsh, int methods, int is_class)
1992-01-18 00:15:38 +01:00
{
tree meth = NULL_TREE;
1992-01-18 00:15:38 +01:00
if (hsh)
{
meth = hsh->key;
if (hsh->list)
{
/* We have two or more methods with the same name but
different types. */
1992-01-18 00:15:38 +01:00
attr loop;
Yet more Objective-C++... * objc-act.c (objc_finish_try_stmt): Add return value. (objc_build_synchronized): Likewise. * objc-act.c (objc_is_gcable_type): Add. (objc_substitute_decl): Add. (objc_build_ivar_assignment): Add. (objc_build_global_assignment): Add. (objc_build_strong_cast_assignment): Add. (objc_is_ivar_reference_p): Add. (objc_is_global_reference_p): Add. (objc_generate_write_barrier): Add. (objc_rewrite_function_call): Add. (objc_gimplify_expr): Add Objective-C++ support. * objc-act.h (ALLOC_OBJC_TYPE_LANG_SPECIFIC): Likewise. (SIZEOF_OBJC_TYPE_LANG_SPECIFIC): Add. (INIT_TYPE_OBJC_INFO): Add Objective-C++ support. (DUP_TYPE_OBJC_INFO): Likewise. (struct imp_entry): Add field has_cxx_cdtors. (struct imp_entry *imp_list): Add OCTI_UMSG_FAST_DECL, OCTI_METH_LIST_TEMPL, OCTI_METH_PROTO_LIST_TEMPL, OCTI_IVAR_LIST_TEMPL, OCTI_ASSIGN_IVAR_DECL, OCTI_ASSIGN_IVAR_FAST_DECL, OCTI_ASSIGN_GLOBAL_DECL, OCTI_ASSIGN_STRONGCAST_DECL. (umsg_fast_decl): Add. (objc_assign_ivar_decl): Add. (objc_assign_ivar_fast_decl): Add. (objc_assign_global_decl): Add. (objc_assign_strong_cast_decl): Add. (objc_method_list_ptr): Add. (objc_method_proto_list_ptr): Add. (objc_ivar_list_ptr): Add. * objc-act.c (should_call_super_dealloc): Add. (OBJC_VERSION): Bump to 6. (objc_is_gcable_type): Add. (objc_substitute_decl): Add. (objc_build_ivar_assignment): Add. (objc_build_global_assignment): Add. (objc_build_strong_cast_assignment): Add. (objc_is_gcable_p): Add. (objc_is_ivar_reference_p): Add. (objc_is_global_reference_p): Add. (generate_shared_structures): Add flags parameter. (objc_generate_cxx_ctor_or_dtor): Add. (objc_generate_cxx_cdtors): Add. (add_class): Add name parameter. (objc_types_share_size_and_alignment): Add. (comp_proto_with_proto): Add strict parameter. (CLS_HAS_CXX_STRUCTORS): Add. (TAG_ASSIGNIVAR): Add. (TAG_ASSIGNGLOBAL): Add. (TAG_ASSIGNSTRONGCAST): Add. (TAG_MSGSEND_FAST): Add. (TAG_ASSIGNIVAR_FAST): Add. (TAG_CXX_CONSTRUCT): Add. (TAG_CXX_DESTRUCT): Add. (OBJC_LOOKUP_CLASS): Add. (OBJC_LOOKUP_NO_SUPER): Add. (objc_finish_file): Add pch support. (objc_finish_implementation): Add Objective-C++ support. (synth_module_prologue): Likewise. (synth_module_prologue): Add fast dispatching. (objc_get_class_reference): Add Objective-C++ support. (objc_generate_write_barrier): Likewise. (next_sjlj_build_enter_and_setjmp): Likewise. (objc_begin_try_stmt): Likewise. (build_next_objc_exception_stuff): Add fast ivar support. (build_private_template): Mark the record as used so debug information is generated. (build_protocol_template): Add Objective-C++ support. (objc_method_parm_type) Likewise. (objc_generate_cxx_ctor_or_dtor): Likewise. (objc_generate_cxx_cdtors): Likewise. (build_protocol_initializer): Likewise. (build_category_template): Likewise. (build_class_template): Likewise. (build_method_list_template): Likewise. (build_category_initializer): Likewise. (build_shared_structure_initializer): Likewise. (objc_finish_message_expr): Likewise. (build_objc_method_call): Add fast dispatch support. (lookup_method_static): Add support to end search at superclasses. (add_method_to_hash_list): Add strict parameter to comp_proto_with_proto. (objc_add_method): Likewise. (objc_add_method): Also set the interface_value. (add_instance_variable): Add Objective-C++ support. (objc_is_public): Likewise. (start_class): Likewise. (continue_class): Likewise. (encode_aggregate_within): Likewise. (start_method_def): Likewise. (objc_start_function): Clear current_function_returns_value and current_function_returns_null. (really_start_method): Add Objective-C++ support. (objc_finish_method_definition): Add warning for missing [super dealloc]. (finish_objc): Add Objective-C++ support. (generate_objc_image_info): Likewise. (objc_lookup_ivar): Likewise. * objc-act.h (TYPE_HAS_OBJC_INFO): Likewise. (INIT_TYPE_OBJC_INFO): Likewise. (DUP_TYPE_OBJC_INFO): Likewise. From-SVN: r99857
2005-05-17 22:07:08 +02:00
/* But just how different are those types? If
-Wno-strict-selector-match is specified, we shall not
complain if the differences are solely among types with
identical size and alignment. */
if (!warn_strict_selector_match)
{
for (loop = hsh->list; loop; loop = loop->next)
if (!comp_proto_with_proto (meth, loop->value, 0))
goto issue_warning;
return meth;
}
issue_warning:
diagnostic.c (warning): Accept parameter to classify warning option. * diagnostic.c (warning): Accept parameter to classify warning option. (warning0): New, for when a pointer to an error() like function is needed. * errors.c (warning): Likewise. * errors.h (warning, warning0): Adjust prototypes. * toplev.h (warning, warning0): Likewise. * attribs.c, builtins.c, c-common.c, c-decl.c, c-format.c, c-gimplify.c, c-lex.c, c-objc-common.c, c-opts.c, c-parser.c, c-pragma.c, c-typeck.c, calls.c, cgraph.c, coverage.c, emit-rtl.c, fold-const.c, fortran/trans-decl.c, function.c, gcse.c, genautomata.c, haifa-sched.c, opts.c, passes.c, regclass.c, reload1.c, stmt.c, stor-layout.c, toplev.c, tree-cfg.c, tree-dump.c, tree-inline.c, tree-mudflap.c, tree-optimize.c, tree-ssa.c, tree.c, varasm.c: Adjust warning() callers. * config/alpha/alpha.c, config/arc/arc.c, config/arm/arm.c, config/avr/avr.c, config/bfin/bfin.c, config/c4x/c4x-c.c, config/c4x/c4x.c, config/cris/cris.c, config/darwin-c.c, config/darwin.c, config/darwin.h, config/h8300/h8300.c, config/i386/cygming.h, config/i386/djgpp.h, config/i386/i386.c, config/i386/winnt.c, config/ia64/ia64-c.c, config/ia64/ia64.c, config/ip2k/ip2k.c, config/m32r/m32r.c, config/m68hc11/m68hc11.c, config/m68k/m68k.c, config/mcore/mcore.c, config/mips/mips.c, config/mmix/mmix.c, config/ns32k/ns32k.c, config/pa/pa-hpux11.h, config/pa/pa.c, config/rs6000/aix43.h, config/rs6000/aix51.h, config/rs6000/aix52.h, config/rs6000/darwin.h, config/rs6000/rs6000-c.c, config/rs6000/rs6000.c, config/s390/s390.c, config/sh/sh.c, config/sh/sh.h, config/sh/symbian.c, config/sol2-c.c, config/sol2.c, config/stormy16/stormy16.c, config/v850/v850-c.c, config/v850/v850.c, config/xtensa/xtensa.c: Adjust warning() callers. * ada/misc.c: Adjust warning() callers. * cp/call.c, cp/class.c, cp/cvt.c, cp/decl.c, cp/decl2.c, cp/except.c, cp/friend.c, cp/init.c, cp/lex.c, cp/mangle.c, cp/method.c, cp/name-lookup.c, cp/parser.c, cp/repo.c, cp/rtti.c, cp/tree.c, cp/typeck.c, cp/typeck2.c: Adjust warning() callers. * fortran/trans-decl.c: Adjust warning() callers. * java/class.c, java/decl.c, java/expr.c, java/jcf-io.c, java/jcf-parse.c, java/jv-scan.c, java/parse.y: Adjust warning() callers. * objc/objc-act.c: Adjust warning() callers. * treelang/parse.y: Adjust warning() callers. From-SVN: r98633
2005-04-23 23:29:07 +02:00
warning (0, "multiple %s named %<%c%s%> found",
methods ? "methods" : "selectors",
(is_class ? '+' : '-'),
1992-01-18 00:15:38 +01:00
IDENTIFIER_POINTER (METHOD_SEL_NAME (meth)));
warn_with_method (methods ? "using" : "found",
((TREE_CODE (meth) == INSTANCE_METHOD_DECL)
? '-'
: '+'),
meth);
1992-01-18 00:15:38 +01:00
for (loop = hsh->list; loop; loop = loop->next)
warn_with_method ("also found",
((TREE_CODE (loop->value) == INSTANCE_METHOD_DECL)
? '-'
: '+'),
loop->value);
1992-01-18 00:15:38 +01:00
}
}
return meth;
}
/* If RECEIVER is a class reference, return the identifier node for
c-parse.in (primary): Call objc_build_message_expr()... [gcc/ChangeLog] 2004-09-01 Ziemowit Laski <zlaski@apple.com> * c-parse.in (primary): Call objc_build_message_expr(), objc_build_selector_expr(), objc_build_protocol_expr(), objc_build_encode_expr() and objc_build_string_object() instead of build_message_expr(), build_selector_expr(), build_protocol_expr(), build_encode_expr() and build_objc_string_object(), respectively. (component_decl_list2): Call objc_get_class_ivars() instead of get_class_ivars_from_name(). (keyworddecl): Call objc_build_keyword_decl() instead of build_keyword_decl(). (receiver): Call objc_get_class_reference() instead of get_class_reference(). (reswords): Add blank line before @@ifobjc section, for clarity. [gcc/objc/ChangeLog] 2004-09-01 Ziemowit Laski <zlaski@apple.com> * objc-act.c (objc_check_decl): Use OBJC_TYPE_NAME macro instead of TYPE_NAME. (build_objc_string_object): Rename to objc_build_string_object(). (get_class_reference): Rename to objc_get_class_reference(). (get_class_ivars_from_name): Rename to objc_get_class_ivars(). (next_sjlj_build_catch_list, get_super_receiver): Call objc_get_class_reference() instead of get_class_reference(). (build_keyword_decl): Rename to objc_build_keyword_decl(). (build_message_expr): Rename to objc_build_message_expr(). (build_protocol_expr): Rename to objc_build_protocol_expr(). (build_selector_expr): Rename to objc_build_selector_expr(). (build_encode_expr): Rename to objc_build_encode_expr(). * objc-act.h (get_class_ivars_from_name): Rename prototype to objc_get_class_ivars(). (get_class_reference): Rename prototype to objc_get_class_reference(). (build_message_expr): Rename prototype to objc_build_message_expr(). (build_selector_expr): Rename prototype to objc_build_selector_expr(). (build_keyword_decl): Rename prototype to objc_build_keyword_decl(). (build_protocol_expr): Rename prototype to objc_build_prototype_expr(). (build_objc_string_object): Rename prototype to objc_build_string_object(). From-SVN: r86950
2004-09-02 02:36:18 +02:00
the referenced class. RECEIVER is created by objc_get_class_reference,
so we check the exact form created depending on which runtimes are
used. */
1992-01-18 00:15:38 +01:00
static tree
receiver_is_class_object (tree receiver, int self, int super)
1992-01-18 00:15:38 +01:00
{
tree chain, exp, arg;
/* The receiver is 'self' or 'super' in the context of a class method. */
if (objc_method_context
&& TREE_CODE (objc_method_context) == CLASS_METHOD_DECL
&& (self || super))
return (super
? CLASS_SUPER_NAME (implementation_template)
: CLASS_NAME (implementation_template));
if (flag_next_runtime)
1992-01-18 00:15:38 +01:00
{
/* The receiver is a variable created by
build_class_reference_decl. */
Makefile.in (c-parse.o): Depend on $(C_COMMON_H). [gcc/ChangeLog] 2004-09-07 Ziemowit Laski <zlaski@apple.com> * Makefile.in (c-parse.o): Depend on $(C_COMMON_H). * c-parse.in: Include c-common.h instead of objc-act.h. (ivar_decl_list, ivar_decls, ivar_decl, ivars, ivar_declarator, myparms, myparm): Remove %type declarations. (methodtype, optparms, OBJC_TYPE_QUAL, objc_quals, objc_qual, objc_typename, objc_try_catch_stmt, optellipsis): Add %type declarations. (objc_inherit_code, objc_public_flag): Remove. (typespec_nonreserved_nonattr): Call objc_get_protocol_qualified_type() instead of get_static_reference() and get_protocol_reference(). (stmt_nocomp): Call grokparm() on @catch parameter. (objcdef): Move semantic action to objc_finish_implementation(). (classdef): Move semantic action to objc_start_class_interface(), objc_continue_interface(), objc_finish_interface(), objc_start_class_implementation(), objc_continue_implementation(), objc_start_category_interface() and objc_start_category_implementation(). (protocoldef): Move semantic actions to objc_start_protocol() and objc_finish_interface(). (ivar_decl_list): Remove nonterminal. (visibility_spec): Move semantic actions to objc_set_visibility(). (ivar_decls): Remove assignment to $$. (ivar_decl): Rephrase in terms of component_decl; call objc_add_instance_variable(). (ivars, ivar_declarator): Remove nonterminals. (opt_semi): New nonterminal. (methodtype): Remove semantic actions. (methoddef): Move semantic actions to objc_set_method_type(), objc_start_method_definition() and objc_finish_method_definition(). (methodproto): Move semantic actions to objc_set_method_type() and objc_add_method_declaration(). (methoddecl): Use objc_typename instead of typename; move semantic actions to objc_build_method_signature(). (optarglist, myxdecls, mydecl, myparms, myparm): Remove nonterminals. (optparmlist): Express in terms of optparms and optellipsis. (optparms, optellipsis, objc_qual, objc_quals, objc_typename): New nonterminals. (keyworddecl): Use objc_typename instead of typename. (rid_to_yy): Mark RID_IN, RID_OUT, RID_INOUT, RID_BYCOPY, RID_BYREF and RID_ONEWAY as returning OBJC_TYPE_QUAL to yyparse(). [gcc/objc/ChangeLog] 2004-09-07 Ziemowit Laski <zlaski@apple.com> * Make-lang.in (objc/objc-parse.o): Depend on $(C_COMMON_H) instead of objc/objc-act.h. (objc/objc-act.o): Depend on $(HASHTAB_H). * objc-act.c: Include hashtab.h; in ObjC++ mode, include cp-tree.h and objcp-decl.h instead of c-tree.h. (build_module_descriptor, get_class_ivars, synth_id_with_class_suffix, error_with_ivar, gen_method_decl, gen_declaration, setup_string_decl, build_protocol_template): Adjust prototypes. (build_module_initializer_routine, start_class, continue_class, finish_class, start_method_def, objc_start_function, start_protocol, build_method_decl, objc_add_method, add_instance_variable, build_ivar_reference, is_ivar, is_private, get_super_receiver, build_selector_table_decl, objc_push_parm, objc_get_parm_info, gen_type_name, gen_type_name_0, start_var_decl, finish_var_decl, create_field_decl): New prototypes. (objc_expand_function_end, comp_method_with_proto, objc_expr_last, gen_declaration_1, gen_declarator, is_complex_decl, adorn_decl, define_decl, create_builtin_decl, gen_declspecs): Remove prototypes. (TYPE_ID): Rename to OBJECT_TYPEDEF_NAME. (CLASS_TYPEDEF_NAME): New. (TAG_EXECCLASS): Change from a global variable to a #define. (TAG_RETURN_STRUCT): Delete. (TAG_GNUINIT): New, holds '__objc_gnu_init' name. (objc_inherit_code, objc_public_flag): New, moved from c-parse.in. (string_descriptor): New struct. (string_htab): New hash table. (string_hash, string_eq): New prototypes. (generate_struct_by_value_array): Call create_field_decl() instead of create_builtin_decl(). (objc_init): Do not initialize objc_ellipsis_node or TAG_EXECCLASS; In ObjC++ mode, call cxx_init() instead of c_objc_common_init(). (objc_finish_file): In ObjC++, call instantiate_pending_templates() and cp_finish_file(). (define_decl, get_static_reference, get_protocol_reference, create_builtin_decl): Remove functions. (objc_start_class_interface, objc_start_category_interface, objc_start_protocol, objc_continue_interface, objc_finish_interface, objc_start_class_implementation, objc_start_category_implementation, objc_continue_implementation, objc_finish_implementation, objc_set_visibility, objc_set_method_type, objc_build_method_signature, objc_add_method_declaration, objc_start_method_definition, objc_add_instance_variable, objc_get_protocol_qualified_type, create_field_decl, start_var_decl, finish_var_decl): New functions. (setup_string_decl): Simplify since it is only called once. (synth_module_prologue): Call build_class_template(); predefine 'id' and 'Class' as typedefs; rename 'temp_type' to 'type'; disable debug hooks for duration of function; fix GNU runtime messenger signatures to correspond to reality; forward-declare '__objc_exec_class' for the GNU runtime; call build_selector_table_decl(); in ObjC++ mode, generate 'extern "C" { ... }' wrappers around synthesized declarations; call build_protocol_template() and build_category_template(). (string_hash, string_eq): New functions. (objc_build_string_object): Check metaclass correctness only once; store string literals in hash table. (objc_build_constructor): Do not convert initializer elements; adjust for ObjC++ impedance mismatch. (build_objc_symtab_template): Call create_field_decl() instead of create_builtin_decl(). (init_objc_symtab): Add missing conversion to initializer element. (build_metadata_decl): Call start_var_decl() instead of define_decl(). (generate_objc_symtab_decl): Do not call build_category_template(); call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(). (build_module_descriptor): Call create_field_decl() instead of grokfield(); call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(); always mark module descriptor as used; move GNU runtime-specific functionality to build_module_initializer_routine(). (build_module_initializer_routine): New function, broken off of build_module_descriptor(). (objc_static_init_needed_p, objc_generate_static_init_call): New functions. (generate_static_references, generate_strings, build_selector_translation_table, generate_descriptor_table, generate_ivars_list, generate_dispatch_table, generate_category): Call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(); build a type directly instead of via groktypename(). (build_selector_reference_decl, build_selector_table_decl, build_class_reference_decl, build_protocol_reference, generate_objc_image_info): Call start_var_decl() instead of build_decl(). (build_selector_reference): For GNU runtime, do not call build_selector_reference_decl(). (build_selector, build_typed_selector_reference): Always convert result to the selector type. (add_objc_string): Cast return value to 'char *'. (build_method_prototype_template, build_selector_template, build_method_template): Use actual selector type for fields pointing to selectors. (finish_objc): For GNU runtime, call build_module_initializer_routine() after build_module_descriptor(). (generate_protocol_list, generate_shared_structures): Call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(); build a type directly instead of via groktypename(). (synth_id_with_class_suffix): Return a string. (get_arg_type_list): For instance methods, use the instance type for 'self'; do not call groktypename_in_parm_context(). (build_objc_string_decl): Squash redeclaration errors in ObjC++. (objc_is_class_name): Use OBJC_TYPE_NAME instead of TYPE_NAME; handle RECORD_TYPEs in ObjC as well as ObjC++. (objc_is_id): New function. (objc_is_object_ptr): Return the canonical type node. (objc_get_class_ivars): Simplify using get_class_ivars(). (get_class_ivars): Remove second parameter; create a fresh copy of the ivar list for each call; do not check for existence of super class. (objc_eh_runtime_type): Mark #ifndef OBJCPLUS. (objc_init_exceptions): When using SJLJ-style exceptions, require the use of '-fobjc-exceptions' flag; do not require it for DWARF-style exceptions. (objc_build_exc_ptr, next_sjlj_build_try_catch_finally): Use objc_object_type instead of objc_id_type. (objc_begin_catch_clause): Convert the incoming PARM_DECL into a VAR_DECL before placing it in the appropriate scope; do not call define_decl(); adjust call to c_begin_compound_stmt(); use objc_object_type instead of objc_id_type. (build_next_objc_exception_stuff): Call create_field_decl() instead of create_builtin_decl(); construct type directly instead of calling groktypename(); use OBJC_VOID_AT_END to mark end of function parameters. (build_private_template): Adjust call to get_class_ivars(); build a type directly instead of via groktypename(). (build_protocol_template, build_method_prototype_list_template, build_method_prototype_template, build_category_template, build_selector_template, build_class_template, build_super_template, build_ivar_template, build_ivar_list_template, build_method_list_template, build_method_template): Call create_field_decl() instead of grokfield(). (objc_method_parm_type): Do not call groktypename(). (generate_descriptor_table): Call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(). (generate_method_descriptors, build_protocol_initializer, generate_dispatch_tables, build_category_initializer, build_shared_structure_initializer): Do not call groktypename(). (generate_protocols): Call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(); do not call groktypename(). (error_with_ivar): Remove last parameter. (check_ivars): Do not iterate ovar CLASS_RAW_IVARS lists in addition to CLASS_IVARS lists; adjust calls to error_with_ivar(). (generate_ivar_lists): Convert one of the initializer elements; do not call groktypename(). (get_arg_type_list, start_method_def, gen_method_def): Account for new representation of variable arguments and '...' in Objective-C methods; add Objective-C++ impedance matching code. (is_objc_type_qualifier): Remove function. (adjust_type_for_id_default): Simplify; there is no longer a need to wade through declspecs. (lookup_interface, start_class, continue_class, finish_class, start_method_def, start_protocol, build_method_decl, objc_add_method, add_instance_variable, build_ivar_reference, is_ivar, is_private, get_super_receiver, objc_build_finally_epilogue): Make into static functions. (receiver_is_class_object): Use new IS_CLASS() macro. (objc_build_message_expr): Tweak ObjC++ message argument handling; call objc_finish_message_expr() instead of finish_message_expr(). (finish_message_expr): Rename to objc_finish_message_expr(); use OBJC_TYPE_NAME and OBJC_SET_TYPE_NAME macros instead of TYPE_NAME. call gen_type_name() instead of gen_declaration(); call objc_is_id() instead of using IS_ID and IS_CLASS; Use objc_class_name instead of calling get_identifier("Class"); handle CONVERT_EXPRs in receiver. (build_objc_method_call, warn_with_method): Do not call groktypename(). (build_ivar_reference): Call convert() instead of clobbering in a type. (hash_init): Initialize string_htab hash table. (add_instance_variable): Simplify parameter list; do not call grokfield(); do not populate CLASS_IVARS list. (start_class): Check for the existence of super class, if one was specified. (continue_class): Use CLASS_RAW_IVARS rather than CLASS_IVARS; do not call build_class_template(); adjust call to get_class_ivars(); call build_decl(), pushdecl() and finish_decl() instead of define_decl(). (finish_class): Call build_decl(), pushdecl() and finish_decl() instead of define_decl(). (add_protocols): Use PROTOCOL_BINFO_ELTS for the tree vector size. (start_protocol): Do not call build_protocol_template(); use PROTOCOL_BINFO_ELTS for the tree vector size. (encode_type_qualifiers): Do not handle the 'const' qualifier here. (encode_pointer): Encode 'const char *' as 'r*', for backwards compatibility. (encode_array): Use HOST_WIDE_INT_PRINT_DEC instead of "%ld". (encode_type): Handle the 'const' qualifier here. (objc_parmlist): New global variable, sued by objc_push_parm and objc_get_parm_info(). (objc_push_parm, objc_get_parm_info): New functions. (objc_expr_last): Remove function. (synth_self_and_ucmd_args): For instance methods, use the instance type for 'self'; call objc_push_parm() instead of push_parm_decl(). (start_method_def): Do not call push_scope(), declare_parm_level(), pop_scope(), push_parm_decl(), store_parm_decls() or objc_expr_last(); just use objc_push_parm() and objc_get_parm_info(). (comp_method_with_proto): Remove function. (objc_types_are_equivalent): Strip away indirections before comparing underlying types. (comp_proto_with_proto): Do not call groktypename(); types are no longer in raw declspec format. (objc_start_function): New function. (really_start_method): Call comp_proto_with_proto() instead of comp_method_with_proto(); call objc_start_function() instead of hand-crafting a function declarator. (continue_method_def, objc_expand_function_end): Remove functions. (get_super_receiver): Call objc_get_current_scope() instead of get_current_scope(); reference 'super_class' field (instead of 'class'). (finish_method_def): Rename to objc_finish_method_definition() and add a function decl parameter; move method encoding call from objc_expand_function_end(). (is_complex_decl, adorn_decl, gen_declarator, gen_declspecs, gen_declaration_1): Remove functions. (tmpbuf, RAW_DECLSPEC): Remove. (gen_declaration): Remove second parameter; simplify to deal with TYPE_P nodes instead of raw declspecs. (gen_type_name, gen_type_name_0): New functions. (gen_method_decl): Remove second parameter; call gen_type_name() instead of gen_declaration_1(). (dump_interface): Adjust calls to gen_declaration() and gen_method_decl(); do not allocate a separate string buffer. (init_objc): Allocate a larger string buffer to accommodate dump_interface(); adjust call to build_module_descriptor(); add call to build_module_initializer_routine() for the GNU runtime. (generate_classref_translation_entry): Do not call start_decl(); call finish_var_decl() instead of finish_decl(); call convert() instead of build_c_cast(). * objc-act.h (CLASS_OWN_IVARS): Remove accessor. (CLASS_BINFO_ELTS): Reduce from 6 to 5, now that CLASS_OWN_IVARS is gone. (OCTI_GNU_INIT_DECL, GNU_INIT_decl): New. (OCTI_ELLIPSIS_NODE, objc_ellipsis_node): Remove. (OCTI_ID_ID, id_type, objc_id_id): Rename to OCTI_ID_NAME, objc_object_type and objc_object_name, respectively. (OCTI_CLS_REF, OCTI_CLASS_NAME, objc_class_reference, objc_class_name): New. (IS_CLASS): New macro. (IS_ID, IS_SUPER): Robustify. (OCTI_EXECCLASS_DECL, execclass_decl): New. (finish_file, start_class, continue_class, finish_class, start_method_def, continue_method_def, finish_method_def, start_protocol, finish_protocol, objc_build_throw_stmt, objc_build_try_catch_finally_stmt, objc_build_synchronized_prologue, objc_build_synchronized_epilogue, objc_build_try_prologue, objc_build_try_epilogue, objc_build_catch_stmt, objc_build_catch_epilogue, objc_build_finally_prologue, objc_build_finally_epilogue, is_ivar, is_private, is_public, add_instance_variable, objc_add_method, get_super_receiver, objc_clear_super_receiver, get_class_ivars_from_name, get_class_reference, get_static_reference, get_object_reference, build_message_expr, finish_message_expr, build_selector_expr, build_ivar_reference, build_keyword_decl, build_method_decl, build_protocol_expr, build_objc_string_object, objc_declare_alias, objc_declare_class, objc_declare_protocols, objc_comptypes, objc_check_decl, build_encode_expr): Remove prototypes. (imp_count, cat_count): Make GGC-aware. (OBJC_SET_TYPE_NAME): New macro. From-SVN: r87168
2004-09-08 02:49:44 +02:00
if (TREE_CODE (receiver) == VAR_DECL && IS_CLASS (TREE_TYPE (receiver)))
/* Look up the identifier. */
for (chain = cls_ref_chain; chain; chain = TREE_CHAIN (chain))
if (TREE_PURPOSE (chain) == receiver)
return TREE_VALUE (chain);
}
/* The receiver is a function call that returns an id. Check if
it is a call to objc_getClass, if so, pick up the class name. */
if (TREE_CODE (receiver) == CALL_EXPR
tree.h (enum tree_code_class): Add tcc_vl_exp. 2007-02-15 Sandra Loosemore <sandra@codesourcery.com> Brooks Moses <brooks.moses@codesourcery.com> Lee Millward <lee.millward@codesourcery.com> * tree.h (enum tree_code_class): Add tcc_vl_exp. (VL_EXP_CLASS_P): New. (TREE_OPERAND_CHECK): Use TREE_OPERAND_LENGTH instead of TREE_CODE_LENGTH. (TREE_OPERAND_CHECK_CODE): Likewise. (GIMPLE_STMT_OPERAND_CHECK): Likewise. (TREE_RTL_OPERAND_CHECK): Likewise. (tree_operand_check_failed): Make second parameter the whole tree instead of its code. Fixed callers. (VL_EXP_CHECK): New. (TREE_OPERAND_LENGTH): New. (VL_EXP_OPERAND_LENGTH): New. (CALL_EXPR_FN): New. (CALL_EXPR_STATIC_CHAIN): New. (CALL_EXPR_ARGS): New. (CALL_EXPR_ARG): New. (call_expr_nargs): New. (CALL_EXPR_ARGP): New. (build_nt_call_list): Declare. (build_vl_exp_stat): Declare. (build_vl_exp): New. (build_call_list): Declare. (build_call_nary): Declare. (build_call_valist): Declare. (build_call_array): Declare. (call_expr_arg): Declare. (call_expr_argp): Declare. (call_expr_arglist): Declare. (fold_build_call_list): Declare. (fold_build_call_list_initializer): Declare. (fold_call_expr): Declare to replace fold_builtin. (fold_builtin_fputs): Update to agree with modified definition. (fold_builtin_strcpy): Likewise. (fold_builtin_strncpy): Likewise. (fold_builtin_memory_chk): Likewise. (fold_builtin_stxcpy_chk): Likewise. (fold_builtin_strncpy_chk): Likewise. (fold_builtin_next_arg): Likewise. (fold_build_call_expr): Declare. (fold_builtin_call_list): Declare. (fold_builtin_call_valist): Declare. (build_call_expr): Declare. (validate_arglist): Update to agree with modified definition. (tree_operand_length): New. (call_expr_arg_iterator): New. (init_call_expr_arg_iterator): New. (next_call_expr_arg): New. (first_call_expr_arg): New. (more_call_expr_args_p): New. (FOR_EACH_CALL_EXPR_ARG): New. * tree.c (tree_code_class_string): Add entries for tcc_vl_exp and tcc_gimple_stmt. (tree_code_size): Update documentation. Use sizeof (tree) rather than sizeof (char *). (tree_size): Likewise. Add case for tcc_vl_exp. (tree_node_structure): Add case for tcc_vl_exp. (contains_placeholder_p): Likewise. (substitute_in_expr): Likewise. (substitute_placeholder_in_expr): Likewise. (stabilize_reference_1): Likewise. (build3_stat): Remove logic for CALL_EXPRs. Replace with assertion to diagnose breakage of this interface for constructing CALL_EXPRs. (build_nt): Add similar assertion here. (build_nt_call_list): New. (simple_cst_equal) <CALL_EXPR>: Rewrite to use new accessors. (iterative_hash_expr): Use TREE_OPERAND_LENGTH instead of TREE_CODE_LENGTH. (get_callee_fndecl): Use new CALL_EXPR accessors. (tree_operand_check_failed): Change parameters to pass entire node instead of its code, so that we can call TREE_OPERAND_LENGTH on it. (process_call_operands): New. (build_vl_exp_stat): New. (build_call_list): New. (build_call_nary): New. (build_call_valist): New. (build_call_array): New. (walk_tree): Use TREE_OPERAND_LENGTH instead of TREE_CODE_LENGTH. (call_expr_arglist): New. * tree.def (CALL_EXPR): Change representation of CALL_EXPRs to use tcc_vl_exp instead of a fixed-size tcc_expression. * doc/c-tree.texi (CALL_EXPR): Document new representation and accessors for CALL_EXPRs. (AGGR_INIT_EXPR): Likewise. 2007-02-15 Sandra Loosemore <sandra@codesourcery.com> Brooks Moses <brooks.moses@codesourcery.com> Lee Millward <lee.millward@codesourcery.com> * builtins.c (c_strlen): Return NULL_TREE instead of 0. (expand_builtin_nonlocal_goto): Change parameter to be entire CALL_EXPR instead of an arglist. Use new CALL_EXPR accessors. (expand_builtin_prefetch): Likewise. (expand_builtin_classify_type): Likewise. (mathfn_built_in): Return NULL_TREE instead of 0. (expand_errno_check): Use new CALL_EXPR accessors. (expand_builtin_mathfn): Use new CALL_EXPR accessors and constructors. Return NULL_RTX instead of 0. (expand_builtin_mathfn_2): Likewise. (expand_builtin_mathfn_3): Likewise. (expand_builtin_interclass_mathfn): Likewise. (expand_builtin_sincos): Likewise. (expand_builtin_cexpi): Likewise. (expand_builtin_int_roundingfn): Likewise. (expand_builtin_int_roundingfn_2): Likewise. (expand_builtin_pow): Likewise. (expand_builtin_powi): Likewise. (expand_builtin_strlen): Pass entire CALL_EXPR as parameter instead of arglist, fixing callers appropriately. Use new CALL_EXPR accessors and constructors. Return NULL_RTX instead of 0. (expand_builtin_strstr): Likewise. (expand_builtin_strchr): Likewise. (expand_builtin_strrchr): Likewise. (expand_builtin_strpbrk): Likewise. (expand_builtin_memcpy): Likewise. (expand_builtin_mempcpy): Likewise. (expand_builtin_mempcpy_args): New. (expand_builtin_memmove): Similarly to expand_builtin_mempcpy. (expand_builtin_memmove_args): New. (expand_builtin_bcopy): Similarly to expand_builtin_mempcpy. (expand_movstr): Likewise. (expand_builtin_strcpy): Likewise. (expand_builtin_strcpy_args): New. (expand_builtin_stpcpy): Similarly to expand_builtin_strcpy. (expand_builtin_strncpy): Likewise. (expand_builtin_memset): Likewise. (expand_builtin_memset_args): New. (expand_builtin_bzero): Similarly to expand_builtin_memset. (expand_builtin_memcmp): Likewise. (expand_builtin_strcmp): Likewise. (expand_builtin_strncmp): Likewise. (expand_builtin_strcat): Likewise. (expand_builtin_strncat): Likewise. (expand_builtin_strspn): Likewise. (expand_builtin_strcspn): Likewise. (expand_builtin_args_info): Likewise. (expand_builtin_va_start): Likewise. (gimplify_va_arg_expr): Likewise. (expand_builtin_va_end): Likewise. (expand_builtin_va_copy): Likewise. (expand_builtin_frame_address): Likewise. (expand_builtin_alloca): Likewise. (expand_builtin_bswap): Likewise. (expand_builtin_unop): Likewise. (expand_builtin_fputs): Likewise. (expand_builtin_expect): Likewise. (expand_builtin_fabs): Likewise. (expand_builtin_copysign): Likewise. (expand_builtin_printf): Likewise. (expand_builtin_fprintf): Likewise. (expand_builtin_sprintf): Likewise. (expand_builtin_init_trampoline): Likewise. (expand_builtin_signbit): Likewise. (expand_builtin_fork_or_exec): Likewise. (expand_builtin_sync_operation): Likewise. (expand_builtin_compare_and_swap): Likewise. (expand_builtin_lock_test_and_set): Likewise. (expand_builtin_lock_release): Likewise. (expand_builtin): Likewise. (builtin_mathfn_code): Likewise. (fold_builtin_constant_p): Pass call arguments individually instead of as an arglist, fixing callers appropriately. Use new CALL_EXPR accessors and constructors. Return NULL_TREE instead of 0. (fold_builtin_expect): Likewise. (fold_builtin_classify_type): Likewise. (fold_builtin_strlen): Likewise. (fold_builtin_nan): Likewise. (integer_valued_real_p): Likewise. (fold_trunc_transparent_mathfn): Likewise. (fold_fixed_mathfn): Likewise. (fold_builtin_cabs): Likewise. (fold_builtin_sqrt): Likewise. (fold_builtin_cbrt): Likewise. (fold_builtin_cos): Likewise. (fold_builtin_cosh): Likewise. (fold_builtin_tan): Likewise. (fold_builtin_sincos): Likewise. (fold_builtin_cexp): Likewise. (fold_builtin_trunc): Likewise. (fold_builtin_floor): Likewise. (fold_builtin_ceil): Likewise. (fold_builtin_round): Likewise. (fold_builtin_int_roundingfn): Likewise. (fold_builtin_bitop): Likewise. (fold_builtin_bswap): Likewise. (fold_builtin_logarithm): Likewise. (fold_builtin_hypot): Likewise. (fold_builtin_pow): Likewise. (fold_builtin_powi): Likewise. (fold_builtin_exponent): Likewise. (fold_builtin_memset): Likewise. (fold_builtin_bzero): Likewise. (fold_builtin_memory_op): Likewise. (fold_builtin_bcopy): Deleted; call site changed to invoke fold_builtin_memory_op directly. (fold_builtin_strcpy): Similarly as for fold_builtin_memory_op. (fold_builtin_strncpy): Likewise. (fold_builtin_memcmp): Likewise. (fold_builtin_strcmp): Likewise. (fold_builtin_strncmp): Likewise. (fold_builtin_signbit): Likewise. (fold_builtin_copysign): Likewise. (fold_builtin_isascii): Likewise. (fold_builtin_toascii): Likewise. (fold_builtin_isdigit): Likewise. (fold_builtin_fabs): Likewise. (fold_builtin_abs): Likewise. (fold_builtin_fmin_fmax): Likewise. (fold_builtin_carg): Likewise. (fold_builtin_classify): Likewise. (fold_builtin_unordered_cmp): Likewise. (fold_builtin_0, fold_builtin_2, fold_builtin_3, fold_builtin_4): New functions split out from fold_builtin_1. (fold_builtin_n): New. (fold_builtin_varargs): New. (fold_builtin): Deleted. Most callers changed to use fold_call_expr instead. (fold_call_expr): New. (build_function_call_expr): Rewrite to use new helper function. (fold_builtin_call_list): New. (build_call_expr): New. (fold_builtin_call_valist): New. (rewrite_call_expr): New. (validate_arg): New. (validate_arglist): Change parameter to be entire CALL_EXPR instead of an arglist. Change return type to bool. Use new CALL_EXPR accessors. (fold_builtin_strstr): Pass call arguments individually instead of as an arglist, fixing callers appropriately. Use new CALL_EXPR accessors and constructors. Return NULL_TREE instead of 0. (fold_builtin_strchr): Likewise. (fold_builtin_strrchr): Likewise. (fold_builtin_strpbrk): Likewise. (fold_builtin_strcat): Likewise. (fold_builtin_strncat): Likewise. (fold_builtin_strspn): Likewise. (fold_builtin_strcspn): Likewise. (fold_builtin_fputs): Likewise. (fold_builtin_next_arg): Likewise. (fold_builtin_sprintf): Likewise. (expand_builtin_object_size): Use new CALL_EXPR accessors. Use NULL_RTX instead of 0. (expand_builtin_memory_chk): Likewise. (maybe_emit_chk_warning): Likewise. (maybe_emit_sprintf_chk_warning): Likewise. (fold_builtin_object_size): Pass call arguments individually instead of as an arglist, fixing callers appropriately. Use new CALL_EXPR accessors and constructors. Return NULL_TREE instead of 0. (fold_builtin_memory_chk): Likewise. (fold_builtin_stxcpy_chk): Likewise. (fold_builtin_strncpy_chk): Likewise. (fold_builtin_strcat_chk): Likewise. (fold_builtin_strcat_chk): Likewise. (fold_builtin_strncat_chk): Likewise. (fold_builtin_sprintf_chk): Likewise. (fold_builtin_snprintf_chk): Likewise. (fold_builtin_printf): Likewise. (fold_builtin_vprintf): Likewise. * fold-const.c (negate_expr_p): Use new CALL_EXPR accessors and constructors. (operand_equal_p): Add separate tcc_vl_exp/CALL_EXPR case. (make_range): Use TREE_OPERAND_LENGTH instead of TREE_CODE_LENGTH. (extract_muldiv_1): Add VL_EXP_CLASS_P case. (fold_mathfn_compare): Use new CALL_EXPR accessors and constructors. (fold_unary): Likewise. (fold_binary): Likewise. (fold_ternary): Remove CALL_EXPR case, since they are no longer ternary expressions. (fold): Add logic for tcc_vl_exp. (fold_checksum_tree): Make it know about tcc_vl_exp. Use TREE_OPERAND_LENGTH instead of TREE_CODE_LENGTH. (fold_build3_stat): Add assertion to flag broken interface for constructing CALL_EXPRs. (fold_build_call_list): New. (fold_build_call_list_initializer): New. (tree_expr_nonnegative_p): Use new CALL_EXPR accessors and constructors. (fold_strip_sign_ops): Likewise. 2007-02-15 Sandra Loosemore <sandra@codesourcery.com> Brooks Moses <brooks.moses@codesourcery.com> Lee Millward <lee.millward@codesourcery.com> * tree-dump.c (dequeue_and_dump) <CALL_EXPR>: Use new CALL_EXPR accessors and dump arguments explicitly. * tree-pretty-print.c (do_niy): Use TREE_OPERAND_LENGTH instead of TREE_CODE_LENGTH. (dump_generic_node): Use new CALL_EXPR accessors and walk arguments explicitly. (print_call_name): Use new CALL_EXPR accessors. * print-tree.c (print_node): Add case tcc_vl_exp. Print CALL_EXPR arguments explicitly instead of as a list. Use TREE_OPERAND_LENGTH instead of TREE_CODE_LENGTH. * tree-vrp.c (stmt_interesting_for_vrp): Use new CALL_EXPR accessors. (vrp_visit_stmt): Likewise. * tree-ssa-loop-im.c (outermost_invariant_loop_expr): Make it know about tcc_vl_exp. Use TREE_OPERAND_LENGTH instead of TREE_CODE_LENGTH. (force_move_till_expr): Likewise. * targhooks.c (default_external_stack_protect_fail): Use build_call_expr instead of build_function_call_expr. (default_hidden_stack_protect_fail): Likewise. * tree-complex.c (expand_complex_libcall): Use build_call_expr to build the call. * cgraphbuild.c (build_cgraph_edges): Use new CALL_EXPR accessors and walk arguments explicitly. * tree-ssa-loop-niter.c (simplify_replace_tree): Use TREE_OPERAND_LENGTH instead of TREE_CODE_LENGTH. (expand_simple_operations): Likewise. (infer_loop_bounds_from_array): Use new CALL_EXPR accessors. * gengtype.c (adjust_field_tree_exp): Use TREE_OPERAND_LENGTH instead of TREE_CODE_LENGTH. (walk_type): Tweak walking of arrays not to blow up on CALL_EXPRs. * optabs.c (expand_widen_pattern-expr): Use TREE_OPERAND_LENGTH instead of TREE_CODE_LENGTH. * value_prof.c (tree_ic): Use new CALL_EXPR accessors. (tree_ic_transform): Likewise. (interesting_stringop_to_profile_p): Pass entire CALL_EXPR as parameter instead of arglist. Fix callers. (tree_stringop_fixed_value): Use new CALL_EXPR accessors. (tree_stringops_transform): Likewise. (tree_indirect_call_to_profile): Likewise. (tree_stringops_values_to_profile): Likewise. * tree-tailcall.c (find_tail_calls): Use new CALL_EXPR iterator. (eliminate_tail_call): Likewise. * ipa-cp.c (ipcp_update_callgraph): Use new CALL_EXPR accessors. * tree-scalar-evolution.c (chrec_contains_symbols_defined_in_loop): Use TREE_OPERAND_LENGTH and generalize to handle any number of operands. (instantiate_parameters_1): Can't handle tcc_vl_exp here. * omp-low.c (build_omp_barrier): Use build_call_expr. (lower_rec_input_clauses): Likewise. (lower_reduction_clauses): Likewise. (expand_parallel_call): Likewise. (maybe_catch_exception): Likewise. (expand_omp_for_generic): Likewise. (expand_omp_for_static_nochunk): Likewise. (expand_omp_sections): Likewise. (lower_omp_single_simple): Likewise. (lower_omp_single_copy): Likewise. (lower_omp_master): Likewise. (lower_omp_ordered): Likewise. (lower_omp_critical): Likewise. * ipa-reference.c (check-call): Use new CALL_EXPR iterator. (scan_for_static_refs): Create tcc_vl_exp case for CALL_EXPR. * tree-gimple.c (is_gimple_call_addr): Fix doc. (recalculate_side_effects): Use TREE_OPERAND_LENGTH instead of TREE_CODE_LENGTH. Add tcc_vl_exp case. * tree-chrec.c (chrec_contains_symbols): Use TREE_OPERAND_LENGTH and generalize to handle any number of operands. (chrec_contains_undetermined): Likewise. (tree_contains_chrecs): Likewise. (evolution_function_is_invariant_rec_p): Use TREE_OPERAND_LENGTH. * cgraphunit.c (update_call_expr): Use new CALL_EXPR accessors. * tree-ssa-ccp.c (ccp_fold): Use new CALL_EXPR accessors. Use fold_call_expr instead of fold_builtin. (ccp_fold_builtin): Likewise. Update calls into builtins.c to match declarations there. (fold_stmt): Use new CALL_EXPR constructor and accessors. Doc updates. * tree-ssa-loop-ivopts.c (expr_invariant_in_loop_p): Use TREE_OPERAND_LENGTH instead of TREE_CODE_LENGTH. * ipa-pure-const.c (check_call): Use new CALL_EXPR accessors. (scan_function): Add case tcc_vl_exp for CALL_EXPR. * tree-stdarg.c (execute_optimize_stdarg): Use new CALL_EXPR accessors. * tree-ssa-math-opts.c (execute_cse_sincos_1): Use build_call_expr. (execute_cse_sincos): Use new CALL_EXPR accessors. * tree-ssa-alias.c (find_used_portions): Use new CALL_EXPR iterator. * gimple-low.c (lower_function_body): Use build_call_expr. (lower_builtin_setjmp): Likewise. * expr.c (emit_block_move_via_libcall): Use build_call_expr. (set_storage_via_libcall): Likewise. (safe_from_p): Add tcc_vl_exp case. Use TREE_OPERAND_LENGTH instead of TREE_CODE_LENGTH. (expand_expr_real_1): Use new CALL_EXPR accessors. * tree-browser.c (store_child_info): Use TREE_OPERAND_LENGTH and generalize to handle any number of operands. (TB_parent_eq): Likewise. * predict.c (expr_expected_value): Use new CALL_EXPR accessors. (strip_builtin_expect): Likewise. * function.c (gimplify_parameters): Use build_call_expr. * tree-vectorizer.c (vect_is_simple_reduction): Use TREE_OPERAND_LENGTH instead of TREE_CODE_LENGTH. * ipa-type-escape.c (check_call): Use new CALL_EXPR iterators. (scan_for_refs): Add case tcc_vl_exp for CALL_EXPR. * tree-data-ref.c (get_references_in_stmt): Use new CALL_EXPR iterators. * gimplify.c (build_stack_save_restore): Use build_call_expr. (gimplify_decl_expr): Likewise. (gimplify_call_expr): Use fold_call_expr instead of fold_builtin. Use new CALL_EXPR iterators. (gimplify_modify_expr_to_memcpy): Use build_call_expr. (gimplify_modify_expr_to_memset): Likewise. (gimplify_variable_sized_compare): Likewise. (gimplify_omp_atomic_fetch_op): Likewise. (gimplify_omp_atomic_pipeline): Likewise. (gimplify_omp_atomic_mutex): Likewise. (gimplify_function_tree): Likewise. * calls.c (alloca_call_p): Use new CALL_EXPR accessors. (call_expr_flags): Likewise. (expand_call): Likewise. * except.c (expand_builtin_eh_return_data_regno): Pass entire CALL_EXPR as parameter instead of arglist. Use new CALL_EXPR accessors. * coverage.c (create_coverage): Use build_call_expr. * tree-ssa-pre.c (expression_node_pool, list_node_pool): Delete. (temp_call_expr_obstack): New. (pool_copy_list): Delete. (temp_copy_call_expr): New. (phi_translate): Add case tcc_vl_exp for CALL_EXPR. Use new CALL_EXPR accessors. Get rid of special goo for copying argument lists and use temp_copy_call_expr instead. (valid_in_sets): Add case tcc_vl_exp for CALL_EXPR. Use new CALL_EXPR accessors. (create_expression_by_pieces): Likewise. Use build_call_array to construct the result instead of fold_build3. (create_value_expr_from): Add tcc_vl_exp. Delete special goo for dealing with argument lists. (init_pre): Remove references to expression_node_pool and list_node_pool. Init temp_call_expr_obstack instead. (fini_pre): Remove references to expression_node_pool and list_node_pool. * tree-sra.c (sra_walk_call_expr): Use new CALL_EXPR accessors and walk arguments explicitly instead of as a list. * tree-mudflap.c (mf_build_check_statement_for): Use build_call_expr. (mx_register_decls): Likewise. (mudflap_register_call): Likewise. (mudflap_finish_file): Likewise. * ipa-prop.c (ipa_callsite_compute_count): Use new CALL_EXPR accessors. (ipa_callsite_compute_param): Likewise. * tree-vect-patterns.c (vect_recog_pow_pattern): Use new CALL_EXPR accessors and constructor. * tree-nested.c (convert_nl_goto_reference): Use new CALL_EXPR accessors and constructor. (convert_tramp_reference): Likewise. (convert_call_expr): Likewise. (finalize_nesting_tree_1): Likewise. * tree-ssa.c (tree_ssa_useless_type_conversion): Use new CALL_EXPR accessors. * tree-ssa-loop-prefetch.c (issue_prefetch_ref): Use build_call_expr. * tree-inline.c (initialize_inlined_parameters): Pass entire CALL_EXPR as parameter instead of arglist. Use new CALL_EXPR accessors. (estimate_num_insns_1): Use new CALL_EXPR accessors. (expand_call_inline): Tidy up call to initialize_inlined_parameters. * tree-vect-transform.c (vect_create_epilog_for_reduction): Use TREE_OPERAND_LENGTH instead of TREE_CODE_LENGTH. (vectorizable_reduction): Likewise. (vectorizable_call): Use new CALL_EXPR iterators. (vectorizable_conversion): Use build_call_expr. (vectorizable_operation): Use TREE_OPERAND_LENGTH. (vect_gen_widened_results_half): Use build_call_expr. (vect_setup_realignment): Likewise. (vectorizable_live_operation): Use TREE_OPERAND_LENGTH. * tree-object-size.c (alloc_object_size): Use new CALL_EXPR accessors. (pass_through_call): Likewise. (compute_object_sizes): Likewise. Use fold_call_expr instead of fold_builtin. * tree-profile.c (tree_gen_interval_profiler): Use build_call_expr. (tree_gen_pow2_profiler): Likewise. (tree_gen_one_value_profiler): Likewise. (tree_gen_ic_func_profiler): Likewise. (tree_gen_average_profiler): Likewise. (tree_gen_ior_profiler): Likewise. * tree-ssa-structalias.c (get_constraint_for): Add case tcc_vl_exp. (find_func_aliases): Use new CALL_EXPR accessors. Add case tcc_vl_exp. Use TREE_OPERAND_LENGTH instead of TREE_CODE_LENGTH. * tree-ssa-reassoc.c (get_rank): Use TREE_OPERAND_LENGTH instead of TREE_CODE_LENGTH. * stmt.c (warn_if_unused_value): Use TREE_OPERAND_LENGTH instead of TREE_CODE_LENGTH. * convert.c (convert_to_real): Use new CALL_EXPR accessors and constructor. (convert_to_integer): Likewise. * tree-ssa-operands.c (get_call_expr_operands): Use new CALL_EXPR accessors. 2007-02-15 Sandra Loosemore <sandra@codesourcery.com> Brooks Moses <brooks.moses@codesourcery.com> Lee Millward <lee.millward@codesourcery.com> * config/alpha/alpha.c (alpha_expand_builtin): Use new CALL_EXPR accessors. * config/frv/frv.c (frv_expand_builtin): Likewise. * config/s390/s390.c (s390_expand_builtin): Likewise. * config/sparc/sparc.c (sparc_gimplify_va_arg): Use build_call_expr. (sparc_expand_builtin): Use new CALL_EXPR accessors. * config/i386/i386.c (ix86_function_ok_for_sibcall): Likewise. (ix86_expand_binop_builtin): Pass entire CALL_EXPR as parameter instead of arglist. Use new CALL_EXPR accessors on it. Fix callers. (ix86_expand_store_builtin): Likewise. (ix86_expand_unop_builtin): Likewise. (ix86_expand_unop1_builtin): Likewise. (ix86_expand_sse_compare): Likewise. (ix86_expand_sse_comi): Likewise. (ix86_expand_vec_init_builtin): Likewise. (ix86_expand_vec_ext_builtin): Likewise. (ix86_expand_vec_set_builtin): Likewise. (ix86_expand_builtin): Use new CALL_EXPR accessors. * config/sh/sh.c (sh_expand_builtin): Use new CALL_EXPR accessors. * config/c4x/c4x.c (c4x_expand_builtin): Likewise. * config/iq2000/iq2000.c (expand_one_builtin): Pass entire CALL_EXPR instead of arglist. Use new CALL_EXPR accessors. Fix callers. (iq2000_expand_builtin): Use new CALL_EXPR accessors. * config/rs6000/rs6000-c.c (altivec_build_resolved_builtin): Use build_call_expr. * config/rs6000/rs6000.c (rs6000_gimplify_va_arg): Likewise. (rs6000_expand_unop_builtin): Pass entire CALL_EXPR instead of arglist. Use new CALL_EXPR accessors. Fix callers. (altivec_expand_abs_builtin): Likewise. (rs6000_expand_binop_builtin): Likewise. (altivec_expand_predicate_builtin): Likewise. (altivec_expand_lv_builtin): Likewise. (spe_expand_stv_builtin): Likewise. (altivec_expand_stv_builtin): Likewise. (rs6000_expand_ternop_builtin): Likewise. (altivec_expand_ld_builtin): Use new CALL_EXPR accessors. (altivec_expand_st_builtin): Likewise. (altivec_expand_dst_builtin): Likewise. (altivec_expand_vec_init_builtin): Pass entire CALL_EXPR instead of arglist. Use new CALL_EXPR accessors. Fix callers. (altivec_expand_vec_set_builtin): Likewise. (altivec_expand_vec_ext_builtin): Likewise. (altivec_expand_builtin): Use new CALL_EXPR accessors. (spe_expand_builtin): Likewise. (spe_expand_predicate_builtin): Pass entire CALL_EXPR instead of arglist. Use new CALL_EXPR accessors. Fix callers. (spe_expand_evsel_builtin): Likewise. (rs6000_expand_builtin): Use new CALL_EXPR accessors. VCFUX and FCFSX cases must construct whole new CALL_EXPR, not just arglist. * config/arm/arm.c (arm_expand_binop_builtin): Pass entire CALL_EXPR instead of arglist. Use new CALL_EXPR accessors. Fix callers. (arm_expand_unop_builtin): Likewise. (arm_expand_builtin): Use new CALL_EXPR accessors. * config/mips/mips.c (mips_expand_builtin): Use new CALL_EXPR accessors. * config/bfin/bfin.c (bfin_expand_binop_builtin): Pass entire CALL_EXPR instead of arglist. Use new CALL_EXPR accessors. Fix callers. (bfin_expand_unop_builtin): Likewise. (bfin_expand_builtin): Use new CALL_EXPR accessors. 2007-02-15 Sandra Loosemore <sandra@codesourcery.com> Brooks Moses <brooks.moses@codesourcery.com> Lee Millward <lee.millward@codesourcery.com> * c-semantics.c (build_stmt): Add internal diagnostic check. * c-pretty-print.c (pp_c_postfix_expression): Use new CALL_EXPR accessors. Print arguments explicitly instead of as a list. * c-typeck.c (build_function_call): Use new CALL_EXPR constructors. * c-omp.c (c_finish_omp_barrier): Use build_call_expr. (c_finish_omp_flish): Likewise. * c-common.c (verify_tree): Use new CALL_EXPR accessors. Traverse arguments explicitly instead of as a list. Use TREE_OPERAND_LENGTH instead of TREE_CODE_LENGTH. (check_function_arguments_recurse): Use new CALL_EXPR accessors. (c_warn_unused_result): Likewise. 2007-02-15 Sandra Loosemore <sandra@codesourcery.com> Brooks Moses <brooks.moses@codesourcery.com> Lee Millward <lee.millward@codesourcery.com> * cp-tree.def (AGGR_INIT_EXPR): Adjust documentation. Change class to tcc_vl_exp. * call.c (build_call): Use build_call_list instead of build3. (build_over_call): Likewise. (build_new_method_call): Use build_min_non_dep_call_list instead of build_min_non_dep. * error.c (dump_call_expr_args): New function. (dump_aggr_init_expr_args): New function. (dump_expr) <AGGR_INIT_EXPR, CALL_EXPR, INDIRECT_REF>: Use them. Update to use new CALL_EXPR and AGGR_INIT_EXPR accessor macros. * cvt.c (convert_to_void): Use build_call_array instead of build3; use new AGGR_INIT_EXPR accessor macros. * mangle.c (write_expression): Use TREE_OPERAND_LENGTH instead of TREE_CODE_LENGTH. * dump.c (cp_dump_tree) <AGGR_INIT_EXPR>: Update to use new AGGR_INIT_EXPR accessor macros. * cp-gimplify.c (cp_gimplify_init_expr): Use AGGR_INIT_EXPR_SLOT to set the slot operand. * cp-tree.h (AGGR_INIT_EXPR_FN): New macro. (AGGR_INIT_EXPR_SLOT): New macro. (AGGR_INIT_EXPR_ARG): New macro. (aggr_init_expr_nargs): New macro. (AGGR_INIT_EXPR_ARGP): New macro. (aggr_init_expr_arg_iterator): New. (init_aggr_init_expr_arg_iterator): New. (next_aggr_init_expr_arg): New. (first_aggr_init_expr_arg): New. (more_aggr_init_expr_args_p): New. (FOR_EACH_AGGR_INIT_EXPR_ARG): New. (stabilize_aggr_init): New declaration. (build_min_non_dep_call_list): Likewise. * tree.c (process_aggr_init_operands): New function. (build_aggr_init_array) New function. (build_cplus_new): Update to use new CALL_EXPR and AGGR_INIT_EXPR accessor macros. Replace use of build3 with build_aggr_init_array. (build_min_non_dep_call_list) New function. (build_min_nt): Assert input code parameter is not a variable length expression class. (build_min, build_min_non_dep): Likewise. (cp_tree_equal) <CALL_EXPR>: Iterate through the arguments to check for equality instead of recursing. Handle tcc_vl_exp tree code classes. (stabilize_call): Update to only handle CALL_EXPRs, not AGGR_INIT_EXPRs; use new CALL_EXPR accessor macros. (stabilize_aggr_init): New function. (stabilize_init): Use it. * cxx-pretty-print.c (pp_cxx_postfix_expression) <AGGR_INIT_EXPR, CALL_EXPR>: Update to use new CALL_EXPR and AGGR_INIT_EXPR accessor macros and argument iterators. * pt.c (tsubst_copy) <CALL_EXPR>: Replace build_nt with build_vl_exp. Iterate through the operands, recursively processing each one. (tsubst_copy_and_build) <CALL_EXPR>: Update to use new CALL_EXPR accessor macros. (value_dependent_expression_p) <default>: Handle tcc_vl_exp tree code classes. Use TREE_OPERAND_LENGTH instead of TREE_CODE_LENGTH. * semantics.c (finish_call_expr): Use build_nt_call_list instead of build_nt. (simplify_aggr_init_expr): Update to use new AGGR_INIT_EXPR accessor macros. Use build_call_array to construct the CALL_EXPR node instead of build3 * decl2.c (build_offset_ref_call_from_tree): Use build_nt_call_list and build_min_non_dep_call_list instead of build_min_nt and build_min_non_dep. * parser.c (cp_parser_postfix_expression) <CPP_OPEN_PAREN>: Use build_nt_call_list instead of build_min_nt. 2007-02-15 Sandra Loosemore <sandra@codesourcery.com> Brooks Moses <brooks.moses@codesourcery.com> Lee Millward <lee.millward@codesourcery.com> * java-tree.h (BUILD_MONITOR_ENTER): Use build_call_nary instead of build3. (BUILD_MONITOR_EXIT): Likewise. * java-gimplify.c (java_gimplify_component_ref): Use build_call_expr. (java_gimplify_modify_expr): Likewise. * class.c (cache_this_class_ref): Use build_call_expr. (build_static_field_ref): Likewise. (emit_indirect_register_classes): Likewise. (emit_register_classes): Likewise. * resource.c (write_resource_constructor): Use build_call_expr. * builtins.c (builtin_creator_function): Change interpretation of the second parameter to be the whole CALL_EXPR instead of the arglist. (max_builtin): Tweak parameter list. Use new CALL_EXPR accessors. (min_builtin): Likewise. (abs_builtin): Likewise. (java_build_function_call_expr): Likewise. (convert_real): Likewise. (UNMARSHAL3): Likewise. (UNMARSHAL4): Likewise. (UNMARSHAL5): Likewise. (build_arglist_for_builtin): Delete. Fix callers to use build_call_expr instead. (putObject_builtin): Tweak parameter list. Use new CALL_EXPR accessors. (compareAndSwapInt_builtin): Likewise. (compareAndSwapLong_builtin): Likewise. (compareAndSwapObject_builtin): Likewise. (putVolatile_builtin): Likewise. (getVolatile_builtin): Likewise. (VMSupportsCS8_builtin): Likewise. (check_for_builtin): Pass entire CALL_EXPR to builtin expander instead of arglist. * expr.c (build_java_athrow): Use build_call_nary instead of build3. (build_java_throw_out_of_bounds_exception): Likewise. (java_check_reference): Likewise. (build_java_arraystore_check): Likewise. (build_newarray): Likewise. (build_anewarray): Likewise. (expand_java_multinewarray): Use build_call_list instead of build3. (build_java_monitor): Use build_call_nary instead of build3. (java_create_object): Likewise. (expand_java_NEW): Likewise. (build_instanceof): Likewise. (expand_java_CHECKCAST): Likewise. (build_java_soft_divmod): Likewise. (build_java_binop): Likewise. (build_field_ref): Likewise. (build_class_init): Likewise. (rewrite_arglist_getcaller): Use build_call_expr. (build_invokeinterface): Use build_call_nary instead of build3. (expand_invoke): Use build_call_list instead of build3. (build_jni_stub): Use build_call_nary, build_call_list, or build_call_expr instead of build3. (expand_java_field_op): Use build_call_expr instead of build3. (force_evaluation_order): Use new CALL_EXPR accessors. * lang.c (java_get_callee_fndecl): Use new CALL_EXPR accessors. 2007-02-15 Sandra Loosemore <sandra@codesourcery.com> Brooks Moses <brooks.moses@codesourcery.com> Lee Millward <lee.millward@codesourcery.com> * objc-act.c (receiver_is_class_object): Use new CALL_EXPR accessors. (objc_get_callee_fndecl): Likewise. 2007-02-15 Sandra Loosemore <sandra@codesourcery.com> Brooks Moses <brooks.moses@codesourcery.com> Lee Millward <lee.millward@codesourcery.com> * trans-expr.c (gfc_conv_power_op): Use build_call_expr. (gfc_conv_string_tmp): Likewise. (gfc_conv_concat_op): Likewise. (gfc_build_compare_string): Likewise. (gfc_conv_function_call): Use build_call_list instead of build3. * trans-array.c (gfc_trans_allocate_array_storage): Use build_call_expr. (gfc_grow_array): Likewise. (gfc_trans_array_ctor_element): Likewise. (gfc_trans_array_constructor_value): Likewise. (gfc_array_allocate): Likewise. (gfc_array_deallocate): Likewise. (gfc_trans_auto_array_allocation): Likewise. (gfc_trans_dummy_array_bias): Likewise. (gfc_conv_array_parameter): Likewise. (gfc_trans_dealloc_allocated): Likewise. (gfc_duplicate_allocatable): Likewise. * trans-openmp.c (gfc_trans_omp_barrier): Use build_call_expr. (gfc_trans_omp_flush): Likewise. * trans-stmt.c (gfc_conv_elementel_dependencies): Use build_call_expr. (gfc_trans_pause): Likewise. (gfc_trans_stop): Likewise. (gfc_trans_character_select): Likewise. (gfc_do_allocate): Likewise. (gfc_trans_assign_need_temp): Likewise. (gfc_trans_pointer_assign_need_temp): Likewise. (gfc_trans_forall_1): Likewise. (gfc_trans_where_2): Likewise. (gfc_trans_allocate): Likewise. (gfc_trans_deallocate): Likewise. * trans.c (gfc_trans_runtime_check): Use build_call_expr. * trans-io.c (gfc_trans_open): Use build_call_expr. (gfc_trans_close): Likewise. (build_filepos): Likewise. (gfc_trans_inquire): Likewise. (NML_FIRST_ARG): Delete. (NML_ADD_ARG): Delete. (transfer_namelist_element): Use build_call_expr. (build_dt): Likewise. (gfc_trans_dt_end): Likewise. (transfer_expr): Likewise. (transfer_array-desc): Likewise. * trans-decl.c (gfc_generate_function_code): Use build_call_expr. (gfc_generate_constructors): Likewise. * trans-intrinsic.c (gfc_conv_intrinsic_ctime): Use build_call_expr. (gfc_conv_intrinsic_fdate): Likewise. (gfc_conv_intrinsic_ttynam): Likewise. (gfc_conv_intrinsic_array_transfer): Likewise. (gfc_conv_associated): Likewise. (gfc_conv_intrinsic_si_kind): Likewise. (gfc_conv_intrinsic_trim): Likewise. (gfc_conv_intrinsic_repeat: Likewise. (gfc_conv_intrinsic_iargc): Likewise. Co-Authored-By: Brooks Moses <brooks.moses@codesourcery.com> Co-Authored-By: Lee Millward <lee.millward@codesourcery.com> From-SVN: r122018
2007-02-16 00:50:49 +01:00
&& (exp = CALL_EXPR_FN (receiver))
&& TREE_CODE (exp) == ADDR_EXPR
&& (exp = TREE_OPERAND (exp, 0))
&& TREE_CODE (exp) == FUNCTION_DECL
/* For some reason, we sometimes wind up with multiple FUNCTION_DECL
prototypes for objc_get_class(). Thankfully, they seem to share the
same function type. */
&& TREE_TYPE (exp) == TREE_TYPE (objc_get_class_decl)
&& !strcmp (IDENTIFIER_POINTER (DECL_NAME (exp)), TAG_GETCLASS)
/* We have a call to objc_get_class/objc_getClass! */
tree.h (enum tree_code_class): Add tcc_vl_exp. 2007-02-15 Sandra Loosemore <sandra@codesourcery.com> Brooks Moses <brooks.moses@codesourcery.com> Lee Millward <lee.millward@codesourcery.com> * tree.h (enum tree_code_class): Add tcc_vl_exp. (VL_EXP_CLASS_P): New. (TREE_OPERAND_CHECK): Use TREE_OPERAND_LENGTH instead of TREE_CODE_LENGTH. (TREE_OPERAND_CHECK_CODE): Likewise. (GIMPLE_STMT_OPERAND_CHECK): Likewise. (TREE_RTL_OPERAND_CHECK): Likewise. (tree_operand_check_failed): Make second parameter the whole tree instead of its code. Fixed callers. (VL_EXP_CHECK): New. (TREE_OPERAND_LENGTH): New. (VL_EXP_OPERAND_LENGTH): New. (CALL_EXPR_FN): New. (CALL_EXPR_STATIC_CHAIN): New. (CALL_EXPR_ARGS): New. (CALL_EXPR_ARG): New. (call_expr_nargs): New. (CALL_EXPR_ARGP): New. (build_nt_call_list): Declare. (build_vl_exp_stat): Declare. (build_vl_exp): New. (build_call_list): Declare. (build_call_nary): Declare. (build_call_valist): Declare. (build_call_array): Declare. (call_expr_arg): Declare. (call_expr_argp): Declare. (call_expr_arglist): Declare. (fold_build_call_list): Declare. (fold_build_call_list_initializer): Declare. (fold_call_expr): Declare to replace fold_builtin. (fold_builtin_fputs): Update to agree with modified definition. (fold_builtin_strcpy): Likewise. (fold_builtin_strncpy): Likewise. (fold_builtin_memory_chk): Likewise. (fold_builtin_stxcpy_chk): Likewise. (fold_builtin_strncpy_chk): Likewise. (fold_builtin_next_arg): Likewise. (fold_build_call_expr): Declare. (fold_builtin_call_list): Declare. (fold_builtin_call_valist): Declare. (build_call_expr): Declare. (validate_arglist): Update to agree with modified definition. (tree_operand_length): New. (call_expr_arg_iterator): New. (init_call_expr_arg_iterator): New. (next_call_expr_arg): New. (first_call_expr_arg): New. (more_call_expr_args_p): New. (FOR_EACH_CALL_EXPR_ARG): New. * tree.c (tree_code_class_string): Add entries for tcc_vl_exp and tcc_gimple_stmt. (tree_code_size): Update documentation. Use sizeof (tree) rather than sizeof (char *). (tree_size): Likewise. Add case for tcc_vl_exp. (tree_node_structure): Add case for tcc_vl_exp. (contains_placeholder_p): Likewise. (substitute_in_expr): Likewise. (substitute_placeholder_in_expr): Likewise. (stabilize_reference_1): Likewise. (build3_stat): Remove logic for CALL_EXPRs. Replace with assertion to diagnose breakage of this interface for constructing CALL_EXPRs. (build_nt): Add similar assertion here. (build_nt_call_list): New. (simple_cst_equal) <CALL_EXPR>: Rewrite to use new accessors. (iterative_hash_expr): Use TREE_OPERAND_LENGTH instead of TREE_CODE_LENGTH. (get_callee_fndecl): Use new CALL_EXPR accessors. (tree_operand_check_failed): Change parameters to pass entire node instead of its code, so that we can call TREE_OPERAND_LENGTH on it. (process_call_operands): New. (build_vl_exp_stat): New. (build_call_list): New. (build_call_nary): New. (build_call_valist): New. (build_call_array): New. (walk_tree): Use TREE_OPERAND_LENGTH instead of TREE_CODE_LENGTH. (call_expr_arglist): New. * tree.def (CALL_EXPR): Change representation of CALL_EXPRs to use tcc_vl_exp instead of a fixed-size tcc_expression. * doc/c-tree.texi (CALL_EXPR): Document new representation and accessors for CALL_EXPRs. (AGGR_INIT_EXPR): Likewise. 2007-02-15 Sandra Loosemore <sandra@codesourcery.com> Brooks Moses <brooks.moses@codesourcery.com> Lee Millward <lee.millward@codesourcery.com> * builtins.c (c_strlen): Return NULL_TREE instead of 0. (expand_builtin_nonlocal_goto): Change parameter to be entire CALL_EXPR instead of an arglist. Use new CALL_EXPR accessors. (expand_builtin_prefetch): Likewise. (expand_builtin_classify_type): Likewise. (mathfn_built_in): Return NULL_TREE instead of 0. (expand_errno_check): Use new CALL_EXPR accessors. (expand_builtin_mathfn): Use new CALL_EXPR accessors and constructors. Return NULL_RTX instead of 0. (expand_builtin_mathfn_2): Likewise. (expand_builtin_mathfn_3): Likewise. (expand_builtin_interclass_mathfn): Likewise. (expand_builtin_sincos): Likewise. (expand_builtin_cexpi): Likewise. (expand_builtin_int_roundingfn): Likewise. (expand_builtin_int_roundingfn_2): Likewise. (expand_builtin_pow): Likewise. (expand_builtin_powi): Likewise. (expand_builtin_strlen): Pass entire CALL_EXPR as parameter instead of arglist, fixing callers appropriately. Use new CALL_EXPR accessors and constructors. Return NULL_RTX instead of 0. (expand_builtin_strstr): Likewise. (expand_builtin_strchr): Likewise. (expand_builtin_strrchr): Likewise. (expand_builtin_strpbrk): Likewise. (expand_builtin_memcpy): Likewise. (expand_builtin_mempcpy): Likewise. (expand_builtin_mempcpy_args): New. (expand_builtin_memmove): Similarly to expand_builtin_mempcpy. (expand_builtin_memmove_args): New. (expand_builtin_bcopy): Similarly to expand_builtin_mempcpy. (expand_movstr): Likewise. (expand_builtin_strcpy): Likewise. (expand_builtin_strcpy_args): New. (expand_builtin_stpcpy): Similarly to expand_builtin_strcpy. (expand_builtin_strncpy): Likewise. (expand_builtin_memset): Likewise. (expand_builtin_memset_args): New. (expand_builtin_bzero): Similarly to expand_builtin_memset. (expand_builtin_memcmp): Likewise. (expand_builtin_strcmp): Likewise. (expand_builtin_strncmp): Likewise. (expand_builtin_strcat): Likewise. (expand_builtin_strncat): Likewise. (expand_builtin_strspn): Likewise. (expand_builtin_strcspn): Likewise. (expand_builtin_args_info): Likewise. (expand_builtin_va_start): Likewise. (gimplify_va_arg_expr): Likewise. (expand_builtin_va_end): Likewise. (expand_builtin_va_copy): Likewise. (expand_builtin_frame_address): Likewise. (expand_builtin_alloca): Likewise. (expand_builtin_bswap): Likewise. (expand_builtin_unop): Likewise. (expand_builtin_fputs): Likewise. (expand_builtin_expect): Likewise. (expand_builtin_fabs): Likewise. (expand_builtin_copysign): Likewise. (expand_builtin_printf): Likewise. (expand_builtin_fprintf): Likewise. (expand_builtin_sprintf): Likewise. (expand_builtin_init_trampoline): Likewise. (expand_builtin_signbit): Likewise. (expand_builtin_fork_or_exec): Likewise. (expand_builtin_sync_operation): Likewise. (expand_builtin_compare_and_swap): Likewise. (expand_builtin_lock_test_and_set): Likewise. (expand_builtin_lock_release): Likewise. (expand_builtin): Likewise. (builtin_mathfn_code): Likewise. (fold_builtin_constant_p): Pass call arguments individually instead of as an arglist, fixing callers appropriately. Use new CALL_EXPR accessors and constructors. Return NULL_TREE instead of 0. (fold_builtin_expect): Likewise. (fold_builtin_classify_type): Likewise. (fold_builtin_strlen): Likewise. (fold_builtin_nan): Likewise. (integer_valued_real_p): Likewise. (fold_trunc_transparent_mathfn): Likewise. (fold_fixed_mathfn): Likewise. (fold_builtin_cabs): Likewise. (fold_builtin_sqrt): Likewise. (fold_builtin_cbrt): Likewise. (fold_builtin_cos): Likewise. (fold_builtin_cosh): Likewise. (fold_builtin_tan): Likewise. (fold_builtin_sincos): Likewise. (fold_builtin_cexp): Likewise. (fold_builtin_trunc): Likewise. (fold_builtin_floor): Likewise. (fold_builtin_ceil): Likewise. (fold_builtin_round): Likewise. (fold_builtin_int_roundingfn): Likewise. (fold_builtin_bitop): Likewise. (fold_builtin_bswap): Likewise. (fold_builtin_logarithm): Likewise. (fold_builtin_hypot): Likewise. (fold_builtin_pow): Likewise. (fold_builtin_powi): Likewise. (fold_builtin_exponent): Likewise. (fold_builtin_memset): Likewise. (fold_builtin_bzero): Likewise. (fold_builtin_memory_op): Likewise. (fold_builtin_bcopy): Deleted; call site changed to invoke fold_builtin_memory_op directly. (fold_builtin_strcpy): Similarly as for fold_builtin_memory_op. (fold_builtin_strncpy): Likewise. (fold_builtin_memcmp): Likewise. (fold_builtin_strcmp): Likewise. (fold_builtin_strncmp): Likewise. (fold_builtin_signbit): Likewise. (fold_builtin_copysign): Likewise. (fold_builtin_isascii): Likewise. (fold_builtin_toascii): Likewise. (fold_builtin_isdigit): Likewise. (fold_builtin_fabs): Likewise. (fold_builtin_abs): Likewise. (fold_builtin_fmin_fmax): Likewise. (fold_builtin_carg): Likewise. (fold_builtin_classify): Likewise. (fold_builtin_unordered_cmp): Likewise. (fold_builtin_0, fold_builtin_2, fold_builtin_3, fold_builtin_4): New functions split out from fold_builtin_1. (fold_builtin_n): New. (fold_builtin_varargs): New. (fold_builtin): Deleted. Most callers changed to use fold_call_expr instead. (fold_call_expr): New. (build_function_call_expr): Rewrite to use new helper function. (fold_builtin_call_list): New. (build_call_expr): New. (fold_builtin_call_valist): New. (rewrite_call_expr): New. (validate_arg): New. (validate_arglist): Change parameter to be entire CALL_EXPR instead of an arglist. Change return type to bool. Use new CALL_EXPR accessors. (fold_builtin_strstr): Pass call arguments individually instead of as an arglist, fixing callers appropriately. Use new CALL_EXPR accessors and constructors. Return NULL_TREE instead of 0. (fold_builtin_strchr): Likewise. (fold_builtin_strrchr): Likewise. (fold_builtin_strpbrk): Likewise. (fold_builtin_strcat): Likewise. (fold_builtin_strncat): Likewise. (fold_builtin_strspn): Likewise. (fold_builtin_strcspn): Likewise. (fold_builtin_fputs): Likewise. (fold_builtin_next_arg): Likewise. (fold_builtin_sprintf): Likewise. (expand_builtin_object_size): Use new CALL_EXPR accessors. Use NULL_RTX instead of 0. (expand_builtin_memory_chk): Likewise. (maybe_emit_chk_warning): Likewise. (maybe_emit_sprintf_chk_warning): Likewise. (fold_builtin_object_size): Pass call arguments individually instead of as an arglist, fixing callers appropriately. Use new CALL_EXPR accessors and constructors. Return NULL_TREE instead of 0. (fold_builtin_memory_chk): Likewise. (fold_builtin_stxcpy_chk): Likewise. (fold_builtin_strncpy_chk): Likewise. (fold_builtin_strcat_chk): Likewise. (fold_builtin_strcat_chk): Likewise. (fold_builtin_strncat_chk): Likewise. (fold_builtin_sprintf_chk): Likewise. (fold_builtin_snprintf_chk): Likewise. (fold_builtin_printf): Likewise. (fold_builtin_vprintf): Likewise. * fold-const.c (negate_expr_p): Use new CALL_EXPR accessors and constructors. (operand_equal_p): Add separate tcc_vl_exp/CALL_EXPR case. (make_range): Use TREE_OPERAND_LENGTH instead of TREE_CODE_LENGTH. (extract_muldiv_1): Add VL_EXP_CLASS_P case. (fold_mathfn_compare): Use new CALL_EXPR accessors and constructors. (fold_unary): Likewise. (fold_binary): Likewise. (fold_ternary): Remove CALL_EXPR case, since they are no longer ternary expressions. (fold): Add logic for tcc_vl_exp. (fold_checksum_tree): Make it know about tcc_vl_exp. Use TREE_OPERAND_LENGTH instead of TREE_CODE_LENGTH. (fold_build3_stat): Add assertion to flag broken interface for constructing CALL_EXPRs. (fold_build_call_list): New. (fold_build_call_list_initializer): New. (tree_expr_nonnegative_p): Use new CALL_EXPR accessors and constructors. (fold_strip_sign_ops): Likewise. 2007-02-15 Sandra Loosemore <sandra@codesourcery.com> Brooks Moses <brooks.moses@codesourcery.com> Lee Millward <lee.millward@codesourcery.com> * tree-dump.c (dequeue_and_dump) <CALL_EXPR>: Use new CALL_EXPR accessors and dump arguments explicitly. * tree-pretty-print.c (do_niy): Use TREE_OPERAND_LENGTH instead of TREE_CODE_LENGTH. (dump_generic_node): Use new CALL_EXPR accessors and walk arguments explicitly. (print_call_name): Use new CALL_EXPR accessors. * print-tree.c (print_node): Add case tcc_vl_exp. Print CALL_EXPR arguments explicitly instead of as a list. Use TREE_OPERAND_LENGTH instead of TREE_CODE_LENGTH. * tree-vrp.c (stmt_interesting_for_vrp): Use new CALL_EXPR accessors. (vrp_visit_stmt): Likewise. * tree-ssa-loop-im.c (outermost_invariant_loop_expr): Make it know about tcc_vl_exp. Use TREE_OPERAND_LENGTH instead of TREE_CODE_LENGTH. (force_move_till_expr): Likewise. * targhooks.c (default_external_stack_protect_fail): Use build_call_expr instead of build_function_call_expr. (default_hidden_stack_protect_fail): Likewise. * tree-complex.c (expand_complex_libcall): Use build_call_expr to build the call. * cgraphbuild.c (build_cgraph_edges): Use new CALL_EXPR accessors and walk arguments explicitly. * tree-ssa-loop-niter.c (simplify_replace_tree): Use TREE_OPERAND_LENGTH instead of TREE_CODE_LENGTH. (expand_simple_operations): Likewise. (infer_loop_bounds_from_array): Use new CALL_EXPR accessors. * gengtype.c (adjust_field_tree_exp): Use TREE_OPERAND_LENGTH instead of TREE_CODE_LENGTH. (walk_type): Tweak walking of arrays not to blow up on CALL_EXPRs. * optabs.c (expand_widen_pattern-expr): Use TREE_OPERAND_LENGTH instead of TREE_CODE_LENGTH. * value_prof.c (tree_ic): Use new CALL_EXPR accessors. (tree_ic_transform): Likewise. (interesting_stringop_to_profile_p): Pass entire CALL_EXPR as parameter instead of arglist. Fix callers. (tree_stringop_fixed_value): Use new CALL_EXPR accessors. (tree_stringops_transform): Likewise. (tree_indirect_call_to_profile): Likewise. (tree_stringops_values_to_profile): Likewise. * tree-tailcall.c (find_tail_calls): Use new CALL_EXPR iterator. (eliminate_tail_call): Likewise. * ipa-cp.c (ipcp_update_callgraph): Use new CALL_EXPR accessors. * tree-scalar-evolution.c (chrec_contains_symbols_defined_in_loop): Use TREE_OPERAND_LENGTH and generalize to handle any number of operands. (instantiate_parameters_1): Can't handle tcc_vl_exp here. * omp-low.c (build_omp_barrier): Use build_call_expr. (lower_rec_input_clauses): Likewise. (lower_reduction_clauses): Likewise. (expand_parallel_call): Likewise. (maybe_catch_exception): Likewise. (expand_omp_for_generic): Likewise. (expand_omp_for_static_nochunk): Likewise. (expand_omp_sections): Likewise. (lower_omp_single_simple): Likewise. (lower_omp_single_copy): Likewise. (lower_omp_master): Likewise. (lower_omp_ordered): Likewise. (lower_omp_critical): Likewise. * ipa-reference.c (check-call): Use new CALL_EXPR iterator. (scan_for_static_refs): Create tcc_vl_exp case for CALL_EXPR. * tree-gimple.c (is_gimple_call_addr): Fix doc. (recalculate_side_effects): Use TREE_OPERAND_LENGTH instead of TREE_CODE_LENGTH. Add tcc_vl_exp case. * tree-chrec.c (chrec_contains_symbols): Use TREE_OPERAND_LENGTH and generalize to handle any number of operands. (chrec_contains_undetermined): Likewise. (tree_contains_chrecs): Likewise. (evolution_function_is_invariant_rec_p): Use TREE_OPERAND_LENGTH. * cgraphunit.c (update_call_expr): Use new CALL_EXPR accessors. * tree-ssa-ccp.c (ccp_fold): Use new CALL_EXPR accessors. Use fold_call_expr instead of fold_builtin. (ccp_fold_builtin): Likewise. Update calls into builtins.c to match declarations there. (fold_stmt): Use new CALL_EXPR constructor and accessors. Doc updates. * tree-ssa-loop-ivopts.c (expr_invariant_in_loop_p): Use TREE_OPERAND_LENGTH instead of TREE_CODE_LENGTH. * ipa-pure-const.c (check_call): Use new CALL_EXPR accessors. (scan_function): Add case tcc_vl_exp for CALL_EXPR. * tree-stdarg.c (execute_optimize_stdarg): Use new CALL_EXPR accessors. * tree-ssa-math-opts.c (execute_cse_sincos_1): Use build_call_expr. (execute_cse_sincos): Use new CALL_EXPR accessors. * tree-ssa-alias.c (find_used_portions): Use new CALL_EXPR iterator. * gimple-low.c (lower_function_body): Use build_call_expr. (lower_builtin_setjmp): Likewise. * expr.c (emit_block_move_via_libcall): Use build_call_expr. (set_storage_via_libcall): Likewise. (safe_from_p): Add tcc_vl_exp case. Use TREE_OPERAND_LENGTH instead of TREE_CODE_LENGTH. (expand_expr_real_1): Use new CALL_EXPR accessors. * tree-browser.c (store_child_info): Use TREE_OPERAND_LENGTH and generalize to handle any number of operands. (TB_parent_eq): Likewise. * predict.c (expr_expected_value): Use new CALL_EXPR accessors. (strip_builtin_expect): Likewise. * function.c (gimplify_parameters): Use build_call_expr. * tree-vectorizer.c (vect_is_simple_reduction): Use TREE_OPERAND_LENGTH instead of TREE_CODE_LENGTH. * ipa-type-escape.c (check_call): Use new CALL_EXPR iterators. (scan_for_refs): Add case tcc_vl_exp for CALL_EXPR. * tree-data-ref.c (get_references_in_stmt): Use new CALL_EXPR iterators. * gimplify.c (build_stack_save_restore): Use build_call_expr. (gimplify_decl_expr): Likewise. (gimplify_call_expr): Use fold_call_expr instead of fold_builtin. Use new CALL_EXPR iterators. (gimplify_modify_expr_to_memcpy): Use build_call_expr. (gimplify_modify_expr_to_memset): Likewise. (gimplify_variable_sized_compare): Likewise. (gimplify_omp_atomic_fetch_op): Likewise. (gimplify_omp_atomic_pipeline): Likewise. (gimplify_omp_atomic_mutex): Likewise. (gimplify_function_tree): Likewise. * calls.c (alloca_call_p): Use new CALL_EXPR accessors. (call_expr_flags): Likewise. (expand_call): Likewise. * except.c (expand_builtin_eh_return_data_regno): Pass entire CALL_EXPR as parameter instead of arglist. Use new CALL_EXPR accessors. * coverage.c (create_coverage): Use build_call_expr. * tree-ssa-pre.c (expression_node_pool, list_node_pool): Delete. (temp_call_expr_obstack): New. (pool_copy_list): Delete. (temp_copy_call_expr): New. (phi_translate): Add case tcc_vl_exp for CALL_EXPR. Use new CALL_EXPR accessors. Get rid of special goo for copying argument lists and use temp_copy_call_expr instead. (valid_in_sets): Add case tcc_vl_exp for CALL_EXPR. Use new CALL_EXPR accessors. (create_expression_by_pieces): Likewise. Use build_call_array to construct the result instead of fold_build3. (create_value_expr_from): Add tcc_vl_exp. Delete special goo for dealing with argument lists. (init_pre): Remove references to expression_node_pool and list_node_pool. Init temp_call_expr_obstack instead. (fini_pre): Remove references to expression_node_pool and list_node_pool. * tree-sra.c (sra_walk_call_expr): Use new CALL_EXPR accessors and walk arguments explicitly instead of as a list. * tree-mudflap.c (mf_build_check_statement_for): Use build_call_expr. (mx_register_decls): Likewise. (mudflap_register_call): Likewise. (mudflap_finish_file): Likewise. * ipa-prop.c (ipa_callsite_compute_count): Use new CALL_EXPR accessors. (ipa_callsite_compute_param): Likewise. * tree-vect-patterns.c (vect_recog_pow_pattern): Use new CALL_EXPR accessors and constructor. * tree-nested.c (convert_nl_goto_reference): Use new CALL_EXPR accessors and constructor. (convert_tramp_reference): Likewise. (convert_call_expr): Likewise. (finalize_nesting_tree_1): Likewise. * tree-ssa.c (tree_ssa_useless_type_conversion): Use new CALL_EXPR accessors. * tree-ssa-loop-prefetch.c (issue_prefetch_ref): Use build_call_expr. * tree-inline.c (initialize_inlined_parameters): Pass entire CALL_EXPR as parameter instead of arglist. Use new CALL_EXPR accessors. (estimate_num_insns_1): Use new CALL_EXPR accessors. (expand_call_inline): Tidy up call to initialize_inlined_parameters. * tree-vect-transform.c (vect_create_epilog_for_reduction): Use TREE_OPERAND_LENGTH instead of TREE_CODE_LENGTH. (vectorizable_reduction): Likewise. (vectorizable_call): Use new CALL_EXPR iterators. (vectorizable_conversion): Use build_call_expr. (vectorizable_operation): Use TREE_OPERAND_LENGTH. (vect_gen_widened_results_half): Use build_call_expr. (vect_setup_realignment): Likewise. (vectorizable_live_operation): Use TREE_OPERAND_LENGTH. * tree-object-size.c (alloc_object_size): Use new CALL_EXPR accessors. (pass_through_call): Likewise. (compute_object_sizes): Likewise. Use fold_call_expr instead of fold_builtin. * tree-profile.c (tree_gen_interval_profiler): Use build_call_expr. (tree_gen_pow2_profiler): Likewise. (tree_gen_one_value_profiler): Likewise. (tree_gen_ic_func_profiler): Likewise. (tree_gen_average_profiler): Likewise. (tree_gen_ior_profiler): Likewise. * tree-ssa-structalias.c (get_constraint_for): Add case tcc_vl_exp. (find_func_aliases): Use new CALL_EXPR accessors. Add case tcc_vl_exp. Use TREE_OPERAND_LENGTH instead of TREE_CODE_LENGTH. * tree-ssa-reassoc.c (get_rank): Use TREE_OPERAND_LENGTH instead of TREE_CODE_LENGTH. * stmt.c (warn_if_unused_value): Use TREE_OPERAND_LENGTH instead of TREE_CODE_LENGTH. * convert.c (convert_to_real): Use new CALL_EXPR accessors and constructor. (convert_to_integer): Likewise. * tree-ssa-operands.c (get_call_expr_operands): Use new CALL_EXPR accessors. 2007-02-15 Sandra Loosemore <sandra@codesourcery.com> Brooks Moses <brooks.moses@codesourcery.com> Lee Millward <lee.millward@codesourcery.com> * config/alpha/alpha.c (alpha_expand_builtin): Use new CALL_EXPR accessors. * config/frv/frv.c (frv_expand_builtin): Likewise. * config/s390/s390.c (s390_expand_builtin): Likewise. * config/sparc/sparc.c (sparc_gimplify_va_arg): Use build_call_expr. (sparc_expand_builtin): Use new CALL_EXPR accessors. * config/i386/i386.c (ix86_function_ok_for_sibcall): Likewise. (ix86_expand_binop_builtin): Pass entire CALL_EXPR as parameter instead of arglist. Use new CALL_EXPR accessors on it. Fix callers. (ix86_expand_store_builtin): Likewise. (ix86_expand_unop_builtin): Likewise. (ix86_expand_unop1_builtin): Likewise. (ix86_expand_sse_compare): Likewise. (ix86_expand_sse_comi): Likewise. (ix86_expand_vec_init_builtin): Likewise. (ix86_expand_vec_ext_builtin): Likewise. (ix86_expand_vec_set_builtin): Likewise. (ix86_expand_builtin): Use new CALL_EXPR accessors. * config/sh/sh.c (sh_expand_builtin): Use new CALL_EXPR accessors. * config/c4x/c4x.c (c4x_expand_builtin): Likewise. * config/iq2000/iq2000.c (expand_one_builtin): Pass entire CALL_EXPR instead of arglist. Use new CALL_EXPR accessors. Fix callers. (iq2000_expand_builtin): Use new CALL_EXPR accessors. * config/rs6000/rs6000-c.c (altivec_build_resolved_builtin): Use build_call_expr. * config/rs6000/rs6000.c (rs6000_gimplify_va_arg): Likewise. (rs6000_expand_unop_builtin): Pass entire CALL_EXPR instead of arglist. Use new CALL_EXPR accessors. Fix callers. (altivec_expand_abs_builtin): Likewise. (rs6000_expand_binop_builtin): Likewise. (altivec_expand_predicate_builtin): Likewise. (altivec_expand_lv_builtin): Likewise. (spe_expand_stv_builtin): Likewise. (altivec_expand_stv_builtin): Likewise. (rs6000_expand_ternop_builtin): Likewise. (altivec_expand_ld_builtin): Use new CALL_EXPR accessors. (altivec_expand_st_builtin): Likewise. (altivec_expand_dst_builtin): Likewise. (altivec_expand_vec_init_builtin): Pass entire CALL_EXPR instead of arglist. Use new CALL_EXPR accessors. Fix callers. (altivec_expand_vec_set_builtin): Likewise. (altivec_expand_vec_ext_builtin): Likewise. (altivec_expand_builtin): Use new CALL_EXPR accessors. (spe_expand_builtin): Likewise. (spe_expand_predicate_builtin): Pass entire CALL_EXPR instead of arglist. Use new CALL_EXPR accessors. Fix callers. (spe_expand_evsel_builtin): Likewise. (rs6000_expand_builtin): Use new CALL_EXPR accessors. VCFUX and FCFSX cases must construct whole new CALL_EXPR, not just arglist. * config/arm/arm.c (arm_expand_binop_builtin): Pass entire CALL_EXPR instead of arglist. Use new CALL_EXPR accessors. Fix callers. (arm_expand_unop_builtin): Likewise. (arm_expand_builtin): Use new CALL_EXPR accessors. * config/mips/mips.c (mips_expand_builtin): Use new CALL_EXPR accessors. * config/bfin/bfin.c (bfin_expand_binop_builtin): Pass entire CALL_EXPR instead of arglist. Use new CALL_EXPR accessors. Fix callers. (bfin_expand_unop_builtin): Likewise. (bfin_expand_builtin): Use new CALL_EXPR accessors. 2007-02-15 Sandra Loosemore <sandra@codesourcery.com> Brooks Moses <brooks.moses@codesourcery.com> Lee Millward <lee.millward@codesourcery.com> * c-semantics.c (build_stmt): Add internal diagnostic check. * c-pretty-print.c (pp_c_postfix_expression): Use new CALL_EXPR accessors. Print arguments explicitly instead of as a list. * c-typeck.c (build_function_call): Use new CALL_EXPR constructors. * c-omp.c (c_finish_omp_barrier): Use build_call_expr. (c_finish_omp_flish): Likewise. * c-common.c (verify_tree): Use new CALL_EXPR accessors. Traverse arguments explicitly instead of as a list. Use TREE_OPERAND_LENGTH instead of TREE_CODE_LENGTH. (check_function_arguments_recurse): Use new CALL_EXPR accessors. (c_warn_unused_result): Likewise. 2007-02-15 Sandra Loosemore <sandra@codesourcery.com> Brooks Moses <brooks.moses@codesourcery.com> Lee Millward <lee.millward@codesourcery.com> * cp-tree.def (AGGR_INIT_EXPR): Adjust documentation. Change class to tcc_vl_exp. * call.c (build_call): Use build_call_list instead of build3. (build_over_call): Likewise. (build_new_method_call): Use build_min_non_dep_call_list instead of build_min_non_dep. * error.c (dump_call_expr_args): New function. (dump_aggr_init_expr_args): New function. (dump_expr) <AGGR_INIT_EXPR, CALL_EXPR, INDIRECT_REF>: Use them. Update to use new CALL_EXPR and AGGR_INIT_EXPR accessor macros. * cvt.c (convert_to_void): Use build_call_array instead of build3; use new AGGR_INIT_EXPR accessor macros. * mangle.c (write_expression): Use TREE_OPERAND_LENGTH instead of TREE_CODE_LENGTH. * dump.c (cp_dump_tree) <AGGR_INIT_EXPR>: Update to use new AGGR_INIT_EXPR accessor macros. * cp-gimplify.c (cp_gimplify_init_expr): Use AGGR_INIT_EXPR_SLOT to set the slot operand. * cp-tree.h (AGGR_INIT_EXPR_FN): New macro. (AGGR_INIT_EXPR_SLOT): New macro. (AGGR_INIT_EXPR_ARG): New macro. (aggr_init_expr_nargs): New macro. (AGGR_INIT_EXPR_ARGP): New macro. (aggr_init_expr_arg_iterator): New. (init_aggr_init_expr_arg_iterator): New. (next_aggr_init_expr_arg): New. (first_aggr_init_expr_arg): New. (more_aggr_init_expr_args_p): New. (FOR_EACH_AGGR_INIT_EXPR_ARG): New. (stabilize_aggr_init): New declaration. (build_min_non_dep_call_list): Likewise. * tree.c (process_aggr_init_operands): New function. (build_aggr_init_array) New function. (build_cplus_new): Update to use new CALL_EXPR and AGGR_INIT_EXPR accessor macros. Replace use of build3 with build_aggr_init_array. (build_min_non_dep_call_list) New function. (build_min_nt): Assert input code parameter is not a variable length expression class. (build_min, build_min_non_dep): Likewise. (cp_tree_equal) <CALL_EXPR>: Iterate through the arguments to check for equality instead of recursing. Handle tcc_vl_exp tree code classes. (stabilize_call): Update to only handle CALL_EXPRs, not AGGR_INIT_EXPRs; use new CALL_EXPR accessor macros. (stabilize_aggr_init): New function. (stabilize_init): Use it. * cxx-pretty-print.c (pp_cxx_postfix_expression) <AGGR_INIT_EXPR, CALL_EXPR>: Update to use new CALL_EXPR and AGGR_INIT_EXPR accessor macros and argument iterators. * pt.c (tsubst_copy) <CALL_EXPR>: Replace build_nt with build_vl_exp. Iterate through the operands, recursively processing each one. (tsubst_copy_and_build) <CALL_EXPR>: Update to use new CALL_EXPR accessor macros. (value_dependent_expression_p) <default>: Handle tcc_vl_exp tree code classes. Use TREE_OPERAND_LENGTH instead of TREE_CODE_LENGTH. * semantics.c (finish_call_expr): Use build_nt_call_list instead of build_nt. (simplify_aggr_init_expr): Update to use new AGGR_INIT_EXPR accessor macros. Use build_call_array to construct the CALL_EXPR node instead of build3 * decl2.c (build_offset_ref_call_from_tree): Use build_nt_call_list and build_min_non_dep_call_list instead of build_min_nt and build_min_non_dep. * parser.c (cp_parser_postfix_expression) <CPP_OPEN_PAREN>: Use build_nt_call_list instead of build_min_nt. 2007-02-15 Sandra Loosemore <sandra@codesourcery.com> Brooks Moses <brooks.moses@codesourcery.com> Lee Millward <lee.millward@codesourcery.com> * java-tree.h (BUILD_MONITOR_ENTER): Use build_call_nary instead of build3. (BUILD_MONITOR_EXIT): Likewise. * java-gimplify.c (java_gimplify_component_ref): Use build_call_expr. (java_gimplify_modify_expr): Likewise. * class.c (cache_this_class_ref): Use build_call_expr. (build_static_field_ref): Likewise. (emit_indirect_register_classes): Likewise. (emit_register_classes): Likewise. * resource.c (write_resource_constructor): Use build_call_expr. * builtins.c (builtin_creator_function): Change interpretation of the second parameter to be the whole CALL_EXPR instead of the arglist. (max_builtin): Tweak parameter list. Use new CALL_EXPR accessors. (min_builtin): Likewise. (abs_builtin): Likewise. (java_build_function_call_expr): Likewise. (convert_real): Likewise. (UNMARSHAL3): Likewise. (UNMARSHAL4): Likewise. (UNMARSHAL5): Likewise. (build_arglist_for_builtin): Delete. Fix callers to use build_call_expr instead. (putObject_builtin): Tweak parameter list. Use new CALL_EXPR accessors. (compareAndSwapInt_builtin): Likewise. (compareAndSwapLong_builtin): Likewise. (compareAndSwapObject_builtin): Likewise. (putVolatile_builtin): Likewise. (getVolatile_builtin): Likewise. (VMSupportsCS8_builtin): Likewise. (check_for_builtin): Pass entire CALL_EXPR to builtin expander instead of arglist. * expr.c (build_java_athrow): Use build_call_nary instead of build3. (build_java_throw_out_of_bounds_exception): Likewise. (java_check_reference): Likewise. (build_java_arraystore_check): Likewise. (build_newarray): Likewise. (build_anewarray): Likewise. (expand_java_multinewarray): Use build_call_list instead of build3. (build_java_monitor): Use build_call_nary instead of build3. (java_create_object): Likewise. (expand_java_NEW): Likewise. (build_instanceof): Likewise. (expand_java_CHECKCAST): Likewise. (build_java_soft_divmod): Likewise. (build_java_binop): Likewise. (build_field_ref): Likewise. (build_class_init): Likewise. (rewrite_arglist_getcaller): Use build_call_expr. (build_invokeinterface): Use build_call_nary instead of build3. (expand_invoke): Use build_call_list instead of build3. (build_jni_stub): Use build_call_nary, build_call_list, or build_call_expr instead of build3. (expand_java_field_op): Use build_call_expr instead of build3. (force_evaluation_order): Use new CALL_EXPR accessors. * lang.c (java_get_callee_fndecl): Use new CALL_EXPR accessors. 2007-02-15 Sandra Loosemore <sandra@codesourcery.com> Brooks Moses <brooks.moses@codesourcery.com> Lee Millward <lee.millward@codesourcery.com> * objc-act.c (receiver_is_class_object): Use new CALL_EXPR accessors. (objc_get_callee_fndecl): Likewise. 2007-02-15 Sandra Loosemore <sandra@codesourcery.com> Brooks Moses <brooks.moses@codesourcery.com> Lee Millward <lee.millward@codesourcery.com> * trans-expr.c (gfc_conv_power_op): Use build_call_expr. (gfc_conv_string_tmp): Likewise. (gfc_conv_concat_op): Likewise. (gfc_build_compare_string): Likewise. (gfc_conv_function_call): Use build_call_list instead of build3. * trans-array.c (gfc_trans_allocate_array_storage): Use build_call_expr. (gfc_grow_array): Likewise. (gfc_trans_array_ctor_element): Likewise. (gfc_trans_array_constructor_value): Likewise. (gfc_array_allocate): Likewise. (gfc_array_deallocate): Likewise. (gfc_trans_auto_array_allocation): Likewise. (gfc_trans_dummy_array_bias): Likewise. (gfc_conv_array_parameter): Likewise. (gfc_trans_dealloc_allocated): Likewise. (gfc_duplicate_allocatable): Likewise. * trans-openmp.c (gfc_trans_omp_barrier): Use build_call_expr. (gfc_trans_omp_flush): Likewise. * trans-stmt.c (gfc_conv_elementel_dependencies): Use build_call_expr. (gfc_trans_pause): Likewise. (gfc_trans_stop): Likewise. (gfc_trans_character_select): Likewise. (gfc_do_allocate): Likewise. (gfc_trans_assign_need_temp): Likewise. (gfc_trans_pointer_assign_need_temp): Likewise. (gfc_trans_forall_1): Likewise. (gfc_trans_where_2): Likewise. (gfc_trans_allocate): Likewise. (gfc_trans_deallocate): Likewise. * trans.c (gfc_trans_runtime_check): Use build_call_expr. * trans-io.c (gfc_trans_open): Use build_call_expr. (gfc_trans_close): Likewise. (build_filepos): Likewise. (gfc_trans_inquire): Likewise. (NML_FIRST_ARG): Delete. (NML_ADD_ARG): Delete. (transfer_namelist_element): Use build_call_expr. (build_dt): Likewise. (gfc_trans_dt_end): Likewise. (transfer_expr): Likewise. (transfer_array-desc): Likewise. * trans-decl.c (gfc_generate_function_code): Use build_call_expr. (gfc_generate_constructors): Likewise. * trans-intrinsic.c (gfc_conv_intrinsic_ctime): Use build_call_expr. (gfc_conv_intrinsic_fdate): Likewise. (gfc_conv_intrinsic_ttynam): Likewise. (gfc_conv_intrinsic_array_transfer): Likewise. (gfc_conv_associated): Likewise. (gfc_conv_intrinsic_si_kind): Likewise. (gfc_conv_intrinsic_trim): Likewise. (gfc_conv_intrinsic_repeat: Likewise. (gfc_conv_intrinsic_iargc): Likewise. Co-Authored-By: Brooks Moses <brooks.moses@codesourcery.com> Co-Authored-By: Lee Millward <lee.millward@codesourcery.com> From-SVN: r122018
2007-02-16 00:50:49 +01:00
&& (arg = CALL_EXPR_ARG (receiver, 0)))
{
STRIP_NOPS (arg);
if (TREE_CODE (arg) == ADDR_EXPR
&& (arg = TREE_OPERAND (arg, 0))
&& TREE_CODE (arg) == STRING_CST)
/* Finally, we have the class name. */
return get_identifier (TREE_STRING_POINTER (arg));
1992-01-18 00:15:38 +01:00
}
return 0;
}
/* If we are currently building a message expr, this holds
the identifier of the selector of the message. This is
1996-07-04 00:07:53 +02:00
used when printing warnings about argument mismatches. */
1992-01-18 00:15:38 +01:00
static tree current_objc_message_selector = 0;
1992-01-18 00:15:38 +01:00
tree
objc_message_selector (void)
1992-01-18 00:15:38 +01:00
{
return current_objc_message_selector;
1992-01-18 00:15:38 +01:00
}
/* Construct an expression for sending a message.
MESS has the object to send to in TREE_PURPOSE
and the argument list (including selector) in TREE_VALUE.
(*(<abstract_decl>(*)())_msg)(receiver, selTransTbl[n], ...);
(*(<abstract_decl>(*)())_msgSuper)(receiver, selTransTbl[n], ...); */
1992-01-18 00:15:38 +01:00
tree
c-parse.in (primary): Call objc_build_message_expr()... [gcc/ChangeLog] 2004-09-01 Ziemowit Laski <zlaski@apple.com> * c-parse.in (primary): Call objc_build_message_expr(), objc_build_selector_expr(), objc_build_protocol_expr(), objc_build_encode_expr() and objc_build_string_object() instead of build_message_expr(), build_selector_expr(), build_protocol_expr(), build_encode_expr() and build_objc_string_object(), respectively. (component_decl_list2): Call objc_get_class_ivars() instead of get_class_ivars_from_name(). (keyworddecl): Call objc_build_keyword_decl() instead of build_keyword_decl(). (receiver): Call objc_get_class_reference() instead of get_class_reference(). (reswords): Add blank line before @@ifobjc section, for clarity. [gcc/objc/ChangeLog] 2004-09-01 Ziemowit Laski <zlaski@apple.com> * objc-act.c (objc_check_decl): Use OBJC_TYPE_NAME macro instead of TYPE_NAME. (build_objc_string_object): Rename to objc_build_string_object(). (get_class_reference): Rename to objc_get_class_reference(). (get_class_ivars_from_name): Rename to objc_get_class_ivars(). (next_sjlj_build_catch_list, get_super_receiver): Call objc_get_class_reference() instead of get_class_reference(). (build_keyword_decl): Rename to objc_build_keyword_decl(). (build_message_expr): Rename to objc_build_message_expr(). (build_protocol_expr): Rename to objc_build_protocol_expr(). (build_selector_expr): Rename to objc_build_selector_expr(). (build_encode_expr): Rename to objc_build_encode_expr(). * objc-act.h (get_class_ivars_from_name): Rename prototype to objc_get_class_ivars(). (get_class_reference): Rename prototype to objc_get_class_reference(). (build_message_expr): Rename prototype to objc_build_message_expr(). (build_selector_expr): Rename prototype to objc_build_selector_expr(). (build_keyword_decl): Rename prototype to objc_build_keyword_decl(). (build_protocol_expr): Rename prototype to objc_build_prototype_expr(). (build_objc_string_object): Rename prototype to objc_build_string_object(). From-SVN: r86950
2004-09-02 02:36:18 +02:00
objc_build_message_expr (tree mess)
1992-01-18 00:15:38 +01:00
{
tree receiver = TREE_PURPOSE (mess);
c-parse.in (objc_inherit_code, [...]): Make static. 2001-10-03 Ziemowit Laski <zlaski@apple.com> * c-parse.in (objc_inherit_code, objc_pq_context, objc_public_flag): Make static. (objc_interface_context, objc_implementation_context, objc_method_context, objc_ivar_chain, objc_ivar_context): Move to global tree array in objc/objc-act.[ch]. (methoddef): Remove unnecessary code. * objc/objc-act.c: (hashed_attribute, hashed_entry, imp_entry): Hoist struct definitions to objc-act.h. (nst_method_hash_list, cls_method_hash_list, imp_list, imp_count, cat_count): Place declaration in objc-act.h. (objc_tree_index): Move enumeration to objc-act.h. (objc_global_trees): Place declaration and macro accessors in objc-act.h. (implementation_context): Remove duplicate; use objc_implementation_context instead: (method_context): Remove duplicate; use objc_method_context instead. (objc_ellipsis_node, objc_method_prototype_template, implemented_classes, function_type): Move global vars to objc_global_trees. (init_objc): Use LAST_BASE_TREE_CODE instead of LAST_CODE. (build_message_expr): Move actual construction of ObjC message send nodes to finish_message_expr. (finish_message_expr): New routine, contains code formerly in build_message_expr. * objc/objc-act.h (finish_message_expr): New prototype. (objc_ivar_chain, objc_method_context, objc_ellipsis_node): Remove declarations; these vars are now part of objc_global_trees. (objc_tree_index, objc_global_trees): Move definitions from objc-act.c. * objc/objc-tree.def: Update copyright info. From-SVN: r46000
2001-10-04 00:05:57 +02:00
tree sel_name;
Makefile.in (c-parse.o): Depend on $(C_COMMON_H). [gcc/ChangeLog] 2004-09-07 Ziemowit Laski <zlaski@apple.com> * Makefile.in (c-parse.o): Depend on $(C_COMMON_H). * c-parse.in: Include c-common.h instead of objc-act.h. (ivar_decl_list, ivar_decls, ivar_decl, ivars, ivar_declarator, myparms, myparm): Remove %type declarations. (methodtype, optparms, OBJC_TYPE_QUAL, objc_quals, objc_qual, objc_typename, objc_try_catch_stmt, optellipsis): Add %type declarations. (objc_inherit_code, objc_public_flag): Remove. (typespec_nonreserved_nonattr): Call objc_get_protocol_qualified_type() instead of get_static_reference() and get_protocol_reference(). (stmt_nocomp): Call grokparm() on @catch parameter. (objcdef): Move semantic action to objc_finish_implementation(). (classdef): Move semantic action to objc_start_class_interface(), objc_continue_interface(), objc_finish_interface(), objc_start_class_implementation(), objc_continue_implementation(), objc_start_category_interface() and objc_start_category_implementation(). (protocoldef): Move semantic actions to objc_start_protocol() and objc_finish_interface(). (ivar_decl_list): Remove nonterminal. (visibility_spec): Move semantic actions to objc_set_visibility(). (ivar_decls): Remove assignment to $$. (ivar_decl): Rephrase in terms of component_decl; call objc_add_instance_variable(). (ivars, ivar_declarator): Remove nonterminals. (opt_semi): New nonterminal. (methodtype): Remove semantic actions. (methoddef): Move semantic actions to objc_set_method_type(), objc_start_method_definition() and objc_finish_method_definition(). (methodproto): Move semantic actions to objc_set_method_type() and objc_add_method_declaration(). (methoddecl): Use objc_typename instead of typename; move semantic actions to objc_build_method_signature(). (optarglist, myxdecls, mydecl, myparms, myparm): Remove nonterminals. (optparmlist): Express in terms of optparms and optellipsis. (optparms, optellipsis, objc_qual, objc_quals, objc_typename): New nonterminals. (keyworddecl): Use objc_typename instead of typename. (rid_to_yy): Mark RID_IN, RID_OUT, RID_INOUT, RID_BYCOPY, RID_BYREF and RID_ONEWAY as returning OBJC_TYPE_QUAL to yyparse(). [gcc/objc/ChangeLog] 2004-09-07 Ziemowit Laski <zlaski@apple.com> * Make-lang.in (objc/objc-parse.o): Depend on $(C_COMMON_H) instead of objc/objc-act.h. (objc/objc-act.o): Depend on $(HASHTAB_H). * objc-act.c: Include hashtab.h; in ObjC++ mode, include cp-tree.h and objcp-decl.h instead of c-tree.h. (build_module_descriptor, get_class_ivars, synth_id_with_class_suffix, error_with_ivar, gen_method_decl, gen_declaration, setup_string_decl, build_protocol_template): Adjust prototypes. (build_module_initializer_routine, start_class, continue_class, finish_class, start_method_def, objc_start_function, start_protocol, build_method_decl, objc_add_method, add_instance_variable, build_ivar_reference, is_ivar, is_private, get_super_receiver, build_selector_table_decl, objc_push_parm, objc_get_parm_info, gen_type_name, gen_type_name_0, start_var_decl, finish_var_decl, create_field_decl): New prototypes. (objc_expand_function_end, comp_method_with_proto, objc_expr_last, gen_declaration_1, gen_declarator, is_complex_decl, adorn_decl, define_decl, create_builtin_decl, gen_declspecs): Remove prototypes. (TYPE_ID): Rename to OBJECT_TYPEDEF_NAME. (CLASS_TYPEDEF_NAME): New. (TAG_EXECCLASS): Change from a global variable to a #define. (TAG_RETURN_STRUCT): Delete. (TAG_GNUINIT): New, holds '__objc_gnu_init' name. (objc_inherit_code, objc_public_flag): New, moved from c-parse.in. (string_descriptor): New struct. (string_htab): New hash table. (string_hash, string_eq): New prototypes. (generate_struct_by_value_array): Call create_field_decl() instead of create_builtin_decl(). (objc_init): Do not initialize objc_ellipsis_node or TAG_EXECCLASS; In ObjC++ mode, call cxx_init() instead of c_objc_common_init(). (objc_finish_file): In ObjC++, call instantiate_pending_templates() and cp_finish_file(). (define_decl, get_static_reference, get_protocol_reference, create_builtin_decl): Remove functions. (objc_start_class_interface, objc_start_category_interface, objc_start_protocol, objc_continue_interface, objc_finish_interface, objc_start_class_implementation, objc_start_category_implementation, objc_continue_implementation, objc_finish_implementation, objc_set_visibility, objc_set_method_type, objc_build_method_signature, objc_add_method_declaration, objc_start_method_definition, objc_add_instance_variable, objc_get_protocol_qualified_type, create_field_decl, start_var_decl, finish_var_decl): New functions. (setup_string_decl): Simplify since it is only called once. (synth_module_prologue): Call build_class_template(); predefine 'id' and 'Class' as typedefs; rename 'temp_type' to 'type'; disable debug hooks for duration of function; fix GNU runtime messenger signatures to correspond to reality; forward-declare '__objc_exec_class' for the GNU runtime; call build_selector_table_decl(); in ObjC++ mode, generate 'extern "C" { ... }' wrappers around synthesized declarations; call build_protocol_template() and build_category_template(). (string_hash, string_eq): New functions. (objc_build_string_object): Check metaclass correctness only once; store string literals in hash table. (objc_build_constructor): Do not convert initializer elements; adjust for ObjC++ impedance mismatch. (build_objc_symtab_template): Call create_field_decl() instead of create_builtin_decl(). (init_objc_symtab): Add missing conversion to initializer element. (build_metadata_decl): Call start_var_decl() instead of define_decl(). (generate_objc_symtab_decl): Do not call build_category_template(); call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(). (build_module_descriptor): Call create_field_decl() instead of grokfield(); call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(); always mark module descriptor as used; move GNU runtime-specific functionality to build_module_initializer_routine(). (build_module_initializer_routine): New function, broken off of build_module_descriptor(). (objc_static_init_needed_p, objc_generate_static_init_call): New functions. (generate_static_references, generate_strings, build_selector_translation_table, generate_descriptor_table, generate_ivars_list, generate_dispatch_table, generate_category): Call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(); build a type directly instead of via groktypename(). (build_selector_reference_decl, build_selector_table_decl, build_class_reference_decl, build_protocol_reference, generate_objc_image_info): Call start_var_decl() instead of build_decl(). (build_selector_reference): For GNU runtime, do not call build_selector_reference_decl(). (build_selector, build_typed_selector_reference): Always convert result to the selector type. (add_objc_string): Cast return value to 'char *'. (build_method_prototype_template, build_selector_template, build_method_template): Use actual selector type for fields pointing to selectors. (finish_objc): For GNU runtime, call build_module_initializer_routine() after build_module_descriptor(). (generate_protocol_list, generate_shared_structures): Call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(); build a type directly instead of via groktypename(). (synth_id_with_class_suffix): Return a string. (get_arg_type_list): For instance methods, use the instance type for 'self'; do not call groktypename_in_parm_context(). (build_objc_string_decl): Squash redeclaration errors in ObjC++. (objc_is_class_name): Use OBJC_TYPE_NAME instead of TYPE_NAME; handle RECORD_TYPEs in ObjC as well as ObjC++. (objc_is_id): New function. (objc_is_object_ptr): Return the canonical type node. (objc_get_class_ivars): Simplify using get_class_ivars(). (get_class_ivars): Remove second parameter; create a fresh copy of the ivar list for each call; do not check for existence of super class. (objc_eh_runtime_type): Mark #ifndef OBJCPLUS. (objc_init_exceptions): When using SJLJ-style exceptions, require the use of '-fobjc-exceptions' flag; do not require it for DWARF-style exceptions. (objc_build_exc_ptr, next_sjlj_build_try_catch_finally): Use objc_object_type instead of objc_id_type. (objc_begin_catch_clause): Convert the incoming PARM_DECL into a VAR_DECL before placing it in the appropriate scope; do not call define_decl(); adjust call to c_begin_compound_stmt(); use objc_object_type instead of objc_id_type. (build_next_objc_exception_stuff): Call create_field_decl() instead of create_builtin_decl(); construct type directly instead of calling groktypename(); use OBJC_VOID_AT_END to mark end of function parameters. (build_private_template): Adjust call to get_class_ivars(); build a type directly instead of via groktypename(). (build_protocol_template, build_method_prototype_list_template, build_method_prototype_template, build_category_template, build_selector_template, build_class_template, build_super_template, build_ivar_template, build_ivar_list_template, build_method_list_template, build_method_template): Call create_field_decl() instead of grokfield(). (objc_method_parm_type): Do not call groktypename(). (generate_descriptor_table): Call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(). (generate_method_descriptors, build_protocol_initializer, generate_dispatch_tables, build_category_initializer, build_shared_structure_initializer): Do not call groktypename(). (generate_protocols): Call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(); do not call groktypename(). (error_with_ivar): Remove last parameter. (check_ivars): Do not iterate ovar CLASS_RAW_IVARS lists in addition to CLASS_IVARS lists; adjust calls to error_with_ivar(). (generate_ivar_lists): Convert one of the initializer elements; do not call groktypename(). (get_arg_type_list, start_method_def, gen_method_def): Account for new representation of variable arguments and '...' in Objective-C methods; add Objective-C++ impedance matching code. (is_objc_type_qualifier): Remove function. (adjust_type_for_id_default): Simplify; there is no longer a need to wade through declspecs. (lookup_interface, start_class, continue_class, finish_class, start_method_def, start_protocol, build_method_decl, objc_add_method, add_instance_variable, build_ivar_reference, is_ivar, is_private, get_super_receiver, objc_build_finally_epilogue): Make into static functions. (receiver_is_class_object): Use new IS_CLASS() macro. (objc_build_message_expr): Tweak ObjC++ message argument handling; call objc_finish_message_expr() instead of finish_message_expr(). (finish_message_expr): Rename to objc_finish_message_expr(); use OBJC_TYPE_NAME and OBJC_SET_TYPE_NAME macros instead of TYPE_NAME. call gen_type_name() instead of gen_declaration(); call objc_is_id() instead of using IS_ID and IS_CLASS; Use objc_class_name instead of calling get_identifier("Class"); handle CONVERT_EXPRs in receiver. (build_objc_method_call, warn_with_method): Do not call groktypename(). (build_ivar_reference): Call convert() instead of clobbering in a type. (hash_init): Initialize string_htab hash table. (add_instance_variable): Simplify parameter list; do not call grokfield(); do not populate CLASS_IVARS list. (start_class): Check for the existence of super class, if one was specified. (continue_class): Use CLASS_RAW_IVARS rather than CLASS_IVARS; do not call build_class_template(); adjust call to get_class_ivars(); call build_decl(), pushdecl() and finish_decl() instead of define_decl(). (finish_class): Call build_decl(), pushdecl() and finish_decl() instead of define_decl(). (add_protocols): Use PROTOCOL_BINFO_ELTS for the tree vector size. (start_protocol): Do not call build_protocol_template(); use PROTOCOL_BINFO_ELTS for the tree vector size. (encode_type_qualifiers): Do not handle the 'const' qualifier here. (encode_pointer): Encode 'const char *' as 'r*', for backwards compatibility. (encode_array): Use HOST_WIDE_INT_PRINT_DEC instead of "%ld". (encode_type): Handle the 'const' qualifier here. (objc_parmlist): New global variable, sued by objc_push_parm and objc_get_parm_info(). (objc_push_parm, objc_get_parm_info): New functions. (objc_expr_last): Remove function. (synth_self_and_ucmd_args): For instance methods, use the instance type for 'self'; call objc_push_parm() instead of push_parm_decl(). (start_method_def): Do not call push_scope(), declare_parm_level(), pop_scope(), push_parm_decl(), store_parm_decls() or objc_expr_last(); just use objc_push_parm() and objc_get_parm_info(). (comp_method_with_proto): Remove function. (objc_types_are_equivalent): Strip away indirections before comparing underlying types. (comp_proto_with_proto): Do not call groktypename(); types are no longer in raw declspec format. (objc_start_function): New function. (really_start_method): Call comp_proto_with_proto() instead of comp_method_with_proto(); call objc_start_function() instead of hand-crafting a function declarator. (continue_method_def, objc_expand_function_end): Remove functions. (get_super_receiver): Call objc_get_current_scope() instead of get_current_scope(); reference 'super_class' field (instead of 'class'). (finish_method_def): Rename to objc_finish_method_definition() and add a function decl parameter; move method encoding call from objc_expand_function_end(). (is_complex_decl, adorn_decl, gen_declarator, gen_declspecs, gen_declaration_1): Remove functions. (tmpbuf, RAW_DECLSPEC): Remove. (gen_declaration): Remove second parameter; simplify to deal with TYPE_P nodes instead of raw declspecs. (gen_type_name, gen_type_name_0): New functions. (gen_method_decl): Remove second parameter; call gen_type_name() instead of gen_declaration_1(). (dump_interface): Adjust calls to gen_declaration() and gen_method_decl(); do not allocate a separate string buffer. (init_objc): Allocate a larger string buffer to accommodate dump_interface(); adjust call to build_module_descriptor(); add call to build_module_initializer_routine() for the GNU runtime. (generate_classref_translation_entry): Do not call start_decl(); call finish_var_decl() instead of finish_decl(); call convert() instead of build_c_cast(). * objc-act.h (CLASS_OWN_IVARS): Remove accessor. (CLASS_BINFO_ELTS): Reduce from 6 to 5, now that CLASS_OWN_IVARS is gone. (OCTI_GNU_INIT_DECL, GNU_INIT_decl): New. (OCTI_ELLIPSIS_NODE, objc_ellipsis_node): Remove. (OCTI_ID_ID, id_type, objc_id_id): Rename to OCTI_ID_NAME, objc_object_type and objc_object_name, respectively. (OCTI_CLS_REF, OCTI_CLASS_NAME, objc_class_reference, objc_class_name): New. (IS_CLASS): New macro. (IS_ID, IS_SUPER): Robustify. (OCTI_EXECCLASS_DECL, execclass_decl): New. (finish_file, start_class, continue_class, finish_class, start_method_def, continue_method_def, finish_method_def, start_protocol, finish_protocol, objc_build_throw_stmt, objc_build_try_catch_finally_stmt, objc_build_synchronized_prologue, objc_build_synchronized_epilogue, objc_build_try_prologue, objc_build_try_epilogue, objc_build_catch_stmt, objc_build_catch_epilogue, objc_build_finally_prologue, objc_build_finally_epilogue, is_ivar, is_private, is_public, add_instance_variable, objc_add_method, get_super_receiver, objc_clear_super_receiver, get_class_ivars_from_name, get_class_reference, get_static_reference, get_object_reference, build_message_expr, finish_message_expr, build_selector_expr, build_ivar_reference, build_keyword_decl, build_method_decl, build_protocol_expr, build_objc_string_object, objc_declare_alias, objc_declare_class, objc_declare_protocols, objc_comptypes, objc_check_decl, build_encode_expr): Remove prototypes. (imp_count, cat_count): Make GGC-aware. (OBJC_SET_TYPE_NAME): New macro. From-SVN: r87168
2004-09-08 02:49:44 +02:00
#ifdef OBJCPLUS
tree args = TREE_PURPOSE (TREE_VALUE (mess));
#else
1992-01-18 00:15:38 +01:00
tree args = TREE_VALUE (mess);
Makefile.in (c-parse.o): Depend on $(C_COMMON_H). [gcc/ChangeLog] 2004-09-07 Ziemowit Laski <zlaski@apple.com> * Makefile.in (c-parse.o): Depend on $(C_COMMON_H). * c-parse.in: Include c-common.h instead of objc-act.h. (ivar_decl_list, ivar_decls, ivar_decl, ivars, ivar_declarator, myparms, myparm): Remove %type declarations. (methodtype, optparms, OBJC_TYPE_QUAL, objc_quals, objc_qual, objc_typename, objc_try_catch_stmt, optellipsis): Add %type declarations. (objc_inherit_code, objc_public_flag): Remove. (typespec_nonreserved_nonattr): Call objc_get_protocol_qualified_type() instead of get_static_reference() and get_protocol_reference(). (stmt_nocomp): Call grokparm() on @catch parameter. (objcdef): Move semantic action to objc_finish_implementation(). (classdef): Move semantic action to objc_start_class_interface(), objc_continue_interface(), objc_finish_interface(), objc_start_class_implementation(), objc_continue_implementation(), objc_start_category_interface() and objc_start_category_implementation(). (protocoldef): Move semantic actions to objc_start_protocol() and objc_finish_interface(). (ivar_decl_list): Remove nonterminal. (visibility_spec): Move semantic actions to objc_set_visibility(). (ivar_decls): Remove assignment to $$. (ivar_decl): Rephrase in terms of component_decl; call objc_add_instance_variable(). (ivars, ivar_declarator): Remove nonterminals. (opt_semi): New nonterminal. (methodtype): Remove semantic actions. (methoddef): Move semantic actions to objc_set_method_type(), objc_start_method_definition() and objc_finish_method_definition(). (methodproto): Move semantic actions to objc_set_method_type() and objc_add_method_declaration(). (methoddecl): Use objc_typename instead of typename; move semantic actions to objc_build_method_signature(). (optarglist, myxdecls, mydecl, myparms, myparm): Remove nonterminals. (optparmlist): Express in terms of optparms and optellipsis. (optparms, optellipsis, objc_qual, objc_quals, objc_typename): New nonterminals. (keyworddecl): Use objc_typename instead of typename. (rid_to_yy): Mark RID_IN, RID_OUT, RID_INOUT, RID_BYCOPY, RID_BYREF and RID_ONEWAY as returning OBJC_TYPE_QUAL to yyparse(). [gcc/objc/ChangeLog] 2004-09-07 Ziemowit Laski <zlaski@apple.com> * Make-lang.in (objc/objc-parse.o): Depend on $(C_COMMON_H) instead of objc/objc-act.h. (objc/objc-act.o): Depend on $(HASHTAB_H). * objc-act.c: Include hashtab.h; in ObjC++ mode, include cp-tree.h and objcp-decl.h instead of c-tree.h. (build_module_descriptor, get_class_ivars, synth_id_with_class_suffix, error_with_ivar, gen_method_decl, gen_declaration, setup_string_decl, build_protocol_template): Adjust prototypes. (build_module_initializer_routine, start_class, continue_class, finish_class, start_method_def, objc_start_function, start_protocol, build_method_decl, objc_add_method, add_instance_variable, build_ivar_reference, is_ivar, is_private, get_super_receiver, build_selector_table_decl, objc_push_parm, objc_get_parm_info, gen_type_name, gen_type_name_0, start_var_decl, finish_var_decl, create_field_decl): New prototypes. (objc_expand_function_end, comp_method_with_proto, objc_expr_last, gen_declaration_1, gen_declarator, is_complex_decl, adorn_decl, define_decl, create_builtin_decl, gen_declspecs): Remove prototypes. (TYPE_ID): Rename to OBJECT_TYPEDEF_NAME. (CLASS_TYPEDEF_NAME): New. (TAG_EXECCLASS): Change from a global variable to a #define. (TAG_RETURN_STRUCT): Delete. (TAG_GNUINIT): New, holds '__objc_gnu_init' name. (objc_inherit_code, objc_public_flag): New, moved from c-parse.in. (string_descriptor): New struct. (string_htab): New hash table. (string_hash, string_eq): New prototypes. (generate_struct_by_value_array): Call create_field_decl() instead of create_builtin_decl(). (objc_init): Do not initialize objc_ellipsis_node or TAG_EXECCLASS; In ObjC++ mode, call cxx_init() instead of c_objc_common_init(). (objc_finish_file): In ObjC++, call instantiate_pending_templates() and cp_finish_file(). (define_decl, get_static_reference, get_protocol_reference, create_builtin_decl): Remove functions. (objc_start_class_interface, objc_start_category_interface, objc_start_protocol, objc_continue_interface, objc_finish_interface, objc_start_class_implementation, objc_start_category_implementation, objc_continue_implementation, objc_finish_implementation, objc_set_visibility, objc_set_method_type, objc_build_method_signature, objc_add_method_declaration, objc_start_method_definition, objc_add_instance_variable, objc_get_protocol_qualified_type, create_field_decl, start_var_decl, finish_var_decl): New functions. (setup_string_decl): Simplify since it is only called once. (synth_module_prologue): Call build_class_template(); predefine 'id' and 'Class' as typedefs; rename 'temp_type' to 'type'; disable debug hooks for duration of function; fix GNU runtime messenger signatures to correspond to reality; forward-declare '__objc_exec_class' for the GNU runtime; call build_selector_table_decl(); in ObjC++ mode, generate 'extern "C" { ... }' wrappers around synthesized declarations; call build_protocol_template() and build_category_template(). (string_hash, string_eq): New functions. (objc_build_string_object): Check metaclass correctness only once; store string literals in hash table. (objc_build_constructor): Do not convert initializer elements; adjust for ObjC++ impedance mismatch. (build_objc_symtab_template): Call create_field_decl() instead of create_builtin_decl(). (init_objc_symtab): Add missing conversion to initializer element. (build_metadata_decl): Call start_var_decl() instead of define_decl(). (generate_objc_symtab_decl): Do not call build_category_template(); call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(). (build_module_descriptor): Call create_field_decl() instead of grokfield(); call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(); always mark module descriptor as used; move GNU runtime-specific functionality to build_module_initializer_routine(). (build_module_initializer_routine): New function, broken off of build_module_descriptor(). (objc_static_init_needed_p, objc_generate_static_init_call): New functions. (generate_static_references, generate_strings, build_selector_translation_table, generate_descriptor_table, generate_ivars_list, generate_dispatch_table, generate_category): Call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(); build a type directly instead of via groktypename(). (build_selector_reference_decl, build_selector_table_decl, build_class_reference_decl, build_protocol_reference, generate_objc_image_info): Call start_var_decl() instead of build_decl(). (build_selector_reference): For GNU runtime, do not call build_selector_reference_decl(). (build_selector, build_typed_selector_reference): Always convert result to the selector type. (add_objc_string): Cast return value to 'char *'. (build_method_prototype_template, build_selector_template, build_method_template): Use actual selector type for fields pointing to selectors. (finish_objc): For GNU runtime, call build_module_initializer_routine() after build_module_descriptor(). (generate_protocol_list, generate_shared_structures): Call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(); build a type directly instead of via groktypename(). (synth_id_with_class_suffix): Return a string. (get_arg_type_list): For instance methods, use the instance type for 'self'; do not call groktypename_in_parm_context(). (build_objc_string_decl): Squash redeclaration errors in ObjC++. (objc_is_class_name): Use OBJC_TYPE_NAME instead of TYPE_NAME; handle RECORD_TYPEs in ObjC as well as ObjC++. (objc_is_id): New function. (objc_is_object_ptr): Return the canonical type node. (objc_get_class_ivars): Simplify using get_class_ivars(). (get_class_ivars): Remove second parameter; create a fresh copy of the ivar list for each call; do not check for existence of super class. (objc_eh_runtime_type): Mark #ifndef OBJCPLUS. (objc_init_exceptions): When using SJLJ-style exceptions, require the use of '-fobjc-exceptions' flag; do not require it for DWARF-style exceptions. (objc_build_exc_ptr, next_sjlj_build_try_catch_finally): Use objc_object_type instead of objc_id_type. (objc_begin_catch_clause): Convert the incoming PARM_DECL into a VAR_DECL before placing it in the appropriate scope; do not call define_decl(); adjust call to c_begin_compound_stmt(); use objc_object_type instead of objc_id_type. (build_next_objc_exception_stuff): Call create_field_decl() instead of create_builtin_decl(); construct type directly instead of calling groktypename(); use OBJC_VOID_AT_END to mark end of function parameters. (build_private_template): Adjust call to get_class_ivars(); build a type directly instead of via groktypename(). (build_protocol_template, build_method_prototype_list_template, build_method_prototype_template, build_category_template, build_selector_template, build_class_template, build_super_template, build_ivar_template, build_ivar_list_template, build_method_list_template, build_method_template): Call create_field_decl() instead of grokfield(). (objc_method_parm_type): Do not call groktypename(). (generate_descriptor_table): Call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(). (generate_method_descriptors, build_protocol_initializer, generate_dispatch_tables, build_category_initializer, build_shared_structure_initializer): Do not call groktypename(). (generate_protocols): Call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(); do not call groktypename(). (error_with_ivar): Remove last parameter. (check_ivars): Do not iterate ovar CLASS_RAW_IVARS lists in addition to CLASS_IVARS lists; adjust calls to error_with_ivar(). (generate_ivar_lists): Convert one of the initializer elements; do not call groktypename(). (get_arg_type_list, start_method_def, gen_method_def): Account for new representation of variable arguments and '...' in Objective-C methods; add Objective-C++ impedance matching code. (is_objc_type_qualifier): Remove function. (adjust_type_for_id_default): Simplify; there is no longer a need to wade through declspecs. (lookup_interface, start_class, continue_class, finish_class, start_method_def, start_protocol, build_method_decl, objc_add_method, add_instance_variable, build_ivar_reference, is_ivar, is_private, get_super_receiver, objc_build_finally_epilogue): Make into static functions. (receiver_is_class_object): Use new IS_CLASS() macro. (objc_build_message_expr): Tweak ObjC++ message argument handling; call objc_finish_message_expr() instead of finish_message_expr(). (finish_message_expr): Rename to objc_finish_message_expr(); use OBJC_TYPE_NAME and OBJC_SET_TYPE_NAME macros instead of TYPE_NAME. call gen_type_name() instead of gen_declaration(); call objc_is_id() instead of using IS_ID and IS_CLASS; Use objc_class_name instead of calling get_identifier("Class"); handle CONVERT_EXPRs in receiver. (build_objc_method_call, warn_with_method): Do not call groktypename(). (build_ivar_reference): Call convert() instead of clobbering in a type. (hash_init): Initialize string_htab hash table. (add_instance_variable): Simplify parameter list; do not call grokfield(); do not populate CLASS_IVARS list. (start_class): Check for the existence of super class, if one was specified. (continue_class): Use CLASS_RAW_IVARS rather than CLASS_IVARS; do not call build_class_template(); adjust call to get_class_ivars(); call build_decl(), pushdecl() and finish_decl() instead of define_decl(). (finish_class): Call build_decl(), pushdecl() and finish_decl() instead of define_decl(). (add_protocols): Use PROTOCOL_BINFO_ELTS for the tree vector size. (start_protocol): Do not call build_protocol_template(); use PROTOCOL_BINFO_ELTS for the tree vector size. (encode_type_qualifiers): Do not handle the 'const' qualifier here. (encode_pointer): Encode 'const char *' as 'r*', for backwards compatibility. (encode_array): Use HOST_WIDE_INT_PRINT_DEC instead of "%ld". (encode_type): Handle the 'const' qualifier here. (objc_parmlist): New global variable, sued by objc_push_parm and objc_get_parm_info(). (objc_push_parm, objc_get_parm_info): New functions. (objc_expr_last): Remove function. (synth_self_and_ucmd_args): For instance methods, use the instance type for 'self'; call objc_push_parm() instead of push_parm_decl(). (start_method_def): Do not call push_scope(), declare_parm_level(), pop_scope(), push_parm_decl(), store_parm_decls() or objc_expr_last(); just use objc_push_parm() and objc_get_parm_info(). (comp_method_with_proto): Remove function. (objc_types_are_equivalent): Strip away indirections before comparing underlying types. (comp_proto_with_proto): Do not call groktypename(); types are no longer in raw declspec format. (objc_start_function): New function. (really_start_method): Call comp_proto_with_proto() instead of comp_method_with_proto(); call objc_start_function() instead of hand-crafting a function declarator. (continue_method_def, objc_expand_function_end): Remove functions. (get_super_receiver): Call objc_get_current_scope() instead of get_current_scope(); reference 'super_class' field (instead of 'class'). (finish_method_def): Rename to objc_finish_method_definition() and add a function decl parameter; move method encoding call from objc_expand_function_end(). (is_complex_decl, adorn_decl, gen_declarator, gen_declspecs, gen_declaration_1): Remove functions. (tmpbuf, RAW_DECLSPEC): Remove. (gen_declaration): Remove second parameter; simplify to deal with TYPE_P nodes instead of raw declspecs. (gen_type_name, gen_type_name_0): New functions. (gen_method_decl): Remove second parameter; call gen_type_name() instead of gen_declaration_1(). (dump_interface): Adjust calls to gen_declaration() and gen_method_decl(); do not allocate a separate string buffer. (init_objc): Allocate a larger string buffer to accommodate dump_interface(); adjust call to build_module_descriptor(); add call to build_module_initializer_routine() for the GNU runtime. (generate_classref_translation_entry): Do not call start_decl(); call finish_var_decl() instead of finish_decl(); call convert() instead of build_c_cast(). * objc-act.h (CLASS_OWN_IVARS): Remove accessor. (CLASS_BINFO_ELTS): Reduce from 6 to 5, now that CLASS_OWN_IVARS is gone. (OCTI_GNU_INIT_DECL, GNU_INIT_decl): New. (OCTI_ELLIPSIS_NODE, objc_ellipsis_node): Remove. (OCTI_ID_ID, id_type, objc_id_id): Rename to OCTI_ID_NAME, objc_object_type and objc_object_name, respectively. (OCTI_CLS_REF, OCTI_CLASS_NAME, objc_class_reference, objc_class_name): New. (IS_CLASS): New macro. (IS_ID, IS_SUPER): Robustify. (OCTI_EXECCLASS_DECL, execclass_decl): New. (finish_file, start_class, continue_class, finish_class, start_method_def, continue_method_def, finish_method_def, start_protocol, finish_protocol, objc_build_throw_stmt, objc_build_try_catch_finally_stmt, objc_build_synchronized_prologue, objc_build_synchronized_epilogue, objc_build_try_prologue, objc_build_try_epilogue, objc_build_catch_stmt, objc_build_catch_epilogue, objc_build_finally_prologue, objc_build_finally_epilogue, is_ivar, is_private, is_public, add_instance_variable, objc_add_method, get_super_receiver, objc_clear_super_receiver, get_class_ivars_from_name, get_class_reference, get_static_reference, get_object_reference, build_message_expr, finish_message_expr, build_selector_expr, build_ivar_reference, build_keyword_decl, build_method_decl, build_protocol_expr, build_objc_string_object, objc_declare_alias, objc_declare_class, objc_declare_protocols, objc_comptypes, objc_check_decl, build_encode_expr): Remove prototypes. (imp_count, cat_count): Make GGC-aware. (OBJC_SET_TYPE_NAME): New macro. From-SVN: r87168
2004-09-08 02:49:44 +02:00
#endif
tree method_params = NULL_TREE;
1992-01-18 00:15:38 +01:00
if (TREE_CODE (receiver) == ERROR_MARK)
return error_mark_node;
/* Obtain the full selector name. */
if (TREE_CODE (args) == IDENTIFIER_NODE)
1996-07-04 00:07:53 +02:00
/* A unary selector. */
1992-01-18 00:15:38 +01:00
sel_name = args;
else if (TREE_CODE (args) == TREE_LIST)
sel_name = build_keyword_selector (args);
else
abort ();
1992-01-18 00:15:38 +01:00
/* Build the parameter list to give to the method. */
if (TREE_CODE (args) == TREE_LIST)
Makefile.in (c-parse.o): Depend on $(C_COMMON_H). [gcc/ChangeLog] 2004-09-07 Ziemowit Laski <zlaski@apple.com> * Makefile.in (c-parse.o): Depend on $(C_COMMON_H). * c-parse.in: Include c-common.h instead of objc-act.h. (ivar_decl_list, ivar_decls, ivar_decl, ivars, ivar_declarator, myparms, myparm): Remove %type declarations. (methodtype, optparms, OBJC_TYPE_QUAL, objc_quals, objc_qual, objc_typename, objc_try_catch_stmt, optellipsis): Add %type declarations. (objc_inherit_code, objc_public_flag): Remove. (typespec_nonreserved_nonattr): Call objc_get_protocol_qualified_type() instead of get_static_reference() and get_protocol_reference(). (stmt_nocomp): Call grokparm() on @catch parameter. (objcdef): Move semantic action to objc_finish_implementation(). (classdef): Move semantic action to objc_start_class_interface(), objc_continue_interface(), objc_finish_interface(), objc_start_class_implementation(), objc_continue_implementation(), objc_start_category_interface() and objc_start_category_implementation(). (protocoldef): Move semantic actions to objc_start_protocol() and objc_finish_interface(). (ivar_decl_list): Remove nonterminal. (visibility_spec): Move semantic actions to objc_set_visibility(). (ivar_decls): Remove assignment to $$. (ivar_decl): Rephrase in terms of component_decl; call objc_add_instance_variable(). (ivars, ivar_declarator): Remove nonterminals. (opt_semi): New nonterminal. (methodtype): Remove semantic actions. (methoddef): Move semantic actions to objc_set_method_type(), objc_start_method_definition() and objc_finish_method_definition(). (methodproto): Move semantic actions to objc_set_method_type() and objc_add_method_declaration(). (methoddecl): Use objc_typename instead of typename; move semantic actions to objc_build_method_signature(). (optarglist, myxdecls, mydecl, myparms, myparm): Remove nonterminals. (optparmlist): Express in terms of optparms and optellipsis. (optparms, optellipsis, objc_qual, objc_quals, objc_typename): New nonterminals. (keyworddecl): Use objc_typename instead of typename. (rid_to_yy): Mark RID_IN, RID_OUT, RID_INOUT, RID_BYCOPY, RID_BYREF and RID_ONEWAY as returning OBJC_TYPE_QUAL to yyparse(). [gcc/objc/ChangeLog] 2004-09-07 Ziemowit Laski <zlaski@apple.com> * Make-lang.in (objc/objc-parse.o): Depend on $(C_COMMON_H) instead of objc/objc-act.h. (objc/objc-act.o): Depend on $(HASHTAB_H). * objc-act.c: Include hashtab.h; in ObjC++ mode, include cp-tree.h and objcp-decl.h instead of c-tree.h. (build_module_descriptor, get_class_ivars, synth_id_with_class_suffix, error_with_ivar, gen_method_decl, gen_declaration, setup_string_decl, build_protocol_template): Adjust prototypes. (build_module_initializer_routine, start_class, continue_class, finish_class, start_method_def, objc_start_function, start_protocol, build_method_decl, objc_add_method, add_instance_variable, build_ivar_reference, is_ivar, is_private, get_super_receiver, build_selector_table_decl, objc_push_parm, objc_get_parm_info, gen_type_name, gen_type_name_0, start_var_decl, finish_var_decl, create_field_decl): New prototypes. (objc_expand_function_end, comp_method_with_proto, objc_expr_last, gen_declaration_1, gen_declarator, is_complex_decl, adorn_decl, define_decl, create_builtin_decl, gen_declspecs): Remove prototypes. (TYPE_ID): Rename to OBJECT_TYPEDEF_NAME. (CLASS_TYPEDEF_NAME): New. (TAG_EXECCLASS): Change from a global variable to a #define. (TAG_RETURN_STRUCT): Delete. (TAG_GNUINIT): New, holds '__objc_gnu_init' name. (objc_inherit_code, objc_public_flag): New, moved from c-parse.in. (string_descriptor): New struct. (string_htab): New hash table. (string_hash, string_eq): New prototypes. (generate_struct_by_value_array): Call create_field_decl() instead of create_builtin_decl(). (objc_init): Do not initialize objc_ellipsis_node or TAG_EXECCLASS; In ObjC++ mode, call cxx_init() instead of c_objc_common_init(). (objc_finish_file): In ObjC++, call instantiate_pending_templates() and cp_finish_file(). (define_decl, get_static_reference, get_protocol_reference, create_builtin_decl): Remove functions. (objc_start_class_interface, objc_start_category_interface, objc_start_protocol, objc_continue_interface, objc_finish_interface, objc_start_class_implementation, objc_start_category_implementation, objc_continue_implementation, objc_finish_implementation, objc_set_visibility, objc_set_method_type, objc_build_method_signature, objc_add_method_declaration, objc_start_method_definition, objc_add_instance_variable, objc_get_protocol_qualified_type, create_field_decl, start_var_decl, finish_var_decl): New functions. (setup_string_decl): Simplify since it is only called once. (synth_module_prologue): Call build_class_template(); predefine 'id' and 'Class' as typedefs; rename 'temp_type' to 'type'; disable debug hooks for duration of function; fix GNU runtime messenger signatures to correspond to reality; forward-declare '__objc_exec_class' for the GNU runtime; call build_selector_table_decl(); in ObjC++ mode, generate 'extern "C" { ... }' wrappers around synthesized declarations; call build_protocol_template() and build_category_template(). (string_hash, string_eq): New functions. (objc_build_string_object): Check metaclass correctness only once; store string literals in hash table. (objc_build_constructor): Do not convert initializer elements; adjust for ObjC++ impedance mismatch. (build_objc_symtab_template): Call create_field_decl() instead of create_builtin_decl(). (init_objc_symtab): Add missing conversion to initializer element. (build_metadata_decl): Call start_var_decl() instead of define_decl(). (generate_objc_symtab_decl): Do not call build_category_template(); call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(). (build_module_descriptor): Call create_field_decl() instead of grokfield(); call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(); always mark module descriptor as used; move GNU runtime-specific functionality to build_module_initializer_routine(). (build_module_initializer_routine): New function, broken off of build_module_descriptor(). (objc_static_init_needed_p, objc_generate_static_init_call): New functions. (generate_static_references, generate_strings, build_selector_translation_table, generate_descriptor_table, generate_ivars_list, generate_dispatch_table, generate_category): Call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(); build a type directly instead of via groktypename(). (build_selector_reference_decl, build_selector_table_decl, build_class_reference_decl, build_protocol_reference, generate_objc_image_info): Call start_var_decl() instead of build_decl(). (build_selector_reference): For GNU runtime, do not call build_selector_reference_decl(). (build_selector, build_typed_selector_reference): Always convert result to the selector type. (add_objc_string): Cast return value to 'char *'. (build_method_prototype_template, build_selector_template, build_method_template): Use actual selector type for fields pointing to selectors. (finish_objc): For GNU runtime, call build_module_initializer_routine() after build_module_descriptor(). (generate_protocol_list, generate_shared_structures): Call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(); build a type directly instead of via groktypename(). (synth_id_with_class_suffix): Return a string. (get_arg_type_list): For instance methods, use the instance type for 'self'; do not call groktypename_in_parm_context(). (build_objc_string_decl): Squash redeclaration errors in ObjC++. (objc_is_class_name): Use OBJC_TYPE_NAME instead of TYPE_NAME; handle RECORD_TYPEs in ObjC as well as ObjC++. (objc_is_id): New function. (objc_is_object_ptr): Return the canonical type node. (objc_get_class_ivars): Simplify using get_class_ivars(). (get_class_ivars): Remove second parameter; create a fresh copy of the ivar list for each call; do not check for existence of super class. (objc_eh_runtime_type): Mark #ifndef OBJCPLUS. (objc_init_exceptions): When using SJLJ-style exceptions, require the use of '-fobjc-exceptions' flag; do not require it for DWARF-style exceptions. (objc_build_exc_ptr, next_sjlj_build_try_catch_finally): Use objc_object_type instead of objc_id_type. (objc_begin_catch_clause): Convert the incoming PARM_DECL into a VAR_DECL before placing it in the appropriate scope; do not call define_decl(); adjust call to c_begin_compound_stmt(); use objc_object_type instead of objc_id_type. (build_next_objc_exception_stuff): Call create_field_decl() instead of create_builtin_decl(); construct type directly instead of calling groktypename(); use OBJC_VOID_AT_END to mark end of function parameters. (build_private_template): Adjust call to get_class_ivars(); build a type directly instead of via groktypename(). (build_protocol_template, build_method_prototype_list_template, build_method_prototype_template, build_category_template, build_selector_template, build_class_template, build_super_template, build_ivar_template, build_ivar_list_template, build_method_list_template, build_method_template): Call create_field_decl() instead of grokfield(). (objc_method_parm_type): Do not call groktypename(). (generate_descriptor_table): Call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(). (generate_method_descriptors, build_protocol_initializer, generate_dispatch_tables, build_category_initializer, build_shared_structure_initializer): Do not call groktypename(). (generate_protocols): Call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(); do not call groktypename(). (error_with_ivar): Remove last parameter. (check_ivars): Do not iterate ovar CLASS_RAW_IVARS lists in addition to CLASS_IVARS lists; adjust calls to error_with_ivar(). (generate_ivar_lists): Convert one of the initializer elements; do not call groktypename(). (get_arg_type_list, start_method_def, gen_method_def): Account for new representation of variable arguments and '...' in Objective-C methods; add Objective-C++ impedance matching code. (is_objc_type_qualifier): Remove function. (adjust_type_for_id_default): Simplify; there is no longer a need to wade through declspecs. (lookup_interface, start_class, continue_class, finish_class, start_method_def, start_protocol, build_method_decl, objc_add_method, add_instance_variable, build_ivar_reference, is_ivar, is_private, get_super_receiver, objc_build_finally_epilogue): Make into static functions. (receiver_is_class_object): Use new IS_CLASS() macro. (objc_build_message_expr): Tweak ObjC++ message argument handling; call objc_finish_message_expr() instead of finish_message_expr(). (finish_message_expr): Rename to objc_finish_message_expr(); use OBJC_TYPE_NAME and OBJC_SET_TYPE_NAME macros instead of TYPE_NAME. call gen_type_name() instead of gen_declaration(); call objc_is_id() instead of using IS_ID and IS_CLASS; Use objc_class_name instead of calling get_identifier("Class"); handle CONVERT_EXPRs in receiver. (build_objc_method_call, warn_with_method): Do not call groktypename(). (build_ivar_reference): Call convert() instead of clobbering in a type. (hash_init): Initialize string_htab hash table. (add_instance_variable): Simplify parameter list; do not call grokfield(); do not populate CLASS_IVARS list. (start_class): Check for the existence of super class, if one was specified. (continue_class): Use CLASS_RAW_IVARS rather than CLASS_IVARS; do not call build_class_template(); adjust call to get_class_ivars(); call build_decl(), pushdecl() and finish_decl() instead of define_decl(). (finish_class): Call build_decl(), pushdecl() and finish_decl() instead of define_decl(). (add_protocols): Use PROTOCOL_BINFO_ELTS for the tree vector size. (start_protocol): Do not call build_protocol_template(); use PROTOCOL_BINFO_ELTS for the tree vector size. (encode_type_qualifiers): Do not handle the 'const' qualifier here. (encode_pointer): Encode 'const char *' as 'r*', for backwards compatibility. (encode_array): Use HOST_WIDE_INT_PRINT_DEC instead of "%ld". (encode_type): Handle the 'const' qualifier here. (objc_parmlist): New global variable, sued by objc_push_parm and objc_get_parm_info(). (objc_push_parm, objc_get_parm_info): New functions. (objc_expr_last): Remove function. (synth_self_and_ucmd_args): For instance methods, use the instance type for 'self'; call objc_push_parm() instead of push_parm_decl(). (start_method_def): Do not call push_scope(), declare_parm_level(), pop_scope(), push_parm_decl(), store_parm_decls() or objc_expr_last(); just use objc_push_parm() and objc_get_parm_info(). (comp_method_with_proto): Remove function. (objc_types_are_equivalent): Strip away indirections before comparing underlying types. (comp_proto_with_proto): Do not call groktypename(); types are no longer in raw declspec format. (objc_start_function): New function. (really_start_method): Call comp_proto_with_proto() instead of comp_method_with_proto(); call objc_start_function() instead of hand-crafting a function declarator. (continue_method_def, objc_expand_function_end): Remove functions. (get_super_receiver): Call objc_get_current_scope() instead of get_current_scope(); reference 'super_class' field (instead of 'class'). (finish_method_def): Rename to objc_finish_method_definition() and add a function decl parameter; move method encoding call from objc_expand_function_end(). (is_complex_decl, adorn_decl, gen_declarator, gen_declspecs, gen_declaration_1): Remove functions. (tmpbuf, RAW_DECLSPEC): Remove. (gen_declaration): Remove second parameter; simplify to deal with TYPE_P nodes instead of raw declspecs. (gen_type_name, gen_type_name_0): New functions. (gen_method_decl): Remove second parameter; call gen_type_name() instead of gen_declaration_1(). (dump_interface): Adjust calls to gen_declaration() and gen_method_decl(); do not allocate a separate string buffer. (init_objc): Allocate a larger string buffer to accommodate dump_interface(); adjust call to build_module_descriptor(); add call to build_module_initializer_routine() for the GNU runtime. (generate_classref_translation_entry): Do not call start_decl(); call finish_var_decl() instead of finish_decl(); call convert() instead of build_c_cast(). * objc-act.h (CLASS_OWN_IVARS): Remove accessor. (CLASS_BINFO_ELTS): Reduce from 6 to 5, now that CLASS_OWN_IVARS is gone. (OCTI_GNU_INIT_DECL, GNU_INIT_decl): New. (OCTI_ELLIPSIS_NODE, objc_ellipsis_node): Remove. (OCTI_ID_ID, id_type, objc_id_id): Rename to OCTI_ID_NAME, objc_object_type and objc_object_name, respectively. (OCTI_CLS_REF, OCTI_CLASS_NAME, objc_class_reference, objc_class_name): New. (IS_CLASS): New macro. (IS_ID, IS_SUPER): Robustify. (OCTI_EXECCLASS_DECL, execclass_decl): New. (finish_file, start_class, continue_class, finish_class, start_method_def, continue_method_def, finish_method_def, start_protocol, finish_protocol, objc_build_throw_stmt, objc_build_try_catch_finally_stmt, objc_build_synchronized_prologue, objc_build_synchronized_epilogue, objc_build_try_prologue, objc_build_try_epilogue, objc_build_catch_stmt, objc_build_catch_epilogue, objc_build_finally_prologue, objc_build_finally_epilogue, is_ivar, is_private, is_public, add_instance_variable, objc_add_method, get_super_receiver, objc_clear_super_receiver, get_class_ivars_from_name, get_class_reference, get_static_reference, get_object_reference, build_message_expr, finish_message_expr, build_selector_expr, build_ivar_reference, build_keyword_decl, build_method_decl, build_protocol_expr, build_objc_string_object, objc_declare_alias, objc_declare_class, objc_declare_protocols, objc_comptypes, objc_check_decl, build_encode_expr): Remove prototypes. (imp_count, cat_count): Make GGC-aware. (OBJC_SET_TYPE_NAME): New macro. From-SVN: r87168
2004-09-08 02:49:44 +02:00
#ifdef OBJCPLUS
method_params = chainon (args, TREE_VALUE (TREE_VALUE (mess)));
#else
1992-01-18 00:15:38 +01:00
{
tree chain = args, prev = NULL_TREE;
1992-01-18 00:15:38 +01:00
/* We have a keyword selector--check for comma expressions. */
while (chain)
{
tree element = TREE_VALUE (chain);
/* We have a comma expression, must collapse... */
if (TREE_CODE (element) == TREE_LIST)
{
if (prev)
TREE_CHAIN (prev) = element;
else
args = element;
}
prev = chain;
chain = TREE_CHAIN (chain);
}
method_params = args;
}
Makefile.in (c-parse.o): Depend on $(C_COMMON_H). [gcc/ChangeLog] 2004-09-07 Ziemowit Laski <zlaski@apple.com> * Makefile.in (c-parse.o): Depend on $(C_COMMON_H). * c-parse.in: Include c-common.h instead of objc-act.h. (ivar_decl_list, ivar_decls, ivar_decl, ivars, ivar_declarator, myparms, myparm): Remove %type declarations. (methodtype, optparms, OBJC_TYPE_QUAL, objc_quals, objc_qual, objc_typename, objc_try_catch_stmt, optellipsis): Add %type declarations. (objc_inherit_code, objc_public_flag): Remove. (typespec_nonreserved_nonattr): Call objc_get_protocol_qualified_type() instead of get_static_reference() and get_protocol_reference(). (stmt_nocomp): Call grokparm() on @catch parameter. (objcdef): Move semantic action to objc_finish_implementation(). (classdef): Move semantic action to objc_start_class_interface(), objc_continue_interface(), objc_finish_interface(), objc_start_class_implementation(), objc_continue_implementation(), objc_start_category_interface() and objc_start_category_implementation(). (protocoldef): Move semantic actions to objc_start_protocol() and objc_finish_interface(). (ivar_decl_list): Remove nonterminal. (visibility_spec): Move semantic actions to objc_set_visibility(). (ivar_decls): Remove assignment to $$. (ivar_decl): Rephrase in terms of component_decl; call objc_add_instance_variable(). (ivars, ivar_declarator): Remove nonterminals. (opt_semi): New nonterminal. (methodtype): Remove semantic actions. (methoddef): Move semantic actions to objc_set_method_type(), objc_start_method_definition() and objc_finish_method_definition(). (methodproto): Move semantic actions to objc_set_method_type() and objc_add_method_declaration(). (methoddecl): Use objc_typename instead of typename; move semantic actions to objc_build_method_signature(). (optarglist, myxdecls, mydecl, myparms, myparm): Remove nonterminals. (optparmlist): Express in terms of optparms and optellipsis. (optparms, optellipsis, objc_qual, objc_quals, objc_typename): New nonterminals. (keyworddecl): Use objc_typename instead of typename. (rid_to_yy): Mark RID_IN, RID_OUT, RID_INOUT, RID_BYCOPY, RID_BYREF and RID_ONEWAY as returning OBJC_TYPE_QUAL to yyparse(). [gcc/objc/ChangeLog] 2004-09-07 Ziemowit Laski <zlaski@apple.com> * Make-lang.in (objc/objc-parse.o): Depend on $(C_COMMON_H) instead of objc/objc-act.h. (objc/objc-act.o): Depend on $(HASHTAB_H). * objc-act.c: Include hashtab.h; in ObjC++ mode, include cp-tree.h and objcp-decl.h instead of c-tree.h. (build_module_descriptor, get_class_ivars, synth_id_with_class_suffix, error_with_ivar, gen_method_decl, gen_declaration, setup_string_decl, build_protocol_template): Adjust prototypes. (build_module_initializer_routine, start_class, continue_class, finish_class, start_method_def, objc_start_function, start_protocol, build_method_decl, objc_add_method, add_instance_variable, build_ivar_reference, is_ivar, is_private, get_super_receiver, build_selector_table_decl, objc_push_parm, objc_get_parm_info, gen_type_name, gen_type_name_0, start_var_decl, finish_var_decl, create_field_decl): New prototypes. (objc_expand_function_end, comp_method_with_proto, objc_expr_last, gen_declaration_1, gen_declarator, is_complex_decl, adorn_decl, define_decl, create_builtin_decl, gen_declspecs): Remove prototypes. (TYPE_ID): Rename to OBJECT_TYPEDEF_NAME. (CLASS_TYPEDEF_NAME): New. (TAG_EXECCLASS): Change from a global variable to a #define. (TAG_RETURN_STRUCT): Delete. (TAG_GNUINIT): New, holds '__objc_gnu_init' name. (objc_inherit_code, objc_public_flag): New, moved from c-parse.in. (string_descriptor): New struct. (string_htab): New hash table. (string_hash, string_eq): New prototypes. (generate_struct_by_value_array): Call create_field_decl() instead of create_builtin_decl(). (objc_init): Do not initialize objc_ellipsis_node or TAG_EXECCLASS; In ObjC++ mode, call cxx_init() instead of c_objc_common_init(). (objc_finish_file): In ObjC++, call instantiate_pending_templates() and cp_finish_file(). (define_decl, get_static_reference, get_protocol_reference, create_builtin_decl): Remove functions. (objc_start_class_interface, objc_start_category_interface, objc_start_protocol, objc_continue_interface, objc_finish_interface, objc_start_class_implementation, objc_start_category_implementation, objc_continue_implementation, objc_finish_implementation, objc_set_visibility, objc_set_method_type, objc_build_method_signature, objc_add_method_declaration, objc_start_method_definition, objc_add_instance_variable, objc_get_protocol_qualified_type, create_field_decl, start_var_decl, finish_var_decl): New functions. (setup_string_decl): Simplify since it is only called once. (synth_module_prologue): Call build_class_template(); predefine 'id' and 'Class' as typedefs; rename 'temp_type' to 'type'; disable debug hooks for duration of function; fix GNU runtime messenger signatures to correspond to reality; forward-declare '__objc_exec_class' for the GNU runtime; call build_selector_table_decl(); in ObjC++ mode, generate 'extern "C" { ... }' wrappers around synthesized declarations; call build_protocol_template() and build_category_template(). (string_hash, string_eq): New functions. (objc_build_string_object): Check metaclass correctness only once; store string literals in hash table. (objc_build_constructor): Do not convert initializer elements; adjust for ObjC++ impedance mismatch. (build_objc_symtab_template): Call create_field_decl() instead of create_builtin_decl(). (init_objc_symtab): Add missing conversion to initializer element. (build_metadata_decl): Call start_var_decl() instead of define_decl(). (generate_objc_symtab_decl): Do not call build_category_template(); call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(). (build_module_descriptor): Call create_field_decl() instead of grokfield(); call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(); always mark module descriptor as used; move GNU runtime-specific functionality to build_module_initializer_routine(). (build_module_initializer_routine): New function, broken off of build_module_descriptor(). (objc_static_init_needed_p, objc_generate_static_init_call): New functions. (generate_static_references, generate_strings, build_selector_translation_table, generate_descriptor_table, generate_ivars_list, generate_dispatch_table, generate_category): Call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(); build a type directly instead of via groktypename(). (build_selector_reference_decl, build_selector_table_decl, build_class_reference_decl, build_protocol_reference, generate_objc_image_info): Call start_var_decl() instead of build_decl(). (build_selector_reference): For GNU runtime, do not call build_selector_reference_decl(). (build_selector, build_typed_selector_reference): Always convert result to the selector type. (add_objc_string): Cast return value to 'char *'. (build_method_prototype_template, build_selector_template, build_method_template): Use actual selector type for fields pointing to selectors. (finish_objc): For GNU runtime, call build_module_initializer_routine() after build_module_descriptor(). (generate_protocol_list, generate_shared_structures): Call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(); build a type directly instead of via groktypename(). (synth_id_with_class_suffix): Return a string. (get_arg_type_list): For instance methods, use the instance type for 'self'; do not call groktypename_in_parm_context(). (build_objc_string_decl): Squash redeclaration errors in ObjC++. (objc_is_class_name): Use OBJC_TYPE_NAME instead of TYPE_NAME; handle RECORD_TYPEs in ObjC as well as ObjC++. (objc_is_id): New function. (objc_is_object_ptr): Return the canonical type node. (objc_get_class_ivars): Simplify using get_class_ivars(). (get_class_ivars): Remove second parameter; create a fresh copy of the ivar list for each call; do not check for existence of super class. (objc_eh_runtime_type): Mark #ifndef OBJCPLUS. (objc_init_exceptions): When using SJLJ-style exceptions, require the use of '-fobjc-exceptions' flag; do not require it for DWARF-style exceptions. (objc_build_exc_ptr, next_sjlj_build_try_catch_finally): Use objc_object_type instead of objc_id_type. (objc_begin_catch_clause): Convert the incoming PARM_DECL into a VAR_DECL before placing it in the appropriate scope; do not call define_decl(); adjust call to c_begin_compound_stmt(); use objc_object_type instead of objc_id_type. (build_next_objc_exception_stuff): Call create_field_decl() instead of create_builtin_decl(); construct type directly instead of calling groktypename(); use OBJC_VOID_AT_END to mark end of function parameters. (build_private_template): Adjust call to get_class_ivars(); build a type directly instead of via groktypename(). (build_protocol_template, build_method_prototype_list_template, build_method_prototype_template, build_category_template, build_selector_template, build_class_template, build_super_template, build_ivar_template, build_ivar_list_template, build_method_list_template, build_method_template): Call create_field_decl() instead of grokfield(). (objc_method_parm_type): Do not call groktypename(). (generate_descriptor_table): Call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(). (generate_method_descriptors, build_protocol_initializer, generate_dispatch_tables, build_category_initializer, build_shared_structure_initializer): Do not call groktypename(). (generate_protocols): Call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(); do not call groktypename(). (error_with_ivar): Remove last parameter. (check_ivars): Do not iterate ovar CLASS_RAW_IVARS lists in addition to CLASS_IVARS lists; adjust calls to error_with_ivar(). (generate_ivar_lists): Convert one of the initializer elements; do not call groktypename(). (get_arg_type_list, start_method_def, gen_method_def): Account for new representation of variable arguments and '...' in Objective-C methods; add Objective-C++ impedance matching code. (is_objc_type_qualifier): Remove function. (adjust_type_for_id_default): Simplify; there is no longer a need to wade through declspecs. (lookup_interface, start_class, continue_class, finish_class, start_method_def, start_protocol, build_method_decl, objc_add_method, add_instance_variable, build_ivar_reference, is_ivar, is_private, get_super_receiver, objc_build_finally_epilogue): Make into static functions. (receiver_is_class_object): Use new IS_CLASS() macro. (objc_build_message_expr): Tweak ObjC++ message argument handling; call objc_finish_message_expr() instead of finish_message_expr(). (finish_message_expr): Rename to objc_finish_message_expr(); use OBJC_TYPE_NAME and OBJC_SET_TYPE_NAME macros instead of TYPE_NAME. call gen_type_name() instead of gen_declaration(); call objc_is_id() instead of using IS_ID and IS_CLASS; Use objc_class_name instead of calling get_identifier("Class"); handle CONVERT_EXPRs in receiver. (build_objc_method_call, warn_with_method): Do not call groktypename(). (build_ivar_reference): Call convert() instead of clobbering in a type. (hash_init): Initialize string_htab hash table. (add_instance_variable): Simplify parameter list; do not call grokfield(); do not populate CLASS_IVARS list. (start_class): Check for the existence of super class, if one was specified. (continue_class): Use CLASS_RAW_IVARS rather than CLASS_IVARS; do not call build_class_template(); adjust call to get_class_ivars(); call build_decl(), pushdecl() and finish_decl() instead of define_decl(). (finish_class): Call build_decl(), pushdecl() and finish_decl() instead of define_decl(). (add_protocols): Use PROTOCOL_BINFO_ELTS for the tree vector size. (start_protocol): Do not call build_protocol_template(); use PROTOCOL_BINFO_ELTS for the tree vector size. (encode_type_qualifiers): Do not handle the 'const' qualifier here. (encode_pointer): Encode 'const char *' as 'r*', for backwards compatibility. (encode_array): Use HOST_WIDE_INT_PRINT_DEC instead of "%ld". (encode_type): Handle the 'const' qualifier here. (objc_parmlist): New global variable, sued by objc_push_parm and objc_get_parm_info(). (objc_push_parm, objc_get_parm_info): New functions. (objc_expr_last): Remove function. (synth_self_and_ucmd_args): For instance methods, use the instance type for 'self'; call objc_push_parm() instead of push_parm_decl(). (start_method_def): Do not call push_scope(), declare_parm_level(), pop_scope(), push_parm_decl(), store_parm_decls() or objc_expr_last(); just use objc_push_parm() and objc_get_parm_info(). (comp_method_with_proto): Remove function. (objc_types_are_equivalent): Strip away indirections before comparing underlying types. (comp_proto_with_proto): Do not call groktypename(); types are no longer in raw declspec format. (objc_start_function): New function. (really_start_method): Call comp_proto_with_proto() instead of comp_method_with_proto(); call objc_start_function() instead of hand-crafting a function declarator. (continue_method_def, objc_expand_function_end): Remove functions. (get_super_receiver): Call objc_get_current_scope() instead of get_current_scope(); reference 'super_class' field (instead of 'class'). (finish_method_def): Rename to objc_finish_method_definition() and add a function decl parameter; move method encoding call from objc_expand_function_end(). (is_complex_decl, adorn_decl, gen_declarator, gen_declspecs, gen_declaration_1): Remove functions. (tmpbuf, RAW_DECLSPEC): Remove. (gen_declaration): Remove second parameter; simplify to deal with TYPE_P nodes instead of raw declspecs. (gen_type_name, gen_type_name_0): New functions. (gen_method_decl): Remove second parameter; call gen_type_name() instead of gen_declaration_1(). (dump_interface): Adjust calls to gen_declaration() and gen_method_decl(); do not allocate a separate string buffer. (init_objc): Allocate a larger string buffer to accommodate dump_interface(); adjust call to build_module_descriptor(); add call to build_module_initializer_routine() for the GNU runtime. (generate_classref_translation_entry): Do not call start_decl(); call finish_var_decl() instead of finish_decl(); call convert() instead of build_c_cast(). * objc-act.h (CLASS_OWN_IVARS): Remove accessor. (CLASS_BINFO_ELTS): Reduce from 6 to 5, now that CLASS_OWN_IVARS is gone. (OCTI_GNU_INIT_DECL, GNU_INIT_decl): New. (OCTI_ELLIPSIS_NODE, objc_ellipsis_node): Remove. (OCTI_ID_ID, id_type, objc_id_id): Rename to OCTI_ID_NAME, objc_object_type and objc_object_name, respectively. (OCTI_CLS_REF, OCTI_CLASS_NAME, objc_class_reference, objc_class_name): New. (IS_CLASS): New macro. (IS_ID, IS_SUPER): Robustify. (OCTI_EXECCLASS_DECL, execclass_decl): New. (finish_file, start_class, continue_class, finish_class, start_method_def, continue_method_def, finish_method_def, start_protocol, finish_protocol, objc_build_throw_stmt, objc_build_try_catch_finally_stmt, objc_build_synchronized_prologue, objc_build_synchronized_epilogue, objc_build_try_prologue, objc_build_try_epilogue, objc_build_catch_stmt, objc_build_catch_epilogue, objc_build_finally_prologue, objc_build_finally_epilogue, is_ivar, is_private, is_public, add_instance_variable, objc_add_method, get_super_receiver, objc_clear_super_receiver, get_class_ivars_from_name, get_class_reference, get_static_reference, get_object_reference, build_message_expr, finish_message_expr, build_selector_expr, build_ivar_reference, build_keyword_decl, build_method_decl, build_protocol_expr, build_objc_string_object, objc_declare_alias, objc_declare_class, objc_declare_protocols, objc_comptypes, objc_check_decl, build_encode_expr): Remove prototypes. (imp_count, cat_count): Make GGC-aware. (OBJC_SET_TYPE_NAME): New macro. From-SVN: r87168
2004-09-08 02:49:44 +02:00
#endif
1992-01-18 00:15:38 +01:00
#ifdef OBJCPLUS
if (processing_template_decl)
/* Must wait until template instantiation time. */
return build_min_nt (MESSAGE_SEND_EXPR, receiver, sel_name,
method_params);
#endif
Makefile.in (c-parse.o): Depend on $(C_COMMON_H). [gcc/ChangeLog] 2004-09-07 Ziemowit Laski <zlaski@apple.com> * Makefile.in (c-parse.o): Depend on $(C_COMMON_H). * c-parse.in: Include c-common.h instead of objc-act.h. (ivar_decl_list, ivar_decls, ivar_decl, ivars, ivar_declarator, myparms, myparm): Remove %type declarations. (methodtype, optparms, OBJC_TYPE_QUAL, objc_quals, objc_qual, objc_typename, objc_try_catch_stmt, optellipsis): Add %type declarations. (objc_inherit_code, objc_public_flag): Remove. (typespec_nonreserved_nonattr): Call objc_get_protocol_qualified_type() instead of get_static_reference() and get_protocol_reference(). (stmt_nocomp): Call grokparm() on @catch parameter. (objcdef): Move semantic action to objc_finish_implementation(). (classdef): Move semantic action to objc_start_class_interface(), objc_continue_interface(), objc_finish_interface(), objc_start_class_implementation(), objc_continue_implementation(), objc_start_category_interface() and objc_start_category_implementation(). (protocoldef): Move semantic actions to objc_start_protocol() and objc_finish_interface(). (ivar_decl_list): Remove nonterminal. (visibility_spec): Move semantic actions to objc_set_visibility(). (ivar_decls): Remove assignment to $$. (ivar_decl): Rephrase in terms of component_decl; call objc_add_instance_variable(). (ivars, ivar_declarator): Remove nonterminals. (opt_semi): New nonterminal. (methodtype): Remove semantic actions. (methoddef): Move semantic actions to objc_set_method_type(), objc_start_method_definition() and objc_finish_method_definition(). (methodproto): Move semantic actions to objc_set_method_type() and objc_add_method_declaration(). (methoddecl): Use objc_typename instead of typename; move semantic actions to objc_build_method_signature(). (optarglist, myxdecls, mydecl, myparms, myparm): Remove nonterminals. (optparmlist): Express in terms of optparms and optellipsis. (optparms, optellipsis, objc_qual, objc_quals, objc_typename): New nonterminals. (keyworddecl): Use objc_typename instead of typename. (rid_to_yy): Mark RID_IN, RID_OUT, RID_INOUT, RID_BYCOPY, RID_BYREF and RID_ONEWAY as returning OBJC_TYPE_QUAL to yyparse(). [gcc/objc/ChangeLog] 2004-09-07 Ziemowit Laski <zlaski@apple.com> * Make-lang.in (objc/objc-parse.o): Depend on $(C_COMMON_H) instead of objc/objc-act.h. (objc/objc-act.o): Depend on $(HASHTAB_H). * objc-act.c: Include hashtab.h; in ObjC++ mode, include cp-tree.h and objcp-decl.h instead of c-tree.h. (build_module_descriptor, get_class_ivars, synth_id_with_class_suffix, error_with_ivar, gen_method_decl, gen_declaration, setup_string_decl, build_protocol_template): Adjust prototypes. (build_module_initializer_routine, start_class, continue_class, finish_class, start_method_def, objc_start_function, start_protocol, build_method_decl, objc_add_method, add_instance_variable, build_ivar_reference, is_ivar, is_private, get_super_receiver, build_selector_table_decl, objc_push_parm, objc_get_parm_info, gen_type_name, gen_type_name_0, start_var_decl, finish_var_decl, create_field_decl): New prototypes. (objc_expand_function_end, comp_method_with_proto, objc_expr_last, gen_declaration_1, gen_declarator, is_complex_decl, adorn_decl, define_decl, create_builtin_decl, gen_declspecs): Remove prototypes. (TYPE_ID): Rename to OBJECT_TYPEDEF_NAME. (CLASS_TYPEDEF_NAME): New. (TAG_EXECCLASS): Change from a global variable to a #define. (TAG_RETURN_STRUCT): Delete. (TAG_GNUINIT): New, holds '__objc_gnu_init' name. (objc_inherit_code, objc_public_flag): New, moved from c-parse.in. (string_descriptor): New struct. (string_htab): New hash table. (string_hash, string_eq): New prototypes. (generate_struct_by_value_array): Call create_field_decl() instead of create_builtin_decl(). (objc_init): Do not initialize objc_ellipsis_node or TAG_EXECCLASS; In ObjC++ mode, call cxx_init() instead of c_objc_common_init(). (objc_finish_file): In ObjC++, call instantiate_pending_templates() and cp_finish_file(). (define_decl, get_static_reference, get_protocol_reference, create_builtin_decl): Remove functions. (objc_start_class_interface, objc_start_category_interface, objc_start_protocol, objc_continue_interface, objc_finish_interface, objc_start_class_implementation, objc_start_category_implementation, objc_continue_implementation, objc_finish_implementation, objc_set_visibility, objc_set_method_type, objc_build_method_signature, objc_add_method_declaration, objc_start_method_definition, objc_add_instance_variable, objc_get_protocol_qualified_type, create_field_decl, start_var_decl, finish_var_decl): New functions. (setup_string_decl): Simplify since it is only called once. (synth_module_prologue): Call build_class_template(); predefine 'id' and 'Class' as typedefs; rename 'temp_type' to 'type'; disable debug hooks for duration of function; fix GNU runtime messenger signatures to correspond to reality; forward-declare '__objc_exec_class' for the GNU runtime; call build_selector_table_decl(); in ObjC++ mode, generate 'extern "C" { ... }' wrappers around synthesized declarations; call build_protocol_template() and build_category_template(). (string_hash, string_eq): New functions. (objc_build_string_object): Check metaclass correctness only once; store string literals in hash table. (objc_build_constructor): Do not convert initializer elements; adjust for ObjC++ impedance mismatch. (build_objc_symtab_template): Call create_field_decl() instead of create_builtin_decl(). (init_objc_symtab): Add missing conversion to initializer element. (build_metadata_decl): Call start_var_decl() instead of define_decl(). (generate_objc_symtab_decl): Do not call build_category_template(); call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(). (build_module_descriptor): Call create_field_decl() instead of grokfield(); call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(); always mark module descriptor as used; move GNU runtime-specific functionality to build_module_initializer_routine(). (build_module_initializer_routine): New function, broken off of build_module_descriptor(). (objc_static_init_needed_p, objc_generate_static_init_call): New functions. (generate_static_references, generate_strings, build_selector_translation_table, generate_descriptor_table, generate_ivars_list, generate_dispatch_table, generate_category): Call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(); build a type directly instead of via groktypename(). (build_selector_reference_decl, build_selector_table_decl, build_class_reference_decl, build_protocol_reference, generate_objc_image_info): Call start_var_decl() instead of build_decl(). (build_selector_reference): For GNU runtime, do not call build_selector_reference_decl(). (build_selector, build_typed_selector_reference): Always convert result to the selector type. (add_objc_string): Cast return value to 'char *'. (build_method_prototype_template, build_selector_template, build_method_template): Use actual selector type for fields pointing to selectors. (finish_objc): For GNU runtime, call build_module_initializer_routine() after build_module_descriptor(). (generate_protocol_list, generate_shared_structures): Call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(); build a type directly instead of via groktypename(). (synth_id_with_class_suffix): Return a string. (get_arg_type_list): For instance methods, use the instance type for 'self'; do not call groktypename_in_parm_context(). (build_objc_string_decl): Squash redeclaration errors in ObjC++. (objc_is_class_name): Use OBJC_TYPE_NAME instead of TYPE_NAME; handle RECORD_TYPEs in ObjC as well as ObjC++. (objc_is_id): New function. (objc_is_object_ptr): Return the canonical type node. (objc_get_class_ivars): Simplify using get_class_ivars(). (get_class_ivars): Remove second parameter; create a fresh copy of the ivar list for each call; do not check for existence of super class. (objc_eh_runtime_type): Mark #ifndef OBJCPLUS. (objc_init_exceptions): When using SJLJ-style exceptions, require the use of '-fobjc-exceptions' flag; do not require it for DWARF-style exceptions. (objc_build_exc_ptr, next_sjlj_build_try_catch_finally): Use objc_object_type instead of objc_id_type. (objc_begin_catch_clause): Convert the incoming PARM_DECL into a VAR_DECL before placing it in the appropriate scope; do not call define_decl(); adjust call to c_begin_compound_stmt(); use objc_object_type instead of objc_id_type. (build_next_objc_exception_stuff): Call create_field_decl() instead of create_builtin_decl(); construct type directly instead of calling groktypename(); use OBJC_VOID_AT_END to mark end of function parameters. (build_private_template): Adjust call to get_class_ivars(); build a type directly instead of via groktypename(). (build_protocol_template, build_method_prototype_list_template, build_method_prototype_template, build_category_template, build_selector_template, build_class_template, build_super_template, build_ivar_template, build_ivar_list_template, build_method_list_template, build_method_template): Call create_field_decl() instead of grokfield(). (objc_method_parm_type): Do not call groktypename(). (generate_descriptor_table): Call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(). (generate_method_descriptors, build_protocol_initializer, generate_dispatch_tables, build_category_initializer, build_shared_structure_initializer): Do not call groktypename(). (generate_protocols): Call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(); do not call groktypename(). (error_with_ivar): Remove last parameter. (check_ivars): Do not iterate ovar CLASS_RAW_IVARS lists in addition to CLASS_IVARS lists; adjust calls to error_with_ivar(). (generate_ivar_lists): Convert one of the initializer elements; do not call groktypename(). (get_arg_type_list, start_method_def, gen_method_def): Account for new representation of variable arguments and '...' in Objective-C methods; add Objective-C++ impedance matching code. (is_objc_type_qualifier): Remove function. (adjust_type_for_id_default): Simplify; there is no longer a need to wade through declspecs. (lookup_interface, start_class, continue_class, finish_class, start_method_def, start_protocol, build_method_decl, objc_add_method, add_instance_variable, build_ivar_reference, is_ivar, is_private, get_super_receiver, objc_build_finally_epilogue): Make into static functions. (receiver_is_class_object): Use new IS_CLASS() macro. (objc_build_message_expr): Tweak ObjC++ message argument handling; call objc_finish_message_expr() instead of finish_message_expr(). (finish_message_expr): Rename to objc_finish_message_expr(); use OBJC_TYPE_NAME and OBJC_SET_TYPE_NAME macros instead of TYPE_NAME. call gen_type_name() instead of gen_declaration(); call objc_is_id() instead of using IS_ID and IS_CLASS; Use objc_class_name instead of calling get_identifier("Class"); handle CONVERT_EXPRs in receiver. (build_objc_method_call, warn_with_method): Do not call groktypename(). (build_ivar_reference): Call convert() instead of clobbering in a type. (hash_init): Initialize string_htab hash table. (add_instance_variable): Simplify parameter list; do not call grokfield(); do not populate CLASS_IVARS list. (start_class): Check for the existence of super class, if one was specified. (continue_class): Use CLASS_RAW_IVARS rather than CLASS_IVARS; do not call build_class_template(); adjust call to get_class_ivars(); call build_decl(), pushdecl() and finish_decl() instead of define_decl(). (finish_class): Call build_decl(), pushdecl() and finish_decl() instead of define_decl(). (add_protocols): Use PROTOCOL_BINFO_ELTS for the tree vector size. (start_protocol): Do not call build_protocol_template(); use PROTOCOL_BINFO_ELTS for the tree vector size. (encode_type_qualifiers): Do not handle the 'const' qualifier here. (encode_pointer): Encode 'const char *' as 'r*', for backwards compatibility. (encode_array): Use HOST_WIDE_INT_PRINT_DEC instead of "%ld". (encode_type): Handle the 'const' qualifier here. (objc_parmlist): New global variable, sued by objc_push_parm and objc_get_parm_info(). (objc_push_parm, objc_get_parm_info): New functions. (objc_expr_last): Remove function. (synth_self_and_ucmd_args): For instance methods, use the instance type for 'self'; call objc_push_parm() instead of push_parm_decl(). (start_method_def): Do not call push_scope(), declare_parm_level(), pop_scope(), push_parm_decl(), store_parm_decls() or objc_expr_last(); just use objc_push_parm() and objc_get_parm_info(). (comp_method_with_proto): Remove function. (objc_types_are_equivalent): Strip away indirections before comparing underlying types. (comp_proto_with_proto): Do not call groktypename(); types are no longer in raw declspec format. (objc_start_function): New function. (really_start_method): Call comp_proto_with_proto() instead of comp_method_with_proto(); call objc_start_function() instead of hand-crafting a function declarator. (continue_method_def, objc_expand_function_end): Remove functions. (get_super_receiver): Call objc_get_current_scope() instead of get_current_scope(); reference 'super_class' field (instead of 'class'). (finish_method_def): Rename to objc_finish_method_definition() and add a function decl parameter; move method encoding call from objc_expand_function_end(). (is_complex_decl, adorn_decl, gen_declarator, gen_declspecs, gen_declaration_1): Remove functions. (tmpbuf, RAW_DECLSPEC): Remove. (gen_declaration): Remove second parameter; simplify to deal with TYPE_P nodes instead of raw declspecs. (gen_type_name, gen_type_name_0): New functions. (gen_method_decl): Remove second parameter; call gen_type_name() instead of gen_declaration_1(). (dump_interface): Adjust calls to gen_declaration() and gen_method_decl(); do not allocate a separate string buffer. (init_objc): Allocate a larger string buffer to accommodate dump_interface(); adjust call to build_module_descriptor(); add call to build_module_initializer_routine() for the GNU runtime. (generate_classref_translation_entry): Do not call start_decl(); call finish_var_decl() instead of finish_decl(); call convert() instead of build_c_cast(). * objc-act.h (CLASS_OWN_IVARS): Remove accessor. (CLASS_BINFO_ELTS): Reduce from 6 to 5, now that CLASS_OWN_IVARS is gone. (OCTI_GNU_INIT_DECL, GNU_INIT_decl): New. (OCTI_ELLIPSIS_NODE, objc_ellipsis_node): Remove. (OCTI_ID_ID, id_type, objc_id_id): Rename to OCTI_ID_NAME, objc_object_type and objc_object_name, respectively. (OCTI_CLS_REF, OCTI_CLASS_NAME, objc_class_reference, objc_class_name): New. (IS_CLASS): New macro. (IS_ID, IS_SUPER): Robustify. (OCTI_EXECCLASS_DECL, execclass_decl): New. (finish_file, start_class, continue_class, finish_class, start_method_def, continue_method_def, finish_method_def, start_protocol, finish_protocol, objc_build_throw_stmt, objc_build_try_catch_finally_stmt, objc_build_synchronized_prologue, objc_build_synchronized_epilogue, objc_build_try_prologue, objc_build_try_epilogue, objc_build_catch_stmt, objc_build_catch_epilogue, objc_build_finally_prologue, objc_build_finally_epilogue, is_ivar, is_private, is_public, add_instance_variable, objc_add_method, get_super_receiver, objc_clear_super_receiver, get_class_ivars_from_name, get_class_reference, get_static_reference, get_object_reference, build_message_expr, finish_message_expr, build_selector_expr, build_ivar_reference, build_keyword_decl, build_method_decl, build_protocol_expr, build_objc_string_object, objc_declare_alias, objc_declare_class, objc_declare_protocols, objc_comptypes, objc_check_decl, build_encode_expr): Remove prototypes. (imp_count, cat_count): Make GGC-aware. (OBJC_SET_TYPE_NAME): New macro. From-SVN: r87168
2004-09-08 02:49:44 +02:00
return objc_finish_message_expr (receiver, sel_name, method_params);
c-parse.in (objc_inherit_code, [...]): Make static. 2001-10-03 Ziemowit Laski <zlaski@apple.com> * c-parse.in (objc_inherit_code, objc_pq_context, objc_public_flag): Make static. (objc_interface_context, objc_implementation_context, objc_method_context, objc_ivar_chain, objc_ivar_context): Move to global tree array in objc/objc-act.[ch]. (methoddef): Remove unnecessary code. * objc/objc-act.c: (hashed_attribute, hashed_entry, imp_entry): Hoist struct definitions to objc-act.h. (nst_method_hash_list, cls_method_hash_list, imp_list, imp_count, cat_count): Place declaration in objc-act.h. (objc_tree_index): Move enumeration to objc-act.h. (objc_global_trees): Place declaration and macro accessors in objc-act.h. (implementation_context): Remove duplicate; use objc_implementation_context instead: (method_context): Remove duplicate; use objc_method_context instead. (objc_ellipsis_node, objc_method_prototype_template, implemented_classes, function_type): Move global vars to objc_global_trees. (init_objc): Use LAST_BASE_TREE_CODE instead of LAST_CODE. (build_message_expr): Move actual construction of ObjC message send nodes to finish_message_expr. (finish_message_expr): New routine, contains code formerly in build_message_expr. * objc/objc-act.h (finish_message_expr): New prototype. (objc_ivar_chain, objc_method_context, objc_ellipsis_node): Remove declarations; these vars are now part of objc_global_trees. (objc_tree_index, objc_global_trees): Move definitions from objc-act.c. * objc/objc-tree.def: Update copyright info. From-SVN: r46000
2001-10-04 00:05:57 +02:00
}
/* Look up method SEL_NAME that would be suitable for receiver
of type 'id' (if IS_CLASS is zero) or 'Class' (if IS_CLASS is
nonzero), and report on any duplicates. */
static tree
lookup_method_in_hash_lists (tree sel_name, int is_class)
{
hash method_prototype = NULL;
if (!is_class)
method_prototype = hash_lookup (nst_method_hash_list,
sel_name);
if (!method_prototype)
{
method_prototype = hash_lookup (cls_method_hash_list,
sel_name);
is_class = 1;
}
return check_duplicates (method_prototype, 1, is_class);
}
Makefile.in (c-parse.o): Depend on $(C_COMMON_H). [gcc/ChangeLog] 2004-09-07 Ziemowit Laski <zlaski@apple.com> * Makefile.in (c-parse.o): Depend on $(C_COMMON_H). * c-parse.in: Include c-common.h instead of objc-act.h. (ivar_decl_list, ivar_decls, ivar_decl, ivars, ivar_declarator, myparms, myparm): Remove %type declarations. (methodtype, optparms, OBJC_TYPE_QUAL, objc_quals, objc_qual, objc_typename, objc_try_catch_stmt, optellipsis): Add %type declarations. (objc_inherit_code, objc_public_flag): Remove. (typespec_nonreserved_nonattr): Call objc_get_protocol_qualified_type() instead of get_static_reference() and get_protocol_reference(). (stmt_nocomp): Call grokparm() on @catch parameter. (objcdef): Move semantic action to objc_finish_implementation(). (classdef): Move semantic action to objc_start_class_interface(), objc_continue_interface(), objc_finish_interface(), objc_start_class_implementation(), objc_continue_implementation(), objc_start_category_interface() and objc_start_category_implementation(). (protocoldef): Move semantic actions to objc_start_protocol() and objc_finish_interface(). (ivar_decl_list): Remove nonterminal. (visibility_spec): Move semantic actions to objc_set_visibility(). (ivar_decls): Remove assignment to $$. (ivar_decl): Rephrase in terms of component_decl; call objc_add_instance_variable(). (ivars, ivar_declarator): Remove nonterminals. (opt_semi): New nonterminal. (methodtype): Remove semantic actions. (methoddef): Move semantic actions to objc_set_method_type(), objc_start_method_definition() and objc_finish_method_definition(). (methodproto): Move semantic actions to objc_set_method_type() and objc_add_method_declaration(). (methoddecl): Use objc_typename instead of typename; move semantic actions to objc_build_method_signature(). (optarglist, myxdecls, mydecl, myparms, myparm): Remove nonterminals. (optparmlist): Express in terms of optparms and optellipsis. (optparms, optellipsis, objc_qual, objc_quals, objc_typename): New nonterminals. (keyworddecl): Use objc_typename instead of typename. (rid_to_yy): Mark RID_IN, RID_OUT, RID_INOUT, RID_BYCOPY, RID_BYREF and RID_ONEWAY as returning OBJC_TYPE_QUAL to yyparse(). [gcc/objc/ChangeLog] 2004-09-07 Ziemowit Laski <zlaski@apple.com> * Make-lang.in (objc/objc-parse.o): Depend on $(C_COMMON_H) instead of objc/objc-act.h. (objc/objc-act.o): Depend on $(HASHTAB_H). * objc-act.c: Include hashtab.h; in ObjC++ mode, include cp-tree.h and objcp-decl.h instead of c-tree.h. (build_module_descriptor, get_class_ivars, synth_id_with_class_suffix, error_with_ivar, gen_method_decl, gen_declaration, setup_string_decl, build_protocol_template): Adjust prototypes. (build_module_initializer_routine, start_class, continue_class, finish_class, start_method_def, objc_start_function, start_protocol, build_method_decl, objc_add_method, add_instance_variable, build_ivar_reference, is_ivar, is_private, get_super_receiver, build_selector_table_decl, objc_push_parm, objc_get_parm_info, gen_type_name, gen_type_name_0, start_var_decl, finish_var_decl, create_field_decl): New prototypes. (objc_expand_function_end, comp_method_with_proto, objc_expr_last, gen_declaration_1, gen_declarator, is_complex_decl, adorn_decl, define_decl, create_builtin_decl, gen_declspecs): Remove prototypes. (TYPE_ID): Rename to OBJECT_TYPEDEF_NAME. (CLASS_TYPEDEF_NAME): New. (TAG_EXECCLASS): Change from a global variable to a #define. (TAG_RETURN_STRUCT): Delete. (TAG_GNUINIT): New, holds '__objc_gnu_init' name. (objc_inherit_code, objc_public_flag): New, moved from c-parse.in. (string_descriptor): New struct. (string_htab): New hash table. (string_hash, string_eq): New prototypes. (generate_struct_by_value_array): Call create_field_decl() instead of create_builtin_decl(). (objc_init): Do not initialize objc_ellipsis_node or TAG_EXECCLASS; In ObjC++ mode, call cxx_init() instead of c_objc_common_init(). (objc_finish_file): In ObjC++, call instantiate_pending_templates() and cp_finish_file(). (define_decl, get_static_reference, get_protocol_reference, create_builtin_decl): Remove functions. (objc_start_class_interface, objc_start_category_interface, objc_start_protocol, objc_continue_interface, objc_finish_interface, objc_start_class_implementation, objc_start_category_implementation, objc_continue_implementation, objc_finish_implementation, objc_set_visibility, objc_set_method_type, objc_build_method_signature, objc_add_method_declaration, objc_start_method_definition, objc_add_instance_variable, objc_get_protocol_qualified_type, create_field_decl, start_var_decl, finish_var_decl): New functions. (setup_string_decl): Simplify since it is only called once. (synth_module_prologue): Call build_class_template(); predefine 'id' and 'Class' as typedefs; rename 'temp_type' to 'type'; disable debug hooks for duration of function; fix GNU runtime messenger signatures to correspond to reality; forward-declare '__objc_exec_class' for the GNU runtime; call build_selector_table_decl(); in ObjC++ mode, generate 'extern "C" { ... }' wrappers around synthesized declarations; call build_protocol_template() and build_category_template(). (string_hash, string_eq): New functions. (objc_build_string_object): Check metaclass correctness only once; store string literals in hash table. (objc_build_constructor): Do not convert initializer elements; adjust for ObjC++ impedance mismatch. (build_objc_symtab_template): Call create_field_decl() instead of create_builtin_decl(). (init_objc_symtab): Add missing conversion to initializer element. (build_metadata_decl): Call start_var_decl() instead of define_decl(). (generate_objc_symtab_decl): Do not call build_category_template(); call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(). (build_module_descriptor): Call create_field_decl() instead of grokfield(); call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(); always mark module descriptor as used; move GNU runtime-specific functionality to build_module_initializer_routine(). (build_module_initializer_routine): New function, broken off of build_module_descriptor(). (objc_static_init_needed_p, objc_generate_static_init_call): New functions. (generate_static_references, generate_strings, build_selector_translation_table, generate_descriptor_table, generate_ivars_list, generate_dispatch_table, generate_category): Call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(); build a type directly instead of via groktypename(). (build_selector_reference_decl, build_selector_table_decl, build_class_reference_decl, build_protocol_reference, generate_objc_image_info): Call start_var_decl() instead of build_decl(). (build_selector_reference): For GNU runtime, do not call build_selector_reference_decl(). (build_selector, build_typed_selector_reference): Always convert result to the selector type. (add_objc_string): Cast return value to 'char *'. (build_method_prototype_template, build_selector_template, build_method_template): Use actual selector type for fields pointing to selectors. (finish_objc): For GNU runtime, call build_module_initializer_routine() after build_module_descriptor(). (generate_protocol_list, generate_shared_structures): Call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(); build a type directly instead of via groktypename(). (synth_id_with_class_suffix): Return a string. (get_arg_type_list): For instance methods, use the instance type for 'self'; do not call groktypename_in_parm_context(). (build_objc_string_decl): Squash redeclaration errors in ObjC++. (objc_is_class_name): Use OBJC_TYPE_NAME instead of TYPE_NAME; handle RECORD_TYPEs in ObjC as well as ObjC++. (objc_is_id): New function. (objc_is_object_ptr): Return the canonical type node. (objc_get_class_ivars): Simplify using get_class_ivars(). (get_class_ivars): Remove second parameter; create a fresh copy of the ivar list for each call; do not check for existence of super class. (objc_eh_runtime_type): Mark #ifndef OBJCPLUS. (objc_init_exceptions): When using SJLJ-style exceptions, require the use of '-fobjc-exceptions' flag; do not require it for DWARF-style exceptions. (objc_build_exc_ptr, next_sjlj_build_try_catch_finally): Use objc_object_type instead of objc_id_type. (objc_begin_catch_clause): Convert the incoming PARM_DECL into a VAR_DECL before placing it in the appropriate scope; do not call define_decl(); adjust call to c_begin_compound_stmt(); use objc_object_type instead of objc_id_type. (build_next_objc_exception_stuff): Call create_field_decl() instead of create_builtin_decl(); construct type directly instead of calling groktypename(); use OBJC_VOID_AT_END to mark end of function parameters. (build_private_template): Adjust call to get_class_ivars(); build a type directly instead of via groktypename(). (build_protocol_template, build_method_prototype_list_template, build_method_prototype_template, build_category_template, build_selector_template, build_class_template, build_super_template, build_ivar_template, build_ivar_list_template, build_method_list_template, build_method_template): Call create_field_decl() instead of grokfield(). (objc_method_parm_type): Do not call groktypename(). (generate_descriptor_table): Call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(). (generate_method_descriptors, build_protocol_initializer, generate_dispatch_tables, build_category_initializer, build_shared_structure_initializer): Do not call groktypename(). (generate_protocols): Call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(); do not call groktypename(). (error_with_ivar): Remove last parameter. (check_ivars): Do not iterate ovar CLASS_RAW_IVARS lists in addition to CLASS_IVARS lists; adjust calls to error_with_ivar(). (generate_ivar_lists): Convert one of the initializer elements; do not call groktypename(). (get_arg_type_list, start_method_def, gen_method_def): Account for new representation of variable arguments and '...' in Objective-C methods; add Objective-C++ impedance matching code. (is_objc_type_qualifier): Remove function. (adjust_type_for_id_default): Simplify; there is no longer a need to wade through declspecs. (lookup_interface, start_class, continue_class, finish_class, start_method_def, start_protocol, build_method_decl, objc_add_method, add_instance_variable, build_ivar_reference, is_ivar, is_private, get_super_receiver, objc_build_finally_epilogue): Make into static functions. (receiver_is_class_object): Use new IS_CLASS() macro. (objc_build_message_expr): Tweak ObjC++ message argument handling; call objc_finish_message_expr() instead of finish_message_expr(). (finish_message_expr): Rename to objc_finish_message_expr(); use OBJC_TYPE_NAME and OBJC_SET_TYPE_NAME macros instead of TYPE_NAME. call gen_type_name() instead of gen_declaration(); call objc_is_id() instead of using IS_ID and IS_CLASS; Use objc_class_name instead of calling get_identifier("Class"); handle CONVERT_EXPRs in receiver. (build_objc_method_call, warn_with_method): Do not call groktypename(). (build_ivar_reference): Call convert() instead of clobbering in a type. (hash_init): Initialize string_htab hash table. (add_instance_variable): Simplify parameter list; do not call grokfield(); do not populate CLASS_IVARS list. (start_class): Check for the existence of super class, if one was specified. (continue_class): Use CLASS_RAW_IVARS rather than CLASS_IVARS; do not call build_class_template(); adjust call to get_class_ivars(); call build_decl(), pushdecl() and finish_decl() instead of define_decl(). (finish_class): Call build_decl(), pushdecl() and finish_decl() instead of define_decl(). (add_protocols): Use PROTOCOL_BINFO_ELTS for the tree vector size. (start_protocol): Do not call build_protocol_template(); use PROTOCOL_BINFO_ELTS for the tree vector size. (encode_type_qualifiers): Do not handle the 'const' qualifier here. (encode_pointer): Encode 'const char *' as 'r*', for backwards compatibility. (encode_array): Use HOST_WIDE_INT_PRINT_DEC instead of "%ld". (encode_type): Handle the 'const' qualifier here. (objc_parmlist): New global variable, sued by objc_push_parm and objc_get_parm_info(). (objc_push_parm, objc_get_parm_info): New functions. (objc_expr_last): Remove function. (synth_self_and_ucmd_args): For instance methods, use the instance type for 'self'; call objc_push_parm() instead of push_parm_decl(). (start_method_def): Do not call push_scope(), declare_parm_level(), pop_scope(), push_parm_decl(), store_parm_decls() or objc_expr_last(); just use objc_push_parm() and objc_get_parm_info(). (comp_method_with_proto): Remove function. (objc_types_are_equivalent): Strip away indirections before comparing underlying types. (comp_proto_with_proto): Do not call groktypename(); types are no longer in raw declspec format. (objc_start_function): New function. (really_start_method): Call comp_proto_with_proto() instead of comp_method_with_proto(); call objc_start_function() instead of hand-crafting a function declarator. (continue_method_def, objc_expand_function_end): Remove functions. (get_super_receiver): Call objc_get_current_scope() instead of get_current_scope(); reference 'super_class' field (instead of 'class'). (finish_method_def): Rename to objc_finish_method_definition() and add a function decl parameter; move method encoding call from objc_expand_function_end(). (is_complex_decl, adorn_decl, gen_declarator, gen_declspecs, gen_declaration_1): Remove functions. (tmpbuf, RAW_DECLSPEC): Remove. (gen_declaration): Remove second parameter; simplify to deal with TYPE_P nodes instead of raw declspecs. (gen_type_name, gen_type_name_0): New functions. (gen_method_decl): Remove second parameter; call gen_type_name() instead of gen_declaration_1(). (dump_interface): Adjust calls to gen_declaration() and gen_method_decl(); do not allocate a separate string buffer. (init_objc): Allocate a larger string buffer to accommodate dump_interface(); adjust call to build_module_descriptor(); add call to build_module_initializer_routine() for the GNU runtime. (generate_classref_translation_entry): Do not call start_decl(); call finish_var_decl() instead of finish_decl(); call convert() instead of build_c_cast(). * objc-act.h (CLASS_OWN_IVARS): Remove accessor. (CLASS_BINFO_ELTS): Reduce from 6 to 5, now that CLASS_OWN_IVARS is gone. (OCTI_GNU_INIT_DECL, GNU_INIT_decl): New. (OCTI_ELLIPSIS_NODE, objc_ellipsis_node): Remove. (OCTI_ID_ID, id_type, objc_id_id): Rename to OCTI_ID_NAME, objc_object_type and objc_object_name, respectively. (OCTI_CLS_REF, OCTI_CLASS_NAME, objc_class_reference, objc_class_name): New. (IS_CLASS): New macro. (IS_ID, IS_SUPER): Robustify. (OCTI_EXECCLASS_DECL, execclass_decl): New. (finish_file, start_class, continue_class, finish_class, start_method_def, continue_method_def, finish_method_def, start_protocol, finish_protocol, objc_build_throw_stmt, objc_build_try_catch_finally_stmt, objc_build_synchronized_prologue, objc_build_synchronized_epilogue, objc_build_try_prologue, objc_build_try_epilogue, objc_build_catch_stmt, objc_build_catch_epilogue, objc_build_finally_prologue, objc_build_finally_epilogue, is_ivar, is_private, is_public, add_instance_variable, objc_add_method, get_super_receiver, objc_clear_super_receiver, get_class_ivars_from_name, get_class_reference, get_static_reference, get_object_reference, build_message_expr, finish_message_expr, build_selector_expr, build_ivar_reference, build_keyword_decl, build_method_decl, build_protocol_expr, build_objc_string_object, objc_declare_alias, objc_declare_class, objc_declare_protocols, objc_comptypes, objc_check_decl, build_encode_expr): Remove prototypes. (imp_count, cat_count): Make GGC-aware. (OBJC_SET_TYPE_NAME): New macro. From-SVN: r87168
2004-09-08 02:49:44 +02:00
/* The 'objc_finish_message_expr' routine is called from within
c-parse.in (primary): Call objc_build_message_expr()... [gcc/ChangeLog] 2004-09-01 Ziemowit Laski <zlaski@apple.com> * c-parse.in (primary): Call objc_build_message_expr(), objc_build_selector_expr(), objc_build_protocol_expr(), objc_build_encode_expr() and objc_build_string_object() instead of build_message_expr(), build_selector_expr(), build_protocol_expr(), build_encode_expr() and build_objc_string_object(), respectively. (component_decl_list2): Call objc_get_class_ivars() instead of get_class_ivars_from_name(). (keyworddecl): Call objc_build_keyword_decl() instead of build_keyword_decl(). (receiver): Call objc_get_class_reference() instead of get_class_reference(). (reswords): Add blank line before @@ifobjc section, for clarity. [gcc/objc/ChangeLog] 2004-09-01 Ziemowit Laski <zlaski@apple.com> * objc-act.c (objc_check_decl): Use OBJC_TYPE_NAME macro instead of TYPE_NAME. (build_objc_string_object): Rename to objc_build_string_object(). (get_class_reference): Rename to objc_get_class_reference(). (get_class_ivars_from_name): Rename to objc_get_class_ivars(). (next_sjlj_build_catch_list, get_super_receiver): Call objc_get_class_reference() instead of get_class_reference(). (build_keyword_decl): Rename to objc_build_keyword_decl(). (build_message_expr): Rename to objc_build_message_expr(). (build_protocol_expr): Rename to objc_build_protocol_expr(). (build_selector_expr): Rename to objc_build_selector_expr(). (build_encode_expr): Rename to objc_build_encode_expr(). * objc-act.h (get_class_ivars_from_name): Rename prototype to objc_get_class_ivars(). (get_class_reference): Rename prototype to objc_get_class_reference(). (build_message_expr): Rename prototype to objc_build_message_expr(). (build_selector_expr): Rename prototype to objc_build_selector_expr(). (build_keyword_decl): Rename prototype to objc_build_keyword_decl(). (build_protocol_expr): Rename prototype to objc_build_prototype_expr(). (build_objc_string_object): Rename prototype to objc_build_string_object(). From-SVN: r86950
2004-09-02 02:36:18 +02:00
'objc_build_message_expr' for non-template functions. In the case of
c-parse.in (objc_inherit_code, [...]): Make static. 2001-10-03 Ziemowit Laski <zlaski@apple.com> * c-parse.in (objc_inherit_code, objc_pq_context, objc_public_flag): Make static. (objc_interface_context, objc_implementation_context, objc_method_context, objc_ivar_chain, objc_ivar_context): Move to global tree array in objc/objc-act.[ch]. (methoddef): Remove unnecessary code. * objc/objc-act.c: (hashed_attribute, hashed_entry, imp_entry): Hoist struct definitions to objc-act.h. (nst_method_hash_list, cls_method_hash_list, imp_list, imp_count, cat_count): Place declaration in objc-act.h. (objc_tree_index): Move enumeration to objc-act.h. (objc_global_trees): Place declaration and macro accessors in objc-act.h. (implementation_context): Remove duplicate; use objc_implementation_context instead: (method_context): Remove duplicate; use objc_method_context instead. (objc_ellipsis_node, objc_method_prototype_template, implemented_classes, function_type): Move global vars to objc_global_trees. (init_objc): Use LAST_BASE_TREE_CODE instead of LAST_CODE. (build_message_expr): Move actual construction of ObjC message send nodes to finish_message_expr. (finish_message_expr): New routine, contains code formerly in build_message_expr. * objc/objc-act.h (finish_message_expr): New prototype. (objc_ivar_chain, objc_method_context, objc_ellipsis_node): Remove declarations; these vars are now part of objc_global_trees. (objc_tree_index, objc_global_trees): Move definitions from objc-act.c. * objc/objc-tree.def: Update copyright info. From-SVN: r46000
2001-10-04 00:05:57 +02:00
C++ template functions, it is called from 'build_expr_from_tree'
(in decl2.c) after RECEIVER and METHOD_PARAMS have been expanded. */
c-parse.in (objc_inherit_code, [...]): Make static. 2001-10-03 Ziemowit Laski <zlaski@apple.com> * c-parse.in (objc_inherit_code, objc_pq_context, objc_public_flag): Make static. (objc_interface_context, objc_implementation_context, objc_method_context, objc_ivar_chain, objc_ivar_context): Move to global tree array in objc/objc-act.[ch]. (methoddef): Remove unnecessary code. * objc/objc-act.c: (hashed_attribute, hashed_entry, imp_entry): Hoist struct definitions to objc-act.h. (nst_method_hash_list, cls_method_hash_list, imp_list, imp_count, cat_count): Place declaration in objc-act.h. (objc_tree_index): Move enumeration to objc-act.h. (objc_global_trees): Place declaration and macro accessors in objc-act.h. (implementation_context): Remove duplicate; use objc_implementation_context instead: (method_context): Remove duplicate; use objc_method_context instead. (objc_ellipsis_node, objc_method_prototype_template, implemented_classes, function_type): Move global vars to objc_global_trees. (init_objc): Use LAST_BASE_TREE_CODE instead of LAST_CODE. (build_message_expr): Move actual construction of ObjC message send nodes to finish_message_expr. (finish_message_expr): New routine, contains code formerly in build_message_expr. * objc/objc-act.h (finish_message_expr): New prototype. (objc_ivar_chain, objc_method_context, objc_ellipsis_node): Remove declarations; these vars are now part of objc_global_trees. (objc_tree_index, objc_global_trees): Move definitions from objc-act.c. * objc/objc-tree.def: Update copyright info. From-SVN: r46000
2001-10-04 00:05:57 +02:00
tree
Makefile.in (c-parse.o): Depend on $(C_COMMON_H). [gcc/ChangeLog] 2004-09-07 Ziemowit Laski <zlaski@apple.com> * Makefile.in (c-parse.o): Depend on $(C_COMMON_H). * c-parse.in: Include c-common.h instead of objc-act.h. (ivar_decl_list, ivar_decls, ivar_decl, ivars, ivar_declarator, myparms, myparm): Remove %type declarations. (methodtype, optparms, OBJC_TYPE_QUAL, objc_quals, objc_qual, objc_typename, objc_try_catch_stmt, optellipsis): Add %type declarations. (objc_inherit_code, objc_public_flag): Remove. (typespec_nonreserved_nonattr): Call objc_get_protocol_qualified_type() instead of get_static_reference() and get_protocol_reference(). (stmt_nocomp): Call grokparm() on @catch parameter. (objcdef): Move semantic action to objc_finish_implementation(). (classdef): Move semantic action to objc_start_class_interface(), objc_continue_interface(), objc_finish_interface(), objc_start_class_implementation(), objc_continue_implementation(), objc_start_category_interface() and objc_start_category_implementation(). (protocoldef): Move semantic actions to objc_start_protocol() and objc_finish_interface(). (ivar_decl_list): Remove nonterminal. (visibility_spec): Move semantic actions to objc_set_visibility(). (ivar_decls): Remove assignment to $$. (ivar_decl): Rephrase in terms of component_decl; call objc_add_instance_variable(). (ivars, ivar_declarator): Remove nonterminals. (opt_semi): New nonterminal. (methodtype): Remove semantic actions. (methoddef): Move semantic actions to objc_set_method_type(), objc_start_method_definition() and objc_finish_method_definition(). (methodproto): Move semantic actions to objc_set_method_type() and objc_add_method_declaration(). (methoddecl): Use objc_typename instead of typename; move semantic actions to objc_build_method_signature(). (optarglist, myxdecls, mydecl, myparms, myparm): Remove nonterminals. (optparmlist): Express in terms of optparms and optellipsis. (optparms, optellipsis, objc_qual, objc_quals, objc_typename): New nonterminals. (keyworddecl): Use objc_typename instead of typename. (rid_to_yy): Mark RID_IN, RID_OUT, RID_INOUT, RID_BYCOPY, RID_BYREF and RID_ONEWAY as returning OBJC_TYPE_QUAL to yyparse(). [gcc/objc/ChangeLog] 2004-09-07 Ziemowit Laski <zlaski@apple.com> * Make-lang.in (objc/objc-parse.o): Depend on $(C_COMMON_H) instead of objc/objc-act.h. (objc/objc-act.o): Depend on $(HASHTAB_H). * objc-act.c: Include hashtab.h; in ObjC++ mode, include cp-tree.h and objcp-decl.h instead of c-tree.h. (build_module_descriptor, get_class_ivars, synth_id_with_class_suffix, error_with_ivar, gen_method_decl, gen_declaration, setup_string_decl, build_protocol_template): Adjust prototypes. (build_module_initializer_routine, start_class, continue_class, finish_class, start_method_def, objc_start_function, start_protocol, build_method_decl, objc_add_method, add_instance_variable, build_ivar_reference, is_ivar, is_private, get_super_receiver, build_selector_table_decl, objc_push_parm, objc_get_parm_info, gen_type_name, gen_type_name_0, start_var_decl, finish_var_decl, create_field_decl): New prototypes. (objc_expand_function_end, comp_method_with_proto, objc_expr_last, gen_declaration_1, gen_declarator, is_complex_decl, adorn_decl, define_decl, create_builtin_decl, gen_declspecs): Remove prototypes. (TYPE_ID): Rename to OBJECT_TYPEDEF_NAME. (CLASS_TYPEDEF_NAME): New. (TAG_EXECCLASS): Change from a global variable to a #define. (TAG_RETURN_STRUCT): Delete. (TAG_GNUINIT): New, holds '__objc_gnu_init' name. (objc_inherit_code, objc_public_flag): New, moved from c-parse.in. (string_descriptor): New struct. (string_htab): New hash table. (string_hash, string_eq): New prototypes. (generate_struct_by_value_array): Call create_field_decl() instead of create_builtin_decl(). (objc_init): Do not initialize objc_ellipsis_node or TAG_EXECCLASS; In ObjC++ mode, call cxx_init() instead of c_objc_common_init(). (objc_finish_file): In ObjC++, call instantiate_pending_templates() and cp_finish_file(). (define_decl, get_static_reference, get_protocol_reference, create_builtin_decl): Remove functions. (objc_start_class_interface, objc_start_category_interface, objc_start_protocol, objc_continue_interface, objc_finish_interface, objc_start_class_implementation, objc_start_category_implementation, objc_continue_implementation, objc_finish_implementation, objc_set_visibility, objc_set_method_type, objc_build_method_signature, objc_add_method_declaration, objc_start_method_definition, objc_add_instance_variable, objc_get_protocol_qualified_type, create_field_decl, start_var_decl, finish_var_decl): New functions. (setup_string_decl): Simplify since it is only called once. (synth_module_prologue): Call build_class_template(); predefine 'id' and 'Class' as typedefs; rename 'temp_type' to 'type'; disable debug hooks for duration of function; fix GNU runtime messenger signatures to correspond to reality; forward-declare '__objc_exec_class' for the GNU runtime; call build_selector_table_decl(); in ObjC++ mode, generate 'extern "C" { ... }' wrappers around synthesized declarations; call build_protocol_template() and build_category_template(). (string_hash, string_eq): New functions. (objc_build_string_object): Check metaclass correctness only once; store string literals in hash table. (objc_build_constructor): Do not convert initializer elements; adjust for ObjC++ impedance mismatch. (build_objc_symtab_template): Call create_field_decl() instead of create_builtin_decl(). (init_objc_symtab): Add missing conversion to initializer element. (build_metadata_decl): Call start_var_decl() instead of define_decl(). (generate_objc_symtab_decl): Do not call build_category_template(); call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(). (build_module_descriptor): Call create_field_decl() instead of grokfield(); call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(); always mark module descriptor as used; move GNU runtime-specific functionality to build_module_initializer_routine(). (build_module_initializer_routine): New function, broken off of build_module_descriptor(). (objc_static_init_needed_p, objc_generate_static_init_call): New functions. (generate_static_references, generate_strings, build_selector_translation_table, generate_descriptor_table, generate_ivars_list, generate_dispatch_table, generate_category): Call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(); build a type directly instead of via groktypename(). (build_selector_reference_decl, build_selector_table_decl, build_class_reference_decl, build_protocol_reference, generate_objc_image_info): Call start_var_decl() instead of build_decl(). (build_selector_reference): For GNU runtime, do not call build_selector_reference_decl(). (build_selector, build_typed_selector_reference): Always convert result to the selector type. (add_objc_string): Cast return value to 'char *'. (build_method_prototype_template, build_selector_template, build_method_template): Use actual selector type for fields pointing to selectors. (finish_objc): For GNU runtime, call build_module_initializer_routine() after build_module_descriptor(). (generate_protocol_list, generate_shared_structures): Call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(); build a type directly instead of via groktypename(). (synth_id_with_class_suffix): Return a string. (get_arg_type_list): For instance methods, use the instance type for 'self'; do not call groktypename_in_parm_context(). (build_objc_string_decl): Squash redeclaration errors in ObjC++. (objc_is_class_name): Use OBJC_TYPE_NAME instead of TYPE_NAME; handle RECORD_TYPEs in ObjC as well as ObjC++. (objc_is_id): New function. (objc_is_object_ptr): Return the canonical type node. (objc_get_class_ivars): Simplify using get_class_ivars(). (get_class_ivars): Remove second parameter; create a fresh copy of the ivar list for each call; do not check for existence of super class. (objc_eh_runtime_type): Mark #ifndef OBJCPLUS. (objc_init_exceptions): When using SJLJ-style exceptions, require the use of '-fobjc-exceptions' flag; do not require it for DWARF-style exceptions. (objc_build_exc_ptr, next_sjlj_build_try_catch_finally): Use objc_object_type instead of objc_id_type. (objc_begin_catch_clause): Convert the incoming PARM_DECL into a VAR_DECL before placing it in the appropriate scope; do not call define_decl(); adjust call to c_begin_compound_stmt(); use objc_object_type instead of objc_id_type. (build_next_objc_exception_stuff): Call create_field_decl() instead of create_builtin_decl(); construct type directly instead of calling groktypename(); use OBJC_VOID_AT_END to mark end of function parameters. (build_private_template): Adjust call to get_class_ivars(); build a type directly instead of via groktypename(). (build_protocol_template, build_method_prototype_list_template, build_method_prototype_template, build_category_template, build_selector_template, build_class_template, build_super_template, build_ivar_template, build_ivar_list_template, build_method_list_template, build_method_template): Call create_field_decl() instead of grokfield(). (objc_method_parm_type): Do not call groktypename(). (generate_descriptor_table): Call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(). (generate_method_descriptors, build_protocol_initializer, generate_dispatch_tables, build_category_initializer, build_shared_structure_initializer): Do not call groktypename(). (generate_protocols): Call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(); do not call groktypename(). (error_with_ivar): Remove last parameter. (check_ivars): Do not iterate ovar CLASS_RAW_IVARS lists in addition to CLASS_IVARS lists; adjust calls to error_with_ivar(). (generate_ivar_lists): Convert one of the initializer elements; do not call groktypename(). (get_arg_type_list, start_method_def, gen_method_def): Account for new representation of variable arguments and '...' in Objective-C methods; add Objective-C++ impedance matching code. (is_objc_type_qualifier): Remove function. (adjust_type_for_id_default): Simplify; there is no longer a need to wade through declspecs. (lookup_interface, start_class, continue_class, finish_class, start_method_def, start_protocol, build_method_decl, objc_add_method, add_instance_variable, build_ivar_reference, is_ivar, is_private, get_super_receiver, objc_build_finally_epilogue): Make into static functions. (receiver_is_class_object): Use new IS_CLASS() macro. (objc_build_message_expr): Tweak ObjC++ message argument handling; call objc_finish_message_expr() instead of finish_message_expr(). (finish_message_expr): Rename to objc_finish_message_expr(); use OBJC_TYPE_NAME and OBJC_SET_TYPE_NAME macros instead of TYPE_NAME. call gen_type_name() instead of gen_declaration(); call objc_is_id() instead of using IS_ID and IS_CLASS; Use objc_class_name instead of calling get_identifier("Class"); handle CONVERT_EXPRs in receiver. (build_objc_method_call, warn_with_method): Do not call groktypename(). (build_ivar_reference): Call convert() instead of clobbering in a type. (hash_init): Initialize string_htab hash table. (add_instance_variable): Simplify parameter list; do not call grokfield(); do not populate CLASS_IVARS list. (start_class): Check for the existence of super class, if one was specified. (continue_class): Use CLASS_RAW_IVARS rather than CLASS_IVARS; do not call build_class_template(); adjust call to get_class_ivars(); call build_decl(), pushdecl() and finish_decl() instead of define_decl(). (finish_class): Call build_decl(), pushdecl() and finish_decl() instead of define_decl(). (add_protocols): Use PROTOCOL_BINFO_ELTS for the tree vector size. (start_protocol): Do not call build_protocol_template(); use PROTOCOL_BINFO_ELTS for the tree vector size. (encode_type_qualifiers): Do not handle the 'const' qualifier here. (encode_pointer): Encode 'const char *' as 'r*', for backwards compatibility. (encode_array): Use HOST_WIDE_INT_PRINT_DEC instead of "%ld". (encode_type): Handle the 'const' qualifier here. (objc_parmlist): New global variable, sued by objc_push_parm and objc_get_parm_info(). (objc_push_parm, objc_get_parm_info): New functions. (objc_expr_last): Remove function. (synth_self_and_ucmd_args): For instance methods, use the instance type for 'self'; call objc_push_parm() instead of push_parm_decl(). (start_method_def): Do not call push_scope(), declare_parm_level(), pop_scope(), push_parm_decl(), store_parm_decls() or objc_expr_last(); just use objc_push_parm() and objc_get_parm_info(). (comp_method_with_proto): Remove function. (objc_types_are_equivalent): Strip away indirections before comparing underlying types. (comp_proto_with_proto): Do not call groktypename(); types are no longer in raw declspec format. (objc_start_function): New function. (really_start_method): Call comp_proto_with_proto() instead of comp_method_with_proto(); call objc_start_function() instead of hand-crafting a function declarator. (continue_method_def, objc_expand_function_end): Remove functions. (get_super_receiver): Call objc_get_current_scope() instead of get_current_scope(); reference 'super_class' field (instead of 'class'). (finish_method_def): Rename to objc_finish_method_definition() and add a function decl parameter; move method encoding call from objc_expand_function_end(). (is_complex_decl, adorn_decl, gen_declarator, gen_declspecs, gen_declaration_1): Remove functions. (tmpbuf, RAW_DECLSPEC): Remove. (gen_declaration): Remove second parameter; simplify to deal with TYPE_P nodes instead of raw declspecs. (gen_type_name, gen_type_name_0): New functions. (gen_method_decl): Remove second parameter; call gen_type_name() instead of gen_declaration_1(). (dump_interface): Adjust calls to gen_declaration() and gen_method_decl(); do not allocate a separate string buffer. (init_objc): Allocate a larger string buffer to accommodate dump_interface(); adjust call to build_module_descriptor(); add call to build_module_initializer_routine() for the GNU runtime. (generate_classref_translation_entry): Do not call start_decl(); call finish_var_decl() instead of finish_decl(); call convert() instead of build_c_cast(). * objc-act.h (CLASS_OWN_IVARS): Remove accessor. (CLASS_BINFO_ELTS): Reduce from 6 to 5, now that CLASS_OWN_IVARS is gone. (OCTI_GNU_INIT_DECL, GNU_INIT_decl): New. (OCTI_ELLIPSIS_NODE, objc_ellipsis_node): Remove. (OCTI_ID_ID, id_type, objc_id_id): Rename to OCTI_ID_NAME, objc_object_type and objc_object_name, respectively. (OCTI_CLS_REF, OCTI_CLASS_NAME, objc_class_reference, objc_class_name): New. (IS_CLASS): New macro. (IS_ID, IS_SUPER): Robustify. (OCTI_EXECCLASS_DECL, execclass_decl): New. (finish_file, start_class, continue_class, finish_class, start_method_def, continue_method_def, finish_method_def, start_protocol, finish_protocol, objc_build_throw_stmt, objc_build_try_catch_finally_stmt, objc_build_synchronized_prologue, objc_build_synchronized_epilogue, objc_build_try_prologue, objc_build_try_epilogue, objc_build_catch_stmt, objc_build_catch_epilogue, objc_build_finally_prologue, objc_build_finally_epilogue, is_ivar, is_private, is_public, add_instance_variable, objc_add_method, get_super_receiver, objc_clear_super_receiver, get_class_ivars_from_name, get_class_reference, get_static_reference, get_object_reference, build_message_expr, finish_message_expr, build_selector_expr, build_ivar_reference, build_keyword_decl, build_method_decl, build_protocol_expr, build_objc_string_object, objc_declare_alias, objc_declare_class, objc_declare_protocols, objc_comptypes, objc_check_decl, build_encode_expr): Remove prototypes. (imp_count, cat_count): Make GGC-aware. (OBJC_SET_TYPE_NAME): New macro. From-SVN: r87168
2004-09-08 02:49:44 +02:00
objc_finish_message_expr (tree receiver, tree sel_name, tree method_params)
{
tree method_prototype = NULL_TREE, rprotos = NULL_TREE, rtype;
objc-act.h (get_object_reference): Rename to get_protocol_reference. 2004-06-20 David Ayers <d.ayers@inode.at> * objc/objc-act.h (get_object_reference): Rename to get_protocol_reference. (super_type): Rename to objc_super_type. (selector_type): Rename to objc_selector_type. (id_type): Rename to objc_id_type. (instance_type): Rename to objc_instance_type. (protocol_type): Rename to objc_protocol_type. (IS_ID): Update reference to id_type. * objc/objc-act.c (get_object_reference): Rename to get_protocol_reference; add documentation; update references to id_type. (lookup_method_in_protocol_list): Rename class_meth to is_class; add documentation. (finish_message_expr): Rename is_class to class_tree. (synth_module_prologue, objc_is_object_ptr, objc_build_exc_ptr, next_sjlj_build_try_catch_finally, objc_begin_catch_clause, build_next_objc_exception_stuff, get_arg_type_list, build_objc_method_call): Update references to id_type. (synth_module_prologue, build_objc_symtab_template, build_selector_reference_decl, build_selector, build_selector_translation_table, build_typed_selector_reference, get_arg_type_list, synth_self_and_ucmd_args, get_arg_type_list, synth_self_and_ucmd_args): Update references to selector_type. (build_private_template, build_ivar_reference): Update references to instance_type. (synth_module_prologue, build_protocol_reference, build_protocol_expr, start_protocol): Update references to protocol_type. (synth_module_prologue, get_arg_type_list, build_objc_method_call): Update references to super_type. * c-parse.in: (typespec_nonreserved_nonattr): Update references to get_object_reference. * objc/objc-tree.def: Add C mode identifier sequence. From-SVN: r83425
2004-06-21 03:50:18 +02:00
tree selector, retval, class_tree;
int self, super, have_cast;
/* Extract the receiver of the message, as well as its type
(where the latter may take the form of a cast or be inferred
from the implementation context). */
rtype = receiver;
while (TREE_CODE (rtype) == COMPOUND_EXPR
|| TREE_CODE (rtype) == MODIFY_EXPR
|| TREE_CODE (rtype) == NOP_EXPR
Makefile.in (c-parse.o): Depend on $(C_COMMON_H). [gcc/ChangeLog] 2004-09-07 Ziemowit Laski <zlaski@apple.com> * Makefile.in (c-parse.o): Depend on $(C_COMMON_H). * c-parse.in: Include c-common.h instead of objc-act.h. (ivar_decl_list, ivar_decls, ivar_decl, ivars, ivar_declarator, myparms, myparm): Remove %type declarations. (methodtype, optparms, OBJC_TYPE_QUAL, objc_quals, objc_qual, objc_typename, objc_try_catch_stmt, optellipsis): Add %type declarations. (objc_inherit_code, objc_public_flag): Remove. (typespec_nonreserved_nonattr): Call objc_get_protocol_qualified_type() instead of get_static_reference() and get_protocol_reference(). (stmt_nocomp): Call grokparm() on @catch parameter. (objcdef): Move semantic action to objc_finish_implementation(). (classdef): Move semantic action to objc_start_class_interface(), objc_continue_interface(), objc_finish_interface(), objc_start_class_implementation(), objc_continue_implementation(), objc_start_category_interface() and objc_start_category_implementation(). (protocoldef): Move semantic actions to objc_start_protocol() and objc_finish_interface(). (ivar_decl_list): Remove nonterminal. (visibility_spec): Move semantic actions to objc_set_visibility(). (ivar_decls): Remove assignment to $$. (ivar_decl): Rephrase in terms of component_decl; call objc_add_instance_variable(). (ivars, ivar_declarator): Remove nonterminals. (opt_semi): New nonterminal. (methodtype): Remove semantic actions. (methoddef): Move semantic actions to objc_set_method_type(), objc_start_method_definition() and objc_finish_method_definition(). (methodproto): Move semantic actions to objc_set_method_type() and objc_add_method_declaration(). (methoddecl): Use objc_typename instead of typename; move semantic actions to objc_build_method_signature(). (optarglist, myxdecls, mydecl, myparms, myparm): Remove nonterminals. (optparmlist): Express in terms of optparms and optellipsis. (optparms, optellipsis, objc_qual, objc_quals, objc_typename): New nonterminals. (keyworddecl): Use objc_typename instead of typename. (rid_to_yy): Mark RID_IN, RID_OUT, RID_INOUT, RID_BYCOPY, RID_BYREF and RID_ONEWAY as returning OBJC_TYPE_QUAL to yyparse(). [gcc/objc/ChangeLog] 2004-09-07 Ziemowit Laski <zlaski@apple.com> * Make-lang.in (objc/objc-parse.o): Depend on $(C_COMMON_H) instead of objc/objc-act.h. (objc/objc-act.o): Depend on $(HASHTAB_H). * objc-act.c: Include hashtab.h; in ObjC++ mode, include cp-tree.h and objcp-decl.h instead of c-tree.h. (build_module_descriptor, get_class_ivars, synth_id_with_class_suffix, error_with_ivar, gen_method_decl, gen_declaration, setup_string_decl, build_protocol_template): Adjust prototypes. (build_module_initializer_routine, start_class, continue_class, finish_class, start_method_def, objc_start_function, start_protocol, build_method_decl, objc_add_method, add_instance_variable, build_ivar_reference, is_ivar, is_private, get_super_receiver, build_selector_table_decl, objc_push_parm, objc_get_parm_info, gen_type_name, gen_type_name_0, start_var_decl, finish_var_decl, create_field_decl): New prototypes. (objc_expand_function_end, comp_method_with_proto, objc_expr_last, gen_declaration_1, gen_declarator, is_complex_decl, adorn_decl, define_decl, create_builtin_decl, gen_declspecs): Remove prototypes. (TYPE_ID): Rename to OBJECT_TYPEDEF_NAME. (CLASS_TYPEDEF_NAME): New. (TAG_EXECCLASS): Change from a global variable to a #define. (TAG_RETURN_STRUCT): Delete. (TAG_GNUINIT): New, holds '__objc_gnu_init' name. (objc_inherit_code, objc_public_flag): New, moved from c-parse.in. (string_descriptor): New struct. (string_htab): New hash table. (string_hash, string_eq): New prototypes. (generate_struct_by_value_array): Call create_field_decl() instead of create_builtin_decl(). (objc_init): Do not initialize objc_ellipsis_node or TAG_EXECCLASS; In ObjC++ mode, call cxx_init() instead of c_objc_common_init(). (objc_finish_file): In ObjC++, call instantiate_pending_templates() and cp_finish_file(). (define_decl, get_static_reference, get_protocol_reference, create_builtin_decl): Remove functions. (objc_start_class_interface, objc_start_category_interface, objc_start_protocol, objc_continue_interface, objc_finish_interface, objc_start_class_implementation, objc_start_category_implementation, objc_continue_implementation, objc_finish_implementation, objc_set_visibility, objc_set_method_type, objc_build_method_signature, objc_add_method_declaration, objc_start_method_definition, objc_add_instance_variable, objc_get_protocol_qualified_type, create_field_decl, start_var_decl, finish_var_decl): New functions. (setup_string_decl): Simplify since it is only called once. (synth_module_prologue): Call build_class_template(); predefine 'id' and 'Class' as typedefs; rename 'temp_type' to 'type'; disable debug hooks for duration of function; fix GNU runtime messenger signatures to correspond to reality; forward-declare '__objc_exec_class' for the GNU runtime; call build_selector_table_decl(); in ObjC++ mode, generate 'extern "C" { ... }' wrappers around synthesized declarations; call build_protocol_template() and build_category_template(). (string_hash, string_eq): New functions. (objc_build_string_object): Check metaclass correctness only once; store string literals in hash table. (objc_build_constructor): Do not convert initializer elements; adjust for ObjC++ impedance mismatch. (build_objc_symtab_template): Call create_field_decl() instead of create_builtin_decl(). (init_objc_symtab): Add missing conversion to initializer element. (build_metadata_decl): Call start_var_decl() instead of define_decl(). (generate_objc_symtab_decl): Do not call build_category_template(); call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(). (build_module_descriptor): Call create_field_decl() instead of grokfield(); call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(); always mark module descriptor as used; move GNU runtime-specific functionality to build_module_initializer_routine(). (build_module_initializer_routine): New function, broken off of build_module_descriptor(). (objc_static_init_needed_p, objc_generate_static_init_call): New functions. (generate_static_references, generate_strings, build_selector_translation_table, generate_descriptor_table, generate_ivars_list, generate_dispatch_table, generate_category): Call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(); build a type directly instead of via groktypename(). (build_selector_reference_decl, build_selector_table_decl, build_class_reference_decl, build_protocol_reference, generate_objc_image_info): Call start_var_decl() instead of build_decl(). (build_selector_reference): For GNU runtime, do not call build_selector_reference_decl(). (build_selector, build_typed_selector_reference): Always convert result to the selector type. (add_objc_string): Cast return value to 'char *'. (build_method_prototype_template, build_selector_template, build_method_template): Use actual selector type for fields pointing to selectors. (finish_objc): For GNU runtime, call build_module_initializer_routine() after build_module_descriptor(). (generate_protocol_list, generate_shared_structures): Call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(); build a type directly instead of via groktypename(). (synth_id_with_class_suffix): Return a string. (get_arg_type_list): For instance methods, use the instance type for 'self'; do not call groktypename_in_parm_context(). (build_objc_string_decl): Squash redeclaration errors in ObjC++. (objc_is_class_name): Use OBJC_TYPE_NAME instead of TYPE_NAME; handle RECORD_TYPEs in ObjC as well as ObjC++. (objc_is_id): New function. (objc_is_object_ptr): Return the canonical type node. (objc_get_class_ivars): Simplify using get_class_ivars(). (get_class_ivars): Remove second parameter; create a fresh copy of the ivar list for each call; do not check for existence of super class. (objc_eh_runtime_type): Mark #ifndef OBJCPLUS. (objc_init_exceptions): When using SJLJ-style exceptions, require the use of '-fobjc-exceptions' flag; do not require it for DWARF-style exceptions. (objc_build_exc_ptr, next_sjlj_build_try_catch_finally): Use objc_object_type instead of objc_id_type. (objc_begin_catch_clause): Convert the incoming PARM_DECL into a VAR_DECL before placing it in the appropriate scope; do not call define_decl(); adjust call to c_begin_compound_stmt(); use objc_object_type instead of objc_id_type. (build_next_objc_exception_stuff): Call create_field_decl() instead of create_builtin_decl(); construct type directly instead of calling groktypename(); use OBJC_VOID_AT_END to mark end of function parameters. (build_private_template): Adjust call to get_class_ivars(); build a type directly instead of via groktypename(). (build_protocol_template, build_method_prototype_list_template, build_method_prototype_template, build_category_template, build_selector_template, build_class_template, build_super_template, build_ivar_template, build_ivar_list_template, build_method_list_template, build_method_template): Call create_field_decl() instead of grokfield(). (objc_method_parm_type): Do not call groktypename(). (generate_descriptor_table): Call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(). (generate_method_descriptors, build_protocol_initializer, generate_dispatch_tables, build_category_initializer, build_shared_structure_initializer): Do not call groktypename(). (generate_protocols): Call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(); do not call groktypename(). (error_with_ivar): Remove last parameter. (check_ivars): Do not iterate ovar CLASS_RAW_IVARS lists in addition to CLASS_IVARS lists; adjust calls to error_with_ivar(). (generate_ivar_lists): Convert one of the initializer elements; do not call groktypename(). (get_arg_type_list, start_method_def, gen_method_def): Account for new representation of variable arguments and '...' in Objective-C methods; add Objective-C++ impedance matching code. (is_objc_type_qualifier): Remove function. (adjust_type_for_id_default): Simplify; there is no longer a need to wade through declspecs. (lookup_interface, start_class, continue_class, finish_class, start_method_def, start_protocol, build_method_decl, objc_add_method, add_instance_variable, build_ivar_reference, is_ivar, is_private, get_super_receiver, objc_build_finally_epilogue): Make into static functions. (receiver_is_class_object): Use new IS_CLASS() macro. (objc_build_message_expr): Tweak ObjC++ message argument handling; call objc_finish_message_expr() instead of finish_message_expr(). (finish_message_expr): Rename to objc_finish_message_expr(); use OBJC_TYPE_NAME and OBJC_SET_TYPE_NAME macros instead of TYPE_NAME. call gen_type_name() instead of gen_declaration(); call objc_is_id() instead of using IS_ID and IS_CLASS; Use objc_class_name instead of calling get_identifier("Class"); handle CONVERT_EXPRs in receiver. (build_objc_method_call, warn_with_method): Do not call groktypename(). (build_ivar_reference): Call convert() instead of clobbering in a type. (hash_init): Initialize string_htab hash table. (add_instance_variable): Simplify parameter list; do not call grokfield(); do not populate CLASS_IVARS list. (start_class): Check for the existence of super class, if one was specified. (continue_class): Use CLASS_RAW_IVARS rather than CLASS_IVARS; do not call build_class_template(); adjust call to get_class_ivars(); call build_decl(), pushdecl() and finish_decl() instead of define_decl(). (finish_class): Call build_decl(), pushdecl() and finish_decl() instead of define_decl(). (add_protocols): Use PROTOCOL_BINFO_ELTS for the tree vector size. (start_protocol): Do not call build_protocol_template(); use PROTOCOL_BINFO_ELTS for the tree vector size. (encode_type_qualifiers): Do not handle the 'const' qualifier here. (encode_pointer): Encode 'const char *' as 'r*', for backwards compatibility. (encode_array): Use HOST_WIDE_INT_PRINT_DEC instead of "%ld". (encode_type): Handle the 'const' qualifier here. (objc_parmlist): New global variable, sued by objc_push_parm and objc_get_parm_info(). (objc_push_parm, objc_get_parm_info): New functions. (objc_expr_last): Remove function. (synth_self_and_ucmd_args): For instance methods, use the instance type for 'self'; call objc_push_parm() instead of push_parm_decl(). (start_method_def): Do not call push_scope(), declare_parm_level(), pop_scope(), push_parm_decl(), store_parm_decls() or objc_expr_last(); just use objc_push_parm() and objc_get_parm_info(). (comp_method_with_proto): Remove function. (objc_types_are_equivalent): Strip away indirections before comparing underlying types. (comp_proto_with_proto): Do not call groktypename(); types are no longer in raw declspec format. (objc_start_function): New function. (really_start_method): Call comp_proto_with_proto() instead of comp_method_with_proto(); call objc_start_function() instead of hand-crafting a function declarator. (continue_method_def, objc_expand_function_end): Remove functions. (get_super_receiver): Call objc_get_current_scope() instead of get_current_scope(); reference 'super_class' field (instead of 'class'). (finish_method_def): Rename to objc_finish_method_definition() and add a function decl parameter; move method encoding call from objc_expand_function_end(). (is_complex_decl, adorn_decl, gen_declarator, gen_declspecs, gen_declaration_1): Remove functions. (tmpbuf, RAW_DECLSPEC): Remove. (gen_declaration): Remove second parameter; simplify to deal with TYPE_P nodes instead of raw declspecs. (gen_type_name, gen_type_name_0): New functions. (gen_method_decl): Remove second parameter; call gen_type_name() instead of gen_declaration_1(). (dump_interface): Adjust calls to gen_declaration() and gen_method_decl(); do not allocate a separate string buffer. (init_objc): Allocate a larger string buffer to accommodate dump_interface(); adjust call to build_module_descriptor(); add call to build_module_initializer_routine() for the GNU runtime. (generate_classref_translation_entry): Do not call start_decl(); call finish_var_decl() instead of finish_decl(); call convert() instead of build_c_cast(). * objc-act.h (CLASS_OWN_IVARS): Remove accessor. (CLASS_BINFO_ELTS): Reduce from 6 to 5, now that CLASS_OWN_IVARS is gone. (OCTI_GNU_INIT_DECL, GNU_INIT_decl): New. (OCTI_ELLIPSIS_NODE, objc_ellipsis_node): Remove. (OCTI_ID_ID, id_type, objc_id_id): Rename to OCTI_ID_NAME, objc_object_type and objc_object_name, respectively. (OCTI_CLS_REF, OCTI_CLASS_NAME, objc_class_reference, objc_class_name): New. (IS_CLASS): New macro. (IS_ID, IS_SUPER): Robustify. (OCTI_EXECCLASS_DECL, execclass_decl): New. (finish_file, start_class, continue_class, finish_class, start_method_def, continue_method_def, finish_method_def, start_protocol, finish_protocol, objc_build_throw_stmt, objc_build_try_catch_finally_stmt, objc_build_synchronized_prologue, objc_build_synchronized_epilogue, objc_build_try_prologue, objc_build_try_epilogue, objc_build_catch_stmt, objc_build_catch_epilogue, objc_build_finally_prologue, objc_build_finally_epilogue, is_ivar, is_private, is_public, add_instance_variable, objc_add_method, get_super_receiver, objc_clear_super_receiver, get_class_ivars_from_name, get_class_reference, get_static_reference, get_object_reference, build_message_expr, finish_message_expr, build_selector_expr, build_ivar_reference, build_keyword_decl, build_method_decl, build_protocol_expr, build_objc_string_object, objc_declare_alias, objc_declare_class, objc_declare_protocols, objc_comptypes, objc_check_decl, build_encode_expr): Remove prototypes. (imp_count, cat_count): Make GGC-aware. (OBJC_SET_TYPE_NAME): New macro. From-SVN: r87168
2004-09-08 02:49:44 +02:00
|| TREE_CODE (rtype) == CONVERT_EXPR
|| TREE_CODE (rtype) == COMPONENT_REF)
rtype = TREE_OPERAND (rtype, 0);
self = (rtype == self_decl);
super = (rtype == UOBJC_SUPER_decl);
rtype = TREE_TYPE (receiver);
have_cast = (TREE_CODE (receiver) == NOP_EXPR
|| (TREE_CODE (receiver) == COMPOUND_EXPR
&& !IS_SUPER (rtype)));
Yet more Objective-C++... * objc-act.c (objc_finish_try_stmt): Add return value. (objc_build_synchronized): Likewise. * objc-act.c (objc_is_gcable_type): Add. (objc_substitute_decl): Add. (objc_build_ivar_assignment): Add. (objc_build_global_assignment): Add. (objc_build_strong_cast_assignment): Add. (objc_is_ivar_reference_p): Add. (objc_is_global_reference_p): Add. (objc_generate_write_barrier): Add. (objc_rewrite_function_call): Add. (objc_gimplify_expr): Add Objective-C++ support. * objc-act.h (ALLOC_OBJC_TYPE_LANG_SPECIFIC): Likewise. (SIZEOF_OBJC_TYPE_LANG_SPECIFIC): Add. (INIT_TYPE_OBJC_INFO): Add Objective-C++ support. (DUP_TYPE_OBJC_INFO): Likewise. (struct imp_entry): Add field has_cxx_cdtors. (struct imp_entry *imp_list): Add OCTI_UMSG_FAST_DECL, OCTI_METH_LIST_TEMPL, OCTI_METH_PROTO_LIST_TEMPL, OCTI_IVAR_LIST_TEMPL, OCTI_ASSIGN_IVAR_DECL, OCTI_ASSIGN_IVAR_FAST_DECL, OCTI_ASSIGN_GLOBAL_DECL, OCTI_ASSIGN_STRONGCAST_DECL. (umsg_fast_decl): Add. (objc_assign_ivar_decl): Add. (objc_assign_ivar_fast_decl): Add. (objc_assign_global_decl): Add. (objc_assign_strong_cast_decl): Add. (objc_method_list_ptr): Add. (objc_method_proto_list_ptr): Add. (objc_ivar_list_ptr): Add. * objc-act.c (should_call_super_dealloc): Add. (OBJC_VERSION): Bump to 6. (objc_is_gcable_type): Add. (objc_substitute_decl): Add. (objc_build_ivar_assignment): Add. (objc_build_global_assignment): Add. (objc_build_strong_cast_assignment): Add. (objc_is_gcable_p): Add. (objc_is_ivar_reference_p): Add. (objc_is_global_reference_p): Add. (generate_shared_structures): Add flags parameter. (objc_generate_cxx_ctor_or_dtor): Add. (objc_generate_cxx_cdtors): Add. (add_class): Add name parameter. (objc_types_share_size_and_alignment): Add. (comp_proto_with_proto): Add strict parameter. (CLS_HAS_CXX_STRUCTORS): Add. (TAG_ASSIGNIVAR): Add. (TAG_ASSIGNGLOBAL): Add. (TAG_ASSIGNSTRONGCAST): Add. (TAG_MSGSEND_FAST): Add. (TAG_ASSIGNIVAR_FAST): Add. (TAG_CXX_CONSTRUCT): Add. (TAG_CXX_DESTRUCT): Add. (OBJC_LOOKUP_CLASS): Add. (OBJC_LOOKUP_NO_SUPER): Add. (objc_finish_file): Add pch support. (objc_finish_implementation): Add Objective-C++ support. (synth_module_prologue): Likewise. (synth_module_prologue): Add fast dispatching. (objc_get_class_reference): Add Objective-C++ support. (objc_generate_write_barrier): Likewise. (next_sjlj_build_enter_and_setjmp): Likewise. (objc_begin_try_stmt): Likewise. (build_next_objc_exception_stuff): Add fast ivar support. (build_private_template): Mark the record as used so debug information is generated. (build_protocol_template): Add Objective-C++ support. (objc_method_parm_type) Likewise. (objc_generate_cxx_ctor_or_dtor): Likewise. (objc_generate_cxx_cdtors): Likewise. (build_protocol_initializer): Likewise. (build_category_template): Likewise. (build_class_template): Likewise. (build_method_list_template): Likewise. (build_category_initializer): Likewise. (build_shared_structure_initializer): Likewise. (objc_finish_message_expr): Likewise. (build_objc_method_call): Add fast dispatch support. (lookup_method_static): Add support to end search at superclasses. (add_method_to_hash_list): Add strict parameter to comp_proto_with_proto. (objc_add_method): Likewise. (objc_add_method): Also set the interface_value. (add_instance_variable): Add Objective-C++ support. (objc_is_public): Likewise. (start_class): Likewise. (continue_class): Likewise. (encode_aggregate_within): Likewise. (start_method_def): Likewise. (objc_start_function): Clear current_function_returns_value and current_function_returns_null. (really_start_method): Add Objective-C++ support. (objc_finish_method_definition): Add warning for missing [super dealloc]. (finish_objc): Add Objective-C++ support. (generate_objc_image_info): Likewise. (objc_lookup_ivar): Likewise. * objc-act.h (TYPE_HAS_OBJC_INFO): Likewise. (INIT_TYPE_OBJC_INFO): Likewise. (DUP_TYPE_OBJC_INFO): Likewise. From-SVN: r99857
2005-05-17 22:07:08 +02:00
/* If we are calling [super dealloc], reset our warning flag. */
if (super && !strcmp ("dealloc", IDENTIFIER_POINTER (sel_name)))
should_call_super_dealloc = 0;
/* If the receiver is a class object, retrieve the corresponding
@interface, if one exists. */
objc-act.h (get_object_reference): Rename to get_protocol_reference. 2004-06-20 David Ayers <d.ayers@inode.at> * objc/objc-act.h (get_object_reference): Rename to get_protocol_reference. (super_type): Rename to objc_super_type. (selector_type): Rename to objc_selector_type. (id_type): Rename to objc_id_type. (instance_type): Rename to objc_instance_type. (protocol_type): Rename to objc_protocol_type. (IS_ID): Update reference to id_type. * objc/objc-act.c (get_object_reference): Rename to get_protocol_reference; add documentation; update references to id_type. (lookup_method_in_protocol_list): Rename class_meth to is_class; add documentation. (finish_message_expr): Rename is_class to class_tree. (synth_module_prologue, objc_is_object_ptr, objc_build_exc_ptr, next_sjlj_build_try_catch_finally, objc_begin_catch_clause, build_next_objc_exception_stuff, get_arg_type_list, build_objc_method_call): Update references to id_type. (synth_module_prologue, build_objc_symtab_template, build_selector_reference_decl, build_selector, build_selector_translation_table, build_typed_selector_reference, get_arg_type_list, synth_self_and_ucmd_args, get_arg_type_list, synth_self_and_ucmd_args): Update references to selector_type. (build_private_template, build_ivar_reference): Update references to instance_type. (synth_module_prologue, build_protocol_reference, build_protocol_expr, start_protocol): Update references to protocol_type. (synth_module_prologue, get_arg_type_list, build_objc_method_call): Update references to super_type. * c-parse.in: (typespec_nonreserved_nonattr): Update references to get_object_reference. * objc/objc-tree.def: Add C mode identifier sequence. From-SVN: r83425
2004-06-21 03:50:18 +02:00
class_tree = receiver_is_class_object (receiver, self, super);
/* Now determine the receiver type (if an explicit cast has not been
provided). */
if (!have_cast)
{
objc-act.h (get_object_reference): Rename to get_protocol_reference. 2004-06-20 David Ayers <d.ayers@inode.at> * objc/objc-act.h (get_object_reference): Rename to get_protocol_reference. (super_type): Rename to objc_super_type. (selector_type): Rename to objc_selector_type. (id_type): Rename to objc_id_type. (instance_type): Rename to objc_instance_type. (protocol_type): Rename to objc_protocol_type. (IS_ID): Update reference to id_type. * objc/objc-act.c (get_object_reference): Rename to get_protocol_reference; add documentation; update references to id_type. (lookup_method_in_protocol_list): Rename class_meth to is_class; add documentation. (finish_message_expr): Rename is_class to class_tree. (synth_module_prologue, objc_is_object_ptr, objc_build_exc_ptr, next_sjlj_build_try_catch_finally, objc_begin_catch_clause, build_next_objc_exception_stuff, get_arg_type_list, build_objc_method_call): Update references to id_type. (synth_module_prologue, build_objc_symtab_template, build_selector_reference_decl, build_selector, build_selector_translation_table, build_typed_selector_reference, get_arg_type_list, synth_self_and_ucmd_args, get_arg_type_list, synth_self_and_ucmd_args): Update references to selector_type. (build_private_template, build_ivar_reference): Update references to instance_type. (synth_module_prologue, build_protocol_reference, build_protocol_expr, start_protocol): Update references to protocol_type. (synth_module_prologue, get_arg_type_list, build_objc_method_call): Update references to super_type. * c-parse.in: (typespec_nonreserved_nonattr): Update references to get_object_reference. * objc/objc-tree.def: Add C mode identifier sequence. From-SVN: r83425
2004-06-21 03:50:18 +02:00
if (class_tree)
rtype = lookup_interface (class_tree);
/* Handle `self' and `super'. */
else if (super)
c-parse.in (objc_inherit_code, [...]): Make static. 2001-10-03 Ziemowit Laski <zlaski@apple.com> * c-parse.in (objc_inherit_code, objc_pq_context, objc_public_flag): Make static. (objc_interface_context, objc_implementation_context, objc_method_context, objc_ivar_chain, objc_ivar_context): Move to global tree array in objc/objc-act.[ch]. (methoddef): Remove unnecessary code. * objc/objc-act.c: (hashed_attribute, hashed_entry, imp_entry): Hoist struct definitions to objc-act.h. (nst_method_hash_list, cls_method_hash_list, imp_list, imp_count, cat_count): Place declaration in objc-act.h. (objc_tree_index): Move enumeration to objc-act.h. (objc_global_trees): Place declaration and macro accessors in objc-act.h. (implementation_context): Remove duplicate; use objc_implementation_context instead: (method_context): Remove duplicate; use objc_method_context instead. (objc_ellipsis_node, objc_method_prototype_template, implemented_classes, function_type): Move global vars to objc_global_trees. (init_objc): Use LAST_BASE_TREE_CODE instead of LAST_CODE. (build_message_expr): Move actual construction of ObjC message send nodes to finish_message_expr. (finish_message_expr): New routine, contains code formerly in build_message_expr. * objc/objc-act.h (finish_message_expr): New prototype. (objc_ivar_chain, objc_method_context, objc_ellipsis_node): Remove declarations; these vars are now part of objc_global_trees. (objc_tree_index, objc_global_trees): Move definitions from objc-act.c. * objc/objc-tree.def: Update copyright info. From-SVN: r46000
2001-10-04 00:05:57 +02:00
{
if (!CLASS_SUPER_NAME (implementation_template))
{
builtins.c, [...]: Avoid "`" as left quote, using "'" or %q, %< and %> as appropriate. * builtins.c, c-common.c, c-decl.c, c-format.c, c-format.h, c-parse.in, c-pch.c, c-pragma.c, collect2.c, final.c, gcc.c, gcov.c, opts.c, pretty-print.h, protoize.c, reg-stack.c, rtl.c, tlink.c, config/alpha/alpha.c, config/arc/arc.c, config/arm/arm.c, config/avr/avr.c, config/c4x/c4x.c, config/darwin.c, config/frv/frv.c, config/h8300/h8300.c, config/i386/i386.c, config/i386/winnt.c, config/ia64/ia64.c, config/ip2k/ip2k.c, config/iq2000/iq2000.c, config/m32r/m32r.c, config/m68hc11/m68hc11.c, config/m68k/m68k.c, config/m68k/m68k.h, config/mcore/mcore.c, config/mips/mips.c, config/mmix/mmix.c, config/ns32k/ns32k.c, config/rs6000/host-darwin.c, config/rs6000/rs6000.c, config/s390/s390.c, config/sh/sh.c, config/sh/symbian.c, config/stormy16/stormy16.c, config/v850/v850.c: Avoid "`" as left quote, using "'" or %q, %< and %> as appropriate. Use %' as apostrophe in diagnostics where applicable. Use %< and %> in place of '' quotes where applicable. Use %qs in place of %<%s%>. Consistently quote __builtin function names. ada: * misc.c (gnat_handle_option): Use %< and %> for quoting in warning message. cp: * call.c, class.c, decl.c, decl2.c, error.c, mangle.c, parser.c, pt.c, search.c, semantics.c, typeck.c: Use %q, %< and %> for quoting in diagnostics. * parser.c (cp_parser_sizeof_operand): Use '' instead of `' for quoting in printf format. * decl.c (duplicate_decls, start_decl): Use %qD instead of unquoted %D. objc: * objc-act.c: Use %q, %< and %> for quoting in diagnostics. testsuite: * gcc.dg/builtin-prefetch-1.c: Adjust expected messages. From-SVN: r90337
2004-11-09 11:13:30 +01:00
error ("no super class declared in @interface for %qs",
IDENTIFIER_POINTER (CLASS_NAME (implementation_template)));
return error_mark_node;
}
rtype = lookup_interface (CLASS_SUPER_NAME (implementation_template));
c-parse.in (objc_inherit_code, [...]): Make static. 2001-10-03 Ziemowit Laski <zlaski@apple.com> * c-parse.in (objc_inherit_code, objc_pq_context, objc_public_flag): Make static. (objc_interface_context, objc_implementation_context, objc_method_context, objc_ivar_chain, objc_ivar_context): Move to global tree array in objc/objc-act.[ch]. (methoddef): Remove unnecessary code. * objc/objc-act.c: (hashed_attribute, hashed_entry, imp_entry): Hoist struct definitions to objc-act.h. (nst_method_hash_list, cls_method_hash_list, imp_list, imp_count, cat_count): Place declaration in objc-act.h. (objc_tree_index): Move enumeration to objc-act.h. (objc_global_trees): Place declaration and macro accessors in objc-act.h. (implementation_context): Remove duplicate; use objc_implementation_context instead: (method_context): Remove duplicate; use objc_method_context instead. (objc_ellipsis_node, objc_method_prototype_template, implemented_classes, function_type): Move global vars to objc_global_trees. (init_objc): Use LAST_BASE_TREE_CODE instead of LAST_CODE. (build_message_expr): Move actual construction of ObjC message send nodes to finish_message_expr. (finish_message_expr): New routine, contains code formerly in build_message_expr. * objc/objc-act.h (finish_message_expr): New prototype. (objc_ivar_chain, objc_method_context, objc_ellipsis_node): Remove declarations; these vars are now part of objc_global_trees. (objc_tree_index, objc_global_trees): Move definitions from objc-act.c. * objc/objc-tree.def: Update copyright info. From-SVN: r46000
2001-10-04 00:05:57 +02:00
}
else if (self)
rtype = lookup_interface (CLASS_NAME (implementation_template));
c-parse.in (objc_inherit_code, [...]): Make static. 2001-10-03 Ziemowit Laski <zlaski@apple.com> * c-parse.in (objc_inherit_code, objc_pq_context, objc_public_flag): Make static. (objc_interface_context, objc_implementation_context, objc_method_context, objc_ivar_chain, objc_ivar_context): Move to global tree array in objc/objc-act.[ch]. (methoddef): Remove unnecessary code. * objc/objc-act.c: (hashed_attribute, hashed_entry, imp_entry): Hoist struct definitions to objc-act.h. (nst_method_hash_list, cls_method_hash_list, imp_list, imp_count, cat_count): Place declaration in objc-act.h. (objc_tree_index): Move enumeration to objc-act.h. (objc_global_trees): Place declaration and macro accessors in objc-act.h. (implementation_context): Remove duplicate; use objc_implementation_context instead: (method_context): Remove duplicate; use objc_method_context instead. (objc_ellipsis_node, objc_method_prototype_template, implemented_classes, function_type): Move global vars to objc_global_trees. (init_objc): Use LAST_BASE_TREE_CODE instead of LAST_CODE. (build_message_expr): Move actual construction of ObjC message send nodes to finish_message_expr. (finish_message_expr): New routine, contains code formerly in build_message_expr. * objc/objc-act.h (finish_message_expr): New prototype. (objc_ivar_chain, objc_method_context, objc_ellipsis_node): Remove declarations; these vars are now part of objc_global_trees. (objc_tree_index, objc_global_trees): Move definitions from objc-act.c. * objc/objc-tree.def: Update copyright info. From-SVN: r46000
2001-10-04 00:05:57 +02:00
}
/* If receiver is of type `id' or `Class' (or if the @interface for a
class is not visible), we shall be satisfied with the existence of
any instance or class method. */
Yet more Objective-C++... * objc-act.c (objc_finish_try_stmt): Add return value. (objc_build_synchronized): Likewise. * objc-act.c (objc_is_gcable_type): Add. (objc_substitute_decl): Add. (objc_build_ivar_assignment): Add. (objc_build_global_assignment): Add. (objc_build_strong_cast_assignment): Add. (objc_is_ivar_reference_p): Add. (objc_is_global_reference_p): Add. (objc_generate_write_barrier): Add. (objc_rewrite_function_call): Add. (objc_gimplify_expr): Add Objective-C++ support. * objc-act.h (ALLOC_OBJC_TYPE_LANG_SPECIFIC): Likewise. (SIZEOF_OBJC_TYPE_LANG_SPECIFIC): Add. (INIT_TYPE_OBJC_INFO): Add Objective-C++ support. (DUP_TYPE_OBJC_INFO): Likewise. (struct imp_entry): Add field has_cxx_cdtors. (struct imp_entry *imp_list): Add OCTI_UMSG_FAST_DECL, OCTI_METH_LIST_TEMPL, OCTI_METH_PROTO_LIST_TEMPL, OCTI_IVAR_LIST_TEMPL, OCTI_ASSIGN_IVAR_DECL, OCTI_ASSIGN_IVAR_FAST_DECL, OCTI_ASSIGN_GLOBAL_DECL, OCTI_ASSIGN_STRONGCAST_DECL. (umsg_fast_decl): Add. (objc_assign_ivar_decl): Add. (objc_assign_ivar_fast_decl): Add. (objc_assign_global_decl): Add. (objc_assign_strong_cast_decl): Add. (objc_method_list_ptr): Add. (objc_method_proto_list_ptr): Add. (objc_ivar_list_ptr): Add. * objc-act.c (should_call_super_dealloc): Add. (OBJC_VERSION): Bump to 6. (objc_is_gcable_type): Add. (objc_substitute_decl): Add. (objc_build_ivar_assignment): Add. (objc_build_global_assignment): Add. (objc_build_strong_cast_assignment): Add. (objc_is_gcable_p): Add. (objc_is_ivar_reference_p): Add. (objc_is_global_reference_p): Add. (generate_shared_structures): Add flags parameter. (objc_generate_cxx_ctor_or_dtor): Add. (objc_generate_cxx_cdtors): Add. (add_class): Add name parameter. (objc_types_share_size_and_alignment): Add. (comp_proto_with_proto): Add strict parameter. (CLS_HAS_CXX_STRUCTORS): Add. (TAG_ASSIGNIVAR): Add. (TAG_ASSIGNGLOBAL): Add. (TAG_ASSIGNSTRONGCAST): Add. (TAG_MSGSEND_FAST): Add. (TAG_ASSIGNIVAR_FAST): Add. (TAG_CXX_CONSTRUCT): Add. (TAG_CXX_DESTRUCT): Add. (OBJC_LOOKUP_CLASS): Add. (OBJC_LOOKUP_NO_SUPER): Add. (objc_finish_file): Add pch support. (objc_finish_implementation): Add Objective-C++ support. (synth_module_prologue): Likewise. (synth_module_prologue): Add fast dispatching. (objc_get_class_reference): Add Objective-C++ support. (objc_generate_write_barrier): Likewise. (next_sjlj_build_enter_and_setjmp): Likewise. (objc_begin_try_stmt): Likewise. (build_next_objc_exception_stuff): Add fast ivar support. (build_private_template): Mark the record as used so debug information is generated. (build_protocol_template): Add Objective-C++ support. (objc_method_parm_type) Likewise. (objc_generate_cxx_ctor_or_dtor): Likewise. (objc_generate_cxx_cdtors): Likewise. (build_protocol_initializer): Likewise. (build_category_template): Likewise. (build_class_template): Likewise. (build_method_list_template): Likewise. (build_category_initializer): Likewise. (build_shared_structure_initializer): Likewise. (objc_finish_message_expr): Likewise. (build_objc_method_call): Add fast dispatch support. (lookup_method_static): Add support to end search at superclasses. (add_method_to_hash_list): Add strict parameter to comp_proto_with_proto. (objc_add_method): Likewise. (objc_add_method): Also set the interface_value. (add_instance_variable): Add Objective-C++ support. (objc_is_public): Likewise. (start_class): Likewise. (continue_class): Likewise. (encode_aggregate_within): Likewise. (start_method_def): Likewise. (objc_start_function): Clear current_function_returns_value and current_function_returns_null. (really_start_method): Add Objective-C++ support. (objc_finish_method_definition): Add warning for missing [super dealloc]. (finish_objc): Add Objective-C++ support. (generate_objc_image_info): Likewise. (objc_lookup_ivar): Likewise. * objc-act.h (TYPE_HAS_OBJC_INFO): Likewise. (INIT_TYPE_OBJC_INFO): Likewise. (DUP_TYPE_OBJC_INFO): Likewise. From-SVN: r99857
2005-05-17 22:07:08 +02:00
if (objc_is_id (rtype))
1992-01-18 00:15:38 +01:00
{
Yet more Objective-C++... * objc-act.c (objc_finish_try_stmt): Add return value. (objc_build_synchronized): Likewise. * objc-act.c (objc_is_gcable_type): Add. (objc_substitute_decl): Add. (objc_build_ivar_assignment): Add. (objc_build_global_assignment): Add. (objc_build_strong_cast_assignment): Add. (objc_is_ivar_reference_p): Add. (objc_is_global_reference_p): Add. (objc_generate_write_barrier): Add. (objc_rewrite_function_call): Add. (objc_gimplify_expr): Add Objective-C++ support. * objc-act.h (ALLOC_OBJC_TYPE_LANG_SPECIFIC): Likewise. (SIZEOF_OBJC_TYPE_LANG_SPECIFIC): Add. (INIT_TYPE_OBJC_INFO): Add Objective-C++ support. (DUP_TYPE_OBJC_INFO): Likewise. (struct imp_entry): Add field has_cxx_cdtors. (struct imp_entry *imp_list): Add OCTI_UMSG_FAST_DECL, OCTI_METH_LIST_TEMPL, OCTI_METH_PROTO_LIST_TEMPL, OCTI_IVAR_LIST_TEMPL, OCTI_ASSIGN_IVAR_DECL, OCTI_ASSIGN_IVAR_FAST_DECL, OCTI_ASSIGN_GLOBAL_DECL, OCTI_ASSIGN_STRONGCAST_DECL. (umsg_fast_decl): Add. (objc_assign_ivar_decl): Add. (objc_assign_ivar_fast_decl): Add. (objc_assign_global_decl): Add. (objc_assign_strong_cast_decl): Add. (objc_method_list_ptr): Add. (objc_method_proto_list_ptr): Add. (objc_ivar_list_ptr): Add. * objc-act.c (should_call_super_dealloc): Add. (OBJC_VERSION): Bump to 6. (objc_is_gcable_type): Add. (objc_substitute_decl): Add. (objc_build_ivar_assignment): Add. (objc_build_global_assignment): Add. (objc_build_strong_cast_assignment): Add. (objc_is_gcable_p): Add. (objc_is_ivar_reference_p): Add. (objc_is_global_reference_p): Add. (generate_shared_structures): Add flags parameter. (objc_generate_cxx_ctor_or_dtor): Add. (objc_generate_cxx_cdtors): Add. (add_class): Add name parameter. (objc_types_share_size_and_alignment): Add. (comp_proto_with_proto): Add strict parameter. (CLS_HAS_CXX_STRUCTORS): Add. (TAG_ASSIGNIVAR): Add. (TAG_ASSIGNGLOBAL): Add. (TAG_ASSIGNSTRONGCAST): Add. (TAG_MSGSEND_FAST): Add. (TAG_ASSIGNIVAR_FAST): Add. (TAG_CXX_CONSTRUCT): Add. (TAG_CXX_DESTRUCT): Add. (OBJC_LOOKUP_CLASS): Add. (OBJC_LOOKUP_NO_SUPER): Add. (objc_finish_file): Add pch support. (objc_finish_implementation): Add Objective-C++ support. (synth_module_prologue): Likewise. (synth_module_prologue): Add fast dispatching. (objc_get_class_reference): Add Objective-C++ support. (objc_generate_write_barrier): Likewise. (next_sjlj_build_enter_and_setjmp): Likewise. (objc_begin_try_stmt): Likewise. (build_next_objc_exception_stuff): Add fast ivar support. (build_private_template): Mark the record as used so debug information is generated. (build_protocol_template): Add Objective-C++ support. (objc_method_parm_type) Likewise. (objc_generate_cxx_ctor_or_dtor): Likewise. (objc_generate_cxx_cdtors): Likewise. (build_protocol_initializer): Likewise. (build_category_template): Likewise. (build_class_template): Likewise. (build_method_list_template): Likewise. (build_category_initializer): Likewise. (build_shared_structure_initializer): Likewise. (objc_finish_message_expr): Likewise. (build_objc_method_call): Add fast dispatch support. (lookup_method_static): Add support to end search at superclasses. (add_method_to_hash_list): Add strict parameter to comp_proto_with_proto. (objc_add_method): Likewise. (objc_add_method): Also set the interface_value. (add_instance_variable): Add Objective-C++ support. (objc_is_public): Likewise. (start_class): Likewise. (continue_class): Likewise. (encode_aggregate_within): Likewise. (start_method_def): Likewise. (objc_start_function): Clear current_function_returns_value and current_function_returns_null. (really_start_method): Add Objective-C++ support. (objc_finish_method_definition): Add warning for missing [super dealloc]. (finish_objc): Add Objective-C++ support. (generate_objc_image_info): Likewise. (objc_lookup_ivar): Likewise. * objc-act.h (TYPE_HAS_OBJC_INFO): Likewise. (INIT_TYPE_OBJC_INFO): Likewise. (DUP_TYPE_OBJC_INFO): Likewise. From-SVN: r99857
2005-05-17 22:07:08 +02:00
class_tree = (IS_CLASS (rtype) ? objc_class_name : NULL_TREE);
rprotos = (TYPE_HAS_OBJC_INFO (TREE_TYPE (rtype))
? TYPE_OBJC_PROTOCOL_LIST (TREE_TYPE (rtype))
: NULL_TREE);
rtype = NULL_TREE;
if (rprotos)
c-common.h: Remove RID_ID. [gcc/ChangeLog] 2004-10-25 David Ayers <d.ayers@inode.at> * c-common.h: Remove RID_ID. * c-parse.in: Remove OBJECTNAME and references to RID_ID. (typespec_reserved_attr): Add rule for TYPENAME non_empty_protocolrefs. (yylexname): Remove special handling of RID_ID. [gcc/objc/ChangeLog] 2004-10-25 Ziemowit Laski <zlaski@apple.com> David Ayers <d.ayers@inode.at> * objc-act.c (objc_comptypes): Use IS_PROTOCOL_QUALIFIED_UNTYPED instead of IS_PROTOCOL_QUALIFIED_ID; add comparisons for: 'Class <Protocol> != id <Protocol>'; 'Class <Protocol> != <class> *'; 'Class <Protocol> == id' and 'Class <Protocol> == Class'. (objc_is_id): Add test for 'super'. (objc_finish_message_expr): Allow for messaging of 'Class <Proto>' receivers; if class methods are not found in protocol lists, search for instance methods therein and warn if one is found. Look in global hash tables for suitable method as a last resort when messaging 'id <Proto>', 'Class <Proto>' and invalid receiver types. (objc_add_method): Insert instance methods listed in protocols into the global class method hash table. * objc-act.h (IS_PROTOCOL_QUALIFIED_ID): Rename to IS_PROTOCOL_QUALIFIED_UNTYPED and allow for 'Class <Proto>' in addition to 'id <Proto>'. [gcc/testsuite/ChangeLog] 2004-10-25 David Ayers <d.ayers@inode.at> Ziemowit Laski <zlaski@apple.com> * objc.dg/call-super-2.m: Add messages to 'Class <Proto>'; update diagnostics when messaging 'id <Proto>'. * objc.dg/class-protocol-1.m: New test. * objc.dg/desig-init-1.m: Add message to an invalid receiver using a non-existent method signature. * objc.dg/method-5.m, objc.dg/method-6.m, objc.dg/proto-hier-1.m: Update diagnostics when messaging with non-existent method signature. * objc.dg/proto-hier-2.m: Adjust wording of diagnostic. * objc.dg/proto-lossage-1.m, objc.dg/proto-lossage-4.m: Messages to invalid receivers are now resolved as if messaging 'id'; remove extraneous diagnostics. From-SVN: r89562
2004-10-26 00:55:25 +02:00
{
/* If messaging 'id <Protos>' or 'Class <Proto>', first search
in protocols themselves for the method prototype. */
method_prototype
= lookup_method_in_protocol_list (rprotos, sel_name,
class_tree != NULL_TREE);
/* If messaging 'Class <Proto>' but did not find a class method
prototype, search for an instance method instead, and warn
about having done so. */
if (!method_prototype && !rtype && class_tree != NULL_TREE)
{
method_prototype
= lookup_method_in_protocol_list (rprotos, sel_name, 0);
if (method_prototype)
diagnostic.c (warning): Accept parameter to classify warning option. * diagnostic.c (warning): Accept parameter to classify warning option. (warning0): New, for when a pointer to an error() like function is needed. * errors.c (warning): Likewise. * errors.h (warning, warning0): Adjust prototypes. * toplev.h (warning, warning0): Likewise. * attribs.c, builtins.c, c-common.c, c-decl.c, c-format.c, c-gimplify.c, c-lex.c, c-objc-common.c, c-opts.c, c-parser.c, c-pragma.c, c-typeck.c, calls.c, cgraph.c, coverage.c, emit-rtl.c, fold-const.c, fortran/trans-decl.c, function.c, gcse.c, genautomata.c, haifa-sched.c, opts.c, passes.c, regclass.c, reload1.c, stmt.c, stor-layout.c, toplev.c, tree-cfg.c, tree-dump.c, tree-inline.c, tree-mudflap.c, tree-optimize.c, tree-ssa.c, tree.c, varasm.c: Adjust warning() callers. * config/alpha/alpha.c, config/arc/arc.c, config/arm/arm.c, config/avr/avr.c, config/bfin/bfin.c, config/c4x/c4x-c.c, config/c4x/c4x.c, config/cris/cris.c, config/darwin-c.c, config/darwin.c, config/darwin.h, config/h8300/h8300.c, config/i386/cygming.h, config/i386/djgpp.h, config/i386/i386.c, config/i386/winnt.c, config/ia64/ia64-c.c, config/ia64/ia64.c, config/ip2k/ip2k.c, config/m32r/m32r.c, config/m68hc11/m68hc11.c, config/m68k/m68k.c, config/mcore/mcore.c, config/mips/mips.c, config/mmix/mmix.c, config/ns32k/ns32k.c, config/pa/pa-hpux11.h, config/pa/pa.c, config/rs6000/aix43.h, config/rs6000/aix51.h, config/rs6000/aix52.h, config/rs6000/darwin.h, config/rs6000/rs6000-c.c, config/rs6000/rs6000.c, config/s390/s390.c, config/sh/sh.c, config/sh/sh.h, config/sh/symbian.c, config/sol2-c.c, config/sol2.c, config/stormy16/stormy16.c, config/v850/v850-c.c, config/v850/v850.c, config/xtensa/xtensa.c: Adjust warning() callers. * ada/misc.c: Adjust warning() callers. * cp/call.c, cp/class.c, cp/cvt.c, cp/decl.c, cp/decl2.c, cp/except.c, cp/friend.c, cp/init.c, cp/lex.c, cp/mangle.c, cp/method.c, cp/name-lookup.c, cp/parser.c, cp/repo.c, cp/rtti.c, cp/tree.c, cp/typeck.c, cp/typeck2.c: Adjust warning() callers. * fortran/trans-decl.c: Adjust warning() callers. * java/class.c, java/decl.c, java/expr.c, java/jcf-io.c, java/jcf-parse.c, java/jv-scan.c, java/parse.y: Adjust warning() callers. * objc/objc-act.c: Adjust warning() callers. * treelang/parse.y: Adjust warning() callers. From-SVN: r98633
2005-04-23 23:29:07 +02:00
warning (0, "found %<-%s%> instead of %<+%s%> in protocol(s)",
c-common.h: Remove RID_ID. [gcc/ChangeLog] 2004-10-25 David Ayers <d.ayers@inode.at> * c-common.h: Remove RID_ID. * c-parse.in: Remove OBJECTNAME and references to RID_ID. (typespec_reserved_attr): Add rule for TYPENAME non_empty_protocolrefs. (yylexname): Remove special handling of RID_ID. [gcc/objc/ChangeLog] 2004-10-25 Ziemowit Laski <zlaski@apple.com> David Ayers <d.ayers@inode.at> * objc-act.c (objc_comptypes): Use IS_PROTOCOL_QUALIFIED_UNTYPED instead of IS_PROTOCOL_QUALIFIED_ID; add comparisons for: 'Class <Protocol> != id <Protocol>'; 'Class <Protocol> != <class> *'; 'Class <Protocol> == id' and 'Class <Protocol> == Class'. (objc_is_id): Add test for 'super'. (objc_finish_message_expr): Allow for messaging of 'Class <Proto>' receivers; if class methods are not found in protocol lists, search for instance methods therein and warn if one is found. Look in global hash tables for suitable method as a last resort when messaging 'id <Proto>', 'Class <Proto>' and invalid receiver types. (objc_add_method): Insert instance methods listed in protocols into the global class method hash table. * objc-act.h (IS_PROTOCOL_QUALIFIED_ID): Rename to IS_PROTOCOL_QUALIFIED_UNTYPED and allow for 'Class <Proto>' in addition to 'id <Proto>'. [gcc/testsuite/ChangeLog] 2004-10-25 David Ayers <d.ayers@inode.at> Ziemowit Laski <zlaski@apple.com> * objc.dg/call-super-2.m: Add messages to 'Class <Proto>'; update diagnostics when messaging 'id <Proto>'. * objc.dg/class-protocol-1.m: New test. * objc.dg/desig-init-1.m: Add message to an invalid receiver using a non-existent method signature. * objc.dg/method-5.m, objc.dg/method-6.m, objc.dg/proto-hier-1.m: Update diagnostics when messaging with non-existent method signature. * objc.dg/proto-hier-2.m: Adjust wording of diagnostic. * objc.dg/proto-lossage-1.m, objc.dg/proto-lossage-4.m: Messages to invalid receivers are now resolved as if messaging 'id'; remove extraneous diagnostics. From-SVN: r89562
2004-10-26 00:55:25 +02:00
IDENTIFIER_POINTER (sel_name),
IDENTIFIER_POINTER (sel_name));
}
}
1992-01-18 00:15:38 +01:00
}
Yet more Objective-C++... * objc-act.c (objc_finish_try_stmt): Add return value. (objc_build_synchronized): Likewise. * objc-act.c (objc_is_gcable_type): Add. (objc_substitute_decl): Add. (objc_build_ivar_assignment): Add. (objc_build_global_assignment): Add. (objc_build_strong_cast_assignment): Add. (objc_is_ivar_reference_p): Add. (objc_is_global_reference_p): Add. (objc_generate_write_barrier): Add. (objc_rewrite_function_call): Add. (objc_gimplify_expr): Add Objective-C++ support. * objc-act.h (ALLOC_OBJC_TYPE_LANG_SPECIFIC): Likewise. (SIZEOF_OBJC_TYPE_LANG_SPECIFIC): Add. (INIT_TYPE_OBJC_INFO): Add Objective-C++ support. (DUP_TYPE_OBJC_INFO): Likewise. (struct imp_entry): Add field has_cxx_cdtors. (struct imp_entry *imp_list): Add OCTI_UMSG_FAST_DECL, OCTI_METH_LIST_TEMPL, OCTI_METH_PROTO_LIST_TEMPL, OCTI_IVAR_LIST_TEMPL, OCTI_ASSIGN_IVAR_DECL, OCTI_ASSIGN_IVAR_FAST_DECL, OCTI_ASSIGN_GLOBAL_DECL, OCTI_ASSIGN_STRONGCAST_DECL. (umsg_fast_decl): Add. (objc_assign_ivar_decl): Add. (objc_assign_ivar_fast_decl): Add. (objc_assign_global_decl): Add. (objc_assign_strong_cast_decl): Add. (objc_method_list_ptr): Add. (objc_method_proto_list_ptr): Add. (objc_ivar_list_ptr): Add. * objc-act.c (should_call_super_dealloc): Add. (OBJC_VERSION): Bump to 6. (objc_is_gcable_type): Add. (objc_substitute_decl): Add. (objc_build_ivar_assignment): Add. (objc_build_global_assignment): Add. (objc_build_strong_cast_assignment): Add. (objc_is_gcable_p): Add. (objc_is_ivar_reference_p): Add. (objc_is_global_reference_p): Add. (generate_shared_structures): Add flags parameter. (objc_generate_cxx_ctor_or_dtor): Add. (objc_generate_cxx_cdtors): Add. (add_class): Add name parameter. (objc_types_share_size_and_alignment): Add. (comp_proto_with_proto): Add strict parameter. (CLS_HAS_CXX_STRUCTORS): Add. (TAG_ASSIGNIVAR): Add. (TAG_ASSIGNGLOBAL): Add. (TAG_ASSIGNSTRONGCAST): Add. (TAG_MSGSEND_FAST): Add. (TAG_ASSIGNIVAR_FAST): Add. (TAG_CXX_CONSTRUCT): Add. (TAG_CXX_DESTRUCT): Add. (OBJC_LOOKUP_CLASS): Add. (OBJC_LOOKUP_NO_SUPER): Add. (objc_finish_file): Add pch support. (objc_finish_implementation): Add Objective-C++ support. (synth_module_prologue): Likewise. (synth_module_prologue): Add fast dispatching. (objc_get_class_reference): Add Objective-C++ support. (objc_generate_write_barrier): Likewise. (next_sjlj_build_enter_and_setjmp): Likewise. (objc_begin_try_stmt): Likewise. (build_next_objc_exception_stuff): Add fast ivar support. (build_private_template): Mark the record as used so debug information is generated. (build_protocol_template): Add Objective-C++ support. (objc_method_parm_type) Likewise. (objc_generate_cxx_ctor_or_dtor): Likewise. (objc_generate_cxx_cdtors): Likewise. (build_protocol_initializer): Likewise. (build_category_template): Likewise. (build_class_template): Likewise. (build_method_list_template): Likewise. (build_category_initializer): Likewise. (build_shared_structure_initializer): Likewise. (objc_finish_message_expr): Likewise. (build_objc_method_call): Add fast dispatch support. (lookup_method_static): Add support to end search at superclasses. (add_method_to_hash_list): Add strict parameter to comp_proto_with_proto. (objc_add_method): Likewise. (objc_add_method): Also set the interface_value. (add_instance_variable): Add Objective-C++ support. (objc_is_public): Likewise. (start_class): Likewise. (continue_class): Likewise. (encode_aggregate_within): Likewise. (start_method_def): Likewise. (objc_start_function): Clear current_function_returns_value and current_function_returns_null. (really_start_method): Add Objective-C++ support. (objc_finish_method_definition): Add warning for missing [super dealloc]. (finish_objc): Add Objective-C++ support. (generate_objc_image_info): Likewise. (objc_lookup_ivar): Likewise. * objc-act.h (TYPE_HAS_OBJC_INFO): Likewise. (INIT_TYPE_OBJC_INFO): Likewise. (DUP_TYPE_OBJC_INFO): Likewise. From-SVN: r99857
2005-05-17 22:07:08 +02:00
else if (rtype)
1992-01-18 00:15:38 +01:00
{
tree orig_rtype = rtype, saved_rtype;
if (TREE_CODE (rtype) == POINTER_TYPE)
rtype = TREE_TYPE (rtype);
/* Traverse typedef aliases */
Makefile.in (c-parse.o): Depend on $(C_COMMON_H). [gcc/ChangeLog] 2004-09-07 Ziemowit Laski <zlaski@apple.com> * Makefile.in (c-parse.o): Depend on $(C_COMMON_H). * c-parse.in: Include c-common.h instead of objc-act.h. (ivar_decl_list, ivar_decls, ivar_decl, ivars, ivar_declarator, myparms, myparm): Remove %type declarations. (methodtype, optparms, OBJC_TYPE_QUAL, objc_quals, objc_qual, objc_typename, objc_try_catch_stmt, optellipsis): Add %type declarations. (objc_inherit_code, objc_public_flag): Remove. (typespec_nonreserved_nonattr): Call objc_get_protocol_qualified_type() instead of get_static_reference() and get_protocol_reference(). (stmt_nocomp): Call grokparm() on @catch parameter. (objcdef): Move semantic action to objc_finish_implementation(). (classdef): Move semantic action to objc_start_class_interface(), objc_continue_interface(), objc_finish_interface(), objc_start_class_implementation(), objc_continue_implementation(), objc_start_category_interface() and objc_start_category_implementation(). (protocoldef): Move semantic actions to objc_start_protocol() and objc_finish_interface(). (ivar_decl_list): Remove nonterminal. (visibility_spec): Move semantic actions to objc_set_visibility(). (ivar_decls): Remove assignment to $$. (ivar_decl): Rephrase in terms of component_decl; call objc_add_instance_variable(). (ivars, ivar_declarator): Remove nonterminals. (opt_semi): New nonterminal. (methodtype): Remove semantic actions. (methoddef): Move semantic actions to objc_set_method_type(), objc_start_method_definition() and objc_finish_method_definition(). (methodproto): Move semantic actions to objc_set_method_type() and objc_add_method_declaration(). (methoddecl): Use objc_typename instead of typename; move semantic actions to objc_build_method_signature(). (optarglist, myxdecls, mydecl, myparms, myparm): Remove nonterminals. (optparmlist): Express in terms of optparms and optellipsis. (optparms, optellipsis, objc_qual, objc_quals, objc_typename): New nonterminals. (keyworddecl): Use objc_typename instead of typename. (rid_to_yy): Mark RID_IN, RID_OUT, RID_INOUT, RID_BYCOPY, RID_BYREF and RID_ONEWAY as returning OBJC_TYPE_QUAL to yyparse(). [gcc/objc/ChangeLog] 2004-09-07 Ziemowit Laski <zlaski@apple.com> * Make-lang.in (objc/objc-parse.o): Depend on $(C_COMMON_H) instead of objc/objc-act.h. (objc/objc-act.o): Depend on $(HASHTAB_H). * objc-act.c: Include hashtab.h; in ObjC++ mode, include cp-tree.h and objcp-decl.h instead of c-tree.h. (build_module_descriptor, get_class_ivars, synth_id_with_class_suffix, error_with_ivar, gen_method_decl, gen_declaration, setup_string_decl, build_protocol_template): Adjust prototypes. (build_module_initializer_routine, start_class, continue_class, finish_class, start_method_def, objc_start_function, start_protocol, build_method_decl, objc_add_method, add_instance_variable, build_ivar_reference, is_ivar, is_private, get_super_receiver, build_selector_table_decl, objc_push_parm, objc_get_parm_info, gen_type_name, gen_type_name_0, start_var_decl, finish_var_decl, create_field_decl): New prototypes. (objc_expand_function_end, comp_method_with_proto, objc_expr_last, gen_declaration_1, gen_declarator, is_complex_decl, adorn_decl, define_decl, create_builtin_decl, gen_declspecs): Remove prototypes. (TYPE_ID): Rename to OBJECT_TYPEDEF_NAME. (CLASS_TYPEDEF_NAME): New. (TAG_EXECCLASS): Change from a global variable to a #define. (TAG_RETURN_STRUCT): Delete. (TAG_GNUINIT): New, holds '__objc_gnu_init' name. (objc_inherit_code, objc_public_flag): New, moved from c-parse.in. (string_descriptor): New struct. (string_htab): New hash table. (string_hash, string_eq): New prototypes. (generate_struct_by_value_array): Call create_field_decl() instead of create_builtin_decl(). (objc_init): Do not initialize objc_ellipsis_node or TAG_EXECCLASS; In ObjC++ mode, call cxx_init() instead of c_objc_common_init(). (objc_finish_file): In ObjC++, call instantiate_pending_templates() and cp_finish_file(). (define_decl, get_static_reference, get_protocol_reference, create_builtin_decl): Remove functions. (objc_start_class_interface, objc_start_category_interface, objc_start_protocol, objc_continue_interface, objc_finish_interface, objc_start_class_implementation, objc_start_category_implementation, objc_continue_implementation, objc_finish_implementation, objc_set_visibility, objc_set_method_type, objc_build_method_signature, objc_add_method_declaration, objc_start_method_definition, objc_add_instance_variable, objc_get_protocol_qualified_type, create_field_decl, start_var_decl, finish_var_decl): New functions. (setup_string_decl): Simplify since it is only called once. (synth_module_prologue): Call build_class_template(); predefine 'id' and 'Class' as typedefs; rename 'temp_type' to 'type'; disable debug hooks for duration of function; fix GNU runtime messenger signatures to correspond to reality; forward-declare '__objc_exec_class' for the GNU runtime; call build_selector_table_decl(); in ObjC++ mode, generate 'extern "C" { ... }' wrappers around synthesized declarations; call build_protocol_template() and build_category_template(). (string_hash, string_eq): New functions. (objc_build_string_object): Check metaclass correctness only once; store string literals in hash table. (objc_build_constructor): Do not convert initializer elements; adjust for ObjC++ impedance mismatch. (build_objc_symtab_template): Call create_field_decl() instead of create_builtin_decl(). (init_objc_symtab): Add missing conversion to initializer element. (build_metadata_decl): Call start_var_decl() instead of define_decl(). (generate_objc_symtab_decl): Do not call build_category_template(); call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(). (build_module_descriptor): Call create_field_decl() instead of grokfield(); call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(); always mark module descriptor as used; move GNU runtime-specific functionality to build_module_initializer_routine(). (build_module_initializer_routine): New function, broken off of build_module_descriptor(). (objc_static_init_needed_p, objc_generate_static_init_call): New functions. (generate_static_references, generate_strings, build_selector_translation_table, generate_descriptor_table, generate_ivars_list, generate_dispatch_table, generate_category): Call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(); build a type directly instead of via groktypename(). (build_selector_reference_decl, build_selector_table_decl, build_class_reference_decl, build_protocol_reference, generate_objc_image_info): Call start_var_decl() instead of build_decl(). (build_selector_reference): For GNU runtime, do not call build_selector_reference_decl(). (build_selector, build_typed_selector_reference): Always convert result to the selector type. (add_objc_string): Cast return value to 'char *'. (build_method_prototype_template, build_selector_template, build_method_template): Use actual selector type for fields pointing to selectors. (finish_objc): For GNU runtime, call build_module_initializer_routine() after build_module_descriptor(). (generate_protocol_list, generate_shared_structures): Call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(); build a type directly instead of via groktypename(). (synth_id_with_class_suffix): Return a string. (get_arg_type_list): For instance methods, use the instance type for 'self'; do not call groktypename_in_parm_context(). (build_objc_string_decl): Squash redeclaration errors in ObjC++. (objc_is_class_name): Use OBJC_TYPE_NAME instead of TYPE_NAME; handle RECORD_TYPEs in ObjC as well as ObjC++. (objc_is_id): New function. (objc_is_object_ptr): Return the canonical type node. (objc_get_class_ivars): Simplify using get_class_ivars(). (get_class_ivars): Remove second parameter; create a fresh copy of the ivar list for each call; do not check for existence of super class. (objc_eh_runtime_type): Mark #ifndef OBJCPLUS. (objc_init_exceptions): When using SJLJ-style exceptions, require the use of '-fobjc-exceptions' flag; do not require it for DWARF-style exceptions. (objc_build_exc_ptr, next_sjlj_build_try_catch_finally): Use objc_object_type instead of objc_id_type. (objc_begin_catch_clause): Convert the incoming PARM_DECL into a VAR_DECL before placing it in the appropriate scope; do not call define_decl(); adjust call to c_begin_compound_stmt(); use objc_object_type instead of objc_id_type. (build_next_objc_exception_stuff): Call create_field_decl() instead of create_builtin_decl(); construct type directly instead of calling groktypename(); use OBJC_VOID_AT_END to mark end of function parameters. (build_private_template): Adjust call to get_class_ivars(); build a type directly instead of via groktypename(). (build_protocol_template, build_method_prototype_list_template, build_method_prototype_template, build_category_template, build_selector_template, build_class_template, build_super_template, build_ivar_template, build_ivar_list_template, build_method_list_template, build_method_template): Call create_field_decl() instead of grokfield(). (objc_method_parm_type): Do not call groktypename(). (generate_descriptor_table): Call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(). (generate_method_descriptors, build_protocol_initializer, generate_dispatch_tables, build_category_initializer, build_shared_structure_initializer): Do not call groktypename(). (generate_protocols): Call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(); do not call groktypename(). (error_with_ivar): Remove last parameter. (check_ivars): Do not iterate ovar CLASS_RAW_IVARS lists in addition to CLASS_IVARS lists; adjust calls to error_with_ivar(). (generate_ivar_lists): Convert one of the initializer elements; do not call groktypename(). (get_arg_type_list, start_method_def, gen_method_def): Account for new representation of variable arguments and '...' in Objective-C methods; add Objective-C++ impedance matching code. (is_objc_type_qualifier): Remove function. (adjust_type_for_id_default): Simplify; there is no longer a need to wade through declspecs. (lookup_interface, start_class, continue_class, finish_class, start_method_def, start_protocol, build_method_decl, objc_add_method, add_instance_variable, build_ivar_reference, is_ivar, is_private, get_super_receiver, objc_build_finally_epilogue): Make into static functions. (receiver_is_class_object): Use new IS_CLASS() macro. (objc_build_message_expr): Tweak ObjC++ message argument handling; call objc_finish_message_expr() instead of finish_message_expr(). (finish_message_expr): Rename to objc_finish_message_expr(); use OBJC_TYPE_NAME and OBJC_SET_TYPE_NAME macros instead of TYPE_NAME. call gen_type_name() instead of gen_declaration(); call objc_is_id() instead of using IS_ID and IS_CLASS; Use objc_class_name instead of calling get_identifier("Class"); handle CONVERT_EXPRs in receiver. (build_objc_method_call, warn_with_method): Do not call groktypename(). (build_ivar_reference): Call convert() instead of clobbering in a type. (hash_init): Initialize string_htab hash table. (add_instance_variable): Simplify parameter list; do not call grokfield(); do not populate CLASS_IVARS list. (start_class): Check for the existence of super class, if one was specified. (continue_class): Use CLASS_RAW_IVARS rather than CLASS_IVARS; do not call build_class_template(); adjust call to get_class_ivars(); call build_decl(), pushdecl() and finish_decl() instead of define_decl(). (finish_class): Call build_decl(), pushdecl() and finish_decl() instead of define_decl(). (add_protocols): Use PROTOCOL_BINFO_ELTS for the tree vector size. (start_protocol): Do not call build_protocol_template(); use PROTOCOL_BINFO_ELTS for the tree vector size. (encode_type_qualifiers): Do not handle the 'const' qualifier here. (encode_pointer): Encode 'const char *' as 'r*', for backwards compatibility. (encode_array): Use HOST_WIDE_INT_PRINT_DEC instead of "%ld". (encode_type): Handle the 'const' qualifier here. (objc_parmlist): New global variable, sued by objc_push_parm and objc_get_parm_info(). (objc_push_parm, objc_get_parm_info): New functions. (objc_expr_last): Remove function. (synth_self_and_ucmd_args): For instance methods, use the instance type for 'self'; call objc_push_parm() instead of push_parm_decl(). (start_method_def): Do not call push_scope(), declare_parm_level(), pop_scope(), push_parm_decl(), store_parm_decls() or objc_expr_last(); just use objc_push_parm() and objc_get_parm_info(). (comp_method_with_proto): Remove function. (objc_types_are_equivalent): Strip away indirections before comparing underlying types. (comp_proto_with_proto): Do not call groktypename(); types are no longer in raw declspec format. (objc_start_function): New function. (really_start_method): Call comp_proto_with_proto() instead of comp_method_with_proto(); call objc_start_function() instead of hand-crafting a function declarator. (continue_method_def, objc_expand_function_end): Remove functions. (get_super_receiver): Call objc_get_current_scope() instead of get_current_scope(); reference 'super_class' field (instead of 'class'). (finish_method_def): Rename to objc_finish_method_definition() and add a function decl parameter; move method encoding call from objc_expand_function_end(). (is_complex_decl, adorn_decl, gen_declarator, gen_declspecs, gen_declaration_1): Remove functions. (tmpbuf, RAW_DECLSPEC): Remove. (gen_declaration): Remove second parameter; simplify to deal with TYPE_P nodes instead of raw declspecs. (gen_type_name, gen_type_name_0): New functions. (gen_method_decl): Remove second parameter; call gen_type_name() instead of gen_declaration_1(). (dump_interface): Adjust calls to gen_declaration() and gen_method_decl(); do not allocate a separate string buffer. (init_objc): Allocate a larger string buffer to accommodate dump_interface(); adjust call to build_module_descriptor(); add call to build_module_initializer_routine() for the GNU runtime. (generate_classref_translation_entry): Do not call start_decl(); call finish_var_decl() instead of finish_decl(); call convert() instead of build_c_cast(). * objc-act.h (CLASS_OWN_IVARS): Remove accessor. (CLASS_BINFO_ELTS): Reduce from 6 to 5, now that CLASS_OWN_IVARS is gone. (OCTI_GNU_INIT_DECL, GNU_INIT_decl): New. (OCTI_ELLIPSIS_NODE, objc_ellipsis_node): Remove. (OCTI_ID_ID, id_type, objc_id_id): Rename to OCTI_ID_NAME, objc_object_type and objc_object_name, respectively. (OCTI_CLS_REF, OCTI_CLASS_NAME, objc_class_reference, objc_class_name): New. (IS_CLASS): New macro. (IS_ID, IS_SUPER): Robustify. (OCTI_EXECCLASS_DECL, execclass_decl): New. (finish_file, start_class, continue_class, finish_class, start_method_def, continue_method_def, finish_method_def, start_protocol, finish_protocol, objc_build_throw_stmt, objc_build_try_catch_finally_stmt, objc_build_synchronized_prologue, objc_build_synchronized_epilogue, objc_build_try_prologue, objc_build_try_epilogue, objc_build_catch_stmt, objc_build_catch_epilogue, objc_build_finally_prologue, objc_build_finally_epilogue, is_ivar, is_private, is_public, add_instance_variable, objc_add_method, get_super_receiver, objc_clear_super_receiver, get_class_ivars_from_name, get_class_reference, get_static_reference, get_object_reference, build_message_expr, finish_message_expr, build_selector_expr, build_ivar_reference, build_keyword_decl, build_method_decl, build_protocol_expr, build_objc_string_object, objc_declare_alias, objc_declare_class, objc_declare_protocols, objc_comptypes, objc_check_decl, build_encode_expr): Remove prototypes. (imp_count, cat_count): Make GGC-aware. (OBJC_SET_TYPE_NAME): New macro. From-SVN: r87168
2004-09-08 02:49:44 +02:00
while (TREE_CODE (rtype) == RECORD_TYPE && OBJC_TYPE_NAME (rtype)
&& TREE_CODE (OBJC_TYPE_NAME (rtype)) == TYPE_DECL
&& DECL_ORIGINAL_TYPE (OBJC_TYPE_NAME (rtype)))
rtype = DECL_ORIGINAL_TYPE (OBJC_TYPE_NAME (rtype));
saved_rtype = rtype;
if (TYPED_OBJECT (rtype))
1992-01-18 00:15:38 +01:00
{
objc-act.c (build_private_template): Change to return 'void'... [gcc/objc/ChangeLog] 2004-12-15 Ziemowit Laski <zlaski@apple.com> * objc-act.c (build_private_template): Change to return 'void'; do not set ivar_context, uprivate_record or objc_instance_type. (objc_comptypes, gen_type_name_0): For types 'id' and 'Class', retrieve protocol list from the pointee rather than the pointer itself; check TYPE_HAS_OBJC_INFO(...) precondition before accessing TYPE_OBJC_PROTOCOL_LIST. (objc_get_protocol_qualified_type): For types 'id' and 'Class', construct a variant of the pointee as well as the pointer, and store protocol information in the former. When creating variants of RECORD_TYPEs, clone their TYPE_LANG_SPECIFIC fields and propagate TYPE_OBJC_INTERFACE information. (objc_declare_class): If a TYPE_DECL is looked up, retrieve the underlying RECORD_TYPE to check for presence of TYPE_OBJC_INTERFACE; for newly-created RECORD_TYPEs, create a tentative TYPE_OBJC_INTERFACE holding an IDENTIFIER_NODE. (objc_finish_message_expr): Check TYPE_HAS_OBJC_INFO(...) before accessing TYPE_OBJC_PROTOCOL_LIST; Use TYPE_OBJC_INTERFACE instead of calling lookup_interface(); allow for TYPE_OBJC_INTERFACE holding an IDENTIFIER_NODE (meaning a @class forward-declaration only). (objc_is_public): Check TYPE_OBJC_INTERFACE instead of calling lookup_interface(). (continue_class): For @implementations, set ivar_context, uprivate_record and objc_instance_type, for @interfaces, call build_private_template(). (encode_pointer): Check TYPE_HAS_OBJC_INFO(...) before accessing TYPE_OBJC_INTERFACE. (objc_types_are_equivalent): Check TYPE_HAS_OBJC_INFO(...) before accessing TYPE_OBJC_PROTOCOL_LIST. * objc-act.h (OBJC_INFO_SLOT_ELTS, TYPE_OBJC_INFO, INIT_TYPE_OBJC_INFO, DUP_TYPE_OBJC_INFO, ALLOC_OBJC_TYPE_LANG_SPECIFIC, SIZEOF_OBJC_TYPE_LANG_SPECIFIC): New macros. (TYPE_OBJC_INTERFACE): Replaces TREE_STATIC_INSTANCE and now points to an actual @interface; stored in TYPE_LANG_SPECIFIC(...). (TYPE_OBJC_PROTOCOL_LIST): Replaces TYPE_PROTOCOL_LIST; stored in TYPE_LANG_SPECIFIC(...). (TREE_STATIC_INSTANCE, TYPE_PROTOCOL_LIST): Delete. (IS_ID, IS_CLASS, IS_PROTOCOL_QUALIFIED_UNTYPED, IS_SUPER, TYPED_OBJECT): Check for POINTER_TYPE rather than POINTER_TYPE_P; adjust for use of TYPE_OBJC_INTERFACE and TYPE_OBJC_PROTOCOL_LIST instead of TREE_STATIC_INSTANCE and TYPE_PROTOCOL_LIST. From-SVN: r92239
2004-12-16 02:10:38 +01:00
rprotos = TYPE_OBJC_PROTOCOL_LIST (rtype);
rtype = TYPE_OBJC_INTERFACE (rtype);
1992-01-18 00:15:38 +01:00
}
/* If we could not find an @interface declaration, we must have
only seen a @class declaration; so, we cannot say anything
more intelligent about which methods the receiver will
understand. */
objc-act.c (build_private_template): Change to return 'void'... [gcc/objc/ChangeLog] 2004-12-15 Ziemowit Laski <zlaski@apple.com> * objc-act.c (build_private_template): Change to return 'void'; do not set ivar_context, uprivate_record or objc_instance_type. (objc_comptypes, gen_type_name_0): For types 'id' and 'Class', retrieve protocol list from the pointee rather than the pointer itself; check TYPE_HAS_OBJC_INFO(...) precondition before accessing TYPE_OBJC_PROTOCOL_LIST. (objc_get_protocol_qualified_type): For types 'id' and 'Class', construct a variant of the pointee as well as the pointer, and store protocol information in the former. When creating variants of RECORD_TYPEs, clone their TYPE_LANG_SPECIFIC fields and propagate TYPE_OBJC_INTERFACE information. (objc_declare_class): If a TYPE_DECL is looked up, retrieve the underlying RECORD_TYPE to check for presence of TYPE_OBJC_INTERFACE; for newly-created RECORD_TYPEs, create a tentative TYPE_OBJC_INTERFACE holding an IDENTIFIER_NODE. (objc_finish_message_expr): Check TYPE_HAS_OBJC_INFO(...) before accessing TYPE_OBJC_PROTOCOL_LIST; Use TYPE_OBJC_INTERFACE instead of calling lookup_interface(); allow for TYPE_OBJC_INTERFACE holding an IDENTIFIER_NODE (meaning a @class forward-declaration only). (objc_is_public): Check TYPE_OBJC_INTERFACE instead of calling lookup_interface(). (continue_class): For @implementations, set ivar_context, uprivate_record and objc_instance_type, for @interfaces, call build_private_template(). (encode_pointer): Check TYPE_HAS_OBJC_INFO(...) before accessing TYPE_OBJC_INTERFACE. (objc_types_are_equivalent): Check TYPE_HAS_OBJC_INFO(...) before accessing TYPE_OBJC_PROTOCOL_LIST. * objc-act.h (OBJC_INFO_SLOT_ELTS, TYPE_OBJC_INFO, INIT_TYPE_OBJC_INFO, DUP_TYPE_OBJC_INFO, ALLOC_OBJC_TYPE_LANG_SPECIFIC, SIZEOF_OBJC_TYPE_LANG_SPECIFIC): New macros. (TYPE_OBJC_INTERFACE): Replaces TREE_STATIC_INSTANCE and now points to an actual @interface; stored in TYPE_LANG_SPECIFIC(...). (TYPE_OBJC_PROTOCOL_LIST): Replaces TYPE_PROTOCOL_LIST; stored in TYPE_LANG_SPECIFIC(...). (TREE_STATIC_INSTANCE, TYPE_PROTOCOL_LIST): Delete. (IS_ID, IS_CLASS, IS_PROTOCOL_QUALIFIED_UNTYPED, IS_SUPER, TYPED_OBJECT): Check for POINTER_TYPE rather than POINTER_TYPE_P; adjust for use of TYPE_OBJC_INTERFACE and TYPE_OBJC_PROTOCOL_LIST instead of TREE_STATIC_INSTANCE and TYPE_PROTOCOL_LIST. From-SVN: r92239
2004-12-16 02:10:38 +01:00
if (!rtype || TREE_CODE (rtype) == IDENTIFIER_NODE)
Yet more Objective-C++... * objc-act.c (objc_finish_try_stmt): Add return value. (objc_build_synchronized): Likewise. * objc-act.c (objc_is_gcable_type): Add. (objc_substitute_decl): Add. (objc_build_ivar_assignment): Add. (objc_build_global_assignment): Add. (objc_build_strong_cast_assignment): Add. (objc_is_ivar_reference_p): Add. (objc_is_global_reference_p): Add. (objc_generate_write_barrier): Add. (objc_rewrite_function_call): Add. (objc_gimplify_expr): Add Objective-C++ support. * objc-act.h (ALLOC_OBJC_TYPE_LANG_SPECIFIC): Likewise. (SIZEOF_OBJC_TYPE_LANG_SPECIFIC): Add. (INIT_TYPE_OBJC_INFO): Add Objective-C++ support. (DUP_TYPE_OBJC_INFO): Likewise. (struct imp_entry): Add field has_cxx_cdtors. (struct imp_entry *imp_list): Add OCTI_UMSG_FAST_DECL, OCTI_METH_LIST_TEMPL, OCTI_METH_PROTO_LIST_TEMPL, OCTI_IVAR_LIST_TEMPL, OCTI_ASSIGN_IVAR_DECL, OCTI_ASSIGN_IVAR_FAST_DECL, OCTI_ASSIGN_GLOBAL_DECL, OCTI_ASSIGN_STRONGCAST_DECL. (umsg_fast_decl): Add. (objc_assign_ivar_decl): Add. (objc_assign_ivar_fast_decl): Add. (objc_assign_global_decl): Add. (objc_assign_strong_cast_decl): Add. (objc_method_list_ptr): Add. (objc_method_proto_list_ptr): Add. (objc_ivar_list_ptr): Add. * objc-act.c (should_call_super_dealloc): Add. (OBJC_VERSION): Bump to 6. (objc_is_gcable_type): Add. (objc_substitute_decl): Add. (objc_build_ivar_assignment): Add. (objc_build_global_assignment): Add. (objc_build_strong_cast_assignment): Add. (objc_is_gcable_p): Add. (objc_is_ivar_reference_p): Add. (objc_is_global_reference_p): Add. (generate_shared_structures): Add flags parameter. (objc_generate_cxx_ctor_or_dtor): Add. (objc_generate_cxx_cdtors): Add. (add_class): Add name parameter. (objc_types_share_size_and_alignment): Add. (comp_proto_with_proto): Add strict parameter. (CLS_HAS_CXX_STRUCTORS): Add. (TAG_ASSIGNIVAR): Add. (TAG_ASSIGNGLOBAL): Add. (TAG_ASSIGNSTRONGCAST): Add. (TAG_MSGSEND_FAST): Add. (TAG_ASSIGNIVAR_FAST): Add. (TAG_CXX_CONSTRUCT): Add. (TAG_CXX_DESTRUCT): Add. (OBJC_LOOKUP_CLASS): Add. (OBJC_LOOKUP_NO_SUPER): Add. (objc_finish_file): Add pch support. (objc_finish_implementation): Add Objective-C++ support. (synth_module_prologue): Likewise. (synth_module_prologue): Add fast dispatching. (objc_get_class_reference): Add Objective-C++ support. (objc_generate_write_barrier): Likewise. (next_sjlj_build_enter_and_setjmp): Likewise. (objc_begin_try_stmt): Likewise. (build_next_objc_exception_stuff): Add fast ivar support. (build_private_template): Mark the record as used so debug information is generated. (build_protocol_template): Add Objective-C++ support. (objc_method_parm_type) Likewise. (objc_generate_cxx_ctor_or_dtor): Likewise. (objc_generate_cxx_cdtors): Likewise. (build_protocol_initializer): Likewise. (build_category_template): Likewise. (build_class_template): Likewise. (build_method_list_template): Likewise. (build_category_initializer): Likewise. (build_shared_structure_initializer): Likewise. (objc_finish_message_expr): Likewise. (build_objc_method_call): Add fast dispatch support. (lookup_method_static): Add support to end search at superclasses. (add_method_to_hash_list): Add strict parameter to comp_proto_with_proto. (objc_add_method): Likewise. (objc_add_method): Also set the interface_value. (add_instance_variable): Add Objective-C++ support. (objc_is_public): Likewise. (start_class): Likewise. (continue_class): Likewise. (encode_aggregate_within): Likewise. (start_method_def): Likewise. (objc_start_function): Clear current_function_returns_value and current_function_returns_null. (really_start_method): Add Objective-C++ support. (objc_finish_method_definition): Add warning for missing [super dealloc]. (finish_objc): Add Objective-C++ support. (generate_objc_image_info): Likewise. (objc_lookup_ivar): Likewise. * objc-act.h (TYPE_HAS_OBJC_INFO): Likewise. (INIT_TYPE_OBJC_INFO): Likewise. (DUP_TYPE_OBJC_INFO): Likewise. From-SVN: r99857
2005-05-17 22:07:08 +02:00
rtype = NULL_TREE;
else if (TREE_CODE (rtype) == CLASS_INTERFACE_TYPE
|| TREE_CODE (rtype) == CLASS_IMPLEMENTATION_TYPE)
1992-01-18 00:15:38 +01:00
{
/* We have a valid ObjC class name. Look up the method name
in the published @interface for the class (and its
superclasses). */
1992-01-18 00:15:38 +01:00
method_prototype
objc-act.h (get_object_reference): Rename to get_protocol_reference. 2004-06-20 David Ayers <d.ayers@inode.at> * objc/objc-act.h (get_object_reference): Rename to get_protocol_reference. (super_type): Rename to objc_super_type. (selector_type): Rename to objc_selector_type. (id_type): Rename to objc_id_type. (instance_type): Rename to objc_instance_type. (protocol_type): Rename to objc_protocol_type. (IS_ID): Update reference to id_type. * objc/objc-act.c (get_object_reference): Rename to get_protocol_reference; add documentation; update references to id_type. (lookup_method_in_protocol_list): Rename class_meth to is_class; add documentation. (finish_message_expr): Rename is_class to class_tree. (synth_module_prologue, objc_is_object_ptr, objc_build_exc_ptr, next_sjlj_build_try_catch_finally, objc_begin_catch_clause, build_next_objc_exception_stuff, get_arg_type_list, build_objc_method_call): Update references to id_type. (synth_module_prologue, build_objc_symtab_template, build_selector_reference_decl, build_selector, build_selector_translation_table, build_typed_selector_reference, get_arg_type_list, synth_self_and_ucmd_args, get_arg_type_list, synth_self_and_ucmd_args): Update references to selector_type. (build_private_template, build_ivar_reference): Update references to instance_type. (synth_module_prologue, build_protocol_reference, build_protocol_expr, start_protocol): Update references to protocol_type. (synth_module_prologue, get_arg_type_list, build_objc_method_call): Update references to super_type. * c-parse.in: (typespec_nonreserved_nonattr): Update references to get_object_reference. * objc/objc-tree.def: Add C mode identifier sequence. From-SVN: r83425
2004-06-21 03:50:18 +02:00
= lookup_method_static (rtype, sel_name, class_tree != NULL_TREE);
/* If the method was not found in the @interface, it may still
exist locally as part of the @implementation. */
if (!method_prototype && objc_implementation_context
&& CLASS_NAME (objc_implementation_context)
== OBJC_TYPE_NAME (rtype))
1992-01-18 00:15:38 +01:00
method_prototype
= lookup_method
objc-act.h (get_object_reference): Rename to get_protocol_reference. 2004-06-20 David Ayers <d.ayers@inode.at> * objc/objc-act.h (get_object_reference): Rename to get_protocol_reference. (super_type): Rename to objc_super_type. (selector_type): Rename to objc_selector_type. (id_type): Rename to objc_id_type. (instance_type): Rename to objc_instance_type. (protocol_type): Rename to objc_protocol_type. (IS_ID): Update reference to id_type. * objc/objc-act.c (get_object_reference): Rename to get_protocol_reference; add documentation; update references to id_type. (lookup_method_in_protocol_list): Rename class_meth to is_class; add documentation. (finish_message_expr): Rename is_class to class_tree. (synth_module_prologue, objc_is_object_ptr, objc_build_exc_ptr, next_sjlj_build_try_catch_finally, objc_begin_catch_clause, build_next_objc_exception_stuff, get_arg_type_list, build_objc_method_call): Update references to id_type. (synth_module_prologue, build_objc_symtab_template, build_selector_reference_decl, build_selector, build_selector_translation_table, build_typed_selector_reference, get_arg_type_list, synth_self_and_ucmd_args, get_arg_type_list, synth_self_and_ucmd_args): Update references to selector_type. (build_private_template, build_ivar_reference): Update references to instance_type. (synth_module_prologue, build_protocol_reference, build_protocol_expr, start_protocol): Update references to protocol_type. (synth_module_prologue, get_arg_type_list, build_objc_method_call): Update references to super_type. * c-parse.in: (typespec_nonreserved_nonattr): Update references to get_object_reference. * objc/objc-tree.def: Add C mode identifier sequence. From-SVN: r83425
2004-06-21 03:50:18 +02:00
((class_tree
? CLASS_CLS_METHODS (objc_implementation_context)
: CLASS_NST_METHODS (objc_implementation_context)),
sel_name);
/* If we haven't found a candidate method by now, try looking for
it in the protocol list. */
if (!method_prototype && rprotos)
method_prototype
= lookup_method_in_protocol_list (rprotos, sel_name,
objc-act.h (get_object_reference): Rename to get_protocol_reference. 2004-06-20 David Ayers <d.ayers@inode.at> * objc/objc-act.h (get_object_reference): Rename to get_protocol_reference. (super_type): Rename to objc_super_type. (selector_type): Rename to objc_selector_type. (id_type): Rename to objc_id_type. (instance_type): Rename to objc_instance_type. (protocol_type): Rename to objc_protocol_type. (IS_ID): Update reference to id_type. * objc/objc-act.c (get_object_reference): Rename to get_protocol_reference; add documentation; update references to id_type. (lookup_method_in_protocol_list): Rename class_meth to is_class; add documentation. (finish_message_expr): Rename is_class to class_tree. (synth_module_prologue, objc_is_object_ptr, objc_build_exc_ptr, next_sjlj_build_try_catch_finally, objc_begin_catch_clause, build_next_objc_exception_stuff, get_arg_type_list, build_objc_method_call): Update references to id_type. (synth_module_prologue, build_objc_symtab_template, build_selector_reference_decl, build_selector, build_selector_translation_table, build_typed_selector_reference, get_arg_type_list, synth_self_and_ucmd_args, get_arg_type_list, synth_self_and_ucmd_args): Update references to selector_type. (build_private_template, build_ivar_reference): Update references to instance_type. (synth_module_prologue, build_protocol_reference, build_protocol_expr, start_protocol): Update references to protocol_type. (synth_module_prologue, get_arg_type_list, build_objc_method_call): Update references to super_type. * c-parse.in: (typespec_nonreserved_nonattr): Update references to get_object_reference. * objc/objc-tree.def: Add C mode identifier sequence. From-SVN: r83425
2004-06-21 03:50:18 +02:00
class_tree != NULL_TREE);
1992-01-18 00:15:38 +01:00
}
else
{
diagnostic.c (warning): Accept parameter to classify warning option. * diagnostic.c (warning): Accept parameter to classify warning option. (warning0): New, for when a pointer to an error() like function is needed. * errors.c (warning): Likewise. * errors.h (warning, warning0): Adjust prototypes. * toplev.h (warning, warning0): Likewise. * attribs.c, builtins.c, c-common.c, c-decl.c, c-format.c, c-gimplify.c, c-lex.c, c-objc-common.c, c-opts.c, c-parser.c, c-pragma.c, c-typeck.c, calls.c, cgraph.c, coverage.c, emit-rtl.c, fold-const.c, fortran/trans-decl.c, function.c, gcse.c, genautomata.c, haifa-sched.c, opts.c, passes.c, regclass.c, reload1.c, stmt.c, stor-layout.c, toplev.c, tree-cfg.c, tree-dump.c, tree-inline.c, tree-mudflap.c, tree-optimize.c, tree-ssa.c, tree.c, varasm.c: Adjust warning() callers. * config/alpha/alpha.c, config/arc/arc.c, config/arm/arm.c, config/avr/avr.c, config/bfin/bfin.c, config/c4x/c4x-c.c, config/c4x/c4x.c, config/cris/cris.c, config/darwin-c.c, config/darwin.c, config/darwin.h, config/h8300/h8300.c, config/i386/cygming.h, config/i386/djgpp.h, config/i386/i386.c, config/i386/winnt.c, config/ia64/ia64-c.c, config/ia64/ia64.c, config/ip2k/ip2k.c, config/m32r/m32r.c, config/m68hc11/m68hc11.c, config/m68k/m68k.c, config/mcore/mcore.c, config/mips/mips.c, config/mmix/mmix.c, config/ns32k/ns32k.c, config/pa/pa-hpux11.h, config/pa/pa.c, config/rs6000/aix43.h, config/rs6000/aix51.h, config/rs6000/aix52.h, config/rs6000/darwin.h, config/rs6000/rs6000-c.c, config/rs6000/rs6000.c, config/s390/s390.c, config/sh/sh.c, config/sh/sh.h, config/sh/symbian.c, config/sol2-c.c, config/sol2.c, config/stormy16/stormy16.c, config/v850/v850-c.c, config/v850/v850.c, config/xtensa/xtensa.c: Adjust warning() callers. * ada/misc.c: Adjust warning() callers. * cp/call.c, cp/class.c, cp/cvt.c, cp/decl.c, cp/decl2.c, cp/except.c, cp/friend.c, cp/init.c, cp/lex.c, cp/mangle.c, cp/method.c, cp/name-lookup.c, cp/parser.c, cp/repo.c, cp/rtti.c, cp/tree.c, cp/typeck.c, cp/typeck2.c: Adjust warning() callers. * fortran/trans-decl.c: Adjust warning() callers. * java/class.c, java/decl.c, java/expr.c, java/jcf-io.c, java/jcf-parse.c, java/jv-scan.c, java/parse.y: Adjust warning() callers. * objc/objc-act.c: Adjust warning() callers. * treelang/parse.y: Adjust warning() callers. From-SVN: r98633
2005-04-23 23:29:07 +02:00
warning (0, "invalid receiver type %qs",
Makefile.in (c-parse.o): Depend on $(C_COMMON_H). [gcc/ChangeLog] 2004-09-07 Ziemowit Laski <zlaski@apple.com> * Makefile.in (c-parse.o): Depend on $(C_COMMON_H). * c-parse.in: Include c-common.h instead of objc-act.h. (ivar_decl_list, ivar_decls, ivar_decl, ivars, ivar_declarator, myparms, myparm): Remove %type declarations. (methodtype, optparms, OBJC_TYPE_QUAL, objc_quals, objc_qual, objc_typename, objc_try_catch_stmt, optellipsis): Add %type declarations. (objc_inherit_code, objc_public_flag): Remove. (typespec_nonreserved_nonattr): Call objc_get_protocol_qualified_type() instead of get_static_reference() and get_protocol_reference(). (stmt_nocomp): Call grokparm() on @catch parameter. (objcdef): Move semantic action to objc_finish_implementation(). (classdef): Move semantic action to objc_start_class_interface(), objc_continue_interface(), objc_finish_interface(), objc_start_class_implementation(), objc_continue_implementation(), objc_start_category_interface() and objc_start_category_implementation(). (protocoldef): Move semantic actions to objc_start_protocol() and objc_finish_interface(). (ivar_decl_list): Remove nonterminal. (visibility_spec): Move semantic actions to objc_set_visibility(). (ivar_decls): Remove assignment to $$. (ivar_decl): Rephrase in terms of component_decl; call objc_add_instance_variable(). (ivars, ivar_declarator): Remove nonterminals. (opt_semi): New nonterminal. (methodtype): Remove semantic actions. (methoddef): Move semantic actions to objc_set_method_type(), objc_start_method_definition() and objc_finish_method_definition(). (methodproto): Move semantic actions to objc_set_method_type() and objc_add_method_declaration(). (methoddecl): Use objc_typename instead of typename; move semantic actions to objc_build_method_signature(). (optarglist, myxdecls, mydecl, myparms, myparm): Remove nonterminals. (optparmlist): Express in terms of optparms and optellipsis. (optparms, optellipsis, objc_qual, objc_quals, objc_typename): New nonterminals. (keyworddecl): Use objc_typename instead of typename. (rid_to_yy): Mark RID_IN, RID_OUT, RID_INOUT, RID_BYCOPY, RID_BYREF and RID_ONEWAY as returning OBJC_TYPE_QUAL to yyparse(). [gcc/objc/ChangeLog] 2004-09-07 Ziemowit Laski <zlaski@apple.com> * Make-lang.in (objc/objc-parse.o): Depend on $(C_COMMON_H) instead of objc/objc-act.h. (objc/objc-act.o): Depend on $(HASHTAB_H). * objc-act.c: Include hashtab.h; in ObjC++ mode, include cp-tree.h and objcp-decl.h instead of c-tree.h. (build_module_descriptor, get_class_ivars, synth_id_with_class_suffix, error_with_ivar, gen_method_decl, gen_declaration, setup_string_decl, build_protocol_template): Adjust prototypes. (build_module_initializer_routine, start_class, continue_class, finish_class, start_method_def, objc_start_function, start_protocol, build_method_decl, objc_add_method, add_instance_variable, build_ivar_reference, is_ivar, is_private, get_super_receiver, build_selector_table_decl, objc_push_parm, objc_get_parm_info, gen_type_name, gen_type_name_0, start_var_decl, finish_var_decl, create_field_decl): New prototypes. (objc_expand_function_end, comp_method_with_proto, objc_expr_last, gen_declaration_1, gen_declarator, is_complex_decl, adorn_decl, define_decl, create_builtin_decl, gen_declspecs): Remove prototypes. (TYPE_ID): Rename to OBJECT_TYPEDEF_NAME. (CLASS_TYPEDEF_NAME): New. (TAG_EXECCLASS): Change from a global variable to a #define. (TAG_RETURN_STRUCT): Delete. (TAG_GNUINIT): New, holds '__objc_gnu_init' name. (objc_inherit_code, objc_public_flag): New, moved from c-parse.in. (string_descriptor): New struct. (string_htab): New hash table. (string_hash, string_eq): New prototypes. (generate_struct_by_value_array): Call create_field_decl() instead of create_builtin_decl(). (objc_init): Do not initialize objc_ellipsis_node or TAG_EXECCLASS; In ObjC++ mode, call cxx_init() instead of c_objc_common_init(). (objc_finish_file): In ObjC++, call instantiate_pending_templates() and cp_finish_file(). (define_decl, get_static_reference, get_protocol_reference, create_builtin_decl): Remove functions. (objc_start_class_interface, objc_start_category_interface, objc_start_protocol, objc_continue_interface, objc_finish_interface, objc_start_class_implementation, objc_start_category_implementation, objc_continue_implementation, objc_finish_implementation, objc_set_visibility, objc_set_method_type, objc_build_method_signature, objc_add_method_declaration, objc_start_method_definition, objc_add_instance_variable, objc_get_protocol_qualified_type, create_field_decl, start_var_decl, finish_var_decl): New functions. (setup_string_decl): Simplify since it is only called once. (synth_module_prologue): Call build_class_template(); predefine 'id' and 'Class' as typedefs; rename 'temp_type' to 'type'; disable debug hooks for duration of function; fix GNU runtime messenger signatures to correspond to reality; forward-declare '__objc_exec_class' for the GNU runtime; call build_selector_table_decl(); in ObjC++ mode, generate 'extern "C" { ... }' wrappers around synthesized declarations; call build_protocol_template() and build_category_template(). (string_hash, string_eq): New functions. (objc_build_string_object): Check metaclass correctness only once; store string literals in hash table. (objc_build_constructor): Do not convert initializer elements; adjust for ObjC++ impedance mismatch. (build_objc_symtab_template): Call create_field_decl() instead of create_builtin_decl(). (init_objc_symtab): Add missing conversion to initializer element. (build_metadata_decl): Call start_var_decl() instead of define_decl(). (generate_objc_symtab_decl): Do not call build_category_template(); call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(). (build_module_descriptor): Call create_field_decl() instead of grokfield(); call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(); always mark module descriptor as used; move GNU runtime-specific functionality to build_module_initializer_routine(). (build_module_initializer_routine): New function, broken off of build_module_descriptor(). (objc_static_init_needed_p, objc_generate_static_init_call): New functions. (generate_static_references, generate_strings, build_selector_translation_table, generate_descriptor_table, generate_ivars_list, generate_dispatch_table, generate_category): Call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(); build a type directly instead of via groktypename(). (build_selector_reference_decl, build_selector_table_decl, build_class_reference_decl, build_protocol_reference, generate_objc_image_info): Call start_var_decl() instead of build_decl(). (build_selector_reference): For GNU runtime, do not call build_selector_reference_decl(). (build_selector, build_typed_selector_reference): Always convert result to the selector type. (add_objc_string): Cast return value to 'char *'. (build_method_prototype_template, build_selector_template, build_method_template): Use actual selector type for fields pointing to selectors. (finish_objc): For GNU runtime, call build_module_initializer_routine() after build_module_descriptor(). (generate_protocol_list, generate_shared_structures): Call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(); build a type directly instead of via groktypename(). (synth_id_with_class_suffix): Return a string. (get_arg_type_list): For instance methods, use the instance type for 'self'; do not call groktypename_in_parm_context(). (build_objc_string_decl): Squash redeclaration errors in ObjC++. (objc_is_class_name): Use OBJC_TYPE_NAME instead of TYPE_NAME; handle RECORD_TYPEs in ObjC as well as ObjC++. (objc_is_id): New function. (objc_is_object_ptr): Return the canonical type node. (objc_get_class_ivars): Simplify using get_class_ivars(). (get_class_ivars): Remove second parameter; create a fresh copy of the ivar list for each call; do not check for existence of super class. (objc_eh_runtime_type): Mark #ifndef OBJCPLUS. (objc_init_exceptions): When using SJLJ-style exceptions, require the use of '-fobjc-exceptions' flag; do not require it for DWARF-style exceptions. (objc_build_exc_ptr, next_sjlj_build_try_catch_finally): Use objc_object_type instead of objc_id_type. (objc_begin_catch_clause): Convert the incoming PARM_DECL into a VAR_DECL before placing it in the appropriate scope; do not call define_decl(); adjust call to c_begin_compound_stmt(); use objc_object_type instead of objc_id_type. (build_next_objc_exception_stuff): Call create_field_decl() instead of create_builtin_decl(); construct type directly instead of calling groktypename(); use OBJC_VOID_AT_END to mark end of function parameters. (build_private_template): Adjust call to get_class_ivars(); build a type directly instead of via groktypename(). (build_protocol_template, build_method_prototype_list_template, build_method_prototype_template, build_category_template, build_selector_template, build_class_template, build_super_template, build_ivar_template, build_ivar_list_template, build_method_list_template, build_method_template): Call create_field_decl() instead of grokfield(). (objc_method_parm_type): Do not call groktypename(). (generate_descriptor_table): Call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(). (generate_method_descriptors, build_protocol_initializer, generate_dispatch_tables, build_category_initializer, build_shared_structure_initializer): Do not call groktypename(). (generate_protocols): Call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(); do not call groktypename(). (error_with_ivar): Remove last parameter. (check_ivars): Do not iterate ovar CLASS_RAW_IVARS lists in addition to CLASS_IVARS lists; adjust calls to error_with_ivar(). (generate_ivar_lists): Convert one of the initializer elements; do not call groktypename(). (get_arg_type_list, start_method_def, gen_method_def): Account for new representation of variable arguments and '...' in Objective-C methods; add Objective-C++ impedance matching code. (is_objc_type_qualifier): Remove function. (adjust_type_for_id_default): Simplify; there is no longer a need to wade through declspecs. (lookup_interface, start_class, continue_class, finish_class, start_method_def, start_protocol, build_method_decl, objc_add_method, add_instance_variable, build_ivar_reference, is_ivar, is_private, get_super_receiver, objc_build_finally_epilogue): Make into static functions. (receiver_is_class_object): Use new IS_CLASS() macro. (objc_build_message_expr): Tweak ObjC++ message argument handling; call objc_finish_message_expr() instead of finish_message_expr(). (finish_message_expr): Rename to objc_finish_message_expr(); use OBJC_TYPE_NAME and OBJC_SET_TYPE_NAME macros instead of TYPE_NAME. call gen_type_name() instead of gen_declaration(); call objc_is_id() instead of using IS_ID and IS_CLASS; Use objc_class_name instead of calling get_identifier("Class"); handle CONVERT_EXPRs in receiver. (build_objc_method_call, warn_with_method): Do not call groktypename(). (build_ivar_reference): Call convert() instead of clobbering in a type. (hash_init): Initialize string_htab hash table. (add_instance_variable): Simplify parameter list; do not call grokfield(); do not populate CLASS_IVARS list. (start_class): Check for the existence of super class, if one was specified. (continue_class): Use CLASS_RAW_IVARS rather than CLASS_IVARS; do not call build_class_template(); adjust call to get_class_ivars(); call build_decl(), pushdecl() and finish_decl() instead of define_decl(). (finish_class): Call build_decl(), pushdecl() and finish_decl() instead of define_decl(). (add_protocols): Use PROTOCOL_BINFO_ELTS for the tree vector size. (start_protocol): Do not call build_protocol_template(); use PROTOCOL_BINFO_ELTS for the tree vector size. (encode_type_qualifiers): Do not handle the 'const' qualifier here. (encode_pointer): Encode 'const char *' as 'r*', for backwards compatibility. (encode_array): Use HOST_WIDE_INT_PRINT_DEC instead of "%ld". (encode_type): Handle the 'const' qualifier here. (objc_parmlist): New global variable, sued by objc_push_parm and objc_get_parm_info(). (objc_push_parm, objc_get_parm_info): New functions. (objc_expr_last): Remove function. (synth_self_and_ucmd_args): For instance methods, use the instance type for 'self'; call objc_push_parm() instead of push_parm_decl(). (start_method_def): Do not call push_scope(), declare_parm_level(), pop_scope(), push_parm_decl(), store_parm_decls() or objc_expr_last(); just use objc_push_parm() and objc_get_parm_info(). (comp_method_with_proto): Remove function. (objc_types_are_equivalent): Strip away indirections before comparing underlying types. (comp_proto_with_proto): Do not call groktypename(); types are no longer in raw declspec format. (objc_start_function): New function. (really_start_method): Call comp_proto_with_proto() instead of comp_method_with_proto(); call objc_start_function() instead of hand-crafting a function declarator. (continue_method_def, objc_expand_function_end): Remove functions. (get_super_receiver): Call objc_get_current_scope() instead of get_current_scope(); reference 'super_class' field (instead of 'class'). (finish_method_def): Rename to objc_finish_method_definition() and add a function decl parameter; move method encoding call from objc_expand_function_end(). (is_complex_decl, adorn_decl, gen_declarator, gen_declspecs, gen_declaration_1): Remove functions. (tmpbuf, RAW_DECLSPEC): Remove. (gen_declaration): Remove second parameter; simplify to deal with TYPE_P nodes instead of raw declspecs. (gen_type_name, gen_type_name_0): New functions. (gen_method_decl): Remove second parameter; call gen_type_name() instead of gen_declaration_1(). (dump_interface): Adjust calls to gen_declaration() and gen_method_decl(); do not allocate a separate string buffer. (init_objc): Allocate a larger string buffer to accommodate dump_interface(); adjust call to build_module_descriptor(); add call to build_module_initializer_routine() for the GNU runtime. (generate_classref_translation_entry): Do not call start_decl(); call finish_var_decl() instead of finish_decl(); call convert() instead of build_c_cast(). * objc-act.h (CLASS_OWN_IVARS): Remove accessor. (CLASS_BINFO_ELTS): Reduce from 6 to 5, now that CLASS_OWN_IVARS is gone. (OCTI_GNU_INIT_DECL, GNU_INIT_decl): New. (OCTI_ELLIPSIS_NODE, objc_ellipsis_node): Remove. (OCTI_ID_ID, id_type, objc_id_id): Rename to OCTI_ID_NAME, objc_object_type and objc_object_name, respectively. (OCTI_CLS_REF, OCTI_CLASS_NAME, objc_class_reference, objc_class_name): New. (IS_CLASS): New macro. (IS_ID, IS_SUPER): Robustify. (OCTI_EXECCLASS_DECL, execclass_decl): New. (finish_file, start_class, continue_class, finish_class, start_method_def, continue_method_def, finish_method_def, start_protocol, finish_protocol, objc_build_throw_stmt, objc_build_try_catch_finally_stmt, objc_build_synchronized_prologue, objc_build_synchronized_epilogue, objc_build_try_prologue, objc_build_try_epilogue, objc_build_catch_stmt, objc_build_catch_epilogue, objc_build_finally_prologue, objc_build_finally_epilogue, is_ivar, is_private, is_public, add_instance_variable, objc_add_method, get_super_receiver, objc_clear_super_receiver, get_class_ivars_from_name, get_class_reference, get_static_reference, get_object_reference, build_message_expr, finish_message_expr, build_selector_expr, build_ivar_reference, build_keyword_decl, build_method_decl, build_protocol_expr, build_objc_string_object, objc_declare_alias, objc_declare_class, objc_declare_protocols, objc_comptypes, objc_check_decl, build_encode_expr): Remove prototypes. (imp_count, cat_count): Make GGC-aware. (OBJC_SET_TYPE_NAME): New macro. From-SVN: r87168
2004-09-08 02:49:44 +02:00
gen_type_name (orig_rtype));
c-common.h: Remove RID_ID. [gcc/ChangeLog] 2004-10-25 David Ayers <d.ayers@inode.at> * c-common.h: Remove RID_ID. * c-parse.in: Remove OBJECTNAME and references to RID_ID. (typespec_reserved_attr): Add rule for TYPENAME non_empty_protocolrefs. (yylexname): Remove special handling of RID_ID. [gcc/objc/ChangeLog] 2004-10-25 Ziemowit Laski <zlaski@apple.com> David Ayers <d.ayers@inode.at> * objc-act.c (objc_comptypes): Use IS_PROTOCOL_QUALIFIED_UNTYPED instead of IS_PROTOCOL_QUALIFIED_ID; add comparisons for: 'Class <Protocol> != id <Protocol>'; 'Class <Protocol> != <class> *'; 'Class <Protocol> == id' and 'Class <Protocol> == Class'. (objc_is_id): Add test for 'super'. (objc_finish_message_expr): Allow for messaging of 'Class <Proto>' receivers; if class methods are not found in protocol lists, search for instance methods therein and warn if one is found. Look in global hash tables for suitable method as a last resort when messaging 'id <Proto>', 'Class <Proto>' and invalid receiver types. (objc_add_method): Insert instance methods listed in protocols into the global class method hash table. * objc-act.h (IS_PROTOCOL_QUALIFIED_ID): Rename to IS_PROTOCOL_QUALIFIED_UNTYPED and allow for 'Class <Proto>' in addition to 'id <Proto>'. [gcc/testsuite/ChangeLog] 2004-10-25 David Ayers <d.ayers@inode.at> Ziemowit Laski <zlaski@apple.com> * objc.dg/call-super-2.m: Add messages to 'Class <Proto>'; update diagnostics when messaging 'id <Proto>'. * objc.dg/class-protocol-1.m: New test. * objc.dg/desig-init-1.m: Add message to an invalid receiver using a non-existent method signature. * objc.dg/method-5.m, objc.dg/method-6.m, objc.dg/proto-hier-1.m: Update diagnostics when messaging with non-existent method signature. * objc.dg/proto-hier-2.m: Adjust wording of diagnostic. * objc.dg/proto-lossage-1.m, objc.dg/proto-lossage-4.m: Messages to invalid receivers are now resolved as if messaging 'id'; remove extraneous diagnostics. From-SVN: r89562
2004-10-26 00:55:25 +02:00
/* After issuing the "invalid receiver" warning, perform method
lookup as if we were messaging 'id'. */
rtype = rprotos = NULL_TREE;
1992-01-18 00:15:38 +01:00
}
}
c-common.h: Remove RID_ID. [gcc/ChangeLog] 2004-10-25 David Ayers <d.ayers@inode.at> * c-common.h: Remove RID_ID. * c-parse.in: Remove OBJECTNAME and references to RID_ID. (typespec_reserved_attr): Add rule for TYPENAME non_empty_protocolrefs. (yylexname): Remove special handling of RID_ID. [gcc/objc/ChangeLog] 2004-10-25 Ziemowit Laski <zlaski@apple.com> David Ayers <d.ayers@inode.at> * objc-act.c (objc_comptypes): Use IS_PROTOCOL_QUALIFIED_UNTYPED instead of IS_PROTOCOL_QUALIFIED_ID; add comparisons for: 'Class <Protocol> != id <Protocol>'; 'Class <Protocol> != <class> *'; 'Class <Protocol> == id' and 'Class <Protocol> == Class'. (objc_is_id): Add test for 'super'. (objc_finish_message_expr): Allow for messaging of 'Class <Proto>' receivers; if class methods are not found in protocol lists, search for instance methods therein and warn if one is found. Look in global hash tables for suitable method as a last resort when messaging 'id <Proto>', 'Class <Proto>' and invalid receiver types. (objc_add_method): Insert instance methods listed in protocols into the global class method hash table. * objc-act.h (IS_PROTOCOL_QUALIFIED_ID): Rename to IS_PROTOCOL_QUALIFIED_UNTYPED and allow for 'Class <Proto>' in addition to 'id <Proto>'. [gcc/testsuite/ChangeLog] 2004-10-25 David Ayers <d.ayers@inode.at> Ziemowit Laski <zlaski@apple.com> * objc.dg/call-super-2.m: Add messages to 'Class <Proto>'; update diagnostics when messaging 'id <Proto>'. * objc.dg/class-protocol-1.m: New test. * objc.dg/desig-init-1.m: Add message to an invalid receiver using a non-existent method signature. * objc.dg/method-5.m, objc.dg/method-6.m, objc.dg/proto-hier-1.m: Update diagnostics when messaging with non-existent method signature. * objc.dg/proto-hier-2.m: Adjust wording of diagnostic. * objc.dg/proto-lossage-1.m, objc.dg/proto-lossage-4.m: Messages to invalid receivers are now resolved as if messaging 'id'; remove extraneous diagnostics. From-SVN: r89562
2004-10-26 00:55:25 +02:00
/* For 'id' or 'Class' receivers, search in the global hash table
as a last resort. For all receivers, warn if protocol searches
have failed. */
if (!method_prototype)
{
if (rprotos)
diagnostic.c (warning): Accept parameter to classify warning option. * diagnostic.c (warning): Accept parameter to classify warning option. (warning0): New, for when a pointer to an error() like function is needed. * errors.c (warning): Likewise. * errors.h (warning, warning0): Adjust prototypes. * toplev.h (warning, warning0): Likewise. * attribs.c, builtins.c, c-common.c, c-decl.c, c-format.c, c-gimplify.c, c-lex.c, c-objc-common.c, c-opts.c, c-parser.c, c-pragma.c, c-typeck.c, calls.c, cgraph.c, coverage.c, emit-rtl.c, fold-const.c, fortran/trans-decl.c, function.c, gcse.c, genautomata.c, haifa-sched.c, opts.c, passes.c, regclass.c, reload1.c, stmt.c, stor-layout.c, toplev.c, tree-cfg.c, tree-dump.c, tree-inline.c, tree-mudflap.c, tree-optimize.c, tree-ssa.c, tree.c, varasm.c: Adjust warning() callers. * config/alpha/alpha.c, config/arc/arc.c, config/arm/arm.c, config/avr/avr.c, config/bfin/bfin.c, config/c4x/c4x-c.c, config/c4x/c4x.c, config/cris/cris.c, config/darwin-c.c, config/darwin.c, config/darwin.h, config/h8300/h8300.c, config/i386/cygming.h, config/i386/djgpp.h, config/i386/i386.c, config/i386/winnt.c, config/ia64/ia64-c.c, config/ia64/ia64.c, config/ip2k/ip2k.c, config/m32r/m32r.c, config/m68hc11/m68hc11.c, config/m68k/m68k.c, config/mcore/mcore.c, config/mips/mips.c, config/mmix/mmix.c, config/ns32k/ns32k.c, config/pa/pa-hpux11.h, config/pa/pa.c, config/rs6000/aix43.h, config/rs6000/aix51.h, config/rs6000/aix52.h, config/rs6000/darwin.h, config/rs6000/rs6000-c.c, config/rs6000/rs6000.c, config/s390/s390.c, config/sh/sh.c, config/sh/sh.h, config/sh/symbian.c, config/sol2-c.c, config/sol2.c, config/stormy16/stormy16.c, config/v850/v850-c.c, config/v850/v850.c, config/xtensa/xtensa.c: Adjust warning() callers. * ada/misc.c: Adjust warning() callers. * cp/call.c, cp/class.c, cp/cvt.c, cp/decl.c, cp/decl2.c, cp/except.c, cp/friend.c, cp/init.c, cp/lex.c, cp/mangle.c, cp/method.c, cp/name-lookup.c, cp/parser.c, cp/repo.c, cp/rtti.c, cp/tree.c, cp/typeck.c, cp/typeck2.c: Adjust warning() callers. * fortran/trans-decl.c: Adjust warning() callers. * java/class.c, java/decl.c, java/expr.c, java/jcf-io.c, java/jcf-parse.c, java/jv-scan.c, java/parse.y: Adjust warning() callers. * objc/objc-act.c: Adjust warning() callers. * treelang/parse.y: Adjust warning() callers. From-SVN: r98633
2005-04-23 23:29:07 +02:00
warning (0, "%<%c%s%> not found in protocol(s)",
c-common.h: Remove RID_ID. [gcc/ChangeLog] 2004-10-25 David Ayers <d.ayers@inode.at> * c-common.h: Remove RID_ID. * c-parse.in: Remove OBJECTNAME and references to RID_ID. (typespec_reserved_attr): Add rule for TYPENAME non_empty_protocolrefs. (yylexname): Remove special handling of RID_ID. [gcc/objc/ChangeLog] 2004-10-25 Ziemowit Laski <zlaski@apple.com> David Ayers <d.ayers@inode.at> * objc-act.c (objc_comptypes): Use IS_PROTOCOL_QUALIFIED_UNTYPED instead of IS_PROTOCOL_QUALIFIED_ID; add comparisons for: 'Class <Protocol> != id <Protocol>'; 'Class <Protocol> != <class> *'; 'Class <Protocol> == id' and 'Class <Protocol> == Class'. (objc_is_id): Add test for 'super'. (objc_finish_message_expr): Allow for messaging of 'Class <Proto>' receivers; if class methods are not found in protocol lists, search for instance methods therein and warn if one is found. Look in global hash tables for suitable method as a last resort when messaging 'id <Proto>', 'Class <Proto>' and invalid receiver types. (objc_add_method): Insert instance methods listed in protocols into the global class method hash table. * objc-act.h (IS_PROTOCOL_QUALIFIED_ID): Rename to IS_PROTOCOL_QUALIFIED_UNTYPED and allow for 'Class <Proto>' in addition to 'id <Proto>'. [gcc/testsuite/ChangeLog] 2004-10-25 David Ayers <d.ayers@inode.at> Ziemowit Laski <zlaski@apple.com> * objc.dg/call-super-2.m: Add messages to 'Class <Proto>'; update diagnostics when messaging 'id <Proto>'. * objc.dg/class-protocol-1.m: New test. * objc.dg/desig-init-1.m: Add message to an invalid receiver using a non-existent method signature. * objc.dg/method-5.m, objc.dg/method-6.m, objc.dg/proto-hier-1.m: Update diagnostics when messaging with non-existent method signature. * objc.dg/proto-hier-2.m: Adjust wording of diagnostic. * objc.dg/proto-lossage-1.m, objc.dg/proto-lossage-4.m: Messages to invalid receivers are now resolved as if messaging 'id'; remove extraneous diagnostics. From-SVN: r89562
2004-10-26 00:55:25 +02:00
(class_tree ? '+' : '-'),
IDENTIFIER_POINTER (sel_name));
if (!rtype)
method_prototype
= lookup_method_in_hash_lists (sel_name, class_tree != NULL_TREE);
}
if (!method_prototype)
1992-01-18 00:15:38 +01:00
{
static bool warn_missing_methods = false;
if (rtype)
diagnostic.c (warning): Accept parameter to classify warning option. * diagnostic.c (warning): Accept parameter to classify warning option. (warning0): New, for when a pointer to an error() like function is needed. * errors.c (warning): Likewise. * errors.h (warning, warning0): Adjust prototypes. * toplev.h (warning, warning0): Likewise. * attribs.c, builtins.c, c-common.c, c-decl.c, c-format.c, c-gimplify.c, c-lex.c, c-objc-common.c, c-opts.c, c-parser.c, c-pragma.c, c-typeck.c, calls.c, cgraph.c, coverage.c, emit-rtl.c, fold-const.c, fortran/trans-decl.c, function.c, gcse.c, genautomata.c, haifa-sched.c, opts.c, passes.c, regclass.c, reload1.c, stmt.c, stor-layout.c, toplev.c, tree-cfg.c, tree-dump.c, tree-inline.c, tree-mudflap.c, tree-optimize.c, tree-ssa.c, tree.c, varasm.c: Adjust warning() callers. * config/alpha/alpha.c, config/arc/arc.c, config/arm/arm.c, config/avr/avr.c, config/bfin/bfin.c, config/c4x/c4x-c.c, config/c4x/c4x.c, config/cris/cris.c, config/darwin-c.c, config/darwin.c, config/darwin.h, config/h8300/h8300.c, config/i386/cygming.h, config/i386/djgpp.h, config/i386/i386.c, config/i386/winnt.c, config/ia64/ia64-c.c, config/ia64/ia64.c, config/ip2k/ip2k.c, config/m32r/m32r.c, config/m68hc11/m68hc11.c, config/m68k/m68k.c, config/mcore/mcore.c, config/mips/mips.c, config/mmix/mmix.c, config/ns32k/ns32k.c, config/pa/pa-hpux11.h, config/pa/pa.c, config/rs6000/aix43.h, config/rs6000/aix51.h, config/rs6000/aix52.h, config/rs6000/darwin.h, config/rs6000/rs6000-c.c, config/rs6000/rs6000.c, config/s390/s390.c, config/sh/sh.c, config/sh/sh.h, config/sh/symbian.c, config/sol2-c.c, config/sol2.c, config/stormy16/stormy16.c, config/v850/v850-c.c, config/v850/v850.c, config/xtensa/xtensa.c: Adjust warning() callers. * ada/misc.c: Adjust warning() callers. * cp/call.c, cp/class.c, cp/cvt.c, cp/decl.c, cp/decl2.c, cp/except.c, cp/friend.c, cp/init.c, cp/lex.c, cp/mangle.c, cp/method.c, cp/name-lookup.c, cp/parser.c, cp/repo.c, cp/rtti.c, cp/tree.c, cp/typeck.c, cp/typeck2.c: Adjust warning() callers. * fortran/trans-decl.c: Adjust warning() callers. * java/class.c, java/decl.c, java/expr.c, java/jcf-io.c, java/jcf-parse.c, java/jv-scan.c, java/parse.y: Adjust warning() callers. * objc/objc-act.c: Adjust warning() callers. * treelang/parse.y: Adjust warning() callers. From-SVN: r98633
2005-04-23 23:29:07 +02:00
warning (0, "%qs may not respond to %<%c%s%>",
IDENTIFIER_POINTER (OBJC_TYPE_NAME (rtype)),
objc-act.h (get_object_reference): Rename to get_protocol_reference. 2004-06-20 David Ayers <d.ayers@inode.at> * objc/objc-act.h (get_object_reference): Rename to get_protocol_reference. (super_type): Rename to objc_super_type. (selector_type): Rename to objc_selector_type. (id_type): Rename to objc_id_type. (instance_type): Rename to objc_instance_type. (protocol_type): Rename to objc_protocol_type. (IS_ID): Update reference to id_type. * objc/objc-act.c (get_object_reference): Rename to get_protocol_reference; add documentation; update references to id_type. (lookup_method_in_protocol_list): Rename class_meth to is_class; add documentation. (finish_message_expr): Rename is_class to class_tree. (synth_module_prologue, objc_is_object_ptr, objc_build_exc_ptr, next_sjlj_build_try_catch_finally, objc_begin_catch_clause, build_next_objc_exception_stuff, get_arg_type_list, build_objc_method_call): Update references to id_type. (synth_module_prologue, build_objc_symtab_template, build_selector_reference_decl, build_selector, build_selector_translation_table, build_typed_selector_reference, get_arg_type_list, synth_self_and_ucmd_args, get_arg_type_list, synth_self_and_ucmd_args): Update references to selector_type. (build_private_template, build_ivar_reference): Update references to instance_type. (synth_module_prologue, build_protocol_reference, build_protocol_expr, start_protocol): Update references to protocol_type. (synth_module_prologue, get_arg_type_list, build_objc_method_call): Update references to super_type. * c-parse.in: (typespec_nonreserved_nonattr): Update references to get_object_reference. * objc/objc-tree.def: Add C mode identifier sequence. From-SVN: r83425
2004-06-21 03:50:18 +02:00
(class_tree ? '+' : '-'),
IDENTIFIER_POINTER (sel_name));
c-common.h: Remove RID_ID. [gcc/ChangeLog] 2004-10-25 David Ayers <d.ayers@inode.at> * c-common.h: Remove RID_ID. * c-parse.in: Remove OBJECTNAME and references to RID_ID. (typespec_reserved_attr): Add rule for TYPENAME non_empty_protocolrefs. (yylexname): Remove special handling of RID_ID. [gcc/objc/ChangeLog] 2004-10-25 Ziemowit Laski <zlaski@apple.com> David Ayers <d.ayers@inode.at> * objc-act.c (objc_comptypes): Use IS_PROTOCOL_QUALIFIED_UNTYPED instead of IS_PROTOCOL_QUALIFIED_ID; add comparisons for: 'Class <Protocol> != id <Protocol>'; 'Class <Protocol> != <class> *'; 'Class <Protocol> == id' and 'Class <Protocol> == Class'. (objc_is_id): Add test for 'super'. (objc_finish_message_expr): Allow for messaging of 'Class <Proto>' receivers; if class methods are not found in protocol lists, search for instance methods therein and warn if one is found. Look in global hash tables for suitable method as a last resort when messaging 'id <Proto>', 'Class <Proto>' and invalid receiver types. (objc_add_method): Insert instance methods listed in protocols into the global class method hash table. * objc-act.h (IS_PROTOCOL_QUALIFIED_ID): Rename to IS_PROTOCOL_QUALIFIED_UNTYPED and allow for 'Class <Proto>' in addition to 'id <Proto>'. [gcc/testsuite/ChangeLog] 2004-10-25 David Ayers <d.ayers@inode.at> Ziemowit Laski <zlaski@apple.com> * objc.dg/call-super-2.m: Add messages to 'Class <Proto>'; update diagnostics when messaging 'id <Proto>'. * objc.dg/class-protocol-1.m: New test. * objc.dg/desig-init-1.m: Add message to an invalid receiver using a non-existent method signature. * objc.dg/method-5.m, objc.dg/method-6.m, objc.dg/proto-hier-1.m: Update diagnostics when messaging with non-existent method signature. * objc.dg/proto-hier-2.m: Adjust wording of diagnostic. * objc.dg/proto-lossage-1.m, objc.dg/proto-lossage-4.m: Messages to invalid receivers are now resolved as if messaging 'id'; remove extraneous diagnostics. From-SVN: r89562
2004-10-26 00:55:25 +02:00
/* If we are messaging an 'id' or 'Class' object and made it here,
then we have failed to find _any_ instance or class method,
respectively. */
else
diagnostic.c (warning): Accept parameter to classify warning option. * diagnostic.c (warning): Accept parameter to classify warning option. (warning0): New, for when a pointer to an error() like function is needed. * errors.c (warning): Likewise. * errors.h (warning, warning0): Adjust prototypes. * toplev.h (warning, warning0): Likewise. * attribs.c, builtins.c, c-common.c, c-decl.c, c-format.c, c-gimplify.c, c-lex.c, c-objc-common.c, c-opts.c, c-parser.c, c-pragma.c, c-typeck.c, calls.c, cgraph.c, coverage.c, emit-rtl.c, fold-const.c, fortran/trans-decl.c, function.c, gcse.c, genautomata.c, haifa-sched.c, opts.c, passes.c, regclass.c, reload1.c, stmt.c, stor-layout.c, toplev.c, tree-cfg.c, tree-dump.c, tree-inline.c, tree-mudflap.c, tree-optimize.c, tree-ssa.c, tree.c, varasm.c: Adjust warning() callers. * config/alpha/alpha.c, config/arc/arc.c, config/arm/arm.c, config/avr/avr.c, config/bfin/bfin.c, config/c4x/c4x-c.c, config/c4x/c4x.c, config/cris/cris.c, config/darwin-c.c, config/darwin.c, config/darwin.h, config/h8300/h8300.c, config/i386/cygming.h, config/i386/djgpp.h, config/i386/i386.c, config/i386/winnt.c, config/ia64/ia64-c.c, config/ia64/ia64.c, config/ip2k/ip2k.c, config/m32r/m32r.c, config/m68hc11/m68hc11.c, config/m68k/m68k.c, config/mcore/mcore.c, config/mips/mips.c, config/mmix/mmix.c, config/ns32k/ns32k.c, config/pa/pa-hpux11.h, config/pa/pa.c, config/rs6000/aix43.h, config/rs6000/aix51.h, config/rs6000/aix52.h, config/rs6000/darwin.h, config/rs6000/rs6000-c.c, config/rs6000/rs6000.c, config/s390/s390.c, config/sh/sh.c, config/sh/sh.h, config/sh/symbian.c, config/sol2-c.c, config/sol2.c, config/stormy16/stormy16.c, config/v850/v850-c.c, config/v850/v850.c, config/xtensa/xtensa.c: Adjust warning() callers. * ada/misc.c: Adjust warning() callers. * cp/call.c, cp/class.c, cp/cvt.c, cp/decl.c, cp/decl2.c, cp/except.c, cp/friend.c, cp/init.c, cp/lex.c, cp/mangle.c, cp/method.c, cp/name-lookup.c, cp/parser.c, cp/repo.c, cp/rtti.c, cp/tree.c, cp/typeck.c, cp/typeck2.c: Adjust warning() callers. * fortran/trans-decl.c: Adjust warning() callers. * java/class.c, java/decl.c, java/expr.c, java/jcf-io.c, java/jcf-parse.c, java/jv-scan.c, java/parse.y: Adjust warning() callers. * objc/objc-act.c: Adjust warning() callers. * treelang/parse.y: Adjust warning() callers. From-SVN: r98633
2005-04-23 23:29:07 +02:00
warning (0, "no %<%c%s%> method found",
objc-act.h (get_object_reference): Rename to get_protocol_reference. 2004-06-20 David Ayers <d.ayers@inode.at> * objc/objc-act.h (get_object_reference): Rename to get_protocol_reference. (super_type): Rename to objc_super_type. (selector_type): Rename to objc_selector_type. (id_type): Rename to objc_id_type. (instance_type): Rename to objc_instance_type. (protocol_type): Rename to objc_protocol_type. (IS_ID): Update reference to id_type. * objc/objc-act.c (get_object_reference): Rename to get_protocol_reference; add documentation; update references to id_type. (lookup_method_in_protocol_list): Rename class_meth to is_class; add documentation. (finish_message_expr): Rename is_class to class_tree. (synth_module_prologue, objc_is_object_ptr, objc_build_exc_ptr, next_sjlj_build_try_catch_finally, objc_begin_catch_clause, build_next_objc_exception_stuff, get_arg_type_list, build_objc_method_call): Update references to id_type. (synth_module_prologue, build_objc_symtab_template, build_selector_reference_decl, build_selector, build_selector_translation_table, build_typed_selector_reference, get_arg_type_list, synth_self_and_ucmd_args, get_arg_type_list, synth_self_and_ucmd_args): Update references to selector_type. (build_private_template, build_ivar_reference): Update references to instance_type. (synth_module_prologue, build_protocol_reference, build_protocol_expr, start_protocol): Update references to protocol_type. (synth_module_prologue, get_arg_type_list, build_objc_method_call): Update references to super_type. * c-parse.in: (typespec_nonreserved_nonattr): Update references to get_object_reference. * objc/objc-tree.def: Add C mode identifier sequence. From-SVN: r83425
2004-06-21 03:50:18 +02:00
(class_tree ? '+' : '-'),
IDENTIFIER_POINTER (sel_name));
c-common.h: Remove RID_ID. [gcc/ChangeLog] 2004-10-25 David Ayers <d.ayers@inode.at> * c-common.h: Remove RID_ID. * c-parse.in: Remove OBJECTNAME and references to RID_ID. (typespec_reserved_attr): Add rule for TYPENAME non_empty_protocolrefs. (yylexname): Remove special handling of RID_ID. [gcc/objc/ChangeLog] 2004-10-25 Ziemowit Laski <zlaski@apple.com> David Ayers <d.ayers@inode.at> * objc-act.c (objc_comptypes): Use IS_PROTOCOL_QUALIFIED_UNTYPED instead of IS_PROTOCOL_QUALIFIED_ID; add comparisons for: 'Class <Protocol> != id <Protocol>'; 'Class <Protocol> != <class> *'; 'Class <Protocol> == id' and 'Class <Protocol> == Class'. (objc_is_id): Add test for 'super'. (objc_finish_message_expr): Allow for messaging of 'Class <Proto>' receivers; if class methods are not found in protocol lists, search for instance methods therein and warn if one is found. Look in global hash tables for suitable method as a last resort when messaging 'id <Proto>', 'Class <Proto>' and invalid receiver types. (objc_add_method): Insert instance methods listed in protocols into the global class method hash table. * objc-act.h (IS_PROTOCOL_QUALIFIED_ID): Rename to IS_PROTOCOL_QUALIFIED_UNTYPED and allow for 'Class <Proto>' in addition to 'id <Proto>'. [gcc/testsuite/ChangeLog] 2004-10-25 David Ayers <d.ayers@inode.at> Ziemowit Laski <zlaski@apple.com> * objc.dg/call-super-2.m: Add messages to 'Class <Proto>'; update diagnostics when messaging 'id <Proto>'. * objc.dg/class-protocol-1.m: New test. * objc.dg/desig-init-1.m: Add message to an invalid receiver using a non-existent method signature. * objc.dg/method-5.m, objc.dg/method-6.m, objc.dg/proto-hier-1.m: Update diagnostics when messaging with non-existent method signature. * objc.dg/proto-hier-2.m: Adjust wording of diagnostic. * objc.dg/proto-lossage-1.m, objc.dg/proto-lossage-4.m: Messages to invalid receivers are now resolved as if messaging 'id'; remove extraneous diagnostics. From-SVN: r89562
2004-10-26 00:55:25 +02:00
if (!warn_missing_methods)
1992-01-18 00:15:38 +01:00
{
diagnostic.c (warning): Accept parameter to classify warning option. * diagnostic.c (warning): Accept parameter to classify warning option. (warning0): New, for when a pointer to an error() like function is needed. * errors.c (warning): Likewise. * errors.h (warning, warning0): Adjust prototypes. * toplev.h (warning, warning0): Likewise. * attribs.c, builtins.c, c-common.c, c-decl.c, c-format.c, c-gimplify.c, c-lex.c, c-objc-common.c, c-opts.c, c-parser.c, c-pragma.c, c-typeck.c, calls.c, cgraph.c, coverage.c, emit-rtl.c, fold-const.c, fortran/trans-decl.c, function.c, gcse.c, genautomata.c, haifa-sched.c, opts.c, passes.c, regclass.c, reload1.c, stmt.c, stor-layout.c, toplev.c, tree-cfg.c, tree-dump.c, tree-inline.c, tree-mudflap.c, tree-optimize.c, tree-ssa.c, tree.c, varasm.c: Adjust warning() callers. * config/alpha/alpha.c, config/arc/arc.c, config/arm/arm.c, config/avr/avr.c, config/bfin/bfin.c, config/c4x/c4x-c.c, config/c4x/c4x.c, config/cris/cris.c, config/darwin-c.c, config/darwin.c, config/darwin.h, config/h8300/h8300.c, config/i386/cygming.h, config/i386/djgpp.h, config/i386/i386.c, config/i386/winnt.c, config/ia64/ia64-c.c, config/ia64/ia64.c, config/ip2k/ip2k.c, config/m32r/m32r.c, config/m68hc11/m68hc11.c, config/m68k/m68k.c, config/mcore/mcore.c, config/mips/mips.c, config/mmix/mmix.c, config/ns32k/ns32k.c, config/pa/pa-hpux11.h, config/pa/pa.c, config/rs6000/aix43.h, config/rs6000/aix51.h, config/rs6000/aix52.h, config/rs6000/darwin.h, config/rs6000/rs6000-c.c, config/rs6000/rs6000.c, config/s390/s390.c, config/sh/sh.c, config/sh/sh.h, config/sh/symbian.c, config/sol2-c.c, config/sol2.c, config/stormy16/stormy16.c, config/v850/v850-c.c, config/v850/v850.c, config/xtensa/xtensa.c: Adjust warning() callers. * ada/misc.c: Adjust warning() callers. * cp/call.c, cp/class.c, cp/cvt.c, cp/decl.c, cp/decl2.c, cp/except.c, cp/friend.c, cp/init.c, cp/lex.c, cp/mangle.c, cp/method.c, cp/name-lookup.c, cp/parser.c, cp/repo.c, cp/rtti.c, cp/tree.c, cp/typeck.c, cp/typeck2.c: Adjust warning() callers. * fortran/trans-decl.c: Adjust warning() callers. * java/class.c, java/decl.c, java/expr.c, java/jcf-io.c, java/jcf-parse.c, java/jv-scan.c, java/parse.y: Adjust warning() callers. * objc/objc-act.c: Adjust warning() callers. * treelang/parse.y: Adjust warning() callers. From-SVN: r98633
2005-04-23 23:29:07 +02:00
warning (0, "(Messages without a matching method signature");
warning (0, "will be assumed to return %<id%> and accept");
warning (0, "%<...%> as arguments.)");
warn_missing_methods = true;
1992-01-18 00:15:38 +01:00
}
}
/* Save the selector name for printing error messages. */
current_objc_message_selector = sel_name;
1992-01-18 00:15:38 +01:00
/* Build the parameters list for looking up the method.
These are the object itself and the selector. */
if (flag_typed_selectors)
selector = build_typed_selector_reference (sel_name, method_prototype);
else
selector = build_selector_reference (sel_name);
1992-01-18 00:15:38 +01:00
retval = build_objc_method_call (super, method_prototype,
receiver,
1992-01-18 00:15:38 +01:00
selector, method_params);
current_objc_message_selector = 0;
1992-01-18 00:15:38 +01:00
return retval;
}
/* Build a tree expression to send OBJECT the operation SELECTOR,
looking up the method on object LOOKUP_OBJECT (often same as OBJECT),
assuming the method has prototype METHOD_PROTOTYPE.
(That is an INSTANCE_METHOD_DECL or CLASS_METHOD_DECL.)
Use METHOD_PARAMS as list of args to pass to the method.
If SUPER_FLAG is nonzero, we look up the superclass's method. */
static tree
build_objc_method_call (int super_flag, tree method_prototype,
tree lookup_object, tree selector,
tree method_params)
1992-01-18 00:15:38 +01:00
{
tree sender = (super_flag ? umsg_super_decl :
(!flag_next_runtime || flag_nil_receivers
Yet more Objective-C++... * objc-act.c (objc_finish_try_stmt): Add return value. (objc_build_synchronized): Likewise. * objc-act.c (objc_is_gcable_type): Add. (objc_substitute_decl): Add. (objc_build_ivar_assignment): Add. (objc_build_global_assignment): Add. (objc_build_strong_cast_assignment): Add. (objc_is_ivar_reference_p): Add. (objc_is_global_reference_p): Add. (objc_generate_write_barrier): Add. (objc_rewrite_function_call): Add. (objc_gimplify_expr): Add Objective-C++ support. * objc-act.h (ALLOC_OBJC_TYPE_LANG_SPECIFIC): Likewise. (SIZEOF_OBJC_TYPE_LANG_SPECIFIC): Add. (INIT_TYPE_OBJC_INFO): Add Objective-C++ support. (DUP_TYPE_OBJC_INFO): Likewise. (struct imp_entry): Add field has_cxx_cdtors. (struct imp_entry *imp_list): Add OCTI_UMSG_FAST_DECL, OCTI_METH_LIST_TEMPL, OCTI_METH_PROTO_LIST_TEMPL, OCTI_IVAR_LIST_TEMPL, OCTI_ASSIGN_IVAR_DECL, OCTI_ASSIGN_IVAR_FAST_DECL, OCTI_ASSIGN_GLOBAL_DECL, OCTI_ASSIGN_STRONGCAST_DECL. (umsg_fast_decl): Add. (objc_assign_ivar_decl): Add. (objc_assign_ivar_fast_decl): Add. (objc_assign_global_decl): Add. (objc_assign_strong_cast_decl): Add. (objc_method_list_ptr): Add. (objc_method_proto_list_ptr): Add. (objc_ivar_list_ptr): Add. * objc-act.c (should_call_super_dealloc): Add. (OBJC_VERSION): Bump to 6. (objc_is_gcable_type): Add. (objc_substitute_decl): Add. (objc_build_ivar_assignment): Add. (objc_build_global_assignment): Add. (objc_build_strong_cast_assignment): Add. (objc_is_gcable_p): Add. (objc_is_ivar_reference_p): Add. (objc_is_global_reference_p): Add. (generate_shared_structures): Add flags parameter. (objc_generate_cxx_ctor_or_dtor): Add. (objc_generate_cxx_cdtors): Add. (add_class): Add name parameter. (objc_types_share_size_and_alignment): Add. (comp_proto_with_proto): Add strict parameter. (CLS_HAS_CXX_STRUCTORS): Add. (TAG_ASSIGNIVAR): Add. (TAG_ASSIGNGLOBAL): Add. (TAG_ASSIGNSTRONGCAST): Add. (TAG_MSGSEND_FAST): Add. (TAG_ASSIGNIVAR_FAST): Add. (TAG_CXX_CONSTRUCT): Add. (TAG_CXX_DESTRUCT): Add. (OBJC_LOOKUP_CLASS): Add. (OBJC_LOOKUP_NO_SUPER): Add. (objc_finish_file): Add pch support. (objc_finish_implementation): Add Objective-C++ support. (synth_module_prologue): Likewise. (synth_module_prologue): Add fast dispatching. (objc_get_class_reference): Add Objective-C++ support. (objc_generate_write_barrier): Likewise. (next_sjlj_build_enter_and_setjmp): Likewise. (objc_begin_try_stmt): Likewise. (build_next_objc_exception_stuff): Add fast ivar support. (build_private_template): Mark the record as used so debug information is generated. (build_protocol_template): Add Objective-C++ support. (objc_method_parm_type) Likewise. (objc_generate_cxx_ctor_or_dtor): Likewise. (objc_generate_cxx_cdtors): Likewise. (build_protocol_initializer): Likewise. (build_category_template): Likewise. (build_class_template): Likewise. (build_method_list_template): Likewise. (build_category_initializer): Likewise. (build_shared_structure_initializer): Likewise. (objc_finish_message_expr): Likewise. (build_objc_method_call): Add fast dispatch support. (lookup_method_static): Add support to end search at superclasses. (add_method_to_hash_list): Add strict parameter to comp_proto_with_proto. (objc_add_method): Likewise. (objc_add_method): Also set the interface_value. (add_instance_variable): Add Objective-C++ support. (objc_is_public): Likewise. (start_class): Likewise. (continue_class): Likewise. (encode_aggregate_within): Likewise. (start_method_def): Likewise. (objc_start_function): Clear current_function_returns_value and current_function_returns_null. (really_start_method): Add Objective-C++ support. (objc_finish_method_definition): Add warning for missing [super dealloc]. (finish_objc): Add Objective-C++ support. (generate_objc_image_info): Likewise. (objc_lookup_ivar): Likewise. * objc-act.h (TYPE_HAS_OBJC_INFO): Likewise. (INIT_TYPE_OBJC_INFO): Likewise. (DUP_TYPE_OBJC_INFO): Likewise. From-SVN: r99857
2005-05-17 22:07:08 +02:00
? (flag_objc_direct_dispatch
? umsg_fast_decl
: umsg_decl)
: umsg_nonnil_decl));
Makefile.in (c-parse.o): Depend on $(C_COMMON_H). [gcc/ChangeLog] 2004-09-07 Ziemowit Laski <zlaski@apple.com> * Makefile.in (c-parse.o): Depend on $(C_COMMON_H). * c-parse.in: Include c-common.h instead of objc-act.h. (ivar_decl_list, ivar_decls, ivar_decl, ivars, ivar_declarator, myparms, myparm): Remove %type declarations. (methodtype, optparms, OBJC_TYPE_QUAL, objc_quals, objc_qual, objc_typename, objc_try_catch_stmt, optellipsis): Add %type declarations. (objc_inherit_code, objc_public_flag): Remove. (typespec_nonreserved_nonattr): Call objc_get_protocol_qualified_type() instead of get_static_reference() and get_protocol_reference(). (stmt_nocomp): Call grokparm() on @catch parameter. (objcdef): Move semantic action to objc_finish_implementation(). (classdef): Move semantic action to objc_start_class_interface(), objc_continue_interface(), objc_finish_interface(), objc_start_class_implementation(), objc_continue_implementation(), objc_start_category_interface() and objc_start_category_implementation(). (protocoldef): Move semantic actions to objc_start_protocol() and objc_finish_interface(). (ivar_decl_list): Remove nonterminal. (visibility_spec): Move semantic actions to objc_set_visibility(). (ivar_decls): Remove assignment to $$. (ivar_decl): Rephrase in terms of component_decl; call objc_add_instance_variable(). (ivars, ivar_declarator): Remove nonterminals. (opt_semi): New nonterminal. (methodtype): Remove semantic actions. (methoddef): Move semantic actions to objc_set_method_type(), objc_start_method_definition() and objc_finish_method_definition(). (methodproto): Move semantic actions to objc_set_method_type() and objc_add_method_declaration(). (methoddecl): Use objc_typename instead of typename; move semantic actions to objc_build_method_signature(). (optarglist, myxdecls, mydecl, myparms, myparm): Remove nonterminals. (optparmlist): Express in terms of optparms and optellipsis. (optparms, optellipsis, objc_qual, objc_quals, objc_typename): New nonterminals. (keyworddecl): Use objc_typename instead of typename. (rid_to_yy): Mark RID_IN, RID_OUT, RID_INOUT, RID_BYCOPY, RID_BYREF and RID_ONEWAY as returning OBJC_TYPE_QUAL to yyparse(). [gcc/objc/ChangeLog] 2004-09-07 Ziemowit Laski <zlaski@apple.com> * Make-lang.in (objc/objc-parse.o): Depend on $(C_COMMON_H) instead of objc/objc-act.h. (objc/objc-act.o): Depend on $(HASHTAB_H). * objc-act.c: Include hashtab.h; in ObjC++ mode, include cp-tree.h and objcp-decl.h instead of c-tree.h. (build_module_descriptor, get_class_ivars, synth_id_with_class_suffix, error_with_ivar, gen_method_decl, gen_declaration, setup_string_decl, build_protocol_template): Adjust prototypes. (build_module_initializer_routine, start_class, continue_class, finish_class, start_method_def, objc_start_function, start_protocol, build_method_decl, objc_add_method, add_instance_variable, build_ivar_reference, is_ivar, is_private, get_super_receiver, build_selector_table_decl, objc_push_parm, objc_get_parm_info, gen_type_name, gen_type_name_0, start_var_decl, finish_var_decl, create_field_decl): New prototypes. (objc_expand_function_end, comp_method_with_proto, objc_expr_last, gen_declaration_1, gen_declarator, is_complex_decl, adorn_decl, define_decl, create_builtin_decl, gen_declspecs): Remove prototypes. (TYPE_ID): Rename to OBJECT_TYPEDEF_NAME. (CLASS_TYPEDEF_NAME): New. (TAG_EXECCLASS): Change from a global variable to a #define. (TAG_RETURN_STRUCT): Delete. (TAG_GNUINIT): New, holds '__objc_gnu_init' name. (objc_inherit_code, objc_public_flag): New, moved from c-parse.in. (string_descriptor): New struct. (string_htab): New hash table. (string_hash, string_eq): New prototypes. (generate_struct_by_value_array): Call create_field_decl() instead of create_builtin_decl(). (objc_init): Do not initialize objc_ellipsis_node or TAG_EXECCLASS; In ObjC++ mode, call cxx_init() instead of c_objc_common_init(). (objc_finish_file): In ObjC++, call instantiate_pending_templates() and cp_finish_file(). (define_decl, get_static_reference, get_protocol_reference, create_builtin_decl): Remove functions. (objc_start_class_interface, objc_start_category_interface, objc_start_protocol, objc_continue_interface, objc_finish_interface, objc_start_class_implementation, objc_start_category_implementation, objc_continue_implementation, objc_finish_implementation, objc_set_visibility, objc_set_method_type, objc_build_method_signature, objc_add_method_declaration, objc_start_method_definition, objc_add_instance_variable, objc_get_protocol_qualified_type, create_field_decl, start_var_decl, finish_var_decl): New functions. (setup_string_decl): Simplify since it is only called once. (synth_module_prologue): Call build_class_template(); predefine 'id' and 'Class' as typedefs; rename 'temp_type' to 'type'; disable debug hooks for duration of function; fix GNU runtime messenger signatures to correspond to reality; forward-declare '__objc_exec_class' for the GNU runtime; call build_selector_table_decl(); in ObjC++ mode, generate 'extern "C" { ... }' wrappers around synthesized declarations; call build_protocol_template() and build_category_template(). (string_hash, string_eq): New functions. (objc_build_string_object): Check metaclass correctness only once; store string literals in hash table. (objc_build_constructor): Do not convert initializer elements; adjust for ObjC++ impedance mismatch. (build_objc_symtab_template): Call create_field_decl() instead of create_builtin_decl(). (init_objc_symtab): Add missing conversion to initializer element. (build_metadata_decl): Call start_var_decl() instead of define_decl(). (generate_objc_symtab_decl): Do not call build_category_template(); call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(). (build_module_descriptor): Call create_field_decl() instead of grokfield(); call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(); always mark module descriptor as used; move GNU runtime-specific functionality to build_module_initializer_routine(). (build_module_initializer_routine): New function, broken off of build_module_descriptor(). (objc_static_init_needed_p, objc_generate_static_init_call): New functions. (generate_static_references, generate_strings, build_selector_translation_table, generate_descriptor_table, generate_ivars_list, generate_dispatch_table, generate_category): Call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(); build a type directly instead of via groktypename(). (build_selector_reference_decl, build_selector_table_decl, build_class_reference_decl, build_protocol_reference, generate_objc_image_info): Call start_var_decl() instead of build_decl(). (build_selector_reference): For GNU runtime, do not call build_selector_reference_decl(). (build_selector, build_typed_selector_reference): Always convert result to the selector type. (add_objc_string): Cast return value to 'char *'. (build_method_prototype_template, build_selector_template, build_method_template): Use actual selector type for fields pointing to selectors. (finish_objc): For GNU runtime, call build_module_initializer_routine() after build_module_descriptor(). (generate_protocol_list, generate_shared_structures): Call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(); build a type directly instead of via groktypename(). (synth_id_with_class_suffix): Return a string. (get_arg_type_list): For instance methods, use the instance type for 'self'; do not call groktypename_in_parm_context(). (build_objc_string_decl): Squash redeclaration errors in ObjC++. (objc_is_class_name): Use OBJC_TYPE_NAME instead of TYPE_NAME; handle RECORD_TYPEs in ObjC as well as ObjC++. (objc_is_id): New function. (objc_is_object_ptr): Return the canonical type node. (objc_get_class_ivars): Simplify using get_class_ivars(). (get_class_ivars): Remove second parameter; create a fresh copy of the ivar list for each call; do not check for existence of super class. (objc_eh_runtime_type): Mark #ifndef OBJCPLUS. (objc_init_exceptions): When using SJLJ-style exceptions, require the use of '-fobjc-exceptions' flag; do not require it for DWARF-style exceptions. (objc_build_exc_ptr, next_sjlj_build_try_catch_finally): Use objc_object_type instead of objc_id_type. (objc_begin_catch_clause): Convert the incoming PARM_DECL into a VAR_DECL before placing it in the appropriate scope; do not call define_decl(); adjust call to c_begin_compound_stmt(); use objc_object_type instead of objc_id_type. (build_next_objc_exception_stuff): Call create_field_decl() instead of create_builtin_decl(); construct type directly instead of calling groktypename(); use OBJC_VOID_AT_END to mark end of function parameters. (build_private_template): Adjust call to get_class_ivars(); build a type directly instead of via groktypename(). (build_protocol_template, build_method_prototype_list_template, build_method_prototype_template, build_category_template, build_selector_template, build_class_template, build_super_template, build_ivar_template, build_ivar_list_template, build_method_list_template, build_method_template): Call create_field_decl() instead of grokfield(). (objc_method_parm_type): Do not call groktypename(). (generate_descriptor_table): Call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(). (generate_method_descriptors, build_protocol_initializer, generate_dispatch_tables, build_category_initializer, build_shared_structure_initializer): Do not call groktypename(). (generate_protocols): Call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(); do not call groktypename(). (error_with_ivar): Remove last parameter. (check_ivars): Do not iterate ovar CLASS_RAW_IVARS lists in addition to CLASS_IVARS lists; adjust calls to error_with_ivar(). (generate_ivar_lists): Convert one of the initializer elements; do not call groktypename(). (get_arg_type_list, start_method_def, gen_method_def): Account for new representation of variable arguments and '...' in Objective-C methods; add Objective-C++ impedance matching code. (is_objc_type_qualifier): Remove function. (adjust_type_for_id_default): Simplify; there is no longer a need to wade through declspecs. (lookup_interface, start_class, continue_class, finish_class, start_method_def, start_protocol, build_method_decl, objc_add_method, add_instance_variable, build_ivar_reference, is_ivar, is_private, get_super_receiver, objc_build_finally_epilogue): Make into static functions. (receiver_is_class_object): Use new IS_CLASS() macro. (objc_build_message_expr): Tweak ObjC++ message argument handling; call objc_finish_message_expr() instead of finish_message_expr(). (finish_message_expr): Rename to objc_finish_message_expr(); use OBJC_TYPE_NAME and OBJC_SET_TYPE_NAME macros instead of TYPE_NAME. call gen_type_name() instead of gen_declaration(); call objc_is_id() instead of using IS_ID and IS_CLASS; Use objc_class_name instead of calling get_identifier("Class"); handle CONVERT_EXPRs in receiver. (build_objc_method_call, warn_with_method): Do not call groktypename(). (build_ivar_reference): Call convert() instead of clobbering in a type. (hash_init): Initialize string_htab hash table. (add_instance_variable): Simplify parameter list; do not call grokfield(); do not populate CLASS_IVARS list. (start_class): Check for the existence of super class, if one was specified. (continue_class): Use CLASS_RAW_IVARS rather than CLASS_IVARS; do not call build_class_template(); adjust call to get_class_ivars(); call build_decl(), pushdecl() and finish_decl() instead of define_decl(). (finish_class): Call build_decl(), pushdecl() and finish_decl() instead of define_decl(). (add_protocols): Use PROTOCOL_BINFO_ELTS for the tree vector size. (start_protocol): Do not call build_protocol_template(); use PROTOCOL_BINFO_ELTS for the tree vector size. (encode_type_qualifiers): Do not handle the 'const' qualifier here. (encode_pointer): Encode 'const char *' as 'r*', for backwards compatibility. (encode_array): Use HOST_WIDE_INT_PRINT_DEC instead of "%ld". (encode_type): Handle the 'const' qualifier here. (objc_parmlist): New global variable, sued by objc_push_parm and objc_get_parm_info(). (objc_push_parm, objc_get_parm_info): New functions. (objc_expr_last): Remove function. (synth_self_and_ucmd_args): For instance methods, use the instance type for 'self'; call objc_push_parm() instead of push_parm_decl(). (start_method_def): Do not call push_scope(), declare_parm_level(), pop_scope(), push_parm_decl(), store_parm_decls() or objc_expr_last(); just use objc_push_parm() and objc_get_parm_info(). (comp_method_with_proto): Remove function. (objc_types_are_equivalent): Strip away indirections before comparing underlying types. (comp_proto_with_proto): Do not call groktypename(); types are no longer in raw declspec format. (objc_start_function): New function. (really_start_method): Call comp_proto_with_proto() instead of comp_method_with_proto(); call objc_start_function() instead of hand-crafting a function declarator. (continue_method_def, objc_expand_function_end): Remove functions. (get_super_receiver): Call objc_get_current_scope() instead of get_current_scope(); reference 'super_class' field (instead of 'class'). (finish_method_def): Rename to objc_finish_method_definition() and add a function decl parameter; move method encoding call from objc_expand_function_end(). (is_complex_decl, adorn_decl, gen_declarator, gen_declspecs, gen_declaration_1): Remove functions. (tmpbuf, RAW_DECLSPEC): Remove. (gen_declaration): Remove second parameter; simplify to deal with TYPE_P nodes instead of raw declspecs. (gen_type_name, gen_type_name_0): New functions. (gen_method_decl): Remove second parameter; call gen_type_name() instead of gen_declaration_1(). (dump_interface): Adjust calls to gen_declaration() and gen_method_decl(); do not allocate a separate string buffer. (init_objc): Allocate a larger string buffer to accommodate dump_interface(); adjust call to build_module_descriptor(); add call to build_module_initializer_routine() for the GNU runtime. (generate_classref_translation_entry): Do not call start_decl(); call finish_var_decl() instead of finish_decl(); call convert() instead of build_c_cast(). * objc-act.h (CLASS_OWN_IVARS): Remove accessor. (CLASS_BINFO_ELTS): Reduce from 6 to 5, now that CLASS_OWN_IVARS is gone. (OCTI_GNU_INIT_DECL, GNU_INIT_decl): New. (OCTI_ELLIPSIS_NODE, objc_ellipsis_node): Remove. (OCTI_ID_ID, id_type, objc_id_id): Rename to OCTI_ID_NAME, objc_object_type and objc_object_name, respectively. (OCTI_CLS_REF, OCTI_CLASS_NAME, objc_class_reference, objc_class_name): New. (IS_CLASS): New macro. (IS_ID, IS_SUPER): Robustify. (OCTI_EXECCLASS_DECL, execclass_decl): New. (finish_file, start_class, continue_class, finish_class, start_method_def, continue_method_def, finish_method_def, start_protocol, finish_protocol, objc_build_throw_stmt, objc_build_try_catch_finally_stmt, objc_build_synchronized_prologue, objc_build_synchronized_epilogue, objc_build_try_prologue, objc_build_try_epilogue, objc_build_catch_stmt, objc_build_catch_epilogue, objc_build_finally_prologue, objc_build_finally_epilogue, is_ivar, is_private, is_public, add_instance_variable, objc_add_method, get_super_receiver, objc_clear_super_receiver, get_class_ivars_from_name, get_class_reference, get_static_reference, get_object_reference, build_message_expr, finish_message_expr, build_selector_expr, build_ivar_reference, build_keyword_decl, build_method_decl, build_protocol_expr, build_objc_string_object, objc_declare_alias, objc_declare_class, objc_declare_protocols, objc_comptypes, objc_check_decl, build_encode_expr): Remove prototypes. (imp_count, cat_count): Make GGC-aware. (OBJC_SET_TYPE_NAME): New macro. From-SVN: r87168
2004-09-08 02:49:44 +02:00
tree rcv_p = (super_flag ? objc_super_type : objc_object_type);
/* If a prototype for the method to be called exists, then cast
the sender's return type and arguments to match that of the method.
Otherwise, leave sender as is. */
tree ret_type
= (method_prototype
Makefile.in (c-parse.o): Depend on $(C_COMMON_H). [gcc/ChangeLog] 2004-09-07 Ziemowit Laski <zlaski@apple.com> * Makefile.in (c-parse.o): Depend on $(C_COMMON_H). * c-parse.in: Include c-common.h instead of objc-act.h. (ivar_decl_list, ivar_decls, ivar_decl, ivars, ivar_declarator, myparms, myparm): Remove %type declarations. (methodtype, optparms, OBJC_TYPE_QUAL, objc_quals, objc_qual, objc_typename, objc_try_catch_stmt, optellipsis): Add %type declarations. (objc_inherit_code, objc_public_flag): Remove. (typespec_nonreserved_nonattr): Call objc_get_protocol_qualified_type() instead of get_static_reference() and get_protocol_reference(). (stmt_nocomp): Call grokparm() on @catch parameter. (objcdef): Move semantic action to objc_finish_implementation(). (classdef): Move semantic action to objc_start_class_interface(), objc_continue_interface(), objc_finish_interface(), objc_start_class_implementation(), objc_continue_implementation(), objc_start_category_interface() and objc_start_category_implementation(). (protocoldef): Move semantic actions to objc_start_protocol() and objc_finish_interface(). (ivar_decl_list): Remove nonterminal. (visibility_spec): Move semantic actions to objc_set_visibility(). (ivar_decls): Remove assignment to $$. (ivar_decl): Rephrase in terms of component_decl; call objc_add_instance_variable(). (ivars, ivar_declarator): Remove nonterminals. (opt_semi): New nonterminal. (methodtype): Remove semantic actions. (methoddef): Move semantic actions to objc_set_method_type(), objc_start_method_definition() and objc_finish_method_definition(). (methodproto): Move semantic actions to objc_set_method_type() and objc_add_method_declaration(). (methoddecl): Use objc_typename instead of typename; move semantic actions to objc_build_method_signature(). (optarglist, myxdecls, mydecl, myparms, myparm): Remove nonterminals. (optparmlist): Express in terms of optparms and optellipsis. (optparms, optellipsis, objc_qual, objc_quals, objc_typename): New nonterminals. (keyworddecl): Use objc_typename instead of typename. (rid_to_yy): Mark RID_IN, RID_OUT, RID_INOUT, RID_BYCOPY, RID_BYREF and RID_ONEWAY as returning OBJC_TYPE_QUAL to yyparse(). [gcc/objc/ChangeLog] 2004-09-07 Ziemowit Laski <zlaski@apple.com> * Make-lang.in (objc/objc-parse.o): Depend on $(C_COMMON_H) instead of objc/objc-act.h. (objc/objc-act.o): Depend on $(HASHTAB_H). * objc-act.c: Include hashtab.h; in ObjC++ mode, include cp-tree.h and objcp-decl.h instead of c-tree.h. (build_module_descriptor, get_class_ivars, synth_id_with_class_suffix, error_with_ivar, gen_method_decl, gen_declaration, setup_string_decl, build_protocol_template): Adjust prototypes. (build_module_initializer_routine, start_class, continue_class, finish_class, start_method_def, objc_start_function, start_protocol, build_method_decl, objc_add_method, add_instance_variable, build_ivar_reference, is_ivar, is_private, get_super_receiver, build_selector_table_decl, objc_push_parm, objc_get_parm_info, gen_type_name, gen_type_name_0, start_var_decl, finish_var_decl, create_field_decl): New prototypes. (objc_expand_function_end, comp_method_with_proto, objc_expr_last, gen_declaration_1, gen_declarator, is_complex_decl, adorn_decl, define_decl, create_builtin_decl, gen_declspecs): Remove prototypes. (TYPE_ID): Rename to OBJECT_TYPEDEF_NAME. (CLASS_TYPEDEF_NAME): New. (TAG_EXECCLASS): Change from a global variable to a #define. (TAG_RETURN_STRUCT): Delete. (TAG_GNUINIT): New, holds '__objc_gnu_init' name. (objc_inherit_code, objc_public_flag): New, moved from c-parse.in. (string_descriptor): New struct. (string_htab): New hash table. (string_hash, string_eq): New prototypes. (generate_struct_by_value_array): Call create_field_decl() instead of create_builtin_decl(). (objc_init): Do not initialize objc_ellipsis_node or TAG_EXECCLASS; In ObjC++ mode, call cxx_init() instead of c_objc_common_init(). (objc_finish_file): In ObjC++, call instantiate_pending_templates() and cp_finish_file(). (define_decl, get_static_reference, get_protocol_reference, create_builtin_decl): Remove functions. (objc_start_class_interface, objc_start_category_interface, objc_start_protocol, objc_continue_interface, objc_finish_interface, objc_start_class_implementation, objc_start_category_implementation, objc_continue_implementation, objc_finish_implementation, objc_set_visibility, objc_set_method_type, objc_build_method_signature, objc_add_method_declaration, objc_start_method_definition, objc_add_instance_variable, objc_get_protocol_qualified_type, create_field_decl, start_var_decl, finish_var_decl): New functions. (setup_string_decl): Simplify since it is only called once. (synth_module_prologue): Call build_class_template(); predefine 'id' and 'Class' as typedefs; rename 'temp_type' to 'type'; disable debug hooks for duration of function; fix GNU runtime messenger signatures to correspond to reality; forward-declare '__objc_exec_class' for the GNU runtime; call build_selector_table_decl(); in ObjC++ mode, generate 'extern "C" { ... }' wrappers around synthesized declarations; call build_protocol_template() and build_category_template(). (string_hash, string_eq): New functions. (objc_build_string_object): Check metaclass correctness only once; store string literals in hash table. (objc_build_constructor): Do not convert initializer elements; adjust for ObjC++ impedance mismatch. (build_objc_symtab_template): Call create_field_decl() instead of create_builtin_decl(). (init_objc_symtab): Add missing conversion to initializer element. (build_metadata_decl): Call start_var_decl() instead of define_decl(). (generate_objc_symtab_decl): Do not call build_category_template(); call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(). (build_module_descriptor): Call create_field_decl() instead of grokfield(); call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(); always mark module descriptor as used; move GNU runtime-specific functionality to build_module_initializer_routine(). (build_module_initializer_routine): New function, broken off of build_module_descriptor(). (objc_static_init_needed_p, objc_generate_static_init_call): New functions. (generate_static_references, generate_strings, build_selector_translation_table, generate_descriptor_table, generate_ivars_list, generate_dispatch_table, generate_category): Call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(); build a type directly instead of via groktypename(). (build_selector_reference_decl, build_selector_table_decl, build_class_reference_decl, build_protocol_reference, generate_objc_image_info): Call start_var_decl() instead of build_decl(). (build_selector_reference): For GNU runtime, do not call build_selector_reference_decl(). (build_selector, build_typed_selector_reference): Always convert result to the selector type. (add_objc_string): Cast return value to 'char *'. (build_method_prototype_template, build_selector_template, build_method_template): Use actual selector type for fields pointing to selectors. (finish_objc): For GNU runtime, call build_module_initializer_routine() after build_module_descriptor(). (generate_protocol_list, generate_shared_structures): Call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(); build a type directly instead of via groktypename(). (synth_id_with_class_suffix): Return a string. (get_arg_type_list): For instance methods, use the instance type for 'self'; do not call groktypename_in_parm_context(). (build_objc_string_decl): Squash redeclaration errors in ObjC++. (objc_is_class_name): Use OBJC_TYPE_NAME instead of TYPE_NAME; handle RECORD_TYPEs in ObjC as well as ObjC++. (objc_is_id): New function. (objc_is_object_ptr): Return the canonical type node. (objc_get_class_ivars): Simplify using get_class_ivars(). (get_class_ivars): Remove second parameter; create a fresh copy of the ivar list for each call; do not check for existence of super class. (objc_eh_runtime_type): Mark #ifndef OBJCPLUS. (objc_init_exceptions): When using SJLJ-style exceptions, require the use of '-fobjc-exceptions' flag; do not require it for DWARF-style exceptions. (objc_build_exc_ptr, next_sjlj_build_try_catch_finally): Use objc_object_type instead of objc_id_type. (objc_begin_catch_clause): Convert the incoming PARM_DECL into a VAR_DECL before placing it in the appropriate scope; do not call define_decl(); adjust call to c_begin_compound_stmt(); use objc_object_type instead of objc_id_type. (build_next_objc_exception_stuff): Call create_field_decl() instead of create_builtin_decl(); construct type directly instead of calling groktypename(); use OBJC_VOID_AT_END to mark end of function parameters. (build_private_template): Adjust call to get_class_ivars(); build a type directly instead of via groktypename(). (build_protocol_template, build_method_prototype_list_template, build_method_prototype_template, build_category_template, build_selector_template, build_class_template, build_super_template, build_ivar_template, build_ivar_list_template, build_method_list_template, build_method_template): Call create_field_decl() instead of grokfield(). (objc_method_parm_type): Do not call groktypename(). (generate_descriptor_table): Call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(). (generate_method_descriptors, build_protocol_initializer, generate_dispatch_tables, build_category_initializer, build_shared_structure_initializer): Do not call groktypename(). (generate_protocols): Call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(); do not call groktypename(). (error_with_ivar): Remove last parameter. (check_ivars): Do not iterate ovar CLASS_RAW_IVARS lists in addition to CLASS_IVARS lists; adjust calls to error_with_ivar(). (generate_ivar_lists): Convert one of the initializer elements; do not call groktypename(). (get_arg_type_list, start_method_def, gen_method_def): Account for new representation of variable arguments and '...' in Objective-C methods; add Objective-C++ impedance matching code. (is_objc_type_qualifier): Remove function. (adjust_type_for_id_default): Simplify; there is no longer a need to wade through declspecs. (lookup_interface, start_class, continue_class, finish_class, start_method_def, start_protocol, build_method_decl, objc_add_method, add_instance_variable, build_ivar_reference, is_ivar, is_private, get_super_receiver, objc_build_finally_epilogue): Make into static functions. (receiver_is_class_object): Use new IS_CLASS() macro. (objc_build_message_expr): Tweak ObjC++ message argument handling; call objc_finish_message_expr() instead of finish_message_expr(). (finish_message_expr): Rename to objc_finish_message_expr(); use OBJC_TYPE_NAME and OBJC_SET_TYPE_NAME macros instead of TYPE_NAME. call gen_type_name() instead of gen_declaration(); call objc_is_id() instead of using IS_ID and IS_CLASS; Use objc_class_name instead of calling get_identifier("Class"); handle CONVERT_EXPRs in receiver. (build_objc_method_call, warn_with_method): Do not call groktypename(). (build_ivar_reference): Call convert() instead of clobbering in a type. (hash_init): Initialize string_htab hash table. (add_instance_variable): Simplify parameter list; do not call grokfield(); do not populate CLASS_IVARS list. (start_class): Check for the existence of super class, if one was specified. (continue_class): Use CLASS_RAW_IVARS rather than CLASS_IVARS; do not call build_class_template(); adjust call to get_class_ivars(); call build_decl(), pushdecl() and finish_decl() instead of define_decl(). (finish_class): Call build_decl(), pushdecl() and finish_decl() instead of define_decl(). (add_protocols): Use PROTOCOL_BINFO_ELTS for the tree vector size. (start_protocol): Do not call build_protocol_template(); use PROTOCOL_BINFO_ELTS for the tree vector size. (encode_type_qualifiers): Do not handle the 'const' qualifier here. (encode_pointer): Encode 'const char *' as 'r*', for backwards compatibility. (encode_array): Use HOST_WIDE_INT_PRINT_DEC instead of "%ld". (encode_type): Handle the 'const' qualifier here. (objc_parmlist): New global variable, sued by objc_push_parm and objc_get_parm_info(). (objc_push_parm, objc_get_parm_info): New functions. (objc_expr_last): Remove function. (synth_self_and_ucmd_args): For instance methods, use the instance type for 'self'; call objc_push_parm() instead of push_parm_decl(). (start_method_def): Do not call push_scope(), declare_parm_level(), pop_scope(), push_parm_decl(), store_parm_decls() or objc_expr_last(); just use objc_push_parm() and objc_get_parm_info(). (comp_method_with_proto): Remove function. (objc_types_are_equivalent): Strip away indirections before comparing underlying types. (comp_proto_with_proto): Do not call groktypename(); types are no longer in raw declspec format. (objc_start_function): New function. (really_start_method): Call comp_proto_with_proto() instead of comp_method_with_proto(); call objc_start_function() instead of hand-crafting a function declarator. (continue_method_def, objc_expand_function_end): Remove functions. (get_super_receiver): Call objc_get_current_scope() instead of get_current_scope(); reference 'super_class' field (instead of 'class'). (finish_method_def): Rename to objc_finish_method_definition() and add a function decl parameter; move method encoding call from objc_expand_function_end(). (is_complex_decl, adorn_decl, gen_declarator, gen_declspecs, gen_declaration_1): Remove functions. (tmpbuf, RAW_DECLSPEC): Remove. (gen_declaration): Remove second parameter; simplify to deal with TYPE_P nodes instead of raw declspecs. (gen_type_name, gen_type_name_0): New functions. (gen_method_decl): Remove second parameter; call gen_type_name() instead of gen_declaration_1(). (dump_interface): Adjust calls to gen_declaration() and gen_method_decl(); do not allocate a separate string buffer. (init_objc): Allocate a larger string buffer to accommodate dump_interface(); adjust call to build_module_descriptor(); add call to build_module_initializer_routine() for the GNU runtime. (generate_classref_translation_entry): Do not call start_decl(); call finish_var_decl() instead of finish_decl(); call convert() instead of build_c_cast(). * objc-act.h (CLASS_OWN_IVARS): Remove accessor. (CLASS_BINFO_ELTS): Reduce from 6 to 5, now that CLASS_OWN_IVARS is gone. (OCTI_GNU_INIT_DECL, GNU_INIT_decl): New. (OCTI_ELLIPSIS_NODE, objc_ellipsis_node): Remove. (OCTI_ID_ID, id_type, objc_id_id): Rename to OCTI_ID_NAME, objc_object_type and objc_object_name, respectively. (OCTI_CLS_REF, OCTI_CLASS_NAME, objc_class_reference, objc_class_name): New. (IS_CLASS): New macro. (IS_ID, IS_SUPER): Robustify. (OCTI_EXECCLASS_DECL, execclass_decl): New. (finish_file, start_class, continue_class, finish_class, start_method_def, continue_method_def, finish_method_def, start_protocol, finish_protocol, objc_build_throw_stmt, objc_build_try_catch_finally_stmt, objc_build_synchronized_prologue, objc_build_synchronized_epilogue, objc_build_try_prologue, objc_build_try_epilogue, objc_build_catch_stmt, objc_build_catch_epilogue, objc_build_finally_prologue, objc_build_finally_epilogue, is_ivar, is_private, is_public, add_instance_variable, objc_add_method, get_super_receiver, objc_clear_super_receiver, get_class_ivars_from_name, get_class_reference, get_static_reference, get_object_reference, build_message_expr, finish_message_expr, build_selector_expr, build_ivar_reference, build_keyword_decl, build_method_decl, build_protocol_expr, build_objc_string_object, objc_declare_alias, objc_declare_class, objc_declare_protocols, objc_comptypes, objc_check_decl, build_encode_expr): Remove prototypes. (imp_count, cat_count): Make GGC-aware. (OBJC_SET_TYPE_NAME): New macro. From-SVN: r87168
2004-09-08 02:49:44 +02:00
? TREE_VALUE (TREE_TYPE (method_prototype))
: objc_object_type);
tree sender_cast
= build_pointer_type
(build_function_type
(ret_type,
get_arg_type_list
(method_prototype, METHOD_REF, super_flag)));
tree method, t;
lookup_object = build_c_cast (rcv_p, lookup_object);
/* Use SAVE_EXPR to avoid evaluating the receiver twice. */
lookup_object = save_expr (lookup_object);
1992-01-18 00:15:38 +01:00
if (flag_next_runtime)
1992-01-18 00:15:38 +01:00
{
/* If we are returning a struct in memory, and the address
of that memory location is passed as a hidden first
argument, then change which messenger entry point this
expr will call. NB: Note that sender_cast remains
unchanged (it already has a struct return type). */
if (!targetm.calls.struct_value_rtx (0, 0)
&& (TREE_CODE (ret_type) == RECORD_TYPE
|| 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 : umsg_nonnil_stret_decl);
method_params = tree_cons (NULL_TREE, lookup_object,
tree_cons (NULL_TREE, selector,
method_params));
method = build_fold_addr_expr (sender);
1992-01-18 00:15:38 +01:00
}
else
{
/* This is the portable (GNU) way. */
tree object;
/* First, call the lookup function to get a pointer to the method,
then cast the pointer, then call it with the method arguments. */
object = (super_flag ? self_decl : lookup_object);
t = tree_cons (NULL_TREE, selector, NULL_TREE);
t = tree_cons (NULL_TREE, lookup_object, t);
method = build_function_call (sender, t);
/* Pass the object to the method. */
method_params = tree_cons (NULL_TREE, object,
tree_cons (NULL_TREE, selector,
method_params));
1992-01-18 00:15:38 +01:00
}
/* ??? Selector is not at this point something we can use inside
the compiler itself. Set it to garbage for the nonce. */
t = build3 (OBJ_TYPE_REF, sender_cast, method, lookup_object, size_zero_node);
return build_function_call (t, method_params);
}
static void
build_protocol_reference (tree p)
{
Makefile.in (c-parse.o): Depend on $(C_COMMON_H). [gcc/ChangeLog] 2004-09-07 Ziemowit Laski <zlaski@apple.com> * Makefile.in (c-parse.o): Depend on $(C_COMMON_H). * c-parse.in: Include c-common.h instead of objc-act.h. (ivar_decl_list, ivar_decls, ivar_decl, ivars, ivar_declarator, myparms, myparm): Remove %type declarations. (methodtype, optparms, OBJC_TYPE_QUAL, objc_quals, objc_qual, objc_typename, objc_try_catch_stmt, optellipsis): Add %type declarations. (objc_inherit_code, objc_public_flag): Remove. (typespec_nonreserved_nonattr): Call objc_get_protocol_qualified_type() instead of get_static_reference() and get_protocol_reference(). (stmt_nocomp): Call grokparm() on @catch parameter. (objcdef): Move semantic action to objc_finish_implementation(). (classdef): Move semantic action to objc_start_class_interface(), objc_continue_interface(), objc_finish_interface(), objc_start_class_implementation(), objc_continue_implementation(), objc_start_category_interface() and objc_start_category_implementation(). (protocoldef): Move semantic actions to objc_start_protocol() and objc_finish_interface(). (ivar_decl_list): Remove nonterminal. (visibility_spec): Move semantic actions to objc_set_visibility(). (ivar_decls): Remove assignment to $$. (ivar_decl): Rephrase in terms of component_decl; call objc_add_instance_variable(). (ivars, ivar_declarator): Remove nonterminals. (opt_semi): New nonterminal. (methodtype): Remove semantic actions. (methoddef): Move semantic actions to objc_set_method_type(), objc_start_method_definition() and objc_finish_method_definition(). (methodproto): Move semantic actions to objc_set_method_type() and objc_add_method_declaration(). (methoddecl): Use objc_typename instead of typename; move semantic actions to objc_build_method_signature(). (optarglist, myxdecls, mydecl, myparms, myparm): Remove nonterminals. (optparmlist): Express in terms of optparms and optellipsis. (optparms, optellipsis, objc_qual, objc_quals, objc_typename): New nonterminals. (keyworddecl): Use objc_typename instead of typename. (rid_to_yy): Mark RID_IN, RID_OUT, RID_INOUT, RID_BYCOPY, RID_BYREF and RID_ONEWAY as returning OBJC_TYPE_QUAL to yyparse(). [gcc/objc/ChangeLog] 2004-09-07 Ziemowit Laski <zlaski@apple.com> * Make-lang.in (objc/objc-parse.o): Depend on $(C_COMMON_H) instead of objc/objc-act.h. (objc/objc-act.o): Depend on $(HASHTAB_H). * objc-act.c: Include hashtab.h; in ObjC++ mode, include cp-tree.h and objcp-decl.h instead of c-tree.h. (build_module_descriptor, get_class_ivars, synth_id_with_class_suffix, error_with_ivar, gen_method_decl, gen_declaration, setup_string_decl, build_protocol_template): Adjust prototypes. (build_module_initializer_routine, start_class, continue_class, finish_class, start_method_def, objc_start_function, start_protocol, build_method_decl, objc_add_method, add_instance_variable, build_ivar_reference, is_ivar, is_private, get_super_receiver, build_selector_table_decl, objc_push_parm, objc_get_parm_info, gen_type_name, gen_type_name_0, start_var_decl, finish_var_decl, create_field_decl): New prototypes. (objc_expand_function_end, comp_method_with_proto, objc_expr_last, gen_declaration_1, gen_declarator, is_complex_decl, adorn_decl, define_decl, create_builtin_decl, gen_declspecs): Remove prototypes. (TYPE_ID): Rename to OBJECT_TYPEDEF_NAME. (CLASS_TYPEDEF_NAME): New. (TAG_EXECCLASS): Change from a global variable to a #define. (TAG_RETURN_STRUCT): Delete. (TAG_GNUINIT): New, holds '__objc_gnu_init' name. (objc_inherit_code, objc_public_flag): New, moved from c-parse.in. (string_descriptor): New struct. (string_htab): New hash table. (string_hash, string_eq): New prototypes. (generate_struct_by_value_array): Call create_field_decl() instead of create_builtin_decl(). (objc_init): Do not initialize objc_ellipsis_node or TAG_EXECCLASS; In ObjC++ mode, call cxx_init() instead of c_objc_common_init(). (objc_finish_file): In ObjC++, call instantiate_pending_templates() and cp_finish_file(). (define_decl, get_static_reference, get_protocol_reference, create_builtin_decl): Remove functions. (objc_start_class_interface, objc_start_category_interface, objc_start_protocol, objc_continue_interface, objc_finish_interface, objc_start_class_implementation, objc_start_category_implementation, objc_continue_implementation, objc_finish_implementation, objc_set_visibility, objc_set_method_type, objc_build_method_signature, objc_add_method_declaration, objc_start_method_definition, objc_add_instance_variable, objc_get_protocol_qualified_type, create_field_decl, start_var_decl, finish_var_decl): New functions. (setup_string_decl): Simplify since it is only called once. (synth_module_prologue): Call build_class_template(); predefine 'id' and 'Class' as typedefs; rename 'temp_type' to 'type'; disable debug hooks for duration of function; fix GNU runtime messenger signatures to correspond to reality; forward-declare '__objc_exec_class' for the GNU runtime; call build_selector_table_decl(); in ObjC++ mode, generate 'extern "C" { ... }' wrappers around synthesized declarations; call build_protocol_template() and build_category_template(). (string_hash, string_eq): New functions. (objc_build_string_object): Check metaclass correctness only once; store string literals in hash table. (objc_build_constructor): Do not convert initializer elements; adjust for ObjC++ impedance mismatch. (build_objc_symtab_template): Call create_field_decl() instead of create_builtin_decl(). (init_objc_symtab): Add missing conversion to initializer element. (build_metadata_decl): Call start_var_decl() instead of define_decl(). (generate_objc_symtab_decl): Do not call build_category_template(); call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(). (build_module_descriptor): Call create_field_decl() instead of grokfield(); call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(); always mark module descriptor as used; move GNU runtime-specific functionality to build_module_initializer_routine(). (build_module_initializer_routine): New function, broken off of build_module_descriptor(). (objc_static_init_needed_p, objc_generate_static_init_call): New functions. (generate_static_references, generate_strings, build_selector_translation_table, generate_descriptor_table, generate_ivars_list, generate_dispatch_table, generate_category): Call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(); build a type directly instead of via groktypename(). (build_selector_reference_decl, build_selector_table_decl, build_class_reference_decl, build_protocol_reference, generate_objc_image_info): Call start_var_decl() instead of build_decl(). (build_selector_reference): For GNU runtime, do not call build_selector_reference_decl(). (build_selector, build_typed_selector_reference): Always convert result to the selector type. (add_objc_string): Cast return value to 'char *'. (build_method_prototype_template, build_selector_template, build_method_template): Use actual selector type for fields pointing to selectors. (finish_objc): For GNU runtime, call build_module_initializer_routine() after build_module_descriptor(). (generate_protocol_list, generate_shared_structures): Call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(); build a type directly instead of via groktypename(). (synth_id_with_class_suffix): Return a string. (get_arg_type_list): For instance methods, use the instance type for 'self'; do not call groktypename_in_parm_context(). (build_objc_string_decl): Squash redeclaration errors in ObjC++. (objc_is_class_name): Use OBJC_TYPE_NAME instead of TYPE_NAME; handle RECORD_TYPEs in ObjC as well as ObjC++. (objc_is_id): New function. (objc_is_object_ptr): Return the canonical type node. (objc_get_class_ivars): Simplify using get_class_ivars(). (get_class_ivars): Remove second parameter; create a fresh copy of the ivar list for each call; do not check for existence of super class. (objc_eh_runtime_type): Mark #ifndef OBJCPLUS. (objc_init_exceptions): When using SJLJ-style exceptions, require the use of '-fobjc-exceptions' flag; do not require it for DWARF-style exceptions. (objc_build_exc_ptr, next_sjlj_build_try_catch_finally): Use objc_object_type instead of objc_id_type. (objc_begin_catch_clause): Convert the incoming PARM_DECL into a VAR_DECL before placing it in the appropriate scope; do not call define_decl(); adjust call to c_begin_compound_stmt(); use objc_object_type instead of objc_id_type. (build_next_objc_exception_stuff): Call create_field_decl() instead of create_builtin_decl(); construct type directly instead of calling groktypename(); use OBJC_VOID_AT_END to mark end of function parameters. (build_private_template): Adjust call to get_class_ivars(); build a type directly instead of via groktypename(). (build_protocol_template, build_method_prototype_list_template, build_method_prototype_template, build_category_template, build_selector_template, build_class_template, build_super_template, build_ivar_template, build_ivar_list_template, build_method_list_template, build_method_template): Call create_field_decl() instead of grokfield(). (objc_method_parm_type): Do not call groktypename(). (generate_descriptor_table): Call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(). (generate_method_descriptors, build_protocol_initializer, generate_dispatch_tables, build_category_initializer, build_shared_structure_initializer): Do not call groktypename(). (generate_protocols): Call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(); do not call groktypename(). (error_with_ivar): Remove last parameter. (check_ivars): Do not iterate ovar CLASS_RAW_IVARS lists in addition to CLASS_IVARS lists; adjust calls to error_with_ivar(). (generate_ivar_lists): Convert one of the initializer elements; do not call groktypename(). (get_arg_type_list, start_method_def, gen_method_def): Account for new representation of variable arguments and '...' in Objective-C methods; add Objective-C++ impedance matching code. (is_objc_type_qualifier): Remove function. (adjust_type_for_id_default): Simplify; there is no longer a need to wade through declspecs. (lookup_interface, start_class, continue_class, finish_class, start_method_def, start_protocol, build_method_decl, objc_add_method, add_instance_variable, build_ivar_reference, is_ivar, is_private, get_super_receiver, objc_build_finally_epilogue): Make into static functions. (receiver_is_class_object): Use new IS_CLASS() macro. (objc_build_message_expr): Tweak ObjC++ message argument handling; call objc_finish_message_expr() instead of finish_message_expr(). (finish_message_expr): Rename to objc_finish_message_expr(); use OBJC_TYPE_NAME and OBJC_SET_TYPE_NAME macros instead of TYPE_NAME. call gen_type_name() instead of gen_declaration(); call objc_is_id() instead of using IS_ID and IS_CLASS; Use objc_class_name instead of calling get_identifier("Class"); handle CONVERT_EXPRs in receiver. (build_objc_method_call, warn_with_method): Do not call groktypename(). (build_ivar_reference): Call convert() instead of clobbering in a type. (hash_init): Initialize string_htab hash table. (add_instance_variable): Simplify parameter list; do not call grokfield(); do not populate CLASS_IVARS list. (start_class): Check for the existence of super class, if one was specified. (continue_class): Use CLASS_RAW_IVARS rather than CLASS_IVARS; do not call build_class_template(); adjust call to get_class_ivars(); call build_decl(), pushdecl() and finish_decl() instead of define_decl(). (finish_class): Call build_decl(), pushdecl() and finish_decl() instead of define_decl(). (add_protocols): Use PROTOCOL_BINFO_ELTS for the tree vector size. (start_protocol): Do not call build_protocol_template(); use PROTOCOL_BINFO_ELTS for the tree vector size. (encode_type_qualifiers): Do not handle the 'const' qualifier here. (encode_pointer): Encode 'const char *' as 'r*', for backwards compatibility. (encode_array): Use HOST_WIDE_INT_PRINT_DEC instead of "%ld". (encode_type): Handle the 'const' qualifier here. (objc_parmlist): New global variable, sued by objc_push_parm and objc_get_parm_info(). (objc_push_parm, objc_get_parm_info): New functions. (objc_expr_last): Remove function. (synth_self_and_ucmd_args): For instance methods, use the instance type for 'self'; call objc_push_parm() instead of push_parm_decl(). (start_method_def): Do not call push_scope(), declare_parm_level(), pop_scope(), push_parm_decl(), store_parm_decls() or objc_expr_last(); just use objc_push_parm() and objc_get_parm_info(). (comp_method_with_proto): Remove function. (objc_types_are_equivalent): Strip away indirections before comparing underlying types. (comp_proto_with_proto): Do not call groktypename(); types are no longer in raw declspec format. (objc_start_function): New function. (really_start_method): Call comp_proto_with_proto() instead of comp_method_with_proto(); call objc_start_function() instead of hand-crafting a function declarator. (continue_method_def, objc_expand_function_end): Remove functions. (get_super_receiver): Call objc_get_current_scope() instead of get_current_scope(); reference 'super_class' field (instead of 'class'). (finish_method_def): Rename to objc_finish_method_definition() and add a function decl parameter; move method encoding call from objc_expand_function_end(). (is_complex_decl, adorn_decl, gen_declarator, gen_declspecs, gen_declaration_1): Remove functions. (tmpbuf, RAW_DECLSPEC): Remove. (gen_declaration): Remove second parameter; simplify to deal with TYPE_P nodes instead of raw declspecs. (gen_type_name, gen_type_name_0): New functions. (gen_method_decl): Remove second parameter; call gen_type_name() instead of gen_declaration_1(). (dump_interface): Adjust calls to gen_declaration() and gen_method_decl(); do not allocate a separate string buffer. (init_objc): Allocate a larger string buffer to accommodate dump_interface(); adjust call to build_module_descriptor(); add call to build_module_initializer_routine() for the GNU runtime. (generate_classref_translation_entry): Do not call start_decl(); call finish_var_decl() instead of finish_decl(); call convert() instead of build_c_cast(). * objc-act.h (CLASS_OWN_IVARS): Remove accessor. (CLASS_BINFO_ELTS): Reduce from 6 to 5, now that CLASS_OWN_IVARS is gone. (OCTI_GNU_INIT_DECL, GNU_INIT_decl): New. (OCTI_ELLIPSIS_NODE, objc_ellipsis_node): Remove. (OCTI_ID_ID, id_type, objc_id_id): Rename to OCTI_ID_NAME, objc_object_type and objc_object_name, respectively. (OCTI_CLS_REF, OCTI_CLASS_NAME, objc_class_reference, objc_class_name): New. (IS_CLASS): New macro. (IS_ID, IS_SUPER): Robustify. (OCTI_EXECCLASS_DECL, execclass_decl): New. (finish_file, start_class, continue_class, finish_class, start_method_def, continue_method_def, finish_method_def, start_protocol, finish_protocol, objc_build_throw_stmt, objc_build_try_catch_finally_stmt, objc_build_synchronized_prologue, objc_build_synchronized_epilogue, objc_build_try_prologue, objc_build_try_epilogue, objc_build_catch_stmt, objc_build_catch_epilogue, objc_build_finally_prologue, objc_build_finally_epilogue, is_ivar, is_private, is_public, add_instance_variable, objc_add_method, get_super_receiver, objc_clear_super_receiver, get_class_ivars_from_name, get_class_reference, get_static_reference, get_object_reference, build_message_expr, finish_message_expr, build_selector_expr, build_ivar_reference, build_keyword_decl, build_method_decl, build_protocol_expr, build_objc_string_object, objc_declare_alias, objc_declare_class, objc_declare_protocols, objc_comptypes, objc_check_decl, build_encode_expr): Remove prototypes. (imp_count, cat_count): Make GGC-aware. (OBJC_SET_TYPE_NAME): New macro. From-SVN: r87168
2004-09-08 02:49:44 +02:00
tree decl;
const char *proto_name;
Makefile.in (c-parse.o): Depend on $(C_COMMON_H). [gcc/ChangeLog] 2004-09-07 Ziemowit Laski <zlaski@apple.com> * Makefile.in (c-parse.o): Depend on $(C_COMMON_H). * c-parse.in: Include c-common.h instead of objc-act.h. (ivar_decl_list, ivar_decls, ivar_decl, ivars, ivar_declarator, myparms, myparm): Remove %type declarations. (methodtype, optparms, OBJC_TYPE_QUAL, objc_quals, objc_qual, objc_typename, objc_try_catch_stmt, optellipsis): Add %type declarations. (objc_inherit_code, objc_public_flag): Remove. (typespec_nonreserved_nonattr): Call objc_get_protocol_qualified_type() instead of get_static_reference() and get_protocol_reference(). (stmt_nocomp): Call grokparm() on @catch parameter. (objcdef): Move semantic action to objc_finish_implementation(). (classdef): Move semantic action to objc_start_class_interface(), objc_continue_interface(), objc_finish_interface(), objc_start_class_implementation(), objc_continue_implementation(), objc_start_category_interface() and objc_start_category_implementation(). (protocoldef): Move semantic actions to objc_start_protocol() and objc_finish_interface(). (ivar_decl_list): Remove nonterminal. (visibility_spec): Move semantic actions to objc_set_visibility(). (ivar_decls): Remove assignment to $$. (ivar_decl): Rephrase in terms of component_decl; call objc_add_instance_variable(). (ivars, ivar_declarator): Remove nonterminals. (opt_semi): New nonterminal. (methodtype): Remove semantic actions. (methoddef): Move semantic actions to objc_set_method_type(), objc_start_method_definition() and objc_finish_method_definition(). (methodproto): Move semantic actions to objc_set_method_type() and objc_add_method_declaration(). (methoddecl): Use objc_typename instead of typename; move semantic actions to objc_build_method_signature(). (optarglist, myxdecls, mydecl, myparms, myparm): Remove nonterminals. (optparmlist): Express in terms of optparms and optellipsis. (optparms, optellipsis, objc_qual, objc_quals, objc_typename): New nonterminals. (keyworddecl): Use objc_typename instead of typename. (rid_to_yy): Mark RID_IN, RID_OUT, RID_INOUT, RID_BYCOPY, RID_BYREF and RID_ONEWAY as returning OBJC_TYPE_QUAL to yyparse(). [gcc/objc/ChangeLog] 2004-09-07 Ziemowit Laski <zlaski@apple.com> * Make-lang.in (objc/objc-parse.o): Depend on $(C_COMMON_H) instead of objc/objc-act.h. (objc/objc-act.o): Depend on $(HASHTAB_H). * objc-act.c: Include hashtab.h; in ObjC++ mode, include cp-tree.h and objcp-decl.h instead of c-tree.h. (build_module_descriptor, get_class_ivars, synth_id_with_class_suffix, error_with_ivar, gen_method_decl, gen_declaration, setup_string_decl, build_protocol_template): Adjust prototypes. (build_module_initializer_routine, start_class, continue_class, finish_class, start_method_def, objc_start_function, start_protocol, build_method_decl, objc_add_method, add_instance_variable, build_ivar_reference, is_ivar, is_private, get_super_receiver, build_selector_table_decl, objc_push_parm, objc_get_parm_info, gen_type_name, gen_type_name_0, start_var_decl, finish_var_decl, create_field_decl): New prototypes. (objc_expand_function_end, comp_method_with_proto, objc_expr_last, gen_declaration_1, gen_declarator, is_complex_decl, adorn_decl, define_decl, create_builtin_decl, gen_declspecs): Remove prototypes. (TYPE_ID): Rename to OBJECT_TYPEDEF_NAME. (CLASS_TYPEDEF_NAME): New. (TAG_EXECCLASS): Change from a global variable to a #define. (TAG_RETURN_STRUCT): Delete. (TAG_GNUINIT): New, holds '__objc_gnu_init' name. (objc_inherit_code, objc_public_flag): New, moved from c-parse.in. (string_descriptor): New struct. (string_htab): New hash table. (string_hash, string_eq): New prototypes. (generate_struct_by_value_array): Call create_field_decl() instead of create_builtin_decl(). (objc_init): Do not initialize objc_ellipsis_node or TAG_EXECCLASS; In ObjC++ mode, call cxx_init() instead of c_objc_common_init(). (objc_finish_file): In ObjC++, call instantiate_pending_templates() and cp_finish_file(). (define_decl, get_static_reference, get_protocol_reference, create_builtin_decl): Remove functions. (objc_start_class_interface, objc_start_category_interface, objc_start_protocol, objc_continue_interface, objc_finish_interface, objc_start_class_implementation, objc_start_category_implementation, objc_continue_implementation, objc_finish_implementation, objc_set_visibility, objc_set_method_type, objc_build_method_signature, objc_add_method_declaration, objc_start_method_definition, objc_add_instance_variable, objc_get_protocol_qualified_type, create_field_decl, start_var_decl, finish_var_decl): New functions. (setup_string_decl): Simplify since it is only called once. (synth_module_prologue): Call build_class_template(); predefine 'id' and 'Class' as typedefs; rename 'temp_type' to 'type'; disable debug hooks for duration of function; fix GNU runtime messenger signatures to correspond to reality; forward-declare '__objc_exec_class' for the GNU runtime; call build_selector_table_decl(); in ObjC++ mode, generate 'extern "C" { ... }' wrappers around synthesized declarations; call build_protocol_template() and build_category_template(). (string_hash, string_eq): New functions. (objc_build_string_object): Check metaclass correctness only once; store string literals in hash table. (objc_build_constructor): Do not convert initializer elements; adjust for ObjC++ impedance mismatch. (build_objc_symtab_template): Call create_field_decl() instead of create_builtin_decl(). (init_objc_symtab): Add missing conversion to initializer element. (build_metadata_decl): Call start_var_decl() instead of define_decl(). (generate_objc_symtab_decl): Do not call build_category_template(); call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(). (build_module_descriptor): Call create_field_decl() instead of grokfield(); call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(); always mark module descriptor as used; move GNU runtime-specific functionality to build_module_initializer_routine(). (build_module_initializer_routine): New function, broken off of build_module_descriptor(). (objc_static_init_needed_p, objc_generate_static_init_call): New functions. (generate_static_references, generate_strings, build_selector_translation_table, generate_descriptor_table, generate_ivars_list, generate_dispatch_table, generate_category): Call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(); build a type directly instead of via groktypename(). (build_selector_reference_decl, build_selector_table_decl, build_class_reference_decl, build_protocol_reference, generate_objc_image_info): Call start_var_decl() instead of build_decl(). (build_selector_reference): For GNU runtime, do not call build_selector_reference_decl(). (build_selector, build_typed_selector_reference): Always convert result to the selector type. (add_objc_string): Cast return value to 'char *'. (build_method_prototype_template, build_selector_template, build_method_template): Use actual selector type for fields pointing to selectors. (finish_objc): For GNU runtime, call build_module_initializer_routine() after build_module_descriptor(). (generate_protocol_list, generate_shared_structures): Call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(); build a type directly instead of via groktypename(). (synth_id_with_class_suffix): Return a string. (get_arg_type_list): For instance methods, use the instance type for 'self'; do not call groktypename_in_parm_context(). (build_objc_string_decl): Squash redeclaration errors in ObjC++. (objc_is_class_name): Use OBJC_TYPE_NAME instead of TYPE_NAME; handle RECORD_TYPEs in ObjC as well as ObjC++. (objc_is_id): New function. (objc_is_object_ptr): Return the canonical type node. (objc_get_class_ivars): Simplify using get_class_ivars(). (get_class_ivars): Remove second parameter; create a fresh copy of the ivar list for each call; do not check for existence of super class. (objc_eh_runtime_type): Mark #ifndef OBJCPLUS. (objc_init_exceptions): When using SJLJ-style exceptions, require the use of '-fobjc-exceptions' flag; do not require it for DWARF-style exceptions. (objc_build_exc_ptr, next_sjlj_build_try_catch_finally): Use objc_object_type instead of objc_id_type. (objc_begin_catch_clause): Convert the incoming PARM_DECL into a VAR_DECL before placing it in the appropriate scope; do not call define_decl(); adjust call to c_begin_compound_stmt(); use objc_object_type instead of objc_id_type. (build_next_objc_exception_stuff): Call create_field_decl() instead of create_builtin_decl(); construct type directly instead of calling groktypename(); use OBJC_VOID_AT_END to mark end of function parameters. (build_private_template): Adjust call to get_class_ivars(); build a type directly instead of via groktypename(). (build_protocol_template, build_method_prototype_list_template, build_method_prototype_template, build_category_template, build_selector_template, build_class_template, build_super_template, build_ivar_template, build_ivar_list_template, build_method_list_template, build_method_template): Call create_field_decl() instead of grokfield(). (objc_method_parm_type): Do not call groktypename(). (generate_descriptor_table): Call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(). (generate_method_descriptors, build_protocol_initializer, generate_dispatch_tables, build_category_initializer, build_shared_structure_initializer): Do not call groktypename(). (generate_protocols): Call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(); do not call groktypename(). (error_with_ivar): Remove last parameter. (check_ivars): Do not iterate ovar CLASS_RAW_IVARS lists in addition to CLASS_IVARS lists; adjust calls to error_with_ivar(). (generate_ivar_lists): Convert one of the initializer elements; do not call groktypename(). (get_arg_type_list, start_method_def, gen_method_def): Account for new representation of variable arguments and '...' in Objective-C methods; add Objective-C++ impedance matching code. (is_objc_type_qualifier): Remove function. (adjust_type_for_id_default): Simplify; there is no longer a need to wade through declspecs. (lookup_interface, start_class, continue_class, finish_class, start_method_def, start_protocol, build_method_decl, objc_add_method, add_instance_variable, build_ivar_reference, is_ivar, is_private, get_super_receiver, objc_build_finally_epilogue): Make into static functions. (receiver_is_class_object): Use new IS_CLASS() macro. (objc_build_message_expr): Tweak ObjC++ message argument handling; call objc_finish_message_expr() instead of finish_message_expr(). (finish_message_expr): Rename to objc_finish_message_expr(); use OBJC_TYPE_NAME and OBJC_SET_TYPE_NAME macros instead of TYPE_NAME. call gen_type_name() instead of gen_declaration(); call objc_is_id() instead of using IS_ID and IS_CLASS; Use objc_class_name instead of calling get_identifier("Class"); handle CONVERT_EXPRs in receiver. (build_objc_method_call, warn_with_method): Do not call groktypename(). (build_ivar_reference): Call convert() instead of clobbering in a type. (hash_init): Initialize string_htab hash table. (add_instance_variable): Simplify parameter list; do not call grokfield(); do not populate CLASS_IVARS list. (start_class): Check for the existence of super class, if one was specified. (continue_class): Use CLASS_RAW_IVARS rather than CLASS_IVARS; do not call build_class_template(); adjust call to get_class_ivars(); call build_decl(), pushdecl() and finish_decl() instead of define_decl(). (finish_class): Call build_decl(), pushdecl() and finish_decl() instead of define_decl(). (add_protocols): Use PROTOCOL_BINFO_ELTS for the tree vector size. (start_protocol): Do not call build_protocol_template(); use PROTOCOL_BINFO_ELTS for the tree vector size. (encode_type_qualifiers): Do not handle the 'const' qualifier here. (encode_pointer): Encode 'const char *' as 'r*', for backwards compatibility. (encode_array): Use HOST_WIDE_INT_PRINT_DEC instead of "%ld". (encode_type): Handle the 'const' qualifier here. (objc_parmlist): New global variable, sued by objc_push_parm and objc_get_parm_info(). (objc_push_parm, objc_get_parm_info): New functions. (objc_expr_last): Remove function. (synth_self_and_ucmd_args): For instance methods, use the instance type for 'self'; call objc_push_parm() instead of push_parm_decl(). (start_method_def): Do not call push_scope(), declare_parm_level(), pop_scope(), push_parm_decl(), store_parm_decls() or objc_expr_last(); just use objc_push_parm() and objc_get_parm_info(). (comp_method_with_proto): Remove function. (objc_types_are_equivalent): Strip away indirections before comparing underlying types. (comp_proto_with_proto): Do not call groktypename(); types are no longer in raw declspec format. (objc_start_function): New function. (really_start_method): Call comp_proto_with_proto() instead of comp_method_with_proto(); call objc_start_function() instead of hand-crafting a function declarator. (continue_method_def, objc_expand_function_end): Remove functions. (get_super_receiver): Call objc_get_current_scope() instead of get_current_scope(); reference 'super_class' field (instead of 'class'). (finish_method_def): Rename to objc_finish_method_definition() and add a function decl parameter; move method encoding call from objc_expand_function_end(). (is_complex_decl, adorn_decl, gen_declarator, gen_declspecs, gen_declaration_1): Remove functions. (tmpbuf, RAW_DECLSPEC): Remove. (gen_declaration): Remove second parameter; simplify to deal with TYPE_P nodes instead of raw declspecs. (gen_type_name, gen_type_name_0): New functions. (gen_method_decl): Remove second parameter; call gen_type_name() instead of gen_declaration_1(). (dump_interface): Adjust calls to gen_declaration() and gen_method_decl(); do not allocate a separate string buffer. (init_objc): Allocate a larger string buffer to accommodate dump_interface(); adjust call to build_module_descriptor(); add call to build_module_initializer_routine() for the GNU runtime. (generate_classref_translation_entry): Do not call start_decl(); call finish_var_decl() instead of finish_decl(); call convert() instead of build_c_cast(). * objc-act.h (CLASS_OWN_IVARS): Remove accessor. (CLASS_BINFO_ELTS): Reduce from 6 to 5, now that CLASS_OWN_IVARS is gone. (OCTI_GNU_INIT_DECL, GNU_INIT_decl): New. (OCTI_ELLIPSIS_NODE, objc_ellipsis_node): Remove. (OCTI_ID_ID, id_type, objc_id_id): Rename to OCTI_ID_NAME, objc_object_type and objc_object_name, respectively. (OCTI_CLS_REF, OCTI_CLASS_NAME, objc_class_reference, objc_class_name): New. (IS_CLASS): New macro. (IS_ID, IS_SUPER): Robustify. (OCTI_EXECCLASS_DECL, execclass_decl): New. (finish_file, start_class, continue_class, finish_class, start_method_def, continue_method_def, finish_method_def, start_protocol, finish_protocol, objc_build_throw_stmt, objc_build_try_catch_finally_stmt, objc_build_synchronized_prologue, objc_build_synchronized_epilogue, objc_build_try_prologue, objc_build_try_epilogue, objc_build_catch_stmt, objc_build_catch_epilogue, objc_build_finally_prologue, objc_build_finally_epilogue, is_ivar, is_private, is_public, add_instance_variable, objc_add_method, get_super_receiver, objc_clear_super_receiver, get_class_ivars_from_name, get_class_reference, get_static_reference, get_object_reference, build_message_expr, finish_message_expr, build_selector_expr, build_ivar_reference, build_keyword_decl, build_method_decl, build_protocol_expr, build_objc_string_object, objc_declare_alias, objc_declare_class, objc_declare_protocols, objc_comptypes, objc_check_decl, build_encode_expr): Remove prototypes. (imp_count, cat_count): Make GGC-aware. (OBJC_SET_TYPE_NAME): New macro. From-SVN: r87168
2004-09-08 02:49:44 +02:00
/* static struct _objc_protocol _OBJC_PROTOCOL_<mumble>; */
Makefile.in (c-parse.o): Depend on $(C_COMMON_H). [gcc/ChangeLog] 2004-09-07 Ziemowit Laski <zlaski@apple.com> * Makefile.in (c-parse.o): Depend on $(C_COMMON_H). * c-parse.in: Include c-common.h instead of objc-act.h. (ivar_decl_list, ivar_decls, ivar_decl, ivars, ivar_declarator, myparms, myparm): Remove %type declarations. (methodtype, optparms, OBJC_TYPE_QUAL, objc_quals, objc_qual, objc_typename, objc_try_catch_stmt, optellipsis): Add %type declarations. (objc_inherit_code, objc_public_flag): Remove. (typespec_nonreserved_nonattr): Call objc_get_protocol_qualified_type() instead of get_static_reference() and get_protocol_reference(). (stmt_nocomp): Call grokparm() on @catch parameter. (objcdef): Move semantic action to objc_finish_implementation(). (classdef): Move semantic action to objc_start_class_interface(), objc_continue_interface(), objc_finish_interface(), objc_start_class_implementation(), objc_continue_implementation(), objc_start_category_interface() and objc_start_category_implementation(). (protocoldef): Move semantic actions to objc_start_protocol() and objc_finish_interface(). (ivar_decl_list): Remove nonterminal. (visibility_spec): Move semantic actions to objc_set_visibility(). (ivar_decls): Remove assignment to $$. (ivar_decl): Rephrase in terms of component_decl; call objc_add_instance_variable(). (ivars, ivar_declarator): Remove nonterminals. (opt_semi): New nonterminal. (methodtype): Remove semantic actions. (methoddef): Move semantic actions to objc_set_method_type(), objc_start_method_definition() and objc_finish_method_definition(). (methodproto): Move semantic actions to objc_set_method_type() and objc_add_method_declaration(). (methoddecl): Use objc_typename instead of typename; move semantic actions to objc_build_method_signature(). (optarglist, myxdecls, mydecl, myparms, myparm): Remove nonterminals. (optparmlist): Express in terms of optparms and optellipsis. (optparms, optellipsis, objc_qual, objc_quals, objc_typename): New nonterminals. (keyworddecl): Use objc_typename instead of typename. (rid_to_yy): Mark RID_IN, RID_OUT, RID_INOUT, RID_BYCOPY, RID_BYREF and RID_ONEWAY as returning OBJC_TYPE_QUAL to yyparse(). [gcc/objc/ChangeLog] 2004-09-07 Ziemowit Laski <zlaski@apple.com> * Make-lang.in (objc/objc-parse.o): Depend on $(C_COMMON_H) instead of objc/objc-act.h. (objc/objc-act.o): Depend on $(HASHTAB_H). * objc-act.c: Include hashtab.h; in ObjC++ mode, include cp-tree.h and objcp-decl.h instead of c-tree.h. (build_module_descriptor, get_class_ivars, synth_id_with_class_suffix, error_with_ivar, gen_method_decl, gen_declaration, setup_string_decl, build_protocol_template): Adjust prototypes. (build_module_initializer_routine, start_class, continue_class, finish_class, start_method_def, objc_start_function, start_protocol, build_method_decl, objc_add_method, add_instance_variable, build_ivar_reference, is_ivar, is_private, get_super_receiver, build_selector_table_decl, objc_push_parm, objc_get_parm_info, gen_type_name, gen_type_name_0, start_var_decl, finish_var_decl, create_field_decl): New prototypes. (objc_expand_function_end, comp_method_with_proto, objc_expr_last, gen_declaration_1, gen_declarator, is_complex_decl, adorn_decl, define_decl, create_builtin_decl, gen_declspecs): Remove prototypes. (TYPE_ID): Rename to OBJECT_TYPEDEF_NAME. (CLASS_TYPEDEF_NAME): New. (TAG_EXECCLASS): Change from a global variable to a #define. (TAG_RETURN_STRUCT): Delete. (TAG_GNUINIT): New, holds '__objc_gnu_init' name. (objc_inherit_code, objc_public_flag): New, moved from c-parse.in. (string_descriptor): New struct. (string_htab): New hash table. (string_hash, string_eq): New prototypes. (generate_struct_by_value_array): Call create_field_decl() instead of create_builtin_decl(). (objc_init): Do not initialize objc_ellipsis_node or TAG_EXECCLASS; In ObjC++ mode, call cxx_init() instead of c_objc_common_init(). (objc_finish_file): In ObjC++, call instantiate_pending_templates() and cp_finish_file(). (define_decl, get_static_reference, get_protocol_reference, create_builtin_decl): Remove functions. (objc_start_class_interface, objc_start_category_interface, objc_start_protocol, objc_continue_interface, objc_finish_interface, objc_start_class_implementation, objc_start_category_implementation, objc_continue_implementation, objc_finish_implementation, objc_set_visibility, objc_set_method_type, objc_build_method_signature, objc_add_method_declaration, objc_start_method_definition, objc_add_instance_variable, objc_get_protocol_qualified_type, create_field_decl, start_var_decl, finish_var_decl): New functions. (setup_string_decl): Simplify since it is only called once. (synth_module_prologue): Call build_class_template(); predefine 'id' and 'Class' as typedefs; rename 'temp_type' to 'type'; disable debug hooks for duration of function; fix GNU runtime messenger signatures to correspond to reality; forward-declare '__objc_exec_class' for the GNU runtime; call build_selector_table_decl(); in ObjC++ mode, generate 'extern "C" { ... }' wrappers around synthesized declarations; call build_protocol_template() and build_category_template(). (string_hash, string_eq): New functions. (objc_build_string_object): Check metaclass correctness only once; store string literals in hash table. (objc_build_constructor): Do not convert initializer elements; adjust for ObjC++ impedance mismatch. (build_objc_symtab_template): Call create_field_decl() instead of create_builtin_decl(). (init_objc_symtab): Add missing conversion to initializer element. (build_metadata_decl): Call start_var_decl() instead of define_decl(). (generate_objc_symtab_decl): Do not call build_category_template(); call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(). (build_module_descriptor): Call create_field_decl() instead of grokfield(); call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(); always mark module descriptor as used; move GNU runtime-specific functionality to build_module_initializer_routine(). (build_module_initializer_routine): New function, broken off of build_module_descriptor(). (objc_static_init_needed_p, objc_generate_static_init_call): New functions. (generate_static_references, generate_strings, build_selector_translation_table, generate_descriptor_table, generate_ivars_list, generate_dispatch_table, generate_category): Call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(); build a type directly instead of via groktypename(). (build_selector_reference_decl, build_selector_table_decl, build_class_reference_decl, build_protocol_reference, generate_objc_image_info): Call start_var_decl() instead of build_decl(). (build_selector_reference): For GNU runtime, do not call build_selector_reference_decl(). (build_selector, build_typed_selector_reference): Always convert result to the selector type. (add_objc_string): Cast return value to 'char *'. (build_method_prototype_template, build_selector_template, build_method_template): Use actual selector type for fields pointing to selectors. (finish_objc): For GNU runtime, call build_module_initializer_routine() after build_module_descriptor(). (generate_protocol_list, generate_shared_structures): Call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(); build a type directly instead of via groktypename(). (synth_id_with_class_suffix): Return a string. (get_arg_type_list): For instance methods, use the instance type for 'self'; do not call groktypename_in_parm_context(). (build_objc_string_decl): Squash redeclaration errors in ObjC++. (objc_is_class_name): Use OBJC_TYPE_NAME instead of TYPE_NAME; handle RECORD_TYPEs in ObjC as well as ObjC++. (objc_is_id): New function. (objc_is_object_ptr): Return the canonical type node. (objc_get_class_ivars): Simplify using get_class_ivars(). (get_class_ivars): Remove second parameter; create a fresh copy of the ivar list for each call; do not check for existence of super class. (objc_eh_runtime_type): Mark #ifndef OBJCPLUS. (objc_init_exceptions): When using SJLJ-style exceptions, require the use of '-fobjc-exceptions' flag; do not require it for DWARF-style exceptions. (objc_build_exc_ptr, next_sjlj_build_try_catch_finally): Use objc_object_type instead of objc_id_type. (objc_begin_catch_clause): Convert the incoming PARM_DECL into a VAR_DECL before placing it in the appropriate scope; do not call define_decl(); adjust call to c_begin_compound_stmt(); use objc_object_type instead of objc_id_type. (build_next_objc_exception_stuff): Call create_field_decl() instead of create_builtin_decl(); construct type directly instead of calling groktypename(); use OBJC_VOID_AT_END to mark end of function parameters. (build_private_template): Adjust call to get_class_ivars(); build a type directly instead of via groktypename(). (build_protocol_template, build_method_prototype_list_template, build_method_prototype_template, build_category_template, build_selector_template, build_class_template, build_super_template, build_ivar_template, build_ivar_list_template, build_method_list_template, build_method_template): Call create_field_decl() instead of grokfield(). (objc_method_parm_type): Do not call groktypename(). (generate_descriptor_table): Call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(). (generate_method_descriptors, build_protocol_initializer, generate_dispatch_tables, build_category_initializer, build_shared_structure_initializer): Do not call groktypename(). (generate_protocols): Call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(); do not call groktypename(). (error_with_ivar): Remove last parameter. (check_ivars): Do not iterate ovar CLASS_RAW_IVARS lists in addition to CLASS_IVARS lists; adjust calls to error_with_ivar(). (generate_ivar_lists): Convert one of the initializer elements; do not call groktypename(). (get_arg_type_list, start_method_def, gen_method_def): Account for new representation of variable arguments and '...' in Objective-C methods; add Objective-C++ impedance matching code. (is_objc_type_qualifier): Remove function. (adjust_type_for_id_default): Simplify; there is no longer a need to wade through declspecs. (lookup_interface, start_class, continue_class, finish_class, start_method_def, start_protocol, build_method_decl, objc_add_method, add_instance_variable, build_ivar_reference, is_ivar, is_private, get_super_receiver, objc_build_finally_epilogue): Make into static functions. (receiver_is_class_object): Use new IS_CLASS() macro. (objc_build_message_expr): Tweak ObjC++ message argument handling; call objc_finish_message_expr() instead of finish_message_expr(). (finish_message_expr): Rename to objc_finish_message_expr(); use OBJC_TYPE_NAME and OBJC_SET_TYPE_NAME macros instead of TYPE_NAME. call gen_type_name() instead of gen_declaration(); call objc_is_id() instead of using IS_ID and IS_CLASS; Use objc_class_name instead of calling get_identifier("Class"); handle CONVERT_EXPRs in receiver. (build_objc_method_call, warn_with_method): Do not call groktypename(). (build_ivar_reference): Call convert() instead of clobbering in a type. (hash_init): Initialize string_htab hash table. (add_instance_variable): Simplify parameter list; do not call grokfield(); do not populate CLASS_IVARS list. (start_class): Check for the existence of super class, if one was specified. (continue_class): Use CLASS_RAW_IVARS rather than CLASS_IVARS; do not call build_class_template(); adjust call to get_class_ivars(); call build_decl(), pushdecl() and finish_decl() instead of define_decl(). (finish_class): Call build_decl(), pushdecl() and finish_decl() instead of define_decl(). (add_protocols): Use PROTOCOL_BINFO_ELTS for the tree vector size. (start_protocol): Do not call build_protocol_template(); use PROTOCOL_BINFO_ELTS for the tree vector size. (encode_type_qualifiers): Do not handle the 'const' qualifier here. (encode_pointer): Encode 'const char *' as 'r*', for backwards compatibility. (encode_array): Use HOST_WIDE_INT_PRINT_DEC instead of "%ld". (encode_type): Handle the 'const' qualifier here. (objc_parmlist): New global variable, sued by objc_push_parm and objc_get_parm_info(). (objc_push_parm, objc_get_parm_info): New functions. (objc_expr_last): Remove function. (synth_self_and_ucmd_args): For instance methods, use the instance type for 'self'; call objc_push_parm() instead of push_parm_decl(). (start_method_def): Do not call push_scope(), declare_parm_level(), pop_scope(), push_parm_decl(), store_parm_decls() or objc_expr_last(); just use objc_push_parm() and objc_get_parm_info(). (comp_method_with_proto): Remove function. (objc_types_are_equivalent): Strip away indirections before comparing underlying types. (comp_proto_with_proto): Do not call groktypename(); types are no longer in raw declspec format. (objc_start_function): New function. (really_start_method): Call comp_proto_with_proto() instead of comp_method_with_proto(); call objc_start_function() instead of hand-crafting a function declarator. (continue_method_def, objc_expand_function_end): Remove functions. (get_super_receiver): Call objc_get_current_scope() instead of get_current_scope(); reference 'super_class' field (instead of 'class'). (finish_method_def): Rename to objc_finish_method_definition() and add a function decl parameter; move method encoding call from objc_expand_function_end(). (is_complex_decl, adorn_decl, gen_declarator, gen_declspecs, gen_declaration_1): Remove functions. (tmpbuf, RAW_DECLSPEC): Remove. (gen_declaration): Remove second parameter; simplify to deal with TYPE_P nodes instead of raw declspecs. (gen_type_name, gen_type_name_0): New functions. (gen_method_decl): Remove second parameter; call gen_type_name() instead of gen_declaration_1(). (dump_interface): Adjust calls to gen_declaration() and gen_method_decl(); do not allocate a separate string buffer. (init_objc): Allocate a larger string buffer to accommodate dump_interface(); adjust call to build_module_descriptor(); add call to build_module_initializer_routine() for the GNU runtime. (generate_classref_translation_entry): Do not call start_decl(); call finish_var_decl() instead of finish_decl(); call convert() instead of build_c_cast(). * objc-act.h (CLASS_OWN_IVARS): Remove accessor. (CLASS_BINFO_ELTS): Reduce from 6 to 5, now that CLASS_OWN_IVARS is gone. (OCTI_GNU_INIT_DECL, GNU_INIT_decl): New. (OCTI_ELLIPSIS_NODE, objc_ellipsis_node): Remove. (OCTI_ID_ID, id_type, objc_id_id): Rename to OCTI_ID_NAME, objc_object_type and objc_object_name, respectively. (OCTI_CLS_REF, OCTI_CLASS_NAME, objc_class_reference, objc_class_name): New. (IS_CLASS): New macro. (IS_ID, IS_SUPER): Robustify. (OCTI_EXECCLASS_DECL, execclass_decl): New. (finish_file, start_class, continue_class, finish_class, start_method_def, continue_method_def, finish_method_def, start_protocol, finish_protocol, objc_build_throw_stmt, objc_build_try_catch_finally_stmt, objc_build_synchronized_prologue, objc_build_synchronized_epilogue, objc_build_try_prologue, objc_build_try_epilogue, objc_build_catch_stmt, objc_build_catch_epilogue, objc_build_finally_prologue, objc_build_finally_epilogue, is_ivar, is_private, is_public, add_instance_variable, objc_add_method, get_super_receiver, objc_clear_super_receiver, get_class_ivars_from_name, get_class_reference, get_static_reference, get_object_reference, build_message_expr, finish_message_expr, build_selector_expr, build_ivar_reference, build_keyword_decl, build_method_decl, build_protocol_expr, build_objc_string_object, objc_declare_alias, objc_declare_class, objc_declare_protocols, objc_comptypes, objc_check_decl, build_encode_expr): Remove prototypes. (imp_count, cat_count): Make GGC-aware. (OBJC_SET_TYPE_NAME): New macro. From-SVN: r87168
2004-09-08 02:49:44 +02:00
proto_name = synth_id_with_class_suffix ("_OBJC_PROTOCOL", p);
decl = start_var_decl (objc_protocol_template, proto_name);
PROTOCOL_FORWARD_DECL (p) = decl;
}
/* This function is called by the parser when (and only when) a
@protocol() expression is found, in order to compile it. */
tree
c-parse.in (primary): Call objc_build_message_expr()... [gcc/ChangeLog] 2004-09-01 Ziemowit Laski <zlaski@apple.com> * c-parse.in (primary): Call objc_build_message_expr(), objc_build_selector_expr(), objc_build_protocol_expr(), objc_build_encode_expr() and objc_build_string_object() instead of build_message_expr(), build_selector_expr(), build_protocol_expr(), build_encode_expr() and build_objc_string_object(), respectively. (component_decl_list2): Call objc_get_class_ivars() instead of get_class_ivars_from_name(). (keyworddecl): Call objc_build_keyword_decl() instead of build_keyword_decl(). (receiver): Call objc_get_class_reference() instead of get_class_reference(). (reswords): Add blank line before @@ifobjc section, for clarity. [gcc/objc/ChangeLog] 2004-09-01 Ziemowit Laski <zlaski@apple.com> * objc-act.c (objc_check_decl): Use OBJC_TYPE_NAME macro instead of TYPE_NAME. (build_objc_string_object): Rename to objc_build_string_object(). (get_class_reference): Rename to objc_get_class_reference(). (get_class_ivars_from_name): Rename to objc_get_class_ivars(). (next_sjlj_build_catch_list, get_super_receiver): Call objc_get_class_reference() instead of get_class_reference(). (build_keyword_decl): Rename to objc_build_keyword_decl(). (build_message_expr): Rename to objc_build_message_expr(). (build_protocol_expr): Rename to objc_build_protocol_expr(). (build_selector_expr): Rename to objc_build_selector_expr(). (build_encode_expr): Rename to objc_build_encode_expr(). * objc-act.h (get_class_ivars_from_name): Rename prototype to objc_get_class_ivars(). (get_class_reference): Rename prototype to objc_get_class_reference(). (build_message_expr): Rename prototype to objc_build_message_expr(). (build_selector_expr): Rename prototype to objc_build_selector_expr(). (build_keyword_decl): Rename prototype to objc_build_keyword_decl(). (build_protocol_expr): Rename prototype to objc_build_prototype_expr(). (build_objc_string_object): Rename prototype to objc_build_string_object(). From-SVN: r86950
2004-09-02 02:36:18 +02:00
objc_build_protocol_expr (tree protoname)
{
tree expr;
tree p = lookup_protocol (protoname);
if (!p)
{
builtins.c, [...]: Avoid "`" as left quote, using "'" or %q, %< and %> as appropriate. * builtins.c, c-common.c, c-decl.c, c-format.c, c-format.h, c-parse.in, c-pch.c, c-pragma.c, collect2.c, final.c, gcc.c, gcov.c, opts.c, pretty-print.h, protoize.c, reg-stack.c, rtl.c, tlink.c, config/alpha/alpha.c, config/arc/arc.c, config/arm/arm.c, config/avr/avr.c, config/c4x/c4x.c, config/darwin.c, config/frv/frv.c, config/h8300/h8300.c, config/i386/i386.c, config/i386/winnt.c, config/ia64/ia64.c, config/ip2k/ip2k.c, config/iq2000/iq2000.c, config/m32r/m32r.c, config/m68hc11/m68hc11.c, config/m68k/m68k.c, config/m68k/m68k.h, config/mcore/mcore.c, config/mips/mips.c, config/mmix/mmix.c, config/ns32k/ns32k.c, config/rs6000/host-darwin.c, config/rs6000/rs6000.c, config/s390/s390.c, config/sh/sh.c, config/sh/symbian.c, config/stormy16/stormy16.c, config/v850/v850.c: Avoid "`" as left quote, using "'" or %q, %< and %> as appropriate. Use %' as apostrophe in diagnostics where applicable. Use %< and %> in place of '' quotes where applicable. Use %qs in place of %<%s%>. Consistently quote __builtin function names. ada: * misc.c (gnat_handle_option): Use %< and %> for quoting in warning message. cp: * call.c, class.c, decl.c, decl2.c, error.c, mangle.c, parser.c, pt.c, search.c, semantics.c, typeck.c: Use %q, %< and %> for quoting in diagnostics. * parser.c (cp_parser_sizeof_operand): Use '' instead of `' for quoting in printf format. * decl.c (duplicate_decls, start_decl): Use %qD instead of unquoted %D. objc: * objc-act.c: Use %q, %< and %> for quoting in diagnostics. testsuite: * gcc.dg/builtin-prefetch-1.c: Adjust expected messages. From-SVN: r90337
2004-11-09 11:13:30 +01:00
error ("cannot find protocol declaration for %qs",
IDENTIFIER_POINTER (protoname));
return error_mark_node;
1992-01-18 00:15:38 +01:00
}
if (!PROTOCOL_FORWARD_DECL (p))
build_protocol_reference (p);
expr = build_unary_op (ADDR_EXPR, PROTOCOL_FORWARD_DECL (p), 0);
objc-act.h (get_object_reference): Rename to get_protocol_reference. 2004-06-20 David Ayers <d.ayers@inode.at> * objc/objc-act.h (get_object_reference): Rename to get_protocol_reference. (super_type): Rename to objc_super_type. (selector_type): Rename to objc_selector_type. (id_type): Rename to objc_id_type. (instance_type): Rename to objc_instance_type. (protocol_type): Rename to objc_protocol_type. (IS_ID): Update reference to id_type. * objc/objc-act.c (get_object_reference): Rename to get_protocol_reference; add documentation; update references to id_type. (lookup_method_in_protocol_list): Rename class_meth to is_class; add documentation. (finish_message_expr): Rename is_class to class_tree. (synth_module_prologue, objc_is_object_ptr, objc_build_exc_ptr, next_sjlj_build_try_catch_finally, objc_begin_catch_clause, build_next_objc_exception_stuff, get_arg_type_list, build_objc_method_call): Update references to id_type. (synth_module_prologue, build_objc_symtab_template, build_selector_reference_decl, build_selector, build_selector_translation_table, build_typed_selector_reference, get_arg_type_list, synth_self_and_ucmd_args, get_arg_type_list, synth_self_and_ucmd_args): Update references to selector_type. (build_private_template, build_ivar_reference): Update references to instance_type. (synth_module_prologue, build_protocol_reference, build_protocol_expr, start_protocol): Update references to protocol_type. (synth_module_prologue, get_arg_type_list, build_objc_method_call): Update references to super_type. * c-parse.in: (typespec_nonreserved_nonattr): Update references to get_object_reference. * objc/objc-tree.def: Add C mode identifier sequence. From-SVN: r83425
2004-06-21 03:50:18 +02:00
/* ??? Ideally we'd build the reference with objc_protocol_type directly,
if we have it, rather than converting it here. */
objc-act.h (get_object_reference): Rename to get_protocol_reference. 2004-06-20 David Ayers <d.ayers@inode.at> * objc/objc-act.h (get_object_reference): Rename to get_protocol_reference. (super_type): Rename to objc_super_type. (selector_type): Rename to objc_selector_type. (id_type): Rename to objc_id_type. (instance_type): Rename to objc_instance_type. (protocol_type): Rename to objc_protocol_type. (IS_ID): Update reference to id_type. * objc/objc-act.c (get_object_reference): Rename to get_protocol_reference; add documentation; update references to id_type. (lookup_method_in_protocol_list): Rename class_meth to is_class; add documentation. (finish_message_expr): Rename is_class to class_tree. (synth_module_prologue, objc_is_object_ptr, objc_build_exc_ptr, next_sjlj_build_try_catch_finally, objc_begin_catch_clause, build_next_objc_exception_stuff, get_arg_type_list, build_objc_method_call): Update references to id_type. (synth_module_prologue, build_objc_symtab_template, build_selector_reference_decl, build_selector, build_selector_translation_table, build_typed_selector_reference, get_arg_type_list, synth_self_and_ucmd_args, get_arg_type_list, synth_self_and_ucmd_args): Update references to selector_type. (build_private_template, build_ivar_reference): Update references to instance_type. (synth_module_prologue, build_protocol_reference, build_protocol_expr, start_protocol): Update references to protocol_type. (synth_module_prologue, get_arg_type_list, build_objc_method_call): Update references to super_type. * c-parse.in: (typespec_nonreserved_nonattr): Update references to get_object_reference. * objc/objc-tree.def: Add C mode identifier sequence. From-SVN: r83425
2004-06-21 03:50:18 +02:00
expr = convert (objc_protocol_type, expr);
/* The @protocol() expression is being compiled into a pointer to a
statically allocated instance of the Protocol class. To become
usable at runtime, the 'isa' pointer of the instance need to be
fixed up at runtime by the runtime library, to point to the
actual 'Protocol' class. */
/* For the GNU runtime, put the static Protocol instance in the list
of statically allocated instances, so that we make sure that its
'isa' pointer is fixed up at runtime by the GNU runtime library
to point to the Protocol class (at runtime, when loading the
module, the GNU runtime library loops on the statically allocated
instances (as found in the defs field in objc_symtab) and fixups
all the 'isa' pointers of those objects). */
if (! flag_next_runtime)
{
/* This type is a struct containing the fields of a Protocol
objc-act.h (get_object_reference): Rename to get_protocol_reference. 2004-06-20 David Ayers <d.ayers@inode.at> * objc/objc-act.h (get_object_reference): Rename to get_protocol_reference. (super_type): Rename to objc_super_type. (selector_type): Rename to objc_selector_type. (id_type): Rename to objc_id_type. (instance_type): Rename to objc_instance_type. (protocol_type): Rename to objc_protocol_type. (IS_ID): Update reference to id_type. * objc/objc-act.c (get_object_reference): Rename to get_protocol_reference; add documentation; update references to id_type. (lookup_method_in_protocol_list): Rename class_meth to is_class; add documentation. (finish_message_expr): Rename is_class to class_tree. (synth_module_prologue, objc_is_object_ptr, objc_build_exc_ptr, next_sjlj_build_try_catch_finally, objc_begin_catch_clause, build_next_objc_exception_stuff, get_arg_type_list, build_objc_method_call): Update references to id_type. (synth_module_prologue, build_objc_symtab_template, build_selector_reference_decl, build_selector, build_selector_translation_table, build_typed_selector_reference, get_arg_type_list, synth_self_and_ucmd_args, get_arg_type_list, synth_self_and_ucmd_args): Update references to selector_type. (build_private_template, build_ivar_reference): Update references to instance_type. (synth_module_prologue, build_protocol_reference, build_protocol_expr, start_protocol): Update references to protocol_type. (synth_module_prologue, get_arg_type_list, build_objc_method_call): Update references to super_type. * c-parse.in: (typespec_nonreserved_nonattr): Update references to get_object_reference. * objc/objc-tree.def: Add C mode identifier sequence. From-SVN: r83425
2004-06-21 03:50:18 +02:00
object. (Cfr. objc_protocol_type instead is the type of a pointer
to such a struct). */
tree protocol_struct_type = xref_tag
(RECORD_TYPE, get_identifier (PROTOCOL_OBJECT_CLASS_NAME));
tree *chain;
/* Look for the list of Protocol statically allocated instances
to fixup at runtime. Create a new list to hold Protocol
statically allocated instances, if the list is not found. At
present there is only another list, holding NSConstantString
static instances to be fixed up at runtime. */
for (chain = &objc_static_instances;
*chain && TREE_VALUE (*chain) != protocol_struct_type;
chain = &TREE_CHAIN (*chain));
if (!*chain)
{
*chain = tree_cons (NULL_TREE, protocol_struct_type, NULL_TREE);
add_objc_string (OBJC_TYPE_NAME (protocol_struct_type),
class_names);
}
/* Add this statically allocated instance to the Protocol list. */
TREE_PURPOSE (*chain) = tree_cons (NULL_TREE,
PROTOCOL_FORWARD_DECL (p),
TREE_PURPOSE (*chain));
}
return expr;
1992-01-18 00:15:38 +01:00
}
/* This function is called by the parser when a @selector() expression
is found, in order to compile it. It is only called by the parser
and only to compile a @selector(). */
1992-01-18 00:15:38 +01:00
tree
c-parse.in (primary): Call objc_build_message_expr()... [gcc/ChangeLog] 2004-09-01 Ziemowit Laski <zlaski@apple.com> * c-parse.in (primary): Call objc_build_message_expr(), objc_build_selector_expr(), objc_build_protocol_expr(), objc_build_encode_expr() and objc_build_string_object() instead of build_message_expr(), build_selector_expr(), build_protocol_expr(), build_encode_expr() and build_objc_string_object(), respectively. (component_decl_list2): Call objc_get_class_ivars() instead of get_class_ivars_from_name(). (keyworddecl): Call objc_build_keyword_decl() instead of build_keyword_decl(). (receiver): Call objc_get_class_reference() instead of get_class_reference(). (reswords): Add blank line before @@ifobjc section, for clarity. [gcc/objc/ChangeLog] 2004-09-01 Ziemowit Laski <zlaski@apple.com> * objc-act.c (objc_check_decl): Use OBJC_TYPE_NAME macro instead of TYPE_NAME. (build_objc_string_object): Rename to objc_build_string_object(). (get_class_reference): Rename to objc_get_class_reference(). (get_class_ivars_from_name): Rename to objc_get_class_ivars(). (next_sjlj_build_catch_list, get_super_receiver): Call objc_get_class_reference() instead of get_class_reference(). (build_keyword_decl): Rename to objc_build_keyword_decl(). (build_message_expr): Rename to objc_build_message_expr(). (build_protocol_expr): Rename to objc_build_protocol_expr(). (build_selector_expr): Rename to objc_build_selector_expr(). (build_encode_expr): Rename to objc_build_encode_expr(). * objc-act.h (get_class_ivars_from_name): Rename prototype to objc_get_class_ivars(). (get_class_reference): Rename prototype to objc_get_class_reference(). (build_message_expr): Rename prototype to objc_build_message_expr(). (build_selector_expr): Rename prototype to objc_build_selector_expr(). (build_keyword_decl): Rename prototype to objc_build_keyword_decl(). (build_protocol_expr): Rename prototype to objc_build_prototype_expr(). (build_objc_string_object): Rename prototype to objc_build_string_object(). From-SVN: r86950
2004-09-02 02:36:18 +02:00
objc_build_selector_expr (tree selnamelist)
1992-01-18 00:15:38 +01:00
{
tree selname;
1996-07-04 00:07:53 +02:00
/* Obtain the full selector name. */
1992-01-18 00:15:38 +01:00
if (TREE_CODE (selnamelist) == IDENTIFIER_NODE)
1996-07-04 00:07:53 +02:00
/* A unary selector. */
1992-01-18 00:15:38 +01:00
selname = selnamelist;
else if (TREE_CODE (selnamelist) == TREE_LIST)
selname = build_keyword_selector (selnamelist);
else
abort ();
1992-01-18 00:15:38 +01:00
/* If we are required to check @selector() expressions as they
are found, check that the selector has been declared. */
if (warn_undeclared_selector)
{
/* Look the selector up in the list of all known class and
instance methods (up to this line) to check that the selector
exists. */
hash hsh;
/* First try with instance methods. */
hsh = hash_lookup (nst_method_hash_list, selname);
/* If not found, try with class methods. */
if (!hsh)
{
hsh = hash_lookup (cls_method_hash_list, selname);
}
/* If still not found, print out a warning. */
if (!hsh)
{
diagnostic.c (warning): Accept parameter to classify warning option. * diagnostic.c (warning): Accept parameter to classify warning option. (warning0): New, for when a pointer to an error() like function is needed. * errors.c (warning): Likewise. * errors.h (warning, warning0): Adjust prototypes. * toplev.h (warning, warning0): Likewise. * attribs.c, builtins.c, c-common.c, c-decl.c, c-format.c, c-gimplify.c, c-lex.c, c-objc-common.c, c-opts.c, c-parser.c, c-pragma.c, c-typeck.c, calls.c, cgraph.c, coverage.c, emit-rtl.c, fold-const.c, fortran/trans-decl.c, function.c, gcse.c, genautomata.c, haifa-sched.c, opts.c, passes.c, regclass.c, reload1.c, stmt.c, stor-layout.c, toplev.c, tree-cfg.c, tree-dump.c, tree-inline.c, tree-mudflap.c, tree-optimize.c, tree-ssa.c, tree.c, varasm.c: Adjust warning() callers. * config/alpha/alpha.c, config/arc/arc.c, config/arm/arm.c, config/avr/avr.c, config/bfin/bfin.c, config/c4x/c4x-c.c, config/c4x/c4x.c, config/cris/cris.c, config/darwin-c.c, config/darwin.c, config/darwin.h, config/h8300/h8300.c, config/i386/cygming.h, config/i386/djgpp.h, config/i386/i386.c, config/i386/winnt.c, config/ia64/ia64-c.c, config/ia64/ia64.c, config/ip2k/ip2k.c, config/m32r/m32r.c, config/m68hc11/m68hc11.c, config/m68k/m68k.c, config/mcore/mcore.c, config/mips/mips.c, config/mmix/mmix.c, config/ns32k/ns32k.c, config/pa/pa-hpux11.h, config/pa/pa.c, config/rs6000/aix43.h, config/rs6000/aix51.h, config/rs6000/aix52.h, config/rs6000/darwin.h, config/rs6000/rs6000-c.c, config/rs6000/rs6000.c, config/s390/s390.c, config/sh/sh.c, config/sh/sh.h, config/sh/symbian.c, config/sol2-c.c, config/sol2.c, config/stormy16/stormy16.c, config/v850/v850-c.c, config/v850/v850.c, config/xtensa/xtensa.c: Adjust warning() callers. * ada/misc.c: Adjust warning() callers. * cp/call.c, cp/class.c, cp/cvt.c, cp/decl.c, cp/decl2.c, cp/except.c, cp/friend.c, cp/init.c, cp/lex.c, cp/mangle.c, cp/method.c, cp/name-lookup.c, cp/parser.c, cp/repo.c, cp/rtti.c, cp/tree.c, cp/typeck.c, cp/typeck2.c: Adjust warning() callers. * fortran/trans-decl.c: Adjust warning() callers. * java/class.c, java/decl.c, java/expr.c, java/jcf-io.c, java/jcf-parse.c, java/jv-scan.c, java/parse.y: Adjust warning() callers. * objc/objc-act.c: Adjust warning() callers. * treelang/parse.y: Adjust warning() callers. From-SVN: r98633
2005-04-23 23:29:07 +02:00
warning (0, "undeclared selector %qs", IDENTIFIER_POINTER (selname));
}
}
if (flag_typed_selectors)
return build_typed_selector_reference (selname, 0);
else
return build_selector_reference (selname);
1992-01-18 00:15:38 +01:00
}
tree
c-parse.in (primary): Call objc_build_message_expr()... [gcc/ChangeLog] 2004-09-01 Ziemowit Laski <zlaski@apple.com> * c-parse.in (primary): Call objc_build_message_expr(), objc_build_selector_expr(), objc_build_protocol_expr(), objc_build_encode_expr() and objc_build_string_object() instead of build_message_expr(), build_selector_expr(), build_protocol_expr(), build_encode_expr() and build_objc_string_object(), respectively. (component_decl_list2): Call objc_get_class_ivars() instead of get_class_ivars_from_name(). (keyworddecl): Call objc_build_keyword_decl() instead of build_keyword_decl(). (receiver): Call objc_get_class_reference() instead of get_class_reference(). (reswords): Add blank line before @@ifobjc section, for clarity. [gcc/objc/ChangeLog] 2004-09-01 Ziemowit Laski <zlaski@apple.com> * objc-act.c (objc_check_decl): Use OBJC_TYPE_NAME macro instead of TYPE_NAME. (build_objc_string_object): Rename to objc_build_string_object(). (get_class_reference): Rename to objc_get_class_reference(). (get_class_ivars_from_name): Rename to objc_get_class_ivars(). (next_sjlj_build_catch_list, get_super_receiver): Call objc_get_class_reference() instead of get_class_reference(). (build_keyword_decl): Rename to objc_build_keyword_decl(). (build_message_expr): Rename to objc_build_message_expr(). (build_protocol_expr): Rename to objc_build_protocol_expr(). (build_selector_expr): Rename to objc_build_selector_expr(). (build_encode_expr): Rename to objc_build_encode_expr(). * objc-act.h (get_class_ivars_from_name): Rename prototype to objc_get_class_ivars(). (get_class_reference): Rename prototype to objc_get_class_reference(). (build_message_expr): Rename prototype to objc_build_message_expr(). (build_selector_expr): Rename prototype to objc_build_selector_expr(). (build_keyword_decl): Rename prototype to objc_build_keyword_decl(). (build_protocol_expr): Rename prototype to objc_build_prototype_expr(). (build_objc_string_object): Rename prototype to objc_build_string_object(). From-SVN: r86950
2004-09-02 02:36:18 +02:00
objc_build_encode_expr (tree type)
1992-01-18 00:15:38 +01:00
{
tree result;
const char *string;
encode_type (type, obstack_object_size (&util_obstack),
OBJC_ENCODE_INLINE_DEFS);
obstack_1grow (&util_obstack, 0); /* null terminate string */
string = obstack_finish (&util_obstack);
1992-01-18 00:15:38 +01:00
1996-07-04 00:07:53 +02:00
/* Synthesize a string that represents the encoded struct/union. */
result = my_build_string (strlen (string) + 1, string);
obstack_free (&util_obstack, util_firstobj);
return result;
1992-01-18 00:15:38 +01:00
}
Makefile.in (c-parse.o): Depend on $(C_COMMON_H). [gcc/ChangeLog] 2004-09-07 Ziemowit Laski <zlaski@apple.com> * Makefile.in (c-parse.o): Depend on $(C_COMMON_H). * c-parse.in: Include c-common.h instead of objc-act.h. (ivar_decl_list, ivar_decls, ivar_decl, ivars, ivar_declarator, myparms, myparm): Remove %type declarations. (methodtype, optparms, OBJC_TYPE_QUAL, objc_quals, objc_qual, objc_typename, objc_try_catch_stmt, optellipsis): Add %type declarations. (objc_inherit_code, objc_public_flag): Remove. (typespec_nonreserved_nonattr): Call objc_get_protocol_qualified_type() instead of get_static_reference() and get_protocol_reference(). (stmt_nocomp): Call grokparm() on @catch parameter. (objcdef): Move semantic action to objc_finish_implementation(). (classdef): Move semantic action to objc_start_class_interface(), objc_continue_interface(), objc_finish_interface(), objc_start_class_implementation(), objc_continue_implementation(), objc_start_category_interface() and objc_start_category_implementation(). (protocoldef): Move semantic actions to objc_start_protocol() and objc_finish_interface(). (ivar_decl_list): Remove nonterminal. (visibility_spec): Move semantic actions to objc_set_visibility(). (ivar_decls): Remove assignment to $$. (ivar_decl): Rephrase in terms of component_decl; call objc_add_instance_variable(). (ivars, ivar_declarator): Remove nonterminals. (opt_semi): New nonterminal. (methodtype): Remove semantic actions. (methoddef): Move semantic actions to objc_set_method_type(), objc_start_method_definition() and objc_finish_method_definition(). (methodproto): Move semantic actions to objc_set_method_type() and objc_add_method_declaration(). (methoddecl): Use objc_typename instead of typename; move semantic actions to objc_build_method_signature(). (optarglist, myxdecls, mydecl, myparms, myparm): Remove nonterminals. (optparmlist): Express in terms of optparms and optellipsis. (optparms, optellipsis, objc_qual, objc_quals, objc_typename): New nonterminals. (keyworddecl): Use objc_typename instead of typename. (rid_to_yy): Mark RID_IN, RID_OUT, RID_INOUT, RID_BYCOPY, RID_BYREF and RID_ONEWAY as returning OBJC_TYPE_QUAL to yyparse(). [gcc/objc/ChangeLog] 2004-09-07 Ziemowit Laski <zlaski@apple.com> * Make-lang.in (objc/objc-parse.o): Depend on $(C_COMMON_H) instead of objc/objc-act.h. (objc/objc-act.o): Depend on $(HASHTAB_H). * objc-act.c: Include hashtab.h; in ObjC++ mode, include cp-tree.h and objcp-decl.h instead of c-tree.h. (build_module_descriptor, get_class_ivars, synth_id_with_class_suffix, error_with_ivar, gen_method_decl, gen_declaration, setup_string_decl, build_protocol_template): Adjust prototypes. (build_module_initializer_routine, start_class, continue_class, finish_class, start_method_def, objc_start_function, start_protocol, build_method_decl, objc_add_method, add_instance_variable, build_ivar_reference, is_ivar, is_private, get_super_receiver, build_selector_table_decl, objc_push_parm, objc_get_parm_info, gen_type_name, gen_type_name_0, start_var_decl, finish_var_decl, create_field_decl): New prototypes. (objc_expand_function_end, comp_method_with_proto, objc_expr_last, gen_declaration_1, gen_declarator, is_complex_decl, adorn_decl, define_decl, create_builtin_decl, gen_declspecs): Remove prototypes. (TYPE_ID): Rename to OBJECT_TYPEDEF_NAME. (CLASS_TYPEDEF_NAME): New. (TAG_EXECCLASS): Change from a global variable to a #define. (TAG_RETURN_STRUCT): Delete. (TAG_GNUINIT): New, holds '__objc_gnu_init' name. (objc_inherit_code, objc_public_flag): New, moved from c-parse.in. (string_descriptor): New struct. (string_htab): New hash table. (string_hash, string_eq): New prototypes. (generate_struct_by_value_array): Call create_field_decl() instead of create_builtin_decl(). (objc_init): Do not initialize objc_ellipsis_node or TAG_EXECCLASS; In ObjC++ mode, call cxx_init() instead of c_objc_common_init(). (objc_finish_file): In ObjC++, call instantiate_pending_templates() and cp_finish_file(). (define_decl, get_static_reference, get_protocol_reference, create_builtin_decl): Remove functions. (objc_start_class_interface, objc_start_category_interface, objc_start_protocol, objc_continue_interface, objc_finish_interface, objc_start_class_implementation, objc_start_category_implementation, objc_continue_implementation, objc_finish_implementation, objc_set_visibility, objc_set_method_type, objc_build_method_signature, objc_add_method_declaration, objc_start_method_definition, objc_add_instance_variable, objc_get_protocol_qualified_type, create_field_decl, start_var_decl, finish_var_decl): New functions. (setup_string_decl): Simplify since it is only called once. (synth_module_prologue): Call build_class_template(); predefine 'id' and 'Class' as typedefs; rename 'temp_type' to 'type'; disable debug hooks for duration of function; fix GNU runtime messenger signatures to correspond to reality; forward-declare '__objc_exec_class' for the GNU runtime; call build_selector_table_decl(); in ObjC++ mode, generate 'extern "C" { ... }' wrappers around synthesized declarations; call build_protocol_template() and build_category_template(). (string_hash, string_eq): New functions. (objc_build_string_object): Check metaclass correctness only once; store string literals in hash table. (objc_build_constructor): Do not convert initializer elements; adjust for ObjC++ impedance mismatch. (build_objc_symtab_template): Call create_field_decl() instead of create_builtin_decl(). (init_objc_symtab): Add missing conversion to initializer element. (build_metadata_decl): Call start_var_decl() instead of define_decl(). (generate_objc_symtab_decl): Do not call build_category_template(); call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(). (build_module_descriptor): Call create_field_decl() instead of grokfield(); call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(); always mark module descriptor as used; move GNU runtime-specific functionality to build_module_initializer_routine(). (build_module_initializer_routine): New function, broken off of build_module_descriptor(). (objc_static_init_needed_p, objc_generate_static_init_call): New functions. (generate_static_references, generate_strings, build_selector_translation_table, generate_descriptor_table, generate_ivars_list, generate_dispatch_table, generate_category): Call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(); build a type directly instead of via groktypename(). (build_selector_reference_decl, build_selector_table_decl, build_class_reference_decl, build_protocol_reference, generate_objc_image_info): Call start_var_decl() instead of build_decl(). (build_selector_reference): For GNU runtime, do not call build_selector_reference_decl(). (build_selector, build_typed_selector_reference): Always convert result to the selector type. (add_objc_string): Cast return value to 'char *'. (build_method_prototype_template, build_selector_template, build_method_template): Use actual selector type for fields pointing to selectors. (finish_objc): For GNU runtime, call build_module_initializer_routine() after build_module_descriptor(). (generate_protocol_list, generate_shared_structures): Call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(); build a type directly instead of via groktypename(). (synth_id_with_class_suffix): Return a string. (get_arg_type_list): For instance methods, use the instance type for 'self'; do not call groktypename_in_parm_context(). (build_objc_string_decl): Squash redeclaration errors in ObjC++. (objc_is_class_name): Use OBJC_TYPE_NAME instead of TYPE_NAME; handle RECORD_TYPEs in ObjC as well as ObjC++. (objc_is_id): New function. (objc_is_object_ptr): Return the canonical type node. (objc_get_class_ivars): Simplify using get_class_ivars(). (get_class_ivars): Remove second parameter; create a fresh copy of the ivar list for each call; do not check for existence of super class. (objc_eh_runtime_type): Mark #ifndef OBJCPLUS. (objc_init_exceptions): When using SJLJ-style exceptions, require the use of '-fobjc-exceptions' flag; do not require it for DWARF-style exceptions. (objc_build_exc_ptr, next_sjlj_build_try_catch_finally): Use objc_object_type instead of objc_id_type. (objc_begin_catch_clause): Convert the incoming PARM_DECL into a VAR_DECL before placing it in the appropriate scope; do not call define_decl(); adjust call to c_begin_compound_stmt(); use objc_object_type instead of objc_id_type. (build_next_objc_exception_stuff): Call create_field_decl() instead of create_builtin_decl(); construct type directly instead of calling groktypename(); use OBJC_VOID_AT_END to mark end of function parameters. (build_private_template): Adjust call to get_class_ivars(); build a type directly instead of via groktypename(). (build_protocol_template, build_method_prototype_list_template, build_method_prototype_template, build_category_template, build_selector_template, build_class_template, build_super_template, build_ivar_template, build_ivar_list_template, build_method_list_template, build_method_template): Call create_field_decl() instead of grokfield(). (objc_method_parm_type): Do not call groktypename(). (generate_descriptor_table): Call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(). (generate_method_descriptors, build_protocol_initializer, generate_dispatch_tables, build_category_initializer, build_shared_structure_initializer): Do not call groktypename(). (generate_protocols): Call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(); do not call groktypename(). (error_with_ivar): Remove last parameter. (check_ivars): Do not iterate ovar CLASS_RAW_IVARS lists in addition to CLASS_IVARS lists; adjust calls to error_with_ivar(). (generate_ivar_lists): Convert one of the initializer elements; do not call groktypename(). (get_arg_type_list, start_method_def, gen_method_def): Account for new representation of variable arguments and '...' in Objective-C methods; add Objective-C++ impedance matching code. (is_objc_type_qualifier): Remove function. (adjust_type_for_id_default): Simplify; there is no longer a need to wade through declspecs. (lookup_interface, start_class, continue_class, finish_class, start_method_def, start_protocol, build_method_decl, objc_add_method, add_instance_variable, build_ivar_reference, is_ivar, is_private, get_super_receiver, objc_build_finally_epilogue): Make into static functions. (receiver_is_class_object): Use new IS_CLASS() macro. (objc_build_message_expr): Tweak ObjC++ message argument handling; call objc_finish_message_expr() instead of finish_message_expr(). (finish_message_expr): Rename to objc_finish_message_expr(); use OBJC_TYPE_NAME and OBJC_SET_TYPE_NAME macros instead of TYPE_NAME. call gen_type_name() instead of gen_declaration(); call objc_is_id() instead of using IS_ID and IS_CLASS; Use objc_class_name instead of calling get_identifier("Class"); handle CONVERT_EXPRs in receiver. (build_objc_method_call, warn_with_method): Do not call groktypename(). (build_ivar_reference): Call convert() instead of clobbering in a type. (hash_init): Initialize string_htab hash table. (add_instance_variable): Simplify parameter list; do not call grokfield(); do not populate CLASS_IVARS list. (start_class): Check for the existence of super class, if one was specified. (continue_class): Use CLASS_RAW_IVARS rather than CLASS_IVARS; do not call build_class_template(); adjust call to get_class_ivars(); call build_decl(), pushdecl() and finish_decl() instead of define_decl(). (finish_class): Call build_decl(), pushdecl() and finish_decl() instead of define_decl(). (add_protocols): Use PROTOCOL_BINFO_ELTS for the tree vector size. (start_protocol): Do not call build_protocol_template(); use PROTOCOL_BINFO_ELTS for the tree vector size. (encode_type_qualifiers): Do not handle the 'const' qualifier here. (encode_pointer): Encode 'const char *' as 'r*', for backwards compatibility. (encode_array): Use HOST_WIDE_INT_PRINT_DEC instead of "%ld". (encode_type): Handle the 'const' qualifier here. (objc_parmlist): New global variable, sued by objc_push_parm and objc_get_parm_info(). (objc_push_parm, objc_get_parm_info): New functions. (objc_expr_last): Remove function. (synth_self_and_ucmd_args): For instance methods, use the instance type for 'self'; call objc_push_parm() instead of push_parm_decl(). (start_method_def): Do not call push_scope(), declare_parm_level(), pop_scope(), push_parm_decl(), store_parm_decls() or objc_expr_last(); just use objc_push_parm() and objc_get_parm_info(). (comp_method_with_proto): Remove function. (objc_types_are_equivalent): Strip away indirections before comparing underlying types. (comp_proto_with_proto): Do not call groktypename(); types are no longer in raw declspec format. (objc_start_function): New function. (really_start_method): Call comp_proto_with_proto() instead of comp_method_with_proto(); call objc_start_function() instead of hand-crafting a function declarator. (continue_method_def, objc_expand_function_end): Remove functions. (get_super_receiver): Call objc_get_current_scope() instead of get_current_scope(); reference 'super_class' field (instead of 'class'). (finish_method_def): Rename to objc_finish_method_definition() and add a function decl parameter; move method encoding call from objc_expand_function_end(). (is_complex_decl, adorn_decl, gen_declarator, gen_declspecs, gen_declaration_1): Remove functions. (tmpbuf, RAW_DECLSPEC): Remove. (gen_declaration): Remove second parameter; simplify to deal with TYPE_P nodes instead of raw declspecs. (gen_type_name, gen_type_name_0): New functions. (gen_method_decl): Remove second parameter; call gen_type_name() instead of gen_declaration_1(). (dump_interface): Adjust calls to gen_declaration() and gen_method_decl(); do not allocate a separate string buffer. (init_objc): Allocate a larger string buffer to accommodate dump_interface(); adjust call to build_module_descriptor(); add call to build_module_initializer_routine() for the GNU runtime. (generate_classref_translation_entry): Do not call start_decl(); call finish_var_decl() instead of finish_decl(); call convert() instead of build_c_cast(). * objc-act.h (CLASS_OWN_IVARS): Remove accessor. (CLASS_BINFO_ELTS): Reduce from 6 to 5, now that CLASS_OWN_IVARS is gone. (OCTI_GNU_INIT_DECL, GNU_INIT_decl): New. (OCTI_ELLIPSIS_NODE, objc_ellipsis_node): Remove. (OCTI_ID_ID, id_type, objc_id_id): Rename to OCTI_ID_NAME, objc_object_type and objc_object_name, respectively. (OCTI_CLS_REF, OCTI_CLASS_NAME, objc_class_reference, objc_class_name): New. (IS_CLASS): New macro. (IS_ID, IS_SUPER): Robustify. (OCTI_EXECCLASS_DECL, execclass_decl): New. (finish_file, start_class, continue_class, finish_class, start_method_def, continue_method_def, finish_method_def, start_protocol, finish_protocol, objc_build_throw_stmt, objc_build_try_catch_finally_stmt, objc_build_synchronized_prologue, objc_build_synchronized_epilogue, objc_build_try_prologue, objc_build_try_epilogue, objc_build_catch_stmt, objc_build_catch_epilogue, objc_build_finally_prologue, objc_build_finally_epilogue, is_ivar, is_private, is_public, add_instance_variable, objc_add_method, get_super_receiver, objc_clear_super_receiver, get_class_ivars_from_name, get_class_reference, get_static_reference, get_object_reference, build_message_expr, finish_message_expr, build_selector_expr, build_ivar_reference, build_keyword_decl, build_method_decl, build_protocol_expr, build_objc_string_object, objc_declare_alias, objc_declare_class, objc_declare_protocols, objc_comptypes, objc_check_decl, build_encode_expr): Remove prototypes. (imp_count, cat_count): Make GGC-aware. (OBJC_SET_TYPE_NAME): New macro. From-SVN: r87168
2004-09-08 02:49:44 +02:00
static tree
build_ivar_reference (tree id)
1992-01-18 00:15:38 +01:00
{
c-parse.in (objc_inherit_code, [...]): Make static. 2001-10-03 Ziemowit Laski <zlaski@apple.com> * c-parse.in (objc_inherit_code, objc_pq_context, objc_public_flag): Make static. (objc_interface_context, objc_implementation_context, objc_method_context, objc_ivar_chain, objc_ivar_context): Move to global tree array in objc/objc-act.[ch]. (methoddef): Remove unnecessary code. * objc/objc-act.c: (hashed_attribute, hashed_entry, imp_entry): Hoist struct definitions to objc-act.h. (nst_method_hash_list, cls_method_hash_list, imp_list, imp_count, cat_count): Place declaration in objc-act.h. (objc_tree_index): Move enumeration to objc-act.h. (objc_global_trees): Place declaration and macro accessors in objc-act.h. (implementation_context): Remove duplicate; use objc_implementation_context instead: (method_context): Remove duplicate; use objc_method_context instead. (objc_ellipsis_node, objc_method_prototype_template, implemented_classes, function_type): Move global vars to objc_global_trees. (init_objc): Use LAST_BASE_TREE_CODE instead of LAST_CODE. (build_message_expr): Move actual construction of ObjC message send nodes to finish_message_expr. (finish_message_expr): New routine, contains code formerly in build_message_expr. * objc/objc-act.h (finish_message_expr): New prototype. (objc_ivar_chain, objc_method_context, objc_ellipsis_node): Remove declarations; these vars are now part of objc_global_trees. (objc_tree_index, objc_global_trees): Move definitions from objc-act.c. * objc/objc-tree.def: Update copyright info. From-SVN: r46000
2001-10-04 00:05:57 +02:00
if (TREE_CODE (objc_method_context) == CLASS_METHOD_DECL)
{
/* Historically, a class method that produced objects (factory
method) would assign `self' to the instance that it
allocated. This would effectively turn the class method into
an instance method. Following this assignment, the instance
variables could be accessed. That practice, while safe,
violates the simple rule that a class method should not refer
to an instance variable. It's better to catch the cases
where this is done unknowingly than to support the above
paradigm. */
diagnostic.c (warning): Accept parameter to classify warning option. * diagnostic.c (warning): Accept parameter to classify warning option. (warning0): New, for when a pointer to an error() like function is needed. * errors.c (warning): Likewise. * errors.h (warning, warning0): Adjust prototypes. * toplev.h (warning, warning0): Likewise. * attribs.c, builtins.c, c-common.c, c-decl.c, c-format.c, c-gimplify.c, c-lex.c, c-objc-common.c, c-opts.c, c-parser.c, c-pragma.c, c-typeck.c, calls.c, cgraph.c, coverage.c, emit-rtl.c, fold-const.c, fortran/trans-decl.c, function.c, gcse.c, genautomata.c, haifa-sched.c, opts.c, passes.c, regclass.c, reload1.c, stmt.c, stor-layout.c, toplev.c, tree-cfg.c, tree-dump.c, tree-inline.c, tree-mudflap.c, tree-optimize.c, tree-ssa.c, tree.c, varasm.c: Adjust warning() callers. * config/alpha/alpha.c, config/arc/arc.c, config/arm/arm.c, config/avr/avr.c, config/bfin/bfin.c, config/c4x/c4x-c.c, config/c4x/c4x.c, config/cris/cris.c, config/darwin-c.c, config/darwin.c, config/darwin.h, config/h8300/h8300.c, config/i386/cygming.h, config/i386/djgpp.h, config/i386/i386.c, config/i386/winnt.c, config/ia64/ia64-c.c, config/ia64/ia64.c, config/ip2k/ip2k.c, config/m32r/m32r.c, config/m68hc11/m68hc11.c, config/m68k/m68k.c, config/mcore/mcore.c, config/mips/mips.c, config/mmix/mmix.c, config/ns32k/ns32k.c, config/pa/pa-hpux11.h, config/pa/pa.c, config/rs6000/aix43.h, config/rs6000/aix51.h, config/rs6000/aix52.h, config/rs6000/darwin.h, config/rs6000/rs6000-c.c, config/rs6000/rs6000.c, config/s390/s390.c, config/sh/sh.c, config/sh/sh.h, config/sh/symbian.c, config/sol2-c.c, config/sol2.c, config/stormy16/stormy16.c, config/v850/v850-c.c, config/v850/v850.c, config/xtensa/xtensa.c: Adjust warning() callers. * ada/misc.c: Adjust warning() callers. * cp/call.c, cp/class.c, cp/cvt.c, cp/decl.c, cp/decl2.c, cp/except.c, cp/friend.c, cp/init.c, cp/lex.c, cp/mangle.c, cp/method.c, cp/name-lookup.c, cp/parser.c, cp/repo.c, cp/rtti.c, cp/tree.c, cp/typeck.c, cp/typeck2.c: Adjust warning() callers. * fortran/trans-decl.c: Adjust warning() callers. * java/class.c, java/decl.c, java/expr.c, java/jcf-io.c, java/jcf-parse.c, java/jv-scan.c, java/parse.y: Adjust warning() callers. * objc/objc-act.c: Adjust warning() callers. * treelang/parse.y: Adjust warning() callers. From-SVN: r98633
2005-04-23 23:29:07 +02:00
warning (0, "instance variable %qs accessed in class method",
IDENTIFIER_POINTER (id));
Makefile.in (c-parse.o): Depend on $(C_COMMON_H). [gcc/ChangeLog] 2004-09-07 Ziemowit Laski <zlaski@apple.com> * Makefile.in (c-parse.o): Depend on $(C_COMMON_H). * c-parse.in: Include c-common.h instead of objc-act.h. (ivar_decl_list, ivar_decls, ivar_decl, ivars, ivar_declarator, myparms, myparm): Remove %type declarations. (methodtype, optparms, OBJC_TYPE_QUAL, objc_quals, objc_qual, objc_typename, objc_try_catch_stmt, optellipsis): Add %type declarations. (objc_inherit_code, objc_public_flag): Remove. (typespec_nonreserved_nonattr): Call objc_get_protocol_qualified_type() instead of get_static_reference() and get_protocol_reference(). (stmt_nocomp): Call grokparm() on @catch parameter. (objcdef): Move semantic action to objc_finish_implementation(). (classdef): Move semantic action to objc_start_class_interface(), objc_continue_interface(), objc_finish_interface(), objc_start_class_implementation(), objc_continue_implementation(), objc_start_category_interface() and objc_start_category_implementation(). (protocoldef): Move semantic actions to objc_start_protocol() and objc_finish_interface(). (ivar_decl_list): Remove nonterminal. (visibility_spec): Move semantic actions to objc_set_visibility(). (ivar_decls): Remove assignment to $$. (ivar_decl): Rephrase in terms of component_decl; call objc_add_instance_variable(). (ivars, ivar_declarator): Remove nonterminals. (opt_semi): New nonterminal. (methodtype): Remove semantic actions. (methoddef): Move semantic actions to objc_set_method_type(), objc_start_method_definition() and objc_finish_method_definition(). (methodproto): Move semantic actions to objc_set_method_type() and objc_add_method_declaration(). (methoddecl): Use objc_typename instead of typename; move semantic actions to objc_build_method_signature(). (optarglist, myxdecls, mydecl, myparms, myparm): Remove nonterminals. (optparmlist): Express in terms of optparms and optellipsis. (optparms, optellipsis, objc_qual, objc_quals, objc_typename): New nonterminals. (keyworddecl): Use objc_typename instead of typename. (rid_to_yy): Mark RID_IN, RID_OUT, RID_INOUT, RID_BYCOPY, RID_BYREF and RID_ONEWAY as returning OBJC_TYPE_QUAL to yyparse(). [gcc/objc/ChangeLog] 2004-09-07 Ziemowit Laski <zlaski@apple.com> * Make-lang.in (objc/objc-parse.o): Depend on $(C_COMMON_H) instead of objc/objc-act.h. (objc/objc-act.o): Depend on $(HASHTAB_H). * objc-act.c: Include hashtab.h; in ObjC++ mode, include cp-tree.h and objcp-decl.h instead of c-tree.h. (build_module_descriptor, get_class_ivars, synth_id_with_class_suffix, error_with_ivar, gen_method_decl, gen_declaration, setup_string_decl, build_protocol_template): Adjust prototypes. (build_module_initializer_routine, start_class, continue_class, finish_class, start_method_def, objc_start_function, start_protocol, build_method_decl, objc_add_method, add_instance_variable, build_ivar_reference, is_ivar, is_private, get_super_receiver, build_selector_table_decl, objc_push_parm, objc_get_parm_info, gen_type_name, gen_type_name_0, start_var_decl, finish_var_decl, create_field_decl): New prototypes. (objc_expand_function_end, comp_method_with_proto, objc_expr_last, gen_declaration_1, gen_declarator, is_complex_decl, adorn_decl, define_decl, create_builtin_decl, gen_declspecs): Remove prototypes. (TYPE_ID): Rename to OBJECT_TYPEDEF_NAME. (CLASS_TYPEDEF_NAME): New. (TAG_EXECCLASS): Change from a global variable to a #define. (TAG_RETURN_STRUCT): Delete. (TAG_GNUINIT): New, holds '__objc_gnu_init' name. (objc_inherit_code, objc_public_flag): New, moved from c-parse.in. (string_descriptor): New struct. (string_htab): New hash table. (string_hash, string_eq): New prototypes. (generate_struct_by_value_array): Call create_field_decl() instead of create_builtin_decl(). (objc_init): Do not initialize objc_ellipsis_node or TAG_EXECCLASS; In ObjC++ mode, call cxx_init() instead of c_objc_common_init(). (objc_finish_file): In ObjC++, call instantiate_pending_templates() and cp_finish_file(). (define_decl, get_static_reference, get_protocol_reference, create_builtin_decl): Remove functions. (objc_start_class_interface, objc_start_category_interface, objc_start_protocol, objc_continue_interface, objc_finish_interface, objc_start_class_implementation, objc_start_category_implementation, objc_continue_implementation, objc_finish_implementation, objc_set_visibility, objc_set_method_type, objc_build_method_signature, objc_add_method_declaration, objc_start_method_definition, objc_add_instance_variable, objc_get_protocol_qualified_type, create_field_decl, start_var_decl, finish_var_decl): New functions. (setup_string_decl): Simplify since it is only called once. (synth_module_prologue): Call build_class_template(); predefine 'id' and 'Class' as typedefs; rename 'temp_type' to 'type'; disable debug hooks for duration of function; fix GNU runtime messenger signatures to correspond to reality; forward-declare '__objc_exec_class' for the GNU runtime; call build_selector_table_decl(); in ObjC++ mode, generate 'extern "C" { ... }' wrappers around synthesized declarations; call build_protocol_template() and build_category_template(). (string_hash, string_eq): New functions. (objc_build_string_object): Check metaclass correctness only once; store string literals in hash table. (objc_build_constructor): Do not convert initializer elements; adjust for ObjC++ impedance mismatch. (build_objc_symtab_template): Call create_field_decl() instead of create_builtin_decl(). (init_objc_symtab): Add missing conversion to initializer element. (build_metadata_decl): Call start_var_decl() instead of define_decl(). (generate_objc_symtab_decl): Do not call build_category_template(); call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(). (build_module_descriptor): Call create_field_decl() instead of grokfield(); call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(); always mark module descriptor as used; move GNU runtime-specific functionality to build_module_initializer_routine(). (build_module_initializer_routine): New function, broken off of build_module_descriptor(). (objc_static_init_needed_p, objc_generate_static_init_call): New functions. (generate_static_references, generate_strings, build_selector_translation_table, generate_descriptor_table, generate_ivars_list, generate_dispatch_table, generate_category): Call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(); build a type directly instead of via groktypename(). (build_selector_reference_decl, build_selector_table_decl, build_class_reference_decl, build_protocol_reference, generate_objc_image_info): Call start_var_decl() instead of build_decl(). (build_selector_reference): For GNU runtime, do not call build_selector_reference_decl(). (build_selector, build_typed_selector_reference): Always convert result to the selector type. (add_objc_string): Cast return value to 'char *'. (build_method_prototype_template, build_selector_template, build_method_template): Use actual selector type for fields pointing to selectors. (finish_objc): For GNU runtime, call build_module_initializer_routine() after build_module_descriptor(). (generate_protocol_list, generate_shared_structures): Call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(); build a type directly instead of via groktypename(). (synth_id_with_class_suffix): Return a string. (get_arg_type_list): For instance methods, use the instance type for 'self'; do not call groktypename_in_parm_context(). (build_objc_string_decl): Squash redeclaration errors in ObjC++. (objc_is_class_name): Use OBJC_TYPE_NAME instead of TYPE_NAME; handle RECORD_TYPEs in ObjC as well as ObjC++. (objc_is_id): New function. (objc_is_object_ptr): Return the canonical type node. (objc_get_class_ivars): Simplify using get_class_ivars(). (get_class_ivars): Remove second parameter; create a fresh copy of the ivar list for each call; do not check for existence of super class. (objc_eh_runtime_type): Mark #ifndef OBJCPLUS. (objc_init_exceptions): When using SJLJ-style exceptions, require the use of '-fobjc-exceptions' flag; do not require it for DWARF-style exceptions. (objc_build_exc_ptr, next_sjlj_build_try_catch_finally): Use objc_object_type instead of objc_id_type. (objc_begin_catch_clause): Convert the incoming PARM_DECL into a VAR_DECL before placing it in the appropriate scope; do not call define_decl(); adjust call to c_begin_compound_stmt(); use objc_object_type instead of objc_id_type. (build_next_objc_exception_stuff): Call create_field_decl() instead of create_builtin_decl(); construct type directly instead of calling groktypename(); use OBJC_VOID_AT_END to mark end of function parameters. (build_private_template): Adjust call to get_class_ivars(); build a type directly instead of via groktypename(). (build_protocol_template, build_method_prototype_list_template, build_method_prototype_template, build_category_template, build_selector_template, build_class_template, build_super_template, build_ivar_template, build_ivar_list_template, build_method_list_template, build_method_template): Call create_field_decl() instead of grokfield(). (objc_method_parm_type): Do not call groktypename(). (generate_descriptor_table): Call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(). (generate_method_descriptors, build_protocol_initializer, generate_dispatch_tables, build_category_initializer, build_shared_structure_initializer): Do not call groktypename(). (generate_protocols): Call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(); do not call groktypename(). (error_with_ivar): Remove last parameter. (check_ivars): Do not iterate ovar CLASS_RAW_IVARS lists in addition to CLASS_IVARS lists; adjust calls to error_with_ivar(). (generate_ivar_lists): Convert one of the initializer elements; do not call groktypename(). (get_arg_type_list, start_method_def, gen_method_def): Account for new representation of variable arguments and '...' in Objective-C methods; add Objective-C++ impedance matching code. (is_objc_type_qualifier): Remove function. (adjust_type_for_id_default): Simplify; there is no longer a need to wade through declspecs. (lookup_interface, start_class, continue_class, finish_class, start_method_def, start_protocol, build_method_decl, objc_add_method, add_instance_variable, build_ivar_reference, is_ivar, is_private, get_super_receiver, objc_build_finally_epilogue): Make into static functions. (receiver_is_class_object): Use new IS_CLASS() macro. (objc_build_message_expr): Tweak ObjC++ message argument handling; call objc_finish_message_expr() instead of finish_message_expr(). (finish_message_expr): Rename to objc_finish_message_expr(); use OBJC_TYPE_NAME and OBJC_SET_TYPE_NAME macros instead of TYPE_NAME. call gen_type_name() instead of gen_declaration(); call objc_is_id() instead of using IS_ID and IS_CLASS; Use objc_class_name instead of calling get_identifier("Class"); handle CONVERT_EXPRs in receiver. (build_objc_method_call, warn_with_method): Do not call groktypename(). (build_ivar_reference): Call convert() instead of clobbering in a type. (hash_init): Initialize string_htab hash table. (add_instance_variable): Simplify parameter list; do not call grokfield(); do not populate CLASS_IVARS list. (start_class): Check for the existence of super class, if one was specified. (continue_class): Use CLASS_RAW_IVARS rather than CLASS_IVARS; do not call build_class_template(); adjust call to get_class_ivars(); call build_decl(), pushdecl() and finish_decl() instead of define_decl(). (finish_class): Call build_decl(), pushdecl() and finish_decl() instead of define_decl(). (add_protocols): Use PROTOCOL_BINFO_ELTS for the tree vector size. (start_protocol): Do not call build_protocol_template(); use PROTOCOL_BINFO_ELTS for the tree vector size. (encode_type_qualifiers): Do not handle the 'const' qualifier here. (encode_pointer): Encode 'const char *' as 'r*', for backwards compatibility. (encode_array): Use HOST_WIDE_INT_PRINT_DEC instead of "%ld". (encode_type): Handle the 'const' qualifier here. (objc_parmlist): New global variable, sued by objc_push_parm and objc_get_parm_info(). (objc_push_parm, objc_get_parm_info): New functions. (objc_expr_last): Remove function. (synth_self_and_ucmd_args): For instance methods, use the instance type for 'self'; call objc_push_parm() instead of push_parm_decl(). (start_method_def): Do not call push_scope(), declare_parm_level(), pop_scope(), push_parm_decl(), store_parm_decls() or objc_expr_last(); just use objc_push_parm() and objc_get_parm_info(). (comp_method_with_proto): Remove function. (objc_types_are_equivalent): Strip away indirections before comparing underlying types. (comp_proto_with_proto): Do not call groktypename(); types are no longer in raw declspec format. (objc_start_function): New function. (really_start_method): Call comp_proto_with_proto() instead of comp_method_with_proto(); call objc_start_function() instead of hand-crafting a function declarator. (continue_method_def, objc_expand_function_end): Remove functions. (get_super_receiver): Call objc_get_current_scope() instead of get_current_scope(); reference 'super_class' field (instead of 'class'). (finish_method_def): Rename to objc_finish_method_definition() and add a function decl parameter; move method encoding call from objc_expand_function_end(). (is_complex_decl, adorn_decl, gen_declarator, gen_declspecs, gen_declaration_1): Remove functions. (tmpbuf, RAW_DECLSPEC): Remove. (gen_declaration): Remove second parameter; simplify to deal with TYPE_P nodes instead of raw declspecs. (gen_type_name, gen_type_name_0): New functions. (gen_method_decl): Remove second parameter; call gen_type_name() instead of gen_declaration_1(). (dump_interface): Adjust calls to gen_declaration() and gen_method_decl(); do not allocate a separate string buffer. (init_objc): Allocate a larger string buffer to accommodate dump_interface(); adjust call to build_module_descriptor(); add call to build_module_initializer_routine() for the GNU runtime. (generate_classref_translation_entry): Do not call start_decl(); call finish_var_decl() instead of finish_decl(); call convert() instead of build_c_cast(). * objc-act.h (CLASS_OWN_IVARS): Remove accessor. (CLASS_BINFO_ELTS): Reduce from 6 to 5, now that CLASS_OWN_IVARS is gone. (OCTI_GNU_INIT_DECL, GNU_INIT_decl): New. (OCTI_ELLIPSIS_NODE, objc_ellipsis_node): Remove. (OCTI_ID_ID, id_type, objc_id_id): Rename to OCTI_ID_NAME, objc_object_type and objc_object_name, respectively. (OCTI_CLS_REF, OCTI_CLASS_NAME, objc_class_reference, objc_class_name): New. (IS_CLASS): New macro. (IS_ID, IS_SUPER): Robustify. (OCTI_EXECCLASS_DECL, execclass_decl): New. (finish_file, start_class, continue_class, finish_class, start_method_def, continue_method_def, finish_method_def, start_protocol, finish_protocol, objc_build_throw_stmt, objc_build_try_catch_finally_stmt, objc_build_synchronized_prologue, objc_build_synchronized_epilogue, objc_build_try_prologue, objc_build_try_epilogue, objc_build_catch_stmt, objc_build_catch_epilogue, objc_build_finally_prologue, objc_build_finally_epilogue, is_ivar, is_private, is_public, add_instance_variable, objc_add_method, get_super_receiver, objc_clear_super_receiver, get_class_ivars_from_name, get_class_reference, get_static_reference, get_object_reference, build_message_expr, finish_message_expr, build_selector_expr, build_ivar_reference, build_keyword_decl, build_method_decl, build_protocol_expr, build_objc_string_object, objc_declare_alias, objc_declare_class, objc_declare_protocols, objc_comptypes, objc_check_decl, build_encode_expr): Remove prototypes. (imp_count, cat_count): Make GGC-aware. (OBJC_SET_TYPE_NAME): New macro. From-SVN: r87168
2004-09-08 02:49:44 +02:00
self_decl = convert (objc_instance_type, self_decl); /* cast */
}
1992-01-18 00:15:38 +01:00
objc-act.c (objc_build_struct): New function. * objc-act.c (objc_build_struct): New function. (objc_derived_from_p): Likewise. (objc_build_component_ref): Likewise. (objc_copy_binfo): Likewise. (objc_xref_basetypes): Likewise. (objc_lookup_protocol): Likewise. (objc_compare_protocols): Likewise. (objc_volatilize_decl): Likewise. (encode_aggregate_fields): Likewise. (volatilized_hash): Likewise. (volatilized_eq): Likewise. (objc_compare_types): Likewise. (objc_type_quals_match): Likewise. (DERIVED_FROM_P): New ObjC macro, corresponding to C++ macro of same name. (get_class_ivars): Add second parameter indicating if entire hierarchy is desired. (struct volatilized_type): New type. (volatilized_htab): New hash table. (objc_types_compatible_p, objc_comptypes): Remove functions. (synth_module_prologue): Do not initialize 'unused_list'. (objc_get_class_reference): Fix ObjC++ impedance mismatches. (objc_declare_alias): Implement as a typedef. (objc_substitute_decl, objc_gimplify_expr): Reformat. (objc_get_class_ivars): Adjust call to get_class_ivars(). (next_sjlj_build_enter_and_setjmp, synth_forward_declarations, build_ivar_reference, get_super_receiver): Call objc_build_component_ref() instead of build_component_ref(). (objc_begin_catch_clause): Use DERIVED_FROM_P() instead of objc_comptypes(). (build_private_template): Call objc_build_struct() instead of start_struct() and finish_struct(). (hash_init): Initialize volatilized_htab. (objc_is_public): Adjust calls to objc_get_ivars(); adjust ObjC++ impedance mismatches. (encode_aggregate_within): Streamline by calling encode_aggregate_fields(). * objc-act.h (objc_types_compatible_p): Remove prototype. (OCTI_UNUSED_LIST, unused_list): Remove slot. * objc-lang.c (LANG_HOOKS_TYPES_COMPATIBLE_P): Remove. From-SVN: r100123
2005-05-25 00:21:01 +02:00
return objc_build_component_ref (build_indirect_ref (self_decl, "->"), id);
1992-01-18 00:15:38 +01:00
}
/* Compute a hash value for a given method SEL_NAME. */
1992-01-18 00:15:38 +01:00
static size_t
hash_func (tree sel_name)
{
const unsigned char *s
= (const unsigned char *)IDENTIFIER_POINTER (sel_name);
size_t h = 0;
while (*s)
h = h * 67 + *s++ - 113;
return h;
}
1992-01-18 00:15:38 +01:00
static void
hash_init (void)
1992-01-18 00:15:38 +01:00
{
nst_method_hash_list
= (hash *) ggc_alloc_cleared (SIZEHASHTABLE * sizeof (hash));
cls_method_hash_list
= (hash *) ggc_alloc_cleared (SIZEHASHTABLE * sizeof (hash));
Makefile.in (c-parse.o): Depend on $(C_COMMON_H). [gcc/ChangeLog] 2004-09-07 Ziemowit Laski <zlaski@apple.com> * Makefile.in (c-parse.o): Depend on $(C_COMMON_H). * c-parse.in: Include c-common.h instead of objc-act.h. (ivar_decl_list, ivar_decls, ivar_decl, ivars, ivar_declarator, myparms, myparm): Remove %type declarations. (methodtype, optparms, OBJC_TYPE_QUAL, objc_quals, objc_qual, objc_typename, objc_try_catch_stmt, optellipsis): Add %type declarations. (objc_inherit_code, objc_public_flag): Remove. (typespec_nonreserved_nonattr): Call objc_get_protocol_qualified_type() instead of get_static_reference() and get_protocol_reference(). (stmt_nocomp): Call grokparm() on @catch parameter. (objcdef): Move semantic action to objc_finish_implementation(). (classdef): Move semantic action to objc_start_class_interface(), objc_continue_interface(), objc_finish_interface(), objc_start_class_implementation(), objc_continue_implementation(), objc_start_category_interface() and objc_start_category_implementation(). (protocoldef): Move semantic actions to objc_start_protocol() and objc_finish_interface(). (ivar_decl_list): Remove nonterminal. (visibility_spec): Move semantic actions to objc_set_visibility(). (ivar_decls): Remove assignment to $$. (ivar_decl): Rephrase in terms of component_decl; call objc_add_instance_variable(). (ivars, ivar_declarator): Remove nonterminals. (opt_semi): New nonterminal. (methodtype): Remove semantic actions. (methoddef): Move semantic actions to objc_set_method_type(), objc_start_method_definition() and objc_finish_method_definition(). (methodproto): Move semantic actions to objc_set_method_type() and objc_add_method_declaration(). (methoddecl): Use objc_typename instead of typename; move semantic actions to objc_build_method_signature(). (optarglist, myxdecls, mydecl, myparms, myparm): Remove nonterminals. (optparmlist): Express in terms of optparms and optellipsis. (optparms, optellipsis, objc_qual, objc_quals, objc_typename): New nonterminals. (keyworddecl): Use objc_typename instead of typename. (rid_to_yy): Mark RID_IN, RID_OUT, RID_INOUT, RID_BYCOPY, RID_BYREF and RID_ONEWAY as returning OBJC_TYPE_QUAL to yyparse(). [gcc/objc/ChangeLog] 2004-09-07 Ziemowit Laski <zlaski@apple.com> * Make-lang.in (objc/objc-parse.o): Depend on $(C_COMMON_H) instead of objc/objc-act.h. (objc/objc-act.o): Depend on $(HASHTAB_H). * objc-act.c: Include hashtab.h; in ObjC++ mode, include cp-tree.h and objcp-decl.h instead of c-tree.h. (build_module_descriptor, get_class_ivars, synth_id_with_class_suffix, error_with_ivar, gen_method_decl, gen_declaration, setup_string_decl, build_protocol_template): Adjust prototypes. (build_module_initializer_routine, start_class, continue_class, finish_class, start_method_def, objc_start_function, start_protocol, build_method_decl, objc_add_method, add_instance_variable, build_ivar_reference, is_ivar, is_private, get_super_receiver, build_selector_table_decl, objc_push_parm, objc_get_parm_info, gen_type_name, gen_type_name_0, start_var_decl, finish_var_decl, create_field_decl): New prototypes. (objc_expand_function_end, comp_method_with_proto, objc_expr_last, gen_declaration_1, gen_declarator, is_complex_decl, adorn_decl, define_decl, create_builtin_decl, gen_declspecs): Remove prototypes. (TYPE_ID): Rename to OBJECT_TYPEDEF_NAME. (CLASS_TYPEDEF_NAME): New. (TAG_EXECCLASS): Change from a global variable to a #define. (TAG_RETURN_STRUCT): Delete. (TAG_GNUINIT): New, holds '__objc_gnu_init' name. (objc_inherit_code, objc_public_flag): New, moved from c-parse.in. (string_descriptor): New struct. (string_htab): New hash table. (string_hash, string_eq): New prototypes. (generate_struct_by_value_array): Call create_field_decl() instead of create_builtin_decl(). (objc_init): Do not initialize objc_ellipsis_node or TAG_EXECCLASS; In ObjC++ mode, call cxx_init() instead of c_objc_common_init(). (objc_finish_file): In ObjC++, call instantiate_pending_templates() and cp_finish_file(). (define_decl, get_static_reference, get_protocol_reference, create_builtin_decl): Remove functions. (objc_start_class_interface, objc_start_category_interface, objc_start_protocol, objc_continue_interface, objc_finish_interface, objc_start_class_implementation, objc_start_category_implementation, objc_continue_implementation, objc_finish_implementation, objc_set_visibility, objc_set_method_type, objc_build_method_signature, objc_add_method_declaration, objc_start_method_definition, objc_add_instance_variable, objc_get_protocol_qualified_type, create_field_decl, start_var_decl, finish_var_decl): New functions. (setup_string_decl): Simplify since it is only called once. (synth_module_prologue): Call build_class_template(); predefine 'id' and 'Class' as typedefs; rename 'temp_type' to 'type'; disable debug hooks for duration of function; fix GNU runtime messenger signatures to correspond to reality; forward-declare '__objc_exec_class' for the GNU runtime; call build_selector_table_decl(); in ObjC++ mode, generate 'extern "C" { ... }' wrappers around synthesized declarations; call build_protocol_template() and build_category_template(). (string_hash, string_eq): New functions. (objc_build_string_object): Check metaclass correctness only once; store string literals in hash table. (objc_build_constructor): Do not convert initializer elements; adjust for ObjC++ impedance mismatch. (build_objc_symtab_template): Call create_field_decl() instead of create_builtin_decl(). (init_objc_symtab): Add missing conversion to initializer element. (build_metadata_decl): Call start_var_decl() instead of define_decl(). (generate_objc_symtab_decl): Do not call build_category_template(); call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(). (build_module_descriptor): Call create_field_decl() instead of grokfield(); call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(); always mark module descriptor as used; move GNU runtime-specific functionality to build_module_initializer_routine(). (build_module_initializer_routine): New function, broken off of build_module_descriptor(). (objc_static_init_needed_p, objc_generate_static_init_call): New functions. (generate_static_references, generate_strings, build_selector_translation_table, generate_descriptor_table, generate_ivars_list, generate_dispatch_table, generate_category): Call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(); build a type directly instead of via groktypename(). (build_selector_reference_decl, build_selector_table_decl, build_class_reference_decl, build_protocol_reference, generate_objc_image_info): Call start_var_decl() instead of build_decl(). (build_selector_reference): For GNU runtime, do not call build_selector_reference_decl(). (build_selector, build_typed_selector_reference): Always convert result to the selector type. (add_objc_string): Cast return value to 'char *'. (build_method_prototype_template, build_selector_template, build_method_template): Use actual selector type for fields pointing to selectors. (finish_objc): For GNU runtime, call build_module_initializer_routine() after build_module_descriptor(). (generate_protocol_list, generate_shared_structures): Call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(); build a type directly instead of via groktypename(). (synth_id_with_class_suffix): Return a string. (get_arg_type_list): For instance methods, use the instance type for 'self'; do not call groktypename_in_parm_context(). (build_objc_string_decl): Squash redeclaration errors in ObjC++. (objc_is_class_name): Use OBJC_TYPE_NAME instead of TYPE_NAME; handle RECORD_TYPEs in ObjC as well as ObjC++. (objc_is_id): New function. (objc_is_object_ptr): Return the canonical type node. (objc_get_class_ivars): Simplify using get_class_ivars(). (get_class_ivars): Remove second parameter; create a fresh copy of the ivar list for each call; do not check for existence of super class. (objc_eh_runtime_type): Mark #ifndef OBJCPLUS. (objc_init_exceptions): When using SJLJ-style exceptions, require the use of '-fobjc-exceptions' flag; do not require it for DWARF-style exceptions. (objc_build_exc_ptr, next_sjlj_build_try_catch_finally): Use objc_object_type instead of objc_id_type. (objc_begin_catch_clause): Convert the incoming PARM_DECL into a VAR_DECL before placing it in the appropriate scope; do not call define_decl(); adjust call to c_begin_compound_stmt(); use objc_object_type instead of objc_id_type. (build_next_objc_exception_stuff): Call create_field_decl() instead of create_builtin_decl(); construct type directly instead of calling groktypename(); use OBJC_VOID_AT_END to mark end of function parameters. (build_private_template): Adjust call to get_class_ivars(); build a type directly instead of via groktypename(). (build_protocol_template, build_method_prototype_list_template, build_method_prototype_template, build_category_template, build_selector_template, build_class_template, build_super_template, build_ivar_template, build_ivar_list_template, build_method_list_template, build_method_template): Call create_field_decl() instead of grokfield(). (objc_method_parm_type): Do not call groktypename(). (generate_descriptor_table): Call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(). (generate_method_descriptors, build_protocol_initializer, generate_dispatch_tables, build_category_initializer, build_shared_structure_initializer): Do not call groktypename(). (generate_protocols): Call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(); do not call groktypename(). (error_with_ivar): Remove last parameter. (check_ivars): Do not iterate ovar CLASS_RAW_IVARS lists in addition to CLASS_IVARS lists; adjust calls to error_with_ivar(). (generate_ivar_lists): Convert one of the initializer elements; do not call groktypename(). (get_arg_type_list, start_method_def, gen_method_def): Account for new representation of variable arguments and '...' in Objective-C methods; add Objective-C++ impedance matching code. (is_objc_type_qualifier): Remove function. (adjust_type_for_id_default): Simplify; there is no longer a need to wade through declspecs. (lookup_interface, start_class, continue_class, finish_class, start_method_def, start_protocol, build_method_decl, objc_add_method, add_instance_variable, build_ivar_reference, is_ivar, is_private, get_super_receiver, objc_build_finally_epilogue): Make into static functions. (receiver_is_class_object): Use new IS_CLASS() macro. (objc_build_message_expr): Tweak ObjC++ message argument handling; call objc_finish_message_expr() instead of finish_message_expr(). (finish_message_expr): Rename to objc_finish_message_expr(); use OBJC_TYPE_NAME and OBJC_SET_TYPE_NAME macros instead of TYPE_NAME. call gen_type_name() instead of gen_declaration(); call objc_is_id() instead of using IS_ID and IS_CLASS; Use objc_class_name instead of calling get_identifier("Class"); handle CONVERT_EXPRs in receiver. (build_objc_method_call, warn_with_method): Do not call groktypename(). (build_ivar_reference): Call convert() instead of clobbering in a type. (hash_init): Initialize string_htab hash table. (add_instance_variable): Simplify parameter list; do not call grokfield(); do not populate CLASS_IVARS list. (start_class): Check for the existence of super class, if one was specified. (continue_class): Use CLASS_RAW_IVARS rather than CLASS_IVARS; do not call build_class_template(); adjust call to get_class_ivars(); call build_decl(), pushdecl() and finish_decl() instead of define_decl(). (finish_class): Call build_decl(), pushdecl() and finish_decl() instead of define_decl(). (add_protocols): Use PROTOCOL_BINFO_ELTS for the tree vector size. (start_protocol): Do not call build_protocol_template(); use PROTOCOL_BINFO_ELTS for the tree vector size. (encode_type_qualifiers): Do not handle the 'const' qualifier here. (encode_pointer): Encode 'const char *' as 'r*', for backwards compatibility. (encode_array): Use HOST_WIDE_INT_PRINT_DEC instead of "%ld". (encode_type): Handle the 'const' qualifier here. (objc_parmlist): New global variable, sued by objc_push_parm and objc_get_parm_info(). (objc_push_parm, objc_get_parm_info): New functions. (objc_expr_last): Remove function. (synth_self_and_ucmd_args): For instance methods, use the instance type for 'self'; call objc_push_parm() instead of push_parm_decl(). (start_method_def): Do not call push_scope(), declare_parm_level(), pop_scope(), push_parm_decl(), store_parm_decls() or objc_expr_last(); just use objc_push_parm() and objc_get_parm_info(). (comp_method_with_proto): Remove function. (objc_types_are_equivalent): Strip away indirections before comparing underlying types. (comp_proto_with_proto): Do not call groktypename(); types are no longer in raw declspec format. (objc_start_function): New function. (really_start_method): Call comp_proto_with_proto() instead of comp_method_with_proto(); call objc_start_function() instead of hand-crafting a function declarator. (continue_method_def, objc_expand_function_end): Remove functions. (get_super_receiver): Call objc_get_current_scope() instead of get_current_scope(); reference 'super_class' field (instead of 'class'). (finish_method_def): Rename to objc_finish_method_definition() and add a function decl parameter; move method encoding call from objc_expand_function_end(). (is_complex_decl, adorn_decl, gen_declarator, gen_declspecs, gen_declaration_1): Remove functions. (tmpbuf, RAW_DECLSPEC): Remove. (gen_declaration): Remove second parameter; simplify to deal with TYPE_P nodes instead of raw declspecs. (gen_type_name, gen_type_name_0): New functions. (gen_method_decl): Remove second parameter; call gen_type_name() instead of gen_declaration_1(). (dump_interface): Adjust calls to gen_declaration() and gen_method_decl(); do not allocate a separate string buffer. (init_objc): Allocate a larger string buffer to accommodate dump_interface(); adjust call to build_module_descriptor(); add call to build_module_initializer_routine() for the GNU runtime. (generate_classref_translation_entry): Do not call start_decl(); call finish_var_decl() instead of finish_decl(); call convert() instead of build_c_cast(). * objc-act.h (CLASS_OWN_IVARS): Remove accessor. (CLASS_BINFO_ELTS): Reduce from 6 to 5, now that CLASS_OWN_IVARS is gone. (OCTI_GNU_INIT_DECL, GNU_INIT_decl): New. (OCTI_ELLIPSIS_NODE, objc_ellipsis_node): Remove. (OCTI_ID_ID, id_type, objc_id_id): Rename to OCTI_ID_NAME, objc_object_type and objc_object_name, respectively. (OCTI_CLS_REF, OCTI_CLASS_NAME, objc_class_reference, objc_class_name): New. (IS_CLASS): New macro. (IS_ID, IS_SUPER): Robustify. (OCTI_EXECCLASS_DECL, execclass_decl): New. (finish_file, start_class, continue_class, finish_class, start_method_def, continue_method_def, finish_method_def, start_protocol, finish_protocol, objc_build_throw_stmt, objc_build_try_catch_finally_stmt, objc_build_synchronized_prologue, objc_build_synchronized_epilogue, objc_build_try_prologue, objc_build_try_epilogue, objc_build_catch_stmt, objc_build_catch_epilogue, objc_build_finally_prologue, objc_build_finally_epilogue, is_ivar, is_private, is_public, add_instance_variable, objc_add_method, get_super_receiver, objc_clear_super_receiver, get_class_ivars_from_name, get_class_reference, get_static_reference, get_object_reference, build_message_expr, finish_message_expr, build_selector_expr, build_ivar_reference, build_keyword_decl, build_method_decl, build_protocol_expr, build_objc_string_object, objc_declare_alias, objc_declare_class, objc_declare_protocols, objc_comptypes, objc_check_decl, build_encode_expr): Remove prototypes. (imp_count, cat_count): Make GGC-aware. (OBJC_SET_TYPE_NAME): New macro. From-SVN: r87168
2004-09-08 02:49:44 +02:00
/* Initialize the hash table used to hold the constant string objects. */
string_htab = htab_create_ggc (31, string_hash,
string_eq, NULL);
objc-act.c (objc_build_struct): New function. * objc-act.c (objc_build_struct): New function. (objc_derived_from_p): Likewise. (objc_build_component_ref): Likewise. (objc_copy_binfo): Likewise. (objc_xref_basetypes): Likewise. (objc_lookup_protocol): Likewise. (objc_compare_protocols): Likewise. (objc_volatilize_decl): Likewise. (encode_aggregate_fields): Likewise. (volatilized_hash): Likewise. (volatilized_eq): Likewise. (objc_compare_types): Likewise. (objc_type_quals_match): Likewise. (DERIVED_FROM_P): New ObjC macro, corresponding to C++ macro of same name. (get_class_ivars): Add second parameter indicating if entire hierarchy is desired. (struct volatilized_type): New type. (volatilized_htab): New hash table. (objc_types_compatible_p, objc_comptypes): Remove functions. (synth_module_prologue): Do not initialize 'unused_list'. (objc_get_class_reference): Fix ObjC++ impedance mismatches. (objc_declare_alias): Implement as a typedef. (objc_substitute_decl, objc_gimplify_expr): Reformat. (objc_get_class_ivars): Adjust call to get_class_ivars(). (next_sjlj_build_enter_and_setjmp, synth_forward_declarations, build_ivar_reference, get_super_receiver): Call objc_build_component_ref() instead of build_component_ref(). (objc_begin_catch_clause): Use DERIVED_FROM_P() instead of objc_comptypes(). (build_private_template): Call objc_build_struct() instead of start_struct() and finish_struct(). (hash_init): Initialize volatilized_htab. (objc_is_public): Adjust calls to objc_get_ivars(); adjust ObjC++ impedance mismatches. (encode_aggregate_within): Streamline by calling encode_aggregate_fields(). * objc-act.h (objc_types_compatible_p): Remove prototype. (OCTI_UNUSED_LIST, unused_list): Remove slot. * objc-lang.c (LANG_HOOKS_TYPES_COMPATIBLE_P): Remove. From-SVN: r100123
2005-05-25 00:21:01 +02:00
/* Initialize the hash table used to hold EH-volatilized types. */
volatilized_htab = htab_create_ggc (31, volatilized_hash,
volatilized_eq, NULL);
1992-01-18 00:15:38 +01:00
}
/* WARNING!!!! hash_enter is called with a method, and will peek
inside to find its selector! But hash_lookup is given a selector
directly, and looks for the selector that's inside the found
entry's key (method) for comparison. */
1992-01-18 00:15:38 +01:00
static void
hash_enter (hash *hashlist, tree method)
1992-01-18 00:15:38 +01:00
{
hash obj;
int slot = hash_func (METHOD_SEL_NAME (method)) % SIZEHASHTABLE;
1992-01-18 00:15:38 +01:00
obj = (hash) ggc_alloc (sizeof (struct hashed_entry));
1992-01-18 00:15:38 +01:00
obj->list = 0;
obj->next = hashlist[slot];
obj->key = method;
hashlist[slot] = obj; /* append to front */
}
static hash
hash_lookup (hash *hashlist, tree sel_name)
1992-01-18 00:15:38 +01:00
{
hash target;
target = hashlist[hash_func (sel_name) % SIZEHASHTABLE];
1992-01-18 00:15:38 +01:00
while (target)
{
if (sel_name == METHOD_SEL_NAME (target->key))
return target;
target = target->next;
}
return 0;
}
static void
hash_add_attr (hash entry, tree value)
1992-01-18 00:15:38 +01:00
{
attr obj;
obj = (attr) ggc_alloc (sizeof (struct hashed_attribute));
1992-01-18 00:15:38 +01:00
obj->next = entry->list;
obj->value = value;
entry->list = obj; /* append to front */
}
static tree
lookup_method (tree mchain, tree method)
1992-01-18 00:15:38 +01:00
{
tree key;
if (TREE_CODE (method) == IDENTIFIER_NODE)
key = method;
else
key = METHOD_SEL_NAME (method);
while (mchain)
{
if (METHOD_SEL_NAME (mchain) == key)
return mchain;
1992-01-18 00:15:38 +01:00
mchain = TREE_CHAIN (mchain);
}
return NULL_TREE;
1992-01-18 00:15:38 +01:00
}
Yet more Objective-C++... * objc-act.c (objc_finish_try_stmt): Add return value. (objc_build_synchronized): Likewise. * objc-act.c (objc_is_gcable_type): Add. (objc_substitute_decl): Add. (objc_build_ivar_assignment): Add. (objc_build_global_assignment): Add. (objc_build_strong_cast_assignment): Add. (objc_is_ivar_reference_p): Add. (objc_is_global_reference_p): Add. (objc_generate_write_barrier): Add. (objc_rewrite_function_call): Add. (objc_gimplify_expr): Add Objective-C++ support. * objc-act.h (ALLOC_OBJC_TYPE_LANG_SPECIFIC): Likewise. (SIZEOF_OBJC_TYPE_LANG_SPECIFIC): Add. (INIT_TYPE_OBJC_INFO): Add Objective-C++ support. (DUP_TYPE_OBJC_INFO): Likewise. (struct imp_entry): Add field has_cxx_cdtors. (struct imp_entry *imp_list): Add OCTI_UMSG_FAST_DECL, OCTI_METH_LIST_TEMPL, OCTI_METH_PROTO_LIST_TEMPL, OCTI_IVAR_LIST_TEMPL, OCTI_ASSIGN_IVAR_DECL, OCTI_ASSIGN_IVAR_FAST_DECL, OCTI_ASSIGN_GLOBAL_DECL, OCTI_ASSIGN_STRONGCAST_DECL. (umsg_fast_decl): Add. (objc_assign_ivar_decl): Add. (objc_assign_ivar_fast_decl): Add. (objc_assign_global_decl): Add. (objc_assign_strong_cast_decl): Add. (objc_method_list_ptr): Add. (objc_method_proto_list_ptr): Add. (objc_ivar_list_ptr): Add. * objc-act.c (should_call_super_dealloc): Add. (OBJC_VERSION): Bump to 6. (objc_is_gcable_type): Add. (objc_substitute_decl): Add. (objc_build_ivar_assignment): Add. (objc_build_global_assignment): Add. (objc_build_strong_cast_assignment): Add. (objc_is_gcable_p): Add. (objc_is_ivar_reference_p): Add. (objc_is_global_reference_p): Add. (generate_shared_structures): Add flags parameter. (objc_generate_cxx_ctor_or_dtor): Add. (objc_generate_cxx_cdtors): Add. (add_class): Add name parameter. (objc_types_share_size_and_alignment): Add. (comp_proto_with_proto): Add strict parameter. (CLS_HAS_CXX_STRUCTORS): Add. (TAG_ASSIGNIVAR): Add. (TAG_ASSIGNGLOBAL): Add. (TAG_ASSIGNSTRONGCAST): Add. (TAG_MSGSEND_FAST): Add. (TAG_ASSIGNIVAR_FAST): Add. (TAG_CXX_CONSTRUCT): Add. (TAG_CXX_DESTRUCT): Add. (OBJC_LOOKUP_CLASS): Add. (OBJC_LOOKUP_NO_SUPER): Add. (objc_finish_file): Add pch support. (objc_finish_implementation): Add Objective-C++ support. (synth_module_prologue): Likewise. (synth_module_prologue): Add fast dispatching. (objc_get_class_reference): Add Objective-C++ support. (objc_generate_write_barrier): Likewise. (next_sjlj_build_enter_and_setjmp): Likewise. (objc_begin_try_stmt): Likewise. (build_next_objc_exception_stuff): Add fast ivar support. (build_private_template): Mark the record as used so debug information is generated. (build_protocol_template): Add Objective-C++ support. (objc_method_parm_type) Likewise. (objc_generate_cxx_ctor_or_dtor): Likewise. (objc_generate_cxx_cdtors): Likewise. (build_protocol_initializer): Likewise. (build_category_template): Likewise. (build_class_template): Likewise. (build_method_list_template): Likewise. (build_category_initializer): Likewise. (build_shared_structure_initializer): Likewise. (objc_finish_message_expr): Likewise. (build_objc_method_call): Add fast dispatch support. (lookup_method_static): Add support to end search at superclasses. (add_method_to_hash_list): Add strict parameter to comp_proto_with_proto. (objc_add_method): Likewise. (objc_add_method): Also set the interface_value. (add_instance_variable): Add Objective-C++ support. (objc_is_public): Likewise. (start_class): Likewise. (continue_class): Likewise. (encode_aggregate_within): Likewise. (start_method_def): Likewise. (objc_start_function): Clear current_function_returns_value and current_function_returns_null. (really_start_method): Add Objective-C++ support. (objc_finish_method_definition): Add warning for missing [super dealloc]. (finish_objc): Add Objective-C++ support. (generate_objc_image_info): Likewise. (objc_lookup_ivar): Likewise. * objc-act.h (TYPE_HAS_OBJC_INFO): Likewise. (INIT_TYPE_OBJC_INFO): Likewise. (DUP_TYPE_OBJC_INFO): Likewise. From-SVN: r99857
2005-05-17 22:07:08 +02:00
/* Look up a class (if OBJC_LOOKUP_CLASS is set in FLAGS) or instance method
in INTERFACE, along with any categories and protocols attached thereto.
If method is not found, and the OBJC_LOOKUP_NO_SUPER is _not_ set in FLAGS,
recursively examine the INTERFACE's superclass. If OBJC_LOOKUP_CLASS is
Yet more Objective-C++... * objc-act.c (objc_finish_try_stmt): Add return value. (objc_build_synchronized): Likewise. * objc-act.c (objc_is_gcable_type): Add. (objc_substitute_decl): Add. (objc_build_ivar_assignment): Add. (objc_build_global_assignment): Add. (objc_build_strong_cast_assignment): Add. (objc_is_ivar_reference_p): Add. (objc_is_global_reference_p): Add. (objc_generate_write_barrier): Add. (objc_rewrite_function_call): Add. (objc_gimplify_expr): Add Objective-C++ support. * objc-act.h (ALLOC_OBJC_TYPE_LANG_SPECIFIC): Likewise. (SIZEOF_OBJC_TYPE_LANG_SPECIFIC): Add. (INIT_TYPE_OBJC_INFO): Add Objective-C++ support. (DUP_TYPE_OBJC_INFO): Likewise. (struct imp_entry): Add field has_cxx_cdtors. (struct imp_entry *imp_list): Add OCTI_UMSG_FAST_DECL, OCTI_METH_LIST_TEMPL, OCTI_METH_PROTO_LIST_TEMPL, OCTI_IVAR_LIST_TEMPL, OCTI_ASSIGN_IVAR_DECL, OCTI_ASSIGN_IVAR_FAST_DECL, OCTI_ASSIGN_GLOBAL_DECL, OCTI_ASSIGN_STRONGCAST_DECL. (umsg_fast_decl): Add. (objc_assign_ivar_decl): Add. (objc_assign_ivar_fast_decl): Add. (objc_assign_global_decl): Add. (objc_assign_strong_cast_decl): Add. (objc_method_list_ptr): Add. (objc_method_proto_list_ptr): Add. (objc_ivar_list_ptr): Add. * objc-act.c (should_call_super_dealloc): Add. (OBJC_VERSION): Bump to 6. (objc_is_gcable_type): Add. (objc_substitute_decl): Add. (objc_build_ivar_assignment): Add. (objc_build_global_assignment): Add. (objc_build_strong_cast_assignment): Add. (objc_is_gcable_p): Add. (objc_is_ivar_reference_p): Add. (objc_is_global_reference_p): Add. (generate_shared_structures): Add flags parameter. (objc_generate_cxx_ctor_or_dtor): Add. (objc_generate_cxx_cdtors): Add. (add_class): Add name parameter. (objc_types_share_size_and_alignment): Add. (comp_proto_with_proto): Add strict parameter. (CLS_HAS_CXX_STRUCTORS): Add. (TAG_ASSIGNIVAR): Add. (TAG_ASSIGNGLOBAL): Add. (TAG_ASSIGNSTRONGCAST): Add. (TAG_MSGSEND_FAST): Add. (TAG_ASSIGNIVAR_FAST): Add. (TAG_CXX_CONSTRUCT): Add. (TAG_CXX_DESTRUCT): Add. (OBJC_LOOKUP_CLASS): Add. (OBJC_LOOKUP_NO_SUPER): Add. (objc_finish_file): Add pch support. (objc_finish_implementation): Add Objective-C++ support. (synth_module_prologue): Likewise. (synth_module_prologue): Add fast dispatching. (objc_get_class_reference): Add Objective-C++ support. (objc_generate_write_barrier): Likewise. (next_sjlj_build_enter_and_setjmp): Likewise. (objc_begin_try_stmt): Likewise. (build_next_objc_exception_stuff): Add fast ivar support. (build_private_template): Mark the record as used so debug information is generated. (build_protocol_template): Add Objective-C++ support. (objc_method_parm_type) Likewise. (objc_generate_cxx_ctor_or_dtor): Likewise. (objc_generate_cxx_cdtors): Likewise. (build_protocol_initializer): Likewise. (build_category_template): Likewise. (build_class_template): Likewise. (build_method_list_template): Likewise. (build_category_initializer): Likewise. (build_shared_structure_initializer): Likewise. (objc_finish_message_expr): Likewise. (build_objc_method_call): Add fast dispatch support. (lookup_method_static): Add support to end search at superclasses. (add_method_to_hash_list): Add strict parameter to comp_proto_with_proto. (objc_add_method): Likewise. (objc_add_method): Also set the interface_value. (add_instance_variable): Add Objective-C++ support. (objc_is_public): Likewise. (start_class): Likewise. (continue_class): Likewise. (encode_aggregate_within): Likewise. (start_method_def): Likewise. (objc_start_function): Clear current_function_returns_value and current_function_returns_null. (really_start_method): Add Objective-C++ support. (objc_finish_method_definition): Add warning for missing [super dealloc]. (finish_objc): Add Objective-C++ support. (generate_objc_image_info): Likewise. (objc_lookup_ivar): Likewise. * objc-act.h (TYPE_HAS_OBJC_INFO): Likewise. (INIT_TYPE_OBJC_INFO): Likewise. (DUP_TYPE_OBJC_INFO): Likewise. From-SVN: r99857
2005-05-17 22:07:08 +02:00
set, OBJC_LOOKUP_NO_SUPER is cleared, and no suitable class method could
be found in INTERFACE or any of its superclasses, look for an _instance_
method of the same name in the root class as a last resort.
If a suitable method cannot be found, return NULL_TREE. */
1992-01-18 00:15:38 +01:00
static tree
Yet more Objective-C++... * objc-act.c (objc_finish_try_stmt): Add return value. (objc_build_synchronized): Likewise. * objc-act.c (objc_is_gcable_type): Add. (objc_substitute_decl): Add. (objc_build_ivar_assignment): Add. (objc_build_global_assignment): Add. (objc_build_strong_cast_assignment): Add. (objc_is_ivar_reference_p): Add. (objc_is_global_reference_p): Add. (objc_generate_write_barrier): Add. (objc_rewrite_function_call): Add. (objc_gimplify_expr): Add Objective-C++ support. * objc-act.h (ALLOC_OBJC_TYPE_LANG_SPECIFIC): Likewise. (SIZEOF_OBJC_TYPE_LANG_SPECIFIC): Add. (INIT_TYPE_OBJC_INFO): Add Objective-C++ support. (DUP_TYPE_OBJC_INFO): Likewise. (struct imp_entry): Add field has_cxx_cdtors. (struct imp_entry *imp_list): Add OCTI_UMSG_FAST_DECL, OCTI_METH_LIST_TEMPL, OCTI_METH_PROTO_LIST_TEMPL, OCTI_IVAR_LIST_TEMPL, OCTI_ASSIGN_IVAR_DECL, OCTI_ASSIGN_IVAR_FAST_DECL, OCTI_ASSIGN_GLOBAL_DECL, OCTI_ASSIGN_STRONGCAST_DECL. (umsg_fast_decl): Add. (objc_assign_ivar_decl): Add. (objc_assign_ivar_fast_decl): Add. (objc_assign_global_decl): Add. (objc_assign_strong_cast_decl): Add. (objc_method_list_ptr): Add. (objc_method_proto_list_ptr): Add. (objc_ivar_list_ptr): Add. * objc-act.c (should_call_super_dealloc): Add. (OBJC_VERSION): Bump to 6. (objc_is_gcable_type): Add. (objc_substitute_decl): Add. (objc_build_ivar_assignment): Add. (objc_build_global_assignment): Add. (objc_build_strong_cast_assignment): Add. (objc_is_gcable_p): Add. (objc_is_ivar_reference_p): Add. (objc_is_global_reference_p): Add. (generate_shared_structures): Add flags parameter. (objc_generate_cxx_ctor_or_dtor): Add. (objc_generate_cxx_cdtors): Add. (add_class): Add name parameter. (objc_types_share_size_and_alignment): Add. (comp_proto_with_proto): Add strict parameter. (CLS_HAS_CXX_STRUCTORS): Add. (TAG_ASSIGNIVAR): Add. (TAG_ASSIGNGLOBAL): Add. (TAG_ASSIGNSTRONGCAST): Add. (TAG_MSGSEND_FAST): Add. (TAG_ASSIGNIVAR_FAST): Add. (TAG_CXX_CONSTRUCT): Add. (TAG_CXX_DESTRUCT): Add. (OBJC_LOOKUP_CLASS): Add. (OBJC_LOOKUP_NO_SUPER): Add. (objc_finish_file): Add pch support. (objc_finish_implementation): Add Objective-C++ support. (synth_module_prologue): Likewise. (synth_module_prologue): Add fast dispatching. (objc_get_class_reference): Add Objective-C++ support. (objc_generate_write_barrier): Likewise. (next_sjlj_build_enter_and_setjmp): Likewise. (objc_begin_try_stmt): Likewise. (build_next_objc_exception_stuff): Add fast ivar support. (build_private_template): Mark the record as used so debug information is generated. (build_protocol_template): Add Objective-C++ support. (objc_method_parm_type) Likewise. (objc_generate_cxx_ctor_or_dtor): Likewise. (objc_generate_cxx_cdtors): Likewise. (build_protocol_initializer): Likewise. (build_category_template): Likewise. (build_class_template): Likewise. (build_method_list_template): Likewise. (build_category_initializer): Likewise. (build_shared_structure_initializer): Likewise. (objc_finish_message_expr): Likewise. (build_objc_method_call): Add fast dispatch support. (lookup_method_static): Add support to end search at superclasses. (add_method_to_hash_list): Add strict parameter to comp_proto_with_proto. (objc_add_method): Likewise. (objc_add_method): Also set the interface_value. (add_instance_variable): Add Objective-C++ support. (objc_is_public): Likewise. (start_class): Likewise. (continue_class): Likewise. (encode_aggregate_within): Likewise. (start_method_def): Likewise. (objc_start_function): Clear current_function_returns_value and current_function_returns_null. (really_start_method): Add Objective-C++ support. (objc_finish_method_definition): Add warning for missing [super dealloc]. (finish_objc): Add Objective-C++ support. (generate_objc_image_info): Likewise. (objc_lookup_ivar): Likewise. * objc-act.h (TYPE_HAS_OBJC_INFO): Likewise. (INIT_TYPE_OBJC_INFO): Likewise. (DUP_TYPE_OBJC_INFO): Likewise. From-SVN: r99857
2005-05-17 22:07:08 +02:00
lookup_method_static (tree interface, tree ident, int flags)
1992-01-18 00:15:38 +01:00
{
tree meth = NULL_TREE, root_inter = NULL_TREE;
1992-01-18 00:15:38 +01:00
tree inter = interface;
Yet more Objective-C++... * objc-act.c (objc_finish_try_stmt): Add return value. (objc_build_synchronized): Likewise. * objc-act.c (objc_is_gcable_type): Add. (objc_substitute_decl): Add. (objc_build_ivar_assignment): Add. (objc_build_global_assignment): Add. (objc_build_strong_cast_assignment): Add. (objc_is_ivar_reference_p): Add. (objc_is_global_reference_p): Add. (objc_generate_write_barrier): Add. (objc_rewrite_function_call): Add. (objc_gimplify_expr): Add Objective-C++ support. * objc-act.h (ALLOC_OBJC_TYPE_LANG_SPECIFIC): Likewise. (SIZEOF_OBJC_TYPE_LANG_SPECIFIC): Add. (INIT_TYPE_OBJC_INFO): Add Objective-C++ support. (DUP_TYPE_OBJC_INFO): Likewise. (struct imp_entry): Add field has_cxx_cdtors. (struct imp_entry *imp_list): Add OCTI_UMSG_FAST_DECL, OCTI_METH_LIST_TEMPL, OCTI_METH_PROTO_LIST_TEMPL, OCTI_IVAR_LIST_TEMPL, OCTI_ASSIGN_IVAR_DECL, OCTI_ASSIGN_IVAR_FAST_DECL, OCTI_ASSIGN_GLOBAL_DECL, OCTI_ASSIGN_STRONGCAST_DECL. (umsg_fast_decl): Add. (objc_assign_ivar_decl): Add. (objc_assign_ivar_fast_decl): Add. (objc_assign_global_decl): Add. (objc_assign_strong_cast_decl): Add. (objc_method_list_ptr): Add. (objc_method_proto_list_ptr): Add. (objc_ivar_list_ptr): Add. * objc-act.c (should_call_super_dealloc): Add. (OBJC_VERSION): Bump to 6. (objc_is_gcable_type): Add. (objc_substitute_decl): Add. (objc_build_ivar_assignment): Add. (objc_build_global_assignment): Add. (objc_build_strong_cast_assignment): Add. (objc_is_gcable_p): Add. (objc_is_ivar_reference_p): Add. (objc_is_global_reference_p): Add. (generate_shared_structures): Add flags parameter. (objc_generate_cxx_ctor_or_dtor): Add. (objc_generate_cxx_cdtors): Add. (add_class): Add name parameter. (objc_types_share_size_and_alignment): Add. (comp_proto_with_proto): Add strict parameter. (CLS_HAS_CXX_STRUCTORS): Add. (TAG_ASSIGNIVAR): Add. (TAG_ASSIGNGLOBAL): Add. (TAG_ASSIGNSTRONGCAST): Add. (TAG_MSGSEND_FAST): Add. (TAG_ASSIGNIVAR_FAST): Add. (TAG_CXX_CONSTRUCT): Add. (TAG_CXX_DESTRUCT): Add. (OBJC_LOOKUP_CLASS): Add. (OBJC_LOOKUP_NO_SUPER): Add. (objc_finish_file): Add pch support. (objc_finish_implementation): Add Objective-C++ support. (synth_module_prologue): Likewise. (synth_module_prologue): Add fast dispatching. (objc_get_class_reference): Add Objective-C++ support. (objc_generate_write_barrier): Likewise. (next_sjlj_build_enter_and_setjmp): Likewise. (objc_begin_try_stmt): Likewise. (build_next_objc_exception_stuff): Add fast ivar support. (build_private_template): Mark the record as used so debug information is generated. (build_protocol_template): Add Objective-C++ support. (objc_method_parm_type) Likewise. (objc_generate_cxx_ctor_or_dtor): Likewise. (objc_generate_cxx_cdtors): Likewise. (build_protocol_initializer): Likewise. (build_category_template): Likewise. (build_class_template): Likewise. (build_method_list_template): Likewise. (build_category_initializer): Likewise. (build_shared_structure_initializer): Likewise. (objc_finish_message_expr): Likewise. (build_objc_method_call): Add fast dispatch support. (lookup_method_static): Add support to end search at superclasses. (add_method_to_hash_list): Add strict parameter to comp_proto_with_proto. (objc_add_method): Likewise. (objc_add_method): Also set the interface_value. (add_instance_variable): Add Objective-C++ support. (objc_is_public): Likewise. (start_class): Likewise. (continue_class): Likewise. (encode_aggregate_within): Likewise. (start_method_def): Likewise. (objc_start_function): Clear current_function_returns_value and current_function_returns_null. (really_start_method): Add Objective-C++ support. (objc_finish_method_definition): Add warning for missing [super dealloc]. (finish_objc): Add Objective-C++ support. (generate_objc_image_info): Likewise. (objc_lookup_ivar): Likewise. * objc-act.h (TYPE_HAS_OBJC_INFO): Likewise. (INIT_TYPE_OBJC_INFO): Likewise. (DUP_TYPE_OBJC_INFO): Likewise. From-SVN: r99857
2005-05-17 22:07:08 +02:00
int is_class = (flags & OBJC_LOOKUP_CLASS);
int no_superclasses = (flags & OBJC_LOOKUP_NO_SUPER);
1992-01-18 00:15:38 +01:00
while (inter)
1992-01-18 00:15:38 +01:00
{
tree chain = is_class ? CLASS_CLS_METHODS (inter) : CLASS_NST_METHODS (inter);
tree category = inter;
/* First, look up the method in the class itself. */
if ((meth = lookup_method (chain, ident)))
1992-01-18 00:15:38 +01:00
return meth;
/* Failing that, look for the method in each category of the class. */
while ((category = CLASS_CATEGORY_LIST (category)))
1992-01-18 00:15:38 +01:00
{
chain = is_class ? CLASS_CLS_METHODS (category) : CLASS_NST_METHODS (category);
/* Check directly in each category. */
if ((meth = lookup_method (chain, ident)))
return meth;
/* Failing that, check in each category's protocols. */
if (CLASS_PROTOCOL_LIST (category))
1992-01-18 00:15:38 +01:00
{
if ((meth = (lookup_method_in_protocol_list
(CLASS_PROTOCOL_LIST (category), ident, is_class))))
1992-01-18 00:15:38 +01:00
return meth;
}
}
/* If not found in categories, check in protocols of the main class. */
if (CLASS_PROTOCOL_LIST (inter))
{
if ((meth = (lookup_method_in_protocol_list
(CLASS_PROTOCOL_LIST (inter), ident, is_class))))
return meth;
}
Yet more Objective-C++... * objc-act.c (objc_finish_try_stmt): Add return value. (objc_build_synchronized): Likewise. * objc-act.c (objc_is_gcable_type): Add. (objc_substitute_decl): Add. (objc_build_ivar_assignment): Add. (objc_build_global_assignment): Add. (objc_build_strong_cast_assignment): Add. (objc_is_ivar_reference_p): Add. (objc_is_global_reference_p): Add. (objc_generate_write_barrier): Add. (objc_rewrite_function_call): Add. (objc_gimplify_expr): Add Objective-C++ support. * objc-act.h (ALLOC_OBJC_TYPE_LANG_SPECIFIC): Likewise. (SIZEOF_OBJC_TYPE_LANG_SPECIFIC): Add. (INIT_TYPE_OBJC_INFO): Add Objective-C++ support. (DUP_TYPE_OBJC_INFO): Likewise. (struct imp_entry): Add field has_cxx_cdtors. (struct imp_entry *imp_list): Add OCTI_UMSG_FAST_DECL, OCTI_METH_LIST_TEMPL, OCTI_METH_PROTO_LIST_TEMPL, OCTI_IVAR_LIST_TEMPL, OCTI_ASSIGN_IVAR_DECL, OCTI_ASSIGN_IVAR_FAST_DECL, OCTI_ASSIGN_GLOBAL_DECL, OCTI_ASSIGN_STRONGCAST_DECL. (umsg_fast_decl): Add. (objc_assign_ivar_decl): Add. (objc_assign_ivar_fast_decl): Add. (objc_assign_global_decl): Add. (objc_assign_strong_cast_decl): Add. (objc_method_list_ptr): Add. (objc_method_proto_list_ptr): Add. (objc_ivar_list_ptr): Add. * objc-act.c (should_call_super_dealloc): Add. (OBJC_VERSION): Bump to 6. (objc_is_gcable_type): Add. (objc_substitute_decl): Add. (objc_build_ivar_assignment): Add. (objc_build_global_assignment): Add. (objc_build_strong_cast_assignment): Add. (objc_is_gcable_p): Add. (objc_is_ivar_reference_p): Add. (objc_is_global_reference_p): Add. (generate_shared_structures): Add flags parameter. (objc_generate_cxx_ctor_or_dtor): Add. (objc_generate_cxx_cdtors): Add. (add_class): Add name parameter. (objc_types_share_size_and_alignment): Add. (comp_proto_with_proto): Add strict parameter. (CLS_HAS_CXX_STRUCTORS): Add. (TAG_ASSIGNIVAR): Add. (TAG_ASSIGNGLOBAL): Add. (TAG_ASSIGNSTRONGCAST): Add. (TAG_MSGSEND_FAST): Add. (TAG_ASSIGNIVAR_FAST): Add. (TAG_CXX_CONSTRUCT): Add. (TAG_CXX_DESTRUCT): Add. (OBJC_LOOKUP_CLASS): Add. (OBJC_LOOKUP_NO_SUPER): Add. (objc_finish_file): Add pch support. (objc_finish_implementation): Add Objective-C++ support. (synth_module_prologue): Likewise. (synth_module_prologue): Add fast dispatching. (objc_get_class_reference): Add Objective-C++ support. (objc_generate_write_barrier): Likewise. (next_sjlj_build_enter_and_setjmp): Likewise. (objc_begin_try_stmt): Likewise. (build_next_objc_exception_stuff): Add fast ivar support. (build_private_template): Mark the record as used so debug information is generated. (build_protocol_template): Add Objective-C++ support. (objc_method_parm_type) Likewise. (objc_generate_cxx_ctor_or_dtor): Likewise. (objc_generate_cxx_cdtors): Likewise. (build_protocol_initializer): Likewise. (build_category_template): Likewise. (build_class_template): Likewise. (build_method_list_template): Likewise. (build_category_initializer): Likewise. (build_shared_structure_initializer): Likewise. (objc_finish_message_expr): Likewise. (build_objc_method_call): Add fast dispatch support. (lookup_method_static): Add support to end search at superclasses. (add_method_to_hash_list): Add strict parameter to comp_proto_with_proto. (objc_add_method): Likewise. (objc_add_method): Also set the interface_value. (add_instance_variable): Add Objective-C++ support. (objc_is_public): Likewise. (start_class): Likewise. (continue_class): Likewise. (encode_aggregate_within): Likewise. (start_method_def): Likewise. (objc_start_function): Clear current_function_returns_value and current_function_returns_null. (really_start_method): Add Objective-C++ support. (objc_finish_method_definition): Add warning for missing [super dealloc]. (finish_objc): Add Objective-C++ support. (generate_objc_image_info): Likewise. (objc_lookup_ivar): Likewise. * objc-act.h (TYPE_HAS_OBJC_INFO): Likewise. (INIT_TYPE_OBJC_INFO): Likewise. (DUP_TYPE_OBJC_INFO): Likewise. From-SVN: r99857
2005-05-17 22:07:08 +02:00
/* If we were instructed not to look in superclasses, don't. */
if (no_superclasses)
return NULL_TREE;
/* Failing that, climb up the inheritance hierarchy. */
root_inter = inter;
inter = lookup_interface (CLASS_SUPER_NAME (inter));
1992-01-18 00:15:38 +01:00
}
while (inter);
/* If no class (factory) method was found, check if an _instance_
method of the same name exists in the root class. This is what
the Objective-C runtime will do. If an instance method was not
found, return 0. */
return is_class ? lookup_method_static (root_inter, ident, 0): NULL_TREE;
1992-01-18 00:15:38 +01:00
}
/* Add the method to the hash list if it doesn't contain an identical
method already. */
2006-05-28 03:01:12 +02:00
static void
add_method_to_hash_list (hash *hash_list, tree method)
{
hash hsh;
if (!(hsh = hash_lookup (hash_list, METHOD_SEL_NAME (method))))
{
/* Install on a global chain. */
hash_enter (hash_list, method);
}
else
{
/* Check types against those; if different, add to a list. */
attr loop;
Yet more Objective-C++... * objc-act.c (objc_finish_try_stmt): Add return value. (objc_build_synchronized): Likewise. * objc-act.c (objc_is_gcable_type): Add. (objc_substitute_decl): Add. (objc_build_ivar_assignment): Add. (objc_build_global_assignment): Add. (objc_build_strong_cast_assignment): Add. (objc_is_ivar_reference_p): Add. (objc_is_global_reference_p): Add. (objc_generate_write_barrier): Add. (objc_rewrite_function_call): Add. (objc_gimplify_expr): Add Objective-C++ support. * objc-act.h (ALLOC_OBJC_TYPE_LANG_SPECIFIC): Likewise. (SIZEOF_OBJC_TYPE_LANG_SPECIFIC): Add. (INIT_TYPE_OBJC_INFO): Add Objective-C++ support. (DUP_TYPE_OBJC_INFO): Likewise. (struct imp_entry): Add field has_cxx_cdtors. (struct imp_entry *imp_list): Add OCTI_UMSG_FAST_DECL, OCTI_METH_LIST_TEMPL, OCTI_METH_PROTO_LIST_TEMPL, OCTI_IVAR_LIST_TEMPL, OCTI_ASSIGN_IVAR_DECL, OCTI_ASSIGN_IVAR_FAST_DECL, OCTI_ASSIGN_GLOBAL_DECL, OCTI_ASSIGN_STRONGCAST_DECL. (umsg_fast_decl): Add. (objc_assign_ivar_decl): Add. (objc_assign_ivar_fast_decl): Add. (objc_assign_global_decl): Add. (objc_assign_strong_cast_decl): Add. (objc_method_list_ptr): Add. (objc_method_proto_list_ptr): Add. (objc_ivar_list_ptr): Add. * objc-act.c (should_call_super_dealloc): Add. (OBJC_VERSION): Bump to 6. (objc_is_gcable_type): Add. (objc_substitute_decl): Add. (objc_build_ivar_assignment): Add. (objc_build_global_assignment): Add. (objc_build_strong_cast_assignment): Add. (objc_is_gcable_p): Add. (objc_is_ivar_reference_p): Add. (objc_is_global_reference_p): Add. (generate_shared_structures): Add flags parameter. (objc_generate_cxx_ctor_or_dtor): Add. (objc_generate_cxx_cdtors): Add. (add_class): Add name parameter. (objc_types_share_size_and_alignment): Add. (comp_proto_with_proto): Add strict parameter. (CLS_HAS_CXX_STRUCTORS): Add. (TAG_ASSIGNIVAR): Add. (TAG_ASSIGNGLOBAL): Add. (TAG_ASSIGNSTRONGCAST): Add. (TAG_MSGSEND_FAST): Add. (TAG_ASSIGNIVAR_FAST): Add. (TAG_CXX_CONSTRUCT): Add. (TAG_CXX_DESTRUCT): Add. (OBJC_LOOKUP_CLASS): Add. (OBJC_LOOKUP_NO_SUPER): Add. (objc_finish_file): Add pch support. (objc_finish_implementation): Add Objective-C++ support. (synth_module_prologue): Likewise. (synth_module_prologue): Add fast dispatching. (objc_get_class_reference): Add Objective-C++ support. (objc_generate_write_barrier): Likewise. (next_sjlj_build_enter_and_setjmp): Likewise. (objc_begin_try_stmt): Likewise. (build_next_objc_exception_stuff): Add fast ivar support. (build_private_template): Mark the record as used so debug information is generated. (build_protocol_template): Add Objective-C++ support. (objc_method_parm_type) Likewise. (objc_generate_cxx_ctor_or_dtor): Likewise. (objc_generate_cxx_cdtors): Likewise. (build_protocol_initializer): Likewise. (build_category_template): Likewise. (build_class_template): Likewise. (build_method_list_template): Likewise. (build_category_initializer): Likewise. (build_shared_structure_initializer): Likewise. (objc_finish_message_expr): Likewise. (build_objc_method_call): Add fast dispatch support. (lookup_method_static): Add support to end search at superclasses. (add_method_to_hash_list): Add strict parameter to comp_proto_with_proto. (objc_add_method): Likewise. (objc_add_method): Also set the interface_value. (add_instance_variable): Add Objective-C++ support. (objc_is_public): Likewise. (start_class): Likewise. (continue_class): Likewise. (encode_aggregate_within): Likewise. (start_method_def): Likewise. (objc_start_function): Clear current_function_returns_value and current_function_returns_null. (really_start_method): Add Objective-C++ support. (objc_finish_method_definition): Add warning for missing [super dealloc]. (finish_objc): Add Objective-C++ support. (generate_objc_image_info): Likewise. (objc_lookup_ivar): Likewise. * objc-act.h (TYPE_HAS_OBJC_INFO): Likewise. (INIT_TYPE_OBJC_INFO): Likewise. (DUP_TYPE_OBJC_INFO): Likewise. From-SVN: r99857
2005-05-17 22:07:08 +02:00
int already_there = comp_proto_with_proto (method, hsh->key, 1);
for (loop = hsh->list; !already_there && loop; loop = loop->next)
Yet more Objective-C++... * objc-act.c (objc_finish_try_stmt): Add return value. (objc_build_synchronized): Likewise. * objc-act.c (objc_is_gcable_type): Add. (objc_substitute_decl): Add. (objc_build_ivar_assignment): Add. (objc_build_global_assignment): Add. (objc_build_strong_cast_assignment): Add. (objc_is_ivar_reference_p): Add. (objc_is_global_reference_p): Add. (objc_generate_write_barrier): Add. (objc_rewrite_function_call): Add. (objc_gimplify_expr): Add Objective-C++ support. * objc-act.h (ALLOC_OBJC_TYPE_LANG_SPECIFIC): Likewise. (SIZEOF_OBJC_TYPE_LANG_SPECIFIC): Add. (INIT_TYPE_OBJC_INFO): Add Objective-C++ support. (DUP_TYPE_OBJC_INFO): Likewise. (struct imp_entry): Add field has_cxx_cdtors. (struct imp_entry *imp_list): Add OCTI_UMSG_FAST_DECL, OCTI_METH_LIST_TEMPL, OCTI_METH_PROTO_LIST_TEMPL, OCTI_IVAR_LIST_TEMPL, OCTI_ASSIGN_IVAR_DECL, OCTI_ASSIGN_IVAR_FAST_DECL, OCTI_ASSIGN_GLOBAL_DECL, OCTI_ASSIGN_STRONGCAST_DECL. (umsg_fast_decl): Add. (objc_assign_ivar_decl): Add. (objc_assign_ivar_fast_decl): Add. (objc_assign_global_decl): Add. (objc_assign_strong_cast_decl): Add. (objc_method_list_ptr): Add. (objc_method_proto_list_ptr): Add. (objc_ivar_list_ptr): Add. * objc-act.c (should_call_super_dealloc): Add. (OBJC_VERSION): Bump to 6. (objc_is_gcable_type): Add. (objc_substitute_decl): Add. (objc_build_ivar_assignment): Add. (objc_build_global_assignment): Add. (objc_build_strong_cast_assignment): Add. (objc_is_gcable_p): Add. (objc_is_ivar_reference_p): Add. (objc_is_global_reference_p): Add. (generate_shared_structures): Add flags parameter. (objc_generate_cxx_ctor_or_dtor): Add. (objc_generate_cxx_cdtors): Add. (add_class): Add name parameter. (objc_types_share_size_and_alignment): Add. (comp_proto_with_proto): Add strict parameter. (CLS_HAS_CXX_STRUCTORS): Add. (TAG_ASSIGNIVAR): Add. (TAG_ASSIGNGLOBAL): Add. (TAG_ASSIGNSTRONGCAST): Add. (TAG_MSGSEND_FAST): Add. (TAG_ASSIGNIVAR_FAST): Add. (TAG_CXX_CONSTRUCT): Add. (TAG_CXX_DESTRUCT): Add. (OBJC_LOOKUP_CLASS): Add. (OBJC_LOOKUP_NO_SUPER): Add. (objc_finish_file): Add pch support. (objc_finish_implementation): Add Objective-C++ support. (synth_module_prologue): Likewise. (synth_module_prologue): Add fast dispatching. (objc_get_class_reference): Add Objective-C++ support. (objc_generate_write_barrier): Likewise. (next_sjlj_build_enter_and_setjmp): Likewise. (objc_begin_try_stmt): Likewise. (build_next_objc_exception_stuff): Add fast ivar support. (build_private_template): Mark the record as used so debug information is generated. (build_protocol_template): Add Objective-C++ support. (objc_method_parm_type) Likewise. (objc_generate_cxx_ctor_or_dtor): Likewise. (objc_generate_cxx_cdtors): Likewise. (build_protocol_initializer): Likewise. (build_category_template): Likewise. (build_class_template): Likewise. (build_method_list_template): Likewise. (build_category_initializer): Likewise. (build_shared_structure_initializer): Likewise. (objc_finish_message_expr): Likewise. (build_objc_method_call): Add fast dispatch support. (lookup_method_static): Add support to end search at superclasses. (add_method_to_hash_list): Add strict parameter to comp_proto_with_proto. (objc_add_method): Likewise. (objc_add_method): Also set the interface_value. (add_instance_variable): Add Objective-C++ support. (objc_is_public): Likewise. (start_class): Likewise. (continue_class): Likewise. (encode_aggregate_within): Likewise. (start_method_def): Likewise. (objc_start_function): Clear current_function_returns_value and current_function_returns_null. (really_start_method): Add Objective-C++ support. (objc_finish_method_definition): Add warning for missing [super dealloc]. (finish_objc): Add Objective-C++ support. (generate_objc_image_info): Likewise. (objc_lookup_ivar): Likewise. * objc-act.h (TYPE_HAS_OBJC_INFO): Likewise. (INIT_TYPE_OBJC_INFO): Likewise. (DUP_TYPE_OBJC_INFO): Likewise. From-SVN: r99857
2005-05-17 22:07:08 +02:00
already_there |= comp_proto_with_proto (method, loop->value, 1);
if (!already_there)
hash_add_attr (hsh, method);
}
}
Makefile.in (c-parse.o): Depend on $(C_COMMON_H). [gcc/ChangeLog] 2004-09-07 Ziemowit Laski <zlaski@apple.com> * Makefile.in (c-parse.o): Depend on $(C_COMMON_H). * c-parse.in: Include c-common.h instead of objc-act.h. (ivar_decl_list, ivar_decls, ivar_decl, ivars, ivar_declarator, myparms, myparm): Remove %type declarations. (methodtype, optparms, OBJC_TYPE_QUAL, objc_quals, objc_qual, objc_typename, objc_try_catch_stmt, optellipsis): Add %type declarations. (objc_inherit_code, objc_public_flag): Remove. (typespec_nonreserved_nonattr): Call objc_get_protocol_qualified_type() instead of get_static_reference() and get_protocol_reference(). (stmt_nocomp): Call grokparm() on @catch parameter. (objcdef): Move semantic action to objc_finish_implementation(). (classdef): Move semantic action to objc_start_class_interface(), objc_continue_interface(), objc_finish_interface(), objc_start_class_implementation(), objc_continue_implementation(), objc_start_category_interface() and objc_start_category_implementation(). (protocoldef): Move semantic actions to objc_start_protocol() and objc_finish_interface(). (ivar_decl_list): Remove nonterminal. (visibility_spec): Move semantic actions to objc_set_visibility(). (ivar_decls): Remove assignment to $$. (ivar_decl): Rephrase in terms of component_decl; call objc_add_instance_variable(). (ivars, ivar_declarator): Remove nonterminals. (opt_semi): New nonterminal. (methodtype): Remove semantic actions. (methoddef): Move semantic actions to objc_set_method_type(), objc_start_method_definition() and objc_finish_method_definition(). (methodproto): Move semantic actions to objc_set_method_type() and objc_add_method_declaration(). (methoddecl): Use objc_typename instead of typename; move semantic actions to objc_build_method_signature(). (optarglist, myxdecls, mydecl, myparms, myparm): Remove nonterminals. (optparmlist): Express in terms of optparms and optellipsis. (optparms, optellipsis, objc_qual, objc_quals, objc_typename): New nonterminals. (keyworddecl): Use objc_typename instead of typename. (rid_to_yy): Mark RID_IN, RID_OUT, RID_INOUT, RID_BYCOPY, RID_BYREF and RID_ONEWAY as returning OBJC_TYPE_QUAL to yyparse(). [gcc/objc/ChangeLog] 2004-09-07 Ziemowit Laski <zlaski@apple.com> * Make-lang.in (objc/objc-parse.o): Depend on $(C_COMMON_H) instead of objc/objc-act.h. (objc/objc-act.o): Depend on $(HASHTAB_H). * objc-act.c: Include hashtab.h; in ObjC++ mode, include cp-tree.h and objcp-decl.h instead of c-tree.h. (build_module_descriptor, get_class_ivars, synth_id_with_class_suffix, error_with_ivar, gen_method_decl, gen_declaration, setup_string_decl, build_protocol_template): Adjust prototypes. (build_module_initializer_routine, start_class, continue_class, finish_class, start_method_def, objc_start_function, start_protocol, build_method_decl, objc_add_method, add_instance_variable, build_ivar_reference, is_ivar, is_private, get_super_receiver, build_selector_table_decl, objc_push_parm, objc_get_parm_info, gen_type_name, gen_type_name_0, start_var_decl, finish_var_decl, create_field_decl): New prototypes. (objc_expand_function_end, comp_method_with_proto, objc_expr_last, gen_declaration_1, gen_declarator, is_complex_decl, adorn_decl, define_decl, create_builtin_decl, gen_declspecs): Remove prototypes. (TYPE_ID): Rename to OBJECT_TYPEDEF_NAME. (CLASS_TYPEDEF_NAME): New. (TAG_EXECCLASS): Change from a global variable to a #define. (TAG_RETURN_STRUCT): Delete. (TAG_GNUINIT): New, holds '__objc_gnu_init' name. (objc_inherit_code, objc_public_flag): New, moved from c-parse.in. (string_descriptor): New struct. (string_htab): New hash table. (string_hash, string_eq): New prototypes. (generate_struct_by_value_array): Call create_field_decl() instead of create_builtin_decl(). (objc_init): Do not initialize objc_ellipsis_node or TAG_EXECCLASS; In ObjC++ mode, call cxx_init() instead of c_objc_common_init(). (objc_finish_file): In ObjC++, call instantiate_pending_templates() and cp_finish_file(). (define_decl, get_static_reference, get_protocol_reference, create_builtin_decl): Remove functions. (objc_start_class_interface, objc_start_category_interface, objc_start_protocol, objc_continue_interface, objc_finish_interface, objc_start_class_implementation, objc_start_category_implementation, objc_continue_implementation, objc_finish_implementation, objc_set_visibility, objc_set_method_type, objc_build_method_signature, objc_add_method_declaration, objc_start_method_definition, objc_add_instance_variable, objc_get_protocol_qualified_type, create_field_decl, start_var_decl, finish_var_decl): New functions. (setup_string_decl): Simplify since it is only called once. (synth_module_prologue): Call build_class_template(); predefine 'id' and 'Class' as typedefs; rename 'temp_type' to 'type'; disable debug hooks for duration of function; fix GNU runtime messenger signatures to correspond to reality; forward-declare '__objc_exec_class' for the GNU runtime; call build_selector_table_decl(); in ObjC++ mode, generate 'extern "C" { ... }' wrappers around synthesized declarations; call build_protocol_template() and build_category_template(). (string_hash, string_eq): New functions. (objc_build_string_object): Check metaclass correctness only once; store string literals in hash table. (objc_build_constructor): Do not convert initializer elements; adjust for ObjC++ impedance mismatch. (build_objc_symtab_template): Call create_field_decl() instead of create_builtin_decl(). (init_objc_symtab): Add missing conversion to initializer element. (build_metadata_decl): Call start_var_decl() instead of define_decl(). (generate_objc_symtab_decl): Do not call build_category_template(); call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(). (build_module_descriptor): Call create_field_decl() instead of grokfield(); call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(); always mark module descriptor as used; move GNU runtime-specific functionality to build_module_initializer_routine(). (build_module_initializer_routine): New function, broken off of build_module_descriptor(). (objc_static_init_needed_p, objc_generate_static_init_call): New functions. (generate_static_references, generate_strings, build_selector_translation_table, generate_descriptor_table, generate_ivars_list, generate_dispatch_table, generate_category): Call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(); build a type directly instead of via groktypename(). (build_selector_reference_decl, build_selector_table_decl, build_class_reference_decl, build_protocol_reference, generate_objc_image_info): Call start_var_decl() instead of build_decl(). (build_selector_reference): For GNU runtime, do not call build_selector_reference_decl(). (build_selector, build_typed_selector_reference): Always convert result to the selector type. (add_objc_string): Cast return value to 'char *'. (build_method_prototype_template, build_selector_template, build_method_template): Use actual selector type for fields pointing to selectors. (finish_objc): For GNU runtime, call build_module_initializer_routine() after build_module_descriptor(). (generate_protocol_list, generate_shared_structures): Call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(); build a type directly instead of via groktypename(). (synth_id_with_class_suffix): Return a string. (get_arg_type_list): For instance methods, use the instance type for 'self'; do not call groktypename_in_parm_context(). (build_objc_string_decl): Squash redeclaration errors in ObjC++. (objc_is_class_name): Use OBJC_TYPE_NAME instead of TYPE_NAME; handle RECORD_TYPEs in ObjC as well as ObjC++. (objc_is_id): New function. (objc_is_object_ptr): Return the canonical type node. (objc_get_class_ivars): Simplify using get_class_ivars(). (get_class_ivars): Remove second parameter; create a fresh copy of the ivar list for each call; do not check for existence of super class. (objc_eh_runtime_type): Mark #ifndef OBJCPLUS. (objc_init_exceptions): When using SJLJ-style exceptions, require the use of '-fobjc-exceptions' flag; do not require it for DWARF-style exceptions. (objc_build_exc_ptr, next_sjlj_build_try_catch_finally): Use objc_object_type instead of objc_id_type. (objc_begin_catch_clause): Convert the incoming PARM_DECL into a VAR_DECL before placing it in the appropriate scope; do not call define_decl(); adjust call to c_begin_compound_stmt(); use objc_object_type instead of objc_id_type. (build_next_objc_exception_stuff): Call create_field_decl() instead of create_builtin_decl(); construct type directly instead of calling groktypename(); use OBJC_VOID_AT_END to mark end of function parameters. (build_private_template): Adjust call to get_class_ivars(); build a type directly instead of via groktypename(). (build_protocol_template, build_method_prototype_list_template, build_method_prototype_template, build_category_template, build_selector_template, build_class_template, build_super_template, build_ivar_template, build_ivar_list_template, build_method_list_template, build_method_template): Call create_field_decl() instead of grokfield(). (objc_method_parm_type): Do not call groktypename(). (generate_descriptor_table): Call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(). (generate_method_descriptors, build_protocol_initializer, generate_dispatch_tables, build_category_initializer, build_shared_structure_initializer): Do not call groktypename(). (generate_protocols): Call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(); do not call groktypename(). (error_with_ivar): Remove last parameter. (check_ivars): Do not iterate ovar CLASS_RAW_IVARS lists in addition to CLASS_IVARS lists; adjust calls to error_with_ivar(). (generate_ivar_lists): Convert one of the initializer elements; do not call groktypename(). (get_arg_type_list, start_method_def, gen_method_def): Account for new representation of variable arguments and '...' in Objective-C methods; add Objective-C++ impedance matching code. (is_objc_type_qualifier): Remove function. (adjust_type_for_id_default): Simplify; there is no longer a need to wade through declspecs. (lookup_interface, start_class, continue_class, finish_class, start_method_def, start_protocol, build_method_decl, objc_add_method, add_instance_variable, build_ivar_reference, is_ivar, is_private, get_super_receiver, objc_build_finally_epilogue): Make into static functions. (receiver_is_class_object): Use new IS_CLASS() macro. (objc_build_message_expr): Tweak ObjC++ message argument handling; call objc_finish_message_expr() instead of finish_message_expr(). (finish_message_expr): Rename to objc_finish_message_expr(); use OBJC_TYPE_NAME and OBJC_SET_TYPE_NAME macros instead of TYPE_NAME. call gen_type_name() instead of gen_declaration(); call objc_is_id() instead of using IS_ID and IS_CLASS; Use objc_class_name instead of calling get_identifier("Class"); handle CONVERT_EXPRs in receiver. (build_objc_method_call, warn_with_method): Do not call groktypename(). (build_ivar_reference): Call convert() instead of clobbering in a type. (hash_init): Initialize string_htab hash table. (add_instance_variable): Simplify parameter list; do not call grokfield(); do not populate CLASS_IVARS list. (start_class): Check for the existence of super class, if one was specified. (continue_class): Use CLASS_RAW_IVARS rather than CLASS_IVARS; do not call build_class_template(); adjust call to get_class_ivars(); call build_decl(), pushdecl() and finish_decl() instead of define_decl(). (finish_class): Call build_decl(), pushdecl() and finish_decl() instead of define_decl(). (add_protocols): Use PROTOCOL_BINFO_ELTS for the tree vector size. (start_protocol): Do not call build_protocol_template(); use PROTOCOL_BINFO_ELTS for the tree vector size. (encode_type_qualifiers): Do not handle the 'const' qualifier here. (encode_pointer): Encode 'const char *' as 'r*', for backwards compatibility. (encode_array): Use HOST_WIDE_INT_PRINT_DEC instead of "%ld". (encode_type): Handle the 'const' qualifier here. (objc_parmlist): New global variable, sued by objc_push_parm and objc_get_parm_info(). (objc_push_parm, objc_get_parm_info): New functions. (objc_expr_last): Remove function. (synth_self_and_ucmd_args): For instance methods, use the instance type for 'self'; call objc_push_parm() instead of push_parm_decl(). (start_method_def): Do not call push_scope(), declare_parm_level(), pop_scope(), push_parm_decl(), store_parm_decls() or objc_expr_last(); just use objc_push_parm() and objc_get_parm_info(). (comp_method_with_proto): Remove function. (objc_types_are_equivalent): Strip away indirections before comparing underlying types. (comp_proto_with_proto): Do not call groktypename(); types are no longer in raw declspec format. (objc_start_function): New function. (really_start_method): Call comp_proto_with_proto() instead of comp_method_with_proto(); call objc_start_function() instead of hand-crafting a function declarator. (continue_method_def, objc_expand_function_end): Remove functions. (get_super_receiver): Call objc_get_current_scope() instead of get_current_scope(); reference 'super_class' field (instead of 'class'). (finish_method_def): Rename to objc_finish_method_definition() and add a function decl parameter; move method encoding call from objc_expand_function_end(). (is_complex_decl, adorn_decl, gen_declarator, gen_declspecs, gen_declaration_1): Remove functions. (tmpbuf, RAW_DECLSPEC): Remove. (gen_declaration): Remove second parameter; simplify to deal with TYPE_P nodes instead of raw declspecs. (gen_type_name, gen_type_name_0): New functions. (gen_method_decl): Remove second parameter; call gen_type_name() instead of gen_declaration_1(). (dump_interface): Adjust calls to gen_declaration() and gen_method_decl(); do not allocate a separate string buffer. (init_objc): Allocate a larger string buffer to accommodate dump_interface(); adjust call to build_module_descriptor(); add call to build_module_initializer_routine() for the GNU runtime. (generate_classref_translation_entry): Do not call start_decl(); call finish_var_decl() instead of finish_decl(); call convert() instead of build_c_cast(). * objc-act.h (CLASS_OWN_IVARS): Remove accessor. (CLASS_BINFO_ELTS): Reduce from 6 to 5, now that CLASS_OWN_IVARS is gone. (OCTI_GNU_INIT_DECL, GNU_INIT_decl): New. (OCTI_ELLIPSIS_NODE, objc_ellipsis_node): Remove. (OCTI_ID_ID, id_type, objc_id_id): Rename to OCTI_ID_NAME, objc_object_type and objc_object_name, respectively. (OCTI_CLS_REF, OCTI_CLASS_NAME, objc_class_reference, objc_class_name): New. (IS_CLASS): New macro. (IS_ID, IS_SUPER): Robustify. (OCTI_EXECCLASS_DECL, execclass_decl): New. (finish_file, start_class, continue_class, finish_class, start_method_def, continue_method_def, finish_method_def, start_protocol, finish_protocol, objc_build_throw_stmt, objc_build_try_catch_finally_stmt, objc_build_synchronized_prologue, objc_build_synchronized_epilogue, objc_build_try_prologue, objc_build_try_epilogue, objc_build_catch_stmt, objc_build_catch_epilogue, objc_build_finally_prologue, objc_build_finally_epilogue, is_ivar, is_private, is_public, add_instance_variable, objc_add_method, get_super_receiver, objc_clear_super_receiver, get_class_ivars_from_name, get_class_reference, get_static_reference, get_object_reference, build_message_expr, finish_message_expr, build_selector_expr, build_ivar_reference, build_keyword_decl, build_method_decl, build_protocol_expr, build_objc_string_object, objc_declare_alias, objc_declare_class, objc_declare_protocols, objc_comptypes, objc_check_decl, build_encode_expr): Remove prototypes. (imp_count, cat_count): Make GGC-aware. (OBJC_SET_TYPE_NAME): New macro. From-SVN: r87168
2004-09-08 02:49:44 +02:00
static tree
objc_add_method (tree class, tree method, int is_class)
1992-01-18 00:15:38 +01:00
{
tree mth;
Makefile.in (c-parse.o): Depend on $(C_COMMON_H). [gcc/ChangeLog] 2004-09-07 Ziemowit Laski <zlaski@apple.com> * Makefile.in (c-parse.o): Depend on $(C_COMMON_H). * c-parse.in: Include c-common.h instead of objc-act.h. (ivar_decl_list, ivar_decls, ivar_decl, ivars, ivar_declarator, myparms, myparm): Remove %type declarations. (methodtype, optparms, OBJC_TYPE_QUAL, objc_quals, objc_qual, objc_typename, objc_try_catch_stmt, optellipsis): Add %type declarations. (objc_inherit_code, objc_public_flag): Remove. (typespec_nonreserved_nonattr): Call objc_get_protocol_qualified_type() instead of get_static_reference() and get_protocol_reference(). (stmt_nocomp): Call grokparm() on @catch parameter. (objcdef): Move semantic action to objc_finish_implementation(). (classdef): Move semantic action to objc_start_class_interface(), objc_continue_interface(), objc_finish_interface(), objc_start_class_implementation(), objc_continue_implementation(), objc_start_category_interface() and objc_start_category_implementation(). (protocoldef): Move semantic actions to objc_start_protocol() and objc_finish_interface(). (ivar_decl_list): Remove nonterminal. (visibility_spec): Move semantic actions to objc_set_visibility(). (ivar_decls): Remove assignment to $$. (ivar_decl): Rephrase in terms of component_decl; call objc_add_instance_variable(). (ivars, ivar_declarator): Remove nonterminals. (opt_semi): New nonterminal. (methodtype): Remove semantic actions. (methoddef): Move semantic actions to objc_set_method_type(), objc_start_method_definition() and objc_finish_method_definition(). (methodproto): Move semantic actions to objc_set_method_type() and objc_add_method_declaration(). (methoddecl): Use objc_typename instead of typename; move semantic actions to objc_build_method_signature(). (optarglist, myxdecls, mydecl, myparms, myparm): Remove nonterminals. (optparmlist): Express in terms of optparms and optellipsis. (optparms, optellipsis, objc_qual, objc_quals, objc_typename): New nonterminals. (keyworddecl): Use objc_typename instead of typename. (rid_to_yy): Mark RID_IN, RID_OUT, RID_INOUT, RID_BYCOPY, RID_BYREF and RID_ONEWAY as returning OBJC_TYPE_QUAL to yyparse(). [gcc/objc/ChangeLog] 2004-09-07 Ziemowit Laski <zlaski@apple.com> * Make-lang.in (objc/objc-parse.o): Depend on $(C_COMMON_H) instead of objc/objc-act.h. (objc/objc-act.o): Depend on $(HASHTAB_H). * objc-act.c: Include hashtab.h; in ObjC++ mode, include cp-tree.h and objcp-decl.h instead of c-tree.h. (build_module_descriptor, get_class_ivars, synth_id_with_class_suffix, error_with_ivar, gen_method_decl, gen_declaration, setup_string_decl, build_protocol_template): Adjust prototypes. (build_module_initializer_routine, start_class, continue_class, finish_class, start_method_def, objc_start_function, start_protocol, build_method_decl, objc_add_method, add_instance_variable, build_ivar_reference, is_ivar, is_private, get_super_receiver, build_selector_table_decl, objc_push_parm, objc_get_parm_info, gen_type_name, gen_type_name_0, start_var_decl, finish_var_decl, create_field_decl): New prototypes. (objc_expand_function_end, comp_method_with_proto, objc_expr_last, gen_declaration_1, gen_declarator, is_complex_decl, adorn_decl, define_decl, create_builtin_decl, gen_declspecs): Remove prototypes. (TYPE_ID): Rename to OBJECT_TYPEDEF_NAME. (CLASS_TYPEDEF_NAME): New. (TAG_EXECCLASS): Change from a global variable to a #define. (TAG_RETURN_STRUCT): Delete. (TAG_GNUINIT): New, holds '__objc_gnu_init' name. (objc_inherit_code, objc_public_flag): New, moved from c-parse.in. (string_descriptor): New struct. (string_htab): New hash table. (string_hash, string_eq): New prototypes. (generate_struct_by_value_array): Call create_field_decl() instead of create_builtin_decl(). (objc_init): Do not initialize objc_ellipsis_node or TAG_EXECCLASS; In ObjC++ mode, call cxx_init() instead of c_objc_common_init(). (objc_finish_file): In ObjC++, call instantiate_pending_templates() and cp_finish_file(). (define_decl, get_static_reference, get_protocol_reference, create_builtin_decl): Remove functions. (objc_start_class_interface, objc_start_category_interface, objc_start_protocol, objc_continue_interface, objc_finish_interface, objc_start_class_implementation, objc_start_category_implementation, objc_continue_implementation, objc_finish_implementation, objc_set_visibility, objc_set_method_type, objc_build_method_signature, objc_add_method_declaration, objc_start_method_definition, objc_add_instance_variable, objc_get_protocol_qualified_type, create_field_decl, start_var_decl, finish_var_decl): New functions. (setup_string_decl): Simplify since it is only called once. (synth_module_prologue): Call build_class_template(); predefine 'id' and 'Class' as typedefs; rename 'temp_type' to 'type'; disable debug hooks for duration of function; fix GNU runtime messenger signatures to correspond to reality; forward-declare '__objc_exec_class' for the GNU runtime; call build_selector_table_decl(); in ObjC++ mode, generate 'extern "C" { ... }' wrappers around synthesized declarations; call build_protocol_template() and build_category_template(). (string_hash, string_eq): New functions. (objc_build_string_object): Check metaclass correctness only once; store string literals in hash table. (objc_build_constructor): Do not convert initializer elements; adjust for ObjC++ impedance mismatch. (build_objc_symtab_template): Call create_field_decl() instead of create_builtin_decl(). (init_objc_symtab): Add missing conversion to initializer element. (build_metadata_decl): Call start_var_decl() instead of define_decl(). (generate_objc_symtab_decl): Do not call build_category_template(); call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(). (build_module_descriptor): Call create_field_decl() instead of grokfield(); call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(); always mark module descriptor as used; move GNU runtime-specific functionality to build_module_initializer_routine(). (build_module_initializer_routine): New function, broken off of build_module_descriptor(). (objc_static_init_needed_p, objc_generate_static_init_call): New functions. (generate_static_references, generate_strings, build_selector_translation_table, generate_descriptor_table, generate_ivars_list, generate_dispatch_table, generate_category): Call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(); build a type directly instead of via groktypename(). (build_selector_reference_decl, build_selector_table_decl, build_class_reference_decl, build_protocol_reference, generate_objc_image_info): Call start_var_decl() instead of build_decl(). (build_selector_reference): For GNU runtime, do not call build_selector_reference_decl(). (build_selector, build_typed_selector_reference): Always convert result to the selector type. (add_objc_string): Cast return value to 'char *'. (build_method_prototype_template, build_selector_template, build_method_template): Use actual selector type for fields pointing to selectors. (finish_objc): For GNU runtime, call build_module_initializer_routine() after build_module_descriptor(). (generate_protocol_list, generate_shared_structures): Call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(); build a type directly instead of via groktypename(). (synth_id_with_class_suffix): Return a string. (get_arg_type_list): For instance methods, use the instance type for 'self'; do not call groktypename_in_parm_context(). (build_objc_string_decl): Squash redeclaration errors in ObjC++. (objc_is_class_name): Use OBJC_TYPE_NAME instead of TYPE_NAME; handle RECORD_TYPEs in ObjC as well as ObjC++. (objc_is_id): New function. (objc_is_object_ptr): Return the canonical type node. (objc_get_class_ivars): Simplify using get_class_ivars(). (get_class_ivars): Remove second parameter; create a fresh copy of the ivar list for each call; do not check for existence of super class. (objc_eh_runtime_type): Mark #ifndef OBJCPLUS. (objc_init_exceptions): When using SJLJ-style exceptions, require the use of '-fobjc-exceptions' flag; do not require it for DWARF-style exceptions. (objc_build_exc_ptr, next_sjlj_build_try_catch_finally): Use objc_object_type instead of objc_id_type. (objc_begin_catch_clause): Convert the incoming PARM_DECL into a VAR_DECL before placing it in the appropriate scope; do not call define_decl(); adjust call to c_begin_compound_stmt(); use objc_object_type instead of objc_id_type. (build_next_objc_exception_stuff): Call create_field_decl() instead of create_builtin_decl(); construct type directly instead of calling groktypename(); use OBJC_VOID_AT_END to mark end of function parameters. (build_private_template): Adjust call to get_class_ivars(); build a type directly instead of via groktypename(). (build_protocol_template, build_method_prototype_list_template, build_method_prototype_template, build_category_template, build_selector_template, build_class_template, build_super_template, build_ivar_template, build_ivar_list_template, build_method_list_template, build_method_template): Call create_field_decl() instead of grokfield(). (objc_method_parm_type): Do not call groktypename(). (generate_descriptor_table): Call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(). (generate_method_descriptors, build_protocol_initializer, generate_dispatch_tables, build_category_initializer, build_shared_structure_initializer): Do not call groktypename(). (generate_protocols): Call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(); do not call groktypename(). (error_with_ivar): Remove last parameter. (check_ivars): Do not iterate ovar CLASS_RAW_IVARS lists in addition to CLASS_IVARS lists; adjust calls to error_with_ivar(). (generate_ivar_lists): Convert one of the initializer elements; do not call groktypename(). (get_arg_type_list, start_method_def, gen_method_def): Account for new representation of variable arguments and '...' in Objective-C methods; add Objective-C++ impedance matching code. (is_objc_type_qualifier): Remove function. (adjust_type_for_id_default): Simplify; there is no longer a need to wade through declspecs. (lookup_interface, start_class, continue_class, finish_class, start_method_def, start_protocol, build_method_decl, objc_add_method, add_instance_variable, build_ivar_reference, is_ivar, is_private, get_super_receiver, objc_build_finally_epilogue): Make into static functions. (receiver_is_class_object): Use new IS_CLASS() macro. (objc_build_message_expr): Tweak ObjC++ message argument handling; call objc_finish_message_expr() instead of finish_message_expr(). (finish_message_expr): Rename to objc_finish_message_expr(); use OBJC_TYPE_NAME and OBJC_SET_TYPE_NAME macros instead of TYPE_NAME. call gen_type_name() instead of gen_declaration(); call objc_is_id() instead of using IS_ID and IS_CLASS; Use objc_class_name instead of calling get_identifier("Class"); handle CONVERT_EXPRs in receiver. (build_objc_method_call, warn_with_method): Do not call groktypename(). (build_ivar_reference): Call convert() instead of clobbering in a type. (hash_init): Initialize string_htab hash table. (add_instance_variable): Simplify parameter list; do not call grokfield(); do not populate CLASS_IVARS list. (start_class): Check for the existence of super class, if one was specified. (continue_class): Use CLASS_RAW_IVARS rather than CLASS_IVARS; do not call build_class_template(); adjust call to get_class_ivars(); call build_decl(), pushdecl() and finish_decl() instead of define_decl(). (finish_class): Call build_decl(), pushdecl() and finish_decl() instead of define_decl(). (add_protocols): Use PROTOCOL_BINFO_ELTS for the tree vector size. (start_protocol): Do not call build_protocol_template(); use PROTOCOL_BINFO_ELTS for the tree vector size. (encode_type_qualifiers): Do not handle the 'const' qualifier here. (encode_pointer): Encode 'const char *' as 'r*', for backwards compatibility. (encode_array): Use HOST_WIDE_INT_PRINT_DEC instead of "%ld". (encode_type): Handle the 'const' qualifier here. (objc_parmlist): New global variable, sued by objc_push_parm and objc_get_parm_info(). (objc_push_parm, objc_get_parm_info): New functions. (objc_expr_last): Remove function. (synth_self_and_ucmd_args): For instance methods, use the instance type for 'self'; call objc_push_parm() instead of push_parm_decl(). (start_method_def): Do not call push_scope(), declare_parm_level(), pop_scope(), push_parm_decl(), store_parm_decls() or objc_expr_last(); just use objc_push_parm() and objc_get_parm_info(). (comp_method_with_proto): Remove function. (objc_types_are_equivalent): Strip away indirections before comparing underlying types. (comp_proto_with_proto): Do not call groktypename(); types are no longer in raw declspec format. (objc_start_function): New function. (really_start_method): Call comp_proto_with_proto() instead of comp_method_with_proto(); call objc_start_function() instead of hand-crafting a function declarator. (continue_method_def, objc_expand_function_end): Remove functions. (get_super_receiver): Call objc_get_current_scope() instead of get_current_scope(); reference 'super_class' field (instead of 'class'). (finish_method_def): Rename to objc_finish_method_definition() and add a function decl parameter; move method encoding call from objc_expand_function_end(). (is_complex_decl, adorn_decl, gen_declarator, gen_declspecs, gen_declaration_1): Remove functions. (tmpbuf, RAW_DECLSPEC): Remove. (gen_declaration): Remove second parameter; simplify to deal with TYPE_P nodes instead of raw declspecs. (gen_type_name, gen_type_name_0): New functions. (gen_method_decl): Remove second parameter; call gen_type_name() instead of gen_declaration_1(). (dump_interface): Adjust calls to gen_declaration() and gen_method_decl(); do not allocate a separate string buffer. (init_objc): Allocate a larger string buffer to accommodate dump_interface(); adjust call to build_module_descriptor(); add call to build_module_initializer_routine() for the GNU runtime. (generate_classref_translation_entry): Do not call start_decl(); call finish_var_decl() instead of finish_decl(); call convert() instead of build_c_cast(). * objc-act.h (CLASS_OWN_IVARS): Remove accessor. (CLASS_BINFO_ELTS): Reduce from 6 to 5, now that CLASS_OWN_IVARS is gone. (OCTI_GNU_INIT_DECL, GNU_INIT_decl): New. (OCTI_ELLIPSIS_NODE, objc_ellipsis_node): Remove. (OCTI_ID_ID, id_type, objc_id_id): Rename to OCTI_ID_NAME, objc_object_type and objc_object_name, respectively. (OCTI_CLS_REF, OCTI_CLASS_NAME, objc_class_reference, objc_class_name): New. (IS_CLASS): New macro. (IS_ID, IS_SUPER): Robustify. (OCTI_EXECCLASS_DECL, execclass_decl): New. (finish_file, start_class, continue_class, finish_class, start_method_def, continue_method_def, finish_method_def, start_protocol, finish_protocol, objc_build_throw_stmt, objc_build_try_catch_finally_stmt, objc_build_synchronized_prologue, objc_build_synchronized_epilogue, objc_build_try_prologue, objc_build_try_epilogue, objc_build_catch_stmt, objc_build_catch_epilogue, objc_build_finally_prologue, objc_build_finally_epilogue, is_ivar, is_private, is_public, add_instance_variable, objc_add_method, get_super_receiver, objc_clear_super_receiver, get_class_ivars_from_name, get_class_reference, get_static_reference, get_object_reference, build_message_expr, finish_message_expr, build_selector_expr, build_ivar_reference, build_keyword_decl, build_method_decl, build_protocol_expr, build_objc_string_object, objc_declare_alias, objc_declare_class, objc_declare_protocols, objc_comptypes, objc_check_decl, build_encode_expr): Remove prototypes. (imp_count, cat_count): Make GGC-aware. (OBJC_SET_TYPE_NAME): New macro. From-SVN: r87168
2004-09-08 02:49:44 +02:00
if (!(mth = lookup_method (is_class
? CLASS_CLS_METHODS (class)
: CLASS_NST_METHODS (class), method)))
1992-01-18 00:15:38 +01:00
{
/* put method on list in reverse order */
if (is_class)
{
TREE_CHAIN (method) = CLASS_CLS_METHODS (class);
CLASS_CLS_METHODS (class) = method;
}
1992-01-18 00:15:38 +01:00
else
{
TREE_CHAIN (method) = CLASS_NST_METHODS (class);
CLASS_NST_METHODS (class) = method;
}
1992-01-18 00:15:38 +01:00
}
else
{
/* When processing an @interface for a class or category, give hard
errors on methods with identical selectors but differing argument
and/or return types. We do not do this for @implementations, because
C/C++ will do it for us (i.e., there will be duplicate function
definition errors). */
if ((TREE_CODE (class) == CLASS_INTERFACE_TYPE
|| TREE_CODE (class) == CATEGORY_INTERFACE_TYPE)
Yet more Objective-C++... * objc-act.c (objc_finish_try_stmt): Add return value. (objc_build_synchronized): Likewise. * objc-act.c (objc_is_gcable_type): Add. (objc_substitute_decl): Add. (objc_build_ivar_assignment): Add. (objc_build_global_assignment): Add. (objc_build_strong_cast_assignment): Add. (objc_is_ivar_reference_p): Add. (objc_is_global_reference_p): Add. (objc_generate_write_barrier): Add. (objc_rewrite_function_call): Add. (objc_gimplify_expr): Add Objective-C++ support. * objc-act.h (ALLOC_OBJC_TYPE_LANG_SPECIFIC): Likewise. (SIZEOF_OBJC_TYPE_LANG_SPECIFIC): Add. (INIT_TYPE_OBJC_INFO): Add Objective-C++ support. (DUP_TYPE_OBJC_INFO): Likewise. (struct imp_entry): Add field has_cxx_cdtors. (struct imp_entry *imp_list): Add OCTI_UMSG_FAST_DECL, OCTI_METH_LIST_TEMPL, OCTI_METH_PROTO_LIST_TEMPL, OCTI_IVAR_LIST_TEMPL, OCTI_ASSIGN_IVAR_DECL, OCTI_ASSIGN_IVAR_FAST_DECL, OCTI_ASSIGN_GLOBAL_DECL, OCTI_ASSIGN_STRONGCAST_DECL. (umsg_fast_decl): Add. (objc_assign_ivar_decl): Add. (objc_assign_ivar_fast_decl): Add. (objc_assign_global_decl): Add. (objc_assign_strong_cast_decl): Add. (objc_method_list_ptr): Add. (objc_method_proto_list_ptr): Add. (objc_ivar_list_ptr): Add. * objc-act.c (should_call_super_dealloc): Add. (OBJC_VERSION): Bump to 6. (objc_is_gcable_type): Add. (objc_substitute_decl): Add. (objc_build_ivar_assignment): Add. (objc_build_global_assignment): Add. (objc_build_strong_cast_assignment): Add. (objc_is_gcable_p): Add. (objc_is_ivar_reference_p): Add. (objc_is_global_reference_p): Add. (generate_shared_structures): Add flags parameter. (objc_generate_cxx_ctor_or_dtor): Add. (objc_generate_cxx_cdtors): Add. (add_class): Add name parameter. (objc_types_share_size_and_alignment): Add. (comp_proto_with_proto): Add strict parameter. (CLS_HAS_CXX_STRUCTORS): Add. (TAG_ASSIGNIVAR): Add. (TAG_ASSIGNGLOBAL): Add. (TAG_ASSIGNSTRONGCAST): Add. (TAG_MSGSEND_FAST): Add. (TAG_ASSIGNIVAR_FAST): Add. (TAG_CXX_CONSTRUCT): Add. (TAG_CXX_DESTRUCT): Add. (OBJC_LOOKUP_CLASS): Add. (OBJC_LOOKUP_NO_SUPER): Add. (objc_finish_file): Add pch support. (objc_finish_implementation): Add Objective-C++ support. (synth_module_prologue): Likewise. (synth_module_prologue): Add fast dispatching. (objc_get_class_reference): Add Objective-C++ support. (objc_generate_write_barrier): Likewise. (next_sjlj_build_enter_and_setjmp): Likewise. (objc_begin_try_stmt): Likewise. (build_next_objc_exception_stuff): Add fast ivar support. (build_private_template): Mark the record as used so debug information is generated. (build_protocol_template): Add Objective-C++ support. (objc_method_parm_type) Likewise. (objc_generate_cxx_ctor_or_dtor): Likewise. (objc_generate_cxx_cdtors): Likewise. (build_protocol_initializer): Likewise. (build_category_template): Likewise. (build_class_template): Likewise. (build_method_list_template): Likewise. (build_category_initializer): Likewise. (build_shared_structure_initializer): Likewise. (objc_finish_message_expr): Likewise. (build_objc_method_call): Add fast dispatch support. (lookup_method_static): Add support to end search at superclasses. (add_method_to_hash_list): Add strict parameter to comp_proto_with_proto. (objc_add_method): Likewise. (objc_add_method): Also set the interface_value. (add_instance_variable): Add Objective-C++ support. (objc_is_public): Likewise. (start_class): Likewise. (continue_class): Likewise. (encode_aggregate_within): Likewise. (start_method_def): Likewise. (objc_start_function): Clear current_function_returns_value and current_function_returns_null. (really_start_method): Add Objective-C++ support. (objc_finish_method_definition): Add warning for missing [super dealloc]. (finish_objc): Add Objective-C++ support. (generate_objc_image_info): Likewise. (objc_lookup_ivar): Likewise. * objc-act.h (TYPE_HAS_OBJC_INFO): Likewise. (INIT_TYPE_OBJC_INFO): Likewise. (DUP_TYPE_OBJC_INFO): Likewise. From-SVN: r99857
2005-05-17 22:07:08 +02:00
&& !comp_proto_with_proto (method, mth, 1))
builtins.c, [...]: Avoid "`" as left quote, using "'" or %q, %< and %> as appropriate. * builtins.c, c-common.c, c-decl.c, c-format.c, c-format.h, c-parse.in, c-pch.c, c-pragma.c, collect2.c, final.c, gcc.c, gcov.c, opts.c, pretty-print.h, protoize.c, reg-stack.c, rtl.c, tlink.c, config/alpha/alpha.c, config/arc/arc.c, config/arm/arm.c, config/avr/avr.c, config/c4x/c4x.c, config/darwin.c, config/frv/frv.c, config/h8300/h8300.c, config/i386/i386.c, config/i386/winnt.c, config/ia64/ia64.c, config/ip2k/ip2k.c, config/iq2000/iq2000.c, config/m32r/m32r.c, config/m68hc11/m68hc11.c, config/m68k/m68k.c, config/m68k/m68k.h, config/mcore/mcore.c, config/mips/mips.c, config/mmix/mmix.c, config/ns32k/ns32k.c, config/rs6000/host-darwin.c, config/rs6000/rs6000.c, config/s390/s390.c, config/sh/sh.c, config/sh/symbian.c, config/stormy16/stormy16.c, config/v850/v850.c: Avoid "`" as left quote, using "'" or %q, %< and %> as appropriate. Use %' as apostrophe in diagnostics where applicable. Use %< and %> in place of '' quotes where applicable. Use %qs in place of %<%s%>. Consistently quote __builtin function names. ada: * misc.c (gnat_handle_option): Use %< and %> for quoting in warning message. cp: * call.c, class.c, decl.c, decl2.c, error.c, mangle.c, parser.c, pt.c, search.c, semantics.c, typeck.c: Use %q, %< and %> for quoting in diagnostics. * parser.c (cp_parser_sizeof_operand): Use '' instead of `' for quoting in printf format. * decl.c (duplicate_decls, start_decl): Use %qD instead of unquoted %D. objc: * objc-act.c: Use %q, %< and %> for quoting in diagnostics. testsuite: * gcc.dg/builtin-prefetch-1.c: Adjust expected messages. From-SVN: r90337
2004-11-09 11:13:30 +01:00
error ("duplicate declaration of method %<%c%s%>",
is_class ? '+' : '-',
Makefile.in (c-parse.o): Depend on $(C_COMMON_H). [gcc/ChangeLog] 2004-09-07 Ziemowit Laski <zlaski@apple.com> * Makefile.in (c-parse.o): Depend on $(C_COMMON_H). * c-parse.in: Include c-common.h instead of objc-act.h. (ivar_decl_list, ivar_decls, ivar_decl, ivars, ivar_declarator, myparms, myparm): Remove %type declarations. (methodtype, optparms, OBJC_TYPE_QUAL, objc_quals, objc_qual, objc_typename, objc_try_catch_stmt, optellipsis): Add %type declarations. (objc_inherit_code, objc_public_flag): Remove. (typespec_nonreserved_nonattr): Call objc_get_protocol_qualified_type() instead of get_static_reference() and get_protocol_reference(). (stmt_nocomp): Call grokparm() on @catch parameter. (objcdef): Move semantic action to objc_finish_implementation(). (classdef): Move semantic action to objc_start_class_interface(), objc_continue_interface(), objc_finish_interface(), objc_start_class_implementation(), objc_continue_implementation(), objc_start_category_interface() and objc_start_category_implementation(). (protocoldef): Move semantic actions to objc_start_protocol() and objc_finish_interface(). (ivar_decl_list): Remove nonterminal. (visibility_spec): Move semantic actions to objc_set_visibility(). (ivar_decls): Remove assignment to $$. (ivar_decl): Rephrase in terms of component_decl; call objc_add_instance_variable(). (ivars, ivar_declarator): Remove nonterminals. (opt_semi): New nonterminal. (methodtype): Remove semantic actions. (methoddef): Move semantic actions to objc_set_method_type(), objc_start_method_definition() and objc_finish_method_definition(). (methodproto): Move semantic actions to objc_set_method_type() and objc_add_method_declaration(). (methoddecl): Use objc_typename instead of typename; move semantic actions to objc_build_method_signature(). (optarglist, myxdecls, mydecl, myparms, myparm): Remove nonterminals. (optparmlist): Express in terms of optparms and optellipsis. (optparms, optellipsis, objc_qual, objc_quals, objc_typename): New nonterminals. (keyworddecl): Use objc_typename instead of typename. (rid_to_yy): Mark RID_IN, RID_OUT, RID_INOUT, RID_BYCOPY, RID_BYREF and RID_ONEWAY as returning OBJC_TYPE_QUAL to yyparse(). [gcc/objc/ChangeLog] 2004-09-07 Ziemowit Laski <zlaski@apple.com> * Make-lang.in (objc/objc-parse.o): Depend on $(C_COMMON_H) instead of objc/objc-act.h. (objc/objc-act.o): Depend on $(HASHTAB_H). * objc-act.c: Include hashtab.h; in ObjC++ mode, include cp-tree.h and objcp-decl.h instead of c-tree.h. (build_module_descriptor, get_class_ivars, synth_id_with_class_suffix, error_with_ivar, gen_method_decl, gen_declaration, setup_string_decl, build_protocol_template): Adjust prototypes. (build_module_initializer_routine, start_class, continue_class, finish_class, start_method_def, objc_start_function, start_protocol, build_method_decl, objc_add_method, add_instance_variable, build_ivar_reference, is_ivar, is_private, get_super_receiver, build_selector_table_decl, objc_push_parm, objc_get_parm_info, gen_type_name, gen_type_name_0, start_var_decl, finish_var_decl, create_field_decl): New prototypes. (objc_expand_function_end, comp_method_with_proto, objc_expr_last, gen_declaration_1, gen_declarator, is_complex_decl, adorn_decl, define_decl, create_builtin_decl, gen_declspecs): Remove prototypes. (TYPE_ID): Rename to OBJECT_TYPEDEF_NAME. (CLASS_TYPEDEF_NAME): New. (TAG_EXECCLASS): Change from a global variable to a #define. (TAG_RETURN_STRUCT): Delete. (TAG_GNUINIT): New, holds '__objc_gnu_init' name. (objc_inherit_code, objc_public_flag): New, moved from c-parse.in. (string_descriptor): New struct. (string_htab): New hash table. (string_hash, string_eq): New prototypes. (generate_struct_by_value_array): Call create_field_decl() instead of create_builtin_decl(). (objc_init): Do not initialize objc_ellipsis_node or TAG_EXECCLASS; In ObjC++ mode, call cxx_init() instead of c_objc_common_init(). (objc_finish_file): In ObjC++, call instantiate_pending_templates() and cp_finish_file(). (define_decl, get_static_reference, get_protocol_reference, create_builtin_decl): Remove functions. (objc_start_class_interface, objc_start_category_interface, objc_start_protocol, objc_continue_interface, objc_finish_interface, objc_start_class_implementation, objc_start_category_implementation, objc_continue_implementation, objc_finish_implementation, objc_set_visibility, objc_set_method_type, objc_build_method_signature, objc_add_method_declaration, objc_start_method_definition, objc_add_instance_variable, objc_get_protocol_qualified_type, create_field_decl, start_var_decl, finish_var_decl): New functions. (setup_string_decl): Simplify since it is only called once. (synth_module_prologue): Call build_class_template(); predefine 'id' and 'Class' as typedefs; rename 'temp_type' to 'type'; disable debug hooks for duration of function; fix GNU runtime messenger signatures to correspond to reality; forward-declare '__objc_exec_class' for the GNU runtime; call build_selector_table_decl(); in ObjC++ mode, generate 'extern "C" { ... }' wrappers around synthesized declarations; call build_protocol_template() and build_category_template(). (string_hash, string_eq): New functions. (objc_build_string_object): Check metaclass correctness only once; store string literals in hash table. (objc_build_constructor): Do not convert initializer elements; adjust for ObjC++ impedance mismatch. (build_objc_symtab_template): Call create_field_decl() instead of create_builtin_decl(). (init_objc_symtab): Add missing conversion to initializer element. (build_metadata_decl): Call start_var_decl() instead of define_decl(). (generate_objc_symtab_decl): Do not call build_category_template(); call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(). (build_module_descriptor): Call create_field_decl() instead of grokfield(); call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(); always mark module descriptor as used; move GNU runtime-specific functionality to build_module_initializer_routine(). (build_module_initializer_routine): New function, broken off of build_module_descriptor(). (objc_static_init_needed_p, objc_generate_static_init_call): New functions. (generate_static_references, generate_strings, build_selector_translation_table, generate_descriptor_table, generate_ivars_list, generate_dispatch_table, generate_category): Call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(); build a type directly instead of via groktypename(). (build_selector_reference_decl, build_selector_table_decl, build_class_reference_decl, build_protocol_reference, generate_objc_image_info): Call start_var_decl() instead of build_decl(). (build_selector_reference): For GNU runtime, do not call build_selector_reference_decl(). (build_selector, build_typed_selector_reference): Always convert result to the selector type. (add_objc_string): Cast return value to 'char *'. (build_method_prototype_template, build_selector_template, build_method_template): Use actual selector type for fields pointing to selectors. (finish_objc): For GNU runtime, call build_module_initializer_routine() after build_module_descriptor(). (generate_protocol_list, generate_shared_structures): Call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(); build a type directly instead of via groktypename(). (synth_id_with_class_suffix): Return a string. (get_arg_type_list): For instance methods, use the instance type for 'self'; do not call groktypename_in_parm_context(). (build_objc_string_decl): Squash redeclaration errors in ObjC++. (objc_is_class_name): Use OBJC_TYPE_NAME instead of TYPE_NAME; handle RECORD_TYPEs in ObjC as well as ObjC++. (objc_is_id): New function. (objc_is_object_ptr): Return the canonical type node. (objc_get_class_ivars): Simplify using get_class_ivars(). (get_class_ivars): Remove second parameter; create a fresh copy of the ivar list for each call; do not check for existence of super class. (objc_eh_runtime_type): Mark #ifndef OBJCPLUS. (objc_init_exceptions): When using SJLJ-style exceptions, require the use of '-fobjc-exceptions' flag; do not require it for DWARF-style exceptions. (objc_build_exc_ptr, next_sjlj_build_try_catch_finally): Use objc_object_type instead of objc_id_type. (objc_begin_catch_clause): Convert the incoming PARM_DECL into a VAR_DECL before placing it in the appropriate scope; do not call define_decl(); adjust call to c_begin_compound_stmt(); use objc_object_type instead of objc_id_type. (build_next_objc_exception_stuff): Call create_field_decl() instead of create_builtin_decl(); construct type directly instead of calling groktypename(); use OBJC_VOID_AT_END to mark end of function parameters. (build_private_template): Adjust call to get_class_ivars(); build a type directly instead of via groktypename(). (build_protocol_template, build_method_prototype_list_template, build_method_prototype_template, build_category_template, build_selector_template, build_class_template, build_super_template, build_ivar_template, build_ivar_list_template, build_method_list_template, build_method_template): Call create_field_decl() instead of grokfield(). (objc_method_parm_type): Do not call groktypename(). (generate_descriptor_table): Call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(). (generate_method_descriptors, build_protocol_initializer, generate_dispatch_tables, build_category_initializer, build_shared_structure_initializer): Do not call groktypename(). (generate_protocols): Call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(); do not call groktypename(). (error_with_ivar): Remove last parameter. (check_ivars): Do not iterate ovar CLASS_RAW_IVARS lists in addition to CLASS_IVARS lists; adjust calls to error_with_ivar(). (generate_ivar_lists): Convert one of the initializer elements; do not call groktypename(). (get_arg_type_list, start_method_def, gen_method_def): Account for new representation of variable arguments and '...' in Objective-C methods; add Objective-C++ impedance matching code. (is_objc_type_qualifier): Remove function. (adjust_type_for_id_default): Simplify; there is no longer a need to wade through declspecs. (lookup_interface, start_class, continue_class, finish_class, start_method_def, start_protocol, build_method_decl, objc_add_method, add_instance_variable, build_ivar_reference, is_ivar, is_private, get_super_receiver, objc_build_finally_epilogue): Make into static functions. (receiver_is_class_object): Use new IS_CLASS() macro. (objc_build_message_expr): Tweak ObjC++ message argument handling; call objc_finish_message_expr() instead of finish_message_expr(). (finish_message_expr): Rename to objc_finish_message_expr(); use OBJC_TYPE_NAME and OBJC_SET_TYPE_NAME macros instead of TYPE_NAME. call gen_type_name() instead of gen_declaration(); call objc_is_id() instead of using IS_ID and IS_CLASS; Use objc_class_name instead of calling get_identifier("Class"); handle CONVERT_EXPRs in receiver. (build_objc_method_call, warn_with_method): Do not call groktypename(). (build_ivar_reference): Call convert() instead of clobbering in a type. (hash_init): Initialize string_htab hash table. (add_instance_variable): Simplify parameter list; do not call grokfield(); do not populate CLASS_IVARS list. (start_class): Check for the existence of super class, if one was specified. (continue_class): Use CLASS_RAW_IVARS rather than CLASS_IVARS; do not call build_class_template(); adjust call to get_class_ivars(); call build_decl(), pushdecl() and finish_decl() instead of define_decl(). (finish_class): Call build_decl(), pushdecl() and finish_decl() instead of define_decl(). (add_protocols): Use PROTOCOL_BINFO_ELTS for the tree vector size. (start_protocol): Do not call build_protocol_template(); use PROTOCOL_BINFO_ELTS for the tree vector size. (encode_type_qualifiers): Do not handle the 'const' qualifier here. (encode_pointer): Encode 'const char *' as 'r*', for backwards compatibility. (encode_array): Use HOST_WIDE_INT_PRINT_DEC instead of "%ld". (encode_type): Handle the 'const' qualifier here. (objc_parmlist): New global variable, sued by objc_push_parm and objc_get_parm_info(). (objc_push_parm, objc_get_parm_info): New functions. (objc_expr_last): Remove function. (synth_self_and_ucmd_args): For instance methods, use the instance type for 'self'; call objc_push_parm() instead of push_parm_decl(). (start_method_def): Do not call push_scope(), declare_parm_level(), pop_scope(), push_parm_decl(), store_parm_decls() or objc_expr_last(); just use objc_push_parm() and objc_get_parm_info(). (comp_method_with_proto): Remove function. (objc_types_are_equivalent): Strip away indirections before comparing underlying types. (comp_proto_with_proto): Do not call groktypename(); types are no longer in raw declspec format. (objc_start_function): New function. (really_start_method): Call comp_proto_with_proto() instead of comp_method_with_proto(); call objc_start_function() instead of hand-crafting a function declarator. (continue_method_def, objc_expand_function_end): Remove functions. (get_super_receiver): Call objc_get_current_scope() instead of get_current_scope(); reference 'super_class' field (instead of 'class'). (finish_method_def): Rename to objc_finish_method_definition() and add a function decl parameter; move method encoding call from objc_expand_function_end(). (is_complex_decl, adorn_decl, gen_declarator, gen_declspecs, gen_declaration_1): Remove functions. (tmpbuf, RAW_DECLSPEC): Remove. (gen_declaration): Remove second parameter; simplify to deal with TYPE_P nodes instead of raw declspecs. (gen_type_name, gen_type_name_0): New functions. (gen_method_decl): Remove second parameter; call gen_type_name() instead of gen_declaration_1(). (dump_interface): Adjust calls to gen_declaration() and gen_method_decl(); do not allocate a separate string buffer. (init_objc): Allocate a larger string buffer to accommodate dump_interface(); adjust call to build_module_descriptor(); add call to build_module_initializer_routine() for the GNU runtime. (generate_classref_translation_entry): Do not call start_decl(); call finish_var_decl() instead of finish_decl(); call convert() instead of build_c_cast(). * objc-act.h (CLASS_OWN_IVARS): Remove accessor. (CLASS_BINFO_ELTS): Reduce from 6 to 5, now that CLASS_OWN_IVARS is gone. (OCTI_GNU_INIT_DECL, GNU_INIT_decl): New. (OCTI_ELLIPSIS_NODE, objc_ellipsis_node): Remove. (OCTI_ID_ID, id_type, objc_id_id): Rename to OCTI_ID_NAME, objc_object_type and objc_object_name, respectively. (OCTI_CLS_REF, OCTI_CLASS_NAME, objc_class_reference, objc_class_name): New. (IS_CLASS): New macro. (IS_ID, IS_SUPER): Robustify. (OCTI_EXECCLASS_DECL, execclass_decl): New. (finish_file, start_class, continue_class, finish_class, start_method_def, continue_method_def, finish_method_def, start_protocol, finish_protocol, objc_build_throw_stmt, objc_build_try_catch_finally_stmt, objc_build_synchronized_prologue, objc_build_synchronized_epilogue, objc_build_try_prologue, objc_build_try_epilogue, objc_build_catch_stmt, objc_build_catch_epilogue, objc_build_finally_prologue, objc_build_finally_epilogue, is_ivar, is_private, is_public, add_instance_variable, objc_add_method, get_super_receiver, objc_clear_super_receiver, get_class_ivars_from_name, get_class_reference, get_static_reference, get_object_reference, build_message_expr, finish_message_expr, build_selector_expr, build_ivar_reference, build_keyword_decl, build_method_decl, build_protocol_expr, build_objc_string_object, objc_declare_alias, objc_declare_class, objc_declare_protocols, objc_comptypes, objc_check_decl, build_encode_expr): Remove prototypes. (imp_count, cat_count): Make GGC-aware. (OBJC_SET_TYPE_NAME): New macro. From-SVN: r87168
2004-09-08 02:49:44 +02:00
IDENTIFIER_POINTER (METHOD_SEL_NAME (mth)));
1992-01-18 00:15:38 +01:00
}
if (is_class)
add_method_to_hash_list (cls_method_hash_list, method);
1992-01-18 00:15:38 +01:00
else
{
add_method_to_hash_list (nst_method_hash_list, method);
/* Instance methods in root classes (and categories thereof)
c-common.h: Remove RID_ID. [gcc/ChangeLog] 2004-10-25 David Ayers <d.ayers@inode.at> * c-common.h: Remove RID_ID. * c-parse.in: Remove OBJECTNAME and references to RID_ID. (typespec_reserved_attr): Add rule for TYPENAME non_empty_protocolrefs. (yylexname): Remove special handling of RID_ID. [gcc/objc/ChangeLog] 2004-10-25 Ziemowit Laski <zlaski@apple.com> David Ayers <d.ayers@inode.at> * objc-act.c (objc_comptypes): Use IS_PROTOCOL_QUALIFIED_UNTYPED instead of IS_PROTOCOL_QUALIFIED_ID; add comparisons for: 'Class <Protocol> != id <Protocol>'; 'Class <Protocol> != <class> *'; 'Class <Protocol> == id' and 'Class <Protocol> == Class'. (objc_is_id): Add test for 'super'. (objc_finish_message_expr): Allow for messaging of 'Class <Proto>' receivers; if class methods are not found in protocol lists, search for instance methods therein and warn if one is found. Look in global hash tables for suitable method as a last resort when messaging 'id <Proto>', 'Class <Proto>' and invalid receiver types. (objc_add_method): Insert instance methods listed in protocols into the global class method hash table. * objc-act.h (IS_PROTOCOL_QUALIFIED_ID): Rename to IS_PROTOCOL_QUALIFIED_UNTYPED and allow for 'Class <Proto>' in addition to 'id <Proto>'. [gcc/testsuite/ChangeLog] 2004-10-25 David Ayers <d.ayers@inode.at> Ziemowit Laski <zlaski@apple.com> * objc.dg/call-super-2.m: Add messages to 'Class <Proto>'; update diagnostics when messaging 'id <Proto>'. * objc.dg/class-protocol-1.m: New test. * objc.dg/desig-init-1.m: Add message to an invalid receiver using a non-existent method signature. * objc.dg/method-5.m, objc.dg/method-6.m, objc.dg/proto-hier-1.m: Update diagnostics when messaging with non-existent method signature. * objc.dg/proto-hier-2.m: Adjust wording of diagnostic. * objc.dg/proto-lossage-1.m, objc.dg/proto-lossage-4.m: Messages to invalid receivers are now resolved as if messaging 'id'; remove extraneous diagnostics. From-SVN: r89562
2004-10-26 00:55:25 +02:00
may act as class methods as a last resort. We also add
instance methods listed in @protocol declarations to
the class hash table, on the assumption that @protocols
may be adopted by root classes or categories. */
if (TREE_CODE (class) == CATEGORY_INTERFACE_TYPE
|| TREE_CODE (class) == CATEGORY_IMPLEMENTATION_TYPE)
class = lookup_interface (CLASS_NAME (class));
c-common.h: Remove RID_ID. [gcc/ChangeLog] 2004-10-25 David Ayers <d.ayers@inode.at> * c-common.h: Remove RID_ID. * c-parse.in: Remove OBJECTNAME and references to RID_ID. (typespec_reserved_attr): Add rule for TYPENAME non_empty_protocolrefs. (yylexname): Remove special handling of RID_ID. [gcc/objc/ChangeLog] 2004-10-25 Ziemowit Laski <zlaski@apple.com> David Ayers <d.ayers@inode.at> * objc-act.c (objc_comptypes): Use IS_PROTOCOL_QUALIFIED_UNTYPED instead of IS_PROTOCOL_QUALIFIED_ID; add comparisons for: 'Class <Protocol> != id <Protocol>'; 'Class <Protocol> != <class> *'; 'Class <Protocol> == id' and 'Class <Protocol> == Class'. (objc_is_id): Add test for 'super'. (objc_finish_message_expr): Allow for messaging of 'Class <Proto>' receivers; if class methods are not found in protocol lists, search for instance methods therein and warn if one is found. Look in global hash tables for suitable method as a last resort when messaging 'id <Proto>', 'Class <Proto>' and invalid receiver types. (objc_add_method): Insert instance methods listed in protocols into the global class method hash table. * objc-act.h (IS_PROTOCOL_QUALIFIED_ID): Rename to IS_PROTOCOL_QUALIFIED_UNTYPED and allow for 'Class <Proto>' in addition to 'id <Proto>'. [gcc/testsuite/ChangeLog] 2004-10-25 David Ayers <d.ayers@inode.at> Ziemowit Laski <zlaski@apple.com> * objc.dg/call-super-2.m: Add messages to 'Class <Proto>'; update diagnostics when messaging 'id <Proto>'. * objc.dg/class-protocol-1.m: New test. * objc.dg/desig-init-1.m: Add message to an invalid receiver using a non-existent method signature. * objc.dg/method-5.m, objc.dg/method-6.m, objc.dg/proto-hier-1.m: Update diagnostics when messaging with non-existent method signature. * objc.dg/proto-hier-2.m: Adjust wording of diagnostic. * objc.dg/proto-lossage-1.m, objc.dg/proto-lossage-4.m: Messages to invalid receivers are now resolved as if messaging 'id'; remove extraneous diagnostics. From-SVN: r89562
2004-10-26 00:55:25 +02:00
if (TREE_CODE (class) == PROTOCOL_INTERFACE_TYPE
|| !CLASS_SUPER_NAME (class))
add_method_to_hash_list (cls_method_hash_list, method);
1992-01-18 00:15:38 +01:00
}
1992-01-18 00:15:38 +01:00
return method;
}
static tree
Yet more Objective-C++... * objc-act.c (objc_finish_try_stmt): Add return value. (objc_build_synchronized): Likewise. * objc-act.c (objc_is_gcable_type): Add. (objc_substitute_decl): Add. (objc_build_ivar_assignment): Add. (objc_build_global_assignment): Add. (objc_build_strong_cast_assignment): Add. (objc_is_ivar_reference_p): Add. (objc_is_global_reference_p): Add. (objc_generate_write_barrier): Add. (objc_rewrite_function_call): Add. (objc_gimplify_expr): Add Objective-C++ support. * objc-act.h (ALLOC_OBJC_TYPE_LANG_SPECIFIC): Likewise. (SIZEOF_OBJC_TYPE_LANG_SPECIFIC): Add. (INIT_TYPE_OBJC_INFO): Add Objective-C++ support. (DUP_TYPE_OBJC_INFO): Likewise. (struct imp_entry): Add field has_cxx_cdtors. (struct imp_entry *imp_list): Add OCTI_UMSG_FAST_DECL, OCTI_METH_LIST_TEMPL, OCTI_METH_PROTO_LIST_TEMPL, OCTI_IVAR_LIST_TEMPL, OCTI_ASSIGN_IVAR_DECL, OCTI_ASSIGN_IVAR_FAST_DECL, OCTI_ASSIGN_GLOBAL_DECL, OCTI_ASSIGN_STRONGCAST_DECL. (umsg_fast_decl): Add. (objc_assign_ivar_decl): Add. (objc_assign_ivar_fast_decl): Add. (objc_assign_global_decl): Add. (objc_assign_strong_cast_decl): Add. (objc_method_list_ptr): Add. (objc_method_proto_list_ptr): Add. (objc_ivar_list_ptr): Add. * objc-act.c (should_call_super_dealloc): Add. (OBJC_VERSION): Bump to 6. (objc_is_gcable_type): Add. (objc_substitute_decl): Add. (objc_build_ivar_assignment): Add. (objc_build_global_assignment): Add. (objc_build_strong_cast_assignment): Add. (objc_is_gcable_p): Add. (objc_is_ivar_reference_p): Add. (objc_is_global_reference_p): Add. (generate_shared_structures): Add flags parameter. (objc_generate_cxx_ctor_or_dtor): Add. (objc_generate_cxx_cdtors): Add. (add_class): Add name parameter. (objc_types_share_size_and_alignment): Add. (comp_proto_with_proto): Add strict parameter. (CLS_HAS_CXX_STRUCTORS): Add. (TAG_ASSIGNIVAR): Add. (TAG_ASSIGNGLOBAL): Add. (TAG_ASSIGNSTRONGCAST): Add. (TAG_MSGSEND_FAST): Add. (TAG_ASSIGNIVAR_FAST): Add. (TAG_CXX_CONSTRUCT): Add. (TAG_CXX_DESTRUCT): Add. (OBJC_LOOKUP_CLASS): Add. (OBJC_LOOKUP_NO_SUPER): Add. (objc_finish_file): Add pch support. (objc_finish_implementation): Add Objective-C++ support. (synth_module_prologue): Likewise. (synth_module_prologue): Add fast dispatching. (objc_get_class_reference): Add Objective-C++ support. (objc_generate_write_barrier): Likewise. (next_sjlj_build_enter_and_setjmp): Likewise. (objc_begin_try_stmt): Likewise. (build_next_objc_exception_stuff): Add fast ivar support. (build_private_template): Mark the record as used so debug information is generated. (build_protocol_template): Add Objective-C++ support. (objc_method_parm_type) Likewise. (objc_generate_cxx_ctor_or_dtor): Likewise. (objc_generate_cxx_cdtors): Likewise. (build_protocol_initializer): Likewise. (build_category_template): Likewise. (build_class_template): Likewise. (build_method_list_template): Likewise. (build_category_initializer): Likewise. (build_shared_structure_initializer): Likewise. (objc_finish_message_expr): Likewise. (build_objc_method_call): Add fast dispatch support. (lookup_method_static): Add support to end search at superclasses. (add_method_to_hash_list): Add strict parameter to comp_proto_with_proto. (objc_add_method): Likewise. (objc_add_method): Also set the interface_value. (add_instance_variable): Add Objective-C++ support. (objc_is_public): Likewise. (start_class): Likewise. (continue_class): Likewise. (encode_aggregate_within): Likewise. (start_method_def): Likewise. (objc_start_function): Clear current_function_returns_value and current_function_returns_null. (really_start_method): Add Objective-C++ support. (objc_finish_method_definition): Add warning for missing [super dealloc]. (finish_objc): Add Objective-C++ support. (generate_objc_image_info): Likewise. (objc_lookup_ivar): Likewise. * objc-act.h (TYPE_HAS_OBJC_INFO): Likewise. (INIT_TYPE_OBJC_INFO): Likewise. (DUP_TYPE_OBJC_INFO): Likewise. From-SVN: r99857
2005-05-17 22:07:08 +02:00
add_class (tree class_name, tree name)
1992-01-18 00:15:38 +01:00
{
Yet more Objective-C++... * objc-act.c (objc_finish_try_stmt): Add return value. (objc_build_synchronized): Likewise. * objc-act.c (objc_is_gcable_type): Add. (objc_substitute_decl): Add. (objc_build_ivar_assignment): Add. (objc_build_global_assignment): Add. (objc_build_strong_cast_assignment): Add. (objc_is_ivar_reference_p): Add. (objc_is_global_reference_p): Add. (objc_generate_write_barrier): Add. (objc_rewrite_function_call): Add. (objc_gimplify_expr): Add Objective-C++ support. * objc-act.h (ALLOC_OBJC_TYPE_LANG_SPECIFIC): Likewise. (SIZEOF_OBJC_TYPE_LANG_SPECIFIC): Add. (INIT_TYPE_OBJC_INFO): Add Objective-C++ support. (DUP_TYPE_OBJC_INFO): Likewise. (struct imp_entry): Add field has_cxx_cdtors. (struct imp_entry *imp_list): Add OCTI_UMSG_FAST_DECL, OCTI_METH_LIST_TEMPL, OCTI_METH_PROTO_LIST_TEMPL, OCTI_IVAR_LIST_TEMPL, OCTI_ASSIGN_IVAR_DECL, OCTI_ASSIGN_IVAR_FAST_DECL, OCTI_ASSIGN_GLOBAL_DECL, OCTI_ASSIGN_STRONGCAST_DECL. (umsg_fast_decl): Add. (objc_assign_ivar_decl): Add. (objc_assign_ivar_fast_decl): Add. (objc_assign_global_decl): Add. (objc_assign_strong_cast_decl): Add. (objc_method_list_ptr): Add. (objc_method_proto_list_ptr): Add. (objc_ivar_list_ptr): Add. * objc-act.c (should_call_super_dealloc): Add. (OBJC_VERSION): Bump to 6. (objc_is_gcable_type): Add. (objc_substitute_decl): Add. (objc_build_ivar_assignment): Add. (objc_build_global_assignment): Add. (objc_build_strong_cast_assignment): Add. (objc_is_gcable_p): Add. (objc_is_ivar_reference_p): Add. (objc_is_global_reference_p): Add. (generate_shared_structures): Add flags parameter. (objc_generate_cxx_ctor_or_dtor): Add. (objc_generate_cxx_cdtors): Add. (add_class): Add name parameter. (objc_types_share_size_and_alignment): Add. (comp_proto_with_proto): Add strict parameter. (CLS_HAS_CXX_STRUCTORS): Add. (TAG_ASSIGNIVAR): Add. (TAG_ASSIGNGLOBAL): Add. (TAG_ASSIGNSTRONGCAST): Add. (TAG_MSGSEND_FAST): Add. (TAG_ASSIGNIVAR_FAST): Add. (TAG_CXX_CONSTRUCT): Add. (TAG_CXX_DESTRUCT): Add. (OBJC_LOOKUP_CLASS): Add. (OBJC_LOOKUP_NO_SUPER): Add. (objc_finish_file): Add pch support. (objc_finish_implementation): Add Objective-C++ support. (synth_module_prologue): Likewise. (synth_module_prologue): Add fast dispatching. (objc_get_class_reference): Add Objective-C++ support. (objc_generate_write_barrier): Likewise. (next_sjlj_build_enter_and_setjmp): Likewise. (objc_begin_try_stmt): Likewise. (build_next_objc_exception_stuff): Add fast ivar support. (build_private_template): Mark the record as used so debug information is generated. (build_protocol_template): Add Objective-C++ support. (objc_method_parm_type) Likewise. (objc_generate_cxx_ctor_or_dtor): Likewise. (objc_generate_cxx_cdtors): Likewise. (build_protocol_initializer): Likewise. (build_category_template): Likewise. (build_class_template): Likewise. (build_method_list_template): Likewise. (build_category_initializer): Likewise. (build_shared_structure_initializer): Likewise. (objc_finish_message_expr): Likewise. (build_objc_method_call): Add fast dispatch support. (lookup_method_static): Add support to end search at superclasses. (add_method_to_hash_list): Add strict parameter to comp_proto_with_proto. (objc_add_method): Likewise. (objc_add_method): Also set the interface_value. (add_instance_variable): Add Objective-C++ support. (objc_is_public): Likewise. (start_class): Likewise. (continue_class): Likewise. (encode_aggregate_within): Likewise. (start_method_def): Likewise. (objc_start_function): Clear current_function_returns_value and current_function_returns_null. (really_start_method): Add Objective-C++ support. (objc_finish_method_definition): Add warning for missing [super dealloc]. (finish_objc): Add Objective-C++ support. (generate_objc_image_info): Likewise. (objc_lookup_ivar): Likewise. * objc-act.h (TYPE_HAS_OBJC_INFO): Likewise. (INIT_TYPE_OBJC_INFO): Likewise. (DUP_TYPE_OBJC_INFO): Likewise. From-SVN: r99857
2005-05-17 22:07:08 +02:00
struct interface_tuple **slot;
1996-07-04 00:07:53 +02:00
/* Put interfaces on list in reverse order. */
Yet more Objective-C++... * objc-act.c (objc_finish_try_stmt): Add return value. (objc_build_synchronized): Likewise. * objc-act.c (objc_is_gcable_type): Add. (objc_substitute_decl): Add. (objc_build_ivar_assignment): Add. (objc_build_global_assignment): Add. (objc_build_strong_cast_assignment): Add. (objc_is_ivar_reference_p): Add. (objc_is_global_reference_p): Add. (objc_generate_write_barrier): Add. (objc_rewrite_function_call): Add. (objc_gimplify_expr): Add Objective-C++ support. * objc-act.h (ALLOC_OBJC_TYPE_LANG_SPECIFIC): Likewise. (SIZEOF_OBJC_TYPE_LANG_SPECIFIC): Add. (INIT_TYPE_OBJC_INFO): Add Objective-C++ support. (DUP_TYPE_OBJC_INFO): Likewise. (struct imp_entry): Add field has_cxx_cdtors. (struct imp_entry *imp_list): Add OCTI_UMSG_FAST_DECL, OCTI_METH_LIST_TEMPL, OCTI_METH_PROTO_LIST_TEMPL, OCTI_IVAR_LIST_TEMPL, OCTI_ASSIGN_IVAR_DECL, OCTI_ASSIGN_IVAR_FAST_DECL, OCTI_ASSIGN_GLOBAL_DECL, OCTI_ASSIGN_STRONGCAST_DECL. (umsg_fast_decl): Add. (objc_assign_ivar_decl): Add. (objc_assign_ivar_fast_decl): Add. (objc_assign_global_decl): Add. (objc_assign_strong_cast_decl): Add. (objc_method_list_ptr): Add. (objc_method_proto_list_ptr): Add. (objc_ivar_list_ptr): Add. * objc-act.c (should_call_super_dealloc): Add. (OBJC_VERSION): Bump to 6. (objc_is_gcable_type): Add. (objc_substitute_decl): Add. (objc_build_ivar_assignment): Add. (objc_build_global_assignment): Add. (objc_build_strong_cast_assignment): Add. (objc_is_gcable_p): Add. (objc_is_ivar_reference_p): Add. (objc_is_global_reference_p): Add. (generate_shared_structures): Add flags parameter. (objc_generate_cxx_ctor_or_dtor): Add. (objc_generate_cxx_cdtors): Add. (add_class): Add name parameter. (objc_types_share_size_and_alignment): Add. (comp_proto_with_proto): Add strict parameter. (CLS_HAS_CXX_STRUCTORS): Add. (TAG_ASSIGNIVAR): Add. (TAG_ASSIGNGLOBAL): Add. (TAG_ASSIGNSTRONGCAST): Add. (TAG_MSGSEND_FAST): Add. (TAG_ASSIGNIVAR_FAST): Add. (TAG_CXX_CONSTRUCT): Add. (TAG_CXX_DESTRUCT): Add. (OBJC_LOOKUP_CLASS): Add. (OBJC_LOOKUP_NO_SUPER): Add. (objc_finish_file): Add pch support. (objc_finish_implementation): Add Objective-C++ support. (synth_module_prologue): Likewise. (synth_module_prologue): Add fast dispatching. (objc_get_class_reference): Add Objective-C++ support. (objc_generate_write_barrier): Likewise. (next_sjlj_build_enter_and_setjmp): Likewise. (objc_begin_try_stmt): Likewise. (build_next_objc_exception_stuff): Add fast ivar support. (build_private_template): Mark the record as used so debug information is generated. (build_protocol_template): Add Objective-C++ support. (objc_method_parm_type) Likewise. (objc_generate_cxx_ctor_or_dtor): Likewise. (objc_generate_cxx_cdtors): Likewise. (build_protocol_initializer): Likewise. (build_category_template): Likewise. (build_class_template): Likewise. (build_method_list_template): Likewise. (build_category_initializer): Likewise. (build_shared_structure_initializer): Likewise. (objc_finish_message_expr): Likewise. (build_objc_method_call): Add fast dispatch support. (lookup_method_static): Add support to end search at superclasses. (add_method_to_hash_list): Add strict parameter to comp_proto_with_proto. (objc_add_method): Likewise. (objc_add_method): Also set the interface_value. (add_instance_variable): Add Objective-C++ support. (objc_is_public): Likewise. (start_class): Likewise. (continue_class): Likewise. (encode_aggregate_within): Likewise. (start_method_def): Likewise. (objc_start_function): Clear current_function_returns_value and current_function_returns_null. (really_start_method): Add Objective-C++ support. (objc_finish_method_definition): Add warning for missing [super dealloc]. (finish_objc): Add Objective-C++ support. (generate_objc_image_info): Likewise. (objc_lookup_ivar): Likewise. * objc-act.h (TYPE_HAS_OBJC_INFO): Likewise. (INIT_TYPE_OBJC_INFO): Likewise. (DUP_TYPE_OBJC_INFO): Likewise. From-SVN: r99857
2005-05-17 22:07:08 +02:00
TREE_CHAIN (class_name) = interface_chain;
interface_chain = class_name;
if (interface_htab == NULL)
interface_htab = htab_create_ggc (31, hash_interface, eq_interface, NULL);
slot = (struct interface_tuple **)
htab_find_slot_with_hash (interface_htab, name,
IDENTIFIER_HASH_VALUE (name),
Yet more Objective-C++... * objc-act.c (objc_finish_try_stmt): Add return value. (objc_build_synchronized): Likewise. * objc-act.c (objc_is_gcable_type): Add. (objc_substitute_decl): Add. (objc_build_ivar_assignment): Add. (objc_build_global_assignment): Add. (objc_build_strong_cast_assignment): Add. (objc_is_ivar_reference_p): Add. (objc_is_global_reference_p): Add. (objc_generate_write_barrier): Add. (objc_rewrite_function_call): Add. (objc_gimplify_expr): Add Objective-C++ support. * objc-act.h (ALLOC_OBJC_TYPE_LANG_SPECIFIC): Likewise. (SIZEOF_OBJC_TYPE_LANG_SPECIFIC): Add. (INIT_TYPE_OBJC_INFO): Add Objective-C++ support. (DUP_TYPE_OBJC_INFO): Likewise. (struct imp_entry): Add field has_cxx_cdtors. (struct imp_entry *imp_list): Add OCTI_UMSG_FAST_DECL, OCTI_METH_LIST_TEMPL, OCTI_METH_PROTO_LIST_TEMPL, OCTI_IVAR_LIST_TEMPL, OCTI_ASSIGN_IVAR_DECL, OCTI_ASSIGN_IVAR_FAST_DECL, OCTI_ASSIGN_GLOBAL_DECL, OCTI_ASSIGN_STRONGCAST_DECL. (umsg_fast_decl): Add. (objc_assign_ivar_decl): Add. (objc_assign_ivar_fast_decl): Add. (objc_assign_global_decl): Add. (objc_assign_strong_cast_decl): Add. (objc_method_list_ptr): Add. (objc_method_proto_list_ptr): Add. (objc_ivar_list_ptr): Add. * objc-act.c (should_call_super_dealloc): Add. (OBJC_VERSION): Bump to 6. (objc_is_gcable_type): Add. (objc_substitute_decl): Add. (objc_build_ivar_assignment): Add. (objc_build_global_assignment): Add. (objc_build_strong_cast_assignment): Add. (objc_is_gcable_p): Add. (objc_is_ivar_reference_p): Add. (objc_is_global_reference_p): Add. (generate_shared_structures): Add flags parameter. (objc_generate_cxx_ctor_or_dtor): Add. (objc_generate_cxx_cdtors): Add. (add_class): Add name parameter. (objc_types_share_size_and_alignment): Add. (comp_proto_with_proto): Add strict parameter. (CLS_HAS_CXX_STRUCTORS): Add. (TAG_ASSIGNIVAR): Add. (TAG_ASSIGNGLOBAL): Add. (TAG_ASSIGNSTRONGCAST): Add. (TAG_MSGSEND_FAST): Add. (TAG_ASSIGNIVAR_FAST): Add. (TAG_CXX_CONSTRUCT): Add. (TAG_CXX_DESTRUCT): Add. (OBJC_LOOKUP_CLASS): Add. (OBJC_LOOKUP_NO_SUPER): Add. (objc_finish_file): Add pch support. (objc_finish_implementation): Add Objective-C++ support. (synth_module_prologue): Likewise. (synth_module_prologue): Add fast dispatching. (objc_get_class_reference): Add Objective-C++ support. (objc_generate_write_barrier): Likewise. (next_sjlj_build_enter_and_setjmp): Likewise. (objc_begin_try_stmt): Likewise. (build_next_objc_exception_stuff): Add fast ivar support. (build_private_template): Mark the record as used so debug information is generated. (build_protocol_template): Add Objective-C++ support. (objc_method_parm_type) Likewise. (objc_generate_cxx_ctor_or_dtor): Likewise. (objc_generate_cxx_cdtors): Likewise. (build_protocol_initializer): Likewise. (build_category_template): Likewise. (build_class_template): Likewise. (build_method_list_template): Likewise. (build_category_initializer): Likewise. (build_shared_structure_initializer): Likewise. (objc_finish_message_expr): Likewise. (build_objc_method_call): Add fast dispatch support. (lookup_method_static): Add support to end search at superclasses. (add_method_to_hash_list): Add strict parameter to comp_proto_with_proto. (objc_add_method): Likewise. (objc_add_method): Also set the interface_value. (add_instance_variable): Add Objective-C++ support. (objc_is_public): Likewise. (start_class): Likewise. (continue_class): Likewise. (encode_aggregate_within): Likewise. (start_method_def): Likewise. (objc_start_function): Clear current_function_returns_value and current_function_returns_null. (really_start_method): Add Objective-C++ support. (objc_finish_method_definition): Add warning for missing [super dealloc]. (finish_objc): Add Objective-C++ support. (generate_objc_image_info): Likewise. (objc_lookup_ivar): Likewise. * objc-act.h (TYPE_HAS_OBJC_INFO): Likewise. (INIT_TYPE_OBJC_INFO): Likewise. (DUP_TYPE_OBJC_INFO): Likewise. From-SVN: r99857
2005-05-17 22:07:08 +02:00
INSERT);
if (!*slot)
{
*slot = (struct interface_tuple *) ggc_alloc_cleared (sizeof (struct interface_tuple));
(*slot)->id = name;
}
(*slot)->class_name = class_name;
1992-01-18 00:15:38 +01:00
return interface_chain;
}
static void
add_category (tree class, tree category)
1992-01-18 00:15:38 +01:00
{
1996-07-04 00:07:53 +02:00
/* Put categories on list in reverse order. */
tree cat = lookup_category (class, CLASS_SUPER_NAME (category));
if (cat)
{
diagnostic.c (warning): Accept parameter to classify warning option. * diagnostic.c (warning): Accept parameter to classify warning option. (warning0): New, for when a pointer to an error() like function is needed. * errors.c (warning): Likewise. * errors.h (warning, warning0): Adjust prototypes. * toplev.h (warning, warning0): Likewise. * attribs.c, builtins.c, c-common.c, c-decl.c, c-format.c, c-gimplify.c, c-lex.c, c-objc-common.c, c-opts.c, c-parser.c, c-pragma.c, c-typeck.c, calls.c, cgraph.c, coverage.c, emit-rtl.c, fold-const.c, fortran/trans-decl.c, function.c, gcse.c, genautomata.c, haifa-sched.c, opts.c, passes.c, regclass.c, reload1.c, stmt.c, stor-layout.c, toplev.c, tree-cfg.c, tree-dump.c, tree-inline.c, tree-mudflap.c, tree-optimize.c, tree-ssa.c, tree.c, varasm.c: Adjust warning() callers. * config/alpha/alpha.c, config/arc/arc.c, config/arm/arm.c, config/avr/avr.c, config/bfin/bfin.c, config/c4x/c4x-c.c, config/c4x/c4x.c, config/cris/cris.c, config/darwin-c.c, config/darwin.c, config/darwin.h, config/h8300/h8300.c, config/i386/cygming.h, config/i386/djgpp.h, config/i386/i386.c, config/i386/winnt.c, config/ia64/ia64-c.c, config/ia64/ia64.c, config/ip2k/ip2k.c, config/m32r/m32r.c, config/m68hc11/m68hc11.c, config/m68k/m68k.c, config/mcore/mcore.c, config/mips/mips.c, config/mmix/mmix.c, config/ns32k/ns32k.c, config/pa/pa-hpux11.h, config/pa/pa.c, config/rs6000/aix43.h, config/rs6000/aix51.h, config/rs6000/aix52.h, config/rs6000/darwin.h, config/rs6000/rs6000-c.c, config/rs6000/rs6000.c, config/s390/s390.c, config/sh/sh.c, config/sh/sh.h, config/sh/symbian.c, config/sol2-c.c, config/sol2.c, config/stormy16/stormy16.c, config/v850/v850-c.c, config/v850/v850.c, config/xtensa/xtensa.c: Adjust warning() callers. * ada/misc.c: Adjust warning() callers. * cp/call.c, cp/class.c, cp/cvt.c, cp/decl.c, cp/decl2.c, cp/except.c, cp/friend.c, cp/init.c, cp/lex.c, cp/mangle.c, cp/method.c, cp/name-lookup.c, cp/parser.c, cp/repo.c, cp/rtti.c, cp/tree.c, cp/typeck.c, cp/typeck2.c: Adjust warning() callers. * fortran/trans-decl.c: Adjust warning() callers. * java/class.c, java/decl.c, java/expr.c, java/jcf-io.c, java/jcf-parse.c, java/jv-scan.c, java/parse.y: Adjust warning() callers. * objc/objc-act.c: Adjust warning() callers. * treelang/parse.y: Adjust warning() callers. From-SVN: r98633
2005-04-23 23:29:07 +02:00
warning (0, "duplicate interface declaration for category %<%s(%s)%>",
IDENTIFIER_POINTER (CLASS_NAME (class)),
IDENTIFIER_POINTER (CLASS_SUPER_NAME (category)));
}
else
{
CLASS_CATEGORY_LIST (category) = CLASS_CATEGORY_LIST (class);
CLASS_CATEGORY_LIST (class) = category;
}
1992-01-18 00:15:38 +01:00
}
/* Called after parsing each instance variable declaration. Necessary to
preserve typedefs and implement public/private...
PUBLIC is 1 for public, 0 for protected, and 2 for private. */
Makefile.in (c-parse.o): Depend on $(C_COMMON_H). [gcc/ChangeLog] 2004-09-07 Ziemowit Laski <zlaski@apple.com> * Makefile.in (c-parse.o): Depend on $(C_COMMON_H). * c-parse.in: Include c-common.h instead of objc-act.h. (ivar_decl_list, ivar_decls, ivar_decl, ivars, ivar_declarator, myparms, myparm): Remove %type declarations. (methodtype, optparms, OBJC_TYPE_QUAL, objc_quals, objc_qual, objc_typename, objc_try_catch_stmt, optellipsis): Add %type declarations. (objc_inherit_code, objc_public_flag): Remove. (typespec_nonreserved_nonattr): Call objc_get_protocol_qualified_type() instead of get_static_reference() and get_protocol_reference(). (stmt_nocomp): Call grokparm() on @catch parameter. (objcdef): Move semantic action to objc_finish_implementation(). (classdef): Move semantic action to objc_start_class_interface(), objc_continue_interface(), objc_finish_interface(), objc_start_class_implementation(), objc_continue_implementation(), objc_start_category_interface() and objc_start_category_implementation(). (protocoldef): Move semantic actions to objc_start_protocol() and objc_finish_interface(). (ivar_decl_list): Remove nonterminal. (visibility_spec): Move semantic actions to objc_set_visibility(). (ivar_decls): Remove assignment to $$. (ivar_decl): Rephrase in terms of component_decl; call objc_add_instance_variable(). (ivars, ivar_declarator): Remove nonterminals. (opt_semi): New nonterminal. (methodtype): Remove semantic actions. (methoddef): Move semantic actions to objc_set_method_type(), objc_start_method_definition() and objc_finish_method_definition(). (methodproto): Move semantic actions to objc_set_method_type() and objc_add_method_declaration(). (methoddecl): Use objc_typename instead of typename; move semantic actions to objc_build_method_signature(). (optarglist, myxdecls, mydecl, myparms, myparm): Remove nonterminals. (optparmlist): Express in terms of optparms and optellipsis. (optparms, optellipsis, objc_qual, objc_quals, objc_typename): New nonterminals. (keyworddecl): Use objc_typename instead of typename. (rid_to_yy): Mark RID_IN, RID_OUT, RID_INOUT, RID_BYCOPY, RID_BYREF and RID_ONEWAY as returning OBJC_TYPE_QUAL to yyparse(). [gcc/objc/ChangeLog] 2004-09-07 Ziemowit Laski <zlaski@apple.com> * Make-lang.in (objc/objc-parse.o): Depend on $(C_COMMON_H) instead of objc/objc-act.h. (objc/objc-act.o): Depend on $(HASHTAB_H). * objc-act.c: Include hashtab.h; in ObjC++ mode, include cp-tree.h and objcp-decl.h instead of c-tree.h. (build_module_descriptor, get_class_ivars, synth_id_with_class_suffix, error_with_ivar, gen_method_decl, gen_declaration, setup_string_decl, build_protocol_template): Adjust prototypes. (build_module_initializer_routine, start_class, continue_class, finish_class, start_method_def, objc_start_function, start_protocol, build_method_decl, objc_add_method, add_instance_variable, build_ivar_reference, is_ivar, is_private, get_super_receiver, build_selector_table_decl, objc_push_parm, objc_get_parm_info, gen_type_name, gen_type_name_0, start_var_decl, finish_var_decl, create_field_decl): New prototypes. (objc_expand_function_end, comp_method_with_proto, objc_expr_last, gen_declaration_1, gen_declarator, is_complex_decl, adorn_decl, define_decl, create_builtin_decl, gen_declspecs): Remove prototypes. (TYPE_ID): Rename to OBJECT_TYPEDEF_NAME. (CLASS_TYPEDEF_NAME): New. (TAG_EXECCLASS): Change from a global variable to a #define. (TAG_RETURN_STRUCT): Delete. (TAG_GNUINIT): New, holds '__objc_gnu_init' name. (objc_inherit_code, objc_public_flag): New, moved from c-parse.in. (string_descriptor): New struct. (string_htab): New hash table. (string_hash, string_eq): New prototypes. (generate_struct_by_value_array): Call create_field_decl() instead of create_builtin_decl(). (objc_init): Do not initialize objc_ellipsis_node or TAG_EXECCLASS; In ObjC++ mode, call cxx_init() instead of c_objc_common_init(). (objc_finish_file): In ObjC++, call instantiate_pending_templates() and cp_finish_file(). (define_decl, get_static_reference, get_protocol_reference, create_builtin_decl): Remove functions. (objc_start_class_interface, objc_start_category_interface, objc_start_protocol, objc_continue_interface, objc_finish_interface, objc_start_class_implementation, objc_start_category_implementation, objc_continue_implementation, objc_finish_implementation, objc_set_visibility, objc_set_method_type, objc_build_method_signature, objc_add_method_declaration, objc_start_method_definition, objc_add_instance_variable, objc_get_protocol_qualified_type, create_field_decl, start_var_decl, finish_var_decl): New functions. (setup_string_decl): Simplify since it is only called once. (synth_module_prologue): Call build_class_template(); predefine 'id' and 'Class' as typedefs; rename 'temp_type' to 'type'; disable debug hooks for duration of function; fix GNU runtime messenger signatures to correspond to reality; forward-declare '__objc_exec_class' for the GNU runtime; call build_selector_table_decl(); in ObjC++ mode, generate 'extern "C" { ... }' wrappers around synthesized declarations; call build_protocol_template() and build_category_template(). (string_hash, string_eq): New functions. (objc_build_string_object): Check metaclass correctness only once; store string literals in hash table. (objc_build_constructor): Do not convert initializer elements; adjust for ObjC++ impedance mismatch. (build_objc_symtab_template): Call create_field_decl() instead of create_builtin_decl(). (init_objc_symtab): Add missing conversion to initializer element. (build_metadata_decl): Call start_var_decl() instead of define_decl(). (generate_objc_symtab_decl): Do not call build_category_template(); call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(). (build_module_descriptor): Call create_field_decl() instead of grokfield(); call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(); always mark module descriptor as used; move GNU runtime-specific functionality to build_module_initializer_routine(). (build_module_initializer_routine): New function, broken off of build_module_descriptor(). (objc_static_init_needed_p, objc_generate_static_init_call): New functions. (generate_static_references, generate_strings, build_selector_translation_table, generate_descriptor_table, generate_ivars_list, generate_dispatch_table, generate_category): Call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(); build a type directly instead of via groktypename(). (build_selector_reference_decl, build_selector_table_decl, build_class_reference_decl, build_protocol_reference, generate_objc_image_info): Call start_var_decl() instead of build_decl(). (build_selector_reference): For GNU runtime, do not call build_selector_reference_decl(). (build_selector, build_typed_selector_reference): Always convert result to the selector type. (add_objc_string): Cast return value to 'char *'. (build_method_prototype_template, build_selector_template, build_method_template): Use actual selector type for fields pointing to selectors. (finish_objc): For GNU runtime, call build_module_initializer_routine() after build_module_descriptor(). (generate_protocol_list, generate_shared_structures): Call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(); build a type directly instead of via groktypename(). (synth_id_with_class_suffix): Return a string. (get_arg_type_list): For instance methods, use the instance type for 'self'; do not call groktypename_in_parm_context(). (build_objc_string_decl): Squash redeclaration errors in ObjC++. (objc_is_class_name): Use OBJC_TYPE_NAME instead of TYPE_NAME; handle RECORD_TYPEs in ObjC as well as ObjC++. (objc_is_id): New function. (objc_is_object_ptr): Return the canonical type node. (objc_get_class_ivars): Simplify using get_class_ivars(). (get_class_ivars): Remove second parameter; create a fresh copy of the ivar list for each call; do not check for existence of super class. (objc_eh_runtime_type): Mark #ifndef OBJCPLUS. (objc_init_exceptions): When using SJLJ-style exceptions, require the use of '-fobjc-exceptions' flag; do not require it for DWARF-style exceptions. (objc_build_exc_ptr, next_sjlj_build_try_catch_finally): Use objc_object_type instead of objc_id_type. (objc_begin_catch_clause): Convert the incoming PARM_DECL into a VAR_DECL before placing it in the appropriate scope; do not call define_decl(); adjust call to c_begin_compound_stmt(); use objc_object_type instead of objc_id_type. (build_next_objc_exception_stuff): Call create_field_decl() instead of create_builtin_decl(); construct type directly instead of calling groktypename(); use OBJC_VOID_AT_END to mark end of function parameters. (build_private_template): Adjust call to get_class_ivars(); build a type directly instead of via groktypename(). (build_protocol_template, build_method_prototype_list_template, build_method_prototype_template, build_category_template, build_selector_template, build_class_template, build_super_template, build_ivar_template, build_ivar_list_template, build_method_list_template, build_method_template): Call create_field_decl() instead of grokfield(). (objc_method_parm_type): Do not call groktypename(). (generate_descriptor_table): Call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(). (generate_method_descriptors, build_protocol_initializer, generate_dispatch_tables, build_category_initializer, build_shared_structure_initializer): Do not call groktypename(). (generate_protocols): Call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(); do not call groktypename(). (error_with_ivar): Remove last parameter. (check_ivars): Do not iterate ovar CLASS_RAW_IVARS lists in addition to CLASS_IVARS lists; adjust calls to error_with_ivar(). (generate_ivar_lists): Convert one of the initializer elements; do not call groktypename(). (get_arg_type_list, start_method_def, gen_method_def): Account for new representation of variable arguments and '...' in Objective-C methods; add Objective-C++ impedance matching code. (is_objc_type_qualifier): Remove function. (adjust_type_for_id_default): Simplify; there is no longer a need to wade through declspecs. (lookup_interface, start_class, continue_class, finish_class, start_method_def, start_protocol, build_method_decl, objc_add_method, add_instance_variable, build_ivar_reference, is_ivar, is_private, get_super_receiver, objc_build_finally_epilogue): Make into static functions. (receiver_is_class_object): Use new IS_CLASS() macro. (objc_build_message_expr): Tweak ObjC++ message argument handling; call objc_finish_message_expr() instead of finish_message_expr(). (finish_message_expr): Rename to objc_finish_message_expr(); use OBJC_TYPE_NAME and OBJC_SET_TYPE_NAME macros instead of TYPE_NAME. call gen_type_name() instead of gen_declaration(); call objc_is_id() instead of using IS_ID and IS_CLASS; Use objc_class_name instead of calling get_identifier("Class"); handle CONVERT_EXPRs in receiver. (build_objc_method_call, warn_with_method): Do not call groktypename(). (build_ivar_reference): Call convert() instead of clobbering in a type. (hash_init): Initialize string_htab hash table. (add_instance_variable): Simplify parameter list; do not call grokfield(); do not populate CLASS_IVARS list. (start_class): Check for the existence of super class, if one was specified. (continue_class): Use CLASS_RAW_IVARS rather than CLASS_IVARS; do not call build_class_template(); adjust call to get_class_ivars(); call build_decl(), pushdecl() and finish_decl() instead of define_decl(). (finish_class): Call build_decl(), pushdecl() and finish_decl() instead of define_decl(). (add_protocols): Use PROTOCOL_BINFO_ELTS for the tree vector size. (start_protocol): Do not call build_protocol_template(); use PROTOCOL_BINFO_ELTS for the tree vector size. (encode_type_qualifiers): Do not handle the 'const' qualifier here. (encode_pointer): Encode 'const char *' as 'r*', for backwards compatibility. (encode_array): Use HOST_WIDE_INT_PRINT_DEC instead of "%ld". (encode_type): Handle the 'const' qualifier here. (objc_parmlist): New global variable, sued by objc_push_parm and objc_get_parm_info(). (objc_push_parm, objc_get_parm_info): New functions. (objc_expr_last): Remove function. (synth_self_and_ucmd_args): For instance methods, use the instance type for 'self'; call objc_push_parm() instead of push_parm_decl(). (start_method_def): Do not call push_scope(), declare_parm_level(), pop_scope(), push_parm_decl(), store_parm_decls() or objc_expr_last(); just use objc_push_parm() and objc_get_parm_info(). (comp_method_with_proto): Remove function. (objc_types_are_equivalent): Strip away indirections before comparing underlying types. (comp_proto_with_proto): Do not call groktypename(); types are no longer in raw declspec format. (objc_start_function): New function. (really_start_method): Call comp_proto_with_proto() instead of comp_method_with_proto(); call objc_start_function() instead of hand-crafting a function declarator. (continue_method_def, objc_expand_function_end): Remove functions. (get_super_receiver): Call objc_get_current_scope() instead of get_current_scope(); reference 'super_class' field (instead of 'class'). (finish_method_def): Rename to objc_finish_method_definition() and add a function decl parameter; move method encoding call from objc_expand_function_end(). (is_complex_decl, adorn_decl, gen_declarator, gen_declspecs, gen_declaration_1): Remove functions. (tmpbuf, RAW_DECLSPEC): Remove. (gen_declaration): Remove second parameter; simplify to deal with TYPE_P nodes instead of raw declspecs. (gen_type_name, gen_type_name_0): New functions. (gen_method_decl): Remove second parameter; call gen_type_name() instead of gen_declaration_1(). (dump_interface): Adjust calls to gen_declaration() and gen_method_decl(); do not allocate a separate string buffer. (init_objc): Allocate a larger string buffer to accommodate dump_interface(); adjust call to build_module_descriptor(); add call to build_module_initializer_routine() for the GNU runtime. (generate_classref_translation_entry): Do not call start_decl(); call finish_var_decl() instead of finish_decl(); call convert() instead of build_c_cast(). * objc-act.h (CLASS_OWN_IVARS): Remove accessor. (CLASS_BINFO_ELTS): Reduce from 6 to 5, now that CLASS_OWN_IVARS is gone. (OCTI_GNU_INIT_DECL, GNU_INIT_decl): New. (OCTI_ELLIPSIS_NODE, objc_ellipsis_node): Remove. (OCTI_ID_ID, id_type, objc_id_id): Rename to OCTI_ID_NAME, objc_object_type and objc_object_name, respectively. (OCTI_CLS_REF, OCTI_CLASS_NAME, objc_class_reference, objc_class_name): New. (IS_CLASS): New macro. (IS_ID, IS_SUPER): Robustify. (OCTI_EXECCLASS_DECL, execclass_decl): New. (finish_file, start_class, continue_class, finish_class, start_method_def, continue_method_def, finish_method_def, start_protocol, finish_protocol, objc_build_throw_stmt, objc_build_try_catch_finally_stmt, objc_build_synchronized_prologue, objc_build_synchronized_epilogue, objc_build_try_prologue, objc_build_try_epilogue, objc_build_catch_stmt, objc_build_catch_epilogue, objc_build_finally_prologue, objc_build_finally_epilogue, is_ivar, is_private, is_public, add_instance_variable, objc_add_method, get_super_receiver, objc_clear_super_receiver, get_class_ivars_from_name, get_class_reference, get_static_reference, get_object_reference, build_message_expr, finish_message_expr, build_selector_expr, build_ivar_reference, build_keyword_decl, build_method_decl, build_protocol_expr, build_objc_string_object, objc_declare_alias, objc_declare_class, objc_declare_protocols, objc_comptypes, objc_check_decl, build_encode_expr): Remove prototypes. (imp_count, cat_count): Make GGC-aware. (OBJC_SET_TYPE_NAME): New macro. From-SVN: r87168
2004-09-08 02:49:44 +02:00
static tree
add_instance_variable (tree class, int public, tree field_decl)
1992-01-18 00:15:38 +01:00
{
tree field_type = TREE_TYPE (field_decl);
const char *ivar_name = DECL_NAME (field_decl)
? IDENTIFIER_POINTER (DECL_NAME (field_decl))
: "<unnamed>";
1992-01-18 00:15:38 +01:00
#ifdef OBJCPLUS
if (TREE_CODE (field_type) == REFERENCE_TYPE)
{
builtins.c, [...]: Avoid "`" as left quote, using "'" or %q, %< and %> as appropriate. * builtins.c, c-common.c, c-decl.c, c-format.c, c-format.h, c-parse.in, c-pch.c, c-pragma.c, collect2.c, final.c, gcc.c, gcov.c, opts.c, pretty-print.h, protoize.c, reg-stack.c, rtl.c, tlink.c, config/alpha/alpha.c, config/arc/arc.c, config/arm/arm.c, config/avr/avr.c, config/c4x/c4x.c, config/darwin.c, config/frv/frv.c, config/h8300/h8300.c, config/i386/i386.c, config/i386/winnt.c, config/ia64/ia64.c, config/ip2k/ip2k.c, config/iq2000/iq2000.c, config/m32r/m32r.c, config/m68hc11/m68hc11.c, config/m68k/m68k.c, config/m68k/m68k.h, config/mcore/mcore.c, config/mips/mips.c, config/mmix/mmix.c, config/ns32k/ns32k.c, config/rs6000/host-darwin.c, config/rs6000/rs6000.c, config/s390/s390.c, config/sh/sh.c, config/sh/symbian.c, config/stormy16/stormy16.c, config/v850/v850.c: Avoid "`" as left quote, using "'" or %q, %< and %> as appropriate. Use %' as apostrophe in diagnostics where applicable. Use %< and %> in place of '' quotes where applicable. Use %qs in place of %<%s%>. Consistently quote __builtin function names. ada: * misc.c (gnat_handle_option): Use %< and %> for quoting in warning message. cp: * call.c, class.c, decl.c, decl2.c, error.c, mangle.c, parser.c, pt.c, search.c, semantics.c, typeck.c: Use %q, %< and %> for quoting in diagnostics. * parser.c (cp_parser_sizeof_operand): Use '' instead of `' for quoting in printf format. * decl.c (duplicate_decls, start_decl): Use %qD instead of unquoted %D. objc: * objc-act.c: Use %q, %< and %> for quoting in diagnostics. testsuite: * gcc.dg/builtin-prefetch-1.c: Adjust expected messages. From-SVN: r90337
2004-11-09 11:13:30 +01:00
error ("illegal reference type specified for instance variable %qs",
ivar_name);
/* Return class as is without adding this ivar. */
return class;
}
#endif
1992-01-18 00:15:38 +01:00
if (field_type == error_mark_node || !TYPE_SIZE (field_type)
Makefile.in (c-parse.o): Depend on $(C_COMMON_H). [gcc/ChangeLog] 2004-09-07 Ziemowit Laski <zlaski@apple.com> * Makefile.in (c-parse.o): Depend on $(C_COMMON_H). * c-parse.in: Include c-common.h instead of objc-act.h. (ivar_decl_list, ivar_decls, ivar_decl, ivars, ivar_declarator, myparms, myparm): Remove %type declarations. (methodtype, optparms, OBJC_TYPE_QUAL, objc_quals, objc_qual, objc_typename, objc_try_catch_stmt, optellipsis): Add %type declarations. (objc_inherit_code, objc_public_flag): Remove. (typespec_nonreserved_nonattr): Call objc_get_protocol_qualified_type() instead of get_static_reference() and get_protocol_reference(). (stmt_nocomp): Call grokparm() on @catch parameter. (objcdef): Move semantic action to objc_finish_implementation(). (classdef): Move semantic action to objc_start_class_interface(), objc_continue_interface(), objc_finish_interface(), objc_start_class_implementation(), objc_continue_implementation(), objc_start_category_interface() and objc_start_category_implementation(). (protocoldef): Move semantic actions to objc_start_protocol() and objc_finish_interface(). (ivar_decl_list): Remove nonterminal. (visibility_spec): Move semantic actions to objc_set_visibility(). (ivar_decls): Remove assignment to $$. (ivar_decl): Rephrase in terms of component_decl; call objc_add_instance_variable(). (ivars, ivar_declarator): Remove nonterminals. (opt_semi): New nonterminal. (methodtype): Remove semantic actions. (methoddef): Move semantic actions to objc_set_method_type(), objc_start_method_definition() and objc_finish_method_definition(). (methodproto): Move semantic actions to objc_set_method_type() and objc_add_method_declaration(). (methoddecl): Use objc_typename instead of typename; move semantic actions to objc_build_method_signature(). (optarglist, myxdecls, mydecl, myparms, myparm): Remove nonterminals. (optparmlist): Express in terms of optparms and optellipsis. (optparms, optellipsis, objc_qual, objc_quals, objc_typename): New nonterminals. (keyworddecl): Use objc_typename instead of typename. (rid_to_yy): Mark RID_IN, RID_OUT, RID_INOUT, RID_BYCOPY, RID_BYREF and RID_ONEWAY as returning OBJC_TYPE_QUAL to yyparse(). [gcc/objc/ChangeLog] 2004-09-07 Ziemowit Laski <zlaski@apple.com> * Make-lang.in (objc/objc-parse.o): Depend on $(C_COMMON_H) instead of objc/objc-act.h. (objc/objc-act.o): Depend on $(HASHTAB_H). * objc-act.c: Include hashtab.h; in ObjC++ mode, include cp-tree.h and objcp-decl.h instead of c-tree.h. (build_module_descriptor, get_class_ivars, synth_id_with_class_suffix, error_with_ivar, gen_method_decl, gen_declaration, setup_string_decl, build_protocol_template): Adjust prototypes. (build_module_initializer_routine, start_class, continue_class, finish_class, start_method_def, objc_start_function, start_protocol, build_method_decl, objc_add_method, add_instance_variable, build_ivar_reference, is_ivar, is_private, get_super_receiver, build_selector_table_decl, objc_push_parm, objc_get_parm_info, gen_type_name, gen_type_name_0, start_var_decl, finish_var_decl, create_field_decl): New prototypes. (objc_expand_function_end, comp_method_with_proto, objc_expr_last, gen_declaration_1, gen_declarator, is_complex_decl, adorn_decl, define_decl, create_builtin_decl, gen_declspecs): Remove prototypes. (TYPE_ID): Rename to OBJECT_TYPEDEF_NAME. (CLASS_TYPEDEF_NAME): New. (TAG_EXECCLASS): Change from a global variable to a #define. (TAG_RETURN_STRUCT): Delete. (TAG_GNUINIT): New, holds '__objc_gnu_init' name. (objc_inherit_code, objc_public_flag): New, moved from c-parse.in. (string_descriptor): New struct. (string_htab): New hash table. (string_hash, string_eq): New prototypes. (generate_struct_by_value_array): Call create_field_decl() instead of create_builtin_decl(). (objc_init): Do not initialize objc_ellipsis_node or TAG_EXECCLASS; In ObjC++ mode, call cxx_init() instead of c_objc_common_init(). (objc_finish_file): In ObjC++, call instantiate_pending_templates() and cp_finish_file(). (define_decl, get_static_reference, get_protocol_reference, create_builtin_decl): Remove functions. (objc_start_class_interface, objc_start_category_interface, objc_start_protocol, objc_continue_interface, objc_finish_interface, objc_start_class_implementation, objc_start_category_implementation, objc_continue_implementation, objc_finish_implementation, objc_set_visibility, objc_set_method_type, objc_build_method_signature, objc_add_method_declaration, objc_start_method_definition, objc_add_instance_variable, objc_get_protocol_qualified_type, create_field_decl, start_var_decl, finish_var_decl): New functions. (setup_string_decl): Simplify since it is only called once. (synth_module_prologue): Call build_class_template(); predefine 'id' and 'Class' as typedefs; rename 'temp_type' to 'type'; disable debug hooks for duration of function; fix GNU runtime messenger signatures to correspond to reality; forward-declare '__objc_exec_class' for the GNU runtime; call build_selector_table_decl(); in ObjC++ mode, generate 'extern "C" { ... }' wrappers around synthesized declarations; call build_protocol_template() and build_category_template(). (string_hash, string_eq): New functions. (objc_build_string_object): Check metaclass correctness only once; store string literals in hash table. (objc_build_constructor): Do not convert initializer elements; adjust for ObjC++ impedance mismatch. (build_objc_symtab_template): Call create_field_decl() instead of create_builtin_decl(). (init_objc_symtab): Add missing conversion to initializer element. (build_metadata_decl): Call start_var_decl() instead of define_decl(). (generate_objc_symtab_decl): Do not call build_category_template(); call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(). (build_module_descriptor): Call create_field_decl() instead of grokfield(); call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(); always mark module descriptor as used; move GNU runtime-specific functionality to build_module_initializer_routine(). (build_module_initializer_routine): New function, broken off of build_module_descriptor(). (objc_static_init_needed_p, objc_generate_static_init_call): New functions. (generate_static_references, generate_strings, build_selector_translation_table, generate_descriptor_table, generate_ivars_list, generate_dispatch_table, generate_category): Call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(); build a type directly instead of via groktypename(). (build_selector_reference_decl, build_selector_table_decl, build_class_reference_decl, build_protocol_reference, generate_objc_image_info): Call start_var_decl() instead of build_decl(). (build_selector_reference): For GNU runtime, do not call build_selector_reference_decl(). (build_selector, build_typed_selector_reference): Always convert result to the selector type. (add_objc_string): Cast return value to 'char *'. (build_method_prototype_template, build_selector_template, build_method_template): Use actual selector type for fields pointing to selectors. (finish_objc): For GNU runtime, call build_module_initializer_routine() after build_module_descriptor(). (generate_protocol_list, generate_shared_structures): Call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(); build a type directly instead of via groktypename(). (synth_id_with_class_suffix): Return a string. (get_arg_type_list): For instance methods, use the instance type for 'self'; do not call groktypename_in_parm_context(). (build_objc_string_decl): Squash redeclaration errors in ObjC++. (objc_is_class_name): Use OBJC_TYPE_NAME instead of TYPE_NAME; handle RECORD_TYPEs in ObjC as well as ObjC++. (objc_is_id): New function. (objc_is_object_ptr): Return the canonical type node. (objc_get_class_ivars): Simplify using get_class_ivars(). (get_class_ivars): Remove second parameter; create a fresh copy of the ivar list for each call; do not check for existence of super class. (objc_eh_runtime_type): Mark #ifndef OBJCPLUS. (objc_init_exceptions): When using SJLJ-style exceptions, require the use of '-fobjc-exceptions' flag; do not require it for DWARF-style exceptions. (objc_build_exc_ptr, next_sjlj_build_try_catch_finally): Use objc_object_type instead of objc_id_type. (objc_begin_catch_clause): Convert the incoming PARM_DECL into a VAR_DECL before placing it in the appropriate scope; do not call define_decl(); adjust call to c_begin_compound_stmt(); use objc_object_type instead of objc_id_type. (build_next_objc_exception_stuff): Call create_field_decl() instead of create_builtin_decl(); construct type directly instead of calling groktypename(); use OBJC_VOID_AT_END to mark end of function parameters. (build_private_template): Adjust call to get_class_ivars(); build a type directly instead of via groktypename(). (build_protocol_template, build_method_prototype_list_template, build_method_prototype_template, build_category_template, build_selector_template, build_class_template, build_super_template, build_ivar_template, build_ivar_list_template, build_method_list_template, build_method_template): Call create_field_decl() instead of grokfield(). (objc_method_parm_type): Do not call groktypename(). (generate_descriptor_table): Call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(). (generate_method_descriptors, build_protocol_initializer, generate_dispatch_tables, build_category_initializer, build_shared_structure_initializer): Do not call groktypename(). (generate_protocols): Call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(); do not call groktypename(). (error_with_ivar): Remove last parameter. (check_ivars): Do not iterate ovar CLASS_RAW_IVARS lists in addition to CLASS_IVARS lists; adjust calls to error_with_ivar(). (generate_ivar_lists): Convert one of the initializer elements; do not call groktypename(). (get_arg_type_list, start_method_def, gen_method_def): Account for new representation of variable arguments and '...' in Objective-C methods; add Objective-C++ impedance matching code. (is_objc_type_qualifier): Remove function. (adjust_type_for_id_default): Simplify; there is no longer a need to wade through declspecs. (lookup_interface, start_class, continue_class, finish_class, start_method_def, start_protocol, build_method_decl, objc_add_method, add_instance_variable, build_ivar_reference, is_ivar, is_private, get_super_receiver, objc_build_finally_epilogue): Make into static functions. (receiver_is_class_object): Use new IS_CLASS() macro. (objc_build_message_expr): Tweak ObjC++ message argument handling; call objc_finish_message_expr() instead of finish_message_expr(). (finish_message_expr): Rename to objc_finish_message_expr(); use OBJC_TYPE_NAME and OBJC_SET_TYPE_NAME macros instead of TYPE_NAME. call gen_type_name() instead of gen_declaration(); call objc_is_id() instead of using IS_ID and IS_CLASS; Use objc_class_name instead of calling get_identifier("Class"); handle CONVERT_EXPRs in receiver. (build_objc_method_call, warn_with_method): Do not call groktypename(). (build_ivar_reference): Call convert() instead of clobbering in a type. (hash_init): Initialize string_htab hash table. (add_instance_variable): Simplify parameter list; do not call grokfield(); do not populate CLASS_IVARS list. (start_class): Check for the existence of super class, if one was specified. (continue_class): Use CLASS_RAW_IVARS rather than CLASS_IVARS; do not call build_class_template(); adjust call to get_class_ivars(); call build_decl(), pushdecl() and finish_decl() instead of define_decl(). (finish_class): Call build_decl(), pushdecl() and finish_decl() instead of define_decl(). (add_protocols): Use PROTOCOL_BINFO_ELTS for the tree vector size. (start_protocol): Do not call build_protocol_template(); use PROTOCOL_BINFO_ELTS for the tree vector size. (encode_type_qualifiers): Do not handle the 'const' qualifier here. (encode_pointer): Encode 'const char *' as 'r*', for backwards compatibility. (encode_array): Use HOST_WIDE_INT_PRINT_DEC instead of "%ld". (encode_type): Handle the 'const' qualifier here. (objc_parmlist): New global variable, sued by objc_push_parm and objc_get_parm_info(). (objc_push_parm, objc_get_parm_info): New functions. (objc_expr_last): Remove function. (synth_self_and_ucmd_args): For instance methods, use the instance type for 'self'; call objc_push_parm() instead of push_parm_decl(). (start_method_def): Do not call push_scope(), declare_parm_level(), pop_scope(), push_parm_decl(), store_parm_decls() or objc_expr_last(); just use objc_push_parm() and objc_get_parm_info(). (comp_method_with_proto): Remove function. (objc_types_are_equivalent): Strip away indirections before comparing underlying types. (comp_proto_with_proto): Do not call groktypename(); types are no longer in raw declspec format. (objc_start_function): New function. (really_start_method): Call comp_proto_with_proto() instead of comp_method_with_proto(); call objc_start_function() instead of hand-crafting a function declarator. (continue_method_def, objc_expand_function_end): Remove functions. (get_super_receiver): Call objc_get_current_scope() instead of get_current_scope(); reference 'super_class' field (instead of 'class'). (finish_method_def): Rename to objc_finish_method_definition() and add a function decl parameter; move method encoding call from objc_expand_function_end(). (is_complex_decl, adorn_decl, gen_declarator, gen_declspecs, gen_declaration_1): Remove functions. (tmpbuf, RAW_DECLSPEC): Remove. (gen_declaration): Remove second parameter; simplify to deal with TYPE_P nodes instead of raw declspecs. (gen_type_name, gen_type_name_0): New functions. (gen_method_decl): Remove second parameter; call gen_type_name() instead of gen_declaration_1(). (dump_interface): Adjust calls to gen_declaration() and gen_method_decl(); do not allocate a separate string buffer. (init_objc): Allocate a larger string buffer to accommodate dump_interface(); adjust call to build_module_descriptor(); add call to build_module_initializer_routine() for the GNU runtime. (generate_classref_translation_entry): Do not call start_decl(); call finish_var_decl() instead of finish_decl(); call convert() instead of build_c_cast(). * objc-act.h (CLASS_OWN_IVARS): Remove accessor. (CLASS_BINFO_ELTS): Reduce from 6 to 5, now that CLASS_OWN_IVARS is gone. (OCTI_GNU_INIT_DECL, GNU_INIT_decl): New. (OCTI_ELLIPSIS_NODE, objc_ellipsis_node): Remove. (OCTI_ID_ID, id_type, objc_id_id): Rename to OCTI_ID_NAME, objc_object_type and objc_object_name, respectively. (OCTI_CLS_REF, OCTI_CLASS_NAME, objc_class_reference, objc_class_name): New. (IS_CLASS): New macro. (IS_ID, IS_SUPER): Robustify. (OCTI_EXECCLASS_DECL, execclass_decl): New. (finish_file, start_class, continue_class, finish_class, start_method_def, continue_method_def, finish_method_def, start_protocol, finish_protocol, objc_build_throw_stmt, objc_build_try_catch_finally_stmt, objc_build_synchronized_prologue, objc_build_synchronized_epilogue, objc_build_try_prologue, objc_build_try_epilogue, objc_build_catch_stmt, objc_build_catch_epilogue, objc_build_finally_prologue, objc_build_finally_epilogue, is_ivar, is_private, is_public, add_instance_variable, objc_add_method, get_super_receiver, objc_clear_super_receiver, get_class_ivars_from_name, get_class_reference, get_static_reference, get_object_reference, build_message_expr, finish_message_expr, build_selector_expr, build_ivar_reference, build_keyword_decl, build_method_decl, build_protocol_expr, build_objc_string_object, objc_declare_alias, objc_declare_class, objc_declare_protocols, objc_comptypes, objc_check_decl, build_encode_expr): Remove prototypes. (imp_count, cat_count): Make GGC-aware. (OBJC_SET_TYPE_NAME): New macro. From-SVN: r87168
2004-09-08 02:49:44 +02:00
|| TYPE_SIZE (field_type) == error_mark_node)
/* 'type[0]' is allowed, but 'type[]' is not! */
{
builtins.c, [...]: Avoid "`" as left quote, using "'" or %q, %< and %> as appropriate. * builtins.c, c-common.c, c-decl.c, c-format.c, c-format.h, c-parse.in, c-pch.c, c-pragma.c, collect2.c, final.c, gcc.c, gcov.c, opts.c, pretty-print.h, protoize.c, reg-stack.c, rtl.c, tlink.c, config/alpha/alpha.c, config/arc/arc.c, config/arm/arm.c, config/avr/avr.c, config/c4x/c4x.c, config/darwin.c, config/frv/frv.c, config/h8300/h8300.c, config/i386/i386.c, config/i386/winnt.c, config/ia64/ia64.c, config/ip2k/ip2k.c, config/iq2000/iq2000.c, config/m32r/m32r.c, config/m68hc11/m68hc11.c, config/m68k/m68k.c, config/m68k/m68k.h, config/mcore/mcore.c, config/mips/mips.c, config/mmix/mmix.c, config/ns32k/ns32k.c, config/rs6000/host-darwin.c, config/rs6000/rs6000.c, config/s390/s390.c, config/sh/sh.c, config/sh/symbian.c, config/stormy16/stormy16.c, config/v850/v850.c: Avoid "`" as left quote, using "'" or %q, %< and %> as appropriate. Use %' as apostrophe in diagnostics where applicable. Use %< and %> in place of '' quotes where applicable. Use %qs in place of %<%s%>. Consistently quote __builtin function names. ada: * misc.c (gnat_handle_option): Use %< and %> for quoting in warning message. cp: * call.c, class.c, decl.c, decl2.c, error.c, mangle.c, parser.c, pt.c, search.c, semantics.c, typeck.c: Use %q, %< and %> for quoting in diagnostics. * parser.c (cp_parser_sizeof_operand): Use '' instead of `' for quoting in printf format. * decl.c (duplicate_decls, start_decl): Use %qD instead of unquoted %D. objc: * objc-act.c: Use %q, %< and %> for quoting in diagnostics. testsuite: * gcc.dg/builtin-prefetch-1.c: Adjust expected messages. From-SVN: r90337
2004-11-09 11:13:30 +01:00
error ("instance variable %qs has unknown size", ivar_name);
/* Return class as is without adding this ivar. */
return class;
}
#ifdef OBJCPLUS
Yet more Objective-C++... * objc-act.c (objc_finish_try_stmt): Add return value. (objc_build_synchronized): Likewise. * objc-act.c (objc_is_gcable_type): Add. (objc_substitute_decl): Add. (objc_build_ivar_assignment): Add. (objc_build_global_assignment): Add. (objc_build_strong_cast_assignment): Add. (objc_is_ivar_reference_p): Add. (objc_is_global_reference_p): Add. (objc_generate_write_barrier): Add. (objc_rewrite_function_call): Add. (objc_gimplify_expr): Add Objective-C++ support. * objc-act.h (ALLOC_OBJC_TYPE_LANG_SPECIFIC): Likewise. (SIZEOF_OBJC_TYPE_LANG_SPECIFIC): Add. (INIT_TYPE_OBJC_INFO): Add Objective-C++ support. (DUP_TYPE_OBJC_INFO): Likewise. (struct imp_entry): Add field has_cxx_cdtors. (struct imp_entry *imp_list): Add OCTI_UMSG_FAST_DECL, OCTI_METH_LIST_TEMPL, OCTI_METH_PROTO_LIST_TEMPL, OCTI_IVAR_LIST_TEMPL, OCTI_ASSIGN_IVAR_DECL, OCTI_ASSIGN_IVAR_FAST_DECL, OCTI_ASSIGN_GLOBAL_DECL, OCTI_ASSIGN_STRONGCAST_DECL. (umsg_fast_decl): Add. (objc_assign_ivar_decl): Add. (objc_assign_ivar_fast_decl): Add. (objc_assign_global_decl): Add. (objc_assign_strong_cast_decl): Add. (objc_method_list_ptr): Add. (objc_method_proto_list_ptr): Add. (objc_ivar_list_ptr): Add. * objc-act.c (should_call_super_dealloc): Add. (OBJC_VERSION): Bump to 6. (objc_is_gcable_type): Add. (objc_substitute_decl): Add. (objc_build_ivar_assignment): Add. (objc_build_global_assignment): Add. (objc_build_strong_cast_assignment): Add. (objc_is_gcable_p): Add. (objc_is_ivar_reference_p): Add. (objc_is_global_reference_p): Add. (generate_shared_structures): Add flags parameter. (objc_generate_cxx_ctor_or_dtor): Add. (objc_generate_cxx_cdtors): Add. (add_class): Add name parameter. (objc_types_share_size_and_alignment): Add. (comp_proto_with_proto): Add strict parameter. (CLS_HAS_CXX_STRUCTORS): Add. (TAG_ASSIGNIVAR): Add. (TAG_ASSIGNGLOBAL): Add. (TAG_ASSIGNSTRONGCAST): Add. (TAG_MSGSEND_FAST): Add. (TAG_ASSIGNIVAR_FAST): Add. (TAG_CXX_CONSTRUCT): Add. (TAG_CXX_DESTRUCT): Add. (OBJC_LOOKUP_CLASS): Add. (OBJC_LOOKUP_NO_SUPER): Add. (objc_finish_file): Add pch support. (objc_finish_implementation): Add Objective-C++ support. (synth_module_prologue): Likewise. (synth_module_prologue): Add fast dispatching. (objc_get_class_reference): Add Objective-C++ support. (objc_generate_write_barrier): Likewise. (next_sjlj_build_enter_and_setjmp): Likewise. (objc_begin_try_stmt): Likewise. (build_next_objc_exception_stuff): Add fast ivar support. (build_private_template): Mark the record as used so debug information is generated. (build_protocol_template): Add Objective-C++ support. (objc_method_parm_type) Likewise. (objc_generate_cxx_ctor_or_dtor): Likewise. (objc_generate_cxx_cdtors): Likewise. (build_protocol_initializer): Likewise. (build_category_template): Likewise. (build_class_template): Likewise. (build_method_list_template): Likewise. (build_category_initializer): Likewise. (build_shared_structure_initializer): Likewise. (objc_finish_message_expr): Likewise. (build_objc_method_call): Add fast dispatch support. (lookup_method_static): Add support to end search at superclasses. (add_method_to_hash_list): Add strict parameter to comp_proto_with_proto. (objc_add_method): Likewise. (objc_add_method): Also set the interface_value. (add_instance_variable): Add Objective-C++ support. (objc_is_public): Likewise. (start_class): Likewise. (continue_class): Likewise. (encode_aggregate_within): Likewise. (start_method_def): Likewise. (objc_start_function): Clear current_function_returns_value and current_function_returns_null. (really_start_method): Add Objective-C++ support. (objc_finish_method_definition): Add warning for missing [super dealloc]. (finish_objc): Add Objective-C++ support. (generate_objc_image_info): Likewise. (objc_lookup_ivar): Likewise. * objc-act.h (TYPE_HAS_OBJC_INFO): Likewise. (INIT_TYPE_OBJC_INFO): Likewise. (DUP_TYPE_OBJC_INFO): Likewise. From-SVN: r99857
2005-05-17 22:07:08 +02:00
/* Check if the ivar being added has a non-POD C++ type. If so, we will
need to either (1) warn the user about it or (2) generate suitable
constructor/destructor call from '- .cxx_construct' or '- .cxx_destruct'
methods (if '-fobjc-call-cxx-cdtors' was specified). */
if (IS_AGGR_TYPE (field_type)
&& (TYPE_NEEDS_CONSTRUCTING (field_type)
|| TYPE_HAS_NONTRIVIAL_DESTRUCTOR (field_type)
|| TYPE_POLYMORPHIC_P (field_type)))
{
const char *type_name = IDENTIFIER_POINTER (OBJC_TYPE_NAME (field_type));
Yet more Objective-C++... * objc-act.c (objc_finish_try_stmt): Add return value. (objc_build_synchronized): Likewise. * objc-act.c (objc_is_gcable_type): Add. (objc_substitute_decl): Add. (objc_build_ivar_assignment): Add. (objc_build_global_assignment): Add. (objc_build_strong_cast_assignment): Add. (objc_is_ivar_reference_p): Add. (objc_is_global_reference_p): Add. (objc_generate_write_barrier): Add. (objc_rewrite_function_call): Add. (objc_gimplify_expr): Add Objective-C++ support. * objc-act.h (ALLOC_OBJC_TYPE_LANG_SPECIFIC): Likewise. (SIZEOF_OBJC_TYPE_LANG_SPECIFIC): Add. (INIT_TYPE_OBJC_INFO): Add Objective-C++ support. (DUP_TYPE_OBJC_INFO): Likewise. (struct imp_entry): Add field has_cxx_cdtors. (struct imp_entry *imp_list): Add OCTI_UMSG_FAST_DECL, OCTI_METH_LIST_TEMPL, OCTI_METH_PROTO_LIST_TEMPL, OCTI_IVAR_LIST_TEMPL, OCTI_ASSIGN_IVAR_DECL, OCTI_ASSIGN_IVAR_FAST_DECL, OCTI_ASSIGN_GLOBAL_DECL, OCTI_ASSIGN_STRONGCAST_DECL. (umsg_fast_decl): Add. (objc_assign_ivar_decl): Add. (objc_assign_ivar_fast_decl): Add. (objc_assign_global_decl): Add. (objc_assign_strong_cast_decl): Add. (objc_method_list_ptr): Add. (objc_method_proto_list_ptr): Add. (objc_ivar_list_ptr): Add. * objc-act.c (should_call_super_dealloc): Add. (OBJC_VERSION): Bump to 6. (objc_is_gcable_type): Add. (objc_substitute_decl): Add. (objc_build_ivar_assignment): Add. (objc_build_global_assignment): Add. (objc_build_strong_cast_assignment): Add. (objc_is_gcable_p): Add. (objc_is_ivar_reference_p): Add. (objc_is_global_reference_p): Add. (generate_shared_structures): Add flags parameter. (objc_generate_cxx_ctor_or_dtor): Add. (objc_generate_cxx_cdtors): Add. (add_class): Add name parameter. (objc_types_share_size_and_alignment): Add. (comp_proto_with_proto): Add strict parameter. (CLS_HAS_CXX_STRUCTORS): Add. (TAG_ASSIGNIVAR): Add. (TAG_ASSIGNGLOBAL): Add. (TAG_ASSIGNSTRONGCAST): Add. (TAG_MSGSEND_FAST): Add. (TAG_ASSIGNIVAR_FAST): Add. (TAG_CXX_CONSTRUCT): Add. (TAG_CXX_DESTRUCT): Add. (OBJC_LOOKUP_CLASS): Add. (OBJC_LOOKUP_NO_SUPER): Add. (objc_finish_file): Add pch support. (objc_finish_implementation): Add Objective-C++ support. (synth_module_prologue): Likewise. (synth_module_prologue): Add fast dispatching. (objc_get_class_reference): Add Objective-C++ support. (objc_generate_write_barrier): Likewise. (next_sjlj_build_enter_and_setjmp): Likewise. (objc_begin_try_stmt): Likewise. (build_next_objc_exception_stuff): Add fast ivar support. (build_private_template): Mark the record as used so debug information is generated. (build_protocol_template): Add Objective-C++ support. (objc_method_parm_type) Likewise. (objc_generate_cxx_ctor_or_dtor): Likewise. (objc_generate_cxx_cdtors): Likewise. (build_protocol_initializer): Likewise. (build_category_template): Likewise. (build_class_template): Likewise. (build_method_list_template): Likewise. (build_category_initializer): Likewise. (build_shared_structure_initializer): Likewise. (objc_finish_message_expr): Likewise. (build_objc_method_call): Add fast dispatch support. (lookup_method_static): Add support to end search at superclasses. (add_method_to_hash_list): Add strict parameter to comp_proto_with_proto. (objc_add_method): Likewise. (objc_add_method): Also set the interface_value. (add_instance_variable): Add Objective-C++ support. (objc_is_public): Likewise. (start_class): Likewise. (continue_class): Likewise. (encode_aggregate_within): Likewise. (start_method_def): Likewise. (objc_start_function): Clear current_function_returns_value and current_function_returns_null. (really_start_method): Add Objective-C++ support. (objc_finish_method_definition): Add warning for missing [super dealloc]. (finish_objc): Add Objective-C++ support. (generate_objc_image_info): Likewise. (objc_lookup_ivar): Likewise. * objc-act.h (TYPE_HAS_OBJC_INFO): Likewise. (INIT_TYPE_OBJC_INFO): Likewise. (DUP_TYPE_OBJC_INFO): Likewise. From-SVN: r99857
2005-05-17 22:07:08 +02:00
if (flag_objc_call_cxx_cdtors)
{
/* Since the ObjC runtime will be calling the constructors and
destructors for us, the only thing we can't handle is the lack
of a default constructor. */
if (TYPE_NEEDS_CONSTRUCTING (field_type)
&& !TYPE_HAS_DEFAULT_CONSTRUCTOR (field_type))
{
warning (0, "type %qs has no default constructor to call",
Yet more Objective-C++... * objc-act.c (objc_finish_try_stmt): Add return value. (objc_build_synchronized): Likewise. * objc-act.c (objc_is_gcable_type): Add. (objc_substitute_decl): Add. (objc_build_ivar_assignment): Add. (objc_build_global_assignment): Add. (objc_build_strong_cast_assignment): Add. (objc_is_ivar_reference_p): Add. (objc_is_global_reference_p): Add. (objc_generate_write_barrier): Add. (objc_rewrite_function_call): Add. (objc_gimplify_expr): Add Objective-C++ support. * objc-act.h (ALLOC_OBJC_TYPE_LANG_SPECIFIC): Likewise. (SIZEOF_OBJC_TYPE_LANG_SPECIFIC): Add. (INIT_TYPE_OBJC_INFO): Add Objective-C++ support. (DUP_TYPE_OBJC_INFO): Likewise. (struct imp_entry): Add field has_cxx_cdtors. (struct imp_entry *imp_list): Add OCTI_UMSG_FAST_DECL, OCTI_METH_LIST_TEMPL, OCTI_METH_PROTO_LIST_TEMPL, OCTI_IVAR_LIST_TEMPL, OCTI_ASSIGN_IVAR_DECL, OCTI_ASSIGN_IVAR_FAST_DECL, OCTI_ASSIGN_GLOBAL_DECL, OCTI_ASSIGN_STRONGCAST_DECL. (umsg_fast_decl): Add. (objc_assign_ivar_decl): Add. (objc_assign_ivar_fast_decl): Add. (objc_assign_global_decl): Add. (objc_assign_strong_cast_decl): Add. (objc_method_list_ptr): Add. (objc_method_proto_list_ptr): Add. (objc_ivar_list_ptr): Add. * objc-act.c (should_call_super_dealloc): Add. (OBJC_VERSION): Bump to 6. (objc_is_gcable_type): Add. (objc_substitute_decl): Add. (objc_build_ivar_assignment): Add. (objc_build_global_assignment): Add. (objc_build_strong_cast_assignment): Add. (objc_is_gcable_p): Add. (objc_is_ivar_reference_p): Add. (objc_is_global_reference_p): Add. (generate_shared_structures): Add flags parameter. (objc_generate_cxx_ctor_or_dtor): Add. (objc_generate_cxx_cdtors): Add. (add_class): Add name parameter. (objc_types_share_size_and_alignment): Add. (comp_proto_with_proto): Add strict parameter. (CLS_HAS_CXX_STRUCTORS): Add. (TAG_ASSIGNIVAR): Add. (TAG_ASSIGNGLOBAL): Add. (TAG_ASSIGNSTRONGCAST): Add. (TAG_MSGSEND_FAST): Add. (TAG_ASSIGNIVAR_FAST): Add. (TAG_CXX_CONSTRUCT): Add. (TAG_CXX_DESTRUCT): Add. (OBJC_LOOKUP_CLASS): Add. (OBJC_LOOKUP_NO_SUPER): Add. (objc_finish_file): Add pch support. (objc_finish_implementation): Add Objective-C++ support. (synth_module_prologue): Likewise. (synth_module_prologue): Add fast dispatching. (objc_get_class_reference): Add Objective-C++ support. (objc_generate_write_barrier): Likewise. (next_sjlj_build_enter_and_setjmp): Likewise. (objc_begin_try_stmt): Likewise. (build_next_objc_exception_stuff): Add fast ivar support. (build_private_template): Mark the record as used so debug information is generated. (build_protocol_template): Add Objective-C++ support. (objc_method_parm_type) Likewise. (objc_generate_cxx_ctor_or_dtor): Likewise. (objc_generate_cxx_cdtors): Likewise. (build_protocol_initializer): Likewise. (build_category_template): Likewise. (build_class_template): Likewise. (build_method_list_template): Likewise. (build_category_initializer): Likewise. (build_shared_structure_initializer): Likewise. (objc_finish_message_expr): Likewise. (build_objc_method_call): Add fast dispatch support. (lookup_method_static): Add support to end search at superclasses. (add_method_to_hash_list): Add strict parameter to comp_proto_with_proto. (objc_add_method): Likewise. (objc_add_method): Also set the interface_value. (add_instance_variable): Add Objective-C++ support. (objc_is_public): Likewise. (start_class): Likewise. (continue_class): Likewise. (encode_aggregate_within): Likewise. (start_method_def): Likewise. (objc_start_function): Clear current_function_returns_value and current_function_returns_null. (really_start_method): Add Objective-C++ support. (objc_finish_method_definition): Add warning for missing [super dealloc]. (finish_objc): Add Objective-C++ support. (generate_objc_image_info): Likewise. (objc_lookup_ivar): Likewise. * objc-act.h (TYPE_HAS_OBJC_INFO): Likewise. (INIT_TYPE_OBJC_INFO): Likewise. (DUP_TYPE_OBJC_INFO): Likewise. From-SVN: r99857
2005-05-17 22:07:08 +02:00
type_name);
/* If we cannot call a constructor, we should also avoid
calling the destructor, for symmetry. */
if (TYPE_HAS_NONTRIVIAL_DESTRUCTOR (field_type))
warning (0, "destructor for %qs shall not be run either",
Yet more Objective-C++... * objc-act.c (objc_finish_try_stmt): Add return value. (objc_build_synchronized): Likewise. * objc-act.c (objc_is_gcable_type): Add. (objc_substitute_decl): Add. (objc_build_ivar_assignment): Add. (objc_build_global_assignment): Add. (objc_build_strong_cast_assignment): Add. (objc_is_ivar_reference_p): Add. (objc_is_global_reference_p): Add. (objc_generate_write_barrier): Add. (objc_rewrite_function_call): Add. (objc_gimplify_expr): Add Objective-C++ support. * objc-act.h (ALLOC_OBJC_TYPE_LANG_SPECIFIC): Likewise. (SIZEOF_OBJC_TYPE_LANG_SPECIFIC): Add. (INIT_TYPE_OBJC_INFO): Add Objective-C++ support. (DUP_TYPE_OBJC_INFO): Likewise. (struct imp_entry): Add field has_cxx_cdtors. (struct imp_entry *imp_list): Add OCTI_UMSG_FAST_DECL, OCTI_METH_LIST_TEMPL, OCTI_METH_PROTO_LIST_TEMPL, OCTI_IVAR_LIST_TEMPL, OCTI_ASSIGN_IVAR_DECL, OCTI_ASSIGN_IVAR_FAST_DECL, OCTI_ASSIGN_GLOBAL_DECL, OCTI_ASSIGN_STRONGCAST_DECL. (umsg_fast_decl): Add. (objc_assign_ivar_decl): Add. (objc_assign_ivar_fast_decl): Add. (objc_assign_global_decl): Add. (objc_assign_strong_cast_decl): Add. (objc_method_list_ptr): Add. (objc_method_proto_list_ptr): Add. (objc_ivar_list_ptr): Add. * objc-act.c (should_call_super_dealloc): Add. (OBJC_VERSION): Bump to 6. (objc_is_gcable_type): Add. (objc_substitute_decl): Add. (objc_build_ivar_assignment): Add. (objc_build_global_assignment): Add. (objc_build_strong_cast_assignment): Add. (objc_is_gcable_p): Add. (objc_is_ivar_reference_p): Add. (objc_is_global_reference_p): Add. (generate_shared_structures): Add flags parameter. (objc_generate_cxx_ctor_or_dtor): Add. (objc_generate_cxx_cdtors): Add. (add_class): Add name parameter. (objc_types_share_size_and_alignment): Add. (comp_proto_with_proto): Add strict parameter. (CLS_HAS_CXX_STRUCTORS): Add. (TAG_ASSIGNIVAR): Add. (TAG_ASSIGNGLOBAL): Add. (TAG_ASSIGNSTRONGCAST): Add. (TAG_MSGSEND_FAST): Add. (TAG_ASSIGNIVAR_FAST): Add. (TAG_CXX_CONSTRUCT): Add. (TAG_CXX_DESTRUCT): Add. (OBJC_LOOKUP_CLASS): Add. (OBJC_LOOKUP_NO_SUPER): Add. (objc_finish_file): Add pch support. (objc_finish_implementation): Add Objective-C++ support. (synth_module_prologue): Likewise. (synth_module_prologue): Add fast dispatching. (objc_get_class_reference): Add Objective-C++ support. (objc_generate_write_barrier): Likewise. (next_sjlj_build_enter_and_setjmp): Likewise. (objc_begin_try_stmt): Likewise. (build_next_objc_exception_stuff): Add fast ivar support. (build_private_template): Mark the record as used so debug information is generated. (build_protocol_template): Add Objective-C++ support. (objc_method_parm_type) Likewise. (objc_generate_cxx_ctor_or_dtor): Likewise. (objc_generate_cxx_cdtors): Likewise. (build_protocol_initializer): Likewise. (build_category_template): Likewise. (build_class_template): Likewise. (build_method_list_template): Likewise. (build_category_initializer): Likewise. (build_shared_structure_initializer): Likewise. (objc_finish_message_expr): Likewise. (build_objc_method_call): Add fast dispatch support. (lookup_method_static): Add support to end search at superclasses. (add_method_to_hash_list): Add strict parameter to comp_proto_with_proto. (objc_add_method): Likewise. (objc_add_method): Also set the interface_value. (add_instance_variable): Add Objective-C++ support. (objc_is_public): Likewise. (start_class): Likewise. (continue_class): Likewise. (encode_aggregate_within): Likewise. (start_method_def): Likewise. (objc_start_function): Clear current_function_returns_value and current_function_returns_null. (really_start_method): Add Objective-C++ support. (objc_finish_method_definition): Add warning for missing [super dealloc]. (finish_objc): Add Objective-C++ support. (generate_objc_image_info): Likewise. (objc_lookup_ivar): Likewise. * objc-act.h (TYPE_HAS_OBJC_INFO): Likewise. (INIT_TYPE_OBJC_INFO): Likewise. (DUP_TYPE_OBJC_INFO): Likewise. From-SVN: r99857
2005-05-17 22:07:08 +02:00
type_name);
}
}
else
{
static bool warn_cxx_ivars = false;
if (TYPE_POLYMORPHIC_P (field_type))
{
/* Vtable pointers are Real Bad(tm), since Obj-C cannot
initialize them. */
error ("type %qs has virtual member functions", type_name);
error ("illegal aggregate type %qs specified "
"for instance variable %qs",
Yet more Objective-C++... * objc-act.c (objc_finish_try_stmt): Add return value. (objc_build_synchronized): Likewise. * objc-act.c (objc_is_gcable_type): Add. (objc_substitute_decl): Add. (objc_build_ivar_assignment): Add. (objc_build_global_assignment): Add. (objc_build_strong_cast_assignment): Add. (objc_is_ivar_reference_p): Add. (objc_is_global_reference_p): Add. (objc_generate_write_barrier): Add. (objc_rewrite_function_call): Add. (objc_gimplify_expr): Add Objective-C++ support. * objc-act.h (ALLOC_OBJC_TYPE_LANG_SPECIFIC): Likewise. (SIZEOF_OBJC_TYPE_LANG_SPECIFIC): Add. (INIT_TYPE_OBJC_INFO): Add Objective-C++ support. (DUP_TYPE_OBJC_INFO): Likewise. (struct imp_entry): Add field has_cxx_cdtors. (struct imp_entry *imp_list): Add OCTI_UMSG_FAST_DECL, OCTI_METH_LIST_TEMPL, OCTI_METH_PROTO_LIST_TEMPL, OCTI_IVAR_LIST_TEMPL, OCTI_ASSIGN_IVAR_DECL, OCTI_ASSIGN_IVAR_FAST_DECL, OCTI_ASSIGN_GLOBAL_DECL, OCTI_ASSIGN_STRONGCAST_DECL. (umsg_fast_decl): Add. (objc_assign_ivar_decl): Add. (objc_assign_ivar_fast_decl): Add. (objc_assign_global_decl): Add. (objc_assign_strong_cast_decl): Add. (objc_method_list_ptr): Add. (objc_method_proto_list_ptr): Add. (objc_ivar_list_ptr): Add. * objc-act.c (should_call_super_dealloc): Add. (OBJC_VERSION): Bump to 6. (objc_is_gcable_type): Add. (objc_substitute_decl): Add. (objc_build_ivar_assignment): Add. (objc_build_global_assignment): Add. (objc_build_strong_cast_assignment): Add. (objc_is_gcable_p): Add. (objc_is_ivar_reference_p): Add. (objc_is_global_reference_p): Add. (generate_shared_structures): Add flags parameter. (objc_generate_cxx_ctor_or_dtor): Add. (objc_generate_cxx_cdtors): Add. (add_class): Add name parameter. (objc_types_share_size_and_alignment): Add. (comp_proto_with_proto): Add strict parameter. (CLS_HAS_CXX_STRUCTORS): Add. (TAG_ASSIGNIVAR): Add. (TAG_ASSIGNGLOBAL): Add. (TAG_ASSIGNSTRONGCAST): Add. (TAG_MSGSEND_FAST): Add. (TAG_ASSIGNIVAR_FAST): Add. (TAG_CXX_CONSTRUCT): Add. (TAG_CXX_DESTRUCT): Add. (OBJC_LOOKUP_CLASS): Add. (OBJC_LOOKUP_NO_SUPER): Add. (objc_finish_file): Add pch support. (objc_finish_implementation): Add Objective-C++ support. (synth_module_prologue): Likewise. (synth_module_prologue): Add fast dispatching. (objc_get_class_reference): Add Objective-C++ support. (objc_generate_write_barrier): Likewise. (next_sjlj_build_enter_and_setjmp): Likewise. (objc_begin_try_stmt): Likewise. (build_next_objc_exception_stuff): Add fast ivar support. (build_private_template): Mark the record as used so debug information is generated. (build_protocol_template): Add Objective-C++ support. (objc_method_parm_type) Likewise. (objc_generate_cxx_ctor_or_dtor): Likewise. (objc_generate_cxx_cdtors): Likewise. (build_protocol_initializer): Likewise. (build_category_template): Likewise. (build_class_template): Likewise. (build_method_list_template): Likewise. (build_category_initializer): Likewise. (build_shared_structure_initializer): Likewise. (objc_finish_message_expr): Likewise. (build_objc_method_call): Add fast dispatch support. (lookup_method_static): Add support to end search at superclasses. (add_method_to_hash_list): Add strict parameter to comp_proto_with_proto. (objc_add_method): Likewise. (objc_add_method): Also set the interface_value. (add_instance_variable): Add Objective-C++ support. (objc_is_public): Likewise. (start_class): Likewise. (continue_class): Likewise. (encode_aggregate_within): Likewise. (start_method_def): Likewise. (objc_start_function): Clear current_function_returns_value and current_function_returns_null. (really_start_method): Add Objective-C++ support. (objc_finish_method_definition): Add warning for missing [super dealloc]. (finish_objc): Add Objective-C++ support. (generate_objc_image_info): Likewise. (objc_lookup_ivar): Likewise. * objc-act.h (TYPE_HAS_OBJC_INFO): Likewise. (INIT_TYPE_OBJC_INFO): Likewise. (DUP_TYPE_OBJC_INFO): Likewise. From-SVN: r99857
2005-05-17 22:07:08 +02:00
type_name, ivar_name);
/* Return class as is without adding this ivar. */
return class;
}
/* User-defined constructors and destructors are not known to Obj-C
and hence will not be called. This may or may not be a problem. */
if (TYPE_NEEDS_CONSTRUCTING (field_type))
warning (0, "type %qs has a user-defined constructor", type_name);
Yet more Objective-C++... * objc-act.c (objc_finish_try_stmt): Add return value. (objc_build_synchronized): Likewise. * objc-act.c (objc_is_gcable_type): Add. (objc_substitute_decl): Add. (objc_build_ivar_assignment): Add. (objc_build_global_assignment): Add. (objc_build_strong_cast_assignment): Add. (objc_is_ivar_reference_p): Add. (objc_is_global_reference_p): Add. (objc_generate_write_barrier): Add. (objc_rewrite_function_call): Add. (objc_gimplify_expr): Add Objective-C++ support. * objc-act.h (ALLOC_OBJC_TYPE_LANG_SPECIFIC): Likewise. (SIZEOF_OBJC_TYPE_LANG_SPECIFIC): Add. (INIT_TYPE_OBJC_INFO): Add Objective-C++ support. (DUP_TYPE_OBJC_INFO): Likewise. (struct imp_entry): Add field has_cxx_cdtors. (struct imp_entry *imp_list): Add OCTI_UMSG_FAST_DECL, OCTI_METH_LIST_TEMPL, OCTI_METH_PROTO_LIST_TEMPL, OCTI_IVAR_LIST_TEMPL, OCTI_ASSIGN_IVAR_DECL, OCTI_ASSIGN_IVAR_FAST_DECL, OCTI_ASSIGN_GLOBAL_DECL, OCTI_ASSIGN_STRONGCAST_DECL. (umsg_fast_decl): Add. (objc_assign_ivar_decl): Add. (objc_assign_ivar_fast_decl): Add. (objc_assign_global_decl): Add. (objc_assign_strong_cast_decl): Add. (objc_method_list_ptr): Add. (objc_method_proto_list_ptr): Add. (objc_ivar_list_ptr): Add. * objc-act.c (should_call_super_dealloc): Add. (OBJC_VERSION): Bump to 6. (objc_is_gcable_type): Add. (objc_substitute_decl): Add. (objc_build_ivar_assignment): Add. (objc_build_global_assignment): Add. (objc_build_strong_cast_assignment): Add. (objc_is_gcable_p): Add. (objc_is_ivar_reference_p): Add. (objc_is_global_reference_p): Add. (generate_shared_structures): Add flags parameter. (objc_generate_cxx_ctor_or_dtor): Add. (objc_generate_cxx_cdtors): Add. (add_class): Add name parameter. (objc_types_share_size_and_alignment): Add. (comp_proto_with_proto): Add strict parameter. (CLS_HAS_CXX_STRUCTORS): Add. (TAG_ASSIGNIVAR): Add. (TAG_ASSIGNGLOBAL): Add. (TAG_ASSIGNSTRONGCAST): Add. (TAG_MSGSEND_FAST): Add. (TAG_ASSIGNIVAR_FAST): Add. (TAG_CXX_CONSTRUCT): Add. (TAG_CXX_DESTRUCT): Add. (OBJC_LOOKUP_CLASS): Add. (OBJC_LOOKUP_NO_SUPER): Add. (objc_finish_file): Add pch support. (objc_finish_implementation): Add Objective-C++ support. (synth_module_prologue): Likewise. (synth_module_prologue): Add fast dispatching. (objc_get_class_reference): Add Objective-C++ support. (objc_generate_write_barrier): Likewise. (next_sjlj_build_enter_and_setjmp): Likewise. (objc_begin_try_stmt): Likewise. (build_next_objc_exception_stuff): Add fast ivar support. (build_private_template): Mark the record as used so debug information is generated. (build_protocol_template): Add Objective-C++ support. (objc_method_parm_type) Likewise. (objc_generate_cxx_ctor_or_dtor): Likewise. (objc_generate_cxx_cdtors): Likewise. (build_protocol_initializer): Likewise. (build_category_template): Likewise. (build_class_template): Likewise. (build_method_list_template): Likewise. (build_category_initializer): Likewise. (build_shared_structure_initializer): Likewise. (objc_finish_message_expr): Likewise. (build_objc_method_call): Add fast dispatch support. (lookup_method_static): Add support to end search at superclasses. (add_method_to_hash_list): Add strict parameter to comp_proto_with_proto. (objc_add_method): Likewise. (objc_add_method): Also set the interface_value. (add_instance_variable): Add Objective-C++ support. (objc_is_public): Likewise. (start_class): Likewise. (continue_class): Likewise. (encode_aggregate_within): Likewise. (start_method_def): Likewise. (objc_start_function): Clear current_function_returns_value and current_function_returns_null. (really_start_method): Add Objective-C++ support. (objc_finish_method_definition): Add warning for missing [super dealloc]. (finish_objc): Add Objective-C++ support. (generate_objc_image_info): Likewise. (objc_lookup_ivar): Likewise. * objc-act.h (TYPE_HAS_OBJC_INFO): Likewise. (INIT_TYPE_OBJC_INFO): Likewise. (DUP_TYPE_OBJC_INFO): Likewise. From-SVN: r99857
2005-05-17 22:07:08 +02:00
if (TYPE_HAS_NONTRIVIAL_DESTRUCTOR (field_type))
warning (0, "type %qs has a user-defined destructor", type_name);
Yet more Objective-C++... * objc-act.c (objc_finish_try_stmt): Add return value. (objc_build_synchronized): Likewise. * objc-act.c (objc_is_gcable_type): Add. (objc_substitute_decl): Add. (objc_build_ivar_assignment): Add. (objc_build_global_assignment): Add. (objc_build_strong_cast_assignment): Add. (objc_is_ivar_reference_p): Add. (objc_is_global_reference_p): Add. (objc_generate_write_barrier): Add. (objc_rewrite_function_call): Add. (objc_gimplify_expr): Add Objective-C++ support. * objc-act.h (ALLOC_OBJC_TYPE_LANG_SPECIFIC): Likewise. (SIZEOF_OBJC_TYPE_LANG_SPECIFIC): Add. (INIT_TYPE_OBJC_INFO): Add Objective-C++ support. (DUP_TYPE_OBJC_INFO): Likewise. (struct imp_entry): Add field has_cxx_cdtors. (struct imp_entry *imp_list): Add OCTI_UMSG_FAST_DECL, OCTI_METH_LIST_TEMPL, OCTI_METH_PROTO_LIST_TEMPL, OCTI_IVAR_LIST_TEMPL, OCTI_ASSIGN_IVAR_DECL, OCTI_ASSIGN_IVAR_FAST_DECL, OCTI_ASSIGN_GLOBAL_DECL, OCTI_ASSIGN_STRONGCAST_DECL. (umsg_fast_decl): Add. (objc_assign_ivar_decl): Add. (objc_assign_ivar_fast_decl): Add. (objc_assign_global_decl): Add. (objc_assign_strong_cast_decl): Add. (objc_method_list_ptr): Add. (objc_method_proto_list_ptr): Add. (objc_ivar_list_ptr): Add. * objc-act.c (should_call_super_dealloc): Add. (OBJC_VERSION): Bump to 6. (objc_is_gcable_type): Add. (objc_substitute_decl): Add. (objc_build_ivar_assignment): Add. (objc_build_global_assignment): Add. (objc_build_strong_cast_assignment): Add. (objc_is_gcable_p): Add. (objc_is_ivar_reference_p): Add. (objc_is_global_reference_p): Add. (generate_shared_structures): Add flags parameter. (objc_generate_cxx_ctor_or_dtor): Add. (objc_generate_cxx_cdtors): Add. (add_class): Add name parameter. (objc_types_share_size_and_alignment): Add. (comp_proto_with_proto): Add strict parameter. (CLS_HAS_CXX_STRUCTORS): Add. (TAG_ASSIGNIVAR): Add. (TAG_ASSIGNGLOBAL): Add. (TAG_ASSIGNSTRONGCAST): Add. (TAG_MSGSEND_FAST): Add. (TAG_ASSIGNIVAR_FAST): Add. (TAG_CXX_CONSTRUCT): Add. (TAG_CXX_DESTRUCT): Add. (OBJC_LOOKUP_CLASS): Add. (OBJC_LOOKUP_NO_SUPER): Add. (objc_finish_file): Add pch support. (objc_finish_implementation): Add Objective-C++ support. (synth_module_prologue): Likewise. (synth_module_prologue): Add fast dispatching. (objc_get_class_reference): Add Objective-C++ support. (objc_generate_write_barrier): Likewise. (next_sjlj_build_enter_and_setjmp): Likewise. (objc_begin_try_stmt): Likewise. (build_next_objc_exception_stuff): Add fast ivar support. (build_private_template): Mark the record as used so debug information is generated. (build_protocol_template): Add Objective-C++ support. (objc_method_parm_type) Likewise. (objc_generate_cxx_ctor_or_dtor): Likewise. (objc_generate_cxx_cdtors): Likewise. (build_protocol_initializer): Likewise. (build_category_template): Likewise. (build_class_template): Likewise. (build_method_list_template): Likewise. (build_category_initializer): Likewise. (build_shared_structure_initializer): Likewise. (objc_finish_message_expr): Likewise. (build_objc_method_call): Add fast dispatch support. (lookup_method_static): Add support to end search at superclasses. (add_method_to_hash_list): Add strict parameter to comp_proto_with_proto. (objc_add_method): Likewise. (objc_add_method): Also set the interface_value. (add_instance_variable): Add Objective-C++ support. (objc_is_public): Likewise. (start_class): Likewise. (continue_class): Likewise. (encode_aggregate_within): Likewise. (start_method_def): Likewise. (objc_start_function): Clear current_function_returns_value and current_function_returns_null. (really_start_method): Add Objective-C++ support. (objc_finish_method_definition): Add warning for missing [super dealloc]. (finish_objc): Add Objective-C++ support. (generate_objc_image_info): Likewise. (objc_lookup_ivar): Likewise. * objc-act.h (TYPE_HAS_OBJC_INFO): Likewise. (INIT_TYPE_OBJC_INFO): Likewise. (DUP_TYPE_OBJC_INFO): Likewise. From-SVN: r99857
2005-05-17 22:07:08 +02:00
if (!warn_cxx_ivars)
{
warning (0, "C++ constructors and destructors will not "
"be invoked for Objective-C fields");
warn_cxx_ivars = true;
}
}
}
#endif
1992-01-18 00:15:38 +01:00
1996-07-04 00:07:53 +02:00
/* Overload the public attribute, it is not used for FIELD_DECLs. */
switch (public)
{
case 0:
TREE_PUBLIC (field_decl) = 0;
TREE_PRIVATE (field_decl) = 0;
TREE_PROTECTED (field_decl) = 1;
break;
case 1:
TREE_PUBLIC (field_decl) = 1;
TREE_PRIVATE (field_decl) = 0;
TREE_PROTECTED (field_decl) = 0;
break;
case 2:
TREE_PUBLIC (field_decl) = 0;
TREE_PRIVATE (field_decl) = 1;
TREE_PROTECTED (field_decl) = 0;
break;
}
1992-01-18 00:15:38 +01:00
Makefile.in (c-parse.o): Depend on $(C_COMMON_H). [gcc/ChangeLog] 2004-09-07 Ziemowit Laski <zlaski@apple.com> * Makefile.in (c-parse.o): Depend on $(C_COMMON_H). * c-parse.in: Include c-common.h instead of objc-act.h. (ivar_decl_list, ivar_decls, ivar_decl, ivars, ivar_declarator, myparms, myparm): Remove %type declarations. (methodtype, optparms, OBJC_TYPE_QUAL, objc_quals, objc_qual, objc_typename, objc_try_catch_stmt, optellipsis): Add %type declarations. (objc_inherit_code, objc_public_flag): Remove. (typespec_nonreserved_nonattr): Call objc_get_protocol_qualified_type() instead of get_static_reference() and get_protocol_reference(). (stmt_nocomp): Call grokparm() on @catch parameter. (objcdef): Move semantic action to objc_finish_implementation(). (classdef): Move semantic action to objc_start_class_interface(), objc_continue_interface(), objc_finish_interface(), objc_start_class_implementation(), objc_continue_implementation(), objc_start_category_interface() and objc_start_category_implementation(). (protocoldef): Move semantic actions to objc_start_protocol() and objc_finish_interface(). (ivar_decl_list): Remove nonterminal. (visibility_spec): Move semantic actions to objc_set_visibility(). (ivar_decls): Remove assignment to $$. (ivar_decl): Rephrase in terms of component_decl; call objc_add_instance_variable(). (ivars, ivar_declarator): Remove nonterminals. (opt_semi): New nonterminal. (methodtype): Remove semantic actions. (methoddef): Move semantic actions to objc_set_method_type(), objc_start_method_definition() and objc_finish_method_definition(). (methodproto): Move semantic actions to objc_set_method_type() and objc_add_method_declaration(). (methoddecl): Use objc_typename instead of typename; move semantic actions to objc_build_method_signature(). (optarglist, myxdecls, mydecl, myparms, myparm): Remove nonterminals. (optparmlist): Express in terms of optparms and optellipsis. (optparms, optellipsis, objc_qual, objc_quals, objc_typename): New nonterminals. (keyworddecl): Use objc_typename instead of typename. (rid_to_yy): Mark RID_IN, RID_OUT, RID_INOUT, RID_BYCOPY, RID_BYREF and RID_ONEWAY as returning OBJC_TYPE_QUAL to yyparse(). [gcc/objc/ChangeLog] 2004-09-07 Ziemowit Laski <zlaski@apple.com> * Make-lang.in (objc/objc-parse.o): Depend on $(C_COMMON_H) instead of objc/objc-act.h. (objc/objc-act.o): Depend on $(HASHTAB_H). * objc-act.c: Include hashtab.h; in ObjC++ mode, include cp-tree.h and objcp-decl.h instead of c-tree.h. (build_module_descriptor, get_class_ivars, synth_id_with_class_suffix, error_with_ivar, gen_method_decl, gen_declaration, setup_string_decl, build_protocol_template): Adjust prototypes. (build_module_initializer_routine, start_class, continue_class, finish_class, start_method_def, objc_start_function, start_protocol, build_method_decl, objc_add_method, add_instance_variable, build_ivar_reference, is_ivar, is_private, get_super_receiver, build_selector_table_decl, objc_push_parm, objc_get_parm_info, gen_type_name, gen_type_name_0, start_var_decl, finish_var_decl, create_field_decl): New prototypes. (objc_expand_function_end, comp_method_with_proto, objc_expr_last, gen_declaration_1, gen_declarator, is_complex_decl, adorn_decl, define_decl, create_builtin_decl, gen_declspecs): Remove prototypes. (TYPE_ID): Rename to OBJECT_TYPEDEF_NAME. (CLASS_TYPEDEF_NAME): New. (TAG_EXECCLASS): Change from a global variable to a #define. (TAG_RETURN_STRUCT): Delete. (TAG_GNUINIT): New, holds '__objc_gnu_init' name. (objc_inherit_code, objc_public_flag): New, moved from c-parse.in. (string_descriptor): New struct. (string_htab): New hash table. (string_hash, string_eq): New prototypes. (generate_struct_by_value_array): Call create_field_decl() instead of create_builtin_decl(). (objc_init): Do not initialize objc_ellipsis_node or TAG_EXECCLASS; In ObjC++ mode, call cxx_init() instead of c_objc_common_init(). (objc_finish_file): In ObjC++, call instantiate_pending_templates() and cp_finish_file(). (define_decl, get_static_reference, get_protocol_reference, create_builtin_decl): Remove functions. (objc_start_class_interface, objc_start_category_interface, objc_start_protocol, objc_continue_interface, objc_finish_interface, objc_start_class_implementation, objc_start_category_implementation, objc_continue_implementation, objc_finish_implementation, objc_set_visibility, objc_set_method_type, objc_build_method_signature, objc_add_method_declaration, objc_start_method_definition, objc_add_instance_variable, objc_get_protocol_qualified_type, create_field_decl, start_var_decl, finish_var_decl): New functions. (setup_string_decl): Simplify since it is only called once. (synth_module_prologue): Call build_class_template(); predefine 'id' and 'Class' as typedefs; rename 'temp_type' to 'type'; disable debug hooks for duration of function; fix GNU runtime messenger signatures to correspond to reality; forward-declare '__objc_exec_class' for the GNU runtime; call build_selector_table_decl(); in ObjC++ mode, generate 'extern "C" { ... }' wrappers around synthesized declarations; call build_protocol_template() and build_category_template(). (string_hash, string_eq): New functions. (objc_build_string_object): Check metaclass correctness only once; store string literals in hash table. (objc_build_constructor): Do not convert initializer elements; adjust for ObjC++ impedance mismatch. (build_objc_symtab_template): Call create_field_decl() instead of create_builtin_decl(). (init_objc_symtab): Add missing conversion to initializer element. (build_metadata_decl): Call start_var_decl() instead of define_decl(). (generate_objc_symtab_decl): Do not call build_category_template(); call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(). (build_module_descriptor): Call create_field_decl() instead of grokfield(); call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(); always mark module descriptor as used; move GNU runtime-specific functionality to build_module_initializer_routine(). (build_module_initializer_routine): New function, broken off of build_module_descriptor(). (objc_static_init_needed_p, objc_generate_static_init_call): New functions. (generate_static_references, generate_strings, build_selector_translation_table, generate_descriptor_table, generate_ivars_list, generate_dispatch_table, generate_category): Call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(); build a type directly instead of via groktypename(). (build_selector_reference_decl, build_selector_table_decl, build_class_reference_decl, build_protocol_reference, generate_objc_image_info): Call start_var_decl() instead of build_decl(). (build_selector_reference): For GNU runtime, do not call build_selector_reference_decl(). (build_selector, build_typed_selector_reference): Always convert result to the selector type. (add_objc_string): Cast return value to 'char *'. (build_method_prototype_template, build_selector_template, build_method_template): Use actual selector type for fields pointing to selectors. (finish_objc): For GNU runtime, call build_module_initializer_routine() after build_module_descriptor(). (generate_protocol_list, generate_shared_structures): Call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(); build a type directly instead of via groktypename(). (synth_id_with_class_suffix): Return a string. (get_arg_type_list): For instance methods, use the instance type for 'self'; do not call groktypename_in_parm_context(). (build_objc_string_decl): Squash redeclaration errors in ObjC++. (objc_is_class_name): Use OBJC_TYPE_NAME instead of TYPE_NAME; handle RECORD_TYPEs in ObjC as well as ObjC++. (objc_is_id): New function. (objc_is_object_ptr): Return the canonical type node. (objc_get_class_ivars): Simplify using get_class_ivars(). (get_class_ivars): Remove second parameter; create a fresh copy of the ivar list for each call; do not check for existence of super class. (objc_eh_runtime_type): Mark #ifndef OBJCPLUS. (objc_init_exceptions): When using SJLJ-style exceptions, require the use of '-fobjc-exceptions' flag; do not require it for DWARF-style exceptions. (objc_build_exc_ptr, next_sjlj_build_try_catch_finally): Use objc_object_type instead of objc_id_type. (objc_begin_catch_clause): Convert the incoming PARM_DECL into a VAR_DECL before placing it in the appropriate scope; do not call define_decl(); adjust call to c_begin_compound_stmt(); use objc_object_type instead of objc_id_type. (build_next_objc_exception_stuff): Call create_field_decl() instead of create_builtin_decl(); construct type directly instead of calling groktypename(); use OBJC_VOID_AT_END to mark end of function parameters. (build_private_template): Adjust call to get_class_ivars(); build a type directly instead of via groktypename(). (build_protocol_template, build_method_prototype_list_template, build_method_prototype_template, build_category_template, build_selector_template, build_class_template, build_super_template, build_ivar_template, build_ivar_list_template, build_method_list_template, build_method_template): Call create_field_decl() instead of grokfield(). (objc_method_parm_type): Do not call groktypename(). (generate_descriptor_table): Call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(). (generate_method_descriptors, build_protocol_initializer, generate_dispatch_tables, build_category_initializer, build_shared_structure_initializer): Do not call groktypename(). (generate_protocols): Call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(); do not call groktypename(). (error_with_ivar): Remove last parameter. (check_ivars): Do not iterate ovar CLASS_RAW_IVARS lists in addition to CLASS_IVARS lists; adjust calls to error_with_ivar(). (generate_ivar_lists): Convert one of the initializer elements; do not call groktypename(). (get_arg_type_list, start_method_def, gen_method_def): Account for new representation of variable arguments and '...' in Objective-C methods; add Objective-C++ impedance matching code. (is_objc_type_qualifier): Remove function. (adjust_type_for_id_default): Simplify; there is no longer a need to wade through declspecs. (lookup_interface, start_class, continue_class, finish_class, start_method_def, start_protocol, build_method_decl, objc_add_method, add_instance_variable, build_ivar_reference, is_ivar, is_private, get_super_receiver, objc_build_finally_epilogue): Make into static functions. (receiver_is_class_object): Use new IS_CLASS() macro. (objc_build_message_expr): Tweak ObjC++ message argument handling; call objc_finish_message_expr() instead of finish_message_expr(). (finish_message_expr): Rename to objc_finish_message_expr(); use OBJC_TYPE_NAME and OBJC_SET_TYPE_NAME macros instead of TYPE_NAME. call gen_type_name() instead of gen_declaration(); call objc_is_id() instead of using IS_ID and IS_CLASS; Use objc_class_name instead of calling get_identifier("Class"); handle CONVERT_EXPRs in receiver. (build_objc_method_call, warn_with_method): Do not call groktypename(). (build_ivar_reference): Call convert() instead of clobbering in a type. (hash_init): Initialize string_htab hash table. (add_instance_variable): Simplify parameter list; do not call grokfield(); do not populate CLASS_IVARS list. (start_class): Check for the existence of super class, if one was specified. (continue_class): Use CLASS_RAW_IVARS rather than CLASS_IVARS; do not call build_class_template(); adjust call to get_class_ivars(); call build_decl(), pushdecl() and finish_decl() instead of define_decl(). (finish_class): Call build_decl(), pushdecl() and finish_decl() instead of define_decl(). (add_protocols): Use PROTOCOL_BINFO_ELTS for the tree vector size. (start_protocol): Do not call build_protocol_template(); use PROTOCOL_BINFO_ELTS for the tree vector size. (encode_type_qualifiers): Do not handle the 'const' qualifier here. (encode_pointer): Encode 'const char *' as 'r*', for backwards compatibility. (encode_array): Use HOST_WIDE_INT_PRINT_DEC instead of "%ld". (encode_type): Handle the 'const' qualifier here. (objc_parmlist): New global variable, sued by objc_push_parm and objc_get_parm_info(). (objc_push_parm, objc_get_parm_info): New functions. (objc_expr_last): Remove function. (synth_self_and_ucmd_args): For instance methods, use the instance type for 'self'; call objc_push_parm() instead of push_parm_decl(). (start_method_def): Do not call push_scope(), declare_parm_level(), pop_scope(), push_parm_decl(), store_parm_decls() or objc_expr_last(); just use objc_push_parm() and objc_get_parm_info(). (comp_method_with_proto): Remove function. (objc_types_are_equivalent): Strip away indirections before comparing underlying types. (comp_proto_with_proto): Do not call groktypename(); types are no longer in raw declspec format. (objc_start_function): New function. (really_start_method): Call comp_proto_with_proto() instead of comp_method_with_proto(); call objc_start_function() instead of hand-crafting a function declarator. (continue_method_def, objc_expand_function_end): Remove functions. (get_super_receiver): Call objc_get_current_scope() instead of get_current_scope(); reference 'super_class' field (instead of 'class'). (finish_method_def): Rename to objc_finish_method_definition() and add a function decl parameter; move method encoding call from objc_expand_function_end(). (is_complex_decl, adorn_decl, gen_declarator, gen_declspecs, gen_declaration_1): Remove functions. (tmpbuf, RAW_DECLSPEC): Remove. (gen_declaration): Remove second parameter; simplify to deal with TYPE_P nodes instead of raw declspecs. (gen_type_name, gen_type_name_0): New functions. (gen_method_decl): Remove second parameter; call gen_type_name() instead of gen_declaration_1(). (dump_interface): Adjust calls to gen_declaration() and gen_method_decl(); do not allocate a separate string buffer. (init_objc): Allocate a larger string buffer to accommodate dump_interface(); adjust call to build_module_descriptor(); add call to build_module_initializer_routine() for the GNU runtime. (generate_classref_translation_entry): Do not call start_decl(); call finish_var_decl() instead of finish_decl(); call convert() instead of build_c_cast(). * objc-act.h (CLASS_OWN_IVARS): Remove accessor. (CLASS_BINFO_ELTS): Reduce from 6 to 5, now that CLASS_OWN_IVARS is gone. (OCTI_GNU_INIT_DECL, GNU_INIT_decl): New. (OCTI_ELLIPSIS_NODE, objc_ellipsis_node): Remove. (OCTI_ID_ID, id_type, objc_id_id): Rename to OCTI_ID_NAME, objc_object_type and objc_object_name, respectively. (OCTI_CLS_REF, OCTI_CLASS_NAME, objc_class_reference, objc_class_name): New. (IS_CLASS): New macro. (IS_ID, IS_SUPER): Robustify. (OCTI_EXECCLASS_DECL, execclass_decl): New. (finish_file, start_class, continue_class, finish_class, start_method_def, continue_method_def, finish_method_def, start_protocol, finish_protocol, objc_build_throw_stmt, objc_build_try_catch_finally_stmt, objc_build_synchronized_prologue, objc_build_synchronized_epilogue, objc_build_try_prologue, objc_build_try_epilogue, objc_build_catch_stmt, objc_build_catch_epilogue, objc_build_finally_prologue, objc_build_finally_epilogue, is_ivar, is_private, is_public, add_instance_variable, objc_add_method, get_super_receiver, objc_clear_super_receiver, get_class_ivars_from_name, get_class_reference, get_static_reference, get_object_reference, build_message_expr, finish_message_expr, build_selector_expr, build_ivar_reference, build_keyword_decl, build_method_decl, build_protocol_expr, build_objc_string_object, objc_declare_alias, objc_declare_class, objc_declare_protocols, objc_comptypes, objc_check_decl, build_encode_expr): Remove prototypes. (imp_count, cat_count): Make GGC-aware. (OBJC_SET_TYPE_NAME): New macro. From-SVN: r87168
2004-09-08 02:49:44 +02:00
CLASS_RAW_IVARS (class) = chainon (CLASS_RAW_IVARS (class), field_decl);
1992-01-18 00:15:38 +01:00
return class;
}
Makefile.in (c-parse.o): Depend on $(C_COMMON_H). [gcc/ChangeLog] 2004-09-07 Ziemowit Laski <zlaski@apple.com> * Makefile.in (c-parse.o): Depend on $(C_COMMON_H). * c-parse.in: Include c-common.h instead of objc-act.h. (ivar_decl_list, ivar_decls, ivar_decl, ivars, ivar_declarator, myparms, myparm): Remove %type declarations. (methodtype, optparms, OBJC_TYPE_QUAL, objc_quals, objc_qual, objc_typename, objc_try_catch_stmt, optellipsis): Add %type declarations. (objc_inherit_code, objc_public_flag): Remove. (typespec_nonreserved_nonattr): Call objc_get_protocol_qualified_type() instead of get_static_reference() and get_protocol_reference(). (stmt_nocomp): Call grokparm() on @catch parameter. (objcdef): Move semantic action to objc_finish_implementation(). (classdef): Move semantic action to objc_start_class_interface(), objc_continue_interface(), objc_finish_interface(), objc_start_class_implementation(), objc_continue_implementation(), objc_start_category_interface() and objc_start_category_implementation(). (protocoldef): Move semantic actions to objc_start_protocol() and objc_finish_interface(). (ivar_decl_list): Remove nonterminal. (visibility_spec): Move semantic actions to objc_set_visibility(). (ivar_decls): Remove assignment to $$. (ivar_decl): Rephrase in terms of component_decl; call objc_add_instance_variable(). (ivars, ivar_declarator): Remove nonterminals. (opt_semi): New nonterminal. (methodtype): Remove semantic actions. (methoddef): Move semantic actions to objc_set_method_type(), objc_start_method_definition() and objc_finish_method_definition(). (methodproto): Move semantic actions to objc_set_method_type() and objc_add_method_declaration(). (methoddecl): Use objc_typename instead of typename; move semantic actions to objc_build_method_signature(). (optarglist, myxdecls, mydecl, myparms, myparm): Remove nonterminals. (optparmlist): Express in terms of optparms and optellipsis. (optparms, optellipsis, objc_qual, objc_quals, objc_typename): New nonterminals. (keyworddecl): Use objc_typename instead of typename. (rid_to_yy): Mark RID_IN, RID_OUT, RID_INOUT, RID_BYCOPY, RID_BYREF and RID_ONEWAY as returning OBJC_TYPE_QUAL to yyparse(). [gcc/objc/ChangeLog] 2004-09-07 Ziemowit Laski <zlaski@apple.com> * Make-lang.in (objc/objc-parse.o): Depend on $(C_COMMON_H) instead of objc/objc-act.h. (objc/objc-act.o): Depend on $(HASHTAB_H). * objc-act.c: Include hashtab.h; in ObjC++ mode, include cp-tree.h and objcp-decl.h instead of c-tree.h. (build_module_descriptor, get_class_ivars, synth_id_with_class_suffix, error_with_ivar, gen_method_decl, gen_declaration, setup_string_decl, build_protocol_template): Adjust prototypes. (build_module_initializer_routine, start_class, continue_class, finish_class, start_method_def, objc_start_function, start_protocol, build_method_decl, objc_add_method, add_instance_variable, build_ivar_reference, is_ivar, is_private, get_super_receiver, build_selector_table_decl, objc_push_parm, objc_get_parm_info, gen_type_name, gen_type_name_0, start_var_decl, finish_var_decl, create_field_decl): New prototypes. (objc_expand_function_end, comp_method_with_proto, objc_expr_last, gen_declaration_1, gen_declarator, is_complex_decl, adorn_decl, define_decl, create_builtin_decl, gen_declspecs): Remove prototypes. (TYPE_ID): Rename to OBJECT_TYPEDEF_NAME. (CLASS_TYPEDEF_NAME): New. (TAG_EXECCLASS): Change from a global variable to a #define. (TAG_RETURN_STRUCT): Delete. (TAG_GNUINIT): New, holds '__objc_gnu_init' name. (objc_inherit_code, objc_public_flag): New, moved from c-parse.in. (string_descriptor): New struct. (string_htab): New hash table. (string_hash, string_eq): New prototypes. (generate_struct_by_value_array): Call create_field_decl() instead of create_builtin_decl(). (objc_init): Do not initialize objc_ellipsis_node or TAG_EXECCLASS; In ObjC++ mode, call cxx_init() instead of c_objc_common_init(). (objc_finish_file): In ObjC++, call instantiate_pending_templates() and cp_finish_file(). (define_decl, get_static_reference, get_protocol_reference, create_builtin_decl): Remove functions. (objc_start_class_interface, objc_start_category_interface, objc_start_protocol, objc_continue_interface, objc_finish_interface, objc_start_class_implementation, objc_start_category_implementation, objc_continue_implementation, objc_finish_implementation, objc_set_visibility, objc_set_method_type, objc_build_method_signature, objc_add_method_declaration, objc_start_method_definition, objc_add_instance_variable, objc_get_protocol_qualified_type, create_field_decl, start_var_decl, finish_var_decl): New functions. (setup_string_decl): Simplify since it is only called once. (synth_module_prologue): Call build_class_template(); predefine 'id' and 'Class' as typedefs; rename 'temp_type' to 'type'; disable debug hooks for duration of function; fix GNU runtime messenger signatures to correspond to reality; forward-declare '__objc_exec_class' for the GNU runtime; call build_selector_table_decl(); in ObjC++ mode, generate 'extern "C" { ... }' wrappers around synthesized declarations; call build_protocol_template() and build_category_template(). (string_hash, string_eq): New functions. (objc_build_string_object): Check metaclass correctness only once; store string literals in hash table. (objc_build_constructor): Do not convert initializer elements; adjust for ObjC++ impedance mismatch. (build_objc_symtab_template): Call create_field_decl() instead of create_builtin_decl(). (init_objc_symtab): Add missing conversion to initializer element. (build_metadata_decl): Call start_var_decl() instead of define_decl(). (generate_objc_symtab_decl): Do not call build_category_template(); call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(). (build_module_descriptor): Call create_field_decl() instead of grokfield(); call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(); always mark module descriptor as used; move GNU runtime-specific functionality to build_module_initializer_routine(). (build_module_initializer_routine): New function, broken off of build_module_descriptor(). (objc_static_init_needed_p, objc_generate_static_init_call): New functions. (generate_static_references, generate_strings, build_selector_translation_table, generate_descriptor_table, generate_ivars_list, generate_dispatch_table, generate_category): Call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(); build a type directly instead of via groktypename(). (build_selector_reference_decl, build_selector_table_decl, build_class_reference_decl, build_protocol_reference, generate_objc_image_info): Call start_var_decl() instead of build_decl(). (build_selector_reference): For GNU runtime, do not call build_selector_reference_decl(). (build_selector, build_typed_selector_reference): Always convert result to the selector type. (add_objc_string): Cast return value to 'char *'. (build_method_prototype_template, build_selector_template, build_method_template): Use actual selector type for fields pointing to selectors. (finish_objc): For GNU runtime, call build_module_initializer_routine() after build_module_descriptor(). (generate_protocol_list, generate_shared_structures): Call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(); build a type directly instead of via groktypename(). (synth_id_with_class_suffix): Return a string. (get_arg_type_list): For instance methods, use the instance type for 'self'; do not call groktypename_in_parm_context(). (build_objc_string_decl): Squash redeclaration errors in ObjC++. (objc_is_class_name): Use OBJC_TYPE_NAME instead of TYPE_NAME; handle RECORD_TYPEs in ObjC as well as ObjC++. (objc_is_id): New function. (objc_is_object_ptr): Return the canonical type node. (objc_get_class_ivars): Simplify using get_class_ivars(). (get_class_ivars): Remove second parameter; create a fresh copy of the ivar list for each call; do not check for existence of super class. (objc_eh_runtime_type): Mark #ifndef OBJCPLUS. (objc_init_exceptions): When using SJLJ-style exceptions, require the use of '-fobjc-exceptions' flag; do not require it for DWARF-style exceptions. (objc_build_exc_ptr, next_sjlj_build_try_catch_finally): Use objc_object_type instead of objc_id_type. (objc_begin_catch_clause): Convert the incoming PARM_DECL into a VAR_DECL before placing it in the appropriate scope; do not call define_decl(); adjust call to c_begin_compound_stmt(); use objc_object_type instead of objc_id_type. (build_next_objc_exception_stuff): Call create_field_decl() instead of create_builtin_decl(); construct type directly instead of calling groktypename(); use OBJC_VOID_AT_END to mark end of function parameters. (build_private_template): Adjust call to get_class_ivars(); build a type directly instead of via groktypename(). (build_protocol_template, build_method_prototype_list_template, build_method_prototype_template, build_category_template, build_selector_template, build_class_template, build_super_template, build_ivar_template, build_ivar_list_template, build_method_list_template, build_method_template): Call create_field_decl() instead of grokfield(). (objc_method_parm_type): Do not call groktypename(). (generate_descriptor_table): Call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(). (generate_method_descriptors, build_protocol_initializer, generate_dispatch_tables, build_category_initializer, build_shared_structure_initializer): Do not call groktypename(). (generate_protocols): Call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(); do not call groktypename(). (error_with_ivar): Remove last parameter. (check_ivars): Do not iterate ovar CLASS_RAW_IVARS lists in addition to CLASS_IVARS lists; adjust calls to error_with_ivar(). (generate_ivar_lists): Convert one of the initializer elements; do not call groktypename(). (get_arg_type_list, start_method_def, gen_method_def): Account for new representation of variable arguments and '...' in Objective-C methods; add Objective-C++ impedance matching code. (is_objc_type_qualifier): Remove function. (adjust_type_for_id_default): Simplify; there is no longer a need to wade through declspecs. (lookup_interface, start_class, continue_class, finish_class, start_method_def, start_protocol, build_method_decl, objc_add_method, add_instance_variable, build_ivar_reference, is_ivar, is_private, get_super_receiver, objc_build_finally_epilogue): Make into static functions. (receiver_is_class_object): Use new IS_CLASS() macro. (objc_build_message_expr): Tweak ObjC++ message argument handling; call objc_finish_message_expr() instead of finish_message_expr(). (finish_message_expr): Rename to objc_finish_message_expr(); use OBJC_TYPE_NAME and OBJC_SET_TYPE_NAME macros instead of TYPE_NAME. call gen_type_name() instead of gen_declaration(); call objc_is_id() instead of using IS_ID and IS_CLASS; Use objc_class_name instead of calling get_identifier("Class"); handle CONVERT_EXPRs in receiver. (build_objc_method_call, warn_with_method): Do not call groktypename(). (build_ivar_reference): Call convert() instead of clobbering in a type. (hash_init): Initialize string_htab hash table. (add_instance_variable): Simplify parameter list; do not call grokfield(); do not populate CLASS_IVARS list. (start_class): Check for the existence of super class, if one was specified. (continue_class): Use CLASS_RAW_IVARS rather than CLASS_IVARS; do not call build_class_template(); adjust call to get_class_ivars(); call build_decl(), pushdecl() and finish_decl() instead of define_decl(). (finish_class): Call build_decl(), pushdecl() and finish_decl() instead of define_decl(). (add_protocols): Use PROTOCOL_BINFO_ELTS for the tree vector size. (start_protocol): Do not call build_protocol_template(); use PROTOCOL_BINFO_ELTS for the tree vector size. (encode_type_qualifiers): Do not handle the 'const' qualifier here. (encode_pointer): Encode 'const char *' as 'r*', for backwards compatibility. (encode_array): Use HOST_WIDE_INT_PRINT_DEC instead of "%ld". (encode_type): Handle the 'const' qualifier here. (objc_parmlist): New global variable, sued by objc_push_parm and objc_get_parm_info(). (objc_push_parm, objc_get_parm_info): New functions. (objc_expr_last): Remove function. (synth_self_and_ucmd_args): For instance methods, use the instance type for 'self'; call objc_push_parm() instead of push_parm_decl(). (start_method_def): Do not call push_scope(), declare_parm_level(), pop_scope(), push_parm_decl(), store_parm_decls() or objc_expr_last(); just use objc_push_parm() and objc_get_parm_info(). (comp_method_with_proto): Remove function. (objc_types_are_equivalent): Strip away indirections before comparing underlying types. (comp_proto_with_proto): Do not call groktypename(); types are no longer in raw declspec format. (objc_start_function): New function. (really_start_method): Call comp_proto_with_proto() instead of comp_method_with_proto(); call objc_start_function() instead of hand-crafting a function declarator. (continue_method_def, objc_expand_function_end): Remove functions. (get_super_receiver): Call objc_get_current_scope() instead of get_current_scope(); reference 'super_class' field (instead of 'class'). (finish_method_def): Rename to objc_finish_method_definition() and add a function decl parameter; move method encoding call from objc_expand_function_end(). (is_complex_decl, adorn_decl, gen_declarator, gen_declspecs, gen_declaration_1): Remove functions. (tmpbuf, RAW_DECLSPEC): Remove. (gen_declaration): Remove second parameter; simplify to deal with TYPE_P nodes instead of raw declspecs. (gen_type_name, gen_type_name_0): New functions. (gen_method_decl): Remove second parameter; call gen_type_name() instead of gen_declaration_1(). (dump_interface): Adjust calls to gen_declaration() and gen_method_decl(); do not allocate a separate string buffer. (init_objc): Allocate a larger string buffer to accommodate dump_interface(); adjust call to build_module_descriptor(); add call to build_module_initializer_routine() for the GNU runtime. (generate_classref_translation_entry): Do not call start_decl(); call finish_var_decl() instead of finish_decl(); call convert() instead of build_c_cast(). * objc-act.h (CLASS_OWN_IVARS): Remove accessor. (CLASS_BINFO_ELTS): Reduce from 6 to 5, now that CLASS_OWN_IVARS is gone. (OCTI_GNU_INIT_DECL, GNU_INIT_decl): New. (OCTI_ELLIPSIS_NODE, objc_ellipsis_node): Remove. (OCTI_ID_ID, id_type, objc_id_id): Rename to OCTI_ID_NAME, objc_object_type and objc_object_name, respectively. (OCTI_CLS_REF, OCTI_CLASS_NAME, objc_class_reference, objc_class_name): New. (IS_CLASS): New macro. (IS_ID, IS_SUPER): Robustify. (OCTI_EXECCLASS_DECL, execclass_decl): New. (finish_file, start_class, continue_class, finish_class, start_method_def, continue_method_def, finish_method_def, start_protocol, finish_protocol, objc_build_throw_stmt, objc_build_try_catch_finally_stmt, objc_build_synchronized_prologue, objc_build_synchronized_epilogue, objc_build_try_prologue, objc_build_try_epilogue, objc_build_catch_stmt, objc_build_catch_epilogue, objc_build_finally_prologue, objc_build_finally_epilogue, is_ivar, is_private, is_public, add_instance_variable, objc_add_method, get_super_receiver, objc_clear_super_receiver, get_class_ivars_from_name, get_class_reference, get_static_reference, get_object_reference, build_message_expr, finish_message_expr, build_selector_expr, build_ivar_reference, build_keyword_decl, build_method_decl, build_protocol_expr, build_objc_string_object, objc_declare_alias, objc_declare_class, objc_declare_protocols, objc_comptypes, objc_check_decl, build_encode_expr): Remove prototypes. (imp_count, cat_count): Make GGC-aware. (OBJC_SET_TYPE_NAME): New macro. From-SVN: r87168
2004-09-08 02:49:44 +02:00
static tree
is_ivar (tree decl_chain, tree ident)
1992-01-18 00:15:38 +01:00
{
for ( ; decl_chain; decl_chain = TREE_CHAIN (decl_chain))
if (DECL_NAME (decl_chain) == ident)
return decl_chain;
return NULL_TREE;
}
/* True if the ivar is private and we are not in its implementation. */
Makefile.in (c-parse.o): Depend on $(C_COMMON_H). [gcc/ChangeLog] 2004-09-07 Ziemowit Laski <zlaski@apple.com> * Makefile.in (c-parse.o): Depend on $(C_COMMON_H). * c-parse.in: Include c-common.h instead of objc-act.h. (ivar_decl_list, ivar_decls, ivar_decl, ivars, ivar_declarator, myparms, myparm): Remove %type declarations. (methodtype, optparms, OBJC_TYPE_QUAL, objc_quals, objc_qual, objc_typename, objc_try_catch_stmt, optellipsis): Add %type declarations. (objc_inherit_code, objc_public_flag): Remove. (typespec_nonreserved_nonattr): Call objc_get_protocol_qualified_type() instead of get_static_reference() and get_protocol_reference(). (stmt_nocomp): Call grokparm() on @catch parameter. (objcdef): Move semantic action to objc_finish_implementation(). (classdef): Move semantic action to objc_start_class_interface(), objc_continue_interface(), objc_finish_interface(), objc_start_class_implementation(), objc_continue_implementation(), objc_start_category_interface() and objc_start_category_implementation(). (protocoldef): Move semantic actions to objc_start_protocol() and objc_finish_interface(). (ivar_decl_list): Remove nonterminal. (visibility_spec): Move semantic actions to objc_set_visibility(). (ivar_decls): Remove assignment to $$. (ivar_decl): Rephrase in terms of component_decl; call objc_add_instance_variable(). (ivars, ivar_declarator): Remove nonterminals. (opt_semi): New nonterminal. (methodtype): Remove semantic actions. (methoddef): Move semantic actions to objc_set_method_type(), objc_start_method_definition() and objc_finish_method_definition(). (methodproto): Move semantic actions to objc_set_method_type() and objc_add_method_declaration(). (methoddecl): Use objc_typename instead of typename; move semantic actions to objc_build_method_signature(). (optarglist, myxdecls, mydecl, myparms, myparm): Remove nonterminals. (optparmlist): Express in terms of optparms and optellipsis. (optparms, optellipsis, objc_qual, objc_quals, objc_typename): New nonterminals. (keyworddecl): Use objc_typename instead of typename. (rid_to_yy): Mark RID_IN, RID_OUT, RID_INOUT, RID_BYCOPY, RID_BYREF and RID_ONEWAY as returning OBJC_TYPE_QUAL to yyparse(). [gcc/objc/ChangeLog] 2004-09-07 Ziemowit Laski <zlaski@apple.com> * Make-lang.in (objc/objc-parse.o): Depend on $(C_COMMON_H) instead of objc/objc-act.h. (objc/objc-act.o): Depend on $(HASHTAB_H). * objc-act.c: Include hashtab.h; in ObjC++ mode, include cp-tree.h and objcp-decl.h instead of c-tree.h. (build_module_descriptor, get_class_ivars, synth_id_with_class_suffix, error_with_ivar, gen_method_decl, gen_declaration, setup_string_decl, build_protocol_template): Adjust prototypes. (build_module_initializer_routine, start_class, continue_class, finish_class, start_method_def, objc_start_function, start_protocol, build_method_decl, objc_add_method, add_instance_variable, build_ivar_reference, is_ivar, is_private, get_super_receiver, build_selector_table_decl, objc_push_parm, objc_get_parm_info, gen_type_name, gen_type_name_0, start_var_decl, finish_var_decl, create_field_decl): New prototypes. (objc_expand_function_end, comp_method_with_proto, objc_expr_last, gen_declaration_1, gen_declarator, is_complex_decl, adorn_decl, define_decl, create_builtin_decl, gen_declspecs): Remove prototypes. (TYPE_ID): Rename to OBJECT_TYPEDEF_NAME. (CLASS_TYPEDEF_NAME): New. (TAG_EXECCLASS): Change from a global variable to a #define. (TAG_RETURN_STRUCT): Delete. (TAG_GNUINIT): New, holds '__objc_gnu_init' name. (objc_inherit_code, objc_public_flag): New, moved from c-parse.in. (string_descriptor): New struct. (string_htab): New hash table. (string_hash, string_eq): New prototypes. (generate_struct_by_value_array): Call create_field_decl() instead of create_builtin_decl(). (objc_init): Do not initialize objc_ellipsis_node or TAG_EXECCLASS; In ObjC++ mode, call cxx_init() instead of c_objc_common_init(). (objc_finish_file): In ObjC++, call instantiate_pending_templates() and cp_finish_file(). (define_decl, get_static_reference, get_protocol_reference, create_builtin_decl): Remove functions. (objc_start_class_interface, objc_start_category_interface, objc_start_protocol, objc_continue_interface, objc_finish_interface, objc_start_class_implementation, objc_start_category_implementation, objc_continue_implementation, objc_finish_implementation, objc_set_visibility, objc_set_method_type, objc_build_method_signature, objc_add_method_declaration, objc_start_method_definition, objc_add_instance_variable, objc_get_protocol_qualified_type, create_field_decl, start_var_decl, finish_var_decl): New functions. (setup_string_decl): Simplify since it is only called once. (synth_module_prologue): Call build_class_template(); predefine 'id' and 'Class' as typedefs; rename 'temp_type' to 'type'; disable debug hooks for duration of function; fix GNU runtime messenger signatures to correspond to reality; forward-declare '__objc_exec_class' for the GNU runtime; call build_selector_table_decl(); in ObjC++ mode, generate 'extern "C" { ... }' wrappers around synthesized declarations; call build_protocol_template() and build_category_template(). (string_hash, string_eq): New functions. (objc_build_string_object): Check metaclass correctness only once; store string literals in hash table. (objc_build_constructor): Do not convert initializer elements; adjust for ObjC++ impedance mismatch. (build_objc_symtab_template): Call create_field_decl() instead of create_builtin_decl(). (init_objc_symtab): Add missing conversion to initializer element. (build_metadata_decl): Call start_var_decl() instead of define_decl(). (generate_objc_symtab_decl): Do not call build_category_template(); call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(). (build_module_descriptor): Call create_field_decl() instead of grokfield(); call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(); always mark module descriptor as used; move GNU runtime-specific functionality to build_module_initializer_routine(). (build_module_initializer_routine): New function, broken off of build_module_descriptor(). (objc_static_init_needed_p, objc_generate_static_init_call): New functions. (generate_static_references, generate_strings, build_selector_translation_table, generate_descriptor_table, generate_ivars_list, generate_dispatch_table, generate_category): Call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(); build a type directly instead of via groktypename(). (build_selector_reference_decl, build_selector_table_decl, build_class_reference_decl, build_protocol_reference, generate_objc_image_info): Call start_var_decl() instead of build_decl(). (build_selector_reference): For GNU runtime, do not call build_selector_reference_decl(). (build_selector, build_typed_selector_reference): Always convert result to the selector type. (add_objc_string): Cast return value to 'char *'. (build_method_prototype_template, build_selector_template, build_method_template): Use actual selector type for fields pointing to selectors. (finish_objc): For GNU runtime, call build_module_initializer_routine() after build_module_descriptor(). (generate_protocol_list, generate_shared_structures): Call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(); build a type directly instead of via groktypename(). (synth_id_with_class_suffix): Return a string. (get_arg_type_list): For instance methods, use the instance type for 'self'; do not call groktypename_in_parm_context(). (build_objc_string_decl): Squash redeclaration errors in ObjC++. (objc_is_class_name): Use OBJC_TYPE_NAME instead of TYPE_NAME; handle RECORD_TYPEs in ObjC as well as ObjC++. (objc_is_id): New function. (objc_is_object_ptr): Return the canonical type node. (objc_get_class_ivars): Simplify using get_class_ivars(). (get_class_ivars): Remove second parameter; create a fresh copy of the ivar list for each call; do not check for existence of super class. (objc_eh_runtime_type): Mark #ifndef OBJCPLUS. (objc_init_exceptions): When using SJLJ-style exceptions, require the use of '-fobjc-exceptions' flag; do not require it for DWARF-style exceptions. (objc_build_exc_ptr, next_sjlj_build_try_catch_finally): Use objc_object_type instead of objc_id_type. (objc_begin_catch_clause): Convert the incoming PARM_DECL into a VAR_DECL before placing it in the appropriate scope; do not call define_decl(); adjust call to c_begin_compound_stmt(); use objc_object_type instead of objc_id_type. (build_next_objc_exception_stuff): Call create_field_decl() instead of create_builtin_decl(); construct type directly instead of calling groktypename(); use OBJC_VOID_AT_END to mark end of function parameters. (build_private_template): Adjust call to get_class_ivars(); build a type directly instead of via groktypename(). (build_protocol_template, build_method_prototype_list_template, build_method_prototype_template, build_category_template, build_selector_template, build_class_template, build_super_template, build_ivar_template, build_ivar_list_template, build_method_list_template, build_method_template): Call create_field_decl() instead of grokfield(). (objc_method_parm_type): Do not call groktypename(). (generate_descriptor_table): Call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(). (generate_method_descriptors, build_protocol_initializer, generate_dispatch_tables, build_category_initializer, build_shared_structure_initializer): Do not call groktypename(). (generate_protocols): Call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(); do not call groktypename(). (error_with_ivar): Remove last parameter. (check_ivars): Do not iterate ovar CLASS_RAW_IVARS lists in addition to CLASS_IVARS lists; adjust calls to error_with_ivar(). (generate_ivar_lists): Convert one of the initializer elements; do not call groktypename(). (get_arg_type_list, start_method_def, gen_method_def): Account for new representation of variable arguments and '...' in Objective-C methods; add Objective-C++ impedance matching code. (is_objc_type_qualifier): Remove function. (adjust_type_for_id_default): Simplify; there is no longer a need to wade through declspecs. (lookup_interface, start_class, continue_class, finish_class, start_method_def, start_protocol, build_method_decl, objc_add_method, add_instance_variable, build_ivar_reference, is_ivar, is_private, get_super_receiver, objc_build_finally_epilogue): Make into static functions. (receiver_is_class_object): Use new IS_CLASS() macro. (objc_build_message_expr): Tweak ObjC++ message argument handling; call objc_finish_message_expr() instead of finish_message_expr(). (finish_message_expr): Rename to objc_finish_message_expr(); use OBJC_TYPE_NAME and OBJC_SET_TYPE_NAME macros instead of TYPE_NAME. call gen_type_name() instead of gen_declaration(); call objc_is_id() instead of using IS_ID and IS_CLASS; Use objc_class_name instead of calling get_identifier("Class"); handle CONVERT_EXPRs in receiver. (build_objc_method_call, warn_with_method): Do not call groktypename(). (build_ivar_reference): Call convert() instead of clobbering in a type. (hash_init): Initialize string_htab hash table. (add_instance_variable): Simplify parameter list; do not call grokfield(); do not populate CLASS_IVARS list. (start_class): Check for the existence of super class, if one was specified. (continue_class): Use CLASS_RAW_IVARS rather than CLASS_IVARS; do not call build_class_template(); adjust call to get_class_ivars(); call build_decl(), pushdecl() and finish_decl() instead of define_decl(). (finish_class): Call build_decl(), pushdecl() and finish_decl() instead of define_decl(). (add_protocols): Use PROTOCOL_BINFO_ELTS for the tree vector size. (start_protocol): Do not call build_protocol_template(); use PROTOCOL_BINFO_ELTS for the tree vector size. (encode_type_qualifiers): Do not handle the 'const' qualifier here. (encode_pointer): Encode 'const char *' as 'r*', for backwards compatibility. (encode_array): Use HOST_WIDE_INT_PRINT_DEC instead of "%ld". (encode_type): Handle the 'const' qualifier here. (objc_parmlist): New global variable, sued by objc_push_parm and objc_get_parm_info(). (objc_push_parm, objc_get_parm_info): New functions. (objc_expr_last): Remove function. (synth_self_and_ucmd_args): For instance methods, use the instance type for 'self'; call objc_push_parm() instead of push_parm_decl(). (start_method_def): Do not call push_scope(), declare_parm_level(), pop_scope(), push_parm_decl(), store_parm_decls() or objc_expr_last(); just use objc_push_parm() and objc_get_parm_info(). (comp_method_with_proto): Remove function. (objc_types_are_equivalent): Strip away indirections before comparing underlying types. (comp_proto_with_proto): Do not call groktypename(); types are no longer in raw declspec format. (objc_start_function): New function. (really_start_method): Call comp_proto_with_proto() instead of comp_method_with_proto(); call objc_start_function() instead of hand-crafting a function declarator. (continue_method_def, objc_expand_function_end): Remove functions. (get_super_receiver): Call objc_get_current_scope() instead of get_current_scope(); reference 'super_class' field (instead of 'class'). (finish_method_def): Rename to objc_finish_method_definition() and add a function decl parameter; move method encoding call from objc_expand_function_end(). (is_complex_decl, adorn_decl, gen_declarator, gen_declspecs, gen_declaration_1): Remove functions. (tmpbuf, RAW_DECLSPEC): Remove. (gen_declaration): Remove second parameter; simplify to deal with TYPE_P nodes instead of raw declspecs. (gen_type_name, gen_type_name_0): New functions. (gen_method_decl): Remove second parameter; call gen_type_name() instead of gen_declaration_1(). (dump_interface): Adjust calls to gen_declaration() and gen_method_decl(); do not allocate a separate string buffer. (init_objc): Allocate a larger string buffer to accommodate dump_interface(); adjust call to build_module_descriptor(); add call to build_module_initializer_routine() for the GNU runtime. (generate_classref_translation_entry): Do not call start_decl(); call finish_var_decl() instead of finish_decl(); call convert() instead of build_c_cast(). * objc-act.h (CLASS_OWN_IVARS): Remove accessor. (CLASS_BINFO_ELTS): Reduce from 6 to 5, now that CLASS_OWN_IVARS is gone. (OCTI_GNU_INIT_DECL, GNU_INIT_decl): New. (OCTI_ELLIPSIS_NODE, objc_ellipsis_node): Remove. (OCTI_ID_ID, id_type, objc_id_id): Rename to OCTI_ID_NAME, objc_object_type and objc_object_name, respectively. (OCTI_CLS_REF, OCTI_CLASS_NAME, objc_class_reference, objc_class_name): New. (IS_CLASS): New macro. (IS_ID, IS_SUPER): Robustify. (OCTI_EXECCLASS_DECL, execclass_decl): New. (finish_file, start_class, continue_class, finish_class, start_method_def, continue_method_def, finish_method_def, start_protocol, finish_protocol, objc_build_throw_stmt, objc_build_try_catch_finally_stmt, objc_build_synchronized_prologue, objc_build_synchronized_epilogue, objc_build_try_prologue, objc_build_try_epilogue, objc_build_catch_stmt, objc_build_catch_epilogue, objc_build_finally_prologue, objc_build_finally_epilogue, is_ivar, is_private, is_public, add_instance_variable, objc_add_method, get_super_receiver, objc_clear_super_receiver, get_class_ivars_from_name, get_class_reference, get_static_reference, get_object_reference, build_message_expr, finish_message_expr, build_selector_expr, build_ivar_reference, build_keyword_decl, build_method_decl, build_protocol_expr, build_objc_string_object, objc_declare_alias, objc_declare_class, objc_declare_protocols, objc_comptypes, objc_check_decl, build_encode_expr): Remove prototypes. (imp_count, cat_count): Make GGC-aware. (OBJC_SET_TYPE_NAME): New macro. From-SVN: r87168
2004-09-08 02:49:44 +02:00
static int
is_private (tree decl)
{
return (TREE_PRIVATE (decl)
&& ! is_ivar (CLASS_IVARS (implementation_template),
DECL_NAME (decl)));
}
/* We have an instance variable reference;, check to see if it is public. */
1992-01-18 00:15:38 +01:00
int
objc_is_public (tree expr, tree identifier)
1992-01-18 00:15:38 +01:00
{
objc-act.c (objc_build_struct): New function. * objc-act.c (objc_build_struct): New function. (objc_derived_from_p): Likewise. (objc_build_component_ref): Likewise. (objc_copy_binfo): Likewise. (objc_xref_basetypes): Likewise. (objc_lookup_protocol): Likewise. (objc_compare_protocols): Likewise. (objc_volatilize_decl): Likewise. (encode_aggregate_fields): Likewise. (volatilized_hash): Likewise. (volatilized_eq): Likewise. (objc_compare_types): Likewise. (objc_type_quals_match): Likewise. (DERIVED_FROM_P): New ObjC macro, corresponding to C++ macro of same name. (get_class_ivars): Add second parameter indicating if entire hierarchy is desired. (struct volatilized_type): New type. (volatilized_htab): New hash table. (objc_types_compatible_p, objc_comptypes): Remove functions. (synth_module_prologue): Do not initialize 'unused_list'. (objc_get_class_reference): Fix ObjC++ impedance mismatches. (objc_declare_alias): Implement as a typedef. (objc_substitute_decl, objc_gimplify_expr): Reformat. (objc_get_class_ivars): Adjust call to get_class_ivars(). (next_sjlj_build_enter_and_setjmp, synth_forward_declarations, build_ivar_reference, get_super_receiver): Call objc_build_component_ref() instead of build_component_ref(). (objc_begin_catch_clause): Use DERIVED_FROM_P() instead of objc_comptypes(). (build_private_template): Call objc_build_struct() instead of start_struct() and finish_struct(). (hash_init): Initialize volatilized_htab. (objc_is_public): Adjust calls to objc_get_ivars(); adjust ObjC++ impedance mismatches. (encode_aggregate_within): Streamline by calling encode_aggregate_fields(). * objc-act.h (objc_types_compatible_p): Remove prototype. (OCTI_UNUSED_LIST, unused_list): Remove slot. * objc-lang.c (LANG_HOOKS_TYPES_COMPATIBLE_P): Remove. From-SVN: r100123
2005-05-25 00:21:01 +02:00
tree basetype, decl;
#ifdef OBJCPLUS
if (processing_template_decl)
return 1;
#endif
if (TREE_TYPE (expr) == error_mark_node)
return 1;
objc-act.c (objc_build_struct): New function. * objc-act.c (objc_build_struct): New function. (objc_derived_from_p): Likewise. (objc_build_component_ref): Likewise. (objc_copy_binfo): Likewise. (objc_xref_basetypes): Likewise. (objc_lookup_protocol): Likewise. (objc_compare_protocols): Likewise. (objc_volatilize_decl): Likewise. (encode_aggregate_fields): Likewise. (volatilized_hash): Likewise. (volatilized_eq): Likewise. (objc_compare_types): Likewise. (objc_type_quals_match): Likewise. (DERIVED_FROM_P): New ObjC macro, corresponding to C++ macro of same name. (get_class_ivars): Add second parameter indicating if entire hierarchy is desired. (struct volatilized_type): New type. (volatilized_htab): New hash table. (objc_types_compatible_p, objc_comptypes): Remove functions. (synth_module_prologue): Do not initialize 'unused_list'. (objc_get_class_reference): Fix ObjC++ impedance mismatches. (objc_declare_alias): Implement as a typedef. (objc_substitute_decl, objc_gimplify_expr): Reformat. (objc_get_class_ivars): Adjust call to get_class_ivars(). (next_sjlj_build_enter_and_setjmp, synth_forward_declarations, build_ivar_reference, get_super_receiver): Call objc_build_component_ref() instead of build_component_ref(). (objc_begin_catch_clause): Use DERIVED_FROM_P() instead of objc_comptypes(). (build_private_template): Call objc_build_struct() instead of start_struct() and finish_struct(). (hash_init): Initialize volatilized_htab. (objc_is_public): Adjust calls to objc_get_ivars(); adjust ObjC++ impedance mismatches. (encode_aggregate_within): Streamline by calling encode_aggregate_fields(). * objc-act.h (objc_types_compatible_p): Remove prototype. (OCTI_UNUSED_LIST, unused_list): Remove slot. * objc-lang.c (LANG_HOOKS_TYPES_COMPATIBLE_P): Remove. From-SVN: r100123
2005-05-25 00:21:01 +02:00
basetype = TYPE_MAIN_VARIANT (TREE_TYPE (expr));
1992-01-18 00:15:38 +01:00
Yet more Objective-C++... * objc-act.c (objc_finish_try_stmt): Add return value. (objc_build_synchronized): Likewise. * objc-act.c (objc_is_gcable_type): Add. (objc_substitute_decl): Add. (objc_build_ivar_assignment): Add. (objc_build_global_assignment): Add. (objc_build_strong_cast_assignment): Add. (objc_is_ivar_reference_p): Add. (objc_is_global_reference_p): Add. (objc_generate_write_barrier): Add. (objc_rewrite_function_call): Add. (objc_gimplify_expr): Add Objective-C++ support. * objc-act.h (ALLOC_OBJC_TYPE_LANG_SPECIFIC): Likewise. (SIZEOF_OBJC_TYPE_LANG_SPECIFIC): Add. (INIT_TYPE_OBJC_INFO): Add Objective-C++ support. (DUP_TYPE_OBJC_INFO): Likewise. (struct imp_entry): Add field has_cxx_cdtors. (struct imp_entry *imp_list): Add OCTI_UMSG_FAST_DECL, OCTI_METH_LIST_TEMPL, OCTI_METH_PROTO_LIST_TEMPL, OCTI_IVAR_LIST_TEMPL, OCTI_ASSIGN_IVAR_DECL, OCTI_ASSIGN_IVAR_FAST_DECL, OCTI_ASSIGN_GLOBAL_DECL, OCTI_ASSIGN_STRONGCAST_DECL. (umsg_fast_decl): Add. (objc_assign_ivar_decl): Add. (objc_assign_ivar_fast_decl): Add. (objc_assign_global_decl): Add. (objc_assign_strong_cast_decl): Add. (objc_method_list_ptr): Add. (objc_method_proto_list_ptr): Add. (objc_ivar_list_ptr): Add. * objc-act.c (should_call_super_dealloc): Add. (OBJC_VERSION): Bump to 6. (objc_is_gcable_type): Add. (objc_substitute_decl): Add. (objc_build_ivar_assignment): Add. (objc_build_global_assignment): Add. (objc_build_strong_cast_assignment): Add. (objc_is_gcable_p): Add. (objc_is_ivar_reference_p): Add. (objc_is_global_reference_p): Add. (generate_shared_structures): Add flags parameter. (objc_generate_cxx_ctor_or_dtor): Add. (objc_generate_cxx_cdtors): Add. (add_class): Add name parameter. (objc_types_share_size_and_alignment): Add. (comp_proto_with_proto): Add strict parameter. (CLS_HAS_CXX_STRUCTORS): Add. (TAG_ASSIGNIVAR): Add. (TAG_ASSIGNGLOBAL): Add. (TAG_ASSIGNSTRONGCAST): Add. (TAG_MSGSEND_FAST): Add. (TAG_ASSIGNIVAR_FAST): Add. (TAG_CXX_CONSTRUCT): Add. (TAG_CXX_DESTRUCT): Add. (OBJC_LOOKUP_CLASS): Add. (OBJC_LOOKUP_NO_SUPER): Add. (objc_finish_file): Add pch support. (objc_finish_implementation): Add Objective-C++ support. (synth_module_prologue): Likewise. (synth_module_prologue): Add fast dispatching. (objc_get_class_reference): Add Objective-C++ support. (objc_generate_write_barrier): Likewise. (next_sjlj_build_enter_and_setjmp): Likewise. (objc_begin_try_stmt): Likewise. (build_next_objc_exception_stuff): Add fast ivar support. (build_private_template): Mark the record as used so debug information is generated. (build_protocol_template): Add Objective-C++ support. (objc_method_parm_type) Likewise. (objc_generate_cxx_ctor_or_dtor): Likewise. (objc_generate_cxx_cdtors): Likewise. (build_protocol_initializer): Likewise. (build_category_template): Likewise. (build_class_template): Likewise. (build_method_list_template): Likewise. (build_category_initializer): Likewise. (build_shared_structure_initializer): Likewise. (objc_finish_message_expr): Likewise. (build_objc_method_call): Add fast dispatch support. (lookup_method_static): Add support to end search at superclasses. (add_method_to_hash_list): Add strict parameter to comp_proto_with_proto. (objc_add_method): Likewise. (objc_add_method): Also set the interface_value. (add_instance_variable): Add Objective-C++ support. (objc_is_public): Likewise. (start_class): Likewise. (continue_class): Likewise. (encode_aggregate_within): Likewise. (start_method_def): Likewise. (objc_start_function): Clear current_function_returns_value and current_function_returns_null. (really_start_method): Add Objective-C++ support. (objc_finish_method_definition): Add warning for missing [super dealloc]. (finish_objc): Add Objective-C++ support. (generate_objc_image_info): Likewise. (objc_lookup_ivar): Likewise. * objc-act.h (TYPE_HAS_OBJC_INFO): Likewise. (INIT_TYPE_OBJC_INFO): Likewise. (DUP_TYPE_OBJC_INFO): Likewise. From-SVN: r99857
2005-05-17 22:07:08 +02:00
if (basetype && TREE_CODE (basetype) == RECORD_TYPE)
1992-01-18 00:15:38 +01:00
{
objc-act.c (build_private_template): Change to return 'void'... [gcc/objc/ChangeLog] 2004-12-15 Ziemowit Laski <zlaski@apple.com> * objc-act.c (build_private_template): Change to return 'void'; do not set ivar_context, uprivate_record or objc_instance_type. (objc_comptypes, gen_type_name_0): For types 'id' and 'Class', retrieve protocol list from the pointee rather than the pointer itself; check TYPE_HAS_OBJC_INFO(...) precondition before accessing TYPE_OBJC_PROTOCOL_LIST. (objc_get_protocol_qualified_type): For types 'id' and 'Class', construct a variant of the pointee as well as the pointer, and store protocol information in the former. When creating variants of RECORD_TYPEs, clone their TYPE_LANG_SPECIFIC fields and propagate TYPE_OBJC_INTERFACE information. (objc_declare_class): If a TYPE_DECL is looked up, retrieve the underlying RECORD_TYPE to check for presence of TYPE_OBJC_INTERFACE; for newly-created RECORD_TYPEs, create a tentative TYPE_OBJC_INTERFACE holding an IDENTIFIER_NODE. (objc_finish_message_expr): Check TYPE_HAS_OBJC_INFO(...) before accessing TYPE_OBJC_PROTOCOL_LIST; Use TYPE_OBJC_INTERFACE instead of calling lookup_interface(); allow for TYPE_OBJC_INTERFACE holding an IDENTIFIER_NODE (meaning a @class forward-declaration only). (objc_is_public): Check TYPE_OBJC_INTERFACE instead of calling lookup_interface(). (continue_class): For @implementations, set ivar_context, uprivate_record and objc_instance_type, for @interfaces, call build_private_template(). (encode_pointer): Check TYPE_HAS_OBJC_INFO(...) before accessing TYPE_OBJC_INTERFACE. (objc_types_are_equivalent): Check TYPE_HAS_OBJC_INFO(...) before accessing TYPE_OBJC_PROTOCOL_LIST. * objc-act.h (OBJC_INFO_SLOT_ELTS, TYPE_OBJC_INFO, INIT_TYPE_OBJC_INFO, DUP_TYPE_OBJC_INFO, ALLOC_OBJC_TYPE_LANG_SPECIFIC, SIZEOF_OBJC_TYPE_LANG_SPECIFIC): New macros. (TYPE_OBJC_INTERFACE): Replaces TREE_STATIC_INSTANCE and now points to an actual @interface; stored in TYPE_LANG_SPECIFIC(...). (TYPE_OBJC_PROTOCOL_LIST): Replaces TYPE_PROTOCOL_LIST; stored in TYPE_LANG_SPECIFIC(...). (TREE_STATIC_INSTANCE, TYPE_PROTOCOL_LIST): Delete. (IS_ID, IS_CLASS, IS_PROTOCOL_QUALIFIED_UNTYPED, IS_SUPER, TYPED_OBJECT): Check for POINTER_TYPE rather than POINTER_TYPE_P; adjust for use of TYPE_OBJC_INTERFACE and TYPE_OBJC_PROTOCOL_LIST instead of TREE_STATIC_INSTANCE and TYPE_PROTOCOL_LIST. From-SVN: r92239
2004-12-16 02:10:38 +01:00
if (TYPE_HAS_OBJC_INFO (basetype) && TYPE_OBJC_INTERFACE (basetype))
1992-01-18 00:15:38 +01:00
{
Yet more Objective-C++... * objc-act.c (objc_finish_try_stmt): Add return value. (objc_build_synchronized): Likewise. * objc-act.c (objc_is_gcable_type): Add. (objc_substitute_decl): Add. (objc_build_ivar_assignment): Add. (objc_build_global_assignment): Add. (objc_build_strong_cast_assignment): Add. (objc_is_ivar_reference_p): Add. (objc_is_global_reference_p): Add. (objc_generate_write_barrier): Add. (objc_rewrite_function_call): Add. (objc_gimplify_expr): Add Objective-C++ support. * objc-act.h (ALLOC_OBJC_TYPE_LANG_SPECIFIC): Likewise. (SIZEOF_OBJC_TYPE_LANG_SPECIFIC): Add. (INIT_TYPE_OBJC_INFO): Add Objective-C++ support. (DUP_TYPE_OBJC_INFO): Likewise. (struct imp_entry): Add field has_cxx_cdtors. (struct imp_entry *imp_list): Add OCTI_UMSG_FAST_DECL, OCTI_METH_LIST_TEMPL, OCTI_METH_PROTO_LIST_TEMPL, OCTI_IVAR_LIST_TEMPL, OCTI_ASSIGN_IVAR_DECL, OCTI_ASSIGN_IVAR_FAST_DECL, OCTI_ASSIGN_GLOBAL_DECL, OCTI_ASSIGN_STRONGCAST_DECL. (umsg_fast_decl): Add. (objc_assign_ivar_decl): Add. (objc_assign_ivar_fast_decl): Add. (objc_assign_global_decl): Add. (objc_assign_strong_cast_decl): Add. (objc_method_list_ptr): Add. (objc_method_proto_list_ptr): Add. (objc_ivar_list_ptr): Add. * objc-act.c (should_call_super_dealloc): Add. (OBJC_VERSION): Bump to 6. (objc_is_gcable_type): Add. (objc_substitute_decl): Add. (objc_build_ivar_assignment): Add. (objc_build_global_assignment): Add. (objc_build_strong_cast_assignment): Add. (objc_is_gcable_p): Add. (objc_is_ivar_reference_p): Add. (objc_is_global_reference_p): Add. (generate_shared_structures): Add flags parameter. (objc_generate_cxx_ctor_or_dtor): Add. (objc_generate_cxx_cdtors): Add. (add_class): Add name parameter. (objc_types_share_size_and_alignment): Add. (comp_proto_with_proto): Add strict parameter. (CLS_HAS_CXX_STRUCTORS): Add. (TAG_ASSIGNIVAR): Add. (TAG_ASSIGNGLOBAL): Add. (TAG_ASSIGNSTRONGCAST): Add. (TAG_MSGSEND_FAST): Add. (TAG_ASSIGNIVAR_FAST): Add. (TAG_CXX_CONSTRUCT): Add. (TAG_CXX_DESTRUCT): Add. (OBJC_LOOKUP_CLASS): Add. (OBJC_LOOKUP_NO_SUPER): Add. (objc_finish_file): Add pch support. (objc_finish_implementation): Add Objective-C++ support. (synth_module_prologue): Likewise. (synth_module_prologue): Add fast dispatching. (objc_get_class_reference): Add Objective-C++ support. (objc_generate_write_barrier): Likewise. (next_sjlj_build_enter_and_setjmp): Likewise. (objc_begin_try_stmt): Likewise. (build_next_objc_exception_stuff): Add fast ivar support. (build_private_template): Mark the record as used so debug information is generated. (build_protocol_template): Add Objective-C++ support. (objc_method_parm_type) Likewise. (objc_generate_cxx_ctor_or_dtor): Likewise. (objc_generate_cxx_cdtors): Likewise. (build_protocol_initializer): Likewise. (build_category_template): Likewise. (build_class_template): Likewise. (build_method_list_template): Likewise. (build_category_initializer): Likewise. (build_shared_structure_initializer): Likewise. (objc_finish_message_expr): Likewise. (build_objc_method_call): Add fast dispatch support. (lookup_method_static): Add support to end search at superclasses. (add_method_to_hash_list): Add strict parameter to comp_proto_with_proto. (objc_add_method): Likewise. (objc_add_method): Also set the interface_value. (add_instance_variable): Add Objective-C++ support. (objc_is_public): Likewise. (start_class): Likewise. (continue_class): Likewise. (encode_aggregate_within): Likewise. (start_method_def): Likewise. (objc_start_function): Clear current_function_returns_value and current_function_returns_null. (really_start_method): Add Objective-C++ support. (objc_finish_method_definition): Add warning for missing [super dealloc]. (finish_objc): Add Objective-C++ support. (generate_objc_image_info): Likewise. (objc_lookup_ivar): Likewise. * objc-act.h (TYPE_HAS_OBJC_INFO): Likewise. (INIT_TYPE_OBJC_INFO): Likewise. (DUP_TYPE_OBJC_INFO): Likewise. From-SVN: r99857
2005-05-17 22:07:08 +02:00
tree class = lookup_interface (OBJC_TYPE_NAME (basetype));
if (!class)
1992-01-18 00:15:38 +01:00
{
builtins.c, [...]: Avoid "`" as left quote, using "'" or %q, %< and %> as appropriate. * builtins.c, c-common.c, c-decl.c, c-format.c, c-format.h, c-parse.in, c-pch.c, c-pragma.c, collect2.c, final.c, gcc.c, gcov.c, opts.c, pretty-print.h, protoize.c, reg-stack.c, rtl.c, tlink.c, config/alpha/alpha.c, config/arc/arc.c, config/arm/arm.c, config/avr/avr.c, config/c4x/c4x.c, config/darwin.c, config/frv/frv.c, config/h8300/h8300.c, config/i386/i386.c, config/i386/winnt.c, config/ia64/ia64.c, config/ip2k/ip2k.c, config/iq2000/iq2000.c, config/m32r/m32r.c, config/m68hc11/m68hc11.c, config/m68k/m68k.c, config/m68k/m68k.h, config/mcore/mcore.c, config/mips/mips.c, config/mmix/mmix.c, config/ns32k/ns32k.c, config/rs6000/host-darwin.c, config/rs6000/rs6000.c, config/s390/s390.c, config/sh/sh.c, config/sh/symbian.c, config/stormy16/stormy16.c, config/v850/v850.c: Avoid "`" as left quote, using "'" or %q, %< and %> as appropriate. Use %' as apostrophe in diagnostics where applicable. Use %< and %> in place of '' quotes where applicable. Use %qs in place of %<%s%>. Consistently quote __builtin function names. ada: * misc.c (gnat_handle_option): Use %< and %> for quoting in warning message. cp: * call.c, class.c, decl.c, decl2.c, error.c, mangle.c, parser.c, pt.c, search.c, semantics.c, typeck.c: Use %q, %< and %> for quoting in diagnostics. * parser.c (cp_parser_sizeof_operand): Use '' instead of `' for quoting in printf format. * decl.c (duplicate_decls, start_decl): Use %qD instead of unquoted %D. objc: * objc-act.c: Use %q, %< and %> for quoting in diagnostics. testsuite: * gcc.dg/builtin-prefetch-1.c: Adjust expected messages. From-SVN: r90337
2004-11-09 11:13:30 +01:00
error ("cannot find interface declaration for %qs",
IDENTIFIER_POINTER (OBJC_TYPE_NAME (basetype)));
return 0;
}
1992-01-18 00:15:38 +01:00
objc-act.c (objc_build_struct): New function. * objc-act.c (objc_build_struct): New function. (objc_derived_from_p): Likewise. (objc_build_component_ref): Likewise. (objc_copy_binfo): Likewise. (objc_xref_basetypes): Likewise. (objc_lookup_protocol): Likewise. (objc_compare_protocols): Likewise. (objc_volatilize_decl): Likewise. (encode_aggregate_fields): Likewise. (volatilized_hash): Likewise. (volatilized_eq): Likewise. (objc_compare_types): Likewise. (objc_type_quals_match): Likewise. (DERIVED_FROM_P): New ObjC macro, corresponding to C++ macro of same name. (get_class_ivars): Add second parameter indicating if entire hierarchy is desired. (struct volatilized_type): New type. (volatilized_htab): New hash table. (objc_types_compatible_p, objc_comptypes): Remove functions. (synth_module_prologue): Do not initialize 'unused_list'. (objc_get_class_reference): Fix ObjC++ impedance mismatches. (objc_declare_alias): Implement as a typedef. (objc_substitute_decl, objc_gimplify_expr): Reformat. (objc_get_class_ivars): Adjust call to get_class_ivars(). (next_sjlj_build_enter_and_setjmp, synth_forward_declarations, build_ivar_reference, get_super_receiver): Call objc_build_component_ref() instead of build_component_ref(). (objc_begin_catch_clause): Use DERIVED_FROM_P() instead of objc_comptypes(). (build_private_template): Call objc_build_struct() instead of start_struct() and finish_struct(). (hash_init): Initialize volatilized_htab. (objc_is_public): Adjust calls to objc_get_ivars(); adjust ObjC++ impedance mismatches. (encode_aggregate_within): Streamline by calling encode_aggregate_fields(). * objc-act.h (objc_types_compatible_p): Remove prototype. (OCTI_UNUSED_LIST, unused_list): Remove slot. * objc-lang.c (LANG_HOOKS_TYPES_COMPATIBLE_P): Remove. From-SVN: r100123
2005-05-25 00:21:01 +02:00
if ((decl = is_ivar (get_class_ivars (class, true), identifier)))
{
1992-01-18 00:15:38 +01:00
if (TREE_PUBLIC (decl))
return 1;
/* Important difference between the Stepstone translator:
all instance variables should be public within the context
of the implementation. */
c-parse.in (objc_inherit_code, [...]): Make static. 2001-10-03 Ziemowit Laski <zlaski@apple.com> * c-parse.in (objc_inherit_code, objc_pq_context, objc_public_flag): Make static. (objc_interface_context, objc_implementation_context, objc_method_context, objc_ivar_chain, objc_ivar_context): Move to global tree array in objc/objc-act.[ch]. (methoddef): Remove unnecessary code. * objc/objc-act.c: (hashed_attribute, hashed_entry, imp_entry): Hoist struct definitions to objc-act.h. (nst_method_hash_list, cls_method_hash_list, imp_list, imp_count, cat_count): Place declaration in objc-act.h. (objc_tree_index): Move enumeration to objc-act.h. (objc_global_trees): Place declaration and macro accessors in objc-act.h. (implementation_context): Remove duplicate; use objc_implementation_context instead: (method_context): Remove duplicate; use objc_method_context instead. (objc_ellipsis_node, objc_method_prototype_template, implemented_classes, function_type): Move global vars to objc_global_trees. (init_objc): Use LAST_BASE_TREE_CODE instead of LAST_CODE. (build_message_expr): Move actual construction of ObjC message send nodes to finish_message_expr. (finish_message_expr): New routine, contains code formerly in build_message_expr. * objc/objc-act.h (finish_message_expr): New prototype. (objc_ivar_chain, objc_method_context, objc_ellipsis_node): Remove declarations; these vars are now part of objc_global_trees. (objc_tree_index, objc_global_trees): Move definitions from objc-act.c. * objc/objc-tree.def: Update copyright info. From-SVN: r46000
2001-10-04 00:05:57 +02:00
if (objc_implementation_context
objc-act.c (objc_build_struct): New function. * objc-act.c (objc_build_struct): New function. (objc_derived_from_p): Likewise. (objc_build_component_ref): Likewise. (objc_copy_binfo): Likewise. (objc_xref_basetypes): Likewise. (objc_lookup_protocol): Likewise. (objc_compare_protocols): Likewise. (objc_volatilize_decl): Likewise. (encode_aggregate_fields): Likewise. (volatilized_hash): Likewise. (volatilized_eq): Likewise. (objc_compare_types): Likewise. (objc_type_quals_match): Likewise. (DERIVED_FROM_P): New ObjC macro, corresponding to C++ macro of same name. (get_class_ivars): Add second parameter indicating if entire hierarchy is desired. (struct volatilized_type): New type. (volatilized_htab): New hash table. (objc_types_compatible_p, objc_comptypes): Remove functions. (synth_module_prologue): Do not initialize 'unused_list'. (objc_get_class_reference): Fix ObjC++ impedance mismatches. (objc_declare_alias): Implement as a typedef. (objc_substitute_decl, objc_gimplify_expr): Reformat. (objc_get_class_ivars): Adjust call to get_class_ivars(). (next_sjlj_build_enter_and_setjmp, synth_forward_declarations, build_ivar_reference, get_super_receiver): Call objc_build_component_ref() instead of build_component_ref(). (objc_begin_catch_clause): Use DERIVED_FROM_P() instead of objc_comptypes(). (build_private_template): Call objc_build_struct() instead of start_struct() and finish_struct(). (hash_init): Initialize volatilized_htab. (objc_is_public): Adjust calls to objc_get_ivars(); adjust ObjC++ impedance mismatches. (encode_aggregate_within): Streamline by calling encode_aggregate_fields(). * objc-act.h (objc_types_compatible_p): Remove prototype. (OCTI_UNUSED_LIST, unused_list): Remove slot. * objc-lang.c (LANG_HOOKS_TYPES_COMPATIBLE_P): Remove. From-SVN: r100123
2005-05-25 00:21:01 +02:00
&& ((TREE_CODE (objc_implementation_context)
== CLASS_IMPLEMENTATION_TYPE)
|| (TREE_CODE (objc_implementation_context)
== CATEGORY_IMPLEMENTATION_TYPE)))
{
objc-act.c (objc_build_struct): New function. * objc-act.c (objc_build_struct): New function. (objc_derived_from_p): Likewise. (objc_build_component_ref): Likewise. (objc_copy_binfo): Likewise. (objc_xref_basetypes): Likewise. (objc_lookup_protocol): Likewise. (objc_compare_protocols): Likewise. (objc_volatilize_decl): Likewise. (encode_aggregate_fields): Likewise. (volatilized_hash): Likewise. (volatilized_eq): Likewise. (objc_compare_types): Likewise. (objc_type_quals_match): Likewise. (DERIVED_FROM_P): New ObjC macro, corresponding to C++ macro of same name. (get_class_ivars): Add second parameter indicating if entire hierarchy is desired. (struct volatilized_type): New type. (volatilized_htab): New hash table. (objc_types_compatible_p, objc_comptypes): Remove functions. (synth_module_prologue): Do not initialize 'unused_list'. (objc_get_class_reference): Fix ObjC++ impedance mismatches. (objc_declare_alias): Implement as a typedef. (objc_substitute_decl, objc_gimplify_expr): Reformat. (objc_get_class_ivars): Adjust call to get_class_ivars(). (next_sjlj_build_enter_and_setjmp, synth_forward_declarations, build_ivar_reference, get_super_receiver): Call objc_build_component_ref() instead of build_component_ref(). (objc_begin_catch_clause): Use DERIVED_FROM_P() instead of objc_comptypes(). (build_private_template): Call objc_build_struct() instead of start_struct() and finish_struct(). (hash_init): Initialize volatilized_htab. (objc_is_public): Adjust calls to objc_get_ivars(); adjust ObjC++ impedance mismatches. (encode_aggregate_within): Streamline by calling encode_aggregate_fields(). * objc-act.h (objc_types_compatible_p): Remove prototype. (OCTI_UNUSED_LIST, unused_list): Remove slot. * objc-lang.c (LANG_HOOKS_TYPES_COMPATIBLE_P): Remove. From-SVN: r100123
2005-05-25 00:21:01 +02:00
tree curtype = TYPE_MAIN_VARIANT
(CLASS_STATIC_TEMPLATE
(implementation_template));
objc-act.c (objc_build_struct): New function. * objc-act.c (objc_build_struct): New function. (objc_derived_from_p): Likewise. (objc_build_component_ref): Likewise. (objc_copy_binfo): Likewise. (objc_xref_basetypes): Likewise. (objc_lookup_protocol): Likewise. (objc_compare_protocols): Likewise. (objc_volatilize_decl): Likewise. (encode_aggregate_fields): Likewise. (volatilized_hash): Likewise. (volatilized_eq): Likewise. (objc_compare_types): Likewise. (objc_type_quals_match): Likewise. (DERIVED_FROM_P): New ObjC macro, corresponding to C++ macro of same name. (get_class_ivars): Add second parameter indicating if entire hierarchy is desired. (struct volatilized_type): New type. (volatilized_htab): New hash table. (objc_types_compatible_p, objc_comptypes): Remove functions. (synth_module_prologue): Do not initialize 'unused_list'. (objc_get_class_reference): Fix ObjC++ impedance mismatches. (objc_declare_alias): Implement as a typedef. (objc_substitute_decl, objc_gimplify_expr): Reformat. (objc_get_class_ivars): Adjust call to get_class_ivars(). (next_sjlj_build_enter_and_setjmp, synth_forward_declarations, build_ivar_reference, get_super_receiver): Call objc_build_component_ref() instead of build_component_ref(). (objc_begin_catch_clause): Use DERIVED_FROM_P() instead of objc_comptypes(). (build_private_template): Call objc_build_struct() instead of start_struct() and finish_struct(). (hash_init): Initialize volatilized_htab. (objc_is_public): Adjust calls to objc_get_ivars(); adjust ObjC++ impedance mismatches. (encode_aggregate_within): Streamline by calling encode_aggregate_fields(). * objc-act.h (objc_types_compatible_p): Remove prototype. (OCTI_UNUSED_LIST, unused_list): Remove slot. * objc-lang.c (LANG_HOOKS_TYPES_COMPATIBLE_P): Remove. From-SVN: r100123
2005-05-25 00:21:01 +02:00
if (basetype == curtype
|| DERIVED_FROM_P (basetype, curtype))
{
int private = is_private (decl);
if (private)
error ("instance variable %qs is declared private",
IDENTIFIER_POINTER (DECL_NAME (decl)));
return !private;
}
}
/* The 2.95.2 compiler sometimes allowed C functions to access
non-@public ivars. We will let this slide for now... */
if (!objc_method_context)
{
diagnostic.c (warning): Accept parameter to classify warning option. * diagnostic.c (warning): Accept parameter to classify warning option. (warning0): New, for when a pointer to an error() like function is needed. * errors.c (warning): Likewise. * errors.h (warning, warning0): Adjust prototypes. * toplev.h (warning, warning0): Likewise. * attribs.c, builtins.c, c-common.c, c-decl.c, c-format.c, c-gimplify.c, c-lex.c, c-objc-common.c, c-opts.c, c-parser.c, c-pragma.c, c-typeck.c, calls.c, cgraph.c, coverage.c, emit-rtl.c, fold-const.c, fortran/trans-decl.c, function.c, gcse.c, genautomata.c, haifa-sched.c, opts.c, passes.c, regclass.c, reload1.c, stmt.c, stor-layout.c, toplev.c, tree-cfg.c, tree-dump.c, tree-inline.c, tree-mudflap.c, tree-optimize.c, tree-ssa.c, tree.c, varasm.c: Adjust warning() callers. * config/alpha/alpha.c, config/arc/arc.c, config/arm/arm.c, config/avr/avr.c, config/bfin/bfin.c, config/c4x/c4x-c.c, config/c4x/c4x.c, config/cris/cris.c, config/darwin-c.c, config/darwin.c, config/darwin.h, config/h8300/h8300.c, config/i386/cygming.h, config/i386/djgpp.h, config/i386/i386.c, config/i386/winnt.c, config/ia64/ia64-c.c, config/ia64/ia64.c, config/ip2k/ip2k.c, config/m32r/m32r.c, config/m68hc11/m68hc11.c, config/m68k/m68k.c, config/mcore/mcore.c, config/mips/mips.c, config/mmix/mmix.c, config/ns32k/ns32k.c, config/pa/pa-hpux11.h, config/pa/pa.c, config/rs6000/aix43.h, config/rs6000/aix51.h, config/rs6000/aix52.h, config/rs6000/darwin.h, config/rs6000/rs6000-c.c, config/rs6000/rs6000.c, config/s390/s390.c, config/sh/sh.c, config/sh/sh.h, config/sh/symbian.c, config/sol2-c.c, config/sol2.c, config/stormy16/stormy16.c, config/v850/v850-c.c, config/v850/v850.c, config/xtensa/xtensa.c: Adjust warning() callers. * ada/misc.c: Adjust warning() callers. * cp/call.c, cp/class.c, cp/cvt.c, cp/decl.c, cp/decl2.c, cp/except.c, cp/friend.c, cp/init.c, cp/lex.c, cp/mangle.c, cp/method.c, cp/name-lookup.c, cp/parser.c, cp/repo.c, cp/rtti.c, cp/tree.c, cp/typeck.c, cp/typeck2.c: Adjust warning() callers. * fortran/trans-decl.c: Adjust warning() callers. * java/class.c, java/decl.c, java/expr.c, java/jcf-io.c, java/jcf-parse.c, java/jv-scan.c, java/parse.y: Adjust warning() callers. * objc/objc-act.c: Adjust warning() callers. * treelang/parse.y: Adjust warning() callers. From-SVN: r98633
2005-04-23 23:29:07 +02:00
warning (0, "instance variable %qs is %s; "
"this will be a hard error in the future",
IDENTIFIER_POINTER (identifier),
TREE_PRIVATE (decl) ? "@private" : "@protected");
return 1;
}
builtins.c, [...]: Avoid "`" as left quote, using "'" or %q, %< and %> as appropriate. * builtins.c, c-common.c, c-decl.c, c-format.c, c-format.h, c-parse.in, c-pch.c, c-pragma.c, collect2.c, final.c, gcc.c, gcov.c, opts.c, pretty-print.h, protoize.c, reg-stack.c, rtl.c, tlink.c, config/alpha/alpha.c, config/arc/arc.c, config/arm/arm.c, config/avr/avr.c, config/c4x/c4x.c, config/darwin.c, config/frv/frv.c, config/h8300/h8300.c, config/i386/i386.c, config/i386/winnt.c, config/ia64/ia64.c, config/ip2k/ip2k.c, config/iq2000/iq2000.c, config/m32r/m32r.c, config/m68hc11/m68hc11.c, config/m68k/m68k.c, config/m68k/m68k.h, config/mcore/mcore.c, config/mips/mips.c, config/mmix/mmix.c, config/ns32k/ns32k.c, config/rs6000/host-darwin.c, config/rs6000/rs6000.c, config/s390/s390.c, config/sh/sh.c, config/sh/symbian.c, config/stormy16/stormy16.c, config/v850/v850.c: Avoid "`" as left quote, using "'" or %q, %< and %> as appropriate. Use %' as apostrophe in diagnostics where applicable. Use %< and %> in place of '' quotes where applicable. Use %qs in place of %<%s%>. Consistently quote __builtin function names. ada: * misc.c (gnat_handle_option): Use %< and %> for quoting in warning message. cp: * call.c, class.c, decl.c, decl2.c, error.c, mangle.c, parser.c, pt.c, search.c, semantics.c, typeck.c: Use %q, %< and %> for quoting in diagnostics. * parser.c (cp_parser_sizeof_operand): Use '' instead of `' for quoting in printf format. * decl.c (duplicate_decls, start_decl): Use %qD instead of unquoted %D. objc: * objc-act.c: Use %q, %< and %> for quoting in diagnostics. testsuite: * gcc.dg/builtin-prefetch-1.c: Adjust expected messages. From-SVN: r90337
2004-11-09 11:13:30 +01:00
error ("instance variable %qs is declared %s",
IDENTIFIER_POINTER (identifier),
TREE_PRIVATE (decl) ? "private" : "protected");
1992-01-18 00:15:38 +01:00
return 0;
}
}
}
1992-01-18 00:15:38 +01:00
return 1;
}
1996-07-04 00:07:53 +02:00
/* Make sure all entries in CHAIN are also in LIST. */
1992-01-18 00:15:38 +01:00
static int
check_methods (tree chain, tree list, int mtype)
1992-01-18 00:15:38 +01:00
{
int first = 1;
while (chain)
{
if (!lookup_method (list, chain))
{
if (first)
{
c-parse.in (objc_inherit_code, [...]): Make static. 2001-10-03 Ziemowit Laski <zlaski@apple.com> * c-parse.in (objc_inherit_code, objc_pq_context, objc_public_flag): Make static. (objc_interface_context, objc_implementation_context, objc_method_context, objc_ivar_chain, objc_ivar_context): Move to global tree array in objc/objc-act.[ch]. (methoddef): Remove unnecessary code. * objc/objc-act.c: (hashed_attribute, hashed_entry, imp_entry): Hoist struct definitions to objc-act.h. (nst_method_hash_list, cls_method_hash_list, imp_list, imp_count, cat_count): Place declaration in objc-act.h. (objc_tree_index): Move enumeration to objc-act.h. (objc_global_trees): Place declaration and macro accessors in objc-act.h. (implementation_context): Remove duplicate; use objc_implementation_context instead: (method_context): Remove duplicate; use objc_method_context instead. (objc_ellipsis_node, objc_method_prototype_template, implemented_classes, function_type): Move global vars to objc_global_trees. (init_objc): Use LAST_BASE_TREE_CODE instead of LAST_CODE. (build_message_expr): Move actual construction of ObjC message send nodes to finish_message_expr. (finish_message_expr): New routine, contains code formerly in build_message_expr. * objc/objc-act.h (finish_message_expr): New prototype. (objc_ivar_chain, objc_method_context, objc_ellipsis_node): Remove declarations; these vars are now part of objc_global_trees. (objc_tree_index, objc_global_trees): Move definitions from objc-act.c. * objc/objc-tree.def: Update copyright info. From-SVN: r46000
2001-10-04 00:05:57 +02:00
if (TREE_CODE (objc_implementation_context)
== CLASS_IMPLEMENTATION_TYPE)
diagnostic.c (warning): Accept parameter to classify warning option. * diagnostic.c (warning): Accept parameter to classify warning option. (warning0): New, for when a pointer to an error() like function is needed. * errors.c (warning): Likewise. * errors.h (warning, warning0): Adjust prototypes. * toplev.h (warning, warning0): Likewise. * attribs.c, builtins.c, c-common.c, c-decl.c, c-format.c, c-gimplify.c, c-lex.c, c-objc-common.c, c-opts.c, c-parser.c, c-pragma.c, c-typeck.c, calls.c, cgraph.c, coverage.c, emit-rtl.c, fold-const.c, fortran/trans-decl.c, function.c, gcse.c, genautomata.c, haifa-sched.c, opts.c, passes.c, regclass.c, reload1.c, stmt.c, stor-layout.c, toplev.c, tree-cfg.c, tree-dump.c, tree-inline.c, tree-mudflap.c, tree-optimize.c, tree-ssa.c, tree.c, varasm.c: Adjust warning() callers. * config/alpha/alpha.c, config/arc/arc.c, config/arm/arm.c, config/avr/avr.c, config/bfin/bfin.c, config/c4x/c4x-c.c, config/c4x/c4x.c, config/cris/cris.c, config/darwin-c.c, config/darwin.c, config/darwin.h, config/h8300/h8300.c, config/i386/cygming.h, config/i386/djgpp.h, config/i386/i386.c, config/i386/winnt.c, config/ia64/ia64-c.c, config/ia64/ia64.c, config/ip2k/ip2k.c, config/m32r/m32r.c, config/m68hc11/m68hc11.c, config/m68k/m68k.c, config/mcore/mcore.c, config/mips/mips.c, config/mmix/mmix.c, config/ns32k/ns32k.c, config/pa/pa-hpux11.h, config/pa/pa.c, config/rs6000/aix43.h, config/rs6000/aix51.h, config/rs6000/aix52.h, config/rs6000/darwin.h, config/rs6000/rs6000-c.c, config/rs6000/rs6000.c, config/s390/s390.c, config/sh/sh.c, config/sh/sh.h, config/sh/symbian.c, config/sol2-c.c, config/sol2.c, config/stormy16/stormy16.c, config/v850/v850-c.c, config/v850/v850.c, config/xtensa/xtensa.c: Adjust warning() callers. * ada/misc.c: Adjust warning() callers. * cp/call.c, cp/class.c, cp/cvt.c, cp/decl.c, cp/decl2.c, cp/except.c, cp/friend.c, cp/init.c, cp/lex.c, cp/mangle.c, cp/method.c, cp/name-lookup.c, cp/parser.c, cp/repo.c, cp/rtti.c, cp/tree.c, cp/typeck.c, cp/typeck2.c: Adjust warning() callers. * fortran/trans-decl.c: Adjust warning() callers. * java/class.c, java/decl.c, java/expr.c, java/jcf-io.c, java/jcf-parse.c, java/jv-scan.c, java/parse.y: Adjust warning() callers. * objc/objc-act.c: Adjust warning() callers. * treelang/parse.y: Adjust warning() callers. From-SVN: r98633
2005-04-23 23:29:07 +02:00
warning (0, "incomplete implementation of class %qs",
c-parse.in (objc_inherit_code, [...]): Make static. 2001-10-03 Ziemowit Laski <zlaski@apple.com> * c-parse.in (objc_inherit_code, objc_pq_context, objc_public_flag): Make static. (objc_interface_context, objc_implementation_context, objc_method_context, objc_ivar_chain, objc_ivar_context): Move to global tree array in objc/objc-act.[ch]. (methoddef): Remove unnecessary code. * objc/objc-act.c: (hashed_attribute, hashed_entry, imp_entry): Hoist struct definitions to objc-act.h. (nst_method_hash_list, cls_method_hash_list, imp_list, imp_count, cat_count): Place declaration in objc-act.h. (objc_tree_index): Move enumeration to objc-act.h. (objc_global_trees): Place declaration and macro accessors in objc-act.h. (implementation_context): Remove duplicate; use objc_implementation_context instead: (method_context): Remove duplicate; use objc_method_context instead. (objc_ellipsis_node, objc_method_prototype_template, implemented_classes, function_type): Move global vars to objc_global_trees. (init_objc): Use LAST_BASE_TREE_CODE instead of LAST_CODE. (build_message_expr): Move actual construction of ObjC message send nodes to finish_message_expr. (finish_message_expr): New routine, contains code formerly in build_message_expr. * objc/objc-act.h (finish_message_expr): New prototype. (objc_ivar_chain, objc_method_context, objc_ellipsis_node): Remove declarations; these vars are now part of objc_global_trees. (objc_tree_index, objc_global_trees): Move definitions from objc-act.c. * objc/objc-tree.def: Update copyright info. From-SVN: r46000
2001-10-04 00:05:57 +02:00
IDENTIFIER_POINTER (CLASS_NAME (objc_implementation_context)));
else if (TREE_CODE (objc_implementation_context)
== CATEGORY_IMPLEMENTATION_TYPE)
diagnostic.c (warning): Accept parameter to classify warning option. * diagnostic.c (warning): Accept parameter to classify warning option. (warning0): New, for when a pointer to an error() like function is needed. * errors.c (warning): Likewise. * errors.h (warning, warning0): Adjust prototypes. * toplev.h (warning, warning0): Likewise. * attribs.c, builtins.c, c-common.c, c-decl.c, c-format.c, c-gimplify.c, c-lex.c, c-objc-common.c, c-opts.c, c-parser.c, c-pragma.c, c-typeck.c, calls.c, cgraph.c, coverage.c, emit-rtl.c, fold-const.c, fortran/trans-decl.c, function.c, gcse.c, genautomata.c, haifa-sched.c, opts.c, passes.c, regclass.c, reload1.c, stmt.c, stor-layout.c, toplev.c, tree-cfg.c, tree-dump.c, tree-inline.c, tree-mudflap.c, tree-optimize.c, tree-ssa.c, tree.c, varasm.c: Adjust warning() callers. * config/alpha/alpha.c, config/arc/arc.c, config/arm/arm.c, config/avr/avr.c, config/bfin/bfin.c, config/c4x/c4x-c.c, config/c4x/c4x.c, config/cris/cris.c, config/darwin-c.c, config/darwin.c, config/darwin.h, config/h8300/h8300.c, config/i386/cygming.h, config/i386/djgpp.h, config/i386/i386.c, config/i386/winnt.c, config/ia64/ia64-c.c, config/ia64/ia64.c, config/ip2k/ip2k.c, config/m32r/m32r.c, config/m68hc11/m68hc11.c, config/m68k/m68k.c, config/mcore/mcore.c, config/mips/mips.c, config/mmix/mmix.c, config/ns32k/ns32k.c, config/pa/pa-hpux11.h, config/pa/pa.c, config/rs6000/aix43.h, config/rs6000/aix51.h, config/rs6000/aix52.h, config/rs6000/darwin.h, config/rs6000/rs6000-c.c, config/rs6000/rs6000.c, config/s390/s390.c, config/sh/sh.c, config/sh/sh.h, config/sh/symbian.c, config/sol2-c.c, config/sol2.c, config/stormy16/stormy16.c, config/v850/v850-c.c, config/v850/v850.c, config/xtensa/xtensa.c: Adjust warning() callers. * ada/misc.c: Adjust warning() callers. * cp/call.c, cp/class.c, cp/cvt.c, cp/decl.c, cp/decl2.c, cp/except.c, cp/friend.c, cp/init.c, cp/lex.c, cp/mangle.c, cp/method.c, cp/name-lookup.c, cp/parser.c, cp/repo.c, cp/rtti.c, cp/tree.c, cp/typeck.c, cp/typeck2.c: Adjust warning() callers. * fortran/trans-decl.c: Adjust warning() callers. * java/class.c, java/decl.c, java/expr.c, java/jcf-io.c, java/jcf-parse.c, java/jv-scan.c, java/parse.y: Adjust warning() callers. * objc/objc-act.c: Adjust warning() callers. * treelang/parse.y: Adjust warning() callers. From-SVN: r98633
2005-04-23 23:29:07 +02:00
warning (0, "incomplete implementation of category %qs",
c-parse.in (objc_inherit_code, [...]): Make static. 2001-10-03 Ziemowit Laski <zlaski@apple.com> * c-parse.in (objc_inherit_code, objc_pq_context, objc_public_flag): Make static. (objc_interface_context, objc_implementation_context, objc_method_context, objc_ivar_chain, objc_ivar_context): Move to global tree array in objc/objc-act.[ch]. (methoddef): Remove unnecessary code. * objc/objc-act.c: (hashed_attribute, hashed_entry, imp_entry): Hoist struct definitions to objc-act.h. (nst_method_hash_list, cls_method_hash_list, imp_list, imp_count, cat_count): Place declaration in objc-act.h. (objc_tree_index): Move enumeration to objc-act.h. (objc_global_trees): Place declaration and macro accessors in objc-act.h. (implementation_context): Remove duplicate; use objc_implementation_context instead: (method_context): Remove duplicate; use objc_method_context instead. (objc_ellipsis_node, objc_method_prototype_template, implemented_classes, function_type): Move global vars to objc_global_trees. (init_objc): Use LAST_BASE_TREE_CODE instead of LAST_CODE. (build_message_expr): Move actual construction of ObjC message send nodes to finish_message_expr. (finish_message_expr): New routine, contains code formerly in build_message_expr. * objc/objc-act.h (finish_message_expr): New prototype. (objc_ivar_chain, objc_method_context, objc_ellipsis_node): Remove declarations; these vars are now part of objc_global_trees. (objc_tree_index, objc_global_trees): Move definitions from objc-act.c. * objc/objc-tree.def: Update copyright info. From-SVN: r46000
2001-10-04 00:05:57 +02:00
IDENTIFIER_POINTER (CLASS_SUPER_NAME (objc_implementation_context)));
1992-01-18 00:15:38 +01:00
first = 0;
}
diagnostic.c (warning): Accept parameter to classify warning option. * diagnostic.c (warning): Accept parameter to classify warning option. (warning0): New, for when a pointer to an error() like function is needed. * errors.c (warning): Likewise. * errors.h (warning, warning0): Adjust prototypes. * toplev.h (warning, warning0): Likewise. * attribs.c, builtins.c, c-common.c, c-decl.c, c-format.c, c-gimplify.c, c-lex.c, c-objc-common.c, c-opts.c, c-parser.c, c-pragma.c, c-typeck.c, calls.c, cgraph.c, coverage.c, emit-rtl.c, fold-const.c, fortran/trans-decl.c, function.c, gcse.c, genautomata.c, haifa-sched.c, opts.c, passes.c, regclass.c, reload1.c, stmt.c, stor-layout.c, toplev.c, tree-cfg.c, tree-dump.c, tree-inline.c, tree-mudflap.c, tree-optimize.c, tree-ssa.c, tree.c, varasm.c: Adjust warning() callers. * config/alpha/alpha.c, config/arc/arc.c, config/arm/arm.c, config/avr/avr.c, config/bfin/bfin.c, config/c4x/c4x-c.c, config/c4x/c4x.c, config/cris/cris.c, config/darwin-c.c, config/darwin.c, config/darwin.h, config/h8300/h8300.c, config/i386/cygming.h, config/i386/djgpp.h, config/i386/i386.c, config/i386/winnt.c, config/ia64/ia64-c.c, config/ia64/ia64.c, config/ip2k/ip2k.c, config/m32r/m32r.c, config/m68hc11/m68hc11.c, config/m68k/m68k.c, config/mcore/mcore.c, config/mips/mips.c, config/mmix/mmix.c, config/ns32k/ns32k.c, config/pa/pa-hpux11.h, config/pa/pa.c, config/rs6000/aix43.h, config/rs6000/aix51.h, config/rs6000/aix52.h, config/rs6000/darwin.h, config/rs6000/rs6000-c.c, config/rs6000/rs6000.c, config/s390/s390.c, config/sh/sh.c, config/sh/sh.h, config/sh/symbian.c, config/sol2-c.c, config/sol2.c, config/stormy16/stormy16.c, config/v850/v850-c.c, config/v850/v850.c, config/xtensa/xtensa.c: Adjust warning() callers. * ada/misc.c: Adjust warning() callers. * cp/call.c, cp/class.c, cp/cvt.c, cp/decl.c, cp/decl2.c, cp/except.c, cp/friend.c, cp/init.c, cp/lex.c, cp/mangle.c, cp/method.c, cp/name-lookup.c, cp/parser.c, cp/repo.c, cp/rtti.c, cp/tree.c, cp/typeck.c, cp/typeck2.c: Adjust warning() callers. * fortran/trans-decl.c: Adjust warning() callers. * java/class.c, java/decl.c, java/expr.c, java/jcf-io.c, java/jcf-parse.c, java/jv-scan.c, java/parse.y: Adjust warning() callers. * objc/objc-act.c: Adjust warning() callers. * treelang/parse.y: Adjust warning() callers. From-SVN: r98633
2005-04-23 23:29:07 +02:00
warning (0, "method definition for %<%c%s%> not found",
1992-01-18 00:15:38 +01:00
mtype, IDENTIFIER_POINTER (METHOD_SEL_NAME (chain)));
}
1992-01-18 00:15:38 +01:00
chain = TREE_CHAIN (chain);
}
return first;
}
/* Check if CLASS, or its superclasses, explicitly conforms to PROTOCOL. */
static int
conforms_to_protocol (tree class, tree protocol)
{
if (TREE_CODE (protocol) == PROTOCOL_INTERFACE_TYPE)
{
tree p = CLASS_PROTOCOL_LIST (class);
while (p && TREE_VALUE (p) != protocol)
p = TREE_CHAIN (p);
if (!p)
{
tree super = (CLASS_SUPER_NAME (class)
? lookup_interface (CLASS_SUPER_NAME (class))
: NULL_TREE);
int tmp = super ? conforms_to_protocol (super, protocol) : 0;
if (!tmp)
return 0;
}
}
return 1;
}
/* Make sure all methods in CHAIN are accessible as MTYPE methods in
1996-07-04 00:07:53 +02:00
CONTEXT. This is one of two mechanisms to check protocol integrity. */
static int
check_methods_accessible (tree chain, tree context, int mtype)
{
int first = 1;
tree list;
tree base_context = context;
while (chain)
{
context = base_context;
while (context)
{
if (mtype == '+')
list = CLASS_CLS_METHODS (context);
else
list = CLASS_NST_METHODS (context);
if (lookup_method (list, chain))
break;
else if (TREE_CODE (context) == CLASS_IMPLEMENTATION_TYPE
|| TREE_CODE (context) == CLASS_INTERFACE_TYPE)
context = (CLASS_SUPER_NAME (context)
? lookup_interface (CLASS_SUPER_NAME (context))
: NULL_TREE);
else if (TREE_CODE (context) == CATEGORY_IMPLEMENTATION_TYPE
|| TREE_CODE (context) == CATEGORY_INTERFACE_TYPE)
context = (CLASS_NAME (context)
? lookup_interface (CLASS_NAME (context))
: NULL_TREE);
else
abort ();
}
if (context == NULL_TREE)
{
if (first)
{
c-parse.in (objc_inherit_code, [...]): Make static. 2001-10-03 Ziemowit Laski <zlaski@apple.com> * c-parse.in (objc_inherit_code, objc_pq_context, objc_public_flag): Make static. (objc_interface_context, objc_implementation_context, objc_method_context, objc_ivar_chain, objc_ivar_context): Move to global tree array in objc/objc-act.[ch]. (methoddef): Remove unnecessary code. * objc/objc-act.c: (hashed_attribute, hashed_entry, imp_entry): Hoist struct definitions to objc-act.h. (nst_method_hash_list, cls_method_hash_list, imp_list, imp_count, cat_count): Place declaration in objc-act.h. (objc_tree_index): Move enumeration to objc-act.h. (objc_global_trees): Place declaration and macro accessors in objc-act.h. (implementation_context): Remove duplicate; use objc_implementation_context instead: (method_context): Remove duplicate; use objc_method_context instead. (objc_ellipsis_node, objc_method_prototype_template, implemented_classes, function_type): Move global vars to objc_global_trees. (init_objc): Use LAST_BASE_TREE_CODE instead of LAST_CODE. (build_message_expr): Move actual construction of ObjC message send nodes to finish_message_expr. (finish_message_expr): New routine, contains code formerly in build_message_expr. * objc/objc-act.h (finish_message_expr): New prototype. (objc_ivar_chain, objc_method_context, objc_ellipsis_node): Remove declarations; these vars are now part of objc_global_trees. (objc_tree_index, objc_global_trees): Move definitions from objc-act.c. * objc/objc-tree.def: Update copyright info. From-SVN: r46000
2001-10-04 00:05:57 +02:00
if (TREE_CODE (objc_implementation_context)
== CLASS_IMPLEMENTATION_TYPE)
diagnostic.c (warning): Accept parameter to classify warning option. * diagnostic.c (warning): Accept parameter to classify warning option. (warning0): New, for when a pointer to an error() like function is needed. * errors.c (warning): Likewise. * errors.h (warning, warning0): Adjust prototypes. * toplev.h (warning, warning0): Likewise. * attribs.c, builtins.c, c-common.c, c-decl.c, c-format.c, c-gimplify.c, c-lex.c, c-objc-common.c, c-opts.c, c-parser.c, c-pragma.c, c-typeck.c, calls.c, cgraph.c, coverage.c, emit-rtl.c, fold-const.c, fortran/trans-decl.c, function.c, gcse.c, genautomata.c, haifa-sched.c, opts.c, passes.c, regclass.c, reload1.c, stmt.c, stor-layout.c, toplev.c, tree-cfg.c, tree-dump.c, tree-inline.c, tree-mudflap.c, tree-optimize.c, tree-ssa.c, tree.c, varasm.c: Adjust warning() callers. * config/alpha/alpha.c, config/arc/arc.c, config/arm/arm.c, config/avr/avr.c, config/bfin/bfin.c, config/c4x/c4x-c.c, config/c4x/c4x.c, config/cris/cris.c, config/darwin-c.c, config/darwin.c, config/darwin.h, config/h8300/h8300.c, config/i386/cygming.h, config/i386/djgpp.h, config/i386/i386.c, config/i386/winnt.c, config/ia64/ia64-c.c, config/ia64/ia64.c, config/ip2k/ip2k.c, config/m32r/m32r.c, config/m68hc11/m68hc11.c, config/m68k/m68k.c, config/mcore/mcore.c, config/mips/mips.c, config/mmix/mmix.c, config/ns32k/ns32k.c, config/pa/pa-hpux11.h, config/pa/pa.c, config/rs6000/aix43.h, config/rs6000/aix51.h, config/rs6000/aix52.h, config/rs6000/darwin.h, config/rs6000/rs6000-c.c, config/rs6000/rs6000.c, config/s390/s390.c, config/sh/sh.c, config/sh/sh.h, config/sh/symbian.c, config/sol2-c.c, config/sol2.c, config/stormy16/stormy16.c, config/v850/v850-c.c, config/v850/v850.c, config/xtensa/xtensa.c: Adjust warning() callers. * ada/misc.c: Adjust warning() callers. * cp/call.c, cp/class.c, cp/cvt.c, cp/decl.c, cp/decl2.c, cp/except.c, cp/friend.c, cp/init.c, cp/lex.c, cp/mangle.c, cp/method.c, cp/name-lookup.c, cp/parser.c, cp/repo.c, cp/rtti.c, cp/tree.c, cp/typeck.c, cp/typeck2.c: Adjust warning() callers. * fortran/trans-decl.c: Adjust warning() callers. * java/class.c, java/decl.c, java/expr.c, java/jcf-io.c, java/jcf-parse.c, java/jv-scan.c, java/parse.y: Adjust warning() callers. * objc/objc-act.c: Adjust warning() callers. * treelang/parse.y: Adjust warning() callers. From-SVN: r98633
2005-04-23 23:29:07 +02:00
warning (0, "incomplete implementation of class %qs",
IDENTIFIER_POINTER
c-parse.in (objc_inherit_code, [...]): Make static. 2001-10-03 Ziemowit Laski <zlaski@apple.com> * c-parse.in (objc_inherit_code, objc_pq_context, objc_public_flag): Make static. (objc_interface_context, objc_implementation_context, objc_method_context, objc_ivar_chain, objc_ivar_context): Move to global tree array in objc/objc-act.[ch]. (methoddef): Remove unnecessary code. * objc/objc-act.c: (hashed_attribute, hashed_entry, imp_entry): Hoist struct definitions to objc-act.h. (nst_method_hash_list, cls_method_hash_list, imp_list, imp_count, cat_count): Place declaration in objc-act.h. (objc_tree_index): Move enumeration to objc-act.h. (objc_global_trees): Place declaration and macro accessors in objc-act.h. (implementation_context): Remove duplicate; use objc_implementation_context instead: (method_context): Remove duplicate; use objc_method_context instead. (objc_ellipsis_node, objc_method_prototype_template, implemented_classes, function_type): Move global vars to objc_global_trees. (init_objc): Use LAST_BASE_TREE_CODE instead of LAST_CODE. (build_message_expr): Move actual construction of ObjC message send nodes to finish_message_expr. (finish_message_expr): New routine, contains code formerly in build_message_expr. * objc/objc-act.h (finish_message_expr): New prototype. (objc_ivar_chain, objc_method_context, objc_ellipsis_node): Remove declarations; these vars are now part of objc_global_trees. (objc_tree_index, objc_global_trees): Move definitions from objc-act.c. * objc/objc-tree.def: Update copyright info. From-SVN: r46000
2001-10-04 00:05:57 +02:00
(CLASS_NAME (objc_implementation_context)));
else if (TREE_CODE (objc_implementation_context)
== CATEGORY_IMPLEMENTATION_TYPE)
diagnostic.c (warning): Accept parameter to classify warning option. * diagnostic.c (warning): Accept parameter to classify warning option. (warning0): New, for when a pointer to an error() like function is needed. * errors.c (warning): Likewise. * errors.h (warning, warning0): Adjust prototypes. * toplev.h (warning, warning0): Likewise. * attribs.c, builtins.c, c-common.c, c-decl.c, c-format.c, c-gimplify.c, c-lex.c, c-objc-common.c, c-opts.c, c-parser.c, c-pragma.c, c-typeck.c, calls.c, cgraph.c, coverage.c, emit-rtl.c, fold-const.c, fortran/trans-decl.c, function.c, gcse.c, genautomata.c, haifa-sched.c, opts.c, passes.c, regclass.c, reload1.c, stmt.c, stor-layout.c, toplev.c, tree-cfg.c, tree-dump.c, tree-inline.c, tree-mudflap.c, tree-optimize.c, tree-ssa.c, tree.c, varasm.c: Adjust warning() callers. * config/alpha/alpha.c, config/arc/arc.c, config/arm/arm.c, config/avr/avr.c, config/bfin/bfin.c, config/c4x/c4x-c.c, config/c4x/c4x.c, config/cris/cris.c, config/darwin-c.c, config/darwin.c, config/darwin.h, config/h8300/h8300.c, config/i386/cygming.h, config/i386/djgpp.h, config/i386/i386.c, config/i386/winnt.c, config/ia64/ia64-c.c, config/ia64/ia64.c, config/ip2k/ip2k.c, config/m32r/m32r.c, config/m68hc11/m68hc11.c, config/m68k/m68k.c, config/mcore/mcore.c, config/mips/mips.c, config/mmix/mmix.c, config/ns32k/ns32k.c, config/pa/pa-hpux11.h, config/pa/pa.c, config/rs6000/aix43.h, config/rs6000/aix51.h, config/rs6000/aix52.h, config/rs6000/darwin.h, config/rs6000/rs6000-c.c, config/rs6000/rs6000.c, config/s390/s390.c, config/sh/sh.c, config/sh/sh.h, config/sh/symbian.c, config/sol2-c.c, config/sol2.c, config/stormy16/stormy16.c, config/v850/v850-c.c, config/v850/v850.c, config/xtensa/xtensa.c: Adjust warning() callers. * ada/misc.c: Adjust warning() callers. * cp/call.c, cp/class.c, cp/cvt.c, cp/decl.c, cp/decl2.c, cp/except.c, cp/friend.c, cp/init.c, cp/lex.c, cp/mangle.c, cp/method.c, cp/name-lookup.c, cp/parser.c, cp/repo.c, cp/rtti.c, cp/tree.c, cp/typeck.c, cp/typeck2.c: Adjust warning() callers. * fortran/trans-decl.c: Adjust warning() callers. * java/class.c, java/decl.c, java/expr.c, java/jcf-io.c, java/jcf-parse.c, java/jv-scan.c, java/parse.y: Adjust warning() callers. * objc/objc-act.c: Adjust warning() callers. * treelang/parse.y: Adjust warning() callers. From-SVN: r98633
2005-04-23 23:29:07 +02:00
warning (0, "incomplete implementation of category %qs",
IDENTIFIER_POINTER
c-parse.in (objc_inherit_code, [...]): Make static. 2001-10-03 Ziemowit Laski <zlaski@apple.com> * c-parse.in (objc_inherit_code, objc_pq_context, objc_public_flag): Make static. (objc_interface_context, objc_implementation_context, objc_method_context, objc_ivar_chain, objc_ivar_context): Move to global tree array in objc/objc-act.[ch]. (methoddef): Remove unnecessary code. * objc/objc-act.c: (hashed_attribute, hashed_entry, imp_entry): Hoist struct definitions to objc-act.h. (nst_method_hash_list, cls_method_hash_list, imp_list, imp_count, cat_count): Place declaration in objc-act.h. (objc_tree_index): Move enumeration to objc-act.h. (objc_global_trees): Place declaration and macro accessors in objc-act.h. (implementation_context): Remove duplicate; use objc_implementation_context instead: (method_context): Remove duplicate; use objc_method_context instead. (objc_ellipsis_node, objc_method_prototype_template, implemented_classes, function_type): Move global vars to objc_global_trees. (init_objc): Use LAST_BASE_TREE_CODE instead of LAST_CODE. (build_message_expr): Move actual construction of ObjC message send nodes to finish_message_expr. (finish_message_expr): New routine, contains code formerly in build_message_expr. * objc/objc-act.h (finish_message_expr): New prototype. (objc_ivar_chain, objc_method_context, objc_ellipsis_node): Remove declarations; these vars are now part of objc_global_trees. (objc_tree_index, objc_global_trees): Move definitions from objc-act.c. * objc/objc-tree.def: Update copyright info. From-SVN: r46000
2001-10-04 00:05:57 +02:00
(CLASS_SUPER_NAME (objc_implementation_context)));
first = 0;
}
diagnostic.c (warning): Accept parameter to classify warning option. * diagnostic.c (warning): Accept parameter to classify warning option. (warning0): New, for when a pointer to an error() like function is needed. * errors.c (warning): Likewise. * errors.h (warning, warning0): Adjust prototypes. * toplev.h (warning, warning0): Likewise. * attribs.c, builtins.c, c-common.c, c-decl.c, c-format.c, c-gimplify.c, c-lex.c, c-objc-common.c, c-opts.c, c-parser.c, c-pragma.c, c-typeck.c, calls.c, cgraph.c, coverage.c, emit-rtl.c, fold-const.c, fortran/trans-decl.c, function.c, gcse.c, genautomata.c, haifa-sched.c, opts.c, passes.c, regclass.c, reload1.c, stmt.c, stor-layout.c, toplev.c, tree-cfg.c, tree-dump.c, tree-inline.c, tree-mudflap.c, tree-optimize.c, tree-ssa.c, tree.c, varasm.c: Adjust warning() callers. * config/alpha/alpha.c, config/arc/arc.c, config/arm/arm.c, config/avr/avr.c, config/bfin/bfin.c, config/c4x/c4x-c.c, config/c4x/c4x.c, config/cris/cris.c, config/darwin-c.c, config/darwin.c, config/darwin.h, config/h8300/h8300.c, config/i386/cygming.h, config/i386/djgpp.h, config/i386/i386.c, config/i386/winnt.c, config/ia64/ia64-c.c, config/ia64/ia64.c, config/ip2k/ip2k.c, config/m32r/m32r.c, config/m68hc11/m68hc11.c, config/m68k/m68k.c, config/mcore/mcore.c, config/mips/mips.c, config/mmix/mmix.c, config/ns32k/ns32k.c, config/pa/pa-hpux11.h, config/pa/pa.c, config/rs6000/aix43.h, config/rs6000/aix51.h, config/rs6000/aix52.h, config/rs6000/darwin.h, config/rs6000/rs6000-c.c, config/rs6000/rs6000.c, config/s390/s390.c, config/sh/sh.c, config/sh/sh.h, config/sh/symbian.c, config/sol2-c.c, config/sol2.c, config/stormy16/stormy16.c, config/v850/v850-c.c, config/v850/v850.c, config/xtensa/xtensa.c: Adjust warning() callers. * ada/misc.c: Adjust warning() callers. * cp/call.c, cp/class.c, cp/cvt.c, cp/decl.c, cp/decl2.c, cp/except.c, cp/friend.c, cp/init.c, cp/lex.c, cp/mangle.c, cp/method.c, cp/name-lookup.c, cp/parser.c, cp/repo.c, cp/rtti.c, cp/tree.c, cp/typeck.c, cp/typeck2.c: Adjust warning() callers. * fortran/trans-decl.c: Adjust warning() callers. * java/class.c, java/decl.c, java/expr.c, java/jcf-io.c, java/jcf-parse.c, java/jv-scan.c, java/parse.y: Adjust warning() callers. * objc/objc-act.c: Adjust warning() callers. * treelang/parse.y: Adjust warning() callers. From-SVN: r98633
2005-04-23 23:29:07 +02:00
warning (0, "method definition for %<%c%s%> not found",
mtype, IDENTIFIER_POINTER (METHOD_SEL_NAME (chain)));
}
1996-07-04 00:07:53 +02:00
chain = TREE_CHAIN (chain); /* next method... */
}
return first;
}
/* Check whether the current interface (accessible via
c-parse.in (objc_inherit_code, [...]): Make static. 2001-10-03 Ziemowit Laski <zlaski@apple.com> * c-parse.in (objc_inherit_code, objc_pq_context, objc_public_flag): Make static. (objc_interface_context, objc_implementation_context, objc_method_context, objc_ivar_chain, objc_ivar_context): Move to global tree array in objc/objc-act.[ch]. (methoddef): Remove unnecessary code. * objc/objc-act.c: (hashed_attribute, hashed_entry, imp_entry): Hoist struct definitions to objc-act.h. (nst_method_hash_list, cls_method_hash_list, imp_list, imp_count, cat_count): Place declaration in objc-act.h. (objc_tree_index): Move enumeration to objc-act.h. (objc_global_trees): Place declaration and macro accessors in objc-act.h. (implementation_context): Remove duplicate; use objc_implementation_context instead: (method_context): Remove duplicate; use objc_method_context instead. (objc_ellipsis_node, objc_method_prototype_template, implemented_classes, function_type): Move global vars to objc_global_trees. (init_objc): Use LAST_BASE_TREE_CODE instead of LAST_CODE. (build_message_expr): Move actual construction of ObjC message send nodes to finish_message_expr. (finish_message_expr): New routine, contains code formerly in build_message_expr. * objc/objc-act.h (finish_message_expr): New prototype. (objc_ivar_chain, objc_method_context, objc_ellipsis_node): Remove declarations; these vars are now part of objc_global_trees. (objc_tree_index, objc_global_trees): Move definitions from objc-act.c. * objc/objc-tree.def: Update copyright info. From-SVN: r46000
2001-10-04 00:05:57 +02:00
'objc_implementation_context') actually implements protocol P, along
with any protocols that P inherits. */
static void
check_protocol (tree p, const char *type, const char *name)
{
if (TREE_CODE (p) == PROTOCOL_INTERFACE_TYPE)
{
int f1, f2;
/* Ensure that all protocols have bodies! */
if (warn_protocol)
{
f1 = check_methods (PROTOCOL_CLS_METHODS (p),
c-parse.in (objc_inherit_code, [...]): Make static. 2001-10-03 Ziemowit Laski <zlaski@apple.com> * c-parse.in (objc_inherit_code, objc_pq_context, objc_public_flag): Make static. (objc_interface_context, objc_implementation_context, objc_method_context, objc_ivar_chain, objc_ivar_context): Move to global tree array in objc/objc-act.[ch]. (methoddef): Remove unnecessary code. * objc/objc-act.c: (hashed_attribute, hashed_entry, imp_entry): Hoist struct definitions to objc-act.h. (nst_method_hash_list, cls_method_hash_list, imp_list, imp_count, cat_count): Place declaration in objc-act.h. (objc_tree_index): Move enumeration to objc-act.h. (objc_global_trees): Place declaration and macro accessors in objc-act.h. (implementation_context): Remove duplicate; use objc_implementation_context instead: (method_context): Remove duplicate; use objc_method_context instead. (objc_ellipsis_node, objc_method_prototype_template, implemented_classes, function_type): Move global vars to objc_global_trees. (init_objc): Use LAST_BASE_TREE_CODE instead of LAST_CODE. (build_message_expr): Move actual construction of ObjC message send nodes to finish_message_expr. (finish_message_expr): New routine, contains code formerly in build_message_expr. * objc/objc-act.h (finish_message_expr): New prototype. (objc_ivar_chain, objc_method_context, objc_ellipsis_node): Remove declarations; these vars are now part of objc_global_trees. (objc_tree_index, objc_global_trees): Move definitions from objc-act.c. * objc/objc-tree.def: Update copyright info. From-SVN: r46000
2001-10-04 00:05:57 +02:00
CLASS_CLS_METHODS (objc_implementation_context),
'+');
f2 = check_methods (PROTOCOL_NST_METHODS (p),
c-parse.in (objc_inherit_code, [...]): Make static. 2001-10-03 Ziemowit Laski <zlaski@apple.com> * c-parse.in (objc_inherit_code, objc_pq_context, objc_public_flag): Make static. (objc_interface_context, objc_implementation_context, objc_method_context, objc_ivar_chain, objc_ivar_context): Move to global tree array in objc/objc-act.[ch]. (methoddef): Remove unnecessary code. * objc/objc-act.c: (hashed_attribute, hashed_entry, imp_entry): Hoist struct definitions to objc-act.h. (nst_method_hash_list, cls_method_hash_list, imp_list, imp_count, cat_count): Place declaration in objc-act.h. (objc_tree_index): Move enumeration to objc-act.h. (objc_global_trees): Place declaration and macro accessors in objc-act.h. (implementation_context): Remove duplicate; use objc_implementation_context instead: (method_context): Remove duplicate; use objc_method_context instead. (objc_ellipsis_node, objc_method_prototype_template, implemented_classes, function_type): Move global vars to objc_global_trees. (init_objc): Use LAST_BASE_TREE_CODE instead of LAST_CODE. (build_message_expr): Move actual construction of ObjC message send nodes to finish_message_expr. (finish_message_expr): New routine, contains code formerly in build_message_expr. * objc/objc-act.h (finish_message_expr): New prototype. (objc_ivar_chain, objc_method_context, objc_ellipsis_node): Remove declarations; these vars are now part of objc_global_trees. (objc_tree_index, objc_global_trees): Move definitions from objc-act.c. * objc/objc-tree.def: Update copyright info. From-SVN: r46000
2001-10-04 00:05:57 +02:00
CLASS_NST_METHODS (objc_implementation_context),
'-');
}
else
{
f1 = check_methods_accessible (PROTOCOL_CLS_METHODS (p),
c-parse.in (objc_inherit_code, [...]): Make static. 2001-10-03 Ziemowit Laski <zlaski@apple.com> * c-parse.in (objc_inherit_code, objc_pq_context, objc_public_flag): Make static. (objc_interface_context, objc_implementation_context, objc_method_context, objc_ivar_chain, objc_ivar_context): Move to global tree array in objc/objc-act.[ch]. (methoddef): Remove unnecessary code. * objc/objc-act.c: (hashed_attribute, hashed_entry, imp_entry): Hoist struct definitions to objc-act.h. (nst_method_hash_list, cls_method_hash_list, imp_list, imp_count, cat_count): Place declaration in objc-act.h. (objc_tree_index): Move enumeration to objc-act.h. (objc_global_trees): Place declaration and macro accessors in objc-act.h. (implementation_context): Remove duplicate; use objc_implementation_context instead: (method_context): Remove duplicate; use objc_method_context instead. (objc_ellipsis_node, objc_method_prototype_template, implemented_classes, function_type): Move global vars to objc_global_trees. (init_objc): Use LAST_BASE_TREE_CODE instead of LAST_CODE. (build_message_expr): Move actual construction of ObjC message send nodes to finish_message_expr. (finish_message_expr): New routine, contains code formerly in build_message_expr. * objc/objc-act.h (finish_message_expr): New prototype. (objc_ivar_chain, objc_method_context, objc_ellipsis_node): Remove declarations; these vars are now part of objc_global_trees. (objc_tree_index, objc_global_trees): Move definitions from objc-act.c. * objc/objc-tree.def: Update copyright info. From-SVN: r46000
2001-10-04 00:05:57 +02:00
objc_implementation_context,
'+');
f2 = check_methods_accessible (PROTOCOL_NST_METHODS (p),
c-parse.in (objc_inherit_code, [...]): Make static. 2001-10-03 Ziemowit Laski <zlaski@apple.com> * c-parse.in (objc_inherit_code, objc_pq_context, objc_public_flag): Make static. (objc_interface_context, objc_implementation_context, objc_method_context, objc_ivar_chain, objc_ivar_context): Move to global tree array in objc/objc-act.[ch]. (methoddef): Remove unnecessary code. * objc/objc-act.c: (hashed_attribute, hashed_entry, imp_entry): Hoist struct definitions to objc-act.h. (nst_method_hash_list, cls_method_hash_list, imp_list, imp_count, cat_count): Place declaration in objc-act.h. (objc_tree_index): Move enumeration to objc-act.h. (objc_global_trees): Place declaration and macro accessors in objc-act.h. (implementation_context): Remove duplicate; use objc_implementation_context instead: (method_context): Remove duplicate; use objc_method_context instead. (objc_ellipsis_node, objc_method_prototype_template, implemented_classes, function_type): Move global vars to objc_global_trees. (init_objc): Use LAST_BASE_TREE_CODE instead of LAST_CODE. (build_message_expr): Move actual construction of ObjC message send nodes to finish_message_expr. (finish_message_expr): New routine, contains code formerly in build_message_expr. * objc/objc-act.h (finish_message_expr): New prototype. (objc_ivar_chain, objc_method_context, objc_ellipsis_node): Remove declarations; these vars are now part of objc_global_trees. (objc_tree_index, objc_global_trees): Move definitions from objc-act.c. * objc/objc-tree.def: Update copyright info. From-SVN: r46000
2001-10-04 00:05:57 +02:00
objc_implementation_context,
'-');
}
if (!f1 || !f2)
diagnostic.c (warning): Accept parameter to classify warning option. * diagnostic.c (warning): Accept parameter to classify warning option. (warning0): New, for when a pointer to an error() like function is needed. * errors.c (warning): Likewise. * errors.h (warning, warning0): Adjust prototypes. * toplev.h (warning, warning0): Likewise. * attribs.c, builtins.c, c-common.c, c-decl.c, c-format.c, c-gimplify.c, c-lex.c, c-objc-common.c, c-opts.c, c-parser.c, c-pragma.c, c-typeck.c, calls.c, cgraph.c, coverage.c, emit-rtl.c, fold-const.c, fortran/trans-decl.c, function.c, gcse.c, genautomata.c, haifa-sched.c, opts.c, passes.c, regclass.c, reload1.c, stmt.c, stor-layout.c, toplev.c, tree-cfg.c, tree-dump.c, tree-inline.c, tree-mudflap.c, tree-optimize.c, tree-ssa.c, tree.c, varasm.c: Adjust warning() callers. * config/alpha/alpha.c, config/arc/arc.c, config/arm/arm.c, config/avr/avr.c, config/bfin/bfin.c, config/c4x/c4x-c.c, config/c4x/c4x.c, config/cris/cris.c, config/darwin-c.c, config/darwin.c, config/darwin.h, config/h8300/h8300.c, config/i386/cygming.h, config/i386/djgpp.h, config/i386/i386.c, config/i386/winnt.c, config/ia64/ia64-c.c, config/ia64/ia64.c, config/ip2k/ip2k.c, config/m32r/m32r.c, config/m68hc11/m68hc11.c, config/m68k/m68k.c, config/mcore/mcore.c, config/mips/mips.c, config/mmix/mmix.c, config/ns32k/ns32k.c, config/pa/pa-hpux11.h, config/pa/pa.c, config/rs6000/aix43.h, config/rs6000/aix51.h, config/rs6000/aix52.h, config/rs6000/darwin.h, config/rs6000/rs6000-c.c, config/rs6000/rs6000.c, config/s390/s390.c, config/sh/sh.c, config/sh/sh.h, config/sh/symbian.c, config/sol2-c.c, config/sol2.c, config/stormy16/stormy16.c, config/v850/v850-c.c, config/v850/v850.c, config/xtensa/xtensa.c: Adjust warning() callers. * ada/misc.c: Adjust warning() callers. * cp/call.c, cp/class.c, cp/cvt.c, cp/decl.c, cp/decl2.c, cp/except.c, cp/friend.c, cp/init.c, cp/lex.c, cp/mangle.c, cp/method.c, cp/name-lookup.c, cp/parser.c, cp/repo.c, cp/rtti.c, cp/tree.c, cp/typeck.c, cp/typeck2.c: Adjust warning() callers. * fortran/trans-decl.c: Adjust warning() callers. * java/class.c, java/decl.c, java/expr.c, java/jcf-io.c, java/jcf-parse.c, java/jv-scan.c, java/parse.y: Adjust warning() callers. * objc/objc-act.c: Adjust warning() callers. * treelang/parse.y: Adjust warning() callers. From-SVN: r98633
2005-04-23 23:29:07 +02:00
warning (0, "%s %qs does not fully implement the %qs protocol",
type, name, IDENTIFIER_POINTER (PROTOCOL_NAME (p)));
}
/* Check protocols recursively. */
if (PROTOCOL_LIST (p))
{
tree subs = PROTOCOL_LIST (p);
tree super_class =
lookup_interface (CLASS_SUPER_NAME (implementation_template));
while (subs)
{
tree sub = TREE_VALUE (subs);
/* If the superclass does not conform to the protocols
inherited by P, then we must! */
if (!super_class || !conforms_to_protocol (super_class, sub))
check_protocol (sub, type, name);
subs = TREE_CHAIN (subs);
}
}
1992-01-18 00:15:38 +01:00
}
/* Check whether the current interface (accessible via
c-parse.in (objc_inherit_code, [...]): Make static. 2001-10-03 Ziemowit Laski <zlaski@apple.com> * c-parse.in (objc_inherit_code, objc_pq_context, objc_public_flag): Make static. (objc_interface_context, objc_implementation_context, objc_method_context, objc_ivar_chain, objc_ivar_context): Move to global tree array in objc/objc-act.[ch]. (methoddef): Remove unnecessary code. * objc/objc-act.c: (hashed_attribute, hashed_entry, imp_entry): Hoist struct definitions to objc-act.h. (nst_method_hash_list, cls_method_hash_list, imp_list, imp_count, cat_count): Place declaration in objc-act.h. (objc_tree_index): Move enumeration to objc-act.h. (objc_global_trees): Place declaration and macro accessors in objc-act.h. (implementation_context): Remove duplicate; use objc_implementation_context instead: (method_context): Remove duplicate; use objc_method_context instead. (objc_ellipsis_node, objc_method_prototype_template, implemented_classes, function_type): Move global vars to objc_global_trees. (init_objc): Use LAST_BASE_TREE_CODE instead of LAST_CODE. (build_message_expr): Move actual construction of ObjC message send nodes to finish_message_expr. (finish_message_expr): New routine, contains code formerly in build_message_expr. * objc/objc-act.h (finish_message_expr): New prototype. (objc_ivar_chain, objc_method_context, objc_ellipsis_node): Remove declarations; these vars are now part of objc_global_trees. (objc_tree_index, objc_global_trees): Move definitions from objc-act.c. * objc/objc-tree.def: Update copyright info. From-SVN: r46000
2001-10-04 00:05:57 +02:00
'objc_implementation_context') actually implements the protocols listed
in PROTO_LIST. */
static void
check_protocols (tree proto_list, const char *type, const char *name)
{
for ( ; proto_list; proto_list = TREE_CHAIN (proto_list))
{
tree p = TREE_VALUE (proto_list);
check_protocol (p, type, name);
}
}
1992-01-18 00:15:38 +01:00
/* Make sure that the class CLASS_NAME is defined
CODE says which kind of thing CLASS_NAME ought to be.
It can be CLASS_INTERFACE_TYPE, CLASS_IMPLEMENTATION_TYPE,
CATEGORY_INTERFACE_TYPE, or CATEGORY_IMPLEMENTATION_TYPE. */
Makefile.in (c-parse.o): Depend on $(C_COMMON_H). [gcc/ChangeLog] 2004-09-07 Ziemowit Laski <zlaski@apple.com> * Makefile.in (c-parse.o): Depend on $(C_COMMON_H). * c-parse.in: Include c-common.h instead of objc-act.h. (ivar_decl_list, ivar_decls, ivar_decl, ivars, ivar_declarator, myparms, myparm): Remove %type declarations. (methodtype, optparms, OBJC_TYPE_QUAL, objc_quals, objc_qual, objc_typename, objc_try_catch_stmt, optellipsis): Add %type declarations. (objc_inherit_code, objc_public_flag): Remove. (typespec_nonreserved_nonattr): Call objc_get_protocol_qualified_type() instead of get_static_reference() and get_protocol_reference(). (stmt_nocomp): Call grokparm() on @catch parameter. (objcdef): Move semantic action to objc_finish_implementation(). (classdef): Move semantic action to objc_start_class_interface(), objc_continue_interface(), objc_finish_interface(), objc_start_class_implementation(), objc_continue_implementation(), objc_start_category_interface() and objc_start_category_implementation(). (protocoldef): Move semantic actions to objc_start_protocol() and objc_finish_interface(). (ivar_decl_list): Remove nonterminal. (visibility_spec): Move semantic actions to objc_set_visibility(). (ivar_decls): Remove assignment to $$. (ivar_decl): Rephrase in terms of component_decl; call objc_add_instance_variable(). (ivars, ivar_declarator): Remove nonterminals. (opt_semi): New nonterminal. (methodtype): Remove semantic actions. (methoddef): Move semantic actions to objc_set_method_type(), objc_start_method_definition() and objc_finish_method_definition(). (methodproto): Move semantic actions to objc_set_method_type() and objc_add_method_declaration(). (methoddecl): Use objc_typename instead of typename; move semantic actions to objc_build_method_signature(). (optarglist, myxdecls, mydecl, myparms, myparm): Remove nonterminals. (optparmlist): Express in terms of optparms and optellipsis. (optparms, optellipsis, objc_qual, objc_quals, objc_typename): New nonterminals. (keyworddecl): Use objc_typename instead of typename. (rid_to_yy): Mark RID_IN, RID_OUT, RID_INOUT, RID_BYCOPY, RID_BYREF and RID_ONEWAY as returning OBJC_TYPE_QUAL to yyparse(). [gcc/objc/ChangeLog] 2004-09-07 Ziemowit Laski <zlaski@apple.com> * Make-lang.in (objc/objc-parse.o): Depend on $(C_COMMON_H) instead of objc/objc-act.h. (objc/objc-act.o): Depend on $(HASHTAB_H). * objc-act.c: Include hashtab.h; in ObjC++ mode, include cp-tree.h and objcp-decl.h instead of c-tree.h. (build_module_descriptor, get_class_ivars, synth_id_with_class_suffix, error_with_ivar, gen_method_decl, gen_declaration, setup_string_decl, build_protocol_template): Adjust prototypes. (build_module_initializer_routine, start_class, continue_class, finish_class, start_method_def, objc_start_function, start_protocol, build_method_decl, objc_add_method, add_instance_variable, build_ivar_reference, is_ivar, is_private, get_super_receiver, build_selector_table_decl, objc_push_parm, objc_get_parm_info, gen_type_name, gen_type_name_0, start_var_decl, finish_var_decl, create_field_decl): New prototypes. (objc_expand_function_end, comp_method_with_proto, objc_expr_last, gen_declaration_1, gen_declarator, is_complex_decl, adorn_decl, define_decl, create_builtin_decl, gen_declspecs): Remove prototypes. (TYPE_ID): Rename to OBJECT_TYPEDEF_NAME. (CLASS_TYPEDEF_NAME): New. (TAG_EXECCLASS): Change from a global variable to a #define. (TAG_RETURN_STRUCT): Delete. (TAG_GNUINIT): New, holds '__objc_gnu_init' name. (objc_inherit_code, objc_public_flag): New, moved from c-parse.in. (string_descriptor): New struct. (string_htab): New hash table. (string_hash, string_eq): New prototypes. (generate_struct_by_value_array): Call create_field_decl() instead of create_builtin_decl(). (objc_init): Do not initialize objc_ellipsis_node or TAG_EXECCLASS; In ObjC++ mode, call cxx_init() instead of c_objc_common_init(). (objc_finish_file): In ObjC++, call instantiate_pending_templates() and cp_finish_file(). (define_decl, get_static_reference, get_protocol_reference, create_builtin_decl): Remove functions. (objc_start_class_interface, objc_start_category_interface, objc_start_protocol, objc_continue_interface, objc_finish_interface, objc_start_class_implementation, objc_start_category_implementation, objc_continue_implementation, objc_finish_implementation, objc_set_visibility, objc_set_method_type, objc_build_method_signature, objc_add_method_declaration, objc_start_method_definition, objc_add_instance_variable, objc_get_protocol_qualified_type, create_field_decl, start_var_decl, finish_var_decl): New functions. (setup_string_decl): Simplify since it is only called once. (synth_module_prologue): Call build_class_template(); predefine 'id' and 'Class' as typedefs; rename 'temp_type' to 'type'; disable debug hooks for duration of function; fix GNU runtime messenger signatures to correspond to reality; forward-declare '__objc_exec_class' for the GNU runtime; call build_selector_table_decl(); in ObjC++ mode, generate 'extern "C" { ... }' wrappers around synthesized declarations; call build_protocol_template() and build_category_template(). (string_hash, string_eq): New functions. (objc_build_string_object): Check metaclass correctness only once; store string literals in hash table. (objc_build_constructor): Do not convert initializer elements; adjust for ObjC++ impedance mismatch. (build_objc_symtab_template): Call create_field_decl() instead of create_builtin_decl(). (init_objc_symtab): Add missing conversion to initializer element. (build_metadata_decl): Call start_var_decl() instead of define_decl(). (generate_objc_symtab_decl): Do not call build_category_template(); call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(). (build_module_descriptor): Call create_field_decl() instead of grokfield(); call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(); always mark module descriptor as used; move GNU runtime-specific functionality to build_module_initializer_routine(). (build_module_initializer_routine): New function, broken off of build_module_descriptor(). (objc_static_init_needed_p, objc_generate_static_init_call): New functions. (generate_static_references, generate_strings, build_selector_translation_table, generate_descriptor_table, generate_ivars_list, generate_dispatch_table, generate_category): Call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(); build a type directly instead of via groktypename(). (build_selector_reference_decl, build_selector_table_decl, build_class_reference_decl, build_protocol_reference, generate_objc_image_info): Call start_var_decl() instead of build_decl(). (build_selector_reference): For GNU runtime, do not call build_selector_reference_decl(). (build_selector, build_typed_selector_reference): Always convert result to the selector type. (add_objc_string): Cast return value to 'char *'. (build_method_prototype_template, build_selector_template, build_method_template): Use actual selector type for fields pointing to selectors. (finish_objc): For GNU runtime, call build_module_initializer_routine() after build_module_descriptor(). (generate_protocol_list, generate_shared_structures): Call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(); build a type directly instead of via groktypename(). (synth_id_with_class_suffix): Return a string. (get_arg_type_list): For instance methods, use the instance type for 'self'; do not call groktypename_in_parm_context(). (build_objc_string_decl): Squash redeclaration errors in ObjC++. (objc_is_class_name): Use OBJC_TYPE_NAME instead of TYPE_NAME; handle RECORD_TYPEs in ObjC as well as ObjC++. (objc_is_id): New function. (objc_is_object_ptr): Return the canonical type node. (objc_get_class_ivars): Simplify using get_class_ivars(). (get_class_ivars): Remove second parameter; create a fresh copy of the ivar list for each call; do not check for existence of super class. (objc_eh_runtime_type): Mark #ifndef OBJCPLUS. (objc_init_exceptions): When using SJLJ-style exceptions, require the use of '-fobjc-exceptions' flag; do not require it for DWARF-style exceptions. (objc_build_exc_ptr, next_sjlj_build_try_catch_finally): Use objc_object_type instead of objc_id_type. (objc_begin_catch_clause): Convert the incoming PARM_DECL into a VAR_DECL before placing it in the appropriate scope; do not call define_decl(); adjust call to c_begin_compound_stmt(); use objc_object_type instead of objc_id_type. (build_next_objc_exception_stuff): Call create_field_decl() instead of create_builtin_decl(); construct type directly instead of calling groktypename(); use OBJC_VOID_AT_END to mark end of function parameters. (build_private_template): Adjust call to get_class_ivars(); build a type directly instead of via groktypename(). (build_protocol_template, build_method_prototype_list_template, build_method_prototype_template, build_category_template, build_selector_template, build_class_template, build_super_template, build_ivar_template, build_ivar_list_template, build_method_list_template, build_method_template): Call create_field_decl() instead of grokfield(). (objc_method_parm_type): Do not call groktypename(). (generate_descriptor_table): Call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(). (generate_method_descriptors, build_protocol_initializer, generate_dispatch_tables, build_category_initializer, build_shared_structure_initializer): Do not call groktypename(). (generate_protocols): Call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(); do not call groktypename(). (error_with_ivar): Remove last parameter. (check_ivars): Do not iterate ovar CLASS_RAW_IVARS lists in addition to CLASS_IVARS lists; adjust calls to error_with_ivar(). (generate_ivar_lists): Convert one of the initializer elements; do not call groktypename(). (get_arg_type_list, start_method_def, gen_method_def): Account for new representation of variable arguments and '...' in Objective-C methods; add Objective-C++ impedance matching code. (is_objc_type_qualifier): Remove function. (adjust_type_for_id_default): Simplify; there is no longer a need to wade through declspecs. (lookup_interface, start_class, continue_class, finish_class, start_method_def, start_protocol, build_method_decl, objc_add_method, add_instance_variable, build_ivar_reference, is_ivar, is_private, get_super_receiver, objc_build_finally_epilogue): Make into static functions. (receiver_is_class_object): Use new IS_CLASS() macro. (objc_build_message_expr): Tweak ObjC++ message argument handling; call objc_finish_message_expr() instead of finish_message_expr(). (finish_message_expr): Rename to objc_finish_message_expr(); use OBJC_TYPE_NAME and OBJC_SET_TYPE_NAME macros instead of TYPE_NAME. call gen_type_name() instead of gen_declaration(); call objc_is_id() instead of using IS_ID and IS_CLASS; Use objc_class_name instead of calling get_identifier("Class"); handle CONVERT_EXPRs in receiver. (build_objc_method_call, warn_with_method): Do not call groktypename(). (build_ivar_reference): Call convert() instead of clobbering in a type. (hash_init): Initialize string_htab hash table. (add_instance_variable): Simplify parameter list; do not call grokfield(); do not populate CLASS_IVARS list. (start_class): Check for the existence of super class, if one was specified. (continue_class): Use CLASS_RAW_IVARS rather than CLASS_IVARS; do not call build_class_template(); adjust call to get_class_ivars(); call build_decl(), pushdecl() and finish_decl() instead of define_decl(). (finish_class): Call build_decl(), pushdecl() and finish_decl() instead of define_decl(). (add_protocols): Use PROTOCOL_BINFO_ELTS for the tree vector size. (start_protocol): Do not call build_protocol_template(); use PROTOCOL_BINFO_ELTS for the tree vector size. (encode_type_qualifiers): Do not handle the 'const' qualifier here. (encode_pointer): Encode 'const char *' as 'r*', for backwards compatibility. (encode_array): Use HOST_WIDE_INT_PRINT_DEC instead of "%ld". (encode_type): Handle the 'const' qualifier here. (objc_parmlist): New global variable, sued by objc_push_parm and objc_get_parm_info(). (objc_push_parm, objc_get_parm_info): New functions. (objc_expr_last): Remove function. (synth_self_and_ucmd_args): For instance methods, use the instance type for 'self'; call objc_push_parm() instead of push_parm_decl(). (start_method_def): Do not call push_scope(), declare_parm_level(), pop_scope(), push_parm_decl(), store_parm_decls() or objc_expr_last(); just use objc_push_parm() and objc_get_parm_info(). (comp_method_with_proto): Remove function. (objc_types_are_equivalent): Strip away indirections before comparing underlying types. (comp_proto_with_proto): Do not call groktypename(); types are no longer in raw declspec format. (objc_start_function): New function. (really_start_method): Call comp_proto_with_proto() instead of comp_method_with_proto(); call objc_start_function() instead of hand-crafting a function declarator. (continue_method_def, objc_expand_function_end): Remove functions. (get_super_receiver): Call objc_get_current_scope() instead of get_current_scope(); reference 'super_class' field (instead of 'class'). (finish_method_def): Rename to objc_finish_method_definition() and add a function decl parameter; move method encoding call from objc_expand_function_end(). (is_complex_decl, adorn_decl, gen_declarator, gen_declspecs, gen_declaration_1): Remove functions. (tmpbuf, RAW_DECLSPEC): Remove. (gen_declaration): Remove second parameter; simplify to deal with TYPE_P nodes instead of raw declspecs. (gen_type_name, gen_type_name_0): New functions. (gen_method_decl): Remove second parameter; call gen_type_name() instead of gen_declaration_1(). (dump_interface): Adjust calls to gen_declaration() and gen_method_decl(); do not allocate a separate string buffer. (init_objc): Allocate a larger string buffer to accommodate dump_interface(); adjust call to build_module_descriptor(); add call to build_module_initializer_routine() for the GNU runtime. (generate_classref_translation_entry): Do not call start_decl(); call finish_var_decl() instead of finish_decl(); call convert() instead of build_c_cast(). * objc-act.h (CLASS_OWN_IVARS): Remove accessor. (CLASS_BINFO_ELTS): Reduce from 6 to 5, now that CLASS_OWN_IVARS is gone. (OCTI_GNU_INIT_DECL, GNU_INIT_decl): New. (OCTI_ELLIPSIS_NODE, objc_ellipsis_node): Remove. (OCTI_ID_ID, id_type, objc_id_id): Rename to OCTI_ID_NAME, objc_object_type and objc_object_name, respectively. (OCTI_CLS_REF, OCTI_CLASS_NAME, objc_class_reference, objc_class_name): New. (IS_CLASS): New macro. (IS_ID, IS_SUPER): Robustify. (OCTI_EXECCLASS_DECL, execclass_decl): New. (finish_file, start_class, continue_class, finish_class, start_method_def, continue_method_def, finish_method_def, start_protocol, finish_protocol, objc_build_throw_stmt, objc_build_try_catch_finally_stmt, objc_build_synchronized_prologue, objc_build_synchronized_epilogue, objc_build_try_prologue, objc_build_try_epilogue, objc_build_catch_stmt, objc_build_catch_epilogue, objc_build_finally_prologue, objc_build_finally_epilogue, is_ivar, is_private, is_public, add_instance_variable, objc_add_method, get_super_receiver, objc_clear_super_receiver, get_class_ivars_from_name, get_class_reference, get_static_reference, get_object_reference, build_message_expr, finish_message_expr, build_selector_expr, build_ivar_reference, build_keyword_decl, build_method_decl, build_protocol_expr, build_objc_string_object, objc_declare_alias, objc_declare_class, objc_declare_protocols, objc_comptypes, objc_check_decl, build_encode_expr): Remove prototypes. (imp_count, cat_count): Make GGC-aware. (OBJC_SET_TYPE_NAME): New macro. From-SVN: r87168
2004-09-08 02:49:44 +02:00
static tree
start_class (enum tree_code code, tree class_name, tree super_name,
tree protocol_list)
1992-01-18 00:15:38 +01:00
{
tree class, decl;
1992-01-18 00:15:38 +01:00
#ifdef OBJCPLUS
if (current_namespace != global_namespace) {
error ("Objective-C declarations may only appear in global scope");
}
#endif /* OBJCPLUS */
if (objc_implementation_context)
{
diagnostic.c (warning): Accept parameter to classify warning option. * diagnostic.c (warning): Accept parameter to classify warning option. (warning0): New, for when a pointer to an error() like function is needed. * errors.c (warning): Likewise. * errors.h (warning, warning0): Adjust prototypes. * toplev.h (warning, warning0): Likewise. * attribs.c, builtins.c, c-common.c, c-decl.c, c-format.c, c-gimplify.c, c-lex.c, c-objc-common.c, c-opts.c, c-parser.c, c-pragma.c, c-typeck.c, calls.c, cgraph.c, coverage.c, emit-rtl.c, fold-const.c, fortran/trans-decl.c, function.c, gcse.c, genautomata.c, haifa-sched.c, opts.c, passes.c, regclass.c, reload1.c, stmt.c, stor-layout.c, toplev.c, tree-cfg.c, tree-dump.c, tree-inline.c, tree-mudflap.c, tree-optimize.c, tree-ssa.c, tree.c, varasm.c: Adjust warning() callers. * config/alpha/alpha.c, config/arc/arc.c, config/arm/arm.c, config/avr/avr.c, config/bfin/bfin.c, config/c4x/c4x-c.c, config/c4x/c4x.c, config/cris/cris.c, config/darwin-c.c, config/darwin.c, config/darwin.h, config/h8300/h8300.c, config/i386/cygming.h, config/i386/djgpp.h, config/i386/i386.c, config/i386/winnt.c, config/ia64/ia64-c.c, config/ia64/ia64.c, config/ip2k/ip2k.c, config/m32r/m32r.c, config/m68hc11/m68hc11.c, config/m68k/m68k.c, config/mcore/mcore.c, config/mips/mips.c, config/mmix/mmix.c, config/ns32k/ns32k.c, config/pa/pa-hpux11.h, config/pa/pa.c, config/rs6000/aix43.h, config/rs6000/aix51.h, config/rs6000/aix52.h, config/rs6000/darwin.h, config/rs6000/rs6000-c.c, config/rs6000/rs6000.c, config/s390/s390.c, config/sh/sh.c, config/sh/sh.h, config/sh/symbian.c, config/sol2-c.c, config/sol2.c, config/stormy16/stormy16.c, config/v850/v850-c.c, config/v850/v850.c, config/xtensa/xtensa.c: Adjust warning() callers. * ada/misc.c: Adjust warning() callers. * cp/call.c, cp/class.c, cp/cvt.c, cp/decl.c, cp/decl2.c, cp/except.c, cp/friend.c, cp/init.c, cp/lex.c, cp/mangle.c, cp/method.c, cp/name-lookup.c, cp/parser.c, cp/repo.c, cp/rtti.c, cp/tree.c, cp/typeck.c, cp/typeck2.c: Adjust warning() callers. * fortran/trans-decl.c: Adjust warning() callers. * java/class.c, java/decl.c, java/expr.c, java/jcf-io.c, java/jcf-parse.c, java/jv-scan.c, java/parse.y: Adjust warning() callers. * objc/objc-act.c: Adjust warning() callers. * treelang/parse.y: Adjust warning() callers. From-SVN: r98633
2005-04-23 23:29:07 +02:00
warning (0, "%<@end%> missing in implementation context");
finish_class (objc_implementation_context);
objc_ivar_chain = NULL_TREE;
objc_implementation_context = NULL_TREE;
}
1992-01-18 00:15:38 +01:00
class = make_node (code);
c-tree.h (TYPE_ACTUAL_ARG_TYPES): Use TYPE_LANG_SLOT_1. * c-tree.h (TYPE_ACTUAL_ARG_TYPES): Use TYPE_LANG_SLOT_1. * dwarf2out.c (add_data_member_location_attribute): Check for TREE_BINFO. * tree.c (tree_node_kinds): Add "binfos". (binfo_lang_slots): New. (make_node_stat): Add TREE_BINFO. (make_tree_binfo_stat): New. (tree_node_structure): Add TREE_BINFO. * tree.def (TREE_BINFO): New. * tree.h (REC_OR_UNION_CHECK): Rename to ... (RECORD_OR_UNION_CHECK): ... here. (NOT_RECORD_OR_UNION_CHECK): New. (TRE_VIA_VIRTUAL): Allow TREE_LIST or TREE_BINFO. (TYPE_FIELDS, TYPE_METHODS, TYPE_VFIELD): Adjust for RECORD_OR_UNION_CHECK. (TYPE_BINFO): Use RECORD_OR_UNION_CHECK. (TYPE_LANG_SLOT_1): New. (BINFO_TYPE, BINFO_OFFSET, BINFO_VTABLE, BINFO_VIRTUALS, BINFO_BASETYPES, TYPE_BINFO_BASETYPES, BINFO_VPTR_FIELD, BINFO_BASEACCESSES, BINFO_INHERITANCE_CHAIN): Adjust. (BINFO_ELTS): Remove. (BINFO_LANG_SLOT): New. (struct tree_binfo): New. (binfo_lang_slots): Declare. (enum tree_node_structure_enum): Add TS_BINFO. (union tree_node): Add binfo. (make_tree_binfo_stat): Declare. (make_tree_binfo): New. (enum tree_node_kind): Add binfo_kind. * cp/call.c (enforce_access): Expect TREE_BINFO. * cp/class.c (binfo_ctor_vtable): Check TREE_BINFO. * cp/cp-tree.h (RECORD_OR_UNION_TYPE_CHECK): Remove. (BINFO_SUBVTT_INDEX, BINFO_VPTR_INDEX, BINFO_PRIMARY_BASE_OF): Adjust. (BINFO_LANG_ELTS): Remove. (BINFO_LANG_SLOTS): New. (TYPE_RAISES_EXCEPTIONS, ENUM_TEMPLATE_INFO): Use TYPE_LANG_SLOT_1. (CLASSTYPE_TEMPLATE_INFO): Adjust. * cp/pt.c (tsubst): Split TREE_BINFO case from TREE_VEC case. * cp/search.c (lookup_member): Check TREE_BINFO. * cp/semantics.c (perform_or_defer_access_check): Likewise. (check_accessibility_of_qualified_id): Check deferred_access_no_check. * cp/tree.c (make_binfo): Use make_tree_binfo. * java/class.c (make_class): Use make_tree_binfo. (set_super_info, add_interface_do): Likewise. * java/java-tree.h (CLASS_HAS_SUPER_FLAG): Expect a BINFO. * objc/objc-act.c (start_class, objc_declare_protocols, start_protocols): Use TYPE_LANG_SLOT_1. * objc/objc-act.h (CLASS_BINFO_ELTS, PROTOCOL_BINFO_ELTS): Rename to ... (CLASS_LANG_SLOT_ELTS, PROTOCOL_LANG_SLOT_ELTS): ... here. (CLASS_IVARS, CLASS_RAW_IVARS, CLASS_STATIC_TEMPLATE, CLASS_CATEGORY_LIST, CLASS_PROTOCOL_LIST, CLASS_OWN_IVARS, PROTOCOL_LIST, PROTOCOL_FORWARD_DECL): Use TYPE_LANG_SLOT_1. From-SVN: r84110
2004-07-05 11:35:44 +02:00
TYPE_LANG_SLOT_1 (class) = make_tree_vec (CLASS_LANG_SLOT_ELTS);
1992-01-18 00:15:38 +01:00
Yet more Objective-C++... * objc-act.c (objc_finish_try_stmt): Add return value. (objc_build_synchronized): Likewise. * objc-act.c (objc_is_gcable_type): Add. (objc_substitute_decl): Add. (objc_build_ivar_assignment): Add. (objc_build_global_assignment): Add. (objc_build_strong_cast_assignment): Add. (objc_is_ivar_reference_p): Add. (objc_is_global_reference_p): Add. (objc_generate_write_barrier): Add. (objc_rewrite_function_call): Add. (objc_gimplify_expr): Add Objective-C++ support. * objc-act.h (ALLOC_OBJC_TYPE_LANG_SPECIFIC): Likewise. (SIZEOF_OBJC_TYPE_LANG_SPECIFIC): Add. (INIT_TYPE_OBJC_INFO): Add Objective-C++ support. (DUP_TYPE_OBJC_INFO): Likewise. (struct imp_entry): Add field has_cxx_cdtors. (struct imp_entry *imp_list): Add OCTI_UMSG_FAST_DECL, OCTI_METH_LIST_TEMPL, OCTI_METH_PROTO_LIST_TEMPL, OCTI_IVAR_LIST_TEMPL, OCTI_ASSIGN_IVAR_DECL, OCTI_ASSIGN_IVAR_FAST_DECL, OCTI_ASSIGN_GLOBAL_DECL, OCTI_ASSIGN_STRONGCAST_DECL. (umsg_fast_decl): Add. (objc_assign_ivar_decl): Add. (objc_assign_ivar_fast_decl): Add. (objc_assign_global_decl): Add. (objc_assign_strong_cast_decl): Add. (objc_method_list_ptr): Add. (objc_method_proto_list_ptr): Add. (objc_ivar_list_ptr): Add. * objc-act.c (should_call_super_dealloc): Add. (OBJC_VERSION): Bump to 6. (objc_is_gcable_type): Add. (objc_substitute_decl): Add. (objc_build_ivar_assignment): Add. (objc_build_global_assignment): Add. (objc_build_strong_cast_assignment): Add. (objc_is_gcable_p): Add. (objc_is_ivar_reference_p): Add. (objc_is_global_reference_p): Add. (generate_shared_structures): Add flags parameter. (objc_generate_cxx_ctor_or_dtor): Add. (objc_generate_cxx_cdtors): Add. (add_class): Add name parameter. (objc_types_share_size_and_alignment): Add. (comp_proto_with_proto): Add strict parameter. (CLS_HAS_CXX_STRUCTORS): Add. (TAG_ASSIGNIVAR): Add. (TAG_ASSIGNGLOBAL): Add. (TAG_ASSIGNSTRONGCAST): Add. (TAG_MSGSEND_FAST): Add. (TAG_ASSIGNIVAR_FAST): Add. (TAG_CXX_CONSTRUCT): Add. (TAG_CXX_DESTRUCT): Add. (OBJC_LOOKUP_CLASS): Add. (OBJC_LOOKUP_NO_SUPER): Add. (objc_finish_file): Add pch support. (objc_finish_implementation): Add Objective-C++ support. (synth_module_prologue): Likewise. (synth_module_prologue): Add fast dispatching. (objc_get_class_reference): Add Objective-C++ support. (objc_generate_write_barrier): Likewise. (next_sjlj_build_enter_and_setjmp): Likewise. (objc_begin_try_stmt): Likewise. (build_next_objc_exception_stuff): Add fast ivar support. (build_private_template): Mark the record as used so debug information is generated. (build_protocol_template): Add Objective-C++ support. (objc_method_parm_type) Likewise. (objc_generate_cxx_ctor_or_dtor): Likewise. (objc_generate_cxx_cdtors): Likewise. (build_protocol_initializer): Likewise. (build_category_template): Likewise. (build_class_template): Likewise. (build_method_list_template): Likewise. (build_category_initializer): Likewise. (build_shared_structure_initializer): Likewise. (objc_finish_message_expr): Likewise. (build_objc_method_call): Add fast dispatch support. (lookup_method_static): Add support to end search at superclasses. (add_method_to_hash_list): Add strict parameter to comp_proto_with_proto. (objc_add_method): Likewise. (objc_add_method): Also set the interface_value. (add_instance_variable): Add Objective-C++ support. (objc_is_public): Likewise. (start_class): Likewise. (continue_class): Likewise. (encode_aggregate_within): Likewise. (start_method_def): Likewise. (objc_start_function): Clear current_function_returns_value and current_function_returns_null. (really_start_method): Add Objective-C++ support. (objc_finish_method_definition): Add warning for missing [super dealloc]. (finish_objc): Add Objective-C++ support. (generate_objc_image_info): Likewise. (objc_lookup_ivar): Likewise. * objc-act.h (TYPE_HAS_OBJC_INFO): Likewise. (INIT_TYPE_OBJC_INFO): Likewise. (DUP_TYPE_OBJC_INFO): Likewise. From-SVN: r99857
2005-05-17 22:07:08 +02:00
/* Check for existence of the super class, if one was specified. Note
that we must have seen an @interface, not just a @class. If we
are looking at a @compatibility_alias, traverse it first. */
Makefile.in (c-parse.o): Depend on $(C_COMMON_H). [gcc/ChangeLog] 2004-09-07 Ziemowit Laski <zlaski@apple.com> * Makefile.in (c-parse.o): Depend on $(C_COMMON_H). * c-parse.in: Include c-common.h instead of objc-act.h. (ivar_decl_list, ivar_decls, ivar_decl, ivars, ivar_declarator, myparms, myparm): Remove %type declarations. (methodtype, optparms, OBJC_TYPE_QUAL, objc_quals, objc_qual, objc_typename, objc_try_catch_stmt, optellipsis): Add %type declarations. (objc_inherit_code, objc_public_flag): Remove. (typespec_nonreserved_nonattr): Call objc_get_protocol_qualified_type() instead of get_static_reference() and get_protocol_reference(). (stmt_nocomp): Call grokparm() on @catch parameter. (objcdef): Move semantic action to objc_finish_implementation(). (classdef): Move semantic action to objc_start_class_interface(), objc_continue_interface(), objc_finish_interface(), objc_start_class_implementation(), objc_continue_implementation(), objc_start_category_interface() and objc_start_category_implementation(). (protocoldef): Move semantic actions to objc_start_protocol() and objc_finish_interface(). (ivar_decl_list): Remove nonterminal. (visibility_spec): Move semantic actions to objc_set_visibility(). (ivar_decls): Remove assignment to $$. (ivar_decl): Rephrase in terms of component_decl; call objc_add_instance_variable(). (ivars, ivar_declarator): Remove nonterminals. (opt_semi): New nonterminal. (methodtype): Remove semantic actions. (methoddef): Move semantic actions to objc_set_method_type(), objc_start_method_definition() and objc_finish_method_definition(). (methodproto): Move semantic actions to objc_set_method_type() and objc_add_method_declaration(). (methoddecl): Use objc_typename instead of typename; move semantic actions to objc_build_method_signature(). (optarglist, myxdecls, mydecl, myparms, myparm): Remove nonterminals. (optparmlist): Express in terms of optparms and optellipsis. (optparms, optellipsis, objc_qual, objc_quals, objc_typename): New nonterminals. (keyworddecl): Use objc_typename instead of typename. (rid_to_yy): Mark RID_IN, RID_OUT, RID_INOUT, RID_BYCOPY, RID_BYREF and RID_ONEWAY as returning OBJC_TYPE_QUAL to yyparse(). [gcc/objc/ChangeLog] 2004-09-07 Ziemowit Laski <zlaski@apple.com> * Make-lang.in (objc/objc-parse.o): Depend on $(C_COMMON_H) instead of objc/objc-act.h. (objc/objc-act.o): Depend on $(HASHTAB_H). * objc-act.c: Include hashtab.h; in ObjC++ mode, include cp-tree.h and objcp-decl.h instead of c-tree.h. (build_module_descriptor, get_class_ivars, synth_id_with_class_suffix, error_with_ivar, gen_method_decl, gen_declaration, setup_string_decl, build_protocol_template): Adjust prototypes. (build_module_initializer_routine, start_class, continue_class, finish_class, start_method_def, objc_start_function, start_protocol, build_method_decl, objc_add_method, add_instance_variable, build_ivar_reference, is_ivar, is_private, get_super_receiver, build_selector_table_decl, objc_push_parm, objc_get_parm_info, gen_type_name, gen_type_name_0, start_var_decl, finish_var_decl, create_field_decl): New prototypes. (objc_expand_function_end, comp_method_with_proto, objc_expr_last, gen_declaration_1, gen_declarator, is_complex_decl, adorn_decl, define_decl, create_builtin_decl, gen_declspecs): Remove prototypes. (TYPE_ID): Rename to OBJECT_TYPEDEF_NAME. (CLASS_TYPEDEF_NAME): New. (TAG_EXECCLASS): Change from a global variable to a #define. (TAG_RETURN_STRUCT): Delete. (TAG_GNUINIT): New, holds '__objc_gnu_init' name. (objc_inherit_code, objc_public_flag): New, moved from c-parse.in. (string_descriptor): New struct. (string_htab): New hash table. (string_hash, string_eq): New prototypes. (generate_struct_by_value_array): Call create_field_decl() instead of create_builtin_decl(). (objc_init): Do not initialize objc_ellipsis_node or TAG_EXECCLASS; In ObjC++ mode, call cxx_init() instead of c_objc_common_init(). (objc_finish_file): In ObjC++, call instantiate_pending_templates() and cp_finish_file(). (define_decl, get_static_reference, get_protocol_reference, create_builtin_decl): Remove functions. (objc_start_class_interface, objc_start_category_interface, objc_start_protocol, objc_continue_interface, objc_finish_interface, objc_start_class_implementation, objc_start_category_implementation, objc_continue_implementation, objc_finish_implementation, objc_set_visibility, objc_set_method_type, objc_build_method_signature, objc_add_method_declaration, objc_start_method_definition, objc_add_instance_variable, objc_get_protocol_qualified_type, create_field_decl, start_var_decl, finish_var_decl): New functions. (setup_string_decl): Simplify since it is only called once. (synth_module_prologue): Call build_class_template(); predefine 'id' and 'Class' as typedefs; rename 'temp_type' to 'type'; disable debug hooks for duration of function; fix GNU runtime messenger signatures to correspond to reality; forward-declare '__objc_exec_class' for the GNU runtime; call build_selector_table_decl(); in ObjC++ mode, generate 'extern "C" { ... }' wrappers around synthesized declarations; call build_protocol_template() and build_category_template(). (string_hash, string_eq): New functions. (objc_build_string_object): Check metaclass correctness only once; store string literals in hash table. (objc_build_constructor): Do not convert initializer elements; adjust for ObjC++ impedance mismatch. (build_objc_symtab_template): Call create_field_decl() instead of create_builtin_decl(). (init_objc_symtab): Add missing conversion to initializer element. (build_metadata_decl): Call start_var_decl() instead of define_decl(). (generate_objc_symtab_decl): Do not call build_category_template(); call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(). (build_module_descriptor): Call create_field_decl() instead of grokfield(); call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(); always mark module descriptor as used; move GNU runtime-specific functionality to build_module_initializer_routine(). (build_module_initializer_routine): New function, broken off of build_module_descriptor(). (objc_static_init_needed_p, objc_generate_static_init_call): New functions. (generate_static_references, generate_strings, build_selector_translation_table, generate_descriptor_table, generate_ivars_list, generate_dispatch_table, generate_category): Call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(); build a type directly instead of via groktypename(). (build_selector_reference_decl, build_selector_table_decl, build_class_reference_decl, build_protocol_reference, generate_objc_image_info): Call start_var_decl() instead of build_decl(). (build_selector_reference): For GNU runtime, do not call build_selector_reference_decl(). (build_selector, build_typed_selector_reference): Always convert result to the selector type. (add_objc_string): Cast return value to 'char *'. (build_method_prototype_template, build_selector_template, build_method_template): Use actual selector type for fields pointing to selectors. (finish_objc): For GNU runtime, call build_module_initializer_routine() after build_module_descriptor(). (generate_protocol_list, generate_shared_structures): Call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(); build a type directly instead of via groktypename(). (synth_id_with_class_suffix): Return a string. (get_arg_type_list): For instance methods, use the instance type for 'self'; do not call groktypename_in_parm_context(). (build_objc_string_decl): Squash redeclaration errors in ObjC++. (objc_is_class_name): Use OBJC_TYPE_NAME instead of TYPE_NAME; handle RECORD_TYPEs in ObjC as well as ObjC++. (objc_is_id): New function. (objc_is_object_ptr): Return the canonical type node. (objc_get_class_ivars): Simplify using get_class_ivars(). (get_class_ivars): Remove second parameter; create a fresh copy of the ivar list for each call; do not check for existence of super class. (objc_eh_runtime_type): Mark #ifndef OBJCPLUS. (objc_init_exceptions): When using SJLJ-style exceptions, require the use of '-fobjc-exceptions' flag; do not require it for DWARF-style exceptions. (objc_build_exc_ptr, next_sjlj_build_try_catch_finally): Use objc_object_type instead of objc_id_type. (objc_begin_catch_clause): Convert the incoming PARM_DECL into a VAR_DECL before placing it in the appropriate scope; do not call define_decl(); adjust call to c_begin_compound_stmt(); use objc_object_type instead of objc_id_type. (build_next_objc_exception_stuff): Call create_field_decl() instead of create_builtin_decl(); construct type directly instead of calling groktypename(); use OBJC_VOID_AT_END to mark end of function parameters. (build_private_template): Adjust call to get_class_ivars(); build a type directly instead of via groktypename(). (build_protocol_template, build_method_prototype_list_template, build_method_prototype_template, build_category_template, build_selector_template, build_class_template, build_super_template, build_ivar_template, build_ivar_list_template, build_method_list_template, build_method_template): Call create_field_decl() instead of grokfield(). (objc_method_parm_type): Do not call groktypename(). (generate_descriptor_table): Call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(). (generate_method_descriptors, build_protocol_initializer, generate_dispatch_tables, build_category_initializer, build_shared_structure_initializer): Do not call groktypename(). (generate_protocols): Call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(); do not call groktypename(). (error_with_ivar): Remove last parameter. (check_ivars): Do not iterate ovar CLASS_RAW_IVARS lists in addition to CLASS_IVARS lists; adjust calls to error_with_ivar(). (generate_ivar_lists): Convert one of the initializer elements; do not call groktypename(). (get_arg_type_list, start_method_def, gen_method_def): Account for new representation of variable arguments and '...' in Objective-C methods; add Objective-C++ impedance matching code. (is_objc_type_qualifier): Remove function. (adjust_type_for_id_default): Simplify; there is no longer a need to wade through declspecs. (lookup_interface, start_class, continue_class, finish_class, start_method_def, start_protocol, build_method_decl, objc_add_method, add_instance_variable, build_ivar_reference, is_ivar, is_private, get_super_receiver, objc_build_finally_epilogue): Make into static functions. (receiver_is_class_object): Use new IS_CLASS() macro. (objc_build_message_expr): Tweak ObjC++ message argument handling; call objc_finish_message_expr() instead of finish_message_expr(). (finish_message_expr): Rename to objc_finish_message_expr(); use OBJC_TYPE_NAME and OBJC_SET_TYPE_NAME macros instead of TYPE_NAME. call gen_type_name() instead of gen_declaration(); call objc_is_id() instead of using IS_ID and IS_CLASS; Use objc_class_name instead of calling get_identifier("Class"); handle CONVERT_EXPRs in receiver. (build_objc_method_call, warn_with_method): Do not call groktypename(). (build_ivar_reference): Call convert() instead of clobbering in a type. (hash_init): Initialize string_htab hash table. (add_instance_variable): Simplify parameter list; do not call grokfield(); do not populate CLASS_IVARS list. (start_class): Check for the existence of super class, if one was specified. (continue_class): Use CLASS_RAW_IVARS rather than CLASS_IVARS; do not call build_class_template(); adjust call to get_class_ivars(); call build_decl(), pushdecl() and finish_decl() instead of define_decl(). (finish_class): Call build_decl(), pushdecl() and finish_decl() instead of define_decl(). (add_protocols): Use PROTOCOL_BINFO_ELTS for the tree vector size. (start_protocol): Do not call build_protocol_template(); use PROTOCOL_BINFO_ELTS for the tree vector size. (encode_type_qualifiers): Do not handle the 'const' qualifier here. (encode_pointer): Encode 'const char *' as 'r*', for backwards compatibility. (encode_array): Use HOST_WIDE_INT_PRINT_DEC instead of "%ld". (encode_type): Handle the 'const' qualifier here. (objc_parmlist): New global variable, sued by objc_push_parm and objc_get_parm_info(). (objc_push_parm, objc_get_parm_info): New functions. (objc_expr_last): Remove function. (synth_self_and_ucmd_args): For instance methods, use the instance type for 'self'; call objc_push_parm() instead of push_parm_decl(). (start_method_def): Do not call push_scope(), declare_parm_level(), pop_scope(), push_parm_decl(), store_parm_decls() or objc_expr_last(); just use objc_push_parm() and objc_get_parm_info(). (comp_method_with_proto): Remove function. (objc_types_are_equivalent): Strip away indirections before comparing underlying types. (comp_proto_with_proto): Do not call groktypename(); types are no longer in raw declspec format. (objc_start_function): New function. (really_start_method): Call comp_proto_with_proto() instead of comp_method_with_proto(); call objc_start_function() instead of hand-crafting a function declarator. (continue_method_def, objc_expand_function_end): Remove functions. (get_super_receiver): Call objc_get_current_scope() instead of get_current_scope(); reference 'super_class' field (instead of 'class'). (finish_method_def): Rename to objc_finish_method_definition() and add a function decl parameter; move method encoding call from objc_expand_function_end(). (is_complex_decl, adorn_decl, gen_declarator, gen_declspecs, gen_declaration_1): Remove functions. (tmpbuf, RAW_DECLSPEC): Remove. (gen_declaration): Remove second parameter; simplify to deal with TYPE_P nodes instead of raw declspecs. (gen_type_name, gen_type_name_0): New functions. (gen_method_decl): Remove second parameter; call gen_type_name() instead of gen_declaration_1(). (dump_interface): Adjust calls to gen_declaration() and gen_method_decl(); do not allocate a separate string buffer. (init_objc): Allocate a larger string buffer to accommodate dump_interface(); adjust call to build_module_descriptor(); add call to build_module_initializer_routine() for the GNU runtime. (generate_classref_translation_entry): Do not call start_decl(); call finish_var_decl() instead of finish_decl(); call convert() instead of build_c_cast(). * objc-act.h (CLASS_OWN_IVARS): Remove accessor. (CLASS_BINFO_ELTS): Reduce from 6 to 5, now that CLASS_OWN_IVARS is gone. (OCTI_GNU_INIT_DECL, GNU_INIT_decl): New. (OCTI_ELLIPSIS_NODE, objc_ellipsis_node): Remove. (OCTI_ID_ID, id_type, objc_id_id): Rename to OCTI_ID_NAME, objc_object_type and objc_object_name, respectively. (OCTI_CLS_REF, OCTI_CLASS_NAME, objc_class_reference, objc_class_name): New. (IS_CLASS): New macro. (IS_ID, IS_SUPER): Robustify. (OCTI_EXECCLASS_DECL, execclass_decl): New. (finish_file, start_class, continue_class, finish_class, start_method_def, continue_method_def, finish_method_def, start_protocol, finish_protocol, objc_build_throw_stmt, objc_build_try_catch_finally_stmt, objc_build_synchronized_prologue, objc_build_synchronized_epilogue, objc_build_try_prologue, objc_build_try_epilogue, objc_build_catch_stmt, objc_build_catch_epilogue, objc_build_finally_prologue, objc_build_finally_epilogue, is_ivar, is_private, is_public, add_instance_variable, objc_add_method, get_super_receiver, objc_clear_super_receiver, get_class_ivars_from_name, get_class_reference, get_static_reference, get_object_reference, build_message_expr, finish_message_expr, build_selector_expr, build_ivar_reference, build_keyword_decl, build_method_decl, build_protocol_expr, build_objc_string_object, objc_declare_alias, objc_declare_class, objc_declare_protocols, objc_comptypes, objc_check_decl, build_encode_expr): Remove prototypes. (imp_count, cat_count): Make GGC-aware. (OBJC_SET_TYPE_NAME): New macro. From-SVN: r87168
2004-09-08 02:49:44 +02:00
if ((code == CLASS_INTERFACE_TYPE || code == CLASS_IMPLEMENTATION_TYPE)
Yet more Objective-C++... * objc-act.c (objc_finish_try_stmt): Add return value. (objc_build_synchronized): Likewise. * objc-act.c (objc_is_gcable_type): Add. (objc_substitute_decl): Add. (objc_build_ivar_assignment): Add. (objc_build_global_assignment): Add. (objc_build_strong_cast_assignment): Add. (objc_is_ivar_reference_p): Add. (objc_is_global_reference_p): Add. (objc_generate_write_barrier): Add. (objc_rewrite_function_call): Add. (objc_gimplify_expr): Add Objective-C++ support. * objc-act.h (ALLOC_OBJC_TYPE_LANG_SPECIFIC): Likewise. (SIZEOF_OBJC_TYPE_LANG_SPECIFIC): Add. (INIT_TYPE_OBJC_INFO): Add Objective-C++ support. (DUP_TYPE_OBJC_INFO): Likewise. (struct imp_entry): Add field has_cxx_cdtors. (struct imp_entry *imp_list): Add OCTI_UMSG_FAST_DECL, OCTI_METH_LIST_TEMPL, OCTI_METH_PROTO_LIST_TEMPL, OCTI_IVAR_LIST_TEMPL, OCTI_ASSIGN_IVAR_DECL, OCTI_ASSIGN_IVAR_FAST_DECL, OCTI_ASSIGN_GLOBAL_DECL, OCTI_ASSIGN_STRONGCAST_DECL. (umsg_fast_decl): Add. (objc_assign_ivar_decl): Add. (objc_assign_ivar_fast_decl): Add. (objc_assign_global_decl): Add. (objc_assign_strong_cast_decl): Add. (objc_method_list_ptr): Add. (objc_method_proto_list_ptr): Add. (objc_ivar_list_ptr): Add. * objc-act.c (should_call_super_dealloc): Add. (OBJC_VERSION): Bump to 6. (objc_is_gcable_type): Add. (objc_substitute_decl): Add. (objc_build_ivar_assignment): Add. (objc_build_global_assignment): Add. (objc_build_strong_cast_assignment): Add. (objc_is_gcable_p): Add. (objc_is_ivar_reference_p): Add. (objc_is_global_reference_p): Add. (generate_shared_structures): Add flags parameter. (objc_generate_cxx_ctor_or_dtor): Add. (objc_generate_cxx_cdtors): Add. (add_class): Add name parameter. (objc_types_share_size_and_alignment): Add. (comp_proto_with_proto): Add strict parameter. (CLS_HAS_CXX_STRUCTORS): Add. (TAG_ASSIGNIVAR): Add. (TAG_ASSIGNGLOBAL): Add. (TAG_ASSIGNSTRONGCAST): Add. (TAG_MSGSEND_FAST): Add. (TAG_ASSIGNIVAR_FAST): Add. (TAG_CXX_CONSTRUCT): Add. (TAG_CXX_DESTRUCT): Add. (OBJC_LOOKUP_CLASS): Add. (OBJC_LOOKUP_NO_SUPER): Add. (objc_finish_file): Add pch support. (objc_finish_implementation): Add Objective-C++ support. (synth_module_prologue): Likewise. (synth_module_prologue): Add fast dispatching. (objc_get_class_reference): Add Objective-C++ support. (objc_generate_write_barrier): Likewise. (next_sjlj_build_enter_and_setjmp): Likewise. (objc_begin_try_stmt): Likewise. (build_next_objc_exception_stuff): Add fast ivar support. (build_private_template): Mark the record as used so debug information is generated. (build_protocol_template): Add Objective-C++ support. (objc_method_parm_type) Likewise. (objc_generate_cxx_ctor_or_dtor): Likewise. (objc_generate_cxx_cdtors): Likewise. (build_protocol_initializer): Likewise. (build_category_template): Likewise. (build_class_template): Likewise. (build_method_list_template): Likewise. (build_category_initializer): Likewise. (build_shared_structure_initializer): Likewise. (objc_finish_message_expr): Likewise. (build_objc_method_call): Add fast dispatch support. (lookup_method_static): Add support to end search at superclasses. (add_method_to_hash_list): Add strict parameter to comp_proto_with_proto. (objc_add_method): Likewise. (objc_add_method): Also set the interface_value. (add_instance_variable): Add Objective-C++ support. (objc_is_public): Likewise. (start_class): Likewise. (continue_class): Likewise. (encode_aggregate_within): Likewise. (start_method_def): Likewise. (objc_start_function): Clear current_function_returns_value and current_function_returns_null. (really_start_method): Add Objective-C++ support. (objc_finish_method_definition): Add warning for missing [super dealloc]. (finish_objc): Add Objective-C++ support. (generate_objc_image_info): Likewise. (objc_lookup_ivar): Likewise. * objc-act.h (TYPE_HAS_OBJC_INFO): Likewise. (INIT_TYPE_OBJC_INFO): Likewise. (DUP_TYPE_OBJC_INFO): Likewise. From-SVN: r99857
2005-05-17 22:07:08 +02:00
&& super_name)
Makefile.in (c-parse.o): Depend on $(C_COMMON_H). [gcc/ChangeLog] 2004-09-07 Ziemowit Laski <zlaski@apple.com> * Makefile.in (c-parse.o): Depend on $(C_COMMON_H). * c-parse.in: Include c-common.h instead of objc-act.h. (ivar_decl_list, ivar_decls, ivar_decl, ivars, ivar_declarator, myparms, myparm): Remove %type declarations. (methodtype, optparms, OBJC_TYPE_QUAL, objc_quals, objc_qual, objc_typename, objc_try_catch_stmt, optellipsis): Add %type declarations. (objc_inherit_code, objc_public_flag): Remove. (typespec_nonreserved_nonattr): Call objc_get_protocol_qualified_type() instead of get_static_reference() and get_protocol_reference(). (stmt_nocomp): Call grokparm() on @catch parameter. (objcdef): Move semantic action to objc_finish_implementation(). (classdef): Move semantic action to objc_start_class_interface(), objc_continue_interface(), objc_finish_interface(), objc_start_class_implementation(), objc_continue_implementation(), objc_start_category_interface() and objc_start_category_implementation(). (protocoldef): Move semantic actions to objc_start_protocol() and objc_finish_interface(). (ivar_decl_list): Remove nonterminal. (visibility_spec): Move semantic actions to objc_set_visibility(). (ivar_decls): Remove assignment to $$. (ivar_decl): Rephrase in terms of component_decl; call objc_add_instance_variable(). (ivars, ivar_declarator): Remove nonterminals. (opt_semi): New nonterminal. (methodtype): Remove semantic actions. (methoddef): Move semantic actions to objc_set_method_type(), objc_start_method_definition() and objc_finish_method_definition(). (methodproto): Move semantic actions to objc_set_method_type() and objc_add_method_declaration(). (methoddecl): Use objc_typename instead of typename; move semantic actions to objc_build_method_signature(). (optarglist, myxdecls, mydecl, myparms, myparm): Remove nonterminals. (optparmlist): Express in terms of optparms and optellipsis. (optparms, optellipsis, objc_qual, objc_quals, objc_typename): New nonterminals. (keyworddecl): Use objc_typename instead of typename. (rid_to_yy): Mark RID_IN, RID_OUT, RID_INOUT, RID_BYCOPY, RID_BYREF and RID_ONEWAY as returning OBJC_TYPE_QUAL to yyparse(). [gcc/objc/ChangeLog] 2004-09-07 Ziemowit Laski <zlaski@apple.com> * Make-lang.in (objc/objc-parse.o): Depend on $(C_COMMON_H) instead of objc/objc-act.h. (objc/objc-act.o): Depend on $(HASHTAB_H). * objc-act.c: Include hashtab.h; in ObjC++ mode, include cp-tree.h and objcp-decl.h instead of c-tree.h. (build_module_descriptor, get_class_ivars, synth_id_with_class_suffix, error_with_ivar, gen_method_decl, gen_declaration, setup_string_decl, build_protocol_template): Adjust prototypes. (build_module_initializer_routine, start_class, continue_class, finish_class, start_method_def, objc_start_function, start_protocol, build_method_decl, objc_add_method, add_instance_variable, build_ivar_reference, is_ivar, is_private, get_super_receiver, build_selector_table_decl, objc_push_parm, objc_get_parm_info, gen_type_name, gen_type_name_0, start_var_decl, finish_var_decl, create_field_decl): New prototypes. (objc_expand_function_end, comp_method_with_proto, objc_expr_last, gen_declaration_1, gen_declarator, is_complex_decl, adorn_decl, define_decl, create_builtin_decl, gen_declspecs): Remove prototypes. (TYPE_ID): Rename to OBJECT_TYPEDEF_NAME. (CLASS_TYPEDEF_NAME): New. (TAG_EXECCLASS): Change from a global variable to a #define. (TAG_RETURN_STRUCT): Delete. (TAG_GNUINIT): New, holds '__objc_gnu_init' name. (objc_inherit_code, objc_public_flag): New, moved from c-parse.in. (string_descriptor): New struct. (string_htab): New hash table. (string_hash, string_eq): New prototypes. (generate_struct_by_value_array): Call create_field_decl() instead of create_builtin_decl(). (objc_init): Do not initialize objc_ellipsis_node or TAG_EXECCLASS; In ObjC++ mode, call cxx_init() instead of c_objc_common_init(). (objc_finish_file): In ObjC++, call instantiate_pending_templates() and cp_finish_file(). (define_decl, get_static_reference, get_protocol_reference, create_builtin_decl): Remove functions. (objc_start_class_interface, objc_start_category_interface, objc_start_protocol, objc_continue_interface, objc_finish_interface, objc_start_class_implementation, objc_start_category_implementation, objc_continue_implementation, objc_finish_implementation, objc_set_visibility, objc_set_method_type, objc_build_method_signature, objc_add_method_declaration, objc_start_method_definition, objc_add_instance_variable, objc_get_protocol_qualified_type, create_field_decl, start_var_decl, finish_var_decl): New functions. (setup_string_decl): Simplify since it is only called once. (synth_module_prologue): Call build_class_template(); predefine 'id' and 'Class' as typedefs; rename 'temp_type' to 'type'; disable debug hooks for duration of function; fix GNU runtime messenger signatures to correspond to reality; forward-declare '__objc_exec_class' for the GNU runtime; call build_selector_table_decl(); in ObjC++ mode, generate 'extern "C" { ... }' wrappers around synthesized declarations; call build_protocol_template() and build_category_template(). (string_hash, string_eq): New functions. (objc_build_string_object): Check metaclass correctness only once; store string literals in hash table. (objc_build_constructor): Do not convert initializer elements; adjust for ObjC++ impedance mismatch. (build_objc_symtab_template): Call create_field_decl() instead of create_builtin_decl(). (init_objc_symtab): Add missing conversion to initializer element. (build_metadata_decl): Call start_var_decl() instead of define_decl(). (generate_objc_symtab_decl): Do not call build_category_template(); call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(). (build_module_descriptor): Call create_field_decl() instead of grokfield(); call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(); always mark module descriptor as used; move GNU runtime-specific functionality to build_module_initializer_routine(). (build_module_initializer_routine): New function, broken off of build_module_descriptor(). (objc_static_init_needed_p, objc_generate_static_init_call): New functions. (generate_static_references, generate_strings, build_selector_translation_table, generate_descriptor_table, generate_ivars_list, generate_dispatch_table, generate_category): Call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(); build a type directly instead of via groktypename(). (build_selector_reference_decl, build_selector_table_decl, build_class_reference_decl, build_protocol_reference, generate_objc_image_info): Call start_var_decl() instead of build_decl(). (build_selector_reference): For GNU runtime, do not call build_selector_reference_decl(). (build_selector, build_typed_selector_reference): Always convert result to the selector type. (add_objc_string): Cast return value to 'char *'. (build_method_prototype_template, build_selector_template, build_method_template): Use actual selector type for fields pointing to selectors. (finish_objc): For GNU runtime, call build_module_initializer_routine() after build_module_descriptor(). (generate_protocol_list, generate_shared_structures): Call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(); build a type directly instead of via groktypename(). (synth_id_with_class_suffix): Return a string. (get_arg_type_list): For instance methods, use the instance type for 'self'; do not call groktypename_in_parm_context(). (build_objc_string_decl): Squash redeclaration errors in ObjC++. (objc_is_class_name): Use OBJC_TYPE_NAME instead of TYPE_NAME; handle RECORD_TYPEs in ObjC as well as ObjC++. (objc_is_id): New function. (objc_is_object_ptr): Return the canonical type node. (objc_get_class_ivars): Simplify using get_class_ivars(). (get_class_ivars): Remove second parameter; create a fresh copy of the ivar list for each call; do not check for existence of super class. (objc_eh_runtime_type): Mark #ifndef OBJCPLUS. (objc_init_exceptions): When using SJLJ-style exceptions, require the use of '-fobjc-exceptions' flag; do not require it for DWARF-style exceptions. (objc_build_exc_ptr, next_sjlj_build_try_catch_finally): Use objc_object_type instead of objc_id_type. (objc_begin_catch_clause): Convert the incoming PARM_DECL into a VAR_DECL before placing it in the appropriate scope; do not call define_decl(); adjust call to c_begin_compound_stmt(); use objc_object_type instead of objc_id_type. (build_next_objc_exception_stuff): Call create_field_decl() instead of create_builtin_decl(); construct type directly instead of calling groktypename(); use OBJC_VOID_AT_END to mark end of function parameters. (build_private_template): Adjust call to get_class_ivars(); build a type directly instead of via groktypename(). (build_protocol_template, build_method_prototype_list_template, build_method_prototype_template, build_category_template, build_selector_template, build_class_template, build_super_template, build_ivar_template, build_ivar_list_template, build_method_list_template, build_method_template): Call create_field_decl() instead of grokfield(). (objc_method_parm_type): Do not call groktypename(). (generate_descriptor_table): Call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(). (generate_method_descriptors, build_protocol_initializer, generate_dispatch_tables, build_category_initializer, build_shared_structure_initializer): Do not call groktypename(). (generate_protocols): Call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(); do not call groktypename(). (error_with_ivar): Remove last parameter. (check_ivars): Do not iterate ovar CLASS_RAW_IVARS lists in addition to CLASS_IVARS lists; adjust calls to error_with_ivar(). (generate_ivar_lists): Convert one of the initializer elements; do not call groktypename(). (get_arg_type_list, start_method_def, gen_method_def): Account for new representation of variable arguments and '...' in Objective-C methods; add Objective-C++ impedance matching code. (is_objc_type_qualifier): Remove function. (adjust_type_for_id_default): Simplify; there is no longer a need to wade through declspecs. (lookup_interface, start_class, continue_class, finish_class, start_method_def, start_protocol, build_method_decl, objc_add_method, add_instance_variable, build_ivar_reference, is_ivar, is_private, get_super_receiver, objc_build_finally_epilogue): Make into static functions. (receiver_is_class_object): Use new IS_CLASS() macro. (objc_build_message_expr): Tweak ObjC++ message argument handling; call objc_finish_message_expr() instead of finish_message_expr(). (finish_message_expr): Rename to objc_finish_message_expr(); use OBJC_TYPE_NAME and OBJC_SET_TYPE_NAME macros instead of TYPE_NAME. call gen_type_name() instead of gen_declaration(); call objc_is_id() instead of using IS_ID and IS_CLASS; Use objc_class_name instead of calling get_identifier("Class"); handle CONVERT_EXPRs in receiver. (build_objc_method_call, warn_with_method): Do not call groktypename(). (build_ivar_reference): Call convert() instead of clobbering in a type. (hash_init): Initialize string_htab hash table. (add_instance_variable): Simplify parameter list; do not call grokfield(); do not populate CLASS_IVARS list. (start_class): Check for the existence of super class, if one was specified. (continue_class): Use CLASS_RAW_IVARS rather than CLASS_IVARS; do not call build_class_template(); adjust call to get_class_ivars(); call build_decl(), pushdecl() and finish_decl() instead of define_decl(). (finish_class): Call build_decl(), pushdecl() and finish_decl() instead of define_decl(). (add_protocols): Use PROTOCOL_BINFO_ELTS for the tree vector size. (start_protocol): Do not call build_protocol_template(); use PROTOCOL_BINFO_ELTS for the tree vector size. (encode_type_qualifiers): Do not handle the 'const' qualifier here. (encode_pointer): Encode 'const char *' as 'r*', for backwards compatibility. (encode_array): Use HOST_WIDE_INT_PRINT_DEC instead of "%ld". (encode_type): Handle the 'const' qualifier here. (objc_parmlist): New global variable, sued by objc_push_parm and objc_get_parm_info(). (objc_push_parm, objc_get_parm_info): New functions. (objc_expr_last): Remove function. (synth_self_and_ucmd_args): For instance methods, use the instance type for 'self'; call objc_push_parm() instead of push_parm_decl(). (start_method_def): Do not call push_scope(), declare_parm_level(), pop_scope(), push_parm_decl(), store_parm_decls() or objc_expr_last(); just use objc_push_parm() and objc_get_parm_info(). (comp_method_with_proto): Remove function. (objc_types_are_equivalent): Strip away indirections before comparing underlying types. (comp_proto_with_proto): Do not call groktypename(); types are no longer in raw declspec format. (objc_start_function): New function. (really_start_method): Call comp_proto_with_proto() instead of comp_method_with_proto(); call objc_start_function() instead of hand-crafting a function declarator. (continue_method_def, objc_expand_function_end): Remove functions. (get_super_receiver): Call objc_get_current_scope() instead of get_current_scope(); reference 'super_class' field (instead of 'class'). (finish_method_def): Rename to objc_finish_method_definition() and add a function decl parameter; move method encoding call from objc_expand_function_end(). (is_complex_decl, adorn_decl, gen_declarator, gen_declspecs, gen_declaration_1): Remove functions. (tmpbuf, RAW_DECLSPEC): Remove. (gen_declaration): Remove second parameter; simplify to deal with TYPE_P nodes instead of raw declspecs. (gen_type_name, gen_type_name_0): New functions. (gen_method_decl): Remove second parameter; call gen_type_name() instead of gen_declaration_1(). (dump_interface): Adjust calls to gen_declaration() and gen_method_decl(); do not allocate a separate string buffer. (init_objc): Allocate a larger string buffer to accommodate dump_interface(); adjust call to build_module_descriptor(); add call to build_module_initializer_routine() for the GNU runtime. (generate_classref_translation_entry): Do not call start_decl(); call finish_var_decl() instead of finish_decl(); call convert() instead of build_c_cast(). * objc-act.h (CLASS_OWN_IVARS): Remove accessor. (CLASS_BINFO_ELTS): Reduce from 6 to 5, now that CLASS_OWN_IVARS is gone. (OCTI_GNU_INIT_DECL, GNU_INIT_decl): New. (OCTI_ELLIPSIS_NODE, objc_ellipsis_node): Remove. (OCTI_ID_ID, id_type, objc_id_id): Rename to OCTI_ID_NAME, objc_object_type and objc_object_name, respectively. (OCTI_CLS_REF, OCTI_CLASS_NAME, objc_class_reference, objc_class_name): New. (IS_CLASS): New macro. (IS_ID, IS_SUPER): Robustify. (OCTI_EXECCLASS_DECL, execclass_decl): New. (finish_file, start_class, continue_class, finish_class, start_method_def, continue_method_def, finish_method_def, start_protocol, finish_protocol, objc_build_throw_stmt, objc_build_try_catch_finally_stmt, objc_build_synchronized_prologue, objc_build_synchronized_epilogue, objc_build_try_prologue, objc_build_try_epilogue, objc_build_catch_stmt, objc_build_catch_epilogue, objc_build_finally_prologue, objc_build_finally_epilogue, is_ivar, is_private, is_public, add_instance_variable, objc_add_method, get_super_receiver, objc_clear_super_receiver, get_class_ivars_from_name, get_class_reference, get_static_reference, get_object_reference, build_message_expr, finish_message_expr, build_selector_expr, build_ivar_reference, build_keyword_decl, build_method_decl, build_protocol_expr, build_objc_string_object, objc_declare_alias, objc_declare_class, objc_declare_protocols, objc_comptypes, objc_check_decl, build_encode_expr): Remove prototypes. (imp_count, cat_count): Make GGC-aware. (OBJC_SET_TYPE_NAME): New macro. From-SVN: r87168
2004-09-08 02:49:44 +02:00
{
Yet more Objective-C++... * objc-act.c (objc_finish_try_stmt): Add return value. (objc_build_synchronized): Likewise. * objc-act.c (objc_is_gcable_type): Add. (objc_substitute_decl): Add. (objc_build_ivar_assignment): Add. (objc_build_global_assignment): Add. (objc_build_strong_cast_assignment): Add. (objc_is_ivar_reference_p): Add. (objc_is_global_reference_p): Add. (objc_generate_write_barrier): Add. (objc_rewrite_function_call): Add. (objc_gimplify_expr): Add Objective-C++ support. * objc-act.h (ALLOC_OBJC_TYPE_LANG_SPECIFIC): Likewise. (SIZEOF_OBJC_TYPE_LANG_SPECIFIC): Add. (INIT_TYPE_OBJC_INFO): Add Objective-C++ support. (DUP_TYPE_OBJC_INFO): Likewise. (struct imp_entry): Add field has_cxx_cdtors. (struct imp_entry *imp_list): Add OCTI_UMSG_FAST_DECL, OCTI_METH_LIST_TEMPL, OCTI_METH_PROTO_LIST_TEMPL, OCTI_IVAR_LIST_TEMPL, OCTI_ASSIGN_IVAR_DECL, OCTI_ASSIGN_IVAR_FAST_DECL, OCTI_ASSIGN_GLOBAL_DECL, OCTI_ASSIGN_STRONGCAST_DECL. (umsg_fast_decl): Add. (objc_assign_ivar_decl): Add. (objc_assign_ivar_fast_decl): Add. (objc_assign_global_decl): Add. (objc_assign_strong_cast_decl): Add. (objc_method_list_ptr): Add. (objc_method_proto_list_ptr): Add. (objc_ivar_list_ptr): Add. * objc-act.c (should_call_super_dealloc): Add. (OBJC_VERSION): Bump to 6. (objc_is_gcable_type): Add. (objc_substitute_decl): Add. (objc_build_ivar_assignment): Add. (objc_build_global_assignment): Add. (objc_build_strong_cast_assignment): Add. (objc_is_gcable_p): Add. (objc_is_ivar_reference_p): Add. (objc_is_global_reference_p): Add. (generate_shared_structures): Add flags parameter. (objc_generate_cxx_ctor_or_dtor): Add. (objc_generate_cxx_cdtors): Add. (add_class): Add name parameter. (objc_types_share_size_and_alignment): Add. (comp_proto_with_proto): Add strict parameter. (CLS_HAS_CXX_STRUCTORS): Add. (TAG_ASSIGNIVAR): Add. (TAG_ASSIGNGLOBAL): Add. (TAG_ASSIGNSTRONGCAST): Add. (TAG_MSGSEND_FAST): Add. (TAG_ASSIGNIVAR_FAST): Add. (TAG_CXX_CONSTRUCT): Add. (TAG_CXX_DESTRUCT): Add. (OBJC_LOOKUP_CLASS): Add. (OBJC_LOOKUP_NO_SUPER): Add. (objc_finish_file): Add pch support. (objc_finish_implementation): Add Objective-C++ support. (synth_module_prologue): Likewise. (synth_module_prologue): Add fast dispatching. (objc_get_class_reference): Add Objective-C++ support. (objc_generate_write_barrier): Likewise. (next_sjlj_build_enter_and_setjmp): Likewise. (objc_begin_try_stmt): Likewise. (build_next_objc_exception_stuff): Add fast ivar support. (build_private_template): Mark the record as used so debug information is generated. (build_protocol_template): Add Objective-C++ support. (objc_method_parm_type) Likewise. (objc_generate_cxx_ctor_or_dtor): Likewise. (objc_generate_cxx_cdtors): Likewise. (build_protocol_initializer): Likewise. (build_category_template): Likewise. (build_class_template): Likewise. (build_method_list_template): Likewise. (build_category_initializer): Likewise. (build_shared_structure_initializer): Likewise. (objc_finish_message_expr): Likewise. (build_objc_method_call): Add fast dispatch support. (lookup_method_static): Add support to end search at superclasses. (add_method_to_hash_list): Add strict parameter to comp_proto_with_proto. (objc_add_method): Likewise. (objc_add_method): Also set the interface_value. (add_instance_variable): Add Objective-C++ support. (objc_is_public): Likewise. (start_class): Likewise. (continue_class): Likewise. (encode_aggregate_within): Likewise. (start_method_def): Likewise. (objc_start_function): Clear current_function_returns_value and current_function_returns_null. (really_start_method): Add Objective-C++ support. (objc_finish_method_definition): Add warning for missing [super dealloc]. (finish_objc): Add Objective-C++ support. (generate_objc_image_info): Likewise. (objc_lookup_ivar): Likewise. * objc-act.h (TYPE_HAS_OBJC_INFO): Likewise. (INIT_TYPE_OBJC_INFO): Likewise. (DUP_TYPE_OBJC_INFO): Likewise. From-SVN: r99857
2005-05-17 22:07:08 +02:00
tree super = objc_is_class_name (super_name);
if (!super || !lookup_interface (super))
{
error ("cannot find interface declaration for %qs, superclass of %qs",
IDENTIFIER_POINTER (super ? super : super_name),
IDENTIFIER_POINTER (class_name));
super_name = NULL_TREE;
}
else
super_name = super;
Makefile.in (c-parse.o): Depend on $(C_COMMON_H). [gcc/ChangeLog] 2004-09-07 Ziemowit Laski <zlaski@apple.com> * Makefile.in (c-parse.o): Depend on $(C_COMMON_H). * c-parse.in: Include c-common.h instead of objc-act.h. (ivar_decl_list, ivar_decls, ivar_decl, ivars, ivar_declarator, myparms, myparm): Remove %type declarations. (methodtype, optparms, OBJC_TYPE_QUAL, objc_quals, objc_qual, objc_typename, objc_try_catch_stmt, optellipsis): Add %type declarations. (objc_inherit_code, objc_public_flag): Remove. (typespec_nonreserved_nonattr): Call objc_get_protocol_qualified_type() instead of get_static_reference() and get_protocol_reference(). (stmt_nocomp): Call grokparm() on @catch parameter. (objcdef): Move semantic action to objc_finish_implementation(). (classdef): Move semantic action to objc_start_class_interface(), objc_continue_interface(), objc_finish_interface(), objc_start_class_implementation(), objc_continue_implementation(), objc_start_category_interface() and objc_start_category_implementation(). (protocoldef): Move semantic actions to objc_start_protocol() and objc_finish_interface(). (ivar_decl_list): Remove nonterminal. (visibility_spec): Move semantic actions to objc_set_visibility(). (ivar_decls): Remove assignment to $$. (ivar_decl): Rephrase in terms of component_decl; call objc_add_instance_variable(). (ivars, ivar_declarator): Remove nonterminals. (opt_semi): New nonterminal. (methodtype): Remove semantic actions. (methoddef): Move semantic actions to objc_set_method_type(), objc_start_method_definition() and objc_finish_method_definition(). (methodproto): Move semantic actions to objc_set_method_type() and objc_add_method_declaration(). (methoddecl): Use objc_typename instead of typename; move semantic actions to objc_build_method_signature(). (optarglist, myxdecls, mydecl, myparms, myparm): Remove nonterminals. (optparmlist): Express in terms of optparms and optellipsis. (optparms, optellipsis, objc_qual, objc_quals, objc_typename): New nonterminals. (keyworddecl): Use objc_typename instead of typename. (rid_to_yy): Mark RID_IN, RID_OUT, RID_INOUT, RID_BYCOPY, RID_BYREF and RID_ONEWAY as returning OBJC_TYPE_QUAL to yyparse(). [gcc/objc/ChangeLog] 2004-09-07 Ziemowit Laski <zlaski@apple.com> * Make-lang.in (objc/objc-parse.o): Depend on $(C_COMMON_H) instead of objc/objc-act.h. (objc/objc-act.o): Depend on $(HASHTAB_H). * objc-act.c: Include hashtab.h; in ObjC++ mode, include cp-tree.h and objcp-decl.h instead of c-tree.h. (build_module_descriptor, get_class_ivars, synth_id_with_class_suffix, error_with_ivar, gen_method_decl, gen_declaration, setup_string_decl, build_protocol_template): Adjust prototypes. (build_module_initializer_routine, start_class, continue_class, finish_class, start_method_def, objc_start_function, start_protocol, build_method_decl, objc_add_method, add_instance_variable, build_ivar_reference, is_ivar, is_private, get_super_receiver, build_selector_table_decl, objc_push_parm, objc_get_parm_info, gen_type_name, gen_type_name_0, start_var_decl, finish_var_decl, create_field_decl): New prototypes. (objc_expand_function_end, comp_method_with_proto, objc_expr_last, gen_declaration_1, gen_declarator, is_complex_decl, adorn_decl, define_decl, create_builtin_decl, gen_declspecs): Remove prototypes. (TYPE_ID): Rename to OBJECT_TYPEDEF_NAME. (CLASS_TYPEDEF_NAME): New. (TAG_EXECCLASS): Change from a global variable to a #define. (TAG_RETURN_STRUCT): Delete. (TAG_GNUINIT): New, holds '__objc_gnu_init' name. (objc_inherit_code, objc_public_flag): New, moved from c-parse.in. (string_descriptor): New struct. (string_htab): New hash table. (string_hash, string_eq): New prototypes. (generate_struct_by_value_array): Call create_field_decl() instead of create_builtin_decl(). (objc_init): Do not initialize objc_ellipsis_node or TAG_EXECCLASS; In ObjC++ mode, call cxx_init() instead of c_objc_common_init(). (objc_finish_file): In ObjC++, call instantiate_pending_templates() and cp_finish_file(). (define_decl, get_static_reference, get_protocol_reference, create_builtin_decl): Remove functions. (objc_start_class_interface, objc_start_category_interface, objc_start_protocol, objc_continue_interface, objc_finish_interface, objc_start_class_implementation, objc_start_category_implementation, objc_continue_implementation, objc_finish_implementation, objc_set_visibility, objc_set_method_type, objc_build_method_signature, objc_add_method_declaration, objc_start_method_definition, objc_add_instance_variable, objc_get_protocol_qualified_type, create_field_decl, start_var_decl, finish_var_decl): New functions. (setup_string_decl): Simplify since it is only called once. (synth_module_prologue): Call build_class_template(); predefine 'id' and 'Class' as typedefs; rename 'temp_type' to 'type'; disable debug hooks for duration of function; fix GNU runtime messenger signatures to correspond to reality; forward-declare '__objc_exec_class' for the GNU runtime; call build_selector_table_decl(); in ObjC++ mode, generate 'extern "C" { ... }' wrappers around synthesized declarations; call build_protocol_template() and build_category_template(). (string_hash, string_eq): New functions. (objc_build_string_object): Check metaclass correctness only once; store string literals in hash table. (objc_build_constructor): Do not convert initializer elements; adjust for ObjC++ impedance mismatch. (build_objc_symtab_template): Call create_field_decl() instead of create_builtin_decl(). (init_objc_symtab): Add missing conversion to initializer element. (build_metadata_decl): Call start_var_decl() instead of define_decl(). (generate_objc_symtab_decl): Do not call build_category_template(); call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(). (build_module_descriptor): Call create_field_decl() instead of grokfield(); call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(); always mark module descriptor as used; move GNU runtime-specific functionality to build_module_initializer_routine(). (build_module_initializer_routine): New function, broken off of build_module_descriptor(). (objc_static_init_needed_p, objc_generate_static_init_call): New functions. (generate_static_references, generate_strings, build_selector_translation_table, generate_descriptor_table, generate_ivars_list, generate_dispatch_table, generate_category): Call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(); build a type directly instead of via groktypename(). (build_selector_reference_decl, build_selector_table_decl, build_class_reference_decl, build_protocol_reference, generate_objc_image_info): Call start_var_decl() instead of build_decl(). (build_selector_reference): For GNU runtime, do not call build_selector_reference_decl(). (build_selector, build_typed_selector_reference): Always convert result to the selector type. (add_objc_string): Cast return value to 'char *'. (build_method_prototype_template, build_selector_template, build_method_template): Use actual selector type for fields pointing to selectors. (finish_objc): For GNU runtime, call build_module_initializer_routine() after build_module_descriptor(). (generate_protocol_list, generate_shared_structures): Call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(); build a type directly instead of via groktypename(). (synth_id_with_class_suffix): Return a string. (get_arg_type_list): For instance methods, use the instance type for 'self'; do not call groktypename_in_parm_context(). (build_objc_string_decl): Squash redeclaration errors in ObjC++. (objc_is_class_name): Use OBJC_TYPE_NAME instead of TYPE_NAME; handle RECORD_TYPEs in ObjC as well as ObjC++. (objc_is_id): New function. (objc_is_object_ptr): Return the canonical type node. (objc_get_class_ivars): Simplify using get_class_ivars(). (get_class_ivars): Remove second parameter; create a fresh copy of the ivar list for each call; do not check for existence of super class. (objc_eh_runtime_type): Mark #ifndef OBJCPLUS. (objc_init_exceptions): When using SJLJ-style exceptions, require the use of '-fobjc-exceptions' flag; do not require it for DWARF-style exceptions. (objc_build_exc_ptr, next_sjlj_build_try_catch_finally): Use objc_object_type instead of objc_id_type. (objc_begin_catch_clause): Convert the incoming PARM_DECL into a VAR_DECL before placing it in the appropriate scope; do not call define_decl(); adjust call to c_begin_compound_stmt(); use objc_object_type instead of objc_id_type. (build_next_objc_exception_stuff): Call create_field_decl() instead of create_builtin_decl(); construct type directly instead of calling groktypename(); use OBJC_VOID_AT_END to mark end of function parameters. (build_private_template): Adjust call to get_class_ivars(); build a type directly instead of via groktypename(). (build_protocol_template, build_method_prototype_list_template, build_method_prototype_template, build_category_template, build_selector_template, build_class_template, build_super_template, build_ivar_template, build_ivar_list_template, build_method_list_template, build_method_template): Call create_field_decl() instead of grokfield(). (objc_method_parm_type): Do not call groktypename(). (generate_descriptor_table): Call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(). (generate_method_descriptors, build_protocol_initializer, generate_dispatch_tables, build_category_initializer, build_shared_structure_initializer): Do not call groktypename(). (generate_protocols): Call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(); do not call groktypename(). (error_with_ivar): Remove last parameter. (check_ivars): Do not iterate ovar CLASS_RAW_IVARS lists in addition to CLASS_IVARS lists; adjust calls to error_with_ivar(). (generate_ivar_lists): Convert one of the initializer elements; do not call groktypename(). (get_arg_type_list, start_method_def, gen_method_def): Account for new representation of variable arguments and '...' in Objective-C methods; add Objective-C++ impedance matching code. (is_objc_type_qualifier): Remove function. (adjust_type_for_id_default): Simplify; there is no longer a need to wade through declspecs. (lookup_interface, start_class, continue_class, finish_class, start_method_def, start_protocol, build_method_decl, objc_add_method, add_instance_variable, build_ivar_reference, is_ivar, is_private, get_super_receiver, objc_build_finally_epilogue): Make into static functions. (receiver_is_class_object): Use new IS_CLASS() macro. (objc_build_message_expr): Tweak ObjC++ message argument handling; call objc_finish_message_expr() instead of finish_message_expr(). (finish_message_expr): Rename to objc_finish_message_expr(); use OBJC_TYPE_NAME and OBJC_SET_TYPE_NAME macros instead of TYPE_NAME. call gen_type_name() instead of gen_declaration(); call objc_is_id() instead of using IS_ID and IS_CLASS; Use objc_class_name instead of calling get_identifier("Class"); handle CONVERT_EXPRs in receiver. (build_objc_method_call, warn_with_method): Do not call groktypename(). (build_ivar_reference): Call convert() instead of clobbering in a type. (hash_init): Initialize string_htab hash table. (add_instance_variable): Simplify parameter list; do not call grokfield(); do not populate CLASS_IVARS list. (start_class): Check for the existence of super class, if one was specified. (continue_class): Use CLASS_RAW_IVARS rather than CLASS_IVARS; do not call build_class_template(); adjust call to get_class_ivars(); call build_decl(), pushdecl() and finish_decl() instead of define_decl(). (finish_class): Call build_decl(), pushdecl() and finish_decl() instead of define_decl(). (add_protocols): Use PROTOCOL_BINFO_ELTS for the tree vector size. (start_protocol): Do not call build_protocol_template(); use PROTOCOL_BINFO_ELTS for the tree vector size. (encode_type_qualifiers): Do not handle the 'const' qualifier here. (encode_pointer): Encode 'const char *' as 'r*', for backwards compatibility. (encode_array): Use HOST_WIDE_INT_PRINT_DEC instead of "%ld". (encode_type): Handle the 'const' qualifier here. (objc_parmlist): New global variable, sued by objc_push_parm and objc_get_parm_info(). (objc_push_parm, objc_get_parm_info): New functions. (objc_expr_last): Remove function. (synth_self_and_ucmd_args): For instance methods, use the instance type for 'self'; call objc_push_parm() instead of push_parm_decl(). (start_method_def): Do not call push_scope(), declare_parm_level(), pop_scope(), push_parm_decl(), store_parm_decls() or objc_expr_last(); just use objc_push_parm() and objc_get_parm_info(). (comp_method_with_proto): Remove function. (objc_types_are_equivalent): Strip away indirections before comparing underlying types. (comp_proto_with_proto): Do not call groktypename(); types are no longer in raw declspec format. (objc_start_function): New function. (really_start_method): Call comp_proto_with_proto() instead of comp_method_with_proto(); call objc_start_function() instead of hand-crafting a function declarator. (continue_method_def, objc_expand_function_end): Remove functions. (get_super_receiver): Call objc_get_current_scope() instead of get_current_scope(); reference 'super_class' field (instead of 'class'). (finish_method_def): Rename to objc_finish_method_definition() and add a function decl parameter; move method encoding call from objc_expand_function_end(). (is_complex_decl, adorn_decl, gen_declarator, gen_declspecs, gen_declaration_1): Remove functions. (tmpbuf, RAW_DECLSPEC): Remove. (gen_declaration): Remove second parameter; simplify to deal with TYPE_P nodes instead of raw declspecs. (gen_type_name, gen_type_name_0): New functions. (gen_method_decl): Remove second parameter; call gen_type_name() instead of gen_declaration_1(). (dump_interface): Adjust calls to gen_declaration() and gen_method_decl(); do not allocate a separate string buffer. (init_objc): Allocate a larger string buffer to accommodate dump_interface(); adjust call to build_module_descriptor(); add call to build_module_initializer_routine() for the GNU runtime. (generate_classref_translation_entry): Do not call start_decl(); call finish_var_decl() instead of finish_decl(); call convert() instead of build_c_cast(). * objc-act.h (CLASS_OWN_IVARS): Remove accessor. (CLASS_BINFO_ELTS): Reduce from 6 to 5, now that CLASS_OWN_IVARS is gone. (OCTI_GNU_INIT_DECL, GNU_INIT_decl): New. (OCTI_ELLIPSIS_NODE, objc_ellipsis_node): Remove. (OCTI_ID_ID, id_type, objc_id_id): Rename to OCTI_ID_NAME, objc_object_type and objc_object_name, respectively. (OCTI_CLS_REF, OCTI_CLASS_NAME, objc_class_reference, objc_class_name): New. (IS_CLASS): New macro. (IS_ID, IS_SUPER): Robustify. (OCTI_EXECCLASS_DECL, execclass_decl): New. (finish_file, start_class, continue_class, finish_class, start_method_def, continue_method_def, finish_method_def, start_protocol, finish_protocol, objc_build_throw_stmt, objc_build_try_catch_finally_stmt, objc_build_synchronized_prologue, objc_build_synchronized_epilogue, objc_build_try_prologue, objc_build_try_epilogue, objc_build_catch_stmt, objc_build_catch_epilogue, objc_build_finally_prologue, objc_build_finally_epilogue, is_ivar, is_private, is_public, add_instance_variable, objc_add_method, get_super_receiver, objc_clear_super_receiver, get_class_ivars_from_name, get_class_reference, get_static_reference, get_object_reference, build_message_expr, finish_message_expr, build_selector_expr, build_ivar_reference, build_keyword_decl, build_method_decl, build_protocol_expr, build_objc_string_object, objc_declare_alias, objc_declare_class, objc_declare_protocols, objc_comptypes, objc_check_decl, build_encode_expr): Remove prototypes. (imp_count, cat_count): Make GGC-aware. (OBJC_SET_TYPE_NAME): New macro. From-SVN: r87168
2004-09-08 02:49:44 +02:00
}
1992-01-18 00:15:38 +01:00
CLASS_NAME (class) = class_name;
CLASS_SUPER_NAME (class) = super_name;
CLASS_CLS_METHODS (class) = NULL_TREE;
if (! objc_is_class_name (class_name)
&& (decl = lookup_name (class_name)))
{
builtins.c, [...]: Avoid "`" as left quote, using "'" or %q, %< and %> as appropriate. * builtins.c, c-common.c, c-decl.c, c-format.c, c-format.h, c-parse.in, c-pch.c, c-pragma.c, collect2.c, final.c, gcc.c, gcov.c, opts.c, pretty-print.h, protoize.c, reg-stack.c, rtl.c, tlink.c, config/alpha/alpha.c, config/arc/arc.c, config/arm/arm.c, config/avr/avr.c, config/c4x/c4x.c, config/darwin.c, config/frv/frv.c, config/h8300/h8300.c, config/i386/i386.c, config/i386/winnt.c, config/ia64/ia64.c, config/ip2k/ip2k.c, config/iq2000/iq2000.c, config/m32r/m32r.c, config/m68hc11/m68hc11.c, config/m68k/m68k.c, config/m68k/m68k.h, config/mcore/mcore.c, config/mips/mips.c, config/mmix/mmix.c, config/ns32k/ns32k.c, config/rs6000/host-darwin.c, config/rs6000/rs6000.c, config/s390/s390.c, config/sh/sh.c, config/sh/symbian.c, config/stormy16/stormy16.c, config/v850/v850.c: Avoid "`" as left quote, using "'" or %q, %< and %> as appropriate. Use %' as apostrophe in diagnostics where applicable. Use %< and %> in place of '' quotes where applicable. Use %qs in place of %<%s%>. Consistently quote __builtin function names. ada: * misc.c (gnat_handle_option): Use %< and %> for quoting in warning message. cp: * call.c, class.c, decl.c, decl2.c, error.c, mangle.c, parser.c, pt.c, search.c, semantics.c, typeck.c: Use %q, %< and %> for quoting in diagnostics. * parser.c (cp_parser_sizeof_operand): Use '' instead of `' for quoting in printf format. * decl.c (duplicate_decls, start_decl): Use %qD instead of unquoted %D. objc: * objc-act.c: Use %q, %< and %> for quoting in diagnostics. testsuite: * gcc.dg/builtin-prefetch-1.c: Adjust expected messages. From-SVN: r90337
2004-11-09 11:13:30 +01:00
error ("%qs redeclared as different kind of symbol",
IDENTIFIER_POINTER (class_name));
toplev.c (default_tree_printer): Handle setting location with '+' flag. 2005-07-02 Zack Weinberg <zack@codesourcery.com> Joseph S. Myers <joseph@codesourcery.com> * toplev.c (default_tree_printer): Handle setting location with '+' flag. * c-objc.common.c (c_tree_printer): Likewise. * c-format.c (gcc_diag_flag_specs): Add '+'. (gcc_cdiag_char_table): Allow '+' flag for tree formats. (format_types_orig): Allow '+' flag for gcc_diag and gcc_cdiag formats. * c-common.c, c-decl.c, c-objc-common.c, c-pragma.c, config/arm/pe.c, config/i386/winnt.c, config/ia64/ia64.c, config/mcore/mcore.c, config/sh/symbian.c, config/sol2.c, config/v850/v850.c, function.c, stor-layout.c, toplev.c, tree-inline.c, tree-optimize.c, tree.c, varasm.c: Use '+' flag instead of %J or %H. Use 'q' flag for quoting. Avoid '.' at end of diagnostics. Use %q+D not %s for a decl. Do not pass excess format arguments where %J is used without %D. cp: * error.c (location_of): Add comment. (locate_error, cp_error_at, cp_warning_at, cp_pedwarn_at): Remove. * cp-tree.h (cp_error_at, cp_warning_at, cp_pedwarn_at): Remove. * call.c, class.c, decl.c, decl2.c, friend.c, init.c, name-lookup.c, parser.c, pt.c, search.c, semantics.c, typeck.c, typeck2.c: Use '+' flag instead of %J, cp_error_at, cp_warning_at or cp_pedwarn_at. Mark up some diagnostic strings with N_. java: * class.c, decl.c, expr.c: Use '+' flag instead of %J. Use 'q' flag for quoting. objc: * objc-act.c: Use '+' flag instead of %J. Use 'q' flag for quoting. testsuite: * gcc.dg/format/gcc_diag-1.c: Update. From-SVN: r101532
2005-07-02 12:55:32 +02:00
error ("previous declaration of %q+D",
decl);
}
if (code == CLASS_IMPLEMENTATION_TYPE)
1992-01-18 00:15:38 +01:00
{
{
tree chain;
for (chain = implemented_classes; chain; chain = TREE_CHAIN (chain))
if (TREE_VALUE (chain) == class_name)
{
builtins.c, [...]: Avoid "`" as left quote, using "'" or %q, %< and %> as appropriate. * builtins.c, c-common.c, c-decl.c, c-format.c, c-format.h, c-parse.in, c-pch.c, c-pragma.c, collect2.c, final.c, gcc.c, gcov.c, opts.c, pretty-print.h, protoize.c, reg-stack.c, rtl.c, tlink.c, config/alpha/alpha.c, config/arc/arc.c, config/arm/arm.c, config/avr/avr.c, config/c4x/c4x.c, config/darwin.c, config/frv/frv.c, config/h8300/h8300.c, config/i386/i386.c, config/i386/winnt.c, config/ia64/ia64.c, config/ip2k/ip2k.c, config/iq2000/iq2000.c, config/m32r/m32r.c, config/m68hc11/m68hc11.c, config/m68k/m68k.c, config/m68k/m68k.h, config/mcore/mcore.c, config/mips/mips.c, config/mmix/mmix.c, config/ns32k/ns32k.c, config/rs6000/host-darwin.c, config/rs6000/rs6000.c, config/s390/s390.c, config/sh/sh.c, config/sh/symbian.c, config/stormy16/stormy16.c, config/v850/v850.c: Avoid "`" as left quote, using "'" or %q, %< and %> as appropriate. Use %' as apostrophe in diagnostics where applicable. Use %< and %> in place of '' quotes where applicable. Use %qs in place of %<%s%>. Consistently quote __builtin function names. ada: * misc.c (gnat_handle_option): Use %< and %> for quoting in warning message. cp: * call.c, class.c, decl.c, decl2.c, error.c, mangle.c, parser.c, pt.c, search.c, semantics.c, typeck.c: Use %q, %< and %> for quoting in diagnostics. * parser.c (cp_parser_sizeof_operand): Use '' instead of `' for quoting in printf format. * decl.c (duplicate_decls, start_decl): Use %qD instead of unquoted %D. objc: * objc-act.c: Use %q, %< and %> for quoting in diagnostics. testsuite: * gcc.dg/builtin-prefetch-1.c: Adjust expected messages. From-SVN: r90337
2004-11-09 11:13:30 +01:00
error ("reimplementation of class %qs",
IDENTIFIER_POINTER (class_name));
return error_mark_node;
}
implemented_classes = tree_cons (NULL_TREE, class_name,
implemented_classes);
}
/* Reset for multiple classes per file. */
method_slot = 0;
1992-01-18 00:15:38 +01:00
c-parse.in (objc_inherit_code, [...]): Make static. 2001-10-03 Ziemowit Laski <zlaski@apple.com> * c-parse.in (objc_inherit_code, objc_pq_context, objc_public_flag): Make static. (objc_interface_context, objc_implementation_context, objc_method_context, objc_ivar_chain, objc_ivar_context): Move to global tree array in objc/objc-act.[ch]. (methoddef): Remove unnecessary code. * objc/objc-act.c: (hashed_attribute, hashed_entry, imp_entry): Hoist struct definitions to objc-act.h. (nst_method_hash_list, cls_method_hash_list, imp_list, imp_count, cat_count): Place declaration in objc-act.h. (objc_tree_index): Move enumeration to objc-act.h. (objc_global_trees): Place declaration and macro accessors in objc-act.h. (implementation_context): Remove duplicate; use objc_implementation_context instead: (method_context): Remove duplicate; use objc_method_context instead. (objc_ellipsis_node, objc_method_prototype_template, implemented_classes, function_type): Move global vars to objc_global_trees. (init_objc): Use LAST_BASE_TREE_CODE instead of LAST_CODE. (build_message_expr): Move actual construction of ObjC message send nodes to finish_message_expr. (finish_message_expr): New routine, contains code formerly in build_message_expr. * objc/objc-act.h (finish_message_expr): New prototype. (objc_ivar_chain, objc_method_context, objc_ellipsis_node): Remove declarations; these vars are now part of objc_global_trees. (objc_tree_index, objc_global_trees): Move definitions from objc-act.c. * objc/objc-tree.def: Update copyright info. From-SVN: r46000
2001-10-04 00:05:57 +02:00
objc_implementation_context = class;
1992-01-18 00:15:38 +01:00
1996-07-04 00:07:53 +02:00
/* Lookup the interface for this implementation. */
1992-01-18 00:15:38 +01:00
if (!(implementation_template = lookup_interface (class_name)))
{
diagnostic.c (warning): Accept parameter to classify warning option. * diagnostic.c (warning): Accept parameter to classify warning option. (warning0): New, for when a pointer to an error() like function is needed. * errors.c (warning): Likewise. * errors.h (warning, warning0): Adjust prototypes. * toplev.h (warning, warning0): Likewise. * attribs.c, builtins.c, c-common.c, c-decl.c, c-format.c, c-gimplify.c, c-lex.c, c-objc-common.c, c-opts.c, c-parser.c, c-pragma.c, c-typeck.c, calls.c, cgraph.c, coverage.c, emit-rtl.c, fold-const.c, fortran/trans-decl.c, function.c, gcse.c, genautomata.c, haifa-sched.c, opts.c, passes.c, regclass.c, reload1.c, stmt.c, stor-layout.c, toplev.c, tree-cfg.c, tree-dump.c, tree-inline.c, tree-mudflap.c, tree-optimize.c, tree-ssa.c, tree.c, varasm.c: Adjust warning() callers. * config/alpha/alpha.c, config/arc/arc.c, config/arm/arm.c, config/avr/avr.c, config/bfin/bfin.c, config/c4x/c4x-c.c, config/c4x/c4x.c, config/cris/cris.c, config/darwin-c.c, config/darwin.c, config/darwin.h, config/h8300/h8300.c, config/i386/cygming.h, config/i386/djgpp.h, config/i386/i386.c, config/i386/winnt.c, config/ia64/ia64-c.c, config/ia64/ia64.c, config/ip2k/ip2k.c, config/m32r/m32r.c, config/m68hc11/m68hc11.c, config/m68k/m68k.c, config/mcore/mcore.c, config/mips/mips.c, config/mmix/mmix.c, config/ns32k/ns32k.c, config/pa/pa-hpux11.h, config/pa/pa.c, config/rs6000/aix43.h, config/rs6000/aix51.h, config/rs6000/aix52.h, config/rs6000/darwin.h, config/rs6000/rs6000-c.c, config/rs6000/rs6000.c, config/s390/s390.c, config/sh/sh.c, config/sh/sh.h, config/sh/symbian.c, config/sol2-c.c, config/sol2.c, config/stormy16/stormy16.c, config/v850/v850-c.c, config/v850/v850.c, config/xtensa/xtensa.c: Adjust warning() callers. * ada/misc.c: Adjust warning() callers. * cp/call.c, cp/class.c, cp/cvt.c, cp/decl.c, cp/decl2.c, cp/except.c, cp/friend.c, cp/init.c, cp/lex.c, cp/mangle.c, cp/method.c, cp/name-lookup.c, cp/parser.c, cp/repo.c, cp/rtti.c, cp/tree.c, cp/typeck.c, cp/typeck2.c: Adjust warning() callers. * fortran/trans-decl.c: Adjust warning() callers. * java/class.c, java/decl.c, java/expr.c, java/jcf-io.c, java/jcf-parse.c, java/jv-scan.c, java/parse.y: Adjust warning() callers. * objc/objc-act.c: Adjust warning() callers. * treelang/parse.y: Adjust warning() callers. From-SVN: r98633
2005-04-23 23:29:07 +02:00
warning (0, "cannot find interface declaration for %qs",
1992-01-18 00:15:38 +01:00
IDENTIFIER_POINTER (class_name));
Yet more Objective-C++... * objc-act.c (objc_finish_try_stmt): Add return value. (objc_build_synchronized): Likewise. * objc-act.c (objc_is_gcable_type): Add. (objc_substitute_decl): Add. (objc_build_ivar_assignment): Add. (objc_build_global_assignment): Add. (objc_build_strong_cast_assignment): Add. (objc_is_ivar_reference_p): Add. (objc_is_global_reference_p): Add. (objc_generate_write_barrier): Add. (objc_rewrite_function_call): Add. (objc_gimplify_expr): Add Objective-C++ support. * objc-act.h (ALLOC_OBJC_TYPE_LANG_SPECIFIC): Likewise. (SIZEOF_OBJC_TYPE_LANG_SPECIFIC): Add. (INIT_TYPE_OBJC_INFO): Add Objective-C++ support. (DUP_TYPE_OBJC_INFO): Likewise. (struct imp_entry): Add field has_cxx_cdtors. (struct imp_entry *imp_list): Add OCTI_UMSG_FAST_DECL, OCTI_METH_LIST_TEMPL, OCTI_METH_PROTO_LIST_TEMPL, OCTI_IVAR_LIST_TEMPL, OCTI_ASSIGN_IVAR_DECL, OCTI_ASSIGN_IVAR_FAST_DECL, OCTI_ASSIGN_GLOBAL_DECL, OCTI_ASSIGN_STRONGCAST_DECL. (umsg_fast_decl): Add. (objc_assign_ivar_decl): Add. (objc_assign_ivar_fast_decl): Add. (objc_assign_global_decl): Add. (objc_assign_strong_cast_decl): Add. (objc_method_list_ptr): Add. (objc_method_proto_list_ptr): Add. (objc_ivar_list_ptr): Add. * objc-act.c (should_call_super_dealloc): Add. (OBJC_VERSION): Bump to 6. (objc_is_gcable_type): Add. (objc_substitute_decl): Add. (objc_build_ivar_assignment): Add. (objc_build_global_assignment): Add. (objc_build_strong_cast_assignment): Add. (objc_is_gcable_p): Add. (objc_is_ivar_reference_p): Add. (objc_is_global_reference_p): Add. (generate_shared_structures): Add flags parameter. (objc_generate_cxx_ctor_or_dtor): Add. (objc_generate_cxx_cdtors): Add. (add_class): Add name parameter. (objc_types_share_size_and_alignment): Add. (comp_proto_with_proto): Add strict parameter. (CLS_HAS_CXX_STRUCTORS): Add. (TAG_ASSIGNIVAR): Add. (TAG_ASSIGNGLOBAL): Add. (TAG_ASSIGNSTRONGCAST): Add. (TAG_MSGSEND_FAST): Add. (TAG_ASSIGNIVAR_FAST): Add. (TAG_CXX_CONSTRUCT): Add. (TAG_CXX_DESTRUCT): Add. (OBJC_LOOKUP_CLASS): Add. (OBJC_LOOKUP_NO_SUPER): Add. (objc_finish_file): Add pch support. (objc_finish_implementation): Add Objective-C++ support. (synth_module_prologue): Likewise. (synth_module_prologue): Add fast dispatching. (objc_get_class_reference): Add Objective-C++ support. (objc_generate_write_barrier): Likewise. (next_sjlj_build_enter_and_setjmp): Likewise. (objc_begin_try_stmt): Likewise. (build_next_objc_exception_stuff): Add fast ivar support. (build_private_template): Mark the record as used so debug information is generated. (build_protocol_template): Add Objective-C++ support. (objc_method_parm_type) Likewise. (objc_generate_cxx_ctor_or_dtor): Likewise. (objc_generate_cxx_cdtors): Likewise. (build_protocol_initializer): Likewise. (build_category_template): Likewise. (build_class_template): Likewise. (build_method_list_template): Likewise. (build_category_initializer): Likewise. (build_shared_structure_initializer): Likewise. (objc_finish_message_expr): Likewise. (build_objc_method_call): Add fast dispatch support. (lookup_method_static): Add support to end search at superclasses. (add_method_to_hash_list): Add strict parameter to comp_proto_with_proto. (objc_add_method): Likewise. (objc_add_method): Also set the interface_value. (add_instance_variable): Add Objective-C++ support. (objc_is_public): Likewise. (start_class): Likewise. (continue_class): Likewise. (encode_aggregate_within): Likewise. (start_method_def): Likewise. (objc_start_function): Clear current_function_returns_value and current_function_returns_null. (really_start_method): Add Objective-C++ support. (objc_finish_method_definition): Add warning for missing [super dealloc]. (finish_objc): Add Objective-C++ support. (generate_objc_image_info): Likewise. (objc_lookup_ivar): Likewise. * objc-act.h (TYPE_HAS_OBJC_INFO): Likewise. (INIT_TYPE_OBJC_INFO): Likewise. (DUP_TYPE_OBJC_INFO): Likewise. From-SVN: r99857
2005-05-17 22:07:08 +02:00
add_class (implementation_template = objc_implementation_context,
class_name);
1992-01-18 00:15:38 +01:00
}
/* If a super class has been specified in the implementation,
insure it conforms to the one specified in the interface. */
1992-01-18 00:15:38 +01:00
if (super_name
&& (super_name != CLASS_SUPER_NAME (implementation_template)))
{
tree previous_name = CLASS_SUPER_NAME (implementation_template);
c-parse.in (yyerror): Const-ification and/or static-ization. * c-parse.in (yyerror): Const-ification and/or static-ization. * c-typeck.c (push_member_name): Likewise. * collect2.c (main): Likewise. * dbxout.c (dbxout_parms): Likewise. * diagnostic.c (format_with_decl): Likewise. * dwarf2out.c (output_ranges): Likewise. * dwarfout.c (fundamental_type_code): Likewise. * except.c (dw2_output_call_site_table): Likewise. * gcc.c (do_spec_1): Likewise. * genopinit.c (optabs): Likewise. * objc/objc-act.c (synth_id_with_class_suffix, start_class, gen_declaration_1, handle_impent): Likewise. * protoize.c (default_include, in_system_include_dir, abspath): Likewise. * sched-vis.c (visualize_stall_cycles): Likewise. * sdbout.c (plain_type_1, sdbout_end_function, sdbout_end_epilogue): Likewise. * varasm.c (decode_reg_name): Likewise. * 1750a.c (mod_regno_adjust): Likewise. * alpha.c (alpha_write_one_linkage, unicosmk_output_default_externs): Likewise. * arm.c (arm_condition_codes): Likewise. * arm.h (arm_condition_codes): Likewise. * avr.c (output_movsisf, encode_section_info): Likewise. * darwin.h (GEN_BINDER_NAME_FOR_STUB, GEN_SYMBOL_NAME_FOR_SYMBOL): Likewise. * i386.c (hi_reg_name, qi_reg_name, qi_high_reg_name): Likewise. * i386.h (hi_reg_name, qi_reg_name, qi_high_reg_name): Likewise. * m88k.c (output_function_profiler): Likewise. * mips.c (mips_output_conditional_branch): Likewise. * ns32k.c (ns32k_out_reg_names): Likewise. * ns32k.h (ns32k_out_reg_names): Likewise. * pj.c (pj_output_rval): Likewise. * rs6000.c (GEN_LOCAL_LABEL_FOR_SYMBOL): Likewise. * sparc.c (sparc_flat_function_prologue, sparc_flat_function_epilogue): Likewise. cp: * decl.c (warn_extern_redeclared_static, cp_make_fname_decl): Const-ification. * pt.c (tsubst_decl): Likewise. f: * bad.c (ffebad_finish): Const-ification and/or static-ization. * intrin.c (ffeintrin_cmp_name_): Likewise. * stc.c (ffestc_R904): Likewise. java: * expr.c (expand_invoke): Const-ification. * parse.y (patch_method_invocation): Likewise. From-SVN: r45581
2001-09-13 16:37:29 +02:00
const char *const name =
previous_name ? IDENTIFIER_POINTER (previous_name) : "";
builtins.c, [...]: Avoid "`" as left quote, using "'" or %q, %< and %> as appropriate. * builtins.c, c-common.c, c-decl.c, c-format.c, c-format.h, c-parse.in, c-pch.c, c-pragma.c, collect2.c, final.c, gcc.c, gcov.c, opts.c, pretty-print.h, protoize.c, reg-stack.c, rtl.c, tlink.c, config/alpha/alpha.c, config/arc/arc.c, config/arm/arm.c, config/avr/avr.c, config/c4x/c4x.c, config/darwin.c, config/frv/frv.c, config/h8300/h8300.c, config/i386/i386.c, config/i386/winnt.c, config/ia64/ia64.c, config/ip2k/ip2k.c, config/iq2000/iq2000.c, config/m32r/m32r.c, config/m68hc11/m68hc11.c, config/m68k/m68k.c, config/m68k/m68k.h, config/mcore/mcore.c, config/mips/mips.c, config/mmix/mmix.c, config/ns32k/ns32k.c, config/rs6000/host-darwin.c, config/rs6000/rs6000.c, config/s390/s390.c, config/sh/sh.c, config/sh/symbian.c, config/stormy16/stormy16.c, config/v850/v850.c: Avoid "`" as left quote, using "'" or %q, %< and %> as appropriate. Use %' as apostrophe in diagnostics where applicable. Use %< and %> in place of '' quotes where applicable. Use %qs in place of %<%s%>. Consistently quote __builtin function names. ada: * misc.c (gnat_handle_option): Use %< and %> for quoting in warning message. cp: * call.c, class.c, decl.c, decl2.c, error.c, mangle.c, parser.c, pt.c, search.c, semantics.c, typeck.c: Use %q, %< and %> for quoting in diagnostics. * parser.c (cp_parser_sizeof_operand): Use '' instead of `' for quoting in printf format. * decl.c (duplicate_decls, start_decl): Use %qD instead of unquoted %D. objc: * objc-act.c: Use %q, %< and %> for quoting in diagnostics. testsuite: * gcc.dg/builtin-prefetch-1.c: Adjust expected messages. From-SVN: r90337
2004-11-09 11:13:30 +01:00
error ("conflicting super class name %qs",
1992-01-18 00:15:38 +01:00
IDENTIFIER_POINTER (super_name));
builtins.c, [...]: Avoid "`" as left quote, using "'" or %q, %< and %> as appropriate. * builtins.c, c-common.c, c-decl.c, c-format.c, c-format.h, c-parse.in, c-pch.c, c-pragma.c, collect2.c, final.c, gcc.c, gcov.c, opts.c, pretty-print.h, protoize.c, reg-stack.c, rtl.c, tlink.c, config/alpha/alpha.c, config/arc/arc.c, config/arm/arm.c, config/avr/avr.c, config/c4x/c4x.c, config/darwin.c, config/frv/frv.c, config/h8300/h8300.c, config/i386/i386.c, config/i386/winnt.c, config/ia64/ia64.c, config/ip2k/ip2k.c, config/iq2000/iq2000.c, config/m32r/m32r.c, config/m68hc11/m68hc11.c, config/m68k/m68k.c, config/m68k/m68k.h, config/mcore/mcore.c, config/mips/mips.c, config/mmix/mmix.c, config/ns32k/ns32k.c, config/rs6000/host-darwin.c, config/rs6000/rs6000.c, config/s390/s390.c, config/sh/sh.c, config/sh/symbian.c, config/stormy16/stormy16.c, config/v850/v850.c: Avoid "`" as left quote, using "'" or %q, %< and %> as appropriate. Use %' as apostrophe in diagnostics where applicable. Use %< and %> in place of '' quotes where applicable. Use %qs in place of %<%s%>. Consistently quote __builtin function names. ada: * misc.c (gnat_handle_option): Use %< and %> for quoting in warning message. cp: * call.c, class.c, decl.c, decl2.c, error.c, mangle.c, parser.c, pt.c, search.c, semantics.c, typeck.c: Use %q, %< and %> for quoting in diagnostics. * parser.c (cp_parser_sizeof_operand): Use '' instead of `' for quoting in printf format. * decl.c (duplicate_decls, start_decl): Use %qD instead of unquoted %D. objc: * objc-act.c: Use %q, %< and %> for quoting in diagnostics. testsuite: * gcc.dg/builtin-prefetch-1.c: Adjust expected messages. From-SVN: r90337
2004-11-09 11:13:30 +01:00
error ("previous declaration of %qs", name);
1992-01-18 00:15:38 +01:00
}
else if (! super_name)
{
CLASS_SUPER_NAME (objc_implementation_context)
= CLASS_SUPER_NAME (implementation_template);
}
1992-01-18 00:15:38 +01:00
}
else if (code == CLASS_INTERFACE_TYPE)
1992-01-18 00:15:38 +01:00
{
if (lookup_interface (class_name))
#ifdef OBJCPLUS
builtins.c, [...]: Avoid "`" as left quote, using "'" or %q, %< and %> as appropriate. * builtins.c, c-common.c, c-decl.c, c-format.c, c-format.h, c-parse.in, c-pch.c, c-pragma.c, collect2.c, final.c, gcc.c, gcov.c, opts.c, pretty-print.h, protoize.c, reg-stack.c, rtl.c, tlink.c, config/alpha/alpha.c, config/arc/arc.c, config/arm/arm.c, config/avr/avr.c, config/c4x/c4x.c, config/darwin.c, config/frv/frv.c, config/h8300/h8300.c, config/i386/i386.c, config/i386/winnt.c, config/ia64/ia64.c, config/ip2k/ip2k.c, config/iq2000/iq2000.c, config/m32r/m32r.c, config/m68hc11/m68hc11.c, config/m68k/m68k.c, config/m68k/m68k.h, config/mcore/mcore.c, config/mips/mips.c, config/mmix/mmix.c, config/ns32k/ns32k.c, config/rs6000/host-darwin.c, config/rs6000/rs6000.c, config/s390/s390.c, config/sh/sh.c, config/sh/symbian.c, config/stormy16/stormy16.c, config/v850/v850.c: Avoid "`" as left quote, using "'" or %q, %< and %> as appropriate. Use %' as apostrophe in diagnostics where applicable. Use %< and %> in place of '' quotes where applicable. Use %qs in place of %<%s%>. Consistently quote __builtin function names. ada: * misc.c (gnat_handle_option): Use %< and %> for quoting in warning message. cp: * call.c, class.c, decl.c, decl2.c, error.c, mangle.c, parser.c, pt.c, search.c, semantics.c, typeck.c: Use %q, %< and %> for quoting in diagnostics. * parser.c (cp_parser_sizeof_operand): Use '' instead of `' for quoting in printf format. * decl.c (duplicate_decls, start_decl): Use %qD instead of unquoted %D. objc: * objc-act.c: Use %q, %< and %> for quoting in diagnostics. testsuite: * gcc.dg/builtin-prefetch-1.c: Adjust expected messages. From-SVN: r90337
2004-11-09 11:13:30 +01:00
error ("duplicate interface declaration for class %qs",
#else
diagnostic.c (warning): Accept parameter to classify warning option. * diagnostic.c (warning): Accept parameter to classify warning option. (warning0): New, for when a pointer to an error() like function is needed. * errors.c (warning): Likewise. * errors.h (warning, warning0): Adjust prototypes. * toplev.h (warning, warning0): Likewise. * attribs.c, builtins.c, c-common.c, c-decl.c, c-format.c, c-gimplify.c, c-lex.c, c-objc-common.c, c-opts.c, c-parser.c, c-pragma.c, c-typeck.c, calls.c, cgraph.c, coverage.c, emit-rtl.c, fold-const.c, fortran/trans-decl.c, function.c, gcse.c, genautomata.c, haifa-sched.c, opts.c, passes.c, regclass.c, reload1.c, stmt.c, stor-layout.c, toplev.c, tree-cfg.c, tree-dump.c, tree-inline.c, tree-mudflap.c, tree-optimize.c, tree-ssa.c, tree.c, varasm.c: Adjust warning() callers. * config/alpha/alpha.c, config/arc/arc.c, config/arm/arm.c, config/avr/avr.c, config/bfin/bfin.c, config/c4x/c4x-c.c, config/c4x/c4x.c, config/cris/cris.c, config/darwin-c.c, config/darwin.c, config/darwin.h, config/h8300/h8300.c, config/i386/cygming.h, config/i386/djgpp.h, config/i386/i386.c, config/i386/winnt.c, config/ia64/ia64-c.c, config/ia64/ia64.c, config/ip2k/ip2k.c, config/m32r/m32r.c, config/m68hc11/m68hc11.c, config/m68k/m68k.c, config/mcore/mcore.c, config/mips/mips.c, config/mmix/mmix.c, config/ns32k/ns32k.c, config/pa/pa-hpux11.h, config/pa/pa.c, config/rs6000/aix43.h, config/rs6000/aix51.h, config/rs6000/aix52.h, config/rs6000/darwin.h, config/rs6000/rs6000-c.c, config/rs6000/rs6000.c, config/s390/s390.c, config/sh/sh.c, config/sh/sh.h, config/sh/symbian.c, config/sol2-c.c, config/sol2.c, config/stormy16/stormy16.c, config/v850/v850-c.c, config/v850/v850.c, config/xtensa/xtensa.c: Adjust warning() callers. * ada/misc.c: Adjust warning() callers. * cp/call.c, cp/class.c, cp/cvt.c, cp/decl.c, cp/decl2.c, cp/except.c, cp/friend.c, cp/init.c, cp/lex.c, cp/mangle.c, cp/method.c, cp/name-lookup.c, cp/parser.c, cp/repo.c, cp/rtti.c, cp/tree.c, cp/typeck.c, cp/typeck2.c: Adjust warning() callers. * fortran/trans-decl.c: Adjust warning() callers. * java/class.c, java/decl.c, java/expr.c, java/jcf-io.c, java/jcf-parse.c, java/jv-scan.c, java/parse.y: Adjust warning() callers. * objc/objc-act.c: Adjust warning() callers. * treelang/parse.y: Adjust warning() callers. From-SVN: r98633
2005-04-23 23:29:07 +02:00
warning (0, "duplicate interface declaration for class %qs",
#endif
IDENTIFIER_POINTER (class_name));
1992-01-18 00:15:38 +01:00
else
Yet more Objective-C++... * objc-act.c (objc_finish_try_stmt): Add return value. (objc_build_synchronized): Likewise. * objc-act.c (objc_is_gcable_type): Add. (objc_substitute_decl): Add. (objc_build_ivar_assignment): Add. (objc_build_global_assignment): Add. (objc_build_strong_cast_assignment): Add. (objc_is_ivar_reference_p): Add. (objc_is_global_reference_p): Add. (objc_generate_write_barrier): Add. (objc_rewrite_function_call): Add. (objc_gimplify_expr): Add Objective-C++ support. * objc-act.h (ALLOC_OBJC_TYPE_LANG_SPECIFIC): Likewise. (SIZEOF_OBJC_TYPE_LANG_SPECIFIC): Add. (INIT_TYPE_OBJC_INFO): Add Objective-C++ support. (DUP_TYPE_OBJC_INFO): Likewise. (struct imp_entry): Add field has_cxx_cdtors. (struct imp_entry *imp_list): Add OCTI_UMSG_FAST_DECL, OCTI_METH_LIST_TEMPL, OCTI_METH_PROTO_LIST_TEMPL, OCTI_IVAR_LIST_TEMPL, OCTI_ASSIGN_IVAR_DECL, OCTI_ASSIGN_IVAR_FAST_DECL, OCTI_ASSIGN_GLOBAL_DECL, OCTI_ASSIGN_STRONGCAST_DECL. (umsg_fast_decl): Add. (objc_assign_ivar_decl): Add. (objc_assign_ivar_fast_decl): Add. (objc_assign_global_decl): Add. (objc_assign_strong_cast_decl): Add. (objc_method_list_ptr): Add. (objc_method_proto_list_ptr): Add. (objc_ivar_list_ptr): Add. * objc-act.c (should_call_super_dealloc): Add. (OBJC_VERSION): Bump to 6. (objc_is_gcable_type): Add. (objc_substitute_decl): Add. (objc_build_ivar_assignment): Add. (objc_build_global_assignment): Add. (objc_build_strong_cast_assignment): Add. (objc_is_gcable_p): Add. (objc_is_ivar_reference_p): Add. (objc_is_global_reference_p): Add. (generate_shared_structures): Add flags parameter. (objc_generate_cxx_ctor_or_dtor): Add. (objc_generate_cxx_cdtors): Add. (add_class): Add name parameter. (objc_types_share_size_and_alignment): Add. (comp_proto_with_proto): Add strict parameter. (CLS_HAS_CXX_STRUCTORS): Add. (TAG_ASSIGNIVAR): Add. (TAG_ASSIGNGLOBAL): Add. (TAG_ASSIGNSTRONGCAST): Add. (TAG_MSGSEND_FAST): Add. (TAG_ASSIGNIVAR_FAST): Add. (TAG_CXX_CONSTRUCT): Add. (TAG_CXX_DESTRUCT): Add. (OBJC_LOOKUP_CLASS): Add. (OBJC_LOOKUP_NO_SUPER): Add. (objc_finish_file): Add pch support. (objc_finish_implementation): Add Objective-C++ support. (synth_module_prologue): Likewise. (synth_module_prologue): Add fast dispatching. (objc_get_class_reference): Add Objective-C++ support. (objc_generate_write_barrier): Likewise. (next_sjlj_build_enter_and_setjmp): Likewise. (objc_begin_try_stmt): Likewise. (build_next_objc_exception_stuff): Add fast ivar support. (build_private_template): Mark the record as used so debug information is generated. (build_protocol_template): Add Objective-C++ support. (objc_method_parm_type) Likewise. (objc_generate_cxx_ctor_or_dtor): Likewise. (objc_generate_cxx_cdtors): Likewise. (build_protocol_initializer): Likewise. (build_category_template): Likewise. (build_class_template): Likewise. (build_method_list_template): Likewise. (build_category_initializer): Likewise. (build_shared_structure_initializer): Likewise. (objc_finish_message_expr): Likewise. (build_objc_method_call): Add fast dispatch support. (lookup_method_static): Add support to end search at superclasses. (add_method_to_hash_list): Add strict parameter to comp_proto_with_proto. (objc_add_method): Likewise. (objc_add_method): Also set the interface_value. (add_instance_variable): Add Objective-C++ support. (objc_is_public): Likewise. (start_class): Likewise. (continue_class): Likewise. (encode_aggregate_within): Likewise. (start_method_def): Likewise. (objc_start_function): Clear current_function_returns_value and current_function_returns_null. (really_start_method): Add Objective-C++ support. (objc_finish_method_definition): Add warning for missing [super dealloc]. (finish_objc): Add Objective-C++ support. (generate_objc_image_info): Likewise. (objc_lookup_ivar): Likewise. * objc-act.h (TYPE_HAS_OBJC_INFO): Likewise. (INIT_TYPE_OBJC_INFO): Likewise. (DUP_TYPE_OBJC_INFO): Likewise. From-SVN: r99857
2005-05-17 22:07:08 +02:00
add_class (class, class_name);
if (protocol_list)
CLASS_PROTOCOL_LIST (class)
= lookup_and_install_protocols (protocol_list);
1992-01-18 00:15:38 +01:00
}
else if (code == CATEGORY_INTERFACE_TYPE)
1992-01-18 00:15:38 +01:00
{
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. */
1992-01-18 00:15:38 +01:00
if (!(class_category_is_assoc_with = lookup_interface (class_name)))
{
builtins.c, [...]: Avoid "`" as left quote, using "'" or %q, %< and %> as appropriate. * builtins.c, c-common.c, c-decl.c, c-format.c, c-format.h, c-parse.in, c-pch.c, c-pragma.c, collect2.c, final.c, gcc.c, gcov.c, opts.c, pretty-print.h, protoize.c, reg-stack.c, rtl.c, tlink.c, config/alpha/alpha.c, config/arc/arc.c, config/arm/arm.c, config/avr/avr.c, config/c4x/c4x.c, config/darwin.c, config/frv/frv.c, config/h8300/h8300.c, config/i386/i386.c, config/i386/winnt.c, config/ia64/ia64.c, config/ip2k/ip2k.c, config/iq2000/iq2000.c, config/m32r/m32r.c, config/m68hc11/m68hc11.c, config/m68k/m68k.c, config/m68k/m68k.h, config/mcore/mcore.c, config/mips/mips.c, config/mmix/mmix.c, config/ns32k/ns32k.c, config/rs6000/host-darwin.c, config/rs6000/rs6000.c, config/s390/s390.c, config/sh/sh.c, config/sh/symbian.c, config/stormy16/stormy16.c, config/v850/v850.c: Avoid "`" as left quote, using "'" or %q, %< and %> as appropriate. Use %' as apostrophe in diagnostics where applicable. Use %< and %> in place of '' quotes where applicable. Use %qs in place of %<%s%>. Consistently quote __builtin function names. ada: * misc.c (gnat_handle_option): Use %< and %> for quoting in warning message. cp: * call.c, class.c, decl.c, decl2.c, error.c, mangle.c, parser.c, pt.c, search.c, semantics.c, typeck.c: Use %q, %< and %> for quoting in diagnostics. * parser.c (cp_parser_sizeof_operand): Use '' instead of `' for quoting in printf format. * decl.c (duplicate_decls, start_decl): Use %qD instead of unquoted %D. objc: * objc-act.c: Use %q, %< and %> for quoting in diagnostics. testsuite: * gcc.dg/builtin-prefetch-1.c: Adjust expected messages. From-SVN: r90337
2004-11-09 11:13:30 +01:00
error ("cannot find interface declaration for %qs",
1992-01-18 00:15:38 +01:00
IDENTIFIER_POINTER (class_name));
exit (FATAL_EXIT_CODE);
1992-01-18 00:15:38 +01:00
}
else
add_category (class_category_is_assoc_with, class);
if (protocol_list)
CLASS_PROTOCOL_LIST (class)
= lookup_and_install_protocols (protocol_list);
1992-01-18 00:15:38 +01:00
}
else if (code == CATEGORY_IMPLEMENTATION_TYPE)
1992-01-18 00:15:38 +01:00
{
/* Reset for multiple classes per file. */
method_slot = 0;
1992-01-18 00:15:38 +01:00
c-parse.in (objc_inherit_code, [...]): Make static. 2001-10-03 Ziemowit Laski <zlaski@apple.com> * c-parse.in (objc_inherit_code, objc_pq_context, objc_public_flag): Make static. (objc_interface_context, objc_implementation_context, objc_method_context, objc_ivar_chain, objc_ivar_context): Move to global tree array in objc/objc-act.[ch]. (methoddef): Remove unnecessary code. * objc/objc-act.c: (hashed_attribute, hashed_entry, imp_entry): Hoist struct definitions to objc-act.h. (nst_method_hash_list, cls_method_hash_list, imp_list, imp_count, cat_count): Place declaration in objc-act.h. (objc_tree_index): Move enumeration to objc-act.h. (objc_global_trees): Place declaration and macro accessors in objc-act.h. (implementation_context): Remove duplicate; use objc_implementation_context instead: (method_context): Remove duplicate; use objc_method_context instead. (objc_ellipsis_node, objc_method_prototype_template, implemented_classes, function_type): Move global vars to objc_global_trees. (init_objc): Use LAST_BASE_TREE_CODE instead of LAST_CODE. (build_message_expr): Move actual construction of ObjC message send nodes to finish_message_expr. (finish_message_expr): New routine, contains code formerly in build_message_expr. * objc/objc-act.h (finish_message_expr): New prototype. (objc_ivar_chain, objc_method_context, objc_ellipsis_node): Remove declarations; these vars are now part of objc_global_trees. (objc_tree_index, objc_global_trees): Move definitions from objc-act.c. * objc/objc-tree.def: Update copyright info. From-SVN: r46000
2001-10-04 00:05:57 +02:00
objc_implementation_context = class;
1992-01-18 00:15:38 +01:00
/* For a category, class_name is really the name of the class that
the following set of methods will be associated with. We must
1996-07-04 00:07:53 +02:00
find the interface so that can derive the objects template. */
1992-01-18 00:15:38 +01:00
if (!(implementation_template = lookup_interface (class_name)))
{
builtins.c, [...]: Avoid "`" as left quote, using "'" or %q, %< and %> as appropriate. * builtins.c, c-common.c, c-decl.c, c-format.c, c-format.h, c-parse.in, c-pch.c, c-pragma.c, collect2.c, final.c, gcc.c, gcov.c, opts.c, pretty-print.h, protoize.c, reg-stack.c, rtl.c, tlink.c, config/alpha/alpha.c, config/arc/arc.c, config/arm/arm.c, config/avr/avr.c, config/c4x/c4x.c, config/darwin.c, config/frv/frv.c, config/h8300/h8300.c, config/i386/i386.c, config/i386/winnt.c, config/ia64/ia64.c, config/ip2k/ip2k.c, config/iq2000/iq2000.c, config/m32r/m32r.c, config/m68hc11/m68hc11.c, config/m68k/m68k.c, config/m68k/m68k.h, config/mcore/mcore.c, config/mips/mips.c, config/mmix/mmix.c, config/ns32k/ns32k.c, config/rs6000/host-darwin.c, config/rs6000/rs6000.c, config/s390/s390.c, config/sh/sh.c, config/sh/symbian.c, config/stormy16/stormy16.c, config/v850/v850.c: Avoid "`" as left quote, using "'" or %q, %< and %> as appropriate. Use %' as apostrophe in diagnostics where applicable. Use %< and %> in place of '' quotes where applicable. Use %qs in place of %<%s%>. Consistently quote __builtin function names. ada: * misc.c (gnat_handle_option): Use %< and %> for quoting in warning message. cp: * call.c, class.c, decl.c, decl2.c, error.c, mangle.c, parser.c, pt.c, search.c, semantics.c, typeck.c: Use %q, %< and %> for quoting in diagnostics. * parser.c (cp_parser_sizeof_operand): Use '' instead of `' for quoting in printf format. * decl.c (duplicate_decls, start_decl): Use %qD instead of unquoted %D. objc: * objc-act.c: Use %q, %< and %> for quoting in diagnostics. testsuite: * gcc.dg/builtin-prefetch-1.c: Adjust expected messages. From-SVN: r90337
2004-11-09 11:13:30 +01:00
error ("cannot find interface declaration for %qs",
1992-01-18 00:15:38 +01:00
IDENTIFIER_POINTER (class_name));
exit (FATAL_EXIT_CODE);
1992-01-18 00:15:38 +01:00
}
}
return class;
}
Makefile.in (c-parse.o): Depend on $(C_COMMON_H). [gcc/ChangeLog] 2004-09-07 Ziemowit Laski <zlaski@apple.com> * Makefile.in (c-parse.o): Depend on $(C_COMMON_H). * c-parse.in: Include c-common.h instead of objc-act.h. (ivar_decl_list, ivar_decls, ivar_decl, ivars, ivar_declarator, myparms, myparm): Remove %type declarations. (methodtype, optparms, OBJC_TYPE_QUAL, objc_quals, objc_qual, objc_typename, objc_try_catch_stmt, optellipsis): Add %type declarations. (objc_inherit_code, objc_public_flag): Remove. (typespec_nonreserved_nonattr): Call objc_get_protocol_qualified_type() instead of get_static_reference() and get_protocol_reference(). (stmt_nocomp): Call grokparm() on @catch parameter. (objcdef): Move semantic action to objc_finish_implementation(). (classdef): Move semantic action to objc_start_class_interface(), objc_continue_interface(), objc_finish_interface(), objc_start_class_implementation(), objc_continue_implementation(), objc_start_category_interface() and objc_start_category_implementation(). (protocoldef): Move semantic actions to objc_start_protocol() and objc_finish_interface(). (ivar_decl_list): Remove nonterminal. (visibility_spec): Move semantic actions to objc_set_visibility(). (ivar_decls): Remove assignment to $$. (ivar_decl): Rephrase in terms of component_decl; call objc_add_instance_variable(). (ivars, ivar_declarator): Remove nonterminals. (opt_semi): New nonterminal. (methodtype): Remove semantic actions. (methoddef): Move semantic actions to objc_set_method_type(), objc_start_method_definition() and objc_finish_method_definition(). (methodproto): Move semantic actions to objc_set_method_type() and objc_add_method_declaration(). (methoddecl): Use objc_typename instead of typename; move semantic actions to objc_build_method_signature(). (optarglist, myxdecls, mydecl, myparms, myparm): Remove nonterminals. (optparmlist): Express in terms of optparms and optellipsis. (optparms, optellipsis, objc_qual, objc_quals, objc_typename): New nonterminals. (keyworddecl): Use objc_typename instead of typename. (rid_to_yy): Mark RID_IN, RID_OUT, RID_INOUT, RID_BYCOPY, RID_BYREF and RID_ONEWAY as returning OBJC_TYPE_QUAL to yyparse(). [gcc/objc/ChangeLog] 2004-09-07 Ziemowit Laski <zlaski@apple.com> * Make-lang.in (objc/objc-parse.o): Depend on $(C_COMMON_H) instead of objc/objc-act.h. (objc/objc-act.o): Depend on $(HASHTAB_H). * objc-act.c: Include hashtab.h; in ObjC++ mode, include cp-tree.h and objcp-decl.h instead of c-tree.h. (build_module_descriptor, get_class_ivars, synth_id_with_class_suffix, error_with_ivar, gen_method_decl, gen_declaration, setup_string_decl, build_protocol_template): Adjust prototypes. (build_module_initializer_routine, start_class, continue_class, finish_class, start_method_def, objc_start_function, start_protocol, build_method_decl, objc_add_method, add_instance_variable, build_ivar_reference, is_ivar, is_private, get_super_receiver, build_selector_table_decl, objc_push_parm, objc_get_parm_info, gen_type_name, gen_type_name_0, start_var_decl, finish_var_decl, create_field_decl): New prototypes. (objc_expand_function_end, comp_method_with_proto, objc_expr_last, gen_declaration_1, gen_declarator, is_complex_decl, adorn_decl, define_decl, create_builtin_decl, gen_declspecs): Remove prototypes. (TYPE_ID): Rename to OBJECT_TYPEDEF_NAME. (CLASS_TYPEDEF_NAME): New. (TAG_EXECCLASS): Change from a global variable to a #define. (TAG_RETURN_STRUCT): Delete. (TAG_GNUINIT): New, holds '__objc_gnu_init' name. (objc_inherit_code, objc_public_flag): New, moved from c-parse.in. (string_descriptor): New struct. (string_htab): New hash table. (string_hash, string_eq): New prototypes. (generate_struct_by_value_array): Call create_field_decl() instead of create_builtin_decl(). (objc_init): Do not initialize objc_ellipsis_node or TAG_EXECCLASS; In ObjC++ mode, call cxx_init() instead of c_objc_common_init(). (objc_finish_file): In ObjC++, call instantiate_pending_templates() and cp_finish_file(). (define_decl, get_static_reference, get_protocol_reference, create_builtin_decl): Remove functions. (objc_start_class_interface, objc_start_category_interface, objc_start_protocol, objc_continue_interface, objc_finish_interface, objc_start_class_implementation, objc_start_category_implementation, objc_continue_implementation, objc_finish_implementation, objc_set_visibility, objc_set_method_type, objc_build_method_signature, objc_add_method_declaration, objc_start_method_definition, objc_add_instance_variable, objc_get_protocol_qualified_type, create_field_decl, start_var_decl, finish_var_decl): New functions. (setup_string_decl): Simplify since it is only called once. (synth_module_prologue): Call build_class_template(); predefine 'id' and 'Class' as typedefs; rename 'temp_type' to 'type'; disable debug hooks for duration of function; fix GNU runtime messenger signatures to correspond to reality; forward-declare '__objc_exec_class' for the GNU runtime; call build_selector_table_decl(); in ObjC++ mode, generate 'extern "C" { ... }' wrappers around synthesized declarations; call build_protocol_template() and build_category_template(). (string_hash, string_eq): New functions. (objc_build_string_object): Check metaclass correctness only once; store string literals in hash table. (objc_build_constructor): Do not convert initializer elements; adjust for ObjC++ impedance mismatch. (build_objc_symtab_template): Call create_field_decl() instead of create_builtin_decl(). (init_objc_symtab): Add missing conversion to initializer element. (build_metadata_decl): Call start_var_decl() instead of define_decl(). (generate_objc_symtab_decl): Do not call build_category_template(); call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(). (build_module_descriptor): Call create_field_decl() instead of grokfield(); call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(); always mark module descriptor as used; move GNU runtime-specific functionality to build_module_initializer_routine(). (build_module_initializer_routine): New function, broken off of build_module_descriptor(). (objc_static_init_needed_p, objc_generate_static_init_call): New functions. (generate_static_references, generate_strings, build_selector_translation_table, generate_descriptor_table, generate_ivars_list, generate_dispatch_table, generate_category): Call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(); build a type directly instead of via groktypename(). (build_selector_reference_decl, build_selector_table_decl, build_class_reference_decl, build_protocol_reference, generate_objc_image_info): Call start_var_decl() instead of build_decl(). (build_selector_reference): For GNU runtime, do not call build_selector_reference_decl(). (build_selector, build_typed_selector_reference): Always convert result to the selector type. (add_objc_string): Cast return value to 'char *'. (build_method_prototype_template, build_selector_template, build_method_template): Use actual selector type for fields pointing to selectors. (finish_objc): For GNU runtime, call build_module_initializer_routine() after build_module_descriptor(). (generate_protocol_list, generate_shared_structures): Call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(); build a type directly instead of via groktypename(). (synth_id_with_class_suffix): Return a string. (get_arg_type_list): For instance methods, use the instance type for 'self'; do not call groktypename_in_parm_context(). (build_objc_string_decl): Squash redeclaration errors in ObjC++. (objc_is_class_name): Use OBJC_TYPE_NAME instead of TYPE_NAME; handle RECORD_TYPEs in ObjC as well as ObjC++. (objc_is_id): New function. (objc_is_object_ptr): Return the canonical type node. (objc_get_class_ivars): Simplify using get_class_ivars(). (get_class_ivars): Remove second parameter; create a fresh copy of the ivar list for each call; do not check for existence of super class. (objc_eh_runtime_type): Mark #ifndef OBJCPLUS. (objc_init_exceptions): When using SJLJ-style exceptions, require the use of '-fobjc-exceptions' flag; do not require it for DWARF-style exceptions. (objc_build_exc_ptr, next_sjlj_build_try_catch_finally): Use objc_object_type instead of objc_id_type. (objc_begin_catch_clause): Convert the incoming PARM_DECL into a VAR_DECL before placing it in the appropriate scope; do not call define_decl(); adjust call to c_begin_compound_stmt(); use objc_object_type instead of objc_id_type. (build_next_objc_exception_stuff): Call create_field_decl() instead of create_builtin_decl(); construct type directly instead of calling groktypename(); use OBJC_VOID_AT_END to mark end of function parameters. (build_private_template): Adjust call to get_class_ivars(); build a type directly instead of via groktypename(). (build_protocol_template, build_method_prototype_list_template, build_method_prototype_template, build_category_template, build_selector_template, build_class_template, build_super_template, build_ivar_template, build_ivar_list_template, build_method_list_template, build_method_template): Call create_field_decl() instead of grokfield(). (objc_method_parm_type): Do not call groktypename(). (generate_descriptor_table): Call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(). (generate_method_descriptors, build_protocol_initializer, generate_dispatch_tables, build_category_initializer, build_shared_structure_initializer): Do not call groktypename(). (generate_protocols): Call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(); do not call groktypename(). (error_with_ivar): Remove last parameter. (check_ivars): Do not iterate ovar CLASS_RAW_IVARS lists in addition to CLASS_IVARS lists; adjust calls to error_with_ivar(). (generate_ivar_lists): Convert one of the initializer elements; do not call groktypename(). (get_arg_type_list, start_method_def, gen_method_def): Account for new representation of variable arguments and '...' in Objective-C methods; add Objective-C++ impedance matching code. (is_objc_type_qualifier): Remove function. (adjust_type_for_id_default): Simplify; there is no longer a need to wade through declspecs. (lookup_interface, start_class, continue_class, finish_class, start_method_def, start_protocol, build_method_decl, objc_add_method, add_instance_variable, build_ivar_reference, is_ivar, is_private, get_super_receiver, objc_build_finally_epilogue): Make into static functions. (receiver_is_class_object): Use new IS_CLASS() macro. (objc_build_message_expr): Tweak ObjC++ message argument handling; call objc_finish_message_expr() instead of finish_message_expr(). (finish_message_expr): Rename to objc_finish_message_expr(); use OBJC_TYPE_NAME and OBJC_SET_TYPE_NAME macros instead of TYPE_NAME. call gen_type_name() instead of gen_declaration(); call objc_is_id() instead of using IS_ID and IS_CLASS; Use objc_class_name instead of calling get_identifier("Class"); handle CONVERT_EXPRs in receiver. (build_objc_method_call, warn_with_method): Do not call groktypename(). (build_ivar_reference): Call convert() instead of clobbering in a type. (hash_init): Initialize string_htab hash table. (add_instance_variable): Simplify parameter list; do not call grokfield(); do not populate CLASS_IVARS list. (start_class): Check for the existence of super class, if one was specified. (continue_class): Use CLASS_RAW_IVARS rather than CLASS_IVARS; do not call build_class_template(); adjust call to get_class_ivars(); call build_decl(), pushdecl() and finish_decl() instead of define_decl(). (finish_class): Call build_decl(), pushdecl() and finish_decl() instead of define_decl(). (add_protocols): Use PROTOCOL_BINFO_ELTS for the tree vector size. (start_protocol): Do not call build_protocol_template(); use PROTOCOL_BINFO_ELTS for the tree vector size. (encode_type_qualifiers): Do not handle the 'const' qualifier here. (encode_pointer): Encode 'const char *' as 'r*', for backwards compatibility. (encode_array): Use HOST_WIDE_INT_PRINT_DEC instead of "%ld". (encode_type): Handle the 'const' qualifier here. (objc_parmlist): New global variable, sued by objc_push_parm and objc_get_parm_info(). (objc_push_parm, objc_get_parm_info): New functions. (objc_expr_last): Remove function. (synth_self_and_ucmd_args): For instance methods, use the instance type for 'self'; call objc_push_parm() instead of push_parm_decl(). (start_method_def): Do not call push_scope(), declare_parm_level(), pop_scope(), push_parm_decl(), store_parm_decls() or objc_expr_last(); just use objc_push_parm() and objc_get_parm_info(). (comp_method_with_proto): Remove function. (objc_types_are_equivalent): Strip away indirections before comparing underlying types. (comp_proto_with_proto): Do not call groktypename(); types are no longer in raw declspec format. (objc_start_function): New function. (really_start_method): Call comp_proto_with_proto() instead of comp_method_with_proto(); call objc_start_function() instead of hand-crafting a function declarator. (continue_method_def, objc_expand_function_end): Remove functions. (get_super_receiver): Call objc_get_current_scope() instead of get_current_scope(); reference 'super_class' field (instead of 'class'). (finish_method_def): Rename to objc_finish_method_definition() and add a function decl parameter; move method encoding call from objc_expand_function_end(). (is_complex_decl, adorn_decl, gen_declarator, gen_declspecs, gen_declaration_1): Remove functions. (tmpbuf, RAW_DECLSPEC): Remove. (gen_declaration): Remove second parameter; simplify to deal with TYPE_P nodes instead of raw declspecs. (gen_type_name, gen_type_name_0): New functions. (gen_method_decl): Remove second parameter; call gen_type_name() instead of gen_declaration_1(). (dump_interface): Adjust calls to gen_declaration() and gen_method_decl(); do not allocate a separate string buffer. (init_objc): Allocate a larger string buffer to accommodate dump_interface(); adjust call to build_module_descriptor(); add call to build_module_initializer_routine() for the GNU runtime. (generate_classref_translation_entry): Do not call start_decl(); call finish_var_decl() instead of finish_decl(); call convert() instead of build_c_cast(). * objc-act.h (CLASS_OWN_IVARS): Remove accessor. (CLASS_BINFO_ELTS): Reduce from 6 to 5, now that CLASS_OWN_IVARS is gone. (OCTI_GNU_INIT_DECL, GNU_INIT_decl): New. (OCTI_ELLIPSIS_NODE, objc_ellipsis_node): Remove. (OCTI_ID_ID, id_type, objc_id_id): Rename to OCTI_ID_NAME, objc_object_type and objc_object_name, respectively. (OCTI_CLS_REF, OCTI_CLASS_NAME, objc_class_reference, objc_class_name): New. (IS_CLASS): New macro. (IS_ID, IS_SUPER): Robustify. (OCTI_EXECCLASS_DECL, execclass_decl): New. (finish_file, start_class, continue_class, finish_class, start_method_def, continue_method_def, finish_method_def, start_protocol, finish_protocol, objc_build_throw_stmt, objc_build_try_catch_finally_stmt, objc_build_synchronized_prologue, objc_build_synchronized_epilogue, objc_build_try_prologue, objc_build_try_epilogue, objc_build_catch_stmt, objc_build_catch_epilogue, objc_build_finally_prologue, objc_build_finally_epilogue, is_ivar, is_private, is_public, add_instance_variable, objc_add_method, get_super_receiver, objc_clear_super_receiver, get_class_ivars_from_name, get_class_reference, get_static_reference, get_object_reference, build_message_expr, finish_message_expr, build_selector_expr, build_ivar_reference, build_keyword_decl, build_method_decl, build_protocol_expr, build_objc_string_object, objc_declare_alias, objc_declare_class, objc_declare_protocols, objc_comptypes, objc_check_decl, build_encode_expr): Remove prototypes. (imp_count, cat_count): Make GGC-aware. (OBJC_SET_TYPE_NAME): New macro. From-SVN: r87168
2004-09-08 02:49:44 +02:00
static tree
continue_class (tree class)
1992-01-18 00:15:38 +01:00
{
if (TREE_CODE (class) == CLASS_IMPLEMENTATION_TYPE
|| TREE_CODE (class) == CATEGORY_IMPLEMENTATION_TYPE)
1992-01-18 00:15:38 +01:00
{
struct imp_entry *imp_entry;
1992-01-18 00:15:38 +01:00
1996-07-04 00:07:53 +02:00
/* Check consistency of the instance variables. */
1992-01-18 00:15:38 +01:00
Makefile.in (c-parse.o): Depend on $(C_COMMON_H). [gcc/ChangeLog] 2004-09-07 Ziemowit Laski <zlaski@apple.com> * Makefile.in (c-parse.o): Depend on $(C_COMMON_H). * c-parse.in: Include c-common.h instead of objc-act.h. (ivar_decl_list, ivar_decls, ivar_decl, ivars, ivar_declarator, myparms, myparm): Remove %type declarations. (methodtype, optparms, OBJC_TYPE_QUAL, objc_quals, objc_qual, objc_typename, objc_try_catch_stmt, optellipsis): Add %type declarations. (objc_inherit_code, objc_public_flag): Remove. (typespec_nonreserved_nonattr): Call objc_get_protocol_qualified_type() instead of get_static_reference() and get_protocol_reference(). (stmt_nocomp): Call grokparm() on @catch parameter. (objcdef): Move semantic action to objc_finish_implementation(). (classdef): Move semantic action to objc_start_class_interface(), objc_continue_interface(), objc_finish_interface(), objc_start_class_implementation(), objc_continue_implementation(), objc_start_category_interface() and objc_start_category_implementation(). (protocoldef): Move semantic actions to objc_start_protocol() and objc_finish_interface(). (ivar_decl_list): Remove nonterminal. (visibility_spec): Move semantic actions to objc_set_visibility(). (ivar_decls): Remove assignment to $$. (ivar_decl): Rephrase in terms of component_decl; call objc_add_instance_variable(). (ivars, ivar_declarator): Remove nonterminals. (opt_semi): New nonterminal. (methodtype): Remove semantic actions. (methoddef): Move semantic actions to objc_set_method_type(), objc_start_method_definition() and objc_finish_method_definition(). (methodproto): Move semantic actions to objc_set_method_type() and objc_add_method_declaration(). (methoddecl): Use objc_typename instead of typename; move semantic actions to objc_build_method_signature(). (optarglist, myxdecls, mydecl, myparms, myparm): Remove nonterminals. (optparmlist): Express in terms of optparms and optellipsis. (optparms, optellipsis, objc_qual, objc_quals, objc_typename): New nonterminals. (keyworddecl): Use objc_typename instead of typename. (rid_to_yy): Mark RID_IN, RID_OUT, RID_INOUT, RID_BYCOPY, RID_BYREF and RID_ONEWAY as returning OBJC_TYPE_QUAL to yyparse(). [gcc/objc/ChangeLog] 2004-09-07 Ziemowit Laski <zlaski@apple.com> * Make-lang.in (objc/objc-parse.o): Depend on $(C_COMMON_H) instead of objc/objc-act.h. (objc/objc-act.o): Depend on $(HASHTAB_H). * objc-act.c: Include hashtab.h; in ObjC++ mode, include cp-tree.h and objcp-decl.h instead of c-tree.h. (build_module_descriptor, get_class_ivars, synth_id_with_class_suffix, error_with_ivar, gen_method_decl, gen_declaration, setup_string_decl, build_protocol_template): Adjust prototypes. (build_module_initializer_routine, start_class, continue_class, finish_class, start_method_def, objc_start_function, start_protocol, build_method_decl, objc_add_method, add_instance_variable, build_ivar_reference, is_ivar, is_private, get_super_receiver, build_selector_table_decl, objc_push_parm, objc_get_parm_info, gen_type_name, gen_type_name_0, start_var_decl, finish_var_decl, create_field_decl): New prototypes. (objc_expand_function_end, comp_method_with_proto, objc_expr_last, gen_declaration_1, gen_declarator, is_complex_decl, adorn_decl, define_decl, create_builtin_decl, gen_declspecs): Remove prototypes. (TYPE_ID): Rename to OBJECT_TYPEDEF_NAME. (CLASS_TYPEDEF_NAME): New. (TAG_EXECCLASS): Change from a global variable to a #define. (TAG_RETURN_STRUCT): Delete. (TAG_GNUINIT): New, holds '__objc_gnu_init' name. (objc_inherit_code, objc_public_flag): New, moved from c-parse.in. (string_descriptor): New struct. (string_htab): New hash table. (string_hash, string_eq): New prototypes. (generate_struct_by_value_array): Call create_field_decl() instead of create_builtin_decl(). (objc_init): Do not initialize objc_ellipsis_node or TAG_EXECCLASS; In ObjC++ mode, call cxx_init() instead of c_objc_common_init(). (objc_finish_file): In ObjC++, call instantiate_pending_templates() and cp_finish_file(). (define_decl, get_static_reference, get_protocol_reference, create_builtin_decl): Remove functions. (objc_start_class_interface, objc_start_category_interface, objc_start_protocol, objc_continue_interface, objc_finish_interface, objc_start_class_implementation, objc_start_category_implementation, objc_continue_implementation, objc_finish_implementation, objc_set_visibility, objc_set_method_type, objc_build_method_signature, objc_add_method_declaration, objc_start_method_definition, objc_add_instance_variable, objc_get_protocol_qualified_type, create_field_decl, start_var_decl, finish_var_decl): New functions. (setup_string_decl): Simplify since it is only called once. (synth_module_prologue): Call build_class_template(); predefine 'id' and 'Class' as typedefs; rename 'temp_type' to 'type'; disable debug hooks for duration of function; fix GNU runtime messenger signatures to correspond to reality; forward-declare '__objc_exec_class' for the GNU runtime; call build_selector_table_decl(); in ObjC++ mode, generate 'extern "C" { ... }' wrappers around synthesized declarations; call build_protocol_template() and build_category_template(). (string_hash, string_eq): New functions. (objc_build_string_object): Check metaclass correctness only once; store string literals in hash table. (objc_build_constructor): Do not convert initializer elements; adjust for ObjC++ impedance mismatch. (build_objc_symtab_template): Call create_field_decl() instead of create_builtin_decl(). (init_objc_symtab): Add missing conversion to initializer element. (build_metadata_decl): Call start_var_decl() instead of define_decl(). (generate_objc_symtab_decl): Do not call build_category_template(); call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(). (build_module_descriptor): Call create_field_decl() instead of grokfield(); call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(); always mark module descriptor as used; move GNU runtime-specific functionality to build_module_initializer_routine(). (build_module_initializer_routine): New function, broken off of build_module_descriptor(). (objc_static_init_needed_p, objc_generate_static_init_call): New functions. (generate_static_references, generate_strings, build_selector_translation_table, generate_descriptor_table, generate_ivars_list, generate_dispatch_table, generate_category): Call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(); build a type directly instead of via groktypename(). (build_selector_reference_decl, build_selector_table_decl, build_class_reference_decl, build_protocol_reference, generate_objc_image_info): Call start_var_decl() instead of build_decl(). (build_selector_reference): For GNU runtime, do not call build_selector_reference_decl(). (build_selector, build_typed_selector_reference): Always convert result to the selector type. (add_objc_string): Cast return value to 'char *'. (build_method_prototype_template, build_selector_template, build_method_template): Use actual selector type for fields pointing to selectors. (finish_objc): For GNU runtime, call build_module_initializer_routine() after build_module_descriptor(). (generate_protocol_list, generate_shared_structures): Call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(); build a type directly instead of via groktypename(). (synth_id_with_class_suffix): Return a string. (get_arg_type_list): For instance methods, use the instance type for 'self'; do not call groktypename_in_parm_context(). (build_objc_string_decl): Squash redeclaration errors in ObjC++. (objc_is_class_name): Use OBJC_TYPE_NAME instead of TYPE_NAME; handle RECORD_TYPEs in ObjC as well as ObjC++. (objc_is_id): New function. (objc_is_object_ptr): Return the canonical type node. (objc_get_class_ivars): Simplify using get_class_ivars(). (get_class_ivars): Remove second parameter; create a fresh copy of the ivar list for each call; do not check for existence of super class. (objc_eh_runtime_type): Mark #ifndef OBJCPLUS. (objc_init_exceptions): When using SJLJ-style exceptions, require the use of '-fobjc-exceptions' flag; do not require it for DWARF-style exceptions. (objc_build_exc_ptr, next_sjlj_build_try_catch_finally): Use objc_object_type instead of objc_id_type. (objc_begin_catch_clause): Convert the incoming PARM_DECL into a VAR_DECL before placing it in the appropriate scope; do not call define_decl(); adjust call to c_begin_compound_stmt(); use objc_object_type instead of objc_id_type. (build_next_objc_exception_stuff): Call create_field_decl() instead of create_builtin_decl(); construct type directly instead of calling groktypename(); use OBJC_VOID_AT_END to mark end of function parameters. (build_private_template): Adjust call to get_class_ivars(); build a type directly instead of via groktypename(). (build_protocol_template, build_method_prototype_list_template, build_method_prototype_template, build_category_template, build_selector_template, build_class_template, build_super_template, build_ivar_template, build_ivar_list_template, build_method_list_template, build_method_template): Call create_field_decl() instead of grokfield(). (objc_method_parm_type): Do not call groktypename(). (generate_descriptor_table): Call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(). (generate_method_descriptors, build_protocol_initializer, generate_dispatch_tables, build_category_initializer, build_shared_structure_initializer): Do not call groktypename(). (generate_protocols): Call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(); do not call groktypename(). (error_with_ivar): Remove last parameter. (check_ivars): Do not iterate ovar CLASS_RAW_IVARS lists in addition to CLASS_IVARS lists; adjust calls to error_with_ivar(). (generate_ivar_lists): Convert one of the initializer elements; do not call groktypename(). (get_arg_type_list, start_method_def, gen_method_def): Account for new representation of variable arguments and '...' in Objective-C methods; add Objective-C++ impedance matching code. (is_objc_type_qualifier): Remove function. (adjust_type_for_id_default): Simplify; there is no longer a need to wade through declspecs. (lookup_interface, start_class, continue_class, finish_class, start_method_def, start_protocol, build_method_decl, objc_add_method, add_instance_variable, build_ivar_reference, is_ivar, is_private, get_super_receiver, objc_build_finally_epilogue): Make into static functions. (receiver_is_class_object): Use new IS_CLASS() macro. (objc_build_message_expr): Tweak ObjC++ message argument handling; call objc_finish_message_expr() instead of finish_message_expr(). (finish_message_expr): Rename to objc_finish_message_expr(); use OBJC_TYPE_NAME and OBJC_SET_TYPE_NAME macros instead of TYPE_NAME. call gen_type_name() instead of gen_declaration(); call objc_is_id() instead of using IS_ID and IS_CLASS; Use objc_class_name instead of calling get_identifier("Class"); handle CONVERT_EXPRs in receiver. (build_objc_method_call, warn_with_method): Do not call groktypename(). (build_ivar_reference): Call convert() instead of clobbering in a type. (hash_init): Initialize string_htab hash table. (add_instance_variable): Simplify parameter list; do not call grokfield(); do not populate CLASS_IVARS list. (start_class): Check for the existence of super class, if one was specified. (continue_class): Use CLASS_RAW_IVARS rather than CLASS_IVARS; do not call build_class_template(); adjust call to get_class_ivars(); call build_decl(), pushdecl() and finish_decl() instead of define_decl(). (finish_class): Call build_decl(), pushdecl() and finish_decl() instead of define_decl(). (add_protocols): Use PROTOCOL_BINFO_ELTS for the tree vector size. (start_protocol): Do not call build_protocol_template(); use PROTOCOL_BINFO_ELTS for the tree vector size. (encode_type_qualifiers): Do not handle the 'const' qualifier here. (encode_pointer): Encode 'const char *' as 'r*', for backwards compatibility. (encode_array): Use HOST_WIDE_INT_PRINT_DEC instead of "%ld". (encode_type): Handle the 'const' qualifier here. (objc_parmlist): New global variable, sued by objc_push_parm and objc_get_parm_info(). (objc_push_parm, objc_get_parm_info): New functions. (objc_expr_last): Remove function. (synth_self_and_ucmd_args): For instance methods, use the instance type for 'self'; call objc_push_parm() instead of push_parm_decl(). (start_method_def): Do not call push_scope(), declare_parm_level(), pop_scope(), push_parm_decl(), store_parm_decls() or objc_expr_last(); just use objc_push_parm() and objc_get_parm_info(). (comp_method_with_proto): Remove function. (objc_types_are_equivalent): Strip away indirections before comparing underlying types. (comp_proto_with_proto): Do not call groktypename(); types are no longer in raw declspec format. (objc_start_function): New function. (really_start_method): Call comp_proto_with_proto() instead of comp_method_with_proto(); call objc_start_function() instead of hand-crafting a function declarator. (continue_method_def, objc_expand_function_end): Remove functions. (get_super_receiver): Call objc_get_current_scope() instead of get_current_scope(); reference 'super_class' field (instead of 'class'). (finish_method_def): Rename to objc_finish_method_definition() and add a function decl parameter; move method encoding call from objc_expand_function_end(). (is_complex_decl, adorn_decl, gen_declarator, gen_declspecs, gen_declaration_1): Remove functions. (tmpbuf, RAW_DECLSPEC): Remove. (gen_declaration): Remove second parameter; simplify to deal with TYPE_P nodes instead of raw declspecs. (gen_type_name, gen_type_name_0): New functions. (gen_method_decl): Remove second parameter; call gen_type_name() instead of gen_declaration_1(). (dump_interface): Adjust calls to gen_declaration() and gen_method_decl(); do not allocate a separate string buffer. (init_objc): Allocate a larger string buffer to accommodate dump_interface(); adjust call to build_module_descriptor(); add call to build_module_initializer_routine() for the GNU runtime. (generate_classref_translation_entry): Do not call start_decl(); call finish_var_decl() instead of finish_decl(); call convert() instead of build_c_cast(). * objc-act.h (CLASS_OWN_IVARS): Remove accessor. (CLASS_BINFO_ELTS): Reduce from 6 to 5, now that CLASS_OWN_IVARS is gone. (OCTI_GNU_INIT_DECL, GNU_INIT_decl): New. (OCTI_ELLIPSIS_NODE, objc_ellipsis_node): Remove. (OCTI_ID_ID, id_type, objc_id_id): Rename to OCTI_ID_NAME, objc_object_type and objc_object_name, respectively. (OCTI_CLS_REF, OCTI_CLASS_NAME, objc_class_reference, objc_class_name): New. (IS_CLASS): New macro. (IS_ID, IS_SUPER): Robustify. (OCTI_EXECCLASS_DECL, execclass_decl): New. (finish_file, start_class, continue_class, finish_class, start_method_def, continue_method_def, finish_method_def, start_protocol, finish_protocol, objc_build_throw_stmt, objc_build_try_catch_finally_stmt, objc_build_synchronized_prologue, objc_build_synchronized_epilogue, objc_build_try_prologue, objc_build_try_epilogue, objc_build_catch_stmt, objc_build_catch_epilogue, objc_build_finally_prologue, objc_build_finally_epilogue, is_ivar, is_private, is_public, add_instance_variable, objc_add_method, get_super_receiver, objc_clear_super_receiver, get_class_ivars_from_name, get_class_reference, get_static_reference, get_object_reference, build_message_expr, finish_message_expr, build_selector_expr, build_ivar_reference, build_keyword_decl, build_method_decl, build_protocol_expr, build_objc_string_object, objc_declare_alias, objc_declare_class, objc_declare_protocols, objc_comptypes, objc_check_decl, build_encode_expr): Remove prototypes. (imp_count, cat_count): Make GGC-aware. (OBJC_SET_TYPE_NAME): New macro. From-SVN: r87168
2004-09-08 02:49:44 +02:00
if (CLASS_RAW_IVARS (class))
1992-01-18 00:15:38 +01:00
check_ivars (implementation_template, class);
/* code generation */
Makefile.in (c-parse.o): Depend on $(C_COMMON_H). [gcc/ChangeLog] 2004-09-07 Ziemowit Laski <zlaski@apple.com> * Makefile.in (c-parse.o): Depend on $(C_COMMON_H). * c-parse.in: Include c-common.h instead of objc-act.h. (ivar_decl_list, ivar_decls, ivar_decl, ivars, ivar_declarator, myparms, myparm): Remove %type declarations. (methodtype, optparms, OBJC_TYPE_QUAL, objc_quals, objc_qual, objc_typename, objc_try_catch_stmt, optellipsis): Add %type declarations. (objc_inherit_code, objc_public_flag): Remove. (typespec_nonreserved_nonattr): Call objc_get_protocol_qualified_type() instead of get_static_reference() and get_protocol_reference(). (stmt_nocomp): Call grokparm() on @catch parameter. (objcdef): Move semantic action to objc_finish_implementation(). (classdef): Move semantic action to objc_start_class_interface(), objc_continue_interface(), objc_finish_interface(), objc_start_class_implementation(), objc_continue_implementation(), objc_start_category_interface() and objc_start_category_implementation(). (protocoldef): Move semantic actions to objc_start_protocol() and objc_finish_interface(). (ivar_decl_list): Remove nonterminal. (visibility_spec): Move semantic actions to objc_set_visibility(). (ivar_decls): Remove assignment to $$. (ivar_decl): Rephrase in terms of component_decl; call objc_add_instance_variable(). (ivars, ivar_declarator): Remove nonterminals. (opt_semi): New nonterminal. (methodtype): Remove semantic actions. (methoddef): Move semantic actions to objc_set_method_type(), objc_start_method_definition() and objc_finish_method_definition(). (methodproto): Move semantic actions to objc_set_method_type() and objc_add_method_declaration(). (methoddecl): Use objc_typename instead of typename; move semantic actions to objc_build_method_signature(). (optarglist, myxdecls, mydecl, myparms, myparm): Remove nonterminals. (optparmlist): Express in terms of optparms and optellipsis. (optparms, optellipsis, objc_qual, objc_quals, objc_typename): New nonterminals. (keyworddecl): Use objc_typename instead of typename. (rid_to_yy): Mark RID_IN, RID_OUT, RID_INOUT, RID_BYCOPY, RID_BYREF and RID_ONEWAY as returning OBJC_TYPE_QUAL to yyparse(). [gcc/objc/ChangeLog] 2004-09-07 Ziemowit Laski <zlaski@apple.com> * Make-lang.in (objc/objc-parse.o): Depend on $(C_COMMON_H) instead of objc/objc-act.h. (objc/objc-act.o): Depend on $(HASHTAB_H). * objc-act.c: Include hashtab.h; in ObjC++ mode, include cp-tree.h and objcp-decl.h instead of c-tree.h. (build_module_descriptor, get_class_ivars, synth_id_with_class_suffix, error_with_ivar, gen_method_decl, gen_declaration, setup_string_decl, build_protocol_template): Adjust prototypes. (build_module_initializer_routine, start_class, continue_class, finish_class, start_method_def, objc_start_function, start_protocol, build_method_decl, objc_add_method, add_instance_variable, build_ivar_reference, is_ivar, is_private, get_super_receiver, build_selector_table_decl, objc_push_parm, objc_get_parm_info, gen_type_name, gen_type_name_0, start_var_decl, finish_var_decl, create_field_decl): New prototypes. (objc_expand_function_end, comp_method_with_proto, objc_expr_last, gen_declaration_1, gen_declarator, is_complex_decl, adorn_decl, define_decl, create_builtin_decl, gen_declspecs): Remove prototypes. (TYPE_ID): Rename to OBJECT_TYPEDEF_NAME. (CLASS_TYPEDEF_NAME): New. (TAG_EXECCLASS): Change from a global variable to a #define. (TAG_RETURN_STRUCT): Delete. (TAG_GNUINIT): New, holds '__objc_gnu_init' name. (objc_inherit_code, objc_public_flag): New, moved from c-parse.in. (string_descriptor): New struct. (string_htab): New hash table. (string_hash, string_eq): New prototypes. (generate_struct_by_value_array): Call create_field_decl() instead of create_builtin_decl(). (objc_init): Do not initialize objc_ellipsis_node or TAG_EXECCLASS; In ObjC++ mode, call cxx_init() instead of c_objc_common_init(). (objc_finish_file): In ObjC++, call instantiate_pending_templates() and cp_finish_file(). (define_decl, get_static_reference, get_protocol_reference, create_builtin_decl): Remove functions. (objc_start_class_interface, objc_start_category_interface, objc_start_protocol, objc_continue_interface, objc_finish_interface, objc_start_class_implementation, objc_start_category_implementation, objc_continue_implementation, objc_finish_implementation, objc_set_visibility, objc_set_method_type, objc_build_method_signature, objc_add_method_declaration, objc_start_method_definition, objc_add_instance_variable, objc_get_protocol_qualified_type, create_field_decl, start_var_decl, finish_var_decl): New functions. (setup_string_decl): Simplify since it is only called once. (synth_module_prologue): Call build_class_template(); predefine 'id' and 'Class' as typedefs; rename 'temp_type' to 'type'; disable debug hooks for duration of function; fix GNU runtime messenger signatures to correspond to reality; forward-declare '__objc_exec_class' for the GNU runtime; call build_selector_table_decl(); in ObjC++ mode, generate 'extern "C" { ... }' wrappers around synthesized declarations; call build_protocol_template() and build_category_template(). (string_hash, string_eq): New functions. (objc_build_string_object): Check metaclass correctness only once; store string literals in hash table. (objc_build_constructor): Do not convert initializer elements; adjust for ObjC++ impedance mismatch. (build_objc_symtab_template): Call create_field_decl() instead of create_builtin_decl(). (init_objc_symtab): Add missing conversion to initializer element. (build_metadata_decl): Call start_var_decl() instead of define_decl(). (generate_objc_symtab_decl): Do not call build_category_template(); call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(). (build_module_descriptor): Call create_field_decl() instead of grokfield(); call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(); always mark module descriptor as used; move GNU runtime-specific functionality to build_module_initializer_routine(). (build_module_initializer_routine): New function, broken off of build_module_descriptor(). (objc_static_init_needed_p, objc_generate_static_init_call): New functions. (generate_static_references, generate_strings, build_selector_translation_table, generate_descriptor_table, generate_ivars_list, generate_dispatch_table, generate_category): Call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(); build a type directly instead of via groktypename(). (build_selector_reference_decl, build_selector_table_decl, build_class_reference_decl, build_protocol_reference, generate_objc_image_info): Call start_var_decl() instead of build_decl(). (build_selector_reference): For GNU runtime, do not call build_selector_reference_decl(). (build_selector, build_typed_selector_reference): Always convert result to the selector type. (add_objc_string): Cast return value to 'char *'. (build_method_prototype_template, build_selector_template, build_method_template): Use actual selector type for fields pointing to selectors. (finish_objc): For GNU runtime, call build_module_initializer_routine() after build_module_descriptor(). (generate_protocol_list, generate_shared_structures): Call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(); build a type directly instead of via groktypename(). (synth_id_with_class_suffix): Return a string. (get_arg_type_list): For instance methods, use the instance type for 'self'; do not call groktypename_in_parm_context(). (build_objc_string_decl): Squash redeclaration errors in ObjC++. (objc_is_class_name): Use OBJC_TYPE_NAME instead of TYPE_NAME; handle RECORD_TYPEs in ObjC as well as ObjC++. (objc_is_id): New function. (objc_is_object_ptr): Return the canonical type node. (objc_get_class_ivars): Simplify using get_class_ivars(). (get_class_ivars): Remove second parameter; create a fresh copy of the ivar list for each call; do not check for existence of super class. (objc_eh_runtime_type): Mark #ifndef OBJCPLUS. (objc_init_exceptions): When using SJLJ-style exceptions, require the use of '-fobjc-exceptions' flag; do not require it for DWARF-style exceptions. (objc_build_exc_ptr, next_sjlj_build_try_catch_finally): Use objc_object_type instead of objc_id_type. (objc_begin_catch_clause): Convert the incoming PARM_DECL into a VAR_DECL before placing it in the appropriate scope; do not call define_decl(); adjust call to c_begin_compound_stmt(); use objc_object_type instead of objc_id_type. (build_next_objc_exception_stuff): Call create_field_decl() instead of create_builtin_decl(); construct type directly instead of calling groktypename(); use OBJC_VOID_AT_END to mark end of function parameters. (build_private_template): Adjust call to get_class_ivars(); build a type directly instead of via groktypename(). (build_protocol_template, build_method_prototype_list_template, build_method_prototype_template, build_category_template, build_selector_template, build_class_template, build_super_template, build_ivar_template, build_ivar_list_template, build_method_list_template, build_method_template): Call create_field_decl() instead of grokfield(). (objc_method_parm_type): Do not call groktypename(). (generate_descriptor_table): Call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(). (generate_method_descriptors, build_protocol_initializer, generate_dispatch_tables, build_category_initializer, build_shared_structure_initializer): Do not call groktypename(). (generate_protocols): Call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(); do not call groktypename(). (error_with_ivar): Remove last parameter. (check_ivars): Do not iterate ovar CLASS_RAW_IVARS lists in addition to CLASS_IVARS lists; adjust calls to error_with_ivar(). (generate_ivar_lists): Convert one of the initializer elements; do not call groktypename(). (get_arg_type_list, start_method_def, gen_method_def): Account for new representation of variable arguments and '...' in Objective-C methods; add Objective-C++ impedance matching code. (is_objc_type_qualifier): Remove function. (adjust_type_for_id_default): Simplify; there is no longer a need to wade through declspecs. (lookup_interface, start_class, continue_class, finish_class, start_method_def, start_protocol, build_method_decl, objc_add_method, add_instance_variable, build_ivar_reference, is_ivar, is_private, get_super_receiver, objc_build_finally_epilogue): Make into static functions. (receiver_is_class_object): Use new IS_CLASS() macro. (objc_build_message_expr): Tweak ObjC++ message argument handling; call objc_finish_message_expr() instead of finish_message_expr(). (finish_message_expr): Rename to objc_finish_message_expr(); use OBJC_TYPE_NAME and OBJC_SET_TYPE_NAME macros instead of TYPE_NAME. call gen_type_name() instead of gen_declaration(); call objc_is_id() instead of using IS_ID and IS_CLASS; Use objc_class_name instead of calling get_identifier("Class"); handle CONVERT_EXPRs in receiver. (build_objc_method_call, warn_with_method): Do not call groktypename(). (build_ivar_reference): Call convert() instead of clobbering in a type. (hash_init): Initialize string_htab hash table. (add_instance_variable): Simplify parameter list; do not call grokfield(); do not populate CLASS_IVARS list. (start_class): Check for the existence of super class, if one was specified. (continue_class): Use CLASS_RAW_IVARS rather than CLASS_IVARS; do not call build_class_template(); adjust call to get_class_ivars(); call build_decl(), pushdecl() and finish_decl() instead of define_decl(). (finish_class): Call build_decl(), pushdecl() and finish_decl() instead of define_decl(). (add_protocols): Use PROTOCOL_BINFO_ELTS for the tree vector size. (start_protocol): Do not call build_protocol_template(); use PROTOCOL_BINFO_ELTS for the tree vector size. (encode_type_qualifiers): Do not handle the 'const' qualifier here. (encode_pointer): Encode 'const char *' as 'r*', for backwards compatibility. (encode_array): Use HOST_WIDE_INT_PRINT_DEC instead of "%ld". (encode_type): Handle the 'const' qualifier here. (objc_parmlist): New global variable, sued by objc_push_parm and objc_get_parm_info(). (objc_push_parm, objc_get_parm_info): New functions. (objc_expr_last): Remove function. (synth_self_and_ucmd_args): For instance methods, use the instance type for 'self'; call objc_push_parm() instead of push_parm_decl(). (start_method_def): Do not call push_scope(), declare_parm_level(), pop_scope(), push_parm_decl(), store_parm_decls() or objc_expr_last(); just use objc_push_parm() and objc_get_parm_info(). (comp_method_with_proto): Remove function. (objc_types_are_equivalent): Strip away indirections before comparing underlying types. (comp_proto_with_proto): Do not call groktypename(); types are no longer in raw declspec format. (objc_start_function): New function. (really_start_method): Call comp_proto_with_proto() instead of comp_method_with_proto(); call objc_start_function() instead of hand-crafting a function declarator. (continue_method_def, objc_expand_function_end): Remove functions. (get_super_receiver): Call objc_get_current_scope() instead of get_current_scope(); reference 'super_class' field (instead of 'class'). (finish_method_def): Rename to objc_finish_method_definition() and add a function decl parameter; move method encoding call from objc_expand_function_end(). (is_complex_decl, adorn_decl, gen_declarator, gen_declspecs, gen_declaration_1): Remove functions. (tmpbuf, RAW_DECLSPEC): Remove. (gen_declaration): Remove second parameter; simplify to deal with TYPE_P nodes instead of raw declspecs. (gen_type_name, gen_type_name_0): New functions. (gen_method_decl): Remove second parameter; call gen_type_name() instead of gen_declaration_1(). (dump_interface): Adjust calls to gen_declaration() and gen_method_decl(); do not allocate a separate string buffer. (init_objc): Allocate a larger string buffer to accommodate dump_interface(); adjust call to build_module_descriptor(); add call to build_module_initializer_routine() for the GNU runtime. (generate_classref_translation_entry): Do not call start_decl(); call finish_var_decl() instead of finish_decl(); call convert() instead of build_c_cast(). * objc-act.h (CLASS_OWN_IVARS): Remove accessor. (CLASS_BINFO_ELTS): Reduce from 6 to 5, now that CLASS_OWN_IVARS is gone. (OCTI_GNU_INIT_DECL, GNU_INIT_decl): New. (OCTI_ELLIPSIS_NODE, objc_ellipsis_node): Remove. (OCTI_ID_ID, id_type, objc_id_id): Rename to OCTI_ID_NAME, objc_object_type and objc_object_name, respectively. (OCTI_CLS_REF, OCTI_CLASS_NAME, objc_class_reference, objc_class_name): New. (IS_CLASS): New macro. (IS_ID, IS_SUPER): Robustify. (OCTI_EXECCLASS_DECL, execclass_decl): New. (finish_file, start_class, continue_class, finish_class, start_method_def, continue_method_def, finish_method_def, start_protocol, finish_protocol, objc_build_throw_stmt, objc_build_try_catch_finally_stmt, objc_build_synchronized_prologue, objc_build_synchronized_epilogue, objc_build_try_prologue, objc_build_try_epilogue, objc_build_catch_stmt, objc_build_catch_epilogue, objc_build_finally_prologue, objc_build_finally_epilogue, is_ivar, is_private, is_public, add_instance_variable, objc_add_method, get_super_receiver, objc_clear_super_receiver, get_class_ivars_from_name, get_class_reference, get_static_reference, get_object_reference, build_message_expr, finish_message_expr, build_selector_expr, build_ivar_reference, build_keyword_decl, build_method_decl, build_protocol_expr, build_objc_string_object, objc_declare_alias, objc_declare_class, objc_declare_protocols, objc_comptypes, objc_check_decl, build_encode_expr): Remove prototypes. (imp_count, cat_count): Make GGC-aware. (OBJC_SET_TYPE_NAME): New macro. From-SVN: r87168
2004-09-08 02:49:44 +02:00
#ifdef OBJCPLUS
push_lang_context (lang_name_c);
#endif
1992-01-18 00:15:38 +01:00
objc-act.c (build_private_template): Change to return 'void'... [gcc/objc/ChangeLog] 2004-12-15 Ziemowit Laski <zlaski@apple.com> * objc-act.c (build_private_template): Change to return 'void'; do not set ivar_context, uprivate_record or objc_instance_type. (objc_comptypes, gen_type_name_0): For types 'id' and 'Class', retrieve protocol list from the pointee rather than the pointer itself; check TYPE_HAS_OBJC_INFO(...) precondition before accessing TYPE_OBJC_PROTOCOL_LIST. (objc_get_protocol_qualified_type): For types 'id' and 'Class', construct a variant of the pointee as well as the pointer, and store protocol information in the former. When creating variants of RECORD_TYPEs, clone their TYPE_LANG_SPECIFIC fields and propagate TYPE_OBJC_INTERFACE information. (objc_declare_class): If a TYPE_DECL is looked up, retrieve the underlying RECORD_TYPE to check for presence of TYPE_OBJC_INTERFACE; for newly-created RECORD_TYPEs, create a tentative TYPE_OBJC_INTERFACE holding an IDENTIFIER_NODE. (objc_finish_message_expr): Check TYPE_HAS_OBJC_INFO(...) before accessing TYPE_OBJC_PROTOCOL_LIST; Use TYPE_OBJC_INTERFACE instead of calling lookup_interface(); allow for TYPE_OBJC_INTERFACE holding an IDENTIFIER_NODE (meaning a @class forward-declaration only). (objc_is_public): Check TYPE_OBJC_INTERFACE instead of calling lookup_interface(). (continue_class): For @implementations, set ivar_context, uprivate_record and objc_instance_type, for @interfaces, call build_private_template(). (encode_pointer): Check TYPE_HAS_OBJC_INFO(...) before accessing TYPE_OBJC_INTERFACE. (objc_types_are_equivalent): Check TYPE_HAS_OBJC_INFO(...) before accessing TYPE_OBJC_PROTOCOL_LIST. * objc-act.h (OBJC_INFO_SLOT_ELTS, TYPE_OBJC_INFO, INIT_TYPE_OBJC_INFO, DUP_TYPE_OBJC_INFO, ALLOC_OBJC_TYPE_LANG_SPECIFIC, SIZEOF_OBJC_TYPE_LANG_SPECIFIC): New macros. (TYPE_OBJC_INTERFACE): Replaces TREE_STATIC_INSTANCE and now points to an actual @interface; stored in TYPE_LANG_SPECIFIC(...). (TYPE_OBJC_PROTOCOL_LIST): Replaces TYPE_PROTOCOL_LIST; stored in TYPE_LANG_SPECIFIC(...). (TREE_STATIC_INSTANCE, TYPE_PROTOCOL_LIST): Delete. (IS_ID, IS_CLASS, IS_PROTOCOL_QUALIFIED_UNTYPED, IS_SUPER, TYPED_OBJECT): Check for POINTER_TYPE rather than POINTER_TYPE_P; adjust for use of TYPE_OBJC_INTERFACE and TYPE_OBJC_PROTOCOL_LIST instead of TREE_STATIC_INSTANCE and TYPE_PROTOCOL_LIST. From-SVN: r92239
2004-12-16 02:10:38 +01:00
build_private_template (implementation_template);
uprivate_record = CLASS_STATIC_TEMPLATE (implementation_template);
objc_instance_type = build_pointer_type (uprivate_record);
1992-01-18 00:15:38 +01:00
imp_entry = (struct imp_entry *) ggc_alloc (sizeof (struct imp_entry));
1992-01-18 00:15:38 +01:00
imp_entry->next = imp_list;
imp_entry->imp_context = class;
imp_entry->imp_template = implementation_template;
1992-01-18 00:15:38 +01:00
synth_forward_declarations ();
imp_entry->class_decl = UOBJC_CLASS_decl;
imp_entry->meta_decl = UOBJC_METACLASS_decl;
Yet more Objective-C++... * objc-act.c (objc_finish_try_stmt): Add return value. (objc_build_synchronized): Likewise. * objc-act.c (objc_is_gcable_type): Add. (objc_substitute_decl): Add. (objc_build_ivar_assignment): Add. (objc_build_global_assignment): Add. (objc_build_strong_cast_assignment): Add. (objc_is_ivar_reference_p): Add. (objc_is_global_reference_p): Add. (objc_generate_write_barrier): Add. (objc_rewrite_function_call): Add. (objc_gimplify_expr): Add Objective-C++ support. * objc-act.h (ALLOC_OBJC_TYPE_LANG_SPECIFIC): Likewise. (SIZEOF_OBJC_TYPE_LANG_SPECIFIC): Add. (INIT_TYPE_OBJC_INFO): Add Objective-C++ support. (DUP_TYPE_OBJC_INFO): Likewise. (struct imp_entry): Add field has_cxx_cdtors. (struct imp_entry *imp_list): Add OCTI_UMSG_FAST_DECL, OCTI_METH_LIST_TEMPL, OCTI_METH_PROTO_LIST_TEMPL, OCTI_IVAR_LIST_TEMPL, OCTI_ASSIGN_IVAR_DECL, OCTI_ASSIGN_IVAR_FAST_DECL, OCTI_ASSIGN_GLOBAL_DECL, OCTI_ASSIGN_STRONGCAST_DECL. (umsg_fast_decl): Add. (objc_assign_ivar_decl): Add. (objc_assign_ivar_fast_decl): Add. (objc_assign_global_decl): Add. (objc_assign_strong_cast_decl): Add. (objc_method_list_ptr): Add. (objc_method_proto_list_ptr): Add. (objc_ivar_list_ptr): Add. * objc-act.c (should_call_super_dealloc): Add. (OBJC_VERSION): Bump to 6. (objc_is_gcable_type): Add. (objc_substitute_decl): Add. (objc_build_ivar_assignment): Add. (objc_build_global_assignment): Add. (objc_build_strong_cast_assignment): Add. (objc_is_gcable_p): Add. (objc_is_ivar_reference_p): Add. (objc_is_global_reference_p): Add. (generate_shared_structures): Add flags parameter. (objc_generate_cxx_ctor_or_dtor): Add. (objc_generate_cxx_cdtors): Add. (add_class): Add name parameter. (objc_types_share_size_and_alignment): Add. (comp_proto_with_proto): Add strict parameter. (CLS_HAS_CXX_STRUCTORS): Add. (TAG_ASSIGNIVAR): Add. (TAG_ASSIGNGLOBAL): Add. (TAG_ASSIGNSTRONGCAST): Add. (TAG_MSGSEND_FAST): Add. (TAG_ASSIGNIVAR_FAST): Add. (TAG_CXX_CONSTRUCT): Add. (TAG_CXX_DESTRUCT): Add. (OBJC_LOOKUP_CLASS): Add. (OBJC_LOOKUP_NO_SUPER): Add. (objc_finish_file): Add pch support. (objc_finish_implementation): Add Objective-C++ support. (synth_module_prologue): Likewise. (synth_module_prologue): Add fast dispatching. (objc_get_class_reference): Add Objective-C++ support. (objc_generate_write_barrier): Likewise. (next_sjlj_build_enter_and_setjmp): Likewise. (objc_begin_try_stmt): Likewise. (build_next_objc_exception_stuff): Add fast ivar support. (build_private_template): Mark the record as used so debug information is generated. (build_protocol_template): Add Objective-C++ support. (objc_method_parm_type) Likewise. (objc_generate_cxx_ctor_or_dtor): Likewise. (objc_generate_cxx_cdtors): Likewise. (build_protocol_initializer): Likewise. (build_category_template): Likewise. (build_class_template): Likewise. (build_method_list_template): Likewise. (build_category_initializer): Likewise. (build_shared_structure_initializer): Likewise. (objc_finish_message_expr): Likewise. (build_objc_method_call): Add fast dispatch support. (lookup_method_static): Add support to end search at superclasses. (add_method_to_hash_list): Add strict parameter to comp_proto_with_proto. (objc_add_method): Likewise. (objc_add_method): Also set the interface_value. (add_instance_variable): Add Objective-C++ support. (objc_is_public): Likewise. (start_class): Likewise. (continue_class): Likewise. (encode_aggregate_within): Likewise. (start_method_def): Likewise. (objc_start_function): Clear current_function_returns_value and current_function_returns_null. (really_start_method): Add Objective-C++ support. (objc_finish_method_definition): Add warning for missing [super dealloc]. (finish_objc): Add Objective-C++ support. (generate_objc_image_info): Likewise. (objc_lookup_ivar): Likewise. * objc-act.h (TYPE_HAS_OBJC_INFO): Likewise. (INIT_TYPE_OBJC_INFO): Likewise. (DUP_TYPE_OBJC_INFO): Likewise. From-SVN: r99857
2005-05-17 22:07:08 +02:00
imp_entry->has_cxx_cdtors = 0;
1992-01-18 00:15:38 +01:00
1996-07-04 00:07:53 +02:00
/* Append to front and increment count. */
imp_list = imp_entry;
if (TREE_CODE (class) == CLASS_IMPLEMENTATION_TYPE)
1992-01-18 00:15:38 +01:00
imp_count++;
else
cat_count++;
Makefile.in (c-parse.o): Depend on $(C_COMMON_H). [gcc/ChangeLog] 2004-09-07 Ziemowit Laski <zlaski@apple.com> * Makefile.in (c-parse.o): Depend on $(C_COMMON_H). * c-parse.in: Include c-common.h instead of objc-act.h. (ivar_decl_list, ivar_decls, ivar_decl, ivars, ivar_declarator, myparms, myparm): Remove %type declarations. (methodtype, optparms, OBJC_TYPE_QUAL, objc_quals, objc_qual, objc_typename, objc_try_catch_stmt, optellipsis): Add %type declarations. (objc_inherit_code, objc_public_flag): Remove. (typespec_nonreserved_nonattr): Call objc_get_protocol_qualified_type() instead of get_static_reference() and get_protocol_reference(). (stmt_nocomp): Call grokparm() on @catch parameter. (objcdef): Move semantic action to objc_finish_implementation(). (classdef): Move semantic action to objc_start_class_interface(), objc_continue_interface(), objc_finish_interface(), objc_start_class_implementation(), objc_continue_implementation(), objc_start_category_interface() and objc_start_category_implementation(). (protocoldef): Move semantic actions to objc_start_protocol() and objc_finish_interface(). (ivar_decl_list): Remove nonterminal. (visibility_spec): Move semantic actions to objc_set_visibility(). (ivar_decls): Remove assignment to $$. (ivar_decl): Rephrase in terms of component_decl; call objc_add_instance_variable(). (ivars, ivar_declarator): Remove nonterminals. (opt_semi): New nonterminal. (methodtype): Remove semantic actions. (methoddef): Move semantic actions to objc_set_method_type(), objc_start_method_definition() and objc_finish_method_definition(). (methodproto): Move semantic actions to objc_set_method_type() and objc_add_method_declaration(). (methoddecl): Use objc_typename instead of typename; move semantic actions to objc_build_method_signature(). (optarglist, myxdecls, mydecl, myparms, myparm): Remove nonterminals. (optparmlist): Express in terms of optparms and optellipsis. (optparms, optellipsis, objc_qual, objc_quals, objc_typename): New nonterminals. (keyworddecl): Use objc_typename instead of typename. (rid_to_yy): Mark RID_IN, RID_OUT, RID_INOUT, RID_BYCOPY, RID_BYREF and RID_ONEWAY as returning OBJC_TYPE_QUAL to yyparse(). [gcc/objc/ChangeLog] 2004-09-07 Ziemowit Laski <zlaski@apple.com> * Make-lang.in (objc/objc-parse.o): Depend on $(C_COMMON_H) instead of objc/objc-act.h. (objc/objc-act.o): Depend on $(HASHTAB_H). * objc-act.c: Include hashtab.h; in ObjC++ mode, include cp-tree.h and objcp-decl.h instead of c-tree.h. (build_module_descriptor, get_class_ivars, synth_id_with_class_suffix, error_with_ivar, gen_method_decl, gen_declaration, setup_string_decl, build_protocol_template): Adjust prototypes. (build_module_initializer_routine, start_class, continue_class, finish_class, start_method_def, objc_start_function, start_protocol, build_method_decl, objc_add_method, add_instance_variable, build_ivar_reference, is_ivar, is_private, get_super_receiver, build_selector_table_decl, objc_push_parm, objc_get_parm_info, gen_type_name, gen_type_name_0, start_var_decl, finish_var_decl, create_field_decl): New prototypes. (objc_expand_function_end, comp_method_with_proto, objc_expr_last, gen_declaration_1, gen_declarator, is_complex_decl, adorn_decl, define_decl, create_builtin_decl, gen_declspecs): Remove prototypes. (TYPE_ID): Rename to OBJECT_TYPEDEF_NAME. (CLASS_TYPEDEF_NAME): New. (TAG_EXECCLASS): Change from a global variable to a #define. (TAG_RETURN_STRUCT): Delete. (TAG_GNUINIT): New, holds '__objc_gnu_init' name. (objc_inherit_code, objc_public_flag): New, moved from c-parse.in. (string_descriptor): New struct. (string_htab): New hash table. (string_hash, string_eq): New prototypes. (generate_struct_by_value_array): Call create_field_decl() instead of create_builtin_decl(). (objc_init): Do not initialize objc_ellipsis_node or TAG_EXECCLASS; In ObjC++ mode, call cxx_init() instead of c_objc_common_init(). (objc_finish_file): In ObjC++, call instantiate_pending_templates() and cp_finish_file(). (define_decl, get_static_reference, get_protocol_reference, create_builtin_decl): Remove functions. (objc_start_class_interface, objc_start_category_interface, objc_start_protocol, objc_continue_interface, objc_finish_interface, objc_start_class_implementation, objc_start_category_implementation, objc_continue_implementation, objc_finish_implementation, objc_set_visibility, objc_set_method_type, objc_build_method_signature, objc_add_method_declaration, objc_start_method_definition, objc_add_instance_variable, objc_get_protocol_qualified_type, create_field_decl, start_var_decl, finish_var_decl): New functions. (setup_string_decl): Simplify since it is only called once. (synth_module_prologue): Call build_class_template(); predefine 'id' and 'Class' as typedefs; rename 'temp_type' to 'type'; disable debug hooks for duration of function; fix GNU runtime messenger signatures to correspond to reality; forward-declare '__objc_exec_class' for the GNU runtime; call build_selector_table_decl(); in ObjC++ mode, generate 'extern "C" { ... }' wrappers around synthesized declarations; call build_protocol_template() and build_category_template(). (string_hash, string_eq): New functions. (objc_build_string_object): Check metaclass correctness only once; store string literals in hash table. (objc_build_constructor): Do not convert initializer elements; adjust for ObjC++ impedance mismatch. (build_objc_symtab_template): Call create_field_decl() instead of create_builtin_decl(). (init_objc_symtab): Add missing conversion to initializer element. (build_metadata_decl): Call start_var_decl() instead of define_decl(). (generate_objc_symtab_decl): Do not call build_category_template(); call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(). (build_module_descriptor): Call create_field_decl() instead of grokfield(); call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(); always mark module descriptor as used; move GNU runtime-specific functionality to build_module_initializer_routine(). (build_module_initializer_routine): New function, broken off of build_module_descriptor(). (objc_static_init_needed_p, objc_generate_static_init_call): New functions. (generate_static_references, generate_strings, build_selector_translation_table, generate_descriptor_table, generate_ivars_list, generate_dispatch_table, generate_category): Call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(); build a type directly instead of via groktypename(). (build_selector_reference_decl, build_selector_table_decl, build_class_reference_decl, build_protocol_reference, generate_objc_image_info): Call start_var_decl() instead of build_decl(). (build_selector_reference): For GNU runtime, do not call build_selector_reference_decl(). (build_selector, build_typed_selector_reference): Always convert result to the selector type. (add_objc_string): Cast return value to 'char *'. (build_method_prototype_template, build_selector_template, build_method_template): Use actual selector type for fields pointing to selectors. (finish_objc): For GNU runtime, call build_module_initializer_routine() after build_module_descriptor(). (generate_protocol_list, generate_shared_structures): Call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(); build a type directly instead of via groktypename(). (synth_id_with_class_suffix): Return a string. (get_arg_type_list): For instance methods, use the instance type for 'self'; do not call groktypename_in_parm_context(). (build_objc_string_decl): Squash redeclaration errors in ObjC++. (objc_is_class_name): Use OBJC_TYPE_NAME instead of TYPE_NAME; handle RECORD_TYPEs in ObjC as well as ObjC++. (objc_is_id): New function. (objc_is_object_ptr): Return the canonical type node. (objc_get_class_ivars): Simplify using get_class_ivars(). (get_class_ivars): Remove second parameter; create a fresh copy of the ivar list for each call; do not check for existence of super class. (objc_eh_runtime_type): Mark #ifndef OBJCPLUS. (objc_init_exceptions): When using SJLJ-style exceptions, require the use of '-fobjc-exceptions' flag; do not require it for DWARF-style exceptions. (objc_build_exc_ptr, next_sjlj_build_try_catch_finally): Use objc_object_type instead of objc_id_type. (objc_begin_catch_clause): Convert the incoming PARM_DECL into a VAR_DECL before placing it in the appropriate scope; do not call define_decl(); adjust call to c_begin_compound_stmt(); use objc_object_type instead of objc_id_type. (build_next_objc_exception_stuff): Call create_field_decl() instead of create_builtin_decl(); construct type directly instead of calling groktypename(); use OBJC_VOID_AT_END to mark end of function parameters. (build_private_template): Adjust call to get_class_ivars(); build a type directly instead of via groktypename(). (build_protocol_template, build_method_prototype_list_template, build_method_prototype_template, build_category_template, build_selector_template, build_class_template, build_super_template, build_ivar_template, build_ivar_list_template, build_method_list_template, build_method_template): Call create_field_decl() instead of grokfield(). (objc_method_parm_type): Do not call groktypename(). (generate_descriptor_table): Call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(). (generate_method_descriptors, build_protocol_initializer, generate_dispatch_tables, build_category_initializer, build_shared_structure_initializer): Do not call groktypename(). (generate_protocols): Call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(); do not call groktypename(). (error_with_ivar): Remove last parameter. (check_ivars): Do not iterate ovar CLASS_RAW_IVARS lists in addition to CLASS_IVARS lists; adjust calls to error_with_ivar(). (generate_ivar_lists): Convert one of the initializer elements; do not call groktypename(). (get_arg_type_list, start_method_def, gen_method_def): Account for new representation of variable arguments and '...' in Objective-C methods; add Objective-C++ impedance matching code. (is_objc_type_qualifier): Remove function. (adjust_type_for_id_default): Simplify; there is no longer a need to wade through declspecs. (lookup_interface, start_class, continue_class, finish_class, start_method_def, start_protocol, build_method_decl, objc_add_method, add_instance_variable, build_ivar_reference, is_ivar, is_private, get_super_receiver, objc_build_finally_epilogue): Make into static functions. (receiver_is_class_object): Use new IS_CLASS() macro. (objc_build_message_expr): Tweak ObjC++ message argument handling; call objc_finish_message_expr() instead of finish_message_expr(). (finish_message_expr): Rename to objc_finish_message_expr(); use OBJC_TYPE_NAME and OBJC_SET_TYPE_NAME macros instead of TYPE_NAME. call gen_type_name() instead of gen_declaration(); call objc_is_id() instead of using IS_ID and IS_CLASS; Use objc_class_name instead of calling get_identifier("Class"); handle CONVERT_EXPRs in receiver. (build_objc_method_call, warn_with_method): Do not call groktypename(). (build_ivar_reference): Call convert() instead of clobbering in a type. (hash_init): Initialize string_htab hash table. (add_instance_variable): Simplify parameter list; do not call grokfield(); do not populate CLASS_IVARS list. (start_class): Check for the existence of super class, if one was specified. (continue_class): Use CLASS_RAW_IVARS rather than CLASS_IVARS; do not call build_class_template(); adjust call to get_class_ivars(); call build_decl(), pushdecl() and finish_decl() instead of define_decl(). (finish_class): Call build_decl(), pushdecl() and finish_decl() instead of define_decl(). (add_protocols): Use PROTOCOL_BINFO_ELTS for the tree vector size. (start_protocol): Do not call build_protocol_template(); use PROTOCOL_BINFO_ELTS for the tree vector size. (encode_type_qualifiers): Do not handle the 'const' qualifier here. (encode_pointer): Encode 'const char *' as 'r*', for backwards compatibility. (encode_array): Use HOST_WIDE_INT_PRINT_DEC instead of "%ld". (encode_type): Handle the 'const' qualifier here. (objc_parmlist): New global variable, sued by objc_push_parm and objc_get_parm_info(). (objc_push_parm, objc_get_parm_info): New functions. (objc_expr_last): Remove function. (synth_self_and_ucmd_args): For instance methods, use the instance type for 'self'; call objc_push_parm() instead of push_parm_decl(). (start_method_def): Do not call push_scope(), declare_parm_level(), pop_scope(), push_parm_decl(), store_parm_decls() or objc_expr_last(); just use objc_push_parm() and objc_get_parm_info(). (comp_method_with_proto): Remove function. (objc_types_are_equivalent): Strip away indirections before comparing underlying types. (comp_proto_with_proto): Do not call groktypename(); types are no longer in raw declspec format. (objc_start_function): New function. (really_start_method): Call comp_proto_with_proto() instead of comp_method_with_proto(); call objc_start_function() instead of hand-crafting a function declarator. (continue_method_def, objc_expand_function_end): Remove functions. (get_super_receiver): Call objc_get_current_scope() instead of get_current_scope(); reference 'super_class' field (instead of 'class'). (finish_method_def): Rename to objc_finish_method_definition() and add a function decl parameter; move method encoding call from objc_expand_function_end(). (is_complex_decl, adorn_decl, gen_declarator, gen_declspecs, gen_declaration_1): Remove functions. (tmpbuf, RAW_DECLSPEC): Remove. (gen_declaration): Remove second parameter; simplify to deal with TYPE_P nodes instead of raw declspecs. (gen_type_name, gen_type_name_0): New functions. (gen_method_decl): Remove second parameter; call gen_type_name() instead of gen_declaration_1(). (dump_interface): Adjust calls to gen_declaration() and gen_method_decl(); do not allocate a separate string buffer. (init_objc): Allocate a larger string buffer to accommodate dump_interface(); adjust call to build_module_descriptor(); add call to build_module_initializer_routine() for the GNU runtime. (generate_classref_translation_entry): Do not call start_decl(); call finish_var_decl() instead of finish_decl(); call convert() instead of build_c_cast(). * objc-act.h (CLASS_OWN_IVARS): Remove accessor. (CLASS_BINFO_ELTS): Reduce from 6 to 5, now that CLASS_OWN_IVARS is gone. (OCTI_GNU_INIT_DECL, GNU_INIT_decl): New. (OCTI_ELLIPSIS_NODE, objc_ellipsis_node): Remove. (OCTI_ID_ID, id_type, objc_id_id): Rename to OCTI_ID_NAME, objc_object_type and objc_object_name, respectively. (OCTI_CLS_REF, OCTI_CLASS_NAME, objc_class_reference, objc_class_name): New. (IS_CLASS): New macro. (IS_ID, IS_SUPER): Robustify. (OCTI_EXECCLASS_DECL, execclass_decl): New. (finish_file, start_class, continue_class, finish_class, start_method_def, continue_method_def, finish_method_def, start_protocol, finish_protocol, objc_build_throw_stmt, objc_build_try_catch_finally_stmt, objc_build_synchronized_prologue, objc_build_synchronized_epilogue, objc_build_try_prologue, objc_build_try_epilogue, objc_build_catch_stmt, objc_build_catch_epilogue, objc_build_finally_prologue, objc_build_finally_epilogue, is_ivar, is_private, is_public, add_instance_variable, objc_add_method, get_super_receiver, objc_clear_super_receiver, get_class_ivars_from_name, get_class_reference, get_static_reference, get_object_reference, build_message_expr, finish_message_expr, build_selector_expr, build_ivar_reference, build_keyword_decl, build_method_decl, build_protocol_expr, build_objc_string_object, objc_declare_alias, objc_declare_class, objc_declare_protocols, objc_comptypes, objc_check_decl, build_encode_expr): Remove prototypes. (imp_count, cat_count): Make GGC-aware. (OBJC_SET_TYPE_NAME): New macro. From-SVN: r87168
2004-09-08 02:49:44 +02:00
#ifdef OBJCPLUS
pop_lang_context ();
#endif /* OBJCPLUS */
objc-act.c (objc_build_struct): New function. * objc-act.c (objc_build_struct): New function. (objc_derived_from_p): Likewise. (objc_build_component_ref): Likewise. (objc_copy_binfo): Likewise. (objc_xref_basetypes): Likewise. (objc_lookup_protocol): Likewise. (objc_compare_protocols): Likewise. (objc_volatilize_decl): Likewise. (encode_aggregate_fields): Likewise. (volatilized_hash): Likewise. (volatilized_eq): Likewise. (objc_compare_types): Likewise. (objc_type_quals_match): Likewise. (DERIVED_FROM_P): New ObjC macro, corresponding to C++ macro of same name. (get_class_ivars): Add second parameter indicating if entire hierarchy is desired. (struct volatilized_type): New type. (volatilized_htab): New hash table. (objc_types_compatible_p, objc_comptypes): Remove functions. (synth_module_prologue): Do not initialize 'unused_list'. (objc_get_class_reference): Fix ObjC++ impedance mismatches. (objc_declare_alias): Implement as a typedef. (objc_substitute_decl, objc_gimplify_expr): Reformat. (objc_get_class_ivars): Adjust call to get_class_ivars(). (next_sjlj_build_enter_and_setjmp, synth_forward_declarations, build_ivar_reference, get_super_receiver): Call objc_build_component_ref() instead of build_component_ref(). (objc_begin_catch_clause): Use DERIVED_FROM_P() instead of objc_comptypes(). (build_private_template): Call objc_build_struct() instead of start_struct() and finish_struct(). (hash_init): Initialize volatilized_htab. (objc_is_public): Adjust calls to objc_get_ivars(); adjust ObjC++ impedance mismatches. (encode_aggregate_within): Streamline by calling encode_aggregate_fields(). * objc-act.h (objc_types_compatible_p): Remove prototype. (OCTI_UNUSED_LIST, unused_list): Remove slot. * objc-lang.c (LANG_HOOKS_TYPES_COMPATIBLE_P): Remove. From-SVN: r100123
2005-05-25 00:21:01 +02:00
return get_class_ivars (implementation_template, true);
1992-01-18 00:15:38 +01:00
}
else if (TREE_CODE (class) == CLASS_INTERFACE_TYPE)
1992-01-18 00:15:38 +01:00
{
Makefile.in (c-parse.o): Depend on $(C_COMMON_H). [gcc/ChangeLog] 2004-09-07 Ziemowit Laski <zlaski@apple.com> * Makefile.in (c-parse.o): Depend on $(C_COMMON_H). * c-parse.in: Include c-common.h instead of objc-act.h. (ivar_decl_list, ivar_decls, ivar_decl, ivars, ivar_declarator, myparms, myparm): Remove %type declarations. (methodtype, optparms, OBJC_TYPE_QUAL, objc_quals, objc_qual, objc_typename, objc_try_catch_stmt, optellipsis): Add %type declarations. (objc_inherit_code, objc_public_flag): Remove. (typespec_nonreserved_nonattr): Call objc_get_protocol_qualified_type() instead of get_static_reference() and get_protocol_reference(). (stmt_nocomp): Call grokparm() on @catch parameter. (objcdef): Move semantic action to objc_finish_implementation(). (classdef): Move semantic action to objc_start_class_interface(), objc_continue_interface(), objc_finish_interface(), objc_start_class_implementation(), objc_continue_implementation(), objc_start_category_interface() and objc_start_category_implementation(). (protocoldef): Move semantic actions to objc_start_protocol() and objc_finish_interface(). (ivar_decl_list): Remove nonterminal. (visibility_spec): Move semantic actions to objc_set_visibility(). (ivar_decls): Remove assignment to $$. (ivar_decl): Rephrase in terms of component_decl; call objc_add_instance_variable(). (ivars, ivar_declarator): Remove nonterminals. (opt_semi): New nonterminal. (methodtype): Remove semantic actions. (methoddef): Move semantic actions to objc_set_method_type(), objc_start_method_definition() and objc_finish_method_definition(). (methodproto): Move semantic actions to objc_set_method_type() and objc_add_method_declaration(). (methoddecl): Use objc_typename instead of typename; move semantic actions to objc_build_method_signature(). (optarglist, myxdecls, mydecl, myparms, myparm): Remove nonterminals. (optparmlist): Express in terms of optparms and optellipsis. (optparms, optellipsis, objc_qual, objc_quals, objc_typename): New nonterminals. (keyworddecl): Use objc_typename instead of typename. (rid_to_yy): Mark RID_IN, RID_OUT, RID_INOUT, RID_BYCOPY, RID_BYREF and RID_ONEWAY as returning OBJC_TYPE_QUAL to yyparse(). [gcc/objc/ChangeLog] 2004-09-07 Ziemowit Laski <zlaski@apple.com> * Make-lang.in (objc/objc-parse.o): Depend on $(C_COMMON_H) instead of objc/objc-act.h. (objc/objc-act.o): Depend on $(HASHTAB_H). * objc-act.c: Include hashtab.h; in ObjC++ mode, include cp-tree.h and objcp-decl.h instead of c-tree.h. (build_module_descriptor, get_class_ivars, synth_id_with_class_suffix, error_with_ivar, gen_method_decl, gen_declaration, setup_string_decl, build_protocol_template): Adjust prototypes. (build_module_initializer_routine, start_class, continue_class, finish_class, start_method_def, objc_start_function, start_protocol, build_method_decl, objc_add_method, add_instance_variable, build_ivar_reference, is_ivar, is_private, get_super_receiver, build_selector_table_decl, objc_push_parm, objc_get_parm_info, gen_type_name, gen_type_name_0, start_var_decl, finish_var_decl, create_field_decl): New prototypes. (objc_expand_function_end, comp_method_with_proto, objc_expr_last, gen_declaration_1, gen_declarator, is_complex_decl, adorn_decl, define_decl, create_builtin_decl, gen_declspecs): Remove prototypes. (TYPE_ID): Rename to OBJECT_TYPEDEF_NAME. (CLASS_TYPEDEF_NAME): New. (TAG_EXECCLASS): Change from a global variable to a #define. (TAG_RETURN_STRUCT): Delete. (TAG_GNUINIT): New, holds '__objc_gnu_init' name. (objc_inherit_code, objc_public_flag): New, moved from c-parse.in. (string_descriptor): New struct. (string_htab): New hash table. (string_hash, string_eq): New prototypes. (generate_struct_by_value_array): Call create_field_decl() instead of create_builtin_decl(). (objc_init): Do not initialize objc_ellipsis_node or TAG_EXECCLASS; In ObjC++ mode, call cxx_init() instead of c_objc_common_init(). (objc_finish_file): In ObjC++, call instantiate_pending_templates() and cp_finish_file(). (define_decl, get_static_reference, get_protocol_reference, create_builtin_decl): Remove functions. (objc_start_class_interface, objc_start_category_interface, objc_start_protocol, objc_continue_interface, objc_finish_interface, objc_start_class_implementation, objc_start_category_implementation, objc_continue_implementation, objc_finish_implementation, objc_set_visibility, objc_set_method_type, objc_build_method_signature, objc_add_method_declaration, objc_start_method_definition, objc_add_instance_variable, objc_get_protocol_qualified_type, create_field_decl, start_var_decl, finish_var_decl): New functions. (setup_string_decl): Simplify since it is only called once. (synth_module_prologue): Call build_class_template(); predefine 'id' and 'Class' as typedefs; rename 'temp_type' to 'type'; disable debug hooks for duration of function; fix GNU runtime messenger signatures to correspond to reality; forward-declare '__objc_exec_class' for the GNU runtime; call build_selector_table_decl(); in ObjC++ mode, generate 'extern "C" { ... }' wrappers around synthesized declarations; call build_protocol_template() and build_category_template(). (string_hash, string_eq): New functions. (objc_build_string_object): Check metaclass correctness only once; store string literals in hash table. (objc_build_constructor): Do not convert initializer elements; adjust for ObjC++ impedance mismatch. (build_objc_symtab_template): Call create_field_decl() instead of create_builtin_decl(). (init_objc_symtab): Add missing conversion to initializer element. (build_metadata_decl): Call start_var_decl() instead of define_decl(). (generate_objc_symtab_decl): Do not call build_category_template(); call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(). (build_module_descriptor): Call create_field_decl() instead of grokfield(); call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(); always mark module descriptor as used; move GNU runtime-specific functionality to build_module_initializer_routine(). (build_module_initializer_routine): New function, broken off of build_module_descriptor(). (objc_static_init_needed_p, objc_generate_static_init_call): New functions. (generate_static_references, generate_strings, build_selector_translation_table, generate_descriptor_table, generate_ivars_list, generate_dispatch_table, generate_category): Call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(); build a type directly instead of via groktypename(). (build_selector_reference_decl, build_selector_table_decl, build_class_reference_decl, build_protocol_reference, generate_objc_image_info): Call start_var_decl() instead of build_decl(). (build_selector_reference): For GNU runtime, do not call build_selector_reference_decl(). (build_selector, build_typed_selector_reference): Always convert result to the selector type. (add_objc_string): Cast return value to 'char *'. (build_method_prototype_template, build_selector_template, build_method_template): Use actual selector type for fields pointing to selectors. (finish_objc): For GNU runtime, call build_module_initializer_routine() after build_module_descriptor(). (generate_protocol_list, generate_shared_structures): Call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(); build a type directly instead of via groktypename(). (synth_id_with_class_suffix): Return a string. (get_arg_type_list): For instance methods, use the instance type for 'self'; do not call groktypename_in_parm_context(). (build_objc_string_decl): Squash redeclaration errors in ObjC++. (objc_is_class_name): Use OBJC_TYPE_NAME instead of TYPE_NAME; handle RECORD_TYPEs in ObjC as well as ObjC++. (objc_is_id): New function. (objc_is_object_ptr): Return the canonical type node. (objc_get_class_ivars): Simplify using get_class_ivars(). (get_class_ivars): Remove second parameter; create a fresh copy of the ivar list for each call; do not check for existence of super class. (objc_eh_runtime_type): Mark #ifndef OBJCPLUS. (objc_init_exceptions): When using SJLJ-style exceptions, require the use of '-fobjc-exceptions' flag; do not require it for DWARF-style exceptions. (objc_build_exc_ptr, next_sjlj_build_try_catch_finally): Use objc_object_type instead of objc_id_type. (objc_begin_catch_clause): Convert the incoming PARM_DECL into a VAR_DECL before placing it in the appropriate scope; do not call define_decl(); adjust call to c_begin_compound_stmt(); use objc_object_type instead of objc_id_type. (build_next_objc_exception_stuff): Call create_field_decl() instead of create_builtin_decl(); construct type directly instead of calling groktypename(); use OBJC_VOID_AT_END to mark end of function parameters. (build_private_template): Adjust call to get_class_ivars(); build a type directly instead of via groktypename(). (build_protocol_template, build_method_prototype_list_template, build_method_prototype_template, build_category_template, build_selector_template, build_class_template, build_super_template, build_ivar_template, build_ivar_list_template, build_method_list_template, build_method_template): Call create_field_decl() instead of grokfield(). (objc_method_parm_type): Do not call groktypename(). (generate_descriptor_table): Call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(). (generate_method_descriptors, build_protocol_initializer, generate_dispatch_tables, build_category_initializer, build_shared_structure_initializer): Do not call groktypename(). (generate_protocols): Call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(); do not call groktypename(). (error_with_ivar): Remove last parameter. (check_ivars): Do not iterate ovar CLASS_RAW_IVARS lists in addition to CLASS_IVARS lists; adjust calls to error_with_ivar(). (generate_ivar_lists): Convert one of the initializer elements; do not call groktypename(). (get_arg_type_list, start_method_def, gen_method_def): Account for new representation of variable arguments and '...' in Objective-C methods; add Objective-C++ impedance matching code. (is_objc_type_qualifier): Remove function. (adjust_type_for_id_default): Simplify; there is no longer a need to wade through declspecs. (lookup_interface, start_class, continue_class, finish_class, start_method_def, start_protocol, build_method_decl, objc_add_method, add_instance_variable, build_ivar_reference, is_ivar, is_private, get_super_receiver, objc_build_finally_epilogue): Make into static functions. (receiver_is_class_object): Use new IS_CLASS() macro. (objc_build_message_expr): Tweak ObjC++ message argument handling; call objc_finish_message_expr() instead of finish_message_expr(). (finish_message_expr): Rename to objc_finish_message_expr(); use OBJC_TYPE_NAME and OBJC_SET_TYPE_NAME macros instead of TYPE_NAME. call gen_type_name() instead of gen_declaration(); call objc_is_id() instead of using IS_ID and IS_CLASS; Use objc_class_name instead of calling get_identifier("Class"); handle CONVERT_EXPRs in receiver. (build_objc_method_call, warn_with_method): Do not call groktypename(). (build_ivar_reference): Call convert() instead of clobbering in a type. (hash_init): Initialize string_htab hash table. (add_instance_variable): Simplify parameter list; do not call grokfield(); do not populate CLASS_IVARS list. (start_class): Check for the existence of super class, if one was specified. (continue_class): Use CLASS_RAW_IVARS rather than CLASS_IVARS; do not call build_class_template(); adjust call to get_class_ivars(); call build_decl(), pushdecl() and finish_decl() instead of define_decl(). (finish_class): Call build_decl(), pushdecl() and finish_decl() instead of define_decl(). (add_protocols): Use PROTOCOL_BINFO_ELTS for the tree vector size. (start_protocol): Do not call build_protocol_template(); use PROTOCOL_BINFO_ELTS for the tree vector size. (encode_type_qualifiers): Do not handle the 'const' qualifier here. (encode_pointer): Encode 'const char *' as 'r*', for backwards compatibility. (encode_array): Use HOST_WIDE_INT_PRINT_DEC instead of "%ld". (encode_type): Handle the 'const' qualifier here. (objc_parmlist): New global variable, sued by objc_push_parm and objc_get_parm_info(). (objc_push_parm, objc_get_parm_info): New functions. (objc_expr_last): Remove function. (synth_self_and_ucmd_args): For instance methods, use the instance type for 'self'; call objc_push_parm() instead of push_parm_decl(). (start_method_def): Do not call push_scope(), declare_parm_level(), pop_scope(), push_parm_decl(), store_parm_decls() or objc_expr_last(); just use objc_push_parm() and objc_get_parm_info(). (comp_method_with_proto): Remove function. (objc_types_are_equivalent): Strip away indirections before comparing underlying types. (comp_proto_with_proto): Do not call groktypename(); types are no longer in raw declspec format. (objc_start_function): New function. (really_start_method): Call comp_proto_with_proto() instead of comp_method_with_proto(); call objc_start_function() instead of hand-crafting a function declarator. (continue_method_def, objc_expand_function_end): Remove functions. (get_super_receiver): Call objc_get_current_scope() instead of get_current_scope(); reference 'super_class' field (instead of 'class'). (finish_method_def): Rename to objc_finish_method_definition() and add a function decl parameter; move method encoding call from objc_expand_function_end(). (is_complex_decl, adorn_decl, gen_declarator, gen_declspecs, gen_declaration_1): Remove functions. (tmpbuf, RAW_DECLSPEC): Remove. (gen_declaration): Remove second parameter; simplify to deal with TYPE_P nodes instead of raw declspecs. (gen_type_name, gen_type_name_0): New functions. (gen_method_decl): Remove second parameter; call gen_type_name() instead of gen_declaration_1(). (dump_interface): Adjust calls to gen_declaration() and gen_method_decl(); do not allocate a separate string buffer. (init_objc): Allocate a larger string buffer to accommodate dump_interface(); adjust call to build_module_descriptor(); add call to build_module_initializer_routine() for the GNU runtime. (generate_classref_translation_entry): Do not call start_decl(); call finish_var_decl() instead of finish_decl(); call convert() instead of build_c_cast(). * objc-act.h (CLASS_OWN_IVARS): Remove accessor. (CLASS_BINFO_ELTS): Reduce from 6 to 5, now that CLASS_OWN_IVARS is gone. (OCTI_GNU_INIT_DECL, GNU_INIT_decl): New. (OCTI_ELLIPSIS_NODE, objc_ellipsis_node): Remove. (OCTI_ID_ID, id_type, objc_id_id): Rename to OCTI_ID_NAME, objc_object_type and objc_object_name, respectively. (OCTI_CLS_REF, OCTI_CLASS_NAME, objc_class_reference, objc_class_name): New. (IS_CLASS): New macro. (IS_ID, IS_SUPER): Robustify. (OCTI_EXECCLASS_DECL, execclass_decl): New. (finish_file, start_class, continue_class, finish_class, start_method_def, continue_method_def, finish_method_def, start_protocol, finish_protocol, objc_build_throw_stmt, objc_build_try_catch_finally_stmt, objc_build_synchronized_prologue, objc_build_synchronized_epilogue, objc_build_try_prologue, objc_build_try_epilogue, objc_build_catch_stmt, objc_build_catch_epilogue, objc_build_finally_prologue, objc_build_finally_epilogue, is_ivar, is_private, is_public, add_instance_variable, objc_add_method, get_super_receiver, objc_clear_super_receiver, get_class_ivars_from_name, get_class_reference, get_static_reference, get_object_reference, build_message_expr, finish_message_expr, build_selector_expr, build_ivar_reference, build_keyword_decl, build_method_decl, build_protocol_expr, build_objc_string_object, objc_declare_alias, objc_declare_class, objc_declare_protocols, objc_comptypes, objc_check_decl, build_encode_expr): Remove prototypes. (imp_count, cat_count): Make GGC-aware. (OBJC_SET_TYPE_NAME): New macro. From-SVN: r87168
2004-09-08 02:49:44 +02:00
#ifdef OBJCPLUS
push_lang_context (lang_name_c);
#endif /* OBJCPLUS */
objc-act.c (build_private_template): Change to return 'void'... [gcc/objc/ChangeLog] 2004-12-15 Ziemowit Laski <zlaski@apple.com> * objc-act.c (build_private_template): Change to return 'void'; do not set ivar_context, uprivate_record or objc_instance_type. (objc_comptypes, gen_type_name_0): For types 'id' and 'Class', retrieve protocol list from the pointee rather than the pointer itself; check TYPE_HAS_OBJC_INFO(...) precondition before accessing TYPE_OBJC_PROTOCOL_LIST. (objc_get_protocol_qualified_type): For types 'id' and 'Class', construct a variant of the pointee as well as the pointer, and store protocol information in the former. When creating variants of RECORD_TYPEs, clone their TYPE_LANG_SPECIFIC fields and propagate TYPE_OBJC_INTERFACE information. (objc_declare_class): If a TYPE_DECL is looked up, retrieve the underlying RECORD_TYPE to check for presence of TYPE_OBJC_INTERFACE; for newly-created RECORD_TYPEs, create a tentative TYPE_OBJC_INTERFACE holding an IDENTIFIER_NODE. (objc_finish_message_expr): Check TYPE_HAS_OBJC_INFO(...) before accessing TYPE_OBJC_PROTOCOL_LIST; Use TYPE_OBJC_INTERFACE instead of calling lookup_interface(); allow for TYPE_OBJC_INTERFACE holding an IDENTIFIER_NODE (meaning a @class forward-declaration only). (objc_is_public): Check TYPE_OBJC_INTERFACE instead of calling lookup_interface(). (continue_class): For @implementations, set ivar_context, uprivate_record and objc_instance_type, for @interfaces, call build_private_template(). (encode_pointer): Check TYPE_HAS_OBJC_INFO(...) before accessing TYPE_OBJC_INTERFACE. (objc_types_are_equivalent): Check TYPE_HAS_OBJC_INFO(...) before accessing TYPE_OBJC_PROTOCOL_LIST. * objc-act.h (OBJC_INFO_SLOT_ELTS, TYPE_OBJC_INFO, INIT_TYPE_OBJC_INFO, DUP_TYPE_OBJC_INFO, ALLOC_OBJC_TYPE_LANG_SPECIFIC, SIZEOF_OBJC_TYPE_LANG_SPECIFIC): New macros. (TYPE_OBJC_INTERFACE): Replaces TREE_STATIC_INSTANCE and now points to an actual @interface; stored in TYPE_LANG_SPECIFIC(...). (TYPE_OBJC_PROTOCOL_LIST): Replaces TYPE_PROTOCOL_LIST; stored in TYPE_LANG_SPECIFIC(...). (TREE_STATIC_INSTANCE, TYPE_PROTOCOL_LIST): Delete. (IS_ID, IS_CLASS, IS_PROTOCOL_QUALIFIED_UNTYPED, IS_SUPER, TYPED_OBJECT): Check for POINTER_TYPE rather than POINTER_TYPE_P; adjust for use of TYPE_OBJC_INTERFACE and TYPE_OBJC_PROTOCOL_LIST instead of TREE_STATIC_INSTANCE and TYPE_PROTOCOL_LIST. From-SVN: r92239
2004-12-16 02:10:38 +01:00
build_private_template (class);
Makefile.in (c-parse.o): Depend on $(C_COMMON_H). [gcc/ChangeLog] 2004-09-07 Ziemowit Laski <zlaski@apple.com> * Makefile.in (c-parse.o): Depend on $(C_COMMON_H). * c-parse.in: Include c-common.h instead of objc-act.h. (ivar_decl_list, ivar_decls, ivar_decl, ivars, ivar_declarator, myparms, myparm): Remove %type declarations. (methodtype, optparms, OBJC_TYPE_QUAL, objc_quals, objc_qual, objc_typename, objc_try_catch_stmt, optellipsis): Add %type declarations. (objc_inherit_code, objc_public_flag): Remove. (typespec_nonreserved_nonattr): Call objc_get_protocol_qualified_type() instead of get_static_reference() and get_protocol_reference(). (stmt_nocomp): Call grokparm() on @catch parameter. (objcdef): Move semantic action to objc_finish_implementation(). (classdef): Move semantic action to objc_start_class_interface(), objc_continue_interface(), objc_finish_interface(), objc_start_class_implementation(), objc_continue_implementation(), objc_start_category_interface() and objc_start_category_implementation(). (protocoldef): Move semantic actions to objc_start_protocol() and objc_finish_interface(). (ivar_decl_list): Remove nonterminal. (visibility_spec): Move semantic actions to objc_set_visibility(). (ivar_decls): Remove assignment to $$. (ivar_decl): Rephrase in terms of component_decl; call objc_add_instance_variable(). (ivars, ivar_declarator): Remove nonterminals. (opt_semi): New nonterminal. (methodtype): Remove semantic actions. (methoddef): Move semantic actions to objc_set_method_type(), objc_start_method_definition() and objc_finish_method_definition(). (methodproto): Move semantic actions to objc_set_method_type() and objc_add_method_declaration(). (methoddecl): Use objc_typename instead of typename; move semantic actions to objc_build_method_signature(). (optarglist, myxdecls, mydecl, myparms, myparm): Remove nonterminals. (optparmlist): Express in terms of optparms and optellipsis. (optparms, optellipsis, objc_qual, objc_quals, objc_typename): New nonterminals. (keyworddecl): Use objc_typename instead of typename. (rid_to_yy): Mark RID_IN, RID_OUT, RID_INOUT, RID_BYCOPY, RID_BYREF and RID_ONEWAY as returning OBJC_TYPE_QUAL to yyparse(). [gcc/objc/ChangeLog] 2004-09-07 Ziemowit Laski <zlaski@apple.com> * Make-lang.in (objc/objc-parse.o): Depend on $(C_COMMON_H) instead of objc/objc-act.h. (objc/objc-act.o): Depend on $(HASHTAB_H). * objc-act.c: Include hashtab.h; in ObjC++ mode, include cp-tree.h and objcp-decl.h instead of c-tree.h. (build_module_descriptor, get_class_ivars, synth_id_with_class_suffix, error_with_ivar, gen_method_decl, gen_declaration, setup_string_decl, build_protocol_template): Adjust prototypes. (build_module_initializer_routine, start_class, continue_class, finish_class, start_method_def, objc_start_function, start_protocol, build_method_decl, objc_add_method, add_instance_variable, build_ivar_reference, is_ivar, is_private, get_super_receiver, build_selector_table_decl, objc_push_parm, objc_get_parm_info, gen_type_name, gen_type_name_0, start_var_decl, finish_var_decl, create_field_decl): New prototypes. (objc_expand_function_end, comp_method_with_proto, objc_expr_last, gen_declaration_1, gen_declarator, is_complex_decl, adorn_decl, define_decl, create_builtin_decl, gen_declspecs): Remove prototypes. (TYPE_ID): Rename to OBJECT_TYPEDEF_NAME. (CLASS_TYPEDEF_NAME): New. (TAG_EXECCLASS): Change from a global variable to a #define. (TAG_RETURN_STRUCT): Delete. (TAG_GNUINIT): New, holds '__objc_gnu_init' name. (objc_inherit_code, objc_public_flag): New, moved from c-parse.in. (string_descriptor): New struct. (string_htab): New hash table. (string_hash, string_eq): New prototypes. (generate_struct_by_value_array): Call create_field_decl() instead of create_builtin_decl(). (objc_init): Do not initialize objc_ellipsis_node or TAG_EXECCLASS; In ObjC++ mode, call cxx_init() instead of c_objc_common_init(). (objc_finish_file): In ObjC++, call instantiate_pending_templates() and cp_finish_file(). (define_decl, get_static_reference, get_protocol_reference, create_builtin_decl): Remove functions. (objc_start_class_interface, objc_start_category_interface, objc_start_protocol, objc_continue_interface, objc_finish_interface, objc_start_class_implementation, objc_start_category_implementation, objc_continue_implementation, objc_finish_implementation, objc_set_visibility, objc_set_method_type, objc_build_method_signature, objc_add_method_declaration, objc_start_method_definition, objc_add_instance_variable, objc_get_protocol_qualified_type, create_field_decl, start_var_decl, finish_var_decl): New functions. (setup_string_decl): Simplify since it is only called once. (synth_module_prologue): Call build_class_template(); predefine 'id' and 'Class' as typedefs; rename 'temp_type' to 'type'; disable debug hooks for duration of function; fix GNU runtime messenger signatures to correspond to reality; forward-declare '__objc_exec_class' for the GNU runtime; call build_selector_table_decl(); in ObjC++ mode, generate 'extern "C" { ... }' wrappers around synthesized declarations; call build_protocol_template() and build_category_template(). (string_hash, string_eq): New functions. (objc_build_string_object): Check metaclass correctness only once; store string literals in hash table. (objc_build_constructor): Do not convert initializer elements; adjust for ObjC++ impedance mismatch. (build_objc_symtab_template): Call create_field_decl() instead of create_builtin_decl(). (init_objc_symtab): Add missing conversion to initializer element. (build_metadata_decl): Call start_var_decl() instead of define_decl(). (generate_objc_symtab_decl): Do not call build_category_template(); call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(). (build_module_descriptor): Call create_field_decl() instead of grokfield(); call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(); always mark module descriptor as used; move GNU runtime-specific functionality to build_module_initializer_routine(). (build_module_initializer_routine): New function, broken off of build_module_descriptor(). (objc_static_init_needed_p, objc_generate_static_init_call): New functions. (generate_static_references, generate_strings, build_selector_translation_table, generate_descriptor_table, generate_ivars_list, generate_dispatch_table, generate_category): Call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(); build a type directly instead of via groktypename(). (build_selector_reference_decl, build_selector_table_decl, build_class_reference_decl, build_protocol_reference, generate_objc_image_info): Call start_var_decl() instead of build_decl(). (build_selector_reference): For GNU runtime, do not call build_selector_reference_decl(). (build_selector, build_typed_selector_reference): Always convert result to the selector type. (add_objc_string): Cast return value to 'char *'. (build_method_prototype_template, build_selector_template, build_method_template): Use actual selector type for fields pointing to selectors. (finish_objc): For GNU runtime, call build_module_initializer_routine() after build_module_descriptor(). (generate_protocol_list, generate_shared_structures): Call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(); build a type directly instead of via groktypename(). (synth_id_with_class_suffix): Return a string. (get_arg_type_list): For instance methods, use the instance type for 'self'; do not call groktypename_in_parm_context(). (build_objc_string_decl): Squash redeclaration errors in ObjC++. (objc_is_class_name): Use OBJC_TYPE_NAME instead of TYPE_NAME; handle RECORD_TYPEs in ObjC as well as ObjC++. (objc_is_id): New function. (objc_is_object_ptr): Return the canonical type node. (objc_get_class_ivars): Simplify using get_class_ivars(). (get_class_ivars): Remove second parameter; create a fresh copy of the ivar list for each call; do not check for existence of super class. (objc_eh_runtime_type): Mark #ifndef OBJCPLUS. (objc_init_exceptions): When using SJLJ-style exceptions, require the use of '-fobjc-exceptions' flag; do not require it for DWARF-style exceptions. (objc_build_exc_ptr, next_sjlj_build_try_catch_finally): Use objc_object_type instead of objc_id_type. (objc_begin_catch_clause): Convert the incoming PARM_DECL into a VAR_DECL before placing it in the appropriate scope; do not call define_decl(); adjust call to c_begin_compound_stmt(); use objc_object_type instead of objc_id_type. (build_next_objc_exception_stuff): Call create_field_decl() instead of create_builtin_decl(); construct type directly instead of calling groktypename(); use OBJC_VOID_AT_END to mark end of function parameters. (build_private_template): Adjust call to get_class_ivars(); build a type directly instead of via groktypename(). (build_protocol_template, build_method_prototype_list_template, build_method_prototype_template, build_category_template, build_selector_template, build_class_template, build_super_template, build_ivar_template, build_ivar_list_template, build_method_list_template, build_method_template): Call create_field_decl() instead of grokfield(). (objc_method_parm_type): Do not call groktypename(). (generate_descriptor_table): Call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(). (generate_method_descriptors, build_protocol_initializer, generate_dispatch_tables, build_category_initializer, build_shared_structure_initializer): Do not call groktypename(). (generate_protocols): Call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(); do not call groktypename(). (error_with_ivar): Remove last parameter. (check_ivars): Do not iterate ovar CLASS_RAW_IVARS lists in addition to CLASS_IVARS lists; adjust calls to error_with_ivar(). (generate_ivar_lists): Convert one of the initializer elements; do not call groktypename(). (get_arg_type_list, start_method_def, gen_method_def): Account for new representation of variable arguments and '...' in Objective-C methods; add Objective-C++ impedance matching code. (is_objc_type_qualifier): Remove function. (adjust_type_for_id_default): Simplify; there is no longer a need to wade through declspecs. (lookup_interface, start_class, continue_class, finish_class, start_method_def, start_protocol, build_method_decl, objc_add_method, add_instance_variable, build_ivar_reference, is_ivar, is_private, get_super_receiver, objc_build_finally_epilogue): Make into static functions. (receiver_is_class_object): Use new IS_CLASS() macro. (objc_build_message_expr): Tweak ObjC++ message argument handling; call objc_finish_message_expr() instead of finish_message_expr(). (finish_message_expr): Rename to objc_finish_message_expr(); use OBJC_TYPE_NAME and OBJC_SET_TYPE_NAME macros instead of TYPE_NAME. call gen_type_name() instead of gen_declaration(); call objc_is_id() instead of using IS_ID and IS_CLASS; Use objc_class_name instead of calling get_identifier("Class"); handle CONVERT_EXPRs in receiver. (build_objc_method_call, warn_with_method): Do not call groktypename(). (build_ivar_reference): Call convert() instead of clobbering in a type. (hash_init): Initialize string_htab hash table. (add_instance_variable): Simplify parameter list; do not call grokfield(); do not populate CLASS_IVARS list. (start_class): Check for the existence of super class, if one was specified. (continue_class): Use CLASS_RAW_IVARS rather than CLASS_IVARS; do not call build_class_template(); adjust call to get_class_ivars(); call build_decl(), pushdecl() and finish_decl() instead of define_decl(). (finish_class): Call build_decl(), pushdecl() and finish_decl() instead of define_decl(). (add_protocols): Use PROTOCOL_BINFO_ELTS for the tree vector size. (start_protocol): Do not call build_protocol_template(); use PROTOCOL_BINFO_ELTS for the tree vector size. (encode_type_qualifiers): Do not handle the 'const' qualifier here. (encode_pointer): Encode 'const char *' as 'r*', for backwards compatibility. (encode_array): Use HOST_WIDE_INT_PRINT_DEC instead of "%ld". (encode_type): Handle the 'const' qualifier here. (objc_parmlist): New global variable, sued by objc_push_parm and objc_get_parm_info(). (objc_push_parm, objc_get_parm_info): New functions. (objc_expr_last): Remove function. (synth_self_and_ucmd_args): For instance methods, use the instance type for 'self'; call objc_push_parm() instead of push_parm_decl(). (start_method_def): Do not call push_scope(), declare_parm_level(), pop_scope(), push_parm_decl(), store_parm_decls() or objc_expr_last(); just use objc_push_parm() and objc_get_parm_info(). (comp_method_with_proto): Remove function. (objc_types_are_equivalent): Strip away indirections before comparing underlying types. (comp_proto_with_proto): Do not call groktypename(); types are no longer in raw declspec format. (objc_start_function): New function. (really_start_method): Call comp_proto_with_proto() instead of comp_method_with_proto(); call objc_start_function() instead of hand-crafting a function declarator. (continue_method_def, objc_expand_function_end): Remove functions. (get_super_receiver): Call objc_get_current_scope() instead of get_current_scope(); reference 'super_class' field (instead of 'class'). (finish_method_def): Rename to objc_finish_method_definition() and add a function decl parameter; move method encoding call from objc_expand_function_end(). (is_complex_decl, adorn_decl, gen_declarator, gen_declspecs, gen_declaration_1): Remove functions. (tmpbuf, RAW_DECLSPEC): Remove. (gen_declaration): Remove second parameter; simplify to deal with TYPE_P nodes instead of raw declspecs. (gen_type_name, gen_type_name_0): New functions. (gen_method_decl): Remove second parameter; call gen_type_name() instead of gen_declaration_1(). (dump_interface): Adjust calls to gen_declaration() and gen_method_decl(); do not allocate a separate string buffer. (init_objc): Allocate a larger string buffer to accommodate dump_interface(); adjust call to build_module_descriptor(); add call to build_module_initializer_routine() for the GNU runtime. (generate_classref_translation_entry): Do not call start_decl(); call finish_var_decl() instead of finish_decl(); call convert() instead of build_c_cast(). * objc-act.h (CLASS_OWN_IVARS): Remove accessor. (CLASS_BINFO_ELTS): Reduce from 6 to 5, now that CLASS_OWN_IVARS is gone. (OCTI_GNU_INIT_DECL, GNU_INIT_decl): New. (OCTI_ELLIPSIS_NODE, objc_ellipsis_node): Remove. (OCTI_ID_ID, id_type, objc_id_id): Rename to OCTI_ID_NAME, objc_object_type and objc_object_name, respectively. (OCTI_CLS_REF, OCTI_CLASS_NAME, objc_class_reference, objc_class_name): New. (IS_CLASS): New macro. (IS_ID, IS_SUPER): Robustify. (OCTI_EXECCLASS_DECL, execclass_decl): New. (finish_file, start_class, continue_class, finish_class, start_method_def, continue_method_def, finish_method_def, start_protocol, finish_protocol, objc_build_throw_stmt, objc_build_try_catch_finally_stmt, objc_build_synchronized_prologue, objc_build_synchronized_epilogue, objc_build_try_prologue, objc_build_try_epilogue, objc_build_catch_stmt, objc_build_catch_epilogue, objc_build_finally_prologue, objc_build_finally_epilogue, is_ivar, is_private, is_public, add_instance_variable, objc_add_method, get_super_receiver, objc_clear_super_receiver, get_class_ivars_from_name, get_class_reference, get_static_reference, get_object_reference, build_message_expr, finish_message_expr, build_selector_expr, build_ivar_reference, build_keyword_decl, build_method_decl, build_protocol_expr, build_objc_string_object, objc_declare_alias, objc_declare_class, objc_declare_protocols, objc_comptypes, objc_check_decl, build_encode_expr): Remove prototypes. (imp_count, cat_count): Make GGC-aware. (OBJC_SET_TYPE_NAME): New macro. From-SVN: r87168
2004-09-08 02:49:44 +02:00
#ifdef OBJCPLUS
pop_lang_context ();
#endif /* OBJCPLUS */
return NULL_TREE;
1992-01-18 00:15:38 +01:00
}
1992-01-18 00:15:38 +01:00
else
return error_mark_node;
}
/* This is called once we see the "@end" in an interface/implementation. */
Makefile.in (c-parse.o): Depend on $(C_COMMON_H). [gcc/ChangeLog] 2004-09-07 Ziemowit Laski <zlaski@apple.com> * Makefile.in (c-parse.o): Depend on $(C_COMMON_H). * c-parse.in: Include c-common.h instead of objc-act.h. (ivar_decl_list, ivar_decls, ivar_decl, ivars, ivar_declarator, myparms, myparm): Remove %type declarations. (methodtype, optparms, OBJC_TYPE_QUAL, objc_quals, objc_qual, objc_typename, objc_try_catch_stmt, optellipsis): Add %type declarations. (objc_inherit_code, objc_public_flag): Remove. (typespec_nonreserved_nonattr): Call objc_get_protocol_qualified_type() instead of get_static_reference() and get_protocol_reference(). (stmt_nocomp): Call grokparm() on @catch parameter. (objcdef): Move semantic action to objc_finish_implementation(). (classdef): Move semantic action to objc_start_class_interface(), objc_continue_interface(), objc_finish_interface(), objc_start_class_implementation(), objc_continue_implementation(), objc_start_category_interface() and objc_start_category_implementation(). (protocoldef): Move semantic actions to objc_start_protocol() and objc_finish_interface(). (ivar_decl_list): Remove nonterminal. (visibility_spec): Move semantic actions to objc_set_visibility(). (ivar_decls): Remove assignment to $$. (ivar_decl): Rephrase in terms of component_decl; call objc_add_instance_variable(). (ivars, ivar_declarator): Remove nonterminals. (opt_semi): New nonterminal. (methodtype): Remove semantic actions. (methoddef): Move semantic actions to objc_set_method_type(), objc_start_method_definition() and objc_finish_method_definition(). (methodproto): Move semantic actions to objc_set_method_type() and objc_add_method_declaration(). (methoddecl): Use objc_typename instead of typename; move semantic actions to objc_build_method_signature(). (optarglist, myxdecls, mydecl, myparms, myparm): Remove nonterminals. (optparmlist): Express in terms of optparms and optellipsis. (optparms, optellipsis, objc_qual, objc_quals, objc_typename): New nonterminals. (keyworddecl): Use objc_typename instead of typename. (rid_to_yy): Mark RID_IN, RID_OUT, RID_INOUT, RID_BYCOPY, RID_BYREF and RID_ONEWAY as returning OBJC_TYPE_QUAL to yyparse(). [gcc/objc/ChangeLog] 2004-09-07 Ziemowit Laski <zlaski@apple.com> * Make-lang.in (objc/objc-parse.o): Depend on $(C_COMMON_H) instead of objc/objc-act.h. (objc/objc-act.o): Depend on $(HASHTAB_H). * objc-act.c: Include hashtab.h; in ObjC++ mode, include cp-tree.h and objcp-decl.h instead of c-tree.h. (build_module_descriptor, get_class_ivars, synth_id_with_class_suffix, error_with_ivar, gen_method_decl, gen_declaration, setup_string_decl, build_protocol_template): Adjust prototypes. (build_module_initializer_routine, start_class, continue_class, finish_class, start_method_def, objc_start_function, start_protocol, build_method_decl, objc_add_method, add_instance_variable, build_ivar_reference, is_ivar, is_private, get_super_receiver, build_selector_table_decl, objc_push_parm, objc_get_parm_info, gen_type_name, gen_type_name_0, start_var_decl, finish_var_decl, create_field_decl): New prototypes. (objc_expand_function_end, comp_method_with_proto, objc_expr_last, gen_declaration_1, gen_declarator, is_complex_decl, adorn_decl, define_decl, create_builtin_decl, gen_declspecs): Remove prototypes. (TYPE_ID): Rename to OBJECT_TYPEDEF_NAME. (CLASS_TYPEDEF_NAME): New. (TAG_EXECCLASS): Change from a global variable to a #define. (TAG_RETURN_STRUCT): Delete. (TAG_GNUINIT): New, holds '__objc_gnu_init' name. (objc_inherit_code, objc_public_flag): New, moved from c-parse.in. (string_descriptor): New struct. (string_htab): New hash table. (string_hash, string_eq): New prototypes. (generate_struct_by_value_array): Call create_field_decl() instead of create_builtin_decl(). (objc_init): Do not initialize objc_ellipsis_node or TAG_EXECCLASS; In ObjC++ mode, call cxx_init() instead of c_objc_common_init(). (objc_finish_file): In ObjC++, call instantiate_pending_templates() and cp_finish_file(). (define_decl, get_static_reference, get_protocol_reference, create_builtin_decl): Remove functions. (objc_start_class_interface, objc_start_category_interface, objc_start_protocol, objc_continue_interface, objc_finish_interface, objc_start_class_implementation, objc_start_category_implementation, objc_continue_implementation, objc_finish_implementation, objc_set_visibility, objc_set_method_type, objc_build_method_signature, objc_add_method_declaration, objc_start_method_definition, objc_add_instance_variable, objc_get_protocol_qualified_type, create_field_decl, start_var_decl, finish_var_decl): New functions. (setup_string_decl): Simplify since it is only called once. (synth_module_prologue): Call build_class_template(); predefine 'id' and 'Class' as typedefs; rename 'temp_type' to 'type'; disable debug hooks for duration of function; fix GNU runtime messenger signatures to correspond to reality; forward-declare '__objc_exec_class' for the GNU runtime; call build_selector_table_decl(); in ObjC++ mode, generate 'extern "C" { ... }' wrappers around synthesized declarations; call build_protocol_template() and build_category_template(). (string_hash, string_eq): New functions. (objc_build_string_object): Check metaclass correctness only once; store string literals in hash table. (objc_build_constructor): Do not convert initializer elements; adjust for ObjC++ impedance mismatch. (build_objc_symtab_template): Call create_field_decl() instead of create_builtin_decl(). (init_objc_symtab): Add missing conversion to initializer element. (build_metadata_decl): Call start_var_decl() instead of define_decl(). (generate_objc_symtab_decl): Do not call build_category_template(); call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(). (build_module_descriptor): Call create_field_decl() instead of grokfield(); call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(); always mark module descriptor as used; move GNU runtime-specific functionality to build_module_initializer_routine(). (build_module_initializer_routine): New function, broken off of build_module_descriptor(). (objc_static_init_needed_p, objc_generate_static_init_call): New functions. (generate_static_references, generate_strings, build_selector_translation_table, generate_descriptor_table, generate_ivars_list, generate_dispatch_table, generate_category): Call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(); build a type directly instead of via groktypename(). (build_selector_reference_decl, build_selector_table_decl, build_class_reference_decl, build_protocol_reference, generate_objc_image_info): Call start_var_decl() instead of build_decl(). (build_selector_reference): For GNU runtime, do not call build_selector_reference_decl(). (build_selector, build_typed_selector_reference): Always convert result to the selector type. (add_objc_string): Cast return value to 'char *'. (build_method_prototype_template, build_selector_template, build_method_template): Use actual selector type for fields pointing to selectors. (finish_objc): For GNU runtime, call build_module_initializer_routine() after build_module_descriptor(). (generate_protocol_list, generate_shared_structures): Call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(); build a type directly instead of via groktypename(). (synth_id_with_class_suffix): Return a string. (get_arg_type_list): For instance methods, use the instance type for 'self'; do not call groktypename_in_parm_context(). (build_objc_string_decl): Squash redeclaration errors in ObjC++. (objc_is_class_name): Use OBJC_TYPE_NAME instead of TYPE_NAME; handle RECORD_TYPEs in ObjC as well as ObjC++. (objc_is_id): New function. (objc_is_object_ptr): Return the canonical type node. (objc_get_class_ivars): Simplify using get_class_ivars(). (get_class_ivars): Remove second parameter; create a fresh copy of the ivar list for each call; do not check for existence of super class. (objc_eh_runtime_type): Mark #ifndef OBJCPLUS. (objc_init_exceptions): When using SJLJ-style exceptions, require the use of '-fobjc-exceptions' flag; do not require it for DWARF-style exceptions. (objc_build_exc_ptr, next_sjlj_build_try_catch_finally): Use objc_object_type instead of objc_id_type. (objc_begin_catch_clause): Convert the incoming PARM_DECL into a VAR_DECL before placing it in the appropriate scope; do not call define_decl(); adjust call to c_begin_compound_stmt(); use objc_object_type instead of objc_id_type. (build_next_objc_exception_stuff): Call create_field_decl() instead of create_builtin_decl(); construct type directly instead of calling groktypename(); use OBJC_VOID_AT_END to mark end of function parameters. (build_private_template): Adjust call to get_class_ivars(); build a type directly instead of via groktypename(). (build_protocol_template, build_method_prototype_list_template, build_method_prototype_template, build_category_template, build_selector_template, build_class_template, build_super_template, build_ivar_template, build_ivar_list_template, build_method_list_template, build_method_template): Call create_field_decl() instead of grokfield(). (objc_method_parm_type): Do not call groktypename(). (generate_descriptor_table): Call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(). (generate_method_descriptors, build_protocol_initializer, generate_dispatch_tables, build_category_initializer, build_shared_structure_initializer): Do not call groktypename(). (generate_protocols): Call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(); do not call groktypename(). (error_with_ivar): Remove last parameter. (check_ivars): Do not iterate ovar CLASS_RAW_IVARS lists in addition to CLASS_IVARS lists; adjust calls to error_with_ivar(). (generate_ivar_lists): Convert one of the initializer elements; do not call groktypename(). (get_arg_type_list, start_method_def, gen_method_def): Account for new representation of variable arguments and '...' in Objective-C methods; add Objective-C++ impedance matching code. (is_objc_type_qualifier): Remove function. (adjust_type_for_id_default): Simplify; there is no longer a need to wade through declspecs. (lookup_interface, start_class, continue_class, finish_class, start_method_def, start_protocol, build_method_decl, objc_add_method, add_instance_variable, build_ivar_reference, is_ivar, is_private, get_super_receiver, objc_build_finally_epilogue): Make into static functions. (receiver_is_class_object): Use new IS_CLASS() macro. (objc_build_message_expr): Tweak ObjC++ message argument handling; call objc_finish_message_expr() instead of finish_message_expr(). (finish_message_expr): Rename to objc_finish_message_expr(); use OBJC_TYPE_NAME and OBJC_SET_TYPE_NAME macros instead of TYPE_NAME. call gen_type_name() instead of gen_declaration(); call objc_is_id() instead of using IS_ID and IS_CLASS; Use objc_class_name instead of calling get_identifier("Class"); handle CONVERT_EXPRs in receiver. (build_objc_method_call, warn_with_method): Do not call groktypename(). (build_ivar_reference): Call convert() instead of clobbering in a type. (hash_init): Initialize string_htab hash table. (add_instance_variable): Simplify parameter list; do not call grokfield(); do not populate CLASS_IVARS list. (start_class): Check for the existence of super class, if one was specified. (continue_class): Use CLASS_RAW_IVARS rather than CLASS_IVARS; do not call build_class_template(); adjust call to get_class_ivars(); call build_decl(), pushdecl() and finish_decl() instead of define_decl(). (finish_class): Call build_decl(), pushdecl() and finish_decl() instead of define_decl(). (add_protocols): Use PROTOCOL_BINFO_ELTS for the tree vector size. (start_protocol): Do not call build_protocol_template(); use PROTOCOL_BINFO_ELTS for the tree vector size. (encode_type_qualifiers): Do not handle the 'const' qualifier here. (encode_pointer): Encode 'const char *' as 'r*', for backwards compatibility. (encode_array): Use HOST_WIDE_INT_PRINT_DEC instead of "%ld". (encode_type): Handle the 'const' qualifier here. (objc_parmlist): New global variable, sued by objc_push_parm and objc_get_parm_info(). (objc_push_parm, objc_get_parm_info): New functions. (objc_expr_last): Remove function. (synth_self_and_ucmd_args): For instance methods, use the instance type for 'self'; call objc_push_parm() instead of push_parm_decl(). (start_method_def): Do not call push_scope(), declare_parm_level(), pop_scope(), push_parm_decl(), store_parm_decls() or objc_expr_last(); just use objc_push_parm() and objc_get_parm_info(). (comp_method_with_proto): Remove function. (objc_types_are_equivalent): Strip away indirections before comparing underlying types. (comp_proto_with_proto): Do not call groktypename(); types are no longer in raw declspec format. (objc_start_function): New function. (really_start_method): Call comp_proto_with_proto() instead of comp_method_with_proto(); call objc_start_function() instead of hand-crafting a function declarator. (continue_method_def, objc_expand_function_end): Remove functions. (get_super_receiver): Call objc_get_current_scope() instead of get_current_scope(); reference 'super_class' field (instead of 'class'). (finish_method_def): Rename to objc_finish_method_definition() and add a function decl parameter; move method encoding call from objc_expand_function_end(). (is_complex_decl, adorn_decl, gen_declarator, gen_declspecs, gen_declaration_1): Remove functions. (tmpbuf, RAW_DECLSPEC): Remove. (gen_declaration): Remove second parameter; simplify to deal with TYPE_P nodes instead of raw declspecs. (gen_type_name, gen_type_name_0): New functions. (gen_method_decl): Remove second parameter; call gen_type_name() instead of gen_declaration_1(). (dump_interface): Adjust calls to gen_declaration() and gen_method_decl(); do not allocate a separate string buffer. (init_objc): Allocate a larger string buffer to accommodate dump_interface(); adjust call to build_module_descriptor(); add call to build_module_initializer_routine() for the GNU runtime. (generate_classref_translation_entry): Do not call start_decl(); call finish_var_decl() instead of finish_decl(); call convert() instead of build_c_cast(). * objc-act.h (CLASS_OWN_IVARS): Remove accessor. (CLASS_BINFO_ELTS): Reduce from 6 to 5, now that CLASS_OWN_IVARS is gone. (OCTI_GNU_INIT_DECL, GNU_INIT_decl): New. (OCTI_ELLIPSIS_NODE, objc_ellipsis_node): Remove. (OCTI_ID_ID, id_type, objc_id_id): Rename to OCTI_ID_NAME, objc_object_type and objc_object_name, respectively. (OCTI_CLS_REF, OCTI_CLASS_NAME, objc_class_reference, objc_class_name): New. (IS_CLASS): New macro. (IS_ID, IS_SUPER): Robustify. (OCTI_EXECCLASS_DECL, execclass_decl): New. (finish_file, start_class, continue_class, finish_class, start_method_def, continue_method_def, finish_method_def, start_protocol, finish_protocol, objc_build_throw_stmt, objc_build_try_catch_finally_stmt, objc_build_synchronized_prologue, objc_build_synchronized_epilogue, objc_build_try_prologue, objc_build_try_epilogue, objc_build_catch_stmt, objc_build_catch_epilogue, objc_build_finally_prologue, objc_build_finally_epilogue, is_ivar, is_private, is_public, add_instance_variable, objc_add_method, get_super_receiver, objc_clear_super_receiver, get_class_ivars_from_name, get_class_reference, get_static_reference, get_object_reference, build_message_expr, finish_message_expr, build_selector_expr, build_ivar_reference, build_keyword_decl, build_method_decl, build_protocol_expr, build_objc_string_object, objc_declare_alias, objc_declare_class, objc_declare_protocols, objc_comptypes, objc_check_decl, build_encode_expr): Remove prototypes. (imp_count, cat_count): Make GGC-aware. (OBJC_SET_TYPE_NAME): New macro. From-SVN: r87168
2004-09-08 02:49:44 +02:00
static void
finish_class (tree class)
1992-01-18 00:15:38 +01:00
{
if (TREE_CODE (class) == CLASS_IMPLEMENTATION_TYPE)
1992-01-18 00:15:38 +01:00
{
1996-07-04 00:07:53 +02:00
/* All code generation is done in finish_objc. */
1992-01-18 00:15:38 +01:00
c-parse.in (objc_inherit_code, [...]): Make static. 2001-10-03 Ziemowit Laski <zlaski@apple.com> * c-parse.in (objc_inherit_code, objc_pq_context, objc_public_flag): Make static. (objc_interface_context, objc_implementation_context, objc_method_context, objc_ivar_chain, objc_ivar_context): Move to global tree array in objc/objc-act.[ch]. (methoddef): Remove unnecessary code. * objc/objc-act.c: (hashed_attribute, hashed_entry, imp_entry): Hoist struct definitions to objc-act.h. (nst_method_hash_list, cls_method_hash_list, imp_list, imp_count, cat_count): Place declaration in objc-act.h. (objc_tree_index): Move enumeration to objc-act.h. (objc_global_trees): Place declaration and macro accessors in objc-act.h. (implementation_context): Remove duplicate; use objc_implementation_context instead: (method_context): Remove duplicate; use objc_method_context instead. (objc_ellipsis_node, objc_method_prototype_template, implemented_classes, function_type): Move global vars to objc_global_trees. (init_objc): Use LAST_BASE_TREE_CODE instead of LAST_CODE. (build_message_expr): Move actual construction of ObjC message send nodes to finish_message_expr. (finish_message_expr): New routine, contains code formerly in build_message_expr. * objc/objc-act.h (finish_message_expr): New prototype. (objc_ivar_chain, objc_method_context, objc_ellipsis_node): Remove declarations; these vars are now part of objc_global_trees. (objc_tree_index, objc_global_trees): Move definitions from objc-act.c. * objc/objc-tree.def: Update copyright info. From-SVN: r46000
2001-10-04 00:05:57 +02:00
if (implementation_template != objc_implementation_context)
1992-01-18 00:15:38 +01:00
{
1996-07-04 00:07:53 +02:00
/* Ensure that all method listed in the interface contain bodies. */
1992-01-18 00:15:38 +01:00
check_methods (CLASS_CLS_METHODS (implementation_template),
c-parse.in (objc_inherit_code, [...]): Make static. 2001-10-03 Ziemowit Laski <zlaski@apple.com> * c-parse.in (objc_inherit_code, objc_pq_context, objc_public_flag): Make static. (objc_interface_context, objc_implementation_context, objc_method_context, objc_ivar_chain, objc_ivar_context): Move to global tree array in objc/objc-act.[ch]. (methoddef): Remove unnecessary code. * objc/objc-act.c: (hashed_attribute, hashed_entry, imp_entry): Hoist struct definitions to objc-act.h. (nst_method_hash_list, cls_method_hash_list, imp_list, imp_count, cat_count): Place declaration in objc-act.h. (objc_tree_index): Move enumeration to objc-act.h. (objc_global_trees): Place declaration and macro accessors in objc-act.h. (implementation_context): Remove duplicate; use objc_implementation_context instead: (method_context): Remove duplicate; use objc_method_context instead. (objc_ellipsis_node, objc_method_prototype_template, implemented_classes, function_type): Move global vars to objc_global_trees. (init_objc): Use LAST_BASE_TREE_CODE instead of LAST_CODE. (build_message_expr): Move actual construction of ObjC message send nodes to finish_message_expr. (finish_message_expr): New routine, contains code formerly in build_message_expr. * objc/objc-act.h (finish_message_expr): New prototype. (objc_ivar_chain, objc_method_context, objc_ellipsis_node): Remove declarations; these vars are now part of objc_global_trees. (objc_tree_index, objc_global_trees): Move definitions from objc-act.c. * objc/objc-tree.def: Update copyright info. From-SVN: r46000
2001-10-04 00:05:57 +02:00
CLASS_CLS_METHODS (objc_implementation_context), '+');
1992-01-18 00:15:38 +01:00
check_methods (CLASS_NST_METHODS (implementation_template),
c-parse.in (objc_inherit_code, [...]): Make static. 2001-10-03 Ziemowit Laski <zlaski@apple.com> * c-parse.in (objc_inherit_code, objc_pq_context, objc_public_flag): Make static. (objc_interface_context, objc_implementation_context, objc_method_context, objc_ivar_chain, objc_ivar_context): Move to global tree array in objc/objc-act.[ch]. (methoddef): Remove unnecessary code. * objc/objc-act.c: (hashed_attribute, hashed_entry, imp_entry): Hoist struct definitions to objc-act.h. (nst_method_hash_list, cls_method_hash_list, imp_list, imp_count, cat_count): Place declaration in objc-act.h. (objc_tree_index): Move enumeration to objc-act.h. (objc_global_trees): Place declaration and macro accessors in objc-act.h. (implementation_context): Remove duplicate; use objc_implementation_context instead: (method_context): Remove duplicate; use objc_method_context instead. (objc_ellipsis_node, objc_method_prototype_template, implemented_classes, function_type): Move global vars to objc_global_trees. (init_objc): Use LAST_BASE_TREE_CODE instead of LAST_CODE. (build_message_expr): Move actual construction of ObjC message send nodes to finish_message_expr. (finish_message_expr): New routine, contains code formerly in build_message_expr. * objc/objc-act.h (finish_message_expr): New prototype. (objc_ivar_chain, objc_method_context, objc_ellipsis_node): Remove declarations; these vars are now part of objc_global_trees. (objc_tree_index, objc_global_trees): Move definitions from objc-act.c. * objc/objc-tree.def: Update copyright info. From-SVN: r46000
2001-10-04 00:05:57 +02:00
CLASS_NST_METHODS (objc_implementation_context), '-');
if (CLASS_PROTOCOL_LIST (implementation_template))
check_protocols (CLASS_PROTOCOL_LIST (implementation_template),
"class",
c-parse.in (objc_inherit_code, [...]): Make static. 2001-10-03 Ziemowit Laski <zlaski@apple.com> * c-parse.in (objc_inherit_code, objc_pq_context, objc_public_flag): Make static. (objc_interface_context, objc_implementation_context, objc_method_context, objc_ivar_chain, objc_ivar_context): Move to global tree array in objc/objc-act.[ch]. (methoddef): Remove unnecessary code. * objc/objc-act.c: (hashed_attribute, hashed_entry, imp_entry): Hoist struct definitions to objc-act.h. (nst_method_hash_list, cls_method_hash_list, imp_list, imp_count, cat_count): Place declaration in objc-act.h. (objc_tree_index): Move enumeration to objc-act.h. (objc_global_trees): Place declaration and macro accessors in objc-act.h. (implementation_context): Remove duplicate; use objc_implementation_context instead: (method_context): Remove duplicate; use objc_method_context instead. (objc_ellipsis_node, objc_method_prototype_template, implemented_classes, function_type): Move global vars to objc_global_trees. (init_objc): Use LAST_BASE_TREE_CODE instead of LAST_CODE. (build_message_expr): Move actual construction of ObjC message send nodes to finish_message_expr. (finish_message_expr): New routine, contains code formerly in build_message_expr. * objc/objc-act.h (finish_message_expr): New prototype. (objc_ivar_chain, objc_method_context, objc_ellipsis_node): Remove declarations; these vars are now part of objc_global_trees. (objc_tree_index, objc_global_trees): Move definitions from objc-act.c. * objc/objc-tree.def: Update copyright info. From-SVN: r46000
2001-10-04 00:05:57 +02:00
IDENTIFIER_POINTER (CLASS_NAME (objc_implementation_context)));
1992-01-18 00:15:38 +01:00
}
}
else if (TREE_CODE (class) == CATEGORY_IMPLEMENTATION_TYPE)
1992-01-18 00:15:38 +01:00
{
tree category = lookup_category (implementation_template, CLASS_SUPER_NAME (class));
1992-01-18 00:15:38 +01:00
if (category)
{
1996-07-04 00:07:53 +02:00
/* Ensure all method listed in the interface contain bodies. */
1992-01-18 00:15:38 +01:00
check_methods (CLASS_CLS_METHODS (category),
c-parse.in (objc_inherit_code, [...]): Make static. 2001-10-03 Ziemowit Laski <zlaski@apple.com> * c-parse.in (objc_inherit_code, objc_pq_context, objc_public_flag): Make static. (objc_interface_context, objc_implementation_context, objc_method_context, objc_ivar_chain, objc_ivar_context): Move to global tree array in objc/objc-act.[ch]. (methoddef): Remove unnecessary code. * objc/objc-act.c: (hashed_attribute, hashed_entry, imp_entry): Hoist struct definitions to objc-act.h. (nst_method_hash_list, cls_method_hash_list, imp_list, imp_count, cat_count): Place declaration in objc-act.h. (objc_tree_index): Move enumeration to objc-act.h. (objc_global_trees): Place declaration and macro accessors in objc-act.h. (implementation_context): Remove duplicate; use objc_implementation_context instead: (method_context): Remove duplicate; use objc_method_context instead. (objc_ellipsis_node, objc_method_prototype_template, implemented_classes, function_type): Move global vars to objc_global_trees. (init_objc): Use LAST_BASE_TREE_CODE instead of LAST_CODE. (build_message_expr): Move actual construction of ObjC message send nodes to finish_message_expr. (finish_message_expr): New routine, contains code formerly in build_message_expr. * objc/objc-act.h (finish_message_expr): New prototype. (objc_ivar_chain, objc_method_context, objc_ellipsis_node): Remove declarations; these vars are now part of objc_global_trees. (objc_tree_index, objc_global_trees): Move definitions from objc-act.c. * objc/objc-tree.def: Update copyright info. From-SVN: r46000
2001-10-04 00:05:57 +02:00
CLASS_CLS_METHODS (objc_implementation_context), '+');
1992-01-18 00:15:38 +01:00
check_methods (CLASS_NST_METHODS (category),
c-parse.in (objc_inherit_code, [...]): Make static. 2001-10-03 Ziemowit Laski <zlaski@apple.com> * c-parse.in (objc_inherit_code, objc_pq_context, objc_public_flag): Make static. (objc_interface_context, objc_implementation_context, objc_method_context, objc_ivar_chain, objc_ivar_context): Move to global tree array in objc/objc-act.[ch]. (methoddef): Remove unnecessary code. * objc/objc-act.c: (hashed_attribute, hashed_entry, imp_entry): Hoist struct definitions to objc-act.h. (nst_method_hash_list, cls_method_hash_list, imp_list, imp_count, cat_count): Place declaration in objc-act.h. (objc_tree_index): Move enumeration to objc-act.h. (objc_global_trees): Place declaration and macro accessors in objc-act.h. (implementation_context): Remove duplicate; use objc_implementation_context instead: (method_context): Remove duplicate; use objc_method_context instead. (objc_ellipsis_node, objc_method_prototype_template, implemented_classes, function_type): Move global vars to objc_global_trees. (init_objc): Use LAST_BASE_TREE_CODE instead of LAST_CODE. (build_message_expr): Move actual construction of ObjC message send nodes to finish_message_expr. (finish_message_expr): New routine, contains code formerly in build_message_expr. * objc/objc-act.h (finish_message_expr): New prototype. (objc_ivar_chain, objc_method_context, objc_ellipsis_node): Remove declarations; these vars are now part of objc_global_trees. (objc_tree_index, objc_global_trees): Move definitions from objc-act.c. * objc/objc-tree.def: Update copyright info. From-SVN: r46000
2001-10-04 00:05:57 +02:00
CLASS_NST_METHODS (objc_implementation_context), '-');
if (CLASS_PROTOCOL_LIST (category))
check_protocols (CLASS_PROTOCOL_LIST (category),
"category",
c-parse.in (objc_inherit_code, [...]): Make static. 2001-10-03 Ziemowit Laski <zlaski@apple.com> * c-parse.in (objc_inherit_code, objc_pq_context, objc_public_flag): Make static. (objc_interface_context, objc_implementation_context, objc_method_context, objc_ivar_chain, objc_ivar_context): Move to global tree array in objc/objc-act.[ch]. (methoddef): Remove unnecessary code. * objc/objc-act.c: (hashed_attribute, hashed_entry, imp_entry): Hoist struct definitions to objc-act.h. (nst_method_hash_list, cls_method_hash_list, imp_list, imp_count, cat_count): Place declaration in objc-act.h. (objc_tree_index): Move enumeration to objc-act.h. (objc_global_trees): Place declaration and macro accessors in objc-act.h. (implementation_context): Remove duplicate; use objc_implementation_context instead: (method_context): Remove duplicate; use objc_method_context instead. (objc_ellipsis_node, objc_method_prototype_template, implemented_classes, function_type): Move global vars to objc_global_trees. (init_objc): Use LAST_BASE_TREE_CODE instead of LAST_CODE. (build_message_expr): Move actual construction of ObjC message send nodes to finish_message_expr. (finish_message_expr): New routine, contains code formerly in build_message_expr. * objc/objc-act.h (finish_message_expr): New prototype. (objc_ivar_chain, objc_method_context, objc_ellipsis_node): Remove declarations; these vars are now part of objc_global_trees. (objc_tree_index, objc_global_trees): Move definitions from objc-act.c. * objc/objc-tree.def: Update copyright info. From-SVN: r46000
2001-10-04 00:05:57 +02:00
IDENTIFIER_POINTER (CLASS_SUPER_NAME (objc_implementation_context)));
1992-01-18 00:15:38 +01:00
}
}
1992-01-18 00:15:38 +01:00
}
static tree
add_protocol (tree protocol)
{
1996-07-04 00:07:53 +02:00
/* Put protocol on list in reverse order. */
TREE_CHAIN (protocol) = protocol_chain;
protocol_chain = protocol;
return protocol_chain;
}
static tree
lookup_protocol (tree ident)
{
tree chain;
for (chain = protocol_chain; chain; chain = TREE_CHAIN (chain))
if (ident == PROTOCOL_NAME (chain))
return chain;
return NULL_TREE;
}
/* This function forward declares the protocols named by NAMES. If
they are already declared or defined, the function has no effect. */
void
objc_declare_protocols (tree names)
{
tree list;
#ifdef OBJCPLUS
if (current_namespace != global_namespace) {
error ("Objective-C declarations may only appear in global scope");
}
#endif /* OBJCPLUS */
for (list = names; list; list = TREE_CHAIN (list))
{
tree name = TREE_VALUE (list);
if (lookup_protocol (name) == NULL_TREE)
{
tree protocol = make_node (PROTOCOL_INTERFACE_TYPE);
c-tree.h (TYPE_ACTUAL_ARG_TYPES): Use TYPE_LANG_SLOT_1. * c-tree.h (TYPE_ACTUAL_ARG_TYPES): Use TYPE_LANG_SLOT_1. * dwarf2out.c (add_data_member_location_attribute): Check for TREE_BINFO. * tree.c (tree_node_kinds): Add "binfos". (binfo_lang_slots): New. (make_node_stat): Add TREE_BINFO. (make_tree_binfo_stat): New. (tree_node_structure): Add TREE_BINFO. * tree.def (TREE_BINFO): New. * tree.h (REC_OR_UNION_CHECK): Rename to ... (RECORD_OR_UNION_CHECK): ... here. (NOT_RECORD_OR_UNION_CHECK): New. (TRE_VIA_VIRTUAL): Allow TREE_LIST or TREE_BINFO. (TYPE_FIELDS, TYPE_METHODS, TYPE_VFIELD): Adjust for RECORD_OR_UNION_CHECK. (TYPE_BINFO): Use RECORD_OR_UNION_CHECK. (TYPE_LANG_SLOT_1): New. (BINFO_TYPE, BINFO_OFFSET, BINFO_VTABLE, BINFO_VIRTUALS, BINFO_BASETYPES, TYPE_BINFO_BASETYPES, BINFO_VPTR_FIELD, BINFO_BASEACCESSES, BINFO_INHERITANCE_CHAIN): Adjust. (BINFO_ELTS): Remove. (BINFO_LANG_SLOT): New. (struct tree_binfo): New. (binfo_lang_slots): Declare. (enum tree_node_structure_enum): Add TS_BINFO. (union tree_node): Add binfo. (make_tree_binfo_stat): Declare. (make_tree_binfo): New. (enum tree_node_kind): Add binfo_kind. * cp/call.c (enforce_access): Expect TREE_BINFO. * cp/class.c (binfo_ctor_vtable): Check TREE_BINFO. * cp/cp-tree.h (RECORD_OR_UNION_TYPE_CHECK): Remove. (BINFO_SUBVTT_INDEX, BINFO_VPTR_INDEX, BINFO_PRIMARY_BASE_OF): Adjust. (BINFO_LANG_ELTS): Remove. (BINFO_LANG_SLOTS): New. (TYPE_RAISES_EXCEPTIONS, ENUM_TEMPLATE_INFO): Use TYPE_LANG_SLOT_1. (CLASSTYPE_TEMPLATE_INFO): Adjust. * cp/pt.c (tsubst): Split TREE_BINFO case from TREE_VEC case. * cp/search.c (lookup_member): Check TREE_BINFO. * cp/semantics.c (perform_or_defer_access_check): Likewise. (check_accessibility_of_qualified_id): Check deferred_access_no_check. * cp/tree.c (make_binfo): Use make_tree_binfo. * java/class.c (make_class): Use make_tree_binfo. (set_super_info, add_interface_do): Likewise. * java/java-tree.h (CLASS_HAS_SUPER_FLAG): Expect a BINFO. * objc/objc-act.c (start_class, objc_declare_protocols, start_protocols): Use TYPE_LANG_SLOT_1. * objc/objc-act.h (CLASS_BINFO_ELTS, PROTOCOL_BINFO_ELTS): Rename to ... (CLASS_LANG_SLOT_ELTS, PROTOCOL_LANG_SLOT_ELTS): ... here. (CLASS_IVARS, CLASS_RAW_IVARS, CLASS_STATIC_TEMPLATE, CLASS_CATEGORY_LIST, CLASS_PROTOCOL_LIST, CLASS_OWN_IVARS, PROTOCOL_LIST, PROTOCOL_FORWARD_DECL): Use TYPE_LANG_SLOT_1. From-SVN: r84110
2004-07-05 11:35:44 +02:00
TYPE_LANG_SLOT_1 (protocol)
= make_tree_vec (PROTOCOL_LANG_SLOT_ELTS);
PROTOCOL_NAME (protocol) = name;
PROTOCOL_LIST (protocol) = NULL_TREE;
add_protocol (protocol);
PROTOCOL_DEFINED (protocol) = 0;
PROTOCOL_FORWARD_DECL (protocol) = NULL_TREE;
}
}
}
Makefile.in (c-parse.o): Depend on $(C_COMMON_H). [gcc/ChangeLog] 2004-09-07 Ziemowit Laski <zlaski@apple.com> * Makefile.in (c-parse.o): Depend on $(C_COMMON_H). * c-parse.in: Include c-common.h instead of objc-act.h. (ivar_decl_list, ivar_decls, ivar_decl, ivars, ivar_declarator, myparms, myparm): Remove %type declarations. (methodtype, optparms, OBJC_TYPE_QUAL, objc_quals, objc_qual, objc_typename, objc_try_catch_stmt, optellipsis): Add %type declarations. (objc_inherit_code, objc_public_flag): Remove. (typespec_nonreserved_nonattr): Call objc_get_protocol_qualified_type() instead of get_static_reference() and get_protocol_reference(). (stmt_nocomp): Call grokparm() on @catch parameter. (objcdef): Move semantic action to objc_finish_implementation(). (classdef): Move semantic action to objc_start_class_interface(), objc_continue_interface(), objc_finish_interface(), objc_start_class_implementation(), objc_continue_implementation(), objc_start_category_interface() and objc_start_category_implementation(). (protocoldef): Move semantic actions to objc_start_protocol() and objc_finish_interface(). (ivar_decl_list): Remove nonterminal. (visibility_spec): Move semantic actions to objc_set_visibility(). (ivar_decls): Remove assignment to $$. (ivar_decl): Rephrase in terms of component_decl; call objc_add_instance_variable(). (ivars, ivar_declarator): Remove nonterminals. (opt_semi): New nonterminal. (methodtype): Remove semantic actions. (methoddef): Move semantic actions to objc_set_method_type(), objc_start_method_definition() and objc_finish_method_definition(). (methodproto): Move semantic actions to objc_set_method_type() and objc_add_method_declaration(). (methoddecl): Use objc_typename instead of typename; move semantic actions to objc_build_method_signature(). (optarglist, myxdecls, mydecl, myparms, myparm): Remove nonterminals. (optparmlist): Express in terms of optparms and optellipsis. (optparms, optellipsis, objc_qual, objc_quals, objc_typename): New nonterminals. (keyworddecl): Use objc_typename instead of typename. (rid_to_yy): Mark RID_IN, RID_OUT, RID_INOUT, RID_BYCOPY, RID_BYREF and RID_ONEWAY as returning OBJC_TYPE_QUAL to yyparse(). [gcc/objc/ChangeLog] 2004-09-07 Ziemowit Laski <zlaski@apple.com> * Make-lang.in (objc/objc-parse.o): Depend on $(C_COMMON_H) instead of objc/objc-act.h. (objc/objc-act.o): Depend on $(HASHTAB_H). * objc-act.c: Include hashtab.h; in ObjC++ mode, include cp-tree.h and objcp-decl.h instead of c-tree.h. (build_module_descriptor, get_class_ivars, synth_id_with_class_suffix, error_with_ivar, gen_method_decl, gen_declaration, setup_string_decl, build_protocol_template): Adjust prototypes. (build_module_initializer_routine, start_class, continue_class, finish_class, start_method_def, objc_start_function, start_protocol, build_method_decl, objc_add_method, add_instance_variable, build_ivar_reference, is_ivar, is_private, get_super_receiver, build_selector_table_decl, objc_push_parm, objc_get_parm_info, gen_type_name, gen_type_name_0, start_var_decl, finish_var_decl, create_field_decl): New prototypes. (objc_expand_function_end, comp_method_with_proto, objc_expr_last, gen_declaration_1, gen_declarator, is_complex_decl, adorn_decl, define_decl, create_builtin_decl, gen_declspecs): Remove prototypes. (TYPE_ID): Rename to OBJECT_TYPEDEF_NAME. (CLASS_TYPEDEF_NAME): New. (TAG_EXECCLASS): Change from a global variable to a #define. (TAG_RETURN_STRUCT): Delete. (TAG_GNUINIT): New, holds '__objc_gnu_init' name. (objc_inherit_code, objc_public_flag): New, moved from c-parse.in. (string_descriptor): New struct. (string_htab): New hash table. (string_hash, string_eq): New prototypes. (generate_struct_by_value_array): Call create_field_decl() instead of create_builtin_decl(). (objc_init): Do not initialize objc_ellipsis_node or TAG_EXECCLASS; In ObjC++ mode, call cxx_init() instead of c_objc_common_init(). (objc_finish_file): In ObjC++, call instantiate_pending_templates() and cp_finish_file(). (define_decl, get_static_reference, get_protocol_reference, create_builtin_decl): Remove functions. (objc_start_class_interface, objc_start_category_interface, objc_start_protocol, objc_continue_interface, objc_finish_interface, objc_start_class_implementation, objc_start_category_implementation, objc_continue_implementation, objc_finish_implementation, objc_set_visibility, objc_set_method_type, objc_build_method_signature, objc_add_method_declaration, objc_start_method_definition, objc_add_instance_variable, objc_get_protocol_qualified_type, create_field_decl, start_var_decl, finish_var_decl): New functions. (setup_string_decl): Simplify since it is only called once. (synth_module_prologue): Call build_class_template(); predefine 'id' and 'Class' as typedefs; rename 'temp_type' to 'type'; disable debug hooks for duration of function; fix GNU runtime messenger signatures to correspond to reality; forward-declare '__objc_exec_class' for the GNU runtime; call build_selector_table_decl(); in ObjC++ mode, generate 'extern "C" { ... }' wrappers around synthesized declarations; call build_protocol_template() and build_category_template(). (string_hash, string_eq): New functions. (objc_build_string_object): Check metaclass correctness only once; store string literals in hash table. (objc_build_constructor): Do not convert initializer elements; adjust for ObjC++ impedance mismatch. (build_objc_symtab_template): Call create_field_decl() instead of create_builtin_decl(). (init_objc_symtab): Add missing conversion to initializer element. (build_metadata_decl): Call start_var_decl() instead of define_decl(). (generate_objc_symtab_decl): Do not call build_category_template(); call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(). (build_module_descriptor): Call create_field_decl() instead of grokfield(); call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(); always mark module descriptor as used; move GNU runtime-specific functionality to build_module_initializer_routine(). (build_module_initializer_routine): New function, broken off of build_module_descriptor(). (objc_static_init_needed_p, objc_generate_static_init_call): New functions. (generate_static_references, generate_strings, build_selector_translation_table, generate_descriptor_table, generate_ivars_list, generate_dispatch_table, generate_category): Call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(); build a type directly instead of via groktypename(). (build_selector_reference_decl, build_selector_table_decl, build_class_reference_decl, build_protocol_reference, generate_objc_image_info): Call start_var_decl() instead of build_decl(). (build_selector_reference): For GNU runtime, do not call build_selector_reference_decl(). (build_selector, build_typed_selector_reference): Always convert result to the selector type. (add_objc_string): Cast return value to 'char *'. (build_method_prototype_template, build_selector_template, build_method_template): Use actual selector type for fields pointing to selectors. (finish_objc): For GNU runtime, call build_module_initializer_routine() after build_module_descriptor(). (generate_protocol_list, generate_shared_structures): Call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(); build a type directly instead of via groktypename(). (synth_id_with_class_suffix): Return a string. (get_arg_type_list): For instance methods, use the instance type for 'self'; do not call groktypename_in_parm_context(). (build_objc_string_decl): Squash redeclaration errors in ObjC++. (objc_is_class_name): Use OBJC_TYPE_NAME instead of TYPE_NAME; handle RECORD_TYPEs in ObjC as well as ObjC++. (objc_is_id): New function. (objc_is_object_ptr): Return the canonical type node. (objc_get_class_ivars): Simplify using get_class_ivars(). (get_class_ivars): Remove second parameter; create a fresh copy of the ivar list for each call; do not check for existence of super class. (objc_eh_runtime_type): Mark #ifndef OBJCPLUS. (objc_init_exceptions): When using SJLJ-style exceptions, require the use of '-fobjc-exceptions' flag; do not require it for DWARF-style exceptions. (objc_build_exc_ptr, next_sjlj_build_try_catch_finally): Use objc_object_type instead of objc_id_type. (objc_begin_catch_clause): Convert the incoming PARM_DECL into a VAR_DECL before placing it in the appropriate scope; do not call define_decl(); adjust call to c_begin_compound_stmt(); use objc_object_type instead of objc_id_type. (build_next_objc_exception_stuff): Call create_field_decl() instead of create_builtin_decl(); construct type directly instead of calling groktypename(); use OBJC_VOID_AT_END to mark end of function parameters. (build_private_template): Adjust call to get_class_ivars(); build a type directly instead of via groktypename(). (build_protocol_template, build_method_prototype_list_template, build_method_prototype_template, build_category_template, build_selector_template, build_class_template, build_super_template, build_ivar_template, build_ivar_list_template, build_method_list_template, build_method_template): Call create_field_decl() instead of grokfield(). (objc_method_parm_type): Do not call groktypename(). (generate_descriptor_table): Call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(). (generate_method_descriptors, build_protocol_initializer, generate_dispatch_tables, build_category_initializer, build_shared_structure_initializer): Do not call groktypename(). (generate_protocols): Call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(); do not call groktypename(). (error_with_ivar): Remove last parameter. (check_ivars): Do not iterate ovar CLASS_RAW_IVARS lists in addition to CLASS_IVARS lists; adjust calls to error_with_ivar(). (generate_ivar_lists): Convert one of the initializer elements; do not call groktypename(). (get_arg_type_list, start_method_def, gen_method_def): Account for new representation of variable arguments and '...' in Objective-C methods; add Objective-C++ impedance matching code. (is_objc_type_qualifier): Remove function. (adjust_type_for_id_default): Simplify; there is no longer a need to wade through declspecs. (lookup_interface, start_class, continue_class, finish_class, start_method_def, start_protocol, build_method_decl, objc_add_method, add_instance_variable, build_ivar_reference, is_ivar, is_private, get_super_receiver, objc_build_finally_epilogue): Make into static functions. (receiver_is_class_object): Use new IS_CLASS() macro. (objc_build_message_expr): Tweak ObjC++ message argument handling; call objc_finish_message_expr() instead of finish_message_expr(). (finish_message_expr): Rename to objc_finish_message_expr(); use OBJC_TYPE_NAME and OBJC_SET_TYPE_NAME macros instead of TYPE_NAME. call gen_type_name() instead of gen_declaration(); call objc_is_id() instead of using IS_ID and IS_CLASS; Use objc_class_name instead of calling get_identifier("Class"); handle CONVERT_EXPRs in receiver. (build_objc_method_call, warn_with_method): Do not call groktypename(). (build_ivar_reference): Call convert() instead of clobbering in a type. (hash_init): Initialize string_htab hash table. (add_instance_variable): Simplify parameter list; do not call grokfield(); do not populate CLASS_IVARS list. (start_class): Check for the existence of super class, if one was specified. (continue_class): Use CLASS_RAW_IVARS rather than CLASS_IVARS; do not call build_class_template(); adjust call to get_class_ivars(); call build_decl(), pushdecl() and finish_decl() instead of define_decl(). (finish_class): Call build_decl(), pushdecl() and finish_decl() instead of define_decl(). (add_protocols): Use PROTOCOL_BINFO_ELTS for the tree vector size. (start_protocol): Do not call build_protocol_template(); use PROTOCOL_BINFO_ELTS for the tree vector size. (encode_type_qualifiers): Do not handle the 'const' qualifier here. (encode_pointer): Encode 'const char *' as 'r*', for backwards compatibility. (encode_array): Use HOST_WIDE_INT_PRINT_DEC instead of "%ld". (encode_type): Handle the 'const' qualifier here. (objc_parmlist): New global variable, sued by objc_push_parm and objc_get_parm_info(). (objc_push_parm, objc_get_parm_info): New functions. (objc_expr_last): Remove function. (synth_self_and_ucmd_args): For instance methods, use the instance type for 'self'; call objc_push_parm() instead of push_parm_decl(). (start_method_def): Do not call push_scope(), declare_parm_level(), pop_scope(), push_parm_decl(), store_parm_decls() or objc_expr_last(); just use objc_push_parm() and objc_get_parm_info(). (comp_method_with_proto): Remove function. (objc_types_are_equivalent): Strip away indirections before comparing underlying types. (comp_proto_with_proto): Do not call groktypename(); types are no longer in raw declspec format. (objc_start_function): New function. (really_start_method): Call comp_proto_with_proto() instead of comp_method_with_proto(); call objc_start_function() instead of hand-crafting a function declarator. (continue_method_def, objc_expand_function_end): Remove functions. (get_super_receiver): Call objc_get_current_scope() instead of get_current_scope(); reference 'super_class' field (instead of 'class'). (finish_method_def): Rename to objc_finish_method_definition() and add a function decl parameter; move method encoding call from objc_expand_function_end(). (is_complex_decl, adorn_decl, gen_declarator, gen_declspecs, gen_declaration_1): Remove functions. (tmpbuf, RAW_DECLSPEC): Remove. (gen_declaration): Remove second parameter; simplify to deal with TYPE_P nodes instead of raw declspecs. (gen_type_name, gen_type_name_0): New functions. (gen_method_decl): Remove second parameter; call gen_type_name() instead of gen_declaration_1(). (dump_interface): Adjust calls to gen_declaration() and gen_method_decl(); do not allocate a separate string buffer. (init_objc): Allocate a larger string buffer to accommodate dump_interface(); adjust call to build_module_descriptor(); add call to build_module_initializer_routine() for the GNU runtime. (generate_classref_translation_entry): Do not call start_decl(); call finish_var_decl() instead of finish_decl(); call convert() instead of build_c_cast(). * objc-act.h (CLASS_OWN_IVARS): Remove accessor. (CLASS_BINFO_ELTS): Reduce from 6 to 5, now that CLASS_OWN_IVARS is gone. (OCTI_GNU_INIT_DECL, GNU_INIT_decl): New. (OCTI_ELLIPSIS_NODE, objc_ellipsis_node): Remove. (OCTI_ID_ID, id_type, objc_id_id): Rename to OCTI_ID_NAME, objc_object_type and objc_object_name, respectively. (OCTI_CLS_REF, OCTI_CLASS_NAME, objc_class_reference, objc_class_name): New. (IS_CLASS): New macro. (IS_ID, IS_SUPER): Robustify. (OCTI_EXECCLASS_DECL, execclass_decl): New. (finish_file, start_class, continue_class, finish_class, start_method_def, continue_method_def, finish_method_def, start_protocol, finish_protocol, objc_build_throw_stmt, objc_build_try_catch_finally_stmt, objc_build_synchronized_prologue, objc_build_synchronized_epilogue, objc_build_try_prologue, objc_build_try_epilogue, objc_build_catch_stmt, objc_build_catch_epilogue, objc_build_finally_prologue, objc_build_finally_epilogue, is_ivar, is_private, is_public, add_instance_variable, objc_add_method, get_super_receiver, objc_clear_super_receiver, get_class_ivars_from_name, get_class_reference, get_static_reference, get_object_reference, build_message_expr, finish_message_expr, build_selector_expr, build_ivar_reference, build_keyword_decl, build_method_decl, build_protocol_expr, build_objc_string_object, objc_declare_alias, objc_declare_class, objc_declare_protocols, objc_comptypes, objc_check_decl, build_encode_expr): Remove prototypes. (imp_count, cat_count): Make GGC-aware. (OBJC_SET_TYPE_NAME): New macro. From-SVN: r87168
2004-09-08 02:49:44 +02:00
static tree
start_protocol (enum tree_code code, tree name, tree list)
{
tree protocol;
#ifdef OBJCPLUS
if (current_namespace != global_namespace) {
error ("Objective-C declarations may only appear in global scope");
}
#endif /* OBJCPLUS */
protocol = lookup_protocol (name);
if (!protocol)
{
protocol = make_node (code);
c-tree.h (TYPE_ACTUAL_ARG_TYPES): Use TYPE_LANG_SLOT_1. * c-tree.h (TYPE_ACTUAL_ARG_TYPES): Use TYPE_LANG_SLOT_1. * dwarf2out.c (add_data_member_location_attribute): Check for TREE_BINFO. * tree.c (tree_node_kinds): Add "binfos". (binfo_lang_slots): New. (make_node_stat): Add TREE_BINFO. (make_tree_binfo_stat): New. (tree_node_structure): Add TREE_BINFO. * tree.def (TREE_BINFO): New. * tree.h (REC_OR_UNION_CHECK): Rename to ... (RECORD_OR_UNION_CHECK): ... here. (NOT_RECORD_OR_UNION_CHECK): New. (TRE_VIA_VIRTUAL): Allow TREE_LIST or TREE_BINFO. (TYPE_FIELDS, TYPE_METHODS, TYPE_VFIELD): Adjust for RECORD_OR_UNION_CHECK. (TYPE_BINFO): Use RECORD_OR_UNION_CHECK. (TYPE_LANG_SLOT_1): New. (BINFO_TYPE, BINFO_OFFSET, BINFO_VTABLE, BINFO_VIRTUALS, BINFO_BASETYPES, TYPE_BINFO_BASETYPES, BINFO_VPTR_FIELD, BINFO_BASEACCESSES, BINFO_INHERITANCE_CHAIN): Adjust. (BINFO_ELTS): Remove. (BINFO_LANG_SLOT): New. (struct tree_binfo): New. (binfo_lang_slots): Declare. (enum tree_node_structure_enum): Add TS_BINFO. (union tree_node): Add binfo. (make_tree_binfo_stat): Declare. (make_tree_binfo): New. (enum tree_node_kind): Add binfo_kind. * cp/call.c (enforce_access): Expect TREE_BINFO. * cp/class.c (binfo_ctor_vtable): Check TREE_BINFO. * cp/cp-tree.h (RECORD_OR_UNION_TYPE_CHECK): Remove. (BINFO_SUBVTT_INDEX, BINFO_VPTR_INDEX, BINFO_PRIMARY_BASE_OF): Adjust. (BINFO_LANG_ELTS): Remove. (BINFO_LANG_SLOTS): New. (TYPE_RAISES_EXCEPTIONS, ENUM_TEMPLATE_INFO): Use TYPE_LANG_SLOT_1. (CLASSTYPE_TEMPLATE_INFO): Adjust. * cp/pt.c (tsubst): Split TREE_BINFO case from TREE_VEC case. * cp/search.c (lookup_member): Check TREE_BINFO. * cp/semantics.c (perform_or_defer_access_check): Likewise. (check_accessibility_of_qualified_id): Check deferred_access_no_check. * cp/tree.c (make_binfo): Use make_tree_binfo. * java/class.c (make_class): Use make_tree_binfo. (set_super_info, add_interface_do): Likewise. * java/java-tree.h (CLASS_HAS_SUPER_FLAG): Expect a BINFO. * objc/objc-act.c (start_class, objc_declare_protocols, start_protocols): Use TYPE_LANG_SLOT_1. * objc/objc-act.h (CLASS_BINFO_ELTS, PROTOCOL_BINFO_ELTS): Rename to ... (CLASS_LANG_SLOT_ELTS, PROTOCOL_LANG_SLOT_ELTS): ... here. (CLASS_IVARS, CLASS_RAW_IVARS, CLASS_STATIC_TEMPLATE, CLASS_CATEGORY_LIST, CLASS_PROTOCOL_LIST, CLASS_OWN_IVARS, PROTOCOL_LIST, PROTOCOL_FORWARD_DECL): Use TYPE_LANG_SLOT_1. From-SVN: r84110
2004-07-05 11:35:44 +02:00
TYPE_LANG_SLOT_1 (protocol) = make_tree_vec (PROTOCOL_LANG_SLOT_ELTS);
PROTOCOL_NAME (protocol) = name;
PROTOCOL_LIST (protocol) = lookup_and_install_protocols (list);
add_protocol (protocol);
PROTOCOL_DEFINED (protocol) = 1;
PROTOCOL_FORWARD_DECL (protocol) = NULL_TREE;
check_protocol_recursively (protocol, list);
}
else if (! PROTOCOL_DEFINED (protocol))
{
PROTOCOL_DEFINED (protocol) = 1;
PROTOCOL_LIST (protocol) = lookup_and_install_protocols (list);
check_protocol_recursively (protocol, list);
}
else
{
diagnostic.c (warning): Accept parameter to classify warning option. * diagnostic.c (warning): Accept parameter to classify warning option. (warning0): New, for when a pointer to an error() like function is needed. * errors.c (warning): Likewise. * errors.h (warning, warning0): Adjust prototypes. * toplev.h (warning, warning0): Likewise. * attribs.c, builtins.c, c-common.c, c-decl.c, c-format.c, c-gimplify.c, c-lex.c, c-objc-common.c, c-opts.c, c-parser.c, c-pragma.c, c-typeck.c, calls.c, cgraph.c, coverage.c, emit-rtl.c, fold-const.c, fortran/trans-decl.c, function.c, gcse.c, genautomata.c, haifa-sched.c, opts.c, passes.c, regclass.c, reload1.c, stmt.c, stor-layout.c, toplev.c, tree-cfg.c, tree-dump.c, tree-inline.c, tree-mudflap.c, tree-optimize.c, tree-ssa.c, tree.c, varasm.c: Adjust warning() callers. * config/alpha/alpha.c, config/arc/arc.c, config/arm/arm.c, config/avr/avr.c, config/bfin/bfin.c, config/c4x/c4x-c.c, config/c4x/c4x.c, config/cris/cris.c, config/darwin-c.c, config/darwin.c, config/darwin.h, config/h8300/h8300.c, config/i386/cygming.h, config/i386/djgpp.h, config/i386/i386.c, config/i386/winnt.c, config/ia64/ia64-c.c, config/ia64/ia64.c, config/ip2k/ip2k.c, config/m32r/m32r.c, config/m68hc11/m68hc11.c, config/m68k/m68k.c, config/mcore/mcore.c, config/mips/mips.c, config/mmix/mmix.c, config/ns32k/ns32k.c, config/pa/pa-hpux11.h, config/pa/pa.c, config/rs6000/aix43.h, config/rs6000/aix51.h, config/rs6000/aix52.h, config/rs6000/darwin.h, config/rs6000/rs6000-c.c, config/rs6000/rs6000.c, config/s390/s390.c, config/sh/sh.c, config/sh/sh.h, config/sh/symbian.c, config/sol2-c.c, config/sol2.c, config/stormy16/stormy16.c, config/v850/v850-c.c, config/v850/v850.c, config/xtensa/xtensa.c: Adjust warning() callers. * ada/misc.c: Adjust warning() callers. * cp/call.c, cp/class.c, cp/cvt.c, cp/decl.c, cp/decl2.c, cp/except.c, cp/friend.c, cp/init.c, cp/lex.c, cp/mangle.c, cp/method.c, cp/name-lookup.c, cp/parser.c, cp/repo.c, cp/rtti.c, cp/tree.c, cp/typeck.c, cp/typeck2.c: Adjust warning() callers. * fortran/trans-decl.c: Adjust warning() callers. * java/class.c, java/decl.c, java/expr.c, java/jcf-io.c, java/jcf-parse.c, java/jv-scan.c, java/parse.y: Adjust warning() callers. * objc/objc-act.c: Adjust warning() callers. * treelang/parse.y: Adjust warning() callers. From-SVN: r98633
2005-04-23 23:29:07 +02:00
warning (0, "duplicate declaration for protocol %qs",
IDENTIFIER_POINTER (name));
}
return protocol;
}
1992-01-18 00:15:38 +01:00
/* "Encode" a data type into a string, which grows in util_obstack.
??? What is the FORMAT? Someone please document this! */
static void
encode_type_qualifiers (tree declspecs)
{
tree spec;
for (spec = declspecs; spec; spec = TREE_CHAIN (spec))
{
Makefile.in (c-parse.o): Depend on $(C_COMMON_H). [gcc/ChangeLog] 2004-09-07 Ziemowit Laski <zlaski@apple.com> * Makefile.in (c-parse.o): Depend on $(C_COMMON_H). * c-parse.in: Include c-common.h instead of objc-act.h. (ivar_decl_list, ivar_decls, ivar_decl, ivars, ivar_declarator, myparms, myparm): Remove %type declarations. (methodtype, optparms, OBJC_TYPE_QUAL, objc_quals, objc_qual, objc_typename, objc_try_catch_stmt, optellipsis): Add %type declarations. (objc_inherit_code, objc_public_flag): Remove. (typespec_nonreserved_nonattr): Call objc_get_protocol_qualified_type() instead of get_static_reference() and get_protocol_reference(). (stmt_nocomp): Call grokparm() on @catch parameter. (objcdef): Move semantic action to objc_finish_implementation(). (classdef): Move semantic action to objc_start_class_interface(), objc_continue_interface(), objc_finish_interface(), objc_start_class_implementation(), objc_continue_implementation(), objc_start_category_interface() and objc_start_category_implementation(). (protocoldef): Move semantic actions to objc_start_protocol() and objc_finish_interface(). (ivar_decl_list): Remove nonterminal. (visibility_spec): Move semantic actions to objc_set_visibility(). (ivar_decls): Remove assignment to $$. (ivar_decl): Rephrase in terms of component_decl; call objc_add_instance_variable(). (ivars, ivar_declarator): Remove nonterminals. (opt_semi): New nonterminal. (methodtype): Remove semantic actions. (methoddef): Move semantic actions to objc_set_method_type(), objc_start_method_definition() and objc_finish_method_definition(). (methodproto): Move semantic actions to objc_set_method_type() and objc_add_method_declaration(). (methoddecl): Use objc_typename instead of typename; move semantic actions to objc_build_method_signature(). (optarglist, myxdecls, mydecl, myparms, myparm): Remove nonterminals. (optparmlist): Express in terms of optparms and optellipsis. (optparms, optellipsis, objc_qual, objc_quals, objc_typename): New nonterminals. (keyworddecl): Use objc_typename instead of typename. (rid_to_yy): Mark RID_IN, RID_OUT, RID_INOUT, RID_BYCOPY, RID_BYREF and RID_ONEWAY as returning OBJC_TYPE_QUAL to yyparse(). [gcc/objc/ChangeLog] 2004-09-07 Ziemowit Laski <zlaski@apple.com> * Make-lang.in (objc/objc-parse.o): Depend on $(C_COMMON_H) instead of objc/objc-act.h. (objc/objc-act.o): Depend on $(HASHTAB_H). * objc-act.c: Include hashtab.h; in ObjC++ mode, include cp-tree.h and objcp-decl.h instead of c-tree.h. (build_module_descriptor, get_class_ivars, synth_id_with_class_suffix, error_with_ivar, gen_method_decl, gen_declaration, setup_string_decl, build_protocol_template): Adjust prototypes. (build_module_initializer_routine, start_class, continue_class, finish_class, start_method_def, objc_start_function, start_protocol, build_method_decl, objc_add_method, add_instance_variable, build_ivar_reference, is_ivar, is_private, get_super_receiver, build_selector_table_decl, objc_push_parm, objc_get_parm_info, gen_type_name, gen_type_name_0, start_var_decl, finish_var_decl, create_field_decl): New prototypes. (objc_expand_function_end, comp_method_with_proto, objc_expr_last, gen_declaration_1, gen_declarator, is_complex_decl, adorn_decl, define_decl, create_builtin_decl, gen_declspecs): Remove prototypes. (TYPE_ID): Rename to OBJECT_TYPEDEF_NAME. (CLASS_TYPEDEF_NAME): New. (TAG_EXECCLASS): Change from a global variable to a #define. (TAG_RETURN_STRUCT): Delete. (TAG_GNUINIT): New, holds '__objc_gnu_init' name. (objc_inherit_code, objc_public_flag): New, moved from c-parse.in. (string_descriptor): New struct. (string_htab): New hash table. (string_hash, string_eq): New prototypes. (generate_struct_by_value_array): Call create_field_decl() instead of create_builtin_decl(). (objc_init): Do not initialize objc_ellipsis_node or TAG_EXECCLASS; In ObjC++ mode, call cxx_init() instead of c_objc_common_init(). (objc_finish_file): In ObjC++, call instantiate_pending_templates() and cp_finish_file(). (define_decl, get_static_reference, get_protocol_reference, create_builtin_decl): Remove functions. (objc_start_class_interface, objc_start_category_interface, objc_start_protocol, objc_continue_interface, objc_finish_interface, objc_start_class_implementation, objc_start_category_implementation, objc_continue_implementation, objc_finish_implementation, objc_set_visibility, objc_set_method_type, objc_build_method_signature, objc_add_method_declaration, objc_start_method_definition, objc_add_instance_variable, objc_get_protocol_qualified_type, create_field_decl, start_var_decl, finish_var_decl): New functions. (setup_string_decl): Simplify since it is only called once. (synth_module_prologue): Call build_class_template(); predefine 'id' and 'Class' as typedefs; rename 'temp_type' to 'type'; disable debug hooks for duration of function; fix GNU runtime messenger signatures to correspond to reality; forward-declare '__objc_exec_class' for the GNU runtime; call build_selector_table_decl(); in ObjC++ mode, generate 'extern "C" { ... }' wrappers around synthesized declarations; call build_protocol_template() and build_category_template(). (string_hash, string_eq): New functions. (objc_build_string_object): Check metaclass correctness only once; store string literals in hash table. (objc_build_constructor): Do not convert initializer elements; adjust for ObjC++ impedance mismatch. (build_objc_symtab_template): Call create_field_decl() instead of create_builtin_decl(). (init_objc_symtab): Add missing conversion to initializer element. (build_metadata_decl): Call start_var_decl() instead of define_decl(). (generate_objc_symtab_decl): Do not call build_category_template(); call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(). (build_module_descriptor): Call create_field_decl() instead of grokfield(); call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(); always mark module descriptor as used; move GNU runtime-specific functionality to build_module_initializer_routine(). (build_module_initializer_routine): New function, broken off of build_module_descriptor(). (objc_static_init_needed_p, objc_generate_static_init_call): New functions. (generate_static_references, generate_strings, build_selector_translation_table, generate_descriptor_table, generate_ivars_list, generate_dispatch_table, generate_category): Call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(); build a type directly instead of via groktypename(). (build_selector_reference_decl, build_selector_table_decl, build_class_reference_decl, build_protocol_reference, generate_objc_image_info): Call start_var_decl() instead of build_decl(). (build_selector_reference): For GNU runtime, do not call build_selector_reference_decl(). (build_selector, build_typed_selector_reference): Always convert result to the selector type. (add_objc_string): Cast return value to 'char *'. (build_method_prototype_template, build_selector_template, build_method_template): Use actual selector type for fields pointing to selectors. (finish_objc): For GNU runtime, call build_module_initializer_routine() after build_module_descriptor(). (generate_protocol_list, generate_shared_structures): Call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(); build a type directly instead of via groktypename(). (synth_id_with_class_suffix): Return a string. (get_arg_type_list): For instance methods, use the instance type for 'self'; do not call groktypename_in_parm_context(). (build_objc_string_decl): Squash redeclaration errors in ObjC++. (objc_is_class_name): Use OBJC_TYPE_NAME instead of TYPE_NAME; handle RECORD_TYPEs in ObjC as well as ObjC++. (objc_is_id): New function. (objc_is_object_ptr): Return the canonical type node. (objc_get_class_ivars): Simplify using get_class_ivars(). (get_class_ivars): Remove second parameter; create a fresh copy of the ivar list for each call; do not check for existence of super class. (objc_eh_runtime_type): Mark #ifndef OBJCPLUS. (objc_init_exceptions): When using SJLJ-style exceptions, require the use of '-fobjc-exceptions' flag; do not require it for DWARF-style exceptions. (objc_build_exc_ptr, next_sjlj_build_try_catch_finally): Use objc_object_type instead of objc_id_type. (objc_begin_catch_clause): Convert the incoming PARM_DECL into a VAR_DECL before placing it in the appropriate scope; do not call define_decl(); adjust call to c_begin_compound_stmt(); use objc_object_type instead of objc_id_type. (build_next_objc_exception_stuff): Call create_field_decl() instead of create_builtin_decl(); construct type directly instead of calling groktypename(); use OBJC_VOID_AT_END to mark end of function parameters. (build_private_template): Adjust call to get_class_ivars(); build a type directly instead of via groktypename(). (build_protocol_template, build_method_prototype_list_template, build_method_prototype_template, build_category_template, build_selector_template, build_class_template, build_super_template, build_ivar_template, build_ivar_list_template, build_method_list_template, build_method_template): Call create_field_decl() instead of grokfield(). (objc_method_parm_type): Do not call groktypename(). (generate_descriptor_table): Call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(). (generate_method_descriptors, build_protocol_initializer, generate_dispatch_tables, build_category_initializer, build_shared_structure_initializer): Do not call groktypename(). (generate_protocols): Call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(); do not call groktypename(). (error_with_ivar): Remove last parameter. (check_ivars): Do not iterate ovar CLASS_RAW_IVARS lists in addition to CLASS_IVARS lists; adjust calls to error_with_ivar(). (generate_ivar_lists): Convert one of the initializer elements; do not call groktypename(). (get_arg_type_list, start_method_def, gen_method_def): Account for new representation of variable arguments and '...' in Objective-C methods; add Objective-C++ impedance matching code. (is_objc_type_qualifier): Remove function. (adjust_type_for_id_default): Simplify; there is no longer a need to wade through declspecs. (lookup_interface, start_class, continue_class, finish_class, start_method_def, start_protocol, build_method_decl, objc_add_method, add_instance_variable, build_ivar_reference, is_ivar, is_private, get_super_receiver, objc_build_finally_epilogue): Make into static functions. (receiver_is_class_object): Use new IS_CLASS() macro. (objc_build_message_expr): Tweak ObjC++ message argument handling; call objc_finish_message_expr() instead of finish_message_expr(). (finish_message_expr): Rename to objc_finish_message_expr(); use OBJC_TYPE_NAME and OBJC_SET_TYPE_NAME macros instead of TYPE_NAME. call gen_type_name() instead of gen_declaration(); call objc_is_id() instead of using IS_ID and IS_CLASS; Use objc_class_name instead of calling get_identifier("Class"); handle CONVERT_EXPRs in receiver. (build_objc_method_call, warn_with_method): Do not call groktypename(). (build_ivar_reference): Call convert() instead of clobbering in a type. (hash_init): Initialize string_htab hash table. (add_instance_variable): Simplify parameter list; do not call grokfield(); do not populate CLASS_IVARS list. (start_class): Check for the existence of super class, if one was specified. (continue_class): Use CLASS_RAW_IVARS rather than CLASS_IVARS; do not call build_class_template(); adjust call to get_class_ivars(); call build_decl(), pushdecl() and finish_decl() instead of define_decl(). (finish_class): Call build_decl(), pushdecl() and finish_decl() instead of define_decl(). (add_protocols): Use PROTOCOL_BINFO_ELTS for the tree vector size. (start_protocol): Do not call build_protocol_template(); use PROTOCOL_BINFO_ELTS for the tree vector size. (encode_type_qualifiers): Do not handle the 'const' qualifier here. (encode_pointer): Encode 'const char *' as 'r*', for backwards compatibility. (encode_array): Use HOST_WIDE_INT_PRINT_DEC instead of "%ld". (encode_type): Handle the 'const' qualifier here. (objc_parmlist): New global variable, sued by objc_push_parm and objc_get_parm_info(). (objc_push_parm, objc_get_parm_info): New functions. (objc_expr_last): Remove function. (synth_self_and_ucmd_args): For instance methods, use the instance type for 'self'; call objc_push_parm() instead of push_parm_decl(). (start_method_def): Do not call push_scope(), declare_parm_level(), pop_scope(), push_parm_decl(), store_parm_decls() or objc_expr_last(); just use objc_push_parm() and objc_get_parm_info(). (comp_method_with_proto): Remove function. (objc_types_are_equivalent): Strip away indirections before comparing underlying types. (comp_proto_with_proto): Do not call groktypename(); types are no longer in raw declspec format. (objc_start_function): New function. (really_start_method): Call comp_proto_with_proto() instead of comp_method_with_proto(); call objc_start_function() instead of hand-crafting a function declarator. (continue_method_def, objc_expand_function_end): Remove functions. (get_super_receiver): Call objc_get_current_scope() instead of get_current_scope(); reference 'super_class' field (instead of 'class'). (finish_method_def): Rename to objc_finish_method_definition() and add a function decl parameter; move method encoding call from objc_expand_function_end(). (is_complex_decl, adorn_decl, gen_declarator, gen_declspecs, gen_declaration_1): Remove functions. (tmpbuf, RAW_DECLSPEC): Remove. (gen_declaration): Remove second parameter; simplify to deal with TYPE_P nodes instead of raw declspecs. (gen_type_name, gen_type_name_0): New functions. (gen_method_decl): Remove second parameter; call gen_type_name() instead of gen_declaration_1(). (dump_interface): Adjust calls to gen_declaration() and gen_method_decl(); do not allocate a separate string buffer. (init_objc): Allocate a larger string buffer to accommodate dump_interface(); adjust call to build_module_descriptor(); add call to build_module_initializer_routine() for the GNU runtime. (generate_classref_translation_entry): Do not call start_decl(); call finish_var_decl() instead of finish_decl(); call convert() instead of build_c_cast(). * objc-act.h (CLASS_OWN_IVARS): Remove accessor. (CLASS_BINFO_ELTS): Reduce from 6 to 5, now that CLASS_OWN_IVARS is gone. (OCTI_GNU_INIT_DECL, GNU_INIT_decl): New. (OCTI_ELLIPSIS_NODE, objc_ellipsis_node): Remove. (OCTI_ID_ID, id_type, objc_id_id): Rename to OCTI_ID_NAME, objc_object_type and objc_object_name, respectively. (OCTI_CLS_REF, OCTI_CLASS_NAME, objc_class_reference, objc_class_name): New. (IS_CLASS): New macro. (IS_ID, IS_SUPER): Robustify. (OCTI_EXECCLASS_DECL, execclass_decl): New. (finish_file, start_class, continue_class, finish_class, start_method_def, continue_method_def, finish_method_def, start_protocol, finish_protocol, objc_build_throw_stmt, objc_build_try_catch_finally_stmt, objc_build_synchronized_prologue, objc_build_synchronized_epilogue, objc_build_try_prologue, objc_build_try_epilogue, objc_build_catch_stmt, objc_build_catch_epilogue, objc_build_finally_prologue, objc_build_finally_epilogue, is_ivar, is_private, is_public, add_instance_variable, objc_add_method, get_super_receiver, objc_clear_super_receiver, get_class_ivars_from_name, get_class_reference, get_static_reference, get_object_reference, build_message_expr, finish_message_expr, build_selector_expr, build_ivar_reference, build_keyword_decl, build_method_decl, build_protocol_expr, build_objc_string_object, objc_declare_alias, objc_declare_class, objc_declare_protocols, objc_comptypes, objc_check_decl, build_encode_expr): Remove prototypes. (imp_count, cat_count): Make GGC-aware. (OBJC_SET_TYPE_NAME): New macro. From-SVN: r87168
2004-09-08 02:49:44 +02:00
if (ridpointers[(int) RID_IN] == TREE_VALUE (spec))
obstack_1grow (&util_obstack, 'n');
else if (ridpointers[(int) RID_INOUT] == TREE_VALUE (spec))
obstack_1grow (&util_obstack, 'N');
else if (ridpointers[(int) RID_OUT] == TREE_VALUE (spec))
obstack_1grow (&util_obstack, 'o');
else if (ridpointers[(int) RID_BYCOPY] == TREE_VALUE (spec))
obstack_1grow (&util_obstack, 'O');
else if (ridpointers[(int) RID_BYREF] == TREE_VALUE (spec))
obstack_1grow (&util_obstack, 'R');
else if (ridpointers[(int) RID_ONEWAY] == TREE_VALUE (spec))
obstack_1grow (&util_obstack, 'V');
}
}
/* Encode a pointer type. */
1992-01-18 00:15:38 +01:00
static void
encode_pointer (tree type, int curtype, int format)
1992-01-18 00:15:38 +01:00
{
tree pointer_to = TREE_TYPE (type);
if (TREE_CODE (pointer_to) == RECORD_TYPE)
{
if (OBJC_TYPE_NAME (pointer_to)
&& TREE_CODE (OBJC_TYPE_NAME (pointer_to)) == IDENTIFIER_NODE)
1992-01-18 00:15:38 +01:00
{
const char *name = IDENTIFIER_POINTER (OBJC_TYPE_NAME (pointer_to));
1992-01-18 00:15:38 +01:00
if (strcmp (name, TAG_OBJECT) == 0) /* '@' */
1992-01-18 00:15:38 +01:00
{
obstack_1grow (&util_obstack, '@');
1992-01-18 00:15:38 +01:00
return;
}
objc-act.c (build_private_template): Change to return 'void'... [gcc/objc/ChangeLog] 2004-12-15 Ziemowit Laski <zlaski@apple.com> * objc-act.c (build_private_template): Change to return 'void'; do not set ivar_context, uprivate_record or objc_instance_type. (objc_comptypes, gen_type_name_0): For types 'id' and 'Class', retrieve protocol list from the pointee rather than the pointer itself; check TYPE_HAS_OBJC_INFO(...) precondition before accessing TYPE_OBJC_PROTOCOL_LIST. (objc_get_protocol_qualified_type): For types 'id' and 'Class', construct a variant of the pointee as well as the pointer, and store protocol information in the former. When creating variants of RECORD_TYPEs, clone their TYPE_LANG_SPECIFIC fields and propagate TYPE_OBJC_INTERFACE information. (objc_declare_class): If a TYPE_DECL is looked up, retrieve the underlying RECORD_TYPE to check for presence of TYPE_OBJC_INTERFACE; for newly-created RECORD_TYPEs, create a tentative TYPE_OBJC_INTERFACE holding an IDENTIFIER_NODE. (objc_finish_message_expr): Check TYPE_HAS_OBJC_INFO(...) before accessing TYPE_OBJC_PROTOCOL_LIST; Use TYPE_OBJC_INTERFACE instead of calling lookup_interface(); allow for TYPE_OBJC_INTERFACE holding an IDENTIFIER_NODE (meaning a @class forward-declaration only). (objc_is_public): Check TYPE_OBJC_INTERFACE instead of calling lookup_interface(). (continue_class): For @implementations, set ivar_context, uprivate_record and objc_instance_type, for @interfaces, call build_private_template(). (encode_pointer): Check TYPE_HAS_OBJC_INFO(...) before accessing TYPE_OBJC_INTERFACE. (objc_types_are_equivalent): Check TYPE_HAS_OBJC_INFO(...) before accessing TYPE_OBJC_PROTOCOL_LIST. * objc-act.h (OBJC_INFO_SLOT_ELTS, TYPE_OBJC_INFO, INIT_TYPE_OBJC_INFO, DUP_TYPE_OBJC_INFO, ALLOC_OBJC_TYPE_LANG_SPECIFIC, SIZEOF_OBJC_TYPE_LANG_SPECIFIC): New macros. (TYPE_OBJC_INTERFACE): Replaces TREE_STATIC_INSTANCE and now points to an actual @interface; stored in TYPE_LANG_SPECIFIC(...). (TYPE_OBJC_PROTOCOL_LIST): Replaces TYPE_PROTOCOL_LIST; stored in TYPE_LANG_SPECIFIC(...). (TREE_STATIC_INSTANCE, TYPE_PROTOCOL_LIST): Delete. (IS_ID, IS_CLASS, IS_PROTOCOL_QUALIFIED_UNTYPED, IS_SUPER, TYPED_OBJECT): Check for POINTER_TYPE rather than POINTER_TYPE_P; adjust for use of TYPE_OBJC_INTERFACE and TYPE_OBJC_PROTOCOL_LIST instead of TREE_STATIC_INSTANCE and TYPE_PROTOCOL_LIST. From-SVN: r92239
2004-12-16 02:10:38 +01:00
else if (TYPE_HAS_OBJC_INFO (pointer_to)
&& TYPE_OBJC_INTERFACE (pointer_to))
{
if (generating_instance_variables)
{
obstack_1grow (&util_obstack, '@');
obstack_1grow (&util_obstack, '"');
obstack_grow (&util_obstack, name, strlen (name));
obstack_1grow (&util_obstack, '"');
return;
}
else
{
obstack_1grow (&util_obstack, '@');
return;
}
}
1992-01-18 00:15:38 +01:00
else if (strcmp (name, TAG_CLASS) == 0) /* '#' */
{
obstack_1grow (&util_obstack, '#');
1992-01-18 00:15:38 +01:00
return;
}
else if (strcmp (name, TAG_SELECTOR) == 0) /* ':' */
{
obstack_1grow (&util_obstack, ':');
1992-01-18 00:15:38 +01:00
return;
}
}
}
else if (TREE_CODE (pointer_to) == INTEGER_TYPE
&& TYPE_MODE (pointer_to) == QImode)
{
tree pname = TREE_CODE (OBJC_TYPE_NAME (pointer_to)) == IDENTIFIER_NODE
? OBJC_TYPE_NAME (pointer_to)
: DECL_NAME (OBJC_TYPE_NAME (pointer_to));
if (!flag_next_runtime || strcmp (IDENTIFIER_POINTER (pname), "BOOL"))
{
Makefile.in (c-parse.o): Depend on $(C_COMMON_H). [gcc/ChangeLog] 2004-09-07 Ziemowit Laski <zlaski@apple.com> * Makefile.in (c-parse.o): Depend on $(C_COMMON_H). * c-parse.in: Include c-common.h instead of objc-act.h. (ivar_decl_list, ivar_decls, ivar_decl, ivars, ivar_declarator, myparms, myparm): Remove %type declarations. (methodtype, optparms, OBJC_TYPE_QUAL, objc_quals, objc_qual, objc_typename, objc_try_catch_stmt, optellipsis): Add %type declarations. (objc_inherit_code, objc_public_flag): Remove. (typespec_nonreserved_nonattr): Call objc_get_protocol_qualified_type() instead of get_static_reference() and get_protocol_reference(). (stmt_nocomp): Call grokparm() on @catch parameter. (objcdef): Move semantic action to objc_finish_implementation(). (classdef): Move semantic action to objc_start_class_interface(), objc_continue_interface(), objc_finish_interface(), objc_start_class_implementation(), objc_continue_implementation(), objc_start_category_interface() and objc_start_category_implementation(). (protocoldef): Move semantic actions to objc_start_protocol() and objc_finish_interface(). (ivar_decl_list): Remove nonterminal. (visibility_spec): Move semantic actions to objc_set_visibility(). (ivar_decls): Remove assignment to $$. (ivar_decl): Rephrase in terms of component_decl; call objc_add_instance_variable(). (ivars, ivar_declarator): Remove nonterminals. (opt_semi): New nonterminal. (methodtype): Remove semantic actions. (methoddef): Move semantic actions to objc_set_method_type(), objc_start_method_definition() and objc_finish_method_definition(). (methodproto): Move semantic actions to objc_set_method_type() and objc_add_method_declaration(). (methoddecl): Use objc_typename instead of typename; move semantic actions to objc_build_method_signature(). (optarglist, myxdecls, mydecl, myparms, myparm): Remove nonterminals. (optparmlist): Express in terms of optparms and optellipsis. (optparms, optellipsis, objc_qual, objc_quals, objc_typename): New nonterminals. (keyworddecl): Use objc_typename instead of typename. (rid_to_yy): Mark RID_IN, RID_OUT, RID_INOUT, RID_BYCOPY, RID_BYREF and RID_ONEWAY as returning OBJC_TYPE_QUAL to yyparse(). [gcc/objc/ChangeLog] 2004-09-07 Ziemowit Laski <zlaski@apple.com> * Make-lang.in (objc/objc-parse.o): Depend on $(C_COMMON_H) instead of objc/objc-act.h. (objc/objc-act.o): Depend on $(HASHTAB_H). * objc-act.c: Include hashtab.h; in ObjC++ mode, include cp-tree.h and objcp-decl.h instead of c-tree.h. (build_module_descriptor, get_class_ivars, synth_id_with_class_suffix, error_with_ivar, gen_method_decl, gen_declaration, setup_string_decl, build_protocol_template): Adjust prototypes. (build_module_initializer_routine, start_class, continue_class, finish_class, start_method_def, objc_start_function, start_protocol, build_method_decl, objc_add_method, add_instance_variable, build_ivar_reference, is_ivar, is_private, get_super_receiver, build_selector_table_decl, objc_push_parm, objc_get_parm_info, gen_type_name, gen_type_name_0, start_var_decl, finish_var_decl, create_field_decl): New prototypes. (objc_expand_function_end, comp_method_with_proto, objc_expr_last, gen_declaration_1, gen_declarator, is_complex_decl, adorn_decl, define_decl, create_builtin_decl, gen_declspecs): Remove prototypes. (TYPE_ID): Rename to OBJECT_TYPEDEF_NAME. (CLASS_TYPEDEF_NAME): New. (TAG_EXECCLASS): Change from a global variable to a #define. (TAG_RETURN_STRUCT): Delete. (TAG_GNUINIT): New, holds '__objc_gnu_init' name. (objc_inherit_code, objc_public_flag): New, moved from c-parse.in. (string_descriptor): New struct. (string_htab): New hash table. (string_hash, string_eq): New prototypes. (generate_struct_by_value_array): Call create_field_decl() instead of create_builtin_decl(). (objc_init): Do not initialize objc_ellipsis_node or TAG_EXECCLASS; In ObjC++ mode, call cxx_init() instead of c_objc_common_init(). (objc_finish_file): In ObjC++, call instantiate_pending_templates() and cp_finish_file(). (define_decl, get_static_reference, get_protocol_reference, create_builtin_decl): Remove functions. (objc_start_class_interface, objc_start_category_interface, objc_start_protocol, objc_continue_interface, objc_finish_interface, objc_start_class_implementation, objc_start_category_implementation, objc_continue_implementation, objc_finish_implementation, objc_set_visibility, objc_set_method_type, objc_build_method_signature, objc_add_method_declaration, objc_start_method_definition, objc_add_instance_variable, objc_get_protocol_qualified_type, create_field_decl, start_var_decl, finish_var_decl): New functions. (setup_string_decl): Simplify since it is only called once. (synth_module_prologue): Call build_class_template(); predefine 'id' and 'Class' as typedefs; rename 'temp_type' to 'type'; disable debug hooks for duration of function; fix GNU runtime messenger signatures to correspond to reality; forward-declare '__objc_exec_class' for the GNU runtime; call build_selector_table_decl(); in ObjC++ mode, generate 'extern "C" { ... }' wrappers around synthesized declarations; call build_protocol_template() and build_category_template(). (string_hash, string_eq): New functions. (objc_build_string_object): Check metaclass correctness only once; store string literals in hash table. (objc_build_constructor): Do not convert initializer elements; adjust for ObjC++ impedance mismatch. (build_objc_symtab_template): Call create_field_decl() instead of create_builtin_decl(). (init_objc_symtab): Add missing conversion to initializer element. (build_metadata_decl): Call start_var_decl() instead of define_decl(). (generate_objc_symtab_decl): Do not call build_category_template(); call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(). (build_module_descriptor): Call create_field_decl() instead of grokfield(); call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(); always mark module descriptor as used; move GNU runtime-specific functionality to build_module_initializer_routine(). (build_module_initializer_routine): New function, broken off of build_module_descriptor(). (objc_static_init_needed_p, objc_generate_static_init_call): New functions. (generate_static_references, generate_strings, build_selector_translation_table, generate_descriptor_table, generate_ivars_list, generate_dispatch_table, generate_category): Call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(); build a type directly instead of via groktypename(). (build_selector_reference_decl, build_selector_table_decl, build_class_reference_decl, build_protocol_reference, generate_objc_image_info): Call start_var_decl() instead of build_decl(). (build_selector_reference): For GNU runtime, do not call build_selector_reference_decl(). (build_selector, build_typed_selector_reference): Always convert result to the selector type. (add_objc_string): Cast return value to 'char *'. (build_method_prototype_template, build_selector_template, build_method_template): Use actual selector type for fields pointing to selectors. (finish_objc): For GNU runtime, call build_module_initializer_routine() after build_module_descriptor(). (generate_protocol_list, generate_shared_structures): Call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(); build a type directly instead of via groktypename(). (synth_id_with_class_suffix): Return a string. (get_arg_type_list): For instance methods, use the instance type for 'self'; do not call groktypename_in_parm_context(). (build_objc_string_decl): Squash redeclaration errors in ObjC++. (objc_is_class_name): Use OBJC_TYPE_NAME instead of TYPE_NAME; handle RECORD_TYPEs in ObjC as well as ObjC++. (objc_is_id): New function. (objc_is_object_ptr): Return the canonical type node. (objc_get_class_ivars): Simplify using get_class_ivars(). (get_class_ivars): Remove second parameter; create a fresh copy of the ivar list for each call; do not check for existence of super class. (objc_eh_runtime_type): Mark #ifndef OBJCPLUS. (objc_init_exceptions): When using SJLJ-style exceptions, require the use of '-fobjc-exceptions' flag; do not require it for DWARF-style exceptions. (objc_build_exc_ptr, next_sjlj_build_try_catch_finally): Use objc_object_type instead of objc_id_type. (objc_begin_catch_clause): Convert the incoming PARM_DECL into a VAR_DECL before placing it in the appropriate scope; do not call define_decl(); adjust call to c_begin_compound_stmt(); use objc_object_type instead of objc_id_type. (build_next_objc_exception_stuff): Call create_field_decl() instead of create_builtin_decl(); construct type directly instead of calling groktypename(); use OBJC_VOID_AT_END to mark end of function parameters. (build_private_template): Adjust call to get_class_ivars(); build a type directly instead of via groktypename(). (build_protocol_template, build_method_prototype_list_template, build_method_prototype_template, build_category_template, build_selector_template, build_class_template, build_super_template, build_ivar_template, build_ivar_list_template, build_method_list_template, build_method_template): Call create_field_decl() instead of grokfield(). (objc_method_parm_type): Do not call groktypename(). (generate_descriptor_table): Call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(). (generate_method_descriptors, build_protocol_initializer, generate_dispatch_tables, build_category_initializer, build_shared_structure_initializer): Do not call groktypename(). (generate_protocols): Call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(); do not call groktypename(). (error_with_ivar): Remove last parameter. (check_ivars): Do not iterate ovar CLASS_RAW_IVARS lists in addition to CLASS_IVARS lists; adjust calls to error_with_ivar(). (generate_ivar_lists): Convert one of the initializer elements; do not call groktypename(). (get_arg_type_list, start_method_def, gen_method_def): Account for new representation of variable arguments and '...' in Objective-C methods; add Objective-C++ impedance matching code. (is_objc_type_qualifier): Remove function. (adjust_type_for_id_default): Simplify; there is no longer a need to wade through declspecs. (lookup_interface, start_class, continue_class, finish_class, start_method_def, start_protocol, build_method_decl, objc_add_method, add_instance_variable, build_ivar_reference, is_ivar, is_private, get_super_receiver, objc_build_finally_epilogue): Make into static functions. (receiver_is_class_object): Use new IS_CLASS() macro. (objc_build_message_expr): Tweak ObjC++ message argument handling; call objc_finish_message_expr() instead of finish_message_expr(). (finish_message_expr): Rename to objc_finish_message_expr(); use OBJC_TYPE_NAME and OBJC_SET_TYPE_NAME macros instead of TYPE_NAME. call gen_type_name() instead of gen_declaration(); call objc_is_id() instead of using IS_ID and IS_CLASS; Use objc_class_name instead of calling get_identifier("Class"); handle CONVERT_EXPRs in receiver. (build_objc_method_call, warn_with_method): Do not call groktypename(). (build_ivar_reference): Call convert() instead of clobbering in a type. (hash_init): Initialize string_htab hash table. (add_instance_variable): Simplify parameter list; do not call grokfield(); do not populate CLASS_IVARS list. (start_class): Check for the existence of super class, if one was specified. (continue_class): Use CLASS_RAW_IVARS rather than CLASS_IVARS; do not call build_class_template(); adjust call to get_class_ivars(); call build_decl(), pushdecl() and finish_decl() instead of define_decl(). (finish_class): Call build_decl(), pushdecl() and finish_decl() instead of define_decl(). (add_protocols): Use PROTOCOL_BINFO_ELTS for the tree vector size. (start_protocol): Do not call build_protocol_template(); use PROTOCOL_BINFO_ELTS for the tree vector size. (encode_type_qualifiers): Do not handle the 'const' qualifier here. (encode_pointer): Encode 'const char *' as 'r*', for backwards compatibility. (encode_array): Use HOST_WIDE_INT_PRINT_DEC instead of "%ld". (encode_type): Handle the 'const' qualifier here. (objc_parmlist): New global variable, sued by objc_push_parm and objc_get_parm_info(). (objc_push_parm, objc_get_parm_info): New functions. (objc_expr_last): Remove function. (synth_self_and_ucmd_args): For instance methods, use the instance type for 'self'; call objc_push_parm() instead of push_parm_decl(). (start_method_def): Do not call push_scope(), declare_parm_level(), pop_scope(), push_parm_decl(), store_parm_decls() or objc_expr_last(); just use objc_push_parm() and objc_get_parm_info(). (comp_method_with_proto): Remove function. (objc_types_are_equivalent): Strip away indirections before comparing underlying types. (comp_proto_with_proto): Do not call groktypename(); types are no longer in raw declspec format. (objc_start_function): New function. (really_start_method): Call comp_proto_with_proto() instead of comp_method_with_proto(); call objc_start_function() instead of hand-crafting a function declarator. (continue_method_def, objc_expand_function_end): Remove functions. (get_super_receiver): Call objc_get_current_scope() instead of get_current_scope(); reference 'super_class' field (instead of 'class'). (finish_method_def): Rename to objc_finish_method_definition() and add a function decl parameter; move method encoding call from objc_expand_function_end(). (is_complex_decl, adorn_decl, gen_declarator, gen_declspecs, gen_declaration_1): Remove functions. (tmpbuf, RAW_DECLSPEC): Remove. (gen_declaration): Remove second parameter; simplify to deal with TYPE_P nodes instead of raw declspecs. (gen_type_name, gen_type_name_0): New functions. (gen_method_decl): Remove second parameter; call gen_type_name() instead of gen_declaration_1(). (dump_interface): Adjust calls to gen_declaration() and gen_method_decl(); do not allocate a separate string buffer. (init_objc): Allocate a larger string buffer to accommodate dump_interface(); adjust call to build_module_descriptor(); add call to build_module_initializer_routine() for the GNU runtime. (generate_classref_translation_entry): Do not call start_decl(); call finish_var_decl() instead of finish_decl(); call convert() instead of build_c_cast(). * objc-act.h (CLASS_OWN_IVARS): Remove accessor. (CLASS_BINFO_ELTS): Reduce from 6 to 5, now that CLASS_OWN_IVARS is gone. (OCTI_GNU_INIT_DECL, GNU_INIT_decl): New. (OCTI_ELLIPSIS_NODE, objc_ellipsis_node): Remove. (OCTI_ID_ID, id_type, objc_id_id): Rename to OCTI_ID_NAME, objc_object_type and objc_object_name, respectively. (OCTI_CLS_REF, OCTI_CLASS_NAME, objc_class_reference, objc_class_name): New. (IS_CLASS): New macro. (IS_ID, IS_SUPER): Robustify. (OCTI_EXECCLASS_DECL, execclass_decl): New. (finish_file, start_class, continue_class, finish_class, start_method_def, continue_method_def, finish_method_def, start_protocol, finish_protocol, objc_build_throw_stmt, objc_build_try_catch_finally_stmt, objc_build_synchronized_prologue, objc_build_synchronized_epilogue, objc_build_try_prologue, objc_build_try_epilogue, objc_build_catch_stmt, objc_build_catch_epilogue, objc_build_finally_prologue, objc_build_finally_epilogue, is_ivar, is_private, is_public, add_instance_variable, objc_add_method, get_super_receiver, objc_clear_super_receiver, get_class_ivars_from_name, get_class_reference, get_static_reference, get_object_reference, build_message_expr, finish_message_expr, build_selector_expr, build_ivar_reference, build_keyword_decl, build_method_decl, build_protocol_expr, build_objc_string_object, objc_declare_alias, objc_declare_class, objc_declare_protocols, objc_comptypes, objc_check_decl, build_encode_expr): Remove prototypes. (imp_count, cat_count): Make GGC-aware. (OBJC_SET_TYPE_NAME): New macro. From-SVN: r87168
2004-09-08 02:49:44 +02:00
/* It appears that "r*" means "const char *" rather than
"char *const". */
if (TYPE_READONLY (pointer_to))
obstack_1grow (&util_obstack, 'r');
obstack_1grow (&util_obstack, '*');
return;
}
1992-01-18 00:15:38 +01:00
}
/* We have a type that does not get special treatment. */
1992-01-18 00:15:38 +01:00
/* NeXT extension */
obstack_1grow (&util_obstack, '^');
encode_type (pointer_to, curtype, format);
1992-01-18 00:15:38 +01:00
}
static void
encode_array (tree type, int curtype, int format)
1992-01-18 00:15:38 +01:00
{
tree an_int_cst = TYPE_SIZE (type);
1992-01-18 00:15:38 +01:00
tree array_of = TREE_TYPE (type);
char buffer[40];
1992-01-18 00:15:38 +01:00
/* An incomplete array is treated like a pointer. */
if (an_int_cst == NULL)
1992-01-18 00:15:38 +01:00
{
encode_pointer (type, curtype, format);
1992-01-18 00:15:38 +01:00
return;
}
if (TREE_INT_CST_LOW (TYPE_SIZE (array_of)) == 0)
sprintf (buffer, "[" HOST_WIDE_INT_PRINT_DEC, (HOST_WIDE_INT)0);
else
sprintf (buffer, "[" HOST_WIDE_INT_PRINT_DEC,
TREE_INT_CST_LOW (an_int_cst)
/ TREE_INT_CST_LOW (TYPE_SIZE (array_of)));
obstack_grow (&util_obstack, buffer, strlen (buffer));
encode_type (array_of, curtype, format);
obstack_1grow (&util_obstack, ']');
1992-01-18 00:15:38 +01:00
return;
}
objc-act.c (objc_build_struct): New function. * objc-act.c (objc_build_struct): New function. (objc_derived_from_p): Likewise. (objc_build_component_ref): Likewise. (objc_copy_binfo): Likewise. (objc_xref_basetypes): Likewise. (objc_lookup_protocol): Likewise. (objc_compare_protocols): Likewise. (objc_volatilize_decl): Likewise. (encode_aggregate_fields): Likewise. (volatilized_hash): Likewise. (volatilized_eq): Likewise. (objc_compare_types): Likewise. (objc_type_quals_match): Likewise. (DERIVED_FROM_P): New ObjC macro, corresponding to C++ macro of same name. (get_class_ivars): Add second parameter indicating if entire hierarchy is desired. (struct volatilized_type): New type. (volatilized_htab): New hash table. (objc_types_compatible_p, objc_comptypes): Remove functions. (synth_module_prologue): Do not initialize 'unused_list'. (objc_get_class_reference): Fix ObjC++ impedance mismatches. (objc_declare_alias): Implement as a typedef. (objc_substitute_decl, objc_gimplify_expr): Reformat. (objc_get_class_ivars): Adjust call to get_class_ivars(). (next_sjlj_build_enter_and_setjmp, synth_forward_declarations, build_ivar_reference, get_super_receiver): Call objc_build_component_ref() instead of build_component_ref(). (objc_begin_catch_clause): Use DERIVED_FROM_P() instead of objc_comptypes(). (build_private_template): Call objc_build_struct() instead of start_struct() and finish_struct(). (hash_init): Initialize volatilized_htab. (objc_is_public): Adjust calls to objc_get_ivars(); adjust ObjC++ impedance mismatches. (encode_aggregate_within): Streamline by calling encode_aggregate_fields(). * objc-act.h (objc_types_compatible_p): Remove prototype. (OCTI_UNUSED_LIST, unused_list): Remove slot. * objc-lang.c (LANG_HOOKS_TYPES_COMPATIBLE_P): Remove. From-SVN: r100123
2005-05-25 00:21:01 +02:00
static void
encode_aggregate_fields (tree type, int pointed_to, int curtype, int format)
{
tree field = TYPE_FIELDS (type);
for (; field; field = TREE_CHAIN (field))
{
#ifdef OBJCPLUS
/* C++ static members, and things that are not field at all,
should not appear in the encoding. */
if (TREE_CODE (field) != FIELD_DECL || TREE_STATIC (field))
continue;
#endif
/* Recursively encode fields of embedded base classes. */
if (DECL_ARTIFICIAL (field) && !DECL_NAME (field)
objc-act.c (objc_build_struct): New function. * objc-act.c (objc_build_struct): New function. (objc_derived_from_p): Likewise. (objc_build_component_ref): Likewise. (objc_copy_binfo): Likewise. (objc_xref_basetypes): Likewise. (objc_lookup_protocol): Likewise. (objc_compare_protocols): Likewise. (objc_volatilize_decl): Likewise. (encode_aggregate_fields): Likewise. (volatilized_hash): Likewise. (volatilized_eq): Likewise. (objc_compare_types): Likewise. (objc_type_quals_match): Likewise. (DERIVED_FROM_P): New ObjC macro, corresponding to C++ macro of same name. (get_class_ivars): Add second parameter indicating if entire hierarchy is desired. (struct volatilized_type): New type. (volatilized_htab): New hash table. (objc_types_compatible_p, objc_comptypes): Remove functions. (synth_module_prologue): Do not initialize 'unused_list'. (objc_get_class_reference): Fix ObjC++ impedance mismatches. (objc_declare_alias): Implement as a typedef. (objc_substitute_decl, objc_gimplify_expr): Reformat. (objc_get_class_ivars): Adjust call to get_class_ivars(). (next_sjlj_build_enter_and_setjmp, synth_forward_declarations, build_ivar_reference, get_super_receiver): Call objc_build_component_ref() instead of build_component_ref(). (objc_begin_catch_clause): Use DERIVED_FROM_P() instead of objc_comptypes(). (build_private_template): Call objc_build_struct() instead of start_struct() and finish_struct(). (hash_init): Initialize volatilized_htab. (objc_is_public): Adjust calls to objc_get_ivars(); adjust ObjC++ impedance mismatches. (encode_aggregate_within): Streamline by calling encode_aggregate_fields(). * objc-act.h (objc_types_compatible_p): Remove prototype. (OCTI_UNUSED_LIST, unused_list): Remove slot. * objc-lang.c (LANG_HOOKS_TYPES_COMPATIBLE_P): Remove. From-SVN: r100123
2005-05-25 00:21:01 +02:00
&& TREE_CODE (TREE_TYPE (field)) == RECORD_TYPE)
{
encode_aggregate_fields (TREE_TYPE (field),
pointed_to, curtype, format);
continue;
}
if (generating_instance_variables && !pointed_to)
{
tree fname = DECL_NAME (field);
obstack_1grow (&util_obstack, '"');
if (fname && TREE_CODE (fname) == IDENTIFIER_NODE)
obstack_grow (&util_obstack,
IDENTIFIER_POINTER (fname),
strlen (IDENTIFIER_POINTER (fname)));
obstack_1grow (&util_obstack, '"');
}
encode_field_decl (field, curtype, format);
}
}
1992-01-18 00:15:38 +01:00
static void
encode_aggregate_within (tree type, int curtype, int format, int left,
int right)
1992-01-18 00:15:38 +01:00
{
tree name;
/* NB: aggregates that are pointed to have slightly different encoding
rules in that you never encode the names of instance variables. */
Yet more Objective-C++... * objc-act.c (objc_finish_try_stmt): Add return value. (objc_build_synchronized): Likewise. * objc-act.c (objc_is_gcable_type): Add. (objc_substitute_decl): Add. (objc_build_ivar_assignment): Add. (objc_build_global_assignment): Add. (objc_build_strong_cast_assignment): Add. (objc_is_ivar_reference_p): Add. (objc_is_global_reference_p): Add. (objc_generate_write_barrier): Add. (objc_rewrite_function_call): Add. (objc_gimplify_expr): Add Objective-C++ support. * objc-act.h (ALLOC_OBJC_TYPE_LANG_SPECIFIC): Likewise. (SIZEOF_OBJC_TYPE_LANG_SPECIFIC): Add. (INIT_TYPE_OBJC_INFO): Add Objective-C++ support. (DUP_TYPE_OBJC_INFO): Likewise. (struct imp_entry): Add field has_cxx_cdtors. (struct imp_entry *imp_list): Add OCTI_UMSG_FAST_DECL, OCTI_METH_LIST_TEMPL, OCTI_METH_PROTO_LIST_TEMPL, OCTI_IVAR_LIST_TEMPL, OCTI_ASSIGN_IVAR_DECL, OCTI_ASSIGN_IVAR_FAST_DECL, OCTI_ASSIGN_GLOBAL_DECL, OCTI_ASSIGN_STRONGCAST_DECL. (umsg_fast_decl): Add. (objc_assign_ivar_decl): Add. (objc_assign_ivar_fast_decl): Add. (objc_assign_global_decl): Add. (objc_assign_strong_cast_decl): Add. (objc_method_list_ptr): Add. (objc_method_proto_list_ptr): Add. (objc_ivar_list_ptr): Add. * objc-act.c (should_call_super_dealloc): Add. (OBJC_VERSION): Bump to 6. (objc_is_gcable_type): Add. (objc_substitute_decl): Add. (objc_build_ivar_assignment): Add. (objc_build_global_assignment): Add. (objc_build_strong_cast_assignment): Add. (objc_is_gcable_p): Add. (objc_is_ivar_reference_p): Add. (objc_is_global_reference_p): Add. (generate_shared_structures): Add flags parameter. (objc_generate_cxx_ctor_or_dtor): Add. (objc_generate_cxx_cdtors): Add. (add_class): Add name parameter. (objc_types_share_size_and_alignment): Add. (comp_proto_with_proto): Add strict parameter. (CLS_HAS_CXX_STRUCTORS): Add. (TAG_ASSIGNIVAR): Add. (TAG_ASSIGNGLOBAL): Add. (TAG_ASSIGNSTRONGCAST): Add. (TAG_MSGSEND_FAST): Add. (TAG_ASSIGNIVAR_FAST): Add. (TAG_CXX_CONSTRUCT): Add. (TAG_CXX_DESTRUCT): Add. (OBJC_LOOKUP_CLASS): Add. (OBJC_LOOKUP_NO_SUPER): Add. (objc_finish_file): Add pch support. (objc_finish_implementation): Add Objective-C++ support. (synth_module_prologue): Likewise. (synth_module_prologue): Add fast dispatching. (objc_get_class_reference): Add Objective-C++ support. (objc_generate_write_barrier): Likewise. (next_sjlj_build_enter_and_setjmp): Likewise. (objc_begin_try_stmt): Likewise. (build_next_objc_exception_stuff): Add fast ivar support. (build_private_template): Mark the record as used so debug information is generated. (build_protocol_template): Add Objective-C++ support. (objc_method_parm_type) Likewise. (objc_generate_cxx_ctor_or_dtor): Likewise. (objc_generate_cxx_cdtors): Likewise. (build_protocol_initializer): Likewise. (build_category_template): Likewise. (build_class_template): Likewise. (build_method_list_template): Likewise. (build_category_initializer): Likewise. (build_shared_structure_initializer): Likewise. (objc_finish_message_expr): Likewise. (build_objc_method_call): Add fast dispatch support. (lookup_method_static): Add support to end search at superclasses. (add_method_to_hash_list): Add strict parameter to comp_proto_with_proto. (objc_add_method): Likewise. (objc_add_method): Also set the interface_value. (add_instance_variable): Add Objective-C++ support. (objc_is_public): Likewise. (start_class): Likewise. (continue_class): Likewise. (encode_aggregate_within): Likewise. (start_method_def): Likewise. (objc_start_function): Clear current_function_returns_value and current_function_returns_null. (really_start_method): Add Objective-C++ support. (objc_finish_method_definition): Add warning for missing [super dealloc]. (finish_objc): Add Objective-C++ support. (generate_objc_image_info): Likewise. (objc_lookup_ivar): Likewise. * objc-act.h (TYPE_HAS_OBJC_INFO): Likewise. (INIT_TYPE_OBJC_INFO): Likewise. (DUP_TYPE_OBJC_INFO): Likewise. From-SVN: r99857
2005-05-17 22:07:08 +02:00
int ob_size = obstack_object_size (&util_obstack);
char c1 = ob_size > 1 ? *(obstack_next_free (&util_obstack) - 2) : 0;
char c0 = ob_size > 0 ? *(obstack_next_free (&util_obstack) - 1) : 0;
int pointed_to = (c0 == '^' || (c1 == '^' && c0 == 'r'));
int inline_contents
= ((format == OBJC_ENCODE_INLINE_DEFS || generating_instance_variables)
Yet more Objective-C++... * objc-act.c (objc_finish_try_stmt): Add return value. (objc_build_synchronized): Likewise. * objc-act.c (objc_is_gcable_type): Add. (objc_substitute_decl): Add. (objc_build_ivar_assignment): Add. (objc_build_global_assignment): Add. (objc_build_strong_cast_assignment): Add. (objc_is_ivar_reference_p): Add. (objc_is_global_reference_p): Add. (objc_generate_write_barrier): Add. (objc_rewrite_function_call): Add. (objc_gimplify_expr): Add Objective-C++ support. * objc-act.h (ALLOC_OBJC_TYPE_LANG_SPECIFIC): Likewise. (SIZEOF_OBJC_TYPE_LANG_SPECIFIC): Add. (INIT_TYPE_OBJC_INFO): Add Objective-C++ support. (DUP_TYPE_OBJC_INFO): Likewise. (struct imp_entry): Add field has_cxx_cdtors. (struct imp_entry *imp_list): Add OCTI_UMSG_FAST_DECL, OCTI_METH_LIST_TEMPL, OCTI_METH_PROTO_LIST_TEMPL, OCTI_IVAR_LIST_TEMPL, OCTI_ASSIGN_IVAR_DECL, OCTI_ASSIGN_IVAR_FAST_DECL, OCTI_ASSIGN_GLOBAL_DECL, OCTI_ASSIGN_STRONGCAST_DECL. (umsg_fast_decl): Add. (objc_assign_ivar_decl): Add. (objc_assign_ivar_fast_decl): Add. (objc_assign_global_decl): Add. (objc_assign_strong_cast_decl): Add. (objc_method_list_ptr): Add. (objc_method_proto_list_ptr): Add. (objc_ivar_list_ptr): Add. * objc-act.c (should_call_super_dealloc): Add. (OBJC_VERSION): Bump to 6. (objc_is_gcable_type): Add. (objc_substitute_decl): Add. (objc_build_ivar_assignment): Add. (objc_build_global_assignment): Add. (objc_build_strong_cast_assignment): Add. (objc_is_gcable_p): Add. (objc_is_ivar_reference_p): Add. (objc_is_global_reference_p): Add. (generate_shared_structures): Add flags parameter. (objc_generate_cxx_ctor_or_dtor): Add. (objc_generate_cxx_cdtors): Add. (add_class): Add name parameter. (objc_types_share_size_and_alignment): Add. (comp_proto_with_proto): Add strict parameter. (CLS_HAS_CXX_STRUCTORS): Add. (TAG_ASSIGNIVAR): Add. (TAG_ASSIGNGLOBAL): Add. (TAG_ASSIGNSTRONGCAST): Add. (TAG_MSGSEND_FAST): Add. (TAG_ASSIGNIVAR_FAST): Add. (TAG_CXX_CONSTRUCT): Add. (TAG_CXX_DESTRUCT): Add. (OBJC_LOOKUP_CLASS): Add. (OBJC_LOOKUP_NO_SUPER): Add. (objc_finish_file): Add pch support. (objc_finish_implementation): Add Objective-C++ support. (synth_module_prologue): Likewise. (synth_module_prologue): Add fast dispatching. (objc_get_class_reference): Add Objective-C++ support. (objc_generate_write_barrier): Likewise. (next_sjlj_build_enter_and_setjmp): Likewise. (objc_begin_try_stmt): Likewise. (build_next_objc_exception_stuff): Add fast ivar support. (build_private_template): Mark the record as used so debug information is generated. (build_protocol_template): Add Objective-C++ support. (objc_method_parm_type) Likewise. (objc_generate_cxx_ctor_or_dtor): Likewise. (objc_generate_cxx_cdtors): Likewise. (build_protocol_initializer): Likewise. (build_category_template): Likewise. (build_class_template): Likewise. (build_method_list_template): Likewise. (build_category_initializer): Likewise. (build_shared_structure_initializer): Likewise. (objc_finish_message_expr): Likewise. (build_objc_method_call): Add fast dispatch support. (lookup_method_static): Add support to end search at superclasses. (add_method_to_hash_list): Add strict parameter to comp_proto_with_proto. (objc_add_method): Likewise. (objc_add_method): Also set the interface_value. (add_instance_variable): Add Objective-C++ support. (objc_is_public): Likewise. (start_class): Likewise. (continue_class): Likewise. (encode_aggregate_within): Likewise. (start_method_def): Likewise. (objc_start_function): Clear current_function_returns_value and current_function_returns_null. (really_start_method): Add Objective-C++ support. (objc_finish_method_definition): Add warning for missing [super dealloc]. (finish_objc): Add Objective-C++ support. (generate_objc_image_info): Likewise. (objc_lookup_ivar): Likewise. * objc-act.h (TYPE_HAS_OBJC_INFO): Likewise. (INIT_TYPE_OBJC_INFO): Likewise. (DUP_TYPE_OBJC_INFO): Likewise. From-SVN: r99857
2005-05-17 22:07:08 +02:00
&& (!pointed_to || ob_size - curtype == (c1 == 'r' ? 2 : 1)));
/* Traverse struct aliases; it is important to get the
original struct and its tag name (if any). */
type = TYPE_MAIN_VARIANT (type);
name = OBJC_TYPE_NAME (type);
/* Open parenth/bracket. */
obstack_1grow (&util_obstack, left);
/* Encode the struct/union tag name, or '?' if a tag was
not provided. Typedef aliases do not qualify. */
if (name && TREE_CODE (name) == IDENTIFIER_NODE
#ifdef OBJCPLUS
/* Did this struct have a tag? */
&& !TYPE_WAS_ANONYMOUS (type)
#endif
)
obstack_grow (&util_obstack,
IDENTIFIER_POINTER (name),
strlen (IDENTIFIER_POINTER (name)));
else
obstack_1grow (&util_obstack, '?');
/* Encode the types (and possibly names) of the inner fields,
if required. */
if (inline_contents)
1992-01-18 00:15:38 +01:00
{
obstack_1grow (&util_obstack, '=');
objc-act.c (objc_build_struct): New function. * objc-act.c (objc_build_struct): New function. (objc_derived_from_p): Likewise. (objc_build_component_ref): Likewise. (objc_copy_binfo): Likewise. (objc_xref_basetypes): Likewise. (objc_lookup_protocol): Likewise. (objc_compare_protocols): Likewise. (objc_volatilize_decl): Likewise. (encode_aggregate_fields): Likewise. (volatilized_hash): Likewise. (volatilized_eq): Likewise. (objc_compare_types): Likewise. (objc_type_quals_match): Likewise. (DERIVED_FROM_P): New ObjC macro, corresponding to C++ macro of same name. (get_class_ivars): Add second parameter indicating if entire hierarchy is desired. (struct volatilized_type): New type. (volatilized_htab): New hash table. (objc_types_compatible_p, objc_comptypes): Remove functions. (synth_module_prologue): Do not initialize 'unused_list'. (objc_get_class_reference): Fix ObjC++ impedance mismatches. (objc_declare_alias): Implement as a typedef. (objc_substitute_decl, objc_gimplify_expr): Reformat. (objc_get_class_ivars): Adjust call to get_class_ivars(). (next_sjlj_build_enter_and_setjmp, synth_forward_declarations, build_ivar_reference, get_super_receiver): Call objc_build_component_ref() instead of build_component_ref(). (objc_begin_catch_clause): Use DERIVED_FROM_P() instead of objc_comptypes(). (build_private_template): Call objc_build_struct() instead of start_struct() and finish_struct(). (hash_init): Initialize volatilized_htab. (objc_is_public): Adjust calls to objc_get_ivars(); adjust ObjC++ impedance mismatches. (encode_aggregate_within): Streamline by calling encode_aggregate_fields(). * objc-act.h (objc_types_compatible_p): Remove prototype. (OCTI_UNUSED_LIST, unused_list): Remove slot. * objc-lang.c (LANG_HOOKS_TYPES_COMPATIBLE_P): Remove. From-SVN: r100123
2005-05-25 00:21:01 +02:00
encode_aggregate_fields (type, pointed_to, curtype, format);
}
/* Close parenth/bracket. */
obstack_1grow (&util_obstack, right);
}
static void
encode_aggregate (tree type, int curtype, int format)
{
enum tree_code code = TREE_CODE (type);
switch (code)
{
case RECORD_TYPE:
{
encode_aggregate_within (type, curtype, format, '{', '}');
1992-01-18 00:15:38 +01:00
break;
}
case UNION_TYPE:
{
encode_aggregate_within (type, curtype, format, '(', ')');
1992-01-18 00:15:38 +01:00
break;
}
1992-01-18 00:15:38 +01:00
case ENUMERAL_TYPE:
obstack_1grow (&util_obstack, 'i');
1992-01-18 00:15:38 +01:00
break;
default:
break;
1992-01-18 00:15:38 +01:00
}
}
/* Encode a bitfield NeXT-style (i.e., without a bit offset or the underlying
field type. */
1992-01-18 00:15:38 +01:00
static void
encode_next_bitfield (int width)
1992-01-18 00:15:38 +01:00
{
char buffer[40];
sprintf (buffer, "b%d", width);
obstack_grow (&util_obstack, buffer, strlen (buffer));
1992-01-18 00:15:38 +01:00
}
/* FORMAT will be OBJC_ENCODE_INLINE_DEFS or OBJC_ENCODE_DONT_INLINE_DEFS. */
1992-01-18 00:15:38 +01:00
static void
encode_type (tree type, int curtype, int format)
1992-01-18 00:15:38 +01:00
{
enum tree_code code = TREE_CODE (type);
char c;
1992-01-18 00:15:38 +01:00
Makefile.in (c-parse.o): Depend on $(C_COMMON_H). [gcc/ChangeLog] 2004-09-07 Ziemowit Laski <zlaski@apple.com> * Makefile.in (c-parse.o): Depend on $(C_COMMON_H). * c-parse.in: Include c-common.h instead of objc-act.h. (ivar_decl_list, ivar_decls, ivar_decl, ivars, ivar_declarator, myparms, myparm): Remove %type declarations. (methodtype, optparms, OBJC_TYPE_QUAL, objc_quals, objc_qual, objc_typename, objc_try_catch_stmt, optellipsis): Add %type declarations. (objc_inherit_code, objc_public_flag): Remove. (typespec_nonreserved_nonattr): Call objc_get_protocol_qualified_type() instead of get_static_reference() and get_protocol_reference(). (stmt_nocomp): Call grokparm() on @catch parameter. (objcdef): Move semantic action to objc_finish_implementation(). (classdef): Move semantic action to objc_start_class_interface(), objc_continue_interface(), objc_finish_interface(), objc_start_class_implementation(), objc_continue_implementation(), objc_start_category_interface() and objc_start_category_implementation(). (protocoldef): Move semantic actions to objc_start_protocol() and objc_finish_interface(). (ivar_decl_list): Remove nonterminal. (visibility_spec): Move semantic actions to objc_set_visibility(). (ivar_decls): Remove assignment to $$. (ivar_decl): Rephrase in terms of component_decl; call objc_add_instance_variable(). (ivars, ivar_declarator): Remove nonterminals. (opt_semi): New nonterminal. (methodtype): Remove semantic actions. (methoddef): Move semantic actions to objc_set_method_type(), objc_start_method_definition() and objc_finish_method_definition(). (methodproto): Move semantic actions to objc_set_method_type() and objc_add_method_declaration(). (methoddecl): Use objc_typename instead of typename; move semantic actions to objc_build_method_signature(). (optarglist, myxdecls, mydecl, myparms, myparm): Remove nonterminals. (optparmlist): Express in terms of optparms and optellipsis. (optparms, optellipsis, objc_qual, objc_quals, objc_typename): New nonterminals. (keyworddecl): Use objc_typename instead of typename. (rid_to_yy): Mark RID_IN, RID_OUT, RID_INOUT, RID_BYCOPY, RID_BYREF and RID_ONEWAY as returning OBJC_TYPE_QUAL to yyparse(). [gcc/objc/ChangeLog] 2004-09-07 Ziemowit Laski <zlaski@apple.com> * Make-lang.in (objc/objc-parse.o): Depend on $(C_COMMON_H) instead of objc/objc-act.h. (objc/objc-act.o): Depend on $(HASHTAB_H). * objc-act.c: Include hashtab.h; in ObjC++ mode, include cp-tree.h and objcp-decl.h instead of c-tree.h. (build_module_descriptor, get_class_ivars, synth_id_with_class_suffix, error_with_ivar, gen_method_decl, gen_declaration, setup_string_decl, build_protocol_template): Adjust prototypes. (build_module_initializer_routine, start_class, continue_class, finish_class, start_method_def, objc_start_function, start_protocol, build_method_decl, objc_add_method, add_instance_variable, build_ivar_reference, is_ivar, is_private, get_super_receiver, build_selector_table_decl, objc_push_parm, objc_get_parm_info, gen_type_name, gen_type_name_0, start_var_decl, finish_var_decl, create_field_decl): New prototypes. (objc_expand_function_end, comp_method_with_proto, objc_expr_last, gen_declaration_1, gen_declarator, is_complex_decl, adorn_decl, define_decl, create_builtin_decl, gen_declspecs): Remove prototypes. (TYPE_ID): Rename to OBJECT_TYPEDEF_NAME. (CLASS_TYPEDEF_NAME): New. (TAG_EXECCLASS): Change from a global variable to a #define. (TAG_RETURN_STRUCT): Delete. (TAG_GNUINIT): New, holds '__objc_gnu_init' name. (objc_inherit_code, objc_public_flag): New, moved from c-parse.in. (string_descriptor): New struct. (string_htab): New hash table. (string_hash, string_eq): New prototypes. (generate_struct_by_value_array): Call create_field_decl() instead of create_builtin_decl(). (objc_init): Do not initialize objc_ellipsis_node or TAG_EXECCLASS; In ObjC++ mode, call cxx_init() instead of c_objc_common_init(). (objc_finish_file): In ObjC++, call instantiate_pending_templates() and cp_finish_file(). (define_decl, get_static_reference, get_protocol_reference, create_builtin_decl): Remove functions. (objc_start_class_interface, objc_start_category_interface, objc_start_protocol, objc_continue_interface, objc_finish_interface, objc_start_class_implementation, objc_start_category_implementation, objc_continue_implementation, objc_finish_implementation, objc_set_visibility, objc_set_method_type, objc_build_method_signature, objc_add_method_declaration, objc_start_method_definition, objc_add_instance_variable, objc_get_protocol_qualified_type, create_field_decl, start_var_decl, finish_var_decl): New functions. (setup_string_decl): Simplify since it is only called once. (synth_module_prologue): Call build_class_template(); predefine 'id' and 'Class' as typedefs; rename 'temp_type' to 'type'; disable debug hooks for duration of function; fix GNU runtime messenger signatures to correspond to reality; forward-declare '__objc_exec_class' for the GNU runtime; call build_selector_table_decl(); in ObjC++ mode, generate 'extern "C" { ... }' wrappers around synthesized declarations; call build_protocol_template() and build_category_template(). (string_hash, string_eq): New functions. (objc_build_string_object): Check metaclass correctness only once; store string literals in hash table. (objc_build_constructor): Do not convert initializer elements; adjust for ObjC++ impedance mismatch. (build_objc_symtab_template): Call create_field_decl() instead of create_builtin_decl(). (init_objc_symtab): Add missing conversion to initializer element. (build_metadata_decl): Call start_var_decl() instead of define_decl(). (generate_objc_symtab_decl): Do not call build_category_template(); call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(). (build_module_descriptor): Call create_field_decl() instead of grokfield(); call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(); always mark module descriptor as used; move GNU runtime-specific functionality to build_module_initializer_routine(). (build_module_initializer_routine): New function, broken off of build_module_descriptor(). (objc_static_init_needed_p, objc_generate_static_init_call): New functions. (generate_static_references, generate_strings, build_selector_translation_table, generate_descriptor_table, generate_ivars_list, generate_dispatch_table, generate_category): Call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(); build a type directly instead of via groktypename(). (build_selector_reference_decl, build_selector_table_decl, build_class_reference_decl, build_protocol_reference, generate_objc_image_info): Call start_var_decl() instead of build_decl(). (build_selector_reference): For GNU runtime, do not call build_selector_reference_decl(). (build_selector, build_typed_selector_reference): Always convert result to the selector type. (add_objc_string): Cast return value to 'char *'. (build_method_prototype_template, build_selector_template, build_method_template): Use actual selector type for fields pointing to selectors. (finish_objc): For GNU runtime, call build_module_initializer_routine() after build_module_descriptor(). (generate_protocol_list, generate_shared_structures): Call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(); build a type directly instead of via groktypename(). (synth_id_with_class_suffix): Return a string. (get_arg_type_list): For instance methods, use the instance type for 'self'; do not call groktypename_in_parm_context(). (build_objc_string_decl): Squash redeclaration errors in ObjC++. (objc_is_class_name): Use OBJC_TYPE_NAME instead of TYPE_NAME; handle RECORD_TYPEs in ObjC as well as ObjC++. (objc_is_id): New function. (objc_is_object_ptr): Return the canonical type node. (objc_get_class_ivars): Simplify using get_class_ivars(). (get_class_ivars): Remove second parameter; create a fresh copy of the ivar list for each call; do not check for existence of super class. (objc_eh_runtime_type): Mark #ifndef OBJCPLUS. (objc_init_exceptions): When using SJLJ-style exceptions, require the use of '-fobjc-exceptions' flag; do not require it for DWARF-style exceptions. (objc_build_exc_ptr, next_sjlj_build_try_catch_finally): Use objc_object_type instead of objc_id_type. (objc_begin_catch_clause): Convert the incoming PARM_DECL into a VAR_DECL before placing it in the appropriate scope; do not call define_decl(); adjust call to c_begin_compound_stmt(); use objc_object_type instead of objc_id_type. (build_next_objc_exception_stuff): Call create_field_decl() instead of create_builtin_decl(); construct type directly instead of calling groktypename(); use OBJC_VOID_AT_END to mark end of function parameters. (build_private_template): Adjust call to get_class_ivars(); build a type directly instead of via groktypename(). (build_protocol_template, build_method_prototype_list_template, build_method_prototype_template, build_category_template, build_selector_template, build_class_template, build_super_template, build_ivar_template, build_ivar_list_template, build_method_list_template, build_method_template): Call create_field_decl() instead of grokfield(). (objc_method_parm_type): Do not call groktypename(). (generate_descriptor_table): Call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(). (generate_method_descriptors, build_protocol_initializer, generate_dispatch_tables, build_category_initializer, build_shared_structure_initializer): Do not call groktypename(). (generate_protocols): Call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(); do not call groktypename(). (error_with_ivar): Remove last parameter. (check_ivars): Do not iterate ovar CLASS_RAW_IVARS lists in addition to CLASS_IVARS lists; adjust calls to error_with_ivar(). (generate_ivar_lists): Convert one of the initializer elements; do not call groktypename(). (get_arg_type_list, start_method_def, gen_method_def): Account for new representation of variable arguments and '...' in Objective-C methods; add Objective-C++ impedance matching code. (is_objc_type_qualifier): Remove function. (adjust_type_for_id_default): Simplify; there is no longer a need to wade through declspecs. (lookup_interface, start_class, continue_class, finish_class, start_method_def, start_protocol, build_method_decl, objc_add_method, add_instance_variable, build_ivar_reference, is_ivar, is_private, get_super_receiver, objc_build_finally_epilogue): Make into static functions. (receiver_is_class_object): Use new IS_CLASS() macro. (objc_build_message_expr): Tweak ObjC++ message argument handling; call objc_finish_message_expr() instead of finish_message_expr(). (finish_message_expr): Rename to objc_finish_message_expr(); use OBJC_TYPE_NAME and OBJC_SET_TYPE_NAME macros instead of TYPE_NAME. call gen_type_name() instead of gen_declaration(); call objc_is_id() instead of using IS_ID and IS_CLASS; Use objc_class_name instead of calling get_identifier("Class"); handle CONVERT_EXPRs in receiver. (build_objc_method_call, warn_with_method): Do not call groktypename(). (build_ivar_reference): Call convert() instead of clobbering in a type. (hash_init): Initialize string_htab hash table. (add_instance_variable): Simplify parameter list; do not call grokfield(); do not populate CLASS_IVARS list. (start_class): Check for the existence of super class, if one was specified. (continue_class): Use CLASS_RAW_IVARS rather than CLASS_IVARS; do not call build_class_template(); adjust call to get_class_ivars(); call build_decl(), pushdecl() and finish_decl() instead of define_decl(). (finish_class): Call build_decl(), pushdecl() and finish_decl() instead of define_decl(). (add_protocols): Use PROTOCOL_BINFO_ELTS for the tree vector size. (start_protocol): Do not call build_protocol_template(); use PROTOCOL_BINFO_ELTS for the tree vector size. (encode_type_qualifiers): Do not handle the 'const' qualifier here. (encode_pointer): Encode 'const char *' as 'r*', for backwards compatibility. (encode_array): Use HOST_WIDE_INT_PRINT_DEC instead of "%ld". (encode_type): Handle the 'const' qualifier here. (objc_parmlist): New global variable, sued by objc_push_parm and objc_get_parm_info(). (objc_push_parm, objc_get_parm_info): New functions. (objc_expr_last): Remove function. (synth_self_and_ucmd_args): For instance methods, use the instance type for 'self'; call objc_push_parm() instead of push_parm_decl(). (start_method_def): Do not call push_scope(), declare_parm_level(), pop_scope(), push_parm_decl(), store_parm_decls() or objc_expr_last(); just use objc_push_parm() and objc_get_parm_info(). (comp_method_with_proto): Remove function. (objc_types_are_equivalent): Strip away indirections before comparing underlying types. (comp_proto_with_proto): Do not call groktypename(); types are no longer in raw declspec format. (objc_start_function): New function. (really_start_method): Call comp_proto_with_proto() instead of comp_method_with_proto(); call objc_start_function() instead of hand-crafting a function declarator. (continue_method_def, objc_expand_function_end): Remove functions. (get_super_receiver): Call objc_get_current_scope() instead of get_current_scope(); reference 'super_class' field (instead of 'class'). (finish_method_def): Rename to objc_finish_method_definition() and add a function decl parameter; move method encoding call from objc_expand_function_end(). (is_complex_decl, adorn_decl, gen_declarator, gen_declspecs, gen_declaration_1): Remove functions. (tmpbuf, RAW_DECLSPEC): Remove. (gen_declaration): Remove second parameter; simplify to deal with TYPE_P nodes instead of raw declspecs. (gen_type_name, gen_type_name_0): New functions. (gen_method_decl): Remove second parameter; call gen_type_name() instead of gen_declaration_1(). (dump_interface): Adjust calls to gen_declaration() and gen_method_decl(); do not allocate a separate string buffer. (init_objc): Allocate a larger string buffer to accommodate dump_interface(); adjust call to build_module_descriptor(); add call to build_module_initializer_routine() for the GNU runtime. (generate_classref_translation_entry): Do not call start_decl(); call finish_var_decl() instead of finish_decl(); call convert() instead of build_c_cast(). * objc-act.h (CLASS_OWN_IVARS): Remove accessor. (CLASS_BINFO_ELTS): Reduce from 6 to 5, now that CLASS_OWN_IVARS is gone. (OCTI_GNU_INIT_DECL, GNU_INIT_decl): New. (OCTI_ELLIPSIS_NODE, objc_ellipsis_node): Remove. (OCTI_ID_ID, id_type, objc_id_id): Rename to OCTI_ID_NAME, objc_object_type and objc_object_name, respectively. (OCTI_CLS_REF, OCTI_CLASS_NAME, objc_class_reference, objc_class_name): New. (IS_CLASS): New macro. (IS_ID, IS_SUPER): Robustify. (OCTI_EXECCLASS_DECL, execclass_decl): New. (finish_file, start_class, continue_class, finish_class, start_method_def, continue_method_def, finish_method_def, start_protocol, finish_protocol, objc_build_throw_stmt, objc_build_try_catch_finally_stmt, objc_build_synchronized_prologue, objc_build_synchronized_epilogue, objc_build_try_prologue, objc_build_try_epilogue, objc_build_catch_stmt, objc_build_catch_epilogue, objc_build_finally_prologue, objc_build_finally_epilogue, is_ivar, is_private, is_public, add_instance_variable, objc_add_method, get_super_receiver, objc_clear_super_receiver, get_class_ivars_from_name, get_class_reference, get_static_reference, get_object_reference, build_message_expr, finish_message_expr, build_selector_expr, build_ivar_reference, build_keyword_decl, build_method_decl, build_protocol_expr, build_objc_string_object, objc_declare_alias, objc_declare_class, objc_declare_protocols, objc_comptypes, objc_check_decl, build_encode_expr): Remove prototypes. (imp_count, cat_count): Make GGC-aware. (OBJC_SET_TYPE_NAME): New macro. From-SVN: r87168
2004-09-08 02:49:44 +02:00
if (TYPE_READONLY (type))
obstack_1grow (&util_obstack, 'r');
1992-01-18 00:15:38 +01:00
if (code == INTEGER_TYPE)
{
switch (GET_MODE_BITSIZE (TYPE_MODE (type)))
1992-01-18 00:15:38 +01:00
{
builtins.c, [...]: Change most occurrences of TREE_UNSIGNED to TYPE_UNSIGNED. * builtins.c, c-aux-info.c, c-common.c, c-cppbuiltin.c, c-decl.c: Change most occurrences of TREE_UNSIGNED to TYPE_UNSIGNED. * c-format.c, c-opts.c, c-pretty-print.c, c-typeck.c: Likewise. * calls.c, convert.c, dbxout.c, dojump.c, dwarf2out.c: Likewise. * expmed.c, expr.c, fold-const.c, function.c, integrate.c: Likewise. * optabs.c, sdbout.c, stmt.c, stor-layout.c, tree-dump.c: Likewise. * tree.c, config/iq2000/iq2000.c, config/m32r/m32r.c: Likewise. * config/mips/mips.c, config/rs6000/rs6000.c: Likewise. * config/s390/s390.c, config/sparc/sparc.c, objc/objc-act.c: Likewise. * stor-layout.c (layout_type, case COMPLEX_TYPE): Test for REAL_TYPE, not INTEGER_TYPE. (layout_type, case VECTOR_TYPE): Simplify code. * tree.c (build_vector_type_for_mode): Remove dup unsigned setting. * tree.h: Update comments. (STRIP_NOPS): Use TYPE_UNSIGNED. (TYPE_UNSIGNED): New macro. (TYPE_TRAP_SIGNED): Remove now redundant check. (SAVE_EXPR_NOPLACEHOLDER): Don't use TREE_UNSIGNED. * cp/call.c (joust): Use TYPE_UNSIGNED, not TREE_UNSIGNED. * cp/class.c (check_bitfield_decl): Likewise. * cp/cvt.c (type_promotes_to): Likewise. * cp/decl.c (finish_enum): Likewise. * cp/mangle.c (write_builtin_type): Likewise. * cp/semantics.c (finish_switch_cond, finish_unary_op_expr): Likewise. * cp/typeck.c (type_after_usual_arithmetic_conversions): Likewise. (build_binary_op): Likewise. * f/com.c (ffecom_arrayref_): Use TYPE_UNSIGNED, not TREE_UNSIGNED. (ffecom_expr_): Likewise. * java/jcf-write.c (generate_bytecode_insns): Use TYPE_UNSIGNED. * treelang/treetree.c (tree_lang_signed_or_unsigned_type): Use TYPE_UNSIGNED, not TREE_UNSIGNED. * ada/decl.c (gnat_to_gnu_entity, make_type_from_size): Use TYPE_UNSIGNED, not TREE_UNSIGNED. * ada/trans.c (tree_transform, convert_with_check): Likewise. * ada/utils.c (gnat_signed_or_unsigned_type): Likewise. (build_vms_descriptor, unchecked_convert): Likewise. * ada/utils2.c (nonbinary_modular_operation): Likewise. From-SVN: r80287
2004-04-01 05:50:43 +02:00
case 8: c = TYPE_UNSIGNED (type) ? 'C' : 'c'; break;
case 16: c = TYPE_UNSIGNED (type) ? 'S' : 's'; break;
case 32:
if (type == long_unsigned_type_node
|| type == long_integer_type_node)
builtins.c, [...]: Change most occurrences of TREE_UNSIGNED to TYPE_UNSIGNED. * builtins.c, c-aux-info.c, c-common.c, c-cppbuiltin.c, c-decl.c: Change most occurrences of TREE_UNSIGNED to TYPE_UNSIGNED. * c-format.c, c-opts.c, c-pretty-print.c, c-typeck.c: Likewise. * calls.c, convert.c, dbxout.c, dojump.c, dwarf2out.c: Likewise. * expmed.c, expr.c, fold-const.c, function.c, integrate.c: Likewise. * optabs.c, sdbout.c, stmt.c, stor-layout.c, tree-dump.c: Likewise. * tree.c, config/iq2000/iq2000.c, config/m32r/m32r.c: Likewise. * config/mips/mips.c, config/rs6000/rs6000.c: Likewise. * config/s390/s390.c, config/sparc/sparc.c, objc/objc-act.c: Likewise. * stor-layout.c (layout_type, case COMPLEX_TYPE): Test for REAL_TYPE, not INTEGER_TYPE. (layout_type, case VECTOR_TYPE): Simplify code. * tree.c (build_vector_type_for_mode): Remove dup unsigned setting. * tree.h: Update comments. (STRIP_NOPS): Use TYPE_UNSIGNED. (TYPE_UNSIGNED): New macro. (TYPE_TRAP_SIGNED): Remove now redundant check. (SAVE_EXPR_NOPLACEHOLDER): Don't use TREE_UNSIGNED. * cp/call.c (joust): Use TYPE_UNSIGNED, not TREE_UNSIGNED. * cp/class.c (check_bitfield_decl): Likewise. * cp/cvt.c (type_promotes_to): Likewise. * cp/decl.c (finish_enum): Likewise. * cp/mangle.c (write_builtin_type): Likewise. * cp/semantics.c (finish_switch_cond, finish_unary_op_expr): Likewise. * cp/typeck.c (type_after_usual_arithmetic_conversions): Likewise. (build_binary_op): Likewise. * f/com.c (ffecom_arrayref_): Use TYPE_UNSIGNED, not TREE_UNSIGNED. (ffecom_expr_): Likewise. * java/jcf-write.c (generate_bytecode_insns): Use TYPE_UNSIGNED. * treelang/treetree.c (tree_lang_signed_or_unsigned_type): Use TYPE_UNSIGNED, not TREE_UNSIGNED. * ada/decl.c (gnat_to_gnu_entity, make_type_from_size): Use TYPE_UNSIGNED, not TREE_UNSIGNED. * ada/trans.c (tree_transform, convert_with_check): Likewise. * ada/utils.c (gnat_signed_or_unsigned_type): Likewise. (build_vms_descriptor, unchecked_convert): Likewise. * ada/utils2.c (nonbinary_modular_operation): Likewise. From-SVN: r80287
2004-04-01 05:50:43 +02:00
c = TYPE_UNSIGNED (type) ? 'L' : 'l';
else
builtins.c, [...]: Change most occurrences of TREE_UNSIGNED to TYPE_UNSIGNED. * builtins.c, c-aux-info.c, c-common.c, c-cppbuiltin.c, c-decl.c: Change most occurrences of TREE_UNSIGNED to TYPE_UNSIGNED. * c-format.c, c-opts.c, c-pretty-print.c, c-typeck.c: Likewise. * calls.c, convert.c, dbxout.c, dojump.c, dwarf2out.c: Likewise. * expmed.c, expr.c, fold-const.c, function.c, integrate.c: Likewise. * optabs.c, sdbout.c, stmt.c, stor-layout.c, tree-dump.c: Likewise. * tree.c, config/iq2000/iq2000.c, config/m32r/m32r.c: Likewise. * config/mips/mips.c, config/rs6000/rs6000.c: Likewise. * config/s390/s390.c, config/sparc/sparc.c, objc/objc-act.c: Likewise. * stor-layout.c (layout_type, case COMPLEX_TYPE): Test for REAL_TYPE, not INTEGER_TYPE. (layout_type, case VECTOR_TYPE): Simplify code. * tree.c (build_vector_type_for_mode): Remove dup unsigned setting. * tree.h: Update comments. (STRIP_NOPS): Use TYPE_UNSIGNED. (TYPE_UNSIGNED): New macro. (TYPE_TRAP_SIGNED): Remove now redundant check. (SAVE_EXPR_NOPLACEHOLDER): Don't use TREE_UNSIGNED. * cp/call.c (joust): Use TYPE_UNSIGNED, not TREE_UNSIGNED. * cp/class.c (check_bitfield_decl): Likewise. * cp/cvt.c (type_promotes_to): Likewise. * cp/decl.c (finish_enum): Likewise. * cp/mangle.c (write_builtin_type): Likewise. * cp/semantics.c (finish_switch_cond, finish_unary_op_expr): Likewise. * cp/typeck.c (type_after_usual_arithmetic_conversions): Likewise. (build_binary_op): Likewise. * f/com.c (ffecom_arrayref_): Use TYPE_UNSIGNED, not TREE_UNSIGNED. (ffecom_expr_): Likewise. * java/jcf-write.c (generate_bytecode_insns): Use TYPE_UNSIGNED. * treelang/treetree.c (tree_lang_signed_or_unsigned_type): Use TYPE_UNSIGNED, not TREE_UNSIGNED. * ada/decl.c (gnat_to_gnu_entity, make_type_from_size): Use TYPE_UNSIGNED, not TREE_UNSIGNED. * ada/trans.c (tree_transform, convert_with_check): Likewise. * ada/utils.c (gnat_signed_or_unsigned_type): Likewise. (build_vms_descriptor, unchecked_convert): Likewise. * ada/utils2.c (nonbinary_modular_operation): Likewise. From-SVN: r80287
2004-04-01 05:50:43 +02:00
c = TYPE_UNSIGNED (type) ? 'I' : 'i';
break;
builtins.c, [...]: Change most occurrences of TREE_UNSIGNED to TYPE_UNSIGNED. * builtins.c, c-aux-info.c, c-common.c, c-cppbuiltin.c, c-decl.c: Change most occurrences of TREE_UNSIGNED to TYPE_UNSIGNED. * c-format.c, c-opts.c, c-pretty-print.c, c-typeck.c: Likewise. * calls.c, convert.c, dbxout.c, dojump.c, dwarf2out.c: Likewise. * expmed.c, expr.c, fold-const.c, function.c, integrate.c: Likewise. * optabs.c, sdbout.c, stmt.c, stor-layout.c, tree-dump.c: Likewise. * tree.c, config/iq2000/iq2000.c, config/m32r/m32r.c: Likewise. * config/mips/mips.c, config/rs6000/rs6000.c: Likewise. * config/s390/s390.c, config/sparc/sparc.c, objc/objc-act.c: Likewise. * stor-layout.c (layout_type, case COMPLEX_TYPE): Test for REAL_TYPE, not INTEGER_TYPE. (layout_type, case VECTOR_TYPE): Simplify code. * tree.c (build_vector_type_for_mode): Remove dup unsigned setting. * tree.h: Update comments. (STRIP_NOPS): Use TYPE_UNSIGNED. (TYPE_UNSIGNED): New macro. (TYPE_TRAP_SIGNED): Remove now redundant check. (SAVE_EXPR_NOPLACEHOLDER): Don't use TREE_UNSIGNED. * cp/call.c (joust): Use TYPE_UNSIGNED, not TREE_UNSIGNED. * cp/class.c (check_bitfield_decl): Likewise. * cp/cvt.c (type_promotes_to): Likewise. * cp/decl.c (finish_enum): Likewise. * cp/mangle.c (write_builtin_type): Likewise. * cp/semantics.c (finish_switch_cond, finish_unary_op_expr): Likewise. * cp/typeck.c (type_after_usual_arithmetic_conversions): Likewise. (build_binary_op): Likewise. * f/com.c (ffecom_arrayref_): Use TYPE_UNSIGNED, not TREE_UNSIGNED. (ffecom_expr_): Likewise. * java/jcf-write.c (generate_bytecode_insns): Use TYPE_UNSIGNED. * treelang/treetree.c (tree_lang_signed_or_unsigned_type): Use TYPE_UNSIGNED, not TREE_UNSIGNED. * ada/decl.c (gnat_to_gnu_entity, make_type_from_size): Use TYPE_UNSIGNED, not TREE_UNSIGNED. * ada/trans.c (tree_transform, convert_with_check): Likewise. * ada/utils.c (gnat_signed_or_unsigned_type): Likewise. (build_vms_descriptor, unchecked_convert): Likewise. * ada/utils2.c (nonbinary_modular_operation): Likewise. From-SVN: r80287
2004-04-01 05:50:43 +02:00
case 64: c = TYPE_UNSIGNED (type) ? 'Q' : 'q'; break;
default: abort ();
1992-01-18 00:15:38 +01:00
}
obstack_1grow (&util_obstack, c);
1992-01-18 00:15:38 +01:00
}
1992-01-18 00:15:38 +01:00
else if (code == REAL_TYPE)
{
1996-07-04 00:07:53 +02:00
/* Floating point types. */
switch (GET_MODE_BITSIZE (TYPE_MODE (type)))
{
case 32: c = 'f'; break;
case 64:
case 96:
case 128: c = 'd'; break;
default: abort ();
}
obstack_1grow (&util_obstack, c);
1992-01-18 00:15:38 +01:00
}
else if (code == VOID_TYPE)
obstack_1grow (&util_obstack, 'v');
1992-01-18 00:15:38 +01:00
else if (code == BOOLEAN_TYPE)
obstack_1grow (&util_obstack, 'B');
1992-01-18 00:15:38 +01:00
else if (code == ARRAY_TYPE)
encode_array (type, curtype, format);
1992-01-18 00:15:38 +01:00
else if (code == POINTER_TYPE)
encode_pointer (type, curtype, format);
1992-01-18 00:15:38 +01:00
else if (code == RECORD_TYPE || code == UNION_TYPE || code == ENUMERAL_TYPE)
encode_aggregate (type, curtype, format);
1992-01-18 00:15:38 +01:00
else if (code == FUNCTION_TYPE) /* '?' */
obstack_1grow (&util_obstack, '?');
else if (code == COMPLEX_TYPE)
{
obstack_1grow (&util_obstack, 'j');
encode_type (TREE_TYPE (type), curtype, format);
}
1992-01-18 00:15:38 +01:00
}
static void
encode_gnu_bitfield (int position, tree type, int size)
{
enum tree_code code = TREE_CODE (type);
char buffer[40];
char charType = '?';
if (code == INTEGER_TYPE)
{
* Clean up usages of TREE_INT_CST_LOW. * c-parse.in (RESTORE_WARN_FLAGS): Use tree_low_cst. * c-parse.y, c-parse.c, objc/objc-parse.y, objc/objc-parse.c: Regenerated. * c-tree.h (min_precision): Move declaration to here. * c-typeck.c (build_binary_op): Use host_integerp and tree_low_cst. (build_unary_op, add_pending_init): Use bit_position. (pending_init_member, process_init_element): Likewise. (really_start_incremental_init, push_init_level, pop_init_level): Don't make copies of nodes or modify them in place, use consistent types when tracking positions, and use tree routines computations. (set_init_index, output_init_element): Likewise. (output_pending_init_elements, process_init_element): Likewise. * dbxout.c (dbxout_type_fields): Use bit_position, host_integerp, tree_low_cst and int_bit_position; also minor cleanup. (dbxout_type_method_1, dbxout_range_type, dbxout_type): Likewise. (print_cst_octal): Precision is unsigned. (dbxout_symbol): Ensure DECL_INITIAL is in-range and use tree_low_cst. * dwarf2out.c (ceiling): Input and output are unsigned HOST_WIDE_INT. (simple_type_align_in_bits): Result is unsigned int. Use tree_int_low_cst and host_integerp. (simple_type_size_in_bits): Result is unsigned HOST_WIDE_INT. (field_byte_offset): Result is HOST_WIDE_INT. Change types of internal variables so alignments are unsigned int, offsets are HOST_WIDE_INT and sizes are unsigned HOST_WIDE_INT. Use host_integerp, tree_low_cst, and int_bit_position. (add_bit_offset_attribute): Likewise. (add_data_member_location_attribute): Use tree_cst_low. (add_bound_info): Use host_integerp, integer_zerop, and integer_onep. (add_bit_size_attribute): Use tree_low_cst. (add_pure_or_virtual_attribute, gen_enumeration_type_die): Likewise. * dwarfout.c: Similar changes to dwarf2out.c. * expr.c (expand_expr, case ARRAY_REF): Remove redundant code. * genoutput.c (n_occurences): Return -1 for null string. (strip_whitespace): Accept null string and make into function. (scan_operands): Reflect above changes. * sdbout.c (plain_type_1): Use host_integerp and tree_low_cst. (sdbout_field_types, sdbout_one_type): Likewise; also use bit_position. * ssa.c (rename_registers): Add missing cast of arg to bzero. * tree.c (int_size_in_bytes): Check for too big to represent. (bit_position, int_bit_position, host_integerp, tree_low_cst): New fns. * tree.h (host_integerp, tree_low_cst, bit_position, int_bit_position): New declarations. (min_precision): Delete from here. * varasm.c (decode_addr_const): Use host_integerp, bit_position, and int_bit_position. * objc/objc-act.c (encode_method_prototype): Sizes are HOST_WIDE_INT. (encode_method_def): Likewise. (build_ivar_list_initializer): Use int_bit_position. (generate_shared_structures): Convert size. (encode_type, encode_complete_bitfield): Use integer_zerop. (encode_bitfield): Use tree_low_cst and int_bit_position. * ch/typeck.c (min_precision): New function. (build_chill_slice): Use host_integerp and tree_low_cst. (expand_constant_to_buffer): Likewise and also int_bit_position. LO is unsigned HOST_WIDE_INT (build_chill_array_ref_1): Make `i' be HOST_WIDE_INT; use tree_low_cst. (extract_constant_from_buffer): Sizes are now HOST_WIDE_INT. Use host_integerp and tree_low_cst. (build_chill_bin_type): Use host_integerp and tree_low_cst. (layout_chill_range_type): Use tree_int_cst_sgn, compare_tree_int, tree_low_cst, and min_precision. (apply_chill_array_layout): Cleanups for types of variables and use tree_int_cst_sgn, compare_tree_int, and tree_low_cst. (apply_chill_field_layout): Likewise. * cp/class.c (build_vbase_path): Use integer_zerop. (build_vtable_entry): Use tree_low_cst. (get_vfield_offset): Use bit_position. (dfs_modify_vtables): New variable vindex_val; `i' is HOST_WIDE_INT. Use tree_low_cst. (check_bitfield_decl): Set DECL_SIZE using convert. (build_base_field): Set DECL_SIZE and DECL_SIZE_UNIT using size_binop. (layout_virtual_bases): DSIZE is unsigned HOST_WIDE_INT. Use tree_low_cst. (finish_struct_1): Use bit_position. (dump_class_hierarchy): Use tree_low_cst. * cp/cp-tree.h (min_precision): Add declaration. * cp/decl.c (xref_tag, xref_basetypes): Use tree_low_cst. * cp/error.c (dump_type_suffix): Use host_integerp and tree_low_cst. (dump_expr): Use integer_zerop, host_integerp, and tree_low_cst. * cp/expr.c (cplus_expand_constant): Use bit_position. * cp/init.c (build_vec_init): Use host_integerp and tree_low_cst. * cp/rtti.c (get_base_offset): Use bit_position. * cp/typeck.c (build_binary_op): Use integer_zerop, compare_tree_int, host_integerp, and tree_low_cst. (pointer_int_sum): Use integer_zerop. (build_component_addr): Use bit_position. * java/class.c (make_field_value): Properly handle sizes. (get_dispatch_vector): Use tree_low_cst and host_integerp. (layout_class_method): Count using trees. * java/decl.c (push_promoted_type): Set TYPE_{MIN,MAX}_VALUE with copy_node. * java/expr.c (java_array_data_offset): Use int_bit_position. (build_newarray, build_anewarray): Use host_integerp and tree_low_cst. (build_invokevirtual): Use tree_low_cst and do computations with trees. From-SVN: r32607
2000-03-17 18:31:58 +01:00
if (integer_zerop (TYPE_MIN_VALUE (type)))
{
/* Unsigned integer types. */
if (TYPE_MODE (type) == QImode)
charType = 'C';
else if (TYPE_MODE (type) == HImode)
charType = 'S';
else if (TYPE_MODE (type) == SImode)
{
if (type == long_unsigned_type_node)
charType = 'L';
else
charType = 'I';
}
else if (TYPE_MODE (type) == DImode)
charType = 'Q';
}
else
/* Signed integer types. */
{
if (TYPE_MODE (type) == QImode)
charType = 'c';
else if (TYPE_MODE (type) == HImode)
charType = 's';
else if (TYPE_MODE (type) == SImode)
{
if (type == long_integer_type_node)
charType = 'l';
else
charType = 'i';
}
else if (TYPE_MODE (type) == DImode)
charType = 'q';
}
}
else if (code == ENUMERAL_TYPE)
charType = 'i';
else
abort ();
sprintf (buffer, "b%d%c%d", position, charType, size);
obstack_grow (&util_obstack, buffer, strlen (buffer));
}
1992-01-18 00:15:38 +01:00
static void
encode_field_decl (tree field_decl, int curtype, int format)
1992-01-18 00:15:38 +01:00
{
tree type;
#ifdef OBJCPLUS
/* C++ static members, and things that are not fields at all,
should not appear in the encoding. */
if (TREE_CODE (field_decl) != FIELD_DECL || TREE_STATIC (field_decl))
return;
#endif
type = TREE_TYPE (field_decl);
/* Generate the bitfield typing information, if needed. Note the difference
between GNU and NeXT runtimes. */
if (DECL_BIT_FIELD_TYPE (field_decl))
{
int size = tree_low_cst (DECL_SIZE (field_decl), 1);
if (flag_next_runtime)
encode_next_bitfield (size);
else
encode_gnu_bitfield (int_bit_position (field_decl),
DECL_BIT_FIELD_TYPE (field_decl), size);
}
1992-01-18 00:15:38 +01:00
else
encode_type (TREE_TYPE (field_decl), curtype, format);
1992-01-18 00:15:38 +01:00
}
Makefile.in (c-parse.o): Depend on $(C_COMMON_H). [gcc/ChangeLog] 2004-09-07 Ziemowit Laski <zlaski@apple.com> * Makefile.in (c-parse.o): Depend on $(C_COMMON_H). * c-parse.in: Include c-common.h instead of objc-act.h. (ivar_decl_list, ivar_decls, ivar_decl, ivars, ivar_declarator, myparms, myparm): Remove %type declarations. (methodtype, optparms, OBJC_TYPE_QUAL, objc_quals, objc_qual, objc_typename, objc_try_catch_stmt, optellipsis): Add %type declarations. (objc_inherit_code, objc_public_flag): Remove. (typespec_nonreserved_nonattr): Call objc_get_protocol_qualified_type() instead of get_static_reference() and get_protocol_reference(). (stmt_nocomp): Call grokparm() on @catch parameter. (objcdef): Move semantic action to objc_finish_implementation(). (classdef): Move semantic action to objc_start_class_interface(), objc_continue_interface(), objc_finish_interface(), objc_start_class_implementation(), objc_continue_implementation(), objc_start_category_interface() and objc_start_category_implementation(). (protocoldef): Move semantic actions to objc_start_protocol() and objc_finish_interface(). (ivar_decl_list): Remove nonterminal. (visibility_spec): Move semantic actions to objc_set_visibility(). (ivar_decls): Remove assignment to $$. (ivar_decl): Rephrase in terms of component_decl; call objc_add_instance_variable(). (ivars, ivar_declarator): Remove nonterminals. (opt_semi): New nonterminal. (methodtype): Remove semantic actions. (methoddef): Move semantic actions to objc_set_method_type(), objc_start_method_definition() and objc_finish_method_definition(). (methodproto): Move semantic actions to objc_set_method_type() and objc_add_method_declaration(). (methoddecl): Use objc_typename instead of typename; move semantic actions to objc_build_method_signature(). (optarglist, myxdecls, mydecl, myparms, myparm): Remove nonterminals. (optparmlist): Express in terms of optparms and optellipsis. (optparms, optellipsis, objc_qual, objc_quals, objc_typename): New nonterminals. (keyworddecl): Use objc_typename instead of typename. (rid_to_yy): Mark RID_IN, RID_OUT, RID_INOUT, RID_BYCOPY, RID_BYREF and RID_ONEWAY as returning OBJC_TYPE_QUAL to yyparse(). [gcc/objc/ChangeLog] 2004-09-07 Ziemowit Laski <zlaski@apple.com> * Make-lang.in (objc/objc-parse.o): Depend on $(C_COMMON_H) instead of objc/objc-act.h. (objc/objc-act.o): Depend on $(HASHTAB_H). * objc-act.c: Include hashtab.h; in ObjC++ mode, include cp-tree.h and objcp-decl.h instead of c-tree.h. (build_module_descriptor, get_class_ivars, synth_id_with_class_suffix, error_with_ivar, gen_method_decl, gen_declaration, setup_string_decl, build_protocol_template): Adjust prototypes. (build_module_initializer_routine, start_class, continue_class, finish_class, start_method_def, objc_start_function, start_protocol, build_method_decl, objc_add_method, add_instance_variable, build_ivar_reference, is_ivar, is_private, get_super_receiver, build_selector_table_decl, objc_push_parm, objc_get_parm_info, gen_type_name, gen_type_name_0, start_var_decl, finish_var_decl, create_field_decl): New prototypes. (objc_expand_function_end, comp_method_with_proto, objc_expr_last, gen_declaration_1, gen_declarator, is_complex_decl, adorn_decl, define_decl, create_builtin_decl, gen_declspecs): Remove prototypes. (TYPE_ID): Rename to OBJECT_TYPEDEF_NAME. (CLASS_TYPEDEF_NAME): New. (TAG_EXECCLASS): Change from a global variable to a #define. (TAG_RETURN_STRUCT): Delete. (TAG_GNUINIT): New, holds '__objc_gnu_init' name. (objc_inherit_code, objc_public_flag): New, moved from c-parse.in. (string_descriptor): New struct. (string_htab): New hash table. (string_hash, string_eq): New prototypes. (generate_struct_by_value_array): Call create_field_decl() instead of create_builtin_decl(). (objc_init): Do not initialize objc_ellipsis_node or TAG_EXECCLASS; In ObjC++ mode, call cxx_init() instead of c_objc_common_init(). (objc_finish_file): In ObjC++, call instantiate_pending_templates() and cp_finish_file(). (define_decl, get_static_reference, get_protocol_reference, create_builtin_decl): Remove functions. (objc_start_class_interface, objc_start_category_interface, objc_start_protocol, objc_continue_interface, objc_finish_interface, objc_start_class_implementation, objc_start_category_implementation, objc_continue_implementation, objc_finish_implementation, objc_set_visibility, objc_set_method_type, objc_build_method_signature, objc_add_method_declaration, objc_start_method_definition, objc_add_instance_variable, objc_get_protocol_qualified_type, create_field_decl, start_var_decl, finish_var_decl): New functions. (setup_string_decl): Simplify since it is only called once. (synth_module_prologue): Call build_class_template(); predefine 'id' and 'Class' as typedefs; rename 'temp_type' to 'type'; disable debug hooks for duration of function; fix GNU runtime messenger signatures to correspond to reality; forward-declare '__objc_exec_class' for the GNU runtime; call build_selector_table_decl(); in ObjC++ mode, generate 'extern "C" { ... }' wrappers around synthesized declarations; call build_protocol_template() and build_category_template(). (string_hash, string_eq): New functions. (objc_build_string_object): Check metaclass correctness only once; store string literals in hash table. (objc_build_constructor): Do not convert initializer elements; adjust for ObjC++ impedance mismatch. (build_objc_symtab_template): Call create_field_decl() instead of create_builtin_decl(). (init_objc_symtab): Add missing conversion to initializer element. (build_metadata_decl): Call start_var_decl() instead of define_decl(). (generate_objc_symtab_decl): Do not call build_category_template(); call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(). (build_module_descriptor): Call create_field_decl() instead of grokfield(); call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(); always mark module descriptor as used; move GNU runtime-specific functionality to build_module_initializer_routine(). (build_module_initializer_routine): New function, broken off of build_module_descriptor(). (objc_static_init_needed_p, objc_generate_static_init_call): New functions. (generate_static_references, generate_strings, build_selector_translation_table, generate_descriptor_table, generate_ivars_list, generate_dispatch_table, generate_category): Call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(); build a type directly instead of via groktypename(). (build_selector_reference_decl, build_selector_table_decl, build_class_reference_decl, build_protocol_reference, generate_objc_image_info): Call start_var_decl() instead of build_decl(). (build_selector_reference): For GNU runtime, do not call build_selector_reference_decl(). (build_selector, build_typed_selector_reference): Always convert result to the selector type. (add_objc_string): Cast return value to 'char *'. (build_method_prototype_template, build_selector_template, build_method_template): Use actual selector type for fields pointing to selectors. (finish_objc): For GNU runtime, call build_module_initializer_routine() after build_module_descriptor(). (generate_protocol_list, generate_shared_structures): Call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(); build a type directly instead of via groktypename(). (synth_id_with_class_suffix): Return a string. (get_arg_type_list): For instance methods, use the instance type for 'self'; do not call groktypename_in_parm_context(). (build_objc_string_decl): Squash redeclaration errors in ObjC++. (objc_is_class_name): Use OBJC_TYPE_NAME instead of TYPE_NAME; handle RECORD_TYPEs in ObjC as well as ObjC++. (objc_is_id): New function. (objc_is_object_ptr): Return the canonical type node. (objc_get_class_ivars): Simplify using get_class_ivars(). (get_class_ivars): Remove second parameter; create a fresh copy of the ivar list for each call; do not check for existence of super class. (objc_eh_runtime_type): Mark #ifndef OBJCPLUS. (objc_init_exceptions): When using SJLJ-style exceptions, require the use of '-fobjc-exceptions' flag; do not require it for DWARF-style exceptions. (objc_build_exc_ptr, next_sjlj_build_try_catch_finally): Use objc_object_type instead of objc_id_type. (objc_begin_catch_clause): Convert the incoming PARM_DECL into a VAR_DECL before placing it in the appropriate scope; do not call define_decl(); adjust call to c_begin_compound_stmt(); use objc_object_type instead of objc_id_type. (build_next_objc_exception_stuff): Call create_field_decl() instead of create_builtin_decl(); construct type directly instead of calling groktypename(); use OBJC_VOID_AT_END to mark end of function parameters. (build_private_template): Adjust call to get_class_ivars(); build a type directly instead of via groktypename(). (build_protocol_template, build_method_prototype_list_template, build_method_prototype_template, build_category_template, build_selector_template, build_class_template, build_super_template, build_ivar_template, build_ivar_list_template, build_method_list_template, build_method_template): Call create_field_decl() instead of grokfield(). (objc_method_parm_type): Do not call groktypename(). (generate_descriptor_table): Call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(). (generate_method_descriptors, build_protocol_initializer, generate_dispatch_tables, build_category_initializer, build_shared_structure_initializer): Do not call groktypename(). (generate_protocols): Call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(); do not call groktypename(). (error_with_ivar): Remove last parameter. (check_ivars): Do not iterate ovar CLASS_RAW_IVARS lists in addition to CLASS_IVARS lists; adjust calls to error_with_ivar(). (generate_ivar_lists): Convert one of the initializer elements; do not call groktypename(). (get_arg_type_list, start_method_def, gen_method_def): Account for new representation of variable arguments and '...' in Objective-C methods; add Objective-C++ impedance matching code. (is_objc_type_qualifier): Remove function. (adjust_type_for_id_default): Simplify; there is no longer a need to wade through declspecs. (lookup_interface, start_class, continue_class, finish_class, start_method_def, start_protocol, build_method_decl, objc_add_method, add_instance_variable, build_ivar_reference, is_ivar, is_private, get_super_receiver, objc_build_finally_epilogue): Make into static functions. (receiver_is_class_object): Use new IS_CLASS() macro. (objc_build_message_expr): Tweak ObjC++ message argument handling; call objc_finish_message_expr() instead of finish_message_expr(). (finish_message_expr): Rename to objc_finish_message_expr(); use OBJC_TYPE_NAME and OBJC_SET_TYPE_NAME macros instead of TYPE_NAME. call gen_type_name() instead of gen_declaration(); call objc_is_id() instead of using IS_ID and IS_CLASS; Use objc_class_name instead of calling get_identifier("Class"); handle CONVERT_EXPRs in receiver. (build_objc_method_call, warn_with_method): Do not call groktypename(). (build_ivar_reference): Call convert() instead of clobbering in a type. (hash_init): Initialize string_htab hash table. (add_instance_variable): Simplify parameter list; do not call grokfield(); do not populate CLASS_IVARS list. (start_class): Check for the existence of super class, if one was specified. (continue_class): Use CLASS_RAW_IVARS rather than CLASS_IVARS; do not call build_class_template(); adjust call to get_class_ivars(); call build_decl(), pushdecl() and finish_decl() instead of define_decl(). (finish_class): Call build_decl(), pushdecl() and finish_decl() instead of define_decl(). (add_protocols): Use PROTOCOL_BINFO_ELTS for the tree vector size. (start_protocol): Do not call build_protocol_template(); use PROTOCOL_BINFO_ELTS for the tree vector size. (encode_type_qualifiers): Do not handle the 'const' qualifier here. (encode_pointer): Encode 'const char *' as 'r*', for backwards compatibility. (encode_array): Use HOST_WIDE_INT_PRINT_DEC instead of "%ld". (encode_type): Handle the 'const' qualifier here. (objc_parmlist): New global variable, sued by objc_push_parm and objc_get_parm_info(). (objc_push_parm, objc_get_parm_info): New functions. (objc_expr_last): Remove function. (synth_self_and_ucmd_args): For instance methods, use the instance type for 'self'; call objc_push_parm() instead of push_parm_decl(). (start_method_def): Do not call push_scope(), declare_parm_level(), pop_scope(), push_parm_decl(), store_parm_decls() or objc_expr_last(); just use objc_push_parm() and objc_get_parm_info(). (comp_method_with_proto): Remove function. (objc_types_are_equivalent): Strip away indirections before comparing underlying types. (comp_proto_with_proto): Do not call groktypename(); types are no longer in raw declspec format. (objc_start_function): New function. (really_start_method): Call comp_proto_with_proto() instead of comp_method_with_proto(); call objc_start_function() instead of hand-crafting a function declarator. (continue_method_def, objc_expand_function_end): Remove functions. (get_super_receiver): Call objc_get_current_scope() instead of get_current_scope(); reference 'super_class' field (instead of 'class'). (finish_method_def): Rename to objc_finish_method_definition() and add a function decl parameter; move method encoding call from objc_expand_function_end(). (is_complex_decl, adorn_decl, gen_declarator, gen_declspecs, gen_declaration_1): Remove functions. (tmpbuf, RAW_DECLSPEC): Remove. (gen_declaration): Remove second parameter; simplify to deal with TYPE_P nodes instead of raw declspecs. (gen_type_name, gen_type_name_0): New functions. (gen_method_decl): Remove second parameter; call gen_type_name() instead of gen_declaration_1(). (dump_interface): Adjust calls to gen_declaration() and gen_method_decl(); do not allocate a separate string buffer. (init_objc): Allocate a larger string buffer to accommodate dump_interface(); adjust call to build_module_descriptor(); add call to build_module_initializer_routine() for the GNU runtime. (generate_classref_translation_entry): Do not call start_decl(); call finish_var_decl() instead of finish_decl(); call convert() instead of build_c_cast(). * objc-act.h (CLASS_OWN_IVARS): Remove accessor. (CLASS_BINFO_ELTS): Reduce from 6 to 5, now that CLASS_OWN_IVARS is gone. (OCTI_GNU_INIT_DECL, GNU_INIT_decl): New. (OCTI_ELLIPSIS_NODE, objc_ellipsis_node): Remove. (OCTI_ID_ID, id_type, objc_id_id): Rename to OCTI_ID_NAME, objc_object_type and objc_object_name, respectively. (OCTI_CLS_REF, OCTI_CLASS_NAME, objc_class_reference, objc_class_name): New. (IS_CLASS): New macro. (IS_ID, IS_SUPER): Robustify. (OCTI_EXECCLASS_DECL, execclass_decl): New. (finish_file, start_class, continue_class, finish_class, start_method_def, continue_method_def, finish_method_def, start_protocol, finish_protocol, objc_build_throw_stmt, objc_build_try_catch_finally_stmt, objc_build_synchronized_prologue, objc_build_synchronized_epilogue, objc_build_try_prologue, objc_build_try_epilogue, objc_build_catch_stmt, objc_build_catch_epilogue, objc_build_finally_prologue, objc_build_finally_epilogue, is_ivar, is_private, is_public, add_instance_variable, objc_add_method, get_super_receiver, objc_clear_super_receiver, get_class_ivars_from_name, get_class_reference, get_static_reference, get_object_reference, build_message_expr, finish_message_expr, build_selector_expr, build_ivar_reference, build_keyword_decl, build_method_decl, build_protocol_expr, build_objc_string_object, objc_declare_alias, objc_declare_class, objc_declare_protocols, objc_comptypes, objc_check_decl, build_encode_expr): Remove prototypes. (imp_count, cat_count): Make GGC-aware. (OBJC_SET_TYPE_NAME): New macro. From-SVN: r87168
2004-09-08 02:49:44 +02:00
static GTY(()) tree objc_parmlist = NULL_TREE;
/* Append PARM to a list of formal parameters of a method, making a necessary
array-to-pointer adjustment along the way. */
static void
objc_push_parm (tree parm)
{
bool relayout_needed = false;
/* Decay arrays and functions into pointers. */
if (TREE_CODE (TREE_TYPE (parm)) == ARRAY_TYPE)
{
TREE_TYPE (parm) = build_pointer_type (TREE_TYPE (TREE_TYPE (parm)));
relayout_needed = true;
}
else if (TREE_CODE (TREE_TYPE (parm)) == FUNCTION_TYPE)
{
TREE_TYPE (parm) = build_pointer_type (TREE_TYPE (parm));
relayout_needed = true;
}
if (relayout_needed)
relayout_decl (parm);
Makefile.in (c-parse.o): Depend on $(C_COMMON_H). [gcc/ChangeLog] 2004-09-07 Ziemowit Laski <zlaski@apple.com> * Makefile.in (c-parse.o): Depend on $(C_COMMON_H). * c-parse.in: Include c-common.h instead of objc-act.h. (ivar_decl_list, ivar_decls, ivar_decl, ivars, ivar_declarator, myparms, myparm): Remove %type declarations. (methodtype, optparms, OBJC_TYPE_QUAL, objc_quals, objc_qual, objc_typename, objc_try_catch_stmt, optellipsis): Add %type declarations. (objc_inherit_code, objc_public_flag): Remove. (typespec_nonreserved_nonattr): Call objc_get_protocol_qualified_type() instead of get_static_reference() and get_protocol_reference(). (stmt_nocomp): Call grokparm() on @catch parameter. (objcdef): Move semantic action to objc_finish_implementation(). (classdef): Move semantic action to objc_start_class_interface(), objc_continue_interface(), objc_finish_interface(), objc_start_class_implementation(), objc_continue_implementation(), objc_start_category_interface() and objc_start_category_implementation(). (protocoldef): Move semantic actions to objc_start_protocol() and objc_finish_interface(). (ivar_decl_list): Remove nonterminal. (visibility_spec): Move semantic actions to objc_set_visibility(). (ivar_decls): Remove assignment to $$. (ivar_decl): Rephrase in terms of component_decl; call objc_add_instance_variable(). (ivars, ivar_declarator): Remove nonterminals. (opt_semi): New nonterminal. (methodtype): Remove semantic actions. (methoddef): Move semantic actions to objc_set_method_type(), objc_start_method_definition() and objc_finish_method_definition(). (methodproto): Move semantic actions to objc_set_method_type() and objc_add_method_declaration(). (methoddecl): Use objc_typename instead of typename; move semantic actions to objc_build_method_signature(). (optarglist, myxdecls, mydecl, myparms, myparm): Remove nonterminals. (optparmlist): Express in terms of optparms and optellipsis. (optparms, optellipsis, objc_qual, objc_quals, objc_typename): New nonterminals. (keyworddecl): Use objc_typename instead of typename. (rid_to_yy): Mark RID_IN, RID_OUT, RID_INOUT, RID_BYCOPY, RID_BYREF and RID_ONEWAY as returning OBJC_TYPE_QUAL to yyparse(). [gcc/objc/ChangeLog] 2004-09-07 Ziemowit Laski <zlaski@apple.com> * Make-lang.in (objc/objc-parse.o): Depend on $(C_COMMON_H) instead of objc/objc-act.h. (objc/objc-act.o): Depend on $(HASHTAB_H). * objc-act.c: Include hashtab.h; in ObjC++ mode, include cp-tree.h and objcp-decl.h instead of c-tree.h. (build_module_descriptor, get_class_ivars, synth_id_with_class_suffix, error_with_ivar, gen_method_decl, gen_declaration, setup_string_decl, build_protocol_template): Adjust prototypes. (build_module_initializer_routine, start_class, continue_class, finish_class, start_method_def, objc_start_function, start_protocol, build_method_decl, objc_add_method, add_instance_variable, build_ivar_reference, is_ivar, is_private, get_super_receiver, build_selector_table_decl, objc_push_parm, objc_get_parm_info, gen_type_name, gen_type_name_0, start_var_decl, finish_var_decl, create_field_decl): New prototypes. (objc_expand_function_end, comp_method_with_proto, objc_expr_last, gen_declaration_1, gen_declarator, is_complex_decl, adorn_decl, define_decl, create_builtin_decl, gen_declspecs): Remove prototypes. (TYPE_ID): Rename to OBJECT_TYPEDEF_NAME. (CLASS_TYPEDEF_NAME): New. (TAG_EXECCLASS): Change from a global variable to a #define. (TAG_RETURN_STRUCT): Delete. (TAG_GNUINIT): New, holds '__objc_gnu_init' name. (objc_inherit_code, objc_public_flag): New, moved from c-parse.in. (string_descriptor): New struct. (string_htab): New hash table. (string_hash, string_eq): New prototypes. (generate_struct_by_value_array): Call create_field_decl() instead of create_builtin_decl(). (objc_init): Do not initialize objc_ellipsis_node or TAG_EXECCLASS; In ObjC++ mode, call cxx_init() instead of c_objc_common_init(). (objc_finish_file): In ObjC++, call instantiate_pending_templates() and cp_finish_file(). (define_decl, get_static_reference, get_protocol_reference, create_builtin_decl): Remove functions. (objc_start_class_interface, objc_start_category_interface, objc_start_protocol, objc_continue_interface, objc_finish_interface, objc_start_class_implementation, objc_start_category_implementation, objc_continue_implementation, objc_finish_implementation, objc_set_visibility, objc_set_method_type, objc_build_method_signature, objc_add_method_declaration, objc_start_method_definition, objc_add_instance_variable, objc_get_protocol_qualified_type, create_field_decl, start_var_decl, finish_var_decl): New functions. (setup_string_decl): Simplify since it is only called once. (synth_module_prologue): Call build_class_template(); predefine 'id' and 'Class' as typedefs; rename 'temp_type' to 'type'; disable debug hooks for duration of function; fix GNU runtime messenger signatures to correspond to reality; forward-declare '__objc_exec_class' for the GNU runtime; call build_selector_table_decl(); in ObjC++ mode, generate 'extern "C" { ... }' wrappers around synthesized declarations; call build_protocol_template() and build_category_template(). (string_hash, string_eq): New functions. (objc_build_string_object): Check metaclass correctness only once; store string literals in hash table. (objc_build_constructor): Do not convert initializer elements; adjust for ObjC++ impedance mismatch. (build_objc_symtab_template): Call create_field_decl() instead of create_builtin_decl(). (init_objc_symtab): Add missing conversion to initializer element. (build_metadata_decl): Call start_var_decl() instead of define_decl(). (generate_objc_symtab_decl): Do not call build_category_template(); call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(). (build_module_descriptor): Call create_field_decl() instead of grokfield(); call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(); always mark module descriptor as used; move GNU runtime-specific functionality to build_module_initializer_routine(). (build_module_initializer_routine): New function, broken off of build_module_descriptor(). (objc_static_init_needed_p, objc_generate_static_init_call): New functions. (generate_static_references, generate_strings, build_selector_translation_table, generate_descriptor_table, generate_ivars_list, generate_dispatch_table, generate_category): Call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(); build a type directly instead of via groktypename(). (build_selector_reference_decl, build_selector_table_decl, build_class_reference_decl, build_protocol_reference, generate_objc_image_info): Call start_var_decl() instead of build_decl(). (build_selector_reference): For GNU runtime, do not call build_selector_reference_decl(). (build_selector, build_typed_selector_reference): Always convert result to the selector type. (add_objc_string): Cast return value to 'char *'. (build_method_prototype_template, build_selector_template, build_method_template): Use actual selector type for fields pointing to selectors. (finish_objc): For GNU runtime, call build_module_initializer_routine() after build_module_descriptor(). (generate_protocol_list, generate_shared_structures): Call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(); build a type directly instead of via groktypename(). (synth_id_with_class_suffix): Return a string. (get_arg_type_list): For instance methods, use the instance type for 'self'; do not call groktypename_in_parm_context(). (build_objc_string_decl): Squash redeclaration errors in ObjC++. (objc_is_class_name): Use OBJC_TYPE_NAME instead of TYPE_NAME; handle RECORD_TYPEs in ObjC as well as ObjC++. (objc_is_id): New function. (objc_is_object_ptr): Return the canonical type node. (objc_get_class_ivars): Simplify using get_class_ivars(). (get_class_ivars): Remove second parameter; create a fresh copy of the ivar list for each call; do not check for existence of super class. (objc_eh_runtime_type): Mark #ifndef OBJCPLUS. (objc_init_exceptions): When using SJLJ-style exceptions, require the use of '-fobjc-exceptions' flag; do not require it for DWARF-style exceptions. (objc_build_exc_ptr, next_sjlj_build_try_catch_finally): Use objc_object_type instead of objc_id_type. (objc_begin_catch_clause): Convert the incoming PARM_DECL into a VAR_DECL before placing it in the appropriate scope; do not call define_decl(); adjust call to c_begin_compound_stmt(); use objc_object_type instead of objc_id_type. (build_next_objc_exception_stuff): Call create_field_decl() instead of create_builtin_decl(); construct type directly instead of calling groktypename(); use OBJC_VOID_AT_END to mark end of function parameters. (build_private_template): Adjust call to get_class_ivars(); build a type directly instead of via groktypename(). (build_protocol_template, build_method_prototype_list_template, build_method_prototype_template, build_category_template, build_selector_template, build_class_template, build_super_template, build_ivar_template, build_ivar_list_template, build_method_list_template, build_method_template): Call create_field_decl() instead of grokfield(). (objc_method_parm_type): Do not call groktypename(). (generate_descriptor_table): Call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(). (generate_method_descriptors, build_protocol_initializer, generate_dispatch_tables, build_category_initializer, build_shared_structure_initializer): Do not call groktypename(). (generate_protocols): Call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(); do not call groktypename(). (error_with_ivar): Remove last parameter. (check_ivars): Do not iterate ovar CLASS_RAW_IVARS lists in addition to CLASS_IVARS lists; adjust calls to error_with_ivar(). (generate_ivar_lists): Convert one of the initializer elements; do not call groktypename(). (get_arg_type_list, start_method_def, gen_method_def): Account for new representation of variable arguments and '...' in Objective-C methods; add Objective-C++ impedance matching code. (is_objc_type_qualifier): Remove function. (adjust_type_for_id_default): Simplify; there is no longer a need to wade through declspecs. (lookup_interface, start_class, continue_class, finish_class, start_method_def, start_protocol, build_method_decl, objc_add_method, add_instance_variable, build_ivar_reference, is_ivar, is_private, get_super_receiver, objc_build_finally_epilogue): Make into static functions. (receiver_is_class_object): Use new IS_CLASS() macro. (objc_build_message_expr): Tweak ObjC++ message argument handling; call objc_finish_message_expr() instead of finish_message_expr(). (finish_message_expr): Rename to objc_finish_message_expr(); use OBJC_TYPE_NAME and OBJC_SET_TYPE_NAME macros instead of TYPE_NAME. call gen_type_name() instead of gen_declaration(); call objc_is_id() instead of using IS_ID and IS_CLASS; Use objc_class_name instead of calling get_identifier("Class"); handle CONVERT_EXPRs in receiver. (build_objc_method_call, warn_with_method): Do not call groktypename(). (build_ivar_reference): Call convert() instead of clobbering in a type. (hash_init): Initialize string_htab hash table. (add_instance_variable): Simplify parameter list; do not call grokfield(); do not populate CLASS_IVARS list. (start_class): Check for the existence of super class, if one was specified. (continue_class): Use CLASS_RAW_IVARS rather than CLASS_IVARS; do not call build_class_template(); adjust call to get_class_ivars(); call build_decl(), pushdecl() and finish_decl() instead of define_decl(). (finish_class): Call build_decl(), pushdecl() and finish_decl() instead of define_decl(). (add_protocols): Use PROTOCOL_BINFO_ELTS for the tree vector size. (start_protocol): Do not call build_protocol_template(); use PROTOCOL_BINFO_ELTS for the tree vector size. (encode_type_qualifiers): Do not handle the 'const' qualifier here. (encode_pointer): Encode 'const char *' as 'r*', for backwards compatibility. (encode_array): Use HOST_WIDE_INT_PRINT_DEC instead of "%ld". (encode_type): Handle the 'const' qualifier here. (objc_parmlist): New global variable, sued by objc_push_parm and objc_get_parm_info(). (objc_push_parm, objc_get_parm_info): New functions. (objc_expr_last): Remove function. (synth_self_and_ucmd_args): For instance methods, use the instance type for 'self'; call objc_push_parm() instead of push_parm_decl(). (start_method_def): Do not call push_scope(), declare_parm_level(), pop_scope(), push_parm_decl(), store_parm_decls() or objc_expr_last(); just use objc_push_parm() and objc_get_parm_info(). (comp_method_with_proto): Remove function. (objc_types_are_equivalent): Strip away indirections before comparing underlying types. (comp_proto_with_proto): Do not call groktypename(); types are no longer in raw declspec format. (objc_start_function): New function. (really_start_method): Call comp_proto_with_proto() instead of comp_method_with_proto(); call objc_start_function() instead of hand-crafting a function declarator. (continue_method_def, objc_expand_function_end): Remove functions. (get_super_receiver): Call objc_get_current_scope() instead of get_current_scope(); reference 'super_class' field (instead of 'class'). (finish_method_def): Rename to objc_finish_method_definition() and add a function decl parameter; move method encoding call from objc_expand_function_end(). (is_complex_decl, adorn_decl, gen_declarator, gen_declspecs, gen_declaration_1): Remove functions. (tmpbuf, RAW_DECLSPEC): Remove. (gen_declaration): Remove second parameter; simplify to deal with TYPE_P nodes instead of raw declspecs. (gen_type_name, gen_type_name_0): New functions. (gen_method_decl): Remove second parameter; call gen_type_name() instead of gen_declaration_1(). (dump_interface): Adjust calls to gen_declaration() and gen_method_decl(); do not allocate a separate string buffer. (init_objc): Allocate a larger string buffer to accommodate dump_interface(); adjust call to build_module_descriptor(); add call to build_module_initializer_routine() for the GNU runtime. (generate_classref_translation_entry): Do not call start_decl(); call finish_var_decl() instead of finish_decl(); call convert() instead of build_c_cast(). * objc-act.h (CLASS_OWN_IVARS): Remove accessor. (CLASS_BINFO_ELTS): Reduce from 6 to 5, now that CLASS_OWN_IVARS is gone. (OCTI_GNU_INIT_DECL, GNU_INIT_decl): New. (OCTI_ELLIPSIS_NODE, objc_ellipsis_node): Remove. (OCTI_ID_ID, id_type, objc_id_id): Rename to OCTI_ID_NAME, objc_object_type and objc_object_name, respectively. (OCTI_CLS_REF, OCTI_CLASS_NAME, objc_class_reference, objc_class_name): New. (IS_CLASS): New macro. (IS_ID, IS_SUPER): Robustify. (OCTI_EXECCLASS_DECL, execclass_decl): New. (finish_file, start_class, continue_class, finish_class, start_method_def, continue_method_def, finish_method_def, start_protocol, finish_protocol, objc_build_throw_stmt, objc_build_try_catch_finally_stmt, objc_build_synchronized_prologue, objc_build_synchronized_epilogue, objc_build_try_prologue, objc_build_try_epilogue, objc_build_catch_stmt, objc_build_catch_epilogue, objc_build_finally_prologue, objc_build_finally_epilogue, is_ivar, is_private, is_public, add_instance_variable, objc_add_method, get_super_receiver, objc_clear_super_receiver, get_class_ivars_from_name, get_class_reference, get_static_reference, get_object_reference, build_message_expr, finish_message_expr, build_selector_expr, build_ivar_reference, build_keyword_decl, build_method_decl, build_protocol_expr, build_objc_string_object, objc_declare_alias, objc_declare_class, objc_declare_protocols, objc_comptypes, objc_check_decl, build_encode_expr): Remove prototypes. (imp_count, cat_count): Make GGC-aware. (OBJC_SET_TYPE_NAME): New macro. From-SVN: r87168
2004-09-08 02:49:44 +02:00
DECL_ARG_TYPE (parm)
= lang_hooks.types.type_promotes_to (TREE_TYPE (parm));
/* Record constancy and volatility. */
c_apply_type_quals_to_decl
((TYPE_READONLY (TREE_TYPE (parm)) ? TYPE_QUAL_CONST : 0)
| (TYPE_RESTRICT (TREE_TYPE (parm)) ? TYPE_QUAL_RESTRICT : 0)
| (TYPE_VOLATILE (TREE_TYPE (parm)) ? TYPE_QUAL_VOLATILE : 0), parm);
Makefile.in (c-parse.o): Depend on $(C_COMMON_H). [gcc/ChangeLog] 2004-09-07 Ziemowit Laski <zlaski@apple.com> * Makefile.in (c-parse.o): Depend on $(C_COMMON_H). * c-parse.in: Include c-common.h instead of objc-act.h. (ivar_decl_list, ivar_decls, ivar_decl, ivars, ivar_declarator, myparms, myparm): Remove %type declarations. (methodtype, optparms, OBJC_TYPE_QUAL, objc_quals, objc_qual, objc_typename, objc_try_catch_stmt, optellipsis): Add %type declarations. (objc_inherit_code, objc_public_flag): Remove. (typespec_nonreserved_nonattr): Call objc_get_protocol_qualified_type() instead of get_static_reference() and get_protocol_reference(). (stmt_nocomp): Call grokparm() on @catch parameter. (objcdef): Move semantic action to objc_finish_implementation(). (classdef): Move semantic action to objc_start_class_interface(), objc_continue_interface(), objc_finish_interface(), objc_start_class_implementation(), objc_continue_implementation(), objc_start_category_interface() and objc_start_category_implementation(). (protocoldef): Move semantic actions to objc_start_protocol() and objc_finish_interface(). (ivar_decl_list): Remove nonterminal. (visibility_spec): Move semantic actions to objc_set_visibility(). (ivar_decls): Remove assignment to $$. (ivar_decl): Rephrase in terms of component_decl; call objc_add_instance_variable(). (ivars, ivar_declarator): Remove nonterminals. (opt_semi): New nonterminal. (methodtype): Remove semantic actions. (methoddef): Move semantic actions to objc_set_method_type(), objc_start_method_definition() and objc_finish_method_definition(). (methodproto): Move semantic actions to objc_set_method_type() and objc_add_method_declaration(). (methoddecl): Use objc_typename instead of typename; move semantic actions to objc_build_method_signature(). (optarglist, myxdecls, mydecl, myparms, myparm): Remove nonterminals. (optparmlist): Express in terms of optparms and optellipsis. (optparms, optellipsis, objc_qual, objc_quals, objc_typename): New nonterminals. (keyworddecl): Use objc_typename instead of typename. (rid_to_yy): Mark RID_IN, RID_OUT, RID_INOUT, RID_BYCOPY, RID_BYREF and RID_ONEWAY as returning OBJC_TYPE_QUAL to yyparse(). [gcc/objc/ChangeLog] 2004-09-07 Ziemowit Laski <zlaski@apple.com> * Make-lang.in (objc/objc-parse.o): Depend on $(C_COMMON_H) instead of objc/objc-act.h. (objc/objc-act.o): Depend on $(HASHTAB_H). * objc-act.c: Include hashtab.h; in ObjC++ mode, include cp-tree.h and objcp-decl.h instead of c-tree.h. (build_module_descriptor, get_class_ivars, synth_id_with_class_suffix, error_with_ivar, gen_method_decl, gen_declaration, setup_string_decl, build_protocol_template): Adjust prototypes. (build_module_initializer_routine, start_class, continue_class, finish_class, start_method_def, objc_start_function, start_protocol, build_method_decl, objc_add_method, add_instance_variable, build_ivar_reference, is_ivar, is_private, get_super_receiver, build_selector_table_decl, objc_push_parm, objc_get_parm_info, gen_type_name, gen_type_name_0, start_var_decl, finish_var_decl, create_field_decl): New prototypes. (objc_expand_function_end, comp_method_with_proto, objc_expr_last, gen_declaration_1, gen_declarator, is_complex_decl, adorn_decl, define_decl, create_builtin_decl, gen_declspecs): Remove prototypes. (TYPE_ID): Rename to OBJECT_TYPEDEF_NAME. (CLASS_TYPEDEF_NAME): New. (TAG_EXECCLASS): Change from a global variable to a #define. (TAG_RETURN_STRUCT): Delete. (TAG_GNUINIT): New, holds '__objc_gnu_init' name. (objc_inherit_code, objc_public_flag): New, moved from c-parse.in. (string_descriptor): New struct. (string_htab): New hash table. (string_hash, string_eq): New prototypes. (generate_struct_by_value_array): Call create_field_decl() instead of create_builtin_decl(). (objc_init): Do not initialize objc_ellipsis_node or TAG_EXECCLASS; In ObjC++ mode, call cxx_init() instead of c_objc_common_init(). (objc_finish_file): In ObjC++, call instantiate_pending_templates() and cp_finish_file(). (define_decl, get_static_reference, get_protocol_reference, create_builtin_decl): Remove functions. (objc_start_class_interface, objc_start_category_interface, objc_start_protocol, objc_continue_interface, objc_finish_interface, objc_start_class_implementation, objc_start_category_implementation, objc_continue_implementation, objc_finish_implementation, objc_set_visibility, objc_set_method_type, objc_build_method_signature, objc_add_method_declaration, objc_start_method_definition, objc_add_instance_variable, objc_get_protocol_qualified_type, create_field_decl, start_var_decl, finish_var_decl): New functions. (setup_string_decl): Simplify since it is only called once. (synth_module_prologue): Call build_class_template(); predefine 'id' and 'Class' as typedefs; rename 'temp_type' to 'type'; disable debug hooks for duration of function; fix GNU runtime messenger signatures to correspond to reality; forward-declare '__objc_exec_class' for the GNU runtime; call build_selector_table_decl(); in ObjC++ mode, generate 'extern "C" { ... }' wrappers around synthesized declarations; call build_protocol_template() and build_category_template(). (string_hash, string_eq): New functions. (objc_build_string_object): Check metaclass correctness only once; store string literals in hash table. (objc_build_constructor): Do not convert initializer elements; adjust for ObjC++ impedance mismatch. (build_objc_symtab_template): Call create_field_decl() instead of create_builtin_decl(). (init_objc_symtab): Add missing conversion to initializer element. (build_metadata_decl): Call start_var_decl() instead of define_decl(). (generate_objc_symtab_decl): Do not call build_category_template(); call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(). (build_module_descriptor): Call create_field_decl() instead of grokfield(); call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(); always mark module descriptor as used; move GNU runtime-specific functionality to build_module_initializer_routine(). (build_module_initializer_routine): New function, broken off of build_module_descriptor(). (objc_static_init_needed_p, objc_generate_static_init_call): New functions. (generate_static_references, generate_strings, build_selector_translation_table, generate_descriptor_table, generate_ivars_list, generate_dispatch_table, generate_category): Call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(); build a type directly instead of via groktypename(). (build_selector_reference_decl, build_selector_table_decl, build_class_reference_decl, build_protocol_reference, generate_objc_image_info): Call start_var_decl() instead of build_decl(). (build_selector_reference): For GNU runtime, do not call build_selector_reference_decl(). (build_selector, build_typed_selector_reference): Always convert result to the selector type. (add_objc_string): Cast return value to 'char *'. (build_method_prototype_template, build_selector_template, build_method_template): Use actual selector type for fields pointing to selectors. (finish_objc): For GNU runtime, call build_module_initializer_routine() after build_module_descriptor(). (generate_protocol_list, generate_shared_structures): Call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(); build a type directly instead of via groktypename(). (synth_id_with_class_suffix): Return a string. (get_arg_type_list): For instance methods, use the instance type for 'self'; do not call groktypename_in_parm_context(). (build_objc_string_decl): Squash redeclaration errors in ObjC++. (objc_is_class_name): Use OBJC_TYPE_NAME instead of TYPE_NAME; handle RECORD_TYPEs in ObjC as well as ObjC++. (objc_is_id): New function. (objc_is_object_ptr): Return the canonical type node. (objc_get_class_ivars): Simplify using get_class_ivars(). (get_class_ivars): Remove second parameter; create a fresh copy of the ivar list for each call; do not check for existence of super class. (objc_eh_runtime_type): Mark #ifndef OBJCPLUS. (objc_init_exceptions): When using SJLJ-style exceptions, require the use of '-fobjc-exceptions' flag; do not require it for DWARF-style exceptions. (objc_build_exc_ptr, next_sjlj_build_try_catch_finally): Use objc_object_type instead of objc_id_type. (objc_begin_catch_clause): Convert the incoming PARM_DECL into a VAR_DECL before placing it in the appropriate scope; do not call define_decl(); adjust call to c_begin_compound_stmt(); use objc_object_type instead of objc_id_type. (build_next_objc_exception_stuff): Call create_field_decl() instead of create_builtin_decl(); construct type directly instead of calling groktypename(); use OBJC_VOID_AT_END to mark end of function parameters. (build_private_template): Adjust call to get_class_ivars(); build a type directly instead of via groktypename(). (build_protocol_template, build_method_prototype_list_template, build_method_prototype_template, build_category_template, build_selector_template, build_class_template, build_super_template, build_ivar_template, build_ivar_list_template, build_method_list_template, build_method_template): Call create_field_decl() instead of grokfield(). (objc_method_parm_type): Do not call groktypename(). (generate_descriptor_table): Call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(). (generate_method_descriptors, build_protocol_initializer, generate_dispatch_tables, build_category_initializer, build_shared_structure_initializer): Do not call groktypename(). (generate_protocols): Call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(); do not call groktypename(). (error_with_ivar): Remove last parameter. (check_ivars): Do not iterate ovar CLASS_RAW_IVARS lists in addition to CLASS_IVARS lists; adjust calls to error_with_ivar(). (generate_ivar_lists): Convert one of the initializer elements; do not call groktypename(). (get_arg_type_list, start_method_def, gen_method_def): Account for new representation of variable arguments and '...' in Objective-C methods; add Objective-C++ impedance matching code. (is_objc_type_qualifier): Remove function. (adjust_type_for_id_default): Simplify; there is no longer a need to wade through declspecs. (lookup_interface, start_class, continue_class, finish_class, start_method_def, start_protocol, build_method_decl, objc_add_method, add_instance_variable, build_ivar_reference, is_ivar, is_private, get_super_receiver, objc_build_finally_epilogue): Make into static functions. (receiver_is_class_object): Use new IS_CLASS() macro. (objc_build_message_expr): Tweak ObjC++ message argument handling; call objc_finish_message_expr() instead of finish_message_expr(). (finish_message_expr): Rename to objc_finish_message_expr(); use OBJC_TYPE_NAME and OBJC_SET_TYPE_NAME macros instead of TYPE_NAME. call gen_type_name() instead of gen_declaration(); call objc_is_id() instead of using IS_ID and IS_CLASS; Use objc_class_name instead of calling get_identifier("Class"); handle CONVERT_EXPRs in receiver. (build_objc_method_call, warn_with_method): Do not call groktypename(). (build_ivar_reference): Call convert() instead of clobbering in a type. (hash_init): Initialize string_htab hash table. (add_instance_variable): Simplify parameter list; do not call grokfield(); do not populate CLASS_IVARS list. (start_class): Check for the existence of super class, if one was specified. (continue_class): Use CLASS_RAW_IVARS rather than CLASS_IVARS; do not call build_class_template(); adjust call to get_class_ivars(); call build_decl(), pushdecl() and finish_decl() instead of define_decl(). (finish_class): Call build_decl(), pushdecl() and finish_decl() instead of define_decl(). (add_protocols): Use PROTOCOL_BINFO_ELTS for the tree vector size. (start_protocol): Do not call build_protocol_template(); use PROTOCOL_BINFO_ELTS for the tree vector size. (encode_type_qualifiers): Do not handle the 'const' qualifier here. (encode_pointer): Encode 'const char *' as 'r*', for backwards compatibility. (encode_array): Use HOST_WIDE_INT_PRINT_DEC instead of "%ld". (encode_type): Handle the 'const' qualifier here. (objc_parmlist): New global variable, sued by objc_push_parm and objc_get_parm_info(). (objc_push_parm, objc_get_parm_info): New functions. (objc_expr_last): Remove function. (synth_self_and_ucmd_args): For instance methods, use the instance type for 'self'; call objc_push_parm() instead of push_parm_decl(). (start_method_def): Do not call push_scope(), declare_parm_level(), pop_scope(), push_parm_decl(), store_parm_decls() or objc_expr_last(); just use objc_push_parm() and objc_get_parm_info(). (comp_method_with_proto): Remove function. (objc_types_are_equivalent): Strip away indirections before comparing underlying types. (comp_proto_with_proto): Do not call groktypename(); types are no longer in raw declspec format. (objc_start_function): New function. (really_start_method): Call comp_proto_with_proto() instead of comp_method_with_proto(); call objc_start_function() instead of hand-crafting a function declarator. (continue_method_def, objc_expand_function_end): Remove functions. (get_super_receiver): Call objc_get_current_scope() instead of get_current_scope(); reference 'super_class' field (instead of 'class'). (finish_method_def): Rename to objc_finish_method_definition() and add a function decl parameter; move method encoding call from objc_expand_function_end(). (is_complex_decl, adorn_decl, gen_declarator, gen_declspecs, gen_declaration_1): Remove functions. (tmpbuf, RAW_DECLSPEC): Remove. (gen_declaration): Remove second parameter; simplify to deal with TYPE_P nodes instead of raw declspecs. (gen_type_name, gen_type_name_0): New functions. (gen_method_decl): Remove second parameter; call gen_type_name() instead of gen_declaration_1(). (dump_interface): Adjust calls to gen_declaration() and gen_method_decl(); do not allocate a separate string buffer. (init_objc): Allocate a larger string buffer to accommodate dump_interface(); adjust call to build_module_descriptor(); add call to build_module_initializer_routine() for the GNU runtime. (generate_classref_translation_entry): Do not call start_decl(); call finish_var_decl() instead of finish_decl(); call convert() instead of build_c_cast(). * objc-act.h (CLASS_OWN_IVARS): Remove accessor. (CLASS_BINFO_ELTS): Reduce from 6 to 5, now that CLASS_OWN_IVARS is gone. (OCTI_GNU_INIT_DECL, GNU_INIT_decl): New. (OCTI_ELLIPSIS_NODE, objc_ellipsis_node): Remove. (OCTI_ID_ID, id_type, objc_id_id): Rename to OCTI_ID_NAME, objc_object_type and objc_object_name, respectively. (OCTI_CLS_REF, OCTI_CLASS_NAME, objc_class_reference, objc_class_name): New. (IS_CLASS): New macro. (IS_ID, IS_SUPER): Robustify. (OCTI_EXECCLASS_DECL, execclass_decl): New. (finish_file, start_class, continue_class, finish_class, start_method_def, continue_method_def, finish_method_def, start_protocol, finish_protocol, objc_build_throw_stmt, objc_build_try_catch_finally_stmt, objc_build_synchronized_prologue, objc_build_synchronized_epilogue, objc_build_try_prologue, objc_build_try_epilogue, objc_build_catch_stmt, objc_build_catch_epilogue, objc_build_finally_prologue, objc_build_finally_epilogue, is_ivar, is_private, is_public, add_instance_variable, objc_add_method, get_super_receiver, objc_clear_super_receiver, get_class_ivars_from_name, get_class_reference, get_static_reference, get_object_reference, build_message_expr, finish_message_expr, build_selector_expr, build_ivar_reference, build_keyword_decl, build_method_decl, build_protocol_expr, build_objc_string_object, objc_declare_alias, objc_declare_class, objc_declare_protocols, objc_comptypes, objc_check_decl, build_encode_expr): Remove prototypes. (imp_count, cat_count): Make GGC-aware. (OBJC_SET_TYPE_NAME): New macro. From-SVN: r87168
2004-09-08 02:49:44 +02:00
objc_parmlist = chainon (objc_parmlist, parm);
}
/* Retrieve the formal parameter list constructed via preceding calls to
Makefile.in (c-parse.o): Depend on $(C_COMMON_H). [gcc/ChangeLog] 2004-09-07 Ziemowit Laski <zlaski@apple.com> * Makefile.in (c-parse.o): Depend on $(C_COMMON_H). * c-parse.in: Include c-common.h instead of objc-act.h. (ivar_decl_list, ivar_decls, ivar_decl, ivars, ivar_declarator, myparms, myparm): Remove %type declarations. (methodtype, optparms, OBJC_TYPE_QUAL, objc_quals, objc_qual, objc_typename, objc_try_catch_stmt, optellipsis): Add %type declarations. (objc_inherit_code, objc_public_flag): Remove. (typespec_nonreserved_nonattr): Call objc_get_protocol_qualified_type() instead of get_static_reference() and get_protocol_reference(). (stmt_nocomp): Call grokparm() on @catch parameter. (objcdef): Move semantic action to objc_finish_implementation(). (classdef): Move semantic action to objc_start_class_interface(), objc_continue_interface(), objc_finish_interface(), objc_start_class_implementation(), objc_continue_implementation(), objc_start_category_interface() and objc_start_category_implementation(). (protocoldef): Move semantic actions to objc_start_protocol() and objc_finish_interface(). (ivar_decl_list): Remove nonterminal. (visibility_spec): Move semantic actions to objc_set_visibility(). (ivar_decls): Remove assignment to $$. (ivar_decl): Rephrase in terms of component_decl; call objc_add_instance_variable(). (ivars, ivar_declarator): Remove nonterminals. (opt_semi): New nonterminal. (methodtype): Remove semantic actions. (methoddef): Move semantic actions to objc_set_method_type(), objc_start_method_definition() and objc_finish_method_definition(). (methodproto): Move semantic actions to objc_set_method_type() and objc_add_method_declaration(). (methoddecl): Use objc_typename instead of typename; move semantic actions to objc_build_method_signature(). (optarglist, myxdecls, mydecl, myparms, myparm): Remove nonterminals. (optparmlist): Express in terms of optparms and optellipsis. (optparms, optellipsis, objc_qual, objc_quals, objc_typename): New nonterminals. (keyworddecl): Use objc_typename instead of typename. (rid_to_yy): Mark RID_IN, RID_OUT, RID_INOUT, RID_BYCOPY, RID_BYREF and RID_ONEWAY as returning OBJC_TYPE_QUAL to yyparse(). [gcc/objc/ChangeLog] 2004-09-07 Ziemowit Laski <zlaski@apple.com> * Make-lang.in (objc/objc-parse.o): Depend on $(C_COMMON_H) instead of objc/objc-act.h. (objc/objc-act.o): Depend on $(HASHTAB_H). * objc-act.c: Include hashtab.h; in ObjC++ mode, include cp-tree.h and objcp-decl.h instead of c-tree.h. (build_module_descriptor, get_class_ivars, synth_id_with_class_suffix, error_with_ivar, gen_method_decl, gen_declaration, setup_string_decl, build_protocol_template): Adjust prototypes. (build_module_initializer_routine, start_class, continue_class, finish_class, start_method_def, objc_start_function, start_protocol, build_method_decl, objc_add_method, add_instance_variable, build_ivar_reference, is_ivar, is_private, get_super_receiver, build_selector_table_decl, objc_push_parm, objc_get_parm_info, gen_type_name, gen_type_name_0, start_var_decl, finish_var_decl, create_field_decl): New prototypes. (objc_expand_function_end, comp_method_with_proto, objc_expr_last, gen_declaration_1, gen_declarator, is_complex_decl, adorn_decl, define_decl, create_builtin_decl, gen_declspecs): Remove prototypes. (TYPE_ID): Rename to OBJECT_TYPEDEF_NAME. (CLASS_TYPEDEF_NAME): New. (TAG_EXECCLASS): Change from a global variable to a #define. (TAG_RETURN_STRUCT): Delete. (TAG_GNUINIT): New, holds '__objc_gnu_init' name. (objc_inherit_code, objc_public_flag): New, moved from c-parse.in. (string_descriptor): New struct. (string_htab): New hash table. (string_hash, string_eq): New prototypes. (generate_struct_by_value_array): Call create_field_decl() instead of create_builtin_decl(). (objc_init): Do not initialize objc_ellipsis_node or TAG_EXECCLASS; In ObjC++ mode, call cxx_init() instead of c_objc_common_init(). (objc_finish_file): In ObjC++, call instantiate_pending_templates() and cp_finish_file(). (define_decl, get_static_reference, get_protocol_reference, create_builtin_decl): Remove functions. (objc_start_class_interface, objc_start_category_interface, objc_start_protocol, objc_continue_interface, objc_finish_interface, objc_start_class_implementation, objc_start_category_implementation, objc_continue_implementation, objc_finish_implementation, objc_set_visibility, objc_set_method_type, objc_build_method_signature, objc_add_method_declaration, objc_start_method_definition, objc_add_instance_variable, objc_get_protocol_qualified_type, create_field_decl, start_var_decl, finish_var_decl): New functions. (setup_string_decl): Simplify since it is only called once. (synth_module_prologue): Call build_class_template(); predefine 'id' and 'Class' as typedefs; rename 'temp_type' to 'type'; disable debug hooks for duration of function; fix GNU runtime messenger signatures to correspond to reality; forward-declare '__objc_exec_class' for the GNU runtime; call build_selector_table_decl(); in ObjC++ mode, generate 'extern "C" { ... }' wrappers around synthesized declarations; call build_protocol_template() and build_category_template(). (string_hash, string_eq): New functions. (objc_build_string_object): Check metaclass correctness only once; store string literals in hash table. (objc_build_constructor): Do not convert initializer elements; adjust for ObjC++ impedance mismatch. (build_objc_symtab_template): Call create_field_decl() instead of create_builtin_decl(). (init_objc_symtab): Add missing conversion to initializer element. (build_metadata_decl): Call start_var_decl() instead of define_decl(). (generate_objc_symtab_decl): Do not call build_category_template(); call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(). (build_module_descriptor): Call create_field_decl() instead of grokfield(); call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(); always mark module descriptor as used; move GNU runtime-specific functionality to build_module_initializer_routine(). (build_module_initializer_routine): New function, broken off of build_module_descriptor(). (objc_static_init_needed_p, objc_generate_static_init_call): New functions. (generate_static_references, generate_strings, build_selector_translation_table, generate_descriptor_table, generate_ivars_list, generate_dispatch_table, generate_category): Call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(); build a type directly instead of via groktypename(). (build_selector_reference_decl, build_selector_table_decl, build_class_reference_decl, build_protocol_reference, generate_objc_image_info): Call start_var_decl() instead of build_decl(). (build_selector_reference): For GNU runtime, do not call build_selector_reference_decl(). (build_selector, build_typed_selector_reference): Always convert result to the selector type. (add_objc_string): Cast return value to 'char *'. (build_method_prototype_template, build_selector_template, build_method_template): Use actual selector type for fields pointing to selectors. (finish_objc): For GNU runtime, call build_module_initializer_routine() after build_module_descriptor(). (generate_protocol_list, generate_shared_structures): Call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(); build a type directly instead of via groktypename(). (synth_id_with_class_suffix): Return a string. (get_arg_type_list): For instance methods, use the instance type for 'self'; do not call groktypename_in_parm_context(). (build_objc_string_decl): Squash redeclaration errors in ObjC++. (objc_is_class_name): Use OBJC_TYPE_NAME instead of TYPE_NAME; handle RECORD_TYPEs in ObjC as well as ObjC++. (objc_is_id): New function. (objc_is_object_ptr): Return the canonical type node. (objc_get_class_ivars): Simplify using get_class_ivars(). (get_class_ivars): Remove second parameter; create a fresh copy of the ivar list for each call; do not check for existence of super class. (objc_eh_runtime_type): Mark #ifndef OBJCPLUS. (objc_init_exceptions): When using SJLJ-style exceptions, require the use of '-fobjc-exceptions' flag; do not require it for DWARF-style exceptions. (objc_build_exc_ptr, next_sjlj_build_try_catch_finally): Use objc_object_type instead of objc_id_type. (objc_begin_catch_clause): Convert the incoming PARM_DECL into a VAR_DECL before placing it in the appropriate scope; do not call define_decl(); adjust call to c_begin_compound_stmt(); use objc_object_type instead of objc_id_type. (build_next_objc_exception_stuff): Call create_field_decl() instead of create_builtin_decl(); construct type directly instead of calling groktypename(); use OBJC_VOID_AT_END to mark end of function parameters. (build_private_template): Adjust call to get_class_ivars(); build a type directly instead of via groktypename(). (build_protocol_template, build_method_prototype_list_template, build_method_prototype_template, build_category_template, build_selector_template, build_class_template, build_super_template, build_ivar_template, build_ivar_list_template, build_method_list_template, build_method_template): Call create_field_decl() instead of grokfield(). (objc_method_parm_type): Do not call groktypename(). (generate_descriptor_table): Call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(). (generate_method_descriptors, build_protocol_initializer, generate_dispatch_tables, build_category_initializer, build_shared_structure_initializer): Do not call groktypename(). (generate_protocols): Call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(); do not call groktypename(). (error_with_ivar): Remove last parameter. (check_ivars): Do not iterate ovar CLASS_RAW_IVARS lists in addition to CLASS_IVARS lists; adjust calls to error_with_ivar(). (generate_ivar_lists): Convert one of the initializer elements; do not call groktypename(). (get_arg_type_list, start_method_def, gen_method_def): Account for new representation of variable arguments and '...' in Objective-C methods; add Objective-C++ impedance matching code. (is_objc_type_qualifier): Remove function. (adjust_type_for_id_default): Simplify; there is no longer a need to wade through declspecs. (lookup_interface, start_class, continue_class, finish_class, start_method_def, start_protocol, build_method_decl, objc_add_method, add_instance_variable, build_ivar_reference, is_ivar, is_private, get_super_receiver, objc_build_finally_epilogue): Make into static functions. (receiver_is_class_object): Use new IS_CLASS() macro. (objc_build_message_expr): Tweak ObjC++ message argument handling; call objc_finish_message_expr() instead of finish_message_expr(). (finish_message_expr): Rename to objc_finish_message_expr(); use OBJC_TYPE_NAME and OBJC_SET_TYPE_NAME macros instead of TYPE_NAME. call gen_type_name() instead of gen_declaration(); call objc_is_id() instead of using IS_ID and IS_CLASS; Use objc_class_name instead of calling get_identifier("Class"); handle CONVERT_EXPRs in receiver. (build_objc_method_call, warn_with_method): Do not call groktypename(). (build_ivar_reference): Call convert() instead of clobbering in a type. (hash_init): Initialize string_htab hash table. (add_instance_variable): Simplify parameter list; do not call grokfield(); do not populate CLASS_IVARS list. (start_class): Check for the existence of super class, if one was specified. (continue_class): Use CLASS_RAW_IVARS rather than CLASS_IVARS; do not call build_class_template(); adjust call to get_class_ivars(); call build_decl(), pushdecl() and finish_decl() instead of define_decl(). (finish_class): Call build_decl(), pushdecl() and finish_decl() instead of define_decl(). (add_protocols): Use PROTOCOL_BINFO_ELTS for the tree vector size. (start_protocol): Do not call build_protocol_template(); use PROTOCOL_BINFO_ELTS for the tree vector size. (encode_type_qualifiers): Do not handle the 'const' qualifier here. (encode_pointer): Encode 'const char *' as 'r*', for backwards compatibility. (encode_array): Use HOST_WIDE_INT_PRINT_DEC instead of "%ld". (encode_type): Handle the 'const' qualifier here. (objc_parmlist): New global variable, sued by objc_push_parm and objc_get_parm_info(). (objc_push_parm, objc_get_parm_info): New functions. (objc_expr_last): Remove function. (synth_self_and_ucmd_args): For instance methods, use the instance type for 'self'; call objc_push_parm() instead of push_parm_decl(). (start_method_def): Do not call push_scope(), declare_parm_level(), pop_scope(), push_parm_decl(), store_parm_decls() or objc_expr_last(); just use objc_push_parm() and objc_get_parm_info(). (comp_method_with_proto): Remove function. (objc_types_are_equivalent): Strip away indirections before comparing underlying types. (comp_proto_with_proto): Do not call groktypename(); types are no longer in raw declspec format. (objc_start_function): New function. (really_start_method): Call comp_proto_with_proto() instead of comp_method_with_proto(); call objc_start_function() instead of hand-crafting a function declarator. (continue_method_def, objc_expand_function_end): Remove functions. (get_super_receiver): Call objc_get_current_scope() instead of get_current_scope(); reference 'super_class' field (instead of 'class'). (finish_method_def): Rename to objc_finish_method_definition() and add a function decl parameter; move method encoding call from objc_expand_function_end(). (is_complex_decl, adorn_decl, gen_declarator, gen_declspecs, gen_declaration_1): Remove functions. (tmpbuf, RAW_DECLSPEC): Remove. (gen_declaration): Remove second parameter; simplify to deal with TYPE_P nodes instead of raw declspecs. (gen_type_name, gen_type_name_0): New functions. (gen_method_decl): Remove second parameter; call gen_type_name() instead of gen_declaration_1(). (dump_interface): Adjust calls to gen_declaration() and gen_method_decl(); do not allocate a separate string buffer. (init_objc): Allocate a larger string buffer to accommodate dump_interface(); adjust call to build_module_descriptor(); add call to build_module_initializer_routine() for the GNU runtime. (generate_classref_translation_entry): Do not call start_decl(); call finish_var_decl() instead of finish_decl(); call convert() instead of build_c_cast(). * objc-act.h (CLASS_OWN_IVARS): Remove accessor. (CLASS_BINFO_ELTS): Reduce from 6 to 5, now that CLASS_OWN_IVARS is gone. (OCTI_GNU_INIT_DECL, GNU_INIT_decl): New. (OCTI_ELLIPSIS_NODE, objc_ellipsis_node): Remove. (OCTI_ID_ID, id_type, objc_id_id): Rename to OCTI_ID_NAME, objc_object_type and objc_object_name, respectively. (OCTI_CLS_REF, OCTI_CLASS_NAME, objc_class_reference, objc_class_name): New. (IS_CLASS): New macro. (IS_ID, IS_SUPER): Robustify. (OCTI_EXECCLASS_DECL, execclass_decl): New. (finish_file, start_class, continue_class, finish_class, start_method_def, continue_method_def, finish_method_def, start_protocol, finish_protocol, objc_build_throw_stmt, objc_build_try_catch_finally_stmt, objc_build_synchronized_prologue, objc_build_synchronized_epilogue, objc_build_try_prologue, objc_build_try_epilogue, objc_build_catch_stmt, objc_build_catch_epilogue, objc_build_finally_prologue, objc_build_finally_epilogue, is_ivar, is_private, is_public, add_instance_variable, objc_add_method, get_super_receiver, objc_clear_super_receiver, get_class_ivars_from_name, get_class_reference, get_static_reference, get_object_reference, build_message_expr, finish_message_expr, build_selector_expr, build_ivar_reference, build_keyword_decl, build_method_decl, build_protocol_expr, build_objc_string_object, objc_declare_alias, objc_declare_class, objc_declare_protocols, objc_comptypes, objc_check_decl, build_encode_expr): Remove prototypes. (imp_count, cat_count): Make GGC-aware. (OBJC_SET_TYPE_NAME): New macro. From-SVN: r87168
2004-09-08 02:49:44 +02:00
objc_push_parm(). */
#ifdef OBJCPLUS
c-tree.h (enum c_declarator_kind, [...]): New. * c-tree.h (enum c_declarator_kind, struct c_arg_info, struct c_declarator, struct c_type_name, struct c_parm): New. (build_array_declarator, set_array_declarator_inner, get_parm_info, grokfield, groktypename, grokparm, push_parm_decl, start_function, start_decl, build_c_parm, build_attrs_declarator, build_function_declarator, make_pointer_declarator, c_cast_expr, store_parm_decls_newstyle, c_expr_sizeof_type): Update prototypes. (build_id_declarator): New. * c-typeck.c (c_cast_expr, c_expr_sizeof_type): Update to new structures. * c-decl.c (ARG_INFO_PARMS, ARG_INFO_TAGS, ARG_INFO_TYPES, ARG_INFO_OTHERS): Remove. (build_id_declarator): New. (build_array_declarator, set_array_declarator_inner, groktypename, start_decl, grokparm, push_parm_decl, grokparms, get_parm_info, grokfield, start_function, store_parm_decls_newstyle, store_parm_decls_oldstyle, store_parm_decls, build_c_parm, build_attrs_declarator, build_function_declarator, make_pointer_declarator, grokdeclarator): Update to new structures. * c-parse.in (%union): Add arginfotype, dtrtype, typenametype and parmtype. (declarator, notype_declarator, after_type_declarator, parm_declarator, parm_declarator_starttypename, parm_declarator_nostarttypename, array_declarator, typename, absdcl, absdcl1, absdcl1_ea, absdcl1_noea, direct_absdcl1, absdcl_maybe_attribute, parm, firstparm, parms, parmlist, parmlist_1, parmlist_2, parmlist_or_identifiers, parmlist_or_identifiers_1): Use these types. (primary, after_type_declarator, parm_declarator_starttypename, notype_declarator, component_decl, component_declarator, component_notype_declarator, typename, absdcl, absdcl_maybe_attribute, absdcl1_ea, direct_absdcl1, parmlist_1, parmlist_2, parmlist_or_identifiers_1): Update to new structures. objc: * objc-act.c (objc_start_function, really_start_method, objc_get_parm_info, start_method_def): Update to new arg_info structures. From-SVN: r87217
2004-09-09 03:19:15 +02:00
static tree
Makefile.in (c-parse.o): Depend on $(C_COMMON_H). [gcc/ChangeLog] 2004-09-07 Ziemowit Laski <zlaski@apple.com> * Makefile.in (c-parse.o): Depend on $(C_COMMON_H). * c-parse.in: Include c-common.h instead of objc-act.h. (ivar_decl_list, ivar_decls, ivar_decl, ivars, ivar_declarator, myparms, myparm): Remove %type declarations. (methodtype, optparms, OBJC_TYPE_QUAL, objc_quals, objc_qual, objc_typename, objc_try_catch_stmt, optellipsis): Add %type declarations. (objc_inherit_code, objc_public_flag): Remove. (typespec_nonreserved_nonattr): Call objc_get_protocol_qualified_type() instead of get_static_reference() and get_protocol_reference(). (stmt_nocomp): Call grokparm() on @catch parameter. (objcdef): Move semantic action to objc_finish_implementation(). (classdef): Move semantic action to objc_start_class_interface(), objc_continue_interface(), objc_finish_interface(), objc_start_class_implementation(), objc_continue_implementation(), objc_start_category_interface() and objc_start_category_implementation(). (protocoldef): Move semantic actions to objc_start_protocol() and objc_finish_interface(). (ivar_decl_list): Remove nonterminal. (visibility_spec): Move semantic actions to objc_set_visibility(). (ivar_decls): Remove assignment to $$. (ivar_decl): Rephrase in terms of component_decl; call objc_add_instance_variable(). (ivars, ivar_declarator): Remove nonterminals. (opt_semi): New nonterminal. (methodtype): Remove semantic actions. (methoddef): Move semantic actions to objc_set_method_type(), objc_start_method_definition() and objc_finish_method_definition(). (methodproto): Move semantic actions to objc_set_method_type() and objc_add_method_declaration(). (methoddecl): Use objc_typename instead of typename; move semantic actions to objc_build_method_signature(). (optarglist, myxdecls, mydecl, myparms, myparm): Remove nonterminals. (optparmlist): Express in terms of optparms and optellipsis. (optparms, optellipsis, objc_qual, objc_quals, objc_typename): New nonterminals. (keyworddecl): Use objc_typename instead of typename. (rid_to_yy): Mark RID_IN, RID_OUT, RID_INOUT, RID_BYCOPY, RID_BYREF and RID_ONEWAY as returning OBJC_TYPE_QUAL to yyparse(). [gcc/objc/ChangeLog] 2004-09-07 Ziemowit Laski <zlaski@apple.com> * Make-lang.in (objc/objc-parse.o): Depend on $(C_COMMON_H) instead of objc/objc-act.h. (objc/objc-act.o): Depend on $(HASHTAB_H). * objc-act.c: Include hashtab.h; in ObjC++ mode, include cp-tree.h and objcp-decl.h instead of c-tree.h. (build_module_descriptor, get_class_ivars, synth_id_with_class_suffix, error_with_ivar, gen_method_decl, gen_declaration, setup_string_decl, build_protocol_template): Adjust prototypes. (build_module_initializer_routine, start_class, continue_class, finish_class, start_method_def, objc_start_function, start_protocol, build_method_decl, objc_add_method, add_instance_variable, build_ivar_reference, is_ivar, is_private, get_super_receiver, build_selector_table_decl, objc_push_parm, objc_get_parm_info, gen_type_name, gen_type_name_0, start_var_decl, finish_var_decl, create_field_decl): New prototypes. (objc_expand_function_end, comp_method_with_proto, objc_expr_last, gen_declaration_1, gen_declarator, is_complex_decl, adorn_decl, define_decl, create_builtin_decl, gen_declspecs): Remove prototypes. (TYPE_ID): Rename to OBJECT_TYPEDEF_NAME. (CLASS_TYPEDEF_NAME): New. (TAG_EXECCLASS): Change from a global variable to a #define. (TAG_RETURN_STRUCT): Delete. (TAG_GNUINIT): New, holds '__objc_gnu_init' name. (objc_inherit_code, objc_public_flag): New, moved from c-parse.in. (string_descriptor): New struct. (string_htab): New hash table. (string_hash, string_eq): New prototypes. (generate_struct_by_value_array): Call create_field_decl() instead of create_builtin_decl(). (objc_init): Do not initialize objc_ellipsis_node or TAG_EXECCLASS; In ObjC++ mode, call cxx_init() instead of c_objc_common_init(). (objc_finish_file): In ObjC++, call instantiate_pending_templates() and cp_finish_file(). (define_decl, get_static_reference, get_protocol_reference, create_builtin_decl): Remove functions. (objc_start_class_interface, objc_start_category_interface, objc_start_protocol, objc_continue_interface, objc_finish_interface, objc_start_class_implementation, objc_start_category_implementation, objc_continue_implementation, objc_finish_implementation, objc_set_visibility, objc_set_method_type, objc_build_method_signature, objc_add_method_declaration, objc_start_method_definition, objc_add_instance_variable, objc_get_protocol_qualified_type, create_field_decl, start_var_decl, finish_var_decl): New functions. (setup_string_decl): Simplify since it is only called once. (synth_module_prologue): Call build_class_template(); predefine 'id' and 'Class' as typedefs; rename 'temp_type' to 'type'; disable debug hooks for duration of function; fix GNU runtime messenger signatures to correspond to reality; forward-declare '__objc_exec_class' for the GNU runtime; call build_selector_table_decl(); in ObjC++ mode, generate 'extern "C" { ... }' wrappers around synthesized declarations; call build_protocol_template() and build_category_template(). (string_hash, string_eq): New functions. (objc_build_string_object): Check metaclass correctness only once; store string literals in hash table. (objc_build_constructor): Do not convert initializer elements; adjust for ObjC++ impedance mismatch. (build_objc_symtab_template): Call create_field_decl() instead of create_builtin_decl(). (init_objc_symtab): Add missing conversion to initializer element. (build_metadata_decl): Call start_var_decl() instead of define_decl(). (generate_objc_symtab_decl): Do not call build_category_template(); call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(). (build_module_descriptor): Call create_field_decl() instead of grokfield(); call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(); always mark module descriptor as used; move GNU runtime-specific functionality to build_module_initializer_routine(). (build_module_initializer_routine): New function, broken off of build_module_descriptor(). (objc_static_init_needed_p, objc_generate_static_init_call): New functions. (generate_static_references, generate_strings, build_selector_translation_table, generate_descriptor_table, generate_ivars_list, generate_dispatch_table, generate_category): Call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(); build a type directly instead of via groktypename(). (build_selector_reference_decl, build_selector_table_decl, build_class_reference_decl, build_protocol_reference, generate_objc_image_info): Call start_var_decl() instead of build_decl(). (build_selector_reference): For GNU runtime, do not call build_selector_reference_decl(). (build_selector, build_typed_selector_reference): Always convert result to the selector type. (add_objc_string): Cast return value to 'char *'. (build_method_prototype_template, build_selector_template, build_method_template): Use actual selector type for fields pointing to selectors. (finish_objc): For GNU runtime, call build_module_initializer_routine() after build_module_descriptor(). (generate_protocol_list, generate_shared_structures): Call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(); build a type directly instead of via groktypename(). (synth_id_with_class_suffix): Return a string. (get_arg_type_list): For instance methods, use the instance type for 'self'; do not call groktypename_in_parm_context(). (build_objc_string_decl): Squash redeclaration errors in ObjC++. (objc_is_class_name): Use OBJC_TYPE_NAME instead of TYPE_NAME; handle RECORD_TYPEs in ObjC as well as ObjC++. (objc_is_id): New function. (objc_is_object_ptr): Return the canonical type node. (objc_get_class_ivars): Simplify using get_class_ivars(). (get_class_ivars): Remove second parameter; create a fresh copy of the ivar list for each call; do not check for existence of super class. (objc_eh_runtime_type): Mark #ifndef OBJCPLUS. (objc_init_exceptions): When using SJLJ-style exceptions, require the use of '-fobjc-exceptions' flag; do not require it for DWARF-style exceptions. (objc_build_exc_ptr, next_sjlj_build_try_catch_finally): Use objc_object_type instead of objc_id_type. (objc_begin_catch_clause): Convert the incoming PARM_DECL into a VAR_DECL before placing it in the appropriate scope; do not call define_decl(); adjust call to c_begin_compound_stmt(); use objc_object_type instead of objc_id_type. (build_next_objc_exception_stuff): Call create_field_decl() instead of create_builtin_decl(); construct type directly instead of calling groktypename(); use OBJC_VOID_AT_END to mark end of function parameters. (build_private_template): Adjust call to get_class_ivars(); build a type directly instead of via groktypename(). (build_protocol_template, build_method_prototype_list_template, build_method_prototype_template, build_category_template, build_selector_template, build_class_template, build_super_template, build_ivar_template, build_ivar_list_template, build_method_list_template, build_method_template): Call create_field_decl() instead of grokfield(). (objc_method_parm_type): Do not call groktypename(). (generate_descriptor_table): Call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(). (generate_method_descriptors, build_protocol_initializer, generate_dispatch_tables, build_category_initializer, build_shared_structure_initializer): Do not call groktypename(). (generate_protocols): Call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(); do not call groktypename(). (error_with_ivar): Remove last parameter. (check_ivars): Do not iterate ovar CLASS_RAW_IVARS lists in addition to CLASS_IVARS lists; adjust calls to error_with_ivar(). (generate_ivar_lists): Convert one of the initializer elements; do not call groktypename(). (get_arg_type_list, start_method_def, gen_method_def): Account for new representation of variable arguments and '...' in Objective-C methods; add Objective-C++ impedance matching code. (is_objc_type_qualifier): Remove function. (adjust_type_for_id_default): Simplify; there is no longer a need to wade through declspecs. (lookup_interface, start_class, continue_class, finish_class, start_method_def, start_protocol, build_method_decl, objc_add_method, add_instance_variable, build_ivar_reference, is_ivar, is_private, get_super_receiver, objc_build_finally_epilogue): Make into static functions. (receiver_is_class_object): Use new IS_CLASS() macro. (objc_build_message_expr): Tweak ObjC++ message argument handling; call objc_finish_message_expr() instead of finish_message_expr(). (finish_message_expr): Rename to objc_finish_message_expr(); use OBJC_TYPE_NAME and OBJC_SET_TYPE_NAME macros instead of TYPE_NAME. call gen_type_name() instead of gen_declaration(); call objc_is_id() instead of using IS_ID and IS_CLASS; Use objc_class_name instead of calling get_identifier("Class"); handle CONVERT_EXPRs in receiver. (build_objc_method_call, warn_with_method): Do not call groktypename(). (build_ivar_reference): Call convert() instead of clobbering in a type. (hash_init): Initialize string_htab hash table. (add_instance_variable): Simplify parameter list; do not call grokfield(); do not populate CLASS_IVARS list. (start_class): Check for the existence of super class, if one was specified. (continue_class): Use CLASS_RAW_IVARS rather than CLASS_IVARS; do not call build_class_template(); adjust call to get_class_ivars(); call build_decl(), pushdecl() and finish_decl() instead of define_decl(). (finish_class): Call build_decl(), pushdecl() and finish_decl() instead of define_decl(). (add_protocols): Use PROTOCOL_BINFO_ELTS for the tree vector size. (start_protocol): Do not call build_protocol_template(); use PROTOCOL_BINFO_ELTS for the tree vector size. (encode_type_qualifiers): Do not handle the 'const' qualifier here. (encode_pointer): Encode 'const char *' as 'r*', for backwards compatibility. (encode_array): Use HOST_WIDE_INT_PRINT_DEC instead of "%ld". (encode_type): Handle the 'const' qualifier here. (objc_parmlist): New global variable, sued by objc_push_parm and objc_get_parm_info(). (objc_push_parm, objc_get_parm_info): New functions. (objc_expr_last): Remove function. (synth_self_and_ucmd_args): For instance methods, use the instance type for 'self'; call objc_push_parm() instead of push_parm_decl(). (start_method_def): Do not call push_scope(), declare_parm_level(), pop_scope(), push_parm_decl(), store_parm_decls() or objc_expr_last(); just use objc_push_parm() and objc_get_parm_info(). (comp_method_with_proto): Remove function. (objc_types_are_equivalent): Strip away indirections before comparing underlying types. (comp_proto_with_proto): Do not call groktypename(); types are no longer in raw declspec format. (objc_start_function): New function. (really_start_method): Call comp_proto_with_proto() instead of comp_method_with_proto(); call objc_start_function() instead of hand-crafting a function declarator. (continue_method_def, objc_expand_function_end): Remove functions. (get_super_receiver): Call objc_get_current_scope() instead of get_current_scope(); reference 'super_class' field (instead of 'class'). (finish_method_def): Rename to objc_finish_method_definition() and add a function decl parameter; move method encoding call from objc_expand_function_end(). (is_complex_decl, adorn_decl, gen_declarator, gen_declspecs, gen_declaration_1): Remove functions. (tmpbuf, RAW_DECLSPEC): Remove. (gen_declaration): Remove second parameter; simplify to deal with TYPE_P nodes instead of raw declspecs. (gen_type_name, gen_type_name_0): New functions. (gen_method_decl): Remove second parameter; call gen_type_name() instead of gen_declaration_1(). (dump_interface): Adjust calls to gen_declaration() and gen_method_decl(); do not allocate a separate string buffer. (init_objc): Allocate a larger string buffer to accommodate dump_interface(); adjust call to build_module_descriptor(); add call to build_module_initializer_routine() for the GNU runtime. (generate_classref_translation_entry): Do not call start_decl(); call finish_var_decl() instead of finish_decl(); call convert() instead of build_c_cast(). * objc-act.h (CLASS_OWN_IVARS): Remove accessor. (CLASS_BINFO_ELTS): Reduce from 6 to 5, now that CLASS_OWN_IVARS is gone. (OCTI_GNU_INIT_DECL, GNU_INIT_decl): New. (OCTI_ELLIPSIS_NODE, objc_ellipsis_node): Remove. (OCTI_ID_ID, id_type, objc_id_id): Rename to OCTI_ID_NAME, objc_object_type and objc_object_name, respectively. (OCTI_CLS_REF, OCTI_CLASS_NAME, objc_class_reference, objc_class_name): New. (IS_CLASS): New macro. (IS_ID, IS_SUPER): Robustify. (OCTI_EXECCLASS_DECL, execclass_decl): New. (finish_file, start_class, continue_class, finish_class, start_method_def, continue_method_def, finish_method_def, start_protocol, finish_protocol, objc_build_throw_stmt, objc_build_try_catch_finally_stmt, objc_build_synchronized_prologue, objc_build_synchronized_epilogue, objc_build_try_prologue, objc_build_try_epilogue, objc_build_catch_stmt, objc_build_catch_epilogue, objc_build_finally_prologue, objc_build_finally_epilogue, is_ivar, is_private, is_public, add_instance_variable, objc_add_method, get_super_receiver, objc_clear_super_receiver, get_class_ivars_from_name, get_class_reference, get_static_reference, get_object_reference, build_message_expr, finish_message_expr, build_selector_expr, build_ivar_reference, build_keyword_decl, build_method_decl, build_protocol_expr, build_objc_string_object, objc_declare_alias, objc_declare_class, objc_declare_protocols, objc_comptypes, objc_check_decl, build_encode_expr): Remove prototypes. (imp_count, cat_count): Make GGC-aware. (OBJC_SET_TYPE_NAME): New macro. From-SVN: r87168
2004-09-08 02:49:44 +02:00
objc_get_parm_info (int have_ellipsis ATTRIBUTE_UNUSED)
#else
c-tree.h (enum c_declarator_kind, [...]): New. * c-tree.h (enum c_declarator_kind, struct c_arg_info, struct c_declarator, struct c_type_name, struct c_parm): New. (build_array_declarator, set_array_declarator_inner, get_parm_info, grokfield, groktypename, grokparm, push_parm_decl, start_function, start_decl, build_c_parm, build_attrs_declarator, build_function_declarator, make_pointer_declarator, c_cast_expr, store_parm_decls_newstyle, c_expr_sizeof_type): Update prototypes. (build_id_declarator): New. * c-typeck.c (c_cast_expr, c_expr_sizeof_type): Update to new structures. * c-decl.c (ARG_INFO_PARMS, ARG_INFO_TAGS, ARG_INFO_TYPES, ARG_INFO_OTHERS): Remove. (build_id_declarator): New. (build_array_declarator, set_array_declarator_inner, groktypename, start_decl, grokparm, push_parm_decl, grokparms, get_parm_info, grokfield, start_function, store_parm_decls_newstyle, store_parm_decls_oldstyle, store_parm_decls, build_c_parm, build_attrs_declarator, build_function_declarator, make_pointer_declarator, grokdeclarator): Update to new structures. * c-parse.in (%union): Add arginfotype, dtrtype, typenametype and parmtype. (declarator, notype_declarator, after_type_declarator, parm_declarator, parm_declarator_starttypename, parm_declarator_nostarttypename, array_declarator, typename, absdcl, absdcl1, absdcl1_ea, absdcl1_noea, direct_absdcl1, absdcl_maybe_attribute, parm, firstparm, parms, parmlist, parmlist_1, parmlist_2, parmlist_or_identifiers, parmlist_or_identifiers_1): Use these types. (primary, after_type_declarator, parm_declarator_starttypename, notype_declarator, component_decl, component_declarator, component_notype_declarator, typename, absdcl, absdcl_maybe_attribute, absdcl1_ea, direct_absdcl1, parmlist_1, parmlist_2, parmlist_or_identifiers_1): Update to new structures. objc: * objc-act.c (objc_start_function, really_start_method, objc_get_parm_info, start_method_def): Update to new arg_info structures. From-SVN: r87217
2004-09-09 03:19:15 +02:00
static struct c_arg_info *
Makefile.in (c-parse.o): Depend on $(C_COMMON_H). [gcc/ChangeLog] 2004-09-07 Ziemowit Laski <zlaski@apple.com> * Makefile.in (c-parse.o): Depend on $(C_COMMON_H). * c-parse.in: Include c-common.h instead of objc-act.h. (ivar_decl_list, ivar_decls, ivar_decl, ivars, ivar_declarator, myparms, myparm): Remove %type declarations. (methodtype, optparms, OBJC_TYPE_QUAL, objc_quals, objc_qual, objc_typename, objc_try_catch_stmt, optellipsis): Add %type declarations. (objc_inherit_code, objc_public_flag): Remove. (typespec_nonreserved_nonattr): Call objc_get_protocol_qualified_type() instead of get_static_reference() and get_protocol_reference(). (stmt_nocomp): Call grokparm() on @catch parameter. (objcdef): Move semantic action to objc_finish_implementation(). (classdef): Move semantic action to objc_start_class_interface(), objc_continue_interface(), objc_finish_interface(), objc_start_class_implementation(), objc_continue_implementation(), objc_start_category_interface() and objc_start_category_implementation(). (protocoldef): Move semantic actions to objc_start_protocol() and objc_finish_interface(). (ivar_decl_list): Remove nonterminal. (visibility_spec): Move semantic actions to objc_set_visibility(). (ivar_decls): Remove assignment to $$. (ivar_decl): Rephrase in terms of component_decl; call objc_add_instance_variable(). (ivars, ivar_declarator): Remove nonterminals. (opt_semi): New nonterminal. (methodtype): Remove semantic actions. (methoddef): Move semantic actions to objc_set_method_type(), objc_start_method_definition() and objc_finish_method_definition(). (methodproto): Move semantic actions to objc_set_method_type() and objc_add_method_declaration(). (methoddecl): Use objc_typename instead of typename; move semantic actions to objc_build_method_signature(). (optarglist, myxdecls, mydecl, myparms, myparm): Remove nonterminals. (optparmlist): Express in terms of optparms and optellipsis. (optparms, optellipsis, objc_qual, objc_quals, objc_typename): New nonterminals. (keyworddecl): Use objc_typename instead of typename. (rid_to_yy): Mark RID_IN, RID_OUT, RID_INOUT, RID_BYCOPY, RID_BYREF and RID_ONEWAY as returning OBJC_TYPE_QUAL to yyparse(). [gcc/objc/ChangeLog] 2004-09-07 Ziemowit Laski <zlaski@apple.com> * Make-lang.in (objc/objc-parse.o): Depend on $(C_COMMON_H) instead of objc/objc-act.h. (objc/objc-act.o): Depend on $(HASHTAB_H). * objc-act.c: Include hashtab.h; in ObjC++ mode, include cp-tree.h and objcp-decl.h instead of c-tree.h. (build_module_descriptor, get_class_ivars, synth_id_with_class_suffix, error_with_ivar, gen_method_decl, gen_declaration, setup_string_decl, build_protocol_template): Adjust prototypes. (build_module_initializer_routine, start_class, continue_class, finish_class, start_method_def, objc_start_function, start_protocol, build_method_decl, objc_add_method, add_instance_variable, build_ivar_reference, is_ivar, is_private, get_super_receiver, build_selector_table_decl, objc_push_parm, objc_get_parm_info, gen_type_name, gen_type_name_0, start_var_decl, finish_var_decl, create_field_decl): New prototypes. (objc_expand_function_end, comp_method_with_proto, objc_expr_last, gen_declaration_1, gen_declarator, is_complex_decl, adorn_decl, define_decl, create_builtin_decl, gen_declspecs): Remove prototypes. (TYPE_ID): Rename to OBJECT_TYPEDEF_NAME. (CLASS_TYPEDEF_NAME): New. (TAG_EXECCLASS): Change from a global variable to a #define. (TAG_RETURN_STRUCT): Delete. (TAG_GNUINIT): New, holds '__objc_gnu_init' name. (objc_inherit_code, objc_public_flag): New, moved from c-parse.in. (string_descriptor): New struct. (string_htab): New hash table. (string_hash, string_eq): New prototypes. (generate_struct_by_value_array): Call create_field_decl() instead of create_builtin_decl(). (objc_init): Do not initialize objc_ellipsis_node or TAG_EXECCLASS; In ObjC++ mode, call cxx_init() instead of c_objc_common_init(). (objc_finish_file): In ObjC++, call instantiate_pending_templates() and cp_finish_file(). (define_decl, get_static_reference, get_protocol_reference, create_builtin_decl): Remove functions. (objc_start_class_interface, objc_start_category_interface, objc_start_protocol, objc_continue_interface, objc_finish_interface, objc_start_class_implementation, objc_start_category_implementation, objc_continue_implementation, objc_finish_implementation, objc_set_visibility, objc_set_method_type, objc_build_method_signature, objc_add_method_declaration, objc_start_method_definition, objc_add_instance_variable, objc_get_protocol_qualified_type, create_field_decl, start_var_decl, finish_var_decl): New functions. (setup_string_decl): Simplify since it is only called once. (synth_module_prologue): Call build_class_template(); predefine 'id' and 'Class' as typedefs; rename 'temp_type' to 'type'; disable debug hooks for duration of function; fix GNU runtime messenger signatures to correspond to reality; forward-declare '__objc_exec_class' for the GNU runtime; call build_selector_table_decl(); in ObjC++ mode, generate 'extern "C" { ... }' wrappers around synthesized declarations; call build_protocol_template() and build_category_template(). (string_hash, string_eq): New functions. (objc_build_string_object): Check metaclass correctness only once; store string literals in hash table. (objc_build_constructor): Do not convert initializer elements; adjust for ObjC++ impedance mismatch. (build_objc_symtab_template): Call create_field_decl() instead of create_builtin_decl(). (init_objc_symtab): Add missing conversion to initializer element. (build_metadata_decl): Call start_var_decl() instead of define_decl(). (generate_objc_symtab_decl): Do not call build_category_template(); call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(). (build_module_descriptor): Call create_field_decl() instead of grokfield(); call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(); always mark module descriptor as used; move GNU runtime-specific functionality to build_module_initializer_routine(). (build_module_initializer_routine): New function, broken off of build_module_descriptor(). (objc_static_init_needed_p, objc_generate_static_init_call): New functions. (generate_static_references, generate_strings, build_selector_translation_table, generate_descriptor_table, generate_ivars_list, generate_dispatch_table, generate_category): Call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(); build a type directly instead of via groktypename(). (build_selector_reference_decl, build_selector_table_decl, build_class_reference_decl, build_protocol_reference, generate_objc_image_info): Call start_var_decl() instead of build_decl(). (build_selector_reference): For GNU runtime, do not call build_selector_reference_decl(). (build_selector, build_typed_selector_reference): Always convert result to the selector type. (add_objc_string): Cast return value to 'char *'. (build_method_prototype_template, build_selector_template, build_method_template): Use actual selector type for fields pointing to selectors. (finish_objc): For GNU runtime, call build_module_initializer_routine() after build_module_descriptor(). (generate_protocol_list, generate_shared_structures): Call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(); build a type directly instead of via groktypename(). (synth_id_with_class_suffix): Return a string. (get_arg_type_list): For instance methods, use the instance type for 'self'; do not call groktypename_in_parm_context(). (build_objc_string_decl): Squash redeclaration errors in ObjC++. (objc_is_class_name): Use OBJC_TYPE_NAME instead of TYPE_NAME; handle RECORD_TYPEs in ObjC as well as ObjC++. (objc_is_id): New function. (objc_is_object_ptr): Return the canonical type node. (objc_get_class_ivars): Simplify using get_class_ivars(). (get_class_ivars): Remove second parameter; create a fresh copy of the ivar list for each call; do not check for existence of super class. (objc_eh_runtime_type): Mark #ifndef OBJCPLUS. (objc_init_exceptions): When using SJLJ-style exceptions, require the use of '-fobjc-exceptions' flag; do not require it for DWARF-style exceptions. (objc_build_exc_ptr, next_sjlj_build_try_catch_finally): Use objc_object_type instead of objc_id_type. (objc_begin_catch_clause): Convert the incoming PARM_DECL into a VAR_DECL before placing it in the appropriate scope; do not call define_decl(); adjust call to c_begin_compound_stmt(); use objc_object_type instead of objc_id_type. (build_next_objc_exception_stuff): Call create_field_decl() instead of create_builtin_decl(); construct type directly instead of calling groktypename(); use OBJC_VOID_AT_END to mark end of function parameters. (build_private_template): Adjust call to get_class_ivars(); build a type directly instead of via groktypename(). (build_protocol_template, build_method_prototype_list_template, build_method_prototype_template, build_category_template, build_selector_template, build_class_template, build_super_template, build_ivar_template, build_ivar_list_template, build_method_list_template, build_method_template): Call create_field_decl() instead of grokfield(). (objc_method_parm_type): Do not call groktypename(). (generate_descriptor_table): Call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(). (generate_method_descriptors, build_protocol_initializer, generate_dispatch_tables, build_category_initializer, build_shared_structure_initializer): Do not call groktypename(). (generate_protocols): Call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(); do not call groktypename(). (error_with_ivar): Remove last parameter. (check_ivars): Do not iterate ovar CLASS_RAW_IVARS lists in addition to CLASS_IVARS lists; adjust calls to error_with_ivar(). (generate_ivar_lists): Convert one of the initializer elements; do not call groktypename(). (get_arg_type_list, start_method_def, gen_method_def): Account for new representation of variable arguments and '...' in Objective-C methods; add Objective-C++ impedance matching code. (is_objc_type_qualifier): Remove function. (adjust_type_for_id_default): Simplify; there is no longer a need to wade through declspecs. (lookup_interface, start_class, continue_class, finish_class, start_method_def, start_protocol, build_method_decl, objc_add_method, add_instance_variable, build_ivar_reference, is_ivar, is_private, get_super_receiver, objc_build_finally_epilogue): Make into static functions. (receiver_is_class_object): Use new IS_CLASS() macro. (objc_build_message_expr): Tweak ObjC++ message argument handling; call objc_finish_message_expr() instead of finish_message_expr(). (finish_message_expr): Rename to objc_finish_message_expr(); use OBJC_TYPE_NAME and OBJC_SET_TYPE_NAME macros instead of TYPE_NAME. call gen_type_name() instead of gen_declaration(); call objc_is_id() instead of using IS_ID and IS_CLASS; Use objc_class_name instead of calling get_identifier("Class"); handle CONVERT_EXPRs in receiver. (build_objc_method_call, warn_with_method): Do not call groktypename(). (build_ivar_reference): Call convert() instead of clobbering in a type. (hash_init): Initialize string_htab hash table. (add_instance_variable): Simplify parameter list; do not call grokfield(); do not populate CLASS_IVARS list. (start_class): Check for the existence of super class, if one was specified. (continue_class): Use CLASS_RAW_IVARS rather than CLASS_IVARS; do not call build_class_template(); adjust call to get_class_ivars(); call build_decl(), pushdecl() and finish_decl() instead of define_decl(). (finish_class): Call build_decl(), pushdecl() and finish_decl() instead of define_decl(). (add_protocols): Use PROTOCOL_BINFO_ELTS for the tree vector size. (start_protocol): Do not call build_protocol_template(); use PROTOCOL_BINFO_ELTS for the tree vector size. (encode_type_qualifiers): Do not handle the 'const' qualifier here. (encode_pointer): Encode 'const char *' as 'r*', for backwards compatibility. (encode_array): Use HOST_WIDE_INT_PRINT_DEC instead of "%ld". (encode_type): Handle the 'const' qualifier here. (objc_parmlist): New global variable, sued by objc_push_parm and objc_get_parm_info(). (objc_push_parm, objc_get_parm_info): New functions. (objc_expr_last): Remove function. (synth_self_and_ucmd_args): For instance methods, use the instance type for 'self'; call objc_push_parm() instead of push_parm_decl(). (start_method_def): Do not call push_scope(), declare_parm_level(), pop_scope(), push_parm_decl(), store_parm_decls() or objc_expr_last(); just use objc_push_parm() and objc_get_parm_info(). (comp_method_with_proto): Remove function. (objc_types_are_equivalent): Strip away indirections before comparing underlying types. (comp_proto_with_proto): Do not call groktypename(); types are no longer in raw declspec format. (objc_start_function): New function. (really_start_method): Call comp_proto_with_proto() instead of comp_method_with_proto(); call objc_start_function() instead of hand-crafting a function declarator. (continue_method_def, objc_expand_function_end): Remove functions. (get_super_receiver): Call objc_get_current_scope() instead of get_current_scope(); reference 'super_class' field (instead of 'class'). (finish_method_def): Rename to objc_finish_method_definition() and add a function decl parameter; move method encoding call from objc_expand_function_end(). (is_complex_decl, adorn_decl, gen_declarator, gen_declspecs, gen_declaration_1): Remove functions. (tmpbuf, RAW_DECLSPEC): Remove. (gen_declaration): Remove second parameter; simplify to deal with TYPE_P nodes instead of raw declspecs. (gen_type_name, gen_type_name_0): New functions. (gen_method_decl): Remove second parameter; call gen_type_name() instead of gen_declaration_1(). (dump_interface): Adjust calls to gen_declaration() and gen_method_decl(); do not allocate a separate string buffer. (init_objc): Allocate a larger string buffer to accommodate dump_interface(); adjust call to build_module_descriptor(); add call to build_module_initializer_routine() for the GNU runtime. (generate_classref_translation_entry): Do not call start_decl(); call finish_var_decl() instead of finish_decl(); call convert() instead of build_c_cast(). * objc-act.h (CLASS_OWN_IVARS): Remove accessor. (CLASS_BINFO_ELTS): Reduce from 6 to 5, now that CLASS_OWN_IVARS is gone. (OCTI_GNU_INIT_DECL, GNU_INIT_decl): New. (OCTI_ELLIPSIS_NODE, objc_ellipsis_node): Remove. (OCTI_ID_ID, id_type, objc_id_id): Rename to OCTI_ID_NAME, objc_object_type and objc_object_name, respectively. (OCTI_CLS_REF, OCTI_CLASS_NAME, objc_class_reference, objc_class_name): New. (IS_CLASS): New macro. (IS_ID, IS_SUPER): Robustify. (OCTI_EXECCLASS_DECL, execclass_decl): New. (finish_file, start_class, continue_class, finish_class, start_method_def, continue_method_def, finish_method_def, start_protocol, finish_protocol, objc_build_throw_stmt, objc_build_try_catch_finally_stmt, objc_build_synchronized_prologue, objc_build_synchronized_epilogue, objc_build_try_prologue, objc_build_try_epilogue, objc_build_catch_stmt, objc_build_catch_epilogue, objc_build_finally_prologue, objc_build_finally_epilogue, is_ivar, is_private, is_public, add_instance_variable, objc_add_method, get_super_receiver, objc_clear_super_receiver, get_class_ivars_from_name, get_class_reference, get_static_reference, get_object_reference, build_message_expr, finish_message_expr, build_selector_expr, build_ivar_reference, build_keyword_decl, build_method_decl, build_protocol_expr, build_objc_string_object, objc_declare_alias, objc_declare_class, objc_declare_protocols, objc_comptypes, objc_check_decl, build_encode_expr): Remove prototypes. (imp_count, cat_count): Make GGC-aware. (OBJC_SET_TYPE_NAME): New macro. From-SVN: r87168
2004-09-08 02:49:44 +02:00
objc_get_parm_info (int have_ellipsis)
#endif
1992-01-18 00:15:38 +01:00
{
c-tree.h (enum c_declarator_kind, [...]): New. * c-tree.h (enum c_declarator_kind, struct c_arg_info, struct c_declarator, struct c_type_name, struct c_parm): New. (build_array_declarator, set_array_declarator_inner, get_parm_info, grokfield, groktypename, grokparm, push_parm_decl, start_function, start_decl, build_c_parm, build_attrs_declarator, build_function_declarator, make_pointer_declarator, c_cast_expr, store_parm_decls_newstyle, c_expr_sizeof_type): Update prototypes. (build_id_declarator): New. * c-typeck.c (c_cast_expr, c_expr_sizeof_type): Update to new structures. * c-decl.c (ARG_INFO_PARMS, ARG_INFO_TAGS, ARG_INFO_TYPES, ARG_INFO_OTHERS): Remove. (build_id_declarator): New. (build_array_declarator, set_array_declarator_inner, groktypename, start_decl, grokparm, push_parm_decl, grokparms, get_parm_info, grokfield, start_function, store_parm_decls_newstyle, store_parm_decls_oldstyle, store_parm_decls, build_c_parm, build_attrs_declarator, build_function_declarator, make_pointer_declarator, grokdeclarator): Update to new structures. * c-parse.in (%union): Add arginfotype, dtrtype, typenametype and parmtype. (declarator, notype_declarator, after_type_declarator, parm_declarator, parm_declarator_starttypename, parm_declarator_nostarttypename, array_declarator, typename, absdcl, absdcl1, absdcl1_ea, absdcl1_noea, direct_absdcl1, absdcl_maybe_attribute, parm, firstparm, parms, parmlist, parmlist_1, parmlist_2, parmlist_or_identifiers, parmlist_or_identifiers_1): Use these types. (primary, after_type_declarator, parm_declarator_starttypename, notype_declarator, component_decl, component_declarator, component_notype_declarator, typename, absdcl, absdcl_maybe_attribute, absdcl1_ea, direct_absdcl1, parmlist_1, parmlist_2, parmlist_or_identifiers_1): Update to new structures. objc: * objc-act.c (objc_start_function, really_start_method, objc_get_parm_info, start_method_def): Update to new arg_info structures. From-SVN: r87217
2004-09-09 03:19:15 +02:00
#ifdef OBJCPLUS
Makefile.in (c-parse.o): Depend on $(C_COMMON_H). [gcc/ChangeLog] 2004-09-07 Ziemowit Laski <zlaski@apple.com> * Makefile.in (c-parse.o): Depend on $(C_COMMON_H). * c-parse.in: Include c-common.h instead of objc-act.h. (ivar_decl_list, ivar_decls, ivar_decl, ivars, ivar_declarator, myparms, myparm): Remove %type declarations. (methodtype, optparms, OBJC_TYPE_QUAL, objc_quals, objc_qual, objc_typename, objc_try_catch_stmt, optellipsis): Add %type declarations. (objc_inherit_code, objc_public_flag): Remove. (typespec_nonreserved_nonattr): Call objc_get_protocol_qualified_type() instead of get_static_reference() and get_protocol_reference(). (stmt_nocomp): Call grokparm() on @catch parameter. (objcdef): Move semantic action to objc_finish_implementation(). (classdef): Move semantic action to objc_start_class_interface(), objc_continue_interface(), objc_finish_interface(), objc_start_class_implementation(), objc_continue_implementation(), objc_start_category_interface() and objc_start_category_implementation(). (protocoldef): Move semantic actions to objc_start_protocol() and objc_finish_interface(). (ivar_decl_list): Remove nonterminal. (visibility_spec): Move semantic actions to objc_set_visibility(). (ivar_decls): Remove assignment to $$. (ivar_decl): Rephrase in terms of component_decl; call objc_add_instance_variable(). (ivars, ivar_declarator): Remove nonterminals. (opt_semi): New nonterminal. (methodtype): Remove semantic actions. (methoddef): Move semantic actions to objc_set_method_type(), objc_start_method_definition() and objc_finish_method_definition(). (methodproto): Move semantic actions to objc_set_method_type() and objc_add_method_declaration(). (methoddecl): Use objc_typename instead of typename; move semantic actions to objc_build_method_signature(). (optarglist, myxdecls, mydecl, myparms, myparm): Remove nonterminals. (optparmlist): Express in terms of optparms and optellipsis. (optparms, optellipsis, objc_qual, objc_quals, objc_typename): New nonterminals. (keyworddecl): Use objc_typename instead of typename. (rid_to_yy): Mark RID_IN, RID_OUT, RID_INOUT, RID_BYCOPY, RID_BYREF and RID_ONEWAY as returning OBJC_TYPE_QUAL to yyparse(). [gcc/objc/ChangeLog] 2004-09-07 Ziemowit Laski <zlaski@apple.com> * Make-lang.in (objc/objc-parse.o): Depend on $(C_COMMON_H) instead of objc/objc-act.h. (objc/objc-act.o): Depend on $(HASHTAB_H). * objc-act.c: Include hashtab.h; in ObjC++ mode, include cp-tree.h and objcp-decl.h instead of c-tree.h. (build_module_descriptor, get_class_ivars, synth_id_with_class_suffix, error_with_ivar, gen_method_decl, gen_declaration, setup_string_decl, build_protocol_template): Adjust prototypes. (build_module_initializer_routine, start_class, continue_class, finish_class, start_method_def, objc_start_function, start_protocol, build_method_decl, objc_add_method, add_instance_variable, build_ivar_reference, is_ivar, is_private, get_super_receiver, build_selector_table_decl, objc_push_parm, objc_get_parm_info, gen_type_name, gen_type_name_0, start_var_decl, finish_var_decl, create_field_decl): New prototypes. (objc_expand_function_end, comp_method_with_proto, objc_expr_last, gen_declaration_1, gen_declarator, is_complex_decl, adorn_decl, define_decl, create_builtin_decl, gen_declspecs): Remove prototypes. (TYPE_ID): Rename to OBJECT_TYPEDEF_NAME. (CLASS_TYPEDEF_NAME): New. (TAG_EXECCLASS): Change from a global variable to a #define. (TAG_RETURN_STRUCT): Delete. (TAG_GNUINIT): New, holds '__objc_gnu_init' name. (objc_inherit_code, objc_public_flag): New, moved from c-parse.in. (string_descriptor): New struct. (string_htab): New hash table. (string_hash, string_eq): New prototypes. (generate_struct_by_value_array): Call create_field_decl() instead of create_builtin_decl(). (objc_init): Do not initialize objc_ellipsis_node or TAG_EXECCLASS; In ObjC++ mode, call cxx_init() instead of c_objc_common_init(). (objc_finish_file): In ObjC++, call instantiate_pending_templates() and cp_finish_file(). (define_decl, get_static_reference, get_protocol_reference, create_builtin_decl): Remove functions. (objc_start_class_interface, objc_start_category_interface, objc_start_protocol, objc_continue_interface, objc_finish_interface, objc_start_class_implementation, objc_start_category_implementation, objc_continue_implementation, objc_finish_implementation, objc_set_visibility, objc_set_method_type, objc_build_method_signature, objc_add_method_declaration, objc_start_method_definition, objc_add_instance_variable, objc_get_protocol_qualified_type, create_field_decl, start_var_decl, finish_var_decl): New functions. (setup_string_decl): Simplify since it is only called once. (synth_module_prologue): Call build_class_template(); predefine 'id' and 'Class' as typedefs; rename 'temp_type' to 'type'; disable debug hooks for duration of function; fix GNU runtime messenger signatures to correspond to reality; forward-declare '__objc_exec_class' for the GNU runtime; call build_selector_table_decl(); in ObjC++ mode, generate 'extern "C" { ... }' wrappers around synthesized declarations; call build_protocol_template() and build_category_template(). (string_hash, string_eq): New functions. (objc_build_string_object): Check metaclass correctness only once; store string literals in hash table. (objc_build_constructor): Do not convert initializer elements; adjust for ObjC++ impedance mismatch. (build_objc_symtab_template): Call create_field_decl() instead of create_builtin_decl(). (init_objc_symtab): Add missing conversion to initializer element. (build_metadata_decl): Call start_var_decl() instead of define_decl(). (generate_objc_symtab_decl): Do not call build_category_template(); call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(). (build_module_descriptor): Call create_field_decl() instead of grokfield(); call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(); always mark module descriptor as used; move GNU runtime-specific functionality to build_module_initializer_routine(). (build_module_initializer_routine): New function, broken off of build_module_descriptor(). (objc_static_init_needed_p, objc_generate_static_init_call): New functions. (generate_static_references, generate_strings, build_selector_translation_table, generate_descriptor_table, generate_ivars_list, generate_dispatch_table, generate_category): Call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(); build a type directly instead of via groktypename(). (build_selector_reference_decl, build_selector_table_decl, build_class_reference_decl, build_protocol_reference, generate_objc_image_info): Call start_var_decl() instead of build_decl(). (build_selector_reference): For GNU runtime, do not call build_selector_reference_decl(). (build_selector, build_typed_selector_reference): Always convert result to the selector type. (add_objc_string): Cast return value to 'char *'. (build_method_prototype_template, build_selector_template, build_method_template): Use actual selector type for fields pointing to selectors. (finish_objc): For GNU runtime, call build_module_initializer_routine() after build_module_descriptor(). (generate_protocol_list, generate_shared_structures): Call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(); build a type directly instead of via groktypename(). (synth_id_with_class_suffix): Return a string. (get_arg_type_list): For instance methods, use the instance type for 'self'; do not call groktypename_in_parm_context(). (build_objc_string_decl): Squash redeclaration errors in ObjC++. (objc_is_class_name): Use OBJC_TYPE_NAME instead of TYPE_NAME; handle RECORD_TYPEs in ObjC as well as ObjC++. (objc_is_id): New function. (objc_is_object_ptr): Return the canonical type node. (objc_get_class_ivars): Simplify using get_class_ivars(). (get_class_ivars): Remove second parameter; create a fresh copy of the ivar list for each call; do not check for existence of super class. (objc_eh_runtime_type): Mark #ifndef OBJCPLUS. (objc_init_exceptions): When using SJLJ-style exceptions, require the use of '-fobjc-exceptions' flag; do not require it for DWARF-style exceptions. (objc_build_exc_ptr, next_sjlj_build_try_catch_finally): Use objc_object_type instead of objc_id_type. (objc_begin_catch_clause): Convert the incoming PARM_DECL into a VAR_DECL before placing it in the appropriate scope; do not call define_decl(); adjust call to c_begin_compound_stmt(); use objc_object_type instead of objc_id_type. (build_next_objc_exception_stuff): Call create_field_decl() instead of create_builtin_decl(); construct type directly instead of calling groktypename(); use OBJC_VOID_AT_END to mark end of function parameters. (build_private_template): Adjust call to get_class_ivars(); build a type directly instead of via groktypename(). (build_protocol_template, build_method_prototype_list_template, build_method_prototype_template, build_category_template, build_selector_template, build_class_template, build_super_template, build_ivar_template, build_ivar_list_template, build_method_list_template, build_method_template): Call create_field_decl() instead of grokfield(). (objc_method_parm_type): Do not call groktypename(). (generate_descriptor_table): Call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(). (generate_method_descriptors, build_protocol_initializer, generate_dispatch_tables, build_category_initializer, build_shared_structure_initializer): Do not call groktypename(). (generate_protocols): Call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(); do not call groktypename(). (error_with_ivar): Remove last parameter. (check_ivars): Do not iterate ovar CLASS_RAW_IVARS lists in addition to CLASS_IVARS lists; adjust calls to error_with_ivar(). (generate_ivar_lists): Convert one of the initializer elements; do not call groktypename(). (get_arg_type_list, start_method_def, gen_method_def): Account for new representation of variable arguments and '...' in Objective-C methods; add Objective-C++ impedance matching code. (is_objc_type_qualifier): Remove function. (adjust_type_for_id_default): Simplify; there is no longer a need to wade through declspecs. (lookup_interface, start_class, continue_class, finish_class, start_method_def, start_protocol, build_method_decl, objc_add_method, add_instance_variable, build_ivar_reference, is_ivar, is_private, get_super_receiver, objc_build_finally_epilogue): Make into static functions. (receiver_is_class_object): Use new IS_CLASS() macro. (objc_build_message_expr): Tweak ObjC++ message argument handling; call objc_finish_message_expr() instead of finish_message_expr(). (finish_message_expr): Rename to objc_finish_message_expr(); use OBJC_TYPE_NAME and OBJC_SET_TYPE_NAME macros instead of TYPE_NAME. call gen_type_name() instead of gen_declaration(); call objc_is_id() instead of using IS_ID and IS_CLASS; Use objc_class_name instead of calling get_identifier("Class"); handle CONVERT_EXPRs in receiver. (build_objc_method_call, warn_with_method): Do not call groktypename(). (build_ivar_reference): Call convert() instead of clobbering in a type. (hash_init): Initialize string_htab hash table. (add_instance_variable): Simplify parameter list; do not call grokfield(); do not populate CLASS_IVARS list. (start_class): Check for the existence of super class, if one was specified. (continue_class): Use CLASS_RAW_IVARS rather than CLASS_IVARS; do not call build_class_template(); adjust call to get_class_ivars(); call build_decl(), pushdecl() and finish_decl() instead of define_decl(). (finish_class): Call build_decl(), pushdecl() and finish_decl() instead of define_decl(). (add_protocols): Use PROTOCOL_BINFO_ELTS for the tree vector size. (start_protocol): Do not call build_protocol_template(); use PROTOCOL_BINFO_ELTS for the tree vector size. (encode_type_qualifiers): Do not handle the 'const' qualifier here. (encode_pointer): Encode 'const char *' as 'r*', for backwards compatibility. (encode_array): Use HOST_WIDE_INT_PRINT_DEC instead of "%ld". (encode_type): Handle the 'const' qualifier here. (objc_parmlist): New global variable, sued by objc_push_parm and objc_get_parm_info(). (objc_push_parm, objc_get_parm_info): New functions. (objc_expr_last): Remove function. (synth_self_and_ucmd_args): For instance methods, use the instance type for 'self'; call objc_push_parm() instead of push_parm_decl(). (start_method_def): Do not call push_scope(), declare_parm_level(), pop_scope(), push_parm_decl(), store_parm_decls() or objc_expr_last(); just use objc_push_parm() and objc_get_parm_info(). (comp_method_with_proto): Remove function. (objc_types_are_equivalent): Strip away indirections before comparing underlying types. (comp_proto_with_proto): Do not call groktypename(); types are no longer in raw declspec format. (objc_start_function): New function. (really_start_method): Call comp_proto_with_proto() instead of comp_method_with_proto(); call objc_start_function() instead of hand-crafting a function declarator. (continue_method_def, objc_expand_function_end): Remove functions. (get_super_receiver): Call objc_get_current_scope() instead of get_current_scope(); reference 'super_class' field (instead of 'class'). (finish_method_def): Rename to objc_finish_method_definition() and add a function decl parameter; move method encoding call from objc_expand_function_end(). (is_complex_decl, adorn_decl, gen_declarator, gen_declspecs, gen_declaration_1): Remove functions. (tmpbuf, RAW_DECLSPEC): Remove. (gen_declaration): Remove second parameter; simplify to deal with TYPE_P nodes instead of raw declspecs. (gen_type_name, gen_type_name_0): New functions. (gen_method_decl): Remove second parameter; call gen_type_name() instead of gen_declaration_1(). (dump_interface): Adjust calls to gen_declaration() and gen_method_decl(); do not allocate a separate string buffer. (init_objc): Allocate a larger string buffer to accommodate dump_interface(); adjust call to build_module_descriptor(); add call to build_module_initializer_routine() for the GNU runtime. (generate_classref_translation_entry): Do not call start_decl(); call finish_var_decl() instead of finish_decl(); call convert() instead of build_c_cast(). * objc-act.h (CLASS_OWN_IVARS): Remove accessor. (CLASS_BINFO_ELTS): Reduce from 6 to 5, now that CLASS_OWN_IVARS is gone. (OCTI_GNU_INIT_DECL, GNU_INIT_decl): New. (OCTI_ELLIPSIS_NODE, objc_ellipsis_node): Remove. (OCTI_ID_ID, id_type, objc_id_id): Rename to OCTI_ID_NAME, objc_object_type and objc_object_name, respectively. (OCTI_CLS_REF, OCTI_CLASS_NAME, objc_class_reference, objc_class_name): New. (IS_CLASS): New macro. (IS_ID, IS_SUPER): Robustify. (OCTI_EXECCLASS_DECL, execclass_decl): New. (finish_file, start_class, continue_class, finish_class, start_method_def, continue_method_def, finish_method_def, start_protocol, finish_protocol, objc_build_throw_stmt, objc_build_try_catch_finally_stmt, objc_build_synchronized_prologue, objc_build_synchronized_epilogue, objc_build_try_prologue, objc_build_try_epilogue, objc_build_catch_stmt, objc_build_catch_epilogue, objc_build_finally_prologue, objc_build_finally_epilogue, is_ivar, is_private, is_public, add_instance_variable, objc_add_method, get_super_receiver, objc_clear_super_receiver, get_class_ivars_from_name, get_class_reference, get_static_reference, get_object_reference, build_message_expr, finish_message_expr, build_selector_expr, build_ivar_reference, build_keyword_decl, build_method_decl, build_protocol_expr, build_objc_string_object, objc_declare_alias, objc_declare_class, objc_declare_protocols, objc_comptypes, objc_check_decl, build_encode_expr): Remove prototypes. (imp_count, cat_count): Make GGC-aware. (OBJC_SET_TYPE_NAME): New macro. From-SVN: r87168
2004-09-08 02:49:44 +02:00
tree parm_info = objc_parmlist;
c-tree.h (enum c_declarator_kind, [...]): New. * c-tree.h (enum c_declarator_kind, struct c_arg_info, struct c_declarator, struct c_type_name, struct c_parm): New. (build_array_declarator, set_array_declarator_inner, get_parm_info, grokfield, groktypename, grokparm, push_parm_decl, start_function, start_decl, build_c_parm, build_attrs_declarator, build_function_declarator, make_pointer_declarator, c_cast_expr, store_parm_decls_newstyle, c_expr_sizeof_type): Update prototypes. (build_id_declarator): New. * c-typeck.c (c_cast_expr, c_expr_sizeof_type): Update to new structures. * c-decl.c (ARG_INFO_PARMS, ARG_INFO_TAGS, ARG_INFO_TYPES, ARG_INFO_OTHERS): Remove. (build_id_declarator): New. (build_array_declarator, set_array_declarator_inner, groktypename, start_decl, grokparm, push_parm_decl, grokparms, get_parm_info, grokfield, start_function, store_parm_decls_newstyle, store_parm_decls_oldstyle, store_parm_decls, build_c_parm, build_attrs_declarator, build_function_declarator, make_pointer_declarator, grokdeclarator): Update to new structures. * c-parse.in (%union): Add arginfotype, dtrtype, typenametype and parmtype. (declarator, notype_declarator, after_type_declarator, parm_declarator, parm_declarator_starttypename, parm_declarator_nostarttypename, array_declarator, typename, absdcl, absdcl1, absdcl1_ea, absdcl1_noea, direct_absdcl1, absdcl_maybe_attribute, parm, firstparm, parms, parmlist, parmlist_1, parmlist_2, parmlist_or_identifiers, parmlist_or_identifiers_1): Use these types. (primary, after_type_declarator, parm_declarator_starttypename, notype_declarator, component_decl, component_declarator, component_notype_declarator, typename, absdcl, absdcl_maybe_attribute, absdcl1_ea, direct_absdcl1, parmlist_1, parmlist_2, parmlist_or_identifiers_1): Update to new structures. objc: * objc-act.c (objc_start_function, really_start_method, objc_get_parm_info, start_method_def): Update to new arg_info structures. From-SVN: r87217
2004-09-09 03:19:15 +02:00
objc_parmlist = NULL_TREE;
1992-01-18 00:15:38 +01:00
c-tree.h (enum c_declarator_kind, [...]): New. * c-tree.h (enum c_declarator_kind, struct c_arg_info, struct c_declarator, struct c_type_name, struct c_parm): New. (build_array_declarator, set_array_declarator_inner, get_parm_info, grokfield, groktypename, grokparm, push_parm_decl, start_function, start_decl, build_c_parm, build_attrs_declarator, build_function_declarator, make_pointer_declarator, c_cast_expr, store_parm_decls_newstyle, c_expr_sizeof_type): Update prototypes. (build_id_declarator): New. * c-typeck.c (c_cast_expr, c_expr_sizeof_type): Update to new structures. * c-decl.c (ARG_INFO_PARMS, ARG_INFO_TAGS, ARG_INFO_TYPES, ARG_INFO_OTHERS): Remove. (build_id_declarator): New. (build_array_declarator, set_array_declarator_inner, groktypename, start_decl, grokparm, push_parm_decl, grokparms, get_parm_info, grokfield, start_function, store_parm_decls_newstyle, store_parm_decls_oldstyle, store_parm_decls, build_c_parm, build_attrs_declarator, build_function_declarator, make_pointer_declarator, grokdeclarator): Update to new structures. * c-parse.in (%union): Add arginfotype, dtrtype, typenametype and parmtype. (declarator, notype_declarator, after_type_declarator, parm_declarator, parm_declarator_starttypename, parm_declarator_nostarttypename, array_declarator, typename, absdcl, absdcl1, absdcl1_ea, absdcl1_noea, direct_absdcl1, absdcl_maybe_attribute, parm, firstparm, parms, parmlist, parmlist_1, parmlist_2, parmlist_or_identifiers, parmlist_or_identifiers_1): Use these types. (primary, after_type_declarator, parm_declarator_starttypename, notype_declarator, component_decl, component_declarator, component_notype_declarator, typename, absdcl, absdcl_maybe_attribute, absdcl1_ea, direct_absdcl1, parmlist_1, parmlist_2, parmlist_or_identifiers_1): Update to new structures. objc: * objc-act.c (objc_start_function, really_start_method, objc_get_parm_info, start_method_def): Update to new arg_info structures. From-SVN: r87217
2004-09-09 03:19:15 +02:00
return parm_info;
#else
tree parm_info = objc_parmlist;
struct c_arg_info *arg_info;
Makefile.in (c-parse.o): Depend on $(C_COMMON_H). [gcc/ChangeLog] 2004-09-07 Ziemowit Laski <zlaski@apple.com> * Makefile.in (c-parse.o): Depend on $(C_COMMON_H). * c-parse.in: Include c-common.h instead of objc-act.h. (ivar_decl_list, ivar_decls, ivar_decl, ivars, ivar_declarator, myparms, myparm): Remove %type declarations. (methodtype, optparms, OBJC_TYPE_QUAL, objc_quals, objc_qual, objc_typename, objc_try_catch_stmt, optellipsis): Add %type declarations. (objc_inherit_code, objc_public_flag): Remove. (typespec_nonreserved_nonattr): Call objc_get_protocol_qualified_type() instead of get_static_reference() and get_protocol_reference(). (stmt_nocomp): Call grokparm() on @catch parameter. (objcdef): Move semantic action to objc_finish_implementation(). (classdef): Move semantic action to objc_start_class_interface(), objc_continue_interface(), objc_finish_interface(), objc_start_class_implementation(), objc_continue_implementation(), objc_start_category_interface() and objc_start_category_implementation(). (protocoldef): Move semantic actions to objc_start_protocol() and objc_finish_interface(). (ivar_decl_list): Remove nonterminal. (visibility_spec): Move semantic actions to objc_set_visibility(). (ivar_decls): Remove assignment to $$. (ivar_decl): Rephrase in terms of component_decl; call objc_add_instance_variable(). (ivars, ivar_declarator): Remove nonterminals. (opt_semi): New nonterminal. (methodtype): Remove semantic actions. (methoddef): Move semantic actions to objc_set_method_type(), objc_start_method_definition() and objc_finish_method_definition(). (methodproto): Move semantic actions to objc_set_method_type() and objc_add_method_declaration(). (methoddecl): Use objc_typename instead of typename; move semantic actions to objc_build_method_signature(). (optarglist, myxdecls, mydecl, myparms, myparm): Remove nonterminals. (optparmlist): Express in terms of optparms and optellipsis. (optparms, optellipsis, objc_qual, objc_quals, objc_typename): New nonterminals. (keyworddecl): Use objc_typename instead of typename. (rid_to_yy): Mark RID_IN, RID_OUT, RID_INOUT, RID_BYCOPY, RID_BYREF and RID_ONEWAY as returning OBJC_TYPE_QUAL to yyparse(). [gcc/objc/ChangeLog] 2004-09-07 Ziemowit Laski <zlaski@apple.com> * Make-lang.in (objc/objc-parse.o): Depend on $(C_COMMON_H) instead of objc/objc-act.h. (objc/objc-act.o): Depend on $(HASHTAB_H). * objc-act.c: Include hashtab.h; in ObjC++ mode, include cp-tree.h and objcp-decl.h instead of c-tree.h. (build_module_descriptor, get_class_ivars, synth_id_with_class_suffix, error_with_ivar, gen_method_decl, gen_declaration, setup_string_decl, build_protocol_template): Adjust prototypes. (build_module_initializer_routine, start_class, continue_class, finish_class, start_method_def, objc_start_function, start_protocol, build_method_decl, objc_add_method, add_instance_variable, build_ivar_reference, is_ivar, is_private, get_super_receiver, build_selector_table_decl, objc_push_parm, objc_get_parm_info, gen_type_name, gen_type_name_0, start_var_decl, finish_var_decl, create_field_decl): New prototypes. (objc_expand_function_end, comp_method_with_proto, objc_expr_last, gen_declaration_1, gen_declarator, is_complex_decl, adorn_decl, define_decl, create_builtin_decl, gen_declspecs): Remove prototypes. (TYPE_ID): Rename to OBJECT_TYPEDEF_NAME. (CLASS_TYPEDEF_NAME): New. (TAG_EXECCLASS): Change from a global variable to a #define. (TAG_RETURN_STRUCT): Delete. (TAG_GNUINIT): New, holds '__objc_gnu_init' name. (objc_inherit_code, objc_public_flag): New, moved from c-parse.in. (string_descriptor): New struct. (string_htab): New hash table. (string_hash, string_eq): New prototypes. (generate_struct_by_value_array): Call create_field_decl() instead of create_builtin_decl(). (objc_init): Do not initialize objc_ellipsis_node or TAG_EXECCLASS; In ObjC++ mode, call cxx_init() instead of c_objc_common_init(). (objc_finish_file): In ObjC++, call instantiate_pending_templates() and cp_finish_file(). (define_decl, get_static_reference, get_protocol_reference, create_builtin_decl): Remove functions. (objc_start_class_interface, objc_start_category_interface, objc_start_protocol, objc_continue_interface, objc_finish_interface, objc_start_class_implementation, objc_start_category_implementation, objc_continue_implementation, objc_finish_implementation, objc_set_visibility, objc_set_method_type, objc_build_method_signature, objc_add_method_declaration, objc_start_method_definition, objc_add_instance_variable, objc_get_protocol_qualified_type, create_field_decl, start_var_decl, finish_var_decl): New functions. (setup_string_decl): Simplify since it is only called once. (synth_module_prologue): Call build_class_template(); predefine 'id' and 'Class' as typedefs; rename 'temp_type' to 'type'; disable debug hooks for duration of function; fix GNU runtime messenger signatures to correspond to reality; forward-declare '__objc_exec_class' for the GNU runtime; call build_selector_table_decl(); in ObjC++ mode, generate 'extern "C" { ... }' wrappers around synthesized declarations; call build_protocol_template() and build_category_template(). (string_hash, string_eq): New functions. (objc_build_string_object): Check metaclass correctness only once; store string literals in hash table. (objc_build_constructor): Do not convert initializer elements; adjust for ObjC++ impedance mismatch. (build_objc_symtab_template): Call create_field_decl() instead of create_builtin_decl(). (init_objc_symtab): Add missing conversion to initializer element. (build_metadata_decl): Call start_var_decl() instead of define_decl(). (generate_objc_symtab_decl): Do not call build_category_template(); call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(). (build_module_descriptor): Call create_field_decl() instead of grokfield(); call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(); always mark module descriptor as used; move GNU runtime-specific functionality to build_module_initializer_routine(). (build_module_initializer_routine): New function, broken off of build_module_descriptor(). (objc_static_init_needed_p, objc_generate_static_init_call): New functions. (generate_static_references, generate_strings, build_selector_translation_table, generate_descriptor_table, generate_ivars_list, generate_dispatch_table, generate_category): Call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(); build a type directly instead of via groktypename(). (build_selector_reference_decl, build_selector_table_decl, build_class_reference_decl, build_protocol_reference, generate_objc_image_info): Call start_var_decl() instead of build_decl(). (build_selector_reference): For GNU runtime, do not call build_selector_reference_decl(). (build_selector, build_typed_selector_reference): Always convert result to the selector type. (add_objc_string): Cast return value to 'char *'. (build_method_prototype_template, build_selector_template, build_method_template): Use actual selector type for fields pointing to selectors. (finish_objc): For GNU runtime, call build_module_initializer_routine() after build_module_descriptor(). (generate_protocol_list, generate_shared_structures): Call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(); build a type directly instead of via groktypename(). (synth_id_with_class_suffix): Return a string. (get_arg_type_list): For instance methods, use the instance type for 'self'; do not call groktypename_in_parm_context(). (build_objc_string_decl): Squash redeclaration errors in ObjC++. (objc_is_class_name): Use OBJC_TYPE_NAME instead of TYPE_NAME; handle RECORD_TYPEs in ObjC as well as ObjC++. (objc_is_id): New function. (objc_is_object_ptr): Return the canonical type node. (objc_get_class_ivars): Simplify using get_class_ivars(). (get_class_ivars): Remove second parameter; create a fresh copy of the ivar list for each call; do not check for existence of super class. (objc_eh_runtime_type): Mark #ifndef OBJCPLUS. (objc_init_exceptions): When using SJLJ-style exceptions, require the use of '-fobjc-exceptions' flag; do not require it for DWARF-style exceptions. (objc_build_exc_ptr, next_sjlj_build_try_catch_finally): Use objc_object_type instead of objc_id_type. (objc_begin_catch_clause): Convert the incoming PARM_DECL into a VAR_DECL before placing it in the appropriate scope; do not call define_decl(); adjust call to c_begin_compound_stmt(); use objc_object_type instead of objc_id_type. (build_next_objc_exception_stuff): Call create_field_decl() instead of create_builtin_decl(); construct type directly instead of calling groktypename(); use OBJC_VOID_AT_END to mark end of function parameters. (build_private_template): Adjust call to get_class_ivars(); build a type directly instead of via groktypename(). (build_protocol_template, build_method_prototype_list_template, build_method_prototype_template, build_category_template, build_selector_template, build_class_template, build_super_template, build_ivar_template, build_ivar_list_template, build_method_list_template, build_method_template): Call create_field_decl() instead of grokfield(). (objc_method_parm_type): Do not call groktypename(). (generate_descriptor_table): Call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(). (generate_method_descriptors, build_protocol_initializer, generate_dispatch_tables, build_category_initializer, build_shared_structure_initializer): Do not call groktypename(). (generate_protocols): Call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(); do not call groktypename(). (error_with_ivar): Remove last parameter. (check_ivars): Do not iterate ovar CLASS_RAW_IVARS lists in addition to CLASS_IVARS lists; adjust calls to error_with_ivar(). (generate_ivar_lists): Convert one of the initializer elements; do not call groktypename(). (get_arg_type_list, start_method_def, gen_method_def): Account for new representation of variable arguments and '...' in Objective-C methods; add Objective-C++ impedance matching code. (is_objc_type_qualifier): Remove function. (adjust_type_for_id_default): Simplify; there is no longer a need to wade through declspecs. (lookup_interface, start_class, continue_class, finish_class, start_method_def, start_protocol, build_method_decl, objc_add_method, add_instance_variable, build_ivar_reference, is_ivar, is_private, get_super_receiver, objc_build_finally_epilogue): Make into static functions. (receiver_is_class_object): Use new IS_CLASS() macro. (objc_build_message_expr): Tweak ObjC++ message argument handling; call objc_finish_message_expr() instead of finish_message_expr(). (finish_message_expr): Rename to objc_finish_message_expr(); use OBJC_TYPE_NAME and OBJC_SET_TYPE_NAME macros instead of TYPE_NAME. call gen_type_name() instead of gen_declaration(); call objc_is_id() instead of using IS_ID and IS_CLASS; Use objc_class_name instead of calling get_identifier("Class"); handle CONVERT_EXPRs in receiver. (build_objc_method_call, warn_with_method): Do not call groktypename(). (build_ivar_reference): Call convert() instead of clobbering in a type. (hash_init): Initialize string_htab hash table. (add_instance_variable): Simplify parameter list; do not call grokfield(); do not populate CLASS_IVARS list. (start_class): Check for the existence of super class, if one was specified. (continue_class): Use CLASS_RAW_IVARS rather than CLASS_IVARS; do not call build_class_template(); adjust call to get_class_ivars(); call build_decl(), pushdecl() and finish_decl() instead of define_decl(). (finish_class): Call build_decl(), pushdecl() and finish_decl() instead of define_decl(). (add_protocols): Use PROTOCOL_BINFO_ELTS for the tree vector size. (start_protocol): Do not call build_protocol_template(); use PROTOCOL_BINFO_ELTS for the tree vector size. (encode_type_qualifiers): Do not handle the 'const' qualifier here. (encode_pointer): Encode 'const char *' as 'r*', for backwards compatibility. (encode_array): Use HOST_WIDE_INT_PRINT_DEC instead of "%ld". (encode_type): Handle the 'const' qualifier here. (objc_parmlist): New global variable, sued by objc_push_parm and objc_get_parm_info(). (objc_push_parm, objc_get_parm_info): New functions. (objc_expr_last): Remove function. (synth_self_and_ucmd_args): For instance methods, use the instance type for 'self'; call objc_push_parm() instead of push_parm_decl(). (start_method_def): Do not call push_scope(), declare_parm_level(), pop_scope(), push_parm_decl(), store_parm_decls() or objc_expr_last(); just use objc_push_parm() and objc_get_parm_info(). (comp_method_with_proto): Remove function. (objc_types_are_equivalent): Strip away indirections before comparing underlying types. (comp_proto_with_proto): Do not call groktypename(); types are no longer in raw declspec format. (objc_start_function): New function. (really_start_method): Call comp_proto_with_proto() instead of comp_method_with_proto(); call objc_start_function() instead of hand-crafting a function declarator. (continue_method_def, objc_expand_function_end): Remove functions. (get_super_receiver): Call objc_get_current_scope() instead of get_current_scope(); reference 'super_class' field (instead of 'class'). (finish_method_def): Rename to objc_finish_method_definition() and add a function decl parameter; move method encoding call from objc_expand_function_end(). (is_complex_decl, adorn_decl, gen_declarator, gen_declspecs, gen_declaration_1): Remove functions. (tmpbuf, RAW_DECLSPEC): Remove. (gen_declaration): Remove second parameter; simplify to deal with TYPE_P nodes instead of raw declspecs. (gen_type_name, gen_type_name_0): New functions. (gen_method_decl): Remove second parameter; call gen_type_name() instead of gen_declaration_1(). (dump_interface): Adjust calls to gen_declaration() and gen_method_decl(); do not allocate a separate string buffer. (init_objc): Allocate a larger string buffer to accommodate dump_interface(); adjust call to build_module_descriptor(); add call to build_module_initializer_routine() for the GNU runtime. (generate_classref_translation_entry): Do not call start_decl(); call finish_var_decl() instead of finish_decl(); call convert() instead of build_c_cast(). * objc-act.h (CLASS_OWN_IVARS): Remove accessor. (CLASS_BINFO_ELTS): Reduce from 6 to 5, now that CLASS_OWN_IVARS is gone. (OCTI_GNU_INIT_DECL, GNU_INIT_decl): New. (OCTI_ELLIPSIS_NODE, objc_ellipsis_node): Remove. (OCTI_ID_ID, id_type, objc_id_id): Rename to OCTI_ID_NAME, objc_object_type and objc_object_name, respectively. (OCTI_CLS_REF, OCTI_CLASS_NAME, objc_class_reference, objc_class_name): New. (IS_CLASS): New macro. (IS_ID, IS_SUPER): Robustify. (OCTI_EXECCLASS_DECL, execclass_decl): New. (finish_file, start_class, continue_class, finish_class, start_method_def, continue_method_def, finish_method_def, start_protocol, finish_protocol, objc_build_throw_stmt, objc_build_try_catch_finally_stmt, objc_build_synchronized_prologue, objc_build_synchronized_epilogue, objc_build_try_prologue, objc_build_try_epilogue, objc_build_catch_stmt, objc_build_catch_epilogue, objc_build_finally_prologue, objc_build_finally_epilogue, is_ivar, is_private, is_public, add_instance_variable, objc_add_method, get_super_receiver, objc_clear_super_receiver, get_class_ivars_from_name, get_class_reference, get_static_reference, get_object_reference, build_message_expr, finish_message_expr, build_selector_expr, build_ivar_reference, build_keyword_decl, build_method_decl, build_protocol_expr, build_objc_string_object, objc_declare_alias, objc_declare_class, objc_declare_protocols, objc_comptypes, objc_check_decl, build_encode_expr): Remove prototypes. (imp_count, cat_count): Make GGC-aware. (OBJC_SET_TYPE_NAME): New macro. From-SVN: r87168
2004-09-08 02:49:44 +02:00
/* The C front-end requires an elaborate song and dance at
this point. */
push_scope ();
declare_parm_level ();
while (parm_info)
{
tree next = TREE_CHAIN (parm_info);
TREE_CHAIN (parm_info) = NULL_TREE;
parm_info = pushdecl (parm_info);
finish_decl (parm_info, NULL_TREE, NULL_TREE);
Makefile.in (c-parse.o): Depend on $(C_COMMON_H). [gcc/ChangeLog] 2004-09-07 Ziemowit Laski <zlaski@apple.com> * Makefile.in (c-parse.o): Depend on $(C_COMMON_H). * c-parse.in: Include c-common.h instead of objc-act.h. (ivar_decl_list, ivar_decls, ivar_decl, ivars, ivar_declarator, myparms, myparm): Remove %type declarations. (methodtype, optparms, OBJC_TYPE_QUAL, objc_quals, objc_qual, objc_typename, objc_try_catch_stmt, optellipsis): Add %type declarations. (objc_inherit_code, objc_public_flag): Remove. (typespec_nonreserved_nonattr): Call objc_get_protocol_qualified_type() instead of get_static_reference() and get_protocol_reference(). (stmt_nocomp): Call grokparm() on @catch parameter. (objcdef): Move semantic action to objc_finish_implementation(). (classdef): Move semantic action to objc_start_class_interface(), objc_continue_interface(), objc_finish_interface(), objc_start_class_implementation(), objc_continue_implementation(), objc_start_category_interface() and objc_start_category_implementation(). (protocoldef): Move semantic actions to objc_start_protocol() and objc_finish_interface(). (ivar_decl_list): Remove nonterminal. (visibility_spec): Move semantic actions to objc_set_visibility(). (ivar_decls): Remove assignment to $$. (ivar_decl): Rephrase in terms of component_decl; call objc_add_instance_variable(). (ivars, ivar_declarator): Remove nonterminals. (opt_semi): New nonterminal. (methodtype): Remove semantic actions. (methoddef): Move semantic actions to objc_set_method_type(), objc_start_method_definition() and objc_finish_method_definition(). (methodproto): Move semantic actions to objc_set_method_type() and objc_add_method_declaration(). (methoddecl): Use objc_typename instead of typename; move semantic actions to objc_build_method_signature(). (optarglist, myxdecls, mydecl, myparms, myparm): Remove nonterminals. (optparmlist): Express in terms of optparms and optellipsis. (optparms, optellipsis, objc_qual, objc_quals, objc_typename): New nonterminals. (keyworddecl): Use objc_typename instead of typename. (rid_to_yy): Mark RID_IN, RID_OUT, RID_INOUT, RID_BYCOPY, RID_BYREF and RID_ONEWAY as returning OBJC_TYPE_QUAL to yyparse(). [gcc/objc/ChangeLog] 2004-09-07 Ziemowit Laski <zlaski@apple.com> * Make-lang.in (objc/objc-parse.o): Depend on $(C_COMMON_H) instead of objc/objc-act.h. (objc/objc-act.o): Depend on $(HASHTAB_H). * objc-act.c: Include hashtab.h; in ObjC++ mode, include cp-tree.h and objcp-decl.h instead of c-tree.h. (build_module_descriptor, get_class_ivars, synth_id_with_class_suffix, error_with_ivar, gen_method_decl, gen_declaration, setup_string_decl, build_protocol_template): Adjust prototypes. (build_module_initializer_routine, start_class, continue_class, finish_class, start_method_def, objc_start_function, start_protocol, build_method_decl, objc_add_method, add_instance_variable, build_ivar_reference, is_ivar, is_private, get_super_receiver, build_selector_table_decl, objc_push_parm, objc_get_parm_info, gen_type_name, gen_type_name_0, start_var_decl, finish_var_decl, create_field_decl): New prototypes. (objc_expand_function_end, comp_method_with_proto, objc_expr_last, gen_declaration_1, gen_declarator, is_complex_decl, adorn_decl, define_decl, create_builtin_decl, gen_declspecs): Remove prototypes. (TYPE_ID): Rename to OBJECT_TYPEDEF_NAME. (CLASS_TYPEDEF_NAME): New. (TAG_EXECCLASS): Change from a global variable to a #define. (TAG_RETURN_STRUCT): Delete. (TAG_GNUINIT): New, holds '__objc_gnu_init' name. (objc_inherit_code, objc_public_flag): New, moved from c-parse.in. (string_descriptor): New struct. (string_htab): New hash table. (string_hash, string_eq): New prototypes. (generate_struct_by_value_array): Call create_field_decl() instead of create_builtin_decl(). (objc_init): Do not initialize objc_ellipsis_node or TAG_EXECCLASS; In ObjC++ mode, call cxx_init() instead of c_objc_common_init(). (objc_finish_file): In ObjC++, call instantiate_pending_templates() and cp_finish_file(). (define_decl, get_static_reference, get_protocol_reference, create_builtin_decl): Remove functions. (objc_start_class_interface, objc_start_category_interface, objc_start_protocol, objc_continue_interface, objc_finish_interface, objc_start_class_implementation, objc_start_category_implementation, objc_continue_implementation, objc_finish_implementation, objc_set_visibility, objc_set_method_type, objc_build_method_signature, objc_add_method_declaration, objc_start_method_definition, objc_add_instance_variable, objc_get_protocol_qualified_type, create_field_decl, start_var_decl, finish_var_decl): New functions. (setup_string_decl): Simplify since it is only called once. (synth_module_prologue): Call build_class_template(); predefine 'id' and 'Class' as typedefs; rename 'temp_type' to 'type'; disable debug hooks for duration of function; fix GNU runtime messenger signatures to correspond to reality; forward-declare '__objc_exec_class' for the GNU runtime; call build_selector_table_decl(); in ObjC++ mode, generate 'extern "C" { ... }' wrappers around synthesized declarations; call build_protocol_template() and build_category_template(). (string_hash, string_eq): New functions. (objc_build_string_object): Check metaclass correctness only once; store string literals in hash table. (objc_build_constructor): Do not convert initializer elements; adjust for ObjC++ impedance mismatch. (build_objc_symtab_template): Call create_field_decl() instead of create_builtin_decl(). (init_objc_symtab): Add missing conversion to initializer element. (build_metadata_decl): Call start_var_decl() instead of define_decl(). (generate_objc_symtab_decl): Do not call build_category_template(); call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(). (build_module_descriptor): Call create_field_decl() instead of grokfield(); call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(); always mark module descriptor as used; move GNU runtime-specific functionality to build_module_initializer_routine(). (build_module_initializer_routine): New function, broken off of build_module_descriptor(). (objc_static_init_needed_p, objc_generate_static_init_call): New functions. (generate_static_references, generate_strings, build_selector_translation_table, generate_descriptor_table, generate_ivars_list, generate_dispatch_table, generate_category): Call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(); build a type directly instead of via groktypename(). (build_selector_reference_decl, build_selector_table_decl, build_class_reference_decl, build_protocol_reference, generate_objc_image_info): Call start_var_decl() instead of build_decl(). (build_selector_reference): For GNU runtime, do not call build_selector_reference_decl(). (build_selector, build_typed_selector_reference): Always convert result to the selector type. (add_objc_string): Cast return value to 'char *'. (build_method_prototype_template, build_selector_template, build_method_template): Use actual selector type for fields pointing to selectors. (finish_objc): For GNU runtime, call build_module_initializer_routine() after build_module_descriptor(). (generate_protocol_list, generate_shared_structures): Call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(); build a type directly instead of via groktypename(). (synth_id_with_class_suffix): Return a string. (get_arg_type_list): For instance methods, use the instance type for 'self'; do not call groktypename_in_parm_context(). (build_objc_string_decl): Squash redeclaration errors in ObjC++. (objc_is_class_name): Use OBJC_TYPE_NAME instead of TYPE_NAME; handle RECORD_TYPEs in ObjC as well as ObjC++. (objc_is_id): New function. (objc_is_object_ptr): Return the canonical type node. (objc_get_class_ivars): Simplify using get_class_ivars(). (get_class_ivars): Remove second parameter; create a fresh copy of the ivar list for each call; do not check for existence of super class. (objc_eh_runtime_type): Mark #ifndef OBJCPLUS. (objc_init_exceptions): When using SJLJ-style exceptions, require the use of '-fobjc-exceptions' flag; do not require it for DWARF-style exceptions. (objc_build_exc_ptr, next_sjlj_build_try_catch_finally): Use objc_object_type instead of objc_id_type. (objc_begin_catch_clause): Convert the incoming PARM_DECL into a VAR_DECL before placing it in the appropriate scope; do not call define_decl(); adjust call to c_begin_compound_stmt(); use objc_object_type instead of objc_id_type. (build_next_objc_exception_stuff): Call create_field_decl() instead of create_builtin_decl(); construct type directly instead of calling groktypename(); use OBJC_VOID_AT_END to mark end of function parameters. (build_private_template): Adjust call to get_class_ivars(); build a type directly instead of via groktypename(). (build_protocol_template, build_method_prototype_list_template, build_method_prototype_template, build_category_template, build_selector_template, build_class_template, build_super_template, build_ivar_template, build_ivar_list_template, build_method_list_template, build_method_template): Call create_field_decl() instead of grokfield(). (objc_method_parm_type): Do not call groktypename(). (generate_descriptor_table): Call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(). (generate_method_descriptors, build_protocol_initializer, generate_dispatch_tables, build_category_initializer, build_shared_structure_initializer): Do not call groktypename(). (generate_protocols): Call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(); do not call groktypename(). (error_with_ivar): Remove last parameter. (check_ivars): Do not iterate ovar CLASS_RAW_IVARS lists in addition to CLASS_IVARS lists; adjust calls to error_with_ivar(). (generate_ivar_lists): Convert one of the initializer elements; do not call groktypename(). (get_arg_type_list, start_method_def, gen_method_def): Account for new representation of variable arguments and '...' in Objective-C methods; add Objective-C++ impedance matching code. (is_objc_type_qualifier): Remove function. (adjust_type_for_id_default): Simplify; there is no longer a need to wade through declspecs. (lookup_interface, start_class, continue_class, finish_class, start_method_def, start_protocol, build_method_decl, objc_add_method, add_instance_variable, build_ivar_reference, is_ivar, is_private, get_super_receiver, objc_build_finally_epilogue): Make into static functions. (receiver_is_class_object): Use new IS_CLASS() macro. (objc_build_message_expr): Tweak ObjC++ message argument handling; call objc_finish_message_expr() instead of finish_message_expr(). (finish_message_expr): Rename to objc_finish_message_expr(); use OBJC_TYPE_NAME and OBJC_SET_TYPE_NAME macros instead of TYPE_NAME. call gen_type_name() instead of gen_declaration(); call objc_is_id() instead of using IS_ID and IS_CLASS; Use objc_class_name instead of calling get_identifier("Class"); handle CONVERT_EXPRs in receiver. (build_objc_method_call, warn_with_method): Do not call groktypename(). (build_ivar_reference): Call convert() instead of clobbering in a type. (hash_init): Initialize string_htab hash table. (add_instance_variable): Simplify parameter list; do not call grokfield(); do not populate CLASS_IVARS list. (start_class): Check for the existence of super class, if one was specified. (continue_class): Use CLASS_RAW_IVARS rather than CLASS_IVARS; do not call build_class_template(); adjust call to get_class_ivars(); call build_decl(), pushdecl() and finish_decl() instead of define_decl(). (finish_class): Call build_decl(), pushdecl() and finish_decl() instead of define_decl(). (add_protocols): Use PROTOCOL_BINFO_ELTS for the tree vector size. (start_protocol): Do not call build_protocol_template(); use PROTOCOL_BINFO_ELTS for the tree vector size. (encode_type_qualifiers): Do not handle the 'const' qualifier here. (encode_pointer): Encode 'const char *' as 'r*', for backwards compatibility. (encode_array): Use HOST_WIDE_INT_PRINT_DEC instead of "%ld". (encode_type): Handle the 'const' qualifier here. (objc_parmlist): New global variable, sued by objc_push_parm and objc_get_parm_info(). (objc_push_parm, objc_get_parm_info): New functions. (objc_expr_last): Remove function. (synth_self_and_ucmd_args): For instance methods, use the instance type for 'self'; call objc_push_parm() instead of push_parm_decl(). (start_method_def): Do not call push_scope(), declare_parm_level(), pop_scope(), push_parm_decl(), store_parm_decls() or objc_expr_last(); just use objc_push_parm() and objc_get_parm_info(). (comp_method_with_proto): Remove function. (objc_types_are_equivalent): Strip away indirections before comparing underlying types. (comp_proto_with_proto): Do not call groktypename(); types are no longer in raw declspec format. (objc_start_function): New function. (really_start_method): Call comp_proto_with_proto() instead of comp_method_with_proto(); call objc_start_function() instead of hand-crafting a function declarator. (continue_method_def, objc_expand_function_end): Remove functions. (get_super_receiver): Call objc_get_current_scope() instead of get_current_scope(); reference 'super_class' field (instead of 'class'). (finish_method_def): Rename to objc_finish_method_definition() and add a function decl parameter; move method encoding call from objc_expand_function_end(). (is_complex_decl, adorn_decl, gen_declarator, gen_declspecs, gen_declaration_1): Remove functions. (tmpbuf, RAW_DECLSPEC): Remove. (gen_declaration): Remove second parameter; simplify to deal with TYPE_P nodes instead of raw declspecs. (gen_type_name, gen_type_name_0): New functions. (gen_method_decl): Remove second parameter; call gen_type_name() instead of gen_declaration_1(). (dump_interface): Adjust calls to gen_declaration() and gen_method_decl(); do not allocate a separate string buffer. (init_objc): Allocate a larger string buffer to accommodate dump_interface(); adjust call to build_module_descriptor(); add call to build_module_initializer_routine() for the GNU runtime. (generate_classref_translation_entry): Do not call start_decl(); call finish_var_decl() instead of finish_decl(); call convert() instead of build_c_cast(). * objc-act.h (CLASS_OWN_IVARS): Remove accessor. (CLASS_BINFO_ELTS): Reduce from 6 to 5, now that CLASS_OWN_IVARS is gone. (OCTI_GNU_INIT_DECL, GNU_INIT_decl): New. (OCTI_ELLIPSIS_NODE, objc_ellipsis_node): Remove. (OCTI_ID_ID, id_type, objc_id_id): Rename to OCTI_ID_NAME, objc_object_type and objc_object_name, respectively. (OCTI_CLS_REF, OCTI_CLASS_NAME, objc_class_reference, objc_class_name): New. (IS_CLASS): New macro. (IS_ID, IS_SUPER): Robustify. (OCTI_EXECCLASS_DECL, execclass_decl): New. (finish_file, start_class, continue_class, finish_class, start_method_def, continue_method_def, finish_method_def, start_protocol, finish_protocol, objc_build_throw_stmt, objc_build_try_catch_finally_stmt, objc_build_synchronized_prologue, objc_build_synchronized_epilogue, objc_build_try_prologue, objc_build_try_epilogue, objc_build_catch_stmt, objc_build_catch_epilogue, objc_build_finally_prologue, objc_build_finally_epilogue, is_ivar, is_private, is_public, add_instance_variable, objc_add_method, get_super_receiver, objc_clear_super_receiver, get_class_ivars_from_name, get_class_reference, get_static_reference, get_object_reference, build_message_expr, finish_message_expr, build_selector_expr, build_ivar_reference, build_keyword_decl, build_method_decl, build_protocol_expr, build_objc_string_object, objc_declare_alias, objc_declare_class, objc_declare_protocols, objc_comptypes, objc_check_decl, build_encode_expr): Remove prototypes. (imp_count, cat_count): Make GGC-aware. (OBJC_SET_TYPE_NAME): New macro. From-SVN: r87168
2004-09-08 02:49:44 +02:00
parm_info = next;
}
c-tree.h (enum c_declarator_kind, [...]): New. * c-tree.h (enum c_declarator_kind, struct c_arg_info, struct c_declarator, struct c_type_name, struct c_parm): New. (build_array_declarator, set_array_declarator_inner, get_parm_info, grokfield, groktypename, grokparm, push_parm_decl, start_function, start_decl, build_c_parm, build_attrs_declarator, build_function_declarator, make_pointer_declarator, c_cast_expr, store_parm_decls_newstyle, c_expr_sizeof_type): Update prototypes. (build_id_declarator): New. * c-typeck.c (c_cast_expr, c_expr_sizeof_type): Update to new structures. * c-decl.c (ARG_INFO_PARMS, ARG_INFO_TAGS, ARG_INFO_TYPES, ARG_INFO_OTHERS): Remove. (build_id_declarator): New. (build_array_declarator, set_array_declarator_inner, groktypename, start_decl, grokparm, push_parm_decl, grokparms, get_parm_info, grokfield, start_function, store_parm_decls_newstyle, store_parm_decls_oldstyle, store_parm_decls, build_c_parm, build_attrs_declarator, build_function_declarator, make_pointer_declarator, grokdeclarator): Update to new structures. * c-parse.in (%union): Add arginfotype, dtrtype, typenametype and parmtype. (declarator, notype_declarator, after_type_declarator, parm_declarator, parm_declarator_starttypename, parm_declarator_nostarttypename, array_declarator, typename, absdcl, absdcl1, absdcl1_ea, absdcl1_noea, direct_absdcl1, absdcl_maybe_attribute, parm, firstparm, parms, parmlist, parmlist_1, parmlist_2, parmlist_or_identifiers, parmlist_or_identifiers_1): Use these types. (primary, after_type_declarator, parm_declarator_starttypename, notype_declarator, component_decl, component_declarator, component_notype_declarator, typename, absdcl, absdcl_maybe_attribute, absdcl1_ea, direct_absdcl1, parmlist_1, parmlist_2, parmlist_or_identifiers_1): Update to new structures. objc: * objc-act.c (objc_start_function, really_start_method, objc_get_parm_info, start_method_def): Update to new arg_info structures. From-SVN: r87217
2004-09-09 03:19:15 +02:00
arg_info = get_parm_info (have_ellipsis);
Makefile.in (c-parse.o): Depend on $(C_COMMON_H). [gcc/ChangeLog] 2004-09-07 Ziemowit Laski <zlaski@apple.com> * Makefile.in (c-parse.o): Depend on $(C_COMMON_H). * c-parse.in: Include c-common.h instead of objc-act.h. (ivar_decl_list, ivar_decls, ivar_decl, ivars, ivar_declarator, myparms, myparm): Remove %type declarations. (methodtype, optparms, OBJC_TYPE_QUAL, objc_quals, objc_qual, objc_typename, objc_try_catch_stmt, optellipsis): Add %type declarations. (objc_inherit_code, objc_public_flag): Remove. (typespec_nonreserved_nonattr): Call objc_get_protocol_qualified_type() instead of get_static_reference() and get_protocol_reference(). (stmt_nocomp): Call grokparm() on @catch parameter. (objcdef): Move semantic action to objc_finish_implementation(). (classdef): Move semantic action to objc_start_class_interface(), objc_continue_interface(), objc_finish_interface(), objc_start_class_implementation(), objc_continue_implementation(), objc_start_category_interface() and objc_start_category_implementation(). (protocoldef): Move semantic actions to objc_start_protocol() and objc_finish_interface(). (ivar_decl_list): Remove nonterminal. (visibility_spec): Move semantic actions to objc_set_visibility(). (ivar_decls): Remove assignment to $$. (ivar_decl): Rephrase in terms of component_decl; call objc_add_instance_variable(). (ivars, ivar_declarator): Remove nonterminals. (opt_semi): New nonterminal. (methodtype): Remove semantic actions. (methoddef): Move semantic actions to objc_set_method_type(), objc_start_method_definition() and objc_finish_method_definition(). (methodproto): Move semantic actions to objc_set_method_type() and objc_add_method_declaration(). (methoddecl): Use objc_typename instead of typename; move semantic actions to objc_build_method_signature(). (optarglist, myxdecls, mydecl, myparms, myparm): Remove nonterminals. (optparmlist): Express in terms of optparms and optellipsis. (optparms, optellipsis, objc_qual, objc_quals, objc_typename): New nonterminals. (keyworddecl): Use objc_typename instead of typename. (rid_to_yy): Mark RID_IN, RID_OUT, RID_INOUT, RID_BYCOPY, RID_BYREF and RID_ONEWAY as returning OBJC_TYPE_QUAL to yyparse(). [gcc/objc/ChangeLog] 2004-09-07 Ziemowit Laski <zlaski@apple.com> * Make-lang.in (objc/objc-parse.o): Depend on $(C_COMMON_H) instead of objc/objc-act.h. (objc/objc-act.o): Depend on $(HASHTAB_H). * objc-act.c: Include hashtab.h; in ObjC++ mode, include cp-tree.h and objcp-decl.h instead of c-tree.h. (build_module_descriptor, get_class_ivars, synth_id_with_class_suffix, error_with_ivar, gen_method_decl, gen_declaration, setup_string_decl, build_protocol_template): Adjust prototypes. (build_module_initializer_routine, start_class, continue_class, finish_class, start_method_def, objc_start_function, start_protocol, build_method_decl, objc_add_method, add_instance_variable, build_ivar_reference, is_ivar, is_private, get_super_receiver, build_selector_table_decl, objc_push_parm, objc_get_parm_info, gen_type_name, gen_type_name_0, start_var_decl, finish_var_decl, create_field_decl): New prototypes. (objc_expand_function_end, comp_method_with_proto, objc_expr_last, gen_declaration_1, gen_declarator, is_complex_decl, adorn_decl, define_decl, create_builtin_decl, gen_declspecs): Remove prototypes. (TYPE_ID): Rename to OBJECT_TYPEDEF_NAME. (CLASS_TYPEDEF_NAME): New. (TAG_EXECCLASS): Change from a global variable to a #define. (TAG_RETURN_STRUCT): Delete. (TAG_GNUINIT): New, holds '__objc_gnu_init' name. (objc_inherit_code, objc_public_flag): New, moved from c-parse.in. (string_descriptor): New struct. (string_htab): New hash table. (string_hash, string_eq): New prototypes. (generate_struct_by_value_array): Call create_field_decl() instead of create_builtin_decl(). (objc_init): Do not initialize objc_ellipsis_node or TAG_EXECCLASS; In ObjC++ mode, call cxx_init() instead of c_objc_common_init(). (objc_finish_file): In ObjC++, call instantiate_pending_templates() and cp_finish_file(). (define_decl, get_static_reference, get_protocol_reference, create_builtin_decl): Remove functions. (objc_start_class_interface, objc_start_category_interface, objc_start_protocol, objc_continue_interface, objc_finish_interface, objc_start_class_implementation, objc_start_category_implementation, objc_continue_implementation, objc_finish_implementation, objc_set_visibility, objc_set_method_type, objc_build_method_signature, objc_add_method_declaration, objc_start_method_definition, objc_add_instance_variable, objc_get_protocol_qualified_type, create_field_decl, start_var_decl, finish_var_decl): New functions. (setup_string_decl): Simplify since it is only called once. (synth_module_prologue): Call build_class_template(); predefine 'id' and 'Class' as typedefs; rename 'temp_type' to 'type'; disable debug hooks for duration of function; fix GNU runtime messenger signatures to correspond to reality; forward-declare '__objc_exec_class' for the GNU runtime; call build_selector_table_decl(); in ObjC++ mode, generate 'extern "C" { ... }' wrappers around synthesized declarations; call build_protocol_template() and build_category_template(). (string_hash, string_eq): New functions. (objc_build_string_object): Check metaclass correctness only once; store string literals in hash table. (objc_build_constructor): Do not convert initializer elements; adjust for ObjC++ impedance mismatch. (build_objc_symtab_template): Call create_field_decl() instead of create_builtin_decl(). (init_objc_symtab): Add missing conversion to initializer element. (build_metadata_decl): Call start_var_decl() instead of define_decl(). (generate_objc_symtab_decl): Do not call build_category_template(); call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(). (build_module_descriptor): Call create_field_decl() instead of grokfield(); call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(); always mark module descriptor as used; move GNU runtime-specific functionality to build_module_initializer_routine(). (build_module_initializer_routine): New function, broken off of build_module_descriptor(). (objc_static_init_needed_p, objc_generate_static_init_call): New functions. (generate_static_references, generate_strings, build_selector_translation_table, generate_descriptor_table, generate_ivars_list, generate_dispatch_table, generate_category): Call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(); build a type directly instead of via groktypename(). (build_selector_reference_decl, build_selector_table_decl, build_class_reference_decl, build_protocol_reference, generate_objc_image_info): Call start_var_decl() instead of build_decl(). (build_selector_reference): For GNU runtime, do not call build_selector_reference_decl(). (build_selector, build_typed_selector_reference): Always convert result to the selector type. (add_objc_string): Cast return value to 'char *'. (build_method_prototype_template, build_selector_template, build_method_template): Use actual selector type for fields pointing to selectors. (finish_objc): For GNU runtime, call build_module_initializer_routine() after build_module_descriptor(). (generate_protocol_list, generate_shared_structures): Call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(); build a type directly instead of via groktypename(). (synth_id_with_class_suffix): Return a string. (get_arg_type_list): For instance methods, use the instance type for 'self'; do not call groktypename_in_parm_context(). (build_objc_string_decl): Squash redeclaration errors in ObjC++. (objc_is_class_name): Use OBJC_TYPE_NAME instead of TYPE_NAME; handle RECORD_TYPEs in ObjC as well as ObjC++. (objc_is_id): New function. (objc_is_object_ptr): Return the canonical type node. (objc_get_class_ivars): Simplify using get_class_ivars(). (get_class_ivars): Remove second parameter; create a fresh copy of the ivar list for each call; do not check for existence of super class. (objc_eh_runtime_type): Mark #ifndef OBJCPLUS. (objc_init_exceptions): When using SJLJ-style exceptions, require the use of '-fobjc-exceptions' flag; do not require it for DWARF-style exceptions. (objc_build_exc_ptr, next_sjlj_build_try_catch_finally): Use objc_object_type instead of objc_id_type. (objc_begin_catch_clause): Convert the incoming PARM_DECL into a VAR_DECL before placing it in the appropriate scope; do not call define_decl(); adjust call to c_begin_compound_stmt(); use objc_object_type instead of objc_id_type. (build_next_objc_exception_stuff): Call create_field_decl() instead of create_builtin_decl(); construct type directly instead of calling groktypename(); use OBJC_VOID_AT_END to mark end of function parameters. (build_private_template): Adjust call to get_class_ivars(); build a type directly instead of via groktypename(). (build_protocol_template, build_method_prototype_list_template, build_method_prototype_template, build_category_template, build_selector_template, build_class_template, build_super_template, build_ivar_template, build_ivar_list_template, build_method_list_template, build_method_template): Call create_field_decl() instead of grokfield(). (objc_method_parm_type): Do not call groktypename(). (generate_descriptor_table): Call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(). (generate_method_descriptors, build_protocol_initializer, generate_dispatch_tables, build_category_initializer, build_shared_structure_initializer): Do not call groktypename(). (generate_protocols): Call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(); do not call groktypename(). (error_with_ivar): Remove last parameter. (check_ivars): Do not iterate ovar CLASS_RAW_IVARS lists in addition to CLASS_IVARS lists; adjust calls to error_with_ivar(). (generate_ivar_lists): Convert one of the initializer elements; do not call groktypename(). (get_arg_type_list, start_method_def, gen_method_def): Account for new representation of variable arguments and '...' in Objective-C methods; add Objective-C++ impedance matching code. (is_objc_type_qualifier): Remove function. (adjust_type_for_id_default): Simplify; there is no longer a need to wade through declspecs. (lookup_interface, start_class, continue_class, finish_class, start_method_def, start_protocol, build_method_decl, objc_add_method, add_instance_variable, build_ivar_reference, is_ivar, is_private, get_super_receiver, objc_build_finally_epilogue): Make into static functions. (receiver_is_class_object): Use new IS_CLASS() macro. (objc_build_message_expr): Tweak ObjC++ message argument handling; call objc_finish_message_expr() instead of finish_message_expr(). (finish_message_expr): Rename to objc_finish_message_expr(); use OBJC_TYPE_NAME and OBJC_SET_TYPE_NAME macros instead of TYPE_NAME. call gen_type_name() instead of gen_declaration(); call objc_is_id() instead of using IS_ID and IS_CLASS; Use objc_class_name instead of calling get_identifier("Class"); handle CONVERT_EXPRs in receiver. (build_objc_method_call, warn_with_method): Do not call groktypename(). (build_ivar_reference): Call convert() instead of clobbering in a type. (hash_init): Initialize string_htab hash table. (add_instance_variable): Simplify parameter list; do not call grokfield(); do not populate CLASS_IVARS list. (start_class): Check for the existence of super class, if one was specified. (continue_class): Use CLASS_RAW_IVARS rather than CLASS_IVARS; do not call build_class_template(); adjust call to get_class_ivars(); call build_decl(), pushdecl() and finish_decl() instead of define_decl(). (finish_class): Call build_decl(), pushdecl() and finish_decl() instead of define_decl(). (add_protocols): Use PROTOCOL_BINFO_ELTS for the tree vector size. (start_protocol): Do not call build_protocol_template(); use PROTOCOL_BINFO_ELTS for the tree vector size. (encode_type_qualifiers): Do not handle the 'const' qualifier here. (encode_pointer): Encode 'const char *' as 'r*', for backwards compatibility. (encode_array): Use HOST_WIDE_INT_PRINT_DEC instead of "%ld". (encode_type): Handle the 'const' qualifier here. (objc_parmlist): New global variable, sued by objc_push_parm and objc_get_parm_info(). (objc_push_parm, objc_get_parm_info): New functions. (objc_expr_last): Remove function. (synth_self_and_ucmd_args): For instance methods, use the instance type for 'self'; call objc_push_parm() instead of push_parm_decl(). (start_method_def): Do not call push_scope(), declare_parm_level(), pop_scope(), push_parm_decl(), store_parm_decls() or objc_expr_last(); just use objc_push_parm() and objc_get_parm_info(). (comp_method_with_proto): Remove function. (objc_types_are_equivalent): Strip away indirections before comparing underlying types. (comp_proto_with_proto): Do not call groktypename(); types are no longer in raw declspec format. (objc_start_function): New function. (really_start_method): Call comp_proto_with_proto() instead of comp_method_with_proto(); call objc_start_function() instead of hand-crafting a function declarator. (continue_method_def, objc_expand_function_end): Remove functions. (get_super_receiver): Call objc_get_current_scope() instead of get_current_scope(); reference 'super_class' field (instead of 'class'). (finish_method_def): Rename to objc_finish_method_definition() and add a function decl parameter; move method encoding call from objc_expand_function_end(). (is_complex_decl, adorn_decl, gen_declarator, gen_declspecs, gen_declaration_1): Remove functions. (tmpbuf, RAW_DECLSPEC): Remove. (gen_declaration): Remove second parameter; simplify to deal with TYPE_P nodes instead of raw declspecs. (gen_type_name, gen_type_name_0): New functions. (gen_method_decl): Remove second parameter; call gen_type_name() instead of gen_declaration_1(). (dump_interface): Adjust calls to gen_declaration() and gen_method_decl(); do not allocate a separate string buffer. (init_objc): Allocate a larger string buffer to accommodate dump_interface(); adjust call to build_module_descriptor(); add call to build_module_initializer_routine() for the GNU runtime. (generate_classref_translation_entry): Do not call start_decl(); call finish_var_decl() instead of finish_decl(); call convert() instead of build_c_cast(). * objc-act.h (CLASS_OWN_IVARS): Remove accessor. (CLASS_BINFO_ELTS): Reduce from 6 to 5, now that CLASS_OWN_IVARS is gone. (OCTI_GNU_INIT_DECL, GNU_INIT_decl): New. (OCTI_ELLIPSIS_NODE, objc_ellipsis_node): Remove. (OCTI_ID_ID, id_type, objc_id_id): Rename to OCTI_ID_NAME, objc_object_type and objc_object_name, respectively. (OCTI_CLS_REF, OCTI_CLASS_NAME, objc_class_reference, objc_class_name): New. (IS_CLASS): New macro. (IS_ID, IS_SUPER): Robustify. (OCTI_EXECCLASS_DECL, execclass_decl): New. (finish_file, start_class, continue_class, finish_class, start_method_def, continue_method_def, finish_method_def, start_protocol, finish_protocol, objc_build_throw_stmt, objc_build_try_catch_finally_stmt, objc_build_synchronized_prologue, objc_build_synchronized_epilogue, objc_build_try_prologue, objc_build_try_epilogue, objc_build_catch_stmt, objc_build_catch_epilogue, objc_build_finally_prologue, objc_build_finally_epilogue, is_ivar, is_private, is_public, add_instance_variable, objc_add_method, get_super_receiver, objc_clear_super_receiver, get_class_ivars_from_name, get_class_reference, get_static_reference, get_object_reference, build_message_expr, finish_message_expr, build_selector_expr, build_ivar_reference, build_keyword_decl, build_method_decl, build_protocol_expr, build_objc_string_object, objc_declare_alias, objc_declare_class, objc_declare_protocols, objc_comptypes, objc_check_decl, build_encode_expr): Remove prototypes. (imp_count, cat_count): Make GGC-aware. (OBJC_SET_TYPE_NAME): New macro. From-SVN: r87168
2004-09-08 02:49:44 +02:00
pop_scope ();
objc_parmlist = NULL_TREE;
c-tree.h (enum c_declarator_kind, [...]): New. * c-tree.h (enum c_declarator_kind, struct c_arg_info, struct c_declarator, struct c_type_name, struct c_parm): New. (build_array_declarator, set_array_declarator_inner, get_parm_info, grokfield, groktypename, grokparm, push_parm_decl, start_function, start_decl, build_c_parm, build_attrs_declarator, build_function_declarator, make_pointer_declarator, c_cast_expr, store_parm_decls_newstyle, c_expr_sizeof_type): Update prototypes. (build_id_declarator): New. * c-typeck.c (c_cast_expr, c_expr_sizeof_type): Update to new structures. * c-decl.c (ARG_INFO_PARMS, ARG_INFO_TAGS, ARG_INFO_TYPES, ARG_INFO_OTHERS): Remove. (build_id_declarator): New. (build_array_declarator, set_array_declarator_inner, groktypename, start_decl, grokparm, push_parm_decl, grokparms, get_parm_info, grokfield, start_function, store_parm_decls_newstyle, store_parm_decls_oldstyle, store_parm_decls, build_c_parm, build_attrs_declarator, build_function_declarator, make_pointer_declarator, grokdeclarator): Update to new structures. * c-parse.in (%union): Add arginfotype, dtrtype, typenametype and parmtype. (declarator, notype_declarator, after_type_declarator, parm_declarator, parm_declarator_starttypename, parm_declarator_nostarttypename, array_declarator, typename, absdcl, absdcl1, absdcl1_ea, absdcl1_noea, direct_absdcl1, absdcl_maybe_attribute, parm, firstparm, parms, parmlist, parmlist_1, parmlist_2, parmlist_or_identifiers, parmlist_or_identifiers_1): Use these types. (primary, after_type_declarator, parm_declarator_starttypename, notype_declarator, component_decl, component_declarator, component_notype_declarator, typename, absdcl, absdcl_maybe_attribute, absdcl1_ea, direct_absdcl1, parmlist_1, parmlist_2, parmlist_or_identifiers_1): Update to new structures. objc: * objc-act.c (objc_start_function, really_start_method, objc_get_parm_info, start_method_def): Update to new arg_info structures. From-SVN: r87217
2004-09-09 03:19:15 +02:00
return arg_info;
#endif
1992-01-18 00:15:38 +01:00
}
Makefile.in (c-parse.o): Depend on $(C_COMMON_H). [gcc/ChangeLog] 2004-09-07 Ziemowit Laski <zlaski@apple.com> * Makefile.in (c-parse.o): Depend on $(C_COMMON_H). * c-parse.in: Include c-common.h instead of objc-act.h. (ivar_decl_list, ivar_decls, ivar_decl, ivars, ivar_declarator, myparms, myparm): Remove %type declarations. (methodtype, optparms, OBJC_TYPE_QUAL, objc_quals, objc_qual, objc_typename, objc_try_catch_stmt, optellipsis): Add %type declarations. (objc_inherit_code, objc_public_flag): Remove. (typespec_nonreserved_nonattr): Call objc_get_protocol_qualified_type() instead of get_static_reference() and get_protocol_reference(). (stmt_nocomp): Call grokparm() on @catch parameter. (objcdef): Move semantic action to objc_finish_implementation(). (classdef): Move semantic action to objc_start_class_interface(), objc_continue_interface(), objc_finish_interface(), objc_start_class_implementation(), objc_continue_implementation(), objc_start_category_interface() and objc_start_category_implementation(). (protocoldef): Move semantic actions to objc_start_protocol() and objc_finish_interface(). (ivar_decl_list): Remove nonterminal. (visibility_spec): Move semantic actions to objc_set_visibility(). (ivar_decls): Remove assignment to $$. (ivar_decl): Rephrase in terms of component_decl; call objc_add_instance_variable(). (ivars, ivar_declarator): Remove nonterminals. (opt_semi): New nonterminal. (methodtype): Remove semantic actions. (methoddef): Move semantic actions to objc_set_method_type(), objc_start_method_definition() and objc_finish_method_definition(). (methodproto): Move semantic actions to objc_set_method_type() and objc_add_method_declaration(). (methoddecl): Use objc_typename instead of typename; move semantic actions to objc_build_method_signature(). (optarglist, myxdecls, mydecl, myparms, myparm): Remove nonterminals. (optparmlist): Express in terms of optparms and optellipsis. (optparms, optellipsis, objc_qual, objc_quals, objc_typename): New nonterminals. (keyworddecl): Use objc_typename instead of typename. (rid_to_yy): Mark RID_IN, RID_OUT, RID_INOUT, RID_BYCOPY, RID_BYREF and RID_ONEWAY as returning OBJC_TYPE_QUAL to yyparse(). [gcc/objc/ChangeLog] 2004-09-07 Ziemowit Laski <zlaski@apple.com> * Make-lang.in (objc/objc-parse.o): Depend on $(C_COMMON_H) instead of objc/objc-act.h. (objc/objc-act.o): Depend on $(HASHTAB_H). * objc-act.c: Include hashtab.h; in ObjC++ mode, include cp-tree.h and objcp-decl.h instead of c-tree.h. (build_module_descriptor, get_class_ivars, synth_id_with_class_suffix, error_with_ivar, gen_method_decl, gen_declaration, setup_string_decl, build_protocol_template): Adjust prototypes. (build_module_initializer_routine, start_class, continue_class, finish_class, start_method_def, objc_start_function, start_protocol, build_method_decl, objc_add_method, add_instance_variable, build_ivar_reference, is_ivar, is_private, get_super_receiver, build_selector_table_decl, objc_push_parm, objc_get_parm_info, gen_type_name, gen_type_name_0, start_var_decl, finish_var_decl, create_field_decl): New prototypes. (objc_expand_function_end, comp_method_with_proto, objc_expr_last, gen_declaration_1, gen_declarator, is_complex_decl, adorn_decl, define_decl, create_builtin_decl, gen_declspecs): Remove prototypes. (TYPE_ID): Rename to OBJECT_TYPEDEF_NAME. (CLASS_TYPEDEF_NAME): New. (TAG_EXECCLASS): Change from a global variable to a #define. (TAG_RETURN_STRUCT): Delete. (TAG_GNUINIT): New, holds '__objc_gnu_init' name. (objc_inherit_code, objc_public_flag): New, moved from c-parse.in. (string_descriptor): New struct. (string_htab): New hash table. (string_hash, string_eq): New prototypes. (generate_struct_by_value_array): Call create_field_decl() instead of create_builtin_decl(). (objc_init): Do not initialize objc_ellipsis_node or TAG_EXECCLASS; In ObjC++ mode, call cxx_init() instead of c_objc_common_init(). (objc_finish_file): In ObjC++, call instantiate_pending_templates() and cp_finish_file(). (define_decl, get_static_reference, get_protocol_reference, create_builtin_decl): Remove functions. (objc_start_class_interface, objc_start_category_interface, objc_start_protocol, objc_continue_interface, objc_finish_interface, objc_start_class_implementation, objc_start_category_implementation, objc_continue_implementation, objc_finish_implementation, objc_set_visibility, objc_set_method_type, objc_build_method_signature, objc_add_method_declaration, objc_start_method_definition, objc_add_instance_variable, objc_get_protocol_qualified_type, create_field_decl, start_var_decl, finish_var_decl): New functions. (setup_string_decl): Simplify since it is only called once. (synth_module_prologue): Call build_class_template(); predefine 'id' and 'Class' as typedefs; rename 'temp_type' to 'type'; disable debug hooks for duration of function; fix GNU runtime messenger signatures to correspond to reality; forward-declare '__objc_exec_class' for the GNU runtime; call build_selector_table_decl(); in ObjC++ mode, generate 'extern "C" { ... }' wrappers around synthesized declarations; call build_protocol_template() and build_category_template(). (string_hash, string_eq): New functions. (objc_build_string_object): Check metaclass correctness only once; store string literals in hash table. (objc_build_constructor): Do not convert initializer elements; adjust for ObjC++ impedance mismatch. (build_objc_symtab_template): Call create_field_decl() instead of create_builtin_decl(). (init_objc_symtab): Add missing conversion to initializer element. (build_metadata_decl): Call start_var_decl() instead of define_decl(). (generate_objc_symtab_decl): Do not call build_category_template(); call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(). (build_module_descriptor): Call create_field_decl() instead of grokfield(); call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(); always mark module descriptor as used; move GNU runtime-specific functionality to build_module_initializer_routine(). (build_module_initializer_routine): New function, broken off of build_module_descriptor(). (objc_static_init_needed_p, objc_generate_static_init_call): New functions. (generate_static_references, generate_strings, build_selector_translation_table, generate_descriptor_table, generate_ivars_list, generate_dispatch_table, generate_category): Call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(); build a type directly instead of via groktypename(). (build_selector_reference_decl, build_selector_table_decl, build_class_reference_decl, build_protocol_reference, generate_objc_image_info): Call start_var_decl() instead of build_decl(). (build_selector_reference): For GNU runtime, do not call build_selector_reference_decl(). (build_selector, build_typed_selector_reference): Always convert result to the selector type. (add_objc_string): Cast return value to 'char *'. (build_method_prototype_template, build_selector_template, build_method_template): Use actual selector type for fields pointing to selectors. (finish_objc): For GNU runtime, call build_module_initializer_routine() after build_module_descriptor(). (generate_protocol_list, generate_shared_structures): Call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(); build a type directly instead of via groktypename(). (synth_id_with_class_suffix): Return a string. (get_arg_type_list): For instance methods, use the instance type for 'self'; do not call groktypename_in_parm_context(). (build_objc_string_decl): Squash redeclaration errors in ObjC++. (objc_is_class_name): Use OBJC_TYPE_NAME instead of TYPE_NAME; handle RECORD_TYPEs in ObjC as well as ObjC++. (objc_is_id): New function. (objc_is_object_ptr): Return the canonical type node. (objc_get_class_ivars): Simplify using get_class_ivars(). (get_class_ivars): Remove second parameter; create a fresh copy of the ivar list for each call; do not check for existence of super class. (objc_eh_runtime_type): Mark #ifndef OBJCPLUS. (objc_init_exceptions): When using SJLJ-style exceptions, require the use of '-fobjc-exceptions' flag; do not require it for DWARF-style exceptions. (objc_build_exc_ptr, next_sjlj_build_try_catch_finally): Use objc_object_type instead of objc_id_type. (objc_begin_catch_clause): Convert the incoming PARM_DECL into a VAR_DECL before placing it in the appropriate scope; do not call define_decl(); adjust call to c_begin_compound_stmt(); use objc_object_type instead of objc_id_type. (build_next_objc_exception_stuff): Call create_field_decl() instead of create_builtin_decl(); construct type directly instead of calling groktypename(); use OBJC_VOID_AT_END to mark end of function parameters. (build_private_template): Adjust call to get_class_ivars(); build a type directly instead of via groktypename(). (build_protocol_template, build_method_prototype_list_template, build_method_prototype_template, build_category_template, build_selector_template, build_class_template, build_super_template, build_ivar_template, build_ivar_list_template, build_method_list_template, build_method_template): Call create_field_decl() instead of grokfield(). (objc_method_parm_type): Do not call groktypename(). (generate_descriptor_table): Call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(). (generate_method_descriptors, build_protocol_initializer, generate_dispatch_tables, build_category_initializer, build_shared_structure_initializer): Do not call groktypename(). (generate_protocols): Call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(); do not call groktypename(). (error_with_ivar): Remove last parameter. (check_ivars): Do not iterate ovar CLASS_RAW_IVARS lists in addition to CLASS_IVARS lists; adjust calls to error_with_ivar(). (generate_ivar_lists): Convert one of the initializer elements; do not call groktypename(). (get_arg_type_list, start_method_def, gen_method_def): Account for new representation of variable arguments and '...' in Objective-C methods; add Objective-C++ impedance matching code. (is_objc_type_qualifier): Remove function. (adjust_type_for_id_default): Simplify; there is no longer a need to wade through declspecs. (lookup_interface, start_class, continue_class, finish_class, start_method_def, start_protocol, build_method_decl, objc_add_method, add_instance_variable, build_ivar_reference, is_ivar, is_private, get_super_receiver, objc_build_finally_epilogue): Make into static functions. (receiver_is_class_object): Use new IS_CLASS() macro. (objc_build_message_expr): Tweak ObjC++ message argument handling; call objc_finish_message_expr() instead of finish_message_expr(). (finish_message_expr): Rename to objc_finish_message_expr(); use OBJC_TYPE_NAME and OBJC_SET_TYPE_NAME macros instead of TYPE_NAME. call gen_type_name() instead of gen_declaration(); call objc_is_id() instead of using IS_ID and IS_CLASS; Use objc_class_name instead of calling get_identifier("Class"); handle CONVERT_EXPRs in receiver. (build_objc_method_call, warn_with_method): Do not call groktypename(). (build_ivar_reference): Call convert() instead of clobbering in a type. (hash_init): Initialize string_htab hash table. (add_instance_variable): Simplify parameter list; do not call grokfield(); do not populate CLASS_IVARS list. (start_class): Check for the existence of super class, if one was specified. (continue_class): Use CLASS_RAW_IVARS rather than CLASS_IVARS; do not call build_class_template(); adjust call to get_class_ivars(); call build_decl(), pushdecl() and finish_decl() instead of define_decl(). (finish_class): Call build_decl(), pushdecl() and finish_decl() instead of define_decl(). (add_protocols): Use PROTOCOL_BINFO_ELTS for the tree vector size. (start_protocol): Do not call build_protocol_template(); use PROTOCOL_BINFO_ELTS for the tree vector size. (encode_type_qualifiers): Do not handle the 'const' qualifier here. (encode_pointer): Encode 'const char *' as 'r*', for backwards compatibility. (encode_array): Use HOST_WIDE_INT_PRINT_DEC instead of "%ld". (encode_type): Handle the 'const' qualifier here. (objc_parmlist): New global variable, sued by objc_push_parm and objc_get_parm_info(). (objc_push_parm, objc_get_parm_info): New functions. (objc_expr_last): Remove function. (synth_self_and_ucmd_args): For instance methods, use the instance type for 'self'; call objc_push_parm() instead of push_parm_decl(). (start_method_def): Do not call push_scope(), declare_parm_level(), pop_scope(), push_parm_decl(), store_parm_decls() or objc_expr_last(); just use objc_push_parm() and objc_get_parm_info(). (comp_method_with_proto): Remove function. (objc_types_are_equivalent): Strip away indirections before comparing underlying types. (comp_proto_with_proto): Do not call groktypename(); types are no longer in raw declspec format. (objc_start_function): New function. (really_start_method): Call comp_proto_with_proto() instead of comp_method_with_proto(); call objc_start_function() instead of hand-crafting a function declarator. (continue_method_def, objc_expand_function_end): Remove functions. (get_super_receiver): Call objc_get_current_scope() instead of get_current_scope(); reference 'super_class' field (instead of 'class'). (finish_method_def): Rename to objc_finish_method_definition() and add a function decl parameter; move method encoding call from objc_expand_function_end(). (is_complex_decl, adorn_decl, gen_declarator, gen_declspecs, gen_declaration_1): Remove functions. (tmpbuf, RAW_DECLSPEC): Remove. (gen_declaration): Remove second parameter; simplify to deal with TYPE_P nodes instead of raw declspecs. (gen_type_name, gen_type_name_0): New functions. (gen_method_decl): Remove second parameter; call gen_type_name() instead of gen_declaration_1(). (dump_interface): Adjust calls to gen_declaration() and gen_method_decl(); do not allocate a separate string buffer. (init_objc): Allocate a larger string buffer to accommodate dump_interface(); adjust call to build_module_descriptor(); add call to build_module_initializer_routine() for the GNU runtime. (generate_classref_translation_entry): Do not call start_decl(); call finish_var_decl() instead of finish_decl(); call convert() instead of build_c_cast(). * objc-act.h (CLASS_OWN_IVARS): Remove accessor. (CLASS_BINFO_ELTS): Reduce from 6 to 5, now that CLASS_OWN_IVARS is gone. (OCTI_GNU_INIT_DECL, GNU_INIT_decl): New. (OCTI_ELLIPSIS_NODE, objc_ellipsis_node): Remove. (OCTI_ID_ID, id_type, objc_id_id): Rename to OCTI_ID_NAME, objc_object_type and objc_object_name, respectively. (OCTI_CLS_REF, OCTI_CLASS_NAME, objc_class_reference, objc_class_name): New. (IS_CLASS): New macro. (IS_ID, IS_SUPER): Robustify. (OCTI_EXECCLASS_DECL, execclass_decl): New. (finish_file, start_class, continue_class, finish_class, start_method_def, continue_method_def, finish_method_def, start_protocol, finish_protocol, objc_build_throw_stmt, objc_build_try_catch_finally_stmt, objc_build_synchronized_prologue, objc_build_synchronized_epilogue, objc_build_try_prologue, objc_build_try_epilogue, objc_build_catch_stmt, objc_build_catch_epilogue, objc_build_finally_prologue, objc_build_finally_epilogue, is_ivar, is_private, is_public, add_instance_variable, objc_add_method, get_super_receiver, objc_clear_super_receiver, get_class_ivars_from_name, get_class_reference, get_static_reference, get_object_reference, build_message_expr, finish_message_expr, build_selector_expr, build_ivar_reference, build_keyword_decl, build_method_decl, build_protocol_expr, build_objc_string_object, objc_declare_alias, objc_declare_class, objc_declare_protocols, objc_comptypes, objc_check_decl, build_encode_expr): Remove prototypes. (imp_count, cat_count): Make GGC-aware. (OBJC_SET_TYPE_NAME): New macro. From-SVN: r87168
2004-09-08 02:49:44 +02:00
/* Synthesize the formal parameters 'id self' and 'SEL _cmd' needed for ObjC
method definitions. In the case of instance methods, we can be more
specific as to the type of 'self'. */
static void
synth_self_and_ucmd_args (void)
1992-01-18 00:15:38 +01:00
{
Makefile.in (c-parse.o): Depend on $(C_COMMON_H). [gcc/ChangeLog] 2004-09-07 Ziemowit Laski <zlaski@apple.com> * Makefile.in (c-parse.o): Depend on $(C_COMMON_H). * c-parse.in: Include c-common.h instead of objc-act.h. (ivar_decl_list, ivar_decls, ivar_decl, ivars, ivar_declarator, myparms, myparm): Remove %type declarations. (methodtype, optparms, OBJC_TYPE_QUAL, objc_quals, objc_qual, objc_typename, objc_try_catch_stmt, optellipsis): Add %type declarations. (objc_inherit_code, objc_public_flag): Remove. (typespec_nonreserved_nonattr): Call objc_get_protocol_qualified_type() instead of get_static_reference() and get_protocol_reference(). (stmt_nocomp): Call grokparm() on @catch parameter. (objcdef): Move semantic action to objc_finish_implementation(). (classdef): Move semantic action to objc_start_class_interface(), objc_continue_interface(), objc_finish_interface(), objc_start_class_implementation(), objc_continue_implementation(), objc_start_category_interface() and objc_start_category_implementation(). (protocoldef): Move semantic actions to objc_start_protocol() and objc_finish_interface(). (ivar_decl_list): Remove nonterminal. (visibility_spec): Move semantic actions to objc_set_visibility(). (ivar_decls): Remove assignment to $$. (ivar_decl): Rephrase in terms of component_decl; call objc_add_instance_variable(). (ivars, ivar_declarator): Remove nonterminals. (opt_semi): New nonterminal. (methodtype): Remove semantic actions. (methoddef): Move semantic actions to objc_set_method_type(), objc_start_method_definition() and objc_finish_method_definition(). (methodproto): Move semantic actions to objc_set_method_type() and objc_add_method_declaration(). (methoddecl): Use objc_typename instead of typename; move semantic actions to objc_build_method_signature(). (optarglist, myxdecls, mydecl, myparms, myparm): Remove nonterminals. (optparmlist): Express in terms of optparms and optellipsis. (optparms, optellipsis, objc_qual, objc_quals, objc_typename): New nonterminals. (keyworddecl): Use objc_typename instead of typename. (rid_to_yy): Mark RID_IN, RID_OUT, RID_INOUT, RID_BYCOPY, RID_BYREF and RID_ONEWAY as returning OBJC_TYPE_QUAL to yyparse(). [gcc/objc/ChangeLog] 2004-09-07 Ziemowit Laski <zlaski@apple.com> * Make-lang.in (objc/objc-parse.o): Depend on $(C_COMMON_H) instead of objc/objc-act.h. (objc/objc-act.o): Depend on $(HASHTAB_H). * objc-act.c: Include hashtab.h; in ObjC++ mode, include cp-tree.h and objcp-decl.h instead of c-tree.h. (build_module_descriptor, get_class_ivars, synth_id_with_class_suffix, error_with_ivar, gen_method_decl, gen_declaration, setup_string_decl, build_protocol_template): Adjust prototypes. (build_module_initializer_routine, start_class, continue_class, finish_class, start_method_def, objc_start_function, start_protocol, build_method_decl, objc_add_method, add_instance_variable, build_ivar_reference, is_ivar, is_private, get_super_receiver, build_selector_table_decl, objc_push_parm, objc_get_parm_info, gen_type_name, gen_type_name_0, start_var_decl, finish_var_decl, create_field_decl): New prototypes. (objc_expand_function_end, comp_method_with_proto, objc_expr_last, gen_declaration_1, gen_declarator, is_complex_decl, adorn_decl, define_decl, create_builtin_decl, gen_declspecs): Remove prototypes. (TYPE_ID): Rename to OBJECT_TYPEDEF_NAME. (CLASS_TYPEDEF_NAME): New. (TAG_EXECCLASS): Change from a global variable to a #define. (TAG_RETURN_STRUCT): Delete. (TAG_GNUINIT): New, holds '__objc_gnu_init' name. (objc_inherit_code, objc_public_flag): New, moved from c-parse.in. (string_descriptor): New struct. (string_htab): New hash table. (string_hash, string_eq): New prototypes. (generate_struct_by_value_array): Call create_field_decl() instead of create_builtin_decl(). (objc_init): Do not initialize objc_ellipsis_node or TAG_EXECCLASS; In ObjC++ mode, call cxx_init() instead of c_objc_common_init(). (objc_finish_file): In ObjC++, call instantiate_pending_templates() and cp_finish_file(). (define_decl, get_static_reference, get_protocol_reference, create_builtin_decl): Remove functions. (objc_start_class_interface, objc_start_category_interface, objc_start_protocol, objc_continue_interface, objc_finish_interface, objc_start_class_implementation, objc_start_category_implementation, objc_continue_implementation, objc_finish_implementation, objc_set_visibility, objc_set_method_type, objc_build_method_signature, objc_add_method_declaration, objc_start_method_definition, objc_add_instance_variable, objc_get_protocol_qualified_type, create_field_decl, start_var_decl, finish_var_decl): New functions. (setup_string_decl): Simplify since it is only called once. (synth_module_prologue): Call build_class_template(); predefine 'id' and 'Class' as typedefs; rename 'temp_type' to 'type'; disable debug hooks for duration of function; fix GNU runtime messenger signatures to correspond to reality; forward-declare '__objc_exec_class' for the GNU runtime; call build_selector_table_decl(); in ObjC++ mode, generate 'extern "C" { ... }' wrappers around synthesized declarations; call build_protocol_template() and build_category_template(). (string_hash, string_eq): New functions. (objc_build_string_object): Check metaclass correctness only once; store string literals in hash table. (objc_build_constructor): Do not convert initializer elements; adjust for ObjC++ impedance mismatch. (build_objc_symtab_template): Call create_field_decl() instead of create_builtin_decl(). (init_objc_symtab): Add missing conversion to initializer element. (build_metadata_decl): Call start_var_decl() instead of define_decl(). (generate_objc_symtab_decl): Do not call build_category_template(); call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(). (build_module_descriptor): Call create_field_decl() instead of grokfield(); call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(); always mark module descriptor as used; move GNU runtime-specific functionality to build_module_initializer_routine(). (build_module_initializer_routine): New function, broken off of build_module_descriptor(). (objc_static_init_needed_p, objc_generate_static_init_call): New functions. (generate_static_references, generate_strings, build_selector_translation_table, generate_descriptor_table, generate_ivars_list, generate_dispatch_table, generate_category): Call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(); build a type directly instead of via groktypename(). (build_selector_reference_decl, build_selector_table_decl, build_class_reference_decl, build_protocol_reference, generate_objc_image_info): Call start_var_decl() instead of build_decl(). (build_selector_reference): For GNU runtime, do not call build_selector_reference_decl(). (build_selector, build_typed_selector_reference): Always convert result to the selector type. (add_objc_string): Cast return value to 'char *'. (build_method_prototype_template, build_selector_template, build_method_template): Use actual selector type for fields pointing to selectors. (finish_objc): For GNU runtime, call build_module_initializer_routine() after build_module_descriptor(). (generate_protocol_list, generate_shared_structures): Call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(); build a type directly instead of via groktypename(). (synth_id_with_class_suffix): Return a string. (get_arg_type_list): For instance methods, use the instance type for 'self'; do not call groktypename_in_parm_context(). (build_objc_string_decl): Squash redeclaration errors in ObjC++. (objc_is_class_name): Use OBJC_TYPE_NAME instead of TYPE_NAME; handle RECORD_TYPEs in ObjC as well as ObjC++. (objc_is_id): New function. (objc_is_object_ptr): Return the canonical type node. (objc_get_class_ivars): Simplify using get_class_ivars(). (get_class_ivars): Remove second parameter; create a fresh copy of the ivar list for each call; do not check for existence of super class. (objc_eh_runtime_type): Mark #ifndef OBJCPLUS. (objc_init_exceptions): When using SJLJ-style exceptions, require the use of '-fobjc-exceptions' flag; do not require it for DWARF-style exceptions. (objc_build_exc_ptr, next_sjlj_build_try_catch_finally): Use objc_object_type instead of objc_id_type. (objc_begin_catch_clause): Convert the incoming PARM_DECL into a VAR_DECL before placing it in the appropriate scope; do not call define_decl(); adjust call to c_begin_compound_stmt(); use objc_object_type instead of objc_id_type. (build_next_objc_exception_stuff): Call create_field_decl() instead of create_builtin_decl(); construct type directly instead of calling groktypename(); use OBJC_VOID_AT_END to mark end of function parameters. (build_private_template): Adjust call to get_class_ivars(); build a type directly instead of via groktypename(). (build_protocol_template, build_method_prototype_list_template, build_method_prototype_template, build_category_template, build_selector_template, build_class_template, build_super_template, build_ivar_template, build_ivar_list_template, build_method_list_template, build_method_template): Call create_field_decl() instead of grokfield(). (objc_method_parm_type): Do not call groktypename(). (generate_descriptor_table): Call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(). (generate_method_descriptors, build_protocol_initializer, generate_dispatch_tables, build_category_initializer, build_shared_structure_initializer): Do not call groktypename(). (generate_protocols): Call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(); do not call groktypename(). (error_with_ivar): Remove last parameter. (check_ivars): Do not iterate ovar CLASS_RAW_IVARS lists in addition to CLASS_IVARS lists; adjust calls to error_with_ivar(). (generate_ivar_lists): Convert one of the initializer elements; do not call groktypename(). (get_arg_type_list, start_method_def, gen_method_def): Account for new representation of variable arguments and '...' in Objective-C methods; add Objective-C++ impedance matching code. (is_objc_type_qualifier): Remove function. (adjust_type_for_id_default): Simplify; there is no longer a need to wade through declspecs. (lookup_interface, start_class, continue_class, finish_class, start_method_def, start_protocol, build_method_decl, objc_add_method, add_instance_variable, build_ivar_reference, is_ivar, is_private, get_super_receiver, objc_build_finally_epilogue): Make into static functions. (receiver_is_class_object): Use new IS_CLASS() macro. (objc_build_message_expr): Tweak ObjC++ message argument handling; call objc_finish_message_expr() instead of finish_message_expr(). (finish_message_expr): Rename to objc_finish_message_expr(); use OBJC_TYPE_NAME and OBJC_SET_TYPE_NAME macros instead of TYPE_NAME. call gen_type_name() instead of gen_declaration(); call objc_is_id() instead of using IS_ID and IS_CLASS; Use objc_class_name instead of calling get_identifier("Class"); handle CONVERT_EXPRs in receiver. (build_objc_method_call, warn_with_method): Do not call groktypename(). (build_ivar_reference): Call convert() instead of clobbering in a type. (hash_init): Initialize string_htab hash table. (add_instance_variable): Simplify parameter list; do not call grokfield(); do not populate CLASS_IVARS list. (start_class): Check for the existence of super class, if one was specified. (continue_class): Use CLASS_RAW_IVARS rather than CLASS_IVARS; do not call build_class_template(); adjust call to get_class_ivars(); call build_decl(), pushdecl() and finish_decl() instead of define_decl(). (finish_class): Call build_decl(), pushdecl() and finish_decl() instead of define_decl(). (add_protocols): Use PROTOCOL_BINFO_ELTS for the tree vector size. (start_protocol): Do not call build_protocol_template(); use PROTOCOL_BINFO_ELTS for the tree vector size. (encode_type_qualifiers): Do not handle the 'const' qualifier here. (encode_pointer): Encode 'const char *' as 'r*', for backwards compatibility. (encode_array): Use HOST_WIDE_INT_PRINT_DEC instead of "%ld". (encode_type): Handle the 'const' qualifier here. (objc_parmlist): New global variable, sued by objc_push_parm and objc_get_parm_info(). (objc_push_parm, objc_get_parm_info): New functions. (objc_expr_last): Remove function. (synth_self_and_ucmd_args): For instance methods, use the instance type for 'self'; call objc_push_parm() instead of push_parm_decl(). (start_method_def): Do not call push_scope(), declare_parm_level(), pop_scope(), push_parm_decl(), store_parm_decls() or objc_expr_last(); just use objc_push_parm() and objc_get_parm_info(). (comp_method_with_proto): Remove function. (objc_types_are_equivalent): Strip away indirections before comparing underlying types. (comp_proto_with_proto): Do not call groktypename(); types are no longer in raw declspec format. (objc_start_function): New function. (really_start_method): Call comp_proto_with_proto() instead of comp_method_with_proto(); call objc_start_function() instead of hand-crafting a function declarator. (continue_method_def, objc_expand_function_end): Remove functions. (get_super_receiver): Call objc_get_current_scope() instead of get_current_scope(); reference 'super_class' field (instead of 'class'). (finish_method_def): Rename to objc_finish_method_definition() and add a function decl parameter; move method encoding call from objc_expand_function_end(). (is_complex_decl, adorn_decl, gen_declarator, gen_declspecs, gen_declaration_1): Remove functions. (tmpbuf, RAW_DECLSPEC): Remove. (gen_declaration): Remove second parameter; simplify to deal with TYPE_P nodes instead of raw declspecs. (gen_type_name, gen_type_name_0): New functions. (gen_method_decl): Remove second parameter; call gen_type_name() instead of gen_declaration_1(). (dump_interface): Adjust calls to gen_declaration() and gen_method_decl(); do not allocate a separate string buffer. (init_objc): Allocate a larger string buffer to accommodate dump_interface(); adjust call to build_module_descriptor(); add call to build_module_initializer_routine() for the GNU runtime. (generate_classref_translation_entry): Do not call start_decl(); call finish_var_decl() instead of finish_decl(); call convert() instead of build_c_cast(). * objc-act.h (CLASS_OWN_IVARS): Remove accessor. (CLASS_BINFO_ELTS): Reduce from 6 to 5, now that CLASS_OWN_IVARS is gone. (OCTI_GNU_INIT_DECL, GNU_INIT_decl): New. (OCTI_ELLIPSIS_NODE, objc_ellipsis_node): Remove. (OCTI_ID_ID, id_type, objc_id_id): Rename to OCTI_ID_NAME, objc_object_type and objc_object_name, respectively. (OCTI_CLS_REF, OCTI_CLASS_NAME, objc_class_reference, objc_class_name): New. (IS_CLASS): New macro. (IS_ID, IS_SUPER): Robustify. (OCTI_EXECCLASS_DECL, execclass_decl): New. (finish_file, start_class, continue_class, finish_class, start_method_def, continue_method_def, finish_method_def, start_protocol, finish_protocol, objc_build_throw_stmt, objc_build_try_catch_finally_stmt, objc_build_synchronized_prologue, objc_build_synchronized_epilogue, objc_build_try_prologue, objc_build_try_epilogue, objc_build_catch_stmt, objc_build_catch_epilogue, objc_build_finally_prologue, objc_build_finally_epilogue, is_ivar, is_private, is_public, add_instance_variable, objc_add_method, get_super_receiver, objc_clear_super_receiver, get_class_ivars_from_name, get_class_reference, get_static_reference, get_object_reference, build_message_expr, finish_message_expr, build_selector_expr, build_ivar_reference, build_keyword_decl, build_method_decl, build_protocol_expr, build_objc_string_object, objc_declare_alias, objc_declare_class, objc_declare_protocols, objc_comptypes, objc_check_decl, build_encode_expr): Remove prototypes. (imp_count, cat_count): Make GGC-aware. (OBJC_SET_TYPE_NAME): New macro. From-SVN: r87168
2004-09-08 02:49:44 +02:00
tree self_type;
1992-01-18 00:15:38 +01:00
if (objc_method_context
&& TREE_CODE (objc_method_context) == INSTANCE_METHOD_DECL)
Makefile.in (c-parse.o): Depend on $(C_COMMON_H). [gcc/ChangeLog] 2004-09-07 Ziemowit Laski <zlaski@apple.com> * Makefile.in (c-parse.o): Depend on $(C_COMMON_H). * c-parse.in: Include c-common.h instead of objc-act.h. (ivar_decl_list, ivar_decls, ivar_decl, ivars, ivar_declarator, myparms, myparm): Remove %type declarations. (methodtype, optparms, OBJC_TYPE_QUAL, objc_quals, objc_qual, objc_typename, objc_try_catch_stmt, optellipsis): Add %type declarations. (objc_inherit_code, objc_public_flag): Remove. (typespec_nonreserved_nonattr): Call objc_get_protocol_qualified_type() instead of get_static_reference() and get_protocol_reference(). (stmt_nocomp): Call grokparm() on @catch parameter. (objcdef): Move semantic action to objc_finish_implementation(). (classdef): Move semantic action to objc_start_class_interface(), objc_continue_interface(), objc_finish_interface(), objc_start_class_implementation(), objc_continue_implementation(), objc_start_category_interface() and objc_start_category_implementation(). (protocoldef): Move semantic actions to objc_start_protocol() and objc_finish_interface(). (ivar_decl_list): Remove nonterminal. (visibility_spec): Move semantic actions to objc_set_visibility(). (ivar_decls): Remove assignment to $$. (ivar_decl): Rephrase in terms of component_decl; call objc_add_instance_variable(). (ivars, ivar_declarator): Remove nonterminals. (opt_semi): New nonterminal. (methodtype): Remove semantic actions. (methoddef): Move semantic actions to objc_set_method_type(), objc_start_method_definition() and objc_finish_method_definition(). (methodproto): Move semantic actions to objc_set_method_type() and objc_add_method_declaration(). (methoddecl): Use objc_typename instead of typename; move semantic actions to objc_build_method_signature(). (optarglist, myxdecls, mydecl, myparms, myparm): Remove nonterminals. (optparmlist): Express in terms of optparms and optellipsis. (optparms, optellipsis, objc_qual, objc_quals, objc_typename): New nonterminals. (keyworddecl): Use objc_typename instead of typename. (rid_to_yy): Mark RID_IN, RID_OUT, RID_INOUT, RID_BYCOPY, RID_BYREF and RID_ONEWAY as returning OBJC_TYPE_QUAL to yyparse(). [gcc/objc/ChangeLog] 2004-09-07 Ziemowit Laski <zlaski@apple.com> * Make-lang.in (objc/objc-parse.o): Depend on $(C_COMMON_H) instead of objc/objc-act.h. (objc/objc-act.o): Depend on $(HASHTAB_H). * objc-act.c: Include hashtab.h; in ObjC++ mode, include cp-tree.h and objcp-decl.h instead of c-tree.h. (build_module_descriptor, get_class_ivars, synth_id_with_class_suffix, error_with_ivar, gen_method_decl, gen_declaration, setup_string_decl, build_protocol_template): Adjust prototypes. (build_module_initializer_routine, start_class, continue_class, finish_class, start_method_def, objc_start_function, start_protocol, build_method_decl, objc_add_method, add_instance_variable, build_ivar_reference, is_ivar, is_private, get_super_receiver, build_selector_table_decl, objc_push_parm, objc_get_parm_info, gen_type_name, gen_type_name_0, start_var_decl, finish_var_decl, create_field_decl): New prototypes. (objc_expand_function_end, comp_method_with_proto, objc_expr_last, gen_declaration_1, gen_declarator, is_complex_decl, adorn_decl, define_decl, create_builtin_decl, gen_declspecs): Remove prototypes. (TYPE_ID): Rename to OBJECT_TYPEDEF_NAME. (CLASS_TYPEDEF_NAME): New. (TAG_EXECCLASS): Change from a global variable to a #define. (TAG_RETURN_STRUCT): Delete. (TAG_GNUINIT): New, holds '__objc_gnu_init' name. (objc_inherit_code, objc_public_flag): New, moved from c-parse.in. (string_descriptor): New struct. (string_htab): New hash table. (string_hash, string_eq): New prototypes. (generate_struct_by_value_array): Call create_field_decl() instead of create_builtin_decl(). (objc_init): Do not initialize objc_ellipsis_node or TAG_EXECCLASS; In ObjC++ mode, call cxx_init() instead of c_objc_common_init(). (objc_finish_file): In ObjC++, call instantiate_pending_templates() and cp_finish_file(). (define_decl, get_static_reference, get_protocol_reference, create_builtin_decl): Remove functions. (objc_start_class_interface, objc_start_category_interface, objc_start_protocol, objc_continue_interface, objc_finish_interface, objc_start_class_implementation, objc_start_category_implementation, objc_continue_implementation, objc_finish_implementation, objc_set_visibility, objc_set_method_type, objc_build_method_signature, objc_add_method_declaration, objc_start_method_definition, objc_add_instance_variable, objc_get_protocol_qualified_type, create_field_decl, start_var_decl, finish_var_decl): New functions. (setup_string_decl): Simplify since it is only called once. (synth_module_prologue): Call build_class_template(); predefine 'id' and 'Class' as typedefs; rename 'temp_type' to 'type'; disable debug hooks for duration of function; fix GNU runtime messenger signatures to correspond to reality; forward-declare '__objc_exec_class' for the GNU runtime; call build_selector_table_decl(); in ObjC++ mode, generate 'extern "C" { ... }' wrappers around synthesized declarations; call build_protocol_template() and build_category_template(). (string_hash, string_eq): New functions. (objc_build_string_object): Check metaclass correctness only once; store string literals in hash table. (objc_build_constructor): Do not convert initializer elements; adjust for ObjC++ impedance mismatch. (build_objc_symtab_template): Call create_field_decl() instead of create_builtin_decl(). (init_objc_symtab): Add missing conversion to initializer element. (build_metadata_decl): Call start_var_decl() instead of define_decl(). (generate_objc_symtab_decl): Do not call build_category_template(); call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(). (build_module_descriptor): Call create_field_decl() instead of grokfield(); call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(); always mark module descriptor as used; move GNU runtime-specific functionality to build_module_initializer_routine(). (build_module_initializer_routine): New function, broken off of build_module_descriptor(). (objc_static_init_needed_p, objc_generate_static_init_call): New functions. (generate_static_references, generate_strings, build_selector_translation_table, generate_descriptor_table, generate_ivars_list, generate_dispatch_table, generate_category): Call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(); build a type directly instead of via groktypename(). (build_selector_reference_decl, build_selector_table_decl, build_class_reference_decl, build_protocol_reference, generate_objc_image_info): Call start_var_decl() instead of build_decl(). (build_selector_reference): For GNU runtime, do not call build_selector_reference_decl(). (build_selector, build_typed_selector_reference): Always convert result to the selector type. (add_objc_string): Cast return value to 'char *'. (build_method_prototype_template, build_selector_template, build_method_template): Use actual selector type for fields pointing to selectors. (finish_objc): For GNU runtime, call build_module_initializer_routine() after build_module_descriptor(). (generate_protocol_list, generate_shared_structures): Call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(); build a type directly instead of via groktypename(). (synth_id_with_class_suffix): Return a string. (get_arg_type_list): For instance methods, use the instance type for 'self'; do not call groktypename_in_parm_context(). (build_objc_string_decl): Squash redeclaration errors in ObjC++. (objc_is_class_name): Use OBJC_TYPE_NAME instead of TYPE_NAME; handle RECORD_TYPEs in ObjC as well as ObjC++. (objc_is_id): New function. (objc_is_object_ptr): Return the canonical type node. (objc_get_class_ivars): Simplify using get_class_ivars(). (get_class_ivars): Remove second parameter; create a fresh copy of the ivar list for each call; do not check for existence of super class. (objc_eh_runtime_type): Mark #ifndef OBJCPLUS. (objc_init_exceptions): When using SJLJ-style exceptions, require the use of '-fobjc-exceptions' flag; do not require it for DWARF-style exceptions. (objc_build_exc_ptr, next_sjlj_build_try_catch_finally): Use objc_object_type instead of objc_id_type. (objc_begin_catch_clause): Convert the incoming PARM_DECL into a VAR_DECL before placing it in the appropriate scope; do not call define_decl(); adjust call to c_begin_compound_stmt(); use objc_object_type instead of objc_id_type. (build_next_objc_exception_stuff): Call create_field_decl() instead of create_builtin_decl(); construct type directly instead of calling groktypename(); use OBJC_VOID_AT_END to mark end of function parameters. (build_private_template): Adjust call to get_class_ivars(); build a type directly instead of via groktypename(). (build_protocol_template, build_method_prototype_list_template, build_method_prototype_template, build_category_template, build_selector_template, build_class_template, build_super_template, build_ivar_template, build_ivar_list_template, build_method_list_template, build_method_template): Call create_field_decl() instead of grokfield(). (objc_method_parm_type): Do not call groktypename(). (generate_descriptor_table): Call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(). (generate_method_descriptors, build_protocol_initializer, generate_dispatch_tables, build_category_initializer, build_shared_structure_initializer): Do not call groktypename(). (generate_protocols): Call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(); do not call groktypename(). (error_with_ivar): Remove last parameter. (check_ivars): Do not iterate ovar CLASS_RAW_IVARS lists in addition to CLASS_IVARS lists; adjust calls to error_with_ivar(). (generate_ivar_lists): Convert one of the initializer elements; do not call groktypename(). (get_arg_type_list, start_method_def, gen_method_def): Account for new representation of variable arguments and '...' in Objective-C methods; add Objective-C++ impedance matching code. (is_objc_type_qualifier): Remove function. (adjust_type_for_id_default): Simplify; there is no longer a need to wade through declspecs. (lookup_interface, start_class, continue_class, finish_class, start_method_def, start_protocol, build_method_decl, objc_add_method, add_instance_variable, build_ivar_reference, is_ivar, is_private, get_super_receiver, objc_build_finally_epilogue): Make into static functions. (receiver_is_class_object): Use new IS_CLASS() macro. (objc_build_message_expr): Tweak ObjC++ message argument handling; call objc_finish_message_expr() instead of finish_message_expr(). (finish_message_expr): Rename to objc_finish_message_expr(); use OBJC_TYPE_NAME and OBJC_SET_TYPE_NAME macros instead of TYPE_NAME. call gen_type_name() instead of gen_declaration(); call objc_is_id() instead of using IS_ID and IS_CLASS; Use objc_class_name instead of calling get_identifier("Class"); handle CONVERT_EXPRs in receiver. (build_objc_method_call, warn_with_method): Do not call groktypename(). (build_ivar_reference): Call convert() instead of clobbering in a type. (hash_init): Initialize string_htab hash table. (add_instance_variable): Simplify parameter list; do not call grokfield(); do not populate CLASS_IVARS list. (start_class): Check for the existence of super class, if one was specified. (continue_class): Use CLASS_RAW_IVARS rather than CLASS_IVARS; do not call build_class_template(); adjust call to get_class_ivars(); call build_decl(), pushdecl() and finish_decl() instead of define_decl(). (finish_class): Call build_decl(), pushdecl() and finish_decl() instead of define_decl(). (add_protocols): Use PROTOCOL_BINFO_ELTS for the tree vector size. (start_protocol): Do not call build_protocol_template(); use PROTOCOL_BINFO_ELTS for the tree vector size. (encode_type_qualifiers): Do not handle the 'const' qualifier here. (encode_pointer): Encode 'const char *' as 'r*', for backwards compatibility. (encode_array): Use HOST_WIDE_INT_PRINT_DEC instead of "%ld". (encode_type): Handle the 'const' qualifier here. (objc_parmlist): New global variable, sued by objc_push_parm and objc_get_parm_info(). (objc_push_parm, objc_get_parm_info): New functions. (objc_expr_last): Remove function. (synth_self_and_ucmd_args): For instance methods, use the instance type for 'self'; call objc_push_parm() instead of push_parm_decl(). (start_method_def): Do not call push_scope(), declare_parm_level(), pop_scope(), push_parm_decl(), store_parm_decls() or objc_expr_last(); just use objc_push_parm() and objc_get_parm_info(). (comp_method_with_proto): Remove function. (objc_types_are_equivalent): Strip away indirections before comparing underlying types. (comp_proto_with_proto): Do not call groktypename(); types are no longer in raw declspec format. (objc_start_function): New function. (really_start_method): Call comp_proto_with_proto() instead of comp_method_with_proto(); call objc_start_function() instead of hand-crafting a function declarator. (continue_method_def, objc_expand_function_end): Remove functions. (get_super_receiver): Call objc_get_current_scope() instead of get_current_scope(); reference 'super_class' field (instead of 'class'). (finish_method_def): Rename to objc_finish_method_definition() and add a function decl parameter; move method encoding call from objc_expand_function_end(). (is_complex_decl, adorn_decl, gen_declarator, gen_declspecs, gen_declaration_1): Remove functions. (tmpbuf, RAW_DECLSPEC): Remove. (gen_declaration): Remove second parameter; simplify to deal with TYPE_P nodes instead of raw declspecs. (gen_type_name, gen_type_name_0): New functions. (gen_method_decl): Remove second parameter; call gen_type_name() instead of gen_declaration_1(). (dump_interface): Adjust calls to gen_declaration() and gen_method_decl(); do not allocate a separate string buffer. (init_objc): Allocate a larger string buffer to accommodate dump_interface(); adjust call to build_module_descriptor(); add call to build_module_initializer_routine() for the GNU runtime. (generate_classref_translation_entry): Do not call start_decl(); call finish_var_decl() instead of finish_decl(); call convert() instead of build_c_cast(). * objc-act.h (CLASS_OWN_IVARS): Remove accessor. (CLASS_BINFO_ELTS): Reduce from 6 to 5, now that CLASS_OWN_IVARS is gone. (OCTI_GNU_INIT_DECL, GNU_INIT_decl): New. (OCTI_ELLIPSIS_NODE, objc_ellipsis_node): Remove. (OCTI_ID_ID, id_type, objc_id_id): Rename to OCTI_ID_NAME, objc_object_type and objc_object_name, respectively. (OCTI_CLS_REF, OCTI_CLASS_NAME, objc_class_reference, objc_class_name): New. (IS_CLASS): New macro. (IS_ID, IS_SUPER): Robustify. (OCTI_EXECCLASS_DECL, execclass_decl): New. (finish_file, start_class, continue_class, finish_class, start_method_def, continue_method_def, finish_method_def, start_protocol, finish_protocol, objc_build_throw_stmt, objc_build_try_catch_finally_stmt, objc_build_synchronized_prologue, objc_build_synchronized_epilogue, objc_build_try_prologue, objc_build_try_epilogue, objc_build_catch_stmt, objc_build_catch_epilogue, objc_build_finally_prologue, objc_build_finally_epilogue, is_ivar, is_private, is_public, add_instance_variable, objc_add_method, get_super_receiver, objc_clear_super_receiver, get_class_ivars_from_name, get_class_reference, get_static_reference, get_object_reference, build_message_expr, finish_message_expr, build_selector_expr, build_ivar_reference, build_keyword_decl, build_method_decl, build_protocol_expr, build_objc_string_object, objc_declare_alias, objc_declare_class, objc_declare_protocols, objc_comptypes, objc_check_decl, build_encode_expr): Remove prototypes. (imp_count, cat_count): Make GGC-aware. (OBJC_SET_TYPE_NAME): New macro. From-SVN: r87168
2004-09-08 02:49:44 +02:00
self_type = objc_instance_type;
1992-01-18 00:15:38 +01:00
else
/* Really a `struct objc_class *'. However, we allow people to
assign to self, which changes its type midstream. */
Makefile.in (c-parse.o): Depend on $(C_COMMON_H). [gcc/ChangeLog] 2004-09-07 Ziemowit Laski <zlaski@apple.com> * Makefile.in (c-parse.o): Depend on $(C_COMMON_H). * c-parse.in: Include c-common.h instead of objc-act.h. (ivar_decl_list, ivar_decls, ivar_decl, ivars, ivar_declarator, myparms, myparm): Remove %type declarations. (methodtype, optparms, OBJC_TYPE_QUAL, objc_quals, objc_qual, objc_typename, objc_try_catch_stmt, optellipsis): Add %type declarations. (objc_inherit_code, objc_public_flag): Remove. (typespec_nonreserved_nonattr): Call objc_get_protocol_qualified_type() instead of get_static_reference() and get_protocol_reference(). (stmt_nocomp): Call grokparm() on @catch parameter. (objcdef): Move semantic action to objc_finish_implementation(). (classdef): Move semantic action to objc_start_class_interface(), objc_continue_interface(), objc_finish_interface(), objc_start_class_implementation(), objc_continue_implementation(), objc_start_category_interface() and objc_start_category_implementation(). (protocoldef): Move semantic actions to objc_start_protocol() and objc_finish_interface(). (ivar_decl_list): Remove nonterminal. (visibility_spec): Move semantic actions to objc_set_visibility(). (ivar_decls): Remove assignment to $$. (ivar_decl): Rephrase in terms of component_decl; call objc_add_instance_variable(). (ivars, ivar_declarator): Remove nonterminals. (opt_semi): New nonterminal. (methodtype): Remove semantic actions. (methoddef): Move semantic actions to objc_set_method_type(), objc_start_method_definition() and objc_finish_method_definition(). (methodproto): Move semantic actions to objc_set_method_type() and objc_add_method_declaration(). (methoddecl): Use objc_typename instead of typename; move semantic actions to objc_build_method_signature(). (optarglist, myxdecls, mydecl, myparms, myparm): Remove nonterminals. (optparmlist): Express in terms of optparms and optellipsis. (optparms, optellipsis, objc_qual, objc_quals, objc_typename): New nonterminals. (keyworddecl): Use objc_typename instead of typename. (rid_to_yy): Mark RID_IN, RID_OUT, RID_INOUT, RID_BYCOPY, RID_BYREF and RID_ONEWAY as returning OBJC_TYPE_QUAL to yyparse(). [gcc/objc/ChangeLog] 2004-09-07 Ziemowit Laski <zlaski@apple.com> * Make-lang.in (objc/objc-parse.o): Depend on $(C_COMMON_H) instead of objc/objc-act.h. (objc/objc-act.o): Depend on $(HASHTAB_H). * objc-act.c: Include hashtab.h; in ObjC++ mode, include cp-tree.h and objcp-decl.h instead of c-tree.h. (build_module_descriptor, get_class_ivars, synth_id_with_class_suffix, error_with_ivar, gen_method_decl, gen_declaration, setup_string_decl, build_protocol_template): Adjust prototypes. (build_module_initializer_routine, start_class, continue_class, finish_class, start_method_def, objc_start_function, start_protocol, build_method_decl, objc_add_method, add_instance_variable, build_ivar_reference, is_ivar, is_private, get_super_receiver, build_selector_table_decl, objc_push_parm, objc_get_parm_info, gen_type_name, gen_type_name_0, start_var_decl, finish_var_decl, create_field_decl): New prototypes. (objc_expand_function_end, comp_method_with_proto, objc_expr_last, gen_declaration_1, gen_declarator, is_complex_decl, adorn_decl, define_decl, create_builtin_decl, gen_declspecs): Remove prototypes. (TYPE_ID): Rename to OBJECT_TYPEDEF_NAME. (CLASS_TYPEDEF_NAME): New. (TAG_EXECCLASS): Change from a global variable to a #define. (TAG_RETURN_STRUCT): Delete. (TAG_GNUINIT): New, holds '__objc_gnu_init' name. (objc_inherit_code, objc_public_flag): New, moved from c-parse.in. (string_descriptor): New struct. (string_htab): New hash table. (string_hash, string_eq): New prototypes. (generate_struct_by_value_array): Call create_field_decl() instead of create_builtin_decl(). (objc_init): Do not initialize objc_ellipsis_node or TAG_EXECCLASS; In ObjC++ mode, call cxx_init() instead of c_objc_common_init(). (objc_finish_file): In ObjC++, call instantiate_pending_templates() and cp_finish_file(). (define_decl, get_static_reference, get_protocol_reference, create_builtin_decl): Remove functions. (objc_start_class_interface, objc_start_category_interface, objc_start_protocol, objc_continue_interface, objc_finish_interface, objc_start_class_implementation, objc_start_category_implementation, objc_continue_implementation, objc_finish_implementation, objc_set_visibility, objc_set_method_type, objc_build_method_signature, objc_add_method_declaration, objc_start_method_definition, objc_add_instance_variable, objc_get_protocol_qualified_type, create_field_decl, start_var_decl, finish_var_decl): New functions. (setup_string_decl): Simplify since it is only called once. (synth_module_prologue): Call build_class_template(); predefine 'id' and 'Class' as typedefs; rename 'temp_type' to 'type'; disable debug hooks for duration of function; fix GNU runtime messenger signatures to correspond to reality; forward-declare '__objc_exec_class' for the GNU runtime; call build_selector_table_decl(); in ObjC++ mode, generate 'extern "C" { ... }' wrappers around synthesized declarations; call build_protocol_template() and build_category_template(). (string_hash, string_eq): New functions. (objc_build_string_object): Check metaclass correctness only once; store string literals in hash table. (objc_build_constructor): Do not convert initializer elements; adjust for ObjC++ impedance mismatch. (build_objc_symtab_template): Call create_field_decl() instead of create_builtin_decl(). (init_objc_symtab): Add missing conversion to initializer element. (build_metadata_decl): Call start_var_decl() instead of define_decl(). (generate_objc_symtab_decl): Do not call build_category_template(); call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(). (build_module_descriptor): Call create_field_decl() instead of grokfield(); call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(); always mark module descriptor as used; move GNU runtime-specific functionality to build_module_initializer_routine(). (build_module_initializer_routine): New function, broken off of build_module_descriptor(). (objc_static_init_needed_p, objc_generate_static_init_call): New functions. (generate_static_references, generate_strings, build_selector_translation_table, generate_descriptor_table, generate_ivars_list, generate_dispatch_table, generate_category): Call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(); build a type directly instead of via groktypename(). (build_selector_reference_decl, build_selector_table_decl, build_class_reference_decl, build_protocol_reference, generate_objc_image_info): Call start_var_decl() instead of build_decl(). (build_selector_reference): For GNU runtime, do not call build_selector_reference_decl(). (build_selector, build_typed_selector_reference): Always convert result to the selector type. (add_objc_string): Cast return value to 'char *'. (build_method_prototype_template, build_selector_template, build_method_template): Use actual selector type for fields pointing to selectors. (finish_objc): For GNU runtime, call build_module_initializer_routine() after build_module_descriptor(). (generate_protocol_list, generate_shared_structures): Call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(); build a type directly instead of via groktypename(). (synth_id_with_class_suffix): Return a string. (get_arg_type_list): For instance methods, use the instance type for 'self'; do not call groktypename_in_parm_context(). (build_objc_string_decl): Squash redeclaration errors in ObjC++. (objc_is_class_name): Use OBJC_TYPE_NAME instead of TYPE_NAME; handle RECORD_TYPEs in ObjC as well as ObjC++. (objc_is_id): New function. (objc_is_object_ptr): Return the canonical type node. (objc_get_class_ivars): Simplify using get_class_ivars(). (get_class_ivars): Remove second parameter; create a fresh copy of the ivar list for each call; do not check for existence of super class. (objc_eh_runtime_type): Mark #ifndef OBJCPLUS. (objc_init_exceptions): When using SJLJ-style exceptions, require the use of '-fobjc-exceptions' flag; do not require it for DWARF-style exceptions. (objc_build_exc_ptr, next_sjlj_build_try_catch_finally): Use objc_object_type instead of objc_id_type. (objc_begin_catch_clause): Convert the incoming PARM_DECL into a VAR_DECL before placing it in the appropriate scope; do not call define_decl(); adjust call to c_begin_compound_stmt(); use objc_object_type instead of objc_id_type. (build_next_objc_exception_stuff): Call create_field_decl() instead of create_builtin_decl(); construct type directly instead of calling groktypename(); use OBJC_VOID_AT_END to mark end of function parameters. (build_private_template): Adjust call to get_class_ivars(); build a type directly instead of via groktypename(). (build_protocol_template, build_method_prototype_list_template, build_method_prototype_template, build_category_template, build_selector_template, build_class_template, build_super_template, build_ivar_template, build_ivar_list_template, build_method_list_template, build_method_template): Call create_field_decl() instead of grokfield(). (objc_method_parm_type): Do not call groktypename(). (generate_descriptor_table): Call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(). (generate_method_descriptors, build_protocol_initializer, generate_dispatch_tables, build_category_initializer, build_shared_structure_initializer): Do not call groktypename(). (generate_protocols): Call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(); do not call groktypename(). (error_with_ivar): Remove last parameter. (check_ivars): Do not iterate ovar CLASS_RAW_IVARS lists in addition to CLASS_IVARS lists; adjust calls to error_with_ivar(). (generate_ivar_lists): Convert one of the initializer elements; do not call groktypename(). (get_arg_type_list, start_method_def, gen_method_def): Account for new representation of variable arguments and '...' in Objective-C methods; add Objective-C++ impedance matching code. (is_objc_type_qualifier): Remove function. (adjust_type_for_id_default): Simplify; there is no longer a need to wade through declspecs. (lookup_interface, start_class, continue_class, finish_class, start_method_def, start_protocol, build_method_decl, objc_add_method, add_instance_variable, build_ivar_reference, is_ivar, is_private, get_super_receiver, objc_build_finally_epilogue): Make into static functions. (receiver_is_class_object): Use new IS_CLASS() macro. (objc_build_message_expr): Tweak ObjC++ message argument handling; call objc_finish_message_expr() instead of finish_message_expr(). (finish_message_expr): Rename to objc_finish_message_expr(); use OBJC_TYPE_NAME and OBJC_SET_TYPE_NAME macros instead of TYPE_NAME. call gen_type_name() instead of gen_declaration(); call objc_is_id() instead of using IS_ID and IS_CLASS; Use objc_class_name instead of calling get_identifier("Class"); handle CONVERT_EXPRs in receiver. (build_objc_method_call, warn_with_method): Do not call groktypename(). (build_ivar_reference): Call convert() instead of clobbering in a type. (hash_init): Initialize string_htab hash table. (add_instance_variable): Simplify parameter list; do not call grokfield(); do not populate CLASS_IVARS list. (start_class): Check for the existence of super class, if one was specified. (continue_class): Use CLASS_RAW_IVARS rather than CLASS_IVARS; do not call build_class_template(); adjust call to get_class_ivars(); call build_decl(), pushdecl() and finish_decl() instead of define_decl(). (finish_class): Call build_decl(), pushdecl() and finish_decl() instead of define_decl(). (add_protocols): Use PROTOCOL_BINFO_ELTS for the tree vector size. (start_protocol): Do not call build_protocol_template(); use PROTOCOL_BINFO_ELTS for the tree vector size. (encode_type_qualifiers): Do not handle the 'const' qualifier here. (encode_pointer): Encode 'const char *' as 'r*', for backwards compatibility. (encode_array): Use HOST_WIDE_INT_PRINT_DEC instead of "%ld". (encode_type): Handle the 'const' qualifier here. (objc_parmlist): New global variable, sued by objc_push_parm and objc_get_parm_info(). (objc_push_parm, objc_get_parm_info): New functions. (objc_expr_last): Remove function. (synth_self_and_ucmd_args): For instance methods, use the instance type for 'self'; call objc_push_parm() instead of push_parm_decl(). (start_method_def): Do not call push_scope(), declare_parm_level(), pop_scope(), push_parm_decl(), store_parm_decls() or objc_expr_last(); just use objc_push_parm() and objc_get_parm_info(). (comp_method_with_proto): Remove function. (objc_types_are_equivalent): Strip away indirections before comparing underlying types. (comp_proto_with_proto): Do not call groktypename(); types are no longer in raw declspec format. (objc_start_function): New function. (really_start_method): Call comp_proto_with_proto() instead of comp_method_with_proto(); call objc_start_function() instead of hand-crafting a function declarator. (continue_method_def, objc_expand_function_end): Remove functions. (get_super_receiver): Call objc_get_current_scope() instead of get_current_scope(); reference 'super_class' field (instead of 'class'). (finish_method_def): Rename to objc_finish_method_definition() and add a function decl parameter; move method encoding call from objc_expand_function_end(). (is_complex_decl, adorn_decl, gen_declarator, gen_declspecs, gen_declaration_1): Remove functions. (tmpbuf, RAW_DECLSPEC): Remove. (gen_declaration): Remove second parameter; simplify to deal with TYPE_P nodes instead of raw declspecs. (gen_type_name, gen_type_name_0): New functions. (gen_method_decl): Remove second parameter; call gen_type_name() instead of gen_declaration_1(). (dump_interface): Adjust calls to gen_declaration() and gen_method_decl(); do not allocate a separate string buffer. (init_objc): Allocate a larger string buffer to accommodate dump_interface(); adjust call to build_module_descriptor(); add call to build_module_initializer_routine() for the GNU runtime. (generate_classref_translation_entry): Do not call start_decl(); call finish_var_decl() instead of finish_decl(); call convert() instead of build_c_cast(). * objc-act.h (CLASS_OWN_IVARS): Remove accessor. (CLASS_BINFO_ELTS): Reduce from 6 to 5, now that CLASS_OWN_IVARS is gone. (OCTI_GNU_INIT_DECL, GNU_INIT_decl): New. (OCTI_ELLIPSIS_NODE, objc_ellipsis_node): Remove. (OCTI_ID_ID, id_type, objc_id_id): Rename to OCTI_ID_NAME, objc_object_type and objc_object_name, respectively. (OCTI_CLS_REF, OCTI_CLASS_NAME, objc_class_reference, objc_class_name): New. (IS_CLASS): New macro. (IS_ID, IS_SUPER): Robustify. (OCTI_EXECCLASS_DECL, execclass_decl): New. (finish_file, start_class, continue_class, finish_class, start_method_def, continue_method_def, finish_method_def, start_protocol, finish_protocol, objc_build_throw_stmt, objc_build_try_catch_finally_stmt, objc_build_synchronized_prologue, objc_build_synchronized_epilogue, objc_build_try_prologue, objc_build_try_epilogue, objc_build_catch_stmt, objc_build_catch_epilogue, objc_build_finally_prologue, objc_build_finally_epilogue, is_ivar, is_private, is_public, add_instance_variable, objc_add_method, get_super_receiver, objc_clear_super_receiver, get_class_ivars_from_name, get_class_reference, get_static_reference, get_object_reference, build_message_expr, finish_message_expr, build_selector_expr, build_ivar_reference, build_keyword_decl, build_method_decl, build_protocol_expr, build_objc_string_object, objc_declare_alias, objc_declare_class, objc_declare_protocols, objc_comptypes, objc_check_decl, build_encode_expr): Remove prototypes. (imp_count, cat_count): Make GGC-aware. (OBJC_SET_TYPE_NAME): New macro. From-SVN: r87168
2004-09-08 02:49:44 +02:00
self_type = objc_object_type;
1992-01-18 00:15:38 +01:00
Makefile.in (c-parse.o): Depend on $(C_COMMON_H). [gcc/ChangeLog] 2004-09-07 Ziemowit Laski <zlaski@apple.com> * Makefile.in (c-parse.o): Depend on $(C_COMMON_H). * c-parse.in: Include c-common.h instead of objc-act.h. (ivar_decl_list, ivar_decls, ivar_decl, ivars, ivar_declarator, myparms, myparm): Remove %type declarations. (methodtype, optparms, OBJC_TYPE_QUAL, objc_quals, objc_qual, objc_typename, objc_try_catch_stmt, optellipsis): Add %type declarations. (objc_inherit_code, objc_public_flag): Remove. (typespec_nonreserved_nonattr): Call objc_get_protocol_qualified_type() instead of get_static_reference() and get_protocol_reference(). (stmt_nocomp): Call grokparm() on @catch parameter. (objcdef): Move semantic action to objc_finish_implementation(). (classdef): Move semantic action to objc_start_class_interface(), objc_continue_interface(), objc_finish_interface(), objc_start_class_implementation(), objc_continue_implementation(), objc_start_category_interface() and objc_start_category_implementation(). (protocoldef): Move semantic actions to objc_start_protocol() and objc_finish_interface(). (ivar_decl_list): Remove nonterminal. (visibility_spec): Move semantic actions to objc_set_visibility(). (ivar_decls): Remove assignment to $$. (ivar_decl): Rephrase in terms of component_decl; call objc_add_instance_variable(). (ivars, ivar_declarator): Remove nonterminals. (opt_semi): New nonterminal. (methodtype): Remove semantic actions. (methoddef): Move semantic actions to objc_set_method_type(), objc_start_method_definition() and objc_finish_method_definition(). (methodproto): Move semantic actions to objc_set_method_type() and objc_add_method_declaration(). (methoddecl): Use objc_typename instead of typename; move semantic actions to objc_build_method_signature(). (optarglist, myxdecls, mydecl, myparms, myparm): Remove nonterminals. (optparmlist): Express in terms of optparms and optellipsis. (optparms, optellipsis, objc_qual, objc_quals, objc_typename): New nonterminals. (keyworddecl): Use objc_typename instead of typename. (rid_to_yy): Mark RID_IN, RID_OUT, RID_INOUT, RID_BYCOPY, RID_BYREF and RID_ONEWAY as returning OBJC_TYPE_QUAL to yyparse(). [gcc/objc/ChangeLog] 2004-09-07 Ziemowit Laski <zlaski@apple.com> * Make-lang.in (objc/objc-parse.o): Depend on $(C_COMMON_H) instead of objc/objc-act.h. (objc/objc-act.o): Depend on $(HASHTAB_H). * objc-act.c: Include hashtab.h; in ObjC++ mode, include cp-tree.h and objcp-decl.h instead of c-tree.h. (build_module_descriptor, get_class_ivars, synth_id_with_class_suffix, error_with_ivar, gen_method_decl, gen_declaration, setup_string_decl, build_protocol_template): Adjust prototypes. (build_module_initializer_routine, start_class, continue_class, finish_class, start_method_def, objc_start_function, start_protocol, build_method_decl, objc_add_method, add_instance_variable, build_ivar_reference, is_ivar, is_private, get_super_receiver, build_selector_table_decl, objc_push_parm, objc_get_parm_info, gen_type_name, gen_type_name_0, start_var_decl, finish_var_decl, create_field_decl): New prototypes. (objc_expand_function_end, comp_method_with_proto, objc_expr_last, gen_declaration_1, gen_declarator, is_complex_decl, adorn_decl, define_decl, create_builtin_decl, gen_declspecs): Remove prototypes. (TYPE_ID): Rename to OBJECT_TYPEDEF_NAME. (CLASS_TYPEDEF_NAME): New. (TAG_EXECCLASS): Change from a global variable to a #define. (TAG_RETURN_STRUCT): Delete. (TAG_GNUINIT): New, holds '__objc_gnu_init' name. (objc_inherit_code, objc_public_flag): New, moved from c-parse.in. (string_descriptor): New struct. (string_htab): New hash table. (string_hash, string_eq): New prototypes. (generate_struct_by_value_array): Call create_field_decl() instead of create_builtin_decl(). (objc_init): Do not initialize objc_ellipsis_node or TAG_EXECCLASS; In ObjC++ mode, call cxx_init() instead of c_objc_common_init(). (objc_finish_file): In ObjC++, call instantiate_pending_templates() and cp_finish_file(). (define_decl, get_static_reference, get_protocol_reference, create_builtin_decl): Remove functions. (objc_start_class_interface, objc_start_category_interface, objc_start_protocol, objc_continue_interface, objc_finish_interface, objc_start_class_implementation, objc_start_category_implementation, objc_continue_implementation, objc_finish_implementation, objc_set_visibility, objc_set_method_type, objc_build_method_signature, objc_add_method_declaration, objc_start_method_definition, objc_add_instance_variable, objc_get_protocol_qualified_type, create_field_decl, start_var_decl, finish_var_decl): New functions. (setup_string_decl): Simplify since it is only called once. (synth_module_prologue): Call build_class_template(); predefine 'id' and 'Class' as typedefs; rename 'temp_type' to 'type'; disable debug hooks for duration of function; fix GNU runtime messenger signatures to correspond to reality; forward-declare '__objc_exec_class' for the GNU runtime; call build_selector_table_decl(); in ObjC++ mode, generate 'extern "C" { ... }' wrappers around synthesized declarations; call build_protocol_template() and build_category_template(). (string_hash, string_eq): New functions. (objc_build_string_object): Check metaclass correctness only once; store string literals in hash table. (objc_build_constructor): Do not convert initializer elements; adjust for ObjC++ impedance mismatch. (build_objc_symtab_template): Call create_field_decl() instead of create_builtin_decl(). (init_objc_symtab): Add missing conversion to initializer element. (build_metadata_decl): Call start_var_decl() instead of define_decl(). (generate_objc_symtab_decl): Do not call build_category_template(); call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(). (build_module_descriptor): Call create_field_decl() instead of grokfield(); call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(); always mark module descriptor as used; move GNU runtime-specific functionality to build_module_initializer_routine(). (build_module_initializer_routine): New function, broken off of build_module_descriptor(). (objc_static_init_needed_p, objc_generate_static_init_call): New functions. (generate_static_references, generate_strings, build_selector_translation_table, generate_descriptor_table, generate_ivars_list, generate_dispatch_table, generate_category): Call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(); build a type directly instead of via groktypename(). (build_selector_reference_decl, build_selector_table_decl, build_class_reference_decl, build_protocol_reference, generate_objc_image_info): Call start_var_decl() instead of build_decl(). (build_selector_reference): For GNU runtime, do not call build_selector_reference_decl(). (build_selector, build_typed_selector_reference): Always convert result to the selector type. (add_objc_string): Cast return value to 'char *'. (build_method_prototype_template, build_selector_template, build_method_template): Use actual selector type for fields pointing to selectors. (finish_objc): For GNU runtime, call build_module_initializer_routine() after build_module_descriptor(). (generate_protocol_list, generate_shared_structures): Call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(); build a type directly instead of via groktypename(). (synth_id_with_class_suffix): Return a string. (get_arg_type_list): For instance methods, use the instance type for 'self'; do not call groktypename_in_parm_context(). (build_objc_string_decl): Squash redeclaration errors in ObjC++. (objc_is_class_name): Use OBJC_TYPE_NAME instead of TYPE_NAME; handle RECORD_TYPEs in ObjC as well as ObjC++. (objc_is_id): New function. (objc_is_object_ptr): Return the canonical type node. (objc_get_class_ivars): Simplify using get_class_ivars(). (get_class_ivars): Remove second parameter; create a fresh copy of the ivar list for each call; do not check for existence of super class. (objc_eh_runtime_type): Mark #ifndef OBJCPLUS. (objc_init_exceptions): When using SJLJ-style exceptions, require the use of '-fobjc-exceptions' flag; do not require it for DWARF-style exceptions. (objc_build_exc_ptr, next_sjlj_build_try_catch_finally): Use objc_object_type instead of objc_id_type. (objc_begin_catch_clause): Convert the incoming PARM_DECL into a VAR_DECL before placing it in the appropriate scope; do not call define_decl(); adjust call to c_begin_compound_stmt(); use objc_object_type instead of objc_id_type. (build_next_objc_exception_stuff): Call create_field_decl() instead of create_builtin_decl(); construct type directly instead of calling groktypename(); use OBJC_VOID_AT_END to mark end of function parameters. (build_private_template): Adjust call to get_class_ivars(); build a type directly instead of via groktypename(). (build_protocol_template, build_method_prototype_list_template, build_method_prototype_template, build_category_template, build_selector_template, build_class_template, build_super_template, build_ivar_template, build_ivar_list_template, build_method_list_template, build_method_template): Call create_field_decl() instead of grokfield(). (objc_method_parm_type): Do not call groktypename(). (generate_descriptor_table): Call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(). (generate_method_descriptors, build_protocol_initializer, generate_dispatch_tables, build_category_initializer, build_shared_structure_initializer): Do not call groktypename(). (generate_protocols): Call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(); do not call groktypename(). (error_with_ivar): Remove last parameter. (check_ivars): Do not iterate ovar CLASS_RAW_IVARS lists in addition to CLASS_IVARS lists; adjust calls to error_with_ivar(). (generate_ivar_lists): Convert one of the initializer elements; do not call groktypename(). (get_arg_type_list, start_method_def, gen_method_def): Account for new representation of variable arguments and '...' in Objective-C methods; add Objective-C++ impedance matching code. (is_objc_type_qualifier): Remove function. (adjust_type_for_id_default): Simplify; there is no longer a need to wade through declspecs. (lookup_interface, start_class, continue_class, finish_class, start_method_def, start_protocol, build_method_decl, objc_add_method, add_instance_variable, build_ivar_reference, is_ivar, is_private, get_super_receiver, objc_build_finally_epilogue): Make into static functions. (receiver_is_class_object): Use new IS_CLASS() macro. (objc_build_message_expr): Tweak ObjC++ message argument handling; call objc_finish_message_expr() instead of finish_message_expr(). (finish_message_expr): Rename to objc_finish_message_expr(); use OBJC_TYPE_NAME and OBJC_SET_TYPE_NAME macros instead of TYPE_NAME. call gen_type_name() instead of gen_declaration(); call objc_is_id() instead of using IS_ID and IS_CLASS; Use objc_class_name instead of calling get_identifier("Class"); handle CONVERT_EXPRs in receiver. (build_objc_method_call, warn_with_method): Do not call groktypename(). (build_ivar_reference): Call convert() instead of clobbering in a type. (hash_init): Initialize string_htab hash table. (add_instance_variable): Simplify parameter list; do not call grokfield(); do not populate CLASS_IVARS list. (start_class): Check for the existence of super class, if one was specified. (continue_class): Use CLASS_RAW_IVARS rather than CLASS_IVARS; do not call build_class_template(); adjust call to get_class_ivars(); call build_decl(), pushdecl() and finish_decl() instead of define_decl(). (finish_class): Call build_decl(), pushdecl() and finish_decl() instead of define_decl(). (add_protocols): Use PROTOCOL_BINFO_ELTS for the tree vector size. (start_protocol): Do not call build_protocol_template(); use PROTOCOL_BINFO_ELTS for the tree vector size. (encode_type_qualifiers): Do not handle the 'const' qualifier here. (encode_pointer): Encode 'const char *' as 'r*', for backwards compatibility. (encode_array): Use HOST_WIDE_INT_PRINT_DEC instead of "%ld". (encode_type): Handle the 'const' qualifier here. (objc_parmlist): New global variable, sued by objc_push_parm and objc_get_parm_info(). (objc_push_parm, objc_get_parm_info): New functions. (objc_expr_last): Remove function. (synth_self_and_ucmd_args): For instance methods, use the instance type for 'self'; call objc_push_parm() instead of push_parm_decl(). (start_method_def): Do not call push_scope(), declare_parm_level(), pop_scope(), push_parm_decl(), store_parm_decls() or objc_expr_last(); just use objc_push_parm() and objc_get_parm_info(). (comp_method_with_proto): Remove function. (objc_types_are_equivalent): Strip away indirections before comparing underlying types. (comp_proto_with_proto): Do not call groktypename(); types are no longer in raw declspec format. (objc_start_function): New function. (really_start_method): Call comp_proto_with_proto() instead of comp_method_with_proto(); call objc_start_function() instead of hand-crafting a function declarator. (continue_method_def, objc_expand_function_end): Remove functions. (get_super_receiver): Call objc_get_current_scope() instead of get_current_scope(); reference 'super_class' field (instead of 'class'). (finish_method_def): Rename to objc_finish_method_definition() and add a function decl parameter; move method encoding call from objc_expand_function_end(). (is_complex_decl, adorn_decl, gen_declarator, gen_declspecs, gen_declaration_1): Remove functions. (tmpbuf, RAW_DECLSPEC): Remove. (gen_declaration): Remove second parameter; simplify to deal with TYPE_P nodes instead of raw declspecs. (gen_type_name, gen_type_name_0): New functions. (gen_method_decl): Remove second parameter; call gen_type_name() instead of gen_declaration_1(). (dump_interface): Adjust calls to gen_declaration() and gen_method_decl(); do not allocate a separate string buffer. (init_objc): Allocate a larger string buffer to accommodate dump_interface(); adjust call to build_module_descriptor(); add call to build_module_initializer_routine() for the GNU runtime. (generate_classref_translation_entry): Do not call start_decl(); call finish_var_decl() instead of finish_decl(); call convert() instead of build_c_cast(). * objc-act.h (CLASS_OWN_IVARS): Remove accessor. (CLASS_BINFO_ELTS): Reduce from 6 to 5, now that CLASS_OWN_IVARS is gone. (OCTI_GNU_INIT_DECL, GNU_INIT_decl): New. (OCTI_ELLIPSIS_NODE, objc_ellipsis_node): Remove. (OCTI_ID_ID, id_type, objc_id_id): Rename to OCTI_ID_NAME, objc_object_type and objc_object_name, respectively. (OCTI_CLS_REF, OCTI_CLASS_NAME, objc_class_reference, objc_class_name): New. (IS_CLASS): New macro. (IS_ID, IS_SUPER): Robustify. (OCTI_EXECCLASS_DECL, execclass_decl): New. (finish_file, start_class, continue_class, finish_class, start_method_def, continue_method_def, finish_method_def, start_protocol, finish_protocol, objc_build_throw_stmt, objc_build_try_catch_finally_stmt, objc_build_synchronized_prologue, objc_build_synchronized_epilogue, objc_build_try_prologue, objc_build_try_epilogue, objc_build_catch_stmt, objc_build_catch_epilogue, objc_build_finally_prologue, objc_build_finally_epilogue, is_ivar, is_private, is_public, add_instance_variable, objc_add_method, get_super_receiver, objc_clear_super_receiver, get_class_ivars_from_name, get_class_reference, get_static_reference, get_object_reference, build_message_expr, finish_message_expr, build_selector_expr, build_ivar_reference, build_keyword_decl, build_method_decl, build_protocol_expr, build_objc_string_object, objc_declare_alias, objc_declare_class, objc_declare_protocols, objc_comptypes, objc_check_decl, build_encode_expr): Remove prototypes. (imp_count, cat_count): Make GGC-aware. (OBJC_SET_TYPE_NAME): New macro. From-SVN: r87168
2004-09-08 02:49:44 +02:00
/* id self; */
objc_push_parm (build_decl (PARM_DECL, self_id, self_type));
1992-01-18 00:15:38 +01:00
Makefile.in (c-parse.o): Depend on $(C_COMMON_H). [gcc/ChangeLog] 2004-09-07 Ziemowit Laski <zlaski@apple.com> * Makefile.in (c-parse.o): Depend on $(C_COMMON_H). * c-parse.in: Include c-common.h instead of objc-act.h. (ivar_decl_list, ivar_decls, ivar_decl, ivars, ivar_declarator, myparms, myparm): Remove %type declarations. (methodtype, optparms, OBJC_TYPE_QUAL, objc_quals, objc_qual, objc_typename, objc_try_catch_stmt, optellipsis): Add %type declarations. (objc_inherit_code, objc_public_flag): Remove. (typespec_nonreserved_nonattr): Call objc_get_protocol_qualified_type() instead of get_static_reference() and get_protocol_reference(). (stmt_nocomp): Call grokparm() on @catch parameter. (objcdef): Move semantic action to objc_finish_implementation(). (classdef): Move semantic action to objc_start_class_interface(), objc_continue_interface(), objc_finish_interface(), objc_start_class_implementation(), objc_continue_implementation(), objc_start_category_interface() and objc_start_category_implementation(). (protocoldef): Move semantic actions to objc_start_protocol() and objc_finish_interface(). (ivar_decl_list): Remove nonterminal. (visibility_spec): Move semantic actions to objc_set_visibility(). (ivar_decls): Remove assignment to $$. (ivar_decl): Rephrase in terms of component_decl; call objc_add_instance_variable(). (ivars, ivar_declarator): Remove nonterminals. (opt_semi): New nonterminal. (methodtype): Remove semantic actions. (methoddef): Move semantic actions to objc_set_method_type(), objc_start_method_definition() and objc_finish_method_definition(). (methodproto): Move semantic actions to objc_set_method_type() and objc_add_method_declaration(). (methoddecl): Use objc_typename instead of typename; move semantic actions to objc_build_method_signature(). (optarglist, myxdecls, mydecl, myparms, myparm): Remove nonterminals. (optparmlist): Express in terms of optparms and optellipsis. (optparms, optellipsis, objc_qual, objc_quals, objc_typename): New nonterminals. (keyworddecl): Use objc_typename instead of typename. (rid_to_yy): Mark RID_IN, RID_OUT, RID_INOUT, RID_BYCOPY, RID_BYREF and RID_ONEWAY as returning OBJC_TYPE_QUAL to yyparse(). [gcc/objc/ChangeLog] 2004-09-07 Ziemowit Laski <zlaski@apple.com> * Make-lang.in (objc/objc-parse.o): Depend on $(C_COMMON_H) instead of objc/objc-act.h. (objc/objc-act.o): Depend on $(HASHTAB_H). * objc-act.c: Include hashtab.h; in ObjC++ mode, include cp-tree.h and objcp-decl.h instead of c-tree.h. (build_module_descriptor, get_class_ivars, synth_id_with_class_suffix, error_with_ivar, gen_method_decl, gen_declaration, setup_string_decl, build_protocol_template): Adjust prototypes. (build_module_initializer_routine, start_class, continue_class, finish_class, start_method_def, objc_start_function, start_protocol, build_method_decl, objc_add_method, add_instance_variable, build_ivar_reference, is_ivar, is_private, get_super_receiver, build_selector_table_decl, objc_push_parm, objc_get_parm_info, gen_type_name, gen_type_name_0, start_var_decl, finish_var_decl, create_field_decl): New prototypes. (objc_expand_function_end, comp_method_with_proto, objc_expr_last, gen_declaration_1, gen_declarator, is_complex_decl, adorn_decl, define_decl, create_builtin_decl, gen_declspecs): Remove prototypes. (TYPE_ID): Rename to OBJECT_TYPEDEF_NAME. (CLASS_TYPEDEF_NAME): New. (TAG_EXECCLASS): Change from a global variable to a #define. (TAG_RETURN_STRUCT): Delete. (TAG_GNUINIT): New, holds '__objc_gnu_init' name. (objc_inherit_code, objc_public_flag): New, moved from c-parse.in. (string_descriptor): New struct. (string_htab): New hash table. (string_hash, string_eq): New prototypes. (generate_struct_by_value_array): Call create_field_decl() instead of create_builtin_decl(). (objc_init): Do not initialize objc_ellipsis_node or TAG_EXECCLASS; In ObjC++ mode, call cxx_init() instead of c_objc_common_init(). (objc_finish_file): In ObjC++, call instantiate_pending_templates() and cp_finish_file(). (define_decl, get_static_reference, get_protocol_reference, create_builtin_decl): Remove functions. (objc_start_class_interface, objc_start_category_interface, objc_start_protocol, objc_continue_interface, objc_finish_interface, objc_start_class_implementation, objc_start_category_implementation, objc_continue_implementation, objc_finish_implementation, objc_set_visibility, objc_set_method_type, objc_build_method_signature, objc_add_method_declaration, objc_start_method_definition, objc_add_instance_variable, objc_get_protocol_qualified_type, create_field_decl, start_var_decl, finish_var_decl): New functions. (setup_string_decl): Simplify since it is only called once. (synth_module_prologue): Call build_class_template(); predefine 'id' and 'Class' as typedefs; rename 'temp_type' to 'type'; disable debug hooks for duration of function; fix GNU runtime messenger signatures to correspond to reality; forward-declare '__objc_exec_class' for the GNU runtime; call build_selector_table_decl(); in ObjC++ mode, generate 'extern "C" { ... }' wrappers around synthesized declarations; call build_protocol_template() and build_category_template(). (string_hash, string_eq): New functions. (objc_build_string_object): Check metaclass correctness only once; store string literals in hash table. (objc_build_constructor): Do not convert initializer elements; adjust for ObjC++ impedance mismatch. (build_objc_symtab_template): Call create_field_decl() instead of create_builtin_decl(). (init_objc_symtab): Add missing conversion to initializer element. (build_metadata_decl): Call start_var_decl() instead of define_decl(). (generate_objc_symtab_decl): Do not call build_category_template(); call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(). (build_module_descriptor): Call create_field_decl() instead of grokfield(); call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(); always mark module descriptor as used; move GNU runtime-specific functionality to build_module_initializer_routine(). (build_module_initializer_routine): New function, broken off of build_module_descriptor(). (objc_static_init_needed_p, objc_generate_static_init_call): New functions. (generate_static_references, generate_strings, build_selector_translation_table, generate_descriptor_table, generate_ivars_list, generate_dispatch_table, generate_category): Call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(); build a type directly instead of via groktypename(). (build_selector_reference_decl, build_selector_table_decl, build_class_reference_decl, build_protocol_reference, generate_objc_image_info): Call start_var_decl() instead of build_decl(). (build_selector_reference): For GNU runtime, do not call build_selector_reference_decl(). (build_selector, build_typed_selector_reference): Always convert result to the selector type. (add_objc_string): Cast return value to 'char *'. (build_method_prototype_template, build_selector_template, build_method_template): Use actual selector type for fields pointing to selectors. (finish_objc): For GNU runtime, call build_module_initializer_routine() after build_module_descriptor(). (generate_protocol_list, generate_shared_structures): Call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(); build a type directly instead of via groktypename(). (synth_id_with_class_suffix): Return a string. (get_arg_type_list): For instance methods, use the instance type for 'self'; do not call groktypename_in_parm_context(). (build_objc_string_decl): Squash redeclaration errors in ObjC++. (objc_is_class_name): Use OBJC_TYPE_NAME instead of TYPE_NAME; handle RECORD_TYPEs in ObjC as well as ObjC++. (objc_is_id): New function. (objc_is_object_ptr): Return the canonical type node. (objc_get_class_ivars): Simplify using get_class_ivars(). (get_class_ivars): Remove second parameter; create a fresh copy of the ivar list for each call; do not check for existence of super class. (objc_eh_runtime_type): Mark #ifndef OBJCPLUS. (objc_init_exceptions): When using SJLJ-style exceptions, require the use of '-fobjc-exceptions' flag; do not require it for DWARF-style exceptions. (objc_build_exc_ptr, next_sjlj_build_try_catch_finally): Use objc_object_type instead of objc_id_type. (objc_begin_catch_clause): Convert the incoming PARM_DECL into a VAR_DECL before placing it in the appropriate scope; do not call define_decl(); adjust call to c_begin_compound_stmt(); use objc_object_type instead of objc_id_type. (build_next_objc_exception_stuff): Call create_field_decl() instead of create_builtin_decl(); construct type directly instead of calling groktypename(); use OBJC_VOID_AT_END to mark end of function parameters. (build_private_template): Adjust call to get_class_ivars(); build a type directly instead of via groktypename(). (build_protocol_template, build_method_prototype_list_template, build_method_prototype_template, build_category_template, build_selector_template, build_class_template, build_super_template, build_ivar_template, build_ivar_list_template, build_method_list_template, build_method_template): Call create_field_decl() instead of grokfield(). (objc_method_parm_type): Do not call groktypename(). (generate_descriptor_table): Call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(). (generate_method_descriptors, build_protocol_initializer, generate_dispatch_tables, build_category_initializer, build_shared_structure_initializer): Do not call groktypename(). (generate_protocols): Call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(); do not call groktypename(). (error_with_ivar): Remove last parameter. (check_ivars): Do not iterate ovar CLASS_RAW_IVARS lists in addition to CLASS_IVARS lists; adjust calls to error_with_ivar(). (generate_ivar_lists): Convert one of the initializer elements; do not call groktypename(). (get_arg_type_list, start_method_def, gen_method_def): Account for new representation of variable arguments and '...' in Objective-C methods; add Objective-C++ impedance matching code. (is_objc_type_qualifier): Remove function. (adjust_type_for_id_default): Simplify; there is no longer a need to wade through declspecs. (lookup_interface, start_class, continue_class, finish_class, start_method_def, start_protocol, build_method_decl, objc_add_method, add_instance_variable, build_ivar_reference, is_ivar, is_private, get_super_receiver, objc_build_finally_epilogue): Make into static functions. (receiver_is_class_object): Use new IS_CLASS() macro. (objc_build_message_expr): Tweak ObjC++ message argument handling; call objc_finish_message_expr() instead of finish_message_expr(). (finish_message_expr): Rename to objc_finish_message_expr(); use OBJC_TYPE_NAME and OBJC_SET_TYPE_NAME macros instead of TYPE_NAME. call gen_type_name() instead of gen_declaration(); call objc_is_id() instead of using IS_ID and IS_CLASS; Use objc_class_name instead of calling get_identifier("Class"); handle CONVERT_EXPRs in receiver. (build_objc_method_call, warn_with_method): Do not call groktypename(). (build_ivar_reference): Call convert() instead of clobbering in a type. (hash_init): Initialize string_htab hash table. (add_instance_variable): Simplify parameter list; do not call grokfield(); do not populate CLASS_IVARS list. (start_class): Check for the existence of super class, if one was specified. (continue_class): Use CLASS_RAW_IVARS rather than CLASS_IVARS; do not call build_class_template(); adjust call to get_class_ivars(); call build_decl(), pushdecl() and finish_decl() instead of define_decl(). (finish_class): Call build_decl(), pushdecl() and finish_decl() instead of define_decl(). (add_protocols): Use PROTOCOL_BINFO_ELTS for the tree vector size. (start_protocol): Do not call build_protocol_template(); use PROTOCOL_BINFO_ELTS for the tree vector size. (encode_type_qualifiers): Do not handle the 'const' qualifier here. (encode_pointer): Encode 'const char *' as 'r*', for backwards compatibility. (encode_array): Use HOST_WIDE_INT_PRINT_DEC instead of "%ld". (encode_type): Handle the 'const' qualifier here. (objc_parmlist): New global variable, sued by objc_push_parm and objc_get_parm_info(). (objc_push_parm, objc_get_parm_info): New functions. (objc_expr_last): Remove function. (synth_self_and_ucmd_args): For instance methods, use the instance type for 'self'; call objc_push_parm() instead of push_parm_decl(). (start_method_def): Do not call push_scope(), declare_parm_level(), pop_scope(), push_parm_decl(), store_parm_decls() or objc_expr_last(); just use objc_push_parm() and objc_get_parm_info(). (comp_method_with_proto): Remove function. (objc_types_are_equivalent): Strip away indirections before comparing underlying types. (comp_proto_with_proto): Do not call groktypename(); types are no longer in raw declspec format. (objc_start_function): New function. (really_start_method): Call comp_proto_with_proto() instead of comp_method_with_proto(); call objc_start_function() instead of hand-crafting a function declarator. (continue_method_def, objc_expand_function_end): Remove functions. (get_super_receiver): Call objc_get_current_scope() instead of get_current_scope(); reference 'super_class' field (instead of 'class'). (finish_method_def): Rename to objc_finish_method_definition() and add a function decl parameter; move method encoding call from objc_expand_function_end(). (is_complex_decl, adorn_decl, gen_declarator, gen_declspecs, gen_declaration_1): Remove functions. (tmpbuf, RAW_DECLSPEC): Remove. (gen_declaration): Remove second parameter; simplify to deal with TYPE_P nodes instead of raw declspecs. (gen_type_name, gen_type_name_0): New functions. (gen_method_decl): Remove second parameter; call gen_type_name() instead of gen_declaration_1(). (dump_interface): Adjust calls to gen_declaration() and gen_method_decl(); do not allocate a separate string buffer. (init_objc): Allocate a larger string buffer to accommodate dump_interface(); adjust call to build_module_descriptor(); add call to build_module_initializer_routine() for the GNU runtime. (generate_classref_translation_entry): Do not call start_decl(); call finish_var_decl() instead of finish_decl(); call convert() instead of build_c_cast(). * objc-act.h (CLASS_OWN_IVARS): Remove accessor. (CLASS_BINFO_ELTS): Reduce from 6 to 5, now that CLASS_OWN_IVARS is gone. (OCTI_GNU_INIT_DECL, GNU_INIT_decl): New. (OCTI_ELLIPSIS_NODE, objc_ellipsis_node): Remove. (OCTI_ID_ID, id_type, objc_id_id): Rename to OCTI_ID_NAME, objc_object_type and objc_object_name, respectively. (OCTI_CLS_REF, OCTI_CLASS_NAME, objc_class_reference, objc_class_name): New. (IS_CLASS): New macro. (IS_ID, IS_SUPER): Robustify. (OCTI_EXECCLASS_DECL, execclass_decl): New. (finish_file, start_class, continue_class, finish_class, start_method_def, continue_method_def, finish_method_def, start_protocol, finish_protocol, objc_build_throw_stmt, objc_build_try_catch_finally_stmt, objc_build_synchronized_prologue, objc_build_synchronized_epilogue, objc_build_try_prologue, objc_build_try_epilogue, objc_build_catch_stmt, objc_build_catch_epilogue, objc_build_finally_prologue, objc_build_finally_epilogue, is_ivar, is_private, is_public, add_instance_variable, objc_add_method, get_super_receiver, objc_clear_super_receiver, get_class_ivars_from_name, get_class_reference, get_static_reference, get_object_reference, build_message_expr, finish_message_expr, build_selector_expr, build_ivar_reference, build_keyword_decl, build_method_decl, build_protocol_expr, build_objc_string_object, objc_declare_alias, objc_declare_class, objc_declare_protocols, objc_comptypes, objc_check_decl, build_encode_expr): Remove prototypes. (imp_count, cat_count): Make GGC-aware. (OBJC_SET_TYPE_NAME): New macro. From-SVN: r87168
2004-09-08 02:49:44 +02:00
/* SEL _cmd; */
objc_push_parm (build_decl (PARM_DECL, ucmd_id, objc_selector_type));
}
Makefile.in (c-parse.o): Depend on $(C_COMMON_H). [gcc/ChangeLog] 2004-09-07 Ziemowit Laski <zlaski@apple.com> * Makefile.in (c-parse.o): Depend on $(C_COMMON_H). * c-parse.in: Include c-common.h instead of objc-act.h. (ivar_decl_list, ivar_decls, ivar_decl, ivars, ivar_declarator, myparms, myparm): Remove %type declarations. (methodtype, optparms, OBJC_TYPE_QUAL, objc_quals, objc_qual, objc_typename, objc_try_catch_stmt, optellipsis): Add %type declarations. (objc_inherit_code, objc_public_flag): Remove. (typespec_nonreserved_nonattr): Call objc_get_protocol_qualified_type() instead of get_static_reference() and get_protocol_reference(). (stmt_nocomp): Call grokparm() on @catch parameter. (objcdef): Move semantic action to objc_finish_implementation(). (classdef): Move semantic action to objc_start_class_interface(), objc_continue_interface(), objc_finish_interface(), objc_start_class_implementation(), objc_continue_implementation(), objc_start_category_interface() and objc_start_category_implementation(). (protocoldef): Move semantic actions to objc_start_protocol() and objc_finish_interface(). (ivar_decl_list): Remove nonterminal. (visibility_spec): Move semantic actions to objc_set_visibility(). (ivar_decls): Remove assignment to $$. (ivar_decl): Rephrase in terms of component_decl; call objc_add_instance_variable(). (ivars, ivar_declarator): Remove nonterminals. (opt_semi): New nonterminal. (methodtype): Remove semantic actions. (methoddef): Move semantic actions to objc_set_method_type(), objc_start_method_definition() and objc_finish_method_definition(). (methodproto): Move semantic actions to objc_set_method_type() and objc_add_method_declaration(). (methoddecl): Use objc_typename instead of typename; move semantic actions to objc_build_method_signature(). (optarglist, myxdecls, mydecl, myparms, myparm): Remove nonterminals. (optparmlist): Express in terms of optparms and optellipsis. (optparms, optellipsis, objc_qual, objc_quals, objc_typename): New nonterminals. (keyworddecl): Use objc_typename instead of typename. (rid_to_yy): Mark RID_IN, RID_OUT, RID_INOUT, RID_BYCOPY, RID_BYREF and RID_ONEWAY as returning OBJC_TYPE_QUAL to yyparse(). [gcc/objc/ChangeLog] 2004-09-07 Ziemowit Laski <zlaski@apple.com> * Make-lang.in (objc/objc-parse.o): Depend on $(C_COMMON_H) instead of objc/objc-act.h. (objc/objc-act.o): Depend on $(HASHTAB_H). * objc-act.c: Include hashtab.h; in ObjC++ mode, include cp-tree.h and objcp-decl.h instead of c-tree.h. (build_module_descriptor, get_class_ivars, synth_id_with_class_suffix, error_with_ivar, gen_method_decl, gen_declaration, setup_string_decl, build_protocol_template): Adjust prototypes. (build_module_initializer_routine, start_class, continue_class, finish_class, start_method_def, objc_start_function, start_protocol, build_method_decl, objc_add_method, add_instance_variable, build_ivar_reference, is_ivar, is_private, get_super_receiver, build_selector_table_decl, objc_push_parm, objc_get_parm_info, gen_type_name, gen_type_name_0, start_var_decl, finish_var_decl, create_field_decl): New prototypes. (objc_expand_function_end, comp_method_with_proto, objc_expr_last, gen_declaration_1, gen_declarator, is_complex_decl, adorn_decl, define_decl, create_builtin_decl, gen_declspecs): Remove prototypes. (TYPE_ID): Rename to OBJECT_TYPEDEF_NAME. (CLASS_TYPEDEF_NAME): New. (TAG_EXECCLASS): Change from a global variable to a #define. (TAG_RETURN_STRUCT): Delete. (TAG_GNUINIT): New, holds '__objc_gnu_init' name. (objc_inherit_code, objc_public_flag): New, moved from c-parse.in. (string_descriptor): New struct. (string_htab): New hash table. (string_hash, string_eq): New prototypes. (generate_struct_by_value_array): Call create_field_decl() instead of create_builtin_decl(). (objc_init): Do not initialize objc_ellipsis_node or TAG_EXECCLASS; In ObjC++ mode, call cxx_init() instead of c_objc_common_init(). (objc_finish_file): In ObjC++, call instantiate_pending_templates() and cp_finish_file(). (define_decl, get_static_reference, get_protocol_reference, create_builtin_decl): Remove functions. (objc_start_class_interface, objc_start_category_interface, objc_start_protocol, objc_continue_interface, objc_finish_interface, objc_start_class_implementation, objc_start_category_implementation, objc_continue_implementation, objc_finish_implementation, objc_set_visibility, objc_set_method_type, objc_build_method_signature, objc_add_method_declaration, objc_start_method_definition, objc_add_instance_variable, objc_get_protocol_qualified_type, create_field_decl, start_var_decl, finish_var_decl): New functions. (setup_string_decl): Simplify since it is only called once. (synth_module_prologue): Call build_class_template(); predefine 'id' and 'Class' as typedefs; rename 'temp_type' to 'type'; disable debug hooks for duration of function; fix GNU runtime messenger signatures to correspond to reality; forward-declare '__objc_exec_class' for the GNU runtime; call build_selector_table_decl(); in ObjC++ mode, generate 'extern "C" { ... }' wrappers around synthesized declarations; call build_protocol_template() and build_category_template(). (string_hash, string_eq): New functions. (objc_build_string_object): Check metaclass correctness only once; store string literals in hash table. (objc_build_constructor): Do not convert initializer elements; adjust for ObjC++ impedance mismatch. (build_objc_symtab_template): Call create_field_decl() instead of create_builtin_decl(). (init_objc_symtab): Add missing conversion to initializer element. (build_metadata_decl): Call start_var_decl() instead of define_decl(). (generate_objc_symtab_decl): Do not call build_category_template(); call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(). (build_module_descriptor): Call create_field_decl() instead of grokfield(); call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(); always mark module descriptor as used; move GNU runtime-specific functionality to build_module_initializer_routine(). (build_module_initializer_routine): New function, broken off of build_module_descriptor(). (objc_static_init_needed_p, objc_generate_static_init_call): New functions. (generate_static_references, generate_strings, build_selector_translation_table, generate_descriptor_table, generate_ivars_list, generate_dispatch_table, generate_category): Call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(); build a type directly instead of via groktypename(). (build_selector_reference_decl, build_selector_table_decl, build_class_reference_decl, build_protocol_reference, generate_objc_image_info): Call start_var_decl() instead of build_decl(). (build_selector_reference): For GNU runtime, do not call build_selector_reference_decl(). (build_selector, build_typed_selector_reference): Always convert result to the selector type. (add_objc_string): Cast return value to 'char *'. (build_method_prototype_template, build_selector_template, build_method_template): Use actual selector type for fields pointing to selectors. (finish_objc): For GNU runtime, call build_module_initializer_routine() after build_module_descriptor(). (generate_protocol_list, generate_shared_structures): Call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(); build a type directly instead of via groktypename(). (synth_id_with_class_suffix): Return a string. (get_arg_type_list): For instance methods, use the instance type for 'self'; do not call groktypename_in_parm_context(). (build_objc_string_decl): Squash redeclaration errors in ObjC++. (objc_is_class_name): Use OBJC_TYPE_NAME instead of TYPE_NAME; handle RECORD_TYPEs in ObjC as well as ObjC++. (objc_is_id): New function. (objc_is_object_ptr): Return the canonical type node. (objc_get_class_ivars): Simplify using get_class_ivars(). (get_class_ivars): Remove second parameter; create a fresh copy of the ivar list for each call; do not check for existence of super class. (objc_eh_runtime_type): Mark #ifndef OBJCPLUS. (objc_init_exceptions): When using SJLJ-style exceptions, require the use of '-fobjc-exceptions' flag; do not require it for DWARF-style exceptions. (objc_build_exc_ptr, next_sjlj_build_try_catch_finally): Use objc_object_type instead of objc_id_type. (objc_begin_catch_clause): Convert the incoming PARM_DECL into a VAR_DECL before placing it in the appropriate scope; do not call define_decl(); adjust call to c_begin_compound_stmt(); use objc_object_type instead of objc_id_type. (build_next_objc_exception_stuff): Call create_field_decl() instead of create_builtin_decl(); construct type directly instead of calling groktypename(); use OBJC_VOID_AT_END to mark end of function parameters. (build_private_template): Adjust call to get_class_ivars(); build a type directly instead of via groktypename(). (build_protocol_template, build_method_prototype_list_template, build_method_prototype_template, build_category_template, build_selector_template, build_class_template, build_super_template, build_ivar_template, build_ivar_list_template, build_method_list_template, build_method_template): Call create_field_decl() instead of grokfield(). (objc_method_parm_type): Do not call groktypename(). (generate_descriptor_table): Call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(). (generate_method_descriptors, build_protocol_initializer, generate_dispatch_tables, build_category_initializer, build_shared_structure_initializer): Do not call groktypename(). (generate_protocols): Call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(); do not call groktypename(). (error_with_ivar): Remove last parameter. (check_ivars): Do not iterate ovar CLASS_RAW_IVARS lists in addition to CLASS_IVARS lists; adjust calls to error_with_ivar(). (generate_ivar_lists): Convert one of the initializer elements; do not call groktypename(). (get_arg_type_list, start_method_def, gen_method_def): Account for new representation of variable arguments and '...' in Objective-C methods; add Objective-C++ impedance matching code. (is_objc_type_qualifier): Remove function. (adjust_type_for_id_default): Simplify; there is no longer a need to wade through declspecs. (lookup_interface, start_class, continue_class, finish_class, start_method_def, start_protocol, build_method_decl, objc_add_method, add_instance_variable, build_ivar_reference, is_ivar, is_private, get_super_receiver, objc_build_finally_epilogue): Make into static functions. (receiver_is_class_object): Use new IS_CLASS() macro. (objc_build_message_expr): Tweak ObjC++ message argument handling; call objc_finish_message_expr() instead of finish_message_expr(). (finish_message_expr): Rename to objc_finish_message_expr(); use OBJC_TYPE_NAME and OBJC_SET_TYPE_NAME macros instead of TYPE_NAME. call gen_type_name() instead of gen_declaration(); call objc_is_id() instead of using IS_ID and IS_CLASS; Use objc_class_name instead of calling get_identifier("Class"); handle CONVERT_EXPRs in receiver. (build_objc_method_call, warn_with_method): Do not call groktypename(). (build_ivar_reference): Call convert() instead of clobbering in a type. (hash_init): Initialize string_htab hash table. (add_instance_variable): Simplify parameter list; do not call grokfield(); do not populate CLASS_IVARS list. (start_class): Check for the existence of super class, if one was specified. (continue_class): Use CLASS_RAW_IVARS rather than CLASS_IVARS; do not call build_class_template(); adjust call to get_class_ivars(); call build_decl(), pushdecl() and finish_decl() instead of define_decl(). (finish_class): Call build_decl(), pushdecl() and finish_decl() instead of define_decl(). (add_protocols): Use PROTOCOL_BINFO_ELTS for the tree vector size. (start_protocol): Do not call build_protocol_template(); use PROTOCOL_BINFO_ELTS for the tree vector size. (encode_type_qualifiers): Do not handle the 'const' qualifier here. (encode_pointer): Encode 'const char *' as 'r*', for backwards compatibility. (encode_array): Use HOST_WIDE_INT_PRINT_DEC instead of "%ld". (encode_type): Handle the 'const' qualifier here. (objc_parmlist): New global variable, sued by objc_push_parm and objc_get_parm_info(). (objc_push_parm, objc_get_parm_info): New functions. (objc_expr_last): Remove function. (synth_self_and_ucmd_args): For instance methods, use the instance type for 'self'; call objc_push_parm() instead of push_parm_decl(). (start_method_def): Do not call push_scope(), declare_parm_level(), pop_scope(), push_parm_decl(), store_parm_decls() or objc_expr_last(); just use objc_push_parm() and objc_get_parm_info(). (comp_method_with_proto): Remove function. (objc_types_are_equivalent): Strip away indirections before comparing underlying types. (comp_proto_with_proto): Do not call groktypename(); types are no longer in raw declspec format. (objc_start_function): New function. (really_start_method): Call comp_proto_with_proto() instead of comp_method_with_proto(); call objc_start_function() instead of hand-crafting a function declarator. (continue_method_def, objc_expand_function_end): Remove functions. (get_super_receiver): Call objc_get_current_scope() instead of get_current_scope(); reference 'super_class' field (instead of 'class'). (finish_method_def): Rename to objc_finish_method_definition() and add a function decl parameter; move method encoding call from objc_expand_function_end(). (is_complex_decl, adorn_decl, gen_declarator, gen_declspecs, gen_declaration_1): Remove functions. (tmpbuf, RAW_DECLSPEC): Remove. (gen_declaration): Remove second parameter; simplify to deal with TYPE_P nodes instead of raw declspecs. (gen_type_name, gen_type_name_0): New functions. (gen_method_decl): Remove second parameter; call gen_type_name() instead of gen_declaration_1(). (dump_interface): Adjust calls to gen_declaration() and gen_method_decl(); do not allocate a separate string buffer. (init_objc): Allocate a larger string buffer to accommodate dump_interface(); adjust call to build_module_descriptor(); add call to build_module_initializer_routine() for the GNU runtime. (generate_classref_translation_entry): Do not call start_decl(); call finish_var_decl() instead of finish_decl(); call convert() instead of build_c_cast(). * objc-act.h (CLASS_OWN_IVARS): Remove accessor. (CLASS_BINFO_ELTS): Reduce from 6 to 5, now that CLASS_OWN_IVARS is gone. (OCTI_GNU_INIT_DECL, GNU_INIT_decl): New. (OCTI_ELLIPSIS_NODE, objc_ellipsis_node): Remove. (OCTI_ID_ID, id_type, objc_id_id): Rename to OCTI_ID_NAME, objc_object_type and objc_object_name, respectively. (OCTI_CLS_REF, OCTI_CLASS_NAME, objc_class_reference, objc_class_name): New. (IS_CLASS): New macro. (IS_ID, IS_SUPER): Robustify. (OCTI_EXECCLASS_DECL, execclass_decl): New. (finish_file, start_class, continue_class, finish_class, start_method_def, continue_method_def, finish_method_def, start_protocol, finish_protocol, objc_build_throw_stmt, objc_build_try_catch_finally_stmt, objc_build_synchronized_prologue, objc_build_synchronized_epilogue, objc_build_try_prologue, objc_build_try_epilogue, objc_build_catch_stmt, objc_build_catch_epilogue, objc_build_finally_prologue, objc_build_finally_epilogue, is_ivar, is_private, is_public, add_instance_variable, objc_add_method, get_super_receiver, objc_clear_super_receiver, get_class_ivars_from_name, get_class_reference, get_static_reference, get_object_reference, build_message_expr, finish_message_expr, build_selector_expr, build_ivar_reference, build_keyword_decl, build_method_decl, build_protocol_expr, build_objc_string_object, objc_declare_alias, objc_declare_class, objc_declare_protocols, objc_comptypes, objc_check_decl, build_encode_expr): Remove prototypes. (imp_count, cat_count): Make GGC-aware. (OBJC_SET_TYPE_NAME): New macro. From-SVN: r87168
2004-09-08 02:49:44 +02:00
/* Transform an Objective-C method definition into a static C function
definition, synthesizing the first two arguments, "self" and "_cmd",
in the process. */
Makefile.in (c-parse.o): Depend on $(C_COMMON_H). [gcc/ChangeLog] 2004-09-07 Ziemowit Laski <zlaski@apple.com> * Makefile.in (c-parse.o): Depend on $(C_COMMON_H). * c-parse.in: Include c-common.h instead of objc-act.h. (ivar_decl_list, ivar_decls, ivar_decl, ivars, ivar_declarator, myparms, myparm): Remove %type declarations. (methodtype, optparms, OBJC_TYPE_QUAL, objc_quals, objc_qual, objc_typename, objc_try_catch_stmt, optellipsis): Add %type declarations. (objc_inherit_code, objc_public_flag): Remove. (typespec_nonreserved_nonattr): Call objc_get_protocol_qualified_type() instead of get_static_reference() and get_protocol_reference(). (stmt_nocomp): Call grokparm() on @catch parameter. (objcdef): Move semantic action to objc_finish_implementation(). (classdef): Move semantic action to objc_start_class_interface(), objc_continue_interface(), objc_finish_interface(), objc_start_class_implementation(), objc_continue_implementation(), objc_start_category_interface() and objc_start_category_implementation(). (protocoldef): Move semantic actions to objc_start_protocol() and objc_finish_interface(). (ivar_decl_list): Remove nonterminal. (visibility_spec): Move semantic actions to objc_set_visibility(). (ivar_decls): Remove assignment to $$. (ivar_decl): Rephrase in terms of component_decl; call objc_add_instance_variable(). (ivars, ivar_declarator): Remove nonterminals. (opt_semi): New nonterminal. (methodtype): Remove semantic actions. (methoddef): Move semantic actions to objc_set_method_type(), objc_start_method_definition() and objc_finish_method_definition(). (methodproto): Move semantic actions to objc_set_method_type() and objc_add_method_declaration(). (methoddecl): Use objc_typename instead of typename; move semantic actions to objc_build_method_signature(). (optarglist, myxdecls, mydecl, myparms, myparm): Remove nonterminals. (optparmlist): Express in terms of optparms and optellipsis. (optparms, optellipsis, objc_qual, objc_quals, objc_typename): New nonterminals. (keyworddecl): Use objc_typename instead of typename. (rid_to_yy): Mark RID_IN, RID_OUT, RID_INOUT, RID_BYCOPY, RID_BYREF and RID_ONEWAY as returning OBJC_TYPE_QUAL to yyparse(). [gcc/objc/ChangeLog] 2004-09-07 Ziemowit Laski <zlaski@apple.com> * Make-lang.in (objc/objc-parse.o): Depend on $(C_COMMON_H) instead of objc/objc-act.h. (objc/objc-act.o): Depend on $(HASHTAB_H). * objc-act.c: Include hashtab.h; in ObjC++ mode, include cp-tree.h and objcp-decl.h instead of c-tree.h. (build_module_descriptor, get_class_ivars, synth_id_with_class_suffix, error_with_ivar, gen_method_decl, gen_declaration, setup_string_decl, build_protocol_template): Adjust prototypes. (build_module_initializer_routine, start_class, continue_class, finish_class, start_method_def, objc_start_function, start_protocol, build_method_decl, objc_add_method, add_instance_variable, build_ivar_reference, is_ivar, is_private, get_super_receiver, build_selector_table_decl, objc_push_parm, objc_get_parm_info, gen_type_name, gen_type_name_0, start_var_decl, finish_var_decl, create_field_decl): New prototypes. (objc_expand_function_end, comp_method_with_proto, objc_expr_last, gen_declaration_1, gen_declarator, is_complex_decl, adorn_decl, define_decl, create_builtin_decl, gen_declspecs): Remove prototypes. (TYPE_ID): Rename to OBJECT_TYPEDEF_NAME. (CLASS_TYPEDEF_NAME): New. (TAG_EXECCLASS): Change from a global variable to a #define. (TAG_RETURN_STRUCT): Delete. (TAG_GNUINIT): New, holds '__objc_gnu_init' name. (objc_inherit_code, objc_public_flag): New, moved from c-parse.in. (string_descriptor): New struct. (string_htab): New hash table. (string_hash, string_eq): New prototypes. (generate_struct_by_value_array): Call create_field_decl() instead of create_builtin_decl(). (objc_init): Do not initialize objc_ellipsis_node or TAG_EXECCLASS; In ObjC++ mode, call cxx_init() instead of c_objc_common_init(). (objc_finish_file): In ObjC++, call instantiate_pending_templates() and cp_finish_file(). (define_decl, get_static_reference, get_protocol_reference, create_builtin_decl): Remove functions. (objc_start_class_interface, objc_start_category_interface, objc_start_protocol, objc_continue_interface, objc_finish_interface, objc_start_class_implementation, objc_start_category_implementation, objc_continue_implementation, objc_finish_implementation, objc_set_visibility, objc_set_method_type, objc_build_method_signature, objc_add_method_declaration, objc_start_method_definition, objc_add_instance_variable, objc_get_protocol_qualified_type, create_field_decl, start_var_decl, finish_var_decl): New functions. (setup_string_decl): Simplify since it is only called once. (synth_module_prologue): Call build_class_template(); predefine 'id' and 'Class' as typedefs; rename 'temp_type' to 'type'; disable debug hooks for duration of function; fix GNU runtime messenger signatures to correspond to reality; forward-declare '__objc_exec_class' for the GNU runtime; call build_selector_table_decl(); in ObjC++ mode, generate 'extern "C" { ... }' wrappers around synthesized declarations; call build_protocol_template() and build_category_template(). (string_hash, string_eq): New functions. (objc_build_string_object): Check metaclass correctness only once; store string literals in hash table. (objc_build_constructor): Do not convert initializer elements; adjust for ObjC++ impedance mismatch. (build_objc_symtab_template): Call create_field_decl() instead of create_builtin_decl(). (init_objc_symtab): Add missing conversion to initializer element. (build_metadata_decl): Call start_var_decl() instead of define_decl(). (generate_objc_symtab_decl): Do not call build_category_template(); call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(). (build_module_descriptor): Call create_field_decl() instead of grokfield(); call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(); always mark module descriptor as used; move GNU runtime-specific functionality to build_module_initializer_routine(). (build_module_initializer_routine): New function, broken off of build_module_descriptor(). (objc_static_init_needed_p, objc_generate_static_init_call): New functions. (generate_static_references, generate_strings, build_selector_translation_table, generate_descriptor_table, generate_ivars_list, generate_dispatch_table, generate_category): Call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(); build a type directly instead of via groktypename(). (build_selector_reference_decl, build_selector_table_decl, build_class_reference_decl, build_protocol_reference, generate_objc_image_info): Call start_var_decl() instead of build_decl(). (build_selector_reference): For GNU runtime, do not call build_selector_reference_decl(). (build_selector, build_typed_selector_reference): Always convert result to the selector type. (add_objc_string): Cast return value to 'char *'. (build_method_prototype_template, build_selector_template, build_method_template): Use actual selector type for fields pointing to selectors. (finish_objc): For GNU runtime, call build_module_initializer_routine() after build_module_descriptor(). (generate_protocol_list, generate_shared_structures): Call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(); build a type directly instead of via groktypename(). (synth_id_with_class_suffix): Return a string. (get_arg_type_list): For instance methods, use the instance type for 'self'; do not call groktypename_in_parm_context(). (build_objc_string_decl): Squash redeclaration errors in ObjC++. (objc_is_class_name): Use OBJC_TYPE_NAME instead of TYPE_NAME; handle RECORD_TYPEs in ObjC as well as ObjC++. (objc_is_id): New function. (objc_is_object_ptr): Return the canonical type node. (objc_get_class_ivars): Simplify using get_class_ivars(). (get_class_ivars): Remove second parameter; create a fresh copy of the ivar list for each call; do not check for existence of super class. (objc_eh_runtime_type): Mark #ifndef OBJCPLUS. (objc_init_exceptions): When using SJLJ-style exceptions, require the use of '-fobjc-exceptions' flag; do not require it for DWARF-style exceptions. (objc_build_exc_ptr, next_sjlj_build_try_catch_finally): Use objc_object_type instead of objc_id_type. (objc_begin_catch_clause): Convert the incoming PARM_DECL into a VAR_DECL before placing it in the appropriate scope; do not call define_decl(); adjust call to c_begin_compound_stmt(); use objc_object_type instead of objc_id_type. (build_next_objc_exception_stuff): Call create_field_decl() instead of create_builtin_decl(); construct type directly instead of calling groktypename(); use OBJC_VOID_AT_END to mark end of function parameters. (build_private_template): Adjust call to get_class_ivars(); build a type directly instead of via groktypename(). (build_protocol_template, build_method_prototype_list_template, build_method_prototype_template, build_category_template, build_selector_template, build_class_template, build_super_template, build_ivar_template, build_ivar_list_template, build_method_list_template, build_method_template): Call create_field_decl() instead of grokfield(). (objc_method_parm_type): Do not call groktypename(). (generate_descriptor_table): Call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(). (generate_method_descriptors, build_protocol_initializer, generate_dispatch_tables, build_category_initializer, build_shared_structure_initializer): Do not call groktypename(). (generate_protocols): Call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(); do not call groktypename(). (error_with_ivar): Remove last parameter. (check_ivars): Do not iterate ovar CLASS_RAW_IVARS lists in addition to CLASS_IVARS lists; adjust calls to error_with_ivar(). (generate_ivar_lists): Convert one of the initializer elements; do not call groktypename(). (get_arg_type_list, start_method_def, gen_method_def): Account for new representation of variable arguments and '...' in Objective-C methods; add Objective-C++ impedance matching code. (is_objc_type_qualifier): Remove function. (adjust_type_for_id_default): Simplify; there is no longer a need to wade through declspecs. (lookup_interface, start_class, continue_class, finish_class, start_method_def, start_protocol, build_method_decl, objc_add_method, add_instance_variable, build_ivar_reference, is_ivar, is_private, get_super_receiver, objc_build_finally_epilogue): Make into static functions. (receiver_is_class_object): Use new IS_CLASS() macro. (objc_build_message_expr): Tweak ObjC++ message argument handling; call objc_finish_message_expr() instead of finish_message_expr(). (finish_message_expr): Rename to objc_finish_message_expr(); use OBJC_TYPE_NAME and OBJC_SET_TYPE_NAME macros instead of TYPE_NAME. call gen_type_name() instead of gen_declaration(); call objc_is_id() instead of using IS_ID and IS_CLASS; Use objc_class_name instead of calling get_identifier("Class"); handle CONVERT_EXPRs in receiver. (build_objc_method_call, warn_with_method): Do not call groktypename(). (build_ivar_reference): Call convert() instead of clobbering in a type. (hash_init): Initialize string_htab hash table. (add_instance_variable): Simplify parameter list; do not call grokfield(); do not populate CLASS_IVARS list. (start_class): Check for the existence of super class, if one was specified. (continue_class): Use CLASS_RAW_IVARS rather than CLASS_IVARS; do not call build_class_template(); adjust call to get_class_ivars(); call build_decl(), pushdecl() and finish_decl() instead of define_decl(). (finish_class): Call build_decl(), pushdecl() and finish_decl() instead of define_decl(). (add_protocols): Use PROTOCOL_BINFO_ELTS for the tree vector size. (start_protocol): Do not call build_protocol_template(); use PROTOCOL_BINFO_ELTS for the tree vector size. (encode_type_qualifiers): Do not handle the 'const' qualifier here. (encode_pointer): Encode 'const char *' as 'r*', for backwards compatibility. (encode_array): Use HOST_WIDE_INT_PRINT_DEC instead of "%ld". (encode_type): Handle the 'const' qualifier here. (objc_parmlist): New global variable, sued by objc_push_parm and objc_get_parm_info(). (objc_push_parm, objc_get_parm_info): New functions. (objc_expr_last): Remove function. (synth_self_and_ucmd_args): For instance methods, use the instance type for 'self'; call objc_push_parm() instead of push_parm_decl(). (start_method_def): Do not call push_scope(), declare_parm_level(), pop_scope(), push_parm_decl(), store_parm_decls() or objc_expr_last(); just use objc_push_parm() and objc_get_parm_info(). (comp_method_with_proto): Remove function. (objc_types_are_equivalent): Strip away indirections before comparing underlying types. (comp_proto_with_proto): Do not call groktypename(); types are no longer in raw declspec format. (objc_start_function): New function. (really_start_method): Call comp_proto_with_proto() instead of comp_method_with_proto(); call objc_start_function() instead of hand-crafting a function declarator. (continue_method_def, objc_expand_function_end): Remove functions. (get_super_receiver): Call objc_get_current_scope() instead of get_current_scope(); reference 'super_class' field (instead of 'class'). (finish_method_def): Rename to objc_finish_method_definition() and add a function decl parameter; move method encoding call from objc_expand_function_end(). (is_complex_decl, adorn_decl, gen_declarator, gen_declspecs, gen_declaration_1): Remove functions. (tmpbuf, RAW_DECLSPEC): Remove. (gen_declaration): Remove second parameter; simplify to deal with TYPE_P nodes instead of raw declspecs. (gen_type_name, gen_type_name_0): New functions. (gen_method_decl): Remove second parameter; call gen_type_name() instead of gen_declaration_1(). (dump_interface): Adjust calls to gen_declaration() and gen_method_decl(); do not allocate a separate string buffer. (init_objc): Allocate a larger string buffer to accommodate dump_interface(); adjust call to build_module_descriptor(); add call to build_module_initializer_routine() for the GNU runtime. (generate_classref_translation_entry): Do not call start_decl(); call finish_var_decl() instead of finish_decl(); call convert() instead of build_c_cast(). * objc-act.h (CLASS_OWN_IVARS): Remove accessor. (CLASS_BINFO_ELTS): Reduce from 6 to 5, now that CLASS_OWN_IVARS is gone. (OCTI_GNU_INIT_DECL, GNU_INIT_decl): New. (OCTI_ELLIPSIS_NODE, objc_ellipsis_node): Remove. (OCTI_ID_ID, id_type, objc_id_id): Rename to OCTI_ID_NAME, objc_object_type and objc_object_name, respectively. (OCTI_CLS_REF, OCTI_CLASS_NAME, objc_class_reference, objc_class_name): New. (IS_CLASS): New macro. (IS_ID, IS_SUPER): Robustify. (OCTI_EXECCLASS_DECL, execclass_decl): New. (finish_file, start_class, continue_class, finish_class, start_method_def, continue_method_def, finish_method_def, start_protocol, finish_protocol, objc_build_throw_stmt, objc_build_try_catch_finally_stmt, objc_build_synchronized_prologue, objc_build_synchronized_epilogue, objc_build_try_prologue, objc_build_try_epilogue, objc_build_catch_stmt, objc_build_catch_epilogue, objc_build_finally_prologue, objc_build_finally_epilogue, is_ivar, is_private, is_public, add_instance_variable, objc_add_method, get_super_receiver, objc_clear_super_receiver, get_class_ivars_from_name, get_class_reference, get_static_reference, get_object_reference, build_message_expr, finish_message_expr, build_selector_expr, build_ivar_reference, build_keyword_decl, build_method_decl, build_protocol_expr, build_objc_string_object, objc_declare_alias, objc_declare_class, objc_declare_protocols, objc_comptypes, objc_check_decl, build_encode_expr): Remove prototypes. (imp_count, cat_count): Make GGC-aware. (OBJC_SET_TYPE_NAME): New macro. From-SVN: r87168
2004-09-08 02:49:44 +02:00
static void
start_method_def (tree method)
{
Makefile.in (c-parse.o): Depend on $(C_COMMON_H). [gcc/ChangeLog] 2004-09-07 Ziemowit Laski <zlaski@apple.com> * Makefile.in (c-parse.o): Depend on $(C_COMMON_H). * c-parse.in: Include c-common.h instead of objc-act.h. (ivar_decl_list, ivar_decls, ivar_decl, ivars, ivar_declarator, myparms, myparm): Remove %type declarations. (methodtype, optparms, OBJC_TYPE_QUAL, objc_quals, objc_qual, objc_typename, objc_try_catch_stmt, optellipsis): Add %type declarations. (objc_inherit_code, objc_public_flag): Remove. (typespec_nonreserved_nonattr): Call objc_get_protocol_qualified_type() instead of get_static_reference() and get_protocol_reference(). (stmt_nocomp): Call grokparm() on @catch parameter. (objcdef): Move semantic action to objc_finish_implementation(). (classdef): Move semantic action to objc_start_class_interface(), objc_continue_interface(), objc_finish_interface(), objc_start_class_implementation(), objc_continue_implementation(), objc_start_category_interface() and objc_start_category_implementation(). (protocoldef): Move semantic actions to objc_start_protocol() and objc_finish_interface(). (ivar_decl_list): Remove nonterminal. (visibility_spec): Move semantic actions to objc_set_visibility(). (ivar_decls): Remove assignment to $$. (ivar_decl): Rephrase in terms of component_decl; call objc_add_instance_variable(). (ivars, ivar_declarator): Remove nonterminals. (opt_semi): New nonterminal. (methodtype): Remove semantic actions. (methoddef): Move semantic actions to objc_set_method_type(), objc_start_method_definition() and objc_finish_method_definition(). (methodproto): Move semantic actions to objc_set_method_type() and objc_add_method_declaration(). (methoddecl): Use objc_typename instead of typename; move semantic actions to objc_build_method_signature(). (optarglist, myxdecls, mydecl, myparms, myparm): Remove nonterminals. (optparmlist): Express in terms of optparms and optellipsis. (optparms, optellipsis, objc_qual, objc_quals, objc_typename): New nonterminals. (keyworddecl): Use objc_typename instead of typename. (rid_to_yy): Mark RID_IN, RID_OUT, RID_INOUT, RID_BYCOPY, RID_BYREF and RID_ONEWAY as returning OBJC_TYPE_QUAL to yyparse(). [gcc/objc/ChangeLog] 2004-09-07 Ziemowit Laski <zlaski@apple.com> * Make-lang.in (objc/objc-parse.o): Depend on $(C_COMMON_H) instead of objc/objc-act.h. (objc/objc-act.o): Depend on $(HASHTAB_H). * objc-act.c: Include hashtab.h; in ObjC++ mode, include cp-tree.h and objcp-decl.h instead of c-tree.h. (build_module_descriptor, get_class_ivars, synth_id_with_class_suffix, error_with_ivar, gen_method_decl, gen_declaration, setup_string_decl, build_protocol_template): Adjust prototypes. (build_module_initializer_routine, start_class, continue_class, finish_class, start_method_def, objc_start_function, start_protocol, build_method_decl, objc_add_method, add_instance_variable, build_ivar_reference, is_ivar, is_private, get_super_receiver, build_selector_table_decl, objc_push_parm, objc_get_parm_info, gen_type_name, gen_type_name_0, start_var_decl, finish_var_decl, create_field_decl): New prototypes. (objc_expand_function_end, comp_method_with_proto, objc_expr_last, gen_declaration_1, gen_declarator, is_complex_decl, adorn_decl, define_decl, create_builtin_decl, gen_declspecs): Remove prototypes. (TYPE_ID): Rename to OBJECT_TYPEDEF_NAME. (CLASS_TYPEDEF_NAME): New. (TAG_EXECCLASS): Change from a global variable to a #define. (TAG_RETURN_STRUCT): Delete. (TAG_GNUINIT): New, holds '__objc_gnu_init' name. (objc_inherit_code, objc_public_flag): New, moved from c-parse.in. (string_descriptor): New struct. (string_htab): New hash table. (string_hash, string_eq): New prototypes. (generate_struct_by_value_array): Call create_field_decl() instead of create_builtin_decl(). (objc_init): Do not initialize objc_ellipsis_node or TAG_EXECCLASS; In ObjC++ mode, call cxx_init() instead of c_objc_common_init(). (objc_finish_file): In ObjC++, call instantiate_pending_templates() and cp_finish_file(). (define_decl, get_static_reference, get_protocol_reference, create_builtin_decl): Remove functions. (objc_start_class_interface, objc_start_category_interface, objc_start_protocol, objc_continue_interface, objc_finish_interface, objc_start_class_implementation, objc_start_category_implementation, objc_continue_implementation, objc_finish_implementation, objc_set_visibility, objc_set_method_type, objc_build_method_signature, objc_add_method_declaration, objc_start_method_definition, objc_add_instance_variable, objc_get_protocol_qualified_type, create_field_decl, start_var_decl, finish_var_decl): New functions. (setup_string_decl): Simplify since it is only called once. (synth_module_prologue): Call build_class_template(); predefine 'id' and 'Class' as typedefs; rename 'temp_type' to 'type'; disable debug hooks for duration of function; fix GNU runtime messenger signatures to correspond to reality; forward-declare '__objc_exec_class' for the GNU runtime; call build_selector_table_decl(); in ObjC++ mode, generate 'extern "C" { ... }' wrappers around synthesized declarations; call build_protocol_template() and build_category_template(). (string_hash, string_eq): New functions. (objc_build_string_object): Check metaclass correctness only once; store string literals in hash table. (objc_build_constructor): Do not convert initializer elements; adjust for ObjC++ impedance mismatch. (build_objc_symtab_template): Call create_field_decl() instead of create_builtin_decl(). (init_objc_symtab): Add missing conversion to initializer element. (build_metadata_decl): Call start_var_decl() instead of define_decl(). (generate_objc_symtab_decl): Do not call build_category_template(); call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(). (build_module_descriptor): Call create_field_decl() instead of grokfield(); call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(); always mark module descriptor as used; move GNU runtime-specific functionality to build_module_initializer_routine(). (build_module_initializer_routine): New function, broken off of build_module_descriptor(). (objc_static_init_needed_p, objc_generate_static_init_call): New functions. (generate_static_references, generate_strings, build_selector_translation_table, generate_descriptor_table, generate_ivars_list, generate_dispatch_table, generate_category): Call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(); build a type directly instead of via groktypename(). (build_selector_reference_decl, build_selector_table_decl, build_class_reference_decl, build_protocol_reference, generate_objc_image_info): Call start_var_decl() instead of build_decl(). (build_selector_reference): For GNU runtime, do not call build_selector_reference_decl(). (build_selector, build_typed_selector_reference): Always convert result to the selector type. (add_objc_string): Cast return value to 'char *'. (build_method_prototype_template, build_selector_template, build_method_template): Use actual selector type for fields pointing to selectors. (finish_objc): For GNU runtime, call build_module_initializer_routine() after build_module_descriptor(). (generate_protocol_list, generate_shared_structures): Call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(); build a type directly instead of via groktypename(). (synth_id_with_class_suffix): Return a string. (get_arg_type_list): For instance methods, use the instance type for 'self'; do not call groktypename_in_parm_context(). (build_objc_string_decl): Squash redeclaration errors in ObjC++. (objc_is_class_name): Use OBJC_TYPE_NAME instead of TYPE_NAME; handle RECORD_TYPEs in ObjC as well as ObjC++. (objc_is_id): New function. (objc_is_object_ptr): Return the canonical type node. (objc_get_class_ivars): Simplify using get_class_ivars(). (get_class_ivars): Remove second parameter; create a fresh copy of the ivar list for each call; do not check for existence of super class. (objc_eh_runtime_type): Mark #ifndef OBJCPLUS. (objc_init_exceptions): When using SJLJ-style exceptions, require the use of '-fobjc-exceptions' flag; do not require it for DWARF-style exceptions. (objc_build_exc_ptr, next_sjlj_build_try_catch_finally): Use objc_object_type instead of objc_id_type. (objc_begin_catch_clause): Convert the incoming PARM_DECL into a VAR_DECL before placing it in the appropriate scope; do not call define_decl(); adjust call to c_begin_compound_stmt(); use objc_object_type instead of objc_id_type. (build_next_objc_exception_stuff): Call create_field_decl() instead of create_builtin_decl(); construct type directly instead of calling groktypename(); use OBJC_VOID_AT_END to mark end of function parameters. (build_private_template): Adjust call to get_class_ivars(); build a type directly instead of via groktypename(). (build_protocol_template, build_method_prototype_list_template, build_method_prototype_template, build_category_template, build_selector_template, build_class_template, build_super_template, build_ivar_template, build_ivar_list_template, build_method_list_template, build_method_template): Call create_field_decl() instead of grokfield(). (objc_method_parm_type): Do not call groktypename(). (generate_descriptor_table): Call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(). (generate_method_descriptors, build_protocol_initializer, generate_dispatch_tables, build_category_initializer, build_shared_structure_initializer): Do not call groktypename(). (generate_protocols): Call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(); do not call groktypename(). (error_with_ivar): Remove last parameter. (check_ivars): Do not iterate ovar CLASS_RAW_IVARS lists in addition to CLASS_IVARS lists; adjust calls to error_with_ivar(). (generate_ivar_lists): Convert one of the initializer elements; do not call groktypename(). (get_arg_type_list, start_method_def, gen_method_def): Account for new representation of variable arguments and '...' in Objective-C methods; add Objective-C++ impedance matching code. (is_objc_type_qualifier): Remove function. (adjust_type_for_id_default): Simplify; there is no longer a need to wade through declspecs. (lookup_interface, start_class, continue_class, finish_class, start_method_def, start_protocol, build_method_decl, objc_add_method, add_instance_variable, build_ivar_reference, is_ivar, is_private, get_super_receiver, objc_build_finally_epilogue): Make into static functions. (receiver_is_class_object): Use new IS_CLASS() macro. (objc_build_message_expr): Tweak ObjC++ message argument handling; call objc_finish_message_expr() instead of finish_message_expr(). (finish_message_expr): Rename to objc_finish_message_expr(); use OBJC_TYPE_NAME and OBJC_SET_TYPE_NAME macros instead of TYPE_NAME. call gen_type_name() instead of gen_declaration(); call objc_is_id() instead of using IS_ID and IS_CLASS; Use objc_class_name instead of calling get_identifier("Class"); handle CONVERT_EXPRs in receiver. (build_objc_method_call, warn_with_method): Do not call groktypename(). (build_ivar_reference): Call convert() instead of clobbering in a type. (hash_init): Initialize string_htab hash table. (add_instance_variable): Simplify parameter list; do not call grokfield(); do not populate CLASS_IVARS list. (start_class): Check for the existence of super class, if one was specified. (continue_class): Use CLASS_RAW_IVARS rather than CLASS_IVARS; do not call build_class_template(); adjust call to get_class_ivars(); call build_decl(), pushdecl() and finish_decl() instead of define_decl(). (finish_class): Call build_decl(), pushdecl() and finish_decl() instead of define_decl(). (add_protocols): Use PROTOCOL_BINFO_ELTS for the tree vector size. (start_protocol): Do not call build_protocol_template(); use PROTOCOL_BINFO_ELTS for the tree vector size. (encode_type_qualifiers): Do not handle the 'const' qualifier here. (encode_pointer): Encode 'const char *' as 'r*', for backwards compatibility. (encode_array): Use HOST_WIDE_INT_PRINT_DEC instead of "%ld". (encode_type): Handle the 'const' qualifier here. (objc_parmlist): New global variable, sued by objc_push_parm and objc_get_parm_info(). (objc_push_parm, objc_get_parm_info): New functions. (objc_expr_last): Remove function. (synth_self_and_ucmd_args): For instance methods, use the instance type for 'self'; call objc_push_parm() instead of push_parm_decl(). (start_method_def): Do not call push_scope(), declare_parm_level(), pop_scope(), push_parm_decl(), store_parm_decls() or objc_expr_last(); just use objc_push_parm() and objc_get_parm_info(). (comp_method_with_proto): Remove function. (objc_types_are_equivalent): Strip away indirections before comparing underlying types. (comp_proto_with_proto): Do not call groktypename(); types are no longer in raw declspec format. (objc_start_function): New function. (really_start_method): Call comp_proto_with_proto() instead of comp_method_with_proto(); call objc_start_function() instead of hand-crafting a function declarator. (continue_method_def, objc_expand_function_end): Remove functions. (get_super_receiver): Call objc_get_current_scope() instead of get_current_scope(); reference 'super_class' field (instead of 'class'). (finish_method_def): Rename to objc_finish_method_definition() and add a function decl parameter; move method encoding call from objc_expand_function_end(). (is_complex_decl, adorn_decl, gen_declarator, gen_declspecs, gen_declaration_1): Remove functions. (tmpbuf, RAW_DECLSPEC): Remove. (gen_declaration): Remove second parameter; simplify to deal with TYPE_P nodes instead of raw declspecs. (gen_type_name, gen_type_name_0): New functions. (gen_method_decl): Remove second parameter; call gen_type_name() instead of gen_declaration_1(). (dump_interface): Adjust calls to gen_declaration() and gen_method_decl(); do not allocate a separate string buffer. (init_objc): Allocate a larger string buffer to accommodate dump_interface(); adjust call to build_module_descriptor(); add call to build_module_initializer_routine() for the GNU runtime. (generate_classref_translation_entry): Do not call start_decl(); call finish_var_decl() instead of finish_decl(); call convert() instead of build_c_cast(). * objc-act.h (CLASS_OWN_IVARS): Remove accessor. (CLASS_BINFO_ELTS): Reduce from 6 to 5, now that CLASS_OWN_IVARS is gone. (OCTI_GNU_INIT_DECL, GNU_INIT_decl): New. (OCTI_ELLIPSIS_NODE, objc_ellipsis_node): Remove. (OCTI_ID_ID, id_type, objc_id_id): Rename to OCTI_ID_NAME, objc_object_type and objc_object_name, respectively. (OCTI_CLS_REF, OCTI_CLASS_NAME, objc_class_reference, objc_class_name): New. (IS_CLASS): New macro. (IS_ID, IS_SUPER): Robustify. (OCTI_EXECCLASS_DECL, execclass_decl): New. (finish_file, start_class, continue_class, finish_class, start_method_def, continue_method_def, finish_method_def, start_protocol, finish_protocol, objc_build_throw_stmt, objc_build_try_catch_finally_stmt, objc_build_synchronized_prologue, objc_build_synchronized_epilogue, objc_build_try_prologue, objc_build_try_epilogue, objc_build_catch_stmt, objc_build_catch_epilogue, objc_build_finally_prologue, objc_build_finally_epilogue, is_ivar, is_private, is_public, add_instance_variable, objc_add_method, get_super_receiver, objc_clear_super_receiver, get_class_ivars_from_name, get_class_reference, get_static_reference, get_object_reference, build_message_expr, finish_message_expr, build_selector_expr, build_ivar_reference, build_keyword_decl, build_method_decl, build_protocol_expr, build_objc_string_object, objc_declare_alias, objc_declare_class, objc_declare_protocols, objc_comptypes, objc_check_decl, build_encode_expr): Remove prototypes. (imp_count, cat_count): Make GGC-aware. (OBJC_SET_TYPE_NAME): New macro. From-SVN: r87168
2004-09-08 02:49:44 +02:00
tree parmlist;
c-tree.h (enum c_declarator_kind, [...]): New. * c-tree.h (enum c_declarator_kind, struct c_arg_info, struct c_declarator, struct c_type_name, struct c_parm): New. (build_array_declarator, set_array_declarator_inner, get_parm_info, grokfield, groktypename, grokparm, push_parm_decl, start_function, start_decl, build_c_parm, build_attrs_declarator, build_function_declarator, make_pointer_declarator, c_cast_expr, store_parm_decls_newstyle, c_expr_sizeof_type): Update prototypes. (build_id_declarator): New. * c-typeck.c (c_cast_expr, c_expr_sizeof_type): Update to new structures. * c-decl.c (ARG_INFO_PARMS, ARG_INFO_TAGS, ARG_INFO_TYPES, ARG_INFO_OTHERS): Remove. (build_id_declarator): New. (build_array_declarator, set_array_declarator_inner, groktypename, start_decl, grokparm, push_parm_decl, grokparms, get_parm_info, grokfield, start_function, store_parm_decls_newstyle, store_parm_decls_oldstyle, store_parm_decls, build_c_parm, build_attrs_declarator, build_function_declarator, make_pointer_declarator, grokdeclarator): Update to new structures. * c-parse.in (%union): Add arginfotype, dtrtype, typenametype and parmtype. (declarator, notype_declarator, after_type_declarator, parm_declarator, parm_declarator_starttypename, parm_declarator_nostarttypename, array_declarator, typename, absdcl, absdcl1, absdcl1_ea, absdcl1_noea, direct_absdcl1, absdcl_maybe_attribute, parm, firstparm, parms, parmlist, parmlist_1, parmlist_2, parmlist_or_identifiers, parmlist_or_identifiers_1): Use these types. (primary, after_type_declarator, parm_declarator_starttypename, notype_declarator, component_decl, component_declarator, component_notype_declarator, typename, absdcl, absdcl_maybe_attribute, absdcl1_ea, direct_absdcl1, parmlist_1, parmlist_2, parmlist_or_identifiers_1): Update to new structures. objc: * objc-act.c (objc_start_function, really_start_method, objc_get_parm_info, start_method_def): Update to new arg_info structures. From-SVN: r87217
2004-09-09 03:19:15 +02:00
#ifdef OBJCPLUS
tree parm_info;
#else
struct c_arg_info *parm_info;
#endif
Makefile.in (c-parse.o): Depend on $(C_COMMON_H). [gcc/ChangeLog] 2004-09-07 Ziemowit Laski <zlaski@apple.com> * Makefile.in (c-parse.o): Depend on $(C_COMMON_H). * c-parse.in: Include c-common.h instead of objc-act.h. (ivar_decl_list, ivar_decls, ivar_decl, ivars, ivar_declarator, myparms, myparm): Remove %type declarations. (methodtype, optparms, OBJC_TYPE_QUAL, objc_quals, objc_qual, objc_typename, objc_try_catch_stmt, optellipsis): Add %type declarations. (objc_inherit_code, objc_public_flag): Remove. (typespec_nonreserved_nonattr): Call objc_get_protocol_qualified_type() instead of get_static_reference() and get_protocol_reference(). (stmt_nocomp): Call grokparm() on @catch parameter. (objcdef): Move semantic action to objc_finish_implementation(). (classdef): Move semantic action to objc_start_class_interface(), objc_continue_interface(), objc_finish_interface(), objc_start_class_implementation(), objc_continue_implementation(), objc_start_category_interface() and objc_start_category_implementation(). (protocoldef): Move semantic actions to objc_start_protocol() and objc_finish_interface(). (ivar_decl_list): Remove nonterminal. (visibility_spec): Move semantic actions to objc_set_visibility(). (ivar_decls): Remove assignment to $$. (ivar_decl): Rephrase in terms of component_decl; call objc_add_instance_variable(). (ivars, ivar_declarator): Remove nonterminals. (opt_semi): New nonterminal. (methodtype): Remove semantic actions. (methoddef): Move semantic actions to objc_set_method_type(), objc_start_method_definition() and objc_finish_method_definition(). (methodproto): Move semantic actions to objc_set_method_type() and objc_add_method_declaration(). (methoddecl): Use objc_typename instead of typename; move semantic actions to objc_build_method_signature(). (optarglist, myxdecls, mydecl, myparms, myparm): Remove nonterminals. (optparmlist): Express in terms of optparms and optellipsis. (optparms, optellipsis, objc_qual, objc_quals, objc_typename): New nonterminals. (keyworddecl): Use objc_typename instead of typename. (rid_to_yy): Mark RID_IN, RID_OUT, RID_INOUT, RID_BYCOPY, RID_BYREF and RID_ONEWAY as returning OBJC_TYPE_QUAL to yyparse(). [gcc/objc/ChangeLog] 2004-09-07 Ziemowit Laski <zlaski@apple.com> * Make-lang.in (objc/objc-parse.o): Depend on $(C_COMMON_H) instead of objc/objc-act.h. (objc/objc-act.o): Depend on $(HASHTAB_H). * objc-act.c: Include hashtab.h; in ObjC++ mode, include cp-tree.h and objcp-decl.h instead of c-tree.h. (build_module_descriptor, get_class_ivars, synth_id_with_class_suffix, error_with_ivar, gen_method_decl, gen_declaration, setup_string_decl, build_protocol_template): Adjust prototypes. (build_module_initializer_routine, start_class, continue_class, finish_class, start_method_def, objc_start_function, start_protocol, build_method_decl, objc_add_method, add_instance_variable, build_ivar_reference, is_ivar, is_private, get_super_receiver, build_selector_table_decl, objc_push_parm, objc_get_parm_info, gen_type_name, gen_type_name_0, start_var_decl, finish_var_decl, create_field_decl): New prototypes. (objc_expand_function_end, comp_method_with_proto, objc_expr_last, gen_declaration_1, gen_declarator, is_complex_decl, adorn_decl, define_decl, create_builtin_decl, gen_declspecs): Remove prototypes. (TYPE_ID): Rename to OBJECT_TYPEDEF_NAME. (CLASS_TYPEDEF_NAME): New. (TAG_EXECCLASS): Change from a global variable to a #define. (TAG_RETURN_STRUCT): Delete. (TAG_GNUINIT): New, holds '__objc_gnu_init' name. (objc_inherit_code, objc_public_flag): New, moved from c-parse.in. (string_descriptor): New struct. (string_htab): New hash table. (string_hash, string_eq): New prototypes. (generate_struct_by_value_array): Call create_field_decl() instead of create_builtin_decl(). (objc_init): Do not initialize objc_ellipsis_node or TAG_EXECCLASS; In ObjC++ mode, call cxx_init() instead of c_objc_common_init(). (objc_finish_file): In ObjC++, call instantiate_pending_templates() and cp_finish_file(). (define_decl, get_static_reference, get_protocol_reference, create_builtin_decl): Remove functions. (objc_start_class_interface, objc_start_category_interface, objc_start_protocol, objc_continue_interface, objc_finish_interface, objc_start_class_implementation, objc_start_category_implementation, objc_continue_implementation, objc_finish_implementation, objc_set_visibility, objc_set_method_type, objc_build_method_signature, objc_add_method_declaration, objc_start_method_definition, objc_add_instance_variable, objc_get_protocol_qualified_type, create_field_decl, start_var_decl, finish_var_decl): New functions. (setup_string_decl): Simplify since it is only called once. (synth_module_prologue): Call build_class_template(); predefine 'id' and 'Class' as typedefs; rename 'temp_type' to 'type'; disable debug hooks for duration of function; fix GNU runtime messenger signatures to correspond to reality; forward-declare '__objc_exec_class' for the GNU runtime; call build_selector_table_decl(); in ObjC++ mode, generate 'extern "C" { ... }' wrappers around synthesized declarations; call build_protocol_template() and build_category_template(). (string_hash, string_eq): New functions. (objc_build_string_object): Check metaclass correctness only once; store string literals in hash table. (objc_build_constructor): Do not convert initializer elements; adjust for ObjC++ impedance mismatch. (build_objc_symtab_template): Call create_field_decl() instead of create_builtin_decl(). (init_objc_symtab): Add missing conversion to initializer element. (build_metadata_decl): Call start_var_decl() instead of define_decl(). (generate_objc_symtab_decl): Do not call build_category_template(); call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(). (build_module_descriptor): Call create_field_decl() instead of grokfield(); call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(); always mark module descriptor as used; move GNU runtime-specific functionality to build_module_initializer_routine(). (build_module_initializer_routine): New function, broken off of build_module_descriptor(). (objc_static_init_needed_p, objc_generate_static_init_call): New functions. (generate_static_references, generate_strings, build_selector_translation_table, generate_descriptor_table, generate_ivars_list, generate_dispatch_table, generate_category): Call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(); build a type directly instead of via groktypename(). (build_selector_reference_decl, build_selector_table_decl, build_class_reference_decl, build_protocol_reference, generate_objc_image_info): Call start_var_decl() instead of build_decl(). (build_selector_reference): For GNU runtime, do not call build_selector_reference_decl(). (build_selector, build_typed_selector_reference): Always convert result to the selector type. (add_objc_string): Cast return value to 'char *'. (build_method_prototype_template, build_selector_template, build_method_template): Use actual selector type for fields pointing to selectors. (finish_objc): For GNU runtime, call build_module_initializer_routine() after build_module_descriptor(). (generate_protocol_list, generate_shared_structures): Call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(); build a type directly instead of via groktypename(). (synth_id_with_class_suffix): Return a string. (get_arg_type_list): For instance methods, use the instance type for 'self'; do not call groktypename_in_parm_context(). (build_objc_string_decl): Squash redeclaration errors in ObjC++. (objc_is_class_name): Use OBJC_TYPE_NAME instead of TYPE_NAME; handle RECORD_TYPEs in ObjC as well as ObjC++. (objc_is_id): New function. (objc_is_object_ptr): Return the canonical type node. (objc_get_class_ivars): Simplify using get_class_ivars(). (get_class_ivars): Remove second parameter; create a fresh copy of the ivar list for each call; do not check for existence of super class. (objc_eh_runtime_type): Mark #ifndef OBJCPLUS. (objc_init_exceptions): When using SJLJ-style exceptions, require the use of '-fobjc-exceptions' flag; do not require it for DWARF-style exceptions. (objc_build_exc_ptr, next_sjlj_build_try_catch_finally): Use objc_object_type instead of objc_id_type. (objc_begin_catch_clause): Convert the incoming PARM_DECL into a VAR_DECL before placing it in the appropriate scope; do not call define_decl(); adjust call to c_begin_compound_stmt(); use objc_object_type instead of objc_id_type. (build_next_objc_exception_stuff): Call create_field_decl() instead of create_builtin_decl(); construct type directly instead of calling groktypename(); use OBJC_VOID_AT_END to mark end of function parameters. (build_private_template): Adjust call to get_class_ivars(); build a type directly instead of via groktypename(). (build_protocol_template, build_method_prototype_list_template, build_method_prototype_template, build_category_template, build_selector_template, build_class_template, build_super_template, build_ivar_template, build_ivar_list_template, build_method_list_template, build_method_template): Call create_field_decl() instead of grokfield(). (objc_method_parm_type): Do not call groktypename(). (generate_descriptor_table): Call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(). (generate_method_descriptors, build_protocol_initializer, generate_dispatch_tables, build_category_initializer, build_shared_structure_initializer): Do not call groktypename(). (generate_protocols): Call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(); do not call groktypename(). (error_with_ivar): Remove last parameter. (check_ivars): Do not iterate ovar CLASS_RAW_IVARS lists in addition to CLASS_IVARS lists; adjust calls to error_with_ivar(). (generate_ivar_lists): Convert one of the initializer elements; do not call groktypename(). (get_arg_type_list, start_method_def, gen_method_def): Account for new representation of variable arguments and '...' in Objective-C methods; add Objective-C++ impedance matching code. (is_objc_type_qualifier): Remove function. (adjust_type_for_id_default): Simplify; there is no longer a need to wade through declspecs. (lookup_interface, start_class, continue_class, finish_class, start_method_def, start_protocol, build_method_decl, objc_add_method, add_instance_variable, build_ivar_reference, is_ivar, is_private, get_super_receiver, objc_build_finally_epilogue): Make into static functions. (receiver_is_class_object): Use new IS_CLASS() macro. (objc_build_message_expr): Tweak ObjC++ message argument handling; call objc_finish_message_expr() instead of finish_message_expr(). (finish_message_expr): Rename to objc_finish_message_expr(); use OBJC_TYPE_NAME and OBJC_SET_TYPE_NAME macros instead of TYPE_NAME. call gen_type_name() instead of gen_declaration(); call objc_is_id() instead of using IS_ID and IS_CLASS; Use objc_class_name instead of calling get_identifier("Class"); handle CONVERT_EXPRs in receiver. (build_objc_method_call, warn_with_method): Do not call groktypename(). (build_ivar_reference): Call convert() instead of clobbering in a type. (hash_init): Initialize string_htab hash table. (add_instance_variable): Simplify parameter list; do not call grokfield(); do not populate CLASS_IVARS list. (start_class): Check for the existence of super class, if one was specified. (continue_class): Use CLASS_RAW_IVARS rather than CLASS_IVARS; do not call build_class_template(); adjust call to get_class_ivars(); call build_decl(), pushdecl() and finish_decl() instead of define_decl(). (finish_class): Call build_decl(), pushdecl() and finish_decl() instead of define_decl(). (add_protocols): Use PROTOCOL_BINFO_ELTS for the tree vector size. (start_protocol): Do not call build_protocol_template(); use PROTOCOL_BINFO_ELTS for the tree vector size. (encode_type_qualifiers): Do not handle the 'const' qualifier here. (encode_pointer): Encode 'const char *' as 'r*', for backwards compatibility. (encode_array): Use HOST_WIDE_INT_PRINT_DEC instead of "%ld". (encode_type): Handle the 'const' qualifier here. (objc_parmlist): New global variable, sued by objc_push_parm and objc_get_parm_info(). (objc_push_parm, objc_get_parm_info): New functions. (objc_expr_last): Remove function. (synth_self_and_ucmd_args): For instance methods, use the instance type for 'self'; call objc_push_parm() instead of push_parm_decl(). (start_method_def): Do not call push_scope(), declare_parm_level(), pop_scope(), push_parm_decl(), store_parm_decls() or objc_expr_last(); just use objc_push_parm() and objc_get_parm_info(). (comp_method_with_proto): Remove function. (objc_types_are_equivalent): Strip away indirections before comparing underlying types. (comp_proto_with_proto): Do not call groktypename(); types are no longer in raw declspec format. (objc_start_function): New function. (really_start_method): Call comp_proto_with_proto() instead of comp_method_with_proto(); call objc_start_function() instead of hand-crafting a function declarator. (continue_method_def, objc_expand_function_end): Remove functions. (get_super_receiver): Call objc_get_current_scope() instead of get_current_scope(); reference 'super_class' field (instead of 'class'). (finish_method_def): Rename to objc_finish_method_definition() and add a function decl parameter; move method encoding call from objc_expand_function_end(). (is_complex_decl, adorn_decl, gen_declarator, gen_declspecs, gen_declaration_1): Remove functions. (tmpbuf, RAW_DECLSPEC): Remove. (gen_declaration): Remove second parameter; simplify to deal with TYPE_P nodes instead of raw declspecs. (gen_type_name, gen_type_name_0): New functions. (gen_method_decl): Remove second parameter; call gen_type_name() instead of gen_declaration_1(). (dump_interface): Adjust calls to gen_declaration() and gen_method_decl(); do not allocate a separate string buffer. (init_objc): Allocate a larger string buffer to accommodate dump_interface(); adjust call to build_module_descriptor(); add call to build_module_initializer_routine() for the GNU runtime. (generate_classref_translation_entry): Do not call start_decl(); call finish_var_decl() instead of finish_decl(); call convert() instead of build_c_cast(). * objc-act.h (CLASS_OWN_IVARS): Remove accessor. (CLASS_BINFO_ELTS): Reduce from 6 to 5, now that CLASS_OWN_IVARS is gone. (OCTI_GNU_INIT_DECL, GNU_INIT_decl): New. (OCTI_ELLIPSIS_NODE, objc_ellipsis_node): Remove. (OCTI_ID_ID, id_type, objc_id_id): Rename to OCTI_ID_NAME, objc_object_type and objc_object_name, respectively. (OCTI_CLS_REF, OCTI_CLASS_NAME, objc_class_reference, objc_class_name): New. (IS_CLASS): New macro. (IS_ID, IS_SUPER): Robustify. (OCTI_EXECCLASS_DECL, execclass_decl): New. (finish_file, start_class, continue_class, finish_class, start_method_def, continue_method_def, finish_method_def, start_protocol, finish_protocol, objc_build_throw_stmt, objc_build_try_catch_finally_stmt, objc_build_synchronized_prologue, objc_build_synchronized_epilogue, objc_build_try_prologue, objc_build_try_epilogue, objc_build_catch_stmt, objc_build_catch_epilogue, objc_build_finally_prologue, objc_build_finally_epilogue, is_ivar, is_private, is_public, add_instance_variable, objc_add_method, get_super_receiver, objc_clear_super_receiver, get_class_ivars_from_name, get_class_reference, get_static_reference, get_object_reference, build_message_expr, finish_message_expr, build_selector_expr, build_ivar_reference, build_keyword_decl, build_method_decl, build_protocol_expr, build_objc_string_object, objc_declare_alias, objc_declare_class, objc_declare_protocols, objc_comptypes, objc_check_decl, build_encode_expr): Remove prototypes. (imp_count, cat_count): Make GGC-aware. (OBJC_SET_TYPE_NAME): New macro. From-SVN: r87168
2004-09-08 02:49:44 +02:00
int have_ellipsis = 0;
Yet more Objective-C++... * objc-act.c (objc_finish_try_stmt): Add return value. (objc_build_synchronized): Likewise. * objc-act.c (objc_is_gcable_type): Add. (objc_substitute_decl): Add. (objc_build_ivar_assignment): Add. (objc_build_global_assignment): Add. (objc_build_strong_cast_assignment): Add. (objc_is_ivar_reference_p): Add. (objc_is_global_reference_p): Add. (objc_generate_write_barrier): Add. (objc_rewrite_function_call): Add. (objc_gimplify_expr): Add Objective-C++ support. * objc-act.h (ALLOC_OBJC_TYPE_LANG_SPECIFIC): Likewise. (SIZEOF_OBJC_TYPE_LANG_SPECIFIC): Add. (INIT_TYPE_OBJC_INFO): Add Objective-C++ support. (DUP_TYPE_OBJC_INFO): Likewise. (struct imp_entry): Add field has_cxx_cdtors. (struct imp_entry *imp_list): Add OCTI_UMSG_FAST_DECL, OCTI_METH_LIST_TEMPL, OCTI_METH_PROTO_LIST_TEMPL, OCTI_IVAR_LIST_TEMPL, OCTI_ASSIGN_IVAR_DECL, OCTI_ASSIGN_IVAR_FAST_DECL, OCTI_ASSIGN_GLOBAL_DECL, OCTI_ASSIGN_STRONGCAST_DECL. (umsg_fast_decl): Add. (objc_assign_ivar_decl): Add. (objc_assign_ivar_fast_decl): Add. (objc_assign_global_decl): Add. (objc_assign_strong_cast_decl): Add. (objc_method_list_ptr): Add. (objc_method_proto_list_ptr): Add. (objc_ivar_list_ptr): Add. * objc-act.c (should_call_super_dealloc): Add. (OBJC_VERSION): Bump to 6. (objc_is_gcable_type): Add. (objc_substitute_decl): Add. (objc_build_ivar_assignment): Add. (objc_build_global_assignment): Add. (objc_build_strong_cast_assignment): Add. (objc_is_gcable_p): Add. (objc_is_ivar_reference_p): Add. (objc_is_global_reference_p): Add. (generate_shared_structures): Add flags parameter. (objc_generate_cxx_ctor_or_dtor): Add. (objc_generate_cxx_cdtors): Add. (add_class): Add name parameter. (objc_types_share_size_and_alignment): Add. (comp_proto_with_proto): Add strict parameter. (CLS_HAS_CXX_STRUCTORS): Add. (TAG_ASSIGNIVAR): Add. (TAG_ASSIGNGLOBAL): Add. (TAG_ASSIGNSTRONGCAST): Add. (TAG_MSGSEND_FAST): Add. (TAG_ASSIGNIVAR_FAST): Add. (TAG_CXX_CONSTRUCT): Add. (TAG_CXX_DESTRUCT): Add. (OBJC_LOOKUP_CLASS): Add. (OBJC_LOOKUP_NO_SUPER): Add. (objc_finish_file): Add pch support. (objc_finish_implementation): Add Objective-C++ support. (synth_module_prologue): Likewise. (synth_module_prologue): Add fast dispatching. (objc_get_class_reference): Add Objective-C++ support. (objc_generate_write_barrier): Likewise. (next_sjlj_build_enter_and_setjmp): Likewise. (objc_begin_try_stmt): Likewise. (build_next_objc_exception_stuff): Add fast ivar support. (build_private_template): Mark the record as used so debug information is generated. (build_protocol_template): Add Objective-C++ support. (objc_method_parm_type) Likewise. (objc_generate_cxx_ctor_or_dtor): Likewise. (objc_generate_cxx_cdtors): Likewise. (build_protocol_initializer): Likewise. (build_category_template): Likewise. (build_class_template): Likewise. (build_method_list_template): Likewise. (build_category_initializer): Likewise. (build_shared_structure_initializer): Likewise. (objc_finish_message_expr): Likewise. (build_objc_method_call): Add fast dispatch support. (lookup_method_static): Add support to end search at superclasses. (add_method_to_hash_list): Add strict parameter to comp_proto_with_proto. (objc_add_method): Likewise. (objc_add_method): Also set the interface_value. (add_instance_variable): Add Objective-C++ support. (objc_is_public): Likewise. (start_class): Likewise. (continue_class): Likewise. (encode_aggregate_within): Likewise. (start_method_def): Likewise. (objc_start_function): Clear current_function_returns_value and current_function_returns_null. (really_start_method): Add Objective-C++ support. (objc_finish_method_definition): Add warning for missing [super dealloc]. (finish_objc): Add Objective-C++ support. (generate_objc_image_info): Likewise. (objc_lookup_ivar): Likewise. * objc-act.h (TYPE_HAS_OBJC_INFO): Likewise. (INIT_TYPE_OBJC_INFO): Likewise. (DUP_TYPE_OBJC_INFO): Likewise. From-SVN: r99857
2005-05-17 22:07:08 +02:00
/* If we are defining a "dealloc" method in a non-root class, we
will need to check if a [super dealloc] is missing, and warn if
it is. */
if(CLASS_SUPER_NAME (objc_implementation_context)
&& !strcmp ("dealloc", IDENTIFIER_POINTER (METHOD_SEL_NAME (method))))
should_call_super_dealloc = 1;
else
should_call_super_dealloc = 0;
/* Required to implement _msgSuper. */
objc_method_context = method;
UOBJC_SUPER_decl = NULL_TREE;
/* Generate prototype declarations for arguments..."new-style". */
synth_self_and_ucmd_args ();
1992-01-18 00:15:38 +01:00
1996-07-04 00:07:53 +02:00
/* Generate argument declarations if a keyword_decl. */
Makefile.in (c-parse.o): Depend on $(C_COMMON_H). [gcc/ChangeLog] 2004-09-07 Ziemowit Laski <zlaski@apple.com> * Makefile.in (c-parse.o): Depend on $(C_COMMON_H). * c-parse.in: Include c-common.h instead of objc-act.h. (ivar_decl_list, ivar_decls, ivar_decl, ivars, ivar_declarator, myparms, myparm): Remove %type declarations. (methodtype, optparms, OBJC_TYPE_QUAL, objc_quals, objc_qual, objc_typename, objc_try_catch_stmt, optellipsis): Add %type declarations. (objc_inherit_code, objc_public_flag): Remove. (typespec_nonreserved_nonattr): Call objc_get_protocol_qualified_type() instead of get_static_reference() and get_protocol_reference(). (stmt_nocomp): Call grokparm() on @catch parameter. (objcdef): Move semantic action to objc_finish_implementation(). (classdef): Move semantic action to objc_start_class_interface(), objc_continue_interface(), objc_finish_interface(), objc_start_class_implementation(), objc_continue_implementation(), objc_start_category_interface() and objc_start_category_implementation(). (protocoldef): Move semantic actions to objc_start_protocol() and objc_finish_interface(). (ivar_decl_list): Remove nonterminal. (visibility_spec): Move semantic actions to objc_set_visibility(). (ivar_decls): Remove assignment to $$. (ivar_decl): Rephrase in terms of component_decl; call objc_add_instance_variable(). (ivars, ivar_declarator): Remove nonterminals. (opt_semi): New nonterminal. (methodtype): Remove semantic actions. (methoddef): Move semantic actions to objc_set_method_type(), objc_start_method_definition() and objc_finish_method_definition(). (methodproto): Move semantic actions to objc_set_method_type() and objc_add_method_declaration(). (methoddecl): Use objc_typename instead of typename; move semantic actions to objc_build_method_signature(). (optarglist, myxdecls, mydecl, myparms, myparm): Remove nonterminals. (optparmlist): Express in terms of optparms and optellipsis. (optparms, optellipsis, objc_qual, objc_quals, objc_typename): New nonterminals. (keyworddecl): Use objc_typename instead of typename. (rid_to_yy): Mark RID_IN, RID_OUT, RID_INOUT, RID_BYCOPY, RID_BYREF and RID_ONEWAY as returning OBJC_TYPE_QUAL to yyparse(). [gcc/objc/ChangeLog] 2004-09-07 Ziemowit Laski <zlaski@apple.com> * Make-lang.in (objc/objc-parse.o): Depend on $(C_COMMON_H) instead of objc/objc-act.h. (objc/objc-act.o): Depend on $(HASHTAB_H). * objc-act.c: Include hashtab.h; in ObjC++ mode, include cp-tree.h and objcp-decl.h instead of c-tree.h. (build_module_descriptor, get_class_ivars, synth_id_with_class_suffix, error_with_ivar, gen_method_decl, gen_declaration, setup_string_decl, build_protocol_template): Adjust prototypes. (build_module_initializer_routine, start_class, continue_class, finish_class, start_method_def, objc_start_function, start_protocol, build_method_decl, objc_add_method, add_instance_variable, build_ivar_reference, is_ivar, is_private, get_super_receiver, build_selector_table_decl, objc_push_parm, objc_get_parm_info, gen_type_name, gen_type_name_0, start_var_decl, finish_var_decl, create_field_decl): New prototypes. (objc_expand_function_end, comp_method_with_proto, objc_expr_last, gen_declaration_1, gen_declarator, is_complex_decl, adorn_decl, define_decl, create_builtin_decl, gen_declspecs): Remove prototypes. (TYPE_ID): Rename to OBJECT_TYPEDEF_NAME. (CLASS_TYPEDEF_NAME): New. (TAG_EXECCLASS): Change from a global variable to a #define. (TAG_RETURN_STRUCT): Delete. (TAG_GNUINIT): New, holds '__objc_gnu_init' name. (objc_inherit_code, objc_public_flag): New, moved from c-parse.in. (string_descriptor): New struct. (string_htab): New hash table. (string_hash, string_eq): New prototypes. (generate_struct_by_value_array): Call create_field_decl() instead of create_builtin_decl(). (objc_init): Do not initialize objc_ellipsis_node or TAG_EXECCLASS; In ObjC++ mode, call cxx_init() instead of c_objc_common_init(). (objc_finish_file): In ObjC++, call instantiate_pending_templates() and cp_finish_file(). (define_decl, get_static_reference, get_protocol_reference, create_builtin_decl): Remove functions. (objc_start_class_interface, objc_start_category_interface, objc_start_protocol, objc_continue_interface, objc_finish_interface, objc_start_class_implementation, objc_start_category_implementation, objc_continue_implementation, objc_finish_implementation, objc_set_visibility, objc_set_method_type, objc_build_method_signature, objc_add_method_declaration, objc_start_method_definition, objc_add_instance_variable, objc_get_protocol_qualified_type, create_field_decl, start_var_decl, finish_var_decl): New functions. (setup_string_decl): Simplify since it is only called once. (synth_module_prologue): Call build_class_template(); predefine 'id' and 'Class' as typedefs; rename 'temp_type' to 'type'; disable debug hooks for duration of function; fix GNU runtime messenger signatures to correspond to reality; forward-declare '__objc_exec_class' for the GNU runtime; call build_selector_table_decl(); in ObjC++ mode, generate 'extern "C" { ... }' wrappers around synthesized declarations; call build_protocol_template() and build_category_template(). (string_hash, string_eq): New functions. (objc_build_string_object): Check metaclass correctness only once; store string literals in hash table. (objc_build_constructor): Do not convert initializer elements; adjust for ObjC++ impedance mismatch. (build_objc_symtab_template): Call create_field_decl() instead of create_builtin_decl(). (init_objc_symtab): Add missing conversion to initializer element. (build_metadata_decl): Call start_var_decl() instead of define_decl(). (generate_objc_symtab_decl): Do not call build_category_template(); call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(). (build_module_descriptor): Call create_field_decl() instead of grokfield(); call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(); always mark module descriptor as used; move GNU runtime-specific functionality to build_module_initializer_routine(). (build_module_initializer_routine): New function, broken off of build_module_descriptor(). (objc_static_init_needed_p, objc_generate_static_init_call): New functions. (generate_static_references, generate_strings, build_selector_translation_table, generate_descriptor_table, generate_ivars_list, generate_dispatch_table, generate_category): Call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(); build a type directly instead of via groktypename(). (build_selector_reference_decl, build_selector_table_decl, build_class_reference_decl, build_protocol_reference, generate_objc_image_info): Call start_var_decl() instead of build_decl(). (build_selector_reference): For GNU runtime, do not call build_selector_reference_decl(). (build_selector, build_typed_selector_reference): Always convert result to the selector type. (add_objc_string): Cast return value to 'char *'. (build_method_prototype_template, build_selector_template, build_method_template): Use actual selector type for fields pointing to selectors. (finish_objc): For GNU runtime, call build_module_initializer_routine() after build_module_descriptor(). (generate_protocol_list, generate_shared_structures): Call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(); build a type directly instead of via groktypename(). (synth_id_with_class_suffix): Return a string. (get_arg_type_list): For instance methods, use the instance type for 'self'; do not call groktypename_in_parm_context(). (build_objc_string_decl): Squash redeclaration errors in ObjC++. (objc_is_class_name): Use OBJC_TYPE_NAME instead of TYPE_NAME; handle RECORD_TYPEs in ObjC as well as ObjC++. (objc_is_id): New function. (objc_is_object_ptr): Return the canonical type node. (objc_get_class_ivars): Simplify using get_class_ivars(). (get_class_ivars): Remove second parameter; create a fresh copy of the ivar list for each call; do not check for existence of super class. (objc_eh_runtime_type): Mark #ifndef OBJCPLUS. (objc_init_exceptions): When using SJLJ-style exceptions, require the use of '-fobjc-exceptions' flag; do not require it for DWARF-style exceptions. (objc_build_exc_ptr, next_sjlj_build_try_catch_finally): Use objc_object_type instead of objc_id_type. (objc_begin_catch_clause): Convert the incoming PARM_DECL into a VAR_DECL before placing it in the appropriate scope; do not call define_decl(); adjust call to c_begin_compound_stmt(); use objc_object_type instead of objc_id_type. (build_next_objc_exception_stuff): Call create_field_decl() instead of create_builtin_decl(); construct type directly instead of calling groktypename(); use OBJC_VOID_AT_END to mark end of function parameters. (build_private_template): Adjust call to get_class_ivars(); build a type directly instead of via groktypename(). (build_protocol_template, build_method_prototype_list_template, build_method_prototype_template, build_category_template, build_selector_template, build_class_template, build_super_template, build_ivar_template, build_ivar_list_template, build_method_list_template, build_method_template): Call create_field_decl() instead of grokfield(). (objc_method_parm_type): Do not call groktypename(). (generate_descriptor_table): Call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(). (generate_method_descriptors, build_protocol_initializer, generate_dispatch_tables, build_category_initializer, build_shared_structure_initializer): Do not call groktypename(). (generate_protocols): Call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(); do not call groktypename(). (error_with_ivar): Remove last parameter. (check_ivars): Do not iterate ovar CLASS_RAW_IVARS lists in addition to CLASS_IVARS lists; adjust calls to error_with_ivar(). (generate_ivar_lists): Convert one of the initializer elements; do not call groktypename(). (get_arg_type_list, start_method_def, gen_method_def): Account for new representation of variable arguments and '...' in Objective-C methods; add Objective-C++ impedance matching code. (is_objc_type_qualifier): Remove function. (adjust_type_for_id_default): Simplify; there is no longer a need to wade through declspecs. (lookup_interface, start_class, continue_class, finish_class, start_method_def, start_protocol, build_method_decl, objc_add_method, add_instance_variable, build_ivar_reference, is_ivar, is_private, get_super_receiver, objc_build_finally_epilogue): Make into static functions. (receiver_is_class_object): Use new IS_CLASS() macro. (objc_build_message_expr): Tweak ObjC++ message argument handling; call objc_finish_message_expr() instead of finish_message_expr(). (finish_message_expr): Rename to objc_finish_message_expr(); use OBJC_TYPE_NAME and OBJC_SET_TYPE_NAME macros instead of TYPE_NAME. call gen_type_name() instead of gen_declaration(); call objc_is_id() instead of using IS_ID and IS_CLASS; Use objc_class_name instead of calling get_identifier("Class"); handle CONVERT_EXPRs in receiver. (build_objc_method_call, warn_with_method): Do not call groktypename(). (build_ivar_reference): Call convert() instead of clobbering in a type. (hash_init): Initialize string_htab hash table. (add_instance_variable): Simplify parameter list; do not call grokfield(); do not populate CLASS_IVARS list. (start_class): Check for the existence of super class, if one was specified. (continue_class): Use CLASS_RAW_IVARS rather than CLASS_IVARS; do not call build_class_template(); adjust call to get_class_ivars(); call build_decl(), pushdecl() and finish_decl() instead of define_decl(). (finish_class): Call build_decl(), pushdecl() and finish_decl() instead of define_decl(). (add_protocols): Use PROTOCOL_BINFO_ELTS for the tree vector size. (start_protocol): Do not call build_protocol_template(); use PROTOCOL_BINFO_ELTS for the tree vector size. (encode_type_qualifiers): Do not handle the 'const' qualifier here. (encode_pointer): Encode 'const char *' as 'r*', for backwards compatibility. (encode_array): Use HOST_WIDE_INT_PRINT_DEC instead of "%ld". (encode_type): Handle the 'const' qualifier here. (objc_parmlist): New global variable, sued by objc_push_parm and objc_get_parm_info(). (objc_push_parm, objc_get_parm_info): New functions. (objc_expr_last): Remove function. (synth_self_and_ucmd_args): For instance methods, use the instance type for 'self'; call objc_push_parm() instead of push_parm_decl(). (start_method_def): Do not call push_scope(), declare_parm_level(), pop_scope(), push_parm_decl(), store_parm_decls() or objc_expr_last(); just use objc_push_parm() and objc_get_parm_info(). (comp_method_with_proto): Remove function. (objc_types_are_equivalent): Strip away indirections before comparing underlying types. (comp_proto_with_proto): Do not call groktypename(); types are no longer in raw declspec format. (objc_start_function): New function. (really_start_method): Call comp_proto_with_proto() instead of comp_method_with_proto(); call objc_start_function() instead of hand-crafting a function declarator. (continue_method_def, objc_expand_function_end): Remove functions. (get_super_receiver): Call objc_get_current_scope() instead of get_current_scope(); reference 'super_class' field (instead of 'class'). (finish_method_def): Rename to objc_finish_method_definition() and add a function decl parameter; move method encoding call from objc_expand_function_end(). (is_complex_decl, adorn_decl, gen_declarator, gen_declspecs, gen_declaration_1): Remove functions. (tmpbuf, RAW_DECLSPEC): Remove. (gen_declaration): Remove second parameter; simplify to deal with TYPE_P nodes instead of raw declspecs. (gen_type_name, gen_type_name_0): New functions. (gen_method_decl): Remove second parameter; call gen_type_name() instead of gen_declaration_1(). (dump_interface): Adjust calls to gen_declaration() and gen_method_decl(); do not allocate a separate string buffer. (init_objc): Allocate a larger string buffer to accommodate dump_interface(); adjust call to build_module_descriptor(); add call to build_module_initializer_routine() for the GNU runtime. (generate_classref_translation_entry): Do not call start_decl(); call finish_var_decl() instead of finish_decl(); call convert() instead of build_c_cast(). * objc-act.h (CLASS_OWN_IVARS): Remove accessor. (CLASS_BINFO_ELTS): Reduce from 6 to 5, now that CLASS_OWN_IVARS is gone. (OCTI_GNU_INIT_DECL, GNU_INIT_decl): New. (OCTI_ELLIPSIS_NODE, objc_ellipsis_node): Remove. (OCTI_ID_ID, id_type, objc_id_id): Rename to OCTI_ID_NAME, objc_object_type and objc_object_name, respectively. (OCTI_CLS_REF, OCTI_CLASS_NAME, objc_class_reference, objc_class_name): New. (IS_CLASS): New macro. (IS_ID, IS_SUPER): Robustify. (OCTI_EXECCLASS_DECL, execclass_decl): New. (finish_file, start_class, continue_class, finish_class, start_method_def, continue_method_def, finish_method_def, start_protocol, finish_protocol, objc_build_throw_stmt, objc_build_try_catch_finally_stmt, objc_build_synchronized_prologue, objc_build_synchronized_epilogue, objc_build_try_prologue, objc_build_try_epilogue, objc_build_catch_stmt, objc_build_catch_epilogue, objc_build_finally_prologue, objc_build_finally_epilogue, is_ivar, is_private, is_public, add_instance_variable, objc_add_method, get_super_receiver, objc_clear_super_receiver, get_class_ivars_from_name, get_class_reference, get_static_reference, get_object_reference, build_message_expr, finish_message_expr, build_selector_expr, build_ivar_reference, build_keyword_decl, build_method_decl, build_protocol_expr, build_objc_string_object, objc_declare_alias, objc_declare_class, objc_declare_protocols, objc_comptypes, objc_check_decl, build_encode_expr): Remove prototypes. (imp_count, cat_count): Make GGC-aware. (OBJC_SET_TYPE_NAME): New macro. From-SVN: r87168
2004-09-08 02:49:44 +02:00
parmlist = METHOD_SEL_ARGS (method);
while (parmlist)
1992-01-18 00:15:38 +01:00
{
tree type = TREE_VALUE (TREE_TYPE (parmlist)), parm;
parm = build_decl (PARM_DECL, KEYWORD_ARG_NAME (parmlist), type);
Makefile.in (c-parse.o): Depend on $(C_COMMON_H). [gcc/ChangeLog] 2004-09-07 Ziemowit Laski <zlaski@apple.com> * Makefile.in (c-parse.o): Depend on $(C_COMMON_H). * c-parse.in: Include c-common.h instead of objc-act.h. (ivar_decl_list, ivar_decls, ivar_decl, ivars, ivar_declarator, myparms, myparm): Remove %type declarations. (methodtype, optparms, OBJC_TYPE_QUAL, objc_quals, objc_qual, objc_typename, objc_try_catch_stmt, optellipsis): Add %type declarations. (objc_inherit_code, objc_public_flag): Remove. (typespec_nonreserved_nonattr): Call objc_get_protocol_qualified_type() instead of get_static_reference() and get_protocol_reference(). (stmt_nocomp): Call grokparm() on @catch parameter. (objcdef): Move semantic action to objc_finish_implementation(). (classdef): Move semantic action to objc_start_class_interface(), objc_continue_interface(), objc_finish_interface(), objc_start_class_implementation(), objc_continue_implementation(), objc_start_category_interface() and objc_start_category_implementation(). (protocoldef): Move semantic actions to objc_start_protocol() and objc_finish_interface(). (ivar_decl_list): Remove nonterminal. (visibility_spec): Move semantic actions to objc_set_visibility(). (ivar_decls): Remove assignment to $$. (ivar_decl): Rephrase in terms of component_decl; call objc_add_instance_variable(). (ivars, ivar_declarator): Remove nonterminals. (opt_semi): New nonterminal. (methodtype): Remove semantic actions. (methoddef): Move semantic actions to objc_set_method_type(), objc_start_method_definition() and objc_finish_method_definition(). (methodproto): Move semantic actions to objc_set_method_type() and objc_add_method_declaration(). (methoddecl): Use objc_typename instead of typename; move semantic actions to objc_build_method_signature(). (optarglist, myxdecls, mydecl, myparms, myparm): Remove nonterminals. (optparmlist): Express in terms of optparms and optellipsis. (optparms, optellipsis, objc_qual, objc_quals, objc_typename): New nonterminals. (keyworddecl): Use objc_typename instead of typename. (rid_to_yy): Mark RID_IN, RID_OUT, RID_INOUT, RID_BYCOPY, RID_BYREF and RID_ONEWAY as returning OBJC_TYPE_QUAL to yyparse(). [gcc/objc/ChangeLog] 2004-09-07 Ziemowit Laski <zlaski@apple.com> * Make-lang.in (objc/objc-parse.o): Depend on $(C_COMMON_H) instead of objc/objc-act.h. (objc/objc-act.o): Depend on $(HASHTAB_H). * objc-act.c: Include hashtab.h; in ObjC++ mode, include cp-tree.h and objcp-decl.h instead of c-tree.h. (build_module_descriptor, get_class_ivars, synth_id_with_class_suffix, error_with_ivar, gen_method_decl, gen_declaration, setup_string_decl, build_protocol_template): Adjust prototypes. (build_module_initializer_routine, start_class, continue_class, finish_class, start_method_def, objc_start_function, start_protocol, build_method_decl, objc_add_method, add_instance_variable, build_ivar_reference, is_ivar, is_private, get_super_receiver, build_selector_table_decl, objc_push_parm, objc_get_parm_info, gen_type_name, gen_type_name_0, start_var_decl, finish_var_decl, create_field_decl): New prototypes. (objc_expand_function_end, comp_method_with_proto, objc_expr_last, gen_declaration_1, gen_declarator, is_complex_decl, adorn_decl, define_decl, create_builtin_decl, gen_declspecs): Remove prototypes. (TYPE_ID): Rename to OBJECT_TYPEDEF_NAME. (CLASS_TYPEDEF_NAME): New. (TAG_EXECCLASS): Change from a global variable to a #define. (TAG_RETURN_STRUCT): Delete. (TAG_GNUINIT): New, holds '__objc_gnu_init' name. (objc_inherit_code, objc_public_flag): New, moved from c-parse.in. (string_descriptor): New struct. (string_htab): New hash table. (string_hash, string_eq): New prototypes. (generate_struct_by_value_array): Call create_field_decl() instead of create_builtin_decl(). (objc_init): Do not initialize objc_ellipsis_node or TAG_EXECCLASS; In ObjC++ mode, call cxx_init() instead of c_objc_common_init(). (objc_finish_file): In ObjC++, call instantiate_pending_templates() and cp_finish_file(). (define_decl, get_static_reference, get_protocol_reference, create_builtin_decl): Remove functions. (objc_start_class_interface, objc_start_category_interface, objc_start_protocol, objc_continue_interface, objc_finish_interface, objc_start_class_implementation, objc_start_category_implementation, objc_continue_implementation, objc_finish_implementation, objc_set_visibility, objc_set_method_type, objc_build_method_signature, objc_add_method_declaration, objc_start_method_definition, objc_add_instance_variable, objc_get_protocol_qualified_type, create_field_decl, start_var_decl, finish_var_decl): New functions. (setup_string_decl): Simplify since it is only called once. (synth_module_prologue): Call build_class_template(); predefine 'id' and 'Class' as typedefs; rename 'temp_type' to 'type'; disable debug hooks for duration of function; fix GNU runtime messenger signatures to correspond to reality; forward-declare '__objc_exec_class' for the GNU runtime; call build_selector_table_decl(); in ObjC++ mode, generate 'extern "C" { ... }' wrappers around synthesized declarations; call build_protocol_template() and build_category_template(). (string_hash, string_eq): New functions. (objc_build_string_object): Check metaclass correctness only once; store string literals in hash table. (objc_build_constructor): Do not convert initializer elements; adjust for ObjC++ impedance mismatch. (build_objc_symtab_template): Call create_field_decl() instead of create_builtin_decl(). (init_objc_symtab): Add missing conversion to initializer element. (build_metadata_decl): Call start_var_decl() instead of define_decl(). (generate_objc_symtab_decl): Do not call build_category_template(); call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(). (build_module_descriptor): Call create_field_decl() instead of grokfield(); call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(); always mark module descriptor as used; move GNU runtime-specific functionality to build_module_initializer_routine(). (build_module_initializer_routine): New function, broken off of build_module_descriptor(). (objc_static_init_needed_p, objc_generate_static_init_call): New functions. (generate_static_references, generate_strings, build_selector_translation_table, generate_descriptor_table, generate_ivars_list, generate_dispatch_table, generate_category): Call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(); build a type directly instead of via groktypename(). (build_selector_reference_decl, build_selector_table_decl, build_class_reference_decl, build_protocol_reference, generate_objc_image_info): Call start_var_decl() instead of build_decl(). (build_selector_reference): For GNU runtime, do not call build_selector_reference_decl(). (build_selector, build_typed_selector_reference): Always convert result to the selector type. (add_objc_string): Cast return value to 'char *'. (build_method_prototype_template, build_selector_template, build_method_template): Use actual selector type for fields pointing to selectors. (finish_objc): For GNU runtime, call build_module_initializer_routine() after build_module_descriptor(). (generate_protocol_list, generate_shared_structures): Call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(); build a type directly instead of via groktypename(). (synth_id_with_class_suffix): Return a string. (get_arg_type_list): For instance methods, use the instance type for 'self'; do not call groktypename_in_parm_context(). (build_objc_string_decl): Squash redeclaration errors in ObjC++. (objc_is_class_name): Use OBJC_TYPE_NAME instead of TYPE_NAME; handle RECORD_TYPEs in ObjC as well as ObjC++. (objc_is_id): New function. (objc_is_object_ptr): Return the canonical type node. (objc_get_class_ivars): Simplify using get_class_ivars(). (get_class_ivars): Remove second parameter; create a fresh copy of the ivar list for each call; do not check for existence of super class. (objc_eh_runtime_type): Mark #ifndef OBJCPLUS. (objc_init_exceptions): When using SJLJ-style exceptions, require the use of '-fobjc-exceptions' flag; do not require it for DWARF-style exceptions. (objc_build_exc_ptr, next_sjlj_build_try_catch_finally): Use objc_object_type instead of objc_id_type. (objc_begin_catch_clause): Convert the incoming PARM_DECL into a VAR_DECL before placing it in the appropriate scope; do not call define_decl(); adjust call to c_begin_compound_stmt(); use objc_object_type instead of objc_id_type. (build_next_objc_exception_stuff): Call create_field_decl() instead of create_builtin_decl(); construct type directly instead of calling groktypename(); use OBJC_VOID_AT_END to mark end of function parameters. (build_private_template): Adjust call to get_class_ivars(); build a type directly instead of via groktypename(). (build_protocol_template, build_method_prototype_list_template, build_method_prototype_template, build_category_template, build_selector_template, build_class_template, build_super_template, build_ivar_template, build_ivar_list_template, build_method_list_template, build_method_template): Call create_field_decl() instead of grokfield(). (objc_method_parm_type): Do not call groktypename(). (generate_descriptor_table): Call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(). (generate_method_descriptors, build_protocol_initializer, generate_dispatch_tables, build_category_initializer, build_shared_structure_initializer): Do not call groktypename(). (generate_protocols): Call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(); do not call groktypename(). (error_with_ivar): Remove last parameter. (check_ivars): Do not iterate ovar CLASS_RAW_IVARS lists in addition to CLASS_IVARS lists; adjust calls to error_with_ivar(). (generate_ivar_lists): Convert one of the initializer elements; do not call groktypename(). (get_arg_type_list, start_method_def, gen_method_def): Account for new representation of variable arguments and '...' in Objective-C methods; add Objective-C++ impedance matching code. (is_objc_type_qualifier): Remove function. (adjust_type_for_id_default): Simplify; there is no longer a need to wade through declspecs. (lookup_interface, start_class, continue_class, finish_class, start_method_def, start_protocol, build_method_decl, objc_add_method, add_instance_variable, build_ivar_reference, is_ivar, is_private, get_super_receiver, objc_build_finally_epilogue): Make into static functions. (receiver_is_class_object): Use new IS_CLASS() macro. (objc_build_message_expr): Tweak ObjC++ message argument handling; call objc_finish_message_expr() instead of finish_message_expr(). (finish_message_expr): Rename to objc_finish_message_expr(); use OBJC_TYPE_NAME and OBJC_SET_TYPE_NAME macros instead of TYPE_NAME. call gen_type_name() instead of gen_declaration(); call objc_is_id() instead of using IS_ID and IS_CLASS; Use objc_class_name instead of calling get_identifier("Class"); handle CONVERT_EXPRs in receiver. (build_objc_method_call, warn_with_method): Do not call groktypename(). (build_ivar_reference): Call convert() instead of clobbering in a type. (hash_init): Initialize string_htab hash table. (add_instance_variable): Simplify parameter list; do not call grokfield(); do not populate CLASS_IVARS list. (start_class): Check for the existence of super class, if one was specified. (continue_class): Use CLASS_RAW_IVARS rather than CLASS_IVARS; do not call build_class_template(); adjust call to get_class_ivars(); call build_decl(), pushdecl() and finish_decl() instead of define_decl(). (finish_class): Call build_decl(), pushdecl() and finish_decl() instead of define_decl(). (add_protocols): Use PROTOCOL_BINFO_ELTS for the tree vector size. (start_protocol): Do not call build_protocol_template(); use PROTOCOL_BINFO_ELTS for the tree vector size. (encode_type_qualifiers): Do not handle the 'const' qualifier here. (encode_pointer): Encode 'const char *' as 'r*', for backwards compatibility. (encode_array): Use HOST_WIDE_INT_PRINT_DEC instead of "%ld". (encode_type): Handle the 'const' qualifier here. (objc_parmlist): New global variable, sued by objc_push_parm and objc_get_parm_info(). (objc_push_parm, objc_get_parm_info): New functions. (objc_expr_last): Remove function. (synth_self_and_ucmd_args): For instance methods, use the instance type for 'self'; call objc_push_parm() instead of push_parm_decl(). (start_method_def): Do not call push_scope(), declare_parm_level(), pop_scope(), push_parm_decl(), store_parm_decls() or objc_expr_last(); just use objc_push_parm() and objc_get_parm_info(). (comp_method_with_proto): Remove function. (objc_types_are_equivalent): Strip away indirections before comparing underlying types. (comp_proto_with_proto): Do not call groktypename(); types are no longer in raw declspec format. (objc_start_function): New function. (really_start_method): Call comp_proto_with_proto() instead of comp_method_with_proto(); call objc_start_function() instead of hand-crafting a function declarator. (continue_method_def, objc_expand_function_end): Remove functions. (get_super_receiver): Call objc_get_current_scope() instead of get_current_scope(); reference 'super_class' field (instead of 'class'). (finish_method_def): Rename to objc_finish_method_definition() and add a function decl parameter; move method encoding call from objc_expand_function_end(). (is_complex_decl, adorn_decl, gen_declarator, gen_declspecs, gen_declaration_1): Remove functions. (tmpbuf, RAW_DECLSPEC): Remove. (gen_declaration): Remove second parameter; simplify to deal with TYPE_P nodes instead of raw declspecs. (gen_type_name, gen_type_name_0): New functions. (gen_method_decl): Remove second parameter; call gen_type_name() instead of gen_declaration_1(). (dump_interface): Adjust calls to gen_declaration() and gen_method_decl(); do not allocate a separate string buffer. (init_objc): Allocate a larger string buffer to accommodate dump_interface(); adjust call to build_module_descriptor(); add call to build_module_initializer_routine() for the GNU runtime. (generate_classref_translation_entry): Do not call start_decl(); call finish_var_decl() instead of finish_decl(); call convert() instead of build_c_cast(). * objc-act.h (CLASS_OWN_IVARS): Remove accessor. (CLASS_BINFO_ELTS): Reduce from 6 to 5, now that CLASS_OWN_IVARS is gone. (OCTI_GNU_INIT_DECL, GNU_INIT_decl): New. (OCTI_ELLIPSIS_NODE, objc_ellipsis_node): Remove. (OCTI_ID_ID, id_type, objc_id_id): Rename to OCTI_ID_NAME, objc_object_type and objc_object_name, respectively. (OCTI_CLS_REF, OCTI_CLASS_NAME, objc_class_reference, objc_class_name): New. (IS_CLASS): New macro. (IS_ID, IS_SUPER): Robustify. (OCTI_EXECCLASS_DECL, execclass_decl): New. (finish_file, start_class, continue_class, finish_class, start_method_def, continue_method_def, finish_method_def, start_protocol, finish_protocol, objc_build_throw_stmt, objc_build_try_catch_finally_stmt, objc_build_synchronized_prologue, objc_build_synchronized_epilogue, objc_build_try_prologue, objc_build_try_epilogue, objc_build_catch_stmt, objc_build_catch_epilogue, objc_build_finally_prologue, objc_build_finally_epilogue, is_ivar, is_private, is_public, add_instance_variable, objc_add_method, get_super_receiver, objc_clear_super_receiver, get_class_ivars_from_name, get_class_reference, get_static_reference, get_object_reference, build_message_expr, finish_message_expr, build_selector_expr, build_ivar_reference, build_keyword_decl, build_method_decl, build_protocol_expr, build_objc_string_object, objc_declare_alias, objc_declare_class, objc_declare_protocols, objc_comptypes, objc_check_decl, build_encode_expr): Remove prototypes. (imp_count, cat_count): Make GGC-aware. (OBJC_SET_TYPE_NAME): New macro. From-SVN: r87168
2004-09-08 02:49:44 +02:00
objc_push_parm (parm);
parmlist = TREE_CHAIN (parmlist);
1992-01-18 00:15:38 +01:00
}
Makefile.in (c-parse.o): Depend on $(C_COMMON_H). [gcc/ChangeLog] 2004-09-07 Ziemowit Laski <zlaski@apple.com> * Makefile.in (c-parse.o): Depend on $(C_COMMON_H). * c-parse.in: Include c-common.h instead of objc-act.h. (ivar_decl_list, ivar_decls, ivar_decl, ivars, ivar_declarator, myparms, myparm): Remove %type declarations. (methodtype, optparms, OBJC_TYPE_QUAL, objc_quals, objc_qual, objc_typename, objc_try_catch_stmt, optellipsis): Add %type declarations. (objc_inherit_code, objc_public_flag): Remove. (typespec_nonreserved_nonattr): Call objc_get_protocol_qualified_type() instead of get_static_reference() and get_protocol_reference(). (stmt_nocomp): Call grokparm() on @catch parameter. (objcdef): Move semantic action to objc_finish_implementation(). (classdef): Move semantic action to objc_start_class_interface(), objc_continue_interface(), objc_finish_interface(), objc_start_class_implementation(), objc_continue_implementation(), objc_start_category_interface() and objc_start_category_implementation(). (protocoldef): Move semantic actions to objc_start_protocol() and objc_finish_interface(). (ivar_decl_list): Remove nonterminal. (visibility_spec): Move semantic actions to objc_set_visibility(). (ivar_decls): Remove assignment to $$. (ivar_decl): Rephrase in terms of component_decl; call objc_add_instance_variable(). (ivars, ivar_declarator): Remove nonterminals. (opt_semi): New nonterminal. (methodtype): Remove semantic actions. (methoddef): Move semantic actions to objc_set_method_type(), objc_start_method_definition() and objc_finish_method_definition(). (methodproto): Move semantic actions to objc_set_method_type() and objc_add_method_declaration(). (methoddecl): Use objc_typename instead of typename; move semantic actions to objc_build_method_signature(). (optarglist, myxdecls, mydecl, myparms, myparm): Remove nonterminals. (optparmlist): Express in terms of optparms and optellipsis. (optparms, optellipsis, objc_qual, objc_quals, objc_typename): New nonterminals. (keyworddecl): Use objc_typename instead of typename. (rid_to_yy): Mark RID_IN, RID_OUT, RID_INOUT, RID_BYCOPY, RID_BYREF and RID_ONEWAY as returning OBJC_TYPE_QUAL to yyparse(). [gcc/objc/ChangeLog] 2004-09-07 Ziemowit Laski <zlaski@apple.com> * Make-lang.in (objc/objc-parse.o): Depend on $(C_COMMON_H) instead of objc/objc-act.h. (objc/objc-act.o): Depend on $(HASHTAB_H). * objc-act.c: Include hashtab.h; in ObjC++ mode, include cp-tree.h and objcp-decl.h instead of c-tree.h. (build_module_descriptor, get_class_ivars, synth_id_with_class_suffix, error_with_ivar, gen_method_decl, gen_declaration, setup_string_decl, build_protocol_template): Adjust prototypes. (build_module_initializer_routine, start_class, continue_class, finish_class, start_method_def, objc_start_function, start_protocol, build_method_decl, objc_add_method, add_instance_variable, build_ivar_reference, is_ivar, is_private, get_super_receiver, build_selector_table_decl, objc_push_parm, objc_get_parm_info, gen_type_name, gen_type_name_0, start_var_decl, finish_var_decl, create_field_decl): New prototypes. (objc_expand_function_end, comp_method_with_proto, objc_expr_last, gen_declaration_1, gen_declarator, is_complex_decl, adorn_decl, define_decl, create_builtin_decl, gen_declspecs): Remove prototypes. (TYPE_ID): Rename to OBJECT_TYPEDEF_NAME. (CLASS_TYPEDEF_NAME): New. (TAG_EXECCLASS): Change from a global variable to a #define. (TAG_RETURN_STRUCT): Delete. (TAG_GNUINIT): New, holds '__objc_gnu_init' name. (objc_inherit_code, objc_public_flag): New, moved from c-parse.in. (string_descriptor): New struct. (string_htab): New hash table. (string_hash, string_eq): New prototypes. (generate_struct_by_value_array): Call create_field_decl() instead of create_builtin_decl(). (objc_init): Do not initialize objc_ellipsis_node or TAG_EXECCLASS; In ObjC++ mode, call cxx_init() instead of c_objc_common_init(). (objc_finish_file): In ObjC++, call instantiate_pending_templates() and cp_finish_file(). (define_decl, get_static_reference, get_protocol_reference, create_builtin_decl): Remove functions. (objc_start_class_interface, objc_start_category_interface, objc_start_protocol, objc_continue_interface, objc_finish_interface, objc_start_class_implementation, objc_start_category_implementation, objc_continue_implementation, objc_finish_implementation, objc_set_visibility, objc_set_method_type, objc_build_method_signature, objc_add_method_declaration, objc_start_method_definition, objc_add_instance_variable, objc_get_protocol_qualified_type, create_field_decl, start_var_decl, finish_var_decl): New functions. (setup_string_decl): Simplify since it is only called once. (synth_module_prologue): Call build_class_template(); predefine 'id' and 'Class' as typedefs; rename 'temp_type' to 'type'; disable debug hooks for duration of function; fix GNU runtime messenger signatures to correspond to reality; forward-declare '__objc_exec_class' for the GNU runtime; call build_selector_table_decl(); in ObjC++ mode, generate 'extern "C" { ... }' wrappers around synthesized declarations; call build_protocol_template() and build_category_template(). (string_hash, string_eq): New functions. (objc_build_string_object): Check metaclass correctness only once; store string literals in hash table. (objc_build_constructor): Do not convert initializer elements; adjust for ObjC++ impedance mismatch. (build_objc_symtab_template): Call create_field_decl() instead of create_builtin_decl(). (init_objc_symtab): Add missing conversion to initializer element. (build_metadata_decl): Call start_var_decl() instead of define_decl(). (generate_objc_symtab_decl): Do not call build_category_template(); call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(). (build_module_descriptor): Call create_field_decl() instead of grokfield(); call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(); always mark module descriptor as used; move GNU runtime-specific functionality to build_module_initializer_routine(). (build_module_initializer_routine): New function, broken off of build_module_descriptor(). (objc_static_init_needed_p, objc_generate_static_init_call): New functions. (generate_static_references, generate_strings, build_selector_translation_table, generate_descriptor_table, generate_ivars_list, generate_dispatch_table, generate_category): Call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(); build a type directly instead of via groktypename(). (build_selector_reference_decl, build_selector_table_decl, build_class_reference_decl, build_protocol_reference, generate_objc_image_info): Call start_var_decl() instead of build_decl(). (build_selector_reference): For GNU runtime, do not call build_selector_reference_decl(). (build_selector, build_typed_selector_reference): Always convert result to the selector type. (add_objc_string): Cast return value to 'char *'. (build_method_prototype_template, build_selector_template, build_method_template): Use actual selector type for fields pointing to selectors. (finish_objc): For GNU runtime, call build_module_initializer_routine() after build_module_descriptor(). (generate_protocol_list, generate_shared_structures): Call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(); build a type directly instead of via groktypename(). (synth_id_with_class_suffix): Return a string. (get_arg_type_list): For instance methods, use the instance type for 'self'; do not call groktypename_in_parm_context(). (build_objc_string_decl): Squash redeclaration errors in ObjC++. (objc_is_class_name): Use OBJC_TYPE_NAME instead of TYPE_NAME; handle RECORD_TYPEs in ObjC as well as ObjC++. (objc_is_id): New function. (objc_is_object_ptr): Return the canonical type node. (objc_get_class_ivars): Simplify using get_class_ivars(). (get_class_ivars): Remove second parameter; create a fresh copy of the ivar list for each call; do not check for existence of super class. (objc_eh_runtime_type): Mark #ifndef OBJCPLUS. (objc_init_exceptions): When using SJLJ-style exceptions, require the use of '-fobjc-exceptions' flag; do not require it for DWARF-style exceptions. (objc_build_exc_ptr, next_sjlj_build_try_catch_finally): Use objc_object_type instead of objc_id_type. (objc_begin_catch_clause): Convert the incoming PARM_DECL into a VAR_DECL before placing it in the appropriate scope; do not call define_decl(); adjust call to c_begin_compound_stmt(); use objc_object_type instead of objc_id_type. (build_next_objc_exception_stuff): Call create_field_decl() instead of create_builtin_decl(); construct type directly instead of calling groktypename(); use OBJC_VOID_AT_END to mark end of function parameters. (build_private_template): Adjust call to get_class_ivars(); build a type directly instead of via groktypename(). (build_protocol_template, build_method_prototype_list_template, build_method_prototype_template, build_category_template, build_selector_template, build_class_template, build_super_template, build_ivar_template, build_ivar_list_template, build_method_list_template, build_method_template): Call create_field_decl() instead of grokfield(). (objc_method_parm_type): Do not call groktypename(). (generate_descriptor_table): Call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(). (generate_method_descriptors, build_protocol_initializer, generate_dispatch_tables, build_category_initializer, build_shared_structure_initializer): Do not call groktypename(). (generate_protocols): Call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(); do not call groktypename(). (error_with_ivar): Remove last parameter. (check_ivars): Do not iterate ovar CLASS_RAW_IVARS lists in addition to CLASS_IVARS lists; adjust calls to error_with_ivar(). (generate_ivar_lists): Convert one of the initializer elements; do not call groktypename(). (get_arg_type_list, start_method_def, gen_method_def): Account for new representation of variable arguments and '...' in Objective-C methods; add Objective-C++ impedance matching code. (is_objc_type_qualifier): Remove function. (adjust_type_for_id_default): Simplify; there is no longer a need to wade through declspecs. (lookup_interface, start_class, continue_class, finish_class, start_method_def, start_protocol, build_method_decl, objc_add_method, add_instance_variable, build_ivar_reference, is_ivar, is_private, get_super_receiver, objc_build_finally_epilogue): Make into static functions. (receiver_is_class_object): Use new IS_CLASS() macro. (objc_build_message_expr): Tweak ObjC++ message argument handling; call objc_finish_message_expr() instead of finish_message_expr(). (finish_message_expr): Rename to objc_finish_message_expr(); use OBJC_TYPE_NAME and OBJC_SET_TYPE_NAME macros instead of TYPE_NAME. call gen_type_name() instead of gen_declaration(); call objc_is_id() instead of using IS_ID and IS_CLASS; Use objc_class_name instead of calling get_identifier("Class"); handle CONVERT_EXPRs in receiver. (build_objc_method_call, warn_with_method): Do not call groktypename(). (build_ivar_reference): Call convert() instead of clobbering in a type. (hash_init): Initialize string_htab hash table. (add_instance_variable): Simplify parameter list; do not call grokfield(); do not populate CLASS_IVARS list. (start_class): Check for the existence of super class, if one was specified. (continue_class): Use CLASS_RAW_IVARS rather than CLASS_IVARS; do not call build_class_template(); adjust call to get_class_ivars(); call build_decl(), pushdecl() and finish_decl() instead of define_decl(). (finish_class): Call build_decl(), pushdecl() and finish_decl() instead of define_decl(). (add_protocols): Use PROTOCOL_BINFO_ELTS for the tree vector size. (start_protocol): Do not call build_protocol_template(); use PROTOCOL_BINFO_ELTS for the tree vector size. (encode_type_qualifiers): Do not handle the 'const' qualifier here. (encode_pointer): Encode 'const char *' as 'r*', for backwards compatibility. (encode_array): Use HOST_WIDE_INT_PRINT_DEC instead of "%ld". (encode_type): Handle the 'const' qualifier here. (objc_parmlist): New global variable, sued by objc_push_parm and objc_get_parm_info(). (objc_push_parm, objc_get_parm_info): New functions. (objc_expr_last): Remove function. (synth_self_and_ucmd_args): For instance methods, use the instance type for 'self'; call objc_push_parm() instead of push_parm_decl(). (start_method_def): Do not call push_scope(), declare_parm_level(), pop_scope(), push_parm_decl(), store_parm_decls() or objc_expr_last(); just use objc_push_parm() and objc_get_parm_info(). (comp_method_with_proto): Remove function. (objc_types_are_equivalent): Strip away indirections before comparing underlying types. (comp_proto_with_proto): Do not call groktypename(); types are no longer in raw declspec format. (objc_start_function): New function. (really_start_method): Call comp_proto_with_proto() instead of comp_method_with_proto(); call objc_start_function() instead of hand-crafting a function declarator. (continue_method_def, objc_expand_function_end): Remove functions. (get_super_receiver): Call objc_get_current_scope() instead of get_current_scope(); reference 'super_class' field (instead of 'class'). (finish_method_def): Rename to objc_finish_method_definition() and add a function decl parameter; move method encoding call from objc_expand_function_end(). (is_complex_decl, adorn_decl, gen_declarator, gen_declspecs, gen_declaration_1): Remove functions. (tmpbuf, RAW_DECLSPEC): Remove. (gen_declaration): Remove second parameter; simplify to deal with TYPE_P nodes instead of raw declspecs. (gen_type_name, gen_type_name_0): New functions. (gen_method_decl): Remove second parameter; call gen_type_name() instead of gen_declaration_1(). (dump_interface): Adjust calls to gen_declaration() and gen_method_decl(); do not allocate a separate string buffer. (init_objc): Allocate a larger string buffer to accommodate dump_interface(); adjust call to build_module_descriptor(); add call to build_module_initializer_routine() for the GNU runtime. (generate_classref_translation_entry): Do not call start_decl(); call finish_var_decl() instead of finish_decl(); call convert() instead of build_c_cast(). * objc-act.h (CLASS_OWN_IVARS): Remove accessor. (CLASS_BINFO_ELTS): Reduce from 6 to 5, now that CLASS_OWN_IVARS is gone. (OCTI_GNU_INIT_DECL, GNU_INIT_decl): New. (OCTI_ELLIPSIS_NODE, objc_ellipsis_node): Remove. (OCTI_ID_ID, id_type, objc_id_id): Rename to OCTI_ID_NAME, objc_object_type and objc_object_name, respectively. (OCTI_CLS_REF, OCTI_CLASS_NAME, objc_class_reference, objc_class_name): New. (IS_CLASS): New macro. (IS_ID, IS_SUPER): Robustify. (OCTI_EXECCLASS_DECL, execclass_decl): New. (finish_file, start_class, continue_class, finish_class, start_method_def, continue_method_def, finish_method_def, start_protocol, finish_protocol, objc_build_throw_stmt, objc_build_try_catch_finally_stmt, objc_build_synchronized_prologue, objc_build_synchronized_epilogue, objc_build_try_prologue, objc_build_try_epilogue, objc_build_catch_stmt, objc_build_catch_epilogue, objc_build_finally_prologue, objc_build_finally_epilogue, is_ivar, is_private, is_public, add_instance_variable, objc_add_method, get_super_receiver, objc_clear_super_receiver, get_class_ivars_from_name, get_class_reference, get_static_reference, get_object_reference, build_message_expr, finish_message_expr, build_selector_expr, build_ivar_reference, build_keyword_decl, build_method_decl, build_protocol_expr, build_objc_string_object, objc_declare_alias, objc_declare_class, objc_declare_protocols, objc_comptypes, objc_check_decl, build_encode_expr): Remove prototypes. (imp_count, cat_count): Make GGC-aware. (OBJC_SET_TYPE_NAME): New macro. From-SVN: r87168
2004-09-08 02:49:44 +02:00
if (METHOD_ADD_ARGS (method))
1992-01-18 00:15:38 +01:00
{
Makefile.in (c-parse.o): Depend on $(C_COMMON_H). [gcc/ChangeLog] 2004-09-07 Ziemowit Laski <zlaski@apple.com> * Makefile.in (c-parse.o): Depend on $(C_COMMON_H). * c-parse.in: Include c-common.h instead of objc-act.h. (ivar_decl_list, ivar_decls, ivar_decl, ivars, ivar_declarator, myparms, myparm): Remove %type declarations. (methodtype, optparms, OBJC_TYPE_QUAL, objc_quals, objc_qual, objc_typename, objc_try_catch_stmt, optellipsis): Add %type declarations. (objc_inherit_code, objc_public_flag): Remove. (typespec_nonreserved_nonattr): Call objc_get_protocol_qualified_type() instead of get_static_reference() and get_protocol_reference(). (stmt_nocomp): Call grokparm() on @catch parameter. (objcdef): Move semantic action to objc_finish_implementation(). (classdef): Move semantic action to objc_start_class_interface(), objc_continue_interface(), objc_finish_interface(), objc_start_class_implementation(), objc_continue_implementation(), objc_start_category_interface() and objc_start_category_implementation(). (protocoldef): Move semantic actions to objc_start_protocol() and objc_finish_interface(). (ivar_decl_list): Remove nonterminal. (visibility_spec): Move semantic actions to objc_set_visibility(). (ivar_decls): Remove assignment to $$. (ivar_decl): Rephrase in terms of component_decl; call objc_add_instance_variable(). (ivars, ivar_declarator): Remove nonterminals. (opt_semi): New nonterminal. (methodtype): Remove semantic actions. (methoddef): Move semantic actions to objc_set_method_type(), objc_start_method_definition() and objc_finish_method_definition(). (methodproto): Move semantic actions to objc_set_method_type() and objc_add_method_declaration(). (methoddecl): Use objc_typename instead of typename; move semantic actions to objc_build_method_signature(). (optarglist, myxdecls, mydecl, myparms, myparm): Remove nonterminals. (optparmlist): Express in terms of optparms and optellipsis. (optparms, optellipsis, objc_qual, objc_quals, objc_typename): New nonterminals. (keyworddecl): Use objc_typename instead of typename. (rid_to_yy): Mark RID_IN, RID_OUT, RID_INOUT, RID_BYCOPY, RID_BYREF and RID_ONEWAY as returning OBJC_TYPE_QUAL to yyparse(). [gcc/objc/ChangeLog] 2004-09-07 Ziemowit Laski <zlaski@apple.com> * Make-lang.in (objc/objc-parse.o): Depend on $(C_COMMON_H) instead of objc/objc-act.h. (objc/objc-act.o): Depend on $(HASHTAB_H). * objc-act.c: Include hashtab.h; in ObjC++ mode, include cp-tree.h and objcp-decl.h instead of c-tree.h. (build_module_descriptor, get_class_ivars, synth_id_with_class_suffix, error_with_ivar, gen_method_decl, gen_declaration, setup_string_decl, build_protocol_template): Adjust prototypes. (build_module_initializer_routine, start_class, continue_class, finish_class, start_method_def, objc_start_function, start_protocol, build_method_decl, objc_add_method, add_instance_variable, build_ivar_reference, is_ivar, is_private, get_super_receiver, build_selector_table_decl, objc_push_parm, objc_get_parm_info, gen_type_name, gen_type_name_0, start_var_decl, finish_var_decl, create_field_decl): New prototypes. (objc_expand_function_end, comp_method_with_proto, objc_expr_last, gen_declaration_1, gen_declarator, is_complex_decl, adorn_decl, define_decl, create_builtin_decl, gen_declspecs): Remove prototypes. (TYPE_ID): Rename to OBJECT_TYPEDEF_NAME. (CLASS_TYPEDEF_NAME): New. (TAG_EXECCLASS): Change from a global variable to a #define. (TAG_RETURN_STRUCT): Delete. (TAG_GNUINIT): New, holds '__objc_gnu_init' name. (objc_inherit_code, objc_public_flag): New, moved from c-parse.in. (string_descriptor): New struct. (string_htab): New hash table. (string_hash, string_eq): New prototypes. (generate_struct_by_value_array): Call create_field_decl() instead of create_builtin_decl(). (objc_init): Do not initialize objc_ellipsis_node or TAG_EXECCLASS; In ObjC++ mode, call cxx_init() instead of c_objc_common_init(). (objc_finish_file): In ObjC++, call instantiate_pending_templates() and cp_finish_file(). (define_decl, get_static_reference, get_protocol_reference, create_builtin_decl): Remove functions. (objc_start_class_interface, objc_start_category_interface, objc_start_protocol, objc_continue_interface, objc_finish_interface, objc_start_class_implementation, objc_start_category_implementation, objc_continue_implementation, objc_finish_implementation, objc_set_visibility, objc_set_method_type, objc_build_method_signature, objc_add_method_declaration, objc_start_method_definition, objc_add_instance_variable, objc_get_protocol_qualified_type, create_field_decl, start_var_decl, finish_var_decl): New functions. (setup_string_decl): Simplify since it is only called once. (synth_module_prologue): Call build_class_template(); predefine 'id' and 'Class' as typedefs; rename 'temp_type' to 'type'; disable debug hooks for duration of function; fix GNU runtime messenger signatures to correspond to reality; forward-declare '__objc_exec_class' for the GNU runtime; call build_selector_table_decl(); in ObjC++ mode, generate 'extern "C" { ... }' wrappers around synthesized declarations; call build_protocol_template() and build_category_template(). (string_hash, string_eq): New functions. (objc_build_string_object): Check metaclass correctness only once; store string literals in hash table. (objc_build_constructor): Do not convert initializer elements; adjust for ObjC++ impedance mismatch. (build_objc_symtab_template): Call create_field_decl() instead of create_builtin_decl(). (init_objc_symtab): Add missing conversion to initializer element. (build_metadata_decl): Call start_var_decl() instead of define_decl(). (generate_objc_symtab_decl): Do not call build_category_template(); call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(). (build_module_descriptor): Call create_field_decl() instead of grokfield(); call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(); always mark module descriptor as used; move GNU runtime-specific functionality to build_module_initializer_routine(). (build_module_initializer_routine): New function, broken off of build_module_descriptor(). (objc_static_init_needed_p, objc_generate_static_init_call): New functions. (generate_static_references, generate_strings, build_selector_translation_table, generate_descriptor_table, generate_ivars_list, generate_dispatch_table, generate_category): Call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(); build a type directly instead of via groktypename(). (build_selector_reference_decl, build_selector_table_decl, build_class_reference_decl, build_protocol_reference, generate_objc_image_info): Call start_var_decl() instead of build_decl(). (build_selector_reference): For GNU runtime, do not call build_selector_reference_decl(). (build_selector, build_typed_selector_reference): Always convert result to the selector type. (add_objc_string): Cast return value to 'char *'. (build_method_prototype_template, build_selector_template, build_method_template): Use actual selector type for fields pointing to selectors. (finish_objc): For GNU runtime, call build_module_initializer_routine() after build_module_descriptor(). (generate_protocol_list, generate_shared_structures): Call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(); build a type directly instead of via groktypename(). (synth_id_with_class_suffix): Return a string. (get_arg_type_list): For instance methods, use the instance type for 'self'; do not call groktypename_in_parm_context(). (build_objc_string_decl): Squash redeclaration errors in ObjC++. (objc_is_class_name): Use OBJC_TYPE_NAME instead of TYPE_NAME; handle RECORD_TYPEs in ObjC as well as ObjC++. (objc_is_id): New function. (objc_is_object_ptr): Return the canonical type node. (objc_get_class_ivars): Simplify using get_class_ivars(). (get_class_ivars): Remove second parameter; create a fresh copy of the ivar list for each call; do not check for existence of super class. (objc_eh_runtime_type): Mark #ifndef OBJCPLUS. (objc_init_exceptions): When using SJLJ-style exceptions, require the use of '-fobjc-exceptions' flag; do not require it for DWARF-style exceptions. (objc_build_exc_ptr, next_sjlj_build_try_catch_finally): Use objc_object_type instead of objc_id_type. (objc_begin_catch_clause): Convert the incoming PARM_DECL into a VAR_DECL before placing it in the appropriate scope; do not call define_decl(); adjust call to c_begin_compound_stmt(); use objc_object_type instead of objc_id_type. (build_next_objc_exception_stuff): Call create_field_decl() instead of create_builtin_decl(); construct type directly instead of calling groktypename(); use OBJC_VOID_AT_END to mark end of function parameters. (build_private_template): Adjust call to get_class_ivars(); build a type directly instead of via groktypename(). (build_protocol_template, build_method_prototype_list_template, build_method_prototype_template, build_category_template, build_selector_template, build_class_template, build_super_template, build_ivar_template, build_ivar_list_template, build_method_list_template, build_method_template): Call create_field_decl() instead of grokfield(). (objc_method_parm_type): Do not call groktypename(). (generate_descriptor_table): Call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(). (generate_method_descriptors, build_protocol_initializer, generate_dispatch_tables, build_category_initializer, build_shared_structure_initializer): Do not call groktypename(). (generate_protocols): Call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(); do not call groktypename(). (error_with_ivar): Remove last parameter. (check_ivars): Do not iterate ovar CLASS_RAW_IVARS lists in addition to CLASS_IVARS lists; adjust calls to error_with_ivar(). (generate_ivar_lists): Convert one of the initializer elements; do not call groktypename(). (get_arg_type_list, start_method_def, gen_method_def): Account for new representation of variable arguments and '...' in Objective-C methods; add Objective-C++ impedance matching code. (is_objc_type_qualifier): Remove function. (adjust_type_for_id_default): Simplify; there is no longer a need to wade through declspecs. (lookup_interface, start_class, continue_class, finish_class, start_method_def, start_protocol, build_method_decl, objc_add_method, add_instance_variable, build_ivar_reference, is_ivar, is_private, get_super_receiver, objc_build_finally_epilogue): Make into static functions. (receiver_is_class_object): Use new IS_CLASS() macro. (objc_build_message_expr): Tweak ObjC++ message argument handling; call objc_finish_message_expr() instead of finish_message_expr(). (finish_message_expr): Rename to objc_finish_message_expr(); use OBJC_TYPE_NAME and OBJC_SET_TYPE_NAME macros instead of TYPE_NAME. call gen_type_name() instead of gen_declaration(); call objc_is_id() instead of using IS_ID and IS_CLASS; Use objc_class_name instead of calling get_identifier("Class"); handle CONVERT_EXPRs in receiver. (build_objc_method_call, warn_with_method): Do not call groktypename(). (build_ivar_reference): Call convert() instead of clobbering in a type. (hash_init): Initialize string_htab hash table. (add_instance_variable): Simplify parameter list; do not call grokfield(); do not populate CLASS_IVARS list. (start_class): Check for the existence of super class, if one was specified. (continue_class): Use CLASS_RAW_IVARS rather than CLASS_IVARS; do not call build_class_template(); adjust call to get_class_ivars(); call build_decl(), pushdecl() and finish_decl() instead of define_decl(). (finish_class): Call build_decl(), pushdecl() and finish_decl() instead of define_decl(). (add_protocols): Use PROTOCOL_BINFO_ELTS for the tree vector size. (start_protocol): Do not call build_protocol_template(); use PROTOCOL_BINFO_ELTS for the tree vector size. (encode_type_qualifiers): Do not handle the 'const' qualifier here. (encode_pointer): Encode 'const char *' as 'r*', for backwards compatibility. (encode_array): Use HOST_WIDE_INT_PRINT_DEC instead of "%ld". (encode_type): Handle the 'const' qualifier here. (objc_parmlist): New global variable, sued by objc_push_parm and objc_get_parm_info(). (objc_push_parm, objc_get_parm_info): New functions. (objc_expr_last): Remove function. (synth_self_and_ucmd_args): For instance methods, use the instance type for 'self'; call objc_push_parm() instead of push_parm_decl(). (start_method_def): Do not call push_scope(), declare_parm_level(), pop_scope(), push_parm_decl(), store_parm_decls() or objc_expr_last(); just use objc_push_parm() and objc_get_parm_info(). (comp_method_with_proto): Remove function. (objc_types_are_equivalent): Strip away indirections before comparing underlying types. (comp_proto_with_proto): Do not call groktypename(); types are no longer in raw declspec format. (objc_start_function): New function. (really_start_method): Call comp_proto_with_proto() instead of comp_method_with_proto(); call objc_start_function() instead of hand-crafting a function declarator. (continue_method_def, objc_expand_function_end): Remove functions. (get_super_receiver): Call objc_get_current_scope() instead of get_current_scope(); reference 'super_class' field (instead of 'class'). (finish_method_def): Rename to objc_finish_method_definition() and add a function decl parameter; move method encoding call from objc_expand_function_end(). (is_complex_decl, adorn_decl, gen_declarator, gen_declspecs, gen_declaration_1): Remove functions. (tmpbuf, RAW_DECLSPEC): Remove. (gen_declaration): Remove second parameter; simplify to deal with TYPE_P nodes instead of raw declspecs. (gen_type_name, gen_type_name_0): New functions. (gen_method_decl): Remove second parameter; call gen_type_name() instead of gen_declaration_1(). (dump_interface): Adjust calls to gen_declaration() and gen_method_decl(); do not allocate a separate string buffer. (init_objc): Allocate a larger string buffer to accommodate dump_interface(); adjust call to build_module_descriptor(); add call to build_module_initializer_routine() for the GNU runtime. (generate_classref_translation_entry): Do not call start_decl(); call finish_var_decl() instead of finish_decl(); call convert() instead of build_c_cast(). * objc-act.h (CLASS_OWN_IVARS): Remove accessor. (CLASS_BINFO_ELTS): Reduce from 6 to 5, now that CLASS_OWN_IVARS is gone. (OCTI_GNU_INIT_DECL, GNU_INIT_decl): New. (OCTI_ELLIPSIS_NODE, objc_ellipsis_node): Remove. (OCTI_ID_ID, id_type, objc_id_id): Rename to OCTI_ID_NAME, objc_object_type and objc_object_name, respectively. (OCTI_CLS_REF, OCTI_CLASS_NAME, objc_class_reference, objc_class_name): New. (IS_CLASS): New macro. (IS_ID, IS_SUPER): Robustify. (OCTI_EXECCLASS_DECL, execclass_decl): New. (finish_file, start_class, continue_class, finish_class, start_method_def, continue_method_def, finish_method_def, start_protocol, finish_protocol, objc_build_throw_stmt, objc_build_try_catch_finally_stmt, objc_build_synchronized_prologue, objc_build_synchronized_epilogue, objc_build_try_prologue, objc_build_try_epilogue, objc_build_catch_stmt, objc_build_catch_epilogue, objc_build_finally_prologue, objc_build_finally_epilogue, is_ivar, is_private, is_public, add_instance_variable, objc_add_method, get_super_receiver, objc_clear_super_receiver, get_class_ivars_from_name, get_class_reference, get_static_reference, get_object_reference, build_message_expr, finish_message_expr, build_selector_expr, build_ivar_reference, build_keyword_decl, build_method_decl, build_protocol_expr, build_objc_string_object, objc_declare_alias, objc_declare_class, objc_declare_protocols, objc_comptypes, objc_check_decl, build_encode_expr): Remove prototypes. (imp_count, cat_count): Make GGC-aware. (OBJC_SET_TYPE_NAME): New macro. From-SVN: r87168
2004-09-08 02:49:44 +02:00
tree akey;
for (akey = TREE_CHAIN (METHOD_ADD_ARGS (method));
Makefile.in (c-parse.o): Depend on $(C_COMMON_H). [gcc/ChangeLog] 2004-09-07 Ziemowit Laski <zlaski@apple.com> * Makefile.in (c-parse.o): Depend on $(C_COMMON_H). * c-parse.in: Include c-common.h instead of objc-act.h. (ivar_decl_list, ivar_decls, ivar_decl, ivars, ivar_declarator, myparms, myparm): Remove %type declarations. (methodtype, optparms, OBJC_TYPE_QUAL, objc_quals, objc_qual, objc_typename, objc_try_catch_stmt, optellipsis): Add %type declarations. (objc_inherit_code, objc_public_flag): Remove. (typespec_nonreserved_nonattr): Call objc_get_protocol_qualified_type() instead of get_static_reference() and get_protocol_reference(). (stmt_nocomp): Call grokparm() on @catch parameter. (objcdef): Move semantic action to objc_finish_implementation(). (classdef): Move semantic action to objc_start_class_interface(), objc_continue_interface(), objc_finish_interface(), objc_start_class_implementation(), objc_continue_implementation(), objc_start_category_interface() and objc_start_category_implementation(). (protocoldef): Move semantic actions to objc_start_protocol() and objc_finish_interface(). (ivar_decl_list): Remove nonterminal. (visibility_spec): Move semantic actions to objc_set_visibility(). (ivar_decls): Remove assignment to $$. (ivar_decl): Rephrase in terms of component_decl; call objc_add_instance_variable(). (ivars, ivar_declarator): Remove nonterminals. (opt_semi): New nonterminal. (methodtype): Remove semantic actions. (methoddef): Move semantic actions to objc_set_method_type(), objc_start_method_definition() and objc_finish_method_definition(). (methodproto): Move semantic actions to objc_set_method_type() and objc_add_method_declaration(). (methoddecl): Use objc_typename instead of typename; move semantic actions to objc_build_method_signature(). (optarglist, myxdecls, mydecl, myparms, myparm): Remove nonterminals. (optparmlist): Express in terms of optparms and optellipsis. (optparms, optellipsis, objc_qual, objc_quals, objc_typename): New nonterminals. (keyworddecl): Use objc_typename instead of typename. (rid_to_yy): Mark RID_IN, RID_OUT, RID_INOUT, RID_BYCOPY, RID_BYREF and RID_ONEWAY as returning OBJC_TYPE_QUAL to yyparse(). [gcc/objc/ChangeLog] 2004-09-07 Ziemowit Laski <zlaski@apple.com> * Make-lang.in (objc/objc-parse.o): Depend on $(C_COMMON_H) instead of objc/objc-act.h. (objc/objc-act.o): Depend on $(HASHTAB_H). * objc-act.c: Include hashtab.h; in ObjC++ mode, include cp-tree.h and objcp-decl.h instead of c-tree.h. (build_module_descriptor, get_class_ivars, synth_id_with_class_suffix, error_with_ivar, gen_method_decl, gen_declaration, setup_string_decl, build_protocol_template): Adjust prototypes. (build_module_initializer_routine, start_class, continue_class, finish_class, start_method_def, objc_start_function, start_protocol, build_method_decl, objc_add_method, add_instance_variable, build_ivar_reference, is_ivar, is_private, get_super_receiver, build_selector_table_decl, objc_push_parm, objc_get_parm_info, gen_type_name, gen_type_name_0, start_var_decl, finish_var_decl, create_field_decl): New prototypes. (objc_expand_function_end, comp_method_with_proto, objc_expr_last, gen_declaration_1, gen_declarator, is_complex_decl, adorn_decl, define_decl, create_builtin_decl, gen_declspecs): Remove prototypes. (TYPE_ID): Rename to OBJECT_TYPEDEF_NAME. (CLASS_TYPEDEF_NAME): New. (TAG_EXECCLASS): Change from a global variable to a #define. (TAG_RETURN_STRUCT): Delete. (TAG_GNUINIT): New, holds '__objc_gnu_init' name. (objc_inherit_code, objc_public_flag): New, moved from c-parse.in. (string_descriptor): New struct. (string_htab): New hash table. (string_hash, string_eq): New prototypes. (generate_struct_by_value_array): Call create_field_decl() instead of create_builtin_decl(). (objc_init): Do not initialize objc_ellipsis_node or TAG_EXECCLASS; In ObjC++ mode, call cxx_init() instead of c_objc_common_init(). (objc_finish_file): In ObjC++, call instantiate_pending_templates() and cp_finish_file(). (define_decl, get_static_reference, get_protocol_reference, create_builtin_decl): Remove functions. (objc_start_class_interface, objc_start_category_interface, objc_start_protocol, objc_continue_interface, objc_finish_interface, objc_start_class_implementation, objc_start_category_implementation, objc_continue_implementation, objc_finish_implementation, objc_set_visibility, objc_set_method_type, objc_build_method_signature, objc_add_method_declaration, objc_start_method_definition, objc_add_instance_variable, objc_get_protocol_qualified_type, create_field_decl, start_var_decl, finish_var_decl): New functions. (setup_string_decl): Simplify since it is only called once. (synth_module_prologue): Call build_class_template(); predefine 'id' and 'Class' as typedefs; rename 'temp_type' to 'type'; disable debug hooks for duration of function; fix GNU runtime messenger signatures to correspond to reality; forward-declare '__objc_exec_class' for the GNU runtime; call build_selector_table_decl(); in ObjC++ mode, generate 'extern "C" { ... }' wrappers around synthesized declarations; call build_protocol_template() and build_category_template(). (string_hash, string_eq): New functions. (objc_build_string_object): Check metaclass correctness only once; store string literals in hash table. (objc_build_constructor): Do not convert initializer elements; adjust for ObjC++ impedance mismatch. (build_objc_symtab_template): Call create_field_decl() instead of create_builtin_decl(). (init_objc_symtab): Add missing conversion to initializer element. (build_metadata_decl): Call start_var_decl() instead of define_decl(). (generate_objc_symtab_decl): Do not call build_category_template(); call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(). (build_module_descriptor): Call create_field_decl() instead of grokfield(); call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(); always mark module descriptor as used; move GNU runtime-specific functionality to build_module_initializer_routine(). (build_module_initializer_routine): New function, broken off of build_module_descriptor(). (objc_static_init_needed_p, objc_generate_static_init_call): New functions. (generate_static_references, generate_strings, build_selector_translation_table, generate_descriptor_table, generate_ivars_list, generate_dispatch_table, generate_category): Call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(); build a type directly instead of via groktypename(). (build_selector_reference_decl, build_selector_table_decl, build_class_reference_decl, build_protocol_reference, generate_objc_image_info): Call start_var_decl() instead of build_decl(). (build_selector_reference): For GNU runtime, do not call build_selector_reference_decl(). (build_selector, build_typed_selector_reference): Always convert result to the selector type. (add_objc_string): Cast return value to 'char *'. (build_method_prototype_template, build_selector_template, build_method_template): Use actual selector type for fields pointing to selectors. (finish_objc): For GNU runtime, call build_module_initializer_routine() after build_module_descriptor(). (generate_protocol_list, generate_shared_structures): Call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(); build a type directly instead of via groktypename(). (synth_id_with_class_suffix): Return a string. (get_arg_type_list): For instance methods, use the instance type for 'self'; do not call groktypename_in_parm_context(). (build_objc_string_decl): Squash redeclaration errors in ObjC++. (objc_is_class_name): Use OBJC_TYPE_NAME instead of TYPE_NAME; handle RECORD_TYPEs in ObjC as well as ObjC++. (objc_is_id): New function. (objc_is_object_ptr): Return the canonical type node. (objc_get_class_ivars): Simplify using get_class_ivars(). (get_class_ivars): Remove second parameter; create a fresh copy of the ivar list for each call; do not check for existence of super class. (objc_eh_runtime_type): Mark #ifndef OBJCPLUS. (objc_init_exceptions): When using SJLJ-style exceptions, require the use of '-fobjc-exceptions' flag; do not require it for DWARF-style exceptions. (objc_build_exc_ptr, next_sjlj_build_try_catch_finally): Use objc_object_type instead of objc_id_type. (objc_begin_catch_clause): Convert the incoming PARM_DECL into a VAR_DECL before placing it in the appropriate scope; do not call define_decl(); adjust call to c_begin_compound_stmt(); use objc_object_type instead of objc_id_type. (build_next_objc_exception_stuff): Call create_field_decl() instead of create_builtin_decl(); construct type directly instead of calling groktypename(); use OBJC_VOID_AT_END to mark end of function parameters. (build_private_template): Adjust call to get_class_ivars(); build a type directly instead of via groktypename(). (build_protocol_template, build_method_prototype_list_template, build_method_prototype_template, build_category_template, build_selector_template, build_class_template, build_super_template, build_ivar_template, build_ivar_list_template, build_method_list_template, build_method_template): Call create_field_decl() instead of grokfield(). (objc_method_parm_type): Do not call groktypename(). (generate_descriptor_table): Call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(). (generate_method_descriptors, build_protocol_initializer, generate_dispatch_tables, build_category_initializer, build_shared_structure_initializer): Do not call groktypename(). (generate_protocols): Call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(); do not call groktypename(). (error_with_ivar): Remove last parameter. (check_ivars): Do not iterate ovar CLASS_RAW_IVARS lists in addition to CLASS_IVARS lists; adjust calls to error_with_ivar(). (generate_ivar_lists): Convert one of the initializer elements; do not call groktypename(). (get_arg_type_list, start_method_def, gen_method_def): Account for new representation of variable arguments and '...' in Objective-C methods; add Objective-C++ impedance matching code. (is_objc_type_qualifier): Remove function. (adjust_type_for_id_default): Simplify; there is no longer a need to wade through declspecs. (lookup_interface, start_class, continue_class, finish_class, start_method_def, start_protocol, build_method_decl, objc_add_method, add_instance_variable, build_ivar_reference, is_ivar, is_private, get_super_receiver, objc_build_finally_epilogue): Make into static functions. (receiver_is_class_object): Use new IS_CLASS() macro. (objc_build_message_expr): Tweak ObjC++ message argument handling; call objc_finish_message_expr() instead of finish_message_expr(). (finish_message_expr): Rename to objc_finish_message_expr(); use OBJC_TYPE_NAME and OBJC_SET_TYPE_NAME macros instead of TYPE_NAME. call gen_type_name() instead of gen_declaration(); call objc_is_id() instead of using IS_ID and IS_CLASS; Use objc_class_name instead of calling get_identifier("Class"); handle CONVERT_EXPRs in receiver. (build_objc_method_call, warn_with_method): Do not call groktypename(). (build_ivar_reference): Call convert() instead of clobbering in a type. (hash_init): Initialize string_htab hash table. (add_instance_variable): Simplify parameter list; do not call grokfield(); do not populate CLASS_IVARS list. (start_class): Check for the existence of super class, if one was specified. (continue_class): Use CLASS_RAW_IVARS rather than CLASS_IVARS; do not call build_class_template(); adjust call to get_class_ivars(); call build_decl(), pushdecl() and finish_decl() instead of define_decl(). (finish_class): Call build_decl(), pushdecl() and finish_decl() instead of define_decl(). (add_protocols): Use PROTOCOL_BINFO_ELTS for the tree vector size. (start_protocol): Do not call build_protocol_template(); use PROTOCOL_BINFO_ELTS for the tree vector size. (encode_type_qualifiers): Do not handle the 'const' qualifier here. (encode_pointer): Encode 'const char *' as 'r*', for backwards compatibility. (encode_array): Use HOST_WIDE_INT_PRINT_DEC instead of "%ld". (encode_type): Handle the 'const' qualifier here. (objc_parmlist): New global variable, sued by objc_push_parm and objc_get_parm_info(). (objc_push_parm, objc_get_parm_info): New functions. (objc_expr_last): Remove function. (synth_self_and_ucmd_args): For instance methods, use the instance type for 'self'; call objc_push_parm() instead of push_parm_decl(). (start_method_def): Do not call push_scope(), declare_parm_level(), pop_scope(), push_parm_decl(), store_parm_decls() or objc_expr_last(); just use objc_push_parm() and objc_get_parm_info(). (comp_method_with_proto): Remove function. (objc_types_are_equivalent): Strip away indirections before comparing underlying types. (comp_proto_with_proto): Do not call groktypename(); types are no longer in raw declspec format. (objc_start_function): New function. (really_start_method): Call comp_proto_with_proto() instead of comp_method_with_proto(); call objc_start_function() instead of hand-crafting a function declarator. (continue_method_def, objc_expand_function_end): Remove functions. (get_super_receiver): Call objc_get_current_scope() instead of get_current_scope(); reference 'super_class' field (instead of 'class'). (finish_method_def): Rename to objc_finish_method_definition() and add a function decl parameter; move method encoding call from objc_expand_function_end(). (is_complex_decl, adorn_decl, gen_declarator, gen_declspecs, gen_declaration_1): Remove functions. (tmpbuf, RAW_DECLSPEC): Remove. (gen_declaration): Remove second parameter; simplify to deal with TYPE_P nodes instead of raw declspecs. (gen_type_name, gen_type_name_0): New functions. (gen_method_decl): Remove second parameter; call gen_type_name() instead of gen_declaration_1(). (dump_interface): Adjust calls to gen_declaration() and gen_method_decl(); do not allocate a separate string buffer. (init_objc): Allocate a larger string buffer to accommodate dump_interface(); adjust call to build_module_descriptor(); add call to build_module_initializer_routine() for the GNU runtime. (generate_classref_translation_entry): Do not call start_decl(); call finish_var_decl() instead of finish_decl(); call convert() instead of build_c_cast(). * objc-act.h (CLASS_OWN_IVARS): Remove accessor. (CLASS_BINFO_ELTS): Reduce from 6 to 5, now that CLASS_OWN_IVARS is gone. (OCTI_GNU_INIT_DECL, GNU_INIT_decl): New. (OCTI_ELLIPSIS_NODE, objc_ellipsis_node): Remove. (OCTI_ID_ID, id_type, objc_id_id): Rename to OCTI_ID_NAME, objc_object_type and objc_object_name, respectively. (OCTI_CLS_REF, OCTI_CLASS_NAME, objc_class_reference, objc_class_name): New. (IS_CLASS): New macro. (IS_ID, IS_SUPER): Robustify. (OCTI_EXECCLASS_DECL, execclass_decl): New. (finish_file, start_class, continue_class, finish_class, start_method_def, continue_method_def, finish_method_def, start_protocol, finish_protocol, objc_build_throw_stmt, objc_build_try_catch_finally_stmt, objc_build_synchronized_prologue, objc_build_synchronized_epilogue, objc_build_try_prologue, objc_build_try_epilogue, objc_build_catch_stmt, objc_build_catch_epilogue, objc_build_finally_prologue, objc_build_finally_epilogue, is_ivar, is_private, is_public, add_instance_variable, objc_add_method, get_super_receiver, objc_clear_super_receiver, get_class_ivars_from_name, get_class_reference, get_static_reference, get_object_reference, build_message_expr, finish_message_expr, build_selector_expr, build_ivar_reference, build_keyword_decl, build_method_decl, build_protocol_expr, build_objc_string_object, objc_declare_alias, objc_declare_class, objc_declare_protocols, objc_comptypes, objc_check_decl, build_encode_expr): Remove prototypes. (imp_count, cat_count): Make GGC-aware. (OBJC_SET_TYPE_NAME): New macro. From-SVN: r87168
2004-09-08 02:49:44 +02:00
akey; akey = TREE_CHAIN (akey))
1992-01-18 00:15:38 +01:00
{
Makefile.in (c-parse.o): Depend on $(C_COMMON_H). [gcc/ChangeLog] 2004-09-07 Ziemowit Laski <zlaski@apple.com> * Makefile.in (c-parse.o): Depend on $(C_COMMON_H). * c-parse.in: Include c-common.h instead of objc-act.h. (ivar_decl_list, ivar_decls, ivar_decl, ivars, ivar_declarator, myparms, myparm): Remove %type declarations. (methodtype, optparms, OBJC_TYPE_QUAL, objc_quals, objc_qual, objc_typename, objc_try_catch_stmt, optellipsis): Add %type declarations. (objc_inherit_code, objc_public_flag): Remove. (typespec_nonreserved_nonattr): Call objc_get_protocol_qualified_type() instead of get_static_reference() and get_protocol_reference(). (stmt_nocomp): Call grokparm() on @catch parameter. (objcdef): Move semantic action to objc_finish_implementation(). (classdef): Move semantic action to objc_start_class_interface(), objc_continue_interface(), objc_finish_interface(), objc_start_class_implementation(), objc_continue_implementation(), objc_start_category_interface() and objc_start_category_implementation(). (protocoldef): Move semantic actions to objc_start_protocol() and objc_finish_interface(). (ivar_decl_list): Remove nonterminal. (visibility_spec): Move semantic actions to objc_set_visibility(). (ivar_decls): Remove assignment to $$. (ivar_decl): Rephrase in terms of component_decl; call objc_add_instance_variable(). (ivars, ivar_declarator): Remove nonterminals. (opt_semi): New nonterminal. (methodtype): Remove semantic actions. (methoddef): Move semantic actions to objc_set_method_type(), objc_start_method_definition() and objc_finish_method_definition(). (methodproto): Move semantic actions to objc_set_method_type() and objc_add_method_declaration(). (methoddecl): Use objc_typename instead of typename; move semantic actions to objc_build_method_signature(). (optarglist, myxdecls, mydecl, myparms, myparm): Remove nonterminals. (optparmlist): Express in terms of optparms and optellipsis. (optparms, optellipsis, objc_qual, objc_quals, objc_typename): New nonterminals. (keyworddecl): Use objc_typename instead of typename. (rid_to_yy): Mark RID_IN, RID_OUT, RID_INOUT, RID_BYCOPY, RID_BYREF and RID_ONEWAY as returning OBJC_TYPE_QUAL to yyparse(). [gcc/objc/ChangeLog] 2004-09-07 Ziemowit Laski <zlaski@apple.com> * Make-lang.in (objc/objc-parse.o): Depend on $(C_COMMON_H) instead of objc/objc-act.h. (objc/objc-act.o): Depend on $(HASHTAB_H). * objc-act.c: Include hashtab.h; in ObjC++ mode, include cp-tree.h and objcp-decl.h instead of c-tree.h. (build_module_descriptor, get_class_ivars, synth_id_with_class_suffix, error_with_ivar, gen_method_decl, gen_declaration, setup_string_decl, build_protocol_template): Adjust prototypes. (build_module_initializer_routine, start_class, continue_class, finish_class, start_method_def, objc_start_function, start_protocol, build_method_decl, objc_add_method, add_instance_variable, build_ivar_reference, is_ivar, is_private, get_super_receiver, build_selector_table_decl, objc_push_parm, objc_get_parm_info, gen_type_name, gen_type_name_0, start_var_decl, finish_var_decl, create_field_decl): New prototypes. (objc_expand_function_end, comp_method_with_proto, objc_expr_last, gen_declaration_1, gen_declarator, is_complex_decl, adorn_decl, define_decl, create_builtin_decl, gen_declspecs): Remove prototypes. (TYPE_ID): Rename to OBJECT_TYPEDEF_NAME. (CLASS_TYPEDEF_NAME): New. (TAG_EXECCLASS): Change from a global variable to a #define. (TAG_RETURN_STRUCT): Delete. (TAG_GNUINIT): New, holds '__objc_gnu_init' name. (objc_inherit_code, objc_public_flag): New, moved from c-parse.in. (string_descriptor): New struct. (string_htab): New hash table. (string_hash, string_eq): New prototypes. (generate_struct_by_value_array): Call create_field_decl() instead of create_builtin_decl(). (objc_init): Do not initialize objc_ellipsis_node or TAG_EXECCLASS; In ObjC++ mode, call cxx_init() instead of c_objc_common_init(). (objc_finish_file): In ObjC++, call instantiate_pending_templates() and cp_finish_file(). (define_decl, get_static_reference, get_protocol_reference, create_builtin_decl): Remove functions. (objc_start_class_interface, objc_start_category_interface, objc_start_protocol, objc_continue_interface, objc_finish_interface, objc_start_class_implementation, objc_start_category_implementation, objc_continue_implementation, objc_finish_implementation, objc_set_visibility, objc_set_method_type, objc_build_method_signature, objc_add_method_declaration, objc_start_method_definition, objc_add_instance_variable, objc_get_protocol_qualified_type, create_field_decl, start_var_decl, finish_var_decl): New functions. (setup_string_decl): Simplify since it is only called once. (synth_module_prologue): Call build_class_template(); predefine 'id' and 'Class' as typedefs; rename 'temp_type' to 'type'; disable debug hooks for duration of function; fix GNU runtime messenger signatures to correspond to reality; forward-declare '__objc_exec_class' for the GNU runtime; call build_selector_table_decl(); in ObjC++ mode, generate 'extern "C" { ... }' wrappers around synthesized declarations; call build_protocol_template() and build_category_template(). (string_hash, string_eq): New functions. (objc_build_string_object): Check metaclass correctness only once; store string literals in hash table. (objc_build_constructor): Do not convert initializer elements; adjust for ObjC++ impedance mismatch. (build_objc_symtab_template): Call create_field_decl() instead of create_builtin_decl(). (init_objc_symtab): Add missing conversion to initializer element. (build_metadata_decl): Call start_var_decl() instead of define_decl(). (generate_objc_symtab_decl): Do not call build_category_template(); call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(). (build_module_descriptor): Call create_field_decl() instead of grokfield(); call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(); always mark module descriptor as used; move GNU runtime-specific functionality to build_module_initializer_routine(). (build_module_initializer_routine): New function, broken off of build_module_descriptor(). (objc_static_init_needed_p, objc_generate_static_init_call): New functions. (generate_static_references, generate_strings, build_selector_translation_table, generate_descriptor_table, generate_ivars_list, generate_dispatch_table, generate_category): Call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(); build a type directly instead of via groktypename(). (build_selector_reference_decl, build_selector_table_decl, build_class_reference_decl, build_protocol_reference, generate_objc_image_info): Call start_var_decl() instead of build_decl(). (build_selector_reference): For GNU runtime, do not call build_selector_reference_decl(). (build_selector, build_typed_selector_reference): Always convert result to the selector type. (add_objc_string): Cast return value to 'char *'. (build_method_prototype_template, build_selector_template, build_method_template): Use actual selector type for fields pointing to selectors. (finish_objc): For GNU runtime, call build_module_initializer_routine() after build_module_descriptor(). (generate_protocol_list, generate_shared_structures): Call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(); build a type directly instead of via groktypename(). (synth_id_with_class_suffix): Return a string. (get_arg_type_list): For instance methods, use the instance type for 'self'; do not call groktypename_in_parm_context(). (build_objc_string_decl): Squash redeclaration errors in ObjC++. (objc_is_class_name): Use OBJC_TYPE_NAME instead of TYPE_NAME; handle RECORD_TYPEs in ObjC as well as ObjC++. (objc_is_id): New function. (objc_is_object_ptr): Return the canonical type node. (objc_get_class_ivars): Simplify using get_class_ivars(). (get_class_ivars): Remove second parameter; create a fresh copy of the ivar list for each call; do not check for existence of super class. (objc_eh_runtime_type): Mark #ifndef OBJCPLUS. (objc_init_exceptions): When using SJLJ-style exceptions, require the use of '-fobjc-exceptions' flag; do not require it for DWARF-style exceptions. (objc_build_exc_ptr, next_sjlj_build_try_catch_finally): Use objc_object_type instead of objc_id_type. (objc_begin_catch_clause): Convert the incoming PARM_DECL into a VAR_DECL before placing it in the appropriate scope; do not call define_decl(); adjust call to c_begin_compound_stmt(); use objc_object_type instead of objc_id_type. (build_next_objc_exception_stuff): Call create_field_decl() instead of create_builtin_decl(); construct type directly instead of calling groktypename(); use OBJC_VOID_AT_END to mark end of function parameters. (build_private_template): Adjust call to get_class_ivars(); build a type directly instead of via groktypename(). (build_protocol_template, build_method_prototype_list_template, build_method_prototype_template, build_category_template, build_selector_template, build_class_template, build_super_template, build_ivar_template, build_ivar_list_template, build_method_list_template, build_method_template): Call create_field_decl() instead of grokfield(). (objc_method_parm_type): Do not call groktypename(). (generate_descriptor_table): Call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(). (generate_method_descriptors, build_protocol_initializer, generate_dispatch_tables, build_category_initializer, build_shared_structure_initializer): Do not call groktypename(). (generate_protocols): Call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(); do not call groktypename(). (error_with_ivar): Remove last parameter. (check_ivars): Do not iterate ovar CLASS_RAW_IVARS lists in addition to CLASS_IVARS lists; adjust calls to error_with_ivar(). (generate_ivar_lists): Convert one of the initializer elements; do not call groktypename(). (get_arg_type_list, start_method_def, gen_method_def): Account for new representation of variable arguments and '...' in Objective-C methods; add Objective-C++ impedance matching code. (is_objc_type_qualifier): Remove function. (adjust_type_for_id_default): Simplify; there is no longer a need to wade through declspecs. (lookup_interface, start_class, continue_class, finish_class, start_method_def, start_protocol, build_method_decl, objc_add_method, add_instance_variable, build_ivar_reference, is_ivar, is_private, get_super_receiver, objc_build_finally_epilogue): Make into static functions. (receiver_is_class_object): Use new IS_CLASS() macro. (objc_build_message_expr): Tweak ObjC++ message argument handling; call objc_finish_message_expr() instead of finish_message_expr(). (finish_message_expr): Rename to objc_finish_message_expr(); use OBJC_TYPE_NAME and OBJC_SET_TYPE_NAME macros instead of TYPE_NAME. call gen_type_name() instead of gen_declaration(); call objc_is_id() instead of using IS_ID and IS_CLASS; Use objc_class_name instead of calling get_identifier("Class"); handle CONVERT_EXPRs in receiver. (build_objc_method_call, warn_with_method): Do not call groktypename(). (build_ivar_reference): Call convert() instead of clobbering in a type. (hash_init): Initialize string_htab hash table. (add_instance_variable): Simplify parameter list; do not call grokfield(); do not populate CLASS_IVARS list. (start_class): Check for the existence of super class, if one was specified. (continue_class): Use CLASS_RAW_IVARS rather than CLASS_IVARS; do not call build_class_template(); adjust call to get_class_ivars(); call build_decl(), pushdecl() and finish_decl() instead of define_decl(). (finish_class): Call build_decl(), pushdecl() and finish_decl() instead of define_decl(). (add_protocols): Use PROTOCOL_BINFO_ELTS for the tree vector size. (start_protocol): Do not call build_protocol_template(); use PROTOCOL_BINFO_ELTS for the tree vector size. (encode_type_qualifiers): Do not handle the 'const' qualifier here. (encode_pointer): Encode 'const char *' as 'r*', for backwards compatibility. (encode_array): Use HOST_WIDE_INT_PRINT_DEC instead of "%ld". (encode_type): Handle the 'const' qualifier here. (objc_parmlist): New global variable, sued by objc_push_parm and objc_get_parm_info(). (objc_push_parm, objc_get_parm_info): New functions. (objc_expr_last): Remove function. (synth_self_and_ucmd_args): For instance methods, use the instance type for 'self'; call objc_push_parm() instead of push_parm_decl(). (start_method_def): Do not call push_scope(), declare_parm_level(), pop_scope(), push_parm_decl(), store_parm_decls() or objc_expr_last(); just use objc_push_parm() and objc_get_parm_info(). (comp_method_with_proto): Remove function. (objc_types_are_equivalent): Strip away indirections before comparing underlying types. (comp_proto_with_proto): Do not call groktypename(); types are no longer in raw declspec format. (objc_start_function): New function. (really_start_method): Call comp_proto_with_proto() instead of comp_method_with_proto(); call objc_start_function() instead of hand-crafting a function declarator. (continue_method_def, objc_expand_function_end): Remove functions. (get_super_receiver): Call objc_get_current_scope() instead of get_current_scope(); reference 'super_class' field (instead of 'class'). (finish_method_def): Rename to objc_finish_method_definition() and add a function decl parameter; move method encoding call from objc_expand_function_end(). (is_complex_decl, adorn_decl, gen_declarator, gen_declspecs, gen_declaration_1): Remove functions. (tmpbuf, RAW_DECLSPEC): Remove. (gen_declaration): Remove second parameter; simplify to deal with TYPE_P nodes instead of raw declspecs. (gen_type_name, gen_type_name_0): New functions. (gen_method_decl): Remove second parameter; call gen_type_name() instead of gen_declaration_1(). (dump_interface): Adjust calls to gen_declaration() and gen_method_decl(); do not allocate a separate string buffer. (init_objc): Allocate a larger string buffer to accommodate dump_interface(); adjust call to build_module_descriptor(); add call to build_module_initializer_routine() for the GNU runtime. (generate_classref_translation_entry): Do not call start_decl(); call finish_var_decl() instead of finish_decl(); call convert() instead of build_c_cast(). * objc-act.h (CLASS_OWN_IVARS): Remove accessor. (CLASS_BINFO_ELTS): Reduce from 6 to 5, now that CLASS_OWN_IVARS is gone. (OCTI_GNU_INIT_DECL, GNU_INIT_decl): New. (OCTI_ELLIPSIS_NODE, objc_ellipsis_node): Remove. (OCTI_ID_ID, id_type, objc_id_id): Rename to OCTI_ID_NAME, objc_object_type and objc_object_name, respectively. (OCTI_CLS_REF, OCTI_CLASS_NAME, objc_class_reference, objc_class_name): New. (IS_CLASS): New macro. (IS_ID, IS_SUPER): Robustify. (OCTI_EXECCLASS_DECL, execclass_decl): New. (finish_file, start_class, continue_class, finish_class, start_method_def, continue_method_def, finish_method_def, start_protocol, finish_protocol, objc_build_throw_stmt, objc_build_try_catch_finally_stmt, objc_build_synchronized_prologue, objc_build_synchronized_epilogue, objc_build_try_prologue, objc_build_try_epilogue, objc_build_catch_stmt, objc_build_catch_epilogue, objc_build_finally_prologue, objc_build_finally_epilogue, is_ivar, is_private, is_public, add_instance_variable, objc_add_method, get_super_receiver, objc_clear_super_receiver, get_class_ivars_from_name, get_class_reference, get_static_reference, get_object_reference, build_message_expr, finish_message_expr, build_selector_expr, build_ivar_reference, build_keyword_decl, build_method_decl, build_protocol_expr, build_objc_string_object, objc_declare_alias, objc_declare_class, objc_declare_protocols, objc_comptypes, objc_check_decl, build_encode_expr): Remove prototypes. (imp_count, cat_count): Make GGC-aware. (OBJC_SET_TYPE_NAME): New macro. From-SVN: r87168
2004-09-08 02:49:44 +02:00
objc_push_parm (TREE_VALUE (akey));
1992-01-18 00:15:38 +01:00
}
Makefile.in (c-parse.o): Depend on $(C_COMMON_H). [gcc/ChangeLog] 2004-09-07 Ziemowit Laski <zlaski@apple.com> * Makefile.in (c-parse.o): Depend on $(C_COMMON_H). * c-parse.in: Include c-common.h instead of objc-act.h. (ivar_decl_list, ivar_decls, ivar_decl, ivars, ivar_declarator, myparms, myparm): Remove %type declarations. (methodtype, optparms, OBJC_TYPE_QUAL, objc_quals, objc_qual, objc_typename, objc_try_catch_stmt, optellipsis): Add %type declarations. (objc_inherit_code, objc_public_flag): Remove. (typespec_nonreserved_nonattr): Call objc_get_protocol_qualified_type() instead of get_static_reference() and get_protocol_reference(). (stmt_nocomp): Call grokparm() on @catch parameter. (objcdef): Move semantic action to objc_finish_implementation(). (classdef): Move semantic action to objc_start_class_interface(), objc_continue_interface(), objc_finish_interface(), objc_start_class_implementation(), objc_continue_implementation(), objc_start_category_interface() and objc_start_category_implementation(). (protocoldef): Move semantic actions to objc_start_protocol() and objc_finish_interface(). (ivar_decl_list): Remove nonterminal. (visibility_spec): Move semantic actions to objc_set_visibility(). (ivar_decls): Remove assignment to $$. (ivar_decl): Rephrase in terms of component_decl; call objc_add_instance_variable(). (ivars, ivar_declarator): Remove nonterminals. (opt_semi): New nonterminal. (methodtype): Remove semantic actions. (methoddef): Move semantic actions to objc_set_method_type(), objc_start_method_definition() and objc_finish_method_definition(). (methodproto): Move semantic actions to objc_set_method_type() and objc_add_method_declaration(). (methoddecl): Use objc_typename instead of typename; move semantic actions to objc_build_method_signature(). (optarglist, myxdecls, mydecl, myparms, myparm): Remove nonterminals. (optparmlist): Express in terms of optparms and optellipsis. (optparms, optellipsis, objc_qual, objc_quals, objc_typename): New nonterminals. (keyworddecl): Use objc_typename instead of typename. (rid_to_yy): Mark RID_IN, RID_OUT, RID_INOUT, RID_BYCOPY, RID_BYREF and RID_ONEWAY as returning OBJC_TYPE_QUAL to yyparse(). [gcc/objc/ChangeLog] 2004-09-07 Ziemowit Laski <zlaski@apple.com> * Make-lang.in (objc/objc-parse.o): Depend on $(C_COMMON_H) instead of objc/objc-act.h. (objc/objc-act.o): Depend on $(HASHTAB_H). * objc-act.c: Include hashtab.h; in ObjC++ mode, include cp-tree.h and objcp-decl.h instead of c-tree.h. (build_module_descriptor, get_class_ivars, synth_id_with_class_suffix, error_with_ivar, gen_method_decl, gen_declaration, setup_string_decl, build_protocol_template): Adjust prototypes. (build_module_initializer_routine, start_class, continue_class, finish_class, start_method_def, objc_start_function, start_protocol, build_method_decl, objc_add_method, add_instance_variable, build_ivar_reference, is_ivar, is_private, get_super_receiver, build_selector_table_decl, objc_push_parm, objc_get_parm_info, gen_type_name, gen_type_name_0, start_var_decl, finish_var_decl, create_field_decl): New prototypes. (objc_expand_function_end, comp_method_with_proto, objc_expr_last, gen_declaration_1, gen_declarator, is_complex_decl, adorn_decl, define_decl, create_builtin_decl, gen_declspecs): Remove prototypes. (TYPE_ID): Rename to OBJECT_TYPEDEF_NAME. (CLASS_TYPEDEF_NAME): New. (TAG_EXECCLASS): Change from a global variable to a #define. (TAG_RETURN_STRUCT): Delete. (TAG_GNUINIT): New, holds '__objc_gnu_init' name. (objc_inherit_code, objc_public_flag): New, moved from c-parse.in. (string_descriptor): New struct. (string_htab): New hash table. (string_hash, string_eq): New prototypes. (generate_struct_by_value_array): Call create_field_decl() instead of create_builtin_decl(). (objc_init): Do not initialize objc_ellipsis_node or TAG_EXECCLASS; In ObjC++ mode, call cxx_init() instead of c_objc_common_init(). (objc_finish_file): In ObjC++, call instantiate_pending_templates() and cp_finish_file(). (define_decl, get_static_reference, get_protocol_reference, create_builtin_decl): Remove functions. (objc_start_class_interface, objc_start_category_interface, objc_start_protocol, objc_continue_interface, objc_finish_interface, objc_start_class_implementation, objc_start_category_implementation, objc_continue_implementation, objc_finish_implementation, objc_set_visibility, objc_set_method_type, objc_build_method_signature, objc_add_method_declaration, objc_start_method_definition, objc_add_instance_variable, objc_get_protocol_qualified_type, create_field_decl, start_var_decl, finish_var_decl): New functions. (setup_string_decl): Simplify since it is only called once. (synth_module_prologue): Call build_class_template(); predefine 'id' and 'Class' as typedefs; rename 'temp_type' to 'type'; disable debug hooks for duration of function; fix GNU runtime messenger signatures to correspond to reality; forward-declare '__objc_exec_class' for the GNU runtime; call build_selector_table_decl(); in ObjC++ mode, generate 'extern "C" { ... }' wrappers around synthesized declarations; call build_protocol_template() and build_category_template(). (string_hash, string_eq): New functions. (objc_build_string_object): Check metaclass correctness only once; store string literals in hash table. (objc_build_constructor): Do not convert initializer elements; adjust for ObjC++ impedance mismatch. (build_objc_symtab_template): Call create_field_decl() instead of create_builtin_decl(). (init_objc_symtab): Add missing conversion to initializer element. (build_metadata_decl): Call start_var_decl() instead of define_decl(). (generate_objc_symtab_decl): Do not call build_category_template(); call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(). (build_module_descriptor): Call create_field_decl() instead of grokfield(); call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(); always mark module descriptor as used; move GNU runtime-specific functionality to build_module_initializer_routine(). (build_module_initializer_routine): New function, broken off of build_module_descriptor(). (objc_static_init_needed_p, objc_generate_static_init_call): New functions. (generate_static_references, generate_strings, build_selector_translation_table, generate_descriptor_table, generate_ivars_list, generate_dispatch_table, generate_category): Call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(); build a type directly instead of via groktypename(). (build_selector_reference_decl, build_selector_table_decl, build_class_reference_decl, build_protocol_reference, generate_objc_image_info): Call start_var_decl() instead of build_decl(). (build_selector_reference): For GNU runtime, do not call build_selector_reference_decl(). (build_selector, build_typed_selector_reference): Always convert result to the selector type. (add_objc_string): Cast return value to 'char *'. (build_method_prototype_template, build_selector_template, build_method_template): Use actual selector type for fields pointing to selectors. (finish_objc): For GNU runtime, call build_module_initializer_routine() after build_module_descriptor(). (generate_protocol_list, generate_shared_structures): Call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(); build a type directly instead of via groktypename(). (synth_id_with_class_suffix): Return a string. (get_arg_type_list): For instance methods, use the instance type for 'self'; do not call groktypename_in_parm_context(). (build_objc_string_decl): Squash redeclaration errors in ObjC++. (objc_is_class_name): Use OBJC_TYPE_NAME instead of TYPE_NAME; handle RECORD_TYPEs in ObjC as well as ObjC++. (objc_is_id): New function. (objc_is_object_ptr): Return the canonical type node. (objc_get_class_ivars): Simplify using get_class_ivars(). (get_class_ivars): Remove second parameter; create a fresh copy of the ivar list for each call; do not check for existence of super class. (objc_eh_runtime_type): Mark #ifndef OBJCPLUS. (objc_init_exceptions): When using SJLJ-style exceptions, require the use of '-fobjc-exceptions' flag; do not require it for DWARF-style exceptions. (objc_build_exc_ptr, next_sjlj_build_try_catch_finally): Use objc_object_type instead of objc_id_type. (objc_begin_catch_clause): Convert the incoming PARM_DECL into a VAR_DECL before placing it in the appropriate scope; do not call define_decl(); adjust call to c_begin_compound_stmt(); use objc_object_type instead of objc_id_type. (build_next_objc_exception_stuff): Call create_field_decl() instead of create_builtin_decl(); construct type directly instead of calling groktypename(); use OBJC_VOID_AT_END to mark end of function parameters. (build_private_template): Adjust call to get_class_ivars(); build a type directly instead of via groktypename(). (build_protocol_template, build_method_prototype_list_template, build_method_prototype_template, build_category_template, build_selector_template, build_class_template, build_super_template, build_ivar_template, build_ivar_list_template, build_method_list_template, build_method_template): Call create_field_decl() instead of grokfield(). (objc_method_parm_type): Do not call groktypename(). (generate_descriptor_table): Call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(). (generate_method_descriptors, build_protocol_initializer, generate_dispatch_tables, build_category_initializer, build_shared_structure_initializer): Do not call groktypename(). (generate_protocols): Call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(); do not call groktypename(). (error_with_ivar): Remove last parameter. (check_ivars): Do not iterate ovar CLASS_RAW_IVARS lists in addition to CLASS_IVARS lists; adjust calls to error_with_ivar(). (generate_ivar_lists): Convert one of the initializer elements; do not call groktypename(). (get_arg_type_list, start_method_def, gen_method_def): Account for new representation of variable arguments and '...' in Objective-C methods; add Objective-C++ impedance matching code. (is_objc_type_qualifier): Remove function. (adjust_type_for_id_default): Simplify; there is no longer a need to wade through declspecs. (lookup_interface, start_class, continue_class, finish_class, start_method_def, start_protocol, build_method_decl, objc_add_method, add_instance_variable, build_ivar_reference, is_ivar, is_private, get_super_receiver, objc_build_finally_epilogue): Make into static functions. (receiver_is_class_object): Use new IS_CLASS() macro. (objc_build_message_expr): Tweak ObjC++ message argument handling; call objc_finish_message_expr() instead of finish_message_expr(). (finish_message_expr): Rename to objc_finish_message_expr(); use OBJC_TYPE_NAME and OBJC_SET_TYPE_NAME macros instead of TYPE_NAME. call gen_type_name() instead of gen_declaration(); call objc_is_id() instead of using IS_ID and IS_CLASS; Use objc_class_name instead of calling get_identifier("Class"); handle CONVERT_EXPRs in receiver. (build_objc_method_call, warn_with_method): Do not call groktypename(). (build_ivar_reference): Call convert() instead of clobbering in a type. (hash_init): Initialize string_htab hash table. (add_instance_variable): Simplify parameter list; do not call grokfield(); do not populate CLASS_IVARS list. (start_class): Check for the existence of super class, if one was specified. (continue_class): Use CLASS_RAW_IVARS rather than CLASS_IVARS; do not call build_class_template(); adjust call to get_class_ivars(); call build_decl(), pushdecl() and finish_decl() instead of define_decl(). (finish_class): Call build_decl(), pushdecl() and finish_decl() instead of define_decl(). (add_protocols): Use PROTOCOL_BINFO_ELTS for the tree vector size. (start_protocol): Do not call build_protocol_template(); use PROTOCOL_BINFO_ELTS for the tree vector size. (encode_type_qualifiers): Do not handle the 'const' qualifier here. (encode_pointer): Encode 'const char *' as 'r*', for backwards compatibility. (encode_array): Use HOST_WIDE_INT_PRINT_DEC instead of "%ld". (encode_type): Handle the 'const' qualifier here. (objc_parmlist): New global variable, sued by objc_push_parm and objc_get_parm_info(). (objc_push_parm, objc_get_parm_info): New functions. (objc_expr_last): Remove function. (synth_self_and_ucmd_args): For instance methods, use the instance type for 'self'; call objc_push_parm() instead of push_parm_decl(). (start_method_def): Do not call push_scope(), declare_parm_level(), pop_scope(), push_parm_decl(), store_parm_decls() or objc_expr_last(); just use objc_push_parm() and objc_get_parm_info(). (comp_method_with_proto): Remove function. (objc_types_are_equivalent): Strip away indirections before comparing underlying types. (comp_proto_with_proto): Do not call groktypename(); types are no longer in raw declspec format. (objc_start_function): New function. (really_start_method): Call comp_proto_with_proto() instead of comp_method_with_proto(); call objc_start_function() instead of hand-crafting a function declarator. (continue_method_def, objc_expand_function_end): Remove functions. (get_super_receiver): Call objc_get_current_scope() instead of get_current_scope(); reference 'super_class' field (instead of 'class'). (finish_method_def): Rename to objc_finish_method_definition() and add a function decl parameter; move method encoding call from objc_expand_function_end(). (is_complex_decl, adorn_decl, gen_declarator, gen_declspecs, gen_declaration_1): Remove functions. (tmpbuf, RAW_DECLSPEC): Remove. (gen_declaration): Remove second parameter; simplify to deal with TYPE_P nodes instead of raw declspecs. (gen_type_name, gen_type_name_0): New functions. (gen_method_decl): Remove second parameter; call gen_type_name() instead of gen_declaration_1(). (dump_interface): Adjust calls to gen_declaration() and gen_method_decl(); do not allocate a separate string buffer. (init_objc): Allocate a larger string buffer to accommodate dump_interface(); adjust call to build_module_descriptor(); add call to build_module_initializer_routine() for the GNU runtime. (generate_classref_translation_entry): Do not call start_decl(); call finish_var_decl() instead of finish_decl(); call convert() instead of build_c_cast(). * objc-act.h (CLASS_OWN_IVARS): Remove accessor. (CLASS_BINFO_ELTS): Reduce from 6 to 5, now that CLASS_OWN_IVARS is gone. (OCTI_GNU_INIT_DECL, GNU_INIT_decl): New. (OCTI_ELLIPSIS_NODE, objc_ellipsis_node): Remove. (OCTI_ID_ID, id_type, objc_id_id): Rename to OCTI_ID_NAME, objc_object_type and objc_object_name, respectively. (OCTI_CLS_REF, OCTI_CLASS_NAME, objc_class_reference, objc_class_name): New. (IS_CLASS): New macro. (IS_ID, IS_SUPER): Robustify. (OCTI_EXECCLASS_DECL, execclass_decl): New. (finish_file, start_class, continue_class, finish_class, start_method_def, continue_method_def, finish_method_def, start_protocol, finish_protocol, objc_build_throw_stmt, objc_build_try_catch_finally_stmt, objc_build_synchronized_prologue, objc_build_synchronized_epilogue, objc_build_try_prologue, objc_build_try_epilogue, objc_build_catch_stmt, objc_build_catch_epilogue, objc_build_finally_prologue, objc_build_finally_epilogue, is_ivar, is_private, is_public, add_instance_variable, objc_add_method, get_super_receiver, objc_clear_super_receiver, get_class_ivars_from_name, get_class_reference, get_static_reference, get_object_reference, build_message_expr, finish_message_expr, build_selector_expr, build_ivar_reference, build_keyword_decl, build_method_decl, build_protocol_expr, build_objc_string_object, objc_declare_alias, objc_declare_class, objc_declare_protocols, objc_comptypes, objc_check_decl, build_encode_expr): Remove prototypes. (imp_count, cat_count): Make GGC-aware. (OBJC_SET_TYPE_NAME): New macro. From-SVN: r87168
2004-09-08 02:49:44 +02:00
if (METHOD_ADD_ARGS_ELLIPSIS_P (method))
Makefile.in (c-parse.o): Depend on $(C_COMMON_H). [gcc/ChangeLog] 2004-09-07 Ziemowit Laski <zlaski@apple.com> * Makefile.in (c-parse.o): Depend on $(C_COMMON_H). * c-parse.in: Include c-common.h instead of objc-act.h. (ivar_decl_list, ivar_decls, ivar_decl, ivars, ivar_declarator, myparms, myparm): Remove %type declarations. (methodtype, optparms, OBJC_TYPE_QUAL, objc_quals, objc_qual, objc_typename, objc_try_catch_stmt, optellipsis): Add %type declarations. (objc_inherit_code, objc_public_flag): Remove. (typespec_nonreserved_nonattr): Call objc_get_protocol_qualified_type() instead of get_static_reference() and get_protocol_reference(). (stmt_nocomp): Call grokparm() on @catch parameter. (objcdef): Move semantic action to objc_finish_implementation(). (classdef): Move semantic action to objc_start_class_interface(), objc_continue_interface(), objc_finish_interface(), objc_start_class_implementation(), objc_continue_implementation(), objc_start_category_interface() and objc_start_category_implementation(). (protocoldef): Move semantic actions to objc_start_protocol() and objc_finish_interface(). (ivar_decl_list): Remove nonterminal. (visibility_spec): Move semantic actions to objc_set_visibility(). (ivar_decls): Remove assignment to $$. (ivar_decl): Rephrase in terms of component_decl; call objc_add_instance_variable(). (ivars, ivar_declarator): Remove nonterminals. (opt_semi): New nonterminal. (methodtype): Remove semantic actions. (methoddef): Move semantic actions to objc_set_method_type(), objc_start_method_definition() and objc_finish_method_definition(). (methodproto): Move semantic actions to objc_set_method_type() and objc_add_method_declaration(). (methoddecl): Use objc_typename instead of typename; move semantic actions to objc_build_method_signature(). (optarglist, myxdecls, mydecl, myparms, myparm): Remove nonterminals. (optparmlist): Express in terms of optparms and optellipsis. (optparms, optellipsis, objc_qual, objc_quals, objc_typename): New nonterminals. (keyworddecl): Use objc_typename instead of typename. (rid_to_yy): Mark RID_IN, RID_OUT, RID_INOUT, RID_BYCOPY, RID_BYREF and RID_ONEWAY as returning OBJC_TYPE_QUAL to yyparse(). [gcc/objc/ChangeLog] 2004-09-07 Ziemowit Laski <zlaski@apple.com> * Make-lang.in (objc/objc-parse.o): Depend on $(C_COMMON_H) instead of objc/objc-act.h. (objc/objc-act.o): Depend on $(HASHTAB_H). * objc-act.c: Include hashtab.h; in ObjC++ mode, include cp-tree.h and objcp-decl.h instead of c-tree.h. (build_module_descriptor, get_class_ivars, synth_id_with_class_suffix, error_with_ivar, gen_method_decl, gen_declaration, setup_string_decl, build_protocol_template): Adjust prototypes. (build_module_initializer_routine, start_class, continue_class, finish_class, start_method_def, objc_start_function, start_protocol, build_method_decl, objc_add_method, add_instance_variable, build_ivar_reference, is_ivar, is_private, get_super_receiver, build_selector_table_decl, objc_push_parm, objc_get_parm_info, gen_type_name, gen_type_name_0, start_var_decl, finish_var_decl, create_field_decl): New prototypes. (objc_expand_function_end, comp_method_with_proto, objc_expr_last, gen_declaration_1, gen_declarator, is_complex_decl, adorn_decl, define_decl, create_builtin_decl, gen_declspecs): Remove prototypes. (TYPE_ID): Rename to OBJECT_TYPEDEF_NAME. (CLASS_TYPEDEF_NAME): New. (TAG_EXECCLASS): Change from a global variable to a #define. (TAG_RETURN_STRUCT): Delete. (TAG_GNUINIT): New, holds '__objc_gnu_init' name. (objc_inherit_code, objc_public_flag): New, moved from c-parse.in. (string_descriptor): New struct. (string_htab): New hash table. (string_hash, string_eq): New prototypes. (generate_struct_by_value_array): Call create_field_decl() instead of create_builtin_decl(). (objc_init): Do not initialize objc_ellipsis_node or TAG_EXECCLASS; In ObjC++ mode, call cxx_init() instead of c_objc_common_init(). (objc_finish_file): In ObjC++, call instantiate_pending_templates() and cp_finish_file(). (define_decl, get_static_reference, get_protocol_reference, create_builtin_decl): Remove functions. (objc_start_class_interface, objc_start_category_interface, objc_start_protocol, objc_continue_interface, objc_finish_interface, objc_start_class_implementation, objc_start_category_implementation, objc_continue_implementation, objc_finish_implementation, objc_set_visibility, objc_set_method_type, objc_build_method_signature, objc_add_method_declaration, objc_start_method_definition, objc_add_instance_variable, objc_get_protocol_qualified_type, create_field_decl, start_var_decl, finish_var_decl): New functions. (setup_string_decl): Simplify since it is only called once. (synth_module_prologue): Call build_class_template(); predefine 'id' and 'Class' as typedefs; rename 'temp_type' to 'type'; disable debug hooks for duration of function; fix GNU runtime messenger signatures to correspond to reality; forward-declare '__objc_exec_class' for the GNU runtime; call build_selector_table_decl(); in ObjC++ mode, generate 'extern "C" { ... }' wrappers around synthesized declarations; call build_protocol_template() and build_category_template(). (string_hash, string_eq): New functions. (objc_build_string_object): Check metaclass correctness only once; store string literals in hash table. (objc_build_constructor): Do not convert initializer elements; adjust for ObjC++ impedance mismatch. (build_objc_symtab_template): Call create_field_decl() instead of create_builtin_decl(). (init_objc_symtab): Add missing conversion to initializer element. (build_metadata_decl): Call start_var_decl() instead of define_decl(). (generate_objc_symtab_decl): Do not call build_category_template(); call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(). (build_module_descriptor): Call create_field_decl() instead of grokfield(); call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(); always mark module descriptor as used; move GNU runtime-specific functionality to build_module_initializer_routine(). (build_module_initializer_routine): New function, broken off of build_module_descriptor(). (objc_static_init_needed_p, objc_generate_static_init_call): New functions. (generate_static_references, generate_strings, build_selector_translation_table, generate_descriptor_table, generate_ivars_list, generate_dispatch_table, generate_category): Call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(); build a type directly instead of via groktypename(). (build_selector_reference_decl, build_selector_table_decl, build_class_reference_decl, build_protocol_reference, generate_objc_image_info): Call start_var_decl() instead of build_decl(). (build_selector_reference): For GNU runtime, do not call build_selector_reference_decl(). (build_selector, build_typed_selector_reference): Always convert result to the selector type. (add_objc_string): Cast return value to 'char *'. (build_method_prototype_template, build_selector_template, build_method_template): Use actual selector type for fields pointing to selectors. (finish_objc): For GNU runtime, call build_module_initializer_routine() after build_module_descriptor(). (generate_protocol_list, generate_shared_structures): Call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(); build a type directly instead of via groktypename(). (synth_id_with_class_suffix): Return a string. (get_arg_type_list): For instance methods, use the instance type for 'self'; do not call groktypename_in_parm_context(). (build_objc_string_decl): Squash redeclaration errors in ObjC++. (objc_is_class_name): Use OBJC_TYPE_NAME instead of TYPE_NAME; handle RECORD_TYPEs in ObjC as well as ObjC++. (objc_is_id): New function. (objc_is_object_ptr): Return the canonical type node. (objc_get_class_ivars): Simplify using get_class_ivars(). (get_class_ivars): Remove second parameter; create a fresh copy of the ivar list for each call; do not check for existence of super class. (objc_eh_runtime_type): Mark #ifndef OBJCPLUS. (objc_init_exceptions): When using SJLJ-style exceptions, require the use of '-fobjc-exceptions' flag; do not require it for DWARF-style exceptions. (objc_build_exc_ptr, next_sjlj_build_try_catch_finally): Use objc_object_type instead of objc_id_type. (objc_begin_catch_clause): Convert the incoming PARM_DECL into a VAR_DECL before placing it in the appropriate scope; do not call define_decl(); adjust call to c_begin_compound_stmt(); use objc_object_type instead of objc_id_type. (build_next_objc_exception_stuff): Call create_field_decl() instead of create_builtin_decl(); construct type directly instead of calling groktypename(); use OBJC_VOID_AT_END to mark end of function parameters. (build_private_template): Adjust call to get_class_ivars(); build a type directly instead of via groktypename(). (build_protocol_template, build_method_prototype_list_template, build_method_prototype_template, build_category_template, build_selector_template, build_class_template, build_super_template, build_ivar_template, build_ivar_list_template, build_method_list_template, build_method_template): Call create_field_decl() instead of grokfield(). (objc_method_parm_type): Do not call groktypename(). (generate_descriptor_table): Call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(). (generate_method_descriptors, build_protocol_initializer, generate_dispatch_tables, build_category_initializer, build_shared_structure_initializer): Do not call groktypename(). (generate_protocols): Call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(); do not call groktypename(). (error_with_ivar): Remove last parameter. (check_ivars): Do not iterate ovar CLASS_RAW_IVARS lists in addition to CLASS_IVARS lists; adjust calls to error_with_ivar(). (generate_ivar_lists): Convert one of the initializer elements; do not call groktypename(). (get_arg_type_list, start_method_def, gen_method_def): Account for new representation of variable arguments and '...' in Objective-C methods; add Objective-C++ impedance matching code. (is_objc_type_qualifier): Remove function. (adjust_type_for_id_default): Simplify; there is no longer a need to wade through declspecs. (lookup_interface, start_class, continue_class, finish_class, start_method_def, start_protocol, build_method_decl, objc_add_method, add_instance_variable, build_ivar_reference, is_ivar, is_private, get_super_receiver, objc_build_finally_epilogue): Make into static functions. (receiver_is_class_object): Use new IS_CLASS() macro. (objc_build_message_expr): Tweak ObjC++ message argument handling; call objc_finish_message_expr() instead of finish_message_expr(). (finish_message_expr): Rename to objc_finish_message_expr(); use OBJC_TYPE_NAME and OBJC_SET_TYPE_NAME macros instead of TYPE_NAME. call gen_type_name() instead of gen_declaration(); call objc_is_id() instead of using IS_ID and IS_CLASS; Use objc_class_name instead of calling get_identifier("Class"); handle CONVERT_EXPRs in receiver. (build_objc_method_call, warn_with_method): Do not call groktypename(). (build_ivar_reference): Call convert() instead of clobbering in a type. (hash_init): Initialize string_htab hash table. (add_instance_variable): Simplify parameter list; do not call grokfield(); do not populate CLASS_IVARS list. (start_class): Check for the existence of super class, if one was specified. (continue_class): Use CLASS_RAW_IVARS rather than CLASS_IVARS; do not call build_class_template(); adjust call to get_class_ivars(); call build_decl(), pushdecl() and finish_decl() instead of define_decl(). (finish_class): Call build_decl(), pushdecl() and finish_decl() instead of define_decl(). (add_protocols): Use PROTOCOL_BINFO_ELTS for the tree vector size. (start_protocol): Do not call build_protocol_template(); use PROTOCOL_BINFO_ELTS for the tree vector size. (encode_type_qualifiers): Do not handle the 'const' qualifier here. (encode_pointer): Encode 'const char *' as 'r*', for backwards compatibility. (encode_array): Use HOST_WIDE_INT_PRINT_DEC instead of "%ld". (encode_type): Handle the 'const' qualifier here. (objc_parmlist): New global variable, sued by objc_push_parm and objc_get_parm_info(). (objc_push_parm, objc_get_parm_info): New functions. (objc_expr_last): Remove function. (synth_self_and_ucmd_args): For instance methods, use the instance type for 'self'; call objc_push_parm() instead of push_parm_decl(). (start_method_def): Do not call push_scope(), declare_parm_level(), pop_scope(), push_parm_decl(), store_parm_decls() or objc_expr_last(); just use objc_push_parm() and objc_get_parm_info(). (comp_method_with_proto): Remove function. (objc_types_are_equivalent): Strip away indirections before comparing underlying types. (comp_proto_with_proto): Do not call groktypename(); types are no longer in raw declspec format. (objc_start_function): New function. (really_start_method): Call comp_proto_with_proto() instead of comp_method_with_proto(); call objc_start_function() instead of hand-crafting a function declarator. (continue_method_def, objc_expand_function_end): Remove functions. (get_super_receiver): Call objc_get_current_scope() instead of get_current_scope(); reference 'super_class' field (instead of 'class'). (finish_method_def): Rename to objc_finish_method_definition() and add a function decl parameter; move method encoding call from objc_expand_function_end(). (is_complex_decl, adorn_decl, gen_declarator, gen_declspecs, gen_declaration_1): Remove functions. (tmpbuf, RAW_DECLSPEC): Remove. (gen_declaration): Remove second parameter; simplify to deal with TYPE_P nodes instead of raw declspecs. (gen_type_name, gen_type_name_0): New functions. (gen_method_decl): Remove second parameter; call gen_type_name() instead of gen_declaration_1(). (dump_interface): Adjust calls to gen_declaration() and gen_method_decl(); do not allocate a separate string buffer. (init_objc): Allocate a larger string buffer to accommodate dump_interface(); adjust call to build_module_descriptor(); add call to build_module_initializer_routine() for the GNU runtime. (generate_classref_translation_entry): Do not call start_decl(); call finish_var_decl() instead of finish_decl(); call convert() instead of build_c_cast(). * objc-act.h (CLASS_OWN_IVARS): Remove accessor. (CLASS_BINFO_ELTS): Reduce from 6 to 5, now that CLASS_OWN_IVARS is gone. (OCTI_GNU_INIT_DECL, GNU_INIT_decl): New. (OCTI_ELLIPSIS_NODE, objc_ellipsis_node): Remove. (OCTI_ID_ID, id_type, objc_id_id): Rename to OCTI_ID_NAME, objc_object_type and objc_object_name, respectively. (OCTI_CLS_REF, OCTI_CLASS_NAME, objc_class_reference, objc_class_name): New. (IS_CLASS): New macro. (IS_ID, IS_SUPER): Robustify. (OCTI_EXECCLASS_DECL, execclass_decl): New. (finish_file, start_class, continue_class, finish_class, start_method_def, continue_method_def, finish_method_def, start_protocol, finish_protocol, objc_build_throw_stmt, objc_build_try_catch_finally_stmt, objc_build_synchronized_prologue, objc_build_synchronized_epilogue, objc_build_try_prologue, objc_build_try_epilogue, objc_build_catch_stmt, objc_build_catch_epilogue, objc_build_finally_prologue, objc_build_finally_epilogue, is_ivar, is_private, is_public, add_instance_variable, objc_add_method, get_super_receiver, objc_clear_super_receiver, get_class_ivars_from_name, get_class_reference, get_static_reference, get_object_reference, build_message_expr, finish_message_expr, build_selector_expr, build_ivar_reference, build_keyword_decl, build_method_decl, build_protocol_expr, build_objc_string_object, objc_declare_alias, objc_declare_class, objc_declare_protocols, objc_comptypes, objc_check_decl, build_encode_expr): Remove prototypes. (imp_count, cat_count): Make GGC-aware. (OBJC_SET_TYPE_NAME): New macro. From-SVN: r87168
2004-09-08 02:49:44 +02:00
have_ellipsis = 1;
1992-01-18 00:15:38 +01:00
}
Makefile.in (c-parse.o): Depend on $(C_COMMON_H). [gcc/ChangeLog] 2004-09-07 Ziemowit Laski <zlaski@apple.com> * Makefile.in (c-parse.o): Depend on $(C_COMMON_H). * c-parse.in: Include c-common.h instead of objc-act.h. (ivar_decl_list, ivar_decls, ivar_decl, ivars, ivar_declarator, myparms, myparm): Remove %type declarations. (methodtype, optparms, OBJC_TYPE_QUAL, objc_quals, objc_qual, objc_typename, objc_try_catch_stmt, optellipsis): Add %type declarations. (objc_inherit_code, objc_public_flag): Remove. (typespec_nonreserved_nonattr): Call objc_get_protocol_qualified_type() instead of get_static_reference() and get_protocol_reference(). (stmt_nocomp): Call grokparm() on @catch parameter. (objcdef): Move semantic action to objc_finish_implementation(). (classdef): Move semantic action to objc_start_class_interface(), objc_continue_interface(), objc_finish_interface(), objc_start_class_implementation(), objc_continue_implementation(), objc_start_category_interface() and objc_start_category_implementation(). (protocoldef): Move semantic actions to objc_start_protocol() and objc_finish_interface(). (ivar_decl_list): Remove nonterminal. (visibility_spec): Move semantic actions to objc_set_visibility(). (ivar_decls): Remove assignment to $$. (ivar_decl): Rephrase in terms of component_decl; call objc_add_instance_variable(). (ivars, ivar_declarator): Remove nonterminals. (opt_semi): New nonterminal. (methodtype): Remove semantic actions. (methoddef): Move semantic actions to objc_set_method_type(), objc_start_method_definition() and objc_finish_method_definition(). (methodproto): Move semantic actions to objc_set_method_type() and objc_add_method_declaration(). (methoddecl): Use objc_typename instead of typename; move semantic actions to objc_build_method_signature(). (optarglist, myxdecls, mydecl, myparms, myparm): Remove nonterminals. (optparmlist): Express in terms of optparms and optellipsis. (optparms, optellipsis, objc_qual, objc_quals, objc_typename): New nonterminals. (keyworddecl): Use objc_typename instead of typename. (rid_to_yy): Mark RID_IN, RID_OUT, RID_INOUT, RID_BYCOPY, RID_BYREF and RID_ONEWAY as returning OBJC_TYPE_QUAL to yyparse(). [gcc/objc/ChangeLog] 2004-09-07 Ziemowit Laski <zlaski@apple.com> * Make-lang.in (objc/objc-parse.o): Depend on $(C_COMMON_H) instead of objc/objc-act.h. (objc/objc-act.o): Depend on $(HASHTAB_H). * objc-act.c: Include hashtab.h; in ObjC++ mode, include cp-tree.h and objcp-decl.h instead of c-tree.h. (build_module_descriptor, get_class_ivars, synth_id_with_class_suffix, error_with_ivar, gen_method_decl, gen_declaration, setup_string_decl, build_protocol_template): Adjust prototypes. (build_module_initializer_routine, start_class, continue_class, finish_class, start_method_def, objc_start_function, start_protocol, build_method_decl, objc_add_method, add_instance_variable, build_ivar_reference, is_ivar, is_private, get_super_receiver, build_selector_table_decl, objc_push_parm, objc_get_parm_info, gen_type_name, gen_type_name_0, start_var_decl, finish_var_decl, create_field_decl): New prototypes. (objc_expand_function_end, comp_method_with_proto, objc_expr_last, gen_declaration_1, gen_declarator, is_complex_decl, adorn_decl, define_decl, create_builtin_decl, gen_declspecs): Remove prototypes. (TYPE_ID): Rename to OBJECT_TYPEDEF_NAME. (CLASS_TYPEDEF_NAME): New. (TAG_EXECCLASS): Change from a global variable to a #define. (TAG_RETURN_STRUCT): Delete. (TAG_GNUINIT): New, holds '__objc_gnu_init' name. (objc_inherit_code, objc_public_flag): New, moved from c-parse.in. (string_descriptor): New struct. (string_htab): New hash table. (string_hash, string_eq): New prototypes. (generate_struct_by_value_array): Call create_field_decl() instead of create_builtin_decl(). (objc_init): Do not initialize objc_ellipsis_node or TAG_EXECCLASS; In ObjC++ mode, call cxx_init() instead of c_objc_common_init(). (objc_finish_file): In ObjC++, call instantiate_pending_templates() and cp_finish_file(). (define_decl, get_static_reference, get_protocol_reference, create_builtin_decl): Remove functions. (objc_start_class_interface, objc_start_category_interface, objc_start_protocol, objc_continue_interface, objc_finish_interface, objc_start_class_implementation, objc_start_category_implementation, objc_continue_implementation, objc_finish_implementation, objc_set_visibility, objc_set_method_type, objc_build_method_signature, objc_add_method_declaration, objc_start_method_definition, objc_add_instance_variable, objc_get_protocol_qualified_type, create_field_decl, start_var_decl, finish_var_decl): New functions. (setup_string_decl): Simplify since it is only called once. (synth_module_prologue): Call build_class_template(); predefine 'id' and 'Class' as typedefs; rename 'temp_type' to 'type'; disable debug hooks for duration of function; fix GNU runtime messenger signatures to correspond to reality; forward-declare '__objc_exec_class' for the GNU runtime; call build_selector_table_decl(); in ObjC++ mode, generate 'extern "C" { ... }' wrappers around synthesized declarations; call build_protocol_template() and build_category_template(). (string_hash, string_eq): New functions. (objc_build_string_object): Check metaclass correctness only once; store string literals in hash table. (objc_build_constructor): Do not convert initializer elements; adjust for ObjC++ impedance mismatch. (build_objc_symtab_template): Call create_field_decl() instead of create_builtin_decl(). (init_objc_symtab): Add missing conversion to initializer element. (build_metadata_decl): Call start_var_decl() instead of define_decl(). (generate_objc_symtab_decl): Do not call build_category_template(); call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(). (build_module_descriptor): Call create_field_decl() instead of grokfield(); call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(); always mark module descriptor as used; move GNU runtime-specific functionality to build_module_initializer_routine(). (build_module_initializer_routine): New function, broken off of build_module_descriptor(). (objc_static_init_needed_p, objc_generate_static_init_call): New functions. (generate_static_references, generate_strings, build_selector_translation_table, generate_descriptor_table, generate_ivars_list, generate_dispatch_table, generate_category): Call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(); build a type directly instead of via groktypename(). (build_selector_reference_decl, build_selector_table_decl, build_class_reference_decl, build_protocol_reference, generate_objc_image_info): Call start_var_decl() instead of build_decl(). (build_selector_reference): For GNU runtime, do not call build_selector_reference_decl(). (build_selector, build_typed_selector_reference): Always convert result to the selector type. (add_objc_string): Cast return value to 'char *'. (build_method_prototype_template, build_selector_template, build_method_template): Use actual selector type for fields pointing to selectors. (finish_objc): For GNU runtime, call build_module_initializer_routine() after build_module_descriptor(). (generate_protocol_list, generate_shared_structures): Call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(); build a type directly instead of via groktypename(). (synth_id_with_class_suffix): Return a string. (get_arg_type_list): For instance methods, use the instance type for 'self'; do not call groktypename_in_parm_context(). (build_objc_string_decl): Squash redeclaration errors in ObjC++. (objc_is_class_name): Use OBJC_TYPE_NAME instead of TYPE_NAME; handle RECORD_TYPEs in ObjC as well as ObjC++. (objc_is_id): New function. (objc_is_object_ptr): Return the canonical type node. (objc_get_class_ivars): Simplify using get_class_ivars(). (get_class_ivars): Remove second parameter; create a fresh copy of the ivar list for each call; do not check for existence of super class. (objc_eh_runtime_type): Mark #ifndef OBJCPLUS. (objc_init_exceptions): When using SJLJ-style exceptions, require the use of '-fobjc-exceptions' flag; do not require it for DWARF-style exceptions. (objc_build_exc_ptr, next_sjlj_build_try_catch_finally): Use objc_object_type instead of objc_id_type. (objc_begin_catch_clause): Convert the incoming PARM_DECL into a VAR_DECL before placing it in the appropriate scope; do not call define_decl(); adjust call to c_begin_compound_stmt(); use objc_object_type instead of objc_id_type. (build_next_objc_exception_stuff): Call create_field_decl() instead of create_builtin_decl(); construct type directly instead of calling groktypename(); use OBJC_VOID_AT_END to mark end of function parameters. (build_private_template): Adjust call to get_class_ivars(); build a type directly instead of via groktypename(). (build_protocol_template, build_method_prototype_list_template, build_method_prototype_template, build_category_template, build_selector_template, build_class_template, build_super_template, build_ivar_template, build_ivar_list_template, build_method_list_template, build_method_template): Call create_field_decl() instead of grokfield(). (objc_method_parm_type): Do not call groktypename(). (generate_descriptor_table): Call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(). (generate_method_descriptors, build_protocol_initializer, generate_dispatch_tables, build_category_initializer, build_shared_structure_initializer): Do not call groktypename(). (generate_protocols): Call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(); do not call groktypename(). (error_with_ivar): Remove last parameter. (check_ivars): Do not iterate ovar CLASS_RAW_IVARS lists in addition to CLASS_IVARS lists; adjust calls to error_with_ivar(). (generate_ivar_lists): Convert one of the initializer elements; do not call groktypename(). (get_arg_type_list, start_method_def, gen_method_def): Account for new representation of variable arguments and '...' in Objective-C methods; add Objective-C++ impedance matching code. (is_objc_type_qualifier): Remove function. (adjust_type_for_id_default): Simplify; there is no longer a need to wade through declspecs. (lookup_interface, start_class, continue_class, finish_class, start_method_def, start_protocol, build_method_decl, objc_add_method, add_instance_variable, build_ivar_reference, is_ivar, is_private, get_super_receiver, objc_build_finally_epilogue): Make into static functions. (receiver_is_class_object): Use new IS_CLASS() macro. (objc_build_message_expr): Tweak ObjC++ message argument handling; call objc_finish_message_expr() instead of finish_message_expr(). (finish_message_expr): Rename to objc_finish_message_expr(); use OBJC_TYPE_NAME and OBJC_SET_TYPE_NAME macros instead of TYPE_NAME. call gen_type_name() instead of gen_declaration(); call objc_is_id() instead of using IS_ID and IS_CLASS; Use objc_class_name instead of calling get_identifier("Class"); handle CONVERT_EXPRs in receiver. (build_objc_method_call, warn_with_method): Do not call groktypename(). (build_ivar_reference): Call convert() instead of clobbering in a type. (hash_init): Initialize string_htab hash table. (add_instance_variable): Simplify parameter list; do not call grokfield(); do not populate CLASS_IVARS list. (start_class): Check for the existence of super class, if one was specified. (continue_class): Use CLASS_RAW_IVARS rather than CLASS_IVARS; do not call build_class_template(); adjust call to get_class_ivars(); call build_decl(), pushdecl() and finish_decl() instead of define_decl(). (finish_class): Call build_decl(), pushdecl() and finish_decl() instead of define_decl(). (add_protocols): Use PROTOCOL_BINFO_ELTS for the tree vector size. (start_protocol): Do not call build_protocol_template(); use PROTOCOL_BINFO_ELTS for the tree vector size. (encode_type_qualifiers): Do not handle the 'const' qualifier here. (encode_pointer): Encode 'const char *' as 'r*', for backwards compatibility. (encode_array): Use HOST_WIDE_INT_PRINT_DEC instead of "%ld". (encode_type): Handle the 'const' qualifier here. (objc_parmlist): New global variable, sued by objc_push_parm and objc_get_parm_info(). (objc_push_parm, objc_get_parm_info): New functions. (objc_expr_last): Remove function. (synth_self_and_ucmd_args): For instance methods, use the instance type for 'self'; call objc_push_parm() instead of push_parm_decl(). (start_method_def): Do not call push_scope(), declare_parm_level(), pop_scope(), push_parm_decl(), store_parm_decls() or objc_expr_last(); just use objc_push_parm() and objc_get_parm_info(). (comp_method_with_proto): Remove function. (objc_types_are_equivalent): Strip away indirections before comparing underlying types. (comp_proto_with_proto): Do not call groktypename(); types are no longer in raw declspec format. (objc_start_function): New function. (really_start_method): Call comp_proto_with_proto() instead of comp_method_with_proto(); call objc_start_function() instead of hand-crafting a function declarator. (continue_method_def, objc_expand_function_end): Remove functions. (get_super_receiver): Call objc_get_current_scope() instead of get_current_scope(); reference 'super_class' field (instead of 'class'). (finish_method_def): Rename to objc_finish_method_definition() and add a function decl parameter; move method encoding call from objc_expand_function_end(). (is_complex_decl, adorn_decl, gen_declarator, gen_declspecs, gen_declaration_1): Remove functions. (tmpbuf, RAW_DECLSPEC): Remove. (gen_declaration): Remove second parameter; simplify to deal with TYPE_P nodes instead of raw declspecs. (gen_type_name, gen_type_name_0): New functions. (gen_method_decl): Remove second parameter; call gen_type_name() instead of gen_declaration_1(). (dump_interface): Adjust calls to gen_declaration() and gen_method_decl(); do not allocate a separate string buffer. (init_objc): Allocate a larger string buffer to accommodate dump_interface(); adjust call to build_module_descriptor(); add call to build_module_initializer_routine() for the GNU runtime. (generate_classref_translation_entry): Do not call start_decl(); call finish_var_decl() instead of finish_decl(); call convert() instead of build_c_cast(). * objc-act.h (CLASS_OWN_IVARS): Remove accessor. (CLASS_BINFO_ELTS): Reduce from 6 to 5, now that CLASS_OWN_IVARS is gone. (OCTI_GNU_INIT_DECL, GNU_INIT_decl): New. (OCTI_ELLIPSIS_NODE, objc_ellipsis_node): Remove. (OCTI_ID_ID, id_type, objc_id_id): Rename to OCTI_ID_NAME, objc_object_type and objc_object_name, respectively. (OCTI_CLS_REF, OCTI_CLASS_NAME, objc_class_reference, objc_class_name): New. (IS_CLASS): New macro. (IS_ID, IS_SUPER): Robustify. (OCTI_EXECCLASS_DECL, execclass_decl): New. (finish_file, start_class, continue_class, finish_class, start_method_def, continue_method_def, finish_method_def, start_protocol, finish_protocol, objc_build_throw_stmt, objc_build_try_catch_finally_stmt, objc_build_synchronized_prologue, objc_build_synchronized_epilogue, objc_build_try_prologue, objc_build_try_epilogue, objc_build_catch_stmt, objc_build_catch_epilogue, objc_build_finally_prologue, objc_build_finally_epilogue, is_ivar, is_private, is_public, add_instance_variable, objc_add_method, get_super_receiver, objc_clear_super_receiver, get_class_ivars_from_name, get_class_reference, get_static_reference, get_object_reference, build_message_expr, finish_message_expr, build_selector_expr, build_ivar_reference, build_keyword_decl, build_method_decl, build_protocol_expr, build_objc_string_object, objc_declare_alias, objc_declare_class, objc_declare_protocols, objc_comptypes, objc_check_decl, build_encode_expr): Remove prototypes. (imp_count, cat_count): Make GGC-aware. (OBJC_SET_TYPE_NAME): New macro. From-SVN: r87168
2004-09-08 02:49:44 +02:00
c-tree.h (enum c_declarator_kind, [...]): New. * c-tree.h (enum c_declarator_kind, struct c_arg_info, struct c_declarator, struct c_type_name, struct c_parm): New. (build_array_declarator, set_array_declarator_inner, get_parm_info, grokfield, groktypename, grokparm, push_parm_decl, start_function, start_decl, build_c_parm, build_attrs_declarator, build_function_declarator, make_pointer_declarator, c_cast_expr, store_parm_decls_newstyle, c_expr_sizeof_type): Update prototypes. (build_id_declarator): New. * c-typeck.c (c_cast_expr, c_expr_sizeof_type): Update to new structures. * c-decl.c (ARG_INFO_PARMS, ARG_INFO_TAGS, ARG_INFO_TYPES, ARG_INFO_OTHERS): Remove. (build_id_declarator): New. (build_array_declarator, set_array_declarator_inner, groktypename, start_decl, grokparm, push_parm_decl, grokparms, get_parm_info, grokfield, start_function, store_parm_decls_newstyle, store_parm_decls_oldstyle, store_parm_decls, build_c_parm, build_attrs_declarator, build_function_declarator, make_pointer_declarator, grokdeclarator): Update to new structures. * c-parse.in (%union): Add arginfotype, dtrtype, typenametype and parmtype. (declarator, notype_declarator, after_type_declarator, parm_declarator, parm_declarator_starttypename, parm_declarator_nostarttypename, array_declarator, typename, absdcl, absdcl1, absdcl1_ea, absdcl1_noea, direct_absdcl1, absdcl_maybe_attribute, parm, firstparm, parms, parmlist, parmlist_1, parmlist_2, parmlist_or_identifiers, parmlist_or_identifiers_1): Use these types. (primary, after_type_declarator, parm_declarator_starttypename, notype_declarator, component_decl, component_declarator, component_notype_declarator, typename, absdcl, absdcl_maybe_attribute, absdcl1_ea, direct_absdcl1, parmlist_1, parmlist_2, parmlist_or_identifiers_1): Update to new structures. objc: * objc-act.c (objc_start_function, really_start_method, objc_get_parm_info, start_method_def): Update to new arg_info structures. From-SVN: r87217
2004-09-09 03:19:15 +02:00
parm_info = objc_get_parm_info (have_ellipsis);
Makefile.in (c-parse.o): Depend on $(C_COMMON_H). [gcc/ChangeLog] 2004-09-07 Ziemowit Laski <zlaski@apple.com> * Makefile.in (c-parse.o): Depend on $(C_COMMON_H). * c-parse.in: Include c-common.h instead of objc-act.h. (ivar_decl_list, ivar_decls, ivar_decl, ivars, ivar_declarator, myparms, myparm): Remove %type declarations. (methodtype, optparms, OBJC_TYPE_QUAL, objc_quals, objc_qual, objc_typename, objc_try_catch_stmt, optellipsis): Add %type declarations. (objc_inherit_code, objc_public_flag): Remove. (typespec_nonreserved_nonattr): Call objc_get_protocol_qualified_type() instead of get_static_reference() and get_protocol_reference(). (stmt_nocomp): Call grokparm() on @catch parameter. (objcdef): Move semantic action to objc_finish_implementation(). (classdef): Move semantic action to objc_start_class_interface(), objc_continue_interface(), objc_finish_interface(), objc_start_class_implementation(), objc_continue_implementation(), objc_start_category_interface() and objc_start_category_implementation(). (protocoldef): Move semantic actions to objc_start_protocol() and objc_finish_interface(). (ivar_decl_list): Remove nonterminal. (visibility_spec): Move semantic actions to objc_set_visibility(). (ivar_decls): Remove assignment to $$. (ivar_decl): Rephrase in terms of component_decl; call objc_add_instance_variable(). (ivars, ivar_declarator): Remove nonterminals. (opt_semi): New nonterminal. (methodtype): Remove semantic actions. (methoddef): Move semantic actions to objc_set_method_type(), objc_start_method_definition() and objc_finish_method_definition(). (methodproto): Move semantic actions to objc_set_method_type() and objc_add_method_declaration(). (methoddecl): Use objc_typename instead of typename; move semantic actions to objc_build_method_signature(). (optarglist, myxdecls, mydecl, myparms, myparm): Remove nonterminals. (optparmlist): Express in terms of optparms and optellipsis. (optparms, optellipsis, objc_qual, objc_quals, objc_typename): New nonterminals. (keyworddecl): Use objc_typename instead of typename. (rid_to_yy): Mark RID_IN, RID_OUT, RID_INOUT, RID_BYCOPY, RID_BYREF and RID_ONEWAY as returning OBJC_TYPE_QUAL to yyparse(). [gcc/objc/ChangeLog] 2004-09-07 Ziemowit Laski <zlaski@apple.com> * Make-lang.in (objc/objc-parse.o): Depend on $(C_COMMON_H) instead of objc/objc-act.h. (objc/objc-act.o): Depend on $(HASHTAB_H). * objc-act.c: Include hashtab.h; in ObjC++ mode, include cp-tree.h and objcp-decl.h instead of c-tree.h. (build_module_descriptor, get_class_ivars, synth_id_with_class_suffix, error_with_ivar, gen_method_decl, gen_declaration, setup_string_decl, build_protocol_template): Adjust prototypes. (build_module_initializer_routine, start_class, continue_class, finish_class, start_method_def, objc_start_function, start_protocol, build_method_decl, objc_add_method, add_instance_variable, build_ivar_reference, is_ivar, is_private, get_super_receiver, build_selector_table_decl, objc_push_parm, objc_get_parm_info, gen_type_name, gen_type_name_0, start_var_decl, finish_var_decl, create_field_decl): New prototypes. (objc_expand_function_end, comp_method_with_proto, objc_expr_last, gen_declaration_1, gen_declarator, is_complex_decl, adorn_decl, define_decl, create_builtin_decl, gen_declspecs): Remove prototypes. (TYPE_ID): Rename to OBJECT_TYPEDEF_NAME. (CLASS_TYPEDEF_NAME): New. (TAG_EXECCLASS): Change from a global variable to a #define. (TAG_RETURN_STRUCT): Delete. (TAG_GNUINIT): New, holds '__objc_gnu_init' name. (objc_inherit_code, objc_public_flag): New, moved from c-parse.in. (string_descriptor): New struct. (string_htab): New hash table. (string_hash, string_eq): New prototypes. (generate_struct_by_value_array): Call create_field_decl() instead of create_builtin_decl(). (objc_init): Do not initialize objc_ellipsis_node or TAG_EXECCLASS; In ObjC++ mode, call cxx_init() instead of c_objc_common_init(). (objc_finish_file): In ObjC++, call instantiate_pending_templates() and cp_finish_file(). (define_decl, get_static_reference, get_protocol_reference, create_builtin_decl): Remove functions. (objc_start_class_interface, objc_start_category_interface, objc_start_protocol, objc_continue_interface, objc_finish_interface, objc_start_class_implementation, objc_start_category_implementation, objc_continue_implementation, objc_finish_implementation, objc_set_visibility, objc_set_method_type, objc_build_method_signature, objc_add_method_declaration, objc_start_method_definition, objc_add_instance_variable, objc_get_protocol_qualified_type, create_field_decl, start_var_decl, finish_var_decl): New functions. (setup_string_decl): Simplify since it is only called once. (synth_module_prologue): Call build_class_template(); predefine 'id' and 'Class' as typedefs; rename 'temp_type' to 'type'; disable debug hooks for duration of function; fix GNU runtime messenger signatures to correspond to reality; forward-declare '__objc_exec_class' for the GNU runtime; call build_selector_table_decl(); in ObjC++ mode, generate 'extern "C" { ... }' wrappers around synthesized declarations; call build_protocol_template() and build_category_template(). (string_hash, string_eq): New functions. (objc_build_string_object): Check metaclass correctness only once; store string literals in hash table. (objc_build_constructor): Do not convert initializer elements; adjust for ObjC++ impedance mismatch. (build_objc_symtab_template): Call create_field_decl() instead of create_builtin_decl(). (init_objc_symtab): Add missing conversion to initializer element. (build_metadata_decl): Call start_var_decl() instead of define_decl(). (generate_objc_symtab_decl): Do not call build_category_template(); call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(). (build_module_descriptor): Call create_field_decl() instead of grokfield(); call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(); always mark module descriptor as used; move GNU runtime-specific functionality to build_module_initializer_routine(). (build_module_initializer_routine): New function, broken off of build_module_descriptor(). (objc_static_init_needed_p, objc_generate_static_init_call): New functions. (generate_static_references, generate_strings, build_selector_translation_table, generate_descriptor_table, generate_ivars_list, generate_dispatch_table, generate_category): Call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(); build a type directly instead of via groktypename(). (build_selector_reference_decl, build_selector_table_decl, build_class_reference_decl, build_protocol_reference, generate_objc_image_info): Call start_var_decl() instead of build_decl(). (build_selector_reference): For GNU runtime, do not call build_selector_reference_decl(). (build_selector, build_typed_selector_reference): Always convert result to the selector type. (add_objc_string): Cast return value to 'char *'. (build_method_prototype_template, build_selector_template, build_method_template): Use actual selector type for fields pointing to selectors. (finish_objc): For GNU runtime, call build_module_initializer_routine() after build_module_descriptor(). (generate_protocol_list, generate_shared_structures): Call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(); build a type directly instead of via groktypename(). (synth_id_with_class_suffix): Return a string. (get_arg_type_list): For instance methods, use the instance type for 'self'; do not call groktypename_in_parm_context(). (build_objc_string_decl): Squash redeclaration errors in ObjC++. (objc_is_class_name): Use OBJC_TYPE_NAME instead of TYPE_NAME; handle RECORD_TYPEs in ObjC as well as ObjC++. (objc_is_id): New function. (objc_is_object_ptr): Return the canonical type node. (objc_get_class_ivars): Simplify using get_class_ivars(). (get_class_ivars): Remove second parameter; create a fresh copy of the ivar list for each call; do not check for existence of super class. (objc_eh_runtime_type): Mark #ifndef OBJCPLUS. (objc_init_exceptions): When using SJLJ-style exceptions, require the use of '-fobjc-exceptions' flag; do not require it for DWARF-style exceptions. (objc_build_exc_ptr, next_sjlj_build_try_catch_finally): Use objc_object_type instead of objc_id_type. (objc_begin_catch_clause): Convert the incoming PARM_DECL into a VAR_DECL before placing it in the appropriate scope; do not call define_decl(); adjust call to c_begin_compound_stmt(); use objc_object_type instead of objc_id_type. (build_next_objc_exception_stuff): Call create_field_decl() instead of create_builtin_decl(); construct type directly instead of calling groktypename(); use OBJC_VOID_AT_END to mark end of function parameters. (build_private_template): Adjust call to get_class_ivars(); build a type directly instead of via groktypename(). (build_protocol_template, build_method_prototype_list_template, build_method_prototype_template, build_category_template, build_selector_template, build_class_template, build_super_template, build_ivar_template, build_ivar_list_template, build_method_list_template, build_method_template): Call create_field_decl() instead of grokfield(). (objc_method_parm_type): Do not call groktypename(). (generate_descriptor_table): Call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(). (generate_method_descriptors, build_protocol_initializer, generate_dispatch_tables, build_category_initializer, build_shared_structure_initializer): Do not call groktypename(). (generate_protocols): Call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(); do not call groktypename(). (error_with_ivar): Remove last parameter. (check_ivars): Do not iterate ovar CLASS_RAW_IVARS lists in addition to CLASS_IVARS lists; adjust calls to error_with_ivar(). (generate_ivar_lists): Convert one of the initializer elements; do not call groktypename(). (get_arg_type_list, start_method_def, gen_method_def): Account for new representation of variable arguments and '...' in Objective-C methods; add Objective-C++ impedance matching code. (is_objc_type_qualifier): Remove function. (adjust_type_for_id_default): Simplify; there is no longer a need to wade through declspecs. (lookup_interface, start_class, continue_class, finish_class, start_method_def, start_protocol, build_method_decl, objc_add_method, add_instance_variable, build_ivar_reference, is_ivar, is_private, get_super_receiver, objc_build_finally_epilogue): Make into static functions. (receiver_is_class_object): Use new IS_CLASS() macro. (objc_build_message_expr): Tweak ObjC++ message argument handling; call objc_finish_message_expr() instead of finish_message_expr(). (finish_message_expr): Rename to objc_finish_message_expr(); use OBJC_TYPE_NAME and OBJC_SET_TYPE_NAME macros instead of TYPE_NAME. call gen_type_name() instead of gen_declaration(); call objc_is_id() instead of using IS_ID and IS_CLASS; Use objc_class_name instead of calling get_identifier("Class"); handle CONVERT_EXPRs in receiver. (build_objc_method_call, warn_with_method): Do not call groktypename(). (build_ivar_reference): Call convert() instead of clobbering in a type. (hash_init): Initialize string_htab hash table. (add_instance_variable): Simplify parameter list; do not call grokfield(); do not populate CLASS_IVARS list. (start_class): Check for the existence of super class, if one was specified. (continue_class): Use CLASS_RAW_IVARS rather than CLASS_IVARS; do not call build_class_template(); adjust call to get_class_ivars(); call build_decl(), pushdecl() and finish_decl() instead of define_decl(). (finish_class): Call build_decl(), pushdecl() and finish_decl() instead of define_decl(). (add_protocols): Use PROTOCOL_BINFO_ELTS for the tree vector size. (start_protocol): Do not call build_protocol_template(); use PROTOCOL_BINFO_ELTS for the tree vector size. (encode_type_qualifiers): Do not handle the 'const' qualifier here. (encode_pointer): Encode 'const char *' as 'r*', for backwards compatibility. (encode_array): Use HOST_WIDE_INT_PRINT_DEC instead of "%ld". (encode_type): Handle the 'const' qualifier here. (objc_parmlist): New global variable, sued by objc_push_parm and objc_get_parm_info(). (objc_push_parm, objc_get_parm_info): New functions. (objc_expr_last): Remove function. (synth_self_and_ucmd_args): For instance methods, use the instance type for 'self'; call objc_push_parm() instead of push_parm_decl(). (start_method_def): Do not call push_scope(), declare_parm_level(), pop_scope(), push_parm_decl(), store_parm_decls() or objc_expr_last(); just use objc_push_parm() and objc_get_parm_info(). (comp_method_with_proto): Remove function. (objc_types_are_equivalent): Strip away indirections before comparing underlying types. (comp_proto_with_proto): Do not call groktypename(); types are no longer in raw declspec format. (objc_start_function): New function. (really_start_method): Call comp_proto_with_proto() instead of comp_method_with_proto(); call objc_start_function() instead of hand-crafting a function declarator. (continue_method_def, objc_expand_function_end): Remove functions. (get_super_receiver): Call objc_get_current_scope() instead of get_current_scope(); reference 'super_class' field (instead of 'class'). (finish_method_def): Rename to objc_finish_method_definition() and add a function decl parameter; move method encoding call from objc_expand_function_end(). (is_complex_decl, adorn_decl, gen_declarator, gen_declspecs, gen_declaration_1): Remove functions. (tmpbuf, RAW_DECLSPEC): Remove. (gen_declaration): Remove second parameter; simplify to deal with TYPE_P nodes instead of raw declspecs. (gen_type_name, gen_type_name_0): New functions. (gen_method_decl): Remove second parameter; call gen_type_name() instead of gen_declaration_1(). (dump_interface): Adjust calls to gen_declaration() and gen_method_decl(); do not allocate a separate string buffer. (init_objc): Allocate a larger string buffer to accommodate dump_interface(); adjust call to build_module_descriptor(); add call to build_module_initializer_routine() for the GNU runtime. (generate_classref_translation_entry): Do not call start_decl(); call finish_var_decl() instead of finish_decl(); call convert() instead of build_c_cast(). * objc-act.h (CLASS_OWN_IVARS): Remove accessor. (CLASS_BINFO_ELTS): Reduce from 6 to 5, now that CLASS_OWN_IVARS is gone. (OCTI_GNU_INIT_DECL, GNU_INIT_decl): New. (OCTI_ELLIPSIS_NODE, objc_ellipsis_node): Remove. (OCTI_ID_ID, id_type, objc_id_id): Rename to OCTI_ID_NAME, objc_object_type and objc_object_name, respectively. (OCTI_CLS_REF, OCTI_CLASS_NAME, objc_class_reference, objc_class_name): New. (IS_CLASS): New macro. (IS_ID, IS_SUPER): Robustify. (OCTI_EXECCLASS_DECL, execclass_decl): New. (finish_file, start_class, continue_class, finish_class, start_method_def, continue_method_def, finish_method_def, start_protocol, finish_protocol, objc_build_throw_stmt, objc_build_try_catch_finally_stmt, objc_build_synchronized_prologue, objc_build_synchronized_epilogue, objc_build_try_prologue, objc_build_try_epilogue, objc_build_catch_stmt, objc_build_catch_epilogue, objc_build_finally_prologue, objc_build_finally_epilogue, is_ivar, is_private, is_public, add_instance_variable, objc_add_method, get_super_receiver, objc_clear_super_receiver, get_class_ivars_from_name, get_class_reference, get_static_reference, get_object_reference, build_message_expr, finish_message_expr, build_selector_expr, build_ivar_reference, build_keyword_decl, build_method_decl, build_protocol_expr, build_objc_string_object, objc_declare_alias, objc_declare_class, objc_declare_protocols, objc_comptypes, objc_check_decl, build_encode_expr): Remove prototypes. (imp_count, cat_count): Make GGC-aware. (OBJC_SET_TYPE_NAME): New macro. From-SVN: r87168
2004-09-08 02:49:44 +02:00
c-tree.h (enum c_declarator_kind, [...]): New. * c-tree.h (enum c_declarator_kind, struct c_arg_info, struct c_declarator, struct c_type_name, struct c_parm): New. (build_array_declarator, set_array_declarator_inner, get_parm_info, grokfield, groktypename, grokparm, push_parm_decl, start_function, start_decl, build_c_parm, build_attrs_declarator, build_function_declarator, make_pointer_declarator, c_cast_expr, store_parm_decls_newstyle, c_expr_sizeof_type): Update prototypes. (build_id_declarator): New. * c-typeck.c (c_cast_expr, c_expr_sizeof_type): Update to new structures. * c-decl.c (ARG_INFO_PARMS, ARG_INFO_TAGS, ARG_INFO_TYPES, ARG_INFO_OTHERS): Remove. (build_id_declarator): New. (build_array_declarator, set_array_declarator_inner, groktypename, start_decl, grokparm, push_parm_decl, grokparms, get_parm_info, grokfield, start_function, store_parm_decls_newstyle, store_parm_decls_oldstyle, store_parm_decls, build_c_parm, build_attrs_declarator, build_function_declarator, make_pointer_declarator, grokdeclarator): Update to new structures. * c-parse.in (%union): Add arginfotype, dtrtype, typenametype and parmtype. (declarator, notype_declarator, after_type_declarator, parm_declarator, parm_declarator_starttypename, parm_declarator_nostarttypename, array_declarator, typename, absdcl, absdcl1, absdcl1_ea, absdcl1_noea, direct_absdcl1, absdcl_maybe_attribute, parm, firstparm, parms, parmlist, parmlist_1, parmlist_2, parmlist_or_identifiers, parmlist_or_identifiers_1): Use these types. (primary, after_type_declarator, parm_declarator_starttypename, notype_declarator, component_decl, component_declarator, component_notype_declarator, typename, absdcl, absdcl_maybe_attribute, absdcl1_ea, direct_absdcl1, parmlist_1, parmlist_2, parmlist_or_identifiers_1): Update to new structures. objc: * objc-act.c (objc_start_function, really_start_method, objc_get_parm_info, start_method_def): Update to new arg_info structures. From-SVN: r87217
2004-09-09 03:19:15 +02:00
really_start_method (objc_method_context, parm_info);
1992-01-18 00:15:38 +01:00
}
static void
warn_with_method (const char *message, int mtype, tree method)
1992-01-18 00:15:38 +01:00
{
/* Add a readable method name to the warning. */
diagnostic.c (warning): Accept parameter to classify warning option. * diagnostic.c (warning): Accept parameter to classify warning option. (warning0): New, for when a pointer to an error() like function is needed. * errors.c (warning): Likewise. * errors.h (warning, warning0): Adjust prototypes. * toplev.h (warning, warning0): Likewise. * attribs.c, builtins.c, c-common.c, c-decl.c, c-format.c, c-gimplify.c, c-lex.c, c-objc-common.c, c-opts.c, c-parser.c, c-pragma.c, c-typeck.c, calls.c, cgraph.c, coverage.c, emit-rtl.c, fold-const.c, fortran/trans-decl.c, function.c, gcse.c, genautomata.c, haifa-sched.c, opts.c, passes.c, regclass.c, reload1.c, stmt.c, stor-layout.c, toplev.c, tree-cfg.c, tree-dump.c, tree-inline.c, tree-mudflap.c, tree-optimize.c, tree-ssa.c, tree.c, varasm.c: Adjust warning() callers. * config/alpha/alpha.c, config/arc/arc.c, config/arm/arm.c, config/avr/avr.c, config/bfin/bfin.c, config/c4x/c4x-c.c, config/c4x/c4x.c, config/cris/cris.c, config/darwin-c.c, config/darwin.c, config/darwin.h, config/h8300/h8300.c, config/i386/cygming.h, config/i386/djgpp.h, config/i386/i386.c, config/i386/winnt.c, config/ia64/ia64-c.c, config/ia64/ia64.c, config/ip2k/ip2k.c, config/m32r/m32r.c, config/m68hc11/m68hc11.c, config/m68k/m68k.c, config/mcore/mcore.c, config/mips/mips.c, config/mmix/mmix.c, config/ns32k/ns32k.c, config/pa/pa-hpux11.h, config/pa/pa.c, config/rs6000/aix43.h, config/rs6000/aix51.h, config/rs6000/aix52.h, config/rs6000/darwin.h, config/rs6000/rs6000-c.c, config/rs6000/rs6000.c, config/s390/s390.c, config/sh/sh.c, config/sh/sh.h, config/sh/symbian.c, config/sol2-c.c, config/sol2.c, config/stormy16/stormy16.c, config/v850/v850-c.c, config/v850/v850.c, config/xtensa/xtensa.c: Adjust warning() callers. * ada/misc.c: Adjust warning() callers. * cp/call.c, cp/class.c, cp/cvt.c, cp/decl.c, cp/decl2.c, cp/except.c, cp/friend.c, cp/init.c, cp/lex.c, cp/mangle.c, cp/method.c, cp/name-lookup.c, cp/parser.c, cp/repo.c, cp/rtti.c, cp/tree.c, cp/typeck.c, cp/typeck2.c: Adjust warning() callers. * fortran/trans-decl.c: Adjust warning() callers. * java/class.c, java/decl.c, java/expr.c, java/jcf-io.c, java/jcf-parse.c, java/jv-scan.c, java/parse.y: Adjust warning() callers. * objc/objc-act.c: Adjust warning() callers. * treelang/parse.y: Adjust warning() callers. From-SVN: r98633
2005-04-23 23:29:07 +02:00
warning (0, "%J%s %<%c%s%>", method,
Makefile.in (c-parse.o): Depend on $(C_COMMON_H). [gcc/ChangeLog] 2004-09-07 Ziemowit Laski <zlaski@apple.com> * Makefile.in (c-parse.o): Depend on $(C_COMMON_H). * c-parse.in: Include c-common.h instead of objc-act.h. (ivar_decl_list, ivar_decls, ivar_decl, ivars, ivar_declarator, myparms, myparm): Remove %type declarations. (methodtype, optparms, OBJC_TYPE_QUAL, objc_quals, objc_qual, objc_typename, objc_try_catch_stmt, optellipsis): Add %type declarations. (objc_inherit_code, objc_public_flag): Remove. (typespec_nonreserved_nonattr): Call objc_get_protocol_qualified_type() instead of get_static_reference() and get_protocol_reference(). (stmt_nocomp): Call grokparm() on @catch parameter. (objcdef): Move semantic action to objc_finish_implementation(). (classdef): Move semantic action to objc_start_class_interface(), objc_continue_interface(), objc_finish_interface(), objc_start_class_implementation(), objc_continue_implementation(), objc_start_category_interface() and objc_start_category_implementation(). (protocoldef): Move semantic actions to objc_start_protocol() and objc_finish_interface(). (ivar_decl_list): Remove nonterminal. (visibility_spec): Move semantic actions to objc_set_visibility(). (ivar_decls): Remove assignment to $$. (ivar_decl): Rephrase in terms of component_decl; call objc_add_instance_variable(). (ivars, ivar_declarator): Remove nonterminals. (opt_semi): New nonterminal. (methodtype): Remove semantic actions. (methoddef): Move semantic actions to objc_set_method_type(), objc_start_method_definition() and objc_finish_method_definition(). (methodproto): Move semantic actions to objc_set_method_type() and objc_add_method_declaration(). (methoddecl): Use objc_typename instead of typename; move semantic actions to objc_build_method_signature(). (optarglist, myxdecls, mydecl, myparms, myparm): Remove nonterminals. (optparmlist): Express in terms of optparms and optellipsis. (optparms, optellipsis, objc_qual, objc_quals, objc_typename): New nonterminals. (keyworddecl): Use objc_typename instead of typename. (rid_to_yy): Mark RID_IN, RID_OUT, RID_INOUT, RID_BYCOPY, RID_BYREF and RID_ONEWAY as returning OBJC_TYPE_QUAL to yyparse(). [gcc/objc/ChangeLog] 2004-09-07 Ziemowit Laski <zlaski@apple.com> * Make-lang.in (objc/objc-parse.o): Depend on $(C_COMMON_H) instead of objc/objc-act.h. (objc/objc-act.o): Depend on $(HASHTAB_H). * objc-act.c: Include hashtab.h; in ObjC++ mode, include cp-tree.h and objcp-decl.h instead of c-tree.h. (build_module_descriptor, get_class_ivars, synth_id_with_class_suffix, error_with_ivar, gen_method_decl, gen_declaration, setup_string_decl, build_protocol_template): Adjust prototypes. (build_module_initializer_routine, start_class, continue_class, finish_class, start_method_def, objc_start_function, start_protocol, build_method_decl, objc_add_method, add_instance_variable, build_ivar_reference, is_ivar, is_private, get_super_receiver, build_selector_table_decl, objc_push_parm, objc_get_parm_info, gen_type_name, gen_type_name_0, start_var_decl, finish_var_decl, create_field_decl): New prototypes. (objc_expand_function_end, comp_method_with_proto, objc_expr_last, gen_declaration_1, gen_declarator, is_complex_decl, adorn_decl, define_decl, create_builtin_decl, gen_declspecs): Remove prototypes. (TYPE_ID): Rename to OBJECT_TYPEDEF_NAME. (CLASS_TYPEDEF_NAME): New. (TAG_EXECCLASS): Change from a global variable to a #define. (TAG_RETURN_STRUCT): Delete. (TAG_GNUINIT): New, holds '__objc_gnu_init' name. (objc_inherit_code, objc_public_flag): New, moved from c-parse.in. (string_descriptor): New struct. (string_htab): New hash table. (string_hash, string_eq): New prototypes. (generate_struct_by_value_array): Call create_field_decl() instead of create_builtin_decl(). (objc_init): Do not initialize objc_ellipsis_node or TAG_EXECCLASS; In ObjC++ mode, call cxx_init() instead of c_objc_common_init(). (objc_finish_file): In ObjC++, call instantiate_pending_templates() and cp_finish_file(). (define_decl, get_static_reference, get_protocol_reference, create_builtin_decl): Remove functions. (objc_start_class_interface, objc_start_category_interface, objc_start_protocol, objc_continue_interface, objc_finish_interface, objc_start_class_implementation, objc_start_category_implementation, objc_continue_implementation, objc_finish_implementation, objc_set_visibility, objc_set_method_type, objc_build_method_signature, objc_add_method_declaration, objc_start_method_definition, objc_add_instance_variable, objc_get_protocol_qualified_type, create_field_decl, start_var_decl, finish_var_decl): New functions. (setup_string_decl): Simplify since it is only called once. (synth_module_prologue): Call build_class_template(); predefine 'id' and 'Class' as typedefs; rename 'temp_type' to 'type'; disable debug hooks for duration of function; fix GNU runtime messenger signatures to correspond to reality; forward-declare '__objc_exec_class' for the GNU runtime; call build_selector_table_decl(); in ObjC++ mode, generate 'extern "C" { ... }' wrappers around synthesized declarations; call build_protocol_template() and build_category_template(). (string_hash, string_eq): New functions. (objc_build_string_object): Check metaclass correctness only once; store string literals in hash table. (objc_build_constructor): Do not convert initializer elements; adjust for ObjC++ impedance mismatch. (build_objc_symtab_template): Call create_field_decl() instead of create_builtin_decl(). (init_objc_symtab): Add missing conversion to initializer element. (build_metadata_decl): Call start_var_decl() instead of define_decl(). (generate_objc_symtab_decl): Do not call build_category_template(); call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(). (build_module_descriptor): Call create_field_decl() instead of grokfield(); call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(); always mark module descriptor as used; move GNU runtime-specific functionality to build_module_initializer_routine(). (build_module_initializer_routine): New function, broken off of build_module_descriptor(). (objc_static_init_needed_p, objc_generate_static_init_call): New functions. (generate_static_references, generate_strings, build_selector_translation_table, generate_descriptor_table, generate_ivars_list, generate_dispatch_table, generate_category): Call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(); build a type directly instead of via groktypename(). (build_selector_reference_decl, build_selector_table_decl, build_class_reference_decl, build_protocol_reference, generate_objc_image_info): Call start_var_decl() instead of build_decl(). (build_selector_reference): For GNU runtime, do not call build_selector_reference_decl(). (build_selector, build_typed_selector_reference): Always convert result to the selector type. (add_objc_string): Cast return value to 'char *'. (build_method_prototype_template, build_selector_template, build_method_template): Use actual selector type for fields pointing to selectors. (finish_objc): For GNU runtime, call build_module_initializer_routine() after build_module_descriptor(). (generate_protocol_list, generate_shared_structures): Call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(); build a type directly instead of via groktypename(). (synth_id_with_class_suffix): Return a string. (get_arg_type_list): For instance methods, use the instance type for 'self'; do not call groktypename_in_parm_context(). (build_objc_string_decl): Squash redeclaration errors in ObjC++. (objc_is_class_name): Use OBJC_TYPE_NAME instead of TYPE_NAME; handle RECORD_TYPEs in ObjC as well as ObjC++. (objc_is_id): New function. (objc_is_object_ptr): Return the canonical type node. (objc_get_class_ivars): Simplify using get_class_ivars(). (get_class_ivars): Remove second parameter; create a fresh copy of the ivar list for each call; do not check for existence of super class. (objc_eh_runtime_type): Mark #ifndef OBJCPLUS. (objc_init_exceptions): When using SJLJ-style exceptions, require the use of '-fobjc-exceptions' flag; do not require it for DWARF-style exceptions. (objc_build_exc_ptr, next_sjlj_build_try_catch_finally): Use objc_object_type instead of objc_id_type. (objc_begin_catch_clause): Convert the incoming PARM_DECL into a VAR_DECL before placing it in the appropriate scope; do not call define_decl(); adjust call to c_begin_compound_stmt(); use objc_object_type instead of objc_id_type. (build_next_objc_exception_stuff): Call create_field_decl() instead of create_builtin_decl(); construct type directly instead of calling groktypename(); use OBJC_VOID_AT_END to mark end of function parameters. (build_private_template): Adjust call to get_class_ivars(); build a type directly instead of via groktypename(). (build_protocol_template, build_method_prototype_list_template, build_method_prototype_template, build_category_template, build_selector_template, build_class_template, build_super_template, build_ivar_template, build_ivar_list_template, build_method_list_template, build_method_template): Call create_field_decl() instead of grokfield(). (objc_method_parm_type): Do not call groktypename(). (generate_descriptor_table): Call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(). (generate_method_descriptors, build_protocol_initializer, generate_dispatch_tables, build_category_initializer, build_shared_structure_initializer): Do not call groktypename(). (generate_protocols): Call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(); do not call groktypename(). (error_with_ivar): Remove last parameter. (check_ivars): Do not iterate ovar CLASS_RAW_IVARS lists in addition to CLASS_IVARS lists; adjust calls to error_with_ivar(). (generate_ivar_lists): Convert one of the initializer elements; do not call groktypename(). (get_arg_type_list, start_method_def, gen_method_def): Account for new representation of variable arguments and '...' in Objective-C methods; add Objective-C++ impedance matching code. (is_objc_type_qualifier): Remove function. (adjust_type_for_id_default): Simplify; there is no longer a need to wade through declspecs. (lookup_interface, start_class, continue_class, finish_class, start_method_def, start_protocol, build_method_decl, objc_add_method, add_instance_variable, build_ivar_reference, is_ivar, is_private, get_super_receiver, objc_build_finally_epilogue): Make into static functions. (receiver_is_class_object): Use new IS_CLASS() macro. (objc_build_message_expr): Tweak ObjC++ message argument handling; call objc_finish_message_expr() instead of finish_message_expr(). (finish_message_expr): Rename to objc_finish_message_expr(); use OBJC_TYPE_NAME and OBJC_SET_TYPE_NAME macros instead of TYPE_NAME. call gen_type_name() instead of gen_declaration(); call objc_is_id() instead of using IS_ID and IS_CLASS; Use objc_class_name instead of calling get_identifier("Class"); handle CONVERT_EXPRs in receiver. (build_objc_method_call, warn_with_method): Do not call groktypename(). (build_ivar_reference): Call convert() instead of clobbering in a type. (hash_init): Initialize string_htab hash table. (add_instance_variable): Simplify parameter list; do not call grokfield(); do not populate CLASS_IVARS list. (start_class): Check for the existence of super class, if one was specified. (continue_class): Use CLASS_RAW_IVARS rather than CLASS_IVARS; do not call build_class_template(); adjust call to get_class_ivars(); call build_decl(), pushdecl() and finish_decl() instead of define_decl(). (finish_class): Call build_decl(), pushdecl() and finish_decl() instead of define_decl(). (add_protocols): Use PROTOCOL_BINFO_ELTS for the tree vector size. (start_protocol): Do not call build_protocol_template(); use PROTOCOL_BINFO_ELTS for the tree vector size. (encode_type_qualifiers): Do not handle the 'const' qualifier here. (encode_pointer): Encode 'const char *' as 'r*', for backwards compatibility. (encode_array): Use HOST_WIDE_INT_PRINT_DEC instead of "%ld". (encode_type): Handle the 'const' qualifier here. (objc_parmlist): New global variable, sued by objc_push_parm and objc_get_parm_info(). (objc_push_parm, objc_get_parm_info): New functions. (objc_expr_last): Remove function. (synth_self_and_ucmd_args): For instance methods, use the instance type for 'self'; call objc_push_parm() instead of push_parm_decl(). (start_method_def): Do not call push_scope(), declare_parm_level(), pop_scope(), push_parm_decl(), store_parm_decls() or objc_expr_last(); just use objc_push_parm() and objc_get_parm_info(). (comp_method_with_proto): Remove function. (objc_types_are_equivalent): Strip away indirections before comparing underlying types. (comp_proto_with_proto): Do not call groktypename(); types are no longer in raw declspec format. (objc_start_function): New function. (really_start_method): Call comp_proto_with_proto() instead of comp_method_with_proto(); call objc_start_function() instead of hand-crafting a function declarator. (continue_method_def, objc_expand_function_end): Remove functions. (get_super_receiver): Call objc_get_current_scope() instead of get_current_scope(); reference 'super_class' field (instead of 'class'). (finish_method_def): Rename to objc_finish_method_definition() and add a function decl parameter; move method encoding call from objc_expand_function_end(). (is_complex_decl, adorn_decl, gen_declarator, gen_declspecs, gen_declaration_1): Remove functions. (tmpbuf, RAW_DECLSPEC): Remove. (gen_declaration): Remove second parameter; simplify to deal with TYPE_P nodes instead of raw declspecs. (gen_type_name, gen_type_name_0): New functions. (gen_method_decl): Remove second parameter; call gen_type_name() instead of gen_declaration_1(). (dump_interface): Adjust calls to gen_declaration() and gen_method_decl(); do not allocate a separate string buffer. (init_objc): Allocate a larger string buffer to accommodate dump_interface(); adjust call to build_module_descriptor(); add call to build_module_initializer_routine() for the GNU runtime. (generate_classref_translation_entry): Do not call start_decl(); call finish_var_decl() instead of finish_decl(); call convert() instead of build_c_cast(). * objc-act.h (CLASS_OWN_IVARS): Remove accessor. (CLASS_BINFO_ELTS): Reduce from 6 to 5, now that CLASS_OWN_IVARS is gone. (OCTI_GNU_INIT_DECL, GNU_INIT_decl): New. (OCTI_ELLIPSIS_NODE, objc_ellipsis_node): Remove. (OCTI_ID_ID, id_type, objc_id_id): Rename to OCTI_ID_NAME, objc_object_type and objc_object_name, respectively. (OCTI_CLS_REF, OCTI_CLASS_NAME, objc_class_reference, objc_class_name): New. (IS_CLASS): New macro. (IS_ID, IS_SUPER): Robustify. (OCTI_EXECCLASS_DECL, execclass_decl): New. (finish_file, start_class, continue_class, finish_class, start_method_def, continue_method_def, finish_method_def, start_protocol, finish_protocol, objc_build_throw_stmt, objc_build_try_catch_finally_stmt, objc_build_synchronized_prologue, objc_build_synchronized_epilogue, objc_build_try_prologue, objc_build_try_epilogue, objc_build_catch_stmt, objc_build_catch_epilogue, objc_build_finally_prologue, objc_build_finally_epilogue, is_ivar, is_private, is_public, add_instance_variable, objc_add_method, get_super_receiver, objc_clear_super_receiver, get_class_ivars_from_name, get_class_reference, get_static_reference, get_object_reference, build_message_expr, finish_message_expr, build_selector_expr, build_ivar_reference, build_keyword_decl, build_method_decl, build_protocol_expr, build_objc_string_object, objc_declare_alias, objc_declare_class, objc_declare_protocols, objc_comptypes, objc_check_decl, build_encode_expr): Remove prototypes. (imp_count, cat_count): Make GGC-aware. (OBJC_SET_TYPE_NAME): New macro. From-SVN: r87168
2004-09-08 02:49:44 +02:00
message, mtype, gen_method_decl (method));
1992-01-18 00:15:38 +01:00
}
Makefile.in (c-parse.o): Depend on $(C_COMMON_H). [gcc/ChangeLog] 2004-09-07 Ziemowit Laski <zlaski@apple.com> * Makefile.in (c-parse.o): Depend on $(C_COMMON_H). * c-parse.in: Include c-common.h instead of objc-act.h. (ivar_decl_list, ivar_decls, ivar_decl, ivars, ivar_declarator, myparms, myparm): Remove %type declarations. (methodtype, optparms, OBJC_TYPE_QUAL, objc_quals, objc_qual, objc_typename, objc_try_catch_stmt, optellipsis): Add %type declarations. (objc_inherit_code, objc_public_flag): Remove. (typespec_nonreserved_nonattr): Call objc_get_protocol_qualified_type() instead of get_static_reference() and get_protocol_reference(). (stmt_nocomp): Call grokparm() on @catch parameter. (objcdef): Move semantic action to objc_finish_implementation(). (classdef): Move semantic action to objc_start_class_interface(), objc_continue_interface(), objc_finish_interface(), objc_start_class_implementation(), objc_continue_implementation(), objc_start_category_interface() and objc_start_category_implementation(). (protocoldef): Move semantic actions to objc_start_protocol() and objc_finish_interface(). (ivar_decl_list): Remove nonterminal. (visibility_spec): Move semantic actions to objc_set_visibility(). (ivar_decls): Remove assignment to $$. (ivar_decl): Rephrase in terms of component_decl; call objc_add_instance_variable(). (ivars, ivar_declarator): Remove nonterminals. (opt_semi): New nonterminal. (methodtype): Remove semantic actions. (methoddef): Move semantic actions to objc_set_method_type(), objc_start_method_definition() and objc_finish_method_definition(). (methodproto): Move semantic actions to objc_set_method_type() and objc_add_method_declaration(). (methoddecl): Use objc_typename instead of typename; move semantic actions to objc_build_method_signature(). (optarglist, myxdecls, mydecl, myparms, myparm): Remove nonterminals. (optparmlist): Express in terms of optparms and optellipsis. (optparms, optellipsis, objc_qual, objc_quals, objc_typename): New nonterminals. (keyworddecl): Use objc_typename instead of typename. (rid_to_yy): Mark RID_IN, RID_OUT, RID_INOUT, RID_BYCOPY, RID_BYREF and RID_ONEWAY as returning OBJC_TYPE_QUAL to yyparse(). [gcc/objc/ChangeLog] 2004-09-07 Ziemowit Laski <zlaski@apple.com> * Make-lang.in (objc/objc-parse.o): Depend on $(C_COMMON_H) instead of objc/objc-act.h. (objc/objc-act.o): Depend on $(HASHTAB_H). * objc-act.c: Include hashtab.h; in ObjC++ mode, include cp-tree.h and objcp-decl.h instead of c-tree.h. (build_module_descriptor, get_class_ivars, synth_id_with_class_suffix, error_with_ivar, gen_method_decl, gen_declaration, setup_string_decl, build_protocol_template): Adjust prototypes. (build_module_initializer_routine, start_class, continue_class, finish_class, start_method_def, objc_start_function, start_protocol, build_method_decl, objc_add_method, add_instance_variable, build_ivar_reference, is_ivar, is_private, get_super_receiver, build_selector_table_decl, objc_push_parm, objc_get_parm_info, gen_type_name, gen_type_name_0, start_var_decl, finish_var_decl, create_field_decl): New prototypes. (objc_expand_function_end, comp_method_with_proto, objc_expr_last, gen_declaration_1, gen_declarator, is_complex_decl, adorn_decl, define_decl, create_builtin_decl, gen_declspecs): Remove prototypes. (TYPE_ID): Rename to OBJECT_TYPEDEF_NAME. (CLASS_TYPEDEF_NAME): New. (TAG_EXECCLASS): Change from a global variable to a #define. (TAG_RETURN_STRUCT): Delete. (TAG_GNUINIT): New, holds '__objc_gnu_init' name. (objc_inherit_code, objc_public_flag): New, moved from c-parse.in. (string_descriptor): New struct. (string_htab): New hash table. (string_hash, string_eq): New prototypes. (generate_struct_by_value_array): Call create_field_decl() instead of create_builtin_decl(). (objc_init): Do not initialize objc_ellipsis_node or TAG_EXECCLASS; In ObjC++ mode, call cxx_init() instead of c_objc_common_init(). (objc_finish_file): In ObjC++, call instantiate_pending_templates() and cp_finish_file(). (define_decl, get_static_reference, get_protocol_reference, create_builtin_decl): Remove functions. (objc_start_class_interface, objc_start_category_interface, objc_start_protocol, objc_continue_interface, objc_finish_interface, objc_start_class_implementation, objc_start_category_implementation, objc_continue_implementation, objc_finish_implementation, objc_set_visibility, objc_set_method_type, objc_build_method_signature, objc_add_method_declaration, objc_start_method_definition, objc_add_instance_variable, objc_get_protocol_qualified_type, create_field_decl, start_var_decl, finish_var_decl): New functions. (setup_string_decl): Simplify since it is only called once. (synth_module_prologue): Call build_class_template(); predefine 'id' and 'Class' as typedefs; rename 'temp_type' to 'type'; disable debug hooks for duration of function; fix GNU runtime messenger signatures to correspond to reality; forward-declare '__objc_exec_class' for the GNU runtime; call build_selector_table_decl(); in ObjC++ mode, generate 'extern "C" { ... }' wrappers around synthesized declarations; call build_protocol_template() and build_category_template(). (string_hash, string_eq): New functions. (objc_build_string_object): Check metaclass correctness only once; store string literals in hash table. (objc_build_constructor): Do not convert initializer elements; adjust for ObjC++ impedance mismatch. (build_objc_symtab_template): Call create_field_decl() instead of create_builtin_decl(). (init_objc_symtab): Add missing conversion to initializer element. (build_metadata_decl): Call start_var_decl() instead of define_decl(). (generate_objc_symtab_decl): Do not call build_category_template(); call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(). (build_module_descriptor): Call create_field_decl() instead of grokfield(); call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(); always mark module descriptor as used; move GNU runtime-specific functionality to build_module_initializer_routine(). (build_module_initializer_routine): New function, broken off of build_module_descriptor(). (objc_static_init_needed_p, objc_generate_static_init_call): New functions. (generate_static_references, generate_strings, build_selector_translation_table, generate_descriptor_table, generate_ivars_list, generate_dispatch_table, generate_category): Call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(); build a type directly instead of via groktypename(). (build_selector_reference_decl, build_selector_table_decl, build_class_reference_decl, build_protocol_reference, generate_objc_image_info): Call start_var_decl() instead of build_decl(). (build_selector_reference): For GNU runtime, do not call build_selector_reference_decl(). (build_selector, build_typed_selector_reference): Always convert result to the selector type. (add_objc_string): Cast return value to 'char *'. (build_method_prototype_template, build_selector_template, build_method_template): Use actual selector type for fields pointing to selectors. (finish_objc): For GNU runtime, call build_module_initializer_routine() after build_module_descriptor(). (generate_protocol_list, generate_shared_structures): Call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(); build a type directly instead of via groktypename(). (synth_id_with_class_suffix): Return a string. (get_arg_type_list): For instance methods, use the instance type for 'self'; do not call groktypename_in_parm_context(). (build_objc_string_decl): Squash redeclaration errors in ObjC++. (objc_is_class_name): Use OBJC_TYPE_NAME instead of TYPE_NAME; handle RECORD_TYPEs in ObjC as well as ObjC++. (objc_is_id): New function. (objc_is_object_ptr): Return the canonical type node. (objc_get_class_ivars): Simplify using get_class_ivars(). (get_class_ivars): Remove second parameter; create a fresh copy of the ivar list for each call; do not check for existence of super class. (objc_eh_runtime_type): Mark #ifndef OBJCPLUS. (objc_init_exceptions): When using SJLJ-style exceptions, require the use of '-fobjc-exceptions' flag; do not require it for DWARF-style exceptions. (objc_build_exc_ptr, next_sjlj_build_try_catch_finally): Use objc_object_type instead of objc_id_type. (objc_begin_catch_clause): Convert the incoming PARM_DECL into a VAR_DECL before placing it in the appropriate scope; do not call define_decl(); adjust call to c_begin_compound_stmt(); use objc_object_type instead of objc_id_type. (build_next_objc_exception_stuff): Call create_field_decl() instead of create_builtin_decl(); construct type directly instead of calling groktypename(); use OBJC_VOID_AT_END to mark end of function parameters. (build_private_template): Adjust call to get_class_ivars(); build a type directly instead of via groktypename(). (build_protocol_template, build_method_prototype_list_template, build_method_prototype_template, build_category_template, build_selector_template, build_class_template, build_super_template, build_ivar_template, build_ivar_list_template, build_method_list_template, build_method_template): Call create_field_decl() instead of grokfield(). (objc_method_parm_type): Do not call groktypename(). (generate_descriptor_table): Call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(). (generate_method_descriptors, build_protocol_initializer, generate_dispatch_tables, build_category_initializer, build_shared_structure_initializer): Do not call groktypename(). (generate_protocols): Call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(); do not call groktypename(). (error_with_ivar): Remove last parameter. (check_ivars): Do not iterate ovar CLASS_RAW_IVARS lists in addition to CLASS_IVARS lists; adjust calls to error_with_ivar(). (generate_ivar_lists): Convert one of the initializer elements; do not call groktypename(). (get_arg_type_list, start_method_def, gen_method_def): Account for new representation of variable arguments and '...' in Objective-C methods; add Objective-C++ impedance matching code. (is_objc_type_qualifier): Remove function. (adjust_type_for_id_default): Simplify; there is no longer a need to wade through declspecs. (lookup_interface, start_class, continue_class, finish_class, start_method_def, start_protocol, build_method_decl, objc_add_method, add_instance_variable, build_ivar_reference, is_ivar, is_private, get_super_receiver, objc_build_finally_epilogue): Make into static functions. (receiver_is_class_object): Use new IS_CLASS() macro. (objc_build_message_expr): Tweak ObjC++ message argument handling; call objc_finish_message_expr() instead of finish_message_expr(). (finish_message_expr): Rename to objc_finish_message_expr(); use OBJC_TYPE_NAME and OBJC_SET_TYPE_NAME macros instead of TYPE_NAME. call gen_type_name() instead of gen_declaration(); call objc_is_id() instead of using IS_ID and IS_CLASS; Use objc_class_name instead of calling get_identifier("Class"); handle CONVERT_EXPRs in receiver. (build_objc_method_call, warn_with_method): Do not call groktypename(). (build_ivar_reference): Call convert() instead of clobbering in a type. (hash_init): Initialize string_htab hash table. (add_instance_variable): Simplify parameter list; do not call grokfield(); do not populate CLASS_IVARS list. (start_class): Check for the existence of super class, if one was specified. (continue_class): Use CLASS_RAW_IVARS rather than CLASS_IVARS; do not call build_class_template(); adjust call to get_class_ivars(); call build_decl(), pushdecl() and finish_decl() instead of define_decl(). (finish_class): Call build_decl(), pushdecl() and finish_decl() instead of define_decl(). (add_protocols): Use PROTOCOL_BINFO_ELTS for the tree vector size. (start_protocol): Do not call build_protocol_template(); use PROTOCOL_BINFO_ELTS for the tree vector size. (encode_type_qualifiers): Do not handle the 'const' qualifier here. (encode_pointer): Encode 'const char *' as 'r*', for backwards compatibility. (encode_array): Use HOST_WIDE_INT_PRINT_DEC instead of "%ld". (encode_type): Handle the 'const' qualifier here. (objc_parmlist): New global variable, sued by objc_push_parm and objc_get_parm_info(). (objc_push_parm, objc_get_parm_info): New functions. (objc_expr_last): Remove function. (synth_self_and_ucmd_args): For instance methods, use the instance type for 'self'; call objc_push_parm() instead of push_parm_decl(). (start_method_def): Do not call push_scope(), declare_parm_level(), pop_scope(), push_parm_decl(), store_parm_decls() or objc_expr_last(); just use objc_push_parm() and objc_get_parm_info(). (comp_method_with_proto): Remove function. (objc_types_are_equivalent): Strip away indirections before comparing underlying types. (comp_proto_with_proto): Do not call groktypename(); types are no longer in raw declspec format. (objc_start_function): New function. (really_start_method): Call comp_proto_with_proto() instead of comp_method_with_proto(); call objc_start_function() instead of hand-crafting a function declarator. (continue_method_def, objc_expand_function_end): Remove functions. (get_super_receiver): Call objc_get_current_scope() instead of get_current_scope(); reference 'super_class' field (instead of 'class'). (finish_method_def): Rename to objc_finish_method_definition() and add a function decl parameter; move method encoding call from objc_expand_function_end(). (is_complex_decl, adorn_decl, gen_declarator, gen_declspecs, gen_declaration_1): Remove functions. (tmpbuf, RAW_DECLSPEC): Remove. (gen_declaration): Remove second parameter; simplify to deal with TYPE_P nodes instead of raw declspecs. (gen_type_name, gen_type_name_0): New functions. (gen_method_decl): Remove second parameter; call gen_type_name() instead of gen_declaration_1(). (dump_interface): Adjust calls to gen_declaration() and gen_method_decl(); do not allocate a separate string buffer. (init_objc): Allocate a larger string buffer to accommodate dump_interface(); adjust call to build_module_descriptor(); add call to build_module_initializer_routine() for the GNU runtime. (generate_classref_translation_entry): Do not call start_decl(); call finish_var_decl() instead of finish_decl(); call convert() instead of build_c_cast(). * objc-act.h (CLASS_OWN_IVARS): Remove accessor. (CLASS_BINFO_ELTS): Reduce from 6 to 5, now that CLASS_OWN_IVARS is gone. (OCTI_GNU_INIT_DECL, GNU_INIT_decl): New. (OCTI_ELLIPSIS_NODE, objc_ellipsis_node): Remove. (OCTI_ID_ID, id_type, objc_id_id): Rename to OCTI_ID_NAME, objc_object_type and objc_object_name, respectively. (OCTI_CLS_REF, OCTI_CLASS_NAME, objc_class_reference, objc_class_name): New. (IS_CLASS): New macro. (IS_ID, IS_SUPER): Robustify. (OCTI_EXECCLASS_DECL, execclass_decl): New. (finish_file, start_class, continue_class, finish_class, start_method_def, continue_method_def, finish_method_def, start_protocol, finish_protocol, objc_build_throw_stmt, objc_build_try_catch_finally_stmt, objc_build_synchronized_prologue, objc_build_synchronized_epilogue, objc_build_try_prologue, objc_build_try_epilogue, objc_build_catch_stmt, objc_build_catch_epilogue, objc_build_finally_prologue, objc_build_finally_epilogue, is_ivar, is_private, is_public, add_instance_variable, objc_add_method, get_super_receiver, objc_clear_super_receiver, get_class_ivars_from_name, get_class_reference, get_static_reference, get_object_reference, build_message_expr, finish_message_expr, build_selector_expr, build_ivar_reference, build_keyword_decl, build_method_decl, build_protocol_expr, build_objc_string_object, objc_declare_alias, objc_declare_class, objc_declare_protocols, objc_comptypes, objc_check_decl, build_encode_expr): Remove prototypes. (imp_count, cat_count): Make GGC-aware. (OBJC_SET_TYPE_NAME): New macro. From-SVN: r87168
2004-09-08 02:49:44 +02:00
/* Return 1 if TYPE1 is equivalent to TYPE2
for purposes of method overloading. */
1992-01-18 00:15:38 +01:00
static int
objc_types_are_equivalent (tree type1, tree type2)
1992-01-18 00:15:38 +01:00
{
if (type1 == type2)
return 1;
Makefile.in (c-parse.o): Depend on $(C_COMMON_H). [gcc/ChangeLog] 2004-09-07 Ziemowit Laski <zlaski@apple.com> * Makefile.in (c-parse.o): Depend on $(C_COMMON_H). * c-parse.in: Include c-common.h instead of objc-act.h. (ivar_decl_list, ivar_decls, ivar_decl, ivars, ivar_declarator, myparms, myparm): Remove %type declarations. (methodtype, optparms, OBJC_TYPE_QUAL, objc_quals, objc_qual, objc_typename, objc_try_catch_stmt, optellipsis): Add %type declarations. (objc_inherit_code, objc_public_flag): Remove. (typespec_nonreserved_nonattr): Call objc_get_protocol_qualified_type() instead of get_static_reference() and get_protocol_reference(). (stmt_nocomp): Call grokparm() on @catch parameter. (objcdef): Move semantic action to objc_finish_implementation(). (classdef): Move semantic action to objc_start_class_interface(), objc_continue_interface(), objc_finish_interface(), objc_start_class_implementation(), objc_continue_implementation(), objc_start_category_interface() and objc_start_category_implementation(). (protocoldef): Move semantic actions to objc_start_protocol() and objc_finish_interface(). (ivar_decl_list): Remove nonterminal. (visibility_spec): Move semantic actions to objc_set_visibility(). (ivar_decls): Remove assignment to $$. (ivar_decl): Rephrase in terms of component_decl; call objc_add_instance_variable(). (ivars, ivar_declarator): Remove nonterminals. (opt_semi): New nonterminal. (methodtype): Remove semantic actions. (methoddef): Move semantic actions to objc_set_method_type(), objc_start_method_definition() and objc_finish_method_definition(). (methodproto): Move semantic actions to objc_set_method_type() and objc_add_method_declaration(). (methoddecl): Use objc_typename instead of typename; move semantic actions to objc_build_method_signature(). (optarglist, myxdecls, mydecl, myparms, myparm): Remove nonterminals. (optparmlist): Express in terms of optparms and optellipsis. (optparms, optellipsis, objc_qual, objc_quals, objc_typename): New nonterminals. (keyworddecl): Use objc_typename instead of typename. (rid_to_yy): Mark RID_IN, RID_OUT, RID_INOUT, RID_BYCOPY, RID_BYREF and RID_ONEWAY as returning OBJC_TYPE_QUAL to yyparse(). [gcc/objc/ChangeLog] 2004-09-07 Ziemowit Laski <zlaski@apple.com> * Make-lang.in (objc/objc-parse.o): Depend on $(C_COMMON_H) instead of objc/objc-act.h. (objc/objc-act.o): Depend on $(HASHTAB_H). * objc-act.c: Include hashtab.h; in ObjC++ mode, include cp-tree.h and objcp-decl.h instead of c-tree.h. (build_module_descriptor, get_class_ivars, synth_id_with_class_suffix, error_with_ivar, gen_method_decl, gen_declaration, setup_string_decl, build_protocol_template): Adjust prototypes. (build_module_initializer_routine, start_class, continue_class, finish_class, start_method_def, objc_start_function, start_protocol, build_method_decl, objc_add_method, add_instance_variable, build_ivar_reference, is_ivar, is_private, get_super_receiver, build_selector_table_decl, objc_push_parm, objc_get_parm_info, gen_type_name, gen_type_name_0, start_var_decl, finish_var_decl, create_field_decl): New prototypes. (objc_expand_function_end, comp_method_with_proto, objc_expr_last, gen_declaration_1, gen_declarator, is_complex_decl, adorn_decl, define_decl, create_builtin_decl, gen_declspecs): Remove prototypes. (TYPE_ID): Rename to OBJECT_TYPEDEF_NAME. (CLASS_TYPEDEF_NAME): New. (TAG_EXECCLASS): Change from a global variable to a #define. (TAG_RETURN_STRUCT): Delete. (TAG_GNUINIT): New, holds '__objc_gnu_init' name. (objc_inherit_code, objc_public_flag): New, moved from c-parse.in. (string_descriptor): New struct. (string_htab): New hash table. (string_hash, string_eq): New prototypes. (generate_struct_by_value_array): Call create_field_decl() instead of create_builtin_decl(). (objc_init): Do not initialize objc_ellipsis_node or TAG_EXECCLASS; In ObjC++ mode, call cxx_init() instead of c_objc_common_init(). (objc_finish_file): In ObjC++, call instantiate_pending_templates() and cp_finish_file(). (define_decl, get_static_reference, get_protocol_reference, create_builtin_decl): Remove functions. (objc_start_class_interface, objc_start_category_interface, objc_start_protocol, objc_continue_interface, objc_finish_interface, objc_start_class_implementation, objc_start_category_implementation, objc_continue_implementation, objc_finish_implementation, objc_set_visibility, objc_set_method_type, objc_build_method_signature, objc_add_method_declaration, objc_start_method_definition, objc_add_instance_variable, objc_get_protocol_qualified_type, create_field_decl, start_var_decl, finish_var_decl): New functions. (setup_string_decl): Simplify since it is only called once. (synth_module_prologue): Call build_class_template(); predefine 'id' and 'Class' as typedefs; rename 'temp_type' to 'type'; disable debug hooks for duration of function; fix GNU runtime messenger signatures to correspond to reality; forward-declare '__objc_exec_class' for the GNU runtime; call build_selector_table_decl(); in ObjC++ mode, generate 'extern "C" { ... }' wrappers around synthesized declarations; call build_protocol_template() and build_category_template(). (string_hash, string_eq): New functions. (objc_build_string_object): Check metaclass correctness only once; store string literals in hash table. (objc_build_constructor): Do not convert initializer elements; adjust for ObjC++ impedance mismatch. (build_objc_symtab_template): Call create_field_decl() instead of create_builtin_decl(). (init_objc_symtab): Add missing conversion to initializer element. (build_metadata_decl): Call start_var_decl() instead of define_decl(). (generate_objc_symtab_decl): Do not call build_category_template(); call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(). (build_module_descriptor): Call create_field_decl() instead of grokfield(); call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(); always mark module descriptor as used; move GNU runtime-specific functionality to build_module_initializer_routine(). (build_module_initializer_routine): New function, broken off of build_module_descriptor(). (objc_static_init_needed_p, objc_generate_static_init_call): New functions. (generate_static_references, generate_strings, build_selector_translation_table, generate_descriptor_table, generate_ivars_list, generate_dispatch_table, generate_category): Call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(); build a type directly instead of via groktypename(). (build_selector_reference_decl, build_selector_table_decl, build_class_reference_decl, build_protocol_reference, generate_objc_image_info): Call start_var_decl() instead of build_decl(). (build_selector_reference): For GNU runtime, do not call build_selector_reference_decl(). (build_selector, build_typed_selector_reference): Always convert result to the selector type. (add_objc_string): Cast return value to 'char *'. (build_method_prototype_template, build_selector_template, build_method_template): Use actual selector type for fields pointing to selectors. (finish_objc): For GNU runtime, call build_module_initializer_routine() after build_module_descriptor(). (generate_protocol_list, generate_shared_structures): Call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(); build a type directly instead of via groktypename(). (synth_id_with_class_suffix): Return a string. (get_arg_type_list): For instance methods, use the instance type for 'self'; do not call groktypename_in_parm_context(). (build_objc_string_decl): Squash redeclaration errors in ObjC++. (objc_is_class_name): Use OBJC_TYPE_NAME instead of TYPE_NAME; handle RECORD_TYPEs in ObjC as well as ObjC++. (objc_is_id): New function. (objc_is_object_ptr): Return the canonical type node. (objc_get_class_ivars): Simplify using get_class_ivars(). (get_class_ivars): Remove second parameter; create a fresh copy of the ivar list for each call; do not check for existence of super class. (objc_eh_runtime_type): Mark #ifndef OBJCPLUS. (objc_init_exceptions): When using SJLJ-style exceptions, require the use of '-fobjc-exceptions' flag; do not require it for DWARF-style exceptions. (objc_build_exc_ptr, next_sjlj_build_try_catch_finally): Use objc_object_type instead of objc_id_type. (objc_begin_catch_clause): Convert the incoming PARM_DECL into a VAR_DECL before placing it in the appropriate scope; do not call define_decl(); adjust call to c_begin_compound_stmt(); use objc_object_type instead of objc_id_type. (build_next_objc_exception_stuff): Call create_field_decl() instead of create_builtin_decl(); construct type directly instead of calling groktypename(); use OBJC_VOID_AT_END to mark end of function parameters. (build_private_template): Adjust call to get_class_ivars(); build a type directly instead of via groktypename(). (build_protocol_template, build_method_prototype_list_template, build_method_prototype_template, build_category_template, build_selector_template, build_class_template, build_super_template, build_ivar_template, build_ivar_list_template, build_method_list_template, build_method_template): Call create_field_decl() instead of grokfield(). (objc_method_parm_type): Do not call groktypename(). (generate_descriptor_table): Call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(). (generate_method_descriptors, build_protocol_initializer, generate_dispatch_tables, build_category_initializer, build_shared_structure_initializer): Do not call groktypename(). (generate_protocols): Call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(); do not call groktypename(). (error_with_ivar): Remove last parameter. (check_ivars): Do not iterate ovar CLASS_RAW_IVARS lists in addition to CLASS_IVARS lists; adjust calls to error_with_ivar(). (generate_ivar_lists): Convert one of the initializer elements; do not call groktypename(). (get_arg_type_list, start_method_def, gen_method_def): Account for new representation of variable arguments and '...' in Objective-C methods; add Objective-C++ impedance matching code. (is_objc_type_qualifier): Remove function. (adjust_type_for_id_default): Simplify; there is no longer a need to wade through declspecs. (lookup_interface, start_class, continue_class, finish_class, start_method_def, start_protocol, build_method_decl, objc_add_method, add_instance_variable, build_ivar_reference, is_ivar, is_private, get_super_receiver, objc_build_finally_epilogue): Make into static functions. (receiver_is_class_object): Use new IS_CLASS() macro. (objc_build_message_expr): Tweak ObjC++ message argument handling; call objc_finish_message_expr() instead of finish_message_expr(). (finish_message_expr): Rename to objc_finish_message_expr(); use OBJC_TYPE_NAME and OBJC_SET_TYPE_NAME macros instead of TYPE_NAME. call gen_type_name() instead of gen_declaration(); call objc_is_id() instead of using IS_ID and IS_CLASS; Use objc_class_name instead of calling get_identifier("Class"); handle CONVERT_EXPRs in receiver. (build_objc_method_call, warn_with_method): Do not call groktypename(). (build_ivar_reference): Call convert() instead of clobbering in a type. (hash_init): Initialize string_htab hash table. (add_instance_variable): Simplify parameter list; do not call grokfield(); do not populate CLASS_IVARS list. (start_class): Check for the existence of super class, if one was specified. (continue_class): Use CLASS_RAW_IVARS rather than CLASS_IVARS; do not call build_class_template(); adjust call to get_class_ivars(); call build_decl(), pushdecl() and finish_decl() instead of define_decl(). (finish_class): Call build_decl(), pushdecl() and finish_decl() instead of define_decl(). (add_protocols): Use PROTOCOL_BINFO_ELTS for the tree vector size. (start_protocol): Do not call build_protocol_template(); use PROTOCOL_BINFO_ELTS for the tree vector size. (encode_type_qualifiers): Do not handle the 'const' qualifier here. (encode_pointer): Encode 'const char *' as 'r*', for backwards compatibility. (encode_array): Use HOST_WIDE_INT_PRINT_DEC instead of "%ld". (encode_type): Handle the 'const' qualifier here. (objc_parmlist): New global variable, sued by objc_push_parm and objc_get_parm_info(). (objc_push_parm, objc_get_parm_info): New functions. (objc_expr_last): Remove function. (synth_self_and_ucmd_args): For instance methods, use the instance type for 'self'; call objc_push_parm() instead of push_parm_decl(). (start_method_def): Do not call push_scope(), declare_parm_level(), pop_scope(), push_parm_decl(), store_parm_decls() or objc_expr_last(); just use objc_push_parm() and objc_get_parm_info(). (comp_method_with_proto): Remove function. (objc_types_are_equivalent): Strip away indirections before comparing underlying types. (comp_proto_with_proto): Do not call groktypename(); types are no longer in raw declspec format. (objc_start_function): New function. (really_start_method): Call comp_proto_with_proto() instead of comp_method_with_proto(); call objc_start_function() instead of hand-crafting a function declarator. (continue_method_def, objc_expand_function_end): Remove functions. (get_super_receiver): Call objc_get_current_scope() instead of get_current_scope(); reference 'super_class' field (instead of 'class'). (finish_method_def): Rename to objc_finish_method_definition() and add a function decl parameter; move method encoding call from objc_expand_function_end(). (is_complex_decl, adorn_decl, gen_declarator, gen_declspecs, gen_declaration_1): Remove functions. (tmpbuf, RAW_DECLSPEC): Remove. (gen_declaration): Remove second parameter; simplify to deal with TYPE_P nodes instead of raw declspecs. (gen_type_name, gen_type_name_0): New functions. (gen_method_decl): Remove second parameter; call gen_type_name() instead of gen_declaration_1(). (dump_interface): Adjust calls to gen_declaration() and gen_method_decl(); do not allocate a separate string buffer. (init_objc): Allocate a larger string buffer to accommodate dump_interface(); adjust call to build_module_descriptor(); add call to build_module_initializer_routine() for the GNU runtime. (generate_classref_translation_entry): Do not call start_decl(); call finish_var_decl() instead of finish_decl(); call convert() instead of build_c_cast(). * objc-act.h (CLASS_OWN_IVARS): Remove accessor. (CLASS_BINFO_ELTS): Reduce from 6 to 5, now that CLASS_OWN_IVARS is gone. (OCTI_GNU_INIT_DECL, GNU_INIT_decl): New. (OCTI_ELLIPSIS_NODE, objc_ellipsis_node): Remove. (OCTI_ID_ID, id_type, objc_id_id): Rename to OCTI_ID_NAME, objc_object_type and objc_object_name, respectively. (OCTI_CLS_REF, OCTI_CLASS_NAME, objc_class_reference, objc_class_name): New. (IS_CLASS): New macro. (IS_ID, IS_SUPER): Robustify. (OCTI_EXECCLASS_DECL, execclass_decl): New. (finish_file, start_class, continue_class, finish_class, start_method_def, continue_method_def, finish_method_def, start_protocol, finish_protocol, objc_build_throw_stmt, objc_build_try_catch_finally_stmt, objc_build_synchronized_prologue, objc_build_synchronized_epilogue, objc_build_try_prologue, objc_build_try_epilogue, objc_build_catch_stmt, objc_build_catch_epilogue, objc_build_finally_prologue, objc_build_finally_epilogue, is_ivar, is_private, is_public, add_instance_variable, objc_add_method, get_super_receiver, objc_clear_super_receiver, get_class_ivars_from_name, get_class_reference, get_static_reference, get_object_reference, build_message_expr, finish_message_expr, build_selector_expr, build_ivar_reference, build_keyword_decl, build_method_decl, build_protocol_expr, build_objc_string_object, objc_declare_alias, objc_declare_class, objc_declare_protocols, objc_comptypes, objc_check_decl, build_encode_expr): Remove prototypes. (imp_count, cat_count): Make GGC-aware. (OBJC_SET_TYPE_NAME): New macro. From-SVN: r87168
2004-09-08 02:49:44 +02:00
/* Strip away indirections. */
while ((TREE_CODE (type1) == ARRAY_TYPE || TREE_CODE (type1) == POINTER_TYPE)
&& (TREE_CODE (type1) == TREE_CODE (type2)))
type1 = TREE_TYPE (type1), type2 = TREE_TYPE (type2);
if (TYPE_MAIN_VARIANT (type1) != TYPE_MAIN_VARIANT (type2))
return 0;
Makefile.in (c-parse.o): Depend on $(C_COMMON_H). [gcc/ChangeLog] 2004-09-07 Ziemowit Laski <zlaski@apple.com> * Makefile.in (c-parse.o): Depend on $(C_COMMON_H). * c-parse.in: Include c-common.h instead of objc-act.h. (ivar_decl_list, ivar_decls, ivar_decl, ivars, ivar_declarator, myparms, myparm): Remove %type declarations. (methodtype, optparms, OBJC_TYPE_QUAL, objc_quals, objc_qual, objc_typename, objc_try_catch_stmt, optellipsis): Add %type declarations. (objc_inherit_code, objc_public_flag): Remove. (typespec_nonreserved_nonattr): Call objc_get_protocol_qualified_type() instead of get_static_reference() and get_protocol_reference(). (stmt_nocomp): Call grokparm() on @catch parameter. (objcdef): Move semantic action to objc_finish_implementation(). (classdef): Move semantic action to objc_start_class_interface(), objc_continue_interface(), objc_finish_interface(), objc_start_class_implementation(), objc_continue_implementation(), objc_start_category_interface() and objc_start_category_implementation(). (protocoldef): Move semantic actions to objc_start_protocol() and objc_finish_interface(). (ivar_decl_list): Remove nonterminal. (visibility_spec): Move semantic actions to objc_set_visibility(). (ivar_decls): Remove assignment to $$. (ivar_decl): Rephrase in terms of component_decl; call objc_add_instance_variable(). (ivars, ivar_declarator): Remove nonterminals. (opt_semi): New nonterminal. (methodtype): Remove semantic actions. (methoddef): Move semantic actions to objc_set_method_type(), objc_start_method_definition() and objc_finish_method_definition(). (methodproto): Move semantic actions to objc_set_method_type() and objc_add_method_declaration(). (methoddecl): Use objc_typename instead of typename; move semantic actions to objc_build_method_signature(). (optarglist, myxdecls, mydecl, myparms, myparm): Remove nonterminals. (optparmlist): Express in terms of optparms and optellipsis. (optparms, optellipsis, objc_qual, objc_quals, objc_typename): New nonterminals. (keyworddecl): Use objc_typename instead of typename. (rid_to_yy): Mark RID_IN, RID_OUT, RID_INOUT, RID_BYCOPY, RID_BYREF and RID_ONEWAY as returning OBJC_TYPE_QUAL to yyparse(). [gcc/objc/ChangeLog] 2004-09-07 Ziemowit Laski <zlaski@apple.com> * Make-lang.in (objc/objc-parse.o): Depend on $(C_COMMON_H) instead of objc/objc-act.h. (objc/objc-act.o): Depend on $(HASHTAB_H). * objc-act.c: Include hashtab.h; in ObjC++ mode, include cp-tree.h and objcp-decl.h instead of c-tree.h. (build_module_descriptor, get_class_ivars, synth_id_with_class_suffix, error_with_ivar, gen_method_decl, gen_declaration, setup_string_decl, build_protocol_template): Adjust prototypes. (build_module_initializer_routine, start_class, continue_class, finish_class, start_method_def, objc_start_function, start_protocol, build_method_decl, objc_add_method, add_instance_variable, build_ivar_reference, is_ivar, is_private, get_super_receiver, build_selector_table_decl, objc_push_parm, objc_get_parm_info, gen_type_name, gen_type_name_0, start_var_decl, finish_var_decl, create_field_decl): New prototypes. (objc_expand_function_end, comp_method_with_proto, objc_expr_last, gen_declaration_1, gen_declarator, is_complex_decl, adorn_decl, define_decl, create_builtin_decl, gen_declspecs): Remove prototypes. (TYPE_ID): Rename to OBJECT_TYPEDEF_NAME. (CLASS_TYPEDEF_NAME): New. (TAG_EXECCLASS): Change from a global variable to a #define. (TAG_RETURN_STRUCT): Delete. (TAG_GNUINIT): New, holds '__objc_gnu_init' name. (objc_inherit_code, objc_public_flag): New, moved from c-parse.in. (string_descriptor): New struct. (string_htab): New hash table. (string_hash, string_eq): New prototypes. (generate_struct_by_value_array): Call create_field_decl() instead of create_builtin_decl(). (objc_init): Do not initialize objc_ellipsis_node or TAG_EXECCLASS; In ObjC++ mode, call cxx_init() instead of c_objc_common_init(). (objc_finish_file): In ObjC++, call instantiate_pending_templates() and cp_finish_file(). (define_decl, get_static_reference, get_protocol_reference, create_builtin_decl): Remove functions. (objc_start_class_interface, objc_start_category_interface, objc_start_protocol, objc_continue_interface, objc_finish_interface, objc_start_class_implementation, objc_start_category_implementation, objc_continue_implementation, objc_finish_implementation, objc_set_visibility, objc_set_method_type, objc_build_method_signature, objc_add_method_declaration, objc_start_method_definition, objc_add_instance_variable, objc_get_protocol_qualified_type, create_field_decl, start_var_decl, finish_var_decl): New functions. (setup_string_decl): Simplify since it is only called once. (synth_module_prologue): Call build_class_template(); predefine 'id' and 'Class' as typedefs; rename 'temp_type' to 'type'; disable debug hooks for duration of function; fix GNU runtime messenger signatures to correspond to reality; forward-declare '__objc_exec_class' for the GNU runtime; call build_selector_table_decl(); in ObjC++ mode, generate 'extern "C" { ... }' wrappers around synthesized declarations; call build_protocol_template() and build_category_template(). (string_hash, string_eq): New functions. (objc_build_string_object): Check metaclass correctness only once; store string literals in hash table. (objc_build_constructor): Do not convert initializer elements; adjust for ObjC++ impedance mismatch. (build_objc_symtab_template): Call create_field_decl() instead of create_builtin_decl(). (init_objc_symtab): Add missing conversion to initializer element. (build_metadata_decl): Call start_var_decl() instead of define_decl(). (generate_objc_symtab_decl): Do not call build_category_template(); call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(). (build_module_descriptor): Call create_field_decl() instead of grokfield(); call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(); always mark module descriptor as used; move GNU runtime-specific functionality to build_module_initializer_routine(). (build_module_initializer_routine): New function, broken off of build_module_descriptor(). (objc_static_init_needed_p, objc_generate_static_init_call): New functions. (generate_static_references, generate_strings, build_selector_translation_table, generate_descriptor_table, generate_ivars_list, generate_dispatch_table, generate_category): Call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(); build a type directly instead of via groktypename(). (build_selector_reference_decl, build_selector_table_decl, build_class_reference_decl, build_protocol_reference, generate_objc_image_info): Call start_var_decl() instead of build_decl(). (build_selector_reference): For GNU runtime, do not call build_selector_reference_decl(). (build_selector, build_typed_selector_reference): Always convert result to the selector type. (add_objc_string): Cast return value to 'char *'. (build_method_prototype_template, build_selector_template, build_method_template): Use actual selector type for fields pointing to selectors. (finish_objc): For GNU runtime, call build_module_initializer_routine() after build_module_descriptor(). (generate_protocol_list, generate_shared_structures): Call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(); build a type directly instead of via groktypename(). (synth_id_with_class_suffix): Return a string. (get_arg_type_list): For instance methods, use the instance type for 'self'; do not call groktypename_in_parm_context(). (build_objc_string_decl): Squash redeclaration errors in ObjC++. (objc_is_class_name): Use OBJC_TYPE_NAME instead of TYPE_NAME; handle RECORD_TYPEs in ObjC as well as ObjC++. (objc_is_id): New function. (objc_is_object_ptr): Return the canonical type node. (objc_get_class_ivars): Simplify using get_class_ivars(). (get_class_ivars): Remove second parameter; create a fresh copy of the ivar list for each call; do not check for existence of super class. (objc_eh_runtime_type): Mark #ifndef OBJCPLUS. (objc_init_exceptions): When using SJLJ-style exceptions, require the use of '-fobjc-exceptions' flag; do not require it for DWARF-style exceptions. (objc_build_exc_ptr, next_sjlj_build_try_catch_finally): Use objc_object_type instead of objc_id_type. (objc_begin_catch_clause): Convert the incoming PARM_DECL into a VAR_DECL before placing it in the appropriate scope; do not call define_decl(); adjust call to c_begin_compound_stmt(); use objc_object_type instead of objc_id_type. (build_next_objc_exception_stuff): Call create_field_decl() instead of create_builtin_decl(); construct type directly instead of calling groktypename(); use OBJC_VOID_AT_END to mark end of function parameters. (build_private_template): Adjust call to get_class_ivars(); build a type directly instead of via groktypename(). (build_protocol_template, build_method_prototype_list_template, build_method_prototype_template, build_category_template, build_selector_template, build_class_template, build_super_template, build_ivar_template, build_ivar_list_template, build_method_list_template, build_method_template): Call create_field_decl() instead of grokfield(). (objc_method_parm_type): Do not call groktypename(). (generate_descriptor_table): Call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(). (generate_method_descriptors, build_protocol_initializer, generate_dispatch_tables, build_category_initializer, build_shared_structure_initializer): Do not call groktypename(). (generate_protocols): Call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(); do not call groktypename(). (error_with_ivar): Remove last parameter. (check_ivars): Do not iterate ovar CLASS_RAW_IVARS lists in addition to CLASS_IVARS lists; adjust calls to error_with_ivar(). (generate_ivar_lists): Convert one of the initializer elements; do not call groktypename(). (get_arg_type_list, start_method_def, gen_method_def): Account for new representation of variable arguments and '...' in Objective-C methods; add Objective-C++ impedance matching code. (is_objc_type_qualifier): Remove function. (adjust_type_for_id_default): Simplify; there is no longer a need to wade through declspecs. (lookup_interface, start_class, continue_class, finish_class, start_method_def, start_protocol, build_method_decl, objc_add_method, add_instance_variable, build_ivar_reference, is_ivar, is_private, get_super_receiver, objc_build_finally_epilogue): Make into static functions. (receiver_is_class_object): Use new IS_CLASS() macro. (objc_build_message_expr): Tweak ObjC++ message argument handling; call objc_finish_message_expr() instead of finish_message_expr(). (finish_message_expr): Rename to objc_finish_message_expr(); use OBJC_TYPE_NAME and OBJC_SET_TYPE_NAME macros instead of TYPE_NAME. call gen_type_name() instead of gen_declaration(); call objc_is_id() instead of using IS_ID and IS_CLASS; Use objc_class_name instead of calling get_identifier("Class"); handle CONVERT_EXPRs in receiver. (build_objc_method_call, warn_with_method): Do not call groktypename(). (build_ivar_reference): Call convert() instead of clobbering in a type. (hash_init): Initialize string_htab hash table. (add_instance_variable): Simplify parameter list; do not call grokfield(); do not populate CLASS_IVARS list. (start_class): Check for the existence of super class, if one was specified. (continue_class): Use CLASS_RAW_IVARS rather than CLASS_IVARS; do not call build_class_template(); adjust call to get_class_ivars(); call build_decl(), pushdecl() and finish_decl() instead of define_decl(). (finish_class): Call build_decl(), pushdecl() and finish_decl() instead of define_decl(). (add_protocols): Use PROTOCOL_BINFO_ELTS for the tree vector size. (start_protocol): Do not call build_protocol_template(); use PROTOCOL_BINFO_ELTS for the tree vector size. (encode_type_qualifiers): Do not handle the 'const' qualifier here. (encode_pointer): Encode 'const char *' as 'r*', for backwards compatibility. (encode_array): Use HOST_WIDE_INT_PRINT_DEC instead of "%ld". (encode_type): Handle the 'const' qualifier here. (objc_parmlist): New global variable, sued by objc_push_parm and objc_get_parm_info(). (objc_push_parm, objc_get_parm_info): New functions. (objc_expr_last): Remove function. (synth_self_and_ucmd_args): For instance methods, use the instance type for 'self'; call objc_push_parm() instead of push_parm_decl(). (start_method_def): Do not call push_scope(), declare_parm_level(), pop_scope(), push_parm_decl(), store_parm_decls() or objc_expr_last(); just use objc_push_parm() and objc_get_parm_info(). (comp_method_with_proto): Remove function. (objc_types_are_equivalent): Strip away indirections before comparing underlying types. (comp_proto_with_proto): Do not call groktypename(); types are no longer in raw declspec format. (objc_start_function): New function. (really_start_method): Call comp_proto_with_proto() instead of comp_method_with_proto(); call objc_start_function() instead of hand-crafting a function declarator. (continue_method_def, objc_expand_function_end): Remove functions. (get_super_receiver): Call objc_get_current_scope() instead of get_current_scope(); reference 'super_class' field (instead of 'class'). (finish_method_def): Rename to objc_finish_method_definition() and add a function decl parameter; move method encoding call from objc_expand_function_end(). (is_complex_decl, adorn_decl, gen_declarator, gen_declspecs, gen_declaration_1): Remove functions. (tmpbuf, RAW_DECLSPEC): Remove. (gen_declaration): Remove second parameter; simplify to deal with TYPE_P nodes instead of raw declspecs. (gen_type_name, gen_type_name_0): New functions. (gen_method_decl): Remove second parameter; call gen_type_name() instead of gen_declaration_1(). (dump_interface): Adjust calls to gen_declaration() and gen_method_decl(); do not allocate a separate string buffer. (init_objc): Allocate a larger string buffer to accommodate dump_interface(); adjust call to build_module_descriptor(); add call to build_module_initializer_routine() for the GNU runtime. (generate_classref_translation_entry): Do not call start_decl(); call finish_var_decl() instead of finish_decl(); call convert() instead of build_c_cast(). * objc-act.h (CLASS_OWN_IVARS): Remove accessor. (CLASS_BINFO_ELTS): Reduce from 6 to 5, now that CLASS_OWN_IVARS is gone. (OCTI_GNU_INIT_DECL, GNU_INIT_decl): New. (OCTI_ELLIPSIS_NODE, objc_ellipsis_node): Remove. (OCTI_ID_ID, id_type, objc_id_id): Rename to OCTI_ID_NAME, objc_object_type and objc_object_name, respectively. (OCTI_CLS_REF, OCTI_CLASS_NAME, objc_class_reference, objc_class_name): New. (IS_CLASS): New macro. (IS_ID, IS_SUPER): Robustify. (OCTI_EXECCLASS_DECL, execclass_decl): New. (finish_file, start_class, continue_class, finish_class, start_method_def, continue_method_def, finish_method_def, start_protocol, finish_protocol, objc_build_throw_stmt, objc_build_try_catch_finally_stmt, objc_build_synchronized_prologue, objc_build_synchronized_epilogue, objc_build_try_prologue, objc_build_try_epilogue, objc_build_catch_stmt, objc_build_catch_epilogue, objc_build_finally_prologue, objc_build_finally_epilogue, is_ivar, is_private, is_public, add_instance_variable, objc_add_method, get_super_receiver, objc_clear_super_receiver, get_class_ivars_from_name, get_class_reference, get_static_reference, get_object_reference, build_message_expr, finish_message_expr, build_selector_expr, build_ivar_reference, build_keyword_decl, build_method_decl, build_protocol_expr, build_objc_string_object, objc_declare_alias, objc_declare_class, objc_declare_protocols, objc_comptypes, objc_check_decl, build_encode_expr): Remove prototypes. (imp_count, cat_count): Make GGC-aware. (OBJC_SET_TYPE_NAME): New macro. From-SVN: r87168
2004-09-08 02:49:44 +02:00
objc-act.c (build_private_template): Change to return 'void'... [gcc/objc/ChangeLog] 2004-12-15 Ziemowit Laski <zlaski@apple.com> * objc-act.c (build_private_template): Change to return 'void'; do not set ivar_context, uprivate_record or objc_instance_type. (objc_comptypes, gen_type_name_0): For types 'id' and 'Class', retrieve protocol list from the pointee rather than the pointer itself; check TYPE_HAS_OBJC_INFO(...) precondition before accessing TYPE_OBJC_PROTOCOL_LIST. (objc_get_protocol_qualified_type): For types 'id' and 'Class', construct a variant of the pointee as well as the pointer, and store protocol information in the former. When creating variants of RECORD_TYPEs, clone their TYPE_LANG_SPECIFIC fields and propagate TYPE_OBJC_INTERFACE information. (objc_declare_class): If a TYPE_DECL is looked up, retrieve the underlying RECORD_TYPE to check for presence of TYPE_OBJC_INTERFACE; for newly-created RECORD_TYPEs, create a tentative TYPE_OBJC_INTERFACE holding an IDENTIFIER_NODE. (objc_finish_message_expr): Check TYPE_HAS_OBJC_INFO(...) before accessing TYPE_OBJC_PROTOCOL_LIST; Use TYPE_OBJC_INTERFACE instead of calling lookup_interface(); allow for TYPE_OBJC_INTERFACE holding an IDENTIFIER_NODE (meaning a @class forward-declaration only). (objc_is_public): Check TYPE_OBJC_INTERFACE instead of calling lookup_interface(). (continue_class): For @implementations, set ivar_context, uprivate_record and objc_instance_type, for @interfaces, call build_private_template(). (encode_pointer): Check TYPE_HAS_OBJC_INFO(...) before accessing TYPE_OBJC_INTERFACE. (objc_types_are_equivalent): Check TYPE_HAS_OBJC_INFO(...) before accessing TYPE_OBJC_PROTOCOL_LIST. * objc-act.h (OBJC_INFO_SLOT_ELTS, TYPE_OBJC_INFO, INIT_TYPE_OBJC_INFO, DUP_TYPE_OBJC_INFO, ALLOC_OBJC_TYPE_LANG_SPECIFIC, SIZEOF_OBJC_TYPE_LANG_SPECIFIC): New macros. (TYPE_OBJC_INTERFACE): Replaces TREE_STATIC_INSTANCE and now points to an actual @interface; stored in TYPE_LANG_SPECIFIC(...). (TYPE_OBJC_PROTOCOL_LIST): Replaces TYPE_PROTOCOL_LIST; stored in TYPE_LANG_SPECIFIC(...). (TREE_STATIC_INSTANCE, TYPE_PROTOCOL_LIST): Delete. (IS_ID, IS_CLASS, IS_PROTOCOL_QUALIFIED_UNTYPED, IS_SUPER, TYPED_OBJECT): Check for POINTER_TYPE rather than POINTER_TYPE_P; adjust for use of TYPE_OBJC_INTERFACE and TYPE_OBJC_PROTOCOL_LIST instead of TREE_STATIC_INSTANCE and TYPE_PROTOCOL_LIST. From-SVN: r92239
2004-12-16 02:10:38 +01:00
type1 = (TYPE_HAS_OBJC_INFO (type1)
? TYPE_OBJC_PROTOCOL_LIST (type1)
: NULL_TREE);
type2 = (TYPE_HAS_OBJC_INFO (type2)
? TYPE_OBJC_PROTOCOL_LIST (type2)
: NULL_TREE);
if (list_length (type1) == list_length (type2))
{
for (; type2; type2 = TREE_CHAIN (type2))
if (!lookup_protocol_in_reflist (type1, TREE_VALUE (type2)))
return 0;
return 1;
}
return 0;
}
Yet more Objective-C++... * objc-act.c (objc_finish_try_stmt): Add return value. (objc_build_synchronized): Likewise. * objc-act.c (objc_is_gcable_type): Add. (objc_substitute_decl): Add. (objc_build_ivar_assignment): Add. (objc_build_global_assignment): Add. (objc_build_strong_cast_assignment): Add. (objc_is_ivar_reference_p): Add. (objc_is_global_reference_p): Add. (objc_generate_write_barrier): Add. (objc_rewrite_function_call): Add. (objc_gimplify_expr): Add Objective-C++ support. * objc-act.h (ALLOC_OBJC_TYPE_LANG_SPECIFIC): Likewise. (SIZEOF_OBJC_TYPE_LANG_SPECIFIC): Add. (INIT_TYPE_OBJC_INFO): Add Objective-C++ support. (DUP_TYPE_OBJC_INFO): Likewise. (struct imp_entry): Add field has_cxx_cdtors. (struct imp_entry *imp_list): Add OCTI_UMSG_FAST_DECL, OCTI_METH_LIST_TEMPL, OCTI_METH_PROTO_LIST_TEMPL, OCTI_IVAR_LIST_TEMPL, OCTI_ASSIGN_IVAR_DECL, OCTI_ASSIGN_IVAR_FAST_DECL, OCTI_ASSIGN_GLOBAL_DECL, OCTI_ASSIGN_STRONGCAST_DECL. (umsg_fast_decl): Add. (objc_assign_ivar_decl): Add. (objc_assign_ivar_fast_decl): Add. (objc_assign_global_decl): Add. (objc_assign_strong_cast_decl): Add. (objc_method_list_ptr): Add. (objc_method_proto_list_ptr): Add. (objc_ivar_list_ptr): Add. * objc-act.c (should_call_super_dealloc): Add. (OBJC_VERSION): Bump to 6. (objc_is_gcable_type): Add. (objc_substitute_decl): Add. (objc_build_ivar_assignment): Add. (objc_build_global_assignment): Add. (objc_build_strong_cast_assignment): Add. (objc_is_gcable_p): Add. (objc_is_ivar_reference_p): Add. (objc_is_global_reference_p): Add. (generate_shared_structures): Add flags parameter. (objc_generate_cxx_ctor_or_dtor): Add. (objc_generate_cxx_cdtors): Add. (add_class): Add name parameter. (objc_types_share_size_and_alignment): Add. (comp_proto_with_proto): Add strict parameter. (CLS_HAS_CXX_STRUCTORS): Add. (TAG_ASSIGNIVAR): Add. (TAG_ASSIGNGLOBAL): Add. (TAG_ASSIGNSTRONGCAST): Add. (TAG_MSGSEND_FAST): Add. (TAG_ASSIGNIVAR_FAST): Add. (TAG_CXX_CONSTRUCT): Add. (TAG_CXX_DESTRUCT): Add. (OBJC_LOOKUP_CLASS): Add. (OBJC_LOOKUP_NO_SUPER): Add. (objc_finish_file): Add pch support. (objc_finish_implementation): Add Objective-C++ support. (synth_module_prologue): Likewise. (synth_module_prologue): Add fast dispatching. (objc_get_class_reference): Add Objective-C++ support. (objc_generate_write_barrier): Likewise. (next_sjlj_build_enter_and_setjmp): Likewise. (objc_begin_try_stmt): Likewise. (build_next_objc_exception_stuff): Add fast ivar support. (build_private_template): Mark the record as used so debug information is generated. (build_protocol_template): Add Objective-C++ support. (objc_method_parm_type) Likewise. (objc_generate_cxx_ctor_or_dtor): Likewise. (objc_generate_cxx_cdtors): Likewise. (build_protocol_initializer): Likewise. (build_category_template): Likewise. (build_class_template): Likewise. (build_method_list_template): Likewise. (build_category_initializer): Likewise. (build_shared_structure_initializer): Likewise. (objc_finish_message_expr): Likewise. (build_objc_method_call): Add fast dispatch support. (lookup_method_static): Add support to end search at superclasses. (add_method_to_hash_list): Add strict parameter to comp_proto_with_proto. (objc_add_method): Likewise. (objc_add_method): Also set the interface_value. (add_instance_variable): Add Objective-C++ support. (objc_is_public): Likewise. (start_class): Likewise. (continue_class): Likewise. (encode_aggregate_within): Likewise. (start_method_def): Likewise. (objc_start_function): Clear current_function_returns_value and current_function_returns_null. (really_start_method): Add Objective-C++ support. (objc_finish_method_definition): Add warning for missing [super dealloc]. (finish_objc): Add Objective-C++ support. (generate_objc_image_info): Likewise. (objc_lookup_ivar): Likewise. * objc-act.h (TYPE_HAS_OBJC_INFO): Likewise. (INIT_TYPE_OBJC_INFO): Likewise. (DUP_TYPE_OBJC_INFO): Likewise. From-SVN: r99857
2005-05-17 22:07:08 +02:00
/* Return 1 if TYPE1 has the same size and alignment as TYPE2. */
static int
objc_types_share_size_and_alignment (tree type1, tree type2)
{
return (simple_cst_equal (TYPE_SIZE (type1), TYPE_SIZE (type2))
&& TYPE_ALIGN (type1) == TYPE_ALIGN (type2));
}
Makefile.in (c-parse.o): Depend on $(C_COMMON_H). [gcc/ChangeLog] 2004-09-07 Ziemowit Laski <zlaski@apple.com> * Makefile.in (c-parse.o): Depend on $(C_COMMON_H). * c-parse.in: Include c-common.h instead of objc-act.h. (ivar_decl_list, ivar_decls, ivar_decl, ivars, ivar_declarator, myparms, myparm): Remove %type declarations. (methodtype, optparms, OBJC_TYPE_QUAL, objc_quals, objc_qual, objc_typename, objc_try_catch_stmt, optellipsis): Add %type declarations. (objc_inherit_code, objc_public_flag): Remove. (typespec_nonreserved_nonattr): Call objc_get_protocol_qualified_type() instead of get_static_reference() and get_protocol_reference(). (stmt_nocomp): Call grokparm() on @catch parameter. (objcdef): Move semantic action to objc_finish_implementation(). (classdef): Move semantic action to objc_start_class_interface(), objc_continue_interface(), objc_finish_interface(), objc_start_class_implementation(), objc_continue_implementation(), objc_start_category_interface() and objc_start_category_implementation(). (protocoldef): Move semantic actions to objc_start_protocol() and objc_finish_interface(). (ivar_decl_list): Remove nonterminal. (visibility_spec): Move semantic actions to objc_set_visibility(). (ivar_decls): Remove assignment to $$. (ivar_decl): Rephrase in terms of component_decl; call objc_add_instance_variable(). (ivars, ivar_declarator): Remove nonterminals. (opt_semi): New nonterminal. (methodtype): Remove semantic actions. (methoddef): Move semantic actions to objc_set_method_type(), objc_start_method_definition() and objc_finish_method_definition(). (methodproto): Move semantic actions to objc_set_method_type() and objc_add_method_declaration(). (methoddecl): Use objc_typename instead of typename; move semantic actions to objc_build_method_signature(). (optarglist, myxdecls, mydecl, myparms, myparm): Remove nonterminals. (optparmlist): Express in terms of optparms and optellipsis. (optparms, optellipsis, objc_qual, objc_quals, objc_typename): New nonterminals. (keyworddecl): Use objc_typename instead of typename. (rid_to_yy): Mark RID_IN, RID_OUT, RID_INOUT, RID_BYCOPY, RID_BYREF and RID_ONEWAY as returning OBJC_TYPE_QUAL to yyparse(). [gcc/objc/ChangeLog] 2004-09-07 Ziemowit Laski <zlaski@apple.com> * Make-lang.in (objc/objc-parse.o): Depend on $(C_COMMON_H) instead of objc/objc-act.h. (objc/objc-act.o): Depend on $(HASHTAB_H). * objc-act.c: Include hashtab.h; in ObjC++ mode, include cp-tree.h and objcp-decl.h instead of c-tree.h. (build_module_descriptor, get_class_ivars, synth_id_with_class_suffix, error_with_ivar, gen_method_decl, gen_declaration, setup_string_decl, build_protocol_template): Adjust prototypes. (build_module_initializer_routine, start_class, continue_class, finish_class, start_method_def, objc_start_function, start_protocol, build_method_decl, objc_add_method, add_instance_variable, build_ivar_reference, is_ivar, is_private, get_super_receiver, build_selector_table_decl, objc_push_parm, objc_get_parm_info, gen_type_name, gen_type_name_0, start_var_decl, finish_var_decl, create_field_decl): New prototypes. (objc_expand_function_end, comp_method_with_proto, objc_expr_last, gen_declaration_1, gen_declarator, is_complex_decl, adorn_decl, define_decl, create_builtin_decl, gen_declspecs): Remove prototypes. (TYPE_ID): Rename to OBJECT_TYPEDEF_NAME. (CLASS_TYPEDEF_NAME): New. (TAG_EXECCLASS): Change from a global variable to a #define. (TAG_RETURN_STRUCT): Delete. (TAG_GNUINIT): New, holds '__objc_gnu_init' name. (objc_inherit_code, objc_public_flag): New, moved from c-parse.in. (string_descriptor): New struct. (string_htab): New hash table. (string_hash, string_eq): New prototypes. (generate_struct_by_value_array): Call create_field_decl() instead of create_builtin_decl(). (objc_init): Do not initialize objc_ellipsis_node or TAG_EXECCLASS; In ObjC++ mode, call cxx_init() instead of c_objc_common_init(). (objc_finish_file): In ObjC++, call instantiate_pending_templates() and cp_finish_file(). (define_decl, get_static_reference, get_protocol_reference, create_builtin_decl): Remove functions. (objc_start_class_interface, objc_start_category_interface, objc_start_protocol, objc_continue_interface, objc_finish_interface, objc_start_class_implementation, objc_start_category_implementation, objc_continue_implementation, objc_finish_implementation, objc_set_visibility, objc_set_method_type, objc_build_method_signature, objc_add_method_declaration, objc_start_method_definition, objc_add_instance_variable, objc_get_protocol_qualified_type, create_field_decl, start_var_decl, finish_var_decl): New functions. (setup_string_decl): Simplify since it is only called once. (synth_module_prologue): Call build_class_template(); predefine 'id' and 'Class' as typedefs; rename 'temp_type' to 'type'; disable debug hooks for duration of function; fix GNU runtime messenger signatures to correspond to reality; forward-declare '__objc_exec_class' for the GNU runtime; call build_selector_table_decl(); in ObjC++ mode, generate 'extern "C" { ... }' wrappers around synthesized declarations; call build_protocol_template() and build_category_template(). (string_hash, string_eq): New functions. (objc_build_string_object): Check metaclass correctness only once; store string literals in hash table. (objc_build_constructor): Do not convert initializer elements; adjust for ObjC++ impedance mismatch. (build_objc_symtab_template): Call create_field_decl() instead of create_builtin_decl(). (init_objc_symtab): Add missing conversion to initializer element. (build_metadata_decl): Call start_var_decl() instead of define_decl(). (generate_objc_symtab_decl): Do not call build_category_template(); call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(). (build_module_descriptor): Call create_field_decl() instead of grokfield(); call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(); always mark module descriptor as used; move GNU runtime-specific functionality to build_module_initializer_routine(). (build_module_initializer_routine): New function, broken off of build_module_descriptor(). (objc_static_init_needed_p, objc_generate_static_init_call): New functions. (generate_static_references, generate_strings, build_selector_translation_table, generate_descriptor_table, generate_ivars_list, generate_dispatch_table, generate_category): Call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(); build a type directly instead of via groktypename(). (build_selector_reference_decl, build_selector_table_decl, build_class_reference_decl, build_protocol_reference, generate_objc_image_info): Call start_var_decl() instead of build_decl(). (build_selector_reference): For GNU runtime, do not call build_selector_reference_decl(). (build_selector, build_typed_selector_reference): Always convert result to the selector type. (add_objc_string): Cast return value to 'char *'. (build_method_prototype_template, build_selector_template, build_method_template): Use actual selector type for fields pointing to selectors. (finish_objc): For GNU runtime, call build_module_initializer_routine() after build_module_descriptor(). (generate_protocol_list, generate_shared_structures): Call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(); build a type directly instead of via groktypename(). (synth_id_with_class_suffix): Return a string. (get_arg_type_list): For instance methods, use the instance type for 'self'; do not call groktypename_in_parm_context(). (build_objc_string_decl): Squash redeclaration errors in ObjC++. (objc_is_class_name): Use OBJC_TYPE_NAME instead of TYPE_NAME; handle RECORD_TYPEs in ObjC as well as ObjC++. (objc_is_id): New function. (objc_is_object_ptr): Return the canonical type node. (objc_get_class_ivars): Simplify using get_class_ivars(). (get_class_ivars): Remove second parameter; create a fresh copy of the ivar list for each call; do not check for existence of super class. (objc_eh_runtime_type): Mark #ifndef OBJCPLUS. (objc_init_exceptions): When using SJLJ-style exceptions, require the use of '-fobjc-exceptions' flag; do not require it for DWARF-style exceptions. (objc_build_exc_ptr, next_sjlj_build_try_catch_finally): Use objc_object_type instead of objc_id_type. (objc_begin_catch_clause): Convert the incoming PARM_DECL into a VAR_DECL before placing it in the appropriate scope; do not call define_decl(); adjust call to c_begin_compound_stmt(); use objc_object_type instead of objc_id_type. (build_next_objc_exception_stuff): Call create_field_decl() instead of create_builtin_decl(); construct type directly instead of calling groktypename(); use OBJC_VOID_AT_END to mark end of function parameters. (build_private_template): Adjust call to get_class_ivars(); build a type directly instead of via groktypename(). (build_protocol_template, build_method_prototype_list_template, build_method_prototype_template, build_category_template, build_selector_template, build_class_template, build_super_template, build_ivar_template, build_ivar_list_template, build_method_list_template, build_method_template): Call create_field_decl() instead of grokfield(). (objc_method_parm_type): Do not call groktypename(). (generate_descriptor_table): Call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(). (generate_method_descriptors, build_protocol_initializer, generate_dispatch_tables, build_category_initializer, build_shared_structure_initializer): Do not call groktypename(). (generate_protocols): Call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(); do not call groktypename(). (error_with_ivar): Remove last parameter. (check_ivars): Do not iterate ovar CLASS_RAW_IVARS lists in addition to CLASS_IVARS lists; adjust calls to error_with_ivar(). (generate_ivar_lists): Convert one of the initializer elements; do not call groktypename(). (get_arg_type_list, start_method_def, gen_method_def): Account for new representation of variable arguments and '...' in Objective-C methods; add Objective-C++ impedance matching code. (is_objc_type_qualifier): Remove function. (adjust_type_for_id_default): Simplify; there is no longer a need to wade through declspecs. (lookup_interface, start_class, continue_class, finish_class, start_method_def, start_protocol, build_method_decl, objc_add_method, add_instance_variable, build_ivar_reference, is_ivar, is_private, get_super_receiver, objc_build_finally_epilogue): Make into static functions. (receiver_is_class_object): Use new IS_CLASS() macro. (objc_build_message_expr): Tweak ObjC++ message argument handling; call objc_finish_message_expr() instead of finish_message_expr(). (finish_message_expr): Rename to objc_finish_message_expr(); use OBJC_TYPE_NAME and OBJC_SET_TYPE_NAME macros instead of TYPE_NAME. call gen_type_name() instead of gen_declaration(); call objc_is_id() instead of using IS_ID and IS_CLASS; Use objc_class_name instead of calling get_identifier("Class"); handle CONVERT_EXPRs in receiver. (build_objc_method_call, warn_with_method): Do not call groktypename(). (build_ivar_reference): Call convert() instead of clobbering in a type. (hash_init): Initialize string_htab hash table. (add_instance_variable): Simplify parameter list; do not call grokfield(); do not populate CLASS_IVARS list. (start_class): Check for the existence of super class, if one was specified. (continue_class): Use CLASS_RAW_IVARS rather than CLASS_IVARS; do not call build_class_template(); adjust call to get_class_ivars(); call build_decl(), pushdecl() and finish_decl() instead of define_decl(). (finish_class): Call build_decl(), pushdecl() and finish_decl() instead of define_decl(). (add_protocols): Use PROTOCOL_BINFO_ELTS for the tree vector size. (start_protocol): Do not call build_protocol_template(); use PROTOCOL_BINFO_ELTS for the tree vector size. (encode_type_qualifiers): Do not handle the 'const' qualifier here. (encode_pointer): Encode 'const char *' as 'r*', for backwards compatibility. (encode_array): Use HOST_WIDE_INT_PRINT_DEC instead of "%ld". (encode_type): Handle the 'const' qualifier here. (objc_parmlist): New global variable, sued by objc_push_parm and objc_get_parm_info(). (objc_push_parm, objc_get_parm_info): New functions. (objc_expr_last): Remove function. (synth_self_and_ucmd_args): For instance methods, use the instance type for 'self'; call objc_push_parm() instead of push_parm_decl(). (start_method_def): Do not call push_scope(), declare_parm_level(), pop_scope(), push_parm_decl(), store_parm_decls() or objc_expr_last(); just use objc_push_parm() and objc_get_parm_info(). (comp_method_with_proto): Remove function. (objc_types_are_equivalent): Strip away indirections before comparing underlying types. (comp_proto_with_proto): Do not call groktypename(); types are no longer in raw declspec format. (objc_start_function): New function. (really_start_method): Call comp_proto_with_proto() instead of comp_method_with_proto(); call objc_start_function() instead of hand-crafting a function declarator. (continue_method_def, objc_expand_function_end): Remove functions. (get_super_receiver): Call objc_get_current_scope() instead of get_current_scope(); reference 'super_class' field (instead of 'class'). (finish_method_def): Rename to objc_finish_method_definition() and add a function decl parameter; move method encoding call from objc_expand_function_end(). (is_complex_decl, adorn_decl, gen_declarator, gen_declspecs, gen_declaration_1): Remove functions. (tmpbuf, RAW_DECLSPEC): Remove. (gen_declaration): Remove second parameter; simplify to deal with TYPE_P nodes instead of raw declspecs. (gen_type_name, gen_type_name_0): New functions. (gen_method_decl): Remove second parameter; call gen_type_name() instead of gen_declaration_1(). (dump_interface): Adjust calls to gen_declaration() and gen_method_decl(); do not allocate a separate string buffer. (init_objc): Allocate a larger string buffer to accommodate dump_interface(); adjust call to build_module_descriptor(); add call to build_module_initializer_routine() for the GNU runtime. (generate_classref_translation_entry): Do not call start_decl(); call finish_var_decl() instead of finish_decl(); call convert() instead of build_c_cast(). * objc-act.h (CLASS_OWN_IVARS): Remove accessor. (CLASS_BINFO_ELTS): Reduce from 6 to 5, now that CLASS_OWN_IVARS is gone. (OCTI_GNU_INIT_DECL, GNU_INIT_decl): New. (OCTI_ELLIPSIS_NODE, objc_ellipsis_node): Remove. (OCTI_ID_ID, id_type, objc_id_id): Rename to OCTI_ID_NAME, objc_object_type and objc_object_name, respectively. (OCTI_CLS_REF, OCTI_CLASS_NAME, objc_class_reference, objc_class_name): New. (IS_CLASS): New macro. (IS_ID, IS_SUPER): Robustify. (OCTI_EXECCLASS_DECL, execclass_decl): New. (finish_file, start_class, continue_class, finish_class, start_method_def, continue_method_def, finish_method_def, start_protocol, finish_protocol, objc_build_throw_stmt, objc_build_try_catch_finally_stmt, objc_build_synchronized_prologue, objc_build_synchronized_epilogue, objc_build_try_prologue, objc_build_try_epilogue, objc_build_catch_stmt, objc_build_catch_epilogue, objc_build_finally_prologue, objc_build_finally_epilogue, is_ivar, is_private, is_public, add_instance_variable, objc_add_method, get_super_receiver, objc_clear_super_receiver, get_class_ivars_from_name, get_class_reference, get_static_reference, get_object_reference, build_message_expr, finish_message_expr, build_selector_expr, build_ivar_reference, build_keyword_decl, build_method_decl, build_protocol_expr, build_objc_string_object, objc_declare_alias, objc_declare_class, objc_declare_protocols, objc_comptypes, objc_check_decl, build_encode_expr): Remove prototypes. (imp_count, cat_count): Make GGC-aware. (OBJC_SET_TYPE_NAME): New macro. From-SVN: r87168
2004-09-08 02:49:44 +02:00
/* Return 1 if PROTO1 is equivalent to PROTO2
Yet more Objective-C++... * objc-act.c (objc_finish_try_stmt): Add return value. (objc_build_synchronized): Likewise. * objc-act.c (objc_is_gcable_type): Add. (objc_substitute_decl): Add. (objc_build_ivar_assignment): Add. (objc_build_global_assignment): Add. (objc_build_strong_cast_assignment): Add. (objc_is_ivar_reference_p): Add. (objc_is_global_reference_p): Add. (objc_generate_write_barrier): Add. (objc_rewrite_function_call): Add. (objc_gimplify_expr): Add Objective-C++ support. * objc-act.h (ALLOC_OBJC_TYPE_LANG_SPECIFIC): Likewise. (SIZEOF_OBJC_TYPE_LANG_SPECIFIC): Add. (INIT_TYPE_OBJC_INFO): Add Objective-C++ support. (DUP_TYPE_OBJC_INFO): Likewise. (struct imp_entry): Add field has_cxx_cdtors. (struct imp_entry *imp_list): Add OCTI_UMSG_FAST_DECL, OCTI_METH_LIST_TEMPL, OCTI_METH_PROTO_LIST_TEMPL, OCTI_IVAR_LIST_TEMPL, OCTI_ASSIGN_IVAR_DECL, OCTI_ASSIGN_IVAR_FAST_DECL, OCTI_ASSIGN_GLOBAL_DECL, OCTI_ASSIGN_STRONGCAST_DECL. (umsg_fast_decl): Add. (objc_assign_ivar_decl): Add. (objc_assign_ivar_fast_decl): Add. (objc_assign_global_decl): Add. (objc_assign_strong_cast_decl): Add. (objc_method_list_ptr): Add. (objc_method_proto_list_ptr): Add. (objc_ivar_list_ptr): Add. * objc-act.c (should_call_super_dealloc): Add. (OBJC_VERSION): Bump to 6. (objc_is_gcable_type): Add. (objc_substitute_decl): Add. (objc_build_ivar_assignment): Add. (objc_build_global_assignment): Add. (objc_build_strong_cast_assignment): Add. (objc_is_gcable_p): Add. (objc_is_ivar_reference_p): Add. (objc_is_global_reference_p): Add. (generate_shared_structures): Add flags parameter. (objc_generate_cxx_ctor_or_dtor): Add. (objc_generate_cxx_cdtors): Add. (add_class): Add name parameter. (objc_types_share_size_and_alignment): Add. (comp_proto_with_proto): Add strict parameter. (CLS_HAS_CXX_STRUCTORS): Add. (TAG_ASSIGNIVAR): Add. (TAG_ASSIGNGLOBAL): Add. (TAG_ASSIGNSTRONGCAST): Add. (TAG_MSGSEND_FAST): Add. (TAG_ASSIGNIVAR_FAST): Add. (TAG_CXX_CONSTRUCT): Add. (TAG_CXX_DESTRUCT): Add. (OBJC_LOOKUP_CLASS): Add. (OBJC_LOOKUP_NO_SUPER): Add. (objc_finish_file): Add pch support. (objc_finish_implementation): Add Objective-C++ support. (synth_module_prologue): Likewise. (synth_module_prologue): Add fast dispatching. (objc_get_class_reference): Add Objective-C++ support. (objc_generate_write_barrier): Likewise. (next_sjlj_build_enter_and_setjmp): Likewise. (objc_begin_try_stmt): Likewise. (build_next_objc_exception_stuff): Add fast ivar support. (build_private_template): Mark the record as used so debug information is generated. (build_protocol_template): Add Objective-C++ support. (objc_method_parm_type) Likewise. (objc_generate_cxx_ctor_or_dtor): Likewise. (objc_generate_cxx_cdtors): Likewise. (build_protocol_initializer): Likewise. (build_category_template): Likewise. (build_class_template): Likewise. (build_method_list_template): Likewise. (build_category_initializer): Likewise. (build_shared_structure_initializer): Likewise. (objc_finish_message_expr): Likewise. (build_objc_method_call): Add fast dispatch support. (lookup_method_static): Add support to end search at superclasses. (add_method_to_hash_list): Add strict parameter to comp_proto_with_proto. (objc_add_method): Likewise. (objc_add_method): Also set the interface_value. (add_instance_variable): Add Objective-C++ support. (objc_is_public): Likewise. (start_class): Likewise. (continue_class): Likewise. (encode_aggregate_within): Likewise. (start_method_def): Likewise. (objc_start_function): Clear current_function_returns_value and current_function_returns_null. (really_start_method): Add Objective-C++ support. (objc_finish_method_definition): Add warning for missing [super dealloc]. (finish_objc): Add Objective-C++ support. (generate_objc_image_info): Likewise. (objc_lookup_ivar): Likewise. * objc-act.h (TYPE_HAS_OBJC_INFO): Likewise. (INIT_TYPE_OBJC_INFO): Likewise. (DUP_TYPE_OBJC_INFO): Likewise. From-SVN: r99857
2005-05-17 22:07:08 +02:00
for purposes of method overloading. Ordinarily, the type signatures
should match up exactly, unless STRICT is zero, in which case we
shall allow differences in which the size and alignment of a type
is the same. */
static int
Yet more Objective-C++... * objc-act.c (objc_finish_try_stmt): Add return value. (objc_build_synchronized): Likewise. * objc-act.c (objc_is_gcable_type): Add. (objc_substitute_decl): Add. (objc_build_ivar_assignment): Add. (objc_build_global_assignment): Add. (objc_build_strong_cast_assignment): Add. (objc_is_ivar_reference_p): Add. (objc_is_global_reference_p): Add. (objc_generate_write_barrier): Add. (objc_rewrite_function_call): Add. (objc_gimplify_expr): Add Objective-C++ support. * objc-act.h (ALLOC_OBJC_TYPE_LANG_SPECIFIC): Likewise. (SIZEOF_OBJC_TYPE_LANG_SPECIFIC): Add. (INIT_TYPE_OBJC_INFO): Add Objective-C++ support. (DUP_TYPE_OBJC_INFO): Likewise. (struct imp_entry): Add field has_cxx_cdtors. (struct imp_entry *imp_list): Add OCTI_UMSG_FAST_DECL, OCTI_METH_LIST_TEMPL, OCTI_METH_PROTO_LIST_TEMPL, OCTI_IVAR_LIST_TEMPL, OCTI_ASSIGN_IVAR_DECL, OCTI_ASSIGN_IVAR_FAST_DECL, OCTI_ASSIGN_GLOBAL_DECL, OCTI_ASSIGN_STRONGCAST_DECL. (umsg_fast_decl): Add. (objc_assign_ivar_decl): Add. (objc_assign_ivar_fast_decl): Add. (objc_assign_global_decl): Add. (objc_assign_strong_cast_decl): Add. (objc_method_list_ptr): Add. (objc_method_proto_list_ptr): Add. (objc_ivar_list_ptr): Add. * objc-act.c (should_call_super_dealloc): Add. (OBJC_VERSION): Bump to 6. (objc_is_gcable_type): Add. (objc_substitute_decl): Add. (objc_build_ivar_assignment): Add. (objc_build_global_assignment): Add. (objc_build_strong_cast_assignment): Add. (objc_is_gcable_p): Add. (objc_is_ivar_reference_p): Add. (objc_is_global_reference_p): Add. (generate_shared_structures): Add flags parameter. (objc_generate_cxx_ctor_or_dtor): Add. (objc_generate_cxx_cdtors): Add. (add_class): Add name parameter. (objc_types_share_size_and_alignment): Add. (comp_proto_with_proto): Add strict parameter. (CLS_HAS_CXX_STRUCTORS): Add. (TAG_ASSIGNIVAR): Add. (TAG_ASSIGNGLOBAL): Add. (TAG_ASSIGNSTRONGCAST): Add. (TAG_MSGSEND_FAST): Add. (TAG_ASSIGNIVAR_FAST): Add. (TAG_CXX_CONSTRUCT): Add. (TAG_CXX_DESTRUCT): Add. (OBJC_LOOKUP_CLASS): Add. (OBJC_LOOKUP_NO_SUPER): Add. (objc_finish_file): Add pch support. (objc_finish_implementation): Add Objective-C++ support. (synth_module_prologue): Likewise. (synth_module_prologue): Add fast dispatching. (objc_get_class_reference): Add Objective-C++ support. (objc_generate_write_barrier): Likewise. (next_sjlj_build_enter_and_setjmp): Likewise. (objc_begin_try_stmt): Likewise. (build_next_objc_exception_stuff): Add fast ivar support. (build_private_template): Mark the record as used so debug information is generated. (build_protocol_template): Add Objective-C++ support. (objc_method_parm_type) Likewise. (objc_generate_cxx_ctor_or_dtor): Likewise. (objc_generate_cxx_cdtors): Likewise. (build_protocol_initializer): Likewise. (build_category_template): Likewise. (build_class_template): Likewise. (build_method_list_template): Likewise. (build_category_initializer): Likewise. (build_shared_structure_initializer): Likewise. (objc_finish_message_expr): Likewise. (build_objc_method_call): Add fast dispatch support. (lookup_method_static): Add support to end search at superclasses. (add_method_to_hash_list): Add strict parameter to comp_proto_with_proto. (objc_add_method): Likewise. (objc_add_method): Also set the interface_value. (add_instance_variable): Add Objective-C++ support. (objc_is_public): Likewise. (start_class): Likewise. (continue_class): Likewise. (encode_aggregate_within): Likewise. (start_method_def): Likewise. (objc_start_function): Clear current_function_returns_value and current_function_returns_null. (really_start_method): Add Objective-C++ support. (objc_finish_method_definition): Add warning for missing [super dealloc]. (finish_objc): Add Objective-C++ support. (generate_objc_image_info): Likewise. (objc_lookup_ivar): Likewise. * objc-act.h (TYPE_HAS_OBJC_INFO): Likewise. (INIT_TYPE_OBJC_INFO): Likewise. (DUP_TYPE_OBJC_INFO): Likewise. From-SVN: r99857
2005-05-17 22:07:08 +02:00
comp_proto_with_proto (tree proto1, tree proto2, int strict)
{
tree type1, type2;
1992-01-18 00:15:38 +01:00
/* The following test is needed in case there are hashing
collisions. */
if (METHOD_SEL_NAME (proto1) != METHOD_SEL_NAME (proto2))
return 0;
/* Compare return types. */
Makefile.in (c-parse.o): Depend on $(C_COMMON_H). [gcc/ChangeLog] 2004-09-07 Ziemowit Laski <zlaski@apple.com> * Makefile.in (c-parse.o): Depend on $(C_COMMON_H). * c-parse.in: Include c-common.h instead of objc-act.h. (ivar_decl_list, ivar_decls, ivar_decl, ivars, ivar_declarator, myparms, myparm): Remove %type declarations. (methodtype, optparms, OBJC_TYPE_QUAL, objc_quals, objc_qual, objc_typename, objc_try_catch_stmt, optellipsis): Add %type declarations. (objc_inherit_code, objc_public_flag): Remove. (typespec_nonreserved_nonattr): Call objc_get_protocol_qualified_type() instead of get_static_reference() and get_protocol_reference(). (stmt_nocomp): Call grokparm() on @catch parameter. (objcdef): Move semantic action to objc_finish_implementation(). (classdef): Move semantic action to objc_start_class_interface(), objc_continue_interface(), objc_finish_interface(), objc_start_class_implementation(), objc_continue_implementation(), objc_start_category_interface() and objc_start_category_implementation(). (protocoldef): Move semantic actions to objc_start_protocol() and objc_finish_interface(). (ivar_decl_list): Remove nonterminal. (visibility_spec): Move semantic actions to objc_set_visibility(). (ivar_decls): Remove assignment to $$. (ivar_decl): Rephrase in terms of component_decl; call objc_add_instance_variable(). (ivars, ivar_declarator): Remove nonterminals. (opt_semi): New nonterminal. (methodtype): Remove semantic actions. (methoddef): Move semantic actions to objc_set_method_type(), objc_start_method_definition() and objc_finish_method_definition(). (methodproto): Move semantic actions to objc_set_method_type() and objc_add_method_declaration(). (methoddecl): Use objc_typename instead of typename; move semantic actions to objc_build_method_signature(). (optarglist, myxdecls, mydecl, myparms, myparm): Remove nonterminals. (optparmlist): Express in terms of optparms and optellipsis. (optparms, optellipsis, objc_qual, objc_quals, objc_typename): New nonterminals. (keyworddecl): Use objc_typename instead of typename. (rid_to_yy): Mark RID_IN, RID_OUT, RID_INOUT, RID_BYCOPY, RID_BYREF and RID_ONEWAY as returning OBJC_TYPE_QUAL to yyparse(). [gcc/objc/ChangeLog] 2004-09-07 Ziemowit Laski <zlaski@apple.com> * Make-lang.in (objc/objc-parse.o): Depend on $(C_COMMON_H) instead of objc/objc-act.h. (objc/objc-act.o): Depend on $(HASHTAB_H). * objc-act.c: Include hashtab.h; in ObjC++ mode, include cp-tree.h and objcp-decl.h instead of c-tree.h. (build_module_descriptor, get_class_ivars, synth_id_with_class_suffix, error_with_ivar, gen_method_decl, gen_declaration, setup_string_decl, build_protocol_template): Adjust prototypes. (build_module_initializer_routine, start_class, continue_class, finish_class, start_method_def, objc_start_function, start_protocol, build_method_decl, objc_add_method, add_instance_variable, build_ivar_reference, is_ivar, is_private, get_super_receiver, build_selector_table_decl, objc_push_parm, objc_get_parm_info, gen_type_name, gen_type_name_0, start_var_decl, finish_var_decl, create_field_decl): New prototypes. (objc_expand_function_end, comp_method_with_proto, objc_expr_last, gen_declaration_1, gen_declarator, is_complex_decl, adorn_decl, define_decl, create_builtin_decl, gen_declspecs): Remove prototypes. (TYPE_ID): Rename to OBJECT_TYPEDEF_NAME. (CLASS_TYPEDEF_NAME): New. (TAG_EXECCLASS): Change from a global variable to a #define. (TAG_RETURN_STRUCT): Delete. (TAG_GNUINIT): New, holds '__objc_gnu_init' name. (objc_inherit_code, objc_public_flag): New, moved from c-parse.in. (string_descriptor): New struct. (string_htab): New hash table. (string_hash, string_eq): New prototypes. (generate_struct_by_value_array): Call create_field_decl() instead of create_builtin_decl(). (objc_init): Do not initialize objc_ellipsis_node or TAG_EXECCLASS; In ObjC++ mode, call cxx_init() instead of c_objc_common_init(). (objc_finish_file): In ObjC++, call instantiate_pending_templates() and cp_finish_file(). (define_decl, get_static_reference, get_protocol_reference, create_builtin_decl): Remove functions. (objc_start_class_interface, objc_start_category_interface, objc_start_protocol, objc_continue_interface, objc_finish_interface, objc_start_class_implementation, objc_start_category_implementation, objc_continue_implementation, objc_finish_implementation, objc_set_visibility, objc_set_method_type, objc_build_method_signature, objc_add_method_declaration, objc_start_method_definition, objc_add_instance_variable, objc_get_protocol_qualified_type, create_field_decl, start_var_decl, finish_var_decl): New functions. (setup_string_decl): Simplify since it is only called once. (synth_module_prologue): Call build_class_template(); predefine 'id' and 'Class' as typedefs; rename 'temp_type' to 'type'; disable debug hooks for duration of function; fix GNU runtime messenger signatures to correspond to reality; forward-declare '__objc_exec_class' for the GNU runtime; call build_selector_table_decl(); in ObjC++ mode, generate 'extern "C" { ... }' wrappers around synthesized declarations; call build_protocol_template() and build_category_template(). (string_hash, string_eq): New functions. (objc_build_string_object): Check metaclass correctness only once; store string literals in hash table. (objc_build_constructor): Do not convert initializer elements; adjust for ObjC++ impedance mismatch. (build_objc_symtab_template): Call create_field_decl() instead of create_builtin_decl(). (init_objc_symtab): Add missing conversion to initializer element. (build_metadata_decl): Call start_var_decl() instead of define_decl(). (generate_objc_symtab_decl): Do not call build_category_template(); call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(). (build_module_descriptor): Call create_field_decl() instead of grokfield(); call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(); always mark module descriptor as used; move GNU runtime-specific functionality to build_module_initializer_routine(). (build_module_initializer_routine): New function, broken off of build_module_descriptor(). (objc_static_init_needed_p, objc_generate_static_init_call): New functions. (generate_static_references, generate_strings, build_selector_translation_table, generate_descriptor_table, generate_ivars_list, generate_dispatch_table, generate_category): Call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(); build a type directly instead of via groktypename(). (build_selector_reference_decl, build_selector_table_decl, build_class_reference_decl, build_protocol_reference, generate_objc_image_info): Call start_var_decl() instead of build_decl(). (build_selector_reference): For GNU runtime, do not call build_selector_reference_decl(). (build_selector, build_typed_selector_reference): Always convert result to the selector type. (add_objc_string): Cast return value to 'char *'. (build_method_prototype_template, build_selector_template, build_method_template): Use actual selector type for fields pointing to selectors. (finish_objc): For GNU runtime, call build_module_initializer_routine() after build_module_descriptor(). (generate_protocol_list, generate_shared_structures): Call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(); build a type directly instead of via groktypename(). (synth_id_with_class_suffix): Return a string. (get_arg_type_list): For instance methods, use the instance type for 'self'; do not call groktypename_in_parm_context(). (build_objc_string_decl): Squash redeclaration errors in ObjC++. (objc_is_class_name): Use OBJC_TYPE_NAME instead of TYPE_NAME; handle RECORD_TYPEs in ObjC as well as ObjC++. (objc_is_id): New function. (objc_is_object_ptr): Return the canonical type node. (objc_get_class_ivars): Simplify using get_class_ivars(). (get_class_ivars): Remove second parameter; create a fresh copy of the ivar list for each call; do not check for existence of super class. (objc_eh_runtime_type): Mark #ifndef OBJCPLUS. (objc_init_exceptions): When using SJLJ-style exceptions, require the use of '-fobjc-exceptions' flag; do not require it for DWARF-style exceptions. (objc_build_exc_ptr, next_sjlj_build_try_catch_finally): Use objc_object_type instead of objc_id_type. (objc_begin_catch_clause): Convert the incoming PARM_DECL into a VAR_DECL before placing it in the appropriate scope; do not call define_decl(); adjust call to c_begin_compound_stmt(); use objc_object_type instead of objc_id_type. (build_next_objc_exception_stuff): Call create_field_decl() instead of create_builtin_decl(); construct type directly instead of calling groktypename(); use OBJC_VOID_AT_END to mark end of function parameters. (build_private_template): Adjust call to get_class_ivars(); build a type directly instead of via groktypename(). (build_protocol_template, build_method_prototype_list_template, build_method_prototype_template, build_category_template, build_selector_template, build_class_template, build_super_template, build_ivar_template, build_ivar_list_template, build_method_list_template, build_method_template): Call create_field_decl() instead of grokfield(). (objc_method_parm_type): Do not call groktypename(). (generate_descriptor_table): Call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(). (generate_method_descriptors, build_protocol_initializer, generate_dispatch_tables, build_category_initializer, build_shared_structure_initializer): Do not call groktypename(). (generate_protocols): Call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(); do not call groktypename(). (error_with_ivar): Remove last parameter. (check_ivars): Do not iterate ovar CLASS_RAW_IVARS lists in addition to CLASS_IVARS lists; adjust calls to error_with_ivar(). (generate_ivar_lists): Convert one of the initializer elements; do not call groktypename(). (get_arg_type_list, start_method_def, gen_method_def): Account for new representation of variable arguments and '...' in Objective-C methods; add Objective-C++ impedance matching code. (is_objc_type_qualifier): Remove function. (adjust_type_for_id_default): Simplify; there is no longer a need to wade through declspecs. (lookup_interface, start_class, continue_class, finish_class, start_method_def, start_protocol, build_method_decl, objc_add_method, add_instance_variable, build_ivar_reference, is_ivar, is_private, get_super_receiver, objc_build_finally_epilogue): Make into static functions. (receiver_is_class_object): Use new IS_CLASS() macro. (objc_build_message_expr): Tweak ObjC++ message argument handling; call objc_finish_message_expr() instead of finish_message_expr(). (finish_message_expr): Rename to objc_finish_message_expr(); use OBJC_TYPE_NAME and OBJC_SET_TYPE_NAME macros instead of TYPE_NAME. call gen_type_name() instead of gen_declaration(); call objc_is_id() instead of using IS_ID and IS_CLASS; Use objc_class_name instead of calling get_identifier("Class"); handle CONVERT_EXPRs in receiver. (build_objc_method_call, warn_with_method): Do not call groktypename(). (build_ivar_reference): Call convert() instead of clobbering in a type. (hash_init): Initialize string_htab hash table. (add_instance_variable): Simplify parameter list; do not call grokfield(); do not populate CLASS_IVARS list. (start_class): Check for the existence of super class, if one was specified. (continue_class): Use CLASS_RAW_IVARS rather than CLASS_IVARS; do not call build_class_template(); adjust call to get_class_ivars(); call build_decl(), pushdecl() and finish_decl() instead of define_decl(). (finish_class): Call build_decl(), pushdecl() and finish_decl() instead of define_decl(). (add_protocols): Use PROTOCOL_BINFO_ELTS for the tree vector size. (start_protocol): Do not call build_protocol_template(); use PROTOCOL_BINFO_ELTS for the tree vector size. (encode_type_qualifiers): Do not handle the 'const' qualifier here. (encode_pointer): Encode 'const char *' as 'r*', for backwards compatibility. (encode_array): Use HOST_WIDE_INT_PRINT_DEC instead of "%ld". (encode_type): Handle the 'const' qualifier here. (objc_parmlist): New global variable, sued by objc_push_parm and objc_get_parm_info(). (objc_push_parm, objc_get_parm_info): New functions. (objc_expr_last): Remove function. (synth_self_and_ucmd_args): For instance methods, use the instance type for 'self'; call objc_push_parm() instead of push_parm_decl(). (start_method_def): Do not call push_scope(), declare_parm_level(), pop_scope(), push_parm_decl(), store_parm_decls() or objc_expr_last(); just use objc_push_parm() and objc_get_parm_info(). (comp_method_with_proto): Remove function. (objc_types_are_equivalent): Strip away indirections before comparing underlying types. (comp_proto_with_proto): Do not call groktypename(); types are no longer in raw declspec format. (objc_start_function): New function. (really_start_method): Call comp_proto_with_proto() instead of comp_method_with_proto(); call objc_start_function() instead of hand-crafting a function declarator. (continue_method_def, objc_expand_function_end): Remove functions. (get_super_receiver): Call objc_get_current_scope() instead of get_current_scope(); reference 'super_class' field (instead of 'class'). (finish_method_def): Rename to objc_finish_method_definition() and add a function decl parameter; move method encoding call from objc_expand_function_end(). (is_complex_decl, adorn_decl, gen_declarator, gen_declspecs, gen_declaration_1): Remove functions. (tmpbuf, RAW_DECLSPEC): Remove. (gen_declaration): Remove second parameter; simplify to deal with TYPE_P nodes instead of raw declspecs. (gen_type_name, gen_type_name_0): New functions. (gen_method_decl): Remove second parameter; call gen_type_name() instead of gen_declaration_1(). (dump_interface): Adjust calls to gen_declaration() and gen_method_decl(); do not allocate a separate string buffer. (init_objc): Allocate a larger string buffer to accommodate dump_interface(); adjust call to build_module_descriptor(); add call to build_module_initializer_routine() for the GNU runtime. (generate_classref_translation_entry): Do not call start_decl(); call finish_var_decl() instead of finish_decl(); call convert() instead of build_c_cast(). * objc-act.h (CLASS_OWN_IVARS): Remove accessor. (CLASS_BINFO_ELTS): Reduce from 6 to 5, now that CLASS_OWN_IVARS is gone. (OCTI_GNU_INIT_DECL, GNU_INIT_decl): New. (OCTI_ELLIPSIS_NODE, objc_ellipsis_node): Remove. (OCTI_ID_ID, id_type, objc_id_id): Rename to OCTI_ID_NAME, objc_object_type and objc_object_name, respectively. (OCTI_CLS_REF, OCTI_CLASS_NAME, objc_class_reference, objc_class_name): New. (IS_CLASS): New macro. (IS_ID, IS_SUPER): Robustify. (OCTI_EXECCLASS_DECL, execclass_decl): New. (finish_file, start_class, continue_class, finish_class, start_method_def, continue_method_def, finish_method_def, start_protocol, finish_protocol, objc_build_throw_stmt, objc_build_try_catch_finally_stmt, objc_build_synchronized_prologue, objc_build_synchronized_epilogue, objc_build_try_prologue, objc_build_try_epilogue, objc_build_catch_stmt, objc_build_catch_epilogue, objc_build_finally_prologue, objc_build_finally_epilogue, is_ivar, is_private, is_public, add_instance_variable, objc_add_method, get_super_receiver, objc_clear_super_receiver, get_class_ivars_from_name, get_class_reference, get_static_reference, get_object_reference, build_message_expr, finish_message_expr, build_selector_expr, build_ivar_reference, build_keyword_decl, build_method_decl, build_protocol_expr, build_objc_string_object, objc_declare_alias, objc_declare_class, objc_declare_protocols, objc_comptypes, objc_check_decl, build_encode_expr): Remove prototypes. (imp_count, cat_count): Make GGC-aware. (OBJC_SET_TYPE_NAME): New macro. From-SVN: r87168
2004-09-08 02:49:44 +02:00
type1 = TREE_VALUE (TREE_TYPE (proto1));
type2 = TREE_VALUE (TREE_TYPE (proto2));
Yet more Objective-C++... * objc-act.c (objc_finish_try_stmt): Add return value. (objc_build_synchronized): Likewise. * objc-act.c (objc_is_gcable_type): Add. (objc_substitute_decl): Add. (objc_build_ivar_assignment): Add. (objc_build_global_assignment): Add. (objc_build_strong_cast_assignment): Add. (objc_is_ivar_reference_p): Add. (objc_is_global_reference_p): Add. (objc_generate_write_barrier): Add. (objc_rewrite_function_call): Add. (objc_gimplify_expr): Add Objective-C++ support. * objc-act.h (ALLOC_OBJC_TYPE_LANG_SPECIFIC): Likewise. (SIZEOF_OBJC_TYPE_LANG_SPECIFIC): Add. (INIT_TYPE_OBJC_INFO): Add Objective-C++ support. (DUP_TYPE_OBJC_INFO): Likewise. (struct imp_entry): Add field has_cxx_cdtors. (struct imp_entry *imp_list): Add OCTI_UMSG_FAST_DECL, OCTI_METH_LIST_TEMPL, OCTI_METH_PROTO_LIST_TEMPL, OCTI_IVAR_LIST_TEMPL, OCTI_ASSIGN_IVAR_DECL, OCTI_ASSIGN_IVAR_FAST_DECL, OCTI_ASSIGN_GLOBAL_DECL, OCTI_ASSIGN_STRONGCAST_DECL. (umsg_fast_decl): Add. (objc_assign_ivar_decl): Add. (objc_assign_ivar_fast_decl): Add. (objc_assign_global_decl): Add. (objc_assign_strong_cast_decl): Add. (objc_method_list_ptr): Add. (objc_method_proto_list_ptr): Add. (objc_ivar_list_ptr): Add. * objc-act.c (should_call_super_dealloc): Add. (OBJC_VERSION): Bump to 6. (objc_is_gcable_type): Add. (objc_substitute_decl): Add. (objc_build_ivar_assignment): Add. (objc_build_global_assignment): Add. (objc_build_strong_cast_assignment): Add. (objc_is_gcable_p): Add. (objc_is_ivar_reference_p): Add. (objc_is_global_reference_p): Add. (generate_shared_structures): Add flags parameter. (objc_generate_cxx_ctor_or_dtor): Add. (objc_generate_cxx_cdtors): Add. (add_class): Add name parameter. (objc_types_share_size_and_alignment): Add. (comp_proto_with_proto): Add strict parameter. (CLS_HAS_CXX_STRUCTORS): Add. (TAG_ASSIGNIVAR): Add. (TAG_ASSIGNGLOBAL): Add. (TAG_ASSIGNSTRONGCAST): Add. (TAG_MSGSEND_FAST): Add. (TAG_ASSIGNIVAR_FAST): Add. (TAG_CXX_CONSTRUCT): Add. (TAG_CXX_DESTRUCT): Add. (OBJC_LOOKUP_CLASS): Add. (OBJC_LOOKUP_NO_SUPER): Add. (objc_finish_file): Add pch support. (objc_finish_implementation): Add Objective-C++ support. (synth_module_prologue): Likewise. (synth_module_prologue): Add fast dispatching. (objc_get_class_reference): Add Objective-C++ support. (objc_generate_write_barrier): Likewise. (next_sjlj_build_enter_and_setjmp): Likewise. (objc_begin_try_stmt): Likewise. (build_next_objc_exception_stuff): Add fast ivar support. (build_private_template): Mark the record as used so debug information is generated. (build_protocol_template): Add Objective-C++ support. (objc_method_parm_type) Likewise. (objc_generate_cxx_ctor_or_dtor): Likewise. (objc_generate_cxx_cdtors): Likewise. (build_protocol_initializer): Likewise. (build_category_template): Likewise. (build_class_template): Likewise. (build_method_list_template): Likewise. (build_category_initializer): Likewise. (build_shared_structure_initializer): Likewise. (objc_finish_message_expr): Likewise. (build_objc_method_call): Add fast dispatch support. (lookup_method_static): Add support to end search at superclasses. (add_method_to_hash_list): Add strict parameter to comp_proto_with_proto. (objc_add_method): Likewise. (objc_add_method): Also set the interface_value. (add_instance_variable): Add Objective-C++ support. (objc_is_public): Likewise. (start_class): Likewise. (continue_class): Likewise. (encode_aggregate_within): Likewise. (start_method_def): Likewise. (objc_start_function): Clear current_function_returns_value and current_function_returns_null. (really_start_method): Add Objective-C++ support. (objc_finish_method_definition): Add warning for missing [super dealloc]. (finish_objc): Add Objective-C++ support. (generate_objc_image_info): Likewise. (objc_lookup_ivar): Likewise. * objc-act.h (TYPE_HAS_OBJC_INFO): Likewise. (INIT_TYPE_OBJC_INFO): Likewise. (DUP_TYPE_OBJC_INFO): Likewise. From-SVN: r99857
2005-05-17 22:07:08 +02:00
if (!objc_types_are_equivalent (type1, type2)
&& (strict || !objc_types_share_size_and_alignment (type1, type2)))
return 0;
1992-01-18 00:15:38 +01:00
/* Compare argument types. */
for (type1 = get_arg_type_list (proto1, METHOD_REF, 0),
type2 = get_arg_type_list (proto2, METHOD_REF, 0);
type1 && type2;
type1 = TREE_CHAIN (type1), type2 = TREE_CHAIN (type2))
{
Yet more Objective-C++... * objc-act.c (objc_finish_try_stmt): Add return value. (objc_build_synchronized): Likewise. * objc-act.c (objc_is_gcable_type): Add. (objc_substitute_decl): Add. (objc_build_ivar_assignment): Add. (objc_build_global_assignment): Add. (objc_build_strong_cast_assignment): Add. (objc_is_ivar_reference_p): Add. (objc_is_global_reference_p): Add. (objc_generate_write_barrier): Add. (objc_rewrite_function_call): Add. (objc_gimplify_expr): Add Objective-C++ support. * objc-act.h (ALLOC_OBJC_TYPE_LANG_SPECIFIC): Likewise. (SIZEOF_OBJC_TYPE_LANG_SPECIFIC): Add. (INIT_TYPE_OBJC_INFO): Add Objective-C++ support. (DUP_TYPE_OBJC_INFO): Likewise. (struct imp_entry): Add field has_cxx_cdtors. (struct imp_entry *imp_list): Add OCTI_UMSG_FAST_DECL, OCTI_METH_LIST_TEMPL, OCTI_METH_PROTO_LIST_TEMPL, OCTI_IVAR_LIST_TEMPL, OCTI_ASSIGN_IVAR_DECL, OCTI_ASSIGN_IVAR_FAST_DECL, OCTI_ASSIGN_GLOBAL_DECL, OCTI_ASSIGN_STRONGCAST_DECL. (umsg_fast_decl): Add. (objc_assign_ivar_decl): Add. (objc_assign_ivar_fast_decl): Add. (objc_assign_global_decl): Add. (objc_assign_strong_cast_decl): Add. (objc_method_list_ptr): Add. (objc_method_proto_list_ptr): Add. (objc_ivar_list_ptr): Add. * objc-act.c (should_call_super_dealloc): Add. (OBJC_VERSION): Bump to 6. (objc_is_gcable_type): Add. (objc_substitute_decl): Add. (objc_build_ivar_assignment): Add. (objc_build_global_assignment): Add. (objc_build_strong_cast_assignment): Add. (objc_is_gcable_p): Add. (objc_is_ivar_reference_p): Add. (objc_is_global_reference_p): Add. (generate_shared_structures): Add flags parameter. (objc_generate_cxx_ctor_or_dtor): Add. (objc_generate_cxx_cdtors): Add. (add_class): Add name parameter. (objc_types_share_size_and_alignment): Add. (comp_proto_with_proto): Add strict parameter. (CLS_HAS_CXX_STRUCTORS): Add. (TAG_ASSIGNIVAR): Add. (TAG_ASSIGNGLOBAL): Add. (TAG_ASSIGNSTRONGCAST): Add. (TAG_MSGSEND_FAST): Add. (TAG_ASSIGNIVAR_FAST): Add. (TAG_CXX_CONSTRUCT): Add. (TAG_CXX_DESTRUCT): Add. (OBJC_LOOKUP_CLASS): Add. (OBJC_LOOKUP_NO_SUPER): Add. (objc_finish_file): Add pch support. (objc_finish_implementation): Add Objective-C++ support. (synth_module_prologue): Likewise. (synth_module_prologue): Add fast dispatching. (objc_get_class_reference): Add Objective-C++ support. (objc_generate_write_barrier): Likewise. (next_sjlj_build_enter_and_setjmp): Likewise. (objc_begin_try_stmt): Likewise. (build_next_objc_exception_stuff): Add fast ivar support. (build_private_template): Mark the record as used so debug information is generated. (build_protocol_template): Add Objective-C++ support. (objc_method_parm_type) Likewise. (objc_generate_cxx_ctor_or_dtor): Likewise. (objc_generate_cxx_cdtors): Likewise. (build_protocol_initializer): Likewise. (build_category_template): Likewise. (build_class_template): Likewise. (build_method_list_template): Likewise. (build_category_initializer): Likewise. (build_shared_structure_initializer): Likewise. (objc_finish_message_expr): Likewise. (build_objc_method_call): Add fast dispatch support. (lookup_method_static): Add support to end search at superclasses. (add_method_to_hash_list): Add strict parameter to comp_proto_with_proto. (objc_add_method): Likewise. (objc_add_method): Also set the interface_value. (add_instance_variable): Add Objective-C++ support. (objc_is_public): Likewise. (start_class): Likewise. (continue_class): Likewise. (encode_aggregate_within): Likewise. (start_method_def): Likewise. (objc_start_function): Clear current_function_returns_value and current_function_returns_null. (really_start_method): Add Objective-C++ support. (objc_finish_method_definition): Add warning for missing [super dealloc]. (finish_objc): Add Objective-C++ support. (generate_objc_image_info): Likewise. (objc_lookup_ivar): Likewise. * objc-act.h (TYPE_HAS_OBJC_INFO): Likewise. (INIT_TYPE_OBJC_INFO): Likewise. (DUP_TYPE_OBJC_INFO): Likewise. From-SVN: r99857
2005-05-17 22:07:08 +02:00
if (!objc_types_are_equivalent (TREE_VALUE (type1), TREE_VALUE (type2))
&& (strict
|| !objc_types_share_size_and_alignment (TREE_VALUE (type1),
TREE_VALUE (type2))))
return 0;
}
1992-01-18 00:15:38 +01:00
return (!type1 && !type2);
1992-01-18 00:15:38 +01:00
}
/* Fold an OBJ_TYPE_REF expression for ObjC method dispatches, where
this occurs. ObjC method dispatches are _not_ like C++ virtual
member function dispatches, and we account for the difference here. */
tree
#ifdef OBJCPLUS
objc_fold_obj_type_ref (tree ref, tree known_type)
#else
objc_fold_obj_type_ref (tree ref ATTRIBUTE_UNUSED,
tree known_type ATTRIBUTE_UNUSED)
#endif
{
#ifdef OBJCPLUS
tree v = BINFO_VIRTUALS (TYPE_BINFO (known_type));
/* If the receiver does not have virtual member functions, there
is nothing we can (or need to) do here. */
if (!v)
return NULL_TREE;
/* Let C++ handle C++ virtual functions. */
return cp_fold_obj_type_ref (ref, known_type);
#else
/* For plain ObjC, we currently do not need to do anything. */
return NULL_TREE;
#endif
}
Makefile.in (c-parse.o): Depend on $(C_COMMON_H). [gcc/ChangeLog] 2004-09-07 Ziemowit Laski <zlaski@apple.com> * Makefile.in (c-parse.o): Depend on $(C_COMMON_H). * c-parse.in: Include c-common.h instead of objc-act.h. (ivar_decl_list, ivar_decls, ivar_decl, ivars, ivar_declarator, myparms, myparm): Remove %type declarations. (methodtype, optparms, OBJC_TYPE_QUAL, objc_quals, objc_qual, objc_typename, objc_try_catch_stmt, optellipsis): Add %type declarations. (objc_inherit_code, objc_public_flag): Remove. (typespec_nonreserved_nonattr): Call objc_get_protocol_qualified_type() instead of get_static_reference() and get_protocol_reference(). (stmt_nocomp): Call grokparm() on @catch parameter. (objcdef): Move semantic action to objc_finish_implementation(). (classdef): Move semantic action to objc_start_class_interface(), objc_continue_interface(), objc_finish_interface(), objc_start_class_implementation(), objc_continue_implementation(), objc_start_category_interface() and objc_start_category_implementation(). (protocoldef): Move semantic actions to objc_start_protocol() and objc_finish_interface(). (ivar_decl_list): Remove nonterminal. (visibility_spec): Move semantic actions to objc_set_visibility(). (ivar_decls): Remove assignment to $$. (ivar_decl): Rephrase in terms of component_decl; call objc_add_instance_variable(). (ivars, ivar_declarator): Remove nonterminals. (opt_semi): New nonterminal. (methodtype): Remove semantic actions. (methoddef): Move semantic actions to objc_set_method_type(), objc_start_method_definition() and objc_finish_method_definition(). (methodproto): Move semantic actions to objc_set_method_type() and objc_add_method_declaration(). (methoddecl): Use objc_typename instead of typename; move semantic actions to objc_build_method_signature(). (optarglist, myxdecls, mydecl, myparms, myparm): Remove nonterminals. (optparmlist): Express in terms of optparms and optellipsis. (optparms, optellipsis, objc_qual, objc_quals, objc_typename): New nonterminals. (keyworddecl): Use objc_typename instead of typename. (rid_to_yy): Mark RID_IN, RID_OUT, RID_INOUT, RID_BYCOPY, RID_BYREF and RID_ONEWAY as returning OBJC_TYPE_QUAL to yyparse(). [gcc/objc/ChangeLog] 2004-09-07 Ziemowit Laski <zlaski@apple.com> * Make-lang.in (objc/objc-parse.o): Depend on $(C_COMMON_H) instead of objc/objc-act.h. (objc/objc-act.o): Depend on $(HASHTAB_H). * objc-act.c: Include hashtab.h; in ObjC++ mode, include cp-tree.h and objcp-decl.h instead of c-tree.h. (build_module_descriptor, get_class_ivars, synth_id_with_class_suffix, error_with_ivar, gen_method_decl, gen_declaration, setup_string_decl, build_protocol_template): Adjust prototypes. (build_module_initializer_routine, start_class, continue_class, finish_class, start_method_def, objc_start_function, start_protocol, build_method_decl, objc_add_method, add_instance_variable, build_ivar_reference, is_ivar, is_private, get_super_receiver, build_selector_table_decl, objc_push_parm, objc_get_parm_info, gen_type_name, gen_type_name_0, start_var_decl, finish_var_decl, create_field_decl): New prototypes. (objc_expand_function_end, comp_method_with_proto, objc_expr_last, gen_declaration_1, gen_declarator, is_complex_decl, adorn_decl, define_decl, create_builtin_decl, gen_declspecs): Remove prototypes. (TYPE_ID): Rename to OBJECT_TYPEDEF_NAME. (CLASS_TYPEDEF_NAME): New. (TAG_EXECCLASS): Change from a global variable to a #define. (TAG_RETURN_STRUCT): Delete. (TAG_GNUINIT): New, holds '__objc_gnu_init' name. (objc_inherit_code, objc_public_flag): New, moved from c-parse.in. (string_descriptor): New struct. (string_htab): New hash table. (string_hash, string_eq): New prototypes. (generate_struct_by_value_array): Call create_field_decl() instead of create_builtin_decl(). (objc_init): Do not initialize objc_ellipsis_node or TAG_EXECCLASS; In ObjC++ mode, call cxx_init() instead of c_objc_common_init(). (objc_finish_file): In ObjC++, call instantiate_pending_templates() and cp_finish_file(). (define_decl, get_static_reference, get_protocol_reference, create_builtin_decl): Remove functions. (objc_start_class_interface, objc_start_category_interface, objc_start_protocol, objc_continue_interface, objc_finish_interface, objc_start_class_implementation, objc_start_category_implementation, objc_continue_implementation, objc_finish_implementation, objc_set_visibility, objc_set_method_type, objc_build_method_signature, objc_add_method_declaration, objc_start_method_definition, objc_add_instance_variable, objc_get_protocol_qualified_type, create_field_decl, start_var_decl, finish_var_decl): New functions. (setup_string_decl): Simplify since it is only called once. (synth_module_prologue): Call build_class_template(); predefine 'id' and 'Class' as typedefs; rename 'temp_type' to 'type'; disable debug hooks for duration of function; fix GNU runtime messenger signatures to correspond to reality; forward-declare '__objc_exec_class' for the GNU runtime; call build_selector_table_decl(); in ObjC++ mode, generate 'extern "C" { ... }' wrappers around synthesized declarations; call build_protocol_template() and build_category_template(). (string_hash, string_eq): New functions. (objc_build_string_object): Check metaclass correctness only once; store string literals in hash table. (objc_build_constructor): Do not convert initializer elements; adjust for ObjC++ impedance mismatch. (build_objc_symtab_template): Call create_field_decl() instead of create_builtin_decl(). (init_objc_symtab): Add missing conversion to initializer element. (build_metadata_decl): Call start_var_decl() instead of define_decl(). (generate_objc_symtab_decl): Do not call build_category_template(); call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(). (build_module_descriptor): Call create_field_decl() instead of grokfield(); call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(); always mark module descriptor as used; move GNU runtime-specific functionality to build_module_initializer_routine(). (build_module_initializer_routine): New function, broken off of build_module_descriptor(). (objc_static_init_needed_p, objc_generate_static_init_call): New functions. (generate_static_references, generate_strings, build_selector_translation_table, generate_descriptor_table, generate_ivars_list, generate_dispatch_table, generate_category): Call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(); build a type directly instead of via groktypename(). (build_selector_reference_decl, build_selector_table_decl, build_class_reference_decl, build_protocol_reference, generate_objc_image_info): Call start_var_decl() instead of build_decl(). (build_selector_reference): For GNU runtime, do not call build_selector_reference_decl(). (build_selector, build_typed_selector_reference): Always convert result to the selector type. (add_objc_string): Cast return value to 'char *'. (build_method_prototype_template, build_selector_template, build_method_template): Use actual selector type for fields pointing to selectors. (finish_objc): For GNU runtime, call build_module_initializer_routine() after build_module_descriptor(). (generate_protocol_list, generate_shared_structures): Call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(); build a type directly instead of via groktypename(). (synth_id_with_class_suffix): Return a string. (get_arg_type_list): For instance methods, use the instance type for 'self'; do not call groktypename_in_parm_context(). (build_objc_string_decl): Squash redeclaration errors in ObjC++. (objc_is_class_name): Use OBJC_TYPE_NAME instead of TYPE_NAME; handle RECORD_TYPEs in ObjC as well as ObjC++. (objc_is_id): New function. (objc_is_object_ptr): Return the canonical type node. (objc_get_class_ivars): Simplify using get_class_ivars(). (get_class_ivars): Remove second parameter; create a fresh copy of the ivar list for each call; do not check for existence of super class. (objc_eh_runtime_type): Mark #ifndef OBJCPLUS. (objc_init_exceptions): When using SJLJ-style exceptions, require the use of '-fobjc-exceptions' flag; do not require it for DWARF-style exceptions. (objc_build_exc_ptr, next_sjlj_build_try_catch_finally): Use objc_object_type instead of objc_id_type. (objc_begin_catch_clause): Convert the incoming PARM_DECL into a VAR_DECL before placing it in the appropriate scope; do not call define_decl(); adjust call to c_begin_compound_stmt(); use objc_object_type instead of objc_id_type. (build_next_objc_exception_stuff): Call create_field_decl() instead of create_builtin_decl(); construct type directly instead of calling groktypename(); use OBJC_VOID_AT_END to mark end of function parameters. (build_private_template): Adjust call to get_class_ivars(); build a type directly instead of via groktypename(). (build_protocol_template, build_method_prototype_list_template, build_method_prototype_template, build_category_template, build_selector_template, build_class_template, build_super_template, build_ivar_template, build_ivar_list_template, build_method_list_template, build_method_template): Call create_field_decl() instead of grokfield(). (objc_method_parm_type): Do not call groktypename(). (generate_descriptor_table): Call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(). (generate_method_descriptors, build_protocol_initializer, generate_dispatch_tables, build_category_initializer, build_shared_structure_initializer): Do not call groktypename(). (generate_protocols): Call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(); do not call groktypename(). (error_with_ivar): Remove last parameter. (check_ivars): Do not iterate ovar CLASS_RAW_IVARS lists in addition to CLASS_IVARS lists; adjust calls to error_with_ivar(). (generate_ivar_lists): Convert one of the initializer elements; do not call groktypename(). (get_arg_type_list, start_method_def, gen_method_def): Account for new representation of variable arguments and '...' in Objective-C methods; add Objective-C++ impedance matching code. (is_objc_type_qualifier): Remove function. (adjust_type_for_id_default): Simplify; there is no longer a need to wade through declspecs. (lookup_interface, start_class, continue_class, finish_class, start_method_def, start_protocol, build_method_decl, objc_add_method, add_instance_variable, build_ivar_reference, is_ivar, is_private, get_super_receiver, objc_build_finally_epilogue): Make into static functions. (receiver_is_class_object): Use new IS_CLASS() macro. (objc_build_message_expr): Tweak ObjC++ message argument handling; call objc_finish_message_expr() instead of finish_message_expr(). (finish_message_expr): Rename to objc_finish_message_expr(); use OBJC_TYPE_NAME and OBJC_SET_TYPE_NAME macros instead of TYPE_NAME. call gen_type_name() instead of gen_declaration(); call objc_is_id() instead of using IS_ID and IS_CLASS; Use objc_class_name instead of calling get_identifier("Class"); handle CONVERT_EXPRs in receiver. (build_objc_method_call, warn_with_method): Do not call groktypename(). (build_ivar_reference): Call convert() instead of clobbering in a type. (hash_init): Initialize string_htab hash table. (add_instance_variable): Simplify parameter list; do not call grokfield(); do not populate CLASS_IVARS list. (start_class): Check for the existence of super class, if one was specified. (continue_class): Use CLASS_RAW_IVARS rather than CLASS_IVARS; do not call build_class_template(); adjust call to get_class_ivars(); call build_decl(), pushdecl() and finish_decl() instead of define_decl(). (finish_class): Call build_decl(), pushdecl() and finish_decl() instead of define_decl(). (add_protocols): Use PROTOCOL_BINFO_ELTS for the tree vector size. (start_protocol): Do not call build_protocol_template(); use PROTOCOL_BINFO_ELTS for the tree vector size. (encode_type_qualifiers): Do not handle the 'const' qualifier here. (encode_pointer): Encode 'const char *' as 'r*', for backwards compatibility. (encode_array): Use HOST_WIDE_INT_PRINT_DEC instead of "%ld". (encode_type): Handle the 'const' qualifier here. (objc_parmlist): New global variable, sued by objc_push_parm and objc_get_parm_info(). (objc_push_parm, objc_get_parm_info): New functions. (objc_expr_last): Remove function. (synth_self_and_ucmd_args): For instance methods, use the instance type for 'self'; call objc_push_parm() instead of push_parm_decl(). (start_method_def): Do not call push_scope(), declare_parm_level(), pop_scope(), push_parm_decl(), store_parm_decls() or objc_expr_last(); just use objc_push_parm() and objc_get_parm_info(). (comp_method_with_proto): Remove function. (objc_types_are_equivalent): Strip away indirections before comparing underlying types. (comp_proto_with_proto): Do not call groktypename(); types are no longer in raw declspec format. (objc_start_function): New function. (really_start_method): Call comp_proto_with_proto() instead of comp_method_with_proto(); call objc_start_function() instead of hand-crafting a function declarator. (continue_method_def, objc_expand_function_end): Remove functions. (get_super_receiver): Call objc_get_current_scope() instead of get_current_scope(); reference 'super_class' field (instead of 'class'). (finish_method_def): Rename to objc_finish_method_definition() and add a function decl parameter; move method encoding call from objc_expand_function_end(). (is_complex_decl, adorn_decl, gen_declarator, gen_declspecs, gen_declaration_1): Remove functions. (tmpbuf, RAW_DECLSPEC): Remove. (gen_declaration): Remove second parameter; simplify to deal with TYPE_P nodes instead of raw declspecs. (gen_type_name, gen_type_name_0): New functions. (gen_method_decl): Remove second parameter; call gen_type_name() instead of gen_declaration_1(). (dump_interface): Adjust calls to gen_declaration() and gen_method_decl(); do not allocate a separate string buffer. (init_objc): Allocate a larger string buffer to accommodate dump_interface(); adjust call to build_module_descriptor(); add call to build_module_initializer_routine() for the GNU runtime. (generate_classref_translation_entry): Do not call start_decl(); call finish_var_decl() instead of finish_decl(); call convert() instead of build_c_cast(). * objc-act.h (CLASS_OWN_IVARS): Remove accessor. (CLASS_BINFO_ELTS): Reduce from 6 to 5, now that CLASS_OWN_IVARS is gone. (OCTI_GNU_INIT_DECL, GNU_INIT_decl): New. (OCTI_ELLIPSIS_NODE, objc_ellipsis_node): Remove. (OCTI_ID_ID, id_type, objc_id_id): Rename to OCTI_ID_NAME, objc_object_type and objc_object_name, respectively. (OCTI_CLS_REF, OCTI_CLASS_NAME, objc_class_reference, objc_class_name): New. (IS_CLASS): New macro. (IS_ID, IS_SUPER): Robustify. (OCTI_EXECCLASS_DECL, execclass_decl): New. (finish_file, start_class, continue_class, finish_class, start_method_def, continue_method_def, finish_method_def, start_protocol, finish_protocol, objc_build_throw_stmt, objc_build_try_catch_finally_stmt, objc_build_synchronized_prologue, objc_build_synchronized_epilogue, objc_build_try_prologue, objc_build_try_epilogue, objc_build_catch_stmt, objc_build_catch_epilogue, objc_build_finally_prologue, objc_build_finally_epilogue, is_ivar, is_private, is_public, add_instance_variable, objc_add_method, get_super_receiver, objc_clear_super_receiver, get_class_ivars_from_name, get_class_reference, get_static_reference, get_object_reference, build_message_expr, finish_message_expr, build_selector_expr, build_ivar_reference, build_keyword_decl, build_method_decl, build_protocol_expr, build_objc_string_object, objc_declare_alias, objc_declare_class, objc_declare_protocols, objc_comptypes, objc_check_decl, build_encode_expr): Remove prototypes. (imp_count, cat_count): Make GGC-aware. (OBJC_SET_TYPE_NAME): New macro. From-SVN: r87168
2004-09-08 02:49:44 +02:00
static void
c-tree.h (enum c_declarator_kind, [...]): New. * c-tree.h (enum c_declarator_kind, struct c_arg_info, struct c_declarator, struct c_type_name, struct c_parm): New. (build_array_declarator, set_array_declarator_inner, get_parm_info, grokfield, groktypename, grokparm, push_parm_decl, start_function, start_decl, build_c_parm, build_attrs_declarator, build_function_declarator, make_pointer_declarator, c_cast_expr, store_parm_decls_newstyle, c_expr_sizeof_type): Update prototypes. (build_id_declarator): New. * c-typeck.c (c_cast_expr, c_expr_sizeof_type): Update to new structures. * c-decl.c (ARG_INFO_PARMS, ARG_INFO_TAGS, ARG_INFO_TYPES, ARG_INFO_OTHERS): Remove. (build_id_declarator): New. (build_array_declarator, set_array_declarator_inner, groktypename, start_decl, grokparm, push_parm_decl, grokparms, get_parm_info, grokfield, start_function, store_parm_decls_newstyle, store_parm_decls_oldstyle, store_parm_decls, build_c_parm, build_attrs_declarator, build_function_declarator, make_pointer_declarator, grokdeclarator): Update to new structures. * c-parse.in (%union): Add arginfotype, dtrtype, typenametype and parmtype. (declarator, notype_declarator, after_type_declarator, parm_declarator, parm_declarator_starttypename, parm_declarator_nostarttypename, array_declarator, typename, absdcl, absdcl1, absdcl1_ea, absdcl1_noea, direct_absdcl1, absdcl_maybe_attribute, parm, firstparm, parms, parmlist, parmlist_1, parmlist_2, parmlist_or_identifiers, parmlist_or_identifiers_1): Use these types. (primary, after_type_declarator, parm_declarator_starttypename, notype_declarator, component_decl, component_declarator, component_notype_declarator, typename, absdcl, absdcl_maybe_attribute, absdcl1_ea, direct_absdcl1, parmlist_1, parmlist_2, parmlist_or_identifiers_1): Update to new structures. objc: * objc-act.c (objc_start_function, really_start_method, objc_get_parm_info, start_method_def): Update to new arg_info structures. From-SVN: r87217
2004-09-09 03:19:15 +02:00
objc_start_function (tree name, tree type, tree attrs,
#ifdef OBJCPLUS
tree params
#else
struct c_arg_info *params
#endif
)
Makefile.in (c-parse.o): Depend on $(C_COMMON_H). [gcc/ChangeLog] 2004-09-07 Ziemowit Laski <zlaski@apple.com> * Makefile.in (c-parse.o): Depend on $(C_COMMON_H). * c-parse.in: Include c-common.h instead of objc-act.h. (ivar_decl_list, ivar_decls, ivar_decl, ivars, ivar_declarator, myparms, myparm): Remove %type declarations. (methodtype, optparms, OBJC_TYPE_QUAL, objc_quals, objc_qual, objc_typename, objc_try_catch_stmt, optellipsis): Add %type declarations. (objc_inherit_code, objc_public_flag): Remove. (typespec_nonreserved_nonattr): Call objc_get_protocol_qualified_type() instead of get_static_reference() and get_protocol_reference(). (stmt_nocomp): Call grokparm() on @catch parameter. (objcdef): Move semantic action to objc_finish_implementation(). (classdef): Move semantic action to objc_start_class_interface(), objc_continue_interface(), objc_finish_interface(), objc_start_class_implementation(), objc_continue_implementation(), objc_start_category_interface() and objc_start_category_implementation(). (protocoldef): Move semantic actions to objc_start_protocol() and objc_finish_interface(). (ivar_decl_list): Remove nonterminal. (visibility_spec): Move semantic actions to objc_set_visibility(). (ivar_decls): Remove assignment to $$. (ivar_decl): Rephrase in terms of component_decl; call objc_add_instance_variable(). (ivars, ivar_declarator): Remove nonterminals. (opt_semi): New nonterminal. (methodtype): Remove semantic actions. (methoddef): Move semantic actions to objc_set_method_type(), objc_start_method_definition() and objc_finish_method_definition(). (methodproto): Move semantic actions to objc_set_method_type() and objc_add_method_declaration(). (methoddecl): Use objc_typename instead of typename; move semantic actions to objc_build_method_signature(). (optarglist, myxdecls, mydecl, myparms, myparm): Remove nonterminals. (optparmlist): Express in terms of optparms and optellipsis. (optparms, optellipsis, objc_qual, objc_quals, objc_typename): New nonterminals. (keyworddecl): Use objc_typename instead of typename. (rid_to_yy): Mark RID_IN, RID_OUT, RID_INOUT, RID_BYCOPY, RID_BYREF and RID_ONEWAY as returning OBJC_TYPE_QUAL to yyparse(). [gcc/objc/ChangeLog] 2004-09-07 Ziemowit Laski <zlaski@apple.com> * Make-lang.in (objc/objc-parse.o): Depend on $(C_COMMON_H) instead of objc/objc-act.h. (objc/objc-act.o): Depend on $(HASHTAB_H). * objc-act.c: Include hashtab.h; in ObjC++ mode, include cp-tree.h and objcp-decl.h instead of c-tree.h. (build_module_descriptor, get_class_ivars, synth_id_with_class_suffix, error_with_ivar, gen_method_decl, gen_declaration, setup_string_decl, build_protocol_template): Adjust prototypes. (build_module_initializer_routine, start_class, continue_class, finish_class, start_method_def, objc_start_function, start_protocol, build_method_decl, objc_add_method, add_instance_variable, build_ivar_reference, is_ivar, is_private, get_super_receiver, build_selector_table_decl, objc_push_parm, objc_get_parm_info, gen_type_name, gen_type_name_0, start_var_decl, finish_var_decl, create_field_decl): New prototypes. (objc_expand_function_end, comp_method_with_proto, objc_expr_last, gen_declaration_1, gen_declarator, is_complex_decl, adorn_decl, define_decl, create_builtin_decl, gen_declspecs): Remove prototypes. (TYPE_ID): Rename to OBJECT_TYPEDEF_NAME. (CLASS_TYPEDEF_NAME): New. (TAG_EXECCLASS): Change from a global variable to a #define. (TAG_RETURN_STRUCT): Delete. (TAG_GNUINIT): New, holds '__objc_gnu_init' name. (objc_inherit_code, objc_public_flag): New, moved from c-parse.in. (string_descriptor): New struct. (string_htab): New hash table. (string_hash, string_eq): New prototypes. (generate_struct_by_value_array): Call create_field_decl() instead of create_builtin_decl(). (objc_init): Do not initialize objc_ellipsis_node or TAG_EXECCLASS; In ObjC++ mode, call cxx_init() instead of c_objc_common_init(). (objc_finish_file): In ObjC++, call instantiate_pending_templates() and cp_finish_file(). (define_decl, get_static_reference, get_protocol_reference, create_builtin_decl): Remove functions. (objc_start_class_interface, objc_start_category_interface, objc_start_protocol, objc_continue_interface, objc_finish_interface, objc_start_class_implementation, objc_start_category_implementation, objc_continue_implementation, objc_finish_implementation, objc_set_visibility, objc_set_method_type, objc_build_method_signature, objc_add_method_declaration, objc_start_method_definition, objc_add_instance_variable, objc_get_protocol_qualified_type, create_field_decl, start_var_decl, finish_var_decl): New functions. (setup_string_decl): Simplify since it is only called once. (synth_module_prologue): Call build_class_template(); predefine 'id' and 'Class' as typedefs; rename 'temp_type' to 'type'; disable debug hooks for duration of function; fix GNU runtime messenger signatures to correspond to reality; forward-declare '__objc_exec_class' for the GNU runtime; call build_selector_table_decl(); in ObjC++ mode, generate 'extern "C" { ... }' wrappers around synthesized declarations; call build_protocol_template() and build_category_template(). (string_hash, string_eq): New functions. (objc_build_string_object): Check metaclass correctness only once; store string literals in hash table. (objc_build_constructor): Do not convert initializer elements; adjust for ObjC++ impedance mismatch. (build_objc_symtab_template): Call create_field_decl() instead of create_builtin_decl(). (init_objc_symtab): Add missing conversion to initializer element. (build_metadata_decl): Call start_var_decl() instead of define_decl(). (generate_objc_symtab_decl): Do not call build_category_template(); call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(). (build_module_descriptor): Call create_field_decl() instead of grokfield(); call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(); always mark module descriptor as used; move GNU runtime-specific functionality to build_module_initializer_routine(). (build_module_initializer_routine): New function, broken off of build_module_descriptor(). (objc_static_init_needed_p, objc_generate_static_init_call): New functions. (generate_static_references, generate_strings, build_selector_translation_table, generate_descriptor_table, generate_ivars_list, generate_dispatch_table, generate_category): Call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(); build a type directly instead of via groktypename(). (build_selector_reference_decl, build_selector_table_decl, build_class_reference_decl, build_protocol_reference, generate_objc_image_info): Call start_var_decl() instead of build_decl(). (build_selector_reference): For GNU runtime, do not call build_selector_reference_decl(). (build_selector, build_typed_selector_reference): Always convert result to the selector type. (add_objc_string): Cast return value to 'char *'. (build_method_prototype_template, build_selector_template, build_method_template): Use actual selector type for fields pointing to selectors. (finish_objc): For GNU runtime, call build_module_initializer_routine() after build_module_descriptor(). (generate_protocol_list, generate_shared_structures): Call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(); build a type directly instead of via groktypename(). (synth_id_with_class_suffix): Return a string. (get_arg_type_list): For instance methods, use the instance type for 'self'; do not call groktypename_in_parm_context(). (build_objc_string_decl): Squash redeclaration errors in ObjC++. (objc_is_class_name): Use OBJC_TYPE_NAME instead of TYPE_NAME; handle RECORD_TYPEs in ObjC as well as ObjC++. (objc_is_id): New function. (objc_is_object_ptr): Return the canonical type node. (objc_get_class_ivars): Simplify using get_class_ivars(). (get_class_ivars): Remove second parameter; create a fresh copy of the ivar list for each call; do not check for existence of super class. (objc_eh_runtime_type): Mark #ifndef OBJCPLUS. (objc_init_exceptions): When using SJLJ-style exceptions, require the use of '-fobjc-exceptions' flag; do not require it for DWARF-style exceptions. (objc_build_exc_ptr, next_sjlj_build_try_catch_finally): Use objc_object_type instead of objc_id_type. (objc_begin_catch_clause): Convert the incoming PARM_DECL into a VAR_DECL before placing it in the appropriate scope; do not call define_decl(); adjust call to c_begin_compound_stmt(); use objc_object_type instead of objc_id_type. (build_next_objc_exception_stuff): Call create_field_decl() instead of create_builtin_decl(); construct type directly instead of calling groktypename(); use OBJC_VOID_AT_END to mark end of function parameters. (build_private_template): Adjust call to get_class_ivars(); build a type directly instead of via groktypename(). (build_protocol_template, build_method_prototype_list_template, build_method_prototype_template, build_category_template, build_selector_template, build_class_template, build_super_template, build_ivar_template, build_ivar_list_template, build_method_list_template, build_method_template): Call create_field_decl() instead of grokfield(). (objc_method_parm_type): Do not call groktypename(). (generate_descriptor_table): Call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(). (generate_method_descriptors, build_protocol_initializer, generate_dispatch_tables, build_category_initializer, build_shared_structure_initializer): Do not call groktypename(). (generate_protocols): Call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(); do not call groktypename(). (error_with_ivar): Remove last parameter. (check_ivars): Do not iterate ovar CLASS_RAW_IVARS lists in addition to CLASS_IVARS lists; adjust calls to error_with_ivar(). (generate_ivar_lists): Convert one of the initializer elements; do not call groktypename(). (get_arg_type_list, start_method_def, gen_method_def): Account for new representation of variable arguments and '...' in Objective-C methods; add Objective-C++ impedance matching code. (is_objc_type_qualifier): Remove function. (adjust_type_for_id_default): Simplify; there is no longer a need to wade through declspecs. (lookup_interface, start_class, continue_class, finish_class, start_method_def, start_protocol, build_method_decl, objc_add_method, add_instance_variable, build_ivar_reference, is_ivar, is_private, get_super_receiver, objc_build_finally_epilogue): Make into static functions. (receiver_is_class_object): Use new IS_CLASS() macro. (objc_build_message_expr): Tweak ObjC++ message argument handling; call objc_finish_message_expr() instead of finish_message_expr(). (finish_message_expr): Rename to objc_finish_message_expr(); use OBJC_TYPE_NAME and OBJC_SET_TYPE_NAME macros instead of TYPE_NAME. call gen_type_name() instead of gen_declaration(); call objc_is_id() instead of using IS_ID and IS_CLASS; Use objc_class_name instead of calling get_identifier("Class"); handle CONVERT_EXPRs in receiver. (build_objc_method_call, warn_with_method): Do not call groktypename(). (build_ivar_reference): Call convert() instead of clobbering in a type. (hash_init): Initialize string_htab hash table. (add_instance_variable): Simplify parameter list; do not call grokfield(); do not populate CLASS_IVARS list. (start_class): Check for the existence of super class, if one was specified. (continue_class): Use CLASS_RAW_IVARS rather than CLASS_IVARS; do not call build_class_template(); adjust call to get_class_ivars(); call build_decl(), pushdecl() and finish_decl() instead of define_decl(). (finish_class): Call build_decl(), pushdecl() and finish_decl() instead of define_decl(). (add_protocols): Use PROTOCOL_BINFO_ELTS for the tree vector size. (start_protocol): Do not call build_protocol_template(); use PROTOCOL_BINFO_ELTS for the tree vector size. (encode_type_qualifiers): Do not handle the 'const' qualifier here. (encode_pointer): Encode 'const char *' as 'r*', for backwards compatibility. (encode_array): Use HOST_WIDE_INT_PRINT_DEC instead of "%ld". (encode_type): Handle the 'const' qualifier here. (objc_parmlist): New global variable, sued by objc_push_parm and objc_get_parm_info(). (objc_push_parm, objc_get_parm_info): New functions. (objc_expr_last): Remove function. (synth_self_and_ucmd_args): For instance methods, use the instance type for 'self'; call objc_push_parm() instead of push_parm_decl(). (start_method_def): Do not call push_scope(), declare_parm_level(), pop_scope(), push_parm_decl(), store_parm_decls() or objc_expr_last(); just use objc_push_parm() and objc_get_parm_info(). (comp_method_with_proto): Remove function. (objc_types_are_equivalent): Strip away indirections before comparing underlying types. (comp_proto_with_proto): Do not call groktypename(); types are no longer in raw declspec format. (objc_start_function): New function. (really_start_method): Call comp_proto_with_proto() instead of comp_method_with_proto(); call objc_start_function() instead of hand-crafting a function declarator. (continue_method_def, objc_expand_function_end): Remove functions. (get_super_receiver): Call objc_get_current_scope() instead of get_current_scope(); reference 'super_class' field (instead of 'class'). (finish_method_def): Rename to objc_finish_method_definition() and add a function decl parameter; move method encoding call from objc_expand_function_end(). (is_complex_decl, adorn_decl, gen_declarator, gen_declspecs, gen_declaration_1): Remove functions. (tmpbuf, RAW_DECLSPEC): Remove. (gen_declaration): Remove second parameter; simplify to deal with TYPE_P nodes instead of raw declspecs. (gen_type_name, gen_type_name_0): New functions. (gen_method_decl): Remove second parameter; call gen_type_name() instead of gen_declaration_1(). (dump_interface): Adjust calls to gen_declaration() and gen_method_decl(); do not allocate a separate string buffer. (init_objc): Allocate a larger string buffer to accommodate dump_interface(); adjust call to build_module_descriptor(); add call to build_module_initializer_routine() for the GNU runtime. (generate_classref_translation_entry): Do not call start_decl(); call finish_var_decl() instead of finish_decl(); call convert() instead of build_c_cast(). * objc-act.h (CLASS_OWN_IVARS): Remove accessor. (CLASS_BINFO_ELTS): Reduce from 6 to 5, now that CLASS_OWN_IVARS is gone. (OCTI_GNU_INIT_DECL, GNU_INIT_decl): New. (OCTI_ELLIPSIS_NODE, objc_ellipsis_node): Remove. (OCTI_ID_ID, id_type, objc_id_id): Rename to OCTI_ID_NAME, objc_object_type and objc_object_name, respectively. (OCTI_CLS_REF, OCTI_CLASS_NAME, objc_class_reference, objc_class_name): New. (IS_CLASS): New macro. (IS_ID, IS_SUPER): Robustify. (OCTI_EXECCLASS_DECL, execclass_decl): New. (finish_file, start_class, continue_class, finish_class, start_method_def, continue_method_def, finish_method_def, start_protocol, finish_protocol, objc_build_throw_stmt, objc_build_try_catch_finally_stmt, objc_build_synchronized_prologue, objc_build_synchronized_epilogue, objc_build_try_prologue, objc_build_try_epilogue, objc_build_catch_stmt, objc_build_catch_epilogue, objc_build_finally_prologue, objc_build_finally_epilogue, is_ivar, is_private, is_public, add_instance_variable, objc_add_method, get_super_receiver, objc_clear_super_receiver, get_class_ivars_from_name, get_class_reference, get_static_reference, get_object_reference, build_message_expr, finish_message_expr, build_selector_expr, build_ivar_reference, build_keyword_decl, build_method_decl, build_protocol_expr, build_objc_string_object, objc_declare_alias, objc_declare_class, objc_declare_protocols, objc_comptypes, objc_check_decl, build_encode_expr): Remove prototypes. (imp_count, cat_count): Make GGC-aware. (OBJC_SET_TYPE_NAME): New macro. From-SVN: r87168
2004-09-08 02:49:44 +02:00
{
tree fndecl = build_decl (FUNCTION_DECL, name, type);
c-tree.h (enum c_declarator_kind, [...]): New. * c-tree.h (enum c_declarator_kind, struct c_arg_info, struct c_declarator, struct c_type_name, struct c_parm): New. (build_array_declarator, set_array_declarator_inner, get_parm_info, grokfield, groktypename, grokparm, push_parm_decl, start_function, start_decl, build_c_parm, build_attrs_declarator, build_function_declarator, make_pointer_declarator, c_cast_expr, store_parm_decls_newstyle, c_expr_sizeof_type): Update prototypes. (build_id_declarator): New. * c-typeck.c (c_cast_expr, c_expr_sizeof_type): Update to new structures. * c-decl.c (ARG_INFO_PARMS, ARG_INFO_TAGS, ARG_INFO_TYPES, ARG_INFO_OTHERS): Remove. (build_id_declarator): New. (build_array_declarator, set_array_declarator_inner, groktypename, start_decl, grokparm, push_parm_decl, grokparms, get_parm_info, grokfield, start_function, store_parm_decls_newstyle, store_parm_decls_oldstyle, store_parm_decls, build_c_parm, build_attrs_declarator, build_function_declarator, make_pointer_declarator, grokdeclarator): Update to new structures. * c-parse.in (%union): Add arginfotype, dtrtype, typenametype and parmtype. (declarator, notype_declarator, after_type_declarator, parm_declarator, parm_declarator_starttypename, parm_declarator_nostarttypename, array_declarator, typename, absdcl, absdcl1, absdcl1_ea, absdcl1_noea, direct_absdcl1, absdcl_maybe_attribute, parm, firstparm, parms, parmlist, parmlist_1, parmlist_2, parmlist_or_identifiers, parmlist_or_identifiers_1): Use these types. (primary, after_type_declarator, parm_declarator_starttypename, notype_declarator, component_decl, component_declarator, component_notype_declarator, typename, absdcl, absdcl_maybe_attribute, absdcl1_ea, direct_absdcl1, parmlist_1, parmlist_2, parmlist_or_identifiers_1): Update to new structures. objc: * objc-act.c (objc_start_function, really_start_method, objc_get_parm_info, start_method_def): Update to new arg_info structures. From-SVN: r87217
2004-09-09 03:19:15 +02:00
#ifdef OBJCPLUS
Makefile.in (c-parse.o): Depend on $(C_COMMON_H). [gcc/ChangeLog] 2004-09-07 Ziemowit Laski <zlaski@apple.com> * Makefile.in (c-parse.o): Depend on $(C_COMMON_H). * c-parse.in: Include c-common.h instead of objc-act.h. (ivar_decl_list, ivar_decls, ivar_decl, ivars, ivar_declarator, myparms, myparm): Remove %type declarations. (methodtype, optparms, OBJC_TYPE_QUAL, objc_quals, objc_qual, objc_typename, objc_try_catch_stmt, optellipsis): Add %type declarations. (objc_inherit_code, objc_public_flag): Remove. (typespec_nonreserved_nonattr): Call objc_get_protocol_qualified_type() instead of get_static_reference() and get_protocol_reference(). (stmt_nocomp): Call grokparm() on @catch parameter. (objcdef): Move semantic action to objc_finish_implementation(). (classdef): Move semantic action to objc_start_class_interface(), objc_continue_interface(), objc_finish_interface(), objc_start_class_implementation(), objc_continue_implementation(), objc_start_category_interface() and objc_start_category_implementation(). (protocoldef): Move semantic actions to objc_start_protocol() and objc_finish_interface(). (ivar_decl_list): Remove nonterminal. (visibility_spec): Move semantic actions to objc_set_visibility(). (ivar_decls): Remove assignment to $$. (ivar_decl): Rephrase in terms of component_decl; call objc_add_instance_variable(). (ivars, ivar_declarator): Remove nonterminals. (opt_semi): New nonterminal. (methodtype): Remove semantic actions. (methoddef): Move semantic actions to objc_set_method_type(), objc_start_method_definition() and objc_finish_method_definition(). (methodproto): Move semantic actions to objc_set_method_type() and objc_add_method_declaration(). (methoddecl): Use objc_typename instead of typename; move semantic actions to objc_build_method_signature(). (optarglist, myxdecls, mydecl, myparms, myparm): Remove nonterminals. (optparmlist): Express in terms of optparms and optellipsis. (optparms, optellipsis, objc_qual, objc_quals, objc_typename): New nonterminals. (keyworddecl): Use objc_typename instead of typename. (rid_to_yy): Mark RID_IN, RID_OUT, RID_INOUT, RID_BYCOPY, RID_BYREF and RID_ONEWAY as returning OBJC_TYPE_QUAL to yyparse(). [gcc/objc/ChangeLog] 2004-09-07 Ziemowit Laski <zlaski@apple.com> * Make-lang.in (objc/objc-parse.o): Depend on $(C_COMMON_H) instead of objc/objc-act.h. (objc/objc-act.o): Depend on $(HASHTAB_H). * objc-act.c: Include hashtab.h; in ObjC++ mode, include cp-tree.h and objcp-decl.h instead of c-tree.h. (build_module_descriptor, get_class_ivars, synth_id_with_class_suffix, error_with_ivar, gen_method_decl, gen_declaration, setup_string_decl, build_protocol_template): Adjust prototypes. (build_module_initializer_routine, start_class, continue_class, finish_class, start_method_def, objc_start_function, start_protocol, build_method_decl, objc_add_method, add_instance_variable, build_ivar_reference, is_ivar, is_private, get_super_receiver, build_selector_table_decl, objc_push_parm, objc_get_parm_info, gen_type_name, gen_type_name_0, start_var_decl, finish_var_decl, create_field_decl): New prototypes. (objc_expand_function_end, comp_method_with_proto, objc_expr_last, gen_declaration_1, gen_declarator, is_complex_decl, adorn_decl, define_decl, create_builtin_decl, gen_declspecs): Remove prototypes. (TYPE_ID): Rename to OBJECT_TYPEDEF_NAME. (CLASS_TYPEDEF_NAME): New. (TAG_EXECCLASS): Change from a global variable to a #define. (TAG_RETURN_STRUCT): Delete. (TAG_GNUINIT): New, holds '__objc_gnu_init' name. (objc_inherit_code, objc_public_flag): New, moved from c-parse.in. (string_descriptor): New struct. (string_htab): New hash table. (string_hash, string_eq): New prototypes. (generate_struct_by_value_array): Call create_field_decl() instead of create_builtin_decl(). (objc_init): Do not initialize objc_ellipsis_node or TAG_EXECCLASS; In ObjC++ mode, call cxx_init() instead of c_objc_common_init(). (objc_finish_file): In ObjC++, call instantiate_pending_templates() and cp_finish_file(). (define_decl, get_static_reference, get_protocol_reference, create_builtin_decl): Remove functions. (objc_start_class_interface, objc_start_category_interface, objc_start_protocol, objc_continue_interface, objc_finish_interface, objc_start_class_implementation, objc_start_category_implementation, objc_continue_implementation, objc_finish_implementation, objc_set_visibility, objc_set_method_type, objc_build_method_signature, objc_add_method_declaration, objc_start_method_definition, objc_add_instance_variable, objc_get_protocol_qualified_type, create_field_decl, start_var_decl, finish_var_decl): New functions. (setup_string_decl): Simplify since it is only called once. (synth_module_prologue): Call build_class_template(); predefine 'id' and 'Class' as typedefs; rename 'temp_type' to 'type'; disable debug hooks for duration of function; fix GNU runtime messenger signatures to correspond to reality; forward-declare '__objc_exec_class' for the GNU runtime; call build_selector_table_decl(); in ObjC++ mode, generate 'extern "C" { ... }' wrappers around synthesized declarations; call build_protocol_template() and build_category_template(). (string_hash, string_eq): New functions. (objc_build_string_object): Check metaclass correctness only once; store string literals in hash table. (objc_build_constructor): Do not convert initializer elements; adjust for ObjC++ impedance mismatch. (build_objc_symtab_template): Call create_field_decl() instead of create_builtin_decl(). (init_objc_symtab): Add missing conversion to initializer element. (build_metadata_decl): Call start_var_decl() instead of define_decl(). (generate_objc_symtab_decl): Do not call build_category_template(); call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(). (build_module_descriptor): Call create_field_decl() instead of grokfield(); call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(); always mark module descriptor as used; move GNU runtime-specific functionality to build_module_initializer_routine(). (build_module_initializer_routine): New function, broken off of build_module_descriptor(). (objc_static_init_needed_p, objc_generate_static_init_call): New functions. (generate_static_references, generate_strings, build_selector_translation_table, generate_descriptor_table, generate_ivars_list, generate_dispatch_table, generate_category): Call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(); build a type directly instead of via groktypename(). (build_selector_reference_decl, build_selector_table_decl, build_class_reference_decl, build_protocol_reference, generate_objc_image_info): Call start_var_decl() instead of build_decl(). (build_selector_reference): For GNU runtime, do not call build_selector_reference_decl(). (build_selector, build_typed_selector_reference): Always convert result to the selector type. (add_objc_string): Cast return value to 'char *'. (build_method_prototype_template, build_selector_template, build_method_template): Use actual selector type for fields pointing to selectors. (finish_objc): For GNU runtime, call build_module_initializer_routine() after build_module_descriptor(). (generate_protocol_list, generate_shared_structures): Call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(); build a type directly instead of via groktypename(). (synth_id_with_class_suffix): Return a string. (get_arg_type_list): For instance methods, use the instance type for 'self'; do not call groktypename_in_parm_context(). (build_objc_string_decl): Squash redeclaration errors in ObjC++. (objc_is_class_name): Use OBJC_TYPE_NAME instead of TYPE_NAME; handle RECORD_TYPEs in ObjC as well as ObjC++. (objc_is_id): New function. (objc_is_object_ptr): Return the canonical type node. (objc_get_class_ivars): Simplify using get_class_ivars(). (get_class_ivars): Remove second parameter; create a fresh copy of the ivar list for each call; do not check for existence of super class. (objc_eh_runtime_type): Mark #ifndef OBJCPLUS. (objc_init_exceptions): When using SJLJ-style exceptions, require the use of '-fobjc-exceptions' flag; do not require it for DWARF-style exceptions. (objc_build_exc_ptr, next_sjlj_build_try_catch_finally): Use objc_object_type instead of objc_id_type. (objc_begin_catch_clause): Convert the incoming PARM_DECL into a VAR_DECL before placing it in the appropriate scope; do not call define_decl(); adjust call to c_begin_compound_stmt(); use objc_object_type instead of objc_id_type. (build_next_objc_exception_stuff): Call create_field_decl() instead of create_builtin_decl(); construct type directly instead of calling groktypename(); use OBJC_VOID_AT_END to mark end of function parameters. (build_private_template): Adjust call to get_class_ivars(); build a type directly instead of via groktypename(). (build_protocol_template, build_method_prototype_list_template, build_method_prototype_template, build_category_template, build_selector_template, build_class_template, build_super_template, build_ivar_template, build_ivar_list_template, build_method_list_template, build_method_template): Call create_field_decl() instead of grokfield(). (objc_method_parm_type): Do not call groktypename(). (generate_descriptor_table): Call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(). (generate_method_descriptors, build_protocol_initializer, generate_dispatch_tables, build_category_initializer, build_shared_structure_initializer): Do not call groktypename(). (generate_protocols): Call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(); do not call groktypename(). (error_with_ivar): Remove last parameter. (check_ivars): Do not iterate ovar CLASS_RAW_IVARS lists in addition to CLASS_IVARS lists; adjust calls to error_with_ivar(). (generate_ivar_lists): Convert one of the initializer elements; do not call groktypename(). (get_arg_type_list, start_method_def, gen_method_def): Account for new representation of variable arguments and '...' in Objective-C methods; add Objective-C++ impedance matching code. (is_objc_type_qualifier): Remove function. (adjust_type_for_id_default): Simplify; there is no longer a need to wade through declspecs. (lookup_interface, start_class, continue_class, finish_class, start_method_def, start_protocol, build_method_decl, objc_add_method, add_instance_variable, build_ivar_reference, is_ivar, is_private, get_super_receiver, objc_build_finally_epilogue): Make into static functions. (receiver_is_class_object): Use new IS_CLASS() macro. (objc_build_message_expr): Tweak ObjC++ message argument handling; call objc_finish_message_expr() instead of finish_message_expr(). (finish_message_expr): Rename to objc_finish_message_expr(); use OBJC_TYPE_NAME and OBJC_SET_TYPE_NAME macros instead of TYPE_NAME. call gen_type_name() instead of gen_declaration(); call objc_is_id() instead of using IS_ID and IS_CLASS; Use objc_class_name instead of calling get_identifier("Class"); handle CONVERT_EXPRs in receiver. (build_objc_method_call, warn_with_method): Do not call groktypename(). (build_ivar_reference): Call convert() instead of clobbering in a type. (hash_init): Initialize string_htab hash table. (add_instance_variable): Simplify parameter list; do not call grokfield(); do not populate CLASS_IVARS list. (start_class): Check for the existence of super class, if one was specified. (continue_class): Use CLASS_RAW_IVARS rather than CLASS_IVARS; do not call build_class_template(); adjust call to get_class_ivars(); call build_decl(), pushdecl() and finish_decl() instead of define_decl(). (finish_class): Call build_decl(), pushdecl() and finish_decl() instead of define_decl(). (add_protocols): Use PROTOCOL_BINFO_ELTS for the tree vector size. (start_protocol): Do not call build_protocol_template(); use PROTOCOL_BINFO_ELTS for the tree vector size. (encode_type_qualifiers): Do not handle the 'const' qualifier here. (encode_pointer): Encode 'const char *' as 'r*', for backwards compatibility. (encode_array): Use HOST_WIDE_INT_PRINT_DEC instead of "%ld". (encode_type): Handle the 'const' qualifier here. (objc_parmlist): New global variable, sued by objc_push_parm and objc_get_parm_info(). (objc_push_parm, objc_get_parm_info): New functions. (objc_expr_last): Remove function. (synth_self_and_ucmd_args): For instance methods, use the instance type for 'self'; call objc_push_parm() instead of push_parm_decl(). (start_method_def): Do not call push_scope(), declare_parm_level(), pop_scope(), push_parm_decl(), store_parm_decls() or objc_expr_last(); just use objc_push_parm() and objc_get_parm_info(). (comp_method_with_proto): Remove function. (objc_types_are_equivalent): Strip away indirections before comparing underlying types. (comp_proto_with_proto): Do not call groktypename(); types are no longer in raw declspec format. (objc_start_function): New function. (really_start_method): Call comp_proto_with_proto() instead of comp_method_with_proto(); call objc_start_function() instead of hand-crafting a function declarator. (continue_method_def, objc_expand_function_end): Remove functions. (get_super_receiver): Call objc_get_current_scope() instead of get_current_scope(); reference 'super_class' field (instead of 'class'). (finish_method_def): Rename to objc_finish_method_definition() and add a function decl parameter; move method encoding call from objc_expand_function_end(). (is_complex_decl, adorn_decl, gen_declarator, gen_declspecs, gen_declaration_1): Remove functions. (tmpbuf, RAW_DECLSPEC): Remove. (gen_declaration): Remove second parameter; simplify to deal with TYPE_P nodes instead of raw declspecs. (gen_type_name, gen_type_name_0): New functions. (gen_method_decl): Remove second parameter; call gen_type_name() instead of gen_declaration_1(). (dump_interface): Adjust calls to gen_declaration() and gen_method_decl(); do not allocate a separate string buffer. (init_objc): Allocate a larger string buffer to accommodate dump_interface(); adjust call to build_module_descriptor(); add call to build_module_initializer_routine() for the GNU runtime. (generate_classref_translation_entry): Do not call start_decl(); call finish_var_decl() instead of finish_decl(); call convert() instead of build_c_cast(). * objc-act.h (CLASS_OWN_IVARS): Remove accessor. (CLASS_BINFO_ELTS): Reduce from 6 to 5, now that CLASS_OWN_IVARS is gone. (OCTI_GNU_INIT_DECL, GNU_INIT_decl): New. (OCTI_ELLIPSIS_NODE, objc_ellipsis_node): Remove. (OCTI_ID_ID, id_type, objc_id_id): Rename to OCTI_ID_NAME, objc_object_type and objc_object_name, respectively. (OCTI_CLS_REF, OCTI_CLASS_NAME, objc_class_reference, objc_class_name): New. (IS_CLASS): New macro. (IS_ID, IS_SUPER): Robustify. (OCTI_EXECCLASS_DECL, execclass_decl): New. (finish_file, start_class, continue_class, finish_class, start_method_def, continue_method_def, finish_method_def, start_protocol, finish_protocol, objc_build_throw_stmt, objc_build_try_catch_finally_stmt, objc_build_synchronized_prologue, objc_build_synchronized_epilogue, objc_build_try_prologue, objc_build_try_epilogue, objc_build_catch_stmt, objc_build_catch_epilogue, objc_build_finally_prologue, objc_build_finally_epilogue, is_ivar, is_private, is_public, add_instance_variable, objc_add_method, get_super_receiver, objc_clear_super_receiver, get_class_ivars_from_name, get_class_reference, get_static_reference, get_object_reference, build_message_expr, finish_message_expr, build_selector_expr, build_ivar_reference, build_keyword_decl, build_method_decl, build_protocol_expr, build_objc_string_object, objc_declare_alias, objc_declare_class, objc_declare_protocols, objc_comptypes, objc_check_decl, build_encode_expr): Remove prototypes. (imp_count, cat_count): Make GGC-aware. (OBJC_SET_TYPE_NAME): New macro. From-SVN: r87168
2004-09-08 02:49:44 +02:00
DECL_ARGUMENTS (fndecl) = params;
DECL_INITIAL (fndecl) = error_mark_node;
DECL_EXTERNAL (fndecl) = 0;
TREE_STATIC (fndecl) = 1;
retrofit_lang_decl (fndecl);
cplus_decl_attributes (&fndecl, attrs, 0);
start_preparsed_function (fndecl, attrs, /*flags=*/SF_DEFAULT);
#else
re PR c/12913 (Jumps into variable length array scope not rejected) PR c/12913 * c-tree.h (struct c_label_list): Update comment. (struct c_label_context): Rename to struct c_label_context_se. (label_context_stack): Rename to label_context_stack_se. (C_DECL_UNJUMPABLE_VM, C_DECL_UNDEFINABLE_VM, struct c_label_context_vm, label_context_stack_vm, c_begin_vm_scope, c_end_vm_scope): New. (C_DECL_DECLARED_BUILTIN, C_DECL_USED): Use FUNCTION_DECL_CHECK. * c-decl.c (pop_scope): Call c_end_vm_scope. (pushdecl): Call c_begin_vm_scope for variably modified declarations. (define_label): Check for jumping into scope of identifier with variably modified type. Push label on stack for those defined at current context of identifiers with variably modified type. (start_function): Create stack level for context of identifiers with variably modified type. (finish_function): Pop stack level for context of identifiers with variably modified type. * c-typeck.c (label_context_stack): Rename to label_context_stack_se. (label_context_stack_vm, c_begin_vm_scope, c_end_vm_scope): New. (c_finish_goto_label): Check for jumping into scope of identifier with variably modified type. Push label on stack for those jumped to from current context of identifiers with variably modified type. (struct c_switch): Add blocked_vm. (c_start_case): Initialize blocked_vm. (do_case): Check blocked_vm. (c_finish_case): Add comment. (c_begin_stmt_expr, c_finish_stmt_expr): Update for renamed variable label_context_stack. objc: * objc-act.c (objc_start_function): Create stack level for context of identifiers with variably modified type. testsuite: * gcc.dg/c99-vla-jump-1.c, gcc.dg/c99-vla-jump-2.c, gcc.dg/c99-vla-jump-3.c, gcc.dg/c99-vla-jump-4.c, gcc.dg/c99-vla-jump-5.c: New tests. From-SVN: r98464
2005-04-20 18:41:48 +02:00
struct c_label_context_se *nstack_se;
struct c_label_context_vm *nstack_vm;
nstack_se = XOBNEW (&parser_obstack, struct c_label_context_se);
nstack_se->labels_def = NULL;
nstack_se->labels_used = NULL;
nstack_se->next = label_context_stack_se;
label_context_stack_se = nstack_se;
nstack_vm = XOBNEW (&parser_obstack, struct c_label_context_vm);
nstack_vm->labels_def = NULL;
nstack_vm->labels_used = NULL;
nstack_vm->scope = 0;
nstack_vm->next = label_context_stack_vm;
label_context_stack_vm = nstack_vm;
Yet more Objective-C++... * objc-act.c (objc_finish_try_stmt): Add return value. (objc_build_synchronized): Likewise. * objc-act.c (objc_is_gcable_type): Add. (objc_substitute_decl): Add. (objc_build_ivar_assignment): Add. (objc_build_global_assignment): Add. (objc_build_strong_cast_assignment): Add. (objc_is_ivar_reference_p): Add. (objc_is_global_reference_p): Add. (objc_generate_write_barrier): Add. (objc_rewrite_function_call): Add. (objc_gimplify_expr): Add Objective-C++ support. * objc-act.h (ALLOC_OBJC_TYPE_LANG_SPECIFIC): Likewise. (SIZEOF_OBJC_TYPE_LANG_SPECIFIC): Add. (INIT_TYPE_OBJC_INFO): Add Objective-C++ support. (DUP_TYPE_OBJC_INFO): Likewise. (struct imp_entry): Add field has_cxx_cdtors. (struct imp_entry *imp_list): Add OCTI_UMSG_FAST_DECL, OCTI_METH_LIST_TEMPL, OCTI_METH_PROTO_LIST_TEMPL, OCTI_IVAR_LIST_TEMPL, OCTI_ASSIGN_IVAR_DECL, OCTI_ASSIGN_IVAR_FAST_DECL, OCTI_ASSIGN_GLOBAL_DECL, OCTI_ASSIGN_STRONGCAST_DECL. (umsg_fast_decl): Add. (objc_assign_ivar_decl): Add. (objc_assign_ivar_fast_decl): Add. (objc_assign_global_decl): Add. (objc_assign_strong_cast_decl): Add. (objc_method_list_ptr): Add. (objc_method_proto_list_ptr): Add. (objc_ivar_list_ptr): Add. * objc-act.c (should_call_super_dealloc): Add. (OBJC_VERSION): Bump to 6. (objc_is_gcable_type): Add. (objc_substitute_decl): Add. (objc_build_ivar_assignment): Add. (objc_build_global_assignment): Add. (objc_build_strong_cast_assignment): Add. (objc_is_gcable_p): Add. (objc_is_ivar_reference_p): Add. (objc_is_global_reference_p): Add. (generate_shared_structures): Add flags parameter. (objc_generate_cxx_ctor_or_dtor): Add. (objc_generate_cxx_cdtors): Add. (add_class): Add name parameter. (objc_types_share_size_and_alignment): Add. (comp_proto_with_proto): Add strict parameter. (CLS_HAS_CXX_STRUCTORS): Add. (TAG_ASSIGNIVAR): Add. (TAG_ASSIGNGLOBAL): Add. (TAG_ASSIGNSTRONGCAST): Add. (TAG_MSGSEND_FAST): Add. (TAG_ASSIGNIVAR_FAST): Add. (TAG_CXX_CONSTRUCT): Add. (TAG_CXX_DESTRUCT): Add. (OBJC_LOOKUP_CLASS): Add. (OBJC_LOOKUP_NO_SUPER): Add. (objc_finish_file): Add pch support. (objc_finish_implementation): Add Objective-C++ support. (synth_module_prologue): Likewise. (synth_module_prologue): Add fast dispatching. (objc_get_class_reference): Add Objective-C++ support. (objc_generate_write_barrier): Likewise. (next_sjlj_build_enter_and_setjmp): Likewise. (objc_begin_try_stmt): Likewise. (build_next_objc_exception_stuff): Add fast ivar support. (build_private_template): Mark the record as used so debug information is generated. (build_protocol_template): Add Objective-C++ support. (objc_method_parm_type) Likewise. (objc_generate_cxx_ctor_or_dtor): Likewise. (objc_generate_cxx_cdtors): Likewise. (build_protocol_initializer): Likewise. (build_category_template): Likewise. (build_class_template): Likewise. (build_method_list_template): Likewise. (build_category_initializer): Likewise. (build_shared_structure_initializer): Likewise. (objc_finish_message_expr): Likewise. (build_objc_method_call): Add fast dispatch support. (lookup_method_static): Add support to end search at superclasses. (add_method_to_hash_list): Add strict parameter to comp_proto_with_proto. (objc_add_method): Likewise. (objc_add_method): Also set the interface_value. (add_instance_variable): Add Objective-C++ support. (objc_is_public): Likewise. (start_class): Likewise. (continue_class): Likewise. (encode_aggregate_within): Likewise. (start_method_def): Likewise. (objc_start_function): Clear current_function_returns_value and current_function_returns_null. (really_start_method): Add Objective-C++ support. (objc_finish_method_definition): Add warning for missing [super dealloc]. (finish_objc): Add Objective-C++ support. (generate_objc_image_info): Likewise. (objc_lookup_ivar): Likewise. * objc-act.h (TYPE_HAS_OBJC_INFO): Likewise. (INIT_TYPE_OBJC_INFO): Likewise. (DUP_TYPE_OBJC_INFO): Likewise. From-SVN: r99857
2005-05-17 22:07:08 +02:00
current_function_returns_value = 0; /* Assume, until we see it does. */
current_function_returns_null = 0;
Makefile.in (c-parse.o): Depend on $(C_COMMON_H). [gcc/ChangeLog] 2004-09-07 Ziemowit Laski <zlaski@apple.com> * Makefile.in (c-parse.o): Depend on $(C_COMMON_H). * c-parse.in: Include c-common.h instead of objc-act.h. (ivar_decl_list, ivar_decls, ivar_decl, ivars, ivar_declarator, myparms, myparm): Remove %type declarations. (methodtype, optparms, OBJC_TYPE_QUAL, objc_quals, objc_qual, objc_typename, objc_try_catch_stmt, optellipsis): Add %type declarations. (objc_inherit_code, objc_public_flag): Remove. (typespec_nonreserved_nonattr): Call objc_get_protocol_qualified_type() instead of get_static_reference() and get_protocol_reference(). (stmt_nocomp): Call grokparm() on @catch parameter. (objcdef): Move semantic action to objc_finish_implementation(). (classdef): Move semantic action to objc_start_class_interface(), objc_continue_interface(), objc_finish_interface(), objc_start_class_implementation(), objc_continue_implementation(), objc_start_category_interface() and objc_start_category_implementation(). (protocoldef): Move semantic actions to objc_start_protocol() and objc_finish_interface(). (ivar_decl_list): Remove nonterminal. (visibility_spec): Move semantic actions to objc_set_visibility(). (ivar_decls): Remove assignment to $$. (ivar_decl): Rephrase in terms of component_decl; call objc_add_instance_variable(). (ivars, ivar_declarator): Remove nonterminals. (opt_semi): New nonterminal. (methodtype): Remove semantic actions. (methoddef): Move semantic actions to objc_set_method_type(), objc_start_method_definition() and objc_finish_method_definition(). (methodproto): Move semantic actions to objc_set_method_type() and objc_add_method_declaration(). (methoddecl): Use objc_typename instead of typename; move semantic actions to objc_build_method_signature(). (optarglist, myxdecls, mydecl, myparms, myparm): Remove nonterminals. (optparmlist): Express in terms of optparms and optellipsis. (optparms, optellipsis, objc_qual, objc_quals, objc_typename): New nonterminals. (keyworddecl): Use objc_typename instead of typename. (rid_to_yy): Mark RID_IN, RID_OUT, RID_INOUT, RID_BYCOPY, RID_BYREF and RID_ONEWAY as returning OBJC_TYPE_QUAL to yyparse(). [gcc/objc/ChangeLog] 2004-09-07 Ziemowit Laski <zlaski@apple.com> * Make-lang.in (objc/objc-parse.o): Depend on $(C_COMMON_H) instead of objc/objc-act.h. (objc/objc-act.o): Depend on $(HASHTAB_H). * objc-act.c: Include hashtab.h; in ObjC++ mode, include cp-tree.h and objcp-decl.h instead of c-tree.h. (build_module_descriptor, get_class_ivars, synth_id_with_class_suffix, error_with_ivar, gen_method_decl, gen_declaration, setup_string_decl, build_protocol_template): Adjust prototypes. (build_module_initializer_routine, start_class, continue_class, finish_class, start_method_def, objc_start_function, start_protocol, build_method_decl, objc_add_method, add_instance_variable, build_ivar_reference, is_ivar, is_private, get_super_receiver, build_selector_table_decl, objc_push_parm, objc_get_parm_info, gen_type_name, gen_type_name_0, start_var_decl, finish_var_decl, create_field_decl): New prototypes. (objc_expand_function_end, comp_method_with_proto, objc_expr_last, gen_declaration_1, gen_declarator, is_complex_decl, adorn_decl, define_decl, create_builtin_decl, gen_declspecs): Remove prototypes. (TYPE_ID): Rename to OBJECT_TYPEDEF_NAME. (CLASS_TYPEDEF_NAME): New. (TAG_EXECCLASS): Change from a global variable to a #define. (TAG_RETURN_STRUCT): Delete. (TAG_GNUINIT): New, holds '__objc_gnu_init' name. (objc_inherit_code, objc_public_flag): New, moved from c-parse.in. (string_descriptor): New struct. (string_htab): New hash table. (string_hash, string_eq): New prototypes. (generate_struct_by_value_array): Call create_field_decl() instead of create_builtin_decl(). (objc_init): Do not initialize objc_ellipsis_node or TAG_EXECCLASS; In ObjC++ mode, call cxx_init() instead of c_objc_common_init(). (objc_finish_file): In ObjC++, call instantiate_pending_templates() and cp_finish_file(). (define_decl, get_static_reference, get_protocol_reference, create_builtin_decl): Remove functions. (objc_start_class_interface, objc_start_category_interface, objc_start_protocol, objc_continue_interface, objc_finish_interface, objc_start_class_implementation, objc_start_category_implementation, objc_continue_implementation, objc_finish_implementation, objc_set_visibility, objc_set_method_type, objc_build_method_signature, objc_add_method_declaration, objc_start_method_definition, objc_add_instance_variable, objc_get_protocol_qualified_type, create_field_decl, start_var_decl, finish_var_decl): New functions. (setup_string_decl): Simplify since it is only called once. (synth_module_prologue): Call build_class_template(); predefine 'id' and 'Class' as typedefs; rename 'temp_type' to 'type'; disable debug hooks for duration of function; fix GNU runtime messenger signatures to correspond to reality; forward-declare '__objc_exec_class' for the GNU runtime; call build_selector_table_decl(); in ObjC++ mode, generate 'extern "C" { ... }' wrappers around synthesized declarations; call build_protocol_template() and build_category_template(). (string_hash, string_eq): New functions. (objc_build_string_object): Check metaclass correctness only once; store string literals in hash table. (objc_build_constructor): Do not convert initializer elements; adjust for ObjC++ impedance mismatch. (build_objc_symtab_template): Call create_field_decl() instead of create_builtin_decl(). (init_objc_symtab): Add missing conversion to initializer element. (build_metadata_decl): Call start_var_decl() instead of define_decl(). (generate_objc_symtab_decl): Do not call build_category_template(); call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(). (build_module_descriptor): Call create_field_decl() instead of grokfield(); call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(); always mark module descriptor as used; move GNU runtime-specific functionality to build_module_initializer_routine(). (build_module_initializer_routine): New function, broken off of build_module_descriptor(). (objc_static_init_needed_p, objc_generate_static_init_call): New functions. (generate_static_references, generate_strings, build_selector_translation_table, generate_descriptor_table, generate_ivars_list, generate_dispatch_table, generate_category): Call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(); build a type directly instead of via groktypename(). (build_selector_reference_decl, build_selector_table_decl, build_class_reference_decl, build_protocol_reference, generate_objc_image_info): Call start_var_decl() instead of build_decl(). (build_selector_reference): For GNU runtime, do not call build_selector_reference_decl(). (build_selector, build_typed_selector_reference): Always convert result to the selector type. (add_objc_string): Cast return value to 'char *'. (build_method_prototype_template, build_selector_template, build_method_template): Use actual selector type for fields pointing to selectors. (finish_objc): For GNU runtime, call build_module_initializer_routine() after build_module_descriptor(). (generate_protocol_list, generate_shared_structures): Call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(); build a type directly instead of via groktypename(). (synth_id_with_class_suffix): Return a string. (get_arg_type_list): For instance methods, use the instance type for 'self'; do not call groktypename_in_parm_context(). (build_objc_string_decl): Squash redeclaration errors in ObjC++. (objc_is_class_name): Use OBJC_TYPE_NAME instead of TYPE_NAME; handle RECORD_TYPEs in ObjC as well as ObjC++. (objc_is_id): New function. (objc_is_object_ptr): Return the canonical type node. (objc_get_class_ivars): Simplify using get_class_ivars(). (get_class_ivars): Remove second parameter; create a fresh copy of the ivar list for each call; do not check for existence of super class. (objc_eh_runtime_type): Mark #ifndef OBJCPLUS. (objc_init_exceptions): When using SJLJ-style exceptions, require the use of '-fobjc-exceptions' flag; do not require it for DWARF-style exceptions. (objc_build_exc_ptr, next_sjlj_build_try_catch_finally): Use objc_object_type instead of objc_id_type. (objc_begin_catch_clause): Convert the incoming PARM_DECL into a VAR_DECL before placing it in the appropriate scope; do not call define_decl(); adjust call to c_begin_compound_stmt(); use objc_object_type instead of objc_id_type. (build_next_objc_exception_stuff): Call create_field_decl() instead of create_builtin_decl(); construct type directly instead of calling groktypename(); use OBJC_VOID_AT_END to mark end of function parameters. (build_private_template): Adjust call to get_class_ivars(); build a type directly instead of via groktypename(). (build_protocol_template, build_method_prototype_list_template, build_method_prototype_template, build_category_template, build_selector_template, build_class_template, build_super_template, build_ivar_template, build_ivar_list_template, build_method_list_template, build_method_template): Call create_field_decl() instead of grokfield(). (objc_method_parm_type): Do not call groktypename(). (generate_descriptor_table): Call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(). (generate_method_descriptors, build_protocol_initializer, generate_dispatch_tables, build_category_initializer, build_shared_structure_initializer): Do not call groktypename(). (generate_protocols): Call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(); do not call groktypename(). (error_with_ivar): Remove last parameter. (check_ivars): Do not iterate ovar CLASS_RAW_IVARS lists in addition to CLASS_IVARS lists; adjust calls to error_with_ivar(). (generate_ivar_lists): Convert one of the initializer elements; do not call groktypename(). (get_arg_type_list, start_method_def, gen_method_def): Account for new representation of variable arguments and '...' in Objective-C methods; add Objective-C++ impedance matching code. (is_objc_type_qualifier): Remove function. (adjust_type_for_id_default): Simplify; there is no longer a need to wade through declspecs. (lookup_interface, start_class, continue_class, finish_class, start_method_def, start_protocol, build_method_decl, objc_add_method, add_instance_variable, build_ivar_reference, is_ivar, is_private, get_super_receiver, objc_build_finally_epilogue): Make into static functions. (receiver_is_class_object): Use new IS_CLASS() macro. (objc_build_message_expr): Tweak ObjC++ message argument handling; call objc_finish_message_expr() instead of finish_message_expr(). (finish_message_expr): Rename to objc_finish_message_expr(); use OBJC_TYPE_NAME and OBJC_SET_TYPE_NAME macros instead of TYPE_NAME. call gen_type_name() instead of gen_declaration(); call objc_is_id() instead of using IS_ID and IS_CLASS; Use objc_class_name instead of calling get_identifier("Class"); handle CONVERT_EXPRs in receiver. (build_objc_method_call, warn_with_method): Do not call groktypename(). (build_ivar_reference): Call convert() instead of clobbering in a type. (hash_init): Initialize string_htab hash table. (add_instance_variable): Simplify parameter list; do not call grokfield(); do not populate CLASS_IVARS list. (start_class): Check for the existence of super class, if one was specified. (continue_class): Use CLASS_RAW_IVARS rather than CLASS_IVARS; do not call build_class_template(); adjust call to get_class_ivars(); call build_decl(), pushdecl() and finish_decl() instead of define_decl(). (finish_class): Call build_decl(), pushdecl() and finish_decl() instead of define_decl(). (add_protocols): Use PROTOCOL_BINFO_ELTS for the tree vector size. (start_protocol): Do not call build_protocol_template(); use PROTOCOL_BINFO_ELTS for the tree vector size. (encode_type_qualifiers): Do not handle the 'const' qualifier here. (encode_pointer): Encode 'const char *' as 'r*', for backwards compatibility. (encode_array): Use HOST_WIDE_INT_PRINT_DEC instead of "%ld". (encode_type): Handle the 'const' qualifier here. (objc_parmlist): New global variable, sued by objc_push_parm and objc_get_parm_info(). (objc_push_parm, objc_get_parm_info): New functions. (objc_expr_last): Remove function. (synth_self_and_ucmd_args): For instance methods, use the instance type for 'self'; call objc_push_parm() instead of push_parm_decl(). (start_method_def): Do not call push_scope(), declare_parm_level(), pop_scope(), push_parm_decl(), store_parm_decls() or objc_expr_last(); just use objc_push_parm() and objc_get_parm_info(). (comp_method_with_proto): Remove function. (objc_types_are_equivalent): Strip away indirections before comparing underlying types. (comp_proto_with_proto): Do not call groktypename(); types are no longer in raw declspec format. (objc_start_function): New function. (really_start_method): Call comp_proto_with_proto() instead of comp_method_with_proto(); call objc_start_function() instead of hand-crafting a function declarator. (continue_method_def, objc_expand_function_end): Remove functions. (get_super_receiver): Call objc_get_current_scope() instead of get_current_scope(); reference 'super_class' field (instead of 'class'). (finish_method_def): Rename to objc_finish_method_definition() and add a function decl parameter; move method encoding call from objc_expand_function_end(). (is_complex_decl, adorn_decl, gen_declarator, gen_declspecs, gen_declaration_1): Remove functions. (tmpbuf, RAW_DECLSPEC): Remove. (gen_declaration): Remove second parameter; simplify to deal with TYPE_P nodes instead of raw declspecs. (gen_type_name, gen_type_name_0): New functions. (gen_method_decl): Remove second parameter; call gen_type_name() instead of gen_declaration_1(). (dump_interface): Adjust calls to gen_declaration() and gen_method_decl(); do not allocate a separate string buffer. (init_objc): Allocate a larger string buffer to accommodate dump_interface(); adjust call to build_module_descriptor(); add call to build_module_initializer_routine() for the GNU runtime. (generate_classref_translation_entry): Do not call start_decl(); call finish_var_decl() instead of finish_decl(); call convert() instead of build_c_cast(). * objc-act.h (CLASS_OWN_IVARS): Remove accessor. (CLASS_BINFO_ELTS): Reduce from 6 to 5, now that CLASS_OWN_IVARS is gone. (OCTI_GNU_INIT_DECL, GNU_INIT_decl): New. (OCTI_ELLIPSIS_NODE, objc_ellipsis_node): Remove. (OCTI_ID_ID, id_type, objc_id_id): Rename to OCTI_ID_NAME, objc_object_type and objc_object_name, respectively. (OCTI_CLS_REF, OCTI_CLASS_NAME, objc_class_reference, objc_class_name): New. (IS_CLASS): New macro. (IS_ID, IS_SUPER): Robustify. (OCTI_EXECCLASS_DECL, execclass_decl): New. (finish_file, start_class, continue_class, finish_class, start_method_def, continue_method_def, finish_method_def, start_protocol, finish_protocol, objc_build_throw_stmt, objc_build_try_catch_finally_stmt, objc_build_synchronized_prologue, objc_build_synchronized_epilogue, objc_build_try_prologue, objc_build_try_epilogue, objc_build_catch_stmt, objc_build_catch_epilogue, objc_build_finally_prologue, objc_build_finally_epilogue, is_ivar, is_private, is_public, add_instance_variable, objc_add_method, get_super_receiver, objc_clear_super_receiver, get_class_ivars_from_name, get_class_reference, get_static_reference, get_object_reference, build_message_expr, finish_message_expr, build_selector_expr, build_ivar_reference, build_keyword_decl, build_method_decl, build_protocol_expr, build_objc_string_object, objc_declare_alias, objc_declare_class, objc_declare_protocols, objc_comptypes, objc_check_decl, build_encode_expr): Remove prototypes. (imp_count, cat_count): Make GGC-aware. (OBJC_SET_TYPE_NAME): New macro. From-SVN: r87168
2004-09-08 02:49:44 +02:00
decl_attributes (&fndecl, attrs, 0);
announce_function (fndecl);
DECL_INITIAL (fndecl) = error_mark_node;
DECL_EXTERNAL (fndecl) = 0;
TREE_STATIC (fndecl) = 1;
Makefile.in (c-parse.o): Depend on $(C_COMMON_H). [gcc/ChangeLog] 2004-09-07 Ziemowit Laski <zlaski@apple.com> * Makefile.in (c-parse.o): Depend on $(C_COMMON_H). * c-parse.in: Include c-common.h instead of objc-act.h. (ivar_decl_list, ivar_decls, ivar_decl, ivars, ivar_declarator, myparms, myparm): Remove %type declarations. (methodtype, optparms, OBJC_TYPE_QUAL, objc_quals, objc_qual, objc_typename, objc_try_catch_stmt, optellipsis): Add %type declarations. (objc_inherit_code, objc_public_flag): Remove. (typespec_nonreserved_nonattr): Call objc_get_protocol_qualified_type() instead of get_static_reference() and get_protocol_reference(). (stmt_nocomp): Call grokparm() on @catch parameter. (objcdef): Move semantic action to objc_finish_implementation(). (classdef): Move semantic action to objc_start_class_interface(), objc_continue_interface(), objc_finish_interface(), objc_start_class_implementation(), objc_continue_implementation(), objc_start_category_interface() and objc_start_category_implementation(). (protocoldef): Move semantic actions to objc_start_protocol() and objc_finish_interface(). (ivar_decl_list): Remove nonterminal. (visibility_spec): Move semantic actions to objc_set_visibility(). (ivar_decls): Remove assignment to $$. (ivar_decl): Rephrase in terms of component_decl; call objc_add_instance_variable(). (ivars, ivar_declarator): Remove nonterminals. (opt_semi): New nonterminal. (methodtype): Remove semantic actions. (methoddef): Move semantic actions to objc_set_method_type(), objc_start_method_definition() and objc_finish_method_definition(). (methodproto): Move semantic actions to objc_set_method_type() and objc_add_method_declaration(). (methoddecl): Use objc_typename instead of typename; move semantic actions to objc_build_method_signature(). (optarglist, myxdecls, mydecl, myparms, myparm): Remove nonterminals. (optparmlist): Express in terms of optparms and optellipsis. (optparms, optellipsis, objc_qual, objc_quals, objc_typename): New nonterminals. (keyworddecl): Use objc_typename instead of typename. (rid_to_yy): Mark RID_IN, RID_OUT, RID_INOUT, RID_BYCOPY, RID_BYREF and RID_ONEWAY as returning OBJC_TYPE_QUAL to yyparse(). [gcc/objc/ChangeLog] 2004-09-07 Ziemowit Laski <zlaski@apple.com> * Make-lang.in (objc/objc-parse.o): Depend on $(C_COMMON_H) instead of objc/objc-act.h. (objc/objc-act.o): Depend on $(HASHTAB_H). * objc-act.c: Include hashtab.h; in ObjC++ mode, include cp-tree.h and objcp-decl.h instead of c-tree.h. (build_module_descriptor, get_class_ivars, synth_id_with_class_suffix, error_with_ivar, gen_method_decl, gen_declaration, setup_string_decl, build_protocol_template): Adjust prototypes. (build_module_initializer_routine, start_class, continue_class, finish_class, start_method_def, objc_start_function, start_protocol, build_method_decl, objc_add_method, add_instance_variable, build_ivar_reference, is_ivar, is_private, get_super_receiver, build_selector_table_decl, objc_push_parm, objc_get_parm_info, gen_type_name, gen_type_name_0, start_var_decl, finish_var_decl, create_field_decl): New prototypes. (objc_expand_function_end, comp_method_with_proto, objc_expr_last, gen_declaration_1, gen_declarator, is_complex_decl, adorn_decl, define_decl, create_builtin_decl, gen_declspecs): Remove prototypes. (TYPE_ID): Rename to OBJECT_TYPEDEF_NAME. (CLASS_TYPEDEF_NAME): New. (TAG_EXECCLASS): Change from a global variable to a #define. (TAG_RETURN_STRUCT): Delete. (TAG_GNUINIT): New, holds '__objc_gnu_init' name. (objc_inherit_code, objc_public_flag): New, moved from c-parse.in. (string_descriptor): New struct. (string_htab): New hash table. (string_hash, string_eq): New prototypes. (generate_struct_by_value_array): Call create_field_decl() instead of create_builtin_decl(). (objc_init): Do not initialize objc_ellipsis_node or TAG_EXECCLASS; In ObjC++ mode, call cxx_init() instead of c_objc_common_init(). (objc_finish_file): In ObjC++, call instantiate_pending_templates() and cp_finish_file(). (define_decl, get_static_reference, get_protocol_reference, create_builtin_decl): Remove functions. (objc_start_class_interface, objc_start_category_interface, objc_start_protocol, objc_continue_interface, objc_finish_interface, objc_start_class_implementation, objc_start_category_implementation, objc_continue_implementation, objc_finish_implementation, objc_set_visibility, objc_set_method_type, objc_build_method_signature, objc_add_method_declaration, objc_start_method_definition, objc_add_instance_variable, objc_get_protocol_qualified_type, create_field_decl, start_var_decl, finish_var_decl): New functions. (setup_string_decl): Simplify since it is only called once. (synth_module_prologue): Call build_class_template(); predefine 'id' and 'Class' as typedefs; rename 'temp_type' to 'type'; disable debug hooks for duration of function; fix GNU runtime messenger signatures to correspond to reality; forward-declare '__objc_exec_class' for the GNU runtime; call build_selector_table_decl(); in ObjC++ mode, generate 'extern "C" { ... }' wrappers around synthesized declarations; call build_protocol_template() and build_category_template(). (string_hash, string_eq): New functions. (objc_build_string_object): Check metaclass correctness only once; store string literals in hash table. (objc_build_constructor): Do not convert initializer elements; adjust for ObjC++ impedance mismatch. (build_objc_symtab_template): Call create_field_decl() instead of create_builtin_decl(). (init_objc_symtab): Add missing conversion to initializer element. (build_metadata_decl): Call start_var_decl() instead of define_decl(). (generate_objc_symtab_decl): Do not call build_category_template(); call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(). (build_module_descriptor): Call create_field_decl() instead of grokfield(); call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(); always mark module descriptor as used; move GNU runtime-specific functionality to build_module_initializer_routine(). (build_module_initializer_routine): New function, broken off of build_module_descriptor(). (objc_static_init_needed_p, objc_generate_static_init_call): New functions. (generate_static_references, generate_strings, build_selector_translation_table, generate_descriptor_table, generate_ivars_list, generate_dispatch_table, generate_category): Call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(); build a type directly instead of via groktypename(). (build_selector_reference_decl, build_selector_table_decl, build_class_reference_decl, build_protocol_reference, generate_objc_image_info): Call start_var_decl() instead of build_decl(). (build_selector_reference): For GNU runtime, do not call build_selector_reference_decl(). (build_selector, build_typed_selector_reference): Always convert result to the selector type. (add_objc_string): Cast return value to 'char *'. (build_method_prototype_template, build_selector_template, build_method_template): Use actual selector type for fields pointing to selectors. (finish_objc): For GNU runtime, call build_module_initializer_routine() after build_module_descriptor(). (generate_protocol_list, generate_shared_structures): Call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(); build a type directly instead of via groktypename(). (synth_id_with_class_suffix): Return a string. (get_arg_type_list): For instance methods, use the instance type for 'self'; do not call groktypename_in_parm_context(). (build_objc_string_decl): Squash redeclaration errors in ObjC++. (objc_is_class_name): Use OBJC_TYPE_NAME instead of TYPE_NAME; handle RECORD_TYPEs in ObjC as well as ObjC++. (objc_is_id): New function. (objc_is_object_ptr): Return the canonical type node. (objc_get_class_ivars): Simplify using get_class_ivars(). (get_class_ivars): Remove second parameter; create a fresh copy of the ivar list for each call; do not check for existence of super class. (objc_eh_runtime_type): Mark #ifndef OBJCPLUS. (objc_init_exceptions): When using SJLJ-style exceptions, require the use of '-fobjc-exceptions' flag; do not require it for DWARF-style exceptions. (objc_build_exc_ptr, next_sjlj_build_try_catch_finally): Use objc_object_type instead of objc_id_type. (objc_begin_catch_clause): Convert the incoming PARM_DECL into a VAR_DECL before placing it in the appropriate scope; do not call define_decl(); adjust call to c_begin_compound_stmt(); use objc_object_type instead of objc_id_type. (build_next_objc_exception_stuff): Call create_field_decl() instead of create_builtin_decl(); construct type directly instead of calling groktypename(); use OBJC_VOID_AT_END to mark end of function parameters. (build_private_template): Adjust call to get_class_ivars(); build a type directly instead of via groktypename(). (build_protocol_template, build_method_prototype_list_template, build_method_prototype_template, build_category_template, build_selector_template, build_class_template, build_super_template, build_ivar_template, build_ivar_list_template, build_method_list_template, build_method_template): Call create_field_decl() instead of grokfield(). (objc_method_parm_type): Do not call groktypename(). (generate_descriptor_table): Call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(). (generate_method_descriptors, build_protocol_initializer, generate_dispatch_tables, build_category_initializer, build_shared_structure_initializer): Do not call groktypename(). (generate_protocols): Call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(); do not call groktypename(). (error_with_ivar): Remove last parameter. (check_ivars): Do not iterate ovar CLASS_RAW_IVARS lists in addition to CLASS_IVARS lists; adjust calls to error_with_ivar(). (generate_ivar_lists): Convert one of the initializer elements; do not call groktypename(). (get_arg_type_list, start_method_def, gen_method_def): Account for new representation of variable arguments and '...' in Objective-C methods; add Objective-C++ impedance matching code. (is_objc_type_qualifier): Remove function. (adjust_type_for_id_default): Simplify; there is no longer a need to wade through declspecs. (lookup_interface, start_class, continue_class, finish_class, start_method_def, start_protocol, build_method_decl, objc_add_method, add_instance_variable, build_ivar_reference, is_ivar, is_private, get_super_receiver, objc_build_finally_epilogue): Make into static functions. (receiver_is_class_object): Use new IS_CLASS() macro. (objc_build_message_expr): Tweak ObjC++ message argument handling; call objc_finish_message_expr() instead of finish_message_expr(). (finish_message_expr): Rename to objc_finish_message_expr(); use OBJC_TYPE_NAME and OBJC_SET_TYPE_NAME macros instead of TYPE_NAME. call gen_type_name() instead of gen_declaration(); call objc_is_id() instead of using IS_ID and IS_CLASS; Use objc_class_name instead of calling get_identifier("Class"); handle CONVERT_EXPRs in receiver. (build_objc_method_call, warn_with_method): Do not call groktypename(). (build_ivar_reference): Call convert() instead of clobbering in a type. (hash_init): Initialize string_htab hash table. (add_instance_variable): Simplify parameter list; do not call grokfield(); do not populate CLASS_IVARS list. (start_class): Check for the existence of super class, if one was specified. (continue_class): Use CLASS_RAW_IVARS rather than CLASS_IVARS; do not call build_class_template(); adjust call to get_class_ivars(); call build_decl(), pushdecl() and finish_decl() instead of define_decl(). (finish_class): Call build_decl(), pushdecl() and finish_decl() instead of define_decl(). (add_protocols): Use PROTOCOL_BINFO_ELTS for the tree vector size. (start_protocol): Do not call build_protocol_template(); use PROTOCOL_BINFO_ELTS for the tree vector size. (encode_type_qualifiers): Do not handle the 'const' qualifier here. (encode_pointer): Encode 'const char *' as 'r*', for backwards compatibility. (encode_array): Use HOST_WIDE_INT_PRINT_DEC instead of "%ld". (encode_type): Handle the 'const' qualifier here. (objc_parmlist): New global variable, sued by objc_push_parm and objc_get_parm_info(). (objc_push_parm, objc_get_parm_info): New functions. (objc_expr_last): Remove function. (synth_self_and_ucmd_args): For instance methods, use the instance type for 'self'; call objc_push_parm() instead of push_parm_decl(). (start_method_def): Do not call push_scope(), declare_parm_level(), pop_scope(), push_parm_decl(), store_parm_decls() or objc_expr_last(); just use objc_push_parm() and objc_get_parm_info(). (comp_method_with_proto): Remove function. (objc_types_are_equivalent): Strip away indirections before comparing underlying types. (comp_proto_with_proto): Do not call groktypename(); types are no longer in raw declspec format. (objc_start_function): New function. (really_start_method): Call comp_proto_with_proto() instead of comp_method_with_proto(); call objc_start_function() instead of hand-crafting a function declarator. (continue_method_def, objc_expand_function_end): Remove functions. (get_super_receiver): Call objc_get_current_scope() instead of get_current_scope(); reference 'super_class' field (instead of 'class'). (finish_method_def): Rename to objc_finish_method_definition() and add a function decl parameter; move method encoding call from objc_expand_function_end(). (is_complex_decl, adorn_decl, gen_declarator, gen_declspecs, gen_declaration_1): Remove functions. (tmpbuf, RAW_DECLSPEC): Remove. (gen_declaration): Remove second parameter; simplify to deal with TYPE_P nodes instead of raw declspecs. (gen_type_name, gen_type_name_0): New functions. (gen_method_decl): Remove second parameter; call gen_type_name() instead of gen_declaration_1(). (dump_interface): Adjust calls to gen_declaration() and gen_method_decl(); do not allocate a separate string buffer. (init_objc): Allocate a larger string buffer to accommodate dump_interface(); adjust call to build_module_descriptor(); add call to build_module_initializer_routine() for the GNU runtime. (generate_classref_translation_entry): Do not call start_decl(); call finish_var_decl() instead of finish_decl(); call convert() instead of build_c_cast(). * objc-act.h (CLASS_OWN_IVARS): Remove accessor. (CLASS_BINFO_ELTS): Reduce from 6 to 5, now that CLASS_OWN_IVARS is gone. (OCTI_GNU_INIT_DECL, GNU_INIT_decl): New. (OCTI_ELLIPSIS_NODE, objc_ellipsis_node): Remove. (OCTI_ID_ID, id_type, objc_id_id): Rename to OCTI_ID_NAME, objc_object_type and objc_object_name, respectively. (OCTI_CLS_REF, OCTI_CLASS_NAME, objc_class_reference, objc_class_name): New. (IS_CLASS): New macro. (IS_ID, IS_SUPER): Robustify. (OCTI_EXECCLASS_DECL, execclass_decl): New. (finish_file, start_class, continue_class, finish_class, start_method_def, continue_method_def, finish_method_def, start_protocol, finish_protocol, objc_build_throw_stmt, objc_build_try_catch_finally_stmt, objc_build_synchronized_prologue, objc_build_synchronized_epilogue, objc_build_try_prologue, objc_build_try_epilogue, objc_build_catch_stmt, objc_build_catch_epilogue, objc_build_finally_prologue, objc_build_finally_epilogue, is_ivar, is_private, is_public, add_instance_variable, objc_add_method, get_super_receiver, objc_clear_super_receiver, get_class_ivars_from_name, get_class_reference, get_static_reference, get_object_reference, build_message_expr, finish_message_expr, build_selector_expr, build_ivar_reference, build_keyword_decl, build_method_decl, build_protocol_expr, build_objc_string_object, objc_declare_alias, objc_declare_class, objc_declare_protocols, objc_comptypes, objc_check_decl, build_encode_expr): Remove prototypes. (imp_count, cat_count): Make GGC-aware. (OBJC_SET_TYPE_NAME): New macro. From-SVN: r87168
2004-09-08 02:49:44 +02:00
current_function_decl = pushdecl (fndecl);
push_scope ();
declare_parm_level ();
DECL_RESULT (current_function_decl)
= build_decl (RESULT_DECL, NULL_TREE,
TREE_TYPE (TREE_TYPE (current_function_decl)));
DECL_ARTIFICIAL (DECL_RESULT (current_function_decl)) = 1;
DECL_IGNORED_P (DECL_RESULT (current_function_decl)) = 1;
Makefile.in (c-parse.o): Depend on $(C_COMMON_H). [gcc/ChangeLog] 2004-09-07 Ziemowit Laski <zlaski@apple.com> * Makefile.in (c-parse.o): Depend on $(C_COMMON_H). * c-parse.in: Include c-common.h instead of objc-act.h. (ivar_decl_list, ivar_decls, ivar_decl, ivars, ivar_declarator, myparms, myparm): Remove %type declarations. (methodtype, optparms, OBJC_TYPE_QUAL, objc_quals, objc_qual, objc_typename, objc_try_catch_stmt, optellipsis): Add %type declarations. (objc_inherit_code, objc_public_flag): Remove. (typespec_nonreserved_nonattr): Call objc_get_protocol_qualified_type() instead of get_static_reference() and get_protocol_reference(). (stmt_nocomp): Call grokparm() on @catch parameter. (objcdef): Move semantic action to objc_finish_implementation(). (classdef): Move semantic action to objc_start_class_interface(), objc_continue_interface(), objc_finish_interface(), objc_start_class_implementation(), objc_continue_implementation(), objc_start_category_interface() and objc_start_category_implementation(). (protocoldef): Move semantic actions to objc_start_protocol() and objc_finish_interface(). (ivar_decl_list): Remove nonterminal. (visibility_spec): Move semantic actions to objc_set_visibility(). (ivar_decls): Remove assignment to $$. (ivar_decl): Rephrase in terms of component_decl; call objc_add_instance_variable(). (ivars, ivar_declarator): Remove nonterminals. (opt_semi): New nonterminal. (methodtype): Remove semantic actions. (methoddef): Move semantic actions to objc_set_method_type(), objc_start_method_definition() and objc_finish_method_definition(). (methodproto): Move semantic actions to objc_set_method_type() and objc_add_method_declaration(). (methoddecl): Use objc_typename instead of typename; move semantic actions to objc_build_method_signature(). (optarglist, myxdecls, mydecl, myparms, myparm): Remove nonterminals. (optparmlist): Express in terms of optparms and optellipsis. (optparms, optellipsis, objc_qual, objc_quals, objc_typename): New nonterminals. (keyworddecl): Use objc_typename instead of typename. (rid_to_yy): Mark RID_IN, RID_OUT, RID_INOUT, RID_BYCOPY, RID_BYREF and RID_ONEWAY as returning OBJC_TYPE_QUAL to yyparse(). [gcc/objc/ChangeLog] 2004-09-07 Ziemowit Laski <zlaski@apple.com> * Make-lang.in (objc/objc-parse.o): Depend on $(C_COMMON_H) instead of objc/objc-act.h. (objc/objc-act.o): Depend on $(HASHTAB_H). * objc-act.c: Include hashtab.h; in ObjC++ mode, include cp-tree.h and objcp-decl.h instead of c-tree.h. (build_module_descriptor, get_class_ivars, synth_id_with_class_suffix, error_with_ivar, gen_method_decl, gen_declaration, setup_string_decl, build_protocol_template): Adjust prototypes. (build_module_initializer_routine, start_class, continue_class, finish_class, start_method_def, objc_start_function, start_protocol, build_method_decl, objc_add_method, add_instance_variable, build_ivar_reference, is_ivar, is_private, get_super_receiver, build_selector_table_decl, objc_push_parm, objc_get_parm_info, gen_type_name, gen_type_name_0, start_var_decl, finish_var_decl, create_field_decl): New prototypes. (objc_expand_function_end, comp_method_with_proto, objc_expr_last, gen_declaration_1, gen_declarator, is_complex_decl, adorn_decl, define_decl, create_builtin_decl, gen_declspecs): Remove prototypes. (TYPE_ID): Rename to OBJECT_TYPEDEF_NAME. (CLASS_TYPEDEF_NAME): New. (TAG_EXECCLASS): Change from a global variable to a #define. (TAG_RETURN_STRUCT): Delete. (TAG_GNUINIT): New, holds '__objc_gnu_init' name. (objc_inherit_code, objc_public_flag): New, moved from c-parse.in. (string_descriptor): New struct. (string_htab): New hash table. (string_hash, string_eq): New prototypes. (generate_struct_by_value_array): Call create_field_decl() instead of create_builtin_decl(). (objc_init): Do not initialize objc_ellipsis_node or TAG_EXECCLASS; In ObjC++ mode, call cxx_init() instead of c_objc_common_init(). (objc_finish_file): In ObjC++, call instantiate_pending_templates() and cp_finish_file(). (define_decl, get_static_reference, get_protocol_reference, create_builtin_decl): Remove functions. (objc_start_class_interface, objc_start_category_interface, objc_start_protocol, objc_continue_interface, objc_finish_interface, objc_start_class_implementation, objc_start_category_implementation, objc_continue_implementation, objc_finish_implementation, objc_set_visibility, objc_set_method_type, objc_build_method_signature, objc_add_method_declaration, objc_start_method_definition, objc_add_instance_variable, objc_get_protocol_qualified_type, create_field_decl, start_var_decl, finish_var_decl): New functions. (setup_string_decl): Simplify since it is only called once. (synth_module_prologue): Call build_class_template(); predefine 'id' and 'Class' as typedefs; rename 'temp_type' to 'type'; disable debug hooks for duration of function; fix GNU runtime messenger signatures to correspond to reality; forward-declare '__objc_exec_class' for the GNU runtime; call build_selector_table_decl(); in ObjC++ mode, generate 'extern "C" { ... }' wrappers around synthesized declarations; call build_protocol_template() and build_category_template(). (string_hash, string_eq): New functions. (objc_build_string_object): Check metaclass correctness only once; store string literals in hash table. (objc_build_constructor): Do not convert initializer elements; adjust for ObjC++ impedance mismatch. (build_objc_symtab_template): Call create_field_decl() instead of create_builtin_decl(). (init_objc_symtab): Add missing conversion to initializer element. (build_metadata_decl): Call start_var_decl() instead of define_decl(). (generate_objc_symtab_decl): Do not call build_category_template(); call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(). (build_module_descriptor): Call create_field_decl() instead of grokfield(); call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(); always mark module descriptor as used; move GNU runtime-specific functionality to build_module_initializer_routine(). (build_module_initializer_routine): New function, broken off of build_module_descriptor(). (objc_static_init_needed_p, objc_generate_static_init_call): New functions. (generate_static_references, generate_strings, build_selector_translation_table, generate_descriptor_table, generate_ivars_list, generate_dispatch_table, generate_category): Call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(); build a type directly instead of via groktypename(). (build_selector_reference_decl, build_selector_table_decl, build_class_reference_decl, build_protocol_reference, generate_objc_image_info): Call start_var_decl() instead of build_decl(). (build_selector_reference): For GNU runtime, do not call build_selector_reference_decl(). (build_selector, build_typed_selector_reference): Always convert result to the selector type. (add_objc_string): Cast return value to 'char *'. (build_method_prototype_template, build_selector_template, build_method_template): Use actual selector type for fields pointing to selectors. (finish_objc): For GNU runtime, call build_module_initializer_routine() after build_module_descriptor(). (generate_protocol_list, generate_shared_structures): Call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(); build a type directly instead of via groktypename(). (synth_id_with_class_suffix): Return a string. (get_arg_type_list): For instance methods, use the instance type for 'self'; do not call groktypename_in_parm_context(). (build_objc_string_decl): Squash redeclaration errors in ObjC++. (objc_is_class_name): Use OBJC_TYPE_NAME instead of TYPE_NAME; handle RECORD_TYPEs in ObjC as well as ObjC++. (objc_is_id): New function. (objc_is_object_ptr): Return the canonical type node. (objc_get_class_ivars): Simplify using get_class_ivars(). (get_class_ivars): Remove second parameter; create a fresh copy of the ivar list for each call; do not check for existence of super class. (objc_eh_runtime_type): Mark #ifndef OBJCPLUS. (objc_init_exceptions): When using SJLJ-style exceptions, require the use of '-fobjc-exceptions' flag; do not require it for DWARF-style exceptions. (objc_build_exc_ptr, next_sjlj_build_try_catch_finally): Use objc_object_type instead of objc_id_type. (objc_begin_catch_clause): Convert the incoming PARM_DECL into a VAR_DECL before placing it in the appropriate scope; do not call define_decl(); adjust call to c_begin_compound_stmt(); use objc_object_type instead of objc_id_type. (build_next_objc_exception_stuff): Call create_field_decl() instead of create_builtin_decl(); construct type directly instead of calling groktypename(); use OBJC_VOID_AT_END to mark end of function parameters. (build_private_template): Adjust call to get_class_ivars(); build a type directly instead of via groktypename(). (build_protocol_template, build_method_prototype_list_template, build_method_prototype_template, build_category_template, build_selector_template, build_class_template, build_super_template, build_ivar_template, build_ivar_list_template, build_method_list_template, build_method_template): Call create_field_decl() instead of grokfield(). (objc_method_parm_type): Do not call groktypename(). (generate_descriptor_table): Call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(). (generate_method_descriptors, build_protocol_initializer, generate_dispatch_tables, build_category_initializer, build_shared_structure_initializer): Do not call groktypename(). (generate_protocols): Call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(); do not call groktypename(). (error_with_ivar): Remove last parameter. (check_ivars): Do not iterate ovar CLASS_RAW_IVARS lists in addition to CLASS_IVARS lists; adjust calls to error_with_ivar(). (generate_ivar_lists): Convert one of the initializer elements; do not call groktypename(). (get_arg_type_list, start_method_def, gen_method_def): Account for new representation of variable arguments and '...' in Objective-C methods; add Objective-C++ impedance matching code. (is_objc_type_qualifier): Remove function. (adjust_type_for_id_default): Simplify; there is no longer a need to wade through declspecs. (lookup_interface, start_class, continue_class, finish_class, start_method_def, start_protocol, build_method_decl, objc_add_method, add_instance_variable, build_ivar_reference, is_ivar, is_private, get_super_receiver, objc_build_finally_epilogue): Make into static functions. (receiver_is_class_object): Use new IS_CLASS() macro. (objc_build_message_expr): Tweak ObjC++ message argument handling; call objc_finish_message_expr() instead of finish_message_expr(). (finish_message_expr): Rename to objc_finish_message_expr(); use OBJC_TYPE_NAME and OBJC_SET_TYPE_NAME macros instead of TYPE_NAME. call gen_type_name() instead of gen_declaration(); call objc_is_id() instead of using IS_ID and IS_CLASS; Use objc_class_name instead of calling get_identifier("Class"); handle CONVERT_EXPRs in receiver. (build_objc_method_call, warn_with_method): Do not call groktypename(). (build_ivar_reference): Call convert() instead of clobbering in a type. (hash_init): Initialize string_htab hash table. (add_instance_variable): Simplify parameter list; do not call grokfield(); do not populate CLASS_IVARS list. (start_class): Check for the existence of super class, if one was specified. (continue_class): Use CLASS_RAW_IVARS rather than CLASS_IVARS; do not call build_class_template(); adjust call to get_class_ivars(); call build_decl(), pushdecl() and finish_decl() instead of define_decl(). (finish_class): Call build_decl(), pushdecl() and finish_decl() instead of define_decl(). (add_protocols): Use PROTOCOL_BINFO_ELTS for the tree vector size. (start_protocol): Do not call build_protocol_template(); use PROTOCOL_BINFO_ELTS for the tree vector size. (encode_type_qualifiers): Do not handle the 'const' qualifier here. (encode_pointer): Encode 'const char *' as 'r*', for backwards compatibility. (encode_array): Use HOST_WIDE_INT_PRINT_DEC instead of "%ld". (encode_type): Handle the 'const' qualifier here. (objc_parmlist): New global variable, sued by objc_push_parm and objc_get_parm_info(). (objc_push_parm, objc_get_parm_info): New functions. (objc_expr_last): Remove function. (synth_self_and_ucmd_args): For instance methods, use the instance type for 'self'; call objc_push_parm() instead of push_parm_decl(). (start_method_def): Do not call push_scope(), declare_parm_level(), pop_scope(), push_parm_decl(), store_parm_decls() or objc_expr_last(); just use objc_push_parm() and objc_get_parm_info(). (comp_method_with_proto): Remove function. (objc_types_are_equivalent): Strip away indirections before comparing underlying types. (comp_proto_with_proto): Do not call groktypename(); types are no longer in raw declspec format. (objc_start_function): New function. (really_start_method): Call comp_proto_with_proto() instead of comp_method_with_proto(); call objc_start_function() instead of hand-crafting a function declarator. (continue_method_def, objc_expand_function_end): Remove functions. (get_super_receiver): Call objc_get_current_scope() instead of get_current_scope(); reference 'super_class' field (instead of 'class'). (finish_method_def): Rename to objc_finish_method_definition() and add a function decl parameter; move method encoding call from objc_expand_function_end(). (is_complex_decl, adorn_decl, gen_declarator, gen_declspecs, gen_declaration_1): Remove functions. (tmpbuf, RAW_DECLSPEC): Remove. (gen_declaration): Remove second parameter; simplify to deal with TYPE_P nodes instead of raw declspecs. (gen_type_name, gen_type_name_0): New functions. (gen_method_decl): Remove second parameter; call gen_type_name() instead of gen_declaration_1(). (dump_interface): Adjust calls to gen_declaration() and gen_method_decl(); do not allocate a separate string buffer. (init_objc): Allocate a larger string buffer to accommodate dump_interface(); adjust call to build_module_descriptor(); add call to build_module_initializer_routine() for the GNU runtime. (generate_classref_translation_entry): Do not call start_decl(); call finish_var_decl() instead of finish_decl(); call convert() instead of build_c_cast(). * objc-act.h (CLASS_OWN_IVARS): Remove accessor. (CLASS_BINFO_ELTS): Reduce from 6 to 5, now that CLASS_OWN_IVARS is gone. (OCTI_GNU_INIT_DECL, GNU_INIT_decl): New. (OCTI_ELLIPSIS_NODE, objc_ellipsis_node): Remove. (OCTI_ID_ID, id_type, objc_id_id): Rename to OCTI_ID_NAME, objc_object_type and objc_object_name, respectively. (OCTI_CLS_REF, OCTI_CLASS_NAME, objc_class_reference, objc_class_name): New. (IS_CLASS): New macro. (IS_ID, IS_SUPER): Robustify. (OCTI_EXECCLASS_DECL, execclass_decl): New. (finish_file, start_class, continue_class, finish_class, start_method_def, continue_method_def, finish_method_def, start_protocol, finish_protocol, objc_build_throw_stmt, objc_build_try_catch_finally_stmt, objc_build_synchronized_prologue, objc_build_synchronized_epilogue, objc_build_try_prologue, objc_build_try_epilogue, objc_build_catch_stmt, objc_build_catch_epilogue, objc_build_finally_prologue, objc_build_finally_epilogue, is_ivar, is_private, is_public, add_instance_variable, objc_add_method, get_super_receiver, objc_clear_super_receiver, get_class_ivars_from_name, get_class_reference, get_static_reference, get_object_reference, build_message_expr, finish_message_expr, build_selector_expr, build_ivar_reference, build_keyword_decl, build_method_decl, build_protocol_expr, build_objc_string_object, objc_declare_alias, objc_declare_class, objc_declare_protocols, objc_comptypes, objc_check_decl, build_encode_expr): Remove prototypes. (imp_count, cat_count): Make GGC-aware. (OBJC_SET_TYPE_NAME): New macro. From-SVN: r87168
2004-09-08 02:49:44 +02:00
start_fname_decls ();
c-tree.h (enum c_declarator_kind, [...]): New. * c-tree.h (enum c_declarator_kind, struct c_arg_info, struct c_declarator, struct c_type_name, struct c_parm): New. (build_array_declarator, set_array_declarator_inner, get_parm_info, grokfield, groktypename, grokparm, push_parm_decl, start_function, start_decl, build_c_parm, build_attrs_declarator, build_function_declarator, make_pointer_declarator, c_cast_expr, store_parm_decls_newstyle, c_expr_sizeof_type): Update prototypes. (build_id_declarator): New. * c-typeck.c (c_cast_expr, c_expr_sizeof_type): Update to new structures. * c-decl.c (ARG_INFO_PARMS, ARG_INFO_TAGS, ARG_INFO_TYPES, ARG_INFO_OTHERS): Remove. (build_id_declarator): New. (build_array_declarator, set_array_declarator_inner, groktypename, start_decl, grokparm, push_parm_decl, grokparms, get_parm_info, grokfield, start_function, store_parm_decls_newstyle, store_parm_decls_oldstyle, store_parm_decls, build_c_parm, build_attrs_declarator, build_function_declarator, make_pointer_declarator, grokdeclarator): Update to new structures. * c-parse.in (%union): Add arginfotype, dtrtype, typenametype and parmtype. (declarator, notype_declarator, after_type_declarator, parm_declarator, parm_declarator_starttypename, parm_declarator_nostarttypename, array_declarator, typename, absdcl, absdcl1, absdcl1_ea, absdcl1_noea, direct_absdcl1, absdcl_maybe_attribute, parm, firstparm, parms, parmlist, parmlist_1, parmlist_2, parmlist_or_identifiers, parmlist_or_identifiers_1): Use these types. (primary, after_type_declarator, parm_declarator_starttypename, notype_declarator, component_decl, component_declarator, component_notype_declarator, typename, absdcl, absdcl_maybe_attribute, absdcl1_ea, direct_absdcl1, parmlist_1, parmlist_2, parmlist_or_identifiers_1): Update to new structures. objc: * objc-act.c (objc_start_function, really_start_method, objc_get_parm_info, start_method_def): Update to new arg_info structures. From-SVN: r87217
2004-09-09 03:19:15 +02:00
store_parm_decls_from (params);
Makefile.in (c-parse.o): Depend on $(C_COMMON_H). [gcc/ChangeLog] 2004-09-07 Ziemowit Laski <zlaski@apple.com> * Makefile.in (c-parse.o): Depend on $(C_COMMON_H). * c-parse.in: Include c-common.h instead of objc-act.h. (ivar_decl_list, ivar_decls, ivar_decl, ivars, ivar_declarator, myparms, myparm): Remove %type declarations. (methodtype, optparms, OBJC_TYPE_QUAL, objc_quals, objc_qual, objc_typename, objc_try_catch_stmt, optellipsis): Add %type declarations. (objc_inherit_code, objc_public_flag): Remove. (typespec_nonreserved_nonattr): Call objc_get_protocol_qualified_type() instead of get_static_reference() and get_protocol_reference(). (stmt_nocomp): Call grokparm() on @catch parameter. (objcdef): Move semantic action to objc_finish_implementation(). (classdef): Move semantic action to objc_start_class_interface(), objc_continue_interface(), objc_finish_interface(), objc_start_class_implementation(), objc_continue_implementation(), objc_start_category_interface() and objc_start_category_implementation(). (protocoldef): Move semantic actions to objc_start_protocol() and objc_finish_interface(). (ivar_decl_list): Remove nonterminal. (visibility_spec): Move semantic actions to objc_set_visibility(). (ivar_decls): Remove assignment to $$. (ivar_decl): Rephrase in terms of component_decl; call objc_add_instance_variable(). (ivars, ivar_declarator): Remove nonterminals. (opt_semi): New nonterminal. (methodtype): Remove semantic actions. (methoddef): Move semantic actions to objc_set_method_type(), objc_start_method_definition() and objc_finish_method_definition(). (methodproto): Move semantic actions to objc_set_method_type() and objc_add_method_declaration(). (methoddecl): Use objc_typename instead of typename; move semantic actions to objc_build_method_signature(). (optarglist, myxdecls, mydecl, myparms, myparm): Remove nonterminals. (optparmlist): Express in terms of optparms and optellipsis. (optparms, optellipsis, objc_qual, objc_quals, objc_typename): New nonterminals. (keyworddecl): Use objc_typename instead of typename. (rid_to_yy): Mark RID_IN, RID_OUT, RID_INOUT, RID_BYCOPY, RID_BYREF and RID_ONEWAY as returning OBJC_TYPE_QUAL to yyparse(). [gcc/objc/ChangeLog] 2004-09-07 Ziemowit Laski <zlaski@apple.com> * Make-lang.in (objc/objc-parse.o): Depend on $(C_COMMON_H) instead of objc/objc-act.h. (objc/objc-act.o): Depend on $(HASHTAB_H). * objc-act.c: Include hashtab.h; in ObjC++ mode, include cp-tree.h and objcp-decl.h instead of c-tree.h. (build_module_descriptor, get_class_ivars, synth_id_with_class_suffix, error_with_ivar, gen_method_decl, gen_declaration, setup_string_decl, build_protocol_template): Adjust prototypes. (build_module_initializer_routine, start_class, continue_class, finish_class, start_method_def, objc_start_function, start_protocol, build_method_decl, objc_add_method, add_instance_variable, build_ivar_reference, is_ivar, is_private, get_super_receiver, build_selector_table_decl, objc_push_parm, objc_get_parm_info, gen_type_name, gen_type_name_0, start_var_decl, finish_var_decl, create_field_decl): New prototypes. (objc_expand_function_end, comp_method_with_proto, objc_expr_last, gen_declaration_1, gen_declarator, is_complex_decl, adorn_decl, define_decl, create_builtin_decl, gen_declspecs): Remove prototypes. (TYPE_ID): Rename to OBJECT_TYPEDEF_NAME. (CLASS_TYPEDEF_NAME): New. (TAG_EXECCLASS): Change from a global variable to a #define. (TAG_RETURN_STRUCT): Delete. (TAG_GNUINIT): New, holds '__objc_gnu_init' name. (objc_inherit_code, objc_public_flag): New, moved from c-parse.in. (string_descriptor): New struct. (string_htab): New hash table. (string_hash, string_eq): New prototypes. (generate_struct_by_value_array): Call create_field_decl() instead of create_builtin_decl(). (objc_init): Do not initialize objc_ellipsis_node or TAG_EXECCLASS; In ObjC++ mode, call cxx_init() instead of c_objc_common_init(). (objc_finish_file): In ObjC++, call instantiate_pending_templates() and cp_finish_file(). (define_decl, get_static_reference, get_protocol_reference, create_builtin_decl): Remove functions. (objc_start_class_interface, objc_start_category_interface, objc_start_protocol, objc_continue_interface, objc_finish_interface, objc_start_class_implementation, objc_start_category_implementation, objc_continue_implementation, objc_finish_implementation, objc_set_visibility, objc_set_method_type, objc_build_method_signature, objc_add_method_declaration, objc_start_method_definition, objc_add_instance_variable, objc_get_protocol_qualified_type, create_field_decl, start_var_decl, finish_var_decl): New functions. (setup_string_decl): Simplify since it is only called once. (synth_module_prologue): Call build_class_template(); predefine 'id' and 'Class' as typedefs; rename 'temp_type' to 'type'; disable debug hooks for duration of function; fix GNU runtime messenger signatures to correspond to reality; forward-declare '__objc_exec_class' for the GNU runtime; call build_selector_table_decl(); in ObjC++ mode, generate 'extern "C" { ... }' wrappers around synthesized declarations; call build_protocol_template() and build_category_template(). (string_hash, string_eq): New functions. (objc_build_string_object): Check metaclass correctness only once; store string literals in hash table. (objc_build_constructor): Do not convert initializer elements; adjust for ObjC++ impedance mismatch. (build_objc_symtab_template): Call create_field_decl() instead of create_builtin_decl(). (init_objc_symtab): Add missing conversion to initializer element. (build_metadata_decl): Call start_var_decl() instead of define_decl(). (generate_objc_symtab_decl): Do not call build_category_template(); call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(). (build_module_descriptor): Call create_field_decl() instead of grokfield(); call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(); always mark module descriptor as used; move GNU runtime-specific functionality to build_module_initializer_routine(). (build_module_initializer_routine): New function, broken off of build_module_descriptor(). (objc_static_init_needed_p, objc_generate_static_init_call): New functions. (generate_static_references, generate_strings, build_selector_translation_table, generate_descriptor_table, generate_ivars_list, generate_dispatch_table, generate_category): Call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(); build a type directly instead of via groktypename(). (build_selector_reference_decl, build_selector_table_decl, build_class_reference_decl, build_protocol_reference, generate_objc_image_info): Call start_var_decl() instead of build_decl(). (build_selector_reference): For GNU runtime, do not call build_selector_reference_decl(). (build_selector, build_typed_selector_reference): Always convert result to the selector type. (add_objc_string): Cast return value to 'char *'. (build_method_prototype_template, build_selector_template, build_method_template): Use actual selector type for fields pointing to selectors. (finish_objc): For GNU runtime, call build_module_initializer_routine() after build_module_descriptor(). (generate_protocol_list, generate_shared_structures): Call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(); build a type directly instead of via groktypename(). (synth_id_with_class_suffix): Return a string. (get_arg_type_list): For instance methods, use the instance type for 'self'; do not call groktypename_in_parm_context(). (build_objc_string_decl): Squash redeclaration errors in ObjC++. (objc_is_class_name): Use OBJC_TYPE_NAME instead of TYPE_NAME; handle RECORD_TYPEs in ObjC as well as ObjC++. (objc_is_id): New function. (objc_is_object_ptr): Return the canonical type node. (objc_get_class_ivars): Simplify using get_class_ivars(). (get_class_ivars): Remove second parameter; create a fresh copy of the ivar list for each call; do not check for existence of super class. (objc_eh_runtime_type): Mark #ifndef OBJCPLUS. (objc_init_exceptions): When using SJLJ-style exceptions, require the use of '-fobjc-exceptions' flag; do not require it for DWARF-style exceptions. (objc_build_exc_ptr, next_sjlj_build_try_catch_finally): Use objc_object_type instead of objc_id_type. (objc_begin_catch_clause): Convert the incoming PARM_DECL into a VAR_DECL before placing it in the appropriate scope; do not call define_decl(); adjust call to c_begin_compound_stmt(); use objc_object_type instead of objc_id_type. (build_next_objc_exception_stuff): Call create_field_decl() instead of create_builtin_decl(); construct type directly instead of calling groktypename(); use OBJC_VOID_AT_END to mark end of function parameters. (build_private_template): Adjust call to get_class_ivars(); build a type directly instead of via groktypename(). (build_protocol_template, build_method_prototype_list_template, build_method_prototype_template, build_category_template, build_selector_template, build_class_template, build_super_template, build_ivar_template, build_ivar_list_template, build_method_list_template, build_method_template): Call create_field_decl() instead of grokfield(). (objc_method_parm_type): Do not call groktypename(). (generate_descriptor_table): Call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(). (generate_method_descriptors, build_protocol_initializer, generate_dispatch_tables, build_category_initializer, build_shared_structure_initializer): Do not call groktypename(). (generate_protocols): Call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(); do not call groktypename(). (error_with_ivar): Remove last parameter. (check_ivars): Do not iterate ovar CLASS_RAW_IVARS lists in addition to CLASS_IVARS lists; adjust calls to error_with_ivar(). (generate_ivar_lists): Convert one of the initializer elements; do not call groktypename(). (get_arg_type_list, start_method_def, gen_method_def): Account for new representation of variable arguments and '...' in Objective-C methods; add Objective-C++ impedance matching code. (is_objc_type_qualifier): Remove function. (adjust_type_for_id_default): Simplify; there is no longer a need to wade through declspecs. (lookup_interface, start_class, continue_class, finish_class, start_method_def, start_protocol, build_method_decl, objc_add_method, add_instance_variable, build_ivar_reference, is_ivar, is_private, get_super_receiver, objc_build_finally_epilogue): Make into static functions. (receiver_is_class_object): Use new IS_CLASS() macro. (objc_build_message_expr): Tweak ObjC++ message argument handling; call objc_finish_message_expr() instead of finish_message_expr(). (finish_message_expr): Rename to objc_finish_message_expr(); use OBJC_TYPE_NAME and OBJC_SET_TYPE_NAME macros instead of TYPE_NAME. call gen_type_name() instead of gen_declaration(); call objc_is_id() instead of using IS_ID and IS_CLASS; Use objc_class_name instead of calling get_identifier("Class"); handle CONVERT_EXPRs in receiver. (build_objc_method_call, warn_with_method): Do not call groktypename(). (build_ivar_reference): Call convert() instead of clobbering in a type. (hash_init): Initialize string_htab hash table. (add_instance_variable): Simplify parameter list; do not call grokfield(); do not populate CLASS_IVARS list. (start_class): Check for the existence of super class, if one was specified. (continue_class): Use CLASS_RAW_IVARS rather than CLASS_IVARS; do not call build_class_template(); adjust call to get_class_ivars(); call build_decl(), pushdecl() and finish_decl() instead of define_decl(). (finish_class): Call build_decl(), pushdecl() and finish_decl() instead of define_decl(). (add_protocols): Use PROTOCOL_BINFO_ELTS for the tree vector size. (start_protocol): Do not call build_protocol_template(); use PROTOCOL_BINFO_ELTS for the tree vector size. (encode_type_qualifiers): Do not handle the 'const' qualifier here. (encode_pointer): Encode 'const char *' as 'r*', for backwards compatibility. (encode_array): Use HOST_WIDE_INT_PRINT_DEC instead of "%ld". (encode_type): Handle the 'const' qualifier here. (objc_parmlist): New global variable, sued by objc_push_parm and objc_get_parm_info(). (objc_push_parm, objc_get_parm_info): New functions. (objc_expr_last): Remove function. (synth_self_and_ucmd_args): For instance methods, use the instance type for 'self'; call objc_push_parm() instead of push_parm_decl(). (start_method_def): Do not call push_scope(), declare_parm_level(), pop_scope(), push_parm_decl(), store_parm_decls() or objc_expr_last(); just use objc_push_parm() and objc_get_parm_info(). (comp_method_with_proto): Remove function. (objc_types_are_equivalent): Strip away indirections before comparing underlying types. (comp_proto_with_proto): Do not call groktypename(); types are no longer in raw declspec format. (objc_start_function): New function. (really_start_method): Call comp_proto_with_proto() instead of comp_method_with_proto(); call objc_start_function() instead of hand-crafting a function declarator. (continue_method_def, objc_expand_function_end): Remove functions. (get_super_receiver): Call objc_get_current_scope() instead of get_current_scope(); reference 'super_class' field (instead of 'class'). (finish_method_def): Rename to objc_finish_method_definition() and add a function decl parameter; move method encoding call from objc_expand_function_end(). (is_complex_decl, adorn_decl, gen_declarator, gen_declspecs, gen_declaration_1): Remove functions. (tmpbuf, RAW_DECLSPEC): Remove. (gen_declaration): Remove second parameter; simplify to deal with TYPE_P nodes instead of raw declspecs. (gen_type_name, gen_type_name_0): New functions. (gen_method_decl): Remove second parameter; call gen_type_name() instead of gen_declaration_1(). (dump_interface): Adjust calls to gen_declaration() and gen_method_decl(); do not allocate a separate string buffer. (init_objc): Allocate a larger string buffer to accommodate dump_interface(); adjust call to build_module_descriptor(); add call to build_module_initializer_routine() for the GNU runtime. (generate_classref_translation_entry): Do not call start_decl(); call finish_var_decl() instead of finish_decl(); call convert() instead of build_c_cast(). * objc-act.h (CLASS_OWN_IVARS): Remove accessor. (CLASS_BINFO_ELTS): Reduce from 6 to 5, now that CLASS_OWN_IVARS is gone. (OCTI_GNU_INIT_DECL, GNU_INIT_decl): New. (OCTI_ELLIPSIS_NODE, objc_ellipsis_node): Remove. (OCTI_ID_ID, id_type, objc_id_id): Rename to OCTI_ID_NAME, objc_object_type and objc_object_name, respectively. (OCTI_CLS_REF, OCTI_CLASS_NAME, objc_class_reference, objc_class_name): New. (IS_CLASS): New macro. (IS_ID, IS_SUPER): Robustify. (OCTI_EXECCLASS_DECL, execclass_decl): New. (finish_file, start_class, continue_class, finish_class, start_method_def, continue_method_def, finish_method_def, start_protocol, finish_protocol, objc_build_throw_stmt, objc_build_try_catch_finally_stmt, objc_build_synchronized_prologue, objc_build_synchronized_epilogue, objc_build_try_prologue, objc_build_try_epilogue, objc_build_catch_stmt, objc_build_catch_epilogue, objc_build_finally_prologue, objc_build_finally_epilogue, is_ivar, is_private, is_public, add_instance_variable, objc_add_method, get_super_receiver, objc_clear_super_receiver, get_class_ivars_from_name, get_class_reference, get_static_reference, get_object_reference, build_message_expr, finish_message_expr, build_selector_expr, build_ivar_reference, build_keyword_decl, build_method_decl, build_protocol_expr, build_objc_string_object, objc_declare_alias, objc_declare_class, objc_declare_protocols, objc_comptypes, objc_check_decl, build_encode_expr): Remove prototypes. (imp_count, cat_count): Make GGC-aware. (OBJC_SET_TYPE_NAME): New macro. From-SVN: r87168
2004-09-08 02:49:44 +02:00
#endif
TREE_USED (current_function_decl) = 1;
}
/* - Generate an identifier for the function. the format is "_n_cls",
where 1 <= n <= nMethods, and cls is the name the implementation we
are processing.
- Install the return type from the method declaration.
- If we have a prototype, check for type consistency. */
1992-01-18 00:15:38 +01:00
static void
c-tree.h (enum c_declarator_kind, [...]): New. * c-tree.h (enum c_declarator_kind, struct c_arg_info, struct c_declarator, struct c_type_name, struct c_parm): New. (build_array_declarator, set_array_declarator_inner, get_parm_info, grokfield, groktypename, grokparm, push_parm_decl, start_function, start_decl, build_c_parm, build_attrs_declarator, build_function_declarator, make_pointer_declarator, c_cast_expr, store_parm_decls_newstyle, c_expr_sizeof_type): Update prototypes. (build_id_declarator): New. * c-typeck.c (c_cast_expr, c_expr_sizeof_type): Update to new structures. * c-decl.c (ARG_INFO_PARMS, ARG_INFO_TAGS, ARG_INFO_TYPES, ARG_INFO_OTHERS): Remove. (build_id_declarator): New. (build_array_declarator, set_array_declarator_inner, groktypename, start_decl, grokparm, push_parm_decl, grokparms, get_parm_info, grokfield, start_function, store_parm_decls_newstyle, store_parm_decls_oldstyle, store_parm_decls, build_c_parm, build_attrs_declarator, build_function_declarator, make_pointer_declarator, grokdeclarator): Update to new structures. * c-parse.in (%union): Add arginfotype, dtrtype, typenametype and parmtype. (declarator, notype_declarator, after_type_declarator, parm_declarator, parm_declarator_starttypename, parm_declarator_nostarttypename, array_declarator, typename, absdcl, absdcl1, absdcl1_ea, absdcl1_noea, direct_absdcl1, absdcl_maybe_attribute, parm, firstparm, parms, parmlist, parmlist_1, parmlist_2, parmlist_or_identifiers, parmlist_or_identifiers_1): Use these types. (primary, after_type_declarator, parm_declarator_starttypename, notype_declarator, component_decl, component_declarator, component_notype_declarator, typename, absdcl, absdcl_maybe_attribute, absdcl1_ea, direct_absdcl1, parmlist_1, parmlist_2, parmlist_or_identifiers_1): Update to new structures. objc: * objc-act.c (objc_start_function, really_start_method, objc_get_parm_info, start_method_def): Update to new arg_info structures. From-SVN: r87217
2004-09-09 03:19:15 +02:00
really_start_method (tree method,
#ifdef OBJCPLUS
tree parmlist
#else
struct c_arg_info *parmlist
#endif
)
1992-01-18 00:15:38 +01:00
{
Makefile.in (c-parse.o): Depend on $(C_COMMON_H). [gcc/ChangeLog] 2004-09-07 Ziemowit Laski <zlaski@apple.com> * Makefile.in (c-parse.o): Depend on $(C_COMMON_H). * c-parse.in: Include c-common.h instead of objc-act.h. (ivar_decl_list, ivar_decls, ivar_decl, ivars, ivar_declarator, myparms, myparm): Remove %type declarations. (methodtype, optparms, OBJC_TYPE_QUAL, objc_quals, objc_qual, objc_typename, objc_try_catch_stmt, optellipsis): Add %type declarations. (objc_inherit_code, objc_public_flag): Remove. (typespec_nonreserved_nonattr): Call objc_get_protocol_qualified_type() instead of get_static_reference() and get_protocol_reference(). (stmt_nocomp): Call grokparm() on @catch parameter. (objcdef): Move semantic action to objc_finish_implementation(). (classdef): Move semantic action to objc_start_class_interface(), objc_continue_interface(), objc_finish_interface(), objc_start_class_implementation(), objc_continue_implementation(), objc_start_category_interface() and objc_start_category_implementation(). (protocoldef): Move semantic actions to objc_start_protocol() and objc_finish_interface(). (ivar_decl_list): Remove nonterminal. (visibility_spec): Move semantic actions to objc_set_visibility(). (ivar_decls): Remove assignment to $$. (ivar_decl): Rephrase in terms of component_decl; call objc_add_instance_variable(). (ivars, ivar_declarator): Remove nonterminals. (opt_semi): New nonterminal. (methodtype): Remove semantic actions. (methoddef): Move semantic actions to objc_set_method_type(), objc_start_method_definition() and objc_finish_method_definition(). (methodproto): Move semantic actions to objc_set_method_type() and objc_add_method_declaration(). (methoddecl): Use objc_typename instead of typename; move semantic actions to objc_build_method_signature(). (optarglist, myxdecls, mydecl, myparms, myparm): Remove nonterminals. (optparmlist): Express in terms of optparms and optellipsis. (optparms, optellipsis, objc_qual, objc_quals, objc_typename): New nonterminals. (keyworddecl): Use objc_typename instead of typename. (rid_to_yy): Mark RID_IN, RID_OUT, RID_INOUT, RID_BYCOPY, RID_BYREF and RID_ONEWAY as returning OBJC_TYPE_QUAL to yyparse(). [gcc/objc/ChangeLog] 2004-09-07 Ziemowit Laski <zlaski@apple.com> * Make-lang.in (objc/objc-parse.o): Depend on $(C_COMMON_H) instead of objc/objc-act.h. (objc/objc-act.o): Depend on $(HASHTAB_H). * objc-act.c: Include hashtab.h; in ObjC++ mode, include cp-tree.h and objcp-decl.h instead of c-tree.h. (build_module_descriptor, get_class_ivars, synth_id_with_class_suffix, error_with_ivar, gen_method_decl, gen_declaration, setup_string_decl, build_protocol_template): Adjust prototypes. (build_module_initializer_routine, start_class, continue_class, finish_class, start_method_def, objc_start_function, start_protocol, build_method_decl, objc_add_method, add_instance_variable, build_ivar_reference, is_ivar, is_private, get_super_receiver, build_selector_table_decl, objc_push_parm, objc_get_parm_info, gen_type_name, gen_type_name_0, start_var_decl, finish_var_decl, create_field_decl): New prototypes. (objc_expand_function_end, comp_method_with_proto, objc_expr_last, gen_declaration_1, gen_declarator, is_complex_decl, adorn_decl, define_decl, create_builtin_decl, gen_declspecs): Remove prototypes. (TYPE_ID): Rename to OBJECT_TYPEDEF_NAME. (CLASS_TYPEDEF_NAME): New. (TAG_EXECCLASS): Change from a global variable to a #define. (TAG_RETURN_STRUCT): Delete. (TAG_GNUINIT): New, holds '__objc_gnu_init' name. (objc_inherit_code, objc_public_flag): New, moved from c-parse.in. (string_descriptor): New struct. (string_htab): New hash table. (string_hash, string_eq): New prototypes. (generate_struct_by_value_array): Call create_field_decl() instead of create_builtin_decl(). (objc_init): Do not initialize objc_ellipsis_node or TAG_EXECCLASS; In ObjC++ mode, call cxx_init() instead of c_objc_common_init(). (objc_finish_file): In ObjC++, call instantiate_pending_templates() and cp_finish_file(). (define_decl, get_static_reference, get_protocol_reference, create_builtin_decl): Remove functions. (objc_start_class_interface, objc_start_category_interface, objc_start_protocol, objc_continue_interface, objc_finish_interface, objc_start_class_implementation, objc_start_category_implementation, objc_continue_implementation, objc_finish_implementation, objc_set_visibility, objc_set_method_type, objc_build_method_signature, objc_add_method_declaration, objc_start_method_definition, objc_add_instance_variable, objc_get_protocol_qualified_type, create_field_decl, start_var_decl, finish_var_decl): New functions. (setup_string_decl): Simplify since it is only called once. (synth_module_prologue): Call build_class_template(); predefine 'id' and 'Class' as typedefs; rename 'temp_type' to 'type'; disable debug hooks for duration of function; fix GNU runtime messenger signatures to correspond to reality; forward-declare '__objc_exec_class' for the GNU runtime; call build_selector_table_decl(); in ObjC++ mode, generate 'extern "C" { ... }' wrappers around synthesized declarations; call build_protocol_template() and build_category_template(). (string_hash, string_eq): New functions. (objc_build_string_object): Check metaclass correctness only once; store string literals in hash table. (objc_build_constructor): Do not convert initializer elements; adjust for ObjC++ impedance mismatch. (build_objc_symtab_template): Call create_field_decl() instead of create_builtin_decl(). (init_objc_symtab): Add missing conversion to initializer element. (build_metadata_decl): Call start_var_decl() instead of define_decl(). (generate_objc_symtab_decl): Do not call build_category_template(); call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(). (build_module_descriptor): Call create_field_decl() instead of grokfield(); call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(); always mark module descriptor as used; move GNU runtime-specific functionality to build_module_initializer_routine(). (build_module_initializer_routine): New function, broken off of build_module_descriptor(). (objc_static_init_needed_p, objc_generate_static_init_call): New functions. (generate_static_references, generate_strings, build_selector_translation_table, generate_descriptor_table, generate_ivars_list, generate_dispatch_table, generate_category): Call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(); build a type directly instead of via groktypename(). (build_selector_reference_decl, build_selector_table_decl, build_class_reference_decl, build_protocol_reference, generate_objc_image_info): Call start_var_decl() instead of build_decl(). (build_selector_reference): For GNU runtime, do not call build_selector_reference_decl(). (build_selector, build_typed_selector_reference): Always convert result to the selector type. (add_objc_string): Cast return value to 'char *'. (build_method_prototype_template, build_selector_template, build_method_template): Use actual selector type for fields pointing to selectors. (finish_objc): For GNU runtime, call build_module_initializer_routine() after build_module_descriptor(). (generate_protocol_list, generate_shared_structures): Call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(); build a type directly instead of via groktypename(). (synth_id_with_class_suffix): Return a string. (get_arg_type_list): For instance methods, use the instance type for 'self'; do not call groktypename_in_parm_context(). (build_objc_string_decl): Squash redeclaration errors in ObjC++. (objc_is_class_name): Use OBJC_TYPE_NAME instead of TYPE_NAME; handle RECORD_TYPEs in ObjC as well as ObjC++. (objc_is_id): New function. (objc_is_object_ptr): Return the canonical type node. (objc_get_class_ivars): Simplify using get_class_ivars(). (get_class_ivars): Remove second parameter; create a fresh copy of the ivar list for each call; do not check for existence of super class. (objc_eh_runtime_type): Mark #ifndef OBJCPLUS. (objc_init_exceptions): When using SJLJ-style exceptions, require the use of '-fobjc-exceptions' flag; do not require it for DWARF-style exceptions. (objc_build_exc_ptr, next_sjlj_build_try_catch_finally): Use objc_object_type instead of objc_id_type. (objc_begin_catch_clause): Convert the incoming PARM_DECL into a VAR_DECL before placing it in the appropriate scope; do not call define_decl(); adjust call to c_begin_compound_stmt(); use objc_object_type instead of objc_id_type. (build_next_objc_exception_stuff): Call create_field_decl() instead of create_builtin_decl(); construct type directly instead of calling groktypename(); use OBJC_VOID_AT_END to mark end of function parameters. (build_private_template): Adjust call to get_class_ivars(); build a type directly instead of via groktypename(). (build_protocol_template, build_method_prototype_list_template, build_method_prototype_template, build_category_template, build_selector_template, build_class_template, build_super_template, build_ivar_template, build_ivar_list_template, build_method_list_template, build_method_template): Call create_field_decl() instead of grokfield(). (objc_method_parm_type): Do not call groktypename(). (generate_descriptor_table): Call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(). (generate_method_descriptors, build_protocol_initializer, generate_dispatch_tables, build_category_initializer, build_shared_structure_initializer): Do not call groktypename(). (generate_protocols): Call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(); do not call groktypename(). (error_with_ivar): Remove last parameter. (check_ivars): Do not iterate ovar CLASS_RAW_IVARS lists in addition to CLASS_IVARS lists; adjust calls to error_with_ivar(). (generate_ivar_lists): Convert one of the initializer elements; do not call groktypename(). (get_arg_type_list, start_method_def, gen_method_def): Account for new representation of variable arguments and '...' in Objective-C methods; add Objective-C++ impedance matching code. (is_objc_type_qualifier): Remove function. (adjust_type_for_id_default): Simplify; there is no longer a need to wade through declspecs. (lookup_interface, start_class, continue_class, finish_class, start_method_def, start_protocol, build_method_decl, objc_add_method, add_instance_variable, build_ivar_reference, is_ivar, is_private, get_super_receiver, objc_build_finally_epilogue): Make into static functions. (receiver_is_class_object): Use new IS_CLASS() macro. (objc_build_message_expr): Tweak ObjC++ message argument handling; call objc_finish_message_expr() instead of finish_message_expr(). (finish_message_expr): Rename to objc_finish_message_expr(); use OBJC_TYPE_NAME and OBJC_SET_TYPE_NAME macros instead of TYPE_NAME. call gen_type_name() instead of gen_declaration(); call objc_is_id() instead of using IS_ID and IS_CLASS; Use objc_class_name instead of calling get_identifier("Class"); handle CONVERT_EXPRs in receiver. (build_objc_method_call, warn_with_method): Do not call groktypename(). (build_ivar_reference): Call convert() instead of clobbering in a type. (hash_init): Initialize string_htab hash table. (add_instance_variable): Simplify parameter list; do not call grokfield(); do not populate CLASS_IVARS list. (start_class): Check for the existence of super class, if one was specified. (continue_class): Use CLASS_RAW_IVARS rather than CLASS_IVARS; do not call build_class_template(); adjust call to get_class_ivars(); call build_decl(), pushdecl() and finish_decl() instead of define_decl(). (finish_class): Call build_decl(), pushdecl() and finish_decl() instead of define_decl(). (add_protocols): Use PROTOCOL_BINFO_ELTS for the tree vector size. (start_protocol): Do not call build_protocol_template(); use PROTOCOL_BINFO_ELTS for the tree vector size. (encode_type_qualifiers): Do not handle the 'const' qualifier here. (encode_pointer): Encode 'const char *' as 'r*', for backwards compatibility. (encode_array): Use HOST_WIDE_INT_PRINT_DEC instead of "%ld". (encode_type): Handle the 'const' qualifier here. (objc_parmlist): New global variable, sued by objc_push_parm and objc_get_parm_info(). (objc_push_parm, objc_get_parm_info): New functions. (objc_expr_last): Remove function. (synth_self_and_ucmd_args): For instance methods, use the instance type for 'self'; call objc_push_parm() instead of push_parm_decl(). (start_method_def): Do not call push_scope(), declare_parm_level(), pop_scope(), push_parm_decl(), store_parm_decls() or objc_expr_last(); just use objc_push_parm() and objc_get_parm_info(). (comp_method_with_proto): Remove function. (objc_types_are_equivalent): Strip away indirections before comparing underlying types. (comp_proto_with_proto): Do not call groktypename(); types are no longer in raw declspec format. (objc_start_function): New function. (really_start_method): Call comp_proto_with_proto() instead of comp_method_with_proto(); call objc_start_function() instead of hand-crafting a function declarator. (continue_method_def, objc_expand_function_end): Remove functions. (get_super_receiver): Call objc_get_current_scope() instead of get_current_scope(); reference 'super_class' field (instead of 'class'). (finish_method_def): Rename to objc_finish_method_definition() and add a function decl parameter; move method encoding call from objc_expand_function_end(). (is_complex_decl, adorn_decl, gen_declarator, gen_declspecs, gen_declaration_1): Remove functions. (tmpbuf, RAW_DECLSPEC): Remove. (gen_declaration): Remove second parameter; simplify to deal with TYPE_P nodes instead of raw declspecs. (gen_type_name, gen_type_name_0): New functions. (gen_method_decl): Remove second parameter; call gen_type_name() instead of gen_declaration_1(). (dump_interface): Adjust calls to gen_declaration() and gen_method_decl(); do not allocate a separate string buffer. (init_objc): Allocate a larger string buffer to accommodate dump_interface(); adjust call to build_module_descriptor(); add call to build_module_initializer_routine() for the GNU runtime. (generate_classref_translation_entry): Do not call start_decl(); call finish_var_decl() instead of finish_decl(); call convert() instead of build_c_cast(). * objc-act.h (CLASS_OWN_IVARS): Remove accessor. (CLASS_BINFO_ELTS): Reduce from 6 to 5, now that CLASS_OWN_IVARS is gone. (OCTI_GNU_INIT_DECL, GNU_INIT_decl): New. (OCTI_ELLIPSIS_NODE, objc_ellipsis_node): Remove. (OCTI_ID_ID, id_type, objc_id_id): Rename to OCTI_ID_NAME, objc_object_type and objc_object_name, respectively. (OCTI_CLS_REF, OCTI_CLASS_NAME, objc_class_reference, objc_class_name): New. (IS_CLASS): New macro. (IS_ID, IS_SUPER): Robustify. (OCTI_EXECCLASS_DECL, execclass_decl): New. (finish_file, start_class, continue_class, finish_class, start_method_def, continue_method_def, finish_method_def, start_protocol, finish_protocol, objc_build_throw_stmt, objc_build_try_catch_finally_stmt, objc_build_synchronized_prologue, objc_build_synchronized_epilogue, objc_build_try_prologue, objc_build_try_epilogue, objc_build_catch_stmt, objc_build_catch_epilogue, objc_build_finally_prologue, objc_build_finally_epilogue, is_ivar, is_private, is_public, add_instance_variable, objc_add_method, get_super_receiver, objc_clear_super_receiver, get_class_ivars_from_name, get_class_reference, get_static_reference, get_object_reference, build_message_expr, finish_message_expr, build_selector_expr, build_ivar_reference, build_keyword_decl, build_method_decl, build_protocol_expr, build_objc_string_object, objc_declare_alias, objc_declare_class, objc_declare_protocols, objc_comptypes, objc_check_decl, build_encode_expr): Remove prototypes. (imp_count, cat_count): Make GGC-aware. (OBJC_SET_TYPE_NAME): New macro. From-SVN: r87168
2004-09-08 02:49:44 +02:00
tree ret_type, meth_type;
tree method_id;
const char *sel_name, *class_name, *cat_name;
char *buf;
1992-01-18 00:15:38 +01:00
1996-07-04 00:07:53 +02:00
/* Synth the storage class & assemble the return type. */
Makefile.in (c-parse.o): Depend on $(C_COMMON_H). [gcc/ChangeLog] 2004-09-07 Ziemowit Laski <zlaski@apple.com> * Makefile.in (c-parse.o): Depend on $(C_COMMON_H). * c-parse.in: Include c-common.h instead of objc-act.h. (ivar_decl_list, ivar_decls, ivar_decl, ivars, ivar_declarator, myparms, myparm): Remove %type declarations. (methodtype, optparms, OBJC_TYPE_QUAL, objc_quals, objc_qual, objc_typename, objc_try_catch_stmt, optellipsis): Add %type declarations. (objc_inherit_code, objc_public_flag): Remove. (typespec_nonreserved_nonattr): Call objc_get_protocol_qualified_type() instead of get_static_reference() and get_protocol_reference(). (stmt_nocomp): Call grokparm() on @catch parameter. (objcdef): Move semantic action to objc_finish_implementation(). (classdef): Move semantic action to objc_start_class_interface(), objc_continue_interface(), objc_finish_interface(), objc_start_class_implementation(), objc_continue_implementation(), objc_start_category_interface() and objc_start_category_implementation(). (protocoldef): Move semantic actions to objc_start_protocol() and objc_finish_interface(). (ivar_decl_list): Remove nonterminal. (visibility_spec): Move semantic actions to objc_set_visibility(). (ivar_decls): Remove assignment to $$. (ivar_decl): Rephrase in terms of component_decl; call objc_add_instance_variable(). (ivars, ivar_declarator): Remove nonterminals. (opt_semi): New nonterminal. (methodtype): Remove semantic actions. (methoddef): Move semantic actions to objc_set_method_type(), objc_start_method_definition() and objc_finish_method_definition(). (methodproto): Move semantic actions to objc_set_method_type() and objc_add_method_declaration(). (methoddecl): Use objc_typename instead of typename; move semantic actions to objc_build_method_signature(). (optarglist, myxdecls, mydecl, myparms, myparm): Remove nonterminals. (optparmlist): Express in terms of optparms and optellipsis. (optparms, optellipsis, objc_qual, objc_quals, objc_typename): New nonterminals. (keyworddecl): Use objc_typename instead of typename. (rid_to_yy): Mark RID_IN, RID_OUT, RID_INOUT, RID_BYCOPY, RID_BYREF and RID_ONEWAY as returning OBJC_TYPE_QUAL to yyparse(). [gcc/objc/ChangeLog] 2004-09-07 Ziemowit Laski <zlaski@apple.com> * Make-lang.in (objc/objc-parse.o): Depend on $(C_COMMON_H) instead of objc/objc-act.h. (objc/objc-act.o): Depend on $(HASHTAB_H). * objc-act.c: Include hashtab.h; in ObjC++ mode, include cp-tree.h and objcp-decl.h instead of c-tree.h. (build_module_descriptor, get_class_ivars, synth_id_with_class_suffix, error_with_ivar, gen_method_decl, gen_declaration, setup_string_decl, build_protocol_template): Adjust prototypes. (build_module_initializer_routine, start_class, continue_class, finish_class, start_method_def, objc_start_function, start_protocol, build_method_decl, objc_add_method, add_instance_variable, build_ivar_reference, is_ivar, is_private, get_super_receiver, build_selector_table_decl, objc_push_parm, objc_get_parm_info, gen_type_name, gen_type_name_0, start_var_decl, finish_var_decl, create_field_decl): New prototypes. (objc_expand_function_end, comp_method_with_proto, objc_expr_last, gen_declaration_1, gen_declarator, is_complex_decl, adorn_decl, define_decl, create_builtin_decl, gen_declspecs): Remove prototypes. (TYPE_ID): Rename to OBJECT_TYPEDEF_NAME. (CLASS_TYPEDEF_NAME): New. (TAG_EXECCLASS): Change from a global variable to a #define. (TAG_RETURN_STRUCT): Delete. (TAG_GNUINIT): New, holds '__objc_gnu_init' name. (objc_inherit_code, objc_public_flag): New, moved from c-parse.in. (string_descriptor): New struct. (string_htab): New hash table. (string_hash, string_eq): New prototypes. (generate_struct_by_value_array): Call create_field_decl() instead of create_builtin_decl(). (objc_init): Do not initialize objc_ellipsis_node or TAG_EXECCLASS; In ObjC++ mode, call cxx_init() instead of c_objc_common_init(). (objc_finish_file): In ObjC++, call instantiate_pending_templates() and cp_finish_file(). (define_decl, get_static_reference, get_protocol_reference, create_builtin_decl): Remove functions. (objc_start_class_interface, objc_start_category_interface, objc_start_protocol, objc_continue_interface, objc_finish_interface, objc_start_class_implementation, objc_start_category_implementation, objc_continue_implementation, objc_finish_implementation, objc_set_visibility, objc_set_method_type, objc_build_method_signature, objc_add_method_declaration, objc_start_method_definition, objc_add_instance_variable, objc_get_protocol_qualified_type, create_field_decl, start_var_decl, finish_var_decl): New functions. (setup_string_decl): Simplify since it is only called once. (synth_module_prologue): Call build_class_template(); predefine 'id' and 'Class' as typedefs; rename 'temp_type' to 'type'; disable debug hooks for duration of function; fix GNU runtime messenger signatures to correspond to reality; forward-declare '__objc_exec_class' for the GNU runtime; call build_selector_table_decl(); in ObjC++ mode, generate 'extern "C" { ... }' wrappers around synthesized declarations; call build_protocol_template() and build_category_template(). (string_hash, string_eq): New functions. (objc_build_string_object): Check metaclass correctness only once; store string literals in hash table. (objc_build_constructor): Do not convert initializer elements; adjust for ObjC++ impedance mismatch. (build_objc_symtab_template): Call create_field_decl() instead of create_builtin_decl(). (init_objc_symtab): Add missing conversion to initializer element. (build_metadata_decl): Call start_var_decl() instead of define_decl(). (generate_objc_symtab_decl): Do not call build_category_template(); call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(). (build_module_descriptor): Call create_field_decl() instead of grokfield(); call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(); always mark module descriptor as used; move GNU runtime-specific functionality to build_module_initializer_routine(). (build_module_initializer_routine): New function, broken off of build_module_descriptor(). (objc_static_init_needed_p, objc_generate_static_init_call): New functions. (generate_static_references, generate_strings, build_selector_translation_table, generate_descriptor_table, generate_ivars_list, generate_dispatch_table, generate_category): Call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(); build a type directly instead of via groktypename(). (build_selector_reference_decl, build_selector_table_decl, build_class_reference_decl, build_protocol_reference, generate_objc_image_info): Call start_var_decl() instead of build_decl(). (build_selector_reference): For GNU runtime, do not call build_selector_reference_decl(). (build_selector, build_typed_selector_reference): Always convert result to the selector type. (add_objc_string): Cast return value to 'char *'. (build_method_prototype_template, build_selector_template, build_method_template): Use actual selector type for fields pointing to selectors. (finish_objc): For GNU runtime, call build_module_initializer_routine() after build_module_descriptor(). (generate_protocol_list, generate_shared_structures): Call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(); build a type directly instead of via groktypename(). (synth_id_with_class_suffix): Return a string. (get_arg_type_list): For instance methods, use the instance type for 'self'; do not call groktypename_in_parm_context(). (build_objc_string_decl): Squash redeclaration errors in ObjC++. (objc_is_class_name): Use OBJC_TYPE_NAME instead of TYPE_NAME; handle RECORD_TYPEs in ObjC as well as ObjC++. (objc_is_id): New function. (objc_is_object_ptr): Return the canonical type node. (objc_get_class_ivars): Simplify using get_class_ivars(). (get_class_ivars): Remove second parameter; create a fresh copy of the ivar list for each call; do not check for existence of super class. (objc_eh_runtime_type): Mark #ifndef OBJCPLUS. (objc_init_exceptions): When using SJLJ-style exceptions, require the use of '-fobjc-exceptions' flag; do not require it for DWARF-style exceptions. (objc_build_exc_ptr, next_sjlj_build_try_catch_finally): Use objc_object_type instead of objc_id_type. (objc_begin_catch_clause): Convert the incoming PARM_DECL into a VAR_DECL before placing it in the appropriate scope; do not call define_decl(); adjust call to c_begin_compound_stmt(); use objc_object_type instead of objc_id_type. (build_next_objc_exception_stuff): Call create_field_decl() instead of create_builtin_decl(); construct type directly instead of calling groktypename(); use OBJC_VOID_AT_END to mark end of function parameters. (build_private_template): Adjust call to get_class_ivars(); build a type directly instead of via groktypename(). (build_protocol_template, build_method_prototype_list_template, build_method_prototype_template, build_category_template, build_selector_template, build_class_template, build_super_template, build_ivar_template, build_ivar_list_template, build_method_list_template, build_method_template): Call create_field_decl() instead of grokfield(). (objc_method_parm_type): Do not call groktypename(). (generate_descriptor_table): Call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(). (generate_method_descriptors, build_protocol_initializer, generate_dispatch_tables, build_category_initializer, build_shared_structure_initializer): Do not call groktypename(). (generate_protocols): Call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(); do not call groktypename(). (error_with_ivar): Remove last parameter. (check_ivars): Do not iterate ovar CLASS_RAW_IVARS lists in addition to CLASS_IVARS lists; adjust calls to error_with_ivar(). (generate_ivar_lists): Convert one of the initializer elements; do not call groktypename(). (get_arg_type_list, start_method_def, gen_method_def): Account for new representation of variable arguments and '...' in Objective-C methods; add Objective-C++ impedance matching code. (is_objc_type_qualifier): Remove function. (adjust_type_for_id_default): Simplify; there is no longer a need to wade through declspecs. (lookup_interface, start_class, continue_class, finish_class, start_method_def, start_protocol, build_method_decl, objc_add_method, add_instance_variable, build_ivar_reference, is_ivar, is_private, get_super_receiver, objc_build_finally_epilogue): Make into static functions. (receiver_is_class_object): Use new IS_CLASS() macro. (objc_build_message_expr): Tweak ObjC++ message argument handling; call objc_finish_message_expr() instead of finish_message_expr(). (finish_message_expr): Rename to objc_finish_message_expr(); use OBJC_TYPE_NAME and OBJC_SET_TYPE_NAME macros instead of TYPE_NAME. call gen_type_name() instead of gen_declaration(); call objc_is_id() instead of using IS_ID and IS_CLASS; Use objc_class_name instead of calling get_identifier("Class"); handle CONVERT_EXPRs in receiver. (build_objc_method_call, warn_with_method): Do not call groktypename(). (build_ivar_reference): Call convert() instead of clobbering in a type. (hash_init): Initialize string_htab hash table. (add_instance_variable): Simplify parameter list; do not call grokfield(); do not populate CLASS_IVARS list. (start_class): Check for the existence of super class, if one was specified. (continue_class): Use CLASS_RAW_IVARS rather than CLASS_IVARS; do not call build_class_template(); adjust call to get_class_ivars(); call build_decl(), pushdecl() and finish_decl() instead of define_decl(). (finish_class): Call build_decl(), pushdecl() and finish_decl() instead of define_decl(). (add_protocols): Use PROTOCOL_BINFO_ELTS for the tree vector size. (start_protocol): Do not call build_protocol_template(); use PROTOCOL_BINFO_ELTS for the tree vector size. (encode_type_qualifiers): Do not handle the 'const' qualifier here. (encode_pointer): Encode 'const char *' as 'r*', for backwards compatibility. (encode_array): Use HOST_WIDE_INT_PRINT_DEC instead of "%ld". (encode_type): Handle the 'const' qualifier here. (objc_parmlist): New global variable, sued by objc_push_parm and objc_get_parm_info(). (objc_push_parm, objc_get_parm_info): New functions. (objc_expr_last): Remove function. (synth_self_and_ucmd_args): For instance methods, use the instance type for 'self'; call objc_push_parm() instead of push_parm_decl(). (start_method_def): Do not call push_scope(), declare_parm_level(), pop_scope(), push_parm_decl(), store_parm_decls() or objc_expr_last(); just use objc_push_parm() and objc_get_parm_info(). (comp_method_with_proto): Remove function. (objc_types_are_equivalent): Strip away indirections before comparing underlying types. (comp_proto_with_proto): Do not call groktypename(); types are no longer in raw declspec format. (objc_start_function): New function. (really_start_method): Call comp_proto_with_proto() instead of comp_method_with_proto(); call objc_start_function() instead of hand-crafting a function declarator. (continue_method_def, objc_expand_function_end): Remove functions. (get_super_receiver): Call objc_get_current_scope() instead of get_current_scope(); reference 'super_class' field (instead of 'class'). (finish_method_def): Rename to objc_finish_method_definition() and add a function decl parameter; move method encoding call from objc_expand_function_end(). (is_complex_decl, adorn_decl, gen_declarator, gen_declspecs, gen_declaration_1): Remove functions. (tmpbuf, RAW_DECLSPEC): Remove. (gen_declaration): Remove second parameter; simplify to deal with TYPE_P nodes instead of raw declspecs. (gen_type_name, gen_type_name_0): New functions. (gen_method_decl): Remove second parameter; call gen_type_name() instead of gen_declaration_1(). (dump_interface): Adjust calls to gen_declaration() and gen_method_decl(); do not allocate a separate string buffer. (init_objc): Allocate a larger string buffer to accommodate dump_interface(); adjust call to build_module_descriptor(); add call to build_module_initializer_routine() for the GNU runtime. (generate_classref_translation_entry): Do not call start_decl(); call finish_var_decl() instead of finish_decl(); call convert() instead of build_c_cast(). * objc-act.h (CLASS_OWN_IVARS): Remove accessor. (CLASS_BINFO_ELTS): Reduce from 6 to 5, now that CLASS_OWN_IVARS is gone. (OCTI_GNU_INIT_DECL, GNU_INIT_decl): New. (OCTI_ELLIPSIS_NODE, objc_ellipsis_node): Remove. (OCTI_ID_ID, id_type, objc_id_id): Rename to OCTI_ID_NAME, objc_object_type and objc_object_name, respectively. (OCTI_CLS_REF, OCTI_CLASS_NAME, objc_class_reference, objc_class_name): New. (IS_CLASS): New macro. (IS_ID, IS_SUPER): Robustify. (OCTI_EXECCLASS_DECL, execclass_decl): New. (finish_file, start_class, continue_class, finish_class, start_method_def, continue_method_def, finish_method_def, start_protocol, finish_protocol, objc_build_throw_stmt, objc_build_try_catch_finally_stmt, objc_build_synchronized_prologue, objc_build_synchronized_epilogue, objc_build_try_prologue, objc_build_try_epilogue, objc_build_catch_stmt, objc_build_catch_epilogue, objc_build_finally_prologue, objc_build_finally_epilogue, is_ivar, is_private, is_public, add_instance_variable, objc_add_method, get_super_receiver, objc_clear_super_receiver, get_class_ivars_from_name, get_class_reference, get_static_reference, get_object_reference, build_message_expr, finish_message_expr, build_selector_expr, build_ivar_reference, build_keyword_decl, build_method_decl, build_protocol_expr, build_objc_string_object, objc_declare_alias, objc_declare_class, objc_declare_protocols, objc_comptypes, objc_check_decl, build_encode_expr): Remove prototypes. (imp_count, cat_count): Make GGC-aware. (OBJC_SET_TYPE_NAME): New macro. From-SVN: r87168
2004-09-08 02:49:44 +02:00
ret_type = TREE_VALUE (TREE_TYPE (method));
1992-01-18 00:15:38 +01:00
sel_name = IDENTIFIER_POINTER (METHOD_SEL_NAME (method));
c-parse.in (objc_inherit_code, [...]): Make static. 2001-10-03 Ziemowit Laski <zlaski@apple.com> * c-parse.in (objc_inherit_code, objc_pq_context, objc_public_flag): Make static. (objc_interface_context, objc_implementation_context, objc_method_context, objc_ivar_chain, objc_ivar_context): Move to global tree array in objc/objc-act.[ch]. (methoddef): Remove unnecessary code. * objc/objc-act.c: (hashed_attribute, hashed_entry, imp_entry): Hoist struct definitions to objc-act.h. (nst_method_hash_list, cls_method_hash_list, imp_list, imp_count, cat_count): Place declaration in objc-act.h. (objc_tree_index): Move enumeration to objc-act.h. (objc_global_trees): Place declaration and macro accessors in objc-act.h. (implementation_context): Remove duplicate; use objc_implementation_context instead: (method_context): Remove duplicate; use objc_method_context instead. (objc_ellipsis_node, objc_method_prototype_template, implemented_classes, function_type): Move global vars to objc_global_trees. (init_objc): Use LAST_BASE_TREE_CODE instead of LAST_CODE. (build_message_expr): Move actual construction of ObjC message send nodes to finish_message_expr. (finish_message_expr): New routine, contains code formerly in build_message_expr. * objc/objc-act.h (finish_message_expr): New prototype. (objc_ivar_chain, objc_method_context, objc_ellipsis_node): Remove declarations; these vars are now part of objc_global_trees. (objc_tree_index, objc_global_trees): Move definitions from objc-act.c. * objc/objc-tree.def: Update copyright info. From-SVN: r46000
2001-10-04 00:05:57 +02:00
class_name = IDENTIFIER_POINTER (CLASS_NAME (objc_implementation_context));
cat_name = ((TREE_CODE (objc_implementation_context)
== CLASS_IMPLEMENTATION_TYPE)
? NULL
c-parse.in (objc_inherit_code, [...]): Make static. 2001-10-03 Ziemowit Laski <zlaski@apple.com> * c-parse.in (objc_inherit_code, objc_pq_context, objc_public_flag): Make static. (objc_interface_context, objc_implementation_context, objc_method_context, objc_ivar_chain, objc_ivar_context): Move to global tree array in objc/objc-act.[ch]. (methoddef): Remove unnecessary code. * objc/objc-act.c: (hashed_attribute, hashed_entry, imp_entry): Hoist struct definitions to objc-act.h. (nst_method_hash_list, cls_method_hash_list, imp_list, imp_count, cat_count): Place declaration in objc-act.h. (objc_tree_index): Move enumeration to objc-act.h. (objc_global_trees): Place declaration and macro accessors in objc-act.h. (implementation_context): Remove duplicate; use objc_implementation_context instead: (method_context): Remove duplicate; use objc_method_context instead. (objc_ellipsis_node, objc_method_prototype_template, implemented_classes, function_type): Move global vars to objc_global_trees. (init_objc): Use LAST_BASE_TREE_CODE instead of LAST_CODE. (build_message_expr): Move actual construction of ObjC message send nodes to finish_message_expr. (finish_message_expr): New routine, contains code formerly in build_message_expr. * objc/objc-act.h (finish_message_expr): New prototype. (objc_ivar_chain, objc_method_context, objc_ellipsis_node): Remove declarations; these vars are now part of objc_global_trees. (objc_tree_index, objc_global_trees): Move definitions from objc-act.c. * objc/objc-tree.def: Update copyright info. From-SVN: r46000
2001-10-04 00:05:57 +02:00
: IDENTIFIER_POINTER (CLASS_SUPER_NAME (objc_implementation_context)));
method_slot++;
/* Make sure this is big enough for any plausible method label. */
buf = (char *) alloca (50 + strlen (sel_name) + strlen (class_name)
+ (cat_name ? strlen (cat_name) : 0));
OBJC_GEN_METHOD_LABEL (buf, TREE_CODE (method) == INSTANCE_METHOD_DECL,
class_name, cat_name, sel_name, method_slot);
1992-01-18 00:15:38 +01:00
method_id = get_identifier (buf);
#ifdef OBJCPLUS
/* Objective-C methods cannot be overloaded, so we don't need
the type encoding appended. It looks bad anyway... */
push_lang_context (lang_name_c);
#endif
Makefile.in (c-parse.o): Depend on $(C_COMMON_H). [gcc/ChangeLog] 2004-09-07 Ziemowit Laski <zlaski@apple.com> * Makefile.in (c-parse.o): Depend on $(C_COMMON_H). * c-parse.in: Include c-common.h instead of objc-act.h. (ivar_decl_list, ivar_decls, ivar_decl, ivars, ivar_declarator, myparms, myparm): Remove %type declarations. (methodtype, optparms, OBJC_TYPE_QUAL, objc_quals, objc_qual, objc_typename, objc_try_catch_stmt, optellipsis): Add %type declarations. (objc_inherit_code, objc_public_flag): Remove. (typespec_nonreserved_nonattr): Call objc_get_protocol_qualified_type() instead of get_static_reference() and get_protocol_reference(). (stmt_nocomp): Call grokparm() on @catch parameter. (objcdef): Move semantic action to objc_finish_implementation(). (classdef): Move semantic action to objc_start_class_interface(), objc_continue_interface(), objc_finish_interface(), objc_start_class_implementation(), objc_continue_implementation(), objc_start_category_interface() and objc_start_category_implementation(). (protocoldef): Move semantic actions to objc_start_protocol() and objc_finish_interface(). (ivar_decl_list): Remove nonterminal. (visibility_spec): Move semantic actions to objc_set_visibility(). (ivar_decls): Remove assignment to $$. (ivar_decl): Rephrase in terms of component_decl; call objc_add_instance_variable(). (ivars, ivar_declarator): Remove nonterminals. (opt_semi): New nonterminal. (methodtype): Remove semantic actions. (methoddef): Move semantic actions to objc_set_method_type(), objc_start_method_definition() and objc_finish_method_definition(). (methodproto): Move semantic actions to objc_set_method_type() and objc_add_method_declaration(). (methoddecl): Use objc_typename instead of typename; move semantic actions to objc_build_method_signature(). (optarglist, myxdecls, mydecl, myparms, myparm): Remove nonterminals. (optparmlist): Express in terms of optparms and optellipsis. (optparms, optellipsis, objc_qual, objc_quals, objc_typename): New nonterminals. (keyworddecl): Use objc_typename instead of typename. (rid_to_yy): Mark RID_IN, RID_OUT, RID_INOUT, RID_BYCOPY, RID_BYREF and RID_ONEWAY as returning OBJC_TYPE_QUAL to yyparse(). [gcc/objc/ChangeLog] 2004-09-07 Ziemowit Laski <zlaski@apple.com> * Make-lang.in (objc/objc-parse.o): Depend on $(C_COMMON_H) instead of objc/objc-act.h. (objc/objc-act.o): Depend on $(HASHTAB_H). * objc-act.c: Include hashtab.h; in ObjC++ mode, include cp-tree.h and objcp-decl.h instead of c-tree.h. (build_module_descriptor, get_class_ivars, synth_id_with_class_suffix, error_with_ivar, gen_method_decl, gen_declaration, setup_string_decl, build_protocol_template): Adjust prototypes. (build_module_initializer_routine, start_class, continue_class, finish_class, start_method_def, objc_start_function, start_protocol, build_method_decl, objc_add_method, add_instance_variable, build_ivar_reference, is_ivar, is_private, get_super_receiver, build_selector_table_decl, objc_push_parm, objc_get_parm_info, gen_type_name, gen_type_name_0, start_var_decl, finish_var_decl, create_field_decl): New prototypes. (objc_expand_function_end, comp_method_with_proto, objc_expr_last, gen_declaration_1, gen_declarator, is_complex_decl, adorn_decl, define_decl, create_builtin_decl, gen_declspecs): Remove prototypes. (TYPE_ID): Rename to OBJECT_TYPEDEF_NAME. (CLASS_TYPEDEF_NAME): New. (TAG_EXECCLASS): Change from a global variable to a #define. (TAG_RETURN_STRUCT): Delete. (TAG_GNUINIT): New, holds '__objc_gnu_init' name. (objc_inherit_code, objc_public_flag): New, moved from c-parse.in. (string_descriptor): New struct. (string_htab): New hash table. (string_hash, string_eq): New prototypes. (generate_struct_by_value_array): Call create_field_decl() instead of create_builtin_decl(). (objc_init): Do not initialize objc_ellipsis_node or TAG_EXECCLASS; In ObjC++ mode, call cxx_init() instead of c_objc_common_init(). (objc_finish_file): In ObjC++, call instantiate_pending_templates() and cp_finish_file(). (define_decl, get_static_reference, get_protocol_reference, create_builtin_decl): Remove functions. (objc_start_class_interface, objc_start_category_interface, objc_start_protocol, objc_continue_interface, objc_finish_interface, objc_start_class_implementation, objc_start_category_implementation, objc_continue_implementation, objc_finish_implementation, objc_set_visibility, objc_set_method_type, objc_build_method_signature, objc_add_method_declaration, objc_start_method_definition, objc_add_instance_variable, objc_get_protocol_qualified_type, create_field_decl, start_var_decl, finish_var_decl): New functions. (setup_string_decl): Simplify since it is only called once. (synth_module_prologue): Call build_class_template(); predefine 'id' and 'Class' as typedefs; rename 'temp_type' to 'type'; disable debug hooks for duration of function; fix GNU runtime messenger signatures to correspond to reality; forward-declare '__objc_exec_class' for the GNU runtime; call build_selector_table_decl(); in ObjC++ mode, generate 'extern "C" { ... }' wrappers around synthesized declarations; call build_protocol_template() and build_category_template(). (string_hash, string_eq): New functions. (objc_build_string_object): Check metaclass correctness only once; store string literals in hash table. (objc_build_constructor): Do not convert initializer elements; adjust for ObjC++ impedance mismatch. (build_objc_symtab_template): Call create_field_decl() instead of create_builtin_decl(). (init_objc_symtab): Add missing conversion to initializer element. (build_metadata_decl): Call start_var_decl() instead of define_decl(). (generate_objc_symtab_decl): Do not call build_category_template(); call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(). (build_module_descriptor): Call create_field_decl() instead of grokfield(); call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(); always mark module descriptor as used; move GNU runtime-specific functionality to build_module_initializer_routine(). (build_module_initializer_routine): New function, broken off of build_module_descriptor(). (objc_static_init_needed_p, objc_generate_static_init_call): New functions. (generate_static_references, generate_strings, build_selector_translation_table, generate_descriptor_table, generate_ivars_list, generate_dispatch_table, generate_category): Call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(); build a type directly instead of via groktypename(). (build_selector_reference_decl, build_selector_table_decl, build_class_reference_decl, build_protocol_reference, generate_objc_image_info): Call start_var_decl() instead of build_decl(). (build_selector_reference): For GNU runtime, do not call build_selector_reference_decl(). (build_selector, build_typed_selector_reference): Always convert result to the selector type. (add_objc_string): Cast return value to 'char *'. (build_method_prototype_template, build_selector_template, build_method_template): Use actual selector type for fields pointing to selectors. (finish_objc): For GNU runtime, call build_module_initializer_routine() after build_module_descriptor(). (generate_protocol_list, generate_shared_structures): Call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(); build a type directly instead of via groktypename(). (synth_id_with_class_suffix): Return a string. (get_arg_type_list): For instance methods, use the instance type for 'self'; do not call groktypename_in_parm_context(). (build_objc_string_decl): Squash redeclaration errors in ObjC++. (objc_is_class_name): Use OBJC_TYPE_NAME instead of TYPE_NAME; handle RECORD_TYPEs in ObjC as well as ObjC++. (objc_is_id): New function. (objc_is_object_ptr): Return the canonical type node. (objc_get_class_ivars): Simplify using get_class_ivars(). (get_class_ivars): Remove second parameter; create a fresh copy of the ivar list for each call; do not check for existence of super class. (objc_eh_runtime_type): Mark #ifndef OBJCPLUS. (objc_init_exceptions): When using SJLJ-style exceptions, require the use of '-fobjc-exceptions' flag; do not require it for DWARF-style exceptions. (objc_build_exc_ptr, next_sjlj_build_try_catch_finally): Use objc_object_type instead of objc_id_type. (objc_begin_catch_clause): Convert the incoming PARM_DECL into a VAR_DECL before placing it in the appropriate scope; do not call define_decl(); adjust call to c_begin_compound_stmt(); use objc_object_type instead of objc_id_type. (build_next_objc_exception_stuff): Call create_field_decl() instead of create_builtin_decl(); construct type directly instead of calling groktypename(); use OBJC_VOID_AT_END to mark end of function parameters. (build_private_template): Adjust call to get_class_ivars(); build a type directly instead of via groktypename(). (build_protocol_template, build_method_prototype_list_template, build_method_prototype_template, build_category_template, build_selector_template, build_class_template, build_super_template, build_ivar_template, build_ivar_list_template, build_method_list_template, build_method_template): Call create_field_decl() instead of grokfield(). (objc_method_parm_type): Do not call groktypename(). (generate_descriptor_table): Call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(). (generate_method_descriptors, build_protocol_initializer, generate_dispatch_tables, build_category_initializer, build_shared_structure_initializer): Do not call groktypename(). (generate_protocols): Call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(); do not call groktypename(). (error_with_ivar): Remove last parameter. (check_ivars): Do not iterate ovar CLASS_RAW_IVARS lists in addition to CLASS_IVARS lists; adjust calls to error_with_ivar(). (generate_ivar_lists): Convert one of the initializer elements; do not call groktypename(). (get_arg_type_list, start_method_def, gen_method_def): Account for new representation of variable arguments and '...' in Objective-C methods; add Objective-C++ impedance matching code. (is_objc_type_qualifier): Remove function. (adjust_type_for_id_default): Simplify; there is no longer a need to wade through declspecs. (lookup_interface, start_class, continue_class, finish_class, start_method_def, start_protocol, build_method_decl, objc_add_method, add_instance_variable, build_ivar_reference, is_ivar, is_private, get_super_receiver, objc_build_finally_epilogue): Make into static functions. (receiver_is_class_object): Use new IS_CLASS() macro. (objc_build_message_expr): Tweak ObjC++ message argument handling; call objc_finish_message_expr() instead of finish_message_expr(). (finish_message_expr): Rename to objc_finish_message_expr(); use OBJC_TYPE_NAME and OBJC_SET_TYPE_NAME macros instead of TYPE_NAME. call gen_type_name() instead of gen_declaration(); call objc_is_id() instead of using IS_ID and IS_CLASS; Use objc_class_name instead of calling get_identifier("Class"); handle CONVERT_EXPRs in receiver. (build_objc_method_call, warn_with_method): Do not call groktypename(). (build_ivar_reference): Call convert() instead of clobbering in a type. (hash_init): Initialize string_htab hash table. (add_instance_variable): Simplify parameter list; do not call grokfield(); do not populate CLASS_IVARS list. (start_class): Check for the existence of super class, if one was specified. (continue_class): Use CLASS_RAW_IVARS rather than CLASS_IVARS; do not call build_class_template(); adjust call to get_class_ivars(); call build_decl(), pushdecl() and finish_decl() instead of define_decl(). (finish_class): Call build_decl(), pushdecl() and finish_decl() instead of define_decl(). (add_protocols): Use PROTOCOL_BINFO_ELTS for the tree vector size. (start_protocol): Do not call build_protocol_template(); use PROTOCOL_BINFO_ELTS for the tree vector size. (encode_type_qualifiers): Do not handle the 'const' qualifier here. (encode_pointer): Encode 'const char *' as 'r*', for backwards compatibility. (encode_array): Use HOST_WIDE_INT_PRINT_DEC instead of "%ld". (encode_type): Handle the 'const' qualifier here. (objc_parmlist): New global variable, sued by objc_push_parm and objc_get_parm_info(). (objc_push_parm, objc_get_parm_info): New functions. (objc_expr_last): Remove function. (synth_self_and_ucmd_args): For instance methods, use the instance type for 'self'; call objc_push_parm() instead of push_parm_decl(). (start_method_def): Do not call push_scope(), declare_parm_level(), pop_scope(), push_parm_decl(), store_parm_decls() or objc_expr_last(); just use objc_push_parm() and objc_get_parm_info(). (comp_method_with_proto): Remove function. (objc_types_are_equivalent): Strip away indirections before comparing underlying types. (comp_proto_with_proto): Do not call groktypename(); types are no longer in raw declspec format. (objc_start_function): New function. (really_start_method): Call comp_proto_with_proto() instead of comp_method_with_proto(); call objc_start_function() instead of hand-crafting a function declarator. (continue_method_def, objc_expand_function_end): Remove functions. (get_super_receiver): Call objc_get_current_scope() instead of get_current_scope(); reference 'super_class' field (instead of 'class'). (finish_method_def): Rename to objc_finish_method_definition() and add a function decl parameter; move method encoding call from objc_expand_function_end(). (is_complex_decl, adorn_decl, gen_declarator, gen_declspecs, gen_declaration_1): Remove functions. (tmpbuf, RAW_DECLSPEC): Remove. (gen_declaration): Remove second parameter; simplify to deal with TYPE_P nodes instead of raw declspecs. (gen_type_name, gen_type_name_0): New functions. (gen_method_decl): Remove second parameter; call gen_type_name() instead of gen_declaration_1(). (dump_interface): Adjust calls to gen_declaration() and gen_method_decl(); do not allocate a separate string buffer. (init_objc): Allocate a larger string buffer to accommodate dump_interface(); adjust call to build_module_descriptor(); add call to build_module_initializer_routine() for the GNU runtime. (generate_classref_translation_entry): Do not call start_decl(); call finish_var_decl() instead of finish_decl(); call convert() instead of build_c_cast(). * objc-act.h (CLASS_OWN_IVARS): Remove accessor. (CLASS_BINFO_ELTS): Reduce from 6 to 5, now that CLASS_OWN_IVARS is gone. (OCTI_GNU_INIT_DECL, GNU_INIT_decl): New. (OCTI_ELLIPSIS_NODE, objc_ellipsis_node): Remove. (OCTI_ID_ID, id_type, objc_id_id): Rename to OCTI_ID_NAME, objc_object_type and objc_object_name, respectively. (OCTI_CLS_REF, OCTI_CLASS_NAME, objc_class_reference, objc_class_name): New. (IS_CLASS): New macro. (IS_ID, IS_SUPER): Robustify. (OCTI_EXECCLASS_DECL, execclass_decl): New. (finish_file, start_class, continue_class, finish_class, start_method_def, continue_method_def, finish_method_def, start_protocol, finish_protocol, objc_build_throw_stmt, objc_build_try_catch_finally_stmt, objc_build_synchronized_prologue, objc_build_synchronized_epilogue, objc_build_try_prologue, objc_build_try_epilogue, objc_build_catch_stmt, objc_build_catch_epilogue, objc_build_finally_prologue, objc_build_finally_epilogue, is_ivar, is_private, is_public, add_instance_variable, objc_add_method, get_super_receiver, objc_clear_super_receiver, get_class_ivars_from_name, get_class_reference, get_static_reference, get_object_reference, build_message_expr, finish_message_expr, build_selector_expr, build_ivar_reference, build_keyword_decl, build_method_decl, build_protocol_expr, build_objc_string_object, objc_declare_alias, objc_declare_class, objc_declare_protocols, objc_comptypes, objc_check_decl, build_encode_expr): Remove prototypes. (imp_count, cat_count): Make GGC-aware. (OBJC_SET_TYPE_NAME): New macro. From-SVN: r87168
2004-09-08 02:49:44 +02:00
meth_type
= build_function_type (ret_type,
get_arg_type_list (method, METHOD_DEF, 0));
objc_start_function (method_id, meth_type, NULL_TREE, parmlist);
1992-01-18 00:15:38 +01:00
Makefile.in (c-parse.o): Depend on $(C_COMMON_H). [gcc/ChangeLog] 2004-09-07 Ziemowit Laski <zlaski@apple.com> * Makefile.in (c-parse.o): Depend on $(C_COMMON_H). * c-parse.in: Include c-common.h instead of objc-act.h. (ivar_decl_list, ivar_decls, ivar_decl, ivars, ivar_declarator, myparms, myparm): Remove %type declarations. (methodtype, optparms, OBJC_TYPE_QUAL, objc_quals, objc_qual, objc_typename, objc_try_catch_stmt, optellipsis): Add %type declarations. (objc_inherit_code, objc_public_flag): Remove. (typespec_nonreserved_nonattr): Call objc_get_protocol_qualified_type() instead of get_static_reference() and get_protocol_reference(). (stmt_nocomp): Call grokparm() on @catch parameter. (objcdef): Move semantic action to objc_finish_implementation(). (classdef): Move semantic action to objc_start_class_interface(), objc_continue_interface(), objc_finish_interface(), objc_start_class_implementation(), objc_continue_implementation(), objc_start_category_interface() and objc_start_category_implementation(). (protocoldef): Move semantic actions to objc_start_protocol() and objc_finish_interface(). (ivar_decl_list): Remove nonterminal. (visibility_spec): Move semantic actions to objc_set_visibility(). (ivar_decls): Remove assignment to $$. (ivar_decl): Rephrase in terms of component_decl; call objc_add_instance_variable(). (ivars, ivar_declarator): Remove nonterminals. (opt_semi): New nonterminal. (methodtype): Remove semantic actions. (methoddef): Move semantic actions to objc_set_method_type(), objc_start_method_definition() and objc_finish_method_definition(). (methodproto): Move semantic actions to objc_set_method_type() and objc_add_method_declaration(). (methoddecl): Use objc_typename instead of typename; move semantic actions to objc_build_method_signature(). (optarglist, myxdecls, mydecl, myparms, myparm): Remove nonterminals. (optparmlist): Express in terms of optparms and optellipsis. (optparms, optellipsis, objc_qual, objc_quals, objc_typename): New nonterminals. (keyworddecl): Use objc_typename instead of typename. (rid_to_yy): Mark RID_IN, RID_OUT, RID_INOUT, RID_BYCOPY, RID_BYREF and RID_ONEWAY as returning OBJC_TYPE_QUAL to yyparse(). [gcc/objc/ChangeLog] 2004-09-07 Ziemowit Laski <zlaski@apple.com> * Make-lang.in (objc/objc-parse.o): Depend on $(C_COMMON_H) instead of objc/objc-act.h. (objc/objc-act.o): Depend on $(HASHTAB_H). * objc-act.c: Include hashtab.h; in ObjC++ mode, include cp-tree.h and objcp-decl.h instead of c-tree.h. (build_module_descriptor, get_class_ivars, synth_id_with_class_suffix, error_with_ivar, gen_method_decl, gen_declaration, setup_string_decl, build_protocol_template): Adjust prototypes. (build_module_initializer_routine, start_class, continue_class, finish_class, start_method_def, objc_start_function, start_protocol, build_method_decl, objc_add_method, add_instance_variable, build_ivar_reference, is_ivar, is_private, get_super_receiver, build_selector_table_decl, objc_push_parm, objc_get_parm_info, gen_type_name, gen_type_name_0, start_var_decl, finish_var_decl, create_field_decl): New prototypes. (objc_expand_function_end, comp_method_with_proto, objc_expr_last, gen_declaration_1, gen_declarator, is_complex_decl, adorn_decl, define_decl, create_builtin_decl, gen_declspecs): Remove prototypes. (TYPE_ID): Rename to OBJECT_TYPEDEF_NAME. (CLASS_TYPEDEF_NAME): New. (TAG_EXECCLASS): Change from a global variable to a #define. (TAG_RETURN_STRUCT): Delete. (TAG_GNUINIT): New, holds '__objc_gnu_init' name. (objc_inherit_code, objc_public_flag): New, moved from c-parse.in. (string_descriptor): New struct. (string_htab): New hash table. (string_hash, string_eq): New prototypes. (generate_struct_by_value_array): Call create_field_decl() instead of create_builtin_decl(). (objc_init): Do not initialize objc_ellipsis_node or TAG_EXECCLASS; In ObjC++ mode, call cxx_init() instead of c_objc_common_init(). (objc_finish_file): In ObjC++, call instantiate_pending_templates() and cp_finish_file(). (define_decl, get_static_reference, get_protocol_reference, create_builtin_decl): Remove functions. (objc_start_class_interface, objc_start_category_interface, objc_start_protocol, objc_continue_interface, objc_finish_interface, objc_start_class_implementation, objc_start_category_implementation, objc_continue_implementation, objc_finish_implementation, objc_set_visibility, objc_set_method_type, objc_build_method_signature, objc_add_method_declaration, objc_start_method_definition, objc_add_instance_variable, objc_get_protocol_qualified_type, create_field_decl, start_var_decl, finish_var_decl): New functions. (setup_string_decl): Simplify since it is only called once. (synth_module_prologue): Call build_class_template(); predefine 'id' and 'Class' as typedefs; rename 'temp_type' to 'type'; disable debug hooks for duration of function; fix GNU runtime messenger signatures to correspond to reality; forward-declare '__objc_exec_class' for the GNU runtime; call build_selector_table_decl(); in ObjC++ mode, generate 'extern "C" { ... }' wrappers around synthesized declarations; call build_protocol_template() and build_category_template(). (string_hash, string_eq): New functions. (objc_build_string_object): Check metaclass correctness only once; store string literals in hash table. (objc_build_constructor): Do not convert initializer elements; adjust for ObjC++ impedance mismatch. (build_objc_symtab_template): Call create_field_decl() instead of create_builtin_decl(). (init_objc_symtab): Add missing conversion to initializer element. (build_metadata_decl): Call start_var_decl() instead of define_decl(). (generate_objc_symtab_decl): Do not call build_category_template(); call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(). (build_module_descriptor): Call create_field_decl() instead of grokfield(); call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(); always mark module descriptor as used; move GNU runtime-specific functionality to build_module_initializer_routine(). (build_module_initializer_routine): New function, broken off of build_module_descriptor(). (objc_static_init_needed_p, objc_generate_static_init_call): New functions. (generate_static_references, generate_strings, build_selector_translation_table, generate_descriptor_table, generate_ivars_list, generate_dispatch_table, generate_category): Call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(); build a type directly instead of via groktypename(). (build_selector_reference_decl, build_selector_table_decl, build_class_reference_decl, build_protocol_reference, generate_objc_image_info): Call start_var_decl() instead of build_decl(). (build_selector_reference): For GNU runtime, do not call build_selector_reference_decl(). (build_selector, build_typed_selector_reference): Always convert result to the selector type. (add_objc_string): Cast return value to 'char *'. (build_method_prototype_template, build_selector_template, build_method_template): Use actual selector type for fields pointing to selectors. (finish_objc): For GNU runtime, call build_module_initializer_routine() after build_module_descriptor(). (generate_protocol_list, generate_shared_structures): Call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(); build a type directly instead of via groktypename(). (synth_id_with_class_suffix): Return a string. (get_arg_type_list): For instance methods, use the instance type for 'self'; do not call groktypename_in_parm_context(). (build_objc_string_decl): Squash redeclaration errors in ObjC++. (objc_is_class_name): Use OBJC_TYPE_NAME instead of TYPE_NAME; handle RECORD_TYPEs in ObjC as well as ObjC++. (objc_is_id): New function. (objc_is_object_ptr): Return the canonical type node. (objc_get_class_ivars): Simplify using get_class_ivars(). (get_class_ivars): Remove second parameter; create a fresh copy of the ivar list for each call; do not check for existence of super class. (objc_eh_runtime_type): Mark #ifndef OBJCPLUS. (objc_init_exceptions): When using SJLJ-style exceptions, require the use of '-fobjc-exceptions' flag; do not require it for DWARF-style exceptions. (objc_build_exc_ptr, next_sjlj_build_try_catch_finally): Use objc_object_type instead of objc_id_type. (objc_begin_catch_clause): Convert the incoming PARM_DECL into a VAR_DECL before placing it in the appropriate scope; do not call define_decl(); adjust call to c_begin_compound_stmt(); use objc_object_type instead of objc_id_type. (build_next_objc_exception_stuff): Call create_field_decl() instead of create_builtin_decl(); construct type directly instead of calling groktypename(); use OBJC_VOID_AT_END to mark end of function parameters. (build_private_template): Adjust call to get_class_ivars(); build a type directly instead of via groktypename(). (build_protocol_template, build_method_prototype_list_template, build_method_prototype_template, build_category_template, build_selector_template, build_class_template, build_super_template, build_ivar_template, build_ivar_list_template, build_method_list_template, build_method_template): Call create_field_decl() instead of grokfield(). (objc_method_parm_type): Do not call groktypename(). (generate_descriptor_table): Call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(). (generate_method_descriptors, build_protocol_initializer, generate_dispatch_tables, build_category_initializer, build_shared_structure_initializer): Do not call groktypename(). (generate_protocols): Call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(); do not call groktypename(). (error_with_ivar): Remove last parameter. (check_ivars): Do not iterate ovar CLASS_RAW_IVARS lists in addition to CLASS_IVARS lists; adjust calls to error_with_ivar(). (generate_ivar_lists): Convert one of the initializer elements; do not call groktypename(). (get_arg_type_list, start_method_def, gen_method_def): Account for new representation of variable arguments and '...' in Objective-C methods; add Objective-C++ impedance matching code. (is_objc_type_qualifier): Remove function. (adjust_type_for_id_default): Simplify; there is no longer a need to wade through declspecs. (lookup_interface, start_class, continue_class, finish_class, start_method_def, start_protocol, build_method_decl, objc_add_method, add_instance_variable, build_ivar_reference, is_ivar, is_private, get_super_receiver, objc_build_finally_epilogue): Make into static functions. (receiver_is_class_object): Use new IS_CLASS() macro. (objc_build_message_expr): Tweak ObjC++ message argument handling; call objc_finish_message_expr() instead of finish_message_expr(). (finish_message_expr): Rename to objc_finish_message_expr(); use OBJC_TYPE_NAME and OBJC_SET_TYPE_NAME macros instead of TYPE_NAME. call gen_type_name() instead of gen_declaration(); call objc_is_id() instead of using IS_ID and IS_CLASS; Use objc_class_name instead of calling get_identifier("Class"); handle CONVERT_EXPRs in receiver. (build_objc_method_call, warn_with_method): Do not call groktypename(). (build_ivar_reference): Call convert() instead of clobbering in a type. (hash_init): Initialize string_htab hash table. (add_instance_variable): Simplify parameter list; do not call grokfield(); do not populate CLASS_IVARS list. (start_class): Check for the existence of super class, if one was specified. (continue_class): Use CLASS_RAW_IVARS rather than CLASS_IVARS; do not call build_class_template(); adjust call to get_class_ivars(); call build_decl(), pushdecl() and finish_decl() instead of define_decl(). (finish_class): Call build_decl(), pushdecl() and finish_decl() instead of define_decl(). (add_protocols): Use PROTOCOL_BINFO_ELTS for the tree vector size. (start_protocol): Do not call build_protocol_template(); use PROTOCOL_BINFO_ELTS for the tree vector size. (encode_type_qualifiers): Do not handle the 'const' qualifier here. (encode_pointer): Encode 'const char *' as 'r*', for backwards compatibility. (encode_array): Use HOST_WIDE_INT_PRINT_DEC instead of "%ld". (encode_type): Handle the 'const' qualifier here. (objc_parmlist): New global variable, sued by objc_push_parm and objc_get_parm_info(). (objc_push_parm, objc_get_parm_info): New functions. (objc_expr_last): Remove function. (synth_self_and_ucmd_args): For instance methods, use the instance type for 'self'; call objc_push_parm() instead of push_parm_decl(). (start_method_def): Do not call push_scope(), declare_parm_level(), pop_scope(), push_parm_decl(), store_parm_decls() or objc_expr_last(); just use objc_push_parm() and objc_get_parm_info(). (comp_method_with_proto): Remove function. (objc_types_are_equivalent): Strip away indirections before comparing underlying types. (comp_proto_with_proto): Do not call groktypename(); types are no longer in raw declspec format. (objc_start_function): New function. (really_start_method): Call comp_proto_with_proto() instead of comp_method_with_proto(); call objc_start_function() instead of hand-crafting a function declarator. (continue_method_def, objc_expand_function_end): Remove functions. (get_super_receiver): Call objc_get_current_scope() instead of get_current_scope(); reference 'super_class' field (instead of 'class'). (finish_method_def): Rename to objc_finish_method_definition() and add a function decl parameter; move method encoding call from objc_expand_function_end(). (is_complex_decl, adorn_decl, gen_declarator, gen_declspecs, gen_declaration_1): Remove functions. (tmpbuf, RAW_DECLSPEC): Remove. (gen_declaration): Remove second parameter; simplify to deal with TYPE_P nodes instead of raw declspecs. (gen_type_name, gen_type_name_0): New functions. (gen_method_decl): Remove second parameter; call gen_type_name() instead of gen_declaration_1(). (dump_interface): Adjust calls to gen_declaration() and gen_method_decl(); do not allocate a separate string buffer. (init_objc): Allocate a larger string buffer to accommodate dump_interface(); adjust call to build_module_descriptor(); add call to build_module_initializer_routine() for the GNU runtime. (generate_classref_translation_entry): Do not call start_decl(); call finish_var_decl() instead of finish_decl(); call convert() instead of build_c_cast(). * objc-act.h (CLASS_OWN_IVARS): Remove accessor. (CLASS_BINFO_ELTS): Reduce from 6 to 5, now that CLASS_OWN_IVARS is gone. (OCTI_GNU_INIT_DECL, GNU_INIT_decl): New. (OCTI_ELLIPSIS_NODE, objc_ellipsis_node): Remove. (OCTI_ID_ID, id_type, objc_id_id): Rename to OCTI_ID_NAME, objc_object_type and objc_object_name, respectively. (OCTI_CLS_REF, OCTI_CLASS_NAME, objc_class_reference, objc_class_name): New. (IS_CLASS): New macro. (IS_ID, IS_SUPER): Robustify. (OCTI_EXECCLASS_DECL, execclass_decl): New. (finish_file, start_class, continue_class, finish_class, start_method_def, continue_method_def, finish_method_def, start_protocol, finish_protocol, objc_build_throw_stmt, objc_build_try_catch_finally_stmt, objc_build_synchronized_prologue, objc_build_synchronized_epilogue, objc_build_try_prologue, objc_build_try_epilogue, objc_build_catch_stmt, objc_build_catch_epilogue, objc_build_finally_prologue, objc_build_finally_epilogue, is_ivar, is_private, is_public, add_instance_variable, objc_add_method, get_super_receiver, objc_clear_super_receiver, get_class_ivars_from_name, get_class_reference, get_static_reference, get_object_reference, build_message_expr, finish_message_expr, build_selector_expr, build_ivar_reference, build_keyword_decl, build_method_decl, build_protocol_expr, build_objc_string_object, objc_declare_alias, objc_declare_class, objc_declare_protocols, objc_comptypes, objc_check_decl, build_encode_expr): Remove prototypes. (imp_count, cat_count): Make GGC-aware. (OBJC_SET_TYPE_NAME): New macro. From-SVN: r87168
2004-09-08 02:49:44 +02:00
/* Set self_decl from the first argument. */
self_decl = DECL_ARGUMENTS (current_function_decl);
Makefile.in (c-parse.o): Depend on $(C_COMMON_H). [gcc/ChangeLog] 2004-09-07 Ziemowit Laski <zlaski@apple.com> * Makefile.in (c-parse.o): Depend on $(C_COMMON_H). * c-parse.in: Include c-common.h instead of objc-act.h. (ivar_decl_list, ivar_decls, ivar_decl, ivars, ivar_declarator, myparms, myparm): Remove %type declarations. (methodtype, optparms, OBJC_TYPE_QUAL, objc_quals, objc_qual, objc_typename, objc_try_catch_stmt, optellipsis): Add %type declarations. (objc_inherit_code, objc_public_flag): Remove. (typespec_nonreserved_nonattr): Call objc_get_protocol_qualified_type() instead of get_static_reference() and get_protocol_reference(). (stmt_nocomp): Call grokparm() on @catch parameter. (objcdef): Move semantic action to objc_finish_implementation(). (classdef): Move semantic action to objc_start_class_interface(), objc_continue_interface(), objc_finish_interface(), objc_start_class_implementation(), objc_continue_implementation(), objc_start_category_interface() and objc_start_category_implementation(). (protocoldef): Move semantic actions to objc_start_protocol() and objc_finish_interface(). (ivar_decl_list): Remove nonterminal. (visibility_spec): Move semantic actions to objc_set_visibility(). (ivar_decls): Remove assignment to $$. (ivar_decl): Rephrase in terms of component_decl; call objc_add_instance_variable(). (ivars, ivar_declarator): Remove nonterminals. (opt_semi): New nonterminal. (methodtype): Remove semantic actions. (methoddef): Move semantic actions to objc_set_method_type(), objc_start_method_definition() and objc_finish_method_definition(). (methodproto): Move semantic actions to objc_set_method_type() and objc_add_method_declaration(). (methoddecl): Use objc_typename instead of typename; move semantic actions to objc_build_method_signature(). (optarglist, myxdecls, mydecl, myparms, myparm): Remove nonterminals. (optparmlist): Express in terms of optparms and optellipsis. (optparms, optellipsis, objc_qual, objc_quals, objc_typename): New nonterminals. (keyworddecl): Use objc_typename instead of typename. (rid_to_yy): Mark RID_IN, RID_OUT, RID_INOUT, RID_BYCOPY, RID_BYREF and RID_ONEWAY as returning OBJC_TYPE_QUAL to yyparse(). [gcc/objc/ChangeLog] 2004-09-07 Ziemowit Laski <zlaski@apple.com> * Make-lang.in (objc/objc-parse.o): Depend on $(C_COMMON_H) instead of objc/objc-act.h. (objc/objc-act.o): Depend on $(HASHTAB_H). * objc-act.c: Include hashtab.h; in ObjC++ mode, include cp-tree.h and objcp-decl.h instead of c-tree.h. (build_module_descriptor, get_class_ivars, synth_id_with_class_suffix, error_with_ivar, gen_method_decl, gen_declaration, setup_string_decl, build_protocol_template): Adjust prototypes. (build_module_initializer_routine, start_class, continue_class, finish_class, start_method_def, objc_start_function, start_protocol, build_method_decl, objc_add_method, add_instance_variable, build_ivar_reference, is_ivar, is_private, get_super_receiver, build_selector_table_decl, objc_push_parm, objc_get_parm_info, gen_type_name, gen_type_name_0, start_var_decl, finish_var_decl, create_field_decl): New prototypes. (objc_expand_function_end, comp_method_with_proto, objc_expr_last, gen_declaration_1, gen_declarator, is_complex_decl, adorn_decl, define_decl, create_builtin_decl, gen_declspecs): Remove prototypes. (TYPE_ID): Rename to OBJECT_TYPEDEF_NAME. (CLASS_TYPEDEF_NAME): New. (TAG_EXECCLASS): Change from a global variable to a #define. (TAG_RETURN_STRUCT): Delete. (TAG_GNUINIT): New, holds '__objc_gnu_init' name. (objc_inherit_code, objc_public_flag): New, moved from c-parse.in. (string_descriptor): New struct. (string_htab): New hash table. (string_hash, string_eq): New prototypes. (generate_struct_by_value_array): Call create_field_decl() instead of create_builtin_decl(). (objc_init): Do not initialize objc_ellipsis_node or TAG_EXECCLASS; In ObjC++ mode, call cxx_init() instead of c_objc_common_init(). (objc_finish_file): In ObjC++, call instantiate_pending_templates() and cp_finish_file(). (define_decl, get_static_reference, get_protocol_reference, create_builtin_decl): Remove functions. (objc_start_class_interface, objc_start_category_interface, objc_start_protocol, objc_continue_interface, objc_finish_interface, objc_start_class_implementation, objc_start_category_implementation, objc_continue_implementation, objc_finish_implementation, objc_set_visibility, objc_set_method_type, objc_build_method_signature, objc_add_method_declaration, objc_start_method_definition, objc_add_instance_variable, objc_get_protocol_qualified_type, create_field_decl, start_var_decl, finish_var_decl): New functions. (setup_string_decl): Simplify since it is only called once. (synth_module_prologue): Call build_class_template(); predefine 'id' and 'Class' as typedefs; rename 'temp_type' to 'type'; disable debug hooks for duration of function; fix GNU runtime messenger signatures to correspond to reality; forward-declare '__objc_exec_class' for the GNU runtime; call build_selector_table_decl(); in ObjC++ mode, generate 'extern "C" { ... }' wrappers around synthesized declarations; call build_protocol_template() and build_category_template(). (string_hash, string_eq): New functions. (objc_build_string_object): Check metaclass correctness only once; store string literals in hash table. (objc_build_constructor): Do not convert initializer elements; adjust for ObjC++ impedance mismatch. (build_objc_symtab_template): Call create_field_decl() instead of create_builtin_decl(). (init_objc_symtab): Add missing conversion to initializer element. (build_metadata_decl): Call start_var_decl() instead of define_decl(). (generate_objc_symtab_decl): Do not call build_category_template(); call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(). (build_module_descriptor): Call create_field_decl() instead of grokfield(); call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(); always mark module descriptor as used; move GNU runtime-specific functionality to build_module_initializer_routine(). (build_module_initializer_routine): New function, broken off of build_module_descriptor(). (objc_static_init_needed_p, objc_generate_static_init_call): New functions. (generate_static_references, generate_strings, build_selector_translation_table, generate_descriptor_table, generate_ivars_list, generate_dispatch_table, generate_category): Call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(); build a type directly instead of via groktypename(). (build_selector_reference_decl, build_selector_table_decl, build_class_reference_decl, build_protocol_reference, generate_objc_image_info): Call start_var_decl() instead of build_decl(). (build_selector_reference): For GNU runtime, do not call build_selector_reference_decl(). (build_selector, build_typed_selector_reference): Always convert result to the selector type. (add_objc_string): Cast return value to 'char *'. (build_method_prototype_template, build_selector_template, build_method_template): Use actual selector type for fields pointing to selectors. (finish_objc): For GNU runtime, call build_module_initializer_routine() after build_module_descriptor(). (generate_protocol_list, generate_shared_structures): Call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(); build a type directly instead of via groktypename(). (synth_id_with_class_suffix): Return a string. (get_arg_type_list): For instance methods, use the instance type for 'self'; do not call groktypename_in_parm_context(). (build_objc_string_decl): Squash redeclaration errors in ObjC++. (objc_is_class_name): Use OBJC_TYPE_NAME instead of TYPE_NAME; handle RECORD_TYPEs in ObjC as well as ObjC++. (objc_is_id): New function. (objc_is_object_ptr): Return the canonical type node. (objc_get_class_ivars): Simplify using get_class_ivars(). (get_class_ivars): Remove second parameter; create a fresh copy of the ivar list for each call; do not check for existence of super class. (objc_eh_runtime_type): Mark #ifndef OBJCPLUS. (objc_init_exceptions): When using SJLJ-style exceptions, require the use of '-fobjc-exceptions' flag; do not require it for DWARF-style exceptions. (objc_build_exc_ptr, next_sjlj_build_try_catch_finally): Use objc_object_type instead of objc_id_type. (objc_begin_catch_clause): Convert the incoming PARM_DECL into a VAR_DECL before placing it in the appropriate scope; do not call define_decl(); adjust call to c_begin_compound_stmt(); use objc_object_type instead of objc_id_type. (build_next_objc_exception_stuff): Call create_field_decl() instead of create_builtin_decl(); construct type directly instead of calling groktypename(); use OBJC_VOID_AT_END to mark end of function parameters. (build_private_template): Adjust call to get_class_ivars(); build a type directly instead of via groktypename(). (build_protocol_template, build_method_prototype_list_template, build_method_prototype_template, build_category_template, build_selector_template, build_class_template, build_super_template, build_ivar_template, build_ivar_list_template, build_method_list_template, build_method_template): Call create_field_decl() instead of grokfield(). (objc_method_parm_type): Do not call groktypename(). (generate_descriptor_table): Call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(). (generate_method_descriptors, build_protocol_initializer, generate_dispatch_tables, build_category_initializer, build_shared_structure_initializer): Do not call groktypename(). (generate_protocols): Call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(); do not call groktypename(). (error_with_ivar): Remove last parameter. (check_ivars): Do not iterate ovar CLASS_RAW_IVARS lists in addition to CLASS_IVARS lists; adjust calls to error_with_ivar(). (generate_ivar_lists): Convert one of the initializer elements; do not call groktypename(). (get_arg_type_list, start_method_def, gen_method_def): Account for new representation of variable arguments and '...' in Objective-C methods; add Objective-C++ impedance matching code. (is_objc_type_qualifier): Remove function. (adjust_type_for_id_default): Simplify; there is no longer a need to wade through declspecs. (lookup_interface, start_class, continue_class, finish_class, start_method_def, start_protocol, build_method_decl, objc_add_method, add_instance_variable, build_ivar_reference, is_ivar, is_private, get_super_receiver, objc_build_finally_epilogue): Make into static functions. (receiver_is_class_object): Use new IS_CLASS() macro. (objc_build_message_expr): Tweak ObjC++ message argument handling; call objc_finish_message_expr() instead of finish_message_expr(). (finish_message_expr): Rename to objc_finish_message_expr(); use OBJC_TYPE_NAME and OBJC_SET_TYPE_NAME macros instead of TYPE_NAME. call gen_type_name() instead of gen_declaration(); call objc_is_id() instead of using IS_ID and IS_CLASS; Use objc_class_name instead of calling get_identifier("Class"); handle CONVERT_EXPRs in receiver. (build_objc_method_call, warn_with_method): Do not call groktypename(). (build_ivar_reference): Call convert() instead of clobbering in a type. (hash_init): Initialize string_htab hash table. (add_instance_variable): Simplify parameter list; do not call grokfield(); do not populate CLASS_IVARS list. (start_class): Check for the existence of super class, if one was specified. (continue_class): Use CLASS_RAW_IVARS rather than CLASS_IVARS; do not call build_class_template(); adjust call to get_class_ivars(); call build_decl(), pushdecl() and finish_decl() instead of define_decl(). (finish_class): Call build_decl(), pushdecl() and finish_decl() instead of define_decl(). (add_protocols): Use PROTOCOL_BINFO_ELTS for the tree vector size. (start_protocol): Do not call build_protocol_template(); use PROTOCOL_BINFO_ELTS for the tree vector size. (encode_type_qualifiers): Do not handle the 'const' qualifier here. (encode_pointer): Encode 'const char *' as 'r*', for backwards compatibility. (encode_array): Use HOST_WIDE_INT_PRINT_DEC instead of "%ld". (encode_type): Handle the 'const' qualifier here. (objc_parmlist): New global variable, sued by objc_push_parm and objc_get_parm_info(). (objc_push_parm, objc_get_parm_info): New functions. (objc_expr_last): Remove function. (synth_self_and_ucmd_args): For instance methods, use the instance type for 'self'; call objc_push_parm() instead of push_parm_decl(). (start_method_def): Do not call push_scope(), declare_parm_level(), pop_scope(), push_parm_decl(), store_parm_decls() or objc_expr_last(); just use objc_push_parm() and objc_get_parm_info(). (comp_method_with_proto): Remove function. (objc_types_are_equivalent): Strip away indirections before comparing underlying types. (comp_proto_with_proto): Do not call groktypename(); types are no longer in raw declspec format. (objc_start_function): New function. (really_start_method): Call comp_proto_with_proto() instead of comp_method_with_proto(); call objc_start_function() instead of hand-crafting a function declarator. (continue_method_def, objc_expand_function_end): Remove functions. (get_super_receiver): Call objc_get_current_scope() instead of get_current_scope(); reference 'super_class' field (instead of 'class'). (finish_method_def): Rename to objc_finish_method_definition() and add a function decl parameter; move method encoding call from objc_expand_function_end(). (is_complex_decl, adorn_decl, gen_declarator, gen_declspecs, gen_declaration_1): Remove functions. (tmpbuf, RAW_DECLSPEC): Remove. (gen_declaration): Remove second parameter; simplify to deal with TYPE_P nodes instead of raw declspecs. (gen_type_name, gen_type_name_0): New functions. (gen_method_decl): Remove second parameter; call gen_type_name() instead of gen_declaration_1(). (dump_interface): Adjust calls to gen_declaration() and gen_method_decl(); do not allocate a separate string buffer. (init_objc): Allocate a larger string buffer to accommodate dump_interface(); adjust call to build_module_descriptor(); add call to build_module_initializer_routine() for the GNU runtime. (generate_classref_translation_entry): Do not call start_decl(); call finish_var_decl() instead of finish_decl(); call convert() instead of build_c_cast(). * objc-act.h (CLASS_OWN_IVARS): Remove accessor. (CLASS_BINFO_ELTS): Reduce from 6 to 5, now that CLASS_OWN_IVARS is gone. (OCTI_GNU_INIT_DECL, GNU_INIT_decl): New. (OCTI_ELLIPSIS_NODE, objc_ellipsis_node): Remove. (OCTI_ID_ID, id_type, objc_id_id): Rename to OCTI_ID_NAME, objc_object_type and objc_object_name, respectively. (OCTI_CLS_REF, OCTI_CLASS_NAME, objc_class_reference, objc_class_name): New. (IS_CLASS): New macro. (IS_ID, IS_SUPER): Robustify. (OCTI_EXECCLASS_DECL, execclass_decl): New. (finish_file, start_class, continue_class, finish_class, start_method_def, continue_method_def, finish_method_def, start_protocol, finish_protocol, objc_build_throw_stmt, objc_build_try_catch_finally_stmt, objc_build_synchronized_prologue, objc_build_synchronized_epilogue, objc_build_try_prologue, objc_build_try_epilogue, objc_build_catch_stmt, objc_build_catch_epilogue, objc_build_finally_prologue, objc_build_finally_epilogue, is_ivar, is_private, is_public, add_instance_variable, objc_add_method, get_super_receiver, objc_clear_super_receiver, get_class_ivars_from_name, get_class_reference, get_static_reference, get_object_reference, build_message_expr, finish_message_expr, build_selector_expr, build_ivar_reference, build_keyword_decl, build_method_decl, build_protocol_expr, build_objc_string_object, objc_declare_alias, objc_declare_class, objc_declare_protocols, objc_comptypes, objc_check_decl, build_encode_expr): Remove prototypes. (imp_count, cat_count): Make GGC-aware. (OBJC_SET_TYPE_NAME): New macro. From-SVN: r87168
2004-09-08 02:49:44 +02:00
/* Suppress unused warnings. */
TREE_USED (self_decl) = 1;
TREE_USED (TREE_CHAIN (self_decl)) = 1;
Makefile.in (c-parse.o): Depend on $(C_COMMON_H). [gcc/ChangeLog] 2004-09-07 Ziemowit Laski <zlaski@apple.com> * Makefile.in (c-parse.o): Depend on $(C_COMMON_H). * c-parse.in: Include c-common.h instead of objc-act.h. (ivar_decl_list, ivar_decls, ivar_decl, ivars, ivar_declarator, myparms, myparm): Remove %type declarations. (methodtype, optparms, OBJC_TYPE_QUAL, objc_quals, objc_qual, objc_typename, objc_try_catch_stmt, optellipsis): Add %type declarations. (objc_inherit_code, objc_public_flag): Remove. (typespec_nonreserved_nonattr): Call objc_get_protocol_qualified_type() instead of get_static_reference() and get_protocol_reference(). (stmt_nocomp): Call grokparm() on @catch parameter. (objcdef): Move semantic action to objc_finish_implementation(). (classdef): Move semantic action to objc_start_class_interface(), objc_continue_interface(), objc_finish_interface(), objc_start_class_implementation(), objc_continue_implementation(), objc_start_category_interface() and objc_start_category_implementation(). (protocoldef): Move semantic actions to objc_start_protocol() and objc_finish_interface(). (ivar_decl_list): Remove nonterminal. (visibility_spec): Move semantic actions to objc_set_visibility(). (ivar_decls): Remove assignment to $$. (ivar_decl): Rephrase in terms of component_decl; call objc_add_instance_variable(). (ivars, ivar_declarator): Remove nonterminals. (opt_semi): New nonterminal. (methodtype): Remove semantic actions. (methoddef): Move semantic actions to objc_set_method_type(), objc_start_method_definition() and objc_finish_method_definition(). (methodproto): Move semantic actions to objc_set_method_type() and objc_add_method_declaration(). (methoddecl): Use objc_typename instead of typename; move semantic actions to objc_build_method_signature(). (optarglist, myxdecls, mydecl, myparms, myparm): Remove nonterminals. (optparmlist): Express in terms of optparms and optellipsis. (optparms, optellipsis, objc_qual, objc_quals, objc_typename): New nonterminals. (keyworddecl): Use objc_typename instead of typename. (rid_to_yy): Mark RID_IN, RID_OUT, RID_INOUT, RID_BYCOPY, RID_BYREF and RID_ONEWAY as returning OBJC_TYPE_QUAL to yyparse(). [gcc/objc/ChangeLog] 2004-09-07 Ziemowit Laski <zlaski@apple.com> * Make-lang.in (objc/objc-parse.o): Depend on $(C_COMMON_H) instead of objc/objc-act.h. (objc/objc-act.o): Depend on $(HASHTAB_H). * objc-act.c: Include hashtab.h; in ObjC++ mode, include cp-tree.h and objcp-decl.h instead of c-tree.h. (build_module_descriptor, get_class_ivars, synth_id_with_class_suffix, error_with_ivar, gen_method_decl, gen_declaration, setup_string_decl, build_protocol_template): Adjust prototypes. (build_module_initializer_routine, start_class, continue_class, finish_class, start_method_def, objc_start_function, start_protocol, build_method_decl, objc_add_method, add_instance_variable, build_ivar_reference, is_ivar, is_private, get_super_receiver, build_selector_table_decl, objc_push_parm, objc_get_parm_info, gen_type_name, gen_type_name_0, start_var_decl, finish_var_decl, create_field_decl): New prototypes. (objc_expand_function_end, comp_method_with_proto, objc_expr_last, gen_declaration_1, gen_declarator, is_complex_decl, adorn_decl, define_decl, create_builtin_decl, gen_declspecs): Remove prototypes. (TYPE_ID): Rename to OBJECT_TYPEDEF_NAME. (CLASS_TYPEDEF_NAME): New. (TAG_EXECCLASS): Change from a global variable to a #define. (TAG_RETURN_STRUCT): Delete. (TAG_GNUINIT): New, holds '__objc_gnu_init' name. (objc_inherit_code, objc_public_flag): New, moved from c-parse.in. (string_descriptor): New struct. (string_htab): New hash table. (string_hash, string_eq): New prototypes. (generate_struct_by_value_array): Call create_field_decl() instead of create_builtin_decl(). (objc_init): Do not initialize objc_ellipsis_node or TAG_EXECCLASS; In ObjC++ mode, call cxx_init() instead of c_objc_common_init(). (objc_finish_file): In ObjC++, call instantiate_pending_templates() and cp_finish_file(). (define_decl, get_static_reference, get_protocol_reference, create_builtin_decl): Remove functions. (objc_start_class_interface, objc_start_category_interface, objc_start_protocol, objc_continue_interface, objc_finish_interface, objc_start_class_implementation, objc_start_category_implementation, objc_continue_implementation, objc_finish_implementation, objc_set_visibility, objc_set_method_type, objc_build_method_signature, objc_add_method_declaration, objc_start_method_definition, objc_add_instance_variable, objc_get_protocol_qualified_type, create_field_decl, start_var_decl, finish_var_decl): New functions. (setup_string_decl): Simplify since it is only called once. (synth_module_prologue): Call build_class_template(); predefine 'id' and 'Class' as typedefs; rename 'temp_type' to 'type'; disable debug hooks for duration of function; fix GNU runtime messenger signatures to correspond to reality; forward-declare '__objc_exec_class' for the GNU runtime; call build_selector_table_decl(); in ObjC++ mode, generate 'extern "C" { ... }' wrappers around synthesized declarations; call build_protocol_template() and build_category_template(). (string_hash, string_eq): New functions. (objc_build_string_object): Check metaclass correctness only once; store string literals in hash table. (objc_build_constructor): Do not convert initializer elements; adjust for ObjC++ impedance mismatch. (build_objc_symtab_template): Call create_field_decl() instead of create_builtin_decl(). (init_objc_symtab): Add missing conversion to initializer element. (build_metadata_decl): Call start_var_decl() instead of define_decl(). (generate_objc_symtab_decl): Do not call build_category_template(); call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(). (build_module_descriptor): Call create_field_decl() instead of grokfield(); call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(); always mark module descriptor as used; move GNU runtime-specific functionality to build_module_initializer_routine(). (build_module_initializer_routine): New function, broken off of build_module_descriptor(). (objc_static_init_needed_p, objc_generate_static_init_call): New functions. (generate_static_references, generate_strings, build_selector_translation_table, generate_descriptor_table, generate_ivars_list, generate_dispatch_table, generate_category): Call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(); build a type directly instead of via groktypename(). (build_selector_reference_decl, build_selector_table_decl, build_class_reference_decl, build_protocol_reference, generate_objc_image_info): Call start_var_decl() instead of build_decl(). (build_selector_reference): For GNU runtime, do not call build_selector_reference_decl(). (build_selector, build_typed_selector_reference): Always convert result to the selector type. (add_objc_string): Cast return value to 'char *'. (build_method_prototype_template, build_selector_template, build_method_template): Use actual selector type for fields pointing to selectors. (finish_objc): For GNU runtime, call build_module_initializer_routine() after build_module_descriptor(). (generate_protocol_list, generate_shared_structures): Call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(); build a type directly instead of via groktypename(). (synth_id_with_class_suffix): Return a string. (get_arg_type_list): For instance methods, use the instance type for 'self'; do not call groktypename_in_parm_context(). (build_objc_string_decl): Squash redeclaration errors in ObjC++. (objc_is_class_name): Use OBJC_TYPE_NAME instead of TYPE_NAME; handle RECORD_TYPEs in ObjC as well as ObjC++. (objc_is_id): New function. (objc_is_object_ptr): Return the canonical type node. (objc_get_class_ivars): Simplify using get_class_ivars(). (get_class_ivars): Remove second parameter; create a fresh copy of the ivar list for each call; do not check for existence of super class. (objc_eh_runtime_type): Mark #ifndef OBJCPLUS. (objc_init_exceptions): When using SJLJ-style exceptions, require the use of '-fobjc-exceptions' flag; do not require it for DWARF-style exceptions. (objc_build_exc_ptr, next_sjlj_build_try_catch_finally): Use objc_object_type instead of objc_id_type. (objc_begin_catch_clause): Convert the incoming PARM_DECL into a VAR_DECL before placing it in the appropriate scope; do not call define_decl(); adjust call to c_begin_compound_stmt(); use objc_object_type instead of objc_id_type. (build_next_objc_exception_stuff): Call create_field_decl() instead of create_builtin_decl(); construct type directly instead of calling groktypename(); use OBJC_VOID_AT_END to mark end of function parameters. (build_private_template): Adjust call to get_class_ivars(); build a type directly instead of via groktypename(). (build_protocol_template, build_method_prototype_list_template, build_method_prototype_template, build_category_template, build_selector_template, build_class_template, build_super_template, build_ivar_template, build_ivar_list_template, build_method_list_template, build_method_template): Call create_field_decl() instead of grokfield(). (objc_method_parm_type): Do not call groktypename(). (generate_descriptor_table): Call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(). (generate_method_descriptors, build_protocol_initializer, generate_dispatch_tables, build_category_initializer, build_shared_structure_initializer): Do not call groktypename(). (generate_protocols): Call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(); do not call groktypename(). (error_with_ivar): Remove last parameter. (check_ivars): Do not iterate ovar CLASS_RAW_IVARS lists in addition to CLASS_IVARS lists; adjust calls to error_with_ivar(). (generate_ivar_lists): Convert one of the initializer elements; do not call groktypename(). (get_arg_type_list, start_method_def, gen_method_def): Account for new representation of variable arguments and '...' in Objective-C methods; add Objective-C++ impedance matching code. (is_objc_type_qualifier): Remove function. (adjust_type_for_id_default): Simplify; there is no longer a need to wade through declspecs. (lookup_interface, start_class, continue_class, finish_class, start_method_def, start_protocol, build_method_decl, objc_add_method, add_instance_variable, build_ivar_reference, is_ivar, is_private, get_super_receiver, objc_build_finally_epilogue): Make into static functions. (receiver_is_class_object): Use new IS_CLASS() macro. (objc_build_message_expr): Tweak ObjC++ message argument handling; call objc_finish_message_expr() instead of finish_message_expr(). (finish_message_expr): Rename to objc_finish_message_expr(); use OBJC_TYPE_NAME and OBJC_SET_TYPE_NAME macros instead of TYPE_NAME. call gen_type_name() instead of gen_declaration(); call objc_is_id() instead of using IS_ID and IS_CLASS; Use objc_class_name instead of calling get_identifier("Class"); handle CONVERT_EXPRs in receiver. (build_objc_method_call, warn_with_method): Do not call groktypename(). (build_ivar_reference): Call convert() instead of clobbering in a type. (hash_init): Initialize string_htab hash table. (add_instance_variable): Simplify parameter list; do not call grokfield(); do not populate CLASS_IVARS list. (start_class): Check for the existence of super class, if one was specified. (continue_class): Use CLASS_RAW_IVARS rather than CLASS_IVARS; do not call build_class_template(); adjust call to get_class_ivars(); call build_decl(), pushdecl() and finish_decl() instead of define_decl(). (finish_class): Call build_decl(), pushdecl() and finish_decl() instead of define_decl(). (add_protocols): Use PROTOCOL_BINFO_ELTS for the tree vector size. (start_protocol): Do not call build_protocol_template(); use PROTOCOL_BINFO_ELTS for the tree vector size. (encode_type_qualifiers): Do not handle the 'const' qualifier here. (encode_pointer): Encode 'const char *' as 'r*', for backwards compatibility. (encode_array): Use HOST_WIDE_INT_PRINT_DEC instead of "%ld". (encode_type): Handle the 'const' qualifier here. (objc_parmlist): New global variable, sued by objc_push_parm and objc_get_parm_info(). (objc_push_parm, objc_get_parm_info): New functions. (objc_expr_last): Remove function. (synth_self_and_ucmd_args): For instance methods, use the instance type for 'self'; call objc_push_parm() instead of push_parm_decl(). (start_method_def): Do not call push_scope(), declare_parm_level(), pop_scope(), push_parm_decl(), store_parm_decls() or objc_expr_last(); just use objc_push_parm() and objc_get_parm_info(). (comp_method_with_proto): Remove function. (objc_types_are_equivalent): Strip away indirections before comparing underlying types. (comp_proto_with_proto): Do not call groktypename(); types are no longer in raw declspec format. (objc_start_function): New function. (really_start_method): Call comp_proto_with_proto() instead of comp_method_with_proto(); call objc_start_function() instead of hand-crafting a function declarator. (continue_method_def, objc_expand_function_end): Remove functions. (get_super_receiver): Call objc_get_current_scope() instead of get_current_scope(); reference 'super_class' field (instead of 'class'). (finish_method_def): Rename to objc_finish_method_definition() and add a function decl parameter; move method encoding call from objc_expand_function_end(). (is_complex_decl, adorn_decl, gen_declarator, gen_declspecs, gen_declaration_1): Remove functions. (tmpbuf, RAW_DECLSPEC): Remove. (gen_declaration): Remove second parameter; simplify to deal with TYPE_P nodes instead of raw declspecs. (gen_type_name, gen_type_name_0): New functions. (gen_method_decl): Remove second parameter; call gen_type_name() instead of gen_declaration_1(). (dump_interface): Adjust calls to gen_declaration() and gen_method_decl(); do not allocate a separate string buffer. (init_objc): Allocate a larger string buffer to accommodate dump_interface(); adjust call to build_module_descriptor(); add call to build_module_initializer_routine() for the GNU runtime. (generate_classref_translation_entry): Do not call start_decl(); call finish_var_decl() instead of finish_decl(); call convert() instead of build_c_cast(). * objc-act.h (CLASS_OWN_IVARS): Remove accessor. (CLASS_BINFO_ELTS): Reduce from 6 to 5, now that CLASS_OWN_IVARS is gone. (OCTI_GNU_INIT_DECL, GNU_INIT_decl): New. (OCTI_ELLIPSIS_NODE, objc_ellipsis_node): Remove. (OCTI_ID_ID, id_type, objc_id_id): Rename to OCTI_ID_NAME, objc_object_type and objc_object_name, respectively. (OCTI_CLS_REF, OCTI_CLASS_NAME, objc_class_reference, objc_class_name): New. (IS_CLASS): New macro. (IS_ID, IS_SUPER): Robustify. (OCTI_EXECCLASS_DECL, execclass_decl): New. (finish_file, start_class, continue_class, finish_class, start_method_def, continue_method_def, finish_method_def, start_protocol, finish_protocol, objc_build_throw_stmt, objc_build_try_catch_finally_stmt, objc_build_synchronized_prologue, objc_build_synchronized_epilogue, objc_build_try_prologue, objc_build_try_epilogue, objc_build_catch_stmt, objc_build_catch_epilogue, objc_build_finally_prologue, objc_build_finally_epilogue, is_ivar, is_private, is_public, add_instance_variable, objc_add_method, get_super_receiver, objc_clear_super_receiver, get_class_ivars_from_name, get_class_reference, get_static_reference, get_object_reference, build_message_expr, finish_message_expr, build_selector_expr, build_ivar_reference, build_keyword_decl, build_method_decl, build_protocol_expr, build_objc_string_object, objc_declare_alias, objc_declare_class, objc_declare_protocols, objc_comptypes, objc_check_decl, build_encode_expr): Remove prototypes. (imp_count, cat_count): Make GGC-aware. (OBJC_SET_TYPE_NAME): New macro. From-SVN: r87168
2004-09-08 02:49:44 +02:00
#ifdef OBJCPLUS
pop_lang_context ();
#endif
1992-01-18 00:15:38 +01:00
METHOD_DEFINITION (method) = current_function_decl;
/* Check consistency...start_function, pushdecl, duplicate_decls. */
c-parse.in (objc_inherit_code, [...]): Make static. 2001-10-03 Ziemowit Laski <zlaski@apple.com> * c-parse.in (objc_inherit_code, objc_pq_context, objc_public_flag): Make static. (objc_interface_context, objc_implementation_context, objc_method_context, objc_ivar_chain, objc_ivar_context): Move to global tree array in objc/objc-act.[ch]. (methoddef): Remove unnecessary code. * objc/objc-act.c: (hashed_attribute, hashed_entry, imp_entry): Hoist struct definitions to objc-act.h. (nst_method_hash_list, cls_method_hash_list, imp_list, imp_count, cat_count): Place declaration in objc-act.h. (objc_tree_index): Move enumeration to objc-act.h. (objc_global_trees): Place declaration and macro accessors in objc-act.h. (implementation_context): Remove duplicate; use objc_implementation_context instead: (method_context): Remove duplicate; use objc_method_context instead. (objc_ellipsis_node, objc_method_prototype_template, implemented_classes, function_type): Move global vars to objc_global_trees. (init_objc): Use LAST_BASE_TREE_CODE instead of LAST_CODE. (build_message_expr): Move actual construction of ObjC message send nodes to finish_message_expr. (finish_message_expr): New routine, contains code formerly in build_message_expr. * objc/objc-act.h (finish_message_expr): New prototype. (objc_ivar_chain, objc_method_context, objc_ellipsis_node): Remove declarations; these vars are now part of objc_global_trees. (objc_tree_index, objc_global_trees): Move definitions from objc-act.c. * objc/objc-tree.def: Update copyright info. From-SVN: r46000
2001-10-04 00:05:57 +02:00
if (implementation_template != objc_implementation_context)
1992-01-18 00:15:38 +01:00
{
tree proto
= lookup_method_static (implementation_template,
METHOD_SEL_NAME (method),
Yet more Objective-C++... * objc-act.c (objc_finish_try_stmt): Add return value. (objc_build_synchronized): Likewise. * objc-act.c (objc_is_gcable_type): Add. (objc_substitute_decl): Add. (objc_build_ivar_assignment): Add. (objc_build_global_assignment): Add. (objc_build_strong_cast_assignment): Add. (objc_is_ivar_reference_p): Add. (objc_is_global_reference_p): Add. (objc_generate_write_barrier): Add. (objc_rewrite_function_call): Add. (objc_gimplify_expr): Add Objective-C++ support. * objc-act.h (ALLOC_OBJC_TYPE_LANG_SPECIFIC): Likewise. (SIZEOF_OBJC_TYPE_LANG_SPECIFIC): Add. (INIT_TYPE_OBJC_INFO): Add Objective-C++ support. (DUP_TYPE_OBJC_INFO): Likewise. (struct imp_entry): Add field has_cxx_cdtors. (struct imp_entry *imp_list): Add OCTI_UMSG_FAST_DECL, OCTI_METH_LIST_TEMPL, OCTI_METH_PROTO_LIST_TEMPL, OCTI_IVAR_LIST_TEMPL, OCTI_ASSIGN_IVAR_DECL, OCTI_ASSIGN_IVAR_FAST_DECL, OCTI_ASSIGN_GLOBAL_DECL, OCTI_ASSIGN_STRONGCAST_DECL. (umsg_fast_decl): Add. (objc_assign_ivar_decl): Add. (objc_assign_ivar_fast_decl): Add. (objc_assign_global_decl): Add. (objc_assign_strong_cast_decl): Add. (objc_method_list_ptr): Add. (objc_method_proto_list_ptr): Add. (objc_ivar_list_ptr): Add. * objc-act.c (should_call_super_dealloc): Add. (OBJC_VERSION): Bump to 6. (objc_is_gcable_type): Add. (objc_substitute_decl): Add. (objc_build_ivar_assignment): Add. (objc_build_global_assignment): Add. (objc_build_strong_cast_assignment): Add. (objc_is_gcable_p): Add. (objc_is_ivar_reference_p): Add. (objc_is_global_reference_p): Add. (generate_shared_structures): Add flags parameter. (objc_generate_cxx_ctor_or_dtor): Add. (objc_generate_cxx_cdtors): Add. (add_class): Add name parameter. (objc_types_share_size_and_alignment): Add. (comp_proto_with_proto): Add strict parameter. (CLS_HAS_CXX_STRUCTORS): Add. (TAG_ASSIGNIVAR): Add. (TAG_ASSIGNGLOBAL): Add. (TAG_ASSIGNSTRONGCAST): Add. (TAG_MSGSEND_FAST): Add. (TAG_ASSIGNIVAR_FAST): Add. (TAG_CXX_CONSTRUCT): Add. (TAG_CXX_DESTRUCT): Add. (OBJC_LOOKUP_CLASS): Add. (OBJC_LOOKUP_NO_SUPER): Add. (objc_finish_file): Add pch support. (objc_finish_implementation): Add Objective-C++ support. (synth_module_prologue): Likewise. (synth_module_prologue): Add fast dispatching. (objc_get_class_reference): Add Objective-C++ support. (objc_generate_write_barrier): Likewise. (next_sjlj_build_enter_and_setjmp): Likewise. (objc_begin_try_stmt): Likewise. (build_next_objc_exception_stuff): Add fast ivar support. (build_private_template): Mark the record as used so debug information is generated. (build_protocol_template): Add Objective-C++ support. (objc_method_parm_type) Likewise. (objc_generate_cxx_ctor_or_dtor): Likewise. (objc_generate_cxx_cdtors): Likewise. (build_protocol_initializer): Likewise. (build_category_template): Likewise. (build_class_template): Likewise. (build_method_list_template): Likewise. (build_category_initializer): Likewise. (build_shared_structure_initializer): Likewise. (objc_finish_message_expr): Likewise. (build_objc_method_call): Add fast dispatch support. (lookup_method_static): Add support to end search at superclasses. (add_method_to_hash_list): Add strict parameter to comp_proto_with_proto. (objc_add_method): Likewise. (objc_add_method): Also set the interface_value. (add_instance_variable): Add Objective-C++ support. (objc_is_public): Likewise. (start_class): Likewise. (continue_class): Likewise. (encode_aggregate_within): Likewise. (start_method_def): Likewise. (objc_start_function): Clear current_function_returns_value and current_function_returns_null. (really_start_method): Add Objective-C++ support. (objc_finish_method_definition): Add warning for missing [super dealloc]. (finish_objc): Add Objective-C++ support. (generate_objc_image_info): Likewise. (objc_lookup_ivar): Likewise. * objc-act.h (TYPE_HAS_OBJC_INFO): Likewise. (INIT_TYPE_OBJC_INFO): Likewise. (DUP_TYPE_OBJC_INFO): Likewise. From-SVN: r99857
2005-05-17 22:07:08 +02:00
((TREE_CODE (method) == CLASS_METHOD_DECL)
| OBJC_LOOKUP_NO_SUPER));
1992-01-18 00:15:38 +01:00
if (proto)
1992-01-18 00:15:38 +01:00
{
Yet more Objective-C++... * objc-act.c (objc_finish_try_stmt): Add return value. (objc_build_synchronized): Likewise. * objc-act.c (objc_is_gcable_type): Add. (objc_substitute_decl): Add. (objc_build_ivar_assignment): Add. (objc_build_global_assignment): Add. (objc_build_strong_cast_assignment): Add. (objc_is_ivar_reference_p): Add. (objc_is_global_reference_p): Add. (objc_generate_write_barrier): Add. (objc_rewrite_function_call): Add. (objc_gimplify_expr): Add Objective-C++ support. * objc-act.h (ALLOC_OBJC_TYPE_LANG_SPECIFIC): Likewise. (SIZEOF_OBJC_TYPE_LANG_SPECIFIC): Add. (INIT_TYPE_OBJC_INFO): Add Objective-C++ support. (DUP_TYPE_OBJC_INFO): Likewise. (struct imp_entry): Add field has_cxx_cdtors. (struct imp_entry *imp_list): Add OCTI_UMSG_FAST_DECL, OCTI_METH_LIST_TEMPL, OCTI_METH_PROTO_LIST_TEMPL, OCTI_IVAR_LIST_TEMPL, OCTI_ASSIGN_IVAR_DECL, OCTI_ASSIGN_IVAR_FAST_DECL, OCTI_ASSIGN_GLOBAL_DECL, OCTI_ASSIGN_STRONGCAST_DECL. (umsg_fast_decl): Add. (objc_assign_ivar_decl): Add. (objc_assign_ivar_fast_decl): Add. (objc_assign_global_decl): Add. (objc_assign_strong_cast_decl): Add. (objc_method_list_ptr): Add. (objc_method_proto_list_ptr): Add. (objc_ivar_list_ptr): Add. * objc-act.c (should_call_super_dealloc): Add. (OBJC_VERSION): Bump to 6. (objc_is_gcable_type): Add. (objc_substitute_decl): Add. (objc_build_ivar_assignment): Add. (objc_build_global_assignment): Add. (objc_build_strong_cast_assignment): Add. (objc_is_gcable_p): Add. (objc_is_ivar_reference_p): Add. (objc_is_global_reference_p): Add. (generate_shared_structures): Add flags parameter. (objc_generate_cxx_ctor_or_dtor): Add. (objc_generate_cxx_cdtors): Add. (add_class): Add name parameter. (objc_types_share_size_and_alignment): Add. (comp_proto_with_proto): Add strict parameter. (CLS_HAS_CXX_STRUCTORS): Add. (TAG_ASSIGNIVAR): Add. (TAG_ASSIGNGLOBAL): Add. (TAG_ASSIGNSTRONGCAST): Add. (TAG_MSGSEND_FAST): Add. (TAG_ASSIGNIVAR_FAST): Add. (TAG_CXX_CONSTRUCT): Add. (TAG_CXX_DESTRUCT): Add. (OBJC_LOOKUP_CLASS): Add. (OBJC_LOOKUP_NO_SUPER): Add. (objc_finish_file): Add pch support. (objc_finish_implementation): Add Objective-C++ support. (synth_module_prologue): Likewise. (synth_module_prologue): Add fast dispatching. (objc_get_class_reference): Add Objective-C++ support. (objc_generate_write_barrier): Likewise. (next_sjlj_build_enter_and_setjmp): Likewise. (objc_begin_try_stmt): Likewise. (build_next_objc_exception_stuff): Add fast ivar support. (build_private_template): Mark the record as used so debug information is generated. (build_protocol_template): Add Objective-C++ support. (objc_method_parm_type) Likewise. (objc_generate_cxx_ctor_or_dtor): Likewise. (objc_generate_cxx_cdtors): Likewise. (build_protocol_initializer): Likewise. (build_category_template): Likewise. (build_class_template): Likewise. (build_method_list_template): Likewise. (build_category_initializer): Likewise. (build_shared_structure_initializer): Likewise. (objc_finish_message_expr): Likewise. (build_objc_method_call): Add fast dispatch support. (lookup_method_static): Add support to end search at superclasses. (add_method_to_hash_list): Add strict parameter to comp_proto_with_proto. (objc_add_method): Likewise. (objc_add_method): Also set the interface_value. (add_instance_variable): Add Objective-C++ support. (objc_is_public): Likewise. (start_class): Likewise. (continue_class): Likewise. (encode_aggregate_within): Likewise. (start_method_def): Likewise. (objc_start_function): Clear current_function_returns_value and current_function_returns_null. (really_start_method): Add Objective-C++ support. (objc_finish_method_definition): Add warning for missing [super dealloc]. (finish_objc): Add Objective-C++ support. (generate_objc_image_info): Likewise. (objc_lookup_ivar): Likewise. * objc-act.h (TYPE_HAS_OBJC_INFO): Likewise. (INIT_TYPE_OBJC_INFO): Likewise. (DUP_TYPE_OBJC_INFO): Likewise. From-SVN: r99857
2005-05-17 22:07:08 +02:00
if (!comp_proto_with_proto (method, proto, 1))
{
char type = (TREE_CODE (method) == INSTANCE_METHOD_DECL ? '-' : '+');
warn_with_method ("conflicting types for", type, method);
warn_with_method ("previous declaration of", type, proto);
}
}
else
{
/* We have a method @implementation even though we did not
see a corresponding @interface declaration (which is allowed
by Objective-C rules). Go ahead and place the method in
the @interface anyway, so that message dispatch lookups
will see it. */
tree interface = implementation_template;
if (TREE_CODE (objc_implementation_context)
== CATEGORY_IMPLEMENTATION_TYPE)
interface = lookup_category
(interface,
CLASS_SUPER_NAME (objc_implementation_context));
if (interface)
objc_add_method (interface, copy_node (method),
TREE_CODE (method) == CLASS_METHOD_DECL);
1992-01-18 00:15:38 +01:00
}
}
}
static void *UOBJC_SUPER_scope = 0;
1992-01-18 00:15:38 +01:00
/* _n_Method (id self, SEL sel, ...)
{
struct objc_super _S;
_msgSuper ((_S.self = self, _S.class = _cls, &_S), ...);
} */
Makefile.in (c-parse.o): Depend on $(C_COMMON_H). [gcc/ChangeLog] 2004-09-07 Ziemowit Laski <zlaski@apple.com> * Makefile.in (c-parse.o): Depend on $(C_COMMON_H). * c-parse.in: Include c-common.h instead of objc-act.h. (ivar_decl_list, ivar_decls, ivar_decl, ivars, ivar_declarator, myparms, myparm): Remove %type declarations. (methodtype, optparms, OBJC_TYPE_QUAL, objc_quals, objc_qual, objc_typename, objc_try_catch_stmt, optellipsis): Add %type declarations. (objc_inherit_code, objc_public_flag): Remove. (typespec_nonreserved_nonattr): Call objc_get_protocol_qualified_type() instead of get_static_reference() and get_protocol_reference(). (stmt_nocomp): Call grokparm() on @catch parameter. (objcdef): Move semantic action to objc_finish_implementation(). (classdef): Move semantic action to objc_start_class_interface(), objc_continue_interface(), objc_finish_interface(), objc_start_class_implementation(), objc_continue_implementation(), objc_start_category_interface() and objc_start_category_implementation(). (protocoldef): Move semantic actions to objc_start_protocol() and objc_finish_interface(). (ivar_decl_list): Remove nonterminal. (visibility_spec): Move semantic actions to objc_set_visibility(). (ivar_decls): Remove assignment to $$. (ivar_decl): Rephrase in terms of component_decl; call objc_add_instance_variable(). (ivars, ivar_declarator): Remove nonterminals. (opt_semi): New nonterminal. (methodtype): Remove semantic actions. (methoddef): Move semantic actions to objc_set_method_type(), objc_start_method_definition() and objc_finish_method_definition(). (methodproto): Move semantic actions to objc_set_method_type() and objc_add_method_declaration(). (methoddecl): Use objc_typename instead of typename; move semantic actions to objc_build_method_signature(). (optarglist, myxdecls, mydecl, myparms, myparm): Remove nonterminals. (optparmlist): Express in terms of optparms and optellipsis. (optparms, optellipsis, objc_qual, objc_quals, objc_typename): New nonterminals. (keyworddecl): Use objc_typename instead of typename. (rid_to_yy): Mark RID_IN, RID_OUT, RID_INOUT, RID_BYCOPY, RID_BYREF and RID_ONEWAY as returning OBJC_TYPE_QUAL to yyparse(). [gcc/objc/ChangeLog] 2004-09-07 Ziemowit Laski <zlaski@apple.com> * Make-lang.in (objc/objc-parse.o): Depend on $(C_COMMON_H) instead of objc/objc-act.h. (objc/objc-act.o): Depend on $(HASHTAB_H). * objc-act.c: Include hashtab.h; in ObjC++ mode, include cp-tree.h and objcp-decl.h instead of c-tree.h. (build_module_descriptor, get_class_ivars, synth_id_with_class_suffix, error_with_ivar, gen_method_decl, gen_declaration, setup_string_decl, build_protocol_template): Adjust prototypes. (build_module_initializer_routine, start_class, continue_class, finish_class, start_method_def, objc_start_function, start_protocol, build_method_decl, objc_add_method, add_instance_variable, build_ivar_reference, is_ivar, is_private, get_super_receiver, build_selector_table_decl, objc_push_parm, objc_get_parm_info, gen_type_name, gen_type_name_0, start_var_decl, finish_var_decl, create_field_decl): New prototypes. (objc_expand_function_end, comp_method_with_proto, objc_expr_last, gen_declaration_1, gen_declarator, is_complex_decl, adorn_decl, define_decl, create_builtin_decl, gen_declspecs): Remove prototypes. (TYPE_ID): Rename to OBJECT_TYPEDEF_NAME. (CLASS_TYPEDEF_NAME): New. (TAG_EXECCLASS): Change from a global variable to a #define. (TAG_RETURN_STRUCT): Delete. (TAG_GNUINIT): New, holds '__objc_gnu_init' name. (objc_inherit_code, objc_public_flag): New, moved from c-parse.in. (string_descriptor): New struct. (string_htab): New hash table. (string_hash, string_eq): New prototypes. (generate_struct_by_value_array): Call create_field_decl() instead of create_builtin_decl(). (objc_init): Do not initialize objc_ellipsis_node or TAG_EXECCLASS; In ObjC++ mode, call cxx_init() instead of c_objc_common_init(). (objc_finish_file): In ObjC++, call instantiate_pending_templates() and cp_finish_file(). (define_decl, get_static_reference, get_protocol_reference, create_builtin_decl): Remove functions. (objc_start_class_interface, objc_start_category_interface, objc_start_protocol, objc_continue_interface, objc_finish_interface, objc_start_class_implementation, objc_start_category_implementation, objc_continue_implementation, objc_finish_implementation, objc_set_visibility, objc_set_method_type, objc_build_method_signature, objc_add_method_declaration, objc_start_method_definition, objc_add_instance_variable, objc_get_protocol_qualified_type, create_field_decl, start_var_decl, finish_var_decl): New functions. (setup_string_decl): Simplify since it is only called once. (synth_module_prologue): Call build_class_template(); predefine 'id' and 'Class' as typedefs; rename 'temp_type' to 'type'; disable debug hooks for duration of function; fix GNU runtime messenger signatures to correspond to reality; forward-declare '__objc_exec_class' for the GNU runtime; call build_selector_table_decl(); in ObjC++ mode, generate 'extern "C" { ... }' wrappers around synthesized declarations; call build_protocol_template() and build_category_template(). (string_hash, string_eq): New functions. (objc_build_string_object): Check metaclass correctness only once; store string literals in hash table. (objc_build_constructor): Do not convert initializer elements; adjust for ObjC++ impedance mismatch. (build_objc_symtab_template): Call create_field_decl() instead of create_builtin_decl(). (init_objc_symtab): Add missing conversion to initializer element. (build_metadata_decl): Call start_var_decl() instead of define_decl(). (generate_objc_symtab_decl): Do not call build_category_template(); call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(). (build_module_descriptor): Call create_field_decl() instead of grokfield(); call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(); always mark module descriptor as used; move GNU runtime-specific functionality to build_module_initializer_routine(). (build_module_initializer_routine): New function, broken off of build_module_descriptor(). (objc_static_init_needed_p, objc_generate_static_init_call): New functions. (generate_static_references, generate_strings, build_selector_translation_table, generate_descriptor_table, generate_ivars_list, generate_dispatch_table, generate_category): Call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(); build a type directly instead of via groktypename(). (build_selector_reference_decl, build_selector_table_decl, build_class_reference_decl, build_protocol_reference, generate_objc_image_info): Call start_var_decl() instead of build_decl(). (build_selector_reference): For GNU runtime, do not call build_selector_reference_decl(). (build_selector, build_typed_selector_reference): Always convert result to the selector type. (add_objc_string): Cast return value to 'char *'. (build_method_prototype_template, build_selector_template, build_method_template): Use actual selector type for fields pointing to selectors. (finish_objc): For GNU runtime, call build_module_initializer_routine() after build_module_descriptor(). (generate_protocol_list, generate_shared_structures): Call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(); build a type directly instead of via groktypename(). (synth_id_with_class_suffix): Return a string. (get_arg_type_list): For instance methods, use the instance type for 'self'; do not call groktypename_in_parm_context(). (build_objc_string_decl): Squash redeclaration errors in ObjC++. (objc_is_class_name): Use OBJC_TYPE_NAME instead of TYPE_NAME; handle RECORD_TYPEs in ObjC as well as ObjC++. (objc_is_id): New function. (objc_is_object_ptr): Return the canonical type node. (objc_get_class_ivars): Simplify using get_class_ivars(). (get_class_ivars): Remove second parameter; create a fresh copy of the ivar list for each call; do not check for existence of super class. (objc_eh_runtime_type): Mark #ifndef OBJCPLUS. (objc_init_exceptions): When using SJLJ-style exceptions, require the use of '-fobjc-exceptions' flag; do not require it for DWARF-style exceptions. (objc_build_exc_ptr, next_sjlj_build_try_catch_finally): Use objc_object_type instead of objc_id_type. (objc_begin_catch_clause): Convert the incoming PARM_DECL into a VAR_DECL before placing it in the appropriate scope; do not call define_decl(); adjust call to c_begin_compound_stmt(); use objc_object_type instead of objc_id_type. (build_next_objc_exception_stuff): Call create_field_decl() instead of create_builtin_decl(); construct type directly instead of calling groktypename(); use OBJC_VOID_AT_END to mark end of function parameters. (build_private_template): Adjust call to get_class_ivars(); build a type directly instead of via groktypename(). (build_protocol_template, build_method_prototype_list_template, build_method_prototype_template, build_category_template, build_selector_template, build_class_template, build_super_template, build_ivar_template, build_ivar_list_template, build_method_list_template, build_method_template): Call create_field_decl() instead of grokfield(). (objc_method_parm_type): Do not call groktypename(). (generate_descriptor_table): Call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(). (generate_method_descriptors, build_protocol_initializer, generate_dispatch_tables, build_category_initializer, build_shared_structure_initializer): Do not call groktypename(). (generate_protocols): Call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(); do not call groktypename(). (error_with_ivar): Remove last parameter. (check_ivars): Do not iterate ovar CLASS_RAW_IVARS lists in addition to CLASS_IVARS lists; adjust calls to error_with_ivar(). (generate_ivar_lists): Convert one of the initializer elements; do not call groktypename(). (get_arg_type_list, start_method_def, gen_method_def): Account for new representation of variable arguments and '...' in Objective-C methods; add Objective-C++ impedance matching code. (is_objc_type_qualifier): Remove function. (adjust_type_for_id_default): Simplify; there is no longer a need to wade through declspecs. (lookup_interface, start_class, continue_class, finish_class, start_method_def, start_protocol, build_method_decl, objc_add_method, add_instance_variable, build_ivar_reference, is_ivar, is_private, get_super_receiver, objc_build_finally_epilogue): Make into static functions. (receiver_is_class_object): Use new IS_CLASS() macro. (objc_build_message_expr): Tweak ObjC++ message argument handling; call objc_finish_message_expr() instead of finish_message_expr(). (finish_message_expr): Rename to objc_finish_message_expr(); use OBJC_TYPE_NAME and OBJC_SET_TYPE_NAME macros instead of TYPE_NAME. call gen_type_name() instead of gen_declaration(); call objc_is_id() instead of using IS_ID and IS_CLASS; Use objc_class_name instead of calling get_identifier("Class"); handle CONVERT_EXPRs in receiver. (build_objc_method_call, warn_with_method): Do not call groktypename(). (build_ivar_reference): Call convert() instead of clobbering in a type. (hash_init): Initialize string_htab hash table. (add_instance_variable): Simplify parameter list; do not call grokfield(); do not populate CLASS_IVARS list. (start_class): Check for the existence of super class, if one was specified. (continue_class): Use CLASS_RAW_IVARS rather than CLASS_IVARS; do not call build_class_template(); adjust call to get_class_ivars(); call build_decl(), pushdecl() and finish_decl() instead of define_decl(). (finish_class): Call build_decl(), pushdecl() and finish_decl() instead of define_decl(). (add_protocols): Use PROTOCOL_BINFO_ELTS for the tree vector size. (start_protocol): Do not call build_protocol_template(); use PROTOCOL_BINFO_ELTS for the tree vector size. (encode_type_qualifiers): Do not handle the 'const' qualifier here. (encode_pointer): Encode 'const char *' as 'r*', for backwards compatibility. (encode_array): Use HOST_WIDE_INT_PRINT_DEC instead of "%ld". (encode_type): Handle the 'const' qualifier here. (objc_parmlist): New global variable, sued by objc_push_parm and objc_get_parm_info(). (objc_push_parm, objc_get_parm_info): New functions. (objc_expr_last): Remove function. (synth_self_and_ucmd_args): For instance methods, use the instance type for 'self'; call objc_push_parm() instead of push_parm_decl(). (start_method_def): Do not call push_scope(), declare_parm_level(), pop_scope(), push_parm_decl(), store_parm_decls() or objc_expr_last(); just use objc_push_parm() and objc_get_parm_info(). (comp_method_with_proto): Remove function. (objc_types_are_equivalent): Strip away indirections before comparing underlying types. (comp_proto_with_proto): Do not call groktypename(); types are no longer in raw declspec format. (objc_start_function): New function. (really_start_method): Call comp_proto_with_proto() instead of comp_method_with_proto(); call objc_start_function() instead of hand-crafting a function declarator. (continue_method_def, objc_expand_function_end): Remove functions. (get_super_receiver): Call objc_get_current_scope() instead of get_current_scope(); reference 'super_class' field (instead of 'class'). (finish_method_def): Rename to objc_finish_method_definition() and add a function decl parameter; move method encoding call from objc_expand_function_end(). (is_complex_decl, adorn_decl, gen_declarator, gen_declspecs, gen_declaration_1): Remove functions. (tmpbuf, RAW_DECLSPEC): Remove. (gen_declaration): Remove second parameter; simplify to deal with TYPE_P nodes instead of raw declspecs. (gen_type_name, gen_type_name_0): New functions. (gen_method_decl): Remove second parameter; call gen_type_name() instead of gen_declaration_1(). (dump_interface): Adjust calls to gen_declaration() and gen_method_decl(); do not allocate a separate string buffer. (init_objc): Allocate a larger string buffer to accommodate dump_interface(); adjust call to build_module_descriptor(); add call to build_module_initializer_routine() for the GNU runtime. (generate_classref_translation_entry): Do not call start_decl(); call finish_var_decl() instead of finish_decl(); call convert() instead of build_c_cast(). * objc-act.h (CLASS_OWN_IVARS): Remove accessor. (CLASS_BINFO_ELTS): Reduce from 6 to 5, now that CLASS_OWN_IVARS is gone. (OCTI_GNU_INIT_DECL, GNU_INIT_decl): New. (OCTI_ELLIPSIS_NODE, objc_ellipsis_node): Remove. (OCTI_ID_ID, id_type, objc_id_id): Rename to OCTI_ID_NAME, objc_object_type and objc_object_name, respectively. (OCTI_CLS_REF, OCTI_CLASS_NAME, objc_class_reference, objc_class_name): New. (IS_CLASS): New macro. (IS_ID, IS_SUPER): Robustify. (OCTI_EXECCLASS_DECL, execclass_decl): New. (finish_file, start_class, continue_class, finish_class, start_method_def, continue_method_def, finish_method_def, start_protocol, finish_protocol, objc_build_throw_stmt, objc_build_try_catch_finally_stmt, objc_build_synchronized_prologue, objc_build_synchronized_epilogue, objc_build_try_prologue, objc_build_try_epilogue, objc_build_catch_stmt, objc_build_catch_epilogue, objc_build_finally_prologue, objc_build_finally_epilogue, is_ivar, is_private, is_public, add_instance_variable, objc_add_method, get_super_receiver, objc_clear_super_receiver, get_class_ivars_from_name, get_class_reference, get_static_reference, get_object_reference, build_message_expr, finish_message_expr, build_selector_expr, build_ivar_reference, build_keyword_decl, build_method_decl, build_protocol_expr, build_objc_string_object, objc_declare_alias, objc_declare_class, objc_declare_protocols, objc_comptypes, objc_check_decl, build_encode_expr): Remove prototypes. (imp_count, cat_count): Make GGC-aware. (OBJC_SET_TYPE_NAME): New macro. From-SVN: r87168
2004-09-08 02:49:44 +02:00
static tree
get_super_receiver (void)
1992-01-18 00:15:38 +01:00
{
c-parse.in (objc_inherit_code, [...]): Make static. 2001-10-03 Ziemowit Laski <zlaski@apple.com> * c-parse.in (objc_inherit_code, objc_pq_context, objc_public_flag): Make static. (objc_interface_context, objc_implementation_context, objc_method_context, objc_ivar_chain, objc_ivar_context): Move to global tree array in objc/objc-act.[ch]. (methoddef): Remove unnecessary code. * objc/objc-act.c: (hashed_attribute, hashed_entry, imp_entry): Hoist struct definitions to objc-act.h. (nst_method_hash_list, cls_method_hash_list, imp_list, imp_count, cat_count): Place declaration in objc-act.h. (objc_tree_index): Move enumeration to objc-act.h. (objc_global_trees): Place declaration and macro accessors in objc-act.h. (implementation_context): Remove duplicate; use objc_implementation_context instead: (method_context): Remove duplicate; use objc_method_context instead. (objc_ellipsis_node, objc_method_prototype_template, implemented_classes, function_type): Move global vars to objc_global_trees. (init_objc): Use LAST_BASE_TREE_CODE instead of LAST_CODE. (build_message_expr): Move actual construction of ObjC message send nodes to finish_message_expr. (finish_message_expr): New routine, contains code formerly in build_message_expr. * objc/objc-act.h (finish_message_expr): New prototype. (objc_ivar_chain, objc_method_context, objc_ellipsis_node): Remove declarations; these vars are now part of objc_global_trees. (objc_tree_index, objc_global_trees): Move definitions from objc-act.c. * objc/objc-tree.def: Update copyright info. From-SVN: r46000
2001-10-04 00:05:57 +02:00
if (objc_method_context)
1992-01-18 00:15:38 +01:00
{
tree super_expr, super_expr_list;
if (!UOBJC_SUPER_decl)
{
Makefile.in (c-parse.o): Depend on $(C_COMMON_H). [gcc/ChangeLog] 2004-09-07 Ziemowit Laski <zlaski@apple.com> * Makefile.in (c-parse.o): Depend on $(C_COMMON_H). * c-parse.in: Include c-common.h instead of objc-act.h. (ivar_decl_list, ivar_decls, ivar_decl, ivars, ivar_declarator, myparms, myparm): Remove %type declarations. (methodtype, optparms, OBJC_TYPE_QUAL, objc_quals, objc_qual, objc_typename, objc_try_catch_stmt, optellipsis): Add %type declarations. (objc_inherit_code, objc_public_flag): Remove. (typespec_nonreserved_nonattr): Call objc_get_protocol_qualified_type() instead of get_static_reference() and get_protocol_reference(). (stmt_nocomp): Call grokparm() on @catch parameter. (objcdef): Move semantic action to objc_finish_implementation(). (classdef): Move semantic action to objc_start_class_interface(), objc_continue_interface(), objc_finish_interface(), objc_start_class_implementation(), objc_continue_implementation(), objc_start_category_interface() and objc_start_category_implementation(). (protocoldef): Move semantic actions to objc_start_protocol() and objc_finish_interface(). (ivar_decl_list): Remove nonterminal. (visibility_spec): Move semantic actions to objc_set_visibility(). (ivar_decls): Remove assignment to $$. (ivar_decl): Rephrase in terms of component_decl; call objc_add_instance_variable(). (ivars, ivar_declarator): Remove nonterminals. (opt_semi): New nonterminal. (methodtype): Remove semantic actions. (methoddef): Move semantic actions to objc_set_method_type(), objc_start_method_definition() and objc_finish_method_definition(). (methodproto): Move semantic actions to objc_set_method_type() and objc_add_method_declaration(). (methoddecl): Use objc_typename instead of typename; move semantic actions to objc_build_method_signature(). (optarglist, myxdecls, mydecl, myparms, myparm): Remove nonterminals. (optparmlist): Express in terms of optparms and optellipsis. (optparms, optellipsis, objc_qual, objc_quals, objc_typename): New nonterminals. (keyworddecl): Use objc_typename instead of typename. (rid_to_yy): Mark RID_IN, RID_OUT, RID_INOUT, RID_BYCOPY, RID_BYREF and RID_ONEWAY as returning OBJC_TYPE_QUAL to yyparse(). [gcc/objc/ChangeLog] 2004-09-07 Ziemowit Laski <zlaski@apple.com> * Make-lang.in (objc/objc-parse.o): Depend on $(C_COMMON_H) instead of objc/objc-act.h. (objc/objc-act.o): Depend on $(HASHTAB_H). * objc-act.c: Include hashtab.h; in ObjC++ mode, include cp-tree.h and objcp-decl.h instead of c-tree.h. (build_module_descriptor, get_class_ivars, synth_id_with_class_suffix, error_with_ivar, gen_method_decl, gen_declaration, setup_string_decl, build_protocol_template): Adjust prototypes. (build_module_initializer_routine, start_class, continue_class, finish_class, start_method_def, objc_start_function, start_protocol, build_method_decl, objc_add_method, add_instance_variable, build_ivar_reference, is_ivar, is_private, get_super_receiver, build_selector_table_decl, objc_push_parm, objc_get_parm_info, gen_type_name, gen_type_name_0, start_var_decl, finish_var_decl, create_field_decl): New prototypes. (objc_expand_function_end, comp_method_with_proto, objc_expr_last, gen_declaration_1, gen_declarator, is_complex_decl, adorn_decl, define_decl, create_builtin_decl, gen_declspecs): Remove prototypes. (TYPE_ID): Rename to OBJECT_TYPEDEF_NAME. (CLASS_TYPEDEF_NAME): New. (TAG_EXECCLASS): Change from a global variable to a #define. (TAG_RETURN_STRUCT): Delete. (TAG_GNUINIT): New, holds '__objc_gnu_init' name. (objc_inherit_code, objc_public_flag): New, moved from c-parse.in. (string_descriptor): New struct. (string_htab): New hash table. (string_hash, string_eq): New prototypes. (generate_struct_by_value_array): Call create_field_decl() instead of create_builtin_decl(). (objc_init): Do not initialize objc_ellipsis_node or TAG_EXECCLASS; In ObjC++ mode, call cxx_init() instead of c_objc_common_init(). (objc_finish_file): In ObjC++, call instantiate_pending_templates() and cp_finish_file(). (define_decl, get_static_reference, get_protocol_reference, create_builtin_decl): Remove functions. (objc_start_class_interface, objc_start_category_interface, objc_start_protocol, objc_continue_interface, objc_finish_interface, objc_start_class_implementation, objc_start_category_implementation, objc_continue_implementation, objc_finish_implementation, objc_set_visibility, objc_set_method_type, objc_build_method_signature, objc_add_method_declaration, objc_start_method_definition, objc_add_instance_variable, objc_get_protocol_qualified_type, create_field_decl, start_var_decl, finish_var_decl): New functions. (setup_string_decl): Simplify since it is only called once. (synth_module_prologue): Call build_class_template(); predefine 'id' and 'Class' as typedefs; rename 'temp_type' to 'type'; disable debug hooks for duration of function; fix GNU runtime messenger signatures to correspond to reality; forward-declare '__objc_exec_class' for the GNU runtime; call build_selector_table_decl(); in ObjC++ mode, generate 'extern "C" { ... }' wrappers around synthesized declarations; call build_protocol_template() and build_category_template(). (string_hash, string_eq): New functions. (objc_build_string_object): Check metaclass correctness only once; store string literals in hash table. (objc_build_constructor): Do not convert initializer elements; adjust for ObjC++ impedance mismatch. (build_objc_symtab_template): Call create_field_decl() instead of create_builtin_decl(). (init_objc_symtab): Add missing conversion to initializer element. (build_metadata_decl): Call start_var_decl() instead of define_decl(). (generate_objc_symtab_decl): Do not call build_category_template(); call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(). (build_module_descriptor): Call create_field_decl() instead of grokfield(); call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(); always mark module descriptor as used; move GNU runtime-specific functionality to build_module_initializer_routine(). (build_module_initializer_routine): New function, broken off of build_module_descriptor(). (objc_static_init_needed_p, objc_generate_static_init_call): New functions. (generate_static_references, generate_strings, build_selector_translation_table, generate_descriptor_table, generate_ivars_list, generate_dispatch_table, generate_category): Call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(); build a type directly instead of via groktypename(). (build_selector_reference_decl, build_selector_table_decl, build_class_reference_decl, build_protocol_reference, generate_objc_image_info): Call start_var_decl() instead of build_decl(). (build_selector_reference): For GNU runtime, do not call build_selector_reference_decl(). (build_selector, build_typed_selector_reference): Always convert result to the selector type. (add_objc_string): Cast return value to 'char *'. (build_method_prototype_template, build_selector_template, build_method_template): Use actual selector type for fields pointing to selectors. (finish_objc): For GNU runtime, call build_module_initializer_routine() after build_module_descriptor(). (generate_protocol_list, generate_shared_structures): Call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(); build a type directly instead of via groktypename(). (synth_id_with_class_suffix): Return a string. (get_arg_type_list): For instance methods, use the instance type for 'self'; do not call groktypename_in_parm_context(). (build_objc_string_decl): Squash redeclaration errors in ObjC++. (objc_is_class_name): Use OBJC_TYPE_NAME instead of TYPE_NAME; handle RECORD_TYPEs in ObjC as well as ObjC++. (objc_is_id): New function. (objc_is_object_ptr): Return the canonical type node. (objc_get_class_ivars): Simplify using get_class_ivars(). (get_class_ivars): Remove second parameter; create a fresh copy of the ivar list for each call; do not check for existence of super class. (objc_eh_runtime_type): Mark #ifndef OBJCPLUS. (objc_init_exceptions): When using SJLJ-style exceptions, require the use of '-fobjc-exceptions' flag; do not require it for DWARF-style exceptions. (objc_build_exc_ptr, next_sjlj_build_try_catch_finally): Use objc_object_type instead of objc_id_type. (objc_begin_catch_clause): Convert the incoming PARM_DECL into a VAR_DECL before placing it in the appropriate scope; do not call define_decl(); adjust call to c_begin_compound_stmt(); use objc_object_type instead of objc_id_type. (build_next_objc_exception_stuff): Call create_field_decl() instead of create_builtin_decl(); construct type directly instead of calling groktypename(); use OBJC_VOID_AT_END to mark end of function parameters. (build_private_template): Adjust call to get_class_ivars(); build a type directly instead of via groktypename(). (build_protocol_template, build_method_prototype_list_template, build_method_prototype_template, build_category_template, build_selector_template, build_class_template, build_super_template, build_ivar_template, build_ivar_list_template, build_method_list_template, build_method_template): Call create_field_decl() instead of grokfield(). (objc_method_parm_type): Do not call groktypename(). (generate_descriptor_table): Call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(). (generate_method_descriptors, build_protocol_initializer, generate_dispatch_tables, build_category_initializer, build_shared_structure_initializer): Do not call groktypename(). (generate_protocols): Call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(); do not call groktypename(). (error_with_ivar): Remove last parameter. (check_ivars): Do not iterate ovar CLASS_RAW_IVARS lists in addition to CLASS_IVARS lists; adjust calls to error_with_ivar(). (generate_ivar_lists): Convert one of the initializer elements; do not call groktypename(). (get_arg_type_list, start_method_def, gen_method_def): Account for new representation of variable arguments and '...' in Objective-C methods; add Objective-C++ impedance matching code. (is_objc_type_qualifier): Remove function. (adjust_type_for_id_default): Simplify; there is no longer a need to wade through declspecs. (lookup_interface, start_class, continue_class, finish_class, start_method_def, start_protocol, build_method_decl, objc_add_method, add_instance_variable, build_ivar_reference, is_ivar, is_private, get_super_receiver, objc_build_finally_epilogue): Make into static functions. (receiver_is_class_object): Use new IS_CLASS() macro. (objc_build_message_expr): Tweak ObjC++ message argument handling; call objc_finish_message_expr() instead of finish_message_expr(). (finish_message_expr): Rename to objc_finish_message_expr(); use OBJC_TYPE_NAME and OBJC_SET_TYPE_NAME macros instead of TYPE_NAME. call gen_type_name() instead of gen_declaration(); call objc_is_id() instead of using IS_ID and IS_CLASS; Use objc_class_name instead of calling get_identifier("Class"); handle CONVERT_EXPRs in receiver. (build_objc_method_call, warn_with_method): Do not call groktypename(). (build_ivar_reference): Call convert() instead of clobbering in a type. (hash_init): Initialize string_htab hash table. (add_instance_variable): Simplify parameter list; do not call grokfield(); do not populate CLASS_IVARS list. (start_class): Check for the existence of super class, if one was specified. (continue_class): Use CLASS_RAW_IVARS rather than CLASS_IVARS; do not call build_class_template(); adjust call to get_class_ivars(); call build_decl(), pushdecl() and finish_decl() instead of define_decl(). (finish_class): Call build_decl(), pushdecl() and finish_decl() instead of define_decl(). (add_protocols): Use PROTOCOL_BINFO_ELTS for the tree vector size. (start_protocol): Do not call build_protocol_template(); use PROTOCOL_BINFO_ELTS for the tree vector size. (encode_type_qualifiers): Do not handle the 'const' qualifier here. (encode_pointer): Encode 'const char *' as 'r*', for backwards compatibility. (encode_array): Use HOST_WIDE_INT_PRINT_DEC instead of "%ld". (encode_type): Handle the 'const' qualifier here. (objc_parmlist): New global variable, sued by objc_push_parm and objc_get_parm_info(). (objc_push_parm, objc_get_parm_info): New functions. (objc_expr_last): Remove function. (synth_self_and_ucmd_args): For instance methods, use the instance type for 'self'; call objc_push_parm() instead of push_parm_decl(). (start_method_def): Do not call push_scope(), declare_parm_level(), pop_scope(), push_parm_decl(), store_parm_decls() or objc_expr_last(); just use objc_push_parm() and objc_get_parm_info(). (comp_method_with_proto): Remove function. (objc_types_are_equivalent): Strip away indirections before comparing underlying types. (comp_proto_with_proto): Do not call groktypename(); types are no longer in raw declspec format. (objc_start_function): New function. (really_start_method): Call comp_proto_with_proto() instead of comp_method_with_proto(); call objc_start_function() instead of hand-crafting a function declarator. (continue_method_def, objc_expand_function_end): Remove functions. (get_super_receiver): Call objc_get_current_scope() instead of get_current_scope(); reference 'super_class' field (instead of 'class'). (finish_method_def): Rename to objc_finish_method_definition() and add a function decl parameter; move method encoding call from objc_expand_function_end(). (is_complex_decl, adorn_decl, gen_declarator, gen_declspecs, gen_declaration_1): Remove functions. (tmpbuf, RAW_DECLSPEC): Remove. (gen_declaration): Remove second parameter; simplify to deal with TYPE_P nodes instead of raw declspecs. (gen_type_name, gen_type_name_0): New functions. (gen_method_decl): Remove second parameter; call gen_type_name() instead of gen_declaration_1(). (dump_interface): Adjust calls to gen_declaration() and gen_method_decl(); do not allocate a separate string buffer. (init_objc): Allocate a larger string buffer to accommodate dump_interface(); adjust call to build_module_descriptor(); add call to build_module_initializer_routine() for the GNU runtime. (generate_classref_translation_entry): Do not call start_decl(); call finish_var_decl() instead of finish_decl(); call convert() instead of build_c_cast(). * objc-act.h (CLASS_OWN_IVARS): Remove accessor. (CLASS_BINFO_ELTS): Reduce from 6 to 5, now that CLASS_OWN_IVARS is gone. (OCTI_GNU_INIT_DECL, GNU_INIT_decl): New. (OCTI_ELLIPSIS_NODE, objc_ellipsis_node): Remove. (OCTI_ID_ID, id_type, objc_id_id): Rename to OCTI_ID_NAME, objc_object_type and objc_object_name, respectively. (OCTI_CLS_REF, OCTI_CLASS_NAME, objc_class_reference, objc_class_name): New. (IS_CLASS): New macro. (IS_ID, IS_SUPER): Robustify. (OCTI_EXECCLASS_DECL, execclass_decl): New. (finish_file, start_class, continue_class, finish_class, start_method_def, continue_method_def, finish_method_def, start_protocol, finish_protocol, objc_build_throw_stmt, objc_build_try_catch_finally_stmt, objc_build_synchronized_prologue, objc_build_synchronized_epilogue, objc_build_try_prologue, objc_build_try_epilogue, objc_build_catch_stmt, objc_build_catch_epilogue, objc_build_finally_prologue, objc_build_finally_epilogue, is_ivar, is_private, is_public, add_instance_variable, objc_add_method, get_super_receiver, objc_clear_super_receiver, get_class_ivars_from_name, get_class_reference, get_static_reference, get_object_reference, build_message_expr, finish_message_expr, build_selector_expr, build_ivar_reference, build_keyword_decl, build_method_decl, build_protocol_expr, build_objc_string_object, objc_declare_alias, objc_declare_class, objc_declare_protocols, objc_comptypes, objc_check_decl, build_encode_expr): Remove prototypes. (imp_count, cat_count): Make GGC-aware. (OBJC_SET_TYPE_NAME): New macro. From-SVN: r87168
2004-09-08 02:49:44 +02:00
UOBJC_SUPER_decl = build_decl (VAR_DECL, get_identifier (TAG_SUPER),
objc_super_template);
/* This prevents `unused variable' warnings when compiling with -Wall. */
TREE_USED (UOBJC_SUPER_decl) = 1;
Makefile.in (c-parse.o): Depend on $(C_COMMON_H). [gcc/ChangeLog] 2004-09-07 Ziemowit Laski <zlaski@apple.com> * Makefile.in (c-parse.o): Depend on $(C_COMMON_H). * c-parse.in: Include c-common.h instead of objc-act.h. (ivar_decl_list, ivar_decls, ivar_decl, ivars, ivar_declarator, myparms, myparm): Remove %type declarations. (methodtype, optparms, OBJC_TYPE_QUAL, objc_quals, objc_qual, objc_typename, objc_try_catch_stmt, optellipsis): Add %type declarations. (objc_inherit_code, objc_public_flag): Remove. (typespec_nonreserved_nonattr): Call objc_get_protocol_qualified_type() instead of get_static_reference() and get_protocol_reference(). (stmt_nocomp): Call grokparm() on @catch parameter. (objcdef): Move semantic action to objc_finish_implementation(). (classdef): Move semantic action to objc_start_class_interface(), objc_continue_interface(), objc_finish_interface(), objc_start_class_implementation(), objc_continue_implementation(), objc_start_category_interface() and objc_start_category_implementation(). (protocoldef): Move semantic actions to objc_start_protocol() and objc_finish_interface(). (ivar_decl_list): Remove nonterminal. (visibility_spec): Move semantic actions to objc_set_visibility(). (ivar_decls): Remove assignment to $$. (ivar_decl): Rephrase in terms of component_decl; call objc_add_instance_variable(). (ivars, ivar_declarator): Remove nonterminals. (opt_semi): New nonterminal. (methodtype): Remove semantic actions. (methoddef): Move semantic actions to objc_set_method_type(), objc_start_method_definition() and objc_finish_method_definition(). (methodproto): Move semantic actions to objc_set_method_type() and objc_add_method_declaration(). (methoddecl): Use objc_typename instead of typename; move semantic actions to objc_build_method_signature(). (optarglist, myxdecls, mydecl, myparms, myparm): Remove nonterminals. (optparmlist): Express in terms of optparms and optellipsis. (optparms, optellipsis, objc_qual, objc_quals, objc_typename): New nonterminals. (keyworddecl): Use objc_typename instead of typename. (rid_to_yy): Mark RID_IN, RID_OUT, RID_INOUT, RID_BYCOPY, RID_BYREF and RID_ONEWAY as returning OBJC_TYPE_QUAL to yyparse(). [gcc/objc/ChangeLog] 2004-09-07 Ziemowit Laski <zlaski@apple.com> * Make-lang.in (objc/objc-parse.o): Depend on $(C_COMMON_H) instead of objc/objc-act.h. (objc/objc-act.o): Depend on $(HASHTAB_H). * objc-act.c: Include hashtab.h; in ObjC++ mode, include cp-tree.h and objcp-decl.h instead of c-tree.h. (build_module_descriptor, get_class_ivars, synth_id_with_class_suffix, error_with_ivar, gen_method_decl, gen_declaration, setup_string_decl, build_protocol_template): Adjust prototypes. (build_module_initializer_routine, start_class, continue_class, finish_class, start_method_def, objc_start_function, start_protocol, build_method_decl, objc_add_method, add_instance_variable, build_ivar_reference, is_ivar, is_private, get_super_receiver, build_selector_table_decl, objc_push_parm, objc_get_parm_info, gen_type_name, gen_type_name_0, start_var_decl, finish_var_decl, create_field_decl): New prototypes. (objc_expand_function_end, comp_method_with_proto, objc_expr_last, gen_declaration_1, gen_declarator, is_complex_decl, adorn_decl, define_decl, create_builtin_decl, gen_declspecs): Remove prototypes. (TYPE_ID): Rename to OBJECT_TYPEDEF_NAME. (CLASS_TYPEDEF_NAME): New. (TAG_EXECCLASS): Change from a global variable to a #define. (TAG_RETURN_STRUCT): Delete. (TAG_GNUINIT): New, holds '__objc_gnu_init' name. (objc_inherit_code, objc_public_flag): New, moved from c-parse.in. (string_descriptor): New struct. (string_htab): New hash table. (string_hash, string_eq): New prototypes. (generate_struct_by_value_array): Call create_field_decl() instead of create_builtin_decl(). (objc_init): Do not initialize objc_ellipsis_node or TAG_EXECCLASS; In ObjC++ mode, call cxx_init() instead of c_objc_common_init(). (objc_finish_file): In ObjC++, call instantiate_pending_templates() and cp_finish_file(). (define_decl, get_static_reference, get_protocol_reference, create_builtin_decl): Remove functions. (objc_start_class_interface, objc_start_category_interface, objc_start_protocol, objc_continue_interface, objc_finish_interface, objc_start_class_implementation, objc_start_category_implementation, objc_continue_implementation, objc_finish_implementation, objc_set_visibility, objc_set_method_type, objc_build_method_signature, objc_add_method_declaration, objc_start_method_definition, objc_add_instance_variable, objc_get_protocol_qualified_type, create_field_decl, start_var_decl, finish_var_decl): New functions. (setup_string_decl): Simplify since it is only called once. (synth_module_prologue): Call build_class_template(); predefine 'id' and 'Class' as typedefs; rename 'temp_type' to 'type'; disable debug hooks for duration of function; fix GNU runtime messenger signatures to correspond to reality; forward-declare '__objc_exec_class' for the GNU runtime; call build_selector_table_decl(); in ObjC++ mode, generate 'extern "C" { ... }' wrappers around synthesized declarations; call build_protocol_template() and build_category_template(). (string_hash, string_eq): New functions. (objc_build_string_object): Check metaclass correctness only once; store string literals in hash table. (objc_build_constructor): Do not convert initializer elements; adjust for ObjC++ impedance mismatch. (build_objc_symtab_template): Call create_field_decl() instead of create_builtin_decl(). (init_objc_symtab): Add missing conversion to initializer element. (build_metadata_decl): Call start_var_decl() instead of define_decl(). (generate_objc_symtab_decl): Do not call build_category_template(); call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(). (build_module_descriptor): Call create_field_decl() instead of grokfield(); call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(); always mark module descriptor as used; move GNU runtime-specific functionality to build_module_initializer_routine(). (build_module_initializer_routine): New function, broken off of build_module_descriptor(). (objc_static_init_needed_p, objc_generate_static_init_call): New functions. (generate_static_references, generate_strings, build_selector_translation_table, generate_descriptor_table, generate_ivars_list, generate_dispatch_table, generate_category): Call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(); build a type directly instead of via groktypename(). (build_selector_reference_decl, build_selector_table_decl, build_class_reference_decl, build_protocol_reference, generate_objc_image_info): Call start_var_decl() instead of build_decl(). (build_selector_reference): For GNU runtime, do not call build_selector_reference_decl(). (build_selector, build_typed_selector_reference): Always convert result to the selector type. (add_objc_string): Cast return value to 'char *'. (build_method_prototype_template, build_selector_template, build_method_template): Use actual selector type for fields pointing to selectors. (finish_objc): For GNU runtime, call build_module_initializer_routine() after build_module_descriptor(). (generate_protocol_list, generate_shared_structures): Call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(); build a type directly instead of via groktypename(). (synth_id_with_class_suffix): Return a string. (get_arg_type_list): For instance methods, use the instance type for 'self'; do not call groktypename_in_parm_context(). (build_objc_string_decl): Squash redeclaration errors in ObjC++. (objc_is_class_name): Use OBJC_TYPE_NAME instead of TYPE_NAME; handle RECORD_TYPEs in ObjC as well as ObjC++. (objc_is_id): New function. (objc_is_object_ptr): Return the canonical type node. (objc_get_class_ivars): Simplify using get_class_ivars(). (get_class_ivars): Remove second parameter; create a fresh copy of the ivar list for each call; do not check for existence of super class. (objc_eh_runtime_type): Mark #ifndef OBJCPLUS. (objc_init_exceptions): When using SJLJ-style exceptions, require the use of '-fobjc-exceptions' flag; do not require it for DWARF-style exceptions. (objc_build_exc_ptr, next_sjlj_build_try_catch_finally): Use objc_object_type instead of objc_id_type. (objc_begin_catch_clause): Convert the incoming PARM_DECL into a VAR_DECL before placing it in the appropriate scope; do not call define_decl(); adjust call to c_begin_compound_stmt(); use objc_object_type instead of objc_id_type. (build_next_objc_exception_stuff): Call create_field_decl() instead of create_builtin_decl(); construct type directly instead of calling groktypename(); use OBJC_VOID_AT_END to mark end of function parameters. (build_private_template): Adjust call to get_class_ivars(); build a type directly instead of via groktypename(). (build_protocol_template, build_method_prototype_list_template, build_method_prototype_template, build_category_template, build_selector_template, build_class_template, build_super_template, build_ivar_template, build_ivar_list_template, build_method_list_template, build_method_template): Call create_field_decl() instead of grokfield(). (objc_method_parm_type): Do not call groktypename(). (generate_descriptor_table): Call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(). (generate_method_descriptors, build_protocol_initializer, generate_dispatch_tables, build_category_initializer, build_shared_structure_initializer): Do not call groktypename(). (generate_protocols): Call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(); do not call groktypename(). (error_with_ivar): Remove last parameter. (check_ivars): Do not iterate ovar CLASS_RAW_IVARS lists in addition to CLASS_IVARS lists; adjust calls to error_with_ivar(). (generate_ivar_lists): Convert one of the initializer elements; do not call groktypename(). (get_arg_type_list, start_method_def, gen_method_def): Account for new representation of variable arguments and '...' in Objective-C methods; add Objective-C++ impedance matching code. (is_objc_type_qualifier): Remove function. (adjust_type_for_id_default): Simplify; there is no longer a need to wade through declspecs. (lookup_interface, start_class, continue_class, finish_class, start_method_def, start_protocol, build_method_decl, objc_add_method, add_instance_variable, build_ivar_reference, is_ivar, is_private, get_super_receiver, objc_build_finally_epilogue): Make into static functions. (receiver_is_class_object): Use new IS_CLASS() macro. (objc_build_message_expr): Tweak ObjC++ message argument handling; call objc_finish_message_expr() instead of finish_message_expr(). (finish_message_expr): Rename to objc_finish_message_expr(); use OBJC_TYPE_NAME and OBJC_SET_TYPE_NAME macros instead of TYPE_NAME. call gen_type_name() instead of gen_declaration(); call objc_is_id() instead of using IS_ID and IS_CLASS; Use objc_class_name instead of calling get_identifier("Class"); handle CONVERT_EXPRs in receiver. (build_objc_method_call, warn_with_method): Do not call groktypename(). (build_ivar_reference): Call convert() instead of clobbering in a type. (hash_init): Initialize string_htab hash table. (add_instance_variable): Simplify parameter list; do not call grokfield(); do not populate CLASS_IVARS list. (start_class): Check for the existence of super class, if one was specified. (continue_class): Use CLASS_RAW_IVARS rather than CLASS_IVARS; do not call build_class_template(); adjust call to get_class_ivars(); call build_decl(), pushdecl() and finish_decl() instead of define_decl(). (finish_class): Call build_decl(), pushdecl() and finish_decl() instead of define_decl(). (add_protocols): Use PROTOCOL_BINFO_ELTS for the tree vector size. (start_protocol): Do not call build_protocol_template(); use PROTOCOL_BINFO_ELTS for the tree vector size. (encode_type_qualifiers): Do not handle the 'const' qualifier here. (encode_pointer): Encode 'const char *' as 'r*', for backwards compatibility. (encode_array): Use HOST_WIDE_INT_PRINT_DEC instead of "%ld". (encode_type): Handle the 'const' qualifier here. (objc_parmlist): New global variable, sued by objc_push_parm and objc_get_parm_info(). (objc_push_parm, objc_get_parm_info): New functions. (objc_expr_last): Remove function. (synth_self_and_ucmd_args): For instance methods, use the instance type for 'self'; call objc_push_parm() instead of push_parm_decl(). (start_method_def): Do not call push_scope(), declare_parm_level(), pop_scope(), push_parm_decl(), store_parm_decls() or objc_expr_last(); just use objc_push_parm() and objc_get_parm_info(). (comp_method_with_proto): Remove function. (objc_types_are_equivalent): Strip away indirections before comparing underlying types. (comp_proto_with_proto): Do not call groktypename(); types are no longer in raw declspec format. (objc_start_function): New function. (really_start_method): Call comp_proto_with_proto() instead of comp_method_with_proto(); call objc_start_function() instead of hand-crafting a function declarator. (continue_method_def, objc_expand_function_end): Remove functions. (get_super_receiver): Call objc_get_current_scope() instead of get_current_scope(); reference 'super_class' field (instead of 'class'). (finish_method_def): Rename to objc_finish_method_definition() and add a function decl parameter; move method encoding call from objc_expand_function_end(). (is_complex_decl, adorn_decl, gen_declarator, gen_declspecs, gen_declaration_1): Remove functions. (tmpbuf, RAW_DECLSPEC): Remove. (gen_declaration): Remove second parameter; simplify to deal with TYPE_P nodes instead of raw declspecs. (gen_type_name, gen_type_name_0): New functions. (gen_method_decl): Remove second parameter; call gen_type_name() instead of gen_declaration_1(). (dump_interface): Adjust calls to gen_declaration() and gen_method_decl(); do not allocate a separate string buffer. (init_objc): Allocate a larger string buffer to accommodate dump_interface(); adjust call to build_module_descriptor(); add call to build_module_initializer_routine() for the GNU runtime. (generate_classref_translation_entry): Do not call start_decl(); call finish_var_decl() instead of finish_decl(); call convert() instead of build_c_cast(). * objc-act.h (CLASS_OWN_IVARS): Remove accessor. (CLASS_BINFO_ELTS): Reduce from 6 to 5, now that CLASS_OWN_IVARS is gone. (OCTI_GNU_INIT_DECL, GNU_INIT_decl): New. (OCTI_ELLIPSIS_NODE, objc_ellipsis_node): Remove. (OCTI_ID_ID, id_type, objc_id_id): Rename to OCTI_ID_NAME, objc_object_type and objc_object_name, respectively. (OCTI_CLS_REF, OCTI_CLASS_NAME, objc_class_reference, objc_class_name): New. (IS_CLASS): New macro. (IS_ID, IS_SUPER): Robustify. (OCTI_EXECCLASS_DECL, execclass_decl): New. (finish_file, start_class, continue_class, finish_class, start_method_def, continue_method_def, finish_method_def, start_protocol, finish_protocol, objc_build_throw_stmt, objc_build_try_catch_finally_stmt, objc_build_synchronized_prologue, objc_build_synchronized_epilogue, objc_build_try_prologue, objc_build_try_epilogue, objc_build_catch_stmt, objc_build_catch_epilogue, objc_build_finally_prologue, objc_build_finally_epilogue, is_ivar, is_private, is_public, add_instance_variable, objc_add_method, get_super_receiver, objc_clear_super_receiver, get_class_ivars_from_name, get_class_reference, get_static_reference, get_object_reference, build_message_expr, finish_message_expr, build_selector_expr, build_ivar_reference, build_keyword_decl, build_method_decl, build_protocol_expr, build_objc_string_object, objc_declare_alias, objc_declare_class, objc_declare_protocols, objc_comptypes, objc_check_decl, build_encode_expr): Remove prototypes. (imp_count, cat_count): Make GGC-aware. (OBJC_SET_TYPE_NAME): New macro. From-SVN: r87168
2004-09-08 02:49:44 +02:00
lang_hooks.decls.pushdecl (UOBJC_SUPER_decl);
finish_decl (UOBJC_SUPER_decl, NULL_TREE, NULL_TREE);
UOBJC_SUPER_scope = objc_get_current_scope ();
}
1996-07-04 00:07:53 +02:00
/* Set receiver to self. */
objc-act.c (objc_build_struct): New function. * objc-act.c (objc_build_struct): New function. (objc_derived_from_p): Likewise. (objc_build_component_ref): Likewise. (objc_copy_binfo): Likewise. (objc_xref_basetypes): Likewise. (objc_lookup_protocol): Likewise. (objc_compare_protocols): Likewise. (objc_volatilize_decl): Likewise. (encode_aggregate_fields): Likewise. (volatilized_hash): Likewise. (volatilized_eq): Likewise. (objc_compare_types): Likewise. (objc_type_quals_match): Likewise. (DERIVED_FROM_P): New ObjC macro, corresponding to C++ macro of same name. (get_class_ivars): Add second parameter indicating if entire hierarchy is desired. (struct volatilized_type): New type. (volatilized_htab): New hash table. (objc_types_compatible_p, objc_comptypes): Remove functions. (synth_module_prologue): Do not initialize 'unused_list'. (objc_get_class_reference): Fix ObjC++ impedance mismatches. (objc_declare_alias): Implement as a typedef. (objc_substitute_decl, objc_gimplify_expr): Reformat. (objc_get_class_ivars): Adjust call to get_class_ivars(). (next_sjlj_build_enter_and_setjmp, synth_forward_declarations, build_ivar_reference, get_super_receiver): Call objc_build_component_ref() instead of build_component_ref(). (objc_begin_catch_clause): Use DERIVED_FROM_P() instead of objc_comptypes(). (build_private_template): Call objc_build_struct() instead of start_struct() and finish_struct(). (hash_init): Initialize volatilized_htab. (objc_is_public): Adjust calls to objc_get_ivars(); adjust ObjC++ impedance mismatches. (encode_aggregate_within): Streamline by calling encode_aggregate_fields(). * objc-act.h (objc_types_compatible_p): Remove prototype. (OCTI_UNUSED_LIST, unused_list): Remove slot. * objc-lang.c (LANG_HOOKS_TYPES_COMPATIBLE_P): Remove. From-SVN: r100123
2005-05-25 00:21:01 +02:00
super_expr = objc_build_component_ref (UOBJC_SUPER_decl, self_id);
1992-01-18 00:15:38 +01:00
super_expr = build_modify_expr (super_expr, NOP_EXPR, self_decl);
c-tree.h (struct c_expr): Define. * c-tree.h (struct c_expr): Define. (C_SET_EXP_ORIGINAL_CODE): Remove. (parser_build_binary_op, build_compound_expr): Update prototypes. * c-parse.in (%union): Add exprtype. (FUNC_NAME): Mark as ttype. (expr, expr_no_commas, cast_expr, unary_expr, primary): Change to exprtype. (expr): Update. Define directly in terms of expr_no_commas instead of using nonnull_exprlist. (nonnull_exprlist, unary_expr, cast_expr, expr_no_commas, primary, offsetof_member_designator, typespec_nonreserved_nonattr, init, initval, designator, component_declarator, component_notype_declarator, enumerator, array_declarator, condition, exexpr, switch_statement, stmt_nocomp, stmt, nonnull_asm_operands, ivar_declarator, receiver): Update. Don't set C_EXP_ORIGINAL_CODE. Use TREE_NO_WARNING for assignments where appropriate. * c-common.h (C_EXP_ORIGINAL_CODE): Remove. * c-common.c (c_common_truthvalue_conversion): Don't check C_EXP_ORIGINAL_CODE. * c-typeck.c (parser_build_binary_op): Use c_expr structures. Don't use C_EXP_ORIGINAL_CODE. (default_conversion, default_function_array_conversion): Don't use C_EXP_ORIGINAL_CODE. Preserve TREE_NO_WARNING. (internal_build_compound_expr): Merge into build_compound_expr. (build_compound_expr): Take two operands instead of a TREE_LIST. * objc/objc-act.c (get_super_receiver): Update calls to build_compound_expr. cp: * typeck.c (build_modify_expr, build_x_modify_expr): Set TREE_NO_WARNING on assignments with an operator other than '='. testsuite: * g++.dg/warn/Wparentheses-1.C, g++.dg/warn/Wparentheses-2.C, gcc.dg/Wparentheses-10.c: New tests. * gcc.dg/Wparentheses-5.c: Remove XFAILs. From-SVN: r84911
2004-07-19 10:38:52 +02:00
super_expr_list = super_expr;
1992-01-18 00:15:38 +01:00
1996-07-04 00:07:53 +02:00
/* Set class to begin searching. */
objc-act.c (objc_build_struct): New function. * objc-act.c (objc_build_struct): New function. (objc_derived_from_p): Likewise. (objc_build_component_ref): Likewise. (objc_copy_binfo): Likewise. (objc_xref_basetypes): Likewise. (objc_lookup_protocol): Likewise. (objc_compare_protocols): Likewise. (objc_volatilize_decl): Likewise. (encode_aggregate_fields): Likewise. (volatilized_hash): Likewise. (volatilized_eq): Likewise. (objc_compare_types): Likewise. (objc_type_quals_match): Likewise. (DERIVED_FROM_P): New ObjC macro, corresponding to C++ macro of same name. (get_class_ivars): Add second parameter indicating if entire hierarchy is desired. (struct volatilized_type): New type. (volatilized_htab): New hash table. (objc_types_compatible_p, objc_comptypes): Remove functions. (synth_module_prologue): Do not initialize 'unused_list'. (objc_get_class_reference): Fix ObjC++ impedance mismatches. (objc_declare_alias): Implement as a typedef. (objc_substitute_decl, objc_gimplify_expr): Reformat. (objc_get_class_ivars): Adjust call to get_class_ivars(). (next_sjlj_build_enter_and_setjmp, synth_forward_declarations, build_ivar_reference, get_super_receiver): Call objc_build_component_ref() instead of build_component_ref(). (objc_begin_catch_clause): Use DERIVED_FROM_P() instead of objc_comptypes(). (build_private_template): Call objc_build_struct() instead of start_struct() and finish_struct(). (hash_init): Initialize volatilized_htab. (objc_is_public): Adjust calls to objc_get_ivars(); adjust ObjC++ impedance mismatches. (encode_aggregate_within): Streamline by calling encode_aggregate_fields(). * objc-act.h (objc_types_compatible_p): Remove prototype. (OCTI_UNUSED_LIST, unused_list): Remove slot. * objc-lang.c (LANG_HOOKS_TYPES_COMPATIBLE_P): Remove. From-SVN: r100123
2005-05-25 00:21:01 +02:00
super_expr = objc_build_component_ref (UOBJC_SUPER_decl,
get_identifier ("super_class"));
1992-01-18 00:15:38 +01:00
c-parse.in (objc_inherit_code, [...]): Make static. 2001-10-03 Ziemowit Laski <zlaski@apple.com> * c-parse.in (objc_inherit_code, objc_pq_context, objc_public_flag): Make static. (objc_interface_context, objc_implementation_context, objc_method_context, objc_ivar_chain, objc_ivar_context): Move to global tree array in objc/objc-act.[ch]. (methoddef): Remove unnecessary code. * objc/objc-act.c: (hashed_attribute, hashed_entry, imp_entry): Hoist struct definitions to objc-act.h. (nst_method_hash_list, cls_method_hash_list, imp_list, imp_count, cat_count): Place declaration in objc-act.h. (objc_tree_index): Move enumeration to objc-act.h. (objc_global_trees): Place declaration and macro accessors in objc-act.h. (implementation_context): Remove duplicate; use objc_implementation_context instead: (method_context): Remove duplicate; use objc_method_context instead. (objc_ellipsis_node, objc_method_prototype_template, implemented_classes, function_type): Move global vars to objc_global_trees. (init_objc): Use LAST_BASE_TREE_CODE instead of LAST_CODE. (build_message_expr): Move actual construction of ObjC message send nodes to finish_message_expr. (finish_message_expr): New routine, contains code formerly in build_message_expr. * objc/objc-act.h (finish_message_expr): New prototype. (objc_ivar_chain, objc_method_context, objc_ellipsis_node): Remove declarations; these vars are now part of objc_global_trees. (objc_tree_index, objc_global_trees): Move definitions from objc-act.c. * objc/objc-tree.def: Update copyright info. From-SVN: r46000
2001-10-04 00:05:57 +02:00
if (TREE_CODE (objc_implementation_context) == CLASS_IMPLEMENTATION_TYPE)
1992-01-18 00:15:38 +01:00
{
/* [_cls, __cls]Super are "pre-built" in
synth_forward_declarations. */
super_expr = build_modify_expr (super_expr, NOP_EXPR,
c-parse.in (objc_inherit_code, [...]): Make static. 2001-10-03 Ziemowit Laski <zlaski@apple.com> * c-parse.in (objc_inherit_code, objc_pq_context, objc_public_flag): Make static. (objc_interface_context, objc_implementation_context, objc_method_context, objc_ivar_chain, objc_ivar_context): Move to global tree array in objc/objc-act.[ch]. (methoddef): Remove unnecessary code. * objc/objc-act.c: (hashed_attribute, hashed_entry, imp_entry): Hoist struct definitions to objc-act.h. (nst_method_hash_list, cls_method_hash_list, imp_list, imp_count, cat_count): Place declaration in objc-act.h. (objc_tree_index): Move enumeration to objc-act.h. (objc_global_trees): Place declaration and macro accessors in objc-act.h. (implementation_context): Remove duplicate; use objc_implementation_context instead: (method_context): Remove duplicate; use objc_method_context instead. (objc_ellipsis_node, objc_method_prototype_template, implemented_classes, function_type): Move global vars to objc_global_trees. (init_objc): Use LAST_BASE_TREE_CODE instead of LAST_CODE. (build_message_expr): Move actual construction of ObjC message send nodes to finish_message_expr. (finish_message_expr): New routine, contains code formerly in build_message_expr. * objc/objc-act.h (finish_message_expr): New prototype. (objc_ivar_chain, objc_method_context, objc_ellipsis_node): Remove declarations; these vars are now part of objc_global_trees. (objc_tree_index, objc_global_trees): Move definitions from objc-act.c. * objc/objc-tree.def: Update copyright info. From-SVN: r46000
2001-10-04 00:05:57 +02:00
((TREE_CODE (objc_method_context)
== INSTANCE_METHOD_DECL)
? ucls_super_ref
: uucls_super_ref));
1992-01-18 00:15:38 +01:00
}
else
1996-07-04 00:07:53 +02:00
/* We have a category. */
1992-01-18 00:15:38 +01:00
{
tree super_name = CLASS_SUPER_NAME (implementation_template);
tree super_class;
1992-01-18 00:15:38 +01:00
/* Barf if super used in a category of Object. */
if (!super_name)
1992-01-18 00:15:38 +01:00
{
builtins.c, [...]: Avoid "`" as left quote, using "'" or %q, %< and %> as appropriate. * builtins.c, c-common.c, c-decl.c, c-format.c, c-format.h, c-parse.in, c-pch.c, c-pragma.c, collect2.c, final.c, gcc.c, gcov.c, opts.c, pretty-print.h, protoize.c, reg-stack.c, rtl.c, tlink.c, config/alpha/alpha.c, config/arc/arc.c, config/arm/arm.c, config/avr/avr.c, config/c4x/c4x.c, config/darwin.c, config/frv/frv.c, config/h8300/h8300.c, config/i386/i386.c, config/i386/winnt.c, config/ia64/ia64.c, config/ip2k/ip2k.c, config/iq2000/iq2000.c, config/m32r/m32r.c, config/m68hc11/m68hc11.c, config/m68k/m68k.c, config/m68k/m68k.h, config/mcore/mcore.c, config/mips/mips.c, config/mmix/mmix.c, config/ns32k/ns32k.c, config/rs6000/host-darwin.c, config/rs6000/rs6000.c, config/s390/s390.c, config/sh/sh.c, config/sh/symbian.c, config/stormy16/stormy16.c, config/v850/v850.c: Avoid "`" as left quote, using "'" or %q, %< and %> as appropriate. Use %' as apostrophe in diagnostics where applicable. Use %< and %> in place of '' quotes where applicable. Use %qs in place of %<%s%>. Consistently quote __builtin function names. ada: * misc.c (gnat_handle_option): Use %< and %> for quoting in warning message. cp: * call.c, class.c, decl.c, decl2.c, error.c, mangle.c, parser.c, pt.c, search.c, semantics.c, typeck.c: Use %q, %< and %> for quoting in diagnostics. * parser.c (cp_parser_sizeof_operand): Use '' instead of `' for quoting in printf format. * decl.c (duplicate_decls, start_decl): Use %qD instead of unquoted %D. objc: * objc-act.c: Use %q, %< and %> for quoting in diagnostics. testsuite: * gcc.dg/builtin-prefetch-1.c: Adjust expected messages. From-SVN: r90337
2004-11-09 11:13:30 +01:00
error ("no super class declared in interface for %qs",
1992-01-18 00:15:38 +01:00
IDENTIFIER_POINTER (CLASS_NAME (implementation_template)));
return error_mark_node;
}
if (flag_next_runtime && !flag_zero_link)
{
c-parse.in (primary): Call objc_build_message_expr()... [gcc/ChangeLog] 2004-09-01 Ziemowit Laski <zlaski@apple.com> * c-parse.in (primary): Call objc_build_message_expr(), objc_build_selector_expr(), objc_build_protocol_expr(), objc_build_encode_expr() and objc_build_string_object() instead of build_message_expr(), build_selector_expr(), build_protocol_expr(), build_encode_expr() and build_objc_string_object(), respectively. (component_decl_list2): Call objc_get_class_ivars() instead of get_class_ivars_from_name(). (keyworddecl): Call objc_build_keyword_decl() instead of build_keyword_decl(). (receiver): Call objc_get_class_reference() instead of get_class_reference(). (reswords): Add blank line before @@ifobjc section, for clarity. [gcc/objc/ChangeLog] 2004-09-01 Ziemowit Laski <zlaski@apple.com> * objc-act.c (objc_check_decl): Use OBJC_TYPE_NAME macro instead of TYPE_NAME. (build_objc_string_object): Rename to objc_build_string_object(). (get_class_reference): Rename to objc_get_class_reference(). (get_class_ivars_from_name): Rename to objc_get_class_ivars(). (next_sjlj_build_catch_list, get_super_receiver): Call objc_get_class_reference() instead of get_class_reference(). (build_keyword_decl): Rename to objc_build_keyword_decl(). (build_message_expr): Rename to objc_build_message_expr(). (build_protocol_expr): Rename to objc_build_protocol_expr(). (build_selector_expr): Rename to objc_build_selector_expr(). (build_encode_expr): Rename to objc_build_encode_expr(). * objc-act.h (get_class_ivars_from_name): Rename prototype to objc_get_class_ivars(). (get_class_reference): Rename prototype to objc_get_class_reference(). (build_message_expr): Rename prototype to objc_build_message_expr(). (build_selector_expr): Rename prototype to objc_build_selector_expr(). (build_keyword_decl): Rename prototype to objc_build_keyword_decl(). (build_protocol_expr): Rename prototype to objc_build_prototype_expr(). (build_objc_string_object): Rename prototype to objc_build_string_object(). From-SVN: r86950
2004-09-02 02:36:18 +02:00
super_class = objc_get_class_reference (super_name);
c-parse.in (objc_inherit_code, [...]): Make static. 2001-10-03 Ziemowit Laski <zlaski@apple.com> * c-parse.in (objc_inherit_code, objc_pq_context, objc_public_flag): Make static. (objc_interface_context, objc_implementation_context, objc_method_context, objc_ivar_chain, objc_ivar_context): Move to global tree array in objc/objc-act.[ch]. (methoddef): Remove unnecessary code. * objc/objc-act.c: (hashed_attribute, hashed_entry, imp_entry): Hoist struct definitions to objc-act.h. (nst_method_hash_list, cls_method_hash_list, imp_list, imp_count, cat_count): Place declaration in objc-act.h. (objc_tree_index): Move enumeration to objc-act.h. (objc_global_trees): Place declaration and macro accessors in objc-act.h. (implementation_context): Remove duplicate; use objc_implementation_context instead: (method_context): Remove duplicate; use objc_method_context instead. (objc_ellipsis_node, objc_method_prototype_template, implemented_classes, function_type): Move global vars to objc_global_trees. (init_objc): Use LAST_BASE_TREE_CODE instead of LAST_CODE. (build_message_expr): Move actual construction of ObjC message send nodes to finish_message_expr. (finish_message_expr): New routine, contains code formerly in build_message_expr. * objc/objc-act.h (finish_message_expr): New prototype. (objc_ivar_chain, objc_method_context, objc_ellipsis_node): Remove declarations; these vars are now part of objc_global_trees. (objc_tree_index, objc_global_trees): Move definitions from objc-act.c. * objc/objc-tree.def: Update copyright info. From-SVN: r46000
2001-10-04 00:05:57 +02:00
if (TREE_CODE (objc_method_context) == CLASS_METHOD_DECL)
/* 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
= build_indirect_ref
(build_c_cast (build_pointer_type (objc_class_type),
super_class), "unary *");
}
1992-01-18 00:15:38 +01:00
else
{
add_class_reference (super_name);
c-parse.in (objc_inherit_code, [...]): Make static. 2001-10-03 Ziemowit Laski <zlaski@apple.com> * c-parse.in (objc_inherit_code, objc_pq_context, objc_public_flag): Make static. (objc_interface_context, objc_implementation_context, objc_method_context, objc_ivar_chain, objc_ivar_context): Move to global tree array in objc/objc-act.[ch]. (methoddef): Remove unnecessary code. * objc/objc-act.c: (hashed_attribute, hashed_entry, imp_entry): Hoist struct definitions to objc-act.h. (nst_method_hash_list, cls_method_hash_list, imp_list, imp_count, cat_count): Place declaration in objc-act.h. (objc_tree_index): Move enumeration to objc-act.h. (objc_global_trees): Place declaration and macro accessors in objc-act.h. (implementation_context): Remove duplicate; use objc_implementation_context instead: (method_context): Remove duplicate; use objc_method_context instead. (objc_ellipsis_node, objc_method_prototype_template, implemented_classes, function_type): Move global vars to objc_global_trees. (init_objc): Use LAST_BASE_TREE_CODE instead of LAST_CODE. (build_message_expr): Move actual construction of ObjC message send nodes to finish_message_expr. (finish_message_expr): New routine, contains code formerly in build_message_expr. * objc/objc-act.h (finish_message_expr): New prototype. (objc_ivar_chain, objc_method_context, objc_ellipsis_node): Remove declarations; these vars are now part of objc_global_trees. (objc_tree_index, objc_global_trees): Move definitions from objc-act.c. * objc/objc-tree.def: Update copyright info. From-SVN: r46000
2001-10-04 00:05:57 +02:00
super_class = (TREE_CODE (objc_method_context) == INSTANCE_METHOD_DECL
? objc_get_class_decl : objc_get_meta_class_decl);
assemble_external (super_class);
super_class
= build_function_call
(super_class,
build_tree_list
(NULL_TREE,
c-tree.h (default_function_array_conversion): Declare. * c-tree.h (default_function_array_conversion): Declare. * c-typeck.c (default_function_array_conversion): Export. Correct comment. (default_conversion): Do not call default_function_array_conversion. Do not allow FUNCTION_TYPE. (build_function_call): Call default_function_array_conversion on the function. (convert_arguments): Do not call it on the function arguments. (build_unary_op): Do not allow ARRAY_TYPE or FUNCTION_TYPE for TRUTH_NOT_EXPR. Call default_function_array_conversion for taking address of ARRAY_REF. (build_compound_expr): Do not call default_function_array_conversion. (build_c_cast): Do not call default_function_array_conversion. (convert_for_assignment): Do not call default_conversion. (digest_init): Call default_function_array_conversion to convert string constants and compound literals to pointers, but not otherwise. (output_init_element): Likewise. (build_asm_expr): Do not call default_function_array_conversion. (c_process_expr_stmt): Likewise. (c_objc_common_truthvalue_conversion): Likewise. Do not allow FUNCTION_TYPE. * c-parser.c (c_parser_expression_conv): New. (c_parser_asm_operands, c_parser_expr_list): Add convert_p argument. All callers changed. Call default_function_array_conversion if convert_p. (c_parser_initializer, c_parser_initval): Call default_function_array_conversion except for string constants and compound literals. (c_parser_initelt): Call default_function_array_conversion for ObjC expression received. (c_parser_statement_after_labels): Call c_parser_expression_conv for return and expression statements. (c_parser_paren_condition, c_parser_for_statement, c_parser_conditional_expression): Call c_parser_expression_conv. (c_parser_expr_no_commas, c_parser_conditional_expression, c_parser_binary_expression, c_parser_cast_expression, c_parser_unary_expression): Call default_function_array_conversion. objc: * objc-act.c (my_build_string_pointer): New. (objc_get_class_reference, get_super_receiver): Call my_build_string_pointer instead of my_build_string when building function arguments. testsuite: * gcc.dg/noncompile/20040203-3.c: Update expected message. From-SVN: r100984
2005-06-15 17:55:47 +02:00
my_build_string_pointer
(IDENTIFIER_LENGTH (super_name) + 1,
IDENTIFIER_POINTER (super_name))));
}
1992-01-18 00:15:38 +01:00
super_expr
= build_modify_expr (super_expr, NOP_EXPR,
build_c_cast (TREE_TYPE (super_expr),
super_class));
1992-01-18 00:15:38 +01:00
}
c-tree.h (struct c_expr): Define. * c-tree.h (struct c_expr): Define. (C_SET_EXP_ORIGINAL_CODE): Remove. (parser_build_binary_op, build_compound_expr): Update prototypes. * c-parse.in (%union): Add exprtype. (FUNC_NAME): Mark as ttype. (expr, expr_no_commas, cast_expr, unary_expr, primary): Change to exprtype. (expr): Update. Define directly in terms of expr_no_commas instead of using nonnull_exprlist. (nonnull_exprlist, unary_expr, cast_expr, expr_no_commas, primary, offsetof_member_designator, typespec_nonreserved_nonattr, init, initval, designator, component_declarator, component_notype_declarator, enumerator, array_declarator, condition, exexpr, switch_statement, stmt_nocomp, stmt, nonnull_asm_operands, ivar_declarator, receiver): Update. Don't set C_EXP_ORIGINAL_CODE. Use TREE_NO_WARNING for assignments where appropriate. * c-common.h (C_EXP_ORIGINAL_CODE): Remove. * c-common.c (c_common_truthvalue_conversion): Don't check C_EXP_ORIGINAL_CODE. * c-typeck.c (parser_build_binary_op): Use c_expr structures. Don't use C_EXP_ORIGINAL_CODE. (default_conversion, default_function_array_conversion): Don't use C_EXP_ORIGINAL_CODE. Preserve TREE_NO_WARNING. (internal_build_compound_expr): Merge into build_compound_expr. (build_compound_expr): Take two operands instead of a TREE_LIST. * objc/objc-act.c (get_super_receiver): Update calls to build_compound_expr. cp: * typeck.c (build_modify_expr, build_x_modify_expr): Set TREE_NO_WARNING on assignments with an operator other than '='. testsuite: * g++.dg/warn/Wparentheses-1.C, g++.dg/warn/Wparentheses-2.C, gcc.dg/Wparentheses-10.c: New tests. * gcc.dg/Wparentheses-5.c: Remove XFAILs. From-SVN: r84911
2004-07-19 10:38:52 +02:00
super_expr_list = build_compound_expr (super_expr_list, super_expr);
1992-01-18 00:15:38 +01:00
super_expr = build_unary_op (ADDR_EXPR, UOBJC_SUPER_decl, 0);
c-tree.h (struct c_expr): Define. * c-tree.h (struct c_expr): Define. (C_SET_EXP_ORIGINAL_CODE): Remove. (parser_build_binary_op, build_compound_expr): Update prototypes. * c-parse.in (%union): Add exprtype. (FUNC_NAME): Mark as ttype. (expr, expr_no_commas, cast_expr, unary_expr, primary): Change to exprtype. (expr): Update. Define directly in terms of expr_no_commas instead of using nonnull_exprlist. (nonnull_exprlist, unary_expr, cast_expr, expr_no_commas, primary, offsetof_member_designator, typespec_nonreserved_nonattr, init, initval, designator, component_declarator, component_notype_declarator, enumerator, array_declarator, condition, exexpr, switch_statement, stmt_nocomp, stmt, nonnull_asm_operands, ivar_declarator, receiver): Update. Don't set C_EXP_ORIGINAL_CODE. Use TREE_NO_WARNING for assignments where appropriate. * c-common.h (C_EXP_ORIGINAL_CODE): Remove. * c-common.c (c_common_truthvalue_conversion): Don't check C_EXP_ORIGINAL_CODE. * c-typeck.c (parser_build_binary_op): Use c_expr structures. Don't use C_EXP_ORIGINAL_CODE. (default_conversion, default_function_array_conversion): Don't use C_EXP_ORIGINAL_CODE. Preserve TREE_NO_WARNING. (internal_build_compound_expr): Merge into build_compound_expr. (build_compound_expr): Take two operands instead of a TREE_LIST. * objc/objc-act.c (get_super_receiver): Update calls to build_compound_expr. cp: * typeck.c (build_modify_expr, build_x_modify_expr): Set TREE_NO_WARNING on assignments with an operator other than '='. testsuite: * g++.dg/warn/Wparentheses-1.C, g++.dg/warn/Wparentheses-2.C, gcc.dg/Wparentheses-10.c: New tests. * gcc.dg/Wparentheses-5.c: Remove XFAILs. From-SVN: r84911
2004-07-19 10:38:52 +02:00
super_expr_list = build_compound_expr (super_expr_list, super_expr);
1992-01-18 00:15:38 +01:00
c-tree.h (struct c_expr): Define. * c-tree.h (struct c_expr): Define. (C_SET_EXP_ORIGINAL_CODE): Remove. (parser_build_binary_op, build_compound_expr): Update prototypes. * c-parse.in (%union): Add exprtype. (FUNC_NAME): Mark as ttype. (expr, expr_no_commas, cast_expr, unary_expr, primary): Change to exprtype. (expr): Update. Define directly in terms of expr_no_commas instead of using nonnull_exprlist. (nonnull_exprlist, unary_expr, cast_expr, expr_no_commas, primary, offsetof_member_designator, typespec_nonreserved_nonattr, init, initval, designator, component_declarator, component_notype_declarator, enumerator, array_declarator, condition, exexpr, switch_statement, stmt_nocomp, stmt, nonnull_asm_operands, ivar_declarator, receiver): Update. Don't set C_EXP_ORIGINAL_CODE. Use TREE_NO_WARNING for assignments where appropriate. * c-common.h (C_EXP_ORIGINAL_CODE): Remove. * c-common.c (c_common_truthvalue_conversion): Don't check C_EXP_ORIGINAL_CODE. * c-typeck.c (parser_build_binary_op): Use c_expr structures. Don't use C_EXP_ORIGINAL_CODE. (default_conversion, default_function_array_conversion): Don't use C_EXP_ORIGINAL_CODE. Preserve TREE_NO_WARNING. (internal_build_compound_expr): Merge into build_compound_expr. (build_compound_expr): Take two operands instead of a TREE_LIST. * objc/objc-act.c (get_super_receiver): Update calls to build_compound_expr. cp: * typeck.c (build_modify_expr, build_x_modify_expr): Set TREE_NO_WARNING on assignments with an operator other than '='. testsuite: * g++.dg/warn/Wparentheses-1.C, g++.dg/warn/Wparentheses-2.C, gcc.dg/Wparentheses-10.c: New tests. * gcc.dg/Wparentheses-5.c: Remove XFAILs. From-SVN: r84911
2004-07-19 10:38:52 +02:00
return super_expr_list;
1992-01-18 00:15:38 +01:00
}
else
{
error ("[super ...] must appear in a method context");
return error_mark_node;
}
}
/* When exiting a scope, sever links to a 'super' declaration (if any)
therein contained. */
void
objc_clear_super_receiver (void)
{
if (objc_method_context
&& UOBJC_SUPER_scope == objc_get_current_scope ()) {
UOBJC_SUPER_decl = 0;
UOBJC_SUPER_scope = 0;
}
1992-01-18 00:15:38 +01:00
}
splay-tree.c (splay_tree_predecessor): Fix typo in comment. * splay-tree.c (splay_tree_predecessor): Fix typo in comment. Convert the C front-end to use function-at-a-time mode. * c-common.h: Include splay-tree.h. (C_DECLARED_LABEL_FLAG): New macro. (struct language_function): Add x_scope_stmt_stack and x_function_name_declared_p. (RECHAIN_STMTS): Move definition. (lang_statment_code_p): Likewise. (lang_expand_stmt): Likewise. (lang_expand_decl_stmt): New variable. (lang_expand_function_end): Likewise. (current_scope_stmt_stack): New function. (add_decl_stmt): Likewise. (add_scope_stmt): Likewise. (mark_stmt_tree): Likewise. (struct c_lang_decl): New structure. (DECL_SAVED_TREE): Define. (c_mark_lang_decl): New function. (c_expand_start_cond): Change prototype. (c_finish_then): New function. (c_finish_else): Likewise. (current_function_name_declared): Remove. (set_current_function_name_declared): Likewise. (mark_c_language_function): Declare. (case_compare): Likewise. (c_add_case_label): Likewise. (c_expand_expr): Likewise. (c_safe_from_p): Likewise. * c-common.c (lang_expand_function_end): New variable. (struct if_elt): Add if_stmt. (c_expand_start_cond): Add the if-statement to the statement-tree, rather than generating RTL. (c_finish_then): New function. (c_expand_start_else): Don't generate RTL. (c_finish_else): New function. (c_expand_expr_stmt): Don't generate RTL. (statement_code_p): Add SCOPE_STMT. (case_compare): New function. (c_add_case_label): Likewise. (mark_stmt_tree): Likewise. (c_mark_lang_decl): Likewise. (mark_c_language_function): Likewise. (c_expand_expr): Likewise. (c_safe_from_p): Likewise. * c-decl.c (c_stmt_tree): New variable (c_scope_stmt_stack): Likewise. (c_function_name_declared_p): Likewise. (lang_expand_expr_stmt): Remove. (poplevel): Don't call output_inline_function for nested functions. (pushdecl): Don't set DECL_CONTEXT for a local declaration of an `extern' function. (redeclaration_error_message): Change means of computing whether or not a function is nested. (lookup_label): Don't call label_rtx. (init_decl_processing): Add more GC roots. (start_decl): Add DECL_STMTs to the statement-tree, rather than calling rest_of_decl_compilation. (finish_decl): Don't call expand_decl. (store_parm_decls): Begin the statement-tree, but don't generate RTL. (finish_function): Tie off the statement-tree. Call c_expand_body if appropriate. (c_expand_body): New function. (push_c_function_context): Save more information. (pop_c_function_contxt): Likewise. (copy_lang_decl): Now that we use DECL_LANG_SPECIFIC, copy it. (lang_mark_tree): Mark it. (current_stmt_tree): Adjust. (current_scope_stmt_stack): New function. (do_case): Remove. (set_current_name_declared): Likewise. (c_begin_compound_stmt): Define. (c_expand_decl_stmt): Likewise. * c-lang.c: Include rtl.h and expr.h. (lang_init): Set more language-specific hooks. * c-lex.c: Include expr.h. * c-parse.in: Changes throughout to add statements to the statement-tree, rather than generating RTL after every statement. * c-semantics.c (lang_expand_decl_stmt): Define. (add_decl_stmt): New function. (add_scope_stmt): Likewise. (finish_stmt_tree): Tweak. (genrtl_expr_stmt): Likewise. (genrtl_decl_stmt): Handle local labels, and call lang_expand_decl_stmt if required. (genrtl_for_stmt): Fix line-number handling. (genrtl_case_label): Handle cleanups. (genrtl_asm_stmt): Don't call combine_strings. (genrtl_compound_stmt): Simplify. (expand_stmt): Handle SCOPE_STMTs. * c-tree.h (struct lang_decl): New structure. (C_DECLARED_LABEL_FLAG): Remove. (c_begin_compound_stmt): Declare. (c_expand_decl_stmt): Likewise. (c_expand_start_case): Rename to c_start_case. (c_finish_case): New function. * c-typeck.c (start_init): Tweak setting of constructor_incremental. (c_expand_asm_operands): Tweak error-handling. Add to the statement-tree. (c_expand_return): Add to the statement-tree. (c_expand_start_case): Rename to ... (c_start_case): ... this. (struct c_switch): New type. (switch_stack): New variable. (do_case): Simplify. (c_finish_case): New function. * dependence.c: Include expr.h. (enum dependence_type): Change spelling of enumerals. (check_node_dependence): Adjust. * expr.h (lang_safe_from_p): Declare. (safe_from_p): Likewise. * expr.c (lang_safe_from_p): New variable. (safe_from_p): Give it external linkage. Use lang_safe_from_p. * stmt.c (expand_expr_stmt): Avoid clobberring of last_expr_type. * toplev.c (rest_of_decl_compilation): Robustify. * tree.c (contains_placeholder_p): Likewise. * Makefile.in: Update dependencies. * objc/objc-act.h: Adjust calculation of value for dummy_tree_code. * objc/objc-act.c: Include rtl.h, expr.h, and c-common.h. (objc_expand_function_end): New function. (finish_method_def): Use it. (init_objc): Initialize more language-specific hooks. * objc/Make-lang.in: Update dependencies. * cp-tree.h (struct cp_language_function): Remove x_scope_stmt_stack and name_declared. (current_scope_stmt_stack): Remove. (function_name_declared_p): New macro. (struct lang_decl_flags): Use c_lang_decl as a base class. (context): Remove. (struct lang_decl): Replace saved_tree with context. (DECL_FRIEND_CONTEXT): Adjust accordingly. (SET_DECL_FRIEND_CONTEXT): Likewise. (DECL_VIRTUAL_CONTEXT): Likewise. (DECL_SAVED_TREE): Remove. (C_DECLARED_LABEL_FLAG): Likewise. (cplus_expand_expr_stmt): Don't declare. (add_decl_stmt): Likewise. (add_scope_stmt): Likewise. * decl.c (mark_stmt_tree): Remove. (case_compare): Likewise. (finish_case_label): Use c_add_case_label. (init_decl_processing): Set more language-specific hooks. (build_enumerator): Fix typo in comment. (cplus_expand_expr_stmt): Remove. (mark_lang_function): Use mark_c_language_function. (lang_mark_tree): Use c_mark_lang_decl. * decl2.c: Change order of inclusion. * except.c: Likewise. * expr.c (cplus_expand_expr): Remove handling of STMT_EXPR. Fall back on c_expand_expr. * friend.c: Include expr.h. * init.c: Change order of inclusion. * Makefile.in: Update dependencies. * lex.h (free_lang_decl_chain): Remove. * optimize.c (maybe_clone_body): Use function_name_declared_p. * pt.c (build_template_decl): Don't copy DECL_VIRTUAL_CONTEXT if it doesn't exist. (instantiate_decl): Use function_name_declared_p. * semantics.c (lang_expand_expr_stmt): Remove. (set_current_function_name_declared): Likewise. (current_function_name_declared): Likewise. (begin_compound_stmt): Use function_name_declared_p. (add_decl_stmt): Remove. (setup_vtbl_ptr): Use function_name_declared_p. (add_scope_stmt): Remove. (current_scope_stmt_stack): New function. (cp_expand_stmt): Don't handle SCOPE_STMTs. (expand_body): Use function_name_declared_p. * tree.c (cp_statement_code_p): Don't include SCOPE_STMT. * typeck.c: Change order of includes. (convert_sequence): Remove. From-SVN: r36464
2000-09-17 09:38:23 +02:00
void
Makefile.in (c-parse.o): Depend on $(C_COMMON_H). [gcc/ChangeLog] 2004-09-07 Ziemowit Laski <zlaski@apple.com> * Makefile.in (c-parse.o): Depend on $(C_COMMON_H). * c-parse.in: Include c-common.h instead of objc-act.h. (ivar_decl_list, ivar_decls, ivar_decl, ivars, ivar_declarator, myparms, myparm): Remove %type declarations. (methodtype, optparms, OBJC_TYPE_QUAL, objc_quals, objc_qual, objc_typename, objc_try_catch_stmt, optellipsis): Add %type declarations. (objc_inherit_code, objc_public_flag): Remove. (typespec_nonreserved_nonattr): Call objc_get_protocol_qualified_type() instead of get_static_reference() and get_protocol_reference(). (stmt_nocomp): Call grokparm() on @catch parameter. (objcdef): Move semantic action to objc_finish_implementation(). (classdef): Move semantic action to objc_start_class_interface(), objc_continue_interface(), objc_finish_interface(), objc_start_class_implementation(), objc_continue_implementation(), objc_start_category_interface() and objc_start_category_implementation(). (protocoldef): Move semantic actions to objc_start_protocol() and objc_finish_interface(). (ivar_decl_list): Remove nonterminal. (visibility_spec): Move semantic actions to objc_set_visibility(). (ivar_decls): Remove assignment to $$. (ivar_decl): Rephrase in terms of component_decl; call objc_add_instance_variable(). (ivars, ivar_declarator): Remove nonterminals. (opt_semi): New nonterminal. (methodtype): Remove semantic actions. (methoddef): Move semantic actions to objc_set_method_type(), objc_start_method_definition() and objc_finish_method_definition(). (methodproto): Move semantic actions to objc_set_method_type() and objc_add_method_declaration(). (methoddecl): Use objc_typename instead of typename; move semantic actions to objc_build_method_signature(). (optarglist, myxdecls, mydecl, myparms, myparm): Remove nonterminals. (optparmlist): Express in terms of optparms and optellipsis. (optparms, optellipsis, objc_qual, objc_quals, objc_typename): New nonterminals. (keyworddecl): Use objc_typename instead of typename. (rid_to_yy): Mark RID_IN, RID_OUT, RID_INOUT, RID_BYCOPY, RID_BYREF and RID_ONEWAY as returning OBJC_TYPE_QUAL to yyparse(). [gcc/objc/ChangeLog] 2004-09-07 Ziemowit Laski <zlaski@apple.com> * Make-lang.in (objc/objc-parse.o): Depend on $(C_COMMON_H) instead of objc/objc-act.h. (objc/objc-act.o): Depend on $(HASHTAB_H). * objc-act.c: Include hashtab.h; in ObjC++ mode, include cp-tree.h and objcp-decl.h instead of c-tree.h. (build_module_descriptor, get_class_ivars, synth_id_with_class_suffix, error_with_ivar, gen_method_decl, gen_declaration, setup_string_decl, build_protocol_template): Adjust prototypes. (build_module_initializer_routine, start_class, continue_class, finish_class, start_method_def, objc_start_function, start_protocol, build_method_decl, objc_add_method, add_instance_variable, build_ivar_reference, is_ivar, is_private, get_super_receiver, build_selector_table_decl, objc_push_parm, objc_get_parm_info, gen_type_name, gen_type_name_0, start_var_decl, finish_var_decl, create_field_decl): New prototypes. (objc_expand_function_end, comp_method_with_proto, objc_expr_last, gen_declaration_1, gen_declarator, is_complex_decl, adorn_decl, define_decl, create_builtin_decl, gen_declspecs): Remove prototypes. (TYPE_ID): Rename to OBJECT_TYPEDEF_NAME. (CLASS_TYPEDEF_NAME): New. (TAG_EXECCLASS): Change from a global variable to a #define. (TAG_RETURN_STRUCT): Delete. (TAG_GNUINIT): New, holds '__objc_gnu_init' name. (objc_inherit_code, objc_public_flag): New, moved from c-parse.in. (string_descriptor): New struct. (string_htab): New hash table. (string_hash, string_eq): New prototypes. (generate_struct_by_value_array): Call create_field_decl() instead of create_builtin_decl(). (objc_init): Do not initialize objc_ellipsis_node or TAG_EXECCLASS; In ObjC++ mode, call cxx_init() instead of c_objc_common_init(). (objc_finish_file): In ObjC++, call instantiate_pending_templates() and cp_finish_file(). (define_decl, get_static_reference, get_protocol_reference, create_builtin_decl): Remove functions. (objc_start_class_interface, objc_start_category_interface, objc_start_protocol, objc_continue_interface, objc_finish_interface, objc_start_class_implementation, objc_start_category_implementation, objc_continue_implementation, objc_finish_implementation, objc_set_visibility, objc_set_method_type, objc_build_method_signature, objc_add_method_declaration, objc_start_method_definition, objc_add_instance_variable, objc_get_protocol_qualified_type, create_field_decl, start_var_decl, finish_var_decl): New functions. (setup_string_decl): Simplify since it is only called once. (synth_module_prologue): Call build_class_template(); predefine 'id' and 'Class' as typedefs; rename 'temp_type' to 'type'; disable debug hooks for duration of function; fix GNU runtime messenger signatures to correspond to reality; forward-declare '__objc_exec_class' for the GNU runtime; call build_selector_table_decl(); in ObjC++ mode, generate 'extern "C" { ... }' wrappers around synthesized declarations; call build_protocol_template() and build_category_template(). (string_hash, string_eq): New functions. (objc_build_string_object): Check metaclass correctness only once; store string literals in hash table. (objc_build_constructor): Do not convert initializer elements; adjust for ObjC++ impedance mismatch. (build_objc_symtab_template): Call create_field_decl() instead of create_builtin_decl(). (init_objc_symtab): Add missing conversion to initializer element. (build_metadata_decl): Call start_var_decl() instead of define_decl(). (generate_objc_symtab_decl): Do not call build_category_template(); call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(). (build_module_descriptor): Call create_field_decl() instead of grokfield(); call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(); always mark module descriptor as used; move GNU runtime-specific functionality to build_module_initializer_routine(). (build_module_initializer_routine): New function, broken off of build_module_descriptor(). (objc_static_init_needed_p, objc_generate_static_init_call): New functions. (generate_static_references, generate_strings, build_selector_translation_table, generate_descriptor_table, generate_ivars_list, generate_dispatch_table, generate_category): Call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(); build a type directly instead of via groktypename(). (build_selector_reference_decl, build_selector_table_decl, build_class_reference_decl, build_protocol_reference, generate_objc_image_info): Call start_var_decl() instead of build_decl(). (build_selector_reference): For GNU runtime, do not call build_selector_reference_decl(). (build_selector, build_typed_selector_reference): Always convert result to the selector type. (add_objc_string): Cast return value to 'char *'. (build_method_prototype_template, build_selector_template, build_method_template): Use actual selector type for fields pointing to selectors. (finish_objc): For GNU runtime, call build_module_initializer_routine() after build_module_descriptor(). (generate_protocol_list, generate_shared_structures): Call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(); build a type directly instead of via groktypename(). (synth_id_with_class_suffix): Return a string. (get_arg_type_list): For instance methods, use the instance type for 'self'; do not call groktypename_in_parm_context(). (build_objc_string_decl): Squash redeclaration errors in ObjC++. (objc_is_class_name): Use OBJC_TYPE_NAME instead of TYPE_NAME; handle RECORD_TYPEs in ObjC as well as ObjC++. (objc_is_id): New function. (objc_is_object_ptr): Return the canonical type node. (objc_get_class_ivars): Simplify using get_class_ivars(). (get_class_ivars): Remove second parameter; create a fresh copy of the ivar list for each call; do not check for existence of super class. (objc_eh_runtime_type): Mark #ifndef OBJCPLUS. (objc_init_exceptions): When using SJLJ-style exceptions, require the use of '-fobjc-exceptions' flag; do not require it for DWARF-style exceptions. (objc_build_exc_ptr, next_sjlj_build_try_catch_finally): Use objc_object_type instead of objc_id_type. (objc_begin_catch_clause): Convert the incoming PARM_DECL into a VAR_DECL before placing it in the appropriate scope; do not call define_decl(); adjust call to c_begin_compound_stmt(); use objc_object_type instead of objc_id_type. (build_next_objc_exception_stuff): Call create_field_decl() instead of create_builtin_decl(); construct type directly instead of calling groktypename(); use OBJC_VOID_AT_END to mark end of function parameters. (build_private_template): Adjust call to get_class_ivars(); build a type directly instead of via groktypename(). (build_protocol_template, build_method_prototype_list_template, build_method_prototype_template, build_category_template, build_selector_template, build_class_template, build_super_template, build_ivar_template, build_ivar_list_template, build_method_list_template, build_method_template): Call create_field_decl() instead of grokfield(). (objc_method_parm_type): Do not call groktypename(). (generate_descriptor_table): Call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(). (generate_method_descriptors, build_protocol_initializer, generate_dispatch_tables, build_category_initializer, build_shared_structure_initializer): Do not call groktypename(). (generate_protocols): Call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(); do not call groktypename(). (error_with_ivar): Remove last parameter. (check_ivars): Do not iterate ovar CLASS_RAW_IVARS lists in addition to CLASS_IVARS lists; adjust calls to error_with_ivar(). (generate_ivar_lists): Convert one of the initializer elements; do not call groktypename(). (get_arg_type_list, start_method_def, gen_method_def): Account for new representation of variable arguments and '...' in Objective-C methods; add Objective-C++ impedance matching code. (is_objc_type_qualifier): Remove function. (adjust_type_for_id_default): Simplify; there is no longer a need to wade through declspecs. (lookup_interface, start_class, continue_class, finish_class, start_method_def, start_protocol, build_method_decl, objc_add_method, add_instance_variable, build_ivar_reference, is_ivar, is_private, get_super_receiver, objc_build_finally_epilogue): Make into static functions. (receiver_is_class_object): Use new IS_CLASS() macro. (objc_build_message_expr): Tweak ObjC++ message argument handling; call objc_finish_message_expr() instead of finish_message_expr(). (finish_message_expr): Rename to objc_finish_message_expr(); use OBJC_TYPE_NAME and OBJC_SET_TYPE_NAME macros instead of TYPE_NAME. call gen_type_name() instead of gen_declaration(); call objc_is_id() instead of using IS_ID and IS_CLASS; Use objc_class_name instead of calling get_identifier("Class"); handle CONVERT_EXPRs in receiver. (build_objc_method_call, warn_with_method): Do not call groktypename(). (build_ivar_reference): Call convert() instead of clobbering in a type. (hash_init): Initialize string_htab hash table. (add_instance_variable): Simplify parameter list; do not call grokfield(); do not populate CLASS_IVARS list. (start_class): Check for the existence of super class, if one was specified. (continue_class): Use CLASS_RAW_IVARS rather than CLASS_IVARS; do not call build_class_template(); adjust call to get_class_ivars(); call build_decl(), pushdecl() and finish_decl() instead of define_decl(). (finish_class): Call build_decl(), pushdecl() and finish_decl() instead of define_decl(). (add_protocols): Use PROTOCOL_BINFO_ELTS for the tree vector size. (start_protocol): Do not call build_protocol_template(); use PROTOCOL_BINFO_ELTS for the tree vector size. (encode_type_qualifiers): Do not handle the 'const' qualifier here. (encode_pointer): Encode 'const char *' as 'r*', for backwards compatibility. (encode_array): Use HOST_WIDE_INT_PRINT_DEC instead of "%ld". (encode_type): Handle the 'const' qualifier here. (objc_parmlist): New global variable, sued by objc_push_parm and objc_get_parm_info(). (objc_push_parm, objc_get_parm_info): New functions. (objc_expr_last): Remove function. (synth_self_and_ucmd_args): For instance methods, use the instance type for 'self'; call objc_push_parm() instead of push_parm_decl(). (start_method_def): Do not call push_scope(), declare_parm_level(), pop_scope(), push_parm_decl(), store_parm_decls() or objc_expr_last(); just use objc_push_parm() and objc_get_parm_info(). (comp_method_with_proto): Remove function. (objc_types_are_equivalent): Strip away indirections before comparing underlying types. (comp_proto_with_proto): Do not call groktypename(); types are no longer in raw declspec format. (objc_start_function): New function. (really_start_method): Call comp_proto_with_proto() instead of comp_method_with_proto(); call objc_start_function() instead of hand-crafting a function declarator. (continue_method_def, objc_expand_function_end): Remove functions. (get_super_receiver): Call objc_get_current_scope() instead of get_current_scope(); reference 'super_class' field (instead of 'class'). (finish_method_def): Rename to objc_finish_method_definition() and add a function decl parameter; move method encoding call from objc_expand_function_end(). (is_complex_decl, adorn_decl, gen_declarator, gen_declspecs, gen_declaration_1): Remove functions. (tmpbuf, RAW_DECLSPEC): Remove. (gen_declaration): Remove second parameter; simplify to deal with TYPE_P nodes instead of raw declspecs. (gen_type_name, gen_type_name_0): New functions. (gen_method_decl): Remove second parameter; call gen_type_name() instead of gen_declaration_1(). (dump_interface): Adjust calls to gen_declaration() and gen_method_decl(); do not allocate a separate string buffer. (init_objc): Allocate a larger string buffer to accommodate dump_interface(); adjust call to build_module_descriptor(); add call to build_module_initializer_routine() for the GNU runtime. (generate_classref_translation_entry): Do not call start_decl(); call finish_var_decl() instead of finish_decl(); call convert() instead of build_c_cast(). * objc-act.h (CLASS_OWN_IVARS): Remove accessor. (CLASS_BINFO_ELTS): Reduce from 6 to 5, now that CLASS_OWN_IVARS is gone. (OCTI_GNU_INIT_DECL, GNU_INIT_decl): New. (OCTI_ELLIPSIS_NODE, objc_ellipsis_node): Remove. (OCTI_ID_ID, id_type, objc_id_id): Rename to OCTI_ID_NAME, objc_object_type and objc_object_name, respectively. (OCTI_CLS_REF, OCTI_CLASS_NAME, objc_class_reference, objc_class_name): New. (IS_CLASS): New macro. (IS_ID, IS_SUPER): Robustify. (OCTI_EXECCLASS_DECL, execclass_decl): New. (finish_file, start_class, continue_class, finish_class, start_method_def, continue_method_def, finish_method_def, start_protocol, finish_protocol, objc_build_throw_stmt, objc_build_try_catch_finally_stmt, objc_build_synchronized_prologue, objc_build_synchronized_epilogue, objc_build_try_prologue, objc_build_try_epilogue, objc_build_catch_stmt, objc_build_catch_epilogue, objc_build_finally_prologue, objc_build_finally_epilogue, is_ivar, is_private, is_public, add_instance_variable, objc_add_method, get_super_receiver, objc_clear_super_receiver, get_class_ivars_from_name, get_class_reference, get_static_reference, get_object_reference, build_message_expr, finish_message_expr, build_selector_expr, build_ivar_reference, build_keyword_decl, build_method_decl, build_protocol_expr, build_objc_string_object, objc_declare_alias, objc_declare_class, objc_declare_protocols, objc_comptypes, objc_check_decl, build_encode_expr): Remove prototypes. (imp_count, cat_count): Make GGC-aware. (OBJC_SET_TYPE_NAME): New macro. From-SVN: r87168
2004-09-08 02:49:44 +02:00
objc_finish_method_definition (tree fndecl)
splay-tree.c (splay_tree_predecessor): Fix typo in comment. * splay-tree.c (splay_tree_predecessor): Fix typo in comment. Convert the C front-end to use function-at-a-time mode. * c-common.h: Include splay-tree.h. (C_DECLARED_LABEL_FLAG): New macro. (struct language_function): Add x_scope_stmt_stack and x_function_name_declared_p. (RECHAIN_STMTS): Move definition. (lang_statment_code_p): Likewise. (lang_expand_stmt): Likewise. (lang_expand_decl_stmt): New variable. (lang_expand_function_end): Likewise. (current_scope_stmt_stack): New function. (add_decl_stmt): Likewise. (add_scope_stmt): Likewise. (mark_stmt_tree): Likewise. (struct c_lang_decl): New structure. (DECL_SAVED_TREE): Define. (c_mark_lang_decl): New function. (c_expand_start_cond): Change prototype. (c_finish_then): New function. (c_finish_else): Likewise. (current_function_name_declared): Remove. (set_current_function_name_declared): Likewise. (mark_c_language_function): Declare. (case_compare): Likewise. (c_add_case_label): Likewise. (c_expand_expr): Likewise. (c_safe_from_p): Likewise. * c-common.c (lang_expand_function_end): New variable. (struct if_elt): Add if_stmt. (c_expand_start_cond): Add the if-statement to the statement-tree, rather than generating RTL. (c_finish_then): New function. (c_expand_start_else): Don't generate RTL. (c_finish_else): New function. (c_expand_expr_stmt): Don't generate RTL. (statement_code_p): Add SCOPE_STMT. (case_compare): New function. (c_add_case_label): Likewise. (mark_stmt_tree): Likewise. (c_mark_lang_decl): Likewise. (mark_c_language_function): Likewise. (c_expand_expr): Likewise. (c_safe_from_p): Likewise. * c-decl.c (c_stmt_tree): New variable (c_scope_stmt_stack): Likewise. (c_function_name_declared_p): Likewise. (lang_expand_expr_stmt): Remove. (poplevel): Don't call output_inline_function for nested functions. (pushdecl): Don't set DECL_CONTEXT for a local declaration of an `extern' function. (redeclaration_error_message): Change means of computing whether or not a function is nested. (lookup_label): Don't call label_rtx. (init_decl_processing): Add more GC roots. (start_decl): Add DECL_STMTs to the statement-tree, rather than calling rest_of_decl_compilation. (finish_decl): Don't call expand_decl. (store_parm_decls): Begin the statement-tree, but don't generate RTL. (finish_function): Tie off the statement-tree. Call c_expand_body if appropriate. (c_expand_body): New function. (push_c_function_context): Save more information. (pop_c_function_contxt): Likewise. (copy_lang_decl): Now that we use DECL_LANG_SPECIFIC, copy it. (lang_mark_tree): Mark it. (current_stmt_tree): Adjust. (current_scope_stmt_stack): New function. (do_case): Remove. (set_current_name_declared): Likewise. (c_begin_compound_stmt): Define. (c_expand_decl_stmt): Likewise. * c-lang.c: Include rtl.h and expr.h. (lang_init): Set more language-specific hooks. * c-lex.c: Include expr.h. * c-parse.in: Changes throughout to add statements to the statement-tree, rather than generating RTL after every statement. * c-semantics.c (lang_expand_decl_stmt): Define. (add_decl_stmt): New function. (add_scope_stmt): Likewise. (finish_stmt_tree): Tweak. (genrtl_expr_stmt): Likewise. (genrtl_decl_stmt): Handle local labels, and call lang_expand_decl_stmt if required. (genrtl_for_stmt): Fix line-number handling. (genrtl_case_label): Handle cleanups. (genrtl_asm_stmt): Don't call combine_strings. (genrtl_compound_stmt): Simplify. (expand_stmt): Handle SCOPE_STMTs. * c-tree.h (struct lang_decl): New structure. (C_DECLARED_LABEL_FLAG): Remove. (c_begin_compound_stmt): Declare. (c_expand_decl_stmt): Likewise. (c_expand_start_case): Rename to c_start_case. (c_finish_case): New function. * c-typeck.c (start_init): Tweak setting of constructor_incremental. (c_expand_asm_operands): Tweak error-handling. Add to the statement-tree. (c_expand_return): Add to the statement-tree. (c_expand_start_case): Rename to ... (c_start_case): ... this. (struct c_switch): New type. (switch_stack): New variable. (do_case): Simplify. (c_finish_case): New function. * dependence.c: Include expr.h. (enum dependence_type): Change spelling of enumerals. (check_node_dependence): Adjust. * expr.h (lang_safe_from_p): Declare. (safe_from_p): Likewise. * expr.c (lang_safe_from_p): New variable. (safe_from_p): Give it external linkage. Use lang_safe_from_p. * stmt.c (expand_expr_stmt): Avoid clobberring of last_expr_type. * toplev.c (rest_of_decl_compilation): Robustify. * tree.c (contains_placeholder_p): Likewise. * Makefile.in: Update dependencies. * objc/objc-act.h: Adjust calculation of value for dummy_tree_code. * objc/objc-act.c: Include rtl.h, expr.h, and c-common.h. (objc_expand_function_end): New function. (finish_method_def): Use it. (init_objc): Initialize more language-specific hooks. * objc/Make-lang.in: Update dependencies. * cp-tree.h (struct cp_language_function): Remove x_scope_stmt_stack and name_declared. (current_scope_stmt_stack): Remove. (function_name_declared_p): New macro. (struct lang_decl_flags): Use c_lang_decl as a base class. (context): Remove. (struct lang_decl): Replace saved_tree with context. (DECL_FRIEND_CONTEXT): Adjust accordingly. (SET_DECL_FRIEND_CONTEXT): Likewise. (DECL_VIRTUAL_CONTEXT): Likewise. (DECL_SAVED_TREE): Remove. (C_DECLARED_LABEL_FLAG): Likewise. (cplus_expand_expr_stmt): Don't declare. (add_decl_stmt): Likewise. (add_scope_stmt): Likewise. * decl.c (mark_stmt_tree): Remove. (case_compare): Likewise. (finish_case_label): Use c_add_case_label. (init_decl_processing): Set more language-specific hooks. (build_enumerator): Fix typo in comment. (cplus_expand_expr_stmt): Remove. (mark_lang_function): Use mark_c_language_function. (lang_mark_tree): Use c_mark_lang_decl. * decl2.c: Change order of inclusion. * except.c: Likewise. * expr.c (cplus_expand_expr): Remove handling of STMT_EXPR. Fall back on c_expand_expr. * friend.c: Include expr.h. * init.c: Change order of inclusion. * Makefile.in: Update dependencies. * lex.h (free_lang_decl_chain): Remove. * optimize.c (maybe_clone_body): Use function_name_declared_p. * pt.c (build_template_decl): Don't copy DECL_VIRTUAL_CONTEXT if it doesn't exist. (instantiate_decl): Use function_name_declared_p. * semantics.c (lang_expand_expr_stmt): Remove. (set_current_function_name_declared): Likewise. (current_function_name_declared): Likewise. (begin_compound_stmt): Use function_name_declared_p. (add_decl_stmt): Remove. (setup_vtbl_ptr): Use function_name_declared_p. (add_scope_stmt): Remove. (current_scope_stmt_stack): New function. (cp_expand_stmt): Don't handle SCOPE_STMTs. (expand_body): Use function_name_declared_p. * tree.c (cp_statement_code_p): Don't include SCOPE_STMT. * typeck.c: Change order of includes. (convert_sequence): Remove. From-SVN: r36464
2000-09-17 09:38:23 +02:00
{
/* We cannot validly inline ObjC methods, at least not without a language
extension to declare that a method need not be dynamically
dispatched, so suppress all thoughts of doing so. */
Makefile.in (c-parse.o): Depend on $(C_COMMON_H). [gcc/ChangeLog] 2004-09-07 Ziemowit Laski <zlaski@apple.com> * Makefile.in (c-parse.o): Depend on $(C_COMMON_H). * c-parse.in: Include c-common.h instead of objc-act.h. (ivar_decl_list, ivar_decls, ivar_decl, ivars, ivar_declarator, myparms, myparm): Remove %type declarations. (methodtype, optparms, OBJC_TYPE_QUAL, objc_quals, objc_qual, objc_typename, objc_try_catch_stmt, optellipsis): Add %type declarations. (objc_inherit_code, objc_public_flag): Remove. (typespec_nonreserved_nonattr): Call objc_get_protocol_qualified_type() instead of get_static_reference() and get_protocol_reference(). (stmt_nocomp): Call grokparm() on @catch parameter. (objcdef): Move semantic action to objc_finish_implementation(). (classdef): Move semantic action to objc_start_class_interface(), objc_continue_interface(), objc_finish_interface(), objc_start_class_implementation(), objc_continue_implementation(), objc_start_category_interface() and objc_start_category_implementation(). (protocoldef): Move semantic actions to objc_start_protocol() and objc_finish_interface(). (ivar_decl_list): Remove nonterminal. (visibility_spec): Move semantic actions to objc_set_visibility(). (ivar_decls): Remove assignment to $$. (ivar_decl): Rephrase in terms of component_decl; call objc_add_instance_variable(). (ivars, ivar_declarator): Remove nonterminals. (opt_semi): New nonterminal. (methodtype): Remove semantic actions. (methoddef): Move semantic actions to objc_set_method_type(), objc_start_method_definition() and objc_finish_method_definition(). (methodproto): Move semantic actions to objc_set_method_type() and objc_add_method_declaration(). (methoddecl): Use objc_typename instead of typename; move semantic actions to objc_build_method_signature(). (optarglist, myxdecls, mydecl, myparms, myparm): Remove nonterminals. (optparmlist): Express in terms of optparms and optellipsis. (optparms, optellipsis, objc_qual, objc_quals, objc_typename): New nonterminals. (keyworddecl): Use objc_typename instead of typename. (rid_to_yy): Mark RID_IN, RID_OUT, RID_INOUT, RID_BYCOPY, RID_BYREF and RID_ONEWAY as returning OBJC_TYPE_QUAL to yyparse(). [gcc/objc/ChangeLog] 2004-09-07 Ziemowit Laski <zlaski@apple.com> * Make-lang.in (objc/objc-parse.o): Depend on $(C_COMMON_H) instead of objc/objc-act.h. (objc/objc-act.o): Depend on $(HASHTAB_H). * objc-act.c: Include hashtab.h; in ObjC++ mode, include cp-tree.h and objcp-decl.h instead of c-tree.h. (build_module_descriptor, get_class_ivars, synth_id_with_class_suffix, error_with_ivar, gen_method_decl, gen_declaration, setup_string_decl, build_protocol_template): Adjust prototypes. (build_module_initializer_routine, start_class, continue_class, finish_class, start_method_def, objc_start_function, start_protocol, build_method_decl, objc_add_method, add_instance_variable, build_ivar_reference, is_ivar, is_private, get_super_receiver, build_selector_table_decl, objc_push_parm, objc_get_parm_info, gen_type_name, gen_type_name_0, start_var_decl, finish_var_decl, create_field_decl): New prototypes. (objc_expand_function_end, comp_method_with_proto, objc_expr_last, gen_declaration_1, gen_declarator, is_complex_decl, adorn_decl, define_decl, create_builtin_decl, gen_declspecs): Remove prototypes. (TYPE_ID): Rename to OBJECT_TYPEDEF_NAME. (CLASS_TYPEDEF_NAME): New. (TAG_EXECCLASS): Change from a global variable to a #define. (TAG_RETURN_STRUCT): Delete. (TAG_GNUINIT): New, holds '__objc_gnu_init' name. (objc_inherit_code, objc_public_flag): New, moved from c-parse.in. (string_descriptor): New struct. (string_htab): New hash table. (string_hash, string_eq): New prototypes. (generate_struct_by_value_array): Call create_field_decl() instead of create_builtin_decl(). (objc_init): Do not initialize objc_ellipsis_node or TAG_EXECCLASS; In ObjC++ mode, call cxx_init() instead of c_objc_common_init(). (objc_finish_file): In ObjC++, call instantiate_pending_templates() and cp_finish_file(). (define_decl, get_static_reference, get_protocol_reference, create_builtin_decl): Remove functions. (objc_start_class_interface, objc_start_category_interface, objc_start_protocol, objc_continue_interface, objc_finish_interface, objc_start_class_implementation, objc_start_category_implementation, objc_continue_implementation, objc_finish_implementation, objc_set_visibility, objc_set_method_type, objc_build_method_signature, objc_add_method_declaration, objc_start_method_definition, objc_add_instance_variable, objc_get_protocol_qualified_type, create_field_decl, start_var_decl, finish_var_decl): New functions. (setup_string_decl): Simplify since it is only called once. (synth_module_prologue): Call build_class_template(); predefine 'id' and 'Class' as typedefs; rename 'temp_type' to 'type'; disable debug hooks for duration of function; fix GNU runtime messenger signatures to correspond to reality; forward-declare '__objc_exec_class' for the GNU runtime; call build_selector_table_decl(); in ObjC++ mode, generate 'extern "C" { ... }' wrappers around synthesized declarations; call build_protocol_template() and build_category_template(). (string_hash, string_eq): New functions. (objc_build_string_object): Check metaclass correctness only once; store string literals in hash table. (objc_build_constructor): Do not convert initializer elements; adjust for ObjC++ impedance mismatch. (build_objc_symtab_template): Call create_field_decl() instead of create_builtin_decl(). (init_objc_symtab): Add missing conversion to initializer element. (build_metadata_decl): Call start_var_decl() instead of define_decl(). (generate_objc_symtab_decl): Do not call build_category_template(); call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(). (build_module_descriptor): Call create_field_decl() instead of grokfield(); call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(); always mark module descriptor as used; move GNU runtime-specific functionality to build_module_initializer_routine(). (build_module_initializer_routine): New function, broken off of build_module_descriptor(). (objc_static_init_needed_p, objc_generate_static_init_call): New functions. (generate_static_references, generate_strings, build_selector_translation_table, generate_descriptor_table, generate_ivars_list, generate_dispatch_table, generate_category): Call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(); build a type directly instead of via groktypename(). (build_selector_reference_decl, build_selector_table_decl, build_class_reference_decl, build_protocol_reference, generate_objc_image_info): Call start_var_decl() instead of build_decl(). (build_selector_reference): For GNU runtime, do not call build_selector_reference_decl(). (build_selector, build_typed_selector_reference): Always convert result to the selector type. (add_objc_string): Cast return value to 'char *'. (build_method_prototype_template, build_selector_template, build_method_template): Use actual selector type for fields pointing to selectors. (finish_objc): For GNU runtime, call build_module_initializer_routine() after build_module_descriptor(). (generate_protocol_list, generate_shared_structures): Call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(); build a type directly instead of via groktypename(). (synth_id_with_class_suffix): Return a string. (get_arg_type_list): For instance methods, use the instance type for 'self'; do not call groktypename_in_parm_context(). (build_objc_string_decl): Squash redeclaration errors in ObjC++. (objc_is_class_name): Use OBJC_TYPE_NAME instead of TYPE_NAME; handle RECORD_TYPEs in ObjC as well as ObjC++. (objc_is_id): New function. (objc_is_object_ptr): Return the canonical type node. (objc_get_class_ivars): Simplify using get_class_ivars(). (get_class_ivars): Remove second parameter; create a fresh copy of the ivar list for each call; do not check for existence of super class. (objc_eh_runtime_type): Mark #ifndef OBJCPLUS. (objc_init_exceptions): When using SJLJ-style exceptions, require the use of '-fobjc-exceptions' flag; do not require it for DWARF-style exceptions. (objc_build_exc_ptr, next_sjlj_build_try_catch_finally): Use objc_object_type instead of objc_id_type. (objc_begin_catch_clause): Convert the incoming PARM_DECL into a VAR_DECL before placing it in the appropriate scope; do not call define_decl(); adjust call to c_begin_compound_stmt(); use objc_object_type instead of objc_id_type. (build_next_objc_exception_stuff): Call create_field_decl() instead of create_builtin_decl(); construct type directly instead of calling groktypename(); use OBJC_VOID_AT_END to mark end of function parameters. (build_private_template): Adjust call to get_class_ivars(); build a type directly instead of via groktypename(). (build_protocol_template, build_method_prototype_list_template, build_method_prototype_template, build_category_template, build_selector_template, build_class_template, build_super_template, build_ivar_template, build_ivar_list_template, build_method_list_template, build_method_template): Call create_field_decl() instead of grokfield(). (objc_method_parm_type): Do not call groktypename(). (generate_descriptor_table): Call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(). (generate_method_descriptors, build_protocol_initializer, generate_dispatch_tables, build_category_initializer, build_shared_structure_initializer): Do not call groktypename(). (generate_protocols): Call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(); do not call groktypename(). (error_with_ivar): Remove last parameter. (check_ivars): Do not iterate ovar CLASS_RAW_IVARS lists in addition to CLASS_IVARS lists; adjust calls to error_with_ivar(). (generate_ivar_lists): Convert one of the initializer elements; do not call groktypename(). (get_arg_type_list, start_method_def, gen_method_def): Account for new representation of variable arguments and '...' in Objective-C methods; add Objective-C++ impedance matching code. (is_objc_type_qualifier): Remove function. (adjust_type_for_id_default): Simplify; there is no longer a need to wade through declspecs. (lookup_interface, start_class, continue_class, finish_class, start_method_def, start_protocol, build_method_decl, objc_add_method, add_instance_variable, build_ivar_reference, is_ivar, is_private, get_super_receiver, objc_build_finally_epilogue): Make into static functions. (receiver_is_class_object): Use new IS_CLASS() macro. (objc_build_message_expr): Tweak ObjC++ message argument handling; call objc_finish_message_expr() instead of finish_message_expr(). (finish_message_expr): Rename to objc_finish_message_expr(); use OBJC_TYPE_NAME and OBJC_SET_TYPE_NAME macros instead of TYPE_NAME. call gen_type_name() instead of gen_declaration(); call objc_is_id() instead of using IS_ID and IS_CLASS; Use objc_class_name instead of calling get_identifier("Class"); handle CONVERT_EXPRs in receiver. (build_objc_method_call, warn_with_method): Do not call groktypename(). (build_ivar_reference): Call convert() instead of clobbering in a type. (hash_init): Initialize string_htab hash table. (add_instance_variable): Simplify parameter list; do not call grokfield(); do not populate CLASS_IVARS list. (start_class): Check for the existence of super class, if one was specified. (continue_class): Use CLASS_RAW_IVARS rather than CLASS_IVARS; do not call build_class_template(); adjust call to get_class_ivars(); call build_decl(), pushdecl() and finish_decl() instead of define_decl(). (finish_class): Call build_decl(), pushdecl() and finish_decl() instead of define_decl(). (add_protocols): Use PROTOCOL_BINFO_ELTS for the tree vector size. (start_protocol): Do not call build_protocol_template(); use PROTOCOL_BINFO_ELTS for the tree vector size. (encode_type_qualifiers): Do not handle the 'const' qualifier here. (encode_pointer): Encode 'const char *' as 'r*', for backwards compatibility. (encode_array): Use HOST_WIDE_INT_PRINT_DEC instead of "%ld". (encode_type): Handle the 'const' qualifier here. (objc_parmlist): New global variable, sued by objc_push_parm and objc_get_parm_info(). (objc_push_parm, objc_get_parm_info): New functions. (objc_expr_last): Remove function. (synth_self_and_ucmd_args): For instance methods, use the instance type for 'self'; call objc_push_parm() instead of push_parm_decl(). (start_method_def): Do not call push_scope(), declare_parm_level(), pop_scope(), push_parm_decl(), store_parm_decls() or objc_expr_last(); just use objc_push_parm() and objc_get_parm_info(). (comp_method_with_proto): Remove function. (objc_types_are_equivalent): Strip away indirections before comparing underlying types. (comp_proto_with_proto): Do not call groktypename(); types are no longer in raw declspec format. (objc_start_function): New function. (really_start_method): Call comp_proto_with_proto() instead of comp_method_with_proto(); call objc_start_function() instead of hand-crafting a function declarator. (continue_method_def, objc_expand_function_end): Remove functions. (get_super_receiver): Call objc_get_current_scope() instead of get_current_scope(); reference 'super_class' field (instead of 'class'). (finish_method_def): Rename to objc_finish_method_definition() and add a function decl parameter; move method encoding call from objc_expand_function_end(). (is_complex_decl, adorn_decl, gen_declarator, gen_declspecs, gen_declaration_1): Remove functions. (tmpbuf, RAW_DECLSPEC): Remove. (gen_declaration): Remove second parameter; simplify to deal with TYPE_P nodes instead of raw declspecs. (gen_type_name, gen_type_name_0): New functions. (gen_method_decl): Remove second parameter; call gen_type_name() instead of gen_declaration_1(). (dump_interface): Adjust calls to gen_declaration() and gen_method_decl(); do not allocate a separate string buffer. (init_objc): Allocate a larger string buffer to accommodate dump_interface(); adjust call to build_module_descriptor(); add call to build_module_initializer_routine() for the GNU runtime. (generate_classref_translation_entry): Do not call start_decl(); call finish_var_decl() instead of finish_decl(); call convert() instead of build_c_cast(). * objc-act.h (CLASS_OWN_IVARS): Remove accessor. (CLASS_BINFO_ELTS): Reduce from 6 to 5, now that CLASS_OWN_IVARS is gone. (OCTI_GNU_INIT_DECL, GNU_INIT_decl): New. (OCTI_ELLIPSIS_NODE, objc_ellipsis_node): Remove. (OCTI_ID_ID, id_type, objc_id_id): Rename to OCTI_ID_NAME, objc_object_type and objc_object_name, respectively. (OCTI_CLS_REF, OCTI_CLASS_NAME, objc_class_reference, objc_class_name): New. (IS_CLASS): New macro. (IS_ID, IS_SUPER): Robustify. (OCTI_EXECCLASS_DECL, execclass_decl): New. (finish_file, start_class, continue_class, finish_class, start_method_def, continue_method_def, finish_method_def, start_protocol, finish_protocol, objc_build_throw_stmt, objc_build_try_catch_finally_stmt, objc_build_synchronized_prologue, objc_build_synchronized_epilogue, objc_build_try_prologue, objc_build_try_epilogue, objc_build_catch_stmt, objc_build_catch_epilogue, objc_build_finally_prologue, objc_build_finally_epilogue, is_ivar, is_private, is_public, add_instance_variable, objc_add_method, get_super_receiver, objc_clear_super_receiver, get_class_ivars_from_name, get_class_reference, get_static_reference, get_object_reference, build_message_expr, finish_message_expr, build_selector_expr, build_ivar_reference, build_keyword_decl, build_method_decl, build_protocol_expr, build_objc_string_object, objc_declare_alias, objc_declare_class, objc_declare_protocols, objc_comptypes, objc_check_decl, build_encode_expr): Remove prototypes. (imp_count, cat_count): Make GGC-aware. (OBJC_SET_TYPE_NAME): New macro. From-SVN: r87168
2004-09-08 02:49:44 +02:00
DECL_INLINE (fndecl) = 0;
DECL_UNINLINABLE (fndecl) = 1;
Makefile.in (c-parse.o): Depend on $(C_COMMON_H). [gcc/ChangeLog] 2004-09-07 Ziemowit Laski <zlaski@apple.com> * Makefile.in (c-parse.o): Depend on $(C_COMMON_H). * c-parse.in: Include c-common.h instead of objc-act.h. (ivar_decl_list, ivar_decls, ivar_decl, ivars, ivar_declarator, myparms, myparm): Remove %type declarations. (methodtype, optparms, OBJC_TYPE_QUAL, objc_quals, objc_qual, objc_typename, objc_try_catch_stmt, optellipsis): Add %type declarations. (objc_inherit_code, objc_public_flag): Remove. (typespec_nonreserved_nonattr): Call objc_get_protocol_qualified_type() instead of get_static_reference() and get_protocol_reference(). (stmt_nocomp): Call grokparm() on @catch parameter. (objcdef): Move semantic action to objc_finish_implementation(). (classdef): Move semantic action to objc_start_class_interface(), objc_continue_interface(), objc_finish_interface(), objc_start_class_implementation(), objc_continue_implementation(), objc_start_category_interface() and objc_start_category_implementation(). (protocoldef): Move semantic actions to objc_start_protocol() and objc_finish_interface(). (ivar_decl_list): Remove nonterminal. (visibility_spec): Move semantic actions to objc_set_visibility(). (ivar_decls): Remove assignment to $$. (ivar_decl): Rephrase in terms of component_decl; call objc_add_instance_variable(). (ivars, ivar_declarator): Remove nonterminals. (opt_semi): New nonterminal. (methodtype): Remove semantic actions. (methoddef): Move semantic actions to objc_set_method_type(), objc_start_method_definition() and objc_finish_method_definition(). (methodproto): Move semantic actions to objc_set_method_type() and objc_add_method_declaration(). (methoddecl): Use objc_typename instead of typename; move semantic actions to objc_build_method_signature(). (optarglist, myxdecls, mydecl, myparms, myparm): Remove nonterminals. (optparmlist): Express in terms of optparms and optellipsis. (optparms, optellipsis, objc_qual, objc_quals, objc_typename): New nonterminals. (keyworddecl): Use objc_typename instead of typename. (rid_to_yy): Mark RID_IN, RID_OUT, RID_INOUT, RID_BYCOPY, RID_BYREF and RID_ONEWAY as returning OBJC_TYPE_QUAL to yyparse(). [gcc/objc/ChangeLog] 2004-09-07 Ziemowit Laski <zlaski@apple.com> * Make-lang.in (objc/objc-parse.o): Depend on $(C_COMMON_H) instead of objc/objc-act.h. (objc/objc-act.o): Depend on $(HASHTAB_H). * objc-act.c: Include hashtab.h; in ObjC++ mode, include cp-tree.h and objcp-decl.h instead of c-tree.h. (build_module_descriptor, get_class_ivars, synth_id_with_class_suffix, error_with_ivar, gen_method_decl, gen_declaration, setup_string_decl, build_protocol_template): Adjust prototypes. (build_module_initializer_routine, start_class, continue_class, finish_class, start_method_def, objc_start_function, start_protocol, build_method_decl, objc_add_method, add_instance_variable, build_ivar_reference, is_ivar, is_private, get_super_receiver, build_selector_table_decl, objc_push_parm, objc_get_parm_info, gen_type_name, gen_type_name_0, start_var_decl, finish_var_decl, create_field_decl): New prototypes. (objc_expand_function_end, comp_method_with_proto, objc_expr_last, gen_declaration_1, gen_declarator, is_complex_decl, adorn_decl, define_decl, create_builtin_decl, gen_declspecs): Remove prototypes. (TYPE_ID): Rename to OBJECT_TYPEDEF_NAME. (CLASS_TYPEDEF_NAME): New. (TAG_EXECCLASS): Change from a global variable to a #define. (TAG_RETURN_STRUCT): Delete. (TAG_GNUINIT): New, holds '__objc_gnu_init' name. (objc_inherit_code, objc_public_flag): New, moved from c-parse.in. (string_descriptor): New struct. (string_htab): New hash table. (string_hash, string_eq): New prototypes. (generate_struct_by_value_array): Call create_field_decl() instead of create_builtin_decl(). (objc_init): Do not initialize objc_ellipsis_node or TAG_EXECCLASS; In ObjC++ mode, call cxx_init() instead of c_objc_common_init(). (objc_finish_file): In ObjC++, call instantiate_pending_templates() and cp_finish_file(). (define_decl, get_static_reference, get_protocol_reference, create_builtin_decl): Remove functions. (objc_start_class_interface, objc_start_category_interface, objc_start_protocol, objc_continue_interface, objc_finish_interface, objc_start_class_implementation, objc_start_category_implementation, objc_continue_implementation, objc_finish_implementation, objc_set_visibility, objc_set_method_type, objc_build_method_signature, objc_add_method_declaration, objc_start_method_definition, objc_add_instance_variable, objc_get_protocol_qualified_type, create_field_decl, start_var_decl, finish_var_decl): New functions. (setup_string_decl): Simplify since it is only called once. (synth_module_prologue): Call build_class_template(); predefine 'id' and 'Class' as typedefs; rename 'temp_type' to 'type'; disable debug hooks for duration of function; fix GNU runtime messenger signatures to correspond to reality; forward-declare '__objc_exec_class' for the GNU runtime; call build_selector_table_decl(); in ObjC++ mode, generate 'extern "C" { ... }' wrappers around synthesized declarations; call build_protocol_template() and build_category_template(). (string_hash, string_eq): New functions. (objc_build_string_object): Check metaclass correctness only once; store string literals in hash table. (objc_build_constructor): Do not convert initializer elements; adjust for ObjC++ impedance mismatch. (build_objc_symtab_template): Call create_field_decl() instead of create_builtin_decl(). (init_objc_symtab): Add missing conversion to initializer element. (build_metadata_decl): Call start_var_decl() instead of define_decl(). (generate_objc_symtab_decl): Do not call build_category_template(); call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(). (build_module_descriptor): Call create_field_decl() instead of grokfield(); call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(); always mark module descriptor as used; move GNU runtime-specific functionality to build_module_initializer_routine(). (build_module_initializer_routine): New function, broken off of build_module_descriptor(). (objc_static_init_needed_p, objc_generate_static_init_call): New functions. (generate_static_references, generate_strings, build_selector_translation_table, generate_descriptor_table, generate_ivars_list, generate_dispatch_table, generate_category): Call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(); build a type directly instead of via groktypename(). (build_selector_reference_decl, build_selector_table_decl, build_class_reference_decl, build_protocol_reference, generate_objc_image_info): Call start_var_decl() instead of build_decl(). (build_selector_reference): For GNU runtime, do not call build_selector_reference_decl(). (build_selector, build_typed_selector_reference): Always convert result to the selector type. (add_objc_string): Cast return value to 'char *'. (build_method_prototype_template, build_selector_template, build_method_template): Use actual selector type for fields pointing to selectors. (finish_objc): For GNU runtime, call build_module_initializer_routine() after build_module_descriptor(). (generate_protocol_list, generate_shared_structures): Call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(); build a type directly instead of via groktypename(). (synth_id_with_class_suffix): Return a string. (get_arg_type_list): For instance methods, use the instance type for 'self'; do not call groktypename_in_parm_context(). (build_objc_string_decl): Squash redeclaration errors in ObjC++. (objc_is_class_name): Use OBJC_TYPE_NAME instead of TYPE_NAME; handle RECORD_TYPEs in ObjC as well as ObjC++. (objc_is_id): New function. (objc_is_object_ptr): Return the canonical type node. (objc_get_class_ivars): Simplify using get_class_ivars(). (get_class_ivars): Remove second parameter; create a fresh copy of the ivar list for each call; do not check for existence of super class. (objc_eh_runtime_type): Mark #ifndef OBJCPLUS. (objc_init_exceptions): When using SJLJ-style exceptions, require the use of '-fobjc-exceptions' flag; do not require it for DWARF-style exceptions. (objc_build_exc_ptr, next_sjlj_build_try_catch_finally): Use objc_object_type instead of objc_id_type. (objc_begin_catch_clause): Convert the incoming PARM_DECL into a VAR_DECL before placing it in the appropriate scope; do not call define_decl(); adjust call to c_begin_compound_stmt(); use objc_object_type instead of objc_id_type. (build_next_objc_exception_stuff): Call create_field_decl() instead of create_builtin_decl(); construct type directly instead of calling groktypename(); use OBJC_VOID_AT_END to mark end of function parameters. (build_private_template): Adjust call to get_class_ivars(); build a type directly instead of via groktypename(). (build_protocol_template, build_method_prototype_list_template, build_method_prototype_template, build_category_template, build_selector_template, build_class_template, build_super_template, build_ivar_template, build_ivar_list_template, build_method_list_template, build_method_template): Call create_field_decl() instead of grokfield(). (objc_method_parm_type): Do not call groktypename(). (generate_descriptor_table): Call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(). (generate_method_descriptors, build_protocol_initializer, generate_dispatch_tables, build_category_initializer, build_shared_structure_initializer): Do not call groktypename(). (generate_protocols): Call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(); do not call groktypename(). (error_with_ivar): Remove last parameter. (check_ivars): Do not iterate ovar CLASS_RAW_IVARS lists in addition to CLASS_IVARS lists; adjust calls to error_with_ivar(). (generate_ivar_lists): Convert one of the initializer elements; do not call groktypename(). (get_arg_type_list, start_method_def, gen_method_def): Account for new representation of variable arguments and '...' in Objective-C methods; add Objective-C++ impedance matching code. (is_objc_type_qualifier): Remove function. (adjust_type_for_id_default): Simplify; there is no longer a need to wade through declspecs. (lookup_interface, start_class, continue_class, finish_class, start_method_def, start_protocol, build_method_decl, objc_add_method, add_instance_variable, build_ivar_reference, is_ivar, is_private, get_super_receiver, objc_build_finally_epilogue): Make into static functions. (receiver_is_class_object): Use new IS_CLASS() macro. (objc_build_message_expr): Tweak ObjC++ message argument handling; call objc_finish_message_expr() instead of finish_message_expr(). (finish_message_expr): Rename to objc_finish_message_expr(); use OBJC_TYPE_NAME and OBJC_SET_TYPE_NAME macros instead of TYPE_NAME. call gen_type_name() instead of gen_declaration(); call objc_is_id() instead of using IS_ID and IS_CLASS; Use objc_class_name instead of calling get_identifier("Class"); handle CONVERT_EXPRs in receiver. (build_objc_method_call, warn_with_method): Do not call groktypename(). (build_ivar_reference): Call convert() instead of clobbering in a type. (hash_init): Initialize string_htab hash table. (add_instance_variable): Simplify parameter list; do not call grokfield(); do not populate CLASS_IVARS list. (start_class): Check for the existence of super class, if one was specified. (continue_class): Use CLASS_RAW_IVARS rather than CLASS_IVARS; do not call build_class_template(); adjust call to get_class_ivars(); call build_decl(), pushdecl() and finish_decl() instead of define_decl(). (finish_class): Call build_decl(), pushdecl() and finish_decl() instead of define_decl(). (add_protocols): Use PROTOCOL_BINFO_ELTS for the tree vector size. (start_protocol): Do not call build_protocol_template(); use PROTOCOL_BINFO_ELTS for the tree vector size. (encode_type_qualifiers): Do not handle the 'const' qualifier here. (encode_pointer): Encode 'const char *' as 'r*', for backwards compatibility. (encode_array): Use HOST_WIDE_INT_PRINT_DEC instead of "%ld". (encode_type): Handle the 'const' qualifier here. (objc_parmlist): New global variable, sued by objc_push_parm and objc_get_parm_info(). (objc_push_parm, objc_get_parm_info): New functions. (objc_expr_last): Remove function. (synth_self_and_ucmd_args): For instance methods, use the instance type for 'self'; call objc_push_parm() instead of push_parm_decl(). (start_method_def): Do not call push_scope(), declare_parm_level(), pop_scope(), push_parm_decl(), store_parm_decls() or objc_expr_last(); just use objc_push_parm() and objc_get_parm_info(). (comp_method_with_proto): Remove function. (objc_types_are_equivalent): Strip away indirections before comparing underlying types. (comp_proto_with_proto): Do not call groktypename(); types are no longer in raw declspec format. (objc_start_function): New function. (really_start_method): Call comp_proto_with_proto() instead of comp_method_with_proto(); call objc_start_function() instead of hand-crafting a function declarator. (continue_method_def, objc_expand_function_end): Remove functions. (get_super_receiver): Call objc_get_current_scope() instead of get_current_scope(); reference 'super_class' field (instead of 'class'). (finish_method_def): Rename to objc_finish_method_definition() and add a function decl parameter; move method encoding call from objc_expand_function_end(). (is_complex_decl, adorn_decl, gen_declarator, gen_declspecs, gen_declaration_1): Remove functions. (tmpbuf, RAW_DECLSPEC): Remove. (gen_declaration): Remove second parameter; simplify to deal with TYPE_P nodes instead of raw declspecs. (gen_type_name, gen_type_name_0): New functions. (gen_method_decl): Remove second parameter; call gen_type_name() instead of gen_declaration_1(). (dump_interface): Adjust calls to gen_declaration() and gen_method_decl(); do not allocate a separate string buffer. (init_objc): Allocate a larger string buffer to accommodate dump_interface(); adjust call to build_module_descriptor(); add call to build_module_initializer_routine() for the GNU runtime. (generate_classref_translation_entry): Do not call start_decl(); call finish_var_decl() instead of finish_decl(); call convert() instead of build_c_cast(). * objc-act.h (CLASS_OWN_IVARS): Remove accessor. (CLASS_BINFO_ELTS): Reduce from 6 to 5, now that CLASS_OWN_IVARS is gone. (OCTI_GNU_INIT_DECL, GNU_INIT_decl): New. (OCTI_ELLIPSIS_NODE, objc_ellipsis_node): Remove. (OCTI_ID_ID, id_type, objc_id_id): Rename to OCTI_ID_NAME, objc_object_type and objc_object_name, respectively. (OCTI_CLS_REF, OCTI_CLASS_NAME, objc_class_reference, objc_class_name): New. (IS_CLASS): New macro. (IS_ID, IS_SUPER): Robustify. (OCTI_EXECCLASS_DECL, execclass_decl): New. (finish_file, start_class, continue_class, finish_class, start_method_def, continue_method_def, finish_method_def, start_protocol, finish_protocol, objc_build_throw_stmt, objc_build_try_catch_finally_stmt, objc_build_synchronized_prologue, objc_build_synchronized_epilogue, objc_build_try_prologue, objc_build_try_epilogue, objc_build_catch_stmt, objc_build_catch_epilogue, objc_build_finally_prologue, objc_build_finally_epilogue, is_ivar, is_private, is_public, add_instance_variable, objc_add_method, get_super_receiver, objc_clear_super_receiver, get_class_ivars_from_name, get_class_reference, get_static_reference, get_object_reference, build_message_expr, finish_message_expr, build_selector_expr, build_ivar_reference, build_keyword_decl, build_method_decl, build_protocol_expr, build_objc_string_object, objc_declare_alias, objc_declare_class, objc_declare_protocols, objc_comptypes, objc_check_decl, build_encode_expr): Remove prototypes. (imp_count, cat_count): Make GGC-aware. (OBJC_SET_TYPE_NAME): New macro. From-SVN: r87168
2004-09-08 02:49:44 +02:00
#ifndef OBJCPLUS
/* The C++ front-end will have called finish_function() for us. */
finish_function ();
Makefile.in (c-parse.o): Depend on $(C_COMMON_H). [gcc/ChangeLog] 2004-09-07 Ziemowit Laski <zlaski@apple.com> * Makefile.in (c-parse.o): Depend on $(C_COMMON_H). * c-parse.in: Include c-common.h instead of objc-act.h. (ivar_decl_list, ivar_decls, ivar_decl, ivars, ivar_declarator, myparms, myparm): Remove %type declarations. (methodtype, optparms, OBJC_TYPE_QUAL, objc_quals, objc_qual, objc_typename, objc_try_catch_stmt, optellipsis): Add %type declarations. (objc_inherit_code, objc_public_flag): Remove. (typespec_nonreserved_nonattr): Call objc_get_protocol_qualified_type() instead of get_static_reference() and get_protocol_reference(). (stmt_nocomp): Call grokparm() on @catch parameter. (objcdef): Move semantic action to objc_finish_implementation(). (classdef): Move semantic action to objc_start_class_interface(), objc_continue_interface(), objc_finish_interface(), objc_start_class_implementation(), objc_continue_implementation(), objc_start_category_interface() and objc_start_category_implementation(). (protocoldef): Move semantic actions to objc_start_protocol() and objc_finish_interface(). (ivar_decl_list): Remove nonterminal. (visibility_spec): Move semantic actions to objc_set_visibility(). (ivar_decls): Remove assignment to $$. (ivar_decl): Rephrase in terms of component_decl; call objc_add_instance_variable(). (ivars, ivar_declarator): Remove nonterminals. (opt_semi): New nonterminal. (methodtype): Remove semantic actions. (methoddef): Move semantic actions to objc_set_method_type(), objc_start_method_definition() and objc_finish_method_definition(). (methodproto): Move semantic actions to objc_set_method_type() and objc_add_method_declaration(). (methoddecl): Use objc_typename instead of typename; move semantic actions to objc_build_method_signature(). (optarglist, myxdecls, mydecl, myparms, myparm): Remove nonterminals. (optparmlist): Express in terms of optparms and optellipsis. (optparms, optellipsis, objc_qual, objc_quals, objc_typename): New nonterminals. (keyworddecl): Use objc_typename instead of typename. (rid_to_yy): Mark RID_IN, RID_OUT, RID_INOUT, RID_BYCOPY, RID_BYREF and RID_ONEWAY as returning OBJC_TYPE_QUAL to yyparse(). [gcc/objc/ChangeLog] 2004-09-07 Ziemowit Laski <zlaski@apple.com> * Make-lang.in (objc/objc-parse.o): Depend on $(C_COMMON_H) instead of objc/objc-act.h. (objc/objc-act.o): Depend on $(HASHTAB_H). * objc-act.c: Include hashtab.h; in ObjC++ mode, include cp-tree.h and objcp-decl.h instead of c-tree.h. (build_module_descriptor, get_class_ivars, synth_id_with_class_suffix, error_with_ivar, gen_method_decl, gen_declaration, setup_string_decl, build_protocol_template): Adjust prototypes. (build_module_initializer_routine, start_class, continue_class, finish_class, start_method_def, objc_start_function, start_protocol, build_method_decl, objc_add_method, add_instance_variable, build_ivar_reference, is_ivar, is_private, get_super_receiver, build_selector_table_decl, objc_push_parm, objc_get_parm_info, gen_type_name, gen_type_name_0, start_var_decl, finish_var_decl, create_field_decl): New prototypes. (objc_expand_function_end, comp_method_with_proto, objc_expr_last, gen_declaration_1, gen_declarator, is_complex_decl, adorn_decl, define_decl, create_builtin_decl, gen_declspecs): Remove prototypes. (TYPE_ID): Rename to OBJECT_TYPEDEF_NAME. (CLASS_TYPEDEF_NAME): New. (TAG_EXECCLASS): Change from a global variable to a #define. (TAG_RETURN_STRUCT): Delete. (TAG_GNUINIT): New, holds '__objc_gnu_init' name. (objc_inherit_code, objc_public_flag): New, moved from c-parse.in. (string_descriptor): New struct. (string_htab): New hash table. (string_hash, string_eq): New prototypes. (generate_struct_by_value_array): Call create_field_decl() instead of create_builtin_decl(). (objc_init): Do not initialize objc_ellipsis_node or TAG_EXECCLASS; In ObjC++ mode, call cxx_init() instead of c_objc_common_init(). (objc_finish_file): In ObjC++, call instantiate_pending_templates() and cp_finish_file(). (define_decl, get_static_reference, get_protocol_reference, create_builtin_decl): Remove functions. (objc_start_class_interface, objc_start_category_interface, objc_start_protocol, objc_continue_interface, objc_finish_interface, objc_start_class_implementation, objc_start_category_implementation, objc_continue_implementation, objc_finish_implementation, objc_set_visibility, objc_set_method_type, objc_build_method_signature, objc_add_method_declaration, objc_start_method_definition, objc_add_instance_variable, objc_get_protocol_qualified_type, create_field_decl, start_var_decl, finish_var_decl): New functions. (setup_string_decl): Simplify since it is only called once. (synth_module_prologue): Call build_class_template(); predefine 'id' and 'Class' as typedefs; rename 'temp_type' to 'type'; disable debug hooks for duration of function; fix GNU runtime messenger signatures to correspond to reality; forward-declare '__objc_exec_class' for the GNU runtime; call build_selector_table_decl(); in ObjC++ mode, generate 'extern "C" { ... }' wrappers around synthesized declarations; call build_protocol_template() and build_category_template(). (string_hash, string_eq): New functions. (objc_build_string_object): Check metaclass correctness only once; store string literals in hash table. (objc_build_constructor): Do not convert initializer elements; adjust for ObjC++ impedance mismatch. (build_objc_symtab_template): Call create_field_decl() instead of create_builtin_decl(). (init_objc_symtab): Add missing conversion to initializer element. (build_metadata_decl): Call start_var_decl() instead of define_decl(). (generate_objc_symtab_decl): Do not call build_category_template(); call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(). (build_module_descriptor): Call create_field_decl() instead of grokfield(); call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(); always mark module descriptor as used; move GNU runtime-specific functionality to build_module_initializer_routine(). (build_module_initializer_routine): New function, broken off of build_module_descriptor(). (objc_static_init_needed_p, objc_generate_static_init_call): New functions. (generate_static_references, generate_strings, build_selector_translation_table, generate_descriptor_table, generate_ivars_list, generate_dispatch_table, generate_category): Call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(); build a type directly instead of via groktypename(). (build_selector_reference_decl, build_selector_table_decl, build_class_reference_decl, build_protocol_reference, generate_objc_image_info): Call start_var_decl() instead of build_decl(). (build_selector_reference): For GNU runtime, do not call build_selector_reference_decl(). (build_selector, build_typed_selector_reference): Always convert result to the selector type. (add_objc_string): Cast return value to 'char *'. (build_method_prototype_template, build_selector_template, build_method_template): Use actual selector type for fields pointing to selectors. (finish_objc): For GNU runtime, call build_module_initializer_routine() after build_module_descriptor(). (generate_protocol_list, generate_shared_structures): Call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(); build a type directly instead of via groktypename(). (synth_id_with_class_suffix): Return a string. (get_arg_type_list): For instance methods, use the instance type for 'self'; do not call groktypename_in_parm_context(). (build_objc_string_decl): Squash redeclaration errors in ObjC++. (objc_is_class_name): Use OBJC_TYPE_NAME instead of TYPE_NAME; handle RECORD_TYPEs in ObjC as well as ObjC++. (objc_is_id): New function. (objc_is_object_ptr): Return the canonical type node. (objc_get_class_ivars): Simplify using get_class_ivars(). (get_class_ivars): Remove second parameter; create a fresh copy of the ivar list for each call; do not check for existence of super class. (objc_eh_runtime_type): Mark #ifndef OBJCPLUS. (objc_init_exceptions): When using SJLJ-style exceptions, require the use of '-fobjc-exceptions' flag; do not require it for DWARF-style exceptions. (objc_build_exc_ptr, next_sjlj_build_try_catch_finally): Use objc_object_type instead of objc_id_type. (objc_begin_catch_clause): Convert the incoming PARM_DECL into a VAR_DECL before placing it in the appropriate scope; do not call define_decl(); adjust call to c_begin_compound_stmt(); use objc_object_type instead of objc_id_type. (build_next_objc_exception_stuff): Call create_field_decl() instead of create_builtin_decl(); construct type directly instead of calling groktypename(); use OBJC_VOID_AT_END to mark end of function parameters. (build_private_template): Adjust call to get_class_ivars(); build a type directly instead of via groktypename(). (build_protocol_template, build_method_prototype_list_template, build_method_prototype_template, build_category_template, build_selector_template, build_class_template, build_super_template, build_ivar_template, build_ivar_list_template, build_method_list_template, build_method_template): Call create_field_decl() instead of grokfield(). (objc_method_parm_type): Do not call groktypename(). (generate_descriptor_table): Call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(). (generate_method_descriptors, build_protocol_initializer, generate_dispatch_tables, build_category_initializer, build_shared_structure_initializer): Do not call groktypename(). (generate_protocols): Call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(); do not call groktypename(). (error_with_ivar): Remove last parameter. (check_ivars): Do not iterate ovar CLASS_RAW_IVARS lists in addition to CLASS_IVARS lists; adjust calls to error_with_ivar(). (generate_ivar_lists): Convert one of the initializer elements; do not call groktypename(). (get_arg_type_list, start_method_def, gen_method_def): Account for new representation of variable arguments and '...' in Objective-C methods; add Objective-C++ impedance matching code. (is_objc_type_qualifier): Remove function. (adjust_type_for_id_default): Simplify; there is no longer a need to wade through declspecs. (lookup_interface, start_class, continue_class, finish_class, start_method_def, start_protocol, build_method_decl, objc_add_method, add_instance_variable, build_ivar_reference, is_ivar, is_private, get_super_receiver, objc_build_finally_epilogue): Make into static functions. (receiver_is_class_object): Use new IS_CLASS() macro. (objc_build_message_expr): Tweak ObjC++ message argument handling; call objc_finish_message_expr() instead of finish_message_expr(). (finish_message_expr): Rename to objc_finish_message_expr(); use OBJC_TYPE_NAME and OBJC_SET_TYPE_NAME macros instead of TYPE_NAME. call gen_type_name() instead of gen_declaration(); call objc_is_id() instead of using IS_ID and IS_CLASS; Use objc_class_name instead of calling get_identifier("Class"); handle CONVERT_EXPRs in receiver. (build_objc_method_call, warn_with_method): Do not call groktypename(). (build_ivar_reference): Call convert() instead of clobbering in a type. (hash_init): Initialize string_htab hash table. (add_instance_variable): Simplify parameter list; do not call grokfield(); do not populate CLASS_IVARS list. (start_class): Check for the existence of super class, if one was specified. (continue_class): Use CLASS_RAW_IVARS rather than CLASS_IVARS; do not call build_class_template(); adjust call to get_class_ivars(); call build_decl(), pushdecl() and finish_decl() instead of define_decl(). (finish_class): Call build_decl(), pushdecl() and finish_decl() instead of define_decl(). (add_protocols): Use PROTOCOL_BINFO_ELTS for the tree vector size. (start_protocol): Do not call build_protocol_template(); use PROTOCOL_BINFO_ELTS for the tree vector size. (encode_type_qualifiers): Do not handle the 'const' qualifier here. (encode_pointer): Encode 'const char *' as 'r*', for backwards compatibility. (encode_array): Use HOST_WIDE_INT_PRINT_DEC instead of "%ld". (encode_type): Handle the 'const' qualifier here. (objc_parmlist): New global variable, sued by objc_push_parm and objc_get_parm_info(). (objc_push_parm, objc_get_parm_info): New functions. (objc_expr_last): Remove function. (synth_self_and_ucmd_args): For instance methods, use the instance type for 'self'; call objc_push_parm() instead of push_parm_decl(). (start_method_def): Do not call push_scope(), declare_parm_level(), pop_scope(), push_parm_decl(), store_parm_decls() or objc_expr_last(); just use objc_push_parm() and objc_get_parm_info(). (comp_method_with_proto): Remove function. (objc_types_are_equivalent): Strip away indirections before comparing underlying types. (comp_proto_with_proto): Do not call groktypename(); types are no longer in raw declspec format. (objc_start_function): New function. (really_start_method): Call comp_proto_with_proto() instead of comp_method_with_proto(); call objc_start_function() instead of hand-crafting a function declarator. (continue_method_def, objc_expand_function_end): Remove functions. (get_super_receiver): Call objc_get_current_scope() instead of get_current_scope(); reference 'super_class' field (instead of 'class'). (finish_method_def): Rename to objc_finish_method_definition() and add a function decl parameter; move method encoding call from objc_expand_function_end(). (is_complex_decl, adorn_decl, gen_declarator, gen_declspecs, gen_declaration_1): Remove functions. (tmpbuf, RAW_DECLSPEC): Remove. (gen_declaration): Remove second parameter; simplify to deal with TYPE_P nodes instead of raw declspecs. (gen_type_name, gen_type_name_0): New functions. (gen_method_decl): Remove second parameter; call gen_type_name() instead of gen_declaration_1(). (dump_interface): Adjust calls to gen_declaration() and gen_method_decl(); do not allocate a separate string buffer. (init_objc): Allocate a larger string buffer to accommodate dump_interface(); adjust call to build_module_descriptor(); add call to build_module_initializer_routine() for the GNU runtime. (generate_classref_translation_entry): Do not call start_decl(); call finish_var_decl() instead of finish_decl(); call convert() instead of build_c_cast(). * objc-act.h (CLASS_OWN_IVARS): Remove accessor. (CLASS_BINFO_ELTS): Reduce from 6 to 5, now that CLASS_OWN_IVARS is gone. (OCTI_GNU_INIT_DECL, GNU_INIT_decl): New. (OCTI_ELLIPSIS_NODE, objc_ellipsis_node): Remove. (OCTI_ID_ID, id_type, objc_id_id): Rename to OCTI_ID_NAME, objc_object_type and objc_object_name, respectively. (OCTI_CLS_REF, OCTI_CLASS_NAME, objc_class_reference, objc_class_name): New. (IS_CLASS): New macro. (IS_ID, IS_SUPER): Robustify. (OCTI_EXECCLASS_DECL, execclass_decl): New. (finish_file, start_class, continue_class, finish_class, start_method_def, continue_method_def, finish_method_def, start_protocol, finish_protocol, objc_build_throw_stmt, objc_build_try_catch_finally_stmt, objc_build_synchronized_prologue, objc_build_synchronized_epilogue, objc_build_try_prologue, objc_build_try_epilogue, objc_build_catch_stmt, objc_build_catch_epilogue, objc_build_finally_prologue, objc_build_finally_epilogue, is_ivar, is_private, is_public, add_instance_variable, objc_add_method, get_super_receiver, objc_clear_super_receiver, get_class_ivars_from_name, get_class_reference, get_static_reference, get_object_reference, build_message_expr, finish_message_expr, build_selector_expr, build_ivar_reference, build_keyword_decl, build_method_decl, build_protocol_expr, build_objc_string_object, objc_declare_alias, objc_declare_class, objc_declare_protocols, objc_comptypes, objc_check_decl, build_encode_expr): Remove prototypes. (imp_count, cat_count): Make GGC-aware. (OBJC_SET_TYPE_NAME): New macro. From-SVN: r87168
2004-09-08 02:49:44 +02:00
#endif
METHOD_ENCODING (objc_method_context)
= encode_method_prototype (objc_method_context);
1992-01-18 00:15:38 +01:00
/* Required to implement _msgSuper. This must be done AFTER finish_function,
since the optimizer may find "may be used before set" errors. */
c-parse.in (objc_inherit_code, [...]): Make static. 2001-10-03 Ziemowit Laski <zlaski@apple.com> * c-parse.in (objc_inherit_code, objc_pq_context, objc_public_flag): Make static. (objc_interface_context, objc_implementation_context, objc_method_context, objc_ivar_chain, objc_ivar_context): Move to global tree array in objc/objc-act.[ch]. (methoddef): Remove unnecessary code. * objc/objc-act.c: (hashed_attribute, hashed_entry, imp_entry): Hoist struct definitions to objc-act.h. (nst_method_hash_list, cls_method_hash_list, imp_list, imp_count, cat_count): Place declaration in objc-act.h. (objc_tree_index): Move enumeration to objc-act.h. (objc_global_trees): Place declaration and macro accessors in objc-act.h. (implementation_context): Remove duplicate; use objc_implementation_context instead: (method_context): Remove duplicate; use objc_method_context instead. (objc_ellipsis_node, objc_method_prototype_template, implemented_classes, function_type): Move global vars to objc_global_trees. (init_objc): Use LAST_BASE_TREE_CODE instead of LAST_CODE. (build_message_expr): Move actual construction of ObjC message send nodes to finish_message_expr. (finish_message_expr): New routine, contains code formerly in build_message_expr. * objc/objc-act.h (finish_message_expr): New prototype. (objc_ivar_chain, objc_method_context, objc_ellipsis_node): Remove declarations; these vars are now part of objc_global_trees. (objc_tree_index, objc_global_trees): Move definitions from objc-act.c. * objc/objc-tree.def: Update copyright info. From-SVN: r46000
2001-10-04 00:05:57 +02:00
objc_method_context = NULL_TREE;
Yet more Objective-C++... * objc-act.c (objc_finish_try_stmt): Add return value. (objc_build_synchronized): Likewise. * objc-act.c (objc_is_gcable_type): Add. (objc_substitute_decl): Add. (objc_build_ivar_assignment): Add. (objc_build_global_assignment): Add. (objc_build_strong_cast_assignment): Add. (objc_is_ivar_reference_p): Add. (objc_is_global_reference_p): Add. (objc_generate_write_barrier): Add. (objc_rewrite_function_call): Add. (objc_gimplify_expr): Add Objective-C++ support. * objc-act.h (ALLOC_OBJC_TYPE_LANG_SPECIFIC): Likewise. (SIZEOF_OBJC_TYPE_LANG_SPECIFIC): Add. (INIT_TYPE_OBJC_INFO): Add Objective-C++ support. (DUP_TYPE_OBJC_INFO): Likewise. (struct imp_entry): Add field has_cxx_cdtors. (struct imp_entry *imp_list): Add OCTI_UMSG_FAST_DECL, OCTI_METH_LIST_TEMPL, OCTI_METH_PROTO_LIST_TEMPL, OCTI_IVAR_LIST_TEMPL, OCTI_ASSIGN_IVAR_DECL, OCTI_ASSIGN_IVAR_FAST_DECL, OCTI_ASSIGN_GLOBAL_DECL, OCTI_ASSIGN_STRONGCAST_DECL. (umsg_fast_decl): Add. (objc_assign_ivar_decl): Add. (objc_assign_ivar_fast_decl): Add. (objc_assign_global_decl): Add. (objc_assign_strong_cast_decl): Add. (objc_method_list_ptr): Add. (objc_method_proto_list_ptr): Add. (objc_ivar_list_ptr): Add. * objc-act.c (should_call_super_dealloc): Add. (OBJC_VERSION): Bump to 6. (objc_is_gcable_type): Add. (objc_substitute_decl): Add. (objc_build_ivar_assignment): Add. (objc_build_global_assignment): Add. (objc_build_strong_cast_assignment): Add. (objc_is_gcable_p): Add. (objc_is_ivar_reference_p): Add. (objc_is_global_reference_p): Add. (generate_shared_structures): Add flags parameter. (objc_generate_cxx_ctor_or_dtor): Add. (objc_generate_cxx_cdtors): Add. (add_class): Add name parameter. (objc_types_share_size_and_alignment): Add. (comp_proto_with_proto): Add strict parameter. (CLS_HAS_CXX_STRUCTORS): Add. (TAG_ASSIGNIVAR): Add. (TAG_ASSIGNGLOBAL): Add. (TAG_ASSIGNSTRONGCAST): Add. (TAG_MSGSEND_FAST): Add. (TAG_ASSIGNIVAR_FAST): Add. (TAG_CXX_CONSTRUCT): Add. (TAG_CXX_DESTRUCT): Add. (OBJC_LOOKUP_CLASS): Add. (OBJC_LOOKUP_NO_SUPER): Add. (objc_finish_file): Add pch support. (objc_finish_implementation): Add Objective-C++ support. (synth_module_prologue): Likewise. (synth_module_prologue): Add fast dispatching. (objc_get_class_reference): Add Objective-C++ support. (objc_generate_write_barrier): Likewise. (next_sjlj_build_enter_and_setjmp): Likewise. (objc_begin_try_stmt): Likewise. (build_next_objc_exception_stuff): Add fast ivar support. (build_private_template): Mark the record as used so debug information is generated. (build_protocol_template): Add Objective-C++ support. (objc_method_parm_type) Likewise. (objc_generate_cxx_ctor_or_dtor): Likewise. (objc_generate_cxx_cdtors): Likewise. (build_protocol_initializer): Likewise. (build_category_template): Likewise. (build_class_template): Likewise. (build_method_list_template): Likewise. (build_category_initializer): Likewise. (build_shared_structure_initializer): Likewise. (objc_finish_message_expr): Likewise. (build_objc_method_call): Add fast dispatch support. (lookup_method_static): Add support to end search at superclasses. (add_method_to_hash_list): Add strict parameter to comp_proto_with_proto. (objc_add_method): Likewise. (objc_add_method): Also set the interface_value. (add_instance_variable): Add Objective-C++ support. (objc_is_public): Likewise. (start_class): Likewise. (continue_class): Likewise. (encode_aggregate_within): Likewise. (start_method_def): Likewise. (objc_start_function): Clear current_function_returns_value and current_function_returns_null. (really_start_method): Add Objective-C++ support. (objc_finish_method_definition): Add warning for missing [super dealloc]. (finish_objc): Add Objective-C++ support. (generate_objc_image_info): Likewise. (objc_lookup_ivar): Likewise. * objc-act.h (TYPE_HAS_OBJC_INFO): Likewise. (INIT_TYPE_OBJC_INFO): Likewise. (DUP_TYPE_OBJC_INFO): Likewise. From-SVN: r99857
2005-05-17 22:07:08 +02:00
if (should_call_super_dealloc)
warning (0, "method possibly missing a [super dealloc] call");
1992-01-18 00:15:38 +01:00
}
#if 0
1992-01-18 00:15:38 +01:00
int
lang_report_error_function (tree decl)
1992-01-18 00:15:38 +01:00
{
c-parse.in (objc_inherit_code, [...]): Make static. 2001-10-03 Ziemowit Laski <zlaski@apple.com> * c-parse.in (objc_inherit_code, objc_pq_context, objc_public_flag): Make static. (objc_interface_context, objc_implementation_context, objc_method_context, objc_ivar_chain, objc_ivar_context): Move to global tree array in objc/objc-act.[ch]. (methoddef): Remove unnecessary code. * objc/objc-act.c: (hashed_attribute, hashed_entry, imp_entry): Hoist struct definitions to objc-act.h. (nst_method_hash_list, cls_method_hash_list, imp_list, imp_count, cat_count): Place declaration in objc-act.h. (objc_tree_index): Move enumeration to objc-act.h. (objc_global_trees): Place declaration and macro accessors in objc-act.h. (implementation_context): Remove duplicate; use objc_implementation_context instead: (method_context): Remove duplicate; use objc_method_context instead. (objc_ellipsis_node, objc_method_prototype_template, implemented_classes, function_type): Move global vars to objc_global_trees. (init_objc): Use LAST_BASE_TREE_CODE instead of LAST_CODE. (build_message_expr): Move actual construction of ObjC message send nodes to finish_message_expr. (finish_message_expr): New routine, contains code formerly in build_message_expr. * objc/objc-act.h (finish_message_expr): New prototype. (objc_ivar_chain, objc_method_context, objc_ellipsis_node): Remove declarations; these vars are now part of objc_global_trees. (objc_tree_index, objc_global_trees): Move definitions from objc-act.c. * objc/objc-tree.def: Update copyright info. From-SVN: r46000
2001-10-04 00:05:57 +02:00
if (objc_method_context)
1992-01-18 00:15:38 +01:00
{
builtins.c, [...]: Avoid "`" as left quote, using "'" or %q, %< and %> as appropriate. * builtins.c, c-common.c, c-decl.c, c-format.c, c-format.h, c-parse.in, c-pch.c, c-pragma.c, collect2.c, final.c, gcc.c, gcov.c, opts.c, pretty-print.h, protoize.c, reg-stack.c, rtl.c, tlink.c, config/alpha/alpha.c, config/arc/arc.c, config/arm/arm.c, config/avr/avr.c, config/c4x/c4x.c, config/darwin.c, config/frv/frv.c, config/h8300/h8300.c, config/i386/i386.c, config/i386/winnt.c, config/ia64/ia64.c, config/ip2k/ip2k.c, config/iq2000/iq2000.c, config/m32r/m32r.c, config/m68hc11/m68hc11.c, config/m68k/m68k.c, config/m68k/m68k.h, config/mcore/mcore.c, config/mips/mips.c, config/mmix/mmix.c, config/ns32k/ns32k.c, config/rs6000/host-darwin.c, config/rs6000/rs6000.c, config/s390/s390.c, config/sh/sh.c, config/sh/symbian.c, config/stormy16/stormy16.c, config/v850/v850.c: Avoid "`" as left quote, using "'" or %q, %< and %> as appropriate. Use %' as apostrophe in diagnostics where applicable. Use %< and %> in place of '' quotes where applicable. Use %qs in place of %<%s%>. Consistently quote __builtin function names. ada: * misc.c (gnat_handle_option): Use %< and %> for quoting in warning message. cp: * call.c, class.c, decl.c, decl2.c, error.c, mangle.c, parser.c, pt.c, search.c, semantics.c, typeck.c: Use %q, %< and %> for quoting in diagnostics. * parser.c (cp_parser_sizeof_operand): Use '' instead of `' for quoting in printf format. * decl.c (duplicate_decls, start_decl): Use %qD instead of unquoted %D. objc: * objc-act.c: Use %q, %< and %> for quoting in diagnostics. testsuite: * gcc.dg/builtin-prefetch-1.c: Adjust expected messages. From-SVN: r90337
2004-11-09 11:13:30 +01:00
fprintf (stderr, "In method %qs\n",
c-parse.in (objc_inherit_code, [...]): Make static. 2001-10-03 Ziemowit Laski <zlaski@apple.com> * c-parse.in (objc_inherit_code, objc_pq_context, objc_public_flag): Make static. (objc_interface_context, objc_implementation_context, objc_method_context, objc_ivar_chain, objc_ivar_context): Move to global tree array in objc/objc-act.[ch]. (methoddef): Remove unnecessary code. * objc/objc-act.c: (hashed_attribute, hashed_entry, imp_entry): Hoist struct definitions to objc-act.h. (nst_method_hash_list, cls_method_hash_list, imp_list, imp_count, cat_count): Place declaration in objc-act.h. (objc_tree_index): Move enumeration to objc-act.h. (objc_global_trees): Place declaration and macro accessors in objc-act.h. (implementation_context): Remove duplicate; use objc_implementation_context instead: (method_context): Remove duplicate; use objc_method_context instead. (objc_ellipsis_node, objc_method_prototype_template, implemented_classes, function_type): Move global vars to objc_global_trees. (init_objc): Use LAST_BASE_TREE_CODE instead of LAST_CODE. (build_message_expr): Move actual construction of ObjC message send nodes to finish_message_expr. (finish_message_expr): New routine, contains code formerly in build_message_expr. * objc/objc-act.h (finish_message_expr): New prototype. (objc_ivar_chain, objc_method_context, objc_ellipsis_node): Remove declarations; these vars are now part of objc_global_trees. (objc_tree_index, objc_global_trees): Move definitions from objc-act.c. * objc/objc-tree.def: Update copyright info. From-SVN: r46000
2001-10-04 00:05:57 +02:00
IDENTIFIER_POINTER (METHOD_SEL_NAME (objc_method_context)));
1992-01-18 00:15:38 +01:00
return 1;
}
1992-01-18 00:15:38 +01:00
else
return 0;
}
#endif
1992-01-18 00:15:38 +01:00
Makefile.in (c-parse.o): Depend on $(C_COMMON_H). [gcc/ChangeLog] 2004-09-07 Ziemowit Laski <zlaski@apple.com> * Makefile.in (c-parse.o): Depend on $(C_COMMON_H). * c-parse.in: Include c-common.h instead of objc-act.h. (ivar_decl_list, ivar_decls, ivar_decl, ivars, ivar_declarator, myparms, myparm): Remove %type declarations. (methodtype, optparms, OBJC_TYPE_QUAL, objc_quals, objc_qual, objc_typename, objc_try_catch_stmt, optellipsis): Add %type declarations. (objc_inherit_code, objc_public_flag): Remove. (typespec_nonreserved_nonattr): Call objc_get_protocol_qualified_type() instead of get_static_reference() and get_protocol_reference(). (stmt_nocomp): Call grokparm() on @catch parameter. (objcdef): Move semantic action to objc_finish_implementation(). (classdef): Move semantic action to objc_start_class_interface(), objc_continue_interface(), objc_finish_interface(), objc_start_class_implementation(), objc_continue_implementation(), objc_start_category_interface() and objc_start_category_implementation(). (protocoldef): Move semantic actions to objc_start_protocol() and objc_finish_interface(). (ivar_decl_list): Remove nonterminal. (visibility_spec): Move semantic actions to objc_set_visibility(). (ivar_decls): Remove assignment to $$. (ivar_decl): Rephrase in terms of component_decl; call objc_add_instance_variable(). (ivars, ivar_declarator): Remove nonterminals. (opt_semi): New nonterminal. (methodtype): Remove semantic actions. (methoddef): Move semantic actions to objc_set_method_type(), objc_start_method_definition() and objc_finish_method_definition(). (methodproto): Move semantic actions to objc_set_method_type() and objc_add_method_declaration(). (methoddecl): Use objc_typename instead of typename; move semantic actions to objc_build_method_signature(). (optarglist, myxdecls, mydecl, myparms, myparm): Remove nonterminals. (optparmlist): Express in terms of optparms and optellipsis. (optparms, optellipsis, objc_qual, objc_quals, objc_typename): New nonterminals. (keyworddecl): Use objc_typename instead of typename. (rid_to_yy): Mark RID_IN, RID_OUT, RID_INOUT, RID_BYCOPY, RID_BYREF and RID_ONEWAY as returning OBJC_TYPE_QUAL to yyparse(). [gcc/objc/ChangeLog] 2004-09-07 Ziemowit Laski <zlaski@apple.com> * Make-lang.in (objc/objc-parse.o): Depend on $(C_COMMON_H) instead of objc/objc-act.h. (objc/objc-act.o): Depend on $(HASHTAB_H). * objc-act.c: Include hashtab.h; in ObjC++ mode, include cp-tree.h and objcp-decl.h instead of c-tree.h. (build_module_descriptor, get_class_ivars, synth_id_with_class_suffix, error_with_ivar, gen_method_decl, gen_declaration, setup_string_decl, build_protocol_template): Adjust prototypes. (build_module_initializer_routine, start_class, continue_class, finish_class, start_method_def, objc_start_function, start_protocol, build_method_decl, objc_add_method, add_instance_variable, build_ivar_reference, is_ivar, is_private, get_super_receiver, build_selector_table_decl, objc_push_parm, objc_get_parm_info, gen_type_name, gen_type_name_0, start_var_decl, finish_var_decl, create_field_decl): New prototypes. (objc_expand_function_end, comp_method_with_proto, objc_expr_last, gen_declaration_1, gen_declarator, is_complex_decl, adorn_decl, define_decl, create_builtin_decl, gen_declspecs): Remove prototypes. (TYPE_ID): Rename to OBJECT_TYPEDEF_NAME. (CLASS_TYPEDEF_NAME): New. (TAG_EXECCLASS): Change from a global variable to a #define. (TAG_RETURN_STRUCT): Delete. (TAG_GNUINIT): New, holds '__objc_gnu_init' name. (objc_inherit_code, objc_public_flag): New, moved from c-parse.in. (string_descriptor): New struct. (string_htab): New hash table. (string_hash, string_eq): New prototypes. (generate_struct_by_value_array): Call create_field_decl() instead of create_builtin_decl(). (objc_init): Do not initialize objc_ellipsis_node or TAG_EXECCLASS; In ObjC++ mode, call cxx_init() instead of c_objc_common_init(). (objc_finish_file): In ObjC++, call instantiate_pending_templates() and cp_finish_file(). (define_decl, get_static_reference, get_protocol_reference, create_builtin_decl): Remove functions. (objc_start_class_interface, objc_start_category_interface, objc_start_protocol, objc_continue_interface, objc_finish_interface, objc_start_class_implementation, objc_start_category_implementation, objc_continue_implementation, objc_finish_implementation, objc_set_visibility, objc_set_method_type, objc_build_method_signature, objc_add_method_declaration, objc_start_method_definition, objc_add_instance_variable, objc_get_protocol_qualified_type, create_field_decl, start_var_decl, finish_var_decl): New functions. (setup_string_decl): Simplify since it is only called once. (synth_module_prologue): Call build_class_template(); predefine 'id' and 'Class' as typedefs; rename 'temp_type' to 'type'; disable debug hooks for duration of function; fix GNU runtime messenger signatures to correspond to reality; forward-declare '__objc_exec_class' for the GNU runtime; call build_selector_table_decl(); in ObjC++ mode, generate 'extern "C" { ... }' wrappers around synthesized declarations; call build_protocol_template() and build_category_template(). (string_hash, string_eq): New functions. (objc_build_string_object): Check metaclass correctness only once; store string literals in hash table. (objc_build_constructor): Do not convert initializer elements; adjust for ObjC++ impedance mismatch. (build_objc_symtab_template): Call create_field_decl() instead of create_builtin_decl(). (init_objc_symtab): Add missing conversion to initializer element. (build_metadata_decl): Call start_var_decl() instead of define_decl(). (generate_objc_symtab_decl): Do not call build_category_template(); call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(). (build_module_descriptor): Call create_field_decl() instead of grokfield(); call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(); always mark module descriptor as used; move GNU runtime-specific functionality to build_module_initializer_routine(). (build_module_initializer_routine): New function, broken off of build_module_descriptor(). (objc_static_init_needed_p, objc_generate_static_init_call): New functions. (generate_static_references, generate_strings, build_selector_translation_table, generate_descriptor_table, generate_ivars_list, generate_dispatch_table, generate_category): Call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(); build a type directly instead of via groktypename(). (build_selector_reference_decl, build_selector_table_decl, build_class_reference_decl, build_protocol_reference, generate_objc_image_info): Call start_var_decl() instead of build_decl(). (build_selector_reference): For GNU runtime, do not call build_selector_reference_decl(). (build_selector, build_typed_selector_reference): Always convert result to the selector type. (add_objc_string): Cast return value to 'char *'. (build_method_prototype_template, build_selector_template, build_method_template): Use actual selector type for fields pointing to selectors. (finish_objc): For GNU runtime, call build_module_initializer_routine() after build_module_descriptor(). (generate_protocol_list, generate_shared_structures): Call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(); build a type directly instead of via groktypename(). (synth_id_with_class_suffix): Return a string. (get_arg_type_list): For instance methods, use the instance type for 'self'; do not call groktypename_in_parm_context(). (build_objc_string_decl): Squash redeclaration errors in ObjC++. (objc_is_class_name): Use OBJC_TYPE_NAME instead of TYPE_NAME; handle RECORD_TYPEs in ObjC as well as ObjC++. (objc_is_id): New function. (objc_is_object_ptr): Return the canonical type node. (objc_get_class_ivars): Simplify using get_class_ivars(). (get_class_ivars): Remove second parameter; create a fresh copy of the ivar list for each call; do not check for existence of super class. (objc_eh_runtime_type): Mark #ifndef OBJCPLUS. (objc_init_exceptions): When using SJLJ-style exceptions, require the use of '-fobjc-exceptions' flag; do not require it for DWARF-style exceptions. (objc_build_exc_ptr, next_sjlj_build_try_catch_finally): Use objc_object_type instead of objc_id_type. (objc_begin_catch_clause): Convert the incoming PARM_DECL into a VAR_DECL before placing it in the appropriate scope; do not call define_decl(); adjust call to c_begin_compound_stmt(); use objc_object_type instead of objc_id_type. (build_next_objc_exception_stuff): Call create_field_decl() instead of create_builtin_decl(); construct type directly instead of calling groktypename(); use OBJC_VOID_AT_END to mark end of function parameters. (build_private_template): Adjust call to get_class_ivars(); build a type directly instead of via groktypename(). (build_protocol_template, build_method_prototype_list_template, build_method_prototype_template, build_category_template, build_selector_template, build_class_template, build_super_template, build_ivar_template, build_ivar_list_template, build_method_list_template, build_method_template): Call create_field_decl() instead of grokfield(). (objc_method_parm_type): Do not call groktypename(). (generate_descriptor_table): Call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(). (generate_method_descriptors, build_protocol_initializer, generate_dispatch_tables, build_category_initializer, build_shared_structure_initializer): Do not call groktypename(). (generate_protocols): Call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(); do not call groktypename(). (error_with_ivar): Remove last parameter. (check_ivars): Do not iterate ovar CLASS_RAW_IVARS lists in addition to CLASS_IVARS lists; adjust calls to error_with_ivar(). (generate_ivar_lists): Convert one of the initializer elements; do not call groktypename(). (get_arg_type_list, start_method_def, gen_method_def): Account for new representation of variable arguments and '...' in Objective-C methods; add Objective-C++ impedance matching code. (is_objc_type_qualifier): Remove function. (adjust_type_for_id_default): Simplify; there is no longer a need to wade through declspecs. (lookup_interface, start_class, continue_class, finish_class, start_method_def, start_protocol, build_method_decl, objc_add_method, add_instance_variable, build_ivar_reference, is_ivar, is_private, get_super_receiver, objc_build_finally_epilogue): Make into static functions. (receiver_is_class_object): Use new IS_CLASS() macro. (objc_build_message_expr): Tweak ObjC++ message argument handling; call objc_finish_message_expr() instead of finish_message_expr(). (finish_message_expr): Rename to objc_finish_message_expr(); use OBJC_TYPE_NAME and OBJC_SET_TYPE_NAME macros instead of TYPE_NAME. call gen_type_name() instead of gen_declaration(); call objc_is_id() instead of using IS_ID and IS_CLASS; Use objc_class_name instead of calling get_identifier("Class"); handle CONVERT_EXPRs in receiver. (build_objc_method_call, warn_with_method): Do not call groktypename(). (build_ivar_reference): Call convert() instead of clobbering in a type. (hash_init): Initialize string_htab hash table. (add_instance_variable): Simplify parameter list; do not call grokfield(); do not populate CLASS_IVARS list. (start_class): Check for the existence of super class, if one was specified. (continue_class): Use CLASS_RAW_IVARS rather than CLASS_IVARS; do not call build_class_template(); adjust call to get_class_ivars(); call build_decl(), pushdecl() and finish_decl() instead of define_decl(). (finish_class): Call build_decl(), pushdecl() and finish_decl() instead of define_decl(). (add_protocols): Use PROTOCOL_BINFO_ELTS for the tree vector size. (start_protocol): Do not call build_protocol_template(); use PROTOCOL_BINFO_ELTS for the tree vector size. (encode_type_qualifiers): Do not handle the 'const' qualifier here. (encode_pointer): Encode 'const char *' as 'r*', for backwards compatibility. (encode_array): Use HOST_WIDE_INT_PRINT_DEC instead of "%ld". (encode_type): Handle the 'const' qualifier here. (objc_parmlist): New global variable, sued by objc_push_parm and objc_get_parm_info(). (objc_push_parm, objc_get_parm_info): New functions. (objc_expr_last): Remove function. (synth_self_and_ucmd_args): For instance methods, use the instance type for 'self'; call objc_push_parm() instead of push_parm_decl(). (start_method_def): Do not call push_scope(), declare_parm_level(), pop_scope(), push_parm_decl(), store_parm_decls() or objc_expr_last(); just use objc_push_parm() and objc_get_parm_info(). (comp_method_with_proto): Remove function. (objc_types_are_equivalent): Strip away indirections before comparing underlying types. (comp_proto_with_proto): Do not call groktypename(); types are no longer in raw declspec format. (objc_start_function): New function. (really_start_method): Call comp_proto_with_proto() instead of comp_method_with_proto(); call objc_start_function() instead of hand-crafting a function declarator. (continue_method_def, objc_expand_function_end): Remove functions. (get_super_receiver): Call objc_get_current_scope() instead of get_current_scope(); reference 'super_class' field (instead of 'class'). (finish_method_def): Rename to objc_finish_method_definition() and add a function decl parameter; move method encoding call from objc_expand_function_end(). (is_complex_decl, adorn_decl, gen_declarator, gen_declspecs, gen_declaration_1): Remove functions. (tmpbuf, RAW_DECLSPEC): Remove. (gen_declaration): Remove second parameter; simplify to deal with TYPE_P nodes instead of raw declspecs. (gen_type_name, gen_type_name_0): New functions. (gen_method_decl): Remove second parameter; call gen_type_name() instead of gen_declaration_1(). (dump_interface): Adjust calls to gen_declaration() and gen_method_decl(); do not allocate a separate string buffer. (init_objc): Allocate a larger string buffer to accommodate dump_interface(); adjust call to build_module_descriptor(); add call to build_module_initializer_routine() for the GNU runtime. (generate_classref_translation_entry): Do not call start_decl(); call finish_var_decl() instead of finish_decl(); call convert() instead of build_c_cast(). * objc-act.h (CLASS_OWN_IVARS): Remove accessor. (CLASS_BINFO_ELTS): Reduce from 6 to 5, now that CLASS_OWN_IVARS is gone. (OCTI_GNU_INIT_DECL, GNU_INIT_decl): New. (OCTI_ELLIPSIS_NODE, objc_ellipsis_node): Remove. (OCTI_ID_ID, id_type, objc_id_id): Rename to OCTI_ID_NAME, objc_object_type and objc_object_name, respectively. (OCTI_CLS_REF, OCTI_CLASS_NAME, objc_class_reference, objc_class_name): New. (IS_CLASS): New macro. (IS_ID, IS_SUPER): Robustify. (OCTI_EXECCLASS_DECL, execclass_decl): New. (finish_file, start_class, continue_class, finish_class, start_method_def, continue_method_def, finish_method_def, start_protocol, finish_protocol, objc_build_throw_stmt, objc_build_try_catch_finally_stmt, objc_build_synchronized_prologue, objc_build_synchronized_epilogue, objc_build_try_prologue, objc_build_try_epilogue, objc_build_catch_stmt, objc_build_catch_epilogue, objc_build_finally_prologue, objc_build_finally_epilogue, is_ivar, is_private, is_public, add_instance_variable, objc_add_method, get_super_receiver, objc_clear_super_receiver, get_class_ivars_from_name, get_class_reference, get_static_reference, get_object_reference, build_message_expr, finish_message_expr, build_selector_expr, build_ivar_reference, build_keyword_decl, build_method_decl, build_protocol_expr, build_objc_string_object, objc_declare_alias, objc_declare_class, objc_declare_protocols, objc_comptypes, objc_check_decl, build_encode_expr): Remove prototypes. (imp_count, cat_count): Make GGC-aware. (OBJC_SET_TYPE_NAME): New macro. From-SVN: r87168
2004-09-08 02:49:44 +02:00
/* Given a tree DECL node, produce a printable description of it in the given
buffer, overwriting the buffer. */
1992-01-18 00:15:38 +01:00
static char *
Makefile.in (c-parse.o): Depend on $(C_COMMON_H). [gcc/ChangeLog] 2004-09-07 Ziemowit Laski <zlaski@apple.com> * Makefile.in (c-parse.o): Depend on $(C_COMMON_H). * c-parse.in: Include c-common.h instead of objc-act.h. (ivar_decl_list, ivar_decls, ivar_decl, ivars, ivar_declarator, myparms, myparm): Remove %type declarations. (methodtype, optparms, OBJC_TYPE_QUAL, objc_quals, objc_qual, objc_typename, objc_try_catch_stmt, optellipsis): Add %type declarations. (objc_inherit_code, objc_public_flag): Remove. (typespec_nonreserved_nonattr): Call objc_get_protocol_qualified_type() instead of get_static_reference() and get_protocol_reference(). (stmt_nocomp): Call grokparm() on @catch parameter. (objcdef): Move semantic action to objc_finish_implementation(). (classdef): Move semantic action to objc_start_class_interface(), objc_continue_interface(), objc_finish_interface(), objc_start_class_implementation(), objc_continue_implementation(), objc_start_category_interface() and objc_start_category_implementation(). (protocoldef): Move semantic actions to objc_start_protocol() and objc_finish_interface(). (ivar_decl_list): Remove nonterminal. (visibility_spec): Move semantic actions to objc_set_visibility(). (ivar_decls): Remove assignment to $$. (ivar_decl): Rephrase in terms of component_decl; call objc_add_instance_variable(). (ivars, ivar_declarator): Remove nonterminals. (opt_semi): New nonterminal. (methodtype): Remove semantic actions. (methoddef): Move semantic actions to objc_set_method_type(), objc_start_method_definition() and objc_finish_method_definition(). (methodproto): Move semantic actions to objc_set_method_type() and objc_add_method_declaration(). (methoddecl): Use objc_typename instead of typename; move semantic actions to objc_build_method_signature(). (optarglist, myxdecls, mydecl, myparms, myparm): Remove nonterminals. (optparmlist): Express in terms of optparms and optellipsis. (optparms, optellipsis, objc_qual, objc_quals, objc_typename): New nonterminals. (keyworddecl): Use objc_typename instead of typename. (rid_to_yy): Mark RID_IN, RID_OUT, RID_INOUT, RID_BYCOPY, RID_BYREF and RID_ONEWAY as returning OBJC_TYPE_QUAL to yyparse(). [gcc/objc/ChangeLog] 2004-09-07 Ziemowit Laski <zlaski@apple.com> * Make-lang.in (objc/objc-parse.o): Depend on $(C_COMMON_H) instead of objc/objc-act.h. (objc/objc-act.o): Depend on $(HASHTAB_H). * objc-act.c: Include hashtab.h; in ObjC++ mode, include cp-tree.h and objcp-decl.h instead of c-tree.h. (build_module_descriptor, get_class_ivars, synth_id_with_class_suffix, error_with_ivar, gen_method_decl, gen_declaration, setup_string_decl, build_protocol_template): Adjust prototypes. (build_module_initializer_routine, start_class, continue_class, finish_class, start_method_def, objc_start_function, start_protocol, build_method_decl, objc_add_method, add_instance_variable, build_ivar_reference, is_ivar, is_private, get_super_receiver, build_selector_table_decl, objc_push_parm, objc_get_parm_info, gen_type_name, gen_type_name_0, start_var_decl, finish_var_decl, create_field_decl): New prototypes. (objc_expand_function_end, comp_method_with_proto, objc_expr_last, gen_declaration_1, gen_declarator, is_complex_decl, adorn_decl, define_decl, create_builtin_decl, gen_declspecs): Remove prototypes. (TYPE_ID): Rename to OBJECT_TYPEDEF_NAME. (CLASS_TYPEDEF_NAME): New. (TAG_EXECCLASS): Change from a global variable to a #define. (TAG_RETURN_STRUCT): Delete. (TAG_GNUINIT): New, holds '__objc_gnu_init' name. (objc_inherit_code, objc_public_flag): New, moved from c-parse.in. (string_descriptor): New struct. (string_htab): New hash table. (string_hash, string_eq): New prototypes. (generate_struct_by_value_array): Call create_field_decl() instead of create_builtin_decl(). (objc_init): Do not initialize objc_ellipsis_node or TAG_EXECCLASS; In ObjC++ mode, call cxx_init() instead of c_objc_common_init(). (objc_finish_file): In ObjC++, call instantiate_pending_templates() and cp_finish_file(). (define_decl, get_static_reference, get_protocol_reference, create_builtin_decl): Remove functions. (objc_start_class_interface, objc_start_category_interface, objc_start_protocol, objc_continue_interface, objc_finish_interface, objc_start_class_implementation, objc_start_category_implementation, objc_continue_implementation, objc_finish_implementation, objc_set_visibility, objc_set_method_type, objc_build_method_signature, objc_add_method_declaration, objc_start_method_definition, objc_add_instance_variable, objc_get_protocol_qualified_type, create_field_decl, start_var_decl, finish_var_decl): New functions. (setup_string_decl): Simplify since it is only called once. (synth_module_prologue): Call build_class_template(); predefine 'id' and 'Class' as typedefs; rename 'temp_type' to 'type'; disable debug hooks for duration of function; fix GNU runtime messenger signatures to correspond to reality; forward-declare '__objc_exec_class' for the GNU runtime; call build_selector_table_decl(); in ObjC++ mode, generate 'extern "C" { ... }' wrappers around synthesized declarations; call build_protocol_template() and build_category_template(). (string_hash, string_eq): New functions. (objc_build_string_object): Check metaclass correctness only once; store string literals in hash table. (objc_build_constructor): Do not convert initializer elements; adjust for ObjC++ impedance mismatch. (build_objc_symtab_template): Call create_field_decl() instead of create_builtin_decl(). (init_objc_symtab): Add missing conversion to initializer element. (build_metadata_decl): Call start_var_decl() instead of define_decl(). (generate_objc_symtab_decl): Do not call build_category_template(); call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(). (build_module_descriptor): Call create_field_decl() instead of grokfield(); call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(); always mark module descriptor as used; move GNU runtime-specific functionality to build_module_initializer_routine(). (build_module_initializer_routine): New function, broken off of build_module_descriptor(). (objc_static_init_needed_p, objc_generate_static_init_call): New functions. (generate_static_references, generate_strings, build_selector_translation_table, generate_descriptor_table, generate_ivars_list, generate_dispatch_table, generate_category): Call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(); build a type directly instead of via groktypename(). (build_selector_reference_decl, build_selector_table_decl, build_class_reference_decl, build_protocol_reference, generate_objc_image_info): Call start_var_decl() instead of build_decl(). (build_selector_reference): For GNU runtime, do not call build_selector_reference_decl(). (build_selector, build_typed_selector_reference): Always convert result to the selector type. (add_objc_string): Cast return value to 'char *'. (build_method_prototype_template, build_selector_template, build_method_template): Use actual selector type for fields pointing to selectors. (finish_objc): For GNU runtime, call build_module_initializer_routine() after build_module_descriptor(). (generate_protocol_list, generate_shared_structures): Call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(); build a type directly instead of via groktypename(). (synth_id_with_class_suffix): Return a string. (get_arg_type_list): For instance methods, use the instance type for 'self'; do not call groktypename_in_parm_context(). (build_objc_string_decl): Squash redeclaration errors in ObjC++. (objc_is_class_name): Use OBJC_TYPE_NAME instead of TYPE_NAME; handle RECORD_TYPEs in ObjC as well as ObjC++. (objc_is_id): New function. (objc_is_object_ptr): Return the canonical type node. (objc_get_class_ivars): Simplify using get_class_ivars(). (get_class_ivars): Remove second parameter; create a fresh copy of the ivar list for each call; do not check for existence of super class. (objc_eh_runtime_type): Mark #ifndef OBJCPLUS. (objc_init_exceptions): When using SJLJ-style exceptions, require the use of '-fobjc-exceptions' flag; do not require it for DWARF-style exceptions. (objc_build_exc_ptr, next_sjlj_build_try_catch_finally): Use objc_object_type instead of objc_id_type. (objc_begin_catch_clause): Convert the incoming PARM_DECL into a VAR_DECL before placing it in the appropriate scope; do not call define_decl(); adjust call to c_begin_compound_stmt(); use objc_object_type instead of objc_id_type. (build_next_objc_exception_stuff): Call create_field_decl() instead of create_builtin_decl(); construct type directly instead of calling groktypename(); use OBJC_VOID_AT_END to mark end of function parameters. (build_private_template): Adjust call to get_class_ivars(); build a type directly instead of via groktypename(). (build_protocol_template, build_method_prototype_list_template, build_method_prototype_template, build_category_template, build_selector_template, build_class_template, build_super_template, build_ivar_template, build_ivar_list_template, build_method_list_template, build_method_template): Call create_field_decl() instead of grokfield(). (objc_method_parm_type): Do not call groktypename(). (generate_descriptor_table): Call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(). (generate_method_descriptors, build_protocol_initializer, generate_dispatch_tables, build_category_initializer, build_shared_structure_initializer): Do not call groktypename(). (generate_protocols): Call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(); do not call groktypename(). (error_with_ivar): Remove last parameter. (check_ivars): Do not iterate ovar CLASS_RAW_IVARS lists in addition to CLASS_IVARS lists; adjust calls to error_with_ivar(). (generate_ivar_lists): Convert one of the initializer elements; do not call groktypename(). (get_arg_type_list, start_method_def, gen_method_def): Account for new representation of variable arguments and '...' in Objective-C methods; add Objective-C++ impedance matching code. (is_objc_type_qualifier): Remove function. (adjust_type_for_id_default): Simplify; there is no longer a need to wade through declspecs. (lookup_interface, start_class, continue_class, finish_class, start_method_def, start_protocol, build_method_decl, objc_add_method, add_instance_variable, build_ivar_reference, is_ivar, is_private, get_super_receiver, objc_build_finally_epilogue): Make into static functions. (receiver_is_class_object): Use new IS_CLASS() macro. (objc_build_message_expr): Tweak ObjC++ message argument handling; call objc_finish_message_expr() instead of finish_message_expr(). (finish_message_expr): Rename to objc_finish_message_expr(); use OBJC_TYPE_NAME and OBJC_SET_TYPE_NAME macros instead of TYPE_NAME. call gen_type_name() instead of gen_declaration(); call objc_is_id() instead of using IS_ID and IS_CLASS; Use objc_class_name instead of calling get_identifier("Class"); handle CONVERT_EXPRs in receiver. (build_objc_method_call, warn_with_method): Do not call groktypename(). (build_ivar_reference): Call convert() instead of clobbering in a type. (hash_init): Initialize string_htab hash table. (add_instance_variable): Simplify parameter list; do not call grokfield(); do not populate CLASS_IVARS list. (start_class): Check for the existence of super class, if one was specified. (continue_class): Use CLASS_RAW_IVARS rather than CLASS_IVARS; do not call build_class_template(); adjust call to get_class_ivars(); call build_decl(), pushdecl() and finish_decl() instead of define_decl(). (finish_class): Call build_decl(), pushdecl() and finish_decl() instead of define_decl(). (add_protocols): Use PROTOCOL_BINFO_ELTS for the tree vector size. (start_protocol): Do not call build_protocol_template(); use PROTOCOL_BINFO_ELTS for the tree vector size. (encode_type_qualifiers): Do not handle the 'const' qualifier here. (encode_pointer): Encode 'const char *' as 'r*', for backwards compatibility. (encode_array): Use HOST_WIDE_INT_PRINT_DEC instead of "%ld". (encode_type): Handle the 'const' qualifier here. (objc_parmlist): New global variable, sued by objc_push_parm and objc_get_parm_info(). (objc_push_parm, objc_get_parm_info): New functions. (objc_expr_last): Remove function. (synth_self_and_ucmd_args): For instance methods, use the instance type for 'self'; call objc_push_parm() instead of push_parm_decl(). (start_method_def): Do not call push_scope(), declare_parm_level(), pop_scope(), push_parm_decl(), store_parm_decls() or objc_expr_last(); just use objc_push_parm() and objc_get_parm_info(). (comp_method_with_proto): Remove function. (objc_types_are_equivalent): Strip away indirections before comparing underlying types. (comp_proto_with_proto): Do not call groktypename(); types are no longer in raw declspec format. (objc_start_function): New function. (really_start_method): Call comp_proto_with_proto() instead of comp_method_with_proto(); call objc_start_function() instead of hand-crafting a function declarator. (continue_method_def, objc_expand_function_end): Remove functions. (get_super_receiver): Call objc_get_current_scope() instead of get_current_scope(); reference 'super_class' field (instead of 'class'). (finish_method_def): Rename to objc_finish_method_definition() and add a function decl parameter; move method encoding call from objc_expand_function_end(). (is_complex_decl, adorn_decl, gen_declarator, gen_declspecs, gen_declaration_1): Remove functions. (tmpbuf, RAW_DECLSPEC): Remove. (gen_declaration): Remove second parameter; simplify to deal with TYPE_P nodes instead of raw declspecs. (gen_type_name, gen_type_name_0): New functions. (gen_method_decl): Remove second parameter; call gen_type_name() instead of gen_declaration_1(). (dump_interface): Adjust calls to gen_declaration() and gen_method_decl(); do not allocate a separate string buffer. (init_objc): Allocate a larger string buffer to accommodate dump_interface(); adjust call to build_module_descriptor(); add call to build_module_initializer_routine() for the GNU runtime. (generate_classref_translation_entry): Do not call start_decl(); call finish_var_decl() instead of finish_decl(); call convert() instead of build_c_cast(). * objc-act.h (CLASS_OWN_IVARS): Remove accessor. (CLASS_BINFO_ELTS): Reduce from 6 to 5, now that CLASS_OWN_IVARS is gone. (OCTI_GNU_INIT_DECL, GNU_INIT_decl): New. (OCTI_ELLIPSIS_NODE, objc_ellipsis_node): Remove. (OCTI_ID_ID, id_type, objc_id_id): Rename to OCTI_ID_NAME, objc_object_type and objc_object_name, respectively. (OCTI_CLS_REF, OCTI_CLASS_NAME, objc_class_reference, objc_class_name): New. (IS_CLASS): New macro. (IS_ID, IS_SUPER): Robustify. (OCTI_EXECCLASS_DECL, execclass_decl): New. (finish_file, start_class, continue_class, finish_class, start_method_def, continue_method_def, finish_method_def, start_protocol, finish_protocol, objc_build_throw_stmt, objc_build_try_catch_finally_stmt, objc_build_synchronized_prologue, objc_build_synchronized_epilogue, objc_build_try_prologue, objc_build_try_epilogue, objc_build_catch_stmt, objc_build_catch_epilogue, objc_build_finally_prologue, objc_build_finally_epilogue, is_ivar, is_private, is_public, add_instance_variable, objc_add_method, get_super_receiver, objc_clear_super_receiver, get_class_ivars_from_name, get_class_reference, get_static_reference, get_object_reference, build_message_expr, finish_message_expr, build_selector_expr, build_ivar_reference, build_keyword_decl, build_method_decl, build_protocol_expr, build_objc_string_object, objc_declare_alias, objc_declare_class, objc_declare_protocols, objc_comptypes, objc_check_decl, build_encode_expr): Remove prototypes. (imp_count, cat_count): Make GGC-aware. (OBJC_SET_TYPE_NAME): New macro. From-SVN: r87168
2004-09-08 02:49:44 +02:00
gen_declaration (tree decl)
1992-01-18 00:15:38 +01:00
{
Makefile.in (c-parse.o): Depend on $(C_COMMON_H). [gcc/ChangeLog] 2004-09-07 Ziemowit Laski <zlaski@apple.com> * Makefile.in (c-parse.o): Depend on $(C_COMMON_H). * c-parse.in: Include c-common.h instead of objc-act.h. (ivar_decl_list, ivar_decls, ivar_decl, ivars, ivar_declarator, myparms, myparm): Remove %type declarations. (methodtype, optparms, OBJC_TYPE_QUAL, objc_quals, objc_qual, objc_typename, objc_try_catch_stmt, optellipsis): Add %type declarations. (objc_inherit_code, objc_public_flag): Remove. (typespec_nonreserved_nonattr): Call objc_get_protocol_qualified_type() instead of get_static_reference() and get_protocol_reference(). (stmt_nocomp): Call grokparm() on @catch parameter. (objcdef): Move semantic action to objc_finish_implementation(). (classdef): Move semantic action to objc_start_class_interface(), objc_continue_interface(), objc_finish_interface(), objc_start_class_implementation(), objc_continue_implementation(), objc_start_category_interface() and objc_start_category_implementation(). (protocoldef): Move semantic actions to objc_start_protocol() and objc_finish_interface(). (ivar_decl_list): Remove nonterminal. (visibility_spec): Move semantic actions to objc_set_visibility(). (ivar_decls): Remove assignment to $$. (ivar_decl): Rephrase in terms of component_decl; call objc_add_instance_variable(). (ivars, ivar_declarator): Remove nonterminals. (opt_semi): New nonterminal. (methodtype): Remove semantic actions. (methoddef): Move semantic actions to objc_set_method_type(), objc_start_method_definition() and objc_finish_method_definition(). (methodproto): Move semantic actions to objc_set_method_type() and objc_add_method_declaration(). (methoddecl): Use objc_typename instead of typename; move semantic actions to objc_build_method_signature(). (optarglist, myxdecls, mydecl, myparms, myparm): Remove nonterminals. (optparmlist): Express in terms of optparms and optellipsis. (optparms, optellipsis, objc_qual, objc_quals, objc_typename): New nonterminals. (keyworddecl): Use objc_typename instead of typename. (rid_to_yy): Mark RID_IN, RID_OUT, RID_INOUT, RID_BYCOPY, RID_BYREF and RID_ONEWAY as returning OBJC_TYPE_QUAL to yyparse(). [gcc/objc/ChangeLog] 2004-09-07 Ziemowit Laski <zlaski@apple.com> * Make-lang.in (objc/objc-parse.o): Depend on $(C_COMMON_H) instead of objc/objc-act.h. (objc/objc-act.o): Depend on $(HASHTAB_H). * objc-act.c: Include hashtab.h; in ObjC++ mode, include cp-tree.h and objcp-decl.h instead of c-tree.h. (build_module_descriptor, get_class_ivars, synth_id_with_class_suffix, error_with_ivar, gen_method_decl, gen_declaration, setup_string_decl, build_protocol_template): Adjust prototypes. (build_module_initializer_routine, start_class, continue_class, finish_class, start_method_def, objc_start_function, start_protocol, build_method_decl, objc_add_method, add_instance_variable, build_ivar_reference, is_ivar, is_private, get_super_receiver, build_selector_table_decl, objc_push_parm, objc_get_parm_info, gen_type_name, gen_type_name_0, start_var_decl, finish_var_decl, create_field_decl): New prototypes. (objc_expand_function_end, comp_method_with_proto, objc_expr_last, gen_declaration_1, gen_declarator, is_complex_decl, adorn_decl, define_decl, create_builtin_decl, gen_declspecs): Remove prototypes. (TYPE_ID): Rename to OBJECT_TYPEDEF_NAME. (CLASS_TYPEDEF_NAME): New. (TAG_EXECCLASS): Change from a global variable to a #define. (TAG_RETURN_STRUCT): Delete. (TAG_GNUINIT): New, holds '__objc_gnu_init' name. (objc_inherit_code, objc_public_flag): New, moved from c-parse.in. (string_descriptor): New struct. (string_htab): New hash table. (string_hash, string_eq): New prototypes. (generate_struct_by_value_array): Call create_field_decl() instead of create_builtin_decl(). (objc_init): Do not initialize objc_ellipsis_node or TAG_EXECCLASS; In ObjC++ mode, call cxx_init() instead of c_objc_common_init(). (objc_finish_file): In ObjC++, call instantiate_pending_templates() and cp_finish_file(). (define_decl, get_static_reference, get_protocol_reference, create_builtin_decl): Remove functions. (objc_start_class_interface, objc_start_category_interface, objc_start_protocol, objc_continue_interface, objc_finish_interface, objc_start_class_implementation, objc_start_category_implementation, objc_continue_implementation, objc_finish_implementation, objc_set_visibility, objc_set_method_type, objc_build_method_signature, objc_add_method_declaration, objc_start_method_definition, objc_add_instance_variable, objc_get_protocol_qualified_type, create_field_decl, start_var_decl, finish_var_decl): New functions. (setup_string_decl): Simplify since it is only called once. (synth_module_prologue): Call build_class_template(); predefine 'id' and 'Class' as typedefs; rename 'temp_type' to 'type'; disable debug hooks for duration of function; fix GNU runtime messenger signatures to correspond to reality; forward-declare '__objc_exec_class' for the GNU runtime; call build_selector_table_decl(); in ObjC++ mode, generate 'extern "C" { ... }' wrappers around synthesized declarations; call build_protocol_template() and build_category_template(). (string_hash, string_eq): New functions. (objc_build_string_object): Check metaclass correctness only once; store string literals in hash table. (objc_build_constructor): Do not convert initializer elements; adjust for ObjC++ impedance mismatch. (build_objc_symtab_template): Call create_field_decl() instead of create_builtin_decl(). (init_objc_symtab): Add missing conversion to initializer element. (build_metadata_decl): Call start_var_decl() instead of define_decl(). (generate_objc_symtab_decl): Do not call build_category_template(); call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(). (build_module_descriptor): Call create_field_decl() instead of grokfield(); call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(); always mark module descriptor as used; move GNU runtime-specific functionality to build_module_initializer_routine(). (build_module_initializer_routine): New function, broken off of build_module_descriptor(). (objc_static_init_needed_p, objc_generate_static_init_call): New functions. (generate_static_references, generate_strings, build_selector_translation_table, generate_descriptor_table, generate_ivars_list, generate_dispatch_table, generate_category): Call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(); build a type directly instead of via groktypename(). (build_selector_reference_decl, build_selector_table_decl, build_class_reference_decl, build_protocol_reference, generate_objc_image_info): Call start_var_decl() instead of build_decl(). (build_selector_reference): For GNU runtime, do not call build_selector_reference_decl(). (build_selector, build_typed_selector_reference): Always convert result to the selector type. (add_objc_string): Cast return value to 'char *'. (build_method_prototype_template, build_selector_template, build_method_template): Use actual selector type for fields pointing to selectors. (finish_objc): For GNU runtime, call build_module_initializer_routine() after build_module_descriptor(). (generate_protocol_list, generate_shared_structures): Call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(); build a type directly instead of via groktypename(). (synth_id_with_class_suffix): Return a string. (get_arg_type_list): For instance methods, use the instance type for 'self'; do not call groktypename_in_parm_context(). (build_objc_string_decl): Squash redeclaration errors in ObjC++. (objc_is_class_name): Use OBJC_TYPE_NAME instead of TYPE_NAME; handle RECORD_TYPEs in ObjC as well as ObjC++. (objc_is_id): New function. (objc_is_object_ptr): Return the canonical type node. (objc_get_class_ivars): Simplify using get_class_ivars(). (get_class_ivars): Remove second parameter; create a fresh copy of the ivar list for each call; do not check for existence of super class. (objc_eh_runtime_type): Mark #ifndef OBJCPLUS. (objc_init_exceptions): When using SJLJ-style exceptions, require the use of '-fobjc-exceptions' flag; do not require it for DWARF-style exceptions. (objc_build_exc_ptr, next_sjlj_build_try_catch_finally): Use objc_object_type instead of objc_id_type. (objc_begin_catch_clause): Convert the incoming PARM_DECL into a VAR_DECL before placing it in the appropriate scope; do not call define_decl(); adjust call to c_begin_compound_stmt(); use objc_object_type instead of objc_id_type. (build_next_objc_exception_stuff): Call create_field_decl() instead of create_builtin_decl(); construct type directly instead of calling groktypename(); use OBJC_VOID_AT_END to mark end of function parameters. (build_private_template): Adjust call to get_class_ivars(); build a type directly instead of via groktypename(). (build_protocol_template, build_method_prototype_list_template, build_method_prototype_template, build_category_template, build_selector_template, build_class_template, build_super_template, build_ivar_template, build_ivar_list_template, build_method_list_template, build_method_template): Call create_field_decl() instead of grokfield(). (objc_method_parm_type): Do not call groktypename(). (generate_descriptor_table): Call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(). (generate_method_descriptors, build_protocol_initializer, generate_dispatch_tables, build_category_initializer, build_shared_structure_initializer): Do not call groktypename(). (generate_protocols): Call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(); do not call groktypename(). (error_with_ivar): Remove last parameter. (check_ivars): Do not iterate ovar CLASS_RAW_IVARS lists in addition to CLASS_IVARS lists; adjust calls to error_with_ivar(). (generate_ivar_lists): Convert one of the initializer elements; do not call groktypename(). (get_arg_type_list, start_method_def, gen_method_def): Account for new representation of variable arguments and '...' in Objective-C methods; add Objective-C++ impedance matching code. (is_objc_type_qualifier): Remove function. (adjust_type_for_id_default): Simplify; there is no longer a need to wade through declspecs. (lookup_interface, start_class, continue_class, finish_class, start_method_def, start_protocol, build_method_decl, objc_add_method, add_instance_variable, build_ivar_reference, is_ivar, is_private, get_super_receiver, objc_build_finally_epilogue): Make into static functions. (receiver_is_class_object): Use new IS_CLASS() macro. (objc_build_message_expr): Tweak ObjC++ message argument handling; call objc_finish_message_expr() instead of finish_message_expr(). (finish_message_expr): Rename to objc_finish_message_expr(); use OBJC_TYPE_NAME and OBJC_SET_TYPE_NAME macros instead of TYPE_NAME. call gen_type_name() instead of gen_declaration(); call objc_is_id() instead of using IS_ID and IS_CLASS; Use objc_class_name instead of calling get_identifier("Class"); handle CONVERT_EXPRs in receiver. (build_objc_method_call, warn_with_method): Do not call groktypename(). (build_ivar_reference): Call convert() instead of clobbering in a type. (hash_init): Initialize string_htab hash table. (add_instance_variable): Simplify parameter list; do not call grokfield(); do not populate CLASS_IVARS list. (start_class): Check for the existence of super class, if one was specified. (continue_class): Use CLASS_RAW_IVARS rather than CLASS_IVARS; do not call build_class_template(); adjust call to get_class_ivars(); call build_decl(), pushdecl() and finish_decl() instead of define_decl(). (finish_class): Call build_decl(), pushdecl() and finish_decl() instead of define_decl(). (add_protocols): Use PROTOCOL_BINFO_ELTS for the tree vector size. (start_protocol): Do not call build_protocol_template(); use PROTOCOL_BINFO_ELTS for the tree vector size. (encode_type_qualifiers): Do not handle the 'const' qualifier here. (encode_pointer): Encode 'const char *' as 'r*', for backwards compatibility. (encode_array): Use HOST_WIDE_INT_PRINT_DEC instead of "%ld". (encode_type): Handle the 'const' qualifier here. (objc_parmlist): New global variable, sued by objc_push_parm and objc_get_parm_info(). (objc_push_parm, objc_get_parm_info): New functions. (objc_expr_last): Remove function. (synth_self_and_ucmd_args): For instance methods, use the instance type for 'self'; call objc_push_parm() instead of push_parm_decl(). (start_method_def): Do not call push_scope(), declare_parm_level(), pop_scope(), push_parm_decl(), store_parm_decls() or objc_expr_last(); just use objc_push_parm() and objc_get_parm_info(). (comp_method_with_proto): Remove function. (objc_types_are_equivalent): Strip away indirections before comparing underlying types. (comp_proto_with_proto): Do not call groktypename(); types are no longer in raw declspec format. (objc_start_function): New function. (really_start_method): Call comp_proto_with_proto() instead of comp_method_with_proto(); call objc_start_function() instead of hand-crafting a function declarator. (continue_method_def, objc_expand_function_end): Remove functions. (get_super_receiver): Call objc_get_current_scope() instead of get_current_scope(); reference 'super_class' field (instead of 'class'). (finish_method_def): Rename to objc_finish_method_definition() and add a function decl parameter; move method encoding call from objc_expand_function_end(). (is_complex_decl, adorn_decl, gen_declarator, gen_declspecs, gen_declaration_1): Remove functions. (tmpbuf, RAW_DECLSPEC): Remove. (gen_declaration): Remove second parameter; simplify to deal with TYPE_P nodes instead of raw declspecs. (gen_type_name, gen_type_name_0): New functions. (gen_method_decl): Remove second parameter; call gen_type_name() instead of gen_declaration_1(). (dump_interface): Adjust calls to gen_declaration() and gen_method_decl(); do not allocate a separate string buffer. (init_objc): Allocate a larger string buffer to accommodate dump_interface(); adjust call to build_module_descriptor(); add call to build_module_initializer_routine() for the GNU runtime. (generate_classref_translation_entry): Do not call start_decl(); call finish_var_decl() instead of finish_decl(); call convert() instead of build_c_cast(). * objc-act.h (CLASS_OWN_IVARS): Remove accessor. (CLASS_BINFO_ELTS): Reduce from 6 to 5, now that CLASS_OWN_IVARS is gone. (OCTI_GNU_INIT_DECL, GNU_INIT_decl): New. (OCTI_ELLIPSIS_NODE, objc_ellipsis_node): Remove. (OCTI_ID_ID, id_type, objc_id_id): Rename to OCTI_ID_NAME, objc_object_type and objc_object_name, respectively. (OCTI_CLS_REF, OCTI_CLASS_NAME, objc_class_reference, objc_class_name): New. (IS_CLASS): New macro. (IS_ID, IS_SUPER): Robustify. (OCTI_EXECCLASS_DECL, execclass_decl): New. (finish_file, start_class, continue_class, finish_class, start_method_def, continue_method_def, finish_method_def, start_protocol, finish_protocol, objc_build_throw_stmt, objc_build_try_catch_finally_stmt, objc_build_synchronized_prologue, objc_build_synchronized_epilogue, objc_build_try_prologue, objc_build_try_epilogue, objc_build_catch_stmt, objc_build_catch_epilogue, objc_build_finally_prologue, objc_build_finally_epilogue, is_ivar, is_private, is_public, add_instance_variable, objc_add_method, get_super_receiver, objc_clear_super_receiver, get_class_ivars_from_name, get_class_reference, get_static_reference, get_object_reference, build_message_expr, finish_message_expr, build_selector_expr, build_ivar_reference, build_keyword_decl, build_method_decl, build_protocol_expr, build_objc_string_object, objc_declare_alias, objc_declare_class, objc_declare_protocols, objc_comptypes, objc_check_decl, build_encode_expr): Remove prototypes. (imp_count, cat_count): Make GGC-aware. (OBJC_SET_TYPE_NAME): New macro. From-SVN: r87168
2004-09-08 02:49:44 +02:00
errbuf[0] = '\0';
1992-01-18 00:15:38 +01:00
Makefile.in (c-parse.o): Depend on $(C_COMMON_H). [gcc/ChangeLog] 2004-09-07 Ziemowit Laski <zlaski@apple.com> * Makefile.in (c-parse.o): Depend on $(C_COMMON_H). * c-parse.in: Include c-common.h instead of objc-act.h. (ivar_decl_list, ivar_decls, ivar_decl, ivars, ivar_declarator, myparms, myparm): Remove %type declarations. (methodtype, optparms, OBJC_TYPE_QUAL, objc_quals, objc_qual, objc_typename, objc_try_catch_stmt, optellipsis): Add %type declarations. (objc_inherit_code, objc_public_flag): Remove. (typespec_nonreserved_nonattr): Call objc_get_protocol_qualified_type() instead of get_static_reference() and get_protocol_reference(). (stmt_nocomp): Call grokparm() on @catch parameter. (objcdef): Move semantic action to objc_finish_implementation(). (classdef): Move semantic action to objc_start_class_interface(), objc_continue_interface(), objc_finish_interface(), objc_start_class_implementation(), objc_continue_implementation(), objc_start_category_interface() and objc_start_category_implementation(). (protocoldef): Move semantic actions to objc_start_protocol() and objc_finish_interface(). (ivar_decl_list): Remove nonterminal. (visibility_spec): Move semantic actions to objc_set_visibility(). (ivar_decls): Remove assignment to $$. (ivar_decl): Rephrase in terms of component_decl; call objc_add_instance_variable(). (ivars, ivar_declarator): Remove nonterminals. (opt_semi): New nonterminal. (methodtype): Remove semantic actions. (methoddef): Move semantic actions to objc_set_method_type(), objc_start_method_definition() and objc_finish_method_definition(). (methodproto): Move semantic actions to objc_set_method_type() and objc_add_method_declaration(). (methoddecl): Use objc_typename instead of typename; move semantic actions to objc_build_method_signature(). (optarglist, myxdecls, mydecl, myparms, myparm): Remove nonterminals. (optparmlist): Express in terms of optparms and optellipsis. (optparms, optellipsis, objc_qual, objc_quals, objc_typename): New nonterminals. (keyworddecl): Use objc_typename instead of typename. (rid_to_yy): Mark RID_IN, RID_OUT, RID_INOUT, RID_BYCOPY, RID_BYREF and RID_ONEWAY as returning OBJC_TYPE_QUAL to yyparse(). [gcc/objc/ChangeLog] 2004-09-07 Ziemowit Laski <zlaski@apple.com> * Make-lang.in (objc/objc-parse.o): Depend on $(C_COMMON_H) instead of objc/objc-act.h. (objc/objc-act.o): Depend on $(HASHTAB_H). * objc-act.c: Include hashtab.h; in ObjC++ mode, include cp-tree.h and objcp-decl.h instead of c-tree.h. (build_module_descriptor, get_class_ivars, synth_id_with_class_suffix, error_with_ivar, gen_method_decl, gen_declaration, setup_string_decl, build_protocol_template): Adjust prototypes. (build_module_initializer_routine, start_class, continue_class, finish_class, start_method_def, objc_start_function, start_protocol, build_method_decl, objc_add_method, add_instance_variable, build_ivar_reference, is_ivar, is_private, get_super_receiver, build_selector_table_decl, objc_push_parm, objc_get_parm_info, gen_type_name, gen_type_name_0, start_var_decl, finish_var_decl, create_field_decl): New prototypes. (objc_expand_function_end, comp_method_with_proto, objc_expr_last, gen_declaration_1, gen_declarator, is_complex_decl, adorn_decl, define_decl, create_builtin_decl, gen_declspecs): Remove prototypes. (TYPE_ID): Rename to OBJECT_TYPEDEF_NAME. (CLASS_TYPEDEF_NAME): New. (TAG_EXECCLASS): Change from a global variable to a #define. (TAG_RETURN_STRUCT): Delete. (TAG_GNUINIT): New, holds '__objc_gnu_init' name. (objc_inherit_code, objc_public_flag): New, moved from c-parse.in. (string_descriptor): New struct. (string_htab): New hash table. (string_hash, string_eq): New prototypes. (generate_struct_by_value_array): Call create_field_decl() instead of create_builtin_decl(). (objc_init): Do not initialize objc_ellipsis_node or TAG_EXECCLASS; In ObjC++ mode, call cxx_init() instead of c_objc_common_init(). (objc_finish_file): In ObjC++, call instantiate_pending_templates() and cp_finish_file(). (define_decl, get_static_reference, get_protocol_reference, create_builtin_decl): Remove functions. (objc_start_class_interface, objc_start_category_interface, objc_start_protocol, objc_continue_interface, objc_finish_interface, objc_start_class_implementation, objc_start_category_implementation, objc_continue_implementation, objc_finish_implementation, objc_set_visibility, objc_set_method_type, objc_build_method_signature, objc_add_method_declaration, objc_start_method_definition, objc_add_instance_variable, objc_get_protocol_qualified_type, create_field_decl, start_var_decl, finish_var_decl): New functions. (setup_string_decl): Simplify since it is only called once. (synth_module_prologue): Call build_class_template(); predefine 'id' and 'Class' as typedefs; rename 'temp_type' to 'type'; disable debug hooks for duration of function; fix GNU runtime messenger signatures to correspond to reality; forward-declare '__objc_exec_class' for the GNU runtime; call build_selector_table_decl(); in ObjC++ mode, generate 'extern "C" { ... }' wrappers around synthesized declarations; call build_protocol_template() and build_category_template(). (string_hash, string_eq): New functions. (objc_build_string_object): Check metaclass correctness only once; store string literals in hash table. (objc_build_constructor): Do not convert initializer elements; adjust for ObjC++ impedance mismatch. (build_objc_symtab_template): Call create_field_decl() instead of create_builtin_decl(). (init_objc_symtab): Add missing conversion to initializer element. (build_metadata_decl): Call start_var_decl() instead of define_decl(). (generate_objc_symtab_decl): Do not call build_category_template(); call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(). (build_module_descriptor): Call create_field_decl() instead of grokfield(); call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(); always mark module descriptor as used; move GNU runtime-specific functionality to build_module_initializer_routine(). (build_module_initializer_routine): New function, broken off of build_module_descriptor(). (objc_static_init_needed_p, objc_generate_static_init_call): New functions. (generate_static_references, generate_strings, build_selector_translation_table, generate_descriptor_table, generate_ivars_list, generate_dispatch_table, generate_category): Call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(); build a type directly instead of via groktypename(). (build_selector_reference_decl, build_selector_table_decl, build_class_reference_decl, build_protocol_reference, generate_objc_image_info): Call start_var_decl() instead of build_decl(). (build_selector_reference): For GNU runtime, do not call build_selector_reference_decl(). (build_selector, build_typed_selector_reference): Always convert result to the selector type. (add_objc_string): Cast return value to 'char *'. (build_method_prototype_template, build_selector_template, build_method_template): Use actual selector type for fields pointing to selectors. (finish_objc): For GNU runtime, call build_module_initializer_routine() after build_module_descriptor(). (generate_protocol_list, generate_shared_structures): Call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(); build a type directly instead of via groktypename(). (synth_id_with_class_suffix): Return a string. (get_arg_type_list): For instance methods, use the instance type for 'self'; do not call groktypename_in_parm_context(). (build_objc_string_decl): Squash redeclaration errors in ObjC++. (objc_is_class_name): Use OBJC_TYPE_NAME instead of TYPE_NAME; handle RECORD_TYPEs in ObjC as well as ObjC++. (objc_is_id): New function. (objc_is_object_ptr): Return the canonical type node. (objc_get_class_ivars): Simplify using get_class_ivars(). (get_class_ivars): Remove second parameter; create a fresh copy of the ivar list for each call; do not check for existence of super class. (objc_eh_runtime_type): Mark #ifndef OBJCPLUS. (objc_init_exceptions): When using SJLJ-style exceptions, require the use of '-fobjc-exceptions' flag; do not require it for DWARF-style exceptions. (objc_build_exc_ptr, next_sjlj_build_try_catch_finally): Use objc_object_type instead of objc_id_type. (objc_begin_catch_clause): Convert the incoming PARM_DECL into a VAR_DECL before placing it in the appropriate scope; do not call define_decl(); adjust call to c_begin_compound_stmt(); use objc_object_type instead of objc_id_type. (build_next_objc_exception_stuff): Call create_field_decl() instead of create_builtin_decl(); construct type directly instead of calling groktypename(); use OBJC_VOID_AT_END to mark end of function parameters. (build_private_template): Adjust call to get_class_ivars(); build a type directly instead of via groktypename(). (build_protocol_template, build_method_prototype_list_template, build_method_prototype_template, build_category_template, build_selector_template, build_class_template, build_super_template, build_ivar_template, build_ivar_list_template, build_method_list_template, build_method_template): Call create_field_decl() instead of grokfield(). (objc_method_parm_type): Do not call groktypename(). (generate_descriptor_table): Call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(). (generate_method_descriptors, build_protocol_initializer, generate_dispatch_tables, build_category_initializer, build_shared_structure_initializer): Do not call groktypename(). (generate_protocols): Call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(); do not call groktypename(). (error_with_ivar): Remove last parameter. (check_ivars): Do not iterate ovar CLASS_RAW_IVARS lists in addition to CLASS_IVARS lists; adjust calls to error_with_ivar(). (generate_ivar_lists): Convert one of the initializer elements; do not call groktypename(). (get_arg_type_list, start_method_def, gen_method_def): Account for new representation of variable arguments and '...' in Objective-C methods; add Objective-C++ impedance matching code. (is_objc_type_qualifier): Remove function. (adjust_type_for_id_default): Simplify; there is no longer a need to wade through declspecs. (lookup_interface, start_class, continue_class, finish_class, start_method_def, start_protocol, build_method_decl, objc_add_method, add_instance_variable, build_ivar_reference, is_ivar, is_private, get_super_receiver, objc_build_finally_epilogue): Make into static functions. (receiver_is_class_object): Use new IS_CLASS() macro. (objc_build_message_expr): Tweak ObjC++ message argument handling; call objc_finish_message_expr() instead of finish_message_expr(). (finish_message_expr): Rename to objc_finish_message_expr(); use OBJC_TYPE_NAME and OBJC_SET_TYPE_NAME macros instead of TYPE_NAME. call gen_type_name() instead of gen_declaration(); call objc_is_id() instead of using IS_ID and IS_CLASS; Use objc_class_name instead of calling get_identifier("Class"); handle CONVERT_EXPRs in receiver. (build_objc_method_call, warn_with_method): Do not call groktypename(). (build_ivar_reference): Call convert() instead of clobbering in a type. (hash_init): Initialize string_htab hash table. (add_instance_variable): Simplify parameter list; do not call grokfield(); do not populate CLASS_IVARS list. (start_class): Check for the existence of super class, if one was specified. (continue_class): Use CLASS_RAW_IVARS rather than CLASS_IVARS; do not call build_class_template(); adjust call to get_class_ivars(); call build_decl(), pushdecl() and finish_decl() instead of define_decl(). (finish_class): Call build_decl(), pushdecl() and finish_decl() instead of define_decl(). (add_protocols): Use PROTOCOL_BINFO_ELTS for the tree vector size. (start_protocol): Do not call build_protocol_template(); use PROTOCOL_BINFO_ELTS for the tree vector size. (encode_type_qualifiers): Do not handle the 'const' qualifier here. (encode_pointer): Encode 'const char *' as 'r*', for backwards compatibility. (encode_array): Use HOST_WIDE_INT_PRINT_DEC instead of "%ld". (encode_type): Handle the 'const' qualifier here. (objc_parmlist): New global variable, sued by objc_push_parm and objc_get_parm_info(). (objc_push_parm, objc_get_parm_info): New functions. (objc_expr_last): Remove function. (synth_self_and_ucmd_args): For instance methods, use the instance type for 'self'; call objc_push_parm() instead of push_parm_decl(). (start_method_def): Do not call push_scope(), declare_parm_level(), pop_scope(), push_parm_decl(), store_parm_decls() or objc_expr_last(); just use objc_push_parm() and objc_get_parm_info(). (comp_method_with_proto): Remove function. (objc_types_are_equivalent): Strip away indirections before comparing underlying types. (comp_proto_with_proto): Do not call groktypename(); types are no longer in raw declspec format. (objc_start_function): New function. (really_start_method): Call comp_proto_with_proto() instead of comp_method_with_proto(); call objc_start_function() instead of hand-crafting a function declarator. (continue_method_def, objc_expand_function_end): Remove functions. (get_super_receiver): Call objc_get_current_scope() instead of get_current_scope(); reference 'super_class' field (instead of 'class'). (finish_method_def): Rename to objc_finish_method_definition() and add a function decl parameter; move method encoding call from objc_expand_function_end(). (is_complex_decl, adorn_decl, gen_declarator, gen_declspecs, gen_declaration_1): Remove functions. (tmpbuf, RAW_DECLSPEC): Remove. (gen_declaration): Remove second parameter; simplify to deal with TYPE_P nodes instead of raw declspecs. (gen_type_name, gen_type_name_0): New functions. (gen_method_decl): Remove second parameter; call gen_type_name() instead of gen_declaration_1(). (dump_interface): Adjust calls to gen_declaration() and gen_method_decl(); do not allocate a separate string buffer. (init_objc): Allocate a larger string buffer to accommodate dump_interface(); adjust call to build_module_descriptor(); add call to build_module_initializer_routine() for the GNU runtime. (generate_classref_translation_entry): Do not call start_decl(); call finish_var_decl() instead of finish_decl(); call convert() instead of build_c_cast(). * objc-act.h (CLASS_OWN_IVARS): Remove accessor. (CLASS_BINFO_ELTS): Reduce from 6 to 5, now that CLASS_OWN_IVARS is gone. (OCTI_GNU_INIT_DECL, GNU_INIT_decl): New. (OCTI_ELLIPSIS_NODE, objc_ellipsis_node): Remove. (OCTI_ID_ID, id_type, objc_id_id): Rename to OCTI_ID_NAME, objc_object_type and objc_object_name, respectively. (OCTI_CLS_REF, OCTI_CLASS_NAME, objc_class_reference, objc_class_name): New. (IS_CLASS): New macro. (IS_ID, IS_SUPER): Robustify. (OCTI_EXECCLASS_DECL, execclass_decl): New. (finish_file, start_class, continue_class, finish_class, start_method_def, continue_method_def, finish_method_def, start_protocol, finish_protocol, objc_build_throw_stmt, objc_build_try_catch_finally_stmt, objc_build_synchronized_prologue, objc_build_synchronized_epilogue, objc_build_try_prologue, objc_build_try_epilogue, objc_build_catch_stmt, objc_build_catch_epilogue, objc_build_finally_prologue, objc_build_finally_epilogue, is_ivar, is_private, is_public, add_instance_variable, objc_add_method, get_super_receiver, objc_clear_super_receiver, get_class_ivars_from_name, get_class_reference, get_static_reference, get_object_reference, build_message_expr, finish_message_expr, build_selector_expr, build_ivar_reference, build_keyword_decl, build_method_decl, build_protocol_expr, build_objc_string_object, objc_declare_alias, objc_declare_class, objc_declare_protocols, objc_comptypes, objc_check_decl, build_encode_expr): Remove prototypes. (imp_count, cat_count): Make GGC-aware. (OBJC_SET_TYPE_NAME): New macro. From-SVN: r87168
2004-09-08 02:49:44 +02:00
if (DECL_P (decl))
1992-01-18 00:15:38 +01:00
{
Makefile.in (c-parse.o): Depend on $(C_COMMON_H). [gcc/ChangeLog] 2004-09-07 Ziemowit Laski <zlaski@apple.com> * Makefile.in (c-parse.o): Depend on $(C_COMMON_H). * c-parse.in: Include c-common.h instead of objc-act.h. (ivar_decl_list, ivar_decls, ivar_decl, ivars, ivar_declarator, myparms, myparm): Remove %type declarations. (methodtype, optparms, OBJC_TYPE_QUAL, objc_quals, objc_qual, objc_typename, objc_try_catch_stmt, optellipsis): Add %type declarations. (objc_inherit_code, objc_public_flag): Remove. (typespec_nonreserved_nonattr): Call objc_get_protocol_qualified_type() instead of get_static_reference() and get_protocol_reference(). (stmt_nocomp): Call grokparm() on @catch parameter. (objcdef): Move semantic action to objc_finish_implementation(). (classdef): Move semantic action to objc_start_class_interface(), objc_continue_interface(), objc_finish_interface(), objc_start_class_implementation(), objc_continue_implementation(), objc_start_category_interface() and objc_start_category_implementation(). (protocoldef): Move semantic actions to objc_start_protocol() and objc_finish_interface(). (ivar_decl_list): Remove nonterminal. (visibility_spec): Move semantic actions to objc_set_visibility(). (ivar_decls): Remove assignment to $$. (ivar_decl): Rephrase in terms of component_decl; call objc_add_instance_variable(). (ivars, ivar_declarator): Remove nonterminals. (opt_semi): New nonterminal. (methodtype): Remove semantic actions. (methoddef): Move semantic actions to objc_set_method_type(), objc_start_method_definition() and objc_finish_method_definition(). (methodproto): Move semantic actions to objc_set_method_type() and objc_add_method_declaration(). (methoddecl): Use objc_typename instead of typename; move semantic actions to objc_build_method_signature(). (optarglist, myxdecls, mydecl, myparms, myparm): Remove nonterminals. (optparmlist): Express in terms of optparms and optellipsis. (optparms, optellipsis, objc_qual, objc_quals, objc_typename): New nonterminals. (keyworddecl): Use objc_typename instead of typename. (rid_to_yy): Mark RID_IN, RID_OUT, RID_INOUT, RID_BYCOPY, RID_BYREF and RID_ONEWAY as returning OBJC_TYPE_QUAL to yyparse(). [gcc/objc/ChangeLog] 2004-09-07 Ziemowit Laski <zlaski@apple.com> * Make-lang.in (objc/objc-parse.o): Depend on $(C_COMMON_H) instead of objc/objc-act.h. (objc/objc-act.o): Depend on $(HASHTAB_H). * objc-act.c: Include hashtab.h; in ObjC++ mode, include cp-tree.h and objcp-decl.h instead of c-tree.h. (build_module_descriptor, get_class_ivars, synth_id_with_class_suffix, error_with_ivar, gen_method_decl, gen_declaration, setup_string_decl, build_protocol_template): Adjust prototypes. (build_module_initializer_routine, start_class, continue_class, finish_class, start_method_def, objc_start_function, start_protocol, build_method_decl, objc_add_method, add_instance_variable, build_ivar_reference, is_ivar, is_private, get_super_receiver, build_selector_table_decl, objc_push_parm, objc_get_parm_info, gen_type_name, gen_type_name_0, start_var_decl, finish_var_decl, create_field_decl): New prototypes. (objc_expand_function_end, comp_method_with_proto, objc_expr_last, gen_declaration_1, gen_declarator, is_complex_decl, adorn_decl, define_decl, create_builtin_decl, gen_declspecs): Remove prototypes. (TYPE_ID): Rename to OBJECT_TYPEDEF_NAME. (CLASS_TYPEDEF_NAME): New. (TAG_EXECCLASS): Change from a global variable to a #define. (TAG_RETURN_STRUCT): Delete. (TAG_GNUINIT): New, holds '__objc_gnu_init' name. (objc_inherit_code, objc_public_flag): New, moved from c-parse.in. (string_descriptor): New struct. (string_htab): New hash table. (string_hash, string_eq): New prototypes. (generate_struct_by_value_array): Call create_field_decl() instead of create_builtin_decl(). (objc_init): Do not initialize objc_ellipsis_node or TAG_EXECCLASS; In ObjC++ mode, call cxx_init() instead of c_objc_common_init(). (objc_finish_file): In ObjC++, call instantiate_pending_templates() and cp_finish_file(). (define_decl, get_static_reference, get_protocol_reference, create_builtin_decl): Remove functions. (objc_start_class_interface, objc_start_category_interface, objc_start_protocol, objc_continue_interface, objc_finish_interface, objc_start_class_implementation, objc_start_category_implementation, objc_continue_implementation, objc_finish_implementation, objc_set_visibility, objc_set_method_type, objc_build_method_signature, objc_add_method_declaration, objc_start_method_definition, objc_add_instance_variable, objc_get_protocol_qualified_type, create_field_decl, start_var_decl, finish_var_decl): New functions. (setup_string_decl): Simplify since it is only called once. (synth_module_prologue): Call build_class_template(); predefine 'id' and 'Class' as typedefs; rename 'temp_type' to 'type'; disable debug hooks for duration of function; fix GNU runtime messenger signatures to correspond to reality; forward-declare '__objc_exec_class' for the GNU runtime; call build_selector_table_decl(); in ObjC++ mode, generate 'extern "C" { ... }' wrappers around synthesized declarations; call build_protocol_template() and build_category_template(). (string_hash, string_eq): New functions. (objc_build_string_object): Check metaclass correctness only once; store string literals in hash table. (objc_build_constructor): Do not convert initializer elements; adjust for ObjC++ impedance mismatch. (build_objc_symtab_template): Call create_field_decl() instead of create_builtin_decl(). (init_objc_symtab): Add missing conversion to initializer element. (build_metadata_decl): Call start_var_decl() instead of define_decl(). (generate_objc_symtab_decl): Do not call build_category_template(); call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(). (build_module_descriptor): Call create_field_decl() instead of grokfield(); call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(); always mark module descriptor as used; move GNU runtime-specific functionality to build_module_initializer_routine(). (build_module_initializer_routine): New function, broken off of build_module_descriptor(). (objc_static_init_needed_p, objc_generate_static_init_call): New functions. (generate_static_references, generate_strings, build_selector_translation_table, generate_descriptor_table, generate_ivars_list, generate_dispatch_table, generate_category): Call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(); build a type directly instead of via groktypename(). (build_selector_reference_decl, build_selector_table_decl, build_class_reference_decl, build_protocol_reference, generate_objc_image_info): Call start_var_decl() instead of build_decl(). (build_selector_reference): For GNU runtime, do not call build_selector_reference_decl(). (build_selector, build_typed_selector_reference): Always convert result to the selector type. (add_objc_string): Cast return value to 'char *'. (build_method_prototype_template, build_selector_template, build_method_template): Use actual selector type for fields pointing to selectors. (finish_objc): For GNU runtime, call build_module_initializer_routine() after build_module_descriptor(). (generate_protocol_list, generate_shared_structures): Call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(); build a type directly instead of via groktypename(). (synth_id_with_class_suffix): Return a string. (get_arg_type_list): For instance methods, use the instance type for 'self'; do not call groktypename_in_parm_context(). (build_objc_string_decl): Squash redeclaration errors in ObjC++. (objc_is_class_name): Use OBJC_TYPE_NAME instead of TYPE_NAME; handle RECORD_TYPEs in ObjC as well as ObjC++. (objc_is_id): New function. (objc_is_object_ptr): Return the canonical type node. (objc_get_class_ivars): Simplify using get_class_ivars(). (get_class_ivars): Remove second parameter; create a fresh copy of the ivar list for each call; do not check for existence of super class. (objc_eh_runtime_type): Mark #ifndef OBJCPLUS. (objc_init_exceptions): When using SJLJ-style exceptions, require the use of '-fobjc-exceptions' flag; do not require it for DWARF-style exceptions. (objc_build_exc_ptr, next_sjlj_build_try_catch_finally): Use objc_object_type instead of objc_id_type. (objc_begin_catch_clause): Convert the incoming PARM_DECL into a VAR_DECL before placing it in the appropriate scope; do not call define_decl(); adjust call to c_begin_compound_stmt(); use objc_object_type instead of objc_id_type. (build_next_objc_exception_stuff): Call create_field_decl() instead of create_builtin_decl(); construct type directly instead of calling groktypename(); use OBJC_VOID_AT_END to mark end of function parameters. (build_private_template): Adjust call to get_class_ivars(); build a type directly instead of via groktypename(). (build_protocol_template, build_method_prototype_list_template, build_method_prototype_template, build_category_template, build_selector_template, build_class_template, build_super_template, build_ivar_template, build_ivar_list_template, build_method_list_template, build_method_template): Call create_field_decl() instead of grokfield(). (objc_method_parm_type): Do not call groktypename(). (generate_descriptor_table): Call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(). (generate_method_descriptors, build_protocol_initializer, generate_dispatch_tables, build_category_initializer, build_shared_structure_initializer): Do not call groktypename(). (generate_protocols): Call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(); do not call groktypename(). (error_with_ivar): Remove last parameter. (check_ivars): Do not iterate ovar CLASS_RAW_IVARS lists in addition to CLASS_IVARS lists; adjust calls to error_with_ivar(). (generate_ivar_lists): Convert one of the initializer elements; do not call groktypename(). (get_arg_type_list, start_method_def, gen_method_def): Account for new representation of variable arguments and '...' in Objective-C methods; add Objective-C++ impedance matching code. (is_objc_type_qualifier): Remove function. (adjust_type_for_id_default): Simplify; there is no longer a need to wade through declspecs. (lookup_interface, start_class, continue_class, finish_class, start_method_def, start_protocol, build_method_decl, objc_add_method, add_instance_variable, build_ivar_reference, is_ivar, is_private, get_super_receiver, objc_build_finally_epilogue): Make into static functions. (receiver_is_class_object): Use new IS_CLASS() macro. (objc_build_message_expr): Tweak ObjC++ message argument handling; call objc_finish_message_expr() instead of finish_message_expr(). (finish_message_expr): Rename to objc_finish_message_expr(); use OBJC_TYPE_NAME and OBJC_SET_TYPE_NAME macros instead of TYPE_NAME. call gen_type_name() instead of gen_declaration(); call objc_is_id() instead of using IS_ID and IS_CLASS; Use objc_class_name instead of calling get_identifier("Class"); handle CONVERT_EXPRs in receiver. (build_objc_method_call, warn_with_method): Do not call groktypename(). (build_ivar_reference): Call convert() instead of clobbering in a type. (hash_init): Initialize string_htab hash table. (add_instance_variable): Simplify parameter list; do not call grokfield(); do not populate CLASS_IVARS list. (start_class): Check for the existence of super class, if one was specified. (continue_class): Use CLASS_RAW_IVARS rather than CLASS_IVARS; do not call build_class_template(); adjust call to get_class_ivars(); call build_decl(), pushdecl() and finish_decl() instead of define_decl(). (finish_class): Call build_decl(), pushdecl() and finish_decl() instead of define_decl(). (add_protocols): Use PROTOCOL_BINFO_ELTS for the tree vector size. (start_protocol): Do not call build_protocol_template(); use PROTOCOL_BINFO_ELTS for the tree vector size. (encode_type_qualifiers): Do not handle the 'const' qualifier here. (encode_pointer): Encode 'const char *' as 'r*', for backwards compatibility. (encode_array): Use HOST_WIDE_INT_PRINT_DEC instead of "%ld". (encode_type): Handle the 'const' qualifier here. (objc_parmlist): New global variable, sued by objc_push_parm and objc_get_parm_info(). (objc_push_parm, objc_get_parm_info): New functions. (objc_expr_last): Remove function. (synth_self_and_ucmd_args): For instance methods, use the instance type for 'self'; call objc_push_parm() instead of push_parm_decl(). (start_method_def): Do not call push_scope(), declare_parm_level(), pop_scope(), push_parm_decl(), store_parm_decls() or objc_expr_last(); just use objc_push_parm() and objc_get_parm_info(). (comp_method_with_proto): Remove function. (objc_types_are_equivalent): Strip away indirections before comparing underlying types. (comp_proto_with_proto): Do not call groktypename(); types are no longer in raw declspec format. (objc_start_function): New function. (really_start_method): Call comp_proto_with_proto() instead of comp_method_with_proto(); call objc_start_function() instead of hand-crafting a function declarator. (continue_method_def, objc_expand_function_end): Remove functions. (get_super_receiver): Call objc_get_current_scope() instead of get_current_scope(); reference 'super_class' field (instead of 'class'). (finish_method_def): Rename to objc_finish_method_definition() and add a function decl parameter; move method encoding call from objc_expand_function_end(). (is_complex_decl, adorn_decl, gen_declarator, gen_declspecs, gen_declaration_1): Remove functions. (tmpbuf, RAW_DECLSPEC): Remove. (gen_declaration): Remove second parameter; simplify to deal with TYPE_P nodes instead of raw declspecs. (gen_type_name, gen_type_name_0): New functions. (gen_method_decl): Remove second parameter; call gen_type_name() instead of gen_declaration_1(). (dump_interface): Adjust calls to gen_declaration() and gen_method_decl(); do not allocate a separate string buffer. (init_objc): Allocate a larger string buffer to accommodate dump_interface(); adjust call to build_module_descriptor(); add call to build_module_initializer_routine() for the GNU runtime. (generate_classref_translation_entry): Do not call start_decl(); call finish_var_decl() instead of finish_decl(); call convert() instead of build_c_cast(). * objc-act.h (CLASS_OWN_IVARS): Remove accessor. (CLASS_BINFO_ELTS): Reduce from 6 to 5, now that CLASS_OWN_IVARS is gone. (OCTI_GNU_INIT_DECL, GNU_INIT_decl): New. (OCTI_ELLIPSIS_NODE, objc_ellipsis_node): Remove. (OCTI_ID_ID, id_type, objc_id_id): Rename to OCTI_ID_NAME, objc_object_type and objc_object_name, respectively. (OCTI_CLS_REF, OCTI_CLASS_NAME, objc_class_reference, objc_class_name): New. (IS_CLASS): New macro. (IS_ID, IS_SUPER): Robustify. (OCTI_EXECCLASS_DECL, execclass_decl): New. (finish_file, start_class, continue_class, finish_class, start_method_def, continue_method_def, finish_method_def, start_protocol, finish_protocol, objc_build_throw_stmt, objc_build_try_catch_finally_stmt, objc_build_synchronized_prologue, objc_build_synchronized_epilogue, objc_build_try_prologue, objc_build_try_epilogue, objc_build_catch_stmt, objc_build_catch_epilogue, objc_build_finally_prologue, objc_build_finally_epilogue, is_ivar, is_private, is_public, add_instance_variable, objc_add_method, get_super_receiver, objc_clear_super_receiver, get_class_ivars_from_name, get_class_reference, get_static_reference, get_object_reference, build_message_expr, finish_message_expr, build_selector_expr, build_ivar_reference, build_keyword_decl, build_method_decl, build_protocol_expr, build_objc_string_object, objc_declare_alias, objc_declare_class, objc_declare_protocols, objc_comptypes, objc_check_decl, build_encode_expr): Remove prototypes. (imp_count, cat_count): Make GGC-aware. (OBJC_SET_TYPE_NAME): New macro. From-SVN: r87168
2004-09-08 02:49:44 +02:00
gen_type_name_0 (TREE_TYPE (decl));
1992-01-18 00:15:38 +01:00
Makefile.in (c-parse.o): Depend on $(C_COMMON_H). [gcc/ChangeLog] 2004-09-07 Ziemowit Laski <zlaski@apple.com> * Makefile.in (c-parse.o): Depend on $(C_COMMON_H). * c-parse.in: Include c-common.h instead of objc-act.h. (ivar_decl_list, ivar_decls, ivar_decl, ivars, ivar_declarator, myparms, myparm): Remove %type declarations. (methodtype, optparms, OBJC_TYPE_QUAL, objc_quals, objc_qual, objc_typename, objc_try_catch_stmt, optellipsis): Add %type declarations. (objc_inherit_code, objc_public_flag): Remove. (typespec_nonreserved_nonattr): Call objc_get_protocol_qualified_type() instead of get_static_reference() and get_protocol_reference(). (stmt_nocomp): Call grokparm() on @catch parameter. (objcdef): Move semantic action to objc_finish_implementation(). (classdef): Move semantic action to objc_start_class_interface(), objc_continue_interface(), objc_finish_interface(), objc_start_class_implementation(), objc_continue_implementation(), objc_start_category_interface() and objc_start_category_implementation(). (protocoldef): Move semantic actions to objc_start_protocol() and objc_finish_interface(). (ivar_decl_list): Remove nonterminal. (visibility_spec): Move semantic actions to objc_set_visibility(). (ivar_decls): Remove assignment to $$. (ivar_decl): Rephrase in terms of component_decl; call objc_add_instance_variable(). (ivars, ivar_declarator): Remove nonterminals. (opt_semi): New nonterminal. (methodtype): Remove semantic actions. (methoddef): Move semantic actions to objc_set_method_type(), objc_start_method_definition() and objc_finish_method_definition(). (methodproto): Move semantic actions to objc_set_method_type() and objc_add_method_declaration(). (methoddecl): Use objc_typename instead of typename; move semantic actions to objc_build_method_signature(). (optarglist, myxdecls, mydecl, myparms, myparm): Remove nonterminals. (optparmlist): Express in terms of optparms and optellipsis. (optparms, optellipsis, objc_qual, objc_quals, objc_typename): New nonterminals. (keyworddecl): Use objc_typename instead of typename. (rid_to_yy): Mark RID_IN, RID_OUT, RID_INOUT, RID_BYCOPY, RID_BYREF and RID_ONEWAY as returning OBJC_TYPE_QUAL to yyparse(). [gcc/objc/ChangeLog] 2004-09-07 Ziemowit Laski <zlaski@apple.com> * Make-lang.in (objc/objc-parse.o): Depend on $(C_COMMON_H) instead of objc/objc-act.h. (objc/objc-act.o): Depend on $(HASHTAB_H). * objc-act.c: Include hashtab.h; in ObjC++ mode, include cp-tree.h and objcp-decl.h instead of c-tree.h. (build_module_descriptor, get_class_ivars, synth_id_with_class_suffix, error_with_ivar, gen_method_decl, gen_declaration, setup_string_decl, build_protocol_template): Adjust prototypes. (build_module_initializer_routine, start_class, continue_class, finish_class, start_method_def, objc_start_function, start_protocol, build_method_decl, objc_add_method, add_instance_variable, build_ivar_reference, is_ivar, is_private, get_super_receiver, build_selector_table_decl, objc_push_parm, objc_get_parm_info, gen_type_name, gen_type_name_0, start_var_decl, finish_var_decl, create_field_decl): New prototypes. (objc_expand_function_end, comp_method_with_proto, objc_expr_last, gen_declaration_1, gen_declarator, is_complex_decl, adorn_decl, define_decl, create_builtin_decl, gen_declspecs): Remove prototypes. (TYPE_ID): Rename to OBJECT_TYPEDEF_NAME. (CLASS_TYPEDEF_NAME): New. (TAG_EXECCLASS): Change from a global variable to a #define. (TAG_RETURN_STRUCT): Delete. (TAG_GNUINIT): New, holds '__objc_gnu_init' name. (objc_inherit_code, objc_public_flag): New, moved from c-parse.in. (string_descriptor): New struct. (string_htab): New hash table. (string_hash, string_eq): New prototypes. (generate_struct_by_value_array): Call create_field_decl() instead of create_builtin_decl(). (objc_init): Do not initialize objc_ellipsis_node or TAG_EXECCLASS; In ObjC++ mode, call cxx_init() instead of c_objc_common_init(). (objc_finish_file): In ObjC++, call instantiate_pending_templates() and cp_finish_file(). (define_decl, get_static_reference, get_protocol_reference, create_builtin_decl): Remove functions. (objc_start_class_interface, objc_start_category_interface, objc_start_protocol, objc_continue_interface, objc_finish_interface, objc_start_class_implementation, objc_start_category_implementation, objc_continue_implementation, objc_finish_implementation, objc_set_visibility, objc_set_method_type, objc_build_method_signature, objc_add_method_declaration, objc_start_method_definition, objc_add_instance_variable, objc_get_protocol_qualified_type, create_field_decl, start_var_decl, finish_var_decl): New functions. (setup_string_decl): Simplify since it is only called once. (synth_module_prologue): Call build_class_template(); predefine 'id' and 'Class' as typedefs; rename 'temp_type' to 'type'; disable debug hooks for duration of function; fix GNU runtime messenger signatures to correspond to reality; forward-declare '__objc_exec_class' for the GNU runtime; call build_selector_table_decl(); in ObjC++ mode, generate 'extern "C" { ... }' wrappers around synthesized declarations; call build_protocol_template() and build_category_template(). (string_hash, string_eq): New functions. (objc_build_string_object): Check metaclass correctness only once; store string literals in hash table. (objc_build_constructor): Do not convert initializer elements; adjust for ObjC++ impedance mismatch. (build_objc_symtab_template): Call create_field_decl() instead of create_builtin_decl(). (init_objc_symtab): Add missing conversion to initializer element. (build_metadata_decl): Call start_var_decl() instead of define_decl(). (generate_objc_symtab_decl): Do not call build_category_template(); call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(). (build_module_descriptor): Call create_field_decl() instead of grokfield(); call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(); always mark module descriptor as used; move GNU runtime-specific functionality to build_module_initializer_routine(). (build_module_initializer_routine): New function, broken off of build_module_descriptor(). (objc_static_init_needed_p, objc_generate_static_init_call): New functions. (generate_static_references, generate_strings, build_selector_translation_table, generate_descriptor_table, generate_ivars_list, generate_dispatch_table, generate_category): Call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(); build a type directly instead of via groktypename(). (build_selector_reference_decl, build_selector_table_decl, build_class_reference_decl, build_protocol_reference, generate_objc_image_info): Call start_var_decl() instead of build_decl(). (build_selector_reference): For GNU runtime, do not call build_selector_reference_decl(). (build_selector, build_typed_selector_reference): Always convert result to the selector type. (add_objc_string): Cast return value to 'char *'. (build_method_prototype_template, build_selector_template, build_method_template): Use actual selector type for fields pointing to selectors. (finish_objc): For GNU runtime, call build_module_initializer_routine() after build_module_descriptor(). (generate_protocol_list, generate_shared_structures): Call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(); build a type directly instead of via groktypename(). (synth_id_with_class_suffix): Return a string. (get_arg_type_list): For instance methods, use the instance type for 'self'; do not call groktypename_in_parm_context(). (build_objc_string_decl): Squash redeclaration errors in ObjC++. (objc_is_class_name): Use OBJC_TYPE_NAME instead of TYPE_NAME; handle RECORD_TYPEs in ObjC as well as ObjC++. (objc_is_id): New function. (objc_is_object_ptr): Return the canonical type node. (objc_get_class_ivars): Simplify using get_class_ivars(). (get_class_ivars): Remove second parameter; create a fresh copy of the ivar list for each call; do not check for existence of super class. (objc_eh_runtime_type): Mark #ifndef OBJCPLUS. (objc_init_exceptions): When using SJLJ-style exceptions, require the use of '-fobjc-exceptions' flag; do not require it for DWARF-style exceptions. (objc_build_exc_ptr, next_sjlj_build_try_catch_finally): Use objc_object_type instead of objc_id_type. (objc_begin_catch_clause): Convert the incoming PARM_DECL into a VAR_DECL before placing it in the appropriate scope; do not call define_decl(); adjust call to c_begin_compound_stmt(); use objc_object_type instead of objc_id_type. (build_next_objc_exception_stuff): Call create_field_decl() instead of create_builtin_decl(); construct type directly instead of calling groktypename(); use OBJC_VOID_AT_END to mark end of function parameters. (build_private_template): Adjust call to get_class_ivars(); build a type directly instead of via groktypename(). (build_protocol_template, build_method_prototype_list_template, build_method_prototype_template, build_category_template, build_selector_template, build_class_template, build_super_template, build_ivar_template, build_ivar_list_template, build_method_list_template, build_method_template): Call create_field_decl() instead of grokfield(). (objc_method_parm_type): Do not call groktypename(). (generate_descriptor_table): Call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(). (generate_method_descriptors, build_protocol_initializer, generate_dispatch_tables, build_category_initializer, build_shared_structure_initializer): Do not call groktypename(). (generate_protocols): Call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(); do not call groktypename(). (error_with_ivar): Remove last parameter. (check_ivars): Do not iterate ovar CLASS_RAW_IVARS lists in addition to CLASS_IVARS lists; adjust calls to error_with_ivar(). (generate_ivar_lists): Convert one of the initializer elements; do not call groktypename(). (get_arg_type_list, start_method_def, gen_method_def): Account for new representation of variable arguments and '...' in Objective-C methods; add Objective-C++ impedance matching code. (is_objc_type_qualifier): Remove function. (adjust_type_for_id_default): Simplify; there is no longer a need to wade through declspecs. (lookup_interface, start_class, continue_class, finish_class, start_method_def, start_protocol, build_method_decl, objc_add_method, add_instance_variable, build_ivar_reference, is_ivar, is_private, get_super_receiver, objc_build_finally_epilogue): Make into static functions. (receiver_is_class_object): Use new IS_CLASS() macro. (objc_build_message_expr): Tweak ObjC++ message argument handling; call objc_finish_message_expr() instead of finish_message_expr(). (finish_message_expr): Rename to objc_finish_message_expr(); use OBJC_TYPE_NAME and OBJC_SET_TYPE_NAME macros instead of TYPE_NAME. call gen_type_name() instead of gen_declaration(); call objc_is_id() instead of using IS_ID and IS_CLASS; Use objc_class_name instead of calling get_identifier("Class"); handle CONVERT_EXPRs in receiver. (build_objc_method_call, warn_with_method): Do not call groktypename(). (build_ivar_reference): Call convert() instead of clobbering in a type. (hash_init): Initialize string_htab hash table. (add_instance_variable): Simplify parameter list; do not call grokfield(); do not populate CLASS_IVARS list. (start_class): Check for the existence of super class, if one was specified. (continue_class): Use CLASS_RAW_IVARS rather than CLASS_IVARS; do not call build_class_template(); adjust call to get_class_ivars(); call build_decl(), pushdecl() and finish_decl() instead of define_decl(). (finish_class): Call build_decl(), pushdecl() and finish_decl() instead of define_decl(). (add_protocols): Use PROTOCOL_BINFO_ELTS for the tree vector size. (start_protocol): Do not call build_protocol_template(); use PROTOCOL_BINFO_ELTS for the tree vector size. (encode_type_qualifiers): Do not handle the 'const' qualifier here. (encode_pointer): Encode 'const char *' as 'r*', for backwards compatibility. (encode_array): Use HOST_WIDE_INT_PRINT_DEC instead of "%ld". (encode_type): Handle the 'const' qualifier here. (objc_parmlist): New global variable, sued by objc_push_parm and objc_get_parm_info(). (objc_push_parm, objc_get_parm_info): New functions. (objc_expr_last): Remove function. (synth_self_and_ucmd_args): For instance methods, use the instance type for 'self'; call objc_push_parm() instead of push_parm_decl(). (start_method_def): Do not call push_scope(), declare_parm_level(), pop_scope(), push_parm_decl(), store_parm_decls() or objc_expr_last(); just use objc_push_parm() and objc_get_parm_info(). (comp_method_with_proto): Remove function. (objc_types_are_equivalent): Strip away indirections before comparing underlying types. (comp_proto_with_proto): Do not call groktypename(); types are no longer in raw declspec format. (objc_start_function): New function. (really_start_method): Call comp_proto_with_proto() instead of comp_method_with_proto(); call objc_start_function() instead of hand-crafting a function declarator. (continue_method_def, objc_expand_function_end): Remove functions. (get_super_receiver): Call objc_get_current_scope() instead of get_current_scope(); reference 'super_class' field (instead of 'class'). (finish_method_def): Rename to objc_finish_method_definition() and add a function decl parameter; move method encoding call from objc_expand_function_end(). (is_complex_decl, adorn_decl, gen_declarator, gen_declspecs, gen_declaration_1): Remove functions. (tmpbuf, RAW_DECLSPEC): Remove. (gen_declaration): Remove second parameter; simplify to deal with TYPE_P nodes instead of raw declspecs. (gen_type_name, gen_type_name_0): New functions. (gen_method_decl): Remove second parameter; call gen_type_name() instead of gen_declaration_1(). (dump_interface): Adjust calls to gen_declaration() and gen_method_decl(); do not allocate a separate string buffer. (init_objc): Allocate a larger string buffer to accommodate dump_interface(); adjust call to build_module_descriptor(); add call to build_module_initializer_routine() for the GNU runtime. (generate_classref_translation_entry): Do not call start_decl(); call finish_var_decl() instead of finish_decl(); call convert() instead of build_c_cast(). * objc-act.h (CLASS_OWN_IVARS): Remove accessor. (CLASS_BINFO_ELTS): Reduce from 6 to 5, now that CLASS_OWN_IVARS is gone. (OCTI_GNU_INIT_DECL, GNU_INIT_decl): New. (OCTI_ELLIPSIS_NODE, objc_ellipsis_node): Remove. (OCTI_ID_ID, id_type, objc_id_id): Rename to OCTI_ID_NAME, objc_object_type and objc_object_name, respectively. (OCTI_CLS_REF, OCTI_CLASS_NAME, objc_class_reference, objc_class_name): New. (IS_CLASS): New macro. (IS_ID, IS_SUPER): Robustify. (OCTI_EXECCLASS_DECL, execclass_decl): New. (finish_file, start_class, continue_class, finish_class, start_method_def, continue_method_def, finish_method_def, start_protocol, finish_protocol, objc_build_throw_stmt, objc_build_try_catch_finally_stmt, objc_build_synchronized_prologue, objc_build_synchronized_epilogue, objc_build_try_prologue, objc_build_try_epilogue, objc_build_catch_stmt, objc_build_catch_epilogue, objc_build_finally_prologue, objc_build_finally_epilogue, is_ivar, is_private, is_public, add_instance_variable, objc_add_method, get_super_receiver, objc_clear_super_receiver, get_class_ivars_from_name, get_class_reference, get_static_reference, get_object_reference, build_message_expr, finish_message_expr, build_selector_expr, build_ivar_reference, build_keyword_decl, build_method_decl, build_protocol_expr, build_objc_string_object, objc_declare_alias, objc_declare_class, objc_declare_protocols, objc_comptypes, objc_check_decl, build_encode_expr): Remove prototypes. (imp_count, cat_count): Make GGC-aware. (OBJC_SET_TYPE_NAME): New macro. From-SVN: r87168
2004-09-08 02:49:44 +02:00
if (DECL_NAME (decl))
1992-01-18 00:15:38 +01:00
{
Makefile.in (c-parse.o): Depend on $(C_COMMON_H). [gcc/ChangeLog] 2004-09-07 Ziemowit Laski <zlaski@apple.com> * Makefile.in (c-parse.o): Depend on $(C_COMMON_H). * c-parse.in: Include c-common.h instead of objc-act.h. (ivar_decl_list, ivar_decls, ivar_decl, ivars, ivar_declarator, myparms, myparm): Remove %type declarations. (methodtype, optparms, OBJC_TYPE_QUAL, objc_quals, objc_qual, objc_typename, objc_try_catch_stmt, optellipsis): Add %type declarations. (objc_inherit_code, objc_public_flag): Remove. (typespec_nonreserved_nonattr): Call objc_get_protocol_qualified_type() instead of get_static_reference() and get_protocol_reference(). (stmt_nocomp): Call grokparm() on @catch parameter. (objcdef): Move semantic action to objc_finish_implementation(). (classdef): Move semantic action to objc_start_class_interface(), objc_continue_interface(), objc_finish_interface(), objc_start_class_implementation(), objc_continue_implementation(), objc_start_category_interface() and objc_start_category_implementation(). (protocoldef): Move semantic actions to objc_start_protocol() and objc_finish_interface(). (ivar_decl_list): Remove nonterminal. (visibility_spec): Move semantic actions to objc_set_visibility(). (ivar_decls): Remove assignment to $$. (ivar_decl): Rephrase in terms of component_decl; call objc_add_instance_variable(). (ivars, ivar_declarator): Remove nonterminals. (opt_semi): New nonterminal. (methodtype): Remove semantic actions. (methoddef): Move semantic actions to objc_set_method_type(), objc_start_method_definition() and objc_finish_method_definition(). (methodproto): Move semantic actions to objc_set_method_type() and objc_add_method_declaration(). (methoddecl): Use objc_typename instead of typename; move semantic actions to objc_build_method_signature(). (optarglist, myxdecls, mydecl, myparms, myparm): Remove nonterminals. (optparmlist): Express in terms of optparms and optellipsis. (optparms, optellipsis, objc_qual, objc_quals, objc_typename): New nonterminals. (keyworddecl): Use objc_typename instead of typename. (rid_to_yy): Mark RID_IN, RID_OUT, RID_INOUT, RID_BYCOPY, RID_BYREF and RID_ONEWAY as returning OBJC_TYPE_QUAL to yyparse(). [gcc/objc/ChangeLog] 2004-09-07 Ziemowit Laski <zlaski@apple.com> * Make-lang.in (objc/objc-parse.o): Depend on $(C_COMMON_H) instead of objc/objc-act.h. (objc/objc-act.o): Depend on $(HASHTAB_H). * objc-act.c: Include hashtab.h; in ObjC++ mode, include cp-tree.h and objcp-decl.h instead of c-tree.h. (build_module_descriptor, get_class_ivars, synth_id_with_class_suffix, error_with_ivar, gen_method_decl, gen_declaration, setup_string_decl, build_protocol_template): Adjust prototypes. (build_module_initializer_routine, start_class, continue_class, finish_class, start_method_def, objc_start_function, start_protocol, build_method_decl, objc_add_method, add_instance_variable, build_ivar_reference, is_ivar, is_private, get_super_receiver, build_selector_table_decl, objc_push_parm, objc_get_parm_info, gen_type_name, gen_type_name_0, start_var_decl, finish_var_decl, create_field_decl): New prototypes. (objc_expand_function_end, comp_method_with_proto, objc_expr_last, gen_declaration_1, gen_declarator, is_complex_decl, adorn_decl, define_decl, create_builtin_decl, gen_declspecs): Remove prototypes. (TYPE_ID): Rename to OBJECT_TYPEDEF_NAME. (CLASS_TYPEDEF_NAME): New. (TAG_EXECCLASS): Change from a global variable to a #define. (TAG_RETURN_STRUCT): Delete. (TAG_GNUINIT): New, holds '__objc_gnu_init' name. (objc_inherit_code, objc_public_flag): New, moved from c-parse.in. (string_descriptor): New struct. (string_htab): New hash table. (string_hash, string_eq): New prototypes. (generate_struct_by_value_array): Call create_field_decl() instead of create_builtin_decl(). (objc_init): Do not initialize objc_ellipsis_node or TAG_EXECCLASS; In ObjC++ mode, call cxx_init() instead of c_objc_common_init(). (objc_finish_file): In ObjC++, call instantiate_pending_templates() and cp_finish_file(). (define_decl, get_static_reference, get_protocol_reference, create_builtin_decl): Remove functions. (objc_start_class_interface, objc_start_category_interface, objc_start_protocol, objc_continue_interface, objc_finish_interface, objc_start_class_implementation, objc_start_category_implementation, objc_continue_implementation, objc_finish_implementation, objc_set_visibility, objc_set_method_type, objc_build_method_signature, objc_add_method_declaration, objc_start_method_definition, objc_add_instance_variable, objc_get_protocol_qualified_type, create_field_decl, start_var_decl, finish_var_decl): New functions. (setup_string_decl): Simplify since it is only called once. (synth_module_prologue): Call build_class_template(); predefine 'id' and 'Class' as typedefs; rename 'temp_type' to 'type'; disable debug hooks for duration of function; fix GNU runtime messenger signatures to correspond to reality; forward-declare '__objc_exec_class' for the GNU runtime; call build_selector_table_decl(); in ObjC++ mode, generate 'extern "C" { ... }' wrappers around synthesized declarations; call build_protocol_template() and build_category_template(). (string_hash, string_eq): New functions. (objc_build_string_object): Check metaclass correctness only once; store string literals in hash table. (objc_build_constructor): Do not convert initializer elements; adjust for ObjC++ impedance mismatch. (build_objc_symtab_template): Call create_field_decl() instead of create_builtin_decl(). (init_objc_symtab): Add missing conversion to initializer element. (build_metadata_decl): Call start_var_decl() instead of define_decl(). (generate_objc_symtab_decl): Do not call build_category_template(); call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(). (build_module_descriptor): Call create_field_decl() instead of grokfield(); call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(); always mark module descriptor as used; move GNU runtime-specific functionality to build_module_initializer_routine(). (build_module_initializer_routine): New function, broken off of build_module_descriptor(). (objc_static_init_needed_p, objc_generate_static_init_call): New functions. (generate_static_references, generate_strings, build_selector_translation_table, generate_descriptor_table, generate_ivars_list, generate_dispatch_table, generate_category): Call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(); build a type directly instead of via groktypename(). (build_selector_reference_decl, build_selector_table_decl, build_class_reference_decl, build_protocol_reference, generate_objc_image_info): Call start_var_decl() instead of build_decl(). (build_selector_reference): For GNU runtime, do not call build_selector_reference_decl(). (build_selector, build_typed_selector_reference): Always convert result to the selector type. (add_objc_string): Cast return value to 'char *'. (build_method_prototype_template, build_selector_template, build_method_template): Use actual selector type for fields pointing to selectors. (finish_objc): For GNU runtime, call build_module_initializer_routine() after build_module_descriptor(). (generate_protocol_list, generate_shared_structures): Call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(); build a type directly instead of via groktypename(). (synth_id_with_class_suffix): Return a string. (get_arg_type_list): For instance methods, use the instance type for 'self'; do not call groktypename_in_parm_context(). (build_objc_string_decl): Squash redeclaration errors in ObjC++. (objc_is_class_name): Use OBJC_TYPE_NAME instead of TYPE_NAME; handle RECORD_TYPEs in ObjC as well as ObjC++. (objc_is_id): New function. (objc_is_object_ptr): Return the canonical type node. (objc_get_class_ivars): Simplify using get_class_ivars(). (get_class_ivars): Remove second parameter; create a fresh copy of the ivar list for each call; do not check for existence of super class. (objc_eh_runtime_type): Mark #ifndef OBJCPLUS. (objc_init_exceptions): When using SJLJ-style exceptions, require the use of '-fobjc-exceptions' flag; do not require it for DWARF-style exceptions. (objc_build_exc_ptr, next_sjlj_build_try_catch_finally): Use objc_object_type instead of objc_id_type. (objc_begin_catch_clause): Convert the incoming PARM_DECL into a VAR_DECL before placing it in the appropriate scope; do not call define_decl(); adjust call to c_begin_compound_stmt(); use objc_object_type instead of objc_id_type. (build_next_objc_exception_stuff): Call create_field_decl() instead of create_builtin_decl(); construct type directly instead of calling groktypename(); use OBJC_VOID_AT_END to mark end of function parameters. (build_private_template): Adjust call to get_class_ivars(); build a type directly instead of via groktypename(). (build_protocol_template, build_method_prototype_list_template, build_method_prototype_template, build_category_template, build_selector_template, build_class_template, build_super_template, build_ivar_template, build_ivar_list_template, build_method_list_template, build_method_template): Call create_field_decl() instead of grokfield(). (objc_method_parm_type): Do not call groktypename(). (generate_descriptor_table): Call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(). (generate_method_descriptors, build_protocol_initializer, generate_dispatch_tables, build_category_initializer, build_shared_structure_initializer): Do not call groktypename(). (generate_protocols): Call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(); do not call groktypename(). (error_with_ivar): Remove last parameter. (check_ivars): Do not iterate ovar CLASS_RAW_IVARS lists in addition to CLASS_IVARS lists; adjust calls to error_with_ivar(). (generate_ivar_lists): Convert one of the initializer elements; do not call groktypename(). (get_arg_type_list, start_method_def, gen_method_def): Account for new representation of variable arguments and '...' in Objective-C methods; add Objective-C++ impedance matching code. (is_objc_type_qualifier): Remove function. (adjust_type_for_id_default): Simplify; there is no longer a need to wade through declspecs. (lookup_interface, start_class, continue_class, finish_class, start_method_def, start_protocol, build_method_decl, objc_add_method, add_instance_variable, build_ivar_reference, is_ivar, is_private, get_super_receiver, objc_build_finally_epilogue): Make into static functions. (receiver_is_class_object): Use new IS_CLASS() macro. (objc_build_message_expr): Tweak ObjC++ message argument handling; call objc_finish_message_expr() instead of finish_message_expr(). (finish_message_expr): Rename to objc_finish_message_expr(); use OBJC_TYPE_NAME and OBJC_SET_TYPE_NAME macros instead of TYPE_NAME. call gen_type_name() instead of gen_declaration(); call objc_is_id() instead of using IS_ID and IS_CLASS; Use objc_class_name instead of calling get_identifier("Class"); handle CONVERT_EXPRs in receiver. (build_objc_method_call, warn_with_method): Do not call groktypename(). (build_ivar_reference): Call convert() instead of clobbering in a type. (hash_init): Initialize string_htab hash table. (add_instance_variable): Simplify parameter list; do not call grokfield(); do not populate CLASS_IVARS list. (start_class): Check for the existence of super class, if one was specified. (continue_class): Use CLASS_RAW_IVARS rather than CLASS_IVARS; do not call build_class_template(); adjust call to get_class_ivars(); call build_decl(), pushdecl() and finish_decl() instead of define_decl(). (finish_class): Call build_decl(), pushdecl() and finish_decl() instead of define_decl(). (add_protocols): Use PROTOCOL_BINFO_ELTS for the tree vector size. (start_protocol): Do not call build_protocol_template(); use PROTOCOL_BINFO_ELTS for the tree vector size. (encode_type_qualifiers): Do not handle the 'const' qualifier here. (encode_pointer): Encode 'const char *' as 'r*', for backwards compatibility. (encode_array): Use HOST_WIDE_INT_PRINT_DEC instead of "%ld". (encode_type): Handle the 'const' qualifier here. (objc_parmlist): New global variable, sued by objc_push_parm and objc_get_parm_info(). (objc_push_parm, objc_get_parm_info): New functions. (objc_expr_last): Remove function. (synth_self_and_ucmd_args): For instance methods, use the instance type for 'self'; call objc_push_parm() instead of push_parm_decl(). (start_method_def): Do not call push_scope(), declare_parm_level(), pop_scope(), push_parm_decl(), store_parm_decls() or objc_expr_last(); just use objc_push_parm() and objc_get_parm_info(). (comp_method_with_proto): Remove function. (objc_types_are_equivalent): Strip away indirections before comparing underlying types. (comp_proto_with_proto): Do not call groktypename(); types are no longer in raw declspec format. (objc_start_function): New function. (really_start_method): Call comp_proto_with_proto() instead of comp_method_with_proto(); call objc_start_function() instead of hand-crafting a function declarator. (continue_method_def, objc_expand_function_end): Remove functions. (get_super_receiver): Call objc_get_current_scope() instead of get_current_scope(); reference 'super_class' field (instead of 'class'). (finish_method_def): Rename to objc_finish_method_definition() and add a function decl parameter; move method encoding call from objc_expand_function_end(). (is_complex_decl, adorn_decl, gen_declarator, gen_declspecs, gen_declaration_1): Remove functions. (tmpbuf, RAW_DECLSPEC): Remove. (gen_declaration): Remove second parameter; simplify to deal with TYPE_P nodes instead of raw declspecs. (gen_type_name, gen_type_name_0): New functions. (gen_method_decl): Remove second parameter; call gen_type_name() instead of gen_declaration_1(). (dump_interface): Adjust calls to gen_declaration() and gen_method_decl(); do not allocate a separate string buffer. (init_objc): Allocate a larger string buffer to accommodate dump_interface(); adjust call to build_module_descriptor(); add call to build_module_initializer_routine() for the GNU runtime. (generate_classref_translation_entry): Do not call start_decl(); call finish_var_decl() instead of finish_decl(); call convert() instead of build_c_cast(). * objc-act.h (CLASS_OWN_IVARS): Remove accessor. (CLASS_BINFO_ELTS): Reduce from 6 to 5, now that CLASS_OWN_IVARS is gone. (OCTI_GNU_INIT_DECL, GNU_INIT_decl): New. (OCTI_ELLIPSIS_NODE, objc_ellipsis_node): Remove. (OCTI_ID_ID, id_type, objc_id_id): Rename to OCTI_ID_NAME, objc_object_type and objc_object_name, respectively. (OCTI_CLS_REF, OCTI_CLASS_NAME, objc_class_reference, objc_class_name): New. (IS_CLASS): New macro. (IS_ID, IS_SUPER): Robustify. (OCTI_EXECCLASS_DECL, execclass_decl): New. (finish_file, start_class, continue_class, finish_class, start_method_def, continue_method_def, finish_method_def, start_protocol, finish_protocol, objc_build_throw_stmt, objc_build_try_catch_finally_stmt, objc_build_synchronized_prologue, objc_build_synchronized_epilogue, objc_build_try_prologue, objc_build_try_epilogue, objc_build_catch_stmt, objc_build_catch_epilogue, objc_build_finally_prologue, objc_build_finally_epilogue, is_ivar, is_private, is_public, add_instance_variable, objc_add_method, get_super_receiver, objc_clear_super_receiver, get_class_ivars_from_name, get_class_reference, get_static_reference, get_object_reference, build_message_expr, finish_message_expr, build_selector_expr, build_ivar_reference, build_keyword_decl, build_method_decl, build_protocol_expr, build_objc_string_object, objc_declare_alias, objc_declare_class, objc_declare_protocols, objc_comptypes, objc_check_decl, build_encode_expr): Remove prototypes. (imp_count, cat_count): Make GGC-aware. (OBJC_SET_TYPE_NAME): New macro. From-SVN: r87168
2004-09-08 02:49:44 +02:00
if (!POINTER_TYPE_P (TREE_TYPE (decl)))
strcat (errbuf, " ");
1992-01-18 00:15:38 +01:00
Makefile.in (c-parse.o): Depend on $(C_COMMON_H). [gcc/ChangeLog] 2004-09-07 Ziemowit Laski <zlaski@apple.com> * Makefile.in (c-parse.o): Depend on $(C_COMMON_H). * c-parse.in: Include c-common.h instead of objc-act.h. (ivar_decl_list, ivar_decls, ivar_decl, ivars, ivar_declarator, myparms, myparm): Remove %type declarations. (methodtype, optparms, OBJC_TYPE_QUAL, objc_quals, objc_qual, objc_typename, objc_try_catch_stmt, optellipsis): Add %type declarations. (objc_inherit_code, objc_public_flag): Remove. (typespec_nonreserved_nonattr): Call objc_get_protocol_qualified_type() instead of get_static_reference() and get_protocol_reference(). (stmt_nocomp): Call grokparm() on @catch parameter. (objcdef): Move semantic action to objc_finish_implementation(). (classdef): Move semantic action to objc_start_class_interface(), objc_continue_interface(), objc_finish_interface(), objc_start_class_implementation(), objc_continue_implementation(), objc_start_category_interface() and objc_start_category_implementation(). (protocoldef): Move semantic actions to objc_start_protocol() and objc_finish_interface(). (ivar_decl_list): Remove nonterminal. (visibility_spec): Move semantic actions to objc_set_visibility(). (ivar_decls): Remove assignment to $$. (ivar_decl): Rephrase in terms of component_decl; call objc_add_instance_variable(). (ivars, ivar_declarator): Remove nonterminals. (opt_semi): New nonterminal. (methodtype): Remove semantic actions. (methoddef): Move semantic actions to objc_set_method_type(), objc_start_method_definition() and objc_finish_method_definition(). (methodproto): Move semantic actions to objc_set_method_type() and objc_add_method_declaration(). (methoddecl): Use objc_typename instead of typename; move semantic actions to objc_build_method_signature(). (optarglist, myxdecls, mydecl, myparms, myparm): Remove nonterminals. (optparmlist): Express in terms of optparms and optellipsis. (optparms, optellipsis, objc_qual, objc_quals, objc_typename): New nonterminals. (keyworddecl): Use objc_typename instead of typename. (rid_to_yy): Mark RID_IN, RID_OUT, RID_INOUT, RID_BYCOPY, RID_BYREF and RID_ONEWAY as returning OBJC_TYPE_QUAL to yyparse(). [gcc/objc/ChangeLog] 2004-09-07 Ziemowit Laski <zlaski@apple.com> * Make-lang.in (objc/objc-parse.o): Depend on $(C_COMMON_H) instead of objc/objc-act.h. (objc/objc-act.o): Depend on $(HASHTAB_H). * objc-act.c: Include hashtab.h; in ObjC++ mode, include cp-tree.h and objcp-decl.h instead of c-tree.h. (build_module_descriptor, get_class_ivars, synth_id_with_class_suffix, error_with_ivar, gen_method_decl, gen_declaration, setup_string_decl, build_protocol_template): Adjust prototypes. (build_module_initializer_routine, start_class, continue_class, finish_class, start_method_def, objc_start_function, start_protocol, build_method_decl, objc_add_method, add_instance_variable, build_ivar_reference, is_ivar, is_private, get_super_receiver, build_selector_table_decl, objc_push_parm, objc_get_parm_info, gen_type_name, gen_type_name_0, start_var_decl, finish_var_decl, create_field_decl): New prototypes. (objc_expand_function_end, comp_method_with_proto, objc_expr_last, gen_declaration_1, gen_declarator, is_complex_decl, adorn_decl, define_decl, create_builtin_decl, gen_declspecs): Remove prototypes. (TYPE_ID): Rename to OBJECT_TYPEDEF_NAME. (CLASS_TYPEDEF_NAME): New. (TAG_EXECCLASS): Change from a global variable to a #define. (TAG_RETURN_STRUCT): Delete. (TAG_GNUINIT): New, holds '__objc_gnu_init' name. (objc_inherit_code, objc_public_flag): New, moved from c-parse.in. (string_descriptor): New struct. (string_htab): New hash table. (string_hash, string_eq): New prototypes. (generate_struct_by_value_array): Call create_field_decl() instead of create_builtin_decl(). (objc_init): Do not initialize objc_ellipsis_node or TAG_EXECCLASS; In ObjC++ mode, call cxx_init() instead of c_objc_common_init(). (objc_finish_file): In ObjC++, call instantiate_pending_templates() and cp_finish_file(). (define_decl, get_static_reference, get_protocol_reference, create_builtin_decl): Remove functions. (objc_start_class_interface, objc_start_category_interface, objc_start_protocol, objc_continue_interface, objc_finish_interface, objc_start_class_implementation, objc_start_category_implementation, objc_continue_implementation, objc_finish_implementation, objc_set_visibility, objc_set_method_type, objc_build_method_signature, objc_add_method_declaration, objc_start_method_definition, objc_add_instance_variable, objc_get_protocol_qualified_type, create_field_decl, start_var_decl, finish_var_decl): New functions. (setup_string_decl): Simplify since it is only called once. (synth_module_prologue): Call build_class_template(); predefine 'id' and 'Class' as typedefs; rename 'temp_type' to 'type'; disable debug hooks for duration of function; fix GNU runtime messenger signatures to correspond to reality; forward-declare '__objc_exec_class' for the GNU runtime; call build_selector_table_decl(); in ObjC++ mode, generate 'extern "C" { ... }' wrappers around synthesized declarations; call build_protocol_template() and build_category_template(). (string_hash, string_eq): New functions. (objc_build_string_object): Check metaclass correctness only once; store string literals in hash table. (objc_build_constructor): Do not convert initializer elements; adjust for ObjC++ impedance mismatch. (build_objc_symtab_template): Call create_field_decl() instead of create_builtin_decl(). (init_objc_symtab): Add missing conversion to initializer element. (build_metadata_decl): Call start_var_decl() instead of define_decl(). (generate_objc_symtab_decl): Do not call build_category_template(); call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(). (build_module_descriptor): Call create_field_decl() instead of grokfield(); call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(); always mark module descriptor as used; move GNU runtime-specific functionality to build_module_initializer_routine(). (build_module_initializer_routine): New function, broken off of build_module_descriptor(). (objc_static_init_needed_p, objc_generate_static_init_call): New functions. (generate_static_references, generate_strings, build_selector_translation_table, generate_descriptor_table, generate_ivars_list, generate_dispatch_table, generate_category): Call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(); build a type directly instead of via groktypename(). (build_selector_reference_decl, build_selector_table_decl, build_class_reference_decl, build_protocol_reference, generate_objc_image_info): Call start_var_decl() instead of build_decl(). (build_selector_reference): For GNU runtime, do not call build_selector_reference_decl(). (build_selector, build_typed_selector_reference): Always convert result to the selector type. (add_objc_string): Cast return value to 'char *'. (build_method_prototype_template, build_selector_template, build_method_template): Use actual selector type for fields pointing to selectors. (finish_objc): For GNU runtime, call build_module_initializer_routine() after build_module_descriptor(). (generate_protocol_list, generate_shared_structures): Call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(); build a type directly instead of via groktypename(). (synth_id_with_class_suffix): Return a string. (get_arg_type_list): For instance methods, use the instance type for 'self'; do not call groktypename_in_parm_context(). (build_objc_string_decl): Squash redeclaration errors in ObjC++. (objc_is_class_name): Use OBJC_TYPE_NAME instead of TYPE_NAME; handle RECORD_TYPEs in ObjC as well as ObjC++. (objc_is_id): New function. (objc_is_object_ptr): Return the canonical type node. (objc_get_class_ivars): Simplify using get_class_ivars(). (get_class_ivars): Remove second parameter; create a fresh copy of the ivar list for each call; do not check for existence of super class. (objc_eh_runtime_type): Mark #ifndef OBJCPLUS. (objc_init_exceptions): When using SJLJ-style exceptions, require the use of '-fobjc-exceptions' flag; do not require it for DWARF-style exceptions. (objc_build_exc_ptr, next_sjlj_build_try_catch_finally): Use objc_object_type instead of objc_id_type. (objc_begin_catch_clause): Convert the incoming PARM_DECL into a VAR_DECL before placing it in the appropriate scope; do not call define_decl(); adjust call to c_begin_compound_stmt(); use objc_object_type instead of objc_id_type. (build_next_objc_exception_stuff): Call create_field_decl() instead of create_builtin_decl(); construct type directly instead of calling groktypename(); use OBJC_VOID_AT_END to mark end of function parameters. (build_private_template): Adjust call to get_class_ivars(); build a type directly instead of via groktypename(). (build_protocol_template, build_method_prototype_list_template, build_method_prototype_template, build_category_template, build_selector_template, build_class_template, build_super_template, build_ivar_template, build_ivar_list_template, build_method_list_template, build_method_template): Call create_field_decl() instead of grokfield(). (objc_method_parm_type): Do not call groktypename(). (generate_descriptor_table): Call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(). (generate_method_descriptors, build_protocol_initializer, generate_dispatch_tables, build_category_initializer, build_shared_structure_initializer): Do not call groktypename(). (generate_protocols): Call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(); do not call groktypename(). (error_with_ivar): Remove last parameter. (check_ivars): Do not iterate ovar CLASS_RAW_IVARS lists in addition to CLASS_IVARS lists; adjust calls to error_with_ivar(). (generate_ivar_lists): Convert one of the initializer elements; do not call groktypename(). (get_arg_type_list, start_method_def, gen_method_def): Account for new representation of variable arguments and '...' in Objective-C methods; add Objective-C++ impedance matching code. (is_objc_type_qualifier): Remove function. (adjust_type_for_id_default): Simplify; there is no longer a need to wade through declspecs. (lookup_interface, start_class, continue_class, finish_class, start_method_def, start_protocol, build_method_decl, objc_add_method, add_instance_variable, build_ivar_reference, is_ivar, is_private, get_super_receiver, objc_build_finally_epilogue): Make into static functions. (receiver_is_class_object): Use new IS_CLASS() macro. (objc_build_message_expr): Tweak ObjC++ message argument handling; call objc_finish_message_expr() instead of finish_message_expr(). (finish_message_expr): Rename to objc_finish_message_expr(); use OBJC_TYPE_NAME and OBJC_SET_TYPE_NAME macros instead of TYPE_NAME. call gen_type_name() instead of gen_declaration(); call objc_is_id() instead of using IS_ID and IS_CLASS; Use objc_class_name instead of calling get_identifier("Class"); handle CONVERT_EXPRs in receiver. (build_objc_method_call, warn_with_method): Do not call groktypename(). (build_ivar_reference): Call convert() instead of clobbering in a type. (hash_init): Initialize string_htab hash table. (add_instance_variable): Simplify parameter list; do not call grokfield(); do not populate CLASS_IVARS list. (start_class): Check for the existence of super class, if one was specified. (continue_class): Use CLASS_RAW_IVARS rather than CLASS_IVARS; do not call build_class_template(); adjust call to get_class_ivars(); call build_decl(), pushdecl() and finish_decl() instead of define_decl(). (finish_class): Call build_decl(), pushdecl() and finish_decl() instead of define_decl(). (add_protocols): Use PROTOCOL_BINFO_ELTS for the tree vector size. (start_protocol): Do not call build_protocol_template(); use PROTOCOL_BINFO_ELTS for the tree vector size. (encode_type_qualifiers): Do not handle the 'const' qualifier here. (encode_pointer): Encode 'const char *' as 'r*', for backwards compatibility. (encode_array): Use HOST_WIDE_INT_PRINT_DEC instead of "%ld". (encode_type): Handle the 'const' qualifier here. (objc_parmlist): New global variable, sued by objc_push_parm and objc_get_parm_info(). (objc_push_parm, objc_get_parm_info): New functions. (objc_expr_last): Remove function. (synth_self_and_ucmd_args): For instance methods, use the instance type for 'self'; call objc_push_parm() instead of push_parm_decl(). (start_method_def): Do not call push_scope(), declare_parm_level(), pop_scope(), push_parm_decl(), store_parm_decls() or objc_expr_last(); just use objc_push_parm() and objc_get_parm_info(). (comp_method_with_proto): Remove function. (objc_types_are_equivalent): Strip away indirections before comparing underlying types. (comp_proto_with_proto): Do not call groktypename(); types are no longer in raw declspec format. (objc_start_function): New function. (really_start_method): Call comp_proto_with_proto() instead of comp_method_with_proto(); call objc_start_function() instead of hand-crafting a function declarator. (continue_method_def, objc_expand_function_end): Remove functions. (get_super_receiver): Call objc_get_current_scope() instead of get_current_scope(); reference 'super_class' field (instead of 'class'). (finish_method_def): Rename to objc_finish_method_definition() and add a function decl parameter; move method encoding call from objc_expand_function_end(). (is_complex_decl, adorn_decl, gen_declarator, gen_declspecs, gen_declaration_1): Remove functions. (tmpbuf, RAW_DECLSPEC): Remove. (gen_declaration): Remove second parameter; simplify to deal with TYPE_P nodes instead of raw declspecs. (gen_type_name, gen_type_name_0): New functions. (gen_method_decl): Remove second parameter; call gen_type_name() instead of gen_declaration_1(). (dump_interface): Adjust calls to gen_declaration() and gen_method_decl(); do not allocate a separate string buffer. (init_objc): Allocate a larger string buffer to accommodate dump_interface(); adjust call to build_module_descriptor(); add call to build_module_initializer_routine() for the GNU runtime. (generate_classref_translation_entry): Do not call start_decl(); call finish_var_decl() instead of finish_decl(); call convert() instead of build_c_cast(). * objc-act.h (CLASS_OWN_IVARS): Remove accessor. (CLASS_BINFO_ELTS): Reduce from 6 to 5, now that CLASS_OWN_IVARS is gone. (OCTI_GNU_INIT_DECL, GNU_INIT_decl): New. (OCTI_ELLIPSIS_NODE, objc_ellipsis_node): Remove. (OCTI_ID_ID, id_type, objc_id_id): Rename to OCTI_ID_NAME, objc_object_type and objc_object_name, respectively. (OCTI_CLS_REF, OCTI_CLASS_NAME, objc_class_reference, objc_class_name): New. (IS_CLASS): New macro. (IS_ID, IS_SUPER): Robustify. (OCTI_EXECCLASS_DECL, execclass_decl): New. (finish_file, start_class, continue_class, finish_class, start_method_def, continue_method_def, finish_method_def, start_protocol, finish_protocol, objc_build_throw_stmt, objc_build_try_catch_finally_stmt, objc_build_synchronized_prologue, objc_build_synchronized_epilogue, objc_build_try_prologue, objc_build_try_epilogue, objc_build_catch_stmt, objc_build_catch_epilogue, objc_build_finally_prologue, objc_build_finally_epilogue, is_ivar, is_private, is_public, add_instance_variable, objc_add_method, get_super_receiver, objc_clear_super_receiver, get_class_ivars_from_name, get_class_reference, get_static_reference, get_object_reference, build_message_expr, finish_message_expr, build_selector_expr, build_ivar_reference, build_keyword_decl, build_method_decl, build_protocol_expr, build_objc_string_object, objc_declare_alias, objc_declare_class, objc_declare_protocols, objc_comptypes, objc_check_decl, build_encode_expr): Remove prototypes. (imp_count, cat_count): Make GGC-aware. (OBJC_SET_TYPE_NAME): New macro. From-SVN: r87168
2004-09-08 02:49:44 +02:00
strcat (errbuf, IDENTIFIER_POINTER (DECL_NAME (decl)));
1992-01-18 00:15:38 +01:00
}
Makefile.in (c-parse.o): Depend on $(C_COMMON_H). [gcc/ChangeLog] 2004-09-07 Ziemowit Laski <zlaski@apple.com> * Makefile.in (c-parse.o): Depend on $(C_COMMON_H). * c-parse.in: Include c-common.h instead of objc-act.h. (ivar_decl_list, ivar_decls, ivar_decl, ivars, ivar_declarator, myparms, myparm): Remove %type declarations. (methodtype, optparms, OBJC_TYPE_QUAL, objc_quals, objc_qual, objc_typename, objc_try_catch_stmt, optellipsis): Add %type declarations. (objc_inherit_code, objc_public_flag): Remove. (typespec_nonreserved_nonattr): Call objc_get_protocol_qualified_type() instead of get_static_reference() and get_protocol_reference(). (stmt_nocomp): Call grokparm() on @catch parameter. (objcdef): Move semantic action to objc_finish_implementation(). (classdef): Move semantic action to objc_start_class_interface(), objc_continue_interface(), objc_finish_interface(), objc_start_class_implementation(), objc_continue_implementation(), objc_start_category_interface() and objc_start_category_implementation(). (protocoldef): Move semantic actions to objc_start_protocol() and objc_finish_interface(). (ivar_decl_list): Remove nonterminal. (visibility_spec): Move semantic actions to objc_set_visibility(). (ivar_decls): Remove assignment to $$. (ivar_decl): Rephrase in terms of component_decl; call objc_add_instance_variable(). (ivars, ivar_declarator): Remove nonterminals. (opt_semi): New nonterminal. (methodtype): Remove semantic actions. (methoddef): Move semantic actions to objc_set_method_type(), objc_start_method_definition() and objc_finish_method_definition(). (methodproto): Move semantic actions to objc_set_method_type() and objc_add_method_declaration(). (methoddecl): Use objc_typename instead of typename; move semantic actions to objc_build_method_signature(). (optarglist, myxdecls, mydecl, myparms, myparm): Remove nonterminals. (optparmlist): Express in terms of optparms and optellipsis. (optparms, optellipsis, objc_qual, objc_quals, objc_typename): New nonterminals. (keyworddecl): Use objc_typename instead of typename. (rid_to_yy): Mark RID_IN, RID_OUT, RID_INOUT, RID_BYCOPY, RID_BYREF and RID_ONEWAY as returning OBJC_TYPE_QUAL to yyparse(). [gcc/objc/ChangeLog] 2004-09-07 Ziemowit Laski <zlaski@apple.com> * Make-lang.in (objc/objc-parse.o): Depend on $(C_COMMON_H) instead of objc/objc-act.h. (objc/objc-act.o): Depend on $(HASHTAB_H). * objc-act.c: Include hashtab.h; in ObjC++ mode, include cp-tree.h and objcp-decl.h instead of c-tree.h. (build_module_descriptor, get_class_ivars, synth_id_with_class_suffix, error_with_ivar, gen_method_decl, gen_declaration, setup_string_decl, build_protocol_template): Adjust prototypes. (build_module_initializer_routine, start_class, continue_class, finish_class, start_method_def, objc_start_function, start_protocol, build_method_decl, objc_add_method, add_instance_variable, build_ivar_reference, is_ivar, is_private, get_super_receiver, build_selector_table_decl, objc_push_parm, objc_get_parm_info, gen_type_name, gen_type_name_0, start_var_decl, finish_var_decl, create_field_decl): New prototypes. (objc_expand_function_end, comp_method_with_proto, objc_expr_last, gen_declaration_1, gen_declarator, is_complex_decl, adorn_decl, define_decl, create_builtin_decl, gen_declspecs): Remove prototypes. (TYPE_ID): Rename to OBJECT_TYPEDEF_NAME. (CLASS_TYPEDEF_NAME): New. (TAG_EXECCLASS): Change from a global variable to a #define. (TAG_RETURN_STRUCT): Delete. (TAG_GNUINIT): New, holds '__objc_gnu_init' name. (objc_inherit_code, objc_public_flag): New, moved from c-parse.in. (string_descriptor): New struct. (string_htab): New hash table. (string_hash, string_eq): New prototypes. (generate_struct_by_value_array): Call create_field_decl() instead of create_builtin_decl(). (objc_init): Do not initialize objc_ellipsis_node or TAG_EXECCLASS; In ObjC++ mode, call cxx_init() instead of c_objc_common_init(). (objc_finish_file): In ObjC++, call instantiate_pending_templates() and cp_finish_file(). (define_decl, get_static_reference, get_protocol_reference, create_builtin_decl): Remove functions. (objc_start_class_interface, objc_start_category_interface, objc_start_protocol, objc_continue_interface, objc_finish_interface, objc_start_class_implementation, objc_start_category_implementation, objc_continue_implementation, objc_finish_implementation, objc_set_visibility, objc_set_method_type, objc_build_method_signature, objc_add_method_declaration, objc_start_method_definition, objc_add_instance_variable, objc_get_protocol_qualified_type, create_field_decl, start_var_decl, finish_var_decl): New functions. (setup_string_decl): Simplify since it is only called once. (synth_module_prologue): Call build_class_template(); predefine 'id' and 'Class' as typedefs; rename 'temp_type' to 'type'; disable debug hooks for duration of function; fix GNU runtime messenger signatures to correspond to reality; forward-declare '__objc_exec_class' for the GNU runtime; call build_selector_table_decl(); in ObjC++ mode, generate 'extern "C" { ... }' wrappers around synthesized declarations; call build_protocol_template() and build_category_template(). (string_hash, string_eq): New functions. (objc_build_string_object): Check metaclass correctness only once; store string literals in hash table. (objc_build_constructor): Do not convert initializer elements; adjust for ObjC++ impedance mismatch. (build_objc_symtab_template): Call create_field_decl() instead of create_builtin_decl(). (init_objc_symtab): Add missing conversion to initializer element. (build_metadata_decl): Call start_var_decl() instead of define_decl(). (generate_objc_symtab_decl): Do not call build_category_template(); call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(). (build_module_descriptor): Call create_field_decl() instead of grokfield(); call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(); always mark module descriptor as used; move GNU runtime-specific functionality to build_module_initializer_routine(). (build_module_initializer_routine): New function, broken off of build_module_descriptor(). (objc_static_init_needed_p, objc_generate_static_init_call): New functions. (generate_static_references, generate_strings, build_selector_translation_table, generate_descriptor_table, generate_ivars_list, generate_dispatch_table, generate_category): Call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(); build a type directly instead of via groktypename(). (build_selector_reference_decl, build_selector_table_decl, build_class_reference_decl, build_protocol_reference, generate_objc_image_info): Call start_var_decl() instead of build_decl(). (build_selector_reference): For GNU runtime, do not call build_selector_reference_decl(). (build_selector, build_typed_selector_reference): Always convert result to the selector type. (add_objc_string): Cast return value to 'char *'. (build_method_prototype_template, build_selector_template, build_method_template): Use actual selector type for fields pointing to selectors. (finish_objc): For GNU runtime, call build_module_initializer_routine() after build_module_descriptor(). (generate_protocol_list, generate_shared_structures): Call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(); build a type directly instead of via groktypename(). (synth_id_with_class_suffix): Return a string. (get_arg_type_list): For instance methods, use the instance type for 'self'; do not call groktypename_in_parm_context(). (build_objc_string_decl): Squash redeclaration errors in ObjC++. (objc_is_class_name): Use OBJC_TYPE_NAME instead of TYPE_NAME; handle RECORD_TYPEs in ObjC as well as ObjC++. (objc_is_id): New function. (objc_is_object_ptr): Return the canonical type node. (objc_get_class_ivars): Simplify using get_class_ivars(). (get_class_ivars): Remove second parameter; create a fresh copy of the ivar list for each call; do not check for existence of super class. (objc_eh_runtime_type): Mark #ifndef OBJCPLUS. (objc_init_exceptions): When using SJLJ-style exceptions, require the use of '-fobjc-exceptions' flag; do not require it for DWARF-style exceptions. (objc_build_exc_ptr, next_sjlj_build_try_catch_finally): Use objc_object_type instead of objc_id_type. (objc_begin_catch_clause): Convert the incoming PARM_DECL into a VAR_DECL before placing it in the appropriate scope; do not call define_decl(); adjust call to c_begin_compound_stmt(); use objc_object_type instead of objc_id_type. (build_next_objc_exception_stuff): Call create_field_decl() instead of create_builtin_decl(); construct type directly instead of calling groktypename(); use OBJC_VOID_AT_END to mark end of function parameters. (build_private_template): Adjust call to get_class_ivars(); build a type directly instead of via groktypename(). (build_protocol_template, build_method_prototype_list_template, build_method_prototype_template, build_category_template, build_selector_template, build_class_template, build_super_template, build_ivar_template, build_ivar_list_template, build_method_list_template, build_method_template): Call create_field_decl() instead of grokfield(). (objc_method_parm_type): Do not call groktypename(). (generate_descriptor_table): Call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(). (generate_method_descriptors, build_protocol_initializer, generate_dispatch_tables, build_category_initializer, build_shared_structure_initializer): Do not call groktypename(). (generate_protocols): Call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(); do not call groktypename(). (error_with_ivar): Remove last parameter. (check_ivars): Do not iterate ovar CLASS_RAW_IVARS lists in addition to CLASS_IVARS lists; adjust calls to error_with_ivar(). (generate_ivar_lists): Convert one of the initializer elements; do not call groktypename(). (get_arg_type_list, start_method_def, gen_method_def): Account for new representation of variable arguments and '...' in Objective-C methods; add Objective-C++ impedance matching code. (is_objc_type_qualifier): Remove function. (adjust_type_for_id_default): Simplify; there is no longer a need to wade through declspecs. (lookup_interface, start_class, continue_class, finish_class, start_method_def, start_protocol, build_method_decl, objc_add_method, add_instance_variable, build_ivar_reference, is_ivar, is_private, get_super_receiver, objc_build_finally_epilogue): Make into static functions. (receiver_is_class_object): Use new IS_CLASS() macro. (objc_build_message_expr): Tweak ObjC++ message argument handling; call objc_finish_message_expr() instead of finish_message_expr(). (finish_message_expr): Rename to objc_finish_message_expr(); use OBJC_TYPE_NAME and OBJC_SET_TYPE_NAME macros instead of TYPE_NAME. call gen_type_name() instead of gen_declaration(); call objc_is_id() instead of using IS_ID and IS_CLASS; Use objc_class_name instead of calling get_identifier("Class"); handle CONVERT_EXPRs in receiver. (build_objc_method_call, warn_with_method): Do not call groktypename(). (build_ivar_reference): Call convert() instead of clobbering in a type. (hash_init): Initialize string_htab hash table. (add_instance_variable): Simplify parameter list; do not call grokfield(); do not populate CLASS_IVARS list. (start_class): Check for the existence of super class, if one was specified. (continue_class): Use CLASS_RAW_IVARS rather than CLASS_IVARS; do not call build_class_template(); adjust call to get_class_ivars(); call build_decl(), pushdecl() and finish_decl() instead of define_decl(). (finish_class): Call build_decl(), pushdecl() and finish_decl() instead of define_decl(). (add_protocols): Use PROTOCOL_BINFO_ELTS for the tree vector size. (start_protocol): Do not call build_protocol_template(); use PROTOCOL_BINFO_ELTS for the tree vector size. (encode_type_qualifiers): Do not handle the 'const' qualifier here. (encode_pointer): Encode 'const char *' as 'r*', for backwards compatibility. (encode_array): Use HOST_WIDE_INT_PRINT_DEC instead of "%ld". (encode_type): Handle the 'const' qualifier here. (objc_parmlist): New global variable, sued by objc_push_parm and objc_get_parm_info(). (objc_push_parm, objc_get_parm_info): New functions. (objc_expr_last): Remove function. (synth_self_and_ucmd_args): For instance methods, use the instance type for 'self'; call objc_push_parm() instead of push_parm_decl(). (start_method_def): Do not call push_scope(), declare_parm_level(), pop_scope(), push_parm_decl(), store_parm_decls() or objc_expr_last(); just use objc_push_parm() and objc_get_parm_info(). (comp_method_with_proto): Remove function. (objc_types_are_equivalent): Strip away indirections before comparing underlying types. (comp_proto_with_proto): Do not call groktypename(); types are no longer in raw declspec format. (objc_start_function): New function. (really_start_method): Call comp_proto_with_proto() instead of comp_method_with_proto(); call objc_start_function() instead of hand-crafting a function declarator. (continue_method_def, objc_expand_function_end): Remove functions. (get_super_receiver): Call objc_get_current_scope() instead of get_current_scope(); reference 'super_class' field (instead of 'class'). (finish_method_def): Rename to objc_finish_method_definition() and add a function decl parameter; move method encoding call from objc_expand_function_end(). (is_complex_decl, adorn_decl, gen_declarator, gen_declspecs, gen_declaration_1): Remove functions. (tmpbuf, RAW_DECLSPEC): Remove. (gen_declaration): Remove second parameter; simplify to deal with TYPE_P nodes instead of raw declspecs. (gen_type_name, gen_type_name_0): New functions. (gen_method_decl): Remove second parameter; call gen_type_name() instead of gen_declaration_1(). (dump_interface): Adjust calls to gen_declaration() and gen_method_decl(); do not allocate a separate string buffer. (init_objc): Allocate a larger string buffer to accommodate dump_interface(); adjust call to build_module_descriptor(); add call to build_module_initializer_routine() for the GNU runtime. (generate_classref_translation_entry): Do not call start_decl(); call finish_var_decl() instead of finish_decl(); call convert() instead of build_c_cast(). * objc-act.h (CLASS_OWN_IVARS): Remove accessor. (CLASS_BINFO_ELTS): Reduce from 6 to 5, now that CLASS_OWN_IVARS is gone. (OCTI_GNU_INIT_DECL, GNU_INIT_decl): New. (OCTI_ELLIPSIS_NODE, objc_ellipsis_node): Remove. (OCTI_ID_ID, id_type, objc_id_id): Rename to OCTI_ID_NAME, objc_object_type and objc_object_name, respectively. (OCTI_CLS_REF, OCTI_CLASS_NAME, objc_class_reference, objc_class_name): New. (IS_CLASS): New macro. (IS_ID, IS_SUPER): Robustify. (OCTI_EXECCLASS_DECL, execclass_decl): New. (finish_file, start_class, continue_class, finish_class, start_method_def, continue_method_def, finish_method_def, start_protocol, finish_protocol, objc_build_throw_stmt, objc_build_try_catch_finally_stmt, objc_build_synchronized_prologue, objc_build_synchronized_epilogue, objc_build_try_prologue, objc_build_try_epilogue, objc_build_catch_stmt, objc_build_catch_epilogue, objc_build_finally_prologue, objc_build_finally_epilogue, is_ivar, is_private, is_public, add_instance_variable, objc_add_method, get_super_receiver, objc_clear_super_receiver, get_class_ivars_from_name, get_class_reference, get_static_reference, get_object_reference, build_message_expr, finish_message_expr, build_selector_expr, build_ivar_reference, build_keyword_decl, build_method_decl, build_protocol_expr, build_objc_string_object, objc_declare_alias, objc_declare_class, objc_declare_protocols, objc_comptypes, objc_check_decl, build_encode_expr): Remove prototypes. (imp_count, cat_count): Make GGC-aware. (OBJC_SET_TYPE_NAME): New macro. From-SVN: r87168
2004-09-08 02:49:44 +02:00
if (DECL_INITIAL (decl)
&& TREE_CODE (DECL_INITIAL (decl)) == INTEGER_CST)
sprintf (errbuf + strlen (errbuf), ": " HOST_WIDE_INT_PRINT_DEC,
TREE_INT_CST_LOW (DECL_INITIAL (decl)));
}
Makefile.in (c-parse.o): Depend on $(C_COMMON_H). [gcc/ChangeLog] 2004-09-07 Ziemowit Laski <zlaski@apple.com> * Makefile.in (c-parse.o): Depend on $(C_COMMON_H). * c-parse.in: Include c-common.h instead of objc-act.h. (ivar_decl_list, ivar_decls, ivar_decl, ivars, ivar_declarator, myparms, myparm): Remove %type declarations. (methodtype, optparms, OBJC_TYPE_QUAL, objc_quals, objc_qual, objc_typename, objc_try_catch_stmt, optellipsis): Add %type declarations. (objc_inherit_code, objc_public_flag): Remove. (typespec_nonreserved_nonattr): Call objc_get_protocol_qualified_type() instead of get_static_reference() and get_protocol_reference(). (stmt_nocomp): Call grokparm() on @catch parameter. (objcdef): Move semantic action to objc_finish_implementation(). (classdef): Move semantic action to objc_start_class_interface(), objc_continue_interface(), objc_finish_interface(), objc_start_class_implementation(), objc_continue_implementation(), objc_start_category_interface() and objc_start_category_implementation(). (protocoldef): Move semantic actions to objc_start_protocol() and objc_finish_interface(). (ivar_decl_list): Remove nonterminal. (visibility_spec): Move semantic actions to objc_set_visibility(). (ivar_decls): Remove assignment to $$. (ivar_decl): Rephrase in terms of component_decl; call objc_add_instance_variable(). (ivars, ivar_declarator): Remove nonterminals. (opt_semi): New nonterminal. (methodtype): Remove semantic actions. (methoddef): Move semantic actions to objc_set_method_type(), objc_start_method_definition() and objc_finish_method_definition(). (methodproto): Move semantic actions to objc_set_method_type() and objc_add_method_declaration(). (methoddecl): Use objc_typename instead of typename; move semantic actions to objc_build_method_signature(). (optarglist, myxdecls, mydecl, myparms, myparm): Remove nonterminals. (optparmlist): Express in terms of optparms and optellipsis. (optparms, optellipsis, objc_qual, objc_quals, objc_typename): New nonterminals. (keyworddecl): Use objc_typename instead of typename. (rid_to_yy): Mark RID_IN, RID_OUT, RID_INOUT, RID_BYCOPY, RID_BYREF and RID_ONEWAY as returning OBJC_TYPE_QUAL to yyparse(). [gcc/objc/ChangeLog] 2004-09-07 Ziemowit Laski <zlaski@apple.com> * Make-lang.in (objc/objc-parse.o): Depend on $(C_COMMON_H) instead of objc/objc-act.h. (objc/objc-act.o): Depend on $(HASHTAB_H). * objc-act.c: Include hashtab.h; in ObjC++ mode, include cp-tree.h and objcp-decl.h instead of c-tree.h. (build_module_descriptor, get_class_ivars, synth_id_with_class_suffix, error_with_ivar, gen_method_decl, gen_declaration, setup_string_decl, build_protocol_template): Adjust prototypes. (build_module_initializer_routine, start_class, continue_class, finish_class, start_method_def, objc_start_function, start_protocol, build_method_decl, objc_add_method, add_instance_variable, build_ivar_reference, is_ivar, is_private, get_super_receiver, build_selector_table_decl, objc_push_parm, objc_get_parm_info, gen_type_name, gen_type_name_0, start_var_decl, finish_var_decl, create_field_decl): New prototypes. (objc_expand_function_end, comp_method_with_proto, objc_expr_last, gen_declaration_1, gen_declarator, is_complex_decl, adorn_decl, define_decl, create_builtin_decl, gen_declspecs): Remove prototypes. (TYPE_ID): Rename to OBJECT_TYPEDEF_NAME. (CLASS_TYPEDEF_NAME): New. (TAG_EXECCLASS): Change from a global variable to a #define. (TAG_RETURN_STRUCT): Delete. (TAG_GNUINIT): New, holds '__objc_gnu_init' name. (objc_inherit_code, objc_public_flag): New, moved from c-parse.in. (string_descriptor): New struct. (string_htab): New hash table. (string_hash, string_eq): New prototypes. (generate_struct_by_value_array): Call create_field_decl() instead of create_builtin_decl(). (objc_init): Do not initialize objc_ellipsis_node or TAG_EXECCLASS; In ObjC++ mode, call cxx_init() instead of c_objc_common_init(). (objc_finish_file): In ObjC++, call instantiate_pending_templates() and cp_finish_file(). (define_decl, get_static_reference, get_protocol_reference, create_builtin_decl): Remove functions. (objc_start_class_interface, objc_start_category_interface, objc_start_protocol, objc_continue_interface, objc_finish_interface, objc_start_class_implementation, objc_start_category_implementation, objc_continue_implementation, objc_finish_implementation, objc_set_visibility, objc_set_method_type, objc_build_method_signature, objc_add_method_declaration, objc_start_method_definition, objc_add_instance_variable, objc_get_protocol_qualified_type, create_field_decl, start_var_decl, finish_var_decl): New functions. (setup_string_decl): Simplify since it is only called once. (synth_module_prologue): Call build_class_template(); predefine 'id' and 'Class' as typedefs; rename 'temp_type' to 'type'; disable debug hooks for duration of function; fix GNU runtime messenger signatures to correspond to reality; forward-declare '__objc_exec_class' for the GNU runtime; call build_selector_table_decl(); in ObjC++ mode, generate 'extern "C" { ... }' wrappers around synthesized declarations; call build_protocol_template() and build_category_template(). (string_hash, string_eq): New functions. (objc_build_string_object): Check metaclass correctness only once; store string literals in hash table. (objc_build_constructor): Do not convert initializer elements; adjust for ObjC++ impedance mismatch. (build_objc_symtab_template): Call create_field_decl() instead of create_builtin_decl(). (init_objc_symtab): Add missing conversion to initializer element. (build_metadata_decl): Call start_var_decl() instead of define_decl(). (generate_objc_symtab_decl): Do not call build_category_template(); call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(). (build_module_descriptor): Call create_field_decl() instead of grokfield(); call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(); always mark module descriptor as used; move GNU runtime-specific functionality to build_module_initializer_routine(). (build_module_initializer_routine): New function, broken off of build_module_descriptor(). (objc_static_init_needed_p, objc_generate_static_init_call): New functions. (generate_static_references, generate_strings, build_selector_translation_table, generate_descriptor_table, generate_ivars_list, generate_dispatch_table, generate_category): Call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(); build a type directly instead of via groktypename(). (build_selector_reference_decl, build_selector_table_decl, build_class_reference_decl, build_protocol_reference, generate_objc_image_info): Call start_var_decl() instead of build_decl(). (build_selector_reference): For GNU runtime, do not call build_selector_reference_decl(). (build_selector, build_typed_selector_reference): Always convert result to the selector type. (add_objc_string): Cast return value to 'char *'. (build_method_prototype_template, build_selector_template, build_method_template): Use actual selector type for fields pointing to selectors. (finish_objc): For GNU runtime, call build_module_initializer_routine() after build_module_descriptor(). (generate_protocol_list, generate_shared_structures): Call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(); build a type directly instead of via groktypename(). (synth_id_with_class_suffix): Return a string. (get_arg_type_list): For instance methods, use the instance type for 'self'; do not call groktypename_in_parm_context(). (build_objc_string_decl): Squash redeclaration errors in ObjC++. (objc_is_class_name): Use OBJC_TYPE_NAME instead of TYPE_NAME; handle RECORD_TYPEs in ObjC as well as ObjC++. (objc_is_id): New function. (objc_is_object_ptr): Return the canonical type node. (objc_get_class_ivars): Simplify using get_class_ivars(). (get_class_ivars): Remove second parameter; create a fresh copy of the ivar list for each call; do not check for existence of super class. (objc_eh_runtime_type): Mark #ifndef OBJCPLUS. (objc_init_exceptions): When using SJLJ-style exceptions, require the use of '-fobjc-exceptions' flag; do not require it for DWARF-style exceptions. (objc_build_exc_ptr, next_sjlj_build_try_catch_finally): Use objc_object_type instead of objc_id_type. (objc_begin_catch_clause): Convert the incoming PARM_DECL into a VAR_DECL before placing it in the appropriate scope; do not call define_decl(); adjust call to c_begin_compound_stmt(); use objc_object_type instead of objc_id_type. (build_next_objc_exception_stuff): Call create_field_decl() instead of create_builtin_decl(); construct type directly instead of calling groktypename(); use OBJC_VOID_AT_END to mark end of function parameters. (build_private_template): Adjust call to get_class_ivars(); build a type directly instead of via groktypename(). (build_protocol_template, build_method_prototype_list_template, build_method_prototype_template, build_category_template, build_selector_template, build_class_template, build_super_template, build_ivar_template, build_ivar_list_template, build_method_list_template, build_method_template): Call create_field_decl() instead of grokfield(). (objc_method_parm_type): Do not call groktypename(). (generate_descriptor_table): Call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(). (generate_method_descriptors, build_protocol_initializer, generate_dispatch_tables, build_category_initializer, build_shared_structure_initializer): Do not call groktypename(). (generate_protocols): Call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(); do not call groktypename(). (error_with_ivar): Remove last parameter. (check_ivars): Do not iterate ovar CLASS_RAW_IVARS lists in addition to CLASS_IVARS lists; adjust calls to error_with_ivar(). (generate_ivar_lists): Convert one of the initializer elements; do not call groktypename(). (get_arg_type_list, start_method_def, gen_method_def): Account for new representation of variable arguments and '...' in Objective-C methods; add Objective-C++ impedance matching code. (is_objc_type_qualifier): Remove function. (adjust_type_for_id_default): Simplify; there is no longer a need to wade through declspecs. (lookup_interface, start_class, continue_class, finish_class, start_method_def, start_protocol, build_method_decl, objc_add_method, add_instance_variable, build_ivar_reference, is_ivar, is_private, get_super_receiver, objc_build_finally_epilogue): Make into static functions. (receiver_is_class_object): Use new IS_CLASS() macro. (objc_build_message_expr): Tweak ObjC++ message argument handling; call objc_finish_message_expr() instead of finish_message_expr(). (finish_message_expr): Rename to objc_finish_message_expr(); use OBJC_TYPE_NAME and OBJC_SET_TYPE_NAME macros instead of TYPE_NAME. call gen_type_name() instead of gen_declaration(); call objc_is_id() instead of using IS_ID and IS_CLASS; Use objc_class_name instead of calling get_identifier("Class"); handle CONVERT_EXPRs in receiver. (build_objc_method_call, warn_with_method): Do not call groktypename(). (build_ivar_reference): Call convert() instead of clobbering in a type. (hash_init): Initialize string_htab hash table. (add_instance_variable): Simplify parameter list; do not call grokfield(); do not populate CLASS_IVARS list. (start_class): Check for the existence of super class, if one was specified. (continue_class): Use CLASS_RAW_IVARS rather than CLASS_IVARS; do not call build_class_template(); adjust call to get_class_ivars(); call build_decl(), pushdecl() and finish_decl() instead of define_decl(). (finish_class): Call build_decl(), pushdecl() and finish_decl() instead of define_decl(). (add_protocols): Use PROTOCOL_BINFO_ELTS for the tree vector size. (start_protocol): Do not call build_protocol_template(); use PROTOCOL_BINFO_ELTS for the tree vector size. (encode_type_qualifiers): Do not handle the 'const' qualifier here. (encode_pointer): Encode 'const char *' as 'r*', for backwards compatibility. (encode_array): Use HOST_WIDE_INT_PRINT_DEC instead of "%ld". (encode_type): Handle the 'const' qualifier here. (objc_parmlist): New global variable, sued by objc_push_parm and objc_get_parm_info(). (objc_push_parm, objc_get_parm_info): New functions. (objc_expr_last): Remove function. (synth_self_and_ucmd_args): For instance methods, use the instance type for 'self'; call objc_push_parm() instead of push_parm_decl(). (start_method_def): Do not call push_scope(), declare_parm_level(), pop_scope(), push_parm_decl(), store_parm_decls() or objc_expr_last(); just use objc_push_parm() and objc_get_parm_info(). (comp_method_with_proto): Remove function. (objc_types_are_equivalent): Strip away indirections before comparing underlying types. (comp_proto_with_proto): Do not call groktypename(); types are no longer in raw declspec format. (objc_start_function): New function. (really_start_method): Call comp_proto_with_proto() instead of comp_method_with_proto(); call objc_start_function() instead of hand-crafting a function declarator. (continue_method_def, objc_expand_function_end): Remove functions. (get_super_receiver): Call objc_get_current_scope() instead of get_current_scope(); reference 'super_class' field (instead of 'class'). (finish_method_def): Rename to objc_finish_method_definition() and add a function decl parameter; move method encoding call from objc_expand_function_end(). (is_complex_decl, adorn_decl, gen_declarator, gen_declspecs, gen_declaration_1): Remove functions. (tmpbuf, RAW_DECLSPEC): Remove. (gen_declaration): Remove second parameter; simplify to deal with TYPE_P nodes instead of raw declspecs. (gen_type_name, gen_type_name_0): New functions. (gen_method_decl): Remove second parameter; call gen_type_name() instead of gen_declaration_1(). (dump_interface): Adjust calls to gen_declaration() and gen_method_decl(); do not allocate a separate string buffer. (init_objc): Allocate a larger string buffer to accommodate dump_interface(); adjust call to build_module_descriptor(); add call to build_module_initializer_routine() for the GNU runtime. (generate_classref_translation_entry): Do not call start_decl(); call finish_var_decl() instead of finish_decl(); call convert() instead of build_c_cast(). * objc-act.h (CLASS_OWN_IVARS): Remove accessor. (CLASS_BINFO_ELTS): Reduce from 6 to 5, now that CLASS_OWN_IVARS is gone. (OCTI_GNU_INIT_DECL, GNU_INIT_decl): New. (OCTI_ELLIPSIS_NODE, objc_ellipsis_node): Remove. (OCTI_ID_ID, id_type, objc_id_id): Rename to OCTI_ID_NAME, objc_object_type and objc_object_name, respectively. (OCTI_CLS_REF, OCTI_CLASS_NAME, objc_class_reference, objc_class_name): New. (IS_CLASS): New macro. (IS_ID, IS_SUPER): Robustify. (OCTI_EXECCLASS_DECL, execclass_decl): New. (finish_file, start_class, continue_class, finish_class, start_method_def, continue_method_def, finish_method_def, start_protocol, finish_protocol, objc_build_throw_stmt, objc_build_try_catch_finally_stmt, objc_build_synchronized_prologue, objc_build_synchronized_epilogue, objc_build_try_prologue, objc_build_try_epilogue, objc_build_catch_stmt, objc_build_catch_epilogue, objc_build_finally_prologue, objc_build_finally_epilogue, is_ivar, is_private, is_public, add_instance_variable, objc_add_method, get_super_receiver, objc_clear_super_receiver, get_class_ivars_from_name, get_class_reference, get_static_reference, get_object_reference, build_message_expr, finish_message_expr, build_selector_expr, build_ivar_reference, build_keyword_decl, build_method_decl, build_protocol_expr, build_objc_string_object, objc_declare_alias, objc_declare_class, objc_declare_protocols, objc_comptypes, objc_check_decl, build_encode_expr): Remove prototypes. (imp_count, cat_count): Make GGC-aware. (OBJC_SET_TYPE_NAME): New macro. From-SVN: r87168
2004-09-08 02:49:44 +02:00
return errbuf;
1992-01-18 00:15:38 +01:00
}
Makefile.in (c-parse.o): Depend on $(C_COMMON_H). [gcc/ChangeLog] 2004-09-07 Ziemowit Laski <zlaski@apple.com> * Makefile.in (c-parse.o): Depend on $(C_COMMON_H). * c-parse.in: Include c-common.h instead of objc-act.h. (ivar_decl_list, ivar_decls, ivar_decl, ivars, ivar_declarator, myparms, myparm): Remove %type declarations. (methodtype, optparms, OBJC_TYPE_QUAL, objc_quals, objc_qual, objc_typename, objc_try_catch_stmt, optellipsis): Add %type declarations. (objc_inherit_code, objc_public_flag): Remove. (typespec_nonreserved_nonattr): Call objc_get_protocol_qualified_type() instead of get_static_reference() and get_protocol_reference(). (stmt_nocomp): Call grokparm() on @catch parameter. (objcdef): Move semantic action to objc_finish_implementation(). (classdef): Move semantic action to objc_start_class_interface(), objc_continue_interface(), objc_finish_interface(), objc_start_class_implementation(), objc_continue_implementation(), objc_start_category_interface() and objc_start_category_implementation(). (protocoldef): Move semantic actions to objc_start_protocol() and objc_finish_interface(). (ivar_decl_list): Remove nonterminal. (visibility_spec): Move semantic actions to objc_set_visibility(). (ivar_decls): Remove assignment to $$. (ivar_decl): Rephrase in terms of component_decl; call objc_add_instance_variable(). (ivars, ivar_declarator): Remove nonterminals. (opt_semi): New nonterminal. (methodtype): Remove semantic actions. (methoddef): Move semantic actions to objc_set_method_type(), objc_start_method_definition() and objc_finish_method_definition(). (methodproto): Move semantic actions to objc_set_method_type() and objc_add_method_declaration(). (methoddecl): Use objc_typename instead of typename; move semantic actions to objc_build_method_signature(). (optarglist, myxdecls, mydecl, myparms, myparm): Remove nonterminals. (optparmlist): Express in terms of optparms and optellipsis. (optparms, optellipsis, objc_qual, objc_quals, objc_typename): New nonterminals. (keyworddecl): Use objc_typename instead of typename. (rid_to_yy): Mark RID_IN, RID_OUT, RID_INOUT, RID_BYCOPY, RID_BYREF and RID_ONEWAY as returning OBJC_TYPE_QUAL to yyparse(). [gcc/objc/ChangeLog] 2004-09-07 Ziemowit Laski <zlaski@apple.com> * Make-lang.in (objc/objc-parse.o): Depend on $(C_COMMON_H) instead of objc/objc-act.h. (objc/objc-act.o): Depend on $(HASHTAB_H). * objc-act.c: Include hashtab.h; in ObjC++ mode, include cp-tree.h and objcp-decl.h instead of c-tree.h. (build_module_descriptor, get_class_ivars, synth_id_with_class_suffix, error_with_ivar, gen_method_decl, gen_declaration, setup_string_decl, build_protocol_template): Adjust prototypes. (build_module_initializer_routine, start_class, continue_class, finish_class, start_method_def, objc_start_function, start_protocol, build_method_decl, objc_add_method, add_instance_variable, build_ivar_reference, is_ivar, is_private, get_super_receiver, build_selector_table_decl, objc_push_parm, objc_get_parm_info, gen_type_name, gen_type_name_0, start_var_decl, finish_var_decl, create_field_decl): New prototypes. (objc_expand_function_end, comp_method_with_proto, objc_expr_last, gen_declaration_1, gen_declarator, is_complex_decl, adorn_decl, define_decl, create_builtin_decl, gen_declspecs): Remove prototypes. (TYPE_ID): Rename to OBJECT_TYPEDEF_NAME. (CLASS_TYPEDEF_NAME): New. (TAG_EXECCLASS): Change from a global variable to a #define. (TAG_RETURN_STRUCT): Delete. (TAG_GNUINIT): New, holds '__objc_gnu_init' name. (objc_inherit_code, objc_public_flag): New, moved from c-parse.in. (string_descriptor): New struct. (string_htab): New hash table. (string_hash, string_eq): New prototypes. (generate_struct_by_value_array): Call create_field_decl() instead of create_builtin_decl(). (objc_init): Do not initialize objc_ellipsis_node or TAG_EXECCLASS; In ObjC++ mode, call cxx_init() instead of c_objc_common_init(). (objc_finish_file): In ObjC++, call instantiate_pending_templates() and cp_finish_file(). (define_decl, get_static_reference, get_protocol_reference, create_builtin_decl): Remove functions. (objc_start_class_interface, objc_start_category_interface, objc_start_protocol, objc_continue_interface, objc_finish_interface, objc_start_class_implementation, objc_start_category_implementation, objc_continue_implementation, objc_finish_implementation, objc_set_visibility, objc_set_method_type, objc_build_method_signature, objc_add_method_declaration, objc_start_method_definition, objc_add_instance_variable, objc_get_protocol_qualified_type, create_field_decl, start_var_decl, finish_var_decl): New functions. (setup_string_decl): Simplify since it is only called once. (synth_module_prologue): Call build_class_template(); predefine 'id' and 'Class' as typedefs; rename 'temp_type' to 'type'; disable debug hooks for duration of function; fix GNU runtime messenger signatures to correspond to reality; forward-declare '__objc_exec_class' for the GNU runtime; call build_selector_table_decl(); in ObjC++ mode, generate 'extern "C" { ... }' wrappers around synthesized declarations; call build_protocol_template() and build_category_template(). (string_hash, string_eq): New functions. (objc_build_string_object): Check metaclass correctness only once; store string literals in hash table. (objc_build_constructor): Do not convert initializer elements; adjust for ObjC++ impedance mismatch. (build_objc_symtab_template): Call create_field_decl() instead of create_builtin_decl(). (init_objc_symtab): Add missing conversion to initializer element. (build_metadata_decl): Call start_var_decl() instead of define_decl(). (generate_objc_symtab_decl): Do not call build_category_template(); call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(). (build_module_descriptor): Call create_field_decl() instead of grokfield(); call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(); always mark module descriptor as used; move GNU runtime-specific functionality to build_module_initializer_routine(). (build_module_initializer_routine): New function, broken off of build_module_descriptor(). (objc_static_init_needed_p, objc_generate_static_init_call): New functions. (generate_static_references, generate_strings, build_selector_translation_table, generate_descriptor_table, generate_ivars_list, generate_dispatch_table, generate_category): Call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(); build a type directly instead of via groktypename(). (build_selector_reference_decl, build_selector_table_decl, build_class_reference_decl, build_protocol_reference, generate_objc_image_info): Call start_var_decl() instead of build_decl(). (build_selector_reference): For GNU runtime, do not call build_selector_reference_decl(). (build_selector, build_typed_selector_reference): Always convert result to the selector type. (add_objc_string): Cast return value to 'char *'. (build_method_prototype_template, build_selector_template, build_method_template): Use actual selector type for fields pointing to selectors. (finish_objc): For GNU runtime, call build_module_initializer_routine() after build_module_descriptor(). (generate_protocol_list, generate_shared_structures): Call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(); build a type directly instead of via groktypename(). (synth_id_with_class_suffix): Return a string. (get_arg_type_list): For instance methods, use the instance type for 'self'; do not call groktypename_in_parm_context(). (build_objc_string_decl): Squash redeclaration errors in ObjC++. (objc_is_class_name): Use OBJC_TYPE_NAME instead of TYPE_NAME; handle RECORD_TYPEs in ObjC as well as ObjC++. (objc_is_id): New function. (objc_is_object_ptr): Return the canonical type node. (objc_get_class_ivars): Simplify using get_class_ivars(). (get_class_ivars): Remove second parameter; create a fresh copy of the ivar list for each call; do not check for existence of super class. (objc_eh_runtime_type): Mark #ifndef OBJCPLUS. (objc_init_exceptions): When using SJLJ-style exceptions, require the use of '-fobjc-exceptions' flag; do not require it for DWARF-style exceptions. (objc_build_exc_ptr, next_sjlj_build_try_catch_finally): Use objc_object_type instead of objc_id_type. (objc_begin_catch_clause): Convert the incoming PARM_DECL into a VAR_DECL before placing it in the appropriate scope; do not call define_decl(); adjust call to c_begin_compound_stmt(); use objc_object_type instead of objc_id_type. (build_next_objc_exception_stuff): Call create_field_decl() instead of create_builtin_decl(); construct type directly instead of calling groktypename(); use OBJC_VOID_AT_END to mark end of function parameters. (build_private_template): Adjust call to get_class_ivars(); build a type directly instead of via groktypename(). (build_protocol_template, build_method_prototype_list_template, build_method_prototype_template, build_category_template, build_selector_template, build_class_template, build_super_template, build_ivar_template, build_ivar_list_template, build_method_list_template, build_method_template): Call create_field_decl() instead of grokfield(). (objc_method_parm_type): Do not call groktypename(). (generate_descriptor_table): Call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(). (generate_method_descriptors, build_protocol_initializer, generate_dispatch_tables, build_category_initializer, build_shared_structure_initializer): Do not call groktypename(). (generate_protocols): Call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(); do not call groktypename(). (error_with_ivar): Remove last parameter. (check_ivars): Do not iterate ovar CLASS_RAW_IVARS lists in addition to CLASS_IVARS lists; adjust calls to error_with_ivar(). (generate_ivar_lists): Convert one of the initializer elements; do not call groktypename(). (get_arg_type_list, start_method_def, gen_method_def): Account for new representation of variable arguments and '...' in Objective-C methods; add Objective-C++ impedance matching code. (is_objc_type_qualifier): Remove function. (adjust_type_for_id_default): Simplify; there is no longer a need to wade through declspecs. (lookup_interface, start_class, continue_class, finish_class, start_method_def, start_protocol, build_method_decl, objc_add_method, add_instance_variable, build_ivar_reference, is_ivar, is_private, get_super_receiver, objc_build_finally_epilogue): Make into static functions. (receiver_is_class_object): Use new IS_CLASS() macro. (objc_build_message_expr): Tweak ObjC++ message argument handling; call objc_finish_message_expr() instead of finish_message_expr(). (finish_message_expr): Rename to objc_finish_message_expr(); use OBJC_TYPE_NAME and OBJC_SET_TYPE_NAME macros instead of TYPE_NAME. call gen_type_name() instead of gen_declaration(); call objc_is_id() instead of using IS_ID and IS_CLASS; Use objc_class_name instead of calling get_identifier("Class"); handle CONVERT_EXPRs in receiver. (build_objc_method_call, warn_with_method): Do not call groktypename(). (build_ivar_reference): Call convert() instead of clobbering in a type. (hash_init): Initialize string_htab hash table. (add_instance_variable): Simplify parameter list; do not call grokfield(); do not populate CLASS_IVARS list. (start_class): Check for the existence of super class, if one was specified. (continue_class): Use CLASS_RAW_IVARS rather than CLASS_IVARS; do not call build_class_template(); adjust call to get_class_ivars(); call build_decl(), pushdecl() and finish_decl() instead of define_decl(). (finish_class): Call build_decl(), pushdecl() and finish_decl() instead of define_decl(). (add_protocols): Use PROTOCOL_BINFO_ELTS for the tree vector size. (start_protocol): Do not call build_protocol_template(); use PROTOCOL_BINFO_ELTS for the tree vector size. (encode_type_qualifiers): Do not handle the 'const' qualifier here. (encode_pointer): Encode 'const char *' as 'r*', for backwards compatibility. (encode_array): Use HOST_WIDE_INT_PRINT_DEC instead of "%ld". (encode_type): Handle the 'const' qualifier here. (objc_parmlist): New global variable, sued by objc_push_parm and objc_get_parm_info(). (objc_push_parm, objc_get_parm_info): New functions. (objc_expr_last): Remove function. (synth_self_and_ucmd_args): For instance methods, use the instance type for 'self'; call objc_push_parm() instead of push_parm_decl(). (start_method_def): Do not call push_scope(), declare_parm_level(), pop_scope(), push_parm_decl(), store_parm_decls() or objc_expr_last(); just use objc_push_parm() and objc_get_parm_info(). (comp_method_with_proto): Remove function. (objc_types_are_equivalent): Strip away indirections before comparing underlying types. (comp_proto_with_proto): Do not call groktypename(); types are no longer in raw declspec format. (objc_start_function): New function. (really_start_method): Call comp_proto_with_proto() instead of comp_method_with_proto(); call objc_start_function() instead of hand-crafting a function declarator. (continue_method_def, objc_expand_function_end): Remove functions. (get_super_receiver): Call objc_get_current_scope() instead of get_current_scope(); reference 'super_class' field (instead of 'class'). (finish_method_def): Rename to objc_finish_method_definition() and add a function decl parameter; move method encoding call from objc_expand_function_end(). (is_complex_decl, adorn_decl, gen_declarator, gen_declspecs, gen_declaration_1): Remove functions. (tmpbuf, RAW_DECLSPEC): Remove. (gen_declaration): Remove second parameter; simplify to deal with TYPE_P nodes instead of raw declspecs. (gen_type_name, gen_type_name_0): New functions. (gen_method_decl): Remove second parameter; call gen_type_name() instead of gen_declaration_1(). (dump_interface): Adjust calls to gen_declaration() and gen_method_decl(); do not allocate a separate string buffer. (init_objc): Allocate a larger string buffer to accommodate dump_interface(); adjust call to build_module_descriptor(); add call to build_module_initializer_routine() for the GNU runtime. (generate_classref_translation_entry): Do not call start_decl(); call finish_var_decl() instead of finish_decl(); call convert() instead of build_c_cast(). * objc-act.h (CLASS_OWN_IVARS): Remove accessor. (CLASS_BINFO_ELTS): Reduce from 6 to 5, now that CLASS_OWN_IVARS is gone. (OCTI_GNU_INIT_DECL, GNU_INIT_decl): New. (OCTI_ELLIPSIS_NODE, objc_ellipsis_node): Remove. (OCTI_ID_ID, id_type, objc_id_id): Rename to OCTI_ID_NAME, objc_object_type and objc_object_name, respectively. (OCTI_CLS_REF, OCTI_CLASS_NAME, objc_class_reference, objc_class_name): New. (IS_CLASS): New macro. (IS_ID, IS_SUPER): Robustify. (OCTI_EXECCLASS_DECL, execclass_decl): New. (finish_file, start_class, continue_class, finish_class, start_method_def, continue_method_def, finish_method_def, start_protocol, finish_protocol, objc_build_throw_stmt, objc_build_try_catch_finally_stmt, objc_build_synchronized_prologue, objc_build_synchronized_epilogue, objc_build_try_prologue, objc_build_try_epilogue, objc_build_catch_stmt, objc_build_catch_epilogue, objc_build_finally_prologue, objc_build_finally_epilogue, is_ivar, is_private, is_public, add_instance_variable, objc_add_method, get_super_receiver, objc_clear_super_receiver, get_class_ivars_from_name, get_class_reference, get_static_reference, get_object_reference, build_message_expr, finish_message_expr, build_selector_expr, build_ivar_reference, build_keyword_decl, build_method_decl, build_protocol_expr, build_objc_string_object, objc_declare_alias, objc_declare_class, objc_declare_protocols, objc_comptypes, objc_check_decl, build_encode_expr): Remove prototypes. (imp_count, cat_count): Make GGC-aware. (OBJC_SET_TYPE_NAME): New macro. From-SVN: r87168
2004-09-08 02:49:44 +02:00
/* Given a tree TYPE node, produce a printable description of it in the given
buffer, overwriting the buffer. */
1992-01-18 00:15:38 +01:00
static char *
Makefile.in (c-parse.o): Depend on $(C_COMMON_H). [gcc/ChangeLog] 2004-09-07 Ziemowit Laski <zlaski@apple.com> * Makefile.in (c-parse.o): Depend on $(C_COMMON_H). * c-parse.in: Include c-common.h instead of objc-act.h. (ivar_decl_list, ivar_decls, ivar_decl, ivars, ivar_declarator, myparms, myparm): Remove %type declarations. (methodtype, optparms, OBJC_TYPE_QUAL, objc_quals, objc_qual, objc_typename, objc_try_catch_stmt, optellipsis): Add %type declarations. (objc_inherit_code, objc_public_flag): Remove. (typespec_nonreserved_nonattr): Call objc_get_protocol_qualified_type() instead of get_static_reference() and get_protocol_reference(). (stmt_nocomp): Call grokparm() on @catch parameter. (objcdef): Move semantic action to objc_finish_implementation(). (classdef): Move semantic action to objc_start_class_interface(), objc_continue_interface(), objc_finish_interface(), objc_start_class_implementation(), objc_continue_implementation(), objc_start_category_interface() and objc_start_category_implementation(). (protocoldef): Move semantic actions to objc_start_protocol() and objc_finish_interface(). (ivar_decl_list): Remove nonterminal. (visibility_spec): Move semantic actions to objc_set_visibility(). (ivar_decls): Remove assignment to $$. (ivar_decl): Rephrase in terms of component_decl; call objc_add_instance_variable(). (ivars, ivar_declarator): Remove nonterminals. (opt_semi): New nonterminal. (methodtype): Remove semantic actions. (methoddef): Move semantic actions to objc_set_method_type(), objc_start_method_definition() and objc_finish_method_definition(). (methodproto): Move semantic actions to objc_set_method_type() and objc_add_method_declaration(). (methoddecl): Use objc_typename instead of typename; move semantic actions to objc_build_method_signature(). (optarglist, myxdecls, mydecl, myparms, myparm): Remove nonterminals. (optparmlist): Express in terms of optparms and optellipsis. (optparms, optellipsis, objc_qual, objc_quals, objc_typename): New nonterminals. (keyworddecl): Use objc_typename instead of typename. (rid_to_yy): Mark RID_IN, RID_OUT, RID_INOUT, RID_BYCOPY, RID_BYREF and RID_ONEWAY as returning OBJC_TYPE_QUAL to yyparse(). [gcc/objc/ChangeLog] 2004-09-07 Ziemowit Laski <zlaski@apple.com> * Make-lang.in (objc/objc-parse.o): Depend on $(C_COMMON_H) instead of objc/objc-act.h. (objc/objc-act.o): Depend on $(HASHTAB_H). * objc-act.c: Include hashtab.h; in ObjC++ mode, include cp-tree.h and objcp-decl.h instead of c-tree.h. (build_module_descriptor, get_class_ivars, synth_id_with_class_suffix, error_with_ivar, gen_method_decl, gen_declaration, setup_string_decl, build_protocol_template): Adjust prototypes. (build_module_initializer_routine, start_class, continue_class, finish_class, start_method_def, objc_start_function, start_protocol, build_method_decl, objc_add_method, add_instance_variable, build_ivar_reference, is_ivar, is_private, get_super_receiver, build_selector_table_decl, objc_push_parm, objc_get_parm_info, gen_type_name, gen_type_name_0, start_var_decl, finish_var_decl, create_field_decl): New prototypes. (objc_expand_function_end, comp_method_with_proto, objc_expr_last, gen_declaration_1, gen_declarator, is_complex_decl, adorn_decl, define_decl, create_builtin_decl, gen_declspecs): Remove prototypes. (TYPE_ID): Rename to OBJECT_TYPEDEF_NAME. (CLASS_TYPEDEF_NAME): New. (TAG_EXECCLASS): Change from a global variable to a #define. (TAG_RETURN_STRUCT): Delete. (TAG_GNUINIT): New, holds '__objc_gnu_init' name. (objc_inherit_code, objc_public_flag): New, moved from c-parse.in. (string_descriptor): New struct. (string_htab): New hash table. (string_hash, string_eq): New prototypes. (generate_struct_by_value_array): Call create_field_decl() instead of create_builtin_decl(). (objc_init): Do not initialize objc_ellipsis_node or TAG_EXECCLASS; In ObjC++ mode, call cxx_init() instead of c_objc_common_init(). (objc_finish_file): In ObjC++, call instantiate_pending_templates() and cp_finish_file(). (define_decl, get_static_reference, get_protocol_reference, create_builtin_decl): Remove functions. (objc_start_class_interface, objc_start_category_interface, objc_start_protocol, objc_continue_interface, objc_finish_interface, objc_start_class_implementation, objc_start_category_implementation, objc_continue_implementation, objc_finish_implementation, objc_set_visibility, objc_set_method_type, objc_build_method_signature, objc_add_method_declaration, objc_start_method_definition, objc_add_instance_variable, objc_get_protocol_qualified_type, create_field_decl, start_var_decl, finish_var_decl): New functions. (setup_string_decl): Simplify since it is only called once. (synth_module_prologue): Call build_class_template(); predefine 'id' and 'Class' as typedefs; rename 'temp_type' to 'type'; disable debug hooks for duration of function; fix GNU runtime messenger signatures to correspond to reality; forward-declare '__objc_exec_class' for the GNU runtime; call build_selector_table_decl(); in ObjC++ mode, generate 'extern "C" { ... }' wrappers around synthesized declarations; call build_protocol_template() and build_category_template(). (string_hash, string_eq): New functions. (objc_build_string_object): Check metaclass correctness only once; store string literals in hash table. (objc_build_constructor): Do not convert initializer elements; adjust for ObjC++ impedance mismatch. (build_objc_symtab_template): Call create_field_decl() instead of create_builtin_decl(). (init_objc_symtab): Add missing conversion to initializer element. (build_metadata_decl): Call start_var_decl() instead of define_decl(). (generate_objc_symtab_decl): Do not call build_category_template(); call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(). (build_module_descriptor): Call create_field_decl() instead of grokfield(); call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(); always mark module descriptor as used; move GNU runtime-specific functionality to build_module_initializer_routine(). (build_module_initializer_routine): New function, broken off of build_module_descriptor(). (objc_static_init_needed_p, objc_generate_static_init_call): New functions. (generate_static_references, generate_strings, build_selector_translation_table, generate_descriptor_table, generate_ivars_list, generate_dispatch_table, generate_category): Call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(); build a type directly instead of via groktypename(). (build_selector_reference_decl, build_selector_table_decl, build_class_reference_decl, build_protocol_reference, generate_objc_image_info): Call start_var_decl() instead of build_decl(). (build_selector_reference): For GNU runtime, do not call build_selector_reference_decl(). (build_selector, build_typed_selector_reference): Always convert result to the selector type. (add_objc_string): Cast return value to 'char *'. (build_method_prototype_template, build_selector_template, build_method_template): Use actual selector type for fields pointing to selectors. (finish_objc): For GNU runtime, call build_module_initializer_routine() after build_module_descriptor(). (generate_protocol_list, generate_shared_structures): Call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(); build a type directly instead of via groktypename(). (synth_id_with_class_suffix): Return a string. (get_arg_type_list): For instance methods, use the instance type for 'self'; do not call groktypename_in_parm_context(). (build_objc_string_decl): Squash redeclaration errors in ObjC++. (objc_is_class_name): Use OBJC_TYPE_NAME instead of TYPE_NAME; handle RECORD_TYPEs in ObjC as well as ObjC++. (objc_is_id): New function. (objc_is_object_ptr): Return the canonical type node. (objc_get_class_ivars): Simplify using get_class_ivars(). (get_class_ivars): Remove second parameter; create a fresh copy of the ivar list for each call; do not check for existence of super class. (objc_eh_runtime_type): Mark #ifndef OBJCPLUS. (objc_init_exceptions): When using SJLJ-style exceptions, require the use of '-fobjc-exceptions' flag; do not require it for DWARF-style exceptions. (objc_build_exc_ptr, next_sjlj_build_try_catch_finally): Use objc_object_type instead of objc_id_type. (objc_begin_catch_clause): Convert the incoming PARM_DECL into a VAR_DECL before placing it in the appropriate scope; do not call define_decl(); adjust call to c_begin_compound_stmt(); use objc_object_type instead of objc_id_type. (build_next_objc_exception_stuff): Call create_field_decl() instead of create_builtin_decl(); construct type directly instead of calling groktypename(); use OBJC_VOID_AT_END to mark end of function parameters. (build_private_template): Adjust call to get_class_ivars(); build a type directly instead of via groktypename(). (build_protocol_template, build_method_prototype_list_template, build_method_prototype_template, build_category_template, build_selector_template, build_class_template, build_super_template, build_ivar_template, build_ivar_list_template, build_method_list_template, build_method_template): Call create_field_decl() instead of grokfield(). (objc_method_parm_type): Do not call groktypename(). (generate_descriptor_table): Call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(). (generate_method_descriptors, build_protocol_initializer, generate_dispatch_tables, build_category_initializer, build_shared_structure_initializer): Do not call groktypename(). (generate_protocols): Call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(); do not call groktypename(). (error_with_ivar): Remove last parameter. (check_ivars): Do not iterate ovar CLASS_RAW_IVARS lists in addition to CLASS_IVARS lists; adjust calls to error_with_ivar(). (generate_ivar_lists): Convert one of the initializer elements; do not call groktypename(). (get_arg_type_list, start_method_def, gen_method_def): Account for new representation of variable arguments and '...' in Objective-C methods; add Objective-C++ impedance matching code. (is_objc_type_qualifier): Remove function. (adjust_type_for_id_default): Simplify; there is no longer a need to wade through declspecs. (lookup_interface, start_class, continue_class, finish_class, start_method_def, start_protocol, build_method_decl, objc_add_method, add_instance_variable, build_ivar_reference, is_ivar, is_private, get_super_receiver, objc_build_finally_epilogue): Make into static functions. (receiver_is_class_object): Use new IS_CLASS() macro. (objc_build_message_expr): Tweak ObjC++ message argument handling; call objc_finish_message_expr() instead of finish_message_expr(). (finish_message_expr): Rename to objc_finish_message_expr(); use OBJC_TYPE_NAME and OBJC_SET_TYPE_NAME macros instead of TYPE_NAME. call gen_type_name() instead of gen_declaration(); call objc_is_id() instead of using IS_ID and IS_CLASS; Use objc_class_name instead of calling get_identifier("Class"); handle CONVERT_EXPRs in receiver. (build_objc_method_call, warn_with_method): Do not call groktypename(). (build_ivar_reference): Call convert() instead of clobbering in a type. (hash_init): Initialize string_htab hash table. (add_instance_variable): Simplify parameter list; do not call grokfield(); do not populate CLASS_IVARS list. (start_class): Check for the existence of super class, if one was specified. (continue_class): Use CLASS_RAW_IVARS rather than CLASS_IVARS; do not call build_class_template(); adjust call to get_class_ivars(); call build_decl(), pushdecl() and finish_decl() instead of define_decl(). (finish_class): Call build_decl(), pushdecl() and finish_decl() instead of define_decl(). (add_protocols): Use PROTOCOL_BINFO_ELTS for the tree vector size. (start_protocol): Do not call build_protocol_template(); use PROTOCOL_BINFO_ELTS for the tree vector size. (encode_type_qualifiers): Do not handle the 'const' qualifier here. (encode_pointer): Encode 'const char *' as 'r*', for backwards compatibility. (encode_array): Use HOST_WIDE_INT_PRINT_DEC instead of "%ld". (encode_type): Handle the 'const' qualifier here. (objc_parmlist): New global variable, sued by objc_push_parm and objc_get_parm_info(). (objc_push_parm, objc_get_parm_info): New functions. (objc_expr_last): Remove function. (synth_self_and_ucmd_args): For instance methods, use the instance type for 'self'; call objc_push_parm() instead of push_parm_decl(). (start_method_def): Do not call push_scope(), declare_parm_level(), pop_scope(), push_parm_decl(), store_parm_decls() or objc_expr_last(); just use objc_push_parm() and objc_get_parm_info(). (comp_method_with_proto): Remove function. (objc_types_are_equivalent): Strip away indirections before comparing underlying types. (comp_proto_with_proto): Do not call groktypename(); types are no longer in raw declspec format. (objc_start_function): New function. (really_start_method): Call comp_proto_with_proto() instead of comp_method_with_proto(); call objc_start_function() instead of hand-crafting a function declarator. (continue_method_def, objc_expand_function_end): Remove functions. (get_super_receiver): Call objc_get_current_scope() instead of get_current_scope(); reference 'super_class' field (instead of 'class'). (finish_method_def): Rename to objc_finish_method_definition() and add a function decl parameter; move method encoding call from objc_expand_function_end(). (is_complex_decl, adorn_decl, gen_declarator, gen_declspecs, gen_declaration_1): Remove functions. (tmpbuf, RAW_DECLSPEC): Remove. (gen_declaration): Remove second parameter; simplify to deal with TYPE_P nodes instead of raw declspecs. (gen_type_name, gen_type_name_0): New functions. (gen_method_decl): Remove second parameter; call gen_type_name() instead of gen_declaration_1(). (dump_interface): Adjust calls to gen_declaration() and gen_method_decl(); do not allocate a separate string buffer. (init_objc): Allocate a larger string buffer to accommodate dump_interface(); adjust call to build_module_descriptor(); add call to build_module_initializer_routine() for the GNU runtime. (generate_classref_translation_entry): Do not call start_decl(); call finish_var_decl() instead of finish_decl(); call convert() instead of build_c_cast(). * objc-act.h (CLASS_OWN_IVARS): Remove accessor. (CLASS_BINFO_ELTS): Reduce from 6 to 5, now that CLASS_OWN_IVARS is gone. (OCTI_GNU_INIT_DECL, GNU_INIT_decl): New. (OCTI_ELLIPSIS_NODE, objc_ellipsis_node): Remove. (OCTI_ID_ID, id_type, objc_id_id): Rename to OCTI_ID_NAME, objc_object_type and objc_object_name, respectively. (OCTI_CLS_REF, OCTI_CLASS_NAME, objc_class_reference, objc_class_name): New. (IS_CLASS): New macro. (IS_ID, IS_SUPER): Robustify. (OCTI_EXECCLASS_DECL, execclass_decl): New. (finish_file, start_class, continue_class, finish_class, start_method_def, continue_method_def, finish_method_def, start_protocol, finish_protocol, objc_build_throw_stmt, objc_build_try_catch_finally_stmt, objc_build_synchronized_prologue, objc_build_synchronized_epilogue, objc_build_try_prologue, objc_build_try_epilogue, objc_build_catch_stmt, objc_build_catch_epilogue, objc_build_finally_prologue, objc_build_finally_epilogue, is_ivar, is_private, is_public, add_instance_variable, objc_add_method, get_super_receiver, objc_clear_super_receiver, get_class_ivars_from_name, get_class_reference, get_static_reference, get_object_reference, build_message_expr, finish_message_expr, build_selector_expr, build_ivar_reference, build_keyword_decl, build_method_decl, build_protocol_expr, build_objc_string_object, objc_declare_alias, objc_declare_class, objc_declare_protocols, objc_comptypes, objc_check_decl, build_encode_expr): Remove prototypes. (imp_count, cat_count): Make GGC-aware. (OBJC_SET_TYPE_NAME): New macro. From-SVN: r87168
2004-09-08 02:49:44 +02:00
gen_type_name_0 (tree type)
1992-01-18 00:15:38 +01:00
{
Makefile.in (c-parse.o): Depend on $(C_COMMON_H). [gcc/ChangeLog] 2004-09-07 Ziemowit Laski <zlaski@apple.com> * Makefile.in (c-parse.o): Depend on $(C_COMMON_H). * c-parse.in: Include c-common.h instead of objc-act.h. (ivar_decl_list, ivar_decls, ivar_decl, ivars, ivar_declarator, myparms, myparm): Remove %type declarations. (methodtype, optparms, OBJC_TYPE_QUAL, objc_quals, objc_qual, objc_typename, objc_try_catch_stmt, optellipsis): Add %type declarations. (objc_inherit_code, objc_public_flag): Remove. (typespec_nonreserved_nonattr): Call objc_get_protocol_qualified_type() instead of get_static_reference() and get_protocol_reference(). (stmt_nocomp): Call grokparm() on @catch parameter. (objcdef): Move semantic action to objc_finish_implementation(). (classdef): Move semantic action to objc_start_class_interface(), objc_continue_interface(), objc_finish_interface(), objc_start_class_implementation(), objc_continue_implementation(), objc_start_category_interface() and objc_start_category_implementation(). (protocoldef): Move semantic actions to objc_start_protocol() and objc_finish_interface(). (ivar_decl_list): Remove nonterminal. (visibility_spec): Move semantic actions to objc_set_visibility(). (ivar_decls): Remove assignment to $$. (ivar_decl): Rephrase in terms of component_decl; call objc_add_instance_variable(). (ivars, ivar_declarator): Remove nonterminals. (opt_semi): New nonterminal. (methodtype): Remove semantic actions. (methoddef): Move semantic actions to objc_set_method_type(), objc_start_method_definition() and objc_finish_method_definition(). (methodproto): Move semantic actions to objc_set_method_type() and objc_add_method_declaration(). (methoddecl): Use objc_typename instead of typename; move semantic actions to objc_build_method_signature(). (optarglist, myxdecls, mydecl, myparms, myparm): Remove nonterminals. (optparmlist): Express in terms of optparms and optellipsis. (optparms, optellipsis, objc_qual, objc_quals, objc_typename): New nonterminals. (keyworddecl): Use objc_typename instead of typename. (rid_to_yy): Mark RID_IN, RID_OUT, RID_INOUT, RID_BYCOPY, RID_BYREF and RID_ONEWAY as returning OBJC_TYPE_QUAL to yyparse(). [gcc/objc/ChangeLog] 2004-09-07 Ziemowit Laski <zlaski@apple.com> * Make-lang.in (objc/objc-parse.o): Depend on $(C_COMMON_H) instead of objc/objc-act.h. (objc/objc-act.o): Depend on $(HASHTAB_H). * objc-act.c: Include hashtab.h; in ObjC++ mode, include cp-tree.h and objcp-decl.h instead of c-tree.h. (build_module_descriptor, get_class_ivars, synth_id_with_class_suffix, error_with_ivar, gen_method_decl, gen_declaration, setup_string_decl, build_protocol_template): Adjust prototypes. (build_module_initializer_routine, start_class, continue_class, finish_class, start_method_def, objc_start_function, start_protocol, build_method_decl, objc_add_method, add_instance_variable, build_ivar_reference, is_ivar, is_private, get_super_receiver, build_selector_table_decl, objc_push_parm, objc_get_parm_info, gen_type_name, gen_type_name_0, start_var_decl, finish_var_decl, create_field_decl): New prototypes. (objc_expand_function_end, comp_method_with_proto, objc_expr_last, gen_declaration_1, gen_declarator, is_complex_decl, adorn_decl, define_decl, create_builtin_decl, gen_declspecs): Remove prototypes. (TYPE_ID): Rename to OBJECT_TYPEDEF_NAME. (CLASS_TYPEDEF_NAME): New. (TAG_EXECCLASS): Change from a global variable to a #define. (TAG_RETURN_STRUCT): Delete. (TAG_GNUINIT): New, holds '__objc_gnu_init' name. (objc_inherit_code, objc_public_flag): New, moved from c-parse.in. (string_descriptor): New struct. (string_htab): New hash table. (string_hash, string_eq): New prototypes. (generate_struct_by_value_array): Call create_field_decl() instead of create_builtin_decl(). (objc_init): Do not initialize objc_ellipsis_node or TAG_EXECCLASS; In ObjC++ mode, call cxx_init() instead of c_objc_common_init(). (objc_finish_file): In ObjC++, call instantiate_pending_templates() and cp_finish_file(). (define_decl, get_static_reference, get_protocol_reference, create_builtin_decl): Remove functions. (objc_start_class_interface, objc_start_category_interface, objc_start_protocol, objc_continue_interface, objc_finish_interface, objc_start_class_implementation, objc_start_category_implementation, objc_continue_implementation, objc_finish_implementation, objc_set_visibility, objc_set_method_type, objc_build_method_signature, objc_add_method_declaration, objc_start_method_definition, objc_add_instance_variable, objc_get_protocol_qualified_type, create_field_decl, start_var_decl, finish_var_decl): New functions. (setup_string_decl): Simplify since it is only called once. (synth_module_prologue): Call build_class_template(); predefine 'id' and 'Class' as typedefs; rename 'temp_type' to 'type'; disable debug hooks for duration of function; fix GNU runtime messenger signatures to correspond to reality; forward-declare '__objc_exec_class' for the GNU runtime; call build_selector_table_decl(); in ObjC++ mode, generate 'extern "C" { ... }' wrappers around synthesized declarations; call build_protocol_template() and build_category_template(). (string_hash, string_eq): New functions. (objc_build_string_object): Check metaclass correctness only once; store string literals in hash table. (objc_build_constructor): Do not convert initializer elements; adjust for ObjC++ impedance mismatch. (build_objc_symtab_template): Call create_field_decl() instead of create_builtin_decl(). (init_objc_symtab): Add missing conversion to initializer element. (build_metadata_decl): Call start_var_decl() instead of define_decl(). (generate_objc_symtab_decl): Do not call build_category_template(); call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(). (build_module_descriptor): Call create_field_decl() instead of grokfield(); call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(); always mark module descriptor as used; move GNU runtime-specific functionality to build_module_initializer_routine(). (build_module_initializer_routine): New function, broken off of build_module_descriptor(). (objc_static_init_needed_p, objc_generate_static_init_call): New functions. (generate_static_references, generate_strings, build_selector_translation_table, generate_descriptor_table, generate_ivars_list, generate_dispatch_table, generate_category): Call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(); build a type directly instead of via groktypename(). (build_selector_reference_decl, build_selector_table_decl, build_class_reference_decl, build_protocol_reference, generate_objc_image_info): Call start_var_decl() instead of build_decl(). (build_selector_reference): For GNU runtime, do not call build_selector_reference_decl(). (build_selector, build_typed_selector_reference): Always convert result to the selector type. (add_objc_string): Cast return value to 'char *'. (build_method_prototype_template, build_selector_template, build_method_template): Use actual selector type for fields pointing to selectors. (finish_objc): For GNU runtime, call build_module_initializer_routine() after build_module_descriptor(). (generate_protocol_list, generate_shared_structures): Call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(); build a type directly instead of via groktypename(). (synth_id_with_class_suffix): Return a string. (get_arg_type_list): For instance methods, use the instance type for 'self'; do not call groktypename_in_parm_context(). (build_objc_string_decl): Squash redeclaration errors in ObjC++. (objc_is_class_name): Use OBJC_TYPE_NAME instead of TYPE_NAME; handle RECORD_TYPEs in ObjC as well as ObjC++. (objc_is_id): New function. (objc_is_object_ptr): Return the canonical type node. (objc_get_class_ivars): Simplify using get_class_ivars(). (get_class_ivars): Remove second parameter; create a fresh copy of the ivar list for each call; do not check for existence of super class. (objc_eh_runtime_type): Mark #ifndef OBJCPLUS. (objc_init_exceptions): When using SJLJ-style exceptions, require the use of '-fobjc-exceptions' flag; do not require it for DWARF-style exceptions. (objc_build_exc_ptr, next_sjlj_build_try_catch_finally): Use objc_object_type instead of objc_id_type. (objc_begin_catch_clause): Convert the incoming PARM_DECL into a VAR_DECL before placing it in the appropriate scope; do not call define_decl(); adjust call to c_begin_compound_stmt(); use objc_object_type instead of objc_id_type. (build_next_objc_exception_stuff): Call create_field_decl() instead of create_builtin_decl(); construct type directly instead of calling groktypename(); use OBJC_VOID_AT_END to mark end of function parameters. (build_private_template): Adjust call to get_class_ivars(); build a type directly instead of via groktypename(). (build_protocol_template, build_method_prototype_list_template, build_method_prototype_template, build_category_template, build_selector_template, build_class_template, build_super_template, build_ivar_template, build_ivar_list_template, build_method_list_template, build_method_template): Call create_field_decl() instead of grokfield(). (objc_method_parm_type): Do not call groktypename(). (generate_descriptor_table): Call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(). (generate_method_descriptors, build_protocol_initializer, generate_dispatch_tables, build_category_initializer, build_shared_structure_initializer): Do not call groktypename(). (generate_protocols): Call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(); do not call groktypename(). (error_with_ivar): Remove last parameter. (check_ivars): Do not iterate ovar CLASS_RAW_IVARS lists in addition to CLASS_IVARS lists; adjust calls to error_with_ivar(). (generate_ivar_lists): Convert one of the initializer elements; do not call groktypename(). (get_arg_type_list, start_method_def, gen_method_def): Account for new representation of variable arguments and '...' in Objective-C methods; add Objective-C++ impedance matching code. (is_objc_type_qualifier): Remove function. (adjust_type_for_id_default): Simplify; there is no longer a need to wade through declspecs. (lookup_interface, start_class, continue_class, finish_class, start_method_def, start_protocol, build_method_decl, objc_add_method, add_instance_variable, build_ivar_reference, is_ivar, is_private, get_super_receiver, objc_build_finally_epilogue): Make into static functions. (receiver_is_class_object): Use new IS_CLASS() macro. (objc_build_message_expr): Tweak ObjC++ message argument handling; call objc_finish_message_expr() instead of finish_message_expr(). (finish_message_expr): Rename to objc_finish_message_expr(); use OBJC_TYPE_NAME and OBJC_SET_TYPE_NAME macros instead of TYPE_NAME. call gen_type_name() instead of gen_declaration(); call objc_is_id() instead of using IS_ID and IS_CLASS; Use objc_class_name instead of calling get_identifier("Class"); handle CONVERT_EXPRs in receiver. (build_objc_method_call, warn_with_method): Do not call groktypename(). (build_ivar_reference): Call convert() instead of clobbering in a type. (hash_init): Initialize string_htab hash table. (add_instance_variable): Simplify parameter list; do not call grokfield(); do not populate CLASS_IVARS list. (start_class): Check for the existence of super class, if one was specified. (continue_class): Use CLASS_RAW_IVARS rather than CLASS_IVARS; do not call build_class_template(); adjust call to get_class_ivars(); call build_decl(), pushdecl() and finish_decl() instead of define_decl(). (finish_class): Call build_decl(), pushdecl() and finish_decl() instead of define_decl(). (add_protocols): Use PROTOCOL_BINFO_ELTS for the tree vector size. (start_protocol): Do not call build_protocol_template(); use PROTOCOL_BINFO_ELTS for the tree vector size. (encode_type_qualifiers): Do not handle the 'const' qualifier here. (encode_pointer): Encode 'const char *' as 'r*', for backwards compatibility. (encode_array): Use HOST_WIDE_INT_PRINT_DEC instead of "%ld". (encode_type): Handle the 'const' qualifier here. (objc_parmlist): New global variable, sued by objc_push_parm and objc_get_parm_info(). (objc_push_parm, objc_get_parm_info): New functions. (objc_expr_last): Remove function. (synth_self_and_ucmd_args): For instance methods, use the instance type for 'self'; call objc_push_parm() instead of push_parm_decl(). (start_method_def): Do not call push_scope(), declare_parm_level(), pop_scope(), push_parm_decl(), store_parm_decls() or objc_expr_last(); just use objc_push_parm() and objc_get_parm_info(). (comp_method_with_proto): Remove function. (objc_types_are_equivalent): Strip away indirections before comparing underlying types. (comp_proto_with_proto): Do not call groktypename(); types are no longer in raw declspec format. (objc_start_function): New function. (really_start_method): Call comp_proto_with_proto() instead of comp_method_with_proto(); call objc_start_function() instead of hand-crafting a function declarator. (continue_method_def, objc_expand_function_end): Remove functions. (get_super_receiver): Call objc_get_current_scope() instead of get_current_scope(); reference 'super_class' field (instead of 'class'). (finish_method_def): Rename to objc_finish_method_definition() and add a function decl parameter; move method encoding call from objc_expand_function_end(). (is_complex_decl, adorn_decl, gen_declarator, gen_declspecs, gen_declaration_1): Remove functions. (tmpbuf, RAW_DECLSPEC): Remove. (gen_declaration): Remove second parameter; simplify to deal with TYPE_P nodes instead of raw declspecs. (gen_type_name, gen_type_name_0): New functions. (gen_method_decl): Remove second parameter; call gen_type_name() instead of gen_declaration_1(). (dump_interface): Adjust calls to gen_declaration() and gen_method_decl(); do not allocate a separate string buffer. (init_objc): Allocate a larger string buffer to accommodate dump_interface(); adjust call to build_module_descriptor(); add call to build_module_initializer_routine() for the GNU runtime. (generate_classref_translation_entry): Do not call start_decl(); call finish_var_decl() instead of finish_decl(); call convert() instead of build_c_cast(). * objc-act.h (CLASS_OWN_IVARS): Remove accessor. (CLASS_BINFO_ELTS): Reduce from 6 to 5, now that CLASS_OWN_IVARS is gone. (OCTI_GNU_INIT_DECL, GNU_INIT_decl): New. (OCTI_ELLIPSIS_NODE, objc_ellipsis_node): Remove. (OCTI_ID_ID, id_type, objc_id_id): Rename to OCTI_ID_NAME, objc_object_type and objc_object_name, respectively. (OCTI_CLS_REF, OCTI_CLASS_NAME, objc_class_reference, objc_class_name): New. (IS_CLASS): New macro. (IS_ID, IS_SUPER): Robustify. (OCTI_EXECCLASS_DECL, execclass_decl): New. (finish_file, start_class, continue_class, finish_class, start_method_def, continue_method_def, finish_method_def, start_protocol, finish_protocol, objc_build_throw_stmt, objc_build_try_catch_finally_stmt, objc_build_synchronized_prologue, objc_build_synchronized_epilogue, objc_build_try_prologue, objc_build_try_epilogue, objc_build_catch_stmt, objc_build_catch_epilogue, objc_build_finally_prologue, objc_build_finally_epilogue, is_ivar, is_private, is_public, add_instance_variable, objc_add_method, get_super_receiver, objc_clear_super_receiver, get_class_ivars_from_name, get_class_reference, get_static_reference, get_object_reference, build_message_expr, finish_message_expr, build_selector_expr, build_ivar_reference, build_keyword_decl, build_method_decl, build_protocol_expr, build_objc_string_object, objc_declare_alias, objc_declare_class, objc_declare_protocols, objc_comptypes, objc_check_decl, build_encode_expr): Remove prototypes. (imp_count, cat_count): Make GGC-aware. (OBJC_SET_TYPE_NAME): New macro. From-SVN: r87168
2004-09-08 02:49:44 +02:00
tree orig = type, proto;
1992-01-18 00:15:38 +01:00
Makefile.in (c-parse.o): Depend on $(C_COMMON_H). [gcc/ChangeLog] 2004-09-07 Ziemowit Laski <zlaski@apple.com> * Makefile.in (c-parse.o): Depend on $(C_COMMON_H). * c-parse.in: Include c-common.h instead of objc-act.h. (ivar_decl_list, ivar_decls, ivar_decl, ivars, ivar_declarator, myparms, myparm): Remove %type declarations. (methodtype, optparms, OBJC_TYPE_QUAL, objc_quals, objc_qual, objc_typename, objc_try_catch_stmt, optellipsis): Add %type declarations. (objc_inherit_code, objc_public_flag): Remove. (typespec_nonreserved_nonattr): Call objc_get_protocol_qualified_type() instead of get_static_reference() and get_protocol_reference(). (stmt_nocomp): Call grokparm() on @catch parameter. (objcdef): Move semantic action to objc_finish_implementation(). (classdef): Move semantic action to objc_start_class_interface(), objc_continue_interface(), objc_finish_interface(), objc_start_class_implementation(), objc_continue_implementation(), objc_start_category_interface() and objc_start_category_implementation(). (protocoldef): Move semantic actions to objc_start_protocol() and objc_finish_interface(). (ivar_decl_list): Remove nonterminal. (visibility_spec): Move semantic actions to objc_set_visibility(). (ivar_decls): Remove assignment to $$. (ivar_decl): Rephrase in terms of component_decl; call objc_add_instance_variable(). (ivars, ivar_declarator): Remove nonterminals. (opt_semi): New nonterminal. (methodtype): Remove semantic actions. (methoddef): Move semantic actions to objc_set_method_type(), objc_start_method_definition() and objc_finish_method_definition(). (methodproto): Move semantic actions to objc_set_method_type() and objc_add_method_declaration(). (methoddecl): Use objc_typename instead of typename; move semantic actions to objc_build_method_signature(). (optarglist, myxdecls, mydecl, myparms, myparm): Remove nonterminals. (optparmlist): Express in terms of optparms and optellipsis. (optparms, optellipsis, objc_qual, objc_quals, objc_typename): New nonterminals. (keyworddecl): Use objc_typename instead of typename. (rid_to_yy): Mark RID_IN, RID_OUT, RID_INOUT, RID_BYCOPY, RID_BYREF and RID_ONEWAY as returning OBJC_TYPE_QUAL to yyparse(). [gcc/objc/ChangeLog] 2004-09-07 Ziemowit Laski <zlaski@apple.com> * Make-lang.in (objc/objc-parse.o): Depend on $(C_COMMON_H) instead of objc/objc-act.h. (objc/objc-act.o): Depend on $(HASHTAB_H). * objc-act.c: Include hashtab.h; in ObjC++ mode, include cp-tree.h and objcp-decl.h instead of c-tree.h. (build_module_descriptor, get_class_ivars, synth_id_with_class_suffix, error_with_ivar, gen_method_decl, gen_declaration, setup_string_decl, build_protocol_template): Adjust prototypes. (build_module_initializer_routine, start_class, continue_class, finish_class, start_method_def, objc_start_function, start_protocol, build_method_decl, objc_add_method, add_instance_variable, build_ivar_reference, is_ivar, is_private, get_super_receiver, build_selector_table_decl, objc_push_parm, objc_get_parm_info, gen_type_name, gen_type_name_0, start_var_decl, finish_var_decl, create_field_decl): New prototypes. (objc_expand_function_end, comp_method_with_proto, objc_expr_last, gen_declaration_1, gen_declarator, is_complex_decl, adorn_decl, define_decl, create_builtin_decl, gen_declspecs): Remove prototypes. (TYPE_ID): Rename to OBJECT_TYPEDEF_NAME. (CLASS_TYPEDEF_NAME): New. (TAG_EXECCLASS): Change from a global variable to a #define. (TAG_RETURN_STRUCT): Delete. (TAG_GNUINIT): New, holds '__objc_gnu_init' name. (objc_inherit_code, objc_public_flag): New, moved from c-parse.in. (string_descriptor): New struct. (string_htab): New hash table. (string_hash, string_eq): New prototypes. (generate_struct_by_value_array): Call create_field_decl() instead of create_builtin_decl(). (objc_init): Do not initialize objc_ellipsis_node or TAG_EXECCLASS; In ObjC++ mode, call cxx_init() instead of c_objc_common_init(). (objc_finish_file): In ObjC++, call instantiate_pending_templates() and cp_finish_file(). (define_decl, get_static_reference, get_protocol_reference, create_builtin_decl): Remove functions. (objc_start_class_interface, objc_start_category_interface, objc_start_protocol, objc_continue_interface, objc_finish_interface, objc_start_class_implementation, objc_start_category_implementation, objc_continue_implementation, objc_finish_implementation, objc_set_visibility, objc_set_method_type, objc_build_method_signature, objc_add_method_declaration, objc_start_method_definition, objc_add_instance_variable, objc_get_protocol_qualified_type, create_field_decl, start_var_decl, finish_var_decl): New functions. (setup_string_decl): Simplify since it is only called once. (synth_module_prologue): Call build_class_template(); predefine 'id' and 'Class' as typedefs; rename 'temp_type' to 'type'; disable debug hooks for duration of function; fix GNU runtime messenger signatures to correspond to reality; forward-declare '__objc_exec_class' for the GNU runtime; call build_selector_table_decl(); in ObjC++ mode, generate 'extern "C" { ... }' wrappers around synthesized declarations; call build_protocol_template() and build_category_template(). (string_hash, string_eq): New functions. (objc_build_string_object): Check metaclass correctness only once; store string literals in hash table. (objc_build_constructor): Do not convert initializer elements; adjust for ObjC++ impedance mismatch. (build_objc_symtab_template): Call create_field_decl() instead of create_builtin_decl(). (init_objc_symtab): Add missing conversion to initializer element. (build_metadata_decl): Call start_var_decl() instead of define_decl(). (generate_objc_symtab_decl): Do not call build_category_template(); call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(). (build_module_descriptor): Call create_field_decl() instead of grokfield(); call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(); always mark module descriptor as used; move GNU runtime-specific functionality to build_module_initializer_routine(). (build_module_initializer_routine): New function, broken off of build_module_descriptor(). (objc_static_init_needed_p, objc_generate_static_init_call): New functions. (generate_static_references, generate_strings, build_selector_translation_table, generate_descriptor_table, generate_ivars_list, generate_dispatch_table, generate_category): Call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(); build a type directly instead of via groktypename(). (build_selector_reference_decl, build_selector_table_decl, build_class_reference_decl, build_protocol_reference, generate_objc_image_info): Call start_var_decl() instead of build_decl(). (build_selector_reference): For GNU runtime, do not call build_selector_reference_decl(). (build_selector, build_typed_selector_reference): Always convert result to the selector type. (add_objc_string): Cast return value to 'char *'. (build_method_prototype_template, build_selector_template, build_method_template): Use actual selector type for fields pointing to selectors. (finish_objc): For GNU runtime, call build_module_initializer_routine() after build_module_descriptor(). (generate_protocol_list, generate_shared_structures): Call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(); build a type directly instead of via groktypename(). (synth_id_with_class_suffix): Return a string. (get_arg_type_list): For instance methods, use the instance type for 'self'; do not call groktypename_in_parm_context(). (build_objc_string_decl): Squash redeclaration errors in ObjC++. (objc_is_class_name): Use OBJC_TYPE_NAME instead of TYPE_NAME; handle RECORD_TYPEs in ObjC as well as ObjC++. (objc_is_id): New function. (objc_is_object_ptr): Return the canonical type node. (objc_get_class_ivars): Simplify using get_class_ivars(). (get_class_ivars): Remove second parameter; create a fresh copy of the ivar list for each call; do not check for existence of super class. (objc_eh_runtime_type): Mark #ifndef OBJCPLUS. (objc_init_exceptions): When using SJLJ-style exceptions, require the use of '-fobjc-exceptions' flag; do not require it for DWARF-style exceptions. (objc_build_exc_ptr, next_sjlj_build_try_catch_finally): Use objc_object_type instead of objc_id_type. (objc_begin_catch_clause): Convert the incoming PARM_DECL into a VAR_DECL before placing it in the appropriate scope; do not call define_decl(); adjust call to c_begin_compound_stmt(); use objc_object_type instead of objc_id_type. (build_next_objc_exception_stuff): Call create_field_decl() instead of create_builtin_decl(); construct type directly instead of calling groktypename(); use OBJC_VOID_AT_END to mark end of function parameters. (build_private_template): Adjust call to get_class_ivars(); build a type directly instead of via groktypename(). (build_protocol_template, build_method_prototype_list_template, build_method_prototype_template, build_category_template, build_selector_template, build_class_template, build_super_template, build_ivar_template, build_ivar_list_template, build_method_list_template, build_method_template): Call create_field_decl() instead of grokfield(). (objc_method_parm_type): Do not call groktypename(). (generate_descriptor_table): Call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(). (generate_method_descriptors, build_protocol_initializer, generate_dispatch_tables, build_category_initializer, build_shared_structure_initializer): Do not call groktypename(). (generate_protocols): Call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(); do not call groktypename(). (error_with_ivar): Remove last parameter. (check_ivars): Do not iterate ovar CLASS_RAW_IVARS lists in addition to CLASS_IVARS lists; adjust calls to error_with_ivar(). (generate_ivar_lists): Convert one of the initializer elements; do not call groktypename(). (get_arg_type_list, start_method_def, gen_method_def): Account for new representation of variable arguments and '...' in Objective-C methods; add Objective-C++ impedance matching code. (is_objc_type_qualifier): Remove function. (adjust_type_for_id_default): Simplify; there is no longer a need to wade through declspecs. (lookup_interface, start_class, continue_class, finish_class, start_method_def, start_protocol, build_method_decl, objc_add_method, add_instance_variable, build_ivar_reference, is_ivar, is_private, get_super_receiver, objc_build_finally_epilogue): Make into static functions. (receiver_is_class_object): Use new IS_CLASS() macro. (objc_build_message_expr): Tweak ObjC++ message argument handling; call objc_finish_message_expr() instead of finish_message_expr(). (finish_message_expr): Rename to objc_finish_message_expr(); use OBJC_TYPE_NAME and OBJC_SET_TYPE_NAME macros instead of TYPE_NAME. call gen_type_name() instead of gen_declaration(); call objc_is_id() instead of using IS_ID and IS_CLASS; Use objc_class_name instead of calling get_identifier("Class"); handle CONVERT_EXPRs in receiver. (build_objc_method_call, warn_with_method): Do not call groktypename(). (build_ivar_reference): Call convert() instead of clobbering in a type. (hash_init): Initialize string_htab hash table. (add_instance_variable): Simplify parameter list; do not call grokfield(); do not populate CLASS_IVARS list. (start_class): Check for the existence of super class, if one was specified. (continue_class): Use CLASS_RAW_IVARS rather than CLASS_IVARS; do not call build_class_template(); adjust call to get_class_ivars(); call build_decl(), pushdecl() and finish_decl() instead of define_decl(). (finish_class): Call build_decl(), pushdecl() and finish_decl() instead of define_decl(). (add_protocols): Use PROTOCOL_BINFO_ELTS for the tree vector size. (start_protocol): Do not call build_protocol_template(); use PROTOCOL_BINFO_ELTS for the tree vector size. (encode_type_qualifiers): Do not handle the 'const' qualifier here. (encode_pointer): Encode 'const char *' as 'r*', for backwards compatibility. (encode_array): Use HOST_WIDE_INT_PRINT_DEC instead of "%ld". (encode_type): Handle the 'const' qualifier here. (objc_parmlist): New global variable, sued by objc_push_parm and objc_get_parm_info(). (objc_push_parm, objc_get_parm_info): New functions. (objc_expr_last): Remove function. (synth_self_and_ucmd_args): For instance methods, use the instance type for 'self'; call objc_push_parm() instead of push_parm_decl(). (start_method_def): Do not call push_scope(), declare_parm_level(), pop_scope(), push_parm_decl(), store_parm_decls() or objc_expr_last(); just use objc_push_parm() and objc_get_parm_info(). (comp_method_with_proto): Remove function. (objc_types_are_equivalent): Strip away indirections before comparing underlying types. (comp_proto_with_proto): Do not call groktypename(); types are no longer in raw declspec format. (objc_start_function): New function. (really_start_method): Call comp_proto_with_proto() instead of comp_method_with_proto(); call objc_start_function() instead of hand-crafting a function declarator. (continue_method_def, objc_expand_function_end): Remove functions. (get_super_receiver): Call objc_get_current_scope() instead of get_current_scope(); reference 'super_class' field (instead of 'class'). (finish_method_def): Rename to objc_finish_method_definition() and add a function decl parameter; move method encoding call from objc_expand_function_end(). (is_complex_decl, adorn_decl, gen_declarator, gen_declspecs, gen_declaration_1): Remove functions. (tmpbuf, RAW_DECLSPEC): Remove. (gen_declaration): Remove second parameter; simplify to deal with TYPE_P nodes instead of raw declspecs. (gen_type_name, gen_type_name_0): New functions. (gen_method_decl): Remove second parameter; call gen_type_name() instead of gen_declaration_1(). (dump_interface): Adjust calls to gen_declaration() and gen_method_decl(); do not allocate a separate string buffer. (init_objc): Allocate a larger string buffer to accommodate dump_interface(); adjust call to build_module_descriptor(); add call to build_module_initializer_routine() for the GNU runtime. (generate_classref_translation_entry): Do not call start_decl(); call finish_var_decl() instead of finish_decl(); call convert() instead of build_c_cast(). * objc-act.h (CLASS_OWN_IVARS): Remove accessor. (CLASS_BINFO_ELTS): Reduce from 6 to 5, now that CLASS_OWN_IVARS is gone. (OCTI_GNU_INIT_DECL, GNU_INIT_decl): New. (OCTI_ELLIPSIS_NODE, objc_ellipsis_node): Remove. (OCTI_ID_ID, id_type, objc_id_id): Rename to OCTI_ID_NAME, objc_object_type and objc_object_name, respectively. (OCTI_CLS_REF, OCTI_CLASS_NAME, objc_class_reference, objc_class_name): New. (IS_CLASS): New macro. (IS_ID, IS_SUPER): Robustify. (OCTI_EXECCLASS_DECL, execclass_decl): New. (finish_file, start_class, continue_class, finish_class, start_method_def, continue_method_def, finish_method_def, start_protocol, finish_protocol, objc_build_throw_stmt, objc_build_try_catch_finally_stmt, objc_build_synchronized_prologue, objc_build_synchronized_epilogue, objc_build_try_prologue, objc_build_try_epilogue, objc_build_catch_stmt, objc_build_catch_epilogue, objc_build_finally_prologue, objc_build_finally_epilogue, is_ivar, is_private, is_public, add_instance_variable, objc_add_method, get_super_receiver, objc_clear_super_receiver, get_class_ivars_from_name, get_class_reference, get_static_reference, get_object_reference, build_message_expr, finish_message_expr, build_selector_expr, build_ivar_reference, build_keyword_decl, build_method_decl, build_protocol_expr, build_objc_string_object, objc_declare_alias, objc_declare_class, objc_declare_protocols, objc_comptypes, objc_check_decl, build_encode_expr): Remove prototypes. (imp_count, cat_count): Make GGC-aware. (OBJC_SET_TYPE_NAME): New macro. From-SVN: r87168
2004-09-08 02:49:44 +02:00
if (TYPE_P (type) && TYPE_NAME (type))
type = TYPE_NAME (type);
else if (POINTER_TYPE_P (type) || TREE_CODE (type) == ARRAY_TYPE)
1992-01-18 00:15:38 +01:00
{
tree inner = TREE_TYPE (type);
while (TREE_CODE (inner) == ARRAY_TYPE)
inner = TREE_TYPE (inner);
gen_type_name_0 (inner);
if (!POINTER_TYPE_P (inner))
Makefile.in (c-parse.o): Depend on $(C_COMMON_H). [gcc/ChangeLog] 2004-09-07 Ziemowit Laski <zlaski@apple.com> * Makefile.in (c-parse.o): Depend on $(C_COMMON_H). * c-parse.in: Include c-common.h instead of objc-act.h. (ivar_decl_list, ivar_decls, ivar_decl, ivars, ivar_declarator, myparms, myparm): Remove %type declarations. (methodtype, optparms, OBJC_TYPE_QUAL, objc_quals, objc_qual, objc_typename, objc_try_catch_stmt, optellipsis): Add %type declarations. (objc_inherit_code, objc_public_flag): Remove. (typespec_nonreserved_nonattr): Call objc_get_protocol_qualified_type() instead of get_static_reference() and get_protocol_reference(). (stmt_nocomp): Call grokparm() on @catch parameter. (objcdef): Move semantic action to objc_finish_implementation(). (classdef): Move semantic action to objc_start_class_interface(), objc_continue_interface(), objc_finish_interface(), objc_start_class_implementation(), objc_continue_implementation(), objc_start_category_interface() and objc_start_category_implementation(). (protocoldef): Move semantic actions to objc_start_protocol() and objc_finish_interface(). (ivar_decl_list): Remove nonterminal. (visibility_spec): Move semantic actions to objc_set_visibility(). (ivar_decls): Remove assignment to $$. (ivar_decl): Rephrase in terms of component_decl; call objc_add_instance_variable(). (ivars, ivar_declarator): Remove nonterminals. (opt_semi): New nonterminal. (methodtype): Remove semantic actions. (methoddef): Move semantic actions to objc_set_method_type(), objc_start_method_definition() and objc_finish_method_definition(). (methodproto): Move semantic actions to objc_set_method_type() and objc_add_method_declaration(). (methoddecl): Use objc_typename instead of typename; move semantic actions to objc_build_method_signature(). (optarglist, myxdecls, mydecl, myparms, myparm): Remove nonterminals. (optparmlist): Express in terms of optparms and optellipsis. (optparms, optellipsis, objc_qual, objc_quals, objc_typename): New nonterminals. (keyworddecl): Use objc_typename instead of typename. (rid_to_yy): Mark RID_IN, RID_OUT, RID_INOUT, RID_BYCOPY, RID_BYREF and RID_ONEWAY as returning OBJC_TYPE_QUAL to yyparse(). [gcc/objc/ChangeLog] 2004-09-07 Ziemowit Laski <zlaski@apple.com> * Make-lang.in (objc/objc-parse.o): Depend on $(C_COMMON_H) instead of objc/objc-act.h. (objc/objc-act.o): Depend on $(HASHTAB_H). * objc-act.c: Include hashtab.h; in ObjC++ mode, include cp-tree.h and objcp-decl.h instead of c-tree.h. (build_module_descriptor, get_class_ivars, synth_id_with_class_suffix, error_with_ivar, gen_method_decl, gen_declaration, setup_string_decl, build_protocol_template): Adjust prototypes. (build_module_initializer_routine, start_class, continue_class, finish_class, start_method_def, objc_start_function, start_protocol, build_method_decl, objc_add_method, add_instance_variable, build_ivar_reference, is_ivar, is_private, get_super_receiver, build_selector_table_decl, objc_push_parm, objc_get_parm_info, gen_type_name, gen_type_name_0, start_var_decl, finish_var_decl, create_field_decl): New prototypes. (objc_expand_function_end, comp_method_with_proto, objc_expr_last, gen_declaration_1, gen_declarator, is_complex_decl, adorn_decl, define_decl, create_builtin_decl, gen_declspecs): Remove prototypes. (TYPE_ID): Rename to OBJECT_TYPEDEF_NAME. (CLASS_TYPEDEF_NAME): New. (TAG_EXECCLASS): Change from a global variable to a #define. (TAG_RETURN_STRUCT): Delete. (TAG_GNUINIT): New, holds '__objc_gnu_init' name. (objc_inherit_code, objc_public_flag): New, moved from c-parse.in. (string_descriptor): New struct. (string_htab): New hash table. (string_hash, string_eq): New prototypes. (generate_struct_by_value_array): Call create_field_decl() instead of create_builtin_decl(). (objc_init): Do not initialize objc_ellipsis_node or TAG_EXECCLASS; In ObjC++ mode, call cxx_init() instead of c_objc_common_init(). (objc_finish_file): In ObjC++, call instantiate_pending_templates() and cp_finish_file(). (define_decl, get_static_reference, get_protocol_reference, create_builtin_decl): Remove functions. (objc_start_class_interface, objc_start_category_interface, objc_start_protocol, objc_continue_interface, objc_finish_interface, objc_start_class_implementation, objc_start_category_implementation, objc_continue_implementation, objc_finish_implementation, objc_set_visibility, objc_set_method_type, objc_build_method_signature, objc_add_method_declaration, objc_start_method_definition, objc_add_instance_variable, objc_get_protocol_qualified_type, create_field_decl, start_var_decl, finish_var_decl): New functions. (setup_string_decl): Simplify since it is only called once. (synth_module_prologue): Call build_class_template(); predefine 'id' and 'Class' as typedefs; rename 'temp_type' to 'type'; disable debug hooks for duration of function; fix GNU runtime messenger signatures to correspond to reality; forward-declare '__objc_exec_class' for the GNU runtime; call build_selector_table_decl(); in ObjC++ mode, generate 'extern "C" { ... }' wrappers around synthesized declarations; call build_protocol_template() and build_category_template(). (string_hash, string_eq): New functions. (objc_build_string_object): Check metaclass correctness only once; store string literals in hash table. (objc_build_constructor): Do not convert initializer elements; adjust for ObjC++ impedance mismatch. (build_objc_symtab_template): Call create_field_decl() instead of create_builtin_decl(). (init_objc_symtab): Add missing conversion to initializer element. (build_metadata_decl): Call start_var_decl() instead of define_decl(). (generate_objc_symtab_decl): Do not call build_category_template(); call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(). (build_module_descriptor): Call create_field_decl() instead of grokfield(); call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(); always mark module descriptor as used; move GNU runtime-specific functionality to build_module_initializer_routine(). (build_module_initializer_routine): New function, broken off of build_module_descriptor(). (objc_static_init_needed_p, objc_generate_static_init_call): New functions. (generate_static_references, generate_strings, build_selector_translation_table, generate_descriptor_table, generate_ivars_list, generate_dispatch_table, generate_category): Call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(); build a type directly instead of via groktypename(). (build_selector_reference_decl, build_selector_table_decl, build_class_reference_decl, build_protocol_reference, generate_objc_image_info): Call start_var_decl() instead of build_decl(). (build_selector_reference): For GNU runtime, do not call build_selector_reference_decl(). (build_selector, build_typed_selector_reference): Always convert result to the selector type. (add_objc_string): Cast return value to 'char *'. (build_method_prototype_template, build_selector_template, build_method_template): Use actual selector type for fields pointing to selectors. (finish_objc): For GNU runtime, call build_module_initializer_routine() after build_module_descriptor(). (generate_protocol_list, generate_shared_structures): Call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(); build a type directly instead of via groktypename(). (synth_id_with_class_suffix): Return a string. (get_arg_type_list): For instance methods, use the instance type for 'self'; do not call groktypename_in_parm_context(). (build_objc_string_decl): Squash redeclaration errors in ObjC++. (objc_is_class_name): Use OBJC_TYPE_NAME instead of TYPE_NAME; handle RECORD_TYPEs in ObjC as well as ObjC++. (objc_is_id): New function. (objc_is_object_ptr): Return the canonical type node. (objc_get_class_ivars): Simplify using get_class_ivars(). (get_class_ivars): Remove second parameter; create a fresh copy of the ivar list for each call; do not check for existence of super class. (objc_eh_runtime_type): Mark #ifndef OBJCPLUS. (objc_init_exceptions): When using SJLJ-style exceptions, require the use of '-fobjc-exceptions' flag; do not require it for DWARF-style exceptions. (objc_build_exc_ptr, next_sjlj_build_try_catch_finally): Use objc_object_type instead of objc_id_type. (objc_begin_catch_clause): Convert the incoming PARM_DECL into a VAR_DECL before placing it in the appropriate scope; do not call define_decl(); adjust call to c_begin_compound_stmt(); use objc_object_type instead of objc_id_type. (build_next_objc_exception_stuff): Call create_field_decl() instead of create_builtin_decl(); construct type directly instead of calling groktypename(); use OBJC_VOID_AT_END to mark end of function parameters. (build_private_template): Adjust call to get_class_ivars(); build a type directly instead of via groktypename(). (build_protocol_template, build_method_prototype_list_template, build_method_prototype_template, build_category_template, build_selector_template, build_class_template, build_super_template, build_ivar_template, build_ivar_list_template, build_method_list_template, build_method_template): Call create_field_decl() instead of grokfield(). (objc_method_parm_type): Do not call groktypename(). (generate_descriptor_table): Call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(). (generate_method_descriptors, build_protocol_initializer, generate_dispatch_tables, build_category_initializer, build_shared_structure_initializer): Do not call groktypename(). (generate_protocols): Call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(); do not call groktypename(). (error_with_ivar): Remove last parameter. (check_ivars): Do not iterate ovar CLASS_RAW_IVARS lists in addition to CLASS_IVARS lists; adjust calls to error_with_ivar(). (generate_ivar_lists): Convert one of the initializer elements; do not call groktypename(). (get_arg_type_list, start_method_def, gen_method_def): Account for new representation of variable arguments and '...' in Objective-C methods; add Objective-C++ impedance matching code. (is_objc_type_qualifier): Remove function. (adjust_type_for_id_default): Simplify; there is no longer a need to wade through declspecs. (lookup_interface, start_class, continue_class, finish_class, start_method_def, start_protocol, build_method_decl, objc_add_method, add_instance_variable, build_ivar_reference, is_ivar, is_private, get_super_receiver, objc_build_finally_epilogue): Make into static functions. (receiver_is_class_object): Use new IS_CLASS() macro. (objc_build_message_expr): Tweak ObjC++ message argument handling; call objc_finish_message_expr() instead of finish_message_expr(). (finish_message_expr): Rename to objc_finish_message_expr(); use OBJC_TYPE_NAME and OBJC_SET_TYPE_NAME macros instead of TYPE_NAME. call gen_type_name() instead of gen_declaration(); call objc_is_id() instead of using IS_ID and IS_CLASS; Use objc_class_name instead of calling get_identifier("Class"); handle CONVERT_EXPRs in receiver. (build_objc_method_call, warn_with_method): Do not call groktypename(). (build_ivar_reference): Call convert() instead of clobbering in a type. (hash_init): Initialize string_htab hash table. (add_instance_variable): Simplify parameter list; do not call grokfield(); do not populate CLASS_IVARS list. (start_class): Check for the existence of super class, if one was specified. (continue_class): Use CLASS_RAW_IVARS rather than CLASS_IVARS; do not call build_class_template(); adjust call to get_class_ivars(); call build_decl(), pushdecl() and finish_decl() instead of define_decl(). (finish_class): Call build_decl(), pushdecl() and finish_decl() instead of define_decl(). (add_protocols): Use PROTOCOL_BINFO_ELTS for the tree vector size. (start_protocol): Do not call build_protocol_template(); use PROTOCOL_BINFO_ELTS for the tree vector size. (encode_type_qualifiers): Do not handle the 'const' qualifier here. (encode_pointer): Encode 'const char *' as 'r*', for backwards compatibility. (encode_array): Use HOST_WIDE_INT_PRINT_DEC instead of "%ld". (encode_type): Handle the 'const' qualifier here. (objc_parmlist): New global variable, sued by objc_push_parm and objc_get_parm_info(). (objc_push_parm, objc_get_parm_info): New functions. (objc_expr_last): Remove function. (synth_self_and_ucmd_args): For instance methods, use the instance type for 'self'; call objc_push_parm() instead of push_parm_decl(). (start_method_def): Do not call push_scope(), declare_parm_level(), pop_scope(), push_parm_decl(), store_parm_decls() or objc_expr_last(); just use objc_push_parm() and objc_get_parm_info(). (comp_method_with_proto): Remove function. (objc_types_are_equivalent): Strip away indirections before comparing underlying types. (comp_proto_with_proto): Do not call groktypename(); types are no longer in raw declspec format. (objc_start_function): New function. (really_start_method): Call comp_proto_with_proto() instead of comp_method_with_proto(); call objc_start_function() instead of hand-crafting a function declarator. (continue_method_def, objc_expand_function_end): Remove functions. (get_super_receiver): Call objc_get_current_scope() instead of get_current_scope(); reference 'super_class' field (instead of 'class'). (finish_method_def): Rename to objc_finish_method_definition() and add a function decl parameter; move method encoding call from objc_expand_function_end(). (is_complex_decl, adorn_decl, gen_declarator, gen_declspecs, gen_declaration_1): Remove functions. (tmpbuf, RAW_DECLSPEC): Remove. (gen_declaration): Remove second parameter; simplify to deal with TYPE_P nodes instead of raw declspecs. (gen_type_name, gen_type_name_0): New functions. (gen_method_decl): Remove second parameter; call gen_type_name() instead of gen_declaration_1(). (dump_interface): Adjust calls to gen_declaration() and gen_method_decl(); do not allocate a separate string buffer. (init_objc): Allocate a larger string buffer to accommodate dump_interface(); adjust call to build_module_descriptor(); add call to build_module_initializer_routine() for the GNU runtime. (generate_classref_translation_entry): Do not call start_decl(); call finish_var_decl() instead of finish_decl(); call convert() instead of build_c_cast(). * objc-act.h (CLASS_OWN_IVARS): Remove accessor. (CLASS_BINFO_ELTS): Reduce from 6 to 5, now that CLASS_OWN_IVARS is gone. (OCTI_GNU_INIT_DECL, GNU_INIT_decl): New. (OCTI_ELLIPSIS_NODE, objc_ellipsis_node): Remove. (OCTI_ID_ID, id_type, objc_id_id): Rename to OCTI_ID_NAME, objc_object_type and objc_object_name, respectively. (OCTI_CLS_REF, OCTI_CLASS_NAME, objc_class_reference, objc_class_name): New. (IS_CLASS): New macro. (IS_ID, IS_SUPER): Robustify. (OCTI_EXECCLASS_DECL, execclass_decl): New. (finish_file, start_class, continue_class, finish_class, start_method_def, continue_method_def, finish_method_def, start_protocol, finish_protocol, objc_build_throw_stmt, objc_build_try_catch_finally_stmt, objc_build_synchronized_prologue, objc_build_synchronized_epilogue, objc_build_try_prologue, objc_build_try_epilogue, objc_build_catch_stmt, objc_build_catch_epilogue, objc_build_finally_prologue, objc_build_finally_epilogue, is_ivar, is_private, is_public, add_instance_variable, objc_add_method, get_super_receiver, objc_clear_super_receiver, get_class_ivars_from_name, get_class_reference, get_static_reference, get_object_reference, build_message_expr, finish_message_expr, build_selector_expr, build_ivar_reference, build_keyword_decl, build_method_decl, build_protocol_expr, build_objc_string_object, objc_declare_alias, objc_declare_class, objc_declare_protocols, objc_comptypes, objc_check_decl, build_encode_expr): Remove prototypes. (imp_count, cat_count): Make GGC-aware. (OBJC_SET_TYPE_NAME): New macro. From-SVN: r87168
2004-09-08 02:49:44 +02:00
strcat (errbuf, " ");
1992-01-18 00:15:38 +01:00
if (POINTER_TYPE_P (type))
strcat (errbuf, "*");
else
while (type != inner)
{
strcat (errbuf, "[");
if (TYPE_DOMAIN (type))
{
char sz[20];
sprintf (sz, HOST_WIDE_INT_PRINT_DEC,
(TREE_INT_CST_LOW
(TYPE_MAX_VALUE (TYPE_DOMAIN (type))) + 1));
strcat (errbuf, sz);
}
strcat (errbuf, "]");
type = TREE_TYPE (type);
}
Makefile.in (c-parse.o): Depend on $(C_COMMON_H). [gcc/ChangeLog] 2004-09-07 Ziemowit Laski <zlaski@apple.com> * Makefile.in (c-parse.o): Depend on $(C_COMMON_H). * c-parse.in: Include c-common.h instead of objc-act.h. (ivar_decl_list, ivar_decls, ivar_decl, ivars, ivar_declarator, myparms, myparm): Remove %type declarations. (methodtype, optparms, OBJC_TYPE_QUAL, objc_quals, objc_qual, objc_typename, objc_try_catch_stmt, optellipsis): Add %type declarations. (objc_inherit_code, objc_public_flag): Remove. (typespec_nonreserved_nonattr): Call objc_get_protocol_qualified_type() instead of get_static_reference() and get_protocol_reference(). (stmt_nocomp): Call grokparm() on @catch parameter. (objcdef): Move semantic action to objc_finish_implementation(). (classdef): Move semantic action to objc_start_class_interface(), objc_continue_interface(), objc_finish_interface(), objc_start_class_implementation(), objc_continue_implementation(), objc_start_category_interface() and objc_start_category_implementation(). (protocoldef): Move semantic actions to objc_start_protocol() and objc_finish_interface(). (ivar_decl_list): Remove nonterminal. (visibility_spec): Move semantic actions to objc_set_visibility(). (ivar_decls): Remove assignment to $$. (ivar_decl): Rephrase in terms of component_decl; call objc_add_instance_variable(). (ivars, ivar_declarator): Remove nonterminals. (opt_semi): New nonterminal. (methodtype): Remove semantic actions. (methoddef): Move semantic actions to objc_set_method_type(), objc_start_method_definition() and objc_finish_method_definition(). (methodproto): Move semantic actions to objc_set_method_type() and objc_add_method_declaration(). (methoddecl): Use objc_typename instead of typename; move semantic actions to objc_build_method_signature(). (optarglist, myxdecls, mydecl, myparms, myparm): Remove nonterminals. (optparmlist): Express in terms of optparms and optellipsis. (optparms, optellipsis, objc_qual, objc_quals, objc_typename): New nonterminals. (keyworddecl): Use objc_typename instead of typename. (rid_to_yy): Mark RID_IN, RID_OUT, RID_INOUT, RID_BYCOPY, RID_BYREF and RID_ONEWAY as returning OBJC_TYPE_QUAL to yyparse(). [gcc/objc/ChangeLog] 2004-09-07 Ziemowit Laski <zlaski@apple.com> * Make-lang.in (objc/objc-parse.o): Depend on $(C_COMMON_H) instead of objc/objc-act.h. (objc/objc-act.o): Depend on $(HASHTAB_H). * objc-act.c: Include hashtab.h; in ObjC++ mode, include cp-tree.h and objcp-decl.h instead of c-tree.h. (build_module_descriptor, get_class_ivars, synth_id_with_class_suffix, error_with_ivar, gen_method_decl, gen_declaration, setup_string_decl, build_protocol_template): Adjust prototypes. (build_module_initializer_routine, start_class, continue_class, finish_class, start_method_def, objc_start_function, start_protocol, build_method_decl, objc_add_method, add_instance_variable, build_ivar_reference, is_ivar, is_private, get_super_receiver, build_selector_table_decl, objc_push_parm, objc_get_parm_info, gen_type_name, gen_type_name_0, start_var_decl, finish_var_decl, create_field_decl): New prototypes. (objc_expand_function_end, comp_method_with_proto, objc_expr_last, gen_declaration_1, gen_declarator, is_complex_decl, adorn_decl, define_decl, create_builtin_decl, gen_declspecs): Remove prototypes. (TYPE_ID): Rename to OBJECT_TYPEDEF_NAME. (CLASS_TYPEDEF_NAME): New. (TAG_EXECCLASS): Change from a global variable to a #define. (TAG_RETURN_STRUCT): Delete. (TAG_GNUINIT): New, holds '__objc_gnu_init' name. (objc_inherit_code, objc_public_flag): New, moved from c-parse.in. (string_descriptor): New struct. (string_htab): New hash table. (string_hash, string_eq): New prototypes. (generate_struct_by_value_array): Call create_field_decl() instead of create_builtin_decl(). (objc_init): Do not initialize objc_ellipsis_node or TAG_EXECCLASS; In ObjC++ mode, call cxx_init() instead of c_objc_common_init(). (objc_finish_file): In ObjC++, call instantiate_pending_templates() and cp_finish_file(). (define_decl, get_static_reference, get_protocol_reference, create_builtin_decl): Remove functions. (objc_start_class_interface, objc_start_category_interface, objc_start_protocol, objc_continue_interface, objc_finish_interface, objc_start_class_implementation, objc_start_category_implementation, objc_continue_implementation, objc_finish_implementation, objc_set_visibility, objc_set_method_type, objc_build_method_signature, objc_add_method_declaration, objc_start_method_definition, objc_add_instance_variable, objc_get_protocol_qualified_type, create_field_decl, start_var_decl, finish_var_decl): New functions. (setup_string_decl): Simplify since it is only called once. (synth_module_prologue): Call build_class_template(); predefine 'id' and 'Class' as typedefs; rename 'temp_type' to 'type'; disable debug hooks for duration of function; fix GNU runtime messenger signatures to correspond to reality; forward-declare '__objc_exec_class' for the GNU runtime; call build_selector_table_decl(); in ObjC++ mode, generate 'extern "C" { ... }' wrappers around synthesized declarations; call build_protocol_template() and build_category_template(). (string_hash, string_eq): New functions. (objc_build_string_object): Check metaclass correctness only once; store string literals in hash table. (objc_build_constructor): Do not convert initializer elements; adjust for ObjC++ impedance mismatch. (build_objc_symtab_template): Call create_field_decl() instead of create_builtin_decl(). (init_objc_symtab): Add missing conversion to initializer element. (build_metadata_decl): Call start_var_decl() instead of define_decl(). (generate_objc_symtab_decl): Do not call build_category_template(); call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(). (build_module_descriptor): Call create_field_decl() instead of grokfield(); call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(); always mark module descriptor as used; move GNU runtime-specific functionality to build_module_initializer_routine(). (build_module_initializer_routine): New function, broken off of build_module_descriptor(). (objc_static_init_needed_p, objc_generate_static_init_call): New functions. (generate_static_references, generate_strings, build_selector_translation_table, generate_descriptor_table, generate_ivars_list, generate_dispatch_table, generate_category): Call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(); build a type directly instead of via groktypename(). (build_selector_reference_decl, build_selector_table_decl, build_class_reference_decl, build_protocol_reference, generate_objc_image_info): Call start_var_decl() instead of build_decl(). (build_selector_reference): For GNU runtime, do not call build_selector_reference_decl(). (build_selector, build_typed_selector_reference): Always convert result to the selector type. (add_objc_string): Cast return value to 'char *'. (build_method_prototype_template, build_selector_template, build_method_template): Use actual selector type for fields pointing to selectors. (finish_objc): For GNU runtime, call build_module_initializer_routine() after build_module_descriptor(). (generate_protocol_list, generate_shared_structures): Call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(); build a type directly instead of via groktypename(). (synth_id_with_class_suffix): Return a string. (get_arg_type_list): For instance methods, use the instance type for 'self'; do not call groktypename_in_parm_context(). (build_objc_string_decl): Squash redeclaration errors in ObjC++. (objc_is_class_name): Use OBJC_TYPE_NAME instead of TYPE_NAME; handle RECORD_TYPEs in ObjC as well as ObjC++. (objc_is_id): New function. (objc_is_object_ptr): Return the canonical type node. (objc_get_class_ivars): Simplify using get_class_ivars(). (get_class_ivars): Remove second parameter; create a fresh copy of the ivar list for each call; do not check for existence of super class. (objc_eh_runtime_type): Mark #ifndef OBJCPLUS. (objc_init_exceptions): When using SJLJ-style exceptions, require the use of '-fobjc-exceptions' flag; do not require it for DWARF-style exceptions. (objc_build_exc_ptr, next_sjlj_build_try_catch_finally): Use objc_object_type instead of objc_id_type. (objc_begin_catch_clause): Convert the incoming PARM_DECL into a VAR_DECL before placing it in the appropriate scope; do not call define_decl(); adjust call to c_begin_compound_stmt(); use objc_object_type instead of objc_id_type. (build_next_objc_exception_stuff): Call create_field_decl() instead of create_builtin_decl(); construct type directly instead of calling groktypename(); use OBJC_VOID_AT_END to mark end of function parameters. (build_private_template): Adjust call to get_class_ivars(); build a type directly instead of via groktypename(). (build_protocol_template, build_method_prototype_list_template, build_method_prototype_template, build_category_template, build_selector_template, build_class_template, build_super_template, build_ivar_template, build_ivar_list_template, build_method_list_template, build_method_template): Call create_field_decl() instead of grokfield(). (objc_method_parm_type): Do not call groktypename(). (generate_descriptor_table): Call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(). (generate_method_descriptors, build_protocol_initializer, generate_dispatch_tables, build_category_initializer, build_shared_structure_initializer): Do not call groktypename(). (generate_protocols): Call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(); do not call groktypename(). (error_with_ivar): Remove last parameter. (check_ivars): Do not iterate ovar CLASS_RAW_IVARS lists in addition to CLASS_IVARS lists; adjust calls to error_with_ivar(). (generate_ivar_lists): Convert one of the initializer elements; do not call groktypename(). (get_arg_type_list, start_method_def, gen_method_def): Account for new representation of variable arguments and '...' in Objective-C methods; add Objective-C++ impedance matching code. (is_objc_type_qualifier): Remove function. (adjust_type_for_id_default): Simplify; there is no longer a need to wade through declspecs. (lookup_interface, start_class, continue_class, finish_class, start_method_def, start_protocol, build_method_decl, objc_add_method, add_instance_variable, build_ivar_reference, is_ivar, is_private, get_super_receiver, objc_build_finally_epilogue): Make into static functions. (receiver_is_class_object): Use new IS_CLASS() macro. (objc_build_message_expr): Tweak ObjC++ message argument handling; call objc_finish_message_expr() instead of finish_message_expr(). (finish_message_expr): Rename to objc_finish_message_expr(); use OBJC_TYPE_NAME and OBJC_SET_TYPE_NAME macros instead of TYPE_NAME. call gen_type_name() instead of gen_declaration(); call objc_is_id() instead of using IS_ID and IS_CLASS; Use objc_class_name instead of calling get_identifier("Class"); handle CONVERT_EXPRs in receiver. (build_objc_method_call, warn_with_method): Do not call groktypename(). (build_ivar_reference): Call convert() instead of clobbering in a type. (hash_init): Initialize string_htab hash table. (add_instance_variable): Simplify parameter list; do not call grokfield(); do not populate CLASS_IVARS list. (start_class): Check for the existence of super class, if one was specified. (continue_class): Use CLASS_RAW_IVARS rather than CLASS_IVARS; do not call build_class_template(); adjust call to get_class_ivars(); call build_decl(), pushdecl() and finish_decl() instead of define_decl(). (finish_class): Call build_decl(), pushdecl() and finish_decl() instead of define_decl(). (add_protocols): Use PROTOCOL_BINFO_ELTS for the tree vector size. (start_protocol): Do not call build_protocol_template(); use PROTOCOL_BINFO_ELTS for the tree vector size. (encode_type_qualifiers): Do not handle the 'const' qualifier here. (encode_pointer): Encode 'const char *' as 'r*', for backwards compatibility. (encode_array): Use HOST_WIDE_INT_PRINT_DEC instead of "%ld". (encode_type): Handle the 'const' qualifier here. (objc_parmlist): New global variable, sued by objc_push_parm and objc_get_parm_info(). (objc_push_parm, objc_get_parm_info): New functions. (objc_expr_last): Remove function. (synth_self_and_ucmd_args): For instance methods, use the instance type for 'self'; call objc_push_parm() instead of push_parm_decl(). (start_method_def): Do not call push_scope(), declare_parm_level(), pop_scope(), push_parm_decl(), store_parm_decls() or objc_expr_last(); just use objc_push_parm() and objc_get_parm_info(). (comp_method_with_proto): Remove function. (objc_types_are_equivalent): Strip away indirections before comparing underlying types. (comp_proto_with_proto): Do not call groktypename(); types are no longer in raw declspec format. (objc_start_function): New function. (really_start_method): Call comp_proto_with_proto() instead of comp_method_with_proto(); call objc_start_function() instead of hand-crafting a function declarator. (continue_method_def, objc_expand_function_end): Remove functions. (get_super_receiver): Call objc_get_current_scope() instead of get_current_scope(); reference 'super_class' field (instead of 'class'). (finish_method_def): Rename to objc_finish_method_definition() and add a function decl parameter; move method encoding call from objc_expand_function_end(). (is_complex_decl, adorn_decl, gen_declarator, gen_declspecs, gen_declaration_1): Remove functions. (tmpbuf, RAW_DECLSPEC): Remove. (gen_declaration): Remove second parameter; simplify to deal with TYPE_P nodes instead of raw declspecs. (gen_type_name, gen_type_name_0): New functions. (gen_method_decl): Remove second parameter; call gen_type_name() instead of gen_declaration_1(). (dump_interface): Adjust calls to gen_declaration() and gen_method_decl(); do not allocate a separate string buffer. (init_objc): Allocate a larger string buffer to accommodate dump_interface(); adjust call to build_module_descriptor(); add call to build_module_initializer_routine() for the GNU runtime. (generate_classref_translation_entry): Do not call start_decl(); call finish_var_decl() instead of finish_decl(); call convert() instead of build_c_cast(). * objc-act.h (CLASS_OWN_IVARS): Remove accessor. (CLASS_BINFO_ELTS): Reduce from 6 to 5, now that CLASS_OWN_IVARS is gone. (OCTI_GNU_INIT_DECL, GNU_INIT_decl): New. (OCTI_ELLIPSIS_NODE, objc_ellipsis_node): Remove. (OCTI_ID_ID, id_type, objc_id_id): Rename to OCTI_ID_NAME, objc_object_type and objc_object_name, respectively. (OCTI_CLS_REF, OCTI_CLASS_NAME, objc_class_reference, objc_class_name): New. (IS_CLASS): New macro. (IS_ID, IS_SUPER): Robustify. (OCTI_EXECCLASS_DECL, execclass_decl): New. (finish_file, start_class, continue_class, finish_class, start_method_def, continue_method_def, finish_method_def, start_protocol, finish_protocol, objc_build_throw_stmt, objc_build_try_catch_finally_stmt, objc_build_synchronized_prologue, objc_build_synchronized_epilogue, objc_build_try_prologue, objc_build_try_epilogue, objc_build_catch_stmt, objc_build_catch_epilogue, objc_build_finally_prologue, objc_build_finally_epilogue, is_ivar, is_private, is_public, add_instance_variable, objc_add_method, get_super_receiver, objc_clear_super_receiver, get_class_ivars_from_name, get_class_reference, get_static_reference, get_object_reference, build_message_expr, finish_message_expr, build_selector_expr, build_ivar_reference, build_keyword_decl, build_method_decl, build_protocol_expr, build_objc_string_object, objc_declare_alias, objc_declare_class, objc_declare_protocols, objc_comptypes, objc_check_decl, build_encode_expr): Remove prototypes. (imp_count, cat_count): Make GGC-aware. (OBJC_SET_TYPE_NAME): New macro. From-SVN: r87168
2004-09-08 02:49:44 +02:00
goto exit_function;
1992-01-18 00:15:38 +01:00
}
Makefile.in (c-parse.o): Depend on $(C_COMMON_H). [gcc/ChangeLog] 2004-09-07 Ziemowit Laski <zlaski@apple.com> * Makefile.in (c-parse.o): Depend on $(C_COMMON_H). * c-parse.in: Include c-common.h instead of objc-act.h. (ivar_decl_list, ivar_decls, ivar_decl, ivars, ivar_declarator, myparms, myparm): Remove %type declarations. (methodtype, optparms, OBJC_TYPE_QUAL, objc_quals, objc_qual, objc_typename, objc_try_catch_stmt, optellipsis): Add %type declarations. (objc_inherit_code, objc_public_flag): Remove. (typespec_nonreserved_nonattr): Call objc_get_protocol_qualified_type() instead of get_static_reference() and get_protocol_reference(). (stmt_nocomp): Call grokparm() on @catch parameter. (objcdef): Move semantic action to objc_finish_implementation(). (classdef): Move semantic action to objc_start_class_interface(), objc_continue_interface(), objc_finish_interface(), objc_start_class_implementation(), objc_continue_implementation(), objc_start_category_interface() and objc_start_category_implementation(). (protocoldef): Move semantic actions to objc_start_protocol() and objc_finish_interface(). (ivar_decl_list): Remove nonterminal. (visibility_spec): Move semantic actions to objc_set_visibility(). (ivar_decls): Remove assignment to $$. (ivar_decl): Rephrase in terms of component_decl; call objc_add_instance_variable(). (ivars, ivar_declarator): Remove nonterminals. (opt_semi): New nonterminal. (methodtype): Remove semantic actions. (methoddef): Move semantic actions to objc_set_method_type(), objc_start_method_definition() and objc_finish_method_definition(). (methodproto): Move semantic actions to objc_set_method_type() and objc_add_method_declaration(). (methoddecl): Use objc_typename instead of typename; move semantic actions to objc_build_method_signature(). (optarglist, myxdecls, mydecl, myparms, myparm): Remove nonterminals. (optparmlist): Express in terms of optparms and optellipsis. (optparms, optellipsis, objc_qual, objc_quals, objc_typename): New nonterminals. (keyworddecl): Use objc_typename instead of typename. (rid_to_yy): Mark RID_IN, RID_OUT, RID_INOUT, RID_BYCOPY, RID_BYREF and RID_ONEWAY as returning OBJC_TYPE_QUAL to yyparse(). [gcc/objc/ChangeLog] 2004-09-07 Ziemowit Laski <zlaski@apple.com> * Make-lang.in (objc/objc-parse.o): Depend on $(C_COMMON_H) instead of objc/objc-act.h. (objc/objc-act.o): Depend on $(HASHTAB_H). * objc-act.c: Include hashtab.h; in ObjC++ mode, include cp-tree.h and objcp-decl.h instead of c-tree.h. (build_module_descriptor, get_class_ivars, synth_id_with_class_suffix, error_with_ivar, gen_method_decl, gen_declaration, setup_string_decl, build_protocol_template): Adjust prototypes. (build_module_initializer_routine, start_class, continue_class, finish_class, start_method_def, objc_start_function, start_protocol, build_method_decl, objc_add_method, add_instance_variable, build_ivar_reference, is_ivar, is_private, get_super_receiver, build_selector_table_decl, objc_push_parm, objc_get_parm_info, gen_type_name, gen_type_name_0, start_var_decl, finish_var_decl, create_field_decl): New prototypes. (objc_expand_function_end, comp_method_with_proto, objc_expr_last, gen_declaration_1, gen_declarator, is_complex_decl, adorn_decl, define_decl, create_builtin_decl, gen_declspecs): Remove prototypes. (TYPE_ID): Rename to OBJECT_TYPEDEF_NAME. (CLASS_TYPEDEF_NAME): New. (TAG_EXECCLASS): Change from a global variable to a #define. (TAG_RETURN_STRUCT): Delete. (TAG_GNUINIT): New, holds '__objc_gnu_init' name. (objc_inherit_code, objc_public_flag): New, moved from c-parse.in. (string_descriptor): New struct. (string_htab): New hash table. (string_hash, string_eq): New prototypes. (generate_struct_by_value_array): Call create_field_decl() instead of create_builtin_decl(). (objc_init): Do not initialize objc_ellipsis_node or TAG_EXECCLASS; In ObjC++ mode, call cxx_init() instead of c_objc_common_init(). (objc_finish_file): In ObjC++, call instantiate_pending_templates() and cp_finish_file(). (define_decl, get_static_reference, get_protocol_reference, create_builtin_decl): Remove functions. (objc_start_class_interface, objc_start_category_interface, objc_start_protocol, objc_continue_interface, objc_finish_interface, objc_start_class_implementation, objc_start_category_implementation, objc_continue_implementation, objc_finish_implementation, objc_set_visibility, objc_set_method_type, objc_build_method_signature, objc_add_method_declaration, objc_start_method_definition, objc_add_instance_variable, objc_get_protocol_qualified_type, create_field_decl, start_var_decl, finish_var_decl): New functions. (setup_string_decl): Simplify since it is only called once. (synth_module_prologue): Call build_class_template(); predefine 'id' and 'Class' as typedefs; rename 'temp_type' to 'type'; disable debug hooks for duration of function; fix GNU runtime messenger signatures to correspond to reality; forward-declare '__objc_exec_class' for the GNU runtime; call build_selector_table_decl(); in ObjC++ mode, generate 'extern "C" { ... }' wrappers around synthesized declarations; call build_protocol_template() and build_category_template(). (string_hash, string_eq): New functions. (objc_build_string_object): Check metaclass correctness only once; store string literals in hash table. (objc_build_constructor): Do not convert initializer elements; adjust for ObjC++ impedance mismatch. (build_objc_symtab_template): Call create_field_decl() instead of create_builtin_decl(). (init_objc_symtab): Add missing conversion to initializer element. (build_metadata_decl): Call start_var_decl() instead of define_decl(). (generate_objc_symtab_decl): Do not call build_category_template(); call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(). (build_module_descriptor): Call create_field_decl() instead of grokfield(); call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(); always mark module descriptor as used; move GNU runtime-specific functionality to build_module_initializer_routine(). (build_module_initializer_routine): New function, broken off of build_module_descriptor(). (objc_static_init_needed_p, objc_generate_static_init_call): New functions. (generate_static_references, generate_strings, build_selector_translation_table, generate_descriptor_table, generate_ivars_list, generate_dispatch_table, generate_category): Call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(); build a type directly instead of via groktypename(). (build_selector_reference_decl, build_selector_table_decl, build_class_reference_decl, build_protocol_reference, generate_objc_image_info): Call start_var_decl() instead of build_decl(). (build_selector_reference): For GNU runtime, do not call build_selector_reference_decl(). (build_selector, build_typed_selector_reference): Always convert result to the selector type. (add_objc_string): Cast return value to 'char *'. (build_method_prototype_template, build_selector_template, build_method_template): Use actual selector type for fields pointing to selectors. (finish_objc): For GNU runtime, call build_module_initializer_routine() after build_module_descriptor(). (generate_protocol_list, generate_shared_structures): Call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(); build a type directly instead of via groktypename(). (synth_id_with_class_suffix): Return a string. (get_arg_type_list): For instance methods, use the instance type for 'self'; do not call groktypename_in_parm_context(). (build_objc_string_decl): Squash redeclaration errors in ObjC++. (objc_is_class_name): Use OBJC_TYPE_NAME instead of TYPE_NAME; handle RECORD_TYPEs in ObjC as well as ObjC++. (objc_is_id): New function. (objc_is_object_ptr): Return the canonical type node. (objc_get_class_ivars): Simplify using get_class_ivars(). (get_class_ivars): Remove second parameter; create a fresh copy of the ivar list for each call; do not check for existence of super class. (objc_eh_runtime_type): Mark #ifndef OBJCPLUS. (objc_init_exceptions): When using SJLJ-style exceptions, require the use of '-fobjc-exceptions' flag; do not require it for DWARF-style exceptions. (objc_build_exc_ptr, next_sjlj_build_try_catch_finally): Use objc_object_type instead of objc_id_type. (objc_begin_catch_clause): Convert the incoming PARM_DECL into a VAR_DECL before placing it in the appropriate scope; do not call define_decl(); adjust call to c_begin_compound_stmt(); use objc_object_type instead of objc_id_type. (build_next_objc_exception_stuff): Call create_field_decl() instead of create_builtin_decl(); construct type directly instead of calling groktypename(); use OBJC_VOID_AT_END to mark end of function parameters. (build_private_template): Adjust call to get_class_ivars(); build a type directly instead of via groktypename(). (build_protocol_template, build_method_prototype_list_template, build_method_prototype_template, build_category_template, build_selector_template, build_class_template, build_super_template, build_ivar_template, build_ivar_list_template, build_method_list_template, build_method_template): Call create_field_decl() instead of grokfield(). (objc_method_parm_type): Do not call groktypename(). (generate_descriptor_table): Call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(). (generate_method_descriptors, build_protocol_initializer, generate_dispatch_tables, build_category_initializer, build_shared_structure_initializer): Do not call groktypename(). (generate_protocols): Call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(); do not call groktypename(). (error_with_ivar): Remove last parameter. (check_ivars): Do not iterate ovar CLASS_RAW_IVARS lists in addition to CLASS_IVARS lists; adjust calls to error_with_ivar(). (generate_ivar_lists): Convert one of the initializer elements; do not call groktypename(). (get_arg_type_list, start_method_def, gen_method_def): Account for new representation of variable arguments and '...' in Objective-C methods; add Objective-C++ impedance matching code. (is_objc_type_qualifier): Remove function. (adjust_type_for_id_default): Simplify; there is no longer a need to wade through declspecs. (lookup_interface, start_class, continue_class, finish_class, start_method_def, start_protocol, build_method_decl, objc_add_method, add_instance_variable, build_ivar_reference, is_ivar, is_private, get_super_receiver, objc_build_finally_epilogue): Make into static functions. (receiver_is_class_object): Use new IS_CLASS() macro. (objc_build_message_expr): Tweak ObjC++ message argument handling; call objc_finish_message_expr() instead of finish_message_expr(). (finish_message_expr): Rename to objc_finish_message_expr(); use OBJC_TYPE_NAME and OBJC_SET_TYPE_NAME macros instead of TYPE_NAME. call gen_type_name() instead of gen_declaration(); call objc_is_id() instead of using IS_ID and IS_CLASS; Use objc_class_name instead of calling get_identifier("Class"); handle CONVERT_EXPRs in receiver. (build_objc_method_call, warn_with_method): Do not call groktypename(). (build_ivar_reference): Call convert() instead of clobbering in a type. (hash_init): Initialize string_htab hash table. (add_instance_variable): Simplify parameter list; do not call grokfield(); do not populate CLASS_IVARS list. (start_class): Check for the existence of super class, if one was specified. (continue_class): Use CLASS_RAW_IVARS rather than CLASS_IVARS; do not call build_class_template(); adjust call to get_class_ivars(); call build_decl(), pushdecl() and finish_decl() instead of define_decl(). (finish_class): Call build_decl(), pushdecl() and finish_decl() instead of define_decl(). (add_protocols): Use PROTOCOL_BINFO_ELTS for the tree vector size. (start_protocol): Do not call build_protocol_template(); use PROTOCOL_BINFO_ELTS for the tree vector size. (encode_type_qualifiers): Do not handle the 'const' qualifier here. (encode_pointer): Encode 'const char *' as 'r*', for backwards compatibility. (encode_array): Use HOST_WIDE_INT_PRINT_DEC instead of "%ld". (encode_type): Handle the 'const' qualifier here. (objc_parmlist): New global variable, sued by objc_push_parm and objc_get_parm_info(). (objc_push_parm, objc_get_parm_info): New functions. (objc_expr_last): Remove function. (synth_self_and_ucmd_args): For instance methods, use the instance type for 'self'; call objc_push_parm() instead of push_parm_decl(). (start_method_def): Do not call push_scope(), declare_parm_level(), pop_scope(), push_parm_decl(), store_parm_decls() or objc_expr_last(); just use objc_push_parm() and objc_get_parm_info(). (comp_method_with_proto): Remove function. (objc_types_are_equivalent): Strip away indirections before comparing underlying types. (comp_proto_with_proto): Do not call groktypename(); types are no longer in raw declspec format. (objc_start_function): New function. (really_start_method): Call comp_proto_with_proto() instead of comp_method_with_proto(); call objc_start_function() instead of hand-crafting a function declarator. (continue_method_def, objc_expand_function_end): Remove functions. (get_super_receiver): Call objc_get_current_scope() instead of get_current_scope(); reference 'super_class' field (instead of 'class'). (finish_method_def): Rename to objc_finish_method_definition() and add a function decl parameter; move method encoding call from objc_expand_function_end(). (is_complex_decl, adorn_decl, gen_declarator, gen_declspecs, gen_declaration_1): Remove functions. (tmpbuf, RAW_DECLSPEC): Remove. (gen_declaration): Remove second parameter; simplify to deal with TYPE_P nodes instead of raw declspecs. (gen_type_name, gen_type_name_0): New functions. (gen_method_decl): Remove second parameter; call gen_type_name() instead of gen_declaration_1(). (dump_interface): Adjust calls to gen_declaration() and gen_method_decl(); do not allocate a separate string buffer. (init_objc): Allocate a larger string buffer to accommodate dump_interface(); adjust call to build_module_descriptor(); add call to build_module_initializer_routine() for the GNU runtime. (generate_classref_translation_entry): Do not call start_decl(); call finish_var_decl() instead of finish_decl(); call convert() instead of build_c_cast(). * objc-act.h (CLASS_OWN_IVARS): Remove accessor. (CLASS_BINFO_ELTS): Reduce from 6 to 5, now that CLASS_OWN_IVARS is gone. (OCTI_GNU_INIT_DECL, GNU_INIT_decl): New. (OCTI_ELLIPSIS_NODE, objc_ellipsis_node): Remove. (OCTI_ID_ID, id_type, objc_id_id): Rename to OCTI_ID_NAME, objc_object_type and objc_object_name, respectively. (OCTI_CLS_REF, OCTI_CLASS_NAME, objc_class_reference, objc_class_name): New. (IS_CLASS): New macro. (IS_ID, IS_SUPER): Robustify. (OCTI_EXECCLASS_DECL, execclass_decl): New. (finish_file, start_class, continue_class, finish_class, start_method_def, continue_method_def, finish_method_def, start_protocol, finish_protocol, objc_build_throw_stmt, objc_build_try_catch_finally_stmt, objc_build_synchronized_prologue, objc_build_synchronized_epilogue, objc_build_try_prologue, objc_build_try_epilogue, objc_build_catch_stmt, objc_build_catch_epilogue, objc_build_finally_prologue, objc_build_finally_epilogue, is_ivar, is_private, is_public, add_instance_variable, objc_add_method, get_super_receiver, objc_clear_super_receiver, get_class_ivars_from_name, get_class_reference, get_static_reference, get_object_reference, build_message_expr, finish_message_expr, build_selector_expr, build_ivar_reference, build_keyword_decl, build_method_decl, build_protocol_expr, build_objc_string_object, objc_declare_alias, objc_declare_class, objc_declare_protocols, objc_comptypes, objc_check_decl, build_encode_expr): Remove prototypes. (imp_count, cat_count): Make GGC-aware. (OBJC_SET_TYPE_NAME): New macro. From-SVN: r87168
2004-09-08 02:49:44 +02:00
if (TREE_CODE (type) == TYPE_DECL && DECL_NAME (type))
type = DECL_NAME (type);
1992-01-18 00:15:38 +01:00
strcat (errbuf, TREE_CODE (type) == IDENTIFIER_NODE
? IDENTIFIER_POINTER (type)
: "");
objc-act.c (build_private_template): Change to return 'void'... [gcc/objc/ChangeLog] 2004-12-15 Ziemowit Laski <zlaski@apple.com> * objc-act.c (build_private_template): Change to return 'void'; do not set ivar_context, uprivate_record or objc_instance_type. (objc_comptypes, gen_type_name_0): For types 'id' and 'Class', retrieve protocol list from the pointee rather than the pointer itself; check TYPE_HAS_OBJC_INFO(...) precondition before accessing TYPE_OBJC_PROTOCOL_LIST. (objc_get_protocol_qualified_type): For types 'id' and 'Class', construct a variant of the pointee as well as the pointer, and store protocol information in the former. When creating variants of RECORD_TYPEs, clone their TYPE_LANG_SPECIFIC fields and propagate TYPE_OBJC_INTERFACE information. (objc_declare_class): If a TYPE_DECL is looked up, retrieve the underlying RECORD_TYPE to check for presence of TYPE_OBJC_INTERFACE; for newly-created RECORD_TYPEs, create a tentative TYPE_OBJC_INTERFACE holding an IDENTIFIER_NODE. (objc_finish_message_expr): Check TYPE_HAS_OBJC_INFO(...) before accessing TYPE_OBJC_PROTOCOL_LIST; Use TYPE_OBJC_INTERFACE instead of calling lookup_interface(); allow for TYPE_OBJC_INTERFACE holding an IDENTIFIER_NODE (meaning a @class forward-declaration only). (objc_is_public): Check TYPE_OBJC_INTERFACE instead of calling lookup_interface(). (continue_class): For @implementations, set ivar_context, uprivate_record and objc_instance_type, for @interfaces, call build_private_template(). (encode_pointer): Check TYPE_HAS_OBJC_INFO(...) before accessing TYPE_OBJC_INTERFACE. (objc_types_are_equivalent): Check TYPE_HAS_OBJC_INFO(...) before accessing TYPE_OBJC_PROTOCOL_LIST. * objc-act.h (OBJC_INFO_SLOT_ELTS, TYPE_OBJC_INFO, INIT_TYPE_OBJC_INFO, DUP_TYPE_OBJC_INFO, ALLOC_OBJC_TYPE_LANG_SPECIFIC, SIZEOF_OBJC_TYPE_LANG_SPECIFIC): New macros. (TYPE_OBJC_INTERFACE): Replaces TREE_STATIC_INSTANCE and now points to an actual @interface; stored in TYPE_LANG_SPECIFIC(...). (TYPE_OBJC_PROTOCOL_LIST): Replaces TYPE_PROTOCOL_LIST; stored in TYPE_LANG_SPECIFIC(...). (TREE_STATIC_INSTANCE, TYPE_PROTOCOL_LIST): Delete. (IS_ID, IS_CLASS, IS_PROTOCOL_QUALIFIED_UNTYPED, IS_SUPER, TYPED_OBJECT): Check for POINTER_TYPE rather than POINTER_TYPE_P; adjust for use of TYPE_OBJC_INTERFACE and TYPE_OBJC_PROTOCOL_LIST instead of TREE_STATIC_INSTANCE and TYPE_PROTOCOL_LIST. From-SVN: r92239
2004-12-16 02:10:38 +01:00
/* For 'id' and 'Class', adopted protocols are stored in the pointee. */
if (objc_is_id (orig))
orig = TREE_TYPE (orig);
objc-act.c (build_private_template): Change to return 'void'... [gcc/objc/ChangeLog] 2004-12-15 Ziemowit Laski <zlaski@apple.com> * objc-act.c (build_private_template): Change to return 'void'; do not set ivar_context, uprivate_record or objc_instance_type. (objc_comptypes, gen_type_name_0): For types 'id' and 'Class', retrieve protocol list from the pointee rather than the pointer itself; check TYPE_HAS_OBJC_INFO(...) precondition before accessing TYPE_OBJC_PROTOCOL_LIST. (objc_get_protocol_qualified_type): For types 'id' and 'Class', construct a variant of the pointee as well as the pointer, and store protocol information in the former. When creating variants of RECORD_TYPEs, clone their TYPE_LANG_SPECIFIC fields and propagate TYPE_OBJC_INTERFACE information. (objc_declare_class): If a TYPE_DECL is looked up, retrieve the underlying RECORD_TYPE to check for presence of TYPE_OBJC_INTERFACE; for newly-created RECORD_TYPEs, create a tentative TYPE_OBJC_INTERFACE holding an IDENTIFIER_NODE. (objc_finish_message_expr): Check TYPE_HAS_OBJC_INFO(...) before accessing TYPE_OBJC_PROTOCOL_LIST; Use TYPE_OBJC_INTERFACE instead of calling lookup_interface(); allow for TYPE_OBJC_INTERFACE holding an IDENTIFIER_NODE (meaning a @class forward-declaration only). (objc_is_public): Check TYPE_OBJC_INTERFACE instead of calling lookup_interface(). (continue_class): For @implementations, set ivar_context, uprivate_record and objc_instance_type, for @interfaces, call build_private_template(). (encode_pointer): Check TYPE_HAS_OBJC_INFO(...) before accessing TYPE_OBJC_INTERFACE. (objc_types_are_equivalent): Check TYPE_HAS_OBJC_INFO(...) before accessing TYPE_OBJC_PROTOCOL_LIST. * objc-act.h (OBJC_INFO_SLOT_ELTS, TYPE_OBJC_INFO, INIT_TYPE_OBJC_INFO, DUP_TYPE_OBJC_INFO, ALLOC_OBJC_TYPE_LANG_SPECIFIC, SIZEOF_OBJC_TYPE_LANG_SPECIFIC): New macros. (TYPE_OBJC_INTERFACE): Replaces TREE_STATIC_INSTANCE and now points to an actual @interface; stored in TYPE_LANG_SPECIFIC(...). (TYPE_OBJC_PROTOCOL_LIST): Replaces TYPE_PROTOCOL_LIST; stored in TYPE_LANG_SPECIFIC(...). (TREE_STATIC_INSTANCE, TYPE_PROTOCOL_LIST): Delete. (IS_ID, IS_CLASS, IS_PROTOCOL_QUALIFIED_UNTYPED, IS_SUPER, TYPED_OBJECT): Check for POINTER_TYPE rather than POINTER_TYPE_P; adjust for use of TYPE_OBJC_INTERFACE and TYPE_OBJC_PROTOCOL_LIST instead of TREE_STATIC_INSTANCE and TYPE_PROTOCOL_LIST. From-SVN: r92239
2004-12-16 02:10:38 +01:00
proto = TYPE_HAS_OBJC_INFO (orig) ? TYPE_OBJC_PROTOCOL_LIST (orig) : NULL_TREE;
Makefile.in (c-parse.o): Depend on $(C_COMMON_H). [gcc/ChangeLog] 2004-09-07 Ziemowit Laski <zlaski@apple.com> * Makefile.in (c-parse.o): Depend on $(C_COMMON_H). * c-parse.in: Include c-common.h instead of objc-act.h. (ivar_decl_list, ivar_decls, ivar_decl, ivars, ivar_declarator, myparms, myparm): Remove %type declarations. (methodtype, optparms, OBJC_TYPE_QUAL, objc_quals, objc_qual, objc_typename, objc_try_catch_stmt, optellipsis): Add %type declarations. (objc_inherit_code, objc_public_flag): Remove. (typespec_nonreserved_nonattr): Call objc_get_protocol_qualified_type() instead of get_static_reference() and get_protocol_reference(). (stmt_nocomp): Call grokparm() on @catch parameter. (objcdef): Move semantic action to objc_finish_implementation(). (classdef): Move semantic action to objc_start_class_interface(), objc_continue_interface(), objc_finish_interface(), objc_start_class_implementation(), objc_continue_implementation(), objc_start_category_interface() and objc_start_category_implementation(). (protocoldef): Move semantic actions to objc_start_protocol() and objc_finish_interface(). (ivar_decl_list): Remove nonterminal. (visibility_spec): Move semantic actions to objc_set_visibility(). (ivar_decls): Remove assignment to $$. (ivar_decl): Rephrase in terms of component_decl; call objc_add_instance_variable(). (ivars, ivar_declarator): Remove nonterminals. (opt_semi): New nonterminal. (methodtype): Remove semantic actions. (methoddef): Move semantic actions to objc_set_method_type(), objc_start_method_definition() and objc_finish_method_definition(). (methodproto): Move semantic actions to objc_set_method_type() and objc_add_method_declaration(). (methoddecl): Use objc_typename instead of typename; move semantic actions to objc_build_method_signature(). (optarglist, myxdecls, mydecl, myparms, myparm): Remove nonterminals. (optparmlist): Express in terms of optparms and optellipsis. (optparms, optellipsis, objc_qual, objc_quals, objc_typename): New nonterminals. (keyworddecl): Use objc_typename instead of typename. (rid_to_yy): Mark RID_IN, RID_OUT, RID_INOUT, RID_BYCOPY, RID_BYREF and RID_ONEWAY as returning OBJC_TYPE_QUAL to yyparse(). [gcc/objc/ChangeLog] 2004-09-07 Ziemowit Laski <zlaski@apple.com> * Make-lang.in (objc/objc-parse.o): Depend on $(C_COMMON_H) instead of objc/objc-act.h. (objc/objc-act.o): Depend on $(HASHTAB_H). * objc-act.c: Include hashtab.h; in ObjC++ mode, include cp-tree.h and objcp-decl.h instead of c-tree.h. (build_module_descriptor, get_class_ivars, synth_id_with_class_suffix, error_with_ivar, gen_method_decl, gen_declaration, setup_string_decl, build_protocol_template): Adjust prototypes. (build_module_initializer_routine, start_class, continue_class, finish_class, start_method_def, objc_start_function, start_protocol, build_method_decl, objc_add_method, add_instance_variable, build_ivar_reference, is_ivar, is_private, get_super_receiver, build_selector_table_decl, objc_push_parm, objc_get_parm_info, gen_type_name, gen_type_name_0, start_var_decl, finish_var_decl, create_field_decl): New prototypes. (objc_expand_function_end, comp_method_with_proto, objc_expr_last, gen_declaration_1, gen_declarator, is_complex_decl, adorn_decl, define_decl, create_builtin_decl, gen_declspecs): Remove prototypes. (TYPE_ID): Rename to OBJECT_TYPEDEF_NAME. (CLASS_TYPEDEF_NAME): New. (TAG_EXECCLASS): Change from a global variable to a #define. (TAG_RETURN_STRUCT): Delete. (TAG_GNUINIT): New, holds '__objc_gnu_init' name. (objc_inherit_code, objc_public_flag): New, moved from c-parse.in. (string_descriptor): New struct. (string_htab): New hash table. (string_hash, string_eq): New prototypes. (generate_struct_by_value_array): Call create_field_decl() instead of create_builtin_decl(). (objc_init): Do not initialize objc_ellipsis_node or TAG_EXECCLASS; In ObjC++ mode, call cxx_init() instead of c_objc_common_init(). (objc_finish_file): In ObjC++, call instantiate_pending_templates() and cp_finish_file(). (define_decl, get_static_reference, get_protocol_reference, create_builtin_decl): Remove functions. (objc_start_class_interface, objc_start_category_interface, objc_start_protocol, objc_continue_interface, objc_finish_interface, objc_start_class_implementation, objc_start_category_implementation, objc_continue_implementation, objc_finish_implementation, objc_set_visibility, objc_set_method_type, objc_build_method_signature, objc_add_method_declaration, objc_start_method_definition, objc_add_instance_variable, objc_get_protocol_qualified_type, create_field_decl, start_var_decl, finish_var_decl): New functions. (setup_string_decl): Simplify since it is only called once. (synth_module_prologue): Call build_class_template(); predefine 'id' and 'Class' as typedefs; rename 'temp_type' to 'type'; disable debug hooks for duration of function; fix GNU runtime messenger signatures to correspond to reality; forward-declare '__objc_exec_class' for the GNU runtime; call build_selector_table_decl(); in ObjC++ mode, generate 'extern "C" { ... }' wrappers around synthesized declarations; call build_protocol_template() and build_category_template(). (string_hash, string_eq): New functions. (objc_build_string_object): Check metaclass correctness only once; store string literals in hash table. (objc_build_constructor): Do not convert initializer elements; adjust for ObjC++ impedance mismatch. (build_objc_symtab_template): Call create_field_decl() instead of create_builtin_decl(). (init_objc_symtab): Add missing conversion to initializer element. (build_metadata_decl): Call start_var_decl() instead of define_decl(). (generate_objc_symtab_decl): Do not call build_category_template(); call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(). (build_module_descriptor): Call create_field_decl() instead of grokfield(); call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(); always mark module descriptor as used; move GNU runtime-specific functionality to build_module_initializer_routine(). (build_module_initializer_routine): New function, broken off of build_module_descriptor(). (objc_static_init_needed_p, objc_generate_static_init_call): New functions. (generate_static_references, generate_strings, build_selector_translation_table, generate_descriptor_table, generate_ivars_list, generate_dispatch_table, generate_category): Call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(); build a type directly instead of via groktypename(). (build_selector_reference_decl, build_selector_table_decl, build_class_reference_decl, build_protocol_reference, generate_objc_image_info): Call start_var_decl() instead of build_decl(). (build_selector_reference): For GNU runtime, do not call build_selector_reference_decl(). (build_selector, build_typed_selector_reference): Always convert result to the selector type. (add_objc_string): Cast return value to 'char *'. (build_method_prototype_template, build_selector_template, build_method_template): Use actual selector type for fields pointing to selectors. (finish_objc): For GNU runtime, call build_module_initializer_routine() after build_module_descriptor(). (generate_protocol_list, generate_shared_structures): Call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(); build a type directly instead of via groktypename(). (synth_id_with_class_suffix): Return a string. (get_arg_type_list): For instance methods, use the instance type for 'self'; do not call groktypename_in_parm_context(). (build_objc_string_decl): Squash redeclaration errors in ObjC++. (objc_is_class_name): Use OBJC_TYPE_NAME instead of TYPE_NAME; handle RECORD_TYPEs in ObjC as well as ObjC++. (objc_is_id): New function. (objc_is_object_ptr): Return the canonical type node. (objc_get_class_ivars): Simplify using get_class_ivars(). (get_class_ivars): Remove second parameter; create a fresh copy of the ivar list for each call; do not check for existence of super class. (objc_eh_runtime_type): Mark #ifndef OBJCPLUS. (objc_init_exceptions): When using SJLJ-style exceptions, require the use of '-fobjc-exceptions' flag; do not require it for DWARF-style exceptions. (objc_build_exc_ptr, next_sjlj_build_try_catch_finally): Use objc_object_type instead of objc_id_type. (objc_begin_catch_clause): Convert the incoming PARM_DECL into a VAR_DECL before placing it in the appropriate scope; do not call define_decl(); adjust call to c_begin_compound_stmt(); use objc_object_type instead of objc_id_type. (build_next_objc_exception_stuff): Call create_field_decl() instead of create_builtin_decl(); construct type directly instead of calling groktypename(); use OBJC_VOID_AT_END to mark end of function parameters. (build_private_template): Adjust call to get_class_ivars(); build a type directly instead of via groktypename(). (build_protocol_template, build_method_prototype_list_template, build_method_prototype_template, build_category_template, build_selector_template, build_class_template, build_super_template, build_ivar_template, build_ivar_list_template, build_method_list_template, build_method_template): Call create_field_decl() instead of grokfield(). (objc_method_parm_type): Do not call groktypename(). (generate_descriptor_table): Call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(). (generate_method_descriptors, build_protocol_initializer, generate_dispatch_tables, build_category_initializer, build_shared_structure_initializer): Do not call groktypename(). (generate_protocols): Call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(); do not call groktypename(). (error_with_ivar): Remove last parameter. (check_ivars): Do not iterate ovar CLASS_RAW_IVARS lists in addition to CLASS_IVARS lists; adjust calls to error_with_ivar(). (generate_ivar_lists): Convert one of the initializer elements; do not call groktypename(). (get_arg_type_list, start_method_def, gen_method_def): Account for new representation of variable arguments and '...' in Objective-C methods; add Objective-C++ impedance matching code. (is_objc_type_qualifier): Remove function. (adjust_type_for_id_default): Simplify; there is no longer a need to wade through declspecs. (lookup_interface, start_class, continue_class, finish_class, start_method_def, start_protocol, build_method_decl, objc_add_method, add_instance_variable, build_ivar_reference, is_ivar, is_private, get_super_receiver, objc_build_finally_epilogue): Make into static functions. (receiver_is_class_object): Use new IS_CLASS() macro. (objc_build_message_expr): Tweak ObjC++ message argument handling; call objc_finish_message_expr() instead of finish_message_expr(). (finish_message_expr): Rename to objc_finish_message_expr(); use OBJC_TYPE_NAME and OBJC_SET_TYPE_NAME macros instead of TYPE_NAME. call gen_type_name() instead of gen_declaration(); call objc_is_id() instead of using IS_ID and IS_CLASS; Use objc_class_name instead of calling get_identifier("Class"); handle CONVERT_EXPRs in receiver. (build_objc_method_call, warn_with_method): Do not call groktypename(). (build_ivar_reference): Call convert() instead of clobbering in a type. (hash_init): Initialize string_htab hash table. (add_instance_variable): Simplify parameter list; do not call grokfield(); do not populate CLASS_IVARS list. (start_class): Check for the existence of super class, if one was specified. (continue_class): Use CLASS_RAW_IVARS rather than CLASS_IVARS; do not call build_class_template(); adjust call to get_class_ivars(); call build_decl(), pushdecl() and finish_decl() instead of define_decl(). (finish_class): Call build_decl(), pushdecl() and finish_decl() instead of define_decl(). (add_protocols): Use PROTOCOL_BINFO_ELTS for the tree vector size. (start_protocol): Do not call build_protocol_template(); use PROTOCOL_BINFO_ELTS for the tree vector size. (encode_type_qualifiers): Do not handle the 'const' qualifier here. (encode_pointer): Encode 'const char *' as 'r*', for backwards compatibility. (encode_array): Use HOST_WIDE_INT_PRINT_DEC instead of "%ld". (encode_type): Handle the 'const' qualifier here. (objc_parmlist): New global variable, sued by objc_push_parm and objc_get_parm_info(). (objc_push_parm, objc_get_parm_info): New functions. (objc_expr_last): Remove function. (synth_self_and_ucmd_args): For instance methods, use the instance type for 'self'; call objc_push_parm() instead of push_parm_decl(). (start_method_def): Do not call push_scope(), declare_parm_level(), pop_scope(), push_parm_decl(), store_parm_decls() or objc_expr_last(); just use objc_push_parm() and objc_get_parm_info(). (comp_method_with_proto): Remove function. (objc_types_are_equivalent): Strip away indirections before comparing underlying types. (comp_proto_with_proto): Do not call groktypename(); types are no longer in raw declspec format. (objc_start_function): New function. (really_start_method): Call comp_proto_with_proto() instead of comp_method_with_proto(); call objc_start_function() instead of hand-crafting a function declarator. (continue_method_def, objc_expand_function_end): Remove functions. (get_super_receiver): Call objc_get_current_scope() instead of get_current_scope(); reference 'super_class' field (instead of 'class'). (finish_method_def): Rename to objc_finish_method_definition() and add a function decl parameter; move method encoding call from objc_expand_function_end(). (is_complex_decl, adorn_decl, gen_declarator, gen_declspecs, gen_declaration_1): Remove functions. (tmpbuf, RAW_DECLSPEC): Remove. (gen_declaration): Remove second parameter; simplify to deal with TYPE_P nodes instead of raw declspecs. (gen_type_name, gen_type_name_0): New functions. (gen_method_decl): Remove second parameter; call gen_type_name() instead of gen_declaration_1(). (dump_interface): Adjust calls to gen_declaration() and gen_method_decl(); do not allocate a separate string buffer. (init_objc): Allocate a larger string buffer to accommodate dump_interface(); adjust call to build_module_descriptor(); add call to build_module_initializer_routine() for the GNU runtime. (generate_classref_translation_entry): Do not call start_decl(); call finish_var_decl() instead of finish_decl(); call convert() instead of build_c_cast(). * objc-act.h (CLASS_OWN_IVARS): Remove accessor. (CLASS_BINFO_ELTS): Reduce from 6 to 5, now that CLASS_OWN_IVARS is gone. (OCTI_GNU_INIT_DECL, GNU_INIT_decl): New. (OCTI_ELLIPSIS_NODE, objc_ellipsis_node): Remove. (OCTI_ID_ID, id_type, objc_id_id): Rename to OCTI_ID_NAME, objc_object_type and objc_object_name, respectively. (OCTI_CLS_REF, OCTI_CLASS_NAME, objc_class_reference, objc_class_name): New. (IS_CLASS): New macro. (IS_ID, IS_SUPER): Robustify. (OCTI_EXECCLASS_DECL, execclass_decl): New. (finish_file, start_class, continue_class, finish_class, start_method_def, continue_method_def, finish_method_def, start_protocol, finish_protocol, objc_build_throw_stmt, objc_build_try_catch_finally_stmt, objc_build_synchronized_prologue, objc_build_synchronized_epilogue, objc_build_try_prologue, objc_build_try_epilogue, objc_build_catch_stmt, objc_build_catch_epilogue, objc_build_finally_prologue, objc_build_finally_epilogue, is_ivar, is_private, is_public, add_instance_variable, objc_add_method, get_super_receiver, objc_clear_super_receiver, get_class_ivars_from_name, get_class_reference, get_static_reference, get_object_reference, build_message_expr, finish_message_expr, build_selector_expr, build_ivar_reference, build_keyword_decl, build_method_decl, build_protocol_expr, build_objc_string_object, objc_declare_alias, objc_declare_class, objc_declare_protocols, objc_comptypes, objc_check_decl, build_encode_expr): Remove prototypes. (imp_count, cat_count): Make GGC-aware. (OBJC_SET_TYPE_NAME): New macro. From-SVN: r87168
2004-09-08 02:49:44 +02:00
if (proto)
{
strcat (errbuf, " <");
1992-01-18 00:15:38 +01:00
Makefile.in (c-parse.o): Depend on $(C_COMMON_H). [gcc/ChangeLog] 2004-09-07 Ziemowit Laski <zlaski@apple.com> * Makefile.in (c-parse.o): Depend on $(C_COMMON_H). * c-parse.in: Include c-common.h instead of objc-act.h. (ivar_decl_list, ivar_decls, ivar_decl, ivars, ivar_declarator, myparms, myparm): Remove %type declarations. (methodtype, optparms, OBJC_TYPE_QUAL, objc_quals, objc_qual, objc_typename, objc_try_catch_stmt, optellipsis): Add %type declarations. (objc_inherit_code, objc_public_flag): Remove. (typespec_nonreserved_nonattr): Call objc_get_protocol_qualified_type() instead of get_static_reference() and get_protocol_reference(). (stmt_nocomp): Call grokparm() on @catch parameter. (objcdef): Move semantic action to objc_finish_implementation(). (classdef): Move semantic action to objc_start_class_interface(), objc_continue_interface(), objc_finish_interface(), objc_start_class_implementation(), objc_continue_implementation(), objc_start_category_interface() and objc_start_category_implementation(). (protocoldef): Move semantic actions to objc_start_protocol() and objc_finish_interface(). (ivar_decl_list): Remove nonterminal. (visibility_spec): Move semantic actions to objc_set_visibility(). (ivar_decls): Remove assignment to $$. (ivar_decl): Rephrase in terms of component_decl; call objc_add_instance_variable(). (ivars, ivar_declarator): Remove nonterminals. (opt_semi): New nonterminal. (methodtype): Remove semantic actions. (methoddef): Move semantic actions to objc_set_method_type(), objc_start_method_definition() and objc_finish_method_definition(). (methodproto): Move semantic actions to objc_set_method_type() and objc_add_method_declaration(). (methoddecl): Use objc_typename instead of typename; move semantic actions to objc_build_method_signature(). (optarglist, myxdecls, mydecl, myparms, myparm): Remove nonterminals. (optparmlist): Express in terms of optparms and optellipsis. (optparms, optellipsis, objc_qual, objc_quals, objc_typename): New nonterminals. (keyworddecl): Use objc_typename instead of typename. (rid_to_yy): Mark RID_IN, RID_OUT, RID_INOUT, RID_BYCOPY, RID_BYREF and RID_ONEWAY as returning OBJC_TYPE_QUAL to yyparse(). [gcc/objc/ChangeLog] 2004-09-07 Ziemowit Laski <zlaski@apple.com> * Make-lang.in (objc/objc-parse.o): Depend on $(C_COMMON_H) instead of objc/objc-act.h. (objc/objc-act.o): Depend on $(HASHTAB_H). * objc-act.c: Include hashtab.h; in ObjC++ mode, include cp-tree.h and objcp-decl.h instead of c-tree.h. (build_module_descriptor, get_class_ivars, synth_id_with_class_suffix, error_with_ivar, gen_method_decl, gen_declaration, setup_string_decl, build_protocol_template): Adjust prototypes. (build_module_initializer_routine, start_class, continue_class, finish_class, start_method_def, objc_start_function, start_protocol, build_method_decl, objc_add_method, add_instance_variable, build_ivar_reference, is_ivar, is_private, get_super_receiver, build_selector_table_decl, objc_push_parm, objc_get_parm_info, gen_type_name, gen_type_name_0, start_var_decl, finish_var_decl, create_field_decl): New prototypes. (objc_expand_function_end, comp_method_with_proto, objc_expr_last, gen_declaration_1, gen_declarator, is_complex_decl, adorn_decl, define_decl, create_builtin_decl, gen_declspecs): Remove prototypes. (TYPE_ID): Rename to OBJECT_TYPEDEF_NAME. (CLASS_TYPEDEF_NAME): New. (TAG_EXECCLASS): Change from a global variable to a #define. (TAG_RETURN_STRUCT): Delete. (TAG_GNUINIT): New, holds '__objc_gnu_init' name. (objc_inherit_code, objc_public_flag): New, moved from c-parse.in. (string_descriptor): New struct. (string_htab): New hash table. (string_hash, string_eq): New prototypes. (generate_struct_by_value_array): Call create_field_decl() instead of create_builtin_decl(). (objc_init): Do not initialize objc_ellipsis_node or TAG_EXECCLASS; In ObjC++ mode, call cxx_init() instead of c_objc_common_init(). (objc_finish_file): In ObjC++, call instantiate_pending_templates() and cp_finish_file(). (define_decl, get_static_reference, get_protocol_reference, create_builtin_decl): Remove functions. (objc_start_class_interface, objc_start_category_interface, objc_start_protocol, objc_continue_interface, objc_finish_interface, objc_start_class_implementation, objc_start_category_implementation, objc_continue_implementation, objc_finish_implementation, objc_set_visibility, objc_set_method_type, objc_build_method_signature, objc_add_method_declaration, objc_start_method_definition, objc_add_instance_variable, objc_get_protocol_qualified_type, create_field_decl, start_var_decl, finish_var_decl): New functions. (setup_string_decl): Simplify since it is only called once. (synth_module_prologue): Call build_class_template(); predefine 'id' and 'Class' as typedefs; rename 'temp_type' to 'type'; disable debug hooks for duration of function; fix GNU runtime messenger signatures to correspond to reality; forward-declare '__objc_exec_class' for the GNU runtime; call build_selector_table_decl(); in ObjC++ mode, generate 'extern "C" { ... }' wrappers around synthesized declarations; call build_protocol_template() and build_category_template(). (string_hash, string_eq): New functions. (objc_build_string_object): Check metaclass correctness only once; store string literals in hash table. (objc_build_constructor): Do not convert initializer elements; adjust for ObjC++ impedance mismatch. (build_objc_symtab_template): Call create_field_decl() instead of create_builtin_decl(). (init_objc_symtab): Add missing conversion to initializer element. (build_metadata_decl): Call start_var_decl() instead of define_decl(). (generate_objc_symtab_decl): Do not call build_category_template(); call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(). (build_module_descriptor): Call create_field_decl() instead of grokfield(); call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(); always mark module descriptor as used; move GNU runtime-specific functionality to build_module_initializer_routine(). (build_module_initializer_routine): New function, broken off of build_module_descriptor(). (objc_static_init_needed_p, objc_generate_static_init_call): New functions. (generate_static_references, generate_strings, build_selector_translation_table, generate_descriptor_table, generate_ivars_list, generate_dispatch_table, generate_category): Call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(); build a type directly instead of via groktypename(). (build_selector_reference_decl, build_selector_table_decl, build_class_reference_decl, build_protocol_reference, generate_objc_image_info): Call start_var_decl() instead of build_decl(). (build_selector_reference): For GNU runtime, do not call build_selector_reference_decl(). (build_selector, build_typed_selector_reference): Always convert result to the selector type. (add_objc_string): Cast return value to 'char *'. (build_method_prototype_template, build_selector_template, build_method_template): Use actual selector type for fields pointing to selectors. (finish_objc): For GNU runtime, call build_module_initializer_routine() after build_module_descriptor(). (generate_protocol_list, generate_shared_structures): Call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(); build a type directly instead of via groktypename(). (synth_id_with_class_suffix): Return a string. (get_arg_type_list): For instance methods, use the instance type for 'self'; do not call groktypename_in_parm_context(). (build_objc_string_decl): Squash redeclaration errors in ObjC++. (objc_is_class_name): Use OBJC_TYPE_NAME instead of TYPE_NAME; handle RECORD_TYPEs in ObjC as well as ObjC++. (objc_is_id): New function. (objc_is_object_ptr): Return the canonical type node. (objc_get_class_ivars): Simplify using get_class_ivars(). (get_class_ivars): Remove second parameter; create a fresh copy of the ivar list for each call; do not check for existence of super class. (objc_eh_runtime_type): Mark #ifndef OBJCPLUS. (objc_init_exceptions): When using SJLJ-style exceptions, require the use of '-fobjc-exceptions' flag; do not require it for DWARF-style exceptions. (objc_build_exc_ptr, next_sjlj_build_try_catch_finally): Use objc_object_type instead of objc_id_type. (objc_begin_catch_clause): Convert the incoming PARM_DECL into a VAR_DECL before placing it in the appropriate scope; do not call define_decl(); adjust call to c_begin_compound_stmt(); use objc_object_type instead of objc_id_type. (build_next_objc_exception_stuff): Call create_field_decl() instead of create_builtin_decl(); construct type directly instead of calling groktypename(); use OBJC_VOID_AT_END to mark end of function parameters. (build_private_template): Adjust call to get_class_ivars(); build a type directly instead of via groktypename(). (build_protocol_template, build_method_prototype_list_template, build_method_prototype_template, build_category_template, build_selector_template, build_class_template, build_super_template, build_ivar_template, build_ivar_list_template, build_method_list_template, build_method_template): Call create_field_decl() instead of grokfield(). (objc_method_parm_type): Do not call groktypename(). (generate_descriptor_table): Call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(). (generate_method_descriptors, build_protocol_initializer, generate_dispatch_tables, build_category_initializer, build_shared_structure_initializer): Do not call groktypename(). (generate_protocols): Call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(); do not call groktypename(). (error_with_ivar): Remove last parameter. (check_ivars): Do not iterate ovar CLASS_RAW_IVARS lists in addition to CLASS_IVARS lists; adjust calls to error_with_ivar(). (generate_ivar_lists): Convert one of the initializer elements; do not call groktypename(). (get_arg_type_list, start_method_def, gen_method_def): Account for new representation of variable arguments and '...' in Objective-C methods; add Objective-C++ impedance matching code. (is_objc_type_qualifier): Remove function. (adjust_type_for_id_default): Simplify; there is no longer a need to wade through declspecs. (lookup_interface, start_class, continue_class, finish_class, start_method_def, start_protocol, build_method_decl, objc_add_method, add_instance_variable, build_ivar_reference, is_ivar, is_private, get_super_receiver, objc_build_finally_epilogue): Make into static functions. (receiver_is_class_object): Use new IS_CLASS() macro. (objc_build_message_expr): Tweak ObjC++ message argument handling; call objc_finish_message_expr() instead of finish_message_expr(). (finish_message_expr): Rename to objc_finish_message_expr(); use OBJC_TYPE_NAME and OBJC_SET_TYPE_NAME macros instead of TYPE_NAME. call gen_type_name() instead of gen_declaration(); call objc_is_id() instead of using IS_ID and IS_CLASS; Use objc_class_name instead of calling get_identifier("Class"); handle CONVERT_EXPRs in receiver. (build_objc_method_call, warn_with_method): Do not call groktypename(). (build_ivar_reference): Call convert() instead of clobbering in a type. (hash_init): Initialize string_htab hash table. (add_instance_variable): Simplify parameter list; do not call grokfield(); do not populate CLASS_IVARS list. (start_class): Check for the existence of super class, if one was specified. (continue_class): Use CLASS_RAW_IVARS rather than CLASS_IVARS; do not call build_class_template(); adjust call to get_class_ivars(); call build_decl(), pushdecl() and finish_decl() instead of define_decl(). (finish_class): Call build_decl(), pushdecl() and finish_decl() instead of define_decl(). (add_protocols): Use PROTOCOL_BINFO_ELTS for the tree vector size. (start_protocol): Do not call build_protocol_template(); use PROTOCOL_BINFO_ELTS for the tree vector size. (encode_type_qualifiers): Do not handle the 'const' qualifier here. (encode_pointer): Encode 'const char *' as 'r*', for backwards compatibility. (encode_array): Use HOST_WIDE_INT_PRINT_DEC instead of "%ld". (encode_type): Handle the 'const' qualifier here. (objc_parmlist): New global variable, sued by objc_push_parm and objc_get_parm_info(). (objc_push_parm, objc_get_parm_info): New functions. (objc_expr_last): Remove function. (synth_self_and_ucmd_args): For instance methods, use the instance type for 'self'; call objc_push_parm() instead of push_parm_decl(). (start_method_def): Do not call push_scope(), declare_parm_level(), pop_scope(), push_parm_decl(), store_parm_decls() or objc_expr_last(); just use objc_push_parm() and objc_get_parm_info(). (comp_method_with_proto): Remove function. (objc_types_are_equivalent): Strip away indirections before comparing underlying types. (comp_proto_with_proto): Do not call groktypename(); types are no longer in raw declspec format. (objc_start_function): New function. (really_start_method): Call comp_proto_with_proto() instead of comp_method_with_proto(); call objc_start_function() instead of hand-crafting a function declarator. (continue_method_def, objc_expand_function_end): Remove functions. (get_super_receiver): Call objc_get_current_scope() instead of get_current_scope(); reference 'super_class' field (instead of 'class'). (finish_method_def): Rename to objc_finish_method_definition() and add a function decl parameter; move method encoding call from objc_expand_function_end(). (is_complex_decl, adorn_decl, gen_declarator, gen_declspecs, gen_declaration_1): Remove functions. (tmpbuf, RAW_DECLSPEC): Remove. (gen_declaration): Remove second parameter; simplify to deal with TYPE_P nodes instead of raw declspecs. (gen_type_name, gen_type_name_0): New functions. (gen_method_decl): Remove second parameter; call gen_type_name() instead of gen_declaration_1(). (dump_interface): Adjust calls to gen_declaration() and gen_method_decl(); do not allocate a separate string buffer. (init_objc): Allocate a larger string buffer to accommodate dump_interface(); adjust call to build_module_descriptor(); add call to build_module_initializer_routine() for the GNU runtime. (generate_classref_translation_entry): Do not call start_decl(); call finish_var_decl() instead of finish_decl(); call convert() instead of build_c_cast(). * objc-act.h (CLASS_OWN_IVARS): Remove accessor. (CLASS_BINFO_ELTS): Reduce from 6 to 5, now that CLASS_OWN_IVARS is gone. (OCTI_GNU_INIT_DECL, GNU_INIT_decl): New. (OCTI_ELLIPSIS_NODE, objc_ellipsis_node): Remove. (OCTI_ID_ID, id_type, objc_id_id): Rename to OCTI_ID_NAME, objc_object_type and objc_object_name, respectively. (OCTI_CLS_REF, OCTI_CLASS_NAME, objc_class_reference, objc_class_name): New. (IS_CLASS): New macro. (IS_ID, IS_SUPER): Robustify. (OCTI_EXECCLASS_DECL, execclass_decl): New. (finish_file, start_class, continue_class, finish_class, start_method_def, continue_method_def, finish_method_def, start_protocol, finish_protocol, objc_build_throw_stmt, objc_build_try_catch_finally_stmt, objc_build_synchronized_prologue, objc_build_synchronized_epilogue, objc_build_try_prologue, objc_build_try_epilogue, objc_build_catch_stmt, objc_build_catch_epilogue, objc_build_finally_prologue, objc_build_finally_epilogue, is_ivar, is_private, is_public, add_instance_variable, objc_add_method, get_super_receiver, objc_clear_super_receiver, get_class_ivars_from_name, get_class_reference, get_static_reference, get_object_reference, build_message_expr, finish_message_expr, build_selector_expr, build_ivar_reference, build_keyword_decl, build_method_decl, build_protocol_expr, build_objc_string_object, objc_declare_alias, objc_declare_class, objc_declare_protocols, objc_comptypes, objc_check_decl, build_encode_expr): Remove prototypes. (imp_count, cat_count): Make GGC-aware. (OBJC_SET_TYPE_NAME): New macro. From-SVN: r87168
2004-09-08 02:49:44 +02:00
while (proto) {
strcat (errbuf,
Makefile.in (c-parse.o): Depend on $(C_COMMON_H). [gcc/ChangeLog] 2004-09-07 Ziemowit Laski <zlaski@apple.com> * Makefile.in (c-parse.o): Depend on $(C_COMMON_H). * c-parse.in: Include c-common.h instead of objc-act.h. (ivar_decl_list, ivar_decls, ivar_decl, ivars, ivar_declarator, myparms, myparm): Remove %type declarations. (methodtype, optparms, OBJC_TYPE_QUAL, objc_quals, objc_qual, objc_typename, objc_try_catch_stmt, optellipsis): Add %type declarations. (objc_inherit_code, objc_public_flag): Remove. (typespec_nonreserved_nonattr): Call objc_get_protocol_qualified_type() instead of get_static_reference() and get_protocol_reference(). (stmt_nocomp): Call grokparm() on @catch parameter. (objcdef): Move semantic action to objc_finish_implementation(). (classdef): Move semantic action to objc_start_class_interface(), objc_continue_interface(), objc_finish_interface(), objc_start_class_implementation(), objc_continue_implementation(), objc_start_category_interface() and objc_start_category_implementation(). (protocoldef): Move semantic actions to objc_start_protocol() and objc_finish_interface(). (ivar_decl_list): Remove nonterminal. (visibility_spec): Move semantic actions to objc_set_visibility(). (ivar_decls): Remove assignment to $$. (ivar_decl): Rephrase in terms of component_decl; call objc_add_instance_variable(). (ivars, ivar_declarator): Remove nonterminals. (opt_semi): New nonterminal. (methodtype): Remove semantic actions. (methoddef): Move semantic actions to objc_set_method_type(), objc_start_method_definition() and objc_finish_method_definition(). (methodproto): Move semantic actions to objc_set_method_type() and objc_add_method_declaration(). (methoddecl): Use objc_typename instead of typename; move semantic actions to objc_build_method_signature(). (optarglist, myxdecls, mydecl, myparms, myparm): Remove nonterminals. (optparmlist): Express in terms of optparms and optellipsis. (optparms, optellipsis, objc_qual, objc_quals, objc_typename): New nonterminals. (keyworddecl): Use objc_typename instead of typename. (rid_to_yy): Mark RID_IN, RID_OUT, RID_INOUT, RID_BYCOPY, RID_BYREF and RID_ONEWAY as returning OBJC_TYPE_QUAL to yyparse(). [gcc/objc/ChangeLog] 2004-09-07 Ziemowit Laski <zlaski@apple.com> * Make-lang.in (objc/objc-parse.o): Depend on $(C_COMMON_H) instead of objc/objc-act.h. (objc/objc-act.o): Depend on $(HASHTAB_H). * objc-act.c: Include hashtab.h; in ObjC++ mode, include cp-tree.h and objcp-decl.h instead of c-tree.h. (build_module_descriptor, get_class_ivars, synth_id_with_class_suffix, error_with_ivar, gen_method_decl, gen_declaration, setup_string_decl, build_protocol_template): Adjust prototypes. (build_module_initializer_routine, start_class, continue_class, finish_class, start_method_def, objc_start_function, start_protocol, build_method_decl, objc_add_method, add_instance_variable, build_ivar_reference, is_ivar, is_private, get_super_receiver, build_selector_table_decl, objc_push_parm, objc_get_parm_info, gen_type_name, gen_type_name_0, start_var_decl, finish_var_decl, create_field_decl): New prototypes. (objc_expand_function_end, comp_method_with_proto, objc_expr_last, gen_declaration_1, gen_declarator, is_complex_decl, adorn_decl, define_decl, create_builtin_decl, gen_declspecs): Remove prototypes. (TYPE_ID): Rename to OBJECT_TYPEDEF_NAME. (CLASS_TYPEDEF_NAME): New. (TAG_EXECCLASS): Change from a global variable to a #define. (TAG_RETURN_STRUCT): Delete. (TAG_GNUINIT): New, holds '__objc_gnu_init' name. (objc_inherit_code, objc_public_flag): New, moved from c-parse.in. (string_descriptor): New struct. (string_htab): New hash table. (string_hash, string_eq): New prototypes. (generate_struct_by_value_array): Call create_field_decl() instead of create_builtin_decl(). (objc_init): Do not initialize objc_ellipsis_node or TAG_EXECCLASS; In ObjC++ mode, call cxx_init() instead of c_objc_common_init(). (objc_finish_file): In ObjC++, call instantiate_pending_templates() and cp_finish_file(). (define_decl, get_static_reference, get_protocol_reference, create_builtin_decl): Remove functions. (objc_start_class_interface, objc_start_category_interface, objc_start_protocol, objc_continue_interface, objc_finish_interface, objc_start_class_implementation, objc_start_category_implementation, objc_continue_implementation, objc_finish_implementation, objc_set_visibility, objc_set_method_type, objc_build_method_signature, objc_add_method_declaration, objc_start_method_definition, objc_add_instance_variable, objc_get_protocol_qualified_type, create_field_decl, start_var_decl, finish_var_decl): New functions. (setup_string_decl): Simplify since it is only called once. (synth_module_prologue): Call build_class_template(); predefine 'id' and 'Class' as typedefs; rename 'temp_type' to 'type'; disable debug hooks for duration of function; fix GNU runtime messenger signatures to correspond to reality; forward-declare '__objc_exec_class' for the GNU runtime; call build_selector_table_decl(); in ObjC++ mode, generate 'extern "C" { ... }' wrappers around synthesized declarations; call build_protocol_template() and build_category_template(). (string_hash, string_eq): New functions. (objc_build_string_object): Check metaclass correctness only once; store string literals in hash table. (objc_build_constructor): Do not convert initializer elements; adjust for ObjC++ impedance mismatch. (build_objc_symtab_template): Call create_field_decl() instead of create_builtin_decl(). (init_objc_symtab): Add missing conversion to initializer element. (build_metadata_decl): Call start_var_decl() instead of define_decl(). (generate_objc_symtab_decl): Do not call build_category_template(); call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(). (build_module_descriptor): Call create_field_decl() instead of grokfield(); call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(); always mark module descriptor as used; move GNU runtime-specific functionality to build_module_initializer_routine(). (build_module_initializer_routine): New function, broken off of build_module_descriptor(). (objc_static_init_needed_p, objc_generate_static_init_call): New functions. (generate_static_references, generate_strings, build_selector_translation_table, generate_descriptor_table, generate_ivars_list, generate_dispatch_table, generate_category): Call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(); build a type directly instead of via groktypename(). (build_selector_reference_decl, build_selector_table_decl, build_class_reference_decl, build_protocol_reference, generate_objc_image_info): Call start_var_decl() instead of build_decl(). (build_selector_reference): For GNU runtime, do not call build_selector_reference_decl(). (build_selector, build_typed_selector_reference): Always convert result to the selector type. (add_objc_string): Cast return value to 'char *'. (build_method_prototype_template, build_selector_template, build_method_template): Use actual selector type for fields pointing to selectors. (finish_objc): For GNU runtime, call build_module_initializer_routine() after build_module_descriptor(). (generate_protocol_list, generate_shared_structures): Call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(); build a type directly instead of via groktypename(). (synth_id_with_class_suffix): Return a string. (get_arg_type_list): For instance methods, use the instance type for 'self'; do not call groktypename_in_parm_context(). (build_objc_string_decl): Squash redeclaration errors in ObjC++. (objc_is_class_name): Use OBJC_TYPE_NAME instead of TYPE_NAME; handle RECORD_TYPEs in ObjC as well as ObjC++. (objc_is_id): New function. (objc_is_object_ptr): Return the canonical type node. (objc_get_class_ivars): Simplify using get_class_ivars(). (get_class_ivars): Remove second parameter; create a fresh copy of the ivar list for each call; do not check for existence of super class. (objc_eh_runtime_type): Mark #ifndef OBJCPLUS. (objc_init_exceptions): When using SJLJ-style exceptions, require the use of '-fobjc-exceptions' flag; do not require it for DWARF-style exceptions. (objc_build_exc_ptr, next_sjlj_build_try_catch_finally): Use objc_object_type instead of objc_id_type. (objc_begin_catch_clause): Convert the incoming PARM_DECL into a VAR_DECL before placing it in the appropriate scope; do not call define_decl(); adjust call to c_begin_compound_stmt(); use objc_object_type instead of objc_id_type. (build_next_objc_exception_stuff): Call create_field_decl() instead of create_builtin_decl(); construct type directly instead of calling groktypename(); use OBJC_VOID_AT_END to mark end of function parameters. (build_private_template): Adjust call to get_class_ivars(); build a type directly instead of via groktypename(). (build_protocol_template, build_method_prototype_list_template, build_method_prototype_template, build_category_template, build_selector_template, build_class_template, build_super_template, build_ivar_template, build_ivar_list_template, build_method_list_template, build_method_template): Call create_field_decl() instead of grokfield(). (objc_method_parm_type): Do not call groktypename(). (generate_descriptor_table): Call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(). (generate_method_descriptors, build_protocol_initializer, generate_dispatch_tables, build_category_initializer, build_shared_structure_initializer): Do not call groktypename(). (generate_protocols): Call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(); do not call groktypename(). (error_with_ivar): Remove last parameter. (check_ivars): Do not iterate ovar CLASS_RAW_IVARS lists in addition to CLASS_IVARS lists; adjust calls to error_with_ivar(). (generate_ivar_lists): Convert one of the initializer elements; do not call groktypename(). (get_arg_type_list, start_method_def, gen_method_def): Account for new representation of variable arguments and '...' in Objective-C methods; add Objective-C++ impedance matching code. (is_objc_type_qualifier): Remove function. (adjust_type_for_id_default): Simplify; there is no longer a need to wade through declspecs. (lookup_interface, start_class, continue_class, finish_class, start_method_def, start_protocol, build_method_decl, objc_add_method, add_instance_variable, build_ivar_reference, is_ivar, is_private, get_super_receiver, objc_build_finally_epilogue): Make into static functions. (receiver_is_class_object): Use new IS_CLASS() macro. (objc_build_message_expr): Tweak ObjC++ message argument handling; call objc_finish_message_expr() instead of finish_message_expr(). (finish_message_expr): Rename to objc_finish_message_expr(); use OBJC_TYPE_NAME and OBJC_SET_TYPE_NAME macros instead of TYPE_NAME. call gen_type_name() instead of gen_declaration(); call objc_is_id() instead of using IS_ID and IS_CLASS; Use objc_class_name instead of calling get_identifier("Class"); handle CONVERT_EXPRs in receiver. (build_objc_method_call, warn_with_method): Do not call groktypename(). (build_ivar_reference): Call convert() instead of clobbering in a type. (hash_init): Initialize string_htab hash table. (add_instance_variable): Simplify parameter list; do not call grokfield(); do not populate CLASS_IVARS list. (start_class): Check for the existence of super class, if one was specified. (continue_class): Use CLASS_RAW_IVARS rather than CLASS_IVARS; do not call build_class_template(); adjust call to get_class_ivars(); call build_decl(), pushdecl() and finish_decl() instead of define_decl(). (finish_class): Call build_decl(), pushdecl() and finish_decl() instead of define_decl(). (add_protocols): Use PROTOCOL_BINFO_ELTS for the tree vector size. (start_protocol): Do not call build_protocol_template(); use PROTOCOL_BINFO_ELTS for the tree vector size. (encode_type_qualifiers): Do not handle the 'const' qualifier here. (encode_pointer): Encode 'const char *' as 'r*', for backwards compatibility. (encode_array): Use HOST_WIDE_INT_PRINT_DEC instead of "%ld". (encode_type): Handle the 'const' qualifier here. (objc_parmlist): New global variable, sued by objc_push_parm and objc_get_parm_info(). (objc_push_parm, objc_get_parm_info): New functions. (objc_expr_last): Remove function. (synth_self_and_ucmd_args): For instance methods, use the instance type for 'self'; call objc_push_parm() instead of push_parm_decl(). (start_method_def): Do not call push_scope(), declare_parm_level(), pop_scope(), push_parm_decl(), store_parm_decls() or objc_expr_last(); just use objc_push_parm() and objc_get_parm_info(). (comp_method_with_proto): Remove function. (objc_types_are_equivalent): Strip away indirections before comparing underlying types. (comp_proto_with_proto): Do not call groktypename(); types are no longer in raw declspec format. (objc_start_function): New function. (really_start_method): Call comp_proto_with_proto() instead of comp_method_with_proto(); call objc_start_function() instead of hand-crafting a function declarator. (continue_method_def, objc_expand_function_end): Remove functions. (get_super_receiver): Call objc_get_current_scope() instead of get_current_scope(); reference 'super_class' field (instead of 'class'). (finish_method_def): Rename to objc_finish_method_definition() and add a function decl parameter; move method encoding call from objc_expand_function_end(). (is_complex_decl, adorn_decl, gen_declarator, gen_declspecs, gen_declaration_1): Remove functions. (tmpbuf, RAW_DECLSPEC): Remove. (gen_declaration): Remove second parameter; simplify to deal with TYPE_P nodes instead of raw declspecs. (gen_type_name, gen_type_name_0): New functions. (gen_method_decl): Remove second parameter; call gen_type_name() instead of gen_declaration_1(). (dump_interface): Adjust calls to gen_declaration() and gen_method_decl(); do not allocate a separate string buffer. (init_objc): Allocate a larger string buffer to accommodate dump_interface(); adjust call to build_module_descriptor(); add call to build_module_initializer_routine() for the GNU runtime. (generate_classref_translation_entry): Do not call start_decl(); call finish_var_decl() instead of finish_decl(); call convert() instead of build_c_cast(). * objc-act.h (CLASS_OWN_IVARS): Remove accessor. (CLASS_BINFO_ELTS): Reduce from 6 to 5, now that CLASS_OWN_IVARS is gone. (OCTI_GNU_INIT_DECL, GNU_INIT_decl): New. (OCTI_ELLIPSIS_NODE, objc_ellipsis_node): Remove. (OCTI_ID_ID, id_type, objc_id_id): Rename to OCTI_ID_NAME, objc_object_type and objc_object_name, respectively. (OCTI_CLS_REF, OCTI_CLASS_NAME, objc_class_reference, objc_class_name): New. (IS_CLASS): New macro. (IS_ID, IS_SUPER): Robustify. (OCTI_EXECCLASS_DECL, execclass_decl): New. (finish_file, start_class, continue_class, finish_class, start_method_def, continue_method_def, finish_method_def, start_protocol, finish_protocol, objc_build_throw_stmt, objc_build_try_catch_finally_stmt, objc_build_synchronized_prologue, objc_build_synchronized_epilogue, objc_build_try_prologue, objc_build_try_epilogue, objc_build_catch_stmt, objc_build_catch_epilogue, objc_build_finally_prologue, objc_build_finally_epilogue, is_ivar, is_private, is_public, add_instance_variable, objc_add_method, get_super_receiver, objc_clear_super_receiver, get_class_ivars_from_name, get_class_reference, get_static_reference, get_object_reference, build_message_expr, finish_message_expr, build_selector_expr, build_ivar_reference, build_keyword_decl, build_method_decl, build_protocol_expr, build_objc_string_object, objc_declare_alias, objc_declare_class, objc_declare_protocols, objc_comptypes, objc_check_decl, build_encode_expr): Remove prototypes. (imp_count, cat_count): Make GGC-aware. (OBJC_SET_TYPE_NAME): New macro. From-SVN: r87168
2004-09-08 02:49:44 +02:00
IDENTIFIER_POINTER (PROTOCOL_NAME (TREE_VALUE (proto))));
proto = TREE_CHAIN (proto);
strcat (errbuf, proto ? ", " : ">");
}
}
1992-01-18 00:15:38 +01:00
Makefile.in (c-parse.o): Depend on $(C_COMMON_H). [gcc/ChangeLog] 2004-09-07 Ziemowit Laski <zlaski@apple.com> * Makefile.in (c-parse.o): Depend on $(C_COMMON_H). * c-parse.in: Include c-common.h instead of objc-act.h. (ivar_decl_list, ivar_decls, ivar_decl, ivars, ivar_declarator, myparms, myparm): Remove %type declarations. (methodtype, optparms, OBJC_TYPE_QUAL, objc_quals, objc_qual, objc_typename, objc_try_catch_stmt, optellipsis): Add %type declarations. (objc_inherit_code, objc_public_flag): Remove. (typespec_nonreserved_nonattr): Call objc_get_protocol_qualified_type() instead of get_static_reference() and get_protocol_reference(). (stmt_nocomp): Call grokparm() on @catch parameter. (objcdef): Move semantic action to objc_finish_implementation(). (classdef): Move semantic action to objc_start_class_interface(), objc_continue_interface(), objc_finish_interface(), objc_start_class_implementation(), objc_continue_implementation(), objc_start_category_interface() and objc_start_category_implementation(). (protocoldef): Move semantic actions to objc_start_protocol() and objc_finish_interface(). (ivar_decl_list): Remove nonterminal. (visibility_spec): Move semantic actions to objc_set_visibility(). (ivar_decls): Remove assignment to $$. (ivar_decl): Rephrase in terms of component_decl; call objc_add_instance_variable(). (ivars, ivar_declarator): Remove nonterminals. (opt_semi): New nonterminal. (methodtype): Remove semantic actions. (methoddef): Move semantic actions to objc_set_method_type(), objc_start_method_definition() and objc_finish_method_definition(). (methodproto): Move semantic actions to objc_set_method_type() and objc_add_method_declaration(). (methoddecl): Use objc_typename instead of typename; move semantic actions to objc_build_method_signature(). (optarglist, myxdecls, mydecl, myparms, myparm): Remove nonterminals. (optparmlist): Express in terms of optparms and optellipsis. (optparms, optellipsis, objc_qual, objc_quals, objc_typename): New nonterminals. (keyworddecl): Use objc_typename instead of typename. (rid_to_yy): Mark RID_IN, RID_OUT, RID_INOUT, RID_BYCOPY, RID_BYREF and RID_ONEWAY as returning OBJC_TYPE_QUAL to yyparse(). [gcc/objc/ChangeLog] 2004-09-07 Ziemowit Laski <zlaski@apple.com> * Make-lang.in (objc/objc-parse.o): Depend on $(C_COMMON_H) instead of objc/objc-act.h. (objc/objc-act.o): Depend on $(HASHTAB_H). * objc-act.c: Include hashtab.h; in ObjC++ mode, include cp-tree.h and objcp-decl.h instead of c-tree.h. (build_module_descriptor, get_class_ivars, synth_id_with_class_suffix, error_with_ivar, gen_method_decl, gen_declaration, setup_string_decl, build_protocol_template): Adjust prototypes. (build_module_initializer_routine, start_class, continue_class, finish_class, start_method_def, objc_start_function, start_protocol, build_method_decl, objc_add_method, add_instance_variable, build_ivar_reference, is_ivar, is_private, get_super_receiver, build_selector_table_decl, objc_push_parm, objc_get_parm_info, gen_type_name, gen_type_name_0, start_var_decl, finish_var_decl, create_field_decl): New prototypes. (objc_expand_function_end, comp_method_with_proto, objc_expr_last, gen_declaration_1, gen_declarator, is_complex_decl, adorn_decl, define_decl, create_builtin_decl, gen_declspecs): Remove prototypes. (TYPE_ID): Rename to OBJECT_TYPEDEF_NAME. (CLASS_TYPEDEF_NAME): New. (TAG_EXECCLASS): Change from a global variable to a #define. (TAG_RETURN_STRUCT): Delete. (TAG_GNUINIT): New, holds '__objc_gnu_init' name. (objc_inherit_code, objc_public_flag): New, moved from c-parse.in. (string_descriptor): New struct. (string_htab): New hash table. (string_hash, string_eq): New prototypes. (generate_struct_by_value_array): Call create_field_decl() instead of create_builtin_decl(). (objc_init): Do not initialize objc_ellipsis_node or TAG_EXECCLASS; In ObjC++ mode, call cxx_init() instead of c_objc_common_init(). (objc_finish_file): In ObjC++, call instantiate_pending_templates() and cp_finish_file(). (define_decl, get_static_reference, get_protocol_reference, create_builtin_decl): Remove functions. (objc_start_class_interface, objc_start_category_interface, objc_start_protocol, objc_continue_interface, objc_finish_interface, objc_start_class_implementation, objc_start_category_implementation, objc_continue_implementation, objc_finish_implementation, objc_set_visibility, objc_set_method_type, objc_build_method_signature, objc_add_method_declaration, objc_start_method_definition, objc_add_instance_variable, objc_get_protocol_qualified_type, create_field_decl, start_var_decl, finish_var_decl): New functions. (setup_string_decl): Simplify since it is only called once. (synth_module_prologue): Call build_class_template(); predefine 'id' and 'Class' as typedefs; rename 'temp_type' to 'type'; disable debug hooks for duration of function; fix GNU runtime messenger signatures to correspond to reality; forward-declare '__objc_exec_class' for the GNU runtime; call build_selector_table_decl(); in ObjC++ mode, generate 'extern "C" { ... }' wrappers around synthesized declarations; call build_protocol_template() and build_category_template(). (string_hash, string_eq): New functions. (objc_build_string_object): Check metaclass correctness only once; store string literals in hash table. (objc_build_constructor): Do not convert initializer elements; adjust for ObjC++ impedance mismatch. (build_objc_symtab_template): Call create_field_decl() instead of create_builtin_decl(). (init_objc_symtab): Add missing conversion to initializer element. (build_metadata_decl): Call start_var_decl() instead of define_decl(). (generate_objc_symtab_decl): Do not call build_category_template(); call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(). (build_module_descriptor): Call create_field_decl() instead of grokfield(); call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(); always mark module descriptor as used; move GNU runtime-specific functionality to build_module_initializer_routine(). (build_module_initializer_routine): New function, broken off of build_module_descriptor(). (objc_static_init_needed_p, objc_generate_static_init_call): New functions. (generate_static_references, generate_strings, build_selector_translation_table, generate_descriptor_table, generate_ivars_list, generate_dispatch_table, generate_category): Call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(); build a type directly instead of via groktypename(). (build_selector_reference_decl, build_selector_table_decl, build_class_reference_decl, build_protocol_reference, generate_objc_image_info): Call start_var_decl() instead of build_decl(). (build_selector_reference): For GNU runtime, do not call build_selector_reference_decl(). (build_selector, build_typed_selector_reference): Always convert result to the selector type. (add_objc_string): Cast return value to 'char *'. (build_method_prototype_template, build_selector_template, build_method_template): Use actual selector type for fields pointing to selectors. (finish_objc): For GNU runtime, call build_module_initializer_routine() after build_module_descriptor(). (generate_protocol_list, generate_shared_structures): Call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(); build a type directly instead of via groktypename(). (synth_id_with_class_suffix): Return a string. (get_arg_type_list): For instance methods, use the instance type for 'self'; do not call groktypename_in_parm_context(). (build_objc_string_decl): Squash redeclaration errors in ObjC++. (objc_is_class_name): Use OBJC_TYPE_NAME instead of TYPE_NAME; handle RECORD_TYPEs in ObjC as well as ObjC++. (objc_is_id): New function. (objc_is_object_ptr): Return the canonical type node. (objc_get_class_ivars): Simplify using get_class_ivars(). (get_class_ivars): Remove second parameter; create a fresh copy of the ivar list for each call; do not check for existence of super class. (objc_eh_runtime_type): Mark #ifndef OBJCPLUS. (objc_init_exceptions): When using SJLJ-style exceptions, require the use of '-fobjc-exceptions' flag; do not require it for DWARF-style exceptions. (objc_build_exc_ptr, next_sjlj_build_try_catch_finally): Use objc_object_type instead of objc_id_type. (objc_begin_catch_clause): Convert the incoming PARM_DECL into a VAR_DECL before placing it in the appropriate scope; do not call define_decl(); adjust call to c_begin_compound_stmt(); use objc_object_type instead of objc_id_type. (build_next_objc_exception_stuff): Call create_field_decl() instead of create_builtin_decl(); construct type directly instead of calling groktypename(); use OBJC_VOID_AT_END to mark end of function parameters. (build_private_template): Adjust call to get_class_ivars(); build a type directly instead of via groktypename(). (build_protocol_template, build_method_prototype_list_template, build_method_prototype_template, build_category_template, build_selector_template, build_class_template, build_super_template, build_ivar_template, build_ivar_list_template, build_method_list_template, build_method_template): Call create_field_decl() instead of grokfield(). (objc_method_parm_type): Do not call groktypename(). (generate_descriptor_table): Call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(). (generate_method_descriptors, build_protocol_initializer, generate_dispatch_tables, build_category_initializer, build_shared_structure_initializer): Do not call groktypename(). (generate_protocols): Call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(); do not call groktypename(). (error_with_ivar): Remove last parameter. (check_ivars): Do not iterate ovar CLASS_RAW_IVARS lists in addition to CLASS_IVARS lists; adjust calls to error_with_ivar(). (generate_ivar_lists): Convert one of the initializer elements; do not call groktypename(). (get_arg_type_list, start_method_def, gen_method_def): Account for new representation of variable arguments and '...' in Objective-C methods; add Objective-C++ impedance matching code. (is_objc_type_qualifier): Remove function. (adjust_type_for_id_default): Simplify; there is no longer a need to wade through declspecs. (lookup_interface, start_class, continue_class, finish_class, start_method_def, start_protocol, build_method_decl, objc_add_method, add_instance_variable, build_ivar_reference, is_ivar, is_private, get_super_receiver, objc_build_finally_epilogue): Make into static functions. (receiver_is_class_object): Use new IS_CLASS() macro. (objc_build_message_expr): Tweak ObjC++ message argument handling; call objc_finish_message_expr() instead of finish_message_expr(). (finish_message_expr): Rename to objc_finish_message_expr(); use OBJC_TYPE_NAME and OBJC_SET_TYPE_NAME macros instead of TYPE_NAME. call gen_type_name() instead of gen_declaration(); call objc_is_id() instead of using IS_ID and IS_CLASS; Use objc_class_name instead of calling get_identifier("Class"); handle CONVERT_EXPRs in receiver. (build_objc_method_call, warn_with_method): Do not call groktypename(). (build_ivar_reference): Call convert() instead of clobbering in a type. (hash_init): Initialize string_htab hash table. (add_instance_variable): Simplify parameter list; do not call grokfield(); do not populate CLASS_IVARS list. (start_class): Check for the existence of super class, if one was specified. (continue_class): Use CLASS_RAW_IVARS rather than CLASS_IVARS; do not call build_class_template(); adjust call to get_class_ivars(); call build_decl(), pushdecl() and finish_decl() instead of define_decl(). (finish_class): Call build_decl(), pushdecl() and finish_decl() instead of define_decl(). (add_protocols): Use PROTOCOL_BINFO_ELTS for the tree vector size. (start_protocol): Do not call build_protocol_template(); use PROTOCOL_BINFO_ELTS for the tree vector size. (encode_type_qualifiers): Do not handle the 'const' qualifier here. (encode_pointer): Encode 'const char *' as 'r*', for backwards compatibility. (encode_array): Use HOST_WIDE_INT_PRINT_DEC instead of "%ld". (encode_type): Handle the 'const' qualifier here. (objc_parmlist): New global variable, sued by objc_push_parm and objc_get_parm_info(). (objc_push_parm, objc_get_parm_info): New functions. (objc_expr_last): Remove function. (synth_self_and_ucmd_args): For instance methods, use the instance type for 'self'; call objc_push_parm() instead of push_parm_decl(). (start_method_def): Do not call push_scope(), declare_parm_level(), pop_scope(), push_parm_decl(), store_parm_decls() or objc_expr_last(); just use objc_push_parm() and objc_get_parm_info(). (comp_method_with_proto): Remove function. (objc_types_are_equivalent): Strip away indirections before comparing underlying types. (comp_proto_with_proto): Do not call groktypename(); types are no longer in raw declspec format. (objc_start_function): New function. (really_start_method): Call comp_proto_with_proto() instead of comp_method_with_proto(); call objc_start_function() instead of hand-crafting a function declarator. (continue_method_def, objc_expand_function_end): Remove functions. (get_super_receiver): Call objc_get_current_scope() instead of get_current_scope(); reference 'super_class' field (instead of 'class'). (finish_method_def): Rename to objc_finish_method_definition() and add a function decl parameter; move method encoding call from objc_expand_function_end(). (is_complex_decl, adorn_decl, gen_declarator, gen_declspecs, gen_declaration_1): Remove functions. (tmpbuf, RAW_DECLSPEC): Remove. (gen_declaration): Remove second parameter; simplify to deal with TYPE_P nodes instead of raw declspecs. (gen_type_name, gen_type_name_0): New functions. (gen_method_decl): Remove second parameter; call gen_type_name() instead of gen_declaration_1(). (dump_interface): Adjust calls to gen_declaration() and gen_method_decl(); do not allocate a separate string buffer. (init_objc): Allocate a larger string buffer to accommodate dump_interface(); adjust call to build_module_descriptor(); add call to build_module_initializer_routine() for the GNU runtime. (generate_classref_translation_entry): Do not call start_decl(); call finish_var_decl() instead of finish_decl(); call convert() instead of build_c_cast(). * objc-act.h (CLASS_OWN_IVARS): Remove accessor. (CLASS_BINFO_ELTS): Reduce from 6 to 5, now that CLASS_OWN_IVARS is gone. (OCTI_GNU_INIT_DECL, GNU_INIT_decl): New. (OCTI_ELLIPSIS_NODE, objc_ellipsis_node): Remove. (OCTI_ID_ID, id_type, objc_id_id): Rename to OCTI_ID_NAME, objc_object_type and objc_object_name, respectively. (OCTI_CLS_REF, OCTI_CLASS_NAME, objc_class_reference, objc_class_name): New. (IS_CLASS): New macro. (IS_ID, IS_SUPER): Robustify. (OCTI_EXECCLASS_DECL, execclass_decl): New. (finish_file, start_class, continue_class, finish_class, start_method_def, continue_method_def, finish_method_def, start_protocol, finish_protocol, objc_build_throw_stmt, objc_build_try_catch_finally_stmt, objc_build_synchronized_prologue, objc_build_synchronized_epilogue, objc_build_try_prologue, objc_build_try_epilogue, objc_build_catch_stmt, objc_build_catch_epilogue, objc_build_finally_prologue, objc_build_finally_epilogue, is_ivar, is_private, is_public, add_instance_variable, objc_add_method, get_super_receiver, objc_clear_super_receiver, get_class_ivars_from_name, get_class_reference, get_static_reference, get_object_reference, build_message_expr, finish_message_expr, build_selector_expr, build_ivar_reference, build_keyword_decl, build_method_decl, build_protocol_expr, build_objc_string_object, objc_declare_alias, objc_declare_class, objc_declare_protocols, objc_comptypes, objc_check_decl, build_encode_expr): Remove prototypes. (imp_count, cat_count): Make GGC-aware. (OBJC_SET_TYPE_NAME): New macro. From-SVN: r87168
2004-09-08 02:49:44 +02:00
exit_function:
return errbuf;
}
Makefile.in (c-parse.o): Depend on $(C_COMMON_H). [gcc/ChangeLog] 2004-09-07 Ziemowit Laski <zlaski@apple.com> * Makefile.in (c-parse.o): Depend on $(C_COMMON_H). * c-parse.in: Include c-common.h instead of objc-act.h. (ivar_decl_list, ivar_decls, ivar_decl, ivars, ivar_declarator, myparms, myparm): Remove %type declarations. (methodtype, optparms, OBJC_TYPE_QUAL, objc_quals, objc_qual, objc_typename, objc_try_catch_stmt, optellipsis): Add %type declarations. (objc_inherit_code, objc_public_flag): Remove. (typespec_nonreserved_nonattr): Call objc_get_protocol_qualified_type() instead of get_static_reference() and get_protocol_reference(). (stmt_nocomp): Call grokparm() on @catch parameter. (objcdef): Move semantic action to objc_finish_implementation(). (classdef): Move semantic action to objc_start_class_interface(), objc_continue_interface(), objc_finish_interface(), objc_start_class_implementation(), objc_continue_implementation(), objc_start_category_interface() and objc_start_category_implementation(). (protocoldef): Move semantic actions to objc_start_protocol() and objc_finish_interface(). (ivar_decl_list): Remove nonterminal. (visibility_spec): Move semantic actions to objc_set_visibility(). (ivar_decls): Remove assignment to $$. (ivar_decl): Rephrase in terms of component_decl; call objc_add_instance_variable(). (ivars, ivar_declarator): Remove nonterminals. (opt_semi): New nonterminal. (methodtype): Remove semantic actions. (methoddef): Move semantic actions to objc_set_method_type(), objc_start_method_definition() and objc_finish_method_definition(). (methodproto): Move semantic actions to objc_set_method_type() and objc_add_method_declaration(). (methoddecl): Use objc_typename instead of typename; move semantic actions to objc_build_method_signature(). (optarglist, myxdecls, mydecl, myparms, myparm): Remove nonterminals. (optparmlist): Express in terms of optparms and optellipsis. (optparms, optellipsis, objc_qual, objc_quals, objc_typename): New nonterminals. (keyworddecl): Use objc_typename instead of typename. (rid_to_yy): Mark RID_IN, RID_OUT, RID_INOUT, RID_BYCOPY, RID_BYREF and RID_ONEWAY as returning OBJC_TYPE_QUAL to yyparse(). [gcc/objc/ChangeLog] 2004-09-07 Ziemowit Laski <zlaski@apple.com> * Make-lang.in (objc/objc-parse.o): Depend on $(C_COMMON_H) instead of objc/objc-act.h. (objc/objc-act.o): Depend on $(HASHTAB_H). * objc-act.c: Include hashtab.h; in ObjC++ mode, include cp-tree.h and objcp-decl.h instead of c-tree.h. (build_module_descriptor, get_class_ivars, synth_id_with_class_suffix, error_with_ivar, gen_method_decl, gen_declaration, setup_string_decl, build_protocol_template): Adjust prototypes. (build_module_initializer_routine, start_class, continue_class, finish_class, start_method_def, objc_start_function, start_protocol, build_method_decl, objc_add_method, add_instance_variable, build_ivar_reference, is_ivar, is_private, get_super_receiver, build_selector_table_decl, objc_push_parm, objc_get_parm_info, gen_type_name, gen_type_name_0, start_var_decl, finish_var_decl, create_field_decl): New prototypes. (objc_expand_function_end, comp_method_with_proto, objc_expr_last, gen_declaration_1, gen_declarator, is_complex_decl, adorn_decl, define_decl, create_builtin_decl, gen_declspecs): Remove prototypes. (TYPE_ID): Rename to OBJECT_TYPEDEF_NAME. (CLASS_TYPEDEF_NAME): New. (TAG_EXECCLASS): Change from a global variable to a #define. (TAG_RETURN_STRUCT): Delete. (TAG_GNUINIT): New, holds '__objc_gnu_init' name. (objc_inherit_code, objc_public_flag): New, moved from c-parse.in. (string_descriptor): New struct. (string_htab): New hash table. (string_hash, string_eq): New prototypes. (generate_struct_by_value_array): Call create_field_decl() instead of create_builtin_decl(). (objc_init): Do not initialize objc_ellipsis_node or TAG_EXECCLASS; In ObjC++ mode, call cxx_init() instead of c_objc_common_init(). (objc_finish_file): In ObjC++, call instantiate_pending_templates() and cp_finish_file(). (define_decl, get_static_reference, get_protocol_reference, create_builtin_decl): Remove functions. (objc_start_class_interface, objc_start_category_interface, objc_start_protocol, objc_continue_interface, objc_finish_interface, objc_start_class_implementation, objc_start_category_implementation, objc_continue_implementation, objc_finish_implementation, objc_set_visibility, objc_set_method_type, objc_build_method_signature, objc_add_method_declaration, objc_start_method_definition, objc_add_instance_variable, objc_get_protocol_qualified_type, create_field_decl, start_var_decl, finish_var_decl): New functions. (setup_string_decl): Simplify since it is only called once. (synth_module_prologue): Call build_class_template(); predefine 'id' and 'Class' as typedefs; rename 'temp_type' to 'type'; disable debug hooks for duration of function; fix GNU runtime messenger signatures to correspond to reality; forward-declare '__objc_exec_class' for the GNU runtime; call build_selector_table_decl(); in ObjC++ mode, generate 'extern "C" { ... }' wrappers around synthesized declarations; call build_protocol_template() and build_category_template(). (string_hash, string_eq): New functions. (objc_build_string_object): Check metaclass correctness only once; store string literals in hash table. (objc_build_constructor): Do not convert initializer elements; adjust for ObjC++ impedance mismatch. (build_objc_symtab_template): Call create_field_decl() instead of create_builtin_decl(). (init_objc_symtab): Add missing conversion to initializer element. (build_metadata_decl): Call start_var_decl() instead of define_decl(). (generate_objc_symtab_decl): Do not call build_category_template(); call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(). (build_module_descriptor): Call create_field_decl() instead of grokfield(); call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(); always mark module descriptor as used; move GNU runtime-specific functionality to build_module_initializer_routine(). (build_module_initializer_routine): New function, broken off of build_module_descriptor(). (objc_static_init_needed_p, objc_generate_static_init_call): New functions. (generate_static_references, generate_strings, build_selector_translation_table, generate_descriptor_table, generate_ivars_list, generate_dispatch_table, generate_category): Call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(); build a type directly instead of via groktypename(). (build_selector_reference_decl, build_selector_table_decl, build_class_reference_decl, build_protocol_reference, generate_objc_image_info): Call start_var_decl() instead of build_decl(). (build_selector_reference): For GNU runtime, do not call build_selector_reference_decl(). (build_selector, build_typed_selector_reference): Always convert result to the selector type. (add_objc_string): Cast return value to 'char *'. (build_method_prototype_template, build_selector_template, build_method_template): Use actual selector type for fields pointing to selectors. (finish_objc): For GNU runtime, call build_module_initializer_routine() after build_module_descriptor(). (generate_protocol_list, generate_shared_structures): Call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(); build a type directly instead of via groktypename(). (synth_id_with_class_suffix): Return a string. (get_arg_type_list): For instance methods, use the instance type for 'self'; do not call groktypename_in_parm_context(). (build_objc_string_decl): Squash redeclaration errors in ObjC++. (objc_is_class_name): Use OBJC_TYPE_NAME instead of TYPE_NAME; handle RECORD_TYPEs in ObjC as well as ObjC++. (objc_is_id): New function. (objc_is_object_ptr): Return the canonical type node. (objc_get_class_ivars): Simplify using get_class_ivars(). (get_class_ivars): Remove second parameter; create a fresh copy of the ivar list for each call; do not check for existence of super class. (objc_eh_runtime_type): Mark #ifndef OBJCPLUS. (objc_init_exceptions): When using SJLJ-style exceptions, require the use of '-fobjc-exceptions' flag; do not require it for DWARF-style exceptions. (objc_build_exc_ptr, next_sjlj_build_try_catch_finally): Use objc_object_type instead of objc_id_type. (objc_begin_catch_clause): Convert the incoming PARM_DECL into a VAR_DECL before placing it in the appropriate scope; do not call define_decl(); adjust call to c_begin_compound_stmt(); use objc_object_type instead of objc_id_type. (build_next_objc_exception_stuff): Call create_field_decl() instead of create_builtin_decl(); construct type directly instead of calling groktypename(); use OBJC_VOID_AT_END to mark end of function parameters. (build_private_template): Adjust call to get_class_ivars(); build a type directly instead of via groktypename(). (build_protocol_template, build_method_prototype_list_template, build_method_prototype_template, build_category_template, build_selector_template, build_class_template, build_super_template, build_ivar_template, build_ivar_list_template, build_method_list_template, build_method_template): Call create_field_decl() instead of grokfield(). (objc_method_parm_type): Do not call groktypename(). (generate_descriptor_table): Call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(). (generate_method_descriptors, build_protocol_initializer, generate_dispatch_tables, build_category_initializer, build_shared_structure_initializer): Do not call groktypename(). (generate_protocols): Call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(); do not call groktypename(). (error_with_ivar): Remove last parameter. (check_ivars): Do not iterate ovar CLASS_RAW_IVARS lists in addition to CLASS_IVARS lists; adjust calls to error_with_ivar(). (generate_ivar_lists): Convert one of the initializer elements; do not call groktypename(). (get_arg_type_list, start_method_def, gen_method_def): Account for new representation of variable arguments and '...' in Objective-C methods; add Objective-C++ impedance matching code. (is_objc_type_qualifier): Remove function. (adjust_type_for_id_default): Simplify; there is no longer a need to wade through declspecs. (lookup_interface, start_class, continue_class, finish_class, start_method_def, start_protocol, build_method_decl, objc_add_method, add_instance_variable, build_ivar_reference, is_ivar, is_private, get_super_receiver, objc_build_finally_epilogue): Make into static functions. (receiver_is_class_object): Use new IS_CLASS() macro. (objc_build_message_expr): Tweak ObjC++ message argument handling; call objc_finish_message_expr() instead of finish_message_expr(). (finish_message_expr): Rename to objc_finish_message_expr(); use OBJC_TYPE_NAME and OBJC_SET_TYPE_NAME macros instead of TYPE_NAME. call gen_type_name() instead of gen_declaration(); call objc_is_id() instead of using IS_ID and IS_CLASS; Use objc_class_name instead of calling get_identifier("Class"); handle CONVERT_EXPRs in receiver. (build_objc_method_call, warn_with_method): Do not call groktypename(). (build_ivar_reference): Call convert() instead of clobbering in a type. (hash_init): Initialize string_htab hash table. (add_instance_variable): Simplify parameter list; do not call grokfield(); do not populate CLASS_IVARS list. (start_class): Check for the existence of super class, if one was specified. (continue_class): Use CLASS_RAW_IVARS rather than CLASS_IVARS; do not call build_class_template(); adjust call to get_class_ivars(); call build_decl(), pushdecl() and finish_decl() instead of define_decl(). (finish_class): Call build_decl(), pushdecl() and finish_decl() instead of define_decl(). (add_protocols): Use PROTOCOL_BINFO_ELTS for the tree vector size. (start_protocol): Do not call build_protocol_template(); use PROTOCOL_BINFO_ELTS for the tree vector size. (encode_type_qualifiers): Do not handle the 'const' qualifier here. (encode_pointer): Encode 'const char *' as 'r*', for backwards compatibility. (encode_array): Use HOST_WIDE_INT_PRINT_DEC instead of "%ld". (encode_type): Handle the 'const' qualifier here. (objc_parmlist): New global variable, sued by objc_push_parm and objc_get_parm_info(). (objc_push_parm, objc_get_parm_info): New functions. (objc_expr_last): Remove function. (synth_self_and_ucmd_args): For instance methods, use the instance type for 'self'; call objc_push_parm() instead of push_parm_decl(). (start_method_def): Do not call push_scope(), declare_parm_level(), pop_scope(), push_parm_decl(), store_parm_decls() or objc_expr_last(); just use objc_push_parm() and objc_get_parm_info(). (comp_method_with_proto): Remove function. (objc_types_are_equivalent): Strip away indirections before comparing underlying types. (comp_proto_with_proto): Do not call groktypename(); types are no longer in raw declspec format. (objc_start_function): New function. (really_start_method): Call comp_proto_with_proto() instead of comp_method_with_proto(); call objc_start_function() instead of hand-crafting a function declarator. (continue_method_def, objc_expand_function_end): Remove functions. (get_super_receiver): Call objc_get_current_scope() instead of get_current_scope(); reference 'super_class' field (instead of 'class'). (finish_method_def): Rename to objc_finish_method_definition() and add a function decl parameter; move method encoding call from objc_expand_function_end(). (is_complex_decl, adorn_decl, gen_declarator, gen_declspecs, gen_declaration_1): Remove functions. (tmpbuf, RAW_DECLSPEC): Remove. (gen_declaration): Remove second parameter; simplify to deal with TYPE_P nodes instead of raw declspecs. (gen_type_name, gen_type_name_0): New functions. (gen_method_decl): Remove second parameter; call gen_type_name() instead of gen_declaration_1(). (dump_interface): Adjust calls to gen_declaration() and gen_method_decl(); do not allocate a separate string buffer. (init_objc): Allocate a larger string buffer to accommodate dump_interface(); adjust call to build_module_descriptor(); add call to build_module_initializer_routine() for the GNU runtime. (generate_classref_translation_entry): Do not call start_decl(); call finish_var_decl() instead of finish_decl(); call convert() instead of build_c_cast(). * objc-act.h (CLASS_OWN_IVARS): Remove accessor. (CLASS_BINFO_ELTS): Reduce from 6 to 5, now that CLASS_OWN_IVARS is gone. (OCTI_GNU_INIT_DECL, GNU_INIT_decl): New. (OCTI_ELLIPSIS_NODE, objc_ellipsis_node): Remove. (OCTI_ID_ID, id_type, objc_id_id): Rename to OCTI_ID_NAME, objc_object_type and objc_object_name, respectively. (OCTI_CLS_REF, OCTI_CLASS_NAME, objc_class_reference, objc_class_name): New. (IS_CLASS): New macro. (IS_ID, IS_SUPER): Robustify. (OCTI_EXECCLASS_DECL, execclass_decl): New. (finish_file, start_class, continue_class, finish_class, start_method_def, continue_method_def, finish_method_def, start_protocol, finish_protocol, objc_build_throw_stmt, objc_build_try_catch_finally_stmt, objc_build_synchronized_prologue, objc_build_synchronized_epilogue, objc_build_try_prologue, objc_build_try_epilogue, objc_build_catch_stmt, objc_build_catch_epilogue, objc_build_finally_prologue, objc_build_finally_epilogue, is_ivar, is_private, is_public, add_instance_variable, objc_add_method, get_super_receiver, objc_clear_super_receiver, get_class_ivars_from_name, get_class_reference, get_static_reference, get_object_reference, build_message_expr, finish_message_expr, build_selector_expr, build_ivar_reference, build_keyword_decl, build_method_decl, build_protocol_expr, build_objc_string_object, objc_declare_alias, objc_declare_class, objc_declare_protocols, objc_comptypes, objc_check_decl, build_encode_expr): Remove prototypes. (imp_count, cat_count): Make GGC-aware. (OBJC_SET_TYPE_NAME): New macro. From-SVN: r87168
2004-09-08 02:49:44 +02:00
static char *
gen_type_name (tree type)
{
errbuf[0] = '\0';
Makefile.in (c-parse.o): Depend on $(C_COMMON_H). [gcc/ChangeLog] 2004-09-07 Ziemowit Laski <zlaski@apple.com> * Makefile.in (c-parse.o): Depend on $(C_COMMON_H). * c-parse.in: Include c-common.h instead of objc-act.h. (ivar_decl_list, ivar_decls, ivar_decl, ivars, ivar_declarator, myparms, myparm): Remove %type declarations. (methodtype, optparms, OBJC_TYPE_QUAL, objc_quals, objc_qual, objc_typename, objc_try_catch_stmt, optellipsis): Add %type declarations. (objc_inherit_code, objc_public_flag): Remove. (typespec_nonreserved_nonattr): Call objc_get_protocol_qualified_type() instead of get_static_reference() and get_protocol_reference(). (stmt_nocomp): Call grokparm() on @catch parameter. (objcdef): Move semantic action to objc_finish_implementation(). (classdef): Move semantic action to objc_start_class_interface(), objc_continue_interface(), objc_finish_interface(), objc_start_class_implementation(), objc_continue_implementation(), objc_start_category_interface() and objc_start_category_implementation(). (protocoldef): Move semantic actions to objc_start_protocol() and objc_finish_interface(). (ivar_decl_list): Remove nonterminal. (visibility_spec): Move semantic actions to objc_set_visibility(). (ivar_decls): Remove assignment to $$. (ivar_decl): Rephrase in terms of component_decl; call objc_add_instance_variable(). (ivars, ivar_declarator): Remove nonterminals. (opt_semi): New nonterminal. (methodtype): Remove semantic actions. (methoddef): Move semantic actions to objc_set_method_type(), objc_start_method_definition() and objc_finish_method_definition(). (methodproto): Move semantic actions to objc_set_method_type() and objc_add_method_declaration(). (methoddecl): Use objc_typename instead of typename; move semantic actions to objc_build_method_signature(). (optarglist, myxdecls, mydecl, myparms, myparm): Remove nonterminals. (optparmlist): Express in terms of optparms and optellipsis. (optparms, optellipsis, objc_qual, objc_quals, objc_typename): New nonterminals. (keyworddecl): Use objc_typename instead of typename. (rid_to_yy): Mark RID_IN, RID_OUT, RID_INOUT, RID_BYCOPY, RID_BYREF and RID_ONEWAY as returning OBJC_TYPE_QUAL to yyparse(). [gcc/objc/ChangeLog] 2004-09-07 Ziemowit Laski <zlaski@apple.com> * Make-lang.in (objc/objc-parse.o): Depend on $(C_COMMON_H) instead of objc/objc-act.h. (objc/objc-act.o): Depend on $(HASHTAB_H). * objc-act.c: Include hashtab.h; in ObjC++ mode, include cp-tree.h and objcp-decl.h instead of c-tree.h. (build_module_descriptor, get_class_ivars, synth_id_with_class_suffix, error_with_ivar, gen_method_decl, gen_declaration, setup_string_decl, build_protocol_template): Adjust prototypes. (build_module_initializer_routine, start_class, continue_class, finish_class, start_method_def, objc_start_function, start_protocol, build_method_decl, objc_add_method, add_instance_variable, build_ivar_reference, is_ivar, is_private, get_super_receiver, build_selector_table_decl, objc_push_parm, objc_get_parm_info, gen_type_name, gen_type_name_0, start_var_decl, finish_var_decl, create_field_decl): New prototypes. (objc_expand_function_end, comp_method_with_proto, objc_expr_last, gen_declaration_1, gen_declarator, is_complex_decl, adorn_decl, define_decl, create_builtin_decl, gen_declspecs): Remove prototypes. (TYPE_ID): Rename to OBJECT_TYPEDEF_NAME. (CLASS_TYPEDEF_NAME): New. (TAG_EXECCLASS): Change from a global variable to a #define. (TAG_RETURN_STRUCT): Delete. (TAG_GNUINIT): New, holds '__objc_gnu_init' name. (objc_inherit_code, objc_public_flag): New, moved from c-parse.in. (string_descriptor): New struct. (string_htab): New hash table. (string_hash, string_eq): New prototypes. (generate_struct_by_value_array): Call create_field_decl() instead of create_builtin_decl(). (objc_init): Do not initialize objc_ellipsis_node or TAG_EXECCLASS; In ObjC++ mode, call cxx_init() instead of c_objc_common_init(). (objc_finish_file): In ObjC++, call instantiate_pending_templates() and cp_finish_file(). (define_decl, get_static_reference, get_protocol_reference, create_builtin_decl): Remove functions. (objc_start_class_interface, objc_start_category_interface, objc_start_protocol, objc_continue_interface, objc_finish_interface, objc_start_class_implementation, objc_start_category_implementation, objc_continue_implementation, objc_finish_implementation, objc_set_visibility, objc_set_method_type, objc_build_method_signature, objc_add_method_declaration, objc_start_method_definition, objc_add_instance_variable, objc_get_protocol_qualified_type, create_field_decl, start_var_decl, finish_var_decl): New functions. (setup_string_decl): Simplify since it is only called once. (synth_module_prologue): Call build_class_template(); predefine 'id' and 'Class' as typedefs; rename 'temp_type' to 'type'; disable debug hooks for duration of function; fix GNU runtime messenger signatures to correspond to reality; forward-declare '__objc_exec_class' for the GNU runtime; call build_selector_table_decl(); in ObjC++ mode, generate 'extern "C" { ... }' wrappers around synthesized declarations; call build_protocol_template() and build_category_template(). (string_hash, string_eq): New functions. (objc_build_string_object): Check metaclass correctness only once; store string literals in hash table. (objc_build_constructor): Do not convert initializer elements; adjust for ObjC++ impedance mismatch. (build_objc_symtab_template): Call create_field_decl() instead of create_builtin_decl(). (init_objc_symtab): Add missing conversion to initializer element. (build_metadata_decl): Call start_var_decl() instead of define_decl(). (generate_objc_symtab_decl): Do not call build_category_template(); call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(). (build_module_descriptor): Call create_field_decl() instead of grokfield(); call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(); always mark module descriptor as used; move GNU runtime-specific functionality to build_module_initializer_routine(). (build_module_initializer_routine): New function, broken off of build_module_descriptor(). (objc_static_init_needed_p, objc_generate_static_init_call): New functions. (generate_static_references, generate_strings, build_selector_translation_table, generate_descriptor_table, generate_ivars_list, generate_dispatch_table, generate_category): Call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(); build a type directly instead of via groktypename(). (build_selector_reference_decl, build_selector_table_decl, build_class_reference_decl, build_protocol_reference, generate_objc_image_info): Call start_var_decl() instead of build_decl(). (build_selector_reference): For GNU runtime, do not call build_selector_reference_decl(). (build_selector, build_typed_selector_reference): Always convert result to the selector type. (add_objc_string): Cast return value to 'char *'. (build_method_prototype_template, build_selector_template, build_method_template): Use actual selector type for fields pointing to selectors. (finish_objc): For GNU runtime, call build_module_initializer_routine() after build_module_descriptor(). (generate_protocol_list, generate_shared_structures): Call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(); build a type directly instead of via groktypename(). (synth_id_with_class_suffix): Return a string. (get_arg_type_list): For instance methods, use the instance type for 'self'; do not call groktypename_in_parm_context(). (build_objc_string_decl): Squash redeclaration errors in ObjC++. (objc_is_class_name): Use OBJC_TYPE_NAME instead of TYPE_NAME; handle RECORD_TYPEs in ObjC as well as ObjC++. (objc_is_id): New function. (objc_is_object_ptr): Return the canonical type node. (objc_get_class_ivars): Simplify using get_class_ivars(). (get_class_ivars): Remove second parameter; create a fresh copy of the ivar list for each call; do not check for existence of super class. (objc_eh_runtime_type): Mark #ifndef OBJCPLUS. (objc_init_exceptions): When using SJLJ-style exceptions, require the use of '-fobjc-exceptions' flag; do not require it for DWARF-style exceptions. (objc_build_exc_ptr, next_sjlj_build_try_catch_finally): Use objc_object_type instead of objc_id_type. (objc_begin_catch_clause): Convert the incoming PARM_DECL into a VAR_DECL before placing it in the appropriate scope; do not call define_decl(); adjust call to c_begin_compound_stmt(); use objc_object_type instead of objc_id_type. (build_next_objc_exception_stuff): Call create_field_decl() instead of create_builtin_decl(); construct type directly instead of calling groktypename(); use OBJC_VOID_AT_END to mark end of function parameters. (build_private_template): Adjust call to get_class_ivars(); build a type directly instead of via groktypename(). (build_protocol_template, build_method_prototype_list_template, build_method_prototype_template, build_category_template, build_selector_template, build_class_template, build_super_template, build_ivar_template, build_ivar_list_template, build_method_list_template, build_method_template): Call create_field_decl() instead of grokfield(). (objc_method_parm_type): Do not call groktypename(). (generate_descriptor_table): Call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(). (generate_method_descriptors, build_protocol_initializer, generate_dispatch_tables, build_category_initializer, build_shared_structure_initializer): Do not call groktypename(). (generate_protocols): Call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(); do not call groktypename(). (error_with_ivar): Remove last parameter. (check_ivars): Do not iterate ovar CLASS_RAW_IVARS lists in addition to CLASS_IVARS lists; adjust calls to error_with_ivar(). (generate_ivar_lists): Convert one of the initializer elements; do not call groktypename(). (get_arg_type_list, start_method_def, gen_method_def): Account for new representation of variable arguments and '...' in Objective-C methods; add Objective-C++ impedance matching code. (is_objc_type_qualifier): Remove function. (adjust_type_for_id_default): Simplify; there is no longer a need to wade through declspecs. (lookup_interface, start_class, continue_class, finish_class, start_method_def, start_protocol, build_method_decl, objc_add_method, add_instance_variable, build_ivar_reference, is_ivar, is_private, get_super_receiver, objc_build_finally_epilogue): Make into static functions. (receiver_is_class_object): Use new IS_CLASS() macro. (objc_build_message_expr): Tweak ObjC++ message argument handling; call objc_finish_message_expr() instead of finish_message_expr(). (finish_message_expr): Rename to objc_finish_message_expr(); use OBJC_TYPE_NAME and OBJC_SET_TYPE_NAME macros instead of TYPE_NAME. call gen_type_name() instead of gen_declaration(); call objc_is_id() instead of using IS_ID and IS_CLASS; Use objc_class_name instead of calling get_identifier("Class"); handle CONVERT_EXPRs in receiver. (build_objc_method_call, warn_with_method): Do not call groktypename(). (build_ivar_reference): Call convert() instead of clobbering in a type. (hash_init): Initialize string_htab hash table. (add_instance_variable): Simplify parameter list; do not call grokfield(); do not populate CLASS_IVARS list. (start_class): Check for the existence of super class, if one was specified. (continue_class): Use CLASS_RAW_IVARS rather than CLASS_IVARS; do not call build_class_template(); adjust call to get_class_ivars(); call build_decl(), pushdecl() and finish_decl() instead of define_decl(). (finish_class): Call build_decl(), pushdecl() and finish_decl() instead of define_decl(). (add_protocols): Use PROTOCOL_BINFO_ELTS for the tree vector size. (start_protocol): Do not call build_protocol_template(); use PROTOCOL_BINFO_ELTS for the tree vector size. (encode_type_qualifiers): Do not handle the 'const' qualifier here. (encode_pointer): Encode 'const char *' as 'r*', for backwards compatibility. (encode_array): Use HOST_WIDE_INT_PRINT_DEC instead of "%ld". (encode_type): Handle the 'const' qualifier here. (objc_parmlist): New global variable, sued by objc_push_parm and objc_get_parm_info(). (objc_push_parm, objc_get_parm_info): New functions. (objc_expr_last): Remove function. (synth_self_and_ucmd_args): For instance methods, use the instance type for 'self'; call objc_push_parm() instead of push_parm_decl(). (start_method_def): Do not call push_scope(), declare_parm_level(), pop_scope(), push_parm_decl(), store_parm_decls() or objc_expr_last(); just use objc_push_parm() and objc_get_parm_info(). (comp_method_with_proto): Remove function. (objc_types_are_equivalent): Strip away indirections before comparing underlying types. (comp_proto_with_proto): Do not call groktypename(); types are no longer in raw declspec format. (objc_start_function): New function. (really_start_method): Call comp_proto_with_proto() instead of comp_method_with_proto(); call objc_start_function() instead of hand-crafting a function declarator. (continue_method_def, objc_expand_function_end): Remove functions. (get_super_receiver): Call objc_get_current_scope() instead of get_current_scope(); reference 'super_class' field (instead of 'class'). (finish_method_def): Rename to objc_finish_method_definition() and add a function decl parameter; move method encoding call from objc_expand_function_end(). (is_complex_decl, adorn_decl, gen_declarator, gen_declspecs, gen_declaration_1): Remove functions. (tmpbuf, RAW_DECLSPEC): Remove. (gen_declaration): Remove second parameter; simplify to deal with TYPE_P nodes instead of raw declspecs. (gen_type_name, gen_type_name_0): New functions. (gen_method_decl): Remove second parameter; call gen_type_name() instead of gen_declaration_1(). (dump_interface): Adjust calls to gen_declaration() and gen_method_decl(); do not allocate a separate string buffer. (init_objc): Allocate a larger string buffer to accommodate dump_interface(); adjust call to build_module_descriptor(); add call to build_module_initializer_routine() for the GNU runtime. (generate_classref_translation_entry): Do not call start_decl(); call finish_var_decl() instead of finish_decl(); call convert() instead of build_c_cast(). * objc-act.h (CLASS_OWN_IVARS): Remove accessor. (CLASS_BINFO_ELTS): Reduce from 6 to 5, now that CLASS_OWN_IVARS is gone. (OCTI_GNU_INIT_DECL, GNU_INIT_decl): New. (OCTI_ELLIPSIS_NODE, objc_ellipsis_node): Remove. (OCTI_ID_ID, id_type, objc_id_id): Rename to OCTI_ID_NAME, objc_object_type and objc_object_name, respectively. (OCTI_CLS_REF, OCTI_CLASS_NAME, objc_class_reference, objc_class_name): New. (IS_CLASS): New macro. (IS_ID, IS_SUPER): Robustify. (OCTI_EXECCLASS_DECL, execclass_decl): New. (finish_file, start_class, continue_class, finish_class, start_method_def, continue_method_def, finish_method_def, start_protocol, finish_protocol, objc_build_throw_stmt, objc_build_try_catch_finally_stmt, objc_build_synchronized_prologue, objc_build_synchronized_epilogue, objc_build_try_prologue, objc_build_try_epilogue, objc_build_catch_stmt, objc_build_catch_epilogue, objc_build_finally_prologue, objc_build_finally_epilogue, is_ivar, is_private, is_public, add_instance_variable, objc_add_method, get_super_receiver, objc_clear_super_receiver, get_class_ivars_from_name, get_class_reference, get_static_reference, get_object_reference, build_message_expr, finish_message_expr, build_selector_expr, build_ivar_reference, build_keyword_decl, build_method_decl, build_protocol_expr, build_objc_string_object, objc_declare_alias, objc_declare_class, objc_declare_protocols, objc_comptypes, objc_check_decl, build_encode_expr): Remove prototypes. (imp_count, cat_count): Make GGC-aware. (OBJC_SET_TYPE_NAME): New macro. From-SVN: r87168
2004-09-08 02:49:44 +02:00
return gen_type_name_0 (type);
1992-01-18 00:15:38 +01:00
}
/* Given a method tree, put a printable description into the given
buffer (overwriting) and return a pointer to the buffer. */
1992-01-18 00:15:38 +01:00
static char *
Makefile.in (c-parse.o): Depend on $(C_COMMON_H). [gcc/ChangeLog] 2004-09-07 Ziemowit Laski <zlaski@apple.com> * Makefile.in (c-parse.o): Depend on $(C_COMMON_H). * c-parse.in: Include c-common.h instead of objc-act.h. (ivar_decl_list, ivar_decls, ivar_decl, ivars, ivar_declarator, myparms, myparm): Remove %type declarations. (methodtype, optparms, OBJC_TYPE_QUAL, objc_quals, objc_qual, objc_typename, objc_try_catch_stmt, optellipsis): Add %type declarations. (objc_inherit_code, objc_public_flag): Remove. (typespec_nonreserved_nonattr): Call objc_get_protocol_qualified_type() instead of get_static_reference() and get_protocol_reference(). (stmt_nocomp): Call grokparm() on @catch parameter. (objcdef): Move semantic action to objc_finish_implementation(). (classdef): Move semantic action to objc_start_class_interface(), objc_continue_interface(), objc_finish_interface(), objc_start_class_implementation(), objc_continue_implementation(), objc_start_category_interface() and objc_start_category_implementation(). (protocoldef): Move semantic actions to objc_start_protocol() and objc_finish_interface(). (ivar_decl_list): Remove nonterminal. (visibility_spec): Move semantic actions to objc_set_visibility(). (ivar_decls): Remove assignment to $$. (ivar_decl): Rephrase in terms of component_decl; call objc_add_instance_variable(). (ivars, ivar_declarator): Remove nonterminals. (opt_semi): New nonterminal. (methodtype): Remove semantic actions. (methoddef): Move semantic actions to objc_set_method_type(), objc_start_method_definition() and objc_finish_method_definition(). (methodproto): Move semantic actions to objc_set_method_type() and objc_add_method_declaration(). (methoddecl): Use objc_typename instead of typename; move semantic actions to objc_build_method_signature(). (optarglist, myxdecls, mydecl, myparms, myparm): Remove nonterminals. (optparmlist): Express in terms of optparms and optellipsis. (optparms, optellipsis, objc_qual, objc_quals, objc_typename): New nonterminals. (keyworddecl): Use objc_typename instead of typename. (rid_to_yy): Mark RID_IN, RID_OUT, RID_INOUT, RID_BYCOPY, RID_BYREF and RID_ONEWAY as returning OBJC_TYPE_QUAL to yyparse(). [gcc/objc/ChangeLog] 2004-09-07 Ziemowit Laski <zlaski@apple.com> * Make-lang.in (objc/objc-parse.o): Depend on $(C_COMMON_H) instead of objc/objc-act.h. (objc/objc-act.o): Depend on $(HASHTAB_H). * objc-act.c: Include hashtab.h; in ObjC++ mode, include cp-tree.h and objcp-decl.h instead of c-tree.h. (build_module_descriptor, get_class_ivars, synth_id_with_class_suffix, error_with_ivar, gen_method_decl, gen_declaration, setup_string_decl, build_protocol_template): Adjust prototypes. (build_module_initializer_routine, start_class, continue_class, finish_class, start_method_def, objc_start_function, start_protocol, build_method_decl, objc_add_method, add_instance_variable, build_ivar_reference, is_ivar, is_private, get_super_receiver, build_selector_table_decl, objc_push_parm, objc_get_parm_info, gen_type_name, gen_type_name_0, start_var_decl, finish_var_decl, create_field_decl): New prototypes. (objc_expand_function_end, comp_method_with_proto, objc_expr_last, gen_declaration_1, gen_declarator, is_complex_decl, adorn_decl, define_decl, create_builtin_decl, gen_declspecs): Remove prototypes. (TYPE_ID): Rename to OBJECT_TYPEDEF_NAME. (CLASS_TYPEDEF_NAME): New. (TAG_EXECCLASS): Change from a global variable to a #define. (TAG_RETURN_STRUCT): Delete. (TAG_GNUINIT): New, holds '__objc_gnu_init' name. (objc_inherit_code, objc_public_flag): New, moved from c-parse.in. (string_descriptor): New struct. (string_htab): New hash table. (string_hash, string_eq): New prototypes. (generate_struct_by_value_array): Call create_field_decl() instead of create_builtin_decl(). (objc_init): Do not initialize objc_ellipsis_node or TAG_EXECCLASS; In ObjC++ mode, call cxx_init() instead of c_objc_common_init(). (objc_finish_file): In ObjC++, call instantiate_pending_templates() and cp_finish_file(). (define_decl, get_static_reference, get_protocol_reference, create_builtin_decl): Remove functions. (objc_start_class_interface, objc_start_category_interface, objc_start_protocol, objc_continue_interface, objc_finish_interface, objc_start_class_implementation, objc_start_category_implementation, objc_continue_implementation, objc_finish_implementation, objc_set_visibility, objc_set_method_type, objc_build_method_signature, objc_add_method_declaration, objc_start_method_definition, objc_add_instance_variable, objc_get_protocol_qualified_type, create_field_decl, start_var_decl, finish_var_decl): New functions. (setup_string_decl): Simplify since it is only called once. (synth_module_prologue): Call build_class_template(); predefine 'id' and 'Class' as typedefs; rename 'temp_type' to 'type'; disable debug hooks for duration of function; fix GNU runtime messenger signatures to correspond to reality; forward-declare '__objc_exec_class' for the GNU runtime; call build_selector_table_decl(); in ObjC++ mode, generate 'extern "C" { ... }' wrappers around synthesized declarations; call build_protocol_template() and build_category_template(). (string_hash, string_eq): New functions. (objc_build_string_object): Check metaclass correctness only once; store string literals in hash table. (objc_build_constructor): Do not convert initializer elements; adjust for ObjC++ impedance mismatch. (build_objc_symtab_template): Call create_field_decl() instead of create_builtin_decl(). (init_objc_symtab): Add missing conversion to initializer element. (build_metadata_decl): Call start_var_decl() instead of define_decl(). (generate_objc_symtab_decl): Do not call build_category_template(); call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(). (build_module_descriptor): Call create_field_decl() instead of grokfield(); call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(); always mark module descriptor as used; move GNU runtime-specific functionality to build_module_initializer_routine(). (build_module_initializer_routine): New function, broken off of build_module_descriptor(). (objc_static_init_needed_p, objc_generate_static_init_call): New functions. (generate_static_references, generate_strings, build_selector_translation_table, generate_descriptor_table, generate_ivars_list, generate_dispatch_table, generate_category): Call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(); build a type directly instead of via groktypename(). (build_selector_reference_decl, build_selector_table_decl, build_class_reference_decl, build_protocol_reference, generate_objc_image_info): Call start_var_decl() instead of build_decl(). (build_selector_reference): For GNU runtime, do not call build_selector_reference_decl(). (build_selector, build_typed_selector_reference): Always convert result to the selector type. (add_objc_string): Cast return value to 'char *'. (build_method_prototype_template, build_selector_template, build_method_template): Use actual selector type for fields pointing to selectors. (finish_objc): For GNU runtime, call build_module_initializer_routine() after build_module_descriptor(). (generate_protocol_list, generate_shared_structures): Call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(); build a type directly instead of via groktypename(). (synth_id_with_class_suffix): Return a string. (get_arg_type_list): For instance methods, use the instance type for 'self'; do not call groktypename_in_parm_context(). (build_objc_string_decl): Squash redeclaration errors in ObjC++. (objc_is_class_name): Use OBJC_TYPE_NAME instead of TYPE_NAME; handle RECORD_TYPEs in ObjC as well as ObjC++. (objc_is_id): New function. (objc_is_object_ptr): Return the canonical type node. (objc_get_class_ivars): Simplify using get_class_ivars(). (get_class_ivars): Remove second parameter; create a fresh copy of the ivar list for each call; do not check for existence of super class. (objc_eh_runtime_type): Mark #ifndef OBJCPLUS. (objc_init_exceptions): When using SJLJ-style exceptions, require the use of '-fobjc-exceptions' flag; do not require it for DWARF-style exceptions. (objc_build_exc_ptr, next_sjlj_build_try_catch_finally): Use objc_object_type instead of objc_id_type. (objc_begin_catch_clause): Convert the incoming PARM_DECL into a VAR_DECL before placing it in the appropriate scope; do not call define_decl(); adjust call to c_begin_compound_stmt(); use objc_object_type instead of objc_id_type. (build_next_objc_exception_stuff): Call create_field_decl() instead of create_builtin_decl(); construct type directly instead of calling groktypename(); use OBJC_VOID_AT_END to mark end of function parameters. (build_private_template): Adjust call to get_class_ivars(); build a type directly instead of via groktypename(). (build_protocol_template, build_method_prototype_list_template, build_method_prototype_template, build_category_template, build_selector_template, build_class_template, build_super_template, build_ivar_template, build_ivar_list_template, build_method_list_template, build_method_template): Call create_field_decl() instead of grokfield(). (objc_method_parm_type): Do not call groktypename(). (generate_descriptor_table): Call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(). (generate_method_descriptors, build_protocol_initializer, generate_dispatch_tables, build_category_initializer, build_shared_structure_initializer): Do not call groktypename(). (generate_protocols): Call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(); do not call groktypename(). (error_with_ivar): Remove last parameter. (check_ivars): Do not iterate ovar CLASS_RAW_IVARS lists in addition to CLASS_IVARS lists; adjust calls to error_with_ivar(). (generate_ivar_lists): Convert one of the initializer elements; do not call groktypename(). (get_arg_type_list, start_method_def, gen_method_def): Account for new representation of variable arguments and '...' in Objective-C methods; add Objective-C++ impedance matching code. (is_objc_type_qualifier): Remove function. (adjust_type_for_id_default): Simplify; there is no longer a need to wade through declspecs. (lookup_interface, start_class, continue_class, finish_class, start_method_def, start_protocol, build_method_decl, objc_add_method, add_instance_variable, build_ivar_reference, is_ivar, is_private, get_super_receiver, objc_build_finally_epilogue): Make into static functions. (receiver_is_class_object): Use new IS_CLASS() macro. (objc_build_message_expr): Tweak ObjC++ message argument handling; call objc_finish_message_expr() instead of finish_message_expr(). (finish_message_expr): Rename to objc_finish_message_expr(); use OBJC_TYPE_NAME and OBJC_SET_TYPE_NAME macros instead of TYPE_NAME. call gen_type_name() instead of gen_declaration(); call objc_is_id() instead of using IS_ID and IS_CLASS; Use objc_class_name instead of calling get_identifier("Class"); handle CONVERT_EXPRs in receiver. (build_objc_method_call, warn_with_method): Do not call groktypename(). (build_ivar_reference): Call convert() instead of clobbering in a type. (hash_init): Initialize string_htab hash table. (add_instance_variable): Simplify parameter list; do not call grokfield(); do not populate CLASS_IVARS list. (start_class): Check for the existence of super class, if one was specified. (continue_class): Use CLASS_RAW_IVARS rather than CLASS_IVARS; do not call build_class_template(); adjust call to get_class_ivars(); call build_decl(), pushdecl() and finish_decl() instead of define_decl(). (finish_class): Call build_decl(), pushdecl() and finish_decl() instead of define_decl(). (add_protocols): Use PROTOCOL_BINFO_ELTS for the tree vector size. (start_protocol): Do not call build_protocol_template(); use PROTOCOL_BINFO_ELTS for the tree vector size. (encode_type_qualifiers): Do not handle the 'const' qualifier here. (encode_pointer): Encode 'const char *' as 'r*', for backwards compatibility. (encode_array): Use HOST_WIDE_INT_PRINT_DEC instead of "%ld". (encode_type): Handle the 'const' qualifier here. (objc_parmlist): New global variable, sued by objc_push_parm and objc_get_parm_info(). (objc_push_parm, objc_get_parm_info): New functions. (objc_expr_last): Remove function. (synth_self_and_ucmd_args): For instance methods, use the instance type for 'self'; call objc_push_parm() instead of push_parm_decl(). (start_method_def): Do not call push_scope(), declare_parm_level(), pop_scope(), push_parm_decl(), store_parm_decls() or objc_expr_last(); just use objc_push_parm() and objc_get_parm_info(). (comp_method_with_proto): Remove function. (objc_types_are_equivalent): Strip away indirections before comparing underlying types. (comp_proto_with_proto): Do not call groktypename(); types are no longer in raw declspec format. (objc_start_function): New function. (really_start_method): Call comp_proto_with_proto() instead of comp_method_with_proto(); call objc_start_function() instead of hand-crafting a function declarator. (continue_method_def, objc_expand_function_end): Remove functions. (get_super_receiver): Call objc_get_current_scope() instead of get_current_scope(); reference 'super_class' field (instead of 'class'). (finish_method_def): Rename to objc_finish_method_definition() and add a function decl parameter; move method encoding call from objc_expand_function_end(). (is_complex_decl, adorn_decl, gen_declarator, gen_declspecs, gen_declaration_1): Remove functions. (tmpbuf, RAW_DECLSPEC): Remove. (gen_declaration): Remove second parameter; simplify to deal with TYPE_P nodes instead of raw declspecs. (gen_type_name, gen_type_name_0): New functions. (gen_method_decl): Remove second parameter; call gen_type_name() instead of gen_declaration_1(). (dump_interface): Adjust calls to gen_declaration() and gen_method_decl(); do not allocate a separate string buffer. (init_objc): Allocate a larger string buffer to accommodate dump_interface(); adjust call to build_module_descriptor(); add call to build_module_initializer_routine() for the GNU runtime. (generate_classref_translation_entry): Do not call start_decl(); call finish_var_decl() instead of finish_decl(); call convert() instead of build_c_cast(). * objc-act.h (CLASS_OWN_IVARS): Remove accessor. (CLASS_BINFO_ELTS): Reduce from 6 to 5, now that CLASS_OWN_IVARS is gone. (OCTI_GNU_INIT_DECL, GNU_INIT_decl): New. (OCTI_ELLIPSIS_NODE, objc_ellipsis_node): Remove. (OCTI_ID_ID, id_type, objc_id_id): Rename to OCTI_ID_NAME, objc_object_type and objc_object_name, respectively. (OCTI_CLS_REF, OCTI_CLASS_NAME, objc_class_reference, objc_class_name): New. (IS_CLASS): New macro. (IS_ID, IS_SUPER): Robustify. (OCTI_EXECCLASS_DECL, execclass_decl): New. (finish_file, start_class, continue_class, finish_class, start_method_def, continue_method_def, finish_method_def, start_protocol, finish_protocol, objc_build_throw_stmt, objc_build_try_catch_finally_stmt, objc_build_synchronized_prologue, objc_build_synchronized_epilogue, objc_build_try_prologue, objc_build_try_epilogue, objc_build_catch_stmt, objc_build_catch_epilogue, objc_build_finally_prologue, objc_build_finally_epilogue, is_ivar, is_private, is_public, add_instance_variable, objc_add_method, get_super_receiver, objc_clear_super_receiver, get_class_ivars_from_name, get_class_reference, get_static_reference, get_object_reference, build_message_expr, finish_message_expr, build_selector_expr, build_ivar_reference, build_keyword_decl, build_method_decl, build_protocol_expr, build_objc_string_object, objc_declare_alias, objc_declare_class, objc_declare_protocols, objc_comptypes, objc_check_decl, build_encode_expr): Remove prototypes. (imp_count, cat_count): Make GGC-aware. (OBJC_SET_TYPE_NAME): New macro. From-SVN: r87168
2004-09-08 02:49:44 +02:00
gen_method_decl (tree method)
1992-01-18 00:15:38 +01:00
{
tree chain;
Makefile.in (c-parse.o): Depend on $(C_COMMON_H). [gcc/ChangeLog] 2004-09-07 Ziemowit Laski <zlaski@apple.com> * Makefile.in (c-parse.o): Depend on $(C_COMMON_H). * c-parse.in: Include c-common.h instead of objc-act.h. (ivar_decl_list, ivar_decls, ivar_decl, ivars, ivar_declarator, myparms, myparm): Remove %type declarations. (methodtype, optparms, OBJC_TYPE_QUAL, objc_quals, objc_qual, objc_typename, objc_try_catch_stmt, optellipsis): Add %type declarations. (objc_inherit_code, objc_public_flag): Remove. (typespec_nonreserved_nonattr): Call objc_get_protocol_qualified_type() instead of get_static_reference() and get_protocol_reference(). (stmt_nocomp): Call grokparm() on @catch parameter. (objcdef): Move semantic action to objc_finish_implementation(). (classdef): Move semantic action to objc_start_class_interface(), objc_continue_interface(), objc_finish_interface(), objc_start_class_implementation(), objc_continue_implementation(), objc_start_category_interface() and objc_start_category_implementation(). (protocoldef): Move semantic actions to objc_start_protocol() and objc_finish_interface(). (ivar_decl_list): Remove nonterminal. (visibility_spec): Move semantic actions to objc_set_visibility(). (ivar_decls): Remove assignment to $$. (ivar_decl): Rephrase in terms of component_decl; call objc_add_instance_variable(). (ivars, ivar_declarator): Remove nonterminals. (opt_semi): New nonterminal. (methodtype): Remove semantic actions. (methoddef): Move semantic actions to objc_set_method_type(), objc_start_method_definition() and objc_finish_method_definition(). (methodproto): Move semantic actions to objc_set_method_type() and objc_add_method_declaration(). (methoddecl): Use objc_typename instead of typename; move semantic actions to objc_build_method_signature(). (optarglist, myxdecls, mydecl, myparms, myparm): Remove nonterminals. (optparmlist): Express in terms of optparms and optellipsis. (optparms, optellipsis, objc_qual, objc_quals, objc_typename): New nonterminals. (keyworddecl): Use objc_typename instead of typename. (rid_to_yy): Mark RID_IN, RID_OUT, RID_INOUT, RID_BYCOPY, RID_BYREF and RID_ONEWAY as returning OBJC_TYPE_QUAL to yyparse(). [gcc/objc/ChangeLog] 2004-09-07 Ziemowit Laski <zlaski@apple.com> * Make-lang.in (objc/objc-parse.o): Depend on $(C_COMMON_H) instead of objc/objc-act.h. (objc/objc-act.o): Depend on $(HASHTAB_H). * objc-act.c: Include hashtab.h; in ObjC++ mode, include cp-tree.h and objcp-decl.h instead of c-tree.h. (build_module_descriptor, get_class_ivars, synth_id_with_class_suffix, error_with_ivar, gen_method_decl, gen_declaration, setup_string_decl, build_protocol_template): Adjust prototypes. (build_module_initializer_routine, start_class, continue_class, finish_class, start_method_def, objc_start_function, start_protocol, build_method_decl, objc_add_method, add_instance_variable, build_ivar_reference, is_ivar, is_private, get_super_receiver, build_selector_table_decl, objc_push_parm, objc_get_parm_info, gen_type_name, gen_type_name_0, start_var_decl, finish_var_decl, create_field_decl): New prototypes. (objc_expand_function_end, comp_method_with_proto, objc_expr_last, gen_declaration_1, gen_declarator, is_complex_decl, adorn_decl, define_decl, create_builtin_decl, gen_declspecs): Remove prototypes. (TYPE_ID): Rename to OBJECT_TYPEDEF_NAME. (CLASS_TYPEDEF_NAME): New. (TAG_EXECCLASS): Change from a global variable to a #define. (TAG_RETURN_STRUCT): Delete. (TAG_GNUINIT): New, holds '__objc_gnu_init' name. (objc_inherit_code, objc_public_flag): New, moved from c-parse.in. (string_descriptor): New struct. (string_htab): New hash table. (string_hash, string_eq): New prototypes. (generate_struct_by_value_array): Call create_field_decl() instead of create_builtin_decl(). (objc_init): Do not initialize objc_ellipsis_node or TAG_EXECCLASS; In ObjC++ mode, call cxx_init() instead of c_objc_common_init(). (objc_finish_file): In ObjC++, call instantiate_pending_templates() and cp_finish_file(). (define_decl, get_static_reference, get_protocol_reference, create_builtin_decl): Remove functions. (objc_start_class_interface, objc_start_category_interface, objc_start_protocol, objc_continue_interface, objc_finish_interface, objc_start_class_implementation, objc_start_category_implementation, objc_continue_implementation, objc_finish_implementation, objc_set_visibility, objc_set_method_type, objc_build_method_signature, objc_add_method_declaration, objc_start_method_definition, objc_add_instance_variable, objc_get_protocol_qualified_type, create_field_decl, start_var_decl, finish_var_decl): New functions. (setup_string_decl): Simplify since it is only called once. (synth_module_prologue): Call build_class_template(); predefine 'id' and 'Class' as typedefs; rename 'temp_type' to 'type'; disable debug hooks for duration of function; fix GNU runtime messenger signatures to correspond to reality; forward-declare '__objc_exec_class' for the GNU runtime; call build_selector_table_decl(); in ObjC++ mode, generate 'extern "C" { ... }' wrappers around synthesized declarations; call build_protocol_template() and build_category_template(). (string_hash, string_eq): New functions. (objc_build_string_object): Check metaclass correctness only once; store string literals in hash table. (objc_build_constructor): Do not convert initializer elements; adjust for ObjC++ impedance mismatch. (build_objc_symtab_template): Call create_field_decl() instead of create_builtin_decl(). (init_objc_symtab): Add missing conversion to initializer element. (build_metadata_decl): Call start_var_decl() instead of define_decl(). (generate_objc_symtab_decl): Do not call build_category_template(); call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(). (build_module_descriptor): Call create_field_decl() instead of grokfield(); call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(); always mark module descriptor as used; move GNU runtime-specific functionality to build_module_initializer_routine(). (build_module_initializer_routine): New function, broken off of build_module_descriptor(). (objc_static_init_needed_p, objc_generate_static_init_call): New functions. (generate_static_references, generate_strings, build_selector_translation_table, generate_descriptor_table, generate_ivars_list, generate_dispatch_table, generate_category): Call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(); build a type directly instead of via groktypename(). (build_selector_reference_decl, build_selector_table_decl, build_class_reference_decl, build_protocol_reference, generate_objc_image_info): Call start_var_decl() instead of build_decl(). (build_selector_reference): For GNU runtime, do not call build_selector_reference_decl(). (build_selector, build_typed_selector_reference): Always convert result to the selector type. (add_objc_string): Cast return value to 'char *'. (build_method_prototype_template, build_selector_template, build_method_template): Use actual selector type for fields pointing to selectors. (finish_objc): For GNU runtime, call build_module_initializer_routine() after build_module_descriptor(). (generate_protocol_list, generate_shared_structures): Call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(); build a type directly instead of via groktypename(). (synth_id_with_class_suffix): Return a string. (get_arg_type_list): For instance methods, use the instance type for 'self'; do not call groktypename_in_parm_context(). (build_objc_string_decl): Squash redeclaration errors in ObjC++. (objc_is_class_name): Use OBJC_TYPE_NAME instead of TYPE_NAME; handle RECORD_TYPEs in ObjC as well as ObjC++. (objc_is_id): New function. (objc_is_object_ptr): Return the canonical type node. (objc_get_class_ivars): Simplify using get_class_ivars(). (get_class_ivars): Remove second parameter; create a fresh copy of the ivar list for each call; do not check for existence of super class. (objc_eh_runtime_type): Mark #ifndef OBJCPLUS. (objc_init_exceptions): When using SJLJ-style exceptions, require the use of '-fobjc-exceptions' flag; do not require it for DWARF-style exceptions. (objc_build_exc_ptr, next_sjlj_build_try_catch_finally): Use objc_object_type instead of objc_id_type. (objc_begin_catch_clause): Convert the incoming PARM_DECL into a VAR_DECL before placing it in the appropriate scope; do not call define_decl(); adjust call to c_begin_compound_stmt(); use objc_object_type instead of objc_id_type. (build_next_objc_exception_stuff): Call create_field_decl() instead of create_builtin_decl(); construct type directly instead of calling groktypename(); use OBJC_VOID_AT_END to mark end of function parameters. (build_private_template): Adjust call to get_class_ivars(); build a type directly instead of via groktypename(). (build_protocol_template, build_method_prototype_list_template, build_method_prototype_template, build_category_template, build_selector_template, build_class_template, build_super_template, build_ivar_template, build_ivar_list_template, build_method_list_template, build_method_template): Call create_field_decl() instead of grokfield(). (objc_method_parm_type): Do not call groktypename(). (generate_descriptor_table): Call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(). (generate_method_descriptors, build_protocol_initializer, generate_dispatch_tables, build_category_initializer, build_shared_structure_initializer): Do not call groktypename(). (generate_protocols): Call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(); do not call groktypename(). (error_with_ivar): Remove last parameter. (check_ivars): Do not iterate ovar CLASS_RAW_IVARS lists in addition to CLASS_IVARS lists; adjust calls to error_with_ivar(). (generate_ivar_lists): Convert one of the initializer elements; do not call groktypename(). (get_arg_type_list, start_method_def, gen_method_def): Account for new representation of variable arguments and '...' in Objective-C methods; add Objective-C++ impedance matching code. (is_objc_type_qualifier): Remove function. (adjust_type_for_id_default): Simplify; there is no longer a need to wade through declspecs. (lookup_interface, start_class, continue_class, finish_class, start_method_def, start_protocol, build_method_decl, objc_add_method, add_instance_variable, build_ivar_reference, is_ivar, is_private, get_super_receiver, objc_build_finally_epilogue): Make into static functions. (receiver_is_class_object): Use new IS_CLASS() macro. (objc_build_message_expr): Tweak ObjC++ message argument handling; call objc_finish_message_expr() instead of finish_message_expr(). (finish_message_expr): Rename to objc_finish_message_expr(); use OBJC_TYPE_NAME and OBJC_SET_TYPE_NAME macros instead of TYPE_NAME. call gen_type_name() instead of gen_declaration(); call objc_is_id() instead of using IS_ID and IS_CLASS; Use objc_class_name instead of calling get_identifier("Class"); handle CONVERT_EXPRs in receiver. (build_objc_method_call, warn_with_method): Do not call groktypename(). (build_ivar_reference): Call convert() instead of clobbering in a type. (hash_init): Initialize string_htab hash table. (add_instance_variable): Simplify parameter list; do not call grokfield(); do not populate CLASS_IVARS list. (start_class): Check for the existence of super class, if one was specified. (continue_class): Use CLASS_RAW_IVARS rather than CLASS_IVARS; do not call build_class_template(); adjust call to get_class_ivars(); call build_decl(), pushdecl() and finish_decl() instead of define_decl(). (finish_class): Call build_decl(), pushdecl() and finish_decl() instead of define_decl(). (add_protocols): Use PROTOCOL_BINFO_ELTS for the tree vector size. (start_protocol): Do not call build_protocol_template(); use PROTOCOL_BINFO_ELTS for the tree vector size. (encode_type_qualifiers): Do not handle the 'const' qualifier here. (encode_pointer): Encode 'const char *' as 'r*', for backwards compatibility. (encode_array): Use HOST_WIDE_INT_PRINT_DEC instead of "%ld". (encode_type): Handle the 'const' qualifier here. (objc_parmlist): New global variable, sued by objc_push_parm and objc_get_parm_info(). (objc_push_parm, objc_get_parm_info): New functions. (objc_expr_last): Remove function. (synth_self_and_ucmd_args): For instance methods, use the instance type for 'self'; call objc_push_parm() instead of push_parm_decl(). (start_method_def): Do not call push_scope(), declare_parm_level(), pop_scope(), push_parm_decl(), store_parm_decls() or objc_expr_last(); just use objc_push_parm() and objc_get_parm_info(). (comp_method_with_proto): Remove function. (objc_types_are_equivalent): Strip away indirections before comparing underlying types. (comp_proto_with_proto): Do not call groktypename(); types are no longer in raw declspec format. (objc_start_function): New function. (really_start_method): Call comp_proto_with_proto() instead of comp_method_with_proto(); call objc_start_function() instead of hand-crafting a function declarator. (continue_method_def, objc_expand_function_end): Remove functions. (get_super_receiver): Call objc_get_current_scope() instead of get_current_scope(); reference 'super_class' field (instead of 'class'). (finish_method_def): Rename to objc_finish_method_definition() and add a function decl parameter; move method encoding call from objc_expand_function_end(). (is_complex_decl, adorn_decl, gen_declarator, gen_declspecs, gen_declaration_1): Remove functions. (tmpbuf, RAW_DECLSPEC): Remove. (gen_declaration): Remove second parameter; simplify to deal with TYPE_P nodes instead of raw declspecs. (gen_type_name, gen_type_name_0): New functions. (gen_method_decl): Remove second parameter; call gen_type_name() instead of gen_declaration_1(). (dump_interface): Adjust calls to gen_declaration() and gen_method_decl(); do not allocate a separate string buffer. (init_objc): Allocate a larger string buffer to accommodate dump_interface(); adjust call to build_module_descriptor(); add call to build_module_initializer_routine() for the GNU runtime. (generate_classref_translation_entry): Do not call start_decl(); call finish_var_decl() instead of finish_decl(); call convert() instead of build_c_cast(). * objc-act.h (CLASS_OWN_IVARS): Remove accessor. (CLASS_BINFO_ELTS): Reduce from 6 to 5, now that CLASS_OWN_IVARS is gone. (OCTI_GNU_INIT_DECL, GNU_INIT_decl): New. (OCTI_ELLIPSIS_NODE, objc_ellipsis_node): Remove. (OCTI_ID_ID, id_type, objc_id_id): Rename to OCTI_ID_NAME, objc_object_type and objc_object_name, respectively. (OCTI_CLS_REF, OCTI_CLASS_NAME, objc_class_reference, objc_class_name): New. (IS_CLASS): New macro. (IS_ID, IS_SUPER): Robustify. (OCTI_EXECCLASS_DECL, execclass_decl): New. (finish_file, start_class, continue_class, finish_class, start_method_def, continue_method_def, finish_method_def, start_protocol, finish_protocol, objc_build_throw_stmt, objc_build_try_catch_finally_stmt, objc_build_synchronized_prologue, objc_build_synchronized_epilogue, objc_build_try_prologue, objc_build_try_epilogue, objc_build_catch_stmt, objc_build_catch_epilogue, objc_build_finally_prologue, objc_build_finally_epilogue, is_ivar, is_private, is_public, add_instance_variable, objc_add_method, get_super_receiver, objc_clear_super_receiver, get_class_ivars_from_name, get_class_reference, get_static_reference, get_object_reference, build_message_expr, finish_message_expr, build_selector_expr, build_ivar_reference, build_keyword_decl, build_method_decl, build_protocol_expr, build_objc_string_object, objc_declare_alias, objc_declare_class, objc_declare_protocols, objc_comptypes, objc_check_decl, build_encode_expr): Remove prototypes. (imp_count, cat_count): Make GGC-aware. (OBJC_SET_TYPE_NAME): New macro. From-SVN: r87168
2004-09-08 02:49:44 +02:00
strcpy (errbuf, "("); /* NB: Do _not_ call strcat() here. */
gen_type_name_0 (TREE_VALUE (TREE_TYPE (method)));
strcat (errbuf, ")");
1992-01-18 00:15:38 +01:00
chain = METHOD_SEL_ARGS (method);
Makefile.in (c-parse.o): Depend on $(C_COMMON_H). [gcc/ChangeLog] 2004-09-07 Ziemowit Laski <zlaski@apple.com> * Makefile.in (c-parse.o): Depend on $(C_COMMON_H). * c-parse.in: Include c-common.h instead of objc-act.h. (ivar_decl_list, ivar_decls, ivar_decl, ivars, ivar_declarator, myparms, myparm): Remove %type declarations. (methodtype, optparms, OBJC_TYPE_QUAL, objc_quals, objc_qual, objc_typename, objc_try_catch_stmt, optellipsis): Add %type declarations. (objc_inherit_code, objc_public_flag): Remove. (typespec_nonreserved_nonattr): Call objc_get_protocol_qualified_type() instead of get_static_reference() and get_protocol_reference(). (stmt_nocomp): Call grokparm() on @catch parameter. (objcdef): Move semantic action to objc_finish_implementation(). (classdef): Move semantic action to objc_start_class_interface(), objc_continue_interface(), objc_finish_interface(), objc_start_class_implementation(), objc_continue_implementation(), objc_start_category_interface() and objc_start_category_implementation(). (protocoldef): Move semantic actions to objc_start_protocol() and objc_finish_interface(). (ivar_decl_list): Remove nonterminal. (visibility_spec): Move semantic actions to objc_set_visibility(). (ivar_decls): Remove assignment to $$. (ivar_decl): Rephrase in terms of component_decl; call objc_add_instance_variable(). (ivars, ivar_declarator): Remove nonterminals. (opt_semi): New nonterminal. (methodtype): Remove semantic actions. (methoddef): Move semantic actions to objc_set_method_type(), objc_start_method_definition() and objc_finish_method_definition(). (methodproto): Move semantic actions to objc_set_method_type() and objc_add_method_declaration(). (methoddecl): Use objc_typename instead of typename; move semantic actions to objc_build_method_signature(). (optarglist, myxdecls, mydecl, myparms, myparm): Remove nonterminals. (optparmlist): Express in terms of optparms and optellipsis. (optparms, optellipsis, objc_qual, objc_quals, objc_typename): New nonterminals. (keyworddecl): Use objc_typename instead of typename. (rid_to_yy): Mark RID_IN, RID_OUT, RID_INOUT, RID_BYCOPY, RID_BYREF and RID_ONEWAY as returning OBJC_TYPE_QUAL to yyparse(). [gcc/objc/ChangeLog] 2004-09-07 Ziemowit Laski <zlaski@apple.com> * Make-lang.in (objc/objc-parse.o): Depend on $(C_COMMON_H) instead of objc/objc-act.h. (objc/objc-act.o): Depend on $(HASHTAB_H). * objc-act.c: Include hashtab.h; in ObjC++ mode, include cp-tree.h and objcp-decl.h instead of c-tree.h. (build_module_descriptor, get_class_ivars, synth_id_with_class_suffix, error_with_ivar, gen_method_decl, gen_declaration, setup_string_decl, build_protocol_template): Adjust prototypes. (build_module_initializer_routine, start_class, continue_class, finish_class, start_method_def, objc_start_function, start_protocol, build_method_decl, objc_add_method, add_instance_variable, build_ivar_reference, is_ivar, is_private, get_super_receiver, build_selector_table_decl, objc_push_parm, objc_get_parm_info, gen_type_name, gen_type_name_0, start_var_decl, finish_var_decl, create_field_decl): New prototypes. (objc_expand_function_end, comp_method_with_proto, objc_expr_last, gen_declaration_1, gen_declarator, is_complex_decl, adorn_decl, define_decl, create_builtin_decl, gen_declspecs): Remove prototypes. (TYPE_ID): Rename to OBJECT_TYPEDEF_NAME. (CLASS_TYPEDEF_NAME): New. (TAG_EXECCLASS): Change from a global variable to a #define. (TAG_RETURN_STRUCT): Delete. (TAG_GNUINIT): New, holds '__objc_gnu_init' name. (objc_inherit_code, objc_public_flag): New, moved from c-parse.in. (string_descriptor): New struct. (string_htab): New hash table. (string_hash, string_eq): New prototypes. (generate_struct_by_value_array): Call create_field_decl() instead of create_builtin_decl(). (objc_init): Do not initialize objc_ellipsis_node or TAG_EXECCLASS; In ObjC++ mode, call cxx_init() instead of c_objc_common_init(). (objc_finish_file): In ObjC++, call instantiate_pending_templates() and cp_finish_file(). (define_decl, get_static_reference, get_protocol_reference, create_builtin_decl): Remove functions. (objc_start_class_interface, objc_start_category_interface, objc_start_protocol, objc_continue_interface, objc_finish_interface, objc_start_class_implementation, objc_start_category_implementation, objc_continue_implementation, objc_finish_implementation, objc_set_visibility, objc_set_method_type, objc_build_method_signature, objc_add_method_declaration, objc_start_method_definition, objc_add_instance_variable, objc_get_protocol_qualified_type, create_field_decl, start_var_decl, finish_var_decl): New functions. (setup_string_decl): Simplify since it is only called once. (synth_module_prologue): Call build_class_template(); predefine 'id' and 'Class' as typedefs; rename 'temp_type' to 'type'; disable debug hooks for duration of function; fix GNU runtime messenger signatures to correspond to reality; forward-declare '__objc_exec_class' for the GNU runtime; call build_selector_table_decl(); in ObjC++ mode, generate 'extern "C" { ... }' wrappers around synthesized declarations; call build_protocol_template() and build_category_template(). (string_hash, string_eq): New functions. (objc_build_string_object): Check metaclass correctness only once; store string literals in hash table. (objc_build_constructor): Do not convert initializer elements; adjust for ObjC++ impedance mismatch. (build_objc_symtab_template): Call create_field_decl() instead of create_builtin_decl(). (init_objc_symtab): Add missing conversion to initializer element. (build_metadata_decl): Call start_var_decl() instead of define_decl(). (generate_objc_symtab_decl): Do not call build_category_template(); call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(). (build_module_descriptor): Call create_field_decl() instead of grokfield(); call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(); always mark module descriptor as used; move GNU runtime-specific functionality to build_module_initializer_routine(). (build_module_initializer_routine): New function, broken off of build_module_descriptor(). (objc_static_init_needed_p, objc_generate_static_init_call): New functions. (generate_static_references, generate_strings, build_selector_translation_table, generate_descriptor_table, generate_ivars_list, generate_dispatch_table, generate_category): Call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(); build a type directly instead of via groktypename(). (build_selector_reference_decl, build_selector_table_decl, build_class_reference_decl, build_protocol_reference, generate_objc_image_info): Call start_var_decl() instead of build_decl(). (build_selector_reference): For GNU runtime, do not call build_selector_reference_decl(). (build_selector, build_typed_selector_reference): Always convert result to the selector type. (add_objc_string): Cast return value to 'char *'. (build_method_prototype_template, build_selector_template, build_method_template): Use actual selector type for fields pointing to selectors. (finish_objc): For GNU runtime, call build_module_initializer_routine() after build_module_descriptor(). (generate_protocol_list, generate_shared_structures): Call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(); build a type directly instead of via groktypename(). (synth_id_with_class_suffix): Return a string. (get_arg_type_list): For instance methods, use the instance type for 'self'; do not call groktypename_in_parm_context(). (build_objc_string_decl): Squash redeclaration errors in ObjC++. (objc_is_class_name): Use OBJC_TYPE_NAME instead of TYPE_NAME; handle RECORD_TYPEs in ObjC as well as ObjC++. (objc_is_id): New function. (objc_is_object_ptr): Return the canonical type node. (objc_get_class_ivars): Simplify using get_class_ivars(). (get_class_ivars): Remove second parameter; create a fresh copy of the ivar list for each call; do not check for existence of super class. (objc_eh_runtime_type): Mark #ifndef OBJCPLUS. (objc_init_exceptions): When using SJLJ-style exceptions, require the use of '-fobjc-exceptions' flag; do not require it for DWARF-style exceptions. (objc_build_exc_ptr, next_sjlj_build_try_catch_finally): Use objc_object_type instead of objc_id_type. (objc_begin_catch_clause): Convert the incoming PARM_DECL into a VAR_DECL before placing it in the appropriate scope; do not call define_decl(); adjust call to c_begin_compound_stmt(); use objc_object_type instead of objc_id_type. (build_next_objc_exception_stuff): Call create_field_decl() instead of create_builtin_decl(); construct type directly instead of calling groktypename(); use OBJC_VOID_AT_END to mark end of function parameters. (build_private_template): Adjust call to get_class_ivars(); build a type directly instead of via groktypename(). (build_protocol_template, build_method_prototype_list_template, build_method_prototype_template, build_category_template, build_selector_template, build_class_template, build_super_template, build_ivar_template, build_ivar_list_template, build_method_list_template, build_method_template): Call create_field_decl() instead of grokfield(). (objc_method_parm_type): Do not call groktypename(). (generate_descriptor_table): Call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(). (generate_method_descriptors, build_protocol_initializer, generate_dispatch_tables, build_category_initializer, build_shared_structure_initializer): Do not call groktypename(). (generate_protocols): Call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(); do not call groktypename(). (error_with_ivar): Remove last parameter. (check_ivars): Do not iterate ovar CLASS_RAW_IVARS lists in addition to CLASS_IVARS lists; adjust calls to error_with_ivar(). (generate_ivar_lists): Convert one of the initializer elements; do not call groktypename(). (get_arg_type_list, start_method_def, gen_method_def): Account for new representation of variable arguments and '...' in Objective-C methods; add Objective-C++ impedance matching code. (is_objc_type_qualifier): Remove function. (adjust_type_for_id_default): Simplify; there is no longer a need to wade through declspecs. (lookup_interface, start_class, continue_class, finish_class, start_method_def, start_protocol, build_method_decl, objc_add_method, add_instance_variable, build_ivar_reference, is_ivar, is_private, get_super_receiver, objc_build_finally_epilogue): Make into static functions. (receiver_is_class_object): Use new IS_CLASS() macro. (objc_build_message_expr): Tweak ObjC++ message argument handling; call objc_finish_message_expr() instead of finish_message_expr(). (finish_message_expr): Rename to objc_finish_message_expr(); use OBJC_TYPE_NAME and OBJC_SET_TYPE_NAME macros instead of TYPE_NAME. call gen_type_name() instead of gen_declaration(); call objc_is_id() instead of using IS_ID and IS_CLASS; Use objc_class_name instead of calling get_identifier("Class"); handle CONVERT_EXPRs in receiver. (build_objc_method_call, warn_with_method): Do not call groktypename(). (build_ivar_reference): Call convert() instead of clobbering in a type. (hash_init): Initialize string_htab hash table. (add_instance_variable): Simplify parameter list; do not call grokfield(); do not populate CLASS_IVARS list. (start_class): Check for the existence of super class, if one was specified. (continue_class): Use CLASS_RAW_IVARS rather than CLASS_IVARS; do not call build_class_template(); adjust call to get_class_ivars(); call build_decl(), pushdecl() and finish_decl() instead of define_decl(). (finish_class): Call build_decl(), pushdecl() and finish_decl() instead of define_decl(). (add_protocols): Use PROTOCOL_BINFO_ELTS for the tree vector size. (start_protocol): Do not call build_protocol_template(); use PROTOCOL_BINFO_ELTS for the tree vector size. (encode_type_qualifiers): Do not handle the 'const' qualifier here. (encode_pointer): Encode 'const char *' as 'r*', for backwards compatibility. (encode_array): Use HOST_WIDE_INT_PRINT_DEC instead of "%ld". (encode_type): Handle the 'const' qualifier here. (objc_parmlist): New global variable, sued by objc_push_parm and objc_get_parm_info(). (objc_push_parm, objc_get_parm_info): New functions. (objc_expr_last): Remove function. (synth_self_and_ucmd_args): For instance methods, use the instance type for 'self'; call objc_push_parm() instead of push_parm_decl(). (start_method_def): Do not call push_scope(), declare_parm_level(), pop_scope(), push_parm_decl(), store_parm_decls() or objc_expr_last(); just use objc_push_parm() and objc_get_parm_info(). (comp_method_with_proto): Remove function. (objc_types_are_equivalent): Strip away indirections before comparing underlying types. (comp_proto_with_proto): Do not call groktypename(); types are no longer in raw declspec format. (objc_start_function): New function. (really_start_method): Call comp_proto_with_proto() instead of comp_method_with_proto(); call objc_start_function() instead of hand-crafting a function declarator. (continue_method_def, objc_expand_function_end): Remove functions. (get_super_receiver): Call objc_get_current_scope() instead of get_current_scope(); reference 'super_class' field (instead of 'class'). (finish_method_def): Rename to objc_finish_method_definition() and add a function decl parameter; move method encoding call from objc_expand_function_end(). (is_complex_decl, adorn_decl, gen_declarator, gen_declspecs, gen_declaration_1): Remove functions. (tmpbuf, RAW_DECLSPEC): Remove. (gen_declaration): Remove second parameter; simplify to deal with TYPE_P nodes instead of raw declspecs. (gen_type_name, gen_type_name_0): New functions. (gen_method_decl): Remove second parameter; call gen_type_name() instead of gen_declaration_1(). (dump_interface): Adjust calls to gen_declaration() and gen_method_decl(); do not allocate a separate string buffer. (init_objc): Allocate a larger string buffer to accommodate dump_interface(); adjust call to build_module_descriptor(); add call to build_module_initializer_routine() for the GNU runtime. (generate_classref_translation_entry): Do not call start_decl(); call finish_var_decl() instead of finish_decl(); call convert() instead of build_c_cast(). * objc-act.h (CLASS_OWN_IVARS): Remove accessor. (CLASS_BINFO_ELTS): Reduce from 6 to 5, now that CLASS_OWN_IVARS is gone. (OCTI_GNU_INIT_DECL, GNU_INIT_decl): New. (OCTI_ELLIPSIS_NODE, objc_ellipsis_node): Remove. (OCTI_ID_ID, id_type, objc_id_id): Rename to OCTI_ID_NAME, objc_object_type and objc_object_name, respectively. (OCTI_CLS_REF, OCTI_CLASS_NAME, objc_class_reference, objc_class_name): New. (IS_CLASS): New macro. (IS_ID, IS_SUPER): Robustify. (OCTI_EXECCLASS_DECL, execclass_decl): New. (finish_file, start_class, continue_class, finish_class, start_method_def, continue_method_def, finish_method_def, start_protocol, finish_protocol, objc_build_throw_stmt, objc_build_try_catch_finally_stmt, objc_build_synchronized_prologue, objc_build_synchronized_epilogue, objc_build_try_prologue, objc_build_try_epilogue, objc_build_catch_stmt, objc_build_catch_epilogue, objc_build_finally_prologue, objc_build_finally_epilogue, is_ivar, is_private, is_public, add_instance_variable, objc_add_method, get_super_receiver, objc_clear_super_receiver, get_class_ivars_from_name, get_class_reference, get_static_reference, get_object_reference, build_message_expr, finish_message_expr, build_selector_expr, build_ivar_reference, build_keyword_decl, build_method_decl, build_protocol_expr, build_objc_string_object, objc_declare_alias, objc_declare_class, objc_declare_protocols, objc_comptypes, objc_check_decl, build_encode_expr): Remove prototypes. (imp_count, cat_count): Make GGC-aware. (OBJC_SET_TYPE_NAME): New macro. From-SVN: r87168
2004-09-08 02:49:44 +02:00
1992-01-18 00:15:38 +01:00
if (chain)
{
1996-07-04 00:07:53 +02:00
/* We have a chain of keyword_decls. */
1992-01-18 00:15:38 +01:00
do
{
if (KEYWORD_KEY_NAME (chain))
Makefile.in (c-parse.o): Depend on $(C_COMMON_H). [gcc/ChangeLog] 2004-09-07 Ziemowit Laski <zlaski@apple.com> * Makefile.in (c-parse.o): Depend on $(C_COMMON_H). * c-parse.in: Include c-common.h instead of objc-act.h. (ivar_decl_list, ivar_decls, ivar_decl, ivars, ivar_declarator, myparms, myparm): Remove %type declarations. (methodtype, optparms, OBJC_TYPE_QUAL, objc_quals, objc_qual, objc_typename, objc_try_catch_stmt, optellipsis): Add %type declarations. (objc_inherit_code, objc_public_flag): Remove. (typespec_nonreserved_nonattr): Call objc_get_protocol_qualified_type() instead of get_static_reference() and get_protocol_reference(). (stmt_nocomp): Call grokparm() on @catch parameter. (objcdef): Move semantic action to objc_finish_implementation(). (classdef): Move semantic action to objc_start_class_interface(), objc_continue_interface(), objc_finish_interface(), objc_start_class_implementation(), objc_continue_implementation(), objc_start_category_interface() and objc_start_category_implementation(). (protocoldef): Move semantic actions to objc_start_protocol() and objc_finish_interface(). (ivar_decl_list): Remove nonterminal. (visibility_spec): Move semantic actions to objc_set_visibility(). (ivar_decls): Remove assignment to $$. (ivar_decl): Rephrase in terms of component_decl; call objc_add_instance_variable(). (ivars, ivar_declarator): Remove nonterminals. (opt_semi): New nonterminal. (methodtype): Remove semantic actions. (methoddef): Move semantic actions to objc_set_method_type(), objc_start_method_definition() and objc_finish_method_definition(). (methodproto): Move semantic actions to objc_set_method_type() and objc_add_method_declaration(). (methoddecl): Use objc_typename instead of typename; move semantic actions to objc_build_method_signature(). (optarglist, myxdecls, mydecl, myparms, myparm): Remove nonterminals. (optparmlist): Express in terms of optparms and optellipsis. (optparms, optellipsis, objc_qual, objc_quals, objc_typename): New nonterminals. (keyworddecl): Use objc_typename instead of typename. (rid_to_yy): Mark RID_IN, RID_OUT, RID_INOUT, RID_BYCOPY, RID_BYREF and RID_ONEWAY as returning OBJC_TYPE_QUAL to yyparse(). [gcc/objc/ChangeLog] 2004-09-07 Ziemowit Laski <zlaski@apple.com> * Make-lang.in (objc/objc-parse.o): Depend on $(C_COMMON_H) instead of objc/objc-act.h. (objc/objc-act.o): Depend on $(HASHTAB_H). * objc-act.c: Include hashtab.h; in ObjC++ mode, include cp-tree.h and objcp-decl.h instead of c-tree.h. (build_module_descriptor, get_class_ivars, synth_id_with_class_suffix, error_with_ivar, gen_method_decl, gen_declaration, setup_string_decl, build_protocol_template): Adjust prototypes. (build_module_initializer_routine, start_class, continue_class, finish_class, start_method_def, objc_start_function, start_protocol, build_method_decl, objc_add_method, add_instance_variable, build_ivar_reference, is_ivar, is_private, get_super_receiver, build_selector_table_decl, objc_push_parm, objc_get_parm_info, gen_type_name, gen_type_name_0, start_var_decl, finish_var_decl, create_field_decl): New prototypes. (objc_expand_function_end, comp_method_with_proto, objc_expr_last, gen_declaration_1, gen_declarator, is_complex_decl, adorn_decl, define_decl, create_builtin_decl, gen_declspecs): Remove prototypes. (TYPE_ID): Rename to OBJECT_TYPEDEF_NAME. (CLASS_TYPEDEF_NAME): New. (TAG_EXECCLASS): Change from a global variable to a #define. (TAG_RETURN_STRUCT): Delete. (TAG_GNUINIT): New, holds '__objc_gnu_init' name. (objc_inherit_code, objc_public_flag): New, moved from c-parse.in. (string_descriptor): New struct. (string_htab): New hash table. (string_hash, string_eq): New prototypes. (generate_struct_by_value_array): Call create_field_decl() instead of create_builtin_decl(). (objc_init): Do not initialize objc_ellipsis_node or TAG_EXECCLASS; In ObjC++ mode, call cxx_init() instead of c_objc_common_init(). (objc_finish_file): In ObjC++, call instantiate_pending_templates() and cp_finish_file(). (define_decl, get_static_reference, get_protocol_reference, create_builtin_decl): Remove functions. (objc_start_class_interface, objc_start_category_interface, objc_start_protocol, objc_continue_interface, objc_finish_interface, objc_start_class_implementation, objc_start_category_implementation, objc_continue_implementation, objc_finish_implementation, objc_set_visibility, objc_set_method_type, objc_build_method_signature, objc_add_method_declaration, objc_start_method_definition, objc_add_instance_variable, objc_get_protocol_qualified_type, create_field_decl, start_var_decl, finish_var_decl): New functions. (setup_string_decl): Simplify since it is only called once. (synth_module_prologue): Call build_class_template(); predefine 'id' and 'Class' as typedefs; rename 'temp_type' to 'type'; disable debug hooks for duration of function; fix GNU runtime messenger signatures to correspond to reality; forward-declare '__objc_exec_class' for the GNU runtime; call build_selector_table_decl(); in ObjC++ mode, generate 'extern "C" { ... }' wrappers around synthesized declarations; call build_protocol_template() and build_category_template(). (string_hash, string_eq): New functions. (objc_build_string_object): Check metaclass correctness only once; store string literals in hash table. (objc_build_constructor): Do not convert initializer elements; adjust for ObjC++ impedance mismatch. (build_objc_symtab_template): Call create_field_decl() instead of create_builtin_decl(). (init_objc_symtab): Add missing conversion to initializer element. (build_metadata_decl): Call start_var_decl() instead of define_decl(). (generate_objc_symtab_decl): Do not call build_category_template(); call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(). (build_module_descriptor): Call create_field_decl() instead of grokfield(); call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(); always mark module descriptor as used; move GNU runtime-specific functionality to build_module_initializer_routine(). (build_module_initializer_routine): New function, broken off of build_module_descriptor(). (objc_static_init_needed_p, objc_generate_static_init_call): New functions. (generate_static_references, generate_strings, build_selector_translation_table, generate_descriptor_table, generate_ivars_list, generate_dispatch_table, generate_category): Call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(); build a type directly instead of via groktypename(). (build_selector_reference_decl, build_selector_table_decl, build_class_reference_decl, build_protocol_reference, generate_objc_image_info): Call start_var_decl() instead of build_decl(). (build_selector_reference): For GNU runtime, do not call build_selector_reference_decl(). (build_selector, build_typed_selector_reference): Always convert result to the selector type. (add_objc_string): Cast return value to 'char *'. (build_method_prototype_template, build_selector_template, build_method_template): Use actual selector type for fields pointing to selectors. (finish_objc): For GNU runtime, call build_module_initializer_routine() after build_module_descriptor(). (generate_protocol_list, generate_shared_structures): Call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(); build a type directly instead of via groktypename(). (synth_id_with_class_suffix): Return a string. (get_arg_type_list): For instance methods, use the instance type for 'self'; do not call groktypename_in_parm_context(). (build_objc_string_decl): Squash redeclaration errors in ObjC++. (objc_is_class_name): Use OBJC_TYPE_NAME instead of TYPE_NAME; handle RECORD_TYPEs in ObjC as well as ObjC++. (objc_is_id): New function. (objc_is_object_ptr): Return the canonical type node. (objc_get_class_ivars): Simplify using get_class_ivars(). (get_class_ivars): Remove second parameter; create a fresh copy of the ivar list for each call; do not check for existence of super class. (objc_eh_runtime_type): Mark #ifndef OBJCPLUS. (objc_init_exceptions): When using SJLJ-style exceptions, require the use of '-fobjc-exceptions' flag; do not require it for DWARF-style exceptions. (objc_build_exc_ptr, next_sjlj_build_try_catch_finally): Use objc_object_type instead of objc_id_type. (objc_begin_catch_clause): Convert the incoming PARM_DECL into a VAR_DECL before placing it in the appropriate scope; do not call define_decl(); adjust call to c_begin_compound_stmt(); use objc_object_type instead of objc_id_type. (build_next_objc_exception_stuff): Call create_field_decl() instead of create_builtin_decl(); construct type directly instead of calling groktypename(); use OBJC_VOID_AT_END to mark end of function parameters. (build_private_template): Adjust call to get_class_ivars(); build a type directly instead of via groktypename(). (build_protocol_template, build_method_prototype_list_template, build_method_prototype_template, build_category_template, build_selector_template, build_class_template, build_super_template, build_ivar_template, build_ivar_list_template, build_method_list_template, build_method_template): Call create_field_decl() instead of grokfield(). (objc_method_parm_type): Do not call groktypename(). (generate_descriptor_table): Call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(). (generate_method_descriptors, build_protocol_initializer, generate_dispatch_tables, build_category_initializer, build_shared_structure_initializer): Do not call groktypename(). (generate_protocols): Call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(); do not call groktypename(). (error_with_ivar): Remove last parameter. (check_ivars): Do not iterate ovar CLASS_RAW_IVARS lists in addition to CLASS_IVARS lists; adjust calls to error_with_ivar(). (generate_ivar_lists): Convert one of the initializer elements; do not call groktypename(). (get_arg_type_list, start_method_def, gen_method_def): Account for new representation of variable arguments and '...' in Objective-C methods; add Objective-C++ impedance matching code. (is_objc_type_qualifier): Remove function. (adjust_type_for_id_default): Simplify; there is no longer a need to wade through declspecs. (lookup_interface, start_class, continue_class, finish_class, start_method_def, start_protocol, build_method_decl, objc_add_method, add_instance_variable, build_ivar_reference, is_ivar, is_private, get_super_receiver, objc_build_finally_epilogue): Make into static functions. (receiver_is_class_object): Use new IS_CLASS() macro. (objc_build_message_expr): Tweak ObjC++ message argument handling; call objc_finish_message_expr() instead of finish_message_expr(). (finish_message_expr): Rename to objc_finish_message_expr(); use OBJC_TYPE_NAME and OBJC_SET_TYPE_NAME macros instead of TYPE_NAME. call gen_type_name() instead of gen_declaration(); call objc_is_id() instead of using IS_ID and IS_CLASS; Use objc_class_name instead of calling get_identifier("Class"); handle CONVERT_EXPRs in receiver. (build_objc_method_call, warn_with_method): Do not call groktypename(). (build_ivar_reference): Call convert() instead of clobbering in a type. (hash_init): Initialize string_htab hash table. (add_instance_variable): Simplify parameter list; do not call grokfield(); do not populate CLASS_IVARS list. (start_class): Check for the existence of super class, if one was specified. (continue_class): Use CLASS_RAW_IVARS rather than CLASS_IVARS; do not call build_class_template(); adjust call to get_class_ivars(); call build_decl(), pushdecl() and finish_decl() instead of define_decl(). (finish_class): Call build_decl(), pushdecl() and finish_decl() instead of define_decl(). (add_protocols): Use PROTOCOL_BINFO_ELTS for the tree vector size. (start_protocol): Do not call build_protocol_template(); use PROTOCOL_BINFO_ELTS for the tree vector size. (encode_type_qualifiers): Do not handle the 'const' qualifier here. (encode_pointer): Encode 'const char *' as 'r*', for backwards compatibility. (encode_array): Use HOST_WIDE_INT_PRINT_DEC instead of "%ld". (encode_type): Handle the 'const' qualifier here. (objc_parmlist): New global variable, sued by objc_push_parm and objc_get_parm_info(). (objc_push_parm, objc_get_parm_info): New functions. (objc_expr_last): Remove function. (synth_self_and_ucmd_args): For instance methods, use the instance type for 'self'; call objc_push_parm() instead of push_parm_decl(). (start_method_def): Do not call push_scope(), declare_parm_level(), pop_scope(), push_parm_decl(), store_parm_decls() or objc_expr_last(); just use objc_push_parm() and objc_get_parm_info(). (comp_method_with_proto): Remove function. (objc_types_are_equivalent): Strip away indirections before comparing underlying types. (comp_proto_with_proto): Do not call groktypename(); types are no longer in raw declspec format. (objc_start_function): New function. (really_start_method): Call comp_proto_with_proto() instead of comp_method_with_proto(); call objc_start_function() instead of hand-crafting a function declarator. (continue_method_def, objc_expand_function_end): Remove functions. (get_super_receiver): Call objc_get_current_scope() instead of get_current_scope(); reference 'super_class' field (instead of 'class'). (finish_method_def): Rename to objc_finish_method_definition() and add a function decl parameter; move method encoding call from objc_expand_function_end(). (is_complex_decl, adorn_decl, gen_declarator, gen_declspecs, gen_declaration_1): Remove functions. (tmpbuf, RAW_DECLSPEC): Remove. (gen_declaration): Remove second parameter; simplify to deal with TYPE_P nodes instead of raw declspecs. (gen_type_name, gen_type_name_0): New functions. (gen_method_decl): Remove second parameter; call gen_type_name() instead of gen_declaration_1(). (dump_interface): Adjust calls to gen_declaration() and gen_method_decl(); do not allocate a separate string buffer. (init_objc): Allocate a larger string buffer to accommodate dump_interface(); adjust call to build_module_descriptor(); add call to build_module_initializer_routine() for the GNU runtime. (generate_classref_translation_entry): Do not call start_decl(); call finish_var_decl() instead of finish_decl(); call convert() instead of build_c_cast(). * objc-act.h (CLASS_OWN_IVARS): Remove accessor. (CLASS_BINFO_ELTS): Reduce from 6 to 5, now that CLASS_OWN_IVARS is gone. (OCTI_GNU_INIT_DECL, GNU_INIT_decl): New. (OCTI_ELLIPSIS_NODE, objc_ellipsis_node): Remove. (OCTI_ID_ID, id_type, objc_id_id): Rename to OCTI_ID_NAME, objc_object_type and objc_object_name, respectively. (OCTI_CLS_REF, OCTI_CLASS_NAME, objc_class_reference, objc_class_name): New. (IS_CLASS): New macro. (IS_ID, IS_SUPER): Robustify. (OCTI_EXECCLASS_DECL, execclass_decl): New. (finish_file, start_class, continue_class, finish_class, start_method_def, continue_method_def, finish_method_def, start_protocol, finish_protocol, objc_build_throw_stmt, objc_build_try_catch_finally_stmt, objc_build_synchronized_prologue, objc_build_synchronized_epilogue, objc_build_try_prologue, objc_build_try_epilogue, objc_build_catch_stmt, objc_build_catch_epilogue, objc_build_finally_prologue, objc_build_finally_epilogue, is_ivar, is_private, is_public, add_instance_variable, objc_add_method, get_super_receiver, objc_clear_super_receiver, get_class_ivars_from_name, get_class_reference, get_static_reference, get_object_reference, build_message_expr, finish_message_expr, build_selector_expr, build_ivar_reference, build_keyword_decl, build_method_decl, build_protocol_expr, build_objc_string_object, objc_declare_alias, objc_declare_class, objc_declare_protocols, objc_comptypes, objc_check_decl, build_encode_expr): Remove prototypes. (imp_count, cat_count): Make GGC-aware. (OBJC_SET_TYPE_NAME): New macro. From-SVN: r87168
2004-09-08 02:49:44 +02:00
strcat (errbuf, IDENTIFIER_POINTER (KEYWORD_KEY_NAME (chain)));
1992-01-18 00:15:38 +01:00
Makefile.in (c-parse.o): Depend on $(C_COMMON_H). [gcc/ChangeLog] 2004-09-07 Ziemowit Laski <zlaski@apple.com> * Makefile.in (c-parse.o): Depend on $(C_COMMON_H). * c-parse.in: Include c-common.h instead of objc-act.h. (ivar_decl_list, ivar_decls, ivar_decl, ivars, ivar_declarator, myparms, myparm): Remove %type declarations. (methodtype, optparms, OBJC_TYPE_QUAL, objc_quals, objc_qual, objc_typename, objc_try_catch_stmt, optellipsis): Add %type declarations. (objc_inherit_code, objc_public_flag): Remove. (typespec_nonreserved_nonattr): Call objc_get_protocol_qualified_type() instead of get_static_reference() and get_protocol_reference(). (stmt_nocomp): Call grokparm() on @catch parameter. (objcdef): Move semantic action to objc_finish_implementation(). (classdef): Move semantic action to objc_start_class_interface(), objc_continue_interface(), objc_finish_interface(), objc_start_class_implementation(), objc_continue_implementation(), objc_start_category_interface() and objc_start_category_implementation(). (protocoldef): Move semantic actions to objc_start_protocol() and objc_finish_interface(). (ivar_decl_list): Remove nonterminal. (visibility_spec): Move semantic actions to objc_set_visibility(). (ivar_decls): Remove assignment to $$. (ivar_decl): Rephrase in terms of component_decl; call objc_add_instance_variable(). (ivars, ivar_declarator): Remove nonterminals. (opt_semi): New nonterminal. (methodtype): Remove semantic actions. (methoddef): Move semantic actions to objc_set_method_type(), objc_start_method_definition() and objc_finish_method_definition(). (methodproto): Move semantic actions to objc_set_method_type() and objc_add_method_declaration(). (methoddecl): Use objc_typename instead of typename; move semantic actions to objc_build_method_signature(). (optarglist, myxdecls, mydecl, myparms, myparm): Remove nonterminals. (optparmlist): Express in terms of optparms and optellipsis. (optparms, optellipsis, objc_qual, objc_quals, objc_typename): New nonterminals. (keyworddecl): Use objc_typename instead of typename. (rid_to_yy): Mark RID_IN, RID_OUT, RID_INOUT, RID_BYCOPY, RID_BYREF and RID_ONEWAY as returning OBJC_TYPE_QUAL to yyparse(). [gcc/objc/ChangeLog] 2004-09-07 Ziemowit Laski <zlaski@apple.com> * Make-lang.in (objc/objc-parse.o): Depend on $(C_COMMON_H) instead of objc/objc-act.h. (objc/objc-act.o): Depend on $(HASHTAB_H). * objc-act.c: Include hashtab.h; in ObjC++ mode, include cp-tree.h and objcp-decl.h instead of c-tree.h. (build_module_descriptor, get_class_ivars, synth_id_with_class_suffix, error_with_ivar, gen_method_decl, gen_declaration, setup_string_decl, build_protocol_template): Adjust prototypes. (build_module_initializer_routine, start_class, continue_class, finish_class, start_method_def, objc_start_function, start_protocol, build_method_decl, objc_add_method, add_instance_variable, build_ivar_reference, is_ivar, is_private, get_super_receiver, build_selector_table_decl, objc_push_parm, objc_get_parm_info, gen_type_name, gen_type_name_0, start_var_decl, finish_var_decl, create_field_decl): New prototypes. (objc_expand_function_end, comp_method_with_proto, objc_expr_last, gen_declaration_1, gen_declarator, is_complex_decl, adorn_decl, define_decl, create_builtin_decl, gen_declspecs): Remove prototypes. (TYPE_ID): Rename to OBJECT_TYPEDEF_NAME. (CLASS_TYPEDEF_NAME): New. (TAG_EXECCLASS): Change from a global variable to a #define. (TAG_RETURN_STRUCT): Delete. (TAG_GNUINIT): New, holds '__objc_gnu_init' name. (objc_inherit_code, objc_public_flag): New, moved from c-parse.in. (string_descriptor): New struct. (string_htab): New hash table. (string_hash, string_eq): New prototypes. (generate_struct_by_value_array): Call create_field_decl() instead of create_builtin_decl(). (objc_init): Do not initialize objc_ellipsis_node or TAG_EXECCLASS; In ObjC++ mode, call cxx_init() instead of c_objc_common_init(). (objc_finish_file): In ObjC++, call instantiate_pending_templates() and cp_finish_file(). (define_decl, get_static_reference, get_protocol_reference, create_builtin_decl): Remove functions. (objc_start_class_interface, objc_start_category_interface, objc_start_protocol, objc_continue_interface, objc_finish_interface, objc_start_class_implementation, objc_start_category_implementation, objc_continue_implementation, objc_finish_implementation, objc_set_visibility, objc_set_method_type, objc_build_method_signature, objc_add_method_declaration, objc_start_method_definition, objc_add_instance_variable, objc_get_protocol_qualified_type, create_field_decl, start_var_decl, finish_var_decl): New functions. (setup_string_decl): Simplify since it is only called once. (synth_module_prologue): Call build_class_template(); predefine 'id' and 'Class' as typedefs; rename 'temp_type' to 'type'; disable debug hooks for duration of function; fix GNU runtime messenger signatures to correspond to reality; forward-declare '__objc_exec_class' for the GNU runtime; call build_selector_table_decl(); in ObjC++ mode, generate 'extern "C" { ... }' wrappers around synthesized declarations; call build_protocol_template() and build_category_template(). (string_hash, string_eq): New functions. (objc_build_string_object): Check metaclass correctness only once; store string literals in hash table. (objc_build_constructor): Do not convert initializer elements; adjust for ObjC++ impedance mismatch. (build_objc_symtab_template): Call create_field_decl() instead of create_builtin_decl(). (init_objc_symtab): Add missing conversion to initializer element. (build_metadata_decl): Call start_var_decl() instead of define_decl(). (generate_objc_symtab_decl): Do not call build_category_template(); call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(). (build_module_descriptor): Call create_field_decl() instead of grokfield(); call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(); always mark module descriptor as used; move GNU runtime-specific functionality to build_module_initializer_routine(). (build_module_initializer_routine): New function, broken off of build_module_descriptor(). (objc_static_init_needed_p, objc_generate_static_init_call): New functions. (generate_static_references, generate_strings, build_selector_translation_table, generate_descriptor_table, generate_ivars_list, generate_dispatch_table, generate_category): Call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(); build a type directly instead of via groktypename(). (build_selector_reference_decl, build_selector_table_decl, build_class_reference_decl, build_protocol_reference, generate_objc_image_info): Call start_var_decl() instead of build_decl(). (build_selector_reference): For GNU runtime, do not call build_selector_reference_decl(). (build_selector, build_typed_selector_reference): Always convert result to the selector type. (add_objc_string): Cast return value to 'char *'. (build_method_prototype_template, build_selector_template, build_method_template): Use actual selector type for fields pointing to selectors. (finish_objc): For GNU runtime, call build_module_initializer_routine() after build_module_descriptor(). (generate_protocol_list, generate_shared_structures): Call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(); build a type directly instead of via groktypename(). (synth_id_with_class_suffix): Return a string. (get_arg_type_list): For instance methods, use the instance type for 'self'; do not call groktypename_in_parm_context(). (build_objc_string_decl): Squash redeclaration errors in ObjC++. (objc_is_class_name): Use OBJC_TYPE_NAME instead of TYPE_NAME; handle RECORD_TYPEs in ObjC as well as ObjC++. (objc_is_id): New function. (objc_is_object_ptr): Return the canonical type node. (objc_get_class_ivars): Simplify using get_class_ivars(). (get_class_ivars): Remove second parameter; create a fresh copy of the ivar list for each call; do not check for existence of super class. (objc_eh_runtime_type): Mark #ifndef OBJCPLUS. (objc_init_exceptions): When using SJLJ-style exceptions, require the use of '-fobjc-exceptions' flag; do not require it for DWARF-style exceptions. (objc_build_exc_ptr, next_sjlj_build_try_catch_finally): Use objc_object_type instead of objc_id_type. (objc_begin_catch_clause): Convert the incoming PARM_DECL into a VAR_DECL before placing it in the appropriate scope; do not call define_decl(); adjust call to c_begin_compound_stmt(); use objc_object_type instead of objc_id_type. (build_next_objc_exception_stuff): Call create_field_decl() instead of create_builtin_decl(); construct type directly instead of calling groktypename(); use OBJC_VOID_AT_END to mark end of function parameters. (build_private_template): Adjust call to get_class_ivars(); build a type directly instead of via groktypename(). (build_protocol_template, build_method_prototype_list_template, build_method_prototype_template, build_category_template, build_selector_template, build_class_template, build_super_template, build_ivar_template, build_ivar_list_template, build_method_list_template, build_method_template): Call create_field_decl() instead of grokfield(). (objc_method_parm_type): Do not call groktypename(). (generate_descriptor_table): Call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(). (generate_method_descriptors, build_protocol_initializer, generate_dispatch_tables, build_category_initializer, build_shared_structure_initializer): Do not call groktypename(). (generate_protocols): Call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(); do not call groktypename(). (error_with_ivar): Remove last parameter. (check_ivars): Do not iterate ovar CLASS_RAW_IVARS lists in addition to CLASS_IVARS lists; adjust calls to error_with_ivar(). (generate_ivar_lists): Convert one of the initializer elements; do not call groktypename(). (get_arg_type_list, start_method_def, gen_method_def): Account for new representation of variable arguments and '...' in Objective-C methods; add Objective-C++ impedance matching code. (is_objc_type_qualifier): Remove function. (adjust_type_for_id_default): Simplify; there is no longer a need to wade through declspecs. (lookup_interface, start_class, continue_class, finish_class, start_method_def, start_protocol, build_method_decl, objc_add_method, add_instance_variable, build_ivar_reference, is_ivar, is_private, get_super_receiver, objc_build_finally_epilogue): Make into static functions. (receiver_is_class_object): Use new IS_CLASS() macro. (objc_build_message_expr): Tweak ObjC++ message argument handling; call objc_finish_message_expr() instead of finish_message_expr(). (finish_message_expr): Rename to objc_finish_message_expr(); use OBJC_TYPE_NAME and OBJC_SET_TYPE_NAME macros instead of TYPE_NAME. call gen_type_name() instead of gen_declaration(); call objc_is_id() instead of using IS_ID and IS_CLASS; Use objc_class_name instead of calling get_identifier("Class"); handle CONVERT_EXPRs in receiver. (build_objc_method_call, warn_with_method): Do not call groktypename(). (build_ivar_reference): Call convert() instead of clobbering in a type. (hash_init): Initialize string_htab hash table. (add_instance_variable): Simplify parameter list; do not call grokfield(); do not populate CLASS_IVARS list. (start_class): Check for the existence of super class, if one was specified. (continue_class): Use CLASS_RAW_IVARS rather than CLASS_IVARS; do not call build_class_template(); adjust call to get_class_ivars(); call build_decl(), pushdecl() and finish_decl() instead of define_decl(). (finish_class): Call build_decl(), pushdecl() and finish_decl() instead of define_decl(). (add_protocols): Use PROTOCOL_BINFO_ELTS for the tree vector size. (start_protocol): Do not call build_protocol_template(); use PROTOCOL_BINFO_ELTS for the tree vector size. (encode_type_qualifiers): Do not handle the 'const' qualifier here. (encode_pointer): Encode 'const char *' as 'r*', for backwards compatibility. (encode_array): Use HOST_WIDE_INT_PRINT_DEC instead of "%ld". (encode_type): Handle the 'const' qualifier here. (objc_parmlist): New global variable, sued by objc_push_parm and objc_get_parm_info(). (objc_push_parm, objc_get_parm_info): New functions. (objc_expr_last): Remove function. (synth_self_and_ucmd_args): For instance methods, use the instance type for 'self'; call objc_push_parm() instead of push_parm_decl(). (start_method_def): Do not call push_scope(), declare_parm_level(), pop_scope(), push_parm_decl(), store_parm_decls() or objc_expr_last(); just use objc_push_parm() and objc_get_parm_info(). (comp_method_with_proto): Remove function. (objc_types_are_equivalent): Strip away indirections before comparing underlying types. (comp_proto_with_proto): Do not call groktypename(); types are no longer in raw declspec format. (objc_start_function): New function. (really_start_method): Call comp_proto_with_proto() instead of comp_method_with_proto(); call objc_start_function() instead of hand-crafting a function declarator. (continue_method_def, objc_expand_function_end): Remove functions. (get_super_receiver): Call objc_get_current_scope() instead of get_current_scope(); reference 'super_class' field (instead of 'class'). (finish_method_def): Rename to objc_finish_method_definition() and add a function decl parameter; move method encoding call from objc_expand_function_end(). (is_complex_decl, adorn_decl, gen_declarator, gen_declspecs, gen_declaration_1): Remove functions. (tmpbuf, RAW_DECLSPEC): Remove. (gen_declaration): Remove second parameter; simplify to deal with TYPE_P nodes instead of raw declspecs. (gen_type_name, gen_type_name_0): New functions. (gen_method_decl): Remove second parameter; call gen_type_name() instead of gen_declaration_1(). (dump_interface): Adjust calls to gen_declaration() and gen_method_decl(); do not allocate a separate string buffer. (init_objc): Allocate a larger string buffer to accommodate dump_interface(); adjust call to build_module_descriptor(); add call to build_module_initializer_routine() for the GNU runtime. (generate_classref_translation_entry): Do not call start_decl(); call finish_var_decl() instead of finish_decl(); call convert() instead of build_c_cast(). * objc-act.h (CLASS_OWN_IVARS): Remove accessor. (CLASS_BINFO_ELTS): Reduce from 6 to 5, now that CLASS_OWN_IVARS is gone. (OCTI_GNU_INIT_DECL, GNU_INIT_decl): New. (OCTI_ELLIPSIS_NODE, objc_ellipsis_node): Remove. (OCTI_ID_ID, id_type, objc_id_id): Rename to OCTI_ID_NAME, objc_object_type and objc_object_name, respectively. (OCTI_CLS_REF, OCTI_CLASS_NAME, objc_class_reference, objc_class_name): New. (IS_CLASS): New macro. (IS_ID, IS_SUPER): Robustify. (OCTI_EXECCLASS_DECL, execclass_decl): New. (finish_file, start_class, continue_class, finish_class, start_method_def, continue_method_def, finish_method_def, start_protocol, finish_protocol, objc_build_throw_stmt, objc_build_try_catch_finally_stmt, objc_build_synchronized_prologue, objc_build_synchronized_epilogue, objc_build_try_prologue, objc_build_try_epilogue, objc_build_catch_stmt, objc_build_catch_epilogue, objc_build_finally_prologue, objc_build_finally_epilogue, is_ivar, is_private, is_public, add_instance_variable, objc_add_method, get_super_receiver, objc_clear_super_receiver, get_class_ivars_from_name, get_class_reference, get_static_reference, get_object_reference, build_message_expr, finish_message_expr, build_selector_expr, build_ivar_reference, build_keyword_decl, build_method_decl, build_protocol_expr, build_objc_string_object, objc_declare_alias, objc_declare_class, objc_declare_protocols, objc_comptypes, objc_check_decl, build_encode_expr): Remove prototypes. (imp_count, cat_count): Make GGC-aware. (OBJC_SET_TYPE_NAME): New macro. From-SVN: r87168
2004-09-08 02:49:44 +02:00
strcat (errbuf, ":(");
gen_type_name_0 (TREE_VALUE (TREE_TYPE (chain)));
strcat (errbuf, ")");
Makefile.in (c-parse.o): Depend on $(C_COMMON_H). [gcc/ChangeLog] 2004-09-07 Ziemowit Laski <zlaski@apple.com> * Makefile.in (c-parse.o): Depend on $(C_COMMON_H). * c-parse.in: Include c-common.h instead of objc-act.h. (ivar_decl_list, ivar_decls, ivar_decl, ivars, ivar_declarator, myparms, myparm): Remove %type declarations. (methodtype, optparms, OBJC_TYPE_QUAL, objc_quals, objc_qual, objc_typename, objc_try_catch_stmt, optellipsis): Add %type declarations. (objc_inherit_code, objc_public_flag): Remove. (typespec_nonreserved_nonattr): Call objc_get_protocol_qualified_type() instead of get_static_reference() and get_protocol_reference(). (stmt_nocomp): Call grokparm() on @catch parameter. (objcdef): Move semantic action to objc_finish_implementation(). (classdef): Move semantic action to objc_start_class_interface(), objc_continue_interface(), objc_finish_interface(), objc_start_class_implementation(), objc_continue_implementation(), objc_start_category_interface() and objc_start_category_implementation(). (protocoldef): Move semantic actions to objc_start_protocol() and objc_finish_interface(). (ivar_decl_list): Remove nonterminal. (visibility_spec): Move semantic actions to objc_set_visibility(). (ivar_decls): Remove assignment to $$. (ivar_decl): Rephrase in terms of component_decl; call objc_add_instance_variable(). (ivars, ivar_declarator): Remove nonterminals. (opt_semi): New nonterminal. (methodtype): Remove semantic actions. (methoddef): Move semantic actions to objc_set_method_type(), objc_start_method_definition() and objc_finish_method_definition(). (methodproto): Move semantic actions to objc_set_method_type() and objc_add_method_declaration(). (methoddecl): Use objc_typename instead of typename; move semantic actions to objc_build_method_signature(). (optarglist, myxdecls, mydecl, myparms, myparm): Remove nonterminals. (optparmlist): Express in terms of optparms and optellipsis. (optparms, optellipsis, objc_qual, objc_quals, objc_typename): New nonterminals. (keyworddecl): Use objc_typename instead of typename. (rid_to_yy): Mark RID_IN, RID_OUT, RID_INOUT, RID_BYCOPY, RID_BYREF and RID_ONEWAY as returning OBJC_TYPE_QUAL to yyparse(). [gcc/objc/ChangeLog] 2004-09-07 Ziemowit Laski <zlaski@apple.com> * Make-lang.in (objc/objc-parse.o): Depend on $(C_COMMON_H) instead of objc/objc-act.h. (objc/objc-act.o): Depend on $(HASHTAB_H). * objc-act.c: Include hashtab.h; in ObjC++ mode, include cp-tree.h and objcp-decl.h instead of c-tree.h. (build_module_descriptor, get_class_ivars, synth_id_with_class_suffix, error_with_ivar, gen_method_decl, gen_declaration, setup_string_decl, build_protocol_template): Adjust prototypes. (build_module_initializer_routine, start_class, continue_class, finish_class, start_method_def, objc_start_function, start_protocol, build_method_decl, objc_add_method, add_instance_variable, build_ivar_reference, is_ivar, is_private, get_super_receiver, build_selector_table_decl, objc_push_parm, objc_get_parm_info, gen_type_name, gen_type_name_0, start_var_decl, finish_var_decl, create_field_decl): New prototypes. (objc_expand_function_end, comp_method_with_proto, objc_expr_last, gen_declaration_1, gen_declarator, is_complex_decl, adorn_decl, define_decl, create_builtin_decl, gen_declspecs): Remove prototypes. (TYPE_ID): Rename to OBJECT_TYPEDEF_NAME. (CLASS_TYPEDEF_NAME): New. (TAG_EXECCLASS): Change from a global variable to a #define. (TAG_RETURN_STRUCT): Delete. (TAG_GNUINIT): New, holds '__objc_gnu_init' name. (objc_inherit_code, objc_public_flag): New, moved from c-parse.in. (string_descriptor): New struct. (string_htab): New hash table. (string_hash, string_eq): New prototypes. (generate_struct_by_value_array): Call create_field_decl() instead of create_builtin_decl(). (objc_init): Do not initialize objc_ellipsis_node or TAG_EXECCLASS; In ObjC++ mode, call cxx_init() instead of c_objc_common_init(). (objc_finish_file): In ObjC++, call instantiate_pending_templates() and cp_finish_file(). (define_decl, get_static_reference, get_protocol_reference, create_builtin_decl): Remove functions. (objc_start_class_interface, objc_start_category_interface, objc_start_protocol, objc_continue_interface, objc_finish_interface, objc_start_class_implementation, objc_start_category_implementation, objc_continue_implementation, objc_finish_implementation, objc_set_visibility, objc_set_method_type, objc_build_method_signature, objc_add_method_declaration, objc_start_method_definition, objc_add_instance_variable, objc_get_protocol_qualified_type, create_field_decl, start_var_decl, finish_var_decl): New functions. (setup_string_decl): Simplify since it is only called once. (synth_module_prologue): Call build_class_template(); predefine 'id' and 'Class' as typedefs; rename 'temp_type' to 'type'; disable debug hooks for duration of function; fix GNU runtime messenger signatures to correspond to reality; forward-declare '__objc_exec_class' for the GNU runtime; call build_selector_table_decl(); in ObjC++ mode, generate 'extern "C" { ... }' wrappers around synthesized declarations; call build_protocol_template() and build_category_template(). (string_hash, string_eq): New functions. (objc_build_string_object): Check metaclass correctness only once; store string literals in hash table. (objc_build_constructor): Do not convert initializer elements; adjust for ObjC++ impedance mismatch. (build_objc_symtab_template): Call create_field_decl() instead of create_builtin_decl(). (init_objc_symtab): Add missing conversion to initializer element. (build_metadata_decl): Call start_var_decl() instead of define_decl(). (generate_objc_symtab_decl): Do not call build_category_template(); call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(). (build_module_descriptor): Call create_field_decl() instead of grokfield(); call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(); always mark module descriptor as used; move GNU runtime-specific functionality to build_module_initializer_routine(). (build_module_initializer_routine): New function, broken off of build_module_descriptor(). (objc_static_init_needed_p, objc_generate_static_init_call): New functions. (generate_static_references, generate_strings, build_selector_translation_table, generate_descriptor_table, generate_ivars_list, generate_dispatch_table, generate_category): Call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(); build a type directly instead of via groktypename(). (build_selector_reference_decl, build_selector_table_decl, build_class_reference_decl, build_protocol_reference, generate_objc_image_info): Call start_var_decl() instead of build_decl(). (build_selector_reference): For GNU runtime, do not call build_selector_reference_decl(). (build_selector, build_typed_selector_reference): Always convert result to the selector type. (add_objc_string): Cast return value to 'char *'. (build_method_prototype_template, build_selector_template, build_method_template): Use actual selector type for fields pointing to selectors. (finish_objc): For GNU runtime, call build_module_initializer_routine() after build_module_descriptor(). (generate_protocol_list, generate_shared_structures): Call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(); build a type directly instead of via groktypename(). (synth_id_with_class_suffix): Return a string. (get_arg_type_list): For instance methods, use the instance type for 'self'; do not call groktypename_in_parm_context(). (build_objc_string_decl): Squash redeclaration errors in ObjC++. (objc_is_class_name): Use OBJC_TYPE_NAME instead of TYPE_NAME; handle RECORD_TYPEs in ObjC as well as ObjC++. (objc_is_id): New function. (objc_is_object_ptr): Return the canonical type node. (objc_get_class_ivars): Simplify using get_class_ivars(). (get_class_ivars): Remove second parameter; create a fresh copy of the ivar list for each call; do not check for existence of super class. (objc_eh_runtime_type): Mark #ifndef OBJCPLUS. (objc_init_exceptions): When using SJLJ-style exceptions, require the use of '-fobjc-exceptions' flag; do not require it for DWARF-style exceptions. (objc_build_exc_ptr, next_sjlj_build_try_catch_finally): Use objc_object_type instead of objc_id_type. (objc_begin_catch_clause): Convert the incoming PARM_DECL into a VAR_DECL before placing it in the appropriate scope; do not call define_decl(); adjust call to c_begin_compound_stmt(); use objc_object_type instead of objc_id_type. (build_next_objc_exception_stuff): Call create_field_decl() instead of create_builtin_decl(); construct type directly instead of calling groktypename(); use OBJC_VOID_AT_END to mark end of function parameters. (build_private_template): Adjust call to get_class_ivars(); build a type directly instead of via groktypename(). (build_protocol_template, build_method_prototype_list_template, build_method_prototype_template, build_category_template, build_selector_template, build_class_template, build_super_template, build_ivar_template, build_ivar_list_template, build_method_list_template, build_method_template): Call create_field_decl() instead of grokfield(). (objc_method_parm_type): Do not call groktypename(). (generate_descriptor_table): Call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(). (generate_method_descriptors, build_protocol_initializer, generate_dispatch_tables, build_category_initializer, build_shared_structure_initializer): Do not call groktypename(). (generate_protocols): Call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(); do not call groktypename(). (error_with_ivar): Remove last parameter. (check_ivars): Do not iterate ovar CLASS_RAW_IVARS lists in addition to CLASS_IVARS lists; adjust calls to error_with_ivar(). (generate_ivar_lists): Convert one of the initializer elements; do not call groktypename(). (get_arg_type_list, start_method_def, gen_method_def): Account for new representation of variable arguments and '...' in Objective-C methods; add Objective-C++ impedance matching code. (is_objc_type_qualifier): Remove function. (adjust_type_for_id_default): Simplify; there is no longer a need to wade through declspecs. (lookup_interface, start_class, continue_class, finish_class, start_method_def, start_protocol, build_method_decl, objc_add_method, add_instance_variable, build_ivar_reference, is_ivar, is_private, get_super_receiver, objc_build_finally_epilogue): Make into static functions. (receiver_is_class_object): Use new IS_CLASS() macro. (objc_build_message_expr): Tweak ObjC++ message argument handling; call objc_finish_message_expr() instead of finish_message_expr(). (finish_message_expr): Rename to objc_finish_message_expr(); use OBJC_TYPE_NAME and OBJC_SET_TYPE_NAME macros instead of TYPE_NAME. call gen_type_name() instead of gen_declaration(); call objc_is_id() instead of using IS_ID and IS_CLASS; Use objc_class_name instead of calling get_identifier("Class"); handle CONVERT_EXPRs in receiver. (build_objc_method_call, warn_with_method): Do not call groktypename(). (build_ivar_reference): Call convert() instead of clobbering in a type. (hash_init): Initialize string_htab hash table. (add_instance_variable): Simplify parameter list; do not call grokfield(); do not populate CLASS_IVARS list. (start_class): Check for the existence of super class, if one was specified. (continue_class): Use CLASS_RAW_IVARS rather than CLASS_IVARS; do not call build_class_template(); adjust call to get_class_ivars(); call build_decl(), pushdecl() and finish_decl() instead of define_decl(). (finish_class): Call build_decl(), pushdecl() and finish_decl() instead of define_decl(). (add_protocols): Use PROTOCOL_BINFO_ELTS for the tree vector size. (start_protocol): Do not call build_protocol_template(); use PROTOCOL_BINFO_ELTS for the tree vector size. (encode_type_qualifiers): Do not handle the 'const' qualifier here. (encode_pointer): Encode 'const char *' as 'r*', for backwards compatibility. (encode_array): Use HOST_WIDE_INT_PRINT_DEC instead of "%ld". (encode_type): Handle the 'const' qualifier here. (objc_parmlist): New global variable, sued by objc_push_parm and objc_get_parm_info(). (objc_push_parm, objc_get_parm_info): New functions. (objc_expr_last): Remove function. (synth_self_and_ucmd_args): For instance methods, use the instance type for 'self'; call objc_push_parm() instead of push_parm_decl(). (start_method_def): Do not call push_scope(), declare_parm_level(), pop_scope(), push_parm_decl(), store_parm_decls() or objc_expr_last(); just use objc_push_parm() and objc_get_parm_info(). (comp_method_with_proto): Remove function. (objc_types_are_equivalent): Strip away indirections before comparing underlying types. (comp_proto_with_proto): Do not call groktypename(); types are no longer in raw declspec format. (objc_start_function): New function. (really_start_method): Call comp_proto_with_proto() instead of comp_method_with_proto(); call objc_start_function() instead of hand-crafting a function declarator. (continue_method_def, objc_expand_function_end): Remove functions. (get_super_receiver): Call objc_get_current_scope() instead of get_current_scope(); reference 'super_class' field (instead of 'class'). (finish_method_def): Rename to objc_finish_method_definition() and add a function decl parameter; move method encoding call from objc_expand_function_end(). (is_complex_decl, adorn_decl, gen_declarator, gen_declspecs, gen_declaration_1): Remove functions. (tmpbuf, RAW_DECLSPEC): Remove. (gen_declaration): Remove second parameter; simplify to deal with TYPE_P nodes instead of raw declspecs. (gen_type_name, gen_type_name_0): New functions. (gen_method_decl): Remove second parameter; call gen_type_name() instead of gen_declaration_1(). (dump_interface): Adjust calls to gen_declaration() and gen_method_decl(); do not allocate a separate string buffer. (init_objc): Allocate a larger string buffer to accommodate dump_interface(); adjust call to build_module_descriptor(); add call to build_module_initializer_routine() for the GNU runtime. (generate_classref_translation_entry): Do not call start_decl(); call finish_var_decl() instead of finish_decl(); call convert() instead of build_c_cast(). * objc-act.h (CLASS_OWN_IVARS): Remove accessor. (CLASS_BINFO_ELTS): Reduce from 6 to 5, now that CLASS_OWN_IVARS is gone. (OCTI_GNU_INIT_DECL, GNU_INIT_decl): New. (OCTI_ELLIPSIS_NODE, objc_ellipsis_node): Remove. (OCTI_ID_ID, id_type, objc_id_id): Rename to OCTI_ID_NAME, objc_object_type and objc_object_name, respectively. (OCTI_CLS_REF, OCTI_CLASS_NAME, objc_class_reference, objc_class_name): New. (IS_CLASS): New macro. (IS_ID, IS_SUPER): Robustify. (OCTI_EXECCLASS_DECL, execclass_decl): New. (finish_file, start_class, continue_class, finish_class, start_method_def, continue_method_def, finish_method_def, start_protocol, finish_protocol, objc_build_throw_stmt, objc_build_try_catch_finally_stmt, objc_build_synchronized_prologue, objc_build_synchronized_epilogue, objc_build_try_prologue, objc_build_try_epilogue, objc_build_catch_stmt, objc_build_catch_epilogue, objc_build_finally_prologue, objc_build_finally_epilogue, is_ivar, is_private, is_public, add_instance_variable, objc_add_method, get_super_receiver, objc_clear_super_receiver, get_class_ivars_from_name, get_class_reference, get_static_reference, get_object_reference, build_message_expr, finish_message_expr, build_selector_expr, build_ivar_reference, build_keyword_decl, build_method_decl, build_protocol_expr, build_objc_string_object, objc_declare_alias, objc_declare_class, objc_declare_protocols, objc_comptypes, objc_check_decl, build_encode_expr): Remove prototypes. (imp_count, cat_count): Make GGC-aware. (OBJC_SET_TYPE_NAME): New macro. From-SVN: r87168
2004-09-08 02:49:44 +02:00
strcat (errbuf, IDENTIFIER_POINTER (KEYWORD_ARG_NAME (chain)));
if ((chain = TREE_CHAIN (chain)))
Makefile.in (c-parse.o): Depend on $(C_COMMON_H). [gcc/ChangeLog] 2004-09-07 Ziemowit Laski <zlaski@apple.com> * Makefile.in (c-parse.o): Depend on $(C_COMMON_H). * c-parse.in: Include c-common.h instead of objc-act.h. (ivar_decl_list, ivar_decls, ivar_decl, ivars, ivar_declarator, myparms, myparm): Remove %type declarations. (methodtype, optparms, OBJC_TYPE_QUAL, objc_quals, objc_qual, objc_typename, objc_try_catch_stmt, optellipsis): Add %type declarations. (objc_inherit_code, objc_public_flag): Remove. (typespec_nonreserved_nonattr): Call objc_get_protocol_qualified_type() instead of get_static_reference() and get_protocol_reference(). (stmt_nocomp): Call grokparm() on @catch parameter. (objcdef): Move semantic action to objc_finish_implementation(). (classdef): Move semantic action to objc_start_class_interface(), objc_continue_interface(), objc_finish_interface(), objc_start_class_implementation(), objc_continue_implementation(), objc_start_category_interface() and objc_start_category_implementation(). (protocoldef): Move semantic actions to objc_start_protocol() and objc_finish_interface(). (ivar_decl_list): Remove nonterminal. (visibility_spec): Move semantic actions to objc_set_visibility(). (ivar_decls): Remove assignment to $$. (ivar_decl): Rephrase in terms of component_decl; call objc_add_instance_variable(). (ivars, ivar_declarator): Remove nonterminals. (opt_semi): New nonterminal. (methodtype): Remove semantic actions. (methoddef): Move semantic actions to objc_set_method_type(), objc_start_method_definition() and objc_finish_method_definition(). (methodproto): Move semantic actions to objc_set_method_type() and objc_add_method_declaration(). (methoddecl): Use objc_typename instead of typename; move semantic actions to objc_build_method_signature(). (optarglist, myxdecls, mydecl, myparms, myparm): Remove nonterminals. (optparmlist): Express in terms of optparms and optellipsis. (optparms, optellipsis, objc_qual, objc_quals, objc_typename): New nonterminals. (keyworddecl): Use objc_typename instead of typename. (rid_to_yy): Mark RID_IN, RID_OUT, RID_INOUT, RID_BYCOPY, RID_BYREF and RID_ONEWAY as returning OBJC_TYPE_QUAL to yyparse(). [gcc/objc/ChangeLog] 2004-09-07 Ziemowit Laski <zlaski@apple.com> * Make-lang.in (objc/objc-parse.o): Depend on $(C_COMMON_H) instead of objc/objc-act.h. (objc/objc-act.o): Depend on $(HASHTAB_H). * objc-act.c: Include hashtab.h; in ObjC++ mode, include cp-tree.h and objcp-decl.h instead of c-tree.h. (build_module_descriptor, get_class_ivars, synth_id_with_class_suffix, error_with_ivar, gen_method_decl, gen_declaration, setup_string_decl, build_protocol_template): Adjust prototypes. (build_module_initializer_routine, start_class, continue_class, finish_class, start_method_def, objc_start_function, start_protocol, build_method_decl, objc_add_method, add_instance_variable, build_ivar_reference, is_ivar, is_private, get_super_receiver, build_selector_table_decl, objc_push_parm, objc_get_parm_info, gen_type_name, gen_type_name_0, start_var_decl, finish_var_decl, create_field_decl): New prototypes. (objc_expand_function_end, comp_method_with_proto, objc_expr_last, gen_declaration_1, gen_declarator, is_complex_decl, adorn_decl, define_decl, create_builtin_decl, gen_declspecs): Remove prototypes. (TYPE_ID): Rename to OBJECT_TYPEDEF_NAME. (CLASS_TYPEDEF_NAME): New. (TAG_EXECCLASS): Change from a global variable to a #define. (TAG_RETURN_STRUCT): Delete. (TAG_GNUINIT): New, holds '__objc_gnu_init' name. (objc_inherit_code, objc_public_flag): New, moved from c-parse.in. (string_descriptor): New struct. (string_htab): New hash table. (string_hash, string_eq): New prototypes. (generate_struct_by_value_array): Call create_field_decl() instead of create_builtin_decl(). (objc_init): Do not initialize objc_ellipsis_node or TAG_EXECCLASS; In ObjC++ mode, call cxx_init() instead of c_objc_common_init(). (objc_finish_file): In ObjC++, call instantiate_pending_templates() and cp_finish_file(). (define_decl, get_static_reference, get_protocol_reference, create_builtin_decl): Remove functions. (objc_start_class_interface, objc_start_category_interface, objc_start_protocol, objc_continue_interface, objc_finish_interface, objc_start_class_implementation, objc_start_category_implementation, objc_continue_implementation, objc_finish_implementation, objc_set_visibility, objc_set_method_type, objc_build_method_signature, objc_add_method_declaration, objc_start_method_definition, objc_add_instance_variable, objc_get_protocol_qualified_type, create_field_decl, start_var_decl, finish_var_decl): New functions. (setup_string_decl): Simplify since it is only called once. (synth_module_prologue): Call build_class_template(); predefine 'id' and 'Class' as typedefs; rename 'temp_type' to 'type'; disable debug hooks for duration of function; fix GNU runtime messenger signatures to correspond to reality; forward-declare '__objc_exec_class' for the GNU runtime; call build_selector_table_decl(); in ObjC++ mode, generate 'extern "C" { ... }' wrappers around synthesized declarations; call build_protocol_template() and build_category_template(). (string_hash, string_eq): New functions. (objc_build_string_object): Check metaclass correctness only once; store string literals in hash table. (objc_build_constructor): Do not convert initializer elements; adjust for ObjC++ impedance mismatch. (build_objc_symtab_template): Call create_field_decl() instead of create_builtin_decl(). (init_objc_symtab): Add missing conversion to initializer element. (build_metadata_decl): Call start_var_decl() instead of define_decl(). (generate_objc_symtab_decl): Do not call build_category_template(); call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(). (build_module_descriptor): Call create_field_decl() instead of grokfield(); call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(); always mark module descriptor as used; move GNU runtime-specific functionality to build_module_initializer_routine(). (build_module_initializer_routine): New function, broken off of build_module_descriptor(). (objc_static_init_needed_p, objc_generate_static_init_call): New functions. (generate_static_references, generate_strings, build_selector_translation_table, generate_descriptor_table, generate_ivars_list, generate_dispatch_table, generate_category): Call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(); build a type directly instead of via groktypename(). (build_selector_reference_decl, build_selector_table_decl, build_class_reference_decl, build_protocol_reference, generate_objc_image_info): Call start_var_decl() instead of build_decl(). (build_selector_reference): For GNU runtime, do not call build_selector_reference_decl(). (build_selector, build_typed_selector_reference): Always convert result to the selector type. (add_objc_string): Cast return value to 'char *'. (build_method_prototype_template, build_selector_template, build_method_template): Use actual selector type for fields pointing to selectors. (finish_objc): For GNU runtime, call build_module_initializer_routine() after build_module_descriptor(). (generate_protocol_list, generate_shared_structures): Call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(); build a type directly instead of via groktypename(). (synth_id_with_class_suffix): Return a string. (get_arg_type_list): For instance methods, use the instance type for 'self'; do not call groktypename_in_parm_context(). (build_objc_string_decl): Squash redeclaration errors in ObjC++. (objc_is_class_name): Use OBJC_TYPE_NAME instead of TYPE_NAME; handle RECORD_TYPEs in ObjC as well as ObjC++. (objc_is_id): New function. (objc_is_object_ptr): Return the canonical type node. (objc_get_class_ivars): Simplify using get_class_ivars(). (get_class_ivars): Remove second parameter; create a fresh copy of the ivar list for each call; do not check for existence of super class. (objc_eh_runtime_type): Mark #ifndef OBJCPLUS. (objc_init_exceptions): When using SJLJ-style exceptions, require the use of '-fobjc-exceptions' flag; do not require it for DWARF-style exceptions. (objc_build_exc_ptr, next_sjlj_build_try_catch_finally): Use objc_object_type instead of objc_id_type. (objc_begin_catch_clause): Convert the incoming PARM_DECL into a VAR_DECL before placing it in the appropriate scope; do not call define_decl(); adjust call to c_begin_compound_stmt(); use objc_object_type instead of objc_id_type. (build_next_objc_exception_stuff): Call create_field_decl() instead of create_builtin_decl(); construct type directly instead of calling groktypename(); use OBJC_VOID_AT_END to mark end of function parameters. (build_private_template): Adjust call to get_class_ivars(); build a type directly instead of via groktypename(). (build_protocol_template, build_method_prototype_list_template, build_method_prototype_template, build_category_template, build_selector_template, build_class_template, build_super_template, build_ivar_template, build_ivar_list_template, build_method_list_template, build_method_template): Call create_field_decl() instead of grokfield(). (objc_method_parm_type): Do not call groktypename(). (generate_descriptor_table): Call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(). (generate_method_descriptors, build_protocol_initializer, generate_dispatch_tables, build_category_initializer, build_shared_structure_initializer): Do not call groktypename(). (generate_protocols): Call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(); do not call groktypename(). (error_with_ivar): Remove last parameter. (check_ivars): Do not iterate ovar CLASS_RAW_IVARS lists in addition to CLASS_IVARS lists; adjust calls to error_with_ivar(). (generate_ivar_lists): Convert one of the initializer elements; do not call groktypename(). (get_arg_type_list, start_method_def, gen_method_def): Account for new representation of variable arguments and '...' in Objective-C methods; add Objective-C++ impedance matching code. (is_objc_type_qualifier): Remove function. (adjust_type_for_id_default): Simplify; there is no longer a need to wade through declspecs. (lookup_interface, start_class, continue_class, finish_class, start_method_def, start_protocol, build_method_decl, objc_add_method, add_instance_variable, build_ivar_reference, is_ivar, is_private, get_super_receiver, objc_build_finally_epilogue): Make into static functions. (receiver_is_class_object): Use new IS_CLASS() macro. (objc_build_message_expr): Tweak ObjC++ message argument handling; call objc_finish_message_expr() instead of finish_message_expr(). (finish_message_expr): Rename to objc_finish_message_expr(); use OBJC_TYPE_NAME and OBJC_SET_TYPE_NAME macros instead of TYPE_NAME. call gen_type_name() instead of gen_declaration(); call objc_is_id() instead of using IS_ID and IS_CLASS; Use objc_class_name instead of calling get_identifier("Class"); handle CONVERT_EXPRs in receiver. (build_objc_method_call, warn_with_method): Do not call groktypename(). (build_ivar_reference): Call convert() instead of clobbering in a type. (hash_init): Initialize string_htab hash table. (add_instance_variable): Simplify parameter list; do not call grokfield(); do not populate CLASS_IVARS list. (start_class): Check for the existence of super class, if one was specified. (continue_class): Use CLASS_RAW_IVARS rather than CLASS_IVARS; do not call build_class_template(); adjust call to get_class_ivars(); call build_decl(), pushdecl() and finish_decl() instead of define_decl(). (finish_class): Call build_decl(), pushdecl() and finish_decl() instead of define_decl(). (add_protocols): Use PROTOCOL_BINFO_ELTS for the tree vector size. (start_protocol): Do not call build_protocol_template(); use PROTOCOL_BINFO_ELTS for the tree vector size. (encode_type_qualifiers): Do not handle the 'const' qualifier here. (encode_pointer): Encode 'const char *' as 'r*', for backwards compatibility. (encode_array): Use HOST_WIDE_INT_PRINT_DEC instead of "%ld". (encode_type): Handle the 'const' qualifier here. (objc_parmlist): New global variable, sued by objc_push_parm and objc_get_parm_info(). (objc_push_parm, objc_get_parm_info): New functions. (objc_expr_last): Remove function. (synth_self_and_ucmd_args): For instance methods, use the instance type for 'self'; call objc_push_parm() instead of push_parm_decl(). (start_method_def): Do not call push_scope(), declare_parm_level(), pop_scope(), push_parm_decl(), store_parm_decls() or objc_expr_last(); just use objc_push_parm() and objc_get_parm_info(). (comp_method_with_proto): Remove function. (objc_types_are_equivalent): Strip away indirections before comparing underlying types. (comp_proto_with_proto): Do not call groktypename(); types are no longer in raw declspec format. (objc_start_function): New function. (really_start_method): Call comp_proto_with_proto() instead of comp_method_with_proto(); call objc_start_function() instead of hand-crafting a function declarator. (continue_method_def, objc_expand_function_end): Remove functions. (get_super_receiver): Call objc_get_current_scope() instead of get_current_scope(); reference 'super_class' field (instead of 'class'). (finish_method_def): Rename to objc_finish_method_definition() and add a function decl parameter; move method encoding call from objc_expand_function_end(). (is_complex_decl, adorn_decl, gen_declarator, gen_declspecs, gen_declaration_1): Remove functions. (tmpbuf, RAW_DECLSPEC): Remove. (gen_declaration): Remove second parameter; simplify to deal with TYPE_P nodes instead of raw declspecs. (gen_type_name, gen_type_name_0): New functions. (gen_method_decl): Remove second parameter; call gen_type_name() instead of gen_declaration_1(). (dump_interface): Adjust calls to gen_declaration() and gen_method_decl(); do not allocate a separate string buffer. (init_objc): Allocate a larger string buffer to accommodate dump_interface(); adjust call to build_module_descriptor(); add call to build_module_initializer_routine() for the GNU runtime. (generate_classref_translation_entry): Do not call start_decl(); call finish_var_decl() instead of finish_decl(); call convert() instead of build_c_cast(). * objc-act.h (CLASS_OWN_IVARS): Remove accessor. (CLASS_BINFO_ELTS): Reduce from 6 to 5, now that CLASS_OWN_IVARS is gone. (OCTI_GNU_INIT_DECL, GNU_INIT_decl): New. (OCTI_ELLIPSIS_NODE, objc_ellipsis_node): Remove. (OCTI_ID_ID, id_type, objc_id_id): Rename to OCTI_ID_NAME, objc_object_type and objc_object_name, respectively. (OCTI_CLS_REF, OCTI_CLASS_NAME, objc_class_reference, objc_class_name): New. (IS_CLASS): New macro. (IS_ID, IS_SUPER): Robustify. (OCTI_EXECCLASS_DECL, execclass_decl): New. (finish_file, start_class, continue_class, finish_class, start_method_def, continue_method_def, finish_method_def, start_protocol, finish_protocol, objc_build_throw_stmt, objc_build_try_catch_finally_stmt, objc_build_synchronized_prologue, objc_build_synchronized_epilogue, objc_build_try_prologue, objc_build_try_epilogue, objc_build_catch_stmt, objc_build_catch_epilogue, objc_build_finally_prologue, objc_build_finally_epilogue, is_ivar, is_private, is_public, add_instance_variable, objc_add_method, get_super_receiver, objc_clear_super_receiver, get_class_ivars_from_name, get_class_reference, get_static_reference, get_object_reference, build_message_expr, finish_message_expr, build_selector_expr, build_ivar_reference, build_keyword_decl, build_method_decl, build_protocol_expr, build_objc_string_object, objc_declare_alias, objc_declare_class, objc_declare_protocols, objc_comptypes, objc_check_decl, build_encode_expr): Remove prototypes. (imp_count, cat_count): Make GGC-aware. (OBJC_SET_TYPE_NAME): New macro. From-SVN: r87168
2004-09-08 02:49:44 +02:00
strcat (errbuf, " ");
1992-01-18 00:15:38 +01:00
}
while (chain);
Makefile.in (c-parse.o): Depend on $(C_COMMON_H). [gcc/ChangeLog] 2004-09-07 Ziemowit Laski <zlaski@apple.com> * Makefile.in (c-parse.o): Depend on $(C_COMMON_H). * c-parse.in: Include c-common.h instead of objc-act.h. (ivar_decl_list, ivar_decls, ivar_decl, ivars, ivar_declarator, myparms, myparm): Remove %type declarations. (methodtype, optparms, OBJC_TYPE_QUAL, objc_quals, objc_qual, objc_typename, objc_try_catch_stmt, optellipsis): Add %type declarations. (objc_inherit_code, objc_public_flag): Remove. (typespec_nonreserved_nonattr): Call objc_get_protocol_qualified_type() instead of get_static_reference() and get_protocol_reference(). (stmt_nocomp): Call grokparm() on @catch parameter. (objcdef): Move semantic action to objc_finish_implementation(). (classdef): Move semantic action to objc_start_class_interface(), objc_continue_interface(), objc_finish_interface(), objc_start_class_implementation(), objc_continue_implementation(), objc_start_category_interface() and objc_start_category_implementation(). (protocoldef): Move semantic actions to objc_start_protocol() and objc_finish_interface(). (ivar_decl_list): Remove nonterminal. (visibility_spec): Move semantic actions to objc_set_visibility(). (ivar_decls): Remove assignment to $$. (ivar_decl): Rephrase in terms of component_decl; call objc_add_instance_variable(). (ivars, ivar_declarator): Remove nonterminals. (opt_semi): New nonterminal. (methodtype): Remove semantic actions. (methoddef): Move semantic actions to objc_set_method_type(), objc_start_method_definition() and objc_finish_method_definition(). (methodproto): Move semantic actions to objc_set_method_type() and objc_add_method_declaration(). (methoddecl): Use objc_typename instead of typename; move semantic actions to objc_build_method_signature(). (optarglist, myxdecls, mydecl, myparms, myparm): Remove nonterminals. (optparmlist): Express in terms of optparms and optellipsis. (optparms, optellipsis, objc_qual, objc_quals, objc_typename): New nonterminals. (keyworddecl): Use objc_typename instead of typename. (rid_to_yy): Mark RID_IN, RID_OUT, RID_INOUT, RID_BYCOPY, RID_BYREF and RID_ONEWAY as returning OBJC_TYPE_QUAL to yyparse(). [gcc/objc/ChangeLog] 2004-09-07 Ziemowit Laski <zlaski@apple.com> * Make-lang.in (objc/objc-parse.o): Depend on $(C_COMMON_H) instead of objc/objc-act.h. (objc/objc-act.o): Depend on $(HASHTAB_H). * objc-act.c: Include hashtab.h; in ObjC++ mode, include cp-tree.h and objcp-decl.h instead of c-tree.h. (build_module_descriptor, get_class_ivars, synth_id_with_class_suffix, error_with_ivar, gen_method_decl, gen_declaration, setup_string_decl, build_protocol_template): Adjust prototypes. (build_module_initializer_routine, start_class, continue_class, finish_class, start_method_def, objc_start_function, start_protocol, build_method_decl, objc_add_method, add_instance_variable, build_ivar_reference, is_ivar, is_private, get_super_receiver, build_selector_table_decl, objc_push_parm, objc_get_parm_info, gen_type_name, gen_type_name_0, start_var_decl, finish_var_decl, create_field_decl): New prototypes. (objc_expand_function_end, comp_method_with_proto, objc_expr_last, gen_declaration_1, gen_declarator, is_complex_decl, adorn_decl, define_decl, create_builtin_decl, gen_declspecs): Remove prototypes. (TYPE_ID): Rename to OBJECT_TYPEDEF_NAME. (CLASS_TYPEDEF_NAME): New. (TAG_EXECCLASS): Change from a global variable to a #define. (TAG_RETURN_STRUCT): Delete. (TAG_GNUINIT): New, holds '__objc_gnu_init' name. (objc_inherit_code, objc_public_flag): New, moved from c-parse.in. (string_descriptor): New struct. (string_htab): New hash table. (string_hash, string_eq): New prototypes. (generate_struct_by_value_array): Call create_field_decl() instead of create_builtin_decl(). (objc_init): Do not initialize objc_ellipsis_node or TAG_EXECCLASS; In ObjC++ mode, call cxx_init() instead of c_objc_common_init(). (objc_finish_file): In ObjC++, call instantiate_pending_templates() and cp_finish_file(). (define_decl, get_static_reference, get_protocol_reference, create_builtin_decl): Remove functions. (objc_start_class_interface, objc_start_category_interface, objc_start_protocol, objc_continue_interface, objc_finish_interface, objc_start_class_implementation, objc_start_category_implementation, objc_continue_implementation, objc_finish_implementation, objc_set_visibility, objc_set_method_type, objc_build_method_signature, objc_add_method_declaration, objc_start_method_definition, objc_add_instance_variable, objc_get_protocol_qualified_type, create_field_decl, start_var_decl, finish_var_decl): New functions. (setup_string_decl): Simplify since it is only called once. (synth_module_prologue): Call build_class_template(); predefine 'id' and 'Class' as typedefs; rename 'temp_type' to 'type'; disable debug hooks for duration of function; fix GNU runtime messenger signatures to correspond to reality; forward-declare '__objc_exec_class' for the GNU runtime; call build_selector_table_decl(); in ObjC++ mode, generate 'extern "C" { ... }' wrappers around synthesized declarations; call build_protocol_template() and build_category_template(). (string_hash, string_eq): New functions. (objc_build_string_object): Check metaclass correctness only once; store string literals in hash table. (objc_build_constructor): Do not convert initializer elements; adjust for ObjC++ impedance mismatch. (build_objc_symtab_template): Call create_field_decl() instead of create_builtin_decl(). (init_objc_symtab): Add missing conversion to initializer element. (build_metadata_decl): Call start_var_decl() instead of define_decl(). (generate_objc_symtab_decl): Do not call build_category_template(); call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(). (build_module_descriptor): Call create_field_decl() instead of grokfield(); call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(); always mark module descriptor as used; move GNU runtime-specific functionality to build_module_initializer_routine(). (build_module_initializer_routine): New function, broken off of build_module_descriptor(). (objc_static_init_needed_p, objc_generate_static_init_call): New functions. (generate_static_references, generate_strings, build_selector_translation_table, generate_descriptor_table, generate_ivars_list, generate_dispatch_table, generate_category): Call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(); build a type directly instead of via groktypename(). (build_selector_reference_decl, build_selector_table_decl, build_class_reference_decl, build_protocol_reference, generate_objc_image_info): Call start_var_decl() instead of build_decl(). (build_selector_reference): For GNU runtime, do not call build_selector_reference_decl(). (build_selector, build_typed_selector_reference): Always convert result to the selector type. (add_objc_string): Cast return value to 'char *'. (build_method_prototype_template, build_selector_template, build_method_template): Use actual selector type for fields pointing to selectors. (finish_objc): For GNU runtime, call build_module_initializer_routine() after build_module_descriptor(). (generate_protocol_list, generate_shared_structures): Call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(); build a type directly instead of via groktypename(). (synth_id_with_class_suffix): Return a string. (get_arg_type_list): For instance methods, use the instance type for 'self'; do not call groktypename_in_parm_context(). (build_objc_string_decl): Squash redeclaration errors in ObjC++. (objc_is_class_name): Use OBJC_TYPE_NAME instead of TYPE_NAME; handle RECORD_TYPEs in ObjC as well as ObjC++. (objc_is_id): New function. (objc_is_object_ptr): Return the canonical type node. (objc_get_class_ivars): Simplify using get_class_ivars(). (get_class_ivars): Remove second parameter; create a fresh copy of the ivar list for each call; do not check for existence of super class. (objc_eh_runtime_type): Mark #ifndef OBJCPLUS. (objc_init_exceptions): When using SJLJ-style exceptions, require the use of '-fobjc-exceptions' flag; do not require it for DWARF-style exceptions. (objc_build_exc_ptr, next_sjlj_build_try_catch_finally): Use objc_object_type instead of objc_id_type. (objc_begin_catch_clause): Convert the incoming PARM_DECL into a VAR_DECL before placing it in the appropriate scope; do not call define_decl(); adjust call to c_begin_compound_stmt(); use objc_object_type instead of objc_id_type. (build_next_objc_exception_stuff): Call create_field_decl() instead of create_builtin_decl(); construct type directly instead of calling groktypename(); use OBJC_VOID_AT_END to mark end of function parameters. (build_private_template): Adjust call to get_class_ivars(); build a type directly instead of via groktypename(). (build_protocol_template, build_method_prototype_list_template, build_method_prototype_template, build_category_template, build_selector_template, build_class_template, build_super_template, build_ivar_template, build_ivar_list_template, build_method_list_template, build_method_template): Call create_field_decl() instead of grokfield(). (objc_method_parm_type): Do not call groktypename(). (generate_descriptor_table): Call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(). (generate_method_descriptors, build_protocol_initializer, generate_dispatch_tables, build_category_initializer, build_shared_structure_initializer): Do not call groktypename(). (generate_protocols): Call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(); do not call groktypename(). (error_with_ivar): Remove last parameter. (check_ivars): Do not iterate ovar CLASS_RAW_IVARS lists in addition to CLASS_IVARS lists; adjust calls to error_with_ivar(). (generate_ivar_lists): Convert one of the initializer elements; do not call groktypename(). (get_arg_type_list, start_method_def, gen_method_def): Account for new representation of variable arguments and '...' in Objective-C methods; add Objective-C++ impedance matching code. (is_objc_type_qualifier): Remove function. (adjust_type_for_id_default): Simplify; there is no longer a need to wade through declspecs. (lookup_interface, start_class, continue_class, finish_class, start_method_def, start_protocol, build_method_decl, objc_add_method, add_instance_variable, build_ivar_reference, is_ivar, is_private, get_super_receiver, objc_build_finally_epilogue): Make into static functions. (receiver_is_class_object): Use new IS_CLASS() macro. (objc_build_message_expr): Tweak ObjC++ message argument handling; call objc_finish_message_expr() instead of finish_message_expr(). (finish_message_expr): Rename to objc_finish_message_expr(); use OBJC_TYPE_NAME and OBJC_SET_TYPE_NAME macros instead of TYPE_NAME. call gen_type_name() instead of gen_declaration(); call objc_is_id() instead of using IS_ID and IS_CLASS; Use objc_class_name instead of calling get_identifier("Class"); handle CONVERT_EXPRs in receiver. (build_objc_method_call, warn_with_method): Do not call groktypename(). (build_ivar_reference): Call convert() instead of clobbering in a type. (hash_init): Initialize string_htab hash table. (add_instance_variable): Simplify parameter list; do not call grokfield(); do not populate CLASS_IVARS list. (start_class): Check for the existence of super class, if one was specified. (continue_class): Use CLASS_RAW_IVARS rather than CLASS_IVARS; do not call build_class_template(); adjust call to get_class_ivars(); call build_decl(), pushdecl() and finish_decl() instead of define_decl(). (finish_class): Call build_decl(), pushdecl() and finish_decl() instead of define_decl(). (add_protocols): Use PROTOCOL_BINFO_ELTS for the tree vector size. (start_protocol): Do not call build_protocol_template(); use PROTOCOL_BINFO_ELTS for the tree vector size. (encode_type_qualifiers): Do not handle the 'const' qualifier here. (encode_pointer): Encode 'const char *' as 'r*', for backwards compatibility. (encode_array): Use HOST_WIDE_INT_PRINT_DEC instead of "%ld". (encode_type): Handle the 'const' qualifier here. (objc_parmlist): New global variable, sued by objc_push_parm and objc_get_parm_info(). (objc_push_parm, objc_get_parm_info): New functions. (objc_expr_last): Remove function. (synth_self_and_ucmd_args): For instance methods, use the instance type for 'self'; call objc_push_parm() instead of push_parm_decl(). (start_method_def): Do not call push_scope(), declare_parm_level(), pop_scope(), push_parm_decl(), store_parm_decls() or objc_expr_last(); just use objc_push_parm() and objc_get_parm_info(). (comp_method_with_proto): Remove function. (objc_types_are_equivalent): Strip away indirections before comparing underlying types. (comp_proto_with_proto): Do not call groktypename(); types are no longer in raw declspec format. (objc_start_function): New function. (really_start_method): Call comp_proto_with_proto() instead of comp_method_with_proto(); call objc_start_function() instead of hand-crafting a function declarator. (continue_method_def, objc_expand_function_end): Remove functions. (get_super_receiver): Call objc_get_current_scope() instead of get_current_scope(); reference 'super_class' field (instead of 'class'). (finish_method_def): Rename to objc_finish_method_definition() and add a function decl parameter; move method encoding call from objc_expand_function_end(). (is_complex_decl, adorn_decl, gen_declarator, gen_declspecs, gen_declaration_1): Remove functions. (tmpbuf, RAW_DECLSPEC): Remove. (gen_declaration): Remove second parameter; simplify to deal with TYPE_P nodes instead of raw declspecs. (gen_type_name, gen_type_name_0): New functions. (gen_method_decl): Remove second parameter; call gen_type_name() instead of gen_declaration_1(). (dump_interface): Adjust calls to gen_declaration() and gen_method_decl(); do not allocate a separate string buffer. (init_objc): Allocate a larger string buffer to accommodate dump_interface(); adjust call to build_module_descriptor(); add call to build_module_initializer_routine() for the GNU runtime. (generate_classref_translation_entry): Do not call start_decl(); call finish_var_decl() instead of finish_decl(); call convert() instead of build_c_cast(). * objc-act.h (CLASS_OWN_IVARS): Remove accessor. (CLASS_BINFO_ELTS): Reduce from 6 to 5, now that CLASS_OWN_IVARS is gone. (OCTI_GNU_INIT_DECL, GNU_INIT_decl): New. (OCTI_ELLIPSIS_NODE, objc_ellipsis_node): Remove. (OCTI_ID_ID, id_type, objc_id_id): Rename to OCTI_ID_NAME, objc_object_type and objc_object_name, respectively. (OCTI_CLS_REF, OCTI_CLASS_NAME, objc_class_reference, objc_class_name): New. (IS_CLASS): New macro. (IS_ID, IS_SUPER): Robustify. (OCTI_EXECCLASS_DECL, execclass_decl): New. (finish_file, start_class, continue_class, finish_class, start_method_def, continue_method_def, finish_method_def, start_protocol, finish_protocol, objc_build_throw_stmt, objc_build_try_catch_finally_stmt, objc_build_synchronized_prologue, objc_build_synchronized_epilogue, objc_build_try_prologue, objc_build_try_epilogue, objc_build_catch_stmt, objc_build_catch_epilogue, objc_build_finally_prologue, objc_build_finally_epilogue, is_ivar, is_private, is_public, add_instance_variable, objc_add_method, get_super_receiver, objc_clear_super_receiver, get_class_ivars_from_name, get_class_reference, get_static_reference, get_object_reference, build_message_expr, finish_message_expr, build_selector_expr, build_ivar_reference, build_keyword_decl, build_method_decl, build_protocol_expr, build_objc_string_object, objc_declare_alias, objc_declare_class, objc_declare_protocols, objc_comptypes, objc_check_decl, build_encode_expr): Remove prototypes. (imp_count, cat_count): Make GGC-aware. (OBJC_SET_TYPE_NAME): New macro. From-SVN: r87168
2004-09-08 02:49:44 +02:00
if (METHOD_ADD_ARGS (method))
{
chain = TREE_CHAIN (METHOD_ADD_ARGS (method));
/* Know we have a chain of parm_decls. */
while (chain)
{
strcat (errbuf, ", ");
gen_type_name_0 (TREE_TYPE (TREE_VALUE (chain)));
1992-01-18 00:15:38 +01:00
chain = TREE_CHAIN (chain);
Makefile.in (c-parse.o): Depend on $(C_COMMON_H). [gcc/ChangeLog] 2004-09-07 Ziemowit Laski <zlaski@apple.com> * Makefile.in (c-parse.o): Depend on $(C_COMMON_H). * c-parse.in: Include c-common.h instead of objc-act.h. (ivar_decl_list, ivar_decls, ivar_decl, ivars, ivar_declarator, myparms, myparm): Remove %type declarations. (methodtype, optparms, OBJC_TYPE_QUAL, objc_quals, objc_qual, objc_typename, objc_try_catch_stmt, optellipsis): Add %type declarations. (objc_inherit_code, objc_public_flag): Remove. (typespec_nonreserved_nonattr): Call objc_get_protocol_qualified_type() instead of get_static_reference() and get_protocol_reference(). (stmt_nocomp): Call grokparm() on @catch parameter. (objcdef): Move semantic action to objc_finish_implementation(). (classdef): Move semantic action to objc_start_class_interface(), objc_continue_interface(), objc_finish_interface(), objc_start_class_implementation(), objc_continue_implementation(), objc_start_category_interface() and objc_start_category_implementation(). (protocoldef): Move semantic actions to objc_start_protocol() and objc_finish_interface(). (ivar_decl_list): Remove nonterminal. (visibility_spec): Move semantic actions to objc_set_visibility(). (ivar_decls): Remove assignment to $$. (ivar_decl): Rephrase in terms of component_decl; call objc_add_instance_variable(). (ivars, ivar_declarator): Remove nonterminals. (opt_semi): New nonterminal. (methodtype): Remove semantic actions. (methoddef): Move semantic actions to objc_set_method_type(), objc_start_method_definition() and objc_finish_method_definition(). (methodproto): Move semantic actions to objc_set_method_type() and objc_add_method_declaration(). (methoddecl): Use objc_typename instead of typename; move semantic actions to objc_build_method_signature(). (optarglist, myxdecls, mydecl, myparms, myparm): Remove nonterminals. (optparmlist): Express in terms of optparms and optellipsis. (optparms, optellipsis, objc_qual, objc_quals, objc_typename): New nonterminals. (keyworddecl): Use objc_typename instead of typename. (rid_to_yy): Mark RID_IN, RID_OUT, RID_INOUT, RID_BYCOPY, RID_BYREF and RID_ONEWAY as returning OBJC_TYPE_QUAL to yyparse(). [gcc/objc/ChangeLog] 2004-09-07 Ziemowit Laski <zlaski@apple.com> * Make-lang.in (objc/objc-parse.o): Depend on $(C_COMMON_H) instead of objc/objc-act.h. (objc/objc-act.o): Depend on $(HASHTAB_H). * objc-act.c: Include hashtab.h; in ObjC++ mode, include cp-tree.h and objcp-decl.h instead of c-tree.h. (build_module_descriptor, get_class_ivars, synth_id_with_class_suffix, error_with_ivar, gen_method_decl, gen_declaration, setup_string_decl, build_protocol_template): Adjust prototypes. (build_module_initializer_routine, start_class, continue_class, finish_class, start_method_def, objc_start_function, start_protocol, build_method_decl, objc_add_method, add_instance_variable, build_ivar_reference, is_ivar, is_private, get_super_receiver, build_selector_table_decl, objc_push_parm, objc_get_parm_info, gen_type_name, gen_type_name_0, start_var_decl, finish_var_decl, create_field_decl): New prototypes. (objc_expand_function_end, comp_method_with_proto, objc_expr_last, gen_declaration_1, gen_declarator, is_complex_decl, adorn_decl, define_decl, create_builtin_decl, gen_declspecs): Remove prototypes. (TYPE_ID): Rename to OBJECT_TYPEDEF_NAME. (CLASS_TYPEDEF_NAME): New. (TAG_EXECCLASS): Change from a global variable to a #define. (TAG_RETURN_STRUCT): Delete. (TAG_GNUINIT): New, holds '__objc_gnu_init' name. (objc_inherit_code, objc_public_flag): New, moved from c-parse.in. (string_descriptor): New struct. (string_htab): New hash table. (string_hash, string_eq): New prototypes. (generate_struct_by_value_array): Call create_field_decl() instead of create_builtin_decl(). (objc_init): Do not initialize objc_ellipsis_node or TAG_EXECCLASS; In ObjC++ mode, call cxx_init() instead of c_objc_common_init(). (objc_finish_file): In ObjC++, call instantiate_pending_templates() and cp_finish_file(). (define_decl, get_static_reference, get_protocol_reference, create_builtin_decl): Remove functions. (objc_start_class_interface, objc_start_category_interface, objc_start_protocol, objc_continue_interface, objc_finish_interface, objc_start_class_implementation, objc_start_category_implementation, objc_continue_implementation, objc_finish_implementation, objc_set_visibility, objc_set_method_type, objc_build_method_signature, objc_add_method_declaration, objc_start_method_definition, objc_add_instance_variable, objc_get_protocol_qualified_type, create_field_decl, start_var_decl, finish_var_decl): New functions. (setup_string_decl): Simplify since it is only called once. (synth_module_prologue): Call build_class_template(); predefine 'id' and 'Class' as typedefs; rename 'temp_type' to 'type'; disable debug hooks for duration of function; fix GNU runtime messenger signatures to correspond to reality; forward-declare '__objc_exec_class' for the GNU runtime; call build_selector_table_decl(); in ObjC++ mode, generate 'extern "C" { ... }' wrappers around synthesized declarations; call build_protocol_template() and build_category_template(). (string_hash, string_eq): New functions. (objc_build_string_object): Check metaclass correctness only once; store string literals in hash table. (objc_build_constructor): Do not convert initializer elements; adjust for ObjC++ impedance mismatch. (build_objc_symtab_template): Call create_field_decl() instead of create_builtin_decl(). (init_objc_symtab): Add missing conversion to initializer element. (build_metadata_decl): Call start_var_decl() instead of define_decl(). (generate_objc_symtab_decl): Do not call build_category_template(); call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(). (build_module_descriptor): Call create_field_decl() instead of grokfield(); call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(); always mark module descriptor as used; move GNU runtime-specific functionality to build_module_initializer_routine(). (build_module_initializer_routine): New function, broken off of build_module_descriptor(). (objc_static_init_needed_p, objc_generate_static_init_call): New functions. (generate_static_references, generate_strings, build_selector_translation_table, generate_descriptor_table, generate_ivars_list, generate_dispatch_table, generate_category): Call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(); build a type directly instead of via groktypename(). (build_selector_reference_decl, build_selector_table_decl, build_class_reference_decl, build_protocol_reference, generate_objc_image_info): Call start_var_decl() instead of build_decl(). (build_selector_reference): For GNU runtime, do not call build_selector_reference_decl(). (build_selector, build_typed_selector_reference): Always convert result to the selector type. (add_objc_string): Cast return value to 'char *'. (build_method_prototype_template, build_selector_template, build_method_template): Use actual selector type for fields pointing to selectors. (finish_objc): For GNU runtime, call build_module_initializer_routine() after build_module_descriptor(). (generate_protocol_list, generate_shared_structures): Call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(); build a type directly instead of via groktypename(). (synth_id_with_class_suffix): Return a string. (get_arg_type_list): For instance methods, use the instance type for 'self'; do not call groktypename_in_parm_context(). (build_objc_string_decl): Squash redeclaration errors in ObjC++. (objc_is_class_name): Use OBJC_TYPE_NAME instead of TYPE_NAME; handle RECORD_TYPEs in ObjC as well as ObjC++. (objc_is_id): New function. (objc_is_object_ptr): Return the canonical type node. (objc_get_class_ivars): Simplify using get_class_ivars(). (get_class_ivars): Remove second parameter; create a fresh copy of the ivar list for each call; do not check for existence of super class. (objc_eh_runtime_type): Mark #ifndef OBJCPLUS. (objc_init_exceptions): When using SJLJ-style exceptions, require the use of '-fobjc-exceptions' flag; do not require it for DWARF-style exceptions. (objc_build_exc_ptr, next_sjlj_build_try_catch_finally): Use objc_object_type instead of objc_id_type. (objc_begin_catch_clause): Convert the incoming PARM_DECL into a VAR_DECL before placing it in the appropriate scope; do not call define_decl(); adjust call to c_begin_compound_stmt(); use objc_object_type instead of objc_id_type. (build_next_objc_exception_stuff): Call create_field_decl() instead of create_builtin_decl(); construct type directly instead of calling groktypename(); use OBJC_VOID_AT_END to mark end of function parameters. (build_private_template): Adjust call to get_class_ivars(); build a type directly instead of via groktypename(). (build_protocol_template, build_method_prototype_list_template, build_method_prototype_template, build_category_template, build_selector_template, build_class_template, build_super_template, build_ivar_template, build_ivar_list_template, build_method_list_template, build_method_template): Call create_field_decl() instead of grokfield(). (objc_method_parm_type): Do not call groktypename(). (generate_descriptor_table): Call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(). (generate_method_descriptors, build_protocol_initializer, generate_dispatch_tables, build_category_initializer, build_shared_structure_initializer): Do not call groktypename(). (generate_protocols): Call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(); do not call groktypename(). (error_with_ivar): Remove last parameter. (check_ivars): Do not iterate ovar CLASS_RAW_IVARS lists in addition to CLASS_IVARS lists; adjust calls to error_with_ivar(). (generate_ivar_lists): Convert one of the initializer elements; do not call groktypename(). (get_arg_type_list, start_method_def, gen_method_def): Account for new representation of variable arguments and '...' in Objective-C methods; add Objective-C++ impedance matching code. (is_objc_type_qualifier): Remove function. (adjust_type_for_id_default): Simplify; there is no longer a need to wade through declspecs. (lookup_interface, start_class, continue_class, finish_class, start_method_def, start_protocol, build_method_decl, objc_add_method, add_instance_variable, build_ivar_reference, is_ivar, is_private, get_super_receiver, objc_build_finally_epilogue): Make into static functions. (receiver_is_class_object): Use new IS_CLASS() macro. (objc_build_message_expr): Tweak ObjC++ message argument handling; call objc_finish_message_expr() instead of finish_message_expr(). (finish_message_expr): Rename to objc_finish_message_expr(); use OBJC_TYPE_NAME and OBJC_SET_TYPE_NAME macros instead of TYPE_NAME. call gen_type_name() instead of gen_declaration(); call objc_is_id() instead of using IS_ID and IS_CLASS; Use objc_class_name instead of calling get_identifier("Class"); handle CONVERT_EXPRs in receiver. (build_objc_method_call, warn_with_method): Do not call groktypename(). (build_ivar_reference): Call convert() instead of clobbering in a type. (hash_init): Initialize string_htab hash table. (add_instance_variable): Simplify parameter list; do not call grokfield(); do not populate CLASS_IVARS list. (start_class): Check for the existence of super class, if one was specified. (continue_class): Use CLASS_RAW_IVARS rather than CLASS_IVARS; do not call build_class_template(); adjust call to get_class_ivars(); call build_decl(), pushdecl() and finish_decl() instead of define_decl(). (finish_class): Call build_decl(), pushdecl() and finish_decl() instead of define_decl(). (add_protocols): Use PROTOCOL_BINFO_ELTS for the tree vector size. (start_protocol): Do not call build_protocol_template(); use PROTOCOL_BINFO_ELTS for the tree vector size. (encode_type_qualifiers): Do not handle the 'const' qualifier here. (encode_pointer): Encode 'const char *' as 'r*', for backwards compatibility. (encode_array): Use HOST_WIDE_INT_PRINT_DEC instead of "%ld". (encode_type): Handle the 'const' qualifier here. (objc_parmlist): New global variable, sued by objc_push_parm and objc_get_parm_info(). (objc_push_parm, objc_get_parm_info): New functions. (objc_expr_last): Remove function. (synth_self_and_ucmd_args): For instance methods, use the instance type for 'self'; call objc_push_parm() instead of push_parm_decl(). (start_method_def): Do not call push_scope(), declare_parm_level(), pop_scope(), push_parm_decl(), store_parm_decls() or objc_expr_last(); just use objc_push_parm() and objc_get_parm_info(). (comp_method_with_proto): Remove function. (objc_types_are_equivalent): Strip away indirections before comparing underlying types. (comp_proto_with_proto): Do not call groktypename(); types are no longer in raw declspec format. (objc_start_function): New function. (really_start_method): Call comp_proto_with_proto() instead of comp_method_with_proto(); call objc_start_function() instead of hand-crafting a function declarator. (continue_method_def, objc_expand_function_end): Remove functions. (get_super_receiver): Call objc_get_current_scope() instead of get_current_scope(); reference 'super_class' field (instead of 'class'). (finish_method_def): Rename to objc_finish_method_definition() and add a function decl parameter; move method encoding call from objc_expand_function_end(). (is_complex_decl, adorn_decl, gen_declarator, gen_declspecs, gen_declaration_1): Remove functions. (tmpbuf, RAW_DECLSPEC): Remove. (gen_declaration): Remove second parameter; simplify to deal with TYPE_P nodes instead of raw declspecs. (gen_type_name, gen_type_name_0): New functions. (gen_method_decl): Remove second parameter; call gen_type_name() instead of gen_declaration_1(). (dump_interface): Adjust calls to gen_declaration() and gen_method_decl(); do not allocate a separate string buffer. (init_objc): Allocate a larger string buffer to accommodate dump_interface(); adjust call to build_module_descriptor(); add call to build_module_initializer_routine() for the GNU runtime. (generate_classref_translation_entry): Do not call start_decl(); call finish_var_decl() instead of finish_decl(); call convert() instead of build_c_cast(). * objc-act.h (CLASS_OWN_IVARS): Remove accessor. (CLASS_BINFO_ELTS): Reduce from 6 to 5, now that CLASS_OWN_IVARS is gone. (OCTI_GNU_INIT_DECL, GNU_INIT_decl): New. (OCTI_ELLIPSIS_NODE, objc_ellipsis_node): Remove. (OCTI_ID_ID, id_type, objc_id_id): Rename to OCTI_ID_NAME, objc_object_type and objc_object_name, respectively. (OCTI_CLS_REF, OCTI_CLASS_NAME, objc_class_reference, objc_class_name): New. (IS_CLASS): New macro. (IS_ID, IS_SUPER): Robustify. (OCTI_EXECCLASS_DECL, execclass_decl): New. (finish_file, start_class, continue_class, finish_class, start_method_def, continue_method_def, finish_method_def, start_protocol, finish_protocol, objc_build_throw_stmt, objc_build_try_catch_finally_stmt, objc_build_synchronized_prologue, objc_build_synchronized_epilogue, objc_build_try_prologue, objc_build_try_epilogue, objc_build_catch_stmt, objc_build_catch_epilogue, objc_build_finally_prologue, objc_build_finally_epilogue, is_ivar, is_private, is_public, add_instance_variable, objc_add_method, get_super_receiver, objc_clear_super_receiver, get_class_ivars_from_name, get_class_reference, get_static_reference, get_object_reference, build_message_expr, finish_message_expr, build_selector_expr, build_ivar_reference, build_keyword_decl, build_method_decl, build_protocol_expr, build_objc_string_object, objc_declare_alias, objc_declare_class, objc_declare_protocols, objc_comptypes, objc_check_decl, build_encode_expr): Remove prototypes. (imp_count, cat_count): Make GGC-aware. (OBJC_SET_TYPE_NAME): New macro. From-SVN: r87168
2004-09-08 02:49:44 +02:00
}
if (METHOD_ADD_ARGS_ELLIPSIS_P (method))
Makefile.in (c-parse.o): Depend on $(C_COMMON_H). [gcc/ChangeLog] 2004-09-07 Ziemowit Laski <zlaski@apple.com> * Makefile.in (c-parse.o): Depend on $(C_COMMON_H). * c-parse.in: Include c-common.h instead of objc-act.h. (ivar_decl_list, ivar_decls, ivar_decl, ivars, ivar_declarator, myparms, myparm): Remove %type declarations. (methodtype, optparms, OBJC_TYPE_QUAL, objc_quals, objc_qual, objc_typename, objc_try_catch_stmt, optellipsis): Add %type declarations. (objc_inherit_code, objc_public_flag): Remove. (typespec_nonreserved_nonattr): Call objc_get_protocol_qualified_type() instead of get_static_reference() and get_protocol_reference(). (stmt_nocomp): Call grokparm() on @catch parameter. (objcdef): Move semantic action to objc_finish_implementation(). (classdef): Move semantic action to objc_start_class_interface(), objc_continue_interface(), objc_finish_interface(), objc_start_class_implementation(), objc_continue_implementation(), objc_start_category_interface() and objc_start_category_implementation(). (protocoldef): Move semantic actions to objc_start_protocol() and objc_finish_interface(). (ivar_decl_list): Remove nonterminal. (visibility_spec): Move semantic actions to objc_set_visibility(). (ivar_decls): Remove assignment to $$. (ivar_decl): Rephrase in terms of component_decl; call objc_add_instance_variable(). (ivars, ivar_declarator): Remove nonterminals. (opt_semi): New nonterminal. (methodtype): Remove semantic actions. (methoddef): Move semantic actions to objc_set_method_type(), objc_start_method_definition() and objc_finish_method_definition(). (methodproto): Move semantic actions to objc_set_method_type() and objc_add_method_declaration(). (methoddecl): Use objc_typename instead of typename; move semantic actions to objc_build_method_signature(). (optarglist, myxdecls, mydecl, myparms, myparm): Remove nonterminals. (optparmlist): Express in terms of optparms and optellipsis. (optparms, optellipsis, objc_qual, objc_quals, objc_typename): New nonterminals. (keyworddecl): Use objc_typename instead of typename. (rid_to_yy): Mark RID_IN, RID_OUT, RID_INOUT, RID_BYCOPY, RID_BYREF and RID_ONEWAY as returning OBJC_TYPE_QUAL to yyparse(). [gcc/objc/ChangeLog] 2004-09-07 Ziemowit Laski <zlaski@apple.com> * Make-lang.in (objc/objc-parse.o): Depend on $(C_COMMON_H) instead of objc/objc-act.h. (objc/objc-act.o): Depend on $(HASHTAB_H). * objc-act.c: Include hashtab.h; in ObjC++ mode, include cp-tree.h and objcp-decl.h instead of c-tree.h. (build_module_descriptor, get_class_ivars, synth_id_with_class_suffix, error_with_ivar, gen_method_decl, gen_declaration, setup_string_decl, build_protocol_template): Adjust prototypes. (build_module_initializer_routine, start_class, continue_class, finish_class, start_method_def, objc_start_function, start_protocol, build_method_decl, objc_add_method, add_instance_variable, build_ivar_reference, is_ivar, is_private, get_super_receiver, build_selector_table_decl, objc_push_parm, objc_get_parm_info, gen_type_name, gen_type_name_0, start_var_decl, finish_var_decl, create_field_decl): New prototypes. (objc_expand_function_end, comp_method_with_proto, objc_expr_last, gen_declaration_1, gen_declarator, is_complex_decl, adorn_decl, define_decl, create_builtin_decl, gen_declspecs): Remove prototypes. (TYPE_ID): Rename to OBJECT_TYPEDEF_NAME. (CLASS_TYPEDEF_NAME): New. (TAG_EXECCLASS): Change from a global variable to a #define. (TAG_RETURN_STRUCT): Delete. (TAG_GNUINIT): New, holds '__objc_gnu_init' name. (objc_inherit_code, objc_public_flag): New, moved from c-parse.in. (string_descriptor): New struct. (string_htab): New hash table. (string_hash, string_eq): New prototypes. (generate_struct_by_value_array): Call create_field_decl() instead of create_builtin_decl(). (objc_init): Do not initialize objc_ellipsis_node or TAG_EXECCLASS; In ObjC++ mode, call cxx_init() instead of c_objc_common_init(). (objc_finish_file): In ObjC++, call instantiate_pending_templates() and cp_finish_file(). (define_decl, get_static_reference, get_protocol_reference, create_builtin_decl): Remove functions. (objc_start_class_interface, objc_start_category_interface, objc_start_protocol, objc_continue_interface, objc_finish_interface, objc_start_class_implementation, objc_start_category_implementation, objc_continue_implementation, objc_finish_implementation, objc_set_visibility, objc_set_method_type, objc_build_method_signature, objc_add_method_declaration, objc_start_method_definition, objc_add_instance_variable, objc_get_protocol_qualified_type, create_field_decl, start_var_decl, finish_var_decl): New functions. (setup_string_decl): Simplify since it is only called once. (synth_module_prologue): Call build_class_template(); predefine 'id' and 'Class' as typedefs; rename 'temp_type' to 'type'; disable debug hooks for duration of function; fix GNU runtime messenger signatures to correspond to reality; forward-declare '__objc_exec_class' for the GNU runtime; call build_selector_table_decl(); in ObjC++ mode, generate 'extern "C" { ... }' wrappers around synthesized declarations; call build_protocol_template() and build_category_template(). (string_hash, string_eq): New functions. (objc_build_string_object): Check metaclass correctness only once; store string literals in hash table. (objc_build_constructor): Do not convert initializer elements; adjust for ObjC++ impedance mismatch. (build_objc_symtab_template): Call create_field_decl() instead of create_builtin_decl(). (init_objc_symtab): Add missing conversion to initializer element. (build_metadata_decl): Call start_var_decl() instead of define_decl(). (generate_objc_symtab_decl): Do not call build_category_template(); call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(). (build_module_descriptor): Call create_field_decl() instead of grokfield(); call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(); always mark module descriptor as used; move GNU runtime-specific functionality to build_module_initializer_routine(). (build_module_initializer_routine): New function, broken off of build_module_descriptor(). (objc_static_init_needed_p, objc_generate_static_init_call): New functions. (generate_static_references, generate_strings, build_selector_translation_table, generate_descriptor_table, generate_ivars_list, generate_dispatch_table, generate_category): Call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(); build a type directly instead of via groktypename(). (build_selector_reference_decl, build_selector_table_decl, build_class_reference_decl, build_protocol_reference, generate_objc_image_info): Call start_var_decl() instead of build_decl(). (build_selector_reference): For GNU runtime, do not call build_selector_reference_decl(). (build_selector, build_typed_selector_reference): Always convert result to the selector type. (add_objc_string): Cast return value to 'char *'. (build_method_prototype_template, build_selector_template, build_method_template): Use actual selector type for fields pointing to selectors. (finish_objc): For GNU runtime, call build_module_initializer_routine() after build_module_descriptor(). (generate_protocol_list, generate_shared_structures): Call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(); build a type directly instead of via groktypename(). (synth_id_with_class_suffix): Return a string. (get_arg_type_list): For instance methods, use the instance type for 'self'; do not call groktypename_in_parm_context(). (build_objc_string_decl): Squash redeclaration errors in ObjC++. (objc_is_class_name): Use OBJC_TYPE_NAME instead of TYPE_NAME; handle RECORD_TYPEs in ObjC as well as ObjC++. (objc_is_id): New function. (objc_is_object_ptr): Return the canonical type node. (objc_get_class_ivars): Simplify using get_class_ivars(). (get_class_ivars): Remove second parameter; create a fresh copy of the ivar list for each call; do not check for existence of super class. (objc_eh_runtime_type): Mark #ifndef OBJCPLUS. (objc_init_exceptions): When using SJLJ-style exceptions, require the use of '-fobjc-exceptions' flag; do not require it for DWARF-style exceptions. (objc_build_exc_ptr, next_sjlj_build_try_catch_finally): Use objc_object_type instead of objc_id_type. (objc_begin_catch_clause): Convert the incoming PARM_DECL into a VAR_DECL before placing it in the appropriate scope; do not call define_decl(); adjust call to c_begin_compound_stmt(); use objc_object_type instead of objc_id_type. (build_next_objc_exception_stuff): Call create_field_decl() instead of create_builtin_decl(); construct type directly instead of calling groktypename(); use OBJC_VOID_AT_END to mark end of function parameters. (build_private_template): Adjust call to get_class_ivars(); build a type directly instead of via groktypename(). (build_protocol_template, build_method_prototype_list_template, build_method_prototype_template, build_category_template, build_selector_template, build_class_template, build_super_template, build_ivar_template, build_ivar_list_template, build_method_list_template, build_method_template): Call create_field_decl() instead of grokfield(). (objc_method_parm_type): Do not call groktypename(). (generate_descriptor_table): Call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(). (generate_method_descriptors, build_protocol_initializer, generate_dispatch_tables, build_category_initializer, build_shared_structure_initializer): Do not call groktypename(). (generate_protocols): Call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(); do not call groktypename(). (error_with_ivar): Remove last parameter. (check_ivars): Do not iterate ovar CLASS_RAW_IVARS lists in addition to CLASS_IVARS lists; adjust calls to error_with_ivar(). (generate_ivar_lists): Convert one of the initializer elements; do not call groktypename(). (get_arg_type_list, start_method_def, gen_method_def): Account for new representation of variable arguments and '...' in Objective-C methods; add Objective-C++ impedance matching code. (is_objc_type_qualifier): Remove function. (adjust_type_for_id_default): Simplify; there is no longer a need to wade through declspecs. (lookup_interface, start_class, continue_class, finish_class, start_method_def, start_protocol, build_method_decl, objc_add_method, add_instance_variable, build_ivar_reference, is_ivar, is_private, get_super_receiver, objc_build_finally_epilogue): Make into static functions. (receiver_is_class_object): Use new IS_CLASS() macro. (objc_build_message_expr): Tweak ObjC++ message argument handling; call objc_finish_message_expr() instead of finish_message_expr(). (finish_message_expr): Rename to objc_finish_message_expr(); use OBJC_TYPE_NAME and OBJC_SET_TYPE_NAME macros instead of TYPE_NAME. call gen_type_name() instead of gen_declaration(); call objc_is_id() instead of using IS_ID and IS_CLASS; Use objc_class_name instead of calling get_identifier("Class"); handle CONVERT_EXPRs in receiver. (build_objc_method_call, warn_with_method): Do not call groktypename(). (build_ivar_reference): Call convert() instead of clobbering in a type. (hash_init): Initialize string_htab hash table. (add_instance_variable): Simplify parameter list; do not call grokfield(); do not populate CLASS_IVARS list. (start_class): Check for the existence of super class, if one was specified. (continue_class): Use CLASS_RAW_IVARS rather than CLASS_IVARS; do not call build_class_template(); adjust call to get_class_ivars(); call build_decl(), pushdecl() and finish_decl() instead of define_decl(). (finish_class): Call build_decl(), pushdecl() and finish_decl() instead of define_decl(). (add_protocols): Use PROTOCOL_BINFO_ELTS for the tree vector size. (start_protocol): Do not call build_protocol_template(); use PROTOCOL_BINFO_ELTS for the tree vector size. (encode_type_qualifiers): Do not handle the 'const' qualifier here. (encode_pointer): Encode 'const char *' as 'r*', for backwards compatibility. (encode_array): Use HOST_WIDE_INT_PRINT_DEC instead of "%ld". (encode_type): Handle the 'const' qualifier here. (objc_parmlist): New global variable, sued by objc_push_parm and objc_get_parm_info(). (objc_push_parm, objc_get_parm_info): New functions. (objc_expr_last): Remove function. (synth_self_and_ucmd_args): For instance methods, use the instance type for 'self'; call objc_push_parm() instead of push_parm_decl(). (start_method_def): Do not call push_scope(), declare_parm_level(), pop_scope(), push_parm_decl(), store_parm_decls() or objc_expr_last(); just use objc_push_parm() and objc_get_parm_info(). (comp_method_with_proto): Remove function. (objc_types_are_equivalent): Strip away indirections before comparing underlying types. (comp_proto_with_proto): Do not call groktypename(); types are no longer in raw declspec format. (objc_start_function): New function. (really_start_method): Call comp_proto_with_proto() instead of comp_method_with_proto(); call objc_start_function() instead of hand-crafting a function declarator. (continue_method_def, objc_expand_function_end): Remove functions. (get_super_receiver): Call objc_get_current_scope() instead of get_current_scope(); reference 'super_class' field (instead of 'class'). (finish_method_def): Rename to objc_finish_method_definition() and add a function decl parameter; move method encoding call from objc_expand_function_end(). (is_complex_decl, adorn_decl, gen_declarator, gen_declspecs, gen_declaration_1): Remove functions. (tmpbuf, RAW_DECLSPEC): Remove. (gen_declaration): Remove second parameter; simplify to deal with TYPE_P nodes instead of raw declspecs. (gen_type_name, gen_type_name_0): New functions. (gen_method_decl): Remove second parameter; call gen_type_name() instead of gen_declaration_1(). (dump_interface): Adjust calls to gen_declaration() and gen_method_decl(); do not allocate a separate string buffer. (init_objc): Allocate a larger string buffer to accommodate dump_interface(); adjust call to build_module_descriptor(); add call to build_module_initializer_routine() for the GNU runtime. (generate_classref_translation_entry): Do not call start_decl(); call finish_var_decl() instead of finish_decl(); call convert() instead of build_c_cast(). * objc-act.h (CLASS_OWN_IVARS): Remove accessor. (CLASS_BINFO_ELTS): Reduce from 6 to 5, now that CLASS_OWN_IVARS is gone. (OCTI_GNU_INIT_DECL, GNU_INIT_decl): New. (OCTI_ELLIPSIS_NODE, objc_ellipsis_node): Remove. (OCTI_ID_ID, id_type, objc_id_id): Rename to OCTI_ID_NAME, objc_object_type and objc_object_name, respectively. (OCTI_CLS_REF, OCTI_CLASS_NAME, objc_class_reference, objc_class_name): New. (IS_CLASS): New macro. (IS_ID, IS_SUPER): Robustify. (OCTI_EXECCLASS_DECL, execclass_decl): New. (finish_file, start_class, continue_class, finish_class, start_method_def, continue_method_def, finish_method_def, start_protocol, finish_protocol, objc_build_throw_stmt, objc_build_try_catch_finally_stmt, objc_build_synchronized_prologue, objc_build_synchronized_epilogue, objc_build_try_prologue, objc_build_try_epilogue, objc_build_catch_stmt, objc_build_catch_epilogue, objc_build_finally_prologue, objc_build_finally_epilogue, is_ivar, is_private, is_public, add_instance_variable, objc_add_method, get_super_receiver, objc_clear_super_receiver, get_class_ivars_from_name, get_class_reference, get_static_reference, get_object_reference, build_message_expr, finish_message_expr, build_selector_expr, build_ivar_reference, build_keyword_decl, build_method_decl, build_protocol_expr, build_objc_string_object, objc_declare_alias, objc_declare_class, objc_declare_protocols, objc_comptypes, objc_check_decl, build_encode_expr): Remove prototypes. (imp_count, cat_count): Make GGC-aware. (OBJC_SET_TYPE_NAME): New macro. From-SVN: r87168
2004-09-08 02:49:44 +02:00
strcat (errbuf, ", ...");
1992-01-18 00:15:38 +01:00
}
}
else
1996-07-04 00:07:53 +02:00
/* We have a unary selector. */
Makefile.in (c-parse.o): Depend on $(C_COMMON_H). [gcc/ChangeLog] 2004-09-07 Ziemowit Laski <zlaski@apple.com> * Makefile.in (c-parse.o): Depend on $(C_COMMON_H). * c-parse.in: Include c-common.h instead of objc-act.h. (ivar_decl_list, ivar_decls, ivar_decl, ivars, ivar_declarator, myparms, myparm): Remove %type declarations. (methodtype, optparms, OBJC_TYPE_QUAL, objc_quals, objc_qual, objc_typename, objc_try_catch_stmt, optellipsis): Add %type declarations. (objc_inherit_code, objc_public_flag): Remove. (typespec_nonreserved_nonattr): Call objc_get_protocol_qualified_type() instead of get_static_reference() and get_protocol_reference(). (stmt_nocomp): Call grokparm() on @catch parameter. (objcdef): Move semantic action to objc_finish_implementation(). (classdef): Move semantic action to objc_start_class_interface(), objc_continue_interface(), objc_finish_interface(), objc_start_class_implementation(), objc_continue_implementation(), objc_start_category_interface() and objc_start_category_implementation(). (protocoldef): Move semantic actions to objc_start_protocol() and objc_finish_interface(). (ivar_decl_list): Remove nonterminal. (visibility_spec): Move semantic actions to objc_set_visibility(). (ivar_decls): Remove assignment to $$. (ivar_decl): Rephrase in terms of component_decl; call objc_add_instance_variable(). (ivars, ivar_declarator): Remove nonterminals. (opt_semi): New nonterminal. (methodtype): Remove semantic actions. (methoddef): Move semantic actions to objc_set_method_type(), objc_start_method_definition() and objc_finish_method_definition(). (methodproto): Move semantic actions to objc_set_method_type() and objc_add_method_declaration(). (methoddecl): Use objc_typename instead of typename; move semantic actions to objc_build_method_signature(). (optarglist, myxdecls, mydecl, myparms, myparm): Remove nonterminals. (optparmlist): Express in terms of optparms and optellipsis. (optparms, optellipsis, objc_qual, objc_quals, objc_typename): New nonterminals. (keyworddecl): Use objc_typename instead of typename. (rid_to_yy): Mark RID_IN, RID_OUT, RID_INOUT, RID_BYCOPY, RID_BYREF and RID_ONEWAY as returning OBJC_TYPE_QUAL to yyparse(). [gcc/objc/ChangeLog] 2004-09-07 Ziemowit Laski <zlaski@apple.com> * Make-lang.in (objc/objc-parse.o): Depend on $(C_COMMON_H) instead of objc/objc-act.h. (objc/objc-act.o): Depend on $(HASHTAB_H). * objc-act.c: Include hashtab.h; in ObjC++ mode, include cp-tree.h and objcp-decl.h instead of c-tree.h. (build_module_descriptor, get_class_ivars, synth_id_with_class_suffix, error_with_ivar, gen_method_decl, gen_declaration, setup_string_decl, build_protocol_template): Adjust prototypes. (build_module_initializer_routine, start_class, continue_class, finish_class, start_method_def, objc_start_function, start_protocol, build_method_decl, objc_add_method, add_instance_variable, build_ivar_reference, is_ivar, is_private, get_super_receiver, build_selector_table_decl, objc_push_parm, objc_get_parm_info, gen_type_name, gen_type_name_0, start_var_decl, finish_var_decl, create_field_decl): New prototypes. (objc_expand_function_end, comp_method_with_proto, objc_expr_last, gen_declaration_1, gen_declarator, is_complex_decl, adorn_decl, define_decl, create_builtin_decl, gen_declspecs): Remove prototypes. (TYPE_ID): Rename to OBJECT_TYPEDEF_NAME. (CLASS_TYPEDEF_NAME): New. (TAG_EXECCLASS): Change from a global variable to a #define. (TAG_RETURN_STRUCT): Delete. (TAG_GNUINIT): New, holds '__objc_gnu_init' name. (objc_inherit_code, objc_public_flag): New, moved from c-parse.in. (string_descriptor): New struct. (string_htab): New hash table. (string_hash, string_eq): New prototypes. (generate_struct_by_value_array): Call create_field_decl() instead of create_builtin_decl(). (objc_init): Do not initialize objc_ellipsis_node or TAG_EXECCLASS; In ObjC++ mode, call cxx_init() instead of c_objc_common_init(). (objc_finish_file): In ObjC++, call instantiate_pending_templates() and cp_finish_file(). (define_decl, get_static_reference, get_protocol_reference, create_builtin_decl): Remove functions. (objc_start_class_interface, objc_start_category_interface, objc_start_protocol, objc_continue_interface, objc_finish_interface, objc_start_class_implementation, objc_start_category_implementation, objc_continue_implementation, objc_finish_implementation, objc_set_visibility, objc_set_method_type, objc_build_method_signature, objc_add_method_declaration, objc_start_method_definition, objc_add_instance_variable, objc_get_protocol_qualified_type, create_field_decl, start_var_decl, finish_var_decl): New functions. (setup_string_decl): Simplify since it is only called once. (synth_module_prologue): Call build_class_template(); predefine 'id' and 'Class' as typedefs; rename 'temp_type' to 'type'; disable debug hooks for duration of function; fix GNU runtime messenger signatures to correspond to reality; forward-declare '__objc_exec_class' for the GNU runtime; call build_selector_table_decl(); in ObjC++ mode, generate 'extern "C" { ... }' wrappers around synthesized declarations; call build_protocol_template() and build_category_template(). (string_hash, string_eq): New functions. (objc_build_string_object): Check metaclass correctness only once; store string literals in hash table. (objc_build_constructor): Do not convert initializer elements; adjust for ObjC++ impedance mismatch. (build_objc_symtab_template): Call create_field_decl() instead of create_builtin_decl(). (init_objc_symtab): Add missing conversion to initializer element. (build_metadata_decl): Call start_var_decl() instead of define_decl(). (generate_objc_symtab_decl): Do not call build_category_template(); call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(). (build_module_descriptor): Call create_field_decl() instead of grokfield(); call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(); always mark module descriptor as used; move GNU runtime-specific functionality to build_module_initializer_routine(). (build_module_initializer_routine): New function, broken off of build_module_descriptor(). (objc_static_init_needed_p, objc_generate_static_init_call): New functions. (generate_static_references, generate_strings, build_selector_translation_table, generate_descriptor_table, generate_ivars_list, generate_dispatch_table, generate_category): Call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(); build a type directly instead of via groktypename(). (build_selector_reference_decl, build_selector_table_decl, build_class_reference_decl, build_protocol_reference, generate_objc_image_info): Call start_var_decl() instead of build_decl(). (build_selector_reference): For GNU runtime, do not call build_selector_reference_decl(). (build_selector, build_typed_selector_reference): Always convert result to the selector type. (add_objc_string): Cast return value to 'char *'. (build_method_prototype_template, build_selector_template, build_method_template): Use actual selector type for fields pointing to selectors. (finish_objc): For GNU runtime, call build_module_initializer_routine() after build_module_descriptor(). (generate_protocol_list, generate_shared_structures): Call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(); build a type directly instead of via groktypename(). (synth_id_with_class_suffix): Return a string. (get_arg_type_list): For instance methods, use the instance type for 'self'; do not call groktypename_in_parm_context(). (build_objc_string_decl): Squash redeclaration errors in ObjC++. (objc_is_class_name): Use OBJC_TYPE_NAME instead of TYPE_NAME; handle RECORD_TYPEs in ObjC as well as ObjC++. (objc_is_id): New function. (objc_is_object_ptr): Return the canonical type node. (objc_get_class_ivars): Simplify using get_class_ivars(). (get_class_ivars): Remove second parameter; create a fresh copy of the ivar list for each call; do not check for existence of super class. (objc_eh_runtime_type): Mark #ifndef OBJCPLUS. (objc_init_exceptions): When using SJLJ-style exceptions, require the use of '-fobjc-exceptions' flag; do not require it for DWARF-style exceptions. (objc_build_exc_ptr, next_sjlj_build_try_catch_finally): Use objc_object_type instead of objc_id_type. (objc_begin_catch_clause): Convert the incoming PARM_DECL into a VAR_DECL before placing it in the appropriate scope; do not call define_decl(); adjust call to c_begin_compound_stmt(); use objc_object_type instead of objc_id_type. (build_next_objc_exception_stuff): Call create_field_decl() instead of create_builtin_decl(); construct type directly instead of calling groktypename(); use OBJC_VOID_AT_END to mark end of function parameters. (build_private_template): Adjust call to get_class_ivars(); build a type directly instead of via groktypename(). (build_protocol_template, build_method_prototype_list_template, build_method_prototype_template, build_category_template, build_selector_template, build_class_template, build_super_template, build_ivar_template, build_ivar_list_template, build_method_list_template, build_method_template): Call create_field_decl() instead of grokfield(). (objc_method_parm_type): Do not call groktypename(). (generate_descriptor_table): Call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(). (generate_method_descriptors, build_protocol_initializer, generate_dispatch_tables, build_category_initializer, build_shared_structure_initializer): Do not call groktypename(). (generate_protocols): Call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(); do not call groktypename(). (error_with_ivar): Remove last parameter. (check_ivars): Do not iterate ovar CLASS_RAW_IVARS lists in addition to CLASS_IVARS lists; adjust calls to error_with_ivar(). (generate_ivar_lists): Convert one of the initializer elements; do not call groktypename(). (get_arg_type_list, start_method_def, gen_method_def): Account for new representation of variable arguments and '...' in Objective-C methods; add Objective-C++ impedance matching code. (is_objc_type_qualifier): Remove function. (adjust_type_for_id_default): Simplify; there is no longer a need to wade through declspecs. (lookup_interface, start_class, continue_class, finish_class, start_method_def, start_protocol, build_method_decl, objc_add_method, add_instance_variable, build_ivar_reference, is_ivar, is_private, get_super_receiver, objc_build_finally_epilogue): Make into static functions. (receiver_is_class_object): Use new IS_CLASS() macro. (objc_build_message_expr): Tweak ObjC++ message argument handling; call objc_finish_message_expr() instead of finish_message_expr(). (finish_message_expr): Rename to objc_finish_message_expr(); use OBJC_TYPE_NAME and OBJC_SET_TYPE_NAME macros instead of TYPE_NAME. call gen_type_name() instead of gen_declaration(); call objc_is_id() instead of using IS_ID and IS_CLASS; Use objc_class_name instead of calling get_identifier("Class"); handle CONVERT_EXPRs in receiver. (build_objc_method_call, warn_with_method): Do not call groktypename(). (build_ivar_reference): Call convert() instead of clobbering in a type. (hash_init): Initialize string_htab hash table. (add_instance_variable): Simplify parameter list; do not call grokfield(); do not populate CLASS_IVARS list. (start_class): Check for the existence of super class, if one was specified. (continue_class): Use CLASS_RAW_IVARS rather than CLASS_IVARS; do not call build_class_template(); adjust call to get_class_ivars(); call build_decl(), pushdecl() and finish_decl() instead of define_decl(). (finish_class): Call build_decl(), pushdecl() and finish_decl() instead of define_decl(). (add_protocols): Use PROTOCOL_BINFO_ELTS for the tree vector size. (start_protocol): Do not call build_protocol_template(); use PROTOCOL_BINFO_ELTS for the tree vector size. (encode_type_qualifiers): Do not handle the 'const' qualifier here. (encode_pointer): Encode 'const char *' as 'r*', for backwards compatibility. (encode_array): Use HOST_WIDE_INT_PRINT_DEC instead of "%ld". (encode_type): Handle the 'const' qualifier here. (objc_parmlist): New global variable, sued by objc_push_parm and objc_get_parm_info(). (objc_push_parm, objc_get_parm_info): New functions. (objc_expr_last): Remove function. (synth_self_and_ucmd_args): For instance methods, use the instance type for 'self'; call objc_push_parm() instead of push_parm_decl(). (start_method_def): Do not call push_scope(), declare_parm_level(), pop_scope(), push_parm_decl(), store_parm_decls() or objc_expr_last(); just use objc_push_parm() and objc_get_parm_info(). (comp_method_with_proto): Remove function. (objc_types_are_equivalent): Strip away indirections before comparing underlying types. (comp_proto_with_proto): Do not call groktypename(); types are no longer in raw declspec format. (objc_start_function): New function. (really_start_method): Call comp_proto_with_proto() instead of comp_method_with_proto(); call objc_start_function() instead of hand-crafting a function declarator. (continue_method_def, objc_expand_function_end): Remove functions. (get_super_receiver): Call objc_get_current_scope() instead of get_current_scope(); reference 'super_class' field (instead of 'class'). (finish_method_def): Rename to objc_finish_method_definition() and add a function decl parameter; move method encoding call from objc_expand_function_end(). (is_complex_decl, adorn_decl, gen_declarator, gen_declspecs, gen_declaration_1): Remove functions. (tmpbuf, RAW_DECLSPEC): Remove. (gen_declaration): Remove second parameter; simplify to deal with TYPE_P nodes instead of raw declspecs. (gen_type_name, gen_type_name_0): New functions. (gen_method_decl): Remove second parameter; call gen_type_name() instead of gen_declaration_1(). (dump_interface): Adjust calls to gen_declaration() and gen_method_decl(); do not allocate a separate string buffer. (init_objc): Allocate a larger string buffer to accommodate dump_interface(); adjust call to build_module_descriptor(); add call to build_module_initializer_routine() for the GNU runtime. (generate_classref_translation_entry): Do not call start_decl(); call finish_var_decl() instead of finish_decl(); call convert() instead of build_c_cast(). * objc-act.h (CLASS_OWN_IVARS): Remove accessor. (CLASS_BINFO_ELTS): Reduce from 6 to 5, now that CLASS_OWN_IVARS is gone. (OCTI_GNU_INIT_DECL, GNU_INIT_decl): New. (OCTI_ELLIPSIS_NODE, objc_ellipsis_node): Remove. (OCTI_ID_ID, id_type, objc_id_id): Rename to OCTI_ID_NAME, objc_object_type and objc_object_name, respectively. (OCTI_CLS_REF, OCTI_CLASS_NAME, objc_class_reference, objc_class_name): New. (IS_CLASS): New macro. (IS_ID, IS_SUPER): Robustify. (OCTI_EXECCLASS_DECL, execclass_decl): New. (finish_file, start_class, continue_class, finish_class, start_method_def, continue_method_def, finish_method_def, start_protocol, finish_protocol, objc_build_throw_stmt, objc_build_try_catch_finally_stmt, objc_build_synchronized_prologue, objc_build_synchronized_epilogue, objc_build_try_prologue, objc_build_try_epilogue, objc_build_catch_stmt, objc_build_catch_epilogue, objc_build_finally_prologue, objc_build_finally_epilogue, is_ivar, is_private, is_public, add_instance_variable, objc_add_method, get_super_receiver, objc_clear_super_receiver, get_class_ivars_from_name, get_class_reference, get_static_reference, get_object_reference, build_message_expr, finish_message_expr, build_selector_expr, build_ivar_reference, build_keyword_decl, build_method_decl, build_protocol_expr, build_objc_string_object, objc_declare_alias, objc_declare_class, objc_declare_protocols, objc_comptypes, objc_check_decl, build_encode_expr): Remove prototypes. (imp_count, cat_count): Make GGC-aware. (OBJC_SET_TYPE_NAME): New macro. From-SVN: r87168
2004-09-08 02:49:44 +02:00
strcat (errbuf, IDENTIFIER_POINTER (METHOD_SEL_NAME (method)));
1992-01-18 00:15:38 +01:00
Makefile.in (c-parse.o): Depend on $(C_COMMON_H). [gcc/ChangeLog] 2004-09-07 Ziemowit Laski <zlaski@apple.com> * Makefile.in (c-parse.o): Depend on $(C_COMMON_H). * c-parse.in: Include c-common.h instead of objc-act.h. (ivar_decl_list, ivar_decls, ivar_decl, ivars, ivar_declarator, myparms, myparm): Remove %type declarations. (methodtype, optparms, OBJC_TYPE_QUAL, objc_quals, objc_qual, objc_typename, objc_try_catch_stmt, optellipsis): Add %type declarations. (objc_inherit_code, objc_public_flag): Remove. (typespec_nonreserved_nonattr): Call objc_get_protocol_qualified_type() instead of get_static_reference() and get_protocol_reference(). (stmt_nocomp): Call grokparm() on @catch parameter. (objcdef): Move semantic action to objc_finish_implementation(). (classdef): Move semantic action to objc_start_class_interface(), objc_continue_interface(), objc_finish_interface(), objc_start_class_implementation(), objc_continue_implementation(), objc_start_category_interface() and objc_start_category_implementation(). (protocoldef): Move semantic actions to objc_start_protocol() and objc_finish_interface(). (ivar_decl_list): Remove nonterminal. (visibility_spec): Move semantic actions to objc_set_visibility(). (ivar_decls): Remove assignment to $$. (ivar_decl): Rephrase in terms of component_decl; call objc_add_instance_variable(). (ivars, ivar_declarator): Remove nonterminals. (opt_semi): New nonterminal. (methodtype): Remove semantic actions. (methoddef): Move semantic actions to objc_set_method_type(), objc_start_method_definition() and objc_finish_method_definition(). (methodproto): Move semantic actions to objc_set_method_type() and objc_add_method_declaration(). (methoddecl): Use objc_typename instead of typename; move semantic actions to objc_build_method_signature(). (optarglist, myxdecls, mydecl, myparms, myparm): Remove nonterminals. (optparmlist): Express in terms of optparms and optellipsis. (optparms, optellipsis, objc_qual, objc_quals, objc_typename): New nonterminals. (keyworddecl): Use objc_typename instead of typename. (rid_to_yy): Mark RID_IN, RID_OUT, RID_INOUT, RID_BYCOPY, RID_BYREF and RID_ONEWAY as returning OBJC_TYPE_QUAL to yyparse(). [gcc/objc/ChangeLog] 2004-09-07 Ziemowit Laski <zlaski@apple.com> * Make-lang.in (objc/objc-parse.o): Depend on $(C_COMMON_H) instead of objc/objc-act.h. (objc/objc-act.o): Depend on $(HASHTAB_H). * objc-act.c: Include hashtab.h; in ObjC++ mode, include cp-tree.h and objcp-decl.h instead of c-tree.h. (build_module_descriptor, get_class_ivars, synth_id_with_class_suffix, error_with_ivar, gen_method_decl, gen_declaration, setup_string_decl, build_protocol_template): Adjust prototypes. (build_module_initializer_routine, start_class, continue_class, finish_class, start_method_def, objc_start_function, start_protocol, build_method_decl, objc_add_method, add_instance_variable, build_ivar_reference, is_ivar, is_private, get_super_receiver, build_selector_table_decl, objc_push_parm, objc_get_parm_info, gen_type_name, gen_type_name_0, start_var_decl, finish_var_decl, create_field_decl): New prototypes. (objc_expand_function_end, comp_method_with_proto, objc_expr_last, gen_declaration_1, gen_declarator, is_complex_decl, adorn_decl, define_decl, create_builtin_decl, gen_declspecs): Remove prototypes. (TYPE_ID): Rename to OBJECT_TYPEDEF_NAME. (CLASS_TYPEDEF_NAME): New. (TAG_EXECCLASS): Change from a global variable to a #define. (TAG_RETURN_STRUCT): Delete. (TAG_GNUINIT): New, holds '__objc_gnu_init' name. (objc_inherit_code, objc_public_flag): New, moved from c-parse.in. (string_descriptor): New struct. (string_htab): New hash table. (string_hash, string_eq): New prototypes. (generate_struct_by_value_array): Call create_field_decl() instead of create_builtin_decl(). (objc_init): Do not initialize objc_ellipsis_node or TAG_EXECCLASS; In ObjC++ mode, call cxx_init() instead of c_objc_common_init(). (objc_finish_file): In ObjC++, call instantiate_pending_templates() and cp_finish_file(). (define_decl, get_static_reference, get_protocol_reference, create_builtin_decl): Remove functions. (objc_start_class_interface, objc_start_category_interface, objc_start_protocol, objc_continue_interface, objc_finish_interface, objc_start_class_implementation, objc_start_category_implementation, objc_continue_implementation, objc_finish_implementation, objc_set_visibility, objc_set_method_type, objc_build_method_signature, objc_add_method_declaration, objc_start_method_definition, objc_add_instance_variable, objc_get_protocol_qualified_type, create_field_decl, start_var_decl, finish_var_decl): New functions. (setup_string_decl): Simplify since it is only called once. (synth_module_prologue): Call build_class_template(); predefine 'id' and 'Class' as typedefs; rename 'temp_type' to 'type'; disable debug hooks for duration of function; fix GNU runtime messenger signatures to correspond to reality; forward-declare '__objc_exec_class' for the GNU runtime; call build_selector_table_decl(); in ObjC++ mode, generate 'extern "C" { ... }' wrappers around synthesized declarations; call build_protocol_template() and build_category_template(). (string_hash, string_eq): New functions. (objc_build_string_object): Check metaclass correctness only once; store string literals in hash table. (objc_build_constructor): Do not convert initializer elements; adjust for ObjC++ impedance mismatch. (build_objc_symtab_template): Call create_field_decl() instead of create_builtin_decl(). (init_objc_symtab): Add missing conversion to initializer element. (build_metadata_decl): Call start_var_decl() instead of define_decl(). (generate_objc_symtab_decl): Do not call build_category_template(); call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(). (build_module_descriptor): Call create_field_decl() instead of grokfield(); call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(); always mark module descriptor as used; move GNU runtime-specific functionality to build_module_initializer_routine(). (build_module_initializer_routine): New function, broken off of build_module_descriptor(). (objc_static_init_needed_p, objc_generate_static_init_call): New functions. (generate_static_references, generate_strings, build_selector_translation_table, generate_descriptor_table, generate_ivars_list, generate_dispatch_table, generate_category): Call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(); build a type directly instead of via groktypename(). (build_selector_reference_decl, build_selector_table_decl, build_class_reference_decl, build_protocol_reference, generate_objc_image_info): Call start_var_decl() instead of build_decl(). (build_selector_reference): For GNU runtime, do not call build_selector_reference_decl(). (build_selector, build_typed_selector_reference): Always convert result to the selector type. (add_objc_string): Cast return value to 'char *'. (build_method_prototype_template, build_selector_template, build_method_template): Use actual selector type for fields pointing to selectors. (finish_objc): For GNU runtime, call build_module_initializer_routine() after build_module_descriptor(). (generate_protocol_list, generate_shared_structures): Call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(); build a type directly instead of via groktypename(). (synth_id_with_class_suffix): Return a string. (get_arg_type_list): For instance methods, use the instance type for 'self'; do not call groktypename_in_parm_context(). (build_objc_string_decl): Squash redeclaration errors in ObjC++. (objc_is_class_name): Use OBJC_TYPE_NAME instead of TYPE_NAME; handle RECORD_TYPEs in ObjC as well as ObjC++. (objc_is_id): New function. (objc_is_object_ptr): Return the canonical type node. (objc_get_class_ivars): Simplify using get_class_ivars(). (get_class_ivars): Remove second parameter; create a fresh copy of the ivar list for each call; do not check for existence of super class. (objc_eh_runtime_type): Mark #ifndef OBJCPLUS. (objc_init_exceptions): When using SJLJ-style exceptions, require the use of '-fobjc-exceptions' flag; do not require it for DWARF-style exceptions. (objc_build_exc_ptr, next_sjlj_build_try_catch_finally): Use objc_object_type instead of objc_id_type. (objc_begin_catch_clause): Convert the incoming PARM_DECL into a VAR_DECL before placing it in the appropriate scope; do not call define_decl(); adjust call to c_begin_compound_stmt(); use objc_object_type instead of objc_id_type. (build_next_objc_exception_stuff): Call create_field_decl() instead of create_builtin_decl(); construct type directly instead of calling groktypename(); use OBJC_VOID_AT_END to mark end of function parameters. (build_private_template): Adjust call to get_class_ivars(); build a type directly instead of via groktypename(). (build_protocol_template, build_method_prototype_list_template, build_method_prototype_template, build_category_template, build_selector_template, build_class_template, build_super_template, build_ivar_template, build_ivar_list_template, build_method_list_template, build_method_template): Call create_field_decl() instead of grokfield(). (objc_method_parm_type): Do not call groktypename(). (generate_descriptor_table): Call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(). (generate_method_descriptors, build_protocol_initializer, generate_dispatch_tables, build_category_initializer, build_shared_structure_initializer): Do not call groktypename(). (generate_protocols): Call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(); do not call groktypename(). (error_with_ivar): Remove last parameter. (check_ivars): Do not iterate ovar CLASS_RAW_IVARS lists in addition to CLASS_IVARS lists; adjust calls to error_with_ivar(). (generate_ivar_lists): Convert one of the initializer elements; do not call groktypename(). (get_arg_type_list, start_method_def, gen_method_def): Account for new representation of variable arguments and '...' in Objective-C methods; add Objective-C++ impedance matching code. (is_objc_type_qualifier): Remove function. (adjust_type_for_id_default): Simplify; there is no longer a need to wade through declspecs. (lookup_interface, start_class, continue_class, finish_class, start_method_def, start_protocol, build_method_decl, objc_add_method, add_instance_variable, build_ivar_reference, is_ivar, is_private, get_super_receiver, objc_build_finally_epilogue): Make into static functions. (receiver_is_class_object): Use new IS_CLASS() macro. (objc_build_message_expr): Tweak ObjC++ message argument handling; call objc_finish_message_expr() instead of finish_message_expr(). (finish_message_expr): Rename to objc_finish_message_expr(); use OBJC_TYPE_NAME and OBJC_SET_TYPE_NAME macros instead of TYPE_NAME. call gen_type_name() instead of gen_declaration(); call objc_is_id() instead of using IS_ID and IS_CLASS; Use objc_class_name instead of calling get_identifier("Class"); handle CONVERT_EXPRs in receiver. (build_objc_method_call, warn_with_method): Do not call groktypename(). (build_ivar_reference): Call convert() instead of clobbering in a type. (hash_init): Initialize string_htab hash table. (add_instance_variable): Simplify parameter list; do not call grokfield(); do not populate CLASS_IVARS list. (start_class): Check for the existence of super class, if one was specified. (continue_class): Use CLASS_RAW_IVARS rather than CLASS_IVARS; do not call build_class_template(); adjust call to get_class_ivars(); call build_decl(), pushdecl() and finish_decl() instead of define_decl(). (finish_class): Call build_decl(), pushdecl() and finish_decl() instead of define_decl(). (add_protocols): Use PROTOCOL_BINFO_ELTS for the tree vector size. (start_protocol): Do not call build_protocol_template(); use PROTOCOL_BINFO_ELTS for the tree vector size. (encode_type_qualifiers): Do not handle the 'const' qualifier here. (encode_pointer): Encode 'const char *' as 'r*', for backwards compatibility. (encode_array): Use HOST_WIDE_INT_PRINT_DEC instead of "%ld". (encode_type): Handle the 'const' qualifier here. (objc_parmlist): New global variable, sued by objc_push_parm and objc_get_parm_info(). (objc_push_parm, objc_get_parm_info): New functions. (objc_expr_last): Remove function. (synth_self_and_ucmd_args): For instance methods, use the instance type for 'self'; call objc_push_parm() instead of push_parm_decl(). (start_method_def): Do not call push_scope(), declare_parm_level(), pop_scope(), push_parm_decl(), store_parm_decls() or objc_expr_last(); just use objc_push_parm() and objc_get_parm_info(). (comp_method_with_proto): Remove function. (objc_types_are_equivalent): Strip away indirections before comparing underlying types. (comp_proto_with_proto): Do not call groktypename(); types are no longer in raw declspec format. (objc_start_function): New function. (really_start_method): Call comp_proto_with_proto() instead of comp_method_with_proto(); call objc_start_function() instead of hand-crafting a function declarator. (continue_method_def, objc_expand_function_end): Remove functions. (get_super_receiver): Call objc_get_current_scope() instead of get_current_scope(); reference 'super_class' field (instead of 'class'). (finish_method_def): Rename to objc_finish_method_definition() and add a function decl parameter; move method encoding call from objc_expand_function_end(). (is_complex_decl, adorn_decl, gen_declarator, gen_declspecs, gen_declaration_1): Remove functions. (tmpbuf, RAW_DECLSPEC): Remove. (gen_declaration): Remove second parameter; simplify to deal with TYPE_P nodes instead of raw declspecs. (gen_type_name, gen_type_name_0): New functions. (gen_method_decl): Remove second parameter; call gen_type_name() instead of gen_declaration_1(). (dump_interface): Adjust calls to gen_declaration() and gen_method_decl(); do not allocate a separate string buffer. (init_objc): Allocate a larger string buffer to accommodate dump_interface(); adjust call to build_module_descriptor(); add call to build_module_initializer_routine() for the GNU runtime. (generate_classref_translation_entry): Do not call start_decl(); call finish_var_decl() instead of finish_decl(); call convert() instead of build_c_cast(). * objc-act.h (CLASS_OWN_IVARS): Remove accessor. (CLASS_BINFO_ELTS): Reduce from 6 to 5, now that CLASS_OWN_IVARS is gone. (OCTI_GNU_INIT_DECL, GNU_INIT_decl): New. (OCTI_ELLIPSIS_NODE, objc_ellipsis_node): Remove. (OCTI_ID_ID, id_type, objc_id_id): Rename to OCTI_ID_NAME, objc_object_type and objc_object_name, respectively. (OCTI_CLS_REF, OCTI_CLASS_NAME, objc_class_reference, objc_class_name): New. (IS_CLASS): New macro. (IS_ID, IS_SUPER): Robustify. (OCTI_EXECCLASS_DECL, execclass_decl): New. (finish_file, start_class, continue_class, finish_class, start_method_def, continue_method_def, finish_method_def, start_protocol, finish_protocol, objc_build_throw_stmt, objc_build_try_catch_finally_stmt, objc_build_synchronized_prologue, objc_build_synchronized_epilogue, objc_build_try_prologue, objc_build_try_epilogue, objc_build_catch_stmt, objc_build_catch_epilogue, objc_build_finally_prologue, objc_build_finally_epilogue, is_ivar, is_private, is_public, add_instance_variable, objc_add_method, get_super_receiver, objc_clear_super_receiver, get_class_ivars_from_name, get_class_reference, get_static_reference, get_object_reference, build_message_expr, finish_message_expr, build_selector_expr, build_ivar_reference, build_keyword_decl, build_method_decl, build_protocol_expr, build_objc_string_object, objc_declare_alias, objc_declare_class, objc_declare_protocols, objc_comptypes, objc_check_decl, build_encode_expr): Remove prototypes. (imp_count, cat_count): Make GGC-aware. (OBJC_SET_TYPE_NAME): New macro. From-SVN: r87168
2004-09-08 02:49:44 +02:00
return errbuf;
1992-01-18 00:15:38 +01:00
}
/* Debug info. */
/* Dump an @interface declaration of the supplied class CHAIN to the
supplied file FP. Used to implement the -gen-decls option (which
prints out an @interface declaration of all classes compiled in
this run); potentially useful for debugging the compiler too. */
1992-01-18 00:15:38 +01:00
static void
dump_interface (FILE *fp, tree chain)
1992-01-18 00:15:38 +01:00
{
/* FIXME: A heap overflow here whenever a method (or ivar)
declaration is so long that it doesn't fit in the buffer. The
code and all the related functions should be rewritten to avoid
using fixed size buffers. */
const char *my_name = IDENTIFIER_POINTER (CLASS_NAME (chain));
1992-01-18 00:15:38 +01:00
tree ivar_decls = CLASS_RAW_IVARS (chain);
tree nst_methods = CLASS_NST_METHODS (chain);
tree cls_methods = CLASS_CLS_METHODS (chain);
fprintf (fp, "\n@interface %s", my_name);
/* CLASS_SUPER_NAME is used to store the superclass name for
classes, and the category name for categories. */
1992-01-18 00:15:38 +01:00
if (CLASS_SUPER_NAME (chain))
{
const char *name = IDENTIFIER_POINTER (CLASS_SUPER_NAME (chain));
if (TREE_CODE (chain) == CATEGORY_IMPLEMENTATION_TYPE
|| TREE_CODE (chain) == CATEGORY_INTERFACE_TYPE)
{
fprintf (fp, " (%s)\n", name);
}
else
{
fprintf (fp, " : %s\n", name);
}
1992-01-18 00:15:38 +01:00
}
else
fprintf (fp, "\n");
/* FIXME - the following doesn't seem to work at the moment. */
1992-01-18 00:15:38 +01:00
if (ivar_decls)
{
fprintf (fp, "{\n");
do
{
Makefile.in (c-parse.o): Depend on $(C_COMMON_H). [gcc/ChangeLog] 2004-09-07 Ziemowit Laski <zlaski@apple.com> * Makefile.in (c-parse.o): Depend on $(C_COMMON_H). * c-parse.in: Include c-common.h instead of objc-act.h. (ivar_decl_list, ivar_decls, ivar_decl, ivars, ivar_declarator, myparms, myparm): Remove %type declarations. (methodtype, optparms, OBJC_TYPE_QUAL, objc_quals, objc_qual, objc_typename, objc_try_catch_stmt, optellipsis): Add %type declarations. (objc_inherit_code, objc_public_flag): Remove. (typespec_nonreserved_nonattr): Call objc_get_protocol_qualified_type() instead of get_static_reference() and get_protocol_reference(). (stmt_nocomp): Call grokparm() on @catch parameter. (objcdef): Move semantic action to objc_finish_implementation(). (classdef): Move semantic action to objc_start_class_interface(), objc_continue_interface(), objc_finish_interface(), objc_start_class_implementation(), objc_continue_implementation(), objc_start_category_interface() and objc_start_category_implementation(). (protocoldef): Move semantic actions to objc_start_protocol() and objc_finish_interface(). (ivar_decl_list): Remove nonterminal. (visibility_spec): Move semantic actions to objc_set_visibility(). (ivar_decls): Remove assignment to $$. (ivar_decl): Rephrase in terms of component_decl; call objc_add_instance_variable(). (ivars, ivar_declarator): Remove nonterminals. (opt_semi): New nonterminal. (methodtype): Remove semantic actions. (methoddef): Move semantic actions to objc_set_method_type(), objc_start_method_definition() and objc_finish_method_definition(). (methodproto): Move semantic actions to objc_set_method_type() and objc_add_method_declaration(). (methoddecl): Use objc_typename instead of typename; move semantic actions to objc_build_method_signature(). (optarglist, myxdecls, mydecl, myparms, myparm): Remove nonterminals. (optparmlist): Express in terms of optparms and optellipsis. (optparms, optellipsis, objc_qual, objc_quals, objc_typename): New nonterminals. (keyworddecl): Use objc_typename instead of typename. (rid_to_yy): Mark RID_IN, RID_OUT, RID_INOUT, RID_BYCOPY, RID_BYREF and RID_ONEWAY as returning OBJC_TYPE_QUAL to yyparse(). [gcc/objc/ChangeLog] 2004-09-07 Ziemowit Laski <zlaski@apple.com> * Make-lang.in (objc/objc-parse.o): Depend on $(C_COMMON_H) instead of objc/objc-act.h. (objc/objc-act.o): Depend on $(HASHTAB_H). * objc-act.c: Include hashtab.h; in ObjC++ mode, include cp-tree.h and objcp-decl.h instead of c-tree.h. (build_module_descriptor, get_class_ivars, synth_id_with_class_suffix, error_with_ivar, gen_method_decl, gen_declaration, setup_string_decl, build_protocol_template): Adjust prototypes. (build_module_initializer_routine, start_class, continue_class, finish_class, start_method_def, objc_start_function, start_protocol, build_method_decl, objc_add_method, add_instance_variable, build_ivar_reference, is_ivar, is_private, get_super_receiver, build_selector_table_decl, objc_push_parm, objc_get_parm_info, gen_type_name, gen_type_name_0, start_var_decl, finish_var_decl, create_field_decl): New prototypes. (objc_expand_function_end, comp_method_with_proto, objc_expr_last, gen_declaration_1, gen_declarator, is_complex_decl, adorn_decl, define_decl, create_builtin_decl, gen_declspecs): Remove prototypes. (TYPE_ID): Rename to OBJECT_TYPEDEF_NAME. (CLASS_TYPEDEF_NAME): New. (TAG_EXECCLASS): Change from a global variable to a #define. (TAG_RETURN_STRUCT): Delete. (TAG_GNUINIT): New, holds '__objc_gnu_init' name. (objc_inherit_code, objc_public_flag): New, moved from c-parse.in. (string_descriptor): New struct. (string_htab): New hash table. (string_hash, string_eq): New prototypes. (generate_struct_by_value_array): Call create_field_decl() instead of create_builtin_decl(). (objc_init): Do not initialize objc_ellipsis_node or TAG_EXECCLASS; In ObjC++ mode, call cxx_init() instead of c_objc_common_init(). (objc_finish_file): In ObjC++, call instantiate_pending_templates() and cp_finish_file(). (define_decl, get_static_reference, get_protocol_reference, create_builtin_decl): Remove functions. (objc_start_class_interface, objc_start_category_interface, objc_start_protocol, objc_continue_interface, objc_finish_interface, objc_start_class_implementation, objc_start_category_implementation, objc_continue_implementation, objc_finish_implementation, objc_set_visibility, objc_set_method_type, objc_build_method_signature, objc_add_method_declaration, objc_start_method_definition, objc_add_instance_variable, objc_get_protocol_qualified_type, create_field_decl, start_var_decl, finish_var_decl): New functions. (setup_string_decl): Simplify since it is only called once. (synth_module_prologue): Call build_class_template(); predefine 'id' and 'Class' as typedefs; rename 'temp_type' to 'type'; disable debug hooks for duration of function; fix GNU runtime messenger signatures to correspond to reality; forward-declare '__objc_exec_class' for the GNU runtime; call build_selector_table_decl(); in ObjC++ mode, generate 'extern "C" { ... }' wrappers around synthesized declarations; call build_protocol_template() and build_category_template(). (string_hash, string_eq): New functions. (objc_build_string_object): Check metaclass correctness only once; store string literals in hash table. (objc_build_constructor): Do not convert initializer elements; adjust for ObjC++ impedance mismatch. (build_objc_symtab_template): Call create_field_decl() instead of create_builtin_decl(). (init_objc_symtab): Add missing conversion to initializer element. (build_metadata_decl): Call start_var_decl() instead of define_decl(). (generate_objc_symtab_decl): Do not call build_category_template(); call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(). (build_module_descriptor): Call create_field_decl() instead of grokfield(); call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(); always mark module descriptor as used; move GNU runtime-specific functionality to build_module_initializer_routine(). (build_module_initializer_routine): New function, broken off of build_module_descriptor(). (objc_static_init_needed_p, objc_generate_static_init_call): New functions. (generate_static_references, generate_strings, build_selector_translation_table, generate_descriptor_table, generate_ivars_list, generate_dispatch_table, generate_category): Call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(); build a type directly instead of via groktypename(). (build_selector_reference_decl, build_selector_table_decl, build_class_reference_decl, build_protocol_reference, generate_objc_image_info): Call start_var_decl() instead of build_decl(). (build_selector_reference): For GNU runtime, do not call build_selector_reference_decl(). (build_selector, build_typed_selector_reference): Always convert result to the selector type. (add_objc_string): Cast return value to 'char *'. (build_method_prototype_template, build_selector_template, build_method_template): Use actual selector type for fields pointing to selectors. (finish_objc): For GNU runtime, call build_module_initializer_routine() after build_module_descriptor(). (generate_protocol_list, generate_shared_structures): Call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(); build a type directly instead of via groktypename(). (synth_id_with_class_suffix): Return a string. (get_arg_type_list): For instance methods, use the instance type for 'self'; do not call groktypename_in_parm_context(). (build_objc_string_decl): Squash redeclaration errors in ObjC++. (objc_is_class_name): Use OBJC_TYPE_NAME instead of TYPE_NAME; handle RECORD_TYPEs in ObjC as well as ObjC++. (objc_is_id): New function. (objc_is_object_ptr): Return the canonical type node. (objc_get_class_ivars): Simplify using get_class_ivars(). (get_class_ivars): Remove second parameter; create a fresh copy of the ivar list for each call; do not check for existence of super class. (objc_eh_runtime_type): Mark #ifndef OBJCPLUS. (objc_init_exceptions): When using SJLJ-style exceptions, require the use of '-fobjc-exceptions' flag; do not require it for DWARF-style exceptions. (objc_build_exc_ptr, next_sjlj_build_try_catch_finally): Use objc_object_type instead of objc_id_type. (objc_begin_catch_clause): Convert the incoming PARM_DECL into a VAR_DECL before placing it in the appropriate scope; do not call define_decl(); adjust call to c_begin_compound_stmt(); use objc_object_type instead of objc_id_type. (build_next_objc_exception_stuff): Call create_field_decl() instead of create_builtin_decl(); construct type directly instead of calling groktypename(); use OBJC_VOID_AT_END to mark end of function parameters. (build_private_template): Adjust call to get_class_ivars(); build a type directly instead of via groktypename(). (build_protocol_template, build_method_prototype_list_template, build_method_prototype_template, build_category_template, build_selector_template, build_class_template, build_super_template, build_ivar_template, build_ivar_list_template, build_method_list_template, build_method_template): Call create_field_decl() instead of grokfield(). (objc_method_parm_type): Do not call groktypename(). (generate_descriptor_table): Call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(). (generate_method_descriptors, build_protocol_initializer, generate_dispatch_tables, build_category_initializer, build_shared_structure_initializer): Do not call groktypename(). (generate_protocols): Call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(); do not call groktypename(). (error_with_ivar): Remove last parameter. (check_ivars): Do not iterate ovar CLASS_RAW_IVARS lists in addition to CLASS_IVARS lists; adjust calls to error_with_ivar(). (generate_ivar_lists): Convert one of the initializer elements; do not call groktypename(). (get_arg_type_list, start_method_def, gen_method_def): Account for new representation of variable arguments and '...' in Objective-C methods; add Objective-C++ impedance matching code. (is_objc_type_qualifier): Remove function. (adjust_type_for_id_default): Simplify; there is no longer a need to wade through declspecs. (lookup_interface, start_class, continue_class, finish_class, start_method_def, start_protocol, build_method_decl, objc_add_method, add_instance_variable, build_ivar_reference, is_ivar, is_private, get_super_receiver, objc_build_finally_epilogue): Make into static functions. (receiver_is_class_object): Use new IS_CLASS() macro. (objc_build_message_expr): Tweak ObjC++ message argument handling; call objc_finish_message_expr() instead of finish_message_expr(). (finish_message_expr): Rename to objc_finish_message_expr(); use OBJC_TYPE_NAME and OBJC_SET_TYPE_NAME macros instead of TYPE_NAME. call gen_type_name() instead of gen_declaration(); call objc_is_id() instead of using IS_ID and IS_CLASS; Use objc_class_name instead of calling get_identifier("Class"); handle CONVERT_EXPRs in receiver. (build_objc_method_call, warn_with_method): Do not call groktypename(). (build_ivar_reference): Call convert() instead of clobbering in a type. (hash_init): Initialize string_htab hash table. (add_instance_variable): Simplify parameter list; do not call grokfield(); do not populate CLASS_IVARS list. (start_class): Check for the existence of super class, if one was specified. (continue_class): Use CLASS_RAW_IVARS rather than CLASS_IVARS; do not call build_class_template(); adjust call to get_class_ivars(); call build_decl(), pushdecl() and finish_decl() instead of define_decl(). (finish_class): Call build_decl(), pushdecl() and finish_decl() instead of define_decl(). (add_protocols): Use PROTOCOL_BINFO_ELTS for the tree vector size. (start_protocol): Do not call build_protocol_template(); use PROTOCOL_BINFO_ELTS for the tree vector size. (encode_type_qualifiers): Do not handle the 'const' qualifier here. (encode_pointer): Encode 'const char *' as 'r*', for backwards compatibility. (encode_array): Use HOST_WIDE_INT_PRINT_DEC instead of "%ld". (encode_type): Handle the 'const' qualifier here. (objc_parmlist): New global variable, sued by objc_push_parm and objc_get_parm_info(). (objc_push_parm, objc_get_parm_info): New functions. (objc_expr_last): Remove function. (synth_self_and_ucmd_args): For instance methods, use the instance type for 'self'; call objc_push_parm() instead of push_parm_decl(). (start_method_def): Do not call push_scope(), declare_parm_level(), pop_scope(), push_parm_decl(), store_parm_decls() or objc_expr_last(); just use objc_push_parm() and objc_get_parm_info(). (comp_method_with_proto): Remove function. (objc_types_are_equivalent): Strip away indirections before comparing underlying types. (comp_proto_with_proto): Do not call groktypename(); types are no longer in raw declspec format. (objc_start_function): New function. (really_start_method): Call comp_proto_with_proto() instead of comp_method_with_proto(); call objc_start_function() instead of hand-crafting a function declarator. (continue_method_def, objc_expand_function_end): Remove functions. (get_super_receiver): Call objc_get_current_scope() instead of get_current_scope(); reference 'super_class' field (instead of 'class'). (finish_method_def): Rename to objc_finish_method_definition() and add a function decl parameter; move method encoding call from objc_expand_function_end(). (is_complex_decl, adorn_decl, gen_declarator, gen_declspecs, gen_declaration_1): Remove functions. (tmpbuf, RAW_DECLSPEC): Remove. (gen_declaration): Remove second parameter; simplify to deal with TYPE_P nodes instead of raw declspecs. (gen_type_name, gen_type_name_0): New functions. (gen_method_decl): Remove second parameter; call gen_type_name() instead of gen_declaration_1(). (dump_interface): Adjust calls to gen_declaration() and gen_method_decl(); do not allocate a separate string buffer. (init_objc): Allocate a larger string buffer to accommodate dump_interface(); adjust call to build_module_descriptor(); add call to build_module_initializer_routine() for the GNU runtime. (generate_classref_translation_entry): Do not call start_decl(); call finish_var_decl() instead of finish_decl(); call convert() instead of build_c_cast(). * objc-act.h (CLASS_OWN_IVARS): Remove accessor. (CLASS_BINFO_ELTS): Reduce from 6 to 5, now that CLASS_OWN_IVARS is gone. (OCTI_GNU_INIT_DECL, GNU_INIT_decl): New. (OCTI_ELLIPSIS_NODE, objc_ellipsis_node): Remove. (OCTI_ID_ID, id_type, objc_id_id): Rename to OCTI_ID_NAME, objc_object_type and objc_object_name, respectively. (OCTI_CLS_REF, OCTI_CLASS_NAME, objc_class_reference, objc_class_name): New. (IS_CLASS): New macro. (IS_ID, IS_SUPER): Robustify. (OCTI_EXECCLASS_DECL, execclass_decl): New. (finish_file, start_class, continue_class, finish_class, start_method_def, continue_method_def, finish_method_def, start_protocol, finish_protocol, objc_build_throw_stmt, objc_build_try_catch_finally_stmt, objc_build_synchronized_prologue, objc_build_synchronized_epilogue, objc_build_try_prologue, objc_build_try_epilogue, objc_build_catch_stmt, objc_build_catch_epilogue, objc_build_finally_prologue, objc_build_finally_epilogue, is_ivar, is_private, is_public, add_instance_variable, objc_add_method, get_super_receiver, objc_clear_super_receiver, get_class_ivars_from_name, get_class_reference, get_static_reference, get_object_reference, build_message_expr, finish_message_expr, build_selector_expr, build_ivar_reference, build_keyword_decl, build_method_decl, build_protocol_expr, build_objc_string_object, objc_declare_alias, objc_declare_class, objc_declare_protocols, objc_comptypes, objc_check_decl, build_encode_expr): Remove prototypes. (imp_count, cat_count): Make GGC-aware. (OBJC_SET_TYPE_NAME): New macro. From-SVN: r87168
2004-09-08 02:49:44 +02:00
fprintf (fp, "\t%s;\n", gen_declaration (ivar_decls));
1992-01-18 00:15:38 +01:00
ivar_decls = TREE_CHAIN (ivar_decls);
}
while (ivar_decls);
fprintf (fp, "}\n");
}
while (nst_methods)
{
Makefile.in (c-parse.o): Depend on $(C_COMMON_H). [gcc/ChangeLog] 2004-09-07 Ziemowit Laski <zlaski@apple.com> * Makefile.in (c-parse.o): Depend on $(C_COMMON_H). * c-parse.in: Include c-common.h instead of objc-act.h. (ivar_decl_list, ivar_decls, ivar_decl, ivars, ivar_declarator, myparms, myparm): Remove %type declarations. (methodtype, optparms, OBJC_TYPE_QUAL, objc_quals, objc_qual, objc_typename, objc_try_catch_stmt, optellipsis): Add %type declarations. (objc_inherit_code, objc_public_flag): Remove. (typespec_nonreserved_nonattr): Call objc_get_protocol_qualified_type() instead of get_static_reference() and get_protocol_reference(). (stmt_nocomp): Call grokparm() on @catch parameter. (objcdef): Move semantic action to objc_finish_implementation(). (classdef): Move semantic action to objc_start_class_interface(), objc_continue_interface(), objc_finish_interface(), objc_start_class_implementation(), objc_continue_implementation(), objc_start_category_interface() and objc_start_category_implementation(). (protocoldef): Move semantic actions to objc_start_protocol() and objc_finish_interface(). (ivar_decl_list): Remove nonterminal. (visibility_spec): Move semantic actions to objc_set_visibility(). (ivar_decls): Remove assignment to $$. (ivar_decl): Rephrase in terms of component_decl; call objc_add_instance_variable(). (ivars, ivar_declarator): Remove nonterminals. (opt_semi): New nonterminal. (methodtype): Remove semantic actions. (methoddef): Move semantic actions to objc_set_method_type(), objc_start_method_definition() and objc_finish_method_definition(). (methodproto): Move semantic actions to objc_set_method_type() and objc_add_method_declaration(). (methoddecl): Use objc_typename instead of typename; move semantic actions to objc_build_method_signature(). (optarglist, myxdecls, mydecl, myparms, myparm): Remove nonterminals. (optparmlist): Express in terms of optparms and optellipsis. (optparms, optellipsis, objc_qual, objc_quals, objc_typename): New nonterminals. (keyworddecl): Use objc_typename instead of typename. (rid_to_yy): Mark RID_IN, RID_OUT, RID_INOUT, RID_BYCOPY, RID_BYREF and RID_ONEWAY as returning OBJC_TYPE_QUAL to yyparse(). [gcc/objc/ChangeLog] 2004-09-07 Ziemowit Laski <zlaski@apple.com> * Make-lang.in (objc/objc-parse.o): Depend on $(C_COMMON_H) instead of objc/objc-act.h. (objc/objc-act.o): Depend on $(HASHTAB_H). * objc-act.c: Include hashtab.h; in ObjC++ mode, include cp-tree.h and objcp-decl.h instead of c-tree.h. (build_module_descriptor, get_class_ivars, synth_id_with_class_suffix, error_with_ivar, gen_method_decl, gen_declaration, setup_string_decl, build_protocol_template): Adjust prototypes. (build_module_initializer_routine, start_class, continue_class, finish_class, start_method_def, objc_start_function, start_protocol, build_method_decl, objc_add_method, add_instance_variable, build_ivar_reference, is_ivar, is_private, get_super_receiver, build_selector_table_decl, objc_push_parm, objc_get_parm_info, gen_type_name, gen_type_name_0, start_var_decl, finish_var_decl, create_field_decl): New prototypes. (objc_expand_function_end, comp_method_with_proto, objc_expr_last, gen_declaration_1, gen_declarator, is_complex_decl, adorn_decl, define_decl, create_builtin_decl, gen_declspecs): Remove prototypes. (TYPE_ID): Rename to OBJECT_TYPEDEF_NAME. (CLASS_TYPEDEF_NAME): New. (TAG_EXECCLASS): Change from a global variable to a #define. (TAG_RETURN_STRUCT): Delete. (TAG_GNUINIT): New, holds '__objc_gnu_init' name. (objc_inherit_code, objc_public_flag): New, moved from c-parse.in. (string_descriptor): New struct. (string_htab): New hash table. (string_hash, string_eq): New prototypes. (generate_struct_by_value_array): Call create_field_decl() instead of create_builtin_decl(). (objc_init): Do not initialize objc_ellipsis_node or TAG_EXECCLASS; In ObjC++ mode, call cxx_init() instead of c_objc_common_init(). (objc_finish_file): In ObjC++, call instantiate_pending_templates() and cp_finish_file(). (define_decl, get_static_reference, get_protocol_reference, create_builtin_decl): Remove functions. (objc_start_class_interface, objc_start_category_interface, objc_start_protocol, objc_continue_interface, objc_finish_interface, objc_start_class_implementation, objc_start_category_implementation, objc_continue_implementation, objc_finish_implementation, objc_set_visibility, objc_set_method_type, objc_build_method_signature, objc_add_method_declaration, objc_start_method_definition, objc_add_instance_variable, objc_get_protocol_qualified_type, create_field_decl, start_var_decl, finish_var_decl): New functions. (setup_string_decl): Simplify since it is only called once. (synth_module_prologue): Call build_class_template(); predefine 'id' and 'Class' as typedefs; rename 'temp_type' to 'type'; disable debug hooks for duration of function; fix GNU runtime messenger signatures to correspond to reality; forward-declare '__objc_exec_class' for the GNU runtime; call build_selector_table_decl(); in ObjC++ mode, generate 'extern "C" { ... }' wrappers around synthesized declarations; call build_protocol_template() and build_category_template(). (string_hash, string_eq): New functions. (objc_build_string_object): Check metaclass correctness only once; store string literals in hash table. (objc_build_constructor): Do not convert initializer elements; adjust for ObjC++ impedance mismatch. (build_objc_symtab_template): Call create_field_decl() instead of create_builtin_decl(). (init_objc_symtab): Add missing conversion to initializer element. (build_metadata_decl): Call start_var_decl() instead of define_decl(). (generate_objc_symtab_decl): Do not call build_category_template(); call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(). (build_module_descriptor): Call create_field_decl() instead of grokfield(); call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(); always mark module descriptor as used; move GNU runtime-specific functionality to build_module_initializer_routine(). (build_module_initializer_routine): New function, broken off of build_module_descriptor(). (objc_static_init_needed_p, objc_generate_static_init_call): New functions. (generate_static_references, generate_strings, build_selector_translation_table, generate_descriptor_table, generate_ivars_list, generate_dispatch_table, generate_category): Call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(); build a type directly instead of via groktypename(). (build_selector_reference_decl, build_selector_table_decl, build_class_reference_decl, build_protocol_reference, generate_objc_image_info): Call start_var_decl() instead of build_decl(). (build_selector_reference): For GNU runtime, do not call build_selector_reference_decl(). (build_selector, build_typed_selector_reference): Always convert result to the selector type. (add_objc_string): Cast return value to 'char *'. (build_method_prototype_template, build_selector_template, build_method_template): Use actual selector type for fields pointing to selectors. (finish_objc): For GNU runtime, call build_module_initializer_routine() after build_module_descriptor(). (generate_protocol_list, generate_shared_structures): Call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(); build a type directly instead of via groktypename(). (synth_id_with_class_suffix): Return a string. (get_arg_type_list): For instance methods, use the instance type for 'self'; do not call groktypename_in_parm_context(). (build_objc_string_decl): Squash redeclaration errors in ObjC++. (objc_is_class_name): Use OBJC_TYPE_NAME instead of TYPE_NAME; handle RECORD_TYPEs in ObjC as well as ObjC++. (objc_is_id): New function. (objc_is_object_ptr): Return the canonical type node. (objc_get_class_ivars): Simplify using get_class_ivars(). (get_class_ivars): Remove second parameter; create a fresh copy of the ivar list for each call; do not check for existence of super class. (objc_eh_runtime_type): Mark #ifndef OBJCPLUS. (objc_init_exceptions): When using SJLJ-style exceptions, require the use of '-fobjc-exceptions' flag; do not require it for DWARF-style exceptions. (objc_build_exc_ptr, next_sjlj_build_try_catch_finally): Use objc_object_type instead of objc_id_type. (objc_begin_catch_clause): Convert the incoming PARM_DECL into a VAR_DECL before placing it in the appropriate scope; do not call define_decl(); adjust call to c_begin_compound_stmt(); use objc_object_type instead of objc_id_type. (build_next_objc_exception_stuff): Call create_field_decl() instead of create_builtin_decl(); construct type directly instead of calling groktypename(); use OBJC_VOID_AT_END to mark end of function parameters. (build_private_template): Adjust call to get_class_ivars(); build a type directly instead of via groktypename(). (build_protocol_template, build_method_prototype_list_template, build_method_prototype_template, build_category_template, build_selector_template, build_class_template, build_super_template, build_ivar_template, build_ivar_list_template, build_method_list_template, build_method_template): Call create_field_decl() instead of grokfield(). (objc_method_parm_type): Do not call groktypename(). (generate_descriptor_table): Call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(). (generate_method_descriptors, build_protocol_initializer, generate_dispatch_tables, build_category_initializer, build_shared_structure_initializer): Do not call groktypename(). (generate_protocols): Call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(); do not call groktypename(). (error_with_ivar): Remove last parameter. (check_ivars): Do not iterate ovar CLASS_RAW_IVARS lists in addition to CLASS_IVARS lists; adjust calls to error_with_ivar(). (generate_ivar_lists): Convert one of the initializer elements; do not call groktypename(). (get_arg_type_list, start_method_def, gen_method_def): Account for new representation of variable arguments and '...' in Objective-C methods; add Objective-C++ impedance matching code. (is_objc_type_qualifier): Remove function. (adjust_type_for_id_default): Simplify; there is no longer a need to wade through declspecs. (lookup_interface, start_class, continue_class, finish_class, start_method_def, start_protocol, build_method_decl, objc_add_method, add_instance_variable, build_ivar_reference, is_ivar, is_private, get_super_receiver, objc_build_finally_epilogue): Make into static functions. (receiver_is_class_object): Use new IS_CLASS() macro. (objc_build_message_expr): Tweak ObjC++ message argument handling; call objc_finish_message_expr() instead of finish_message_expr(). (finish_message_expr): Rename to objc_finish_message_expr(); use OBJC_TYPE_NAME and OBJC_SET_TYPE_NAME macros instead of TYPE_NAME. call gen_type_name() instead of gen_declaration(); call objc_is_id() instead of using IS_ID and IS_CLASS; Use objc_class_name instead of calling get_identifier("Class"); handle CONVERT_EXPRs in receiver. (build_objc_method_call, warn_with_method): Do not call groktypename(). (build_ivar_reference): Call convert() instead of clobbering in a type. (hash_init): Initialize string_htab hash table. (add_instance_variable): Simplify parameter list; do not call grokfield(); do not populate CLASS_IVARS list. (start_class): Check for the existence of super class, if one was specified. (continue_class): Use CLASS_RAW_IVARS rather than CLASS_IVARS; do not call build_class_template(); adjust call to get_class_ivars(); call build_decl(), pushdecl() and finish_decl() instead of define_decl(). (finish_class): Call build_decl(), pushdecl() and finish_decl() instead of define_decl(). (add_protocols): Use PROTOCOL_BINFO_ELTS for the tree vector size. (start_protocol): Do not call build_protocol_template(); use PROTOCOL_BINFO_ELTS for the tree vector size. (encode_type_qualifiers): Do not handle the 'const' qualifier here. (encode_pointer): Encode 'const char *' as 'r*', for backwards compatibility. (encode_array): Use HOST_WIDE_INT_PRINT_DEC instead of "%ld". (encode_type): Handle the 'const' qualifier here. (objc_parmlist): New global variable, sued by objc_push_parm and objc_get_parm_info(). (objc_push_parm, objc_get_parm_info): New functions. (objc_expr_last): Remove function. (synth_self_and_ucmd_args): For instance methods, use the instance type for 'self'; call objc_push_parm() instead of push_parm_decl(). (start_method_def): Do not call push_scope(), declare_parm_level(), pop_scope(), push_parm_decl(), store_parm_decls() or objc_expr_last(); just use objc_push_parm() and objc_get_parm_info(). (comp_method_with_proto): Remove function. (objc_types_are_equivalent): Strip away indirections before comparing underlying types. (comp_proto_with_proto): Do not call groktypename(); types are no longer in raw declspec format. (objc_start_function): New function. (really_start_method): Call comp_proto_with_proto() instead of comp_method_with_proto(); call objc_start_function() instead of hand-crafting a function declarator. (continue_method_def, objc_expand_function_end): Remove functions. (get_super_receiver): Call objc_get_current_scope() instead of get_current_scope(); reference 'super_class' field (instead of 'class'). (finish_method_def): Rename to objc_finish_method_definition() and add a function decl parameter; move method encoding call from objc_expand_function_end(). (is_complex_decl, adorn_decl, gen_declarator, gen_declspecs, gen_declaration_1): Remove functions. (tmpbuf, RAW_DECLSPEC): Remove. (gen_declaration): Remove second parameter; simplify to deal with TYPE_P nodes instead of raw declspecs. (gen_type_name, gen_type_name_0): New functions. (gen_method_decl): Remove second parameter; call gen_type_name() instead of gen_declaration_1(). (dump_interface): Adjust calls to gen_declaration() and gen_method_decl(); do not allocate a separate string buffer. (init_objc): Allocate a larger string buffer to accommodate dump_interface(); adjust call to build_module_descriptor(); add call to build_module_initializer_routine() for the GNU runtime. (generate_classref_translation_entry): Do not call start_decl(); call finish_var_decl() instead of finish_decl(); call convert() instead of build_c_cast(). * objc-act.h (CLASS_OWN_IVARS): Remove accessor. (CLASS_BINFO_ELTS): Reduce from 6 to 5, now that CLASS_OWN_IVARS is gone. (OCTI_GNU_INIT_DECL, GNU_INIT_decl): New. (OCTI_ELLIPSIS_NODE, objc_ellipsis_node): Remove. (OCTI_ID_ID, id_type, objc_id_id): Rename to OCTI_ID_NAME, objc_object_type and objc_object_name, respectively. (OCTI_CLS_REF, OCTI_CLASS_NAME, objc_class_reference, objc_class_name): New. (IS_CLASS): New macro. (IS_ID, IS_SUPER): Robustify. (OCTI_EXECCLASS_DECL, execclass_decl): New. (finish_file, start_class, continue_class, finish_class, start_method_def, continue_method_def, finish_method_def, start_protocol, finish_protocol, objc_build_throw_stmt, objc_build_try_catch_finally_stmt, objc_build_synchronized_prologue, objc_build_synchronized_epilogue, objc_build_try_prologue, objc_build_try_epilogue, objc_build_catch_stmt, objc_build_catch_epilogue, objc_build_finally_prologue, objc_build_finally_epilogue, is_ivar, is_private, is_public, add_instance_variable, objc_add_method, get_super_receiver, objc_clear_super_receiver, get_class_ivars_from_name, get_class_reference, get_static_reference, get_object_reference, build_message_expr, finish_message_expr, build_selector_expr, build_ivar_reference, build_keyword_decl, build_method_decl, build_protocol_expr, build_objc_string_object, objc_declare_alias, objc_declare_class, objc_declare_protocols, objc_comptypes, objc_check_decl, build_encode_expr): Remove prototypes. (imp_count, cat_count): Make GGC-aware. (OBJC_SET_TYPE_NAME): New macro. From-SVN: r87168
2004-09-08 02:49:44 +02:00
fprintf (fp, "- %s;\n", gen_method_decl (nst_methods));
1992-01-18 00:15:38 +01:00
nst_methods = TREE_CHAIN (nst_methods);
}
while (cls_methods)
{
Makefile.in (c-parse.o): Depend on $(C_COMMON_H). [gcc/ChangeLog] 2004-09-07 Ziemowit Laski <zlaski@apple.com> * Makefile.in (c-parse.o): Depend on $(C_COMMON_H). * c-parse.in: Include c-common.h instead of objc-act.h. (ivar_decl_list, ivar_decls, ivar_decl, ivars, ivar_declarator, myparms, myparm): Remove %type declarations. (methodtype, optparms, OBJC_TYPE_QUAL, objc_quals, objc_qual, objc_typename, objc_try_catch_stmt, optellipsis): Add %type declarations. (objc_inherit_code, objc_public_flag): Remove. (typespec_nonreserved_nonattr): Call objc_get_protocol_qualified_type() instead of get_static_reference() and get_protocol_reference(). (stmt_nocomp): Call grokparm() on @catch parameter. (objcdef): Move semantic action to objc_finish_implementation(). (classdef): Move semantic action to objc_start_class_interface(), objc_continue_interface(), objc_finish_interface(), objc_start_class_implementation(), objc_continue_implementation(), objc_start_category_interface() and objc_start_category_implementation(). (protocoldef): Move semantic actions to objc_start_protocol() and objc_finish_interface(). (ivar_decl_list): Remove nonterminal. (visibility_spec): Move semantic actions to objc_set_visibility(). (ivar_decls): Remove assignment to $$. (ivar_decl): Rephrase in terms of component_decl; call objc_add_instance_variable(). (ivars, ivar_declarator): Remove nonterminals. (opt_semi): New nonterminal. (methodtype): Remove semantic actions. (methoddef): Move semantic actions to objc_set_method_type(), objc_start_method_definition() and objc_finish_method_definition(). (methodproto): Move semantic actions to objc_set_method_type() and objc_add_method_declaration(). (methoddecl): Use objc_typename instead of typename; move semantic actions to objc_build_method_signature(). (optarglist, myxdecls, mydecl, myparms, myparm): Remove nonterminals. (optparmlist): Express in terms of optparms and optellipsis. (optparms, optellipsis, objc_qual, objc_quals, objc_typename): New nonterminals. (keyworddecl): Use objc_typename instead of typename. (rid_to_yy): Mark RID_IN, RID_OUT, RID_INOUT, RID_BYCOPY, RID_BYREF and RID_ONEWAY as returning OBJC_TYPE_QUAL to yyparse(). [gcc/objc/ChangeLog] 2004-09-07 Ziemowit Laski <zlaski@apple.com> * Make-lang.in (objc/objc-parse.o): Depend on $(C_COMMON_H) instead of objc/objc-act.h. (objc/objc-act.o): Depend on $(HASHTAB_H). * objc-act.c: Include hashtab.h; in ObjC++ mode, include cp-tree.h and objcp-decl.h instead of c-tree.h. (build_module_descriptor, get_class_ivars, synth_id_with_class_suffix, error_with_ivar, gen_method_decl, gen_declaration, setup_string_decl, build_protocol_template): Adjust prototypes. (build_module_initializer_routine, start_class, continue_class, finish_class, start_method_def, objc_start_function, start_protocol, build_method_decl, objc_add_method, add_instance_variable, build_ivar_reference, is_ivar, is_private, get_super_receiver, build_selector_table_decl, objc_push_parm, objc_get_parm_info, gen_type_name, gen_type_name_0, start_var_decl, finish_var_decl, create_field_decl): New prototypes. (objc_expand_function_end, comp_method_with_proto, objc_expr_last, gen_declaration_1, gen_declarator, is_complex_decl, adorn_decl, define_decl, create_builtin_decl, gen_declspecs): Remove prototypes. (TYPE_ID): Rename to OBJECT_TYPEDEF_NAME. (CLASS_TYPEDEF_NAME): New. (TAG_EXECCLASS): Change from a global variable to a #define. (TAG_RETURN_STRUCT): Delete. (TAG_GNUINIT): New, holds '__objc_gnu_init' name. (objc_inherit_code, objc_public_flag): New, moved from c-parse.in. (string_descriptor): New struct. (string_htab): New hash table. (string_hash, string_eq): New prototypes. (generate_struct_by_value_array): Call create_field_decl() instead of create_builtin_decl(). (objc_init): Do not initialize objc_ellipsis_node or TAG_EXECCLASS; In ObjC++ mode, call cxx_init() instead of c_objc_common_init(). (objc_finish_file): In ObjC++, call instantiate_pending_templates() and cp_finish_file(). (define_decl, get_static_reference, get_protocol_reference, create_builtin_decl): Remove functions. (objc_start_class_interface, objc_start_category_interface, objc_start_protocol, objc_continue_interface, objc_finish_interface, objc_start_class_implementation, objc_start_category_implementation, objc_continue_implementation, objc_finish_implementation, objc_set_visibility, objc_set_method_type, objc_build_method_signature, objc_add_method_declaration, objc_start_method_definition, objc_add_instance_variable, objc_get_protocol_qualified_type, create_field_decl, start_var_decl, finish_var_decl): New functions. (setup_string_decl): Simplify since it is only called once. (synth_module_prologue): Call build_class_template(); predefine 'id' and 'Class' as typedefs; rename 'temp_type' to 'type'; disable debug hooks for duration of function; fix GNU runtime messenger signatures to correspond to reality; forward-declare '__objc_exec_class' for the GNU runtime; call build_selector_table_decl(); in ObjC++ mode, generate 'extern "C" { ... }' wrappers around synthesized declarations; call build_protocol_template() and build_category_template(). (string_hash, string_eq): New functions. (objc_build_string_object): Check metaclass correctness only once; store string literals in hash table. (objc_build_constructor): Do not convert initializer elements; adjust for ObjC++ impedance mismatch. (build_objc_symtab_template): Call create_field_decl() instead of create_builtin_decl(). (init_objc_symtab): Add missing conversion to initializer element. (build_metadata_decl): Call start_var_decl() instead of define_decl(). (generate_objc_symtab_decl): Do not call build_category_template(); call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(). (build_module_descriptor): Call create_field_decl() instead of grokfield(); call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(); always mark module descriptor as used; move GNU runtime-specific functionality to build_module_initializer_routine(). (build_module_initializer_routine): New function, broken off of build_module_descriptor(). (objc_static_init_needed_p, objc_generate_static_init_call): New functions. (generate_static_references, generate_strings, build_selector_translation_table, generate_descriptor_table, generate_ivars_list, generate_dispatch_table, generate_category): Call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(); build a type directly instead of via groktypename(). (build_selector_reference_decl, build_selector_table_decl, build_class_reference_decl, build_protocol_reference, generate_objc_image_info): Call start_var_decl() instead of build_decl(). (build_selector_reference): For GNU runtime, do not call build_selector_reference_decl(). (build_selector, build_typed_selector_reference): Always convert result to the selector type. (add_objc_string): Cast return value to 'char *'. (build_method_prototype_template, build_selector_template, build_method_template): Use actual selector type for fields pointing to selectors. (finish_objc): For GNU runtime, call build_module_initializer_routine() after build_module_descriptor(). (generate_protocol_list, generate_shared_structures): Call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(); build a type directly instead of via groktypename(). (synth_id_with_class_suffix): Return a string. (get_arg_type_list): For instance methods, use the instance type for 'self'; do not call groktypename_in_parm_context(). (build_objc_string_decl): Squash redeclaration errors in ObjC++. (objc_is_class_name): Use OBJC_TYPE_NAME instead of TYPE_NAME; handle RECORD_TYPEs in ObjC as well as ObjC++. (objc_is_id): New function. (objc_is_object_ptr): Return the canonical type node. (objc_get_class_ivars): Simplify using get_class_ivars(). (get_class_ivars): Remove second parameter; create a fresh copy of the ivar list for each call; do not check for existence of super class. (objc_eh_runtime_type): Mark #ifndef OBJCPLUS. (objc_init_exceptions): When using SJLJ-style exceptions, require the use of '-fobjc-exceptions' flag; do not require it for DWARF-style exceptions. (objc_build_exc_ptr, next_sjlj_build_try_catch_finally): Use objc_object_type instead of objc_id_type. (objc_begin_catch_clause): Convert the incoming PARM_DECL into a VAR_DECL before placing it in the appropriate scope; do not call define_decl(); adjust call to c_begin_compound_stmt(); use objc_object_type instead of objc_id_type. (build_next_objc_exception_stuff): Call create_field_decl() instead of create_builtin_decl(); construct type directly instead of calling groktypename(); use OBJC_VOID_AT_END to mark end of function parameters. (build_private_template): Adjust call to get_class_ivars(); build a type directly instead of via groktypename(). (build_protocol_template, build_method_prototype_list_template, build_method_prototype_template, build_category_template, build_selector_template, build_class_template, build_super_template, build_ivar_template, build_ivar_list_template, build_method_list_template, build_method_template): Call create_field_decl() instead of grokfield(). (objc_method_parm_type): Do not call groktypename(). (generate_descriptor_table): Call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(). (generate_method_descriptors, build_protocol_initializer, generate_dispatch_tables, build_category_initializer, build_shared_structure_initializer): Do not call groktypename(). (generate_protocols): Call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(); do not call groktypename(). (error_with_ivar): Remove last parameter. (check_ivars): Do not iterate ovar CLASS_RAW_IVARS lists in addition to CLASS_IVARS lists; adjust calls to error_with_ivar(). (generate_ivar_lists): Convert one of the initializer elements; do not call groktypename(). (get_arg_type_list, start_method_def, gen_method_def): Account for new representation of variable arguments and '...' in Objective-C methods; add Objective-C++ impedance matching code. (is_objc_type_qualifier): Remove function. (adjust_type_for_id_default): Simplify; there is no longer a need to wade through declspecs. (lookup_interface, start_class, continue_class, finish_class, start_method_def, start_protocol, build_method_decl, objc_add_method, add_instance_variable, build_ivar_reference, is_ivar, is_private, get_super_receiver, objc_build_finally_epilogue): Make into static functions. (receiver_is_class_object): Use new IS_CLASS() macro. (objc_build_message_expr): Tweak ObjC++ message argument handling; call objc_finish_message_expr() instead of finish_message_expr(). (finish_message_expr): Rename to objc_finish_message_expr(); use OBJC_TYPE_NAME and OBJC_SET_TYPE_NAME macros instead of TYPE_NAME. call gen_type_name() instead of gen_declaration(); call objc_is_id() instead of using IS_ID and IS_CLASS; Use objc_class_name instead of calling get_identifier("Class"); handle CONVERT_EXPRs in receiver. (build_objc_method_call, warn_with_method): Do not call groktypename(). (build_ivar_reference): Call convert() instead of clobbering in a type. (hash_init): Initialize string_htab hash table. (add_instance_variable): Simplify parameter list; do not call grokfield(); do not populate CLASS_IVARS list. (start_class): Check for the existence of super class, if one was specified. (continue_class): Use CLASS_RAW_IVARS rather than CLASS_IVARS; do not call build_class_template(); adjust call to get_class_ivars(); call build_decl(), pushdecl() and finish_decl() instead of define_decl(). (finish_class): Call build_decl(), pushdecl() and finish_decl() instead of define_decl(). (add_protocols): Use PROTOCOL_BINFO_ELTS for the tree vector size. (start_protocol): Do not call build_protocol_template(); use PROTOCOL_BINFO_ELTS for the tree vector size. (encode_type_qualifiers): Do not handle the 'const' qualifier here. (encode_pointer): Encode 'const char *' as 'r*', for backwards compatibility. (encode_array): Use HOST_WIDE_INT_PRINT_DEC instead of "%ld". (encode_type): Handle the 'const' qualifier here. (objc_parmlist): New global variable, sued by objc_push_parm and objc_get_parm_info(). (objc_push_parm, objc_get_parm_info): New functions. (objc_expr_last): Remove function. (synth_self_and_ucmd_args): For instance methods, use the instance type for 'self'; call objc_push_parm() instead of push_parm_decl(). (start_method_def): Do not call push_scope(), declare_parm_level(), pop_scope(), push_parm_decl(), store_parm_decls() or objc_expr_last(); just use objc_push_parm() and objc_get_parm_info(). (comp_method_with_proto): Remove function. (objc_types_are_equivalent): Strip away indirections before comparing underlying types. (comp_proto_with_proto): Do not call groktypename(); types are no longer in raw declspec format. (objc_start_function): New function. (really_start_method): Call comp_proto_with_proto() instead of comp_method_with_proto(); call objc_start_function() instead of hand-crafting a function declarator. (continue_method_def, objc_expand_function_end): Remove functions. (get_super_receiver): Call objc_get_current_scope() instead of get_current_scope(); reference 'super_class' field (instead of 'class'). (finish_method_def): Rename to objc_finish_method_definition() and add a function decl parameter; move method encoding call from objc_expand_function_end(). (is_complex_decl, adorn_decl, gen_declarator, gen_declspecs, gen_declaration_1): Remove functions. (tmpbuf, RAW_DECLSPEC): Remove. (gen_declaration): Remove second parameter; simplify to deal with TYPE_P nodes instead of raw declspecs. (gen_type_name, gen_type_name_0): New functions. (gen_method_decl): Remove second parameter; call gen_type_name() instead of gen_declaration_1(). (dump_interface): Adjust calls to gen_declaration() and gen_method_decl(); do not allocate a separate string buffer. (init_objc): Allocate a larger string buffer to accommodate dump_interface(); adjust call to build_module_descriptor(); add call to build_module_initializer_routine() for the GNU runtime. (generate_classref_translation_entry): Do not call start_decl(); call finish_var_decl() instead of finish_decl(); call convert() instead of build_c_cast(). * objc-act.h (CLASS_OWN_IVARS): Remove accessor. (CLASS_BINFO_ELTS): Reduce from 6 to 5, now that CLASS_OWN_IVARS is gone. (OCTI_GNU_INIT_DECL, GNU_INIT_decl): New. (OCTI_ELLIPSIS_NODE, objc_ellipsis_node): Remove. (OCTI_ID_ID, id_type, objc_id_id): Rename to OCTI_ID_NAME, objc_object_type and objc_object_name, respectively. (OCTI_CLS_REF, OCTI_CLASS_NAME, objc_class_reference, objc_class_name): New. (IS_CLASS): New macro. (IS_ID, IS_SUPER): Robustify. (OCTI_EXECCLASS_DECL, execclass_decl): New. (finish_file, start_class, continue_class, finish_class, start_method_def, continue_method_def, finish_method_def, start_protocol, finish_protocol, objc_build_throw_stmt, objc_build_try_catch_finally_stmt, objc_build_synchronized_prologue, objc_build_synchronized_epilogue, objc_build_try_prologue, objc_build_try_epilogue, objc_build_catch_stmt, objc_build_catch_epilogue, objc_build_finally_prologue, objc_build_finally_epilogue, is_ivar, is_private, is_public, add_instance_variable, objc_add_method, get_super_receiver, objc_clear_super_receiver, get_class_ivars_from_name, get_class_reference, get_static_reference, get_object_reference, build_message_expr, finish_message_expr, build_selector_expr, build_ivar_reference, build_keyword_decl, build_method_decl, build_protocol_expr, build_objc_string_object, objc_declare_alias, objc_declare_class, objc_declare_protocols, objc_comptypes, objc_check_decl, build_encode_expr): Remove prototypes. (imp_count, cat_count): Make GGC-aware. (OBJC_SET_TYPE_NAME): New macro. From-SVN: r87168
2004-09-08 02:49:44 +02:00
fprintf (fp, "+ %s;\n", gen_method_decl (cls_methods));
1992-01-18 00:15:38 +01:00
cls_methods = TREE_CHAIN (cls_methods);
}
fprintf (fp, "@end\n");
1992-01-18 00:15:38 +01:00
}
/* Demangle function for Objective-C */
static const char *
objc_demangle (const char *mangled)
{
char *demangled, *cp;
if (mangled[0] == '_' &&
(mangled[1] == 'i' || mangled[1] == 'c') &&
mangled[2] == '_')
{
tree-vrp.c: Use XNEW/XCNEW allocation wrappers. 2006-01-31 Marcin Dalecki <martin@dalecki.de> * tree-vrp.c: Use XNEW/XCNEW allocation wrappers. * regrename.c: Ditto. * tree-ssa-loop-im.c: Ditto. * tree-dump.c: Ditto. * tree-complex.c: Ditto. * genrecog.c: Ditto. * tree-ssa-threadupdate.c: Ditto. * tracer.c: Ditto. * java/class.c: Ditto. * java/jcf-parse.c: Ditto. * java/resource.c: Ditto. * java/except.c: Ditto. * java/jvspec.c: Ditto. * java/jcf-write.c: Ditto. * java/jcf-path.c: Ditto. * java/gjavah.c: Ditto. * java/zextract.c: Ditto. * java/jcf-io.c: Ditto. * java/jcf.h: Ditto. * java/buffer.c: Ditto. * java/lang.c: Ditto. * java/parse-scan.y: Ditto. * java/lex.c: Ditto. * java/lex.h: Ditto. * cfgloopmanip.c: Ditto. * postreload-gcse.c: Ditto. * tree-ssa-loop-manip.c: Ditto. * postreload.c: Ditto. * tree-ssa-loop-ch.c: Ditto. * loop.c: Ditto. * ipa-cp.c: Ditto. * cppspec.c: Ditto. * diagnostic.c: Ditto. * final.c: Ditto. * genoutput.c: Ditto. * gcc.c: Ditto. * cfghooks.c: Ditto. * cfgloopanal.c: Ditto. * objc/objc-act.c: Ditto. * gcov.c: Ditto. * genextract.c: Ditto. * genautomata.c: Ditto. * pretty-print.c: Ditto. * genemit.c: Ditto. * cgraphunit.c: Ditto. * flow.c: Ditto. * df-scan.c: Ditto. * haifa-sched.c: Ditto. * dominance.c: Ditto. * dbxout.c: Ditto. * tree-ssa-loop-ivopts.c: Ditto. * df-core.c: Ditto. * mode-switching.c: Ditto. * modulo-sched.c: Ditto. * graph.c: Ditto. * ipa-pure-const.c: Ditto. * cse.c: Ditto. * fix-header.c: Ditto. * web.c: Ditto. * tree-stdarg.c: Ditto. * ipa-utils.c: Ditto. * loop-init.c: Ditto. * ipa-inline.c: Ditto. * cfganal.c: Ditto. * global.c: Ditto. * alloc-pool.c: Ditto. * dwarf2out.c: Ditto. * opts.c: Ditto. * genattrtab.c: Ditto. * tree-ssa-loop-ivcanon.c: Ditto. * predict.c: Ditto. * timevar.c: Ditto. * lcm.c: Ditto. * fortran/gfortranspec.c: Ditto. * regmove.c: Ditto. * local-alloc.c: Ditto. * langhooks.c: Ditto. * function.c: Ditto. * tree-vectorizer.c: Ditto. * gcse.c: Ditto. * ipa-type-escape.c: Ditto. * alias.c: Ditto. * tree-if-conv.c: Ditto. * profile.c: Ditto. * ipa.c: Ditto. * tree-data-ref.c: Ditto. * loop-unroll.c: Ditto. * treelang/treetree.c: Ditto. * calls.c: Ditto. * bt-load.c: Ditto. * ggc-common.c: Ditto. * except.c: Ditto. * coverage.c: Ditto. * cselib.c: Ditto. * tree-cfgcleanup.c: Ditto. * tree-ssa-pre.c: Ditto. * cfgcleanup.c: Ditto. * loop-invariant.c: Ditto. * loop-iv.c: Ditto. * ipa-prop.c: Ditto. * print-tree.c: Ditto. * conflict.c: Ditto. * ggc-page.c: Ditto. * sched-deps.c: Ditto. * regclass.c: Ditto. * tree-object-size.c: Ditto. * combine.c: Ditto. * bb-reorder.c: Ditto. * resource.c: Ditto. * var-tracking.c: Ditto. * cfgloop.c: Ditto. * df-problems.c: Ditto. * reg-stack.c: Ditto. * tlink.c: Ditto. * gccspec.c: Ditto. * sched-rgn.c: Ditto. * tree-ssa-structalias.c: Ditto. * tree-ssa-reassoc.c: Ditto. * config/darwin-c.c: Ditto. * config/darwin.c: Ditto. * config/arm/arm.c: Ditto. * cfgrtl.c: Ditto. * collect2.c: Ditto. * reload1.c: Ditto. From-SVN: r110446
2006-01-31 20:56:55 +01:00
cp = demangled = XNEWVEC (char, strlen(mangled) + 2);
if (mangled[1] == 'i')
*cp++ = '-'; /* for instance method */
else
*cp++ = '+'; /* for class method */
*cp++ = '['; /* opening left brace */
strcpy(cp, mangled+3); /* tack on the rest of the mangled name */
while (*cp && *cp == '_')
cp++; /* skip any initial underbars in class name */
cp = strchr(cp, '_'); /* find first non-initial underbar */
if (cp == NULL)
{
free(demangled); /* not mangled name */
return mangled;
}
if (cp[1] == '_') /* easy case: no category name */
{
*cp++ = ' '; /* replace two '_' with one ' ' */
strcpy(cp, mangled + (cp - demangled) + 2);
}
else
{
*cp++ = '('; /* less easy case: category name */
cp = strchr(cp, '_');
if (cp == 0)
{
free(demangled); /* not mangled name */
return mangled;
}
*cp++ = ')';
*cp++ = ' '; /* overwriting 1st char of method name... */
strcpy(cp, mangled + (cp - demangled)); /* get it back */
}
while (*cp && *cp == '_')
cp++; /* skip any initial underbars in method name */
for (; *cp; cp++)
if (*cp == '_')
*cp = ':'; /* replace remaining '_' with ':' */
*cp++ = ']'; /* closing right brace */
*cp++ = 0; /* string terminator */
return demangled;
}
else
return mangled; /* not an objc mangled name */
}
Makefile.in: Update. * Makefile.in: Update. * c-common.c: Include langhooks.h. (inline_forbidden_p): Use new hook. * diagnostic.c: Include langhooks.h. (format_with_decl, announce_function, default_print_error_function): Use new hook. * dwarf2out.c (dwarf2_name): Use new hook. * function.c: Include langhooks.h. (init_function_start): Use new hook. * langhooks-def.h (lhd_decl_printable_name): New. (LANGHOOKS_DECL_PRINTABLE_NAME): New. (LANGHOOKS_INITIALIZER): Update. * langhooks.c (lhd_decl_printable_name): New. * langhooks.h (struct lang_hooks): New hook. * toplev.c (decl_name, decl_printable_name): Remove. (open_dump_file): Use new hook. (process_options): Remove old hook. * tree.h (decl_printable_name): Remove. ada: * misc.c (LANG_HOOKS_DECL_PRINTABLE_NAME): Redefine. (gnat_init): Remove old hook. cp: * cp-lang.c (LANG_HOOKS_DECL_PRINTABLE_NAME): Redefine. * cp-tree.h (lang_printable_name): Rename. * error.c (lang_decl_name): Use new hook. * lex.c (cxx_init): Remove old hook. * pt.c (tsubst_expr): Use new hook. * tree.c (lang_printable_name): Rename. f: * com.c (lang_printable_name): Rename. (LANG_HOOKS_DECL_PRINTABLE_NAME): Redefine. (ffe_init): Don't use old hook. java: * decl.c (start_java_method): Use new hook. * lang.c (LANG_HOOKS_DECL_PRINTABLE_NAME): Redefine. (java_init): Remove old hook. objc: * objc-act.c (objc_init): Remove old hook. (objc_printable_name): Export. * objc-act.h (objc_printable_name): New. * objc-lang.c (LANG_HOOKS_DECL_PRINTABLE_NAME): Redefine. From-SVN: r51066
2002-03-20 08:58:41 +01:00
const char *
objc_printable_name (tree decl, int kind ATTRIBUTE_UNUSED)
{
return objc_demangle (IDENTIFIER_POINTER (DECL_NAME (decl)));
}
static void
init_objc (void)
{
gcc_obstack_init (&util_obstack);
util_firstobj = (char *) obstack_finish (&util_obstack);
1992-01-18 00:15:38 +01:00
tree-vrp.c: Use XNEW/XCNEW allocation wrappers. 2006-01-31 Marcin Dalecki <martin@dalecki.de> * tree-vrp.c: Use XNEW/XCNEW allocation wrappers. * regrename.c: Ditto. * tree-ssa-loop-im.c: Ditto. * tree-dump.c: Ditto. * tree-complex.c: Ditto. * genrecog.c: Ditto. * tree-ssa-threadupdate.c: Ditto. * tracer.c: Ditto. * java/class.c: Ditto. * java/jcf-parse.c: Ditto. * java/resource.c: Ditto. * java/except.c: Ditto. * java/jvspec.c: Ditto. * java/jcf-write.c: Ditto. * java/jcf-path.c: Ditto. * java/gjavah.c: Ditto. * java/zextract.c: Ditto. * java/jcf-io.c: Ditto. * java/jcf.h: Ditto. * java/buffer.c: Ditto. * java/lang.c: Ditto. * java/parse-scan.y: Ditto. * java/lex.c: Ditto. * java/lex.h: Ditto. * cfgloopmanip.c: Ditto. * postreload-gcse.c: Ditto. * tree-ssa-loop-manip.c: Ditto. * postreload.c: Ditto. * tree-ssa-loop-ch.c: Ditto. * loop.c: Ditto. * ipa-cp.c: Ditto. * cppspec.c: Ditto. * diagnostic.c: Ditto. * final.c: Ditto. * genoutput.c: Ditto. * gcc.c: Ditto. * cfghooks.c: Ditto. * cfgloopanal.c: Ditto. * objc/objc-act.c: Ditto. * gcov.c: Ditto. * genextract.c: Ditto. * genautomata.c: Ditto. * pretty-print.c: Ditto. * genemit.c: Ditto. * cgraphunit.c: Ditto. * flow.c: Ditto. * df-scan.c: Ditto. * haifa-sched.c: Ditto. * dominance.c: Ditto. * dbxout.c: Ditto. * tree-ssa-loop-ivopts.c: Ditto. * df-core.c: Ditto. * mode-switching.c: Ditto. * modulo-sched.c: Ditto. * graph.c: Ditto. * ipa-pure-const.c: Ditto. * cse.c: Ditto. * fix-header.c: Ditto. * web.c: Ditto. * tree-stdarg.c: Ditto. * ipa-utils.c: Ditto. * loop-init.c: Ditto. * ipa-inline.c: Ditto. * cfganal.c: Ditto. * global.c: Ditto. * alloc-pool.c: Ditto. * dwarf2out.c: Ditto. * opts.c: Ditto. * genattrtab.c: Ditto. * tree-ssa-loop-ivcanon.c: Ditto. * predict.c: Ditto. * timevar.c: Ditto. * lcm.c: Ditto. * fortran/gfortranspec.c: Ditto. * regmove.c: Ditto. * local-alloc.c: Ditto. * langhooks.c: Ditto. * function.c: Ditto. * tree-vectorizer.c: Ditto. * gcse.c: Ditto. * ipa-type-escape.c: Ditto. * alias.c: Ditto. * tree-if-conv.c: Ditto. * profile.c: Ditto. * ipa.c: Ditto. * tree-data-ref.c: Ditto. * loop-unroll.c: Ditto. * treelang/treetree.c: Ditto. * calls.c: Ditto. * bt-load.c: Ditto. * ggc-common.c: Ditto. * except.c: Ditto. * coverage.c: Ditto. * cselib.c: Ditto. * tree-cfgcleanup.c: Ditto. * tree-ssa-pre.c: Ditto. * cfgcleanup.c: Ditto. * loop-invariant.c: Ditto. * loop-iv.c: Ditto. * ipa-prop.c: Ditto. * print-tree.c: Ditto. * conflict.c: Ditto. * ggc-page.c: Ditto. * sched-deps.c: Ditto. * regclass.c: Ditto. * tree-object-size.c: Ditto. * combine.c: Ditto. * bb-reorder.c: Ditto. * resource.c: Ditto. * var-tracking.c: Ditto. * cfgloop.c: Ditto. * df-problems.c: Ditto. * reg-stack.c: Ditto. * tlink.c: Ditto. * gccspec.c: Ditto. * sched-rgn.c: Ditto. * tree-ssa-structalias.c: Ditto. * tree-ssa-reassoc.c: Ditto. * config/darwin-c.c: Ditto. * config/darwin.c: Ditto. * config/arm/arm.c: Ditto. * cfgrtl.c: Ditto. * collect2.c: Ditto. * reload1.c: Ditto. From-SVN: r110446
2006-01-31 20:56:55 +01:00
errbuf = XNEWVEC (char, 1024 * 10);
1992-01-18 00:15:38 +01:00
hash_init ();
synth_module_prologue ();
}
static void
finish_objc (void)
1992-01-18 00:15:38 +01:00
{
struct imp_entry *impent;
tree chain;
/* The internally generated initializers appear to have missing braces.
Don't warn about this. */
int save_warn_missing_braces = warn_missing_braces;
warn_missing_braces = 0;
1992-01-18 00:15:38 +01:00
/* A missing @end may not be detected by the parser. */
if (objc_implementation_context)
{
diagnostic.c (warning): Accept parameter to classify warning option. * diagnostic.c (warning): Accept parameter to classify warning option. (warning0): New, for when a pointer to an error() like function is needed. * errors.c (warning): Likewise. * errors.h (warning, warning0): Adjust prototypes. * toplev.h (warning, warning0): Likewise. * attribs.c, builtins.c, c-common.c, c-decl.c, c-format.c, c-gimplify.c, c-lex.c, c-objc-common.c, c-opts.c, c-parser.c, c-pragma.c, c-typeck.c, calls.c, cgraph.c, coverage.c, emit-rtl.c, fold-const.c, fortran/trans-decl.c, function.c, gcse.c, genautomata.c, haifa-sched.c, opts.c, passes.c, regclass.c, reload1.c, stmt.c, stor-layout.c, toplev.c, tree-cfg.c, tree-dump.c, tree-inline.c, tree-mudflap.c, tree-optimize.c, tree-ssa.c, tree.c, varasm.c: Adjust warning() callers. * config/alpha/alpha.c, config/arc/arc.c, config/arm/arm.c, config/avr/avr.c, config/bfin/bfin.c, config/c4x/c4x-c.c, config/c4x/c4x.c, config/cris/cris.c, config/darwin-c.c, config/darwin.c, config/darwin.h, config/h8300/h8300.c, config/i386/cygming.h, config/i386/djgpp.h, config/i386/i386.c, config/i386/winnt.c, config/ia64/ia64-c.c, config/ia64/ia64.c, config/ip2k/ip2k.c, config/m32r/m32r.c, config/m68hc11/m68hc11.c, config/m68k/m68k.c, config/mcore/mcore.c, config/mips/mips.c, config/mmix/mmix.c, config/ns32k/ns32k.c, config/pa/pa-hpux11.h, config/pa/pa.c, config/rs6000/aix43.h, config/rs6000/aix51.h, config/rs6000/aix52.h, config/rs6000/darwin.h, config/rs6000/rs6000-c.c, config/rs6000/rs6000.c, config/s390/s390.c, config/sh/sh.c, config/sh/sh.h, config/sh/symbian.c, config/sol2-c.c, config/sol2.c, config/stormy16/stormy16.c, config/v850/v850-c.c, config/v850/v850.c, config/xtensa/xtensa.c: Adjust warning() callers. * ada/misc.c: Adjust warning() callers. * cp/call.c, cp/class.c, cp/cvt.c, cp/decl.c, cp/decl2.c, cp/except.c, cp/friend.c, cp/init.c, cp/lex.c, cp/mangle.c, cp/method.c, cp/name-lookup.c, cp/parser.c, cp/repo.c, cp/rtti.c, cp/tree.c, cp/typeck.c, cp/typeck2.c: Adjust warning() callers. * fortran/trans-decl.c: Adjust warning() callers. * java/class.c, java/decl.c, java/expr.c, java/jcf-io.c, java/jcf-parse.c, java/jv-scan.c, java/parse.y: Adjust warning() callers. * objc/objc-act.c: Adjust warning() callers. * treelang/parse.y: Adjust warning() callers. From-SVN: r98633
2005-04-23 23:29:07 +02:00
warning (0, "%<@end%> missing in implementation context");
c-parse.in (objc_inherit_code, [...]): Make static. 2001-10-03 Ziemowit Laski <zlaski@apple.com> * c-parse.in (objc_inherit_code, objc_pq_context, objc_public_flag): Make static. (objc_interface_context, objc_implementation_context, objc_method_context, objc_ivar_chain, objc_ivar_context): Move to global tree array in objc/objc-act.[ch]. (methoddef): Remove unnecessary code. * objc/objc-act.c: (hashed_attribute, hashed_entry, imp_entry): Hoist struct definitions to objc-act.h. (nst_method_hash_list, cls_method_hash_list, imp_list, imp_count, cat_count): Place declaration in objc-act.h. (objc_tree_index): Move enumeration to objc-act.h. (objc_global_trees): Place declaration and macro accessors in objc-act.h. (implementation_context): Remove duplicate; use objc_implementation_context instead: (method_context): Remove duplicate; use objc_method_context instead. (objc_ellipsis_node, objc_method_prototype_template, implemented_classes, function_type): Move global vars to objc_global_trees. (init_objc): Use LAST_BASE_TREE_CODE instead of LAST_CODE. (build_message_expr): Move actual construction of ObjC message send nodes to finish_message_expr. (finish_message_expr): New routine, contains code formerly in build_message_expr. * objc/objc-act.h (finish_message_expr): New prototype. (objc_ivar_chain, objc_method_context, objc_ellipsis_node): Remove declarations; these vars are now part of objc_global_trees. (objc_tree_index, objc_global_trees): Move definitions from objc-act.c. * objc/objc-tree.def: Update copyright info. From-SVN: r46000
2001-10-04 00:05:57 +02:00
finish_class (objc_implementation_context);
objc_ivar_chain = NULL_TREE;
objc_implementation_context = NULL_TREE;
}
/* Process the static instances here because initialization of objc_symtab
depends on them. */
if (objc_static_instances)
generate_static_references ();
if (imp_list || class_names_chain
|| meth_var_names_chain || meth_var_types_chain || sel_ref_chain)
1992-01-18 00:15:38 +01:00
generate_objc_symtab_decl ();
for (impent = imp_list; impent; impent = impent->next)
{
c-parse.in (objc_inherit_code, [...]): Make static. 2001-10-03 Ziemowit Laski <zlaski@apple.com> * c-parse.in (objc_inherit_code, objc_pq_context, objc_public_flag): Make static. (objc_interface_context, objc_implementation_context, objc_method_context, objc_ivar_chain, objc_ivar_context): Move to global tree array in objc/objc-act.[ch]. (methoddef): Remove unnecessary code. * objc/objc-act.c: (hashed_attribute, hashed_entry, imp_entry): Hoist struct definitions to objc-act.h. (nst_method_hash_list, cls_method_hash_list, imp_list, imp_count, cat_count): Place declaration in objc-act.h. (objc_tree_index): Move enumeration to objc-act.h. (objc_global_trees): Place declaration and macro accessors in objc-act.h. (implementation_context): Remove duplicate; use objc_implementation_context instead: (method_context): Remove duplicate; use objc_method_context instead. (objc_ellipsis_node, objc_method_prototype_template, implemented_classes, function_type): Move global vars to objc_global_trees. (init_objc): Use LAST_BASE_TREE_CODE instead of LAST_CODE. (build_message_expr): Move actual construction of ObjC message send nodes to finish_message_expr. (finish_message_expr): New routine, contains code formerly in build_message_expr. * objc/objc-act.h (finish_message_expr): New prototype. (objc_ivar_chain, objc_method_context, objc_ellipsis_node): Remove declarations; these vars are now part of objc_global_trees. (objc_tree_index, objc_global_trees): Move definitions from objc-act.c. * objc/objc-tree.def: Update copyright info. From-SVN: r46000
2001-10-04 00:05:57 +02:00
objc_implementation_context = impent->imp_context;
1992-01-18 00:15:38 +01:00
implementation_template = impent->imp_template;
UOBJC_CLASS_decl = impent->class_decl;
UOBJC_METACLASS_decl = impent->meta_decl;
/* Dump the @interface of each class as we compile it, if the
-gen-decls option is in use. TODO: Dump the classes in the
order they were found, rather than in reverse order as we
are doing now. */
if (flag_gen_declaration)
{
dump_interface (gen_declaration_file, objc_implementation_context);
}
c-parse.in (objc_inherit_code, [...]): Make static. 2001-10-03 Ziemowit Laski <zlaski@apple.com> * c-parse.in (objc_inherit_code, objc_pq_context, objc_public_flag): Make static. (objc_interface_context, objc_implementation_context, objc_method_context, objc_ivar_chain, objc_ivar_context): Move to global tree array in objc/objc-act.[ch]. (methoddef): Remove unnecessary code. * objc/objc-act.c: (hashed_attribute, hashed_entry, imp_entry): Hoist struct definitions to objc-act.h. (nst_method_hash_list, cls_method_hash_list, imp_list, imp_count, cat_count): Place declaration in objc-act.h. (objc_tree_index): Move enumeration to objc-act.h. (objc_global_trees): Place declaration and macro accessors in objc-act.h. (implementation_context): Remove duplicate; use objc_implementation_context instead: (method_context): Remove duplicate; use objc_method_context instead. (objc_ellipsis_node, objc_method_prototype_template, implemented_classes, function_type): Move global vars to objc_global_trees. (init_objc): Use LAST_BASE_TREE_CODE instead of LAST_CODE. (build_message_expr): Move actual construction of ObjC message send nodes to finish_message_expr. (finish_message_expr): New routine, contains code formerly in build_message_expr. * objc/objc-act.h (finish_message_expr): New prototype. (objc_ivar_chain, objc_method_context, objc_ellipsis_node): Remove declarations; these vars are now part of objc_global_trees. (objc_tree_index, objc_global_trees): Move definitions from objc-act.c. * objc/objc-tree.def: Update copyright info. From-SVN: r46000
2001-10-04 00:05:57 +02:00
if (TREE_CODE (objc_implementation_context) == CLASS_IMPLEMENTATION_TYPE)
1992-01-18 00:15:38 +01:00
{
/* all of the following reference the string pool... */
generate_ivar_lists ();
generate_dispatch_tables ();
Yet more Objective-C++... * objc-act.c (objc_finish_try_stmt): Add return value. (objc_build_synchronized): Likewise. * objc-act.c (objc_is_gcable_type): Add. (objc_substitute_decl): Add. (objc_build_ivar_assignment): Add. (objc_build_global_assignment): Add. (objc_build_strong_cast_assignment): Add. (objc_is_ivar_reference_p): Add. (objc_is_global_reference_p): Add. (objc_generate_write_barrier): Add. (objc_rewrite_function_call): Add. (objc_gimplify_expr): Add Objective-C++ support. * objc-act.h (ALLOC_OBJC_TYPE_LANG_SPECIFIC): Likewise. (SIZEOF_OBJC_TYPE_LANG_SPECIFIC): Add. (INIT_TYPE_OBJC_INFO): Add Objective-C++ support. (DUP_TYPE_OBJC_INFO): Likewise. (struct imp_entry): Add field has_cxx_cdtors. (struct imp_entry *imp_list): Add OCTI_UMSG_FAST_DECL, OCTI_METH_LIST_TEMPL, OCTI_METH_PROTO_LIST_TEMPL, OCTI_IVAR_LIST_TEMPL, OCTI_ASSIGN_IVAR_DECL, OCTI_ASSIGN_IVAR_FAST_DECL, OCTI_ASSIGN_GLOBAL_DECL, OCTI_ASSIGN_STRONGCAST_DECL. (umsg_fast_decl): Add. (objc_assign_ivar_decl): Add. (objc_assign_ivar_fast_decl): Add. (objc_assign_global_decl): Add. (objc_assign_strong_cast_decl): Add. (objc_method_list_ptr): Add. (objc_method_proto_list_ptr): Add. (objc_ivar_list_ptr): Add. * objc-act.c (should_call_super_dealloc): Add. (OBJC_VERSION): Bump to 6. (objc_is_gcable_type): Add. (objc_substitute_decl): Add. (objc_build_ivar_assignment): Add. (objc_build_global_assignment): Add. (objc_build_strong_cast_assignment): Add. (objc_is_gcable_p): Add. (objc_is_ivar_reference_p): Add. (objc_is_global_reference_p): Add. (generate_shared_structures): Add flags parameter. (objc_generate_cxx_ctor_or_dtor): Add. (objc_generate_cxx_cdtors): Add. (add_class): Add name parameter. (objc_types_share_size_and_alignment): Add. (comp_proto_with_proto): Add strict parameter. (CLS_HAS_CXX_STRUCTORS): Add. (TAG_ASSIGNIVAR): Add. (TAG_ASSIGNGLOBAL): Add. (TAG_ASSIGNSTRONGCAST): Add. (TAG_MSGSEND_FAST): Add. (TAG_ASSIGNIVAR_FAST): Add. (TAG_CXX_CONSTRUCT): Add. (TAG_CXX_DESTRUCT): Add. (OBJC_LOOKUP_CLASS): Add. (OBJC_LOOKUP_NO_SUPER): Add. (objc_finish_file): Add pch support. (objc_finish_implementation): Add Objective-C++ support. (synth_module_prologue): Likewise. (synth_module_prologue): Add fast dispatching. (objc_get_class_reference): Add Objective-C++ support. (objc_generate_write_barrier): Likewise. (next_sjlj_build_enter_and_setjmp): Likewise. (objc_begin_try_stmt): Likewise. (build_next_objc_exception_stuff): Add fast ivar support. (build_private_template): Mark the record as used so debug information is generated. (build_protocol_template): Add Objective-C++ support. (objc_method_parm_type) Likewise. (objc_generate_cxx_ctor_or_dtor): Likewise. (objc_generate_cxx_cdtors): Likewise. (build_protocol_initializer): Likewise. (build_category_template): Likewise. (build_class_template): Likewise. (build_method_list_template): Likewise. (build_category_initializer): Likewise. (build_shared_structure_initializer): Likewise. (objc_finish_message_expr): Likewise. (build_objc_method_call): Add fast dispatch support. (lookup_method_static): Add support to end search at superclasses. (add_method_to_hash_list): Add strict parameter to comp_proto_with_proto. (objc_add_method): Likewise. (objc_add_method): Also set the interface_value. (add_instance_variable): Add Objective-C++ support. (objc_is_public): Likewise. (start_class): Likewise. (continue_class): Likewise. (encode_aggregate_within): Likewise. (start_method_def): Likewise. (objc_start_function): Clear current_function_returns_value and current_function_returns_null. (really_start_method): Add Objective-C++ support. (objc_finish_method_definition): Add warning for missing [super dealloc]. (finish_objc): Add Objective-C++ support. (generate_objc_image_info): Likewise. (objc_lookup_ivar): Likewise. * objc-act.h (TYPE_HAS_OBJC_INFO): Likewise. (INIT_TYPE_OBJC_INFO): Likewise. (DUP_TYPE_OBJC_INFO): Likewise. From-SVN: r99857
2005-05-17 22:07:08 +02:00
generate_shared_structures (impent->has_cxx_cdtors
? CLS_HAS_CXX_STRUCTORS
: 0);
1992-01-18 00:15:38 +01:00
}
else
{
generate_dispatch_tables ();
c-parse.in (objc_inherit_code, [...]): Make static. 2001-10-03 Ziemowit Laski <zlaski@apple.com> * c-parse.in (objc_inherit_code, objc_pq_context, objc_public_flag): Make static. (objc_interface_context, objc_implementation_context, objc_method_context, objc_ivar_chain, objc_ivar_context): Move to global tree array in objc/objc-act.[ch]. (methoddef): Remove unnecessary code. * objc/objc-act.c: (hashed_attribute, hashed_entry, imp_entry): Hoist struct definitions to objc-act.h. (nst_method_hash_list, cls_method_hash_list, imp_list, imp_count, cat_count): Place declaration in objc-act.h. (objc_tree_index): Move enumeration to objc-act.h. (objc_global_trees): Place declaration and macro accessors in objc-act.h. (implementation_context): Remove duplicate; use objc_implementation_context instead: (method_context): Remove duplicate; use objc_method_context instead. (objc_ellipsis_node, objc_method_prototype_template, implemented_classes, function_type): Move global vars to objc_global_trees. (init_objc): Use LAST_BASE_TREE_CODE instead of LAST_CODE. (build_message_expr): Move actual construction of ObjC message send nodes to finish_message_expr. (finish_message_expr): New routine, contains code formerly in build_message_expr. * objc/objc-act.h (finish_message_expr): New prototype. (objc_ivar_chain, objc_method_context, objc_ellipsis_node): Remove declarations; these vars are now part of objc_global_trees. (objc_tree_index, objc_global_trees): Move definitions from objc-act.c. * objc/objc-tree.def: Update copyright info. From-SVN: r46000
2001-10-04 00:05:57 +02:00
generate_category (objc_implementation_context);
1992-01-18 00:15:38 +01:00
}
}
/* If we are using an array of selectors, we must always
finish up the array decl even if no selectors were used. */
if (! flag_next_runtime || sel_ref_chain)
1992-01-18 00:15:38 +01:00
build_selector_translation_table ();
if (protocol_chain)
generate_protocols ();
Yet more Objective-C++... * objc-act.c (objc_finish_try_stmt): Add return value. (objc_build_synchronized): Likewise. * objc-act.c (objc_is_gcable_type): Add. (objc_substitute_decl): Add. (objc_build_ivar_assignment): Add. (objc_build_global_assignment): Add. (objc_build_strong_cast_assignment): Add. (objc_is_ivar_reference_p): Add. (objc_is_global_reference_p): Add. (objc_generate_write_barrier): Add. (objc_rewrite_function_call): Add. (objc_gimplify_expr): Add Objective-C++ support. * objc-act.h (ALLOC_OBJC_TYPE_LANG_SPECIFIC): Likewise. (SIZEOF_OBJC_TYPE_LANG_SPECIFIC): Add. (INIT_TYPE_OBJC_INFO): Add Objective-C++ support. (DUP_TYPE_OBJC_INFO): Likewise. (struct imp_entry): Add field has_cxx_cdtors. (struct imp_entry *imp_list): Add OCTI_UMSG_FAST_DECL, OCTI_METH_LIST_TEMPL, OCTI_METH_PROTO_LIST_TEMPL, OCTI_IVAR_LIST_TEMPL, OCTI_ASSIGN_IVAR_DECL, OCTI_ASSIGN_IVAR_FAST_DECL, OCTI_ASSIGN_GLOBAL_DECL, OCTI_ASSIGN_STRONGCAST_DECL. (umsg_fast_decl): Add. (objc_assign_ivar_decl): Add. (objc_assign_ivar_fast_decl): Add. (objc_assign_global_decl): Add. (objc_assign_strong_cast_decl): Add. (objc_method_list_ptr): Add. (objc_method_proto_list_ptr): Add. (objc_ivar_list_ptr): Add. * objc-act.c (should_call_super_dealloc): Add. (OBJC_VERSION): Bump to 6. (objc_is_gcable_type): Add. (objc_substitute_decl): Add. (objc_build_ivar_assignment): Add. (objc_build_global_assignment): Add. (objc_build_strong_cast_assignment): Add. (objc_is_gcable_p): Add. (objc_is_ivar_reference_p): Add. (objc_is_global_reference_p): Add. (generate_shared_structures): Add flags parameter. (objc_generate_cxx_ctor_or_dtor): Add. (objc_generate_cxx_cdtors): Add. (add_class): Add name parameter. (objc_types_share_size_and_alignment): Add. (comp_proto_with_proto): Add strict parameter. (CLS_HAS_CXX_STRUCTORS): Add. (TAG_ASSIGNIVAR): Add. (TAG_ASSIGNGLOBAL): Add. (TAG_ASSIGNSTRONGCAST): Add. (TAG_MSGSEND_FAST): Add. (TAG_ASSIGNIVAR_FAST): Add. (TAG_CXX_CONSTRUCT): Add. (TAG_CXX_DESTRUCT): Add. (OBJC_LOOKUP_CLASS): Add. (OBJC_LOOKUP_NO_SUPER): Add. (objc_finish_file): Add pch support. (objc_finish_implementation): Add Objective-C++ support. (synth_module_prologue): Likewise. (synth_module_prologue): Add fast dispatching. (objc_get_class_reference): Add Objective-C++ support. (objc_generate_write_barrier): Likewise. (next_sjlj_build_enter_and_setjmp): Likewise. (objc_begin_try_stmt): Likewise. (build_next_objc_exception_stuff): Add fast ivar support. (build_private_template): Mark the record as used so debug information is generated. (build_protocol_template): Add Objective-C++ support. (objc_method_parm_type) Likewise. (objc_generate_cxx_ctor_or_dtor): Likewise. (objc_generate_cxx_cdtors): Likewise. (build_protocol_initializer): Likewise. (build_category_template): Likewise. (build_class_template): Likewise. (build_method_list_template): Likewise. (build_category_initializer): Likewise. (build_shared_structure_initializer): Likewise. (objc_finish_message_expr): Likewise. (build_objc_method_call): Add fast dispatch support. (lookup_method_static): Add support to end search at superclasses. (add_method_to_hash_list): Add strict parameter to comp_proto_with_proto. (objc_add_method): Likewise. (objc_add_method): Also set the interface_value. (add_instance_variable): Add Objective-C++ support. (objc_is_public): Likewise. (start_class): Likewise. (continue_class): Likewise. (encode_aggregate_within): Likewise. (start_method_def): Likewise. (objc_start_function): Clear current_function_returns_value and current_function_returns_null. (really_start_method): Add Objective-C++ support. (objc_finish_method_definition): Add warning for missing [super dealloc]. (finish_objc): Add Objective-C++ support. (generate_objc_image_info): Likewise. (objc_lookup_ivar): Likewise. * objc-act.h (TYPE_HAS_OBJC_INFO): Likewise. (INIT_TYPE_OBJC_INFO): Likewise. (DUP_TYPE_OBJC_INFO): Likewise. From-SVN: r99857
2005-05-17 22:07:08 +02:00
if ((flag_replace_objc_classes && imp_list) || flag_objc_gc)
generate_objc_image_info ();
Makefile.in (c-parse.o): Depend on $(C_COMMON_H). [gcc/ChangeLog] 2004-09-07 Ziemowit Laski <zlaski@apple.com> * Makefile.in (c-parse.o): Depend on $(C_COMMON_H). * c-parse.in: Include c-common.h instead of objc-act.h. (ivar_decl_list, ivar_decls, ivar_decl, ivars, ivar_declarator, myparms, myparm): Remove %type declarations. (methodtype, optparms, OBJC_TYPE_QUAL, objc_quals, objc_qual, objc_typename, objc_try_catch_stmt, optellipsis): Add %type declarations. (objc_inherit_code, objc_public_flag): Remove. (typespec_nonreserved_nonattr): Call objc_get_protocol_qualified_type() instead of get_static_reference() and get_protocol_reference(). (stmt_nocomp): Call grokparm() on @catch parameter. (objcdef): Move semantic action to objc_finish_implementation(). (classdef): Move semantic action to objc_start_class_interface(), objc_continue_interface(), objc_finish_interface(), objc_start_class_implementation(), objc_continue_implementation(), objc_start_category_interface() and objc_start_category_implementation(). (protocoldef): Move semantic actions to objc_start_protocol() and objc_finish_interface(). (ivar_decl_list): Remove nonterminal. (visibility_spec): Move semantic actions to objc_set_visibility(). (ivar_decls): Remove assignment to $$. (ivar_decl): Rephrase in terms of component_decl; call objc_add_instance_variable(). (ivars, ivar_declarator): Remove nonterminals. (opt_semi): New nonterminal. (methodtype): Remove semantic actions. (methoddef): Move semantic actions to objc_set_method_type(), objc_start_method_definition() and objc_finish_method_definition(). (methodproto): Move semantic actions to objc_set_method_type() and objc_add_method_declaration(). (methoddecl): Use objc_typename instead of typename; move semantic actions to objc_build_method_signature(). (optarglist, myxdecls, mydecl, myparms, myparm): Remove nonterminals. (optparmlist): Express in terms of optparms and optellipsis. (optparms, optellipsis, objc_qual, objc_quals, objc_typename): New nonterminals. (keyworddecl): Use objc_typename instead of typename. (rid_to_yy): Mark RID_IN, RID_OUT, RID_INOUT, RID_BYCOPY, RID_BYREF and RID_ONEWAY as returning OBJC_TYPE_QUAL to yyparse(). [gcc/objc/ChangeLog] 2004-09-07 Ziemowit Laski <zlaski@apple.com> * Make-lang.in (objc/objc-parse.o): Depend on $(C_COMMON_H) instead of objc/objc-act.h. (objc/objc-act.o): Depend on $(HASHTAB_H). * objc-act.c: Include hashtab.h; in ObjC++ mode, include cp-tree.h and objcp-decl.h instead of c-tree.h. (build_module_descriptor, get_class_ivars, synth_id_with_class_suffix, error_with_ivar, gen_method_decl, gen_declaration, setup_string_decl, build_protocol_template): Adjust prototypes. (build_module_initializer_routine, start_class, continue_class, finish_class, start_method_def, objc_start_function, start_protocol, build_method_decl, objc_add_method, add_instance_variable, build_ivar_reference, is_ivar, is_private, get_super_receiver, build_selector_table_decl, objc_push_parm, objc_get_parm_info, gen_type_name, gen_type_name_0, start_var_decl, finish_var_decl, create_field_decl): New prototypes. (objc_expand_function_end, comp_method_with_proto, objc_expr_last, gen_declaration_1, gen_declarator, is_complex_decl, adorn_decl, define_decl, create_builtin_decl, gen_declspecs): Remove prototypes. (TYPE_ID): Rename to OBJECT_TYPEDEF_NAME. (CLASS_TYPEDEF_NAME): New. (TAG_EXECCLASS): Change from a global variable to a #define. (TAG_RETURN_STRUCT): Delete. (TAG_GNUINIT): New, holds '__objc_gnu_init' name. (objc_inherit_code, objc_public_flag): New, moved from c-parse.in. (string_descriptor): New struct. (string_htab): New hash table. (string_hash, string_eq): New prototypes. (generate_struct_by_value_array): Call create_field_decl() instead of create_builtin_decl(). (objc_init): Do not initialize objc_ellipsis_node or TAG_EXECCLASS; In ObjC++ mode, call cxx_init() instead of c_objc_common_init(). (objc_finish_file): In ObjC++, call instantiate_pending_templates() and cp_finish_file(). (define_decl, get_static_reference, get_protocol_reference, create_builtin_decl): Remove functions. (objc_start_class_interface, objc_start_category_interface, objc_start_protocol, objc_continue_interface, objc_finish_interface, objc_start_class_implementation, objc_start_category_implementation, objc_continue_implementation, objc_finish_implementation, objc_set_visibility, objc_set_method_type, objc_build_method_signature, objc_add_method_declaration, objc_start_method_definition, objc_add_instance_variable, objc_get_protocol_qualified_type, create_field_decl, start_var_decl, finish_var_decl): New functions. (setup_string_decl): Simplify since it is only called once. (synth_module_prologue): Call build_class_template(); predefine 'id' and 'Class' as typedefs; rename 'temp_type' to 'type'; disable debug hooks for duration of function; fix GNU runtime messenger signatures to correspond to reality; forward-declare '__objc_exec_class' for the GNU runtime; call build_selector_table_decl(); in ObjC++ mode, generate 'extern "C" { ... }' wrappers around synthesized declarations; call build_protocol_template() and build_category_template(). (string_hash, string_eq): New functions. (objc_build_string_object): Check metaclass correctness only once; store string literals in hash table. (objc_build_constructor): Do not convert initializer elements; adjust for ObjC++ impedance mismatch. (build_objc_symtab_template): Call create_field_decl() instead of create_builtin_decl(). (init_objc_symtab): Add missing conversion to initializer element. (build_metadata_decl): Call start_var_decl() instead of define_decl(). (generate_objc_symtab_decl): Do not call build_category_template(); call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(). (build_module_descriptor): Call create_field_decl() instead of grokfield(); call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(); always mark module descriptor as used; move GNU runtime-specific functionality to build_module_initializer_routine(). (build_module_initializer_routine): New function, broken off of build_module_descriptor(). (objc_static_init_needed_p, objc_generate_static_init_call): New functions. (generate_static_references, generate_strings, build_selector_translation_table, generate_descriptor_table, generate_ivars_list, generate_dispatch_table, generate_category): Call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(); build a type directly instead of via groktypename(). (build_selector_reference_decl, build_selector_table_decl, build_class_reference_decl, build_protocol_reference, generate_objc_image_info): Call start_var_decl() instead of build_decl(). (build_selector_reference): For GNU runtime, do not call build_selector_reference_decl(). (build_selector, build_typed_selector_reference): Always convert result to the selector type. (add_objc_string): Cast return value to 'char *'. (build_method_prototype_template, build_selector_template, build_method_template): Use actual selector type for fields pointing to selectors. (finish_objc): For GNU runtime, call build_module_initializer_routine() after build_module_descriptor(). (generate_protocol_list, generate_shared_structures): Call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(); build a type directly instead of via groktypename(). (synth_id_with_class_suffix): Return a string. (get_arg_type_list): For instance methods, use the instance type for 'self'; do not call groktypename_in_parm_context(). (build_objc_string_decl): Squash redeclaration errors in ObjC++. (objc_is_class_name): Use OBJC_TYPE_NAME instead of TYPE_NAME; handle RECORD_TYPEs in ObjC as well as ObjC++. (objc_is_id): New function. (objc_is_object_ptr): Return the canonical type node. (objc_get_class_ivars): Simplify using get_class_ivars(). (get_class_ivars): Remove second parameter; create a fresh copy of the ivar list for each call; do not check for existence of super class. (objc_eh_runtime_type): Mark #ifndef OBJCPLUS. (objc_init_exceptions): When using SJLJ-style exceptions, require the use of '-fobjc-exceptions' flag; do not require it for DWARF-style exceptions. (objc_build_exc_ptr, next_sjlj_build_try_catch_finally): Use objc_object_type instead of objc_id_type. (objc_begin_catch_clause): Convert the incoming PARM_DECL into a VAR_DECL before placing it in the appropriate scope; do not call define_decl(); adjust call to c_begin_compound_stmt(); use objc_object_type instead of objc_id_type. (build_next_objc_exception_stuff): Call create_field_decl() instead of create_builtin_decl(); construct type directly instead of calling groktypename(); use OBJC_VOID_AT_END to mark end of function parameters. (build_private_template): Adjust call to get_class_ivars(); build a type directly instead of via groktypename(). (build_protocol_template, build_method_prototype_list_template, build_method_prototype_template, build_category_template, build_selector_template, build_class_template, build_super_template, build_ivar_template, build_ivar_list_template, build_method_list_template, build_method_template): Call create_field_decl() instead of grokfield(). (objc_method_parm_type): Do not call groktypename(). (generate_descriptor_table): Call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(). (generate_method_descriptors, build_protocol_initializer, generate_dispatch_tables, build_category_initializer, build_shared_structure_initializer): Do not call groktypename(). (generate_protocols): Call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(); do not call groktypename(). (error_with_ivar): Remove last parameter. (check_ivars): Do not iterate ovar CLASS_RAW_IVARS lists in addition to CLASS_IVARS lists; adjust calls to error_with_ivar(). (generate_ivar_lists): Convert one of the initializer elements; do not call groktypename(). (get_arg_type_list, start_method_def, gen_method_def): Account for new representation of variable arguments and '...' in Objective-C methods; add Objective-C++ impedance matching code. (is_objc_type_qualifier): Remove function. (adjust_type_for_id_default): Simplify; there is no longer a need to wade through declspecs. (lookup_interface, start_class, continue_class, finish_class, start_method_def, start_protocol, build_method_decl, objc_add_method, add_instance_variable, build_ivar_reference, is_ivar, is_private, get_super_receiver, objc_build_finally_epilogue): Make into static functions. (receiver_is_class_object): Use new IS_CLASS() macro. (objc_build_message_expr): Tweak ObjC++ message argument handling; call objc_finish_message_expr() instead of finish_message_expr(). (finish_message_expr): Rename to objc_finish_message_expr(); use OBJC_TYPE_NAME and OBJC_SET_TYPE_NAME macros instead of TYPE_NAME. call gen_type_name() instead of gen_declaration(); call objc_is_id() instead of using IS_ID and IS_CLASS; Use objc_class_name instead of calling get_identifier("Class"); handle CONVERT_EXPRs in receiver. (build_objc_method_call, warn_with_method): Do not call groktypename(). (build_ivar_reference): Call convert() instead of clobbering in a type. (hash_init): Initialize string_htab hash table. (add_instance_variable): Simplify parameter list; do not call grokfield(); do not populate CLASS_IVARS list. (start_class): Check for the existence of super class, if one was specified. (continue_class): Use CLASS_RAW_IVARS rather than CLASS_IVARS; do not call build_class_template(); adjust call to get_class_ivars(); call build_decl(), pushdecl() and finish_decl() instead of define_decl(). (finish_class): Call build_decl(), pushdecl() and finish_decl() instead of define_decl(). (add_protocols): Use PROTOCOL_BINFO_ELTS for the tree vector size. (start_protocol): Do not call build_protocol_template(); use PROTOCOL_BINFO_ELTS for the tree vector size. (encode_type_qualifiers): Do not handle the 'const' qualifier here. (encode_pointer): Encode 'const char *' as 'r*', for backwards compatibility. (encode_array): Use HOST_WIDE_INT_PRINT_DEC instead of "%ld". (encode_type): Handle the 'const' qualifier here. (objc_parmlist): New global variable, sued by objc_push_parm and objc_get_parm_info(). (objc_push_parm, objc_get_parm_info): New functions. (objc_expr_last): Remove function. (synth_self_and_ucmd_args): For instance methods, use the instance type for 'self'; call objc_push_parm() instead of push_parm_decl(). (start_method_def): Do not call push_scope(), declare_parm_level(), pop_scope(), push_parm_decl(), store_parm_decls() or objc_expr_last(); just use objc_push_parm() and objc_get_parm_info(). (comp_method_with_proto): Remove function. (objc_types_are_equivalent): Strip away indirections before comparing underlying types. (comp_proto_with_proto): Do not call groktypename(); types are no longer in raw declspec format. (objc_start_function): New function. (really_start_method): Call comp_proto_with_proto() instead of comp_method_with_proto(); call objc_start_function() instead of hand-crafting a function declarator. (continue_method_def, objc_expand_function_end): Remove functions. (get_super_receiver): Call objc_get_current_scope() instead of get_current_scope(); reference 'super_class' field (instead of 'class'). (finish_method_def): Rename to objc_finish_method_definition() and add a function decl parameter; move method encoding call from objc_expand_function_end(). (is_complex_decl, adorn_decl, gen_declarator, gen_declspecs, gen_declaration_1): Remove functions. (tmpbuf, RAW_DECLSPEC): Remove. (gen_declaration): Remove second parameter; simplify to deal with TYPE_P nodes instead of raw declspecs. (gen_type_name, gen_type_name_0): New functions. (gen_method_decl): Remove second parameter; call gen_type_name() instead of gen_declaration_1(). (dump_interface): Adjust calls to gen_declaration() and gen_method_decl(); do not allocate a separate string buffer. (init_objc): Allocate a larger string buffer to accommodate dump_interface(); adjust call to build_module_descriptor(); add call to build_module_initializer_routine() for the GNU runtime. (generate_classref_translation_entry): Do not call start_decl(); call finish_var_decl() instead of finish_decl(); call convert() instead of build_c_cast(). * objc-act.h (CLASS_OWN_IVARS): Remove accessor. (CLASS_BINFO_ELTS): Reduce from 6 to 5, now that CLASS_OWN_IVARS is gone. (OCTI_GNU_INIT_DECL, GNU_INIT_decl): New. (OCTI_ELLIPSIS_NODE, objc_ellipsis_node): Remove. (OCTI_ID_ID, id_type, objc_id_id): Rename to OCTI_ID_NAME, objc_object_type and objc_object_name, respectively. (OCTI_CLS_REF, OCTI_CLASS_NAME, objc_class_reference, objc_class_name): New. (IS_CLASS): New macro. (IS_ID, IS_SUPER): Robustify. (OCTI_EXECCLASS_DECL, execclass_decl): New. (finish_file, start_class, continue_class, finish_class, start_method_def, continue_method_def, finish_method_def, start_protocol, finish_protocol, objc_build_throw_stmt, objc_build_try_catch_finally_stmt, objc_build_synchronized_prologue, objc_build_synchronized_epilogue, objc_build_try_prologue, objc_build_try_epilogue, objc_build_catch_stmt, objc_build_catch_epilogue, objc_build_finally_prologue, objc_build_finally_epilogue, is_ivar, is_private, is_public, add_instance_variable, objc_add_method, get_super_receiver, objc_clear_super_receiver, get_class_ivars_from_name, get_class_reference, get_static_reference, get_object_reference, build_message_expr, finish_message_expr, build_selector_expr, build_ivar_reference, build_keyword_decl, build_method_decl, build_protocol_expr, build_objc_string_object, objc_declare_alias, objc_declare_class, objc_declare_protocols, objc_comptypes, objc_check_decl, build_encode_expr): Remove prototypes. (imp_count, cat_count): Make GGC-aware. (OBJC_SET_TYPE_NAME): New macro. From-SVN: r87168
2004-09-08 02:49:44 +02:00
/* Arrange for ObjC data structures to be initialized at run time. */
c-parse.in (objc_inherit_code, [...]): Make static. 2001-10-03 Ziemowit Laski <zlaski@apple.com> * c-parse.in (objc_inherit_code, objc_pq_context, objc_public_flag): Make static. (objc_interface_context, objc_implementation_context, objc_method_context, objc_ivar_chain, objc_ivar_context): Move to global tree array in objc/objc-act.[ch]. (methoddef): Remove unnecessary code. * objc/objc-act.c: (hashed_attribute, hashed_entry, imp_entry): Hoist struct definitions to objc-act.h. (nst_method_hash_list, cls_method_hash_list, imp_list, imp_count, cat_count): Place declaration in objc-act.h. (objc_tree_index): Move enumeration to objc-act.h. (objc_global_trees): Place declaration and macro accessors in objc-act.h. (implementation_context): Remove duplicate; use objc_implementation_context instead: (method_context): Remove duplicate; use objc_method_context instead. (objc_ellipsis_node, objc_method_prototype_template, implemented_classes, function_type): Move global vars to objc_global_trees. (init_objc): Use LAST_BASE_TREE_CODE instead of LAST_CODE. (build_message_expr): Move actual construction of ObjC message send nodes to finish_message_expr. (finish_message_expr): New routine, contains code formerly in build_message_expr. * objc/objc-act.h (finish_message_expr): New prototype. (objc_ivar_chain, objc_method_context, objc_ellipsis_node): Remove declarations; these vars are now part of objc_global_trees. (objc_tree_index, objc_global_trees): Move definitions from objc-act.c. * objc/objc-tree.def: Update copyright info. From-SVN: r46000
2001-10-04 00:05:57 +02:00
if (objc_implementation_context || class_names_chain || objc_static_instances
|| meth_var_names_chain || meth_var_types_chain || sel_ref_chain)
1992-01-18 00:15:38 +01:00
{
Makefile.in (c-parse.o): Depend on $(C_COMMON_H). [gcc/ChangeLog] 2004-09-07 Ziemowit Laski <zlaski@apple.com> * Makefile.in (c-parse.o): Depend on $(C_COMMON_H). * c-parse.in: Include c-common.h instead of objc-act.h. (ivar_decl_list, ivar_decls, ivar_decl, ivars, ivar_declarator, myparms, myparm): Remove %type declarations. (methodtype, optparms, OBJC_TYPE_QUAL, objc_quals, objc_qual, objc_typename, objc_try_catch_stmt, optellipsis): Add %type declarations. (objc_inherit_code, objc_public_flag): Remove. (typespec_nonreserved_nonattr): Call objc_get_protocol_qualified_type() instead of get_static_reference() and get_protocol_reference(). (stmt_nocomp): Call grokparm() on @catch parameter. (objcdef): Move semantic action to objc_finish_implementation(). (classdef): Move semantic action to objc_start_class_interface(), objc_continue_interface(), objc_finish_interface(), objc_start_class_implementation(), objc_continue_implementation(), objc_start_category_interface() and objc_start_category_implementation(). (protocoldef): Move semantic actions to objc_start_protocol() and objc_finish_interface(). (ivar_decl_list): Remove nonterminal. (visibility_spec): Move semantic actions to objc_set_visibility(). (ivar_decls): Remove assignment to $$. (ivar_decl): Rephrase in terms of component_decl; call objc_add_instance_variable(). (ivars, ivar_declarator): Remove nonterminals. (opt_semi): New nonterminal. (methodtype): Remove semantic actions. (methoddef): Move semantic actions to objc_set_method_type(), objc_start_method_definition() and objc_finish_method_definition(). (methodproto): Move semantic actions to objc_set_method_type() and objc_add_method_declaration(). (methoddecl): Use objc_typename instead of typename; move semantic actions to objc_build_method_signature(). (optarglist, myxdecls, mydecl, myparms, myparm): Remove nonterminals. (optparmlist): Express in terms of optparms and optellipsis. (optparms, optellipsis, objc_qual, objc_quals, objc_typename): New nonterminals. (keyworddecl): Use objc_typename instead of typename. (rid_to_yy): Mark RID_IN, RID_OUT, RID_INOUT, RID_BYCOPY, RID_BYREF and RID_ONEWAY as returning OBJC_TYPE_QUAL to yyparse(). [gcc/objc/ChangeLog] 2004-09-07 Ziemowit Laski <zlaski@apple.com> * Make-lang.in (objc/objc-parse.o): Depend on $(C_COMMON_H) instead of objc/objc-act.h. (objc/objc-act.o): Depend on $(HASHTAB_H). * objc-act.c: Include hashtab.h; in ObjC++ mode, include cp-tree.h and objcp-decl.h instead of c-tree.h. (build_module_descriptor, get_class_ivars, synth_id_with_class_suffix, error_with_ivar, gen_method_decl, gen_declaration, setup_string_decl, build_protocol_template): Adjust prototypes. (build_module_initializer_routine, start_class, continue_class, finish_class, start_method_def, objc_start_function, start_protocol, build_method_decl, objc_add_method, add_instance_variable, build_ivar_reference, is_ivar, is_private, get_super_receiver, build_selector_table_decl, objc_push_parm, objc_get_parm_info, gen_type_name, gen_type_name_0, start_var_decl, finish_var_decl, create_field_decl): New prototypes. (objc_expand_function_end, comp_method_with_proto, objc_expr_last, gen_declaration_1, gen_declarator, is_complex_decl, adorn_decl, define_decl, create_builtin_decl, gen_declspecs): Remove prototypes. (TYPE_ID): Rename to OBJECT_TYPEDEF_NAME. (CLASS_TYPEDEF_NAME): New. (TAG_EXECCLASS): Change from a global variable to a #define. (TAG_RETURN_STRUCT): Delete. (TAG_GNUINIT): New, holds '__objc_gnu_init' name. (objc_inherit_code, objc_public_flag): New, moved from c-parse.in. (string_descriptor): New struct. (string_htab): New hash table. (string_hash, string_eq): New prototypes. (generate_struct_by_value_array): Call create_field_decl() instead of create_builtin_decl(). (objc_init): Do not initialize objc_ellipsis_node or TAG_EXECCLASS; In ObjC++ mode, call cxx_init() instead of c_objc_common_init(). (objc_finish_file): In ObjC++, call instantiate_pending_templates() and cp_finish_file(). (define_decl, get_static_reference, get_protocol_reference, create_builtin_decl): Remove functions. (objc_start_class_interface, objc_start_category_interface, objc_start_protocol, objc_continue_interface, objc_finish_interface, objc_start_class_implementation, objc_start_category_implementation, objc_continue_implementation, objc_finish_implementation, objc_set_visibility, objc_set_method_type, objc_build_method_signature, objc_add_method_declaration, objc_start_method_definition, objc_add_instance_variable, objc_get_protocol_qualified_type, create_field_decl, start_var_decl, finish_var_decl): New functions. (setup_string_decl): Simplify since it is only called once. (synth_module_prologue): Call build_class_template(); predefine 'id' and 'Class' as typedefs; rename 'temp_type' to 'type'; disable debug hooks for duration of function; fix GNU runtime messenger signatures to correspond to reality; forward-declare '__objc_exec_class' for the GNU runtime; call build_selector_table_decl(); in ObjC++ mode, generate 'extern "C" { ... }' wrappers around synthesized declarations; call build_protocol_template() and build_category_template(). (string_hash, string_eq): New functions. (objc_build_string_object): Check metaclass correctness only once; store string literals in hash table. (objc_build_constructor): Do not convert initializer elements; adjust for ObjC++ impedance mismatch. (build_objc_symtab_template): Call create_field_decl() instead of create_builtin_decl(). (init_objc_symtab): Add missing conversion to initializer element. (build_metadata_decl): Call start_var_decl() instead of define_decl(). (generate_objc_symtab_decl): Do not call build_category_template(); call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(). (build_module_descriptor): Call create_field_decl() instead of grokfield(); call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(); always mark module descriptor as used; move GNU runtime-specific functionality to build_module_initializer_routine(). (build_module_initializer_routine): New function, broken off of build_module_descriptor(). (objc_static_init_needed_p, objc_generate_static_init_call): New functions. (generate_static_references, generate_strings, build_selector_translation_table, generate_descriptor_table, generate_ivars_list, generate_dispatch_table, generate_category): Call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(); build a type directly instead of via groktypename(). (build_selector_reference_decl, build_selector_table_decl, build_class_reference_decl, build_protocol_reference, generate_objc_image_info): Call start_var_decl() instead of build_decl(). (build_selector_reference): For GNU runtime, do not call build_selector_reference_decl(). (build_selector, build_typed_selector_reference): Always convert result to the selector type. (add_objc_string): Cast return value to 'char *'. (build_method_prototype_template, build_selector_template, build_method_template): Use actual selector type for fields pointing to selectors. (finish_objc): For GNU runtime, call build_module_initializer_routine() after build_module_descriptor(). (generate_protocol_list, generate_shared_structures): Call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(); build a type directly instead of via groktypename(). (synth_id_with_class_suffix): Return a string. (get_arg_type_list): For instance methods, use the instance type for 'self'; do not call groktypename_in_parm_context(). (build_objc_string_decl): Squash redeclaration errors in ObjC++. (objc_is_class_name): Use OBJC_TYPE_NAME instead of TYPE_NAME; handle RECORD_TYPEs in ObjC as well as ObjC++. (objc_is_id): New function. (objc_is_object_ptr): Return the canonical type node. (objc_get_class_ivars): Simplify using get_class_ivars(). (get_class_ivars): Remove second parameter; create a fresh copy of the ivar list for each call; do not check for existence of super class. (objc_eh_runtime_type): Mark #ifndef OBJCPLUS. (objc_init_exceptions): When using SJLJ-style exceptions, require the use of '-fobjc-exceptions' flag; do not require it for DWARF-style exceptions. (objc_build_exc_ptr, next_sjlj_build_try_catch_finally): Use objc_object_type instead of objc_id_type. (objc_begin_catch_clause): Convert the incoming PARM_DECL into a VAR_DECL before placing it in the appropriate scope; do not call define_decl(); adjust call to c_begin_compound_stmt(); use objc_object_type instead of objc_id_type. (build_next_objc_exception_stuff): Call create_field_decl() instead of create_builtin_decl(); construct type directly instead of calling groktypename(); use OBJC_VOID_AT_END to mark end of function parameters. (build_private_template): Adjust call to get_class_ivars(); build a type directly instead of via groktypename(). (build_protocol_template, build_method_prototype_list_template, build_method_prototype_template, build_category_template, build_selector_template, build_class_template, build_super_template, build_ivar_template, build_ivar_list_template, build_method_list_template, build_method_template): Call create_field_decl() instead of grokfield(). (objc_method_parm_type): Do not call groktypename(). (generate_descriptor_table): Call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(). (generate_method_descriptors, build_protocol_initializer, generate_dispatch_tables, build_category_initializer, build_shared_structure_initializer): Do not call groktypename(). (generate_protocols): Call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(); do not call groktypename(). (error_with_ivar): Remove last parameter. (check_ivars): Do not iterate ovar CLASS_RAW_IVARS lists in addition to CLASS_IVARS lists; adjust calls to error_with_ivar(). (generate_ivar_lists): Convert one of the initializer elements; do not call groktypename(). (get_arg_type_list, start_method_def, gen_method_def): Account for new representation of variable arguments and '...' in Objective-C methods; add Objective-C++ impedance matching code. (is_objc_type_qualifier): Remove function. (adjust_type_for_id_default): Simplify; there is no longer a need to wade through declspecs. (lookup_interface, start_class, continue_class, finish_class, start_method_def, start_protocol, build_method_decl, objc_add_method, add_instance_variable, build_ivar_reference, is_ivar, is_private, get_super_receiver, objc_build_finally_epilogue): Make into static functions. (receiver_is_class_object): Use new IS_CLASS() macro. (objc_build_message_expr): Tweak ObjC++ message argument handling; call objc_finish_message_expr() instead of finish_message_expr(). (finish_message_expr): Rename to objc_finish_message_expr(); use OBJC_TYPE_NAME and OBJC_SET_TYPE_NAME macros instead of TYPE_NAME. call gen_type_name() instead of gen_declaration(); call objc_is_id() instead of using IS_ID and IS_CLASS; Use objc_class_name instead of calling get_identifier("Class"); handle CONVERT_EXPRs in receiver. (build_objc_method_call, warn_with_method): Do not call groktypename(). (build_ivar_reference): Call convert() instead of clobbering in a type. (hash_init): Initialize string_htab hash table. (add_instance_variable): Simplify parameter list; do not call grokfield(); do not populate CLASS_IVARS list. (start_class): Check for the existence of super class, if one was specified. (continue_class): Use CLASS_RAW_IVARS rather than CLASS_IVARS; do not call build_class_template(); adjust call to get_class_ivars(); call build_decl(), pushdecl() and finish_decl() instead of define_decl(). (finish_class): Call build_decl(), pushdecl() and finish_decl() instead of define_decl(). (add_protocols): Use PROTOCOL_BINFO_ELTS for the tree vector size. (start_protocol): Do not call build_protocol_template(); use PROTOCOL_BINFO_ELTS for the tree vector size. (encode_type_qualifiers): Do not handle the 'const' qualifier here. (encode_pointer): Encode 'const char *' as 'r*', for backwards compatibility. (encode_array): Use HOST_WIDE_INT_PRINT_DEC instead of "%ld". (encode_type): Handle the 'const' qualifier here. (objc_parmlist): New global variable, sued by objc_push_parm and objc_get_parm_info(). (objc_push_parm, objc_get_parm_info): New functions. (objc_expr_last): Remove function. (synth_self_and_ucmd_args): For instance methods, use the instance type for 'self'; call objc_push_parm() instead of push_parm_decl(). (start_method_def): Do not call push_scope(), declare_parm_level(), pop_scope(), push_parm_decl(), store_parm_decls() or objc_expr_last(); just use objc_push_parm() and objc_get_parm_info(). (comp_method_with_proto): Remove function. (objc_types_are_equivalent): Strip away indirections before comparing underlying types. (comp_proto_with_proto): Do not call groktypename(); types are no longer in raw declspec format. (objc_start_function): New function. (really_start_method): Call comp_proto_with_proto() instead of comp_method_with_proto(); call objc_start_function() instead of hand-crafting a function declarator. (continue_method_def, objc_expand_function_end): Remove functions. (get_super_receiver): Call objc_get_current_scope() instead of get_current_scope(); reference 'super_class' field (instead of 'class'). (finish_method_def): Rename to objc_finish_method_definition() and add a function decl parameter; move method encoding call from objc_expand_function_end(). (is_complex_decl, adorn_decl, gen_declarator, gen_declspecs, gen_declaration_1): Remove functions. (tmpbuf, RAW_DECLSPEC): Remove. (gen_declaration): Remove second parameter; simplify to deal with TYPE_P nodes instead of raw declspecs. (gen_type_name, gen_type_name_0): New functions. (gen_method_decl): Remove second parameter; call gen_type_name() instead of gen_declaration_1(). (dump_interface): Adjust calls to gen_declaration() and gen_method_decl(); do not allocate a separate string buffer. (init_objc): Allocate a larger string buffer to accommodate dump_interface(); adjust call to build_module_descriptor(); add call to build_module_initializer_routine() for the GNU runtime. (generate_classref_translation_entry): Do not call start_decl(); call finish_var_decl() instead of finish_decl(); call convert() instead of build_c_cast(). * objc-act.h (CLASS_OWN_IVARS): Remove accessor. (CLASS_BINFO_ELTS): Reduce from 6 to 5, now that CLASS_OWN_IVARS is gone. (OCTI_GNU_INIT_DECL, GNU_INIT_decl): New. (OCTI_ELLIPSIS_NODE, objc_ellipsis_node): Remove. (OCTI_ID_ID, id_type, objc_id_id): Rename to OCTI_ID_NAME, objc_object_type and objc_object_name, respectively. (OCTI_CLS_REF, OCTI_CLASS_NAME, objc_class_reference, objc_class_name): New. (IS_CLASS): New macro. (IS_ID, IS_SUPER): Robustify. (OCTI_EXECCLASS_DECL, execclass_decl): New. (finish_file, start_class, continue_class, finish_class, start_method_def, continue_method_def, finish_method_def, start_protocol, finish_protocol, objc_build_throw_stmt, objc_build_try_catch_finally_stmt, objc_build_synchronized_prologue, objc_build_synchronized_epilogue, objc_build_try_prologue, objc_build_try_epilogue, objc_build_catch_stmt, objc_build_catch_epilogue, objc_build_finally_prologue, objc_build_finally_epilogue, is_ivar, is_private, is_public, add_instance_variable, objc_add_method, get_super_receiver, objc_clear_super_receiver, get_class_ivars_from_name, get_class_reference, get_static_reference, get_object_reference, build_message_expr, finish_message_expr, build_selector_expr, build_ivar_reference, build_keyword_decl, build_method_decl, build_protocol_expr, build_objc_string_object, objc_declare_alias, objc_declare_class, objc_declare_protocols, objc_comptypes, objc_check_decl, build_encode_expr): Remove prototypes. (imp_count, cat_count): Make GGC-aware. (OBJC_SET_TYPE_NAME): New macro. From-SVN: r87168
2004-09-08 02:49:44 +02:00
build_module_descriptor ();
if (!flag_next_runtime)
build_module_initializer_routine ();
1992-01-18 00:15:38 +01:00
}
/* Dump the class references. This forces the appropriate classes
1992-01-18 00:15:38 +01:00
to be linked into the executable image, preserving unix archive
semantics. This can be removed when we move to a more dynamically
linked environment. */
1992-01-18 00:15:38 +01:00
for (chain = cls_ref_chain; chain; chain = TREE_CHAIN (chain))
{
handle_class_ref (chain);
if (TREE_PURPOSE (chain))
generate_classref_translation_entry (chain);
}
1992-01-18 00:15:38 +01:00
for (impent = imp_list; impent; impent = impent->next)
handle_impent (impent);
1992-01-18 00:15:38 +01:00
if (warn_selector)
{
int slot;
hash hsh;
1992-01-18 00:15:38 +01:00
/* Run through the selector hash tables and print a warning for any
1996-07-04 00:07:53 +02:00
selector which has multiple methods. */
1992-01-18 00:15:38 +01:00
for (slot = 0; slot < SIZEHASHTABLE; slot++)
{
for (hsh = cls_method_hash_list[slot]; hsh; hsh = hsh->next)
check_duplicates (hsh, 0, 1);
for (hsh = nst_method_hash_list[slot]; hsh; hsh = hsh->next)
check_duplicates (hsh, 0, 1);
}
1992-01-18 00:15:38 +01:00
}
warn_missing_braces = save_warn_missing_braces;
1992-01-18 00:15:38 +01:00
}
/* Subroutines of finish_objc. */
static void
generate_classref_translation_entry (tree chain)
{
Makefile.in (c-parse.o): Depend on $(C_COMMON_H). [gcc/ChangeLog] 2004-09-07 Ziemowit Laski <zlaski@apple.com> * Makefile.in (c-parse.o): Depend on $(C_COMMON_H). * c-parse.in: Include c-common.h instead of objc-act.h. (ivar_decl_list, ivar_decls, ivar_decl, ivars, ivar_declarator, myparms, myparm): Remove %type declarations. (methodtype, optparms, OBJC_TYPE_QUAL, objc_quals, objc_qual, objc_typename, objc_try_catch_stmt, optellipsis): Add %type declarations. (objc_inherit_code, objc_public_flag): Remove. (typespec_nonreserved_nonattr): Call objc_get_protocol_qualified_type() instead of get_static_reference() and get_protocol_reference(). (stmt_nocomp): Call grokparm() on @catch parameter. (objcdef): Move semantic action to objc_finish_implementation(). (classdef): Move semantic action to objc_start_class_interface(), objc_continue_interface(), objc_finish_interface(), objc_start_class_implementation(), objc_continue_implementation(), objc_start_category_interface() and objc_start_category_implementation(). (protocoldef): Move semantic actions to objc_start_protocol() and objc_finish_interface(). (ivar_decl_list): Remove nonterminal. (visibility_spec): Move semantic actions to objc_set_visibility(). (ivar_decls): Remove assignment to $$. (ivar_decl): Rephrase in terms of component_decl; call objc_add_instance_variable(). (ivars, ivar_declarator): Remove nonterminals. (opt_semi): New nonterminal. (methodtype): Remove semantic actions. (methoddef): Move semantic actions to objc_set_method_type(), objc_start_method_definition() and objc_finish_method_definition(). (methodproto): Move semantic actions to objc_set_method_type() and objc_add_method_declaration(). (methoddecl): Use objc_typename instead of typename; move semantic actions to objc_build_method_signature(). (optarglist, myxdecls, mydecl, myparms, myparm): Remove nonterminals. (optparmlist): Express in terms of optparms and optellipsis. (optparms, optellipsis, objc_qual, objc_quals, objc_typename): New nonterminals. (keyworddecl): Use objc_typename instead of typename. (rid_to_yy): Mark RID_IN, RID_OUT, RID_INOUT, RID_BYCOPY, RID_BYREF and RID_ONEWAY as returning OBJC_TYPE_QUAL to yyparse(). [gcc/objc/ChangeLog] 2004-09-07 Ziemowit Laski <zlaski@apple.com> * Make-lang.in (objc/objc-parse.o): Depend on $(C_COMMON_H) instead of objc/objc-act.h. (objc/objc-act.o): Depend on $(HASHTAB_H). * objc-act.c: Include hashtab.h; in ObjC++ mode, include cp-tree.h and objcp-decl.h instead of c-tree.h. (build_module_descriptor, get_class_ivars, synth_id_with_class_suffix, error_with_ivar, gen_method_decl, gen_declaration, setup_string_decl, build_protocol_template): Adjust prototypes. (build_module_initializer_routine, start_class, continue_class, finish_class, start_method_def, objc_start_function, start_protocol, build_method_decl, objc_add_method, add_instance_variable, build_ivar_reference, is_ivar, is_private, get_super_receiver, build_selector_table_decl, objc_push_parm, objc_get_parm_info, gen_type_name, gen_type_name_0, start_var_decl, finish_var_decl, create_field_decl): New prototypes. (objc_expand_function_end, comp_method_with_proto, objc_expr_last, gen_declaration_1, gen_declarator, is_complex_decl, adorn_decl, define_decl, create_builtin_decl, gen_declspecs): Remove prototypes. (TYPE_ID): Rename to OBJECT_TYPEDEF_NAME. (CLASS_TYPEDEF_NAME): New. (TAG_EXECCLASS): Change from a global variable to a #define. (TAG_RETURN_STRUCT): Delete. (TAG_GNUINIT): New, holds '__objc_gnu_init' name. (objc_inherit_code, objc_public_flag): New, moved from c-parse.in. (string_descriptor): New struct. (string_htab): New hash table. (string_hash, string_eq): New prototypes. (generate_struct_by_value_array): Call create_field_decl() instead of create_builtin_decl(). (objc_init): Do not initialize objc_ellipsis_node or TAG_EXECCLASS; In ObjC++ mode, call cxx_init() instead of c_objc_common_init(). (objc_finish_file): In ObjC++, call instantiate_pending_templates() and cp_finish_file(). (define_decl, get_static_reference, get_protocol_reference, create_builtin_decl): Remove functions. (objc_start_class_interface, objc_start_category_interface, objc_start_protocol, objc_continue_interface, objc_finish_interface, objc_start_class_implementation, objc_start_category_implementation, objc_continue_implementation, objc_finish_implementation, objc_set_visibility, objc_set_method_type, objc_build_method_signature, objc_add_method_declaration, objc_start_method_definition, objc_add_instance_variable, objc_get_protocol_qualified_type, create_field_decl, start_var_decl, finish_var_decl): New functions. (setup_string_decl): Simplify since it is only called once. (synth_module_prologue): Call build_class_template(); predefine 'id' and 'Class' as typedefs; rename 'temp_type' to 'type'; disable debug hooks for duration of function; fix GNU runtime messenger signatures to correspond to reality; forward-declare '__objc_exec_class' for the GNU runtime; call build_selector_table_decl(); in ObjC++ mode, generate 'extern "C" { ... }' wrappers around synthesized declarations; call build_protocol_template() and build_category_template(). (string_hash, string_eq): New functions. (objc_build_string_object): Check metaclass correctness only once; store string literals in hash table. (objc_build_constructor): Do not convert initializer elements; adjust for ObjC++ impedance mismatch. (build_objc_symtab_template): Call create_field_decl() instead of create_builtin_decl(). (init_objc_symtab): Add missing conversion to initializer element. (build_metadata_decl): Call start_var_decl() instead of define_decl(). (generate_objc_symtab_decl): Do not call build_category_template(); call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(). (build_module_descriptor): Call create_field_decl() instead of grokfield(); call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(); always mark module descriptor as used; move GNU runtime-specific functionality to build_module_initializer_routine(). (build_module_initializer_routine): New function, broken off of build_module_descriptor(). (objc_static_init_needed_p, objc_generate_static_init_call): New functions. (generate_static_references, generate_strings, build_selector_translation_table, generate_descriptor_table, generate_ivars_list, generate_dispatch_table, generate_category): Call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(); build a type directly instead of via groktypename(). (build_selector_reference_decl, build_selector_table_decl, build_class_reference_decl, build_protocol_reference, generate_objc_image_info): Call start_var_decl() instead of build_decl(). (build_selector_reference): For GNU runtime, do not call build_selector_reference_decl(). (build_selector, build_typed_selector_reference): Always convert result to the selector type. (add_objc_string): Cast return value to 'char *'. (build_method_prototype_template, build_selector_template, build_method_template): Use actual selector type for fields pointing to selectors. (finish_objc): For GNU runtime, call build_module_initializer_routine() after build_module_descriptor(). (generate_protocol_list, generate_shared_structures): Call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(); build a type directly instead of via groktypename(). (synth_id_with_class_suffix): Return a string. (get_arg_type_list): For instance methods, use the instance type for 'self'; do not call groktypename_in_parm_context(). (build_objc_string_decl): Squash redeclaration errors in ObjC++. (objc_is_class_name): Use OBJC_TYPE_NAME instead of TYPE_NAME; handle RECORD_TYPEs in ObjC as well as ObjC++. (objc_is_id): New function. (objc_is_object_ptr): Return the canonical type node. (objc_get_class_ivars): Simplify using get_class_ivars(). (get_class_ivars): Remove second parameter; create a fresh copy of the ivar list for each call; do not check for existence of super class. (objc_eh_runtime_type): Mark #ifndef OBJCPLUS. (objc_init_exceptions): When using SJLJ-style exceptions, require the use of '-fobjc-exceptions' flag; do not require it for DWARF-style exceptions. (objc_build_exc_ptr, next_sjlj_build_try_catch_finally): Use objc_object_type instead of objc_id_type. (objc_begin_catch_clause): Convert the incoming PARM_DECL into a VAR_DECL before placing it in the appropriate scope; do not call define_decl(); adjust call to c_begin_compound_stmt(); use objc_object_type instead of objc_id_type. (build_next_objc_exception_stuff): Call create_field_decl() instead of create_builtin_decl(); construct type directly instead of calling groktypename(); use OBJC_VOID_AT_END to mark end of function parameters. (build_private_template): Adjust call to get_class_ivars(); build a type directly instead of via groktypename(). (build_protocol_template, build_method_prototype_list_template, build_method_prototype_template, build_category_template, build_selector_template, build_class_template, build_super_template, build_ivar_template, build_ivar_list_template, build_method_list_template, build_method_template): Call create_field_decl() instead of grokfield(). (objc_method_parm_type): Do not call groktypename(). (generate_descriptor_table): Call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(). (generate_method_descriptors, build_protocol_initializer, generate_dispatch_tables, build_category_initializer, build_shared_structure_initializer): Do not call groktypename(). (generate_protocols): Call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(); do not call groktypename(). (error_with_ivar): Remove last parameter. (check_ivars): Do not iterate ovar CLASS_RAW_IVARS lists in addition to CLASS_IVARS lists; adjust calls to error_with_ivar(). (generate_ivar_lists): Convert one of the initializer elements; do not call groktypename(). (get_arg_type_list, start_method_def, gen_method_def): Account for new representation of variable arguments and '...' in Objective-C methods; add Objective-C++ impedance matching code. (is_objc_type_qualifier): Remove function. (adjust_type_for_id_default): Simplify; there is no longer a need to wade through declspecs. (lookup_interface, start_class, continue_class, finish_class, start_method_def, start_protocol, build_method_decl, objc_add_method, add_instance_variable, build_ivar_reference, is_ivar, is_private, get_super_receiver, objc_build_finally_epilogue): Make into static functions. (receiver_is_class_object): Use new IS_CLASS() macro. (objc_build_message_expr): Tweak ObjC++ message argument handling; call objc_finish_message_expr() instead of finish_message_expr(). (finish_message_expr): Rename to objc_finish_message_expr(); use OBJC_TYPE_NAME and OBJC_SET_TYPE_NAME macros instead of TYPE_NAME. call gen_type_name() instead of gen_declaration(); call objc_is_id() instead of using IS_ID and IS_CLASS; Use objc_class_name instead of calling get_identifier("Class"); handle CONVERT_EXPRs in receiver. (build_objc_method_call, warn_with_method): Do not call groktypename(). (build_ivar_reference): Call convert() instead of clobbering in a type. (hash_init): Initialize string_htab hash table. (add_instance_variable): Simplify parameter list; do not call grokfield(); do not populate CLASS_IVARS list. (start_class): Check for the existence of super class, if one was specified. (continue_class): Use CLASS_RAW_IVARS rather than CLASS_IVARS; do not call build_class_template(); adjust call to get_class_ivars(); call build_decl(), pushdecl() and finish_decl() instead of define_decl(). (finish_class): Call build_decl(), pushdecl() and finish_decl() instead of define_decl(). (add_protocols): Use PROTOCOL_BINFO_ELTS for the tree vector size. (start_protocol): Do not call build_protocol_template(); use PROTOCOL_BINFO_ELTS for the tree vector size. (encode_type_qualifiers): Do not handle the 'const' qualifier here. (encode_pointer): Encode 'const char *' as 'r*', for backwards compatibility. (encode_array): Use HOST_WIDE_INT_PRINT_DEC instead of "%ld". (encode_type): Handle the 'const' qualifier here. (objc_parmlist): New global variable, sued by objc_push_parm and objc_get_parm_info(). (objc_push_parm, objc_get_parm_info): New functions. (objc_expr_last): Remove function. (synth_self_and_ucmd_args): For instance methods, use the instance type for 'self'; call objc_push_parm() instead of push_parm_decl(). (start_method_def): Do not call push_scope(), declare_parm_level(), pop_scope(), push_parm_decl(), store_parm_decls() or objc_expr_last(); just use objc_push_parm() and objc_get_parm_info(). (comp_method_with_proto): Remove function. (objc_types_are_equivalent): Strip away indirections before comparing underlying types. (comp_proto_with_proto): Do not call groktypename(); types are no longer in raw declspec format. (objc_start_function): New function. (really_start_method): Call comp_proto_with_proto() instead of comp_method_with_proto(); call objc_start_function() instead of hand-crafting a function declarator. (continue_method_def, objc_expand_function_end): Remove functions. (get_super_receiver): Call objc_get_current_scope() instead of get_current_scope(); reference 'super_class' field (instead of 'class'). (finish_method_def): Rename to objc_finish_method_definition() and add a function decl parameter; move method encoding call from objc_expand_function_end(). (is_complex_decl, adorn_decl, gen_declarator, gen_declspecs, gen_declaration_1): Remove functions. (tmpbuf, RAW_DECLSPEC): Remove. (gen_declaration): Remove second parameter; simplify to deal with TYPE_P nodes instead of raw declspecs. (gen_type_name, gen_type_name_0): New functions. (gen_method_decl): Remove second parameter; call gen_type_name() instead of gen_declaration_1(). (dump_interface): Adjust calls to gen_declaration() and gen_method_decl(); do not allocate a separate string buffer. (init_objc): Allocate a larger string buffer to accommodate dump_interface(); adjust call to build_module_descriptor(); add call to build_module_initializer_routine() for the GNU runtime. (generate_classref_translation_entry): Do not call start_decl(); call finish_var_decl() instead of finish_decl(); call convert() instead of build_c_cast(). * objc-act.h (CLASS_OWN_IVARS): Remove accessor. (CLASS_BINFO_ELTS): Reduce from 6 to 5, now that CLASS_OWN_IVARS is gone. (OCTI_GNU_INIT_DECL, GNU_INIT_decl): New. (OCTI_ELLIPSIS_NODE, objc_ellipsis_node): Remove. (OCTI_ID_ID, id_type, objc_id_id): Rename to OCTI_ID_NAME, objc_object_type and objc_object_name, respectively. (OCTI_CLS_REF, OCTI_CLASS_NAME, objc_class_reference, objc_class_name): New. (IS_CLASS): New macro. (IS_ID, IS_SUPER): Robustify. (OCTI_EXECCLASS_DECL, execclass_decl): New. (finish_file, start_class, continue_class, finish_class, start_method_def, continue_method_def, finish_method_def, start_protocol, finish_protocol, objc_build_throw_stmt, objc_build_try_catch_finally_stmt, objc_build_synchronized_prologue, objc_build_synchronized_epilogue, objc_build_try_prologue, objc_build_try_epilogue, objc_build_catch_stmt, objc_build_catch_epilogue, objc_build_finally_prologue, objc_build_finally_epilogue, is_ivar, is_private, is_public, add_instance_variable, objc_add_method, get_super_receiver, objc_clear_super_receiver, get_class_ivars_from_name, get_class_reference, get_static_reference, get_object_reference, build_message_expr, finish_message_expr, build_selector_expr, build_ivar_reference, build_keyword_decl, build_method_decl, build_protocol_expr, build_objc_string_object, objc_declare_alias, objc_declare_class, objc_declare_protocols, objc_comptypes, objc_check_decl, build_encode_expr): Remove prototypes. (imp_count, cat_count): Make GGC-aware. (OBJC_SET_TYPE_NAME): New macro. From-SVN: r87168
2004-09-08 02:49:44 +02:00
tree expr, decl, type;
Makefile.in (c-parse.o): Depend on $(C_COMMON_H). [gcc/ChangeLog] 2004-09-07 Ziemowit Laski <zlaski@apple.com> * Makefile.in (c-parse.o): Depend on $(C_COMMON_H). * c-parse.in: Include c-common.h instead of objc-act.h. (ivar_decl_list, ivar_decls, ivar_decl, ivars, ivar_declarator, myparms, myparm): Remove %type declarations. (methodtype, optparms, OBJC_TYPE_QUAL, objc_quals, objc_qual, objc_typename, objc_try_catch_stmt, optellipsis): Add %type declarations. (objc_inherit_code, objc_public_flag): Remove. (typespec_nonreserved_nonattr): Call objc_get_protocol_qualified_type() instead of get_static_reference() and get_protocol_reference(). (stmt_nocomp): Call grokparm() on @catch parameter. (objcdef): Move semantic action to objc_finish_implementation(). (classdef): Move semantic action to objc_start_class_interface(), objc_continue_interface(), objc_finish_interface(), objc_start_class_implementation(), objc_continue_implementation(), objc_start_category_interface() and objc_start_category_implementation(). (protocoldef): Move semantic actions to objc_start_protocol() and objc_finish_interface(). (ivar_decl_list): Remove nonterminal. (visibility_spec): Move semantic actions to objc_set_visibility(). (ivar_decls): Remove assignment to $$. (ivar_decl): Rephrase in terms of component_decl; call objc_add_instance_variable(). (ivars, ivar_declarator): Remove nonterminals. (opt_semi): New nonterminal. (methodtype): Remove semantic actions. (methoddef): Move semantic actions to objc_set_method_type(), objc_start_method_definition() and objc_finish_method_definition(). (methodproto): Move semantic actions to objc_set_method_type() and objc_add_method_declaration(). (methoddecl): Use objc_typename instead of typename; move semantic actions to objc_build_method_signature(). (optarglist, myxdecls, mydecl, myparms, myparm): Remove nonterminals. (optparmlist): Express in terms of optparms and optellipsis. (optparms, optellipsis, objc_qual, objc_quals, objc_typename): New nonterminals. (keyworddecl): Use objc_typename instead of typename. (rid_to_yy): Mark RID_IN, RID_OUT, RID_INOUT, RID_BYCOPY, RID_BYREF and RID_ONEWAY as returning OBJC_TYPE_QUAL to yyparse(). [gcc/objc/ChangeLog] 2004-09-07 Ziemowit Laski <zlaski@apple.com> * Make-lang.in (objc/objc-parse.o): Depend on $(C_COMMON_H) instead of objc/objc-act.h. (objc/objc-act.o): Depend on $(HASHTAB_H). * objc-act.c: Include hashtab.h; in ObjC++ mode, include cp-tree.h and objcp-decl.h instead of c-tree.h. (build_module_descriptor, get_class_ivars, synth_id_with_class_suffix, error_with_ivar, gen_method_decl, gen_declaration, setup_string_decl, build_protocol_template): Adjust prototypes. (build_module_initializer_routine, start_class, continue_class, finish_class, start_method_def, objc_start_function, start_protocol, build_method_decl, objc_add_method, add_instance_variable, build_ivar_reference, is_ivar, is_private, get_super_receiver, build_selector_table_decl, objc_push_parm, objc_get_parm_info, gen_type_name, gen_type_name_0, start_var_decl, finish_var_decl, create_field_decl): New prototypes. (objc_expand_function_end, comp_method_with_proto, objc_expr_last, gen_declaration_1, gen_declarator, is_complex_decl, adorn_decl, define_decl, create_builtin_decl, gen_declspecs): Remove prototypes. (TYPE_ID): Rename to OBJECT_TYPEDEF_NAME. (CLASS_TYPEDEF_NAME): New. (TAG_EXECCLASS): Change from a global variable to a #define. (TAG_RETURN_STRUCT): Delete. (TAG_GNUINIT): New, holds '__objc_gnu_init' name. (objc_inherit_code, objc_public_flag): New, moved from c-parse.in. (string_descriptor): New struct. (string_htab): New hash table. (string_hash, string_eq): New prototypes. (generate_struct_by_value_array): Call create_field_decl() instead of create_builtin_decl(). (objc_init): Do not initialize objc_ellipsis_node or TAG_EXECCLASS; In ObjC++ mode, call cxx_init() instead of c_objc_common_init(). (objc_finish_file): In ObjC++, call instantiate_pending_templates() and cp_finish_file(). (define_decl, get_static_reference, get_protocol_reference, create_builtin_decl): Remove functions. (objc_start_class_interface, objc_start_category_interface, objc_start_protocol, objc_continue_interface, objc_finish_interface, objc_start_class_implementation, objc_start_category_implementation, objc_continue_implementation, objc_finish_implementation, objc_set_visibility, objc_set_method_type, objc_build_method_signature, objc_add_method_declaration, objc_start_method_definition, objc_add_instance_variable, objc_get_protocol_qualified_type, create_field_decl, start_var_decl, finish_var_decl): New functions. (setup_string_decl): Simplify since it is only called once. (synth_module_prologue): Call build_class_template(); predefine 'id' and 'Class' as typedefs; rename 'temp_type' to 'type'; disable debug hooks for duration of function; fix GNU runtime messenger signatures to correspond to reality; forward-declare '__objc_exec_class' for the GNU runtime; call build_selector_table_decl(); in ObjC++ mode, generate 'extern "C" { ... }' wrappers around synthesized declarations; call build_protocol_template() and build_category_template(). (string_hash, string_eq): New functions. (objc_build_string_object): Check metaclass correctness only once; store string literals in hash table. (objc_build_constructor): Do not convert initializer elements; adjust for ObjC++ impedance mismatch. (build_objc_symtab_template): Call create_field_decl() instead of create_builtin_decl(). (init_objc_symtab): Add missing conversion to initializer element. (build_metadata_decl): Call start_var_decl() instead of define_decl(). (generate_objc_symtab_decl): Do not call build_category_template(); call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(). (build_module_descriptor): Call create_field_decl() instead of grokfield(); call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(); always mark module descriptor as used; move GNU runtime-specific functionality to build_module_initializer_routine(). (build_module_initializer_routine): New function, broken off of build_module_descriptor(). (objc_static_init_needed_p, objc_generate_static_init_call): New functions. (generate_static_references, generate_strings, build_selector_translation_table, generate_descriptor_table, generate_ivars_list, generate_dispatch_table, generate_category): Call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(); build a type directly instead of via groktypename(). (build_selector_reference_decl, build_selector_table_decl, build_class_reference_decl, build_protocol_reference, generate_objc_image_info): Call start_var_decl() instead of build_decl(). (build_selector_reference): For GNU runtime, do not call build_selector_reference_decl(). (build_selector, build_typed_selector_reference): Always convert result to the selector type. (add_objc_string): Cast return value to 'char *'. (build_method_prototype_template, build_selector_template, build_method_template): Use actual selector type for fields pointing to selectors. (finish_objc): For GNU runtime, call build_module_initializer_routine() after build_module_descriptor(). (generate_protocol_list, generate_shared_structures): Call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(); build a type directly instead of via groktypename(). (synth_id_with_class_suffix): Return a string. (get_arg_type_list): For instance methods, use the instance type for 'self'; do not call groktypename_in_parm_context(). (build_objc_string_decl): Squash redeclaration errors in ObjC++. (objc_is_class_name): Use OBJC_TYPE_NAME instead of TYPE_NAME; handle RECORD_TYPEs in ObjC as well as ObjC++. (objc_is_id): New function. (objc_is_object_ptr): Return the canonical type node. (objc_get_class_ivars): Simplify using get_class_ivars(). (get_class_ivars): Remove second parameter; create a fresh copy of the ivar list for each call; do not check for existence of super class. (objc_eh_runtime_type): Mark #ifndef OBJCPLUS. (objc_init_exceptions): When using SJLJ-style exceptions, require the use of '-fobjc-exceptions' flag; do not require it for DWARF-style exceptions. (objc_build_exc_ptr, next_sjlj_build_try_catch_finally): Use objc_object_type instead of objc_id_type. (objc_begin_catch_clause): Convert the incoming PARM_DECL into a VAR_DECL before placing it in the appropriate scope; do not call define_decl(); adjust call to c_begin_compound_stmt(); use objc_object_type instead of objc_id_type. (build_next_objc_exception_stuff): Call create_field_decl() instead of create_builtin_decl(); construct type directly instead of calling groktypename(); use OBJC_VOID_AT_END to mark end of function parameters. (build_private_template): Adjust call to get_class_ivars(); build a type directly instead of via groktypename(). (build_protocol_template, build_method_prototype_list_template, build_method_prototype_template, build_category_template, build_selector_template, build_class_template, build_super_template, build_ivar_template, build_ivar_list_template, build_method_list_template, build_method_template): Call create_field_decl() instead of grokfield(). (objc_method_parm_type): Do not call groktypename(). (generate_descriptor_table): Call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(). (generate_method_descriptors, build_protocol_initializer, generate_dispatch_tables, build_category_initializer, build_shared_structure_initializer): Do not call groktypename(). (generate_protocols): Call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(); do not call groktypename(). (error_with_ivar): Remove last parameter. (check_ivars): Do not iterate ovar CLASS_RAW_IVARS lists in addition to CLASS_IVARS lists; adjust calls to error_with_ivar(). (generate_ivar_lists): Convert one of the initializer elements; do not call groktypename(). (get_arg_type_list, start_method_def, gen_method_def): Account for new representation of variable arguments and '...' in Objective-C methods; add Objective-C++ impedance matching code. (is_objc_type_qualifier): Remove function. (adjust_type_for_id_default): Simplify; there is no longer a need to wade through declspecs. (lookup_interface, start_class, continue_class, finish_class, start_method_def, start_protocol, build_method_decl, objc_add_method, add_instance_variable, build_ivar_reference, is_ivar, is_private, get_super_receiver, objc_build_finally_epilogue): Make into static functions. (receiver_is_class_object): Use new IS_CLASS() macro. (objc_build_message_expr): Tweak ObjC++ message argument handling; call objc_finish_message_expr() instead of finish_message_expr(). (finish_message_expr): Rename to objc_finish_message_expr(); use OBJC_TYPE_NAME and OBJC_SET_TYPE_NAME macros instead of TYPE_NAME. call gen_type_name() instead of gen_declaration(); call objc_is_id() instead of using IS_ID and IS_CLASS; Use objc_class_name instead of calling get_identifier("Class"); handle CONVERT_EXPRs in receiver. (build_objc_method_call, warn_with_method): Do not call groktypename(). (build_ivar_reference): Call convert() instead of clobbering in a type. (hash_init): Initialize string_htab hash table. (add_instance_variable): Simplify parameter list; do not call grokfield(); do not populate CLASS_IVARS list. (start_class): Check for the existence of super class, if one was specified. (continue_class): Use CLASS_RAW_IVARS rather than CLASS_IVARS; do not call build_class_template(); adjust call to get_class_ivars(); call build_decl(), pushdecl() and finish_decl() instead of define_decl(). (finish_class): Call build_decl(), pushdecl() and finish_decl() instead of define_decl(). (add_protocols): Use PROTOCOL_BINFO_ELTS for the tree vector size. (start_protocol): Do not call build_protocol_template(); use PROTOCOL_BINFO_ELTS for the tree vector size. (encode_type_qualifiers): Do not handle the 'const' qualifier here. (encode_pointer): Encode 'const char *' as 'r*', for backwards compatibility. (encode_array): Use HOST_WIDE_INT_PRINT_DEC instead of "%ld". (encode_type): Handle the 'const' qualifier here. (objc_parmlist): New global variable, sued by objc_push_parm and objc_get_parm_info(). (objc_push_parm, objc_get_parm_info): New functions. (objc_expr_last): Remove function. (synth_self_and_ucmd_args): For instance methods, use the instance type for 'self'; call objc_push_parm() instead of push_parm_decl(). (start_method_def): Do not call push_scope(), declare_parm_level(), pop_scope(), push_parm_decl(), store_parm_decls() or objc_expr_last(); just use objc_push_parm() and objc_get_parm_info(). (comp_method_with_proto): Remove function. (objc_types_are_equivalent): Strip away indirections before comparing underlying types. (comp_proto_with_proto): Do not call groktypename(); types are no longer in raw declspec format. (objc_start_function): New function. (really_start_method): Call comp_proto_with_proto() instead of comp_method_with_proto(); call objc_start_function() instead of hand-crafting a function declarator. (continue_method_def, objc_expand_function_end): Remove functions. (get_super_receiver): Call objc_get_current_scope() instead of get_current_scope(); reference 'super_class' field (instead of 'class'). (finish_method_def): Rename to objc_finish_method_definition() and add a function decl parameter; move method encoding call from objc_expand_function_end(). (is_complex_decl, adorn_decl, gen_declarator, gen_declspecs, gen_declaration_1): Remove functions. (tmpbuf, RAW_DECLSPEC): Remove. (gen_declaration): Remove second parameter; simplify to deal with TYPE_P nodes instead of raw declspecs. (gen_type_name, gen_type_name_0): New functions. (gen_method_decl): Remove second parameter; call gen_type_name() instead of gen_declaration_1(). (dump_interface): Adjust calls to gen_declaration() and gen_method_decl(); do not allocate a separate string buffer. (init_objc): Allocate a larger string buffer to accommodate dump_interface(); adjust call to build_module_descriptor(); add call to build_module_initializer_routine() for the GNU runtime. (generate_classref_translation_entry): Do not call start_decl(); call finish_var_decl() instead of finish_decl(); call convert() instead of build_c_cast(). * objc-act.h (CLASS_OWN_IVARS): Remove accessor. (CLASS_BINFO_ELTS): Reduce from 6 to 5, now that CLASS_OWN_IVARS is gone. (OCTI_GNU_INIT_DECL, GNU_INIT_decl): New. (OCTI_ELLIPSIS_NODE, objc_ellipsis_node): Remove. (OCTI_ID_ID, id_type, objc_id_id): Rename to OCTI_ID_NAME, objc_object_type and objc_object_name, respectively. (OCTI_CLS_REF, OCTI_CLASS_NAME, objc_class_reference, objc_class_name): New. (IS_CLASS): New macro. (IS_ID, IS_SUPER): Robustify. (OCTI_EXECCLASS_DECL, execclass_decl): New. (finish_file, start_class, continue_class, finish_class, start_method_def, continue_method_def, finish_method_def, start_protocol, finish_protocol, objc_build_throw_stmt, objc_build_try_catch_finally_stmt, objc_build_synchronized_prologue, objc_build_synchronized_epilogue, objc_build_try_prologue, objc_build_try_epilogue, objc_build_catch_stmt, objc_build_catch_epilogue, objc_build_finally_prologue, objc_build_finally_epilogue, is_ivar, is_private, is_public, add_instance_variable, objc_add_method, get_super_receiver, objc_clear_super_receiver, get_class_ivars_from_name, get_class_reference, get_static_reference, get_object_reference, build_message_expr, finish_message_expr, build_selector_expr, build_ivar_reference, build_keyword_decl, build_method_decl, build_protocol_expr, build_objc_string_object, objc_declare_alias, objc_declare_class, objc_declare_protocols, objc_comptypes, objc_check_decl, build_encode_expr): Remove prototypes. (imp_count, cat_count): Make GGC-aware. (OBJC_SET_TYPE_NAME): New macro. From-SVN: r87168
2004-09-08 02:49:44 +02:00
decl = TREE_PURPOSE (chain);
type = TREE_TYPE (decl);
expr = add_objc_string (TREE_VALUE (chain), class_names);
Makefile.in (c-parse.o): Depend on $(C_COMMON_H). [gcc/ChangeLog] 2004-09-07 Ziemowit Laski <zlaski@apple.com> * Makefile.in (c-parse.o): Depend on $(C_COMMON_H). * c-parse.in: Include c-common.h instead of objc-act.h. (ivar_decl_list, ivar_decls, ivar_decl, ivars, ivar_declarator, myparms, myparm): Remove %type declarations. (methodtype, optparms, OBJC_TYPE_QUAL, objc_quals, objc_qual, objc_typename, objc_try_catch_stmt, optellipsis): Add %type declarations. (objc_inherit_code, objc_public_flag): Remove. (typespec_nonreserved_nonattr): Call objc_get_protocol_qualified_type() instead of get_static_reference() and get_protocol_reference(). (stmt_nocomp): Call grokparm() on @catch parameter. (objcdef): Move semantic action to objc_finish_implementation(). (classdef): Move semantic action to objc_start_class_interface(), objc_continue_interface(), objc_finish_interface(), objc_start_class_implementation(), objc_continue_implementation(), objc_start_category_interface() and objc_start_category_implementation(). (protocoldef): Move semantic actions to objc_start_protocol() and objc_finish_interface(). (ivar_decl_list): Remove nonterminal. (visibility_spec): Move semantic actions to objc_set_visibility(). (ivar_decls): Remove assignment to $$. (ivar_decl): Rephrase in terms of component_decl; call objc_add_instance_variable(). (ivars, ivar_declarator): Remove nonterminals. (opt_semi): New nonterminal. (methodtype): Remove semantic actions. (methoddef): Move semantic actions to objc_set_method_type(), objc_start_method_definition() and objc_finish_method_definition(). (methodproto): Move semantic actions to objc_set_method_type() and objc_add_method_declaration(). (methoddecl): Use objc_typename instead of typename; move semantic actions to objc_build_method_signature(). (optarglist, myxdecls, mydecl, myparms, myparm): Remove nonterminals. (optparmlist): Express in terms of optparms and optellipsis. (optparms, optellipsis, objc_qual, objc_quals, objc_typename): New nonterminals. (keyworddecl): Use objc_typename instead of typename. (rid_to_yy): Mark RID_IN, RID_OUT, RID_INOUT, RID_BYCOPY, RID_BYREF and RID_ONEWAY as returning OBJC_TYPE_QUAL to yyparse(). [gcc/objc/ChangeLog] 2004-09-07 Ziemowit Laski <zlaski@apple.com> * Make-lang.in (objc/objc-parse.o): Depend on $(C_COMMON_H) instead of objc/objc-act.h. (objc/objc-act.o): Depend on $(HASHTAB_H). * objc-act.c: Include hashtab.h; in ObjC++ mode, include cp-tree.h and objcp-decl.h instead of c-tree.h. (build_module_descriptor, get_class_ivars, synth_id_with_class_suffix, error_with_ivar, gen_method_decl, gen_declaration, setup_string_decl, build_protocol_template): Adjust prototypes. (build_module_initializer_routine, start_class, continue_class, finish_class, start_method_def, objc_start_function, start_protocol, build_method_decl, objc_add_method, add_instance_variable, build_ivar_reference, is_ivar, is_private, get_super_receiver, build_selector_table_decl, objc_push_parm, objc_get_parm_info, gen_type_name, gen_type_name_0, start_var_decl, finish_var_decl, create_field_decl): New prototypes. (objc_expand_function_end, comp_method_with_proto, objc_expr_last, gen_declaration_1, gen_declarator, is_complex_decl, adorn_decl, define_decl, create_builtin_decl, gen_declspecs): Remove prototypes. (TYPE_ID): Rename to OBJECT_TYPEDEF_NAME. (CLASS_TYPEDEF_NAME): New. (TAG_EXECCLASS): Change from a global variable to a #define. (TAG_RETURN_STRUCT): Delete. (TAG_GNUINIT): New, holds '__objc_gnu_init' name. (objc_inherit_code, objc_public_flag): New, moved from c-parse.in. (string_descriptor): New struct. (string_htab): New hash table. (string_hash, string_eq): New prototypes. (generate_struct_by_value_array): Call create_field_decl() instead of create_builtin_decl(). (objc_init): Do not initialize objc_ellipsis_node or TAG_EXECCLASS; In ObjC++ mode, call cxx_init() instead of c_objc_common_init(). (objc_finish_file): In ObjC++, call instantiate_pending_templates() and cp_finish_file(). (define_decl, get_static_reference, get_protocol_reference, create_builtin_decl): Remove functions. (objc_start_class_interface, objc_start_category_interface, objc_start_protocol, objc_continue_interface, objc_finish_interface, objc_start_class_implementation, objc_start_category_implementation, objc_continue_implementation, objc_finish_implementation, objc_set_visibility, objc_set_method_type, objc_build_method_signature, objc_add_method_declaration, objc_start_method_definition, objc_add_instance_variable, objc_get_protocol_qualified_type, create_field_decl, start_var_decl, finish_var_decl): New functions. (setup_string_decl): Simplify since it is only called once. (synth_module_prologue): Call build_class_template(); predefine 'id' and 'Class' as typedefs; rename 'temp_type' to 'type'; disable debug hooks for duration of function; fix GNU runtime messenger signatures to correspond to reality; forward-declare '__objc_exec_class' for the GNU runtime; call build_selector_table_decl(); in ObjC++ mode, generate 'extern "C" { ... }' wrappers around synthesized declarations; call build_protocol_template() and build_category_template(). (string_hash, string_eq): New functions. (objc_build_string_object): Check metaclass correctness only once; store string literals in hash table. (objc_build_constructor): Do not convert initializer elements; adjust for ObjC++ impedance mismatch. (build_objc_symtab_template): Call create_field_decl() instead of create_builtin_decl(). (init_objc_symtab): Add missing conversion to initializer element. (build_metadata_decl): Call start_var_decl() instead of define_decl(). (generate_objc_symtab_decl): Do not call build_category_template(); call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(). (build_module_descriptor): Call create_field_decl() instead of grokfield(); call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(); always mark module descriptor as used; move GNU runtime-specific functionality to build_module_initializer_routine(). (build_module_initializer_routine): New function, broken off of build_module_descriptor(). (objc_static_init_needed_p, objc_generate_static_init_call): New functions. (generate_static_references, generate_strings, build_selector_translation_table, generate_descriptor_table, generate_ivars_list, generate_dispatch_table, generate_category): Call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(); build a type directly instead of via groktypename(). (build_selector_reference_decl, build_selector_table_decl, build_class_reference_decl, build_protocol_reference, generate_objc_image_info): Call start_var_decl() instead of build_decl(). (build_selector_reference): For GNU runtime, do not call build_selector_reference_decl(). (build_selector, build_typed_selector_reference): Always convert result to the selector type. (add_objc_string): Cast return value to 'char *'. (build_method_prototype_template, build_selector_template, build_method_template): Use actual selector type for fields pointing to selectors. (finish_objc): For GNU runtime, call build_module_initializer_routine() after build_module_descriptor(). (generate_protocol_list, generate_shared_structures): Call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(); build a type directly instead of via groktypename(). (synth_id_with_class_suffix): Return a string. (get_arg_type_list): For instance methods, use the instance type for 'self'; do not call groktypename_in_parm_context(). (build_objc_string_decl): Squash redeclaration errors in ObjC++. (objc_is_class_name): Use OBJC_TYPE_NAME instead of TYPE_NAME; handle RECORD_TYPEs in ObjC as well as ObjC++. (objc_is_id): New function. (objc_is_object_ptr): Return the canonical type node. (objc_get_class_ivars): Simplify using get_class_ivars(). (get_class_ivars): Remove second parameter; create a fresh copy of the ivar list for each call; do not check for existence of super class. (objc_eh_runtime_type): Mark #ifndef OBJCPLUS. (objc_init_exceptions): When using SJLJ-style exceptions, require the use of '-fobjc-exceptions' flag; do not require it for DWARF-style exceptions. (objc_build_exc_ptr, next_sjlj_build_try_catch_finally): Use objc_object_type instead of objc_id_type. (objc_begin_catch_clause): Convert the incoming PARM_DECL into a VAR_DECL before placing it in the appropriate scope; do not call define_decl(); adjust call to c_begin_compound_stmt(); use objc_object_type instead of objc_id_type. (build_next_objc_exception_stuff): Call create_field_decl() instead of create_builtin_decl(); construct type directly instead of calling groktypename(); use OBJC_VOID_AT_END to mark end of function parameters. (build_private_template): Adjust call to get_class_ivars(); build a type directly instead of via groktypename(). (build_protocol_template, build_method_prototype_list_template, build_method_prototype_template, build_category_template, build_selector_template, build_class_template, build_super_template, build_ivar_template, build_ivar_list_template, build_method_list_template, build_method_template): Call create_field_decl() instead of grokfield(). (objc_method_parm_type): Do not call groktypename(). (generate_descriptor_table): Call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(). (generate_method_descriptors, build_protocol_initializer, generate_dispatch_tables, build_category_initializer, build_shared_structure_initializer): Do not call groktypename(). (generate_protocols): Call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(); do not call groktypename(). (error_with_ivar): Remove last parameter. (check_ivars): Do not iterate ovar CLASS_RAW_IVARS lists in addition to CLASS_IVARS lists; adjust calls to error_with_ivar(). (generate_ivar_lists): Convert one of the initializer elements; do not call groktypename(). (get_arg_type_list, start_method_def, gen_method_def): Account for new representation of variable arguments and '...' in Objective-C methods; add Objective-C++ impedance matching code. (is_objc_type_qualifier): Remove function. (adjust_type_for_id_default): Simplify; there is no longer a need to wade through declspecs. (lookup_interface, start_class, continue_class, finish_class, start_method_def, start_protocol, build_method_decl, objc_add_method, add_instance_variable, build_ivar_reference, is_ivar, is_private, get_super_receiver, objc_build_finally_epilogue): Make into static functions. (receiver_is_class_object): Use new IS_CLASS() macro. (objc_build_message_expr): Tweak ObjC++ message argument handling; call objc_finish_message_expr() instead of finish_message_expr(). (finish_message_expr): Rename to objc_finish_message_expr(); use OBJC_TYPE_NAME and OBJC_SET_TYPE_NAME macros instead of TYPE_NAME. call gen_type_name() instead of gen_declaration(); call objc_is_id() instead of using IS_ID and IS_CLASS; Use objc_class_name instead of calling get_identifier("Class"); handle CONVERT_EXPRs in receiver. (build_objc_method_call, warn_with_method): Do not call groktypename(). (build_ivar_reference): Call convert() instead of clobbering in a type. (hash_init): Initialize string_htab hash table. (add_instance_variable): Simplify parameter list; do not call grokfield(); do not populate CLASS_IVARS list. (start_class): Check for the existence of super class, if one was specified. (continue_class): Use CLASS_RAW_IVARS rather than CLASS_IVARS; do not call build_class_template(); adjust call to get_class_ivars(); call build_decl(), pushdecl() and finish_decl() instead of define_decl(). (finish_class): Call build_decl(), pushdecl() and finish_decl() instead of define_decl(). (add_protocols): Use PROTOCOL_BINFO_ELTS for the tree vector size. (start_protocol): Do not call build_protocol_template(); use PROTOCOL_BINFO_ELTS for the tree vector size. (encode_type_qualifiers): Do not handle the 'const' qualifier here. (encode_pointer): Encode 'const char *' as 'r*', for backwards compatibility. (encode_array): Use HOST_WIDE_INT_PRINT_DEC instead of "%ld". (encode_type): Handle the 'const' qualifier here. (objc_parmlist): New global variable, sued by objc_push_parm and objc_get_parm_info(). (objc_push_parm, objc_get_parm_info): New functions. (objc_expr_last): Remove function. (synth_self_and_ucmd_args): For instance methods, use the instance type for 'self'; call objc_push_parm() instead of push_parm_decl(). (start_method_def): Do not call push_scope(), declare_parm_level(), pop_scope(), push_parm_decl(), store_parm_decls() or objc_expr_last(); just use objc_push_parm() and objc_get_parm_info(). (comp_method_with_proto): Remove function. (objc_types_are_equivalent): Strip away indirections before comparing underlying types. (comp_proto_with_proto): Do not call groktypename(); types are no longer in raw declspec format. (objc_start_function): New function. (really_start_method): Call comp_proto_with_proto() instead of comp_method_with_proto(); call objc_start_function() instead of hand-crafting a function declarator. (continue_method_def, objc_expand_function_end): Remove functions. (get_super_receiver): Call objc_get_current_scope() instead of get_current_scope(); reference 'super_class' field (instead of 'class'). (finish_method_def): Rename to objc_finish_method_definition() and add a function decl parameter; move method encoding call from objc_expand_function_end(). (is_complex_decl, adorn_decl, gen_declarator, gen_declspecs, gen_declaration_1): Remove functions. (tmpbuf, RAW_DECLSPEC): Remove. (gen_declaration): Remove second parameter; simplify to deal with TYPE_P nodes instead of raw declspecs. (gen_type_name, gen_type_name_0): New functions. (gen_method_decl): Remove second parameter; call gen_type_name() instead of gen_declaration_1(). (dump_interface): Adjust calls to gen_declaration() and gen_method_decl(); do not allocate a separate string buffer. (init_objc): Allocate a larger string buffer to accommodate dump_interface(); adjust call to build_module_descriptor(); add call to build_module_initializer_routine() for the GNU runtime. (generate_classref_translation_entry): Do not call start_decl(); call finish_var_decl() instead of finish_decl(); call convert() instead of build_c_cast(). * objc-act.h (CLASS_OWN_IVARS): Remove accessor. (CLASS_BINFO_ELTS): Reduce from 6 to 5, now that CLASS_OWN_IVARS is gone. (OCTI_GNU_INIT_DECL, GNU_INIT_decl): New. (OCTI_ELLIPSIS_NODE, objc_ellipsis_node): Remove. (OCTI_ID_ID, id_type, objc_id_id): Rename to OCTI_ID_NAME, objc_object_type and objc_object_name, respectively. (OCTI_CLS_REF, OCTI_CLASS_NAME, objc_class_reference, objc_class_name): New. (IS_CLASS): New macro. (IS_ID, IS_SUPER): Robustify. (OCTI_EXECCLASS_DECL, execclass_decl): New. (finish_file, start_class, continue_class, finish_class, start_method_def, continue_method_def, finish_method_def, start_protocol, finish_protocol, objc_build_throw_stmt, objc_build_try_catch_finally_stmt, objc_build_synchronized_prologue, objc_build_synchronized_epilogue, objc_build_try_prologue, objc_build_try_epilogue, objc_build_catch_stmt, objc_build_catch_epilogue, objc_build_finally_prologue, objc_build_finally_epilogue, is_ivar, is_private, is_public, add_instance_variable, objc_add_method, get_super_receiver, objc_clear_super_receiver, get_class_ivars_from_name, get_class_reference, get_static_reference, get_object_reference, build_message_expr, finish_message_expr, build_selector_expr, build_ivar_reference, build_keyword_decl, build_method_decl, build_protocol_expr, build_objc_string_object, objc_declare_alias, objc_declare_class, objc_declare_protocols, objc_comptypes, objc_check_decl, build_encode_expr): Remove prototypes. (imp_count, cat_count): Make GGC-aware. (OBJC_SET_TYPE_NAME): New macro. From-SVN: r87168
2004-09-08 02:49:44 +02:00
expr = convert (type, expr); /* cast! */
Makefile.in (c-parse.o): Depend on $(C_COMMON_H). [gcc/ChangeLog] 2004-09-07 Ziemowit Laski <zlaski@apple.com> * Makefile.in (c-parse.o): Depend on $(C_COMMON_H). * c-parse.in: Include c-common.h instead of objc-act.h. (ivar_decl_list, ivar_decls, ivar_decl, ivars, ivar_declarator, myparms, myparm): Remove %type declarations. (methodtype, optparms, OBJC_TYPE_QUAL, objc_quals, objc_qual, objc_typename, objc_try_catch_stmt, optellipsis): Add %type declarations. (objc_inherit_code, objc_public_flag): Remove. (typespec_nonreserved_nonattr): Call objc_get_protocol_qualified_type() instead of get_static_reference() and get_protocol_reference(). (stmt_nocomp): Call grokparm() on @catch parameter. (objcdef): Move semantic action to objc_finish_implementation(). (classdef): Move semantic action to objc_start_class_interface(), objc_continue_interface(), objc_finish_interface(), objc_start_class_implementation(), objc_continue_implementation(), objc_start_category_interface() and objc_start_category_implementation(). (protocoldef): Move semantic actions to objc_start_protocol() and objc_finish_interface(). (ivar_decl_list): Remove nonterminal. (visibility_spec): Move semantic actions to objc_set_visibility(). (ivar_decls): Remove assignment to $$. (ivar_decl): Rephrase in terms of component_decl; call objc_add_instance_variable(). (ivars, ivar_declarator): Remove nonterminals. (opt_semi): New nonterminal. (methodtype): Remove semantic actions. (methoddef): Move semantic actions to objc_set_method_type(), objc_start_method_definition() and objc_finish_method_definition(). (methodproto): Move semantic actions to objc_set_method_type() and objc_add_method_declaration(). (methoddecl): Use objc_typename instead of typename; move semantic actions to objc_build_method_signature(). (optarglist, myxdecls, mydecl, myparms, myparm): Remove nonterminals. (optparmlist): Express in terms of optparms and optellipsis. (optparms, optellipsis, objc_qual, objc_quals, objc_typename): New nonterminals. (keyworddecl): Use objc_typename instead of typename. (rid_to_yy): Mark RID_IN, RID_OUT, RID_INOUT, RID_BYCOPY, RID_BYREF and RID_ONEWAY as returning OBJC_TYPE_QUAL to yyparse(). [gcc/objc/ChangeLog] 2004-09-07 Ziemowit Laski <zlaski@apple.com> * Make-lang.in (objc/objc-parse.o): Depend on $(C_COMMON_H) instead of objc/objc-act.h. (objc/objc-act.o): Depend on $(HASHTAB_H). * objc-act.c: Include hashtab.h; in ObjC++ mode, include cp-tree.h and objcp-decl.h instead of c-tree.h. (build_module_descriptor, get_class_ivars, synth_id_with_class_suffix, error_with_ivar, gen_method_decl, gen_declaration, setup_string_decl, build_protocol_template): Adjust prototypes. (build_module_initializer_routine, start_class, continue_class, finish_class, start_method_def, objc_start_function, start_protocol, build_method_decl, objc_add_method, add_instance_variable, build_ivar_reference, is_ivar, is_private, get_super_receiver, build_selector_table_decl, objc_push_parm, objc_get_parm_info, gen_type_name, gen_type_name_0, start_var_decl, finish_var_decl, create_field_decl): New prototypes. (objc_expand_function_end, comp_method_with_proto, objc_expr_last, gen_declaration_1, gen_declarator, is_complex_decl, adorn_decl, define_decl, create_builtin_decl, gen_declspecs): Remove prototypes. (TYPE_ID): Rename to OBJECT_TYPEDEF_NAME. (CLASS_TYPEDEF_NAME): New. (TAG_EXECCLASS): Change from a global variable to a #define. (TAG_RETURN_STRUCT): Delete. (TAG_GNUINIT): New, holds '__objc_gnu_init' name. (objc_inherit_code, objc_public_flag): New, moved from c-parse.in. (string_descriptor): New struct. (string_htab): New hash table. (string_hash, string_eq): New prototypes. (generate_struct_by_value_array): Call create_field_decl() instead of create_builtin_decl(). (objc_init): Do not initialize objc_ellipsis_node or TAG_EXECCLASS; In ObjC++ mode, call cxx_init() instead of c_objc_common_init(). (objc_finish_file): In ObjC++, call instantiate_pending_templates() and cp_finish_file(). (define_decl, get_static_reference, get_protocol_reference, create_builtin_decl): Remove functions. (objc_start_class_interface, objc_start_category_interface, objc_start_protocol, objc_continue_interface, objc_finish_interface, objc_start_class_implementation, objc_start_category_implementation, objc_continue_implementation, objc_finish_implementation, objc_set_visibility, objc_set_method_type, objc_build_method_signature, objc_add_method_declaration, objc_start_method_definition, objc_add_instance_variable, objc_get_protocol_qualified_type, create_field_decl, start_var_decl, finish_var_decl): New functions. (setup_string_decl): Simplify since it is only called once. (synth_module_prologue): Call build_class_template(); predefine 'id' and 'Class' as typedefs; rename 'temp_type' to 'type'; disable debug hooks for duration of function; fix GNU runtime messenger signatures to correspond to reality; forward-declare '__objc_exec_class' for the GNU runtime; call build_selector_table_decl(); in ObjC++ mode, generate 'extern "C" { ... }' wrappers around synthesized declarations; call build_protocol_template() and build_category_template(). (string_hash, string_eq): New functions. (objc_build_string_object): Check metaclass correctness only once; store string literals in hash table. (objc_build_constructor): Do not convert initializer elements; adjust for ObjC++ impedance mismatch. (build_objc_symtab_template): Call create_field_decl() instead of create_builtin_decl(). (init_objc_symtab): Add missing conversion to initializer element. (build_metadata_decl): Call start_var_decl() instead of define_decl(). (generate_objc_symtab_decl): Do not call build_category_template(); call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(). (build_module_descriptor): Call create_field_decl() instead of grokfield(); call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(); always mark module descriptor as used; move GNU runtime-specific functionality to build_module_initializer_routine(). (build_module_initializer_routine): New function, broken off of build_module_descriptor(). (objc_static_init_needed_p, objc_generate_static_init_call): New functions. (generate_static_references, generate_strings, build_selector_translation_table, generate_descriptor_table, generate_ivars_list, generate_dispatch_table, generate_category): Call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(); build a type directly instead of via groktypename(). (build_selector_reference_decl, build_selector_table_decl, build_class_reference_decl, build_protocol_reference, generate_objc_image_info): Call start_var_decl() instead of build_decl(). (build_selector_reference): For GNU runtime, do not call build_selector_reference_decl(). (build_selector, build_typed_selector_reference): Always convert result to the selector type. (add_objc_string): Cast return value to 'char *'. (build_method_prototype_template, build_selector_template, build_method_template): Use actual selector type for fields pointing to selectors. (finish_objc): For GNU runtime, call build_module_initializer_routine() after build_module_descriptor(). (generate_protocol_list, generate_shared_structures): Call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(); build a type directly instead of via groktypename(). (synth_id_with_class_suffix): Return a string. (get_arg_type_list): For instance methods, use the instance type for 'self'; do not call groktypename_in_parm_context(). (build_objc_string_decl): Squash redeclaration errors in ObjC++. (objc_is_class_name): Use OBJC_TYPE_NAME instead of TYPE_NAME; handle RECORD_TYPEs in ObjC as well as ObjC++. (objc_is_id): New function. (objc_is_object_ptr): Return the canonical type node. (objc_get_class_ivars): Simplify using get_class_ivars(). (get_class_ivars): Remove second parameter; create a fresh copy of the ivar list for each call; do not check for existence of super class. (objc_eh_runtime_type): Mark #ifndef OBJCPLUS. (objc_init_exceptions): When using SJLJ-style exceptions, require the use of '-fobjc-exceptions' flag; do not require it for DWARF-style exceptions. (objc_build_exc_ptr, next_sjlj_build_try_catch_finally): Use objc_object_type instead of objc_id_type. (objc_begin_catch_clause): Convert the incoming PARM_DECL into a VAR_DECL before placing it in the appropriate scope; do not call define_decl(); adjust call to c_begin_compound_stmt(); use objc_object_type instead of objc_id_type. (build_next_objc_exception_stuff): Call create_field_decl() instead of create_builtin_decl(); construct type directly instead of calling groktypename(); use OBJC_VOID_AT_END to mark end of function parameters. (build_private_template): Adjust call to get_class_ivars(); build a type directly instead of via groktypename(). (build_protocol_template, build_method_prototype_list_template, build_method_prototype_template, build_category_template, build_selector_template, build_class_template, build_super_template, build_ivar_template, build_ivar_list_template, build_method_list_template, build_method_template): Call create_field_decl() instead of grokfield(). (objc_method_parm_type): Do not call groktypename(). (generate_descriptor_table): Call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(). (generate_method_descriptors, build_protocol_initializer, generate_dispatch_tables, build_category_initializer, build_shared_structure_initializer): Do not call groktypename(). (generate_protocols): Call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(); do not call groktypename(). (error_with_ivar): Remove last parameter. (check_ivars): Do not iterate ovar CLASS_RAW_IVARS lists in addition to CLASS_IVARS lists; adjust calls to error_with_ivar(). (generate_ivar_lists): Convert one of the initializer elements; do not call groktypename(). (get_arg_type_list, start_method_def, gen_method_def): Account for new representation of variable arguments and '...' in Objective-C methods; add Objective-C++ impedance matching code. (is_objc_type_qualifier): Remove function. (adjust_type_for_id_default): Simplify; there is no longer a need to wade through declspecs. (lookup_interface, start_class, continue_class, finish_class, start_method_def, start_protocol, build_method_decl, objc_add_method, add_instance_variable, build_ivar_reference, is_ivar, is_private, get_super_receiver, objc_build_finally_epilogue): Make into static functions. (receiver_is_class_object): Use new IS_CLASS() macro. (objc_build_message_expr): Tweak ObjC++ message argument handling; call objc_finish_message_expr() instead of finish_message_expr(). (finish_message_expr): Rename to objc_finish_message_expr(); use OBJC_TYPE_NAME and OBJC_SET_TYPE_NAME macros instead of TYPE_NAME. call gen_type_name() instead of gen_declaration(); call objc_is_id() instead of using IS_ID and IS_CLASS; Use objc_class_name instead of calling get_identifier("Class"); handle CONVERT_EXPRs in receiver. (build_objc_method_call, warn_with_method): Do not call groktypename(). (build_ivar_reference): Call convert() instead of clobbering in a type. (hash_init): Initialize string_htab hash table. (add_instance_variable): Simplify parameter list; do not call grokfield(); do not populate CLASS_IVARS list. (start_class): Check for the existence of super class, if one was specified. (continue_class): Use CLASS_RAW_IVARS rather than CLASS_IVARS; do not call build_class_template(); adjust call to get_class_ivars(); call build_decl(), pushdecl() and finish_decl() instead of define_decl(). (finish_class): Call build_decl(), pushdecl() and finish_decl() instead of define_decl(). (add_protocols): Use PROTOCOL_BINFO_ELTS for the tree vector size. (start_protocol): Do not call build_protocol_template(); use PROTOCOL_BINFO_ELTS for the tree vector size. (encode_type_qualifiers): Do not handle the 'const' qualifier here. (encode_pointer): Encode 'const char *' as 'r*', for backwards compatibility. (encode_array): Use HOST_WIDE_INT_PRINT_DEC instead of "%ld". (encode_type): Handle the 'const' qualifier here. (objc_parmlist): New global variable, sued by objc_push_parm and objc_get_parm_info(). (objc_push_parm, objc_get_parm_info): New functions. (objc_expr_last): Remove function. (synth_self_and_ucmd_args): For instance methods, use the instance type for 'self'; call objc_push_parm() instead of push_parm_decl(). (start_method_def): Do not call push_scope(), declare_parm_level(), pop_scope(), push_parm_decl(), store_parm_decls() or objc_expr_last(); just use objc_push_parm() and objc_get_parm_info(). (comp_method_with_proto): Remove function. (objc_types_are_equivalent): Strip away indirections before comparing underlying types. (comp_proto_with_proto): Do not call groktypename(); types are no longer in raw declspec format. (objc_start_function): New function. (really_start_method): Call comp_proto_with_proto() instead of comp_method_with_proto(); call objc_start_function() instead of hand-crafting a function declarator. (continue_method_def, objc_expand_function_end): Remove functions. (get_super_receiver): Call objc_get_current_scope() instead of get_current_scope(); reference 'super_class' field (instead of 'class'). (finish_method_def): Rename to objc_finish_method_definition() and add a function decl parameter; move method encoding call from objc_expand_function_end(). (is_complex_decl, adorn_decl, gen_declarator, gen_declspecs, gen_declaration_1): Remove functions. (tmpbuf, RAW_DECLSPEC): Remove. (gen_declaration): Remove second parameter; simplify to deal with TYPE_P nodes instead of raw declspecs. (gen_type_name, gen_type_name_0): New functions. (gen_method_decl): Remove second parameter; call gen_type_name() instead of gen_declaration_1(). (dump_interface): Adjust calls to gen_declaration() and gen_method_decl(); do not allocate a separate string buffer. (init_objc): Allocate a larger string buffer to accommodate dump_interface(); adjust call to build_module_descriptor(); add call to build_module_initializer_routine() for the GNU runtime. (generate_classref_translation_entry): Do not call start_decl(); call finish_var_decl() instead of finish_decl(); call convert() instead of build_c_cast(). * objc-act.h (CLASS_OWN_IVARS): Remove accessor. (CLASS_BINFO_ELTS): Reduce from 6 to 5, now that CLASS_OWN_IVARS is gone. (OCTI_GNU_INIT_DECL, GNU_INIT_decl): New. (OCTI_ELLIPSIS_NODE, objc_ellipsis_node): Remove. (OCTI_ID_ID, id_type, objc_id_id): Rename to OCTI_ID_NAME, objc_object_type and objc_object_name, respectively. (OCTI_CLS_REF, OCTI_CLASS_NAME, objc_class_reference, objc_class_name): New. (IS_CLASS): New macro. (IS_ID, IS_SUPER): Robustify. (OCTI_EXECCLASS_DECL, execclass_decl): New. (finish_file, start_class, continue_class, finish_class, start_method_def, continue_method_def, finish_method_def, start_protocol, finish_protocol, objc_build_throw_stmt, objc_build_try_catch_finally_stmt, objc_build_synchronized_prologue, objc_build_synchronized_epilogue, objc_build_try_prologue, objc_build_try_epilogue, objc_build_catch_stmt, objc_build_catch_epilogue, objc_build_finally_prologue, objc_build_finally_epilogue, is_ivar, is_private, is_public, add_instance_variable, objc_add_method, get_super_receiver, objc_clear_super_receiver, get_class_ivars_from_name, get_class_reference, get_static_reference, get_object_reference, build_message_expr, finish_message_expr, build_selector_expr, build_ivar_reference, build_keyword_decl, build_method_decl, build_protocol_expr, build_objc_string_object, objc_declare_alias, objc_declare_class, objc_declare_protocols, objc_comptypes, objc_check_decl, build_encode_expr): Remove prototypes. (imp_count, cat_count): Make GGC-aware. (OBJC_SET_TYPE_NAME): New macro. From-SVN: r87168
2004-09-08 02:49:44 +02:00
/* The decl that is the one that we
forward declared in build_class_reference. */
Makefile.in (c-parse.o): Depend on $(C_COMMON_H). [gcc/ChangeLog] 2004-09-07 Ziemowit Laski <zlaski@apple.com> * Makefile.in (c-parse.o): Depend on $(C_COMMON_H). * c-parse.in: Include c-common.h instead of objc-act.h. (ivar_decl_list, ivar_decls, ivar_decl, ivars, ivar_declarator, myparms, myparm): Remove %type declarations. (methodtype, optparms, OBJC_TYPE_QUAL, objc_quals, objc_qual, objc_typename, objc_try_catch_stmt, optellipsis): Add %type declarations. (objc_inherit_code, objc_public_flag): Remove. (typespec_nonreserved_nonattr): Call objc_get_protocol_qualified_type() instead of get_static_reference() and get_protocol_reference(). (stmt_nocomp): Call grokparm() on @catch parameter. (objcdef): Move semantic action to objc_finish_implementation(). (classdef): Move semantic action to objc_start_class_interface(), objc_continue_interface(), objc_finish_interface(), objc_start_class_implementation(), objc_continue_implementation(), objc_start_category_interface() and objc_start_category_implementation(). (protocoldef): Move semantic actions to objc_start_protocol() and objc_finish_interface(). (ivar_decl_list): Remove nonterminal. (visibility_spec): Move semantic actions to objc_set_visibility(). (ivar_decls): Remove assignment to $$. (ivar_decl): Rephrase in terms of component_decl; call objc_add_instance_variable(). (ivars, ivar_declarator): Remove nonterminals. (opt_semi): New nonterminal. (methodtype): Remove semantic actions. (methoddef): Move semantic actions to objc_set_method_type(), objc_start_method_definition() and objc_finish_method_definition(). (methodproto): Move semantic actions to objc_set_method_type() and objc_add_method_declaration(). (methoddecl): Use objc_typename instead of typename; move semantic actions to objc_build_method_signature(). (optarglist, myxdecls, mydecl, myparms, myparm): Remove nonterminals. (optparmlist): Express in terms of optparms and optellipsis. (optparms, optellipsis, objc_qual, objc_quals, objc_typename): New nonterminals. (keyworddecl): Use objc_typename instead of typename. (rid_to_yy): Mark RID_IN, RID_OUT, RID_INOUT, RID_BYCOPY, RID_BYREF and RID_ONEWAY as returning OBJC_TYPE_QUAL to yyparse(). [gcc/objc/ChangeLog] 2004-09-07 Ziemowit Laski <zlaski@apple.com> * Make-lang.in (objc/objc-parse.o): Depend on $(C_COMMON_H) instead of objc/objc-act.h. (objc/objc-act.o): Depend on $(HASHTAB_H). * objc-act.c: Include hashtab.h; in ObjC++ mode, include cp-tree.h and objcp-decl.h instead of c-tree.h. (build_module_descriptor, get_class_ivars, synth_id_with_class_suffix, error_with_ivar, gen_method_decl, gen_declaration, setup_string_decl, build_protocol_template): Adjust prototypes. (build_module_initializer_routine, start_class, continue_class, finish_class, start_method_def, objc_start_function, start_protocol, build_method_decl, objc_add_method, add_instance_variable, build_ivar_reference, is_ivar, is_private, get_super_receiver, build_selector_table_decl, objc_push_parm, objc_get_parm_info, gen_type_name, gen_type_name_0, start_var_decl, finish_var_decl, create_field_decl): New prototypes. (objc_expand_function_end, comp_method_with_proto, objc_expr_last, gen_declaration_1, gen_declarator, is_complex_decl, adorn_decl, define_decl, create_builtin_decl, gen_declspecs): Remove prototypes. (TYPE_ID): Rename to OBJECT_TYPEDEF_NAME. (CLASS_TYPEDEF_NAME): New. (TAG_EXECCLASS): Change from a global variable to a #define. (TAG_RETURN_STRUCT): Delete. (TAG_GNUINIT): New, holds '__objc_gnu_init' name. (objc_inherit_code, objc_public_flag): New, moved from c-parse.in. (string_descriptor): New struct. (string_htab): New hash table. (string_hash, string_eq): New prototypes. (generate_struct_by_value_array): Call create_field_decl() instead of create_builtin_decl(). (objc_init): Do not initialize objc_ellipsis_node or TAG_EXECCLASS; In ObjC++ mode, call cxx_init() instead of c_objc_common_init(). (objc_finish_file): In ObjC++, call instantiate_pending_templates() and cp_finish_file(). (define_decl, get_static_reference, get_protocol_reference, create_builtin_decl): Remove functions. (objc_start_class_interface, objc_start_category_interface, objc_start_protocol, objc_continue_interface, objc_finish_interface, objc_start_class_implementation, objc_start_category_implementation, objc_continue_implementation, objc_finish_implementation, objc_set_visibility, objc_set_method_type, objc_build_method_signature, objc_add_method_declaration, objc_start_method_definition, objc_add_instance_variable, objc_get_protocol_qualified_type, create_field_decl, start_var_decl, finish_var_decl): New functions. (setup_string_decl): Simplify since it is only called once. (synth_module_prologue): Call build_class_template(); predefine 'id' and 'Class' as typedefs; rename 'temp_type' to 'type'; disable debug hooks for duration of function; fix GNU runtime messenger signatures to correspond to reality; forward-declare '__objc_exec_class' for the GNU runtime; call build_selector_table_decl(); in ObjC++ mode, generate 'extern "C" { ... }' wrappers around synthesized declarations; call build_protocol_template() and build_category_template(). (string_hash, string_eq): New functions. (objc_build_string_object): Check metaclass correctness only once; store string literals in hash table. (objc_build_constructor): Do not convert initializer elements; adjust for ObjC++ impedance mismatch. (build_objc_symtab_template): Call create_field_decl() instead of create_builtin_decl(). (init_objc_symtab): Add missing conversion to initializer element. (build_metadata_decl): Call start_var_decl() instead of define_decl(). (generate_objc_symtab_decl): Do not call build_category_template(); call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(). (build_module_descriptor): Call create_field_decl() instead of grokfield(); call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(); always mark module descriptor as used; move GNU runtime-specific functionality to build_module_initializer_routine(). (build_module_initializer_routine): New function, broken off of build_module_descriptor(). (objc_static_init_needed_p, objc_generate_static_init_call): New functions. (generate_static_references, generate_strings, build_selector_translation_table, generate_descriptor_table, generate_ivars_list, generate_dispatch_table, generate_category): Call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(); build a type directly instead of via groktypename(). (build_selector_reference_decl, build_selector_table_decl, build_class_reference_decl, build_protocol_reference, generate_objc_image_info): Call start_var_decl() instead of build_decl(). (build_selector_reference): For GNU runtime, do not call build_selector_reference_decl(). (build_selector, build_typed_selector_reference): Always convert result to the selector type. (add_objc_string): Cast return value to 'char *'. (build_method_prototype_template, build_selector_template, build_method_template): Use actual selector type for fields pointing to selectors. (finish_objc): For GNU runtime, call build_module_initializer_routine() after build_module_descriptor(). (generate_protocol_list, generate_shared_structures): Call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(); build a type directly instead of via groktypename(). (synth_id_with_class_suffix): Return a string. (get_arg_type_list): For instance methods, use the instance type for 'self'; do not call groktypename_in_parm_context(). (build_objc_string_decl): Squash redeclaration errors in ObjC++. (objc_is_class_name): Use OBJC_TYPE_NAME instead of TYPE_NAME; handle RECORD_TYPEs in ObjC as well as ObjC++. (objc_is_id): New function. (objc_is_object_ptr): Return the canonical type node. (objc_get_class_ivars): Simplify using get_class_ivars(). (get_class_ivars): Remove second parameter; create a fresh copy of the ivar list for each call; do not check for existence of super class. (objc_eh_runtime_type): Mark #ifndef OBJCPLUS. (objc_init_exceptions): When using SJLJ-style exceptions, require the use of '-fobjc-exceptions' flag; do not require it for DWARF-style exceptions. (objc_build_exc_ptr, next_sjlj_build_try_catch_finally): Use objc_object_type instead of objc_id_type. (objc_begin_catch_clause): Convert the incoming PARM_DECL into a VAR_DECL before placing it in the appropriate scope; do not call define_decl(); adjust call to c_begin_compound_stmt(); use objc_object_type instead of objc_id_type. (build_next_objc_exception_stuff): Call create_field_decl() instead of create_builtin_decl(); construct type directly instead of calling groktypename(); use OBJC_VOID_AT_END to mark end of function parameters. (build_private_template): Adjust call to get_class_ivars(); build a type directly instead of via groktypename(). (build_protocol_template, build_method_prototype_list_template, build_method_prototype_template, build_category_template, build_selector_template, build_class_template, build_super_template, build_ivar_template, build_ivar_list_template, build_method_list_template, build_method_template): Call create_field_decl() instead of grokfield(). (objc_method_parm_type): Do not call groktypename(). (generate_descriptor_table): Call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(). (generate_method_descriptors, build_protocol_initializer, generate_dispatch_tables, build_category_initializer, build_shared_structure_initializer): Do not call groktypename(). (generate_protocols): Call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(); do not call groktypename(). (error_with_ivar): Remove last parameter. (check_ivars): Do not iterate ovar CLASS_RAW_IVARS lists in addition to CLASS_IVARS lists; adjust calls to error_with_ivar(). (generate_ivar_lists): Convert one of the initializer elements; do not call groktypename(). (get_arg_type_list, start_method_def, gen_method_def): Account for new representation of variable arguments and '...' in Objective-C methods; add Objective-C++ impedance matching code. (is_objc_type_qualifier): Remove function. (adjust_type_for_id_default): Simplify; there is no longer a need to wade through declspecs. (lookup_interface, start_class, continue_class, finish_class, start_method_def, start_protocol, build_method_decl, objc_add_method, add_instance_variable, build_ivar_reference, is_ivar, is_private, get_super_receiver, objc_build_finally_epilogue): Make into static functions. (receiver_is_class_object): Use new IS_CLASS() macro. (objc_build_message_expr): Tweak ObjC++ message argument handling; call objc_finish_message_expr() instead of finish_message_expr(). (finish_message_expr): Rename to objc_finish_message_expr(); use OBJC_TYPE_NAME and OBJC_SET_TYPE_NAME macros instead of TYPE_NAME. call gen_type_name() instead of gen_declaration(); call objc_is_id() instead of using IS_ID and IS_CLASS; Use objc_class_name instead of calling get_identifier("Class"); handle CONVERT_EXPRs in receiver. (build_objc_method_call, warn_with_method): Do not call groktypename(). (build_ivar_reference): Call convert() instead of clobbering in a type. (hash_init): Initialize string_htab hash table. (add_instance_variable): Simplify parameter list; do not call grokfield(); do not populate CLASS_IVARS list. (start_class): Check for the existence of super class, if one was specified. (continue_class): Use CLASS_RAW_IVARS rather than CLASS_IVARS; do not call build_class_template(); adjust call to get_class_ivars(); call build_decl(), pushdecl() and finish_decl() instead of define_decl(). (finish_class): Call build_decl(), pushdecl() and finish_decl() instead of define_decl(). (add_protocols): Use PROTOCOL_BINFO_ELTS for the tree vector size. (start_protocol): Do not call build_protocol_template(); use PROTOCOL_BINFO_ELTS for the tree vector size. (encode_type_qualifiers): Do not handle the 'const' qualifier here. (encode_pointer): Encode 'const char *' as 'r*', for backwards compatibility. (encode_array): Use HOST_WIDE_INT_PRINT_DEC instead of "%ld". (encode_type): Handle the 'const' qualifier here. (objc_parmlist): New global variable, sued by objc_push_parm and objc_get_parm_info(). (objc_push_parm, objc_get_parm_info): New functions. (objc_expr_last): Remove function. (synth_self_and_ucmd_args): For instance methods, use the instance type for 'self'; call objc_push_parm() instead of push_parm_decl(). (start_method_def): Do not call push_scope(), declare_parm_level(), pop_scope(), push_parm_decl(), store_parm_decls() or objc_expr_last(); just use objc_push_parm() and objc_get_parm_info(). (comp_method_with_proto): Remove function. (objc_types_are_equivalent): Strip away indirections before comparing underlying types. (comp_proto_with_proto): Do not call groktypename(); types are no longer in raw declspec format. (objc_start_function): New function. (really_start_method): Call comp_proto_with_proto() instead of comp_method_with_proto(); call objc_start_function() instead of hand-crafting a function declarator. (continue_method_def, objc_expand_function_end): Remove functions. (get_super_receiver): Call objc_get_current_scope() instead of get_current_scope(); reference 'super_class' field (instead of 'class'). (finish_method_def): Rename to objc_finish_method_definition() and add a function decl parameter; move method encoding call from objc_expand_function_end(). (is_complex_decl, adorn_decl, gen_declarator, gen_declspecs, gen_declaration_1): Remove functions. (tmpbuf, RAW_DECLSPEC): Remove. (gen_declaration): Remove second parameter; simplify to deal with TYPE_P nodes instead of raw declspecs. (gen_type_name, gen_type_name_0): New functions. (gen_method_decl): Remove second parameter; call gen_type_name() instead of gen_declaration_1(). (dump_interface): Adjust calls to gen_declaration() and gen_method_decl(); do not allocate a separate string buffer. (init_objc): Allocate a larger string buffer to accommodate dump_interface(); adjust call to build_module_descriptor(); add call to build_module_initializer_routine() for the GNU runtime. (generate_classref_translation_entry): Do not call start_decl(); call finish_var_decl() instead of finish_decl(); call convert() instead of build_c_cast(). * objc-act.h (CLASS_OWN_IVARS): Remove accessor. (CLASS_BINFO_ELTS): Reduce from 6 to 5, now that CLASS_OWN_IVARS is gone. (OCTI_GNU_INIT_DECL, GNU_INIT_decl): New. (OCTI_ELLIPSIS_NODE, objc_ellipsis_node): Remove. (OCTI_ID_ID, id_type, objc_id_id): Rename to OCTI_ID_NAME, objc_object_type and objc_object_name, respectively. (OCTI_CLS_REF, OCTI_CLASS_NAME, objc_class_reference, objc_class_name): New. (IS_CLASS): New macro. (IS_ID, IS_SUPER): Robustify. (OCTI_EXECCLASS_DECL, execclass_decl): New. (finish_file, start_class, continue_class, finish_class, start_method_def, continue_method_def, finish_method_def, start_protocol, finish_protocol, objc_build_throw_stmt, objc_build_try_catch_finally_stmt, objc_build_synchronized_prologue, objc_build_synchronized_epilogue, objc_build_try_prologue, objc_build_try_epilogue, objc_build_catch_stmt, objc_build_catch_epilogue, objc_build_finally_prologue, objc_build_finally_epilogue, is_ivar, is_private, is_public, add_instance_variable, objc_add_method, get_super_receiver, objc_clear_super_receiver, get_class_ivars_from_name, get_class_reference, get_static_reference, get_object_reference, build_message_expr, finish_message_expr, build_selector_expr, build_ivar_reference, build_keyword_decl, build_method_decl, build_protocol_expr, build_objc_string_object, objc_declare_alias, objc_declare_class, objc_declare_protocols, objc_comptypes, objc_check_decl, build_encode_expr): Remove prototypes. (imp_count, cat_count): Make GGC-aware. (OBJC_SET_TYPE_NAME): New macro. From-SVN: r87168
2004-09-08 02:49:44 +02:00
finish_var_decl (decl, expr);
return;
}
static void
handle_class_ref (tree chain)
{
const char *name = IDENTIFIER_POINTER (TREE_VALUE (chain));
char *string = (char *) alloca (strlen (name) + 30);
tree decl;
tree exp;
1992-01-18 00:15:38 +01:00
sprintf (string, "%sobjc_class_name_%s",
(flag_next_runtime ? "." : "__"), name);
#ifdef ASM_DECLARE_UNRESOLVED_REFERENCE
if (flag_next_runtime)
{
ASM_DECLARE_UNRESOLVED_REFERENCE (asm_out_file, string);
return;
}
#endif
/* Make a decl for this name, so we can use its address in a tree. */
decl = build_decl (VAR_DECL, get_identifier (string), char_type_node);
DECL_EXTERNAL (decl) = 1;
TREE_PUBLIC (decl) = 1;
pushdecl (decl);
rest_of_decl_compilation (decl, 0, 0);
/* Make a decl for the address. */
sprintf (string, "%sobjc_class_ref_%s",
(flag_next_runtime ? "." : "__"), name);
exp = build1 (ADDR_EXPR, string_type_node, decl);
decl = build_decl (VAR_DECL, get_identifier (string), string_type_node);
DECL_INITIAL (decl) = exp;
TREE_STATIC (decl) = 1;
TREE_USED (decl) = 1;
/* Force the output of the decl as this forces the reference of the class. */
mark_decl_referenced (decl);
pushdecl (decl);
rest_of_decl_compilation (decl, 0, 0);
}
static void
handle_impent (struct imp_entry *impent)
{
char *string;
c-parse.in (objc_inherit_code, [...]): Make static. 2001-10-03 Ziemowit Laski <zlaski@apple.com> * c-parse.in (objc_inherit_code, objc_pq_context, objc_public_flag): Make static. (objc_interface_context, objc_implementation_context, objc_method_context, objc_ivar_chain, objc_ivar_context): Move to global tree array in objc/objc-act.[ch]. (methoddef): Remove unnecessary code. * objc/objc-act.c: (hashed_attribute, hashed_entry, imp_entry): Hoist struct definitions to objc-act.h. (nst_method_hash_list, cls_method_hash_list, imp_list, imp_count, cat_count): Place declaration in objc-act.h. (objc_tree_index): Move enumeration to objc-act.h. (objc_global_trees): Place declaration and macro accessors in objc-act.h. (implementation_context): Remove duplicate; use objc_implementation_context instead: (method_context): Remove duplicate; use objc_method_context instead. (objc_ellipsis_node, objc_method_prototype_template, implemented_classes, function_type): Move global vars to objc_global_trees. (init_objc): Use LAST_BASE_TREE_CODE instead of LAST_CODE. (build_message_expr): Move actual construction of ObjC message send nodes to finish_message_expr. (finish_message_expr): New routine, contains code formerly in build_message_expr. * objc/objc-act.h (finish_message_expr): New prototype. (objc_ivar_chain, objc_method_context, objc_ellipsis_node): Remove declarations; these vars are now part of objc_global_trees. (objc_tree_index, objc_global_trees): Move definitions from objc-act.c. * objc/objc-tree.def: Update copyright info. From-SVN: r46000
2001-10-04 00:05:57 +02:00
objc_implementation_context = impent->imp_context;
implementation_template = impent->imp_template;
if (TREE_CODE (impent->imp_context) == CLASS_IMPLEMENTATION_TYPE)
{
c-parse.in (yyerror): Const-ification and/or static-ization. * c-parse.in (yyerror): Const-ification and/or static-ization. * c-typeck.c (push_member_name): Likewise. * collect2.c (main): Likewise. * dbxout.c (dbxout_parms): Likewise. * diagnostic.c (format_with_decl): Likewise. * dwarf2out.c (output_ranges): Likewise. * dwarfout.c (fundamental_type_code): Likewise. * except.c (dw2_output_call_site_table): Likewise. * gcc.c (do_spec_1): Likewise. * genopinit.c (optabs): Likewise. * objc/objc-act.c (synth_id_with_class_suffix, start_class, gen_declaration_1, handle_impent): Likewise. * protoize.c (default_include, in_system_include_dir, abspath): Likewise. * sched-vis.c (visualize_stall_cycles): Likewise. * sdbout.c (plain_type_1, sdbout_end_function, sdbout_end_epilogue): Likewise. * varasm.c (decode_reg_name): Likewise. * 1750a.c (mod_regno_adjust): Likewise. * alpha.c (alpha_write_one_linkage, unicosmk_output_default_externs): Likewise. * arm.c (arm_condition_codes): Likewise. * arm.h (arm_condition_codes): Likewise. * avr.c (output_movsisf, encode_section_info): Likewise. * darwin.h (GEN_BINDER_NAME_FOR_STUB, GEN_SYMBOL_NAME_FOR_SYMBOL): Likewise. * i386.c (hi_reg_name, qi_reg_name, qi_high_reg_name): Likewise. * i386.h (hi_reg_name, qi_reg_name, qi_high_reg_name): Likewise. * m88k.c (output_function_profiler): Likewise. * mips.c (mips_output_conditional_branch): Likewise. * ns32k.c (ns32k_out_reg_names): Likewise. * ns32k.h (ns32k_out_reg_names): Likewise. * pj.c (pj_output_rval): Likewise. * rs6000.c (GEN_LOCAL_LABEL_FOR_SYMBOL): Likewise. * sparc.c (sparc_flat_function_prologue, sparc_flat_function_epilogue): Likewise. cp: * decl.c (warn_extern_redeclared_static, cp_make_fname_decl): Const-ification. * pt.c (tsubst_decl): Likewise. f: * bad.c (ffebad_finish): Const-ification and/or static-ization. * intrin.c (ffeintrin_cmp_name_): Likewise. * stc.c (ffestc_R904): Likewise. java: * expr.c (expand_invoke): Const-ification. * parse.y (patch_method_invocation): Likewise. From-SVN: r45581
2001-09-13 16:37:29 +02:00
const char *const class_name =
IDENTIFIER_POINTER (CLASS_NAME (impent->imp_context));
string = (char *) alloca (strlen (class_name) + 30);
sprintf (string, "%sobjc_class_name_%s",
(flag_next_runtime ? "." : "__"), class_name);
}
else if (TREE_CODE (impent->imp_context) == CATEGORY_IMPLEMENTATION_TYPE)
{
c-parse.in (yyerror): Const-ification and/or static-ization. * c-parse.in (yyerror): Const-ification and/or static-ization. * c-typeck.c (push_member_name): Likewise. * collect2.c (main): Likewise. * dbxout.c (dbxout_parms): Likewise. * diagnostic.c (format_with_decl): Likewise. * dwarf2out.c (output_ranges): Likewise. * dwarfout.c (fundamental_type_code): Likewise. * except.c (dw2_output_call_site_table): Likewise. * gcc.c (do_spec_1): Likewise. * genopinit.c (optabs): Likewise. * objc/objc-act.c (synth_id_with_class_suffix, start_class, gen_declaration_1, handle_impent): Likewise. * protoize.c (default_include, in_system_include_dir, abspath): Likewise. * sched-vis.c (visualize_stall_cycles): Likewise. * sdbout.c (plain_type_1, sdbout_end_function, sdbout_end_epilogue): Likewise. * varasm.c (decode_reg_name): Likewise. * 1750a.c (mod_regno_adjust): Likewise. * alpha.c (alpha_write_one_linkage, unicosmk_output_default_externs): Likewise. * arm.c (arm_condition_codes): Likewise. * arm.h (arm_condition_codes): Likewise. * avr.c (output_movsisf, encode_section_info): Likewise. * darwin.h (GEN_BINDER_NAME_FOR_STUB, GEN_SYMBOL_NAME_FOR_SYMBOL): Likewise. * i386.c (hi_reg_name, qi_reg_name, qi_high_reg_name): Likewise. * i386.h (hi_reg_name, qi_reg_name, qi_high_reg_name): Likewise. * m88k.c (output_function_profiler): Likewise. * mips.c (mips_output_conditional_branch): Likewise. * ns32k.c (ns32k_out_reg_names): Likewise. * ns32k.h (ns32k_out_reg_names): Likewise. * pj.c (pj_output_rval): Likewise. * rs6000.c (GEN_LOCAL_LABEL_FOR_SYMBOL): Likewise. * sparc.c (sparc_flat_function_prologue, sparc_flat_function_epilogue): Likewise. cp: * decl.c (warn_extern_redeclared_static, cp_make_fname_decl): Const-ification. * pt.c (tsubst_decl): Likewise. f: * bad.c (ffebad_finish): Const-ification and/or static-ization. * intrin.c (ffeintrin_cmp_name_): Likewise. * stc.c (ffestc_R904): Likewise. java: * expr.c (expand_invoke): Const-ification. * parse.y (patch_method_invocation): Likewise. From-SVN: r45581
2001-09-13 16:37:29 +02:00
const char *const class_name =
IDENTIFIER_POINTER (CLASS_NAME (impent->imp_context));
c-parse.in (yyerror): Const-ification and/or static-ization. * c-parse.in (yyerror): Const-ification and/or static-ization. * c-typeck.c (push_member_name): Likewise. * collect2.c (main): Likewise. * dbxout.c (dbxout_parms): Likewise. * diagnostic.c (format_with_decl): Likewise. * dwarf2out.c (output_ranges): Likewise. * dwarfout.c (fundamental_type_code): Likewise. * except.c (dw2_output_call_site_table): Likewise. * gcc.c (do_spec_1): Likewise. * genopinit.c (optabs): Likewise. * objc/objc-act.c (synth_id_with_class_suffix, start_class, gen_declaration_1, handle_impent): Likewise. * protoize.c (default_include, in_system_include_dir, abspath): Likewise. * sched-vis.c (visualize_stall_cycles): Likewise. * sdbout.c (plain_type_1, sdbout_end_function, sdbout_end_epilogue): Likewise. * varasm.c (decode_reg_name): Likewise. * 1750a.c (mod_regno_adjust): Likewise. * alpha.c (alpha_write_one_linkage, unicosmk_output_default_externs): Likewise. * arm.c (arm_condition_codes): Likewise. * arm.h (arm_condition_codes): Likewise. * avr.c (output_movsisf, encode_section_info): Likewise. * darwin.h (GEN_BINDER_NAME_FOR_STUB, GEN_SYMBOL_NAME_FOR_SYMBOL): Likewise. * i386.c (hi_reg_name, qi_reg_name, qi_high_reg_name): Likewise. * i386.h (hi_reg_name, qi_reg_name, qi_high_reg_name): Likewise. * m88k.c (output_function_profiler): Likewise. * mips.c (mips_output_conditional_branch): Likewise. * ns32k.c (ns32k_out_reg_names): Likewise. * ns32k.h (ns32k_out_reg_names): Likewise. * pj.c (pj_output_rval): Likewise. * rs6000.c (GEN_LOCAL_LABEL_FOR_SYMBOL): Likewise. * sparc.c (sparc_flat_function_prologue, sparc_flat_function_epilogue): Likewise. cp: * decl.c (warn_extern_redeclared_static, cp_make_fname_decl): Const-ification. * pt.c (tsubst_decl): Likewise. f: * bad.c (ffebad_finish): Const-ification and/or static-ization. * intrin.c (ffeintrin_cmp_name_): Likewise. * stc.c (ffestc_R904): Likewise. java: * expr.c (expand_invoke): Const-ification. * parse.y (patch_method_invocation): Likewise. From-SVN: r45581
2001-09-13 16:37:29 +02:00
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 hand. */
sprintf (string, "*%sobjc_category_name_%s_%s",
(flag_next_runtime ? "." : "__"), class_name, class_super_name);
}
else
return;
#ifdef ASM_DECLARE_CLASS_REFERENCE
if (flag_next_runtime)
{
ASM_DECLARE_CLASS_REFERENCE (asm_out_file, string);
return;
}
else
#endif
{
tree decl, init;
tree.h (build_int_cst): New, sign extended constant. * tree.h (build_int_cst): New, sign extended constant. (build_int_cstu): New, zero extended constant. (build_int_cst_wide): Renamed from build_int_cst. * tree.c (build_int_cst, build_int_cstu): New. (build_int_cst_wide): Renamed from build_int_cst. (make_vector_type, build_common_tree_nodes, build_common_tree_nodes_2): Adjust build_int_cst calls. * builtins.c (expand_builtin_prefetch, expand_builtin_strstr, expand_builtin_strpbrk, expand_builtin_fputs, build_string_literal, expand_builtin_printf, expand_builtin_sprintf, fold_builtin_classify_type, fold_builtin_lround, fold_builtin_bitop, fold_builtin_isascii, fold_builtin_toascii, fold_builtin_isdigit, simplify_builtin_strstr, simplify_builtin_strpbrk, fold_builtin_fputs, simplify_builtin_sprintf): Likewise. * c-common.c (start_fname_decls, fix_string_type, shorten_compare, DEF_ATTR_INT): Likewise. * c-decl.c (complete_array_type, check_bitfield_type_and_width): Likewise. * c-lex.c (interpret_integer, lex_charconst): Likewise. * c-parse.in (primary) <TYPES_COMPATIBLE_P> Likewise. * c-pretty-print.c (pp_c_integer_constant): Likewise. * c-typeck.c (really_start_incremental_init, push_init_level, set_nonincremental_init_from_string): Likewise. * calls.c (load_register_parameters): Likewise. convert.c (convert_to_pointer): Likewise. coverage.c (coverage_counter_alloc, tree_coverage_counter_ref, build_fn_info_type, build_fn_info_value, build_ctr_info_value, build_gcov_info): Likewise. * except.c (init_eh, assign_filter_values): Likewise. * expmed.c (store_fixed_bit_field, extract_bit_field, extract_fixed_bit_field, extract_split_bit_field, expand_shift, expand_mult_const, expand_mult_highpart_adjust, extract_high_half, expand_sdiv_pow2, expand_divmod, make_tree): Likewise. * expr.c (convert_move, emit_group_load, emit_group_store, expand_assignment, store_constructor, store_field, expand_expr_real_1, reduce_to_bit_field_precision): Likewise. fold-const.c (force_fit_type, int_const_binop, fold_convert_const, invert_truthvalue, optimize_bit_field_compare, decode_field_reference, all_ones_mask_p, constant_boolean_node, fold_div_compare, fold, fold_read_from_constant_string, fold_negate_const, fold_abs_const, fold_not_const, round_up, round_down): Likewise. * function.c (assign_parm_setup_block): Likewise. * stmt.c (shift_return_value, expand_case, estimate_case_costs): Likewise. * stor-layout.c (layout_type, initialize_sizetypes, set_min_and_max_values_for_integral_type): Likewise. * tree-chrec.c (chrec_fold_multiply_poly_poly, reset_evolution_in_loop): Likewise. * tree-chrec.h (build_polynomial_chrec): Likewise. * tree-complex.c (build_replicated_const): Likewise. * tree-eh.c (honor_protect_cleanup_actions, lower_try_finally_onedest, lower_try_finally_copy, lower_try_finally_switch): Likewise. * tree-mudflap.c (mf_build_string, mx_register_decls, mudflap_register_call, mudflap_enqueue_constant): Likewise. * tree-nested.c (get_trampoline_type, get_nl_goto_field): Likewise. * tree-pretty-print.c (dump_generic_node): Likewise. * tree-ssa-ccp.c (widen_bitfield, maybe_fold_offset_to_array_ref): Likewise. * tree-ssa-dom.c (simplify_rhs_and_lookup_avail_expr): Likewise. * tree-ssa-loop-niter.c (number_of_iterations_cond, loop_niter_by_eval, upper_bound_in_type, lower_bound_in_type): Likewise. * tree-ssa-loop-ivcanon.c (create_canonical_iv, canonicalize_loop_induction_variables): Likewise. * tree-vectorizer.c (vect_create_index_for_array_ref, vect_transform_loop_bound, vect_compute_data_ref_alignment): Likewise. * config/alpha/alpha.c (alpha_initialize_trampoline, alpha_va_start, alpha_gimplify_va_arg_1): Likewise. * config/arm/arm.c (arm_get_cookie_size): Likewise. * config/c4x/c4x.c (c4x_gimplify_va_arg_expr): Likewise. * config/i386/i386.c (ix86_va_start, ix86_gimplify_va_arg): Likewise. * config/ia64/ia64.c (ia64_gimplify_va_arg): Likewise. * config/mips/mips.c (mips_build_builtin_va_list, mips_va_start, mips_gimplify_va_arg_expr): Likewise. * config/pa/pa.c (hppa_gimplify_va_arg_expr): Likewise. * config/rs6000/rs6000.c (rs6000_va_start, rs6000_gimplify_va_arg, add_compiler_branch_island): Likewise. * config/s390/s390.c (s390_va_start): Likewise. * config/sh/sh.c (sh_va_start): Likewise. * config/stormy16/stormy16.c (xstormy16_expand_builtin_va_start): Likewise. * config/xtensa/xtensa.c (xtensa_va_start, xtensa_gimplify_va_arg_expr): Likewise. * objc/objc-act.c (build_objc_string_object, build_objc_symtab_template, init_def_list, init_objc_symtab, init_module_descriptor, generate_static_references, build_selector_translation_table, get_proto_encoding, build_typed_selector_reference, build_selector_reference, build_next_objc_exception_stuff, build_method_prototype_list_template, generate_descriptor_table, generate_protocols, build_protocol_initializer, build_ivar_list_template, build_method_list_template, build_ivar_list_initializer, generate_ivars_list, generate_dispatch_table, generate_protocol_list, build_category_initializer, build_shared_structure_initializer, generate_shared_structures, handle_impent, generate_objc_image_info): Likewise. 2004-04-25 Paolo Bonzini <bonzini@gnu.org> * cfglayout.c (duplicate_insn_chain): Remove references to NOTE_INSN_LOOP_VTOP and NOTE_INSN_LOOP_CONT. * cfgloop.h (struct loop): Remove fields vtop, cont and cont_dominator. * cfgrtl.c (rtl_delete_block): Remove handling of NOTE_INSN_LOOP_CONT. * final.c (final_scan_insn): Remove references to NOTE_INSN_LOOP_VTOP and NOTE_INSN_LOOP_CONT. * insn-notes.def (NOTE_INSN_LOOP_VTOP, NOTE_INSN_LOOP_CONT): Remove. * jump.c (squeeze_notes): Remove references to NOTE_INSN_LOOP_VTOP and NOTE_INSN_LOOP_CONT. * loop.c (scan_loops, find_and_verify_loops, for_each_insn_in_loop, check_dbra_loop, loop_dump_aux): Remove references to removed notes and fields. * reorg.c (mostly_true_jump): Do not rely on NOTE_INSN_LOOP_VTOPs. * unroll.c (unroll_loop, copy_loop_body, loop_iterations): Remove references to removed notes and fields. (subtract_reg_term, ujump_to_loop_cont): Remove. From-SVN: r86544
2004-08-25 11:52:54 +02:00
init = build_int_cst (c_common_type_for_size (BITS_PER_WORD, 1), 0);
decl = build_decl (VAR_DECL, get_identifier (string), TREE_TYPE (init));
TREE_PUBLIC (decl) = 1;
TREE_READONLY (decl) = 1;
TREE_USED (decl) = 1;
TREE_CONSTANT (decl) = 1;
DECL_CONTEXT (decl) = 0;
DECL_ARTIFICIAL (decl) = 1;
DECL_INITIAL (decl) = init;
assemble_variable (decl, 1, 0, 0);
}
}
/* The Fix-and-Continue functionality available in Mac OS X 10.3 and
later requires that ObjC translation units participating in F&C be
specially marked. The following routine accomplishes this. */
/* static int _OBJC_IMAGE_INFO[2] = { 0, 1 }; */
static void
generate_objc_image_info (void)
{
Makefile.in (c-parse.o): Depend on $(C_COMMON_H). [gcc/ChangeLog] 2004-09-07 Ziemowit Laski <zlaski@apple.com> * Makefile.in (c-parse.o): Depend on $(C_COMMON_H). * c-parse.in: Include c-common.h instead of objc-act.h. (ivar_decl_list, ivar_decls, ivar_decl, ivars, ivar_declarator, myparms, myparm): Remove %type declarations. (methodtype, optparms, OBJC_TYPE_QUAL, objc_quals, objc_qual, objc_typename, objc_try_catch_stmt, optellipsis): Add %type declarations. (objc_inherit_code, objc_public_flag): Remove. (typespec_nonreserved_nonattr): Call objc_get_protocol_qualified_type() instead of get_static_reference() and get_protocol_reference(). (stmt_nocomp): Call grokparm() on @catch parameter. (objcdef): Move semantic action to objc_finish_implementation(). (classdef): Move semantic action to objc_start_class_interface(), objc_continue_interface(), objc_finish_interface(), objc_start_class_implementation(), objc_continue_implementation(), objc_start_category_interface() and objc_start_category_implementation(). (protocoldef): Move semantic actions to objc_start_protocol() and objc_finish_interface(). (ivar_decl_list): Remove nonterminal. (visibility_spec): Move semantic actions to objc_set_visibility(). (ivar_decls): Remove assignment to $$. (ivar_decl): Rephrase in terms of component_decl; call objc_add_instance_variable(). (ivars, ivar_declarator): Remove nonterminals. (opt_semi): New nonterminal. (methodtype): Remove semantic actions. (methoddef): Move semantic actions to objc_set_method_type(), objc_start_method_definition() and objc_finish_method_definition(). (methodproto): Move semantic actions to objc_set_method_type() and objc_add_method_declaration(). (methoddecl): Use objc_typename instead of typename; move semantic actions to objc_build_method_signature(). (optarglist, myxdecls, mydecl, myparms, myparm): Remove nonterminals. (optparmlist): Express in terms of optparms and optellipsis. (optparms, optellipsis, objc_qual, objc_quals, objc_typename): New nonterminals. (keyworddecl): Use objc_typename instead of typename. (rid_to_yy): Mark RID_IN, RID_OUT, RID_INOUT, RID_BYCOPY, RID_BYREF and RID_ONEWAY as returning OBJC_TYPE_QUAL to yyparse(). [gcc/objc/ChangeLog] 2004-09-07 Ziemowit Laski <zlaski@apple.com> * Make-lang.in (objc/objc-parse.o): Depend on $(C_COMMON_H) instead of objc/objc-act.h. (objc/objc-act.o): Depend on $(HASHTAB_H). * objc-act.c: Include hashtab.h; in ObjC++ mode, include cp-tree.h and objcp-decl.h instead of c-tree.h. (build_module_descriptor, get_class_ivars, synth_id_with_class_suffix, error_with_ivar, gen_method_decl, gen_declaration, setup_string_decl, build_protocol_template): Adjust prototypes. (build_module_initializer_routine, start_class, continue_class, finish_class, start_method_def, objc_start_function, start_protocol, build_method_decl, objc_add_method, add_instance_variable, build_ivar_reference, is_ivar, is_private, get_super_receiver, build_selector_table_decl, objc_push_parm, objc_get_parm_info, gen_type_name, gen_type_name_0, start_var_decl, finish_var_decl, create_field_decl): New prototypes. (objc_expand_function_end, comp_method_with_proto, objc_expr_last, gen_declaration_1, gen_declarator, is_complex_decl, adorn_decl, define_decl, create_builtin_decl, gen_declspecs): Remove prototypes. (TYPE_ID): Rename to OBJECT_TYPEDEF_NAME. (CLASS_TYPEDEF_NAME): New. (TAG_EXECCLASS): Change from a global variable to a #define. (TAG_RETURN_STRUCT): Delete. (TAG_GNUINIT): New, holds '__objc_gnu_init' name. (objc_inherit_code, objc_public_flag): New, moved from c-parse.in. (string_descriptor): New struct. (string_htab): New hash table. (string_hash, string_eq): New prototypes. (generate_struct_by_value_array): Call create_field_decl() instead of create_builtin_decl(). (objc_init): Do not initialize objc_ellipsis_node or TAG_EXECCLASS; In ObjC++ mode, call cxx_init() instead of c_objc_common_init(). (objc_finish_file): In ObjC++, call instantiate_pending_templates() and cp_finish_file(). (define_decl, get_static_reference, get_protocol_reference, create_builtin_decl): Remove functions. (objc_start_class_interface, objc_start_category_interface, objc_start_protocol, objc_continue_interface, objc_finish_interface, objc_start_class_implementation, objc_start_category_implementation, objc_continue_implementation, objc_finish_implementation, objc_set_visibility, objc_set_method_type, objc_build_method_signature, objc_add_method_declaration, objc_start_method_definition, objc_add_instance_variable, objc_get_protocol_qualified_type, create_field_decl, start_var_decl, finish_var_decl): New functions. (setup_string_decl): Simplify since it is only called once. (synth_module_prologue): Call build_class_template(); predefine 'id' and 'Class' as typedefs; rename 'temp_type' to 'type'; disable debug hooks for duration of function; fix GNU runtime messenger signatures to correspond to reality; forward-declare '__objc_exec_class' for the GNU runtime; call build_selector_table_decl(); in ObjC++ mode, generate 'extern "C" { ... }' wrappers around synthesized declarations; call build_protocol_template() and build_category_template(). (string_hash, string_eq): New functions. (objc_build_string_object): Check metaclass correctness only once; store string literals in hash table. (objc_build_constructor): Do not convert initializer elements; adjust for ObjC++ impedance mismatch. (build_objc_symtab_template): Call create_field_decl() instead of create_builtin_decl(). (init_objc_symtab): Add missing conversion to initializer element. (build_metadata_decl): Call start_var_decl() instead of define_decl(). (generate_objc_symtab_decl): Do not call build_category_template(); call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(). (build_module_descriptor): Call create_field_decl() instead of grokfield(); call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(); always mark module descriptor as used; move GNU runtime-specific functionality to build_module_initializer_routine(). (build_module_initializer_routine): New function, broken off of build_module_descriptor(). (objc_static_init_needed_p, objc_generate_static_init_call): New functions. (generate_static_references, generate_strings, build_selector_translation_table, generate_descriptor_table, generate_ivars_list, generate_dispatch_table, generate_category): Call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(); build a type directly instead of via groktypename(). (build_selector_reference_decl, build_selector_table_decl, build_class_reference_decl, build_protocol_reference, generate_objc_image_info): Call start_var_decl() instead of build_decl(). (build_selector_reference): For GNU runtime, do not call build_selector_reference_decl(). (build_selector, build_typed_selector_reference): Always convert result to the selector type. (add_objc_string): Cast return value to 'char *'. (build_method_prototype_template, build_selector_template, build_method_template): Use actual selector type for fields pointing to selectors. (finish_objc): For GNU runtime, call build_module_initializer_routine() after build_module_descriptor(). (generate_protocol_list, generate_shared_structures): Call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(); build a type directly instead of via groktypename(). (synth_id_with_class_suffix): Return a string. (get_arg_type_list): For instance methods, use the instance type for 'self'; do not call groktypename_in_parm_context(). (build_objc_string_decl): Squash redeclaration errors in ObjC++. (objc_is_class_name): Use OBJC_TYPE_NAME instead of TYPE_NAME; handle RECORD_TYPEs in ObjC as well as ObjC++. (objc_is_id): New function. (objc_is_object_ptr): Return the canonical type node. (objc_get_class_ivars): Simplify using get_class_ivars(). (get_class_ivars): Remove second parameter; create a fresh copy of the ivar list for each call; do not check for existence of super class. (objc_eh_runtime_type): Mark #ifndef OBJCPLUS. (objc_init_exceptions): When using SJLJ-style exceptions, require the use of '-fobjc-exceptions' flag; do not require it for DWARF-style exceptions. (objc_build_exc_ptr, next_sjlj_build_try_catch_finally): Use objc_object_type instead of objc_id_type. (objc_begin_catch_clause): Convert the incoming PARM_DECL into a VAR_DECL before placing it in the appropriate scope; do not call define_decl(); adjust call to c_begin_compound_stmt(); use objc_object_type instead of objc_id_type. (build_next_objc_exception_stuff): Call create_field_decl() instead of create_builtin_decl(); construct type directly instead of calling groktypename(); use OBJC_VOID_AT_END to mark end of function parameters. (build_private_template): Adjust call to get_class_ivars(); build a type directly instead of via groktypename(). (build_protocol_template, build_method_prototype_list_template, build_method_prototype_template, build_category_template, build_selector_template, build_class_template, build_super_template, build_ivar_template, build_ivar_list_template, build_method_list_template, build_method_template): Call create_field_decl() instead of grokfield(). (objc_method_parm_type): Do not call groktypename(). (generate_descriptor_table): Call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(). (generate_method_descriptors, build_protocol_initializer, generate_dispatch_tables, build_category_initializer, build_shared_structure_initializer): Do not call groktypename(). (generate_protocols): Call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(); do not call groktypename(). (error_with_ivar): Remove last parameter. (check_ivars): Do not iterate ovar CLASS_RAW_IVARS lists in addition to CLASS_IVARS lists; adjust calls to error_with_ivar(). (generate_ivar_lists): Convert one of the initializer elements; do not call groktypename(). (get_arg_type_list, start_method_def, gen_method_def): Account for new representation of variable arguments and '...' in Objective-C methods; add Objective-C++ impedance matching code. (is_objc_type_qualifier): Remove function. (adjust_type_for_id_default): Simplify; there is no longer a need to wade through declspecs. (lookup_interface, start_class, continue_class, finish_class, start_method_def, start_protocol, build_method_decl, objc_add_method, add_instance_variable, build_ivar_reference, is_ivar, is_private, get_super_receiver, objc_build_finally_epilogue): Make into static functions. (receiver_is_class_object): Use new IS_CLASS() macro. (objc_build_message_expr): Tweak ObjC++ message argument handling; call objc_finish_message_expr() instead of finish_message_expr(). (finish_message_expr): Rename to objc_finish_message_expr(); use OBJC_TYPE_NAME and OBJC_SET_TYPE_NAME macros instead of TYPE_NAME. call gen_type_name() instead of gen_declaration(); call objc_is_id() instead of using IS_ID and IS_CLASS; Use objc_class_name instead of calling get_identifier("Class"); handle CONVERT_EXPRs in receiver. (build_objc_method_call, warn_with_method): Do not call groktypename(). (build_ivar_reference): Call convert() instead of clobbering in a type. (hash_init): Initialize string_htab hash table. (add_instance_variable): Simplify parameter list; do not call grokfield(); do not populate CLASS_IVARS list. (start_class): Check for the existence of super class, if one was specified. (continue_class): Use CLASS_RAW_IVARS rather than CLASS_IVARS; do not call build_class_template(); adjust call to get_class_ivars(); call build_decl(), pushdecl() and finish_decl() instead of define_decl(). (finish_class): Call build_decl(), pushdecl() and finish_decl() instead of define_decl(). (add_protocols): Use PROTOCOL_BINFO_ELTS for the tree vector size. (start_protocol): Do not call build_protocol_template(); use PROTOCOL_BINFO_ELTS for the tree vector size. (encode_type_qualifiers): Do not handle the 'const' qualifier here. (encode_pointer): Encode 'const char *' as 'r*', for backwards compatibility. (encode_array): Use HOST_WIDE_INT_PRINT_DEC instead of "%ld". (encode_type): Handle the 'const' qualifier here. (objc_parmlist): New global variable, sued by objc_push_parm and objc_get_parm_info(). (objc_push_parm, objc_get_parm_info): New functions. (objc_expr_last): Remove function. (synth_self_and_ucmd_args): For instance methods, use the instance type for 'self'; call objc_push_parm() instead of push_parm_decl(). (start_method_def): Do not call push_scope(), declare_parm_level(), pop_scope(), push_parm_decl(), store_parm_decls() or objc_expr_last(); just use objc_push_parm() and objc_get_parm_info(). (comp_method_with_proto): Remove function. (objc_types_are_equivalent): Strip away indirections before comparing underlying types. (comp_proto_with_proto): Do not call groktypename(); types are no longer in raw declspec format. (objc_start_function): New function. (really_start_method): Call comp_proto_with_proto() instead of comp_method_with_proto(); call objc_start_function() instead of hand-crafting a function declarator. (continue_method_def, objc_expand_function_end): Remove functions. (get_super_receiver): Call objc_get_current_scope() instead of get_current_scope(); reference 'super_class' field (instead of 'class'). (finish_method_def): Rename to objc_finish_method_definition() and add a function decl parameter; move method encoding call from objc_expand_function_end(). (is_complex_decl, adorn_decl, gen_declarator, gen_declspecs, gen_declaration_1): Remove functions. (tmpbuf, RAW_DECLSPEC): Remove. (gen_declaration): Remove second parameter; simplify to deal with TYPE_P nodes instead of raw declspecs. (gen_type_name, gen_type_name_0): New functions. (gen_method_decl): Remove second parameter; call gen_type_name() instead of gen_declaration_1(). (dump_interface): Adjust calls to gen_declaration() and gen_method_decl(); do not allocate a separate string buffer. (init_objc): Allocate a larger string buffer to accommodate dump_interface(); adjust call to build_module_descriptor(); add call to build_module_initializer_routine() for the GNU runtime. (generate_classref_translation_entry): Do not call start_decl(); call finish_var_decl() instead of finish_decl(); call convert() instead of build_c_cast(). * objc-act.h (CLASS_OWN_IVARS): Remove accessor. (CLASS_BINFO_ELTS): Reduce from 6 to 5, now that CLASS_OWN_IVARS is gone. (OCTI_GNU_INIT_DECL, GNU_INIT_decl): New. (OCTI_ELLIPSIS_NODE, objc_ellipsis_node): Remove. (OCTI_ID_ID, id_type, objc_id_id): Rename to OCTI_ID_NAME, objc_object_type and objc_object_name, respectively. (OCTI_CLS_REF, OCTI_CLASS_NAME, objc_class_reference, objc_class_name): New. (IS_CLASS): New macro. (IS_ID, IS_SUPER): Robustify. (OCTI_EXECCLASS_DECL, execclass_decl): New. (finish_file, start_class, continue_class, finish_class, start_method_def, continue_method_def, finish_method_def, start_protocol, finish_protocol, objc_build_throw_stmt, objc_build_try_catch_finally_stmt, objc_build_synchronized_prologue, objc_build_synchronized_epilogue, objc_build_try_prologue, objc_build_try_epilogue, objc_build_catch_stmt, objc_build_catch_epilogue, objc_build_finally_prologue, objc_build_finally_epilogue, is_ivar, is_private, is_public, add_instance_variable, objc_add_method, get_super_receiver, objc_clear_super_receiver, get_class_ivars_from_name, get_class_reference, get_static_reference, get_object_reference, build_message_expr, finish_message_expr, build_selector_expr, build_ivar_reference, build_keyword_decl, build_method_decl, build_protocol_expr, build_objc_string_object, objc_declare_alias, objc_declare_class, objc_declare_protocols, objc_comptypes, objc_check_decl, build_encode_expr): Remove prototypes. (imp_count, cat_count): Make GGC-aware. (OBJC_SET_TYPE_NAME): New macro. From-SVN: r87168
2004-09-08 02:49:44 +02:00
tree decl, initlist;
Yet more Objective-C++... * objc-act.c (objc_finish_try_stmt): Add return value. (objc_build_synchronized): Likewise. * objc-act.c (objc_is_gcable_type): Add. (objc_substitute_decl): Add. (objc_build_ivar_assignment): Add. (objc_build_global_assignment): Add. (objc_build_strong_cast_assignment): Add. (objc_is_ivar_reference_p): Add. (objc_is_global_reference_p): Add. (objc_generate_write_barrier): Add. (objc_rewrite_function_call): Add. (objc_gimplify_expr): Add Objective-C++ support. * objc-act.h (ALLOC_OBJC_TYPE_LANG_SPECIFIC): Likewise. (SIZEOF_OBJC_TYPE_LANG_SPECIFIC): Add. (INIT_TYPE_OBJC_INFO): Add Objective-C++ support. (DUP_TYPE_OBJC_INFO): Likewise. (struct imp_entry): Add field has_cxx_cdtors. (struct imp_entry *imp_list): Add OCTI_UMSG_FAST_DECL, OCTI_METH_LIST_TEMPL, OCTI_METH_PROTO_LIST_TEMPL, OCTI_IVAR_LIST_TEMPL, OCTI_ASSIGN_IVAR_DECL, OCTI_ASSIGN_IVAR_FAST_DECL, OCTI_ASSIGN_GLOBAL_DECL, OCTI_ASSIGN_STRONGCAST_DECL. (umsg_fast_decl): Add. (objc_assign_ivar_decl): Add. (objc_assign_ivar_fast_decl): Add. (objc_assign_global_decl): Add. (objc_assign_strong_cast_decl): Add. (objc_method_list_ptr): Add. (objc_method_proto_list_ptr): Add. (objc_ivar_list_ptr): Add. * objc-act.c (should_call_super_dealloc): Add. (OBJC_VERSION): Bump to 6. (objc_is_gcable_type): Add. (objc_substitute_decl): Add. (objc_build_ivar_assignment): Add. (objc_build_global_assignment): Add. (objc_build_strong_cast_assignment): Add. (objc_is_gcable_p): Add. (objc_is_ivar_reference_p): Add. (objc_is_global_reference_p): Add. (generate_shared_structures): Add flags parameter. (objc_generate_cxx_ctor_or_dtor): Add. (objc_generate_cxx_cdtors): Add. (add_class): Add name parameter. (objc_types_share_size_and_alignment): Add. (comp_proto_with_proto): Add strict parameter. (CLS_HAS_CXX_STRUCTORS): Add. (TAG_ASSIGNIVAR): Add. (TAG_ASSIGNGLOBAL): Add. (TAG_ASSIGNSTRONGCAST): Add. (TAG_MSGSEND_FAST): Add. (TAG_ASSIGNIVAR_FAST): Add. (TAG_CXX_CONSTRUCT): Add. (TAG_CXX_DESTRUCT): Add. (OBJC_LOOKUP_CLASS): Add. (OBJC_LOOKUP_NO_SUPER): Add. (objc_finish_file): Add pch support. (objc_finish_implementation): Add Objective-C++ support. (synth_module_prologue): Likewise. (synth_module_prologue): Add fast dispatching. (objc_get_class_reference): Add Objective-C++ support. (objc_generate_write_barrier): Likewise. (next_sjlj_build_enter_and_setjmp): Likewise. (objc_begin_try_stmt): Likewise. (build_next_objc_exception_stuff): Add fast ivar support. (build_private_template): Mark the record as used so debug information is generated. (build_protocol_template): Add Objective-C++ support. (objc_method_parm_type) Likewise. (objc_generate_cxx_ctor_or_dtor): Likewise. (objc_generate_cxx_cdtors): Likewise. (build_protocol_initializer): Likewise. (build_category_template): Likewise. (build_class_template): Likewise. (build_method_list_template): Likewise. (build_category_initializer): Likewise. (build_shared_structure_initializer): Likewise. (objc_finish_message_expr): Likewise. (build_objc_method_call): Add fast dispatch support. (lookup_method_static): Add support to end search at superclasses. (add_method_to_hash_list): Add strict parameter to comp_proto_with_proto. (objc_add_method): Likewise. (objc_add_method): Also set the interface_value. (add_instance_variable): Add Objective-C++ support. (objc_is_public): Likewise. (start_class): Likewise. (continue_class): Likewise. (encode_aggregate_within): Likewise. (start_method_def): Likewise. (objc_start_function): Clear current_function_returns_value and current_function_returns_null. (really_start_method): Add Objective-C++ support. (objc_finish_method_definition): Add warning for missing [super dealloc]. (finish_objc): Add Objective-C++ support. (generate_objc_image_info): Likewise. (objc_lookup_ivar): Likewise. * objc-act.h (TYPE_HAS_OBJC_INFO): Likewise. (INIT_TYPE_OBJC_INFO): Likewise. (DUP_TYPE_OBJC_INFO): Likewise. From-SVN: r99857
2005-05-17 22:07:08 +02:00
int flags
= ((flag_replace_objc_classes && imp_list ? 1 : 0)
| (flag_objc_gc ? 2 : 0));
Makefile.in (c-parse.o): Depend on $(C_COMMON_H). [gcc/ChangeLog] 2004-09-07 Ziemowit Laski <zlaski@apple.com> * Makefile.in (c-parse.o): Depend on $(C_COMMON_H). * c-parse.in: Include c-common.h instead of objc-act.h. (ivar_decl_list, ivar_decls, ivar_decl, ivars, ivar_declarator, myparms, myparm): Remove %type declarations. (methodtype, optparms, OBJC_TYPE_QUAL, objc_quals, objc_qual, objc_typename, objc_try_catch_stmt, optellipsis): Add %type declarations. (objc_inherit_code, objc_public_flag): Remove. (typespec_nonreserved_nonattr): Call objc_get_protocol_qualified_type() instead of get_static_reference() and get_protocol_reference(). (stmt_nocomp): Call grokparm() on @catch parameter. (objcdef): Move semantic action to objc_finish_implementation(). (classdef): Move semantic action to objc_start_class_interface(), objc_continue_interface(), objc_finish_interface(), objc_start_class_implementation(), objc_continue_implementation(), objc_start_category_interface() and objc_start_category_implementation(). (protocoldef): Move semantic actions to objc_start_protocol() and objc_finish_interface(). (ivar_decl_list): Remove nonterminal. (visibility_spec): Move semantic actions to objc_set_visibility(). (ivar_decls): Remove assignment to $$. (ivar_decl): Rephrase in terms of component_decl; call objc_add_instance_variable(). (ivars, ivar_declarator): Remove nonterminals. (opt_semi): New nonterminal. (methodtype): Remove semantic actions. (methoddef): Move semantic actions to objc_set_method_type(), objc_start_method_definition() and objc_finish_method_definition(). (methodproto): Move semantic actions to objc_set_method_type() and objc_add_method_declaration(). (methoddecl): Use objc_typename instead of typename; move semantic actions to objc_build_method_signature(). (optarglist, myxdecls, mydecl, myparms, myparm): Remove nonterminals. (optparmlist): Express in terms of optparms and optellipsis. (optparms, optellipsis, objc_qual, objc_quals, objc_typename): New nonterminals. (keyworddecl): Use objc_typename instead of typename. (rid_to_yy): Mark RID_IN, RID_OUT, RID_INOUT, RID_BYCOPY, RID_BYREF and RID_ONEWAY as returning OBJC_TYPE_QUAL to yyparse(). [gcc/objc/ChangeLog] 2004-09-07 Ziemowit Laski <zlaski@apple.com> * Make-lang.in (objc/objc-parse.o): Depend on $(C_COMMON_H) instead of objc/objc-act.h. (objc/objc-act.o): Depend on $(HASHTAB_H). * objc-act.c: Include hashtab.h; in ObjC++ mode, include cp-tree.h and objcp-decl.h instead of c-tree.h. (build_module_descriptor, get_class_ivars, synth_id_with_class_suffix, error_with_ivar, gen_method_decl, gen_declaration, setup_string_decl, build_protocol_template): Adjust prototypes. (build_module_initializer_routine, start_class, continue_class, finish_class, start_method_def, objc_start_function, start_protocol, build_method_decl, objc_add_method, add_instance_variable, build_ivar_reference, is_ivar, is_private, get_super_receiver, build_selector_table_decl, objc_push_parm, objc_get_parm_info, gen_type_name, gen_type_name_0, start_var_decl, finish_var_decl, create_field_decl): New prototypes. (objc_expand_function_end, comp_method_with_proto, objc_expr_last, gen_declaration_1, gen_declarator, is_complex_decl, adorn_decl, define_decl, create_builtin_decl, gen_declspecs): Remove prototypes. (TYPE_ID): Rename to OBJECT_TYPEDEF_NAME. (CLASS_TYPEDEF_NAME): New. (TAG_EXECCLASS): Change from a global variable to a #define. (TAG_RETURN_STRUCT): Delete. (TAG_GNUINIT): New, holds '__objc_gnu_init' name. (objc_inherit_code, objc_public_flag): New, moved from c-parse.in. (string_descriptor): New struct. (string_htab): New hash table. (string_hash, string_eq): New prototypes. (generate_struct_by_value_array): Call create_field_decl() instead of create_builtin_decl(). (objc_init): Do not initialize objc_ellipsis_node or TAG_EXECCLASS; In ObjC++ mode, call cxx_init() instead of c_objc_common_init(). (objc_finish_file): In ObjC++, call instantiate_pending_templates() and cp_finish_file(). (define_decl, get_static_reference, get_protocol_reference, create_builtin_decl): Remove functions. (objc_start_class_interface, objc_start_category_interface, objc_start_protocol, objc_continue_interface, objc_finish_interface, objc_start_class_implementation, objc_start_category_implementation, objc_continue_implementation, objc_finish_implementation, objc_set_visibility, objc_set_method_type, objc_build_method_signature, objc_add_method_declaration, objc_start_method_definition, objc_add_instance_variable, objc_get_protocol_qualified_type, create_field_decl, start_var_decl, finish_var_decl): New functions. (setup_string_decl): Simplify since it is only called once. (synth_module_prologue): Call build_class_template(); predefine 'id' and 'Class' as typedefs; rename 'temp_type' to 'type'; disable debug hooks for duration of function; fix GNU runtime messenger signatures to correspond to reality; forward-declare '__objc_exec_class' for the GNU runtime; call build_selector_table_decl(); in ObjC++ mode, generate 'extern "C" { ... }' wrappers around synthesized declarations; call build_protocol_template() and build_category_template(). (string_hash, string_eq): New functions. (objc_build_string_object): Check metaclass correctness only once; store string literals in hash table. (objc_build_constructor): Do not convert initializer elements; adjust for ObjC++ impedance mismatch. (build_objc_symtab_template): Call create_field_decl() instead of create_builtin_decl(). (init_objc_symtab): Add missing conversion to initializer element. (build_metadata_decl): Call start_var_decl() instead of define_decl(). (generate_objc_symtab_decl): Do not call build_category_template(); call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(). (build_module_descriptor): Call create_field_decl() instead of grokfield(); call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(); always mark module descriptor as used; move GNU runtime-specific functionality to build_module_initializer_routine(). (build_module_initializer_routine): New function, broken off of build_module_descriptor(). (objc_static_init_needed_p, objc_generate_static_init_call): New functions. (generate_static_references, generate_strings, build_selector_translation_table, generate_descriptor_table, generate_ivars_list, generate_dispatch_table, generate_category): Call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(); build a type directly instead of via groktypename(). (build_selector_reference_decl, build_selector_table_decl, build_class_reference_decl, build_protocol_reference, generate_objc_image_info): Call start_var_decl() instead of build_decl(). (build_selector_reference): For GNU runtime, do not call build_selector_reference_decl(). (build_selector, build_typed_selector_reference): Always convert result to the selector type. (add_objc_string): Cast return value to 'char *'. (build_method_prototype_template, build_selector_template, build_method_template): Use actual selector type for fields pointing to selectors. (finish_objc): For GNU runtime, call build_module_initializer_routine() after build_module_descriptor(). (generate_protocol_list, generate_shared_structures): Call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(); build a type directly instead of via groktypename(). (synth_id_with_class_suffix): Return a string. (get_arg_type_list): For instance methods, use the instance type for 'self'; do not call groktypename_in_parm_context(). (build_objc_string_decl): Squash redeclaration errors in ObjC++. (objc_is_class_name): Use OBJC_TYPE_NAME instead of TYPE_NAME; handle RECORD_TYPEs in ObjC as well as ObjC++. (objc_is_id): New function. (objc_is_object_ptr): Return the canonical type node. (objc_get_class_ivars): Simplify using get_class_ivars(). (get_class_ivars): Remove second parameter; create a fresh copy of the ivar list for each call; do not check for existence of super class. (objc_eh_runtime_type): Mark #ifndef OBJCPLUS. (objc_init_exceptions): When using SJLJ-style exceptions, require the use of '-fobjc-exceptions' flag; do not require it for DWARF-style exceptions. (objc_build_exc_ptr, next_sjlj_build_try_catch_finally): Use objc_object_type instead of objc_id_type. (objc_begin_catch_clause): Convert the incoming PARM_DECL into a VAR_DECL before placing it in the appropriate scope; do not call define_decl(); adjust call to c_begin_compound_stmt(); use objc_object_type instead of objc_id_type. (build_next_objc_exception_stuff): Call create_field_decl() instead of create_builtin_decl(); construct type directly instead of calling groktypename(); use OBJC_VOID_AT_END to mark end of function parameters. (build_private_template): Adjust call to get_class_ivars(); build a type directly instead of via groktypename(). (build_protocol_template, build_method_prototype_list_template, build_method_prototype_template, build_category_template, build_selector_template, build_class_template, build_super_template, build_ivar_template, build_ivar_list_template, build_method_list_template, build_method_template): Call create_field_decl() instead of grokfield(). (objc_method_parm_type): Do not call groktypename(). (generate_descriptor_table): Call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(). (generate_method_descriptors, build_protocol_initializer, generate_dispatch_tables, build_category_initializer, build_shared_structure_initializer): Do not call groktypename(). (generate_protocols): Call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(); do not call groktypename(). (error_with_ivar): Remove last parameter. (check_ivars): Do not iterate ovar CLASS_RAW_IVARS lists in addition to CLASS_IVARS lists; adjust calls to error_with_ivar(). (generate_ivar_lists): Convert one of the initializer elements; do not call groktypename(). (get_arg_type_list, start_method_def, gen_method_def): Account for new representation of variable arguments and '...' in Objective-C methods; add Objective-C++ impedance matching code. (is_objc_type_qualifier): Remove function. (adjust_type_for_id_default): Simplify; there is no longer a need to wade through declspecs. (lookup_interface, start_class, continue_class, finish_class, start_method_def, start_protocol, build_method_decl, objc_add_method, add_instance_variable, build_ivar_reference, is_ivar, is_private, get_super_receiver, objc_build_finally_epilogue): Make into static functions. (receiver_is_class_object): Use new IS_CLASS() macro. (objc_build_message_expr): Tweak ObjC++ message argument handling; call objc_finish_message_expr() instead of finish_message_expr(). (finish_message_expr): Rename to objc_finish_message_expr(); use OBJC_TYPE_NAME and OBJC_SET_TYPE_NAME macros instead of TYPE_NAME. call gen_type_name() instead of gen_declaration(); call objc_is_id() instead of using IS_ID and IS_CLASS; Use objc_class_name instead of calling get_identifier("Class"); handle CONVERT_EXPRs in receiver. (build_objc_method_call, warn_with_method): Do not call groktypename(). (build_ivar_reference): Call convert() instead of clobbering in a type. (hash_init): Initialize string_htab hash table. (add_instance_variable): Simplify parameter list; do not call grokfield(); do not populate CLASS_IVARS list. (start_class): Check for the existence of super class, if one was specified. (continue_class): Use CLASS_RAW_IVARS rather than CLASS_IVARS; do not call build_class_template(); adjust call to get_class_ivars(); call build_decl(), pushdecl() and finish_decl() instead of define_decl(). (finish_class): Call build_decl(), pushdecl() and finish_decl() instead of define_decl(). (add_protocols): Use PROTOCOL_BINFO_ELTS for the tree vector size. (start_protocol): Do not call build_protocol_template(); use PROTOCOL_BINFO_ELTS for the tree vector size. (encode_type_qualifiers): Do not handle the 'const' qualifier here. (encode_pointer): Encode 'const char *' as 'r*', for backwards compatibility. (encode_array): Use HOST_WIDE_INT_PRINT_DEC instead of "%ld". (encode_type): Handle the 'const' qualifier here. (objc_parmlist): New global variable, sued by objc_push_parm and objc_get_parm_info(). (objc_push_parm, objc_get_parm_info): New functions. (objc_expr_last): Remove function. (synth_self_and_ucmd_args): For instance methods, use the instance type for 'self'; call objc_push_parm() instead of push_parm_decl(). (start_method_def): Do not call push_scope(), declare_parm_level(), pop_scope(), push_parm_decl(), store_parm_decls() or objc_expr_last(); just use objc_push_parm() and objc_get_parm_info(). (comp_method_with_proto): Remove function. (objc_types_are_equivalent): Strip away indirections before comparing underlying types. (comp_proto_with_proto): Do not call groktypename(); types are no longer in raw declspec format. (objc_start_function): New function. (really_start_method): Call comp_proto_with_proto() instead of comp_method_with_proto(); call objc_start_function() instead of hand-crafting a function declarator. (continue_method_def, objc_expand_function_end): Remove functions. (get_super_receiver): Call objc_get_current_scope() instead of get_current_scope(); reference 'super_class' field (instead of 'class'). (finish_method_def): Rename to objc_finish_method_definition() and add a function decl parameter; move method encoding call from objc_expand_function_end(). (is_complex_decl, adorn_decl, gen_declarator, gen_declspecs, gen_declaration_1): Remove functions. (tmpbuf, RAW_DECLSPEC): Remove. (gen_declaration): Remove second parameter; simplify to deal with TYPE_P nodes instead of raw declspecs. (gen_type_name, gen_type_name_0): New functions. (gen_method_decl): Remove second parameter; call gen_type_name() instead of gen_declaration_1(). (dump_interface): Adjust calls to gen_declaration() and gen_method_decl(); do not allocate a separate string buffer. (init_objc): Allocate a larger string buffer to accommodate dump_interface(); adjust call to build_module_descriptor(); add call to build_module_initializer_routine() for the GNU runtime. (generate_classref_translation_entry): Do not call start_decl(); call finish_var_decl() instead of finish_decl(); call convert() instead of build_c_cast(). * objc-act.h (CLASS_OWN_IVARS): Remove accessor. (CLASS_BINFO_ELTS): Reduce from 6 to 5, now that CLASS_OWN_IVARS is gone. (OCTI_GNU_INIT_DECL, GNU_INIT_decl): New. (OCTI_ELLIPSIS_NODE, objc_ellipsis_node): Remove. (OCTI_ID_ID, id_type, objc_id_id): Rename to OCTI_ID_NAME, objc_object_type and objc_object_name, respectively. (OCTI_CLS_REF, OCTI_CLASS_NAME, objc_class_reference, objc_class_name): New. (IS_CLASS): New macro. (IS_ID, IS_SUPER): Robustify. (OCTI_EXECCLASS_DECL, execclass_decl): New. (finish_file, start_class, continue_class, finish_class, start_method_def, continue_method_def, finish_method_def, start_protocol, finish_protocol, objc_build_throw_stmt, objc_build_try_catch_finally_stmt, objc_build_synchronized_prologue, objc_build_synchronized_epilogue, objc_build_try_prologue, objc_build_try_epilogue, objc_build_catch_stmt, objc_build_catch_epilogue, objc_build_finally_prologue, objc_build_finally_epilogue, is_ivar, is_private, is_public, add_instance_variable, objc_add_method, get_super_receiver, objc_clear_super_receiver, get_class_ivars_from_name, get_class_reference, get_static_reference, get_object_reference, build_message_expr, finish_message_expr, build_selector_expr, build_ivar_reference, build_keyword_decl, build_method_decl, build_protocol_expr, build_objc_string_object, objc_declare_alias, objc_declare_class, objc_declare_protocols, objc_comptypes, objc_check_decl, build_encode_expr): Remove prototypes. (imp_count, cat_count): Make GGC-aware. (OBJC_SET_TYPE_NAME): New macro. From-SVN: r87168
2004-09-08 02:49:44 +02:00
decl = start_var_decl (build_array_type
(integer_type_node,
build_index_type (build_int_cst (NULL_TREE, 2 - 1))),
"_OBJC_IMAGE_INFO");
tree.h (build_int_cst): New, sign extended constant. * tree.h (build_int_cst): New, sign extended constant. (build_int_cstu): New, zero extended constant. (build_int_cst_wide): Renamed from build_int_cst. * tree.c (build_int_cst, build_int_cstu): New. (build_int_cst_wide): Renamed from build_int_cst. (make_vector_type, build_common_tree_nodes, build_common_tree_nodes_2): Adjust build_int_cst calls. * builtins.c (expand_builtin_prefetch, expand_builtin_strstr, expand_builtin_strpbrk, expand_builtin_fputs, build_string_literal, expand_builtin_printf, expand_builtin_sprintf, fold_builtin_classify_type, fold_builtin_lround, fold_builtin_bitop, fold_builtin_isascii, fold_builtin_toascii, fold_builtin_isdigit, simplify_builtin_strstr, simplify_builtin_strpbrk, fold_builtin_fputs, simplify_builtin_sprintf): Likewise. * c-common.c (start_fname_decls, fix_string_type, shorten_compare, DEF_ATTR_INT): Likewise. * c-decl.c (complete_array_type, check_bitfield_type_and_width): Likewise. * c-lex.c (interpret_integer, lex_charconst): Likewise. * c-parse.in (primary) <TYPES_COMPATIBLE_P> Likewise. * c-pretty-print.c (pp_c_integer_constant): Likewise. * c-typeck.c (really_start_incremental_init, push_init_level, set_nonincremental_init_from_string): Likewise. * calls.c (load_register_parameters): Likewise. convert.c (convert_to_pointer): Likewise. coverage.c (coverage_counter_alloc, tree_coverage_counter_ref, build_fn_info_type, build_fn_info_value, build_ctr_info_value, build_gcov_info): Likewise. * except.c (init_eh, assign_filter_values): Likewise. * expmed.c (store_fixed_bit_field, extract_bit_field, extract_fixed_bit_field, extract_split_bit_field, expand_shift, expand_mult_const, expand_mult_highpart_adjust, extract_high_half, expand_sdiv_pow2, expand_divmod, make_tree): Likewise. * expr.c (convert_move, emit_group_load, emit_group_store, expand_assignment, store_constructor, store_field, expand_expr_real_1, reduce_to_bit_field_precision): Likewise. fold-const.c (force_fit_type, int_const_binop, fold_convert_const, invert_truthvalue, optimize_bit_field_compare, decode_field_reference, all_ones_mask_p, constant_boolean_node, fold_div_compare, fold, fold_read_from_constant_string, fold_negate_const, fold_abs_const, fold_not_const, round_up, round_down): Likewise. * function.c (assign_parm_setup_block): Likewise. * stmt.c (shift_return_value, expand_case, estimate_case_costs): Likewise. * stor-layout.c (layout_type, initialize_sizetypes, set_min_and_max_values_for_integral_type): Likewise. * tree-chrec.c (chrec_fold_multiply_poly_poly, reset_evolution_in_loop): Likewise. * tree-chrec.h (build_polynomial_chrec): Likewise. * tree-complex.c (build_replicated_const): Likewise. * tree-eh.c (honor_protect_cleanup_actions, lower_try_finally_onedest, lower_try_finally_copy, lower_try_finally_switch): Likewise. * tree-mudflap.c (mf_build_string, mx_register_decls, mudflap_register_call, mudflap_enqueue_constant): Likewise. * tree-nested.c (get_trampoline_type, get_nl_goto_field): Likewise. * tree-pretty-print.c (dump_generic_node): Likewise. * tree-ssa-ccp.c (widen_bitfield, maybe_fold_offset_to_array_ref): Likewise. * tree-ssa-dom.c (simplify_rhs_and_lookup_avail_expr): Likewise. * tree-ssa-loop-niter.c (number_of_iterations_cond, loop_niter_by_eval, upper_bound_in_type, lower_bound_in_type): Likewise. * tree-ssa-loop-ivcanon.c (create_canonical_iv, canonicalize_loop_induction_variables): Likewise. * tree-vectorizer.c (vect_create_index_for_array_ref, vect_transform_loop_bound, vect_compute_data_ref_alignment): Likewise. * config/alpha/alpha.c (alpha_initialize_trampoline, alpha_va_start, alpha_gimplify_va_arg_1): Likewise. * config/arm/arm.c (arm_get_cookie_size): Likewise. * config/c4x/c4x.c (c4x_gimplify_va_arg_expr): Likewise. * config/i386/i386.c (ix86_va_start, ix86_gimplify_va_arg): Likewise. * config/ia64/ia64.c (ia64_gimplify_va_arg): Likewise. * config/mips/mips.c (mips_build_builtin_va_list, mips_va_start, mips_gimplify_va_arg_expr): Likewise. * config/pa/pa.c (hppa_gimplify_va_arg_expr): Likewise. * config/rs6000/rs6000.c (rs6000_va_start, rs6000_gimplify_va_arg, add_compiler_branch_island): Likewise. * config/s390/s390.c (s390_va_start): Likewise. * config/sh/sh.c (sh_va_start): Likewise. * config/stormy16/stormy16.c (xstormy16_expand_builtin_va_start): Likewise. * config/xtensa/xtensa.c (xtensa_va_start, xtensa_gimplify_va_arg_expr): Likewise. * objc/objc-act.c (build_objc_string_object, build_objc_symtab_template, init_def_list, init_objc_symtab, init_module_descriptor, generate_static_references, build_selector_translation_table, get_proto_encoding, build_typed_selector_reference, build_selector_reference, build_next_objc_exception_stuff, build_method_prototype_list_template, generate_descriptor_table, generate_protocols, build_protocol_initializer, build_ivar_list_template, build_method_list_template, build_ivar_list_initializer, generate_ivars_list, generate_dispatch_table, generate_protocol_list, build_category_initializer, build_shared_structure_initializer, generate_shared_structures, handle_impent, generate_objc_image_info): Likewise. 2004-04-25 Paolo Bonzini <bonzini@gnu.org> * cfglayout.c (duplicate_insn_chain): Remove references to NOTE_INSN_LOOP_VTOP and NOTE_INSN_LOOP_CONT. * cfgloop.h (struct loop): Remove fields vtop, cont and cont_dominator. * cfgrtl.c (rtl_delete_block): Remove handling of NOTE_INSN_LOOP_CONT. * final.c (final_scan_insn): Remove references to NOTE_INSN_LOOP_VTOP and NOTE_INSN_LOOP_CONT. * insn-notes.def (NOTE_INSN_LOOP_VTOP, NOTE_INSN_LOOP_CONT): Remove. * jump.c (squeeze_notes): Remove references to NOTE_INSN_LOOP_VTOP and NOTE_INSN_LOOP_CONT. * loop.c (scan_loops, find_and_verify_loops, for_each_insn_in_loop, check_dbra_loop, loop_dump_aux): Remove references to removed notes and fields. * reorg.c (mostly_true_jump): Do not rely on NOTE_INSN_LOOP_VTOPs. * unroll.c (unroll_loop, copy_loop_body, loop_iterations): Remove references to removed notes and fields. (subtract_reg_term, ujump_to_loop_cont): Remove. From-SVN: r86544
2004-08-25 11:52:54 +02:00
initlist = build_tree_list (NULL_TREE, build_int_cst (NULL_TREE, 0));
Yet more Objective-C++... * objc-act.c (objc_finish_try_stmt): Add return value. (objc_build_synchronized): Likewise. * objc-act.c (objc_is_gcable_type): Add. (objc_substitute_decl): Add. (objc_build_ivar_assignment): Add. (objc_build_global_assignment): Add. (objc_build_strong_cast_assignment): Add. (objc_is_ivar_reference_p): Add. (objc_is_global_reference_p): Add. (objc_generate_write_barrier): Add. (objc_rewrite_function_call): Add. (objc_gimplify_expr): Add Objective-C++ support. * objc-act.h (ALLOC_OBJC_TYPE_LANG_SPECIFIC): Likewise. (SIZEOF_OBJC_TYPE_LANG_SPECIFIC): Add. (INIT_TYPE_OBJC_INFO): Add Objective-C++ support. (DUP_TYPE_OBJC_INFO): Likewise. (struct imp_entry): Add field has_cxx_cdtors. (struct imp_entry *imp_list): Add OCTI_UMSG_FAST_DECL, OCTI_METH_LIST_TEMPL, OCTI_METH_PROTO_LIST_TEMPL, OCTI_IVAR_LIST_TEMPL, OCTI_ASSIGN_IVAR_DECL, OCTI_ASSIGN_IVAR_FAST_DECL, OCTI_ASSIGN_GLOBAL_DECL, OCTI_ASSIGN_STRONGCAST_DECL. (umsg_fast_decl): Add. (objc_assign_ivar_decl): Add. (objc_assign_ivar_fast_decl): Add. (objc_assign_global_decl): Add. (objc_assign_strong_cast_decl): Add. (objc_method_list_ptr): Add. (objc_method_proto_list_ptr): Add. (objc_ivar_list_ptr): Add. * objc-act.c (should_call_super_dealloc): Add. (OBJC_VERSION): Bump to 6. (objc_is_gcable_type): Add. (objc_substitute_decl): Add. (objc_build_ivar_assignment): Add. (objc_build_global_assignment): Add. (objc_build_strong_cast_assignment): Add. (objc_is_gcable_p): Add. (objc_is_ivar_reference_p): Add. (objc_is_global_reference_p): Add. (generate_shared_structures): Add flags parameter. (objc_generate_cxx_ctor_or_dtor): Add. (objc_generate_cxx_cdtors): Add. (add_class): Add name parameter. (objc_types_share_size_and_alignment): Add. (comp_proto_with_proto): Add strict parameter. (CLS_HAS_CXX_STRUCTORS): Add. (TAG_ASSIGNIVAR): Add. (TAG_ASSIGNGLOBAL): Add. (TAG_ASSIGNSTRONGCAST): Add. (TAG_MSGSEND_FAST): Add. (TAG_ASSIGNIVAR_FAST): Add. (TAG_CXX_CONSTRUCT): Add. (TAG_CXX_DESTRUCT): Add. (OBJC_LOOKUP_CLASS): Add. (OBJC_LOOKUP_NO_SUPER): Add. (objc_finish_file): Add pch support. (objc_finish_implementation): Add Objective-C++ support. (synth_module_prologue): Likewise. (synth_module_prologue): Add fast dispatching. (objc_get_class_reference): Add Objective-C++ support. (objc_generate_write_barrier): Likewise. (next_sjlj_build_enter_and_setjmp): Likewise. (objc_begin_try_stmt): Likewise. (build_next_objc_exception_stuff): Add fast ivar support. (build_private_template): Mark the record as used so debug information is generated. (build_protocol_template): Add Objective-C++ support. (objc_method_parm_type) Likewise. (objc_generate_cxx_ctor_or_dtor): Likewise. (objc_generate_cxx_cdtors): Likewise. (build_protocol_initializer): Likewise. (build_category_template): Likewise. (build_class_template): Likewise. (build_method_list_template): Likewise. (build_category_initializer): Likewise. (build_shared_structure_initializer): Likewise. (objc_finish_message_expr): Likewise. (build_objc_method_call): Add fast dispatch support. (lookup_method_static): Add support to end search at superclasses. (add_method_to_hash_list): Add strict parameter to comp_proto_with_proto. (objc_add_method): Likewise. (objc_add_method): Also set the interface_value. (add_instance_variable): Add Objective-C++ support. (objc_is_public): Likewise. (start_class): Likewise. (continue_class): Likewise. (encode_aggregate_within): Likewise. (start_method_def): Likewise. (objc_start_function): Clear current_function_returns_value and current_function_returns_null. (really_start_method): Add Objective-C++ support. (objc_finish_method_definition): Add warning for missing [super dealloc]. (finish_objc): Add Objective-C++ support. (generate_objc_image_info): Likewise. (objc_lookup_ivar): Likewise. * objc-act.h (TYPE_HAS_OBJC_INFO): Likewise. (INIT_TYPE_OBJC_INFO): Likewise. (DUP_TYPE_OBJC_INFO): Likewise. From-SVN: r99857
2005-05-17 22:07:08 +02:00
initlist = tree_cons (NULL_TREE, build_int_cst (NULL_TREE, flags), initlist);
Makefile.in (c-parse.o): Depend on $(C_COMMON_H). [gcc/ChangeLog] 2004-09-07 Ziemowit Laski <zlaski@apple.com> * Makefile.in (c-parse.o): Depend on $(C_COMMON_H). * c-parse.in: Include c-common.h instead of objc-act.h. (ivar_decl_list, ivar_decls, ivar_decl, ivars, ivar_declarator, myparms, myparm): Remove %type declarations. (methodtype, optparms, OBJC_TYPE_QUAL, objc_quals, objc_qual, objc_typename, objc_try_catch_stmt, optellipsis): Add %type declarations. (objc_inherit_code, objc_public_flag): Remove. (typespec_nonreserved_nonattr): Call objc_get_protocol_qualified_type() instead of get_static_reference() and get_protocol_reference(). (stmt_nocomp): Call grokparm() on @catch parameter. (objcdef): Move semantic action to objc_finish_implementation(). (classdef): Move semantic action to objc_start_class_interface(), objc_continue_interface(), objc_finish_interface(), objc_start_class_implementation(), objc_continue_implementation(), objc_start_category_interface() and objc_start_category_implementation(). (protocoldef): Move semantic actions to objc_start_protocol() and objc_finish_interface(). (ivar_decl_list): Remove nonterminal. (visibility_spec): Move semantic actions to objc_set_visibility(). (ivar_decls): Remove assignment to $$. (ivar_decl): Rephrase in terms of component_decl; call objc_add_instance_variable(). (ivars, ivar_declarator): Remove nonterminals. (opt_semi): New nonterminal. (methodtype): Remove semantic actions. (methoddef): Move semantic actions to objc_set_method_type(), objc_start_method_definition() and objc_finish_method_definition(). (methodproto): Move semantic actions to objc_set_method_type() and objc_add_method_declaration(). (methoddecl): Use objc_typename instead of typename; move semantic actions to objc_build_method_signature(). (optarglist, myxdecls, mydecl, myparms, myparm): Remove nonterminals. (optparmlist): Express in terms of optparms and optellipsis. (optparms, optellipsis, objc_qual, objc_quals, objc_typename): New nonterminals. (keyworddecl): Use objc_typename instead of typename. (rid_to_yy): Mark RID_IN, RID_OUT, RID_INOUT, RID_BYCOPY, RID_BYREF and RID_ONEWAY as returning OBJC_TYPE_QUAL to yyparse(). [gcc/objc/ChangeLog] 2004-09-07 Ziemowit Laski <zlaski@apple.com> * Make-lang.in (objc/objc-parse.o): Depend on $(C_COMMON_H) instead of objc/objc-act.h. (objc/objc-act.o): Depend on $(HASHTAB_H). * objc-act.c: Include hashtab.h; in ObjC++ mode, include cp-tree.h and objcp-decl.h instead of c-tree.h. (build_module_descriptor, get_class_ivars, synth_id_with_class_suffix, error_with_ivar, gen_method_decl, gen_declaration, setup_string_decl, build_protocol_template): Adjust prototypes. (build_module_initializer_routine, start_class, continue_class, finish_class, start_method_def, objc_start_function, start_protocol, build_method_decl, objc_add_method, add_instance_variable, build_ivar_reference, is_ivar, is_private, get_super_receiver, build_selector_table_decl, objc_push_parm, objc_get_parm_info, gen_type_name, gen_type_name_0, start_var_decl, finish_var_decl, create_field_decl): New prototypes. (objc_expand_function_end, comp_method_with_proto, objc_expr_last, gen_declaration_1, gen_declarator, is_complex_decl, adorn_decl, define_decl, create_builtin_decl, gen_declspecs): Remove prototypes. (TYPE_ID): Rename to OBJECT_TYPEDEF_NAME. (CLASS_TYPEDEF_NAME): New. (TAG_EXECCLASS): Change from a global variable to a #define. (TAG_RETURN_STRUCT): Delete. (TAG_GNUINIT): New, holds '__objc_gnu_init' name. (objc_inherit_code, objc_public_flag): New, moved from c-parse.in. (string_descriptor): New struct. (string_htab): New hash table. (string_hash, string_eq): New prototypes. (generate_struct_by_value_array): Call create_field_decl() instead of create_builtin_decl(). (objc_init): Do not initialize objc_ellipsis_node or TAG_EXECCLASS; In ObjC++ mode, call cxx_init() instead of c_objc_common_init(). (objc_finish_file): In ObjC++, call instantiate_pending_templates() and cp_finish_file(). (define_decl, get_static_reference, get_protocol_reference, create_builtin_decl): Remove functions. (objc_start_class_interface, objc_start_category_interface, objc_start_protocol, objc_continue_interface, objc_finish_interface, objc_start_class_implementation, objc_start_category_implementation, objc_continue_implementation, objc_finish_implementation, objc_set_visibility, objc_set_method_type, objc_build_method_signature, objc_add_method_declaration, objc_start_method_definition, objc_add_instance_variable, objc_get_protocol_qualified_type, create_field_decl, start_var_decl, finish_var_decl): New functions. (setup_string_decl): Simplify since it is only called once. (synth_module_prologue): Call build_class_template(); predefine 'id' and 'Class' as typedefs; rename 'temp_type' to 'type'; disable debug hooks for duration of function; fix GNU runtime messenger signatures to correspond to reality; forward-declare '__objc_exec_class' for the GNU runtime; call build_selector_table_decl(); in ObjC++ mode, generate 'extern "C" { ... }' wrappers around synthesized declarations; call build_protocol_template() and build_category_template(). (string_hash, string_eq): New functions. (objc_build_string_object): Check metaclass correctness only once; store string literals in hash table. (objc_build_constructor): Do not convert initializer elements; adjust for ObjC++ impedance mismatch. (build_objc_symtab_template): Call create_field_decl() instead of create_builtin_decl(). (init_objc_symtab): Add missing conversion to initializer element. (build_metadata_decl): Call start_var_decl() instead of define_decl(). (generate_objc_symtab_decl): Do not call build_category_template(); call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(). (build_module_descriptor): Call create_field_decl() instead of grokfield(); call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(); always mark module descriptor as used; move GNU runtime-specific functionality to build_module_initializer_routine(). (build_module_initializer_routine): New function, broken off of build_module_descriptor(). (objc_static_init_needed_p, objc_generate_static_init_call): New functions. (generate_static_references, generate_strings, build_selector_translation_table, generate_descriptor_table, generate_ivars_list, generate_dispatch_table, generate_category): Call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(); build a type directly instead of via groktypename(). (build_selector_reference_decl, build_selector_table_decl, build_class_reference_decl, build_protocol_reference, generate_objc_image_info): Call start_var_decl() instead of build_decl(). (build_selector_reference): For GNU runtime, do not call build_selector_reference_decl(). (build_selector, build_typed_selector_reference): Always convert result to the selector type. (add_objc_string): Cast return value to 'char *'. (build_method_prototype_template, build_selector_template, build_method_template): Use actual selector type for fields pointing to selectors. (finish_objc): For GNU runtime, call build_module_initializer_routine() after build_module_descriptor(). (generate_protocol_list, generate_shared_structures): Call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(); build a type directly instead of via groktypename(). (synth_id_with_class_suffix): Return a string. (get_arg_type_list): For instance methods, use the instance type for 'self'; do not call groktypename_in_parm_context(). (build_objc_string_decl): Squash redeclaration errors in ObjC++. (objc_is_class_name): Use OBJC_TYPE_NAME instead of TYPE_NAME; handle RECORD_TYPEs in ObjC as well as ObjC++. (objc_is_id): New function. (objc_is_object_ptr): Return the canonical type node. (objc_get_class_ivars): Simplify using get_class_ivars(). (get_class_ivars): Remove second parameter; create a fresh copy of the ivar list for each call; do not check for existence of super class. (objc_eh_runtime_type): Mark #ifndef OBJCPLUS. (objc_init_exceptions): When using SJLJ-style exceptions, require the use of '-fobjc-exceptions' flag; do not require it for DWARF-style exceptions. (objc_build_exc_ptr, next_sjlj_build_try_catch_finally): Use objc_object_type instead of objc_id_type. (objc_begin_catch_clause): Convert the incoming PARM_DECL into a VAR_DECL before placing it in the appropriate scope; do not call define_decl(); adjust call to c_begin_compound_stmt(); use objc_object_type instead of objc_id_type. (build_next_objc_exception_stuff): Call create_field_decl() instead of create_builtin_decl(); construct type directly instead of calling groktypename(); use OBJC_VOID_AT_END to mark end of function parameters. (build_private_template): Adjust call to get_class_ivars(); build a type directly instead of via groktypename(). (build_protocol_template, build_method_prototype_list_template, build_method_prototype_template, build_category_template, build_selector_template, build_class_template, build_super_template, build_ivar_template, build_ivar_list_template, build_method_list_template, build_method_template): Call create_field_decl() instead of grokfield(). (objc_method_parm_type): Do not call groktypename(). (generate_descriptor_table): Call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(). (generate_method_descriptors, build_protocol_initializer, generate_dispatch_tables, build_category_initializer, build_shared_structure_initializer): Do not call groktypename(). (generate_protocols): Call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(); do not call groktypename(). (error_with_ivar): Remove last parameter. (check_ivars): Do not iterate ovar CLASS_RAW_IVARS lists in addition to CLASS_IVARS lists; adjust calls to error_with_ivar(). (generate_ivar_lists): Convert one of the initializer elements; do not call groktypename(). (get_arg_type_list, start_method_def, gen_method_def): Account for new representation of variable arguments and '...' in Objective-C methods; add Objective-C++ impedance matching code. (is_objc_type_qualifier): Remove function. (adjust_type_for_id_default): Simplify; there is no longer a need to wade through declspecs. (lookup_interface, start_class, continue_class, finish_class, start_method_def, start_protocol, build_method_decl, objc_add_method, add_instance_variable, build_ivar_reference, is_ivar, is_private, get_super_receiver, objc_build_finally_epilogue): Make into static functions. (receiver_is_class_object): Use new IS_CLASS() macro. (objc_build_message_expr): Tweak ObjC++ message argument handling; call objc_finish_message_expr() instead of finish_message_expr(). (finish_message_expr): Rename to objc_finish_message_expr(); use OBJC_TYPE_NAME and OBJC_SET_TYPE_NAME macros instead of TYPE_NAME. call gen_type_name() instead of gen_declaration(); call objc_is_id() instead of using IS_ID and IS_CLASS; Use objc_class_name instead of calling get_identifier("Class"); handle CONVERT_EXPRs in receiver. (build_objc_method_call, warn_with_method): Do not call groktypename(). (build_ivar_reference): Call convert() instead of clobbering in a type. (hash_init): Initialize string_htab hash table. (add_instance_variable): Simplify parameter list; do not call grokfield(); do not populate CLASS_IVARS list. (start_class): Check for the existence of super class, if one was specified. (continue_class): Use CLASS_RAW_IVARS rather than CLASS_IVARS; do not call build_class_template(); adjust call to get_class_ivars(); call build_decl(), pushdecl() and finish_decl() instead of define_decl(). (finish_class): Call build_decl(), pushdecl() and finish_decl() instead of define_decl(). (add_protocols): Use PROTOCOL_BINFO_ELTS for the tree vector size. (start_protocol): Do not call build_protocol_template(); use PROTOCOL_BINFO_ELTS for the tree vector size. (encode_type_qualifiers): Do not handle the 'const' qualifier here. (encode_pointer): Encode 'const char *' as 'r*', for backwards compatibility. (encode_array): Use HOST_WIDE_INT_PRINT_DEC instead of "%ld". (encode_type): Handle the 'const' qualifier here. (objc_parmlist): New global variable, sued by objc_push_parm and objc_get_parm_info(). (objc_push_parm, objc_get_parm_info): New functions. (objc_expr_last): Remove function. (synth_self_and_ucmd_args): For instance methods, use the instance type for 'self'; call objc_push_parm() instead of push_parm_decl(). (start_method_def): Do not call push_scope(), declare_parm_level(), pop_scope(), push_parm_decl(), store_parm_decls() or objc_expr_last(); just use objc_push_parm() and objc_get_parm_info(). (comp_method_with_proto): Remove function. (objc_types_are_equivalent): Strip away indirections before comparing underlying types. (comp_proto_with_proto): Do not call groktypename(); types are no longer in raw declspec format. (objc_start_function): New function. (really_start_method): Call comp_proto_with_proto() instead of comp_method_with_proto(); call objc_start_function() instead of hand-crafting a function declarator. (continue_method_def, objc_expand_function_end): Remove functions. (get_super_receiver): Call objc_get_current_scope() instead of get_current_scope(); reference 'super_class' field (instead of 'class'). (finish_method_def): Rename to objc_finish_method_definition() and add a function decl parameter; move method encoding call from objc_expand_function_end(). (is_complex_decl, adorn_decl, gen_declarator, gen_declspecs, gen_declaration_1): Remove functions. (tmpbuf, RAW_DECLSPEC): Remove. (gen_declaration): Remove second parameter; simplify to deal with TYPE_P nodes instead of raw declspecs. (gen_type_name, gen_type_name_0): New functions. (gen_method_decl): Remove second parameter; call gen_type_name() instead of gen_declaration_1(). (dump_interface): Adjust calls to gen_declaration() and gen_method_decl(); do not allocate a separate string buffer. (init_objc): Allocate a larger string buffer to accommodate dump_interface(); adjust call to build_module_descriptor(); add call to build_module_initializer_routine() for the GNU runtime. (generate_classref_translation_entry): Do not call start_decl(); call finish_var_decl() instead of finish_decl(); call convert() instead of build_c_cast(). * objc-act.h (CLASS_OWN_IVARS): Remove accessor. (CLASS_BINFO_ELTS): Reduce from 6 to 5, now that CLASS_OWN_IVARS is gone. (OCTI_GNU_INIT_DECL, GNU_INIT_decl): New. (OCTI_ELLIPSIS_NODE, objc_ellipsis_node): Remove. (OCTI_ID_ID, id_type, objc_id_id): Rename to OCTI_ID_NAME, objc_object_type and objc_object_name, respectively. (OCTI_CLS_REF, OCTI_CLASS_NAME, objc_class_reference, objc_class_name): New. (IS_CLASS): New macro. (IS_ID, IS_SUPER): Robustify. (OCTI_EXECCLASS_DECL, execclass_decl): New. (finish_file, start_class, continue_class, finish_class, start_method_def, continue_method_def, finish_method_def, start_protocol, finish_protocol, objc_build_throw_stmt, objc_build_try_catch_finally_stmt, objc_build_synchronized_prologue, objc_build_synchronized_epilogue, objc_build_try_prologue, objc_build_try_epilogue, objc_build_catch_stmt, objc_build_catch_epilogue, objc_build_finally_prologue, objc_build_finally_epilogue, is_ivar, is_private, is_public, add_instance_variable, objc_add_method, get_super_receiver, objc_clear_super_receiver, get_class_ivars_from_name, get_class_reference, get_static_reference, get_object_reference, build_message_expr, finish_message_expr, build_selector_expr, build_ivar_reference, build_keyword_decl, build_method_decl, build_protocol_expr, build_objc_string_object, objc_declare_alias, objc_declare_class, objc_declare_protocols, objc_comptypes, objc_check_decl, build_encode_expr): Remove prototypes. (imp_count, cat_count): Make GGC-aware. (OBJC_SET_TYPE_NAME): New macro. From-SVN: r87168
2004-09-08 02:49:44 +02:00
initlist = objc_build_constructor (TREE_TYPE (decl), nreverse (initlist));
Makefile.in (c-parse.o): Depend on $(C_COMMON_H). [gcc/ChangeLog] 2004-09-07 Ziemowit Laski <zlaski@apple.com> * Makefile.in (c-parse.o): Depend on $(C_COMMON_H). * c-parse.in: Include c-common.h instead of objc-act.h. (ivar_decl_list, ivar_decls, ivar_decl, ivars, ivar_declarator, myparms, myparm): Remove %type declarations. (methodtype, optparms, OBJC_TYPE_QUAL, objc_quals, objc_qual, objc_typename, objc_try_catch_stmt, optellipsis): Add %type declarations. (objc_inherit_code, objc_public_flag): Remove. (typespec_nonreserved_nonattr): Call objc_get_protocol_qualified_type() instead of get_static_reference() and get_protocol_reference(). (stmt_nocomp): Call grokparm() on @catch parameter. (objcdef): Move semantic action to objc_finish_implementation(). (classdef): Move semantic action to objc_start_class_interface(), objc_continue_interface(), objc_finish_interface(), objc_start_class_implementation(), objc_continue_implementation(), objc_start_category_interface() and objc_start_category_implementation(). (protocoldef): Move semantic actions to objc_start_protocol() and objc_finish_interface(). (ivar_decl_list): Remove nonterminal. (visibility_spec): Move semantic actions to objc_set_visibility(). (ivar_decls): Remove assignment to $$. (ivar_decl): Rephrase in terms of component_decl; call objc_add_instance_variable(). (ivars, ivar_declarator): Remove nonterminals. (opt_semi): New nonterminal. (methodtype): Remove semantic actions. (methoddef): Move semantic actions to objc_set_method_type(), objc_start_method_definition() and objc_finish_method_definition(). (methodproto): Move semantic actions to objc_set_method_type() and objc_add_method_declaration(). (methoddecl): Use objc_typename instead of typename; move semantic actions to objc_build_method_signature(). (optarglist, myxdecls, mydecl, myparms, myparm): Remove nonterminals. (optparmlist): Express in terms of optparms and optellipsis. (optparms, optellipsis, objc_qual, objc_quals, objc_typename): New nonterminals. (keyworddecl): Use objc_typename instead of typename. (rid_to_yy): Mark RID_IN, RID_OUT, RID_INOUT, RID_BYCOPY, RID_BYREF and RID_ONEWAY as returning OBJC_TYPE_QUAL to yyparse(). [gcc/objc/ChangeLog] 2004-09-07 Ziemowit Laski <zlaski@apple.com> * Make-lang.in (objc/objc-parse.o): Depend on $(C_COMMON_H) instead of objc/objc-act.h. (objc/objc-act.o): Depend on $(HASHTAB_H). * objc-act.c: Include hashtab.h; in ObjC++ mode, include cp-tree.h and objcp-decl.h instead of c-tree.h. (build_module_descriptor, get_class_ivars, synth_id_with_class_suffix, error_with_ivar, gen_method_decl, gen_declaration, setup_string_decl, build_protocol_template): Adjust prototypes. (build_module_initializer_routine, start_class, continue_class, finish_class, start_method_def, objc_start_function, start_protocol, build_method_decl, objc_add_method, add_instance_variable, build_ivar_reference, is_ivar, is_private, get_super_receiver, build_selector_table_decl, objc_push_parm, objc_get_parm_info, gen_type_name, gen_type_name_0, start_var_decl, finish_var_decl, create_field_decl): New prototypes. (objc_expand_function_end, comp_method_with_proto, objc_expr_last, gen_declaration_1, gen_declarator, is_complex_decl, adorn_decl, define_decl, create_builtin_decl, gen_declspecs): Remove prototypes. (TYPE_ID): Rename to OBJECT_TYPEDEF_NAME. (CLASS_TYPEDEF_NAME): New. (TAG_EXECCLASS): Change from a global variable to a #define. (TAG_RETURN_STRUCT): Delete. (TAG_GNUINIT): New, holds '__objc_gnu_init' name. (objc_inherit_code, objc_public_flag): New, moved from c-parse.in. (string_descriptor): New struct. (string_htab): New hash table. (string_hash, string_eq): New prototypes. (generate_struct_by_value_array): Call create_field_decl() instead of create_builtin_decl(). (objc_init): Do not initialize objc_ellipsis_node or TAG_EXECCLASS; In ObjC++ mode, call cxx_init() instead of c_objc_common_init(). (objc_finish_file): In ObjC++, call instantiate_pending_templates() and cp_finish_file(). (define_decl, get_static_reference, get_protocol_reference, create_builtin_decl): Remove functions. (objc_start_class_interface, objc_start_category_interface, objc_start_protocol, objc_continue_interface, objc_finish_interface, objc_start_class_implementation, objc_start_category_implementation, objc_continue_implementation, objc_finish_implementation, objc_set_visibility, objc_set_method_type, objc_build_method_signature, objc_add_method_declaration, objc_start_method_definition, objc_add_instance_variable, objc_get_protocol_qualified_type, create_field_decl, start_var_decl, finish_var_decl): New functions. (setup_string_decl): Simplify since it is only called once. (synth_module_prologue): Call build_class_template(); predefine 'id' and 'Class' as typedefs; rename 'temp_type' to 'type'; disable debug hooks for duration of function; fix GNU runtime messenger signatures to correspond to reality; forward-declare '__objc_exec_class' for the GNU runtime; call build_selector_table_decl(); in ObjC++ mode, generate 'extern "C" { ... }' wrappers around synthesized declarations; call build_protocol_template() and build_category_template(). (string_hash, string_eq): New functions. (objc_build_string_object): Check metaclass correctness only once; store string literals in hash table. (objc_build_constructor): Do not convert initializer elements; adjust for ObjC++ impedance mismatch. (build_objc_symtab_template): Call create_field_decl() instead of create_builtin_decl(). (init_objc_symtab): Add missing conversion to initializer element. (build_metadata_decl): Call start_var_decl() instead of define_decl(). (generate_objc_symtab_decl): Do not call build_category_template(); call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(). (build_module_descriptor): Call create_field_decl() instead of grokfield(); call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(); always mark module descriptor as used; move GNU runtime-specific functionality to build_module_initializer_routine(). (build_module_initializer_routine): New function, broken off of build_module_descriptor(). (objc_static_init_needed_p, objc_generate_static_init_call): New functions. (generate_static_references, generate_strings, build_selector_translation_table, generate_descriptor_table, generate_ivars_list, generate_dispatch_table, generate_category): Call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(); build a type directly instead of via groktypename(). (build_selector_reference_decl, build_selector_table_decl, build_class_reference_decl, build_protocol_reference, generate_objc_image_info): Call start_var_decl() instead of build_decl(). (build_selector_reference): For GNU runtime, do not call build_selector_reference_decl(). (build_selector, build_typed_selector_reference): Always convert result to the selector type. (add_objc_string): Cast return value to 'char *'. (build_method_prototype_template, build_selector_template, build_method_template): Use actual selector type for fields pointing to selectors. (finish_objc): For GNU runtime, call build_module_initializer_routine() after build_module_descriptor(). (generate_protocol_list, generate_shared_structures): Call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(); build a type directly instead of via groktypename(). (synth_id_with_class_suffix): Return a string. (get_arg_type_list): For instance methods, use the instance type for 'self'; do not call groktypename_in_parm_context(). (build_objc_string_decl): Squash redeclaration errors in ObjC++. (objc_is_class_name): Use OBJC_TYPE_NAME instead of TYPE_NAME; handle RECORD_TYPEs in ObjC as well as ObjC++. (objc_is_id): New function. (objc_is_object_ptr): Return the canonical type node. (objc_get_class_ivars): Simplify using get_class_ivars(). (get_class_ivars): Remove second parameter; create a fresh copy of the ivar list for each call; do not check for existence of super class. (objc_eh_runtime_type): Mark #ifndef OBJCPLUS. (objc_init_exceptions): When using SJLJ-style exceptions, require the use of '-fobjc-exceptions' flag; do not require it for DWARF-style exceptions. (objc_build_exc_ptr, next_sjlj_build_try_catch_finally): Use objc_object_type instead of objc_id_type. (objc_begin_catch_clause): Convert the incoming PARM_DECL into a VAR_DECL before placing it in the appropriate scope; do not call define_decl(); adjust call to c_begin_compound_stmt(); use objc_object_type instead of objc_id_type. (build_next_objc_exception_stuff): Call create_field_decl() instead of create_builtin_decl(); construct type directly instead of calling groktypename(); use OBJC_VOID_AT_END to mark end of function parameters. (build_private_template): Adjust call to get_class_ivars(); build a type directly instead of via groktypename(). (build_protocol_template, build_method_prototype_list_template, build_method_prototype_template, build_category_template, build_selector_template, build_class_template, build_super_template, build_ivar_template, build_ivar_list_template, build_method_list_template, build_method_template): Call create_field_decl() instead of grokfield(). (objc_method_parm_type): Do not call groktypename(). (generate_descriptor_table): Call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(). (generate_method_descriptors, build_protocol_initializer, generate_dispatch_tables, build_category_initializer, build_shared_structure_initializer): Do not call groktypename(). (generate_protocols): Call start_var_decl() and finish_var_decl() instead of start_decl() and finish_decl(); do not call groktypename(). (error_with_ivar): Remove last parameter. (check_ivars): Do not iterate ovar CLASS_RAW_IVARS lists in addition to CLASS_IVARS lists; adjust calls to error_with_ivar(). (generate_ivar_lists): Convert one of the initializer elements; do not call groktypename(). (get_arg_type_list, start_method_def, gen_method_def): Account for new representation of variable arguments and '...' in Objective-C methods; add Objective-C++ impedance matching code. (is_objc_type_qualifier): Remove function. (adjust_type_for_id_default): Simplify; there is no longer a need to wade through declspecs. (lookup_interface, start_class, continue_class, finish_class, start_method_def, start_protocol, build_method_decl, objc_add_method, add_instance_variable, build_ivar_reference, is_ivar, is_private, get_super_receiver, objc_build_finally_epilogue): Make into static functions. (receiver_is_class_object): Use new IS_CLASS() macro. (objc_build_message_expr): Tweak ObjC++ message argument handling; call objc_finish_message_expr() instead of finish_message_expr(). (finish_message_expr): Rename to objc_finish_message_expr(); use OBJC_TYPE_NAME and OBJC_SET_TYPE_NAME macros instead of TYPE_NAME. call gen_type_name() instead of gen_declaration(); call objc_is_id() instead of using IS_ID and IS_CLASS; Use objc_class_name instead of calling get_identifier("Class"); handle CONVERT_EXPRs in receiver. (build_objc_method_call, warn_with_method): Do not call groktypename(). (build_ivar_reference): Call convert() instead of clobbering in a type. (hash_init): Initialize string_htab hash table. (add_instance_variable): Simplify parameter list; do not call grokfield(); do not populate CLASS_IVARS list. (start_class): Check for the existence of super class, if one was specified. (continue_class): Use CLASS_RAW_IVARS rather than CLASS_IVARS; do not call build_class_template(); adjust call to get_class_ivars(); call build_decl(), pushdecl() and finish_decl() instead of define_decl(). (finish_class): Call build_decl(), pushdecl() and finish_decl() instead of define_decl(). (add_protocols): Use PROTOCOL_BINFO_ELTS for the tree vector size. (start_protocol): Do not call build_protocol_template(); use PROTOCOL_BINFO_ELTS for the tree vector size. (encode_type_qualifiers): Do not handle the 'const' qualifier here. (encode_pointer): Encode 'const char *' as 'r*', for backwards compatibility. (encode_array): Use HOST_WIDE_INT_PRINT_DEC instead of "%ld". (encode_type): Handle the 'const' qualifier here. (objc_parmlist): New global variable, sued by objc_push_parm and objc_get_parm_info(). (objc_push_parm, objc_get_parm_info): New functions. (objc_expr_last): Remove function. (synth_self_and_ucmd_args): For instance methods, use the instance type for 'self'; call objc_push_parm() instead of push_parm_decl(). (start_method_def): Do not call push_scope(), declare_parm_level(), pop_scope(), push_parm_decl(), store_parm_decls() or objc_expr_last(); just use objc_push_parm() and objc_get_parm_info(). (comp_method_with_proto): Remove function. (objc_types_are_equivalent): Strip away indirections before comparing underlying types. (comp_proto_with_proto): Do not call groktypename(); types are no longer in raw declspec format. (objc_start_function): New function. (really_start_method): Call comp_proto_with_proto() instead of comp_method_with_proto(); call objc_start_function() instead of hand-crafting a function declarator. (continue_method_def, objc_expand_function_end): Remove functions. (get_super_receiver): Call objc_get_current_scope() instead of get_current_scope(); reference 'super_class' field (instead of 'class'). (finish_method_def): Rename to objc_finish_method_definition() and add a function decl parameter; move method encoding call from objc_expand_function_end(). (is_complex_decl, adorn_decl, gen_declarator, gen_declspecs, gen_declaration_1): Remove functions. (tmpbuf, RAW_DECLSPEC): Remove. (gen_declaration): Remove second parameter; simplify to deal with TYPE_P nodes instead of raw declspecs. (gen_type_name, gen_type_name_0): New functions. (gen_method_decl): Remove second parameter; call gen_type_name() instead of gen_declaration_1(). (dump_interface): Adjust calls to gen_declaration() and gen_method_decl(); do not allocate a separate string buffer. (init_objc): Allocate a larger string buffer to accommodate dump_interface(); adjust call to build_module_descriptor(); add call to build_module_initializer_routine() for the GNU runtime. (generate_classref_translation_entry): Do not call start_decl(); call finish_var_decl() instead of finish_decl(); call convert() instead of build_c_cast(). * objc-act.h (CLASS_OWN_IVARS): Remove accessor. (CLASS_BINFO_ELTS): Reduce from 6 to 5, now that CLASS_OWN_IVARS is gone. (OCTI_GNU_INIT_DECL, GNU_INIT_decl): New. (OCTI_ELLIPSIS_NODE, objc_ellipsis_node): Remove. (OCTI_ID_ID, id_type, objc_id_id): Rename to OCTI_ID_NAME, objc_object_type and objc_object_name, respectively. (OCTI_CLS_REF, OCTI_CLASS_NAME, objc_class_reference, objc_class_name): New. (IS_CLASS): New macro. (IS_ID, IS_SUPER): Robustify. (OCTI_EXECCLASS_DECL, execclass_decl): New. (finish_file, start_class, continue_class, finish_class, start_method_def, continue_method_def, finish_method_def, start_protocol, finish_protocol, objc_build_throw_stmt, objc_build_try_catch_finally_stmt, objc_build_synchronized_prologue, objc_build_synchronized_epilogue, objc_build_try_prologue, objc_build_try_epilogue, objc_build_catch_stmt, objc_build_catch_epilogue, objc_build_finally_prologue, objc_build_finally_epilogue, is_ivar, is_private, is_public, add_instance_variable, objc_add_method, get_super_receiver, objc_clear_super_receiver, get_class_ivars_from_name, get_class_reference, get_static_reference, get_object_reference, build_message_expr, finish_message_expr, build_selector_expr, build_ivar_reference, build_keyword_decl, build_method_decl, build_protocol_expr, build_objc_string_object, objc_declare_alias, objc_declare_class, objc_declare_protocols, objc_comptypes, objc_check_decl, build_encode_expr): Remove prototypes. (imp_count, cat_count): Make GGC-aware. (OBJC_SET_TYPE_NAME): New macro. From-SVN: r87168
2004-09-08 02:49:44 +02:00
finish_var_decl (decl, initlist);
}
/* Look up ID as an instance variable. OTHER contains the result of
the C or C++ lookup, which we may want to use instead. */
tree
objc_lookup_ivar (tree other, tree id)
{
tree ivar;
/* If we are not inside of an ObjC method, ivar lookup makes no sense. */
if (!objc_method_context)
return other;
if (!strcmp (IDENTIFIER_POINTER (id), "super"))
/* We have a message to super. */
return get_super_receiver ();
/* In a class method, look up an instance variable only as a last
resort. */
if (TREE_CODE (objc_method_context) == CLASS_METHOD_DECL
&& other && other != error_mark_node)
return other;
/* 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;
/* In an instance method, a local variable (or parameter) may hide the
instance variable. */
if (TREE_CODE (objc_method_context) == INSTANCE_METHOD_DECL
Yet more Objective-C++... * objc-act.c (objc_finish_try_stmt): Add return value. (objc_build_synchronized): Likewise. * objc-act.c (objc_is_gcable_type): Add. (objc_substitute_decl): Add. (objc_build_ivar_assignment): Add. (objc_build_global_assignment): Add. (objc_build_strong_cast_assignment): Add. (objc_is_ivar_reference_p): Add. (objc_is_global_reference_p): Add. (objc_generate_write_barrier): Add. (objc_rewrite_function_call): Add. (objc_gimplify_expr): Add Objective-C++ support. * objc-act.h (ALLOC_OBJC_TYPE_LANG_SPECIFIC): Likewise. (SIZEOF_OBJC_TYPE_LANG_SPECIFIC): Add. (INIT_TYPE_OBJC_INFO): Add Objective-C++ support. (DUP_TYPE_OBJC_INFO): Likewise. (struct imp_entry): Add field has_cxx_cdtors. (struct imp_entry *imp_list): Add OCTI_UMSG_FAST_DECL, OCTI_METH_LIST_TEMPL, OCTI_METH_PROTO_LIST_TEMPL, OCTI_IVAR_LIST_TEMPL, OCTI_ASSIGN_IVAR_DECL, OCTI_ASSIGN_IVAR_FAST_DECL, OCTI_ASSIGN_GLOBAL_DECL, OCTI_ASSIGN_STRONGCAST_DECL. (umsg_fast_decl): Add. (objc_assign_ivar_decl): Add. (objc_assign_ivar_fast_decl): Add. (objc_assign_global_decl): Add. (objc_assign_strong_cast_decl): Add. (objc_method_list_ptr): Add. (objc_method_proto_list_ptr): Add. (objc_ivar_list_ptr): Add. * objc-act.c (should_call_super_dealloc): Add. (OBJC_VERSION): Bump to 6. (objc_is_gcable_type): Add. (objc_substitute_decl): Add. (objc_build_ivar_assignment): Add. (objc_build_global_assignment): Add. (objc_build_strong_cast_assignment): Add. (objc_is_gcable_p): Add. (objc_is_ivar_reference_p): Add. (objc_is_global_reference_p): Add. (generate_shared_structures): Add flags parameter. (objc_generate_cxx_ctor_or_dtor): Add. (objc_generate_cxx_cdtors): Add. (add_class): Add name parameter. (objc_types_share_size_and_alignment): Add. (comp_proto_with_proto): Add strict parameter. (CLS_HAS_CXX_STRUCTORS): Add. (TAG_ASSIGNIVAR): Add. (TAG_ASSIGNGLOBAL): Add. (TAG_ASSIGNSTRONGCAST): Add. (TAG_MSGSEND_FAST): Add. (TAG_ASSIGNIVAR_FAST): Add. (TAG_CXX_CONSTRUCT): Add. (TAG_CXX_DESTRUCT): Add. (OBJC_LOOKUP_CLASS): Add. (OBJC_LOOKUP_NO_SUPER): Add. (objc_finish_file): Add pch support. (objc_finish_implementation): Add Objective-C++ support. (synth_module_prologue): Likewise. (synth_module_prologue): Add fast dispatching. (objc_get_class_reference): Add Objective-C++ support. (objc_generate_write_barrier): Likewise. (next_sjlj_build_enter_and_setjmp): Likewise. (objc_begin_try_stmt): Likewise. (build_next_objc_exception_stuff): Add fast ivar support. (build_private_template): Mark the record as used so debug information is generated. (build_protocol_template): Add Objective-C++ support. (objc_method_parm_type) Likewise. (objc_generate_cxx_ctor_or_dtor): Likewise. (objc_generate_cxx_cdtors): Likewise. (build_protocol_initializer): Likewise. (build_category_template): Likewise. (build_class_template): Likewise. (build_method_list_template): Likewise. (build_category_initializer): Likewise. (build_shared_structure_initializer): Likewise. (objc_finish_message_expr): Likewise. (build_objc_method_call): Add fast dispatch support. (lookup_method_static): Add support to end search at superclasses. (add_method_to_hash_list): Add strict parameter to comp_proto_with_proto. (objc_add_method): Likewise. (objc_add_method): Also set the interface_value. (add_instance_variable): Add Objective-C++ support. (objc_is_public): Likewise. (start_class): Likewise. (continue_class): Likewise. (encode_aggregate_within): Likewise. (start_method_def): Likewise. (objc_start_function): Clear current_function_returns_value and current_function_returns_null. (really_start_method): Add Objective-C++ support. (objc_finish_method_definition): Add warning for missing [super dealloc]. (finish_objc): Add Objective-C++ support. (generate_objc_image_info): Likewise. (objc_lookup_ivar): Likewise. * objc-act.h (TYPE_HAS_OBJC_INFO): Likewise. (INIT_TYPE_OBJC_INFO): Likewise. (DUP_TYPE_OBJC_INFO): Likewise. From-SVN: r99857
2005-05-17 22:07:08 +02:00
&& other && other != error_mark_node
#ifdef OBJCPLUS
&& CP_DECL_CONTEXT (other) != global_namespace)
#else
&& !DECL_FILE_SCOPE_P (other))
#endif
{
diagnostic.c (warning): Accept parameter to classify warning option. * diagnostic.c (warning): Accept parameter to classify warning option. (warning0): New, for when a pointer to an error() like function is needed. * errors.c (warning): Likewise. * errors.h (warning, warning0): Adjust prototypes. * toplev.h (warning, warning0): Likewise. * attribs.c, builtins.c, c-common.c, c-decl.c, c-format.c, c-gimplify.c, c-lex.c, c-objc-common.c, c-opts.c, c-parser.c, c-pragma.c, c-typeck.c, calls.c, cgraph.c, coverage.c, emit-rtl.c, fold-const.c, fortran/trans-decl.c, function.c, gcse.c, genautomata.c, haifa-sched.c, opts.c, passes.c, regclass.c, reload1.c, stmt.c, stor-layout.c, toplev.c, tree-cfg.c, tree-dump.c, tree-inline.c, tree-mudflap.c, tree-optimize.c, tree-ssa.c, tree.c, varasm.c: Adjust warning() callers. * config/alpha/alpha.c, config/arc/arc.c, config/arm/arm.c, config/avr/avr.c, config/bfin/bfin.c, config/c4x/c4x-c.c, config/c4x/c4x.c, config/cris/cris.c, config/darwin-c.c, config/darwin.c, config/darwin.h, config/h8300/h8300.c, config/i386/cygming.h, config/i386/djgpp.h, config/i386/i386.c, config/i386/winnt.c, config/ia64/ia64-c.c, config/ia64/ia64.c, config/ip2k/ip2k.c, config/m32r/m32r.c, config/m68hc11/m68hc11.c, config/m68k/m68k.c, config/mcore/mcore.c, config/mips/mips.c, config/mmix/mmix.c, config/ns32k/ns32k.c, config/pa/pa-hpux11.h, config/pa/pa.c, config/rs6000/aix43.h, config/rs6000/aix51.h, config/rs6000/aix52.h, config/rs6000/darwin.h, config/rs6000/rs6000-c.c, config/rs6000/rs6000.c, config/s390/s390.c, config/sh/sh.c, config/sh/sh.h, config/sh/symbian.c, config/sol2-c.c, config/sol2.c, config/stormy16/stormy16.c, config/v850/v850-c.c, config/v850/v850.c, config/xtensa/xtensa.c: Adjust warning() callers. * ada/misc.c: Adjust warning() callers. * cp/call.c, cp/class.c, cp/cvt.c, cp/decl.c, cp/decl2.c, cp/except.c, cp/friend.c, cp/init.c, cp/lex.c, cp/mangle.c, cp/method.c, cp/name-lookup.c, cp/parser.c, cp/repo.c, cp/rtti.c, cp/tree.c, cp/typeck.c, cp/typeck2.c: Adjust warning() callers. * fortran/trans-decl.c: Adjust warning() callers. * java/class.c, java/decl.c, java/expr.c, java/jcf-io.c, java/jcf-parse.c, java/jv-scan.c, java/parse.y: Adjust warning() callers. * objc/objc-act.c: Adjust warning() callers. * treelang/parse.y: Adjust warning() callers. From-SVN: r98633
2005-04-23 23:29:07 +02:00
warning (0, "local declaration of %qs hides instance variable",
IDENTIFIER_POINTER (id));
return other;
}
/* At this point, we are either in an instance method with no obscuring
local definitions, or in a class method with no alternate definitions
at all. */
return build_ivar_reference (id);
}
Yet more Objective-C++... * objc-act.c (objc_finish_try_stmt): Add return value. (objc_build_synchronized): Likewise. * objc-act.c (objc_is_gcable_type): Add. (objc_substitute_decl): Add. (objc_build_ivar_assignment): Add. (objc_build_global_assignment): Add. (objc_build_strong_cast_assignment): Add. (objc_is_ivar_reference_p): Add. (objc_is_global_reference_p): Add. (objc_generate_write_barrier): Add. (objc_rewrite_function_call): Add. (objc_gimplify_expr): Add Objective-C++ support. * objc-act.h (ALLOC_OBJC_TYPE_LANG_SPECIFIC): Likewise. (SIZEOF_OBJC_TYPE_LANG_SPECIFIC): Add. (INIT_TYPE_OBJC_INFO): Add Objective-C++ support. (DUP_TYPE_OBJC_INFO): Likewise. (struct imp_entry): Add field has_cxx_cdtors. (struct imp_entry *imp_list): Add OCTI_UMSG_FAST_DECL, OCTI_METH_LIST_TEMPL, OCTI_METH_PROTO_LIST_TEMPL, OCTI_IVAR_LIST_TEMPL, OCTI_ASSIGN_IVAR_DECL, OCTI_ASSIGN_IVAR_FAST_DECL, OCTI_ASSIGN_GLOBAL_DECL, OCTI_ASSIGN_STRONGCAST_DECL. (umsg_fast_decl): Add. (objc_assign_ivar_decl): Add. (objc_assign_ivar_fast_decl): Add. (objc_assign_global_decl): Add. (objc_assign_strong_cast_decl): Add. (objc_method_list_ptr): Add. (objc_method_proto_list_ptr): Add. (objc_ivar_list_ptr): Add. * objc-act.c (should_call_super_dealloc): Add. (OBJC_VERSION): Bump to 6. (objc_is_gcable_type): Add. (objc_substitute_decl): Add. (objc_build_ivar_assignment): Add. (objc_build_global_assignment): Add. (objc_build_strong_cast_assignment): Add. (objc_is_gcable_p): Add. (objc_is_ivar_reference_p): Add. (objc_is_global_reference_p): Add. (generate_shared_structures): Add flags parameter. (objc_generate_cxx_ctor_or_dtor): Add. (objc_generate_cxx_cdtors): Add. (add_class): Add name parameter. (objc_types_share_size_and_alignment): Add. (comp_proto_with_proto): Add strict parameter. (CLS_HAS_CXX_STRUCTORS): Add. (TAG_ASSIGNIVAR): Add. (TAG_ASSIGNGLOBAL): Add. (TAG_ASSIGNSTRONGCAST): Add. (TAG_MSGSEND_FAST): Add. (TAG_ASSIGNIVAR_FAST): Add. (TAG_CXX_CONSTRUCT): Add. (TAG_CXX_DESTRUCT): Add. (OBJC_LOOKUP_CLASS): Add. (OBJC_LOOKUP_NO_SUPER): Add. (objc_finish_file): Add pch support. (objc_finish_implementation): Add Objective-C++ support. (synth_module_prologue): Likewise. (synth_module_prologue): Add fast dispatching. (objc_get_class_reference): Add Objective-C++ support. (objc_generate_write_barrier): Likewise. (next_sjlj_build_enter_and_setjmp): Likewise. (objc_begin_try_stmt): Likewise. (build_next_objc_exception_stuff): Add fast ivar support. (build_private_template): Mark the record as used so debug information is generated. (build_protocol_template): Add Objective-C++ support. (objc_method_parm_type) Likewise. (objc_generate_cxx_ctor_or_dtor): Likewise. (objc_generate_cxx_cdtors): Likewise. (build_protocol_initializer): Likewise. (build_category_template): Likewise. (build_class_template): Likewise. (build_method_list_template): Likewise. (build_category_initializer): Likewise. (build_shared_structure_initializer): Likewise. (objc_finish_message_expr): Likewise. (build_objc_method_call): Add fast dispatch support. (lookup_method_static): Add support to end search at superclasses. (add_method_to_hash_list): Add strict parameter to comp_proto_with_proto. (objc_add_method): Likewise. (objc_add_method): Also set the interface_value. (add_instance_variable): Add Objective-C++ support. (objc_is_public): Likewise. (start_class): Likewise. (continue_class): Likewise. (encode_aggregate_within): Likewise. (start_method_def): Likewise. (objc_start_function): Clear current_function_returns_value and current_function_returns_null. (really_start_method): Add Objective-C++ support. (objc_finish_method_definition): Add warning for missing [super dealloc]. (finish_objc): Add Objective-C++ support. (generate_objc_image_info): Likewise. (objc_lookup_ivar): Likewise. * objc-act.h (TYPE_HAS_OBJC_INFO): Likewise. (INIT_TYPE_OBJC_INFO): Likewise. (DUP_TYPE_OBJC_INFO): Likewise. From-SVN: r99857
2005-05-17 22:07:08 +02:00
/* Possibly rewrite a function CALL into an OBJ_TYPE_REF expression. This
needs to be done if we are calling a function through a cast. */
tree
objc_rewrite_function_call (tree function, tree params)
{
if (TREE_CODE (function) == NOP_EXPR
&& TREE_CODE (TREE_OPERAND (function, 0)) == ADDR_EXPR
&& TREE_CODE (TREE_OPERAND (TREE_OPERAND (function, 0), 0))
== FUNCTION_DECL)
{
function = build3 (OBJ_TYPE_REF, TREE_TYPE (function),
TREE_OPERAND (function, 0),
TREE_VALUE (params), size_zero_node);
Yet more Objective-C++... * objc-act.c (objc_finish_try_stmt): Add return value. (objc_build_synchronized): Likewise. * objc-act.c (objc_is_gcable_type): Add. (objc_substitute_decl): Add. (objc_build_ivar_assignment): Add. (objc_build_global_assignment): Add. (objc_build_strong_cast_assignment): Add. (objc_is_ivar_reference_p): Add. (objc_is_global_reference_p): Add. (objc_generate_write_barrier): Add. (objc_rewrite_function_call): Add. (objc_gimplify_expr): Add Objective-C++ support. * objc-act.h (ALLOC_OBJC_TYPE_LANG_SPECIFIC): Likewise. (SIZEOF_OBJC_TYPE_LANG_SPECIFIC): Add. (INIT_TYPE_OBJC_INFO): Add Objective-C++ support. (DUP_TYPE_OBJC_INFO): Likewise. (struct imp_entry): Add field has_cxx_cdtors. (struct imp_entry *imp_list): Add OCTI_UMSG_FAST_DECL, OCTI_METH_LIST_TEMPL, OCTI_METH_PROTO_LIST_TEMPL, OCTI_IVAR_LIST_TEMPL, OCTI_ASSIGN_IVAR_DECL, OCTI_ASSIGN_IVAR_FAST_DECL, OCTI_ASSIGN_GLOBAL_DECL, OCTI_ASSIGN_STRONGCAST_DECL. (umsg_fast_decl): Add. (objc_assign_ivar_decl): Add. (objc_assign_ivar_fast_decl): Add. (objc_assign_global_decl): Add. (objc_assign_strong_cast_decl): Add. (objc_method_list_ptr): Add. (objc_method_proto_list_ptr): Add. (objc_ivar_list_ptr): Add. * objc-act.c (should_call_super_dealloc): Add. (OBJC_VERSION): Bump to 6. (objc_is_gcable_type): Add. (objc_substitute_decl): Add. (objc_build_ivar_assignment): Add. (objc_build_global_assignment): Add. (objc_build_strong_cast_assignment): Add. (objc_is_gcable_p): Add. (objc_is_ivar_reference_p): Add. (objc_is_global_reference_p): Add. (generate_shared_structures): Add flags parameter. (objc_generate_cxx_ctor_or_dtor): Add. (objc_generate_cxx_cdtors): Add. (add_class): Add name parameter. (objc_types_share_size_and_alignment): Add. (comp_proto_with_proto): Add strict parameter. (CLS_HAS_CXX_STRUCTORS): Add. (TAG_ASSIGNIVAR): Add. (TAG_ASSIGNGLOBAL): Add. (TAG_ASSIGNSTRONGCAST): Add. (TAG_MSGSEND_FAST): Add. (TAG_ASSIGNIVAR_FAST): Add. (TAG_CXX_CONSTRUCT): Add. (TAG_CXX_DESTRUCT): Add. (OBJC_LOOKUP_CLASS): Add. (OBJC_LOOKUP_NO_SUPER): Add. (objc_finish_file): Add pch support. (objc_finish_implementation): Add Objective-C++ support. (synth_module_prologue): Likewise. (synth_module_prologue): Add fast dispatching. (objc_get_class_reference): Add Objective-C++ support. (objc_generate_write_barrier): Likewise. (next_sjlj_build_enter_and_setjmp): Likewise. (objc_begin_try_stmt): Likewise. (build_next_objc_exception_stuff): Add fast ivar support. (build_private_template): Mark the record as used so debug information is generated. (build_protocol_template): Add Objective-C++ support. (objc_method_parm_type) Likewise. (objc_generate_cxx_ctor_or_dtor): Likewise. (objc_generate_cxx_cdtors): Likewise. (build_protocol_initializer): Likewise. (build_category_template): Likewise. (build_class_template): Likewise. (build_method_list_template): Likewise. (build_category_initializer): Likewise. (build_shared_structure_initializer): Likewise. (objc_finish_message_expr): Likewise. (build_objc_method_call): Add fast dispatch support. (lookup_method_static): Add support to end search at superclasses. (add_method_to_hash_list): Add strict parameter to comp_proto_with_proto. (objc_add_method): Likewise. (objc_add_method): Also set the interface_value. (add_instance_variable): Add Objective-C++ support. (objc_is_public): Likewise. (start_class): Likewise. (continue_class): Likewise. (encode_aggregate_within): Likewise. (start_method_def): Likewise. (objc_start_function): Clear current_function_returns_value and current_function_returns_null. (really_start_method): Add Objective-C++ support. (objc_finish_method_definition): Add warning for missing [super dealloc]. (finish_objc): Add Objective-C++ support. (generate_objc_image_info): Likewise. (objc_lookup_ivar): Likewise. * objc-act.h (TYPE_HAS_OBJC_INFO): Likewise. (INIT_TYPE_OBJC_INFO): Likewise. (DUP_TYPE_OBJC_INFO): Likewise. From-SVN: r99857
2005-05-17 22:07:08 +02:00
}
return function;
}
/* Look for the special case of OBJC_TYPE_REF with the address of
a function in OBJ_TYPE_REF_EXPR (presumably objc_msgSend or one
of its cousins). */
objc-act.c (objc_build_struct): New function. * objc-act.c (objc_build_struct): New function. (objc_derived_from_p): Likewise. (objc_build_component_ref): Likewise. (objc_copy_binfo): Likewise. (objc_xref_basetypes): Likewise. (objc_lookup_protocol): Likewise. (objc_compare_protocols): Likewise. (objc_volatilize_decl): Likewise. (encode_aggregate_fields): Likewise. (volatilized_hash): Likewise. (volatilized_eq): Likewise. (objc_compare_types): Likewise. (objc_type_quals_match): Likewise. (DERIVED_FROM_P): New ObjC macro, corresponding to C++ macro of same name. (get_class_ivars): Add second parameter indicating if entire hierarchy is desired. (struct volatilized_type): New type. (volatilized_htab): New hash table. (objc_types_compatible_p, objc_comptypes): Remove functions. (synth_module_prologue): Do not initialize 'unused_list'. (objc_get_class_reference): Fix ObjC++ impedance mismatches. (objc_declare_alias): Implement as a typedef. (objc_substitute_decl, objc_gimplify_expr): Reformat. (objc_get_class_ivars): Adjust call to get_class_ivars(). (next_sjlj_build_enter_and_setjmp, synth_forward_declarations, build_ivar_reference, get_super_receiver): Call objc_build_component_ref() instead of build_component_ref(). (objc_begin_catch_clause): Use DERIVED_FROM_P() instead of objc_comptypes(). (build_private_template): Call objc_build_struct() instead of start_struct() and finish_struct(). (hash_init): Initialize volatilized_htab. (objc_is_public): Adjust calls to objc_get_ivars(); adjust ObjC++ impedance mismatches. (encode_aggregate_within): Streamline by calling encode_aggregate_fields(). * objc-act.h (objc_types_compatible_p): Remove prototype. (OCTI_UNUSED_LIST, unused_list): Remove slot. * objc-lang.c (LANG_HOOKS_TYPES_COMPATIBLE_P): Remove. From-SVN: r100123
2005-05-25 00:21:01 +02:00
enum gimplify_status
objc_gimplify_expr (tree *expr_p, tree *pre_p, tree *post_p)
{
enum gimplify_status r0, r1;
objc-act.c (objc_build_struct): New function. * objc-act.c (objc_build_struct): New function. (objc_derived_from_p): Likewise. (objc_build_component_ref): Likewise. (objc_copy_binfo): Likewise. (objc_xref_basetypes): Likewise. (objc_lookup_protocol): Likewise. (objc_compare_protocols): Likewise. (objc_volatilize_decl): Likewise. (encode_aggregate_fields): Likewise. (volatilized_hash): Likewise. (volatilized_eq): Likewise. (objc_compare_types): Likewise. (objc_type_quals_match): Likewise. (DERIVED_FROM_P): New ObjC macro, corresponding to C++ macro of same name. (get_class_ivars): Add second parameter indicating if entire hierarchy is desired. (struct volatilized_type): New type. (volatilized_htab): New hash table. (objc_types_compatible_p, objc_comptypes): Remove functions. (synth_module_prologue): Do not initialize 'unused_list'. (objc_get_class_reference): Fix ObjC++ impedance mismatches. (objc_declare_alias): Implement as a typedef. (objc_substitute_decl, objc_gimplify_expr): Reformat. (objc_get_class_ivars): Adjust call to get_class_ivars(). (next_sjlj_build_enter_and_setjmp, synth_forward_declarations, build_ivar_reference, get_super_receiver): Call objc_build_component_ref() instead of build_component_ref(). (objc_begin_catch_clause): Use DERIVED_FROM_P() instead of objc_comptypes(). (build_private_template): Call objc_build_struct() instead of start_struct() and finish_struct(). (hash_init): Initialize volatilized_htab. (objc_is_public): Adjust calls to objc_get_ivars(); adjust ObjC++ impedance mismatches. (encode_aggregate_within): Streamline by calling encode_aggregate_fields(). * objc-act.h (objc_types_compatible_p): Remove prototype. (OCTI_UNUSED_LIST, unused_list): Remove slot. * objc-lang.c (LANG_HOOKS_TYPES_COMPATIBLE_P): Remove. From-SVN: r100123
2005-05-25 00:21:01 +02:00
if (TREE_CODE (*expr_p) == OBJ_TYPE_REF
&& TREE_CODE (OBJ_TYPE_REF_EXPR (*expr_p)) == ADDR_EXPR
objc-act.c (objc_build_struct): New function. * objc-act.c (objc_build_struct): New function. (objc_derived_from_p): Likewise. (objc_build_component_ref): Likewise. (objc_copy_binfo): Likewise. (objc_xref_basetypes): Likewise. (objc_lookup_protocol): Likewise. (objc_compare_protocols): Likewise. (objc_volatilize_decl): Likewise. (encode_aggregate_fields): Likewise. (volatilized_hash): Likewise. (volatilized_eq): Likewise. (objc_compare_types): Likewise. (objc_type_quals_match): Likewise. (DERIVED_FROM_P): New ObjC macro, corresponding to C++ macro of same name. (get_class_ivars): Add second parameter indicating if entire hierarchy is desired. (struct volatilized_type): New type. (volatilized_htab): New hash table. (objc_types_compatible_p, objc_comptypes): Remove functions. (synth_module_prologue): Do not initialize 'unused_list'. (objc_get_class_reference): Fix ObjC++ impedance mismatches. (objc_declare_alias): Implement as a typedef. (objc_substitute_decl, objc_gimplify_expr): Reformat. (objc_get_class_ivars): Adjust call to get_class_ivars(). (next_sjlj_build_enter_and_setjmp, synth_forward_declarations, build_ivar_reference, get_super_receiver): Call objc_build_component_ref() instead of build_component_ref(). (objc_begin_catch_clause): Use DERIVED_FROM_P() instead of objc_comptypes(). (build_private_template): Call objc_build_struct() instead of start_struct() and finish_struct(). (hash_init): Initialize volatilized_htab. (objc_is_public): Adjust calls to objc_get_ivars(); adjust ObjC++ impedance mismatches. (encode_aggregate_within): Streamline by calling encode_aggregate_fields(). * objc-act.h (objc_types_compatible_p): Remove prototype. (OCTI_UNUSED_LIST, unused_list): Remove slot. * objc-lang.c (LANG_HOOKS_TYPES_COMPATIBLE_P): Remove. From-SVN: r100123
2005-05-25 00:21:01 +02:00
&& TREE_CODE (TREE_OPERAND (OBJ_TYPE_REF_EXPR (*expr_p), 0))
== FUNCTION_DECL)
{
/* Postincrements in OBJ_TYPE_REF_OBJECT don't affect the
value of the OBJ_TYPE_REF, so force them to be emitted
during subexpression evaluation rather than after the
OBJ_TYPE_REF. This permits objc_msgSend calls in Objective
C to use direct rather than indirect calls when the
object expression has a postincrement. */
r0 = gimplify_expr (&OBJ_TYPE_REF_OBJECT (*expr_p), pre_p, NULL,
is_gimple_val, fb_rvalue);
r1 = gimplify_expr (&OBJ_TYPE_REF_EXPR (*expr_p), pre_p, post_p,
is_gimple_val, fb_rvalue);
objc-act.c (objc_build_struct): New function. * objc-act.c (objc_build_struct): New function. (objc_derived_from_p): Likewise. (objc_build_component_ref): Likewise. (objc_copy_binfo): Likewise. (objc_xref_basetypes): Likewise. (objc_lookup_protocol): Likewise. (objc_compare_protocols): Likewise. (objc_volatilize_decl): Likewise. (encode_aggregate_fields): Likewise. (volatilized_hash): Likewise. (volatilized_eq): Likewise. (objc_compare_types): Likewise. (objc_type_quals_match): Likewise. (DERIVED_FROM_P): New ObjC macro, corresponding to C++ macro of same name. (get_class_ivars): Add second parameter indicating if entire hierarchy is desired. (struct volatilized_type): New type. (volatilized_htab): New hash table. (objc_types_compatible_p, objc_comptypes): Remove functions. (synth_module_prologue): Do not initialize 'unused_list'. (objc_get_class_reference): Fix ObjC++ impedance mismatches. (objc_declare_alias): Implement as a typedef. (objc_substitute_decl, objc_gimplify_expr): Reformat. (objc_get_class_ivars): Adjust call to get_class_ivars(). (next_sjlj_build_enter_and_setjmp, synth_forward_declarations, build_ivar_reference, get_super_receiver): Call objc_build_component_ref() instead of build_component_ref(). (objc_begin_catch_clause): Use DERIVED_FROM_P() instead of objc_comptypes(). (build_private_template): Call objc_build_struct() instead of start_struct() and finish_struct(). (hash_init): Initialize volatilized_htab. (objc_is_public): Adjust calls to objc_get_ivars(); adjust ObjC++ impedance mismatches. (encode_aggregate_within): Streamline by calling encode_aggregate_fields(). * objc-act.h (objc_types_compatible_p): Remove prototype. (OCTI_UNUSED_LIST, unused_list): Remove slot. * objc-lang.c (LANG_HOOKS_TYPES_COMPATIBLE_P): Remove. From-SVN: r100123
2005-05-25 00:21:01 +02:00
return MIN (r0, r1);
}
objc-act.c (objc_build_struct): New function. * objc-act.c (objc_build_struct): New function. (objc_derived_from_p): Likewise. (objc_build_component_ref): Likewise. (objc_copy_binfo): Likewise. (objc_xref_basetypes): Likewise. (objc_lookup_protocol): Likewise. (objc_compare_protocols): Likewise. (objc_volatilize_decl): Likewise. (encode_aggregate_fields): Likewise. (volatilized_hash): Likewise. (volatilized_eq): Likewise. (objc_compare_types): Likewise. (objc_type_quals_match): Likewise. (DERIVED_FROM_P): New ObjC macro, corresponding to C++ macro of same name. (get_class_ivars): Add second parameter indicating if entire hierarchy is desired. (struct volatilized_type): New type. (volatilized_htab): New hash table. (objc_types_compatible_p, objc_comptypes): Remove functions. (synth_module_prologue): Do not initialize 'unused_list'. (objc_get_class_reference): Fix ObjC++ impedance mismatches. (objc_declare_alias): Implement as a typedef. (objc_substitute_decl, objc_gimplify_expr): Reformat. (objc_get_class_ivars): Adjust call to get_class_ivars(). (next_sjlj_build_enter_and_setjmp, synth_forward_declarations, build_ivar_reference, get_super_receiver): Call objc_build_component_ref() instead of build_component_ref(). (objc_begin_catch_clause): Use DERIVED_FROM_P() instead of objc_comptypes(). (build_private_template): Call objc_build_struct() instead of start_struct() and finish_struct(). (hash_init): Initialize volatilized_htab. (objc_is_public): Adjust calls to objc_get_ivars(); adjust ObjC++ impedance mismatches. (encode_aggregate_within): Streamline by calling encode_aggregate_fields(). * objc-act.h (objc_types_compatible_p): Remove prototype. (OCTI_UNUSED_LIST, unused_list): Remove slot. * objc-lang.c (LANG_HOOKS_TYPES_COMPATIBLE_P): Remove. From-SVN: r100123
2005-05-25 00:21:01 +02:00
Yet more Objective-C++... * objc-act.c (objc_finish_try_stmt): Add return value. (objc_build_synchronized): Likewise. * objc-act.c (objc_is_gcable_type): Add. (objc_substitute_decl): Add. (objc_build_ivar_assignment): Add. (objc_build_global_assignment): Add. (objc_build_strong_cast_assignment): Add. (objc_is_ivar_reference_p): Add. (objc_is_global_reference_p): Add. (objc_generate_write_barrier): Add. (objc_rewrite_function_call): Add. (objc_gimplify_expr): Add Objective-C++ support. * objc-act.h (ALLOC_OBJC_TYPE_LANG_SPECIFIC): Likewise. (SIZEOF_OBJC_TYPE_LANG_SPECIFIC): Add. (INIT_TYPE_OBJC_INFO): Add Objective-C++ support. (DUP_TYPE_OBJC_INFO): Likewise. (struct imp_entry): Add field has_cxx_cdtors. (struct imp_entry *imp_list): Add OCTI_UMSG_FAST_DECL, OCTI_METH_LIST_TEMPL, OCTI_METH_PROTO_LIST_TEMPL, OCTI_IVAR_LIST_TEMPL, OCTI_ASSIGN_IVAR_DECL, OCTI_ASSIGN_IVAR_FAST_DECL, OCTI_ASSIGN_GLOBAL_DECL, OCTI_ASSIGN_STRONGCAST_DECL. (umsg_fast_decl): Add. (objc_assign_ivar_decl): Add. (objc_assign_ivar_fast_decl): Add. (objc_assign_global_decl): Add. (objc_assign_strong_cast_decl): Add. (objc_method_list_ptr): Add. (objc_method_proto_list_ptr): Add. (objc_ivar_list_ptr): Add. * objc-act.c (should_call_super_dealloc): Add. (OBJC_VERSION): Bump to 6. (objc_is_gcable_type): Add. (objc_substitute_decl): Add. (objc_build_ivar_assignment): Add. (objc_build_global_assignment): Add. (objc_build_strong_cast_assignment): Add. (objc_is_gcable_p): Add. (objc_is_ivar_reference_p): Add. (objc_is_global_reference_p): Add. (generate_shared_structures): Add flags parameter. (objc_generate_cxx_ctor_or_dtor): Add. (objc_generate_cxx_cdtors): Add. (add_class): Add name parameter. (objc_types_share_size_and_alignment): Add. (comp_proto_with_proto): Add strict parameter. (CLS_HAS_CXX_STRUCTORS): Add. (TAG_ASSIGNIVAR): Add. (TAG_ASSIGNGLOBAL): Add. (TAG_ASSIGNSTRONGCAST): Add. (TAG_MSGSEND_FAST): Add. (TAG_ASSIGNIVAR_FAST): Add. (TAG_CXX_CONSTRUCT): Add. (TAG_CXX_DESTRUCT): Add. (OBJC_LOOKUP_CLASS): Add. (OBJC_LOOKUP_NO_SUPER): Add. (objc_finish_file): Add pch support. (objc_finish_implementation): Add Objective-C++ support. (synth_module_prologue): Likewise. (synth_module_prologue): Add fast dispatching. (objc_get_class_reference): Add Objective-C++ support. (objc_generate_write_barrier): Likewise. (next_sjlj_build_enter_and_setjmp): Likewise. (objc_begin_try_stmt): Likewise. (build_next_objc_exception_stuff): Add fast ivar support. (build_private_template): Mark the record as used so debug information is generated. (build_protocol_template): Add Objective-C++ support. (objc_method_parm_type) Likewise. (objc_generate_cxx_ctor_or_dtor): Likewise. (objc_generate_cxx_cdtors): Likewise. (build_protocol_initializer): Likewise. (build_category_template): Likewise. (build_class_template): Likewise. (build_method_list_template): Likewise. (build_category_initializer): Likewise. (build_shared_structure_initializer): Likewise. (objc_finish_message_expr): Likewise. (build_objc_method_call): Add fast dispatch support. (lookup_method_static): Add support to end search at superclasses. (add_method_to_hash_list): Add strict parameter to comp_proto_with_proto. (objc_add_method): Likewise. (objc_add_method): Also set the interface_value. (add_instance_variable): Add Objective-C++ support. (objc_is_public): Likewise. (start_class): Likewise. (continue_class): Likewise. (encode_aggregate_within): Likewise. (start_method_def): Likewise. (objc_start_function): Clear current_function_returns_value and current_function_returns_null. (really_start_method): Add Objective-C++ support. (objc_finish_method_definition): Add warning for missing [super dealloc]. (finish_objc): Add Objective-C++ support. (generate_objc_image_info): Likewise. (objc_lookup_ivar): Likewise. * objc-act.h (TYPE_HAS_OBJC_INFO): Likewise. (INIT_TYPE_OBJC_INFO): Likewise. (DUP_TYPE_OBJC_INFO): Likewise. From-SVN: r99857
2005-05-17 22:07:08 +02:00
#ifdef OBJCPLUS
return cp_gimplify_expr (expr_p, pre_p, post_p);
#else
return c_gimplify_expr (expr_p, pre_p, post_p);
Yet more Objective-C++... * objc-act.c (objc_finish_try_stmt): Add return value. (objc_build_synchronized): Likewise. * objc-act.c (objc_is_gcable_type): Add. (objc_substitute_decl): Add. (objc_build_ivar_assignment): Add. (objc_build_global_assignment): Add. (objc_build_strong_cast_assignment): Add. (objc_is_ivar_reference_p): Add. (objc_is_global_reference_p): Add. (objc_generate_write_barrier): Add. (objc_rewrite_function_call): Add. (objc_gimplify_expr): Add Objective-C++ support. * objc-act.h (ALLOC_OBJC_TYPE_LANG_SPECIFIC): Likewise. (SIZEOF_OBJC_TYPE_LANG_SPECIFIC): Add. (INIT_TYPE_OBJC_INFO): Add Objective-C++ support. (DUP_TYPE_OBJC_INFO): Likewise. (struct imp_entry): Add field has_cxx_cdtors. (struct imp_entry *imp_list): Add OCTI_UMSG_FAST_DECL, OCTI_METH_LIST_TEMPL, OCTI_METH_PROTO_LIST_TEMPL, OCTI_IVAR_LIST_TEMPL, OCTI_ASSIGN_IVAR_DECL, OCTI_ASSIGN_IVAR_FAST_DECL, OCTI_ASSIGN_GLOBAL_DECL, OCTI_ASSIGN_STRONGCAST_DECL. (umsg_fast_decl): Add. (objc_assign_ivar_decl): Add. (objc_assign_ivar_fast_decl): Add. (objc_assign_global_decl): Add. (objc_assign_strong_cast_decl): Add. (objc_method_list_ptr): Add. (objc_method_proto_list_ptr): Add. (objc_ivar_list_ptr): Add. * objc-act.c (should_call_super_dealloc): Add. (OBJC_VERSION): Bump to 6. (objc_is_gcable_type): Add. (objc_substitute_decl): Add. (objc_build_ivar_assignment): Add. (objc_build_global_assignment): Add. (objc_build_strong_cast_assignment): Add. (objc_is_gcable_p): Add. (objc_is_ivar_reference_p): Add. (objc_is_global_reference_p): Add. (generate_shared_structures): Add flags parameter. (objc_generate_cxx_ctor_or_dtor): Add. (objc_generate_cxx_cdtors): Add. (add_class): Add name parameter. (objc_types_share_size_and_alignment): Add. (comp_proto_with_proto): Add strict parameter. (CLS_HAS_CXX_STRUCTORS): Add. (TAG_ASSIGNIVAR): Add. (TAG_ASSIGNGLOBAL): Add. (TAG_ASSIGNSTRONGCAST): Add. (TAG_MSGSEND_FAST): Add. (TAG_ASSIGNIVAR_FAST): Add. (TAG_CXX_CONSTRUCT): Add. (TAG_CXX_DESTRUCT): Add. (OBJC_LOOKUP_CLASS): Add. (OBJC_LOOKUP_NO_SUPER): Add. (objc_finish_file): Add pch support. (objc_finish_implementation): Add Objective-C++ support. (synth_module_prologue): Likewise. (synth_module_prologue): Add fast dispatching. (objc_get_class_reference): Add Objective-C++ support. (objc_generate_write_barrier): Likewise. (next_sjlj_build_enter_and_setjmp): Likewise. (objc_begin_try_stmt): Likewise. (build_next_objc_exception_stuff): Add fast ivar support. (build_private_template): Mark the record as used so debug information is generated. (build_protocol_template): Add Objective-C++ support. (objc_method_parm_type) Likewise. (objc_generate_cxx_ctor_or_dtor): Likewise. (objc_generate_cxx_cdtors): Likewise. (build_protocol_initializer): Likewise. (build_category_template): Likewise. (build_class_template): Likewise. (build_method_list_template): Likewise. (build_category_initializer): Likewise. (build_shared_structure_initializer): Likewise. (objc_finish_message_expr): Likewise. (build_objc_method_call): Add fast dispatch support. (lookup_method_static): Add support to end search at superclasses. (add_method_to_hash_list): Add strict parameter to comp_proto_with_proto. (objc_add_method): Likewise. (objc_add_method): Also set the interface_value. (add_instance_variable): Add Objective-C++ support. (objc_is_public): Likewise. (start_class): Likewise. (continue_class): Likewise. (encode_aggregate_within): Likewise. (start_method_def): Likewise. (objc_start_function): Clear current_function_returns_value and current_function_returns_null. (really_start_method): Add Objective-C++ support. (objc_finish_method_definition): Add warning for missing [super dealloc]. (finish_objc): Add Objective-C++ support. (generate_objc_image_info): Likewise. (objc_lookup_ivar): Likewise. * objc-act.h (TYPE_HAS_OBJC_INFO): Likewise. (INIT_TYPE_OBJC_INFO): Likewise. (DUP_TYPE_OBJC_INFO): Likewise. From-SVN: r99857
2005-05-17 22:07:08 +02:00
#endif
}
/* Given a CALL expression, find the function being called. The ObjC
version looks for the OBJ_TYPE_REF_EXPR which is used for objc_msgSend. */
tree
objc_get_callee_fndecl (tree call_expr)
{
tree.h (enum tree_code_class): Add tcc_vl_exp. 2007-02-15 Sandra Loosemore <sandra@codesourcery.com> Brooks Moses <brooks.moses@codesourcery.com> Lee Millward <lee.millward@codesourcery.com> * tree.h (enum tree_code_class): Add tcc_vl_exp. (VL_EXP_CLASS_P): New. (TREE_OPERAND_CHECK): Use TREE_OPERAND_LENGTH instead of TREE_CODE_LENGTH. (TREE_OPERAND_CHECK_CODE): Likewise. (GIMPLE_STMT_OPERAND_CHECK): Likewise. (TREE_RTL_OPERAND_CHECK): Likewise. (tree_operand_check_failed): Make second parameter the whole tree instead of its code. Fixed callers. (VL_EXP_CHECK): New. (TREE_OPERAND_LENGTH): New. (VL_EXP_OPERAND_LENGTH): New. (CALL_EXPR_FN): New. (CALL_EXPR_STATIC_CHAIN): New. (CALL_EXPR_ARGS): New. (CALL_EXPR_ARG): New. (call_expr_nargs): New. (CALL_EXPR_ARGP): New. (build_nt_call_list): Declare. (build_vl_exp_stat): Declare. (build_vl_exp): New. (build_call_list): Declare. (build_call_nary): Declare. (build_call_valist): Declare. (build_call_array): Declare. (call_expr_arg): Declare. (call_expr_argp): Declare. (call_expr_arglist): Declare. (fold_build_call_list): Declare. (fold_build_call_list_initializer): Declare. (fold_call_expr): Declare to replace fold_builtin. (fold_builtin_fputs): Update to agree with modified definition. (fold_builtin_strcpy): Likewise. (fold_builtin_strncpy): Likewise. (fold_builtin_memory_chk): Likewise. (fold_builtin_stxcpy_chk): Likewise. (fold_builtin_strncpy_chk): Likewise. (fold_builtin_next_arg): Likewise. (fold_build_call_expr): Declare. (fold_builtin_call_list): Declare. (fold_builtin_call_valist): Declare. (build_call_expr): Declare. (validate_arglist): Update to agree with modified definition. (tree_operand_length): New. (call_expr_arg_iterator): New. (init_call_expr_arg_iterator): New. (next_call_expr_arg): New. (first_call_expr_arg): New. (more_call_expr_args_p): New. (FOR_EACH_CALL_EXPR_ARG): New. * tree.c (tree_code_class_string): Add entries for tcc_vl_exp and tcc_gimple_stmt. (tree_code_size): Update documentation. Use sizeof (tree) rather than sizeof (char *). (tree_size): Likewise. Add case for tcc_vl_exp. (tree_node_structure): Add case for tcc_vl_exp. (contains_placeholder_p): Likewise. (substitute_in_expr): Likewise. (substitute_placeholder_in_expr): Likewise. (stabilize_reference_1): Likewise. (build3_stat): Remove logic for CALL_EXPRs. Replace with assertion to diagnose breakage of this interface for constructing CALL_EXPRs. (build_nt): Add similar assertion here. (build_nt_call_list): New. (simple_cst_equal) <CALL_EXPR>: Rewrite to use new accessors. (iterative_hash_expr): Use TREE_OPERAND_LENGTH instead of TREE_CODE_LENGTH. (get_callee_fndecl): Use new CALL_EXPR accessors. (tree_operand_check_failed): Change parameters to pass entire node instead of its code, so that we can call TREE_OPERAND_LENGTH on it. (process_call_operands): New. (build_vl_exp_stat): New. (build_call_list): New. (build_call_nary): New. (build_call_valist): New. (build_call_array): New. (walk_tree): Use TREE_OPERAND_LENGTH instead of TREE_CODE_LENGTH. (call_expr_arglist): New. * tree.def (CALL_EXPR): Change representation of CALL_EXPRs to use tcc_vl_exp instead of a fixed-size tcc_expression. * doc/c-tree.texi (CALL_EXPR): Document new representation and accessors for CALL_EXPRs. (AGGR_INIT_EXPR): Likewise. 2007-02-15 Sandra Loosemore <sandra@codesourcery.com> Brooks Moses <brooks.moses@codesourcery.com> Lee Millward <lee.millward@codesourcery.com> * builtins.c (c_strlen): Return NULL_TREE instead of 0. (expand_builtin_nonlocal_goto): Change parameter to be entire CALL_EXPR instead of an arglist. Use new CALL_EXPR accessors. (expand_builtin_prefetch): Likewise. (expand_builtin_classify_type): Likewise. (mathfn_built_in): Return NULL_TREE instead of 0. (expand_errno_check): Use new CALL_EXPR accessors. (expand_builtin_mathfn): Use new CALL_EXPR accessors and constructors. Return NULL_RTX instead of 0. (expand_builtin_mathfn_2): Likewise. (expand_builtin_mathfn_3): Likewise. (expand_builtin_interclass_mathfn): Likewise. (expand_builtin_sincos): Likewise. (expand_builtin_cexpi): Likewise. (expand_builtin_int_roundingfn): Likewise. (expand_builtin_int_roundingfn_2): Likewise. (expand_builtin_pow): Likewise. (expand_builtin_powi): Likewise. (expand_builtin_strlen): Pass entire CALL_EXPR as parameter instead of arglist, fixing callers appropriately. Use new CALL_EXPR accessors and constructors. Return NULL_RTX instead of 0. (expand_builtin_strstr): Likewise. (expand_builtin_strchr): Likewise. (expand_builtin_strrchr): Likewise. (expand_builtin_strpbrk): Likewise. (expand_builtin_memcpy): Likewise. (expand_builtin_mempcpy): Likewise. (expand_builtin_mempcpy_args): New. (expand_builtin_memmove): Similarly to expand_builtin_mempcpy. (expand_builtin_memmove_args): New. (expand_builtin_bcopy): Similarly to expand_builtin_mempcpy. (expand_movstr): Likewise. (expand_builtin_strcpy): Likewise. (expand_builtin_strcpy_args): New. (expand_builtin_stpcpy): Similarly to expand_builtin_strcpy. (expand_builtin_strncpy): Likewise. (expand_builtin_memset): Likewise. (expand_builtin_memset_args): New. (expand_builtin_bzero): Similarly to expand_builtin_memset. (expand_builtin_memcmp): Likewise. (expand_builtin_strcmp): Likewise. (expand_builtin_strncmp): Likewise. (expand_builtin_strcat): Likewise. (expand_builtin_strncat): Likewise. (expand_builtin_strspn): Likewise. (expand_builtin_strcspn): Likewise. (expand_builtin_args_info): Likewise. (expand_builtin_va_start): Likewise. (gimplify_va_arg_expr): Likewise. (expand_builtin_va_end): Likewise. (expand_builtin_va_copy): Likewise. (expand_builtin_frame_address): Likewise. (expand_builtin_alloca): Likewise. (expand_builtin_bswap): Likewise. (expand_builtin_unop): Likewise. (expand_builtin_fputs): Likewise. (expand_builtin_expect): Likewise. (expand_builtin_fabs): Likewise. (expand_builtin_copysign): Likewise. (expand_builtin_printf): Likewise. (expand_builtin_fprintf): Likewise. (expand_builtin_sprintf): Likewise. (expand_builtin_init_trampoline): Likewise. (expand_builtin_signbit): Likewise. (expand_builtin_fork_or_exec): Likewise. (expand_builtin_sync_operation): Likewise. (expand_builtin_compare_and_swap): Likewise. (expand_builtin_lock_test_and_set): Likewise. (expand_builtin_lock_release): Likewise. (expand_builtin): Likewise. (builtin_mathfn_code): Likewise. (fold_builtin_constant_p): Pass call arguments individually instead of as an arglist, fixing callers appropriately. Use new CALL_EXPR accessors and constructors. Return NULL_TREE instead of 0. (fold_builtin_expect): Likewise. (fold_builtin_classify_type): Likewise. (fold_builtin_strlen): Likewise. (fold_builtin_nan): Likewise. (integer_valued_real_p): Likewise. (fold_trunc_transparent_mathfn): Likewise. (fold_fixed_mathfn): Likewise. (fold_builtin_cabs): Likewise. (fold_builtin_sqrt): Likewise. (fold_builtin_cbrt): Likewise. (fold_builtin_cos): Likewise. (fold_builtin_cosh): Likewise. (fold_builtin_tan): Likewise. (fold_builtin_sincos): Likewise. (fold_builtin_cexp): Likewise. (fold_builtin_trunc): Likewise. (fold_builtin_floor): Likewise. (fold_builtin_ceil): Likewise. (fold_builtin_round): Likewise. (fold_builtin_int_roundingfn): Likewise. (fold_builtin_bitop): Likewise. (fold_builtin_bswap): Likewise. (fold_builtin_logarithm): Likewise. (fold_builtin_hypot): Likewise. (fold_builtin_pow): Likewise. (fold_builtin_powi): Likewise. (fold_builtin_exponent): Likewise. (fold_builtin_memset): Likewise. (fold_builtin_bzero): Likewise. (fold_builtin_memory_op): Likewise. (fold_builtin_bcopy): Deleted; call site changed to invoke fold_builtin_memory_op directly. (fold_builtin_strcpy): Similarly as for fold_builtin_memory_op. (fold_builtin_strncpy): Likewise. (fold_builtin_memcmp): Likewise. (fold_builtin_strcmp): Likewise. (fold_builtin_strncmp): Likewise. (fold_builtin_signbit): Likewise. (fold_builtin_copysign): Likewise. (fold_builtin_isascii): Likewise. (fold_builtin_toascii): Likewise. (fold_builtin_isdigit): Likewise. (fold_builtin_fabs): Likewise. (fold_builtin_abs): Likewise. (fold_builtin_fmin_fmax): Likewise. (fold_builtin_carg): Likewise. (fold_builtin_classify): Likewise. (fold_builtin_unordered_cmp): Likewise. (fold_builtin_0, fold_builtin_2, fold_builtin_3, fold_builtin_4): New functions split out from fold_builtin_1. (fold_builtin_n): New. (fold_builtin_varargs): New. (fold_builtin): Deleted. Most callers changed to use fold_call_expr instead. (fold_call_expr): New. (build_function_call_expr): Rewrite to use new helper function. (fold_builtin_call_list): New. (build_call_expr): New. (fold_builtin_call_valist): New. (rewrite_call_expr): New. (validate_arg): New. (validate_arglist): Change parameter to be entire CALL_EXPR instead of an arglist. Change return type to bool. Use new CALL_EXPR accessors. (fold_builtin_strstr): Pass call arguments individually instead of as an arglist, fixing callers appropriately. Use new CALL_EXPR accessors and constructors. Return NULL_TREE instead of 0. (fold_builtin_strchr): Likewise. (fold_builtin_strrchr): Likewise. (fold_builtin_strpbrk): Likewise. (fold_builtin_strcat): Likewise. (fold_builtin_strncat): Likewise. (fold_builtin_strspn): Likewise. (fold_builtin_strcspn): Likewise. (fold_builtin_fputs): Likewise. (fold_builtin_next_arg): Likewise. (fold_builtin_sprintf): Likewise. (expand_builtin_object_size): Use new CALL_EXPR accessors. Use NULL_RTX instead of 0. (expand_builtin_memory_chk): Likewise. (maybe_emit_chk_warning): Likewise. (maybe_emit_sprintf_chk_warning): Likewise. (fold_builtin_object_size): Pass call arguments individually instead of as an arglist, fixing callers appropriately. Use new CALL_EXPR accessors and constructors. Return NULL_TREE instead of 0. (fold_builtin_memory_chk): Likewise. (fold_builtin_stxcpy_chk): Likewise. (fold_builtin_strncpy_chk): Likewise. (fold_builtin_strcat_chk): Likewise. (fold_builtin_strcat_chk): Likewise. (fold_builtin_strncat_chk): Likewise. (fold_builtin_sprintf_chk): Likewise. (fold_builtin_snprintf_chk): Likewise. (fold_builtin_printf): Likewise. (fold_builtin_vprintf): Likewise. * fold-const.c (negate_expr_p): Use new CALL_EXPR accessors and constructors. (operand_equal_p): Add separate tcc_vl_exp/CALL_EXPR case. (make_range): Use TREE_OPERAND_LENGTH instead of TREE_CODE_LENGTH. (extract_muldiv_1): Add VL_EXP_CLASS_P case. (fold_mathfn_compare): Use new CALL_EXPR accessors and constructors. (fold_unary): Likewise. (fold_binary): Likewise. (fold_ternary): Remove CALL_EXPR case, since they are no longer ternary expressions. (fold): Add logic for tcc_vl_exp. (fold_checksum_tree): Make it know about tcc_vl_exp. Use TREE_OPERAND_LENGTH instead of TREE_CODE_LENGTH. (fold_build3_stat): Add assertion to flag broken interface for constructing CALL_EXPRs. (fold_build_call_list): New. (fold_build_call_list_initializer): New. (tree_expr_nonnegative_p): Use new CALL_EXPR accessors and constructors. (fold_strip_sign_ops): Likewise. 2007-02-15 Sandra Loosemore <sandra@codesourcery.com> Brooks Moses <brooks.moses@codesourcery.com> Lee Millward <lee.millward@codesourcery.com> * tree-dump.c (dequeue_and_dump) <CALL_EXPR>: Use new CALL_EXPR accessors and dump arguments explicitly. * tree-pretty-print.c (do_niy): Use TREE_OPERAND_LENGTH instead of TREE_CODE_LENGTH. (dump_generic_node): Use new CALL_EXPR accessors and walk arguments explicitly. (print_call_name): Use new CALL_EXPR accessors. * print-tree.c (print_node): Add case tcc_vl_exp. Print CALL_EXPR arguments explicitly instead of as a list. Use TREE_OPERAND_LENGTH instead of TREE_CODE_LENGTH. * tree-vrp.c (stmt_interesting_for_vrp): Use new CALL_EXPR accessors. (vrp_visit_stmt): Likewise. * tree-ssa-loop-im.c (outermost_invariant_loop_expr): Make it know about tcc_vl_exp. Use TREE_OPERAND_LENGTH instead of TREE_CODE_LENGTH. (force_move_till_expr): Likewise. * targhooks.c (default_external_stack_protect_fail): Use build_call_expr instead of build_function_call_expr. (default_hidden_stack_protect_fail): Likewise. * tree-complex.c (expand_complex_libcall): Use build_call_expr to build the call. * cgraphbuild.c (build_cgraph_edges): Use new CALL_EXPR accessors and walk arguments explicitly. * tree-ssa-loop-niter.c (simplify_replace_tree): Use TREE_OPERAND_LENGTH instead of TREE_CODE_LENGTH. (expand_simple_operations): Likewise. (infer_loop_bounds_from_array): Use new CALL_EXPR accessors. * gengtype.c (adjust_field_tree_exp): Use TREE_OPERAND_LENGTH instead of TREE_CODE_LENGTH. (walk_type): Tweak walking of arrays not to blow up on CALL_EXPRs. * optabs.c (expand_widen_pattern-expr): Use TREE_OPERAND_LENGTH instead of TREE_CODE_LENGTH. * value_prof.c (tree_ic): Use new CALL_EXPR accessors. (tree_ic_transform): Likewise. (interesting_stringop_to_profile_p): Pass entire CALL_EXPR as parameter instead of arglist. Fix callers. (tree_stringop_fixed_value): Use new CALL_EXPR accessors. (tree_stringops_transform): Likewise. (tree_indirect_call_to_profile): Likewise. (tree_stringops_values_to_profile): Likewise. * tree-tailcall.c (find_tail_calls): Use new CALL_EXPR iterator. (eliminate_tail_call): Likewise. * ipa-cp.c (ipcp_update_callgraph): Use new CALL_EXPR accessors. * tree-scalar-evolution.c (chrec_contains_symbols_defined_in_loop): Use TREE_OPERAND_LENGTH and generalize to handle any number of operands. (instantiate_parameters_1): Can't handle tcc_vl_exp here. * omp-low.c (build_omp_barrier): Use build_call_expr. (lower_rec_input_clauses): Likewise. (lower_reduction_clauses): Likewise. (expand_parallel_call): Likewise. (maybe_catch_exception): Likewise. (expand_omp_for_generic): Likewise. (expand_omp_for_static_nochunk): Likewise. (expand_omp_sections): Likewise. (lower_omp_single_simple): Likewise. (lower_omp_single_copy): Likewise. (lower_omp_master): Likewise. (lower_omp_ordered): Likewise. (lower_omp_critical): Likewise. * ipa-reference.c (check-call): Use new CALL_EXPR iterator. (scan_for_static_refs): Create tcc_vl_exp case for CALL_EXPR. * tree-gimple.c (is_gimple_call_addr): Fix doc. (recalculate_side_effects): Use TREE_OPERAND_LENGTH instead of TREE_CODE_LENGTH. Add tcc_vl_exp case. * tree-chrec.c (chrec_contains_symbols): Use TREE_OPERAND_LENGTH and generalize to handle any number of operands. (chrec_contains_undetermined): Likewise. (tree_contains_chrecs): Likewise. (evolution_function_is_invariant_rec_p): Use TREE_OPERAND_LENGTH. * cgraphunit.c (update_call_expr): Use new CALL_EXPR accessors. * tree-ssa-ccp.c (ccp_fold): Use new CALL_EXPR accessors. Use fold_call_expr instead of fold_builtin. (ccp_fold_builtin): Likewise. Update calls into builtins.c to match declarations there. (fold_stmt): Use new CALL_EXPR constructor and accessors. Doc updates. * tree-ssa-loop-ivopts.c (expr_invariant_in_loop_p): Use TREE_OPERAND_LENGTH instead of TREE_CODE_LENGTH. * ipa-pure-const.c (check_call): Use new CALL_EXPR accessors. (scan_function): Add case tcc_vl_exp for CALL_EXPR. * tree-stdarg.c (execute_optimize_stdarg): Use new CALL_EXPR accessors. * tree-ssa-math-opts.c (execute_cse_sincos_1): Use build_call_expr. (execute_cse_sincos): Use new CALL_EXPR accessors. * tree-ssa-alias.c (find_used_portions): Use new CALL_EXPR iterator. * gimple-low.c (lower_function_body): Use build_call_expr. (lower_builtin_setjmp): Likewise. * expr.c (emit_block_move_via_libcall): Use build_call_expr. (set_storage_via_libcall): Likewise. (safe_from_p): Add tcc_vl_exp case. Use TREE_OPERAND_LENGTH instead of TREE_CODE_LENGTH. (expand_expr_real_1): Use new CALL_EXPR accessors. * tree-browser.c (store_child_info): Use TREE_OPERAND_LENGTH and generalize to handle any number of operands. (TB_parent_eq): Likewise. * predict.c (expr_expected_value): Use new CALL_EXPR accessors. (strip_builtin_expect): Likewise. * function.c (gimplify_parameters): Use build_call_expr. * tree-vectorizer.c (vect_is_simple_reduction): Use TREE_OPERAND_LENGTH instead of TREE_CODE_LENGTH. * ipa-type-escape.c (check_call): Use new CALL_EXPR iterators. (scan_for_refs): Add case tcc_vl_exp for CALL_EXPR. * tree-data-ref.c (get_references_in_stmt): Use new CALL_EXPR iterators. * gimplify.c (build_stack_save_restore): Use build_call_expr. (gimplify_decl_expr): Likewise. (gimplify_call_expr): Use fold_call_expr instead of fold_builtin. Use new CALL_EXPR iterators. (gimplify_modify_expr_to_memcpy): Use build_call_expr. (gimplify_modify_expr_to_memset): Likewise. (gimplify_variable_sized_compare): Likewise. (gimplify_omp_atomic_fetch_op): Likewise. (gimplify_omp_atomic_pipeline): Likewise. (gimplify_omp_atomic_mutex): Likewise. (gimplify_function_tree): Likewise. * calls.c (alloca_call_p): Use new CALL_EXPR accessors. (call_expr_flags): Likewise. (expand_call): Likewise. * except.c (expand_builtin_eh_return_data_regno): Pass entire CALL_EXPR as parameter instead of arglist. Use new CALL_EXPR accessors. * coverage.c (create_coverage): Use build_call_expr. * tree-ssa-pre.c (expression_node_pool, list_node_pool): Delete. (temp_call_expr_obstack): New. (pool_copy_list): Delete. (temp_copy_call_expr): New. (phi_translate): Add case tcc_vl_exp for CALL_EXPR. Use new CALL_EXPR accessors. Get rid of special goo for copying argument lists and use temp_copy_call_expr instead. (valid_in_sets): Add case tcc_vl_exp for CALL_EXPR. Use new CALL_EXPR accessors. (create_expression_by_pieces): Likewise. Use build_call_array to construct the result instead of fold_build3. (create_value_expr_from): Add tcc_vl_exp. Delete special goo for dealing with argument lists. (init_pre): Remove references to expression_node_pool and list_node_pool. Init temp_call_expr_obstack instead. (fini_pre): Remove references to expression_node_pool and list_node_pool. * tree-sra.c (sra_walk_call_expr): Use new CALL_EXPR accessors and walk arguments explicitly instead of as a list. * tree-mudflap.c (mf_build_check_statement_for): Use build_call_expr. (mx_register_decls): Likewise. (mudflap_register_call): Likewise. (mudflap_finish_file): Likewise. * ipa-prop.c (ipa_callsite_compute_count): Use new CALL_EXPR accessors. (ipa_callsite_compute_param): Likewise. * tree-vect-patterns.c (vect_recog_pow_pattern): Use new CALL_EXPR accessors and constructor. * tree-nested.c (convert_nl_goto_reference): Use new CALL_EXPR accessors and constructor. (convert_tramp_reference): Likewise. (convert_call_expr): Likewise. (finalize_nesting_tree_1): Likewise. * tree-ssa.c (tree_ssa_useless_type_conversion): Use new CALL_EXPR accessors. * tree-ssa-loop-prefetch.c (issue_prefetch_ref): Use build_call_expr. * tree-inline.c (initialize_inlined_parameters): Pass entire CALL_EXPR as parameter instead of arglist. Use new CALL_EXPR accessors. (estimate_num_insns_1): Use new CALL_EXPR accessors. (expand_call_inline): Tidy up call to initialize_inlined_parameters. * tree-vect-transform.c (vect_create_epilog_for_reduction): Use TREE_OPERAND_LENGTH instead of TREE_CODE_LENGTH. (vectorizable_reduction): Likewise. (vectorizable_call): Use new CALL_EXPR iterators. (vectorizable_conversion): Use build_call_expr. (vectorizable_operation): Use TREE_OPERAND_LENGTH. (vect_gen_widened_results_half): Use build_call_expr. (vect_setup_realignment): Likewise. (vectorizable_live_operation): Use TREE_OPERAND_LENGTH. * tree-object-size.c (alloc_object_size): Use new CALL_EXPR accessors. (pass_through_call): Likewise. (compute_object_sizes): Likewise. Use fold_call_expr instead of fold_builtin. * tree-profile.c (tree_gen_interval_profiler): Use build_call_expr. (tree_gen_pow2_profiler): Likewise. (tree_gen_one_value_profiler): Likewise. (tree_gen_ic_func_profiler): Likewise. (tree_gen_average_profiler): Likewise. (tree_gen_ior_profiler): Likewise. * tree-ssa-structalias.c (get_constraint_for): Add case tcc_vl_exp. (find_func_aliases): Use new CALL_EXPR accessors. Add case tcc_vl_exp. Use TREE_OPERAND_LENGTH instead of TREE_CODE_LENGTH. * tree-ssa-reassoc.c (get_rank): Use TREE_OPERAND_LENGTH instead of TREE_CODE_LENGTH. * stmt.c (warn_if_unused_value): Use TREE_OPERAND_LENGTH instead of TREE_CODE_LENGTH. * convert.c (convert_to_real): Use new CALL_EXPR accessors and constructor. (convert_to_integer): Likewise. * tree-ssa-operands.c (get_call_expr_operands): Use new CALL_EXPR accessors. 2007-02-15 Sandra Loosemore <sandra@codesourcery.com> Brooks Moses <brooks.moses@codesourcery.com> Lee Millward <lee.millward@codesourcery.com> * config/alpha/alpha.c (alpha_expand_builtin): Use new CALL_EXPR accessors. * config/frv/frv.c (frv_expand_builtin): Likewise. * config/s390/s390.c (s390_expand_builtin): Likewise. * config/sparc/sparc.c (sparc_gimplify_va_arg): Use build_call_expr. (sparc_expand_builtin): Use new CALL_EXPR accessors. * config/i386/i386.c (ix86_function_ok_for_sibcall): Likewise. (ix86_expand_binop_builtin): Pass entire CALL_EXPR as parameter instead of arglist. Use new CALL_EXPR accessors on it. Fix callers. (ix86_expand_store_builtin): Likewise. (ix86_expand_unop_builtin): Likewise. (ix86_expand_unop1_builtin): Likewise. (ix86_expand_sse_compare): Likewise. (ix86_expand_sse_comi): Likewise. (ix86_expand_vec_init_builtin): Likewise. (ix86_expand_vec_ext_builtin): Likewise. (ix86_expand_vec_set_builtin): Likewise. (ix86_expand_builtin): Use new CALL_EXPR accessors. * config/sh/sh.c (sh_expand_builtin): Use new CALL_EXPR accessors. * config/c4x/c4x.c (c4x_expand_builtin): Likewise. * config/iq2000/iq2000.c (expand_one_builtin): Pass entire CALL_EXPR instead of arglist. Use new CALL_EXPR accessors. Fix callers. (iq2000_expand_builtin): Use new CALL_EXPR accessors. * config/rs6000/rs6000-c.c (altivec_build_resolved_builtin): Use build_call_expr. * config/rs6000/rs6000.c (rs6000_gimplify_va_arg): Likewise. (rs6000_expand_unop_builtin): Pass entire CALL_EXPR instead of arglist. Use new CALL_EXPR accessors. Fix callers. (altivec_expand_abs_builtin): Likewise. (rs6000_expand_binop_builtin): Likewise. (altivec_expand_predicate_builtin): Likewise. (altivec_expand_lv_builtin): Likewise. (spe_expand_stv_builtin): Likewise. (altivec_expand_stv_builtin): Likewise. (rs6000_expand_ternop_builtin): Likewise. (altivec_expand_ld_builtin): Use new CALL_EXPR accessors. (altivec_expand_st_builtin): Likewise. (altivec_expand_dst_builtin): Likewise. (altivec_expand_vec_init_builtin): Pass entire CALL_EXPR instead of arglist. Use new CALL_EXPR accessors. Fix callers. (altivec_expand_vec_set_builtin): Likewise. (altivec_expand_vec_ext_builtin): Likewise. (altivec_expand_builtin): Use new CALL_EXPR accessors. (spe_expand_builtin): Likewise. (spe_expand_predicate_builtin): Pass entire CALL_EXPR instead of arglist. Use new CALL_EXPR accessors. Fix callers. (spe_expand_evsel_builtin): Likewise. (rs6000_expand_builtin): Use new CALL_EXPR accessors. VCFUX and FCFSX cases must construct whole new CALL_EXPR, not just arglist. * config/arm/arm.c (arm_expand_binop_builtin): Pass entire CALL_EXPR instead of arglist. Use new CALL_EXPR accessors. Fix callers. (arm_expand_unop_builtin): Likewise. (arm_expand_builtin): Use new CALL_EXPR accessors. * config/mips/mips.c (mips_expand_builtin): Use new CALL_EXPR accessors. * config/bfin/bfin.c (bfin_expand_binop_builtin): Pass entire CALL_EXPR instead of arglist. Use new CALL_EXPR accessors. Fix callers. (bfin_expand_unop_builtin): Likewise. (bfin_expand_builtin): Use new CALL_EXPR accessors. 2007-02-15 Sandra Loosemore <sandra@codesourcery.com> Brooks Moses <brooks.moses@codesourcery.com> Lee Millward <lee.millward@codesourcery.com> * c-semantics.c (build_stmt): Add internal diagnostic check. * c-pretty-print.c (pp_c_postfix_expression): Use new CALL_EXPR accessors. Print arguments explicitly instead of as a list. * c-typeck.c (build_function_call): Use new CALL_EXPR constructors. * c-omp.c (c_finish_omp_barrier): Use build_call_expr. (c_finish_omp_flish): Likewise. * c-common.c (verify_tree): Use new CALL_EXPR accessors. Traverse arguments explicitly instead of as a list. Use TREE_OPERAND_LENGTH instead of TREE_CODE_LENGTH. (check_function_arguments_recurse): Use new CALL_EXPR accessors. (c_warn_unused_result): Likewise. 2007-02-15 Sandra Loosemore <sandra@codesourcery.com> Brooks Moses <brooks.moses@codesourcery.com> Lee Millward <lee.millward@codesourcery.com> * cp-tree.def (AGGR_INIT_EXPR): Adjust documentation. Change class to tcc_vl_exp. * call.c (build_call): Use build_call_list instead of build3. (build_over_call): Likewise. (build_new_method_call): Use build_min_non_dep_call_list instead of build_min_non_dep. * error.c (dump_call_expr_args): New function. (dump_aggr_init_expr_args): New function. (dump_expr) <AGGR_INIT_EXPR, CALL_EXPR, INDIRECT_REF>: Use them. Update to use new CALL_EXPR and AGGR_INIT_EXPR accessor macros. * cvt.c (convert_to_void): Use build_call_array instead of build3; use new AGGR_INIT_EXPR accessor macros. * mangle.c (write_expression): Use TREE_OPERAND_LENGTH instead of TREE_CODE_LENGTH. * dump.c (cp_dump_tree) <AGGR_INIT_EXPR>: Update to use new AGGR_INIT_EXPR accessor macros. * cp-gimplify.c (cp_gimplify_init_expr): Use AGGR_INIT_EXPR_SLOT to set the slot operand. * cp-tree.h (AGGR_INIT_EXPR_FN): New macro. (AGGR_INIT_EXPR_SLOT): New macro. (AGGR_INIT_EXPR_ARG): New macro. (aggr_init_expr_nargs): New macro. (AGGR_INIT_EXPR_ARGP): New macro. (aggr_init_expr_arg_iterator): New. (init_aggr_init_expr_arg_iterator): New. (next_aggr_init_expr_arg): New. (first_aggr_init_expr_arg): New. (more_aggr_init_expr_args_p): New. (FOR_EACH_AGGR_INIT_EXPR_ARG): New. (stabilize_aggr_init): New declaration. (build_min_non_dep_call_list): Likewise. * tree.c (process_aggr_init_operands): New function. (build_aggr_init_array) New function. (build_cplus_new): Update to use new CALL_EXPR and AGGR_INIT_EXPR accessor macros. Replace use of build3 with build_aggr_init_array. (build_min_non_dep_call_list) New function. (build_min_nt): Assert input code parameter is not a variable length expression class. (build_min, build_min_non_dep): Likewise. (cp_tree_equal) <CALL_EXPR>: Iterate through the arguments to check for equality instead of recursing. Handle tcc_vl_exp tree code classes. (stabilize_call): Update to only handle CALL_EXPRs, not AGGR_INIT_EXPRs; use new CALL_EXPR accessor macros. (stabilize_aggr_init): New function. (stabilize_init): Use it. * cxx-pretty-print.c (pp_cxx_postfix_expression) <AGGR_INIT_EXPR, CALL_EXPR>: Update to use new CALL_EXPR and AGGR_INIT_EXPR accessor macros and argument iterators. * pt.c (tsubst_copy) <CALL_EXPR>: Replace build_nt with build_vl_exp. Iterate through the operands, recursively processing each one. (tsubst_copy_and_build) <CALL_EXPR>: Update to use new CALL_EXPR accessor macros. (value_dependent_expression_p) <default>: Handle tcc_vl_exp tree code classes. Use TREE_OPERAND_LENGTH instead of TREE_CODE_LENGTH. * semantics.c (finish_call_expr): Use build_nt_call_list instead of build_nt. (simplify_aggr_init_expr): Update to use new AGGR_INIT_EXPR accessor macros. Use build_call_array to construct the CALL_EXPR node instead of build3 * decl2.c (build_offset_ref_call_from_tree): Use build_nt_call_list and build_min_non_dep_call_list instead of build_min_nt and build_min_non_dep. * parser.c (cp_parser_postfix_expression) <CPP_OPEN_PAREN>: Use build_nt_call_list instead of build_min_nt. 2007-02-15 Sandra Loosemore <sandra@codesourcery.com> Brooks Moses <brooks.moses@codesourcery.com> Lee Millward <lee.millward@codesourcery.com> * java-tree.h (BUILD_MONITOR_ENTER): Use build_call_nary instead of build3. (BUILD_MONITOR_EXIT): Likewise. * java-gimplify.c (java_gimplify_component_ref): Use build_call_expr. (java_gimplify_modify_expr): Likewise. * class.c (cache_this_class_ref): Use build_call_expr. (build_static_field_ref): Likewise. (emit_indirect_register_classes): Likewise. (emit_register_classes): Likewise. * resource.c (write_resource_constructor): Use build_call_expr. * builtins.c (builtin_creator_function): Change interpretation of the second parameter to be the whole CALL_EXPR instead of the arglist. (max_builtin): Tweak parameter list. Use new CALL_EXPR accessors. (min_builtin): Likewise. (abs_builtin): Likewise. (java_build_function_call_expr): Likewise. (convert_real): Likewise. (UNMARSHAL3): Likewise. (UNMARSHAL4): Likewise. (UNMARSHAL5): Likewise. (build_arglist_for_builtin): Delete. Fix callers to use build_call_expr instead. (putObject_builtin): Tweak parameter list. Use new CALL_EXPR accessors. (compareAndSwapInt_builtin): Likewise. (compareAndSwapLong_builtin): Likewise. (compareAndSwapObject_builtin): Likewise. (putVolatile_builtin): Likewise. (getVolatile_builtin): Likewise. (VMSupportsCS8_builtin): Likewise. (check_for_builtin): Pass entire CALL_EXPR to builtin expander instead of arglist. * expr.c (build_java_athrow): Use build_call_nary instead of build3. (build_java_throw_out_of_bounds_exception): Likewise. (java_check_reference): Likewise. (build_java_arraystore_check): Likewise. (build_newarray): Likewise. (build_anewarray): Likewise. (expand_java_multinewarray): Use build_call_list instead of build3. (build_java_monitor): Use build_call_nary instead of build3. (java_create_object): Likewise. (expand_java_NEW): Likewise. (build_instanceof): Likewise. (expand_java_CHECKCAST): Likewise. (build_java_soft_divmod): Likewise. (build_java_binop): Likewise. (build_field_ref): Likewise. (build_class_init): Likewise. (rewrite_arglist_getcaller): Use build_call_expr. (build_invokeinterface): Use build_call_nary instead of build3. (expand_invoke): Use build_call_list instead of build3. (build_jni_stub): Use build_call_nary, build_call_list, or build_call_expr instead of build3. (expand_java_field_op): Use build_call_expr instead of build3. (force_evaluation_order): Use new CALL_EXPR accessors. * lang.c (java_get_callee_fndecl): Use new CALL_EXPR accessors. 2007-02-15 Sandra Loosemore <sandra@codesourcery.com> Brooks Moses <brooks.moses@codesourcery.com> Lee Millward <lee.millward@codesourcery.com> * objc-act.c (receiver_is_class_object): Use new CALL_EXPR accessors. (objc_get_callee_fndecl): Likewise. 2007-02-15 Sandra Loosemore <sandra@codesourcery.com> Brooks Moses <brooks.moses@codesourcery.com> Lee Millward <lee.millward@codesourcery.com> * trans-expr.c (gfc_conv_power_op): Use build_call_expr. (gfc_conv_string_tmp): Likewise. (gfc_conv_concat_op): Likewise. (gfc_build_compare_string): Likewise. (gfc_conv_function_call): Use build_call_list instead of build3. * trans-array.c (gfc_trans_allocate_array_storage): Use build_call_expr. (gfc_grow_array): Likewise. (gfc_trans_array_ctor_element): Likewise. (gfc_trans_array_constructor_value): Likewise. (gfc_array_allocate): Likewise. (gfc_array_deallocate): Likewise. (gfc_trans_auto_array_allocation): Likewise. (gfc_trans_dummy_array_bias): Likewise. (gfc_conv_array_parameter): Likewise. (gfc_trans_dealloc_allocated): Likewise. (gfc_duplicate_allocatable): Likewise. * trans-openmp.c (gfc_trans_omp_barrier): Use build_call_expr. (gfc_trans_omp_flush): Likewise. * trans-stmt.c (gfc_conv_elementel_dependencies): Use build_call_expr. (gfc_trans_pause): Likewise. (gfc_trans_stop): Likewise. (gfc_trans_character_select): Likewise. (gfc_do_allocate): Likewise. (gfc_trans_assign_need_temp): Likewise. (gfc_trans_pointer_assign_need_temp): Likewise. (gfc_trans_forall_1): Likewise. (gfc_trans_where_2): Likewise. (gfc_trans_allocate): Likewise. (gfc_trans_deallocate): Likewise. * trans.c (gfc_trans_runtime_check): Use build_call_expr. * trans-io.c (gfc_trans_open): Use build_call_expr. (gfc_trans_close): Likewise. (build_filepos): Likewise. (gfc_trans_inquire): Likewise. (NML_FIRST_ARG): Delete. (NML_ADD_ARG): Delete. (transfer_namelist_element): Use build_call_expr. (build_dt): Likewise. (gfc_trans_dt_end): Likewise. (transfer_expr): Likewise. (transfer_array-desc): Likewise. * trans-decl.c (gfc_generate_function_code): Use build_call_expr. (gfc_generate_constructors): Likewise. * trans-intrinsic.c (gfc_conv_intrinsic_ctime): Use build_call_expr. (gfc_conv_intrinsic_fdate): Likewise. (gfc_conv_intrinsic_ttynam): Likewise. (gfc_conv_intrinsic_array_transfer): Likewise. (gfc_conv_associated): Likewise. (gfc_conv_intrinsic_si_kind): Likewise. (gfc_conv_intrinsic_trim): Likewise. (gfc_conv_intrinsic_repeat: Likewise. (gfc_conv_intrinsic_iargc): Likewise. Co-Authored-By: Brooks Moses <brooks.moses@codesourcery.com> Co-Authored-By: Lee Millward <lee.millward@codesourcery.com> From-SVN: r122018
2007-02-16 00:50:49 +01:00
tree addr = CALL_EXPR_FN (call_expr);
if (TREE_CODE (addr) != OBJ_TYPE_REF)
return 0;
addr = OBJ_TYPE_REF_EXPR (addr);
/* If the address is just `&f' for some function `f', then we know
that `f' is being called. */
if (TREE_CODE (addr) == ADDR_EXPR
&& TREE_CODE (TREE_OPERAND (addr, 0)) == FUNCTION_DECL)
return TREE_OPERAND (addr, 0);
return 0;
}
#include "gt-objc-objc-act.h"